-
Couldn't load subscription status.
- Fork 6
feat: support for making installation string generation dynamic #269
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
src/index.ts
Outdated
| } | ||
|
|
||
| const { installation } = target.clientsById[clientId || target.info.default]; | ||
| const results = this.requests.map(request => (installation ? installation(request, options) : false)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i don't totally follow why this is an array. is it because you can pass several HAR files into this library?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah that's correct. it's not something we've ever done and is just holdoverr from upstream
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks great ty! reminder to publish this as a breaking change
| expect(result).toBe('This was generated from a custom client.'); | ||
|
|
||
| const install = snippet.installation('node', 'custom')[0]; | ||
| expect(install).toBe('brew install https://httpbin.org/anything'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hell yeah thank you!
| return results; | ||
| } | ||
|
|
||
| installation(targetId: TargetId, clientId?: ClientId, options?: any) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry one more thing — wanna make this return type a little stricter?
| installation(targetId: TargetId, clientId?: ClientId, options?: any) { | |
| installation(targetId: TargetId, clientId?: ClientId, options?: any): (string | false)[] { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the inferred type is a little messy atm:
HTTPSnippet.installation(targetId: TargetId, clientId?: ClientId, options?: any): (string | false)[] | boolean[]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
going to do isolateddeclarations in a followup
🧰 Changes
We're working on some enhancements for HTTP snippet generation for external partners and need to make plugin installation strings dynamic -- this reworks how
installationis set up on a client basis to allow for this.