@happyvertical/messages 0.89.9 → 0.89.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +7 -4627
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -1,20 +1,9 @@
|
|
|
1
1
|
import { a as InvalidMessageError, c as RateLimitError, i as ConnectionError, l as SendError, n as AuthenticationError, o as MessageNotFoundError, r as ChannelNotFoundError, s as MessagingError, t as BaseMessageClient } from "./chunks/base-DWpO_9_P.js";
|
|
2
2
|
import { getEmailClient, getEmailClient as getEmailClient$1 } from "@happyvertical/email";
|
|
3
|
+
import { WebClient } from "@slack/web-api";
|
|
3
4
|
import { createHmac } from "node:crypto";
|
|
4
5
|
//#region \0rolldown/runtime.js
|
|
5
6
|
var __defProp = Object.defineProperty;
|
|
6
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
7
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
8
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
-
var __esmMin = (fn, res, err) => () => {
|
|
10
|
-
if (err) throw err[0];
|
|
11
|
-
try {
|
|
12
|
-
return fn && (res = fn(fn = 0)), res;
|
|
13
|
-
} catch (e) {
|
|
14
|
-
throw err = [e], e;
|
|
15
|
-
}
|
|
16
|
-
};
|
|
17
|
-
var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
|
|
18
7
|
var __exportAll = (all, no_symbols) => {
|
|
19
8
|
let target = {};
|
|
20
9
|
for (var name in all) __defProp(target, name, {
|
|
@@ -24,21 +13,6 @@ var __exportAll = (all, no_symbols) => {
|
|
|
24
13
|
if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
25
14
|
return target;
|
|
26
15
|
};
|
|
27
|
-
var __copyProps = (to, from, except, desc) => {
|
|
28
|
-
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
29
|
-
key = keys[i];
|
|
30
|
-
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
31
|
-
get: ((k) => from[k]).bind(null, key),
|
|
32
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
return to;
|
|
36
|
-
};
|
|
37
|
-
var __toCommonJS = (mod) => __hasOwnProp.call(mod, "module.exports") ? mod["module.exports"] : __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
38
|
-
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, { get: (a, b) => (typeof require !== "undefined" ? require : a)[b] }) : x)(function(x) {
|
|
39
|
-
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
40
|
-
throw Error("Calling `require` for \"" + x + "\" in an environment that doesn't expose the `require` function. See https://rolldown.rs/in-depth/bundling-cjs#require-external-modules for more details.");
|
|
41
|
-
});
|
|
42
16
|
//#endregion
|
|
43
17
|
//#region src/adapters/email-bridge.ts
|
|
44
18
|
/**
|
|
@@ -190,4607 +164,13 @@ var EmailBridgeAdapter = class extends BaseMessageClient {
|
|
|
190
164
|
}
|
|
191
165
|
};
|
|
192
166
|
//#endregion
|
|
193
|
-
//#region ../../node_modules/.pnpm/@slack+web-api@7.15.1_debug@4.4.3_supports-color@8.1.1_/node_modules/@slack/web-api/dist/errors.js
|
|
194
|
-
var require_errors = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
195
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
196
|
-
exports.ErrorCode = void 0;
|
|
197
|
-
exports.errorWithCode = errorWithCode;
|
|
198
|
-
exports.requestErrorWithOriginal = requestErrorWithOriginal;
|
|
199
|
-
exports.httpErrorFromResponse = httpErrorFromResponse;
|
|
200
|
-
exports.platformErrorFromResult = platformErrorFromResult;
|
|
201
|
-
exports.rateLimitedErrorWithDelay = rateLimitedErrorWithDelay;
|
|
202
|
-
/**
|
|
203
|
-
* A dictionary of codes for errors produced by this package
|
|
204
|
-
*/
|
|
205
|
-
var ErrorCode;
|
|
206
|
-
(function(ErrorCode) {
|
|
207
|
-
ErrorCode["RequestError"] = "slack_webapi_request_error";
|
|
208
|
-
ErrorCode["HTTPError"] = "slack_webapi_http_error";
|
|
209
|
-
ErrorCode["PlatformError"] = "slack_webapi_platform_error";
|
|
210
|
-
ErrorCode["RateLimitedError"] = "slack_webapi_rate_limited_error";
|
|
211
|
-
ErrorCode["FileUploadInvalidArgumentsError"] = "slack_webapi_file_upload_invalid_args_error";
|
|
212
|
-
ErrorCode["FileUploadReadFileDataError"] = "slack_webapi_file_upload_read_file_data_error";
|
|
213
|
-
})(ErrorCode || (exports.ErrorCode = ErrorCode = {}));
|
|
214
|
-
/**
|
|
215
|
-
* Factory for producing a {@link CodedError} from a generic error
|
|
216
|
-
*/
|
|
217
|
-
function errorWithCode(error, code) {
|
|
218
|
-
const codedError = error;
|
|
219
|
-
codedError.code = code;
|
|
220
|
-
return codedError;
|
|
221
|
-
}
|
|
222
|
-
/**
|
|
223
|
-
* A factory to create WebAPIRequestError objects
|
|
224
|
-
* @param original - original error
|
|
225
|
-
* @param attachOriginal - config indicating if 'original' property should be added on the error object
|
|
226
|
-
*/
|
|
227
|
-
function requestErrorWithOriginal(original, attachOriginal) {
|
|
228
|
-
const error = errorWithCode(/* @__PURE__ */ new Error(`A request error occurred: ${original.message}`), ErrorCode.RequestError);
|
|
229
|
-
if (attachOriginal) error.original = original;
|
|
230
|
-
return error;
|
|
231
|
-
}
|
|
232
|
-
/**
|
|
233
|
-
* A factory to create WebAPIHTTPError objects
|
|
234
|
-
* @param response - original error
|
|
235
|
-
*/
|
|
236
|
-
function httpErrorFromResponse(response) {
|
|
237
|
-
const error = errorWithCode(/* @__PURE__ */ new Error(`An HTTP protocol error occurred: statusCode = ${response.status}`), ErrorCode.HTTPError);
|
|
238
|
-
error.statusCode = response.status;
|
|
239
|
-
error.statusMessage = response.statusText;
|
|
240
|
-
const nonNullHeaders = {};
|
|
241
|
-
for (const k of Object.keys(response.headers)) if (k && response.headers[k]) nonNullHeaders[k] = response.headers[k];
|
|
242
|
-
error.headers = nonNullHeaders;
|
|
243
|
-
error.body = response.data;
|
|
244
|
-
return error;
|
|
245
|
-
}
|
|
246
|
-
/**
|
|
247
|
-
* A factory to create WebAPIPlatformError objects
|
|
248
|
-
* @param result - Web API call result
|
|
249
|
-
*/
|
|
250
|
-
function platformErrorFromResult(result) {
|
|
251
|
-
const error = errorWithCode(/* @__PURE__ */ new Error(`An API error occurred: ${result.error}`), ErrorCode.PlatformError);
|
|
252
|
-
error.data = result;
|
|
253
|
-
return error;
|
|
254
|
-
}
|
|
255
|
-
/**
|
|
256
|
-
* A factory to create WebAPIRateLimitedError objects
|
|
257
|
-
* @param retrySec - Number of seconds that the request can be retried in
|
|
258
|
-
*/
|
|
259
|
-
function rateLimitedErrorWithDelay(retrySec) {
|
|
260
|
-
const error = errorWithCode(/* @__PURE__ */ new Error(`A rate-limit has been reached, you may retry this request in ${retrySec} seconds`), ErrorCode.RateLimitedError);
|
|
261
|
-
error.retryAfter = retrySec;
|
|
262
|
-
return error;
|
|
263
|
-
}
|
|
264
|
-
}));
|
|
265
|
-
//#endregion
|
|
266
|
-
//#region ../../node_modules/.pnpm/@slack+web-api@7.15.1_debug@4.4.3_supports-color@8.1.1_/node_modules/@slack/web-api/package.json
|
|
267
|
-
var package_exports = /* @__PURE__ */ __exportAll({
|
|
268
|
-
author: () => author,
|
|
269
|
-
bugs: () => bugs,
|
|
270
|
-
default: () => package_default,
|
|
271
|
-
dependencies: () => dependencies,
|
|
272
|
-
description: () => description,
|
|
273
|
-
devDependencies: () => devDependencies,
|
|
274
|
-
engines: () => engines,
|
|
275
|
-
files: () => files,
|
|
276
|
-
homepage: () => homepage,
|
|
277
|
-
keywords: () => keywords,
|
|
278
|
-
license: () => "MIT",
|
|
279
|
-
main: () => main,
|
|
280
|
-
name: () => name,
|
|
281
|
-
publishConfig: () => publishConfig,
|
|
282
|
-
repository: () => repository,
|
|
283
|
-
scripts: () => scripts,
|
|
284
|
-
tsd: () => tsd,
|
|
285
|
-
types: () => types,
|
|
286
|
-
version: () => version
|
|
287
|
-
}), name, version, description, author, keywords, main, types, files, engines, repository, homepage, publishConfig, bugs, scripts, dependencies, devDependencies, tsd, package_default;
|
|
288
|
-
var init_package = __esmMin((() => {
|
|
289
|
-
name = "@slack/web-api";
|
|
290
|
-
version = "7.15.1";
|
|
291
|
-
description = "Official library for using the Slack Platform's Web API";
|
|
292
|
-
author = "Slack Technologies, LLC";
|
|
293
|
-
keywords = [
|
|
294
|
-
"slack",
|
|
295
|
-
"web-api",
|
|
296
|
-
"bot",
|
|
297
|
-
"client",
|
|
298
|
-
"http",
|
|
299
|
-
"api",
|
|
300
|
-
"proxy",
|
|
301
|
-
"rate-limiting",
|
|
302
|
-
"pagination"
|
|
303
|
-
];
|
|
304
|
-
main = "dist/index.js";
|
|
305
|
-
types = "./dist/index.d.ts";
|
|
306
|
-
files = ["dist/**/*"];
|
|
307
|
-
engines = {
|
|
308
|
-
"node": ">= 18",
|
|
309
|
-
"npm": ">= 8.6.0"
|
|
310
|
-
};
|
|
311
|
-
repository = {
|
|
312
|
-
"type": "git",
|
|
313
|
-
"url": "git+https://github.com/slackapi/node-slack-sdk.git"
|
|
314
|
-
};
|
|
315
|
-
homepage = "https://docs.slack.dev/tools/node-slack-sdk/web-api/";
|
|
316
|
-
publishConfig = { "access": "public" };
|
|
317
|
-
bugs = { "url": "https://github.com/slackapi/node-slack-sdk/issues" };
|
|
318
|
-
scripts = {
|
|
319
|
-
"build": "npm run build:clean && tsc",
|
|
320
|
-
"build:clean": "shx rm -rf ./dist",
|
|
321
|
-
"docs": "npx typedoc --plugin typedoc-plugin-markdown",
|
|
322
|
-
"prepack": "npm run build",
|
|
323
|
-
"test": "npm run test:unit",
|
|
324
|
-
"test:node18": "npm run build && bash -c 'node --test --test-reporter=spec --import tsx src/*.test.ts'",
|
|
325
|
-
"test:integration": "npm run build && node test/integration/commonjs-project/index.js && node test/integration/esm-project/index.mjs && npm run test:integration:ts",
|
|
326
|
-
"test:integration:ts": "cd test/integration/ts-4.7-project && npm i && npm run build",
|
|
327
|
-
"test:types": "tsd",
|
|
328
|
-
"test:unit": "npm run build && node --experimental-test-coverage --test-reporter=spec --test-reporter-destination=stdout --test-reporter=lcov --test-reporter-destination=lcov.info --test-reporter=junit --test-reporter-destination=test-results.xml --import tsx --test src/*.test.ts",
|
|
329
|
-
"watch": "npx nodemon --watch 'src' --ext 'ts' --exec npm run build"
|
|
330
|
-
};
|
|
331
|
-
dependencies = {
|
|
332
|
-
"@slack/logger": "^4.0.1",
|
|
333
|
-
"@slack/types": "^2.20.1",
|
|
334
|
-
"@types/node": ">=18",
|
|
335
|
-
"@types/retry": "0.12.0",
|
|
336
|
-
"axios": "^1.15.0",
|
|
337
|
-
"eventemitter3": "^5.0.1",
|
|
338
|
-
"form-data": "^4.0.4",
|
|
339
|
-
"is-electron": "2.2.2",
|
|
340
|
-
"is-stream": "^2",
|
|
341
|
-
"p-queue": "^6",
|
|
342
|
-
"p-retry": "^4",
|
|
343
|
-
"retry": "^0.13.1"
|
|
344
|
-
};
|
|
345
|
-
devDependencies = {
|
|
346
|
-
"@types/busboy": "^1.5.4",
|
|
347
|
-
"@types/sinon": "^21",
|
|
348
|
-
"busboy": "^1",
|
|
349
|
-
"nock": "^14",
|
|
350
|
-
"sinon": "^21",
|
|
351
|
-
"tsd": "^0.33.0"
|
|
352
|
-
};
|
|
353
|
-
tsd = { "directory": "test/types" };
|
|
354
|
-
package_default = {
|
|
355
|
-
name,
|
|
356
|
-
version,
|
|
357
|
-
description,
|
|
358
|
-
author,
|
|
359
|
-
license: "MIT",
|
|
360
|
-
keywords,
|
|
361
|
-
main,
|
|
362
|
-
types,
|
|
363
|
-
files,
|
|
364
|
-
engines,
|
|
365
|
-
repository,
|
|
366
|
-
homepage,
|
|
367
|
-
publishConfig,
|
|
368
|
-
bugs,
|
|
369
|
-
scripts,
|
|
370
|
-
dependencies,
|
|
371
|
-
devDependencies,
|
|
372
|
-
tsd
|
|
373
|
-
};
|
|
374
|
-
}));
|
|
375
|
-
//#endregion
|
|
376
|
-
//#region ../../node_modules/.pnpm/@slack+web-api@7.15.1_debug@4.4.3_supports-color@8.1.1_/node_modules/@slack/web-api/dist/instrument.js
|
|
377
|
-
var require_instrument = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
378
|
-
var __createBinding = exports && exports.__createBinding || (Object.create ? (function(o, m, k, k2) {
|
|
379
|
-
if (k2 === void 0) k2 = k;
|
|
380
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
381
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) desc = {
|
|
382
|
-
enumerable: true,
|
|
383
|
-
get: function() {
|
|
384
|
-
return m[k];
|
|
385
|
-
}
|
|
386
|
-
};
|
|
387
|
-
Object.defineProperty(o, k2, desc);
|
|
388
|
-
}) : (function(o, m, k, k2) {
|
|
389
|
-
if (k2 === void 0) k2 = k;
|
|
390
|
-
o[k2] = m[k];
|
|
391
|
-
}));
|
|
392
|
-
var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? (function(o, v) {
|
|
393
|
-
Object.defineProperty(o, "default", {
|
|
394
|
-
enumerable: true,
|
|
395
|
-
value: v
|
|
396
|
-
});
|
|
397
|
-
}) : function(o, v) {
|
|
398
|
-
o["default"] = v;
|
|
399
|
-
});
|
|
400
|
-
var __importStar = exports && exports.__importStar || (function() {
|
|
401
|
-
var ownKeys = function(o) {
|
|
402
|
-
ownKeys = Object.getOwnPropertyNames || function(o) {
|
|
403
|
-
var ar = [];
|
|
404
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
405
|
-
return ar;
|
|
406
|
-
};
|
|
407
|
-
return ownKeys(o);
|
|
408
|
-
};
|
|
409
|
-
return function(mod) {
|
|
410
|
-
if (mod && mod.__esModule) return mod;
|
|
411
|
-
var result = {};
|
|
412
|
-
if (mod != null) {
|
|
413
|
-
for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
414
|
-
}
|
|
415
|
-
__setModuleDefault(result, mod);
|
|
416
|
-
return result;
|
|
417
|
-
};
|
|
418
|
-
})();
|
|
419
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
420
|
-
exports.addAppMetadata = addAppMetadata;
|
|
421
|
-
exports.getUserAgent = getUserAgent;
|
|
422
|
-
var os = __importStar(__require("node:os"));
|
|
423
|
-
var node_path_1$1 = __require("node:path");
|
|
424
|
-
var packageJson = (init_package(), __toCommonJS(package_exports).default);
|
|
425
|
-
/**
|
|
426
|
-
* Replaces occurrences of '/' with ':' in a string, since '/' is meaningful inside User-Agent strings as a separator.
|
|
427
|
-
*/
|
|
428
|
-
function replaceSlashes(s) {
|
|
429
|
-
return s.replace("/", ":");
|
|
430
|
-
}
|
|
431
|
-
var MAX_LATIN1_CODE = 255;
|
|
432
|
-
/**
|
|
433
|
-
* Ensures a string is safe for use in HTTP headers by URI-encoding characters outside the Latin-1 (ISO-8859-1) range.
|
|
434
|
-
* Latin-1 characters (code points 0x00–0xFF) are preserved as-is; all others are percent-encoded via encodeURIComponent.
|
|
435
|
-
*/
|
|
436
|
-
function toLatin1Safe(s) {
|
|
437
|
-
let result = "";
|
|
438
|
-
for (const char of s) result += char.charCodeAt(0) <= MAX_LATIN1_CODE ? char : encodeURIComponent(char);
|
|
439
|
-
return result;
|
|
440
|
-
}
|
|
441
|
-
var baseUserAgent = `${replaceSlashes(packageJson.name)}/${packageJson.version} ${toLatin1Safe((0, node_path_1$1.basename)(process.title))}/${process.version.replace("v", "")} ${os.platform()}/${os.release()}`;
|
|
442
|
-
var appMetadata = {};
|
|
443
|
-
/**
|
|
444
|
-
* Appends the app metadata into the User-Agent value
|
|
445
|
-
* @param appMetadata.name - name of tool to be counted in instrumentation
|
|
446
|
-
* @param appMetadata.version - version of tool to be counted in instrumentation
|
|
447
|
-
*/
|
|
448
|
-
function addAppMetadata({ name, version }) {
|
|
449
|
-
appMetadata[replaceSlashes(name)] = version;
|
|
450
|
-
}
|
|
451
|
-
/**
|
|
452
|
-
* Returns the current User-Agent value for instrumentation
|
|
453
|
-
*/
|
|
454
|
-
function getUserAgent() {
|
|
455
|
-
const appIdentifier = Object.entries(appMetadata).map(([name, version]) => `${name}/${version}`).join(" ");
|
|
456
|
-
return (appIdentifier.length > 0 ? `${appIdentifier} ` : "") + baseUserAgent;
|
|
457
|
-
}
|
|
458
|
-
}));
|
|
459
|
-
//#endregion
|
|
460
|
-
//#region ../../node_modules/.pnpm/@slack+logger@4.0.1/node_modules/@slack/logger/dist/index.js
|
|
461
|
-
var require_dist$3 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
462
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
463
|
-
exports.ConsoleLogger = exports.LogLevel = void 0;
|
|
464
|
-
/**
|
|
465
|
-
* Severity levels for log entries
|
|
466
|
-
*/
|
|
467
|
-
var LogLevel;
|
|
468
|
-
(function(LogLevel) {
|
|
469
|
-
LogLevel["ERROR"] = "error";
|
|
470
|
-
LogLevel["WARN"] = "warn";
|
|
471
|
-
LogLevel["INFO"] = "info";
|
|
472
|
-
LogLevel["DEBUG"] = "debug";
|
|
473
|
-
})(LogLevel || (exports.LogLevel = LogLevel = {}));
|
|
474
|
-
/**
|
|
475
|
-
* Default logger which logs to stdout and stderr
|
|
476
|
-
*/
|
|
477
|
-
var ConsoleLogger = class ConsoleLogger {
|
|
478
|
-
constructor() {
|
|
479
|
-
this.level = LogLevel.INFO;
|
|
480
|
-
this.name = "";
|
|
481
|
-
}
|
|
482
|
-
getLevel() {
|
|
483
|
-
return this.level;
|
|
484
|
-
}
|
|
485
|
-
/**
|
|
486
|
-
* Sets the instance's log level so that only messages which are equal or more severe are output to the console.
|
|
487
|
-
*/
|
|
488
|
-
setLevel(level) {
|
|
489
|
-
this.level = level;
|
|
490
|
-
}
|
|
491
|
-
/**
|
|
492
|
-
* Set the instance's name, which will appear on each log line before the message.
|
|
493
|
-
*/
|
|
494
|
-
setName(name) {
|
|
495
|
-
this.name = name;
|
|
496
|
-
}
|
|
497
|
-
/**
|
|
498
|
-
* Log a debug message
|
|
499
|
-
*/
|
|
500
|
-
debug(...msg) {
|
|
501
|
-
if (ConsoleLogger.isMoreOrEqualSevere(LogLevel.DEBUG, this.level)) console.debug(ConsoleLogger.labels.get(LogLevel.DEBUG), this.name, ...msg);
|
|
502
|
-
}
|
|
503
|
-
/**
|
|
504
|
-
* Log an info message
|
|
505
|
-
*/
|
|
506
|
-
info(...msg) {
|
|
507
|
-
if (ConsoleLogger.isMoreOrEqualSevere(LogLevel.INFO, this.level)) console.info(ConsoleLogger.labels.get(LogLevel.INFO), this.name, ...msg);
|
|
508
|
-
}
|
|
509
|
-
/**
|
|
510
|
-
* Log a warning message
|
|
511
|
-
*/
|
|
512
|
-
warn(...msg) {
|
|
513
|
-
if (ConsoleLogger.isMoreOrEqualSevere(LogLevel.WARN, this.level)) console.warn(ConsoleLogger.labels.get(LogLevel.WARN), this.name, ...msg);
|
|
514
|
-
}
|
|
515
|
-
/**
|
|
516
|
-
* Log an error message
|
|
517
|
-
*/
|
|
518
|
-
error(...msg) {
|
|
519
|
-
if (ConsoleLogger.isMoreOrEqualSevere(LogLevel.ERROR, this.level)) console.error(ConsoleLogger.labels.get(LogLevel.ERROR), this.name, ...msg);
|
|
520
|
-
}
|
|
521
|
-
/**
|
|
522
|
-
* Helper to compare two log levels and determine if a is equal or more severe than b
|
|
523
|
-
*/
|
|
524
|
-
static isMoreOrEqualSevere(a, b) {
|
|
525
|
-
return ConsoleLogger.severity[a] >= ConsoleLogger.severity[b];
|
|
526
|
-
}
|
|
527
|
-
};
|
|
528
|
-
exports.ConsoleLogger = ConsoleLogger;
|
|
529
|
-
/** Map of labels for each log level */
|
|
530
|
-
ConsoleLogger.labels = (() => {
|
|
531
|
-
const map = Object.entries(LogLevel).map(([key, value]) => [value, `[${key}] `]);
|
|
532
|
-
return new Map(map);
|
|
533
|
-
})();
|
|
534
|
-
/** Map of severity as comparable numbers for each log level */
|
|
535
|
-
ConsoleLogger.severity = {
|
|
536
|
-
[LogLevel.ERROR]: 400,
|
|
537
|
-
[LogLevel.WARN]: 300,
|
|
538
|
-
[LogLevel.INFO]: 200,
|
|
539
|
-
[LogLevel.DEBUG]: 100
|
|
540
|
-
};
|
|
541
|
-
}));
|
|
542
|
-
//#endregion
|
|
543
|
-
//#region ../../node_modules/.pnpm/@slack+web-api@7.15.1_debug@4.4.3_supports-color@8.1.1_/node_modules/@slack/web-api/dist/logger.js
|
|
544
|
-
var require_logger = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
545
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
546
|
-
exports.LogLevel = void 0;
|
|
547
|
-
exports.getLogger = getLogger;
|
|
548
|
-
var logger_1 = require_dist$3();
|
|
549
|
-
var logger_2 = require_dist$3();
|
|
550
|
-
Object.defineProperty(exports, "LogLevel", {
|
|
551
|
-
enumerable: true,
|
|
552
|
-
get: function() {
|
|
553
|
-
return logger_2.LogLevel;
|
|
554
|
-
}
|
|
555
|
-
});
|
|
556
|
-
var instanceCount = 0;
|
|
557
|
-
/**
|
|
558
|
-
* INTERNAL interface for getting or creating a named Logger.
|
|
559
|
-
*/
|
|
560
|
-
function getLogger(name, level, existingLogger) {
|
|
561
|
-
const instanceId = instanceCount;
|
|
562
|
-
instanceCount += 1;
|
|
563
|
-
const logger = (() => {
|
|
564
|
-
if (existingLogger !== void 0) return existingLogger;
|
|
565
|
-
return new logger_1.ConsoleLogger();
|
|
566
|
-
})();
|
|
567
|
-
logger.setName(`web-api:${name}:${instanceId}`);
|
|
568
|
-
if (level !== void 0) logger.setLevel(level);
|
|
569
|
-
return logger;
|
|
570
|
-
}
|
|
571
|
-
}));
|
|
572
|
-
//#endregion
|
|
573
|
-
//#region ../../node_modules/.pnpm/@slack+web-api@7.15.1_debug@4.4.3_supports-color@8.1.1_/node_modules/@slack/web-api/dist/retry-policies.js
|
|
574
|
-
var require_retry_policies = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
575
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
576
|
-
exports.rapidRetryPolicy = exports.fiveRetriesInFiveMinutes = exports.tenRetriesInAboutThirtyMinutes = void 0;
|
|
577
|
-
/**
|
|
578
|
-
* The default retry policy. Retry up to 10 times, over the span of about 30 minutes. It's not exact because
|
|
579
|
-
* randomization has been added to prevent a stampeding herd problem (if all instances in your application are retrying
|
|
580
|
-
* a request at the exact same intervals, they are more likely to cause failures for each other).
|
|
581
|
-
*/
|
|
582
|
-
exports.tenRetriesInAboutThirtyMinutes = {
|
|
583
|
-
retries: 10,
|
|
584
|
-
factor: 1.96821,
|
|
585
|
-
randomize: true
|
|
586
|
-
};
|
|
587
|
-
/**
|
|
588
|
-
* Short & sweet, five retries in five minutes and then bail.
|
|
589
|
-
*/
|
|
590
|
-
exports.fiveRetriesInFiveMinutes = {
|
|
591
|
-
retries: 5,
|
|
592
|
-
factor: 3.86
|
|
593
|
-
};
|
|
594
|
-
/**
|
|
595
|
-
* This policy is just to keep the tests running fast.
|
|
596
|
-
*/
|
|
597
|
-
exports.rapidRetryPolicy = {
|
|
598
|
-
minTimeout: 0,
|
|
599
|
-
maxTimeout: 1
|
|
600
|
-
};
|
|
601
|
-
exports.default = {
|
|
602
|
-
tenRetriesInAboutThirtyMinutes: exports.tenRetriesInAboutThirtyMinutes,
|
|
603
|
-
fiveRetriesInFiveMinutes: exports.fiveRetriesInFiveMinutes,
|
|
604
|
-
rapidRetryPolicy: exports.rapidRetryPolicy
|
|
605
|
-
};
|
|
606
|
-
}));
|
|
607
|
-
//#endregion
|
|
608
|
-
//#region ../../node_modules/.pnpm/@slack+web-api@7.15.1_debug@4.4.3_supports-color@8.1.1_/node_modules/@slack/web-api/dist/types/request/index.js
|
|
609
|
-
var require_request = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
610
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
611
|
-
}));
|
|
612
|
-
//#endregion
|
|
613
|
-
//#region ../../node_modules/.pnpm/@slack+web-api@7.15.1_debug@4.4.3_supports-color@8.1.1_/node_modules/@slack/web-api/dist/types/response/index.js
|
|
614
|
-
var require_response = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
615
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
616
|
-
}));
|
|
617
|
-
//#endregion
|
|
618
|
-
//#region ../../node_modules/.pnpm/@slack+web-api@7.15.1_debug@4.4.3_supports-color@8.1.1_/node_modules/@slack/web-api/dist/chat-stream.js
|
|
619
|
-
var require_chat_stream = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
620
|
-
var __rest = exports && exports.__rest || function(s, e) {
|
|
621
|
-
var t = {};
|
|
622
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
623
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function") {
|
|
624
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
625
|
-
}
|
|
626
|
-
return t;
|
|
627
|
-
};
|
|
628
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
629
|
-
exports.ChatStreamer = void 0;
|
|
630
|
-
var ChatStreamer = class {
|
|
631
|
-
/**
|
|
632
|
-
* Instantiate a new chat streamer.
|
|
633
|
-
*
|
|
634
|
-
* @description The "constructor" method creates a unique {@link ChatStreamer} instance that keeps track of one chat stream.
|
|
635
|
-
* @example
|
|
636
|
-
* const client = new WebClient(process.env.SLACK_BOT_TOKEN);
|
|
637
|
-
* const logger = new ConsoleLogger();
|
|
638
|
-
* const args = {
|
|
639
|
-
* channel: "C0123456789",
|
|
640
|
-
* thread_ts: "1700000001.123456",
|
|
641
|
-
* recipient_team_id: "T0123456789",
|
|
642
|
-
* recipient_user_id: "U0123456789",
|
|
643
|
-
* };
|
|
644
|
-
* const streamer = new ChatStreamer(client, logger, args, { buffer_size: 512 });
|
|
645
|
-
* await streamer.append({
|
|
646
|
-
* markdown_text: "**hello world!**",
|
|
647
|
-
* });
|
|
648
|
-
* await streamer.stop();
|
|
649
|
-
* @see {@link https://docs.slack.dev/reference/methods/chat.startStream}
|
|
650
|
-
* @see {@link https://docs.slack.dev/reference/methods/chat.appendStream}
|
|
651
|
-
* @see {@link https://docs.slack.dev/reference/methods/chat.stopStream}
|
|
652
|
-
*/
|
|
653
|
-
constructor(client, logger, args, options) {
|
|
654
|
-
var _a;
|
|
655
|
-
this.buffer = "";
|
|
656
|
-
this.client = client;
|
|
657
|
-
this.logger = logger;
|
|
658
|
-
this.options = { buffer_size: (_a = options.buffer_size) !== null && _a !== void 0 ? _a : 256 };
|
|
659
|
-
this.state = "starting";
|
|
660
|
-
this.streamArgs = args;
|
|
661
|
-
}
|
|
662
|
-
/**
|
|
663
|
-
* Append to the stream.
|
|
664
|
-
*
|
|
665
|
-
* @description The "append" method appends to the chat stream being used. This method can be called multiple times. After the stream is stopped this method cannot be called.
|
|
666
|
-
* @example
|
|
667
|
-
* const streamer = client.chatStream({
|
|
668
|
-
* channel: "C0123456789",
|
|
669
|
-
* thread_ts: "1700000001.123456",
|
|
670
|
-
* recipient_team_id: "T0123456789",
|
|
671
|
-
* recipient_user_id: "U0123456789",
|
|
672
|
-
* });
|
|
673
|
-
* await streamer.append({
|
|
674
|
-
* markdown_text: "**hello wo",
|
|
675
|
-
* });
|
|
676
|
-
* await streamer.append({
|
|
677
|
-
* markdown_text: "rld!**",
|
|
678
|
-
* });
|
|
679
|
-
* await streamer.stop();
|
|
680
|
-
* @see {@link https://docs.slack.dev/reference/methods/chat.appendStream}
|
|
681
|
-
*/
|
|
682
|
-
async append(args) {
|
|
683
|
-
if (this.state === "completed") throw new Error(`failed to append stream: stream state is ${this.state}`);
|
|
684
|
-
const { markdown_text, chunks } = args, opts = __rest(args, ["markdown_text", "chunks"]);
|
|
685
|
-
if (opts.token) this.token = opts.token;
|
|
686
|
-
if (markdown_text) this.buffer += markdown_text;
|
|
687
|
-
if (this.buffer.length >= this.options.buffer_size || chunks) return await this.flushBuffer(Object.assign({ chunks }, opts));
|
|
688
|
-
const details = {
|
|
689
|
-
bufferLength: this.buffer.length,
|
|
690
|
-
bufferSize: this.options.buffer_size,
|
|
691
|
-
channel: this.streamArgs.channel,
|
|
692
|
-
recipientTeamId: this.streamArgs.recipient_team_id,
|
|
693
|
-
recipientUserId: this.streamArgs.recipient_user_id,
|
|
694
|
-
threadTs: this.streamArgs.thread_ts
|
|
695
|
-
};
|
|
696
|
-
this.logger.debug(`ChatStreamer appended to buffer: ${JSON.stringify(details)}`);
|
|
697
|
-
return null;
|
|
698
|
-
}
|
|
699
|
-
/**
|
|
700
|
-
* Stop the stream and finalize the message.
|
|
701
|
-
*
|
|
702
|
-
* @description The "stop" method stops the chat stream being used. This method can be called once to end the stream. Additional "blocks" and "metadata" can be provided.
|
|
703
|
-
*
|
|
704
|
-
* @example
|
|
705
|
-
* const streamer = client.chatStream({
|
|
706
|
-
* channel: "C0123456789",
|
|
707
|
-
* thread_ts: "1700000001.123456",
|
|
708
|
-
* recipient_team_id: "T0123456789",
|
|
709
|
-
* recipient_user_id: "U0123456789",
|
|
710
|
-
* });
|
|
711
|
-
* await streamer.append({
|
|
712
|
-
* markdown_text: "**hello world!**",
|
|
713
|
-
* });
|
|
714
|
-
* await streamer.stop();
|
|
715
|
-
* @see {@link https://docs.slack.dev/reference/methods/chat.stopStream}
|
|
716
|
-
*/
|
|
717
|
-
async stop(args) {
|
|
718
|
-
if (this.state === "completed") throw new Error(`failed to stop stream: stream state is ${this.state}`);
|
|
719
|
-
const _a = args !== null && args !== void 0 ? args : {}, { markdown_text, chunks } = _a, opts = __rest(_a, ["markdown_text", "chunks"]);
|
|
720
|
-
if (opts.token) this.token = opts.token;
|
|
721
|
-
if (markdown_text) this.buffer += markdown_text;
|
|
722
|
-
if (!this.streamTs) {
|
|
723
|
-
const response = await this.client.chat.startStream(Object.assign(Object.assign({}, this.streamArgs), { token: this.token }));
|
|
724
|
-
if (!response.ts) throw new Error("failed to stop stream: stream not started");
|
|
725
|
-
this.streamTs = response.ts;
|
|
726
|
-
this.state = "in_progress";
|
|
727
|
-
}
|
|
728
|
-
const chunksToFlush = [];
|
|
729
|
-
if (this.buffer.length > 0) chunksToFlush.push({
|
|
730
|
-
type: "markdown_text",
|
|
731
|
-
text: this.buffer
|
|
732
|
-
});
|
|
733
|
-
if (chunks) chunksToFlush.push(...chunks);
|
|
734
|
-
const response = await this.client.chat.stopStream(Object.assign({
|
|
735
|
-
token: this.token,
|
|
736
|
-
channel: this.streamArgs.channel,
|
|
737
|
-
ts: this.streamTs,
|
|
738
|
-
chunks: chunksToFlush
|
|
739
|
-
}, opts));
|
|
740
|
-
this.state = "completed";
|
|
741
|
-
return response;
|
|
742
|
-
}
|
|
743
|
-
async flushBuffer(args) {
|
|
744
|
-
const _a = args !== null && args !== void 0 ? args : {}, { chunks } = _a, opts = __rest(_a, ["chunks"]);
|
|
745
|
-
const chunksToFlush = [];
|
|
746
|
-
if (this.buffer.length > 0) chunksToFlush.push({
|
|
747
|
-
type: "markdown_text",
|
|
748
|
-
text: this.buffer
|
|
749
|
-
});
|
|
750
|
-
if (chunks) chunksToFlush.push(...chunks);
|
|
751
|
-
if (!this.streamTs) {
|
|
752
|
-
const response = await this.client.chat.startStream(Object.assign(Object.assign(Object.assign({}, this.streamArgs), {
|
|
753
|
-
token: this.token,
|
|
754
|
-
chunks: chunksToFlush
|
|
755
|
-
}), opts));
|
|
756
|
-
this.buffer = "";
|
|
757
|
-
this.streamTs = response.ts;
|
|
758
|
-
this.state = "in_progress";
|
|
759
|
-
return response;
|
|
760
|
-
}
|
|
761
|
-
const response = await this.client.chat.appendStream(Object.assign({
|
|
762
|
-
token: this.token,
|
|
763
|
-
channel: this.streamArgs.channel,
|
|
764
|
-
ts: this.streamTs,
|
|
765
|
-
chunks: chunksToFlush
|
|
766
|
-
}, opts));
|
|
767
|
-
this.buffer = "";
|
|
768
|
-
return response;
|
|
769
|
-
}
|
|
770
|
-
};
|
|
771
|
-
exports.ChatStreamer = ChatStreamer;
|
|
772
|
-
}));
|
|
773
|
-
//#endregion
|
|
774
|
-
//#region ../../node_modules/.pnpm/form-data@4.0.5/node_modules/form-data/lib/browser.js
|
|
775
|
-
var require_browser = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
776
|
-
module.exports = typeof self === "object" ? self.FormData : window.FormData;
|
|
777
|
-
}));
|
|
778
|
-
//#endregion
|
|
779
|
-
//#region ../../node_modules/.pnpm/is-electron@2.2.2/node_modules/is-electron/index.js
|
|
780
|
-
var require_is_electron = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
781
|
-
function isElectron() {
|
|
782
|
-
if (typeof window !== "undefined" && typeof window.process === "object" && window.process.type === "renderer") return true;
|
|
783
|
-
if (typeof process !== "undefined" && typeof process.versions === "object" && !!process.versions.electron) return true;
|
|
784
|
-
if (typeof navigator === "object" && typeof navigator.userAgent === "string" && navigator.userAgent.indexOf("Electron") >= 0) return true;
|
|
785
|
-
return false;
|
|
786
|
-
}
|
|
787
|
-
module.exports = isElectron;
|
|
788
|
-
}));
|
|
789
|
-
//#endregion
|
|
790
|
-
//#region ../../node_modules/.pnpm/is-stream@2.0.1/node_modules/is-stream/index.js
|
|
791
|
-
var require_is_stream = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
792
|
-
var isStream = (stream) => stream !== null && typeof stream === "object" && typeof stream.pipe === "function";
|
|
793
|
-
isStream.writable = (stream) => isStream(stream) && stream.writable !== false && typeof stream._write === "function" && typeof stream._writableState === "object";
|
|
794
|
-
isStream.readable = (stream) => isStream(stream) && stream.readable !== false && typeof stream._read === "function" && typeof stream._readableState === "object";
|
|
795
|
-
isStream.duplex = (stream) => isStream.writable(stream) && isStream.readable(stream);
|
|
796
|
-
isStream.transform = (stream) => isStream.duplex(stream) && typeof stream._transform === "function";
|
|
797
|
-
module.exports = isStream;
|
|
798
|
-
}));
|
|
799
|
-
//#endregion
|
|
800
|
-
//#region ../../node_modules/.pnpm/eventemitter3@4.0.7/node_modules/eventemitter3/index.js
|
|
801
|
-
var require_eventemitter3$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
802
|
-
var has = Object.prototype.hasOwnProperty;
|
|
803
|
-
var prefix = "~";
|
|
804
|
-
/**
|
|
805
|
-
* Constructor to create a storage for our `EE` objects.
|
|
806
|
-
* An `Events` instance is a plain object whose properties are event names.
|
|
807
|
-
*
|
|
808
|
-
* @constructor
|
|
809
|
-
* @private
|
|
810
|
-
*/
|
|
811
|
-
function Events() {}
|
|
812
|
-
if (Object.create) {
|
|
813
|
-
Events.prototype = Object.create(null);
|
|
814
|
-
if (!new Events().__proto__) prefix = false;
|
|
815
|
-
}
|
|
816
|
-
/**
|
|
817
|
-
* Representation of a single event listener.
|
|
818
|
-
*
|
|
819
|
-
* @param {Function} fn The listener function.
|
|
820
|
-
* @param {*} context The context to invoke the listener with.
|
|
821
|
-
* @param {Boolean} [once=false] Specify if the listener is a one-time listener.
|
|
822
|
-
* @constructor
|
|
823
|
-
* @private
|
|
824
|
-
*/
|
|
825
|
-
function EE(fn, context, once) {
|
|
826
|
-
this.fn = fn;
|
|
827
|
-
this.context = context;
|
|
828
|
-
this.once = once || false;
|
|
829
|
-
}
|
|
830
|
-
/**
|
|
831
|
-
* Add a listener for a given event.
|
|
832
|
-
*
|
|
833
|
-
* @param {EventEmitter} emitter Reference to the `EventEmitter` instance.
|
|
834
|
-
* @param {(String|Symbol)} event The event name.
|
|
835
|
-
* @param {Function} fn The listener function.
|
|
836
|
-
* @param {*} context The context to invoke the listener with.
|
|
837
|
-
* @param {Boolean} once Specify if the listener is a one-time listener.
|
|
838
|
-
* @returns {EventEmitter}
|
|
839
|
-
* @private
|
|
840
|
-
*/
|
|
841
|
-
function addListener(emitter, event, fn, context, once) {
|
|
842
|
-
if (typeof fn !== "function") throw new TypeError("The listener must be a function");
|
|
843
|
-
var listener = new EE(fn, context || emitter, once), evt = prefix ? prefix + event : event;
|
|
844
|
-
if (!emitter._events[evt]) emitter._events[evt] = listener, emitter._eventsCount++;
|
|
845
|
-
else if (!emitter._events[evt].fn) emitter._events[evt].push(listener);
|
|
846
|
-
else emitter._events[evt] = [emitter._events[evt], listener];
|
|
847
|
-
return emitter;
|
|
848
|
-
}
|
|
849
|
-
/**
|
|
850
|
-
* Clear event by name.
|
|
851
|
-
*
|
|
852
|
-
* @param {EventEmitter} emitter Reference to the `EventEmitter` instance.
|
|
853
|
-
* @param {(String|Symbol)} evt The Event name.
|
|
854
|
-
* @private
|
|
855
|
-
*/
|
|
856
|
-
function clearEvent(emitter, evt) {
|
|
857
|
-
if (--emitter._eventsCount === 0) emitter._events = new Events();
|
|
858
|
-
else delete emitter._events[evt];
|
|
859
|
-
}
|
|
860
|
-
/**
|
|
861
|
-
* Minimal `EventEmitter` interface that is molded against the Node.js
|
|
862
|
-
* `EventEmitter` interface.
|
|
863
|
-
*
|
|
864
|
-
* @constructor
|
|
865
|
-
* @public
|
|
866
|
-
*/
|
|
867
|
-
function EventEmitter() {
|
|
868
|
-
this._events = new Events();
|
|
869
|
-
this._eventsCount = 0;
|
|
870
|
-
}
|
|
871
|
-
/**
|
|
872
|
-
* Return an array listing the events for which the emitter has registered
|
|
873
|
-
* listeners.
|
|
874
|
-
*
|
|
875
|
-
* @returns {Array}
|
|
876
|
-
* @public
|
|
877
|
-
*/
|
|
878
|
-
EventEmitter.prototype.eventNames = function eventNames() {
|
|
879
|
-
var names = [], events, name;
|
|
880
|
-
if (this._eventsCount === 0) return names;
|
|
881
|
-
for (name in events = this._events) if (has.call(events, name)) names.push(prefix ? name.slice(1) : name);
|
|
882
|
-
if (Object.getOwnPropertySymbols) return names.concat(Object.getOwnPropertySymbols(events));
|
|
883
|
-
return names;
|
|
884
|
-
};
|
|
885
|
-
/**
|
|
886
|
-
* Return the listeners registered for a given event.
|
|
887
|
-
*
|
|
888
|
-
* @param {(String|Symbol)} event The event name.
|
|
889
|
-
* @returns {Array} The registered listeners.
|
|
890
|
-
* @public
|
|
891
|
-
*/
|
|
892
|
-
EventEmitter.prototype.listeners = function listeners(event) {
|
|
893
|
-
var evt = prefix ? prefix + event : event, handlers = this._events[evt];
|
|
894
|
-
if (!handlers) return [];
|
|
895
|
-
if (handlers.fn) return [handlers.fn];
|
|
896
|
-
for (var i = 0, l = handlers.length, ee = new Array(l); i < l; i++) ee[i] = handlers[i].fn;
|
|
897
|
-
return ee;
|
|
898
|
-
};
|
|
899
|
-
/**
|
|
900
|
-
* Return the number of listeners listening to a given event.
|
|
901
|
-
*
|
|
902
|
-
* @param {(String|Symbol)} event The event name.
|
|
903
|
-
* @returns {Number} The number of listeners.
|
|
904
|
-
* @public
|
|
905
|
-
*/
|
|
906
|
-
EventEmitter.prototype.listenerCount = function listenerCount(event) {
|
|
907
|
-
var evt = prefix ? prefix + event : event, listeners = this._events[evt];
|
|
908
|
-
if (!listeners) return 0;
|
|
909
|
-
if (listeners.fn) return 1;
|
|
910
|
-
return listeners.length;
|
|
911
|
-
};
|
|
912
|
-
/**
|
|
913
|
-
* Calls each of the listeners registered for a given event.
|
|
914
|
-
*
|
|
915
|
-
* @param {(String|Symbol)} event The event name.
|
|
916
|
-
* @returns {Boolean} `true` if the event had listeners, else `false`.
|
|
917
|
-
* @public
|
|
918
|
-
*/
|
|
919
|
-
EventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) {
|
|
920
|
-
var evt = prefix ? prefix + event : event;
|
|
921
|
-
if (!this._events[evt]) return false;
|
|
922
|
-
var listeners = this._events[evt], len = arguments.length, args, i;
|
|
923
|
-
if (listeners.fn) {
|
|
924
|
-
if (listeners.once) this.removeListener(event, listeners.fn, void 0, true);
|
|
925
|
-
switch (len) {
|
|
926
|
-
case 1: return listeners.fn.call(listeners.context), true;
|
|
927
|
-
case 2: return listeners.fn.call(listeners.context, a1), true;
|
|
928
|
-
case 3: return listeners.fn.call(listeners.context, a1, a2), true;
|
|
929
|
-
case 4: return listeners.fn.call(listeners.context, a1, a2, a3), true;
|
|
930
|
-
case 5: return listeners.fn.call(listeners.context, a1, a2, a3, a4), true;
|
|
931
|
-
case 6: return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true;
|
|
932
|
-
}
|
|
933
|
-
for (i = 1, args = new Array(len - 1); i < len; i++) args[i - 1] = arguments[i];
|
|
934
|
-
listeners.fn.apply(listeners.context, args);
|
|
935
|
-
} else {
|
|
936
|
-
var length = listeners.length, j;
|
|
937
|
-
for (i = 0; i < length; i++) {
|
|
938
|
-
if (listeners[i].once) this.removeListener(event, listeners[i].fn, void 0, true);
|
|
939
|
-
switch (len) {
|
|
940
|
-
case 1:
|
|
941
|
-
listeners[i].fn.call(listeners[i].context);
|
|
942
|
-
break;
|
|
943
|
-
case 2:
|
|
944
|
-
listeners[i].fn.call(listeners[i].context, a1);
|
|
945
|
-
break;
|
|
946
|
-
case 3:
|
|
947
|
-
listeners[i].fn.call(listeners[i].context, a1, a2);
|
|
948
|
-
break;
|
|
949
|
-
case 4:
|
|
950
|
-
listeners[i].fn.call(listeners[i].context, a1, a2, a3);
|
|
951
|
-
break;
|
|
952
|
-
default:
|
|
953
|
-
if (!args) for (j = 1, args = new Array(len - 1); j < len; j++) args[j - 1] = arguments[j];
|
|
954
|
-
listeners[i].fn.apply(listeners[i].context, args);
|
|
955
|
-
}
|
|
956
|
-
}
|
|
957
|
-
}
|
|
958
|
-
return true;
|
|
959
|
-
};
|
|
960
|
-
/**
|
|
961
|
-
* Add a listener for a given event.
|
|
962
|
-
*
|
|
963
|
-
* @param {(String|Symbol)} event The event name.
|
|
964
|
-
* @param {Function} fn The listener function.
|
|
965
|
-
* @param {*} [context=this] The context to invoke the listener with.
|
|
966
|
-
* @returns {EventEmitter} `this`.
|
|
967
|
-
* @public
|
|
968
|
-
*/
|
|
969
|
-
EventEmitter.prototype.on = function on(event, fn, context) {
|
|
970
|
-
return addListener(this, event, fn, context, false);
|
|
971
|
-
};
|
|
972
|
-
/**
|
|
973
|
-
* Add a one-time listener for a given event.
|
|
974
|
-
*
|
|
975
|
-
* @param {(String|Symbol)} event The event name.
|
|
976
|
-
* @param {Function} fn The listener function.
|
|
977
|
-
* @param {*} [context=this] The context to invoke the listener with.
|
|
978
|
-
* @returns {EventEmitter} `this`.
|
|
979
|
-
* @public
|
|
980
|
-
*/
|
|
981
|
-
EventEmitter.prototype.once = function once(event, fn, context) {
|
|
982
|
-
return addListener(this, event, fn, context, true);
|
|
983
|
-
};
|
|
984
|
-
/**
|
|
985
|
-
* Remove the listeners of a given event.
|
|
986
|
-
*
|
|
987
|
-
* @param {(String|Symbol)} event The event name.
|
|
988
|
-
* @param {Function} fn Only remove the listeners that match this function.
|
|
989
|
-
* @param {*} context Only remove the listeners that have this context.
|
|
990
|
-
* @param {Boolean} once Only remove one-time listeners.
|
|
991
|
-
* @returns {EventEmitter} `this`.
|
|
992
|
-
* @public
|
|
993
|
-
*/
|
|
994
|
-
EventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) {
|
|
995
|
-
var evt = prefix ? prefix + event : event;
|
|
996
|
-
if (!this._events[evt]) return this;
|
|
997
|
-
if (!fn) {
|
|
998
|
-
clearEvent(this, evt);
|
|
999
|
-
return this;
|
|
1000
|
-
}
|
|
1001
|
-
var listeners = this._events[evt];
|
|
1002
|
-
if (listeners.fn) {
|
|
1003
|
-
if (listeners.fn === fn && (!once || listeners.once) && (!context || listeners.context === context)) clearEvent(this, evt);
|
|
1004
|
-
} else {
|
|
1005
|
-
for (var i = 0, events = [], length = listeners.length; i < length; i++) if (listeners[i].fn !== fn || once && !listeners[i].once || context && listeners[i].context !== context) events.push(listeners[i]);
|
|
1006
|
-
if (events.length) this._events[evt] = events.length === 1 ? events[0] : events;
|
|
1007
|
-
else clearEvent(this, evt);
|
|
1008
|
-
}
|
|
1009
|
-
return this;
|
|
1010
|
-
};
|
|
1011
|
-
/**
|
|
1012
|
-
* Remove all listeners, or those of the specified event.
|
|
1013
|
-
*
|
|
1014
|
-
* @param {(String|Symbol)} [event] The event name.
|
|
1015
|
-
* @returns {EventEmitter} `this`.
|
|
1016
|
-
* @public
|
|
1017
|
-
*/
|
|
1018
|
-
EventEmitter.prototype.removeAllListeners = function removeAllListeners(event) {
|
|
1019
|
-
var evt;
|
|
1020
|
-
if (event) {
|
|
1021
|
-
evt = prefix ? prefix + event : event;
|
|
1022
|
-
if (this._events[evt]) clearEvent(this, evt);
|
|
1023
|
-
} else {
|
|
1024
|
-
this._events = new Events();
|
|
1025
|
-
this._eventsCount = 0;
|
|
1026
|
-
}
|
|
1027
|
-
return this;
|
|
1028
|
-
};
|
|
1029
|
-
EventEmitter.prototype.off = EventEmitter.prototype.removeListener;
|
|
1030
|
-
EventEmitter.prototype.addListener = EventEmitter.prototype.on;
|
|
1031
|
-
EventEmitter.prefixed = prefix;
|
|
1032
|
-
EventEmitter.EventEmitter = EventEmitter;
|
|
1033
|
-
if ("undefined" !== typeof module) module.exports = EventEmitter;
|
|
1034
|
-
}));
|
|
1035
|
-
//#endregion
|
|
1036
|
-
//#region ../../node_modules/.pnpm/p-finally@1.0.0/node_modules/p-finally/index.js
|
|
1037
|
-
var require_p_finally = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1038
|
-
module.exports = (promise, onFinally) => {
|
|
1039
|
-
onFinally = onFinally || (() => {});
|
|
1040
|
-
return promise.then((val) => new Promise((resolve) => {
|
|
1041
|
-
resolve(onFinally());
|
|
1042
|
-
}).then(() => val), (err) => new Promise((resolve) => {
|
|
1043
|
-
resolve(onFinally());
|
|
1044
|
-
}).then(() => {
|
|
1045
|
-
throw err;
|
|
1046
|
-
}));
|
|
1047
|
-
};
|
|
1048
|
-
}));
|
|
1049
|
-
//#endregion
|
|
1050
|
-
//#region ../../node_modules/.pnpm/p-timeout@3.2.0/node_modules/p-timeout/index.js
|
|
1051
|
-
var require_p_timeout = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1052
|
-
var pFinally = require_p_finally();
|
|
1053
|
-
var TimeoutError = class extends Error {
|
|
1054
|
-
constructor(message) {
|
|
1055
|
-
super(message);
|
|
1056
|
-
this.name = "TimeoutError";
|
|
1057
|
-
}
|
|
1058
|
-
};
|
|
1059
|
-
var pTimeout = (promise, milliseconds, fallback) => new Promise((resolve, reject) => {
|
|
1060
|
-
if (typeof milliseconds !== "number" || milliseconds < 0) throw new TypeError("Expected `milliseconds` to be a positive number");
|
|
1061
|
-
if (milliseconds === Infinity) {
|
|
1062
|
-
resolve(promise);
|
|
1063
|
-
return;
|
|
1064
|
-
}
|
|
1065
|
-
const timer = setTimeout(() => {
|
|
1066
|
-
if (typeof fallback === "function") {
|
|
1067
|
-
try {
|
|
1068
|
-
resolve(fallback());
|
|
1069
|
-
} catch (error) {
|
|
1070
|
-
reject(error);
|
|
1071
|
-
}
|
|
1072
|
-
return;
|
|
1073
|
-
}
|
|
1074
|
-
const message = typeof fallback === "string" ? fallback : `Promise timed out after ${milliseconds} milliseconds`;
|
|
1075
|
-
const timeoutError = fallback instanceof Error ? fallback : new TimeoutError(message);
|
|
1076
|
-
if (typeof promise.cancel === "function") promise.cancel();
|
|
1077
|
-
reject(timeoutError);
|
|
1078
|
-
}, milliseconds);
|
|
1079
|
-
pFinally(promise.then(resolve, reject), () => {
|
|
1080
|
-
clearTimeout(timer);
|
|
1081
|
-
});
|
|
1082
|
-
});
|
|
1083
|
-
module.exports = pTimeout;
|
|
1084
|
-
module.exports.default = pTimeout;
|
|
1085
|
-
module.exports.TimeoutError = TimeoutError;
|
|
1086
|
-
}));
|
|
1087
|
-
//#endregion
|
|
1088
|
-
//#region ../../node_modules/.pnpm/p-queue@6.6.2/node_modules/p-queue/dist/lower-bound.js
|
|
1089
|
-
var require_lower_bound = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
1090
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1091
|
-
function lowerBound(array, value, comparator) {
|
|
1092
|
-
let first = 0;
|
|
1093
|
-
let count = array.length;
|
|
1094
|
-
while (count > 0) {
|
|
1095
|
-
const step = count / 2 | 0;
|
|
1096
|
-
let it = first + step;
|
|
1097
|
-
if (comparator(array[it], value) <= 0) {
|
|
1098
|
-
first = ++it;
|
|
1099
|
-
count -= step + 1;
|
|
1100
|
-
} else count = step;
|
|
1101
|
-
}
|
|
1102
|
-
return first;
|
|
1103
|
-
}
|
|
1104
|
-
exports.default = lowerBound;
|
|
1105
|
-
}));
|
|
1106
|
-
//#endregion
|
|
1107
|
-
//#region ../../node_modules/.pnpm/p-queue@6.6.2/node_modules/p-queue/dist/priority-queue.js
|
|
1108
|
-
var require_priority_queue = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
1109
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1110
|
-
var lower_bound_1 = require_lower_bound();
|
|
1111
|
-
var PriorityQueue = class {
|
|
1112
|
-
constructor() {
|
|
1113
|
-
this._queue = [];
|
|
1114
|
-
}
|
|
1115
|
-
enqueue(run, options) {
|
|
1116
|
-
options = Object.assign({ priority: 0 }, options);
|
|
1117
|
-
const element = {
|
|
1118
|
-
priority: options.priority,
|
|
1119
|
-
run
|
|
1120
|
-
};
|
|
1121
|
-
if (this.size && this._queue[this.size - 1].priority >= options.priority) {
|
|
1122
|
-
this._queue.push(element);
|
|
1123
|
-
return;
|
|
1124
|
-
}
|
|
1125
|
-
const index = lower_bound_1.default(this._queue, element, (a, b) => b.priority - a.priority);
|
|
1126
|
-
this._queue.splice(index, 0, element);
|
|
1127
|
-
}
|
|
1128
|
-
dequeue() {
|
|
1129
|
-
const item = this._queue.shift();
|
|
1130
|
-
return item === null || item === void 0 ? void 0 : item.run;
|
|
1131
|
-
}
|
|
1132
|
-
filter(options) {
|
|
1133
|
-
return this._queue.filter((element) => element.priority === options.priority).map((element) => element.run);
|
|
1134
|
-
}
|
|
1135
|
-
get size() {
|
|
1136
|
-
return this._queue.length;
|
|
1137
|
-
}
|
|
1138
|
-
};
|
|
1139
|
-
exports.default = PriorityQueue;
|
|
1140
|
-
}));
|
|
1141
|
-
//#endregion
|
|
1142
|
-
//#region ../../node_modules/.pnpm/p-queue@6.6.2/node_modules/p-queue/dist/index.js
|
|
1143
|
-
var require_dist$2 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
1144
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1145
|
-
var EventEmitter = require_eventemitter3$1();
|
|
1146
|
-
var p_timeout_1 = require_p_timeout();
|
|
1147
|
-
var priority_queue_1 = require_priority_queue();
|
|
1148
|
-
var empty = () => {};
|
|
1149
|
-
var timeoutError = new p_timeout_1.TimeoutError();
|
|
1150
|
-
/**
|
|
1151
|
-
Promise queue with concurrency control.
|
|
1152
|
-
*/
|
|
1153
|
-
var PQueue = class extends EventEmitter {
|
|
1154
|
-
constructor(options) {
|
|
1155
|
-
var _a, _b, _c, _d;
|
|
1156
|
-
super();
|
|
1157
|
-
this._intervalCount = 0;
|
|
1158
|
-
this._intervalEnd = 0;
|
|
1159
|
-
this._pendingCount = 0;
|
|
1160
|
-
this._resolveEmpty = empty;
|
|
1161
|
-
this._resolveIdle = empty;
|
|
1162
|
-
options = Object.assign({
|
|
1163
|
-
carryoverConcurrencyCount: false,
|
|
1164
|
-
intervalCap: Infinity,
|
|
1165
|
-
interval: 0,
|
|
1166
|
-
concurrency: Infinity,
|
|
1167
|
-
autoStart: true,
|
|
1168
|
-
queueClass: priority_queue_1.default
|
|
1169
|
-
}, options);
|
|
1170
|
-
if (!(typeof options.intervalCap === "number" && options.intervalCap >= 1)) throw new TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${(_b = (_a = options.intervalCap) === null || _a === void 0 ? void 0 : _a.toString()) !== null && _b !== void 0 ? _b : ""}\` (${typeof options.intervalCap})`);
|
|
1171
|
-
if (options.interval === void 0 || !(Number.isFinite(options.interval) && options.interval >= 0)) throw new TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${(_d = (_c = options.interval) === null || _c === void 0 ? void 0 : _c.toString()) !== null && _d !== void 0 ? _d : ""}\` (${typeof options.interval})`);
|
|
1172
|
-
this._carryoverConcurrencyCount = options.carryoverConcurrencyCount;
|
|
1173
|
-
this._isIntervalIgnored = options.intervalCap === Infinity || options.interval === 0;
|
|
1174
|
-
this._intervalCap = options.intervalCap;
|
|
1175
|
-
this._interval = options.interval;
|
|
1176
|
-
this._queue = new options.queueClass();
|
|
1177
|
-
this._queueClass = options.queueClass;
|
|
1178
|
-
this.concurrency = options.concurrency;
|
|
1179
|
-
this._timeout = options.timeout;
|
|
1180
|
-
this._throwOnTimeout = options.throwOnTimeout === true;
|
|
1181
|
-
this._isPaused = options.autoStart === false;
|
|
1182
|
-
}
|
|
1183
|
-
get _doesIntervalAllowAnother() {
|
|
1184
|
-
return this._isIntervalIgnored || this._intervalCount < this._intervalCap;
|
|
1185
|
-
}
|
|
1186
|
-
get _doesConcurrentAllowAnother() {
|
|
1187
|
-
return this._pendingCount < this._concurrency;
|
|
1188
|
-
}
|
|
1189
|
-
_next() {
|
|
1190
|
-
this._pendingCount--;
|
|
1191
|
-
this._tryToStartAnother();
|
|
1192
|
-
this.emit("next");
|
|
1193
|
-
}
|
|
1194
|
-
_resolvePromises() {
|
|
1195
|
-
this._resolveEmpty();
|
|
1196
|
-
this._resolveEmpty = empty;
|
|
1197
|
-
if (this._pendingCount === 0) {
|
|
1198
|
-
this._resolveIdle();
|
|
1199
|
-
this._resolveIdle = empty;
|
|
1200
|
-
this.emit("idle");
|
|
1201
|
-
}
|
|
1202
|
-
}
|
|
1203
|
-
_onResumeInterval() {
|
|
1204
|
-
this._onInterval();
|
|
1205
|
-
this._initializeIntervalIfNeeded();
|
|
1206
|
-
this._timeoutId = void 0;
|
|
1207
|
-
}
|
|
1208
|
-
_isIntervalPaused() {
|
|
1209
|
-
const now = Date.now();
|
|
1210
|
-
if (this._intervalId === void 0) {
|
|
1211
|
-
const delay = this._intervalEnd - now;
|
|
1212
|
-
if (delay < 0) this._intervalCount = this._carryoverConcurrencyCount ? this._pendingCount : 0;
|
|
1213
|
-
else {
|
|
1214
|
-
if (this._timeoutId === void 0) this._timeoutId = setTimeout(() => {
|
|
1215
|
-
this._onResumeInterval();
|
|
1216
|
-
}, delay);
|
|
1217
|
-
return true;
|
|
1218
|
-
}
|
|
1219
|
-
}
|
|
1220
|
-
return false;
|
|
1221
|
-
}
|
|
1222
|
-
_tryToStartAnother() {
|
|
1223
|
-
if (this._queue.size === 0) {
|
|
1224
|
-
if (this._intervalId) clearInterval(this._intervalId);
|
|
1225
|
-
this._intervalId = void 0;
|
|
1226
|
-
this._resolvePromises();
|
|
1227
|
-
return false;
|
|
1228
|
-
}
|
|
1229
|
-
if (!this._isPaused) {
|
|
1230
|
-
const canInitializeInterval = !this._isIntervalPaused();
|
|
1231
|
-
if (this._doesIntervalAllowAnother && this._doesConcurrentAllowAnother) {
|
|
1232
|
-
const job = this._queue.dequeue();
|
|
1233
|
-
if (!job) return false;
|
|
1234
|
-
this.emit("active");
|
|
1235
|
-
job();
|
|
1236
|
-
if (canInitializeInterval) this._initializeIntervalIfNeeded();
|
|
1237
|
-
return true;
|
|
1238
|
-
}
|
|
1239
|
-
}
|
|
1240
|
-
return false;
|
|
1241
|
-
}
|
|
1242
|
-
_initializeIntervalIfNeeded() {
|
|
1243
|
-
if (this._isIntervalIgnored || this._intervalId !== void 0) return;
|
|
1244
|
-
this._intervalId = setInterval(() => {
|
|
1245
|
-
this._onInterval();
|
|
1246
|
-
}, this._interval);
|
|
1247
|
-
this._intervalEnd = Date.now() + this._interval;
|
|
1248
|
-
}
|
|
1249
|
-
_onInterval() {
|
|
1250
|
-
if (this._intervalCount === 0 && this._pendingCount === 0 && this._intervalId) {
|
|
1251
|
-
clearInterval(this._intervalId);
|
|
1252
|
-
this._intervalId = void 0;
|
|
1253
|
-
}
|
|
1254
|
-
this._intervalCount = this._carryoverConcurrencyCount ? this._pendingCount : 0;
|
|
1255
|
-
this._processQueue();
|
|
1256
|
-
}
|
|
1257
|
-
/**
|
|
1258
|
-
Executes all queued functions until it reaches the limit.
|
|
1259
|
-
*/
|
|
1260
|
-
_processQueue() {
|
|
1261
|
-
while (this._tryToStartAnother());
|
|
1262
|
-
}
|
|
1263
|
-
get concurrency() {
|
|
1264
|
-
return this._concurrency;
|
|
1265
|
-
}
|
|
1266
|
-
set concurrency(newConcurrency) {
|
|
1267
|
-
if (!(typeof newConcurrency === "number" && newConcurrency >= 1)) throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${newConcurrency}\` (${typeof newConcurrency})`);
|
|
1268
|
-
this._concurrency = newConcurrency;
|
|
1269
|
-
this._processQueue();
|
|
1270
|
-
}
|
|
1271
|
-
/**
|
|
1272
|
-
Adds a sync or async task to the queue. Always returns a promise.
|
|
1273
|
-
*/
|
|
1274
|
-
async add(fn, options = {}) {
|
|
1275
|
-
return new Promise((resolve, reject) => {
|
|
1276
|
-
const run = async () => {
|
|
1277
|
-
this._pendingCount++;
|
|
1278
|
-
this._intervalCount++;
|
|
1279
|
-
try {
|
|
1280
|
-
resolve(await (this._timeout === void 0 && options.timeout === void 0 ? fn() : p_timeout_1.default(Promise.resolve(fn()), options.timeout === void 0 ? this._timeout : options.timeout, () => {
|
|
1281
|
-
if (options.throwOnTimeout === void 0 ? this._throwOnTimeout : options.throwOnTimeout) reject(timeoutError);
|
|
1282
|
-
})));
|
|
1283
|
-
} catch (error) {
|
|
1284
|
-
reject(error);
|
|
1285
|
-
}
|
|
1286
|
-
this._next();
|
|
1287
|
-
};
|
|
1288
|
-
this._queue.enqueue(run, options);
|
|
1289
|
-
this._tryToStartAnother();
|
|
1290
|
-
this.emit("add");
|
|
1291
|
-
});
|
|
1292
|
-
}
|
|
1293
|
-
/**
|
|
1294
|
-
Same as `.add()`, but accepts an array of sync or async functions.
|
|
1295
|
-
|
|
1296
|
-
@returns A promise that resolves when all functions are resolved.
|
|
1297
|
-
*/
|
|
1298
|
-
async addAll(functions, options) {
|
|
1299
|
-
return Promise.all(functions.map(async (function_) => this.add(function_, options)));
|
|
1300
|
-
}
|
|
1301
|
-
/**
|
|
1302
|
-
Start (or resume) executing enqueued tasks within concurrency limit. No need to call this if queue is not paused (via `options.autoStart = false` or by `.pause()` method.)
|
|
1303
|
-
*/
|
|
1304
|
-
start() {
|
|
1305
|
-
if (!this._isPaused) return this;
|
|
1306
|
-
this._isPaused = false;
|
|
1307
|
-
this._processQueue();
|
|
1308
|
-
return this;
|
|
1309
|
-
}
|
|
1310
|
-
/**
|
|
1311
|
-
Put queue execution on hold.
|
|
1312
|
-
*/
|
|
1313
|
-
pause() {
|
|
1314
|
-
this._isPaused = true;
|
|
1315
|
-
}
|
|
1316
|
-
/**
|
|
1317
|
-
Clear the queue.
|
|
1318
|
-
*/
|
|
1319
|
-
clear() {
|
|
1320
|
-
this._queue = new this._queueClass();
|
|
1321
|
-
}
|
|
1322
|
-
/**
|
|
1323
|
-
Can be called multiple times. Useful if you for example add additional items at a later time.
|
|
1324
|
-
|
|
1325
|
-
@returns A promise that settles when the queue becomes empty.
|
|
1326
|
-
*/
|
|
1327
|
-
async onEmpty() {
|
|
1328
|
-
if (this._queue.size === 0) return;
|
|
1329
|
-
return new Promise((resolve) => {
|
|
1330
|
-
const existingResolve = this._resolveEmpty;
|
|
1331
|
-
this._resolveEmpty = () => {
|
|
1332
|
-
existingResolve();
|
|
1333
|
-
resolve();
|
|
1334
|
-
};
|
|
1335
|
-
});
|
|
1336
|
-
}
|
|
1337
|
-
/**
|
|
1338
|
-
The difference with `.onEmpty` is that `.onIdle` guarantees that all work from the queue has finished. `.onEmpty` merely signals that the queue is empty, but it could mean that some promises haven't completed yet.
|
|
1339
|
-
|
|
1340
|
-
@returns A promise that settles when the queue becomes empty, and all promises have completed; `queue.size === 0 && queue.pending === 0`.
|
|
1341
|
-
*/
|
|
1342
|
-
async onIdle() {
|
|
1343
|
-
if (this._pendingCount === 0 && this._queue.size === 0) return;
|
|
1344
|
-
return new Promise((resolve) => {
|
|
1345
|
-
const existingResolve = this._resolveIdle;
|
|
1346
|
-
this._resolveIdle = () => {
|
|
1347
|
-
existingResolve();
|
|
1348
|
-
resolve();
|
|
1349
|
-
};
|
|
1350
|
-
});
|
|
1351
|
-
}
|
|
1352
|
-
/**
|
|
1353
|
-
Size of the queue.
|
|
1354
|
-
*/
|
|
1355
|
-
get size() {
|
|
1356
|
-
return this._queue.size;
|
|
1357
|
-
}
|
|
1358
|
-
/**
|
|
1359
|
-
Size of the queue, filtered by the given options.
|
|
1360
|
-
|
|
1361
|
-
For example, this can be used to find the number of items remaining in the queue with a specific priority level.
|
|
1362
|
-
*/
|
|
1363
|
-
sizeBy(options) {
|
|
1364
|
-
return this._queue.filter(options).length;
|
|
1365
|
-
}
|
|
1366
|
-
/**
|
|
1367
|
-
Number of pending promises.
|
|
1368
|
-
*/
|
|
1369
|
-
get pending() {
|
|
1370
|
-
return this._pendingCount;
|
|
1371
|
-
}
|
|
1372
|
-
/**
|
|
1373
|
-
Whether the queue is currently paused.
|
|
1374
|
-
*/
|
|
1375
|
-
get isPaused() {
|
|
1376
|
-
return this._isPaused;
|
|
1377
|
-
}
|
|
1378
|
-
get timeout() {
|
|
1379
|
-
return this._timeout;
|
|
1380
|
-
}
|
|
1381
|
-
/**
|
|
1382
|
-
Set the timeout for future operations.
|
|
1383
|
-
*/
|
|
1384
|
-
set timeout(milliseconds) {
|
|
1385
|
-
this._timeout = milliseconds;
|
|
1386
|
-
}
|
|
1387
|
-
};
|
|
1388
|
-
exports.default = PQueue;
|
|
1389
|
-
}));
|
|
1390
|
-
//#endregion
|
|
1391
|
-
//#region ../../node_modules/.pnpm/retry@0.13.1/node_modules/retry/lib/retry_operation.js
|
|
1392
|
-
var require_retry_operation = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1393
|
-
function RetryOperation(timeouts, options) {
|
|
1394
|
-
if (typeof options === "boolean") options = { forever: options };
|
|
1395
|
-
this._originalTimeouts = JSON.parse(JSON.stringify(timeouts));
|
|
1396
|
-
this._timeouts = timeouts;
|
|
1397
|
-
this._options = options || {};
|
|
1398
|
-
this._maxRetryTime = options && options.maxRetryTime || Infinity;
|
|
1399
|
-
this._fn = null;
|
|
1400
|
-
this._errors = [];
|
|
1401
|
-
this._attempts = 1;
|
|
1402
|
-
this._operationTimeout = null;
|
|
1403
|
-
this._operationTimeoutCb = null;
|
|
1404
|
-
this._timeout = null;
|
|
1405
|
-
this._operationStart = null;
|
|
1406
|
-
this._timer = null;
|
|
1407
|
-
if (this._options.forever) this._cachedTimeouts = this._timeouts.slice(0);
|
|
1408
|
-
}
|
|
1409
|
-
module.exports = RetryOperation;
|
|
1410
|
-
RetryOperation.prototype.reset = function() {
|
|
1411
|
-
this._attempts = 1;
|
|
1412
|
-
this._timeouts = this._originalTimeouts.slice(0);
|
|
1413
|
-
};
|
|
1414
|
-
RetryOperation.prototype.stop = function() {
|
|
1415
|
-
if (this._timeout) clearTimeout(this._timeout);
|
|
1416
|
-
if (this._timer) clearTimeout(this._timer);
|
|
1417
|
-
this._timeouts = [];
|
|
1418
|
-
this._cachedTimeouts = null;
|
|
1419
|
-
};
|
|
1420
|
-
RetryOperation.prototype.retry = function(err) {
|
|
1421
|
-
if (this._timeout) clearTimeout(this._timeout);
|
|
1422
|
-
if (!err) return false;
|
|
1423
|
-
var currentTime = (/* @__PURE__ */ new Date()).getTime();
|
|
1424
|
-
if (err && currentTime - this._operationStart >= this._maxRetryTime) {
|
|
1425
|
-
this._errors.push(err);
|
|
1426
|
-
this._errors.unshift(/* @__PURE__ */ new Error("RetryOperation timeout occurred"));
|
|
1427
|
-
return false;
|
|
1428
|
-
}
|
|
1429
|
-
this._errors.push(err);
|
|
1430
|
-
var timeout = this._timeouts.shift();
|
|
1431
|
-
if (timeout === void 0) if (this._cachedTimeouts) {
|
|
1432
|
-
this._errors.splice(0, this._errors.length - 1);
|
|
1433
|
-
timeout = this._cachedTimeouts.slice(-1);
|
|
1434
|
-
} else return false;
|
|
1435
|
-
var self = this;
|
|
1436
|
-
this._timer = setTimeout(function() {
|
|
1437
|
-
self._attempts++;
|
|
1438
|
-
if (self._operationTimeoutCb) {
|
|
1439
|
-
self._timeout = setTimeout(function() {
|
|
1440
|
-
self._operationTimeoutCb(self._attempts);
|
|
1441
|
-
}, self._operationTimeout);
|
|
1442
|
-
if (self._options.unref) self._timeout.unref();
|
|
1443
|
-
}
|
|
1444
|
-
self._fn(self._attempts);
|
|
1445
|
-
}, timeout);
|
|
1446
|
-
if (this._options.unref) this._timer.unref();
|
|
1447
|
-
return true;
|
|
1448
|
-
};
|
|
1449
|
-
RetryOperation.prototype.attempt = function(fn, timeoutOps) {
|
|
1450
|
-
this._fn = fn;
|
|
1451
|
-
if (timeoutOps) {
|
|
1452
|
-
if (timeoutOps.timeout) this._operationTimeout = timeoutOps.timeout;
|
|
1453
|
-
if (timeoutOps.cb) this._operationTimeoutCb = timeoutOps.cb;
|
|
1454
|
-
}
|
|
1455
|
-
var self = this;
|
|
1456
|
-
if (this._operationTimeoutCb) this._timeout = setTimeout(function() {
|
|
1457
|
-
self._operationTimeoutCb();
|
|
1458
|
-
}, self._operationTimeout);
|
|
1459
|
-
this._operationStart = (/* @__PURE__ */ new Date()).getTime();
|
|
1460
|
-
this._fn(this._attempts);
|
|
1461
|
-
};
|
|
1462
|
-
RetryOperation.prototype.try = function(fn) {
|
|
1463
|
-
console.log("Using RetryOperation.try() is deprecated");
|
|
1464
|
-
this.attempt(fn);
|
|
1465
|
-
};
|
|
1466
|
-
RetryOperation.prototype.start = function(fn) {
|
|
1467
|
-
console.log("Using RetryOperation.start() is deprecated");
|
|
1468
|
-
this.attempt(fn);
|
|
1469
|
-
};
|
|
1470
|
-
RetryOperation.prototype.start = RetryOperation.prototype.try;
|
|
1471
|
-
RetryOperation.prototype.errors = function() {
|
|
1472
|
-
return this._errors;
|
|
1473
|
-
};
|
|
1474
|
-
RetryOperation.prototype.attempts = function() {
|
|
1475
|
-
return this._attempts;
|
|
1476
|
-
};
|
|
1477
|
-
RetryOperation.prototype.mainError = function() {
|
|
1478
|
-
if (this._errors.length === 0) return null;
|
|
1479
|
-
var counts = {};
|
|
1480
|
-
var mainError = null;
|
|
1481
|
-
var mainErrorCount = 0;
|
|
1482
|
-
for (var i = 0; i < this._errors.length; i++) {
|
|
1483
|
-
var error = this._errors[i];
|
|
1484
|
-
var message = error.message;
|
|
1485
|
-
var count = (counts[message] || 0) + 1;
|
|
1486
|
-
counts[message] = count;
|
|
1487
|
-
if (count >= mainErrorCount) {
|
|
1488
|
-
mainError = error;
|
|
1489
|
-
mainErrorCount = count;
|
|
1490
|
-
}
|
|
1491
|
-
}
|
|
1492
|
-
return mainError;
|
|
1493
|
-
};
|
|
1494
|
-
}));
|
|
1495
|
-
//#endregion
|
|
1496
|
-
//#region ../../node_modules/.pnpm/retry@0.13.1/node_modules/retry/lib/retry.js
|
|
1497
|
-
var require_retry$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
1498
|
-
var RetryOperation = require_retry_operation();
|
|
1499
|
-
exports.operation = function(options) {
|
|
1500
|
-
return new RetryOperation(exports.timeouts(options), {
|
|
1501
|
-
forever: options && (options.forever || options.retries === Infinity),
|
|
1502
|
-
unref: options && options.unref,
|
|
1503
|
-
maxRetryTime: options && options.maxRetryTime
|
|
1504
|
-
});
|
|
1505
|
-
};
|
|
1506
|
-
exports.timeouts = function(options) {
|
|
1507
|
-
if (options instanceof Array) return [].concat(options);
|
|
1508
|
-
var opts = {
|
|
1509
|
-
retries: 10,
|
|
1510
|
-
factor: 2,
|
|
1511
|
-
minTimeout: 1 * 1e3,
|
|
1512
|
-
maxTimeout: Infinity,
|
|
1513
|
-
randomize: false
|
|
1514
|
-
};
|
|
1515
|
-
for (var key in options) opts[key] = options[key];
|
|
1516
|
-
if (opts.minTimeout > opts.maxTimeout) throw new Error("minTimeout is greater than maxTimeout");
|
|
1517
|
-
var timeouts = [];
|
|
1518
|
-
for (var i = 0; i < opts.retries; i++) timeouts.push(this.createTimeout(i, opts));
|
|
1519
|
-
if (options && options.forever && !timeouts.length) timeouts.push(this.createTimeout(i, opts));
|
|
1520
|
-
timeouts.sort(function(a, b) {
|
|
1521
|
-
return a - b;
|
|
1522
|
-
});
|
|
1523
|
-
return timeouts;
|
|
1524
|
-
};
|
|
1525
|
-
exports.createTimeout = function(attempt, opts) {
|
|
1526
|
-
var random = opts.randomize ? Math.random() + 1 : 1;
|
|
1527
|
-
var timeout = Math.round(random * Math.max(opts.minTimeout, 1) * Math.pow(opts.factor, attempt));
|
|
1528
|
-
timeout = Math.min(timeout, opts.maxTimeout);
|
|
1529
|
-
return timeout;
|
|
1530
|
-
};
|
|
1531
|
-
exports.wrap = function(obj, options, methods) {
|
|
1532
|
-
if (options instanceof Array) {
|
|
1533
|
-
methods = options;
|
|
1534
|
-
options = null;
|
|
1535
|
-
}
|
|
1536
|
-
if (!methods) {
|
|
1537
|
-
methods = [];
|
|
1538
|
-
for (var key in obj) if (typeof obj[key] === "function") methods.push(key);
|
|
1539
|
-
}
|
|
1540
|
-
for (var i = 0; i < methods.length; i++) {
|
|
1541
|
-
var method = methods[i];
|
|
1542
|
-
var original = obj[method];
|
|
1543
|
-
obj[method] = function retryWrapper(original) {
|
|
1544
|
-
var op = exports.operation(options);
|
|
1545
|
-
var args = Array.prototype.slice.call(arguments, 1);
|
|
1546
|
-
var callback = args.pop();
|
|
1547
|
-
args.push(function(err) {
|
|
1548
|
-
if (op.retry(err)) return;
|
|
1549
|
-
if (err) arguments[0] = op.mainError();
|
|
1550
|
-
callback.apply(this, arguments);
|
|
1551
|
-
});
|
|
1552
|
-
op.attempt(function() {
|
|
1553
|
-
original.apply(obj, args);
|
|
1554
|
-
});
|
|
1555
|
-
}.bind(obj, original);
|
|
1556
|
-
obj[method].options = options;
|
|
1557
|
-
}
|
|
1558
|
-
};
|
|
1559
|
-
}));
|
|
1560
|
-
//#endregion
|
|
1561
|
-
//#region ../../node_modules/.pnpm/retry@0.13.1/node_modules/retry/index.js
|
|
1562
|
-
var require_retry = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1563
|
-
module.exports = require_retry$1();
|
|
1564
|
-
}));
|
|
1565
|
-
//#endregion
|
|
1566
|
-
//#region ../../node_modules/.pnpm/p-retry@4.6.2/node_modules/p-retry/index.js
|
|
1567
|
-
var require_p_retry = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1568
|
-
var retry = require_retry();
|
|
1569
|
-
var networkErrorMsgs = [
|
|
1570
|
-
"Failed to fetch",
|
|
1571
|
-
"NetworkError when attempting to fetch resource.",
|
|
1572
|
-
"The Internet connection appears to be offline.",
|
|
1573
|
-
"Network request failed"
|
|
1574
|
-
];
|
|
1575
|
-
var AbortError = class extends Error {
|
|
1576
|
-
constructor(message) {
|
|
1577
|
-
super();
|
|
1578
|
-
if (message instanceof Error) {
|
|
1579
|
-
this.originalError = message;
|
|
1580
|
-
({message} = message);
|
|
1581
|
-
} else {
|
|
1582
|
-
this.originalError = new Error(message);
|
|
1583
|
-
this.originalError.stack = this.stack;
|
|
1584
|
-
}
|
|
1585
|
-
this.name = "AbortError";
|
|
1586
|
-
this.message = message;
|
|
1587
|
-
}
|
|
1588
|
-
};
|
|
1589
|
-
var decorateErrorWithCounts = (error, attemptNumber, options) => {
|
|
1590
|
-
const retriesLeft = options.retries - (attemptNumber - 1);
|
|
1591
|
-
error.attemptNumber = attemptNumber;
|
|
1592
|
-
error.retriesLeft = retriesLeft;
|
|
1593
|
-
return error;
|
|
1594
|
-
};
|
|
1595
|
-
var isNetworkError = (errorMessage) => networkErrorMsgs.includes(errorMessage);
|
|
1596
|
-
var pRetry = (input, options) => new Promise((resolve, reject) => {
|
|
1597
|
-
options = {
|
|
1598
|
-
onFailedAttempt: () => {},
|
|
1599
|
-
retries: 10,
|
|
1600
|
-
...options
|
|
1601
|
-
};
|
|
1602
|
-
const operation = retry.operation(options);
|
|
1603
|
-
operation.attempt(async (attemptNumber) => {
|
|
1604
|
-
try {
|
|
1605
|
-
resolve(await input(attemptNumber));
|
|
1606
|
-
} catch (error) {
|
|
1607
|
-
if (!(error instanceof Error)) {
|
|
1608
|
-
reject(/* @__PURE__ */ new TypeError(`Non-error was thrown: "${error}". You should only throw errors.`));
|
|
1609
|
-
return;
|
|
1610
|
-
}
|
|
1611
|
-
if (error instanceof AbortError) {
|
|
1612
|
-
operation.stop();
|
|
1613
|
-
reject(error.originalError);
|
|
1614
|
-
} else if (error instanceof TypeError && !isNetworkError(error.message)) {
|
|
1615
|
-
operation.stop();
|
|
1616
|
-
reject(error);
|
|
1617
|
-
} else {
|
|
1618
|
-
decorateErrorWithCounts(error, attemptNumber, options);
|
|
1619
|
-
try {
|
|
1620
|
-
await options.onFailedAttempt(error);
|
|
1621
|
-
} catch (error) {
|
|
1622
|
-
reject(error);
|
|
1623
|
-
return;
|
|
1624
|
-
}
|
|
1625
|
-
if (!operation.retry(error)) reject(operation.mainError());
|
|
1626
|
-
}
|
|
1627
|
-
}
|
|
1628
|
-
});
|
|
1629
|
-
});
|
|
1630
|
-
module.exports = pRetry;
|
|
1631
|
-
module.exports.default = pRetry;
|
|
1632
|
-
module.exports.AbortError = AbortError;
|
|
1633
|
-
}));
|
|
1634
|
-
//#endregion
|
|
1635
|
-
//#region ../../node_modules/.pnpm/@slack+web-api@7.15.1_debug@4.4.3_supports-color@8.1.1_/node_modules/@slack/web-api/dist/file-upload.js
|
|
1636
|
-
var require_file_upload = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
1637
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1638
|
-
exports.getFileUploadJob = getFileUploadJob;
|
|
1639
|
-
exports.getMultipleFileUploadJobs = getMultipleFileUploadJobs;
|
|
1640
|
-
exports.getFileData = getFileData;
|
|
1641
|
-
exports.getFileDataLength = getFileDataLength;
|
|
1642
|
-
exports.getFileDataAsStream = getFileDataAsStream;
|
|
1643
|
-
exports.getAllFileUploadsToComplete = getAllFileUploadsToComplete;
|
|
1644
|
-
exports.warnIfNotUsingFilesUploadV2 = warnIfNotUsingFilesUploadV2;
|
|
1645
|
-
exports.warnIfChannels = warnIfChannels;
|
|
1646
|
-
exports.errorIfChannelsCsv = errorIfChannelsCsv;
|
|
1647
|
-
exports.errorIfInvalidOrMissingFileData = errorIfInvalidOrMissingFileData;
|
|
1648
|
-
exports.warnIfMissingOrInvalidFileNameAndDefault = warnIfMissingOrInvalidFileNameAndDefault;
|
|
1649
|
-
exports.warnIfLegacyFileType = warnIfLegacyFileType;
|
|
1650
|
-
exports.buildMissingFileIdError = buildMissingFileIdError;
|
|
1651
|
-
exports.buildFileSizeErrorMsg = buildFileSizeErrorMsg;
|
|
1652
|
-
exports.buildLegacyFileTypeWarning = buildLegacyFileTypeWarning;
|
|
1653
|
-
exports.buildMissingFileNameWarning = buildMissingFileNameWarning;
|
|
1654
|
-
exports.buildMissingExtensionWarning = buildMissingExtensionWarning;
|
|
1655
|
-
exports.buildLegacyMethodWarning = buildLegacyMethodWarning;
|
|
1656
|
-
exports.buildGeneralFilesUploadWarning = buildGeneralFilesUploadWarning;
|
|
1657
|
-
exports.buildFilesUploadMissingMessage = buildFilesUploadMissingMessage;
|
|
1658
|
-
exports.buildChannelsWarning = buildChannelsWarning;
|
|
1659
|
-
exports.buildMultipleChannelsErrorMsg = buildMultipleChannelsErrorMsg;
|
|
1660
|
-
exports.buildInvalidFilesUploadParamError = buildInvalidFilesUploadParamError;
|
|
1661
|
-
var node_fs_1 = __require("node:fs");
|
|
1662
|
-
var node_stream_1 = __require("node:stream");
|
|
1663
|
-
var errors_1 = require_errors();
|
|
1664
|
-
async function getFileUploadJob(options, logger) {
|
|
1665
|
-
var _a, _b, _c, _d;
|
|
1666
|
-
warnIfLegacyFileType(options, logger);
|
|
1667
|
-
warnIfChannels(options, logger);
|
|
1668
|
-
errorIfChannelsCsv(options);
|
|
1669
|
-
const fileName = warnIfMissingOrInvalidFileNameAndDefault(options, logger);
|
|
1670
|
-
const fileData = await getFileData(options);
|
|
1671
|
-
const fileDataBytesLength = getFileDataLength(fileData);
|
|
1672
|
-
const fileUploadJob = {
|
|
1673
|
-
alt_text: options.alt_text,
|
|
1674
|
-
blocks: options.blocks,
|
|
1675
|
-
channel_id: (_a = options.channels) !== null && _a !== void 0 ? _a : options.channel_id,
|
|
1676
|
-
filename: (_b = options.filename) !== null && _b !== void 0 ? _b : fileName,
|
|
1677
|
-
initial_comment: options.initial_comment,
|
|
1678
|
-
snippet_type: options.snippet_type,
|
|
1679
|
-
title: (_d = (_c = options.title) !== null && _c !== void 0 ? _c : options.filename) !== null && _d !== void 0 ? _d : fileName,
|
|
1680
|
-
data: fileData,
|
|
1681
|
-
length: fileDataBytesLength
|
|
1682
|
-
};
|
|
1683
|
-
if ("thread_ts" in options) fileUploadJob.thread_ts = options.thread_ts;
|
|
1684
|
-
if ("token" in options) fileUploadJob.token = options.token;
|
|
1685
|
-
if ("content" in options) return Object.assign({ content: options.content }, fileUploadJob);
|
|
1686
|
-
if ("file" in options) return Object.assign({ file: options.file }, fileUploadJob);
|
|
1687
|
-
throw (0, errors_1.errorWithCode)(/* @__PURE__ */ new Error("Either a file or content field is required for valid file upload. You must supply one"), errors_1.ErrorCode.FileUploadInvalidArgumentsError);
|
|
1688
|
-
}
|
|
1689
|
-
/**
|
|
1690
|
-
* Returns an array of files upload entries when `file_uploads` is supplied.
|
|
1691
|
-
* **Note**
|
|
1692
|
-
* file_uploads should be set when multiple files are intended to be attached to a
|
|
1693
|
-
* single message. To support this, we handle options supplied with
|
|
1694
|
-
* top level `initial_comment`, `thread_ts`, `channel_id` and `file_uploads` parameters.
|
|
1695
|
-
* ```javascript
|
|
1696
|
-
* const res = await client.files.uploadV2({
|
|
1697
|
-
* initial_comment: 'Here are the files!',
|
|
1698
|
-
* thread_ts: '1223313423434.131321',
|
|
1699
|
-
* channel_id: 'C12345',
|
|
1700
|
-
* file_uploads: [
|
|
1701
|
-
* {
|
|
1702
|
-
* file: './test/fixtures/test-txt.txt',
|
|
1703
|
-
* filename: 'test-txt.txt',
|
|
1704
|
-
* },
|
|
1705
|
-
* {
|
|
1706
|
-
* file: './test/fixtures/test-png.png',
|
|
1707
|
-
* filename: 'test-png.png',
|
|
1708
|
-
* },
|
|
1709
|
-
* ],
|
|
1710
|
-
* });
|
|
1711
|
-
* ```
|
|
1712
|
-
* @param options provided by user
|
|
1713
|
-
*/
|
|
1714
|
-
async function getMultipleFileUploadJobs(options, logger) {
|
|
1715
|
-
if ("file_uploads" in options) return Promise.all(options.file_uploads.map((upload) => {
|
|
1716
|
-
const { blocks, channel_id, channels, initial_comment, thread_ts } = upload;
|
|
1717
|
-
if (blocks || channel_id || channels || initial_comment || thread_ts) throw (0, errors_1.errorWithCode)(new Error(buildInvalidFilesUploadParamError()), errors_1.ErrorCode.FileUploadInvalidArgumentsError);
|
|
1718
|
-
const uploadJobArgs = Object.assign(Object.assign({}, upload), {
|
|
1719
|
-
blocks: options.blocks,
|
|
1720
|
-
channels: options.channels,
|
|
1721
|
-
channel_id: options.channel_id,
|
|
1722
|
-
initial_comment: options.initial_comment
|
|
1723
|
-
});
|
|
1724
|
-
if ("thread_ts" in options) uploadJobArgs.thread_ts = options.thread_ts;
|
|
1725
|
-
if ("token" in options) uploadJobArgs.token = options.token;
|
|
1726
|
-
if ("content" in upload) return getFileUploadJob(Object.assign({ content: upload.content }, uploadJobArgs), logger);
|
|
1727
|
-
if ("file" in upload) return getFileUploadJob(Object.assign({ file: upload.file }, uploadJobArgs), logger);
|
|
1728
|
-
throw (0, errors_1.errorWithCode)(/* @__PURE__ */ new Error("Either a file or content field is required for valid file upload. You must supply one"), errors_1.ErrorCode.FileUploadInvalidArgumentsError);
|
|
1729
|
-
}));
|
|
1730
|
-
throw new Error(buildFilesUploadMissingMessage());
|
|
1731
|
-
}
|
|
1732
|
-
/**
|
|
1733
|
-
* Returns a single file upload's data
|
|
1734
|
-
* @param options
|
|
1735
|
-
* @returns Binary data representation of file
|
|
1736
|
-
*/
|
|
1737
|
-
async function getFileData(options) {
|
|
1738
|
-
errorIfInvalidOrMissingFileData(options);
|
|
1739
|
-
if ("file" in options) {
|
|
1740
|
-
const { file } = options;
|
|
1741
|
-
if (Buffer.isBuffer(file)) return file;
|
|
1742
|
-
if (typeof file === "string") try {
|
|
1743
|
-
return (0, node_fs_1.readFileSync)(file);
|
|
1744
|
-
} catch (_err) {
|
|
1745
|
-
throw (0, errors_1.errorWithCode)(/* @__PURE__ */ new Error(`Unable to resolve file data for ${file}. Please supply a filepath string, or binary data Buffer or String directly.`), errors_1.ErrorCode.FileUploadInvalidArgumentsError);
|
|
1746
|
-
}
|
|
1747
|
-
const data = await getFileDataAsStream(file);
|
|
1748
|
-
if (data) return data;
|
|
1749
|
-
}
|
|
1750
|
-
if ("content" in options) return Buffer.from(options.content);
|
|
1751
|
-
throw (0, errors_1.errorWithCode)(/* @__PURE__ */ new Error("There was an issue getting the file data for the file or content supplied"), errors_1.ErrorCode.FileUploadReadFileDataError);
|
|
1752
|
-
}
|
|
1753
|
-
function getFileDataLength(data) {
|
|
1754
|
-
if (data) return Buffer.byteLength(data, "utf8");
|
|
1755
|
-
throw (0, errors_1.errorWithCode)(new Error(buildFileSizeErrorMsg()), errors_1.ErrorCode.FileUploadReadFileDataError);
|
|
1756
|
-
}
|
|
1757
|
-
async function getFileDataAsStream(readable) {
|
|
1758
|
-
const chunks = [];
|
|
1759
|
-
return new Promise((resolve, reject) => {
|
|
1760
|
-
readable.on("readable", () => {
|
|
1761
|
-
let chunk = readable.read();
|
|
1762
|
-
while (chunk !== null) {
|
|
1763
|
-
chunks.push(chunk);
|
|
1764
|
-
chunk = readable.read();
|
|
1765
|
-
}
|
|
1766
|
-
});
|
|
1767
|
-
readable.on("end", () => {
|
|
1768
|
-
if (chunks.length > 0) resolve(Buffer.concat(chunks));
|
|
1769
|
-
else reject(Error("No data in supplied file"));
|
|
1770
|
-
});
|
|
1771
|
-
});
|
|
1772
|
-
}
|
|
1773
|
-
/**
|
|
1774
|
-
* Filters through all fileUploads and groups them into jobs for completion
|
|
1775
|
-
* based on combination of channel_id, thread_ts, initial_comment, blocks.
|
|
1776
|
-
* {@link https://docs.slack.dev/reference/methods/files.completeUploadExternal files.completeUploadExternal} allows for multiple
|
|
1777
|
-
* files to be uploaded with a message (`initial_comment`), and as a threaded message (`thread_ts`)
|
|
1778
|
-
* In order to be grouped together, file uploads must have like properties.
|
|
1779
|
-
* @param fileUploads
|
|
1780
|
-
* @returns
|
|
1781
|
-
*/
|
|
1782
|
-
function getAllFileUploadsToComplete(fileUploads) {
|
|
1783
|
-
const toComplete = {};
|
|
1784
|
-
for (const upload of fileUploads) {
|
|
1785
|
-
const { blocks, channel_id, thread_ts, initial_comment, file_id, title } = upload;
|
|
1786
|
-
if (file_id) {
|
|
1787
|
-
const compareString = `:::${channel_id}:::${thread_ts}:::${initial_comment}:::${JSON.stringify(blocks)}`;
|
|
1788
|
-
if (!Object.prototype.hasOwnProperty.call(toComplete, compareString)) {
|
|
1789
|
-
toComplete[compareString] = {
|
|
1790
|
-
files: [{
|
|
1791
|
-
id: file_id,
|
|
1792
|
-
title
|
|
1793
|
-
}],
|
|
1794
|
-
channel_id,
|
|
1795
|
-
blocks,
|
|
1796
|
-
initial_comment
|
|
1797
|
-
};
|
|
1798
|
-
if (thread_ts && channel_id) {
|
|
1799
|
-
const fileThreadDestinationArgument = {
|
|
1800
|
-
channel_id,
|
|
1801
|
-
thread_ts
|
|
1802
|
-
};
|
|
1803
|
-
toComplete[compareString] = Object.assign(Object.assign({}, toComplete[compareString]), fileThreadDestinationArgument);
|
|
1804
|
-
}
|
|
1805
|
-
if ("token" in upload) toComplete[compareString].token = upload.token;
|
|
1806
|
-
} else toComplete[compareString].files.push({
|
|
1807
|
-
id: file_id,
|
|
1808
|
-
title
|
|
1809
|
-
});
|
|
1810
|
-
} else throw new Error(buildMissingFileIdError());
|
|
1811
|
-
}
|
|
1812
|
-
return toComplete;
|
|
1813
|
-
}
|
|
1814
|
-
/**
|
|
1815
|
-
* Advise to use the files.uploadV2 method over legacy files.upload method and over
|
|
1816
|
-
* lower-level utilities.
|
|
1817
|
-
* @param method
|
|
1818
|
-
* @param logger
|
|
1819
|
-
*/
|
|
1820
|
-
function warnIfNotUsingFilesUploadV2(method, logger) {
|
|
1821
|
-
const isTargetMethod = ["files.upload"].includes(method);
|
|
1822
|
-
if (method === "files.upload") logger.warn(buildLegacyMethodWarning(method));
|
|
1823
|
-
if (isTargetMethod) logger.info(buildGeneralFilesUploadWarning());
|
|
1824
|
-
}
|
|
1825
|
-
/**
|
|
1826
|
-
* `channels` param is supported but only when a single channel is specified.
|
|
1827
|
-
* @param options
|
|
1828
|
-
* @param logger
|
|
1829
|
-
*/
|
|
1830
|
-
function warnIfChannels(options, logger) {
|
|
1831
|
-
if (options.channels) logger.warn(buildChannelsWarning());
|
|
1832
|
-
}
|
|
1833
|
-
/**
|
|
1834
|
-
* v1 files.upload supported `channels` parameter provided as a comma-separated
|
|
1835
|
-
* string of values, e.g. 'C1234,C5678'. V2 no longer supports this csv value.
|
|
1836
|
-
* You may still supply `channels` with a single channel string value e.g. 'C1234'
|
|
1837
|
-
* but it is highly encouraged to supply `channel_id` instead.
|
|
1838
|
-
* @param options
|
|
1839
|
-
*/
|
|
1840
|
-
function errorIfChannelsCsv(options) {
|
|
1841
|
-
if ((options.channels ? options.channels.split(",") : []).length > 1) throw (0, errors_1.errorWithCode)(new Error(buildMultipleChannelsErrorMsg()), errors_1.ErrorCode.FileUploadInvalidArgumentsError);
|
|
1842
|
-
}
|
|
1843
|
-
/**
|
|
1844
|
-
* Checks for either a file or content property and errors if missing
|
|
1845
|
-
* @param options
|
|
1846
|
-
*/
|
|
1847
|
-
function errorIfInvalidOrMissingFileData(options) {
|
|
1848
|
-
const hasFile = "file" in options;
|
|
1849
|
-
const hasContent = "content" in options;
|
|
1850
|
-
if (!(hasFile || hasContent) || hasFile && hasContent) throw (0, errors_1.errorWithCode)(/* @__PURE__ */ new Error("Either a file or content field is required for valid file upload. You cannot supply both"), errors_1.ErrorCode.FileUploadInvalidArgumentsError);
|
|
1851
|
-
if ("file" in options) {
|
|
1852
|
-
const { file } = options;
|
|
1853
|
-
if (file && !(typeof file === "string" || Buffer.isBuffer(file) || file instanceof node_stream_1.Readable)) throw (0, errors_1.errorWithCode)(/* @__PURE__ */ new Error("file must be a valid string path, buffer or Readable"), errors_1.ErrorCode.FileUploadInvalidArgumentsError);
|
|
1854
|
-
}
|
|
1855
|
-
if ("content" in options && options.content && typeof options.content !== "string") throw (0, errors_1.errorWithCode)(/* @__PURE__ */ new Error("content must be a string"), errors_1.ErrorCode.FileUploadInvalidArgumentsError);
|
|
1856
|
-
}
|
|
1857
|
-
/**
|
|
1858
|
-
* @param options
|
|
1859
|
-
* @param logger
|
|
1860
|
-
* @returns filename if it exists
|
|
1861
|
-
*/
|
|
1862
|
-
function warnIfMissingOrInvalidFileNameAndDefault(options, logger) {
|
|
1863
|
-
var _a;
|
|
1864
|
-
const DEFAULT_FILENAME = `file.${(_a = options.filetype) !== null && _a !== void 0 ? _a : "txt"}`;
|
|
1865
|
-
const { filename } = options;
|
|
1866
|
-
if (!filename) {
|
|
1867
|
-
logger.warn(buildMissingFileNameWarning());
|
|
1868
|
-
return DEFAULT_FILENAME;
|
|
1869
|
-
}
|
|
1870
|
-
if (filename.split(".").length < 2) logger.warn(buildMissingExtensionWarning(filename));
|
|
1871
|
-
return filename;
|
|
1872
|
-
}
|
|
1873
|
-
/**
|
|
1874
|
-
* `filetype` param is no longer supported and will be ignored
|
|
1875
|
-
* @param options
|
|
1876
|
-
* @param logger
|
|
1877
|
-
*/
|
|
1878
|
-
function warnIfLegacyFileType(options, logger) {
|
|
1879
|
-
if (options.filetype) logger.warn(buildLegacyFileTypeWarning());
|
|
1880
|
-
}
|
|
1881
|
-
function buildMissingFileIdError() {
|
|
1882
|
-
return "Missing required file id for file upload completion";
|
|
1883
|
-
}
|
|
1884
|
-
function buildFileSizeErrorMsg() {
|
|
1885
|
-
return "There was an issue calculating the size of your file";
|
|
1886
|
-
}
|
|
1887
|
-
function buildLegacyFileTypeWarning() {
|
|
1888
|
-
return "filetype is no longer a supported field in files.uploadV2. \nPlease remove this field. To indicate file type, please do so via the required filename property using the appropriate file extension, e.g. image.png, text.txt";
|
|
1889
|
-
}
|
|
1890
|
-
function buildMissingFileNameWarning() {
|
|
1891
|
-
return "filename is a required field for files.uploadV2. \n For backwards compatibility and ease of migration, defaulting the filename. For best experience and consistent unfurl behavior, you should set the filename property with correct file extension, e.g. image.png, text.txt";
|
|
1892
|
-
}
|
|
1893
|
-
function buildMissingExtensionWarning(filename) {
|
|
1894
|
-
return `filename supplied '${filename}' may be missing a proper extension. Missing extenions may result in unexpected unfurl behavior when shared`;
|
|
1895
|
-
}
|
|
1896
|
-
function buildLegacyMethodWarning(method) {
|
|
1897
|
-
return `${method} may cause some issues like timeouts for relatively large files.`;
|
|
1898
|
-
}
|
|
1899
|
-
function buildGeneralFilesUploadWarning() {
|
|
1900
|
-
return "Our latest recommendation is to use client.files.uploadV2() method, which is mostly compatible and much stabler, instead.";
|
|
1901
|
-
}
|
|
1902
|
-
function buildFilesUploadMissingMessage() {
|
|
1903
|
-
return "Something went wrong with processing file_uploads";
|
|
1904
|
-
}
|
|
1905
|
-
function buildChannelsWarning() {
|
|
1906
|
-
return "Although the 'channels' parameter is still supported for smoother migration from legacy files.upload, we recommend using the new channel_id parameter with a single str value instead (e.g. 'C12345').";
|
|
1907
|
-
}
|
|
1908
|
-
function buildMultipleChannelsErrorMsg() {
|
|
1909
|
-
return "Sharing files with multiple channels is no longer supported in v2. Share files in each channel separately instead.";
|
|
1910
|
-
}
|
|
1911
|
-
function buildInvalidFilesUploadParamError() {
|
|
1912
|
-
return "You may supply file_uploads only for a single channel, message, or thread respectively. Therefore, please supply any channel_id, initial_comment or blocks, or thread_ts in the top-layer.";
|
|
1913
|
-
}
|
|
1914
|
-
}));
|
|
1915
|
-
//#endregion
|
|
1916
|
-
//#region ../../node_modules/.pnpm/@slack+web-api@7.15.1_debug@4.4.3_supports-color@8.1.1_/node_modules/@slack/web-api/dist/helpers.js
|
|
1917
|
-
var require_helpers = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
1918
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1919
|
-
exports.default = delay;
|
|
1920
|
-
/**
|
|
1921
|
-
* Build a Promise that will resolve after the specified number of milliseconds.
|
|
1922
|
-
* @param ms milliseconds to wait
|
|
1923
|
-
* @param value value for eventual resolution
|
|
1924
|
-
*/
|
|
1925
|
-
function delay(ms) {
|
|
1926
|
-
return new Promise((resolve) => {
|
|
1927
|
-
setTimeout(resolve, ms);
|
|
1928
|
-
});
|
|
1929
|
-
}
|
|
1930
|
-
}));
|
|
1931
|
-
//#endregion
|
|
1932
|
-
//#region ../../node_modules/.pnpm/eventemitter3@5.0.4/node_modules/eventemitter3/index.js
|
|
1933
|
-
var require_eventemitter3 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1934
|
-
var has = Object.prototype.hasOwnProperty;
|
|
1935
|
-
var prefix = "~";
|
|
1936
|
-
/**
|
|
1937
|
-
* Constructor to create a storage for our `EE` objects.
|
|
1938
|
-
* An `Events` instance is a plain object whose properties are event names.
|
|
1939
|
-
*
|
|
1940
|
-
* @constructor
|
|
1941
|
-
* @private
|
|
1942
|
-
*/
|
|
1943
|
-
function Events() {}
|
|
1944
|
-
if (Object.create) {
|
|
1945
|
-
Events.prototype = Object.create(null);
|
|
1946
|
-
if (!new Events().__proto__) prefix = false;
|
|
1947
|
-
}
|
|
1948
|
-
/**
|
|
1949
|
-
* Representation of a single event listener.
|
|
1950
|
-
*
|
|
1951
|
-
* @param {Function} fn The listener function.
|
|
1952
|
-
* @param {*} context The context to invoke the listener with.
|
|
1953
|
-
* @param {Boolean} [once=false] Specify if the listener is a one-time listener.
|
|
1954
|
-
* @constructor
|
|
1955
|
-
* @private
|
|
1956
|
-
*/
|
|
1957
|
-
function EE(fn, context, once) {
|
|
1958
|
-
this.fn = fn;
|
|
1959
|
-
this.context = context;
|
|
1960
|
-
this.once = once || false;
|
|
1961
|
-
}
|
|
1962
|
-
/**
|
|
1963
|
-
* Add a listener for a given event.
|
|
1964
|
-
*
|
|
1965
|
-
* @param {EventEmitter} emitter Reference to the `EventEmitter` instance.
|
|
1966
|
-
* @param {(String|Symbol)} event The event name.
|
|
1967
|
-
* @param {Function} fn The listener function.
|
|
1968
|
-
* @param {*} context The context to invoke the listener with.
|
|
1969
|
-
* @param {Boolean} once Specify if the listener is a one-time listener.
|
|
1970
|
-
* @returns {EventEmitter}
|
|
1971
|
-
* @private
|
|
1972
|
-
*/
|
|
1973
|
-
function addListener(emitter, event, fn, context, once) {
|
|
1974
|
-
if (typeof fn !== "function") throw new TypeError("The listener must be a function");
|
|
1975
|
-
var listener = new EE(fn, context || emitter, once), evt = prefix ? prefix + event : event;
|
|
1976
|
-
if (!emitter._events[evt]) emitter._events[evt] = listener, emitter._eventsCount++;
|
|
1977
|
-
else if (!emitter._events[evt].fn) emitter._events[evt].push(listener);
|
|
1978
|
-
else emitter._events[evt] = [emitter._events[evt], listener];
|
|
1979
|
-
return emitter;
|
|
1980
|
-
}
|
|
1981
|
-
/**
|
|
1982
|
-
* Clear event by name.
|
|
1983
|
-
*
|
|
1984
|
-
* @param {EventEmitter} emitter Reference to the `EventEmitter` instance.
|
|
1985
|
-
* @param {(String|Symbol)} evt The Event name.
|
|
1986
|
-
* @private
|
|
1987
|
-
*/
|
|
1988
|
-
function clearEvent(emitter, evt) {
|
|
1989
|
-
if (--emitter._eventsCount === 0) emitter._events = new Events();
|
|
1990
|
-
else delete emitter._events[evt];
|
|
1991
|
-
}
|
|
1992
|
-
/**
|
|
1993
|
-
* Minimal `EventEmitter` interface that is molded against the Node.js
|
|
1994
|
-
* `EventEmitter` interface.
|
|
1995
|
-
*
|
|
1996
|
-
* @constructor
|
|
1997
|
-
* @public
|
|
1998
|
-
*/
|
|
1999
|
-
function EventEmitter() {
|
|
2000
|
-
this._events = new Events();
|
|
2001
|
-
this._eventsCount = 0;
|
|
2002
|
-
}
|
|
2003
|
-
/**
|
|
2004
|
-
* Return an array listing the events for which the emitter has registered
|
|
2005
|
-
* listeners.
|
|
2006
|
-
*
|
|
2007
|
-
* @returns {Array}
|
|
2008
|
-
* @public
|
|
2009
|
-
*/
|
|
2010
|
-
EventEmitter.prototype.eventNames = function eventNames() {
|
|
2011
|
-
var names = [], events, name;
|
|
2012
|
-
if (this._eventsCount === 0) return names;
|
|
2013
|
-
for (name in events = this._events) if (has.call(events, name)) names.push(prefix ? name.slice(1) : name);
|
|
2014
|
-
if (Object.getOwnPropertySymbols) return names.concat(Object.getOwnPropertySymbols(events));
|
|
2015
|
-
return names;
|
|
2016
|
-
};
|
|
2017
|
-
/**
|
|
2018
|
-
* Return the listeners registered for a given event.
|
|
2019
|
-
*
|
|
2020
|
-
* @param {(String|Symbol)} event The event name.
|
|
2021
|
-
* @returns {Array} The registered listeners.
|
|
2022
|
-
* @public
|
|
2023
|
-
*/
|
|
2024
|
-
EventEmitter.prototype.listeners = function listeners(event) {
|
|
2025
|
-
var evt = prefix ? prefix + event : event, handlers = this._events[evt];
|
|
2026
|
-
if (!handlers) return [];
|
|
2027
|
-
if (handlers.fn) return [handlers.fn];
|
|
2028
|
-
for (var i = 0, l = handlers.length, ee = new Array(l); i < l; i++) ee[i] = handlers[i].fn;
|
|
2029
|
-
return ee;
|
|
2030
|
-
};
|
|
2031
|
-
/**
|
|
2032
|
-
* Return the number of listeners listening to a given event.
|
|
2033
|
-
*
|
|
2034
|
-
* @param {(String|Symbol)} event The event name.
|
|
2035
|
-
* @returns {Number} The number of listeners.
|
|
2036
|
-
* @public
|
|
2037
|
-
*/
|
|
2038
|
-
EventEmitter.prototype.listenerCount = function listenerCount(event) {
|
|
2039
|
-
var evt = prefix ? prefix + event : event, listeners = this._events[evt];
|
|
2040
|
-
if (!listeners) return 0;
|
|
2041
|
-
if (listeners.fn) return 1;
|
|
2042
|
-
return listeners.length;
|
|
2043
|
-
};
|
|
2044
|
-
/**
|
|
2045
|
-
* Calls each of the listeners registered for a given event.
|
|
2046
|
-
*
|
|
2047
|
-
* @param {(String|Symbol)} event The event name.
|
|
2048
|
-
* @returns {Boolean} `true` if the event had listeners, else `false`.
|
|
2049
|
-
* @public
|
|
2050
|
-
*/
|
|
2051
|
-
EventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) {
|
|
2052
|
-
var evt = prefix ? prefix + event : event;
|
|
2053
|
-
if (!this._events[evt]) return false;
|
|
2054
|
-
var listeners = this._events[evt], len = arguments.length, args, i;
|
|
2055
|
-
if (listeners.fn) {
|
|
2056
|
-
if (listeners.once) this.removeListener(event, listeners.fn, void 0, true);
|
|
2057
|
-
switch (len) {
|
|
2058
|
-
case 1: return listeners.fn.call(listeners.context), true;
|
|
2059
|
-
case 2: return listeners.fn.call(listeners.context, a1), true;
|
|
2060
|
-
case 3: return listeners.fn.call(listeners.context, a1, a2), true;
|
|
2061
|
-
case 4: return listeners.fn.call(listeners.context, a1, a2, a3), true;
|
|
2062
|
-
case 5: return listeners.fn.call(listeners.context, a1, a2, a3, a4), true;
|
|
2063
|
-
case 6: return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true;
|
|
2064
|
-
}
|
|
2065
|
-
for (i = 1, args = new Array(len - 1); i < len; i++) args[i - 1] = arguments[i];
|
|
2066
|
-
listeners.fn.apply(listeners.context, args);
|
|
2067
|
-
} else {
|
|
2068
|
-
var length = listeners.length, j;
|
|
2069
|
-
for (i = 0; i < length; i++) {
|
|
2070
|
-
if (listeners[i].once) this.removeListener(event, listeners[i].fn, void 0, true);
|
|
2071
|
-
switch (len) {
|
|
2072
|
-
case 1:
|
|
2073
|
-
listeners[i].fn.call(listeners[i].context);
|
|
2074
|
-
break;
|
|
2075
|
-
case 2:
|
|
2076
|
-
listeners[i].fn.call(listeners[i].context, a1);
|
|
2077
|
-
break;
|
|
2078
|
-
case 3:
|
|
2079
|
-
listeners[i].fn.call(listeners[i].context, a1, a2);
|
|
2080
|
-
break;
|
|
2081
|
-
case 4:
|
|
2082
|
-
listeners[i].fn.call(listeners[i].context, a1, a2, a3);
|
|
2083
|
-
break;
|
|
2084
|
-
default:
|
|
2085
|
-
if (!args) for (j = 1, args = new Array(len - 1); j < len; j++) args[j - 1] = arguments[j];
|
|
2086
|
-
listeners[i].fn.apply(listeners[i].context, args);
|
|
2087
|
-
}
|
|
2088
|
-
}
|
|
2089
|
-
}
|
|
2090
|
-
return true;
|
|
2091
|
-
};
|
|
2092
|
-
/**
|
|
2093
|
-
* Add a listener for a given event.
|
|
2094
|
-
*
|
|
2095
|
-
* @param {(String|Symbol)} event The event name.
|
|
2096
|
-
* @param {Function} fn The listener function.
|
|
2097
|
-
* @param {*} [context=this] The context to invoke the listener with.
|
|
2098
|
-
* @returns {EventEmitter} `this`.
|
|
2099
|
-
* @public
|
|
2100
|
-
*/
|
|
2101
|
-
EventEmitter.prototype.on = function on(event, fn, context) {
|
|
2102
|
-
return addListener(this, event, fn, context, false);
|
|
2103
|
-
};
|
|
2104
|
-
/**
|
|
2105
|
-
* Add a one-time listener for a given event.
|
|
2106
|
-
*
|
|
2107
|
-
* @param {(String|Symbol)} event The event name.
|
|
2108
|
-
* @param {Function} fn The listener function.
|
|
2109
|
-
* @param {*} [context=this] The context to invoke the listener with.
|
|
2110
|
-
* @returns {EventEmitter} `this`.
|
|
2111
|
-
* @public
|
|
2112
|
-
*/
|
|
2113
|
-
EventEmitter.prototype.once = function once(event, fn, context) {
|
|
2114
|
-
return addListener(this, event, fn, context, true);
|
|
2115
|
-
};
|
|
2116
|
-
/**
|
|
2117
|
-
* Remove the listeners of a given event.
|
|
2118
|
-
*
|
|
2119
|
-
* @param {(String|Symbol)} event The event name.
|
|
2120
|
-
* @param {Function} fn Only remove the listeners that match this function.
|
|
2121
|
-
* @param {*} context Only remove the listeners that have this context.
|
|
2122
|
-
* @param {Boolean} once Only remove one-time listeners.
|
|
2123
|
-
* @returns {EventEmitter} `this`.
|
|
2124
|
-
* @public
|
|
2125
|
-
*/
|
|
2126
|
-
EventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) {
|
|
2127
|
-
var evt = prefix ? prefix + event : event;
|
|
2128
|
-
if (!this._events[evt]) return this;
|
|
2129
|
-
if (!fn) {
|
|
2130
|
-
clearEvent(this, evt);
|
|
2131
|
-
return this;
|
|
2132
|
-
}
|
|
2133
|
-
var listeners = this._events[evt];
|
|
2134
|
-
if (listeners.fn) {
|
|
2135
|
-
if (listeners.fn === fn && (!once || listeners.once) && (!context || listeners.context === context)) clearEvent(this, evt);
|
|
2136
|
-
} else {
|
|
2137
|
-
for (var i = 0, events = [], length = listeners.length; i < length; i++) if (listeners[i].fn !== fn || once && !listeners[i].once || context && listeners[i].context !== context) events.push(listeners[i]);
|
|
2138
|
-
if (events.length) this._events[evt] = events.length === 1 ? events[0] : events;
|
|
2139
|
-
else clearEvent(this, evt);
|
|
2140
|
-
}
|
|
2141
|
-
return this;
|
|
2142
|
-
};
|
|
2143
|
-
/**
|
|
2144
|
-
* Remove all listeners, or those of the specified event.
|
|
2145
|
-
*
|
|
2146
|
-
* @param {(String|Symbol)} [event] The event name.
|
|
2147
|
-
* @returns {EventEmitter} `this`.
|
|
2148
|
-
* @public
|
|
2149
|
-
*/
|
|
2150
|
-
EventEmitter.prototype.removeAllListeners = function removeAllListeners(event) {
|
|
2151
|
-
var evt;
|
|
2152
|
-
if (event) {
|
|
2153
|
-
evt = prefix ? prefix + event : event;
|
|
2154
|
-
if (this._events[evt]) clearEvent(this, evt);
|
|
2155
|
-
} else {
|
|
2156
|
-
this._events = new Events();
|
|
2157
|
-
this._eventsCount = 0;
|
|
2158
|
-
}
|
|
2159
|
-
return this;
|
|
2160
|
-
};
|
|
2161
|
-
EventEmitter.prototype.off = EventEmitter.prototype.removeListener;
|
|
2162
|
-
EventEmitter.prototype.addListener = EventEmitter.prototype.on;
|
|
2163
|
-
EventEmitter.prefixed = prefix;
|
|
2164
|
-
EventEmitter.EventEmitter = EventEmitter;
|
|
2165
|
-
if ("undefined" !== typeof module) module.exports = EventEmitter;
|
|
2166
|
-
}));
|
|
2167
|
-
//#endregion
|
|
2168
|
-
//#region ../../node_modules/.pnpm/@slack+types@2.20.1/node_modules/@slack/types/dist/block-kit/block-elements.js
|
|
2169
|
-
var require_block_elements = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
2170
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2171
|
-
}));
|
|
2172
|
-
//#endregion
|
|
2173
|
-
//#region ../../node_modules/.pnpm/@slack+types@2.20.1/node_modules/@slack/types/dist/block-kit/blocks.js
|
|
2174
|
-
var require_blocks = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
2175
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2176
|
-
}));
|
|
2177
|
-
//#endregion
|
|
2178
|
-
//#region ../../node_modules/.pnpm/@slack+types@2.20.1/node_modules/@slack/types/dist/block-kit/composition-objects.js
|
|
2179
|
-
var require_composition_objects = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
2180
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2181
|
-
}));
|
|
2182
|
-
//#endregion
|
|
2183
|
-
//#region ../../node_modules/.pnpm/@slack+types@2.20.1/node_modules/@slack/types/dist/block-kit/extensions.js
|
|
2184
|
-
var require_extensions = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
2185
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2186
|
-
}));
|
|
2187
|
-
//#endregion
|
|
2188
|
-
//#region ../../node_modules/.pnpm/@slack+types@2.20.1/node_modules/@slack/types/dist/calls.js
|
|
2189
|
-
var require_calls = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
2190
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2191
|
-
}));
|
|
2192
|
-
//#endregion
|
|
2193
|
-
//#region ../../node_modules/.pnpm/@slack+types@2.20.1/node_modules/@slack/types/dist/chunk.js
|
|
2194
|
-
var require_chunk = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
2195
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2196
|
-
}));
|
|
2197
|
-
//#endregion
|
|
2198
|
-
//#region ../../node_modules/.pnpm/@slack+types@2.20.1/node_modules/@slack/types/dist/dialog.js
|
|
2199
|
-
var require_dialog = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
2200
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2201
|
-
}));
|
|
2202
|
-
//#endregion
|
|
2203
|
-
//#region ../../node_modules/.pnpm/@slack+types@2.20.1/node_modules/@slack/types/dist/events/app.js
|
|
2204
|
-
var require_app = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
2205
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2206
|
-
}));
|
|
2207
|
-
//#endregion
|
|
2208
|
-
//#region ../../node_modules/.pnpm/@slack+types@2.20.1/node_modules/@slack/types/dist/events/assistant.js
|
|
2209
|
-
var require_assistant = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
2210
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2211
|
-
}));
|
|
2212
|
-
//#endregion
|
|
2213
|
-
//#region ../../node_modules/.pnpm/@slack+types@2.20.1/node_modules/@slack/types/dist/events/call.js
|
|
2214
|
-
var require_call = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
2215
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2216
|
-
}));
|
|
2217
|
-
//#endregion
|
|
2218
|
-
//#region ../../node_modules/.pnpm/@slack+types@2.20.1/node_modules/@slack/types/dist/events/channel.js
|
|
2219
|
-
var require_channel = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
2220
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2221
|
-
}));
|
|
2222
|
-
//#endregion
|
|
2223
|
-
//#region ../../node_modules/.pnpm/@slack+types@2.20.1/node_modules/@slack/types/dist/events/dnd.js
|
|
2224
|
-
var require_dnd = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
2225
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2226
|
-
}));
|
|
2227
|
-
//#endregion
|
|
2228
|
-
//#region ../../node_modules/.pnpm/@slack+types@2.20.1/node_modules/@slack/types/dist/events/email.js
|
|
2229
|
-
var require_email = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
2230
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2231
|
-
}));
|
|
2232
|
-
//#endregion
|
|
2233
|
-
//#region ../../node_modules/.pnpm/@slack+types@2.20.1/node_modules/@slack/types/dist/events/emoji.js
|
|
2234
|
-
var require_emoji = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
2235
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2236
|
-
}));
|
|
2237
|
-
//#endregion
|
|
2238
|
-
//#region ../../node_modules/.pnpm/@slack+types@2.20.1/node_modules/@slack/types/dist/events/file.js
|
|
2239
|
-
var require_file = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
2240
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2241
|
-
}));
|
|
2242
|
-
//#endregion
|
|
2243
|
-
//#region ../../node_modules/.pnpm/@slack+types@2.20.1/node_modules/@slack/types/dist/events/function.js
|
|
2244
|
-
var require_function = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
2245
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2246
|
-
}));
|
|
2247
|
-
//#endregion
|
|
2248
|
-
//#region ../../node_modules/.pnpm/@slack+types@2.20.1/node_modules/@slack/types/dist/events/grid-migration.js
|
|
2249
|
-
var require_grid_migration = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
2250
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2251
|
-
}));
|
|
2252
|
-
//#endregion
|
|
2253
|
-
//#region ../../node_modules/.pnpm/@slack+types@2.20.1/node_modules/@slack/types/dist/events/group.js
|
|
2254
|
-
var require_group = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
2255
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2256
|
-
}));
|
|
2257
|
-
//#endregion
|
|
2258
|
-
//#region ../../node_modules/.pnpm/@slack+types@2.20.1/node_modules/@slack/types/dist/events/im.js
|
|
2259
|
-
var require_im = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
2260
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2261
|
-
}));
|
|
2262
|
-
//#endregion
|
|
2263
|
-
//#region ../../node_modules/.pnpm/@slack+types@2.20.1/node_modules/@slack/types/dist/events/invite.js
|
|
2264
|
-
var require_invite = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
2265
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2266
|
-
}));
|
|
2267
|
-
//#endregion
|
|
2268
|
-
//#region ../../node_modules/.pnpm/@slack+types@2.20.1/node_modules/@slack/types/dist/events/link-shared.js
|
|
2269
|
-
var require_link_shared = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
2270
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2271
|
-
}));
|
|
2272
|
-
//#endregion
|
|
2273
|
-
//#region ../../node_modules/.pnpm/@slack+types@2.20.1/node_modules/@slack/types/dist/events/member.js
|
|
2274
|
-
var require_member = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
2275
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2276
|
-
}));
|
|
2277
|
-
//#endregion
|
|
2278
|
-
//#region ../../node_modules/.pnpm/@slack+types@2.20.1/node_modules/@slack/types/dist/events/message.js
|
|
2279
|
-
var require_message = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
2280
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2281
|
-
}));
|
|
2282
|
-
//#endregion
|
|
2283
|
-
//#region ../../node_modules/.pnpm/@slack+types@2.20.1/node_modules/@slack/types/dist/events/message-metadata.js
|
|
2284
|
-
var require_message_metadata$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
2285
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2286
|
-
}));
|
|
2287
|
-
//#endregion
|
|
2288
|
-
//#region ../../node_modules/.pnpm/@slack+types@2.20.1/node_modules/@slack/types/dist/events/pin.js
|
|
2289
|
-
var require_pin = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
2290
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2291
|
-
}));
|
|
2292
|
-
//#endregion
|
|
2293
|
-
//#region ../../node_modules/.pnpm/@slack+types@2.20.1/node_modules/@slack/types/dist/events/reaction.js
|
|
2294
|
-
var require_reaction = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
2295
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2296
|
-
}));
|
|
2297
|
-
//#endregion
|
|
2298
|
-
//#region ../../node_modules/.pnpm/@slack+types@2.20.1/node_modules/@slack/types/dist/events/shared-channel.js
|
|
2299
|
-
var require_shared_channel = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
2300
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2301
|
-
}));
|
|
2302
|
-
//#endregion
|
|
2303
|
-
//#region ../../node_modules/.pnpm/@slack+types@2.20.1/node_modules/@slack/types/dist/events/star.js
|
|
2304
|
-
var require_star = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
2305
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2306
|
-
}));
|
|
2307
|
-
//#endregion
|
|
2308
|
-
//#region ../../node_modules/.pnpm/@slack+types@2.20.1/node_modules/@slack/types/dist/events/steps-from-apps.js
|
|
2309
|
-
var require_steps_from_apps = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
2310
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2311
|
-
}));
|
|
2312
|
-
//#endregion
|
|
2313
|
-
//#region ../../node_modules/.pnpm/@slack+types@2.20.1/node_modules/@slack/types/dist/events/subteam.js
|
|
2314
|
-
var require_subteam = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
2315
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2316
|
-
}));
|
|
2317
|
-
//#endregion
|
|
2318
|
-
//#region ../../node_modules/.pnpm/@slack+types@2.20.1/node_modules/@slack/types/dist/events/team.js
|
|
2319
|
-
var require_team = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
2320
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2321
|
-
}));
|
|
2322
|
-
//#endregion
|
|
2323
|
-
//#region ../../node_modules/.pnpm/@slack+types@2.20.1/node_modules/@slack/types/dist/events/token.js
|
|
2324
|
-
var require_token = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
2325
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2326
|
-
}));
|
|
2327
|
-
//#endregion
|
|
2328
|
-
//#region ../../node_modules/.pnpm/@slack+types@2.20.1/node_modules/@slack/types/dist/events/user.js
|
|
2329
|
-
var require_user = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
2330
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2331
|
-
}));
|
|
2332
|
-
//#endregion
|
|
2333
|
-
//#region ../../node_modules/.pnpm/@slack+types@2.20.1/node_modules/@slack/types/dist/events/index.js
|
|
2334
|
-
var require_events = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
2335
|
-
var __createBinding = exports && exports.__createBinding || (Object.create ? (function(o, m, k, k2) {
|
|
2336
|
-
if (k2 === void 0) k2 = k;
|
|
2337
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
2338
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) desc = {
|
|
2339
|
-
enumerable: true,
|
|
2340
|
-
get: function() {
|
|
2341
|
-
return m[k];
|
|
2342
|
-
}
|
|
2343
|
-
};
|
|
2344
|
-
Object.defineProperty(o, k2, desc);
|
|
2345
|
-
}) : (function(o, m, k, k2) {
|
|
2346
|
-
if (k2 === void 0) k2 = k;
|
|
2347
|
-
o[k2] = m[k];
|
|
2348
|
-
}));
|
|
2349
|
-
var __exportStar = exports && exports.__exportStar || function(m, exports$4) {
|
|
2350
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports$4, p)) __createBinding(exports$4, m, p);
|
|
2351
|
-
};
|
|
2352
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2353
|
-
__exportStar(require_app(), exports);
|
|
2354
|
-
__exportStar(require_assistant(), exports);
|
|
2355
|
-
__exportStar(require_call(), exports);
|
|
2356
|
-
__exportStar(require_channel(), exports);
|
|
2357
|
-
__exportStar(require_dnd(), exports);
|
|
2358
|
-
__exportStar(require_email(), exports);
|
|
2359
|
-
__exportStar(require_emoji(), exports);
|
|
2360
|
-
__exportStar(require_file(), exports);
|
|
2361
|
-
__exportStar(require_function(), exports);
|
|
2362
|
-
__exportStar(require_grid_migration(), exports);
|
|
2363
|
-
__exportStar(require_group(), exports);
|
|
2364
|
-
__exportStar(require_im(), exports);
|
|
2365
|
-
__exportStar(require_invite(), exports);
|
|
2366
|
-
__exportStar(require_link_shared(), exports);
|
|
2367
|
-
__exportStar(require_member(), exports);
|
|
2368
|
-
__exportStar(require_message(), exports);
|
|
2369
|
-
__exportStar(require_message_metadata$1(), exports);
|
|
2370
|
-
__exportStar(require_pin(), exports);
|
|
2371
|
-
__exportStar(require_reaction(), exports);
|
|
2372
|
-
__exportStar(require_shared_channel(), exports);
|
|
2373
|
-
__exportStar(require_star(), exports);
|
|
2374
|
-
__exportStar(require_steps_from_apps(), exports);
|
|
2375
|
-
__exportStar(require_subteam(), exports);
|
|
2376
|
-
__exportStar(require_team(), exports);
|
|
2377
|
-
__exportStar(require_token(), exports);
|
|
2378
|
-
__exportStar(require_user(), exports);
|
|
2379
|
-
}));
|
|
2380
|
-
//#endregion
|
|
2381
|
-
//#region ../../node_modules/.pnpm/@slack+types@2.20.1/node_modules/@slack/types/dist/message-attachments.js
|
|
2382
|
-
var require_message_attachments = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
2383
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2384
|
-
}));
|
|
2385
|
-
//#endregion
|
|
2386
|
-
//#region ../../node_modules/.pnpm/@slack+types@2.20.1/node_modules/@slack/types/dist/message-metadata.js
|
|
2387
|
-
var require_message_metadata = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
2388
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2389
|
-
exports.CustomFieldType = exports.EntityType = void 0;
|
|
2390
|
-
var EntityType;
|
|
2391
|
-
(function(EntityType) {
|
|
2392
|
-
EntityType["Task"] = "slack#/entities/task";
|
|
2393
|
-
EntityType["File"] = "slack#/entities/file";
|
|
2394
|
-
EntityType["Item"] = "slack#/entities/item";
|
|
2395
|
-
EntityType["Incident"] = "slack#/entities/incident";
|
|
2396
|
-
EntityType["ContentItem"] = "slack#/entities/content_item";
|
|
2397
|
-
})(EntityType || (exports.EntityType = EntityType = {}));
|
|
2398
|
-
var CustomFieldType;
|
|
2399
|
-
(function(CustomFieldType) {
|
|
2400
|
-
CustomFieldType["Integer"] = "integer";
|
|
2401
|
-
CustomFieldType["String"] = "string";
|
|
2402
|
-
CustomFieldType["Array"] = "array";
|
|
2403
|
-
CustomFieldType["Date"] = "slack#/types/date";
|
|
2404
|
-
CustomFieldType["Timestamp"] = "slack#/types/timestamp";
|
|
2405
|
-
CustomFieldType["Image"] = "slack#/types/image";
|
|
2406
|
-
CustomFieldType["ChannelId"] = "slack#/types/channel_id";
|
|
2407
|
-
CustomFieldType["User"] = "slack#/types/user";
|
|
2408
|
-
CustomFieldType["EntityRef"] = "slack#/types/entity_ref";
|
|
2409
|
-
CustomFieldType["Boolean"] = "boolean";
|
|
2410
|
-
CustomFieldType["Link"] = "slack#/types/link";
|
|
2411
|
-
CustomFieldType["Email"] = "slack#/types/email";
|
|
2412
|
-
})(CustomFieldType || (exports.CustomFieldType = CustomFieldType = {}));
|
|
2413
|
-
}));
|
|
2414
|
-
//#endregion
|
|
2415
|
-
//#region ../../node_modules/.pnpm/@slack+types@2.20.1/node_modules/@slack/types/dist/views.js
|
|
2416
|
-
var require_views = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
2417
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2418
|
-
}));
|
|
2419
|
-
//#endregion
|
|
2420
|
-
//#region ../../node_modules/.pnpm/@slack+types@2.20.1/node_modules/@slack/types/dist/index.js
|
|
2421
|
-
var require_dist$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
2422
|
-
var __createBinding = exports && exports.__createBinding || (Object.create ? (function(o, m, k, k2) {
|
|
2423
|
-
if (k2 === void 0) k2 = k;
|
|
2424
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
2425
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) desc = {
|
|
2426
|
-
enumerable: true,
|
|
2427
|
-
get: function() {
|
|
2428
|
-
return m[k];
|
|
2429
|
-
}
|
|
2430
|
-
};
|
|
2431
|
-
Object.defineProperty(o, k2, desc);
|
|
2432
|
-
}) : (function(o, m, k, k2) {
|
|
2433
|
-
if (k2 === void 0) k2 = k;
|
|
2434
|
-
o[k2] = m[k];
|
|
2435
|
-
}));
|
|
2436
|
-
var __exportStar = exports && exports.__exportStar || function(m, exports$3) {
|
|
2437
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports$3, p)) __createBinding(exports$3, m, p);
|
|
2438
|
-
};
|
|
2439
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2440
|
-
__exportStar(require_block_elements(), exports);
|
|
2441
|
-
__exportStar(require_blocks(), exports);
|
|
2442
|
-
__exportStar(require_composition_objects(), exports);
|
|
2443
|
-
__exportStar(require_extensions(), exports);
|
|
2444
|
-
__exportStar(require_calls(), exports);
|
|
2445
|
-
__exportStar(require_chunk(), exports);
|
|
2446
|
-
__exportStar(require_dialog(), exports);
|
|
2447
|
-
__exportStar(require_events(), exports);
|
|
2448
|
-
__exportStar(require_message_attachments(), exports);
|
|
2449
|
-
__exportStar(require_message_metadata(), exports);
|
|
2450
|
-
__exportStar(require_views(), exports);
|
|
2451
|
-
}));
|
|
2452
|
-
//#endregion
|
|
2453
|
-
//#region ../../node_modules/.pnpm/@slack+web-api@7.15.1_debug@4.4.3_supports-color@8.1.1_/node_modules/@slack/web-api/dist/methods.js
|
|
2454
|
-
var require_methods = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
2455
|
-
var __createBinding = exports && exports.__createBinding || (Object.create ? (function(o, m, k, k2) {
|
|
2456
|
-
if (k2 === void 0) k2 = k;
|
|
2457
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
2458
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) desc = {
|
|
2459
|
-
enumerable: true,
|
|
2460
|
-
get: function() {
|
|
2461
|
-
return m[k];
|
|
2462
|
-
}
|
|
2463
|
-
};
|
|
2464
|
-
Object.defineProperty(o, k2, desc);
|
|
2465
|
-
}) : (function(o, m, k, k2) {
|
|
2466
|
-
if (k2 === void 0) k2 = k;
|
|
2467
|
-
o[k2] = m[k];
|
|
2468
|
-
}));
|
|
2469
|
-
var __exportStar = exports && exports.__exportStar || function(m, exports$2) {
|
|
2470
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports$2, p)) __createBinding(exports$2, m, p);
|
|
2471
|
-
};
|
|
2472
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2473
|
-
exports.Methods = void 0;
|
|
2474
|
-
var eventemitter3_1 = require_eventemitter3();
|
|
2475
|
-
var WebClient_1 = require_WebClient();
|
|
2476
|
-
/**
|
|
2477
|
-
* Binds a certain `method` and its (required) arguments and result types to the `apiCall` method in `WebClient`.
|
|
2478
|
-
*/
|
|
2479
|
-
function bindApiCall(self, method) {
|
|
2480
|
-
return self.apiCall.bind(self, method);
|
|
2481
|
-
}
|
|
2482
|
-
/**
|
|
2483
|
-
* Binds a certain `method` and its (required) arguments and result types to the `apiCall` method in `WebClient`.
|
|
2484
|
-
*/
|
|
2485
|
-
function bindApiCallWithOptionalArgument(self, method) {
|
|
2486
|
-
return self.apiCall.bind(self, method);
|
|
2487
|
-
}
|
|
2488
|
-
function bindFilesUploadV2(self) {
|
|
2489
|
-
return self.filesUploadV2.bind(self);
|
|
2490
|
-
}
|
|
2491
|
-
/**
|
|
2492
|
-
* A class that defines all Web API methods, their arguments type, their response type, and binds those methods to the
|
|
2493
|
-
* `apiCall` class method.
|
|
2494
|
-
*/
|
|
2495
|
-
var Methods = class extends eventemitter3_1.EventEmitter {
|
|
2496
|
-
constructor() {
|
|
2497
|
-
super();
|
|
2498
|
-
this.admin = {
|
|
2499
|
-
analytics: {
|
|
2500
|
-
/**
|
|
2501
|
-
* @description Retrieve analytics data for a given date, presented as a compressed JSON file.
|
|
2502
|
-
* @see {@link https://docs.slack.dev/reference/methods/api.test `api.test` API reference}.
|
|
2503
|
-
*/
|
|
2504
|
-
getFile: bindApiCall(this, "admin.analytics.getFile") },
|
|
2505
|
-
apps: {
|
|
2506
|
-
activities: {
|
|
2507
|
-
/**
|
|
2508
|
-
* @description Get logs for a specified team/org.
|
|
2509
|
-
* @see {@link https://docs.slack.dev/reference/methods/admin.apps.activities.list `admin.apps.activities.list` API reference}.
|
|
2510
|
-
*/
|
|
2511
|
-
list: bindApiCallWithOptionalArgument(this, "admin.apps.activities.list") },
|
|
2512
|
-
/**
|
|
2513
|
-
* @description Approve an app for installation on a workspace.
|
|
2514
|
-
* @see {@link https://docs.slack.dev/reference/methods/admin.apps.approve `admin.apps.approve` API reference}.
|
|
2515
|
-
*/
|
|
2516
|
-
approve: bindApiCall(this, "admin.apps.approve"),
|
|
2517
|
-
approved: {
|
|
2518
|
-
/**
|
|
2519
|
-
* @description List approved apps for an org or workspace.
|
|
2520
|
-
* @see {@link https://docs.slack.dev/reference/methods/admin.apps.approved.list `admin.apps.approved.list` API reference}.
|
|
2521
|
-
*/
|
|
2522
|
-
list: bindApiCall(this, "admin.apps.approved.list") },
|
|
2523
|
-
/**
|
|
2524
|
-
* @description Clear an app resolution.
|
|
2525
|
-
* @see {@link https://docs.slack.dev/reference/methods/admin.apps.clearResolution `admin.apps.clearResolution` API reference}.
|
|
2526
|
-
*/
|
|
2527
|
-
clearResolution: bindApiCall(this, "admin.apps.clearResolution"),
|
|
2528
|
-
config: {
|
|
2529
|
-
/**
|
|
2530
|
-
* @description Look up the app config for connectors by their IDs.
|
|
2531
|
-
* @see {@link https://docs.slack.dev/reference/methods/admin.apps.config.lookup `admin.apps.config.lookup` API reference}.
|
|
2532
|
-
*/
|
|
2533
|
-
lookup: bindApiCall(this, "admin.apps.config.lookup"),
|
|
2534
|
-
/**
|
|
2535
|
-
* @description Set the app config for a connector.
|
|
2536
|
-
* @see {@link https://docs.slack.dev/reference/methods/admin.apps.config.set `admin.apps.config.set` API reference}.
|
|
2537
|
-
*/
|
|
2538
|
-
set: bindApiCall(this, "admin.apps.config.set")
|
|
2539
|
-
},
|
|
2540
|
-
requests: {
|
|
2541
|
-
/**
|
|
2542
|
-
* @description Cancel app request for team.
|
|
2543
|
-
* @see {@link https://docs.slack.dev/reference/methods/admin.apps.requests.cancel `admin.apps.requests.cancel` API reference}.
|
|
2544
|
-
*/
|
|
2545
|
-
cancel: bindApiCall(this, "admin.apps.requests.cancel"),
|
|
2546
|
-
/**
|
|
2547
|
-
* @description List app requests for a team/workspace.
|
|
2548
|
-
* @see {@link https://docs.slack.dev/reference/methods/admin.apps.requests.list `admin.apps.requests.list` API reference}.
|
|
2549
|
-
*/
|
|
2550
|
-
list: bindApiCall(this, "admin.apps.requests.list")
|
|
2551
|
-
},
|
|
2552
|
-
/**
|
|
2553
|
-
* @description Restrict an app for installation on a workspace.
|
|
2554
|
-
* @see {@link https://docs.slack.dev/reference/methods/admin.apps.restrict `admin.apps.restrict` API reference}.
|
|
2555
|
-
*/
|
|
2556
|
-
restrict: bindApiCall(this, "admin.apps.restrict"),
|
|
2557
|
-
restricted: {
|
|
2558
|
-
/**
|
|
2559
|
-
* @description List restricted apps for an org or workspace.
|
|
2560
|
-
* @see {@link https://docs.slack.dev/reference/methods/admin.apps.restricted.list `admin.apps.restricted.list` API reference}.
|
|
2561
|
-
*/
|
|
2562
|
-
list: bindApiCall(this, "admin.apps.restricted.list") },
|
|
2563
|
-
/**
|
|
2564
|
-
* @description Uninstall an app from one or many workspaces, or an entire enterprise organization.
|
|
2565
|
-
* @see {@link https://docs.slack.dev/reference/methods/admin.apps.uninstall `admin.apps.uninstall` API reference}.
|
|
2566
|
-
*/
|
|
2567
|
-
uninstall: bindApiCall(this, "admin.apps.uninstall")
|
|
2568
|
-
},
|
|
2569
|
-
auth: { policy: {
|
|
2570
|
-
/**
|
|
2571
|
-
* @description Assign entities to a particular authentication policy.
|
|
2572
|
-
* @see {@link https://docs.slack.dev/reference/methods/admin.auth.policy.assignEntities `admin.auth.policy.assignEntities` API reference}.
|
|
2573
|
-
*/
|
|
2574
|
-
assignEntities: bindApiCall(this, "admin.auth.policy.assignEntities"),
|
|
2575
|
-
/**
|
|
2576
|
-
* @description Fetch all the entities assigned to a particular authentication policy by name.
|
|
2577
|
-
* @see {@link https://docs.slack.dev/reference/methods/admin.auth.policy.getEntities `admin.auth.policy.getEntities` API reference}.
|
|
2578
|
-
*/
|
|
2579
|
-
getEntities: bindApiCall(this, "admin.auth.policy.getEntities"),
|
|
2580
|
-
/**
|
|
2581
|
-
* @description Remove specified entities from a specified authentication policy.
|
|
2582
|
-
* @see {@link https://docs.slack.dev/reference/methods/admin.auth.policy.removeEntities `admin.auth.policy.removeEntities` API reference}.
|
|
2583
|
-
*/
|
|
2584
|
-
removeEntities: bindApiCall(this, "admin.auth.policy.removeEntities")
|
|
2585
|
-
} },
|
|
2586
|
-
barriers: {
|
|
2587
|
-
/**
|
|
2588
|
-
* @description Create an Information Barrier.
|
|
2589
|
-
* @see {@link https://docs.slack.dev/reference/methods/admin.barriers.create `admin.barriers.create` API reference}.
|
|
2590
|
-
*/
|
|
2591
|
-
create: bindApiCall(this, "admin.barriers.create"),
|
|
2592
|
-
/**
|
|
2593
|
-
* @description Delete an existing Information Barrier.
|
|
2594
|
-
* @see {@link https://docs.slack.dev/reference/methods/admin.barriers.delete `admin.barriers.delete` API reference}.
|
|
2595
|
-
*/
|
|
2596
|
-
delete: bindApiCall(this, "admin.barriers.delete"),
|
|
2597
|
-
/**
|
|
2598
|
-
* @description Get all Information Barriers for your organization.
|
|
2599
|
-
* @see {@link https://docs.slack.dev/reference/methods/admin.barriers.list `admin.barriers.list` API reference}.
|
|
2600
|
-
*/
|
|
2601
|
-
list: bindApiCallWithOptionalArgument(this, "admin.barriers.list"),
|
|
2602
|
-
/**
|
|
2603
|
-
* @description Update an existing Information Barrier.
|
|
2604
|
-
* @see {@link https://docs.slack.dev/reference/methods/admin.barriers.update `admin.barriers.update` API reference}.
|
|
2605
|
-
*/
|
|
2606
|
-
update: bindApiCall(this, "admin.barriers.update")
|
|
2607
|
-
},
|
|
2608
|
-
conversations: {
|
|
2609
|
-
/**
|
|
2610
|
-
* @description Archive a public or private channel.
|
|
2611
|
-
* @see {@link https://docs.slack.dev/reference/methods/admin.conversations.archive `admin.conversations.archive` API reference}.
|
|
2612
|
-
*/
|
|
2613
|
-
archive: bindApiCall(this, "admin.conversations.archive"),
|
|
2614
|
-
/**
|
|
2615
|
-
* @description Archive public or private channels in bulk.
|
|
2616
|
-
* @see {@link https://docs.slack.dev/reference/methods/admin.conversations.bulkArchive `admin.conversations.bulkArchive` API reference}.
|
|
2617
|
-
*/
|
|
2618
|
-
bulkArchive: bindApiCall(this, "admin.conversations.bulkArchive"),
|
|
2619
|
-
/**
|
|
2620
|
-
* @description Delete public or private channels in bulk.
|
|
2621
|
-
* @see {@link https://docs.slack.dev/reference/methods/admin.conversations.bulkDelete `admin.conversations.bulkDelete` API reference}.
|
|
2622
|
-
*/
|
|
2623
|
-
bulkDelete: bindApiCall(this, "admin.conversations.bulkDelete"),
|
|
2624
|
-
/**
|
|
2625
|
-
* @description Move public or private channels in bulk.
|
|
2626
|
-
* @see {@link https://docs.slack.dev/reference/methods/admin.conversations.bulkMove `admin.conversations.bulkMove` API reference}.
|
|
2627
|
-
*/
|
|
2628
|
-
bulkMove: bindApiCall(this, "admin.conversations.bulkMove"),
|
|
2629
|
-
/**
|
|
2630
|
-
* @description Convert a public channel to a private channel.
|
|
2631
|
-
* @see {@link https://docs.slack.dev/reference/methods/admin.conversations.convertToPrivate `admin.conversations.convertToPrivate` API reference}.
|
|
2632
|
-
*/
|
|
2633
|
-
convertToPrivate: bindApiCall(this, "admin.conversations.convertToPrivate"),
|
|
2634
|
-
/**
|
|
2635
|
-
* @description Convert a private channel to a public channel.
|
|
2636
|
-
* @see {@link https://docs.slack.dev/reference/methods/admin.conversations.convertToPublic `admin.conversations.convertToPublic` API reference}.
|
|
2637
|
-
*/
|
|
2638
|
-
convertToPublic: bindApiCall(this, "admin.conversations.convertToPublic"),
|
|
2639
|
-
/**
|
|
2640
|
-
* @description Create a public or private channel-based conversation.
|
|
2641
|
-
* @see {@link https://docs.slack.dev/reference/methods/admin.conversations.create `admin.conversations.create` API reference}.
|
|
2642
|
-
*/
|
|
2643
|
-
create: bindApiCall(this, "admin.conversations.create"),
|
|
2644
|
-
/**
|
|
2645
|
-
* @description Delete a public or private channel.
|
|
2646
|
-
* @see {@link https://docs.slack.dev/reference/methods/admin.conversations.delete `admin.conversations.delete` API reference}.
|
|
2647
|
-
*/
|
|
2648
|
-
delete: bindApiCall(this, "admin.conversations.delete"),
|
|
2649
|
-
/**
|
|
2650
|
-
* @description Disconnect a connected channel from one or more workspaces.
|
|
2651
|
-
* @see {@link https://docs.slack.dev/reference/methods/admin.conversations.disconnectShared `admin.conversations.disconnectShared` API reference}.
|
|
2652
|
-
*/
|
|
2653
|
-
disconnectShared: bindApiCall(this, "admin.conversations.disconnectShared"),
|
|
2654
|
-
ekm: {
|
|
2655
|
-
/**
|
|
2656
|
-
* @description List all disconnected channels — i.e., channels that were once connected to other workspaces
|
|
2657
|
-
* and then disconnected — and the corresponding original channel IDs for key revocation with EKM.
|
|
2658
|
-
* @see {@link https://docs.slack.dev/reference/methods/admin.conversations.ekm.listOriginalConnectedChannelInfo `admin.conversations.ekm.listOriginalConnectedChannelInfo` API reference}.
|
|
2659
|
-
*/
|
|
2660
|
-
listOriginalConnectedChannelInfo: bindApiCallWithOptionalArgument(this, "admin.conversations.ekm.listOriginalConnectedChannelInfo") },
|
|
2661
|
-
/**
|
|
2662
|
-
* @description Get conversation preferences for a public or private channel.
|
|
2663
|
-
* @see {@link https://docs.slack.dev/reference/methods/admin.conversations.getConversationPrefs `admin.conversations.getConversationPrefs` API reference}.
|
|
2664
|
-
*/
|
|
2665
|
-
getConversationPrefs: bindApiCall(this, "admin.conversations.getConversationPrefs"),
|
|
2666
|
-
/**
|
|
2667
|
-
* @description Get a conversation's retention policy.
|
|
2668
|
-
* @see {@link https://docs.slack.dev/reference/methods/admin.conversations.getCustomRetention `admin.conversations.getCustomRetention` API reference}.
|
|
2669
|
-
*/
|
|
2670
|
-
getCustomRetention: bindApiCall(this, "admin.conversations.getCustomRetention"),
|
|
2671
|
-
/**
|
|
2672
|
-
* @description Get all the workspaces a given public or private channel is connected to within
|
|
2673
|
-
* this Enterprise org.
|
|
2674
|
-
* @see {@link https://docs.slack.dev/reference/methods/admin.conversations.getTeams `admin.conversations.getTeams` API reference}.
|
|
2675
|
-
*/
|
|
2676
|
-
getTeams: bindApiCall(this, "admin.conversations.getTeams"),
|
|
2677
|
-
/**
|
|
2678
|
-
* @description Invite a user to a public or private channel.
|
|
2679
|
-
* @see {@link https://docs.slack.dev/reference/methods/admin.conversations.invite `admin.conversations.invite` API reference}.
|
|
2680
|
-
*/
|
|
2681
|
-
invite: bindApiCall(this, "admin.conversations.invite"),
|
|
2682
|
-
/**
|
|
2683
|
-
* @description Returns channels on the given team using the filters.
|
|
2684
|
-
* @see {@link https://docs.slack.dev/reference/methods/admin.conversations.lookup `admin.conversations.lookup` API reference}.
|
|
2685
|
-
*/
|
|
2686
|
-
lookup: bindApiCall(this, "admin.conversations.lookup"),
|
|
2687
|
-
/**
|
|
2688
|
-
* @description Remove a conversation's retention policy.
|
|
2689
|
-
* @see {@link https://docs.slack.dev/reference/methods/admin.conversations.removeCustomRetention `admin.conversations.removeCustomRetention` API reference}.
|
|
2690
|
-
*/
|
|
2691
|
-
removeCustomRetention: bindApiCall(this, "admin.conversations.removeCustomRetention"),
|
|
2692
|
-
/**
|
|
2693
|
-
* @description Rename a public or private channel.
|
|
2694
|
-
* @see {@link https://docs.slack.dev/reference/methods/admin.conversations.rename `admin.conversations.rename` API reference}.
|
|
2695
|
-
*/
|
|
2696
|
-
rename: bindApiCall(this, "admin.conversations.rename"),
|
|
2697
|
-
restrictAccess: {
|
|
2698
|
-
/**
|
|
2699
|
-
* @description Add an allowlist of IDP groups for accessing a channel.
|
|
2700
|
-
* @see {@link https://docs.slack.dev/reference/methods/admin.conversations.restrictAccess.addGroup `admin.conversations.restrictAccess.addGroup` API reference}.
|
|
2701
|
-
*/
|
|
2702
|
-
addGroup: bindApiCall(this, "admin.conversations.restrictAccess.addGroup"),
|
|
2703
|
-
/**
|
|
2704
|
-
* @description List all IDP Groups linked to a channel.
|
|
2705
|
-
* @see {@link https://docs.slack.dev/reference/methods/admin.conversations.restrictAccess.listGroups `admin.conversations.restrictAccess.listGroups` API reference}.
|
|
2706
|
-
*/
|
|
2707
|
-
listGroups: bindApiCall(this, "admin.conversations.restrictAccess.listGroups"),
|
|
2708
|
-
/**
|
|
2709
|
-
* @description Remove a linked IDP group linked from a private channel.
|
|
2710
|
-
* @see {@link https://docs.slack.dev/reference/methods/admin.conversations.restrictAccess.removeGroup `admin.conversations.restrictAccess.removeGroup` API reference}.
|
|
2711
|
-
*/
|
|
2712
|
-
removeGroup: bindApiCall(this, "admin.conversations.restrictAccess.removeGroup")
|
|
2713
|
-
},
|
|
2714
|
-
/**
|
|
2715
|
-
* @description Search for public or private channels in an Enterprise organization.
|
|
2716
|
-
* @see {@link https://docs.slack.dev/reference/methods/admin.conversations.search `admin.conversations.search` API reference}.
|
|
2717
|
-
*/
|
|
2718
|
-
search: bindApiCallWithOptionalArgument(this, "admin.conversations.search"),
|
|
2719
|
-
/**
|
|
2720
|
-
* @description Set the posting permissions for a public or private channel.
|
|
2721
|
-
* @see {@link https://docs.slack.dev/reference/methods/admin.conversations.setConversationPrefs `admin.conversations.setConversationPrefs` API reference}.
|
|
2722
|
-
*/
|
|
2723
|
-
setConversationPrefs: bindApiCall(this, "admin.conversations.setConversationPrefs"),
|
|
2724
|
-
/**
|
|
2725
|
-
* @description Set a conversation's retention policy.
|
|
2726
|
-
* @see {@link https://docs.slack.dev/reference/methods/admin.conversations.setCustomRetention `admin.conversations.setCustomRetention` API reference}.
|
|
2727
|
-
*/
|
|
2728
|
-
setCustomRetention: bindApiCall(this, "admin.conversations.setCustomRetention"),
|
|
2729
|
-
/**
|
|
2730
|
-
* @description Set the workspaces in an Enterprise grid org that connect to a public or private channel.
|
|
2731
|
-
* @see {@link https://docs.slack.dev/reference/methods/admin.conversations.setTeams `admin.conversations.setTeams` API reference}.
|
|
2732
|
-
*/
|
|
2733
|
-
setTeams: bindApiCall(this, "admin.conversations.setTeams"),
|
|
2734
|
-
/**
|
|
2735
|
-
* @description Unarchive a public or private channel.
|
|
2736
|
-
* @see {@link https://docs.slack.dev/reference/methods/admin.conversations.unarchive `admin.conversations.unarchive` API reference}.
|
|
2737
|
-
*/
|
|
2738
|
-
unarchive: bindApiCall(this, "admin.conversations.unarchive")
|
|
2739
|
-
},
|
|
2740
|
-
emoji: {
|
|
2741
|
-
/**
|
|
2742
|
-
* @description Add an emoji.
|
|
2743
|
-
* @see {@link https://docs.slack.dev/reference/methods/admin.emoji.add `admin.emoji.add` API reference}.
|
|
2744
|
-
*/
|
|
2745
|
-
add: bindApiCall(this, "admin.emoji.add"),
|
|
2746
|
-
/**
|
|
2747
|
-
* @description Add an emoji alias.
|
|
2748
|
-
* @see {@link https://docs.slack.dev/reference/methods/admin.emoji.addAlias `admin.emoji.addAlias` API reference}.
|
|
2749
|
-
*/
|
|
2750
|
-
addAlias: bindApiCall(this, "admin.emoji.addAlias"),
|
|
2751
|
-
/**
|
|
2752
|
-
* @description List emoji for an Enterprise Grid organization.
|
|
2753
|
-
* @see {@link https://docs.slack.dev/reference/methods/admin.emoji.list `admin.emoji.list` API reference}.
|
|
2754
|
-
*/
|
|
2755
|
-
list: bindApiCallWithOptionalArgument(this, "admin.emoji.list"),
|
|
2756
|
-
/**
|
|
2757
|
-
* @description Remove an emoji across an Enterprise Grid organization.
|
|
2758
|
-
* @see {@link https://docs.slack.dev/reference/methods/admin.emoji.remove `admin.emoji.remove` API reference}.
|
|
2759
|
-
*/
|
|
2760
|
-
remove: bindApiCall(this, "admin.emoji.remove"),
|
|
2761
|
-
/**
|
|
2762
|
-
* @description Rename an emoji.
|
|
2763
|
-
* @see {@link https://docs.slack.dev/reference/methods/admin.emoji.rename `admin.emoji.rename` API reference}.
|
|
2764
|
-
*/
|
|
2765
|
-
rename: bindApiCall(this, "admin.emoji.rename")
|
|
2766
|
-
},
|
|
2767
|
-
functions: {
|
|
2768
|
-
/**
|
|
2769
|
-
* @description Look up functions by a set of apps.
|
|
2770
|
-
* @see {@link https://docs.slack.dev/reference/methods/admin.functions.list `admin.functions.list` API reference}.
|
|
2771
|
-
*/
|
|
2772
|
-
list: bindApiCall(this, "admin.functions.list"),
|
|
2773
|
-
permissions: {
|
|
2774
|
-
/**
|
|
2775
|
-
* @description Lookup the visibility of multiple Slack functions and include the users if
|
|
2776
|
-
* it is limited to particular named entities.
|
|
2777
|
-
* @see {@link https://docs.slack.dev/reference/methods/admin.functions.permissions.lookup `admin.functions.permissions.lookup` API reference}.
|
|
2778
|
-
*/
|
|
2779
|
-
lookup: bindApiCall(this, "admin.functions.permissions.lookup"),
|
|
2780
|
-
/**
|
|
2781
|
-
* @description Set the visibility of a Slack function and define the users or workspaces if
|
|
2782
|
-
* it is set to named_entities.
|
|
2783
|
-
* @see {@link https://docs.slack.dev/reference/methods/admin.functions.permissions.set `admin.functions.permissions.set` API reference}.
|
|
2784
|
-
*/
|
|
2785
|
-
set: bindApiCall(this, "admin.functions.permissions.set")
|
|
2786
|
-
}
|
|
2787
|
-
},
|
|
2788
|
-
inviteRequests: {
|
|
2789
|
-
/**
|
|
2790
|
-
* @description Approve a workspace invite request.
|
|
2791
|
-
* @see {@link https://docs.slack.dev/reference/methods/admin.inviteRequests.approve `admin.inviteRequests.approve` API reference}.
|
|
2792
|
-
*/
|
|
2793
|
-
approve: bindApiCall(this, "admin.inviteRequests.approve"),
|
|
2794
|
-
approved: {
|
|
2795
|
-
/**
|
|
2796
|
-
* @description List all approved workspace invite requests.
|
|
2797
|
-
* @see {@link https://docs.slack.dev/reference/methods/admin.inviteRequests.approved.list `admin.inviteRequests.approved.list` API reference}.
|
|
2798
|
-
*/
|
|
2799
|
-
list: bindApiCall(this, "admin.inviteRequests.approved.list") },
|
|
2800
|
-
denied: {
|
|
2801
|
-
/**
|
|
2802
|
-
* @description List all denied workspace invite requests.
|
|
2803
|
-
* @see {@link https://docs.slack.dev/reference/methods/admin.inviteRequests.denied.list `admin.inviteRequests.denied.list` API reference}.
|
|
2804
|
-
*/
|
|
2805
|
-
list: bindApiCall(this, "admin.inviteRequests.denied.list") },
|
|
2806
|
-
/**
|
|
2807
|
-
* @description Deny a workspace invite request.
|
|
2808
|
-
* @see {@link https://docs.slack.dev/reference/methods/admin.inviteRequests.deny `admin.inviteRequests.deny` API reference}.
|
|
2809
|
-
*/
|
|
2810
|
-
deny: bindApiCall(this, "admin.inviteRequests.deny"),
|
|
2811
|
-
/**
|
|
2812
|
-
* @description List all pending workspace invite requests.
|
|
2813
|
-
* @see {@link https://docs.slack.dev/reference/methods/admin.inviteRequests.list `admin.inviteRequests.list` API reference}.
|
|
2814
|
-
*/
|
|
2815
|
-
list: bindApiCall(this, "admin.inviteRequests.list")
|
|
2816
|
-
},
|
|
2817
|
-
roles: {
|
|
2818
|
-
/**
|
|
2819
|
-
* @description Adds members to the specified role with the specified scopes.
|
|
2820
|
-
* @see {@link https://docs.slack.dev/reference/methods/admin.roles.addAssignments `admin.roles.addAssignments` API reference}.
|
|
2821
|
-
*/
|
|
2822
|
-
addAssignments: bindApiCall(this, "admin.roles.addAssignments"),
|
|
2823
|
-
/**
|
|
2824
|
-
* @description Lists assignments for all roles across entities.
|
|
2825
|
-
* Options to scope results by any combination of roles or entities.
|
|
2826
|
-
* @see {@link https://docs.slack.dev/reference/methods/admin.roles.listAssignments `admin.roles.listAssignments` API reference}.
|
|
2827
|
-
*/
|
|
2828
|
-
listAssignments: bindApiCallWithOptionalArgument(this, "admin.roles.listAssignments"),
|
|
2829
|
-
/**
|
|
2830
|
-
* @description Removes a set of users from a role for the given scopes and entities.
|
|
2831
|
-
* @see {@link https://docs.slack.dev/reference/methods/admin.roles.removeAssignments `admin.roles.removeAssignments` API reference}.
|
|
2832
|
-
*/
|
|
2833
|
-
removeAssignments: bindApiCall(this, "admin.roles.removeAssignments")
|
|
2834
|
-
},
|
|
2835
|
-
teams: {
|
|
2836
|
-
admins: {
|
|
2837
|
-
/**
|
|
2838
|
-
* @description List all of the admins on a given workspace.
|
|
2839
|
-
* @see {@link https://docs.slack.dev/reference/methods/admin.teams.admins.list `admin.teams.admins.list` API reference}.
|
|
2840
|
-
*/
|
|
2841
|
-
list: bindApiCall(this, "admin.teams.admins.list") },
|
|
2842
|
-
/**
|
|
2843
|
-
* @description Create an Enterprise team.
|
|
2844
|
-
* @see {@link https://docs.slack.dev/reference/methods/admin.teams.create `admin.teams.create` API reference}.
|
|
2845
|
-
*/
|
|
2846
|
-
create: bindApiCall(this, "admin.teams.create"),
|
|
2847
|
-
/**
|
|
2848
|
-
* @description List all teams on an Enterprise organization.
|
|
2849
|
-
* @see {@link https://docs.slack.dev/reference/methods/admin.teams.list `admin.teams.list` API reference}.
|
|
2850
|
-
*/
|
|
2851
|
-
list: bindApiCallWithOptionalArgument(this, "admin.teams.list"),
|
|
2852
|
-
owners: {
|
|
2853
|
-
/**
|
|
2854
|
-
* @description List all of the owners on a given workspace.
|
|
2855
|
-
* @see {@link https://docs.slack.dev/reference/methods/admin.teams.owners.list `admin.teams.owners.list` API reference}.
|
|
2856
|
-
*/
|
|
2857
|
-
list: bindApiCall(this, "admin.teams.owners.list") },
|
|
2858
|
-
settings: {
|
|
2859
|
-
/**
|
|
2860
|
-
* @description Fetch information about settings in a workspace.
|
|
2861
|
-
* @see {@link https://docs.slack.dev/reference/methods/admin.teams.settings.info `admin.teams.settings.info` API reference}.
|
|
2862
|
-
*/
|
|
2863
|
-
info: bindApiCall(this, "admin.teams.settings.info"),
|
|
2864
|
-
/**
|
|
2865
|
-
* @description Set the default channels of a workspace.
|
|
2866
|
-
* @see {@link https://docs.slack.dev/reference/methods/admin.teams.settings.setDefaultChannels `admin.teams.settings.setDefaultChannels` API reference}.
|
|
2867
|
-
*/
|
|
2868
|
-
setDefaultChannels: bindApiCall(this, "admin.teams.settings.setDefaultChannels"),
|
|
2869
|
-
/**
|
|
2870
|
-
* @description Set the description of a given workspace.
|
|
2871
|
-
* @see {@link https://docs.slack.dev/reference/methods/admin.teams.settings.setDescription `admin.teams.settings.setDescription` API reference}.
|
|
2872
|
-
*/
|
|
2873
|
-
setDescription: bindApiCall(this, "admin.teams.settings.setDescription"),
|
|
2874
|
-
/**
|
|
2875
|
-
* @description Set the discoverability of a given workspace.
|
|
2876
|
-
* @see {@link https://docs.slack.dev/reference/methods/admin.teams.settings.setDiscoverability `admin.teams.settings.setDiscoverability` API reference}.
|
|
2877
|
-
*/
|
|
2878
|
-
setDiscoverability: bindApiCall(this, "admin.teams.settings.setDiscoverability"),
|
|
2879
|
-
/**
|
|
2880
|
-
* @description Sets the icon of a workspace.
|
|
2881
|
-
* @see {@link https://docs.slack.dev/reference/methods/admin.teams.settings.setIcon `admin.teams.settings.setIcon` API reference}.
|
|
2882
|
-
*/
|
|
2883
|
-
setIcon: bindApiCall(this, "admin.teams.settings.setIcon"),
|
|
2884
|
-
/**
|
|
2885
|
-
* @description Set the name of a given workspace.
|
|
2886
|
-
* @see {@link https://docs.slack.dev/reference/methods/admin.teams.settings.setName `admin.teams.settings.setName` API reference}.
|
|
2887
|
-
*/
|
|
2888
|
-
setName: bindApiCall(this, "admin.teams.settings.setName")
|
|
2889
|
-
}
|
|
2890
|
-
},
|
|
2891
|
-
usergroups: {
|
|
2892
|
-
/**
|
|
2893
|
-
* @description Add up to one hundred default channels to an IDP group.
|
|
2894
|
-
* @see {@link https://docs.slack.dev/reference/methods/admin.usergroups.addChannels `admin.teams.usergroups.addChannels` API reference}.
|
|
2895
|
-
*/
|
|
2896
|
-
addChannels: bindApiCall(this, "admin.usergroups.addChannels"),
|
|
2897
|
-
/**
|
|
2898
|
-
* @description Associate one or more default workspaces with an organization-wide IDP group.
|
|
2899
|
-
* @see {@link https://docs.slack.dev/reference/methods/admin.usergroups.addTeams `admin.teams.usergroups.addTeams` API reference}.
|
|
2900
|
-
*/
|
|
2901
|
-
addTeams: bindApiCall(this, "admin.usergroups.addTeams"),
|
|
2902
|
-
/**
|
|
2903
|
-
* @description List the channels linked to an org-level IDP group (user group).
|
|
2904
|
-
* @see {@link https://docs.slack.dev/reference/methods/admin.usergroups.listChannels `admin.teams.usergroups.listChannels` API reference}.
|
|
2905
|
-
*/
|
|
2906
|
-
listChannels: bindApiCall(this, "admin.usergroups.listChannels"),
|
|
2907
|
-
/**
|
|
2908
|
-
* @description Remove one or more default channels from an org-level IDP group (user group).
|
|
2909
|
-
* @see {@link https://docs.slack.dev/reference/methods/admin.usergroups.removeChannels `admin.teams.usergroups.removeChannels` API reference}.
|
|
2910
|
-
*/
|
|
2911
|
-
removeChannels: bindApiCall(this, "admin.usergroups.removeChannels")
|
|
2912
|
-
},
|
|
2913
|
-
users: {
|
|
2914
|
-
/**
|
|
2915
|
-
* @description Add an Enterprise user to a workspace.
|
|
2916
|
-
* @see {@link https://docs.slack.dev/reference/methods/admin.users.assign `admin.users.assign` API reference}.
|
|
2917
|
-
*/
|
|
2918
|
-
assign: bindApiCall(this, "admin.users.assign"),
|
|
2919
|
-
/**
|
|
2920
|
-
* @description Invite a user to a workspace.
|
|
2921
|
-
* @see {@link https://docs.slack.dev/reference/methods/admin.users.invite `admin.users.invite` API reference}.
|
|
2922
|
-
*/
|
|
2923
|
-
invite: bindApiCall(this, "admin.users.invite"),
|
|
2924
|
-
/**
|
|
2925
|
-
* @description List users on a workspace.
|
|
2926
|
-
* @see {@link https://docs.slack.dev/reference/methods/admin.users.list `admin.users.list` API reference}.
|
|
2927
|
-
*/
|
|
2928
|
-
list: bindApiCallWithOptionalArgument(this, "admin.users.list"),
|
|
2929
|
-
/**
|
|
2930
|
-
* @description Remove a user from a workspace.
|
|
2931
|
-
* @see {@link https://docs.slack.dev/reference/methods/admin.users.remove `admin.users.remove` API reference}.
|
|
2932
|
-
*/
|
|
2933
|
-
remove: bindApiCall(this, "admin.users.remove"),
|
|
2934
|
-
session: {
|
|
2935
|
-
/**
|
|
2936
|
-
* @description Clear user-specific session settings—the session duration and what happens when the client
|
|
2937
|
-
* closes—for a list of users.
|
|
2938
|
-
* @see {@link https://docs.slack.dev/reference/methods/admin.users.session.clearSettings `admin.users.session.clearSettings` API reference}.
|
|
2939
|
-
*/
|
|
2940
|
-
clearSettings: bindApiCall(this, "admin.users.session.clearSettings"),
|
|
2941
|
-
/**
|
|
2942
|
-
* @description Get user-specific session settings—the session duration and what happens when the client
|
|
2943
|
-
* closes—given a list of users.
|
|
2944
|
-
* @see {@link https://docs.slack.dev/reference/methods/admin.users.session.getSettings `admin.users.session.getSettings` API reference}.
|
|
2945
|
-
*/
|
|
2946
|
-
getSettings: bindApiCall(this, "admin.users.session.getSettings"),
|
|
2947
|
-
/**
|
|
2948
|
-
* @description Revoke a single session for a user. The user will be forced to login to Slack.
|
|
2949
|
-
* @see {@link https://docs.slack.dev/reference/methods/admin.users.session.invalidate `admin.users.session.invalidate` API reference}.
|
|
2950
|
-
*/
|
|
2951
|
-
invalidate: bindApiCall(this, "admin.users.session.invalidate"),
|
|
2952
|
-
/**
|
|
2953
|
-
* @description List active user sessions for an organization.
|
|
2954
|
-
* @see {@link https://docs.slack.dev/reference/methods/admin.users.session.list `admin.users.session.list` API reference}.
|
|
2955
|
-
*/
|
|
2956
|
-
list: bindApiCallWithOptionalArgument(this, "admin.users.session.list"),
|
|
2957
|
-
/**
|
|
2958
|
-
* @description Wipes all valid sessions on all devices for a given user.
|
|
2959
|
-
* @see {@link https://docs.slack.dev/reference/methods/admin.users.session.reset `admin.users.session.reset` API reference}.
|
|
2960
|
-
*/
|
|
2961
|
-
reset: bindApiCall(this, "admin.users.session.reset"),
|
|
2962
|
-
/**
|
|
2963
|
-
* @description Enqueues an asynchronous job to wipe all valid sessions on all devices for a given user list.
|
|
2964
|
-
* @see {@link https://docs.slack.dev/reference/methods/admin.users.session.resetBulk `admin.users.session.resetBulk` API reference}.
|
|
2965
|
-
*/
|
|
2966
|
-
resetBulk: bindApiCall(this, "admin.users.session.resetBulk"),
|
|
2967
|
-
/**
|
|
2968
|
-
* @description Configure the user-level session settings—the session duration and what happens when the client
|
|
2969
|
-
* closes—for one or more users.
|
|
2970
|
-
* @see {@link https://docs.slack.dev/reference/methods/admin.users.session.setSettings `admin.users.session.setSettings` API reference}.
|
|
2971
|
-
*/
|
|
2972
|
-
setSettings: bindApiCall(this, "admin.users.session.setSettings")
|
|
2973
|
-
},
|
|
2974
|
-
/**
|
|
2975
|
-
* @description Set an existing guest, regular user, or owner to be an admin user.
|
|
2976
|
-
* @see {@link https://docs.slack.dev/reference/methods/admin.users.setAdmin `admin.users.setAdmin` API reference}.
|
|
2977
|
-
*/
|
|
2978
|
-
setAdmin: bindApiCall(this, "admin.users.setAdmin"),
|
|
2979
|
-
/**
|
|
2980
|
-
* @description Set an expiration for a guest user.
|
|
2981
|
-
* @see {@link https://docs.slack.dev/reference/methods/admin.users.setExpiration `admin.users.setExpiration` API reference}.
|
|
2982
|
-
*/
|
|
2983
|
-
setExpiration: bindApiCall(this, "admin.users.setExpiration"),
|
|
2984
|
-
/**
|
|
2985
|
-
* @description Set an existing guest, regular user, or admin user to be a workspace owner.
|
|
2986
|
-
* @see {@link https://docs.slack.dev/reference/methods/admin.users.setOwner `admin.users.setOwner` API reference}.
|
|
2987
|
-
*/
|
|
2988
|
-
setOwner: bindApiCall(this, "admin.users.setOwner"),
|
|
2989
|
-
/**
|
|
2990
|
-
* @description Set an existing guest user, admin user, or owner to be a regular user.
|
|
2991
|
-
* @see {@link https://docs.slack.dev/reference/methods/admin.users.setRegular `admin.users.setRegular` API reference}.
|
|
2992
|
-
*/
|
|
2993
|
-
setRegular: bindApiCall(this, "admin.users.setRegular"),
|
|
2994
|
-
unsupportedVersions: {
|
|
2995
|
-
/**
|
|
2996
|
-
* @description Ask Slackbot to send you an export listing all workspace members using unsupported software,
|
|
2997
|
-
* presented as a zipped CSV file.
|
|
2998
|
-
* @see {@link https://docs.slack.dev/reference/methods/admin.users.unsupportedVersions.export `admin.users.unsupportedVersions.export` API reference}.
|
|
2999
|
-
*/
|
|
3000
|
-
export: bindApiCall(this, "admin.users.unsupportedVersions.export") }
|
|
3001
|
-
},
|
|
3002
|
-
workflows: {
|
|
3003
|
-
collaborators: {
|
|
3004
|
-
/**
|
|
3005
|
-
* @description Add collaborators to workflows within the team or enterprise.
|
|
3006
|
-
* @see {@link https://docs.slack.dev/reference/methods/admin.workflows.collaborators.add `admin.workflows.collaborators.add` API reference}.
|
|
3007
|
-
*/
|
|
3008
|
-
add: bindApiCall(this, "admin.workflows.collaborators.add"),
|
|
3009
|
-
/**
|
|
3010
|
-
* @description Remove collaborators from workflows within the team or enterprise.
|
|
3011
|
-
* @see {@link https://docs.slack.dev/reference/methods/admin.workflows.collaborators.remove `admin.workflows.collaborators.remove` API reference}.
|
|
3012
|
-
*/
|
|
3013
|
-
remove: bindApiCall(this, "admin.workflows.collaborators.remove")
|
|
3014
|
-
},
|
|
3015
|
-
permissions: {
|
|
3016
|
-
/**
|
|
3017
|
-
* @description Look up the permissions for a set of workflows.
|
|
3018
|
-
* @see {@link https://docs.slack.dev/reference/methods/admin.workflows.permissions.lookup `admin.workflows.permissions.lookup` API reference}.
|
|
3019
|
-
*/
|
|
3020
|
-
lookup: bindApiCall(this, "admin.workflows.permissions.lookup") },
|
|
3021
|
-
/**
|
|
3022
|
-
* @description Search workflows within the team or enterprise.
|
|
3023
|
-
* @see {@link https://docs.slack.dev/reference/methods/admin.workflows.search `admin.workflows.search` API reference}.
|
|
3024
|
-
*/
|
|
3025
|
-
search: bindApiCallWithOptionalArgument(this, "admin.workflows.search"),
|
|
3026
|
-
/**
|
|
3027
|
-
* @description Unpublish workflows within the team or enterprise.
|
|
3028
|
-
* @see {@link https://docs.slack.dev/reference/methods/admin.workflows.unpublish `admin.workflows.unpublish` API reference}.
|
|
3029
|
-
*/
|
|
3030
|
-
unpublish: bindApiCall(this, "admin.workflows.unpublish")
|
|
3031
|
-
}
|
|
3032
|
-
};
|
|
3033
|
-
this.api = {
|
|
3034
|
-
/**
|
|
3035
|
-
* @description Checks API calling code.
|
|
3036
|
-
* @see {@link https://docs.slack.dev/reference/methods/api.test `api.test` API reference}.
|
|
3037
|
-
*/
|
|
3038
|
-
test: bindApiCallWithOptionalArgument(this, "api.test") };
|
|
3039
|
-
this.assistant = { threads: {
|
|
3040
|
-
/**
|
|
3041
|
-
* @description Set loading status to indicate that the app is building a response.
|
|
3042
|
-
* @see {@link https://docs.slack.dev/reference/methods/assistant.threads.setStatus `assistant.threads.setStatus` API reference}.
|
|
3043
|
-
*/
|
|
3044
|
-
setStatus: bindApiCall(this, "assistant.threads.setStatus"),
|
|
3045
|
-
/**
|
|
3046
|
-
* @description Set suggested prompts for the user. Can suggest up to four prompts.
|
|
3047
|
-
* @see {@link https://docs.slack.dev/reference/methods/assistant.threads.setSuggestedPrompts `assistant.threads.setSuggestedPrompts` API reference}.
|
|
3048
|
-
*/
|
|
3049
|
-
setSuggestedPrompts: bindApiCall(this, "assistant.threads.setSuggestedPrompts"),
|
|
3050
|
-
/**
|
|
3051
|
-
* @description Set the title of the thread. This is shown when a user views the app's chat history.
|
|
3052
|
-
* @see {@link https://docs.slack.dev/reference/methods/assistant.threads.setTitle `assistant.threads.setTitle` API reference}.
|
|
3053
|
-
*/
|
|
3054
|
-
setTitle: bindApiCall(this, "assistant.threads.setTitle")
|
|
3055
|
-
} };
|
|
3056
|
-
this.apps = {
|
|
3057
|
-
connections: {
|
|
3058
|
-
/**
|
|
3059
|
-
* @description Generate a temporary Socket Mode WebSocket URL that your app can connect to in order to receive
|
|
3060
|
-
* events and interactive payloads over.
|
|
3061
|
-
* @see {@link https://docs.slack.dev/reference/methods/apps.connections.open `apps.connections.open` API reference}.
|
|
3062
|
-
*/
|
|
3063
|
-
open: bindApiCallWithOptionalArgument(this, "apps.connections.open") },
|
|
3064
|
-
event: { authorizations: {
|
|
3065
|
-
/**
|
|
3066
|
-
* @description Get a list of authorizations for the given event context.
|
|
3067
|
-
* Each authorization represents an app installation that the event is visible to.
|
|
3068
|
-
* @see {@link https://docs.slack.dev/reference/methods/apps.event.authorizations.list `apps.event.authorizations.list` API reference}.
|
|
3069
|
-
*/
|
|
3070
|
-
list: bindApiCall(this, "apps.event.authorizations.list") } },
|
|
3071
|
-
manifest: {
|
|
3072
|
-
/**
|
|
3073
|
-
* @description Create an app from an app manifest.
|
|
3074
|
-
* @see {@link https://docs.slack.dev/reference/methods/apps.manifest.create `apps.manifest.create` API reference}.
|
|
3075
|
-
*/
|
|
3076
|
-
create: bindApiCall(this, "apps.manifest.create"),
|
|
3077
|
-
/**
|
|
3078
|
-
* @description Permanently deletes an app created through app manifests.
|
|
3079
|
-
* @see {@link https://docs.slack.dev/reference/methods/apps.manifest.delete `apps.manifest.delete` API reference}.
|
|
3080
|
-
*/
|
|
3081
|
-
delete: bindApiCall(this, "apps.manifest.delete"),
|
|
3082
|
-
/**
|
|
3083
|
-
* @description Export an app manifest from an existing app.
|
|
3084
|
-
* @see {@link https://docs.slack.dev/reference/methods/apps.manifest.export `apps.manifest.export` API reference}.
|
|
3085
|
-
*/
|
|
3086
|
-
export: bindApiCall(this, "apps.manifest.export"),
|
|
3087
|
-
/**
|
|
3088
|
-
* @description Update an app from an app manifest.
|
|
3089
|
-
* @see {@link https://docs.slack.dev/reference/methods/apps.manifest.update `apps.manifest.update` API reference}.
|
|
3090
|
-
*/
|
|
3091
|
-
update: bindApiCall(this, "apps.manifest.update"),
|
|
3092
|
-
/**
|
|
3093
|
-
* @description Validate an app manifest.
|
|
3094
|
-
* @see {@link https://docs.slack.dev/reference/methods/apps.manifest.validate `apps.manifest.validate` API reference}.
|
|
3095
|
-
*/
|
|
3096
|
-
validate: bindApiCall(this, "apps.manifest.validate")
|
|
3097
|
-
},
|
|
3098
|
-
/**
|
|
3099
|
-
* @description Uninstalls your app from a workspace.
|
|
3100
|
-
* @see {@link https://docs.slack.dev/reference/methods/apps.uninstall `apps.uninstall` API reference}.
|
|
3101
|
-
*/
|
|
3102
|
-
uninstall: bindApiCall(this, "apps.uninstall"),
|
|
3103
|
-
user: { connection: {
|
|
3104
|
-
/**
|
|
3105
|
-
* @description Updates the connection status between a user and an app.
|
|
3106
|
-
* @see {@link https://docs.slack.dev/reference/methods/apps.user.connection.update `apps.user.connection.update` API reference}.
|
|
3107
|
-
*/
|
|
3108
|
-
update: bindApiCall(this, "apps.user.connection.update") } }
|
|
3109
|
-
};
|
|
3110
|
-
this.auth = {
|
|
3111
|
-
/**
|
|
3112
|
-
* @description Revokes a token.
|
|
3113
|
-
* @see {@link https://docs.slack.dev/reference/methods/auth.revoke `auth.revoke` API reference}.
|
|
3114
|
-
*/
|
|
3115
|
-
revoke: bindApiCallWithOptionalArgument(this, "auth.revoke"),
|
|
3116
|
-
teams: {
|
|
3117
|
-
/**
|
|
3118
|
-
* @description Obtain a full list of workspaces your org-wide app has been approved for.
|
|
3119
|
-
* @see {@link https://docs.slack.dev/reference/methods/auth.teams.list `auth.teams.list` API reference}.
|
|
3120
|
-
*/
|
|
3121
|
-
list: bindApiCallWithOptionalArgument(this, "auth.teams.list") },
|
|
3122
|
-
test: bindApiCallWithOptionalArgument(this, "auth.test")
|
|
3123
|
-
};
|
|
3124
|
-
this.bookmarks = {
|
|
3125
|
-
/**
|
|
3126
|
-
* @description Add bookmark to a channel.
|
|
3127
|
-
* @see {@link https://docs.slack.dev/reference/methods/bookmarks.add `bookmarks.add` API reference}.
|
|
3128
|
-
*/
|
|
3129
|
-
add: bindApiCall(this, "bookmarks.add"),
|
|
3130
|
-
/**
|
|
3131
|
-
* @description Edit bookmark.
|
|
3132
|
-
* @see {@link https://docs.slack.dev/reference/methods/bookmarks.edit `bookmarks.edit` API reference}.
|
|
3133
|
-
*/
|
|
3134
|
-
edit: bindApiCall(this, "bookmarks.edit"),
|
|
3135
|
-
/**
|
|
3136
|
-
* @description List bookmarks for a channel.
|
|
3137
|
-
* @see {@link https://docs.slack.dev/reference/methods/bookmarks.list `bookmarks.list` API reference}.
|
|
3138
|
-
*/
|
|
3139
|
-
list: bindApiCall(this, "bookmarks.list"),
|
|
3140
|
-
/**
|
|
3141
|
-
* @description Remove bookmark from a channel.
|
|
3142
|
-
* @see {@link https://docs.slack.dev/reference/methods/bookmarks.remove `bookmarks.remove` API reference}.
|
|
3143
|
-
*/
|
|
3144
|
-
remove: bindApiCall(this, "bookmarks.remove")
|
|
3145
|
-
};
|
|
3146
|
-
this.bots = {
|
|
3147
|
-
/**
|
|
3148
|
-
* @description Gets information about a bot user.
|
|
3149
|
-
* @see {@link https://docs.slack.dev/reference/methods/bots.info `bots.info` API reference}.
|
|
3150
|
-
*/
|
|
3151
|
-
info: bindApiCallWithOptionalArgument(this, "bots.info") };
|
|
3152
|
-
this.calls = {
|
|
3153
|
-
/**
|
|
3154
|
-
* @description Registers a new Call.
|
|
3155
|
-
* @see {@link https://docs.slack.dev/reference/methods/calls.add `calls.add` API reference}.
|
|
3156
|
-
*/
|
|
3157
|
-
add: bindApiCall(this, "calls.add"),
|
|
3158
|
-
/**
|
|
3159
|
-
* @description Ends a Call.
|
|
3160
|
-
* @see {@link https://docs.slack.dev/reference/methods/calls.end `calls.end` API reference}.
|
|
3161
|
-
*/
|
|
3162
|
-
end: bindApiCall(this, "calls.end"),
|
|
3163
|
-
/**
|
|
3164
|
-
* @description Returns information about a Call.
|
|
3165
|
-
* @see {@link https://docs.slack.dev/reference/methods/calls.info `calls.info` API reference}.
|
|
3166
|
-
*/
|
|
3167
|
-
info: bindApiCall(this, "calls.info"),
|
|
3168
|
-
/**
|
|
3169
|
-
* @description Updates information about a Call.
|
|
3170
|
-
* @see {@link https://docs.slack.dev/reference/methods/calls.update `calls.update` API reference}.
|
|
3171
|
-
*/
|
|
3172
|
-
update: bindApiCall(this, "calls.update"),
|
|
3173
|
-
participants: {
|
|
3174
|
-
/**
|
|
3175
|
-
* @description Registers new participants added to a Call.
|
|
3176
|
-
* @see {@link https://docs.slack.dev/reference/methods/calls.participants.add `calls.participants.add` API reference}.
|
|
3177
|
-
*/
|
|
3178
|
-
add: bindApiCall(this, "calls.participants.add"),
|
|
3179
|
-
remove: bindApiCall(this, "calls.participants.remove")
|
|
3180
|
-
}
|
|
3181
|
-
};
|
|
3182
|
-
this.canvases = {
|
|
3183
|
-
access: {
|
|
3184
|
-
/**
|
|
3185
|
-
* @description Remove access to a canvas for specified entities.
|
|
3186
|
-
* @see {@link https://docs.slack.dev/reference/methods/canvases.access.delete `canvases.access.delete` API reference}.
|
|
3187
|
-
*/
|
|
3188
|
-
delete: bindApiCall(this, "canvases.access.delete"),
|
|
3189
|
-
/**
|
|
3190
|
-
* @description Sets the access level to a canvas for specified entities.
|
|
3191
|
-
* @see {@link https://docs.slack.dev/reference/methods/canvases.access.set `canvases.access.set` API reference}.
|
|
3192
|
-
*/
|
|
3193
|
-
set: bindApiCall(this, "canvases.access.set")
|
|
3194
|
-
},
|
|
3195
|
-
/**
|
|
3196
|
-
* @description Create Canvas for a user.
|
|
3197
|
-
* @see {@link https://docs.slack.dev/reference/methods/canvases.create `canvases.create` API reference}.
|
|
3198
|
-
*/
|
|
3199
|
-
create: bindApiCallWithOptionalArgument(this, "canvases.create"),
|
|
3200
|
-
/**
|
|
3201
|
-
* @description Deletes a canvas.
|
|
3202
|
-
* @see {@link https://docs.slack.dev/reference/methods/canvases.delete `canvases.delete` API reference}.
|
|
3203
|
-
*/
|
|
3204
|
-
delete: bindApiCall(this, "canvases.delete"),
|
|
3205
|
-
/**
|
|
3206
|
-
* @description Update an existing canvas.
|
|
3207
|
-
* @see {@link https://docs.slack.dev/reference/methods/canvases.edit `canvases.edit` API reference}.
|
|
3208
|
-
*/
|
|
3209
|
-
edit: bindApiCall(this, "canvases.edit"),
|
|
3210
|
-
sections: {
|
|
3211
|
-
/**
|
|
3212
|
-
* @description Find sections matching the provided criteria.
|
|
3213
|
-
* @see {@link https://docs.slack.dev/reference/methods/canvases.sections.lookup `canvases.sections.lookup` API reference}.
|
|
3214
|
-
*/
|
|
3215
|
-
lookup: bindApiCall(this, "canvases.sections.lookup") }
|
|
3216
|
-
};
|
|
3217
|
-
this.chat = {
|
|
3218
|
-
/**
|
|
3219
|
-
* @description Appends text to an existing streaming conversation.
|
|
3220
|
-
* @see {@link https://docs.slack.dev/reference/methods/chat.appendStream `chat.appendStream` API reference}.
|
|
3221
|
-
*/
|
|
3222
|
-
appendStream: bindApiCall(this, "chat.appendStream"),
|
|
3223
|
-
/**
|
|
3224
|
-
* @description Deletes a message.
|
|
3225
|
-
* @see {@link https://docs.slack.dev/reference/methods/chat.delete `chat.delete` API reference}.
|
|
3226
|
-
*/
|
|
3227
|
-
delete: bindApiCall(this, "chat.delete"),
|
|
3228
|
-
/**
|
|
3229
|
-
* @description Deletes a pending scheduled message from the queue.
|
|
3230
|
-
* @see {@link https://docs.slack.dev/reference/methods/chat.deleteScheduledMessage `chat.deleteScheduledMessage` API reference}.
|
|
3231
|
-
*/
|
|
3232
|
-
deleteScheduledMessage: bindApiCall(this, "chat.deleteScheduledMessage"),
|
|
3233
|
-
/**
|
|
3234
|
-
* @description Retrieve a permalink URL for a specific extant message.
|
|
3235
|
-
* @see {@link https://docs.slack.dev/reference/methods/chat.getPermalink `chat.getPermalink` API reference}.
|
|
3236
|
-
*/
|
|
3237
|
-
getPermalink: bindApiCall(this, "chat.getPermalink"),
|
|
3238
|
-
/**
|
|
3239
|
-
* @description Share a me message into a channel.
|
|
3240
|
-
* @see {@link https://docs.slack.dev/reference/methods/chat.meMessage `chat.meMessage` API reference}.
|
|
3241
|
-
*/
|
|
3242
|
-
meMessage: bindApiCall(this, "chat.meMessage"),
|
|
3243
|
-
/**
|
|
3244
|
-
* @description Sends an ephemeral message to a user in a channel.
|
|
3245
|
-
* @see {@link https://docs.slack.dev/reference/methods/chat.postEphemeral `chat.postEphemeral` API reference}.
|
|
3246
|
-
*/
|
|
3247
|
-
postEphemeral: bindApiCall(this, "chat.postEphemeral"),
|
|
3248
|
-
/**
|
|
3249
|
-
* @description Sends a message to a channel.
|
|
3250
|
-
* @see {@link https://docs.slack.dev/reference/methods/chat.postMessage `chat.postMessage` API reference}.
|
|
3251
|
-
*/
|
|
3252
|
-
postMessage: bindApiCall(this, "chat.postMessage"),
|
|
3253
|
-
/**
|
|
3254
|
-
* @description Schedules a message to be sent to a channel.
|
|
3255
|
-
* @see {@link https://docs.slack.dev/reference/methods/chat.scheduleMessage `chat.scheduleMessage` API reference}.
|
|
3256
|
-
*/
|
|
3257
|
-
scheduleMessage: bindApiCall(this, "chat.scheduleMessage"),
|
|
3258
|
-
scheduledMessages: {
|
|
3259
|
-
/**
|
|
3260
|
-
* @description Returns a list of scheduled messages.
|
|
3261
|
-
* @see {@link https://docs.slack.dev/reference/methods/chat.scheduledMessages.list `chat.scheduledMessages.list` API reference}.
|
|
3262
|
-
*/
|
|
3263
|
-
list: bindApiCallWithOptionalArgument(this, "chat.scheduledMessages.list") },
|
|
3264
|
-
/**
|
|
3265
|
-
* @description Starts a new streaming conversation.
|
|
3266
|
-
* @see {@link https://docs.slack.dev/reference/methods/chat.startStream `chat.startStream` API reference}.
|
|
3267
|
-
*/
|
|
3268
|
-
startStream: bindApiCall(this, "chat.startStream"),
|
|
3269
|
-
/**
|
|
3270
|
-
* @description Stops a streaming conversation.
|
|
3271
|
-
* @see {@link https://docs.slack.dev/reference/methods/chat.stopStream `chat.stopStream` API reference}.
|
|
3272
|
-
*/
|
|
3273
|
-
stopStream: bindApiCall(this, "chat.stopStream"),
|
|
3274
|
-
/**
|
|
3275
|
-
* @description Provide custom unfurl behavior for user-posted URLs.
|
|
3276
|
-
* @see {@link https://docs.slack.dev/reference/methods/chat.unfurl `chat.unfurl` API reference}.
|
|
3277
|
-
*/
|
|
3278
|
-
unfurl: bindApiCall(this, "chat.unfurl"),
|
|
3279
|
-
/**
|
|
3280
|
-
* @description Updates a message.
|
|
3281
|
-
* @see {@link https://docs.slack.dev/reference/methods/chat.update `chat.update` API reference}.
|
|
3282
|
-
*/
|
|
3283
|
-
update: bindApiCall(this, "chat.update")
|
|
3284
|
-
};
|
|
3285
|
-
this.conversations = {
|
|
3286
|
-
/**
|
|
3287
|
-
* @description Accepts an invitation to a Slack Connect channel.
|
|
3288
|
-
* @see {@link https://docs.slack.dev/reference/methods/conversations.acceptSharedInvite `conversations.acceptSharedInvite` API reference}.
|
|
3289
|
-
*/
|
|
3290
|
-
acceptSharedInvite: bindApiCall(this, "conversations.acceptSharedInvite"),
|
|
3291
|
-
/**
|
|
3292
|
-
* @description Approves an invitation to a Slack Connect channel.
|
|
3293
|
-
* @see {@link https://docs.slack.dev/reference/methods/conversations.approveSharedInvite `conversations.approveSharedInvite` API reference}.
|
|
3294
|
-
*/
|
|
3295
|
-
approveSharedInvite: bindApiCall(this, "conversations.approveSharedInvite"),
|
|
3296
|
-
/**
|
|
3297
|
-
* @description Archives a conversation.
|
|
3298
|
-
* @see {@link https://docs.slack.dev/reference/methods/conversations.archive `conversations.archive` API reference}.
|
|
3299
|
-
*/
|
|
3300
|
-
archive: bindApiCall(this, "conversations.archive"),
|
|
3301
|
-
canvases: {
|
|
3302
|
-
/**
|
|
3303
|
-
* @description Create a Channel Canvas for a channel.
|
|
3304
|
-
* @see {@link https://docs.slack.dev/reference/methods/conversations.canvases.create `conversations.canvases.create` API reference}.
|
|
3305
|
-
*/
|
|
3306
|
-
create: bindApiCall(this, "conversations.canvases.create") },
|
|
3307
|
-
/**
|
|
3308
|
-
* @description Closes a direct message or multi-person direct message.
|
|
3309
|
-
* @see {@link https://docs.slack.dev/reference/methods/conversations.close `conversations.close` API reference}.
|
|
3310
|
-
*/
|
|
3311
|
-
close: bindApiCall(this, "conversations.close"),
|
|
3312
|
-
/**
|
|
3313
|
-
* @description Initiates a public or private channel-based conversation.
|
|
3314
|
-
* @see {@link https://docs.slack.dev/reference/methods/conversations.create `conversations.create` API reference}.
|
|
3315
|
-
*/
|
|
3316
|
-
create: bindApiCall(this, "conversations.create"),
|
|
3317
|
-
/**
|
|
3318
|
-
* @description Declines an invitation to a Slack Connect channel.
|
|
3319
|
-
* @see {@link https://docs.slack.dev/reference/methods/conversations.declineSharedInvite `conversations.declineSharedInvite` API reference}.
|
|
3320
|
-
*/
|
|
3321
|
-
declineSharedInvite: bindApiCall(this, "conversations.declineSharedInvite"),
|
|
3322
|
-
externalInvitePermissions: {
|
|
3323
|
-
/**
|
|
3324
|
-
* @description Convert a team in a shared channel from an External Limited channel to a fully shared Slack
|
|
3325
|
-
* Connect channel or vice versa.
|
|
3326
|
-
* @see {@link https://docs.slack.dev/reference/methods/conversations.externalInvitePermissions.set `conversations.externalInvitePermissions.set` API reference}.
|
|
3327
|
-
*/
|
|
3328
|
-
set: bindApiCall(this, "conversations.externalInvitePermissions.set") },
|
|
3329
|
-
/**
|
|
3330
|
-
* @description Fetches a conversation's history of messages and events.
|
|
3331
|
-
* @see {@link https://docs.slack.dev/reference/methods/conversations.history `conversations.history` API reference}.
|
|
3332
|
-
*/
|
|
3333
|
-
history: bindApiCall(this, "conversations.history"),
|
|
3334
|
-
/**
|
|
3335
|
-
* @description Retrieve information about a conversation.
|
|
3336
|
-
* @see {@link https://docs.slack.dev/reference/methods/conversations.info `conversations.info` API reference}.
|
|
3337
|
-
*/
|
|
3338
|
-
info: bindApiCall(this, "conversations.info"),
|
|
3339
|
-
/**
|
|
3340
|
-
* @description Invites users to a channel.
|
|
3341
|
-
* @see {@link https://docs.slack.dev/reference/methods/conversations.invite `conversations.invite` API reference}.
|
|
3342
|
-
*/
|
|
3343
|
-
invite: bindApiCall(this, "conversations.invite"),
|
|
3344
|
-
/**
|
|
3345
|
-
* @description Sends an invitation to a Slack Connect channel.
|
|
3346
|
-
* @see {@link https://docs.slack.dev/reference/methods/conversations.inviteShared `conversations.inviteShared` API reference}.
|
|
3347
|
-
*/
|
|
3348
|
-
inviteShared: bindApiCall(this, "conversations.inviteShared"),
|
|
3349
|
-
/**
|
|
3350
|
-
* @description Joins an existing conversation.
|
|
3351
|
-
* @see {@link https://docs.slack.dev/reference/methods/conversations.join `conversations.join` API reference}.
|
|
3352
|
-
*/
|
|
3353
|
-
join: bindApiCall(this, "conversations.join"),
|
|
3354
|
-
/**
|
|
3355
|
-
* @description Removes a user from a conversation.
|
|
3356
|
-
* @see {@link https://docs.slack.dev/reference/methods/conversations.kick `conversations.kick` API reference}.
|
|
3357
|
-
*/
|
|
3358
|
-
kick: bindApiCall(this, "conversations.kick"),
|
|
3359
|
-
/**
|
|
3360
|
-
* @description Leaves a conversation.
|
|
3361
|
-
* @see {@link https://docs.slack.dev/reference/methods/conversations.leave `conversations.leave` API reference}.
|
|
3362
|
-
*/
|
|
3363
|
-
leave: bindApiCall(this, "conversations.leave"),
|
|
3364
|
-
/**
|
|
3365
|
-
* @description List all channels in a Slack team.
|
|
3366
|
-
* @see {@link https://docs.slack.dev/reference/methods/conversations.list `conversations.list` API reference}.
|
|
3367
|
-
*/
|
|
3368
|
-
list: bindApiCallWithOptionalArgument(this, "conversations.list"),
|
|
3369
|
-
/**
|
|
3370
|
-
* @description Lists shared channel invites that have been generated or received but have not been approved by
|
|
3371
|
-
* all parties.
|
|
3372
|
-
* @see {@link https://docs.slack.dev/reference/methods/conversations.listConnectInvites `conversations.listConnectInvites` API reference}.
|
|
3373
|
-
*/
|
|
3374
|
-
listConnectInvites: bindApiCallWithOptionalArgument(this, "conversations.listConnectInvites"),
|
|
3375
|
-
/**
|
|
3376
|
-
* @description Sets the read cursor in a channel.
|
|
3377
|
-
* @see {@link https://docs.slack.dev/reference/methods/conversations.mark `conversations.mark` API reference}.
|
|
3378
|
-
*/
|
|
3379
|
-
mark: bindApiCall(this, "conversations.mark"),
|
|
3380
|
-
/**
|
|
3381
|
-
* @description Retrieve members of a conversation.
|
|
3382
|
-
* @see {@link https://docs.slack.dev/reference/methods/conversations.members `conversations.members` API reference}.
|
|
3383
|
-
*/
|
|
3384
|
-
members: bindApiCall(this, "conversations.members"),
|
|
3385
|
-
/**
|
|
3386
|
-
* @description Opens or resumes a direct message or multi-person direct message.
|
|
3387
|
-
* @see {@link https://docs.slack.dev/reference/methods/conversations.open `conversations.open` API reference}.
|
|
3388
|
-
*/
|
|
3389
|
-
open: bindApiCall(this, "conversations.open"),
|
|
3390
|
-
/**
|
|
3391
|
-
* @description Renames a conversation.
|
|
3392
|
-
* @see {@link https://docs.slack.dev/reference/methods/conversations.rename `conversations.rename` API reference}.
|
|
3393
|
-
*/
|
|
3394
|
-
rename: bindApiCall(this, "conversations.rename"),
|
|
3395
|
-
/**
|
|
3396
|
-
* @description Retrieve a thread of messages posted to a conversation.
|
|
3397
|
-
* @see {@link https://docs.slack.dev/reference/methods/conversations.replies `conversations.replies` API reference}.
|
|
3398
|
-
*/
|
|
3399
|
-
replies: bindApiCall(this, "conversations.replies"),
|
|
3400
|
-
requestSharedInvite: {
|
|
3401
|
-
/**
|
|
3402
|
-
* @description Approves a request to add an external user to a channel and sends them a Slack Connect invite.
|
|
3403
|
-
* @see {@link https://docs.slack.dev/reference/methods/conversations.requestSharedInvite.approve `conversations.requestSharedInvite.approve` API reference}.
|
|
3404
|
-
*/
|
|
3405
|
-
approve: bindApiCall(this, "conversations.requestSharedInvite.approve"),
|
|
3406
|
-
/**
|
|
3407
|
-
* @description Denies a request to invite an external user to a channel.
|
|
3408
|
-
* @see {@link https://docs.slack.dev/reference/methods/conversations.requestSharedInvite.deny `conversations.requestSharedInvite.deny` API reference}.
|
|
3409
|
-
*/
|
|
3410
|
-
deny: bindApiCall(this, "conversations.requestSharedInvite.deny"),
|
|
3411
|
-
/**
|
|
3412
|
-
* @description Lists requests to add external users to channels with ability to filter.
|
|
3413
|
-
* @see {@link https://docs.slack.dev/reference/methods/conversations.requestSharedInvite.list `conversations.requestSharedInvite.list` API reference}.
|
|
3414
|
-
*/
|
|
3415
|
-
list: bindApiCallWithOptionalArgument(this, "conversations.requestSharedInvite.list")
|
|
3416
|
-
},
|
|
3417
|
-
/**
|
|
3418
|
-
* @description Sets the purpose for a conversation.
|
|
3419
|
-
* @see {@link https://docs.slack.dev/reference/methods/conversations.setPurpose `conversations.setPurpose` API reference}.
|
|
3420
|
-
*/
|
|
3421
|
-
setPurpose: bindApiCall(this, "conversations.setPurpose"),
|
|
3422
|
-
/**
|
|
3423
|
-
* @description Sets the topic for a conversation.
|
|
3424
|
-
* @see {@link https://docs.slack.dev/reference/methods/conversations.setTopic `conversations.setTopic` API reference}.
|
|
3425
|
-
*/
|
|
3426
|
-
setTopic: bindApiCall(this, "conversations.setTopic"),
|
|
3427
|
-
/**
|
|
3428
|
-
* @description Reverses conversation archival.
|
|
3429
|
-
* @see {@link https://docs.slack.dev/reference/methods/conversations.unarchive `conversations.unarchive` API reference}.
|
|
3430
|
-
*/
|
|
3431
|
-
unarchive: bindApiCall(this, "conversations.unarchive")
|
|
3432
|
-
};
|
|
3433
|
-
this.dialog = {
|
|
3434
|
-
/**
|
|
3435
|
-
* @description Open a dialog with a user.
|
|
3436
|
-
* @see {@link https://docs.slack.dev/reference/methods/dialog.open `dialog.open` API reference}.
|
|
3437
|
-
*/
|
|
3438
|
-
open: bindApiCall(this, "dialog.open") };
|
|
3439
|
-
this.dnd = {
|
|
3440
|
-
/**
|
|
3441
|
-
* @description Ends the current user's Do Not Disturb session immediately.
|
|
3442
|
-
* @see {@link https://docs.slack.dev/reference/methods/dnd.endDnd `dnd.endDnd` API reference}.
|
|
3443
|
-
*/
|
|
3444
|
-
endDnd: bindApiCallWithOptionalArgument(this, "dnd.endDnd"),
|
|
3445
|
-
/**
|
|
3446
|
-
* @description Ends the current user's snooze mode immediately.
|
|
3447
|
-
* @see {@link https://docs.slack.dev/reference/methods/dnd.endSnooze `dnd.endSnooze` API reference}.
|
|
3448
|
-
*/
|
|
3449
|
-
endSnooze: bindApiCallWithOptionalArgument(this, "dnd.endSnooze"),
|
|
3450
|
-
/**
|
|
3451
|
-
* @description Retrieves a user's current Do Not Disturb status.
|
|
3452
|
-
* @see {@link https://docs.slack.dev/reference/methods/dnd.info `dnd.info` API reference}.
|
|
3453
|
-
*/
|
|
3454
|
-
info: bindApiCallWithOptionalArgument(this, "dnd.info"),
|
|
3455
|
-
/**
|
|
3456
|
-
* @description Turns on Do Not Disturb mode for the current user, or changes its duration.
|
|
3457
|
-
* @see {@link https://docs.slack.dev/reference/methods/dnd.setSnooze `dnd.setSnooze` API reference}.
|
|
3458
|
-
*/
|
|
3459
|
-
setSnooze: bindApiCall(this, "dnd.setSnooze"),
|
|
3460
|
-
/**
|
|
3461
|
-
* @description Retrieves the Do Not Disturb status for up to 50 users on a team.
|
|
3462
|
-
* @see {@link https://docs.slack.dev/reference/methods/dnd.teamInfo `dnd.teamInfo` API reference}.
|
|
3463
|
-
*/
|
|
3464
|
-
teamInfo: bindApiCall(this, "dnd.teamInfo")
|
|
3465
|
-
};
|
|
3466
|
-
this.emoji = {
|
|
3467
|
-
/**
|
|
3468
|
-
* @description Lists custom emoji for a team.
|
|
3469
|
-
* @see {@link https://docs.slack.dev/reference/methods/emoji.list `emoji.list` API reference}.
|
|
3470
|
-
*/
|
|
3471
|
-
list: bindApiCallWithOptionalArgument(this, "emoji.list") };
|
|
3472
|
-
this.entity = {
|
|
3473
|
-
/**
|
|
3474
|
-
* @description Provide information about the entity to be displayed in the flexpane.
|
|
3475
|
-
* @see {@link https://docs.slack.dev/reference/methods/entity.presentDetails}
|
|
3476
|
-
*/
|
|
3477
|
-
presentDetails: bindApiCall(this, "entity.presentDetails") };
|
|
3478
|
-
this.files = {
|
|
3479
|
-
/**
|
|
3480
|
-
* @description Finishes an upload started with {@link https://docs.slack.dev/reference/methods/files.getUploadURLExternal `files.getUploadURLExternal`}.
|
|
3481
|
-
* @see {@link https://docs.slack.dev/reference/methods/files.completeUploadExternal `files.completeUploadExternal` API reference}.
|
|
3482
|
-
*/
|
|
3483
|
-
completeUploadExternal: bindApiCall(this, "files.completeUploadExternal"),
|
|
3484
|
-
/**
|
|
3485
|
-
* @description Deletes a file.
|
|
3486
|
-
* @see {@link https://docs.slack.dev/reference/methods/files.delete `files.delete` API reference}.
|
|
3487
|
-
*/
|
|
3488
|
-
delete: bindApiCall(this, "files.delete"),
|
|
3489
|
-
/**
|
|
3490
|
-
* @description Gets a URL for an edge external file upload.
|
|
3491
|
-
* @see {@link https://docs.slack.dev/reference/methods/files.getUploadURLExternal `files.getUploadURLExternal` API reference}.
|
|
3492
|
-
*/
|
|
3493
|
-
getUploadURLExternal: bindApiCall(this, "files.getUploadURLExternal"),
|
|
3494
|
-
/**
|
|
3495
|
-
* @description Gets information about a file.
|
|
3496
|
-
* @see {@link https://docs.slack.dev/reference/methods/files.info `files.info` API reference}.
|
|
3497
|
-
*/
|
|
3498
|
-
info: bindApiCall(this, "files.info"),
|
|
3499
|
-
/**
|
|
3500
|
-
* @description List files for a team, in a channel, or from a user with applied filters.
|
|
3501
|
-
* @see {@link https://docs.slack.dev/reference/methods/files.list `files.list` API reference}.
|
|
3502
|
-
*/
|
|
3503
|
-
list: bindApiCall(this, "files.list"),
|
|
3504
|
-
/**
|
|
3505
|
-
* @description Revokes public/external sharing access for a file.
|
|
3506
|
-
* @see {@link https://docs.slack.dev/reference/methods/files.revokePublicURL `files.revokePublicURL` API reference}.
|
|
3507
|
-
*/
|
|
3508
|
-
revokePublicURL: bindApiCall(this, "files.revokePublicURL"),
|
|
3509
|
-
/**
|
|
3510
|
-
* @description Enables a file for public/external sharing.
|
|
3511
|
-
* @see {@link https://docs.slack.dev/reference/methods/files.sharedPublicURL `files.sharedPublicURL` API reference}.
|
|
3512
|
-
*/
|
|
3513
|
-
sharedPublicURL: bindApiCall(this, "files.sharedPublicURL"),
|
|
3514
|
-
/**
|
|
3515
|
-
* @description Uploads or creates a file.
|
|
3516
|
-
* @deprecated Use `uploadV2` instead. See {@link https://docs.slack.dev/changelog/2024-04-a-better-way-to-upload-files-is-here-to-stay our post on retiring `files.upload`}.
|
|
3517
|
-
* @see {@link https://docs.slack.dev/reference/methods/files.upload `files.upload` API reference}.
|
|
3518
|
-
*/
|
|
3519
|
-
upload: bindApiCall(this, "files.upload"),
|
|
3520
|
-
/**
|
|
3521
|
-
* @description Custom method to support a new way of uploading files to Slack.
|
|
3522
|
-
* Supports a single file upload
|
|
3523
|
-
* Supply:
|
|
3524
|
-
* - (required) single file or content
|
|
3525
|
-
* - (optional) channel, alt_text, snippet_type,
|
|
3526
|
-
* Supports multiple file uploads
|
|
3527
|
-
* Supply:
|
|
3528
|
-
* - multiple upload_files
|
|
3529
|
-
* Will try to honor both single file or content data supplied as well
|
|
3530
|
-
* as multiple file uploads property.
|
|
3531
|
-
* @see {@link https://docs.slack.dev/tools/node-slack-sdk/web-api/#upload-a-file `@slack/web-api` Upload a file documentation}.
|
|
3532
|
-
*/
|
|
3533
|
-
uploadV2: bindFilesUploadV2(this),
|
|
3534
|
-
comments: {
|
|
3535
|
-
/**
|
|
3536
|
-
* @description Deletes an existing comment on a file.
|
|
3537
|
-
* @see {@link https://docs.slack.dev/reference/methods/files.comments.delete `files.comments.delete` API reference}.
|
|
3538
|
-
*/
|
|
3539
|
-
delete: bindApiCall(this, "files.comments.delete") },
|
|
3540
|
-
remote: {
|
|
3541
|
-
/**
|
|
3542
|
-
* @description Adds a file from a remote service.
|
|
3543
|
-
* @see {@link https://docs.slack.dev/reference/methods/files.remote.add `files.remote.add` API reference}.
|
|
3544
|
-
*/
|
|
3545
|
-
add: bindApiCall(this, "files.remote.add"),
|
|
3546
|
-
/**
|
|
3547
|
-
* @description Retrieve information about a remote file added to Slack.
|
|
3548
|
-
* @see {@link https://docs.slack.dev/reference/methods/files.remote.info `files.remote.info` API reference}.
|
|
3549
|
-
*/
|
|
3550
|
-
info: bindApiCall(this, "files.remote.info"),
|
|
3551
|
-
/**
|
|
3552
|
-
* @description List remote files added to Slack.
|
|
3553
|
-
* @see {@link https://docs.slack.dev/reference/methods/files.remote.list `files.remote.list` API reference}.
|
|
3554
|
-
*/
|
|
3555
|
-
list: bindApiCall(this, "files.remote.list"),
|
|
3556
|
-
/**
|
|
3557
|
-
* @description Remove a remote file.
|
|
3558
|
-
* @see {@link https://docs.slack.dev/reference/methods/files.remote.remove `files.remote.remove` API reference}.
|
|
3559
|
-
*/
|
|
3560
|
-
remove: bindApiCall(this, "files.remote.remove"),
|
|
3561
|
-
/**
|
|
3562
|
-
* @description Share a remote file into a channel.
|
|
3563
|
-
* @see {@link https://docs.slack.dev/reference/methods/files.remote.share `files.remote.share` API reference}.
|
|
3564
|
-
*/
|
|
3565
|
-
share: bindApiCall(this, "files.remote.share"),
|
|
3566
|
-
/**
|
|
3567
|
-
* @description Updates an existing remote file.
|
|
3568
|
-
* @see {@link https://docs.slack.dev/reference/methods/files.remote.update `files.remote.update` API reference}.
|
|
3569
|
-
*/
|
|
3570
|
-
update: bindApiCall(this, "files.remote.update")
|
|
3571
|
-
}
|
|
3572
|
-
};
|
|
3573
|
-
this.functions = {
|
|
3574
|
-
/**
|
|
3575
|
-
* @description Signal the failure to execute a Custom Function.
|
|
3576
|
-
* @see {@link https://docs.slack.dev/reference/methods/functions.completeError `functions.completeError` API reference}.
|
|
3577
|
-
*/
|
|
3578
|
-
completeError: bindApiCall(this, "functions.completeError"),
|
|
3579
|
-
/**
|
|
3580
|
-
* @description Signal the successful completion of a Custom Function.
|
|
3581
|
-
* @see {@link https://docs.slack.dev/reference/methods/functions.completeSuccess `functions.completeSuccess` API reference}.
|
|
3582
|
-
*/
|
|
3583
|
-
completeSuccess: bindApiCall(this, "functions.completeSuccess")
|
|
3584
|
-
};
|
|
3585
|
-
this.migration = {
|
|
3586
|
-
/**
|
|
3587
|
-
* @description For Enterprise Grid workspaces, map local user IDs to global user IDs.
|
|
3588
|
-
* @see {@link https://docs.slack.dev/reference/methods/migration.exchange `migration.exchange` API reference}.
|
|
3589
|
-
*/
|
|
3590
|
-
exchange: bindApiCall(this, "migration.exchange") };
|
|
3591
|
-
this.oauth = {
|
|
3592
|
-
/**
|
|
3593
|
-
* @description Exchanges a temporary OAuth verifier code for an access token.
|
|
3594
|
-
* @deprecated This is a legacy method only used by classic Slack apps. Use `oauth.v2.access` for new Slack apps.
|
|
3595
|
-
* @see {@link https://docs.slack.dev/reference/methods/oauth.access `oauth.access` API reference}.
|
|
3596
|
-
*/
|
|
3597
|
-
access: bindApiCall(this, "oauth.access"),
|
|
3598
|
-
v2: {
|
|
3599
|
-
/**
|
|
3600
|
-
* @description Exchanges a temporary OAuth verifier code for an access token.
|
|
3601
|
-
* @see {@link https://docs.slack.dev/reference/methods/oauth.v2.access `oauth.v2.access` API reference}.
|
|
3602
|
-
*/
|
|
3603
|
-
access: bindApiCall(this, "oauth.v2.access"),
|
|
3604
|
-
/**
|
|
3605
|
-
* @description Exchanges a legacy access token for a new expiring access token and refresh token.
|
|
3606
|
-
* @see {@link https://docs.slack.dev/reference/methods/oauth.v2.exchange `oauth.v2.exchange` API reference}.
|
|
3607
|
-
*/
|
|
3608
|
-
exchange: bindApiCall(this, "oauth.v2.exchange")
|
|
3609
|
-
}
|
|
3610
|
-
};
|
|
3611
|
-
this.openid = { connect: {
|
|
3612
|
-
/**
|
|
3613
|
-
* @description Exchanges a temporary OAuth verifier code for an access token for {@link https://docs.slack.dev/authentication/sign-in-with-slack Sign in with Slack}.
|
|
3614
|
-
* @see {@link https://docs.slack.dev/reference/methods/openid.connect.token `openid.connect.token` API reference}.
|
|
3615
|
-
*/
|
|
3616
|
-
token: bindApiCall(this, "openid.connect.token"),
|
|
3617
|
-
/**
|
|
3618
|
-
* @description Get the identity of a user who has authorized {@link https://docs.slack.dev/authentication/sign-in-with-slack Sign in with Slack}.
|
|
3619
|
-
* @see {@link https://docs.slack.dev/reference/methods/openid.connect.userInfo `openid.connect.userInfo` API reference}.
|
|
3620
|
-
*/
|
|
3621
|
-
userInfo: bindApiCallWithOptionalArgument(this, "openid.connect.userInfo")
|
|
3622
|
-
} };
|
|
3623
|
-
this.pins = {
|
|
3624
|
-
/**
|
|
3625
|
-
* @description Pins an item to a channel.
|
|
3626
|
-
* @see {@link https://docs.slack.dev/reference/methods/pins.add `pins.add` API reference}.
|
|
3627
|
-
*/
|
|
3628
|
-
add: bindApiCall(this, "pins.add"),
|
|
3629
|
-
/**
|
|
3630
|
-
* @description Lists items pinned to a channel.
|
|
3631
|
-
* @see {@link https://docs.slack.dev/reference/methods/pins.list `pins.list` API reference}.
|
|
3632
|
-
*/
|
|
3633
|
-
list: bindApiCall(this, "pins.list"),
|
|
3634
|
-
/**
|
|
3635
|
-
* @description Un-pins an item from a channel.
|
|
3636
|
-
* @see {@link https://docs.slack.dev/reference/methods/pins.remove `pins.remove` API reference}.
|
|
3637
|
-
*/
|
|
3638
|
-
remove: bindApiCall(this, "pins.remove")
|
|
3639
|
-
};
|
|
3640
|
-
this.reactions = {
|
|
3641
|
-
/**
|
|
3642
|
-
* @description Adds a reaction to an item.
|
|
3643
|
-
* @see {@link https://docs.slack.dev/reference/methods/reactions.add `reactions.add` API reference}.
|
|
3644
|
-
*/
|
|
3645
|
-
add: bindApiCall(this, "reactions.add"),
|
|
3646
|
-
/**
|
|
3647
|
-
* @description Gets reactions for an item.
|
|
3648
|
-
* @see {@link https://docs.slack.dev/reference/methods/reactions.get `reactions.get` API reference}.
|
|
3649
|
-
*/
|
|
3650
|
-
get: bindApiCall(this, "reactions.get"),
|
|
3651
|
-
/**
|
|
3652
|
-
* @description List reactions made by a user.
|
|
3653
|
-
* @see {@link https://docs.slack.dev/reference/methods/reactions.list `reactions.list` API reference}.
|
|
3654
|
-
*/
|
|
3655
|
-
list: bindApiCallWithOptionalArgument(this, "reactions.list"),
|
|
3656
|
-
/**
|
|
3657
|
-
* @description Removes a reaction from an item.
|
|
3658
|
-
* @see {@link https://docs.slack.dev/reference/methods/reactions.remove `reactions.remove` API reference}.
|
|
3659
|
-
*/
|
|
3660
|
-
remove: bindApiCall(this, "reactions.remove")
|
|
3661
|
-
};
|
|
3662
|
-
this.reminders = {
|
|
3663
|
-
/**
|
|
3664
|
-
* @description Creates a reminder.
|
|
3665
|
-
* @see {@link https://docs.slack.dev/reference/methods/reminders.add `reminders.add` API reference}.
|
|
3666
|
-
*/
|
|
3667
|
-
add: bindApiCall(this, "reminders.add"),
|
|
3668
|
-
/**
|
|
3669
|
-
* @description Marks a reminder as complete.
|
|
3670
|
-
* @see {@link https://docs.slack.dev/reference/methods/reminders.complete `reminders.complete` API reference}.
|
|
3671
|
-
*/
|
|
3672
|
-
complete: bindApiCall(this, "reminders.complete"),
|
|
3673
|
-
/**
|
|
3674
|
-
* @description Deletes a reminder.
|
|
3675
|
-
* @see {@link https://docs.slack.dev/reference/methods/reminders.delete `reminders.delete` API reference}.
|
|
3676
|
-
*/
|
|
3677
|
-
delete: bindApiCall(this, "reminders.delete"),
|
|
3678
|
-
/**
|
|
3679
|
-
* @description Gets information about a reminder.
|
|
3680
|
-
* @see {@link https://docs.slack.dev/reference/methods/reminders.info `reminders.info` API reference}.
|
|
3681
|
-
*/
|
|
3682
|
-
info: bindApiCall(this, "reminders.info"),
|
|
3683
|
-
/**
|
|
3684
|
-
* @description Lists all reminders created by or for a given user.
|
|
3685
|
-
* @see {@link https://docs.slack.dev/reference/methods/reminders.list `reminders.list` API reference}.
|
|
3686
|
-
*/
|
|
3687
|
-
list: bindApiCallWithOptionalArgument(this, "reminders.list")
|
|
3688
|
-
};
|
|
3689
|
-
this.rtm = {
|
|
3690
|
-
/**
|
|
3691
|
-
* @description Starts a Real Time Messaging session.
|
|
3692
|
-
* @see {@link https://docs.slack.dev/reference/methods/rtm.connect `rtm.connect` API reference}.
|
|
3693
|
-
*/
|
|
3694
|
-
connect: bindApiCallWithOptionalArgument(this, "rtm.connect"),
|
|
3695
|
-
/**
|
|
3696
|
-
* @description Starts a Real Time Messaging session.
|
|
3697
|
-
* @deprecated Use `rtm.connect` instead. See {@link https://docs.slack.dev/changelog/2021-10-rtm-start-to-stop our post on retiring `rtm.start`}.
|
|
3698
|
-
* @see {@link https://docs.slack.dev/reference/methods/rtm.start `rtm.start` API reference}.
|
|
3699
|
-
*/
|
|
3700
|
-
start: bindApiCallWithOptionalArgument(this, "rtm.start")
|
|
3701
|
-
};
|
|
3702
|
-
this.search = {
|
|
3703
|
-
/**
|
|
3704
|
-
* @description Searches for messages and files matching a query.
|
|
3705
|
-
* @see {@link https://docs.slack.dev/reference/methods/search.all search.all` API reference}.
|
|
3706
|
-
*/
|
|
3707
|
-
all: bindApiCall(this, "search.all"),
|
|
3708
|
-
/**
|
|
3709
|
-
* @description Searches for files matching a query.
|
|
3710
|
-
* @see {@link https://docs.slack.dev/reference/methods/search.files search.files` API reference}.
|
|
3711
|
-
*/
|
|
3712
|
-
files: bindApiCall(this, "search.files"),
|
|
3713
|
-
/**
|
|
3714
|
-
* @description Searches for messages matching a query.
|
|
3715
|
-
* @see {@link https://docs.slack.dev/reference/methods/search.messages search.messages` API reference}.
|
|
3716
|
-
*/
|
|
3717
|
-
messages: bindApiCall(this, "search.messages")
|
|
3718
|
-
};
|
|
3719
|
-
this.slackLists = {
|
|
3720
|
-
access: {
|
|
3721
|
-
/**
|
|
3722
|
-
* @description Delete access for specified entities.
|
|
3723
|
-
* @see {@link https://docs.slack.dev/reference/methods/slackLists.access.delete `slackLists.access.delete` API reference}.
|
|
3724
|
-
*/
|
|
3725
|
-
delete: bindApiCall(this, "slackLists.access.delete"),
|
|
3726
|
-
/**
|
|
3727
|
-
* @description Set access level for specified entities.
|
|
3728
|
-
* @see {@link https://docs.slack.dev/reference/methods/slackLists.access.set `slackLists.access.set` API reference}.
|
|
3729
|
-
*/
|
|
3730
|
-
set: bindApiCall(this, "slackLists.access.set")
|
|
3731
|
-
},
|
|
3732
|
-
/**
|
|
3733
|
-
* @description Create a List.
|
|
3734
|
-
* @see {@link https://docs.slack.dev/reference/methods/slackLists.create `slackLists.create` API reference}.
|
|
3735
|
-
*/
|
|
3736
|
-
create: bindApiCall(this, "slackLists.create"),
|
|
3737
|
-
download: {
|
|
3738
|
-
/**
|
|
3739
|
-
* @description Get download job status.
|
|
3740
|
-
* @see {@link https://docs.slack.dev/reference/methods/slackLists.download.get `slackLists.download.get` API reference}.
|
|
3741
|
-
*/
|
|
3742
|
-
get: bindApiCall(this, "slackLists.download.get"),
|
|
3743
|
-
/**
|
|
3744
|
-
* @description Start a download job for a list.
|
|
3745
|
-
* @see {@link https://docs.slack.dev/reference/methods/slackLists.download.start `slackLists.download.start` API reference}.
|
|
3746
|
-
*/
|
|
3747
|
-
start: bindApiCall(this, "slackLists.download.start")
|
|
3748
|
-
},
|
|
3749
|
-
items: {
|
|
3750
|
-
/**
|
|
3751
|
-
* @description Create a list item.
|
|
3752
|
-
* @see {@link https://docs.slack.dev/reference/methods/slackLists.items.create `slackLists.items.create` API reference}.
|
|
3753
|
-
*/
|
|
3754
|
-
create: bindApiCall(this, "slackLists.items.create"),
|
|
3755
|
-
/**
|
|
3756
|
-
* @description Delete a list item.
|
|
3757
|
-
* @see {@link https://docs.slack.dev/reference/methods/slackLists.items.delete `slackLists.items.delete` API reference}.
|
|
3758
|
-
*/
|
|
3759
|
-
delete: bindApiCall(this, "slackLists.items.delete"),
|
|
3760
|
-
/**
|
|
3761
|
-
* @description Delete multiple list items.
|
|
3762
|
-
* @see {@link https://docs.slack.dev/reference/methods/slackLists.items.deleteMultiple `slackLists.items.deleteMultiple` API reference}.
|
|
3763
|
-
*/
|
|
3764
|
-
deleteMultiple: bindApiCall(this, "slackLists.items.deleteMultiple"),
|
|
3765
|
-
/**
|
|
3766
|
-
* @description Get info about a list item.
|
|
3767
|
-
* @see {@link https://docs.slack.dev/reference/methods/slackLists.items.info `slackLists.items.info` API reference}.
|
|
3768
|
-
*/
|
|
3769
|
-
info: bindApiCall(this, "slackLists.items.info"),
|
|
3770
|
-
/**
|
|
3771
|
-
* @description Get records from a List.
|
|
3772
|
-
* @see {@link https://docs.slack.dev/reference/methods/slackLists.items.list `slackLists.items.list` API reference}.
|
|
3773
|
-
*/
|
|
3774
|
-
list: bindApiCall(this, "slackLists.items.list"),
|
|
3775
|
-
/**
|
|
3776
|
-
* @description Update a list item.
|
|
3777
|
-
* @see {@link https://docs.slack.dev/reference/methods/slackLists.items.update `slackLists.items.update` API reference}.
|
|
3778
|
-
*/
|
|
3779
|
-
update: bindApiCall(this, "slackLists.items.update")
|
|
3780
|
-
},
|
|
3781
|
-
/**
|
|
3782
|
-
* @description Update a list.
|
|
3783
|
-
* @see {@link https://docs.slack.dev/reference/methods/slackLists.update `slackLists.update` API reference}.
|
|
3784
|
-
*/
|
|
3785
|
-
update: bindApiCall(this, "slackLists.update")
|
|
3786
|
-
};
|
|
3787
|
-
this.team = {
|
|
3788
|
-
/**
|
|
3789
|
-
* @description Gets the access logs for the current team.
|
|
3790
|
-
* @see {@link https://docs.slack.dev/reference/methods/team.accessLogs `team.accessLogs` API reference}.
|
|
3791
|
-
*/
|
|
3792
|
-
accessLogs: bindApiCallWithOptionalArgument(this, "team.accessLogs"),
|
|
3793
|
-
/**
|
|
3794
|
-
* @description Gets billable users information for the current team.
|
|
3795
|
-
* @see {@link https://docs.slack.dev/reference/methods/team.billableInfo `team.billableInfo` API reference}.
|
|
3796
|
-
*/
|
|
3797
|
-
billableInfo: bindApiCallWithOptionalArgument(this, "team.billableInfo"),
|
|
3798
|
-
billing: {
|
|
3799
|
-
/**
|
|
3800
|
-
* @description Reads a workspace's billing plan information.
|
|
3801
|
-
* @see {@link https://docs.slack.dev/reference/methods/team.billing.info `team.billing.info` API reference}.
|
|
3802
|
-
*/
|
|
3803
|
-
info: bindApiCall(this, "team.billing.info") },
|
|
3804
|
-
externalTeams: {
|
|
3805
|
-
/**
|
|
3806
|
-
* @description Disconnect an external organization.
|
|
3807
|
-
* @see {@link https://docs.slack.dev/reference/methods/team.externalTeams.disconnect `team.externalTeams.disconnect` API reference}.
|
|
3808
|
-
*/
|
|
3809
|
-
disconnect: bindApiCall(this, "team.externalTeams.disconnect"),
|
|
3810
|
-
/**
|
|
3811
|
-
* @description Returns a list of all the external teams connected and details about the connection.
|
|
3812
|
-
* @see {@link https://docs.slack.dev/reference/methods/team.externalTeams.list `team.externalTeams.list` API reference}.
|
|
3813
|
-
*/
|
|
3814
|
-
list: bindApiCall(this, "team.externalTeams.list")
|
|
3815
|
-
},
|
|
3816
|
-
/**
|
|
3817
|
-
* @description Gets information about the current team.
|
|
3818
|
-
* @see {@link https://docs.slack.dev/reference/methods/team.info `team.info` API reference}.
|
|
3819
|
-
*/
|
|
3820
|
-
info: bindApiCallWithOptionalArgument(this, "team.info"),
|
|
3821
|
-
/**
|
|
3822
|
-
* @description Gets the integration logs for the current team.
|
|
3823
|
-
* @see {@link https://docs.slack.dev/reference/methods/team.integrationLogs `team.integrationLogs` API reference}.
|
|
3824
|
-
*/
|
|
3825
|
-
integrationLogs: bindApiCallWithOptionalArgument(this, "team.integrationLogs"),
|
|
3826
|
-
preferences: {
|
|
3827
|
-
/**
|
|
3828
|
-
* @description Retrieve a list of a workspace's team preferences.
|
|
3829
|
-
* @see {@link https://docs.slack.dev/reference/methods/team.preferences.list `team.preferences.list` API reference}.
|
|
3830
|
-
*/
|
|
3831
|
-
list: bindApiCallWithOptionalArgument(this, "team.preferences.list") },
|
|
3832
|
-
profile: {
|
|
3833
|
-
/**
|
|
3834
|
-
* @description Retrieve a team's profile.
|
|
3835
|
-
* @see {@link https://docs.slack.dev/reference/methods/team.profile.get `team.profile.get` API reference}.
|
|
3836
|
-
*/
|
|
3837
|
-
get: bindApiCallWithOptionalArgument(this, "team.profile.get") }
|
|
3838
|
-
};
|
|
3839
|
-
this.tooling = { tokens: {
|
|
3840
|
-
/**
|
|
3841
|
-
* @description Exchanges a refresh token for a new app configuration token.
|
|
3842
|
-
* @see {@link https://docs.slack.dev/reference/methods/tooling.tokens.rotate `tooling.tokens.rotate` API reference}.
|
|
3843
|
-
*/
|
|
3844
|
-
rotate: bindApiCall(this, "tooling.tokens.rotate") } };
|
|
3845
|
-
this.usergroups = {
|
|
3846
|
-
/**
|
|
3847
|
-
* @description Create a User Group.
|
|
3848
|
-
* @see {@link https://docs.slack.dev/reference/methods/usergroups.create `usergroups.create` API reference}.
|
|
3849
|
-
*/
|
|
3850
|
-
create: bindApiCall(this, "usergroups.create"),
|
|
3851
|
-
/**
|
|
3852
|
-
* @description Disable an existing User Group.
|
|
3853
|
-
* @see {@link https://docs.slack.dev/reference/methods/usergroups.disable `usergroups.disable` API reference}.
|
|
3854
|
-
*/
|
|
3855
|
-
disable: bindApiCall(this, "usergroups.disable"),
|
|
3856
|
-
/**
|
|
3857
|
-
* @description Enable an existing User Group.
|
|
3858
|
-
* @see {@link https://docs.slack.dev/reference/methods/usergroups.enable `usergroups.enable` API reference}.
|
|
3859
|
-
*/
|
|
3860
|
-
enable: bindApiCall(this, "usergroups.enable"),
|
|
3861
|
-
/**
|
|
3862
|
-
* @description List all User Groups for a team.
|
|
3863
|
-
* @see {@link https://docs.slack.dev/reference/methods/usergroups.list `usergroups.list` API reference}.
|
|
3864
|
-
*/
|
|
3865
|
-
list: bindApiCallWithOptionalArgument(this, "usergroups.list"),
|
|
3866
|
-
/**
|
|
3867
|
-
* @description Update an existing User Group.
|
|
3868
|
-
* @see {@link https://docs.slack.dev/reference/methods/usergroups.update `usergroups.update` API reference}.
|
|
3869
|
-
*/
|
|
3870
|
-
update: bindApiCall(this, "usergroups.update"),
|
|
3871
|
-
users: {
|
|
3872
|
-
/**
|
|
3873
|
-
* @description List all users in a User Group.
|
|
3874
|
-
* @see {@link https://docs.slack.dev/reference/methods/usergroups.users.list `usergroups.users.list` API reference}.
|
|
3875
|
-
*/
|
|
3876
|
-
list: bindApiCall(this, "usergroups.users.list"),
|
|
3877
|
-
/**
|
|
3878
|
-
* @description Update the list of users in a User Group.
|
|
3879
|
-
* @see {@link https://docs.slack.dev/reference/methods/usergroups.users.update `usergroups.users.update` API reference}.
|
|
3880
|
-
*/
|
|
3881
|
-
update: bindApiCall(this, "usergroups.users.update")
|
|
3882
|
-
}
|
|
3883
|
-
};
|
|
3884
|
-
this.users = {
|
|
3885
|
-
/**
|
|
3886
|
-
* @description List conversations the calling user may access.
|
|
3887
|
-
* @see {@link https://docs.slack.dev/reference/methods/users.conversations `users.conversations` API reference}.
|
|
3888
|
-
*/
|
|
3889
|
-
conversations: bindApiCall(this, "users.conversations"),
|
|
3890
|
-
/**
|
|
3891
|
-
* @description Delete the user profile photo.
|
|
3892
|
-
* @see {@link https://docs.slack.dev/reference/methods/users.deletePhoto `users.deletePhoto` API reference}.
|
|
3893
|
-
*/
|
|
3894
|
-
deletePhoto: bindApiCall(this, "users.deletePhoto"),
|
|
3895
|
-
discoverableContacts: {
|
|
3896
|
-
/**
|
|
3897
|
-
* @description Lookup an email address to see if someone is on Slack.
|
|
3898
|
-
* @see {@link https://docs.slack.dev/reference/methods/users.discoverableContacts.lookup `users.discoverableContacts.lookup` API reference}.
|
|
3899
|
-
*/
|
|
3900
|
-
lookup: bindApiCall(this, "users.discoverableContacts.lookup") },
|
|
3901
|
-
/**
|
|
3902
|
-
* @description Gets user presence information.
|
|
3903
|
-
* @see {@link https://docs.slack.dev/reference/methods/users.getPresence `users.getPresence` API reference}.
|
|
3904
|
-
*/
|
|
3905
|
-
getPresence: bindApiCall(this, "users.getPresence"),
|
|
3906
|
-
/**
|
|
3907
|
-
* @description Get a user's identity.
|
|
3908
|
-
* @see {@link https://docs.slack.dev/reference/methods/users.identity `users.identity` API reference}.
|
|
3909
|
-
*/
|
|
3910
|
-
identity: bindApiCall(this, "users.identity"),
|
|
3911
|
-
/**
|
|
3912
|
-
* @description Gets information about a user.
|
|
3913
|
-
* @see {@link https://docs.slack.dev/reference/methods/users.info `users.info` API reference}.
|
|
3914
|
-
*/
|
|
3915
|
-
info: bindApiCall(this, "users.info"),
|
|
3916
|
-
/**
|
|
3917
|
-
* @description Lists all users in a Slack team.
|
|
3918
|
-
* @see {@link https://docs.slack.dev/reference/methods/users.list `users.list` API reference}.
|
|
3919
|
-
*/
|
|
3920
|
-
list: bindApiCall(this, "users.list"),
|
|
3921
|
-
/**
|
|
3922
|
-
* @description Find a user with an email address.
|
|
3923
|
-
* @see {@link https://docs.slack.dev/reference/methods/users.lookupByEmail `users.lookupByEmail` API reference}.
|
|
3924
|
-
*/
|
|
3925
|
-
lookupByEmail: bindApiCall(this, "users.lookupByEmail"),
|
|
3926
|
-
/**
|
|
3927
|
-
* @description Set the user profile photo.
|
|
3928
|
-
* @see {@link https://docs.slack.dev/reference/methods/users.setPhoto `users.setPhoto` API reference}.
|
|
3929
|
-
*/
|
|
3930
|
-
setPhoto: bindApiCall(this, "users.setPhoto"),
|
|
3931
|
-
/**
|
|
3932
|
-
* @description Manually sets user presence.
|
|
3933
|
-
* @see {@link https://docs.slack.dev/reference/methods/users.setPresence `users.setPresence` API reference}.
|
|
3934
|
-
*/
|
|
3935
|
-
setPresence: bindApiCall(this, "users.setPresence"),
|
|
3936
|
-
profile: {
|
|
3937
|
-
/**
|
|
3938
|
-
* @description Retrieve a user's profile information, including their custom status.
|
|
3939
|
-
* @see {@link https://docs.slack.dev/reference/methods/users.profile.get `users.profile.get` API reference}.
|
|
3940
|
-
*/
|
|
3941
|
-
get: bindApiCall(this, "users.profile.get"),
|
|
3942
|
-
/**
|
|
3943
|
-
* @description Set a user's profile information, including custom status.
|
|
3944
|
-
* @see {@link https://docs.slack.dev/reference/methods/users.profile.set `users.profile.set` API reference}.
|
|
3945
|
-
*/
|
|
3946
|
-
set: bindApiCall(this, "users.profile.set")
|
|
3947
|
-
}
|
|
3948
|
-
};
|
|
3949
|
-
this.views = {
|
|
3950
|
-
/**
|
|
3951
|
-
* @description Open a view for a user.
|
|
3952
|
-
* @see {@link https://docs.slack.dev/reference/methods/views.open `views.open` API reference}.
|
|
3953
|
-
*/
|
|
3954
|
-
open: bindApiCall(this, "views.open"),
|
|
3955
|
-
/**
|
|
3956
|
-
* @description Publish a static view for a user.
|
|
3957
|
-
* @see {@link https://docs.slack.dev/reference/methods/views.publish `views.publish` API reference}.
|
|
3958
|
-
*/
|
|
3959
|
-
publish: bindApiCall(this, "views.publish"),
|
|
3960
|
-
/**
|
|
3961
|
-
* @description Push a view onto the stack of a root view.
|
|
3962
|
-
* @see {@link https://docs.slack.dev/reference/methods/views.push `views.push` API reference}.
|
|
3963
|
-
*/
|
|
3964
|
-
push: bindApiCall(this, "views.push"),
|
|
3965
|
-
/**
|
|
3966
|
-
* @description Update an existing view.
|
|
3967
|
-
* @see {@link https://docs.slack.dev/reference/methods/views.update `views.update` API reference}.
|
|
3968
|
-
*/
|
|
3969
|
-
update: bindApiCall(this, "views.update")
|
|
3970
|
-
};
|
|
3971
|
-
this.stars = {
|
|
3972
|
-
/**
|
|
3973
|
-
* @description Save an item for later. Formerly known as adding a star.
|
|
3974
|
-
* @deprecated Stars can still be added but they can no longer be viewed or interacted with by end-users.
|
|
3975
|
-
* See {@link https://docs.slack.dev/changelog/2023-07-its-later-already-for-stars-and-reminders our post on stars and the Later list}.
|
|
3976
|
-
* @see {@link https://docs.slack.dev/reference/methods/stars.add `stars.add` API reference}.
|
|
3977
|
-
*/
|
|
3978
|
-
add: bindApiCall(this, "stars.add"),
|
|
3979
|
-
/**
|
|
3980
|
-
* @description List a user's saved items, formerly known as stars.
|
|
3981
|
-
* @deprecated Stars can still be listed but they can no longer be viewed or interacted with by end-users.
|
|
3982
|
-
* See {@link https://docs.slack.dev/changelog/2023-07-its-later-already-for-stars-and-reminders our post on stars and the Later list}.
|
|
3983
|
-
* @see {@link https://docs.slack.dev/reference/methods/stars.list `stars.list` API reference}.
|
|
3984
|
-
*/
|
|
3985
|
-
list: bindApiCall(this, "stars.list"),
|
|
3986
|
-
/**
|
|
3987
|
-
* @description Remove a saved item from a user's saved items, formerly known as stars.
|
|
3988
|
-
* @deprecated Stars can still be removed but they can no longer be viewed or interacted with by end-users.
|
|
3989
|
-
* See {@link https://docs.slack.dev/changelog/2023-07-its-later-already-for-stars-and-reminders our post on stars and the Later list}.
|
|
3990
|
-
* @see {@link https://docs.slack.dev/reference/methods/stars.remove `stars.remove` API reference}.
|
|
3991
|
-
*/
|
|
3992
|
-
remove: bindApiCall(this, "stars.remove")
|
|
3993
|
-
};
|
|
3994
|
-
this.workflows = {
|
|
3995
|
-
featured: {
|
|
3996
|
-
/**
|
|
3997
|
-
* @description Add featured workflows to a channel.
|
|
3998
|
-
* @see {@link https://docs.slack.dev/reference/methods/workflows.featured.add `workflows.featured.add` API reference}.
|
|
3999
|
-
*/
|
|
4000
|
-
add: bindApiCall(this, "workflows.featured.add"),
|
|
4001
|
-
/**
|
|
4002
|
-
* @description List the featured workflows for specified channels.
|
|
4003
|
-
* @see {@link https://docs.slack.dev/reference/methods/workflows.featured.list `workflows.featured.list` API reference}.
|
|
4004
|
-
*/
|
|
4005
|
-
list: bindApiCall(this, "workflows.featured.list"),
|
|
4006
|
-
/**
|
|
4007
|
-
* @description Remove featured workflows from a channel.
|
|
4008
|
-
* @see {@link https://docs.slack.dev/reference/methods/workflows.featured.remove `workflows.featured.remove` API reference}.
|
|
4009
|
-
*/
|
|
4010
|
-
remove: bindApiCall(this, "workflows.featured.remove"),
|
|
4011
|
-
/**
|
|
4012
|
-
* @description Set featured workflows for a channel.
|
|
4013
|
-
* @see {@link https://docs.slack.dev/reference/methods/workflows.featured.set `workflows.featured.set` API reference}.
|
|
4014
|
-
*/
|
|
4015
|
-
set: bindApiCall(this, "workflows.featured.set")
|
|
4016
|
-
},
|
|
4017
|
-
/**
|
|
4018
|
-
* @description Indicate that an app's step in a workflow completed execution.
|
|
4019
|
-
* @deprecated Steps from Apps is deprecated.
|
|
4020
|
-
* We're retiring all Slack app functionality around Steps from Apps in September 2024.
|
|
4021
|
-
* See {@link https://docs.slack.dev/changelog/2023-08-workflow-steps-from-apps-step-back our post on deprecating Steps from Apps}.
|
|
4022
|
-
* @see {@link https://docs.slack.dev/legacy/legacy-steps-from-apps/legacy-steps-from-apps-workflow_step-object `workflows.stepCompleted` API reference}.
|
|
4023
|
-
*/
|
|
4024
|
-
stepCompleted: bindApiCall(this, "workflows.stepCompleted"),
|
|
4025
|
-
/**
|
|
4026
|
-
* @description Indicate that an app's step in a workflow failed to execute.
|
|
4027
|
-
* @deprecated Steps from Apps is deprecated.
|
|
4028
|
-
* We're retiring all Slack app functionality around Steps from Apps in September 2024.
|
|
4029
|
-
* See {@link https://docs.slack.dev/changelog/2023-08-workflow-steps-from-apps-step-back our post on deprecating Steps from Apps}.
|
|
4030
|
-
* @see {@link https://docs.slack.dev/legacy/legacy-steps-from-apps/legacy-steps-from-apps-workflow_step-object `workflows.stepFailed` API reference}.
|
|
4031
|
-
*/
|
|
4032
|
-
stepFailed: bindApiCall(this, "workflows.stepFailed"),
|
|
4033
|
-
/**
|
|
4034
|
-
* @description Update the configuration for a workflow step.
|
|
4035
|
-
* @deprecated Steps from Apps is deprecated.
|
|
4036
|
-
* We're retiring all Slack app functionality around Steps from Apps in September 2024.
|
|
4037
|
-
* See {@link https://docs.slack.dev/changelog/2023-08-workflow-steps-from-apps-step-back our post on deprecating Steps from Apps}.
|
|
4038
|
-
* @see {@link https://docs.slack.dev/legacy/legacy-steps-from-apps/legacy-steps-from-apps-workflow_step-object `workflows.updateStep` API reference}.
|
|
4039
|
-
*/
|
|
4040
|
-
updateStep: bindApiCall(this, "workflows.updateStep")
|
|
4041
|
-
};
|
|
4042
|
-
if (new.target !== WebClient_1.WebClient && !(new.target.prototype instanceof WebClient_1.WebClient)) throw new Error("Attempt to inherit from WebClient methods without inheriting from WebClient");
|
|
4043
|
-
}
|
|
4044
|
-
};
|
|
4045
|
-
exports.Methods = Methods;
|
|
4046
|
-
__exportStar(require_dist$1(), exports);
|
|
4047
|
-
}));
|
|
4048
|
-
//#endregion
|
|
4049
|
-
//#region ../../node_modules/.pnpm/@slack+web-api@7.15.1_debug@4.4.3_supports-color@8.1.1_/node_modules/@slack/web-api/dist/WebClient.js
|
|
4050
|
-
var require_WebClient = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
4051
|
-
var __createBinding = exports && exports.__createBinding || (Object.create ? (function(o, m, k, k2) {
|
|
4052
|
-
if (k2 === void 0) k2 = k;
|
|
4053
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
4054
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) desc = {
|
|
4055
|
-
enumerable: true,
|
|
4056
|
-
get: function() {
|
|
4057
|
-
return m[k];
|
|
4058
|
-
}
|
|
4059
|
-
};
|
|
4060
|
-
Object.defineProperty(o, k2, desc);
|
|
4061
|
-
}) : (function(o, m, k, k2) {
|
|
4062
|
-
if (k2 === void 0) k2 = k;
|
|
4063
|
-
o[k2] = m[k];
|
|
4064
|
-
}));
|
|
4065
|
-
var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? (function(o, v) {
|
|
4066
|
-
Object.defineProperty(o, "default", {
|
|
4067
|
-
enumerable: true,
|
|
4068
|
-
value: v
|
|
4069
|
-
});
|
|
4070
|
-
}) : function(o, v) {
|
|
4071
|
-
o["default"] = v;
|
|
4072
|
-
});
|
|
4073
|
-
var __importStar = exports && exports.__importStar || (function() {
|
|
4074
|
-
var ownKeys = function(o) {
|
|
4075
|
-
ownKeys = Object.getOwnPropertyNames || function(o) {
|
|
4076
|
-
var ar = [];
|
|
4077
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
4078
|
-
return ar;
|
|
4079
|
-
};
|
|
4080
|
-
return ownKeys(o);
|
|
4081
|
-
};
|
|
4082
|
-
return function(mod) {
|
|
4083
|
-
if (mod && mod.__esModule) return mod;
|
|
4084
|
-
var result = {};
|
|
4085
|
-
if (mod != null) {
|
|
4086
|
-
for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
4087
|
-
}
|
|
4088
|
-
__setModuleDefault(result, mod);
|
|
4089
|
-
return result;
|
|
4090
|
-
};
|
|
4091
|
-
})();
|
|
4092
|
-
var __await = exports && exports.__await || function(v) {
|
|
4093
|
-
return this instanceof __await ? (this.v = v, this) : new __await(v);
|
|
4094
|
-
};
|
|
4095
|
-
var __asyncGenerator = exports && exports.__asyncGenerator || function(thisArg, _arguments, generator) {
|
|
4096
|
-
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
4097
|
-
var g = generator.apply(thisArg, _arguments || []), i, q = [];
|
|
4098
|
-
return i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function() {
|
|
4099
|
-
return this;
|
|
4100
|
-
}, i;
|
|
4101
|
-
function awaitReturn(f) {
|
|
4102
|
-
return function(v) {
|
|
4103
|
-
return Promise.resolve(v).then(f, reject);
|
|
4104
|
-
};
|
|
4105
|
-
}
|
|
4106
|
-
function verb(n, f) {
|
|
4107
|
-
if (g[n]) {
|
|
4108
|
-
i[n] = function(v) {
|
|
4109
|
-
return new Promise(function(a, b) {
|
|
4110
|
-
q.push([
|
|
4111
|
-
n,
|
|
4112
|
-
v,
|
|
4113
|
-
a,
|
|
4114
|
-
b
|
|
4115
|
-
]) > 1 || resume(n, v);
|
|
4116
|
-
});
|
|
4117
|
-
};
|
|
4118
|
-
if (f) i[n] = f(i[n]);
|
|
4119
|
-
}
|
|
4120
|
-
}
|
|
4121
|
-
function resume(n, v) {
|
|
4122
|
-
try {
|
|
4123
|
-
step(g[n](v));
|
|
4124
|
-
} catch (e) {
|
|
4125
|
-
settle(q[0][3], e);
|
|
4126
|
-
}
|
|
4127
|
-
}
|
|
4128
|
-
function step(r) {
|
|
4129
|
-
r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r);
|
|
4130
|
-
}
|
|
4131
|
-
function fulfill(value) {
|
|
4132
|
-
resume("next", value);
|
|
4133
|
-
}
|
|
4134
|
-
function reject(value) {
|
|
4135
|
-
resume("throw", value);
|
|
4136
|
-
}
|
|
4137
|
-
function settle(f, v) {
|
|
4138
|
-
if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]);
|
|
4139
|
-
}
|
|
4140
|
-
};
|
|
4141
|
-
var __asyncValues = exports && exports.__asyncValues || function(o) {
|
|
4142
|
-
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
4143
|
-
var m = o[Symbol.asyncIterator], i;
|
|
4144
|
-
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function() {
|
|
4145
|
-
return this;
|
|
4146
|
-
}, i);
|
|
4147
|
-
function verb(n) {
|
|
4148
|
-
i[n] = o[n] && function(v) {
|
|
4149
|
-
return new Promise(function(resolve, reject) {
|
|
4150
|
-
v = o[n](v), settle(resolve, reject, v.done, v.value);
|
|
4151
|
-
});
|
|
4152
|
-
};
|
|
4153
|
-
}
|
|
4154
|
-
function settle(resolve, reject, d, v) {
|
|
4155
|
-
Promise.resolve(v).then(function(v) {
|
|
4156
|
-
resolve({
|
|
4157
|
-
value: v,
|
|
4158
|
-
done: d
|
|
4159
|
-
});
|
|
4160
|
-
}, reject);
|
|
4161
|
-
}
|
|
4162
|
-
};
|
|
4163
|
-
var __rest = exports && exports.__rest || function(s, e) {
|
|
4164
|
-
var t = {};
|
|
4165
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
4166
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function") {
|
|
4167
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
4168
|
-
}
|
|
4169
|
-
return t;
|
|
4170
|
-
};
|
|
4171
|
-
var __importDefault = exports && exports.__importDefault || function(mod) {
|
|
4172
|
-
return mod && mod.__esModule ? mod : { "default": mod };
|
|
4173
|
-
};
|
|
4174
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4175
|
-
exports.WebClient = exports.WebClientEvent = void 0;
|
|
4176
|
-
exports.buildThreadTsWarningMessage = buildThreadTsWarningMessage;
|
|
4177
|
-
var node_path_1 = __require("node:path");
|
|
4178
|
-
var node_querystring_1 = __require("node:querystring");
|
|
4179
|
-
var node_util_1 = __require("node:util");
|
|
4180
|
-
var node_zlib_1 = __importDefault(__require("node:zlib"));
|
|
4181
|
-
var axios_1 = __importDefault(__require("axios"));
|
|
4182
|
-
var form_data_1 = __importDefault(require_browser());
|
|
4183
|
-
var is_electron_1 = __importDefault(require_is_electron());
|
|
4184
|
-
var is_stream_1 = __importDefault(require_is_stream());
|
|
4185
|
-
var p_queue_1 = __importDefault(require_dist$2());
|
|
4186
|
-
var p_retry_1 = __importStar(require_p_retry());
|
|
4187
|
-
var chat_stream_1 = require_chat_stream();
|
|
4188
|
-
var errors_1 = require_errors();
|
|
4189
|
-
var file_upload_1 = require_file_upload();
|
|
4190
|
-
var helpers_1 = __importDefault(require_helpers());
|
|
4191
|
-
var instrument_1 = require_instrument();
|
|
4192
|
-
var logger_1 = require_logger();
|
|
4193
|
-
var methods_1 = require_methods();
|
|
4194
|
-
var retry_policies_1 = require_retry_policies();
|
|
4195
|
-
var axiosHeaderPropsToIgnore = [
|
|
4196
|
-
"delete",
|
|
4197
|
-
"common",
|
|
4198
|
-
"get",
|
|
4199
|
-
"put",
|
|
4200
|
-
"head",
|
|
4201
|
-
"post",
|
|
4202
|
-
"link",
|
|
4203
|
-
"patch",
|
|
4204
|
-
"purge",
|
|
4205
|
-
"unlink",
|
|
4206
|
-
"options"
|
|
4207
|
-
];
|
|
4208
|
-
var defaultFilename = "Untitled";
|
|
4209
|
-
var defaultPageSize = 200;
|
|
4210
|
-
var noopPageReducer = () => void 0;
|
|
4211
|
-
var WebClientEvent;
|
|
4212
|
-
(function(WebClientEvent) {
|
|
4213
|
-
WebClientEvent["RATE_LIMITED"] = "rate_limited";
|
|
4214
|
-
})(WebClientEvent || (exports.WebClientEvent = WebClientEvent = {}));
|
|
4215
|
-
/**
|
|
4216
|
-
* A client for Slack's Web API
|
|
4217
|
-
*
|
|
4218
|
-
* This client provides an alias for each {@link https://docs.slack.dev/reference/methods|Web API method}. Each method is
|
|
4219
|
-
* a convenience wrapper for calling the {@link WebClient#apiCall} method using the method name as the first parameter.
|
|
4220
|
-
*/
|
|
4221
|
-
var WebClient = class WebClient extends methods_1.Methods {
|
|
4222
|
-
/**
|
|
4223
|
-
* @param token - An API token to authenticate/authorize with Slack (usually start with `xoxp`, `xoxb`)
|
|
4224
|
-
* @param {Object} [webClientOptions] - Configuration options.
|
|
4225
|
-
* @param {Function} [webClientOptions.requestInterceptor] - An interceptor to mutate outgoing requests. See {@link https://axios-http.com/docs/interceptors Axios interceptors}
|
|
4226
|
-
* @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}
|
|
4227
|
-
*/
|
|
4228
|
-
constructor(token, { slackApiUrl = "https://slack.com/api/", logger = void 0, logLevel = void 0, maxRequestConcurrency = 100, retryConfig = retry_policies_1.tenRetriesInAboutThirtyMinutes, agent = void 0, tls = void 0, timeout = 0, rejectRateLimitedCalls = false, headers = {}, teamId = void 0, allowAbsoluteUrls = true, attachOriginalToWebAPIRequestError = true, requestInterceptor = void 0, adapter = void 0 } = {}) {
|
|
4229
|
-
super();
|
|
4230
|
-
this.token = token;
|
|
4231
|
-
this.slackApiUrl = slackApiUrl;
|
|
4232
|
-
if (!this.slackApiUrl.endsWith("/")) this.slackApiUrl += "/";
|
|
4233
|
-
this.retryConfig = retryConfig;
|
|
4234
|
-
this.requestQueue = new p_queue_1.default({ concurrency: maxRequestConcurrency });
|
|
4235
|
-
this.tlsConfig = tls !== void 0 ? tls : {};
|
|
4236
|
-
this.rejectRateLimitedCalls = rejectRateLimitedCalls;
|
|
4237
|
-
this.teamId = teamId;
|
|
4238
|
-
this.allowAbsoluteUrls = allowAbsoluteUrls;
|
|
4239
|
-
this.attachOriginalToWebAPIRequestError = attachOriginalToWebAPIRequestError;
|
|
4240
|
-
if (typeof logger !== "undefined") {
|
|
4241
|
-
this.logger = logger;
|
|
4242
|
-
if (typeof logLevel !== "undefined") this.logger.debug("The logLevel given to WebClient was ignored as you also gave logger");
|
|
4243
|
-
} else this.logger = (0, logger_1.getLogger)(WebClient.loggerName, logLevel !== null && logLevel !== void 0 ? logLevel : logger_1.LogLevel.INFO, logger);
|
|
4244
|
-
if (this.token && !headers.Authorization) headers.Authorization = `Bearer ${this.token}`;
|
|
4245
|
-
this.axios = axios_1.default.create({
|
|
4246
|
-
adapter: adapter ? (config) => adapter(Object.assign(Object.assign({}, config), { adapter: void 0 })) : void 0,
|
|
4247
|
-
timeout,
|
|
4248
|
-
baseURL: this.slackApiUrl,
|
|
4249
|
-
headers: (0, is_electron_1.default)() ? headers : Object.assign({ "User-Agent": (0, instrument_1.getUserAgent)() }, headers),
|
|
4250
|
-
httpAgent: agent,
|
|
4251
|
-
httpsAgent: agent,
|
|
4252
|
-
validateStatus: () => true,
|
|
4253
|
-
maxRedirects: 0,
|
|
4254
|
-
proxy: false
|
|
4255
|
-
});
|
|
4256
|
-
this.axios.defaults.headers.post["Content-Type"] = void 0;
|
|
4257
|
-
if (requestInterceptor) this.axios.interceptors.request.use(requestInterceptor, null);
|
|
4258
|
-
this.axios.interceptors.request.use(this.serializeApiCallData.bind(this), null);
|
|
4259
|
-
this.logger.debug("initialized");
|
|
4260
|
-
}
|
|
4261
|
-
/**
|
|
4262
|
-
* Generic method for calling a Web API method
|
|
4263
|
-
* @param method - the Web API method to call {@link https://docs.slack.dev/reference/methods}
|
|
4264
|
-
* @param options - options
|
|
4265
|
-
*/
|
|
4266
|
-
async apiCall(method, options = {}) {
|
|
4267
|
-
this.logger.debug(`apiCall('${method}') start`);
|
|
4268
|
-
warnDeprecations(method, this.logger);
|
|
4269
|
-
warnIfFallbackIsMissing(method, this.logger, options);
|
|
4270
|
-
warnIfThreadTsIsNotString(method, this.logger, options);
|
|
4271
|
-
if (typeof options === "string" || typeof options === "number" || typeof options === "boolean") throw new TypeError(`Expected an options argument but instead received a ${typeof options}`);
|
|
4272
|
-
(0, file_upload_1.warnIfNotUsingFilesUploadV2)(method, this.logger);
|
|
4273
|
-
if (method === "files.uploadV2") return this.filesUploadV2(options);
|
|
4274
|
-
const headers = {};
|
|
4275
|
-
if (options.token) headers.Authorization = `Bearer ${options.token}`;
|
|
4276
|
-
const url = this.deriveRequestUrl(method);
|
|
4277
|
-
const response = await this.makeRequest(url, Object.assign({ team_id: this.teamId }, options), headers);
|
|
4278
|
-
const result = await this.buildResult(response);
|
|
4279
|
-
this.logger.debug(`http request result: ${JSON.stringify(result)}`);
|
|
4280
|
-
if (result.response_metadata !== void 0 && result.response_metadata.warnings !== void 0) result.response_metadata.warnings.forEach(this.logger.warn.bind(this.logger));
|
|
4281
|
-
if (result.response_metadata !== void 0 && result.response_metadata.messages !== void 0) for (const msg of result.response_metadata.messages) {
|
|
4282
|
-
const errReg = /\[ERROR\](.*)/;
|
|
4283
|
-
const warnReg = /\[WARN\](.*)/;
|
|
4284
|
-
if (errReg.test(msg)) {
|
|
4285
|
-
const errMatch = msg.match(errReg);
|
|
4286
|
-
if (errMatch != null) this.logger.error(errMatch[1].trim());
|
|
4287
|
-
} else if (warnReg.test(msg)) {
|
|
4288
|
-
const warnMatch = msg.match(warnReg);
|
|
4289
|
-
if (warnMatch != null) this.logger.warn(warnMatch[1].trim());
|
|
4290
|
-
}
|
|
4291
|
-
}
|
|
4292
|
-
if (!result.ok && response.headers["content-type"] !== "application/gzip") throw (0, errors_1.platformErrorFromResult)(result);
|
|
4293
|
-
if ("ok" in result && result.ok === false) throw (0, errors_1.platformErrorFromResult)(result);
|
|
4294
|
-
this.logger.debug(`apiCall('${method}') end`);
|
|
4295
|
-
return result;
|
|
4296
|
-
}
|
|
4297
|
-
paginate(method, options, shouldStop, reduce) {
|
|
4298
|
-
const pageSize = (() => {
|
|
4299
|
-
if (options !== void 0 && typeof options.limit === "number") {
|
|
4300
|
-
const { limit } = options;
|
|
4301
|
-
options.limit = void 0;
|
|
4302
|
-
return limit;
|
|
4303
|
-
}
|
|
4304
|
-
return defaultPageSize;
|
|
4305
|
-
})();
|
|
4306
|
-
function generatePages() {
|
|
4307
|
-
return __asyncGenerator(this, arguments, function* generatePages_1() {
|
|
4308
|
-
let result;
|
|
4309
|
-
let paginationOptions = { limit: pageSize };
|
|
4310
|
-
if (options !== void 0 && options.cursor !== void 0) paginationOptions.cursor = options.cursor;
|
|
4311
|
-
while (result === void 0 || paginationOptions !== void 0) {
|
|
4312
|
-
result = yield __await(this.apiCall(method, Object.assign(options !== void 0 ? options : {}, paginationOptions)));
|
|
4313
|
-
yield yield __await(result);
|
|
4314
|
-
paginationOptions = paginationOptionsForNextPage(result, pageSize);
|
|
4315
|
-
}
|
|
4316
|
-
});
|
|
4317
|
-
}
|
|
4318
|
-
if (shouldStop === void 0) return generatePages.call(this);
|
|
4319
|
-
const pageReducer = reduce !== void 0 ? reduce : noopPageReducer;
|
|
4320
|
-
let index = 0;
|
|
4321
|
-
return (async () => {
|
|
4322
|
-
var _a, e_1, _b, _c;
|
|
4323
|
-
const pageIterator = generatePages.call(this);
|
|
4324
|
-
const firstPage = (await pageIterator.next(void 0)).value;
|
|
4325
|
-
let accumulator = pageReducer(void 0, firstPage, index);
|
|
4326
|
-
index += 1;
|
|
4327
|
-
if (shouldStop(firstPage)) return accumulator;
|
|
4328
|
-
try {
|
|
4329
|
-
for (var _d = true, pageIterator_1 = __asyncValues(pageIterator), pageIterator_1_1; pageIterator_1_1 = await pageIterator_1.next(), _a = pageIterator_1_1.done, !_a; _d = true) {
|
|
4330
|
-
_c = pageIterator_1_1.value;
|
|
4331
|
-
_d = false;
|
|
4332
|
-
const page = _c;
|
|
4333
|
-
accumulator = pageReducer(accumulator, page, index);
|
|
4334
|
-
if (shouldStop(page)) return accumulator;
|
|
4335
|
-
index += 1;
|
|
4336
|
-
}
|
|
4337
|
-
} catch (e_1_1) {
|
|
4338
|
-
e_1 = { error: e_1_1 };
|
|
4339
|
-
} finally {
|
|
4340
|
-
try {
|
|
4341
|
-
if (!_d && !_a && (_b = pageIterator_1.return)) await _b.call(pageIterator_1);
|
|
4342
|
-
} finally {
|
|
4343
|
-
if (e_1) throw e_1.error;
|
|
4344
|
-
}
|
|
4345
|
-
}
|
|
4346
|
-
return accumulator;
|
|
4347
|
-
})();
|
|
4348
|
-
}
|
|
4349
|
-
/**
|
|
4350
|
-
* Stream markdown text into a conversation.
|
|
4351
|
-
*
|
|
4352
|
-
* @description The "chatStream" method starts a new chat stream in a conversation that can be appended to. After appending an entire message, the stream can be stopped with concluding arguments such as "blocks" for gathering feedback.
|
|
4353
|
-
*
|
|
4354
|
-
* The "markdown_text" content is appended to a buffer before being sent to the recipient, with a default buffer size of "256" characters. Setting the "buffer_size" value to a smaller number sends more frequent updates for the same amount of characters, but might reach rate limits more often.
|
|
4355
|
-
*
|
|
4356
|
-
* @example
|
|
4357
|
-
* const streamer = client.chatStream({
|
|
4358
|
-
* channel: "C0123456789",
|
|
4359
|
-
* thread_ts: "1700000001.123456",
|
|
4360
|
-
* recipient_team_id: "T0123456789",
|
|
4361
|
-
* recipient_user_id: "U0123456789",
|
|
4362
|
-
* });
|
|
4363
|
-
* await streamer.append({
|
|
4364
|
-
* markdown_text: "**hello wo",
|
|
4365
|
-
* });
|
|
4366
|
-
* await streamer.append({
|
|
4367
|
-
* markdown_text: "rld!**",
|
|
4368
|
-
* });
|
|
4369
|
-
* await streamer.stop();
|
|
4370
|
-
*
|
|
4371
|
-
* @see {@link https://docs.slack.dev/reference/methods/chat.startStream}
|
|
4372
|
-
* @see {@link https://docs.slack.dev/reference/methods/chat.appendStream}
|
|
4373
|
-
* @see {@link https://docs.slack.dev/reference/methods/chat.stopStream}
|
|
4374
|
-
*/
|
|
4375
|
-
chatStream(params) {
|
|
4376
|
-
const { buffer_size } = params, args = __rest(params, ["buffer_size"]);
|
|
4377
|
-
const options = { buffer_size };
|
|
4378
|
-
return new chat_stream_1.ChatStreamer(this, this.logger, args, options);
|
|
4379
|
-
}
|
|
4380
|
-
/**
|
|
4381
|
-
* This wrapper method provides an easy way to upload files using the following endpoints:
|
|
4382
|
-
*
|
|
4383
|
-
* **#1**: For each file submitted with this method, submit filenames
|
|
4384
|
-
* and file metadata to {@link https://docs.slack.dev/reference/methods/files.getuploadurlexternal files.getUploadURLExternal} to request a URL to
|
|
4385
|
-
* which to send the file data to and an id for the file
|
|
4386
|
-
*
|
|
4387
|
-
* **#2**: for each returned file `upload_url`, upload corresponding file to
|
|
4388
|
-
* URLs returned from step 1 (e.g. https://files.slack.com/upload/v1/...\")
|
|
4389
|
-
*
|
|
4390
|
-
* **#3**: Complete uploads {@link https://docs.slack.dev/reference/methods/files.completeuploadexternal files.completeUploadExternal}
|
|
4391
|
-
* @param options
|
|
4392
|
-
*/
|
|
4393
|
-
async filesUploadV2(options) {
|
|
4394
|
-
this.logger.debug("files.uploadV2() start");
|
|
4395
|
-
const fileUploads = await this.getAllFileUploads(options);
|
|
4396
|
-
(await this.fetchAllUploadURLExternal(fileUploads)).forEach((res, idx) => {
|
|
4397
|
-
fileUploads[idx].upload_url = res.upload_url;
|
|
4398
|
-
fileUploads[idx].file_id = res.file_id;
|
|
4399
|
-
});
|
|
4400
|
-
await this.postFileUploadsToExternalURL(fileUploads, options);
|
|
4401
|
-
return {
|
|
4402
|
-
ok: true,
|
|
4403
|
-
files: await this.completeFileUploads(fileUploads)
|
|
4404
|
-
};
|
|
4405
|
-
}
|
|
4406
|
-
/**
|
|
4407
|
-
* For each file submitted with this method, submits filenames
|
|
4408
|
-
* and file metadata to files.getUploadURLExternal to request a URL to
|
|
4409
|
-
* which to send the file data to and an id for the file
|
|
4410
|
-
* @param fileUploads
|
|
4411
|
-
*/
|
|
4412
|
-
async fetchAllUploadURLExternal(fileUploads) {
|
|
4413
|
-
return Promise.all(fileUploads.map((upload) => {
|
|
4414
|
-
const options = {
|
|
4415
|
-
filename: upload.filename,
|
|
4416
|
-
length: upload.length,
|
|
4417
|
-
alt_text: upload.alt_text,
|
|
4418
|
-
snippet_type: upload.snippet_type
|
|
4419
|
-
};
|
|
4420
|
-
if ("token" in upload) options.token = upload.token;
|
|
4421
|
-
return this.files.getUploadURLExternal(options);
|
|
4422
|
-
}));
|
|
4423
|
-
}
|
|
4424
|
-
/**
|
|
4425
|
-
* Complete uploads.
|
|
4426
|
-
* @param fileUploads
|
|
4427
|
-
* @returns
|
|
4428
|
-
*/
|
|
4429
|
-
async completeFileUploads(fileUploads) {
|
|
4430
|
-
const toComplete = Object.values((0, file_upload_1.getAllFileUploadsToComplete)(fileUploads));
|
|
4431
|
-
return Promise.all(toComplete.map((job) => this.files.completeUploadExternal(job)));
|
|
4432
|
-
}
|
|
4433
|
-
/**
|
|
4434
|
-
* for each returned file upload URL, upload corresponding file
|
|
4435
|
-
* @param fileUploads
|
|
4436
|
-
* @returns
|
|
4437
|
-
*/
|
|
4438
|
-
async postFileUploadsToExternalURL(fileUploads, options) {
|
|
4439
|
-
return Promise.all(fileUploads.map(async (upload) => {
|
|
4440
|
-
const { upload_url, file_id, filename, data } = upload;
|
|
4441
|
-
const body = data;
|
|
4442
|
-
if (upload_url) {
|
|
4443
|
-
const headers = {};
|
|
4444
|
-
if (options.token) headers.Authorization = `Bearer ${options.token}`;
|
|
4445
|
-
const uploadRes = await this.makeRequest(upload_url, { body }, headers);
|
|
4446
|
-
if (uploadRes.status !== 200) return Promise.reject(Error(`Failed to upload file (id:${file_id}, filename: ${filename})`));
|
|
4447
|
-
const returnData = {
|
|
4448
|
-
ok: true,
|
|
4449
|
-
body: uploadRes.data
|
|
4450
|
-
};
|
|
4451
|
-
return Promise.resolve(returnData);
|
|
4452
|
-
}
|
|
4453
|
-
return Promise.reject(Error(`No upload url found for file (id: ${file_id}, filename: ${filename}`));
|
|
4454
|
-
}));
|
|
4455
|
-
}
|
|
4456
|
-
/**
|
|
4457
|
-
* @param options All file uploads arguments
|
|
4458
|
-
* @returns An array of file upload entries
|
|
4459
|
-
*/
|
|
4460
|
-
async getAllFileUploads(options) {
|
|
4461
|
-
let fileUploads = [];
|
|
4462
|
-
if ("file" in options || "content" in options) fileUploads.push(await (0, file_upload_1.getFileUploadJob)(options, this.logger));
|
|
4463
|
-
if ("file_uploads" in options) fileUploads = fileUploads.concat(await (0, file_upload_1.getMultipleFileUploadJobs)(options, this.logger));
|
|
4464
|
-
return fileUploads;
|
|
4465
|
-
}
|
|
4466
|
-
/**
|
|
4467
|
-
* Low-level function to make a single API request. handles queuing, retries, and http-level errors
|
|
4468
|
-
*/
|
|
4469
|
-
async makeRequest(url, body, headers = {}) {
|
|
4470
|
-
const task = () => this.requestQueue.add(async () => {
|
|
4471
|
-
try {
|
|
4472
|
-
const config = Object.assign({ headers }, this.tlsConfig);
|
|
4473
|
-
if (url.endsWith("admin.analytics.getFile")) config.responseType = "arraybuffer";
|
|
4474
|
-
if (url.endsWith("apps.event.authorizations.list")) body.token = void 0;
|
|
4475
|
-
this.logger.debug(`http request url: ${url}`);
|
|
4476
|
-
this.logger.debug(`http request body: ${JSON.stringify(redact(body))}`);
|
|
4477
|
-
let allHeaders = Object.keys(this.axios.defaults.headers).reduce((acc, cur) => {
|
|
4478
|
-
if (!axiosHeaderPropsToIgnore.includes(cur)) acc[cur] = this.axios.defaults.headers[cur];
|
|
4479
|
-
return acc;
|
|
4480
|
-
}, {});
|
|
4481
|
-
allHeaders = Object.assign(Object.assign(Object.assign({}, this.axios.defaults.headers.common), allHeaders), headers);
|
|
4482
|
-
this.logger.debug(`http request headers: ${JSON.stringify(redact(allHeaders))}`);
|
|
4483
|
-
const response = await this.axios.post(url, body, config);
|
|
4484
|
-
this.logger.debug("http response received");
|
|
4485
|
-
if (response.status === 429) {
|
|
4486
|
-
const retrySec = parseRetryHeaders(response);
|
|
4487
|
-
if (retrySec !== void 0) {
|
|
4488
|
-
this.emit(WebClientEvent.RATE_LIMITED, retrySec, {
|
|
4489
|
-
url,
|
|
4490
|
-
body
|
|
4491
|
-
});
|
|
4492
|
-
if (this.rejectRateLimitedCalls) throw new p_retry_1.AbortError((0, errors_1.rateLimitedErrorWithDelay)(retrySec));
|
|
4493
|
-
this.logger.info(`API Call failed due to rate limiting. Will retry in ${retrySec} seconds.`);
|
|
4494
|
-
this.requestQueue.pause();
|
|
4495
|
-
await (0, helpers_1.default)(retrySec * 1e3);
|
|
4496
|
-
this.requestQueue.start();
|
|
4497
|
-
throw new Error(`A rate limit was exceeded (url: ${url}, retry-after: ${retrySec})`);
|
|
4498
|
-
}
|
|
4499
|
-
throw new p_retry_1.AbortError(/* @__PURE__ */ new Error(`Retry header did not contain a valid timeout (url: ${url}, retry-after header: ${response.headers["retry-after"]})`));
|
|
4500
|
-
}
|
|
4501
|
-
if (response.status !== 200) throw (0, errors_1.httpErrorFromResponse)(response);
|
|
4502
|
-
return response;
|
|
4503
|
-
} catch (error) {
|
|
4504
|
-
const e = error;
|
|
4505
|
-
this.logger.warn("http request failed", e.message);
|
|
4506
|
-
if (e.request) throw (0, errors_1.requestErrorWithOriginal)(e, this.attachOriginalToWebAPIRequestError);
|
|
4507
|
-
throw error;
|
|
4508
|
-
}
|
|
4509
|
-
});
|
|
4510
|
-
return (0, p_retry_1.default)(task, this.retryConfig);
|
|
4511
|
-
}
|
|
4512
|
-
/**
|
|
4513
|
-
* Get the complete request URL for the provided URL.
|
|
4514
|
-
* @param url - The resource to POST to. Either a Slack API method or absolute URL.
|
|
4515
|
-
*/
|
|
4516
|
-
deriveRequestUrl(url) {
|
|
4517
|
-
if ((url.startsWith("https://") || url.startsWith("http://")) && this.allowAbsoluteUrls) return url;
|
|
4518
|
-
return `${this.axios.getUri() + url}`;
|
|
4519
|
-
}
|
|
4520
|
-
/**
|
|
4521
|
-
* Transforms options (a simple key-value object) into an acceptable value for a body. This can be either
|
|
4522
|
-
* a string, used when posting with a content-type of url-encoded. Or, it can be a readable stream, used
|
|
4523
|
-
* when the options contain a binary (a stream or a buffer) and the upload should be done with content-type
|
|
4524
|
-
* multipart/form-data.
|
|
4525
|
-
* @param config - The Axios request configuration object
|
|
4526
|
-
*/
|
|
4527
|
-
serializeApiCallData(config) {
|
|
4528
|
-
const { data, headers } = config;
|
|
4529
|
-
let containsBinaryData = false;
|
|
4530
|
-
const flattened = Object.entries(data).map(([key, value]) => {
|
|
4531
|
-
if (value === void 0 || value === null) return [];
|
|
4532
|
-
let serializedValue = value;
|
|
4533
|
-
if (Buffer.isBuffer(value) || (0, is_stream_1.default)(value)) containsBinaryData = true;
|
|
4534
|
-
else if (typeof value !== "string" && typeof value !== "number" && typeof value !== "boolean") serializedValue = JSON.stringify(value);
|
|
4535
|
-
return [key, serializedValue];
|
|
4536
|
-
});
|
|
4537
|
-
if (containsBinaryData) {
|
|
4538
|
-
this.logger.debug("Request arguments contain binary data");
|
|
4539
|
-
const form = flattened.reduce((frm, [key, value]) => {
|
|
4540
|
-
if (Buffer.isBuffer(value) || (0, is_stream_1.default)(value)) {
|
|
4541
|
-
const opts = {};
|
|
4542
|
-
opts.filename = (() => {
|
|
4543
|
-
const streamOrBuffer = value;
|
|
4544
|
-
if (typeof streamOrBuffer.name === "string") return (0, node_path_1.basename)(streamOrBuffer.name);
|
|
4545
|
-
if (typeof streamOrBuffer.path === "string") return (0, node_path_1.basename)(streamOrBuffer.path);
|
|
4546
|
-
return defaultFilename;
|
|
4547
|
-
})();
|
|
4548
|
-
frm.append(key, value, opts);
|
|
4549
|
-
} else if (key !== void 0 && value !== void 0) frm.append(key, value);
|
|
4550
|
-
return frm;
|
|
4551
|
-
}, new form_data_1.default());
|
|
4552
|
-
if (headers) for (const [header, value] of Object.entries(form.getHeaders())) headers[header] = value;
|
|
4553
|
-
config.data = form;
|
|
4554
|
-
config.headers = headers;
|
|
4555
|
-
return config;
|
|
4556
|
-
}
|
|
4557
|
-
if (headers) headers["Content-Type"] = "application/x-www-form-urlencoded";
|
|
4558
|
-
config.data = (0, node_querystring_1.stringify)(flattened.reduce((accumulator, [key, value]) => {
|
|
4559
|
-
if (key !== void 0 && value !== void 0) accumulator[key] = value;
|
|
4560
|
-
return accumulator;
|
|
4561
|
-
}, {}));
|
|
4562
|
-
config.headers = headers;
|
|
4563
|
-
return config;
|
|
4564
|
-
}
|
|
4565
|
-
/**
|
|
4566
|
-
* Processes an HTTP response into a WebAPICallResult by performing JSON parsing on the body and merging relevant
|
|
4567
|
-
* HTTP headers into the object.
|
|
4568
|
-
* @param response - an http response
|
|
4569
|
-
*/
|
|
4570
|
-
async buildResult(response) {
|
|
4571
|
-
let { data } = response;
|
|
4572
|
-
const isGzipResponse = response.headers["content-type"] === "application/gzip";
|
|
4573
|
-
if (isGzipResponse) try {
|
|
4574
|
-
const unzippedData = await new Promise((resolve, reject) => {
|
|
4575
|
-
node_zlib_1.default.unzip(data, (err, buf) => {
|
|
4576
|
-
if (err) return reject(err);
|
|
4577
|
-
return resolve(buf.toString().split("\n"));
|
|
4578
|
-
});
|
|
4579
|
-
}).then((res) => res).catch((err) => {
|
|
4580
|
-
throw err;
|
|
4581
|
-
});
|
|
4582
|
-
const fileData = [];
|
|
4583
|
-
if (Array.isArray(unzippedData)) {
|
|
4584
|
-
for (const dataset of unzippedData) if (dataset && dataset.length > 0) fileData.push(JSON.parse(dataset));
|
|
4585
|
-
}
|
|
4586
|
-
data = { file_data: fileData };
|
|
4587
|
-
} catch (err) {
|
|
4588
|
-
data = {
|
|
4589
|
-
ok: false,
|
|
4590
|
-
error: err
|
|
4591
|
-
};
|
|
4592
|
-
}
|
|
4593
|
-
else if (!isGzipResponse && response.request.path === "/api/admin.analytics.getFile") data = JSON.parse(new node_util_1.TextDecoder().decode(data));
|
|
4594
|
-
if (typeof data === "string") try {
|
|
4595
|
-
data = JSON.parse(data);
|
|
4596
|
-
} catch (_) {
|
|
4597
|
-
data = {
|
|
4598
|
-
ok: false,
|
|
4599
|
-
error: data
|
|
4600
|
-
};
|
|
4601
|
-
}
|
|
4602
|
-
if (data.response_metadata === void 0) data.response_metadata = {};
|
|
4603
|
-
if (response.headers["x-oauth-scopes"] !== void 0) data.response_metadata.scopes = response.headers["x-oauth-scopes"].trim().split(/\s*,\s*/);
|
|
4604
|
-
if (response.headers["x-accepted-oauth-scopes"] !== void 0) data.response_metadata.acceptedScopes = response.headers["x-accepted-oauth-scopes"].trim().split(/\s*,\s*/);
|
|
4605
|
-
const retrySec = parseRetryHeaders(response);
|
|
4606
|
-
if (retrySec !== void 0) data.response_metadata.retryAfter = retrySec;
|
|
4607
|
-
return data;
|
|
4608
|
-
}
|
|
4609
|
-
};
|
|
4610
|
-
exports.WebClient = WebClient;
|
|
4611
|
-
/**
|
|
4612
|
-
* The name used to prefix all logging generated from this object
|
|
4613
|
-
*/
|
|
4614
|
-
WebClient.loggerName = "WebClient";
|
|
4615
|
-
exports.default = WebClient;
|
|
4616
|
-
/**
|
|
4617
|
-
* Determines an appropriate set of cursor pagination options for the next request to a paginated API method.
|
|
4618
|
-
* @param previousResult - the result of the last request, where the next cursor might be found.
|
|
4619
|
-
* @param pageSize - the maximum number of additional items to fetch in the next request.
|
|
4620
|
-
*/
|
|
4621
|
-
function paginationOptionsForNextPage(previousResult, pageSize) {
|
|
4622
|
-
if (previousResult !== void 0 && previousResult.response_metadata !== void 0 && previousResult.response_metadata.next_cursor !== void 0 && previousResult.response_metadata.next_cursor !== "") return {
|
|
4623
|
-
limit: pageSize,
|
|
4624
|
-
cursor: previousResult.response_metadata.next_cursor
|
|
4625
|
-
};
|
|
4626
|
-
}
|
|
4627
|
-
/**
|
|
4628
|
-
* Extract the amount of time (in seconds) the platform has recommended this client wait before sending another request
|
|
4629
|
-
* from a rate-limited HTTP response (statusCode = 429).
|
|
4630
|
-
*/
|
|
4631
|
-
function parseRetryHeaders(response) {
|
|
4632
|
-
if (response.headers["retry-after"] !== void 0) {
|
|
4633
|
-
const retryAfter = Number.parseInt(response.headers["retry-after"], 10);
|
|
4634
|
-
if (!Number.isNaN(retryAfter)) return retryAfter;
|
|
4635
|
-
}
|
|
4636
|
-
}
|
|
4637
|
-
/**
|
|
4638
|
-
* Log a warning when using a deprecated method
|
|
4639
|
-
* @param method api method being called
|
|
4640
|
-
* @param logger instance of web clients logger
|
|
4641
|
-
*/
|
|
4642
|
-
function warnDeprecations(method, logger) {
|
|
4643
|
-
if ([
|
|
4644
|
-
"workflows.stepCompleted",
|
|
4645
|
-
"workflows.stepFailed",
|
|
4646
|
-
"workflows.updateStep"
|
|
4647
|
-
].some((depMethod) => {
|
|
4648
|
-
return new RegExp(`^${depMethod}`).test(method);
|
|
4649
|
-
})) logger.warn(`${method} is deprecated. Please check on https://docs.slack.dev/reference/methods for an alternative.`);
|
|
4650
|
-
}
|
|
4651
|
-
/**
|
|
4652
|
-
* Log a warning when using chat.postMessage without text argument or attachments with fallback argument
|
|
4653
|
-
* @param method api method being called
|
|
4654
|
-
* @param logger instance of we clients logger
|
|
4655
|
-
* @param options arguments for the Web API method
|
|
4656
|
-
*/
|
|
4657
|
-
function warnIfFallbackIsMissing(method, logger, options) {
|
|
4658
|
-
const isTargetMethod = [
|
|
4659
|
-
"chat.postEphemeral",
|
|
4660
|
-
"chat.postMessage",
|
|
4661
|
-
"chat.scheduleMessage"
|
|
4662
|
-
].includes(method);
|
|
4663
|
-
const hasAttachments = (args) => Array.isArray(args.attachments) && args.attachments.length;
|
|
4664
|
-
const missingAttachmentFallbackDetected = (args) => Array.isArray(args.attachments) && args.attachments.some((attachment) => !attachment.fallback || attachment.fallback.trim() === "");
|
|
4665
|
-
const isEmptyText = (args) => (args.text === void 0 || args.text === null || args.text === "") && (args.markdown_text === void 0 || args.markdown === null || args.markdown_text === "");
|
|
4666
|
-
const buildMissingTextWarning = () => `The top-level \`text\` argument is missing in the request payload for a ${method} call - It's a best practice to always provide a \`text\` argument when posting a message. The \`text\` is used in places where the content cannot be rendered such as: system push notifications, assistive technology such as screen readers, etc.`;
|
|
4667
|
-
const buildMissingFallbackWarning = () => `Additionally, the attachment-level \`fallback\` argument is missing in the request payload for a ${method} call - To avoid this warning, it is recommended to always provide a top-level \`text\` argument when posting a message. Alternatively, you can provide an attachment-level \`fallback\` argument, though this is now considered a legacy field (see https://docs.slack.dev/legacy/legacy-messaging/legacy-secondary-message-attachments for more details).`;
|
|
4668
|
-
if (isTargetMethod && typeof options === "object") {
|
|
4669
|
-
if (hasAttachments(options)) {
|
|
4670
|
-
if (missingAttachmentFallbackDetected(options) && isEmptyText(options)) {
|
|
4671
|
-
logger.warn(buildMissingTextWarning());
|
|
4672
|
-
logger.warn(buildMissingFallbackWarning());
|
|
4673
|
-
}
|
|
4674
|
-
} else if (isEmptyText(options)) logger.warn(buildMissingTextWarning());
|
|
4675
|
-
}
|
|
4676
|
-
}
|
|
4677
|
-
/**
|
|
4678
|
-
* Log a warning when thread_ts is not a string
|
|
4679
|
-
* @param method api method being called
|
|
4680
|
-
* @param logger instance of web clients logger
|
|
4681
|
-
* @param options arguments for the Web API method
|
|
4682
|
-
*/
|
|
4683
|
-
function warnIfThreadTsIsNotString(method, logger, options) {
|
|
4684
|
-
if ([
|
|
4685
|
-
"chat.postEphemeral",
|
|
4686
|
-
"chat.postMessage",
|
|
4687
|
-
"chat.scheduleMessage",
|
|
4688
|
-
"files.upload"
|
|
4689
|
-
].includes(method) && (options === null || options === void 0 ? void 0 : options.thread_ts) !== void 0 && typeof (options === null || options === void 0 ? void 0 : options.thread_ts) !== "string") logger.warn(buildThreadTsWarningMessage(method));
|
|
4690
|
-
}
|
|
4691
|
-
function buildThreadTsWarningMessage(method) {
|
|
4692
|
-
return `The given thread_ts value in the request payload for a ${method} call is a float value. We highly recommend using a string value instead.`;
|
|
4693
|
-
}
|
|
4694
|
-
/**
|
|
4695
|
-
* Takes an object and redacts specific items
|
|
4696
|
-
* @param body
|
|
4697
|
-
* @returns
|
|
4698
|
-
*/
|
|
4699
|
-
function redact(body) {
|
|
4700
|
-
return Object.entries(body).map(([key, value]) => {
|
|
4701
|
-
if (value === void 0 || value === null) return [];
|
|
4702
|
-
let serializedValue = value;
|
|
4703
|
-
if (key.match(/.*token.*/) !== null || key.match(/[Aa]uthorization/)) serializedValue = "[[REDACTED]]";
|
|
4704
|
-
if (Buffer.isBuffer(value) || (0, is_stream_1.default)(value)) serializedValue = "[[BINARY VALUE OMITTED]]";
|
|
4705
|
-
else if (typeof value !== "string" && typeof value !== "number" && typeof value !== "boolean") serializedValue = JSON.stringify(value);
|
|
4706
|
-
return [key, serializedValue];
|
|
4707
|
-
}).reduce((accumulator, [key, value]) => {
|
|
4708
|
-
if (key !== void 0 && value !== void 0) accumulator[key] = value;
|
|
4709
|
-
return accumulator;
|
|
4710
|
-
}, {});
|
|
4711
|
-
}
|
|
4712
|
-
}));
|
|
4713
|
-
//#endregion
|
|
4714
|
-
//#region ../../node_modules/.pnpm/@slack+web-api@7.15.1_debug@4.4.3_supports-color@8.1.1_/node_modules/@slack/web-api/dist/index.js
|
|
4715
|
-
var require_dist = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
4716
|
-
var __createBinding = exports && exports.__createBinding || (Object.create ? (function(o, m, k, k2) {
|
|
4717
|
-
if (k2 === void 0) k2 = k;
|
|
4718
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
4719
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) desc = {
|
|
4720
|
-
enumerable: true,
|
|
4721
|
-
get: function() {
|
|
4722
|
-
return m[k];
|
|
4723
|
-
}
|
|
4724
|
-
};
|
|
4725
|
-
Object.defineProperty(o, k2, desc);
|
|
4726
|
-
}) : (function(o, m, k, k2) {
|
|
4727
|
-
if (k2 === void 0) k2 = k;
|
|
4728
|
-
o[k2] = m[k];
|
|
4729
|
-
}));
|
|
4730
|
-
var __exportStar = exports && exports.__exportStar || function(m, exports$1) {
|
|
4731
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports$1, p)) __createBinding(exports$1, m, p);
|
|
4732
|
-
};
|
|
4733
|
-
var __importDefault = exports && exports.__importDefault || function(mod) {
|
|
4734
|
-
return mod && mod.__esModule ? mod : { "default": mod };
|
|
4735
|
-
};
|
|
4736
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4737
|
-
exports.WebClientEvent = exports.WebClient = exports.ChatStreamer = exports.retryPolicies = exports.LogLevel = exports.addAppMetadata = exports.ErrorCode = void 0;
|
|
4738
|
-
var errors_1 = require_errors();
|
|
4739
|
-
Object.defineProperty(exports, "ErrorCode", {
|
|
4740
|
-
enumerable: true,
|
|
4741
|
-
get: function() {
|
|
4742
|
-
return errors_1.ErrorCode;
|
|
4743
|
-
}
|
|
4744
|
-
});
|
|
4745
|
-
var instrument_1 = require_instrument();
|
|
4746
|
-
Object.defineProperty(exports, "addAppMetadata", {
|
|
4747
|
-
enumerable: true,
|
|
4748
|
-
get: function() {
|
|
4749
|
-
return instrument_1.addAppMetadata;
|
|
4750
|
-
}
|
|
4751
|
-
});
|
|
4752
|
-
var logger_1 = require_logger();
|
|
4753
|
-
Object.defineProperty(exports, "LogLevel", {
|
|
4754
|
-
enumerable: true,
|
|
4755
|
-
get: function() {
|
|
4756
|
-
return logger_1.LogLevel;
|
|
4757
|
-
}
|
|
4758
|
-
});
|
|
4759
|
-
var retry_policies_1 = require_retry_policies();
|
|
4760
|
-
Object.defineProperty(exports, "retryPolicies", {
|
|
4761
|
-
enumerable: true,
|
|
4762
|
-
get: function() {
|
|
4763
|
-
return __importDefault(retry_policies_1).default;
|
|
4764
|
-
}
|
|
4765
|
-
});
|
|
4766
|
-
__exportStar(require_request(), exports);
|
|
4767
|
-
__exportStar(require_response(), exports);
|
|
4768
|
-
var chat_stream_1 = require_chat_stream();
|
|
4769
|
-
Object.defineProperty(exports, "ChatStreamer", {
|
|
4770
|
-
enumerable: true,
|
|
4771
|
-
get: function() {
|
|
4772
|
-
return chat_stream_1.ChatStreamer;
|
|
4773
|
-
}
|
|
4774
|
-
});
|
|
4775
|
-
var WebClient_1 = require_WebClient();
|
|
4776
|
-
Object.defineProperty(exports, "WebClient", {
|
|
4777
|
-
enumerable: true,
|
|
4778
|
-
get: function() {
|
|
4779
|
-
return WebClient_1.WebClient;
|
|
4780
|
-
}
|
|
4781
|
-
});
|
|
4782
|
-
Object.defineProperty(exports, "WebClientEvent", {
|
|
4783
|
-
enumerable: true,
|
|
4784
|
-
get: function() {
|
|
4785
|
-
return WebClient_1.WebClientEvent;
|
|
4786
|
-
}
|
|
4787
|
-
});
|
|
4788
|
-
__exportStar(require_methods(), exports);
|
|
4789
|
-
}));
|
|
4790
|
-
//#endregion
|
|
4791
167
|
//#region src/adapters/slack.ts
|
|
168
|
+
/**
|
|
169
|
+
* Slack Adapter
|
|
170
|
+
*
|
|
171
|
+
* Implements MessageClient interface for Slack using @slack/web-api.
|
|
172
|
+
*/
|
|
4792
173
|
var slack_exports = /* @__PURE__ */ __exportAll({ SlackAdapter: () => SlackAdapter });
|
|
4793
|
-
var import_dist = require_dist();
|
|
4794
174
|
var SlackAdapter = class extends BaseMessageClient {
|
|
4795
175
|
client;
|
|
4796
176
|
botToken;
|
|
@@ -4801,7 +181,7 @@ var SlackAdapter = class extends BaseMessageClient {
|
|
|
4801
181
|
logger: options.logger
|
|
4802
182
|
});
|
|
4803
183
|
this.botToken = options.botToken;
|
|
4804
|
-
this.client = new
|
|
184
|
+
this.client = new WebClient(options.botToken);
|
|
4805
185
|
}
|
|
4806
186
|
async send(message, options) {
|
|
4807
187
|
this.validateMessage(message);
|