@datadog/datadog-ci-plugin-container-app 5.22.0 → 5.22.1
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/bundle.js +629 -158
- package/dist/bundle.js.map +1 -1
- package/package.json +2 -2
package/dist/bundle.js
CHANGED
|
@@ -53125,7 +53125,7 @@ var require_source$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
53125
53125
|
var require_package$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
53126
53126
|
module.exports = {
|
|
53127
53127
|
"name": "@datadog/datadog-ci-base",
|
|
53128
|
-
"version": "5.22.
|
|
53128
|
+
"version": "5.22.1",
|
|
53129
53129
|
"description": "Base package for Datadog CI",
|
|
53130
53130
|
"license": "Apache-2.0",
|
|
53131
53131
|
"keywords": ["datadog", "datadog-ci"],
|
|
@@ -53227,7 +53227,7 @@ var require_package$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
53227
53227
|
"inquirer": "^8.2.7",
|
|
53228
53228
|
"is-docker": "^4.0.0",
|
|
53229
53229
|
"jest-diff": "^30.2.0",
|
|
53230
|
-
"js-yaml": "^4.
|
|
53230
|
+
"js-yaml": "^4.3.1",
|
|
53231
53231
|
"jszip": "^3.10.1",
|
|
53232
53232
|
"proxy-agent": "^6.4.0",
|
|
53233
53233
|
"semver": "^7.6.3",
|
|
@@ -53235,7 +53235,7 @@ var require_package$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
53235
53235
|
"terminal-link": "^2.1.1",
|
|
53236
53236
|
"tiny-async-pool": "^2.1.0",
|
|
53237
53237
|
"typanion": "^3.14.0",
|
|
53238
|
-
"undici": "^7.
|
|
53238
|
+
"undici": "^7.29.0",
|
|
53239
53239
|
"upath": "^2.0.1"
|
|
53240
53240
|
},
|
|
53241
53241
|
"devDependencies": {
|
|
@@ -84282,12 +84282,19 @@ var require_request$2 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
84282
84282
|
arr.push(val[i]);
|
|
84283
84283
|
} else if (val[i] === null) arr.push("");
|
|
84284
84284
|
else if (typeof val[i] === "object") throw new InvalidArgumentError(`invalid ${key} header`);
|
|
84285
|
-
else
|
|
84285
|
+
else {
|
|
84286
|
+
const str = `${val[i]}`;
|
|
84287
|
+
if (!isValidHeaderValue(str)) throw new InvalidArgumentError(`invalid ${key} header`);
|
|
84288
|
+
arr.push(str);
|
|
84289
|
+
}
|
|
84286
84290
|
val = arr;
|
|
84287
84291
|
} else if (typeof val === "string") {
|
|
84288
84292
|
if (!isValidHeaderValue(val)) throw new InvalidArgumentError(`invalid ${key} header`);
|
|
84289
84293
|
} else if (val === null) val = "";
|
|
84290
|
-
else
|
|
84294
|
+
else {
|
|
84295
|
+
val = `${val}`;
|
|
84296
|
+
if (!isValidHeaderValue(val)) throw new InvalidArgumentError(`invalid ${key} header`);
|
|
84297
|
+
}
|
|
84291
84298
|
if (headerName === "host") {
|
|
84292
84299
|
if (request.host !== null) throw new InvalidArgumentError("duplicate host header");
|
|
84293
84300
|
if (typeof val !== "string") throw new InvalidArgumentError("invalid host header");
|
|
@@ -88065,7 +88072,7 @@ var require_client_h1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
88065
88072
|
const util = require_util$6();
|
|
88066
88073
|
const { channels } = require_diagnostics();
|
|
88067
88074
|
const timers = require_timers();
|
|
88068
|
-
const { RequestContentLengthMismatchError, ResponseContentLengthMismatchError, RequestAbortedError, HeadersTimeoutError, HeadersOverflowError, SocketError, InformationalError, BodyTimeoutError, HTTPParserError, ResponseExceededMaxSizeError } = require_errors$1();
|
|
88075
|
+
const { RequestContentLengthMismatchError, ResponseContentLengthMismatchError, RequestAbortedError, InvalidArgumentError, HeadersTimeoutError, HeadersOverflowError, SocketError, InformationalError, BodyTimeoutError, HTTPParserError, ResponseExceededMaxSizeError } = require_errors$1();
|
|
88069
88076
|
const { kUrl, kReset, kClient, kParser, kBlocking, kRunning, kPending, kSize, kWriting, kQueue, kNoRef, kKeepAliveDefaultTimeout, kHostHeader, kPendingIdx, kRunningIdx, kError, kPipelining, kSocket, kKeepAliveTimeoutValue, kMaxHeadersSize, kKeepAliveMaxTimeout, kKeepAliveTimeoutThreshold, kHeadersTimeout, kBodyTimeout, kStrictContentLength, kMaxRequests, kCounter, kMaxResponseSize, kOnError, kResume, kHTTPContext, kClosed } = require_symbols();
|
|
88070
88077
|
const constants = require_constants$3();
|
|
88071
88078
|
const EMPTY_BUF = Buffer.alloc(0);
|
|
@@ -88715,7 +88722,17 @@ var require_client_h1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
88715
88722
|
if (request.contentType == null) headers.push("content-type", contentType);
|
|
88716
88723
|
body = bodyStream.stream;
|
|
88717
88724
|
contentLength = bodyStream.length;
|
|
88718
|
-
} else if (util.isBlobLike(body) && request.contentType == null
|
|
88725
|
+
} else if (util.isBlobLike(body) && request.contentType == null) {
|
|
88726
|
+
const contentType = body.type;
|
|
88727
|
+
if (contentType) {
|
|
88728
|
+
const contentTypeValue = `${contentType}`;
|
|
88729
|
+
if (!util.isValidHeaderValue(contentTypeValue)) {
|
|
88730
|
+
util.errorRequest(client, request, new InvalidArgumentError("invalid content-type header"));
|
|
88731
|
+
return false;
|
|
88732
|
+
}
|
|
88733
|
+
headers.push("content-type", contentTypeValue);
|
|
88734
|
+
}
|
|
88735
|
+
}
|
|
88719
88736
|
if (body && typeof body.read === "function") body.read(0);
|
|
88720
88737
|
const bodyLength = util.bodyLength(body);
|
|
88721
88738
|
contentLength = bodyLength ?? contentLength;
|
|
@@ -91519,6 +91536,17 @@ var require_retry_handler = /* @__PURE__ */ __commonJSMin(((exports, module) =>
|
|
|
91519
91536
|
const retryTime = new Date(retryAfter).getTime();
|
|
91520
91537
|
return isNaN(retryTime) ? 0 : retryTime - Date.now();
|
|
91521
91538
|
}
|
|
91539
|
+
function validatePartialResponseContentLength(headers, range, statusCode, retryCount) {
|
|
91540
|
+
const contentLength = headers["content-length"];
|
|
91541
|
+
if (contentLength == null) return;
|
|
91542
|
+
if (!Number.isFinite(range.start) || !Number.isFinite(range.end)) return;
|
|
91543
|
+
const length = Number(contentLength);
|
|
91544
|
+
const expectedLength = range.end - range.start + 1;
|
|
91545
|
+
if (!Number.isFinite(length) || length !== expectedLength) throw new RequestRetryError("Content-Length mismatch", statusCode, {
|
|
91546
|
+
headers,
|
|
91547
|
+
data: { count: retryCount }
|
|
91548
|
+
});
|
|
91549
|
+
}
|
|
91522
91550
|
module.exports = class RetryHandler {
|
|
91523
91551
|
constructor(opts, { dispatch, handler }) {
|
|
91524
91552
|
const { retryOptions, ...dispatchOpts } = opts;
|
|
@@ -91664,6 +91692,7 @@ var require_retry_handler = /* @__PURE__ */ __commonJSMin(((exports, module) =>
|
|
|
91664
91692
|
headers,
|
|
91665
91693
|
data: { count: this.retryCount }
|
|
91666
91694
|
});
|
|
91695
|
+
validatePartialResponseContentLength(headers, contentRange, statusCode, this.retryCount);
|
|
91667
91696
|
const { start, size, end = size ? size - 1 : null } = contentRange;
|
|
91668
91697
|
assert$20(this.start === start, "content-range mismatch");
|
|
91669
91698
|
assert$20(this.end == null || this.end === end, "content-range mismatch");
|
|
@@ -91677,6 +91706,7 @@ var require_retry_handler = /* @__PURE__ */ __commonJSMin(((exports, module) =>
|
|
|
91677
91706
|
this.handler.onResponseStart?.(controller, statusCode, headers, statusMessage);
|
|
91678
91707
|
return;
|
|
91679
91708
|
}
|
|
91709
|
+
validatePartialResponseContentLength(headers, range, statusCode, this.retryCount);
|
|
91680
91710
|
const { start, size, end = size ? size - 1 : null } = range;
|
|
91681
91711
|
assert$20(start != null && Number.isFinite(start), "content-range mismatch");
|
|
91682
91712
|
assert$20(end != null && Number.isFinite(end), "invalid content-length");
|
|
@@ -95309,8 +95339,100 @@ var require_dns = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
95309
95339
|
//#endregion
|
|
95310
95340
|
//#region ../../node_modules/undici/lib/util/cache.js
|
|
95311
95341
|
var require_cache$2 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
95312
|
-
const { safeHTTPMethods, pathHasQueryOrFragment, hasSafeIterator } = require_util$6();
|
|
95342
|
+
const { safeHTTPMethods, pathHasQueryOrFragment, hasSafeIterator, isValidHTTPToken } = require_util$6();
|
|
95313
95343
|
const { serializePathWithQuery } = require_util$6();
|
|
95344
|
+
const MAX_DELTA_SECONDS = 2147483647;
|
|
95345
|
+
const RESTRICTIVE_DIRECTIVE_NAMES = [
|
|
95346
|
+
"no-store",
|
|
95347
|
+
"private",
|
|
95348
|
+
"no-cache"
|
|
95349
|
+
];
|
|
95350
|
+
const kInvalidCacheControlDirectives = Symbol("invalid cache-control directives");
|
|
95351
|
+
function trimOWS(value) {
|
|
95352
|
+
return value.replace(/^[\t ]+|[\t ]+$/g, "");
|
|
95353
|
+
}
|
|
95354
|
+
function arrayIncludes(array, value) {
|
|
95355
|
+
for (let i = 0; i < array.length; i++) if (array[i] === value) return true;
|
|
95356
|
+
return false;
|
|
95357
|
+
}
|
|
95358
|
+
function trimOWSStart(value) {
|
|
95359
|
+
return value.replace(/^[\t ]+/, "");
|
|
95360
|
+
}
|
|
95361
|
+
function trimOWSEnd(value) {
|
|
95362
|
+
return value.replace(/[\t ]+$/, "");
|
|
95363
|
+
}
|
|
95364
|
+
function findUnescapedQuote(value, start) {
|
|
95365
|
+
let escaped = false;
|
|
95366
|
+
for (let i = start; i < value.length; i++) if (escaped) escaped = false;
|
|
95367
|
+
else if (value[i] === "\\") escaped = true;
|
|
95368
|
+
else if (value[i] === "\"") return i;
|
|
95369
|
+
return -1;
|
|
95370
|
+
}
|
|
95371
|
+
function splitCacheControlHeaderValue(value) {
|
|
95372
|
+
const directives = [];
|
|
95373
|
+
let start = 0;
|
|
95374
|
+
let quoteStart = -1;
|
|
95375
|
+
let inQuote = false;
|
|
95376
|
+
let escaped = false;
|
|
95377
|
+
for (let i = 0; i < value.length; i++) if (inQuote) {
|
|
95378
|
+
if (escaped) escaped = false;
|
|
95379
|
+
else if (value[i] === "\\") escaped = true;
|
|
95380
|
+
else if (value[i] === "\"") {
|
|
95381
|
+
inQuote = false;
|
|
95382
|
+
quoteStart = -1;
|
|
95383
|
+
}
|
|
95384
|
+
} else if (value[i] === "\"") {
|
|
95385
|
+
inQuote = true;
|
|
95386
|
+
quoteStart = i;
|
|
95387
|
+
} else if (value[i] === ",") {
|
|
95388
|
+
directives.push({
|
|
95389
|
+
value: value.substring(start, i),
|
|
95390
|
+
fromMalformedQuote: false
|
|
95391
|
+
});
|
|
95392
|
+
start = i + 1;
|
|
95393
|
+
}
|
|
95394
|
+
if (!inQuote) {
|
|
95395
|
+
directives.push({
|
|
95396
|
+
value: value.substring(start),
|
|
95397
|
+
fromMalformedQuote: false
|
|
95398
|
+
});
|
|
95399
|
+
return directives;
|
|
95400
|
+
}
|
|
95401
|
+
const tail = value.substring(start);
|
|
95402
|
+
const quoteOffset = quoteStart - start;
|
|
95403
|
+
let tailStart = 0;
|
|
95404
|
+
for (let i = 0; i < tail.length; i++) if (tail[i] === ",") {
|
|
95405
|
+
directives.push({
|
|
95406
|
+
value: tail.substring(tailStart, i),
|
|
95407
|
+
fromMalformedQuote: tailStart > quoteOffset
|
|
95408
|
+
});
|
|
95409
|
+
tailStart = i + 1;
|
|
95410
|
+
}
|
|
95411
|
+
directives.push({
|
|
95412
|
+
value: tail.substring(tailStart),
|
|
95413
|
+
fromMalformedQuote: tailStart > quoteOffset
|
|
95414
|
+
});
|
|
95415
|
+
return directives;
|
|
95416
|
+
}
|
|
95417
|
+
function markInvalidCacheControlDirective(directives, key) {
|
|
95418
|
+
let invalidDirectives = directives[kInvalidCacheControlDirectives];
|
|
95419
|
+
if (invalidDirectives === void 0) {
|
|
95420
|
+
invalidDirectives = /* @__PURE__ */ new Set();
|
|
95421
|
+
Object.defineProperty(directives, kInvalidCacheControlDirectives, { value: invalidDirectives });
|
|
95422
|
+
}
|
|
95423
|
+
invalidDirectives.add(key);
|
|
95424
|
+
}
|
|
95425
|
+
function hasInvalidCacheControlDirective(directives, key) {
|
|
95426
|
+
return directives[kInvalidCacheControlDirectives]?.has(key) === true;
|
|
95427
|
+
}
|
|
95428
|
+
function getMalformedRestrictiveDirectiveName(key) {
|
|
95429
|
+
for (const directiveName of RESTRICTIVE_DIRECTIVE_NAMES) if (key.startsWith(directiveName) && key.length > directiveName.length && !isValidHTTPToken(key[directiveName.length])) return directiveName;
|
|
95430
|
+
let tokenOnlyKey = "";
|
|
95431
|
+
let hasInvalidTokenChar = false;
|
|
95432
|
+
for (let i = 0; i < key.length; i++) if (isValidHTTPToken(key[i])) tokenOnlyKey += key[i];
|
|
95433
|
+
else hasInvalidTokenChar = true;
|
|
95434
|
+
if (hasInvalidTokenChar && arrayIncludes(RESTRICTIVE_DIRECTIVE_NAMES, tokenOnlyKey)) return tokenOnlyKey;
|
|
95435
|
+
}
|
|
95314
95436
|
/**
|
|
95315
95437
|
* @param {import('../../types/dispatcher.d.ts').default.DispatchOptions} opts
|
|
95316
95438
|
*/
|
|
@@ -95325,6 +95447,14 @@ var require_cache$2 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
95325
95447
|
headers: opts.headers
|
|
95326
95448
|
};
|
|
95327
95449
|
}
|
|
95450
|
+
function appendHeader(headers, key, val) {
|
|
95451
|
+
const headerName = key.toLowerCase();
|
|
95452
|
+
const current = headers[headerName];
|
|
95453
|
+
const values = Array.isArray(val) ? val : [val];
|
|
95454
|
+
if (current === void 0) headers[headerName] = Array.isArray(val) ? val.slice() : val;
|
|
95455
|
+
else if (Array.isArray(current)) current.push(...values);
|
|
95456
|
+
else headers[headerName] = [current, ...values];
|
|
95457
|
+
}
|
|
95328
95458
|
/**
|
|
95329
95459
|
* @param {Record<string, string[] | string>}
|
|
95330
95460
|
* @returns {Record<string, string[] | string>}
|
|
@@ -95338,9 +95468,9 @@ var require_cache$2 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
95338
95468
|
if (!Array.isArray(x)) throw new Error("opts.headers is not a valid header map");
|
|
95339
95469
|
const [key, val] = x;
|
|
95340
95470
|
if (typeof key !== "string" || typeof val !== "string") throw new Error("opts.headers is not a valid header map");
|
|
95341
|
-
headers
|
|
95471
|
+
appendHeader(headers, key, val);
|
|
95342
95472
|
}
|
|
95343
|
-
else for (const key of Object.keys(opts.headers)) headers
|
|
95473
|
+
else for (const key of Object.keys(opts.headers)) appendHeader(headers, key, opts.headers[key]);
|
|
95344
95474
|
} else throw new Error("opts.headers is not an object");
|
|
95345
95475
|
return headers;
|
|
95346
95476
|
}
|
|
@@ -95384,20 +95514,31 @@ var require_cache$2 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
95384
95514
|
* @type {import('../../types/cache-interceptor.d.ts').default.CacheControlDirectives}
|
|
95385
95515
|
*/
|
|
95386
95516
|
const output = {};
|
|
95387
|
-
|
|
95388
|
-
|
|
95389
|
-
|
|
95390
|
-
for (const directive of header) directives.push(...directive.split(","));
|
|
95391
|
-
} else directives = header.split(",");
|
|
95517
|
+
const invalidNumericDirectives = /* @__PURE__ */ new Set();
|
|
95518
|
+
const invalidNoArgumentDirectives = /* @__PURE__ */ new Set();
|
|
95519
|
+
const directives = splitCacheControlHeaderValue(Array.isArray(header) ? header.join(",") : header);
|
|
95392
95520
|
for (let i = 0; i < directives.length; i++) {
|
|
95393
|
-
const
|
|
95521
|
+
const directiveRecord = directives[i];
|
|
95522
|
+
const directive = directiveRecord.value.toLowerCase();
|
|
95523
|
+
const fromMalformedQuote = directiveRecord.fromMalformedQuote;
|
|
95394
95524
|
const keyValueDelimiter = directive.indexOf("=");
|
|
95395
95525
|
let key;
|
|
95396
95526
|
let value;
|
|
95527
|
+
let keyHasTrailingWhitespace = false;
|
|
95528
|
+
let valueHasLeadingWhitespace = false;
|
|
95397
95529
|
if (keyValueDelimiter !== -1) {
|
|
95398
|
-
|
|
95399
|
-
|
|
95400
|
-
|
|
95530
|
+
const rawKey = directive.substring(0, keyValueDelimiter);
|
|
95531
|
+
const rawValue = directive.substring(keyValueDelimiter + 1);
|
|
95532
|
+
keyHasTrailingWhitespace = trimOWSEnd(rawKey) !== rawKey;
|
|
95533
|
+
valueHasLeadingWhitespace = trimOWSStart(rawValue) !== rawValue;
|
|
95534
|
+
key = trimOWS(rawKey);
|
|
95535
|
+
value = trimOWSStart(rawValue);
|
|
95536
|
+
} else key = trimOWS(directive);
|
|
95537
|
+
const malformedRestrictiveDirectiveName = getMalformedRestrictiveDirectiveName(key);
|
|
95538
|
+
if (malformedRestrictiveDirectiveName !== void 0) {
|
|
95539
|
+
output[malformedRestrictiveDirectiveName] = true;
|
|
95540
|
+
continue;
|
|
95541
|
+
}
|
|
95401
95542
|
switch (key) {
|
|
95402
95543
|
case "min-fresh":
|
|
95403
95544
|
case "max-stale":
|
|
@@ -95405,54 +95546,99 @@ var require_cache$2 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
95405
95546
|
case "s-maxage":
|
|
95406
95547
|
case "stale-while-revalidate":
|
|
95407
95548
|
case "stale-if-error": {
|
|
95408
|
-
if (
|
|
95549
|
+
if (fromMalformedQuote || invalidNumericDirectives.has(key)) continue;
|
|
95550
|
+
if (value === void 0 || keyHasTrailingWhitespace || valueHasLeadingWhitespace) {
|
|
95551
|
+
delete output[key];
|
|
95552
|
+
invalidNumericDirectives.add(key);
|
|
95553
|
+
markInvalidCacheControlDirective(output, key);
|
|
95554
|
+
continue;
|
|
95555
|
+
}
|
|
95409
95556
|
if (value.length >= 2 && value[0] === "\"" && value[value.length - 1] === "\"") value = value.substring(1, value.length - 1);
|
|
95410
|
-
|
|
95411
|
-
|
|
95412
|
-
|
|
95413
|
-
|
|
95557
|
+
if (!/^[0-9]+$/.test(value)) {
|
|
95558
|
+
delete output[key];
|
|
95559
|
+
invalidNumericDirectives.add(key);
|
|
95560
|
+
markInvalidCacheControlDirective(output, key);
|
|
95561
|
+
continue;
|
|
95562
|
+
}
|
|
95563
|
+
const parsedValue = Math.min(parseInt(value, 10), MAX_DELTA_SECONDS);
|
|
95564
|
+
if (key === "min-fresh") {
|
|
95565
|
+
if (!(key in output) || output[key] < parsedValue) output[key] = parsedValue;
|
|
95566
|
+
} else if (!(key in output) || output[key] > parsedValue) output[key] = parsedValue;
|
|
95414
95567
|
break;
|
|
95415
95568
|
}
|
|
95416
95569
|
case "private":
|
|
95417
|
-
case "no-cache":
|
|
95418
|
-
if (
|
|
95419
|
-
|
|
95420
|
-
|
|
95421
|
-
|
|
95422
|
-
|
|
95423
|
-
|
|
95424
|
-
|
|
95425
|
-
|
|
95570
|
+
case "no-cache":
|
|
95571
|
+
if (fromMalformedQuote) {
|
|
95572
|
+
output[key] = true;
|
|
95573
|
+
break;
|
|
95574
|
+
}
|
|
95575
|
+
if (value !== void 0 && value.length === 0) {
|
|
95576
|
+
output[key] = true;
|
|
95577
|
+
break;
|
|
95578
|
+
}
|
|
95579
|
+
if (value) {
|
|
95580
|
+
if (value[0] === "\"") {
|
|
95581
|
+
value = trimOWSEnd(value);
|
|
95582
|
+
let fieldList = "";
|
|
95583
|
+
let lastQuotedPart = i;
|
|
95584
|
+
let foundEndingQuote = false;
|
|
95585
|
+
const closingQuote = findUnescapedQuote(value, 1);
|
|
95586
|
+
if (closingQuote !== -1) {
|
|
95587
|
+
fieldList = value.substring(1, closingQuote);
|
|
95426
95588
|
foundEndingQuote = true;
|
|
95589
|
+
} else {
|
|
95590
|
+
const fieldListParts = [value.substring(1)];
|
|
95591
|
+
for (let j = i + 1; j < directives.length; j++) {
|
|
95592
|
+
const nextPart = trimOWS(directives[j].value);
|
|
95593
|
+
const closingQuote = findUnescapedQuote(nextPart, 0);
|
|
95594
|
+
lastQuotedPart = j;
|
|
95595
|
+
if (closingQuote !== -1) {
|
|
95596
|
+
fieldListParts.push(nextPart.substring(0, closingQuote));
|
|
95597
|
+
foundEndingQuote = true;
|
|
95598
|
+
break;
|
|
95599
|
+
}
|
|
95600
|
+
fieldListParts.push(nextPart);
|
|
95601
|
+
}
|
|
95602
|
+
fieldList = fieldListParts.join(",");
|
|
95603
|
+
}
|
|
95604
|
+
if (!foundEndingQuote) {
|
|
95605
|
+
output[key] = true;
|
|
95427
95606
|
break;
|
|
95428
95607
|
}
|
|
95429
|
-
|
|
95430
|
-
|
|
95431
|
-
let
|
|
95432
|
-
|
|
95433
|
-
|
|
95434
|
-
headers[
|
|
95608
|
+
i = lastQuotedPart;
|
|
95609
|
+
const headers = fieldList.split(",");
|
|
95610
|
+
let validFieldNames = true;
|
|
95611
|
+
for (let j = 0; j < headers.length; j++) {
|
|
95612
|
+
headers[j] = trimOWS(headers[j]);
|
|
95613
|
+
if (!isValidHTTPToken(headers[j])) validFieldNames = false;
|
|
95435
95614
|
}
|
|
95436
|
-
|
|
95437
|
-
if (key in output) output[key] = output[key].concat(headers);
|
|
95615
|
+
if (!validFieldNames) output[key] = true;
|
|
95616
|
+
else if (output[key] !== true) if (key in output) output[key] = output[key].concat(headers);
|
|
95438
95617
|
else output[key] = headers;
|
|
95618
|
+
} else {
|
|
95619
|
+
const fieldName = trimOWS(value);
|
|
95620
|
+
if (!isValidHTTPToken(fieldName)) output[key] = true;
|
|
95621
|
+
else if (output[key] !== true) if (key in output) output[key] = output[key].concat(fieldName);
|
|
95622
|
+
else output[key] = [fieldName];
|
|
95439
95623
|
}
|
|
95440
|
-
|
|
95441
|
-
const fieldName = value.trim();
|
|
95442
|
-
if (key in output) output[key] = output[key].concat(fieldName);
|
|
95443
|
-
else output[key] = [fieldName];
|
|
95624
|
+
break;
|
|
95444
95625
|
}
|
|
95445
|
-
break;
|
|
95446
|
-
}
|
|
95447
95626
|
case "public":
|
|
95448
|
-
case "no-store":
|
|
95449
95627
|
case "must-revalidate":
|
|
95450
95628
|
case "proxy-revalidate":
|
|
95451
95629
|
case "immutable":
|
|
95452
95630
|
case "no-transform":
|
|
95453
95631
|
case "must-understand":
|
|
95454
95632
|
case "only-if-cached":
|
|
95455
|
-
if (
|
|
95633
|
+
if (fromMalformedQuote || invalidNoArgumentDirectives.has(key)) continue;
|
|
95634
|
+
if (value !== void 0) {
|
|
95635
|
+
delete output[key];
|
|
95636
|
+
invalidNoArgumentDirectives.add(key);
|
|
95637
|
+
continue;
|
|
95638
|
+
}
|
|
95639
|
+
output[key] = true;
|
|
95640
|
+
break;
|
|
95641
|
+
case "no-store":
|
|
95456
95642
|
output[key] = true;
|
|
95457
95643
|
break;
|
|
95458
95644
|
default: continue;
|
|
@@ -95462,20 +95648,52 @@ var require_cache$2 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
95462
95648
|
}
|
|
95463
95649
|
/**
|
|
95464
95650
|
* @param {string | string[]} varyHeader Vary header from the server
|
|
95651
|
+
* @returns {string[]}
|
|
95652
|
+
*/
|
|
95653
|
+
function splitVaryHeader(varyHeader) {
|
|
95654
|
+
const values = Array.isArray(varyHeader) ? varyHeader : [varyHeader];
|
|
95655
|
+
const output = [];
|
|
95656
|
+
for (let i = 0; i < values.length; i++) {
|
|
95657
|
+
const parts = values[i].split(",");
|
|
95658
|
+
for (let j = 0; j < parts.length; j++) output.push(parts[j]);
|
|
95659
|
+
}
|
|
95660
|
+
return output;
|
|
95661
|
+
}
|
|
95662
|
+
/**
|
|
95663
|
+
* @param {string | string[]} varyHeader Vary header from the server
|
|
95664
|
+
* @returns {boolean}
|
|
95665
|
+
*/
|
|
95666
|
+
function hasVaryStar(varyHeader) {
|
|
95667
|
+
const values = splitVaryHeader(varyHeader);
|
|
95668
|
+
for (let i = 0; i < values.length; i++) if (trimOWS(values[i]).indexOf("*") !== -1) return true;
|
|
95669
|
+
return false;
|
|
95670
|
+
}
|
|
95671
|
+
/**
|
|
95672
|
+
* @param {string | string[]} varyHeader Vary header from the server
|
|
95465
95673
|
* @param {Record<string, string | string[]>} headers Request headers
|
|
95466
|
-
* @returns {Record<string, string | string[]>}
|
|
95674
|
+
* @returns {Record<string, string | string[] | null> | undefined}
|
|
95467
95675
|
*/
|
|
95468
95676
|
function parseVaryHeader(varyHeader, headers) {
|
|
95469
|
-
if (
|
|
95677
|
+
if (hasVaryStar(varyHeader)) return headers;
|
|
95470
95678
|
const output = {};
|
|
95471
|
-
const varyingHeaders =
|
|
95679
|
+
const varyingHeaders = splitVaryHeader(varyHeader);
|
|
95472
95680
|
for (const header of varyingHeaders) {
|
|
95473
|
-
const trimmedHeader = header
|
|
95474
|
-
|
|
95681
|
+
const trimmedHeader = trimOWS(header).toLowerCase();
|
|
95682
|
+
if (trimmedHeader.length === 0) continue;
|
|
95683
|
+
if (!isValidHTTPToken(trimmedHeader)) return;
|
|
95684
|
+
const headerValue = headers[trimmedHeader];
|
|
95685
|
+
output[trimmedHeader] = Array.isArray(headerValue) ? headerValue.slice() : headerValue ?? null;
|
|
95475
95686
|
}
|
|
95476
95687
|
return output;
|
|
95477
95688
|
}
|
|
95478
95689
|
/**
|
|
95690
|
+
* @param {string | string[]} varyHeader Vary header from the server
|
|
95691
|
+
* @returns {boolean}
|
|
95692
|
+
*/
|
|
95693
|
+
function isInvalidOrWildcardVaryHeader(varyHeader) {
|
|
95694
|
+
return hasVaryStar(varyHeader) || parseVaryHeader(varyHeader, {}) === void 0;
|
|
95695
|
+
}
|
|
95696
|
+
/**
|
|
95479
95697
|
* Note: this deviates from the spec a little. Empty etags ("", W/"") are valid,
|
|
95480
95698
|
* however, including them in cached resposnes serves little to no purpose.
|
|
95481
95699
|
*
|
|
@@ -95509,7 +95727,7 @@ var require_cache$2 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
95509
95727
|
function assertCacheMethods(methods, name = "CacheMethods") {
|
|
95510
95728
|
if (!Array.isArray(methods)) throw new TypeError(`expected type of ${name} needs to be an array, got ${methods === null ? "null" : typeof methods}`);
|
|
95511
95729
|
if (methods.length === 0) throw new TypeError(`${name} needs to have at least one method`);
|
|
95512
|
-
for (const method of methods) if (!safeHTTPMethods
|
|
95730
|
+
for (const method of methods) if (!arrayIncludes(safeHTTPMethods, method)) throw new TypeError(`element of ${name}-array needs to be one of following values: ${safeHTTPMethods.join(", ")}, got ${method}`);
|
|
95513
95731
|
}
|
|
95514
95732
|
/**
|
|
95515
95733
|
* Creates a string key for request deduplication purposes.
|
|
@@ -95540,7 +95758,10 @@ var require_cache$2 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
95540
95758
|
assertCacheKey,
|
|
95541
95759
|
assertCacheValue,
|
|
95542
95760
|
parseCacheControlHeader,
|
|
95761
|
+
hasInvalidCacheControlDirective,
|
|
95543
95762
|
parseVaryHeader,
|
|
95763
|
+
hasVaryStar,
|
|
95764
|
+
isInvalidOrWildcardVaryHeader,
|
|
95544
95765
|
isEtagUsable,
|
|
95545
95766
|
assertCacheMethods,
|
|
95546
95767
|
assertCacheStore,
|
|
@@ -95563,6 +95784,11 @@ var require_date = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
95563
95784
|
default: return parseRfc850Date(date);
|
|
95564
95785
|
}
|
|
95565
95786
|
}
|
|
95787
|
+
function makeDate(year, monthIdx, day, hour, minute, second, weekday) {
|
|
95788
|
+
const result = new Date(Date.UTC(year, monthIdx, day, hour, minute, second));
|
|
95789
|
+
if (year >= 0 && year <= 99) result.setUTCFullYear(year);
|
|
95790
|
+
return result.getUTCFullYear() === year && result.getUTCMonth() === monthIdx && result.getUTCDate() === day && result.getUTCHours() === hour && result.getUTCMinutes() === minute && result.getUTCSeconds() === second && result.getUTCDay() === weekday ? result : void 0;
|
|
95791
|
+
}
|
|
95566
95792
|
/**
|
|
95567
95793
|
* @see https://httpwg.org/specs/rfc9110.html#preferred.date.format
|
|
95568
95794
|
*
|
|
@@ -95657,8 +95883,7 @@ var require_date = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
95657
95883
|
if (code2 < 48 || code2 > 57) return;
|
|
95658
95884
|
second = (code1 - 48) * 10 + (code2 - 48);
|
|
95659
95885
|
}
|
|
95660
|
-
|
|
95661
|
-
return result.getUTCDay() === weekday ? result : void 0;
|
|
95886
|
+
return makeDate(year, monthIdx, day, hour, minute, second, weekday);
|
|
95662
95887
|
}
|
|
95663
95888
|
/**
|
|
95664
95889
|
* @see https://httpwg.org/specs/rfc9110.html#obsolete.date.formats
|
|
@@ -95753,9 +95978,7 @@ var require_date = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
95753
95978
|
if (yearDigit3 < 48 || yearDigit3 > 57) return;
|
|
95754
95979
|
const yearDigit4 = date.charCodeAt(23);
|
|
95755
95980
|
if (yearDigit4 < 48 || yearDigit4 > 57) return;
|
|
95756
|
-
|
|
95757
|
-
const result = new Date(Date.UTC(year, monthIdx, day, hour, minute, second));
|
|
95758
|
-
return result.getUTCDay() === weekday ? result : void 0;
|
|
95981
|
+
return makeDate((yearDigit1 - 48) * 1e3 + (yearDigit2 - 48) * 100 + (yearDigit3 - 48) * 10 + (yearDigit4 - 48), monthIdx, day, hour, minute, second, weekday);
|
|
95759
95982
|
}
|
|
95760
95983
|
/**
|
|
95761
95984
|
* @see https://httpwg.org/specs/rfc9110.html#obsolete.date.formats
|
|
@@ -95862,8 +96085,7 @@ var require_date = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
95862
96085
|
if (code2 < 48 || code2 > 57) return;
|
|
95863
96086
|
second = (code1 - 48) * 10 + (code2 - 48);
|
|
95864
96087
|
}
|
|
95865
|
-
|
|
95866
|
-
return result.getUTCDay() === weekday ? result : void 0;
|
|
96088
|
+
return makeDate(year, monthIdx, day, hour, minute, second, weekday);
|
|
95867
96089
|
}
|
|
95868
96090
|
module.exports = { parseHttpDate };
|
|
95869
96091
|
}));
|
|
@@ -95871,7 +96093,7 @@ var require_date = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
95871
96093
|
//#region ../../node_modules/undici/lib/handler/cache-handler.js
|
|
95872
96094
|
var require_cache_handler = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
95873
96095
|
const util = require_util$6();
|
|
95874
|
-
const { parseCacheControlHeader, parseVaryHeader, isEtagUsable } = require_cache$2();
|
|
96096
|
+
const { parseCacheControlHeader, hasInvalidCacheControlDirective, parseVaryHeader, hasVaryStar, isInvalidOrWildcardVaryHeader, isEtagUsable } = require_cache$2();
|
|
95875
96097
|
const { parseHttpDate } = require_date();
|
|
95876
96098
|
function noop() {}
|
|
95877
96099
|
const HEURISTICALLY_CACHEABLE_STATUS_CODES = [
|
|
@@ -95890,6 +96112,62 @@ var require_cache_handler = /* @__PURE__ */ __commonJSMin(((exports, module) =>
|
|
|
95890
96112
|
];
|
|
95891
96113
|
const NOT_UNDERSTOOD_STATUS_CODES = [206];
|
|
95892
96114
|
const MAX_RESPONSE_AGE = 2147483647e3;
|
|
96115
|
+
function trimOWS(value) {
|
|
96116
|
+
return value.replace(/^[\t ]+|[\t ]+$/g, "");
|
|
96117
|
+
}
|
|
96118
|
+
function arrayIncludes(array, value) {
|
|
96119
|
+
for (let i = 0; i < array.length; i++) if (array[i] === value) return true;
|
|
96120
|
+
return false;
|
|
96121
|
+
}
|
|
96122
|
+
function appendConnectionHeaderTokens(headersToRemove, connectionHeader) {
|
|
96123
|
+
const values = Array.isArray(connectionHeader) ? connectionHeader : [connectionHeader];
|
|
96124
|
+
for (let i = 0; i < values.length; i++) {
|
|
96125
|
+
const tokens = values[i].split(",");
|
|
96126
|
+
for (let j = 0; j < tokens.length; j++) headersToRemove.push(trimOWS(tokens[j]).toLowerCase());
|
|
96127
|
+
}
|
|
96128
|
+
}
|
|
96129
|
+
function getSameOriginPath(cacheKey, location) {
|
|
96130
|
+
if (typeof location !== "string") return;
|
|
96131
|
+
let originUrl;
|
|
96132
|
+
let requestUrl;
|
|
96133
|
+
let locationUrl;
|
|
96134
|
+
try {
|
|
96135
|
+
originUrl = new URL(cacheKey.origin);
|
|
96136
|
+
requestUrl = new URL(cacheKey.path, originUrl);
|
|
96137
|
+
locationUrl = new URL(location, requestUrl);
|
|
96138
|
+
} catch {
|
|
96139
|
+
return;
|
|
96140
|
+
}
|
|
96141
|
+
if (locationUrl.origin !== originUrl.origin) return;
|
|
96142
|
+
return locationUrl.pathname + locationUrl.search;
|
|
96143
|
+
}
|
|
96144
|
+
function deleteCachedUri(store, cacheKey, path) {
|
|
96145
|
+
deleteCachedValue(store, {
|
|
96146
|
+
...cacheKey,
|
|
96147
|
+
path
|
|
96148
|
+
});
|
|
96149
|
+
for (let i = 0; i < util.safeHTTPMethods.length; i++) {
|
|
96150
|
+
const method = util.safeHTTPMethods[i];
|
|
96151
|
+
if (method !== cacheKey.method) deleteCachedValue(store, {
|
|
96152
|
+
...cacheKey,
|
|
96153
|
+
method,
|
|
96154
|
+
path
|
|
96155
|
+
});
|
|
96156
|
+
}
|
|
96157
|
+
}
|
|
96158
|
+
function deleteLocationTargets(store, cacheKey, headerValue) {
|
|
96159
|
+
if (headerValue === void 0) return;
|
|
96160
|
+
const values = Array.isArray(headerValue) ? headerValue : [headerValue];
|
|
96161
|
+
for (let i = 0; i < values.length; i++) {
|
|
96162
|
+
const path = getSameOriginPath(cacheKey, values[i]);
|
|
96163
|
+
if (path !== void 0) deleteCachedUri(store, cacheKey, path);
|
|
96164
|
+
}
|
|
96165
|
+
}
|
|
96166
|
+
function invalidateUnsafeRequest(store, cacheKey, resHeaders) {
|
|
96167
|
+
deleteCachedUri(store, cacheKey, cacheKey.path);
|
|
96168
|
+
deleteLocationTargets(store, cacheKey, resHeaders.location);
|
|
96169
|
+
deleteLocationTargets(store, cacheKey, resHeaders["content-location"]);
|
|
96170
|
+
}
|
|
95893
96171
|
/**
|
|
95894
96172
|
* @typedef {import('../../types/dispatcher.d.ts').default.DispatchHandler} DispatchHandler
|
|
95895
96173
|
*
|
|
@@ -95949,32 +96227,52 @@ var require_cache_handler = /* @__PURE__ */ __commonJSMin(((exports, module) =>
|
|
|
95949
96227
|
onResponseStart(controller, statusCode, resHeaders, statusMessage) {
|
|
95950
96228
|
const downstreamOnHeaders = () => this.#handler.onResponseStart?.(controller, statusCode, resHeaders, statusMessage);
|
|
95951
96229
|
const handler = this;
|
|
95952
|
-
if (!util.safeHTTPMethods
|
|
95953
|
-
|
|
95954
|
-
this.#store.delete(this.#cacheKey)?.catch?.(noop);
|
|
95955
|
-
} catch {}
|
|
96230
|
+
if (!arrayIncludes(util.safeHTTPMethods, this.#cacheKey.method) && statusCode >= 200 && statusCode <= 399) {
|
|
96231
|
+
invalidateUnsafeRequest(this.#store, this.#cacheKey, resHeaders);
|
|
95956
96232
|
return downstreamOnHeaders();
|
|
95957
96233
|
}
|
|
95958
96234
|
const cacheControlHeader = resHeaders["cache-control"];
|
|
95959
|
-
const heuristicallyCacheable = resHeaders["last-modified"] && HEURISTICALLY_CACHEABLE_STATUS_CODES
|
|
95960
|
-
if (!cacheControlHeader && !resHeaders["expires"] && !heuristicallyCacheable && !this.#cacheByDefault)
|
|
96235
|
+
const heuristicallyCacheable = resHeaders["last-modified"] && arrayIncludes(HEURISTICALLY_CACHEABLE_STATUS_CODES, statusCode);
|
|
96236
|
+
if (!cacheControlHeader && !resHeaders["expires"] && !heuristicallyCacheable && !this.#cacheByDefault) {
|
|
96237
|
+
if (statusCode === 304 && resHeaders.vary && isInvalidOrWildcardVaryHeader(resHeaders.vary)) deleteCachedValue(this.#store, this.#cacheKey);
|
|
96238
|
+
return downstreamOnHeaders();
|
|
96239
|
+
}
|
|
95961
96240
|
const cacheControlDirectives = cacheControlHeader ? parseCacheControlHeader(cacheControlHeader) : {};
|
|
95962
|
-
if (!canCacheResponse(this.#cacheType, statusCode, resHeaders, cacheControlDirectives, this.#cacheKey.headers))
|
|
96241
|
+
if (!canCacheResponse(this.#cacheType, statusCode, resHeaders, cacheControlDirectives, this.#cacheKey.headers)) {
|
|
96242
|
+
if (statusCode === 304 && (cacheControlHeader || revalidationResponseDisallowsCachedReuse(this.#cacheType, resHeaders, cacheControlDirectives))) deleteCachedValue(this.#store, this.#cacheKey);
|
|
96243
|
+
return downstreamOnHeaders();
|
|
96244
|
+
}
|
|
95963
96245
|
const now = Date.now();
|
|
95964
|
-
const resAge = resHeaders
|
|
95965
|
-
if (resAge && resAge >= MAX_RESPONSE_AGE)
|
|
95966
|
-
|
|
96246
|
+
const resAge = Object.hasOwn(resHeaders, "age") ? getAge(resHeaders.age) : void 0;
|
|
96247
|
+
if (resAge !== void 0 && resAge >= MAX_RESPONSE_AGE) {
|
|
96248
|
+
deleteCachedValueIfNotModified(statusCode, this.#store, this.#cacheKey);
|
|
96249
|
+
return downstreamOnHeaders();
|
|
96250
|
+
}
|
|
96251
|
+
const resDate = Object.hasOwn(resHeaders, "date") ? getDate(resHeaders.date) : void 0;
|
|
96252
|
+
if (resDate === null) {
|
|
96253
|
+
deleteCachedValueIfNotModified(statusCode, this.#store, this.#cacheKey);
|
|
96254
|
+
return downstreamOnHeaders();
|
|
96255
|
+
}
|
|
96256
|
+
const apparentAge = resDate ? Math.max(0, now - resDate.getTime()) : 0;
|
|
96257
|
+
const currentAge = Math.max(apparentAge, resAge ?? 0);
|
|
95967
96258
|
const staleAt = determineStaleAt(this.#cacheType, now, resAge, resHeaders, resDate, cacheControlDirectives) ?? this.#cacheByDefault;
|
|
95968
|
-
if (staleAt === void 0 ||
|
|
95969
|
-
|
|
96259
|
+
if (staleAt === void 0 || currentAge >= staleAt) {
|
|
96260
|
+
if (cacheControlHeader || staleAt !== void 0) deleteCachedValueIfNotModified(statusCode, this.#store, this.#cacheKey);
|
|
96261
|
+
return downstreamOnHeaders();
|
|
96262
|
+
}
|
|
96263
|
+
const baseTime = now - currentAge;
|
|
95970
96264
|
const absoluteStaleAt = staleAt + baseTime;
|
|
95971
|
-
if (now >= absoluteStaleAt)
|
|
96265
|
+
if (now >= absoluteStaleAt) {
|
|
96266
|
+
deleteCachedValueIfNotModified(statusCode, this.#store, this.#cacheKey);
|
|
96267
|
+
return downstreamOnHeaders();
|
|
96268
|
+
}
|
|
95972
96269
|
let varyDirectives;
|
|
95973
96270
|
if (this.#cacheKey.headers && resHeaders.vary) {
|
|
95974
96271
|
varyDirectives = parseVaryHeader(resHeaders.vary, this.#cacheKey.headers);
|
|
95975
96272
|
if (!varyDirectives) return downstreamOnHeaders();
|
|
95976
96273
|
}
|
|
95977
|
-
const
|
|
96274
|
+
const cachedAt = baseTime;
|
|
96275
|
+
const deleteAt = determineDeleteAt(baseTime, now, cacheControlDirectives, absoluteStaleAt);
|
|
95978
96276
|
const strippedHeaders = stripNecessaryHeaders(resHeaders, cacheControlDirectives);
|
|
95979
96277
|
/**
|
|
95980
96278
|
* @type {import('../../types/cache-interceptor.d.ts').default.CacheValue}
|
|
@@ -95985,7 +96283,7 @@ var require_cache_handler = /* @__PURE__ */ __commonJSMin(((exports, module) =>
|
|
|
95985
96283
|
headers: strippedHeaders,
|
|
95986
96284
|
vary: varyDirectives,
|
|
95987
96285
|
cacheControlDirectives,
|
|
95988
|
-
cachedAt
|
|
96286
|
+
cachedAt,
|
|
95989
96287
|
staleAt: absoluteStaleAt,
|
|
95990
96288
|
deleteAt
|
|
95991
96289
|
};
|
|
@@ -95995,6 +96293,7 @@ var require_cache_handler = /* @__PURE__ */ __commonJSMin(((exports, module) =>
|
|
|
95995
96293
|
value.statusCode = cachedValue.statusCode;
|
|
95996
96294
|
value.statusMessage = cachedValue.statusMessage;
|
|
95997
96295
|
value.etag = cachedValue.etag;
|
|
96296
|
+
value.vary = varyDirectives ?? cachedValue.vary;
|
|
95998
96297
|
value.headers = {
|
|
95999
96298
|
...cachedValue.headers,
|
|
96000
96299
|
...strippedHeaders
|
|
@@ -96073,6 +96372,27 @@ var require_cache_handler = /* @__PURE__ */ __commonJSMin(((exports, module) =>
|
|
|
96073
96372
|
}
|
|
96074
96373
|
};
|
|
96075
96374
|
/**
|
|
96375
|
+
* @param {import('../../types/cache-interceptor.d.ts').default.CacheStore} store
|
|
96376
|
+
* @param {import('../../types/cache-interceptor.d.ts').default.CacheKey} cacheKey
|
|
96377
|
+
*/
|
|
96378
|
+
function deleteCachedValue(store, cacheKey) {
|
|
96379
|
+
try {
|
|
96380
|
+
store.delete(cacheKey)?.catch?.(noop);
|
|
96381
|
+
} catch {}
|
|
96382
|
+
}
|
|
96383
|
+
function deleteCachedValueIfNotModified(statusCode, store, cacheKey) {
|
|
96384
|
+
if (statusCode === 304) deleteCachedValue(store, cacheKey);
|
|
96385
|
+
}
|
|
96386
|
+
/**
|
|
96387
|
+
* @param {import('../../types/cache-interceptor.d.ts').default.CacheOptions['type']} cacheType
|
|
96388
|
+
* @param {import('../../types/header.d.ts').IncomingHttpHeaders} resHeaders
|
|
96389
|
+
* @param {import('../../types/cache-interceptor.d.ts').default.CacheControlDirectives} cacheControlDirectives
|
|
96390
|
+
* @returns {boolean}
|
|
96391
|
+
*/
|
|
96392
|
+
function revalidationResponseDisallowsCachedReuse(cacheType, resHeaders, cacheControlDirectives) {
|
|
96393
|
+
return cacheControlDirectives["no-store"] === true || cacheType === "shared" && cacheControlDirectives.private === true || (resHeaders.vary ? isInvalidOrWildcardVaryHeader(resHeaders.vary) : false);
|
|
96394
|
+
}
|
|
96395
|
+
/**
|
|
96076
96396
|
* @see https://www.rfc-editor.org/rfc/rfc9111.html#name-storing-responses-to-authen
|
|
96077
96397
|
*
|
|
96078
96398
|
* @param {import('../../types/cache-interceptor.d.ts').default.CacheOptions['type']} cacheType
|
|
@@ -96082,26 +96402,46 @@ var require_cache_handler = /* @__PURE__ */ __commonJSMin(((exports, module) =>
|
|
|
96082
96402
|
* @param {import('../../types/header.d.ts').IncomingHttpHeaders} [reqHeaders]
|
|
96083
96403
|
*/
|
|
96084
96404
|
function canCacheResponse(cacheType, statusCode, resHeaders, cacheControlDirectives, reqHeaders) {
|
|
96085
|
-
if (statusCode < 200 || NOT_UNDERSTOOD_STATUS_CODES
|
|
96086
|
-
if (!HEURISTICALLY_CACHEABLE_STATUS_CODES
|
|
96405
|
+
if (statusCode < 200 || arrayIncludes(NOT_UNDERSTOOD_STATUS_CODES, statusCode)) return false;
|
|
96406
|
+
if (!arrayIncludes(HEURISTICALLY_CACHEABLE_STATUS_CODES, statusCode) && !resHeaders["expires"] && !cacheControlDirectives.public && cacheControlDirectives["max-age"] === void 0 && !(cacheControlDirectives.private && cacheType === "private") && !(cacheControlDirectives["s-maxage"] !== void 0 && cacheType === "shared")) return false;
|
|
96087
96407
|
if (cacheControlDirectives["no-store"]) return false;
|
|
96088
96408
|
if (cacheType === "shared" && cacheControlDirectives.private === true) return false;
|
|
96089
|
-
if (resHeaders.vary
|
|
96090
|
-
if (reqHeaders
|
|
96409
|
+
if (resHeaders.vary && hasVaryStar(resHeaders.vary)) return false;
|
|
96410
|
+
if (reqHeaders != null && Object.hasOwn(reqHeaders, "authorization")) {
|
|
96091
96411
|
if (!cacheControlDirectives.public && !cacheControlDirectives["s-maxage"] && !cacheControlDirectives["must-revalidate"]) return false;
|
|
96092
96412
|
if (typeof reqHeaders.authorization !== "string") return false;
|
|
96093
|
-
if (Array.isArray(cacheControlDirectives["no-cache"]) && cacheControlDirectives["no-cache"]
|
|
96094
|
-
if (Array.isArray(cacheControlDirectives["private"]) && cacheControlDirectives["private"]
|
|
96413
|
+
if (Array.isArray(cacheControlDirectives["no-cache"]) && arrayIncludes(cacheControlDirectives["no-cache"], "authorization")) return false;
|
|
96414
|
+
if (Array.isArray(cacheControlDirectives["private"]) && arrayIncludes(cacheControlDirectives["private"], "authorization")) return false;
|
|
96095
96415
|
}
|
|
96096
96416
|
return true;
|
|
96097
96417
|
}
|
|
96098
96418
|
/**
|
|
96419
|
+
* @param {string | string[]} dateHeader
|
|
96420
|
+
* @returns {Date | null | undefined}
|
|
96421
|
+
*/
|
|
96422
|
+
function getDate(dateHeader) {
|
|
96423
|
+
let dateValue = dateHeader;
|
|
96424
|
+
if (Array.isArray(dateValue)) {
|
|
96425
|
+
if (dateValue.length !== 1) return null;
|
|
96426
|
+
dateValue = dateValue[0];
|
|
96427
|
+
}
|
|
96428
|
+
if (typeof dateValue !== "string") return null;
|
|
96429
|
+
return parseHttpDate(dateValue);
|
|
96430
|
+
}
|
|
96431
|
+
/**
|
|
96099
96432
|
* @param {string | string[]} ageHeader
|
|
96100
96433
|
* @returns {number | undefined}
|
|
96101
96434
|
*/
|
|
96102
96435
|
function getAge(ageHeader) {
|
|
96103
|
-
|
|
96104
|
-
|
|
96436
|
+
let ageValue = ageHeader;
|
|
96437
|
+
if (Array.isArray(ageValue)) {
|
|
96438
|
+
if (ageValue.length !== 1) return MAX_RESPONSE_AGE;
|
|
96439
|
+
ageValue = ageValue[0];
|
|
96440
|
+
}
|
|
96441
|
+
if (typeof ageValue !== "string" || !/^[\t ]*[0-9]+[\t ]*$/.test(ageValue)) return MAX_RESPONSE_AGE;
|
|
96442
|
+
const age = BigInt(ageValue.replace(/^[\t ]+|[\t ]+$/g, ""));
|
|
96443
|
+
if (age >= BigInt(MAX_RESPONSE_AGE / 1e3)) return MAX_RESPONSE_AGE;
|
|
96444
|
+
return Number(age) * 1e3;
|
|
96105
96445
|
}
|
|
96106
96446
|
/**
|
|
96107
96447
|
* @param {import('../../types/cache-interceptor.d.ts').default.CacheOptions['type']} cacheType
|
|
@@ -96115,44 +96455,53 @@ var require_cache_handler = /* @__PURE__ */ __commonJSMin(((exports, module) =>
|
|
|
96115
96455
|
*/
|
|
96116
96456
|
function determineStaleAt(cacheType, now, age, resHeaders, responseDate, cacheControlDirectives) {
|
|
96117
96457
|
if (cacheType === "shared") {
|
|
96458
|
+
if (hasInvalidCacheControlDirective(cacheControlDirectives, "s-maxage")) return 0;
|
|
96118
96459
|
const sMaxAge = cacheControlDirectives["s-maxage"];
|
|
96119
|
-
if (sMaxAge !== void 0) return sMaxAge
|
|
96460
|
+
if (sMaxAge !== void 0) return sMaxAge * 1e3;
|
|
96120
96461
|
}
|
|
96462
|
+
if (hasInvalidCacheControlDirective(cacheControlDirectives, "max-age")) return 0;
|
|
96121
96463
|
const maxAge = cacheControlDirectives["max-age"];
|
|
96122
|
-
if (maxAge !== void 0) return maxAge
|
|
96123
|
-
if (
|
|
96464
|
+
if (maxAge !== void 0) return maxAge * 1e3;
|
|
96465
|
+
if (Object.hasOwn(resHeaders, "expires")) {
|
|
96466
|
+
if (typeof resHeaders.expires !== "string") return 0;
|
|
96124
96467
|
const expiresDate = parseHttpDate(resHeaders.expires);
|
|
96125
|
-
if (expiresDate)
|
|
96126
|
-
|
|
96127
|
-
|
|
96128
|
-
|
|
96129
|
-
|
|
96130
|
-
|
|
96131
|
-
return
|
|
96468
|
+
if (!expiresDate) return 0;
|
|
96469
|
+
if (now >= expiresDate.getTime()) return 0;
|
|
96470
|
+
if (responseDate) {
|
|
96471
|
+
if (responseDate >= expiresDate) return 0;
|
|
96472
|
+
const freshnessLifetime = expiresDate.getTime() - responseDate.getTime();
|
|
96473
|
+
if (age !== void 0 && age >= freshnessLifetime) return 0;
|
|
96474
|
+
return freshnessLifetime;
|
|
96132
96475
|
}
|
|
96476
|
+
return expiresDate.getTime() - now;
|
|
96133
96477
|
}
|
|
96134
96478
|
if (typeof resHeaders["last-modified"] === "string") {
|
|
96135
|
-
const lastModified =
|
|
96136
|
-
if (
|
|
96479
|
+
const lastModified = parseHttpDate(resHeaders["last-modified"]);
|
|
96480
|
+
if (lastModified) {
|
|
96137
96481
|
if (lastModified.getTime() >= now) return;
|
|
96138
96482
|
return (now - lastModified.getTime()) * .1;
|
|
96139
96483
|
}
|
|
96140
96484
|
}
|
|
96141
|
-
if (cacheControlDirectives.immutable) return
|
|
96485
|
+
if (cacheControlDirectives.immutable) return 31536e6;
|
|
96142
96486
|
}
|
|
96143
96487
|
/**
|
|
96144
|
-
* @param {number}
|
|
96488
|
+
* @param {number} baseTime
|
|
96489
|
+
* @param {number} cachedAt
|
|
96145
96490
|
* @param {import('../../types/cache-interceptor.d.ts').default.CacheControlDirectives} cacheControlDirectives
|
|
96146
96491
|
* @param {number} staleAt
|
|
96147
96492
|
*/
|
|
96148
|
-
function determineDeleteAt(
|
|
96493
|
+
function determineDeleteAt(baseTime, cachedAt, cacheControlDirectives, staleAt) {
|
|
96149
96494
|
let staleWhileRevalidate = -Infinity;
|
|
96150
96495
|
let staleIfError = -Infinity;
|
|
96151
96496
|
let immutable = -Infinity;
|
|
96152
96497
|
if (cacheControlDirectives["stale-while-revalidate"]) staleWhileRevalidate = staleAt + cacheControlDirectives["stale-while-revalidate"] * 1e3;
|
|
96153
96498
|
if (cacheControlDirectives["stale-if-error"]) staleIfError = staleAt + cacheControlDirectives["stale-if-error"] * 1e3;
|
|
96154
|
-
if (cacheControlDirectives.immutable && staleWhileRevalidate === -Infinity && staleIfError === -Infinity) immutable =
|
|
96155
|
-
if (staleWhileRevalidate === -Infinity && staleIfError === -Infinity && immutable === -Infinity)
|
|
96499
|
+
if (cacheControlDirectives.immutable && staleWhileRevalidate === -Infinity && staleIfError === -Infinity) immutable = cachedAt + 31536e6;
|
|
96500
|
+
if (staleWhileRevalidate === -Infinity && staleIfError === -Infinity && immutable === -Infinity) {
|
|
96501
|
+
const freshnessLifetime = staleAt - baseTime;
|
|
96502
|
+
const datePrecisionPadding = Math.min(Math.max(cachedAt - baseTime, 0), 1e3);
|
|
96503
|
+
return staleAt + freshnessLifetime + datePrecisionPadding;
|
|
96504
|
+
}
|
|
96156
96505
|
return Math.max(staleAt, staleWhileRevalidate, staleIfError, immutable);
|
|
96157
96506
|
}
|
|
96158
96507
|
/**
|
|
@@ -96173,24 +96522,16 @@ var require_cache_handler = /* @__PURE__ */ __commonJSMin(((exports, module) =>
|
|
|
96173
96522
|
"upgrade",
|
|
96174
96523
|
"age"
|
|
96175
96524
|
];
|
|
96176
|
-
if (resHeaders["connection"])
|
|
96177
|
-
else headersToRemove.push(...resHeaders["connection"].split(",").map((header) => header.trim()));
|
|
96525
|
+
if (resHeaders["connection"]) appendConnectionHeaderTokens(headersToRemove, resHeaders["connection"]);
|
|
96178
96526
|
if (Array.isArray(cacheControlDirectives["no-cache"])) headersToRemove.push(...cacheControlDirectives["no-cache"]);
|
|
96179
96527
|
if (Array.isArray(cacheControlDirectives["private"])) headersToRemove.push(...cacheControlDirectives["private"]);
|
|
96180
96528
|
let strippedHeaders;
|
|
96181
|
-
for (const headerName of headersToRemove) if (resHeaders
|
|
96529
|
+
for (const headerName of headersToRemove) if (Object.hasOwn(resHeaders, headerName)) {
|
|
96182
96530
|
strippedHeaders ??= { ...resHeaders };
|
|
96183
96531
|
delete strippedHeaders[headerName];
|
|
96184
96532
|
}
|
|
96185
96533
|
return strippedHeaders ?? resHeaders;
|
|
96186
96534
|
}
|
|
96187
|
-
/**
|
|
96188
|
-
* @param {Date} date
|
|
96189
|
-
* @returns {boolean}
|
|
96190
|
-
*/
|
|
96191
|
-
function isValidDate(date) {
|
|
96192
|
-
return date instanceof Date && Number.isFinite(date.valueOf());
|
|
96193
|
-
}
|
|
96194
96535
|
module.exports = CacheHandler;
|
|
96195
96536
|
}));
|
|
96196
96537
|
//#endregion
|
|
@@ -96352,10 +96693,30 @@ var require_memory_cache_store = /* @__PURE__ */ __commonJSMin(((exports, module
|
|
|
96352
96693
|
}
|
|
96353
96694
|
};
|
|
96354
96695
|
function findEntry(key, entries, now) {
|
|
96355
|
-
|
|
96356
|
-
|
|
96357
|
-
|
|
96358
|
-
}
|
|
96696
|
+
for (let i = 0; i < entries.length; i++) {
|
|
96697
|
+
const entry = entries[i];
|
|
96698
|
+
if (entry.deleteAt > now && entry.method === key.method && varyMatches(key, entry)) return entry;
|
|
96699
|
+
}
|
|
96700
|
+
}
|
|
96701
|
+
function varyMatches(key, entry) {
|
|
96702
|
+
if (entry.vary == null) return true;
|
|
96703
|
+
for (const headerName in entry.vary) if (Object.hasOwn(entry.vary, headerName) && !headerValueEquals(key.headers?.[headerName], entry.vary[headerName])) return false;
|
|
96704
|
+
return true;
|
|
96705
|
+
}
|
|
96706
|
+
/**
|
|
96707
|
+
* @param {string|string[]|null|undefined} lhs
|
|
96708
|
+
* @param {string|string[]|null|undefined} rhs
|
|
96709
|
+
* @returns {boolean}
|
|
96710
|
+
*/
|
|
96711
|
+
function headerValueEquals(lhs, rhs) {
|
|
96712
|
+
if (lhs == null && rhs == null) return true;
|
|
96713
|
+
if (lhs == null && rhs != null || lhs != null && rhs == null) return false;
|
|
96714
|
+
if (Array.isArray(lhs) && Array.isArray(rhs)) {
|
|
96715
|
+
if (lhs.length !== rhs.length) return false;
|
|
96716
|
+
for (let i = 0; i < lhs.length; i++) if (lhs[i] !== rhs[i]) return false;
|
|
96717
|
+
return true;
|
|
96718
|
+
}
|
|
96719
|
+
return lhs === rhs;
|
|
96359
96720
|
}
|
|
96360
96721
|
module.exports = MemoryCacheStore;
|
|
96361
96722
|
}));
|
|
@@ -96379,7 +96740,7 @@ var require_cache_revalidation_handler = /* @__PURE__ */ __commonJSMin(((exports
|
|
|
96379
96740
|
var CacheRevalidationHandler = class {
|
|
96380
96741
|
#successful = false;
|
|
96381
96742
|
/**
|
|
96382
|
-
* @type {((boolean, any) => void) | null}
|
|
96743
|
+
* @type {((success: boolean, context?: any, statusCode?: number, headers?: import('../../types/header.d.ts').IncomingHttpHeaders) => void) | null}
|
|
96383
96744
|
*/
|
|
96384
96745
|
#callback;
|
|
96385
96746
|
/**
|
|
@@ -96392,7 +96753,7 @@ var require_cache_revalidation_handler = /* @__PURE__ */ __commonJSMin(((exports
|
|
|
96392
96753
|
*/
|
|
96393
96754
|
#allowErrorStatusCodes;
|
|
96394
96755
|
/**
|
|
96395
|
-
* @param {(boolean) => void} callback Function to call if the cached value is valid
|
|
96756
|
+
* @param {(success: boolean, context?: any, statusCode?: number, headers?: import('../../types/header.d.ts').IncomingHttpHeaders) => void} callback Function to call if the cached value is valid
|
|
96396
96757
|
* @param {import('../../types/dispatcher.d.ts').default.DispatchHandlers} handler
|
|
96397
96758
|
* @param {boolean} allowErrorStatusCodes
|
|
96398
96759
|
*/
|
|
@@ -96412,7 +96773,7 @@ var require_cache_revalidation_handler = /* @__PURE__ */ __commonJSMin(((exports
|
|
|
96412
96773
|
onResponseStart(controller, statusCode, headers, statusMessage) {
|
|
96413
96774
|
assert$11(this.#callback != null);
|
|
96414
96775
|
this.#successful = statusCode === 304 || this.#allowErrorStatusCodes && statusCode >= 500 && statusCode <= 504;
|
|
96415
|
-
this.#callback(this.#successful, this.#context);
|
|
96776
|
+
this.#callback(this.#successful, this.#context, statusCode, headers);
|
|
96416
96777
|
this.#callback = null;
|
|
96417
96778
|
if (this.#successful) return true;
|
|
96418
96779
|
this.#handler.onRequestStart?.(controller, this.#context);
|
|
@@ -96447,8 +96808,9 @@ var require_cache$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
96447
96808
|
const CacheHandler = require_cache_handler();
|
|
96448
96809
|
const MemoryCacheStore = require_memory_cache_store();
|
|
96449
96810
|
const CacheRevalidationHandler = require_cache_revalidation_handler();
|
|
96450
|
-
const { assertCacheStore, assertCacheMethods, makeCacheKey, normalizeHeaders, parseCacheControlHeader } = require_cache$2();
|
|
96811
|
+
const { assertCacheStore, assertCacheMethods, makeCacheKey, normalizeHeaders, parseCacheControlHeader, isInvalidOrWildcardVaryHeader } = require_cache$2();
|
|
96451
96812
|
const { AbortError } = require_errors$1();
|
|
96813
|
+
const { parseHttpDate } = require_date();
|
|
96452
96814
|
/**
|
|
96453
96815
|
* @param {(string | RegExp)[] | undefined} origins
|
|
96454
96816
|
* @param {string} name
|
|
@@ -96462,6 +96824,25 @@ var require_cache$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
96462
96824
|
}
|
|
96463
96825
|
}
|
|
96464
96826
|
const nop = () => {};
|
|
96827
|
+
function trimOWS(value) {
|
|
96828
|
+
return value.replace(/^[\t ]+|[\t ]+$/g, "");
|
|
96829
|
+
}
|
|
96830
|
+
function arrayIncludes(array, value) {
|
|
96831
|
+
for (let i = 0; i < array.length; i++) if (array[i] === value) return true;
|
|
96832
|
+
return false;
|
|
96833
|
+
}
|
|
96834
|
+
function hasPragmaNoCache(headers) {
|
|
96835
|
+
const pragma = headers?.pragma;
|
|
96836
|
+
if (!pragma) return false;
|
|
96837
|
+
const values = Array.isArray(pragma) ? pragma : [pragma];
|
|
96838
|
+
for (let i = 0; i < values.length; i++) {
|
|
96839
|
+
const value = values[i];
|
|
96840
|
+
if (typeof value !== "string") continue;
|
|
96841
|
+
const directives = value.split(",");
|
|
96842
|
+
for (let j = 0; j < directives.length; j++) if (trimOWS(directives[j]).toLowerCase() === "no-cache") return true;
|
|
96843
|
+
}
|
|
96844
|
+
return false;
|
|
96845
|
+
}
|
|
96465
96846
|
/**
|
|
96466
96847
|
* @typedef {(options: import('../../types/dispatcher.d.ts').default.DispatchOptions, handler: import('../../types/dispatcher.d.ts').default.DispatchHandler) => void} DispatchFn
|
|
96467
96848
|
*/
|
|
@@ -96479,13 +96860,57 @@ var require_cache$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
96479
96860
|
}
|
|
96480
96861
|
/**
|
|
96481
96862
|
* @param {import('../../types/cache-interceptor.d.ts').default.GetResult} result
|
|
96863
|
+
* @param {import('../../types/cache-interceptor.d.ts').default.CacheOptions['type']} cacheType
|
|
96864
|
+
* @returns {boolean}
|
|
96865
|
+
*/
|
|
96866
|
+
function staleResponseRequiresRevalidation(result, cacheType) {
|
|
96867
|
+
return result.cacheControlDirectives?.["must-revalidate"] === true || cacheType === "shared" && (result.cacheControlDirectives?.["proxy-revalidate"] === true || result.cacheControlDirectives?.["s-maxage"] !== void 0);
|
|
96868
|
+
}
|
|
96869
|
+
/**
|
|
96870
|
+
* @param {import('../../types/cache-interceptor.d.ts').default.CacheOptions['type']} cacheType
|
|
96871
|
+
* @param {import('../../types/header.d.ts').IncomingHttpHeaders} headers
|
|
96872
|
+
* @returns {boolean}
|
|
96873
|
+
*/
|
|
96874
|
+
function revalidationResponseDisallowsCachedReuse(cacheType, headers) {
|
|
96875
|
+
if (headers.vary && isInvalidOrWildcardVaryHeader(headers.vary)) return true;
|
|
96876
|
+
const cacheControl = headers["cache-control"];
|
|
96877
|
+
if (!cacheControl) return false;
|
|
96878
|
+
const cacheControlDirectives = parseCacheControlHeader(cacheControl);
|
|
96879
|
+
return cacheControlDirectives["no-store"] === true || cacheType === "shared" && cacheControlDirectives.private === true;
|
|
96880
|
+
}
|
|
96881
|
+
function revalidationResponseUpdatesCacheControl(headers) {
|
|
96882
|
+
return headers["cache-control"] !== void 0;
|
|
96883
|
+
}
|
|
96884
|
+
function deleteCachedValue(store, cacheKey) {
|
|
96885
|
+
try {
|
|
96886
|
+
store.delete(cacheKey)?.catch?.(nop);
|
|
96887
|
+
} catch {}
|
|
96888
|
+
}
|
|
96889
|
+
function getUsableLastModified(headers) {
|
|
96890
|
+
const lastModified = headers?.["last-modified"];
|
|
96891
|
+
if (typeof lastModified === "string" && parseHttpDate(lastModified)) return lastModified;
|
|
96892
|
+
}
|
|
96893
|
+
function makeRevalidationHeaders(opts, result) {
|
|
96894
|
+
const headers = {
|
|
96895
|
+
...opts.headers,
|
|
96896
|
+
"if-modified-since": getUsableLastModified(result.headers) ?? new Date(result.cachedAt).toUTCString()
|
|
96897
|
+
};
|
|
96898
|
+
if (result.etag) headers["if-none-match"] = result.etag;
|
|
96899
|
+
if (result.vary) {
|
|
96900
|
+
for (const key in result.vary) if (result.vary[key] != null) headers[key] = result.vary[key];
|
|
96901
|
+
}
|
|
96902
|
+
return headers;
|
|
96903
|
+
}
|
|
96904
|
+
/**
|
|
96905
|
+
* @param {import('../../types/cache-interceptor.d.ts').default.GetResult} result
|
|
96482
96906
|
* @param {import('../../types/cache-interceptor.d.ts').default.CacheControlDirectives | undefined} cacheControlDirectives
|
|
96907
|
+
* @param {import('../../types/cache-interceptor.d.ts').default.CacheOptions['type']} cacheType
|
|
96483
96908
|
* @returns {boolean}
|
|
96484
96909
|
*/
|
|
96485
|
-
function isStale(result, cacheControlDirectives) {
|
|
96910
|
+
function isStale(result, cacheControlDirectives, cacheType) {
|
|
96486
96911
|
const now = Date.now();
|
|
96487
96912
|
if (now > result.staleAt) {
|
|
96488
|
-
if (cacheControlDirectives?.["max-stale"]) return now > result.staleAt + cacheControlDirectives["max-stale"] * 1e3;
|
|
96913
|
+
if (!staleResponseRequiresRevalidation(result, cacheType) && cacheControlDirectives?.["max-stale"]) return now > result.staleAt + cacheControlDirectives["max-stale"] * 1e3;
|
|
96489
96914
|
return true;
|
|
96490
96915
|
}
|
|
96491
96916
|
if (cacheControlDirectives?.["min-fresh"]) return result.staleAt - now <= cacheControlDirectives["min-fresh"] * 1e3;
|
|
@@ -96494,11 +96919,12 @@ var require_cache$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
96494
96919
|
/**
|
|
96495
96920
|
* Check if we're within the stale-while-revalidate window for a stale response
|
|
96496
96921
|
* @param {import('../../types/cache-interceptor.d.ts').default.GetResult} result
|
|
96922
|
+
* @param {import('../../types/cache-interceptor.d.ts').default.CacheOptions['type']} cacheType
|
|
96497
96923
|
* @returns {boolean}
|
|
96498
96924
|
*/
|
|
96499
|
-
function withinStaleWhileRevalidateWindow(result) {
|
|
96925
|
+
function withinStaleWhileRevalidateWindow(result, cacheType) {
|
|
96500
96926
|
const staleWhileRevalidate = result.cacheControlDirectives?.["stale-while-revalidate"];
|
|
96501
|
-
if (!staleWhileRevalidate) return false;
|
|
96927
|
+
if (!staleWhileRevalidate || staleResponseRequiresRevalidation(result, cacheType)) return false;
|
|
96502
96928
|
return Date.now() <= result.staleAt + staleWhileRevalidate * 1e3;
|
|
96503
96929
|
}
|
|
96504
96930
|
/**
|
|
@@ -96596,22 +97022,15 @@ var require_cache$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
96596
97022
|
const now = Date.now();
|
|
96597
97023
|
if (now > result.deleteAt) return dispatch(opts, new CacheHandler(globalOpts, cacheKey, handler));
|
|
96598
97024
|
const age = Math.round((now - result.cachedAt) / 1e3);
|
|
96599
|
-
|
|
96600
|
-
const stale = isStale(result, reqCacheControl);
|
|
96601
|
-
const revalidate = needsRevalidation(result, reqCacheControl, opts);
|
|
97025
|
+
const requestMaxAgeExpired = reqCacheControl?.["max-age"] !== void 0 && age >= reqCacheControl["max-age"];
|
|
97026
|
+
const stale = requestMaxAgeExpired || isStale(result, reqCacheControl, globalOpts.type);
|
|
97027
|
+
const revalidate = requestMaxAgeExpired || needsRevalidation(result, reqCacheControl, opts);
|
|
96602
97028
|
if (stale || revalidate) {
|
|
96603
97029
|
if (util.isStream(opts.body) && util.bodyLength(opts.body) !== 0) return dispatch(opts, new CacheHandler(globalOpts, cacheKey, handler));
|
|
96604
|
-
if (!revalidate && withinStaleWhileRevalidateWindow(result)) {
|
|
97030
|
+
if (!revalidate && withinStaleWhileRevalidateWindow(result, globalOpts.type)) {
|
|
96605
97031
|
sendCachedValue(handler, opts, result, age, null, true);
|
|
96606
97032
|
queueMicrotask(() => {
|
|
96607
|
-
const headers =
|
|
96608
|
-
...opts.headers,
|
|
96609
|
-
"if-modified-since": new Date(result.cachedAt).toUTCString()
|
|
96610
|
-
};
|
|
96611
|
-
if (result.etag) headers["if-none-match"] = result.etag;
|
|
96612
|
-
if (result.vary) {
|
|
96613
|
-
for (const key in result.vary) if (result.vary[key] != null) headers[key] = result.vary[key];
|
|
96614
|
-
}
|
|
97033
|
+
const headers = makeRevalidationHeaders(opts, result);
|
|
96615
97034
|
dispatch({
|
|
96616
97035
|
...opts,
|
|
96617
97036
|
headers
|
|
@@ -96627,22 +97046,26 @@ var require_cache$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
96627
97046
|
return true;
|
|
96628
97047
|
}
|
|
96629
97048
|
let withinStaleIfErrorThreshold = false;
|
|
96630
|
-
|
|
96631
|
-
|
|
96632
|
-
|
|
96633
|
-
...opts.headers,
|
|
96634
|
-
"if-modified-since": new Date(result.cachedAt).toUTCString()
|
|
96635
|
-
};
|
|
96636
|
-
if (result.etag) headers["if-none-match"] = result.etag;
|
|
96637
|
-
if (result.vary) {
|
|
96638
|
-
for (const key in result.vary) if (result.vary[key] != null) headers[key] = result.vary[key];
|
|
97049
|
+
if (!staleResponseRequiresRevalidation(result, globalOpts.type)) {
|
|
97050
|
+
const staleIfErrorExpiry = result.cacheControlDirectives["stale-if-error"] ?? reqCacheControl?.["stale-if-error"];
|
|
97051
|
+
if (staleIfErrorExpiry) withinStaleIfErrorThreshold = now < result.staleAt + staleIfErrorExpiry * 1e3;
|
|
96639
97052
|
}
|
|
97053
|
+
const headers = makeRevalidationHeaders(opts, result);
|
|
96640
97054
|
return dispatch({
|
|
96641
97055
|
...opts,
|
|
96642
97056
|
headers
|
|
96643
|
-
}, new CacheRevalidationHandler((success, context) => {
|
|
96644
|
-
if (success)
|
|
96645
|
-
|
|
97057
|
+
}, new CacheRevalidationHandler((success, context, statusCode, headers) => {
|
|
97058
|
+
if (success) {
|
|
97059
|
+
if (statusCode === 304) {
|
|
97060
|
+
if (revalidationResponseDisallowsCachedReuse(globalOpts.type, headers)) {
|
|
97061
|
+
if (util.isStream(result.body)) result.body.on("error", nop).destroy();
|
|
97062
|
+
deleteCachedValue(globalOpts.store, cacheKey);
|
|
97063
|
+
return dispatch(opts, new CacheHandler(globalOpts, cacheKey, handler));
|
|
97064
|
+
}
|
|
97065
|
+
if (revalidationResponseUpdatesCacheControl(headers)) deleteCachedValue(globalOpts.store, cacheKey);
|
|
97066
|
+
}
|
|
97067
|
+
sendCachedValue(handler, opts, result, age, context, stale);
|
|
97068
|
+
} else if (util.isStream(result.body)) result.body.on("error", nop).destroy();
|
|
96646
97069
|
}, new CacheHandler(globalOpts, cacheKey, handler), withinStaleIfErrorThreshold));
|
|
96647
97070
|
}
|
|
96648
97071
|
if (util.isStream(opts.body)) opts.body.on("error", nop).destroy();
|
|
@@ -96666,10 +97089,14 @@ var require_cache$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
96666
97089
|
cacheByDefault,
|
|
96667
97090
|
type
|
|
96668
97091
|
};
|
|
96669
|
-
const safeMethodsToNotCache =
|
|
97092
|
+
const safeMethodsToNotCache = [];
|
|
97093
|
+
for (let i = 0; i < util.safeHTTPMethods.length; i++) {
|
|
97094
|
+
const method = util.safeHTTPMethods[i];
|
|
97095
|
+
if (!arrayIncludes(methods, method)) safeMethodsToNotCache.push(method);
|
|
97096
|
+
}
|
|
96670
97097
|
return (dispatch) => {
|
|
96671
97098
|
return (opts, handler) => {
|
|
96672
|
-
if (!opts.origin || safeMethodsToNotCache
|
|
97099
|
+
if (!opts.origin || arrayIncludes(safeMethodsToNotCache, opts.method)) return dispatch(opts, handler);
|
|
96673
97100
|
if (origins !== void 0) {
|
|
96674
97101
|
const requestOrigin = opts.origin.toString().toLowerCase();
|
|
96675
97102
|
let isAllowed = false;
|
|
@@ -96691,7 +97118,7 @@ var require_cache$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
96691
97118
|
...opts,
|
|
96692
97119
|
headers: normalizeHeaders(opts)
|
|
96693
97120
|
};
|
|
96694
|
-
const reqCacheControl = opts.headers?.["cache-control"] ? parseCacheControlHeader(opts.headers["cache-control"]) : void 0;
|
|
97121
|
+
const reqCacheControl = opts.headers?.["cache-control"] ? parseCacheControlHeader(opts.headers["cache-control"]) : hasPragmaNoCache(opts.headers) ? { "no-cache": true } : void 0;
|
|
96695
97122
|
if (reqCacheControl?.["no-store"]) return dispatch(opts, handler);
|
|
96696
97123
|
/**
|
|
96697
97124
|
* @type {import('../../types/cache-interceptor.d.ts').default.CacheKey}
|
|
@@ -97619,7 +98046,8 @@ var require_sqlite_cache_store = /* @__PURE__ */ __commonJSMin(((exports, module
|
|
|
97619
98046
|
if (lhs == null && rhs != null || lhs != null && rhs == null) return false;
|
|
97620
98047
|
if (Array.isArray(lhs) && Array.isArray(rhs)) {
|
|
97621
98048
|
if (lhs.length !== rhs.length) return false;
|
|
97622
|
-
|
|
98049
|
+
for (let i = 0; i < lhs.length; i++) if (lhs[i] !== rhs[i]) return false;
|
|
98050
|
+
return true;
|
|
97623
98051
|
}
|
|
97624
98052
|
return lhs === rhs;
|
|
97625
98053
|
}
|
|
@@ -100506,16 +100934,54 @@ var require_util$3 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
100506
100934
|
function validateCookiePath(path) {
|
|
100507
100935
|
for (let i = 0; i < path.length; ++i) {
|
|
100508
100936
|
const code = path.charCodeAt(i);
|
|
100509
|
-
if (code < 32 || code
|
|
100937
|
+
if (code < 32 || code > 126 || code === 59) throw new Error("Invalid cookie path");
|
|
100510
100938
|
}
|
|
100511
100939
|
}
|
|
100512
100940
|
/**
|
|
100513
|
-
*
|
|
100514
|
-
*
|
|
100941
|
+
* <let-dig> ::= <letter> | <digit>
|
|
100942
|
+
*
|
|
100943
|
+
* <letter> ::= any one of the 52 alphabetic characters A through Z in
|
|
100944
|
+
* upper case and a through z in lower case
|
|
100945
|
+
*
|
|
100946
|
+
* <digit> ::= any one of the ten digits 0 through 9r
|
|
100947
|
+
*
|
|
100948
|
+
* @see https://www.rfc-editor.org/rfc/rfc1034#section-3.5
|
|
100949
|
+
* @param {number} code
|
|
100950
|
+
*/
|
|
100951
|
+
function isLetterOrDigit(code) {
|
|
100952
|
+
return code >= 48 && code <= 57 || code >= 65 && code <= 90 || code >= 97 && code <= 122;
|
|
100953
|
+
}
|
|
100954
|
+
/**
|
|
100955
|
+
* Validates a cookie domain against the "preferred name syntax".
|
|
100956
|
+
*
|
|
100957
|
+
* <domain> ::= <subdomain> | " "
|
|
100958
|
+
* <subdomain> ::= <label> | <subdomain> "." <label>
|
|
100959
|
+
* <label> ::= <let-dig> [ [ <ldh-str> ] <let-dig> ]
|
|
100960
|
+
* <ldh-str> ::= <let-dig-hyp> | <let-dig-hyp> <ldh-str>
|
|
100961
|
+
* <let-dig-hyp> ::= <let-dig> | "-"
|
|
100962
|
+
*
|
|
100963
|
+
* @see https://www.rfc-editor.org/rfc/rfc1034#section-3.5
|
|
100964
|
+
* @see https://www.rfc-editor.org/rfc/rfc1123#section-2.1
|
|
100965
|
+
* @see https://www.rfc-editor.org/rfc/rfc1035#section-2.3.4
|
|
100515
100966
|
* @param {string} domain
|
|
100516
100967
|
*/
|
|
100517
100968
|
function validateCookieDomain(domain) {
|
|
100518
|
-
if (domain
|
|
100969
|
+
if (domain === " ") return;
|
|
100970
|
+
if (domain.length > 255) throw new Error("Invalid cookie domain");
|
|
100971
|
+
let labelLength = 0;
|
|
100972
|
+
for (let i = 0; i < domain.length; ++i) {
|
|
100973
|
+
const code = domain.charCodeAt(i);
|
|
100974
|
+
if (code === 46) {
|
|
100975
|
+
if (labelLength === 0) throw new Error("Invalid cookie domain");
|
|
100976
|
+
if (domain.charCodeAt(i - 1) === 45) throw new Error("Invalid cookie domain");
|
|
100977
|
+
labelLength = 0;
|
|
100978
|
+
continue;
|
|
100979
|
+
}
|
|
100980
|
+
if (labelLength === 0 && !isLetterOrDigit(code)) throw new Error("Invalid cookie domain");
|
|
100981
|
+
if (!isLetterOrDigit(code) && code !== 45) throw new Error("Invalid cookie domain");
|
|
100982
|
+
if (++labelLength > 63) throw new Error("Invalid cookie domain");
|
|
100983
|
+
}
|
|
100984
|
+
if (labelLength === 0 || domain.charCodeAt(domain.length - 1) === 45) throw new Error("Invalid cookie domain");
|
|
100519
100985
|
}
|
|
100520
100986
|
const IMFDays = [
|
|
100521
100987
|
"Sun",
|
|
@@ -100630,7 +101096,11 @@ var require_util$3 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
100630
101096
|
for (const part of cookie.unparsed) {
|
|
100631
101097
|
if (!part.includes("=")) throw new Error("Invalid unparsed");
|
|
100632
101098
|
const [key, ...value] = part.split("=");
|
|
100633
|
-
|
|
101099
|
+
const trimmedKey = key.trim();
|
|
101100
|
+
const joinedValue = value.join("=");
|
|
101101
|
+
validateCookieName(trimmedKey);
|
|
101102
|
+
validateCookieValue(joinedValue);
|
|
101103
|
+
out.push(`${trimmedKey}=${joinedValue}`);
|
|
100634
101104
|
}
|
|
100635
101105
|
return out.join("; ");
|
|
100636
101106
|
}
|
|
@@ -104469,6 +104939,7 @@ var require_datadog_route = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
104469
104939
|
"/synthetics/mobile/applications/:applicationId/multipart-upload-complete",
|
|
104470
104940
|
"/synthetics/mobile/applications/validation-job-status/:jobId",
|
|
104471
104941
|
"/synthetics/settings",
|
|
104942
|
+
"/synthetics/suites/:suiteId",
|
|
104472
104943
|
"/synthetics/tests/:testId",
|
|
104473
104944
|
"/synthetics/tests/:testId/version_history/:version?only_check_existence=true",
|
|
104474
104945
|
"/synthetics/tests/:testType/:testId",
|