launchiamenterprise / keyrunner

KeyRunner: A secure, codeless VS Code extension for API testing & Designing. Features include data encryption at rest, sensitive data masking, and the innovative Playground for chaining API requests without coding
https://keyrunner.app
MIT License
15 stars 1 forks source link

Add support for importing external libraries #55

Closed zachdev closed 1 month ago

zachdev commented 2 months ago

It would be helpful to be able to reference external libraries in the scripting functionality of the app.

launchiamenterprise commented 1 month ago

@zachdev this feature is in testing phase and will be released with V#1.0.66 (Available for download on 10/7)

frank-duq commented 1 month ago

what a great news, can't wait for this feature to come, I was actually - at time of writing - playing with keyrunner for the first time, after migrating away from postman (for one main reason: I hit their 25-collections-run-limit-per-month !)....that's it, I'm done with postman, moving away.

but now, the large collection that I've imported from postman into keyrunner relies on the usage of a 3rd party lib that postman was offering out-of-the-box / e.g. fully integrated within their tool without any additional add-on installation required (more info here), which ends up being super useful for generating 'random' data on every given request/collection run, to avoid data collisions etc, super useful.

I've some hopes that the mentioned above wip feature will allow me to do something equivalent (e.g. get my hands on some 3rd party lib which allows to generate random data to be injected in request body from request pre-script generated env/collection variables normally, Faker or anything else, but obviously a big plus for Faker..).

Knowing that such Faker 3rd party lib is actually an npm package in the first place, not sure if that will be supported here, any insights @launchiamenterprise on what kind of external libs will be supported here?

Also, any revised/updated ETA for this one, no pressure obviously, only being curious (and to determine if I shall just wait and test once it's out, or start working on some workaround solutions right away...) ?

launchiamenterprise commented 1 month ago

@frank-duq We are glad to hear you are trying out KeyRunner after migrating from Postman. You can definitely use the Faker library in your pre/post scripts to generate random data. We are currently experiencing a technical challenge with another issue, which has delayed the release of our new version. However, we tentatively expect to roll it out within the next 1-2 days. We will update this thread once its released with documentation on usage of third party libraries.

faker

frank-duq commented 1 month ago

What an amazing news, thank you so much and looking forward it I'll definitely stay tuned on this thread!

Amazing product btw, so far I've a good first impression. Keyrunner seems to have a great potential to become a serious replacement candidate/alternative for postman! One step at a time!;-)

launchiamenterprise commented 1 month ago

@zachdev @frank-duq this feature is introduced with V#1.0.67. Please update to latest

here is the documentation : https://docs.keyrunner.app/docs/ExternalLibraries.html

frank-duq commented 1 month ago

@launchiamenterprise from the online doc, if I take faker as an example, it is saying to import it as:

var faker = require('faker');

but this is currently not working (using v1.0.67) and generating a pre-script error when executed.

Instead, I had to rely on the screenshot example that you've provided above, and do:

var faker = kr.lib.faker;

Is this expected or a bug? or perhaps the online doc should just be updated accordingly?


Also, I was wondering if there was a way to know what "version" of a lib is being imported? For instance, when I import faker as per the above, I could be wrong but it seems to be fakerjs v8.x, rather than their latest v9.x, is it possible? I was trying to use one of their more recent update/feature some months back present in their 9.x releases, e.g. faker.phone.number({ style: 'international' }) (ref.) but this is not working, passing such {style: ...} option doesn't seem to be supported with the current keyrunner imported faker lib version, and I had to fallback on using what was supported in their v8.x, e.g. faker.phone.number() and parse the result.

That is fine, I understand that exposing Keyrunner to external libs is a super amazing feature (truly!), but at the same time, it opens the door to having to maintain the list of libs and update them over time etc.. but what would be nice, if you could find an easy way for you to maintain it, would be to publish perhaps on that online doc page what lib version you're making available to us, so that we know which lib's online documentation version to look for, to determine what lib features to use, and which ones not.

just a suggestion! thanks!