@workflow/web 4.1.24 → 4.1.26
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/build/client/assets/{encryption-BRhjWsZh.js → encryption-CVDhlDp_.js} +1 -1
- package/build/client/assets/{highlighted-body-B3W2YXNL-Bt3a5JLE.js → highlighted-body-B3W2YXNL-DNE7dweN.js} +1 -1
- package/build/client/assets/{home-Blj6TeEE.js → home-BcCTbe4i.js} +3 -3
- package/build/client/assets/{index-DZSXezpI.js → index-DhdkuKp5.js} +5 -1
- package/build/client/assets/{manifest-7bf3847b.js → manifest-f88c7f34.js} +1 -1
- package/build/client/assets/{mermaid-3ZIDBTTL-Bp6ZST9_.js → mermaid-3ZIDBTTL-B1-N6W83.js} +89 -48
- package/build/client/assets/{root-BxnaECGo.js → root-C2Eu3fUP.js} +1 -1
- package/build/client/assets/{run-detail-DivTczoC.js → run-detail-CyImB2zR.js} +4 -4
- package/build/client/assets/{workflow-graph-viewer-C6PWoIIU.js → workflow-graph-viewer-lj3vdGSs.js} +2 -2
- package/build/server/assets/{app-DrQARxC_.js → app-B1cjUJ8B.js} +1 -1
- package/build/server/assets/{highlighted-body-B3W2YXNL-DjQADekk.js → highlighted-body-B3W2YXNL-D7styBk6.js} +2 -2
- package/build/server/assets/{index-jGuRgZeU.js → index-D_AI8hkf.js} +3 -3
- package/build/server/assets/{mermaid-3ZIDBTTL-BkSETGny.js → mermaid-3ZIDBTTL-b9Kqgreu.js} +2 -2
- package/build/server/assets/{server-build-dZA4Blmq.js → server-build-CRL4YkrL.js} +1957 -583
- package/build/server/assets/{token-a0u6SMZC.js → token-CiFjsKMS.js} +2 -2
- package/build/server/assets/{token-util-C7q6rX5g.js → token-util-BcXLU8tX.js} +2 -2
- package/build/server/index.js +1 -1
- package/package.json +5 -5
|
@@ -18,7 +18,7 @@ import { createRequire as __wkfCreateRequire } from "node:module";
|
|
|
18
18
|
if (typeof globalThis.require === "undefined") {
|
|
19
19
|
globalThis.require = __wkfCreateRequire(import.meta.url);
|
|
20
20
|
}
|
|
21
|
-
import { a as requireReact, S as ServerRouter, c as createReadableStreamFromReadable, r as reactExports, g as getDefaultExportFromCjs, R as React, b as ReactExports, w as withComponentProps, d as withErrorBoundaryProps, M as Meta, L as Links, e as ScrollRestoration, f as Scripts, O as Outlet, u as useNavigate, h as useSearchParams, i as Link$1, j as useRouteError, k as isRouteErrorResponse, l as useLocation, m as useParams } from "./app-
|
|
21
|
+
import { a as requireReact, S as ServerRouter, c as createReadableStreamFromReadable, r as reactExports, g as getDefaultExportFromCjs, R as React, b as ReactExports, w as withComponentProps, d as withErrorBoundaryProps, M as Meta, L as Links, e as ScrollRestoration, f as Scripts, O as Outlet, u as useNavigate, h as useSearchParams, i as Link$1, j as useRouteError, k as isRouteErrorResponse, l as useLocation, m as useParams } from "./app-B1cjUJ8B.js";
|
|
22
22
|
import require$$0$5, { PassThrough, Transform as Transform$1 } from "node:stream";
|
|
23
23
|
import require$$0 from "util";
|
|
24
24
|
import require$$1 from "crypto";
|
|
@@ -34069,9 +34069,6 @@ class DevalueError extends Error {
|
|
|
34069
34069
|
this.root = root2;
|
|
34070
34070
|
}
|
|
34071
34071
|
}
|
|
34072
|
-
function is_primitive(thing) {
|
|
34073
|
-
return thing === null || typeof thing !== "object" && typeof thing !== "function";
|
|
34074
|
-
}
|
|
34075
34072
|
const object_proto_names = /* @__PURE__ */ Object.getOwnPropertyNames(Object.prototype).sort().join("\0");
|
|
34076
34073
|
function is_plain_object(thing) {
|
|
34077
34074
|
const proto2 = Object.getPrototypeOf(thing);
|
|
@@ -34150,14 +34147,17 @@ function is_valid_array_index_string(s2) {
|
|
|
34150
34147
|
}
|
|
34151
34148
|
return is_valid_array_index(+s2);
|
|
34152
34149
|
}
|
|
34153
|
-
function
|
|
34154
|
-
const keys2 = Object.keys(array2);
|
|
34150
|
+
function array_index_cut(keys2) {
|
|
34155
34151
|
for (var i = keys2.length - 1; i >= 0; i--) {
|
|
34156
34152
|
if (is_valid_array_index_string(keys2[i])) {
|
|
34157
34153
|
break;
|
|
34158
34154
|
}
|
|
34159
34155
|
}
|
|
34160
|
-
|
|
34156
|
+
return i + 1;
|
|
34157
|
+
}
|
|
34158
|
+
function valid_array_indices(array2) {
|
|
34159
|
+
const keys2 = Object.keys(array2);
|
|
34160
|
+
keys2.length = array_index_cut(keys2);
|
|
34161
34161
|
return keys2;
|
|
34162
34162
|
}
|
|
34163
34163
|
function encode_native(array_buffer) {
|
|
@@ -34195,10 +34195,92 @@ const native = typeof Uint8Array.fromBase64 === "function";
|
|
|
34195
34195
|
const buffer = typeof process === "object" && ((_a2 = process.versions) == null ? void 0 : _a2.node) !== void 0;
|
|
34196
34196
|
const encode64 = native ? encode_native : buffer ? encode_buffer : encode_legacy;
|
|
34197
34197
|
const decode64 = native ? decode_native : buffer ? decode_buffer : decode_legacy;
|
|
34198
|
-
function
|
|
34198
|
+
function merge_operations(defaults2, overrides) {
|
|
34199
|
+
return defaults2;
|
|
34200
|
+
}
|
|
34201
|
+
const NOT_PLAIN = Object.freeze({ kind: "not-plain" });
|
|
34202
|
+
const SYMBOL_KEYS = Object.freeze({ kind: "symbol-keys" });
|
|
34203
|
+
const stringify_operations = {
|
|
34204
|
+
identify: (value) => value,
|
|
34205
|
+
typeOf: (value) => value === null ? "null" : typeof value,
|
|
34206
|
+
toPrimitive: (value) => value,
|
|
34207
|
+
tagOf: (value) => get_type(value),
|
|
34208
|
+
isThenable: (value) => typeof value.then === "function",
|
|
34209
|
+
toPromise: (thenable) => Promise.resolve(thenable),
|
|
34210
|
+
unbox: (boxed) => boxed.valueOf(),
|
|
34211
|
+
toISOString: (date2) => isNaN(date2.getDate()) ? "" : date2.toISOString(),
|
|
34212
|
+
toStringValue: (value) => value.toString(),
|
|
34213
|
+
regExpInfo: (regexp) => ({ source: regexp.source, flags: regexp.flags }),
|
|
34214
|
+
valuesOf: (set2) => set2,
|
|
34215
|
+
entriesOf: (map2) => map2,
|
|
34216
|
+
viewInfo: (view) => ({
|
|
34217
|
+
buffer: view.buffer,
|
|
34218
|
+
byteOffset: view.byteOffset,
|
|
34219
|
+
byteLength: view.byteLength,
|
|
34220
|
+
length: view.length,
|
|
34221
|
+
bufferByteLength: view.buffer.byteLength
|
|
34222
|
+
}),
|
|
34223
|
+
toArrayBuffer: (buffer2) => buffer2,
|
|
34224
|
+
lengthOf: (array2) => array2.length,
|
|
34225
|
+
hasOwn: (value, key) => Object.hasOwn(value, key),
|
|
34226
|
+
indicesOf: (array2) => valid_array_indices(array2),
|
|
34227
|
+
shapeOf: (value) => {
|
|
34228
|
+
if (!is_plain_object(value)) return NOT_PLAIN;
|
|
34229
|
+
if (enumerable_symbols(value).length > 0) return SYMBOL_KEYS;
|
|
34230
|
+
return {
|
|
34231
|
+
kind: Object.getPrototypeOf(value) === null ? "null-proto" : "plain",
|
|
34232
|
+
keys: Object.keys(value)
|
|
34233
|
+
};
|
|
34234
|
+
},
|
|
34235
|
+
get: (value, key) => value[key]
|
|
34236
|
+
};
|
|
34237
|
+
const default_stringify_operations = Object.freeze(stringify_operations);
|
|
34238
|
+
const parse_operations = {
|
|
34239
|
+
fromPrimitive: (primitive) => primitive,
|
|
34240
|
+
fromISOString: (iso) => new Date(iso),
|
|
34241
|
+
fromStringValue: (tag, text2) => {
|
|
34242
|
+
if (tag === "URL") return new URL(text2);
|
|
34243
|
+
if (tag === "URLSearchParams") return new URLSearchParams(text2);
|
|
34244
|
+
return Temporal[tag.slice(9)].from(text2);
|
|
34245
|
+
},
|
|
34246
|
+
fromArrayBuffer: (buffer2) => buffer2,
|
|
34247
|
+
fromRegExpInfo: (source, flags) => new RegExp(source, flags),
|
|
34248
|
+
fromViewInfo: (tag, buffer2, byteOffset, length) => {
|
|
34249
|
+
const Constructor = (
|
|
34250
|
+
/** @type {any} */
|
|
34251
|
+
globalThis[tag]
|
|
34252
|
+
);
|
|
34253
|
+
return byteOffset !== void 0 ? new Constructor(buffer2, byteOffset, length) : new Constructor(buffer2);
|
|
34254
|
+
},
|
|
34255
|
+
box: (value) => Object(value),
|
|
34256
|
+
createArray: (length) => new Array(length),
|
|
34257
|
+
createSparseArray: (length) => {
|
|
34258
|
+
const array2 = [];
|
|
34259
|
+
array2[MAX_ARRAY_INDEX] = void 0;
|
|
34260
|
+
delete array2[MAX_ARRAY_INDEX];
|
|
34261
|
+
array2.length = length;
|
|
34262
|
+
return array2;
|
|
34263
|
+
},
|
|
34264
|
+
createObject: () => ({}),
|
|
34265
|
+
createNullPrototypeObject: () => /* @__PURE__ */ Object.create(null),
|
|
34266
|
+
createSet: () => /* @__PURE__ */ new Set(),
|
|
34267
|
+
createMap: () => /* @__PURE__ */ new Map(),
|
|
34268
|
+
set: (target2, key, value) => {
|
|
34269
|
+
target2[key] = value;
|
|
34270
|
+
},
|
|
34271
|
+
addValue: (set2, value) => {
|
|
34272
|
+
set2.add(value);
|
|
34273
|
+
},
|
|
34274
|
+
addEntry: (map2, key, value) => {
|
|
34275
|
+
map2.set(key, value);
|
|
34276
|
+
}
|
|
34277
|
+
};
|
|
34278
|
+
const default_parse_operations = Object.freeze(parse_operations);
|
|
34279
|
+
function parse$7(serialized, revivers, options) {
|
|
34199
34280
|
return unflatten(JSON.parse(serialized), revivers);
|
|
34200
34281
|
}
|
|
34201
|
-
function unflatten(parsed, revivers) {
|
|
34282
|
+
function unflatten(parsed, revivers, options) {
|
|
34283
|
+
const ops = merge_operations(default_parse_operations);
|
|
34202
34284
|
if (typeof parsed === "number") return hydrate(parsed, true);
|
|
34203
34285
|
if (!Array.isArray(parsed) || parsed.length === 0) {
|
|
34204
34286
|
throw new Error("Invalid input");
|
|
@@ -34210,18 +34292,21 @@ function unflatten(parsed, revivers) {
|
|
|
34210
34292
|
const hydrated = Array(values.length);
|
|
34211
34293
|
let hydrating = null;
|
|
34212
34294
|
function hydrate(index2, standalone = false) {
|
|
34213
|
-
if (index2 === UNDEFINED) return void 0;
|
|
34214
|
-
if (index2 === NAN) return NaN;
|
|
34215
|
-
if (index2 === POSITIVE_INFINITY) return Infinity;
|
|
34216
|
-
if (index2 === NEGATIVE_INFINITY) return -Infinity;
|
|
34217
|
-
if (index2 === NEGATIVE_ZERO) return -0;
|
|
34295
|
+
if (index2 === UNDEFINED) return ops.fromPrimitive(void 0);
|
|
34296
|
+
if (index2 === NAN) return ops.fromPrimitive(NaN);
|
|
34297
|
+
if (index2 === POSITIVE_INFINITY) return ops.fromPrimitive(Infinity);
|
|
34298
|
+
if (index2 === NEGATIVE_INFINITY) return ops.fromPrimitive(-Infinity);
|
|
34299
|
+
if (index2 === NEGATIVE_ZERO) return ops.fromPrimitive(-0);
|
|
34218
34300
|
if (standalone || typeof index2 !== "number") {
|
|
34219
34301
|
throw new Error(`Invalid input`);
|
|
34220
34302
|
}
|
|
34221
34303
|
if (index2 in hydrated) return hydrated[index2];
|
|
34304
|
+
if (index2 >= values.length) {
|
|
34305
|
+
throw new Error(`Invalid input`);
|
|
34306
|
+
}
|
|
34222
34307
|
const value = values[index2];
|
|
34223
34308
|
if (!value || typeof value !== "object") {
|
|
34224
|
-
hydrated[index2] = value;
|
|
34309
|
+
hydrated[index2] = ops.fromPrimitive(value);
|
|
34225
34310
|
} else if (Array.isArray(value)) {
|
|
34226
34311
|
if (typeof value[0] === "string") {
|
|
34227
34312
|
const type = value[0];
|
|
@@ -34231,6 +34316,9 @@ function unflatten(parsed, revivers) {
|
|
|
34231
34316
|
if (typeof i !== "number") {
|
|
34232
34317
|
i = values.push(value[1]) - 1;
|
|
34233
34318
|
}
|
|
34319
|
+
if (Object.hasOwn(hydrated, i)) {
|
|
34320
|
+
return hydrated[index2] = reviver(hydrated[i]);
|
|
34321
|
+
}
|
|
34234
34322
|
hydrating ?? (hydrating = /* @__PURE__ */ new Set());
|
|
34235
34323
|
if (hydrating.has(i)) {
|
|
34236
34324
|
throw new Error("Invalid circular reference");
|
|
@@ -34242,44 +34330,44 @@ function unflatten(parsed, revivers) {
|
|
|
34242
34330
|
}
|
|
34243
34331
|
switch (type) {
|
|
34244
34332
|
case "Date":
|
|
34245
|
-
hydrated[index2] =
|
|
34333
|
+
hydrated[index2] = ops.fromISOString(value[1]);
|
|
34246
34334
|
break;
|
|
34247
34335
|
case "Set":
|
|
34248
|
-
const set2 =
|
|
34336
|
+
const set2 = ops.createSet();
|
|
34249
34337
|
hydrated[index2] = set2;
|
|
34250
34338
|
for (let i = 1; i < value.length; i += 1) {
|
|
34251
|
-
|
|
34339
|
+
ops.addValue(set2, hydrate(value[i]));
|
|
34252
34340
|
}
|
|
34253
34341
|
break;
|
|
34254
34342
|
case "Map":
|
|
34255
|
-
const map2 =
|
|
34343
|
+
const map2 = ops.createMap();
|
|
34256
34344
|
hydrated[index2] = map2;
|
|
34257
34345
|
for (let i = 1; i < value.length; i += 2) {
|
|
34258
|
-
|
|
34346
|
+
ops.addEntry(map2, hydrate(value[i]), hydrate(value[i + 1]));
|
|
34259
34347
|
}
|
|
34260
34348
|
break;
|
|
34261
34349
|
case "RegExp":
|
|
34262
|
-
hydrated[index2] =
|
|
34350
|
+
hydrated[index2] = ops.fromRegExpInfo(value[1], value[2]);
|
|
34263
34351
|
break;
|
|
34264
34352
|
case "Object": {
|
|
34265
34353
|
const wrapped_index = value[1];
|
|
34266
34354
|
if (typeof values[wrapped_index] === "object" && values[wrapped_index][0] !== "BigInt") {
|
|
34267
34355
|
throw new Error("Invalid input");
|
|
34268
34356
|
}
|
|
34269
|
-
hydrated[index2] =
|
|
34357
|
+
hydrated[index2] = ops.box(hydrate(wrapped_index));
|
|
34270
34358
|
break;
|
|
34271
34359
|
}
|
|
34272
34360
|
case "BigInt":
|
|
34273
|
-
hydrated[index2] = BigInt(value[1]);
|
|
34361
|
+
hydrated[index2] = ops.fromPrimitive(BigInt(value[1]));
|
|
34274
34362
|
break;
|
|
34275
34363
|
case "null":
|
|
34276
|
-
const obj =
|
|
34364
|
+
const obj = ops.createNullPrototypeObject();
|
|
34277
34365
|
hydrated[index2] = obj;
|
|
34278
34366
|
for (let i = 1; i < value.length; i += 2) {
|
|
34279
34367
|
if (value[i] === "__proto__") {
|
|
34280
34368
|
throw new Error("Cannot parse an object with a `__proto__` property");
|
|
34281
34369
|
}
|
|
34282
|
-
obj
|
|
34370
|
+
ops.set(obj, value[i], hydrate(value[i + 1]));
|
|
34283
34371
|
}
|
|
34284
34372
|
break;
|
|
34285
34373
|
case "Int8Array":
|
|
@@ -34298,9 +34386,8 @@ function unflatten(parsed, revivers) {
|
|
|
34298
34386
|
if (values[value[1]][0] !== "ArrayBuffer") {
|
|
34299
34387
|
throw new Error("Invalid data");
|
|
34300
34388
|
}
|
|
34301
|
-
const TypedArrayConstructor = globalThis[type];
|
|
34302
34389
|
const buffer2 = hydrate(value[1]);
|
|
34303
|
-
hydrated[index2] =
|
|
34390
|
+
hydrated[index2] = ops.fromViewInfo(type, buffer2, value[2], value[3]);
|
|
34304
34391
|
break;
|
|
34305
34392
|
}
|
|
34306
34393
|
case "ArrayBuffer": {
|
|
@@ -34308,10 +34395,11 @@ function unflatten(parsed, revivers) {
|
|
|
34308
34395
|
if (typeof base642 !== "string") {
|
|
34309
34396
|
throw new Error("Invalid ArrayBuffer encoding");
|
|
34310
34397
|
}
|
|
34311
|
-
|
|
34312
|
-
hydrated[index2] = arraybuffer;
|
|
34398
|
+
hydrated[index2] = ops.fromArrayBuffer(decode64(base642));
|
|
34313
34399
|
break;
|
|
34314
34400
|
}
|
|
34401
|
+
case "URL":
|
|
34402
|
+
case "URLSearchParams":
|
|
34315
34403
|
case "Temporal.Duration":
|
|
34316
34404
|
case "Temporal.Instant":
|
|
34317
34405
|
case "Temporal.PlainDate":
|
|
@@ -34320,18 +34408,7 @@ function unflatten(parsed, revivers) {
|
|
|
34320
34408
|
case "Temporal.PlainMonthDay":
|
|
34321
34409
|
case "Temporal.PlainYearMonth":
|
|
34322
34410
|
case "Temporal.ZonedDateTime": {
|
|
34323
|
-
|
|
34324
|
-
hydrated[index2] = Temporal[temporalName].from(value[1]);
|
|
34325
|
-
break;
|
|
34326
|
-
}
|
|
34327
|
-
case "URL": {
|
|
34328
|
-
const url2 = new URL(value[1]);
|
|
34329
|
-
hydrated[index2] = url2;
|
|
34330
|
-
break;
|
|
34331
|
-
}
|
|
34332
|
-
case "URLSearchParams": {
|
|
34333
|
-
const url2 = new URLSearchParams(value[1]);
|
|
34334
|
-
hydrated[index2] = url2;
|
|
34411
|
+
hydrated[index2] = ops.fromStringValue(type, value[1]);
|
|
34335
34412
|
break;
|
|
34336
34413
|
}
|
|
34337
34414
|
default:
|
|
@@ -34342,47 +34419,44 @@ function unflatten(parsed, revivers) {
|
|
|
34342
34419
|
if (!is_valid_array_len(len)) {
|
|
34343
34420
|
throw new Error("Invalid input");
|
|
34344
34421
|
}
|
|
34345
|
-
const array2 =
|
|
34422
|
+
const array2 = ops.createSparseArray(len);
|
|
34346
34423
|
hydrated[index2] = array2;
|
|
34347
|
-
array2[MAX_ARRAY_INDEX] = void 0;
|
|
34348
|
-
delete array2[MAX_ARRAY_INDEX];
|
|
34349
34424
|
for (let i = 2; i < value.length; i += 2) {
|
|
34350
34425
|
const idx = value[i];
|
|
34351
34426
|
if (!is_valid_array_index(idx) || idx >= len) {
|
|
34352
34427
|
throw new Error("Invalid input");
|
|
34353
34428
|
}
|
|
34354
|
-
array2
|
|
34429
|
+
ops.set(array2, idx, hydrate(value[i + 1]));
|
|
34355
34430
|
}
|
|
34356
|
-
array2.length = len;
|
|
34357
34431
|
} else {
|
|
34358
|
-
const array2 =
|
|
34432
|
+
const array2 = ops.createArray(value.length);
|
|
34359
34433
|
hydrated[index2] = array2;
|
|
34360
34434
|
for (let i = 0; i < value.length; i += 1) {
|
|
34361
34435
|
const n = value[i];
|
|
34362
34436
|
if (n === HOLE) continue;
|
|
34363
|
-
array2
|
|
34437
|
+
ops.set(array2, i, hydrate(n));
|
|
34364
34438
|
}
|
|
34365
34439
|
}
|
|
34366
34440
|
} else {
|
|
34367
|
-
const object2 =
|
|
34441
|
+
const object2 = ops.createObject();
|
|
34368
34442
|
hydrated[index2] = object2;
|
|
34369
34443
|
for (const key of Object.keys(value)) {
|
|
34370
34444
|
if (key === "__proto__") {
|
|
34371
34445
|
throw new Error("Cannot parse an object with a `__proto__` property");
|
|
34372
34446
|
}
|
|
34373
|
-
|
|
34374
|
-
object2[key] = hydrate(n);
|
|
34447
|
+
ops.set(object2, key, hydrate(value[key]));
|
|
34375
34448
|
}
|
|
34376
34449
|
}
|
|
34377
34450
|
return hydrated[index2];
|
|
34378
34451
|
}
|
|
34379
34452
|
return hydrate(0);
|
|
34380
34453
|
}
|
|
34381
|
-
function stringify$2(value, reducers) {
|
|
34454
|
+
function stringify$2(value, reducers, options) {
|
|
34382
34455
|
const stringified = run(false, value, reducers);
|
|
34383
34456
|
return typeof stringified === "string" ? stringified : `[${stringified.join(",")}]`;
|
|
34384
34457
|
}
|
|
34385
|
-
function run(async, value, reducers) {
|
|
34458
|
+
function run(async, value, reducers, options) {
|
|
34459
|
+
const ops = merge_operations(default_stringify_operations);
|
|
34386
34460
|
const stringified = [];
|
|
34387
34461
|
const indexes = /* @__PURE__ */ new Map();
|
|
34388
34462
|
const custom2 = [];
|
|
@@ -34394,17 +34468,24 @@ function run(async, value, reducers) {
|
|
|
34394
34468
|
const keys2 = [];
|
|
34395
34469
|
let p2 = 0;
|
|
34396
34470
|
function flatten(thing, index3) {
|
|
34397
|
-
|
|
34398
|
-
if (
|
|
34399
|
-
|
|
34400
|
-
if (
|
|
34401
|
-
|
|
34402
|
-
|
|
34471
|
+
const type = ops.typeOf(thing);
|
|
34472
|
+
if (type === "undefined") return UNDEFINED;
|
|
34473
|
+
let number2;
|
|
34474
|
+
if (type === "number") {
|
|
34475
|
+
number2 = /** @type {number} */
|
|
34476
|
+
ops.toPrimitive(thing);
|
|
34477
|
+
if (Number.isNaN(number2)) return NAN;
|
|
34478
|
+
if (number2 === Infinity) return POSITIVE_INFINITY;
|
|
34479
|
+
if (number2 === -Infinity) return NEGATIVE_INFINITY;
|
|
34480
|
+
if (number2 === 0 && 1 / number2 < 0) return NEGATIVE_ZERO;
|
|
34481
|
+
}
|
|
34482
|
+
const id2 = ops.identify(thing);
|
|
34483
|
+
if (indexes.has(id2)) return (
|
|
34403
34484
|
/** @type {number} */
|
|
34404
|
-
indexes.get(
|
|
34485
|
+
indexes.get(id2)
|
|
34405
34486
|
);
|
|
34406
34487
|
index3 ?? (index3 = p2++);
|
|
34407
|
-
indexes.set(
|
|
34488
|
+
indexes.set(id2, index3);
|
|
34408
34489
|
for (const { key, fn: fn2 } of custom2) {
|
|
34409
34490
|
const value2 = fn2(thing);
|
|
34410
34491
|
if (value2) {
|
|
@@ -34412,15 +34493,15 @@ function run(async, value, reducers) {
|
|
|
34412
34493
|
return index3;
|
|
34413
34494
|
}
|
|
34414
34495
|
}
|
|
34415
|
-
if (
|
|
34496
|
+
if (type === "function") {
|
|
34416
34497
|
throw new DevalueError(`Cannot stringify a function`, keys2, thing, value);
|
|
34417
|
-
} else if (
|
|
34498
|
+
} else if (type === "symbol") {
|
|
34418
34499
|
throw new DevalueError(`Cannot stringify a Symbol primitive`, keys2, thing, value);
|
|
34419
34500
|
}
|
|
34420
34501
|
let str = "";
|
|
34421
|
-
if (
|
|
34422
|
-
str = stringify_primitive(thing);
|
|
34423
|
-
} else if (
|
|
34502
|
+
if (type !== "object") {
|
|
34503
|
+
str = stringify_primitive(type === "number" ? number2 : ops.toPrimitive(thing));
|
|
34504
|
+
} else if (ops.isThenable(thing)) {
|
|
34424
34505
|
{
|
|
34425
34506
|
throw new DevalueError(
|
|
34426
34507
|
`Cannot stringify a Promise or thenable — use stringifyAsync instead`,
|
|
@@ -34430,54 +34511,51 @@ function run(async, value, reducers) {
|
|
|
34430
34511
|
);
|
|
34431
34512
|
}
|
|
34432
34513
|
} else {
|
|
34433
|
-
const
|
|
34434
|
-
switch (
|
|
34514
|
+
const tag = ops.tagOf(thing);
|
|
34515
|
+
switch (tag) {
|
|
34435
34516
|
case "Number":
|
|
34436
34517
|
case "String":
|
|
34437
34518
|
case "Boolean":
|
|
34438
34519
|
case "BigInt":
|
|
34439
|
-
str = `["Object",${flatten(
|
|
34520
|
+
str = `["Object",${flatten(ops.unbox(thing))}]`;
|
|
34440
34521
|
break;
|
|
34441
34522
|
case "Date":
|
|
34442
|
-
|
|
34443
|
-
str = `["Date","${valid2 ? thing.toISOString() : ""}"]`;
|
|
34523
|
+
str = `["Date","${ops.toISOString(thing)}"]`;
|
|
34444
34524
|
break;
|
|
34445
34525
|
case "URL":
|
|
34446
|
-
str = `["URL",${stringify_string(
|
|
34526
|
+
str = `["URL",${stringify_string(ops.toStringValue(thing))}]`;
|
|
34447
34527
|
break;
|
|
34448
34528
|
case "URLSearchParams":
|
|
34449
|
-
str = `["URLSearchParams",${stringify_string(
|
|
34529
|
+
str = `["URLSearchParams",${stringify_string(ops.toStringValue(thing))}]`;
|
|
34450
34530
|
break;
|
|
34451
34531
|
case "RegExp":
|
|
34452
|
-
const { source, flags } = thing;
|
|
34532
|
+
const { source, flags } = ops.regExpInfo(thing);
|
|
34453
34533
|
str = flags ? `["RegExp",${stringify_string(source)},"${flags}"]` : `["RegExp",${stringify_string(source)}]`;
|
|
34454
34534
|
break;
|
|
34455
34535
|
case "Array": {
|
|
34456
34536
|
let mostly_dense = false;
|
|
34537
|
+
const length = ops.lengthOf(thing);
|
|
34457
34538
|
str = "[";
|
|
34458
|
-
for (let i = 0; i <
|
|
34539
|
+
for (let i = 0; i < length; i += 1) {
|
|
34459
34540
|
if (i > 0) str += ",";
|
|
34460
|
-
if (
|
|
34541
|
+
if (ops.hasOwn(thing, i)) {
|
|
34461
34542
|
keys2.push(`[${i}]`);
|
|
34462
|
-
str += flatten(thing
|
|
34543
|
+
str += flatten(ops.get(thing, i));
|
|
34463
34544
|
keys2.pop();
|
|
34464
34545
|
} else if (mostly_dense) {
|
|
34465
34546
|
str += HOLE;
|
|
34466
34547
|
} else {
|
|
34467
|
-
const populated_keys =
|
|
34468
|
-
/** @type {any[]} */
|
|
34469
|
-
thing
|
|
34470
|
-
);
|
|
34548
|
+
const populated_keys = ops.indicesOf(thing);
|
|
34471
34549
|
const population = populated_keys.length;
|
|
34472
|
-
const d2 = String(
|
|
34473
|
-
const hole_cost = (
|
|
34550
|
+
const d2 = String(length).length;
|
|
34551
|
+
const hole_cost = (length - population) * 3;
|
|
34474
34552
|
const sparse_cost = 4 + d2 + population * (d2 + 1);
|
|
34475
34553
|
if (hole_cost > sparse_cost) {
|
|
34476
|
-
str = "[" + SPARSE + "," +
|
|
34554
|
+
str = "[" + SPARSE + "," + length;
|
|
34477
34555
|
for (let j2 = 0; j2 < populated_keys.length; j2++) {
|
|
34478
34556
|
const key = populated_keys[j2];
|
|
34479
34557
|
keys2.push(`[${key}]`);
|
|
34480
|
-
str += "," + key + "," + flatten(thing
|
|
34558
|
+
str += "," + key + "," + flatten(ops.get(thing, key));
|
|
34481
34559
|
keys2.pop();
|
|
34482
34560
|
}
|
|
34483
34561
|
break;
|
|
@@ -34492,15 +34570,19 @@ function run(async, value, reducers) {
|
|
|
34492
34570
|
}
|
|
34493
34571
|
case "Set":
|
|
34494
34572
|
str = '["Set"';
|
|
34495
|
-
for (const value2 of thing) {
|
|
34573
|
+
for (const value2 of ops.valuesOf(thing)) {
|
|
34496
34574
|
str += `,${flatten(value2)}`;
|
|
34497
34575
|
}
|
|
34498
34576
|
str += "]";
|
|
34499
34577
|
break;
|
|
34500
34578
|
case "Map":
|
|
34501
34579
|
str = '["Map"';
|
|
34502
|
-
for (const [key, value2] of thing) {
|
|
34503
|
-
|
|
34580
|
+
for (const [key, value2] of ops.entriesOf(thing)) {
|
|
34581
|
+
const key_type = ops.typeOf(key);
|
|
34582
|
+
const key_is_primitive = key_type !== "object" && key_type !== "function" && key_type !== "symbol";
|
|
34583
|
+
keys2.push(
|
|
34584
|
+
`.get(${key_is_primitive ? stringify_primitive(ops.toPrimitive(key)) : "..."})`
|
|
34585
|
+
);
|
|
34504
34586
|
str += `,${flatten(key)},${flatten(value2)}`;
|
|
34505
34587
|
keys2.pop();
|
|
34506
34588
|
}
|
|
@@ -34517,19 +34599,26 @@ function run(async, value, reducers) {
|
|
|
34517
34599
|
case "Float32Array":
|
|
34518
34600
|
case "Float64Array":
|
|
34519
34601
|
case "BigInt64Array":
|
|
34520
|
-
case "BigUint64Array":
|
|
34602
|
+
case "BigUint64Array": {
|
|
34603
|
+
const info = ops.viewInfo(thing);
|
|
34604
|
+
str = '["' + tag + '",' + flatten(info.buffer);
|
|
34605
|
+
if (info.byteLength !== info.bufferByteLength) {
|
|
34606
|
+
str += `,${info.byteOffset},${info.length}`;
|
|
34607
|
+
}
|
|
34608
|
+
str += "]";
|
|
34609
|
+
break;
|
|
34610
|
+
}
|
|
34521
34611
|
case "DataView": {
|
|
34522
|
-
const
|
|
34523
|
-
str = '["' +
|
|
34524
|
-
if (
|
|
34525
|
-
str += `,${
|
|
34612
|
+
const info = ops.viewInfo(thing);
|
|
34613
|
+
str = '["' + tag + '",' + flatten(info.buffer);
|
|
34614
|
+
if (info.byteLength !== info.bufferByteLength) {
|
|
34615
|
+
str += `,${info.byteOffset},${info.byteLength}`;
|
|
34526
34616
|
}
|
|
34527
34617
|
str += "]";
|
|
34528
34618
|
break;
|
|
34529
34619
|
}
|
|
34530
34620
|
case "ArrayBuffer": {
|
|
34531
|
-
const
|
|
34532
|
-
const base642 = encode64(arraybuffer);
|
|
34621
|
+
const base642 = encode64(ops.toArrayBuffer(thing));
|
|
34533
34622
|
str = `["ArrayBuffer","${base642}"]`;
|
|
34534
34623
|
break;
|
|
34535
34624
|
}
|
|
@@ -34541,18 +34630,19 @@ function run(async, value, reducers) {
|
|
|
34541
34630
|
case "Temporal.PlainMonthDay":
|
|
34542
34631
|
case "Temporal.PlainYearMonth":
|
|
34543
34632
|
case "Temporal.ZonedDateTime":
|
|
34544
|
-
str = `["${
|
|
34633
|
+
str = `["${tag}",${stringify_string(ops.toStringValue(thing))}]`;
|
|
34545
34634
|
break;
|
|
34546
|
-
default:
|
|
34547
|
-
|
|
34635
|
+
default: {
|
|
34636
|
+
const shape = ops.shapeOf(thing);
|
|
34637
|
+
if (shape.kind === "not-plain") {
|
|
34548
34638
|
throw new DevalueError(`Cannot stringify arbitrary non-POJOs`, keys2, thing, value);
|
|
34549
34639
|
}
|
|
34550
|
-
if (
|
|
34640
|
+
if (shape.kind === "symbol-keys") {
|
|
34551
34641
|
throw new DevalueError(`Cannot stringify POJOs with symbolic keys`, keys2, thing, value);
|
|
34552
34642
|
}
|
|
34553
|
-
if (
|
|
34643
|
+
if (shape.kind === "null-proto") {
|
|
34554
34644
|
str = '["null"';
|
|
34555
|
-
for (const key of
|
|
34645
|
+
for (const key of shape.keys) {
|
|
34556
34646
|
if (key === "__proto__") {
|
|
34557
34647
|
throw new DevalueError(
|
|
34558
34648
|
`Cannot stringify objects with __proto__ keys`,
|
|
@@ -34562,14 +34652,14 @@ function run(async, value, reducers) {
|
|
|
34562
34652
|
);
|
|
34563
34653
|
}
|
|
34564
34654
|
keys2.push(stringify_key(key));
|
|
34565
|
-
str += `,${stringify_string(key)},${flatten(thing
|
|
34655
|
+
str += `,${stringify_string(key)},${flatten(ops.get(thing, key))}`;
|
|
34566
34656
|
keys2.pop();
|
|
34567
34657
|
}
|
|
34568
34658
|
str += "]";
|
|
34569
34659
|
} else {
|
|
34570
34660
|
str = "{";
|
|
34571
34661
|
let started = false;
|
|
34572
|
-
for (const key of
|
|
34662
|
+
for (const key of shape.keys) {
|
|
34573
34663
|
if (key === "__proto__") {
|
|
34574
34664
|
throw new DevalueError(
|
|
34575
34665
|
`Cannot stringify objects with __proto__ keys`,
|
|
@@ -34581,11 +34671,12 @@ function run(async, value, reducers) {
|
|
|
34581
34671
|
if (started) str += ",";
|
|
34582
34672
|
started = true;
|
|
34583
34673
|
keys2.push(stringify_key(key));
|
|
34584
|
-
str += `${stringify_string(key)}:${flatten(thing
|
|
34674
|
+
str += `${stringify_string(key)}:${flatten(ops.get(thing, key))}`;
|
|
34585
34675
|
keys2.pop();
|
|
34586
34676
|
}
|
|
34587
34677
|
str += "}";
|
|
34588
34678
|
}
|
|
34679
|
+
}
|
|
34589
34680
|
}
|
|
34590
34681
|
}
|
|
34591
34682
|
stringified[index3] = str;
|
|
@@ -49326,6 +49417,11 @@ function getWebRevivers() {
|
|
|
49326
49417
|
BigInt: (value) => BigInt(value),
|
|
49327
49418
|
BigInt64Array: (value) => new BigInt64Array(reviveArrayBuffer(value)),
|
|
49328
49419
|
BigUint64Array: (value) => new BigUint64Array(reviveArrayBuffer(value)),
|
|
49420
|
+
// Deliberately not registered under `DataView`: payloads written before
|
|
49421
|
+
// core gained this reducer use devalue's built-in encoding, and a custom
|
|
49422
|
+
// reviver for that tag would strip their bounds and render the whole
|
|
49423
|
+
// backing buffer. See `getCommonReducers()` in core's `serialization.ts`.
|
|
49424
|
+
DataViewBytes: (value) => new DataView(reviveArrayBuffer(value)),
|
|
49329
49425
|
Date: (value) => new Date(value),
|
|
49330
49426
|
Error: (value) => {
|
|
49331
49427
|
const error2 = new Error(value.message);
|
|
@@ -81877,7 +81973,7 @@ var tn = f("block", "before:content-[counter(line)]", "before:inline-block", "be
|
|
|
81877
81973
|
var et = ({ className: e, language: t, style: o, isIncomplete: n, ...s2 }) => jsxRuntimeExports.jsx("div", { className: f("my-4 flex w-full flex-col gap-2 rounded-xl border border-border bg-sidebar p-2", e), "data-incomplete": n || void 0, "data-language": t, "data-streamdown": "code-block", style: { contentVisibility: "auto", containIntrinsicSize: "auto 200px", ...o }, ...s2 });
|
|
81878
81974
|
var Se = reactExports.createContext({ code: "" }), de = () => reactExports.useContext(Se);
|
|
81879
81975
|
var ot = ({ language: e }) => jsxRuntimeExports.jsx("div", { className: "flex h-8 items-center text-muted-foreground text-xs", "data-language": e, "data-streamdown": "code-block-header", children: jsxRuntimeExports.jsx("span", { className: "ml-1 font-mono lowercase", children: e }) });
|
|
81880
|
-
var cn$1 = /\n+$/, dn = reactExports.lazy(() => import("./highlighted-body-B3W2YXNL-
|
|
81976
|
+
var cn$1 = /\n+$/, dn = reactExports.lazy(() => import("./highlighted-body-B3W2YXNL-D7styBk6.js").then((e) => ({ default: e.HighlightedCodeBlockBody }))), rt = ({ code: e, language: t, className: o, children: n, isIncomplete: s2 = false, ...r2 }) => {
|
|
81881
81977
|
let i = reactExports.useMemo(() => e.replace(cn$1, ""), [e]), c = reactExports.useMemo(() => ({ bg: "transparent", fg: "inherit", tokens: i.split(`
|
|
81882
81978
|
`).map((a2) => [{ content: a2, color: "inherit", bgColor: "transparent", htmlStyle: {}, offset: 0 }]) }), [i]);
|
|
81883
81979
|
return jsxRuntimeExports.jsx(Se.Provider, { value: { code: e }, children: jsxRuntimeExports.jsxs(et, { isIncomplete: s2, language: t, children: [jsxRuntimeExports.jsx(ot, { language: t }), n ? jsxRuntimeExports.jsx("div", { className: "pointer-events-none sticky top-2 z-10 -mt-10 flex h-8 items-center justify-end", children: jsxRuntimeExports.jsx("div", { className: "pointer-events-auto flex shrink-0 items-center gap-2 rounded-md border border-sidebar bg-sidebar/80 px-1.5 py-1 supports-[backdrop-filter]:bg-sidebar/70 supports-[backdrop-filter]:backdrop-blur", "data-streamdown": "code-block-actions", children: n }) }) : null, jsxRuntimeExports.jsx(reactExports.Suspense, { fallback: jsxRuntimeExports.jsx(Qe, { className: o, language: t, result: c, ...r2 }), children: jsxRuntimeExports.jsx(dn, { className: o, code: i, language: t, raw: c, ...r2 }) })] }) });
|
|
@@ -82199,7 +82295,7 @@ var Dt = ({ children: e, className: t, onDownload: o, onError: n }) => {
|
|
|
82199
82295
|
}, []), jsxRuntimeExports.jsxs("div", { className: "relative", ref: i, children: [jsxRuntimeExports.jsx("button", { className: f("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50", t), disabled: c, onClick: () => r2(!s2), title: "Download table", type: "button", children: e != null ? e : jsxRuntimeExports.jsx(Z, { size: 14 }) }), s2 ? jsxRuntimeExports.jsxs("div", { className: "absolute top-full right-0 z-10 mt-1 min-w-[120px] overflow-hidden rounded-md border border-border bg-background shadow-lg", children: [jsxRuntimeExports.jsx("button", { className: "w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40", onClick: () => a2("csv"), title: "Download table as CSV", type: "button", children: "CSV" }), jsxRuntimeExports.jsx("button", { className: "w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40", onClick: () => a2("markdown"), title: "Download table as Markdown", type: "button", children: "Markdown" })] }) : null] });
|
|
82200
82296
|
};
|
|
82201
82297
|
var Vt = ({ children: e, className: t, showControls: o, ...n }) => jsxRuntimeExports.jsxs("div", { className: "my-4 flex flex-col gap-2 rounded-lg border border-border bg-sidebar p-2", "data-streamdown": "table-wrapper", children: [o ? jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-end gap-1", children: [jsxRuntimeExports.jsx(Ht, {}), jsxRuntimeExports.jsx(Dt, {})] }) : null, jsxRuntimeExports.jsx("div", { className: "border-collapse overflow-x-auto overscroll-y-auto rounded-md border border-border bg-background", children: jsxRuntimeExports.jsx("table", { className: f("w-full divide-y divide-border", t), "data-streamdown": "table", ...n, children: e }) })] });
|
|
82202
|
-
var Jn = reactExports.lazy(() => import("./mermaid-3ZIDBTTL-
|
|
82298
|
+
var Jn = reactExports.lazy(() => import("./mermaid-3ZIDBTTL-b9Kqgreu.js").then((e) => ({ default: e.Mermaid }))), Kn = /language-([^\s]+)/;
|
|
82203
82299
|
function ke(e, t) {
|
|
82204
82300
|
if (!(e != null && e.position || t != null && t.position)) return true;
|
|
82205
82301
|
if (!(e != null && e.position && (t != null && t.position))) return false;
|
|
@@ -90822,6 +90918,17 @@ class WorkflowRunFailedError extends WorkflowError {
|
|
|
90822
90918
|
super(`Workflow run "${runId}" failed: ${error2.message}`, {
|
|
90823
90919
|
cause: causeError
|
|
90824
90920
|
});
|
|
90921
|
+
/**
|
|
90922
|
+
* `failed` is terminal, and a run's terminal state is immutable. This error
|
|
90923
|
+
* is only ever thrown after a *successful* read of such a run, so re-running
|
|
90924
|
+
* the read returns the same record and throws the same error. Marking it
|
|
90925
|
+
* non-retryable is what stops the step executor from spending a retry budget
|
|
90926
|
+
* on that when the read happens inside a step — a parent awaiting a child's
|
|
90927
|
+
* `returnValue` — and then replacing this error with its retry-exhaustion
|
|
90928
|
+
* wrapper. A read that *fails* throws something else and stays retryable.
|
|
90929
|
+
* See `FatalError.is()`.
|
|
90930
|
+
*/
|
|
90931
|
+
__publicField(this, "fatal", true);
|
|
90825
90932
|
__publicField(this, "runId");
|
|
90826
90933
|
this.name = "WorkflowRunFailedError";
|
|
90827
90934
|
this.runId = runId;
|
|
@@ -90971,6 +91078,8 @@ class PreconditionFailedError extends WorkflowWorldError {
|
|
|
90971
91078
|
class WorkflowRunCancelledError extends WorkflowError {
|
|
90972
91079
|
constructor(runId) {
|
|
90973
91080
|
super(`Workflow run "${runId}" cancelled`, {});
|
|
91081
|
+
/** Terminal and immutable, for the same reason as {@link WorkflowRunFailedError.fatal}. */
|
|
91082
|
+
__publicField(this, "fatal", true);
|
|
90974
91083
|
__publicField(this, "runId");
|
|
90975
91084
|
this.name = "WorkflowRunCancelledError";
|
|
90976
91085
|
this.runId = runId;
|
|
@@ -90999,7 +91108,11 @@ class FatalError extends Error {
|
|
|
90999
91108
|
this.name = "FatalError";
|
|
91000
91109
|
}
|
|
91001
91110
|
static is(value) {
|
|
91002
|
-
|
|
91111
|
+
if (!isError(value))
|
|
91112
|
+
return false;
|
|
91113
|
+
if (value.name === "FatalError")
|
|
91114
|
+
return true;
|
|
91115
|
+
return value.fatal === true;
|
|
91003
91116
|
}
|
|
91004
91117
|
}
|
|
91005
91118
|
class RetryableError extends Error {
|
|
@@ -92091,7 +92204,7 @@ createLogger("build", {
|
|
|
92091
92204
|
debugNamespace: "workflow:build"
|
|
92092
92205
|
});
|
|
92093
92206
|
const MAX_QUEUE_DELIVERIES = 48;
|
|
92094
|
-
const version$1 = "4.8.
|
|
92207
|
+
const version$1 = "4.8.10";
|
|
92095
92208
|
const execFileAsync = promisify(execFile);
|
|
92096
92209
|
function parsePort$1(value, radix = 10) {
|
|
92097
92210
|
const port = parseInt(value, radix);
|
|
@@ -95780,10 +95893,27 @@ function requireRequest$1() {
|
|
|
95780
95893
|
return false;
|
|
95781
95894
|
}
|
|
95782
95895
|
}
|
|
95783
|
-
|
|
95896
|
+
/**
|
|
95897
|
+
* @param {number} statusCode
|
|
95898
|
+
* @param {Buffer[]|string[]} headers
|
|
95899
|
+
* @param {import('node:stream').Duplex} socket
|
|
95900
|
+
* @param {string} [statusText]
|
|
95901
|
+
*/
|
|
95902
|
+
onUpgrade(statusCode, headers2, socket, statusText = "") {
|
|
95903
|
+
this.onFinally();
|
|
95784
95904
|
assert2(!this.aborted);
|
|
95785
95905
|
assert2(!this.completed);
|
|
95786
|
-
|
|
95906
|
+
if (channels.headers.hasSubscribers) {
|
|
95907
|
+
channels.headers.publish({ request: this, response: { statusCode, headers: headers2, statusText } });
|
|
95908
|
+
}
|
|
95909
|
+
const result = this[kHandler].onUpgrade(statusCode, headers2, socket);
|
|
95910
|
+
if (!this.aborted) {
|
|
95911
|
+
this.completed = true;
|
|
95912
|
+
if (channels.trailers.hasSubscribers) {
|
|
95913
|
+
channels.trailers.publish({ request: this, trailers: [] });
|
|
95914
|
+
}
|
|
95915
|
+
}
|
|
95916
|
+
return result;
|
|
95787
95917
|
}
|
|
95788
95918
|
onComplete(trailers) {
|
|
95789
95919
|
this.onFinally();
|
|
@@ -95851,7 +95981,11 @@ function requireRequest$1() {
|
|
|
95851
95981
|
} else if (typeof val[i] === "object") {
|
|
95852
95982
|
throw new InvalidArgumentError(`invalid ${key} header`);
|
|
95853
95983
|
} else {
|
|
95854
|
-
|
|
95984
|
+
const str = `${val[i]}`;
|
|
95985
|
+
if (!isValidHeaderValue(str)) {
|
|
95986
|
+
throw new InvalidArgumentError(`invalid ${key} header`);
|
|
95987
|
+
}
|
|
95988
|
+
arr.push(str);
|
|
95855
95989
|
}
|
|
95856
95990
|
}
|
|
95857
95991
|
val = arr;
|
|
@@ -95863,6 +95997,9 @@ function requireRequest$1() {
|
|
|
95863
95997
|
val = "";
|
|
95864
95998
|
} else {
|
|
95865
95999
|
val = `${val}`;
|
|
96000
|
+
if (!isValidHeaderValue(val)) {
|
|
96001
|
+
throw new InvalidArgumentError(`invalid ${key} header`);
|
|
96002
|
+
}
|
|
95866
96003
|
}
|
|
95867
96004
|
if (headerName === "host") {
|
|
95868
96005
|
if (request2.host !== null) {
|
|
@@ -100079,6 +100216,7 @@ function requireClientH1() {
|
|
|
100079
100216
|
RequestContentLengthMismatchError,
|
|
100080
100217
|
ResponseContentLengthMismatchError,
|
|
100081
100218
|
RequestAbortedError,
|
|
100219
|
+
InvalidArgumentError,
|
|
100082
100220
|
HeadersTimeoutError,
|
|
100083
100221
|
HeadersOverflowError,
|
|
100084
100222
|
SocketError,
|
|
@@ -100132,7 +100270,13 @@ function requireClientH1() {
|
|
|
100132
100270
|
function lazyllhttp() {
|
|
100133
100271
|
const llhttpWasmData = process.env.JEST_WORKER_ID ? requireLlhttpWasm() : void 0;
|
|
100134
100272
|
let mod;
|
|
100135
|
-
let useWasmSIMD =
|
|
100273
|
+
let useWasmSIMD = true;
|
|
100274
|
+
if (process.arch === "ppc64") {
|
|
100275
|
+
const [major, minor] = process.versions.node.split(".").map((n) => parseInt(n, 10));
|
|
100276
|
+
if (major < 24 || major === 24 && minor < 12) {
|
|
100277
|
+
useWasmSIMD = false;
|
|
100278
|
+
}
|
|
100279
|
+
}
|
|
100136
100280
|
if (process.env.UNDICI_NO_WASM_SIMD === "1") {
|
|
100137
100281
|
useWasmSIMD = false;
|
|
100138
100282
|
} else if (process.env.UNDICI_NO_WASM_SIMD === "0") {
|
|
@@ -100487,7 +100631,7 @@ function requireClientH1() {
|
|
|
100487
100631
|
* @param {Buffer} head
|
|
100488
100632
|
*/
|
|
100489
100633
|
onUpgrade(head) {
|
|
100490
|
-
const { upgrade, client: client2, socket, headers: headers2, statusCode } = this;
|
|
100634
|
+
const { upgrade, client: client2, socket, headers: headers2, statusCode, statusText } = this;
|
|
100491
100635
|
assert2(upgrade);
|
|
100492
100636
|
assert2(client2[kSocket] === socket);
|
|
100493
100637
|
assert2(!socket.destroyed);
|
|
@@ -100512,8 +100656,9 @@ function requireClientH1() {
|
|
|
100512
100656
|
client2[kQueue][client2[kRunningIdx]++] = null;
|
|
100513
100657
|
client2.emit("disconnect", client2[kUrl], [client2], new InformationalError("upgrade"));
|
|
100514
100658
|
try {
|
|
100515
|
-
request2.onUpgrade(statusCode, headers2, socket);
|
|
100659
|
+
request2.onUpgrade(statusCode, headers2, socket, statusText);
|
|
100516
100660
|
} catch (err) {
|
|
100661
|
+
util2.errorRequest(client2, request2, err);
|
|
100517
100662
|
util2.destroy(socket, err);
|
|
100518
100663
|
}
|
|
100519
100664
|
client2[kResume]();
|
|
@@ -100845,22 +100990,20 @@ function requireClientH1() {
|
|
|
100845
100990
|
}
|
|
100846
100991
|
function clearIdleSocketValidation(socket) {
|
|
100847
100992
|
if (socket[kIdleSocketValidationTimeout]) {
|
|
100848
|
-
|
|
100993
|
+
clearImmediate(socket[kIdleSocketValidationTimeout]);
|
|
100849
100994
|
socket[kIdleSocketValidationTimeout] = null;
|
|
100850
100995
|
}
|
|
100851
100996
|
socket[kIdleSocketValidation] = 0;
|
|
100852
100997
|
}
|
|
100853
100998
|
function scheduleIdleSocketValidation(client2, socket) {
|
|
100854
|
-
var _a3, _b2;
|
|
100855
100999
|
socket[kIdleSocketValidation] = 1;
|
|
100856
|
-
socket[kIdleSocketValidationTimeout] =
|
|
101000
|
+
socket[kIdleSocketValidationTimeout] = setImmediate(() => {
|
|
100857
101001
|
socket[kIdleSocketValidationTimeout] = null;
|
|
100858
101002
|
socket[kIdleSocketValidation] = 2;
|
|
100859
101003
|
if (client2[kSocket] === socket && !socket.destroyed) {
|
|
100860
101004
|
client2[kResume]();
|
|
100861
101005
|
}
|
|
100862
|
-
}
|
|
100863
|
-
(_b2 = (_a3 = socket[kIdleSocketValidationTimeout]).unref) == null ? void 0 : _b2.call(_a3);
|
|
101006
|
+
});
|
|
100864
101007
|
}
|
|
100865
101008
|
function resumeH1(client2) {
|
|
100866
101009
|
const socket = client2[kSocket];
|
|
@@ -100927,8 +101070,16 @@ function requireClientH1() {
|
|
|
100927
101070
|
}
|
|
100928
101071
|
body2 = bodyStream.stream;
|
|
100929
101072
|
contentLength2 = bodyStream.length;
|
|
100930
|
-
} else if (util2.isBlobLike(body2) && request2.contentType == null
|
|
100931
|
-
|
|
101073
|
+
} else if (util2.isBlobLike(body2) && request2.contentType == null) {
|
|
101074
|
+
const contentType = body2.type;
|
|
101075
|
+
if (contentType) {
|
|
101076
|
+
const contentTypeValue = `${contentType}`;
|
|
101077
|
+
if (!util2.isValidHeaderValue(contentTypeValue)) {
|
|
101078
|
+
util2.errorRequest(client2, request2, new InvalidArgumentError("invalid content-type header"));
|
|
101079
|
+
return false;
|
|
101080
|
+
}
|
|
101081
|
+
headers2.push("content-type", contentTypeValue);
|
|
101082
|
+
}
|
|
100932
101083
|
}
|
|
100933
101084
|
if (body2 && typeof body2.read === "function") {
|
|
100934
101085
|
body2.read(0);
|
|
@@ -101342,7 +101493,9 @@ function requireClientH2() {
|
|
|
101342
101493
|
RequestAbortedError,
|
|
101343
101494
|
SocketError,
|
|
101344
101495
|
InformationalError,
|
|
101345
|
-
InvalidArgumentError
|
|
101496
|
+
InvalidArgumentError,
|
|
101497
|
+
HeadersTimeoutError,
|
|
101498
|
+
BodyTimeoutError
|
|
101346
101499
|
} = requireErrors();
|
|
101347
101500
|
const {
|
|
101348
101501
|
kUrl,
|
|
@@ -101367,6 +101520,7 @@ function requireClientH2() {
|
|
|
101367
101520
|
kHTTPContext,
|
|
101368
101521
|
kClosed,
|
|
101369
101522
|
kBodyTimeout,
|
|
101523
|
+
kHeadersTimeout,
|
|
101370
101524
|
kEnableConnectProtocol,
|
|
101371
101525
|
kRemoteSettings,
|
|
101372
101526
|
kHTTP2Stream,
|
|
@@ -101503,7 +101657,7 @@ function requireClientH2() {
|
|
|
101503
101657
|
function resumeH2(client2) {
|
|
101504
101658
|
const socket = client2[kSocket];
|
|
101505
101659
|
if ((socket == null ? void 0 : socket.destroyed) === false) {
|
|
101506
|
-
if (client2[kSize] === 0
|
|
101660
|
+
if (client2[kSize] === 0) {
|
|
101507
101661
|
socket.unref();
|
|
101508
101662
|
client2[kHTTP2Session].unref();
|
|
101509
101663
|
} else {
|
|
@@ -101569,6 +101723,24 @@ function requireClientH2() {
|
|
|
101569
101723
|
this.destroy(err);
|
|
101570
101724
|
util2.destroy(this[kSocket], err);
|
|
101571
101725
|
}
|
|
101726
|
+
function completeRequest(client2, request2, resetPendingIdx = false) {
|
|
101727
|
+
const queue = client2[kQueue];
|
|
101728
|
+
const runningIdx = client2[kRunningIdx];
|
|
101729
|
+
if (runningIdx < client2[kPendingIdx] && queue[runningIdx] === request2) {
|
|
101730
|
+
queue[runningIdx] = null;
|
|
101731
|
+
client2[kRunningIdx] = runningIdx + 1;
|
|
101732
|
+
return;
|
|
101733
|
+
}
|
|
101734
|
+
const index2 = queue.indexOf(request2, runningIdx);
|
|
101735
|
+
if (index2 === -1 || index2 >= client2[kPendingIdx]) {
|
|
101736
|
+
return;
|
|
101737
|
+
}
|
|
101738
|
+
queue.splice(index2, 1);
|
|
101739
|
+
client2[kPendingIdx]--;
|
|
101740
|
+
if (resetPendingIdx && client2[kPendingIdx] < client2[kRunningIdx]) {
|
|
101741
|
+
client2[kPendingIdx] = client2[kRunningIdx];
|
|
101742
|
+
}
|
|
101743
|
+
}
|
|
101572
101744
|
function onHttp2SessionGoAway(errorCode) {
|
|
101573
101745
|
const err = this[kError] || new SocketError(`HTTP/2: "GOAWAY" frame received with code ${errorCode}`, util2.getSocketInfo(this[kSocket]));
|
|
101574
101746
|
const client2 = this[kClient];
|
|
@@ -101580,7 +101752,9 @@ function requireClientH2() {
|
|
|
101580
101752
|
if (client2[kRunningIdx] < client2[kQueue].length) {
|
|
101581
101753
|
const request2 = client2[kQueue][client2[kRunningIdx]];
|
|
101582
101754
|
client2[kQueue][client2[kRunningIdx]++] = null;
|
|
101583
|
-
|
|
101755
|
+
if (request2 != null) {
|
|
101756
|
+
util2.errorRequest(client2, request2, err);
|
|
101757
|
+
}
|
|
101584
101758
|
client2[kPendingIdx] = client2[kRunningIdx];
|
|
101585
101759
|
}
|
|
101586
101760
|
assert2(client2[kRunning] === 0);
|
|
@@ -101603,7 +101777,9 @@ function requireClientH2() {
|
|
|
101603
101777
|
const requests = client2[kQueue].splice(client2[kRunningIdx]);
|
|
101604
101778
|
for (let i = 0; i < requests.length; i++) {
|
|
101605
101779
|
const request2 = requests[i];
|
|
101606
|
-
|
|
101780
|
+
if (request2 != null) {
|
|
101781
|
+
util2.errorRequest(client2, request2, err);
|
|
101782
|
+
}
|
|
101607
101783
|
}
|
|
101608
101784
|
}
|
|
101609
101785
|
}
|
|
@@ -101635,7 +101811,8 @@ function requireClientH2() {
|
|
|
101635
101811
|
return method !== "GET" && method !== "HEAD" && method !== "OPTIONS" && method !== "TRACE" && method !== "CONNECT";
|
|
101636
101812
|
}
|
|
101637
101813
|
function writeH2(client2, request2) {
|
|
101638
|
-
const
|
|
101814
|
+
const headersTimeout = request2.headersTimeout ?? client2[kHeadersTimeout];
|
|
101815
|
+
const bodyTimeout = request2.bodyTimeout ?? client2[kBodyTimeout];
|
|
101639
101816
|
const session = client2[kHTTP2Session];
|
|
101640
101817
|
const { method, path: path2, host, upgrade, expectContinue, signal, protocol, headers: reqHeaders } = request2;
|
|
101641
101818
|
let { body: body2 } = request2;
|
|
@@ -101683,6 +101860,7 @@ function requireClientH2() {
|
|
|
101683
101860
|
stream.removeAllListeners("data");
|
|
101684
101861
|
stream.close();
|
|
101685
101862
|
client2[kOnError](err);
|
|
101863
|
+
completeRequest(client2, request2);
|
|
101686
101864
|
client2[kResume]();
|
|
101687
101865
|
}
|
|
101688
101866
|
util2.destroy(body2, err);
|
|
@@ -101713,11 +101891,16 @@ function requireClientH2() {
|
|
|
101713
101891
|
}
|
|
101714
101892
|
stream = session.request(headers2, { endStream: false, signal });
|
|
101715
101893
|
stream[kHTTP2Stream] = true;
|
|
101894
|
+
++session[kOpenStreams];
|
|
101716
101895
|
stream.once("response", (headers3, _flags) => {
|
|
101717
101896
|
const { [HTTP2_HEADER_STATUS]: statusCode, ...realHeaders } = headers3;
|
|
101718
|
-
|
|
101719
|
-
|
|
101720
|
-
|
|
101897
|
+
try {
|
|
101898
|
+
request2.onUpgrade(statusCode, parseH2Headers(realHeaders), stream);
|
|
101899
|
+
} catch (err) {
|
|
101900
|
+
abort(err);
|
|
101901
|
+
return;
|
|
101902
|
+
}
|
|
101903
|
+
completeRequest(client2, request2);
|
|
101721
101904
|
});
|
|
101722
101905
|
stream.on("error", () => {
|
|
101723
101906
|
if (stream.rstCode === NGHTTP2_REFUSED_STREAM || stream.rstCode === NGHTTP2_CANCEL) {
|
|
@@ -101728,22 +101911,28 @@ function requireClientH2() {
|
|
|
101728
101911
|
session[kOpenStreams] -= 1;
|
|
101729
101912
|
if (session[kOpenStreams] === 0) session.unref();
|
|
101730
101913
|
});
|
|
101731
|
-
stream.setTimeout(
|
|
101914
|
+
stream.setTimeout(headersTimeout);
|
|
101732
101915
|
return true;
|
|
101733
101916
|
}
|
|
101734
101917
|
stream = session.request(headers2, { endStream: false, signal });
|
|
101735
101918
|
stream[kHTTP2Stream] = true;
|
|
101919
|
+
++session[kOpenStreams];
|
|
101736
101920
|
stream.on("response", (headers3) => {
|
|
101737
101921
|
const { [HTTP2_HEADER_STATUS]: statusCode, ...realHeaders } = headers3;
|
|
101738
|
-
|
|
101739
|
-
|
|
101740
|
-
|
|
101922
|
+
try {
|
|
101923
|
+
request2.onUpgrade(statusCode, parseH2Headers(realHeaders), stream);
|
|
101924
|
+
} catch (err) {
|
|
101925
|
+
abort(err);
|
|
101926
|
+
return;
|
|
101927
|
+
}
|
|
101928
|
+
completeRequest(client2, request2);
|
|
101741
101929
|
});
|
|
101930
|
+
stream.on("error", abort);
|
|
101742
101931
|
stream.once("close", () => {
|
|
101743
101932
|
session[kOpenStreams] -= 1;
|
|
101744
101933
|
if (session[kOpenStreams] === 0) session.unref();
|
|
101745
101934
|
});
|
|
101746
|
-
stream.setTimeout(
|
|
101935
|
+
stream.setTimeout(headersTimeout);
|
|
101747
101936
|
return true;
|
|
101748
101937
|
}
|
|
101749
101938
|
headers2[HTTP2_HEADER_PATH] = path2;
|
|
@@ -101801,12 +101990,13 @@ function requireClientH2() {
|
|
|
101801
101990
|
writeBodyH2();
|
|
101802
101991
|
}
|
|
101803
101992
|
++session[kOpenStreams];
|
|
101804
|
-
stream.setTimeout(
|
|
101993
|
+
stream.setTimeout(headersTimeout);
|
|
101805
101994
|
let responseReceived = false;
|
|
101806
101995
|
stream.once("response", (headers3) => {
|
|
101807
101996
|
const { [HTTP2_HEADER_STATUS]: statusCode, ...realHeaders } = headers3;
|
|
101808
101997
|
request2.onResponseStarted();
|
|
101809
101998
|
responseReceived = true;
|
|
101999
|
+
stream.setTimeout(bodyTimeout);
|
|
101810
102000
|
if (request2.aborted) {
|
|
101811
102001
|
stream.removeAllListeners("data");
|
|
101812
102002
|
return;
|
|
@@ -101829,12 +102019,11 @@ function requireClientH2() {
|
|
|
101829
102019
|
if (!request2.aborted && !request2.completed) {
|
|
101830
102020
|
request2.onComplete({});
|
|
101831
102021
|
}
|
|
101832
|
-
client2
|
|
102022
|
+
completeRequest(client2, request2);
|
|
101833
102023
|
client2[kResume]();
|
|
101834
102024
|
} else {
|
|
101835
102025
|
abort(new InformationalError("HTTP/2: stream half-closed (remote)"));
|
|
101836
|
-
client2
|
|
101837
|
-
client2[kPendingIdx] = client2[kRunningIdx];
|
|
102026
|
+
completeRequest(client2, request2, true);
|
|
101838
102027
|
client2[kResume]();
|
|
101839
102028
|
}
|
|
101840
102029
|
});
|
|
@@ -101844,6 +102033,9 @@ function requireClientH2() {
|
|
|
101844
102033
|
if (session[kOpenStreams] === 0) {
|
|
101845
102034
|
session.unref();
|
|
101846
102035
|
}
|
|
102036
|
+
if (!request2.aborted && !request2.completed) {
|
|
102037
|
+
abort(new InformationalError("HTTP/2: stream closed before the response was complete"));
|
|
102038
|
+
}
|
|
101847
102039
|
});
|
|
101848
102040
|
stream.once("error", function(err) {
|
|
101849
102041
|
stream.removeAllListeners("data");
|
|
@@ -101857,7 +102049,7 @@ function requireClientH2() {
|
|
|
101857
102049
|
stream.removeAllListeners("data");
|
|
101858
102050
|
});
|
|
101859
102051
|
stream.on("timeout", () => {
|
|
101860
|
-
const err = new
|
|
102052
|
+
const err = responseReceived ? new BodyTimeoutError(`HTTP/2: "body timeout after ${bodyTimeout}"`) : new HeadersTimeoutError(`HTTP/2: "headers timeout after ${headersTimeout}"`);
|
|
101861
102053
|
stream.removeAllListeners("data");
|
|
101862
102054
|
session[kOpenStreams] -= 1;
|
|
101863
102055
|
if (session[kOpenStreams] === 0) {
|
|
@@ -102357,7 +102549,9 @@ function requireClient() {
|
|
|
102357
102549
|
const requests = this[kQueue].splice(this[kPendingIdx]);
|
|
102358
102550
|
for (let i = 0; i < requests.length; i++) {
|
|
102359
102551
|
const request2 = requests[i];
|
|
102360
|
-
|
|
102552
|
+
if (request2 != null) {
|
|
102553
|
+
util2.errorRequest(this, request2, err);
|
|
102554
|
+
}
|
|
102361
102555
|
}
|
|
102362
102556
|
const callback = () => {
|
|
102363
102557
|
if (this[kClosedResolve]) {
|
|
@@ -102382,7 +102576,9 @@ function requireClient() {
|
|
|
102382
102576
|
const requests = client2[kQueue].splice(client2[kRunningIdx]);
|
|
102383
102577
|
for (let i = 0; i < requests.length; i++) {
|
|
102384
102578
|
const request2 = requests[i];
|
|
102385
|
-
|
|
102579
|
+
if (request2 != null) {
|
|
102580
|
+
util2.errorRequest(client2, request2, err);
|
|
102581
|
+
}
|
|
102386
102582
|
}
|
|
102387
102583
|
assert2(client2[kSize] === 0);
|
|
102388
102584
|
}
|
|
@@ -102985,12 +103181,14 @@ function requireBalancedPool() {
|
|
|
102985
103181
|
return new Pool(origin, opts);
|
|
102986
103182
|
}
|
|
102987
103183
|
class BalancedPool extends PoolBase {
|
|
102988
|
-
constructor(upstreams = [], { factory = defaultFactory, ...opts } = {}) {
|
|
103184
|
+
constructor(upstreams = [], { factory = defaultFactory, connect: connect2, tls, ...opts } = {}) {
|
|
102989
103185
|
if (typeof factory !== "function") {
|
|
102990
103186
|
throw new InvalidArgumentError("factory must be a function.");
|
|
102991
103187
|
}
|
|
102992
103188
|
super(opts);
|
|
102993
|
-
|
|
103189
|
+
if (connect2 && typeof connect2 !== "function") connect2 = { ...connect2 };
|
|
103190
|
+
if (tls && typeof tls !== "function") tls = { ...tls };
|
|
103191
|
+
this[kOptions] = { ...util2.deepClone(opts), connect: connect2, tls };
|
|
102994
103192
|
this[kOptions].interceptors = opts.interceptors ? { ...opts.interceptors } : void 0;
|
|
102995
103193
|
this[kIndex] = -1;
|
|
102996
103194
|
this[kCurrentWeight] = 0;
|
|
@@ -104435,6 +104633,7 @@ function requireEnvHttpProxyAgent() {
|
|
|
104435
104633
|
var retryHandler;
|
|
104436
104634
|
var hasRequiredRetryHandler;
|
|
104437
104635
|
function requireRetryHandler() {
|
|
104636
|
+
var _paused, _target;
|
|
104438
104637
|
if (hasRequiredRetryHandler) return retryHandler;
|
|
104439
104638
|
hasRequiredRetryHandler = 1;
|
|
104440
104639
|
const assert2 = require$$0$4;
|
|
@@ -104450,6 +104649,84 @@ function requireRetryHandler() {
|
|
|
104450
104649
|
const retryTime = new Date(retryAfter).getTime();
|
|
104451
104650
|
return isNaN(retryTime) ? 0 : retryTime - Date.now();
|
|
104452
104651
|
}
|
|
104652
|
+
function validatePartialResponseContentLength(headers2, range2, statusCode, retryCount) {
|
|
104653
|
+
const contentLength2 = headers2["content-length"];
|
|
104654
|
+
if (contentLength2 == null) {
|
|
104655
|
+
return;
|
|
104656
|
+
}
|
|
104657
|
+
if (!Number.isFinite(range2.start) || !Number.isFinite(range2.end)) {
|
|
104658
|
+
return;
|
|
104659
|
+
}
|
|
104660
|
+
const length = Number(contentLength2);
|
|
104661
|
+
const expectedLength = range2.end - range2.start + 1;
|
|
104662
|
+
if (!Number.isFinite(length) || length !== expectedLength) {
|
|
104663
|
+
throw new RequestRetryError("Content-Length mismatch", statusCode, {
|
|
104664
|
+
headers: headers2,
|
|
104665
|
+
data: { count: retryCount }
|
|
104666
|
+
});
|
|
104667
|
+
}
|
|
104668
|
+
}
|
|
104669
|
+
class RetryController {
|
|
104670
|
+
constructor() {
|
|
104671
|
+
__privateAdd(this, _paused, false);
|
|
104672
|
+
__privateAdd(this, _target, null);
|
|
104673
|
+
}
|
|
104674
|
+
set target(target2) {
|
|
104675
|
+
__privateSet(this, _target, target2);
|
|
104676
|
+
if (__privateGet(this, _paused)) {
|
|
104677
|
+
target2 == null ? void 0 : target2.pause();
|
|
104678
|
+
}
|
|
104679
|
+
}
|
|
104680
|
+
get target() {
|
|
104681
|
+
return __privateGet(this, _target);
|
|
104682
|
+
}
|
|
104683
|
+
pause() {
|
|
104684
|
+
var _a3;
|
|
104685
|
+
__privateSet(this, _paused, true);
|
|
104686
|
+
(_a3 = __privateGet(this, _target)) == null ? void 0 : _a3.pause();
|
|
104687
|
+
}
|
|
104688
|
+
resume() {
|
|
104689
|
+
var _a3;
|
|
104690
|
+
__privateSet(this, _paused, false);
|
|
104691
|
+
(_a3 = __privateGet(this, _target)) == null ? void 0 : _a3.resume();
|
|
104692
|
+
}
|
|
104693
|
+
abort(reason) {
|
|
104694
|
+
var _a3;
|
|
104695
|
+
(_a3 = __privateGet(this, _target)) == null ? void 0 : _a3.abort(reason);
|
|
104696
|
+
}
|
|
104697
|
+
get paused() {
|
|
104698
|
+
var _a3;
|
|
104699
|
+
return __privateGet(this, _paused) || (((_a3 = __privateGet(this, _target)) == null ? void 0 : _a3.paused) ?? false);
|
|
104700
|
+
}
|
|
104701
|
+
get aborted() {
|
|
104702
|
+
var _a3;
|
|
104703
|
+
return ((_a3 = __privateGet(this, _target)) == null ? void 0 : _a3.aborted) ?? false;
|
|
104704
|
+
}
|
|
104705
|
+
get reason() {
|
|
104706
|
+
var _a3;
|
|
104707
|
+
return ((_a3 = __privateGet(this, _target)) == null ? void 0 : _a3.reason) ?? null;
|
|
104708
|
+
}
|
|
104709
|
+
get rawHeaders() {
|
|
104710
|
+
var _a3;
|
|
104711
|
+
return ((_a3 = __privateGet(this, _target)) == null ? void 0 : _a3.rawHeaders) ?? null;
|
|
104712
|
+
}
|
|
104713
|
+
set rawHeaders(value) {
|
|
104714
|
+
if (__privateGet(this, _target)) {
|
|
104715
|
+
__privateGet(this, _target).rawHeaders = value;
|
|
104716
|
+
}
|
|
104717
|
+
}
|
|
104718
|
+
get rawTrailers() {
|
|
104719
|
+
var _a3;
|
|
104720
|
+
return ((_a3 = __privateGet(this, _target)) == null ? void 0 : _a3.rawTrailers) ?? null;
|
|
104721
|
+
}
|
|
104722
|
+
set rawTrailers(value) {
|
|
104723
|
+
if (__privateGet(this, _target)) {
|
|
104724
|
+
__privateGet(this, _target).rawTrailers = value;
|
|
104725
|
+
}
|
|
104726
|
+
}
|
|
104727
|
+
}
|
|
104728
|
+
_paused = new WeakMap();
|
|
104729
|
+
_target = new WeakMap();
|
|
104453
104730
|
class RetryHandler {
|
|
104454
104731
|
constructor(opts, { dispatch: dispatch2, handler }) {
|
|
104455
104732
|
const { retryOptions, ...dispatchOpts } = opts;
|
|
@@ -104504,13 +104781,19 @@ function requireRetryHandler() {
|
|
|
104504
104781
|
this.start = 0;
|
|
104505
104782
|
this.end = null;
|
|
104506
104783
|
this.etag = null;
|
|
104784
|
+
this.controllerProxy = new RetryController();
|
|
104507
104785
|
}
|
|
104508
104786
|
onResponseStartWithRetry(controller, statusCode, headers2, statusMessage, err) {
|
|
104509
|
-
var _a3, _b2, _c, _d;
|
|
104787
|
+
var _a3, _b2, _c, _d, _e2, _f;
|
|
104510
104788
|
if (this.retryOpts.throwOnError) {
|
|
104511
104789
|
if (this.retryOpts.statusCodes.includes(statusCode) === false) {
|
|
104512
|
-
this.headersSent
|
|
104513
|
-
|
|
104790
|
+
if (this.headersSent) {
|
|
104791
|
+
(_b2 = (_a3 = this.handler).onResponseError) == null ? void 0 : _b2.call(_a3, this.controllerProxy, err);
|
|
104792
|
+
} else {
|
|
104793
|
+
this.headersSent = true;
|
|
104794
|
+
this.checkpointResponseEnd(headers2);
|
|
104795
|
+
(_d = (_c = this.handler).onResponseStart) == null ? void 0 : _d.call(_c, this.controllerProxy, statusCode, headers2, statusMessage);
|
|
104796
|
+
}
|
|
104514
104797
|
} else {
|
|
104515
104798
|
this.error = err;
|
|
104516
104799
|
}
|
|
@@ -104518,14 +104801,20 @@ function requireRetryHandler() {
|
|
|
104518
104801
|
}
|
|
104519
104802
|
if (isDisturbed(this.opts.body)) {
|
|
104520
104803
|
this.headersSent = true;
|
|
104521
|
-
|
|
104804
|
+
this.checkpointResponseEnd(headers2);
|
|
104805
|
+
(_f = (_e2 = this.handler).onResponseStart) == null ? void 0 : _f.call(_e2, this.controllerProxy, statusCode, headers2, statusMessage);
|
|
104522
104806
|
return;
|
|
104523
104807
|
}
|
|
104524
104808
|
function shouldRetry(passedErr) {
|
|
104525
|
-
var _a4, _b3;
|
|
104809
|
+
var _a4, _b3, _c2, _d2;
|
|
104526
104810
|
if (passedErr) {
|
|
104527
|
-
this.headersSent
|
|
104528
|
-
|
|
104811
|
+
if (this.headersSent) {
|
|
104812
|
+
(_b3 = (_a4 = this.handler).onResponseError) == null ? void 0 : _b3.call(_a4, this.controllerProxy, passedErr);
|
|
104813
|
+
} else {
|
|
104814
|
+
this.headersSent = true;
|
|
104815
|
+
this.checkpointResponseEnd(headers2);
|
|
104816
|
+
(_d2 = (_c2 = this.handler).onResponseStart) == null ? void 0 : _d2.call(_c2, this.controllerProxy, statusCode, headers2, statusMessage);
|
|
104817
|
+
}
|
|
104529
104818
|
controller.resume();
|
|
104530
104819
|
return;
|
|
104531
104820
|
}
|
|
@@ -104542,15 +104831,27 @@ function requireRetryHandler() {
|
|
|
104542
104831
|
shouldRetry.bind(this)
|
|
104543
104832
|
);
|
|
104544
104833
|
}
|
|
104834
|
+
checkpointResponseEnd(headers2) {
|
|
104835
|
+
if (this.end == null && this.opts.method !== "HEAD") {
|
|
104836
|
+
const contentLength2 = headers2["content-length"];
|
|
104837
|
+
this.end = contentLength2 != null ? Number(contentLength2) - 1 : null;
|
|
104838
|
+
assert2(
|
|
104839
|
+
this.end == null || Number.isFinite(this.end),
|
|
104840
|
+
"invalid content-length"
|
|
104841
|
+
);
|
|
104842
|
+
this.resume = this.end != null;
|
|
104843
|
+
}
|
|
104844
|
+
}
|
|
104545
104845
|
onRequestStart(controller, context) {
|
|
104546
104846
|
var _a3, _b2;
|
|
104847
|
+
this.controllerProxy.target = controller;
|
|
104547
104848
|
if (!this.headersSent) {
|
|
104548
|
-
(_b2 = (_a3 = this.handler).onRequestStart) == null ? void 0 : _b2.call(_a3,
|
|
104849
|
+
(_b2 = (_a3 = this.handler).onRequestStart) == null ? void 0 : _b2.call(_a3, this.controllerProxy, context);
|
|
104549
104850
|
}
|
|
104550
104851
|
}
|
|
104551
|
-
onRequestUpgrade(
|
|
104852
|
+
onRequestUpgrade(_controller, statusCode, headers2, socket) {
|
|
104552
104853
|
var _a3, _b2;
|
|
104553
|
-
(_b2 = (_a3 = this.handler).onRequestUpgrade) == null ? void 0 : _b2.call(_a3,
|
|
104854
|
+
(_b2 = (_a3 = this.handler).onRequestUpgrade) == null ? void 0 : _b2.call(_a3, this.controllerProxy, statusCode, headers2, socket);
|
|
104554
104855
|
}
|
|
104555
104856
|
static [kRetryHandlerDefaultRetry](err, { state, opts }, cb) {
|
|
104556
104857
|
const { statusCode, code: code2, headers: headers2 } = err;
|
|
@@ -104623,9 +104924,14 @@ function requireRetryHandler() {
|
|
|
104623
104924
|
data: { count: this.retryCount }
|
|
104624
104925
|
});
|
|
104625
104926
|
}
|
|
104927
|
+
validatePartialResponseContentLength(headers2, contentRange, statusCode, this.retryCount);
|
|
104626
104928
|
const { start: start2, size: size2, end = size2 ? size2 - 1 : null } = contentRange;
|
|
104627
|
-
|
|
104628
|
-
|
|
104929
|
+
if (this.start !== start2 || this.end != null && this.end !== end) {
|
|
104930
|
+
throw new RequestRetryError("Content-Range mismatch", statusCode, {
|
|
104931
|
+
headers: headers2,
|
|
104932
|
+
data: { count: this.retryCount }
|
|
104933
|
+
});
|
|
104934
|
+
}
|
|
104629
104935
|
return;
|
|
104630
104936
|
}
|
|
104631
104937
|
if (this.end == null) {
|
|
@@ -104635,13 +104941,14 @@ function requireRetryHandler() {
|
|
|
104635
104941
|
this.headersSent = true;
|
|
104636
104942
|
(_b2 = (_a3 = this.handler).onResponseStart) == null ? void 0 : _b2.call(
|
|
104637
104943
|
_a3,
|
|
104638
|
-
|
|
104944
|
+
this.controllerProxy,
|
|
104639
104945
|
statusCode,
|
|
104640
104946
|
headers2,
|
|
104641
104947
|
statusMessage
|
|
104642
104948
|
);
|
|
104643
104949
|
return;
|
|
104644
104950
|
}
|
|
104951
|
+
validatePartialResponseContentLength(headers2, range2, statusCode, this.retryCount);
|
|
104645
104952
|
const { start: start2, size: size2, end = size2 ? size2 - 1 : null } = range2;
|
|
104646
104953
|
assert2(
|
|
104647
104954
|
start2 != null && Number.isFinite(start2),
|
|
@@ -104668,7 +104975,7 @@ function requireRetryHandler() {
|
|
|
104668
104975
|
this.headersSent = true;
|
|
104669
104976
|
(_d = (_c = this.handler).onResponseStart) == null ? void 0 : _d.call(
|
|
104670
104977
|
_c,
|
|
104671
|
-
|
|
104978
|
+
this.controllerProxy,
|
|
104672
104979
|
statusCode,
|
|
104673
104980
|
headers2,
|
|
104674
104981
|
statusMessage
|
|
@@ -104680,26 +104987,26 @@ function requireRetryHandler() {
|
|
|
104680
104987
|
});
|
|
104681
104988
|
}
|
|
104682
104989
|
}
|
|
104683
|
-
onResponseData(
|
|
104990
|
+
onResponseData(_controller, chunk) {
|
|
104684
104991
|
var _a3, _b2;
|
|
104685
104992
|
if (this.error) {
|
|
104686
104993
|
return;
|
|
104687
104994
|
}
|
|
104688
104995
|
this.start += chunk.length;
|
|
104689
|
-
(_b2 = (_a3 = this.handler).onResponseData) == null ? void 0 : _b2.call(_a3,
|
|
104996
|
+
(_b2 = (_a3 = this.handler).onResponseData) == null ? void 0 : _b2.call(_a3, this.controllerProxy, chunk);
|
|
104690
104997
|
}
|
|
104691
|
-
onResponseEnd(
|
|
104998
|
+
onResponseEnd(_controller, trailers) {
|
|
104692
104999
|
var _a3, _b2;
|
|
104693
105000
|
if (this.error && this.retryOpts.throwOnError) {
|
|
104694
105001
|
throw this.error;
|
|
104695
105002
|
}
|
|
104696
105003
|
if (!this.error) {
|
|
104697
105004
|
this.retryCount = 0;
|
|
104698
|
-
return (_b2 = (_a3 = this.handler).onResponseEnd) == null ? void 0 : _b2.call(_a3,
|
|
105005
|
+
return (_b2 = (_a3 = this.handler).onResponseEnd) == null ? void 0 : _b2.call(_a3, this.controllerProxy, trailers);
|
|
104699
105006
|
}
|
|
104700
|
-
this.retry(
|
|
105007
|
+
this.retry();
|
|
104701
105008
|
}
|
|
104702
|
-
retry(
|
|
105009
|
+
retry() {
|
|
104703
105010
|
var _a3, _b2;
|
|
104704
105011
|
if (this.start !== 0) {
|
|
104705
105012
|
const headers2 = { range: `bytes=${this.start}-${this.end ?? ""}` };
|
|
@@ -104718,22 +105025,22 @@ function requireRetryHandler() {
|
|
|
104718
105025
|
this.retryCountCheckpoint = this.retryCount;
|
|
104719
105026
|
this.dispatch(this.opts, this);
|
|
104720
105027
|
} catch (err) {
|
|
104721
|
-
(_b2 = (_a3 = this.handler).onResponseError) == null ? void 0 : _b2.call(_a3,
|
|
105028
|
+
(_b2 = (_a3 = this.handler).onResponseError) == null ? void 0 : _b2.call(_a3, this.controllerProxy, err);
|
|
104722
105029
|
}
|
|
104723
105030
|
}
|
|
104724
105031
|
onResponseError(controller, err) {
|
|
104725
105032
|
var _a3, _b2;
|
|
104726
|
-
if ((controller == null ? void 0 : controller.aborted) || isDisturbed(this.opts.body)) {
|
|
104727
|
-
(_b2 = (_a3 = this.handler).onResponseError) == null ? void 0 : _b2.call(_a3,
|
|
105033
|
+
if ((controller == null ? void 0 : controller.aborted) || isDisturbed(this.opts.body) || this.headersSent && !this.resume) {
|
|
105034
|
+
(_b2 = (_a3 = this.handler).onResponseError) == null ? void 0 : _b2.call(_a3, this.controllerProxy, err);
|
|
104728
105035
|
return;
|
|
104729
105036
|
}
|
|
104730
105037
|
function shouldRetry(returnedErr) {
|
|
104731
105038
|
var _a4, _b3;
|
|
104732
105039
|
if (!returnedErr) {
|
|
104733
|
-
this.retry(
|
|
105040
|
+
this.retry();
|
|
104734
105041
|
return;
|
|
104735
105042
|
}
|
|
104736
|
-
(_b3 = (_a4 = this.handler) == null ? void 0 : _a4.onResponseError) == null ? void 0 : _b3.call(_a4,
|
|
105043
|
+
(_b3 = (_a4 = this.handler) == null ? void 0 : _a4.onResponseError) == null ? void 0 : _b3.call(_a4, this.controllerProxy, returnedErr);
|
|
104737
105044
|
}
|
|
104738
105045
|
if (this.retryCount - this.retryCountCheckpoint > 0) {
|
|
104739
105046
|
this.retryCount = this.retryCountCheckpoint + (this.retryCount - this.retryCountCheckpoint);
|
|
@@ -108368,7 +108675,7 @@ function requireRetry() {
|
|
|
108368
108675
|
var dump;
|
|
108369
108676
|
var hasRequiredDump;
|
|
108370
108677
|
function requireDump() {
|
|
108371
|
-
var _maxSize2, _dumped, _size2,
|
|
108678
|
+
var _maxSize2, _dumped, _size2, _DumpHandler_instances, abort_fn;
|
|
108372
108679
|
if (hasRequiredDump) return dump;
|
|
108373
108680
|
hasRequiredDump = 1;
|
|
108374
108681
|
const { InvalidArgumentError, RequestAbortedError } = requireErrors();
|
|
@@ -108383,14 +108690,12 @@ function requireDump() {
|
|
|
108383
108690
|
__privateAdd(this, _maxSize2, 1024 * 1024);
|
|
108384
108691
|
__privateAdd(this, _dumped, false);
|
|
108385
108692
|
__privateAdd(this, _size2, 0);
|
|
108386
|
-
__privateAdd(this, _controller, null);
|
|
108387
108693
|
__publicField(this, "aborted", false);
|
|
108388
108694
|
__publicField(this, "reason", false);
|
|
108389
108695
|
__privateSet(this, _maxSize2, maxSize ?? __privateGet(this, _maxSize2));
|
|
108390
108696
|
}
|
|
108391
108697
|
onRequestStart(controller, context) {
|
|
108392
108698
|
controller.abort = __privateMethod(this, _DumpHandler_instances, abort_fn).bind(this);
|
|
108393
|
-
__privateSet(this, _controller, controller);
|
|
108394
108699
|
return super.onRequestStart(controller, context);
|
|
108395
108700
|
}
|
|
108396
108701
|
onResponseStart(controller, statusCode, headers2, statusMessage) {
|
|
@@ -108406,40 +108711,31 @@ function requireDump() {
|
|
|
108406
108711
|
return super.onResponseStart(controller, statusCode, headers2, statusMessage);
|
|
108407
108712
|
}
|
|
108408
108713
|
onResponseError(controller, err) {
|
|
108409
|
-
|
|
108410
|
-
if (__privateGet(this, _dumped)) {
|
|
108411
|
-
return;
|
|
108412
|
-
}
|
|
108413
|
-
err = ((_a3 = __privateGet(this, _controller)) == null ? void 0 : _a3.reason) ?? err;
|
|
108414
|
-
super.onResponseError(controller, err);
|
|
108714
|
+
super.onResponseError(controller, this.aborted === true ? this.reason : err);
|
|
108415
108715
|
}
|
|
108416
108716
|
onResponseData(controller, chunk) {
|
|
108417
108717
|
__privateSet(this, _size2, __privateGet(this, _size2) + chunk.length);
|
|
108418
|
-
if (__privateGet(this, _size2)
|
|
108718
|
+
if (__privateGet(this, _size2) > __privateGet(this, _maxSize2)) {
|
|
108719
|
+
throw new RequestAbortedError(
|
|
108720
|
+
`Response size (${__privateGet(this, _size2)}) larger than maxSize (${__privateGet(this, _maxSize2)})`
|
|
108721
|
+
);
|
|
108722
|
+
}
|
|
108723
|
+
if (__privateGet(this, _size2) === __privateGet(this, _maxSize2)) {
|
|
108419
108724
|
__privateSet(this, _dumped, true);
|
|
108420
|
-
if (this.aborted === true) {
|
|
108421
|
-
super.onResponseError(controller, this.reason);
|
|
108422
|
-
} else {
|
|
108423
|
-
super.onResponseEnd(controller, {});
|
|
108424
|
-
}
|
|
108425
108725
|
}
|
|
108426
108726
|
return true;
|
|
108427
108727
|
}
|
|
108428
108728
|
onResponseEnd(controller, trailers) {
|
|
108429
|
-
if (
|
|
108430
|
-
return;
|
|
108431
|
-
}
|
|
108432
|
-
if (__privateGet(this, _controller).aborted === true) {
|
|
108729
|
+
if (this.aborted === true) {
|
|
108433
108730
|
super.onResponseError(controller, this.reason);
|
|
108434
108731
|
return;
|
|
108435
108732
|
}
|
|
108436
|
-
super.onResponseEnd(controller, trailers);
|
|
108733
|
+
super.onResponseEnd(controller, __privateGet(this, _dumped) ? {} : trailers);
|
|
108437
108734
|
}
|
|
108438
108735
|
}
|
|
108439
108736
|
_maxSize2 = new WeakMap();
|
|
108440
108737
|
_dumped = new WeakMap();
|
|
108441
108738
|
_size2 = new WeakMap();
|
|
108442
|
-
_controller = new WeakMap();
|
|
108443
108739
|
_DumpHandler_instances = new WeakSet();
|
|
108444
108740
|
abort_fn = function(reason) {
|
|
108445
108741
|
this.aborted = true;
|
|
@@ -108922,9 +109218,122 @@ function requireCache$2() {
|
|
|
108922
109218
|
const {
|
|
108923
109219
|
safeHTTPMethods,
|
|
108924
109220
|
pathHasQueryOrFragment,
|
|
108925
|
-
hasSafeIterator
|
|
109221
|
+
hasSafeIterator,
|
|
109222
|
+
isValidHTTPToken
|
|
108926
109223
|
} = requireUtil$5();
|
|
108927
109224
|
const { serializePathWithQuery } = requireUtil$5();
|
|
109225
|
+
const MAX_DELTA_SECONDS = 2147483647;
|
|
109226
|
+
const RESTRICTIVE_DIRECTIVE_NAMES = ["no-store", "private", "no-cache"];
|
|
109227
|
+
const kInvalidCacheControlDirectives = Symbol("invalid cache-control directives");
|
|
109228
|
+
function trimOWS(value) {
|
|
109229
|
+
return value.replace(/^[\t ]+|[\t ]+$/g, "");
|
|
109230
|
+
}
|
|
109231
|
+
function arrayIncludes(array2, value) {
|
|
109232
|
+
for (let i = 0; i < array2.length; i++) {
|
|
109233
|
+
if (array2[i] === value) {
|
|
109234
|
+
return true;
|
|
109235
|
+
}
|
|
109236
|
+
}
|
|
109237
|
+
return false;
|
|
109238
|
+
}
|
|
109239
|
+
function trimOWSStart(value) {
|
|
109240
|
+
return value.replace(/^[\t ]+/, "");
|
|
109241
|
+
}
|
|
109242
|
+
function trimOWSEnd(value) {
|
|
109243
|
+
return value.replace(/[\t ]+$/, "");
|
|
109244
|
+
}
|
|
109245
|
+
function findUnescapedQuote(value, start2) {
|
|
109246
|
+
let escaped = false;
|
|
109247
|
+
for (let i = start2; i < value.length; i++) {
|
|
109248
|
+
if (escaped) {
|
|
109249
|
+
escaped = false;
|
|
109250
|
+
} else if (value[i] === "\\") {
|
|
109251
|
+
escaped = true;
|
|
109252
|
+
} else if (value[i] === '"') {
|
|
109253
|
+
return i;
|
|
109254
|
+
}
|
|
109255
|
+
}
|
|
109256
|
+
return -1;
|
|
109257
|
+
}
|
|
109258
|
+
function splitCacheControlHeaderValue(value) {
|
|
109259
|
+
const directives = [];
|
|
109260
|
+
let start2 = 0;
|
|
109261
|
+
let quoteStart = -1;
|
|
109262
|
+
let inQuote = false;
|
|
109263
|
+
let escaped = false;
|
|
109264
|
+
for (let i = 0; i < value.length; i++) {
|
|
109265
|
+
if (inQuote) {
|
|
109266
|
+
if (escaped) {
|
|
109267
|
+
escaped = false;
|
|
109268
|
+
} else if (value[i] === "\\") {
|
|
109269
|
+
escaped = true;
|
|
109270
|
+
} else if (value[i] === '"') {
|
|
109271
|
+
inQuote = false;
|
|
109272
|
+
quoteStart = -1;
|
|
109273
|
+
}
|
|
109274
|
+
} else if (value[i] === '"') {
|
|
109275
|
+
inQuote = true;
|
|
109276
|
+
quoteStart = i;
|
|
109277
|
+
} else if (value[i] === ",") {
|
|
109278
|
+
directives.push({ value: value.substring(start2, i), fromMalformedQuote: false });
|
|
109279
|
+
start2 = i + 1;
|
|
109280
|
+
}
|
|
109281
|
+
}
|
|
109282
|
+
if (!inQuote) {
|
|
109283
|
+
directives.push({ value: value.substring(start2), fromMalformedQuote: false });
|
|
109284
|
+
return directives;
|
|
109285
|
+
}
|
|
109286
|
+
const tail = value.substring(start2);
|
|
109287
|
+
const quoteOffset = quoteStart - start2;
|
|
109288
|
+
let tailStart = 0;
|
|
109289
|
+
for (let i = 0; i < tail.length; i++) {
|
|
109290
|
+
if (tail[i] === ",") {
|
|
109291
|
+
directives.push({
|
|
109292
|
+
value: tail.substring(tailStart, i),
|
|
109293
|
+
fromMalformedQuote: tailStart > quoteOffset
|
|
109294
|
+
});
|
|
109295
|
+
tailStart = i + 1;
|
|
109296
|
+
}
|
|
109297
|
+
}
|
|
109298
|
+
directives.push({
|
|
109299
|
+
value: tail.substring(tailStart),
|
|
109300
|
+
fromMalformedQuote: tailStart > quoteOffset
|
|
109301
|
+
});
|
|
109302
|
+
return directives;
|
|
109303
|
+
}
|
|
109304
|
+
function markInvalidCacheControlDirective(directives, key) {
|
|
109305
|
+
let invalidDirectives = directives[kInvalidCacheControlDirectives];
|
|
109306
|
+
if (invalidDirectives === void 0) {
|
|
109307
|
+
invalidDirectives = /* @__PURE__ */ new Set();
|
|
109308
|
+
Object.defineProperty(directives, kInvalidCacheControlDirectives, {
|
|
109309
|
+
value: invalidDirectives
|
|
109310
|
+
});
|
|
109311
|
+
}
|
|
109312
|
+
invalidDirectives.add(key);
|
|
109313
|
+
}
|
|
109314
|
+
function hasInvalidCacheControlDirective(directives, key) {
|
|
109315
|
+
var _a3;
|
|
109316
|
+
return ((_a3 = directives[kInvalidCacheControlDirectives]) == null ? void 0 : _a3.has(key)) === true;
|
|
109317
|
+
}
|
|
109318
|
+
function getMalformedRestrictiveDirectiveName(key) {
|
|
109319
|
+
for (const directiveName of RESTRICTIVE_DIRECTIVE_NAMES) {
|
|
109320
|
+
if (key.startsWith(directiveName) && key.length > directiveName.length && !isValidHTTPToken(key[directiveName.length])) {
|
|
109321
|
+
return directiveName;
|
|
109322
|
+
}
|
|
109323
|
+
}
|
|
109324
|
+
let tokenOnlyKey = "";
|
|
109325
|
+
let hasInvalidTokenChar = false;
|
|
109326
|
+
for (let i = 0; i < key.length; i++) {
|
|
109327
|
+
if (isValidHTTPToken(key[i])) {
|
|
109328
|
+
tokenOnlyKey += key[i];
|
|
109329
|
+
} else {
|
|
109330
|
+
hasInvalidTokenChar = true;
|
|
109331
|
+
}
|
|
109332
|
+
}
|
|
109333
|
+
if (hasInvalidTokenChar && arrayIncludes(RESTRICTIVE_DIRECTIVE_NAMES, tokenOnlyKey)) {
|
|
109334
|
+
return tokenOnlyKey;
|
|
109335
|
+
}
|
|
109336
|
+
}
|
|
108928
109337
|
function makeCacheKey(opts) {
|
|
108929
109338
|
if (!opts.origin) {
|
|
108930
109339
|
throw new Error("opts.origin is undefined");
|
|
@@ -108940,6 +109349,18 @@ function requireCache$2() {
|
|
|
108940
109349
|
headers: opts.headers
|
|
108941
109350
|
};
|
|
108942
109351
|
}
|
|
109352
|
+
function appendHeader(headers2, key, val) {
|
|
109353
|
+
const headerName = key.toLowerCase();
|
|
109354
|
+
const current = headers2[headerName];
|
|
109355
|
+
const values = Array.isArray(val) ? val : [val];
|
|
109356
|
+
if (current === void 0) {
|
|
109357
|
+
headers2[headerName] = Array.isArray(val) ? val.slice() : val;
|
|
109358
|
+
} else if (Array.isArray(current)) {
|
|
109359
|
+
current.push(...values);
|
|
109360
|
+
} else {
|
|
109361
|
+
headers2[headerName] = [current, ...values];
|
|
109362
|
+
}
|
|
109363
|
+
}
|
|
108943
109364
|
function normalizeHeaders(opts) {
|
|
108944
109365
|
let headers2;
|
|
108945
109366
|
if (opts.headers == null) {
|
|
@@ -108955,11 +109376,11 @@ function requireCache$2() {
|
|
|
108955
109376
|
if (typeof key !== "string" || typeof val !== "string") {
|
|
108956
109377
|
throw new Error("opts.headers is not a valid header map");
|
|
108957
109378
|
}
|
|
108958
|
-
headers2
|
|
109379
|
+
appendHeader(headers2, key, val);
|
|
108959
109380
|
}
|
|
108960
109381
|
} else {
|
|
108961
109382
|
for (const key of Object.keys(opts.headers)) {
|
|
108962
|
-
headers2
|
|
109383
|
+
appendHeader(headers2, key, opts.headers[key]);
|
|
108963
109384
|
}
|
|
108964
109385
|
}
|
|
108965
109386
|
} else {
|
|
@@ -109004,25 +109425,32 @@ function requireCache$2() {
|
|
|
109004
109425
|
}
|
|
109005
109426
|
function parseCacheControlHeader(header) {
|
|
109006
109427
|
const output = {};
|
|
109007
|
-
|
|
109008
|
-
|
|
109009
|
-
|
|
109010
|
-
for (const directive of header) {
|
|
109011
|
-
directives.push(...directive.split(","));
|
|
109012
|
-
}
|
|
109013
|
-
} else {
|
|
109014
|
-
directives = header.split(",");
|
|
109015
|
-
}
|
|
109428
|
+
const invalidNumericDirectives = /* @__PURE__ */ new Set();
|
|
109429
|
+
const invalidNoArgumentDirectives = /* @__PURE__ */ new Set();
|
|
109430
|
+
const directives = splitCacheControlHeaderValue(Array.isArray(header) ? header.join(",") : header);
|
|
109016
109431
|
for (let i = 0; i < directives.length; i++) {
|
|
109017
|
-
const
|
|
109432
|
+
const directiveRecord = directives[i];
|
|
109433
|
+
const directive = directiveRecord.value.toLowerCase();
|
|
109434
|
+
const fromMalformedQuote = directiveRecord.fromMalformedQuote;
|
|
109018
109435
|
const keyValueDelimiter = directive.indexOf("=");
|
|
109019
109436
|
let key;
|
|
109020
109437
|
let value;
|
|
109438
|
+
let keyHasTrailingWhitespace = false;
|
|
109439
|
+
let valueHasLeadingWhitespace = false;
|
|
109021
109440
|
if (keyValueDelimiter !== -1) {
|
|
109022
|
-
|
|
109023
|
-
|
|
109441
|
+
const rawKey = directive.substring(0, keyValueDelimiter);
|
|
109442
|
+
const rawValue = directive.substring(keyValueDelimiter + 1);
|
|
109443
|
+
keyHasTrailingWhitespace = trimOWSEnd(rawKey) !== rawKey;
|
|
109444
|
+
valueHasLeadingWhitespace = trimOWSStart(rawValue) !== rawValue;
|
|
109445
|
+
key = trimOWS(rawKey);
|
|
109446
|
+
value = trimOWSStart(rawValue);
|
|
109024
109447
|
} else {
|
|
109025
|
-
key = directive
|
|
109448
|
+
key = trimOWS(directive);
|
|
109449
|
+
}
|
|
109450
|
+
const malformedRestrictiveDirectiveName = getMalformedRestrictiveDirectiveName(key);
|
|
109451
|
+
if (malformedRestrictiveDirectiveName !== void 0) {
|
|
109452
|
+
output[malformedRestrictiveDirectiveName] = true;
|
|
109453
|
+
continue;
|
|
109026
109454
|
}
|
|
109027
109455
|
switch (key) {
|
|
109028
109456
|
case "min-fresh":
|
|
@@ -109031,48 +109459,85 @@ function requireCache$2() {
|
|
|
109031
109459
|
case "s-maxage":
|
|
109032
109460
|
case "stale-while-revalidate":
|
|
109033
109461
|
case "stale-if-error": {
|
|
109034
|
-
if (
|
|
109462
|
+
if (fromMalformedQuote || invalidNumericDirectives.has(key)) {
|
|
109463
|
+
continue;
|
|
109464
|
+
}
|
|
109465
|
+
if (value === void 0 || keyHasTrailingWhitespace || valueHasLeadingWhitespace) {
|
|
109466
|
+
delete output[key];
|
|
109467
|
+
invalidNumericDirectives.add(key);
|
|
109468
|
+
markInvalidCacheControlDirective(output, key);
|
|
109035
109469
|
continue;
|
|
109036
109470
|
}
|
|
109037
109471
|
if (value.length >= 2 && value[0] === '"' && value[value.length - 1] === '"') {
|
|
109038
109472
|
value = value.substring(1, value.length - 1);
|
|
109039
109473
|
}
|
|
109040
|
-
|
|
109041
|
-
|
|
109474
|
+
if (!/^[0-9]+$/.test(value)) {
|
|
109475
|
+
delete output[key];
|
|
109476
|
+
invalidNumericDirectives.add(key);
|
|
109477
|
+
markInvalidCacheControlDirective(output, key);
|
|
109042
109478
|
continue;
|
|
109043
109479
|
}
|
|
109044
|
-
|
|
109045
|
-
|
|
109480
|
+
const parsedValue = Math.min(parseInt(value, 10), MAX_DELTA_SECONDS);
|
|
109481
|
+
if (key === "min-fresh") {
|
|
109482
|
+
if (!(key in output) || output[key] < parsedValue) {
|
|
109483
|
+
output[key] = parsedValue;
|
|
109484
|
+
}
|
|
109485
|
+
} else if (!(key in output) || output[key] > parsedValue) {
|
|
109486
|
+
output[key] = parsedValue;
|
|
109046
109487
|
}
|
|
109047
|
-
output[key] = parsedValue;
|
|
109048
109488
|
break;
|
|
109049
109489
|
}
|
|
109050
109490
|
case "private":
|
|
109051
109491
|
case "no-cache": {
|
|
109492
|
+
if (fromMalformedQuote) {
|
|
109493
|
+
output[key] = true;
|
|
109494
|
+
break;
|
|
109495
|
+
}
|
|
109496
|
+
if (value !== void 0 && value.length === 0) {
|
|
109497
|
+
output[key] = true;
|
|
109498
|
+
break;
|
|
109499
|
+
}
|
|
109052
109500
|
if (value) {
|
|
109053
109501
|
if (value[0] === '"') {
|
|
109054
|
-
|
|
109055
|
-
let
|
|
109056
|
-
|
|
109502
|
+
value = trimOWSEnd(value);
|
|
109503
|
+
let fieldList = "";
|
|
109504
|
+
let lastQuotedPart = i;
|
|
109505
|
+
let foundEndingQuote = false;
|
|
109506
|
+
const closingQuote = findUnescapedQuote(value, 1);
|
|
109507
|
+
if (closingQuote !== -1) {
|
|
109508
|
+
fieldList = value.substring(1, closingQuote);
|
|
109509
|
+
foundEndingQuote = true;
|
|
109510
|
+
} else {
|
|
109511
|
+
const fieldListParts = [value.substring(1)];
|
|
109057
109512
|
for (let j2 = i + 1; j2 < directives.length; j2++) {
|
|
109058
|
-
const nextPart = directives[j2];
|
|
109059
|
-
const
|
|
109060
|
-
|
|
109061
|
-
if (
|
|
109513
|
+
const nextPart = trimOWS(directives[j2].value);
|
|
109514
|
+
const closingQuote2 = findUnescapedQuote(nextPart, 0);
|
|
109515
|
+
lastQuotedPart = j2;
|
|
109516
|
+
if (closingQuote2 !== -1) {
|
|
109517
|
+
fieldListParts.push(nextPart.substring(0, closingQuote2));
|
|
109062
109518
|
foundEndingQuote = true;
|
|
109063
109519
|
break;
|
|
109064
109520
|
}
|
|
109521
|
+
fieldListParts.push(nextPart);
|
|
109065
109522
|
}
|
|
109523
|
+
fieldList = fieldListParts.join(",");
|
|
109066
109524
|
}
|
|
109067
|
-
if (foundEndingQuote) {
|
|
109068
|
-
|
|
109069
|
-
|
|
109070
|
-
|
|
109071
|
-
|
|
109072
|
-
|
|
109073
|
-
|
|
109074
|
-
|
|
109525
|
+
if (!foundEndingQuote) {
|
|
109526
|
+
output[key] = true;
|
|
109527
|
+
break;
|
|
109528
|
+
}
|
|
109529
|
+
i = lastQuotedPart;
|
|
109530
|
+
const headers2 = fieldList.split(",");
|
|
109531
|
+
let validFieldNames = true;
|
|
109532
|
+
for (let j2 = 0; j2 < headers2.length; j2++) {
|
|
109533
|
+
headers2[j2] = trimOWS(headers2[j2]);
|
|
109534
|
+
if (!isValidHTTPToken(headers2[j2])) {
|
|
109535
|
+
validFieldNames = false;
|
|
109075
109536
|
}
|
|
109537
|
+
}
|
|
109538
|
+
if (!validFieldNames) {
|
|
109539
|
+
output[key] = true;
|
|
109540
|
+
} else if (output[key] !== true) {
|
|
109076
109541
|
if (key in output) {
|
|
109077
109542
|
output[key] = output[key].concat(headers2);
|
|
109078
109543
|
} else {
|
|
@@ -109080,11 +109545,15 @@ function requireCache$2() {
|
|
|
109080
109545
|
}
|
|
109081
109546
|
}
|
|
109082
109547
|
} else {
|
|
109083
|
-
const fieldName = value
|
|
109084
|
-
if (
|
|
109085
|
-
output[key] =
|
|
109086
|
-
} else {
|
|
109087
|
-
|
|
109548
|
+
const fieldName = trimOWS(value);
|
|
109549
|
+
if (!isValidHTTPToken(fieldName)) {
|
|
109550
|
+
output[key] = true;
|
|
109551
|
+
} else if (output[key] !== true) {
|
|
109552
|
+
if (key in output) {
|
|
109553
|
+
output[key] = output[key].concat(fieldName);
|
|
109554
|
+
} else {
|
|
109555
|
+
output[key] = [fieldName];
|
|
109556
|
+
}
|
|
109088
109557
|
}
|
|
109089
109558
|
}
|
|
109090
109559
|
break;
|
|
@@ -109092,39 +109561,76 @@ function requireCache$2() {
|
|
|
109092
109561
|
}
|
|
109093
109562
|
// eslint-disable-next-line no-fallthrough
|
|
109094
109563
|
case "public":
|
|
109095
|
-
case "no-store":
|
|
109096
109564
|
case "must-revalidate":
|
|
109097
109565
|
case "proxy-revalidate":
|
|
109098
109566
|
case "immutable":
|
|
109099
109567
|
case "no-transform":
|
|
109100
109568
|
case "must-understand":
|
|
109101
109569
|
case "only-if-cached":
|
|
109102
|
-
if (
|
|
109570
|
+
if (fromMalformedQuote || invalidNoArgumentDirectives.has(key)) {
|
|
109571
|
+
continue;
|
|
109572
|
+
}
|
|
109573
|
+
if (value !== void 0) {
|
|
109574
|
+
delete output[key];
|
|
109575
|
+
invalidNoArgumentDirectives.add(key);
|
|
109103
109576
|
continue;
|
|
109104
109577
|
}
|
|
109105
109578
|
output[key] = true;
|
|
109106
109579
|
break;
|
|
109580
|
+
case "no-store":
|
|
109581
|
+
output[key] = true;
|
|
109582
|
+
break;
|
|
109107
109583
|
default:
|
|
109108
109584
|
continue;
|
|
109109
109585
|
}
|
|
109110
109586
|
}
|
|
109111
109587
|
return output;
|
|
109112
109588
|
}
|
|
109589
|
+
function splitVaryHeader(varyHeader) {
|
|
109590
|
+
const values = Array.isArray(varyHeader) ? varyHeader : [varyHeader];
|
|
109591
|
+
const output = [];
|
|
109592
|
+
for (let i = 0; i < values.length; i++) {
|
|
109593
|
+
const parts = values[i].split(",");
|
|
109594
|
+
for (let j2 = 0; j2 < parts.length; j2++) {
|
|
109595
|
+
output.push(parts[j2]);
|
|
109596
|
+
}
|
|
109597
|
+
}
|
|
109598
|
+
return output;
|
|
109599
|
+
}
|
|
109600
|
+
function hasVaryStar(varyHeader) {
|
|
109601
|
+
const values = splitVaryHeader(varyHeader);
|
|
109602
|
+
for (let i = 0; i < values.length; i++) {
|
|
109603
|
+
if (trimOWS(values[i]).indexOf("*") !== -1) {
|
|
109604
|
+
return true;
|
|
109605
|
+
}
|
|
109606
|
+
}
|
|
109607
|
+
return false;
|
|
109608
|
+
}
|
|
109113
109609
|
function parseVaryHeader(varyHeader, headers2) {
|
|
109114
|
-
if (
|
|
109610
|
+
if (hasVaryStar(varyHeader)) {
|
|
109115
109611
|
return headers2;
|
|
109116
109612
|
}
|
|
109117
109613
|
const output = (
|
|
109118
109614
|
/** @type {Record<string, string | string[] | null>} */
|
|
109119
109615
|
{}
|
|
109120
109616
|
);
|
|
109121
|
-
const varyingHeaders =
|
|
109617
|
+
const varyingHeaders = splitVaryHeader(varyHeader);
|
|
109122
109618
|
for (const header of varyingHeaders) {
|
|
109123
|
-
const trimmedHeader = header
|
|
109124
|
-
|
|
109619
|
+
const trimmedHeader = trimOWS(header).toLowerCase();
|
|
109620
|
+
if (trimmedHeader.length === 0) {
|
|
109621
|
+
continue;
|
|
109622
|
+
}
|
|
109623
|
+
if (!isValidHTTPToken(trimmedHeader)) {
|
|
109624
|
+
return void 0;
|
|
109625
|
+
}
|
|
109626
|
+
const headerValue = headers2[trimmedHeader];
|
|
109627
|
+
output[trimmedHeader] = Array.isArray(headerValue) ? headerValue.slice() : headerValue ?? null;
|
|
109125
109628
|
}
|
|
109126
109629
|
return output;
|
|
109127
109630
|
}
|
|
109631
|
+
function isInvalidOrWildcardVaryHeader(varyHeader) {
|
|
109632
|
+
return hasVaryStar(varyHeader) || parseVaryHeader(varyHeader, {}) === void 0;
|
|
109633
|
+
}
|
|
109128
109634
|
function isEtagUsable(etag) {
|
|
109129
109635
|
if (etag.length <= 2) {
|
|
109130
109636
|
return false;
|
|
@@ -109155,7 +109661,7 @@ function requireCache$2() {
|
|
|
109155
109661
|
throw new TypeError(`${name2} needs to have at least one method`);
|
|
109156
109662
|
}
|
|
109157
109663
|
for (const method of methods) {
|
|
109158
|
-
if (!safeHTTPMethods
|
|
109664
|
+
if (!arrayIncludes(safeHTTPMethods, method)) {
|
|
109159
109665
|
throw new TypeError(`element of ${name2}-array needs to be one of following values: ${safeHTTPMethods.join(", ")}, got ${method}`);
|
|
109160
109666
|
}
|
|
109161
109667
|
}
|
|
@@ -109179,7 +109685,10 @@ function requireCache$2() {
|
|
|
109179
109685
|
assertCacheKey,
|
|
109180
109686
|
assertCacheValue,
|
|
109181
109687
|
parseCacheControlHeader,
|
|
109688
|
+
hasInvalidCacheControlDirective,
|
|
109182
109689
|
parseVaryHeader,
|
|
109690
|
+
hasVaryStar,
|
|
109691
|
+
isInvalidOrWildcardVaryHeader,
|
|
109183
109692
|
isEtagUsable,
|
|
109184
109693
|
assertCacheMethods,
|
|
109185
109694
|
assertCacheStore,
|
|
@@ -109202,6 +109711,13 @@ function requireDate() {
|
|
|
109202
109711
|
return parseRfc850Date(date2);
|
|
109203
109712
|
}
|
|
109204
109713
|
}
|
|
109714
|
+
function makeDate(year, monthIdx, day, hour, minute, second, weekday) {
|
|
109715
|
+
const result = new Date(Date.UTC(year, monthIdx, day, hour, minute, second));
|
|
109716
|
+
if (year >= 0 && year <= 99) {
|
|
109717
|
+
result.setUTCFullYear(year);
|
|
109718
|
+
}
|
|
109719
|
+
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;
|
|
109720
|
+
}
|
|
109205
109721
|
function parseImfDate(date2) {
|
|
109206
109722
|
if (date2.length !== 29 || date2[4] !== " " || date2[7] !== " " || date2[11] !== " " || date2[16] !== " " || date2[19] !== ":" || date2[22] !== ":" || date2[25] !== " " || date2[26] !== "G" || date2[27] !== "M" || date2[28] !== "T") {
|
|
109207
109723
|
return void 0;
|
|
@@ -109362,8 +109878,7 @@ function requireDate() {
|
|
|
109362
109878
|
}
|
|
109363
109879
|
second = (code1 - 48) * 10 + (code2 - 48);
|
|
109364
109880
|
}
|
|
109365
|
-
|
|
109366
|
-
return result.getUTCDay() === weekday ? result : void 0;
|
|
109881
|
+
return makeDate(year, monthIdx, day, hour, minute, second, weekday);
|
|
109367
109882
|
}
|
|
109368
109883
|
function parseAscTimeDate(date2) {
|
|
109369
109884
|
if (date2.length !== 24 || date2[7] !== " " || date2[10] !== " " || date2[19] !== " ") {
|
|
@@ -109525,8 +110040,7 @@ function requireDate() {
|
|
|
109525
110040
|
return void 0;
|
|
109526
110041
|
}
|
|
109527
110042
|
const year = (yearDigit1 - 48) * 1e3 + (yearDigit2 - 48) * 100 + (yearDigit3 - 48) * 10 + (yearDigit4 - 48);
|
|
109528
|
-
|
|
109529
|
-
return result.getUTCDay() === weekday ? result : void 0;
|
|
110043
|
+
return makeDate(year, monthIdx, day, hour, minute, second, weekday);
|
|
109530
110044
|
}
|
|
109531
110045
|
function parseRfc850Date(date2) {
|
|
109532
110046
|
let commaIndex = -1;
|
|
@@ -109675,8 +110189,7 @@ function requireDate() {
|
|
|
109675
110189
|
}
|
|
109676
110190
|
second = (code1 - 48) * 10 + (code2 - 48);
|
|
109677
110191
|
}
|
|
109678
|
-
|
|
109679
|
-
return result.getUTCDay() === weekday ? result : void 0;
|
|
110192
|
+
return makeDate(year, monthIdx, day, hour, minute, second, weekday);
|
|
109680
110193
|
}
|
|
109681
110194
|
date$1 = {
|
|
109682
110195
|
parseHttpDate
|
|
@@ -109692,7 +110205,10 @@ function requireCacheHandler() {
|
|
|
109692
110205
|
const util2 = requireUtil$5();
|
|
109693
110206
|
const {
|
|
109694
110207
|
parseCacheControlHeader,
|
|
110208
|
+
hasInvalidCacheControlDirective,
|
|
109695
110209
|
parseVaryHeader,
|
|
110210
|
+
hasVaryStar,
|
|
110211
|
+
isInvalidOrWildcardVaryHeader,
|
|
109696
110212
|
isEtagUsable
|
|
109697
110213
|
} = requireCache$2();
|
|
109698
110214
|
const { parseHttpDate } = requireDate();
|
|
@@ -109716,6 +110232,78 @@ function requireCacheHandler() {
|
|
|
109716
110232
|
206
|
|
109717
110233
|
];
|
|
109718
110234
|
const MAX_RESPONSE_AGE = 2147483647e3;
|
|
110235
|
+
function trimOWS(value) {
|
|
110236
|
+
return value.replace(/^[\t ]+|[\t ]+$/g, "");
|
|
110237
|
+
}
|
|
110238
|
+
function arrayIncludes(array2, value) {
|
|
110239
|
+
for (let i = 0; i < array2.length; i++) {
|
|
110240
|
+
if (array2[i] === value) {
|
|
110241
|
+
return true;
|
|
110242
|
+
}
|
|
110243
|
+
}
|
|
110244
|
+
return false;
|
|
110245
|
+
}
|
|
110246
|
+
function appendConnectionHeaderTokens(headersToRemove, connectionHeader) {
|
|
110247
|
+
const values = Array.isArray(connectionHeader) ? connectionHeader : [connectionHeader];
|
|
110248
|
+
for (let i = 0; i < values.length; i++) {
|
|
110249
|
+
const tokens = values[i].split(",");
|
|
110250
|
+
for (let j2 = 0; j2 < tokens.length; j2++) {
|
|
110251
|
+
headersToRemove.push(trimOWS(tokens[j2]).toLowerCase());
|
|
110252
|
+
}
|
|
110253
|
+
}
|
|
110254
|
+
}
|
|
110255
|
+
function getSameOriginPath(cacheKey, location2) {
|
|
110256
|
+
if (typeof location2 !== "string") {
|
|
110257
|
+
return void 0;
|
|
110258
|
+
}
|
|
110259
|
+
let originUrl;
|
|
110260
|
+
let requestUrl;
|
|
110261
|
+
let locationUrl;
|
|
110262
|
+
try {
|
|
110263
|
+
originUrl = new URL(cacheKey.origin);
|
|
110264
|
+
requestUrl = new URL(cacheKey.path, originUrl);
|
|
110265
|
+
locationUrl = new URL(location2, requestUrl);
|
|
110266
|
+
} catch {
|
|
110267
|
+
return void 0;
|
|
110268
|
+
}
|
|
110269
|
+
if (locationUrl.origin !== originUrl.origin) {
|
|
110270
|
+
return void 0;
|
|
110271
|
+
}
|
|
110272
|
+
return locationUrl.pathname + locationUrl.search;
|
|
110273
|
+
}
|
|
110274
|
+
function deleteCachedUri(store, cacheKey, path2) {
|
|
110275
|
+
deleteCachedValue(store, {
|
|
110276
|
+
...cacheKey,
|
|
110277
|
+
path: path2
|
|
110278
|
+
});
|
|
110279
|
+
for (let i = 0; i < util2.safeHTTPMethods.length; i++) {
|
|
110280
|
+
const method = util2.safeHTTPMethods[i];
|
|
110281
|
+
if (method !== cacheKey.method) {
|
|
110282
|
+
deleteCachedValue(store, {
|
|
110283
|
+
...cacheKey,
|
|
110284
|
+
method,
|
|
110285
|
+
path: path2
|
|
110286
|
+
});
|
|
110287
|
+
}
|
|
110288
|
+
}
|
|
110289
|
+
}
|
|
110290
|
+
function deleteLocationTargets(store, cacheKey, headerValue) {
|
|
110291
|
+
if (headerValue === void 0) {
|
|
110292
|
+
return;
|
|
110293
|
+
}
|
|
110294
|
+
const values = Array.isArray(headerValue) ? headerValue : [headerValue];
|
|
110295
|
+
for (let i = 0; i < values.length; i++) {
|
|
110296
|
+
const path2 = getSameOriginPath(cacheKey, values[i]);
|
|
110297
|
+
if (path2 !== void 0) {
|
|
110298
|
+
deleteCachedUri(store, cacheKey, path2);
|
|
110299
|
+
}
|
|
110300
|
+
}
|
|
110301
|
+
}
|
|
110302
|
+
function invalidateUnsafeRequest(store, cacheKey, resHeaders) {
|
|
110303
|
+
deleteCachedUri(store, cacheKey, cacheKey.path);
|
|
110304
|
+
deleteLocationTargets(store, cacheKey, resHeaders.location);
|
|
110305
|
+
deleteLocationTargets(store, cacheKey, resHeaders["content-location"]);
|
|
110306
|
+
}
|
|
109719
110307
|
class CacheHandler {
|
|
109720
110308
|
/**
|
|
109721
110309
|
* @param {import('../../types/cache-interceptor.d.ts').default.CacheHandlerOptions} opts
|
|
@@ -109770,11 +110358,10 @@ function requireCacheHandler() {
|
|
|
109770
110358
|
* @param {string} statusMessage
|
|
109771
110359
|
*/
|
|
109772
110360
|
onResponseStart(controller, statusCode, resHeaders, statusMessage) {
|
|
109773
|
-
var _a3, _b2;
|
|
109774
110361
|
const downstreamOnHeaders = () => {
|
|
109775
|
-
var
|
|
109776
|
-
return (
|
|
109777
|
-
|
|
110362
|
+
var _a3, _b2;
|
|
110363
|
+
return (_b2 = (_a3 = __privateGet(this, _handler)).onResponseStart) == null ? void 0 : _b2.call(
|
|
110364
|
+
_a3,
|
|
109778
110365
|
controller,
|
|
109779
110366
|
statusCode,
|
|
109780
110367
|
resHeaders,
|
|
@@ -109782,35 +110369,53 @@ function requireCacheHandler() {
|
|
|
109782
110369
|
);
|
|
109783
110370
|
};
|
|
109784
110371
|
const handler = this;
|
|
109785
|
-
if (!util2.safeHTTPMethods
|
|
109786
|
-
|
|
109787
|
-
(_b2 = (_a3 = __privateGet(this, _store).delete(__privateGet(this, _cacheKey))) == null ? void 0 : _a3.catch) == null ? void 0 : _b2.call(_a3, noop3);
|
|
109788
|
-
} catch {
|
|
109789
|
-
}
|
|
110372
|
+
if (!arrayIncludes(util2.safeHTTPMethods, __privateGet(this, _cacheKey).method) && statusCode >= 200 && statusCode <= 399) {
|
|
110373
|
+
invalidateUnsafeRequest(__privateGet(this, _store), __privateGet(this, _cacheKey), resHeaders);
|
|
109790
110374
|
return downstreamOnHeaders();
|
|
109791
110375
|
}
|
|
109792
110376
|
const cacheControlHeader = resHeaders["cache-control"];
|
|
109793
|
-
const
|
|
110377
|
+
const cacheControlDirectives = cacheControlHeader ? parseCacheControlHeader(cacheControlHeader) : {};
|
|
110378
|
+
if (revalidationResponseDisallowsCachedReuse(__privateGet(this, _cacheType), resHeaders, cacheControlDirectives)) {
|
|
110379
|
+
deleteCachedValue(__privateGet(this, _store), __privateGet(this, _cacheKey));
|
|
110380
|
+
return downstreamOnHeaders();
|
|
110381
|
+
}
|
|
110382
|
+
const heuristicallyCacheable = resHeaders["last-modified"] && arrayIncludes(HEURISTICALLY_CACHEABLE_STATUS_CODES, statusCode);
|
|
109794
110383
|
if (!cacheControlHeader && !resHeaders["expires"] && !heuristicallyCacheable && !__privateGet(this, _cacheByDefault)) {
|
|
110384
|
+
if (statusCode === 304 && resHeaders.vary && isInvalidOrWildcardVaryHeader(resHeaders.vary)) {
|
|
110385
|
+
deleteCachedValue(__privateGet(this, _store), __privateGet(this, _cacheKey));
|
|
110386
|
+
}
|
|
109795
110387
|
return downstreamOnHeaders();
|
|
109796
110388
|
}
|
|
109797
|
-
|
|
109798
|
-
|
|
110389
|
+
if (!canCacheResponse(__privateGet(this, _cacheType), __privateGet(this, _cacheKey).method, statusCode, resHeaders, cacheControlDirectives, __privateGet(this, _cacheKey).headers)) {
|
|
110390
|
+
if (statusCode === 304 && (cacheControlHeader || revalidationResponseDisallowsCachedReuse(__privateGet(this, _cacheType), resHeaders, cacheControlDirectives))) {
|
|
110391
|
+
deleteCachedValue(__privateGet(this, _store), __privateGet(this, _cacheKey));
|
|
110392
|
+
}
|
|
109799
110393
|
return downstreamOnHeaders();
|
|
109800
110394
|
}
|
|
109801
110395
|
const now2 = Date.now();
|
|
109802
|
-
const resAge = resHeaders
|
|
109803
|
-
if (resAge && resAge >= MAX_RESPONSE_AGE) {
|
|
110396
|
+
const resAge = Object.hasOwn(resHeaders, "age") ? getAge(resHeaders.age) : void 0;
|
|
110397
|
+
if (resAge !== void 0 && resAge >= MAX_RESPONSE_AGE) {
|
|
110398
|
+
deleteCachedValueIfNotModified(statusCode, __privateGet(this, _store), __privateGet(this, _cacheKey));
|
|
110399
|
+
return downstreamOnHeaders();
|
|
110400
|
+
}
|
|
110401
|
+
const resDate = Object.hasOwn(resHeaders, "date") ? getDate(resHeaders.date) : void 0;
|
|
110402
|
+
if (resDate === null) {
|
|
110403
|
+
deleteCachedValueIfNotModified(statusCode, __privateGet(this, _store), __privateGet(this, _cacheKey));
|
|
109804
110404
|
return downstreamOnHeaders();
|
|
109805
110405
|
}
|
|
109806
|
-
const
|
|
110406
|
+
const apparentAge = resDate ? Math.max(0, now2 - resDate.getTime()) : 0;
|
|
110407
|
+
const currentAge = Math.max(apparentAge, resAge ?? 0);
|
|
109807
110408
|
const staleAt = determineStaleAt(__privateGet(this, _cacheType), now2, resAge, resHeaders, resDate, cacheControlDirectives) ?? __privateGet(this, _cacheByDefault);
|
|
109808
|
-
if (staleAt === void 0 ||
|
|
110409
|
+
if (staleAt === void 0 || currentAge >= staleAt) {
|
|
110410
|
+
if (cacheControlHeader || staleAt !== void 0) {
|
|
110411
|
+
deleteCachedValueIfNotModified(statusCode, __privateGet(this, _store), __privateGet(this, _cacheKey));
|
|
110412
|
+
}
|
|
109809
110413
|
return downstreamOnHeaders();
|
|
109810
110414
|
}
|
|
109811
|
-
const baseTime =
|
|
110415
|
+
const baseTime = now2 - currentAge;
|
|
109812
110416
|
const absoluteStaleAt = staleAt + baseTime;
|
|
109813
110417
|
if (now2 >= absoluteStaleAt) {
|
|
110418
|
+
deleteCachedValueIfNotModified(statusCode, __privateGet(this, _store), __privateGet(this, _cacheKey));
|
|
109814
110419
|
return downstreamOnHeaders();
|
|
109815
110420
|
}
|
|
109816
110421
|
let varyDirectives;
|
|
@@ -109820,7 +110425,8 @@ function requireCacheHandler() {
|
|
|
109820
110425
|
return downstreamOnHeaders();
|
|
109821
110426
|
}
|
|
109822
110427
|
}
|
|
109823
|
-
const
|
|
110428
|
+
const cachedAt = baseTime;
|
|
110429
|
+
const deleteAt = determineDeleteAt(baseTime, now2, cacheControlDirectives, absoluteStaleAt);
|
|
109824
110430
|
const strippedHeaders = stripNecessaryHeaders(resHeaders, cacheControlDirectives);
|
|
109825
110431
|
const value = {
|
|
109826
110432
|
statusCode,
|
|
@@ -109828,7 +110434,7 @@ function requireCacheHandler() {
|
|
|
109828
110434
|
headers: strippedHeaders,
|
|
109829
110435
|
vary: varyDirectives,
|
|
109830
110436
|
cacheControlDirectives,
|
|
109831
|
-
cachedAt
|
|
110437
|
+
cachedAt,
|
|
109832
110438
|
staleAt: absoluteStaleAt,
|
|
109833
110439
|
deleteAt
|
|
109834
110440
|
};
|
|
@@ -109840,6 +110446,7 @@ function requireCacheHandler() {
|
|
|
109840
110446
|
value.statusCode = cachedValue.statusCode;
|
|
109841
110447
|
value.statusMessage = cachedValue.statusMessage;
|
|
109842
110448
|
value.etag = cachedValue.etag;
|
|
110449
|
+
value.vary = varyDirectives ?? cachedValue.vary;
|
|
109843
110450
|
value.headers = { ...cachedValue.headers, ...strippedHeaders };
|
|
109844
110451
|
downstreamOnHeaders();
|
|
109845
110452
|
__privateSet(this, _writeStream, __privateGet(this, _store).createWriteStream(__privateGet(this, _cacheKey), value));
|
|
@@ -109849,10 +110456,10 @@ function requireCacheHandler() {
|
|
|
109849
110456
|
if (typeof cachedValue.body.values === "function") {
|
|
109850
110457
|
const bodyIterator = cachedValue.body.values();
|
|
109851
110458
|
const streamCachedBody = () => {
|
|
109852
|
-
var
|
|
110459
|
+
var _a3, _b2;
|
|
109853
110460
|
for (const chunk of bodyIterator) {
|
|
109854
110461
|
const full = __privateGet(this, _writeStream).write(chunk) === false;
|
|
109855
|
-
(
|
|
110462
|
+
(_b2 = (_a3 = __privateGet(this, _handler)).onResponseData) == null ? void 0 : _b2.call(_a3, controller, chunk);
|
|
109856
110463
|
if (full) {
|
|
109857
110464
|
break;
|
|
109858
110465
|
}
|
|
@@ -109871,9 +110478,9 @@ function requireCacheHandler() {
|
|
|
109871
110478
|
streamCachedBody();
|
|
109872
110479
|
} else if (typeof cachedValue.body.on === "function") {
|
|
109873
110480
|
cachedValue.body.on("data", (chunk) => {
|
|
109874
|
-
var
|
|
110481
|
+
var _a3, _b2;
|
|
109875
110482
|
__privateGet(this, _writeStream).write(chunk);
|
|
109876
|
-
(
|
|
110483
|
+
(_b2 = (_a3 = __privateGet(this, _handler)).onResponseData) == null ? void 0 : _b2.call(_a3, controller, chunk);
|
|
109877
110484
|
}).on("end", () => {
|
|
109878
110485
|
__privateGet(this, _writeStream).end();
|
|
109879
110486
|
}).on("error", () => {
|
|
@@ -109941,75 +110548,130 @@ function requireCacheHandler() {
|
|
|
109941
110548
|
_store = new WeakMap();
|
|
109942
110549
|
_handler = new WeakMap();
|
|
109943
110550
|
_writeStream = new WeakMap();
|
|
109944
|
-
function
|
|
109945
|
-
var _a3;
|
|
109946
|
-
|
|
110551
|
+
function deleteCachedValue(store, cacheKey) {
|
|
110552
|
+
var _a3, _b2;
|
|
110553
|
+
try {
|
|
110554
|
+
(_b2 = (_a3 = store.delete(cacheKey)) == null ? void 0 : _a3.catch) == null ? void 0 : _b2.call(_a3, noop3);
|
|
110555
|
+
} catch {
|
|
110556
|
+
}
|
|
110557
|
+
}
|
|
110558
|
+
function deleteCachedValueIfNotModified(statusCode, store, cacheKey) {
|
|
110559
|
+
if (statusCode === 304) {
|
|
110560
|
+
deleteCachedValue(store, cacheKey);
|
|
110561
|
+
}
|
|
110562
|
+
}
|
|
110563
|
+
function revalidationResponseDisallowsCachedReuse(cacheType, resHeaders, cacheControlDirectives) {
|
|
110564
|
+
return cacheControlDirectives["no-store"] === true || cacheType === "shared" && (cacheControlDirectives.private === true || Object.hasOwn(resHeaders, "set-cookie")) || (resHeaders.vary ? isInvalidOrWildcardVaryHeader(resHeaders.vary) : false);
|
|
110565
|
+
}
|
|
110566
|
+
function canCacheResponse(cacheType, method, statusCode, resHeaders, cacheControlDirectives, reqHeaders) {
|
|
110567
|
+
if (!arrayIncludes(util2.safeHTTPMethods, method)) {
|
|
109947
110568
|
return false;
|
|
109948
110569
|
}
|
|
109949
|
-
if (
|
|
110570
|
+
if (statusCode < 200 || arrayIncludes(NOT_UNDERSTOOD_STATUS_CODES, statusCode)) {
|
|
110571
|
+
return false;
|
|
110572
|
+
}
|
|
110573
|
+
if (!arrayIncludes(HEURISTICALLY_CACHEABLE_STATUS_CODES, statusCode) && !resHeaders["expires"] && !cacheControlDirectives.public && cacheControlDirectives["max-age"] === void 0 && // RFC 9111: a private response directive, if the cache is not shared
|
|
109950
110574
|
!(cacheControlDirectives.private && cacheType === "private") && !(cacheControlDirectives["s-maxage"] !== void 0 && cacheType === "shared")) {
|
|
109951
110575
|
return false;
|
|
109952
110576
|
}
|
|
109953
110577
|
if (cacheControlDirectives["no-store"]) {
|
|
109954
110578
|
return false;
|
|
109955
110579
|
}
|
|
109956
|
-
if (cacheType === "shared" && cacheControlDirectives.private === true) {
|
|
110580
|
+
if (cacheType === "shared" && (cacheControlDirectives.private === true || Object.hasOwn(resHeaders, "set-cookie"))) {
|
|
109957
110581
|
return false;
|
|
109958
110582
|
}
|
|
109959
|
-
if (
|
|
110583
|
+
if (resHeaders.vary && hasVaryStar(resHeaders.vary)) {
|
|
109960
110584
|
return false;
|
|
109961
110585
|
}
|
|
109962
|
-
if (reqHeaders
|
|
110586
|
+
if (reqHeaders != null && Object.hasOwn(reqHeaders, "authorization")) {
|
|
109963
110587
|
if (!cacheControlDirectives.public && !cacheControlDirectives["s-maxage"] && !cacheControlDirectives["must-revalidate"]) {
|
|
109964
110588
|
return false;
|
|
109965
110589
|
}
|
|
109966
110590
|
if (typeof reqHeaders.authorization !== "string") {
|
|
109967
110591
|
return false;
|
|
109968
110592
|
}
|
|
109969
|
-
if (Array.isArray(cacheControlDirectives["no-cache"]) && cacheControlDirectives["no-cache"]
|
|
110593
|
+
if (Array.isArray(cacheControlDirectives["no-cache"]) && arrayIncludes(cacheControlDirectives["no-cache"], "authorization")) {
|
|
109970
110594
|
return false;
|
|
109971
110595
|
}
|
|
109972
|
-
if (Array.isArray(cacheControlDirectives["private"]) && cacheControlDirectives["private"]
|
|
110596
|
+
if (Array.isArray(cacheControlDirectives["private"]) && arrayIncludes(cacheControlDirectives["private"], "authorization")) {
|
|
109973
110597
|
return false;
|
|
109974
110598
|
}
|
|
109975
110599
|
}
|
|
109976
110600
|
return true;
|
|
109977
110601
|
}
|
|
110602
|
+
function getDate(dateHeader) {
|
|
110603
|
+
let dateValue = dateHeader;
|
|
110604
|
+
if (Array.isArray(dateValue)) {
|
|
110605
|
+
if (dateValue.length !== 1) {
|
|
110606
|
+
return null;
|
|
110607
|
+
}
|
|
110608
|
+
dateValue = dateValue[0];
|
|
110609
|
+
}
|
|
110610
|
+
if (typeof dateValue !== "string") {
|
|
110611
|
+
return null;
|
|
110612
|
+
}
|
|
110613
|
+
return parseHttpDate(dateValue);
|
|
110614
|
+
}
|
|
109978
110615
|
function getAge(ageHeader) {
|
|
109979
|
-
|
|
109980
|
-
|
|
110616
|
+
let ageValue = ageHeader;
|
|
110617
|
+
if (Array.isArray(ageValue)) {
|
|
110618
|
+
if (ageValue.length !== 1) {
|
|
110619
|
+
return MAX_RESPONSE_AGE;
|
|
110620
|
+
}
|
|
110621
|
+
ageValue = ageValue[0];
|
|
110622
|
+
}
|
|
110623
|
+
if (typeof ageValue !== "string" || !/^[\t ]*[0-9]+[\t ]*$/.test(ageValue)) {
|
|
110624
|
+
return MAX_RESPONSE_AGE;
|
|
110625
|
+
}
|
|
110626
|
+
const age = BigInt(ageValue.replace(/^[\t ]+|[\t ]+$/g, ""));
|
|
110627
|
+
if (age >= BigInt(MAX_RESPONSE_AGE / 1e3)) {
|
|
110628
|
+
return MAX_RESPONSE_AGE;
|
|
110629
|
+
}
|
|
110630
|
+
return Number(age) * 1e3;
|
|
109981
110631
|
}
|
|
109982
110632
|
function determineStaleAt(cacheType, now2, age, resHeaders, responseDate, cacheControlDirectives) {
|
|
109983
110633
|
if (cacheType === "shared") {
|
|
110634
|
+
if (hasInvalidCacheControlDirective(cacheControlDirectives, "s-maxage")) {
|
|
110635
|
+
return 0;
|
|
110636
|
+
}
|
|
109984
110637
|
const sMaxAge = cacheControlDirectives["s-maxage"];
|
|
109985
110638
|
if (sMaxAge !== void 0) {
|
|
109986
|
-
return sMaxAge
|
|
110639
|
+
return sMaxAge * 1e3;
|
|
109987
110640
|
}
|
|
109988
110641
|
}
|
|
110642
|
+
if (hasInvalidCacheControlDirective(cacheControlDirectives, "max-age")) {
|
|
110643
|
+
return 0;
|
|
110644
|
+
}
|
|
109989
110645
|
const maxAge = cacheControlDirectives["max-age"];
|
|
109990
110646
|
if (maxAge !== void 0) {
|
|
109991
|
-
return maxAge
|
|
110647
|
+
return maxAge * 1e3;
|
|
109992
110648
|
}
|
|
109993
|
-
if (
|
|
110649
|
+
if (Object.hasOwn(resHeaders, "expires")) {
|
|
110650
|
+
if (typeof resHeaders.expires !== "string") {
|
|
110651
|
+
return 0;
|
|
110652
|
+
}
|
|
109994
110653
|
const expiresDate = parseHttpDate(resHeaders.expires);
|
|
109995
|
-
if (expiresDate) {
|
|
109996
|
-
|
|
109997
|
-
|
|
110654
|
+
if (!expiresDate) {
|
|
110655
|
+
return 0;
|
|
110656
|
+
}
|
|
110657
|
+
if (now2 >= expiresDate.getTime()) {
|
|
110658
|
+
return 0;
|
|
110659
|
+
}
|
|
110660
|
+
if (responseDate) {
|
|
110661
|
+
if (responseDate >= expiresDate) {
|
|
110662
|
+
return 0;
|
|
109998
110663
|
}
|
|
109999
|
-
|
|
110000
|
-
|
|
110001
|
-
|
|
110002
|
-
}
|
|
110003
|
-
if (age !== void 0 && age > expiresDate - responseDate) {
|
|
110004
|
-
return void 0;
|
|
110005
|
-
}
|
|
110664
|
+
const freshnessLifetime = expiresDate.getTime() - responseDate.getTime();
|
|
110665
|
+
if (age !== void 0 && age >= freshnessLifetime) {
|
|
110666
|
+
return 0;
|
|
110006
110667
|
}
|
|
110007
|
-
return
|
|
110668
|
+
return freshnessLifetime;
|
|
110008
110669
|
}
|
|
110670
|
+
return expiresDate.getTime() - now2;
|
|
110009
110671
|
}
|
|
110010
110672
|
if (typeof resHeaders["last-modified"] === "string") {
|
|
110011
|
-
const lastModified =
|
|
110012
|
-
if (
|
|
110673
|
+
const lastModified = parseHttpDate(resHeaders["last-modified"]);
|
|
110674
|
+
if (lastModified) {
|
|
110013
110675
|
if (lastModified.getTime() >= now2) {
|
|
110014
110676
|
return void 0;
|
|
110015
110677
|
}
|
|
@@ -110018,11 +110680,11 @@ function requireCacheHandler() {
|
|
|
110018
110680
|
}
|
|
110019
110681
|
}
|
|
110020
110682
|
if (cacheControlDirectives.immutable) {
|
|
110021
|
-
return
|
|
110683
|
+
return 31536e6;
|
|
110022
110684
|
}
|
|
110023
110685
|
return void 0;
|
|
110024
110686
|
}
|
|
110025
|
-
function determineDeleteAt(
|
|
110687
|
+
function determineDeleteAt(baseTime, cachedAt, cacheControlDirectives, staleAt) {
|
|
110026
110688
|
let staleWhileRevalidate = -Infinity;
|
|
110027
110689
|
let staleIfError = -Infinity;
|
|
110028
110690
|
let immutable = -Infinity;
|
|
@@ -110033,11 +110695,12 @@ function requireCacheHandler() {
|
|
|
110033
110695
|
staleIfError = staleAt + cacheControlDirectives["stale-if-error"] * 1e3;
|
|
110034
110696
|
}
|
|
110035
110697
|
if (cacheControlDirectives.immutable && staleWhileRevalidate === -Infinity && staleIfError === -Infinity) {
|
|
110036
|
-
immutable =
|
|
110698
|
+
immutable = cachedAt + 31536e6;
|
|
110037
110699
|
}
|
|
110038
110700
|
if (staleWhileRevalidate === -Infinity && staleIfError === -Infinity && immutable === -Infinity) {
|
|
110039
|
-
const freshnessLifetime = staleAt -
|
|
110040
|
-
|
|
110701
|
+
const freshnessLifetime = staleAt - baseTime;
|
|
110702
|
+
const datePrecisionPadding = Math.min(Math.max(cachedAt - baseTime, 0), 1e3);
|
|
110703
|
+
return staleAt + freshnessLifetime + datePrecisionPadding;
|
|
110041
110704
|
}
|
|
110042
110705
|
return Math.max(staleAt, staleWhileRevalidate, staleIfError, immutable);
|
|
110043
110706
|
}
|
|
@@ -110055,11 +110718,7 @@ function requireCacheHandler() {
|
|
|
110055
110718
|
"age"
|
|
110056
110719
|
];
|
|
110057
110720
|
if (resHeaders["connection"]) {
|
|
110058
|
-
|
|
110059
|
-
headersToRemove.push(...resHeaders["connection"].map((header) => header.trim()));
|
|
110060
|
-
} else {
|
|
110061
|
-
headersToRemove.push(...resHeaders["connection"].split(",").map((header) => header.trim()));
|
|
110062
|
-
}
|
|
110721
|
+
appendConnectionHeaderTokens(headersToRemove, resHeaders["connection"]);
|
|
110063
110722
|
}
|
|
110064
110723
|
if (Array.isArray(cacheControlDirectives["no-cache"])) {
|
|
110065
110724
|
headersToRemove.push(...cacheControlDirectives["no-cache"]);
|
|
@@ -110069,16 +110728,13 @@ function requireCacheHandler() {
|
|
|
110069
110728
|
}
|
|
110070
110729
|
let strippedHeaders;
|
|
110071
110730
|
for (const headerName of headersToRemove) {
|
|
110072
|
-
if (resHeaders
|
|
110731
|
+
if (Object.hasOwn(resHeaders, headerName)) {
|
|
110073
110732
|
strippedHeaders ?? (strippedHeaders = { ...resHeaders });
|
|
110074
110733
|
delete strippedHeaders[headerName];
|
|
110075
110734
|
}
|
|
110076
110735
|
}
|
|
110077
110736
|
return strippedHeaders ?? resHeaders;
|
|
110078
110737
|
}
|
|
110079
|
-
function isValidDate(date2) {
|
|
110080
|
-
return date2 instanceof Date && Number.isFinite(date2.valueOf());
|
|
110081
|
-
}
|
|
110082
110738
|
cacheHandler = CacheHandler;
|
|
110083
110739
|
return cacheHandler;
|
|
110084
110740
|
}
|
|
@@ -110257,12 +110913,44 @@ function requireMemoryCacheStore() {
|
|
|
110257
110913
|
_entries = new WeakMap();
|
|
110258
110914
|
_hasEmittedMaxSizeEvent = new WeakMap();
|
|
110259
110915
|
function findEntry(key, entries, now2) {
|
|
110260
|
-
|
|
110261
|
-
|
|
110262
|
-
|
|
110916
|
+
for (let i = 0; i < entries.length; i++) {
|
|
110917
|
+
const entry2 = entries[i];
|
|
110918
|
+
if (entry2.deleteAt > now2 && entry2.method === key.method && varyMatches(key, entry2)) {
|
|
110919
|
+
return entry2;
|
|
110263
110920
|
}
|
|
110264
|
-
|
|
110265
|
-
|
|
110921
|
+
}
|
|
110922
|
+
}
|
|
110923
|
+
function varyMatches(key, entry2) {
|
|
110924
|
+
var _a3;
|
|
110925
|
+
if (entry2.vary == null) {
|
|
110926
|
+
return true;
|
|
110927
|
+
}
|
|
110928
|
+
for (const headerName in entry2.vary) {
|
|
110929
|
+
if (Object.hasOwn(entry2.vary, headerName) && !headerValueEquals((_a3 = key.headers) == null ? void 0 : _a3[headerName], entry2.vary[headerName])) {
|
|
110930
|
+
return false;
|
|
110931
|
+
}
|
|
110932
|
+
}
|
|
110933
|
+
return true;
|
|
110934
|
+
}
|
|
110935
|
+
function headerValueEquals(lhs, rhs) {
|
|
110936
|
+
if (lhs == null && rhs == null) {
|
|
110937
|
+
return true;
|
|
110938
|
+
}
|
|
110939
|
+
if (lhs == null && rhs != null || lhs != null && rhs == null) {
|
|
110940
|
+
return false;
|
|
110941
|
+
}
|
|
110942
|
+
if (Array.isArray(lhs) && Array.isArray(rhs)) {
|
|
110943
|
+
if (lhs.length !== rhs.length) {
|
|
110944
|
+
return false;
|
|
110945
|
+
}
|
|
110946
|
+
for (let i = 0; i < lhs.length; i++) {
|
|
110947
|
+
if (lhs[i] !== rhs[i]) {
|
|
110948
|
+
return false;
|
|
110949
|
+
}
|
|
110950
|
+
}
|
|
110951
|
+
return true;
|
|
110952
|
+
}
|
|
110953
|
+
return lhs === rhs;
|
|
110266
110954
|
}
|
|
110267
110955
|
memoryCacheStore = MemoryCacheStore;
|
|
110268
110956
|
return memoryCacheStore;
|
|
@@ -110276,14 +110964,14 @@ function requireCacheRevalidationHandler() {
|
|
|
110276
110964
|
const assert2 = require$$0$4;
|
|
110277
110965
|
class CacheRevalidationHandler {
|
|
110278
110966
|
/**
|
|
110279
|
-
* @param {(boolean) => void} callback Function to call if the cached value is valid
|
|
110967
|
+
* @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
|
|
110280
110968
|
* @param {import('../../types/dispatcher.d.ts').default.DispatchHandlers} handler
|
|
110281
110969
|
* @param {boolean} allowErrorStatusCodes
|
|
110282
110970
|
*/
|
|
110283
110971
|
constructor(callback, handler, allowErrorStatusCodes) {
|
|
110284
110972
|
__privateAdd(this, _successful, false);
|
|
110285
110973
|
/**
|
|
110286
|
-
* @type {((boolean, any) => void) | null}
|
|
110974
|
+
* @type {((success: boolean, context?: any, statusCode?: number, headers?: import('../../types/header.d.ts').IncomingHttpHeaders) => void) | null}
|
|
110287
110975
|
*/
|
|
110288
110976
|
__privateAdd(this, _callback);
|
|
110289
110977
|
/**
|
|
@@ -110314,7 +111002,7 @@ function requireCacheRevalidationHandler() {
|
|
|
110314
111002
|
var _a3, _b2, _c, _d;
|
|
110315
111003
|
assert2(__privateGet(this, _callback) != null);
|
|
110316
111004
|
__privateSet(this, _successful, statusCode === 304 || __privateGet(this, _allowErrorStatusCodes) && statusCode >= 500 && statusCode <= 504);
|
|
110317
|
-
__privateGet(this, _callback).call(this, __privateGet(this, _successful), __privateGet(this, _context));
|
|
111005
|
+
__privateGet(this, _callback).call(this, __privateGet(this, _successful), __privateGet(this, _context), statusCode, headers2);
|
|
110318
111006
|
__privateSet(this, _callback, null);
|
|
110319
111007
|
if (__privateGet(this, _successful)) {
|
|
110320
111008
|
return true;
|
|
@@ -110376,8 +111064,9 @@ function requireCache$1() {
|
|
|
110376
111064
|
const CacheHandler = requireCacheHandler();
|
|
110377
111065
|
const MemoryCacheStore = requireMemoryCacheStore();
|
|
110378
111066
|
const CacheRevalidationHandler = requireCacheRevalidationHandler();
|
|
110379
|
-
const { assertCacheStore, assertCacheMethods, makeCacheKey, normalizeHeaders, parseCacheControlHeader } = requireCache$2();
|
|
111067
|
+
const { assertCacheStore, assertCacheMethods, makeCacheKey, normalizeHeaders, parseCacheControlHeader, isInvalidOrWildcardVaryHeader } = requireCache$2();
|
|
110380
111068
|
const { AbortError } = requireErrors();
|
|
111069
|
+
const { parseHttpDate } = requireDate();
|
|
110381
111070
|
function assertCacheOrigins(origins, name2) {
|
|
110382
111071
|
if (origins === void 0) return;
|
|
110383
111072
|
if (!Array.isArray(origins)) {
|
|
@@ -110392,6 +111081,37 @@ function requireCache$1() {
|
|
|
110392
111081
|
}
|
|
110393
111082
|
const nop = () => {
|
|
110394
111083
|
};
|
|
111084
|
+
function trimOWS(value) {
|
|
111085
|
+
return value.replace(/^[\t ]+|[\t ]+$/g, "");
|
|
111086
|
+
}
|
|
111087
|
+
function arrayIncludes(array2, value) {
|
|
111088
|
+
for (let i = 0; i < array2.length; i++) {
|
|
111089
|
+
if (array2[i] === value) {
|
|
111090
|
+
return true;
|
|
111091
|
+
}
|
|
111092
|
+
}
|
|
111093
|
+
return false;
|
|
111094
|
+
}
|
|
111095
|
+
function hasPragmaNoCache(headers2) {
|
|
111096
|
+
const pragma = headers2 == null ? void 0 : headers2.pragma;
|
|
111097
|
+
if (!pragma) {
|
|
111098
|
+
return false;
|
|
111099
|
+
}
|
|
111100
|
+
const values = Array.isArray(pragma) ? pragma : [pragma];
|
|
111101
|
+
for (let i = 0; i < values.length; i++) {
|
|
111102
|
+
const value = values[i];
|
|
111103
|
+
if (typeof value !== "string") {
|
|
111104
|
+
continue;
|
|
111105
|
+
}
|
|
111106
|
+
const directives = value.split(",");
|
|
111107
|
+
for (let j2 = 0; j2 < directives.length; j2++) {
|
|
111108
|
+
if (trimOWS(directives[j2]).toLowerCase() === "no-cache") {
|
|
111109
|
+
return true;
|
|
111110
|
+
}
|
|
111111
|
+
}
|
|
111112
|
+
}
|
|
111113
|
+
return false;
|
|
111114
|
+
}
|
|
110395
111115
|
function needsRevalidation(result, cacheControlDirectives, { headers: headers2 = {} }) {
|
|
110396
111116
|
var _a3;
|
|
110397
111117
|
if (cacheControlDirectives == null ? void 0 : cacheControlDirectives["no-cache"]) {
|
|
@@ -110405,10 +111125,60 @@ function requireCache$1() {
|
|
|
110405
111125
|
}
|
|
110406
111126
|
return false;
|
|
110407
111127
|
}
|
|
110408
|
-
function
|
|
111128
|
+
function staleResponseRequiresRevalidation(result, cacheType) {
|
|
111129
|
+
var _a3, _b2, _c;
|
|
111130
|
+
return ((_a3 = result.cacheControlDirectives) == null ? void 0 : _a3["must-revalidate"]) === true || cacheType === "shared" && (((_b2 = result.cacheControlDirectives) == null ? void 0 : _b2["proxy-revalidate"]) === true || // https://www.rfc-editor.org/rfc/rfc9111.html#section-5.2.2.10
|
|
111131
|
+
// s-maxage implies proxy-revalidate for shared caches.
|
|
111132
|
+
((_c = result.cacheControlDirectives) == null ? void 0 : _c["s-maxage"]) !== void 0);
|
|
111133
|
+
}
|
|
111134
|
+
function revalidationResponseDisallowsCachedReuse(cacheType, headers2) {
|
|
111135
|
+
if (headers2.vary && isInvalidOrWildcardVaryHeader(headers2.vary) || cacheType === "shared" && Object.hasOwn(headers2, "set-cookie")) {
|
|
111136
|
+
return true;
|
|
111137
|
+
}
|
|
111138
|
+
const cacheControl = headers2["cache-control"];
|
|
111139
|
+
if (!cacheControl) {
|
|
111140
|
+
return false;
|
|
111141
|
+
}
|
|
111142
|
+
const cacheControlDirectives = parseCacheControlHeader(cacheControl);
|
|
111143
|
+
return cacheControlDirectives["no-store"] === true || cacheType === "shared" && cacheControlDirectives.private === true;
|
|
111144
|
+
}
|
|
111145
|
+
function revalidationResponseUpdatesCacheControl(headers2) {
|
|
111146
|
+
return headers2["cache-control"] !== void 0;
|
|
111147
|
+
}
|
|
111148
|
+
function deleteCachedValue(store, cacheKey) {
|
|
111149
|
+
var _a3, _b2;
|
|
111150
|
+
try {
|
|
111151
|
+
(_b2 = (_a3 = store.delete(cacheKey)) == null ? void 0 : _a3.catch) == null ? void 0 : _b2.call(_a3, nop);
|
|
111152
|
+
} catch {
|
|
111153
|
+
}
|
|
111154
|
+
}
|
|
111155
|
+
function getUsableLastModified(headers2) {
|
|
111156
|
+
const lastModified = headers2 == null ? void 0 : headers2["last-modified"];
|
|
111157
|
+
if (typeof lastModified === "string" && parseHttpDate(lastModified)) {
|
|
111158
|
+
return lastModified;
|
|
111159
|
+
}
|
|
111160
|
+
}
|
|
111161
|
+
function makeRevalidationHeaders(opts, result) {
|
|
111162
|
+
const headers2 = {
|
|
111163
|
+
...opts.headers,
|
|
111164
|
+
"if-modified-since": getUsableLastModified(result.headers) ?? new Date(result.cachedAt).toUTCString()
|
|
111165
|
+
};
|
|
111166
|
+
if (result.etag) {
|
|
111167
|
+
headers2["if-none-match"] = result.etag;
|
|
111168
|
+
}
|
|
111169
|
+
if (result.vary) {
|
|
111170
|
+
for (const key in result.vary) {
|
|
111171
|
+
if (result.vary[key] != null) {
|
|
111172
|
+
headers2[key] = result.vary[key];
|
|
111173
|
+
}
|
|
111174
|
+
}
|
|
111175
|
+
}
|
|
111176
|
+
return headers2;
|
|
111177
|
+
}
|
|
111178
|
+
function isStale(result, cacheControlDirectives, cacheType) {
|
|
110409
111179
|
const now2 = Date.now();
|
|
110410
111180
|
if (now2 > result.staleAt) {
|
|
110411
|
-
if (cacheControlDirectives == null ? void 0 : cacheControlDirectives["max-stale"]) {
|
|
111181
|
+
if (!staleResponseRequiresRevalidation(result, cacheType) && (cacheControlDirectives == null ? void 0 : cacheControlDirectives["max-stale"])) {
|
|
110412
111182
|
const gracePeriod = result.staleAt + cacheControlDirectives["max-stale"] * 1e3;
|
|
110413
111183
|
return now2 > gracePeriod;
|
|
110414
111184
|
}
|
|
@@ -110421,10 +111191,10 @@ function requireCache$1() {
|
|
|
110421
111191
|
}
|
|
110422
111192
|
return false;
|
|
110423
111193
|
}
|
|
110424
|
-
function withinStaleWhileRevalidateWindow(result) {
|
|
111194
|
+
function withinStaleWhileRevalidateWindow(result, cacheType) {
|
|
110425
111195
|
var _a3;
|
|
110426
111196
|
const staleWhileRevalidate = (_a3 = result.cacheControlDirectives) == null ? void 0 : _a3["stale-while-revalidate"];
|
|
110427
|
-
if (!staleWhileRevalidate) {
|
|
111197
|
+
if (!staleWhileRevalidate || staleResponseRequiresRevalidation(result, cacheType)) {
|
|
110428
111198
|
return false;
|
|
110429
111199
|
}
|
|
110430
111200
|
const now2 = Date.now();
|
|
@@ -110522,37 +111292,29 @@ function requireCache$1() {
|
|
|
110522
111292
|
if (!result) {
|
|
110523
111293
|
return handleUncachedResponse(dispatch2, globalOpts, cacheKey, handler, opts, reqCacheControl);
|
|
110524
111294
|
}
|
|
111295
|
+
if (globalOpts.type === "shared" && Object.hasOwn(result.headers, "set-cookie")) {
|
|
111296
|
+
if (util2.isStream(result.body)) {
|
|
111297
|
+
result.body.on("error", nop).destroy();
|
|
111298
|
+
}
|
|
111299
|
+
deleteCachedValue(globalOpts.store, cacheKey);
|
|
111300
|
+
return handleUncachedResponse(dispatch2, globalOpts, cacheKey, handler, opts, reqCacheControl);
|
|
111301
|
+
}
|
|
110525
111302
|
const now2 = Date.now();
|
|
110526
111303
|
if (now2 > result.deleteAt) {
|
|
110527
111304
|
return dispatch2(opts, new CacheHandler(globalOpts, cacheKey, handler));
|
|
110528
111305
|
}
|
|
110529
111306
|
const age = Math.round((now2 - result.cachedAt) / 1e3);
|
|
110530
|
-
|
|
110531
|
-
|
|
110532
|
-
|
|
110533
|
-
const stale = isStale(result, reqCacheControl);
|
|
110534
|
-
const revalidate = needsRevalidation(result, reqCacheControl, opts);
|
|
111307
|
+
const requestMaxAgeExpired = (reqCacheControl == null ? void 0 : reqCacheControl["max-age"]) !== void 0 && age >= reqCacheControl["max-age"];
|
|
111308
|
+
const stale = requestMaxAgeExpired || isStale(result, reqCacheControl, globalOpts.type);
|
|
111309
|
+
const revalidate = requestMaxAgeExpired || needsRevalidation(result, reqCacheControl, opts);
|
|
110535
111310
|
if (stale || revalidate) {
|
|
110536
111311
|
if (util2.isStream(opts.body) && util2.bodyLength(opts.body) !== 0) {
|
|
110537
111312
|
return dispatch2(opts, new CacheHandler(globalOpts, cacheKey, handler));
|
|
110538
111313
|
}
|
|
110539
|
-
if (!revalidate && withinStaleWhileRevalidateWindow(result)) {
|
|
111314
|
+
if (!revalidate && withinStaleWhileRevalidateWindow(result, globalOpts.type)) {
|
|
110540
111315
|
sendCachedValue(handler, opts, result, age, null, true);
|
|
110541
111316
|
queueMicrotask(() => {
|
|
110542
|
-
const headers3 =
|
|
110543
|
-
...opts.headers,
|
|
110544
|
-
"if-modified-since": new Date(result.cachedAt).toUTCString()
|
|
110545
|
-
};
|
|
110546
|
-
if (result.etag) {
|
|
110547
|
-
headers3["if-none-match"] = result.etag;
|
|
110548
|
-
}
|
|
110549
|
-
if (result.vary) {
|
|
110550
|
-
for (const key in result.vary) {
|
|
110551
|
-
if (result.vary[key] != null) {
|
|
110552
|
-
headers3[key] = result.vary[key];
|
|
110553
|
-
}
|
|
110554
|
-
}
|
|
110555
|
-
}
|
|
111317
|
+
const headers3 = makeRevalidationHeaders(opts, result);
|
|
110556
111318
|
dispatch2(
|
|
110557
111319
|
{
|
|
110558
111320
|
...opts,
|
|
@@ -110578,32 +111340,33 @@ function requireCache$1() {
|
|
|
110578
111340
|
return true;
|
|
110579
111341
|
}
|
|
110580
111342
|
let withinStaleIfErrorThreshold = false;
|
|
110581
|
-
|
|
110582
|
-
|
|
110583
|
-
|
|
110584
|
-
|
|
110585
|
-
const headers2 = {
|
|
110586
|
-
...opts.headers,
|
|
110587
|
-
"if-modified-since": new Date(result.cachedAt).toUTCString()
|
|
110588
|
-
};
|
|
110589
|
-
if (result.etag) {
|
|
110590
|
-
headers2["if-none-match"] = result.etag;
|
|
110591
|
-
}
|
|
110592
|
-
if (result.vary) {
|
|
110593
|
-
for (const key in result.vary) {
|
|
110594
|
-
if (result.vary[key] != null) {
|
|
110595
|
-
headers2[key] = result.vary[key];
|
|
110596
|
-
}
|
|
111343
|
+
if (!staleResponseRequiresRevalidation(result, globalOpts.type)) {
|
|
111344
|
+
const staleIfErrorExpiry = result.cacheControlDirectives["stale-if-error"] ?? (reqCacheControl == null ? void 0 : reqCacheControl["stale-if-error"]);
|
|
111345
|
+
if (staleIfErrorExpiry) {
|
|
111346
|
+
withinStaleIfErrorThreshold = now2 < result.staleAt + staleIfErrorExpiry * 1e3;
|
|
110597
111347
|
}
|
|
110598
111348
|
}
|
|
111349
|
+
const headers2 = makeRevalidationHeaders(opts, result);
|
|
110599
111350
|
return dispatch2(
|
|
110600
111351
|
{
|
|
110601
111352
|
...opts,
|
|
110602
111353
|
headers: headers2
|
|
110603
111354
|
},
|
|
110604
111355
|
new CacheRevalidationHandler(
|
|
110605
|
-
(success2, context) => {
|
|
111356
|
+
(success2, context, statusCode, headers3) => {
|
|
110606
111357
|
if (success2) {
|
|
111358
|
+
if (statusCode === 304) {
|
|
111359
|
+
if (revalidationResponseDisallowsCachedReuse(globalOpts.type, headers3)) {
|
|
111360
|
+
if (util2.isStream(result.body)) {
|
|
111361
|
+
result.body.on("error", nop).destroy();
|
|
111362
|
+
}
|
|
111363
|
+
deleteCachedValue(globalOpts.store, cacheKey);
|
|
111364
|
+
return dispatch2(opts, new CacheHandler(globalOpts, cacheKey, handler));
|
|
111365
|
+
}
|
|
111366
|
+
if (revalidationResponseUpdatesCacheControl(headers3)) {
|
|
111367
|
+
deleteCachedValue(globalOpts.store, cacheKey);
|
|
111368
|
+
}
|
|
111369
|
+
}
|
|
110607
111370
|
sendCachedValue(handler, opts, result, age, context, stale);
|
|
110608
111371
|
} else if (util2.isStream(result.body)) {
|
|
110609
111372
|
result.body.on("error", nop).destroy();
|
|
@@ -110645,11 +111408,17 @@ function requireCache$1() {
|
|
|
110645
111408
|
cacheByDefault,
|
|
110646
111409
|
type
|
|
110647
111410
|
};
|
|
110648
|
-
const safeMethodsToNotCache =
|
|
111411
|
+
const safeMethodsToNotCache = [];
|
|
111412
|
+
for (let i = 0; i < util2.safeHTTPMethods.length; i++) {
|
|
111413
|
+
const method = util2.safeHTTPMethods[i];
|
|
111414
|
+
if (!arrayIncludes(methods, method)) {
|
|
111415
|
+
safeMethodsToNotCache.push(method);
|
|
111416
|
+
}
|
|
111417
|
+
}
|
|
110649
111418
|
return (dispatch2) => {
|
|
110650
111419
|
return (opts2, handler) => {
|
|
110651
111420
|
var _a3;
|
|
110652
|
-
if (!opts2.origin || safeMethodsToNotCache
|
|
111421
|
+
if (!opts2.origin || arrayIncludes(safeMethodsToNotCache, opts2.method)) {
|
|
110653
111422
|
return dispatch2(opts2, handler);
|
|
110654
111423
|
}
|
|
110655
111424
|
if (origins !== void 0) {
|
|
@@ -110675,11 +111444,14 @@ function requireCache$1() {
|
|
|
110675
111444
|
...opts2,
|
|
110676
111445
|
headers: normalizeHeaders(opts2)
|
|
110677
111446
|
};
|
|
110678
|
-
const reqCacheControl = ((_a3 = opts2.headers) == null ? void 0 : _a3["cache-control"]) ? parseCacheControlHeader(opts2.headers["cache-control"]) : void 0;
|
|
111447
|
+
const reqCacheControl = ((_a3 = opts2.headers) == null ? void 0 : _a3["cache-control"]) ? parseCacheControlHeader(opts2.headers["cache-control"]) : hasPragmaNoCache(opts2.headers) ? { "no-cache": true } : void 0;
|
|
110679
111448
|
if (reqCacheControl == null ? void 0 : reqCacheControl["no-store"]) {
|
|
110680
111449
|
return dispatch2(opts2, handler);
|
|
110681
111450
|
}
|
|
110682
111451
|
const cacheKey = makeCacheKey(opts2);
|
|
111452
|
+
if (!arrayIncludes(util2.safeHTTPMethods, opts2.method)) {
|
|
111453
|
+
return dispatch2(opts2, new CacheHandler(globalOpts, cacheKey, handler));
|
|
111454
|
+
}
|
|
110683
111455
|
const result = store.get(cacheKey);
|
|
110684
111456
|
if (result && typeof result.then === "function") {
|
|
110685
111457
|
return result.then((result2) => handleResult(
|
|
@@ -110710,13 +111482,78 @@ function requireCache$1() {
|
|
|
110710
111482
|
var decompress;
|
|
110711
111483
|
var hasRequiredDecompress;
|
|
110712
111484
|
function requireDecompress() {
|
|
110713
|
-
var _decompressors, _skipStatusCodes, _skipErrorResponses, _DecompressHandler_instances, shouldSkipDecompression_fn, createDecompressionChain_fn, setupDecompressorEvents_fn, setupSingleDecompressor_fn, setupMultipleDecompressors_fn, cleanupDecompressors_fn;
|
|
111485
|
+
var _onPause, _onResume, _onAbort, _paused, _decompressors, _trailers, _skipStatusCodes, _skipErrorResponses, _maxSize2, _decompressedSize, _terminated, _inputEnded, _inputBackpressured, _upstreamPaused, _draining, _drainRequested, _completionPending, _finalDecompressor, _controller, _DecompressHandler_instances, onDownstreamPause_fn, onDownstreamResume_fn, pauseUpstream_fn, resumeUpstreamIfNeeded_fn, drainOutput_fn, finishIfReady_fn, onDecompressionEnd_fn, shouldSkipDecompression_fn, createDecompressionChain_fn, fail_fn, setupDecompressorEvents_fn, setupSingleDecompressor_fn, setupMultipleDecompressors_fn, setupInputBackpressure_fn, cleanupDecompressors_fn;
|
|
110714
111486
|
if (hasRequiredDecompress) return decompress;
|
|
110715
111487
|
hasRequiredDecompress = 1;
|
|
110716
111488
|
const { createInflate, createGunzip, createBrotliDecompress, createZstdDecompress } = zlib;
|
|
110717
|
-
const { pipeline } = require$$0$5;
|
|
111489
|
+
const { pipeline, Transform: TransformStream2 } = require$$0$5;
|
|
111490
|
+
const { InvalidArgumentError, ResponseExceededMaxSizeError } = requireErrors();
|
|
110718
111491
|
const DecoratorHandler = requireDecoratorHandler();
|
|
110719
111492
|
const { runtimeFeatures: runtimeFeatures2 } = requireRuntimeFeatures();
|
|
111493
|
+
class DecompressController {
|
|
111494
|
+
constructor(onPause, onResume, onAbort) {
|
|
111495
|
+
__privateAdd(this, _onPause);
|
|
111496
|
+
__privateAdd(this, _onResume);
|
|
111497
|
+
__privateAdd(this, _onAbort);
|
|
111498
|
+
__privateAdd(this, _paused, false);
|
|
111499
|
+
__privateSet(this, _onPause, onPause);
|
|
111500
|
+
__privateSet(this, _onResume, onResume);
|
|
111501
|
+
__privateSet(this, _onAbort, onAbort);
|
|
111502
|
+
this.target = null;
|
|
111503
|
+
}
|
|
111504
|
+
pause() {
|
|
111505
|
+
if (__privateGet(this, _paused)) {
|
|
111506
|
+
return;
|
|
111507
|
+
}
|
|
111508
|
+
__privateSet(this, _paused, true);
|
|
111509
|
+
__privateGet(this, _onPause).call(this);
|
|
111510
|
+
}
|
|
111511
|
+
resume() {
|
|
111512
|
+
if (!__privateGet(this, _paused)) {
|
|
111513
|
+
return;
|
|
111514
|
+
}
|
|
111515
|
+
__privateSet(this, _paused, false);
|
|
111516
|
+
__privateGet(this, _onResume).call(this);
|
|
111517
|
+
}
|
|
111518
|
+
abort(reason) {
|
|
111519
|
+
var _a3;
|
|
111520
|
+
(_a3 = this.target) == null ? void 0 : _a3.abort(reason);
|
|
111521
|
+
__privateGet(this, _onAbort).call(this, reason);
|
|
111522
|
+
}
|
|
111523
|
+
get paused() {
|
|
111524
|
+
return __privateGet(this, _paused);
|
|
111525
|
+
}
|
|
111526
|
+
get aborted() {
|
|
111527
|
+
var _a3;
|
|
111528
|
+
return ((_a3 = this.target) == null ? void 0 : _a3.aborted) ?? false;
|
|
111529
|
+
}
|
|
111530
|
+
get reason() {
|
|
111531
|
+
var _a3;
|
|
111532
|
+
return ((_a3 = this.target) == null ? void 0 : _a3.reason) ?? null;
|
|
111533
|
+
}
|
|
111534
|
+
get rawHeaders() {
|
|
111535
|
+
var _a3;
|
|
111536
|
+
return ((_a3 = this.target) == null ? void 0 : _a3.rawHeaders) ?? null;
|
|
111537
|
+
}
|
|
111538
|
+
set rawHeaders(value) {
|
|
111539
|
+
if (this.target) {
|
|
111540
|
+
this.target.rawHeaders = value;
|
|
111541
|
+
}
|
|
111542
|
+
}
|
|
111543
|
+
get rawTrailers() {
|
|
111544
|
+
var _a3;
|
|
111545
|
+
return ((_a3 = this.target) == null ? void 0 : _a3.rawTrailers) ?? null;
|
|
111546
|
+
}
|
|
111547
|
+
set rawTrailers(value) {
|
|
111548
|
+
if (this.target) {
|
|
111549
|
+
this.target.rawTrailers = value;
|
|
111550
|
+
}
|
|
111551
|
+
}
|
|
111552
|
+
}
|
|
111553
|
+
_onPause = new WeakMap();
|
|
111554
|
+
_onResume = new WeakMap();
|
|
111555
|
+
_onAbort = new WeakMap();
|
|
111556
|
+
_paused = new WeakMap();
|
|
110720
111557
|
const supportedEncodings = {
|
|
110721
111558
|
gzip: createGunzip,
|
|
110722
111559
|
"x-gzip": createGunzip,
|
|
@@ -110730,22 +111567,83 @@ function requireDecompress() {
|
|
|
110730
111567
|
/** @type {const} */
|
|
110731
111568
|
[204, 304]
|
|
110732
111569
|
);
|
|
111570
|
+
const defaultMaxSize = 0;
|
|
111571
|
+
function createMaxSizeLimiter(maxSize) {
|
|
111572
|
+
let size2 = 0;
|
|
111573
|
+
return new TransformStream2({
|
|
111574
|
+
transform(chunk, _encoding, callback) {
|
|
111575
|
+
const decompressedSize = size2 + chunk.length;
|
|
111576
|
+
if (decompressedSize > maxSize) {
|
|
111577
|
+
callback(new ResponseExceededMaxSizeError(
|
|
111578
|
+
`Decompressed response size (${decompressedSize}) exceeded maxSize (${maxSize})`
|
|
111579
|
+
));
|
|
111580
|
+
return;
|
|
111581
|
+
}
|
|
111582
|
+
size2 = decompressedSize;
|
|
111583
|
+
callback(null, chunk);
|
|
111584
|
+
}
|
|
111585
|
+
});
|
|
111586
|
+
}
|
|
110733
111587
|
let warningEmitted = (
|
|
110734
111588
|
/** @type {boolean} */
|
|
110735
111589
|
false
|
|
110736
111590
|
);
|
|
110737
111591
|
const _DecompressHandler = class _DecompressHandler extends DecoratorHandler {
|
|
110738
|
-
constructor(handler, { skipStatusCodes = defaultSkipStatusCodes, skipErrorResponses = true } = {}) {
|
|
111592
|
+
constructor(handler, { skipStatusCodes = defaultSkipStatusCodes, skipErrorResponses = true, maxSize = defaultMaxSize } = {}) {
|
|
111593
|
+
if (!Number.isSafeInteger(maxSize) || maxSize < 0) {
|
|
111594
|
+
throw new InvalidArgumentError("maxSize must be a non-negative integer");
|
|
111595
|
+
}
|
|
110739
111596
|
super(handler);
|
|
110740
111597
|
__privateAdd(this, _DecompressHandler_instances);
|
|
110741
111598
|
/** @type {Transform[]} */
|
|
110742
111599
|
__privateAdd(this, _decompressors, []);
|
|
111600
|
+
/** @type {Record<string, string | string[]> | undefined} */
|
|
111601
|
+
__privateAdd(this, _trailers);
|
|
110743
111602
|
/** @type {Readonly<number[]>} */
|
|
110744
111603
|
__privateAdd(this, _skipStatusCodes);
|
|
110745
111604
|
/** @type {boolean} */
|
|
110746
111605
|
__privateAdd(this, _skipErrorResponses);
|
|
111606
|
+
/** @type {number} */
|
|
111607
|
+
__privateAdd(this, _maxSize2);
|
|
111608
|
+
/** @type {number} */
|
|
111609
|
+
__privateAdd(this, _decompressedSize, 0);
|
|
111610
|
+
/** @type {boolean} */
|
|
111611
|
+
__privateAdd(this, _terminated, false);
|
|
111612
|
+
/** @type {boolean} */
|
|
111613
|
+
__privateAdd(this, _inputEnded, false);
|
|
111614
|
+
/** @type {boolean} */
|
|
111615
|
+
__privateAdd(this, _inputBackpressured, false);
|
|
111616
|
+
/** @type {boolean} */
|
|
111617
|
+
__privateAdd(this, _upstreamPaused, false);
|
|
111618
|
+
/** @type {boolean} */
|
|
111619
|
+
__privateAdd(this, _draining, false);
|
|
111620
|
+
/** @type {boolean} */
|
|
111621
|
+
__privateAdd(this, _drainRequested, false);
|
|
111622
|
+
/** @type {boolean} */
|
|
111623
|
+
__privateAdd(this, _completionPending, false);
|
|
111624
|
+
/** @type {DecompressorStream | undefined} */
|
|
111625
|
+
__privateAdd(this, _finalDecompressor);
|
|
111626
|
+
/** @type {DecompressController} */
|
|
111627
|
+
__privateAdd(this, _controller);
|
|
110747
111628
|
__privateSet(this, _skipStatusCodes, skipStatusCodes);
|
|
110748
111629
|
__privateSet(this, _skipErrorResponses, skipErrorResponses);
|
|
111630
|
+
__privateSet(this, _maxSize2, maxSize);
|
|
111631
|
+
__privateSet(this, _controller, new DecompressController(
|
|
111632
|
+
() => __privateMethod(this, _DecompressHandler_instances, onDownstreamPause_fn).call(this),
|
|
111633
|
+
() => __privateMethod(this, _DecompressHandler_instances, onDownstreamResume_fn).call(this),
|
|
111634
|
+
(reason) => {
|
|
111635
|
+
if (__privateGet(this, _inputEnded) && !__privateGet(this, _terminated)) {
|
|
111636
|
+
this.onResponseError(__privateGet(this, _controller), reason);
|
|
111637
|
+
}
|
|
111638
|
+
}
|
|
111639
|
+
));
|
|
111640
|
+
}
|
|
111641
|
+
onRequestStart(controller, context) {
|
|
111642
|
+
__privateGet(this, _controller).target = controller;
|
|
111643
|
+
return super.onRequestStart(__privateGet(this, _controller), context);
|
|
111644
|
+
}
|
|
111645
|
+
onRequestUpgrade(controller, statusCode, headers2, socket) {
|
|
111646
|
+
return super.onRequestUpgrade(__privateGet(this, _controller), statusCode, headers2, socket);
|
|
110749
111647
|
}
|
|
110750
111648
|
/**
|
|
110751
111649
|
* @param {Controller} controller
|
|
@@ -110757,21 +111655,45 @@ function requireDecompress() {
|
|
|
110757
111655
|
onResponseStart(controller, statusCode, headers2, statusMessage) {
|
|
110758
111656
|
const contentEncoding = headers2["content-encoding"];
|
|
110759
111657
|
if (__privateMethod(this, _DecompressHandler_instances, shouldSkipDecompression_fn).call(this, contentEncoding, statusCode)) {
|
|
110760
|
-
return super.onResponseStart(
|
|
111658
|
+
return super.onResponseStart(__privateGet(this, _controller), statusCode, headers2, statusMessage);
|
|
110761
111659
|
}
|
|
110762
111660
|
const decompressors = __privateMethod(this, _DecompressHandler_instances, createDecompressionChain_fn).call(this, contentEncoding.toLowerCase());
|
|
110763
111661
|
if (decompressors.length === 0) {
|
|
110764
111662
|
__privateMethod(this, _DecompressHandler_instances, cleanupDecompressors_fn).call(this);
|
|
110765
|
-
return super.onResponseStart(
|
|
111663
|
+
return super.onResponseStart(__privateGet(this, _controller), statusCode, headers2, statusMessage);
|
|
110766
111664
|
}
|
|
110767
111665
|
__privateSet(this, _decompressors, decompressors);
|
|
110768
111666
|
const { "content-encoding": _2, "content-length": __, ...newHeaders } = headers2;
|
|
111667
|
+
if (__privateGet(this, _controller).rawHeaders) {
|
|
111668
|
+
const rawHeaders = __privateGet(this, _controller).rawHeaders;
|
|
111669
|
+
if (Array.isArray(rawHeaders)) {
|
|
111670
|
+
const filteredHeaders = [];
|
|
111671
|
+
for (let i = 0; i < rawHeaders.length; i += 2) {
|
|
111672
|
+
const headerName = rawHeaders[i];
|
|
111673
|
+
const name2 = Buffer.isBuffer(headerName) ? headerName.toString("latin1") : `${headerName}`;
|
|
111674
|
+
const lowerName = name2.toLowerCase();
|
|
111675
|
+
if (lowerName === "content-encoding" || lowerName === "content-length") {
|
|
111676
|
+
continue;
|
|
111677
|
+
}
|
|
111678
|
+
filteredHeaders.push(rawHeaders[i], rawHeaders[i + 1]);
|
|
111679
|
+
}
|
|
111680
|
+
rawHeaders.splice(0, rawHeaders.length, ...filteredHeaders);
|
|
111681
|
+
} else if (typeof rawHeaders === "object") {
|
|
111682
|
+
for (const name2 of Object.keys(rawHeaders)) {
|
|
111683
|
+
const lowerName = name2.toLowerCase();
|
|
111684
|
+
if (lowerName === "content-encoding" || lowerName === "content-length") {
|
|
111685
|
+
delete rawHeaders[name2];
|
|
111686
|
+
}
|
|
111687
|
+
}
|
|
111688
|
+
}
|
|
111689
|
+
}
|
|
111690
|
+
__privateMethod(this, _DecompressHandler_instances, setupInputBackpressure_fn).call(this);
|
|
110769
111691
|
if (__privateGet(this, _decompressors).length === 1) {
|
|
110770
|
-
__privateMethod(this, _DecompressHandler_instances, setupSingleDecompressor_fn).call(this
|
|
111692
|
+
__privateMethod(this, _DecompressHandler_instances, setupSingleDecompressor_fn).call(this);
|
|
110771
111693
|
} else {
|
|
110772
|
-
__privateMethod(this, _DecompressHandler_instances, setupMultipleDecompressors_fn).call(this
|
|
111694
|
+
__privateMethod(this, _DecompressHandler_instances, setupMultipleDecompressors_fn).call(this);
|
|
110773
111695
|
}
|
|
110774
|
-
return super.onResponseStart(
|
|
111696
|
+
return super.onResponseStart(__privateGet(this, _controller), statusCode, newHeaders, statusMessage);
|
|
110775
111697
|
}
|
|
110776
111698
|
/**
|
|
110777
111699
|
* @param {Controller} controller
|
|
@@ -110780,10 +111702,13 @@ function requireDecompress() {
|
|
|
110780
111702
|
*/
|
|
110781
111703
|
onResponseData(controller, chunk) {
|
|
110782
111704
|
if (__privateGet(this, _decompressors).length > 0) {
|
|
110783
|
-
__privateGet(this, _decompressors)[0].write(chunk)
|
|
111705
|
+
if (!__privateGet(this, _decompressors)[0].write(chunk)) {
|
|
111706
|
+
__privateSet(this, _inputBackpressured, true);
|
|
111707
|
+
__privateMethod(this, _DecompressHandler_instances, pauseUpstream_fn).call(this);
|
|
111708
|
+
}
|
|
110784
111709
|
return;
|
|
110785
111710
|
}
|
|
110786
|
-
super.onResponseData(
|
|
111711
|
+
return super.onResponseData(__privateGet(this, _controller), chunk);
|
|
110787
111712
|
}
|
|
110788
111713
|
/**
|
|
110789
111714
|
* @param {Controller} controller
|
|
@@ -110792,11 +111717,12 @@ function requireDecompress() {
|
|
|
110792
111717
|
*/
|
|
110793
111718
|
onResponseEnd(controller, trailers) {
|
|
110794
111719
|
if (__privateGet(this, _decompressors).length > 0) {
|
|
111720
|
+
__privateSet(this, _inputEnded, true);
|
|
111721
|
+
__privateSet(this, _trailers, trailers);
|
|
110795
111722
|
__privateGet(this, _decompressors)[0].end();
|
|
110796
|
-
__privateMethod(this, _DecompressHandler_instances, cleanupDecompressors_fn).call(this);
|
|
110797
111723
|
return;
|
|
110798
111724
|
}
|
|
110799
|
-
super.onResponseEnd(
|
|
111725
|
+
return super.onResponseEnd(__privateGet(this, _controller), trailers);
|
|
110800
111726
|
}
|
|
110801
111727
|
/**
|
|
110802
111728
|
* @param {Controller} controller
|
|
@@ -110804,19 +111730,112 @@ function requireDecompress() {
|
|
|
110804
111730
|
* @returns {void}
|
|
110805
111731
|
*/
|
|
110806
111732
|
onResponseError(controller, err) {
|
|
110807
|
-
if (__privateGet(this,
|
|
110808
|
-
|
|
110809
|
-
decompressor.destroy(err);
|
|
110810
|
-
}
|
|
110811
|
-
__privateMethod(this, _DecompressHandler_instances, cleanupDecompressors_fn).call(this);
|
|
111733
|
+
if (__privateGet(this, _terminated)) {
|
|
111734
|
+
return;
|
|
110812
111735
|
}
|
|
110813
|
-
|
|
111736
|
+
__privateSet(this, _terminated, true);
|
|
111737
|
+
for (const decompressor of __privateGet(this, _decompressors)) {
|
|
111738
|
+
decompressor.destroy();
|
|
111739
|
+
}
|
|
111740
|
+
__privateMethod(this, _DecompressHandler_instances, cleanupDecompressors_fn).call(this);
|
|
111741
|
+
super.onResponseError(__privateGet(this, _controller), err);
|
|
110814
111742
|
}
|
|
110815
111743
|
};
|
|
110816
111744
|
_decompressors = new WeakMap();
|
|
111745
|
+
_trailers = new WeakMap();
|
|
110817
111746
|
_skipStatusCodes = new WeakMap();
|
|
110818
111747
|
_skipErrorResponses = new WeakMap();
|
|
111748
|
+
_maxSize2 = new WeakMap();
|
|
111749
|
+
_decompressedSize = new WeakMap();
|
|
111750
|
+
_terminated = new WeakMap();
|
|
111751
|
+
_inputEnded = new WeakMap();
|
|
111752
|
+
_inputBackpressured = new WeakMap();
|
|
111753
|
+
_upstreamPaused = new WeakMap();
|
|
111754
|
+
_draining = new WeakMap();
|
|
111755
|
+
_drainRequested = new WeakMap();
|
|
111756
|
+
_completionPending = new WeakMap();
|
|
111757
|
+
_finalDecompressor = new WeakMap();
|
|
111758
|
+
_controller = new WeakMap();
|
|
110819
111759
|
_DecompressHandler_instances = new WeakSet();
|
|
111760
|
+
onDownstreamPause_fn = function() {
|
|
111761
|
+
__privateMethod(this, _DecompressHandler_instances, pauseUpstream_fn).call(this);
|
|
111762
|
+
};
|
|
111763
|
+
onDownstreamResume_fn = function() {
|
|
111764
|
+
const drainWasDeferred = __privateGet(this, _draining);
|
|
111765
|
+
__privateMethod(this, _DecompressHandler_instances, drainOutput_fn).call(this);
|
|
111766
|
+
if (!drainWasDeferred) {
|
|
111767
|
+
__privateMethod(this, _DecompressHandler_instances, resumeUpstreamIfNeeded_fn).call(this);
|
|
111768
|
+
__privateMethod(this, _DecompressHandler_instances, finishIfReady_fn).call(this);
|
|
111769
|
+
}
|
|
111770
|
+
};
|
|
111771
|
+
pauseUpstream_fn = function() {
|
|
111772
|
+
var _a3;
|
|
111773
|
+
if (!__privateGet(this, _upstreamPaused) && !__privateGet(this, _terminated)) {
|
|
111774
|
+
__privateSet(this, _upstreamPaused, true);
|
|
111775
|
+
(_a3 = __privateGet(this, _controller).target) == null ? void 0 : _a3.pause();
|
|
111776
|
+
}
|
|
111777
|
+
};
|
|
111778
|
+
resumeUpstreamIfNeeded_fn = function() {
|
|
111779
|
+
var _a3;
|
|
111780
|
+
if (__privateGet(this, _upstreamPaused) && !__privateGet(this, _controller).paused && !__privateGet(this, _inputBackpressured)) {
|
|
111781
|
+
__privateSet(this, _upstreamPaused, false);
|
|
111782
|
+
if (!__privateGet(this, _inputEnded)) {
|
|
111783
|
+
(_a3 = __privateGet(this, _controller).target) == null ? void 0 : _a3.resume();
|
|
111784
|
+
}
|
|
111785
|
+
}
|
|
111786
|
+
};
|
|
111787
|
+
drainOutput_fn = function() {
|
|
111788
|
+
if (__privateGet(this, _terminated) || __privateGet(this, _controller).paused || !__privateGet(this, _finalDecompressor)) {
|
|
111789
|
+
return;
|
|
111790
|
+
}
|
|
111791
|
+
if (__privateGet(this, _draining)) {
|
|
111792
|
+
__privateSet(this, _drainRequested, true);
|
|
111793
|
+
return;
|
|
111794
|
+
}
|
|
111795
|
+
__privateSet(this, _draining, true);
|
|
111796
|
+
try {
|
|
111797
|
+
do {
|
|
111798
|
+
__privateSet(this, _drainRequested, false);
|
|
111799
|
+
let chunk;
|
|
111800
|
+
while (!__privateGet(this, _terminated) && !__privateGet(this, _controller).paused && (chunk = __privateGet(this, _finalDecompressor).read()) !== null) {
|
|
111801
|
+
if (__privateGet(this, _maxSize2) > 0) {
|
|
111802
|
+
const decompressedSize = __privateGet(this, _decompressedSize) + chunk.length;
|
|
111803
|
+
if (decompressedSize > __privateGet(this, _maxSize2)) {
|
|
111804
|
+
__privateMethod(this, _DecompressHandler_instances, fail_fn).call(this, new ResponseExceededMaxSizeError(
|
|
111805
|
+
`Decompressed response size (${decompressedSize}) exceeded maxSize (${__privateGet(this, _maxSize2)})`
|
|
111806
|
+
));
|
|
111807
|
+
return;
|
|
111808
|
+
}
|
|
111809
|
+
__privateSet(this, _decompressedSize, decompressedSize);
|
|
111810
|
+
}
|
|
111811
|
+
const result = __superGet(_DecompressHandler.prototype, this, "onResponseData").call(this, __privateGet(this, _controller), chunk);
|
|
111812
|
+
if (result === false && !__privateGet(this, _controller).paused) {
|
|
111813
|
+
__privateGet(this, _controller).pause();
|
|
111814
|
+
}
|
|
111815
|
+
}
|
|
111816
|
+
} while (__privateGet(this, _drainRequested) && !__privateGet(this, _terminated) && !__privateGet(this, _controller).paused);
|
|
111817
|
+
} finally {
|
|
111818
|
+
__privateSet(this, _draining, false);
|
|
111819
|
+
}
|
|
111820
|
+
__privateMethod(this, _DecompressHandler_instances, resumeUpstreamIfNeeded_fn).call(this);
|
|
111821
|
+
__privateMethod(this, _DecompressHandler_instances, finishIfReady_fn).call(this);
|
|
111822
|
+
};
|
|
111823
|
+
finishIfReady_fn = function() {
|
|
111824
|
+
if (__privateGet(this, _terminated) || !__privateGet(this, _completionPending) || __privateGet(this, _controller).paused || __privateGet(this, _draining)) {
|
|
111825
|
+
return;
|
|
111826
|
+
}
|
|
111827
|
+
__privateSet(this, _terminated, true);
|
|
111828
|
+
__privateMethod(this, _DecompressHandler_instances, cleanupDecompressors_fn).call(this);
|
|
111829
|
+
__superGet(_DecompressHandler.prototype, this, "onResponseEnd").call(this, __privateGet(this, _controller), __privateGet(this, _trailers));
|
|
111830
|
+
};
|
|
111831
|
+
onDecompressionEnd_fn = function() {
|
|
111832
|
+
if (__privateGet(this, _terminated)) {
|
|
111833
|
+
return;
|
|
111834
|
+
}
|
|
111835
|
+
__privateSet(this, _completionPending, true);
|
|
111836
|
+
__privateMethod(this, _DecompressHandler_instances, drainOutput_fn).call(this);
|
|
111837
|
+
__privateMethod(this, _DecompressHandler_instances, finishIfReady_fn).call(this);
|
|
111838
|
+
};
|
|
110820
111839
|
/**
|
|
110821
111840
|
* Determines if decompression should be skipped based on encoding and status code
|
|
110822
111841
|
* @param {string} contentEncoding - Content-Encoding header value
|
|
@@ -110833,7 +111852,7 @@ function requireDecompress() {
|
|
|
110833
111852
|
* Creates a chain of decompressors for multiple content encodings
|
|
110834
111853
|
*
|
|
110835
111854
|
* @param {string} encodings - Comma-separated list of content encodings
|
|
110836
|
-
* @returns {Array<
|
|
111855
|
+
* @returns {Array<Transform>} - Array of decompressor and limiting streams
|
|
110837
111856
|
* @throws {Error} - If the number of content-encodings exceeds the maximum allowed
|
|
110838
111857
|
*/
|
|
110839
111858
|
createDecompressionChain_fn = function(encodings) {
|
|
@@ -110852,54 +111871,81 @@ function requireDecompress() {
|
|
|
110852
111871
|
}
|
|
110853
111872
|
decompressors.push(supportedEncodings[encoding2]());
|
|
110854
111873
|
}
|
|
110855
|
-
|
|
111874
|
+
if (decompressors.length < 2) {
|
|
111875
|
+
return decompressors;
|
|
111876
|
+
}
|
|
111877
|
+
const streams = [];
|
|
111878
|
+
for (let i = 0; i < decompressors.length; i++) {
|
|
111879
|
+
streams.push(decompressors[i]);
|
|
111880
|
+
if (i < decompressors.length - 1 && __privateGet(this, _maxSize2) > 0) {
|
|
111881
|
+
streams.push(createMaxSizeLimiter(__privateGet(this, _maxSize2)));
|
|
111882
|
+
}
|
|
111883
|
+
}
|
|
111884
|
+
return streams;
|
|
111885
|
+
};
|
|
111886
|
+
/**
|
|
111887
|
+
* Stops decompression and reports an error.
|
|
111888
|
+
* @param {Error} error - The decompression error
|
|
111889
|
+
* @returns {void}
|
|
111890
|
+
*/
|
|
111891
|
+
fail_fn = function(error2) {
|
|
111892
|
+
if (__privateGet(this, _terminated)) {
|
|
111893
|
+
return;
|
|
111894
|
+
}
|
|
111895
|
+
if (__privateGet(this, _inputEnded)) {
|
|
111896
|
+
this.onResponseError(__privateGet(this, _controller), error2);
|
|
111897
|
+
} else {
|
|
111898
|
+
__privateGet(this, _controller).abort(error2);
|
|
111899
|
+
}
|
|
110856
111900
|
};
|
|
110857
111901
|
/**
|
|
110858
|
-
* Sets up event handlers for
|
|
111902
|
+
* Sets up event handlers for the final decompressor stream.
|
|
110859
111903
|
* @param {DecompressorStream} decompressor - The decompressor stream
|
|
110860
|
-
* @param {Controller} controller - The controller to coordinate with
|
|
110861
111904
|
* @returns {void}
|
|
110862
111905
|
*/
|
|
110863
|
-
setupDecompressorEvents_fn = function(decompressor
|
|
110864
|
-
|
|
110865
|
-
|
|
110866
|
-
|
|
110867
|
-
const result = __superGet(_DecompressHandler.prototype, this, "onResponseData").call(this, controller, chunk);
|
|
110868
|
-
if (result === false) {
|
|
110869
|
-
break;
|
|
110870
|
-
}
|
|
110871
|
-
}
|
|
110872
|
-
});
|
|
110873
|
-
decompressor.on("error", (error2) => {
|
|
110874
|
-
__superGet(_DecompressHandler.prototype, this, "onResponseError").call(this, controller, error2);
|
|
110875
|
-
});
|
|
111906
|
+
setupDecompressorEvents_fn = function(decompressor) {
|
|
111907
|
+
__privateSet(this, _finalDecompressor, decompressor);
|
|
111908
|
+
decompressor.on("readable", () => __privateMethod(this, _DecompressHandler_instances, drainOutput_fn).call(this));
|
|
111909
|
+
decompressor.on("error", (error2) => __privateMethod(this, _DecompressHandler_instances, fail_fn).call(this, error2));
|
|
110876
111910
|
};
|
|
110877
111911
|
/**
|
|
110878
111912
|
* Sets up event handling for a single decompressor
|
|
110879
|
-
* @param {Controller} controller - The controller to handle events
|
|
110880
111913
|
* @returns {void}
|
|
110881
111914
|
*/
|
|
110882
|
-
setupSingleDecompressor_fn = function(
|
|
111915
|
+
setupSingleDecompressor_fn = function() {
|
|
110883
111916
|
const decompressor = __privateGet(this, _decompressors)[0];
|
|
110884
|
-
__privateMethod(this, _DecompressHandler_instances, setupDecompressorEvents_fn).call(this, decompressor
|
|
110885
|
-
decompressor.on("end", () =>
|
|
110886
|
-
__superGet(_DecompressHandler.prototype, this, "onResponseEnd").call(this, controller, {});
|
|
110887
|
-
});
|
|
111917
|
+
__privateMethod(this, _DecompressHandler_instances, setupDecompressorEvents_fn).call(this, decompressor);
|
|
111918
|
+
decompressor.on("end", () => __privateMethod(this, _DecompressHandler_instances, onDecompressionEnd_fn).call(this));
|
|
110888
111919
|
};
|
|
110889
111920
|
/**
|
|
110890
111921
|
* Sets up event handling for multiple chained decompressors using pipeline
|
|
110891
|
-
* @param {Controller} controller - The controller to handle events
|
|
110892
111922
|
* @returns {void}
|
|
110893
111923
|
*/
|
|
110894
|
-
setupMultipleDecompressors_fn = function(
|
|
111924
|
+
setupMultipleDecompressors_fn = function() {
|
|
110895
111925
|
const lastDecompressor = __privateGet(this, _decompressors)[__privateGet(this, _decompressors).length - 1];
|
|
110896
|
-
__privateMethod(this, _DecompressHandler_instances, setupDecompressorEvents_fn).call(this, lastDecompressor
|
|
111926
|
+
__privateMethod(this, _DecompressHandler_instances, setupDecompressorEvents_fn).call(this, lastDecompressor);
|
|
110897
111927
|
pipeline(__privateGet(this, _decompressors), (err) => {
|
|
111928
|
+
if (__privateGet(this, _terminated)) {
|
|
111929
|
+
return;
|
|
111930
|
+
}
|
|
110898
111931
|
if (err) {
|
|
110899
|
-
|
|
111932
|
+
__privateMethod(this, _DecompressHandler_instances, fail_fn).call(this, err);
|
|
111933
|
+
return;
|
|
111934
|
+
}
|
|
111935
|
+
__privateMethod(this, _DecompressHandler_instances, onDecompressionEnd_fn).call(this);
|
|
111936
|
+
});
|
|
111937
|
+
};
|
|
111938
|
+
setupInputBackpressure_fn = function() {
|
|
111939
|
+
const decompressor = __privateGet(this, _decompressors)[0];
|
|
111940
|
+
decompressor.on("drain", () => {
|
|
111941
|
+
if (__privateGet(this, _terminated)) {
|
|
110900
111942
|
return;
|
|
110901
111943
|
}
|
|
110902
|
-
|
|
111944
|
+
__privateSet(this, _inputBackpressured, false);
|
|
111945
|
+
if (!__privateGet(this, _controller).paused) {
|
|
111946
|
+
__privateMethod(this, _DecompressHandler_instances, drainOutput_fn).call(this);
|
|
111947
|
+
__privateMethod(this, _DecompressHandler_instances, resumeUpstreamIfNeeded_fn).call(this);
|
|
111948
|
+
}
|
|
110903
111949
|
});
|
|
110904
111950
|
};
|
|
110905
111951
|
/**
|
|
@@ -110908,6 +111954,7 @@ function requireDecompress() {
|
|
|
110908
111954
|
*/
|
|
110909
111955
|
cleanupDecompressors_fn = function() {
|
|
110910
111956
|
__privateGet(this, _decompressors).length = 0;
|
|
111957
|
+
__privateSet(this, _finalDecompressor, void 0);
|
|
110911
111958
|
};
|
|
110912
111959
|
let DecompressHandler = _DecompressHandler;
|
|
110913
111960
|
function createDecompressInterceptor(options = {}) {
|
|
@@ -111752,7 +112799,12 @@ function requireSqliteCacheStore() {
|
|
|
111752
112799
|
if (lhs.length !== rhs.length) {
|
|
111753
112800
|
return false;
|
|
111754
112801
|
}
|
|
111755
|
-
|
|
112802
|
+
for (let i = 0; i < lhs.length; i++) {
|
|
112803
|
+
if (lhs[i] !== rhs[i]) {
|
|
112804
|
+
return false;
|
|
112805
|
+
}
|
|
112806
|
+
}
|
|
112807
|
+
return true;
|
|
111756
112808
|
}
|
|
111757
112809
|
return lhs === rhs;
|
|
111758
112810
|
}
|
|
@@ -115467,14 +116519,48 @@ function requireUtil$2() {
|
|
|
115467
116519
|
for (let i = 0; i < path2.length; ++i) {
|
|
115468
116520
|
const code2 = path2.charCodeAt(i);
|
|
115469
116521
|
if (code2 < 32 || // exclude CTLs (0-31)
|
|
115470
|
-
code2
|
|
116522
|
+
code2 > 126 || // exclude DEL and non-ascii
|
|
115471
116523
|
code2 === 59) {
|
|
115472
116524
|
throw new Error("Invalid cookie path");
|
|
115473
116525
|
}
|
|
115474
116526
|
}
|
|
115475
116527
|
}
|
|
116528
|
+
function isLetterOrDigit(code2) {
|
|
116529
|
+
return code2 >= 48 && code2 <= 57 || // 0-9
|
|
116530
|
+
code2 >= 65 && code2 <= 90 || // A-Z
|
|
116531
|
+
code2 >= 97 && code2 <= 122;
|
|
116532
|
+
}
|
|
115476
116533
|
function validateCookieDomain(domain2) {
|
|
115477
|
-
if (domain2
|
|
116534
|
+
if (domain2 === " ") {
|
|
116535
|
+
return;
|
|
116536
|
+
}
|
|
116537
|
+
if (domain2.length > 255) {
|
|
116538
|
+
throw new Error("Invalid cookie domain");
|
|
116539
|
+
}
|
|
116540
|
+
let labelLength = 0;
|
|
116541
|
+
for (let i = 0; i < domain2.length; ++i) {
|
|
116542
|
+
const code2 = domain2.charCodeAt(i);
|
|
116543
|
+
if (code2 === 46) {
|
|
116544
|
+
if (labelLength === 0) {
|
|
116545
|
+
throw new Error("Invalid cookie domain");
|
|
116546
|
+
}
|
|
116547
|
+
if (domain2.charCodeAt(i - 1) === 45) {
|
|
116548
|
+
throw new Error("Invalid cookie domain");
|
|
116549
|
+
}
|
|
116550
|
+
labelLength = 0;
|
|
116551
|
+
continue;
|
|
116552
|
+
}
|
|
116553
|
+
if (labelLength === 0 && !isLetterOrDigit(code2)) {
|
|
116554
|
+
throw new Error("Invalid cookie domain");
|
|
116555
|
+
}
|
|
116556
|
+
if (!isLetterOrDigit(code2) && code2 !== 45) {
|
|
116557
|
+
throw new Error("Invalid cookie domain");
|
|
116558
|
+
}
|
|
116559
|
+
if (++labelLength > 63) {
|
|
116560
|
+
throw new Error("Invalid cookie domain");
|
|
116561
|
+
}
|
|
116562
|
+
}
|
|
116563
|
+
if (labelLength === 0 || domain2.charCodeAt(domain2.length - 1) === 45) {
|
|
115478
116564
|
throw new Error("Invalid cookie domain");
|
|
115479
116565
|
}
|
|
115480
116566
|
}
|
|
@@ -115557,7 +116643,11 @@ function requireUtil$2() {
|
|
|
115557
116643
|
throw new Error("Invalid unparsed");
|
|
115558
116644
|
}
|
|
115559
116645
|
const [key, ...value] = part.split("=");
|
|
115560
|
-
|
|
116646
|
+
const trimmedKey = key.trim();
|
|
116647
|
+
const joinedValue = value.join("=");
|
|
116648
|
+
validateCookieName(trimmedKey);
|
|
116649
|
+
validateCookieValue(joinedValue);
|
|
116650
|
+
out.push(`${trimmedKey}=${joinedValue}`);
|
|
115561
116651
|
}
|
|
115562
116652
|
return out.join("; ");
|
|
115563
116653
|
}
|
|
@@ -116511,11 +117601,11 @@ function requireConnection() {
|
|
|
116511
117601
|
var _a3, _b2, _c, _d;
|
|
116512
117602
|
if (response2.type === "error" || response2.status !== 101) {
|
|
116513
117603
|
if (((_a3 = response2.socket) == null ? void 0 : _a3.session) == null) {
|
|
116514
|
-
|
|
117604
|
+
failHandshake(handler, response2, 1002, "Received network error or non-101 status code.", response2.error);
|
|
116515
117605
|
return;
|
|
116516
117606
|
}
|
|
116517
117607
|
if (response2.status !== 200) {
|
|
116518
|
-
|
|
117608
|
+
failHandshake(handler, response2, 1002, "Received network error or non-200 status code.", response2.error);
|
|
116519
117609
|
return;
|
|
116520
117610
|
}
|
|
116521
117611
|
}
|
|
@@ -116524,21 +117614,21 @@ function requireConnection() {
|
|
|
116524
117614
|
warningEmitted = true;
|
|
116525
117615
|
}
|
|
116526
117616
|
if (protocols.length !== 0 && !response2.headersList.get("Sec-WebSocket-Protocol")) {
|
|
116527
|
-
|
|
117617
|
+
failHandshake(handler, response2, 1002, "Server did not respond with sent protocols.");
|
|
116528
117618
|
return;
|
|
116529
117619
|
}
|
|
116530
117620
|
if (response2.socket.session == null && ((_c = response2.headersList.get("Upgrade")) == null ? void 0 : _c.toLowerCase()) !== "websocket") {
|
|
116531
|
-
|
|
117621
|
+
failHandshake(handler, response2, 1002, 'Server did not set Upgrade header to "websocket".');
|
|
116532
117622
|
return;
|
|
116533
117623
|
}
|
|
116534
117624
|
if (response2.socket.session == null && ((_d = response2.headersList.get("Connection")) == null ? void 0 : _d.toLowerCase()) !== "upgrade") {
|
|
116535
|
-
|
|
117625
|
+
failHandshake(handler, response2, 1002, 'Server did not set Connection header to "upgrade".');
|
|
116536
117626
|
return;
|
|
116537
117627
|
}
|
|
116538
117628
|
const secWSAccept = response2.headersList.get("Sec-WebSocket-Accept");
|
|
116539
117629
|
const digest = crypto$1.hash("sha1", keyValue + uid, "base64");
|
|
116540
117630
|
if (secWSAccept !== digest) {
|
|
116541
|
-
|
|
117631
|
+
failHandshake(handler, response2, 1002, "Incorrect hash received in Sec-WebSocket-Accept header.");
|
|
116542
117632
|
return;
|
|
116543
117633
|
}
|
|
116544
117634
|
const secExtension = response2.headersList.get("Sec-WebSocket-Extensions");
|
|
@@ -116546,15 +117636,15 @@ function requireConnection() {
|
|
|
116546
117636
|
if (secExtension !== null) {
|
|
116547
117637
|
extensions2 = parseExtensions(secExtension);
|
|
116548
117638
|
if (!extensions2.has("permessage-deflate")) {
|
|
116549
|
-
|
|
117639
|
+
failHandshake(handler, response2, 1002, "Sec-WebSocket-Extensions header does not match.");
|
|
116550
117640
|
return;
|
|
116551
117641
|
}
|
|
116552
117642
|
}
|
|
116553
117643
|
const secProtocol = response2.headersList.get("Sec-WebSocket-Protocol");
|
|
116554
117644
|
if (secProtocol !== null) {
|
|
116555
117645
|
const requestProtocols = getDecodeSplit("sec-websocket-protocol", request2.headersList);
|
|
116556
|
-
if (!requestProtocols.includes(secProtocol)) {
|
|
116557
|
-
|
|
117646
|
+
if (requestProtocols === null || !requestProtocols.includes(secProtocol)) {
|
|
117647
|
+
failHandshake(handler, response2, 1002, "Protocol was not set in the opening handshake.");
|
|
116558
117648
|
return;
|
|
116559
117649
|
}
|
|
116560
117650
|
}
|
|
@@ -116600,6 +117690,13 @@ function requireConnection() {
|
|
|
116600
117690
|
object2.readyState = states.CLOSING;
|
|
116601
117691
|
}
|
|
116602
117692
|
}
|
|
117693
|
+
function failHandshake(handler, response2, code2, reason, cause) {
|
|
117694
|
+
var _a3;
|
|
117695
|
+
if (((_a3 = response2.socket) == null ? void 0 : _a3.session) != null && !response2.socket.destroyed) {
|
|
117696
|
+
response2.socket.destroy();
|
|
117697
|
+
}
|
|
117698
|
+
failWebsocketConnection(handler, code2, reason);
|
|
117699
|
+
}
|
|
116603
117700
|
function failWebsocketConnection(handler, code2, reason, cause) {
|
|
116604
117701
|
var _a3;
|
|
116605
117702
|
if (isEstablished(handler.readyState)) {
|
|
@@ -116673,6 +117770,7 @@ function requirePermessageDeflate() {
|
|
|
116673
117770
|
if (__privateGet(this, _maxPayloadSize) > 0 && __privateGet(this, _inflate)[kLength] > __privateGet(this, _maxPayloadSize)) {
|
|
116674
117771
|
callback(new MessageSizeExceededError());
|
|
116675
117772
|
__privateGet(this, _inflate).removeAllListeners();
|
|
117773
|
+
__privateGet(this, _inflate).destroy();
|
|
116676
117774
|
__privateSet(this, _inflate, null);
|
|
116677
117775
|
return;
|
|
116678
117776
|
}
|
|
@@ -117763,7 +118861,7 @@ function requireWebsocketerror() {
|
|
|
117763
118861
|
var websocketstream;
|
|
117764
118862
|
var hasRequiredWebsocketstream;
|
|
117765
118863
|
function requireWebsocketstream() {
|
|
117766
|
-
var _url2, _openedPromise, _closedPromise, _readableStream, _readableStreamController,
|
|
118864
|
+
var _url2, _openedPromise, _closedPromise, _readableStream, _readableStreamController, _writableStreamController, _handshakeAborted, _handler, _parser, _WebSocketStream_instances, write_fn, onConnectionEstablished_fn, onMessage_fn, onSocketClose_fn, closeUsingReason_fn, cancel_fn;
|
|
117767
118865
|
if (hasRequiredWebsocketstream) return websocketstream;
|
|
117768
118866
|
hasRequiredWebsocketstream = 1;
|
|
117769
118867
|
const { createDeferredPromise } = requirePromise();
|
|
@@ -117796,9 +118894,9 @@ function requireWebsocketstream() {
|
|
|
117796
118894
|
__privateAdd(this, _readableStream);
|
|
117797
118895
|
/** @type {ReadableStreamDefaultController} */
|
|
117798
118896
|
__privateAdd(this, _readableStreamController);
|
|
117799
|
-
//
|
|
117800
|
-
/** @type {
|
|
117801
|
-
__privateAdd(this,
|
|
118897
|
+
// Retain the controller so the writable stream can be errored while locked.
|
|
118898
|
+
/** @type {WritableStreamDefaultController} */
|
|
118899
|
+
__privateAdd(this, _writableStreamController);
|
|
117802
118900
|
// Each WebSocketStream object has an associated boolean handshake aborted , which is initially false.
|
|
117803
118901
|
__privateAdd(this, _handshakeAborted, false);
|
|
117804
118902
|
/** @type {import('../websocket').Handler} */
|
|
@@ -117909,7 +119007,7 @@ function requireWebsocketstream() {
|
|
|
117909
119007
|
_closedPromise = new WeakMap();
|
|
117910
119008
|
_readableStream = new WeakMap();
|
|
117911
119009
|
_readableStreamController = new WeakMap();
|
|
117912
|
-
|
|
119010
|
+
_writableStreamController = new WeakMap();
|
|
117913
119011
|
_handshakeAborted = new WeakMap();
|
|
117914
119012
|
_handler = new WeakMap();
|
|
117915
119013
|
_parser = new WeakMap();
|
|
@@ -117964,12 +119062,14 @@ function requireWebsocketstream() {
|
|
|
117964
119062
|
cancel: (reason) => __privateMethod(this, _WebSocketStream_instances, cancel_fn).call(this, reason)
|
|
117965
119063
|
});
|
|
117966
119064
|
const writable = new WritableStream({
|
|
119065
|
+
start: (controller) => {
|
|
119066
|
+
__privateSet(this, _writableStreamController, controller);
|
|
119067
|
+
},
|
|
117967
119068
|
write: (chunk) => __privateMethod(this, _WebSocketStream_instances, write_fn).call(this, chunk),
|
|
117968
119069
|
close: () => closeWebSocketConnection(__privateGet(this, _handler), null, null),
|
|
117969
119070
|
abort: (reason) => __privateMethod(this, _WebSocketStream_instances, closeUsingReason_fn).call(this, reason)
|
|
117970
119071
|
});
|
|
117971
119072
|
__privateSet(this, _readableStream, readable2);
|
|
117972
|
-
__privateSet(this, _writableStream, writable);
|
|
117973
119073
|
__privateGet(this, _openedPromise).resolve({
|
|
117974
119074
|
extensions: extensions2,
|
|
117975
119075
|
protocol,
|
|
@@ -118014,9 +119114,7 @@ function requireWebsocketstream() {
|
|
|
118014
119114
|
const reason = (result == null ? void 0 : result.reason) == null ? "" : utf8DecodeBytes(Buffer.from(result.reason));
|
|
118015
119115
|
if (wasClean) {
|
|
118016
119116
|
__privateGet(this, _readableStreamController).close();
|
|
118017
|
-
|
|
118018
|
-
__privateGet(this, _writableStream).abort(new DOMException("A closed WebSocketStream cannot be written to", "InvalidStateError"));
|
|
118019
|
-
}
|
|
119117
|
+
__privateGet(this, _writableStreamController).error(new DOMException("A closed WebSocketStream cannot be written to", "InvalidStateError"));
|
|
118020
119118
|
__privateGet(this, _closedPromise).resolve({
|
|
118021
119119
|
closeCode: code2,
|
|
118022
119120
|
reason
|
|
@@ -118024,7 +119122,7 @@ function requireWebsocketstream() {
|
|
|
118024
119122
|
} else {
|
|
118025
119123
|
const error2 = createUnvalidatedWebSocketError("unclean close", code2, reason);
|
|
118026
119124
|
(_b2 = __privateGet(this, _readableStreamController)) == null ? void 0 : _b2.error(error2);
|
|
118027
|
-
(_c = __privateGet(this,
|
|
119125
|
+
(_c = __privateGet(this, _writableStreamController)) == null ? void 0 : _c.error(error2);
|
|
118028
119126
|
__privateGet(this, _closedPromise).reject(error2);
|
|
118029
119127
|
}
|
|
118030
119128
|
};
|
|
@@ -118118,6 +119216,40 @@ function requireEventsourceStream() {
|
|
|
118118
119216
|
const CR = 13;
|
|
118119
119217
|
const COLON = 58;
|
|
118120
119218
|
const SPACE = 32;
|
|
119219
|
+
const DATA = Buffer.from("data");
|
|
119220
|
+
const EVENT = Buffer.from("event");
|
|
119221
|
+
const ID2 = Buffer.from("id");
|
|
119222
|
+
const RETRY2 = Buffer.from("retry");
|
|
119223
|
+
function isASCIINumberBytes(buffer2, start2) {
|
|
119224
|
+
if (start2 >= buffer2.length) {
|
|
119225
|
+
return false;
|
|
119226
|
+
}
|
|
119227
|
+
for (let i = start2; i < buffer2.length; i++) {
|
|
119228
|
+
if (buffer2[i] < 48 || buffer2[i] > 57) {
|
|
119229
|
+
return false;
|
|
119230
|
+
}
|
|
119231
|
+
}
|
|
119232
|
+
return true;
|
|
119233
|
+
}
|
|
119234
|
+
function isValidLastEventIdBytes(buffer2, start2) {
|
|
119235
|
+
for (let i = start2; i < buffer2.length; i++) {
|
|
119236
|
+
if (buffer2[i] === 0) {
|
|
119237
|
+
return false;
|
|
119238
|
+
}
|
|
119239
|
+
}
|
|
119240
|
+
return true;
|
|
119241
|
+
}
|
|
119242
|
+
function isFieldName(line, length, field) {
|
|
119243
|
+
if (length !== field.length) {
|
|
119244
|
+
return false;
|
|
119245
|
+
}
|
|
119246
|
+
for (let i = 0; i < length; i++) {
|
|
119247
|
+
if (line[i] !== field[i]) {
|
|
119248
|
+
return false;
|
|
119249
|
+
}
|
|
119250
|
+
}
|
|
119251
|
+
return true;
|
|
119252
|
+
}
|
|
118121
119253
|
class EventSourceStream extends Transform2 {
|
|
118122
119254
|
/**
|
|
118123
119255
|
* @param {object} options
|
|
@@ -118146,10 +119278,13 @@ function requireEventsourceStream() {
|
|
|
118146
119278
|
*/
|
|
118147
119279
|
__publicField(this, "eventEndCheck", false);
|
|
118148
119280
|
/**
|
|
118149
|
-
* @type {Buffer
|
|
119281
|
+
* @type {Buffer[]}
|
|
118150
119282
|
*/
|
|
118151
|
-
__publicField(this, "
|
|
119283
|
+
__publicField(this, "chunks", []);
|
|
119284
|
+
__publicField(this, "chunkIndex", 0);
|
|
118152
119285
|
__publicField(this, "pos", 0);
|
|
119286
|
+
__publicField(this, "lineChunkIndex", 0);
|
|
119287
|
+
__publicField(this, "linePos", 0);
|
|
118153
119288
|
__publicField(this, "event", {
|
|
118154
119289
|
data: void 0,
|
|
118155
119290
|
event: void 0,
|
|
@@ -118172,63 +119307,30 @@ function requireEventsourceStream() {
|
|
|
118172
119307
|
callback();
|
|
118173
119308
|
return;
|
|
118174
119309
|
}
|
|
118175
|
-
|
|
118176
|
-
this.buffer = Buffer.concat([this.buffer, chunk]);
|
|
118177
|
-
} else {
|
|
118178
|
-
this.buffer = chunk;
|
|
118179
|
-
}
|
|
119310
|
+
this.chunks.push(chunk);
|
|
118180
119311
|
if (this.checkBOM) {
|
|
118181
|
-
|
|
118182
|
-
|
|
118183
|
-
|
|
118184
|
-
callback();
|
|
118185
|
-
return;
|
|
118186
|
-
}
|
|
118187
|
-
this.checkBOM = false;
|
|
118188
|
-
callback();
|
|
118189
|
-
return;
|
|
118190
|
-
case 2:
|
|
118191
|
-
if (this.buffer[0] === BOM[0] && this.buffer[1] === BOM[1]) {
|
|
118192
|
-
callback();
|
|
118193
|
-
return;
|
|
118194
|
-
}
|
|
118195
|
-
this.checkBOM = false;
|
|
118196
|
-
break;
|
|
118197
|
-
case 3:
|
|
118198
|
-
if (this.buffer[0] === BOM[0] && this.buffer[1] === BOM[1] && this.buffer[2] === BOM[2]) {
|
|
118199
|
-
this.buffer = Buffer.alloc(0);
|
|
118200
|
-
this.checkBOM = false;
|
|
118201
|
-
callback();
|
|
118202
|
-
return;
|
|
118203
|
-
}
|
|
118204
|
-
this.checkBOM = false;
|
|
118205
|
-
break;
|
|
118206
|
-
default:
|
|
118207
|
-
if (this.buffer[0] === BOM[0] && this.buffer[1] === BOM[1] && this.buffer[2] === BOM[2]) {
|
|
118208
|
-
this.buffer = this.buffer.subarray(3);
|
|
118209
|
-
}
|
|
118210
|
-
this.checkBOM = false;
|
|
118211
|
-
break;
|
|
119312
|
+
if (this.handleBOM()) {
|
|
119313
|
+
callback();
|
|
119314
|
+
return;
|
|
118212
119315
|
}
|
|
118213
119316
|
}
|
|
118214
|
-
while (this.
|
|
119317
|
+
while (this.hasCurrentByte()) {
|
|
119318
|
+
const byte = this.currentByte();
|
|
118215
119319
|
if (this.eventEndCheck) {
|
|
118216
119320
|
if (this.crlfCheck) {
|
|
118217
|
-
if (
|
|
118218
|
-
this.buffer = this.buffer.subarray(this.pos + 1);
|
|
118219
|
-
this.pos = 0;
|
|
119321
|
+
if (byte === LF) {
|
|
118220
119322
|
this.crlfCheck = false;
|
|
119323
|
+
this.consumeCurrentByte();
|
|
118221
119324
|
continue;
|
|
118222
119325
|
}
|
|
118223
119326
|
this.crlfCheck = false;
|
|
118224
119327
|
}
|
|
118225
|
-
if (
|
|
118226
|
-
if (
|
|
119328
|
+
if (byte === LF || byte === CR) {
|
|
119329
|
+
if (byte === CR) {
|
|
118227
119330
|
this.crlfCheck = true;
|
|
118228
119331
|
}
|
|
118229
|
-
this.
|
|
118230
|
-
this.
|
|
118231
|
-
if (this.event.data !== void 0 || this.event.event || this.event.id !== void 0 || this.event.retry) {
|
|
119332
|
+
this.consumeCurrentByte();
|
|
119333
|
+
if (this.hasPendingEvent()) {
|
|
118232
119334
|
this.processEvent(this.event);
|
|
118233
119335
|
}
|
|
118234
119336
|
this.clearEvent();
|
|
@@ -118237,17 +119339,16 @@ function requireEventsourceStream() {
|
|
|
118237
119339
|
this.eventEndCheck = false;
|
|
118238
119340
|
continue;
|
|
118239
119341
|
}
|
|
118240
|
-
if (
|
|
118241
|
-
if (
|
|
119342
|
+
if (byte === LF || byte === CR) {
|
|
119343
|
+
if (byte === CR) {
|
|
118242
119344
|
this.crlfCheck = true;
|
|
118243
119345
|
}
|
|
118244
|
-
this.parseLine(this.
|
|
118245
|
-
this.
|
|
118246
|
-
this.pos = 0;
|
|
119346
|
+
this.parseLine(this.readLine(), this.event);
|
|
119347
|
+
this.consumeCurrentByte();
|
|
118247
119348
|
this.eventEndCheck = true;
|
|
118248
119349
|
continue;
|
|
118249
119350
|
}
|
|
118250
|
-
this.
|
|
119351
|
+
this.advanceCursor();
|
|
118251
119352
|
}
|
|
118252
119353
|
callback();
|
|
118253
119354
|
}
|
|
@@ -118263,43 +119364,42 @@ function requireEventsourceStream() {
|
|
|
118263
119364
|
if (colonPosition === 0) {
|
|
118264
119365
|
return;
|
|
118265
119366
|
}
|
|
118266
|
-
let
|
|
118267
|
-
let
|
|
119367
|
+
let fieldLength = line.length;
|
|
119368
|
+
let valueStart = line.length;
|
|
118268
119369
|
if (colonPosition !== -1) {
|
|
118269
|
-
|
|
118270
|
-
|
|
119370
|
+
fieldLength = colonPosition;
|
|
119371
|
+
valueStart = colonPosition + 1;
|
|
118271
119372
|
if (line[valueStart] === SPACE) {
|
|
118272
119373
|
++valueStart;
|
|
118273
119374
|
}
|
|
118274
|
-
value = line.subarray(valueStart).toString("utf8");
|
|
118275
|
-
} else {
|
|
118276
|
-
field = line.toString("utf8");
|
|
118277
|
-
value = "";
|
|
118278
119375
|
}
|
|
118279
|
-
|
|
118280
|
-
|
|
118281
|
-
|
|
118282
|
-
|
|
118283
|
-
|
|
118284
|
-
|
|
119376
|
+
if (isFieldName(line, fieldLength, DATA)) {
|
|
119377
|
+
const value = line.toString("utf8", valueStart);
|
|
119378
|
+
if (event.data === void 0) {
|
|
119379
|
+
event.data = value;
|
|
119380
|
+
} else {
|
|
119381
|
+
event.data += `
|
|
118285
119382
|
${value}`;
|
|
118286
|
-
|
|
118287
|
-
|
|
118288
|
-
|
|
118289
|
-
|
|
118290
|
-
|
|
118291
|
-
|
|
118292
|
-
|
|
118293
|
-
|
|
118294
|
-
|
|
118295
|
-
|
|
118296
|
-
|
|
118297
|
-
|
|
118298
|
-
|
|
118299
|
-
|
|
118300
|
-
|
|
118301
|
-
|
|
118302
|
-
|
|
119383
|
+
}
|
|
119384
|
+
return;
|
|
119385
|
+
}
|
|
119386
|
+
if (isFieldName(line, fieldLength, RETRY2)) {
|
|
119387
|
+
if (isASCIINumberBytes(line, valueStart)) {
|
|
119388
|
+
event.retry = line.toString("utf8", valueStart);
|
|
119389
|
+
}
|
|
119390
|
+
return;
|
|
119391
|
+
}
|
|
119392
|
+
if (isFieldName(line, fieldLength, ID2)) {
|
|
119393
|
+
if (isValidLastEventIdBytes(line, valueStart)) {
|
|
119394
|
+
event.id = line.toString("utf8", valueStart);
|
|
119395
|
+
}
|
|
119396
|
+
return;
|
|
119397
|
+
}
|
|
119398
|
+
if (isFieldName(line, fieldLength, EVENT)) {
|
|
119399
|
+
const value = line.toString("utf8", valueStart);
|
|
119400
|
+
if (value.length > 0) {
|
|
119401
|
+
event.event = value;
|
|
119402
|
+
}
|
|
118303
119403
|
}
|
|
118304
119404
|
}
|
|
118305
119405
|
/**
|
|
@@ -118324,12 +119424,120 @@ ${value}`;
|
|
|
118324
119424
|
}
|
|
118325
119425
|
}
|
|
118326
119426
|
clearEvent() {
|
|
118327
|
-
this.event =
|
|
118328
|
-
|
|
118329
|
-
|
|
118330
|
-
|
|
118331
|
-
|
|
118332
|
-
|
|
119427
|
+
this.event.data = void 0;
|
|
119428
|
+
this.event.event = void 0;
|
|
119429
|
+
this.event.id = void 0;
|
|
119430
|
+
this.event.retry = void 0;
|
|
119431
|
+
}
|
|
119432
|
+
hasPendingEvent() {
|
|
119433
|
+
return this.event.data !== void 0 || this.event.event !== void 0 || this.event.id !== void 0 || this.event.retry !== void 0;
|
|
119434
|
+
}
|
|
119435
|
+
hasCurrentByte() {
|
|
119436
|
+
return this.chunkIndex < this.chunks.length && this.pos < this.chunks[this.chunkIndex].length;
|
|
119437
|
+
}
|
|
119438
|
+
currentByte() {
|
|
119439
|
+
return this.chunks[this.chunkIndex][this.pos];
|
|
119440
|
+
}
|
|
119441
|
+
consumeCurrentByte() {
|
|
119442
|
+
this.advanceCursor();
|
|
119443
|
+
this.syncLineStartToCursor();
|
|
119444
|
+
}
|
|
119445
|
+
advanceCursor() {
|
|
119446
|
+
this.pos++;
|
|
119447
|
+
while (this.chunkIndex < this.chunks.length && this.pos >= this.chunks[this.chunkIndex].length) {
|
|
119448
|
+
this.chunkIndex++;
|
|
119449
|
+
this.pos = 0;
|
|
119450
|
+
}
|
|
119451
|
+
}
|
|
119452
|
+
syncLineStartToCursor() {
|
|
119453
|
+
this.lineChunkIndex = this.chunkIndex;
|
|
119454
|
+
this.linePos = this.pos;
|
|
119455
|
+
this.dropConsumedChunks();
|
|
119456
|
+
}
|
|
119457
|
+
dropConsumedChunks() {
|
|
119458
|
+
while (this.lineChunkIndex > 0) {
|
|
119459
|
+
this.chunks.shift();
|
|
119460
|
+
this.lineChunkIndex--;
|
|
119461
|
+
this.chunkIndex--;
|
|
119462
|
+
}
|
|
119463
|
+
if (this.chunkIndex === this.chunks.length) {
|
|
119464
|
+
this.chunks.length = 0;
|
|
119465
|
+
this.chunkIndex = 0;
|
|
119466
|
+
this.pos = 0;
|
|
119467
|
+
this.lineChunkIndex = 0;
|
|
119468
|
+
this.linePos = 0;
|
|
119469
|
+
}
|
|
119470
|
+
}
|
|
119471
|
+
readLine() {
|
|
119472
|
+
if (this.lineChunkIndex === this.chunkIndex) {
|
|
119473
|
+
return this.chunks[this.chunkIndex].subarray(this.linePos, this.pos);
|
|
119474
|
+
}
|
|
119475
|
+
const chunks = [];
|
|
119476
|
+
let length = 0;
|
|
119477
|
+
for (let i = this.lineChunkIndex; i <= this.chunkIndex; i++) {
|
|
119478
|
+
const chunk = this.chunks[i];
|
|
119479
|
+
const start2 = i === this.lineChunkIndex ? this.linePos : 0;
|
|
119480
|
+
const end = i === this.chunkIndex ? this.pos : chunk.length;
|
|
119481
|
+
const slice = chunk.subarray(start2, end);
|
|
119482
|
+
length += slice.length;
|
|
119483
|
+
chunks.push(slice);
|
|
119484
|
+
}
|
|
119485
|
+
return Buffer.concat(chunks, length);
|
|
119486
|
+
}
|
|
119487
|
+
peekBufferedByte(offset2) {
|
|
119488
|
+
let chunkIndex = this.lineChunkIndex;
|
|
119489
|
+
let pos = this.linePos;
|
|
119490
|
+
while (chunkIndex < this.chunks.length) {
|
|
119491
|
+
const chunk = this.chunks[chunkIndex];
|
|
119492
|
+
const remaining = chunk.length - pos;
|
|
119493
|
+
if (offset2 < remaining) {
|
|
119494
|
+
return chunk[pos + offset2];
|
|
119495
|
+
}
|
|
119496
|
+
offset2 -= remaining;
|
|
119497
|
+
chunkIndex++;
|
|
119498
|
+
pos = 0;
|
|
119499
|
+
}
|
|
119500
|
+
}
|
|
119501
|
+
discardLeadingBytes(count2) {
|
|
119502
|
+
while (count2 > 0 && this.lineChunkIndex < this.chunks.length) {
|
|
119503
|
+
const chunk = this.chunks[this.lineChunkIndex];
|
|
119504
|
+
const remaining = chunk.length - this.linePos;
|
|
119505
|
+
if (count2 < remaining) {
|
|
119506
|
+
this.linePos += count2;
|
|
119507
|
+
count2 = 0;
|
|
119508
|
+
} else {
|
|
119509
|
+
count2 -= remaining;
|
|
119510
|
+
this.lineChunkIndex++;
|
|
119511
|
+
this.linePos = 0;
|
|
119512
|
+
}
|
|
119513
|
+
}
|
|
119514
|
+
this.chunkIndex = this.lineChunkIndex;
|
|
119515
|
+
this.pos = this.linePos;
|
|
119516
|
+
this.dropConsumedChunks();
|
|
119517
|
+
}
|
|
119518
|
+
handleBOM() {
|
|
119519
|
+
const first = this.peekBufferedByte(0);
|
|
119520
|
+
const second = this.peekBufferedByte(1);
|
|
119521
|
+
const third = this.peekBufferedByte(2);
|
|
119522
|
+
if (second === void 0) {
|
|
119523
|
+
if (first === BOM[0]) {
|
|
119524
|
+
return true;
|
|
119525
|
+
}
|
|
119526
|
+
this.checkBOM = false;
|
|
119527
|
+
return true;
|
|
119528
|
+
}
|
|
119529
|
+
if (third === void 0) {
|
|
119530
|
+
if (first === BOM[0] && second === BOM[1]) {
|
|
119531
|
+
return true;
|
|
119532
|
+
}
|
|
119533
|
+
this.checkBOM = false;
|
|
119534
|
+
return false;
|
|
119535
|
+
}
|
|
119536
|
+
if (first === BOM[0] && second === BOM[1] && third === BOM[2]) {
|
|
119537
|
+
this.discardLeadingBytes(3);
|
|
119538
|
+
}
|
|
119539
|
+
this.checkBOM = false;
|
|
119540
|
+
return !this.hasCurrentByte();
|
|
118333
119541
|
}
|
|
118334
119542
|
}
|
|
118335
119543
|
eventsourceStream = {
|
|
@@ -120753,7 +121961,7 @@ function createLocalWorld(args) {
|
|
|
120753
121961
|
const basedir = mergedConfig.dataDir;
|
|
120754
121962
|
const hooksDir = path$3.join(basedir, "hooks");
|
|
120755
121963
|
const taggedHookFiles = await listTaggedFiles(hooksDir, tag);
|
|
120756
|
-
const { HookSchema: HookSchema2 } = await import("./index-
|
|
121964
|
+
const { HookSchema: HookSchema2 } = await import("./index-D_AI8hkf.js");
|
|
120757
121965
|
await Promise.all(taggedHookFiles.map(async (hookFile) => {
|
|
120758
121966
|
const hook = await readJSON(path$3.join(hooksDir, hookFile), HookSchema2);
|
|
120759
121967
|
if (hook == null ? void 0 : hook.token) {
|
|
@@ -120940,6 +122148,12 @@ function getRetryAgentOptions() {
|
|
|
120940
122148
|
maxRetries: MAX_RETRIES
|
|
120941
122149
|
};
|
|
120942
122150
|
}
|
|
122151
|
+
function getEventsRetryAgentOptions() {
|
|
122152
|
+
return {
|
|
122153
|
+
...getRetryAgentOptions(),
|
|
122154
|
+
errorCodes: [...RETRY_ERROR_CODES, "ERR_HTTP2_STREAM_ERROR"]
|
|
122155
|
+
};
|
|
122156
|
+
}
|
|
120943
122157
|
const STREAM_RETRY_OPTIONS = {
|
|
120944
122158
|
retryAfter: true,
|
|
120945
122159
|
methods: ["PUT"],
|
|
@@ -120962,14 +122176,17 @@ function contentLength(headers2) {
|
|
|
120962
122176
|
const raw2 = record2["content-length"] ?? record2["Content-Length"];
|
|
120963
122177
|
return typeof raw2 === "string" || typeof raw2 === "number" ? Number(raw2) : Number.NaN;
|
|
120964
122178
|
}
|
|
120965
|
-
function
|
|
120966
|
-
return (opts, handler) => {
|
|
122179
|
+
function createH2MultiplexInterceptor(fallback) {
|
|
122180
|
+
return (dispatch2) => (opts, handler) => {
|
|
120967
122181
|
const body2 = opts.body;
|
|
120968
122182
|
const isAsyncIterable = !!body2 && typeof body2 !== "string" && !Buffer.isBuffer(body2) && typeof body2[Symbol.asyncIterator] === "function";
|
|
120969
122183
|
const length = contentLength(opts.headers);
|
|
120970
|
-
if (!isAsyncIterable
|
|
122184
|
+
if (!isAsyncIterable) {
|
|
120971
122185
|
return dispatch2({ ...opts, idempotent: true }, handler);
|
|
120972
122186
|
}
|
|
122187
|
+
if (!(length >= 0) || length > H2_REBUFFER_MAX_BYTES) {
|
|
122188
|
+
return fallback ? fallback.dispatch(opts, handler) : dispatch2({ ...opts, idempotent: true }, handler);
|
|
122189
|
+
}
|
|
120973
122190
|
void (async () => {
|
|
120974
122191
|
var _a3;
|
|
120975
122192
|
try {
|
|
@@ -120993,7 +122210,15 @@ const RECYCLABLE_ERROR_CODES = /* @__PURE__ */ new Set([
|
|
|
120993
122210
|
// Covers H2 stream timeout, frameError and GOAWAY (undici InformationalError).
|
|
120994
122211
|
"UND_ERR_INFO",
|
|
120995
122212
|
"UND_ERR_HEADERS_TIMEOUT",
|
|
120996
|
-
"UND_ERR_BODY_TIMEOUT"
|
|
122213
|
+
"UND_ERR_BODY_TIMEOUT",
|
|
122214
|
+
// Node can surface these directly instead of undici's UND_ERR_INFO. Once
|
|
122215
|
+
// repeated, retire the pool even when classification used its fallback.
|
|
122216
|
+
// Keep this scoped to session/stream failures: ERR_HTTP2_* also contains
|
|
122217
|
+
// request-validation and caller-cancellation errors a new pool cannot fix.
|
|
122218
|
+
"ERR_HTTP2_GOAWAY_SESSION",
|
|
122219
|
+
"ERR_HTTP2_INVALID_SESSION",
|
|
122220
|
+
"ERR_HTTP2_SESSION_ERROR",
|
|
122221
|
+
"ERR_HTTP2_STREAM_ERROR"
|
|
120997
122222
|
]);
|
|
120998
122223
|
const MAX_CAUSE_DEPTH = 8;
|
|
120999
122224
|
function isRecyclableTransportError(error2) {
|
|
@@ -121095,15 +122320,27 @@ function createEventsDispatcher(agentOverrides) {
|
|
|
121095
122320
|
const agent2 = new undiciExports.RetryAgent(new undiciExports.Agent({
|
|
121096
122321
|
...h2 ? getEventsAgentOptions() : getEventsAgentOptionsNoH2(),
|
|
121097
122322
|
...agentOverrides
|
|
121098
|
-
}),
|
|
122323
|
+
}), getEventsRetryAgentOptions());
|
|
121099
122324
|
if (!h2) {
|
|
121100
122325
|
return agent2;
|
|
121101
122326
|
}
|
|
121102
|
-
|
|
122327
|
+
const streamedBodyAgent = new undiciExports.RetryAgent(new undiciExports.Agent({ ...getEventsAgentOptionsNoH2(), ...agentOverrides }), getEventsRetryAgentOptions());
|
|
122328
|
+
return withBoundLifecycle(agent2, agent2.compose(createH2MultiplexInterceptor(streamedBodyAgent)), streamedBodyAgent);
|
|
121103
122329
|
}
|
|
121104
|
-
function withBoundLifecycle(agent2, composed) {
|
|
122330
|
+
function withBoundLifecycle(agent2, composed, companion) {
|
|
121105
122331
|
return new Proxy(composed, {
|
|
121106
|
-
get: (target2, key) =>
|
|
122332
|
+
get: (target2, key) => {
|
|
122333
|
+
if (key !== "close" && key !== "destroy") {
|
|
122334
|
+
return target2[key];
|
|
122335
|
+
}
|
|
122336
|
+
const own2 = agent2[key].bind(agent2);
|
|
122337
|
+
if (!companion)
|
|
122338
|
+
return own2;
|
|
122339
|
+
const other = companion[key].bind(companion);
|
|
122340
|
+
return async (...args) => {
|
|
122341
|
+
await Promise.all([own2(...args), other(...args)]);
|
|
122342
|
+
};
|
|
122343
|
+
}
|
|
121107
122344
|
});
|
|
121108
122345
|
}
|
|
121109
122346
|
function createStreamDispatcher(retryOptions, agentOverrides) {
|
|
@@ -121246,8 +122483,8 @@ function requireGetVercelOidcToken() {
|
|
|
121246
122483
|
}
|
|
121247
122484
|
try {
|
|
121248
122485
|
const [{ getTokenPayload, isExpired }, { refreshToken }] = await Promise.all([
|
|
121249
|
-
await import("./token-util-
|
|
121250
|
-
await import("./token-
|
|
122486
|
+
await import("./token-util-BcXLU8tX.js").then((n) => n.t),
|
|
122487
|
+
await import("./token-CiFjsKMS.js").then((n) => n.t)
|
|
121251
122488
|
]);
|
|
121252
122489
|
if (!token || isExpired(getTokenPayload(token), options == null ? void 0 : options.expirationBufferMs)) {
|
|
121253
122490
|
await refreshToken(options);
|
|
@@ -121911,6 +123148,51 @@ function getTransientTransportCode(error2) {
|
|
|
121911
123148
|
}
|
|
121912
123149
|
return void 0;
|
|
121913
123150
|
}
|
|
123151
|
+
function validateHttpUrl(url2) {
|
|
123152
|
+
const { protocol, username, password } = new URL(url2);
|
|
123153
|
+
if (protocol !== "http:" && protocol !== "https:") {
|
|
123154
|
+
throw new TypeError(`Unsupported URL protocol ${protocol}; expected http: or https:`);
|
|
123155
|
+
}
|
|
123156
|
+
if (username || password) {
|
|
123157
|
+
throw new TypeError("HTTP(S) URLs with embedded credentials are unsupported");
|
|
123158
|
+
}
|
|
123159
|
+
}
|
|
123160
|
+
const REQUEST_CONSTRUCTION_ERROR_CODES = /* @__PURE__ */ new Set([
|
|
123161
|
+
"ERR_INVALID_URL",
|
|
123162
|
+
"ERR_INVALID_ARG_TYPE",
|
|
123163
|
+
"ERR_INVALID_ARG_VALUE",
|
|
123164
|
+
"ERR_INVALID_CHAR",
|
|
123165
|
+
"ERR_INVALID_HTTP_TOKEN",
|
|
123166
|
+
"ERR_HTTP_INVALID_HEADER_VALUE",
|
|
123167
|
+
"ERR_UNESCAPED_CHARACTERS",
|
|
123168
|
+
// Undici validates request options and headers during dispatch, after
|
|
123169
|
+
// Fetch has constructed the Request (e.g. unsupported Expect headers).
|
|
123170
|
+
"UND_ERR_INVALID_ARG",
|
|
123171
|
+
"UND_ERR_NOT_SUPPORTED"
|
|
123172
|
+
]);
|
|
123173
|
+
function describeTransportFailure(error2) {
|
|
123174
|
+
const known = getTransientTransportCode(error2);
|
|
123175
|
+
if (known)
|
|
123176
|
+
return known;
|
|
123177
|
+
let firstCode;
|
|
123178
|
+
let innermostName;
|
|
123179
|
+
let current = error2;
|
|
123180
|
+
for (let depth = 0; current && depth < 8; depth++) {
|
|
123181
|
+
const { code: code2, name: name2, message: message2 } = current;
|
|
123182
|
+
if (name2 === "Error" && message2 === "bad port" && code2 === void 0) {
|
|
123183
|
+
return void 0;
|
|
123184
|
+
}
|
|
123185
|
+
if (typeof code2 === "string" && code2) {
|
|
123186
|
+
if (REQUEST_CONSTRUCTION_ERROR_CODES.has(code2))
|
|
123187
|
+
return void 0;
|
|
123188
|
+
firstCode ?? (firstCode = code2);
|
|
123189
|
+
}
|
|
123190
|
+
if (typeof name2 === "string" && name2)
|
|
123191
|
+
innermostName = name2;
|
|
123192
|
+
current = current.cause;
|
|
123193
|
+
}
|
|
123194
|
+
return firstCode ?? innermostName ?? "unknown";
|
|
123195
|
+
}
|
|
121914
123196
|
const HTTP_DEBUG_ENABLED = typeof process !== "undefined" && typeof process.env.DEBUG === "string" && (process.env.DEBUG.includes("workflow:") || process.env.DEBUG === "*");
|
|
121915
123197
|
const DIAGNOSTIC_HEADERS = [
|
|
121916
123198
|
"x-vercel-id",
|
|
@@ -122003,6 +123285,7 @@ function httpClientSpanAttributes(args) {
|
|
|
122003
123285
|
async function instrumentedFetch(opts) {
|
|
122004
123286
|
const { method, url: url2, headers: headers2, body: body2, dispatcher: dispatcher2, peerService = "workflow-server", timeoutMs = REQUEST_TIMEOUT_MS, signal: callerSignal, injectTraceContext = true, cacheBust = true, logLabel, buildError, onTransportOutcome, deferTransportSuccessUntilBody = false } = opts;
|
|
122005
123287
|
const label = logLabel ?? url2;
|
|
123288
|
+
validateHttpUrl(url2);
|
|
122006
123289
|
return trace(`http ${method}`, { kind: await getSpanKind("CLIENT") }, async (span) => {
|
|
122007
123290
|
var _a3, _b2, _c, _d, _e2;
|
|
122008
123291
|
span == null ? void 0 : span.setAttributes(httpClientSpanAttributes({ method, url: url2, peerService }));
|
|
@@ -122012,13 +123295,13 @@ async function instrumentedFetch(opts) {
|
|
|
122012
123295
|
headers2.set("X-Request-Time", Date.now().toString());
|
|
122013
123296
|
const timeoutSignal = timeoutMs != null ? AbortSignal.timeout(timeoutMs) : void 0;
|
|
122014
123297
|
const signal = callerSignal && timeoutSignal ? AbortSignal.any([callerSignal, timeoutSignal]) : callerSignal ?? timeoutSignal;
|
|
123298
|
+
const nodeAgents = dispatcher2 ? void 0 : getNodeHttpAgents();
|
|
123299
|
+
span == null ? void 0 : span.setAttributes({
|
|
123300
|
+
...WorkflowHttpTransport(nodeAgents ? "node-http" : "undici")
|
|
123301
|
+
});
|
|
122015
123302
|
const start2 = Date.now();
|
|
122016
123303
|
let response2;
|
|
122017
123304
|
try {
|
|
122018
|
-
const nodeAgents = dispatcher2 ? void 0 : getNodeHttpAgents();
|
|
122019
|
-
span == null ? void 0 : span.setAttributes({
|
|
122020
|
-
...WorkflowHttpTransport(nodeAgents ? "node-http" : "undici")
|
|
122021
|
-
});
|
|
122022
123305
|
response2 = nodeAgents ? await nodeHttpFetch(url2, {
|
|
122023
123306
|
method,
|
|
122024
123307
|
headers: headers2,
|
|
@@ -122047,7 +123330,7 @@ async function instrumentedFetch(opts) {
|
|
|
122047
123330
|
(_a3 = span == null ? void 0 : span.recordException) == null ? void 0 : _a3.call(span, timeoutError);
|
|
122048
123331
|
throw timeoutError;
|
|
122049
123332
|
}
|
|
122050
|
-
const transportCode =
|
|
123333
|
+
const transportCode = describeTransportFailure(error2);
|
|
122051
123334
|
if (transportCode) {
|
|
122052
123335
|
const transportError2 = new WorkflowWorldError(`${method} ${label} transport failure after ${elapsed}ms (${transportCode})`, { url: url2, code: "TRANSPORT", cause: error2 });
|
|
122053
123336
|
span == null ? void 0 : span.setAttributes({ ...ErrorType("TRANSPORT") });
|
|
@@ -126793,7 +128076,7 @@ var QueueClient = class {
|
|
|
126793
128076
|
setApi(this, new ApiClient({ ...options, region }));
|
|
126794
128077
|
}
|
|
126795
128078
|
};
|
|
126796
|
-
const version = "4.7.
|
|
128079
|
+
const version = "4.7.5";
|
|
126797
128080
|
const IDEMPOTENT_METHODS = /* @__PURE__ */ new Set(["GET", "HEAD"]);
|
|
126798
128081
|
const MAX_BODY_PARSE_RETRIES = 2;
|
|
126799
128082
|
const BODY_PARSE_RETRY_BASE_MS = 100;
|
|
@@ -126904,6 +128187,7 @@ async function makeRequest({ endpoint, options = {}, config: config2 = {}, schem
|
|
|
126904
128187
|
const method = (options.method || "GET").toUpperCase();
|
|
126905
128188
|
const { baseUrl, headers: headers2 } = await getHttpConfig(config2);
|
|
126906
128189
|
const url2 = `${baseUrl}${endpoint}`;
|
|
128190
|
+
validateHttpUrl(url2);
|
|
126907
128191
|
return trace(`http ${method}`, { kind: await getSpanKind("CLIENT") }, async (span) => {
|
|
126908
128192
|
var _a3, _b2, _c;
|
|
126909
128193
|
span == null ? void 0 : span.setAttributes(httpClientSpanAttributes({
|
|
@@ -126925,13 +128209,15 @@ async function makeRequest({ endpoint, options = {}, config: config2 = {}, schem
|
|
|
126925
128209
|
headers2.set("X-Request-Time", Date.now().toString());
|
|
126926
128210
|
const timeoutSignal = AbortSignal.timeout(REQUEST_TIMEOUT_MS);
|
|
126927
128211
|
const signal = options.signal ? AbortSignal.any([options.signal, timeoutSignal]) : timeoutSignal;
|
|
128212
|
+
const nodeAgents = getNodeHttpAgents(config2);
|
|
128213
|
+
const undiciRequest = nodeAgents ? void 0 : new Request(url2, { ...options, body: body2, headers: headers2, signal });
|
|
128214
|
+
const undiciDispatcher = nodeAgents ? void 0 : getDispatcher(config2);
|
|
128215
|
+
span == null ? void 0 : span.setAttributes({
|
|
128216
|
+
...WorkflowHttpTransport(nodeAgents ? "node-http" : "undici")
|
|
128217
|
+
});
|
|
126928
128218
|
const fetchStart = Date.now();
|
|
126929
128219
|
let response2;
|
|
126930
128220
|
try {
|
|
126931
|
-
const nodeAgents = getNodeHttpAgents(config2);
|
|
126932
|
-
span == null ? void 0 : span.setAttributes({
|
|
126933
|
-
...WorkflowHttpTransport(nodeAgents ? "node-http" : "undici")
|
|
126934
|
-
});
|
|
126935
128221
|
response2 = nodeAgents ? await nodeHttpFetch(url2, {
|
|
126936
128222
|
method,
|
|
126937
128223
|
headers: headers2,
|
|
@@ -126942,9 +128228,9 @@ async function makeRequest({ endpoint, options = {}, config: config2 = {}, schem
|
|
|
126942
128228
|
// with: without these the node:http path arms no stalled-socket
|
|
126943
128229
|
// deadline.
|
|
126944
128230
|
...getNodeHttpPhaseTimeouts()
|
|
126945
|
-
}) : await fetch(
|
|
128231
|
+
}) : await fetch(undiciRequest, {
|
|
126946
128232
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- undici v7 dispatcher types don't match @types/node's RequestInit
|
|
126947
|
-
dispatcher:
|
|
128233
|
+
dispatcher: undiciDispatcher
|
|
126948
128234
|
});
|
|
126949
128235
|
} catch (error2) {
|
|
126950
128236
|
const elapsed = Date.now() - fetchStart;
|
|
@@ -126954,7 +128240,7 @@ async function makeRequest({ endpoint, options = {}, config: config2 = {}, schem
|
|
|
126954
128240
|
(_a3 = span == null ? void 0 : span.recordException) == null ? void 0 : _a3.call(span, timeoutError);
|
|
126955
128241
|
throw timeoutError;
|
|
126956
128242
|
}
|
|
126957
|
-
const transportCode =
|
|
128243
|
+
const transportCode = describeTransportFailure(error2);
|
|
126958
128244
|
if (transportCode) {
|
|
126959
128245
|
if (retryConnectTimeout && canRetryRead && transportCode === "UND_ERR_CONNECT_TIMEOUT" && attempt === 0) {
|
|
126960
128246
|
await new Promise((resolve2) => setTimeout(resolve2, BODY_PARSE_RETRY_BASE_MS));
|
|
@@ -127607,7 +128893,7 @@ async function fetchV4(url2, init2, config2, opName) {
|
|
|
127607
128893
|
}
|
|
127608
128894
|
} catch (cause) {
|
|
127609
128895
|
noteEventsTransportOutcome(dispatcher2, cause);
|
|
127610
|
-
const transportCode =
|
|
128896
|
+
const transportCode = describeTransportFailure(cause);
|
|
127611
128897
|
controller.error(transportCode ? new WorkflowWorldError(`v4 ${opName}: response stream transport failure (${transportCode})`, { url: url2, code: "TRANSPORT", cause }) : cause);
|
|
127612
128898
|
}
|
|
127613
128899
|
},
|
|
@@ -128615,10 +129901,10 @@ const getWorld = () => {
|
|
|
128615
129901
|
return globalSymbols$1[WorldCache];
|
|
128616
129902
|
};
|
|
128617
129903
|
const DEFAULT_HEALTH_CHECK_TIMEOUT = 3e4;
|
|
128618
|
-
const SAFE_WORKFLOW_NAME_PATTERN = /^[a-zA-Z0-9_\-./@]+$/;
|
|
129904
|
+
const SAFE_WORKFLOW_NAME_PATTERN = /^[a-zA-Z0-9_\-./@()[\]]+$/;
|
|
128619
129905
|
function getWorkflowQueueName(workflowName, namespace2) {
|
|
128620
129906
|
if (!SAFE_WORKFLOW_NAME_PATTERN.test(workflowName)) {
|
|
128621
|
-
throw new Error(`Invalid workflow name "${workflowName}": must only contain alphanumeric characters, underscores, hyphens, dots, forward slashes, or
|
|
129907
|
+
throw new Error(`Invalid workflow name "${workflowName}": must only contain alphanumeric characters, underscores, hyphens, dots, forward slashes, at signs, parentheses, or square brackets`);
|
|
128622
129908
|
}
|
|
128623
129909
|
const prefix = getQueueTopicPrefix("workflow", resolveQueueNamespace(namespace2));
|
|
128624
129910
|
return `${prefix}${workflowName}`;
|
|
@@ -129340,12 +130626,22 @@ function createReconnectingFramedStream(runId, name2, startIndex) {
|
|
|
129340
130626
|
let reconnectCount = 0;
|
|
129341
130627
|
let totalReconnectCount = 0;
|
|
129342
130628
|
let reader;
|
|
130629
|
+
let canceled = false;
|
|
130630
|
+
let cancelReason;
|
|
129343
130631
|
let buffer2 = new Uint8Array(0);
|
|
129344
130632
|
async function connect2() {
|
|
130633
|
+
if (canceled)
|
|
130634
|
+
return false;
|
|
129345
130635
|
const world = getWorld();
|
|
129346
130636
|
const effectiveStartIndex = reconnectSupported ? currentStartIndex + consumedFrames : startIndex;
|
|
129347
130637
|
const stream = await world.readFromStream(name2, effectiveStartIndex);
|
|
130638
|
+
if (canceled) {
|
|
130639
|
+
await stream.cancel(cancelReason).catch(() => {
|
|
130640
|
+
});
|
|
130641
|
+
return false;
|
|
130642
|
+
}
|
|
129348
130643
|
reader = stream.getReader();
|
|
130644
|
+
return true;
|
|
129349
130645
|
}
|
|
129350
130646
|
async function isVerifiedComplete() {
|
|
129351
130647
|
try {
|
|
@@ -129357,11 +130653,15 @@ function createReconnectingFramedStream(runId, name2, startIndex) {
|
|
|
129357
130653
|
}
|
|
129358
130654
|
}
|
|
129359
130655
|
async function reconnect() {
|
|
130656
|
+
if (canceled)
|
|
130657
|
+
return false;
|
|
129360
130658
|
if (reader) {
|
|
129361
130659
|
await reader.cancel().catch(() => {
|
|
129362
130660
|
});
|
|
129363
130661
|
reader = void 0;
|
|
129364
130662
|
}
|
|
130663
|
+
if (canceled)
|
|
130664
|
+
return false;
|
|
129365
130665
|
currentStartIndex += consumedFrames;
|
|
129366
130666
|
consumedFrames = 0;
|
|
129367
130667
|
buffer2 = new Uint8Array(0);
|
|
@@ -129375,19 +130675,27 @@ function createReconnectingFramedStream(runId, name2, startIndex) {
|
|
|
129375
130675
|
throw new Error(`Stream "${name2}" exceeded maximum total reconnection attempts (${FRAMED_STREAM_MAX_TOTAL_RECONNECTS})`);
|
|
129376
130676
|
}
|
|
129377
130677
|
try {
|
|
129378
|
-
await connect2()
|
|
129379
|
-
|
|
130678
|
+
if (!await connect2())
|
|
130679
|
+
return false;
|
|
130680
|
+
return true;
|
|
129380
130681
|
} catch {
|
|
130682
|
+
if (canceled)
|
|
130683
|
+
return false;
|
|
129381
130684
|
}
|
|
129382
130685
|
}
|
|
129383
130686
|
}
|
|
129384
130687
|
return new ReadableStream({
|
|
129385
130688
|
pull: async (controller) => {
|
|
130689
|
+
if (canceled)
|
|
130690
|
+
return;
|
|
129386
130691
|
for (; ; ) {
|
|
129387
130692
|
if (!reader) {
|
|
129388
130693
|
try {
|
|
129389
|
-
await connect2()
|
|
130694
|
+
if (!await connect2())
|
|
130695
|
+
return;
|
|
129390
130696
|
} catch (err) {
|
|
130697
|
+
if (canceled)
|
|
130698
|
+
return;
|
|
129391
130699
|
controller.error(err);
|
|
129392
130700
|
return;
|
|
129393
130701
|
}
|
|
@@ -129396,23 +130704,32 @@ function createReconnectingFramedStream(runId, name2, startIndex) {
|
|
|
129396
130704
|
try {
|
|
129397
130705
|
result = await reader.read();
|
|
129398
130706
|
} catch (err) {
|
|
130707
|
+
if (canceled)
|
|
130708
|
+
return;
|
|
129399
130709
|
if (!reconnectSupported) {
|
|
129400
130710
|
controller.error(err);
|
|
129401
130711
|
return;
|
|
129402
130712
|
}
|
|
129403
130713
|
try {
|
|
129404
|
-
await reconnect()
|
|
130714
|
+
if (!await reconnect())
|
|
130715
|
+
return;
|
|
129405
130716
|
} catch (reconnectErr) {
|
|
129406
130717
|
controller.error(reconnectErr);
|
|
129407
130718
|
return;
|
|
129408
130719
|
}
|
|
129409
130720
|
continue;
|
|
129410
130721
|
}
|
|
130722
|
+
if (canceled)
|
|
130723
|
+
return;
|
|
129411
130724
|
if (result.done || !result.value) {
|
|
129412
130725
|
reader = void 0;
|
|
129413
|
-
|
|
130726
|
+
const verifiedComplete = !reconnectSupported || await isVerifiedComplete();
|
|
130727
|
+
if (canceled)
|
|
130728
|
+
return;
|
|
130729
|
+
if (!verifiedComplete) {
|
|
129414
130730
|
try {
|
|
129415
|
-
await reconnect()
|
|
130731
|
+
if (!await reconnect())
|
|
130732
|
+
return;
|
|
129416
130733
|
} catch (reconnectErr) {
|
|
129417
130734
|
controller.error(reconnectErr);
|
|
129418
130735
|
return;
|
|
@@ -129446,12 +130763,15 @@ function createReconnectingFramedStream(runId, name2, startIndex) {
|
|
|
129446
130763
|
}
|
|
129447
130764
|
}
|
|
129448
130765
|
},
|
|
129449
|
-
cancel: async () => {
|
|
129450
|
-
|
|
129451
|
-
|
|
130766
|
+
cancel: async (reason) => {
|
|
130767
|
+
canceled = true;
|
|
130768
|
+
cancelReason = reason;
|
|
130769
|
+
const currentReader = reader;
|
|
130770
|
+
reader = void 0;
|
|
130771
|
+
if (currentReader) {
|
|
130772
|
+
await currentReader.cancel(reason).catch((err) => {
|
|
129452
130773
|
console.warn("Error closing ReadableStream reader:", err);
|
|
129453
130774
|
});
|
|
129454
|
-
reader = void 0;
|
|
129455
130775
|
}
|
|
129456
130776
|
}
|
|
129457
130777
|
});
|
|
@@ -129554,6 +130874,23 @@ function getCommonReducers(global2 = globalThis) {
|
|
|
129554
130874
|
BigInt: (value) => typeof value === "bigint" && value.toString(),
|
|
129555
130875
|
BigInt64Array: (value) => value instanceof global2.BigInt64Array && viewToBase64(value),
|
|
129556
130876
|
BigUint64Array: (value) => value instanceof global2.BigUint64Array && viewToBase64(value),
|
|
130877
|
+
// Claims `DataView` for the same reason every typed array is claimed:
|
|
130878
|
+
// devalue's built-in `DataView` encoding emits the *whole* backing
|
|
130879
|
+
// ArrayBuffer plus the view's offset and length. For a view onto Node's
|
|
130880
|
+
// shared `Buffer` pool (`Buffer.allocUnsafe`, and `Buffer.from` below
|
|
130881
|
+
// `Buffer.poolSize >>> 1`) that whole buffer is 8 KiB of unrelated
|
|
130882
|
+
// allocations, so a four-byte view would persist bytes the workflow
|
|
130883
|
+
// never handed us into the run's event log. Base64 of the viewed range
|
|
130884
|
+
// keeps the payload to the bytes the view actually spans.
|
|
130885
|
+
//
|
|
130886
|
+
// The tag deliberately is *not* `DataView`. devalue skips its built-in
|
|
130887
|
+
// branch for any tag that has a custom reviver, so registering one under
|
|
130888
|
+
// that name would strip the bounds off `["DataView", buf, offset, length]`
|
|
130889
|
+
// tuples already in event logs — the o11y UI and CLI read those with
|
|
130890
|
+
// current code, and would render the whole pooled slab this reducer
|
|
130891
|
+
// exists to keep out. Under a distinct tag the built-in branch stays
|
|
130892
|
+
// reachable and those payloads still revive with their bounds.
|
|
130893
|
+
DataViewBytes: (value) => value instanceof global2.DataView && viewToBase64(value),
|
|
129557
130894
|
// Class and Instance are intentionally placed before Error so that
|
|
129558
130895
|
// custom Error subclasses with WORKFLOW_SERIALIZE take precedence
|
|
129559
130896
|
// over the generic Error serialization (devalue uses first-match-wins).
|
|
@@ -129821,6 +131158,12 @@ function getCommonRevivers(global2 = globalThis) {
|
|
|
129821
131158
|
const ab = reviveArrayBuffer(value);
|
|
129822
131159
|
return new global2.BigUint64Array(ab);
|
|
129823
131160
|
},
|
|
131161
|
+
// No `DataView` reviver: see the `DataViewBytes` reducer. Older payloads
|
|
131162
|
+
// tagged `DataView` must keep reaching devalue's built-in branch.
|
|
131163
|
+
DataViewBytes: (value) => {
|
|
131164
|
+
const ab = reviveArrayBuffer(value);
|
|
131165
|
+
return new global2.DataView(ab);
|
|
131166
|
+
},
|
|
129824
131167
|
Date: (value) => new global2.Date(value),
|
|
129825
131168
|
DOMException: (value) => {
|
|
129826
131169
|
const error2 = new global2.DOMException(value.message, value.name);
|
|
@@ -129908,6 +131251,13 @@ async function getForwardedWritableEncryptionKey(runId, deploymentId) {
|
|
|
129908
131251
|
const rawKey = deploymentId ? await world.getEncryptionKeyForRun(runId, { deploymentId }) : await world.getEncryptionKeyForRun(await world.runs.get(runId));
|
|
129909
131252
|
return rawKey ? await importKey(rawKey, ["encrypt"]) : void 0;
|
|
129910
131253
|
}
|
|
131254
|
+
function lazyForwardedWritableEncryptionKey(runId, deploymentId) {
|
|
131255
|
+
let keyPromise;
|
|
131256
|
+
return () => {
|
|
131257
|
+
keyPromise ?? (keyPromise = getForwardedWritableEncryptionKey(runId, deploymentId));
|
|
131258
|
+
return keyPromise;
|
|
131259
|
+
};
|
|
131260
|
+
}
|
|
129911
131261
|
function getExternalRevivers(global2 = globalThis, ops, runId, cryptoKey) {
|
|
129912
131262
|
return {
|
|
129913
131263
|
...getCommonRevivers(global2),
|
|
@@ -129958,7 +131308,7 @@ function getExternalRevivers(global2 = globalThis, ops, runId, cryptoKey) {
|
|
|
129958
131308
|
},
|
|
129959
131309
|
WritableStream: (value) => {
|
|
129960
131310
|
const targetRunId = typeof value.runId === "string" ? value.runId : runId;
|
|
129961
|
-
const targetKey = targetRunId === runId ? cryptoKey :
|
|
131311
|
+
const targetKey = targetRunId === runId ? cryptoKey : lazyForwardedWritableEncryptionKey(targetRunId, value.deploymentId);
|
|
129962
131312
|
const serialize2 = getSerializeStream(getExternalReducers(global2, ops, targetRunId, targetKey), targetKey);
|
|
129963
131313
|
const serverWritable = new WorkflowServerWritableStream(value.name, targetRunId);
|
|
129964
131314
|
const state = createFlushableState();
|
|
@@ -130188,7 +131538,7 @@ function getStepRevivers(global2 = globalThis, ops, runId, cryptoKey, deployment
|
|
|
130188
131538
|
WritableStream: (value) => {
|
|
130189
131539
|
const targetRunId = typeof value.runId === "string" ? value.runId : runId;
|
|
130190
131540
|
const targetDeploymentId = typeof value.deploymentId === "string" ? value.deploymentId : targetRunId === runId ? deploymentId : void 0;
|
|
130191
|
-
const targetKey = targetRunId === runId ? cryptoKey :
|
|
131541
|
+
const targetKey = targetRunId === runId ? cryptoKey : lazyForwardedWritableEncryptionKey(targetRunId, targetDeploymentId);
|
|
130192
131542
|
const serialize2 = getSerializeStream(getStepReducers(global2, ops, targetRunId, targetKey), targetKey);
|
|
130193
131543
|
const serverWritable = new WorkflowServerWritableStream(value.name, targetRunId);
|
|
130194
131544
|
const state = createFlushableState();
|
|
@@ -133237,17 +134587,29 @@ async function start$1(workflow, argsOrOptions, options) {
|
|
|
133237
134587
|
...WorkflowArgumentsCount(args.length)
|
|
133238
134588
|
});
|
|
133239
134589
|
const world = (opts == null ? void 0 : opts.world) ?? getWorld();
|
|
133240
|
-
|
|
133241
|
-
let deploymentId
|
|
133242
|
-
if (deploymentId === "latest") {
|
|
133243
|
-
|
|
133244
|
-
|
|
133245
|
-
|
|
133246
|
-
|
|
133247
|
-
|
|
133248
|
-
|
|
134590
|
+
let currentDeploymentId;
|
|
134591
|
+
let deploymentId;
|
|
134592
|
+
if (opts.deploymentId === void 0 || opts.deploymentId === "latest") {
|
|
134593
|
+
const current = await world.getDeploymentId();
|
|
134594
|
+
currentDeploymentId = current;
|
|
134595
|
+
deploymentId = opts.deploymentId ?? current;
|
|
134596
|
+
if (deploymentId === "latest") {
|
|
134597
|
+
if (world.resolveLatestDeploymentId) {
|
|
134598
|
+
deploymentId = await world.resolveLatestDeploymentId();
|
|
134599
|
+
} else {
|
|
134600
|
+
if (!hasWarnedLatestNoOp) {
|
|
134601
|
+
hasWarnedLatestNoOp = true;
|
|
134602
|
+
runtimeLogger.warn("deploymentId: 'latest' has no effect in this world and was ignored. It is only supported by worlds with atomic deployments, such as Vercel. The run will target the current deployment.", { currentDeploymentId });
|
|
134603
|
+
}
|
|
134604
|
+
deploymentId = current;
|
|
133249
134605
|
}
|
|
133250
|
-
|
|
134606
|
+
}
|
|
134607
|
+
} else {
|
|
134608
|
+
deploymentId = opts.deploymentId;
|
|
134609
|
+
try {
|
|
134610
|
+
currentDeploymentId = await world.getDeploymentId();
|
|
134611
|
+
} catch (err) {
|
|
134612
|
+
runtimeLogger.debug("Current deployment is unavailable; starting as a cross-deployment run", { deploymentId, error: String(err) });
|
|
133251
134613
|
}
|
|
133252
134614
|
}
|
|
133253
134615
|
let framedByteStreams;
|
|
@@ -133678,8 +135040,8 @@ createQueueHandler(stepPrefix, async (message_, metadata) => {
|
|
|
133678
135040
|
stepName: stepNameFromQueue,
|
|
133679
135041
|
attempt: metadata.attempt
|
|
133680
135042
|
});
|
|
135043
|
+
const world = getWorld();
|
|
133681
135044
|
try {
|
|
133682
|
-
const world = getWorld();
|
|
133683
135045
|
await world.events.create(workflowRunId, {
|
|
133684
135046
|
eventType: "step_failed",
|
|
133685
135047
|
specVersion: SPEC_VERSION_CURRENT,
|
|
@@ -133689,22 +135051,34 @@ createQueueHandler(stepPrefix, async (message_, metadata) => {
|
|
|
133689
135051
|
error: `Step exceeded maximum queue deliveries (${metadata.attempt}/${MAX_QUEUE_DELIVERIES})`
|
|
133690
135052
|
}
|
|
133691
135053
|
}, { requestId });
|
|
133692
|
-
await queueMessage(world, getWorkflowQueueName(workflowName, stepNamespace), {
|
|
133693
|
-
runId: workflowRunId,
|
|
133694
|
-
traceCarrier: await serializeTraceCarrier(),
|
|
133695
|
-
requestedAt: /* @__PURE__ */ new Date()
|
|
133696
|
-
});
|
|
133697
135054
|
} catch (err) {
|
|
133698
|
-
if (
|
|
135055
|
+
if (RunExpiredError.is(err)) {
|
|
135056
|
+
return;
|
|
135057
|
+
}
|
|
135058
|
+
if (!EntityConflictError.is(err)) {
|
|
135059
|
+
if (isRetryableWorldError(err)) {
|
|
135060
|
+
runtimeLogger.warn("Transient error marking step as failed after max deliveries, retrying via queue redelivery", {
|
|
135061
|
+
workflowRunId,
|
|
135062
|
+
stepId,
|
|
135063
|
+
attempt: metadata.attempt,
|
|
135064
|
+
error: err instanceof Error ? err.message : String(err)
|
|
135065
|
+
});
|
|
135066
|
+
throw err;
|
|
135067
|
+
}
|
|
135068
|
+
runtimeLogger.error(`Failed to mark step as failed after ${metadata.attempt} delivery attempts. A persistent error is preventing the step from being terminated. The run will remain in its current state until manually resolved. This is most likely due to a persistent outage of the workflow backend or a bug in the workflow runtime and should be reported to the Workflow team.`, {
|
|
135069
|
+
workflowRunId,
|
|
135070
|
+
stepId,
|
|
135071
|
+
attempt: metadata.attempt,
|
|
135072
|
+
error: err instanceof Error ? err.message : String(err)
|
|
135073
|
+
});
|
|
133699
135074
|
return;
|
|
133700
135075
|
}
|
|
133701
|
-
runtimeLogger.error(`Failed to mark step as failed after ${metadata.attempt} delivery attempts. A persistent error is preventing the step from being terminated. The run will remain in its current state until manually resolved. This is most likely due to a persistent outage of the workflow backend or a bug in the workflow runtime and should be reported to the Workflow team.`, {
|
|
133702
|
-
workflowRunId,
|
|
133703
|
-
stepId,
|
|
133704
|
-
attempt: metadata.attempt,
|
|
133705
|
-
error: err instanceof Error ? err.message : String(err)
|
|
133706
|
-
});
|
|
133707
135076
|
}
|
|
135077
|
+
await queueMessage(world, getWorkflowQueueName(workflowName, stepNamespace), {
|
|
135078
|
+
runId: workflowRunId,
|
|
135079
|
+
traceCarrier: await serializeTraceCarrier(),
|
|
135080
|
+
requestedAt: /* @__PURE__ */ new Date()
|
|
135081
|
+
});
|
|
133708
135082
|
return;
|
|
133709
135083
|
}
|
|
133710
135084
|
const spanLinks = await linkToCurrentContext();
|
|
@@ -155967,7 +157341,7 @@ const route4 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProper
|
|
|
155967
157341
|
__proto__: null,
|
|
155968
157342
|
loader
|
|
155969
157343
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
155970
|
-
const serverManifest = { "entry": { "module": "/assets/entry.client-C_C46bD6.js", "imports": ["/assets/index-BsV8i_Jn.js"], "css": [] }, "routes": { "root": { "id": "root", "parentId": void 0, "path": "", "index": void 0, "caseSensitive": void 0, "hasAction": true, "hasLoader": true, "hasClientAction": false, "hasClientLoader": false, "hasClientMiddleware": false, "hasDefaultExport": true, "hasErrorBoundary": true, "module": "/assets/root-
|
|
157344
|
+
const serverManifest = { "entry": { "module": "/assets/entry.client-C_C46bD6.js", "imports": ["/assets/index-BsV8i_Jn.js"], "css": [] }, "routes": { "root": { "id": "root", "parentId": void 0, "path": "", "index": void 0, "caseSensitive": void 0, "hasAction": true, "hasLoader": true, "hasClientAction": false, "hasClientLoader": false, "hasClientMiddleware": false, "hasDefaultExport": true, "hasErrorBoundary": true, "module": "/assets/root-C2Eu3fUP.js", "imports": ["/assets/index-BsV8i_Jn.js", "/assets/mermaid-3ZIDBTTL-B1-N6W83.js"], "css": ["/assets/root-BOS11TzD.css", "/assets/mermaid-3ZIDBTTL-yyHEMZs4.css"], "clientActionModule": void 0, "clientLoaderModule": void 0, "clientMiddlewareModule": void 0, "hydrateFallbackModule": void 0 }, "routes/home": { "id": "routes/home", "parentId": "root", "path": void 0, "index": true, "caseSensitive": void 0, "hasAction": false, "hasLoader": false, "hasClientAction": false, "hasClientLoader": false, "hasClientMiddleware": false, "hasDefaultExport": true, "hasErrorBoundary": false, "module": "/assets/home-BcCTbe4i.js", "imports": ["/assets/index-BsV8i_Jn.js", "/assets/workflow-graph-viewer-lj3vdGSs.js", "/assets/mermaid-3ZIDBTTL-B1-N6W83.js", "/assets/index-DhdkuKp5.js"], "css": ["/assets/workflow-graph-viewer-yls6qlc0.css", "/assets/mermaid-3ZIDBTTL-yyHEMZs4.css"], "clientActionModule": void 0, "clientLoaderModule": void 0, "clientMiddlewareModule": void 0, "hydrateFallbackModule": void 0 }, "routes/run-detail": { "id": "routes/run-detail", "parentId": "root", "path": "run/:runId", "index": void 0, "caseSensitive": void 0, "hasAction": false, "hasLoader": false, "hasClientAction": false, "hasClientLoader": false, "hasClientMiddleware": false, "hasDefaultExport": true, "hasErrorBoundary": false, "module": "/assets/run-detail-CyImB2zR.js", "imports": ["/assets/index-BsV8i_Jn.js", "/assets/workflow-graph-viewer-lj3vdGSs.js", "/assets/mermaid-3ZIDBTTL-B1-N6W83.js", "/assets/encryption-CVDhlDp_.js", "/assets/index-DhdkuKp5.js"], "css": ["/assets/workflow-graph-viewer-yls6qlc0.css", "/assets/mermaid-3ZIDBTTL-yyHEMZs4.css"], "clientActionModule": void 0, "clientLoaderModule": void 0, "clientMiddlewareModule": void 0, "hydrateFallbackModule": void 0 }, "routes/api.rpc": { "id": "routes/api.rpc", "parentId": "root", "path": "api/rpc", "index": void 0, "caseSensitive": void 0, "hasAction": true, "hasLoader": true, "hasClientAction": false, "hasClientLoader": false, "hasClientMiddleware": false, "hasDefaultExport": false, "hasErrorBoundary": false, "module": "/assets/api.rpc-l0sNRNKZ.js", "imports": [], "css": [], "clientActionModule": void 0, "clientLoaderModule": void 0, "clientMiddlewareModule": void 0, "hydrateFallbackModule": void 0 }, "routes/api.stream.$streamId": { "id": "routes/api.stream.$streamId", "parentId": "root", "path": "api/stream/:streamId", "index": void 0, "caseSensitive": void 0, "hasAction": false, "hasLoader": true, "hasClientAction": false, "hasClientLoader": false, "hasClientMiddleware": false, "hasDefaultExport": false, "hasErrorBoundary": false, "module": "/assets/api.stream._streamId-l0sNRNKZ.js", "imports": [], "css": [], "clientActionModule": void 0, "clientLoaderModule": void 0, "clientMiddlewareModule": void 0, "hydrateFallbackModule": void 0 } }, "url": "/assets/manifest-f88c7f34.js", "version": "f88c7f34", "sri": void 0 };
|
|
155971
157345
|
const assetsBuildDirectory = "build/client";
|
|
155972
157346
|
const basename = "/";
|
|
155973
157347
|
const future = { "unstable_optimizeDeps": false, "unstable_subResourceIntegrity": false, "unstable_trailingSlashAwareDataRequests": false, "unstable_previewServerPrerendering": false, "v8_middleware": false, "v8_splitRouteModules": false, "v8_viteEnvironmentApi": false };
|