cloudstructs 0.6.17 → 0.6.19
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/.jsii +3 -3
- package/assets/slack-app/provider.lambda/index.js +134 -7
- package/assets/slack-events/events.lambda/index.js +4 -0
- package/assets/slack-textract/detect.lambda/index.js +355 -80
- package/assets/ssl-server-test/analyze.lambda/index.js +134 -7
- package/assets/static-website/origin-request.edge-lambda/index.js +4 -0
- package/assets/toolkit-cleaner/clean-objects.lambda/index.js +4 -0
- package/lib/codecommit-mirror/index.js +2 -2
- package/lib/ecs-service-roller/index.js +2 -2
- package/lib/email-receiver/receiver.js +1 -1
- package/lib/saml-identity-provider/index.js +2 -2
- package/lib/slack-app/manifest.js +1 -1
- package/lib/slack-app/slack-app.js +2 -2
- package/lib/slack-events/index.js +1 -1
- package/lib/slack-textract/index.js +3 -3
- package/lib/ssl-server-test/index.js +1 -1
- package/lib/state-machine-cr-provider/index.js +1 -1
- package/lib/static-website/index.js +1 -1
- package/lib/toolkit-cleaner/index.js +1 -1
- package/lib/url-shortener/index.js +1 -1
- package/node_modules/@slack/logger/node_modules/@types/node/README.md +1 -1
- package/node_modules/@slack/logger/node_modules/@types/node/child_process.d.ts +1 -1
- package/node_modules/@slack/logger/node_modules/@types/node/package.json +2 -2
- package/node_modules/@slack/logger/node_modules/@types/node/ts4.8/child_process.d.ts +1 -1
- package/node_modules/@slack/web-api/node_modules/@types/node/README.md +1 -1
- package/node_modules/@slack/web-api/node_modules/@types/node/child_process.d.ts +1 -1
- package/node_modules/@slack/web-api/node_modules/@types/node/package.json +2 -2
- package/node_modules/@slack/web-api/node_modules/@types/node/ts4.8/child_process.d.ts +1 -1
- package/node_modules/@types/cacheable-request/node_modules/@types/node/README.md +1 -1
- package/node_modules/@types/cacheable-request/node_modules/@types/node/child_process.d.ts +1 -1
- package/node_modules/@types/cacheable-request/node_modules/@types/node/package.json +2 -2
- package/node_modules/@types/cacheable-request/node_modules/@types/node/ts4.8/child_process.d.ts +1 -1
- package/node_modules/@types/is-stream/node_modules/@types/node/README.md +1 -1
- package/node_modules/@types/is-stream/node_modules/@types/node/child_process.d.ts +1 -1
- package/node_modules/@types/is-stream/node_modules/@types/node/package.json +2 -2
- package/node_modules/@types/is-stream/node_modules/@types/node/ts4.8/child_process.d.ts +1 -1
- package/node_modules/@types/keyv/node_modules/@types/node/README.md +1 -1
- package/node_modules/@types/keyv/node_modules/@types/node/child_process.d.ts +1 -1
- package/node_modules/@types/keyv/node_modules/@types/node/package.json +2 -2
- package/node_modules/@types/keyv/node_modules/@types/node/ts4.8/child_process.d.ts +1 -1
- package/node_modules/@types/responselike/node_modules/@types/node/README.md +1 -1
- package/node_modules/@types/responselike/node_modules/@types/node/child_process.d.ts +1 -1
- package/node_modules/@types/responselike/node_modules/@types/node/package.json +2 -2
- package/node_modules/@types/responselike/node_modules/@types/node/ts4.8/child_process.d.ts +1 -1
- package/node_modules/http-cache-semantics/index.js +4 -3
- package/node_modules/http-cache-semantics/package.json +2 -8
- package/package.json +11 -12
|
@@ -21,6 +21,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
21
21
|
return to;
|
|
22
22
|
};
|
|
23
23
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
24
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
25
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
26
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
27
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
28
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
29
|
mod
|
|
26
30
|
));
|
|
@@ -287,6 +291,7 @@ var require_p_timeout = __commonJS({
|
|
|
287
291
|
reject(timeoutError);
|
|
288
292
|
}, milliseconds);
|
|
289
293
|
pFinally(
|
|
294
|
+
// eslint-disable-next-line promise/prefer-await-to-then
|
|
290
295
|
promise.then(resolve, reject),
|
|
291
296
|
() => {
|
|
292
297
|
clearTimeout(timer);
|
|
@@ -484,6 +489,9 @@ var require_dist = __commonJS({
|
|
|
484
489
|
this._intervalCount = this._carryoverConcurrencyCount ? this._pendingCount : 0;
|
|
485
490
|
this._processQueue();
|
|
486
491
|
}
|
|
492
|
+
/**
|
|
493
|
+
Executes all queued functions until it reaches the limit.
|
|
494
|
+
*/
|
|
487
495
|
_processQueue() {
|
|
488
496
|
while (this._tryToStartAnother()) {
|
|
489
497
|
}
|
|
@@ -498,6 +506,9 @@ var require_dist = __commonJS({
|
|
|
498
506
|
this._concurrency = newConcurrency;
|
|
499
507
|
this._processQueue();
|
|
500
508
|
}
|
|
509
|
+
/**
|
|
510
|
+
Adds a sync or async task to the queue. Always returns a promise.
|
|
511
|
+
*/
|
|
501
512
|
async add(fn, options = {}) {
|
|
502
513
|
return new Promise((resolve, reject) => {
|
|
503
514
|
const run = async () => {
|
|
@@ -521,9 +532,17 @@ var require_dist = __commonJS({
|
|
|
521
532
|
this.emit("add");
|
|
522
533
|
});
|
|
523
534
|
}
|
|
535
|
+
/**
|
|
536
|
+
Same as `.add()`, but accepts an array of sync or async functions.
|
|
537
|
+
|
|
538
|
+
@returns A promise that resolves when all functions are resolved.
|
|
539
|
+
*/
|
|
524
540
|
async addAll(functions, options) {
|
|
525
541
|
return Promise.all(functions.map(async (function_) => this.add(function_, options)));
|
|
526
542
|
}
|
|
543
|
+
/**
|
|
544
|
+
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.)
|
|
545
|
+
*/
|
|
527
546
|
start() {
|
|
528
547
|
if (!this._isPaused) {
|
|
529
548
|
return this;
|
|
@@ -532,12 +551,23 @@ var require_dist = __commonJS({
|
|
|
532
551
|
this._processQueue();
|
|
533
552
|
return this;
|
|
534
553
|
}
|
|
554
|
+
/**
|
|
555
|
+
Put queue execution on hold.
|
|
556
|
+
*/
|
|
535
557
|
pause() {
|
|
536
558
|
this._isPaused = true;
|
|
537
559
|
}
|
|
560
|
+
/**
|
|
561
|
+
Clear the queue.
|
|
562
|
+
*/
|
|
538
563
|
clear() {
|
|
539
564
|
this._queue = new this._queueClass();
|
|
540
565
|
}
|
|
566
|
+
/**
|
|
567
|
+
Can be called multiple times. Useful if you for example add additional items at a later time.
|
|
568
|
+
|
|
569
|
+
@returns A promise that settles when the queue becomes empty.
|
|
570
|
+
*/
|
|
541
571
|
async onEmpty() {
|
|
542
572
|
if (this._queue.size === 0) {
|
|
543
573
|
return;
|
|
@@ -550,6 +580,11 @@ var require_dist = __commonJS({
|
|
|
550
580
|
};
|
|
551
581
|
});
|
|
552
582
|
}
|
|
583
|
+
/**
|
|
584
|
+
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.
|
|
585
|
+
|
|
586
|
+
@returns A promise that settles when the queue becomes empty, and all promises have completed; `queue.size === 0 && queue.pending === 0`.
|
|
587
|
+
*/
|
|
553
588
|
async onIdle() {
|
|
554
589
|
if (this._pendingCount === 0 && this._queue.size === 0) {
|
|
555
590
|
return;
|
|
@@ -562,21 +597,38 @@ var require_dist = __commonJS({
|
|
|
562
597
|
};
|
|
563
598
|
});
|
|
564
599
|
}
|
|
600
|
+
/**
|
|
601
|
+
Size of the queue.
|
|
602
|
+
*/
|
|
565
603
|
get size() {
|
|
566
604
|
return this._queue.size;
|
|
567
605
|
}
|
|
606
|
+
/**
|
|
607
|
+
Size of the queue, filtered by the given options.
|
|
608
|
+
|
|
609
|
+
For example, this can be used to find the number of items remaining in the queue with a specific priority level.
|
|
610
|
+
*/
|
|
568
611
|
sizeBy(options) {
|
|
569
612
|
return this._queue.filter(options).length;
|
|
570
613
|
}
|
|
614
|
+
/**
|
|
615
|
+
Number of pending promises.
|
|
616
|
+
*/
|
|
571
617
|
get pending() {
|
|
572
618
|
return this._pendingCount;
|
|
573
619
|
}
|
|
620
|
+
/**
|
|
621
|
+
Whether the queue is currently paused.
|
|
622
|
+
*/
|
|
574
623
|
get isPaused() {
|
|
575
624
|
return this._isPaused;
|
|
576
625
|
}
|
|
577
626
|
get timeout() {
|
|
578
627
|
return this._timeout;
|
|
579
628
|
}
|
|
629
|
+
/**
|
|
630
|
+
Set the timeout for future operations.
|
|
631
|
+
*/
|
|
580
632
|
set timeout(milliseconds) {
|
|
581
633
|
this._timeout = milliseconds;
|
|
582
634
|
}
|
|
@@ -630,7 +682,7 @@ var require_retry_operation = __commonJS({
|
|
|
630
682
|
if (!err) {
|
|
631
683
|
return false;
|
|
632
684
|
}
|
|
633
|
-
var currentTime = new Date().getTime();
|
|
685
|
+
var currentTime = (/* @__PURE__ */ new Date()).getTime();
|
|
634
686
|
if (err && currentTime - this._operationStart >= this._maxRetryTime) {
|
|
635
687
|
this._errors.push(err);
|
|
636
688
|
this._errors.unshift(new Error("RetryOperation timeout occurred"));
|
|
@@ -680,7 +732,7 @@ var require_retry_operation = __commonJS({
|
|
|
680
732
|
self._operationTimeoutCb();
|
|
681
733
|
}, self._operationTimeout);
|
|
682
734
|
}
|
|
683
|
-
this._operationStart = new Date().getTime();
|
|
735
|
+
this._operationStart = (/* @__PURE__ */ new Date()).getTime();
|
|
684
736
|
this._fn(this._attempts);
|
|
685
737
|
};
|
|
686
738
|
RetryOperation.prototype.try = function(fn) {
|
|
@@ -820,9 +872,13 @@ var require_p_retry = __commonJS({
|
|
|
820
872
|
var retry = require_retry2();
|
|
821
873
|
var networkErrorMsgs = [
|
|
822
874
|
"Failed to fetch",
|
|
875
|
+
// Chrome
|
|
823
876
|
"NetworkError when attempting to fetch resource.",
|
|
877
|
+
// Firefox
|
|
824
878
|
"The Internet connection appears to be offline.",
|
|
879
|
+
// Safari
|
|
825
880
|
"Network request failed"
|
|
881
|
+
// `cross-fetch`
|
|
826
882
|
];
|
|
827
883
|
var AbortError = class extends Error {
|
|
828
884
|
constructor(message) {
|
|
@@ -1171,14 +1227,18 @@ var require_enhanceError = __commonJS({
|
|
|
1171
1227
|
error.isAxiosError = true;
|
|
1172
1228
|
error.toJSON = function toJSON() {
|
|
1173
1229
|
return {
|
|
1230
|
+
// Standard
|
|
1174
1231
|
message: this.message,
|
|
1175
1232
|
name: this.name,
|
|
1233
|
+
// Microsoft
|
|
1176
1234
|
description: this.description,
|
|
1177
1235
|
number: this.number,
|
|
1236
|
+
// Mozilla
|
|
1178
1237
|
fileName: this.fileName,
|
|
1179
1238
|
lineNumber: this.lineNumber,
|
|
1180
1239
|
columnNumber: this.columnNumber,
|
|
1181
1240
|
stack: this.stack,
|
|
1241
|
+
// Axios
|
|
1182
1242
|
config: this.config,
|
|
1183
1243
|
code: this.code
|
|
1184
1244
|
};
|
|
@@ -1227,44 +1287,50 @@ var require_cookies = __commonJS({
|
|
|
1227
1287
|
"node_modules/axios/lib/helpers/cookies.js"(exports, module2) {
|
|
1228
1288
|
"use strict";
|
|
1229
1289
|
var utils = require_utils();
|
|
1230
|
-
module2.exports = utils.isStandardBrowserEnv() ?
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
cookie.push("
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1290
|
+
module2.exports = utils.isStandardBrowserEnv() ? (
|
|
1291
|
+
// Standard browser envs support document.cookie
|
|
1292
|
+
function standardBrowserEnv() {
|
|
1293
|
+
return {
|
|
1294
|
+
write: function write(name, value, expires, path, domain, secure) {
|
|
1295
|
+
var cookie = [];
|
|
1296
|
+
cookie.push(name + "=" + encodeURIComponent(value));
|
|
1297
|
+
if (utils.isNumber(expires)) {
|
|
1298
|
+
cookie.push("expires=" + new Date(expires).toGMTString());
|
|
1299
|
+
}
|
|
1300
|
+
if (utils.isString(path)) {
|
|
1301
|
+
cookie.push("path=" + path);
|
|
1302
|
+
}
|
|
1303
|
+
if (utils.isString(domain)) {
|
|
1304
|
+
cookie.push("domain=" + domain);
|
|
1305
|
+
}
|
|
1306
|
+
if (secure === true) {
|
|
1307
|
+
cookie.push("secure");
|
|
1308
|
+
}
|
|
1309
|
+
document.cookie = cookie.join("; ");
|
|
1310
|
+
},
|
|
1311
|
+
read: function read(name) {
|
|
1312
|
+
var match = document.cookie.match(new RegExp("(^|;\\s*)(" + name + ")=([^;]*)"));
|
|
1313
|
+
return match ? decodeURIComponent(match[3]) : null;
|
|
1314
|
+
},
|
|
1315
|
+
remove: function remove(name) {
|
|
1316
|
+
this.write(name, "", Date.now() - 864e5);
|
|
1243
1317
|
}
|
|
1244
|
-
|
|
1245
|
-
|
|
1318
|
+
};
|
|
1319
|
+
}()
|
|
1320
|
+
) : (
|
|
1321
|
+
// Non standard browser env (web workers, react-native) lack needed support.
|
|
1322
|
+
function nonStandardBrowserEnv() {
|
|
1323
|
+
return {
|
|
1324
|
+
write: function write() {
|
|
1325
|
+
},
|
|
1326
|
+
read: function read() {
|
|
1327
|
+
return null;
|
|
1328
|
+
},
|
|
1329
|
+
remove: function remove() {
|
|
1246
1330
|
}
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
var match = document.cookie.match(new RegExp("(^|;\\s*)(" + name + ")=([^;]*)"));
|
|
1251
|
-
return match ? decodeURIComponent(match[3]) : null;
|
|
1252
|
-
},
|
|
1253
|
-
remove: function remove(name) {
|
|
1254
|
-
this.write(name, "", Date.now() - 864e5);
|
|
1255
|
-
}
|
|
1256
|
-
};
|
|
1257
|
-
}() : function nonStandardBrowserEnv() {
|
|
1258
|
-
return {
|
|
1259
|
-
write: function write() {
|
|
1260
|
-
},
|
|
1261
|
-
read: function read() {
|
|
1262
|
-
return null;
|
|
1263
|
-
},
|
|
1264
|
-
remove: function remove() {
|
|
1265
|
-
}
|
|
1266
|
-
};
|
|
1267
|
-
}();
|
|
1331
|
+
};
|
|
1332
|
+
}()
|
|
1333
|
+
);
|
|
1268
1334
|
}
|
|
1269
1335
|
});
|
|
1270
1336
|
|
|
@@ -1360,38 +1426,45 @@ var require_isURLSameOrigin = __commonJS({
|
|
|
1360
1426
|
"node_modules/axios/lib/helpers/isURLSameOrigin.js"(exports, module2) {
|
|
1361
1427
|
"use strict";
|
|
1362
1428
|
var utils = require_utils();
|
|
1363
|
-
module2.exports = utils.isStandardBrowserEnv() ?
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
var
|
|
1369
|
-
|
|
1429
|
+
module2.exports = utils.isStandardBrowserEnv() ? (
|
|
1430
|
+
// Standard browser envs have full support of the APIs needed to test
|
|
1431
|
+
// whether the request URL is of the same origin as current location.
|
|
1432
|
+
function standardBrowserEnv() {
|
|
1433
|
+
var msie = /(msie|trident)/i.test(navigator.userAgent);
|
|
1434
|
+
var urlParsingNode = document.createElement("a");
|
|
1435
|
+
var originURL;
|
|
1436
|
+
function resolveURL(url) {
|
|
1437
|
+
var href = url;
|
|
1438
|
+
if (msie) {
|
|
1439
|
+
urlParsingNode.setAttribute("href", href);
|
|
1440
|
+
href = urlParsingNode.href;
|
|
1441
|
+
}
|
|
1370
1442
|
urlParsingNode.setAttribute("href", href);
|
|
1371
|
-
|
|
1443
|
+
return {
|
|
1444
|
+
href: urlParsingNode.href,
|
|
1445
|
+
protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, "") : "",
|
|
1446
|
+
host: urlParsingNode.host,
|
|
1447
|
+
search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, "") : "",
|
|
1448
|
+
hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, "") : "",
|
|
1449
|
+
hostname: urlParsingNode.hostname,
|
|
1450
|
+
port: urlParsingNode.port,
|
|
1451
|
+
pathname: urlParsingNode.pathname.charAt(0) === "/" ? urlParsingNode.pathname : "/" + urlParsingNode.pathname
|
|
1452
|
+
};
|
|
1372
1453
|
}
|
|
1373
|
-
|
|
1374
|
-
return {
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
host: urlParsingNode.host,
|
|
1378
|
-
search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, "") : "",
|
|
1379
|
-
hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, "") : "",
|
|
1380
|
-
hostname: urlParsingNode.hostname,
|
|
1381
|
-
port: urlParsingNode.port,
|
|
1382
|
-
pathname: urlParsingNode.pathname.charAt(0) === "/" ? urlParsingNode.pathname : "/" + urlParsingNode.pathname
|
|
1454
|
+
originURL = resolveURL(window.location.href);
|
|
1455
|
+
return function isURLSameOrigin(requestURL) {
|
|
1456
|
+
var parsed = utils.isString(requestURL) ? resolveURL(requestURL) : requestURL;
|
|
1457
|
+
return parsed.protocol === originURL.protocol && parsed.host === originURL.host;
|
|
1383
1458
|
};
|
|
1384
|
-
}
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
return
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
};
|
|
1394
|
-
}();
|
|
1459
|
+
}()
|
|
1460
|
+
) : (
|
|
1461
|
+
// Non standard browser envs (web workers, react-native) lack needed support.
|
|
1462
|
+
function nonStandardBrowserEnv() {
|
|
1463
|
+
return function isURLSameOrigin() {
|
|
1464
|
+
return true;
|
|
1465
|
+
};
|
|
1466
|
+
}()
|
|
1467
|
+
);
|
|
1395
1468
|
}
|
|
1396
1469
|
});
|
|
1397
1470
|
|
|
@@ -1677,7 +1750,7 @@ var require_common = __commonJS({
|
|
|
1677
1750
|
return;
|
|
1678
1751
|
}
|
|
1679
1752
|
const self = debug;
|
|
1680
|
-
const curr = Number(new Date());
|
|
1753
|
+
const curr = Number(/* @__PURE__ */ new Date());
|
|
1681
1754
|
const ms = curr - (prevTime || curr);
|
|
1682
1755
|
self.diff = ms;
|
|
1683
1756
|
self.prev = prevTime;
|
|
@@ -1905,7 +1978,11 @@ var require_browser = __commonJS({
|
|
|
1905
1978
|
if (typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
|
|
1906
1979
|
return false;
|
|
1907
1980
|
}
|
|
1908
|
-
return typeof document !== "undefined" && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance ||
|
|
1981
|
+
return typeof document !== "undefined" && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || // Is firebug? http://stackoverflow.com/a/398120/376773
|
|
1982
|
+
typeof window !== "undefined" && window.console && (window.console.firebug || window.console.exception && window.console.table) || // Is firefox >= v31?
|
|
1983
|
+
// https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
|
|
1984
|
+
typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31 || // Double check webkit in userAgent just in case we are in a worker
|
|
1985
|
+
typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/);
|
|
1909
1986
|
}
|
|
1910
1987
|
function formatArgs(args) {
|
|
1911
1988
|
args[0] = (this.useColors ? "%c" : "") + this.namespace + (this.useColors ? " %c" : " ") + args[0] + (this.useColors ? "%c " : " ") + "+" + module2.exports.humanize(this.diff);
|
|
@@ -2222,7 +2299,7 @@ var require_node = __commonJS({
|
|
|
2222
2299
|
if (exports.inspectOpts.hideDate) {
|
|
2223
2300
|
return "";
|
|
2224
2301
|
}
|
|
2225
|
-
return new Date().toISOString() + " ";
|
|
2302
|
+
return (/* @__PURE__ */ new Date()).toISOString() + " ";
|
|
2226
2303
|
}
|
|
2227
2304
|
function log(...args) {
|
|
2228
2305
|
return process.stderr.write(util.format(...args) + "\n");
|
|
@@ -2504,7 +2581,11 @@ var require_follow_redirects = __commonJS({
|
|
|
2504
2581
|
for (var event of events) {
|
|
2505
2582
|
request.on(event, eventHandlers[event]);
|
|
2506
2583
|
}
|
|
2507
|
-
this._currentUrl = /^\//.test(this._options.path) ? url.format(this._options) :
|
|
2584
|
+
this._currentUrl = /^\//.test(this._options.path) ? url.format(this._options) : (
|
|
2585
|
+
// When making a request to a proxy, […]
|
|
2586
|
+
// a client MUST send the target URI in absolute-form […].
|
|
2587
|
+
this._options.path
|
|
2588
|
+
);
|
|
2508
2589
|
if (this._isRedirect) {
|
|
2509
2590
|
var i = 0;
|
|
2510
2591
|
var self = this;
|
|
@@ -2552,11 +2633,16 @@ var require_follow_redirects = __commonJS({
|
|
|
2552
2633
|
var beforeRedirect = this._options.beforeRedirect;
|
|
2553
2634
|
if (beforeRedirect) {
|
|
2554
2635
|
requestHeaders = Object.assign({
|
|
2636
|
+
// The Host header was set by nativeProtocol.request
|
|
2555
2637
|
Host: response.req.getHeader("host")
|
|
2556
2638
|
}, this._options.headers);
|
|
2557
2639
|
}
|
|
2558
2640
|
var method = this._options.method;
|
|
2559
|
-
if ((statusCode === 301 || statusCode === 302) && this._options.method === "POST" ||
|
|
2641
|
+
if ((statusCode === 301 || statusCode === 302) && this._options.method === "POST" || // RFC7231§6.4.4: The 303 (See Other) status code indicates that
|
|
2642
|
+
// the server is redirecting the user agent to a different resource […]
|
|
2643
|
+
// A user agent can perform a retrieval request targeting that URI
|
|
2644
|
+
// (a GET or HEAD request if using HTTP) […]
|
|
2645
|
+
statusCode === 303 && !/^(?:GET|HEAD)$/.test(this._options.method)) {
|
|
2560
2646
|
this._options.method = "GET";
|
|
2561
2647
|
this._requestBodyBuffers = [];
|
|
2562
2648
|
removeMatchingHeaders(/^content-/i, this._options.headers);
|
|
@@ -2665,7 +2751,10 @@ var require_follow_redirects = __commonJS({
|
|
|
2665
2751
|
function urlToOptions(urlObject) {
|
|
2666
2752
|
var options = {
|
|
2667
2753
|
protocol: urlObject.protocol,
|
|
2668
|
-
hostname: urlObject.hostname.startsWith("[") ?
|
|
2754
|
+
hostname: urlObject.hostname.startsWith("[") ? (
|
|
2755
|
+
/* istanbul ignore next */
|
|
2756
|
+
urlObject.hostname.slice(1, -1)
|
|
2757
|
+
) : urlObject.hostname,
|
|
2669
2758
|
hash: urlObject.hash,
|
|
2670
2759
|
search: urlObject.search,
|
|
2671
2760
|
pathname: urlObject.pathname,
|
|
@@ -3160,6 +3249,10 @@ var require_defaults = __commonJS({
|
|
|
3160
3249
|
}
|
|
3161
3250
|
return data;
|
|
3162
3251
|
}],
|
|
3252
|
+
/**
|
|
3253
|
+
* A timeout in milliseconds to abort a request. If set to 0 (default) a
|
|
3254
|
+
* timeout is not created.
|
|
3255
|
+
*/
|
|
3163
3256
|
timeout: 0,
|
|
3164
3257
|
xsrfCookieName: "XSRF-TOKEN",
|
|
3165
3258
|
xsrfHeaderName: "X-XSRF-TOKEN",
|
|
@@ -12870,7 +12963,9 @@ var require_form_data = __commonJS({
|
|
|
12870
12963
|
var contentType = this._getContentType(value, options);
|
|
12871
12964
|
var contents = "";
|
|
12872
12965
|
var headers = {
|
|
12966
|
+
// add custom disposition as third element or keep it two elements if not
|
|
12873
12967
|
"Content-Disposition": ["form-data", 'name="' + field + '"'].concat(contentDisposition || []),
|
|
12968
|
+
// if no content type. allow it to be empty array
|
|
12874
12969
|
"Content-Type": [].concat(contentType || [])
|
|
12875
12970
|
};
|
|
12876
12971
|
if (typeof options.header == "object") {
|
|
@@ -13285,6 +13380,12 @@ var require_methods = __commonJS({
|
|
|
13285
13380
|
return self.apiCall.bind(self, method);
|
|
13286
13381
|
}
|
|
13287
13382
|
var Methods = class extends eventemitter3_1.EventEmitter {
|
|
13383
|
+
// TODO: As of writing, `WebClient` already extends EventEmitter...
|
|
13384
|
+
// and I want WebClient to extend this class...
|
|
13385
|
+
// and multiple inheritance in JS is cursed...
|
|
13386
|
+
// so I'm just making this class extend EventEmitter.
|
|
13387
|
+
//
|
|
13388
|
+
// It shouldn't be here, indeed. Nothing here uses it, indeed. But it must be here for the sake of sanity.
|
|
13288
13389
|
constructor() {
|
|
13289
13390
|
super();
|
|
13290
13391
|
this.admin = {
|
|
@@ -13877,32 +13978,53 @@ var require_dist3 = __commonJS({
|
|
|
13877
13978
|
getLevel() {
|
|
13878
13979
|
return this.level;
|
|
13879
13980
|
}
|
|
13981
|
+
/**
|
|
13982
|
+
* Sets the instance's log level so that only messages which are equal or more severe are output to the console.
|
|
13983
|
+
*/
|
|
13880
13984
|
setLevel(level) {
|
|
13881
13985
|
this.level = level;
|
|
13882
13986
|
}
|
|
13987
|
+
/**
|
|
13988
|
+
* Set the instance's name, which will appear on each log line before the message.
|
|
13989
|
+
*/
|
|
13883
13990
|
setName(name) {
|
|
13884
13991
|
this.name = name;
|
|
13885
13992
|
}
|
|
13993
|
+
/**
|
|
13994
|
+
* Log a debug message
|
|
13995
|
+
*/
|
|
13886
13996
|
debug(...msg) {
|
|
13887
13997
|
if (ConsoleLogger.isMoreOrEqualSevere(LogLevel.DEBUG, this.level)) {
|
|
13888
13998
|
console.debug(ConsoleLogger.labels.get(LogLevel.DEBUG), this.name, ...msg);
|
|
13889
13999
|
}
|
|
13890
14000
|
}
|
|
14001
|
+
/**
|
|
14002
|
+
* Log an info message
|
|
14003
|
+
*/
|
|
13891
14004
|
info(...msg) {
|
|
13892
14005
|
if (ConsoleLogger.isMoreOrEqualSevere(LogLevel.INFO, this.level)) {
|
|
13893
14006
|
console.info(ConsoleLogger.labels.get(LogLevel.INFO), this.name, ...msg);
|
|
13894
14007
|
}
|
|
13895
14008
|
}
|
|
14009
|
+
/**
|
|
14010
|
+
* Log a warning message
|
|
14011
|
+
*/
|
|
13896
14012
|
warn(...msg) {
|
|
13897
14013
|
if (ConsoleLogger.isMoreOrEqualSevere(LogLevel.WARN, this.level)) {
|
|
13898
14014
|
console.warn(ConsoleLogger.labels.get(LogLevel.WARN), this.name, ...msg);
|
|
13899
14015
|
}
|
|
13900
14016
|
}
|
|
14017
|
+
/**
|
|
14018
|
+
* Log an error message
|
|
14019
|
+
*/
|
|
13901
14020
|
error(...msg) {
|
|
13902
14021
|
if (ConsoleLogger.isMoreOrEqualSevere(LogLevel.ERROR, this.level)) {
|
|
13903
14022
|
console.error(ConsoleLogger.labels.get(LogLevel.ERROR), this.name, ...msg);
|
|
13904
14023
|
}
|
|
13905
14024
|
}
|
|
14025
|
+
/**
|
|
14026
|
+
* Helper to compare two log levels and determine if a is equal or more severe than b
|
|
14027
|
+
*/
|
|
13906
14028
|
static isMoreOrEqualSevere(a, b) {
|
|
13907
14029
|
return ConsoleLogger.severity[a] >= ConsoleLogger.severity[b];
|
|
13908
14030
|
}
|
|
@@ -14111,6 +14233,9 @@ var require_WebClient = __commonJS({
|
|
|
14111
14233
|
var retry_policies_1 = __importDefault(require_retry_policies());
|
|
14112
14234
|
var helpers_1 = require_helpers();
|
|
14113
14235
|
var WebClient2 = class extends methods_1.Methods {
|
|
14236
|
+
/**
|
|
14237
|
+
* @param token - An API token to authenticate/authorize with Slack (usually start with `xoxp`, `xoxb`)
|
|
14238
|
+
*/
|
|
14114
14239
|
constructor(token, { slackApiUrl = "https://slack.com/api/", logger = void 0, logLevel = logger_1.LogLevel.INFO, maxRequestConcurrency = 3, retryConfig = retry_policies_1.default.tenRetriesInAboutThirtyMinutes, agent = void 0, tls = void 0, rejectRateLimitedCalls = false, headers = {}, teamId = void 0 } = {}) {
|
|
14115
14240
|
super();
|
|
14116
14241
|
this.token = token;
|
|
@@ -14138,11 +14263,21 @@ var require_WebClient = __commonJS({
|
|
|
14138
14263
|
transformRequest: [this.serializeApiCallOptions.bind(this)],
|
|
14139
14264
|
validateStatus: () => true,
|
|
14140
14265
|
maxRedirects: 0,
|
|
14266
|
+
// disabling axios' automatic proxy support:
|
|
14267
|
+
// axios would read from envvars to configure a proxy automatically, but it doesn't support TLS destinations.
|
|
14268
|
+
// for compatibility with https://api.slack.com, and for a larger set of possible proxies (SOCKS or other
|
|
14269
|
+
// protocols), users of this package should use the `agent` option to configure a proxy.
|
|
14141
14270
|
proxy: false
|
|
14142
14271
|
});
|
|
14143
14272
|
delete this.axios.defaults.headers.post["Content-Type"];
|
|
14144
14273
|
this.logger.debug("initialized");
|
|
14145
14274
|
}
|
|
14275
|
+
/**
|
|
14276
|
+
* Generic method for calling a Web API method
|
|
14277
|
+
*
|
|
14278
|
+
* @param method - the Web API method to call {@link https://api.slack.com/methods}
|
|
14279
|
+
* @param options - options
|
|
14280
|
+
*/
|
|
14146
14281
|
async apiCall(method, options) {
|
|
14147
14282
|
this.logger.debug(`apiCall('${method}') start`);
|
|
14148
14283
|
warnDeprecations(method, this.logger);
|
|
@@ -14245,6 +14380,9 @@ var require_WebClient = __commonJS({
|
|
|
14245
14380
|
return accumulator;
|
|
14246
14381
|
})();
|
|
14247
14382
|
}
|
|
14383
|
+
/**
|
|
14384
|
+
* Low-level function to make a single API request. handles queuing, retries, and http-level errors
|
|
14385
|
+
*/
|
|
14248
14386
|
async makeRequest(url, body, headers = {}) {
|
|
14249
14387
|
const task = () => this.requestQueue.add(async () => {
|
|
14250
14388
|
this.logger.debug("will perform http request");
|
|
@@ -14283,6 +14421,15 @@ var require_WebClient = __commonJS({
|
|
|
14283
14421
|
});
|
|
14284
14422
|
return p_retry_1.default(task, this.retryConfig);
|
|
14285
14423
|
}
|
|
14424
|
+
/**
|
|
14425
|
+
* Transforms options (a simple key-value object) into an acceptable value for a body. This can be either
|
|
14426
|
+
* a string, used when posting with a content-type of url-encoded. Or, it can be a readable stream, used
|
|
14427
|
+
* when the options contain a binary (a stream or a buffer) and the upload should be done with content-type
|
|
14428
|
+
* multipart/form-data.
|
|
14429
|
+
*
|
|
14430
|
+
* @param options - arguments for the Web API method
|
|
14431
|
+
* @param headers - a mutable object representing the HTTP headers for the outgoing request
|
|
14432
|
+
*/
|
|
14286
14433
|
serializeApiCallOptions(options, headers) {
|
|
14287
14434
|
let containsBinaryData = false;
|
|
14288
14435
|
const flattened = Object.entries(options).map(([key, value]) => {
|
|
@@ -14332,6 +14479,11 @@ var require_WebClient = __commonJS({
|
|
|
14332
14479
|
return accumulator;
|
|
14333
14480
|
}, initialValue));
|
|
14334
14481
|
}
|
|
14482
|
+
/**
|
|
14483
|
+
* Processes an HTTP response into a WebAPICallResult by performing JSON parsing on the body and merging relevent
|
|
14484
|
+
* HTTP headers into the object.
|
|
14485
|
+
* @param response - an http response
|
|
14486
|
+
*/
|
|
14335
14487
|
buildResult(response) {
|
|
14336
14488
|
const data = response.data;
|
|
14337
14489
|
if (data.response_metadata === void 0) {
|
|
@@ -14744,10 +14896,12 @@ var require_dist5 = __commonJS({
|
|
|
14744
14896
|
}
|
|
14745
14897
|
};
|
|
14746
14898
|
exports.assert = {
|
|
14899
|
+
// Unknowns.
|
|
14747
14900
|
undefined: (value) => assertType(is.undefined(value), "undefined", value),
|
|
14748
14901
|
string: (value) => assertType(is.string(value), "string", value),
|
|
14749
14902
|
number: (value) => assertType(is.number(value), "number", value),
|
|
14750
14903
|
bigint: (value) => assertType(is.bigint(value), "bigint", value),
|
|
14904
|
+
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
14751
14905
|
function_: (value) => assertType(is.function_(value), "Function", value),
|
|
14752
14906
|
null_: (value) => assertType(is.null_(value), "null", value),
|
|
14753
14907
|
class_: (value) => assertType(is.class_(value), "Class", value),
|
|
@@ -14773,7 +14927,9 @@ var require_dist5 = __commonJS({
|
|
|
14773
14927
|
promise: (value) => assertType(is.promise(value), "Promise", value),
|
|
14774
14928
|
generatorFunction: (value) => assertType(is.generatorFunction(value), "GeneratorFunction", value),
|
|
14775
14929
|
asyncGeneratorFunction: (value) => assertType(is.asyncGeneratorFunction(value), "AsyncGeneratorFunction", value),
|
|
14930
|
+
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
14776
14931
|
asyncFunction: (value) => assertType(is.asyncFunction(value), "AsyncFunction", value),
|
|
14932
|
+
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
14777
14933
|
boundFunction: (value) => assertType(is.boundFunction(value), "Function", value),
|
|
14778
14934
|
regExp: (value) => assertType(is.regExp(value), "RegExp", value),
|
|
14779
14935
|
date: (value) => assertType(is.date(value), "Date", value),
|
|
@@ -14827,10 +14983,13 @@ var require_dist5 = __commonJS({
|
|
|
14827
14983
|
propertyKey: (value) => assertType(is.propertyKey(value), "PropertyKey", value),
|
|
14828
14984
|
formData: (value) => assertType(is.formData(value), "FormData", value),
|
|
14829
14985
|
urlSearchParams: (value) => assertType(is.urlSearchParams(value), "URLSearchParams", value),
|
|
14986
|
+
// Numbers.
|
|
14830
14987
|
evenInteger: (value) => assertType(is.evenInteger(value), "even integer", value),
|
|
14831
14988
|
oddInteger: (value) => assertType(is.oddInteger(value), "odd integer", value),
|
|
14989
|
+
// Two arguments.
|
|
14832
14990
|
directInstanceOf: (instance, class_) => assertType(is.directInstanceOf(instance, class_), "T", instance),
|
|
14833
14991
|
inRange: (value, range) => assertType(is.inRange(value, range), "in range", value),
|
|
14992
|
+
// Variadic functions.
|
|
14834
14993
|
any: (predicate, ...values) => {
|
|
14835
14994
|
return assertType(is.any(predicate, ...values), "predicate returns truthy for any value", values, { multipleValues: true });
|
|
14836
14995
|
},
|
|
@@ -15994,6 +16153,7 @@ var require_http_cache_semantics = __commonJS({
|
|
|
15994
16153
|
206,
|
|
15995
16154
|
300,
|
|
15996
16155
|
301,
|
|
16156
|
+
308,
|
|
15997
16157
|
404,
|
|
15998
16158
|
405,
|
|
15999
16159
|
410,
|
|
@@ -16024,6 +16184,7 @@ var require_http_cache_semantics = __commonJS({
|
|
|
16024
16184
|
]);
|
|
16025
16185
|
var hopByHopHeaders = {
|
|
16026
16186
|
date: true,
|
|
16187
|
+
// included, because we add Age update Date
|
|
16027
16188
|
connection: true,
|
|
16028
16189
|
"keep-alive": true,
|
|
16029
16190
|
"proxy-authenticate": true,
|
|
@@ -16034,6 +16195,7 @@ var require_http_cache_semantics = __commonJS({
|
|
|
16034
16195
|
upgrade: true
|
|
16035
16196
|
};
|
|
16036
16197
|
var excludedFromRevalidationUpdate = {
|
|
16198
|
+
// Since the old body is reused, it doesn't make sense to change properties of the body
|
|
16037
16199
|
"content-length": true,
|
|
16038
16200
|
"content-encoding": true,
|
|
16039
16201
|
"transfer-encoding": true,
|
|
@@ -16053,10 +16215,10 @@ var require_http_cache_semantics = __commonJS({
|
|
|
16053
16215
|
const cc = {};
|
|
16054
16216
|
if (!header)
|
|
16055
16217
|
return cc;
|
|
16056
|
-
const parts = header.trim().split(
|
|
16218
|
+
const parts = header.trim().split(/,/);
|
|
16057
16219
|
for (const part of parts) {
|
|
16058
|
-
const [k, v] = part.split(
|
|
16059
|
-
cc[k] = v === void 0 ? true : v.replace(/^"|"$/g, "");
|
|
16220
|
+
const [k, v] = part.split(/=/, 2);
|
|
16221
|
+
cc[k.trim()] = v === void 0 ? true : v.trim().replace(/^"|"$/g, "");
|
|
16060
16222
|
}
|
|
16061
16223
|
return cc;
|
|
16062
16224
|
}
|
|
@@ -16120,7 +16282,19 @@ var require_http_cache_semantics = __commonJS({
|
|
|
16120
16282
|
return Date.now();
|
|
16121
16283
|
}
|
|
16122
16284
|
storable() {
|
|
16123
|
-
return !!(!this._reqcc["no-store"] &&
|
|
16285
|
+
return !!(!this._reqcc["no-store"] && // A cache MUST NOT store a response to any request, unless:
|
|
16286
|
+
// The request method is understood by the cache and defined as being cacheable, and
|
|
16287
|
+
("GET" === this._method || "HEAD" === this._method || "POST" === this._method && this._hasExplicitExpiration()) && // the response status code is understood by the cache, and
|
|
16288
|
+
understoodStatuses.has(this._status) && // the "no-store" cache directive does not appear in request or response header fields, and
|
|
16289
|
+
!this._rescc["no-store"] && // the "private" response directive does not appear in the response, if the cache is shared, and
|
|
16290
|
+
(!this._isShared || !this._rescc.private) && // the Authorization header field does not appear in the request, if the cache is shared,
|
|
16291
|
+
(!this._isShared || this._noAuthorization || this._allowsStoringAuthenticated()) && // the response either:
|
|
16292
|
+
// contains an Expires header field, or
|
|
16293
|
+
(this._resHeaders.expires || // contains a max-age response directive, or
|
|
16294
|
+
// contains a s-maxage response directive and the cache is shared, or
|
|
16295
|
+
// contains a public response directive.
|
|
16296
|
+
this._rescc["max-age"] || this._isShared && this._rescc["s-maxage"] || this._rescc.public || // has a status code that is defined as cacheable by default
|
|
16297
|
+
statusCodeCacheableByDefault.has(this._status)));
|
|
16124
16298
|
}
|
|
16125
16299
|
_hasExplicitExpiration() {
|
|
16126
16300
|
return this._isShared && this._rescc["s-maxage"] || this._rescc["max-age"] || this._resHeaders.expires;
|
|
@@ -16151,7 +16325,9 @@ var require_http_cache_semantics = __commonJS({
|
|
|
16151
16325
|
return this._requestMatches(req, false);
|
|
16152
16326
|
}
|
|
16153
16327
|
_requestMatches(req, allowHeadMethod) {
|
|
16154
|
-
return (!this._url || this._url === req.url) && this._host === req.headers.host &&
|
|
16328
|
+
return (!this._url || this._url === req.url) && this._host === req.headers.host && // the request method associated with the stored response allows it to be used for the presented request, and
|
|
16329
|
+
(!req.method || this._method === req.method || allowHeadMethod && "HEAD" === req.method) && // selecting header fields nominated by the stored response (if any) match those presented, and
|
|
16330
|
+
this._varyMatches(req);
|
|
16155
16331
|
}
|
|
16156
16332
|
_allowsStoringAuthenticated() {
|
|
16157
16333
|
return this._rescc["must-revalidate"] || this._rescc.public || this._rescc["s-maxage"];
|
|
@@ -16205,6 +16381,10 @@ var require_http_cache_semantics = __commonJS({
|
|
|
16205
16381
|
headers.date = new Date(this.now()).toUTCString();
|
|
16206
16382
|
return headers;
|
|
16207
16383
|
}
|
|
16384
|
+
/**
|
|
16385
|
+
* Value of the Date response header or current time if Date was invalid
|
|
16386
|
+
* @return timestamp
|
|
16387
|
+
*/
|
|
16208
16388
|
date() {
|
|
16209
16389
|
const serverDate = Date.parse(this._resHeaders.date);
|
|
16210
16390
|
if (isFinite(serverDate)) {
|
|
@@ -16212,6 +16392,12 @@ var require_http_cache_semantics = __commonJS({
|
|
|
16212
16392
|
}
|
|
16213
16393
|
return this._responseTime;
|
|
16214
16394
|
}
|
|
16395
|
+
/**
|
|
16396
|
+
* Value of the Age header, in seconds, updated for the current time.
|
|
16397
|
+
* May be fractional.
|
|
16398
|
+
*
|
|
16399
|
+
* @return Number
|
|
16400
|
+
*/
|
|
16215
16401
|
age() {
|
|
16216
16402
|
let age = this._ageValue();
|
|
16217
16403
|
const residentTime = (this.now() - this._responseTime) / 1e3;
|
|
@@ -16220,6 +16406,13 @@ var require_http_cache_semantics = __commonJS({
|
|
|
16220
16406
|
_ageValue() {
|
|
16221
16407
|
return toNumberOrZero(this._resHeaders.age);
|
|
16222
16408
|
}
|
|
16409
|
+
/**
|
|
16410
|
+
* Value of applicable max-age (or heuristic equivalent) in seconds. This counts since response's `Date`.
|
|
16411
|
+
*
|
|
16412
|
+
* For an up-to-date value, see `timeToLive()`.
|
|
16413
|
+
*
|
|
16414
|
+
* @return Number
|
|
16415
|
+
*/
|
|
16223
16416
|
maxAge() {
|
|
16224
16417
|
if (!this.storable() || this._rescc["no-cache"]) {
|
|
16225
16418
|
return 0;
|
|
@@ -16316,6 +16509,13 @@ var require_http_cache_semantics = __commonJS({
|
|
|
16316
16509
|
reqcc: this._reqcc
|
|
16317
16510
|
};
|
|
16318
16511
|
}
|
|
16512
|
+
/**
|
|
16513
|
+
* Headers for sending to the origin server to revalidate stale response.
|
|
16514
|
+
* Allows server to return 304 to allow reuse of the previous response.
|
|
16515
|
+
*
|
|
16516
|
+
* Hop by hop headers are always stripped.
|
|
16517
|
+
* Revalidation headers may be added or removed, depending on request.
|
|
16518
|
+
*/
|
|
16319
16519
|
revalidationHeaders(incomingReq) {
|
|
16320
16520
|
this._assertRequestHasHeaders(incomingReq);
|
|
16321
16521
|
const headers = this._copyWithoutHopByHopHeaders(incomingReq.headers);
|
|
@@ -16346,6 +16546,15 @@ var require_http_cache_semantics = __commonJS({
|
|
|
16346
16546
|
}
|
|
16347
16547
|
return headers;
|
|
16348
16548
|
}
|
|
16549
|
+
/**
|
|
16550
|
+
* Creates new CachePolicy with information combined from the previews response,
|
|
16551
|
+
* and the new revalidation response.
|
|
16552
|
+
*
|
|
16553
|
+
* Returns {policy, modified} where modified is a boolean indicating
|
|
16554
|
+
* whether the response body has been modified, and old cached body can't be used.
|
|
16555
|
+
*
|
|
16556
|
+
* @return {Object} {policy: CachePolicy, modified: Boolean}
|
|
16557
|
+
*/
|
|
16349
16558
|
revalidatedPolicy(request, response) {
|
|
16350
16559
|
this._assertRequestHasHeaders(request);
|
|
16351
16560
|
if (this._useStaleIfError() && isErrorResponse(response)) {
|
|
@@ -16375,6 +16584,9 @@ var require_http_cache_semantics = __commonJS({
|
|
|
16375
16584
|
if (!matches) {
|
|
16376
16585
|
return {
|
|
16377
16586
|
policy: new this.constructor(request, response),
|
|
16587
|
+
// Client receiving 304 without body, even if it's invalid/mismatched has no option
|
|
16588
|
+
// but to reuse a cached body. We don't have a good way to tell clients to do
|
|
16589
|
+
// error recovery in such case.
|
|
16378
16590
|
modified: response.status != 304,
|
|
16379
16591
|
matches: false
|
|
16380
16592
|
};
|
|
@@ -17206,6 +17418,7 @@ var require_agent = __commonJS({
|
|
|
17206
17418
|
var kOriginSet = Symbol("cachedOriginSet");
|
|
17207
17419
|
var kGracefullyClosing = Symbol("gracefullyClosing");
|
|
17208
17420
|
var nameKeys = [
|
|
17421
|
+
// `http2.connect()` options
|
|
17209
17422
|
"maxDeflateDynamicTableSize",
|
|
17210
17423
|
"maxSessionMemory",
|
|
17211
17424
|
"maxHeaderListPairs",
|
|
@@ -17213,10 +17426,12 @@ var require_agent = __commonJS({
|
|
|
17213
17426
|
"maxReservedRemoteStreams",
|
|
17214
17427
|
"maxSendHeaderBlockLength",
|
|
17215
17428
|
"paddingStrategy",
|
|
17429
|
+
// `tls.connect()` options
|
|
17216
17430
|
"localAddress",
|
|
17217
17431
|
"path",
|
|
17218
17432
|
"rejectUnauthorized",
|
|
17219
17433
|
"minDHSize",
|
|
17434
|
+
// `tls.createSecureContext()` options
|
|
17220
17435
|
"ca",
|
|
17221
17436
|
"cert",
|
|
17222
17437
|
"clientCertEngine",
|
|
@@ -17252,7 +17467,12 @@ var require_agent = __commonJS({
|
|
|
17252
17467
|
};
|
|
17253
17468
|
var closeCoveredSessions = (where, session) => {
|
|
17254
17469
|
for (const coveredSession of where) {
|
|
17255
|
-
if (
|
|
17470
|
+
if (
|
|
17471
|
+
// The set is a proper subset when its length is less than the other set.
|
|
17472
|
+
coveredSession[kOriginSet].length < session[kOriginSet].length && // And the other set includes all elements of the subset.
|
|
17473
|
+
coveredSession[kOriginSet].every((origin) => session[kOriginSet].includes(origin)) && // Makes sure that the session can handle all requests from the covered session.
|
|
17474
|
+
coveredSession[kCurrentStreamsCount] + session[kCurrentStreamsCount] <= session.remoteSettings.maxConcurrentStreams
|
|
17475
|
+
) {
|
|
17256
17476
|
gracefullyClose(coveredSession);
|
|
17257
17477
|
}
|
|
17258
17478
|
}
|
|
@@ -17357,7 +17577,9 @@ var require_agent = __commonJS({
|
|
|
17357
17577
|
}
|
|
17358
17578
|
if (session[kOriginSet].includes(normalizedOrigin)) {
|
|
17359
17579
|
const sessionCurrentStreamsCount = session[kCurrentStreamsCount];
|
|
17360
|
-
if (sessionCurrentStreamsCount >= sessionMaxConcurrentStreams || session[kGracefullyClosing] ||
|
|
17580
|
+
if (sessionCurrentStreamsCount >= sessionMaxConcurrentStreams || session[kGracefullyClosing] || // Unfortunately the `close` event isn't called immediately,
|
|
17581
|
+
// so `session.destroyed` is `true`, but `session.closed` is `false`.
|
|
17582
|
+
session.destroyed) {
|
|
17361
17583
|
continue;
|
|
17362
17584
|
}
|
|
17363
17585
|
if (!optimalSession) {
|
|
@@ -18915,6 +19137,7 @@ var require_core = __commonJS({
|
|
|
18915
19137
|
"beforeRedirect",
|
|
18916
19138
|
"beforeError",
|
|
18917
19139
|
"beforeRetry",
|
|
19140
|
+
// Promise-Only
|
|
18918
19141
|
"afterResponse"
|
|
18919
19142
|
];
|
|
18920
19143
|
function validateSearchParameters(searchParameters) {
|
|
@@ -18963,6 +19186,7 @@ var require_core = __commonJS({
|
|
|
18963
19186
|
writable: true,
|
|
18964
19187
|
configurable: true,
|
|
18965
19188
|
enumerable: false,
|
|
19189
|
+
// @ts-expect-error TS doesn't see the check above
|
|
18966
19190
|
value: source[name]
|
|
18967
19191
|
};
|
|
18968
19192
|
}
|
|
@@ -18986,11 +19210,15 @@ var require_core = __commonJS({
|
|
|
18986
19210
|
value: self[kResponse]
|
|
18987
19211
|
});
|
|
18988
19212
|
Object.defineProperty(this, "options", {
|
|
19213
|
+
// This fails because of TS 3.7.2 useDefineForClassFields
|
|
19214
|
+
// Ref: https://github.com/microsoft/TypeScript/issues/34972
|
|
18989
19215
|
enumerable: false,
|
|
18990
19216
|
value: self.options
|
|
18991
19217
|
});
|
|
18992
19218
|
} else {
|
|
18993
19219
|
Object.defineProperty(this, "options", {
|
|
19220
|
+
// This fails because of TS 3.7.2 useDefineForClassFields
|
|
19221
|
+
// Ref: https://github.com/microsoft/TypeScript/issues/34972
|
|
18994
19222
|
enumerable: false,
|
|
18995
19223
|
value: self
|
|
18996
19224
|
});
|
|
@@ -19076,7 +19304,10 @@ var require_core = __commonJS({
|
|
|
19076
19304
|
var Request = class extends stream_1.Duplex {
|
|
19077
19305
|
constructor(url, options = {}, defaults) {
|
|
19078
19306
|
super({
|
|
19307
|
+
// This must be false, to enable throwing after destroy
|
|
19308
|
+
// It is used for retry logic in Promise API
|
|
19079
19309
|
autoDestroy: false,
|
|
19310
|
+
// It needs to be zero because we're just proxying the data to another stream
|
|
19080
19311
|
highWaterMark: 0
|
|
19081
19312
|
});
|
|
19082
19313
|
this[kDownloadedSize] = 0;
|
|
@@ -19974,6 +20205,7 @@ var require_core = __commonJS({
|
|
|
19974
20205
|
}
|
|
19975
20206
|
}
|
|
19976
20207
|
}
|
|
20208
|
+
// Node.js 12 has incorrect types, so the encoding must be a string
|
|
19977
20209
|
_write(chunk, encoding, callback) {
|
|
19978
20210
|
const write = () => {
|
|
19979
20211
|
this._writeRequest(chunk, encoding, callback);
|
|
@@ -20048,10 +20280,16 @@ var require_core = __commonJS({
|
|
|
20048
20280
|
get _isAboutToError() {
|
|
20049
20281
|
return this[kStopReading];
|
|
20050
20282
|
}
|
|
20283
|
+
/**
|
|
20284
|
+
The remote IP address.
|
|
20285
|
+
*/
|
|
20051
20286
|
get ip() {
|
|
20052
20287
|
var _a;
|
|
20053
20288
|
return (_a = this.socket) === null || _a === void 0 ? void 0 : _a.remoteAddress;
|
|
20054
20289
|
}
|
|
20290
|
+
/**
|
|
20291
|
+
Indicates whether the request has been aborted or not.
|
|
20292
|
+
*/
|
|
20055
20293
|
get aborted() {
|
|
20056
20294
|
var _a, _b, _c;
|
|
20057
20295
|
return ((_b = (_a = this[kRequest]) === null || _a === void 0 ? void 0 : _a.destroyed) !== null && _b !== void 0 ? _b : this.destroyed) && !((_c = this[kOriginalResponse]) === null || _c === void 0 ? void 0 : _c.complete);
|
|
@@ -20060,6 +20298,9 @@ var require_core = __commonJS({
|
|
|
20060
20298
|
var _a, _b;
|
|
20061
20299
|
return (_b = (_a = this[kRequest]) === null || _a === void 0 ? void 0 : _a.socket) !== null && _b !== void 0 ? _b : void 0;
|
|
20062
20300
|
}
|
|
20301
|
+
/**
|
|
20302
|
+
Progress event for downloading (receiving a response).
|
|
20303
|
+
*/
|
|
20063
20304
|
get downloadProgress() {
|
|
20064
20305
|
let percent;
|
|
20065
20306
|
if (this[kResponseSize]) {
|
|
@@ -20075,6 +20316,9 @@ var require_core = __commonJS({
|
|
|
20075
20316
|
total: this[kResponseSize]
|
|
20076
20317
|
};
|
|
20077
20318
|
}
|
|
20319
|
+
/**
|
|
20320
|
+
Progress event for uploading (sending a request).
|
|
20321
|
+
*/
|
|
20078
20322
|
get uploadProgress() {
|
|
20079
20323
|
let percent;
|
|
20080
20324
|
if (this[kBodySize]) {
|
|
@@ -20090,10 +20334,40 @@ var require_core = __commonJS({
|
|
|
20090
20334
|
total: this[kBodySize]
|
|
20091
20335
|
};
|
|
20092
20336
|
}
|
|
20337
|
+
/**
|
|
20338
|
+
The object contains the following properties:
|
|
20339
|
+
|
|
20340
|
+
- `start` - Time when the request started.
|
|
20341
|
+
- `socket` - Time when a socket was assigned to the request.
|
|
20342
|
+
- `lookup` - Time when the DNS lookup finished.
|
|
20343
|
+
- `connect` - Time when the socket successfully connected.
|
|
20344
|
+
- `secureConnect` - Time when the socket securely connected.
|
|
20345
|
+
- `upload` - Time when the request finished uploading.
|
|
20346
|
+
- `response` - Time when the request fired `response` event.
|
|
20347
|
+
- `end` - Time when the response fired `end` event.
|
|
20348
|
+
- `error` - Time when the request fired `error` event.
|
|
20349
|
+
- `abort` - Time when the request fired `abort` event.
|
|
20350
|
+
- `phases`
|
|
20351
|
+
- `wait` - `timings.socket - timings.start`
|
|
20352
|
+
- `dns` - `timings.lookup - timings.socket`
|
|
20353
|
+
- `tcp` - `timings.connect - timings.lookup`
|
|
20354
|
+
- `tls` - `timings.secureConnect - timings.connect`
|
|
20355
|
+
- `request` - `timings.upload - (timings.secureConnect || timings.connect)`
|
|
20356
|
+
- `firstByte` - `timings.response - timings.upload`
|
|
20357
|
+
- `download` - `timings.end - timings.response`
|
|
20358
|
+
- `total` - `(timings.end || timings.error || timings.abort) - timings.start`
|
|
20359
|
+
|
|
20360
|
+
If something has not been measured yet, it will be `undefined`.
|
|
20361
|
+
|
|
20362
|
+
__Note__: The time is a `number` representing the milliseconds elapsed since the UNIX epoch.
|
|
20363
|
+
*/
|
|
20093
20364
|
get timings() {
|
|
20094
20365
|
var _a;
|
|
20095
20366
|
return (_a = this[kRequest]) === null || _a === void 0 ? void 0 : _a.timings;
|
|
20096
20367
|
}
|
|
20368
|
+
/**
|
|
20369
|
+
Whether the response was retrieved from the cache.
|
|
20370
|
+
*/
|
|
20097
20371
|
get isFromCache() {
|
|
20098
20372
|
return this[kIsFromCache];
|
|
20099
20373
|
}
|
|
@@ -20740,6 +21014,7 @@ var require_source5 = __commonJS({
|
|
|
20740
21014
|
methodRewriting: true,
|
|
20741
21015
|
ignoreInvalidCookies: false,
|
|
20742
21016
|
context: {},
|
|
21017
|
+
// TODO: Set this to `true` when Got 12 gets released
|
|
20743
21018
|
http2: false,
|
|
20744
21019
|
allowGetBody: false,
|
|
20745
21020
|
https: void 0,
|