feat: support for making installation string generation dynamic#269
Merged
feat: support for making installation string generation dynamic#269
Conversation
erunion
commented
Apr 8, 2025
kanadgupta
suggested changes
Apr 8, 2025
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.
i don't totally follow why this is an array. is it because you can pass several HAR files into this library?
Member
Author
There was a problem hiding this comment.
yeah that's correct. it's not something we've ever done and is just holdoverr from upstream
kanadgupta
approved these changes
Apr 8, 2025
kanadgupta
left a comment
There was a problem hiding this comment.
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'); |
kanadgupta
reviewed
Apr 8, 2025
| return results; | ||
| } | ||
|
|
||
| installation(targetId: TargetId, clientId?: ClientId, options?: any) { |
There was a problem hiding this comment.
sorry one more thing — wanna make this return type a little stricter?
Suggested change
| installation(targetId: TargetId, clientId?: ClientId, options?: any) { | |
| installation(targetId: TargetId, clientId?: ClientId, options?: any): (string | false)[] { |
There was a problem hiding this comment.
the inferred type is a little messy atm:
HTTPSnippet.installation(targetId: TargetId, clientId?: ClientId, options?: any): (string | false)[] | boolean[]
Member
Author
There was a problem hiding this comment.
going to do isolateddeclarations in a followup
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🧰 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.