-
Notifications
You must be signed in to change notification settings - Fork 678
feat: migrate from axios to fetch #2591
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
45 commits
Select commit
Hold shift + click to select a range
c3b962b
chore: drop Node.js 18 support for web-api and webhook
WilliamBergamin 5033bcd
chore: sync package-lock.json after dropping Node.js 18 support
WilliamBergamin ea9eefa
improve naming
WilliamBergamin cdcf067
fix: move from axios to fetch
WilliamBergamin ae5cc24
update from v8
WilliamBergamin 13183aa
make rtm use older version of packages
WilliamBergamin b0063a0
use undici in socket-mode
WilliamBergamin 896baad
Merge branch 'v8' into mirgate-from-axios-to-fetch
WilliamBergamin 9482c57
improve behavior based on review
WilliamBergamin 57a72fc
imporve based on review
WilliamBergamin 5ecd0c1
improve based on prototyping
WilliamBergamin 0be3856
improve based on review and prototyping
WilliamBergamin c4f96b5
Update SlackWebSocket.ts
WilliamBergamin db2e290
simplify changes
WilliamBergamin 1256822
Merge branch 'v8' into mirgate-from-axios-to-fetch
WilliamBergamin a4162b2
Update package.json
WilliamBergamin 6836ffe
Merge branch 'v8' into mirgate-from-axios-to-fetch
WilliamBergamin 6fa7843
improve based on review
WilliamBergamin a910040
Merge branch 'v8' into mirgate-from-axios-to-fetch
WilliamBergamin 27d87bf
clean up the unit tests
WilliamBergamin 6af858d
make things work
WilliamBergamin 52ed3d8
restore preveously deleted comments
WilliamBergamin 79b798e
update the type from the package
WilliamBergamin 0d17317
Merge branch 'v8' into mirgate-from-axios-to-fetch
WilliamBergamin 811a029
Update package-lock.json
WilliamBergamin fa22c7e
Merge branch 'v8' into mirgate-from-axios-to-fetch
WilliamBergamin 5ecb21d
fix accept header being set by axios previously
WilliamBergamin 504875c
Merge branch 'v8' into mirgate-from-axios-to-fetch
WilliamBergamin c5a944d
fix issue where axios was added back in
WilliamBergamin 2f57822
we aren't returning the correct response from start
WilliamBergamin 234a516
make undici a peer dependency
WilliamBergamin e3bf6ed
improve devxp of fetch typing
WilliamBergamin 6d9ad8e
Improve abstraction between our lib and undici types
WilliamBergamin 6d26252
Improve typing of socketmode dispatcher configuration
WilliamBergamin b585c95
improve type casting behaviors
WilliamBergamin 941bc00
Improve based on feedback
WilliamBergamin 4be1919
Update packages/web-api/src/WebClient.ts
WilliamBergamin e26413e
Update packages/web-api/src/WebClient.ts
WilliamBergamin 2b193ed
Update packages/socket-mode/examples/proxy.js
WilliamBergamin 9cacf5b
improve docstring
WilliamBergamin aaa5792
Improve typescript
WilliamBergamin 4214294
fix linting issues
WilliamBergamin a79685b
Fix intergration test command
WilliamBergamin dc79d75
improve test stability with fetch changes
WilliamBergamin 3f11848
Apply suggestion from @srtaalej
WilliamBergamin 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,17 +1,18 @@ | ||
| const { SocketModeClient, LogLevel } = require('@slack/socket-mode'); | ||
| const HttpsProxyAgent = require('https-proxy-agent'); | ||
| const clientOptions = { agent: new HttpsProxyAgent('http://localhost:9001') }; | ||
| const { ProxyAgent } = require('undici'); | ||
|
|
||
| const dispatcher = new ProxyAgent('http://localhost:9001'); | ||
|
|
||
| const socketModeClient = new SocketModeClient({ | ||
| appToken: process.env.SLACK_APP_TOKEN, | ||
| logLevel: LogLevel.DEBUG, | ||
| clientOptions, | ||
| dispatcher, | ||
| }); | ||
|
|
||
| // const { WebClient } = require('@slack/web-api'); | ||
| // const webClient = new WebClient(process.env.SLACK_BOT_TOKEN, { | ||
| // logLevel: LogLevel.DEBUG, | ||
| // clientOptions, | ||
| // fetch: (url, options) => fetch(url, { ...options, dispatcher }) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 praise: Big fan of how this can be reused! |
||
| // }); | ||
|
|
||
| socketModeClient.on('slack_event', async ({ ack, body }) => { | ||
|
|
||
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
Oops, something went wrong.
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.