-
Notifications
You must be signed in to change notification settings - Fork 4
feat(axios-client-adapter): add support for configurable proxy #257
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
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
ff47336
feat(axios-client-adapter): add support for configurable proxy
Ayeshas09 0a0d184
refactor(proxy): extract proxy configuration to its own package
Ayeshas09 32cedaf
test(axios-client-adapter): add tests to cover httpClient.ts
Ayeshas09 7c7e657
refactor: apply PR review suggestions
Ayeshas09 8d5cfdf
refactor: fix imports
Ayeshas09 fcacc9d
refactor: apply PR review suggestions
Ayeshas09 ac311bd
refactor: apply PR review suggestions
Ayeshas09 60d0d73
refactor(axios-client-adapter): make setProxyAgent private
Ayeshas09 f5b219a
refactor(axios-client-adapter): add ProxySettings export in index.ts
Ayeshas09 a372a38
ci: add workflow for PR analysis
Ayeshas09 27c4808
ci: fix branch name for PR analysis
Ayeshas09 0dbbcfc
ci: rename workflow
Ayeshas09 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| name: SonarQube Scan | ||
| on: | ||
| push: | ||
| branches: [master] | ||
| pull_request: | ||
| branches: [master] | ||
|
|
||
| jobs: | ||
| check: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v2 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| - uses: actions/setup-node@v1 | ||
| with: | ||
| node-version: "18.x" | ||
|
|
||
| - name: Install deps | ||
| run: yarn | ||
|
|
||
| - name: Build | ||
| run: yarn build | ||
|
|
||
| - name: Test | ||
| run: yarn test | ||
|
|
||
| - name: SonarQube Scan | ||
| if: ${{ github.actor != 'dependabot[bot]' }} | ||
| uses: SonarSource/sonarqube-scan-action@v5.2.0 | ||
| env: | ||
| SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
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
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
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
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
This file was deleted.
Oops, something went wrong.
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| # APIMatic Proxy Libary for JavaScript | ||
|
|
||
| > This library is currently in preview. | ||
|
|
||
| Provides utility functions to generate HTTP and HTTPS proxy agents based on configuration. It supports conditional behavior for both Node.js and browser environments. | ||
|
|
||
| The exported helper functions and interfaces include: | ||
|
|
||
| 1. **createProxyAgents**: Creates and returns HTTP and HTTPS proxy agents using provided proxy settings. In browser environments, this function returns undefined with a warning, as proxy agents are not supported in browsers. | ||
| 2. **ProxySettings**: Defines the proxy configuration, including a required address and optional port and authentication credentials. | ||
|
|
||
| This library is used by JavaScript SDKs generated by the [APIMatic Code Generator](http://www.apimatic.io). | ||
|
|
||
| ## Builds | ||
|
|
||
| The following environments are supported: | ||
|
|
||
| 1. Node.js v14+ and v16+ | ||
| 1. Bundlers like Rollup or Webpack | ||
| 1. Web browsers | ||
|
|
||
| To support multiple environments, we export various builds: | ||
|
|
||
| | Environment | Usage | | ||
| | --- |----------------------------------------------------------------------------| | ||
| | Common.js | Import like this: `require('@apimatic/proxy')`. | | ||
| | ES Module | Import like this: `import { /* your imports */ } from '@apimatic/proxy'`. | | ||
| | Browsers | *Use script: `https://unpkg.com/@apimatic/proxy@VERSION/umd/schema.js` | | ||
| | Modern Browsers (supports ESM and uses modern JS) | *Use script: `https://unpkg.com/@apimatic/proxy@VERSION/umd/schema.esm.js` | | ||
|
|
||
| _* Don't forget to replace VERSION with the version number._ | ||
|
|
||
| **Note**: We discourage importing files or modules directly from the package. These are likely to change in the future and should not be considered stable. |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| const { jest: lernaAliases } = require('lerna-alias'); | ||
|
|
||
| module.exports = { | ||
| preset: 'ts-jest', | ||
| moduleNameMapper: lernaAliases(), | ||
| coverageReporters: [['lcov', { projectRoot: '../../' }]] | ||
| }; |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| { | ||
| "name": "@apimatic/proxy", | ||
| "version": "0.1.0", | ||
| "description": "provides utilities to route requests through a configurable proxy", | ||
| "main": "lib/index.js", | ||
| "module": "lib/index.js", | ||
| "types": "lib/index.d.ts", | ||
| "engines": { | ||
| "node": ">=14.15.0 || >=16.0.0" | ||
| }, | ||
| "scripts": { | ||
| "clean": "rimraf lib es umd tsconfig.tsbuildinfo", | ||
| "test": "jest --passWithNoTests", | ||
| "build": "npm run clean && tsc && rollup -c --bundleConfigAsCjs && npm run annotate:es", | ||
| "annotate:es": "babel es --out-dir es --no-babelrc --plugins annotate-pure-calls", | ||
| "preversion": "npm run test", | ||
| "prepublishOnly": "npm run build", | ||
| "size": "size-limit", | ||
| "analyze": "size-limit --why", | ||
| "lint": "tslint --project .", | ||
| "lint:fix": "tslint --project . --fix", | ||
| "check-style": "prettier --check \"{src,test}/**/*.ts\"", | ||
| "check-style:fix": "prettier --write \"{src,test}/**/*.ts\"" | ||
| }, | ||
| "author": "APIMatic Ltd.", | ||
| "license": "ISC", | ||
| "browser": { | ||
| "./lib/proxyAgent.js": "./lib/proxyAgentBrowser.js" | ||
| }, | ||
| "dependencies": { | ||
| "http-proxy-agent": "^7.0.2", | ||
| "https-proxy-agent": "^7.0.6" | ||
| }, | ||
| "publishConfig": { | ||
| "access": "public" | ||
| }, | ||
| "repository": { | ||
| "type": "git", | ||
| "url": "git@github.com:apimatic/apimatic-js-runtime.git", | ||
| "directory": "packages/proxy" | ||
| } | ||
| } |
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.