@postman-cs/onboarding-repo-sync 2.9.3 → 2.10.2
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/README.md +10 -1
- package/action.yml +5 -3
- package/dist/action.cjs +1683 -757
- package/dist/cli.cjs +1718 -795
- package/dist/index.cjs +1683 -757
- package/package.json +12 -8
package/dist/index.cjs
CHANGED
|
@@ -331,6 +331,7 @@ var require_symbols = __commonJS({
|
|
|
331
331
|
kCounter: /* @__PURE__ */ Symbol("socket request counter"),
|
|
332
332
|
kMaxResponseSize: /* @__PURE__ */ Symbol("max response size"),
|
|
333
333
|
kHTTP2Session: /* @__PURE__ */ Symbol("http2Session"),
|
|
334
|
+
kHTTP2Options: /* @__PURE__ */ Symbol("http2 options"),
|
|
334
335
|
kHTTP2SessionState: /* @__PURE__ */ Symbol("http2Session state"),
|
|
335
336
|
kRetryHandlerDefaultRetry: /* @__PURE__ */ Symbol("retry agent default retry"),
|
|
336
337
|
kConstruct: /* @__PURE__ */ Symbol("constructable"),
|
|
@@ -1377,14 +1378,14 @@ var require_util = __commonJS({
|
|
|
1377
1378
|
}
|
|
1378
1379
|
const port = url.port != null ? url.port : url.protocol === "https:" ? 443 : 80;
|
|
1379
1380
|
let origin = url.origin != null ? url.origin : `${url.protocol || ""}//${url.hostname || ""}:${port}`;
|
|
1380
|
-
let
|
|
1381
|
+
let path10 = url.path != null ? url.path : `${url.pathname || ""}${url.search || ""}`;
|
|
1381
1382
|
if (origin[origin.length - 1] === "/") {
|
|
1382
1383
|
origin = origin.slice(0, origin.length - 1);
|
|
1383
1384
|
}
|
|
1384
|
-
if (
|
|
1385
|
-
|
|
1385
|
+
if (path10 && path10[0] !== "/") {
|
|
1386
|
+
path10 = `/${path10}`;
|
|
1386
1387
|
}
|
|
1387
|
-
return new URL(`${origin}${
|
|
1388
|
+
return new URL(`${origin}${path10}`);
|
|
1388
1389
|
}
|
|
1389
1390
|
if (!isHttpOrHttpsPrefixed(url.origin || url.protocol)) {
|
|
1390
1391
|
throw new InvalidArgumentError("Invalid URL protocol: the URL must start with `http:` or `https:`.");
|
|
@@ -2255,9 +2256,9 @@ var require_diagnostics = __commonJS({
|
|
|
2255
2256
|
"undici:client:sendHeaders",
|
|
2256
2257
|
(evt) => {
|
|
2257
2258
|
const {
|
|
2258
|
-
request: { method, path:
|
|
2259
|
+
request: { method, path: path10, origin }
|
|
2259
2260
|
} = evt;
|
|
2260
|
-
debugLog("sending request to %s %s%s", method, origin,
|
|
2261
|
+
debugLog("sending request to %s %s%s", method, origin, path10);
|
|
2261
2262
|
}
|
|
2262
2263
|
);
|
|
2263
2264
|
}
|
|
@@ -2275,14 +2276,14 @@ var require_diagnostics = __commonJS({
|
|
|
2275
2276
|
"undici:request:headers",
|
|
2276
2277
|
(evt) => {
|
|
2277
2278
|
const {
|
|
2278
|
-
request: { method, path:
|
|
2279
|
+
request: { method, path: path10, origin },
|
|
2279
2280
|
response: { statusCode }
|
|
2280
2281
|
} = evt;
|
|
2281
2282
|
debugLog(
|
|
2282
2283
|
"received response to %s %s%s - HTTP %d",
|
|
2283
2284
|
method,
|
|
2284
2285
|
origin,
|
|
2285
|
-
|
|
2286
|
+
path10,
|
|
2286
2287
|
statusCode
|
|
2287
2288
|
);
|
|
2288
2289
|
}
|
|
@@ -2291,23 +2292,23 @@ var require_diagnostics = __commonJS({
|
|
|
2291
2292
|
"undici:request:trailers",
|
|
2292
2293
|
(evt) => {
|
|
2293
2294
|
const {
|
|
2294
|
-
request: { method, path:
|
|
2295
|
+
request: { method, path: path10, origin }
|
|
2295
2296
|
} = evt;
|
|
2296
|
-
debugLog("trailers received from %s %s%s", method, origin,
|
|
2297
|
+
debugLog("trailers received from %s %s%s", method, origin, path10);
|
|
2297
2298
|
}
|
|
2298
2299
|
);
|
|
2299
2300
|
diagnosticsChannel.subscribe(
|
|
2300
2301
|
"undici:request:error",
|
|
2301
2302
|
(evt) => {
|
|
2302
2303
|
const {
|
|
2303
|
-
request: { method, path:
|
|
2304
|
+
request: { method, path: path10, origin },
|
|
2304
2305
|
error: error2
|
|
2305
2306
|
} = evt;
|
|
2306
2307
|
debugLog(
|
|
2307
2308
|
"request to %s %s%s errored - %s",
|
|
2308
2309
|
method,
|
|
2309
2310
|
origin,
|
|
2310
|
-
|
|
2311
|
+
path10,
|
|
2311
2312
|
error2.message
|
|
2312
2313
|
);
|
|
2313
2314
|
}
|
|
@@ -2460,9 +2461,9 @@ var require_request = __commonJS({
|
|
|
2460
2461
|
return this.#paused;
|
|
2461
2462
|
}
|
|
2462
2463
|
};
|
|
2463
|
-
var
|
|
2464
|
+
var Request2 = class {
|
|
2464
2465
|
constructor(origin, {
|
|
2465
|
-
path:
|
|
2466
|
+
path: path10,
|
|
2466
2467
|
method,
|
|
2467
2468
|
body,
|
|
2468
2469
|
headers,
|
|
@@ -2479,11 +2480,11 @@ var require_request = __commonJS({
|
|
|
2479
2480
|
maxRedirections,
|
|
2480
2481
|
typeOfService
|
|
2481
2482
|
}, handler) {
|
|
2482
|
-
if (typeof
|
|
2483
|
+
if (typeof path10 !== "string") {
|
|
2483
2484
|
throw new InvalidArgumentError("path must be a string");
|
|
2484
|
-
} else if (
|
|
2485
|
+
} else if (path10[0] !== "/" && !(path10.startsWith("http://") || path10.startsWith("https://")) && method !== "CONNECT") {
|
|
2485
2486
|
throw new InvalidArgumentError("path must be an absolute URL or start with a slash");
|
|
2486
|
-
} else if (invalidPathRegex.test(
|
|
2487
|
+
} else if (invalidPathRegex.test(path10)) {
|
|
2487
2488
|
throw new InvalidArgumentError("invalid request path");
|
|
2488
2489
|
}
|
|
2489
2490
|
if (typeof method !== "string") {
|
|
@@ -2558,7 +2559,7 @@ var require_request = __commonJS({
|
|
|
2558
2559
|
this.completed = false;
|
|
2559
2560
|
this.aborted = false;
|
|
2560
2561
|
this.upgrade = upgrade || null;
|
|
2561
|
-
this.path = query ? serializePathWithQuery(
|
|
2562
|
+
this.path = query ? serializePathWithQuery(path10, query) : path10;
|
|
2562
2563
|
this.origin = origin;
|
|
2563
2564
|
this.protocol = getProtocolFromUrlString(origin);
|
|
2564
2565
|
this.idempotent = idempotent == null ? method === "HEAD" || method === "GET" || method === "QUERY" : idempotent;
|
|
@@ -2755,7 +2756,11 @@ var require_request = __commonJS({
|
|
|
2755
2756
|
} else if (typeof val[i] === "object") {
|
|
2756
2757
|
throw new InvalidArgumentError(`invalid ${key} header`);
|
|
2757
2758
|
} else {
|
|
2758
|
-
|
|
2759
|
+
const str = `${val[i]}`;
|
|
2760
|
+
if (!isValidHeaderValue(str)) {
|
|
2761
|
+
throw new InvalidArgumentError(`invalid ${key} header`);
|
|
2762
|
+
}
|
|
2763
|
+
arr.push(str);
|
|
2759
2764
|
}
|
|
2760
2765
|
}
|
|
2761
2766
|
val = arr;
|
|
@@ -2767,6 +2772,9 @@ var require_request = __commonJS({
|
|
|
2767
2772
|
val = "";
|
|
2768
2773
|
} else {
|
|
2769
2774
|
val = `${val}`;
|
|
2775
|
+
if (!isValidHeaderValue(val)) {
|
|
2776
|
+
throw new InvalidArgumentError(`invalid ${key} header`);
|
|
2777
|
+
}
|
|
2770
2778
|
}
|
|
2771
2779
|
if (headerName === "host") {
|
|
2772
2780
|
if (request.host !== null) {
|
|
@@ -2809,7 +2817,7 @@ var require_request = __commonJS({
|
|
|
2809
2817
|
request.headers.push(key, val);
|
|
2810
2818
|
}
|
|
2811
2819
|
}
|
|
2812
|
-
module2.exports =
|
|
2820
|
+
module2.exports = Request2;
|
|
2813
2821
|
}
|
|
2814
2822
|
});
|
|
2815
2823
|
|
|
@@ -3092,14 +3100,26 @@ var require_connect = __commonJS({
|
|
|
3092
3100
|
} else {
|
|
3093
3101
|
assert(!httpSocket, "httpSocket can only be sent on TLS update");
|
|
3094
3102
|
port = port || 80;
|
|
3095
|
-
|
|
3103
|
+
const connectOptions = {
|
|
3096
3104
|
highWaterMark: 64 * 1024,
|
|
3097
3105
|
// Same as nodejs fs streams.
|
|
3098
3106
|
...options,
|
|
3099
3107
|
localAddress,
|
|
3100
3108
|
port,
|
|
3101
3109
|
host: hostname
|
|
3102
|
-
}
|
|
3110
|
+
};
|
|
3111
|
+
const family = net.isIP(hostname);
|
|
3112
|
+
if (family !== 0 && servername && servername !== hostname) {
|
|
3113
|
+
connectOptions.host = servername;
|
|
3114
|
+
connectOptions.lookup = (_hostname, lookupOptions, cb) => {
|
|
3115
|
+
if (lookupOptions.all) {
|
|
3116
|
+
cb(null, [{ address: hostname, family }]);
|
|
3117
|
+
} else {
|
|
3118
|
+
cb(null, hostname, family);
|
|
3119
|
+
}
|
|
3120
|
+
};
|
|
3121
|
+
}
|
|
3122
|
+
socket = net.connect(connectOptions);
|
|
3103
3123
|
if (useH2c === true) {
|
|
3104
3124
|
socket.alpnProtocol = "h2";
|
|
3105
3125
|
}
|
|
@@ -6752,6 +6772,7 @@ var require_client_h1 = __commonJS({
|
|
|
6752
6772
|
RequestContentLengthMismatchError,
|
|
6753
6773
|
ResponseContentLengthMismatchError,
|
|
6754
6774
|
RequestAbortedError,
|
|
6775
|
+
InvalidArgumentError,
|
|
6755
6776
|
HeadersTimeoutError,
|
|
6756
6777
|
HeadersOverflowError,
|
|
6757
6778
|
SocketError,
|
|
@@ -7538,20 +7559,20 @@ var require_client_h1 = __commonJS({
|
|
|
7538
7559
|
}
|
|
7539
7560
|
function clearIdleSocketValidation(socket) {
|
|
7540
7561
|
if (socket[kIdleSocketValidationTimeout]) {
|
|
7541
|
-
|
|
7562
|
+
clearTimeout(socket[kIdleSocketValidationTimeout]);
|
|
7542
7563
|
socket[kIdleSocketValidationTimeout] = null;
|
|
7543
7564
|
}
|
|
7544
7565
|
socket[kIdleSocketValidation] = 0;
|
|
7545
7566
|
}
|
|
7546
7567
|
function scheduleIdleSocketValidation(client, socket) {
|
|
7547
7568
|
socket[kIdleSocketValidation] = 1;
|
|
7548
|
-
socket[kIdleSocketValidationTimeout] =
|
|
7569
|
+
socket[kIdleSocketValidationTimeout] = setTimeout(() => {
|
|
7549
7570
|
socket[kIdleSocketValidationTimeout] = null;
|
|
7550
7571
|
socket[kIdleSocketValidation] = 2;
|
|
7551
7572
|
if (client[kSocket] === socket && !socket.destroyed) {
|
|
7552
7573
|
client[kResume]();
|
|
7553
7574
|
}
|
|
7554
|
-
});
|
|
7575
|
+
}, 0);
|
|
7555
7576
|
socket[kIdleSocketValidationTimeout].unref?.();
|
|
7556
7577
|
}
|
|
7557
7578
|
function resumeH1(client) {
|
|
@@ -7624,7 +7645,7 @@ var require_client_h1 = __commonJS({
|
|
|
7624
7645
|
}
|
|
7625
7646
|
}
|
|
7626
7647
|
function writeH1(client, request) {
|
|
7627
|
-
const { method, path:
|
|
7648
|
+
const { method, path: path10, host, upgrade, blocking, reset } = request;
|
|
7628
7649
|
let { body, headers, contentLength } = request;
|
|
7629
7650
|
const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH" || method === "QUERY" || method === "PROPFIND" || method === "PROPPATCH";
|
|
7630
7651
|
if (util.isFormDataLike(body)) {
|
|
@@ -7637,8 +7658,16 @@ var require_client_h1 = __commonJS({
|
|
|
7637
7658
|
}
|
|
7638
7659
|
body = bodyStream.stream;
|
|
7639
7660
|
contentLength = bodyStream.length;
|
|
7640
|
-
} else if (util.isBlobLike(body) && request.contentType == null
|
|
7641
|
-
|
|
7661
|
+
} else if (util.isBlobLike(body) && request.contentType == null) {
|
|
7662
|
+
const contentType = body.type;
|
|
7663
|
+
if (contentType) {
|
|
7664
|
+
const contentTypeValue = `${contentType}`;
|
|
7665
|
+
if (!util.isValidHeaderValue(contentTypeValue)) {
|
|
7666
|
+
util.errorRequest(client, request, new InvalidArgumentError("invalid content-type header"));
|
|
7667
|
+
return false;
|
|
7668
|
+
}
|
|
7669
|
+
headers.push("content-type", contentTypeValue);
|
|
7670
|
+
}
|
|
7642
7671
|
}
|
|
7643
7672
|
if (body && typeof body.read === "function") {
|
|
7644
7673
|
body.read(0);
|
|
@@ -7692,7 +7721,7 @@ var require_client_h1 = __commonJS({
|
|
|
7692
7721
|
socket[kBlocking] = true;
|
|
7693
7722
|
}
|
|
7694
7723
|
setTypeOfService(socket, request);
|
|
7695
|
-
let header = `${method} ${
|
|
7724
|
+
let header = `${method} ${path10} HTTP/1.1\r
|
|
7696
7725
|
`;
|
|
7697
7726
|
if (typeof host === "string") {
|
|
7698
7727
|
header += `host: ${host}\r
|
|
@@ -8067,10 +8096,7 @@ var require_client_h2 = __commonJS({
|
|
|
8067
8096
|
kStrictContentLength,
|
|
8068
8097
|
kOnError,
|
|
8069
8098
|
kMaxConcurrentStreams,
|
|
8070
|
-
kPingInterval,
|
|
8071
8099
|
kHTTP2Session,
|
|
8072
|
-
kHTTP2InitialWindowSize,
|
|
8073
|
-
kHTTP2ConnectionWindowSize,
|
|
8074
8100
|
kHostAuthority,
|
|
8075
8101
|
kResume,
|
|
8076
8102
|
kSize,
|
|
@@ -8082,7 +8108,8 @@ var require_client_h2 = __commonJS({
|
|
|
8082
8108
|
kEnableConnectProtocol,
|
|
8083
8109
|
kRemoteSettings,
|
|
8084
8110
|
kHTTP2Stream,
|
|
8085
|
-
kHTTP2SessionState
|
|
8111
|
+
kHTTP2SessionState,
|
|
8112
|
+
kHTTP2Options
|
|
8086
8113
|
} = require_symbols();
|
|
8087
8114
|
var { channels } = require_diagnostics();
|
|
8088
8115
|
var kOpenStreams = /* @__PURE__ */ Symbol("open streams");
|
|
@@ -8091,6 +8118,9 @@ var require_client_h2 = __commonJS({
|
|
|
8091
8118
|
var kRequestStreamCleanup = /* @__PURE__ */ Symbol("request stream cleanup");
|
|
8092
8119
|
var kRequestStreamState = /* @__PURE__ */ Symbol("request stream state");
|
|
8093
8120
|
var kReceivedGoAway = /* @__PURE__ */ Symbol("received goaway");
|
|
8121
|
+
var kGoAwayReplayAttempts = /* @__PURE__ */ Symbol("goaway replay attempts");
|
|
8122
|
+
var kRefusedStreamRetry = /* @__PURE__ */ Symbol("refused stream retry");
|
|
8123
|
+
var MAX_GOAWAY_REPLAY_ATTEMPTS = 1;
|
|
8094
8124
|
var extractBody;
|
|
8095
8125
|
var http2;
|
|
8096
8126
|
try {
|
|
@@ -8188,10 +8218,15 @@ var require_client_h2 = __commonJS({
|
|
|
8188
8218
|
client[kPendingIdx] = client[kRunningIdx];
|
|
8189
8219
|
}
|
|
8190
8220
|
}
|
|
8191
|
-
function
|
|
8221
|
+
function canReplayRequest(request) {
|
|
8192
8222
|
const { body } = request;
|
|
8193
8223
|
return body == null || util.isBuffer(body) || util.isBlobLike(body);
|
|
8194
8224
|
}
|
|
8225
|
+
function registerGoAwayRefusal(request) {
|
|
8226
|
+
const attempts = (request[kGoAwayReplayAttempts] ?? 0) + 1;
|
|
8227
|
+
request[kGoAwayReplayAttempts] = attempts;
|
|
8228
|
+
return attempts <= MAX_GOAWAY_REPLAY_ATTEMPTS;
|
|
8229
|
+
}
|
|
8195
8230
|
function closeStream(stream, code = NGHTTP2_REFUSED_STREAM) {
|
|
8196
8231
|
if (stream != null && !stream.destroyed && !stream.closed) {
|
|
8197
8232
|
try {
|
|
@@ -8203,15 +8238,30 @@ var require_client_h2 = __commonJS({
|
|
|
8203
8238
|
function detachRequestStreamForClose(request) {
|
|
8204
8239
|
const stream = request[kRequestStream];
|
|
8205
8240
|
clearRequestStream(request);
|
|
8241
|
+
severRequestStream(stream);
|
|
8206
8242
|
return stream;
|
|
8207
8243
|
}
|
|
8244
|
+
function severRequestStream(stream) {
|
|
8245
|
+
if (stream == null || stream[kRequestStreamState] == null) {
|
|
8246
|
+
return;
|
|
8247
|
+
}
|
|
8248
|
+
stream[kRequestStreamState] = null;
|
|
8249
|
+
stream.off("close", completeRequestStream);
|
|
8250
|
+
stream.off("close", onUpgradeStreamClose);
|
|
8251
|
+
if (stream[kHTTP2Session] != null) {
|
|
8252
|
+
closeStreamSession(stream);
|
|
8253
|
+
}
|
|
8254
|
+
if (!stream.destroyed && !stream.closed) {
|
|
8255
|
+
stream.once("error", noop);
|
|
8256
|
+
}
|
|
8257
|
+
}
|
|
8208
8258
|
function connectH2(client, socket) {
|
|
8209
8259
|
client[kSocket] = socket;
|
|
8210
|
-
const http2InitialWindowSize = client[
|
|
8211
|
-
const http2ConnectionWindowSize = client[
|
|
8260
|
+
const http2InitialWindowSize = client[kHTTP2Options].sessionOptions?.initialWindowSize;
|
|
8261
|
+
const http2ConnectionWindowSize = client[kHTTP2Options].connectionWindowSize;
|
|
8212
8262
|
const session = http2.connect(client[kUrl], {
|
|
8213
8263
|
createConnection: () => socket,
|
|
8214
|
-
peerMaxConcurrentStreams: client[
|
|
8264
|
+
peerMaxConcurrentStreams: client[kHTTP2Options].maxConcurrentStreams,
|
|
8215
8265
|
settings: {
|
|
8216
8266
|
// TODO(metcoder95): add support for PUSH
|
|
8217
8267
|
enablePush: false,
|
|
@@ -8224,13 +8274,16 @@ var require_client_h2 = __commonJS({
|
|
|
8224
8274
|
session[kSocket] = socket;
|
|
8225
8275
|
session[kHTTP2SessionState] = {
|
|
8226
8276
|
idleTimeout: null,
|
|
8277
|
+
// Armed while the peer advertises MAX_CONCURRENT_STREAMS = 0 and we have
|
|
8278
|
+
// work that cannot start. See setNoStreamsTimeout.
|
|
8279
|
+
noStreamsTimeout: null,
|
|
8227
8280
|
// Sockets start out ref'd. Session ref/unref proxies to the socket, so a
|
|
8228
8281
|
// single cached flag lets us skip redundant uv ref/unref calls, provided
|
|
8229
8282
|
// every ref/unref of the session or its socket goes through
|
|
8230
8283
|
// refH2Session/unrefH2Session.
|
|
8231
8284
|
refed: true,
|
|
8232
8285
|
ping: {
|
|
8233
|
-
interval: client[
|
|
8286
|
+
interval: client[kHTTP2Options].pingInterval === 0 ? null : setInterval(onHttp2SendPing, client[kHTTP2Options].pingInterval, session).unref()
|
|
8234
8287
|
}
|
|
8235
8288
|
};
|
|
8236
8289
|
session[kReceivedGoAway] = false;
|
|
@@ -8335,8 +8388,48 @@ var require_client_h2 = __commonJS({
|
|
|
8335
8388
|
} else {
|
|
8336
8389
|
clearHttp2IdleTimeout(session);
|
|
8337
8390
|
}
|
|
8391
|
+
if (client[kMaxConcurrentStreams] === 0 && client[kRunning] === 0 && client[kPending] > 0) {
|
|
8392
|
+
setNoStreamsTimeout(session);
|
|
8393
|
+
} else {
|
|
8394
|
+
clearNoStreamsTimeout(session);
|
|
8395
|
+
}
|
|
8396
|
+
}
|
|
8397
|
+
}
|
|
8398
|
+
function clearNoStreamsTimeout(session) {
|
|
8399
|
+
const state = session[kHTTP2SessionState];
|
|
8400
|
+
if (state?.noStreamsTimeout != null) {
|
|
8401
|
+
clearTimeout(state.noStreamsTimeout);
|
|
8402
|
+
state.noStreamsTimeout = null;
|
|
8338
8403
|
}
|
|
8339
8404
|
}
|
|
8405
|
+
function setNoStreamsTimeout(session) {
|
|
8406
|
+
const client = session[kClient];
|
|
8407
|
+
const state = session[kHTTP2SessionState];
|
|
8408
|
+
const timeout = client[kHeadersTimeout];
|
|
8409
|
+
if (!timeout || state.noStreamsTimeout != null) {
|
|
8410
|
+
return;
|
|
8411
|
+
}
|
|
8412
|
+
state.noStreamsTimeout = setTimeout(onNoStreamsTimeout, timeout, session).unref();
|
|
8413
|
+
}
|
|
8414
|
+
function onNoStreamsTimeout(session) {
|
|
8415
|
+
const client = session[kClient];
|
|
8416
|
+
const state = session[kHTTP2SessionState];
|
|
8417
|
+
state.noStreamsTimeout = null;
|
|
8418
|
+
if (client[kHTTP2Session] !== session || client[kMaxConcurrentStreams] !== 0 || client[kRunning] !== 0 || client[kPending] === 0) {
|
|
8419
|
+
return;
|
|
8420
|
+
}
|
|
8421
|
+
const err = new HeadersTimeoutError(
|
|
8422
|
+
`HTTP/2: server did not accept a new stream within ${client[kHeadersTimeout]}`
|
|
8423
|
+
);
|
|
8424
|
+
const requests = client[kQueue].splice(client[kPendingIdx]);
|
|
8425
|
+
for (let i = 0; i < requests.length; i++) {
|
|
8426
|
+
if (requests[i] != null) {
|
|
8427
|
+
util.errorRequest(client, requests[i], err);
|
|
8428
|
+
}
|
|
8429
|
+
}
|
|
8430
|
+
session[kError] = err;
|
|
8431
|
+
resetHttp2Session(session, err);
|
|
8432
|
+
}
|
|
8340
8433
|
function clearHttp2IdleTimeout(session) {
|
|
8341
8434
|
const state = session[kHTTP2SessionState];
|
|
8342
8435
|
if (state?.idleTimeout != null) {
|
|
@@ -8443,7 +8536,7 @@ var require_client_h2 = __commonJS({
|
|
|
8443
8536
|
const request = client[kQueue][i];
|
|
8444
8537
|
if (request != null) {
|
|
8445
8538
|
streamsToClose.push(detachRequestStreamForClose(request));
|
|
8446
|
-
if (
|
|
8539
|
+
if (canReplayRequest(request) && registerGoAwayRefusal(request)) {
|
|
8447
8540
|
retriableRequests.push(request);
|
|
8448
8541
|
} else {
|
|
8449
8542
|
util.errorRequest(client, request, err);
|
|
@@ -8464,6 +8557,7 @@ var require_client_h2 = __commonJS({
|
|
|
8464
8557
|
client[kHTTP2Session] = null;
|
|
8465
8558
|
}
|
|
8466
8559
|
clearHttp2IdleTimeout(this);
|
|
8560
|
+
clearNoStreamsTimeout(this);
|
|
8467
8561
|
if (!this.closed && !this.destroyed) {
|
|
8468
8562
|
this.close();
|
|
8469
8563
|
}
|
|
@@ -8480,6 +8574,7 @@ var require_client_h2 = __commonJS({
|
|
|
8480
8574
|
client[kHTTP2Session] = null;
|
|
8481
8575
|
}
|
|
8482
8576
|
clearHttp2IdleTimeout(this);
|
|
8577
|
+
clearNoStreamsTimeout(this);
|
|
8483
8578
|
if (state.ping.interval != null) {
|
|
8484
8579
|
clearInterval(state.ping.interval);
|
|
8485
8580
|
state.ping.interval = null;
|
|
@@ -8555,6 +8650,12 @@ var require_client_h2 = __commonJS({
|
|
|
8555
8650
|
releaseRequestStream(this);
|
|
8556
8651
|
if (state.pendingEnd && !state.request.aborted && !state.request.completed) {
|
|
8557
8652
|
state.request.onResponseEnd(state.trailers || {});
|
|
8653
|
+
} else if (!state.request.aborted && !state.request.completed) {
|
|
8654
|
+
util.errorRequest(
|
|
8655
|
+
state.client,
|
|
8656
|
+
state.request,
|
|
8657
|
+
new InformationalError("HTTP/2: stream closed before the response was complete")
|
|
8658
|
+
);
|
|
8558
8659
|
}
|
|
8559
8660
|
finalizeRequest(state);
|
|
8560
8661
|
closeStreamSession(this);
|
|
@@ -8701,7 +8802,7 @@ var require_client_h2 = __commonJS({
|
|
|
8701
8802
|
const headersTimeout = request.headersTimeout ?? client[kHeadersTimeout];
|
|
8702
8803
|
const bodyTimeout = request.bodyTimeout ?? client[kBodyTimeout];
|
|
8703
8804
|
const session = client[kHTTP2Session];
|
|
8704
|
-
const { method, path:
|
|
8805
|
+
const { method, path: path10, host, upgrade, expectContinue, signal, protocol, headers: reqHeaders } = request;
|
|
8705
8806
|
if (upgrade != null && upgrade !== "websocket") {
|
|
8706
8807
|
util.errorRequest(client, request, new InvalidArgumentError(`Custom upgrade "${upgrade}" not supported over HTTP/2`));
|
|
8707
8808
|
return false;
|
|
@@ -8764,7 +8865,7 @@ var require_client_h2 = __commonJS({
|
|
|
8764
8865
|
}
|
|
8765
8866
|
headers[HTTP2_HEADER_METHOD] = "CONNECT";
|
|
8766
8867
|
headers[HTTP2_HEADER_PROTOCOL] = "websocket";
|
|
8767
|
-
headers[HTTP2_HEADER_PATH] =
|
|
8868
|
+
headers[HTTP2_HEADER_PATH] = path10;
|
|
8768
8869
|
if (protocol === "ws:" || protocol === "wss:") {
|
|
8769
8870
|
headers[HTTP2_HEADER_SCHEME] = protocol === "ws:" ? "http" : "https";
|
|
8770
8871
|
} else {
|
|
@@ -8786,7 +8887,7 @@ var require_client_h2 = __commonJS({
|
|
|
8786
8887
|
setupUpgradeStream(stream, state);
|
|
8787
8888
|
return true;
|
|
8788
8889
|
}
|
|
8789
|
-
headers[HTTP2_HEADER_PATH] =
|
|
8890
|
+
headers[HTTP2_HEADER_PATH] = path10;
|
|
8790
8891
|
headers[HTTP2_HEADER_SCHEME] = protocol === "http:" ? "http" : "https";
|
|
8791
8892
|
const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH" || method === "QUERY" || method === "PROPFIND" || method === "PROPPATCH";
|
|
8792
8893
|
let body = state.body;
|
|
@@ -8954,6 +9055,20 @@ var require_client_h2 = __commonJS({
|
|
|
8954
9055
|
state.abort(new InformationalError("HTTP/2: stream half-closed (remote)"), true);
|
|
8955
9056
|
}
|
|
8956
9057
|
}
|
|
9058
|
+
function retryRefusedStream(stream, state) {
|
|
9059
|
+
const { client, request } = state;
|
|
9060
|
+
if (state.responseReceived || request.aborted || request.completed || request[kRefusedStreamRetry] || !canReplayRequest(request)) {
|
|
9061
|
+
return false;
|
|
9062
|
+
}
|
|
9063
|
+
request[kRefusedStreamRetry] = true;
|
|
9064
|
+
detachRequestStreamForClose(request);
|
|
9065
|
+
state.stream = null;
|
|
9066
|
+
state.requestFinalized = true;
|
|
9067
|
+
completeRequest(client, request);
|
|
9068
|
+
client[kQueue].splice(client[kPendingIdx], 0, request);
|
|
9069
|
+
client[kResume]();
|
|
9070
|
+
return true;
|
|
9071
|
+
}
|
|
8957
9072
|
function onError(err) {
|
|
8958
9073
|
const stream = this;
|
|
8959
9074
|
const state = stream[kRequestStreamState];
|
|
@@ -8961,6 +9076,12 @@ var require_client_h2 = __commonJS({
|
|
|
8961
9076
|
return;
|
|
8962
9077
|
}
|
|
8963
9078
|
stream.off("error", onError);
|
|
9079
|
+
if (typeof stream.rstCode === "number" && stream.rstCode !== NGHTTP2_NO_ERROR) {
|
|
9080
|
+
err.http2ErrorCode = stream.rstCode;
|
|
9081
|
+
}
|
|
9082
|
+
if (stream.rstCode === NGHTTP2_REFUSED_STREAM && retryRefusedStream(stream, state)) {
|
|
9083
|
+
return;
|
|
9084
|
+
}
|
|
8964
9085
|
state.abort(err);
|
|
8965
9086
|
}
|
|
8966
9087
|
function onFrameError(type, code) {
|
|
@@ -9195,7 +9316,7 @@ var require_client = __commonJS({
|
|
|
9195
9316
|
var util = require_util();
|
|
9196
9317
|
var { ClientStats } = require_stats();
|
|
9197
9318
|
var { channels } = require_diagnostics();
|
|
9198
|
-
var
|
|
9319
|
+
var Request2 = require_request();
|
|
9199
9320
|
var DispatcherBase = require_dispatcher_base();
|
|
9200
9321
|
var {
|
|
9201
9322
|
InvalidArgumentError,
|
|
@@ -9242,10 +9363,8 @@ var require_client = __commonJS({
|
|
|
9242
9363
|
kHTTPContext,
|
|
9243
9364
|
kMaxConcurrentStreams,
|
|
9244
9365
|
kHostAuthority,
|
|
9245
|
-
kHTTP2InitialWindowSize,
|
|
9246
|
-
kHTTP2ConnectionWindowSize,
|
|
9247
9366
|
kResume,
|
|
9248
|
-
|
|
9367
|
+
kHTTP2Options
|
|
9249
9368
|
} = require_symbols();
|
|
9250
9369
|
var connectH1 = require_client_h1();
|
|
9251
9370
|
var connectH2 = require_client_h2();
|
|
@@ -9258,6 +9377,14 @@ var require_client = __commonJS({
|
|
|
9258
9377
|
function getPipelining(client) {
|
|
9259
9378
|
return client[kPipelining] ?? client[kHTTPContext]?.defaultPipelining ?? 1;
|
|
9260
9379
|
}
|
|
9380
|
+
var h2NamespaceOptsWarning = false;
|
|
9381
|
+
function emitH2OptionsNamespaceWarning(optName) {
|
|
9382
|
+
if (h2NamespaceOptsWarning === true) return;
|
|
9383
|
+
process.emitWarning(`Use h2Options.${optName} instead. ${optName} for H2 will be deprecated in future major.`, {
|
|
9384
|
+
code: "UNDICI-H2-OPTIONS"
|
|
9385
|
+
});
|
|
9386
|
+
h2NamespaceOptsWarning = true;
|
|
9387
|
+
}
|
|
9261
9388
|
function getMaxConcurrent(client) {
|
|
9262
9389
|
if (client[kHTTPContext]?.version === "h2") {
|
|
9263
9390
|
return client[kMaxConcurrentStreams];
|
|
@@ -9301,7 +9428,8 @@ var require_client = __commonJS({
|
|
|
9301
9428
|
initialWindowSize,
|
|
9302
9429
|
connectionWindowSize,
|
|
9303
9430
|
pingInterval,
|
|
9304
|
-
webSocket
|
|
9431
|
+
webSocket,
|
|
9432
|
+
h2Options
|
|
9305
9433
|
} = {}) {
|
|
9306
9434
|
if (keepAlive !== void 0) {
|
|
9307
9435
|
throw new InvalidArgumentError("unsupported keepAlive, use pipelining=0 instead");
|
|
@@ -9364,20 +9492,45 @@ var require_client = __commonJS({
|
|
|
9364
9492
|
if (allowH2 != null && typeof allowH2 !== "boolean") {
|
|
9365
9493
|
throw new InvalidArgumentError("allowH2 must be a valid boolean value");
|
|
9366
9494
|
}
|
|
9367
|
-
if (
|
|
9368
|
-
|
|
9369
|
-
|
|
9370
|
-
|
|
9371
|
-
|
|
9372
|
-
|
|
9373
|
-
|
|
9374
|
-
|
|
9375
|
-
|
|
9376
|
-
|
|
9377
|
-
|
|
9378
|
-
|
|
9379
|
-
|
|
9380
|
-
|
|
9495
|
+
if (allowH2 !== false) {
|
|
9496
|
+
if (h2Options != null) {
|
|
9497
|
+
if (h2Options.useH2c != null && typeof h2Options.useH2c !== "boolean") {
|
|
9498
|
+
throw new InvalidArgumentError("h2Options.useH2c must be a valid boolean value");
|
|
9499
|
+
}
|
|
9500
|
+
if (h2Options.settings?.initialWindowSize != null && (!Number.isInteger(h2Options.settings.initialWindowSize) || h2Options.settings.initialWindowSize < 1)) {
|
|
9501
|
+
throw new InvalidArgumentError("h2Options.settings.initialWindowSize must be a positive integer, greater than 0");
|
|
9502
|
+
}
|
|
9503
|
+
if (h2Options.maxConcurrentStreams != null && (!Number.isInteger(h2Options.connectionWindowSize) || h2Options.maxConcurrentStreams < 1)) {
|
|
9504
|
+
throw new InvalidArgumentError("h2Options.maxConcurrentStreams must be a positive integer, greater than 0");
|
|
9505
|
+
}
|
|
9506
|
+
if (h2Options.connectionWindowSize != null && (!Number.isInteger(h2Options.connectionWindowSize) || h2Options.connectionWindowSize < 1)) {
|
|
9507
|
+
throw new InvalidArgumentError("h2Options.connectionWindowSize must be a positive integer, greater than 0");
|
|
9508
|
+
}
|
|
9509
|
+
if (h2Options.pingInterval != null && (typeof h2Options.pingInterval !== "number" || !Number.isInteger(h2Options.pingInterval) || h2Options.pingInterval < 0)) {
|
|
9510
|
+
throw new InvalidArgumentError("h2Options.pingInterval must be a positive integer, greater or equal to 0");
|
|
9511
|
+
}
|
|
9512
|
+
} else {
|
|
9513
|
+
if (useH2c != null && typeof useH2c !== "boolean") {
|
|
9514
|
+
emitH2OptionsNamespaceWarning("useH2c");
|
|
9515
|
+
throw new InvalidArgumentError("useH2c must be a valid boolean value");
|
|
9516
|
+
}
|
|
9517
|
+
if (maxConcurrentStreams != null && (typeof maxConcurrentStreams !== "number" || maxConcurrentStreams < 1)) {
|
|
9518
|
+
emitH2OptionsNamespaceWarning("maxConcurrentStreams");
|
|
9519
|
+
throw new InvalidArgumentError("maxConcurrentStreams must be a positive integer, greater than 0");
|
|
9520
|
+
}
|
|
9521
|
+
if (initialWindowSize != null && (!Number.isInteger(initialWindowSize) || initialWindowSize < 1)) {
|
|
9522
|
+
emitH2OptionsNamespaceWarning("initialWindowSize");
|
|
9523
|
+
throw new InvalidArgumentError("initialWindowSize must be a positive integer, greater than 0");
|
|
9524
|
+
}
|
|
9525
|
+
if (connectionWindowSize != null && (!Number.isInteger(connectionWindowSize) || connectionWindowSize < 1)) {
|
|
9526
|
+
emitH2OptionsNamespaceWarning("connectionWindowSize");
|
|
9527
|
+
throw new InvalidArgumentError("connectionWindowSize must be a positive integer, greater than 0");
|
|
9528
|
+
}
|
|
9529
|
+
if (pingInterval != null && (typeof pingInterval !== "number" || !Number.isInteger(pingInterval) || pingInterval < 0)) {
|
|
9530
|
+
emitH2OptionsNamespaceWarning("pingInterval");
|
|
9531
|
+
throw new InvalidArgumentError("pingInterval must be a positive integer, greater or equal to 0");
|
|
9532
|
+
}
|
|
9533
|
+
}
|
|
9381
9534
|
}
|
|
9382
9535
|
super({ webSocket });
|
|
9383
9536
|
if (typeof connect2 !== "function") {
|
|
@@ -9385,8 +9538,8 @@ var require_client = __commonJS({
|
|
|
9385
9538
|
...tls,
|
|
9386
9539
|
maxCachedSessions,
|
|
9387
9540
|
allowH2,
|
|
9388
|
-
useH2c,
|
|
9389
9541
|
socketPath,
|
|
9542
|
+
useH2c: h2Options?.useH2c ?? useH2c,
|
|
9390
9543
|
timeout: connectTimeout,
|
|
9391
9544
|
...typeof autoSelectFamily === "boolean" ? { autoSelectFamily, autoSelectFamilyAttemptTimeout } : void 0,
|
|
9392
9545
|
...connect2
|
|
@@ -9421,10 +9574,21 @@ var require_client = __commonJS({
|
|
|
9421
9574
|
this[kClosedResolve] = null;
|
|
9422
9575
|
this[kMaxResponseSize] = maxResponseSize > -1 ? maxResponseSize : -1;
|
|
9423
9576
|
this[kHTTPContext] = null;
|
|
9424
|
-
this[
|
|
9425
|
-
|
|
9426
|
-
|
|
9427
|
-
|
|
9577
|
+
this[kHTTP2Options] = {
|
|
9578
|
+
pingInterval: h2Options?.pingInterval ?? pingInterval ?? 6e4,
|
|
9579
|
+
connectionWindowSize: h2Options?.connectionWindowSize ?? connectionWindowSize ?? 524288,
|
|
9580
|
+
maxConcurrentStreams: h2Options?.maxConcurrentStreams ?? maxConcurrentStreams ?? 100,
|
|
9581
|
+
// Max peerConcurrentStreams for a Node h2 server
|
|
9582
|
+
sessionOptions: {
|
|
9583
|
+
// HTTP/2 window sizes are set to higher defaults than Node.js core for better performance:
|
|
9584
|
+
// - initialWindowSize: 262144 (256KB) vs Node.js default 65535 (64KB - 1)
|
|
9585
|
+
// Allows more data to be sent before requiring acknowledgment, improving throughput
|
|
9586
|
+
// especially on high-latency networks. This matches common production HTTP/2 servers.
|
|
9587
|
+
// - connectionWindowSize: 524288 (512KB) vs Node.js default (none set)
|
|
9588
|
+
// Provides better flow control for the entire connection across multiple streams.
|
|
9589
|
+
initialWindowSize: h2Options?.initialWindowSize ?? initialWindowSize ?? 262144
|
|
9590
|
+
}
|
|
9591
|
+
};
|
|
9428
9592
|
this[kQueue] = [];
|
|
9429
9593
|
this[kRunningIdx] = 0;
|
|
9430
9594
|
this[kPendingIdx] = 0;
|
|
@@ -9464,7 +9628,7 @@ var require_client = __commonJS({
|
|
|
9464
9628
|
this.once("connect", cb);
|
|
9465
9629
|
}
|
|
9466
9630
|
[kDispatch](opts, handler) {
|
|
9467
|
-
const request = new
|
|
9631
|
+
const request = new Request2(this[kUrl].origin, opts, handler);
|
|
9468
9632
|
this[kQueue].push(request);
|
|
9469
9633
|
if (this[kResuming]) {
|
|
9470
9634
|
} else if (util.bodyLength(request.body) == null && util.isIterable(request.body)) {
|
|
@@ -9709,6 +9873,7 @@ var require_client = __commonJS({
|
|
|
9709
9873
|
return;
|
|
9710
9874
|
}
|
|
9711
9875
|
if (!client[kHTTPContext]) {
|
|
9876
|
+
client[kServerName] = request.servername;
|
|
9712
9877
|
connect(client);
|
|
9713
9878
|
return;
|
|
9714
9879
|
}
|
|
@@ -11119,7 +11284,7 @@ var require_socks5_proxy_agent = __commonJS({
|
|
|
11119
11284
|
var DispatcherBase = require_dispatcher_base();
|
|
11120
11285
|
var { InvalidArgumentError } = require_errors();
|
|
11121
11286
|
var { Socks5Client, STATES } = require_socks5_client();
|
|
11122
|
-
var { kDispatch, kClose, kDestroy } = require_symbols();
|
|
11287
|
+
var { kBusy, kConnected, kDispatch, kClose, kDestroy } = require_symbols();
|
|
11123
11288
|
var Pool = require_pool();
|
|
11124
11289
|
var buildConnector = require_connect();
|
|
11125
11290
|
var { debuglog } = require("node:util");
|
|
@@ -11277,6 +11442,17 @@ var require_socks5_proxy_agent = __commonJS({
|
|
|
11277
11442
|
}
|
|
11278
11443
|
});
|
|
11279
11444
|
this[kPools].set(originKey, pool);
|
|
11445
|
+
const closePoolIfUnused = () => {
|
|
11446
|
+
if (this[kPools].get(originKey) !== pool || pool[kConnected] > 0 || pool[kBusy]) {
|
|
11447
|
+
return;
|
|
11448
|
+
}
|
|
11449
|
+
this[kPools].delete(originKey);
|
|
11450
|
+
if (!pool.destroyed) {
|
|
11451
|
+
pool.close();
|
|
11452
|
+
}
|
|
11453
|
+
};
|
|
11454
|
+
pool.on("disconnect", closePoolIfUnused);
|
|
11455
|
+
pool.on("connectionError", closePoolIfUnused);
|
|
11280
11456
|
}
|
|
11281
11457
|
return pool[kDispatch](opts, handler);
|
|
11282
11458
|
} catch (err) {
|
|
@@ -11381,10 +11557,10 @@ var require_proxy_agent = __commonJS({
|
|
|
11381
11557
|
};
|
|
11382
11558
|
const {
|
|
11383
11559
|
origin,
|
|
11384
|
-
path:
|
|
11560
|
+
path: path10 = "/",
|
|
11385
11561
|
headers = {}
|
|
11386
11562
|
} = opts;
|
|
11387
|
-
opts.path = origin +
|
|
11563
|
+
opts.path = origin + path10;
|
|
11388
11564
|
if (!("host" in headers) && !("Host" in headers)) {
|
|
11389
11565
|
const { host } = new URL(origin);
|
|
11390
11566
|
headers.host = host;
|
|
@@ -11661,7 +11837,7 @@ var require_env_http_proxy_agent = __commonJS({
|
|
|
11661
11837
|
}
|
|
11662
11838
|
#getProxyAgentForUrl(url) {
|
|
11663
11839
|
let { protocol, host: hostname, port } = url;
|
|
11664
|
-
hostname = hostname.replace(/:\d*$/, "").toLowerCase();
|
|
11840
|
+
hostname = hostname.replace(/:\d*$/, "").replace(/^\[(.+)\]$/, "$1").toLowerCase();
|
|
11665
11841
|
port = Number.parseInt(port, 10) || DEFAULT_PORTS[protocol] || 0;
|
|
11666
11842
|
if (!this.#shouldProxy(hostname, port)) {
|
|
11667
11843
|
return this[kNoProxyAgent];
|
|
@@ -11704,11 +11880,22 @@ var require_env_http_proxy_agent = __commonJS({
|
|
|
11704
11880
|
if (!entry) {
|
|
11705
11881
|
continue;
|
|
11706
11882
|
}
|
|
11707
|
-
|
|
11883
|
+
let hostname, port;
|
|
11884
|
+
const ipv6WithPort = entry.match(/^\[(.+)\]:(\d+)$/);
|
|
11885
|
+
if (ipv6WithPort) {
|
|
11886
|
+
hostname = ipv6WithPort[1];
|
|
11887
|
+
port = Number.parseInt(ipv6WithPort[2], 10);
|
|
11888
|
+
} else {
|
|
11889
|
+
const unbracketed = entry.replace(/^\[(.+)\]$/, "$1");
|
|
11890
|
+
const colonCount = (unbracketed.match(/:/g) || []).length;
|
|
11891
|
+
const parsed = colonCount === 1 && unbracketed.match(/^(.+):(\d+)$/);
|
|
11892
|
+
hostname = parsed ? parsed[1] : unbracketed;
|
|
11893
|
+
port = parsed ? Number.parseInt(parsed[2], 10) : 0;
|
|
11894
|
+
}
|
|
11708
11895
|
noProxyEntries.push({
|
|
11709
11896
|
// strip leading dot or asterisk with dot
|
|
11710
|
-
hostname:
|
|
11711
|
-
port
|
|
11897
|
+
hostname: hostname.replace(/^\*?\./, "").toLowerCase(),
|
|
11898
|
+
port
|
|
11712
11899
|
});
|
|
11713
11900
|
}
|
|
11714
11901
|
this.#noProxyValue = noProxyValue;
|
|
@@ -11744,6 +11931,23 @@ var require_retry_handler = __commonJS({
|
|
|
11744
11931
|
const retryTime = new Date(retryAfter).getTime();
|
|
11745
11932
|
return isNaN(retryTime) ? null : retryTime - Date.now();
|
|
11746
11933
|
}
|
|
11934
|
+
function validatePartialResponseContentLength(headers, range, statusCode, retryCount) {
|
|
11935
|
+
const contentLength = headers["content-length"];
|
|
11936
|
+
if (contentLength == null) {
|
|
11937
|
+
return;
|
|
11938
|
+
}
|
|
11939
|
+
if (!Number.isFinite(range.start) || !Number.isFinite(range.end)) {
|
|
11940
|
+
return;
|
|
11941
|
+
}
|
|
11942
|
+
const length = Number(contentLength);
|
|
11943
|
+
const expectedLength = range.end - range.start + 1;
|
|
11944
|
+
if (!Number.isFinite(length) || length !== expectedLength) {
|
|
11945
|
+
throw new RequestRetryError("Content-Length mismatch", statusCode, {
|
|
11946
|
+
headers,
|
|
11947
|
+
data: { count: retryCount }
|
|
11948
|
+
});
|
|
11949
|
+
}
|
|
11950
|
+
}
|
|
11747
11951
|
var RetryController = class {
|
|
11748
11952
|
constructor() {
|
|
11749
11953
|
this.target = null;
|
|
@@ -11913,6 +12117,10 @@ var require_retry_handler = __commonJS({
|
|
|
11913
12117
|
setTimeout(() => cb(null), retryTimeout);
|
|
11914
12118
|
}
|
|
11915
12119
|
onResponseStart(controller, statusCode, headers, statusMessage) {
|
|
12120
|
+
if (statusCode < 200) {
|
|
12121
|
+
this.handler.onResponseStart?.(this.controllerProxy, statusCode, headers, statusMessage);
|
|
12122
|
+
return;
|
|
12123
|
+
}
|
|
11916
12124
|
this.error = null;
|
|
11917
12125
|
this.retryCount += 1;
|
|
11918
12126
|
this.statusCode = statusCode;
|
|
@@ -11947,6 +12155,7 @@ var require_retry_handler = __commonJS({
|
|
|
11947
12155
|
data: { count: this.retryCount }
|
|
11948
12156
|
});
|
|
11949
12157
|
}
|
|
12158
|
+
validatePartialResponseContentLength(headers, contentRange, statusCode, this.retryCount);
|
|
11950
12159
|
const { start, size, end = size ? size - 1 : null } = contentRange;
|
|
11951
12160
|
assert(this.start === start, "content-range mismatch");
|
|
11952
12161
|
assert(this.end == null || this.end === end, "content-range mismatch");
|
|
@@ -11955,7 +12164,7 @@ var require_retry_handler = __commonJS({
|
|
|
11955
12164
|
if (this.end == null) {
|
|
11956
12165
|
if (statusCode === 206) {
|
|
11957
12166
|
const range = parseRangeHeader(headers["content-range"]);
|
|
11958
|
-
if (range == null) {
|
|
12167
|
+
if (range == null || range.end == null) {
|
|
11959
12168
|
this.headersSent = true;
|
|
11960
12169
|
this.handler.onResponseStart?.(
|
|
11961
12170
|
this.controllerProxy,
|
|
@@ -11965,6 +12174,7 @@ var require_retry_handler = __commonJS({
|
|
|
11965
12174
|
);
|
|
11966
12175
|
return;
|
|
11967
12176
|
}
|
|
12177
|
+
validatePartialResponseContentLength(headers, range, statusCode, this.retryCount);
|
|
11968
12178
|
const { start, size, end = size ? size - 1 : null } = range;
|
|
11969
12179
|
assert(
|
|
11970
12180
|
start != null && Number.isFinite(start),
|
|
@@ -11974,7 +12184,7 @@ var require_retry_handler = __commonJS({
|
|
|
11974
12184
|
this.start = start;
|
|
11975
12185
|
this.end = end;
|
|
11976
12186
|
}
|
|
11977
|
-
if (this.end == null) {
|
|
12187
|
+
if (this.end == null && this.opts.method !== "HEAD") {
|
|
11978
12188
|
const contentLength = headers["content-length"];
|
|
11979
12189
|
this.end = contentLength != null ? Number(contentLength) - 1 : null;
|
|
11980
12190
|
}
|
|
@@ -12175,7 +12385,6 @@ var require_readable = __commonJS({
|
|
|
12175
12385
|
var kContentLength = /* @__PURE__ */ Symbol("kContentLength");
|
|
12176
12386
|
var kUsed = /* @__PURE__ */ Symbol("kUsed");
|
|
12177
12387
|
var kBytesRead = /* @__PURE__ */ Symbol("kBytesRead");
|
|
12178
|
-
var kPreservedBuffer = /* @__PURE__ */ Symbol("kPreservedBuffer");
|
|
12179
12388
|
var noop = () => {
|
|
12180
12389
|
};
|
|
12181
12390
|
var BodyReadable = class extends Readable {
|
|
@@ -12414,21 +12623,6 @@ var require_readable = __commonJS({
|
|
|
12414
12623
|
*/
|
|
12415
12624
|
setEncoding(encoding) {
|
|
12416
12625
|
if (Buffer.isEncoding(encoding)) {
|
|
12417
|
-
const state = this._readableState;
|
|
12418
|
-
const buffer = state.buffer;
|
|
12419
|
-
if (buffer && state.length > 0) {
|
|
12420
|
-
const bufferIndex = state.bufferIndex ?? 0;
|
|
12421
|
-
const preserved = [];
|
|
12422
|
-
const source = typeof buffer.slice === "function" ? buffer.slice(bufferIndex) : buffer;
|
|
12423
|
-
for (const data of source) {
|
|
12424
|
-
if (Buffer.isBuffer(data)) {
|
|
12425
|
-
preserved.push(data);
|
|
12426
|
-
}
|
|
12427
|
-
}
|
|
12428
|
-
if (preserved.length > 0) {
|
|
12429
|
-
this[kPreservedBuffer] = (this[kPreservedBuffer] || []).concat(preserved);
|
|
12430
|
-
}
|
|
12431
|
-
}
|
|
12432
12626
|
super.setEncoding(encoding);
|
|
12433
12627
|
}
|
|
12434
12628
|
return this;
|
|
@@ -12479,13 +12673,7 @@ var require_readable = __commonJS({
|
|
|
12479
12673
|
return;
|
|
12480
12674
|
}
|
|
12481
12675
|
const { _readableState: state } = consume2.stream;
|
|
12482
|
-
|
|
12483
|
-
if (preserved && preserved.length > 0) {
|
|
12484
|
-
for (const chunk of preserved) {
|
|
12485
|
-
consumePush(consume2, chunk);
|
|
12486
|
-
}
|
|
12487
|
-
consume2.stream[kPreservedBuffer] = null;
|
|
12488
|
-
} else if (state.bufferIndex) {
|
|
12676
|
+
if (state.bufferIndex) {
|
|
12489
12677
|
const start = state.bufferIndex;
|
|
12490
12678
|
const end = state.buffer.length;
|
|
12491
12679
|
for (let n = start; n < end; n++) {
|
|
@@ -12496,13 +12684,17 @@ var require_readable = __commonJS({
|
|
|
12496
12684
|
consumePush(consume2, chunk);
|
|
12497
12685
|
}
|
|
12498
12686
|
}
|
|
12687
|
+
const decoder = state.decoder;
|
|
12688
|
+
if (decoder != null && decoder.lastNeed > 0) {
|
|
12689
|
+
consumePush(consume2, Buffer.from(decoder.lastChar.subarray(0, decoder.lastTotal - decoder.lastNeed)));
|
|
12690
|
+
}
|
|
12499
12691
|
if (state.endEmitted) {
|
|
12500
|
-
consumeEnd(
|
|
12501
|
-
|
|
12502
|
-
consume2.stream.on("end", function() {
|
|
12503
|
-
consumeEnd(this[kConsume], this._readableState.encoding);
|
|
12504
|
-
});
|
|
12692
|
+
consumeEnd(consume2, state.encoding);
|
|
12693
|
+
return;
|
|
12505
12694
|
}
|
|
12695
|
+
consume2.stream.on("end", function() {
|
|
12696
|
+
consumeEnd(this[kConsume], this._readableState.encoding);
|
|
12697
|
+
});
|
|
12506
12698
|
consume2.stream.resume();
|
|
12507
12699
|
while (consume2.stream.read() != null) {
|
|
12508
12700
|
}
|
|
@@ -12559,6 +12751,9 @@ var require_readable = __commonJS({
|
|
|
12559
12751
|
if (consume2.body === null) {
|
|
12560
12752
|
return;
|
|
12561
12753
|
}
|
|
12754
|
+
if (typeof chunk === "string") {
|
|
12755
|
+
chunk = Buffer.from(chunk, consume2.stream._readableState.encoding);
|
|
12756
|
+
}
|
|
12562
12757
|
consume2.length += chunk.length;
|
|
12563
12758
|
consume2.body.push(chunk);
|
|
12564
12759
|
}
|
|
@@ -13543,6 +13738,7 @@ var require_mock_utils = __commonJS({
|
|
|
13543
13738
|
}
|
|
13544
13739
|
} = require("node:util");
|
|
13545
13740
|
var { InvalidArgumentError } = require_errors();
|
|
13741
|
+
var requestAborted = /* @__PURE__ */ Symbol("request aborted");
|
|
13546
13742
|
function matchValue(match, value) {
|
|
13547
13743
|
if (typeof match === "string") {
|
|
13548
13744
|
return match === value;
|
|
@@ -13629,20 +13825,20 @@ var require_mock_utils = __commonJS({
|
|
|
13629
13825
|
}
|
|
13630
13826
|
return normalizedQp;
|
|
13631
13827
|
}
|
|
13632
|
-
function safeUrl(
|
|
13633
|
-
if (typeof
|
|
13634
|
-
return
|
|
13828
|
+
function safeUrl(path10) {
|
|
13829
|
+
if (typeof path10 !== "string") {
|
|
13830
|
+
return path10;
|
|
13635
13831
|
}
|
|
13636
|
-
const pathSegments =
|
|
13832
|
+
const pathSegments = path10.split("?", 3);
|
|
13637
13833
|
if (pathSegments.length !== 2) {
|
|
13638
|
-
return
|
|
13834
|
+
return path10;
|
|
13639
13835
|
}
|
|
13640
13836
|
const qp = new URLSearchParams(pathSegments.pop());
|
|
13641
13837
|
qp.sort();
|
|
13642
13838
|
return [...pathSegments, qp.toString()].join("?");
|
|
13643
13839
|
}
|
|
13644
|
-
function matchKey(mockDispatch2, { path:
|
|
13645
|
-
const pathMatch = matchValue(mockDispatch2.path,
|
|
13840
|
+
function matchKey(mockDispatch2, { path: path10, method, body, headers }) {
|
|
13841
|
+
const pathMatch = matchValue(mockDispatch2.path, path10);
|
|
13646
13842
|
const methodMatch = matchValue(mockDispatch2.method, method);
|
|
13647
13843
|
const bodyMatch = typeof mockDispatch2.body !== "undefined" ? matchValue(mockDispatch2.body, body) : true;
|
|
13648
13844
|
const headersMatch = matchHeaders(mockDispatch2, headers);
|
|
@@ -13655,6 +13851,8 @@ var require_mock_utils = __commonJS({
|
|
|
13655
13851
|
return data;
|
|
13656
13852
|
} else if (data instanceof ArrayBuffer) {
|
|
13657
13853
|
return data;
|
|
13854
|
+
} else if (ArrayBuffer.isView(data)) {
|
|
13855
|
+
return new Uint8Array(data.buffer, data.byteOffset, data.byteLength);
|
|
13658
13856
|
} else if (typeof data === "object") {
|
|
13659
13857
|
return JSON.stringify(data);
|
|
13660
13858
|
} else if (data) {
|
|
@@ -13667,8 +13865,8 @@ var require_mock_utils = __commonJS({
|
|
|
13667
13865
|
const basePath = key.query ? serializePathWithQuery(key.path, key.query) : key.path;
|
|
13668
13866
|
const resolvedPath = typeof basePath === "string" ? safeUrl(basePath) : basePath;
|
|
13669
13867
|
const resolvedPathWithoutTrailingSlash = removeTrailingSlash(resolvedPath);
|
|
13670
|
-
let matchedMockDispatches = mockDispatches.filter(({ consumed }) => !consumed).filter(({ path:
|
|
13671
|
-
return ignoreTrailingSlash ? matchValue(removeTrailingSlash(safeUrl(
|
|
13868
|
+
let matchedMockDispatches = mockDispatches.filter(({ consumed }) => !consumed).filter(({ path: path10, ignoreTrailingSlash }) => {
|
|
13869
|
+
return ignoreTrailingSlash ? matchValue(removeTrailingSlash(safeUrl(path10)), resolvedPathWithoutTrailingSlash) : matchValue(safeUrl(path10), resolvedPath);
|
|
13672
13870
|
});
|
|
13673
13871
|
if (matchedMockDispatches.length === 0) {
|
|
13674
13872
|
throw new MockNotMatchedError(`Mock dispatch not matched for path '${resolvedPath}'`);
|
|
@@ -13707,19 +13905,22 @@ var require_mock_utils = __commonJS({
|
|
|
13707
13905
|
mockDispatches.splice(index, 1);
|
|
13708
13906
|
}
|
|
13709
13907
|
}
|
|
13710
|
-
function removeTrailingSlash(
|
|
13711
|
-
|
|
13712
|
-
|
|
13908
|
+
function removeTrailingSlash(path10) {
|
|
13909
|
+
if (typeof path10 !== "string") {
|
|
13910
|
+
return path10;
|
|
13911
|
+
}
|
|
13912
|
+
while (path10.endsWith("/")) {
|
|
13913
|
+
path10 = path10.slice(0, -1);
|
|
13713
13914
|
}
|
|
13714
|
-
if (
|
|
13715
|
-
|
|
13915
|
+
if (path10.length === 0) {
|
|
13916
|
+
path10 = "/";
|
|
13716
13917
|
}
|
|
13717
|
-
return
|
|
13918
|
+
return path10;
|
|
13718
13919
|
}
|
|
13719
13920
|
function buildKey(opts) {
|
|
13720
|
-
const { path:
|
|
13921
|
+
const { path: path10, method, body, headers, query } = opts;
|
|
13721
13922
|
return {
|
|
13722
|
-
path:
|
|
13923
|
+
path: path10,
|
|
13723
13924
|
method,
|
|
13724
13925
|
body,
|
|
13725
13926
|
headers,
|
|
@@ -13761,30 +13962,38 @@ var require_mock_utils = __commonJS({
|
|
|
13761
13962
|
const { timesInvoked, times } = mockDispatch2;
|
|
13762
13963
|
mockDispatch2.consumed = !mockDispatch2.persist && timesInvoked >= times;
|
|
13763
13964
|
mockDispatch2.pending = timesInvoked < times;
|
|
13764
|
-
|
|
13765
|
-
|
|
13965
|
+
const hasBodyHooks = typeof handler.onBodySent === "function" || typeof handler.onRequestSent === "function";
|
|
13966
|
+
if (mockDispatch2.data.callback && (!hasBodyHooks || opts.body == null)) {
|
|
13967
|
+
const { callback, ...responseDefaults } = mockDispatch2.data;
|
|
13968
|
+
const callbackResult = callback(opts);
|
|
13766
13969
|
if (isPromise(callbackResult)) {
|
|
13767
13970
|
callbackResult.then(
|
|
13768
13971
|
(resolvedData) => {
|
|
13769
|
-
|
|
13972
|
+
if (resolvedData == null || typeof resolvedData !== "object") {
|
|
13973
|
+
handler.onResponseError(null, new InvalidArgumentError("reply options callback must return an object"));
|
|
13974
|
+
return;
|
|
13975
|
+
}
|
|
13976
|
+
mockDispatch2.data = { ...responseDefaults, ...resolvedData };
|
|
13770
13977
|
dispatchMockReply(mockDispatches, mockDispatch2, key, opts, handler);
|
|
13771
13978
|
},
|
|
13772
13979
|
(error2) => {
|
|
13773
|
-
deleteMockDispatch(mockDispatches, key);
|
|
13774
13980
|
handler.onResponseError(null, error2);
|
|
13775
13981
|
}
|
|
13776
13982
|
);
|
|
13777
13983
|
return true;
|
|
13778
13984
|
}
|
|
13779
|
-
|
|
13985
|
+
if (callbackResult == null || typeof callbackResult !== "object") {
|
|
13986
|
+
throw new InvalidArgumentError("reply options callback must return an object");
|
|
13987
|
+
}
|
|
13988
|
+
mockDispatch2.data = { ...responseDefaults, ...callbackResult };
|
|
13780
13989
|
}
|
|
13781
13990
|
return dispatchMockReply(mockDispatches, mockDispatch2, key, opts, handler);
|
|
13782
13991
|
}
|
|
13783
13992
|
function dispatchMockReply(mockDispatches, mockDispatch2, key, opts, handler) {
|
|
13784
|
-
const { data:
|
|
13785
|
-
if (
|
|
13993
|
+
const { data: response, delay } = mockDispatch2;
|
|
13994
|
+
if (response.error !== null) {
|
|
13786
13995
|
deleteMockDispatch(mockDispatches, key);
|
|
13787
|
-
handler.onResponseError(null,
|
|
13996
|
+
handler.onResponseError(null, response.error);
|
|
13788
13997
|
return true;
|
|
13789
13998
|
}
|
|
13790
13999
|
let aborted = false;
|
|
@@ -13811,30 +14020,91 @@ var require_mock_utils = __commonJS({
|
|
|
13811
14020
|
handler.onResponseError?.(controller, reason);
|
|
13812
14021
|
}
|
|
13813
14022
|
};
|
|
14023
|
+
let replyOpts = opts;
|
|
14024
|
+
const dispatches = mockDispatches;
|
|
13814
14025
|
handler.onRequestStart?.(controller, null);
|
|
13815
|
-
if (
|
|
13816
|
-
|
|
13817
|
-
|
|
13818
|
-
|
|
13819
|
-
|
|
13820
|
-
|
|
13821
|
-
|
|
14026
|
+
if (aborted) {
|
|
14027
|
+
return true;
|
|
14028
|
+
}
|
|
14029
|
+
const requestBody = dispatchRequestBody(opts.body, handler, controller, () => aborted);
|
|
14030
|
+
if (isPromise(requestBody)) {
|
|
14031
|
+
requestBody.then((body) => {
|
|
14032
|
+
if (body === requestAborted) {
|
|
14033
|
+
return;
|
|
14034
|
+
}
|
|
14035
|
+
if (body !== opts.body) {
|
|
14036
|
+
replyOpts = { ...opts, body };
|
|
14037
|
+
}
|
|
14038
|
+
sendReply();
|
|
14039
|
+
}, (error2) => controller.abort(error2));
|
|
14040
|
+
return true;
|
|
14041
|
+
}
|
|
14042
|
+
if (requestBody === requestAborted) {
|
|
14043
|
+
return true;
|
|
14044
|
+
}
|
|
14045
|
+
if (requestBody !== opts.body) {
|
|
14046
|
+
replyOpts = { ...opts, body: requestBody };
|
|
14047
|
+
}
|
|
14048
|
+
sendReply();
|
|
14049
|
+
function sendReply() {
|
|
14050
|
+
if (response.callback) {
|
|
14051
|
+
const { callback, ...responseDefaults } = response;
|
|
14052
|
+
let callbackResult;
|
|
14053
|
+
try {
|
|
14054
|
+
callbackResult = callback(replyOpts);
|
|
14055
|
+
} catch (err) {
|
|
14056
|
+
deleteMockDispatch(mockDispatches, key);
|
|
14057
|
+
handler.onResponseError(null, err);
|
|
14058
|
+
return;
|
|
14059
|
+
}
|
|
14060
|
+
if (isPromise(callbackResult)) {
|
|
14061
|
+
callbackResult.then(
|
|
14062
|
+
(resolvedData) => {
|
|
14063
|
+
if (resolvedData == null || typeof resolvedData !== "object") {
|
|
14064
|
+
handler.onResponseError(null, new InvalidArgumentError("reply options callback must return an object"));
|
|
14065
|
+
return;
|
|
14066
|
+
}
|
|
14067
|
+
mockDispatch2.data = { ...responseDefaults, ...resolvedData };
|
|
14068
|
+
handleReply(dispatches, mockDispatch2.data);
|
|
14069
|
+
},
|
|
14070
|
+
(err) => {
|
|
14071
|
+
handler.onResponseError(null, err);
|
|
14072
|
+
}
|
|
14073
|
+
);
|
|
14074
|
+
return;
|
|
14075
|
+
}
|
|
14076
|
+
if (callbackResult == null || typeof callbackResult !== "object") {
|
|
14077
|
+
throw new InvalidArgumentError("reply options callback must return an object");
|
|
14078
|
+
}
|
|
14079
|
+
mockDispatch2.data = { ...responseDefaults, ...callbackResult };
|
|
14080
|
+
handleReply(dispatches, mockDispatch2.data);
|
|
14081
|
+
return;
|
|
14082
|
+
}
|
|
14083
|
+
if (typeof delay === "number" && delay > 0) {
|
|
14084
|
+
timer = setTimeout(() => {
|
|
14085
|
+
timer = null;
|
|
14086
|
+
handleReply(dispatches);
|
|
14087
|
+
}, delay);
|
|
14088
|
+
} else {
|
|
14089
|
+
handleReply(dispatches);
|
|
14090
|
+
}
|
|
13822
14091
|
}
|
|
13823
|
-
function handleReply(mockDispatches2,
|
|
14092
|
+
function handleReply(mockDispatches2, _response = response) {
|
|
13824
14093
|
if (aborted) {
|
|
13825
14094
|
return;
|
|
13826
14095
|
}
|
|
14096
|
+
const { statusCode, data, headers, trailers } = _response;
|
|
13827
14097
|
const optsHeaders = Array.isArray(opts.headers) ? buildHeadersFromArray(opts.headers) : opts.headers;
|
|
13828
|
-
const body = typeof
|
|
14098
|
+
const body = typeof data === "function" ? data({ ...replyOpts, headers: optsHeaders }) : data;
|
|
13829
14099
|
if (isPromise(body)) {
|
|
13830
|
-
return body.then((newData) => handleReply(mockDispatches2, newData));
|
|
14100
|
+
return body.then((newData) => handleReply(mockDispatches2, { ..._response, data: newData }));
|
|
13831
14101
|
}
|
|
13832
14102
|
if (aborted) {
|
|
13833
14103
|
return;
|
|
13834
14104
|
}
|
|
13835
14105
|
const responseData = getResponseData(body);
|
|
13836
|
-
const responseHeaders = generateKeyValues(headers);
|
|
13837
|
-
const responseTrailers = generateKeyValues(trailers);
|
|
14106
|
+
const responseHeaders = generateKeyValues(headers ?? {});
|
|
14107
|
+
const responseTrailers = generateKeyValues(trailers ?? {});
|
|
13838
14108
|
controller.rawHeaders = responseHeaders;
|
|
13839
14109
|
controller.rawTrailers = responseTrailers;
|
|
13840
14110
|
handler.onResponseStart?.(controller, statusCode, parseHeaders(responseHeaders), getStatusText(statusCode));
|
|
@@ -13844,6 +14114,78 @@ var require_mock_utils = __commonJS({
|
|
|
13844
14114
|
}
|
|
13845
14115
|
return true;
|
|
13846
14116
|
}
|
|
14117
|
+
function dispatchRequestBody(body, handler, controller, isAborted) {
|
|
14118
|
+
if (typeof handler.onBodySent !== "function" && typeof handler.onRequestSent !== "function") {
|
|
14119
|
+
return body;
|
|
14120
|
+
}
|
|
14121
|
+
if (body == null) {
|
|
14122
|
+
return callOnRequestSent(handler, controller, isAborted) ? body : requestAborted;
|
|
14123
|
+
}
|
|
14124
|
+
if (body && typeof body[Symbol.asyncIterator] === "function") {
|
|
14125
|
+
return dispatchAsyncIterableBody(body, handler, controller, isAborted);
|
|
14126
|
+
}
|
|
14127
|
+
if (isIterableBody(body)) {
|
|
14128
|
+
const chunks = [];
|
|
14129
|
+
for (const chunk of body) {
|
|
14130
|
+
if (isAborted()) {
|
|
14131
|
+
return requestAborted;
|
|
14132
|
+
}
|
|
14133
|
+
chunks.push(chunk);
|
|
14134
|
+
if (!callOnBodySent(handler, controller, chunk) || isAborted()) {
|
|
14135
|
+
return requestAborted;
|
|
14136
|
+
}
|
|
14137
|
+
}
|
|
14138
|
+
return callOnRequestSent(handler, controller, isAborted) ? chunks : requestAborted;
|
|
14139
|
+
}
|
|
14140
|
+
if (isAborted()) {
|
|
14141
|
+
return requestAborted;
|
|
14142
|
+
}
|
|
14143
|
+
if (!callOnBodySent(handler, controller, body)) {
|
|
14144
|
+
return requestAborted;
|
|
14145
|
+
}
|
|
14146
|
+
return callOnRequestSent(handler, controller, isAborted) ? body : requestAborted;
|
|
14147
|
+
}
|
|
14148
|
+
async function dispatchAsyncIterableBody(body, handler, controller, isAborted) {
|
|
14149
|
+
const chunks = [];
|
|
14150
|
+
for await (const chunk of body) {
|
|
14151
|
+
if (isAborted()) {
|
|
14152
|
+
return requestAborted;
|
|
14153
|
+
}
|
|
14154
|
+
chunks.push(chunk);
|
|
14155
|
+
if (!callOnBodySent(handler, controller, chunk) || isAborted()) {
|
|
14156
|
+
return requestAborted;
|
|
14157
|
+
}
|
|
14158
|
+
}
|
|
14159
|
+
if (!callOnRequestSent(handler, controller, isAborted)) {
|
|
14160
|
+
return requestAborted;
|
|
14161
|
+
}
|
|
14162
|
+
return {
|
|
14163
|
+
async *[Symbol.asyncIterator]() {
|
|
14164
|
+
yield* chunks;
|
|
14165
|
+
}
|
|
14166
|
+
};
|
|
14167
|
+
}
|
|
14168
|
+
function callOnBodySent(handler, controller, chunk) {
|
|
14169
|
+
try {
|
|
14170
|
+
handler.onBodySent?.(chunk);
|
|
14171
|
+
return true;
|
|
14172
|
+
} catch (error2) {
|
|
14173
|
+
controller.abort(error2);
|
|
14174
|
+
return false;
|
|
14175
|
+
}
|
|
14176
|
+
}
|
|
14177
|
+
function callOnRequestSent(handler, controller, isAborted) {
|
|
14178
|
+
try {
|
|
14179
|
+
handler.onRequestSent?.();
|
|
14180
|
+
return !isAborted();
|
|
14181
|
+
} catch (error2) {
|
|
14182
|
+
controller.abort(error2);
|
|
14183
|
+
return false;
|
|
14184
|
+
}
|
|
14185
|
+
}
|
|
14186
|
+
function isIterableBody(body) {
|
|
14187
|
+
return typeof body !== "string" && !Buffer.isBuffer(body) && !ArrayBuffer.isView(body) && typeof body[Symbol.iterator] === "function";
|
|
14188
|
+
}
|
|
13847
14189
|
function buildMockDispatch() {
|
|
13848
14190
|
const agent = this[kMockAgent];
|
|
13849
14191
|
const origin = this[kOrigin];
|
|
@@ -14449,10 +14791,10 @@ var require_pending_interceptors_formatter = __commonJS({
|
|
|
14449
14791
|
}
|
|
14450
14792
|
format(pendingInterceptors) {
|
|
14451
14793
|
const withPrettyHeaders = pendingInterceptors.map(
|
|
14452
|
-
({ method, path:
|
|
14794
|
+
({ method, path: path10, data: { statusCode }, persist, times, timesInvoked, origin }) => ({
|
|
14453
14795
|
Method: method,
|
|
14454
14796
|
Origin: origin,
|
|
14455
|
-
Path:
|
|
14797
|
+
Path: path10,
|
|
14456
14798
|
"Status code": statusCode,
|
|
14457
14799
|
Persistent: persist ? PERSISTENT : NOT_PERSISTENT,
|
|
14458
14800
|
Invocations: timesInvoked,
|
|
@@ -14534,9 +14876,9 @@ var require_mock_agent = __commonJS({
|
|
|
14534
14876
|
const acceptNonStandardSearchParameters = this[kMockAgentAcceptsNonStandardSearchParameters];
|
|
14535
14877
|
const dispatchOpts = { ...opts };
|
|
14536
14878
|
if (acceptNonStandardSearchParameters && dispatchOpts.path) {
|
|
14537
|
-
const [
|
|
14879
|
+
const [path10, searchParams] = dispatchOpts.path.split("?");
|
|
14538
14880
|
const normalizedSearchParams = normalizeSearchParams(searchParams, acceptNonStandardSearchParameters);
|
|
14539
|
-
dispatchOpts.path = `${
|
|
14881
|
+
dispatchOpts.path = `${path10}?${normalizedSearchParams}`;
|
|
14540
14882
|
}
|
|
14541
14883
|
return this[kAgent].dispatch(dispatchOpts, handler);
|
|
14542
14884
|
}
|
|
@@ -14952,12 +15294,12 @@ var require_snapshot_recorder = __commonJS({
|
|
|
14952
15294
|
* @return {Promise<void>} - Resolves when snapshots are loaded
|
|
14953
15295
|
*/
|
|
14954
15296
|
async loadSnapshots(filePath) {
|
|
14955
|
-
const
|
|
14956
|
-
if (!
|
|
15297
|
+
const path10 = filePath || this.#snapshotPath;
|
|
15298
|
+
if (!path10) {
|
|
14957
15299
|
throw new InvalidArgumentError("Snapshot path is required");
|
|
14958
15300
|
}
|
|
14959
15301
|
try {
|
|
14960
|
-
const data = await readFile(resolve3(
|
|
15302
|
+
const data = await readFile(resolve3(path10), "utf8");
|
|
14961
15303
|
const parsed = JSON.parse(data);
|
|
14962
15304
|
if (Array.isArray(parsed)) {
|
|
14963
15305
|
this.#snapshots.clear();
|
|
@@ -14971,7 +15313,7 @@ var require_snapshot_recorder = __commonJS({
|
|
|
14971
15313
|
if (error2.code === "ENOENT") {
|
|
14972
15314
|
this.#snapshots.clear();
|
|
14973
15315
|
} else {
|
|
14974
|
-
throw new UndiciError(`Failed to load snapshots from ${
|
|
15316
|
+
throw new UndiciError(`Failed to load snapshots from ${path10}`, { cause: error2 });
|
|
14975
15317
|
}
|
|
14976
15318
|
}
|
|
14977
15319
|
}
|
|
@@ -14982,11 +15324,11 @@ var require_snapshot_recorder = __commonJS({
|
|
|
14982
15324
|
* @returns {Promise<void>} - Resolves when snapshots are saved
|
|
14983
15325
|
*/
|
|
14984
15326
|
async saveSnapshots(filePath) {
|
|
14985
|
-
const
|
|
14986
|
-
if (!
|
|
15327
|
+
const path10 = filePath || this.#snapshotPath;
|
|
15328
|
+
if (!path10) {
|
|
14987
15329
|
throw new InvalidArgumentError("Snapshot path is required");
|
|
14988
15330
|
}
|
|
14989
|
-
const resolvedPath = resolve3(
|
|
15331
|
+
const resolvedPath = resolve3(path10);
|
|
14990
15332
|
await mkdir3(dirname5(resolvedPath), { recursive: true });
|
|
14991
15333
|
const data = Array.from(this.#snapshots.entries()).map(([hash, snapshot]) => ({
|
|
14992
15334
|
hash,
|
|
@@ -15435,6 +15777,7 @@ var require_global2 = __commonJS({
|
|
|
15435
15777
|
var { InvalidArgumentError } = require_errors();
|
|
15436
15778
|
var Agent3 = require_agent();
|
|
15437
15779
|
var Dispatcher1Wrapper = require_dispatcher1_wrapper();
|
|
15780
|
+
var fallbackDispatcher;
|
|
15438
15781
|
if (getGlobalDispatcher() === void 0) {
|
|
15439
15782
|
setGlobalDispatcher(new Agent3());
|
|
15440
15783
|
}
|
|
@@ -15442,22 +15785,36 @@ var require_global2 = __commonJS({
|
|
|
15442
15785
|
if (!agent || typeof agent.dispatch !== "function") {
|
|
15443
15786
|
throw new InvalidArgumentError("Argument agent must implement Agent");
|
|
15444
15787
|
}
|
|
15445
|
-
|
|
15446
|
-
|
|
15447
|
-
|
|
15448
|
-
|
|
15449
|
-
|
|
15450
|
-
|
|
15451
|
-
|
|
15452
|
-
|
|
15453
|
-
|
|
15454
|
-
|
|
15455
|
-
|
|
15456
|
-
|
|
15457
|
-
|
|
15788
|
+
try {
|
|
15789
|
+
Object.defineProperty(globalThis, globalDispatcher, {
|
|
15790
|
+
value: agent,
|
|
15791
|
+
writable: true,
|
|
15792
|
+
enumerable: false,
|
|
15793
|
+
configurable: false
|
|
15794
|
+
});
|
|
15795
|
+
} catch (err) {
|
|
15796
|
+
if (err instanceof TypeError) {
|
|
15797
|
+
fallbackDispatcher = agent;
|
|
15798
|
+
return;
|
|
15799
|
+
}
|
|
15800
|
+
throw err;
|
|
15801
|
+
}
|
|
15802
|
+
try {
|
|
15803
|
+
const legacyAgent = agent instanceof Dispatcher1Wrapper ? agent : new Dispatcher1Wrapper(agent);
|
|
15804
|
+
Object.defineProperty(globalThis, legacyGlobalDispatcher, {
|
|
15805
|
+
value: legacyAgent,
|
|
15806
|
+
writable: true,
|
|
15807
|
+
enumerable: false,
|
|
15808
|
+
configurable: false
|
|
15809
|
+
});
|
|
15810
|
+
} catch (err) {
|
|
15811
|
+
if (!(err instanceof TypeError)) {
|
|
15812
|
+
throw err;
|
|
15813
|
+
}
|
|
15814
|
+
}
|
|
15458
15815
|
}
|
|
15459
15816
|
function getGlobalDispatcher() {
|
|
15460
|
-
return globalThis[globalDispatcher];
|
|
15817
|
+
return globalThis[globalDispatcher] ?? fallbackDispatcher;
|
|
15461
15818
|
}
|
|
15462
15819
|
var installedExports = (
|
|
15463
15820
|
/** @type {const} */
|
|
@@ -15608,15 +15965,15 @@ var require_redirect_handler = __commonJS({
|
|
|
15608
15965
|
return;
|
|
15609
15966
|
}
|
|
15610
15967
|
const { origin, pathname, search } = util.parseURL(new URL(this.location, this.opts.origin && new URL(this.opts.path, this.opts.origin)));
|
|
15611
|
-
const
|
|
15612
|
-
const redirectUrlString = `${origin}${
|
|
15968
|
+
const path10 = search ? `${pathname}${search}` : pathname;
|
|
15969
|
+
const redirectUrlString = `${origin}${path10}`;
|
|
15613
15970
|
for (const historyUrl of this.history) {
|
|
15614
15971
|
if (historyUrl.toString() === redirectUrlString) {
|
|
15615
15972
|
throw new InvalidArgumentError(`Redirect loop detected. Cannot redirect to ${origin}. This typically happens when using a Client or Pool with cross-origin redirects. Use an Agent for cross-origin redirects.`);
|
|
15616
15973
|
}
|
|
15617
15974
|
}
|
|
15618
15975
|
this.opts.headers = cleanRequestHeaders(this.opts.headers, removeContentHeaders, this.opts.origin !== origin, this.stripHeadersOnRedirect, this.stripHeadersOnCrossOriginRedirect);
|
|
15619
|
-
this.opts.path =
|
|
15976
|
+
this.opts.path = path10;
|
|
15620
15977
|
this.opts.origin = origin;
|
|
15621
15978
|
this.opts.query = null;
|
|
15622
15979
|
}
|
|
@@ -16356,24 +16713,146 @@ var require_cache = __commonJS({
|
|
|
16356
16713
|
var {
|
|
16357
16714
|
safeHTTPMethods,
|
|
16358
16715
|
pathHasQueryOrFragment,
|
|
16359
|
-
hasSafeIterator
|
|
16716
|
+
hasSafeIterator,
|
|
16717
|
+
isValidHTTPToken
|
|
16360
16718
|
} = require_util();
|
|
16361
16719
|
var { serializePathWithQuery } = require_util();
|
|
16362
|
-
|
|
16363
|
-
|
|
16364
|
-
|
|
16720
|
+
var MAX_DELTA_SECONDS = 2147483647;
|
|
16721
|
+
var RESTRICTIVE_DIRECTIVE_NAMES = ["no-store", "private", "no-cache"];
|
|
16722
|
+
var kInvalidCacheControlDirectives = /* @__PURE__ */ Symbol("invalid cache-control directives");
|
|
16723
|
+
function trimOWS(value) {
|
|
16724
|
+
return value.replace(/^[\t ]+|[\t ]+$/g, "");
|
|
16725
|
+
}
|
|
16726
|
+
function arrayIncludes(array, value) {
|
|
16727
|
+
for (let i = 0; i < array.length; i++) {
|
|
16728
|
+
if (array[i] === value) {
|
|
16729
|
+
return true;
|
|
16730
|
+
}
|
|
16731
|
+
}
|
|
16732
|
+
return false;
|
|
16733
|
+
}
|
|
16734
|
+
function trimOWSStart(value) {
|
|
16735
|
+
return value.replace(/^[\t ]+/, "");
|
|
16736
|
+
}
|
|
16737
|
+
function trimOWSEnd(value) {
|
|
16738
|
+
return value.replace(/[\t ]+$/, "");
|
|
16739
|
+
}
|
|
16740
|
+
function findUnescapedQuote(value, start) {
|
|
16741
|
+
let escaped = false;
|
|
16742
|
+
for (let i = start; i < value.length; i++) {
|
|
16743
|
+
if (escaped) {
|
|
16744
|
+
escaped = false;
|
|
16745
|
+
} else if (value[i] === "\\") {
|
|
16746
|
+
escaped = true;
|
|
16747
|
+
} else if (value[i] === '"') {
|
|
16748
|
+
return i;
|
|
16749
|
+
}
|
|
16365
16750
|
}
|
|
16751
|
+
return -1;
|
|
16752
|
+
}
|
|
16753
|
+
function splitCacheControlHeaderValue(value) {
|
|
16754
|
+
const directives = [];
|
|
16755
|
+
let start = 0;
|
|
16756
|
+
let quoteStart = -1;
|
|
16757
|
+
let inQuote = false;
|
|
16758
|
+
let escaped = false;
|
|
16759
|
+
for (let i = 0; i < value.length; i++) {
|
|
16760
|
+
if (inQuote) {
|
|
16761
|
+
if (escaped) {
|
|
16762
|
+
escaped = false;
|
|
16763
|
+
} else if (value[i] === "\\") {
|
|
16764
|
+
escaped = true;
|
|
16765
|
+
} else if (value[i] === '"') {
|
|
16766
|
+
inQuote = false;
|
|
16767
|
+
quoteStart = -1;
|
|
16768
|
+
}
|
|
16769
|
+
} else if (value[i] === '"') {
|
|
16770
|
+
inQuote = true;
|
|
16771
|
+
quoteStart = i;
|
|
16772
|
+
} else if (value[i] === ",") {
|
|
16773
|
+
directives.push({ value: value.substring(start, i), fromMalformedQuote: false });
|
|
16774
|
+
start = i + 1;
|
|
16775
|
+
}
|
|
16776
|
+
}
|
|
16777
|
+
if (!inQuote) {
|
|
16778
|
+
directives.push({ value: value.substring(start), fromMalformedQuote: false });
|
|
16779
|
+
return directives;
|
|
16780
|
+
}
|
|
16781
|
+
const tail = value.substring(start);
|
|
16782
|
+
const quoteOffset = quoteStart - start;
|
|
16783
|
+
let tailStart = 0;
|
|
16784
|
+
for (let i = 0; i < tail.length; i++) {
|
|
16785
|
+
if (tail[i] === ",") {
|
|
16786
|
+
directives.push({
|
|
16787
|
+
value: tail.substring(tailStart, i),
|
|
16788
|
+
fromMalformedQuote: tailStart > quoteOffset
|
|
16789
|
+
});
|
|
16790
|
+
tailStart = i + 1;
|
|
16791
|
+
}
|
|
16792
|
+
}
|
|
16793
|
+
directives.push({
|
|
16794
|
+
value: tail.substring(tailStart),
|
|
16795
|
+
fromMalformedQuote: tailStart > quoteOffset
|
|
16796
|
+
});
|
|
16797
|
+
return directives;
|
|
16798
|
+
}
|
|
16799
|
+
function markInvalidCacheControlDirective(directives, key) {
|
|
16800
|
+
let invalidDirectives = directives[kInvalidCacheControlDirectives];
|
|
16801
|
+
if (invalidDirectives === void 0) {
|
|
16802
|
+
invalidDirectives = /* @__PURE__ */ new Set();
|
|
16803
|
+
Object.defineProperty(directives, kInvalidCacheControlDirectives, {
|
|
16804
|
+
value: invalidDirectives
|
|
16805
|
+
});
|
|
16806
|
+
}
|
|
16807
|
+
invalidDirectives.add(key);
|
|
16808
|
+
}
|
|
16809
|
+
function hasInvalidCacheControlDirective(directives, key) {
|
|
16810
|
+
return directives[kInvalidCacheControlDirectives]?.has(key) === true;
|
|
16811
|
+
}
|
|
16812
|
+
function getMalformedRestrictiveDirectiveName(key) {
|
|
16813
|
+
for (const directiveName of RESTRICTIVE_DIRECTIVE_NAMES) {
|
|
16814
|
+
if (key.startsWith(directiveName) && key.length > directiveName.length && !isValidHTTPToken(key[directiveName.length])) {
|
|
16815
|
+
return directiveName;
|
|
16816
|
+
}
|
|
16817
|
+
}
|
|
16818
|
+
let tokenOnlyKey = "";
|
|
16819
|
+
let hasInvalidTokenChar = false;
|
|
16820
|
+
for (let i = 0; i < key.length; i++) {
|
|
16821
|
+
if (isValidHTTPToken(key[i])) {
|
|
16822
|
+
tokenOnlyKey += key[i];
|
|
16823
|
+
} else {
|
|
16824
|
+
hasInvalidTokenChar = true;
|
|
16825
|
+
}
|
|
16826
|
+
}
|
|
16827
|
+
if (hasInvalidTokenChar && arrayIncludes(RESTRICTIVE_DIRECTIVE_NAMES, tokenOnlyKey)) {
|
|
16828
|
+
return tokenOnlyKey;
|
|
16829
|
+
}
|
|
16830
|
+
}
|
|
16831
|
+
function makeCacheKey(opts) {
|
|
16832
|
+
const origin = opts.origin ? opts.origin.toString() : "";
|
|
16366
16833
|
let fullPath = opts.path || "/";
|
|
16367
16834
|
if (opts.query && !pathHasQueryOrFragment(fullPath)) {
|
|
16368
16835
|
fullPath = serializePathWithQuery(fullPath, opts.query);
|
|
16369
16836
|
}
|
|
16370
16837
|
return {
|
|
16371
|
-
origin
|
|
16838
|
+
origin,
|
|
16372
16839
|
method: opts.method,
|
|
16373
16840
|
path: fullPath,
|
|
16374
16841
|
headers: opts.headers
|
|
16375
16842
|
};
|
|
16376
16843
|
}
|
|
16844
|
+
function appendHeader(headers, key, val) {
|
|
16845
|
+
const headerName = key.toLowerCase();
|
|
16846
|
+
const current = headers[headerName];
|
|
16847
|
+
const values = Array.isArray(val) ? val : [val];
|
|
16848
|
+
if (current === void 0) {
|
|
16849
|
+
headers[headerName] = Array.isArray(val) ? val.slice() : val;
|
|
16850
|
+
} else if (Array.isArray(current)) {
|
|
16851
|
+
current.push(...values);
|
|
16852
|
+
} else {
|
|
16853
|
+
headers[headerName] = [current, ...values];
|
|
16854
|
+
}
|
|
16855
|
+
}
|
|
16377
16856
|
function normalizeHeaders(opts) {
|
|
16378
16857
|
let headers;
|
|
16379
16858
|
if (opts.headers == null) {
|
|
@@ -16392,7 +16871,7 @@ var require_cache = __commonJS({
|
|
|
16392
16871
|
if (typeof key !== "string" || typeof val !== "string") {
|
|
16393
16872
|
throw new Error("opts.headers is not a valid header map");
|
|
16394
16873
|
}
|
|
16395
|
-
headers
|
|
16874
|
+
appendHeader(headers, key, val);
|
|
16396
16875
|
}
|
|
16397
16876
|
} else {
|
|
16398
16877
|
const len = opts.headers.length;
|
|
@@ -16406,14 +16885,14 @@ var require_cache = __commonJS({
|
|
|
16406
16885
|
throw new Error("opts.headers is not a valid header map");
|
|
16407
16886
|
}
|
|
16408
16887
|
if (typeof val === "string") {
|
|
16409
|
-
headers
|
|
16888
|
+
appendHeader(headers, key, val);
|
|
16410
16889
|
} else {
|
|
16411
16890
|
const mapped = [];
|
|
16412
16891
|
for (let j = 0; j < val.length; j++) {
|
|
16413
16892
|
const v = val[j];
|
|
16414
16893
|
mapped.push(typeof v === "string" ? v : v.toString("latin1"));
|
|
16415
16894
|
}
|
|
16416
|
-
headers
|
|
16895
|
+
appendHeader(headers, key, mapped);
|
|
16417
16896
|
}
|
|
16418
16897
|
}
|
|
16419
16898
|
}
|
|
@@ -16426,12 +16905,12 @@ var require_cache = __commonJS({
|
|
|
16426
16905
|
if (typeof key !== "string" || typeof val !== "string") {
|
|
16427
16906
|
throw new Error("opts.headers is not a valid header map");
|
|
16428
16907
|
}
|
|
16429
|
-
headers
|
|
16908
|
+
appendHeader(headers, key, val);
|
|
16430
16909
|
}
|
|
16431
16910
|
}
|
|
16432
16911
|
} else {
|
|
16433
16912
|
for (const key of Object.keys(opts.headers)) {
|
|
16434
|
-
headers
|
|
16913
|
+
appendHeader(headers, key, opts.headers[key]);
|
|
16435
16914
|
}
|
|
16436
16915
|
}
|
|
16437
16916
|
} else {
|
|
@@ -16476,25 +16955,32 @@ var require_cache = __commonJS({
|
|
|
16476
16955
|
}
|
|
16477
16956
|
function parseCacheControlHeader(header) {
|
|
16478
16957
|
const output = {};
|
|
16479
|
-
|
|
16480
|
-
|
|
16481
|
-
|
|
16482
|
-
for (const directive of header) {
|
|
16483
|
-
directives.push(...directive.split(","));
|
|
16484
|
-
}
|
|
16485
|
-
} else {
|
|
16486
|
-
directives = header.split(",");
|
|
16487
|
-
}
|
|
16958
|
+
const invalidNumericDirectives = /* @__PURE__ */ new Set();
|
|
16959
|
+
const invalidNoArgumentDirectives = /* @__PURE__ */ new Set();
|
|
16960
|
+
const directives = splitCacheControlHeaderValue(Array.isArray(header) ? header.join(",") : header);
|
|
16488
16961
|
for (let i = 0; i < directives.length; i++) {
|
|
16489
|
-
const
|
|
16962
|
+
const directiveRecord = directives[i];
|
|
16963
|
+
const directive = directiveRecord.value.toLowerCase();
|
|
16964
|
+
const fromMalformedQuote = directiveRecord.fromMalformedQuote;
|
|
16490
16965
|
const keyValueDelimiter = directive.indexOf("=");
|
|
16491
16966
|
let key;
|
|
16492
16967
|
let value;
|
|
16968
|
+
let keyHasTrailingWhitespace = false;
|
|
16969
|
+
let valueHasLeadingWhitespace = false;
|
|
16493
16970
|
if (keyValueDelimiter !== -1) {
|
|
16494
|
-
|
|
16495
|
-
|
|
16971
|
+
const rawKey = directive.substring(0, keyValueDelimiter);
|
|
16972
|
+
const rawValue = directive.substring(keyValueDelimiter + 1);
|
|
16973
|
+
keyHasTrailingWhitespace = trimOWSEnd(rawKey) !== rawKey;
|
|
16974
|
+
valueHasLeadingWhitespace = trimOWSStart(rawValue) !== rawValue;
|
|
16975
|
+
key = trimOWS(rawKey);
|
|
16976
|
+
value = trimOWSStart(rawValue);
|
|
16496
16977
|
} else {
|
|
16497
|
-
key = directive
|
|
16978
|
+
key = trimOWS(directive);
|
|
16979
|
+
}
|
|
16980
|
+
const malformedRestrictiveDirectiveName = getMalformedRestrictiveDirectiveName(key);
|
|
16981
|
+
if (malformedRestrictiveDirectiveName !== void 0) {
|
|
16982
|
+
output[malformedRestrictiveDirectiveName] = true;
|
|
16983
|
+
continue;
|
|
16498
16984
|
}
|
|
16499
16985
|
switch (key) {
|
|
16500
16986
|
case "min-fresh":
|
|
@@ -16503,48 +16989,85 @@ var require_cache = __commonJS({
|
|
|
16503
16989
|
case "s-maxage":
|
|
16504
16990
|
case "stale-while-revalidate":
|
|
16505
16991
|
case "stale-if-error": {
|
|
16506
|
-
if (
|
|
16992
|
+
if (fromMalformedQuote || invalidNumericDirectives.has(key)) {
|
|
16993
|
+
continue;
|
|
16994
|
+
}
|
|
16995
|
+
if (value === void 0 || keyHasTrailingWhitespace || valueHasLeadingWhitespace) {
|
|
16996
|
+
delete output[key];
|
|
16997
|
+
invalidNumericDirectives.add(key);
|
|
16998
|
+
markInvalidCacheControlDirective(output, key);
|
|
16507
16999
|
continue;
|
|
16508
17000
|
}
|
|
16509
17001
|
if (value.length >= 2 && value[0] === '"' && value[value.length - 1] === '"') {
|
|
16510
17002
|
value = value.substring(1, value.length - 1);
|
|
16511
17003
|
}
|
|
16512
|
-
|
|
16513
|
-
|
|
17004
|
+
if (!/^[0-9]+$/.test(value)) {
|
|
17005
|
+
delete output[key];
|
|
17006
|
+
invalidNumericDirectives.add(key);
|
|
17007
|
+
markInvalidCacheControlDirective(output, key);
|
|
16514
17008
|
continue;
|
|
16515
17009
|
}
|
|
16516
|
-
|
|
16517
|
-
|
|
17010
|
+
const parsedValue = Math.min(parseInt(value, 10), MAX_DELTA_SECONDS);
|
|
17011
|
+
if (key === "min-fresh") {
|
|
17012
|
+
if (!(key in output) || output[key] < parsedValue) {
|
|
17013
|
+
output[key] = parsedValue;
|
|
17014
|
+
}
|
|
17015
|
+
} else if (!(key in output) || output[key] > parsedValue) {
|
|
17016
|
+
output[key] = parsedValue;
|
|
16518
17017
|
}
|
|
16519
|
-
output[key] = parsedValue;
|
|
16520
17018
|
break;
|
|
16521
17019
|
}
|
|
16522
17020
|
case "private":
|
|
16523
17021
|
case "no-cache": {
|
|
17022
|
+
if (fromMalformedQuote) {
|
|
17023
|
+
output[key] = true;
|
|
17024
|
+
break;
|
|
17025
|
+
}
|
|
17026
|
+
if (value !== void 0 && value.length === 0) {
|
|
17027
|
+
output[key] = true;
|
|
17028
|
+
break;
|
|
17029
|
+
}
|
|
16524
17030
|
if (value) {
|
|
16525
17031
|
if (value[0] === '"') {
|
|
16526
|
-
|
|
16527
|
-
let
|
|
16528
|
-
|
|
17032
|
+
value = trimOWSEnd(value);
|
|
17033
|
+
let fieldList = "";
|
|
17034
|
+
let lastQuotedPart = i;
|
|
17035
|
+
let foundEndingQuote = false;
|
|
17036
|
+
const closingQuote = findUnescapedQuote(value, 1);
|
|
17037
|
+
if (closingQuote !== -1) {
|
|
17038
|
+
fieldList = value.substring(1, closingQuote);
|
|
17039
|
+
foundEndingQuote = true;
|
|
17040
|
+
} else {
|
|
17041
|
+
const fieldListParts = [value.substring(1)];
|
|
16529
17042
|
for (let j = i + 1; j < directives.length; j++) {
|
|
16530
|
-
const nextPart = directives[j];
|
|
16531
|
-
const
|
|
16532
|
-
|
|
16533
|
-
if (
|
|
17043
|
+
const nextPart = trimOWS(directives[j].value);
|
|
17044
|
+
const closingQuote2 = findUnescapedQuote(nextPart, 0);
|
|
17045
|
+
lastQuotedPart = j;
|
|
17046
|
+
if (closingQuote2 !== -1) {
|
|
17047
|
+
fieldListParts.push(nextPart.substring(0, closingQuote2));
|
|
16534
17048
|
foundEndingQuote = true;
|
|
16535
17049
|
break;
|
|
16536
17050
|
}
|
|
17051
|
+
fieldListParts.push(nextPart);
|
|
16537
17052
|
}
|
|
17053
|
+
fieldList = fieldListParts.join(",");
|
|
16538
17054
|
}
|
|
16539
|
-
if (foundEndingQuote) {
|
|
16540
|
-
|
|
16541
|
-
|
|
16542
|
-
|
|
16543
|
-
|
|
16544
|
-
|
|
16545
|
-
|
|
16546
|
-
|
|
17055
|
+
if (!foundEndingQuote) {
|
|
17056
|
+
output[key] = true;
|
|
17057
|
+
break;
|
|
17058
|
+
}
|
|
17059
|
+
i = lastQuotedPart;
|
|
17060
|
+
const headers = fieldList.split(",");
|
|
17061
|
+
let validFieldNames = true;
|
|
17062
|
+
for (let j = 0; j < headers.length; j++) {
|
|
17063
|
+
headers[j] = trimOWS(headers[j]);
|
|
17064
|
+
if (!isValidHTTPToken(headers[j])) {
|
|
17065
|
+
validFieldNames = false;
|
|
16547
17066
|
}
|
|
17067
|
+
}
|
|
17068
|
+
if (!validFieldNames) {
|
|
17069
|
+
output[key] = true;
|
|
17070
|
+
} else if (output[key] !== true) {
|
|
16548
17071
|
if (key in output) {
|
|
16549
17072
|
output[key] = output[key].concat(headers);
|
|
16550
17073
|
} else {
|
|
@@ -16552,11 +17075,15 @@ var require_cache = __commonJS({
|
|
|
16552
17075
|
}
|
|
16553
17076
|
}
|
|
16554
17077
|
} else {
|
|
16555
|
-
const fieldName = value
|
|
16556
|
-
if (
|
|
16557
|
-
output[key] =
|
|
16558
|
-
} else {
|
|
16559
|
-
|
|
17078
|
+
const fieldName = trimOWS(value);
|
|
17079
|
+
if (!isValidHTTPToken(fieldName)) {
|
|
17080
|
+
output[key] = true;
|
|
17081
|
+
} else if (output[key] !== true) {
|
|
17082
|
+
if (key in output) {
|
|
17083
|
+
output[key] = output[key].concat(fieldName);
|
|
17084
|
+
} else {
|
|
17085
|
+
output[key] = [fieldName];
|
|
17086
|
+
}
|
|
16560
17087
|
}
|
|
16561
17088
|
}
|
|
16562
17089
|
break;
|
|
@@ -16564,39 +17091,76 @@ var require_cache = __commonJS({
|
|
|
16564
17091
|
}
|
|
16565
17092
|
// eslint-disable-next-line no-fallthrough
|
|
16566
17093
|
case "public":
|
|
16567
|
-
case "no-store":
|
|
16568
17094
|
case "must-revalidate":
|
|
16569
17095
|
case "proxy-revalidate":
|
|
16570
17096
|
case "immutable":
|
|
16571
17097
|
case "no-transform":
|
|
16572
17098
|
case "must-understand":
|
|
16573
17099
|
case "only-if-cached":
|
|
16574
|
-
if (
|
|
17100
|
+
if (fromMalformedQuote || invalidNoArgumentDirectives.has(key)) {
|
|
17101
|
+
continue;
|
|
17102
|
+
}
|
|
17103
|
+
if (value !== void 0) {
|
|
17104
|
+
delete output[key];
|
|
17105
|
+
invalidNoArgumentDirectives.add(key);
|
|
16575
17106
|
continue;
|
|
16576
17107
|
}
|
|
16577
17108
|
output[key] = true;
|
|
16578
17109
|
break;
|
|
17110
|
+
case "no-store":
|
|
17111
|
+
output[key] = true;
|
|
17112
|
+
break;
|
|
16579
17113
|
default:
|
|
16580
17114
|
continue;
|
|
16581
17115
|
}
|
|
16582
17116
|
}
|
|
16583
17117
|
return output;
|
|
16584
17118
|
}
|
|
17119
|
+
function splitVaryHeader(varyHeader) {
|
|
17120
|
+
const values = Array.isArray(varyHeader) ? varyHeader : [varyHeader];
|
|
17121
|
+
const output = [];
|
|
17122
|
+
for (let i = 0; i < values.length; i++) {
|
|
17123
|
+
const parts = values[i].split(",");
|
|
17124
|
+
for (let j = 0; j < parts.length; j++) {
|
|
17125
|
+
output.push(parts[j]);
|
|
17126
|
+
}
|
|
17127
|
+
}
|
|
17128
|
+
return output;
|
|
17129
|
+
}
|
|
17130
|
+
function hasVaryStar(varyHeader) {
|
|
17131
|
+
const values = splitVaryHeader(varyHeader);
|
|
17132
|
+
for (let i = 0; i < values.length; i++) {
|
|
17133
|
+
if (trimOWS(values[i]).indexOf("*") !== -1) {
|
|
17134
|
+
return true;
|
|
17135
|
+
}
|
|
17136
|
+
}
|
|
17137
|
+
return false;
|
|
17138
|
+
}
|
|
16585
17139
|
function parseVaryHeader(varyHeader, headers) {
|
|
16586
|
-
if (
|
|
17140
|
+
if (hasVaryStar(varyHeader)) {
|
|
16587
17141
|
return headers;
|
|
16588
17142
|
}
|
|
16589
17143
|
const output = (
|
|
16590
17144
|
/** @type {Record<string, string | string[] | null>} */
|
|
16591
17145
|
{}
|
|
16592
17146
|
);
|
|
16593
|
-
const varyingHeaders =
|
|
17147
|
+
const varyingHeaders = splitVaryHeader(varyHeader);
|
|
16594
17148
|
for (const header of varyingHeaders) {
|
|
16595
|
-
const trimmedHeader = header
|
|
16596
|
-
|
|
17149
|
+
const trimmedHeader = trimOWS(header).toLowerCase();
|
|
17150
|
+
if (trimmedHeader.length === 0) {
|
|
17151
|
+
continue;
|
|
17152
|
+
}
|
|
17153
|
+
if (!isValidHTTPToken(trimmedHeader)) {
|
|
17154
|
+
return void 0;
|
|
17155
|
+
}
|
|
17156
|
+
const headerValue = headers[trimmedHeader];
|
|
17157
|
+
output[trimmedHeader] = Array.isArray(headerValue) ? headerValue.slice() : headerValue ?? null;
|
|
16597
17158
|
}
|
|
16598
17159
|
return output;
|
|
16599
17160
|
}
|
|
17161
|
+
function isInvalidOrWildcardVaryHeader(varyHeader) {
|
|
17162
|
+
return hasVaryStar(varyHeader) || parseVaryHeader(varyHeader, {}) === void 0;
|
|
17163
|
+
}
|
|
16600
17164
|
function isEtagUsable(etag) {
|
|
16601
17165
|
if (etag.length <= 2) {
|
|
16602
17166
|
return false;
|
|
@@ -16627,7 +17191,7 @@ var require_cache = __commonJS({
|
|
|
16627
17191
|
throw new TypeError(`${name} needs to have at least one method`);
|
|
16628
17192
|
}
|
|
16629
17193
|
for (const method of methods) {
|
|
16630
|
-
if (!safeHTTPMethods
|
|
17194
|
+
if (!arrayIncludes(safeHTTPMethods, method)) {
|
|
16631
17195
|
throw new TypeError(`element of ${name}-array needs to be one of following values: ${safeHTTPMethods.join(", ")}, got ${method}`);
|
|
16632
17196
|
}
|
|
16633
17197
|
}
|
|
@@ -16651,7 +17215,10 @@ var require_cache = __commonJS({
|
|
|
16651
17215
|
assertCacheKey,
|
|
16652
17216
|
assertCacheValue,
|
|
16653
17217
|
parseCacheControlHeader,
|
|
17218
|
+
hasInvalidCacheControlDirective,
|
|
16654
17219
|
parseVaryHeader,
|
|
17220
|
+
hasVaryStar,
|
|
17221
|
+
isInvalidOrWildcardVaryHeader,
|
|
16655
17222
|
isEtagUsable,
|
|
16656
17223
|
assertCacheMethods,
|
|
16657
17224
|
assertCacheStore,
|
|
@@ -16674,6 +17241,13 @@ var require_date = __commonJS({
|
|
|
16674
17241
|
return parseRfc850Date(date);
|
|
16675
17242
|
}
|
|
16676
17243
|
}
|
|
17244
|
+
function makeDate(year, monthIdx, day, hour, minute, second, weekday) {
|
|
17245
|
+
const result = new Date(Date.UTC(year, monthIdx, day, hour, minute, second));
|
|
17246
|
+
if (year >= 0 && year <= 99) {
|
|
17247
|
+
result.setUTCFullYear(year);
|
|
17248
|
+
}
|
|
17249
|
+
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;
|
|
17250
|
+
}
|
|
16677
17251
|
function parseImfDate(date) {
|
|
16678
17252
|
if (date.length !== 29 || date[4] !== " " || date[7] !== " " || date[11] !== " " || date[16] !== " " || date[19] !== ":" || date[22] !== ":" || date[25] !== " " || date[26] !== "G" || date[27] !== "M" || date[28] !== "T") {
|
|
16679
17253
|
return void 0;
|
|
@@ -16834,8 +17408,7 @@ var require_date = __commonJS({
|
|
|
16834
17408
|
}
|
|
16835
17409
|
second = (code1 - 48) * 10 + (code2 - 48);
|
|
16836
17410
|
}
|
|
16837
|
-
|
|
16838
|
-
return result.getUTCDay() === weekday ? result : void 0;
|
|
17411
|
+
return makeDate(year, monthIdx, day, hour, minute, second, weekday);
|
|
16839
17412
|
}
|
|
16840
17413
|
function parseAscTimeDate(date) {
|
|
16841
17414
|
if (date.length !== 24 || date[7] !== " " || date[10] !== " " || date[19] !== " ") {
|
|
@@ -16997,8 +17570,7 @@ var require_date = __commonJS({
|
|
|
16997
17570
|
return void 0;
|
|
16998
17571
|
}
|
|
16999
17572
|
const year = (yearDigit1 - 48) * 1e3 + (yearDigit2 - 48) * 100 + (yearDigit3 - 48) * 10 + (yearDigit4 - 48);
|
|
17000
|
-
|
|
17001
|
-
return result.getUTCDay() === weekday ? result : void 0;
|
|
17573
|
+
return makeDate(year, monthIdx, day, hour, minute, second, weekday);
|
|
17002
17574
|
}
|
|
17003
17575
|
function parseRfc850Date(date) {
|
|
17004
17576
|
let commaIndex = -1;
|
|
@@ -17147,8 +17719,7 @@ var require_date = __commonJS({
|
|
|
17147
17719
|
}
|
|
17148
17720
|
second = (code1 - 48) * 10 + (code2 - 48);
|
|
17149
17721
|
}
|
|
17150
|
-
|
|
17151
|
-
return result.getUTCDay() === weekday ? result : void 0;
|
|
17722
|
+
return makeDate(year, monthIdx, day, hour, minute, second, weekday);
|
|
17152
17723
|
}
|
|
17153
17724
|
module2.exports = {
|
|
17154
17725
|
parseHttpDate
|
|
@@ -17163,7 +17734,10 @@ var require_cache_handler = __commonJS({
|
|
|
17163
17734
|
var util = require_util();
|
|
17164
17735
|
var {
|
|
17165
17736
|
parseCacheControlHeader,
|
|
17737
|
+
hasInvalidCacheControlDirective,
|
|
17166
17738
|
parseVaryHeader,
|
|
17739
|
+
hasVaryStar,
|
|
17740
|
+
isInvalidOrWildcardVaryHeader,
|
|
17167
17741
|
isEtagUsable
|
|
17168
17742
|
} = require_cache();
|
|
17169
17743
|
var { parseHttpDate } = require_date();
|
|
@@ -17188,6 +17762,78 @@ var require_cache_handler = __commonJS({
|
|
|
17188
17762
|
];
|
|
17189
17763
|
var MAX_RESPONSE_AGE = 2147483647e3;
|
|
17190
17764
|
var REVALIDATION_ONLY_RETENTION = 864e5;
|
|
17765
|
+
function trimOWS(value) {
|
|
17766
|
+
return value.replace(/^[\t ]+|[\t ]+$/g, "");
|
|
17767
|
+
}
|
|
17768
|
+
function arrayIncludes(array, value) {
|
|
17769
|
+
for (let i = 0; i < array.length; i++) {
|
|
17770
|
+
if (array[i] === value) {
|
|
17771
|
+
return true;
|
|
17772
|
+
}
|
|
17773
|
+
}
|
|
17774
|
+
return false;
|
|
17775
|
+
}
|
|
17776
|
+
function appendConnectionHeaderTokens(headersToRemove, connectionHeader) {
|
|
17777
|
+
const values = Array.isArray(connectionHeader) ? connectionHeader : [connectionHeader];
|
|
17778
|
+
for (let i = 0; i < values.length; i++) {
|
|
17779
|
+
const tokens = values[i].split(",");
|
|
17780
|
+
for (let j = 0; j < tokens.length; j++) {
|
|
17781
|
+
headersToRemove.push(trimOWS(tokens[j]).toLowerCase());
|
|
17782
|
+
}
|
|
17783
|
+
}
|
|
17784
|
+
}
|
|
17785
|
+
function getSameOriginPath(cacheKey, location) {
|
|
17786
|
+
if (typeof location !== "string") {
|
|
17787
|
+
return void 0;
|
|
17788
|
+
}
|
|
17789
|
+
let originUrl;
|
|
17790
|
+
let requestUrl;
|
|
17791
|
+
let locationUrl;
|
|
17792
|
+
try {
|
|
17793
|
+
originUrl = new URL(cacheKey.origin);
|
|
17794
|
+
requestUrl = new URL(cacheKey.path, originUrl);
|
|
17795
|
+
locationUrl = new URL(location, requestUrl);
|
|
17796
|
+
} catch {
|
|
17797
|
+
return void 0;
|
|
17798
|
+
}
|
|
17799
|
+
if (locationUrl.origin !== originUrl.origin) {
|
|
17800
|
+
return void 0;
|
|
17801
|
+
}
|
|
17802
|
+
return locationUrl.pathname + locationUrl.search;
|
|
17803
|
+
}
|
|
17804
|
+
function deleteCachedUri(store, cacheKey, path10) {
|
|
17805
|
+
deleteCachedValue(store, {
|
|
17806
|
+
...cacheKey,
|
|
17807
|
+
path: path10
|
|
17808
|
+
});
|
|
17809
|
+
for (let i = 0; i < util.safeHTTPMethods.length; i++) {
|
|
17810
|
+
const method = util.safeHTTPMethods[i];
|
|
17811
|
+
if (method !== cacheKey.method) {
|
|
17812
|
+
deleteCachedValue(store, {
|
|
17813
|
+
...cacheKey,
|
|
17814
|
+
method,
|
|
17815
|
+
path: path10
|
|
17816
|
+
});
|
|
17817
|
+
}
|
|
17818
|
+
}
|
|
17819
|
+
}
|
|
17820
|
+
function deleteLocationTargets(store, cacheKey, headerValue) {
|
|
17821
|
+
if (headerValue === void 0) {
|
|
17822
|
+
return;
|
|
17823
|
+
}
|
|
17824
|
+
const values = Array.isArray(headerValue) ? headerValue : [headerValue];
|
|
17825
|
+
for (let i = 0; i < values.length; i++) {
|
|
17826
|
+
const path10 = getSameOriginPath(cacheKey, values[i]);
|
|
17827
|
+
if (path10 !== void 0) {
|
|
17828
|
+
deleteCachedUri(store, cacheKey, path10);
|
|
17829
|
+
}
|
|
17830
|
+
}
|
|
17831
|
+
}
|
|
17832
|
+
function invalidateUnsafeRequest(store, cacheKey, resHeaders) {
|
|
17833
|
+
deleteCachedUri(store, cacheKey, cacheKey.path);
|
|
17834
|
+
deleteLocationTargets(store, cacheKey, resHeaders.location);
|
|
17835
|
+
deleteLocationTargets(store, cacheKey, resHeaders["content-location"]);
|
|
17836
|
+
}
|
|
17191
17837
|
var CacheHandler = class {
|
|
17192
17838
|
/**
|
|
17193
17839
|
* @type {import('../../types/cache-interceptor.d.ts').default.CacheKey}
|
|
@@ -17247,38 +17893,51 @@ var require_cache_handler = __commonJS({
|
|
|
17247
17893
|
statusMessage
|
|
17248
17894
|
);
|
|
17249
17895
|
const handler = this;
|
|
17250
|
-
if (!util.safeHTTPMethods
|
|
17251
|
-
|
|
17252
|
-
this.#store.delete(this.#cacheKey)?.catch?.(noop);
|
|
17253
|
-
} catch {
|
|
17254
|
-
}
|
|
17255
|
-
this.#deleteLocationHeaderEntries(resHeaders);
|
|
17896
|
+
if (!arrayIncludes(util.safeHTTPMethods, this.#cacheKey.method) && statusCode >= 200 && statusCode <= 399) {
|
|
17897
|
+
invalidateUnsafeRequest(this.#store, this.#cacheKey, resHeaders);
|
|
17256
17898
|
return downstreamOnHeaders();
|
|
17257
17899
|
}
|
|
17258
17900
|
const cacheControlHeader = resHeaders["cache-control"];
|
|
17259
|
-
const heuristicallyCacheable = resHeaders["last-modified"] && HEURISTICALLY_CACHEABLE_STATUS_CODES
|
|
17901
|
+
const heuristicallyCacheable = resHeaders["last-modified"] && arrayIncludes(HEURISTICALLY_CACHEABLE_STATUS_CODES, statusCode);
|
|
17260
17902
|
if (!cacheControlHeader && !resHeaders["expires"] && !heuristicallyCacheable && !this.#cacheByDefault) {
|
|
17903
|
+
if (statusCode === 304 && resHeaders.vary && isInvalidOrWildcardVaryHeader(resHeaders.vary)) {
|
|
17904
|
+
deleteCachedValue(this.#store, this.#cacheKey);
|
|
17905
|
+
}
|
|
17261
17906
|
return downstreamOnHeaders();
|
|
17262
17907
|
}
|
|
17263
17908
|
const cacheControlDirectives = cacheControlHeader ? parseCacheControlHeader(cacheControlHeader) : {};
|
|
17264
17909
|
if (!canCacheResponse(this.#cacheType, statusCode, resHeaders, cacheControlDirectives, this.#cacheKey.headers)) {
|
|
17910
|
+
if (statusCode === 304 && (cacheControlHeader || revalidationResponseDisallowsCachedReuse(this.#cacheType, resHeaders, cacheControlDirectives))) {
|
|
17911
|
+
deleteCachedValue(this.#store, this.#cacheKey);
|
|
17912
|
+
}
|
|
17265
17913
|
return downstreamOnHeaders();
|
|
17266
17914
|
}
|
|
17267
17915
|
const now = Date.now();
|
|
17268
|
-
const resAge = resHeaders
|
|
17269
|
-
if (resAge && resAge >= MAX_RESPONSE_AGE) {
|
|
17916
|
+
const resAge = Object.hasOwn(resHeaders, "age") ? getAge(resHeaders.age) : void 0;
|
|
17917
|
+
if (resAge !== void 0 && resAge >= MAX_RESPONSE_AGE) {
|
|
17918
|
+
deleteCachedValueIfNotModified(statusCode, this.#store, this.#cacheKey);
|
|
17919
|
+
return downstreamOnHeaders();
|
|
17920
|
+
}
|
|
17921
|
+
const resDate = Object.hasOwn(resHeaders, "date") ? getDate(resHeaders.date) : void 0;
|
|
17922
|
+
if (resDate === null) {
|
|
17923
|
+
deleteCachedValueIfNotModified(statusCode, this.#store, this.#cacheKey);
|
|
17270
17924
|
return downstreamOnHeaders();
|
|
17271
17925
|
}
|
|
17272
|
-
const
|
|
17926
|
+
const apparentAge = resDate ? Math.max(0, now - resDate.getTime()) : 0;
|
|
17927
|
+
const currentAge = Math.max(apparentAge, resAge ?? 0);
|
|
17273
17928
|
const hasValidator = typeof resHeaders.etag === "string" && isEtagUsable(resHeaders.etag) || typeof resHeaders["last-modified"] === "string";
|
|
17274
17929
|
const staleAt = determineStaleAt(this.#cacheType, now, resAge, resHeaders, resDate, cacheControlDirectives, hasValidator) ?? this.#cacheByDefault;
|
|
17275
|
-
|
|
17930
|
+
const revalidationOnly = staleAt === 0 && hasValidator;
|
|
17931
|
+
if (staleAt === void 0 || currentAge >= staleAt && !revalidationOnly) {
|
|
17932
|
+
if (cacheControlHeader || staleAt !== void 0) {
|
|
17933
|
+
deleteCachedValueIfNotModified(statusCode, this.#store, this.#cacheKey);
|
|
17934
|
+
}
|
|
17276
17935
|
return downstreamOnHeaders();
|
|
17277
17936
|
}
|
|
17278
|
-
const baseTime =
|
|
17937
|
+
const baseTime = now - currentAge;
|
|
17279
17938
|
const absoluteStaleAt = staleAt + baseTime;
|
|
17280
|
-
const revalidationOnly = staleAt === 0 && hasValidator;
|
|
17281
17939
|
if (now >= absoluteStaleAt && !revalidationOnly) {
|
|
17940
|
+
deleteCachedValueIfNotModified(statusCode, this.#store, this.#cacheKey);
|
|
17282
17941
|
return downstreamOnHeaders();
|
|
17283
17942
|
}
|
|
17284
17943
|
let varyDirectives;
|
|
@@ -17288,8 +17947,8 @@ var require_cache_handler = __commonJS({
|
|
|
17288
17947
|
return downstreamOnHeaders();
|
|
17289
17948
|
}
|
|
17290
17949
|
}
|
|
17291
|
-
const cachedAt =
|
|
17292
|
-
const deleteAt = determineDeleteAt(baseTime,
|
|
17950
|
+
const cachedAt = baseTime;
|
|
17951
|
+
const deleteAt = determineDeleteAt(baseTime, now, cacheControlDirectives, absoluteStaleAt);
|
|
17293
17952
|
const strippedHeaders = stripNecessaryHeaders(resHeaders, cacheControlDirectives);
|
|
17294
17953
|
const value = {
|
|
17295
17954
|
statusCode,
|
|
@@ -17309,6 +17968,7 @@ var require_cache_handler = __commonJS({
|
|
|
17309
17968
|
value.statusCode = cachedValue.statusCode;
|
|
17310
17969
|
value.statusMessage = cachedValue.statusMessage;
|
|
17311
17970
|
value.etag = cachedValue.etag;
|
|
17971
|
+
value.vary = varyDirectives ?? cachedValue.vary;
|
|
17312
17972
|
value.headers = { ...cachedValue.headers, ...strippedHeaders };
|
|
17313
17973
|
downstreamOnHeaders();
|
|
17314
17974
|
this.#writeStream = this.#store.createWriteStream(this.#cacheKey, value);
|
|
@@ -17383,47 +18043,6 @@ var require_cache_handler = __commonJS({
|
|
|
17383
18043
|
downstreamOnHeaders();
|
|
17384
18044
|
}
|
|
17385
18045
|
}
|
|
17386
|
-
/**
|
|
17387
|
-
* Deletes the cache entries for the URIs in the response's Location and
|
|
17388
|
-
* Content-Location headers when they share the request URI's origin
|
|
17389
|
-
* https://www.rfc-editor.org/rfc/rfc9111.html#section-4.4
|
|
17390
|
-
*
|
|
17391
|
-
* @param {import('../../types/header.d.ts').IncomingHttpHeaders} resHeaders
|
|
17392
|
-
*/
|
|
17393
|
-
#deleteLocationHeaderEntries(resHeaders) {
|
|
17394
|
-
let requestUrl;
|
|
17395
|
-
try {
|
|
17396
|
-
requestUrl = new URL(this.#cacheKey.path, this.#cacheKey.origin);
|
|
17397
|
-
} catch {
|
|
17398
|
-
return;
|
|
17399
|
-
}
|
|
17400
|
-
const invalidatedPaths = /* @__PURE__ */ new Set([this.#cacheKey.path]);
|
|
17401
|
-
for (const headerName of ["location", "content-location"]) {
|
|
17402
|
-
const header = resHeaders[headerName];
|
|
17403
|
-
const value = Array.isArray(header) ? header[0] : header;
|
|
17404
|
-
if (typeof value !== "string" || value === "") {
|
|
17405
|
-
continue;
|
|
17406
|
-
}
|
|
17407
|
-
let url;
|
|
17408
|
-
try {
|
|
17409
|
-
url = new URL(value, requestUrl);
|
|
17410
|
-
} catch {
|
|
17411
|
-
continue;
|
|
17412
|
-
}
|
|
17413
|
-
if (url.origin !== requestUrl.origin) {
|
|
17414
|
-
continue;
|
|
17415
|
-
}
|
|
17416
|
-
const path9 = `${url.pathname}${url.search}`;
|
|
17417
|
-
if (invalidatedPaths.has(path9)) {
|
|
17418
|
-
continue;
|
|
17419
|
-
}
|
|
17420
|
-
invalidatedPaths.add(path9);
|
|
17421
|
-
try {
|
|
17422
|
-
this.#store.delete({ ...this.#cacheKey, path: path9 })?.catch?.(noop);
|
|
17423
|
-
} catch {
|
|
17424
|
-
}
|
|
17425
|
-
}
|
|
17426
|
-
}
|
|
17427
18046
|
onResponseData(controller, chunk) {
|
|
17428
18047
|
if (this.#writeStream?.write(chunk) === false) {
|
|
17429
18048
|
controller.pause();
|
|
@@ -17440,11 +18059,25 @@ var require_cache_handler = __commonJS({
|
|
|
17440
18059
|
this.#handler.onResponseError?.(controller, err);
|
|
17441
18060
|
}
|
|
17442
18061
|
};
|
|
18062
|
+
function deleteCachedValue(store, cacheKey) {
|
|
18063
|
+
try {
|
|
18064
|
+
store.delete(cacheKey)?.catch?.(noop);
|
|
18065
|
+
} catch {
|
|
18066
|
+
}
|
|
18067
|
+
}
|
|
18068
|
+
function deleteCachedValueIfNotModified(statusCode, store, cacheKey) {
|
|
18069
|
+
if (statusCode === 304) {
|
|
18070
|
+
deleteCachedValue(store, cacheKey);
|
|
18071
|
+
}
|
|
18072
|
+
}
|
|
18073
|
+
function revalidationResponseDisallowsCachedReuse(cacheType, resHeaders, cacheControlDirectives) {
|
|
18074
|
+
return cacheControlDirectives["no-store"] === true || cacheType === "shared" && cacheControlDirectives.private === true || (resHeaders.vary ? isInvalidOrWildcardVaryHeader(resHeaders.vary) : false);
|
|
18075
|
+
}
|
|
17443
18076
|
function canCacheResponse(cacheType, statusCode, resHeaders, cacheControlDirectives, reqHeaders) {
|
|
17444
|
-
if (statusCode < 200 || NOT_UNDERSTOOD_STATUS_CODES
|
|
18077
|
+
if (statusCode < 200 || arrayIncludes(NOT_UNDERSTOOD_STATUS_CODES, statusCode)) {
|
|
17445
18078
|
return false;
|
|
17446
18079
|
}
|
|
17447
|
-
if (!HEURISTICALLY_CACHEABLE_STATUS_CODES
|
|
18080
|
+
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
|
|
17448
18081
|
!(cacheControlDirectives.private && cacheType === "private") && !(cacheControlDirectives["s-maxage"] !== void 0 && cacheType === "shared")) {
|
|
17449
18082
|
return false;
|
|
17450
18083
|
}
|
|
@@ -17454,66 +18087,104 @@ var require_cache_handler = __commonJS({
|
|
|
17454
18087
|
if (cacheType === "shared" && cacheControlDirectives.private === true) {
|
|
17455
18088
|
return false;
|
|
17456
18089
|
}
|
|
17457
|
-
if (resHeaders.vary
|
|
18090
|
+
if (resHeaders.vary && hasVaryStar(resHeaders.vary)) {
|
|
17458
18091
|
return false;
|
|
17459
18092
|
}
|
|
17460
|
-
if (reqHeaders
|
|
18093
|
+
if (reqHeaders != null && Object.hasOwn(reqHeaders, "authorization")) {
|
|
17461
18094
|
if (!cacheControlDirectives.public && !cacheControlDirectives["s-maxage"] && !cacheControlDirectives["must-revalidate"]) {
|
|
17462
18095
|
return false;
|
|
17463
18096
|
}
|
|
17464
18097
|
if (typeof reqHeaders.authorization !== "string") {
|
|
17465
18098
|
return false;
|
|
17466
18099
|
}
|
|
17467
|
-
if (Array.isArray(cacheControlDirectives["no-cache"]) && cacheControlDirectives["no-cache"]
|
|
18100
|
+
if (Array.isArray(cacheControlDirectives["no-cache"]) && arrayIncludes(cacheControlDirectives["no-cache"], "authorization")) {
|
|
17468
18101
|
return false;
|
|
17469
18102
|
}
|
|
17470
|
-
if (Array.isArray(cacheControlDirectives["private"]) && cacheControlDirectives["private"]
|
|
18103
|
+
if (Array.isArray(cacheControlDirectives["private"]) && arrayIncludes(cacheControlDirectives["private"], "authorization")) {
|
|
17471
18104
|
return false;
|
|
17472
18105
|
}
|
|
17473
18106
|
}
|
|
17474
18107
|
return true;
|
|
17475
18108
|
}
|
|
18109
|
+
function getDate(dateHeader) {
|
|
18110
|
+
let dateValue = dateHeader;
|
|
18111
|
+
if (Array.isArray(dateValue)) {
|
|
18112
|
+
if (dateValue.length !== 1) {
|
|
18113
|
+
return null;
|
|
18114
|
+
}
|
|
18115
|
+
dateValue = dateValue[0];
|
|
18116
|
+
}
|
|
18117
|
+
if (typeof dateValue !== "string") {
|
|
18118
|
+
return null;
|
|
18119
|
+
}
|
|
18120
|
+
return parseHttpDate(dateValue);
|
|
18121
|
+
}
|
|
17476
18122
|
function getAge(ageHeader) {
|
|
17477
|
-
|
|
17478
|
-
|
|
18123
|
+
let ageValue = ageHeader;
|
|
18124
|
+
if (Array.isArray(ageValue)) {
|
|
18125
|
+
if (ageValue.length !== 1) {
|
|
18126
|
+
return MAX_RESPONSE_AGE;
|
|
18127
|
+
}
|
|
18128
|
+
ageValue = ageValue[0];
|
|
18129
|
+
}
|
|
18130
|
+
if (typeof ageValue !== "string" || !/^[\t ]*[0-9]+[\t ]*$/.test(ageValue)) {
|
|
18131
|
+
return MAX_RESPONSE_AGE;
|
|
18132
|
+
}
|
|
18133
|
+
const age = BigInt(ageValue.replace(/^[\t ]+|[\t ]+$/g, ""));
|
|
18134
|
+
if (age >= BigInt(MAX_RESPONSE_AGE / 1e3)) {
|
|
18135
|
+
return MAX_RESPONSE_AGE;
|
|
18136
|
+
}
|
|
18137
|
+
return Number(age) * 1e3;
|
|
17479
18138
|
}
|
|
17480
18139
|
function determineStaleAt(cacheType, now, age, resHeaders, responseDate, cacheControlDirectives, hasValidator) {
|
|
17481
18140
|
if (cacheType === "shared") {
|
|
18141
|
+
if (hasInvalidCacheControlDirective(cacheControlDirectives, "s-maxage")) {
|
|
18142
|
+
return 0;
|
|
18143
|
+
}
|
|
17482
18144
|
const sMaxAge = cacheControlDirectives["s-maxage"];
|
|
17483
18145
|
if (sMaxAge !== void 0) {
|
|
17484
18146
|
if (sMaxAge > 0) {
|
|
17485
18147
|
return sMaxAge * 1e3;
|
|
17486
18148
|
}
|
|
17487
|
-
return
|
|
18149
|
+
return 0;
|
|
17488
18150
|
}
|
|
17489
18151
|
}
|
|
18152
|
+
if (hasInvalidCacheControlDirective(cacheControlDirectives, "max-age")) {
|
|
18153
|
+
return 0;
|
|
18154
|
+
}
|
|
17490
18155
|
const maxAge = cacheControlDirectives["max-age"];
|
|
17491
18156
|
if (maxAge !== void 0) {
|
|
17492
18157
|
if (maxAge > 0) {
|
|
17493
18158
|
return maxAge * 1e3;
|
|
17494
18159
|
}
|
|
17495
|
-
return
|
|
18160
|
+
return 0;
|
|
17496
18161
|
}
|
|
17497
|
-
if (
|
|
18162
|
+
if (Object.hasOwn(resHeaders, "expires")) {
|
|
18163
|
+
if (typeof resHeaders.expires !== "string") {
|
|
18164
|
+
return 0;
|
|
18165
|
+
}
|
|
17498
18166
|
const expiresDate = parseHttpDate(resHeaders.expires);
|
|
17499
|
-
if (expiresDate) {
|
|
17500
|
-
|
|
17501
|
-
|
|
18167
|
+
if (!expiresDate) {
|
|
18168
|
+
return 0;
|
|
18169
|
+
}
|
|
18170
|
+
if (now >= expiresDate.getTime()) {
|
|
18171
|
+
return 0;
|
|
18172
|
+
}
|
|
18173
|
+
if (responseDate) {
|
|
18174
|
+
if (responseDate >= expiresDate) {
|
|
18175
|
+
return 0;
|
|
17502
18176
|
}
|
|
17503
|
-
|
|
17504
|
-
|
|
17505
|
-
|
|
17506
|
-
}
|
|
17507
|
-
if (age !== void 0 && age > expiresDate - responseDate) {
|
|
17508
|
-
return void 0;
|
|
17509
|
-
}
|
|
18177
|
+
const freshnessLifetime = expiresDate.getTime() - responseDate.getTime();
|
|
18178
|
+
if (age !== void 0 && age >= freshnessLifetime) {
|
|
18179
|
+
return 0;
|
|
17510
18180
|
}
|
|
17511
|
-
return
|
|
18181
|
+
return freshnessLifetime;
|
|
17512
18182
|
}
|
|
18183
|
+
return expiresDate.getTime() - now;
|
|
17513
18184
|
}
|
|
17514
18185
|
if (typeof resHeaders["last-modified"] === "string") {
|
|
17515
|
-
const lastModified =
|
|
17516
|
-
if (
|
|
18186
|
+
const lastModified = parseHttpDate(resHeaders["last-modified"]);
|
|
18187
|
+
if (lastModified) {
|
|
17517
18188
|
if (lastModified.getTime() >= now) {
|
|
17518
18189
|
return void 0;
|
|
17519
18190
|
}
|
|
@@ -17566,11 +18237,7 @@ var require_cache_handler = __commonJS({
|
|
|
17566
18237
|
"age"
|
|
17567
18238
|
];
|
|
17568
18239
|
if (resHeaders["connection"]) {
|
|
17569
|
-
|
|
17570
|
-
headersToRemove.push(...resHeaders["connection"].map((header) => header.trim()));
|
|
17571
|
-
} else {
|
|
17572
|
-
headersToRemove.push(...resHeaders["connection"].split(",").map((header) => header.trim()));
|
|
17573
|
-
}
|
|
18240
|
+
appendConnectionHeaderTokens(headersToRemove, resHeaders["connection"]);
|
|
17574
18241
|
}
|
|
17575
18242
|
if (Array.isArray(cacheControlDirectives["no-cache"])) {
|
|
17576
18243
|
headersToRemove.push(...cacheControlDirectives["no-cache"]);
|
|
@@ -17580,16 +18247,13 @@ var require_cache_handler = __commonJS({
|
|
|
17580
18247
|
}
|
|
17581
18248
|
let strippedHeaders;
|
|
17582
18249
|
for (const headerName of headersToRemove) {
|
|
17583
|
-
if (resHeaders
|
|
18250
|
+
if (Object.hasOwn(resHeaders, headerName)) {
|
|
17584
18251
|
strippedHeaders ??= { ...resHeaders };
|
|
17585
18252
|
delete strippedHeaders[headerName];
|
|
17586
18253
|
}
|
|
17587
18254
|
}
|
|
17588
18255
|
return strippedHeaders ?? resHeaders;
|
|
17589
18256
|
}
|
|
17590
|
-
function isValidDate(date) {
|
|
17591
|
-
return date instanceof Date && Number.isFinite(date.valueOf());
|
|
17592
|
-
}
|
|
17593
18257
|
module2.exports = CacheHandler;
|
|
17594
18258
|
}
|
|
17595
18259
|
});
|
|
@@ -17760,12 +18424,43 @@ var require_memory_cache_store = __commonJS({
|
|
|
17760
18424
|
}
|
|
17761
18425
|
};
|
|
17762
18426
|
function findEntry(key, entries, now) {
|
|
17763
|
-
|
|
17764
|
-
|
|
17765
|
-
|
|
18427
|
+
for (let i = 0; i < entries.length; i++) {
|
|
18428
|
+
const entry = entries[i];
|
|
18429
|
+
if (entry.deleteAt > now && entry.method === key.method && varyMatches(key, entry)) {
|
|
18430
|
+
return entry;
|
|
17766
18431
|
}
|
|
17767
|
-
|
|
17768
|
-
|
|
18432
|
+
}
|
|
18433
|
+
}
|
|
18434
|
+
function varyMatches(key, entry) {
|
|
18435
|
+
if (entry.vary == null) {
|
|
18436
|
+
return true;
|
|
18437
|
+
}
|
|
18438
|
+
for (const headerName in entry.vary) {
|
|
18439
|
+
if (Object.hasOwn(entry.vary, headerName) && !headerValueEquals(key.headers?.[headerName], entry.vary[headerName])) {
|
|
18440
|
+
return false;
|
|
18441
|
+
}
|
|
18442
|
+
}
|
|
18443
|
+
return true;
|
|
18444
|
+
}
|
|
18445
|
+
function headerValueEquals(lhs, rhs) {
|
|
18446
|
+
if (lhs == null && rhs == null) {
|
|
18447
|
+
return true;
|
|
18448
|
+
}
|
|
18449
|
+
if (lhs == null && rhs != null || lhs != null && rhs == null) {
|
|
18450
|
+
return false;
|
|
18451
|
+
}
|
|
18452
|
+
if (Array.isArray(lhs) && Array.isArray(rhs)) {
|
|
18453
|
+
if (lhs.length !== rhs.length) {
|
|
18454
|
+
return false;
|
|
18455
|
+
}
|
|
18456
|
+
for (let i = 0; i < lhs.length; i++) {
|
|
18457
|
+
if (lhs[i] !== rhs[i]) {
|
|
18458
|
+
return false;
|
|
18459
|
+
}
|
|
18460
|
+
}
|
|
18461
|
+
return true;
|
|
18462
|
+
}
|
|
18463
|
+
return lhs === rhs;
|
|
17769
18464
|
}
|
|
17770
18465
|
module2.exports = MemoryCacheStore;
|
|
17771
18466
|
}
|
|
@@ -17779,7 +18474,7 @@ var require_cache_revalidation_handler = __commonJS({
|
|
|
17779
18474
|
var CacheRevalidationHandler = class {
|
|
17780
18475
|
#successful = false;
|
|
17781
18476
|
/**
|
|
17782
|
-
* @type {((boolean, any) => void) | null}
|
|
18477
|
+
* @type {((success: boolean, context?: any, statusCode?: number, headers?: import('../../types/header.d.ts').IncomingHttpHeaders) => void) | null}
|
|
17783
18478
|
*/
|
|
17784
18479
|
#callback;
|
|
17785
18480
|
/**
|
|
@@ -17792,7 +18487,7 @@ var require_cache_revalidation_handler = __commonJS({
|
|
|
17792
18487
|
*/
|
|
17793
18488
|
#allowErrorStatusCodes;
|
|
17794
18489
|
/**
|
|
17795
|
-
* @param {(boolean) => void} callback Function to call if the cached value is valid
|
|
18490
|
+
* @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
|
|
17796
18491
|
* @param {import('../../types/dispatcher.d.ts').default.DispatchHandlers} handler
|
|
17797
18492
|
* @param {boolean} allowErrorStatusCodes
|
|
17798
18493
|
*/
|
|
@@ -17814,7 +18509,7 @@ var require_cache_revalidation_handler = __commonJS({
|
|
|
17814
18509
|
onResponseStart(controller, statusCode, headers, statusMessage) {
|
|
17815
18510
|
assert(this.#callback != null);
|
|
17816
18511
|
this.#successful = statusCode === 304 || this.#allowErrorStatusCodes && statusCode >= 500 && statusCode <= 504;
|
|
17817
|
-
this.#callback(this.#successful, this.#context);
|
|
18512
|
+
this.#callback(this.#successful, this.#context, statusCode, headers);
|
|
17818
18513
|
this.#callback = null;
|
|
17819
18514
|
if (this.#successful) {
|
|
17820
18515
|
return true;
|
|
@@ -17874,8 +18569,9 @@ var require_cache2 = __commonJS({
|
|
|
17874
18569
|
var CacheHandler = require_cache_handler();
|
|
17875
18570
|
var MemoryCacheStore = require_memory_cache_store();
|
|
17876
18571
|
var CacheRevalidationHandler = require_cache_revalidation_handler();
|
|
17877
|
-
var { assertCacheStore, assertCacheMethods, makeCacheKey, normalizeHeaders, parseCacheControlHeader } = require_cache();
|
|
18572
|
+
var { assertCacheStore, assertCacheMethods, makeCacheKey, normalizeHeaders, parseCacheControlHeader, isInvalidOrWildcardVaryHeader } = require_cache();
|
|
17878
18573
|
var { AbortError } = require_errors();
|
|
18574
|
+
var { parseHttpDate } = require_date();
|
|
17879
18575
|
function assertCacheOrigins(origins, name) {
|
|
17880
18576
|
if (origins === void 0) return;
|
|
17881
18577
|
if (!Array.isArray(origins)) {
|
|
@@ -17890,6 +18586,37 @@ var require_cache2 = __commonJS({
|
|
|
17890
18586
|
}
|
|
17891
18587
|
var nop = () => {
|
|
17892
18588
|
};
|
|
18589
|
+
function trimOWS(value) {
|
|
18590
|
+
return value.replace(/^[\t ]+|[\t ]+$/g, "");
|
|
18591
|
+
}
|
|
18592
|
+
function arrayIncludes(array, value) {
|
|
18593
|
+
for (let i = 0; i < array.length; i++) {
|
|
18594
|
+
if (array[i] === value) {
|
|
18595
|
+
return true;
|
|
18596
|
+
}
|
|
18597
|
+
}
|
|
18598
|
+
return false;
|
|
18599
|
+
}
|
|
18600
|
+
function hasPragmaNoCache(headers) {
|
|
18601
|
+
const pragma = headers?.pragma;
|
|
18602
|
+
if (!pragma) {
|
|
18603
|
+
return false;
|
|
18604
|
+
}
|
|
18605
|
+
const values = Array.isArray(pragma) ? pragma : [pragma];
|
|
18606
|
+
for (let i = 0; i < values.length; i++) {
|
|
18607
|
+
const value = values[i];
|
|
18608
|
+
if (typeof value !== "string") {
|
|
18609
|
+
continue;
|
|
18610
|
+
}
|
|
18611
|
+
const directives = value.split(",");
|
|
18612
|
+
for (let j = 0; j < directives.length; j++) {
|
|
18613
|
+
if (trimOWS(directives[j]).toLowerCase() === "no-cache") {
|
|
18614
|
+
return true;
|
|
18615
|
+
}
|
|
18616
|
+
}
|
|
18617
|
+
}
|
|
18618
|
+
return false;
|
|
18619
|
+
}
|
|
17893
18620
|
function needsRevalidation(result, cacheControlDirectives, { headers = {} }) {
|
|
17894
18621
|
if (cacheControlDirectives?.["no-cache"]) {
|
|
17895
18622
|
return true;
|
|
@@ -17902,15 +18629,58 @@ var require_cache2 = __commonJS({
|
|
|
17902
18629
|
}
|
|
17903
18630
|
return false;
|
|
17904
18631
|
}
|
|
17905
|
-
function
|
|
17906
|
-
return
|
|
17907
|
-
|
|
17908
|
-
);
|
|
18632
|
+
function staleResponseRequiresRevalidation(result, cacheType) {
|
|
18633
|
+
return result.cacheControlDirectives?.["must-revalidate"] === true || cacheType === "shared" && (result.cacheControlDirectives?.["proxy-revalidate"] === true || // https://www.rfc-editor.org/rfc/rfc9111.html#section-5.2.2.10
|
|
18634
|
+
// s-maxage implies proxy-revalidate for shared caches.
|
|
18635
|
+
result.cacheControlDirectives?.["s-maxage"] !== void 0);
|
|
18636
|
+
}
|
|
18637
|
+
function revalidationResponseDisallowsCachedReuse(cacheType, headers) {
|
|
18638
|
+
if (headers.vary && isInvalidOrWildcardVaryHeader(headers.vary)) {
|
|
18639
|
+
return true;
|
|
18640
|
+
}
|
|
18641
|
+
const cacheControl = headers["cache-control"];
|
|
18642
|
+
if (!cacheControl) {
|
|
18643
|
+
return false;
|
|
18644
|
+
}
|
|
18645
|
+
const cacheControlDirectives = parseCacheControlHeader(cacheControl);
|
|
18646
|
+
return cacheControlDirectives["no-store"] === true || cacheType === "shared" && cacheControlDirectives.private === true;
|
|
18647
|
+
}
|
|
18648
|
+
function revalidationResponseUpdatesCacheControl(headers) {
|
|
18649
|
+
return headers["cache-control"] !== void 0;
|
|
18650
|
+
}
|
|
18651
|
+
function deleteCachedValue(store, cacheKey) {
|
|
18652
|
+
try {
|
|
18653
|
+
store.delete(cacheKey)?.catch?.(nop);
|
|
18654
|
+
} catch {
|
|
18655
|
+
}
|
|
18656
|
+
}
|
|
18657
|
+
function getUsableLastModified(headers) {
|
|
18658
|
+
const lastModified = headers?.["last-modified"];
|
|
18659
|
+
if (typeof lastModified === "string" && parseHttpDate(lastModified)) {
|
|
18660
|
+
return lastModified;
|
|
18661
|
+
}
|
|
18662
|
+
}
|
|
18663
|
+
function makeRevalidationHeaders(opts, result) {
|
|
18664
|
+
const headers = {
|
|
18665
|
+
...opts.headers,
|
|
18666
|
+
"if-modified-since": getUsableLastModified(result.headers) ?? new Date(result.cachedAt).toUTCString()
|
|
18667
|
+
};
|
|
18668
|
+
if (result.etag) {
|
|
18669
|
+
headers["if-none-match"] = result.etag;
|
|
18670
|
+
}
|
|
18671
|
+
if (result.vary) {
|
|
18672
|
+
for (const key in result.vary) {
|
|
18673
|
+
if (result.vary[key] != null) {
|
|
18674
|
+
headers[key] = result.vary[key];
|
|
18675
|
+
}
|
|
18676
|
+
}
|
|
18677
|
+
}
|
|
18678
|
+
return headers;
|
|
17909
18679
|
}
|
|
17910
18680
|
function isStale(result, cacheControlDirectives, cacheType) {
|
|
17911
18681
|
const now = Date.now();
|
|
17912
18682
|
if (now > result.staleAt) {
|
|
17913
|
-
if (cacheControlDirectives?.["max-stale"]
|
|
18683
|
+
if (!staleResponseRequiresRevalidation(result, cacheType) && cacheControlDirectives?.["max-stale"]) {
|
|
17914
18684
|
const gracePeriod = result.staleAt + cacheControlDirectives["max-stale"] * 1e3;
|
|
17915
18685
|
return now > gracePeriod;
|
|
17916
18686
|
}
|
|
@@ -17923,9 +18693,9 @@ var require_cache2 = __commonJS({
|
|
|
17923
18693
|
}
|
|
17924
18694
|
return false;
|
|
17925
18695
|
}
|
|
17926
|
-
function withinStaleWhileRevalidateWindow(result) {
|
|
18696
|
+
function withinStaleWhileRevalidateWindow(result, cacheType) {
|
|
17927
18697
|
const staleWhileRevalidate = result.cacheControlDirectives?.["stale-while-revalidate"];
|
|
17928
|
-
if (!staleWhileRevalidate) {
|
|
18698
|
+
if (!staleWhileRevalidate || staleResponseRequiresRevalidation(result, cacheType)) {
|
|
17929
18699
|
return false;
|
|
17930
18700
|
}
|
|
17931
18701
|
const now = Date.now();
|
|
@@ -18035,32 +18805,17 @@ var require_cache2 = __commonJS({
|
|
|
18035
18805
|
return dispatch(opts, new CacheHandler(globalOpts, cacheKey, handler));
|
|
18036
18806
|
}
|
|
18037
18807
|
const age = Math.round((now - result.cachedAt) / 1e3);
|
|
18038
|
-
|
|
18039
|
-
|
|
18040
|
-
|
|
18041
|
-
const stale = isStale(result, reqCacheControl, globalOpts.type);
|
|
18042
|
-
const revalidate = needsRevalidation(result, reqCacheControl, opts);
|
|
18808
|
+
const requestMaxAgeExpired = reqCacheControl?.["max-age"] !== void 0 && age >= reqCacheControl["max-age"];
|
|
18809
|
+
const stale = requestMaxAgeExpired || isStale(result, reqCacheControl, globalOpts.type);
|
|
18810
|
+
const revalidate = requestMaxAgeExpired || needsRevalidation(result, reqCacheControl, opts);
|
|
18043
18811
|
if (stale || revalidate) {
|
|
18044
18812
|
if (util.isStream(opts.body) && util.bodyLength(opts.body) !== 0) {
|
|
18045
18813
|
return dispatch(opts, new CacheHandler(globalOpts, cacheKey, handler));
|
|
18046
18814
|
}
|
|
18047
|
-
if (!revalidate && withinStaleWhileRevalidateWindow(result)) {
|
|
18815
|
+
if (!revalidate && withinStaleWhileRevalidateWindow(result, globalOpts.type)) {
|
|
18048
18816
|
sendCachedValue(handler, opts, result, age, null, true);
|
|
18049
18817
|
queueMicrotask(() => {
|
|
18050
|
-
const headers2 =
|
|
18051
|
-
...opts.headers,
|
|
18052
|
-
"if-modified-since": new Date(result.cachedAt).toUTCString()
|
|
18053
|
-
};
|
|
18054
|
-
if (result.etag) {
|
|
18055
|
-
headers2["if-none-match"] = result.etag;
|
|
18056
|
-
}
|
|
18057
|
-
if (result.vary) {
|
|
18058
|
-
for (const key in result.vary) {
|
|
18059
|
-
if (result.vary[key] != null) {
|
|
18060
|
-
headers2[key] = result.vary[key];
|
|
18061
|
-
}
|
|
18062
|
-
}
|
|
18063
|
-
}
|
|
18818
|
+
const headers2 = makeRevalidationHeaders(opts, result);
|
|
18064
18819
|
dispatch(
|
|
18065
18820
|
{
|
|
18066
18821
|
...opts,
|
|
@@ -18086,32 +18841,33 @@ var require_cache2 = __commonJS({
|
|
|
18086
18841
|
return true;
|
|
18087
18842
|
}
|
|
18088
18843
|
let withinStaleIfErrorThreshold = false;
|
|
18089
|
-
|
|
18090
|
-
|
|
18091
|
-
|
|
18092
|
-
|
|
18093
|
-
const headers = {
|
|
18094
|
-
...opts.headers,
|
|
18095
|
-
"if-modified-since": new Date(result.cachedAt).toUTCString()
|
|
18096
|
-
};
|
|
18097
|
-
if (result.etag) {
|
|
18098
|
-
headers["if-none-match"] = result.etag;
|
|
18099
|
-
}
|
|
18100
|
-
if (result.vary) {
|
|
18101
|
-
for (const key in result.vary) {
|
|
18102
|
-
if (result.vary[key] != null) {
|
|
18103
|
-
headers[key] = result.vary[key];
|
|
18104
|
-
}
|
|
18844
|
+
if (!staleResponseRequiresRevalidation(result, globalOpts.type)) {
|
|
18845
|
+
const staleIfErrorExpiry = result.cacheControlDirectives["stale-if-error"] ?? reqCacheControl?.["stale-if-error"];
|
|
18846
|
+
if (staleIfErrorExpiry) {
|
|
18847
|
+
withinStaleIfErrorThreshold = now < result.staleAt + staleIfErrorExpiry * 1e3;
|
|
18105
18848
|
}
|
|
18106
18849
|
}
|
|
18850
|
+
const headers = makeRevalidationHeaders(opts, result);
|
|
18107
18851
|
return dispatch(
|
|
18108
18852
|
{
|
|
18109
18853
|
...opts,
|
|
18110
18854
|
headers
|
|
18111
18855
|
},
|
|
18112
18856
|
new CacheRevalidationHandler(
|
|
18113
|
-
(success, context) => {
|
|
18857
|
+
(success, context, statusCode, headers2) => {
|
|
18114
18858
|
if (success) {
|
|
18859
|
+
if (statusCode === 304) {
|
|
18860
|
+
if (revalidationResponseDisallowsCachedReuse(globalOpts.type, headers2)) {
|
|
18861
|
+
if (util.isStream(result.body)) {
|
|
18862
|
+
result.body.on("error", nop).destroy();
|
|
18863
|
+
}
|
|
18864
|
+
deleteCachedValue(globalOpts.store, cacheKey);
|
|
18865
|
+
return dispatch(opts, new CacheHandler(globalOpts, cacheKey, handler));
|
|
18866
|
+
}
|
|
18867
|
+
if (revalidationResponseUpdatesCacheControl(headers2)) {
|
|
18868
|
+
deleteCachedValue(globalOpts.store, cacheKey);
|
|
18869
|
+
}
|
|
18870
|
+
}
|
|
18115
18871
|
sendCachedValue(handler, opts, result, age, context, stale);
|
|
18116
18872
|
} else if (util.isStream(result.body)) {
|
|
18117
18873
|
result.body.on("error", nop).destroy();
|
|
@@ -18153,13 +18909,22 @@ var require_cache2 = __commonJS({
|
|
|
18153
18909
|
cacheByDefault,
|
|
18154
18910
|
type
|
|
18155
18911
|
};
|
|
18156
|
-
const safeMethodsToNotCache =
|
|
18912
|
+
const safeMethodsToNotCache = [];
|
|
18913
|
+
for (let i = 0; i < util.safeHTTPMethods.length; i++) {
|
|
18914
|
+
const method = util.safeHTTPMethods[i];
|
|
18915
|
+
if (!arrayIncludes(methods, method)) {
|
|
18916
|
+
safeMethodsToNotCache.push(method);
|
|
18917
|
+
}
|
|
18918
|
+
}
|
|
18157
18919
|
return (dispatch) => {
|
|
18158
18920
|
return (opts2, handler) => {
|
|
18159
|
-
if (
|
|
18921
|
+
if (arrayIncludes(safeMethodsToNotCache, opts2.method)) {
|
|
18160
18922
|
return dispatch(opts2, handler);
|
|
18161
18923
|
}
|
|
18162
18924
|
if (origins !== void 0) {
|
|
18925
|
+
if (!opts2.origin) {
|
|
18926
|
+
return dispatch(opts2, handler);
|
|
18927
|
+
}
|
|
18163
18928
|
const requestOrigin = opts2.origin.toString().toLowerCase();
|
|
18164
18929
|
let isAllowed = false;
|
|
18165
18930
|
for (let i = 0; i < origins.length; i++) {
|
|
@@ -18182,7 +18947,7 @@ var require_cache2 = __commonJS({
|
|
|
18182
18947
|
...opts2,
|
|
18183
18948
|
headers: normalizeHeaders(opts2)
|
|
18184
18949
|
};
|
|
18185
|
-
const reqCacheControl = opts2.headers?.["cache-control"] ? parseCacheControlHeader(opts2.headers["cache-control"]) : void 0;
|
|
18950
|
+
const reqCacheControl = opts2.headers?.["cache-control"] ? parseCacheControlHeader(opts2.headers["cache-control"]) : hasPragmaNoCache(opts2.headers) ? { "no-cache": true } : void 0;
|
|
18186
18951
|
if (reqCacheControl?.["no-store"]) {
|
|
18187
18952
|
return dispatch(opts2, handler);
|
|
18188
18953
|
}
|
|
@@ -18242,6 +19007,8 @@ var require_decompress = __commonJS({
|
|
|
18242
19007
|
var DecompressHandler = class extends DecoratorHandler {
|
|
18243
19008
|
/** @type {Transform[]} */
|
|
18244
19009
|
#decompressors = [];
|
|
19010
|
+
/** @type {Record<string, string | string[]> | undefined} */
|
|
19011
|
+
#trailers;
|
|
18245
19012
|
/** @type {Readonly<number[]>} */
|
|
18246
19013
|
#skipStatusCodes;
|
|
18247
19014
|
/** @type {boolean} */
|
|
@@ -18317,7 +19084,7 @@ var require_decompress = __commonJS({
|
|
|
18317
19084
|
const decompressor = this.#decompressors[0];
|
|
18318
19085
|
this.#setupDecompressorEvents(decompressor, controller);
|
|
18319
19086
|
decompressor.on("end", () => {
|
|
18320
|
-
super.onResponseEnd(controller,
|
|
19087
|
+
super.onResponseEnd(controller, this.#trailers);
|
|
18321
19088
|
});
|
|
18322
19089
|
}
|
|
18323
19090
|
/**
|
|
@@ -18333,7 +19100,7 @@ var require_decompress = __commonJS({
|
|
|
18333
19100
|
super.onResponseError(controller, err);
|
|
18334
19101
|
return;
|
|
18335
19102
|
}
|
|
18336
|
-
super.onResponseEnd(controller,
|
|
19103
|
+
super.onResponseEnd(controller, this.#trailers);
|
|
18337
19104
|
});
|
|
18338
19105
|
}
|
|
18339
19106
|
/**
|
|
@@ -18411,6 +19178,7 @@ var require_decompress = __commonJS({
|
|
|
18411
19178
|
*/
|
|
18412
19179
|
onResponseEnd(controller, trailers) {
|
|
18413
19180
|
if (this.#decompressors.length > 0) {
|
|
19181
|
+
this.#trailers = trailers;
|
|
18414
19182
|
this.#decompressors[0].end();
|
|
18415
19183
|
this.#cleanupDecompressors();
|
|
18416
19184
|
return;
|
|
@@ -18854,7 +19622,7 @@ var require_deduplicate = __commonJS({
|
|
|
18854
19622
|
const pendingRequests = /* @__PURE__ */ new Map();
|
|
18855
19623
|
return (dispatch) => {
|
|
18856
19624
|
return (opts2, handler) => {
|
|
18857
|
-
if (
|
|
19625
|
+
if (opts2.upgrade || methods.includes(opts2.method) === false) {
|
|
18858
19626
|
return dispatch(opts2, handler);
|
|
18859
19627
|
}
|
|
18860
19628
|
opts2 = {
|
|
@@ -19252,7 +20020,12 @@ var require_sqlite_cache_store = __commonJS({
|
|
|
19252
20020
|
if (lhs.length !== rhs.length) {
|
|
19253
20021
|
return false;
|
|
19254
20022
|
}
|
|
19255
|
-
|
|
20023
|
+
for (let i = 0; i < lhs.length; i++) {
|
|
20024
|
+
if (lhs[i] !== rhs[i]) {
|
|
20025
|
+
return false;
|
|
20026
|
+
}
|
|
20027
|
+
}
|
|
20028
|
+
return true;
|
|
19256
20029
|
}
|
|
19257
20030
|
return lhs === rhs;
|
|
19258
20031
|
}
|
|
@@ -20205,7 +20978,7 @@ var require_request2 = __commonJS({
|
|
|
20205
20978
|
}
|
|
20206
20979
|
}
|
|
20207
20980
|
var patchMethodWarning = false;
|
|
20208
|
-
var
|
|
20981
|
+
var Request2 = class _Request {
|
|
20209
20982
|
/** @type {AbortSignal} */
|
|
20210
20983
|
#signal;
|
|
20211
20984
|
/** @type {import('../../dispatcher/dispatcher')} */
|
|
@@ -20710,15 +21483,15 @@ var require_request2 = __commonJS({
|
|
|
20710
21483
|
request.#abortCleanup?.();
|
|
20711
21484
|
}
|
|
20712
21485
|
};
|
|
20713
|
-
var { setRequestSignal, getRequestDispatcher, setRequestDispatcher, setRequestHeaders, getRequestState, setRequestState, removeRequestAbortListener } =
|
|
20714
|
-
Reflect.deleteProperty(
|
|
20715
|
-
Reflect.deleteProperty(
|
|
20716
|
-
Reflect.deleteProperty(
|
|
20717
|
-
Reflect.deleteProperty(
|
|
20718
|
-
Reflect.deleteProperty(
|
|
20719
|
-
Reflect.deleteProperty(
|
|
20720
|
-
Reflect.deleteProperty(
|
|
20721
|
-
mixinBody(
|
|
21486
|
+
var { setRequestSignal, getRequestDispatcher, setRequestDispatcher, setRequestHeaders, getRequestState, setRequestState, removeRequestAbortListener } = Request2;
|
|
21487
|
+
Reflect.deleteProperty(Request2, "setRequestSignal");
|
|
21488
|
+
Reflect.deleteProperty(Request2, "getRequestDispatcher");
|
|
21489
|
+
Reflect.deleteProperty(Request2, "setRequestDispatcher");
|
|
21490
|
+
Reflect.deleteProperty(Request2, "setRequestHeaders");
|
|
21491
|
+
Reflect.deleteProperty(Request2, "getRequestState");
|
|
21492
|
+
Reflect.deleteProperty(Request2, "setRequestState");
|
|
21493
|
+
Reflect.deleteProperty(Request2, "removeRequestAbortListener");
|
|
21494
|
+
mixinBody(Request2, getRequestState);
|
|
20722
21495
|
function makeRequest(init) {
|
|
20723
21496
|
return {
|
|
20724
21497
|
method: init.method ?? "GET",
|
|
@@ -20772,7 +21545,7 @@ var require_request2 = __commonJS({
|
|
|
20772
21545
|
return newRequest;
|
|
20773
21546
|
}
|
|
20774
21547
|
function fromInnerRequest(innerRequest, dispatcher, signal, guard) {
|
|
20775
|
-
const request = new
|
|
21548
|
+
const request = new Request2(kConstruct);
|
|
20776
21549
|
setRequestState(request, innerRequest);
|
|
20777
21550
|
setRequestDispatcher(request, dispatcher);
|
|
20778
21551
|
setRequestSignal(request, signal);
|
|
@@ -20782,7 +21555,7 @@ var require_request2 = __commonJS({
|
|
|
20782
21555
|
setHeadersGuard(headers, guard);
|
|
20783
21556
|
return request;
|
|
20784
21557
|
}
|
|
20785
|
-
Object.defineProperties(
|
|
21558
|
+
Object.defineProperties(Request2.prototype, {
|
|
20786
21559
|
method: kEnumerableProperty,
|
|
20787
21560
|
url: kEnumerableProperty,
|
|
20788
21561
|
headers: kEnumerableProperty,
|
|
@@ -20808,7 +21581,7 @@ var require_request2 = __commonJS({
|
|
|
20808
21581
|
configurable: true
|
|
20809
21582
|
}
|
|
20810
21583
|
});
|
|
20811
|
-
webidl.is.Request = webidl.util.MakeTypeAssertion(
|
|
21584
|
+
webidl.is.Request = webidl.util.MakeTypeAssertion(Request2);
|
|
20812
21585
|
webidl.converters.RequestInfo = function(V) {
|
|
20813
21586
|
if (typeof V === "string") {
|
|
20814
21587
|
return webidl.converters.USVString(V);
|
|
@@ -20907,7 +21680,7 @@ var require_request2 = __commonJS({
|
|
|
20907
21680
|
}
|
|
20908
21681
|
]);
|
|
20909
21682
|
module2.exports = {
|
|
20910
|
-
Request,
|
|
21683
|
+
Request: Request2,
|
|
20911
21684
|
makeRequest,
|
|
20912
21685
|
fromInnerRequest,
|
|
20913
21686
|
cloneRequest,
|
|
@@ -21070,7 +21843,7 @@ var require_fetch = __commonJS({
|
|
|
21070
21843
|
getResponseState
|
|
21071
21844
|
} = require_response();
|
|
21072
21845
|
var { HeadersList } = require_headers();
|
|
21073
|
-
var { Request, cloneRequest, getRequestDispatcher, getRequestState, removeRequestAbortListener } = require_request2();
|
|
21846
|
+
var { Request: Request2, cloneRequest, getRequestDispatcher, getRequestState, removeRequestAbortListener } = require_request2();
|
|
21074
21847
|
var zlib = require("node:zlib");
|
|
21075
21848
|
var {
|
|
21076
21849
|
makePolicyContainer,
|
|
@@ -21190,7 +21963,7 @@ var require_fetch = __commonJS({
|
|
|
21190
21963
|
let p = Promise.withResolvers();
|
|
21191
21964
|
let requestObject;
|
|
21192
21965
|
try {
|
|
21193
|
-
requestObject = new
|
|
21966
|
+
requestObject = new Request2(input, init);
|
|
21194
21967
|
} catch (e) {
|
|
21195
21968
|
p.reject(e);
|
|
21196
21969
|
return p.promise;
|
|
@@ -22049,13 +22822,13 @@ var require_fetch = __commonJS({
|
|
|
22049
22822
|
function dispatch({ body }) {
|
|
22050
22823
|
const url = requestCurrentURL(request);
|
|
22051
22824
|
const agent = fetchParams.controller.dispatcher;
|
|
22052
|
-
const
|
|
22825
|
+
const path10 = url.pathname + url.search;
|
|
22053
22826
|
const hasTrailingQuestionMark = url.search.length === 0 && url.href[url.href.length - url.hash.length - 1] === "?";
|
|
22054
22827
|
return dispatchWithProtocolPreference(body);
|
|
22055
22828
|
function dispatchWithProtocolPreference(body2, allowH2) {
|
|
22056
22829
|
return new Promise((resolve3, reject) => agent.dispatch(
|
|
22057
22830
|
{
|
|
22058
|
-
path: hasTrailingQuestionMark ? `${
|
|
22831
|
+
path: hasTrailingQuestionMark ? `${path10}?` : path10,
|
|
22059
22832
|
origin: url.origin,
|
|
22060
22833
|
method: request.method,
|
|
22061
22834
|
body: agent.isMockActive ? request.body && (request.body.source || request.body.stream) : body2,
|
|
@@ -22245,7 +23018,7 @@ var require_cache3 = __commonJS({
|
|
|
22245
23018
|
var { kEnumerableProperty, isDisturbed } = require_util();
|
|
22246
23019
|
var { webidl } = require_webidl();
|
|
22247
23020
|
var { cloneResponse, fromInnerResponse, getResponseState } = require_response();
|
|
22248
|
-
var { Request, fromInnerRequest, getRequestState } = require_request2();
|
|
23021
|
+
var { Request: Request2, fromInnerRequest, getRequestState } = require_request2();
|
|
22249
23022
|
var { fetching } = require_fetch();
|
|
22250
23023
|
var { urlIsHttpHttpsScheme, readAllBytes } = require_util2();
|
|
22251
23024
|
var Cache = class _Cache {
|
|
@@ -22317,7 +23090,7 @@ var require_cache3 = __commonJS({
|
|
|
22317
23090
|
}
|
|
22318
23091
|
const fetchControllers = [];
|
|
22319
23092
|
for (const request of requests) {
|
|
22320
|
-
const r = getRequestState(new
|
|
23093
|
+
const r = getRequestState(new Request2(request));
|
|
22321
23094
|
if (!urlIsHttpHttpsScheme(r.url)) {
|
|
22322
23095
|
throw webidl.errors.exception({
|
|
22323
23096
|
header: prefix,
|
|
@@ -22404,7 +23177,7 @@ var require_cache3 = __commonJS({
|
|
|
22404
23177
|
if (webidl.is.Request(request)) {
|
|
22405
23178
|
innerRequest = getRequestState(request);
|
|
22406
23179
|
} else {
|
|
22407
|
-
innerRequest = getRequestState(new
|
|
23180
|
+
innerRequest = getRequestState(new Request2(request));
|
|
22408
23181
|
}
|
|
22409
23182
|
if (!urlIsHttpHttpsScheme(innerRequest.url) || innerRequest.method !== "GET") {
|
|
22410
23183
|
throw webidl.errors.exception({
|
|
@@ -22489,7 +23262,7 @@ var require_cache3 = __commonJS({
|
|
|
22489
23262
|
}
|
|
22490
23263
|
} else {
|
|
22491
23264
|
assert(typeof request === "string");
|
|
22492
|
-
r = getRequestState(new
|
|
23265
|
+
r = getRequestState(new Request2(request));
|
|
22493
23266
|
}
|
|
22494
23267
|
const operations = [];
|
|
22495
23268
|
const operation = {
|
|
@@ -22534,7 +23307,7 @@ var require_cache3 = __commonJS({
|
|
|
22534
23307
|
return [];
|
|
22535
23308
|
}
|
|
22536
23309
|
} else if (typeof request === "string") {
|
|
22537
|
-
r = getRequestState(new
|
|
23310
|
+
r = getRequestState(new Request2(request));
|
|
22538
23311
|
}
|
|
22539
23312
|
}
|
|
22540
23313
|
const promise = Promise.withResolvers();
|
|
@@ -22707,7 +23480,7 @@ var require_cache3 = __commonJS({
|
|
|
22707
23480
|
return [];
|
|
22708
23481
|
}
|
|
22709
23482
|
} else if (typeof request === "string") {
|
|
22710
|
-
r = getRequestState(new
|
|
23483
|
+
r = getRequestState(new Request2(request));
|
|
22711
23484
|
}
|
|
22712
23485
|
}
|
|
22713
23486
|
const responses = [];
|
|
@@ -22967,9 +23740,9 @@ var require_util4 = __commonJS({
|
|
|
22967
23740
|
}
|
|
22968
23741
|
}
|
|
22969
23742
|
}
|
|
22970
|
-
function validateCookiePath(
|
|
22971
|
-
for (let i = 0; i <
|
|
22972
|
-
const code =
|
|
23743
|
+
function validateCookiePath(path10) {
|
|
23744
|
+
for (let i = 0; i < path10.length; ++i) {
|
|
23745
|
+
const code = path10.charCodeAt(i);
|
|
22973
23746
|
if (code < 32 || // exclude CTLs (0-31)
|
|
22974
23747
|
code > 126 || // exclude non-ascii and DEL
|
|
22975
23748
|
code === 59) {
|
|
@@ -22977,8 +23750,42 @@ var require_util4 = __commonJS({
|
|
|
22977
23750
|
}
|
|
22978
23751
|
}
|
|
22979
23752
|
}
|
|
23753
|
+
function isLetterOrDigit(code) {
|
|
23754
|
+
return code >= 48 && code <= 57 || // 0-9
|
|
23755
|
+
code >= 65 && code <= 90 || // A-Z
|
|
23756
|
+
code >= 97 && code <= 122;
|
|
23757
|
+
}
|
|
22980
23758
|
function validateCookieDomain(domain) {
|
|
22981
|
-
if (domain
|
|
23759
|
+
if (domain === " ") {
|
|
23760
|
+
return;
|
|
23761
|
+
}
|
|
23762
|
+
if (domain.length > 255) {
|
|
23763
|
+
throw new Error("Invalid cookie domain");
|
|
23764
|
+
}
|
|
23765
|
+
let labelLength = 0;
|
|
23766
|
+
for (let i = 0; i < domain.length; ++i) {
|
|
23767
|
+
const code = domain.charCodeAt(i);
|
|
23768
|
+
if (code === 46) {
|
|
23769
|
+
if (labelLength === 0) {
|
|
23770
|
+
throw new Error("Invalid cookie domain");
|
|
23771
|
+
}
|
|
23772
|
+
if (domain.charCodeAt(i - 1) === 45) {
|
|
23773
|
+
throw new Error("Invalid cookie domain");
|
|
23774
|
+
}
|
|
23775
|
+
labelLength = 0;
|
|
23776
|
+
continue;
|
|
23777
|
+
}
|
|
23778
|
+
if (labelLength === 0 && !isLetterOrDigit(code)) {
|
|
23779
|
+
throw new Error("Invalid cookie domain");
|
|
23780
|
+
}
|
|
23781
|
+
if (!isLetterOrDigit(code) && code !== 45) {
|
|
23782
|
+
throw new Error("Invalid cookie domain");
|
|
23783
|
+
}
|
|
23784
|
+
if (++labelLength > 63) {
|
|
23785
|
+
throw new Error("Invalid cookie domain");
|
|
23786
|
+
}
|
|
23787
|
+
}
|
|
23788
|
+
if (labelLength === 0 || domain.charCodeAt(domain.length - 1) === 45) {
|
|
22982
23789
|
throw new Error("Invalid cookie domain");
|
|
22983
23790
|
}
|
|
22984
23791
|
}
|
|
@@ -23061,7 +23868,11 @@ var require_util4 = __commonJS({
|
|
|
23061
23868
|
throw new Error("Invalid unparsed");
|
|
23062
23869
|
}
|
|
23063
23870
|
const [key, ...value] = part.split("=");
|
|
23064
|
-
|
|
23871
|
+
const trimmedKey = key.trim();
|
|
23872
|
+
const joinedValue = value.join("=");
|
|
23873
|
+
validateCookieName(trimmedKey);
|
|
23874
|
+
validateCookieValue(joinedValue);
|
|
23875
|
+
out.push(`${trimmedKey}=${joinedValue}`);
|
|
23065
23876
|
}
|
|
23066
23877
|
return out.join("; ");
|
|
23067
23878
|
}
|
|
@@ -24661,6 +25472,8 @@ var require_websocket = __commonJS({
|
|
|
24661
25472
|
var { SendQueue } = require_sender();
|
|
24662
25473
|
var { WebsocketFrameSend } = require_frame();
|
|
24663
25474
|
var { channels } = require_diagnostics();
|
|
25475
|
+
var kRef = /* @__PURE__ */ Symbol.for("nodejs.ref");
|
|
25476
|
+
var kUnref = /* @__PURE__ */ Symbol.for("nodejs.unref");
|
|
24664
25477
|
function getSocketAddress(socket) {
|
|
24665
25478
|
if (typeof socket?.address === "function") {
|
|
24666
25479
|
return socket.address();
|
|
@@ -24680,6 +25493,7 @@ var require_websocket = __commonJS({
|
|
|
24680
25493
|
#bufferedAmount = 0;
|
|
24681
25494
|
#protocol = "";
|
|
24682
25495
|
#extensions = "";
|
|
25496
|
+
#refed = true;
|
|
24683
25497
|
/** @type {SendQueue} */
|
|
24684
25498
|
#sendQueue;
|
|
24685
25499
|
/** @type {Handler} */
|
|
@@ -24762,6 +25576,16 @@ var require_websocket = __commonJS({
|
|
|
24762
25576
|
this.#handler.readyState = _WebSocket.CONNECTING;
|
|
24763
25577
|
this.#binaryType = "blob";
|
|
24764
25578
|
}
|
|
25579
|
+
[kRef]() {
|
|
25580
|
+
webidl.brandCheck(this, _WebSocket);
|
|
25581
|
+
this.#refed = true;
|
|
25582
|
+
this.#handler.socket?.ref?.();
|
|
25583
|
+
}
|
|
25584
|
+
[kUnref]() {
|
|
25585
|
+
webidl.brandCheck(this, _WebSocket);
|
|
25586
|
+
this.#refed = false;
|
|
25587
|
+
this.#handler.socket?.unref?.();
|
|
25588
|
+
}
|
|
24765
25589
|
/**
|
|
24766
25590
|
* @see https://websockets.spec.whatwg.org/#dom-websocket-close
|
|
24767
25591
|
* @param {number|undefined} code
|
|
@@ -24923,6 +25747,9 @@ var require_websocket = __commonJS({
|
|
|
24923
25747
|
*/
|
|
24924
25748
|
#onConnectionEstablished(response, parsedExtensions) {
|
|
24925
25749
|
this.#handler.socket = response.socket;
|
|
25750
|
+
if (!this.#refed) {
|
|
25751
|
+
this.#handler.socket.unref?.();
|
|
25752
|
+
}
|
|
24926
25753
|
const maxFragments = this.#handler.controller.dispatcher?.webSocketOptions?.maxFragments;
|
|
24927
25754
|
const maxPayloadSize = this.#handler.controller.dispatcher?.webSocketOptions?.maxPayloadSize;
|
|
24928
25755
|
const parser = new ByteParser(this.#handler, parsedExtensions, {
|
|
@@ -26287,11 +27114,11 @@ var require_undici = __commonJS({
|
|
|
26287
27114
|
if (typeof opts.path !== "string") {
|
|
26288
27115
|
throw new InvalidArgumentError("invalid opts.path");
|
|
26289
27116
|
}
|
|
26290
|
-
let
|
|
27117
|
+
let path10 = opts.path;
|
|
26291
27118
|
if (!opts.path.startsWith("/")) {
|
|
26292
|
-
|
|
27119
|
+
path10 = `/${path10}`;
|
|
26293
27120
|
}
|
|
26294
|
-
url = new URL(util.parseOrigin(url).origin +
|
|
27121
|
+
url = new URL(util.parseOrigin(url).origin + path10);
|
|
26295
27122
|
} else {
|
|
26296
27123
|
if (!opts) {
|
|
26297
27124
|
opts = typeof url === "object" ? url : {};
|
|
@@ -34169,10 +34996,10 @@ var require_util7 = __commonJS({
|
|
|
34169
34996
|
function cloneDef(schema) {
|
|
34170
34997
|
return mergeDefs(schema._zod.def);
|
|
34171
34998
|
}
|
|
34172
|
-
function getElementAtPath(obj,
|
|
34173
|
-
if (!
|
|
34999
|
+
function getElementAtPath(obj, path10) {
|
|
35000
|
+
if (!path10)
|
|
34174
35001
|
return obj;
|
|
34175
|
-
return
|
|
35002
|
+
return path10.reduce((acc, key) => acc?.[key], obj);
|
|
34176
35003
|
}
|
|
34177
35004
|
function promiseAllObject(promisesObj) {
|
|
34178
35005
|
const keys = Object.keys(promisesObj);
|
|
@@ -34582,11 +35409,11 @@ var require_util7 = __commonJS({
|
|
|
34582
35409
|
}
|
|
34583
35410
|
return false;
|
|
34584
35411
|
}
|
|
34585
|
-
function prefixIssues(
|
|
35412
|
+
function prefixIssues(path10, issues) {
|
|
34586
35413
|
return issues.map((iss) => {
|
|
34587
35414
|
var _a;
|
|
34588
35415
|
(_a = iss).path ?? (_a.path = []);
|
|
34589
|
-
iss.path.unshift(
|
|
35416
|
+
iss.path.unshift(path10);
|
|
34590
35417
|
return iss;
|
|
34591
35418
|
});
|
|
34592
35419
|
}
|
|
@@ -34775,16 +35602,16 @@ var require_errors2 = __commonJS({
|
|
|
34775
35602
|
}
|
|
34776
35603
|
function formatError2(error2, mapper = (issue2) => issue2.message) {
|
|
34777
35604
|
const fieldErrors = { _errors: [] };
|
|
34778
|
-
const processError = (error3,
|
|
35605
|
+
const processError = (error3, path10 = []) => {
|
|
34779
35606
|
for (const issue2 of error3.issues) {
|
|
34780
35607
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
34781
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
35608
|
+
issue2.errors.map((issues) => processError({ issues }, [...path10, ...issue2.path]));
|
|
34782
35609
|
} else if (issue2.code === "invalid_key") {
|
|
34783
|
-
processError({ issues: issue2.issues }, [...
|
|
35610
|
+
processError({ issues: issue2.issues }, [...path10, ...issue2.path]);
|
|
34784
35611
|
} else if (issue2.code === "invalid_element") {
|
|
34785
|
-
processError({ issues: issue2.issues }, [...
|
|
35612
|
+
processError({ issues: issue2.issues }, [...path10, ...issue2.path]);
|
|
34786
35613
|
} else {
|
|
34787
|
-
const fullpath = [...
|
|
35614
|
+
const fullpath = [...path10, ...issue2.path];
|
|
34788
35615
|
if (fullpath.length === 0) {
|
|
34789
35616
|
fieldErrors._errors.push(mapper(issue2));
|
|
34790
35617
|
} else {
|
|
@@ -34811,17 +35638,17 @@ var require_errors2 = __commonJS({
|
|
|
34811
35638
|
}
|
|
34812
35639
|
function treeifyError(error2, mapper = (issue2) => issue2.message) {
|
|
34813
35640
|
const result = { errors: [] };
|
|
34814
|
-
const processError = (error3,
|
|
35641
|
+
const processError = (error3, path10 = []) => {
|
|
34815
35642
|
var _a, _b;
|
|
34816
35643
|
for (const issue2 of error3.issues) {
|
|
34817
35644
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
34818
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
35645
|
+
issue2.errors.map((issues) => processError({ issues }, [...path10, ...issue2.path]));
|
|
34819
35646
|
} else if (issue2.code === "invalid_key") {
|
|
34820
|
-
processError({ issues: issue2.issues }, [...
|
|
35647
|
+
processError({ issues: issue2.issues }, [...path10, ...issue2.path]);
|
|
34821
35648
|
} else if (issue2.code === "invalid_element") {
|
|
34822
|
-
processError({ issues: issue2.issues }, [...
|
|
35649
|
+
processError({ issues: issue2.issues }, [...path10, ...issue2.path]);
|
|
34823
35650
|
} else {
|
|
34824
|
-
const fullpath = [...
|
|
35651
|
+
const fullpath = [...path10, ...issue2.path];
|
|
34825
35652
|
if (fullpath.length === 0) {
|
|
34826
35653
|
result.errors.push(mapper(issue2));
|
|
34827
35654
|
continue;
|
|
@@ -34853,8 +35680,8 @@ var require_errors2 = __commonJS({
|
|
|
34853
35680
|
}
|
|
34854
35681
|
function toDotPath(_path) {
|
|
34855
35682
|
const segs = [];
|
|
34856
|
-
const
|
|
34857
|
-
for (const seg of
|
|
35683
|
+
const path10 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
|
|
35684
|
+
for (const seg of path10) {
|
|
34858
35685
|
if (typeof seg === "number")
|
|
34859
35686
|
segs.push(`[${seg}]`);
|
|
34860
35687
|
else if (typeof seg === "symbol")
|
|
@@ -62005,11 +62832,11 @@ var require_lodash = __commonJS({
|
|
|
62005
62832
|
return isFunction(object[key]);
|
|
62006
62833
|
});
|
|
62007
62834
|
}
|
|
62008
|
-
function baseGet(object,
|
|
62009
|
-
|
|
62010
|
-
var index = 0, length =
|
|
62835
|
+
function baseGet(object, path10) {
|
|
62836
|
+
path10 = castPath(path10, object);
|
|
62837
|
+
var index = 0, length = path10.length;
|
|
62011
62838
|
while (object != null && index < length) {
|
|
62012
|
-
object = object[toKey(
|
|
62839
|
+
object = object[toKey(path10[index++])];
|
|
62013
62840
|
}
|
|
62014
62841
|
return index && index == length ? object : undefined2;
|
|
62015
62842
|
}
|
|
@@ -62073,10 +62900,10 @@ var require_lodash = __commonJS({
|
|
|
62073
62900
|
});
|
|
62074
62901
|
return accumulator;
|
|
62075
62902
|
}
|
|
62076
|
-
function baseInvoke(object,
|
|
62077
|
-
|
|
62078
|
-
object = parent(object,
|
|
62079
|
-
var func = object == null ? object : object[toKey(last(
|
|
62903
|
+
function baseInvoke(object, path10, args) {
|
|
62904
|
+
path10 = castPath(path10, object);
|
|
62905
|
+
object = parent(object, path10);
|
|
62906
|
+
var func = object == null ? object : object[toKey(last(path10))];
|
|
62080
62907
|
return func == null ? undefined2 : apply(func, object, args);
|
|
62081
62908
|
}
|
|
62082
62909
|
function baseIsArguments(value) {
|
|
@@ -62232,13 +63059,13 @@ var require_lodash = __commonJS({
|
|
|
62232
63059
|
return object === source || baseIsMatch(object, source, matchData);
|
|
62233
63060
|
};
|
|
62234
63061
|
}
|
|
62235
|
-
function baseMatchesProperty(
|
|
62236
|
-
if (isKey(
|
|
62237
|
-
return matchesStrictComparable(toKey(
|
|
63062
|
+
function baseMatchesProperty(path10, srcValue) {
|
|
63063
|
+
if (isKey(path10) && isStrictComparable(srcValue)) {
|
|
63064
|
+
return matchesStrictComparable(toKey(path10), srcValue);
|
|
62238
63065
|
}
|
|
62239
63066
|
return function(object) {
|
|
62240
|
-
var objValue = get(object,
|
|
62241
|
-
return objValue === undefined2 && objValue === srcValue ? hasIn(object,
|
|
63067
|
+
var objValue = get(object, path10);
|
|
63068
|
+
return objValue === undefined2 && objValue === srcValue ? hasIn(object, path10) : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
|
|
62242
63069
|
};
|
|
62243
63070
|
}
|
|
62244
63071
|
function baseMerge(object, source, srcIndex, customizer, stack) {
|
|
@@ -62335,23 +63162,23 @@ var require_lodash = __commonJS({
|
|
|
62335
63162
|
});
|
|
62336
63163
|
}
|
|
62337
63164
|
function basePick(object, paths) {
|
|
62338
|
-
return basePickBy(object, paths, function(value,
|
|
62339
|
-
return hasIn(object,
|
|
63165
|
+
return basePickBy(object, paths, function(value, path10) {
|
|
63166
|
+
return hasIn(object, path10);
|
|
62340
63167
|
});
|
|
62341
63168
|
}
|
|
62342
63169
|
function basePickBy(object, paths, predicate) {
|
|
62343
63170
|
var index = -1, length = paths.length, result2 = {};
|
|
62344
63171
|
while (++index < length) {
|
|
62345
|
-
var
|
|
62346
|
-
if (predicate(value,
|
|
62347
|
-
baseSet(result2, castPath(
|
|
63172
|
+
var path10 = paths[index], value = baseGet(object, path10);
|
|
63173
|
+
if (predicate(value, path10)) {
|
|
63174
|
+
baseSet(result2, castPath(path10, object), value);
|
|
62348
63175
|
}
|
|
62349
63176
|
}
|
|
62350
63177
|
return result2;
|
|
62351
63178
|
}
|
|
62352
|
-
function basePropertyDeep(
|
|
63179
|
+
function basePropertyDeep(path10) {
|
|
62353
63180
|
return function(object) {
|
|
62354
|
-
return baseGet(object,
|
|
63181
|
+
return baseGet(object, path10);
|
|
62355
63182
|
};
|
|
62356
63183
|
}
|
|
62357
63184
|
function basePullAll(array, values2, iteratee2, comparator) {
|
|
@@ -62425,14 +63252,14 @@ var require_lodash = __commonJS({
|
|
|
62425
63252
|
var array = values(collection);
|
|
62426
63253
|
return shuffleSelf(array, baseClamp(n, 0, array.length));
|
|
62427
63254
|
}
|
|
62428
|
-
function baseSet(object,
|
|
63255
|
+
function baseSet(object, path10, value, customizer) {
|
|
62429
63256
|
if (!isObject(object)) {
|
|
62430
63257
|
return object;
|
|
62431
63258
|
}
|
|
62432
|
-
|
|
62433
|
-
var index = -1, length =
|
|
63259
|
+
path10 = castPath(path10, object);
|
|
63260
|
+
var index = -1, length = path10.length, lastIndex = length - 1, nested = object;
|
|
62434
63261
|
while (nested != null && ++index < length) {
|
|
62435
|
-
var key = toKey(
|
|
63262
|
+
var key = toKey(path10[index]), newValue = value;
|
|
62436
63263
|
if (key === "__proto__" || key === "constructor" || key === "prototype") {
|
|
62437
63264
|
return object;
|
|
62438
63265
|
}
|
|
@@ -62440,7 +63267,7 @@ var require_lodash = __commonJS({
|
|
|
62440
63267
|
var objValue = nested[key];
|
|
62441
63268
|
newValue = customizer ? customizer(objValue, key, nested) : undefined2;
|
|
62442
63269
|
if (newValue === undefined2) {
|
|
62443
|
-
newValue = isObject(objValue) ? objValue : isIndex(
|
|
63270
|
+
newValue = isObject(objValue) ? objValue : isIndex(path10[index + 1]) ? [] : {};
|
|
62444
63271
|
}
|
|
62445
63272
|
}
|
|
62446
63273
|
assignValue(nested, key, newValue);
|
|
@@ -62606,14 +63433,14 @@ var require_lodash = __commonJS({
|
|
|
62606
63433
|
}
|
|
62607
63434
|
return result2;
|
|
62608
63435
|
}
|
|
62609
|
-
function baseUnset(object,
|
|
62610
|
-
|
|
62611
|
-
var index = -1, length =
|
|
63436
|
+
function baseUnset(object, path10) {
|
|
63437
|
+
path10 = castPath(path10, object);
|
|
63438
|
+
var index = -1, length = path10.length;
|
|
62612
63439
|
if (!length) {
|
|
62613
63440
|
return true;
|
|
62614
63441
|
}
|
|
62615
63442
|
while (++index < length) {
|
|
62616
|
-
var key = toKey(
|
|
63443
|
+
var key = toKey(path10[index]);
|
|
62617
63444
|
if (key === "__proto__" && !hasOwnProperty.call(object, "__proto__")) {
|
|
62618
63445
|
return false;
|
|
62619
63446
|
}
|
|
@@ -62621,11 +63448,11 @@ var require_lodash = __commonJS({
|
|
|
62621
63448
|
return false;
|
|
62622
63449
|
}
|
|
62623
63450
|
}
|
|
62624
|
-
var obj = parent(object,
|
|
62625
|
-
return obj == null || delete obj[toKey(last(
|
|
63451
|
+
var obj = parent(object, path10);
|
|
63452
|
+
return obj == null || delete obj[toKey(last(path10))];
|
|
62626
63453
|
}
|
|
62627
|
-
function baseUpdate(object,
|
|
62628
|
-
return baseSet(object,
|
|
63454
|
+
function baseUpdate(object, path10, updater, customizer) {
|
|
63455
|
+
return baseSet(object, path10, updater(baseGet(object, path10)), customizer);
|
|
62629
63456
|
}
|
|
62630
63457
|
function baseWhile(array, predicate, isDrop, fromRight) {
|
|
62631
63458
|
var length = array.length, index = fromRight ? length : -1;
|
|
@@ -63508,11 +64335,11 @@ var require_lodash = __commonJS({
|
|
|
63508
64335
|
var match = source.match(reWrapDetails);
|
|
63509
64336
|
return match ? match[1].split(reSplitDetails) : [];
|
|
63510
64337
|
}
|
|
63511
|
-
function hasPath(object,
|
|
63512
|
-
|
|
63513
|
-
var index = -1, length =
|
|
64338
|
+
function hasPath(object, path10, hasFunc) {
|
|
64339
|
+
path10 = castPath(path10, object);
|
|
64340
|
+
var index = -1, length = path10.length, result2 = false;
|
|
63514
64341
|
while (++index < length) {
|
|
63515
|
-
var key = toKey(
|
|
64342
|
+
var key = toKey(path10[index]);
|
|
63516
64343
|
if (!(result2 = object != null && hasFunc(object, key))) {
|
|
63517
64344
|
break;
|
|
63518
64345
|
}
|
|
@@ -63714,8 +64541,8 @@ var require_lodash = __commonJS({
|
|
|
63714
64541
|
return apply(func, this, otherArgs);
|
|
63715
64542
|
};
|
|
63716
64543
|
}
|
|
63717
|
-
function parent(object,
|
|
63718
|
-
return
|
|
64544
|
+
function parent(object, path10) {
|
|
64545
|
+
return path10.length < 2 ? object : baseGet(object, baseSlice(path10, 0, -1));
|
|
63719
64546
|
}
|
|
63720
64547
|
function reorder(array, indexes) {
|
|
63721
64548
|
var arrLength = array.length, length = nativeMin(indexes.length, arrLength), oldArray = copyArray(array);
|
|
@@ -64350,10 +65177,10 @@ var require_lodash = __commonJS({
|
|
|
64350
65177
|
}
|
|
64351
65178
|
return isString(collection) ? fromIndex <= length && collection.indexOf(value, fromIndex) > -1 : !!length && baseIndexOf(collection, value, fromIndex) > -1;
|
|
64352
65179
|
}
|
|
64353
|
-
var invokeMap = baseRest(function(collection,
|
|
64354
|
-
var index = -1, isFunc = typeof
|
|
65180
|
+
var invokeMap = baseRest(function(collection, path10, args) {
|
|
65181
|
+
var index = -1, isFunc = typeof path10 == "function", result2 = isArrayLike(collection) ? Array2(collection.length) : [];
|
|
64355
65182
|
baseEach(collection, function(value) {
|
|
64356
|
-
result2[++index] = isFunc ? apply(
|
|
65183
|
+
result2[++index] = isFunc ? apply(path10, value, args) : baseInvoke(value, path10, args);
|
|
64357
65184
|
});
|
|
64358
65185
|
return result2;
|
|
64359
65186
|
});
|
|
@@ -65005,15 +65832,15 @@ var require_lodash = __commonJS({
|
|
|
65005
65832
|
function functionsIn(object) {
|
|
65006
65833
|
return object == null ? [] : baseFunctions(object, keysIn(object));
|
|
65007
65834
|
}
|
|
65008
|
-
function get(object,
|
|
65009
|
-
var result2 = object == null ? undefined2 : baseGet(object,
|
|
65835
|
+
function get(object, path10, defaultValue) {
|
|
65836
|
+
var result2 = object == null ? undefined2 : baseGet(object, path10);
|
|
65010
65837
|
return result2 === undefined2 ? defaultValue : result2;
|
|
65011
65838
|
}
|
|
65012
|
-
function has(object,
|
|
65013
|
-
return object != null && hasPath(object,
|
|
65839
|
+
function has(object, path10) {
|
|
65840
|
+
return object != null && hasPath(object, path10, baseHas);
|
|
65014
65841
|
}
|
|
65015
|
-
function hasIn(object,
|
|
65016
|
-
return object != null && hasPath(object,
|
|
65842
|
+
function hasIn(object, path10) {
|
|
65843
|
+
return object != null && hasPath(object, path10, baseHasIn);
|
|
65017
65844
|
}
|
|
65018
65845
|
var invert = createInverter(function(result2, value, key) {
|
|
65019
65846
|
if (value != null && typeof value.toString != "function") {
|
|
@@ -65066,10 +65893,10 @@ var require_lodash = __commonJS({
|
|
|
65066
65893
|
return result2;
|
|
65067
65894
|
}
|
|
65068
65895
|
var isDeep = false;
|
|
65069
|
-
paths = arrayMap(paths, function(
|
|
65070
|
-
|
|
65071
|
-
isDeep || (isDeep =
|
|
65072
|
-
return
|
|
65896
|
+
paths = arrayMap(paths, function(path10) {
|
|
65897
|
+
path10 = castPath(path10, object);
|
|
65898
|
+
isDeep || (isDeep = path10.length > 1);
|
|
65899
|
+
return path10;
|
|
65073
65900
|
});
|
|
65074
65901
|
copyObject(object, getAllKeysIn(object), result2);
|
|
65075
65902
|
if (isDeep) {
|
|
@@ -65095,19 +65922,19 @@ var require_lodash = __commonJS({
|
|
|
65095
65922
|
return [prop];
|
|
65096
65923
|
});
|
|
65097
65924
|
predicate = getIteratee(predicate);
|
|
65098
|
-
return basePickBy(object, props, function(value,
|
|
65099
|
-
return predicate(value,
|
|
65925
|
+
return basePickBy(object, props, function(value, path10) {
|
|
65926
|
+
return predicate(value, path10[0]);
|
|
65100
65927
|
});
|
|
65101
65928
|
}
|
|
65102
|
-
function result(object,
|
|
65103
|
-
|
|
65104
|
-
var index = -1, length =
|
|
65929
|
+
function result(object, path10, defaultValue) {
|
|
65930
|
+
path10 = castPath(path10, object);
|
|
65931
|
+
var index = -1, length = path10.length;
|
|
65105
65932
|
if (!length) {
|
|
65106
65933
|
length = 1;
|
|
65107
65934
|
object = undefined2;
|
|
65108
65935
|
}
|
|
65109
65936
|
while (++index < length) {
|
|
65110
|
-
var value = object == null ? undefined2 : object[toKey(
|
|
65937
|
+
var value = object == null ? undefined2 : object[toKey(path10[index])];
|
|
65111
65938
|
if (value === undefined2) {
|
|
65112
65939
|
index = length;
|
|
65113
65940
|
value = defaultValue;
|
|
@@ -65116,12 +65943,12 @@ var require_lodash = __commonJS({
|
|
|
65116
65943
|
}
|
|
65117
65944
|
return object;
|
|
65118
65945
|
}
|
|
65119
|
-
function set(object,
|
|
65120
|
-
return object == null ? object : baseSet(object,
|
|
65946
|
+
function set(object, path10, value) {
|
|
65947
|
+
return object == null ? object : baseSet(object, path10, value);
|
|
65121
65948
|
}
|
|
65122
|
-
function setWith(object,
|
|
65949
|
+
function setWith(object, path10, value, customizer) {
|
|
65123
65950
|
customizer = typeof customizer == "function" ? customizer : undefined2;
|
|
65124
|
-
return object == null ? object : baseSet(object,
|
|
65951
|
+
return object == null ? object : baseSet(object, path10, value, customizer);
|
|
65125
65952
|
}
|
|
65126
65953
|
var toPairs = createToPairs(keys);
|
|
65127
65954
|
var toPairsIn = createToPairs(keysIn);
|
|
@@ -65143,15 +65970,15 @@ var require_lodash = __commonJS({
|
|
|
65143
65970
|
});
|
|
65144
65971
|
return accumulator;
|
|
65145
65972
|
}
|
|
65146
|
-
function unset(object,
|
|
65147
|
-
return object == null ? true : baseUnset(object,
|
|
65973
|
+
function unset(object, path10) {
|
|
65974
|
+
return object == null ? true : baseUnset(object, path10);
|
|
65148
65975
|
}
|
|
65149
|
-
function update(object,
|
|
65150
|
-
return object == null ? object : baseUpdate(object,
|
|
65976
|
+
function update(object, path10, updater) {
|
|
65977
|
+
return object == null ? object : baseUpdate(object, path10, castFunction(updater));
|
|
65151
65978
|
}
|
|
65152
|
-
function updateWith(object,
|
|
65979
|
+
function updateWith(object, path10, updater, customizer) {
|
|
65153
65980
|
customizer = typeof customizer == "function" ? customizer : undefined2;
|
|
65154
|
-
return object == null ? object : baseUpdate(object,
|
|
65981
|
+
return object == null ? object : baseUpdate(object, path10, castFunction(updater), customizer);
|
|
65155
65982
|
}
|
|
65156
65983
|
function values(object) {
|
|
65157
65984
|
return object == null ? [] : baseValues(object, keys(object));
|
|
@@ -65537,17 +66364,17 @@ var require_lodash = __commonJS({
|
|
|
65537
66364
|
function matches(source) {
|
|
65538
66365
|
return baseMatches(baseClone(source, CLONE_DEEP_FLAG));
|
|
65539
66366
|
}
|
|
65540
|
-
function matchesProperty(
|
|
65541
|
-
return baseMatchesProperty(
|
|
66367
|
+
function matchesProperty(path10, srcValue) {
|
|
66368
|
+
return baseMatchesProperty(path10, baseClone(srcValue, CLONE_DEEP_FLAG));
|
|
65542
66369
|
}
|
|
65543
|
-
var method = baseRest(function(
|
|
66370
|
+
var method = baseRest(function(path10, args) {
|
|
65544
66371
|
return function(object) {
|
|
65545
|
-
return baseInvoke(object,
|
|
66372
|
+
return baseInvoke(object, path10, args);
|
|
65546
66373
|
};
|
|
65547
66374
|
});
|
|
65548
66375
|
var methodOf = baseRest(function(object, args) {
|
|
65549
|
-
return function(
|
|
65550
|
-
return baseInvoke(object,
|
|
66376
|
+
return function(path10) {
|
|
66377
|
+
return baseInvoke(object, path10, args);
|
|
65551
66378
|
};
|
|
65552
66379
|
});
|
|
65553
66380
|
function mixin(object, source, options) {
|
|
@@ -65594,12 +66421,12 @@ var require_lodash = __commonJS({
|
|
|
65594
66421
|
var over = createOver(arrayMap);
|
|
65595
66422
|
var overEvery = createOver(arrayEvery);
|
|
65596
66423
|
var overSome = createOver(arraySome);
|
|
65597
|
-
function property(
|
|
65598
|
-
return isKey(
|
|
66424
|
+
function property(path10) {
|
|
66425
|
+
return isKey(path10) ? baseProperty(toKey(path10)) : basePropertyDeep(path10);
|
|
65599
66426
|
}
|
|
65600
66427
|
function propertyOf(object) {
|
|
65601
|
-
return function(
|
|
65602
|
-
return object == null ? undefined2 : baseGet(object,
|
|
66428
|
+
return function(path10) {
|
|
66429
|
+
return object == null ? undefined2 : baseGet(object, path10);
|
|
65603
66430
|
};
|
|
65604
66431
|
}
|
|
65605
66432
|
var range = createRange();
|
|
@@ -66052,12 +66879,12 @@ var require_lodash = __commonJS({
|
|
|
66052
66879
|
LazyWrapper.prototype.findLast = function(predicate) {
|
|
66053
66880
|
return this.reverse().find(predicate);
|
|
66054
66881
|
};
|
|
66055
|
-
LazyWrapper.prototype.invokeMap = baseRest(function(
|
|
66056
|
-
if (typeof
|
|
66882
|
+
LazyWrapper.prototype.invokeMap = baseRest(function(path10, args) {
|
|
66883
|
+
if (typeof path10 == "function") {
|
|
66057
66884
|
return new LazyWrapper(this);
|
|
66058
66885
|
}
|
|
66059
66886
|
return this.map(function(value) {
|
|
66060
|
-
return baseInvoke(value,
|
|
66887
|
+
return baseInvoke(value, path10, args);
|
|
66061
66888
|
});
|
|
66062
66889
|
});
|
|
66063
66890
|
LazyWrapper.prototype.reject = function(predicate) {
|
|
@@ -72341,7 +73168,7 @@ var require_url2 = __commonJS({
|
|
|
72341
73168
|
*/
|
|
72342
73169
|
update(url) {
|
|
72343
73170
|
!url && (url = E);
|
|
72344
|
-
var parsedUrl = _.isString(url) ? Url.parse(url) : url, auth = parsedUrl.auth, protocol = parsedUrl.protocol, port = parsedUrl.port,
|
|
73171
|
+
var parsedUrl = _.isString(url) ? Url.parse(url) : url, auth = parsedUrl.auth, protocol = parsedUrl.protocol, port = parsedUrl.port, path10 = parsedUrl.path, hash = parsedUrl.hash, host = parsedUrl.host, query = parsedUrl.query, variable = parsedUrl.variable;
|
|
72345
73172
|
if (query) {
|
|
72346
73173
|
if (_.isString(query)) {
|
|
72347
73174
|
query = QueryParam.parse(query);
|
|
@@ -72361,9 +73188,9 @@ var require_url2 = __commonJS({
|
|
|
72361
73188
|
return v;
|
|
72362
73189
|
});
|
|
72363
73190
|
}
|
|
72364
|
-
if (_.isString(
|
|
72365
|
-
|
|
72366
|
-
|
|
73191
|
+
if (_.isString(path10)) {
|
|
73192
|
+
path10 && (path10 = path10.replace(regexes.trimPath, MATCH_1));
|
|
73193
|
+
path10 = path10 ? path10 === PATH_SEPARATOR ? [E] : path10.split(PATH_SEPARATOR) : void 0;
|
|
72367
73194
|
}
|
|
72368
73195
|
_.isString(host) && (host = host.split(regexes.splitDomain));
|
|
72369
73196
|
_.assign(
|
|
@@ -72385,7 +73212,7 @@ var require_url2 = __commonJS({
|
|
|
72385
73212
|
/**
|
|
72386
73213
|
* @type {Array<String>}
|
|
72387
73214
|
*/
|
|
72388
|
-
path:
|
|
73215
|
+
path: path10,
|
|
72389
73216
|
/**
|
|
72390
73217
|
* @type {String}
|
|
72391
73218
|
*/
|
|
@@ -72527,11 +73354,11 @@ var require_url2 = __commonJS({
|
|
|
72527
73354
|
* @example /something/postman?hi=notbye
|
|
72528
73355
|
*/
|
|
72529
73356
|
getPathWithQuery() {
|
|
72530
|
-
var
|
|
73357
|
+
var path10 = this.getPath(), queryString = this.getQueryString();
|
|
72531
73358
|
if (queryString) {
|
|
72532
|
-
|
|
73359
|
+
path10 += QUERY_SEPARATOR + queryString;
|
|
72533
73360
|
}
|
|
72534
|
-
return
|
|
73361
|
+
return path10;
|
|
72535
73362
|
},
|
|
72536
73363
|
/**
|
|
72537
73364
|
* Returns the host part of the URL
|
|
@@ -72571,9 +73398,9 @@ var require_url2 = __commonJS({
|
|
|
72571
73398
|
* @note not discontinue yet because it's used in Twitter APIs public collections
|
|
72572
73399
|
*/
|
|
72573
73400
|
getOAuth1BaseUrl() {
|
|
72574
|
-
var protocol = this.protocol || PROTOCOL_HTTP, port = this.port ? this.port.toString() : void 0, host = (port === HTTP_PORT || port === HTTPS_PORT || port === void 0) && this.host.join(DOMAIN_SEPARATOR) || this.host.join(DOMAIN_SEPARATOR) + PORT_SEPARATOR + port,
|
|
73401
|
+
var protocol = this.protocol || PROTOCOL_HTTP, port = this.port ? this.port.toString() : void 0, host = (port === HTTP_PORT || port === HTTPS_PORT || port === void 0) && this.host.join(DOMAIN_SEPARATOR) || this.host.join(DOMAIN_SEPARATOR) + PORT_SEPARATOR + port, path10 = this.getPath();
|
|
72575
73402
|
protocol = _.endsWith(protocol, PROTOCOL_SEPARATOR) ? protocol : protocol + PROTOCOL_SEPARATOR;
|
|
72576
|
-
return protocol.toLowerCase() + host.toLowerCase() +
|
|
73403
|
+
return protocol.toLowerCase() + host.toLowerCase() + path10;
|
|
72577
73404
|
}
|
|
72578
73405
|
}
|
|
72579
73406
|
);
|
|
@@ -72828,9 +73655,9 @@ var require_url_match_pattern = __commonJS({
|
|
|
72828
73655
|
* @param {String=} path The path to be checked if the pattern allows.
|
|
72829
73656
|
* @returns {Boolean=}
|
|
72830
73657
|
*/
|
|
72831
|
-
testPath(
|
|
73658
|
+
testPath(path10) {
|
|
72832
73659
|
var matchRegexObject = this._matchPatternObject;
|
|
72833
|
-
return !_.isEmpty(
|
|
73660
|
+
return !_.isEmpty(path10.match(matchRegexObject.path));
|
|
72834
73661
|
},
|
|
72835
73662
|
/**
|
|
72836
73663
|
* Tests the url string with the match pattern provided.
|
|
@@ -74579,7 +75406,7 @@ var require_request13 = __commonJS({
|
|
|
74579
75406
|
var HeaderList = require_header_list().HeaderList;
|
|
74580
75407
|
var RequestBody = require_request_body2().RequestBody;
|
|
74581
75408
|
var RequestAuth = require_request_auth().RequestAuth;
|
|
74582
|
-
var
|
|
75409
|
+
var Request2;
|
|
74583
75410
|
var DEFAULT_REQ_METHOD = "GET";
|
|
74584
75411
|
var CONTENT_LENGTH = "Content-Length";
|
|
74585
75412
|
var SP = " ";
|
|
@@ -74598,8 +75425,8 @@ var require_request13 = __commonJS({
|
|
|
74598
75425
|
* @extends {Property}
|
|
74599
75426
|
* @param {Request.definition} options -
|
|
74600
75427
|
*/
|
|
74601
|
-
|
|
74602
|
-
|
|
75428
|
+
Request2 = function PostmanRequest(options) {
|
|
75429
|
+
Request2.super_.apply(this, arguments);
|
|
74603
75430
|
typeof options === "string" && (options = {
|
|
74604
75431
|
url: options
|
|
74605
75432
|
});
|
|
@@ -74629,7 +75456,7 @@ var require_request13 = __commonJS({
|
|
|
74629
75456
|
Property
|
|
74630
75457
|
);
|
|
74631
75458
|
_.assign(
|
|
74632
|
-
|
|
75459
|
+
Request2.prototype,
|
|
74633
75460
|
/** @lends Request.prototype */
|
|
74634
75461
|
{
|
|
74635
75462
|
/**
|
|
@@ -74831,12 +75658,12 @@ var require_request13 = __commonJS({
|
|
|
74831
75658
|
* @returns {Request}
|
|
74832
75659
|
*/
|
|
74833
75660
|
clone: function() {
|
|
74834
|
-
return new
|
|
75661
|
+
return new Request2(this.toJSON());
|
|
74835
75662
|
}
|
|
74836
75663
|
}
|
|
74837
75664
|
);
|
|
74838
75665
|
_.assign(
|
|
74839
|
-
|
|
75666
|
+
Request2,
|
|
74840
75667
|
/** @lends Request */
|
|
74841
75668
|
{
|
|
74842
75669
|
/**
|
|
@@ -74854,12 +75681,12 @@ var require_request13 = __commonJS({
|
|
|
74854
75681
|
* @returns {Boolean}
|
|
74855
75682
|
*/
|
|
74856
75683
|
isRequest: function(obj) {
|
|
74857
|
-
return Boolean(obj) && (obj instanceof
|
|
75684
|
+
return Boolean(obj) && (obj instanceof Request2 || _.inSuperChain(obj.constructor, "_postman_propertyName", Request2._postman_propertyName));
|
|
74858
75685
|
}
|
|
74859
75686
|
}
|
|
74860
75687
|
);
|
|
74861
75688
|
module2.exports = {
|
|
74862
|
-
Request
|
|
75689
|
+
Request: Request2
|
|
74863
75690
|
};
|
|
74864
75691
|
}
|
|
74865
75692
|
});
|
|
@@ -76604,11 +77431,11 @@ var require_Mime = __commonJS({
|
|
|
76604
77431
|
}
|
|
76605
77432
|
}
|
|
76606
77433
|
};
|
|
76607
|
-
Mime.prototype.getType = function(
|
|
76608
|
-
|
|
76609
|
-
let last =
|
|
77434
|
+
Mime.prototype.getType = function(path10) {
|
|
77435
|
+
path10 = String(path10);
|
|
77436
|
+
let last = path10.replace(/^.*[/\\]/, "").toLowerCase();
|
|
76610
77437
|
let ext = last.replace(/^.*\./, "").toLowerCase();
|
|
76611
|
-
let hasPath = last.length <
|
|
77438
|
+
let hasPath = last.length < path10.length;
|
|
76612
77439
|
let hasDot = ext.length < last.length - 1;
|
|
76613
77440
|
return (hasDot || !hasPath) && this._types[ext] || null;
|
|
76614
77441
|
};
|
|
@@ -78839,7 +79666,7 @@ var require_response2 = __commonJS({
|
|
|
78839
79666
|
var LJSON = require_liquid_json();
|
|
78840
79667
|
var Property = require_property().Property;
|
|
78841
79668
|
var PropertyBase = require_property_base().PropertyBase;
|
|
78842
|
-
var
|
|
79669
|
+
var Request2 = require_request13().Request;
|
|
78843
79670
|
var CookieList = require_cookie_list().CookieList;
|
|
78844
79671
|
var HeaderList = require_header_list().HeaderList;
|
|
78845
79672
|
var contentInfo = require_content_info().contentInfo;
|
|
@@ -78910,7 +79737,7 @@ var require_response2 = __commonJS({
|
|
|
78910
79737
|
/**
|
|
78911
79738
|
* @type {Request}
|
|
78912
79739
|
*/
|
|
78913
|
-
originalRequest: options.originalRequest ? new
|
|
79740
|
+
originalRequest: options.originalRequest ? new Request2(options.originalRequest) : void 0,
|
|
78914
79741
|
/**
|
|
78915
79742
|
* @type {String}
|
|
78916
79743
|
*/
|
|
@@ -79257,7 +80084,7 @@ var require_item = __commonJS({
|
|
|
79257
80084
|
var Property = require_property().Property;
|
|
79258
80085
|
var PropertyList = require_property_list().PropertyList;
|
|
79259
80086
|
var EventList = require_event_list().EventList;
|
|
79260
|
-
var
|
|
80087
|
+
var Request2 = require_request13().Request;
|
|
79261
80088
|
var RequestAuth = require_request_auth().RequestAuth;
|
|
79262
80089
|
var Response2 = require_response2().Response;
|
|
79263
80090
|
var Item;
|
|
@@ -79318,7 +80145,7 @@ var require_item = __commonJS({
|
|
|
79318
80145
|
*
|
|
79319
80146
|
* @type {Request}
|
|
79320
80147
|
*/
|
|
79321
|
-
request: definition && new
|
|
80148
|
+
request: definition && new Request2(definition.request),
|
|
79322
80149
|
/**
|
|
79323
80150
|
* An Item also contains a list of sample responses that is expected when the request defined in the item is
|
|
79324
80151
|
* executed. The sample responses are useful in elaborating API usage and is also useful for other
|
|
@@ -79505,7 +80332,7 @@ var require_item = __commonJS({
|
|
|
79505
80332
|
*/
|
|
79506
80333
|
authorizeRequestUsing: function(type, options) {
|
|
79507
80334
|
if (!this.request) {
|
|
79508
|
-
this.request = new
|
|
80335
|
+
this.request = new Request2();
|
|
79509
80336
|
}
|
|
79510
80337
|
return this.request.authorizeUsing(type, options);
|
|
79511
80338
|
},
|
|
@@ -79515,12 +80342,12 @@ var require_item = __commonJS({
|
|
|
79515
80342
|
* @returns {Array<string>}
|
|
79516
80343
|
*/
|
|
79517
80344
|
getPath: function() {
|
|
79518
|
-
const
|
|
79519
|
-
|
|
80345
|
+
const path10 = [], pushItem = (item) => {
|
|
80346
|
+
path10.push(item.name);
|
|
79520
80347
|
};
|
|
79521
80348
|
pushItem(this);
|
|
79522
80349
|
this.forEachParent({ withRoot: true }, pushItem);
|
|
79523
|
-
return
|
|
80350
|
+
return path10.reverse();
|
|
79524
80351
|
}
|
|
79525
80352
|
}
|
|
79526
80353
|
);
|
|
@@ -79561,7 +80388,7 @@ var require_item_group = __commonJS({
|
|
|
79561
80388
|
var PropertyList = require_property_list().PropertyList;
|
|
79562
80389
|
var EventList = require_event_list().EventList;
|
|
79563
80390
|
var Item = require_item().Item;
|
|
79564
|
-
var
|
|
80391
|
+
var Request2 = require_request13().Request;
|
|
79565
80392
|
var RequestAuth = require_request_auth().RequestAuth;
|
|
79566
80393
|
var ItemGroup;
|
|
79567
80394
|
var OBJECT = "object";
|
|
@@ -79801,7 +80628,7 @@ var require_item_group = __commonJS({
|
|
|
79801
80628
|
* @note This function was previously (in v2 of SDK) used to clone request and populate headers. Now it is used to
|
|
79802
80629
|
* only set auth information to request
|
|
79803
80630
|
*/
|
|
79804
|
-
authorizeRequestsUsing:
|
|
80631
|
+
authorizeRequestsUsing: Request2.prototype.authorizeUsing
|
|
79805
80632
|
}
|
|
79806
80633
|
);
|
|
79807
80634
|
_.assign(
|
|
@@ -85240,8 +86067,8 @@ var require_Trie = __commonJS({
|
|
|
85240
86067
|
throw new Error("Trie.insert: key cannot be null or undefined");
|
|
85241
86068
|
}
|
|
85242
86069
|
let node = this.root;
|
|
85243
|
-
const
|
|
85244
|
-
for (const segment of
|
|
86070
|
+
const path10 = this.getPath(key);
|
|
86071
|
+
for (const segment of path10) {
|
|
85245
86072
|
if (!node.children.has(segment)) {
|
|
85246
86073
|
node.children.set(segment, new TrieNode());
|
|
85247
86074
|
}
|
|
@@ -85258,8 +86085,8 @@ var require_Trie = __commonJS({
|
|
|
85258
86085
|
return [];
|
|
85259
86086
|
}
|
|
85260
86087
|
let node = this.root;
|
|
85261
|
-
const
|
|
85262
|
-
for (const segment of
|
|
86088
|
+
const path10 = this.getPath(prefix);
|
|
86089
|
+
for (const segment of path10) {
|
|
85263
86090
|
const child2 = node.children.get(segment);
|
|
85264
86091
|
if (!child2) {
|
|
85265
86092
|
return [];
|
|
@@ -85275,8 +86102,8 @@ var require_Trie = __commonJS({
|
|
|
85275
86102
|
return [];
|
|
85276
86103
|
}
|
|
85277
86104
|
let node = this.root;
|
|
85278
|
-
const
|
|
85279
|
-
for (const segment of
|
|
86105
|
+
const path10 = this.getPath(prefix);
|
|
86106
|
+
for (const segment of path10) {
|
|
85280
86107
|
const child2 = node.children.get(segment);
|
|
85281
86108
|
if (!child2) {
|
|
85282
86109
|
return [];
|
|
@@ -85284,7 +86111,7 @@ var require_Trie = __commonJS({
|
|
|
85284
86111
|
node = child2;
|
|
85285
86112
|
}
|
|
85286
86113
|
const results = [];
|
|
85287
|
-
this._collectEntries(node,
|
|
86114
|
+
this._collectEntries(node, path10, results);
|
|
85288
86115
|
return results;
|
|
85289
86116
|
}
|
|
85290
86117
|
get(key) {
|
|
@@ -85292,8 +86119,8 @@ var require_Trie = __commonJS({
|
|
|
85292
86119
|
return void 0;
|
|
85293
86120
|
}
|
|
85294
86121
|
let node = this.root;
|
|
85295
|
-
const
|
|
85296
|
-
for (const segment of
|
|
86122
|
+
const path10 = this.getPath(key);
|
|
86123
|
+
for (const segment of path10) {
|
|
85297
86124
|
const child2 = node.children.get(segment);
|
|
85298
86125
|
if (!child2) {
|
|
85299
86126
|
return void 0;
|
|
@@ -85307,8 +86134,8 @@ var require_Trie = __commonJS({
|
|
|
85307
86134
|
return false;
|
|
85308
86135
|
}
|
|
85309
86136
|
let node = this.root;
|
|
85310
|
-
const
|
|
85311
|
-
for (const segment of
|
|
86137
|
+
const path10 = this.getPath(key);
|
|
86138
|
+
for (const segment of path10) {
|
|
85312
86139
|
const child2 = node.children.get(segment);
|
|
85313
86140
|
if (!child2) {
|
|
85314
86141
|
return false;
|
|
@@ -88617,17 +89444,17 @@ var require_visit = __commonJS({
|
|
|
88617
89444
|
visit2.BREAK = BREAK;
|
|
88618
89445
|
visit2.SKIP = SKIP;
|
|
88619
89446
|
visit2.REMOVE = REMOVE;
|
|
88620
|
-
function visit_(key, node, visitor,
|
|
88621
|
-
const ctrl = callVisitor(key, node, visitor,
|
|
89447
|
+
function visit_(key, node, visitor, path10) {
|
|
89448
|
+
const ctrl = callVisitor(key, node, visitor, path10);
|
|
88622
89449
|
if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
|
|
88623
|
-
replaceNode(key,
|
|
88624
|
-
return visit_(key, ctrl, visitor,
|
|
89450
|
+
replaceNode(key, path10, ctrl);
|
|
89451
|
+
return visit_(key, ctrl, visitor, path10);
|
|
88625
89452
|
}
|
|
88626
89453
|
if (typeof ctrl !== "symbol") {
|
|
88627
89454
|
if (identity.isCollection(node)) {
|
|
88628
|
-
|
|
89455
|
+
path10 = Object.freeze(path10.concat(node));
|
|
88629
89456
|
for (let i = 0; i < node.items.length; ++i) {
|
|
88630
|
-
const ci = visit_(i, node.items[i], visitor,
|
|
89457
|
+
const ci = visit_(i, node.items[i], visitor, path10);
|
|
88631
89458
|
if (typeof ci === "number")
|
|
88632
89459
|
i = ci - 1;
|
|
88633
89460
|
else if (ci === BREAK)
|
|
@@ -88638,13 +89465,13 @@ var require_visit = __commonJS({
|
|
|
88638
89465
|
}
|
|
88639
89466
|
}
|
|
88640
89467
|
} else if (identity.isPair(node)) {
|
|
88641
|
-
|
|
88642
|
-
const ck = visit_("key", node.key, visitor,
|
|
89468
|
+
path10 = Object.freeze(path10.concat(node));
|
|
89469
|
+
const ck = visit_("key", node.key, visitor, path10);
|
|
88643
89470
|
if (ck === BREAK)
|
|
88644
89471
|
return BREAK;
|
|
88645
89472
|
else if (ck === REMOVE)
|
|
88646
89473
|
node.key = null;
|
|
88647
|
-
const cv = visit_("value", node.value, visitor,
|
|
89474
|
+
const cv = visit_("value", node.value, visitor, path10);
|
|
88648
89475
|
if (cv === BREAK)
|
|
88649
89476
|
return BREAK;
|
|
88650
89477
|
else if (cv === REMOVE)
|
|
@@ -88665,17 +89492,17 @@ var require_visit = __commonJS({
|
|
|
88665
89492
|
visitAsync.BREAK = BREAK;
|
|
88666
89493
|
visitAsync.SKIP = SKIP;
|
|
88667
89494
|
visitAsync.REMOVE = REMOVE;
|
|
88668
|
-
async function visitAsync_(key, node, visitor,
|
|
88669
|
-
const ctrl = await callVisitor(key, node, visitor,
|
|
89495
|
+
async function visitAsync_(key, node, visitor, path10) {
|
|
89496
|
+
const ctrl = await callVisitor(key, node, visitor, path10);
|
|
88670
89497
|
if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
|
|
88671
|
-
replaceNode(key,
|
|
88672
|
-
return visitAsync_(key, ctrl, visitor,
|
|
89498
|
+
replaceNode(key, path10, ctrl);
|
|
89499
|
+
return visitAsync_(key, ctrl, visitor, path10);
|
|
88673
89500
|
}
|
|
88674
89501
|
if (typeof ctrl !== "symbol") {
|
|
88675
89502
|
if (identity.isCollection(node)) {
|
|
88676
|
-
|
|
89503
|
+
path10 = Object.freeze(path10.concat(node));
|
|
88677
89504
|
for (let i = 0; i < node.items.length; ++i) {
|
|
88678
|
-
const ci = await visitAsync_(i, node.items[i], visitor,
|
|
89505
|
+
const ci = await visitAsync_(i, node.items[i], visitor, path10);
|
|
88679
89506
|
if (typeof ci === "number")
|
|
88680
89507
|
i = ci - 1;
|
|
88681
89508
|
else if (ci === BREAK)
|
|
@@ -88686,13 +89513,13 @@ var require_visit = __commonJS({
|
|
|
88686
89513
|
}
|
|
88687
89514
|
}
|
|
88688
89515
|
} else if (identity.isPair(node)) {
|
|
88689
|
-
|
|
88690
|
-
const ck = await visitAsync_("key", node.key, visitor,
|
|
89516
|
+
path10 = Object.freeze(path10.concat(node));
|
|
89517
|
+
const ck = await visitAsync_("key", node.key, visitor, path10);
|
|
88691
89518
|
if (ck === BREAK)
|
|
88692
89519
|
return BREAK;
|
|
88693
89520
|
else if (ck === REMOVE)
|
|
88694
89521
|
node.key = null;
|
|
88695
|
-
const cv = await visitAsync_("value", node.value, visitor,
|
|
89522
|
+
const cv = await visitAsync_("value", node.value, visitor, path10);
|
|
88696
89523
|
if (cv === BREAK)
|
|
88697
89524
|
return BREAK;
|
|
88698
89525
|
else if (cv === REMOVE)
|
|
@@ -88719,23 +89546,23 @@ var require_visit = __commonJS({
|
|
|
88719
89546
|
}
|
|
88720
89547
|
return visitor;
|
|
88721
89548
|
}
|
|
88722
|
-
function callVisitor(key, node, visitor,
|
|
89549
|
+
function callVisitor(key, node, visitor, path10) {
|
|
88723
89550
|
if (typeof visitor === "function")
|
|
88724
|
-
return visitor(key, node,
|
|
89551
|
+
return visitor(key, node, path10);
|
|
88725
89552
|
if (identity.isMap(node))
|
|
88726
|
-
return visitor.Map?.(key, node,
|
|
89553
|
+
return visitor.Map?.(key, node, path10);
|
|
88727
89554
|
if (identity.isSeq(node))
|
|
88728
|
-
return visitor.Seq?.(key, node,
|
|
89555
|
+
return visitor.Seq?.(key, node, path10);
|
|
88729
89556
|
if (identity.isPair(node))
|
|
88730
|
-
return visitor.Pair?.(key, node,
|
|
89557
|
+
return visitor.Pair?.(key, node, path10);
|
|
88731
89558
|
if (identity.isScalar(node))
|
|
88732
|
-
return visitor.Scalar?.(key, node,
|
|
89559
|
+
return visitor.Scalar?.(key, node, path10);
|
|
88733
89560
|
if (identity.isAlias(node))
|
|
88734
|
-
return visitor.Alias?.(key, node,
|
|
89561
|
+
return visitor.Alias?.(key, node, path10);
|
|
88735
89562
|
return void 0;
|
|
88736
89563
|
}
|
|
88737
|
-
function replaceNode(key,
|
|
88738
|
-
const parent =
|
|
89564
|
+
function replaceNode(key, path10, node) {
|
|
89565
|
+
const parent = path10[path10.length - 1];
|
|
88739
89566
|
if (identity.isCollection(parent)) {
|
|
88740
89567
|
parent.items[key] = node;
|
|
88741
89568
|
} else if (identity.isPair(parent)) {
|
|
@@ -89345,10 +90172,10 @@ var require_Collection = __commonJS({
|
|
|
89345
90172
|
var createNode = require_createNode();
|
|
89346
90173
|
var identity = require_identity();
|
|
89347
90174
|
var Node = require_Node();
|
|
89348
|
-
function collectionFromPath(schema,
|
|
90175
|
+
function collectionFromPath(schema, path10, value) {
|
|
89349
90176
|
let v = value;
|
|
89350
|
-
for (let i =
|
|
89351
|
-
const k =
|
|
90177
|
+
for (let i = path10.length - 1; i >= 0; --i) {
|
|
90178
|
+
const k = path10[i];
|
|
89352
90179
|
if (typeof k === "number" && Number.isInteger(k) && k >= 0) {
|
|
89353
90180
|
const a = [];
|
|
89354
90181
|
a[k] = v;
|
|
@@ -89367,7 +90194,7 @@ var require_Collection = __commonJS({
|
|
|
89367
90194
|
sourceObjects: /* @__PURE__ */ new Map()
|
|
89368
90195
|
});
|
|
89369
90196
|
}
|
|
89370
|
-
var isEmptyPath = (
|
|
90197
|
+
var isEmptyPath = (path10) => path10 == null || typeof path10 === "object" && !!path10[Symbol.iterator]().next().done;
|
|
89371
90198
|
var Collection2 = class extends Node.NodeBase {
|
|
89372
90199
|
constructor(type, schema) {
|
|
89373
90200
|
super(type);
|
|
@@ -89397,11 +90224,11 @@ var require_Collection = __commonJS({
|
|
|
89397
90224
|
* be a Pair instance or a `{ key, value }` object, which may not have a key
|
|
89398
90225
|
* that already exists in the map.
|
|
89399
90226
|
*/
|
|
89400
|
-
addIn(
|
|
89401
|
-
if (isEmptyPath(
|
|
90227
|
+
addIn(path10, value) {
|
|
90228
|
+
if (isEmptyPath(path10))
|
|
89402
90229
|
this.add(value);
|
|
89403
90230
|
else {
|
|
89404
|
-
const [key, ...rest] =
|
|
90231
|
+
const [key, ...rest] = path10;
|
|
89405
90232
|
const node = this.get(key, true);
|
|
89406
90233
|
if (identity.isCollection(node))
|
|
89407
90234
|
node.addIn(rest, value);
|
|
@@ -89415,8 +90242,8 @@ var require_Collection = __commonJS({
|
|
|
89415
90242
|
* Removes a value from the collection.
|
|
89416
90243
|
* @returns `true` if the item was found and removed.
|
|
89417
90244
|
*/
|
|
89418
|
-
deleteIn(
|
|
89419
|
-
const [key, ...rest] =
|
|
90245
|
+
deleteIn(path10) {
|
|
90246
|
+
const [key, ...rest] = path10;
|
|
89420
90247
|
if (rest.length === 0)
|
|
89421
90248
|
return this.delete(key);
|
|
89422
90249
|
const node = this.get(key, true);
|
|
@@ -89430,8 +90257,8 @@ var require_Collection = __commonJS({
|
|
|
89430
90257
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
89431
90258
|
* `true` (collections are always returned intact).
|
|
89432
90259
|
*/
|
|
89433
|
-
getIn(
|
|
89434
|
-
const [key, ...rest] =
|
|
90260
|
+
getIn(path10, keepScalar) {
|
|
90261
|
+
const [key, ...rest] = path10;
|
|
89435
90262
|
const node = this.get(key, true);
|
|
89436
90263
|
if (rest.length === 0)
|
|
89437
90264
|
return !keepScalar && identity.isScalar(node) ? node.value : node;
|
|
@@ -89449,8 +90276,8 @@ var require_Collection = __commonJS({
|
|
|
89449
90276
|
/**
|
|
89450
90277
|
* Checks if the collection includes a value with the key `key`.
|
|
89451
90278
|
*/
|
|
89452
|
-
hasIn(
|
|
89453
|
-
const [key, ...rest] =
|
|
90279
|
+
hasIn(path10) {
|
|
90280
|
+
const [key, ...rest] = path10;
|
|
89454
90281
|
if (rest.length === 0)
|
|
89455
90282
|
return this.has(key);
|
|
89456
90283
|
const node = this.get(key, true);
|
|
@@ -89460,8 +90287,8 @@ var require_Collection = __commonJS({
|
|
|
89460
90287
|
* Sets a value in this collection. For `!!set`, `value` needs to be a
|
|
89461
90288
|
* boolean to add/remove the item from the set.
|
|
89462
90289
|
*/
|
|
89463
|
-
setIn(
|
|
89464
|
-
const [key, ...rest] =
|
|
90290
|
+
setIn(path10, value) {
|
|
90291
|
+
const [key, ...rest] = path10;
|
|
89465
90292
|
if (rest.length === 0) {
|
|
89466
90293
|
this.set(key, value);
|
|
89467
90294
|
} else {
|
|
@@ -91976,9 +92803,9 @@ var require_Document = __commonJS({
|
|
|
91976
92803
|
this.contents.add(value);
|
|
91977
92804
|
}
|
|
91978
92805
|
/** Adds a value to the document. */
|
|
91979
|
-
addIn(
|
|
92806
|
+
addIn(path10, value) {
|
|
91980
92807
|
if (assertCollection(this.contents))
|
|
91981
|
-
this.contents.addIn(
|
|
92808
|
+
this.contents.addIn(path10, value);
|
|
91982
92809
|
}
|
|
91983
92810
|
/**
|
|
91984
92811
|
* Create a new `Alias` node, ensuring that the target `node` has the required anchor.
|
|
@@ -92053,14 +92880,14 @@ var require_Document = __commonJS({
|
|
|
92053
92880
|
* Removes a value from the document.
|
|
92054
92881
|
* @returns `true` if the item was found and removed.
|
|
92055
92882
|
*/
|
|
92056
|
-
deleteIn(
|
|
92057
|
-
if (Collection2.isEmptyPath(
|
|
92883
|
+
deleteIn(path10) {
|
|
92884
|
+
if (Collection2.isEmptyPath(path10)) {
|
|
92058
92885
|
if (this.contents == null)
|
|
92059
92886
|
return false;
|
|
92060
92887
|
this.contents = null;
|
|
92061
92888
|
return true;
|
|
92062
92889
|
}
|
|
92063
|
-
return assertCollection(this.contents) ? this.contents.deleteIn(
|
|
92890
|
+
return assertCollection(this.contents) ? this.contents.deleteIn(path10) : false;
|
|
92064
92891
|
}
|
|
92065
92892
|
/**
|
|
92066
92893
|
* Returns item at `key`, or `undefined` if not found. By default unwraps
|
|
@@ -92075,10 +92902,10 @@ var require_Document = __commonJS({
|
|
|
92075
92902
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
92076
92903
|
* `true` (collections are always returned intact).
|
|
92077
92904
|
*/
|
|
92078
|
-
getIn(
|
|
92079
|
-
if (Collection2.isEmptyPath(
|
|
92905
|
+
getIn(path10, keepScalar) {
|
|
92906
|
+
if (Collection2.isEmptyPath(path10))
|
|
92080
92907
|
return !keepScalar && identity.isScalar(this.contents) ? this.contents.value : this.contents;
|
|
92081
|
-
return identity.isCollection(this.contents) ? this.contents.getIn(
|
|
92908
|
+
return identity.isCollection(this.contents) ? this.contents.getIn(path10, keepScalar) : void 0;
|
|
92082
92909
|
}
|
|
92083
92910
|
/**
|
|
92084
92911
|
* Checks if the document includes a value with the key `key`.
|
|
@@ -92089,10 +92916,10 @@ var require_Document = __commonJS({
|
|
|
92089
92916
|
/**
|
|
92090
92917
|
* Checks if the document includes a value at `path`.
|
|
92091
92918
|
*/
|
|
92092
|
-
hasIn(
|
|
92093
|
-
if (Collection2.isEmptyPath(
|
|
92919
|
+
hasIn(path10) {
|
|
92920
|
+
if (Collection2.isEmptyPath(path10))
|
|
92094
92921
|
return this.contents !== void 0;
|
|
92095
|
-
return identity.isCollection(this.contents) ? this.contents.hasIn(
|
|
92922
|
+
return identity.isCollection(this.contents) ? this.contents.hasIn(path10) : false;
|
|
92096
92923
|
}
|
|
92097
92924
|
/**
|
|
92098
92925
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
@@ -92109,13 +92936,13 @@ var require_Document = __commonJS({
|
|
|
92109
92936
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
92110
92937
|
* boolean to add/remove the item from the set.
|
|
92111
92938
|
*/
|
|
92112
|
-
setIn(
|
|
92113
|
-
if (Collection2.isEmptyPath(
|
|
92939
|
+
setIn(path10, value) {
|
|
92940
|
+
if (Collection2.isEmptyPath(path10)) {
|
|
92114
92941
|
this.contents = value;
|
|
92115
92942
|
} else if (this.contents == null) {
|
|
92116
|
-
this.contents = Collection2.collectionFromPath(this.schema, Array.from(
|
|
92943
|
+
this.contents = Collection2.collectionFromPath(this.schema, Array.from(path10), value);
|
|
92117
92944
|
} else if (assertCollection(this.contents)) {
|
|
92118
|
-
this.contents.setIn(
|
|
92945
|
+
this.contents.setIn(path10, value);
|
|
92119
92946
|
}
|
|
92120
92947
|
}
|
|
92121
92948
|
/**
|
|
@@ -94075,9 +94902,9 @@ var require_cst_visit = __commonJS({
|
|
|
94075
94902
|
visit2.BREAK = BREAK;
|
|
94076
94903
|
visit2.SKIP = SKIP;
|
|
94077
94904
|
visit2.REMOVE = REMOVE;
|
|
94078
|
-
visit2.itemAtPath = (cst,
|
|
94905
|
+
visit2.itemAtPath = (cst, path10) => {
|
|
94079
94906
|
let item = cst;
|
|
94080
|
-
for (const [field, index] of
|
|
94907
|
+
for (const [field, index] of path10) {
|
|
94081
94908
|
const tok = item?.[field];
|
|
94082
94909
|
if (tok && "items" in tok) {
|
|
94083
94910
|
item = tok.items[index];
|
|
@@ -94086,23 +94913,23 @@ var require_cst_visit = __commonJS({
|
|
|
94086
94913
|
}
|
|
94087
94914
|
return item;
|
|
94088
94915
|
};
|
|
94089
|
-
visit2.parentCollection = (cst,
|
|
94090
|
-
const parent = visit2.itemAtPath(cst,
|
|
94091
|
-
const field =
|
|
94916
|
+
visit2.parentCollection = (cst, path10) => {
|
|
94917
|
+
const parent = visit2.itemAtPath(cst, path10.slice(0, -1));
|
|
94918
|
+
const field = path10[path10.length - 1][0];
|
|
94092
94919
|
const coll = parent?.[field];
|
|
94093
94920
|
if (coll && "items" in coll)
|
|
94094
94921
|
return coll;
|
|
94095
94922
|
throw new Error("Parent collection not found");
|
|
94096
94923
|
};
|
|
94097
|
-
function _visit(
|
|
94098
|
-
let ctrl = visitor(item,
|
|
94924
|
+
function _visit(path10, item, visitor) {
|
|
94925
|
+
let ctrl = visitor(item, path10);
|
|
94099
94926
|
if (typeof ctrl === "symbol")
|
|
94100
94927
|
return ctrl;
|
|
94101
94928
|
for (const field of ["key", "value"]) {
|
|
94102
94929
|
const token = item[field];
|
|
94103
94930
|
if (token && "items" in token) {
|
|
94104
94931
|
for (let i = 0; i < token.items.length; ++i) {
|
|
94105
|
-
const ci = _visit(Object.freeze(
|
|
94932
|
+
const ci = _visit(Object.freeze(path10.concat([[field, i]])), token.items[i], visitor);
|
|
94106
94933
|
if (typeof ci === "number")
|
|
94107
94934
|
i = ci - 1;
|
|
94108
94935
|
else if (ci === BREAK)
|
|
@@ -94113,10 +94940,10 @@ var require_cst_visit = __commonJS({
|
|
|
94113
94940
|
}
|
|
94114
94941
|
}
|
|
94115
94942
|
if (typeof ctrl === "function" && field === "key")
|
|
94116
|
-
ctrl = ctrl(item,
|
|
94943
|
+
ctrl = ctrl(item, path10);
|
|
94117
94944
|
}
|
|
94118
94945
|
}
|
|
94119
|
-
return typeof ctrl === "function" ? ctrl(item,
|
|
94946
|
+
return typeof ctrl === "function" ? ctrl(item, path10) : ctrl;
|
|
94120
94947
|
}
|
|
94121
94948
|
exports2.visit = visit2;
|
|
94122
94949
|
}
|
|
@@ -98447,7 +99274,7 @@ var require_split_collection = __commonJS({
|
|
|
98447
99274
|
if (items && items.length > 0) {
|
|
98448
99275
|
processItems(trie, rootPath, rootResourcesPath, items, serializeOpts, idMap, collection.id);
|
|
98449
99276
|
}
|
|
98450
|
-
const files = trie.entries().map(([
|
|
99277
|
+
const files = trie.entries().map(([path10, content]) => ({ path: path10, content }));
|
|
98451
99278
|
return idMap ? { files, rootPath, idMap } : { files, rootPath };
|
|
98452
99279
|
}
|
|
98453
99280
|
}
|
|
@@ -101321,8 +102148,8 @@ var require_utils5 = __commonJS({
|
|
|
101321
102148
|
var result = transform2[inputType][outputType](input);
|
|
101322
102149
|
return result;
|
|
101323
102150
|
};
|
|
101324
|
-
exports2.resolve = function(
|
|
101325
|
-
var parts =
|
|
102151
|
+
exports2.resolve = function(path10) {
|
|
102152
|
+
var parts = path10.split("/");
|
|
101326
102153
|
var result = [];
|
|
101327
102154
|
for (var index = 0; index < parts.length; index++) {
|
|
101328
102155
|
var part = parts[index];
|
|
@@ -107175,18 +108002,18 @@ var require_object = __commonJS({
|
|
|
107175
108002
|
var object = new ZipObject(name, zipObjectContent, o);
|
|
107176
108003
|
this.files[name] = object;
|
|
107177
108004
|
};
|
|
107178
|
-
var parentFolder = function(
|
|
107179
|
-
if (
|
|
107180
|
-
|
|
108005
|
+
var parentFolder = function(path10) {
|
|
108006
|
+
if (path10.slice(-1) === "/") {
|
|
108007
|
+
path10 = path10.substring(0, path10.length - 1);
|
|
107181
108008
|
}
|
|
107182
|
-
var lastSlash =
|
|
107183
|
-
return lastSlash > 0 ?
|
|
108009
|
+
var lastSlash = path10.lastIndexOf("/");
|
|
108010
|
+
return lastSlash > 0 ? path10.substring(0, lastSlash) : "";
|
|
107184
108011
|
};
|
|
107185
|
-
var forceTrailingSlash = function(
|
|
107186
|
-
if (
|
|
107187
|
-
|
|
108012
|
+
var forceTrailingSlash = function(path10) {
|
|
108013
|
+
if (path10.slice(-1) !== "/") {
|
|
108014
|
+
path10 += "/";
|
|
107188
108015
|
}
|
|
107189
|
-
return
|
|
108016
|
+
return path10;
|
|
107190
108017
|
};
|
|
107191
108018
|
var folderAdd = function(name, createFolders) {
|
|
107192
108019
|
createFolders = typeof createFolders !== "undefined" ? createFolders : defaults.createFolders;
|
|
@@ -110544,8 +111371,8 @@ function getIDToken(aud) {
|
|
|
110544
111371
|
|
|
110545
111372
|
// src/index.ts
|
|
110546
111373
|
var import_node_crypto4 = require("node:crypto");
|
|
110547
|
-
var
|
|
110548
|
-
var
|
|
111374
|
+
var import_node_fs6 = require("node:fs");
|
|
111375
|
+
var path9 = __toESM(require("node:path"), 1);
|
|
110549
111376
|
|
|
110550
111377
|
// node_modules/js-yaml/dist/js-yaml.mjs
|
|
110551
111378
|
var NOT_RESOLVED = /* @__PURE__ */ Symbol("NOT_RESOLVED");
|
|
@@ -110969,6 +111796,11 @@ var binaryTag = defineScalarTag("tag:yaml.org,2002:binary", {
|
|
|
110969
111796
|
});
|
|
110970
111797
|
var YAML_DATE_REGEXP = /* @__PURE__ */ new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$");
|
|
110971
111798
|
var YAML_TIMESTAMP_REGEXP = /* @__PURE__ */ new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");
|
|
111799
|
+
function makeUtcDate(year, month, day, hour = 0, minute = 0, second = 0, fraction = 0) {
|
|
111800
|
+
const date = new Date(Date.UTC(year, month, day, hour, minute, second, fraction));
|
|
111801
|
+
date.setUTCFullYear(year, month, day);
|
|
111802
|
+
return date;
|
|
111803
|
+
}
|
|
110972
111804
|
function resolveYamlTimestamp(source) {
|
|
110973
111805
|
let match = YAML_DATE_REGEXP.exec(source);
|
|
110974
111806
|
if (match === null) match = YAML_TIMESTAMP_REGEXP.exec(source);
|
|
@@ -110977,7 +111809,7 @@ function resolveYamlTimestamp(source) {
|
|
|
110977
111809
|
const month = +match[2] - 1;
|
|
110978
111810
|
const day = +match[3];
|
|
110979
111811
|
if (!match[4]) {
|
|
110980
|
-
const date2 =
|
|
111812
|
+
const date2 = makeUtcDate(year, month, day);
|
|
110981
111813
|
if (date2.getUTCFullYear() !== year || date2.getUTCMonth() !== month || date2.getUTCDate() !== day) return NOT_RESOLVED;
|
|
110982
111814
|
return date2;
|
|
110983
111815
|
}
|
|
@@ -110991,7 +111823,7 @@ function resolveYamlTimestamp(source) {
|
|
|
110991
111823
|
while (value.length < 3) value += "0";
|
|
110992
111824
|
fraction = +value;
|
|
110993
111825
|
}
|
|
110994
|
-
const date =
|
|
111826
|
+
const date = makeUtcDate(year, month, day, hour, minute, second, fraction);
|
|
110995
111827
|
if (date.getUTCFullYear() !== year || date.getUTCMonth() !== month || date.getUTCDate() !== day) return NOT_RESOLVED;
|
|
110996
111828
|
if (match[9]) {
|
|
110997
111829
|
const offsetHour = +match[10];
|
|
@@ -111089,7 +111921,11 @@ var mapTag = defineMappingTag("tag:yaml.org,2002:map", {
|
|
|
111089
111921
|
return Object.prototype.hasOwnProperty.call(container, String(key));
|
|
111090
111922
|
},
|
|
111091
111923
|
keys: (container) => Object.keys(container),
|
|
111092
|
-
get: (container, key) =>
|
|
111924
|
+
get: (container, key) => {
|
|
111925
|
+
const normalizedKey = String(key);
|
|
111926
|
+
if (!Object.prototype.hasOwnProperty.call(container, normalizedKey)) return null;
|
|
111927
|
+
return container[normalizedKey];
|
|
111928
|
+
}
|
|
111093
111929
|
});
|
|
111094
111930
|
var setTag = defineMappingTag("tag:yaml.org,2002:set", {
|
|
111095
111931
|
create: () => /* @__PURE__ */ new Set(),
|
|
@@ -111110,9 +111946,9 @@ var setTag = defineMappingTag("tag:yaml.org,2002:set", {
|
|
|
111110
111946
|
});
|
|
111111
111947
|
function createTagDefinitionMap() {
|
|
111112
111948
|
return {
|
|
111113
|
-
scalar:
|
|
111114
|
-
sequence:
|
|
111115
|
-
mapping:
|
|
111949
|
+
scalar: /* @__PURE__ */ Object.create(null),
|
|
111950
|
+
sequence: /* @__PURE__ */ Object.create(null),
|
|
111951
|
+
mapping: /* @__PURE__ */ Object.create(null)
|
|
111116
111952
|
};
|
|
111117
111953
|
}
|
|
111118
111954
|
function createTagDefinitionListMap() {
|
|
@@ -111282,7 +112118,11 @@ var legacyMapTag = defineMappingTag("tag:yaml.org,2002:map", {
|
|
|
111282
112118
|
return normalizedKey !== null && Object.prototype.hasOwnProperty.call(container, normalizedKey);
|
|
111283
112119
|
},
|
|
111284
112120
|
keys: (container) => Object.keys(container),
|
|
111285
|
-
get: (container, key) =>
|
|
112121
|
+
get: (container, key) => {
|
|
112122
|
+
const normalizedKey = String(key);
|
|
112123
|
+
if (!Object.prototype.hasOwnProperty.call(container, normalizedKey)) return null;
|
|
112124
|
+
return container[normalizedKey];
|
|
112125
|
+
}
|
|
111286
112126
|
});
|
|
111287
112127
|
var DEFAULT_SNIPPET_OPTIONS = {
|
|
111288
112128
|
maxLength: 79,
|
|
@@ -111618,10 +112458,10 @@ function getScalarValue(input, scalar) {
|
|
|
111618
112458
|
return getPlainValue(input, valueStart, valueEnd);
|
|
111619
112459
|
}
|
|
111620
112460
|
}
|
|
111621
|
-
var DEFAULT_TAG_HANDLERS = {
|
|
112461
|
+
var DEFAULT_TAG_HANDLERS = Object.assign(/* @__PURE__ */ Object.create(null), {
|
|
111622
112462
|
"!": "!",
|
|
111623
112463
|
"!!": "tag:yaml.org,2002:"
|
|
111624
|
-
};
|
|
112464
|
+
});
|
|
111625
112465
|
function tagPercentEncode(source) {
|
|
111626
112466
|
return encodeURI(source).replace(/!/g, "%21");
|
|
111627
112467
|
}
|
|
@@ -111874,6 +112714,10 @@ function constructFromEvents(events2, options) {
|
|
|
111874
112714
|
}
|
|
111875
112715
|
case 6: {
|
|
111876
112716
|
const frame = state.frames.pop();
|
|
112717
|
+
if (frame.kind === "mapping" && frame.hasKey) {
|
|
112718
|
+
state.position = frame.keyPosition;
|
|
112719
|
+
throwError$1(state, "incomplete mapping pair in event stream");
|
|
112720
|
+
}
|
|
111877
112721
|
if (frame.kind === "document") state.documents.push(frame.value);
|
|
111878
112722
|
else {
|
|
111879
112723
|
const value = frame.tag.carrierIsResult ? frame.value : finalizeCollection(state, frame.position, frame.tag, frame.value);
|
|
@@ -112544,10 +113388,6 @@ function parseNode(state, parentIndent, nodeContext, allowToSeek, allowCompact,
|
|
|
112544
113388
|
else if (state.lineIndent === parentIndent) indentStatus = 0;
|
|
112545
113389
|
else indentStatus = -1;
|
|
112546
113390
|
}
|
|
112547
|
-
if (state.position === state.lineStart && testDocumentSeparator(state)) {
|
|
112548
|
-
state.depth--;
|
|
112549
|
-
return false;
|
|
112550
|
-
}
|
|
112551
113391
|
if (indentStatus === 1) while (true) {
|
|
112552
113392
|
const ch = state.input.charCodeAt(state.position);
|
|
112553
113393
|
const propertyState = snapshotState(state);
|
|
@@ -113096,14 +113936,14 @@ function chooseScalarStyle(state, string, layout, singleLineOnly, forceQuote, in
|
|
|
113096
113936
|
if (char === CHAR_LINE_FEED) {
|
|
113097
113937
|
hasLineBreak = true;
|
|
113098
113938
|
if (shouldTrackWidth) {
|
|
113099
|
-
hasFoldableLine = hasFoldableLine || i - previousLineBreak - 1 > lineWidth && string[previousLineBreak + 1]
|
|
113939
|
+
hasFoldableLine = hasFoldableLine || i - previousLineBreak - 1 > lineWidth && !isMoreIndented(string[previousLineBreak + 1]);
|
|
113100
113940
|
previousLineBreak = i;
|
|
113101
113941
|
}
|
|
113102
113942
|
} else if (!isPrintable(char)) return STYLE_DOUBLE;
|
|
113103
113943
|
plain = plain && isPlainSafe(char, prevChar, inblock);
|
|
113104
113944
|
prevChar = char;
|
|
113105
113945
|
}
|
|
113106
|
-
hasFoldableLine = hasFoldableLine || shouldTrackWidth && i - previousLineBreak - 1 > lineWidth && string[previousLineBreak + 1]
|
|
113946
|
+
hasFoldableLine = hasFoldableLine || shouldTrackWidth && i - previousLineBreak - 1 > lineWidth && !isMoreIndented(string[previousLineBreak + 1]);
|
|
113107
113947
|
}
|
|
113108
113948
|
if (!hasLineBreak && !hasFoldableLine) {
|
|
113109
113949
|
if (plain && !forceQuote) return STYLE_PLAIN;
|
|
@@ -113168,27 +114008,30 @@ function encodeFlowBreaks(string, indent) {
|
|
|
113168
114008
|
function dropEndingNewline(string) {
|
|
113169
114009
|
return string[string.length - 1] === "\n" ? string.slice(0, -1) : string;
|
|
113170
114010
|
}
|
|
114011
|
+
function isMoreIndented(char) {
|
|
114012
|
+
return char === " " || char === " ";
|
|
114013
|
+
}
|
|
113171
114014
|
function foldBlockScalar(string, width) {
|
|
113172
114015
|
const lineRe = /(\n+)([^\n]*)/g;
|
|
113173
114016
|
let nextLF = string.indexOf("\n");
|
|
113174
114017
|
if (nextLF === -1) nextLF = string.length;
|
|
113175
114018
|
lineRe.lastIndex = nextLF;
|
|
113176
114019
|
let result = foldLine(string.slice(0, nextLF), width);
|
|
113177
|
-
let prevMoreIndented = string[0] === "\n" || string[0]
|
|
114020
|
+
let prevMoreIndented = string[0] === "\n" || isMoreIndented(string[0]);
|
|
113178
114021
|
let moreIndented;
|
|
113179
114022
|
let match;
|
|
113180
114023
|
while (match = lineRe.exec(string)) {
|
|
113181
114024
|
const prefix = match[1];
|
|
113182
114025
|
const line = match[2];
|
|
113183
|
-
moreIndented = line
|
|
114026
|
+
moreIndented = line !== "" && isMoreIndented(line[0]);
|
|
113184
114027
|
result += prefix + (!prevMoreIndented && !moreIndented && line !== "" ? "\n" : "") + foldLine(line, width);
|
|
113185
114028
|
prevMoreIndented = moreIndented;
|
|
113186
114029
|
}
|
|
113187
114030
|
return result;
|
|
113188
114031
|
}
|
|
113189
114032
|
function foldLine(line, width) {
|
|
113190
|
-
if (line === "" || line[0]
|
|
113191
|
-
const breakRe = / [^ ]/g;
|
|
114033
|
+
if (line === "" || isMoreIndented(line[0])) return line;
|
|
114034
|
+
const breakRe = / [^ \t]/g;
|
|
113192
114035
|
let match;
|
|
113193
114036
|
let start = 0;
|
|
113194
114037
|
let end;
|
|
@@ -114590,12 +115433,23 @@ var RepoMutationService = class {
|
|
|
114590
115433
|
resolvedCurrentRef
|
|
114591
115434
|
};
|
|
114592
115435
|
}
|
|
114593
|
-
await this.execute("git", [
|
|
115436
|
+
const commit = await this.execute("git", [
|
|
114594
115437
|
"commit",
|
|
114595
115438
|
"-m",
|
|
114596
115439
|
"chore: sync Postman artifacts and metadata"
|
|
114597
115440
|
]);
|
|
114598
|
-
|
|
115441
|
+
if (commit.exitCode !== 0) {
|
|
115442
|
+
throw new Error(
|
|
115443
|
+
secretMasker(commit.stderr || commit.stdout || "Failed to commit generated changes")
|
|
115444
|
+
);
|
|
115445
|
+
}
|
|
115446
|
+
const revision = await this.execute("git", ["rev-parse", "HEAD"]);
|
|
115447
|
+
let commitSha = revision.stdout.trim();
|
|
115448
|
+
if (revision.exitCode !== 0 || !commitSha) {
|
|
115449
|
+
throw new Error(
|
|
115450
|
+
secretMasker(revision.stderr || revision.stdout || "Failed to resolve generated commit")
|
|
115451
|
+
);
|
|
115452
|
+
}
|
|
114599
115453
|
if (options.repoWriteMode !== "commit-and-push") {
|
|
114600
115454
|
return {
|
|
114601
115455
|
commitSha,
|
|
@@ -114717,11 +115571,11 @@ function normalizeRepoUrl(url) {
|
|
|
114717
115571
|
const sshMatch = raw.match(/^git@([^:]+):(.+?)(?:\.git)?$/);
|
|
114718
115572
|
if (sshMatch) {
|
|
114719
115573
|
const host = sshMatch[1];
|
|
114720
|
-
const
|
|
115574
|
+
const path10 = sshMatch[2];
|
|
114721
115575
|
if (host === "ssh.dev.azure.com") {
|
|
114722
|
-
return normalizeAzureReposSshPath2(
|
|
115576
|
+
return normalizeAzureReposSshPath2(path10);
|
|
114723
115577
|
}
|
|
114724
|
-
return `https://${host}/${
|
|
115578
|
+
return `https://${host}/${path10}`;
|
|
114725
115579
|
}
|
|
114726
115580
|
try {
|
|
114727
115581
|
const parsed = new URL(raw);
|
|
@@ -114792,7 +115646,7 @@ function detectRepoContext(input, env = process.env) {
|
|
|
114792
115646
|
};
|
|
114793
115647
|
}
|
|
114794
115648
|
|
|
114795
|
-
// node_modules/@postman-
|
|
115649
|
+
// node_modules/@postman-cs/automation-core/dist/ci-context.js
|
|
114796
115650
|
function norm(value) {
|
|
114797
115651
|
const trimmed = (value ?? "").trim();
|
|
114798
115652
|
return trimmed.length > 0 ? trimmed : void 0;
|
|
@@ -114943,7 +115797,7 @@ function detectCiProviderContext(env = process.env) {
|
|
|
114943
115797
|
return { ciProvider: "unknown", runnerKind: "unknown" };
|
|
114944
115798
|
}
|
|
114945
115799
|
|
|
114946
|
-
// node_modules/@postman-
|
|
115800
|
+
// node_modules/@postman-cs/automation-core/dist/repo-context.js
|
|
114947
115801
|
function normalize2(value) {
|
|
114948
115802
|
const trimmed = (value ?? "").trim();
|
|
114949
115803
|
return trimmed.length > 0 ? trimmed : void 0;
|
|
@@ -114956,8 +115810,8 @@ function normalizeRepoUrl2(url) {
|
|
|
114956
115810
|
const sshMatch = raw.match(/^git@([^:]+):(.+?)(?:\.git)?$/);
|
|
114957
115811
|
if (sshMatch) {
|
|
114958
115812
|
const host = sshMatch[1];
|
|
114959
|
-
const
|
|
114960
|
-
return `https://${host}/${
|
|
115813
|
+
const path10 = sshMatch[2];
|
|
115814
|
+
return `https://${host}/${path10}`;
|
|
114961
115815
|
}
|
|
114962
115816
|
return raw.replace(/\.git$/, "");
|
|
114963
115817
|
}
|
|
@@ -115032,7 +115886,7 @@ function detectRepoContext2(input, env = process.env) {
|
|
|
115032
115886
|
};
|
|
115033
115887
|
}
|
|
115034
115888
|
|
|
115035
|
-
// node_modules/@postman-
|
|
115889
|
+
// node_modules/@postman-cs/automation-core/dist/telemetry.js
|
|
115036
115890
|
var import_node_crypto = require("node:crypto");
|
|
115037
115891
|
var import_undici2 = __toESM(require_undici(), 1);
|
|
115038
115892
|
var SCHEMA_VERSION = 3;
|
|
@@ -115172,7 +116026,7 @@ function createTelemetryContext(options) {
|
|
|
115172
116026
|
};
|
|
115173
116027
|
}
|
|
115174
116028
|
|
|
115175
|
-
// node_modules/@postman-
|
|
116029
|
+
// node_modules/@postman-cs/automation-core/dist/logger.js
|
|
115176
116030
|
var LEVEL_ORDER = {
|
|
115177
116031
|
debug: 10,
|
|
115178
116032
|
info: 20,
|
|
@@ -115352,7 +116206,7 @@ function createLogger(options) {
|
|
|
115352
116206
|
return root;
|
|
115353
116207
|
}
|
|
115354
116208
|
|
|
115355
|
-
// node_modules/@postman-
|
|
116209
|
+
// node_modules/@postman-cs/automation-core/dist/secrets-resolver.js
|
|
115356
116210
|
var SECRETS_RESOLVER_PROVIDERS = ["none", "aws", "azure", "gcp"];
|
|
115357
116211
|
var DEFAULT_SECRETS_RESOLVER_PROVIDER = "none";
|
|
115358
116212
|
function parseSecretsResolverProvider(value, fallback = DEFAULT_SECRETS_RESOLVER_PROVIDER) {
|
|
@@ -115395,7 +116249,7 @@ function secretsResolverEnvironmentKeys(provider) {
|
|
|
115395
116249
|
}
|
|
115396
116250
|
}
|
|
115397
116251
|
|
|
115398
|
-
// node_modules/@postman-
|
|
116252
|
+
// node_modules/@postman-cs/automation-core/dist/http/http-error.js
|
|
115399
116253
|
var REDACTED2 = "[REDACTED]";
|
|
115400
116254
|
var SENSITIVE_HEADER_NAMES = /* @__PURE__ */ new Set([
|
|
115401
116255
|
"authorization",
|
|
@@ -115554,7 +116408,7 @@ var HttpError = class _HttpError extends Error {
|
|
|
115554
116408
|
}
|
|
115555
116409
|
};
|
|
115556
116410
|
|
|
115557
|
-
// node_modules/@postman-
|
|
116411
|
+
// node_modules/@postman-cs/automation-core/dist/http/retry.js
|
|
115558
116412
|
function sleep(delayMs) {
|
|
115559
116413
|
return new Promise((resolve3) => {
|
|
115560
116414
|
setTimeout(resolve3, delayMs);
|
|
@@ -115618,7 +116472,7 @@ function isRetryableGatewayFailure(status, body = "") {
|
|
|
115618
116472
|
return isTransientHttpStatus(status) || RETRYABLE_GATEWAY_BODY.test(body);
|
|
115619
116473
|
}
|
|
115620
116474
|
|
|
115621
|
-
// node_modules/@postman-
|
|
116475
|
+
// node_modules/@postman-cs/automation-core/dist/http/gateway-client.js
|
|
115622
116476
|
var DEFAULT_POSTMAN_BIFROST_BASE_URL = "https://bifrost-premium-https-v4.gw.postman.com";
|
|
115623
116477
|
function isExpiredAuthError(status, body) {
|
|
115624
116478
|
return status === 401 || body.includes("UNAUTHENTICATED") || body.includes("authenticationError");
|
|
@@ -116705,8 +117559,8 @@ var BifrostInternalIntegrationAdapter = class {
|
|
|
116705
117559
|
* - 403 + error.meta.workspaceId -> linked-invisible
|
|
116706
117560
|
* - 200 + error.meta.workspaceId -> linked-invisible (proxy envelope)
|
|
116707
117561
|
*/
|
|
116708
|
-
async findWorkspaceForRepo(repoUrl,
|
|
116709
|
-
const fsPath =
|
|
117562
|
+
async findWorkspaceForRepo(repoUrl, path10 = "/") {
|
|
117563
|
+
const fsPath = path10 && path10.trim() ? path10.trim() : "/";
|
|
116710
117564
|
const url = `${this.bifrostBaseUrl}/ws/proxy`;
|
|
116711
117565
|
const payload = {
|
|
116712
117566
|
service: "workspaces",
|
|
@@ -116946,10 +117800,14 @@ var postmanRepoSyncActionContract = {
|
|
|
116946
117800
|
committerEmail: "support@postman.com"
|
|
116947
117801
|
},
|
|
116948
117802
|
inputs: {
|
|
116949
|
-
"
|
|
116950
|
-
description: "
|
|
117803
|
+
"working-directory": {
|
|
117804
|
+
description: "Repository-root-relative directory used for all local inputs and generated artifacts.",
|
|
116951
117805
|
required: false,
|
|
116952
|
-
default: "
|
|
117806
|
+
default: ""
|
|
117807
|
+
},
|
|
117808
|
+
"generate-ci-workflow": {
|
|
117809
|
+
description: "Whether to generate the CI workflow file. Defaults to true at the repository root and false when working-directory is set.",
|
|
117810
|
+
required: false
|
|
116953
117811
|
},
|
|
116954
117812
|
"ci-workflow-path": {
|
|
116955
117813
|
description: "Path to write the generated CI workflow file",
|
|
@@ -117295,8 +118153,8 @@ var PostmanAssetsClient = class {
|
|
|
117295
118153
|
this.fetchImpl = options.fetchImpl ?? fetch;
|
|
117296
118154
|
void (options.secretMasker ?? createSecretMasker([this.apiKey]));
|
|
117297
118155
|
}
|
|
117298
|
-
async request(
|
|
117299
|
-
const url =
|
|
118156
|
+
async request(path10, init = {}) {
|
|
118157
|
+
const url = path10.startsWith("http") ? path10 : `${this.baseUrl}${path10}`;
|
|
117300
118158
|
const response = await this.fetchImpl(url, {
|
|
117301
118159
|
...init,
|
|
117302
118160
|
headers: {
|
|
@@ -117841,9 +118699,9 @@ var PostmanGatewayAssetsClient = class {
|
|
|
117841
118699
|
const row = this.asRecord(value);
|
|
117842
118700
|
if (!row || row.type === "FOLDER") continue;
|
|
117843
118701
|
if (row.type !== "FILE" || typeof row.id !== "string" || !row.id.trim() || typeof row.path !== "string" || !row.path.trim() || typeof row.content !== "string" || typeof row.fileType !== "string" || !row.fileType.trim()) return void 0;
|
|
117844
|
-
const
|
|
117845
|
-
if (
|
|
117846
|
-
rows.push({ ...row, path:
|
|
118702
|
+
const path10 = row.path.replace(/\\/g, "/").normalize("NFC");
|
|
118703
|
+
if (path10.startsWith("/") || path10.split("/").some((part) => part === ".." || !part)) throw new Error("CONTRACT_DEFINITION_PATH_INVALID");
|
|
118704
|
+
rows.push({ ...row, path: path10 });
|
|
117847
118705
|
}
|
|
117848
118706
|
const meta = this.asRecord(response?.meta);
|
|
117849
118707
|
const cursorValue = this.asRecord(meta?.cursor)?.next;
|
|
@@ -117856,9 +118714,9 @@ var PostmanGatewayAssetsClient = class {
|
|
|
117856
118714
|
}
|
|
117857
118715
|
const paths = /* @__PURE__ */ new Set();
|
|
117858
118716
|
for (const row of rows) {
|
|
117859
|
-
const
|
|
117860
|
-
if (paths.has(
|
|
117861
|
-
paths.add(
|
|
118717
|
+
const path10 = String(row.path).toLocaleLowerCase();
|
|
118718
|
+
if (paths.has(path10)) throw new Error("CONTRACT_DEFINITION_DUPLICATE_PATH");
|
|
118719
|
+
paths.add(path10);
|
|
117862
118720
|
}
|
|
117863
118721
|
const roots = rows.filter((row) => row.fileType === "ROOT");
|
|
117864
118722
|
if (roots.length !== 1) throw new Error("CONTRACT_DEFINITION_INVENTORY_INVALID");
|
|
@@ -119040,10 +119898,10 @@ function detectProvider(env) {
|
|
|
119040
119898
|
return "unknown";
|
|
119041
119899
|
}
|
|
119042
119900
|
function readGithubEvent(env) {
|
|
119043
|
-
const
|
|
119044
|
-
if (!
|
|
119901
|
+
const path10 = clean(env.GITHUB_EVENT_PATH);
|
|
119902
|
+
if (!path10) return void 0;
|
|
119045
119903
|
try {
|
|
119046
|
-
return JSON.parse((0, import_node_fs4.readFileSync)(
|
|
119904
|
+
return JSON.parse((0, import_node_fs4.readFileSync)(path10, "utf8"));
|
|
119047
119905
|
} catch {
|
|
119048
119906
|
return void 0;
|
|
119049
119907
|
}
|
|
@@ -119363,6 +120221,47 @@ function parseAssetMarker(description) {
|
|
|
119363
120221
|
return void 0;
|
|
119364
120222
|
}
|
|
119365
120223
|
|
|
120224
|
+
// src/lib/working-directory.ts
|
|
120225
|
+
var import_node_fs5 = require("node:fs");
|
|
120226
|
+
var import_node_path3 = __toESM(require("node:path"), 1);
|
|
120227
|
+
function invalidWorkingDirectory(message) {
|
|
120228
|
+
throw new Error(`Invalid working-directory: ${message}`);
|
|
120229
|
+
}
|
|
120230
|
+
function isOutside(root, candidate) {
|
|
120231
|
+
const relative4 = import_node_path3.default.relative(root, candidate);
|
|
120232
|
+
return relative4 === ".." || relative4.startsWith(`..${import_node_path3.default.sep}`) || import_node_path3.default.isAbsolute(relative4);
|
|
120233
|
+
}
|
|
120234
|
+
function activateWorkingDirectory(input, baseRoot) {
|
|
120235
|
+
const originalRoot = import_node_path3.default.resolve(baseRoot);
|
|
120236
|
+
const requested = input?.trim() ?? "";
|
|
120237
|
+
if (!requested) {
|
|
120238
|
+
return { changed: false, originalRoot, effectiveRoot: originalRoot };
|
|
120239
|
+
}
|
|
120240
|
+
if (import_node_path3.default.isAbsolute(requested)) {
|
|
120241
|
+
invalidWorkingDirectory("expected a repository-root-relative directory");
|
|
120242
|
+
}
|
|
120243
|
+
if (requested.split(/[\\/]/u).includes("..")) {
|
|
120244
|
+
invalidWorkingDirectory("path traversal is not allowed");
|
|
120245
|
+
}
|
|
120246
|
+
let originalRealPath;
|
|
120247
|
+
let effectiveRoot;
|
|
120248
|
+
try {
|
|
120249
|
+
originalRealPath = (0, import_node_fs5.realpathSync)(originalRoot);
|
|
120250
|
+
effectiveRoot = (0, import_node_fs5.realpathSync)(import_node_path3.default.resolve(originalRealPath, requested));
|
|
120251
|
+
} catch {
|
|
120252
|
+
invalidWorkingDirectory(`directory does not exist: ${requested}`);
|
|
120253
|
+
}
|
|
120254
|
+
if (isOutside(originalRealPath, effectiveRoot)) {
|
|
120255
|
+
invalidWorkingDirectory("resolved path must stay inside the repository root");
|
|
120256
|
+
}
|
|
120257
|
+
if (!(0, import_node_fs5.statSync)(effectiveRoot).isDirectory()) {
|
|
120258
|
+
invalidWorkingDirectory(`path is not a directory: ${requested}`);
|
|
120259
|
+
}
|
|
120260
|
+
process.chdir(effectiveRoot);
|
|
120261
|
+
process.env.GITHUB_WORKSPACE = effectiveRoot;
|
|
120262
|
+
return { changed: true, originalRoot: originalRealPath, effectiveRoot };
|
|
120263
|
+
}
|
|
120264
|
+
|
|
119366
120265
|
// src/index.ts
|
|
119367
120266
|
var identitySecretMasker = (input) => input;
|
|
119368
120267
|
function resolveRepoSyncMasker(dependencies) {
|
|
@@ -119610,7 +120509,22 @@ function resolveInputs(env = process.env) {
|
|
|
119610
120509
|
const postmanRegion = parsePostmanRegion(getInput2("postman-region", env));
|
|
119611
120510
|
const postmanStack = parsePostmanStack(getInput2("postman-stack", env));
|
|
119612
120511
|
const endpointProfile = resolvePostmanEndpointProfile(postmanStack, postmanRegion, env);
|
|
120512
|
+
const workingDirectory = getInput2("working-directory", env);
|
|
120513
|
+
const generateCiWorkflowInput = getInput2("generate-ci-workflow", env);
|
|
120514
|
+
let generateCiWorkflow = parseBooleanInput(generateCiWorkflowInput, true);
|
|
120515
|
+
let generateCiWorkflowDefaulted = false;
|
|
120516
|
+
if (workingDirectory) {
|
|
120517
|
+
if (!generateCiWorkflowInput) {
|
|
120518
|
+
generateCiWorkflow = false;
|
|
120519
|
+
generateCiWorkflowDefaulted = true;
|
|
120520
|
+
} else if (generateCiWorkflow) {
|
|
120521
|
+
throw new Error(
|
|
120522
|
+
"generate-ci-workflow=true is not supported with working-directory because GitHub ignores nested workflow files. Set generate-ci-workflow=false and use the monorepo dispatcher guide."
|
|
120523
|
+
);
|
|
120524
|
+
}
|
|
120525
|
+
}
|
|
119613
120526
|
return {
|
|
120527
|
+
workingDirectory,
|
|
119614
120528
|
projectName: getInput2("project-name", env),
|
|
119615
120529
|
workspaceId: getInput2("workspace-id", env),
|
|
119616
120530
|
baselineCollectionId: getInput2("baseline-collection-id", env),
|
|
@@ -119652,7 +120566,8 @@ function resolveInputs(env = process.env) {
|
|
|
119652
120566
|
ghFallbackToken: getInput2("gh-fallback-token", env),
|
|
119653
120567
|
provider: repoContext.provider,
|
|
119654
120568
|
ciWorkflowBase64: getInput2("ci-workflow-base64", env),
|
|
119655
|
-
generateCiWorkflow
|
|
120569
|
+
generateCiWorkflow,
|
|
120570
|
+
generateCiWorkflowDefaulted,
|
|
119656
120571
|
ciRunnerOs: parseCiRunnerOs(getInput2("ci-runner-os", env)),
|
|
119657
120572
|
monitorType: getInput2("monitor-type", env) || "cloud",
|
|
119658
120573
|
ciWorkflowPath: getInput2("ci-workflow-path", env) || (repoContext.provider === "azure-devops" ? "azure-pipelines.yml" : ".github/workflows/ci.yml"),
|
|
@@ -119755,7 +120670,7 @@ var StateUnreadableError = class extends Error {
|
|
|
119755
120670
|
function readResourcesState() {
|
|
119756
120671
|
let raw;
|
|
119757
120672
|
try {
|
|
119758
|
-
raw = (0,
|
|
120673
|
+
raw = (0, import_node_fs6.readFileSync)(".postman/resources.yaml", "utf8");
|
|
119759
120674
|
} catch {
|
|
119760
120675
|
return null;
|
|
119761
120676
|
}
|
|
@@ -119812,7 +120727,7 @@ function getEnvironmentUidsFromResources(resourcesState) {
|
|
|
119812
120727
|
);
|
|
119813
120728
|
}
|
|
119814
120729
|
function normalizeToPosix(filePath) {
|
|
119815
|
-
return filePath.split(
|
|
120730
|
+
return filePath.split(path9.sep).join("/").replace(/\\/g, "/");
|
|
119816
120731
|
}
|
|
119817
120732
|
function canonicalizeRelativePath(value) {
|
|
119818
120733
|
return normalizeToPosix(String(value ?? "").trim()).replace(/^\.\/+/, "").replace(/\/{2,}/g, "/").replace(/\/+$/g, "");
|
|
@@ -119860,7 +120775,7 @@ function isSpecCandidateExtension(filePath) {
|
|
|
119860
120775
|
}
|
|
119861
120776
|
function readOpenApiSpecFile(fullPath) {
|
|
119862
120777
|
try {
|
|
119863
|
-
const raw = (0,
|
|
120778
|
+
const raw = (0, import_node_fs6.readFileSync)(fullPath, "utf8");
|
|
119864
120779
|
const parsed = fullPath.endsWith(".json") ? JSON.parse(raw) : load(raw);
|
|
119865
120780
|
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
119866
120781
|
return false;
|
|
@@ -119881,7 +120796,7 @@ function shouldIgnoreSpecDiscoveryEntry(entryName, currentDir, baseDir, ignoredP
|
|
|
119881
120796
|
if (LOCAL_SPEC_DISCOVERY_IGNORED_DIRS.has(entryName)) {
|
|
119882
120797
|
return true;
|
|
119883
120798
|
}
|
|
119884
|
-
const relative4 = normalizeToPosix(
|
|
120799
|
+
const relative4 = normalizeToPosix(path9.relative(baseDir, path9.join(currentDir, entryName)));
|
|
119885
120800
|
return ignoredPrefixes.some(
|
|
119886
120801
|
(prefix) => relative4 === prefix || relative4.startsWith(`${prefix}/`)
|
|
119887
120802
|
);
|
|
@@ -119897,7 +120812,7 @@ function scanLocalSpecReferences(baseDir = ".", options = {}) {
|
|
|
119897
120812
|
const { dir: currentDir, depth: currentDepth } = pendingDirs.shift();
|
|
119898
120813
|
let entries;
|
|
119899
120814
|
try {
|
|
119900
|
-
entries = (0,
|
|
120815
|
+
entries = (0, import_node_fs6.readdirSync)(currentDir, { withFileTypes: true }).sort(
|
|
119901
120816
|
(left, right) => left.name.localeCompare(right.name)
|
|
119902
120817
|
);
|
|
119903
120818
|
} catch {
|
|
@@ -119913,7 +120828,7 @@ function scanLocalSpecReferences(baseDir = ".", options = {}) {
|
|
|
119913
120828
|
if (shouldIgnoreSpecDiscoveryEntry(entry.name, currentDir, baseDir, ignoredPrefixes)) {
|
|
119914
120829
|
continue;
|
|
119915
120830
|
}
|
|
119916
|
-
const fullPath =
|
|
120831
|
+
const fullPath = path9.join(currentDir, entry.name);
|
|
119917
120832
|
if (entry.isDirectory()) {
|
|
119918
120833
|
const nextDepth = currentDepth + 1;
|
|
119919
120834
|
if (nextDepth > LOCAL_SPEC_DISCOVERY_MAX_DEPTH) {
|
|
@@ -119935,12 +120850,12 @@ function scanLocalSpecReferences(baseDir = ".", options = {}) {
|
|
|
119935
120850
|
}
|
|
119936
120851
|
let sizeBytes;
|
|
119937
120852
|
try {
|
|
119938
|
-
sizeBytes = (0,
|
|
120853
|
+
sizeBytes = (0, import_node_fs6.statSync)(fullPath).size;
|
|
119939
120854
|
} catch {
|
|
119940
120855
|
continue;
|
|
119941
120856
|
}
|
|
119942
120857
|
if (sizeBytes > LOCAL_SPEC_DISCOVERY_MAX_CANDIDATE_FILE_BYTES) {
|
|
119943
|
-
const repoRelativePath2 = normalizeToPosix(
|
|
120858
|
+
const repoRelativePath2 = normalizeToPosix(path9.relative(baseDir, fullPath));
|
|
119944
120859
|
failLocalSpecDiscoveryLimit(
|
|
119945
120860
|
`local spec discovery candidate ${repoRelativePath2} exceeds ${LOCAL_SPEC_DISCOVERY_MAX_CANDIDATE_FILE_BYTES} bytes.`
|
|
119946
120861
|
);
|
|
@@ -119948,14 +120863,14 @@ function scanLocalSpecReferences(baseDir = ".", options = {}) {
|
|
|
119948
120863
|
if (!readOpenApiSpecFile(fullPath)) {
|
|
119949
120864
|
continue;
|
|
119950
120865
|
}
|
|
119951
|
-
const repoRelativePath = normalizeToPosix(
|
|
120866
|
+
const repoRelativePath = normalizeToPosix(path9.relative(baseDir, fullPath));
|
|
119952
120867
|
if (found.has(repoRelativePath)) {
|
|
119953
120868
|
continue;
|
|
119954
120869
|
}
|
|
119955
120870
|
found.add(repoRelativePath);
|
|
119956
120871
|
refs.push({
|
|
119957
120872
|
repoRelativePath,
|
|
119958
|
-
configRelativePath: normalizeToPosix(
|
|
120873
|
+
configRelativePath: normalizeToPosix(path9.join("..", repoRelativePath))
|
|
119959
120874
|
});
|
|
119960
120875
|
}
|
|
119961
120876
|
}
|
|
@@ -119966,11 +120881,11 @@ function tryResolveExplicitSpecReference(explicitSpecPath) {
|
|
|
119966
120881
|
if (!normalizedExplicitPath) {
|
|
119967
120882
|
return void 0;
|
|
119968
120883
|
}
|
|
119969
|
-
const explicitFullPath =
|
|
119970
|
-
if ((0,
|
|
120884
|
+
const explicitFullPath = path9.resolve(normalizedExplicitPath);
|
|
120885
|
+
if ((0, import_node_fs6.existsSync)(explicitFullPath) && (0, import_node_fs6.statSync)(explicitFullPath).isFile()) {
|
|
119971
120886
|
return {
|
|
119972
120887
|
repoRelativePath: normalizedExplicitPath,
|
|
119973
|
-
configRelativePath: normalizeToPosix(
|
|
120888
|
+
configRelativePath: normalizeToPosix(path9.join("..", normalizedExplicitPath))
|
|
119974
120889
|
};
|
|
119975
120890
|
}
|
|
119976
120891
|
return void 0;
|
|
@@ -120033,6 +120948,7 @@ function readActionInputs(actionCore) {
|
|
|
120033
120948
|
const sslExtraCaCerts = readInput(actionCore, "ssl-extra-ca-certs");
|
|
120034
120949
|
const inputs = resolveInputs({
|
|
120035
120950
|
...process.env,
|
|
120951
|
+
INPUT_WORKING_DIRECTORY: readInput(actionCore, "working-directory"),
|
|
120036
120952
|
INPUT_PROJECT_NAME: projectName,
|
|
120037
120953
|
INPUT_WORKSPACE_ID: readInput(actionCore, "workspace-id"),
|
|
120038
120954
|
INPUT_BASELINE_COLLECTION_ID: readInput(actionCore, "baseline-collection-id"),
|
|
@@ -120365,8 +121281,8 @@ async function upsertMockEnvironment(inputs, dependencies, assetProjectName, moc
|
|
|
120365
121281
|
return "";
|
|
120366
121282
|
}
|
|
120367
121283
|
}
|
|
120368
|
-
function ensureDir(
|
|
120369
|
-
(0,
|
|
121284
|
+
function ensureDir(path10) {
|
|
121285
|
+
(0, import_node_fs6.mkdirSync)(path10, { recursive: true });
|
|
120370
121286
|
}
|
|
120371
121287
|
function getCollectionDirectoryName(kind, projectName) {
|
|
120372
121288
|
if (kind === "Baseline") {
|
|
@@ -120401,9 +121317,9 @@ function stripVolatileFields(obj) {
|
|
|
120401
121317
|
}
|
|
120402
121318
|
return obj;
|
|
120403
121319
|
}
|
|
120404
|
-
function writeJsonFile(
|
|
121320
|
+
function writeJsonFile(path10, content, normalize4 = false) {
|
|
120405
121321
|
const data = normalize4 ? stripVolatileFields(content) : content;
|
|
120406
|
-
(0,
|
|
121322
|
+
(0, import_node_fs6.writeFileSync)(path10, JSON.stringify(data, null, 2));
|
|
120407
121323
|
}
|
|
120408
121324
|
function sanitizeMockEnvironmentArtifact(content) {
|
|
120409
121325
|
if (Array.isArray(content)) {
|
|
@@ -120656,32 +121572,32 @@ function parsePrebuiltCollectionsJson(raw) {
|
|
|
120656
121572
|
function assertPathWithinArtifactRoot(targetPath, artifactDir, fieldName) {
|
|
120657
121573
|
assertPathWithinCwd(targetPath, fieldName);
|
|
120658
121574
|
assertPathWithinCwd(artifactDir, "artifact-dir");
|
|
120659
|
-
const cwd = (0,
|
|
120660
|
-
const artifactRoot =
|
|
120661
|
-
const resolved =
|
|
120662
|
-
const relativeToArtifact =
|
|
120663
|
-
if (!relativeToArtifact || relativeToArtifact.startsWith("..") ||
|
|
121575
|
+
const cwd = (0, import_node_fs6.realpathSync)(process.cwd());
|
|
121576
|
+
const artifactRoot = path9.resolve(cwd, artifactDir.trim());
|
|
121577
|
+
const resolved = path9.resolve(cwd, targetPath.trim());
|
|
121578
|
+
const relativeToArtifact = path9.relative(artifactRoot, resolved);
|
|
121579
|
+
if (!relativeToArtifact || relativeToArtifact.startsWith("..") || path9.isAbsolute(relativeToArtifact)) {
|
|
120664
121580
|
failPrebuiltCollections(
|
|
120665
121581
|
`${fieldName} must stay under artifact-dir (${artifactDir}); received ${targetPath}`
|
|
120666
121582
|
);
|
|
120667
121583
|
}
|
|
120668
121584
|
let existingPath = resolved;
|
|
120669
|
-
while (!(0,
|
|
120670
|
-
const parent =
|
|
121585
|
+
while (!(0, import_node_fs6.existsSync)(existingPath)) {
|
|
121586
|
+
const parent = path9.dirname(existingPath);
|
|
120671
121587
|
if (parent === existingPath) {
|
|
120672
121588
|
break;
|
|
120673
121589
|
}
|
|
120674
121590
|
existingPath = parent;
|
|
120675
121591
|
}
|
|
120676
|
-
const realExisting = (0,
|
|
120677
|
-
const realArtifactRoot = (0,
|
|
120678
|
-
const realRelative = realArtifactRoot ?
|
|
120679
|
-
if (realArtifactRoot && (realRelative.startsWith("..") ||
|
|
121592
|
+
const realExisting = (0, import_node_fs6.realpathSync)(existingPath);
|
|
121593
|
+
const realArtifactRoot = (0, import_node_fs6.existsSync)(artifactRoot) ? (0, import_node_fs6.realpathSync)(artifactRoot) : void 0;
|
|
121594
|
+
const realRelative = realArtifactRoot ? path9.relative(realArtifactRoot, realExisting) : "";
|
|
121595
|
+
if (realArtifactRoot && (realRelative.startsWith("..") || path9.isAbsolute(realRelative))) {
|
|
120680
121596
|
failPrebuiltCollections(
|
|
120681
121597
|
`${fieldName} resolves outside artifact-dir via symlink; received ${targetPath}`
|
|
120682
121598
|
);
|
|
120683
121599
|
}
|
|
120684
|
-
return normalizeToPosix(
|
|
121600
|
+
return normalizeToPosix(path9.relative(cwd, resolved));
|
|
120685
121601
|
}
|
|
120686
121602
|
function prebuiltDirectoryTraversalIdentity(absolutePath, stats, options = {}) {
|
|
120687
121603
|
const platform2 = options.platform ?? process.platform;
|
|
@@ -120689,7 +121605,7 @@ function prebuiltDirectoryTraversalIdentity(absolutePath, stats, options = {}) {
|
|
|
120689
121605
|
if (platform2 !== "win32" && !inodeIsZero) {
|
|
120690
121606
|
return `${stats.dev}:${stats.ino}`;
|
|
120691
121607
|
}
|
|
120692
|
-
const resolveCanonicalPath = options.resolveCanonicalPath ?? ((candidate) =>
|
|
121608
|
+
const resolveCanonicalPath = options.resolveCanonicalPath ?? ((candidate) => import_node_fs6.realpathSync.native(candidate));
|
|
120693
121609
|
const canonical = resolveCanonicalPath(absolutePath);
|
|
120694
121610
|
return platform2 === "win32" ? canonical.toLowerCase() : canonical;
|
|
120695
121611
|
}
|
|
@@ -120699,13 +121615,13 @@ function listPrebuiltCollectionTreeFiles(collectionPath, artifactDir) {
|
|
|
120699
121615
|
artifactDir,
|
|
120700
121616
|
"prebuilt collection path"
|
|
120701
121617
|
);
|
|
120702
|
-
const absRoot =
|
|
120703
|
-
if (!(0,
|
|
121618
|
+
const absRoot = path9.resolve(process.cwd(), confined);
|
|
121619
|
+
if (!(0, import_node_fs6.existsSync)(absRoot)) {
|
|
120704
121620
|
return [];
|
|
120705
121621
|
}
|
|
120706
121622
|
let rootStat;
|
|
120707
121623
|
try {
|
|
120708
|
-
rootStat = (0,
|
|
121624
|
+
rootStat = (0, import_node_fs6.lstatSync)(absRoot);
|
|
120709
121625
|
} catch {
|
|
120710
121626
|
return [];
|
|
120711
121627
|
}
|
|
@@ -120728,20 +121644,20 @@ function listPrebuiltCollectionTreeFiles(collectionPath, artifactDir) {
|
|
|
120728
121644
|
break;
|
|
120729
121645
|
}
|
|
120730
121646
|
const { absolute: currentAbsolute, depth: currentDepth } = current;
|
|
120731
|
-
const currentStat = (0,
|
|
121647
|
+
const currentStat = (0, import_node_fs6.lstatSync)(currentAbsolute);
|
|
120732
121648
|
if (currentStat.isSymbolicLink() || !currentStat.isDirectory()) {
|
|
120733
121649
|
failPrebuiltCollections(
|
|
120734
|
-
`prebuilt collection tree directory changed or became unsupported at ${normalizeToPosix(
|
|
121650
|
+
`prebuilt collection tree directory changed or became unsupported at ${normalizeToPosix(path9.relative(absRoot, currentAbsolute)) || "."}`
|
|
120735
121651
|
);
|
|
120736
121652
|
}
|
|
120737
121653
|
const currentKey = prebuiltDirectoryTraversalIdentity(currentAbsolute, currentStat);
|
|
120738
121654
|
if (seenDirectories.has(currentKey)) {
|
|
120739
121655
|
failPrebuiltCollections(
|
|
120740
|
-
`prebuilt collection tree directory cycle detected at ${normalizeToPosix(
|
|
121656
|
+
`prebuilt collection tree directory cycle detected at ${normalizeToPosix(path9.relative(absRoot, currentAbsolute)) || "."}`
|
|
120741
121657
|
);
|
|
120742
121658
|
}
|
|
120743
121659
|
seenDirectories.add(currentKey);
|
|
120744
|
-
const entries = (0,
|
|
121660
|
+
const entries = (0, import_node_fs6.readdirSync)(currentAbsolute, { withFileTypes: true }).sort(
|
|
120745
121661
|
(left, right) => left.name.localeCompare(right.name)
|
|
120746
121662
|
);
|
|
120747
121663
|
for (const entry of entries) {
|
|
@@ -120751,10 +121667,10 @@ function listPrebuiltCollectionTreeFiles(collectionPath, artifactDir) {
|
|
|
120751
121667
|
`prebuilt collection tree exceeded the ${PREBUILT_COLLECTION_MAX_TRAVERSAL_ENTRIES} traversal-entry budget`
|
|
120752
121668
|
);
|
|
120753
121669
|
}
|
|
120754
|
-
const abs =
|
|
121670
|
+
const abs = path9.join(currentAbsolute, entry.name);
|
|
120755
121671
|
if (entry.isSymbolicLink()) {
|
|
120756
121672
|
failPrebuiltCollections(
|
|
120757
|
-
`prebuilt collection tree must not contain symlinks; received ${normalizeToPosix(
|
|
121673
|
+
`prebuilt collection tree must not contain symlinks; received ${normalizeToPosix(path9.relative(absRoot, abs))}`
|
|
120758
121674
|
);
|
|
120759
121675
|
}
|
|
120760
121676
|
if (entry.isDirectory()) {
|
|
@@ -120769,18 +121685,18 @@ function listPrebuiltCollectionTreeFiles(collectionPath, artifactDir) {
|
|
|
120769
121685
|
}
|
|
120770
121686
|
if (!entry.isFile()) {
|
|
120771
121687
|
failPrebuiltCollections(
|
|
120772
|
-
`prebuilt collection tree contains unsupported entry type at ${normalizeToPosix(
|
|
121688
|
+
`prebuilt collection tree contains unsupported entry type at ${normalizeToPosix(path9.relative(absRoot, abs))}`
|
|
120773
121689
|
);
|
|
120774
121690
|
}
|
|
120775
|
-
const fileLstat = (0,
|
|
121691
|
+
const fileLstat = (0, import_node_fs6.lstatSync)(abs);
|
|
120776
121692
|
if (fileLstat.isSymbolicLink() || !fileLstat.isFile()) {
|
|
120777
121693
|
failPrebuiltCollections(
|
|
120778
|
-
`prebuilt collection tree file changed or became unsupported at ${normalizeToPosix(
|
|
121694
|
+
`prebuilt collection tree file changed or became unsupported at ${normalizeToPosix(path9.relative(absRoot, abs))}`
|
|
120779
121695
|
);
|
|
120780
121696
|
}
|
|
120781
121697
|
if (fileLstat.size > PREBUILT_COLLECTION_MAX_FILE_BYTES) {
|
|
120782
121698
|
failPrebuiltCollections(
|
|
120783
|
-
`prebuilt collection tree file ${normalizeToPosix(
|
|
121699
|
+
`prebuilt collection tree file ${normalizeToPosix(path9.relative(absRoot, abs))} exceeds the ${PREBUILT_COLLECTION_MAX_FILE_BYTES / (1024 * 1024)} MiB individual-file budget`
|
|
120784
121700
|
);
|
|
120785
121701
|
}
|
|
120786
121702
|
totalBytes += fileLstat.size;
|
|
@@ -120791,7 +121707,7 @@ function listPrebuiltCollectionTreeFiles(collectionPath, artifactDir) {
|
|
|
120791
121707
|
}
|
|
120792
121708
|
files.push({
|
|
120793
121709
|
absolute: abs,
|
|
120794
|
-
relative: normalizeToPosix(
|
|
121710
|
+
relative: normalizeToPosix(path9.relative(absRoot, abs)),
|
|
120795
121711
|
dev: fileLstat.dev,
|
|
120796
121712
|
ino: fileLstat.ino,
|
|
120797
121713
|
size: fileLstat.size
|
|
@@ -120875,8 +121791,8 @@ async function preparePrebuiltCollections(inputs) {
|
|
|
120875
121791
|
inputs.artifactDir,
|
|
120876
121792
|
`prebuilt ${entry.role} collection path`
|
|
120877
121793
|
);
|
|
120878
|
-
const absolute =
|
|
120879
|
-
if (!(0,
|
|
121794
|
+
const absolute = path9.resolve(process.cwd(), confinedPath);
|
|
121795
|
+
if (!(0, import_node_fs6.existsSync)(absolute)) {
|
|
120880
121796
|
prepared.set(entry.role, { entry, confinedPath });
|
|
120881
121797
|
continue;
|
|
120882
121798
|
}
|
|
@@ -120905,8 +121821,8 @@ function tryReusePrebuiltCollection(options) {
|
|
|
120905
121821
|
if (confined !== expectedNormalized) {
|
|
120906
121822
|
return false;
|
|
120907
121823
|
}
|
|
120908
|
-
const expectedName =
|
|
120909
|
-
if (
|
|
121824
|
+
const expectedName = path9.posix.basename(expectedNormalized);
|
|
121825
|
+
if (path9.posix.basename(confined) !== expectedName) {
|
|
120910
121826
|
return false;
|
|
120911
121827
|
}
|
|
120912
121828
|
return prepared.artifactDigest === entry.artifactDigest;
|
|
@@ -121001,26 +121917,26 @@ function assertPathWithinCwd(targetPath, fieldName) {
|
|
|
121001
121917
|
const originalPath = String(targetPath || "");
|
|
121002
121918
|
const rawPath = originalPath.trim();
|
|
121003
121919
|
const segments = rawPath.split(/[\\/]+/).filter(Boolean);
|
|
121004
|
-
if (!rawPath || hasControlCharacter2(originalPath) ||
|
|
121920
|
+
if (!rawPath || hasControlCharacter2(originalPath) || path9.isAbsolute(rawPath) || path9.win32.isAbsolute(rawPath) || segments.includes("..") || rawPath.startsWith(":") || hasControlCharacter2(rawPath)) {
|
|
121005
121921
|
throw new Error(`${fieldName} must stay within the repository root; received ${targetPath}`);
|
|
121006
121922
|
}
|
|
121007
|
-
const base = (0,
|
|
121008
|
-
const resolved =
|
|
121009
|
-
const relative4 =
|
|
121010
|
-
if (relative4.startsWith("..") ||
|
|
121923
|
+
const base = (0, import_node_fs6.realpathSync)(process.cwd());
|
|
121924
|
+
const resolved = path9.resolve(base, rawPath);
|
|
121925
|
+
const relative4 = path9.relative(base, resolved);
|
|
121926
|
+
if (relative4.startsWith("..") || path9.isAbsolute(relative4)) {
|
|
121011
121927
|
throw new Error(`${fieldName} must stay within the repository root; received ${targetPath}`);
|
|
121012
121928
|
}
|
|
121013
121929
|
let existingPath = resolved;
|
|
121014
|
-
while (!(0,
|
|
121015
|
-
const parent =
|
|
121930
|
+
while (!(0, import_node_fs6.existsSync)(existingPath)) {
|
|
121931
|
+
const parent = path9.dirname(existingPath);
|
|
121016
121932
|
if (parent === existingPath) {
|
|
121017
121933
|
break;
|
|
121018
121934
|
}
|
|
121019
121935
|
existingPath = parent;
|
|
121020
121936
|
}
|
|
121021
|
-
const realExistingPath = (0,
|
|
121022
|
-
const realRelative =
|
|
121023
|
-
if (realRelative.startsWith("..") ||
|
|
121937
|
+
const realExistingPath = (0, import_node_fs6.realpathSync)(existingPath);
|
|
121938
|
+
const realRelative = path9.relative(base, realExistingPath);
|
|
121939
|
+
if (realRelative.startsWith("..") || path9.isAbsolute(realRelative)) {
|
|
121024
121940
|
throw new Error(`${fieldName} must stay within the repository root; received ${targetPath}`);
|
|
121025
121941
|
}
|
|
121026
121942
|
}
|
|
@@ -121069,7 +121985,7 @@ async function exportArtifacts(inputs, dependencies, envUids, assetProjectName,
|
|
|
121069
121985
|
}
|
|
121070
121986
|
ensureDir(".postman");
|
|
121071
121987
|
assertPathWithinCwd(".postman/resources.yaml", "resources state target");
|
|
121072
|
-
(0,
|
|
121988
|
+
(0, import_node_fs6.writeFileSync)(".postman/resources.yaml", buildResourcesManifest(
|
|
121073
121989
|
durableWorkspaceId,
|
|
121074
121990
|
{},
|
|
121075
121991
|
{},
|
|
@@ -121136,8 +122052,8 @@ async function exportArtifacts(inputs, dependencies, envUids, assetProjectName,
|
|
|
121136
122052
|
ensureDir(specsDir);
|
|
121137
122053
|
ensureDir(".postman");
|
|
121138
122054
|
const globalsFilePath = `${globalsDir}/workspace.globals.yaml`;
|
|
121139
|
-
if (!(0,
|
|
121140
|
-
(0,
|
|
122055
|
+
if (!(0, import_node_fs6.existsSync)(globalsFilePath)) {
|
|
122056
|
+
(0, import_node_fs6.writeFileSync)(globalsFilePath, "name: Globals\nvalues: []\n");
|
|
121141
122057
|
}
|
|
121142
122058
|
if (inputs.generateCiWorkflow) {
|
|
121143
122059
|
const ciDir = inputs.ciWorkflowPath.split("/").slice(0, -1).join("/");
|
|
@@ -121183,7 +122099,7 @@ async function exportArtifacts(inputs, dependencies, envUids, assetProjectName,
|
|
|
121183
122099
|
);
|
|
121184
122100
|
}
|
|
121185
122101
|
assertPathWithinCwd(".postman/resources.yaml", "resources state target");
|
|
121186
|
-
(0,
|
|
122102
|
+
(0, import_node_fs6.writeFileSync)(".postman/resources.yaml", buildResourcesManifest(
|
|
121187
122103
|
durableWorkspaceId,
|
|
121188
122104
|
manifestCollections,
|
|
121189
122105
|
envUids,
|
|
@@ -121197,12 +122113,12 @@ async function exportArtifacts(inputs, dependencies, envUids, assetProjectName,
|
|
|
121197
122113
|
if (mappedSpec && Object.keys(manifestCollections).length > 0) {
|
|
121198
122114
|
let existingWorkflows;
|
|
121199
122115
|
try {
|
|
121200
|
-
existingWorkflows = (0,
|
|
122116
|
+
existingWorkflows = (0, import_node_fs6.readFileSync)(".postman/workflows.yaml", "utf8");
|
|
121201
122117
|
} catch {
|
|
121202
122118
|
existingWorkflows = void 0;
|
|
121203
122119
|
}
|
|
121204
122120
|
assertPathWithinCwd(".postman/workflows.yaml", "workflows state target");
|
|
121205
|
-
(0,
|
|
122121
|
+
(0, import_node_fs6.writeFileSync)(
|
|
121206
122122
|
".postman/workflows.yaml",
|
|
121207
122123
|
buildSpecCollectionWorkflowManifest(
|
|
121208
122124
|
mappedSpec.configRelativePath,
|
|
@@ -121258,13 +122174,13 @@ async function commitAndPushGeneratedFiles(inputs, dependencies, privateMockAuth
|
|
|
121258
122174
|
const dir = parts.slice(0, -1).join("/");
|
|
121259
122175
|
ensureDir(dir);
|
|
121260
122176
|
}
|
|
121261
|
-
(0,
|
|
122177
|
+
(0, import_node_fs6.writeFileSync)(inputs.ciWorkflowPath, ciWorkflow);
|
|
121262
122178
|
if (inputs.provider === "github" || inputs.provider === "unknown") {
|
|
121263
122179
|
const gcPath = ".github/workflows/postman-preview-gc.yml";
|
|
121264
122180
|
if (inputs.ciWorkflowPath.endsWith(".github/workflows/ci.yml") || inputs.ciWorkflowPath === ".github/workflows/ci.yml") {
|
|
121265
122181
|
assertPathWithinCwd(gcPath, "preview GC workflow path");
|
|
121266
122182
|
ensureDir(".github/workflows");
|
|
121267
|
-
(0,
|
|
122183
|
+
(0, import_node_fs6.writeFileSync)(gcPath, renderGcWorkflowTemplate());
|
|
121268
122184
|
}
|
|
121269
122185
|
}
|
|
121270
122186
|
}
|
|
@@ -121272,16 +122188,16 @@ async function commitAndPushGeneratedFiles(inputs, dependencies, privateMockAuth
|
|
|
121272
122188
|
return { commitSha: "", resolvedCurrentRef: "", pushed: false };
|
|
121273
122189
|
}
|
|
121274
122190
|
const provisionPath = ".github/workflows/provision.yml";
|
|
121275
|
-
const provisionExists = inputs.provider === "github" && (0,
|
|
122191
|
+
const provisionExists = inputs.provider === "github" && (0, import_node_fs6.existsSync)(provisionPath);
|
|
121276
122192
|
const gcWorkflowPath = ".github/workflows/postman-preview-gc.yml";
|
|
121277
|
-
const gcExists = inputs.generateCiWorkflow && (0,
|
|
122193
|
+
const gcExists = inputs.generateCiWorkflow && (0, import_node_fs6.existsSync)(gcWorkflowPath);
|
|
121278
122194
|
const stagePaths = (inputs.onboardingScope === "spec-only" ? [".postman/resources.yaml"] : [
|
|
121279
122195
|
inputs.artifactDir,
|
|
121280
122196
|
".postman",
|
|
121281
122197
|
inputs.generateCiWorkflow ? inputs.ciWorkflowPath : null,
|
|
121282
122198
|
gcExists ? gcWorkflowPath : null,
|
|
121283
122199
|
provisionExists ? provisionPath : null
|
|
121284
|
-
]).filter((entry) => typeof entry === "string" && ((0,
|
|
122200
|
+
]).filter((entry) => typeof entry === "string" && ((0, import_node_fs6.existsSync)(entry) || entry === provisionPath));
|
|
121285
122201
|
if (stagePaths.length === 0) {
|
|
121286
122202
|
dependencies.core.info("No generated repository paths were found; skipping repo mutation.");
|
|
121287
122203
|
return {
|
|
@@ -122226,6 +123142,7 @@ function createRepoSyncDependencies(inputs, resolved, factories, options = {}) {
|
|
|
122226
123142
|
listSpecVersionTags: gatewayAssets.listSpecVersionTags.bind(gatewayAssets)
|
|
122227
123143
|
};
|
|
122228
123144
|
const repoMutation = repository && (inputs.repoWriteMode === "commit-only" || inputs.repoWriteMode === "commit-and-push") ? new RepoMutationService({
|
|
123145
|
+
cwd: process.cwd(),
|
|
122229
123146
|
provider: inputs.provider,
|
|
122230
123147
|
repository,
|
|
122231
123148
|
repoUrl: inputs.repoUrl || void 0,
|
|
@@ -122291,7 +123208,16 @@ function runGatedSkip(inputs, decision, actionCore) {
|
|
|
122291
123208
|
return outputs;
|
|
122292
123209
|
}
|
|
122293
123210
|
async function runAction(actionCore = core_exports, actionExec = exec_exports) {
|
|
123211
|
+
activateWorkingDirectory(
|
|
123212
|
+
actionCore.getInput("working-directory"),
|
|
123213
|
+
process.env.GITHUB_WORKSPACE ?? process.cwd()
|
|
123214
|
+
);
|
|
122294
123215
|
const inputs = readActionInputs(actionCore);
|
|
123216
|
+
if (inputs.generateCiWorkflowDefaulted) {
|
|
123217
|
+
actionCore.info(
|
|
123218
|
+
"working-directory is set; generate-ci-workflow defaulted to false. Use the root monorepo dispatcher workflow."
|
|
123219
|
+
);
|
|
123220
|
+
}
|
|
122295
123221
|
const branchDecision = decideBranchTier(inputs);
|
|
122296
123222
|
if (branchDecision.tier === "gated") {
|
|
122297
123223
|
return runGatedSkip(inputs, branchDecision, actionCore);
|
|
@@ -122442,5 +123368,5 @@ postman-collection/index.js:
|
|
|
122442
123368
|
*)
|
|
122443
123369
|
|
|
122444
123370
|
js-yaml/dist/js-yaml.mjs:
|
|
122445
|
-
(*! js-yaml 5.2.
|
|
123371
|
+
(*! js-yaml 5.2.3 https://github.com/nodeca/js-yaml @license MIT *)
|
|
122446
123372
|
*/
|