Skip to content

Commit

Permalink
Merge pull request #1121 from MeilCli/update/action
Browse files Browse the repository at this point in the history
update actions
  • Loading branch information
MeilCli authored Oct 24, 2024
2 parents 240b773 + f502cc4 commit f550ac7
Showing 1 changed file with 29 additions and 11 deletions.
40 changes: 29 additions & 11 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4855,8 +4855,11 @@ var WebClientEvent;
class WebClient extends methods_1.Methods {
/**
* @param token - An API token to authenticate/authorize with Slack (usually start with `xoxp`, `xoxb`)
* @param {Object} [webClientOptions] - Configuration options.
* @param {Function} [webClientOptions.requestInterceptor] - An interceptor to mutate outgoing requests. See {@link https://axios-http.com/docs/interceptors Axios interceptors}
* @param {Function} [webClientOptions.adapter] - An adapter to allow custom handling of requests. Useful if you would like to use a pre-configured http client. See {@link https://github.com/axios/axios/blob/v1.x/README.md?plain=1#L586 Axios adapter}
*/
constructor(token, { slackApiUrl = 'https://slack.com/api/', logger = undefined, logLevel = undefined, maxRequestConcurrency = 100, retryConfig = retry_policies_1.tenRetriesInAboutThirtyMinutes, agent = undefined, tls = undefined, timeout = 0, rejectRateLimitedCalls = false, headers = {}, teamId = undefined, attachOriginalToWebAPIRequestError = true, } = {}) {
constructor(token, { slackApiUrl = 'https://slack.com/api/', logger = undefined, logLevel = undefined, maxRequestConcurrency = 100, retryConfig = retry_policies_1.tenRetriesInAboutThirtyMinutes, agent = undefined, tls = undefined, timeout = 0, rejectRateLimitedCalls = false, headers = {}, teamId = undefined, attachOriginalToWebAPIRequestError = true, requestInterceptor = undefined, adapter = undefined, } = {}) {
super();
this.token = token;
this.slackApiUrl = slackApiUrl;
Expand All @@ -4880,12 +4883,12 @@ class WebClient extends methods_1.Methods {
if (this.token && !headers.Authorization)
headers.Authorization = `Bearer ${this.token}`;
this.axios = axios_1.default.create({
adapter: adapter ? (config) => adapter(Object.assign(Object.assign({}, config), { adapter: undefined })) : undefined,
timeout,
baseURL: slackApiUrl,
headers: (0, is_electron_1.default)() ? headers : Object.assign({ 'User-Agent': (0, instrument_1.getUserAgent)() }, headers),
httpAgent: agent,
httpsAgent: agent,
transformRequest: [this.serializeApiCallOptions.bind(this)],
validateStatus: () => true, // all HTTP status codes should result in a resolved promise (as opposed to only 2xx)
maxRedirects: 0,
// disabling axios' automatic proxy support:
Expand All @@ -4894,8 +4897,14 @@ class WebClient extends methods_1.Methods {
// protocols), users of this package should use the `agent` option to configure a proxy.
proxy: false,
});
// serializeApiCallOptions will always determine the appropriate content-type
// serializeApiCallData will always determine the appropriate content-type
this.axios.defaults.headers.post['Content-Type'] = undefined;
// request interceptors have reversed execution order
// see: https://github.com/axios/axios/blob/v1.x/test/specs/interceptors.spec.js#L88
if (requestInterceptor) {
this.axios.interceptors.request.use(requestInterceptor, null);
}
this.axios.interceptors.request.use(this.serializeApiCallData.bind(this), null);
this.logger.debug('initialized');
}
/**
Expand Down Expand Up @@ -5227,15 +5236,15 @@ class WebClient extends methods_1.Methods {
* a string, used when posting with a content-type of url-encoded. Or, it can be a readable stream, used
* when the options contain a binary (a stream or a buffer) and the upload should be done with content-type
* multipart/form-data.
* @param options - arguments for the Web API method
* @param headers - a mutable object representing the HTTP headers for the outgoing request
* @param config - The Axios request configuration object
*/
serializeApiCallOptions(options, headers) {
serializeApiCallData(config) {
const { data, headers } = config;
// The following operation both flattens complex objects into a JSON-encoded strings and searches the values for
// binary content
let containsBinaryData = false;
// biome-ignore lint/suspicious/noExplicitAny: call options can be anything
const flattened = Object.entries(options).map(([key, value]) => {
// biome-ignore lint/suspicious/noExplicitAny: HTTP request data can be anything
const flattened = Object.entries(data).map(([key, value]) => {
if (value === undefined || value === null) {
return [];
}
Expand Down Expand Up @@ -5285,19 +5294,23 @@ class WebClient extends methods_1.Methods {
headers[header] = value;
}
}
return form;
config.data = form;
config.headers = headers;
return config;
}
// Otherwise, a simple key-value object is returned
if (headers)
headers['Content-Type'] = 'application/x-www-form-urlencoded';
// biome-ignore lint/suspicious/noExplicitAny: form values can be anything
const initialValue = {};
return (0, node_querystring_1.stringify)(flattened.reduce((accumulator, [key, value]) => {
config.data = (0, node_querystring_1.stringify)(flattened.reduce((accumulator, [key, value]) => {
if (key !== undefined && value !== undefined) {
accumulator[key] = value;
}
return accumulator;
}, initialValue));
config.headers = headers;
return config;
}
/**
* Processes an HTTP response into a WebAPICallResult by performing JSON parsing on the body and merging relevant
Expand Down Expand Up @@ -7109,6 +7122,11 @@ class Methods extends eventemitter3_1.EventEmitter {
* @see {@link https://api.slack.com/methods/conversations.requestSharedInvite.deny `conversations.requestSharedInvite.deny` API reference}.
*/
deny: bindApiCall(this, 'conversations.requestSharedInvite.deny'),
/**
* @description Lists requests to add external users to channels with ability to filter.
* @see {@link https://api.slack.com/methods/conversations.requestSharedInvite.list `conversations.requestSharedInvite.list` API reference}.
*/
list: bindApiCallWithOptionalArgument(this, 'conversations.requestSharedInvite.list'),
},
/**
* @description Sets the purpose for a conversation.
Expand Down Expand Up @@ -19291,7 +19309,7 @@ module.exports = axios;
/***/ ((module) => {

"use strict";
module.exports = /*#__PURE__*/JSON.parse('{"name":"@slack/web-api","version":"7.5.0","description":"Official library for using the Slack Platform\'s Web API","author":"Slack Technologies, LLC","license":"MIT","keywords":["slack","web-api","bot","client","http","api","proxy","rate-limiting","pagination"],"main":"dist/index.js","types":"./dist/index.d.ts","files":["dist/**/*"],"engines":{"node":">= 18","npm":">= 8.6.0"},"repository":"slackapi/node-slack-sdk","homepage":"https://slack.dev/node-slack-sdk/web-api","publishConfig":{"access":"public"},"bugs":{"url":"https://github.com/slackapi/node-slack-sdk/issues"},"scripts":{"prepare":"npm run build","build":"npm run build:clean && tsc","build:clean":"shx rm -rf ./dist ./coverage","lint":"npx @biomejs/biome check --write .","mocha":"mocha --config .mocharc.json \\"./src/**/*.spec.ts\\"","test":"npm run lint && npm run test:types && npm run test:integration && npm run test:unit","test:integration":"npm run build && node test/integration/commonjs-project/index.js && node test/integration/esm-project/index.mjs && npm run test:integration:ts","test:integration:ts":"cd test/integration/ts-4.7-project && npm i && npm run build","test:unit":"npm run build && c8 npm run mocha","test:types":"tsd","watch":"npx nodemon --watch \'src\' --ext \'ts\' --exec npm run build"},"dependencies":{"@slack/logger":"^4.0.0","@slack/types":"^2.9.0","@types/node":">=18.0.0","@types/retry":"0.12.0","axios":"^1.7.4","eventemitter3":"^5.0.1","form-data":"^4.0.0","is-electron":"2.2.2","is-stream":"^2","p-queue":"^6","p-retry":"^4","retry":"^0.13.1"},"devDependencies":{"@biomejs/biome":"^1.8.3","@tsconfig/recommended":"^1","@types/busboy":"^1.5.4","@types/chai":"^4","@types/mocha":"^10","@types/sinon":"^17","busboy":"^1","c8":"^10.1.2","chai":"^4","mocha":"^10","nock":"^13","shx":"^0.3.2","sinon":"^19","source-map-support":"^0.5.21","ts-node":"^10","tsd":"^0.31.1","typescript":"5.3.3"},"tsd":{"directory":"test/types"}}');
module.exports = /*#__PURE__*/JSON.parse('{"name":"@slack/web-api","version":"7.7.0","description":"Official library for using the Slack Platform\'s Web API","author":"Slack Technologies, LLC","license":"MIT","keywords":["slack","web-api","bot","client","http","api","proxy","rate-limiting","pagination"],"main":"dist/index.js","types":"./dist/index.d.ts","files":["dist/**/*"],"engines":{"node":">= 18","npm":">= 8.6.0"},"repository":"slackapi/node-slack-sdk","homepage":"https://slack.dev/node-slack-sdk/web-api","publishConfig":{"access":"public"},"bugs":{"url":"https://github.com/slackapi/node-slack-sdk/issues"},"scripts":{"prepare":"npm run build","build":"npm run build:clean && tsc","build:clean":"shx rm -rf ./dist ./coverage","lint":"npx @biomejs/biome check --write .","mocha":"mocha --config .mocharc.json \\"./src/**/*.spec.ts\\"","test":"npm run lint && npm run test:types && npm run test:integration && npm run test:unit","test:integration":"npm run build && node test/integration/commonjs-project/index.js && node test/integration/esm-project/index.mjs && npm run test:integration:ts","test:integration:ts":"cd test/integration/ts-4.7-project && npm i && npm run build","test:unit":"npm run build && c8 npm run mocha","test:types":"tsd","watch":"npx nodemon --watch \'src\' --ext \'ts\' --exec npm run build"},"dependencies":{"@slack/logger":"^4.0.0","@slack/types":"^2.9.0","@types/node":">=18.0.0","@types/retry":"0.12.0","axios":"^1.7.4","eventemitter3":"^5.0.1","form-data":"^4.0.0","is-electron":"2.2.2","is-stream":"^2","p-queue":"^6","p-retry":"^4","retry":"^0.13.1"},"devDependencies":{"@biomejs/biome":"^1.8.3","@tsconfig/recommended":"^1","@types/busboy":"^1.5.4","@types/chai":"^4","@types/mocha":"^10","@types/sinon":"^17","busboy":"^1","c8":"^10.1.2","chai":"^4","mocha":"^10","nock":"^13","shx":"^0.3.2","sinon":"^19","source-map-support":"^0.5.21","ts-node":"^10","tsd":"^0.31.1","typescript":"5.3.3"},"tsd":{"directory":"test/types"}}');

/***/ }),

Expand Down

0 comments on commit f550ac7

Please sign in to comment.