@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/action.cjs
CHANGED
|
@@ -330,6 +330,7 @@ var require_symbols = __commonJS({
|
|
|
330
330
|
kCounter: /* @__PURE__ */ Symbol("socket request counter"),
|
|
331
331
|
kMaxResponseSize: /* @__PURE__ */ Symbol("max response size"),
|
|
332
332
|
kHTTP2Session: /* @__PURE__ */ Symbol("http2Session"),
|
|
333
|
+
kHTTP2Options: /* @__PURE__ */ Symbol("http2 options"),
|
|
333
334
|
kHTTP2SessionState: /* @__PURE__ */ Symbol("http2Session state"),
|
|
334
335
|
kRetryHandlerDefaultRetry: /* @__PURE__ */ Symbol("retry agent default retry"),
|
|
335
336
|
kConstruct: /* @__PURE__ */ Symbol("constructable"),
|
|
@@ -1376,14 +1377,14 @@ var require_util = __commonJS({
|
|
|
1376
1377
|
}
|
|
1377
1378
|
const port = url.port != null ? url.port : url.protocol === "https:" ? 443 : 80;
|
|
1378
1379
|
let origin = url.origin != null ? url.origin : `${url.protocol || ""}//${url.hostname || ""}:${port}`;
|
|
1379
|
-
let
|
|
1380
|
+
let path10 = url.path != null ? url.path : `${url.pathname || ""}${url.search || ""}`;
|
|
1380
1381
|
if (origin[origin.length - 1] === "/") {
|
|
1381
1382
|
origin = origin.slice(0, origin.length - 1);
|
|
1382
1383
|
}
|
|
1383
|
-
if (
|
|
1384
|
-
|
|
1384
|
+
if (path10 && path10[0] !== "/") {
|
|
1385
|
+
path10 = `/${path10}`;
|
|
1385
1386
|
}
|
|
1386
|
-
return new URL(`${origin}${
|
|
1387
|
+
return new URL(`${origin}${path10}`);
|
|
1387
1388
|
}
|
|
1388
1389
|
if (!isHttpOrHttpsPrefixed(url.origin || url.protocol)) {
|
|
1389
1390
|
throw new InvalidArgumentError("Invalid URL protocol: the URL must start with `http:` or `https:`.");
|
|
@@ -2254,9 +2255,9 @@ var require_diagnostics = __commonJS({
|
|
|
2254
2255
|
"undici:client:sendHeaders",
|
|
2255
2256
|
(evt) => {
|
|
2256
2257
|
const {
|
|
2257
|
-
request: { method, path:
|
|
2258
|
+
request: { method, path: path10, origin }
|
|
2258
2259
|
} = evt;
|
|
2259
|
-
debugLog("sending request to %s %s%s", method, origin,
|
|
2260
|
+
debugLog("sending request to %s %s%s", method, origin, path10);
|
|
2260
2261
|
}
|
|
2261
2262
|
);
|
|
2262
2263
|
}
|
|
@@ -2274,14 +2275,14 @@ var require_diagnostics = __commonJS({
|
|
|
2274
2275
|
"undici:request:headers",
|
|
2275
2276
|
(evt) => {
|
|
2276
2277
|
const {
|
|
2277
|
-
request: { method, path:
|
|
2278
|
+
request: { method, path: path10, origin },
|
|
2278
2279
|
response: { statusCode }
|
|
2279
2280
|
} = evt;
|
|
2280
2281
|
debugLog(
|
|
2281
2282
|
"received response to %s %s%s - HTTP %d",
|
|
2282
2283
|
method,
|
|
2283
2284
|
origin,
|
|
2284
|
-
|
|
2285
|
+
path10,
|
|
2285
2286
|
statusCode
|
|
2286
2287
|
);
|
|
2287
2288
|
}
|
|
@@ -2290,23 +2291,23 @@ var require_diagnostics = __commonJS({
|
|
|
2290
2291
|
"undici:request:trailers",
|
|
2291
2292
|
(evt) => {
|
|
2292
2293
|
const {
|
|
2293
|
-
request: { method, path:
|
|
2294
|
+
request: { method, path: path10, origin }
|
|
2294
2295
|
} = evt;
|
|
2295
|
-
debugLog("trailers received from %s %s%s", method, origin,
|
|
2296
|
+
debugLog("trailers received from %s %s%s", method, origin, path10);
|
|
2296
2297
|
}
|
|
2297
2298
|
);
|
|
2298
2299
|
diagnosticsChannel.subscribe(
|
|
2299
2300
|
"undici:request:error",
|
|
2300
2301
|
(evt) => {
|
|
2301
2302
|
const {
|
|
2302
|
-
request: { method, path:
|
|
2303
|
+
request: { method, path: path10, origin },
|
|
2303
2304
|
error: error2
|
|
2304
2305
|
} = evt;
|
|
2305
2306
|
debugLog(
|
|
2306
2307
|
"request to %s %s%s errored - %s",
|
|
2307
2308
|
method,
|
|
2308
2309
|
origin,
|
|
2309
|
-
|
|
2310
|
+
path10,
|
|
2310
2311
|
error2.message
|
|
2311
2312
|
);
|
|
2312
2313
|
}
|
|
@@ -2459,9 +2460,9 @@ var require_request = __commonJS({
|
|
|
2459
2460
|
return this.#paused;
|
|
2460
2461
|
}
|
|
2461
2462
|
};
|
|
2462
|
-
var
|
|
2463
|
+
var Request2 = class {
|
|
2463
2464
|
constructor(origin, {
|
|
2464
|
-
path:
|
|
2465
|
+
path: path10,
|
|
2465
2466
|
method,
|
|
2466
2467
|
body,
|
|
2467
2468
|
headers,
|
|
@@ -2478,11 +2479,11 @@ var require_request = __commonJS({
|
|
|
2478
2479
|
maxRedirections,
|
|
2479
2480
|
typeOfService
|
|
2480
2481
|
}, handler) {
|
|
2481
|
-
if (typeof
|
|
2482
|
+
if (typeof path10 !== "string") {
|
|
2482
2483
|
throw new InvalidArgumentError("path must be a string");
|
|
2483
|
-
} else if (
|
|
2484
|
+
} else if (path10[0] !== "/" && !(path10.startsWith("http://") || path10.startsWith("https://")) && method !== "CONNECT") {
|
|
2484
2485
|
throw new InvalidArgumentError("path must be an absolute URL or start with a slash");
|
|
2485
|
-
} else if (invalidPathRegex.test(
|
|
2486
|
+
} else if (invalidPathRegex.test(path10)) {
|
|
2486
2487
|
throw new InvalidArgumentError("invalid request path");
|
|
2487
2488
|
}
|
|
2488
2489
|
if (typeof method !== "string") {
|
|
@@ -2557,7 +2558,7 @@ var require_request = __commonJS({
|
|
|
2557
2558
|
this.completed = false;
|
|
2558
2559
|
this.aborted = false;
|
|
2559
2560
|
this.upgrade = upgrade || null;
|
|
2560
|
-
this.path = query ? serializePathWithQuery(
|
|
2561
|
+
this.path = query ? serializePathWithQuery(path10, query) : path10;
|
|
2561
2562
|
this.origin = origin;
|
|
2562
2563
|
this.protocol = getProtocolFromUrlString(origin);
|
|
2563
2564
|
this.idempotent = idempotent == null ? method === "HEAD" || method === "GET" || method === "QUERY" : idempotent;
|
|
@@ -2754,7 +2755,11 @@ var require_request = __commonJS({
|
|
|
2754
2755
|
} else if (typeof val[i] === "object") {
|
|
2755
2756
|
throw new InvalidArgumentError(`invalid ${key} header`);
|
|
2756
2757
|
} else {
|
|
2757
|
-
|
|
2758
|
+
const str = `${val[i]}`;
|
|
2759
|
+
if (!isValidHeaderValue(str)) {
|
|
2760
|
+
throw new InvalidArgumentError(`invalid ${key} header`);
|
|
2761
|
+
}
|
|
2762
|
+
arr.push(str);
|
|
2758
2763
|
}
|
|
2759
2764
|
}
|
|
2760
2765
|
val = arr;
|
|
@@ -2766,6 +2771,9 @@ var require_request = __commonJS({
|
|
|
2766
2771
|
val = "";
|
|
2767
2772
|
} else {
|
|
2768
2773
|
val = `${val}`;
|
|
2774
|
+
if (!isValidHeaderValue(val)) {
|
|
2775
|
+
throw new InvalidArgumentError(`invalid ${key} header`);
|
|
2776
|
+
}
|
|
2769
2777
|
}
|
|
2770
2778
|
if (headerName === "host") {
|
|
2771
2779
|
if (request.host !== null) {
|
|
@@ -2808,7 +2816,7 @@ var require_request = __commonJS({
|
|
|
2808
2816
|
request.headers.push(key, val);
|
|
2809
2817
|
}
|
|
2810
2818
|
}
|
|
2811
|
-
module2.exports =
|
|
2819
|
+
module2.exports = Request2;
|
|
2812
2820
|
}
|
|
2813
2821
|
});
|
|
2814
2822
|
|
|
@@ -3091,14 +3099,26 @@ var require_connect = __commonJS({
|
|
|
3091
3099
|
} else {
|
|
3092
3100
|
assert(!httpSocket, "httpSocket can only be sent on TLS update");
|
|
3093
3101
|
port = port || 80;
|
|
3094
|
-
|
|
3102
|
+
const connectOptions = {
|
|
3095
3103
|
highWaterMark: 64 * 1024,
|
|
3096
3104
|
// Same as nodejs fs streams.
|
|
3097
3105
|
...options,
|
|
3098
3106
|
localAddress,
|
|
3099
3107
|
port,
|
|
3100
3108
|
host: hostname
|
|
3101
|
-
}
|
|
3109
|
+
};
|
|
3110
|
+
const family = net.isIP(hostname);
|
|
3111
|
+
if (family !== 0 && servername && servername !== hostname) {
|
|
3112
|
+
connectOptions.host = servername;
|
|
3113
|
+
connectOptions.lookup = (_hostname, lookupOptions, cb) => {
|
|
3114
|
+
if (lookupOptions.all) {
|
|
3115
|
+
cb(null, [{ address: hostname, family }]);
|
|
3116
|
+
} else {
|
|
3117
|
+
cb(null, hostname, family);
|
|
3118
|
+
}
|
|
3119
|
+
};
|
|
3120
|
+
}
|
|
3121
|
+
socket = net.connect(connectOptions);
|
|
3102
3122
|
if (useH2c === true) {
|
|
3103
3123
|
socket.alpnProtocol = "h2";
|
|
3104
3124
|
}
|
|
@@ -6751,6 +6771,7 @@ var require_client_h1 = __commonJS({
|
|
|
6751
6771
|
RequestContentLengthMismatchError,
|
|
6752
6772
|
ResponseContentLengthMismatchError,
|
|
6753
6773
|
RequestAbortedError,
|
|
6774
|
+
InvalidArgumentError,
|
|
6754
6775
|
HeadersTimeoutError,
|
|
6755
6776
|
HeadersOverflowError,
|
|
6756
6777
|
SocketError,
|
|
@@ -7537,20 +7558,20 @@ var require_client_h1 = __commonJS({
|
|
|
7537
7558
|
}
|
|
7538
7559
|
function clearIdleSocketValidation(socket) {
|
|
7539
7560
|
if (socket[kIdleSocketValidationTimeout]) {
|
|
7540
|
-
|
|
7561
|
+
clearTimeout(socket[kIdleSocketValidationTimeout]);
|
|
7541
7562
|
socket[kIdleSocketValidationTimeout] = null;
|
|
7542
7563
|
}
|
|
7543
7564
|
socket[kIdleSocketValidation] = 0;
|
|
7544
7565
|
}
|
|
7545
7566
|
function scheduleIdleSocketValidation(client, socket) {
|
|
7546
7567
|
socket[kIdleSocketValidation] = 1;
|
|
7547
|
-
socket[kIdleSocketValidationTimeout] =
|
|
7568
|
+
socket[kIdleSocketValidationTimeout] = setTimeout(() => {
|
|
7548
7569
|
socket[kIdleSocketValidationTimeout] = null;
|
|
7549
7570
|
socket[kIdleSocketValidation] = 2;
|
|
7550
7571
|
if (client[kSocket] === socket && !socket.destroyed) {
|
|
7551
7572
|
client[kResume]();
|
|
7552
7573
|
}
|
|
7553
|
-
});
|
|
7574
|
+
}, 0);
|
|
7554
7575
|
socket[kIdleSocketValidationTimeout].unref?.();
|
|
7555
7576
|
}
|
|
7556
7577
|
function resumeH1(client) {
|
|
@@ -7623,7 +7644,7 @@ var require_client_h1 = __commonJS({
|
|
|
7623
7644
|
}
|
|
7624
7645
|
}
|
|
7625
7646
|
function writeH1(client, request) {
|
|
7626
|
-
const { method, path:
|
|
7647
|
+
const { method, path: path10, host, upgrade, blocking, reset } = request;
|
|
7627
7648
|
let { body, headers, contentLength } = request;
|
|
7628
7649
|
const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH" || method === "QUERY" || method === "PROPFIND" || method === "PROPPATCH";
|
|
7629
7650
|
if (util.isFormDataLike(body)) {
|
|
@@ -7636,8 +7657,16 @@ var require_client_h1 = __commonJS({
|
|
|
7636
7657
|
}
|
|
7637
7658
|
body = bodyStream.stream;
|
|
7638
7659
|
contentLength = bodyStream.length;
|
|
7639
|
-
} else if (util.isBlobLike(body) && request.contentType == null
|
|
7640
|
-
|
|
7660
|
+
} else if (util.isBlobLike(body) && request.contentType == null) {
|
|
7661
|
+
const contentType = body.type;
|
|
7662
|
+
if (contentType) {
|
|
7663
|
+
const contentTypeValue = `${contentType}`;
|
|
7664
|
+
if (!util.isValidHeaderValue(contentTypeValue)) {
|
|
7665
|
+
util.errorRequest(client, request, new InvalidArgumentError("invalid content-type header"));
|
|
7666
|
+
return false;
|
|
7667
|
+
}
|
|
7668
|
+
headers.push("content-type", contentTypeValue);
|
|
7669
|
+
}
|
|
7641
7670
|
}
|
|
7642
7671
|
if (body && typeof body.read === "function") {
|
|
7643
7672
|
body.read(0);
|
|
@@ -7691,7 +7720,7 @@ var require_client_h1 = __commonJS({
|
|
|
7691
7720
|
socket[kBlocking] = true;
|
|
7692
7721
|
}
|
|
7693
7722
|
setTypeOfService(socket, request);
|
|
7694
|
-
let header = `${method} ${
|
|
7723
|
+
let header = `${method} ${path10} HTTP/1.1\r
|
|
7695
7724
|
`;
|
|
7696
7725
|
if (typeof host === "string") {
|
|
7697
7726
|
header += `host: ${host}\r
|
|
@@ -8066,10 +8095,7 @@ var require_client_h2 = __commonJS({
|
|
|
8066
8095
|
kStrictContentLength,
|
|
8067
8096
|
kOnError,
|
|
8068
8097
|
kMaxConcurrentStreams,
|
|
8069
|
-
kPingInterval,
|
|
8070
8098
|
kHTTP2Session,
|
|
8071
|
-
kHTTP2InitialWindowSize,
|
|
8072
|
-
kHTTP2ConnectionWindowSize,
|
|
8073
8099
|
kHostAuthority,
|
|
8074
8100
|
kResume,
|
|
8075
8101
|
kSize,
|
|
@@ -8081,7 +8107,8 @@ var require_client_h2 = __commonJS({
|
|
|
8081
8107
|
kEnableConnectProtocol,
|
|
8082
8108
|
kRemoteSettings,
|
|
8083
8109
|
kHTTP2Stream,
|
|
8084
|
-
kHTTP2SessionState
|
|
8110
|
+
kHTTP2SessionState,
|
|
8111
|
+
kHTTP2Options
|
|
8085
8112
|
} = require_symbols();
|
|
8086
8113
|
var { channels } = require_diagnostics();
|
|
8087
8114
|
var kOpenStreams = /* @__PURE__ */ Symbol("open streams");
|
|
@@ -8090,6 +8117,9 @@ var require_client_h2 = __commonJS({
|
|
|
8090
8117
|
var kRequestStreamCleanup = /* @__PURE__ */ Symbol("request stream cleanup");
|
|
8091
8118
|
var kRequestStreamState = /* @__PURE__ */ Symbol("request stream state");
|
|
8092
8119
|
var kReceivedGoAway = /* @__PURE__ */ Symbol("received goaway");
|
|
8120
|
+
var kGoAwayReplayAttempts = /* @__PURE__ */ Symbol("goaway replay attempts");
|
|
8121
|
+
var kRefusedStreamRetry = /* @__PURE__ */ Symbol("refused stream retry");
|
|
8122
|
+
var MAX_GOAWAY_REPLAY_ATTEMPTS = 1;
|
|
8093
8123
|
var extractBody;
|
|
8094
8124
|
var http2;
|
|
8095
8125
|
try {
|
|
@@ -8187,10 +8217,15 @@ var require_client_h2 = __commonJS({
|
|
|
8187
8217
|
client[kPendingIdx] = client[kRunningIdx];
|
|
8188
8218
|
}
|
|
8189
8219
|
}
|
|
8190
|
-
function
|
|
8220
|
+
function canReplayRequest(request) {
|
|
8191
8221
|
const { body } = request;
|
|
8192
8222
|
return body == null || util.isBuffer(body) || util.isBlobLike(body);
|
|
8193
8223
|
}
|
|
8224
|
+
function registerGoAwayRefusal(request) {
|
|
8225
|
+
const attempts = (request[kGoAwayReplayAttempts] ?? 0) + 1;
|
|
8226
|
+
request[kGoAwayReplayAttempts] = attempts;
|
|
8227
|
+
return attempts <= MAX_GOAWAY_REPLAY_ATTEMPTS;
|
|
8228
|
+
}
|
|
8194
8229
|
function closeStream(stream, code = NGHTTP2_REFUSED_STREAM) {
|
|
8195
8230
|
if (stream != null && !stream.destroyed && !stream.closed) {
|
|
8196
8231
|
try {
|
|
@@ -8202,15 +8237,30 @@ var require_client_h2 = __commonJS({
|
|
|
8202
8237
|
function detachRequestStreamForClose(request) {
|
|
8203
8238
|
const stream = request[kRequestStream];
|
|
8204
8239
|
clearRequestStream(request);
|
|
8240
|
+
severRequestStream(stream);
|
|
8205
8241
|
return stream;
|
|
8206
8242
|
}
|
|
8243
|
+
function severRequestStream(stream) {
|
|
8244
|
+
if (stream == null || stream[kRequestStreamState] == null) {
|
|
8245
|
+
return;
|
|
8246
|
+
}
|
|
8247
|
+
stream[kRequestStreamState] = null;
|
|
8248
|
+
stream.off("close", completeRequestStream);
|
|
8249
|
+
stream.off("close", onUpgradeStreamClose);
|
|
8250
|
+
if (stream[kHTTP2Session] != null) {
|
|
8251
|
+
closeStreamSession(stream);
|
|
8252
|
+
}
|
|
8253
|
+
if (!stream.destroyed && !stream.closed) {
|
|
8254
|
+
stream.once("error", noop);
|
|
8255
|
+
}
|
|
8256
|
+
}
|
|
8207
8257
|
function connectH2(client, socket) {
|
|
8208
8258
|
client[kSocket] = socket;
|
|
8209
|
-
const http2InitialWindowSize = client[
|
|
8210
|
-
const http2ConnectionWindowSize = client[
|
|
8259
|
+
const http2InitialWindowSize = client[kHTTP2Options].sessionOptions?.initialWindowSize;
|
|
8260
|
+
const http2ConnectionWindowSize = client[kHTTP2Options].connectionWindowSize;
|
|
8211
8261
|
const session = http2.connect(client[kUrl], {
|
|
8212
8262
|
createConnection: () => socket,
|
|
8213
|
-
peerMaxConcurrentStreams: client[
|
|
8263
|
+
peerMaxConcurrentStreams: client[kHTTP2Options].maxConcurrentStreams,
|
|
8214
8264
|
settings: {
|
|
8215
8265
|
// TODO(metcoder95): add support for PUSH
|
|
8216
8266
|
enablePush: false,
|
|
@@ -8223,13 +8273,16 @@ var require_client_h2 = __commonJS({
|
|
|
8223
8273
|
session[kSocket] = socket;
|
|
8224
8274
|
session[kHTTP2SessionState] = {
|
|
8225
8275
|
idleTimeout: null,
|
|
8276
|
+
// Armed while the peer advertises MAX_CONCURRENT_STREAMS = 0 and we have
|
|
8277
|
+
// work that cannot start. See setNoStreamsTimeout.
|
|
8278
|
+
noStreamsTimeout: null,
|
|
8226
8279
|
// Sockets start out ref'd. Session ref/unref proxies to the socket, so a
|
|
8227
8280
|
// single cached flag lets us skip redundant uv ref/unref calls, provided
|
|
8228
8281
|
// every ref/unref of the session or its socket goes through
|
|
8229
8282
|
// refH2Session/unrefH2Session.
|
|
8230
8283
|
refed: true,
|
|
8231
8284
|
ping: {
|
|
8232
|
-
interval: client[
|
|
8285
|
+
interval: client[kHTTP2Options].pingInterval === 0 ? null : setInterval(onHttp2SendPing, client[kHTTP2Options].pingInterval, session).unref()
|
|
8233
8286
|
}
|
|
8234
8287
|
};
|
|
8235
8288
|
session[kReceivedGoAway] = false;
|
|
@@ -8334,8 +8387,48 @@ var require_client_h2 = __commonJS({
|
|
|
8334
8387
|
} else {
|
|
8335
8388
|
clearHttp2IdleTimeout(session);
|
|
8336
8389
|
}
|
|
8390
|
+
if (client[kMaxConcurrentStreams] === 0 && client[kRunning] === 0 && client[kPending] > 0) {
|
|
8391
|
+
setNoStreamsTimeout(session);
|
|
8392
|
+
} else {
|
|
8393
|
+
clearNoStreamsTimeout(session);
|
|
8394
|
+
}
|
|
8395
|
+
}
|
|
8396
|
+
}
|
|
8397
|
+
function clearNoStreamsTimeout(session) {
|
|
8398
|
+
const state = session[kHTTP2SessionState];
|
|
8399
|
+
if (state?.noStreamsTimeout != null) {
|
|
8400
|
+
clearTimeout(state.noStreamsTimeout);
|
|
8401
|
+
state.noStreamsTimeout = null;
|
|
8337
8402
|
}
|
|
8338
8403
|
}
|
|
8404
|
+
function setNoStreamsTimeout(session) {
|
|
8405
|
+
const client = session[kClient];
|
|
8406
|
+
const state = session[kHTTP2SessionState];
|
|
8407
|
+
const timeout = client[kHeadersTimeout];
|
|
8408
|
+
if (!timeout || state.noStreamsTimeout != null) {
|
|
8409
|
+
return;
|
|
8410
|
+
}
|
|
8411
|
+
state.noStreamsTimeout = setTimeout(onNoStreamsTimeout, timeout, session).unref();
|
|
8412
|
+
}
|
|
8413
|
+
function onNoStreamsTimeout(session) {
|
|
8414
|
+
const client = session[kClient];
|
|
8415
|
+
const state = session[kHTTP2SessionState];
|
|
8416
|
+
state.noStreamsTimeout = null;
|
|
8417
|
+
if (client[kHTTP2Session] !== session || client[kMaxConcurrentStreams] !== 0 || client[kRunning] !== 0 || client[kPending] === 0) {
|
|
8418
|
+
return;
|
|
8419
|
+
}
|
|
8420
|
+
const err = new HeadersTimeoutError(
|
|
8421
|
+
`HTTP/2: server did not accept a new stream within ${client[kHeadersTimeout]}`
|
|
8422
|
+
);
|
|
8423
|
+
const requests = client[kQueue].splice(client[kPendingIdx]);
|
|
8424
|
+
for (let i = 0; i < requests.length; i++) {
|
|
8425
|
+
if (requests[i] != null) {
|
|
8426
|
+
util.errorRequest(client, requests[i], err);
|
|
8427
|
+
}
|
|
8428
|
+
}
|
|
8429
|
+
session[kError] = err;
|
|
8430
|
+
resetHttp2Session(session, err);
|
|
8431
|
+
}
|
|
8339
8432
|
function clearHttp2IdleTimeout(session) {
|
|
8340
8433
|
const state = session[kHTTP2SessionState];
|
|
8341
8434
|
if (state?.idleTimeout != null) {
|
|
@@ -8442,7 +8535,7 @@ var require_client_h2 = __commonJS({
|
|
|
8442
8535
|
const request = client[kQueue][i];
|
|
8443
8536
|
if (request != null) {
|
|
8444
8537
|
streamsToClose.push(detachRequestStreamForClose(request));
|
|
8445
|
-
if (
|
|
8538
|
+
if (canReplayRequest(request) && registerGoAwayRefusal(request)) {
|
|
8446
8539
|
retriableRequests.push(request);
|
|
8447
8540
|
} else {
|
|
8448
8541
|
util.errorRequest(client, request, err);
|
|
@@ -8463,6 +8556,7 @@ var require_client_h2 = __commonJS({
|
|
|
8463
8556
|
client[kHTTP2Session] = null;
|
|
8464
8557
|
}
|
|
8465
8558
|
clearHttp2IdleTimeout(this);
|
|
8559
|
+
clearNoStreamsTimeout(this);
|
|
8466
8560
|
if (!this.closed && !this.destroyed) {
|
|
8467
8561
|
this.close();
|
|
8468
8562
|
}
|
|
@@ -8479,6 +8573,7 @@ var require_client_h2 = __commonJS({
|
|
|
8479
8573
|
client[kHTTP2Session] = null;
|
|
8480
8574
|
}
|
|
8481
8575
|
clearHttp2IdleTimeout(this);
|
|
8576
|
+
clearNoStreamsTimeout(this);
|
|
8482
8577
|
if (state.ping.interval != null) {
|
|
8483
8578
|
clearInterval(state.ping.interval);
|
|
8484
8579
|
state.ping.interval = null;
|
|
@@ -8554,6 +8649,12 @@ var require_client_h2 = __commonJS({
|
|
|
8554
8649
|
releaseRequestStream(this);
|
|
8555
8650
|
if (state.pendingEnd && !state.request.aborted && !state.request.completed) {
|
|
8556
8651
|
state.request.onResponseEnd(state.trailers || {});
|
|
8652
|
+
} else if (!state.request.aborted && !state.request.completed) {
|
|
8653
|
+
util.errorRequest(
|
|
8654
|
+
state.client,
|
|
8655
|
+
state.request,
|
|
8656
|
+
new InformationalError("HTTP/2: stream closed before the response was complete")
|
|
8657
|
+
);
|
|
8557
8658
|
}
|
|
8558
8659
|
finalizeRequest(state);
|
|
8559
8660
|
closeStreamSession(this);
|
|
@@ -8700,7 +8801,7 @@ var require_client_h2 = __commonJS({
|
|
|
8700
8801
|
const headersTimeout = request.headersTimeout ?? client[kHeadersTimeout];
|
|
8701
8802
|
const bodyTimeout = request.bodyTimeout ?? client[kBodyTimeout];
|
|
8702
8803
|
const session = client[kHTTP2Session];
|
|
8703
|
-
const { method, path:
|
|
8804
|
+
const { method, path: path10, host, upgrade, expectContinue, signal, protocol, headers: reqHeaders } = request;
|
|
8704
8805
|
if (upgrade != null && upgrade !== "websocket") {
|
|
8705
8806
|
util.errorRequest(client, request, new InvalidArgumentError(`Custom upgrade "${upgrade}" not supported over HTTP/2`));
|
|
8706
8807
|
return false;
|
|
@@ -8763,7 +8864,7 @@ var require_client_h2 = __commonJS({
|
|
|
8763
8864
|
}
|
|
8764
8865
|
headers[HTTP2_HEADER_METHOD] = "CONNECT";
|
|
8765
8866
|
headers[HTTP2_HEADER_PROTOCOL] = "websocket";
|
|
8766
|
-
headers[HTTP2_HEADER_PATH] =
|
|
8867
|
+
headers[HTTP2_HEADER_PATH] = path10;
|
|
8767
8868
|
if (protocol === "ws:" || protocol === "wss:") {
|
|
8768
8869
|
headers[HTTP2_HEADER_SCHEME] = protocol === "ws:" ? "http" : "https";
|
|
8769
8870
|
} else {
|
|
@@ -8785,7 +8886,7 @@ var require_client_h2 = __commonJS({
|
|
|
8785
8886
|
setupUpgradeStream(stream, state);
|
|
8786
8887
|
return true;
|
|
8787
8888
|
}
|
|
8788
|
-
headers[HTTP2_HEADER_PATH] =
|
|
8889
|
+
headers[HTTP2_HEADER_PATH] = path10;
|
|
8789
8890
|
headers[HTTP2_HEADER_SCHEME] = protocol === "http:" ? "http" : "https";
|
|
8790
8891
|
const expectsPayload = method === "PUT" || method === "POST" || method === "PATCH" || method === "QUERY" || method === "PROPFIND" || method === "PROPPATCH";
|
|
8791
8892
|
let body = state.body;
|
|
@@ -8953,6 +9054,20 @@ var require_client_h2 = __commonJS({
|
|
|
8953
9054
|
state.abort(new InformationalError("HTTP/2: stream half-closed (remote)"), true);
|
|
8954
9055
|
}
|
|
8955
9056
|
}
|
|
9057
|
+
function retryRefusedStream(stream, state) {
|
|
9058
|
+
const { client, request } = state;
|
|
9059
|
+
if (state.responseReceived || request.aborted || request.completed || request[kRefusedStreamRetry] || !canReplayRequest(request)) {
|
|
9060
|
+
return false;
|
|
9061
|
+
}
|
|
9062
|
+
request[kRefusedStreamRetry] = true;
|
|
9063
|
+
detachRequestStreamForClose(request);
|
|
9064
|
+
state.stream = null;
|
|
9065
|
+
state.requestFinalized = true;
|
|
9066
|
+
completeRequest(client, request);
|
|
9067
|
+
client[kQueue].splice(client[kPendingIdx], 0, request);
|
|
9068
|
+
client[kResume]();
|
|
9069
|
+
return true;
|
|
9070
|
+
}
|
|
8956
9071
|
function onError(err) {
|
|
8957
9072
|
const stream = this;
|
|
8958
9073
|
const state = stream[kRequestStreamState];
|
|
@@ -8960,6 +9075,12 @@ var require_client_h2 = __commonJS({
|
|
|
8960
9075
|
return;
|
|
8961
9076
|
}
|
|
8962
9077
|
stream.off("error", onError);
|
|
9078
|
+
if (typeof stream.rstCode === "number" && stream.rstCode !== NGHTTP2_NO_ERROR) {
|
|
9079
|
+
err.http2ErrorCode = stream.rstCode;
|
|
9080
|
+
}
|
|
9081
|
+
if (stream.rstCode === NGHTTP2_REFUSED_STREAM && retryRefusedStream(stream, state)) {
|
|
9082
|
+
return;
|
|
9083
|
+
}
|
|
8963
9084
|
state.abort(err);
|
|
8964
9085
|
}
|
|
8965
9086
|
function onFrameError(type, code) {
|
|
@@ -9194,7 +9315,7 @@ var require_client = __commonJS({
|
|
|
9194
9315
|
var util = require_util();
|
|
9195
9316
|
var { ClientStats } = require_stats();
|
|
9196
9317
|
var { channels } = require_diagnostics();
|
|
9197
|
-
var
|
|
9318
|
+
var Request2 = require_request();
|
|
9198
9319
|
var DispatcherBase = require_dispatcher_base();
|
|
9199
9320
|
var {
|
|
9200
9321
|
InvalidArgumentError,
|
|
@@ -9241,10 +9362,8 @@ var require_client = __commonJS({
|
|
|
9241
9362
|
kHTTPContext,
|
|
9242
9363
|
kMaxConcurrentStreams,
|
|
9243
9364
|
kHostAuthority,
|
|
9244
|
-
kHTTP2InitialWindowSize,
|
|
9245
|
-
kHTTP2ConnectionWindowSize,
|
|
9246
9365
|
kResume,
|
|
9247
|
-
|
|
9366
|
+
kHTTP2Options
|
|
9248
9367
|
} = require_symbols();
|
|
9249
9368
|
var connectH1 = require_client_h1();
|
|
9250
9369
|
var connectH2 = require_client_h2();
|
|
@@ -9257,6 +9376,14 @@ var require_client = __commonJS({
|
|
|
9257
9376
|
function getPipelining(client) {
|
|
9258
9377
|
return client[kPipelining] ?? client[kHTTPContext]?.defaultPipelining ?? 1;
|
|
9259
9378
|
}
|
|
9379
|
+
var h2NamespaceOptsWarning = false;
|
|
9380
|
+
function emitH2OptionsNamespaceWarning(optName) {
|
|
9381
|
+
if (h2NamespaceOptsWarning === true) return;
|
|
9382
|
+
process.emitWarning(`Use h2Options.${optName} instead. ${optName} for H2 will be deprecated in future major.`, {
|
|
9383
|
+
code: "UNDICI-H2-OPTIONS"
|
|
9384
|
+
});
|
|
9385
|
+
h2NamespaceOptsWarning = true;
|
|
9386
|
+
}
|
|
9260
9387
|
function getMaxConcurrent(client) {
|
|
9261
9388
|
if (client[kHTTPContext]?.version === "h2") {
|
|
9262
9389
|
return client[kMaxConcurrentStreams];
|
|
@@ -9300,7 +9427,8 @@ var require_client = __commonJS({
|
|
|
9300
9427
|
initialWindowSize,
|
|
9301
9428
|
connectionWindowSize,
|
|
9302
9429
|
pingInterval,
|
|
9303
|
-
webSocket
|
|
9430
|
+
webSocket,
|
|
9431
|
+
h2Options
|
|
9304
9432
|
} = {}) {
|
|
9305
9433
|
if (keepAlive !== void 0) {
|
|
9306
9434
|
throw new InvalidArgumentError("unsupported keepAlive, use pipelining=0 instead");
|
|
@@ -9363,20 +9491,45 @@ var require_client = __commonJS({
|
|
|
9363
9491
|
if (allowH2 != null && typeof allowH2 !== "boolean") {
|
|
9364
9492
|
throw new InvalidArgumentError("allowH2 must be a valid boolean value");
|
|
9365
9493
|
}
|
|
9366
|
-
if (
|
|
9367
|
-
|
|
9368
|
-
|
|
9369
|
-
|
|
9370
|
-
|
|
9371
|
-
|
|
9372
|
-
|
|
9373
|
-
|
|
9374
|
-
|
|
9375
|
-
|
|
9376
|
-
|
|
9377
|
-
|
|
9378
|
-
|
|
9379
|
-
|
|
9494
|
+
if (allowH2 !== false) {
|
|
9495
|
+
if (h2Options != null) {
|
|
9496
|
+
if (h2Options.useH2c != null && typeof h2Options.useH2c !== "boolean") {
|
|
9497
|
+
throw new InvalidArgumentError("h2Options.useH2c must be a valid boolean value");
|
|
9498
|
+
}
|
|
9499
|
+
if (h2Options.settings?.initialWindowSize != null && (!Number.isInteger(h2Options.settings.initialWindowSize) || h2Options.settings.initialWindowSize < 1)) {
|
|
9500
|
+
throw new InvalidArgumentError("h2Options.settings.initialWindowSize must be a positive integer, greater than 0");
|
|
9501
|
+
}
|
|
9502
|
+
if (h2Options.maxConcurrentStreams != null && (!Number.isInteger(h2Options.connectionWindowSize) || h2Options.maxConcurrentStreams < 1)) {
|
|
9503
|
+
throw new InvalidArgumentError("h2Options.maxConcurrentStreams must be a positive integer, greater than 0");
|
|
9504
|
+
}
|
|
9505
|
+
if (h2Options.connectionWindowSize != null && (!Number.isInteger(h2Options.connectionWindowSize) || h2Options.connectionWindowSize < 1)) {
|
|
9506
|
+
throw new InvalidArgumentError("h2Options.connectionWindowSize must be a positive integer, greater than 0");
|
|
9507
|
+
}
|
|
9508
|
+
if (h2Options.pingInterval != null && (typeof h2Options.pingInterval !== "number" || !Number.isInteger(h2Options.pingInterval) || h2Options.pingInterval < 0)) {
|
|
9509
|
+
throw new InvalidArgumentError("h2Options.pingInterval must be a positive integer, greater or equal to 0");
|
|
9510
|
+
}
|
|
9511
|
+
} else {
|
|
9512
|
+
if (useH2c != null && typeof useH2c !== "boolean") {
|
|
9513
|
+
emitH2OptionsNamespaceWarning("useH2c");
|
|
9514
|
+
throw new InvalidArgumentError("useH2c must be a valid boolean value");
|
|
9515
|
+
}
|
|
9516
|
+
if (maxConcurrentStreams != null && (typeof maxConcurrentStreams !== "number" || maxConcurrentStreams < 1)) {
|
|
9517
|
+
emitH2OptionsNamespaceWarning("maxConcurrentStreams");
|
|
9518
|
+
throw new InvalidArgumentError("maxConcurrentStreams must be a positive integer, greater than 0");
|
|
9519
|
+
}
|
|
9520
|
+
if (initialWindowSize != null && (!Number.isInteger(initialWindowSize) || initialWindowSize < 1)) {
|
|
9521
|
+
emitH2OptionsNamespaceWarning("initialWindowSize");
|
|
9522
|
+
throw new InvalidArgumentError("initialWindowSize must be a positive integer, greater than 0");
|
|
9523
|
+
}
|
|
9524
|
+
if (connectionWindowSize != null && (!Number.isInteger(connectionWindowSize) || connectionWindowSize < 1)) {
|
|
9525
|
+
emitH2OptionsNamespaceWarning("connectionWindowSize");
|
|
9526
|
+
throw new InvalidArgumentError("connectionWindowSize must be a positive integer, greater than 0");
|
|
9527
|
+
}
|
|
9528
|
+
if (pingInterval != null && (typeof pingInterval !== "number" || !Number.isInteger(pingInterval) || pingInterval < 0)) {
|
|
9529
|
+
emitH2OptionsNamespaceWarning("pingInterval");
|
|
9530
|
+
throw new InvalidArgumentError("pingInterval must be a positive integer, greater or equal to 0");
|
|
9531
|
+
}
|
|
9532
|
+
}
|
|
9380
9533
|
}
|
|
9381
9534
|
super({ webSocket });
|
|
9382
9535
|
if (typeof connect2 !== "function") {
|
|
@@ -9384,8 +9537,8 @@ var require_client = __commonJS({
|
|
|
9384
9537
|
...tls,
|
|
9385
9538
|
maxCachedSessions,
|
|
9386
9539
|
allowH2,
|
|
9387
|
-
useH2c,
|
|
9388
9540
|
socketPath,
|
|
9541
|
+
useH2c: h2Options?.useH2c ?? useH2c,
|
|
9389
9542
|
timeout: connectTimeout,
|
|
9390
9543
|
...typeof autoSelectFamily === "boolean" ? { autoSelectFamily, autoSelectFamilyAttemptTimeout } : void 0,
|
|
9391
9544
|
...connect2
|
|
@@ -9420,10 +9573,21 @@ var require_client = __commonJS({
|
|
|
9420
9573
|
this[kClosedResolve] = null;
|
|
9421
9574
|
this[kMaxResponseSize] = maxResponseSize > -1 ? maxResponseSize : -1;
|
|
9422
9575
|
this[kHTTPContext] = null;
|
|
9423
|
-
this[
|
|
9424
|
-
|
|
9425
|
-
|
|
9426
|
-
|
|
9576
|
+
this[kHTTP2Options] = {
|
|
9577
|
+
pingInterval: h2Options?.pingInterval ?? pingInterval ?? 6e4,
|
|
9578
|
+
connectionWindowSize: h2Options?.connectionWindowSize ?? connectionWindowSize ?? 524288,
|
|
9579
|
+
maxConcurrentStreams: h2Options?.maxConcurrentStreams ?? maxConcurrentStreams ?? 100,
|
|
9580
|
+
// Max peerConcurrentStreams for a Node h2 server
|
|
9581
|
+
sessionOptions: {
|
|
9582
|
+
// HTTP/2 window sizes are set to higher defaults than Node.js core for better performance:
|
|
9583
|
+
// - initialWindowSize: 262144 (256KB) vs Node.js default 65535 (64KB - 1)
|
|
9584
|
+
// Allows more data to be sent before requiring acknowledgment, improving throughput
|
|
9585
|
+
// especially on high-latency networks. This matches common production HTTP/2 servers.
|
|
9586
|
+
// - connectionWindowSize: 524288 (512KB) vs Node.js default (none set)
|
|
9587
|
+
// Provides better flow control for the entire connection across multiple streams.
|
|
9588
|
+
initialWindowSize: h2Options?.initialWindowSize ?? initialWindowSize ?? 262144
|
|
9589
|
+
}
|
|
9590
|
+
};
|
|
9427
9591
|
this[kQueue] = [];
|
|
9428
9592
|
this[kRunningIdx] = 0;
|
|
9429
9593
|
this[kPendingIdx] = 0;
|
|
@@ -9463,7 +9627,7 @@ var require_client = __commonJS({
|
|
|
9463
9627
|
this.once("connect", cb);
|
|
9464
9628
|
}
|
|
9465
9629
|
[kDispatch](opts, handler) {
|
|
9466
|
-
const request = new
|
|
9630
|
+
const request = new Request2(this[kUrl].origin, opts, handler);
|
|
9467
9631
|
this[kQueue].push(request);
|
|
9468
9632
|
if (this[kResuming]) {
|
|
9469
9633
|
} else if (util.bodyLength(request.body) == null && util.isIterable(request.body)) {
|
|
@@ -9708,6 +9872,7 @@ var require_client = __commonJS({
|
|
|
9708
9872
|
return;
|
|
9709
9873
|
}
|
|
9710
9874
|
if (!client[kHTTPContext]) {
|
|
9875
|
+
client[kServerName] = request.servername;
|
|
9711
9876
|
connect(client);
|
|
9712
9877
|
return;
|
|
9713
9878
|
}
|
|
@@ -11118,7 +11283,7 @@ var require_socks5_proxy_agent = __commonJS({
|
|
|
11118
11283
|
var DispatcherBase = require_dispatcher_base();
|
|
11119
11284
|
var { InvalidArgumentError } = require_errors();
|
|
11120
11285
|
var { Socks5Client, STATES } = require_socks5_client();
|
|
11121
|
-
var { kDispatch, kClose, kDestroy } = require_symbols();
|
|
11286
|
+
var { kBusy, kConnected, kDispatch, kClose, kDestroy } = require_symbols();
|
|
11122
11287
|
var Pool = require_pool();
|
|
11123
11288
|
var buildConnector = require_connect();
|
|
11124
11289
|
var { debuglog } = require("node:util");
|
|
@@ -11276,6 +11441,17 @@ var require_socks5_proxy_agent = __commonJS({
|
|
|
11276
11441
|
}
|
|
11277
11442
|
});
|
|
11278
11443
|
this[kPools].set(originKey, pool);
|
|
11444
|
+
const closePoolIfUnused = () => {
|
|
11445
|
+
if (this[kPools].get(originKey) !== pool || pool[kConnected] > 0 || pool[kBusy]) {
|
|
11446
|
+
return;
|
|
11447
|
+
}
|
|
11448
|
+
this[kPools].delete(originKey);
|
|
11449
|
+
if (!pool.destroyed) {
|
|
11450
|
+
pool.close();
|
|
11451
|
+
}
|
|
11452
|
+
};
|
|
11453
|
+
pool.on("disconnect", closePoolIfUnused);
|
|
11454
|
+
pool.on("connectionError", closePoolIfUnused);
|
|
11279
11455
|
}
|
|
11280
11456
|
return pool[kDispatch](opts, handler);
|
|
11281
11457
|
} catch (err) {
|
|
@@ -11380,10 +11556,10 @@ var require_proxy_agent = __commonJS({
|
|
|
11380
11556
|
};
|
|
11381
11557
|
const {
|
|
11382
11558
|
origin,
|
|
11383
|
-
path:
|
|
11559
|
+
path: path10 = "/",
|
|
11384
11560
|
headers = {}
|
|
11385
11561
|
} = opts;
|
|
11386
|
-
opts.path = origin +
|
|
11562
|
+
opts.path = origin + path10;
|
|
11387
11563
|
if (!("host" in headers) && !("Host" in headers)) {
|
|
11388
11564
|
const { host } = new URL(origin);
|
|
11389
11565
|
headers.host = host;
|
|
@@ -11660,7 +11836,7 @@ var require_env_http_proxy_agent = __commonJS({
|
|
|
11660
11836
|
}
|
|
11661
11837
|
#getProxyAgentForUrl(url) {
|
|
11662
11838
|
let { protocol, host: hostname, port } = url;
|
|
11663
|
-
hostname = hostname.replace(/:\d*$/, "").toLowerCase();
|
|
11839
|
+
hostname = hostname.replace(/:\d*$/, "").replace(/^\[(.+)\]$/, "$1").toLowerCase();
|
|
11664
11840
|
port = Number.parseInt(port, 10) || DEFAULT_PORTS[protocol] || 0;
|
|
11665
11841
|
if (!this.#shouldProxy(hostname, port)) {
|
|
11666
11842
|
return this[kNoProxyAgent];
|
|
@@ -11703,11 +11879,22 @@ var require_env_http_proxy_agent = __commonJS({
|
|
|
11703
11879
|
if (!entry) {
|
|
11704
11880
|
continue;
|
|
11705
11881
|
}
|
|
11706
|
-
|
|
11882
|
+
let hostname, port;
|
|
11883
|
+
const ipv6WithPort = entry.match(/^\[(.+)\]:(\d+)$/);
|
|
11884
|
+
if (ipv6WithPort) {
|
|
11885
|
+
hostname = ipv6WithPort[1];
|
|
11886
|
+
port = Number.parseInt(ipv6WithPort[2], 10);
|
|
11887
|
+
} else {
|
|
11888
|
+
const unbracketed = entry.replace(/^\[(.+)\]$/, "$1");
|
|
11889
|
+
const colonCount = (unbracketed.match(/:/g) || []).length;
|
|
11890
|
+
const parsed = colonCount === 1 && unbracketed.match(/^(.+):(\d+)$/);
|
|
11891
|
+
hostname = parsed ? parsed[1] : unbracketed;
|
|
11892
|
+
port = parsed ? Number.parseInt(parsed[2], 10) : 0;
|
|
11893
|
+
}
|
|
11707
11894
|
noProxyEntries.push({
|
|
11708
11895
|
// strip leading dot or asterisk with dot
|
|
11709
|
-
hostname:
|
|
11710
|
-
port
|
|
11896
|
+
hostname: hostname.replace(/^\*?\./, "").toLowerCase(),
|
|
11897
|
+
port
|
|
11711
11898
|
});
|
|
11712
11899
|
}
|
|
11713
11900
|
this.#noProxyValue = noProxyValue;
|
|
@@ -11743,6 +11930,23 @@ var require_retry_handler = __commonJS({
|
|
|
11743
11930
|
const retryTime = new Date(retryAfter).getTime();
|
|
11744
11931
|
return isNaN(retryTime) ? null : retryTime - Date.now();
|
|
11745
11932
|
}
|
|
11933
|
+
function validatePartialResponseContentLength(headers, range, statusCode, retryCount) {
|
|
11934
|
+
const contentLength = headers["content-length"];
|
|
11935
|
+
if (contentLength == null) {
|
|
11936
|
+
return;
|
|
11937
|
+
}
|
|
11938
|
+
if (!Number.isFinite(range.start) || !Number.isFinite(range.end)) {
|
|
11939
|
+
return;
|
|
11940
|
+
}
|
|
11941
|
+
const length = Number(contentLength);
|
|
11942
|
+
const expectedLength = range.end - range.start + 1;
|
|
11943
|
+
if (!Number.isFinite(length) || length !== expectedLength) {
|
|
11944
|
+
throw new RequestRetryError("Content-Length mismatch", statusCode, {
|
|
11945
|
+
headers,
|
|
11946
|
+
data: { count: retryCount }
|
|
11947
|
+
});
|
|
11948
|
+
}
|
|
11949
|
+
}
|
|
11746
11950
|
var RetryController = class {
|
|
11747
11951
|
constructor() {
|
|
11748
11952
|
this.target = null;
|
|
@@ -11912,6 +12116,10 @@ var require_retry_handler = __commonJS({
|
|
|
11912
12116
|
setTimeout(() => cb(null), retryTimeout);
|
|
11913
12117
|
}
|
|
11914
12118
|
onResponseStart(controller, statusCode, headers, statusMessage) {
|
|
12119
|
+
if (statusCode < 200) {
|
|
12120
|
+
this.handler.onResponseStart?.(this.controllerProxy, statusCode, headers, statusMessage);
|
|
12121
|
+
return;
|
|
12122
|
+
}
|
|
11915
12123
|
this.error = null;
|
|
11916
12124
|
this.retryCount += 1;
|
|
11917
12125
|
this.statusCode = statusCode;
|
|
@@ -11946,6 +12154,7 @@ var require_retry_handler = __commonJS({
|
|
|
11946
12154
|
data: { count: this.retryCount }
|
|
11947
12155
|
});
|
|
11948
12156
|
}
|
|
12157
|
+
validatePartialResponseContentLength(headers, contentRange, statusCode, this.retryCount);
|
|
11949
12158
|
const { start, size, end = size ? size - 1 : null } = contentRange;
|
|
11950
12159
|
assert(this.start === start, "content-range mismatch");
|
|
11951
12160
|
assert(this.end == null || this.end === end, "content-range mismatch");
|
|
@@ -11954,7 +12163,7 @@ var require_retry_handler = __commonJS({
|
|
|
11954
12163
|
if (this.end == null) {
|
|
11955
12164
|
if (statusCode === 206) {
|
|
11956
12165
|
const range = parseRangeHeader(headers["content-range"]);
|
|
11957
|
-
if (range == null) {
|
|
12166
|
+
if (range == null || range.end == null) {
|
|
11958
12167
|
this.headersSent = true;
|
|
11959
12168
|
this.handler.onResponseStart?.(
|
|
11960
12169
|
this.controllerProxy,
|
|
@@ -11964,6 +12173,7 @@ var require_retry_handler = __commonJS({
|
|
|
11964
12173
|
);
|
|
11965
12174
|
return;
|
|
11966
12175
|
}
|
|
12176
|
+
validatePartialResponseContentLength(headers, range, statusCode, this.retryCount);
|
|
11967
12177
|
const { start, size, end = size ? size - 1 : null } = range;
|
|
11968
12178
|
assert(
|
|
11969
12179
|
start != null && Number.isFinite(start),
|
|
@@ -11973,7 +12183,7 @@ var require_retry_handler = __commonJS({
|
|
|
11973
12183
|
this.start = start;
|
|
11974
12184
|
this.end = end;
|
|
11975
12185
|
}
|
|
11976
|
-
if (this.end == null) {
|
|
12186
|
+
if (this.end == null && this.opts.method !== "HEAD") {
|
|
11977
12187
|
const contentLength = headers["content-length"];
|
|
11978
12188
|
this.end = contentLength != null ? Number(contentLength) - 1 : null;
|
|
11979
12189
|
}
|
|
@@ -12174,7 +12384,6 @@ var require_readable = __commonJS({
|
|
|
12174
12384
|
var kContentLength = /* @__PURE__ */ Symbol("kContentLength");
|
|
12175
12385
|
var kUsed = /* @__PURE__ */ Symbol("kUsed");
|
|
12176
12386
|
var kBytesRead = /* @__PURE__ */ Symbol("kBytesRead");
|
|
12177
|
-
var kPreservedBuffer = /* @__PURE__ */ Symbol("kPreservedBuffer");
|
|
12178
12387
|
var noop = () => {
|
|
12179
12388
|
};
|
|
12180
12389
|
var BodyReadable = class extends Readable {
|
|
@@ -12413,21 +12622,6 @@ var require_readable = __commonJS({
|
|
|
12413
12622
|
*/
|
|
12414
12623
|
setEncoding(encoding) {
|
|
12415
12624
|
if (Buffer.isEncoding(encoding)) {
|
|
12416
|
-
const state = this._readableState;
|
|
12417
|
-
const buffer = state.buffer;
|
|
12418
|
-
if (buffer && state.length > 0) {
|
|
12419
|
-
const bufferIndex = state.bufferIndex ?? 0;
|
|
12420
|
-
const preserved = [];
|
|
12421
|
-
const source = typeof buffer.slice === "function" ? buffer.slice(bufferIndex) : buffer;
|
|
12422
|
-
for (const data of source) {
|
|
12423
|
-
if (Buffer.isBuffer(data)) {
|
|
12424
|
-
preserved.push(data);
|
|
12425
|
-
}
|
|
12426
|
-
}
|
|
12427
|
-
if (preserved.length > 0) {
|
|
12428
|
-
this[kPreservedBuffer] = (this[kPreservedBuffer] || []).concat(preserved);
|
|
12429
|
-
}
|
|
12430
|
-
}
|
|
12431
12625
|
super.setEncoding(encoding);
|
|
12432
12626
|
}
|
|
12433
12627
|
return this;
|
|
@@ -12478,13 +12672,7 @@ var require_readable = __commonJS({
|
|
|
12478
12672
|
return;
|
|
12479
12673
|
}
|
|
12480
12674
|
const { _readableState: state } = consume2.stream;
|
|
12481
|
-
|
|
12482
|
-
if (preserved && preserved.length > 0) {
|
|
12483
|
-
for (const chunk of preserved) {
|
|
12484
|
-
consumePush(consume2, chunk);
|
|
12485
|
-
}
|
|
12486
|
-
consume2.stream[kPreservedBuffer] = null;
|
|
12487
|
-
} else if (state.bufferIndex) {
|
|
12675
|
+
if (state.bufferIndex) {
|
|
12488
12676
|
const start = state.bufferIndex;
|
|
12489
12677
|
const end = state.buffer.length;
|
|
12490
12678
|
for (let n = start; n < end; n++) {
|
|
@@ -12495,13 +12683,17 @@ var require_readable = __commonJS({
|
|
|
12495
12683
|
consumePush(consume2, chunk);
|
|
12496
12684
|
}
|
|
12497
12685
|
}
|
|
12686
|
+
const decoder = state.decoder;
|
|
12687
|
+
if (decoder != null && decoder.lastNeed > 0) {
|
|
12688
|
+
consumePush(consume2, Buffer.from(decoder.lastChar.subarray(0, decoder.lastTotal - decoder.lastNeed)));
|
|
12689
|
+
}
|
|
12498
12690
|
if (state.endEmitted) {
|
|
12499
|
-
consumeEnd(
|
|
12500
|
-
|
|
12501
|
-
consume2.stream.on("end", function() {
|
|
12502
|
-
consumeEnd(this[kConsume], this._readableState.encoding);
|
|
12503
|
-
});
|
|
12691
|
+
consumeEnd(consume2, state.encoding);
|
|
12692
|
+
return;
|
|
12504
12693
|
}
|
|
12694
|
+
consume2.stream.on("end", function() {
|
|
12695
|
+
consumeEnd(this[kConsume], this._readableState.encoding);
|
|
12696
|
+
});
|
|
12505
12697
|
consume2.stream.resume();
|
|
12506
12698
|
while (consume2.stream.read() != null) {
|
|
12507
12699
|
}
|
|
@@ -12558,6 +12750,9 @@ var require_readable = __commonJS({
|
|
|
12558
12750
|
if (consume2.body === null) {
|
|
12559
12751
|
return;
|
|
12560
12752
|
}
|
|
12753
|
+
if (typeof chunk === "string") {
|
|
12754
|
+
chunk = Buffer.from(chunk, consume2.stream._readableState.encoding);
|
|
12755
|
+
}
|
|
12561
12756
|
consume2.length += chunk.length;
|
|
12562
12757
|
consume2.body.push(chunk);
|
|
12563
12758
|
}
|
|
@@ -13542,6 +13737,7 @@ var require_mock_utils = __commonJS({
|
|
|
13542
13737
|
}
|
|
13543
13738
|
} = require("node:util");
|
|
13544
13739
|
var { InvalidArgumentError } = require_errors();
|
|
13740
|
+
var requestAborted = /* @__PURE__ */ Symbol("request aborted");
|
|
13545
13741
|
function matchValue(match, value) {
|
|
13546
13742
|
if (typeof match === "string") {
|
|
13547
13743
|
return match === value;
|
|
@@ -13628,20 +13824,20 @@ var require_mock_utils = __commonJS({
|
|
|
13628
13824
|
}
|
|
13629
13825
|
return normalizedQp;
|
|
13630
13826
|
}
|
|
13631
|
-
function safeUrl(
|
|
13632
|
-
if (typeof
|
|
13633
|
-
return
|
|
13827
|
+
function safeUrl(path10) {
|
|
13828
|
+
if (typeof path10 !== "string") {
|
|
13829
|
+
return path10;
|
|
13634
13830
|
}
|
|
13635
|
-
const pathSegments =
|
|
13831
|
+
const pathSegments = path10.split("?", 3);
|
|
13636
13832
|
if (pathSegments.length !== 2) {
|
|
13637
|
-
return
|
|
13833
|
+
return path10;
|
|
13638
13834
|
}
|
|
13639
13835
|
const qp = new URLSearchParams(pathSegments.pop());
|
|
13640
13836
|
qp.sort();
|
|
13641
13837
|
return [...pathSegments, qp.toString()].join("?");
|
|
13642
13838
|
}
|
|
13643
|
-
function matchKey(mockDispatch2, { path:
|
|
13644
|
-
const pathMatch = matchValue(mockDispatch2.path,
|
|
13839
|
+
function matchKey(mockDispatch2, { path: path10, method, body, headers }) {
|
|
13840
|
+
const pathMatch = matchValue(mockDispatch2.path, path10);
|
|
13645
13841
|
const methodMatch = matchValue(mockDispatch2.method, method);
|
|
13646
13842
|
const bodyMatch = typeof mockDispatch2.body !== "undefined" ? matchValue(mockDispatch2.body, body) : true;
|
|
13647
13843
|
const headersMatch = matchHeaders(mockDispatch2, headers);
|
|
@@ -13654,6 +13850,8 @@ var require_mock_utils = __commonJS({
|
|
|
13654
13850
|
return data;
|
|
13655
13851
|
} else if (data instanceof ArrayBuffer) {
|
|
13656
13852
|
return data;
|
|
13853
|
+
} else if (ArrayBuffer.isView(data)) {
|
|
13854
|
+
return new Uint8Array(data.buffer, data.byteOffset, data.byteLength);
|
|
13657
13855
|
} else if (typeof data === "object") {
|
|
13658
13856
|
return JSON.stringify(data);
|
|
13659
13857
|
} else if (data) {
|
|
@@ -13666,8 +13864,8 @@ var require_mock_utils = __commonJS({
|
|
|
13666
13864
|
const basePath = key.query ? serializePathWithQuery(key.path, key.query) : key.path;
|
|
13667
13865
|
const resolvedPath = typeof basePath === "string" ? safeUrl(basePath) : basePath;
|
|
13668
13866
|
const resolvedPathWithoutTrailingSlash = removeTrailingSlash(resolvedPath);
|
|
13669
|
-
let matchedMockDispatches = mockDispatches.filter(({ consumed }) => !consumed).filter(({ path:
|
|
13670
|
-
return ignoreTrailingSlash ? matchValue(removeTrailingSlash(safeUrl(
|
|
13867
|
+
let matchedMockDispatches = mockDispatches.filter(({ consumed }) => !consumed).filter(({ path: path10, ignoreTrailingSlash }) => {
|
|
13868
|
+
return ignoreTrailingSlash ? matchValue(removeTrailingSlash(safeUrl(path10)), resolvedPathWithoutTrailingSlash) : matchValue(safeUrl(path10), resolvedPath);
|
|
13671
13869
|
});
|
|
13672
13870
|
if (matchedMockDispatches.length === 0) {
|
|
13673
13871
|
throw new MockNotMatchedError(`Mock dispatch not matched for path '${resolvedPath}'`);
|
|
@@ -13706,19 +13904,22 @@ var require_mock_utils = __commonJS({
|
|
|
13706
13904
|
mockDispatches.splice(index, 1);
|
|
13707
13905
|
}
|
|
13708
13906
|
}
|
|
13709
|
-
function removeTrailingSlash(
|
|
13710
|
-
|
|
13711
|
-
|
|
13907
|
+
function removeTrailingSlash(path10) {
|
|
13908
|
+
if (typeof path10 !== "string") {
|
|
13909
|
+
return path10;
|
|
13910
|
+
}
|
|
13911
|
+
while (path10.endsWith("/")) {
|
|
13912
|
+
path10 = path10.slice(0, -1);
|
|
13712
13913
|
}
|
|
13713
|
-
if (
|
|
13714
|
-
|
|
13914
|
+
if (path10.length === 0) {
|
|
13915
|
+
path10 = "/";
|
|
13715
13916
|
}
|
|
13716
|
-
return
|
|
13917
|
+
return path10;
|
|
13717
13918
|
}
|
|
13718
13919
|
function buildKey(opts) {
|
|
13719
|
-
const { path:
|
|
13920
|
+
const { path: path10, method, body, headers, query } = opts;
|
|
13720
13921
|
return {
|
|
13721
|
-
path:
|
|
13922
|
+
path: path10,
|
|
13722
13923
|
method,
|
|
13723
13924
|
body,
|
|
13724
13925
|
headers,
|
|
@@ -13760,30 +13961,38 @@ var require_mock_utils = __commonJS({
|
|
|
13760
13961
|
const { timesInvoked, times } = mockDispatch2;
|
|
13761
13962
|
mockDispatch2.consumed = !mockDispatch2.persist && timesInvoked >= times;
|
|
13762
13963
|
mockDispatch2.pending = timesInvoked < times;
|
|
13763
|
-
|
|
13764
|
-
|
|
13964
|
+
const hasBodyHooks = typeof handler.onBodySent === "function" || typeof handler.onRequestSent === "function";
|
|
13965
|
+
if (mockDispatch2.data.callback && (!hasBodyHooks || opts.body == null)) {
|
|
13966
|
+
const { callback, ...responseDefaults } = mockDispatch2.data;
|
|
13967
|
+
const callbackResult = callback(opts);
|
|
13765
13968
|
if (isPromise(callbackResult)) {
|
|
13766
13969
|
callbackResult.then(
|
|
13767
13970
|
(resolvedData) => {
|
|
13768
|
-
|
|
13971
|
+
if (resolvedData == null || typeof resolvedData !== "object") {
|
|
13972
|
+
handler.onResponseError(null, new InvalidArgumentError("reply options callback must return an object"));
|
|
13973
|
+
return;
|
|
13974
|
+
}
|
|
13975
|
+
mockDispatch2.data = { ...responseDefaults, ...resolvedData };
|
|
13769
13976
|
dispatchMockReply(mockDispatches, mockDispatch2, key, opts, handler);
|
|
13770
13977
|
},
|
|
13771
13978
|
(error2) => {
|
|
13772
|
-
deleteMockDispatch(mockDispatches, key);
|
|
13773
13979
|
handler.onResponseError(null, error2);
|
|
13774
13980
|
}
|
|
13775
13981
|
);
|
|
13776
13982
|
return true;
|
|
13777
13983
|
}
|
|
13778
|
-
|
|
13984
|
+
if (callbackResult == null || typeof callbackResult !== "object") {
|
|
13985
|
+
throw new InvalidArgumentError("reply options callback must return an object");
|
|
13986
|
+
}
|
|
13987
|
+
mockDispatch2.data = { ...responseDefaults, ...callbackResult };
|
|
13779
13988
|
}
|
|
13780
13989
|
return dispatchMockReply(mockDispatches, mockDispatch2, key, opts, handler);
|
|
13781
13990
|
}
|
|
13782
13991
|
function dispatchMockReply(mockDispatches, mockDispatch2, key, opts, handler) {
|
|
13783
|
-
const { data:
|
|
13784
|
-
if (
|
|
13992
|
+
const { data: response, delay } = mockDispatch2;
|
|
13993
|
+
if (response.error !== null) {
|
|
13785
13994
|
deleteMockDispatch(mockDispatches, key);
|
|
13786
|
-
handler.onResponseError(null,
|
|
13995
|
+
handler.onResponseError(null, response.error);
|
|
13787
13996
|
return true;
|
|
13788
13997
|
}
|
|
13789
13998
|
let aborted = false;
|
|
@@ -13810,30 +14019,91 @@ var require_mock_utils = __commonJS({
|
|
|
13810
14019
|
handler.onResponseError?.(controller, reason);
|
|
13811
14020
|
}
|
|
13812
14021
|
};
|
|
14022
|
+
let replyOpts = opts;
|
|
14023
|
+
const dispatches = mockDispatches;
|
|
13813
14024
|
handler.onRequestStart?.(controller, null);
|
|
13814
|
-
if (
|
|
13815
|
-
|
|
13816
|
-
|
|
13817
|
-
|
|
13818
|
-
|
|
13819
|
-
|
|
13820
|
-
|
|
14025
|
+
if (aborted) {
|
|
14026
|
+
return true;
|
|
14027
|
+
}
|
|
14028
|
+
const requestBody = dispatchRequestBody(opts.body, handler, controller, () => aborted);
|
|
14029
|
+
if (isPromise(requestBody)) {
|
|
14030
|
+
requestBody.then((body) => {
|
|
14031
|
+
if (body === requestAborted) {
|
|
14032
|
+
return;
|
|
14033
|
+
}
|
|
14034
|
+
if (body !== opts.body) {
|
|
14035
|
+
replyOpts = { ...opts, body };
|
|
14036
|
+
}
|
|
14037
|
+
sendReply();
|
|
14038
|
+
}, (error2) => controller.abort(error2));
|
|
14039
|
+
return true;
|
|
14040
|
+
}
|
|
14041
|
+
if (requestBody === requestAborted) {
|
|
14042
|
+
return true;
|
|
14043
|
+
}
|
|
14044
|
+
if (requestBody !== opts.body) {
|
|
14045
|
+
replyOpts = { ...opts, body: requestBody };
|
|
14046
|
+
}
|
|
14047
|
+
sendReply();
|
|
14048
|
+
function sendReply() {
|
|
14049
|
+
if (response.callback) {
|
|
14050
|
+
const { callback, ...responseDefaults } = response;
|
|
14051
|
+
let callbackResult;
|
|
14052
|
+
try {
|
|
14053
|
+
callbackResult = callback(replyOpts);
|
|
14054
|
+
} catch (err) {
|
|
14055
|
+
deleteMockDispatch(mockDispatches, key);
|
|
14056
|
+
handler.onResponseError(null, err);
|
|
14057
|
+
return;
|
|
14058
|
+
}
|
|
14059
|
+
if (isPromise(callbackResult)) {
|
|
14060
|
+
callbackResult.then(
|
|
14061
|
+
(resolvedData) => {
|
|
14062
|
+
if (resolvedData == null || typeof resolvedData !== "object") {
|
|
14063
|
+
handler.onResponseError(null, new InvalidArgumentError("reply options callback must return an object"));
|
|
14064
|
+
return;
|
|
14065
|
+
}
|
|
14066
|
+
mockDispatch2.data = { ...responseDefaults, ...resolvedData };
|
|
14067
|
+
handleReply(dispatches, mockDispatch2.data);
|
|
14068
|
+
},
|
|
14069
|
+
(err) => {
|
|
14070
|
+
handler.onResponseError(null, err);
|
|
14071
|
+
}
|
|
14072
|
+
);
|
|
14073
|
+
return;
|
|
14074
|
+
}
|
|
14075
|
+
if (callbackResult == null || typeof callbackResult !== "object") {
|
|
14076
|
+
throw new InvalidArgumentError("reply options callback must return an object");
|
|
14077
|
+
}
|
|
14078
|
+
mockDispatch2.data = { ...responseDefaults, ...callbackResult };
|
|
14079
|
+
handleReply(dispatches, mockDispatch2.data);
|
|
14080
|
+
return;
|
|
14081
|
+
}
|
|
14082
|
+
if (typeof delay === "number" && delay > 0) {
|
|
14083
|
+
timer = setTimeout(() => {
|
|
14084
|
+
timer = null;
|
|
14085
|
+
handleReply(dispatches);
|
|
14086
|
+
}, delay);
|
|
14087
|
+
} else {
|
|
14088
|
+
handleReply(dispatches);
|
|
14089
|
+
}
|
|
13821
14090
|
}
|
|
13822
|
-
function handleReply(mockDispatches2,
|
|
14091
|
+
function handleReply(mockDispatches2, _response = response) {
|
|
13823
14092
|
if (aborted) {
|
|
13824
14093
|
return;
|
|
13825
14094
|
}
|
|
14095
|
+
const { statusCode, data, headers, trailers } = _response;
|
|
13826
14096
|
const optsHeaders = Array.isArray(opts.headers) ? buildHeadersFromArray(opts.headers) : opts.headers;
|
|
13827
|
-
const body = typeof
|
|
14097
|
+
const body = typeof data === "function" ? data({ ...replyOpts, headers: optsHeaders }) : data;
|
|
13828
14098
|
if (isPromise(body)) {
|
|
13829
|
-
return body.then((newData) => handleReply(mockDispatches2, newData));
|
|
14099
|
+
return body.then((newData) => handleReply(mockDispatches2, { ..._response, data: newData }));
|
|
13830
14100
|
}
|
|
13831
14101
|
if (aborted) {
|
|
13832
14102
|
return;
|
|
13833
14103
|
}
|
|
13834
14104
|
const responseData = getResponseData(body);
|
|
13835
|
-
const responseHeaders = generateKeyValues(headers);
|
|
13836
|
-
const responseTrailers = generateKeyValues(trailers);
|
|
14105
|
+
const responseHeaders = generateKeyValues(headers ?? {});
|
|
14106
|
+
const responseTrailers = generateKeyValues(trailers ?? {});
|
|
13837
14107
|
controller.rawHeaders = responseHeaders;
|
|
13838
14108
|
controller.rawTrailers = responseTrailers;
|
|
13839
14109
|
handler.onResponseStart?.(controller, statusCode, parseHeaders(responseHeaders), getStatusText(statusCode));
|
|
@@ -13843,6 +14113,78 @@ var require_mock_utils = __commonJS({
|
|
|
13843
14113
|
}
|
|
13844
14114
|
return true;
|
|
13845
14115
|
}
|
|
14116
|
+
function dispatchRequestBody(body, handler, controller, isAborted) {
|
|
14117
|
+
if (typeof handler.onBodySent !== "function" && typeof handler.onRequestSent !== "function") {
|
|
14118
|
+
return body;
|
|
14119
|
+
}
|
|
14120
|
+
if (body == null) {
|
|
14121
|
+
return callOnRequestSent(handler, controller, isAborted) ? body : requestAborted;
|
|
14122
|
+
}
|
|
14123
|
+
if (body && typeof body[Symbol.asyncIterator] === "function") {
|
|
14124
|
+
return dispatchAsyncIterableBody(body, handler, controller, isAborted);
|
|
14125
|
+
}
|
|
14126
|
+
if (isIterableBody(body)) {
|
|
14127
|
+
const chunks = [];
|
|
14128
|
+
for (const chunk of body) {
|
|
14129
|
+
if (isAborted()) {
|
|
14130
|
+
return requestAborted;
|
|
14131
|
+
}
|
|
14132
|
+
chunks.push(chunk);
|
|
14133
|
+
if (!callOnBodySent(handler, controller, chunk) || isAborted()) {
|
|
14134
|
+
return requestAborted;
|
|
14135
|
+
}
|
|
14136
|
+
}
|
|
14137
|
+
return callOnRequestSent(handler, controller, isAborted) ? chunks : requestAborted;
|
|
14138
|
+
}
|
|
14139
|
+
if (isAborted()) {
|
|
14140
|
+
return requestAborted;
|
|
14141
|
+
}
|
|
14142
|
+
if (!callOnBodySent(handler, controller, body)) {
|
|
14143
|
+
return requestAborted;
|
|
14144
|
+
}
|
|
14145
|
+
return callOnRequestSent(handler, controller, isAborted) ? body : requestAborted;
|
|
14146
|
+
}
|
|
14147
|
+
async function dispatchAsyncIterableBody(body, handler, controller, isAborted) {
|
|
14148
|
+
const chunks = [];
|
|
14149
|
+
for await (const chunk of body) {
|
|
14150
|
+
if (isAborted()) {
|
|
14151
|
+
return requestAborted;
|
|
14152
|
+
}
|
|
14153
|
+
chunks.push(chunk);
|
|
14154
|
+
if (!callOnBodySent(handler, controller, chunk) || isAborted()) {
|
|
14155
|
+
return requestAborted;
|
|
14156
|
+
}
|
|
14157
|
+
}
|
|
14158
|
+
if (!callOnRequestSent(handler, controller, isAborted)) {
|
|
14159
|
+
return requestAborted;
|
|
14160
|
+
}
|
|
14161
|
+
return {
|
|
14162
|
+
async *[Symbol.asyncIterator]() {
|
|
14163
|
+
yield* chunks;
|
|
14164
|
+
}
|
|
14165
|
+
};
|
|
14166
|
+
}
|
|
14167
|
+
function callOnBodySent(handler, controller, chunk) {
|
|
14168
|
+
try {
|
|
14169
|
+
handler.onBodySent?.(chunk);
|
|
14170
|
+
return true;
|
|
14171
|
+
} catch (error2) {
|
|
14172
|
+
controller.abort(error2);
|
|
14173
|
+
return false;
|
|
14174
|
+
}
|
|
14175
|
+
}
|
|
14176
|
+
function callOnRequestSent(handler, controller, isAborted) {
|
|
14177
|
+
try {
|
|
14178
|
+
handler.onRequestSent?.();
|
|
14179
|
+
return !isAborted();
|
|
14180
|
+
} catch (error2) {
|
|
14181
|
+
controller.abort(error2);
|
|
14182
|
+
return false;
|
|
14183
|
+
}
|
|
14184
|
+
}
|
|
14185
|
+
function isIterableBody(body) {
|
|
14186
|
+
return typeof body !== "string" && !Buffer.isBuffer(body) && !ArrayBuffer.isView(body) && typeof body[Symbol.iterator] === "function";
|
|
14187
|
+
}
|
|
13846
14188
|
function buildMockDispatch() {
|
|
13847
14189
|
const agent = this[kMockAgent];
|
|
13848
14190
|
const origin = this[kOrigin];
|
|
@@ -14448,10 +14790,10 @@ var require_pending_interceptors_formatter = __commonJS({
|
|
|
14448
14790
|
}
|
|
14449
14791
|
format(pendingInterceptors) {
|
|
14450
14792
|
const withPrettyHeaders = pendingInterceptors.map(
|
|
14451
|
-
({ method, path:
|
|
14793
|
+
({ method, path: path10, data: { statusCode }, persist, times, timesInvoked, origin }) => ({
|
|
14452
14794
|
Method: method,
|
|
14453
14795
|
Origin: origin,
|
|
14454
|
-
Path:
|
|
14796
|
+
Path: path10,
|
|
14455
14797
|
"Status code": statusCode,
|
|
14456
14798
|
Persistent: persist ? PERSISTENT : NOT_PERSISTENT,
|
|
14457
14799
|
Invocations: timesInvoked,
|
|
@@ -14533,9 +14875,9 @@ var require_mock_agent = __commonJS({
|
|
|
14533
14875
|
const acceptNonStandardSearchParameters = this[kMockAgentAcceptsNonStandardSearchParameters];
|
|
14534
14876
|
const dispatchOpts = { ...opts };
|
|
14535
14877
|
if (acceptNonStandardSearchParameters && dispatchOpts.path) {
|
|
14536
|
-
const [
|
|
14878
|
+
const [path10, searchParams] = dispatchOpts.path.split("?");
|
|
14537
14879
|
const normalizedSearchParams = normalizeSearchParams(searchParams, acceptNonStandardSearchParameters);
|
|
14538
|
-
dispatchOpts.path = `${
|
|
14880
|
+
dispatchOpts.path = `${path10}?${normalizedSearchParams}`;
|
|
14539
14881
|
}
|
|
14540
14882
|
return this[kAgent].dispatch(dispatchOpts, handler);
|
|
14541
14883
|
}
|
|
@@ -14951,12 +15293,12 @@ var require_snapshot_recorder = __commonJS({
|
|
|
14951
15293
|
* @return {Promise<void>} - Resolves when snapshots are loaded
|
|
14952
15294
|
*/
|
|
14953
15295
|
async loadSnapshots(filePath) {
|
|
14954
|
-
const
|
|
14955
|
-
if (!
|
|
15296
|
+
const path10 = filePath || this.#snapshotPath;
|
|
15297
|
+
if (!path10) {
|
|
14956
15298
|
throw new InvalidArgumentError("Snapshot path is required");
|
|
14957
15299
|
}
|
|
14958
15300
|
try {
|
|
14959
|
-
const data = await readFile(resolve3(
|
|
15301
|
+
const data = await readFile(resolve3(path10), "utf8");
|
|
14960
15302
|
const parsed = JSON.parse(data);
|
|
14961
15303
|
if (Array.isArray(parsed)) {
|
|
14962
15304
|
this.#snapshots.clear();
|
|
@@ -14970,7 +15312,7 @@ var require_snapshot_recorder = __commonJS({
|
|
|
14970
15312
|
if (error2.code === "ENOENT") {
|
|
14971
15313
|
this.#snapshots.clear();
|
|
14972
15314
|
} else {
|
|
14973
|
-
throw new UndiciError(`Failed to load snapshots from ${
|
|
15315
|
+
throw new UndiciError(`Failed to load snapshots from ${path10}`, { cause: error2 });
|
|
14974
15316
|
}
|
|
14975
15317
|
}
|
|
14976
15318
|
}
|
|
@@ -14981,11 +15323,11 @@ var require_snapshot_recorder = __commonJS({
|
|
|
14981
15323
|
* @returns {Promise<void>} - Resolves when snapshots are saved
|
|
14982
15324
|
*/
|
|
14983
15325
|
async saveSnapshots(filePath) {
|
|
14984
|
-
const
|
|
14985
|
-
if (!
|
|
15326
|
+
const path10 = filePath || this.#snapshotPath;
|
|
15327
|
+
if (!path10) {
|
|
14986
15328
|
throw new InvalidArgumentError("Snapshot path is required");
|
|
14987
15329
|
}
|
|
14988
|
-
const resolvedPath = resolve3(
|
|
15330
|
+
const resolvedPath = resolve3(path10);
|
|
14989
15331
|
await mkdir3(dirname5(resolvedPath), { recursive: true });
|
|
14990
15332
|
const data = Array.from(this.#snapshots.entries()).map(([hash, snapshot]) => ({
|
|
14991
15333
|
hash,
|
|
@@ -15434,6 +15776,7 @@ var require_global2 = __commonJS({
|
|
|
15434
15776
|
var { InvalidArgumentError } = require_errors();
|
|
15435
15777
|
var Agent3 = require_agent();
|
|
15436
15778
|
var Dispatcher1Wrapper = require_dispatcher1_wrapper();
|
|
15779
|
+
var fallbackDispatcher;
|
|
15437
15780
|
if (getGlobalDispatcher() === void 0) {
|
|
15438
15781
|
setGlobalDispatcher(new Agent3());
|
|
15439
15782
|
}
|
|
@@ -15441,22 +15784,36 @@ var require_global2 = __commonJS({
|
|
|
15441
15784
|
if (!agent || typeof agent.dispatch !== "function") {
|
|
15442
15785
|
throw new InvalidArgumentError("Argument agent must implement Agent");
|
|
15443
15786
|
}
|
|
15444
|
-
|
|
15445
|
-
|
|
15446
|
-
|
|
15447
|
-
|
|
15448
|
-
|
|
15449
|
-
|
|
15450
|
-
|
|
15451
|
-
|
|
15452
|
-
|
|
15453
|
-
|
|
15454
|
-
|
|
15455
|
-
|
|
15456
|
-
|
|
15787
|
+
try {
|
|
15788
|
+
Object.defineProperty(globalThis, globalDispatcher, {
|
|
15789
|
+
value: agent,
|
|
15790
|
+
writable: true,
|
|
15791
|
+
enumerable: false,
|
|
15792
|
+
configurable: false
|
|
15793
|
+
});
|
|
15794
|
+
} catch (err) {
|
|
15795
|
+
if (err instanceof TypeError) {
|
|
15796
|
+
fallbackDispatcher = agent;
|
|
15797
|
+
return;
|
|
15798
|
+
}
|
|
15799
|
+
throw err;
|
|
15800
|
+
}
|
|
15801
|
+
try {
|
|
15802
|
+
const legacyAgent = agent instanceof Dispatcher1Wrapper ? agent : new Dispatcher1Wrapper(agent);
|
|
15803
|
+
Object.defineProperty(globalThis, legacyGlobalDispatcher, {
|
|
15804
|
+
value: legacyAgent,
|
|
15805
|
+
writable: true,
|
|
15806
|
+
enumerable: false,
|
|
15807
|
+
configurable: false
|
|
15808
|
+
});
|
|
15809
|
+
} catch (err) {
|
|
15810
|
+
if (!(err instanceof TypeError)) {
|
|
15811
|
+
throw err;
|
|
15812
|
+
}
|
|
15813
|
+
}
|
|
15457
15814
|
}
|
|
15458
15815
|
function getGlobalDispatcher() {
|
|
15459
|
-
return globalThis[globalDispatcher];
|
|
15816
|
+
return globalThis[globalDispatcher] ?? fallbackDispatcher;
|
|
15460
15817
|
}
|
|
15461
15818
|
var installedExports = (
|
|
15462
15819
|
/** @type {const} */
|
|
@@ -15607,15 +15964,15 @@ var require_redirect_handler = __commonJS({
|
|
|
15607
15964
|
return;
|
|
15608
15965
|
}
|
|
15609
15966
|
const { origin, pathname, search } = util.parseURL(new URL(this.location, this.opts.origin && new URL(this.opts.path, this.opts.origin)));
|
|
15610
|
-
const
|
|
15611
|
-
const redirectUrlString = `${origin}${
|
|
15967
|
+
const path10 = search ? `${pathname}${search}` : pathname;
|
|
15968
|
+
const redirectUrlString = `${origin}${path10}`;
|
|
15612
15969
|
for (const historyUrl of this.history) {
|
|
15613
15970
|
if (historyUrl.toString() === redirectUrlString) {
|
|
15614
15971
|
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.`);
|
|
15615
15972
|
}
|
|
15616
15973
|
}
|
|
15617
15974
|
this.opts.headers = cleanRequestHeaders(this.opts.headers, removeContentHeaders, this.opts.origin !== origin, this.stripHeadersOnRedirect, this.stripHeadersOnCrossOriginRedirect);
|
|
15618
|
-
this.opts.path =
|
|
15975
|
+
this.opts.path = path10;
|
|
15619
15976
|
this.opts.origin = origin;
|
|
15620
15977
|
this.opts.query = null;
|
|
15621
15978
|
}
|
|
@@ -16355,24 +16712,146 @@ var require_cache = __commonJS({
|
|
|
16355
16712
|
var {
|
|
16356
16713
|
safeHTTPMethods,
|
|
16357
16714
|
pathHasQueryOrFragment,
|
|
16358
|
-
hasSafeIterator
|
|
16715
|
+
hasSafeIterator,
|
|
16716
|
+
isValidHTTPToken
|
|
16359
16717
|
} = require_util();
|
|
16360
16718
|
var { serializePathWithQuery } = require_util();
|
|
16361
|
-
|
|
16362
|
-
|
|
16363
|
-
|
|
16719
|
+
var MAX_DELTA_SECONDS = 2147483647;
|
|
16720
|
+
var RESTRICTIVE_DIRECTIVE_NAMES = ["no-store", "private", "no-cache"];
|
|
16721
|
+
var kInvalidCacheControlDirectives = /* @__PURE__ */ Symbol("invalid cache-control directives");
|
|
16722
|
+
function trimOWS(value) {
|
|
16723
|
+
return value.replace(/^[\t ]+|[\t ]+$/g, "");
|
|
16724
|
+
}
|
|
16725
|
+
function arrayIncludes(array, value) {
|
|
16726
|
+
for (let i = 0; i < array.length; i++) {
|
|
16727
|
+
if (array[i] === value) {
|
|
16728
|
+
return true;
|
|
16729
|
+
}
|
|
16730
|
+
}
|
|
16731
|
+
return false;
|
|
16732
|
+
}
|
|
16733
|
+
function trimOWSStart(value) {
|
|
16734
|
+
return value.replace(/^[\t ]+/, "");
|
|
16735
|
+
}
|
|
16736
|
+
function trimOWSEnd(value) {
|
|
16737
|
+
return value.replace(/[\t ]+$/, "");
|
|
16738
|
+
}
|
|
16739
|
+
function findUnescapedQuote(value, start) {
|
|
16740
|
+
let escaped = false;
|
|
16741
|
+
for (let i = start; i < value.length; i++) {
|
|
16742
|
+
if (escaped) {
|
|
16743
|
+
escaped = false;
|
|
16744
|
+
} else if (value[i] === "\\") {
|
|
16745
|
+
escaped = true;
|
|
16746
|
+
} else if (value[i] === '"') {
|
|
16747
|
+
return i;
|
|
16748
|
+
}
|
|
16364
16749
|
}
|
|
16750
|
+
return -1;
|
|
16751
|
+
}
|
|
16752
|
+
function splitCacheControlHeaderValue(value) {
|
|
16753
|
+
const directives = [];
|
|
16754
|
+
let start = 0;
|
|
16755
|
+
let quoteStart = -1;
|
|
16756
|
+
let inQuote = false;
|
|
16757
|
+
let escaped = false;
|
|
16758
|
+
for (let i = 0; i < value.length; i++) {
|
|
16759
|
+
if (inQuote) {
|
|
16760
|
+
if (escaped) {
|
|
16761
|
+
escaped = false;
|
|
16762
|
+
} else if (value[i] === "\\") {
|
|
16763
|
+
escaped = true;
|
|
16764
|
+
} else if (value[i] === '"') {
|
|
16765
|
+
inQuote = false;
|
|
16766
|
+
quoteStart = -1;
|
|
16767
|
+
}
|
|
16768
|
+
} else if (value[i] === '"') {
|
|
16769
|
+
inQuote = true;
|
|
16770
|
+
quoteStart = i;
|
|
16771
|
+
} else if (value[i] === ",") {
|
|
16772
|
+
directives.push({ value: value.substring(start, i), fromMalformedQuote: false });
|
|
16773
|
+
start = i + 1;
|
|
16774
|
+
}
|
|
16775
|
+
}
|
|
16776
|
+
if (!inQuote) {
|
|
16777
|
+
directives.push({ value: value.substring(start), fromMalformedQuote: false });
|
|
16778
|
+
return directives;
|
|
16779
|
+
}
|
|
16780
|
+
const tail = value.substring(start);
|
|
16781
|
+
const quoteOffset = quoteStart - start;
|
|
16782
|
+
let tailStart = 0;
|
|
16783
|
+
for (let i = 0; i < tail.length; i++) {
|
|
16784
|
+
if (tail[i] === ",") {
|
|
16785
|
+
directives.push({
|
|
16786
|
+
value: tail.substring(tailStart, i),
|
|
16787
|
+
fromMalformedQuote: tailStart > quoteOffset
|
|
16788
|
+
});
|
|
16789
|
+
tailStart = i + 1;
|
|
16790
|
+
}
|
|
16791
|
+
}
|
|
16792
|
+
directives.push({
|
|
16793
|
+
value: tail.substring(tailStart),
|
|
16794
|
+
fromMalformedQuote: tailStart > quoteOffset
|
|
16795
|
+
});
|
|
16796
|
+
return directives;
|
|
16797
|
+
}
|
|
16798
|
+
function markInvalidCacheControlDirective(directives, key) {
|
|
16799
|
+
let invalidDirectives = directives[kInvalidCacheControlDirectives];
|
|
16800
|
+
if (invalidDirectives === void 0) {
|
|
16801
|
+
invalidDirectives = /* @__PURE__ */ new Set();
|
|
16802
|
+
Object.defineProperty(directives, kInvalidCacheControlDirectives, {
|
|
16803
|
+
value: invalidDirectives
|
|
16804
|
+
});
|
|
16805
|
+
}
|
|
16806
|
+
invalidDirectives.add(key);
|
|
16807
|
+
}
|
|
16808
|
+
function hasInvalidCacheControlDirective(directives, key) {
|
|
16809
|
+
return directives[kInvalidCacheControlDirectives]?.has(key) === true;
|
|
16810
|
+
}
|
|
16811
|
+
function getMalformedRestrictiveDirectiveName(key) {
|
|
16812
|
+
for (const directiveName of RESTRICTIVE_DIRECTIVE_NAMES) {
|
|
16813
|
+
if (key.startsWith(directiveName) && key.length > directiveName.length && !isValidHTTPToken(key[directiveName.length])) {
|
|
16814
|
+
return directiveName;
|
|
16815
|
+
}
|
|
16816
|
+
}
|
|
16817
|
+
let tokenOnlyKey = "";
|
|
16818
|
+
let hasInvalidTokenChar = false;
|
|
16819
|
+
for (let i = 0; i < key.length; i++) {
|
|
16820
|
+
if (isValidHTTPToken(key[i])) {
|
|
16821
|
+
tokenOnlyKey += key[i];
|
|
16822
|
+
} else {
|
|
16823
|
+
hasInvalidTokenChar = true;
|
|
16824
|
+
}
|
|
16825
|
+
}
|
|
16826
|
+
if (hasInvalidTokenChar && arrayIncludes(RESTRICTIVE_DIRECTIVE_NAMES, tokenOnlyKey)) {
|
|
16827
|
+
return tokenOnlyKey;
|
|
16828
|
+
}
|
|
16829
|
+
}
|
|
16830
|
+
function makeCacheKey(opts) {
|
|
16831
|
+
const origin = opts.origin ? opts.origin.toString() : "";
|
|
16365
16832
|
let fullPath = opts.path || "/";
|
|
16366
16833
|
if (opts.query && !pathHasQueryOrFragment(fullPath)) {
|
|
16367
16834
|
fullPath = serializePathWithQuery(fullPath, opts.query);
|
|
16368
16835
|
}
|
|
16369
16836
|
return {
|
|
16370
|
-
origin
|
|
16837
|
+
origin,
|
|
16371
16838
|
method: opts.method,
|
|
16372
16839
|
path: fullPath,
|
|
16373
16840
|
headers: opts.headers
|
|
16374
16841
|
};
|
|
16375
16842
|
}
|
|
16843
|
+
function appendHeader(headers, key, val) {
|
|
16844
|
+
const headerName = key.toLowerCase();
|
|
16845
|
+
const current = headers[headerName];
|
|
16846
|
+
const values = Array.isArray(val) ? val : [val];
|
|
16847
|
+
if (current === void 0) {
|
|
16848
|
+
headers[headerName] = Array.isArray(val) ? val.slice() : val;
|
|
16849
|
+
} else if (Array.isArray(current)) {
|
|
16850
|
+
current.push(...values);
|
|
16851
|
+
} else {
|
|
16852
|
+
headers[headerName] = [current, ...values];
|
|
16853
|
+
}
|
|
16854
|
+
}
|
|
16376
16855
|
function normalizeHeaders(opts) {
|
|
16377
16856
|
let headers;
|
|
16378
16857
|
if (opts.headers == null) {
|
|
@@ -16391,7 +16870,7 @@ var require_cache = __commonJS({
|
|
|
16391
16870
|
if (typeof key !== "string" || typeof val !== "string") {
|
|
16392
16871
|
throw new Error("opts.headers is not a valid header map");
|
|
16393
16872
|
}
|
|
16394
|
-
headers
|
|
16873
|
+
appendHeader(headers, key, val);
|
|
16395
16874
|
}
|
|
16396
16875
|
} else {
|
|
16397
16876
|
const len = opts.headers.length;
|
|
@@ -16405,14 +16884,14 @@ var require_cache = __commonJS({
|
|
|
16405
16884
|
throw new Error("opts.headers is not a valid header map");
|
|
16406
16885
|
}
|
|
16407
16886
|
if (typeof val === "string") {
|
|
16408
|
-
headers
|
|
16887
|
+
appendHeader(headers, key, val);
|
|
16409
16888
|
} else {
|
|
16410
16889
|
const mapped = [];
|
|
16411
16890
|
for (let j = 0; j < val.length; j++) {
|
|
16412
16891
|
const v = val[j];
|
|
16413
16892
|
mapped.push(typeof v === "string" ? v : v.toString("latin1"));
|
|
16414
16893
|
}
|
|
16415
|
-
headers
|
|
16894
|
+
appendHeader(headers, key, mapped);
|
|
16416
16895
|
}
|
|
16417
16896
|
}
|
|
16418
16897
|
}
|
|
@@ -16425,12 +16904,12 @@ var require_cache = __commonJS({
|
|
|
16425
16904
|
if (typeof key !== "string" || typeof val !== "string") {
|
|
16426
16905
|
throw new Error("opts.headers is not a valid header map");
|
|
16427
16906
|
}
|
|
16428
|
-
headers
|
|
16907
|
+
appendHeader(headers, key, val);
|
|
16429
16908
|
}
|
|
16430
16909
|
}
|
|
16431
16910
|
} else {
|
|
16432
16911
|
for (const key of Object.keys(opts.headers)) {
|
|
16433
|
-
headers
|
|
16912
|
+
appendHeader(headers, key, opts.headers[key]);
|
|
16434
16913
|
}
|
|
16435
16914
|
}
|
|
16436
16915
|
} else {
|
|
@@ -16475,25 +16954,32 @@ var require_cache = __commonJS({
|
|
|
16475
16954
|
}
|
|
16476
16955
|
function parseCacheControlHeader(header) {
|
|
16477
16956
|
const output = {};
|
|
16478
|
-
|
|
16479
|
-
|
|
16480
|
-
|
|
16481
|
-
for (const directive of header) {
|
|
16482
|
-
directives.push(...directive.split(","));
|
|
16483
|
-
}
|
|
16484
|
-
} else {
|
|
16485
|
-
directives = header.split(",");
|
|
16486
|
-
}
|
|
16957
|
+
const invalidNumericDirectives = /* @__PURE__ */ new Set();
|
|
16958
|
+
const invalidNoArgumentDirectives = /* @__PURE__ */ new Set();
|
|
16959
|
+
const directives = splitCacheControlHeaderValue(Array.isArray(header) ? header.join(",") : header);
|
|
16487
16960
|
for (let i = 0; i < directives.length; i++) {
|
|
16488
|
-
const
|
|
16961
|
+
const directiveRecord = directives[i];
|
|
16962
|
+
const directive = directiveRecord.value.toLowerCase();
|
|
16963
|
+
const fromMalformedQuote = directiveRecord.fromMalformedQuote;
|
|
16489
16964
|
const keyValueDelimiter = directive.indexOf("=");
|
|
16490
16965
|
let key;
|
|
16491
16966
|
let value;
|
|
16967
|
+
let keyHasTrailingWhitespace = false;
|
|
16968
|
+
let valueHasLeadingWhitespace = false;
|
|
16492
16969
|
if (keyValueDelimiter !== -1) {
|
|
16493
|
-
|
|
16494
|
-
|
|
16970
|
+
const rawKey = directive.substring(0, keyValueDelimiter);
|
|
16971
|
+
const rawValue = directive.substring(keyValueDelimiter + 1);
|
|
16972
|
+
keyHasTrailingWhitespace = trimOWSEnd(rawKey) !== rawKey;
|
|
16973
|
+
valueHasLeadingWhitespace = trimOWSStart(rawValue) !== rawValue;
|
|
16974
|
+
key = trimOWS(rawKey);
|
|
16975
|
+
value = trimOWSStart(rawValue);
|
|
16495
16976
|
} else {
|
|
16496
|
-
key = directive
|
|
16977
|
+
key = trimOWS(directive);
|
|
16978
|
+
}
|
|
16979
|
+
const malformedRestrictiveDirectiveName = getMalformedRestrictiveDirectiveName(key);
|
|
16980
|
+
if (malformedRestrictiveDirectiveName !== void 0) {
|
|
16981
|
+
output[malformedRestrictiveDirectiveName] = true;
|
|
16982
|
+
continue;
|
|
16497
16983
|
}
|
|
16498
16984
|
switch (key) {
|
|
16499
16985
|
case "min-fresh":
|
|
@@ -16502,48 +16988,85 @@ var require_cache = __commonJS({
|
|
|
16502
16988
|
case "s-maxage":
|
|
16503
16989
|
case "stale-while-revalidate":
|
|
16504
16990
|
case "stale-if-error": {
|
|
16505
|
-
if (
|
|
16991
|
+
if (fromMalformedQuote || invalidNumericDirectives.has(key)) {
|
|
16992
|
+
continue;
|
|
16993
|
+
}
|
|
16994
|
+
if (value === void 0 || keyHasTrailingWhitespace || valueHasLeadingWhitespace) {
|
|
16995
|
+
delete output[key];
|
|
16996
|
+
invalidNumericDirectives.add(key);
|
|
16997
|
+
markInvalidCacheControlDirective(output, key);
|
|
16506
16998
|
continue;
|
|
16507
16999
|
}
|
|
16508
17000
|
if (value.length >= 2 && value[0] === '"' && value[value.length - 1] === '"') {
|
|
16509
17001
|
value = value.substring(1, value.length - 1);
|
|
16510
17002
|
}
|
|
16511
|
-
|
|
16512
|
-
|
|
17003
|
+
if (!/^[0-9]+$/.test(value)) {
|
|
17004
|
+
delete output[key];
|
|
17005
|
+
invalidNumericDirectives.add(key);
|
|
17006
|
+
markInvalidCacheControlDirective(output, key);
|
|
16513
17007
|
continue;
|
|
16514
17008
|
}
|
|
16515
|
-
|
|
16516
|
-
|
|
17009
|
+
const parsedValue = Math.min(parseInt(value, 10), MAX_DELTA_SECONDS);
|
|
17010
|
+
if (key === "min-fresh") {
|
|
17011
|
+
if (!(key in output) || output[key] < parsedValue) {
|
|
17012
|
+
output[key] = parsedValue;
|
|
17013
|
+
}
|
|
17014
|
+
} else if (!(key in output) || output[key] > parsedValue) {
|
|
17015
|
+
output[key] = parsedValue;
|
|
16517
17016
|
}
|
|
16518
|
-
output[key] = parsedValue;
|
|
16519
17017
|
break;
|
|
16520
17018
|
}
|
|
16521
17019
|
case "private":
|
|
16522
17020
|
case "no-cache": {
|
|
17021
|
+
if (fromMalformedQuote) {
|
|
17022
|
+
output[key] = true;
|
|
17023
|
+
break;
|
|
17024
|
+
}
|
|
17025
|
+
if (value !== void 0 && value.length === 0) {
|
|
17026
|
+
output[key] = true;
|
|
17027
|
+
break;
|
|
17028
|
+
}
|
|
16523
17029
|
if (value) {
|
|
16524
17030
|
if (value[0] === '"') {
|
|
16525
|
-
|
|
16526
|
-
let
|
|
16527
|
-
|
|
17031
|
+
value = trimOWSEnd(value);
|
|
17032
|
+
let fieldList = "";
|
|
17033
|
+
let lastQuotedPart = i;
|
|
17034
|
+
let foundEndingQuote = false;
|
|
17035
|
+
const closingQuote = findUnescapedQuote(value, 1);
|
|
17036
|
+
if (closingQuote !== -1) {
|
|
17037
|
+
fieldList = value.substring(1, closingQuote);
|
|
17038
|
+
foundEndingQuote = true;
|
|
17039
|
+
} else {
|
|
17040
|
+
const fieldListParts = [value.substring(1)];
|
|
16528
17041
|
for (let j = i + 1; j < directives.length; j++) {
|
|
16529
|
-
const nextPart = directives[j];
|
|
16530
|
-
const
|
|
16531
|
-
|
|
16532
|
-
if (
|
|
17042
|
+
const nextPart = trimOWS(directives[j].value);
|
|
17043
|
+
const closingQuote2 = findUnescapedQuote(nextPart, 0);
|
|
17044
|
+
lastQuotedPart = j;
|
|
17045
|
+
if (closingQuote2 !== -1) {
|
|
17046
|
+
fieldListParts.push(nextPart.substring(0, closingQuote2));
|
|
16533
17047
|
foundEndingQuote = true;
|
|
16534
17048
|
break;
|
|
16535
17049
|
}
|
|
17050
|
+
fieldListParts.push(nextPart);
|
|
16536
17051
|
}
|
|
17052
|
+
fieldList = fieldListParts.join(",");
|
|
16537
17053
|
}
|
|
16538
|
-
if (foundEndingQuote) {
|
|
16539
|
-
|
|
16540
|
-
|
|
16541
|
-
|
|
16542
|
-
|
|
16543
|
-
|
|
16544
|
-
|
|
16545
|
-
|
|
17054
|
+
if (!foundEndingQuote) {
|
|
17055
|
+
output[key] = true;
|
|
17056
|
+
break;
|
|
17057
|
+
}
|
|
17058
|
+
i = lastQuotedPart;
|
|
17059
|
+
const headers = fieldList.split(",");
|
|
17060
|
+
let validFieldNames = true;
|
|
17061
|
+
for (let j = 0; j < headers.length; j++) {
|
|
17062
|
+
headers[j] = trimOWS(headers[j]);
|
|
17063
|
+
if (!isValidHTTPToken(headers[j])) {
|
|
17064
|
+
validFieldNames = false;
|
|
16546
17065
|
}
|
|
17066
|
+
}
|
|
17067
|
+
if (!validFieldNames) {
|
|
17068
|
+
output[key] = true;
|
|
17069
|
+
} else if (output[key] !== true) {
|
|
16547
17070
|
if (key in output) {
|
|
16548
17071
|
output[key] = output[key].concat(headers);
|
|
16549
17072
|
} else {
|
|
@@ -16551,11 +17074,15 @@ var require_cache = __commonJS({
|
|
|
16551
17074
|
}
|
|
16552
17075
|
}
|
|
16553
17076
|
} else {
|
|
16554
|
-
const fieldName = value
|
|
16555
|
-
if (
|
|
16556
|
-
output[key] =
|
|
16557
|
-
} else {
|
|
16558
|
-
|
|
17077
|
+
const fieldName = trimOWS(value);
|
|
17078
|
+
if (!isValidHTTPToken(fieldName)) {
|
|
17079
|
+
output[key] = true;
|
|
17080
|
+
} else if (output[key] !== true) {
|
|
17081
|
+
if (key in output) {
|
|
17082
|
+
output[key] = output[key].concat(fieldName);
|
|
17083
|
+
} else {
|
|
17084
|
+
output[key] = [fieldName];
|
|
17085
|
+
}
|
|
16559
17086
|
}
|
|
16560
17087
|
}
|
|
16561
17088
|
break;
|
|
@@ -16563,39 +17090,76 @@ var require_cache = __commonJS({
|
|
|
16563
17090
|
}
|
|
16564
17091
|
// eslint-disable-next-line no-fallthrough
|
|
16565
17092
|
case "public":
|
|
16566
|
-
case "no-store":
|
|
16567
17093
|
case "must-revalidate":
|
|
16568
17094
|
case "proxy-revalidate":
|
|
16569
17095
|
case "immutable":
|
|
16570
17096
|
case "no-transform":
|
|
16571
17097
|
case "must-understand":
|
|
16572
17098
|
case "only-if-cached":
|
|
16573
|
-
if (
|
|
17099
|
+
if (fromMalformedQuote || invalidNoArgumentDirectives.has(key)) {
|
|
17100
|
+
continue;
|
|
17101
|
+
}
|
|
17102
|
+
if (value !== void 0) {
|
|
17103
|
+
delete output[key];
|
|
17104
|
+
invalidNoArgumentDirectives.add(key);
|
|
16574
17105
|
continue;
|
|
16575
17106
|
}
|
|
16576
17107
|
output[key] = true;
|
|
16577
17108
|
break;
|
|
17109
|
+
case "no-store":
|
|
17110
|
+
output[key] = true;
|
|
17111
|
+
break;
|
|
16578
17112
|
default:
|
|
16579
17113
|
continue;
|
|
16580
17114
|
}
|
|
16581
17115
|
}
|
|
16582
17116
|
return output;
|
|
16583
17117
|
}
|
|
17118
|
+
function splitVaryHeader(varyHeader) {
|
|
17119
|
+
const values = Array.isArray(varyHeader) ? varyHeader : [varyHeader];
|
|
17120
|
+
const output = [];
|
|
17121
|
+
for (let i = 0; i < values.length; i++) {
|
|
17122
|
+
const parts = values[i].split(",");
|
|
17123
|
+
for (let j = 0; j < parts.length; j++) {
|
|
17124
|
+
output.push(parts[j]);
|
|
17125
|
+
}
|
|
17126
|
+
}
|
|
17127
|
+
return output;
|
|
17128
|
+
}
|
|
17129
|
+
function hasVaryStar(varyHeader) {
|
|
17130
|
+
const values = splitVaryHeader(varyHeader);
|
|
17131
|
+
for (let i = 0; i < values.length; i++) {
|
|
17132
|
+
if (trimOWS(values[i]).indexOf("*") !== -1) {
|
|
17133
|
+
return true;
|
|
17134
|
+
}
|
|
17135
|
+
}
|
|
17136
|
+
return false;
|
|
17137
|
+
}
|
|
16584
17138
|
function parseVaryHeader(varyHeader, headers) {
|
|
16585
|
-
if (
|
|
17139
|
+
if (hasVaryStar(varyHeader)) {
|
|
16586
17140
|
return headers;
|
|
16587
17141
|
}
|
|
16588
17142
|
const output = (
|
|
16589
17143
|
/** @type {Record<string, string | string[] | null>} */
|
|
16590
17144
|
{}
|
|
16591
17145
|
);
|
|
16592
|
-
const varyingHeaders =
|
|
17146
|
+
const varyingHeaders = splitVaryHeader(varyHeader);
|
|
16593
17147
|
for (const header of varyingHeaders) {
|
|
16594
|
-
const trimmedHeader = header
|
|
16595
|
-
|
|
17148
|
+
const trimmedHeader = trimOWS(header).toLowerCase();
|
|
17149
|
+
if (trimmedHeader.length === 0) {
|
|
17150
|
+
continue;
|
|
17151
|
+
}
|
|
17152
|
+
if (!isValidHTTPToken(trimmedHeader)) {
|
|
17153
|
+
return void 0;
|
|
17154
|
+
}
|
|
17155
|
+
const headerValue = headers[trimmedHeader];
|
|
17156
|
+
output[trimmedHeader] = Array.isArray(headerValue) ? headerValue.slice() : headerValue ?? null;
|
|
16596
17157
|
}
|
|
16597
17158
|
return output;
|
|
16598
17159
|
}
|
|
17160
|
+
function isInvalidOrWildcardVaryHeader(varyHeader) {
|
|
17161
|
+
return hasVaryStar(varyHeader) || parseVaryHeader(varyHeader, {}) === void 0;
|
|
17162
|
+
}
|
|
16599
17163
|
function isEtagUsable(etag) {
|
|
16600
17164
|
if (etag.length <= 2) {
|
|
16601
17165
|
return false;
|
|
@@ -16626,7 +17190,7 @@ var require_cache = __commonJS({
|
|
|
16626
17190
|
throw new TypeError(`${name} needs to have at least one method`);
|
|
16627
17191
|
}
|
|
16628
17192
|
for (const method of methods) {
|
|
16629
|
-
if (!safeHTTPMethods
|
|
17193
|
+
if (!arrayIncludes(safeHTTPMethods, method)) {
|
|
16630
17194
|
throw new TypeError(`element of ${name}-array needs to be one of following values: ${safeHTTPMethods.join(", ")}, got ${method}`);
|
|
16631
17195
|
}
|
|
16632
17196
|
}
|
|
@@ -16650,7 +17214,10 @@ var require_cache = __commonJS({
|
|
|
16650
17214
|
assertCacheKey,
|
|
16651
17215
|
assertCacheValue,
|
|
16652
17216
|
parseCacheControlHeader,
|
|
17217
|
+
hasInvalidCacheControlDirective,
|
|
16653
17218
|
parseVaryHeader,
|
|
17219
|
+
hasVaryStar,
|
|
17220
|
+
isInvalidOrWildcardVaryHeader,
|
|
16654
17221
|
isEtagUsable,
|
|
16655
17222
|
assertCacheMethods,
|
|
16656
17223
|
assertCacheStore,
|
|
@@ -16673,6 +17240,13 @@ var require_date = __commonJS({
|
|
|
16673
17240
|
return parseRfc850Date(date);
|
|
16674
17241
|
}
|
|
16675
17242
|
}
|
|
17243
|
+
function makeDate(year, monthIdx, day, hour, minute, second, weekday) {
|
|
17244
|
+
const result = new Date(Date.UTC(year, monthIdx, day, hour, minute, second));
|
|
17245
|
+
if (year >= 0 && year <= 99) {
|
|
17246
|
+
result.setUTCFullYear(year);
|
|
17247
|
+
}
|
|
17248
|
+
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;
|
|
17249
|
+
}
|
|
16676
17250
|
function parseImfDate(date) {
|
|
16677
17251
|
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") {
|
|
16678
17252
|
return void 0;
|
|
@@ -16833,8 +17407,7 @@ var require_date = __commonJS({
|
|
|
16833
17407
|
}
|
|
16834
17408
|
second = (code1 - 48) * 10 + (code2 - 48);
|
|
16835
17409
|
}
|
|
16836
|
-
|
|
16837
|
-
return result.getUTCDay() === weekday ? result : void 0;
|
|
17410
|
+
return makeDate(year, monthIdx, day, hour, minute, second, weekday);
|
|
16838
17411
|
}
|
|
16839
17412
|
function parseAscTimeDate(date) {
|
|
16840
17413
|
if (date.length !== 24 || date[7] !== " " || date[10] !== " " || date[19] !== " ") {
|
|
@@ -16996,8 +17569,7 @@ var require_date = __commonJS({
|
|
|
16996
17569
|
return void 0;
|
|
16997
17570
|
}
|
|
16998
17571
|
const year = (yearDigit1 - 48) * 1e3 + (yearDigit2 - 48) * 100 + (yearDigit3 - 48) * 10 + (yearDigit4 - 48);
|
|
16999
|
-
|
|
17000
|
-
return result.getUTCDay() === weekday ? result : void 0;
|
|
17572
|
+
return makeDate(year, monthIdx, day, hour, minute, second, weekday);
|
|
17001
17573
|
}
|
|
17002
17574
|
function parseRfc850Date(date) {
|
|
17003
17575
|
let commaIndex = -1;
|
|
@@ -17146,8 +17718,7 @@ var require_date = __commonJS({
|
|
|
17146
17718
|
}
|
|
17147
17719
|
second = (code1 - 48) * 10 + (code2 - 48);
|
|
17148
17720
|
}
|
|
17149
|
-
|
|
17150
|
-
return result.getUTCDay() === weekday ? result : void 0;
|
|
17721
|
+
return makeDate(year, monthIdx, day, hour, minute, second, weekday);
|
|
17151
17722
|
}
|
|
17152
17723
|
module2.exports = {
|
|
17153
17724
|
parseHttpDate
|
|
@@ -17162,7 +17733,10 @@ var require_cache_handler = __commonJS({
|
|
|
17162
17733
|
var util = require_util();
|
|
17163
17734
|
var {
|
|
17164
17735
|
parseCacheControlHeader,
|
|
17736
|
+
hasInvalidCacheControlDirective,
|
|
17165
17737
|
parseVaryHeader,
|
|
17738
|
+
hasVaryStar,
|
|
17739
|
+
isInvalidOrWildcardVaryHeader,
|
|
17166
17740
|
isEtagUsable
|
|
17167
17741
|
} = require_cache();
|
|
17168
17742
|
var { parseHttpDate } = require_date();
|
|
@@ -17187,6 +17761,78 @@ var require_cache_handler = __commonJS({
|
|
|
17187
17761
|
];
|
|
17188
17762
|
var MAX_RESPONSE_AGE = 2147483647e3;
|
|
17189
17763
|
var REVALIDATION_ONLY_RETENTION = 864e5;
|
|
17764
|
+
function trimOWS(value) {
|
|
17765
|
+
return value.replace(/^[\t ]+|[\t ]+$/g, "");
|
|
17766
|
+
}
|
|
17767
|
+
function arrayIncludes(array, value) {
|
|
17768
|
+
for (let i = 0; i < array.length; i++) {
|
|
17769
|
+
if (array[i] === value) {
|
|
17770
|
+
return true;
|
|
17771
|
+
}
|
|
17772
|
+
}
|
|
17773
|
+
return false;
|
|
17774
|
+
}
|
|
17775
|
+
function appendConnectionHeaderTokens(headersToRemove, connectionHeader) {
|
|
17776
|
+
const values = Array.isArray(connectionHeader) ? connectionHeader : [connectionHeader];
|
|
17777
|
+
for (let i = 0; i < values.length; i++) {
|
|
17778
|
+
const tokens = values[i].split(",");
|
|
17779
|
+
for (let j = 0; j < tokens.length; j++) {
|
|
17780
|
+
headersToRemove.push(trimOWS(tokens[j]).toLowerCase());
|
|
17781
|
+
}
|
|
17782
|
+
}
|
|
17783
|
+
}
|
|
17784
|
+
function getSameOriginPath(cacheKey, location) {
|
|
17785
|
+
if (typeof location !== "string") {
|
|
17786
|
+
return void 0;
|
|
17787
|
+
}
|
|
17788
|
+
let originUrl;
|
|
17789
|
+
let requestUrl;
|
|
17790
|
+
let locationUrl;
|
|
17791
|
+
try {
|
|
17792
|
+
originUrl = new URL(cacheKey.origin);
|
|
17793
|
+
requestUrl = new URL(cacheKey.path, originUrl);
|
|
17794
|
+
locationUrl = new URL(location, requestUrl);
|
|
17795
|
+
} catch {
|
|
17796
|
+
return void 0;
|
|
17797
|
+
}
|
|
17798
|
+
if (locationUrl.origin !== originUrl.origin) {
|
|
17799
|
+
return void 0;
|
|
17800
|
+
}
|
|
17801
|
+
return locationUrl.pathname + locationUrl.search;
|
|
17802
|
+
}
|
|
17803
|
+
function deleteCachedUri(store, cacheKey, path10) {
|
|
17804
|
+
deleteCachedValue(store, {
|
|
17805
|
+
...cacheKey,
|
|
17806
|
+
path: path10
|
|
17807
|
+
});
|
|
17808
|
+
for (let i = 0; i < util.safeHTTPMethods.length; i++) {
|
|
17809
|
+
const method = util.safeHTTPMethods[i];
|
|
17810
|
+
if (method !== cacheKey.method) {
|
|
17811
|
+
deleteCachedValue(store, {
|
|
17812
|
+
...cacheKey,
|
|
17813
|
+
method,
|
|
17814
|
+
path: path10
|
|
17815
|
+
});
|
|
17816
|
+
}
|
|
17817
|
+
}
|
|
17818
|
+
}
|
|
17819
|
+
function deleteLocationTargets(store, cacheKey, headerValue) {
|
|
17820
|
+
if (headerValue === void 0) {
|
|
17821
|
+
return;
|
|
17822
|
+
}
|
|
17823
|
+
const values = Array.isArray(headerValue) ? headerValue : [headerValue];
|
|
17824
|
+
for (let i = 0; i < values.length; i++) {
|
|
17825
|
+
const path10 = getSameOriginPath(cacheKey, values[i]);
|
|
17826
|
+
if (path10 !== void 0) {
|
|
17827
|
+
deleteCachedUri(store, cacheKey, path10);
|
|
17828
|
+
}
|
|
17829
|
+
}
|
|
17830
|
+
}
|
|
17831
|
+
function invalidateUnsafeRequest(store, cacheKey, resHeaders) {
|
|
17832
|
+
deleteCachedUri(store, cacheKey, cacheKey.path);
|
|
17833
|
+
deleteLocationTargets(store, cacheKey, resHeaders.location);
|
|
17834
|
+
deleteLocationTargets(store, cacheKey, resHeaders["content-location"]);
|
|
17835
|
+
}
|
|
17190
17836
|
var CacheHandler = class {
|
|
17191
17837
|
/**
|
|
17192
17838
|
* @type {import('../../types/cache-interceptor.d.ts').default.CacheKey}
|
|
@@ -17246,38 +17892,51 @@ var require_cache_handler = __commonJS({
|
|
|
17246
17892
|
statusMessage
|
|
17247
17893
|
);
|
|
17248
17894
|
const handler = this;
|
|
17249
|
-
if (!util.safeHTTPMethods
|
|
17250
|
-
|
|
17251
|
-
this.#store.delete(this.#cacheKey)?.catch?.(noop);
|
|
17252
|
-
} catch {
|
|
17253
|
-
}
|
|
17254
|
-
this.#deleteLocationHeaderEntries(resHeaders);
|
|
17895
|
+
if (!arrayIncludes(util.safeHTTPMethods, this.#cacheKey.method) && statusCode >= 200 && statusCode <= 399) {
|
|
17896
|
+
invalidateUnsafeRequest(this.#store, this.#cacheKey, resHeaders);
|
|
17255
17897
|
return downstreamOnHeaders();
|
|
17256
17898
|
}
|
|
17257
17899
|
const cacheControlHeader = resHeaders["cache-control"];
|
|
17258
|
-
const heuristicallyCacheable = resHeaders["last-modified"] && HEURISTICALLY_CACHEABLE_STATUS_CODES
|
|
17900
|
+
const heuristicallyCacheable = resHeaders["last-modified"] && arrayIncludes(HEURISTICALLY_CACHEABLE_STATUS_CODES, statusCode);
|
|
17259
17901
|
if (!cacheControlHeader && !resHeaders["expires"] && !heuristicallyCacheable && !this.#cacheByDefault) {
|
|
17902
|
+
if (statusCode === 304 && resHeaders.vary && isInvalidOrWildcardVaryHeader(resHeaders.vary)) {
|
|
17903
|
+
deleteCachedValue(this.#store, this.#cacheKey);
|
|
17904
|
+
}
|
|
17260
17905
|
return downstreamOnHeaders();
|
|
17261
17906
|
}
|
|
17262
17907
|
const cacheControlDirectives = cacheControlHeader ? parseCacheControlHeader(cacheControlHeader) : {};
|
|
17263
17908
|
if (!canCacheResponse(this.#cacheType, statusCode, resHeaders, cacheControlDirectives, this.#cacheKey.headers)) {
|
|
17909
|
+
if (statusCode === 304 && (cacheControlHeader || revalidationResponseDisallowsCachedReuse(this.#cacheType, resHeaders, cacheControlDirectives))) {
|
|
17910
|
+
deleteCachedValue(this.#store, this.#cacheKey);
|
|
17911
|
+
}
|
|
17264
17912
|
return downstreamOnHeaders();
|
|
17265
17913
|
}
|
|
17266
17914
|
const now = Date.now();
|
|
17267
|
-
const resAge = resHeaders
|
|
17268
|
-
if (resAge && resAge >= MAX_RESPONSE_AGE) {
|
|
17915
|
+
const resAge = Object.hasOwn(resHeaders, "age") ? getAge(resHeaders.age) : void 0;
|
|
17916
|
+
if (resAge !== void 0 && resAge >= MAX_RESPONSE_AGE) {
|
|
17917
|
+
deleteCachedValueIfNotModified(statusCode, this.#store, this.#cacheKey);
|
|
17918
|
+
return downstreamOnHeaders();
|
|
17919
|
+
}
|
|
17920
|
+
const resDate = Object.hasOwn(resHeaders, "date") ? getDate(resHeaders.date) : void 0;
|
|
17921
|
+
if (resDate === null) {
|
|
17922
|
+
deleteCachedValueIfNotModified(statusCode, this.#store, this.#cacheKey);
|
|
17269
17923
|
return downstreamOnHeaders();
|
|
17270
17924
|
}
|
|
17271
|
-
const
|
|
17925
|
+
const apparentAge = resDate ? Math.max(0, now - resDate.getTime()) : 0;
|
|
17926
|
+
const currentAge = Math.max(apparentAge, resAge ?? 0);
|
|
17272
17927
|
const hasValidator = typeof resHeaders.etag === "string" && isEtagUsable(resHeaders.etag) || typeof resHeaders["last-modified"] === "string";
|
|
17273
17928
|
const staleAt = determineStaleAt(this.#cacheType, now, resAge, resHeaders, resDate, cacheControlDirectives, hasValidator) ?? this.#cacheByDefault;
|
|
17274
|
-
|
|
17929
|
+
const revalidationOnly = staleAt === 0 && hasValidator;
|
|
17930
|
+
if (staleAt === void 0 || currentAge >= staleAt && !revalidationOnly) {
|
|
17931
|
+
if (cacheControlHeader || staleAt !== void 0) {
|
|
17932
|
+
deleteCachedValueIfNotModified(statusCode, this.#store, this.#cacheKey);
|
|
17933
|
+
}
|
|
17275
17934
|
return downstreamOnHeaders();
|
|
17276
17935
|
}
|
|
17277
|
-
const baseTime =
|
|
17936
|
+
const baseTime = now - currentAge;
|
|
17278
17937
|
const absoluteStaleAt = staleAt + baseTime;
|
|
17279
|
-
const revalidationOnly = staleAt === 0 && hasValidator;
|
|
17280
17938
|
if (now >= absoluteStaleAt && !revalidationOnly) {
|
|
17939
|
+
deleteCachedValueIfNotModified(statusCode, this.#store, this.#cacheKey);
|
|
17281
17940
|
return downstreamOnHeaders();
|
|
17282
17941
|
}
|
|
17283
17942
|
let varyDirectives;
|
|
@@ -17287,8 +17946,8 @@ var require_cache_handler = __commonJS({
|
|
|
17287
17946
|
return downstreamOnHeaders();
|
|
17288
17947
|
}
|
|
17289
17948
|
}
|
|
17290
|
-
const cachedAt =
|
|
17291
|
-
const deleteAt = determineDeleteAt(baseTime,
|
|
17949
|
+
const cachedAt = baseTime;
|
|
17950
|
+
const deleteAt = determineDeleteAt(baseTime, now, cacheControlDirectives, absoluteStaleAt);
|
|
17292
17951
|
const strippedHeaders = stripNecessaryHeaders(resHeaders, cacheControlDirectives);
|
|
17293
17952
|
const value = {
|
|
17294
17953
|
statusCode,
|
|
@@ -17308,6 +17967,7 @@ var require_cache_handler = __commonJS({
|
|
|
17308
17967
|
value.statusCode = cachedValue.statusCode;
|
|
17309
17968
|
value.statusMessage = cachedValue.statusMessage;
|
|
17310
17969
|
value.etag = cachedValue.etag;
|
|
17970
|
+
value.vary = varyDirectives ?? cachedValue.vary;
|
|
17311
17971
|
value.headers = { ...cachedValue.headers, ...strippedHeaders };
|
|
17312
17972
|
downstreamOnHeaders();
|
|
17313
17973
|
this.#writeStream = this.#store.createWriteStream(this.#cacheKey, value);
|
|
@@ -17382,47 +18042,6 @@ var require_cache_handler = __commonJS({
|
|
|
17382
18042
|
downstreamOnHeaders();
|
|
17383
18043
|
}
|
|
17384
18044
|
}
|
|
17385
|
-
/**
|
|
17386
|
-
* Deletes the cache entries for the URIs in the response's Location and
|
|
17387
|
-
* Content-Location headers when they share the request URI's origin
|
|
17388
|
-
* https://www.rfc-editor.org/rfc/rfc9111.html#section-4.4
|
|
17389
|
-
*
|
|
17390
|
-
* @param {import('../../types/header.d.ts').IncomingHttpHeaders} resHeaders
|
|
17391
|
-
*/
|
|
17392
|
-
#deleteLocationHeaderEntries(resHeaders) {
|
|
17393
|
-
let requestUrl;
|
|
17394
|
-
try {
|
|
17395
|
-
requestUrl = new URL(this.#cacheKey.path, this.#cacheKey.origin);
|
|
17396
|
-
} catch {
|
|
17397
|
-
return;
|
|
17398
|
-
}
|
|
17399
|
-
const invalidatedPaths = /* @__PURE__ */ new Set([this.#cacheKey.path]);
|
|
17400
|
-
for (const headerName of ["location", "content-location"]) {
|
|
17401
|
-
const header = resHeaders[headerName];
|
|
17402
|
-
const value = Array.isArray(header) ? header[0] : header;
|
|
17403
|
-
if (typeof value !== "string" || value === "") {
|
|
17404
|
-
continue;
|
|
17405
|
-
}
|
|
17406
|
-
let url;
|
|
17407
|
-
try {
|
|
17408
|
-
url = new URL(value, requestUrl);
|
|
17409
|
-
} catch {
|
|
17410
|
-
continue;
|
|
17411
|
-
}
|
|
17412
|
-
if (url.origin !== requestUrl.origin) {
|
|
17413
|
-
continue;
|
|
17414
|
-
}
|
|
17415
|
-
const path9 = `${url.pathname}${url.search}`;
|
|
17416
|
-
if (invalidatedPaths.has(path9)) {
|
|
17417
|
-
continue;
|
|
17418
|
-
}
|
|
17419
|
-
invalidatedPaths.add(path9);
|
|
17420
|
-
try {
|
|
17421
|
-
this.#store.delete({ ...this.#cacheKey, path: path9 })?.catch?.(noop);
|
|
17422
|
-
} catch {
|
|
17423
|
-
}
|
|
17424
|
-
}
|
|
17425
|
-
}
|
|
17426
18045
|
onResponseData(controller, chunk) {
|
|
17427
18046
|
if (this.#writeStream?.write(chunk) === false) {
|
|
17428
18047
|
controller.pause();
|
|
@@ -17439,11 +18058,25 @@ var require_cache_handler = __commonJS({
|
|
|
17439
18058
|
this.#handler.onResponseError?.(controller, err);
|
|
17440
18059
|
}
|
|
17441
18060
|
};
|
|
18061
|
+
function deleteCachedValue(store, cacheKey) {
|
|
18062
|
+
try {
|
|
18063
|
+
store.delete(cacheKey)?.catch?.(noop);
|
|
18064
|
+
} catch {
|
|
18065
|
+
}
|
|
18066
|
+
}
|
|
18067
|
+
function deleteCachedValueIfNotModified(statusCode, store, cacheKey) {
|
|
18068
|
+
if (statusCode === 304) {
|
|
18069
|
+
deleteCachedValue(store, cacheKey);
|
|
18070
|
+
}
|
|
18071
|
+
}
|
|
18072
|
+
function revalidationResponseDisallowsCachedReuse(cacheType, resHeaders, cacheControlDirectives) {
|
|
18073
|
+
return cacheControlDirectives["no-store"] === true || cacheType === "shared" && cacheControlDirectives.private === true || (resHeaders.vary ? isInvalidOrWildcardVaryHeader(resHeaders.vary) : false);
|
|
18074
|
+
}
|
|
17442
18075
|
function canCacheResponse(cacheType, statusCode, resHeaders, cacheControlDirectives, reqHeaders) {
|
|
17443
|
-
if (statusCode < 200 || NOT_UNDERSTOOD_STATUS_CODES
|
|
18076
|
+
if (statusCode < 200 || arrayIncludes(NOT_UNDERSTOOD_STATUS_CODES, statusCode)) {
|
|
17444
18077
|
return false;
|
|
17445
18078
|
}
|
|
17446
|
-
if (!HEURISTICALLY_CACHEABLE_STATUS_CODES
|
|
18079
|
+
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
|
|
17447
18080
|
!(cacheControlDirectives.private && cacheType === "private") && !(cacheControlDirectives["s-maxage"] !== void 0 && cacheType === "shared")) {
|
|
17448
18081
|
return false;
|
|
17449
18082
|
}
|
|
@@ -17453,66 +18086,104 @@ var require_cache_handler = __commonJS({
|
|
|
17453
18086
|
if (cacheType === "shared" && cacheControlDirectives.private === true) {
|
|
17454
18087
|
return false;
|
|
17455
18088
|
}
|
|
17456
|
-
if (resHeaders.vary
|
|
18089
|
+
if (resHeaders.vary && hasVaryStar(resHeaders.vary)) {
|
|
17457
18090
|
return false;
|
|
17458
18091
|
}
|
|
17459
|
-
if (reqHeaders
|
|
18092
|
+
if (reqHeaders != null && Object.hasOwn(reqHeaders, "authorization")) {
|
|
17460
18093
|
if (!cacheControlDirectives.public && !cacheControlDirectives["s-maxage"] && !cacheControlDirectives["must-revalidate"]) {
|
|
17461
18094
|
return false;
|
|
17462
18095
|
}
|
|
17463
18096
|
if (typeof reqHeaders.authorization !== "string") {
|
|
17464
18097
|
return false;
|
|
17465
18098
|
}
|
|
17466
|
-
if (Array.isArray(cacheControlDirectives["no-cache"]) && cacheControlDirectives["no-cache"]
|
|
18099
|
+
if (Array.isArray(cacheControlDirectives["no-cache"]) && arrayIncludes(cacheControlDirectives["no-cache"], "authorization")) {
|
|
17467
18100
|
return false;
|
|
17468
18101
|
}
|
|
17469
|
-
if (Array.isArray(cacheControlDirectives["private"]) && cacheControlDirectives["private"]
|
|
18102
|
+
if (Array.isArray(cacheControlDirectives["private"]) && arrayIncludes(cacheControlDirectives["private"], "authorization")) {
|
|
17470
18103
|
return false;
|
|
17471
18104
|
}
|
|
17472
18105
|
}
|
|
17473
18106
|
return true;
|
|
17474
18107
|
}
|
|
18108
|
+
function getDate(dateHeader) {
|
|
18109
|
+
let dateValue = dateHeader;
|
|
18110
|
+
if (Array.isArray(dateValue)) {
|
|
18111
|
+
if (dateValue.length !== 1) {
|
|
18112
|
+
return null;
|
|
18113
|
+
}
|
|
18114
|
+
dateValue = dateValue[0];
|
|
18115
|
+
}
|
|
18116
|
+
if (typeof dateValue !== "string") {
|
|
18117
|
+
return null;
|
|
18118
|
+
}
|
|
18119
|
+
return parseHttpDate(dateValue);
|
|
18120
|
+
}
|
|
17475
18121
|
function getAge(ageHeader) {
|
|
17476
|
-
|
|
17477
|
-
|
|
18122
|
+
let ageValue = ageHeader;
|
|
18123
|
+
if (Array.isArray(ageValue)) {
|
|
18124
|
+
if (ageValue.length !== 1) {
|
|
18125
|
+
return MAX_RESPONSE_AGE;
|
|
18126
|
+
}
|
|
18127
|
+
ageValue = ageValue[0];
|
|
18128
|
+
}
|
|
18129
|
+
if (typeof ageValue !== "string" || !/^[\t ]*[0-9]+[\t ]*$/.test(ageValue)) {
|
|
18130
|
+
return MAX_RESPONSE_AGE;
|
|
18131
|
+
}
|
|
18132
|
+
const age = BigInt(ageValue.replace(/^[\t ]+|[\t ]+$/g, ""));
|
|
18133
|
+
if (age >= BigInt(MAX_RESPONSE_AGE / 1e3)) {
|
|
18134
|
+
return MAX_RESPONSE_AGE;
|
|
18135
|
+
}
|
|
18136
|
+
return Number(age) * 1e3;
|
|
17478
18137
|
}
|
|
17479
18138
|
function determineStaleAt(cacheType, now, age, resHeaders, responseDate, cacheControlDirectives, hasValidator) {
|
|
17480
18139
|
if (cacheType === "shared") {
|
|
18140
|
+
if (hasInvalidCacheControlDirective(cacheControlDirectives, "s-maxage")) {
|
|
18141
|
+
return 0;
|
|
18142
|
+
}
|
|
17481
18143
|
const sMaxAge = cacheControlDirectives["s-maxage"];
|
|
17482
18144
|
if (sMaxAge !== void 0) {
|
|
17483
18145
|
if (sMaxAge > 0) {
|
|
17484
18146
|
return sMaxAge * 1e3;
|
|
17485
18147
|
}
|
|
17486
|
-
return
|
|
18148
|
+
return 0;
|
|
17487
18149
|
}
|
|
17488
18150
|
}
|
|
18151
|
+
if (hasInvalidCacheControlDirective(cacheControlDirectives, "max-age")) {
|
|
18152
|
+
return 0;
|
|
18153
|
+
}
|
|
17489
18154
|
const maxAge = cacheControlDirectives["max-age"];
|
|
17490
18155
|
if (maxAge !== void 0) {
|
|
17491
18156
|
if (maxAge > 0) {
|
|
17492
18157
|
return maxAge * 1e3;
|
|
17493
18158
|
}
|
|
17494
|
-
return
|
|
18159
|
+
return 0;
|
|
17495
18160
|
}
|
|
17496
|
-
if (
|
|
18161
|
+
if (Object.hasOwn(resHeaders, "expires")) {
|
|
18162
|
+
if (typeof resHeaders.expires !== "string") {
|
|
18163
|
+
return 0;
|
|
18164
|
+
}
|
|
17497
18165
|
const expiresDate = parseHttpDate(resHeaders.expires);
|
|
17498
|
-
if (expiresDate) {
|
|
17499
|
-
|
|
17500
|
-
|
|
18166
|
+
if (!expiresDate) {
|
|
18167
|
+
return 0;
|
|
18168
|
+
}
|
|
18169
|
+
if (now >= expiresDate.getTime()) {
|
|
18170
|
+
return 0;
|
|
18171
|
+
}
|
|
18172
|
+
if (responseDate) {
|
|
18173
|
+
if (responseDate >= expiresDate) {
|
|
18174
|
+
return 0;
|
|
17501
18175
|
}
|
|
17502
|
-
|
|
17503
|
-
|
|
17504
|
-
|
|
17505
|
-
}
|
|
17506
|
-
if (age !== void 0 && age > expiresDate - responseDate) {
|
|
17507
|
-
return void 0;
|
|
17508
|
-
}
|
|
18176
|
+
const freshnessLifetime = expiresDate.getTime() - responseDate.getTime();
|
|
18177
|
+
if (age !== void 0 && age >= freshnessLifetime) {
|
|
18178
|
+
return 0;
|
|
17509
18179
|
}
|
|
17510
|
-
return
|
|
18180
|
+
return freshnessLifetime;
|
|
17511
18181
|
}
|
|
18182
|
+
return expiresDate.getTime() - now;
|
|
17512
18183
|
}
|
|
17513
18184
|
if (typeof resHeaders["last-modified"] === "string") {
|
|
17514
|
-
const lastModified =
|
|
17515
|
-
if (
|
|
18185
|
+
const lastModified = parseHttpDate(resHeaders["last-modified"]);
|
|
18186
|
+
if (lastModified) {
|
|
17516
18187
|
if (lastModified.getTime() >= now) {
|
|
17517
18188
|
return void 0;
|
|
17518
18189
|
}
|
|
@@ -17565,11 +18236,7 @@ var require_cache_handler = __commonJS({
|
|
|
17565
18236
|
"age"
|
|
17566
18237
|
];
|
|
17567
18238
|
if (resHeaders["connection"]) {
|
|
17568
|
-
|
|
17569
|
-
headersToRemove.push(...resHeaders["connection"].map((header) => header.trim()));
|
|
17570
|
-
} else {
|
|
17571
|
-
headersToRemove.push(...resHeaders["connection"].split(",").map((header) => header.trim()));
|
|
17572
|
-
}
|
|
18239
|
+
appendConnectionHeaderTokens(headersToRemove, resHeaders["connection"]);
|
|
17573
18240
|
}
|
|
17574
18241
|
if (Array.isArray(cacheControlDirectives["no-cache"])) {
|
|
17575
18242
|
headersToRemove.push(...cacheControlDirectives["no-cache"]);
|
|
@@ -17579,16 +18246,13 @@ var require_cache_handler = __commonJS({
|
|
|
17579
18246
|
}
|
|
17580
18247
|
let strippedHeaders;
|
|
17581
18248
|
for (const headerName of headersToRemove) {
|
|
17582
|
-
if (resHeaders
|
|
18249
|
+
if (Object.hasOwn(resHeaders, headerName)) {
|
|
17583
18250
|
strippedHeaders ??= { ...resHeaders };
|
|
17584
18251
|
delete strippedHeaders[headerName];
|
|
17585
18252
|
}
|
|
17586
18253
|
}
|
|
17587
18254
|
return strippedHeaders ?? resHeaders;
|
|
17588
18255
|
}
|
|
17589
|
-
function isValidDate(date) {
|
|
17590
|
-
return date instanceof Date && Number.isFinite(date.valueOf());
|
|
17591
|
-
}
|
|
17592
18256
|
module2.exports = CacheHandler;
|
|
17593
18257
|
}
|
|
17594
18258
|
});
|
|
@@ -17759,12 +18423,43 @@ var require_memory_cache_store = __commonJS({
|
|
|
17759
18423
|
}
|
|
17760
18424
|
};
|
|
17761
18425
|
function findEntry(key, entries, now) {
|
|
17762
|
-
|
|
17763
|
-
|
|
17764
|
-
|
|
18426
|
+
for (let i = 0; i < entries.length; i++) {
|
|
18427
|
+
const entry = entries[i];
|
|
18428
|
+
if (entry.deleteAt > now && entry.method === key.method && varyMatches(key, entry)) {
|
|
18429
|
+
return entry;
|
|
17765
18430
|
}
|
|
17766
|
-
|
|
17767
|
-
|
|
18431
|
+
}
|
|
18432
|
+
}
|
|
18433
|
+
function varyMatches(key, entry) {
|
|
18434
|
+
if (entry.vary == null) {
|
|
18435
|
+
return true;
|
|
18436
|
+
}
|
|
18437
|
+
for (const headerName in entry.vary) {
|
|
18438
|
+
if (Object.hasOwn(entry.vary, headerName) && !headerValueEquals(key.headers?.[headerName], entry.vary[headerName])) {
|
|
18439
|
+
return false;
|
|
18440
|
+
}
|
|
18441
|
+
}
|
|
18442
|
+
return true;
|
|
18443
|
+
}
|
|
18444
|
+
function headerValueEquals(lhs, rhs) {
|
|
18445
|
+
if (lhs == null && rhs == null) {
|
|
18446
|
+
return true;
|
|
18447
|
+
}
|
|
18448
|
+
if (lhs == null && rhs != null || lhs != null && rhs == null) {
|
|
18449
|
+
return false;
|
|
18450
|
+
}
|
|
18451
|
+
if (Array.isArray(lhs) && Array.isArray(rhs)) {
|
|
18452
|
+
if (lhs.length !== rhs.length) {
|
|
18453
|
+
return false;
|
|
18454
|
+
}
|
|
18455
|
+
for (let i = 0; i < lhs.length; i++) {
|
|
18456
|
+
if (lhs[i] !== rhs[i]) {
|
|
18457
|
+
return false;
|
|
18458
|
+
}
|
|
18459
|
+
}
|
|
18460
|
+
return true;
|
|
18461
|
+
}
|
|
18462
|
+
return lhs === rhs;
|
|
17768
18463
|
}
|
|
17769
18464
|
module2.exports = MemoryCacheStore;
|
|
17770
18465
|
}
|
|
@@ -17778,7 +18473,7 @@ var require_cache_revalidation_handler = __commonJS({
|
|
|
17778
18473
|
var CacheRevalidationHandler = class {
|
|
17779
18474
|
#successful = false;
|
|
17780
18475
|
/**
|
|
17781
|
-
* @type {((boolean, any) => void) | null}
|
|
18476
|
+
* @type {((success: boolean, context?: any, statusCode?: number, headers?: import('../../types/header.d.ts').IncomingHttpHeaders) => void) | null}
|
|
17782
18477
|
*/
|
|
17783
18478
|
#callback;
|
|
17784
18479
|
/**
|
|
@@ -17791,7 +18486,7 @@ var require_cache_revalidation_handler = __commonJS({
|
|
|
17791
18486
|
*/
|
|
17792
18487
|
#allowErrorStatusCodes;
|
|
17793
18488
|
/**
|
|
17794
|
-
* @param {(boolean) => void} callback Function to call if the cached value is valid
|
|
18489
|
+
* @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
|
|
17795
18490
|
* @param {import('../../types/dispatcher.d.ts').default.DispatchHandlers} handler
|
|
17796
18491
|
* @param {boolean} allowErrorStatusCodes
|
|
17797
18492
|
*/
|
|
@@ -17813,7 +18508,7 @@ var require_cache_revalidation_handler = __commonJS({
|
|
|
17813
18508
|
onResponseStart(controller, statusCode, headers, statusMessage) {
|
|
17814
18509
|
assert(this.#callback != null);
|
|
17815
18510
|
this.#successful = statusCode === 304 || this.#allowErrorStatusCodes && statusCode >= 500 && statusCode <= 504;
|
|
17816
|
-
this.#callback(this.#successful, this.#context);
|
|
18511
|
+
this.#callback(this.#successful, this.#context, statusCode, headers);
|
|
17817
18512
|
this.#callback = null;
|
|
17818
18513
|
if (this.#successful) {
|
|
17819
18514
|
return true;
|
|
@@ -17873,8 +18568,9 @@ var require_cache2 = __commonJS({
|
|
|
17873
18568
|
var CacheHandler = require_cache_handler();
|
|
17874
18569
|
var MemoryCacheStore = require_memory_cache_store();
|
|
17875
18570
|
var CacheRevalidationHandler = require_cache_revalidation_handler();
|
|
17876
|
-
var { assertCacheStore, assertCacheMethods, makeCacheKey, normalizeHeaders, parseCacheControlHeader } = require_cache();
|
|
18571
|
+
var { assertCacheStore, assertCacheMethods, makeCacheKey, normalizeHeaders, parseCacheControlHeader, isInvalidOrWildcardVaryHeader } = require_cache();
|
|
17877
18572
|
var { AbortError } = require_errors();
|
|
18573
|
+
var { parseHttpDate } = require_date();
|
|
17878
18574
|
function assertCacheOrigins(origins, name) {
|
|
17879
18575
|
if (origins === void 0) return;
|
|
17880
18576
|
if (!Array.isArray(origins)) {
|
|
@@ -17889,6 +18585,37 @@ var require_cache2 = __commonJS({
|
|
|
17889
18585
|
}
|
|
17890
18586
|
var nop = () => {
|
|
17891
18587
|
};
|
|
18588
|
+
function trimOWS(value) {
|
|
18589
|
+
return value.replace(/^[\t ]+|[\t ]+$/g, "");
|
|
18590
|
+
}
|
|
18591
|
+
function arrayIncludes(array, value) {
|
|
18592
|
+
for (let i = 0; i < array.length; i++) {
|
|
18593
|
+
if (array[i] === value) {
|
|
18594
|
+
return true;
|
|
18595
|
+
}
|
|
18596
|
+
}
|
|
18597
|
+
return false;
|
|
18598
|
+
}
|
|
18599
|
+
function hasPragmaNoCache(headers) {
|
|
18600
|
+
const pragma = headers?.pragma;
|
|
18601
|
+
if (!pragma) {
|
|
18602
|
+
return false;
|
|
18603
|
+
}
|
|
18604
|
+
const values = Array.isArray(pragma) ? pragma : [pragma];
|
|
18605
|
+
for (let i = 0; i < values.length; i++) {
|
|
18606
|
+
const value = values[i];
|
|
18607
|
+
if (typeof value !== "string") {
|
|
18608
|
+
continue;
|
|
18609
|
+
}
|
|
18610
|
+
const directives = value.split(",");
|
|
18611
|
+
for (let j = 0; j < directives.length; j++) {
|
|
18612
|
+
if (trimOWS(directives[j]).toLowerCase() === "no-cache") {
|
|
18613
|
+
return true;
|
|
18614
|
+
}
|
|
18615
|
+
}
|
|
18616
|
+
}
|
|
18617
|
+
return false;
|
|
18618
|
+
}
|
|
17892
18619
|
function needsRevalidation(result, cacheControlDirectives, { headers = {} }) {
|
|
17893
18620
|
if (cacheControlDirectives?.["no-cache"]) {
|
|
17894
18621
|
return true;
|
|
@@ -17901,15 +18628,58 @@ var require_cache2 = __commonJS({
|
|
|
17901
18628
|
}
|
|
17902
18629
|
return false;
|
|
17903
18630
|
}
|
|
17904
|
-
function
|
|
17905
|
-
return
|
|
17906
|
-
|
|
17907
|
-
);
|
|
18631
|
+
function staleResponseRequiresRevalidation(result, cacheType) {
|
|
18632
|
+
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
|
|
18633
|
+
// s-maxage implies proxy-revalidate for shared caches.
|
|
18634
|
+
result.cacheControlDirectives?.["s-maxage"] !== void 0);
|
|
18635
|
+
}
|
|
18636
|
+
function revalidationResponseDisallowsCachedReuse(cacheType, headers) {
|
|
18637
|
+
if (headers.vary && isInvalidOrWildcardVaryHeader(headers.vary)) {
|
|
18638
|
+
return true;
|
|
18639
|
+
}
|
|
18640
|
+
const cacheControl = headers["cache-control"];
|
|
18641
|
+
if (!cacheControl) {
|
|
18642
|
+
return false;
|
|
18643
|
+
}
|
|
18644
|
+
const cacheControlDirectives = parseCacheControlHeader(cacheControl);
|
|
18645
|
+
return cacheControlDirectives["no-store"] === true || cacheType === "shared" && cacheControlDirectives.private === true;
|
|
18646
|
+
}
|
|
18647
|
+
function revalidationResponseUpdatesCacheControl(headers) {
|
|
18648
|
+
return headers["cache-control"] !== void 0;
|
|
18649
|
+
}
|
|
18650
|
+
function deleteCachedValue(store, cacheKey) {
|
|
18651
|
+
try {
|
|
18652
|
+
store.delete(cacheKey)?.catch?.(nop);
|
|
18653
|
+
} catch {
|
|
18654
|
+
}
|
|
18655
|
+
}
|
|
18656
|
+
function getUsableLastModified(headers) {
|
|
18657
|
+
const lastModified = headers?.["last-modified"];
|
|
18658
|
+
if (typeof lastModified === "string" && parseHttpDate(lastModified)) {
|
|
18659
|
+
return lastModified;
|
|
18660
|
+
}
|
|
18661
|
+
}
|
|
18662
|
+
function makeRevalidationHeaders(opts, result) {
|
|
18663
|
+
const headers = {
|
|
18664
|
+
...opts.headers,
|
|
18665
|
+
"if-modified-since": getUsableLastModified(result.headers) ?? new Date(result.cachedAt).toUTCString()
|
|
18666
|
+
};
|
|
18667
|
+
if (result.etag) {
|
|
18668
|
+
headers["if-none-match"] = result.etag;
|
|
18669
|
+
}
|
|
18670
|
+
if (result.vary) {
|
|
18671
|
+
for (const key in result.vary) {
|
|
18672
|
+
if (result.vary[key] != null) {
|
|
18673
|
+
headers[key] = result.vary[key];
|
|
18674
|
+
}
|
|
18675
|
+
}
|
|
18676
|
+
}
|
|
18677
|
+
return headers;
|
|
17908
18678
|
}
|
|
17909
18679
|
function isStale(result, cacheControlDirectives, cacheType) {
|
|
17910
18680
|
const now = Date.now();
|
|
17911
18681
|
if (now > result.staleAt) {
|
|
17912
|
-
if (cacheControlDirectives?.["max-stale"]
|
|
18682
|
+
if (!staleResponseRequiresRevalidation(result, cacheType) && cacheControlDirectives?.["max-stale"]) {
|
|
17913
18683
|
const gracePeriod = result.staleAt + cacheControlDirectives["max-stale"] * 1e3;
|
|
17914
18684
|
return now > gracePeriod;
|
|
17915
18685
|
}
|
|
@@ -17922,9 +18692,9 @@ var require_cache2 = __commonJS({
|
|
|
17922
18692
|
}
|
|
17923
18693
|
return false;
|
|
17924
18694
|
}
|
|
17925
|
-
function withinStaleWhileRevalidateWindow(result) {
|
|
18695
|
+
function withinStaleWhileRevalidateWindow(result, cacheType) {
|
|
17926
18696
|
const staleWhileRevalidate = result.cacheControlDirectives?.["stale-while-revalidate"];
|
|
17927
|
-
if (!staleWhileRevalidate) {
|
|
18697
|
+
if (!staleWhileRevalidate || staleResponseRequiresRevalidation(result, cacheType)) {
|
|
17928
18698
|
return false;
|
|
17929
18699
|
}
|
|
17930
18700
|
const now = Date.now();
|
|
@@ -18034,32 +18804,17 @@ var require_cache2 = __commonJS({
|
|
|
18034
18804
|
return dispatch(opts, new CacheHandler(globalOpts, cacheKey, handler));
|
|
18035
18805
|
}
|
|
18036
18806
|
const age = Math.round((now - result.cachedAt) / 1e3);
|
|
18037
|
-
|
|
18038
|
-
|
|
18039
|
-
|
|
18040
|
-
const stale = isStale(result, reqCacheControl, globalOpts.type);
|
|
18041
|
-
const revalidate = needsRevalidation(result, reqCacheControl, opts);
|
|
18807
|
+
const requestMaxAgeExpired = reqCacheControl?.["max-age"] !== void 0 && age >= reqCacheControl["max-age"];
|
|
18808
|
+
const stale = requestMaxAgeExpired || isStale(result, reqCacheControl, globalOpts.type);
|
|
18809
|
+
const revalidate = requestMaxAgeExpired || needsRevalidation(result, reqCacheControl, opts);
|
|
18042
18810
|
if (stale || revalidate) {
|
|
18043
18811
|
if (util.isStream(opts.body) && util.bodyLength(opts.body) !== 0) {
|
|
18044
18812
|
return dispatch(opts, new CacheHandler(globalOpts, cacheKey, handler));
|
|
18045
18813
|
}
|
|
18046
|
-
if (!revalidate && withinStaleWhileRevalidateWindow(result)) {
|
|
18814
|
+
if (!revalidate && withinStaleWhileRevalidateWindow(result, globalOpts.type)) {
|
|
18047
18815
|
sendCachedValue(handler, opts, result, age, null, true);
|
|
18048
18816
|
queueMicrotask(() => {
|
|
18049
|
-
const headers2 =
|
|
18050
|
-
...opts.headers,
|
|
18051
|
-
"if-modified-since": new Date(result.cachedAt).toUTCString()
|
|
18052
|
-
};
|
|
18053
|
-
if (result.etag) {
|
|
18054
|
-
headers2["if-none-match"] = result.etag;
|
|
18055
|
-
}
|
|
18056
|
-
if (result.vary) {
|
|
18057
|
-
for (const key in result.vary) {
|
|
18058
|
-
if (result.vary[key] != null) {
|
|
18059
|
-
headers2[key] = result.vary[key];
|
|
18060
|
-
}
|
|
18061
|
-
}
|
|
18062
|
-
}
|
|
18817
|
+
const headers2 = makeRevalidationHeaders(opts, result);
|
|
18063
18818
|
dispatch(
|
|
18064
18819
|
{
|
|
18065
18820
|
...opts,
|
|
@@ -18085,32 +18840,33 @@ var require_cache2 = __commonJS({
|
|
|
18085
18840
|
return true;
|
|
18086
18841
|
}
|
|
18087
18842
|
let withinStaleIfErrorThreshold = false;
|
|
18088
|
-
|
|
18089
|
-
|
|
18090
|
-
|
|
18091
|
-
|
|
18092
|
-
const headers = {
|
|
18093
|
-
...opts.headers,
|
|
18094
|
-
"if-modified-since": new Date(result.cachedAt).toUTCString()
|
|
18095
|
-
};
|
|
18096
|
-
if (result.etag) {
|
|
18097
|
-
headers["if-none-match"] = result.etag;
|
|
18098
|
-
}
|
|
18099
|
-
if (result.vary) {
|
|
18100
|
-
for (const key in result.vary) {
|
|
18101
|
-
if (result.vary[key] != null) {
|
|
18102
|
-
headers[key] = result.vary[key];
|
|
18103
|
-
}
|
|
18843
|
+
if (!staleResponseRequiresRevalidation(result, globalOpts.type)) {
|
|
18844
|
+
const staleIfErrorExpiry = result.cacheControlDirectives["stale-if-error"] ?? reqCacheControl?.["stale-if-error"];
|
|
18845
|
+
if (staleIfErrorExpiry) {
|
|
18846
|
+
withinStaleIfErrorThreshold = now < result.staleAt + staleIfErrorExpiry * 1e3;
|
|
18104
18847
|
}
|
|
18105
18848
|
}
|
|
18849
|
+
const headers = makeRevalidationHeaders(opts, result);
|
|
18106
18850
|
return dispatch(
|
|
18107
18851
|
{
|
|
18108
18852
|
...opts,
|
|
18109
18853
|
headers
|
|
18110
18854
|
},
|
|
18111
18855
|
new CacheRevalidationHandler(
|
|
18112
|
-
(success, context) => {
|
|
18856
|
+
(success, context, statusCode, headers2) => {
|
|
18113
18857
|
if (success) {
|
|
18858
|
+
if (statusCode === 304) {
|
|
18859
|
+
if (revalidationResponseDisallowsCachedReuse(globalOpts.type, headers2)) {
|
|
18860
|
+
if (util.isStream(result.body)) {
|
|
18861
|
+
result.body.on("error", nop).destroy();
|
|
18862
|
+
}
|
|
18863
|
+
deleteCachedValue(globalOpts.store, cacheKey);
|
|
18864
|
+
return dispatch(opts, new CacheHandler(globalOpts, cacheKey, handler));
|
|
18865
|
+
}
|
|
18866
|
+
if (revalidationResponseUpdatesCacheControl(headers2)) {
|
|
18867
|
+
deleteCachedValue(globalOpts.store, cacheKey);
|
|
18868
|
+
}
|
|
18869
|
+
}
|
|
18114
18870
|
sendCachedValue(handler, opts, result, age, context, stale);
|
|
18115
18871
|
} else if (util.isStream(result.body)) {
|
|
18116
18872
|
result.body.on("error", nop).destroy();
|
|
@@ -18152,13 +18908,22 @@ var require_cache2 = __commonJS({
|
|
|
18152
18908
|
cacheByDefault,
|
|
18153
18909
|
type
|
|
18154
18910
|
};
|
|
18155
|
-
const safeMethodsToNotCache =
|
|
18911
|
+
const safeMethodsToNotCache = [];
|
|
18912
|
+
for (let i = 0; i < util.safeHTTPMethods.length; i++) {
|
|
18913
|
+
const method = util.safeHTTPMethods[i];
|
|
18914
|
+
if (!arrayIncludes(methods, method)) {
|
|
18915
|
+
safeMethodsToNotCache.push(method);
|
|
18916
|
+
}
|
|
18917
|
+
}
|
|
18156
18918
|
return (dispatch) => {
|
|
18157
18919
|
return (opts2, handler) => {
|
|
18158
|
-
if (
|
|
18920
|
+
if (arrayIncludes(safeMethodsToNotCache, opts2.method)) {
|
|
18159
18921
|
return dispatch(opts2, handler);
|
|
18160
18922
|
}
|
|
18161
18923
|
if (origins !== void 0) {
|
|
18924
|
+
if (!opts2.origin) {
|
|
18925
|
+
return dispatch(opts2, handler);
|
|
18926
|
+
}
|
|
18162
18927
|
const requestOrigin = opts2.origin.toString().toLowerCase();
|
|
18163
18928
|
let isAllowed = false;
|
|
18164
18929
|
for (let i = 0; i < origins.length; i++) {
|
|
@@ -18181,7 +18946,7 @@ var require_cache2 = __commonJS({
|
|
|
18181
18946
|
...opts2,
|
|
18182
18947
|
headers: normalizeHeaders(opts2)
|
|
18183
18948
|
};
|
|
18184
|
-
const reqCacheControl = opts2.headers?.["cache-control"] ? parseCacheControlHeader(opts2.headers["cache-control"]) : void 0;
|
|
18949
|
+
const reqCacheControl = opts2.headers?.["cache-control"] ? parseCacheControlHeader(opts2.headers["cache-control"]) : hasPragmaNoCache(opts2.headers) ? { "no-cache": true } : void 0;
|
|
18185
18950
|
if (reqCacheControl?.["no-store"]) {
|
|
18186
18951
|
return dispatch(opts2, handler);
|
|
18187
18952
|
}
|
|
@@ -18241,6 +19006,8 @@ var require_decompress = __commonJS({
|
|
|
18241
19006
|
var DecompressHandler = class extends DecoratorHandler {
|
|
18242
19007
|
/** @type {Transform[]} */
|
|
18243
19008
|
#decompressors = [];
|
|
19009
|
+
/** @type {Record<string, string | string[]> | undefined} */
|
|
19010
|
+
#trailers;
|
|
18244
19011
|
/** @type {Readonly<number[]>} */
|
|
18245
19012
|
#skipStatusCodes;
|
|
18246
19013
|
/** @type {boolean} */
|
|
@@ -18316,7 +19083,7 @@ var require_decompress = __commonJS({
|
|
|
18316
19083
|
const decompressor = this.#decompressors[0];
|
|
18317
19084
|
this.#setupDecompressorEvents(decompressor, controller);
|
|
18318
19085
|
decompressor.on("end", () => {
|
|
18319
|
-
super.onResponseEnd(controller,
|
|
19086
|
+
super.onResponseEnd(controller, this.#trailers);
|
|
18320
19087
|
});
|
|
18321
19088
|
}
|
|
18322
19089
|
/**
|
|
@@ -18332,7 +19099,7 @@ var require_decompress = __commonJS({
|
|
|
18332
19099
|
super.onResponseError(controller, err);
|
|
18333
19100
|
return;
|
|
18334
19101
|
}
|
|
18335
|
-
super.onResponseEnd(controller,
|
|
19102
|
+
super.onResponseEnd(controller, this.#trailers);
|
|
18336
19103
|
});
|
|
18337
19104
|
}
|
|
18338
19105
|
/**
|
|
@@ -18410,6 +19177,7 @@ var require_decompress = __commonJS({
|
|
|
18410
19177
|
*/
|
|
18411
19178
|
onResponseEnd(controller, trailers) {
|
|
18412
19179
|
if (this.#decompressors.length > 0) {
|
|
19180
|
+
this.#trailers = trailers;
|
|
18413
19181
|
this.#decompressors[0].end();
|
|
18414
19182
|
this.#cleanupDecompressors();
|
|
18415
19183
|
return;
|
|
@@ -18853,7 +19621,7 @@ var require_deduplicate = __commonJS({
|
|
|
18853
19621
|
const pendingRequests = /* @__PURE__ */ new Map();
|
|
18854
19622
|
return (dispatch) => {
|
|
18855
19623
|
return (opts2, handler) => {
|
|
18856
|
-
if (
|
|
19624
|
+
if (opts2.upgrade || methods.includes(opts2.method) === false) {
|
|
18857
19625
|
return dispatch(opts2, handler);
|
|
18858
19626
|
}
|
|
18859
19627
|
opts2 = {
|
|
@@ -19251,7 +20019,12 @@ var require_sqlite_cache_store = __commonJS({
|
|
|
19251
20019
|
if (lhs.length !== rhs.length) {
|
|
19252
20020
|
return false;
|
|
19253
20021
|
}
|
|
19254
|
-
|
|
20022
|
+
for (let i = 0; i < lhs.length; i++) {
|
|
20023
|
+
if (lhs[i] !== rhs[i]) {
|
|
20024
|
+
return false;
|
|
20025
|
+
}
|
|
20026
|
+
}
|
|
20027
|
+
return true;
|
|
19255
20028
|
}
|
|
19256
20029
|
return lhs === rhs;
|
|
19257
20030
|
}
|
|
@@ -20204,7 +20977,7 @@ var require_request2 = __commonJS({
|
|
|
20204
20977
|
}
|
|
20205
20978
|
}
|
|
20206
20979
|
var patchMethodWarning = false;
|
|
20207
|
-
var
|
|
20980
|
+
var Request2 = class _Request {
|
|
20208
20981
|
/** @type {AbortSignal} */
|
|
20209
20982
|
#signal;
|
|
20210
20983
|
/** @type {import('../../dispatcher/dispatcher')} */
|
|
@@ -20709,15 +21482,15 @@ var require_request2 = __commonJS({
|
|
|
20709
21482
|
request.#abortCleanup?.();
|
|
20710
21483
|
}
|
|
20711
21484
|
};
|
|
20712
|
-
var { setRequestSignal, getRequestDispatcher, setRequestDispatcher, setRequestHeaders, getRequestState, setRequestState, removeRequestAbortListener } =
|
|
20713
|
-
Reflect.deleteProperty(
|
|
20714
|
-
Reflect.deleteProperty(
|
|
20715
|
-
Reflect.deleteProperty(
|
|
20716
|
-
Reflect.deleteProperty(
|
|
20717
|
-
Reflect.deleteProperty(
|
|
20718
|
-
Reflect.deleteProperty(
|
|
20719
|
-
Reflect.deleteProperty(
|
|
20720
|
-
mixinBody(
|
|
21485
|
+
var { setRequestSignal, getRequestDispatcher, setRequestDispatcher, setRequestHeaders, getRequestState, setRequestState, removeRequestAbortListener } = Request2;
|
|
21486
|
+
Reflect.deleteProperty(Request2, "setRequestSignal");
|
|
21487
|
+
Reflect.deleteProperty(Request2, "getRequestDispatcher");
|
|
21488
|
+
Reflect.deleteProperty(Request2, "setRequestDispatcher");
|
|
21489
|
+
Reflect.deleteProperty(Request2, "setRequestHeaders");
|
|
21490
|
+
Reflect.deleteProperty(Request2, "getRequestState");
|
|
21491
|
+
Reflect.deleteProperty(Request2, "setRequestState");
|
|
21492
|
+
Reflect.deleteProperty(Request2, "removeRequestAbortListener");
|
|
21493
|
+
mixinBody(Request2, getRequestState);
|
|
20721
21494
|
function makeRequest(init) {
|
|
20722
21495
|
return {
|
|
20723
21496
|
method: init.method ?? "GET",
|
|
@@ -20771,7 +21544,7 @@ var require_request2 = __commonJS({
|
|
|
20771
21544
|
return newRequest;
|
|
20772
21545
|
}
|
|
20773
21546
|
function fromInnerRequest(innerRequest, dispatcher, signal, guard) {
|
|
20774
|
-
const request = new
|
|
21547
|
+
const request = new Request2(kConstruct);
|
|
20775
21548
|
setRequestState(request, innerRequest);
|
|
20776
21549
|
setRequestDispatcher(request, dispatcher);
|
|
20777
21550
|
setRequestSignal(request, signal);
|
|
@@ -20781,7 +21554,7 @@ var require_request2 = __commonJS({
|
|
|
20781
21554
|
setHeadersGuard(headers, guard);
|
|
20782
21555
|
return request;
|
|
20783
21556
|
}
|
|
20784
|
-
Object.defineProperties(
|
|
21557
|
+
Object.defineProperties(Request2.prototype, {
|
|
20785
21558
|
method: kEnumerableProperty,
|
|
20786
21559
|
url: kEnumerableProperty,
|
|
20787
21560
|
headers: kEnumerableProperty,
|
|
@@ -20807,7 +21580,7 @@ var require_request2 = __commonJS({
|
|
|
20807
21580
|
configurable: true
|
|
20808
21581
|
}
|
|
20809
21582
|
});
|
|
20810
|
-
webidl.is.Request = webidl.util.MakeTypeAssertion(
|
|
21583
|
+
webidl.is.Request = webidl.util.MakeTypeAssertion(Request2);
|
|
20811
21584
|
webidl.converters.RequestInfo = function(V) {
|
|
20812
21585
|
if (typeof V === "string") {
|
|
20813
21586
|
return webidl.converters.USVString(V);
|
|
@@ -20906,7 +21679,7 @@ var require_request2 = __commonJS({
|
|
|
20906
21679
|
}
|
|
20907
21680
|
]);
|
|
20908
21681
|
module2.exports = {
|
|
20909
|
-
Request,
|
|
21682
|
+
Request: Request2,
|
|
20910
21683
|
makeRequest,
|
|
20911
21684
|
fromInnerRequest,
|
|
20912
21685
|
cloneRequest,
|
|
@@ -21069,7 +21842,7 @@ var require_fetch = __commonJS({
|
|
|
21069
21842
|
getResponseState
|
|
21070
21843
|
} = require_response();
|
|
21071
21844
|
var { HeadersList } = require_headers();
|
|
21072
|
-
var { Request, cloneRequest, getRequestDispatcher, getRequestState, removeRequestAbortListener } = require_request2();
|
|
21845
|
+
var { Request: Request2, cloneRequest, getRequestDispatcher, getRequestState, removeRequestAbortListener } = require_request2();
|
|
21073
21846
|
var zlib = require("node:zlib");
|
|
21074
21847
|
var {
|
|
21075
21848
|
makePolicyContainer,
|
|
@@ -21189,7 +21962,7 @@ var require_fetch = __commonJS({
|
|
|
21189
21962
|
let p = Promise.withResolvers();
|
|
21190
21963
|
let requestObject;
|
|
21191
21964
|
try {
|
|
21192
|
-
requestObject = new
|
|
21965
|
+
requestObject = new Request2(input, init);
|
|
21193
21966
|
} catch (e) {
|
|
21194
21967
|
p.reject(e);
|
|
21195
21968
|
return p.promise;
|
|
@@ -22048,13 +22821,13 @@ var require_fetch = __commonJS({
|
|
|
22048
22821
|
function dispatch({ body }) {
|
|
22049
22822
|
const url = requestCurrentURL(request);
|
|
22050
22823
|
const agent = fetchParams.controller.dispatcher;
|
|
22051
|
-
const
|
|
22824
|
+
const path10 = url.pathname + url.search;
|
|
22052
22825
|
const hasTrailingQuestionMark = url.search.length === 0 && url.href[url.href.length - url.hash.length - 1] === "?";
|
|
22053
22826
|
return dispatchWithProtocolPreference(body);
|
|
22054
22827
|
function dispatchWithProtocolPreference(body2, allowH2) {
|
|
22055
22828
|
return new Promise((resolve3, reject) => agent.dispatch(
|
|
22056
22829
|
{
|
|
22057
|
-
path: hasTrailingQuestionMark ? `${
|
|
22830
|
+
path: hasTrailingQuestionMark ? `${path10}?` : path10,
|
|
22058
22831
|
origin: url.origin,
|
|
22059
22832
|
method: request.method,
|
|
22060
22833
|
body: agent.isMockActive ? request.body && (request.body.source || request.body.stream) : body2,
|
|
@@ -22244,7 +23017,7 @@ var require_cache3 = __commonJS({
|
|
|
22244
23017
|
var { kEnumerableProperty, isDisturbed } = require_util();
|
|
22245
23018
|
var { webidl } = require_webidl();
|
|
22246
23019
|
var { cloneResponse, fromInnerResponse, getResponseState } = require_response();
|
|
22247
|
-
var { Request, fromInnerRequest, getRequestState } = require_request2();
|
|
23020
|
+
var { Request: Request2, fromInnerRequest, getRequestState } = require_request2();
|
|
22248
23021
|
var { fetching } = require_fetch();
|
|
22249
23022
|
var { urlIsHttpHttpsScheme, readAllBytes } = require_util2();
|
|
22250
23023
|
var Cache = class _Cache {
|
|
@@ -22316,7 +23089,7 @@ var require_cache3 = __commonJS({
|
|
|
22316
23089
|
}
|
|
22317
23090
|
const fetchControllers = [];
|
|
22318
23091
|
for (const request of requests) {
|
|
22319
|
-
const r = getRequestState(new
|
|
23092
|
+
const r = getRequestState(new Request2(request));
|
|
22320
23093
|
if (!urlIsHttpHttpsScheme(r.url)) {
|
|
22321
23094
|
throw webidl.errors.exception({
|
|
22322
23095
|
header: prefix,
|
|
@@ -22403,7 +23176,7 @@ var require_cache3 = __commonJS({
|
|
|
22403
23176
|
if (webidl.is.Request(request)) {
|
|
22404
23177
|
innerRequest = getRequestState(request);
|
|
22405
23178
|
} else {
|
|
22406
|
-
innerRequest = getRequestState(new
|
|
23179
|
+
innerRequest = getRequestState(new Request2(request));
|
|
22407
23180
|
}
|
|
22408
23181
|
if (!urlIsHttpHttpsScheme(innerRequest.url) || innerRequest.method !== "GET") {
|
|
22409
23182
|
throw webidl.errors.exception({
|
|
@@ -22488,7 +23261,7 @@ var require_cache3 = __commonJS({
|
|
|
22488
23261
|
}
|
|
22489
23262
|
} else {
|
|
22490
23263
|
assert(typeof request === "string");
|
|
22491
|
-
r = getRequestState(new
|
|
23264
|
+
r = getRequestState(new Request2(request));
|
|
22492
23265
|
}
|
|
22493
23266
|
const operations = [];
|
|
22494
23267
|
const operation = {
|
|
@@ -22533,7 +23306,7 @@ var require_cache3 = __commonJS({
|
|
|
22533
23306
|
return [];
|
|
22534
23307
|
}
|
|
22535
23308
|
} else if (typeof request === "string") {
|
|
22536
|
-
r = getRequestState(new
|
|
23309
|
+
r = getRequestState(new Request2(request));
|
|
22537
23310
|
}
|
|
22538
23311
|
}
|
|
22539
23312
|
const promise = Promise.withResolvers();
|
|
@@ -22706,7 +23479,7 @@ var require_cache3 = __commonJS({
|
|
|
22706
23479
|
return [];
|
|
22707
23480
|
}
|
|
22708
23481
|
} else if (typeof request === "string") {
|
|
22709
|
-
r = getRequestState(new
|
|
23482
|
+
r = getRequestState(new Request2(request));
|
|
22710
23483
|
}
|
|
22711
23484
|
}
|
|
22712
23485
|
const responses = [];
|
|
@@ -22966,9 +23739,9 @@ var require_util4 = __commonJS({
|
|
|
22966
23739
|
}
|
|
22967
23740
|
}
|
|
22968
23741
|
}
|
|
22969
|
-
function validateCookiePath(
|
|
22970
|
-
for (let i = 0; i <
|
|
22971
|
-
const code =
|
|
23742
|
+
function validateCookiePath(path10) {
|
|
23743
|
+
for (let i = 0; i < path10.length; ++i) {
|
|
23744
|
+
const code = path10.charCodeAt(i);
|
|
22972
23745
|
if (code < 32 || // exclude CTLs (0-31)
|
|
22973
23746
|
code > 126 || // exclude non-ascii and DEL
|
|
22974
23747
|
code === 59) {
|
|
@@ -22976,8 +23749,42 @@ var require_util4 = __commonJS({
|
|
|
22976
23749
|
}
|
|
22977
23750
|
}
|
|
22978
23751
|
}
|
|
23752
|
+
function isLetterOrDigit(code) {
|
|
23753
|
+
return code >= 48 && code <= 57 || // 0-9
|
|
23754
|
+
code >= 65 && code <= 90 || // A-Z
|
|
23755
|
+
code >= 97 && code <= 122;
|
|
23756
|
+
}
|
|
22979
23757
|
function validateCookieDomain(domain) {
|
|
22980
|
-
if (domain
|
|
23758
|
+
if (domain === " ") {
|
|
23759
|
+
return;
|
|
23760
|
+
}
|
|
23761
|
+
if (domain.length > 255) {
|
|
23762
|
+
throw new Error("Invalid cookie domain");
|
|
23763
|
+
}
|
|
23764
|
+
let labelLength = 0;
|
|
23765
|
+
for (let i = 0; i < domain.length; ++i) {
|
|
23766
|
+
const code = domain.charCodeAt(i);
|
|
23767
|
+
if (code === 46) {
|
|
23768
|
+
if (labelLength === 0) {
|
|
23769
|
+
throw new Error("Invalid cookie domain");
|
|
23770
|
+
}
|
|
23771
|
+
if (domain.charCodeAt(i - 1) === 45) {
|
|
23772
|
+
throw new Error("Invalid cookie domain");
|
|
23773
|
+
}
|
|
23774
|
+
labelLength = 0;
|
|
23775
|
+
continue;
|
|
23776
|
+
}
|
|
23777
|
+
if (labelLength === 0 && !isLetterOrDigit(code)) {
|
|
23778
|
+
throw new Error("Invalid cookie domain");
|
|
23779
|
+
}
|
|
23780
|
+
if (!isLetterOrDigit(code) && code !== 45) {
|
|
23781
|
+
throw new Error("Invalid cookie domain");
|
|
23782
|
+
}
|
|
23783
|
+
if (++labelLength > 63) {
|
|
23784
|
+
throw new Error("Invalid cookie domain");
|
|
23785
|
+
}
|
|
23786
|
+
}
|
|
23787
|
+
if (labelLength === 0 || domain.charCodeAt(domain.length - 1) === 45) {
|
|
22981
23788
|
throw new Error("Invalid cookie domain");
|
|
22982
23789
|
}
|
|
22983
23790
|
}
|
|
@@ -23060,7 +23867,11 @@ var require_util4 = __commonJS({
|
|
|
23060
23867
|
throw new Error("Invalid unparsed");
|
|
23061
23868
|
}
|
|
23062
23869
|
const [key, ...value] = part.split("=");
|
|
23063
|
-
|
|
23870
|
+
const trimmedKey = key.trim();
|
|
23871
|
+
const joinedValue = value.join("=");
|
|
23872
|
+
validateCookieName(trimmedKey);
|
|
23873
|
+
validateCookieValue(joinedValue);
|
|
23874
|
+
out.push(`${trimmedKey}=${joinedValue}`);
|
|
23064
23875
|
}
|
|
23065
23876
|
return out.join("; ");
|
|
23066
23877
|
}
|
|
@@ -24660,6 +25471,8 @@ var require_websocket = __commonJS({
|
|
|
24660
25471
|
var { SendQueue } = require_sender();
|
|
24661
25472
|
var { WebsocketFrameSend } = require_frame();
|
|
24662
25473
|
var { channels } = require_diagnostics();
|
|
25474
|
+
var kRef = /* @__PURE__ */ Symbol.for("nodejs.ref");
|
|
25475
|
+
var kUnref = /* @__PURE__ */ Symbol.for("nodejs.unref");
|
|
24663
25476
|
function getSocketAddress(socket) {
|
|
24664
25477
|
if (typeof socket?.address === "function") {
|
|
24665
25478
|
return socket.address();
|
|
@@ -24679,6 +25492,7 @@ var require_websocket = __commonJS({
|
|
|
24679
25492
|
#bufferedAmount = 0;
|
|
24680
25493
|
#protocol = "";
|
|
24681
25494
|
#extensions = "";
|
|
25495
|
+
#refed = true;
|
|
24682
25496
|
/** @type {SendQueue} */
|
|
24683
25497
|
#sendQueue;
|
|
24684
25498
|
/** @type {Handler} */
|
|
@@ -24761,6 +25575,16 @@ var require_websocket = __commonJS({
|
|
|
24761
25575
|
this.#handler.readyState = _WebSocket.CONNECTING;
|
|
24762
25576
|
this.#binaryType = "blob";
|
|
24763
25577
|
}
|
|
25578
|
+
[kRef]() {
|
|
25579
|
+
webidl.brandCheck(this, _WebSocket);
|
|
25580
|
+
this.#refed = true;
|
|
25581
|
+
this.#handler.socket?.ref?.();
|
|
25582
|
+
}
|
|
25583
|
+
[kUnref]() {
|
|
25584
|
+
webidl.brandCheck(this, _WebSocket);
|
|
25585
|
+
this.#refed = false;
|
|
25586
|
+
this.#handler.socket?.unref?.();
|
|
25587
|
+
}
|
|
24764
25588
|
/**
|
|
24765
25589
|
* @see https://websockets.spec.whatwg.org/#dom-websocket-close
|
|
24766
25590
|
* @param {number|undefined} code
|
|
@@ -24922,6 +25746,9 @@ var require_websocket = __commonJS({
|
|
|
24922
25746
|
*/
|
|
24923
25747
|
#onConnectionEstablished(response, parsedExtensions) {
|
|
24924
25748
|
this.#handler.socket = response.socket;
|
|
25749
|
+
if (!this.#refed) {
|
|
25750
|
+
this.#handler.socket.unref?.();
|
|
25751
|
+
}
|
|
24925
25752
|
const maxFragments = this.#handler.controller.dispatcher?.webSocketOptions?.maxFragments;
|
|
24926
25753
|
const maxPayloadSize = this.#handler.controller.dispatcher?.webSocketOptions?.maxPayloadSize;
|
|
24927
25754
|
const parser = new ByteParser(this.#handler, parsedExtensions, {
|
|
@@ -26286,11 +27113,11 @@ var require_undici = __commonJS({
|
|
|
26286
27113
|
if (typeof opts.path !== "string") {
|
|
26287
27114
|
throw new InvalidArgumentError("invalid opts.path");
|
|
26288
27115
|
}
|
|
26289
|
-
let
|
|
27116
|
+
let path10 = opts.path;
|
|
26290
27117
|
if (!opts.path.startsWith("/")) {
|
|
26291
|
-
|
|
27118
|
+
path10 = `/${path10}`;
|
|
26292
27119
|
}
|
|
26293
|
-
url = new URL(util.parseOrigin(url).origin +
|
|
27120
|
+
url = new URL(util.parseOrigin(url).origin + path10);
|
|
26294
27121
|
} else {
|
|
26295
27122
|
if (!opts) {
|
|
26296
27123
|
opts = typeof url === "object" ? url : {};
|
|
@@ -34168,10 +34995,10 @@ var require_util7 = __commonJS({
|
|
|
34168
34995
|
function cloneDef(schema) {
|
|
34169
34996
|
return mergeDefs(schema._zod.def);
|
|
34170
34997
|
}
|
|
34171
|
-
function getElementAtPath(obj,
|
|
34172
|
-
if (!
|
|
34998
|
+
function getElementAtPath(obj, path10) {
|
|
34999
|
+
if (!path10)
|
|
34173
35000
|
return obj;
|
|
34174
|
-
return
|
|
35001
|
+
return path10.reduce((acc, key) => acc?.[key], obj);
|
|
34175
35002
|
}
|
|
34176
35003
|
function promiseAllObject(promisesObj) {
|
|
34177
35004
|
const keys = Object.keys(promisesObj);
|
|
@@ -34581,11 +35408,11 @@ var require_util7 = __commonJS({
|
|
|
34581
35408
|
}
|
|
34582
35409
|
return false;
|
|
34583
35410
|
}
|
|
34584
|
-
function prefixIssues(
|
|
35411
|
+
function prefixIssues(path10, issues) {
|
|
34585
35412
|
return issues.map((iss) => {
|
|
34586
35413
|
var _a;
|
|
34587
35414
|
(_a = iss).path ?? (_a.path = []);
|
|
34588
|
-
iss.path.unshift(
|
|
35415
|
+
iss.path.unshift(path10);
|
|
34589
35416
|
return iss;
|
|
34590
35417
|
});
|
|
34591
35418
|
}
|
|
@@ -34774,16 +35601,16 @@ var require_errors2 = __commonJS({
|
|
|
34774
35601
|
}
|
|
34775
35602
|
function formatError2(error2, mapper = (issue2) => issue2.message) {
|
|
34776
35603
|
const fieldErrors = { _errors: [] };
|
|
34777
|
-
const processError = (error3,
|
|
35604
|
+
const processError = (error3, path10 = []) => {
|
|
34778
35605
|
for (const issue2 of error3.issues) {
|
|
34779
35606
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
34780
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
35607
|
+
issue2.errors.map((issues) => processError({ issues }, [...path10, ...issue2.path]));
|
|
34781
35608
|
} else if (issue2.code === "invalid_key") {
|
|
34782
|
-
processError({ issues: issue2.issues }, [...
|
|
35609
|
+
processError({ issues: issue2.issues }, [...path10, ...issue2.path]);
|
|
34783
35610
|
} else if (issue2.code === "invalid_element") {
|
|
34784
|
-
processError({ issues: issue2.issues }, [...
|
|
35611
|
+
processError({ issues: issue2.issues }, [...path10, ...issue2.path]);
|
|
34785
35612
|
} else {
|
|
34786
|
-
const fullpath = [...
|
|
35613
|
+
const fullpath = [...path10, ...issue2.path];
|
|
34787
35614
|
if (fullpath.length === 0) {
|
|
34788
35615
|
fieldErrors._errors.push(mapper(issue2));
|
|
34789
35616
|
} else {
|
|
@@ -34810,17 +35637,17 @@ var require_errors2 = __commonJS({
|
|
|
34810
35637
|
}
|
|
34811
35638
|
function treeifyError(error2, mapper = (issue2) => issue2.message) {
|
|
34812
35639
|
const result = { errors: [] };
|
|
34813
|
-
const processError = (error3,
|
|
35640
|
+
const processError = (error3, path10 = []) => {
|
|
34814
35641
|
var _a, _b;
|
|
34815
35642
|
for (const issue2 of error3.issues) {
|
|
34816
35643
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
34817
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
35644
|
+
issue2.errors.map((issues) => processError({ issues }, [...path10, ...issue2.path]));
|
|
34818
35645
|
} else if (issue2.code === "invalid_key") {
|
|
34819
|
-
processError({ issues: issue2.issues }, [...
|
|
35646
|
+
processError({ issues: issue2.issues }, [...path10, ...issue2.path]);
|
|
34820
35647
|
} else if (issue2.code === "invalid_element") {
|
|
34821
|
-
processError({ issues: issue2.issues }, [...
|
|
35648
|
+
processError({ issues: issue2.issues }, [...path10, ...issue2.path]);
|
|
34822
35649
|
} else {
|
|
34823
|
-
const fullpath = [...
|
|
35650
|
+
const fullpath = [...path10, ...issue2.path];
|
|
34824
35651
|
if (fullpath.length === 0) {
|
|
34825
35652
|
result.errors.push(mapper(issue2));
|
|
34826
35653
|
continue;
|
|
@@ -34852,8 +35679,8 @@ var require_errors2 = __commonJS({
|
|
|
34852
35679
|
}
|
|
34853
35680
|
function toDotPath(_path) {
|
|
34854
35681
|
const segs = [];
|
|
34855
|
-
const
|
|
34856
|
-
for (const seg of
|
|
35682
|
+
const path10 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
|
|
35683
|
+
for (const seg of path10) {
|
|
34857
35684
|
if (typeof seg === "number")
|
|
34858
35685
|
segs.push(`[${seg}]`);
|
|
34859
35686
|
else if (typeof seg === "symbol")
|
|
@@ -62004,11 +62831,11 @@ var require_lodash = __commonJS({
|
|
|
62004
62831
|
return isFunction(object[key]);
|
|
62005
62832
|
});
|
|
62006
62833
|
}
|
|
62007
|
-
function baseGet(object,
|
|
62008
|
-
|
|
62009
|
-
var index = 0, length =
|
|
62834
|
+
function baseGet(object, path10) {
|
|
62835
|
+
path10 = castPath(path10, object);
|
|
62836
|
+
var index = 0, length = path10.length;
|
|
62010
62837
|
while (object != null && index < length) {
|
|
62011
|
-
object = object[toKey(
|
|
62838
|
+
object = object[toKey(path10[index++])];
|
|
62012
62839
|
}
|
|
62013
62840
|
return index && index == length ? object : undefined2;
|
|
62014
62841
|
}
|
|
@@ -62072,10 +62899,10 @@ var require_lodash = __commonJS({
|
|
|
62072
62899
|
});
|
|
62073
62900
|
return accumulator;
|
|
62074
62901
|
}
|
|
62075
|
-
function baseInvoke(object,
|
|
62076
|
-
|
|
62077
|
-
object = parent(object,
|
|
62078
|
-
var func = object == null ? object : object[toKey(last(
|
|
62902
|
+
function baseInvoke(object, path10, args) {
|
|
62903
|
+
path10 = castPath(path10, object);
|
|
62904
|
+
object = parent(object, path10);
|
|
62905
|
+
var func = object == null ? object : object[toKey(last(path10))];
|
|
62079
62906
|
return func == null ? undefined2 : apply(func, object, args);
|
|
62080
62907
|
}
|
|
62081
62908
|
function baseIsArguments(value) {
|
|
@@ -62231,13 +63058,13 @@ var require_lodash = __commonJS({
|
|
|
62231
63058
|
return object === source || baseIsMatch(object, source, matchData);
|
|
62232
63059
|
};
|
|
62233
63060
|
}
|
|
62234
|
-
function baseMatchesProperty(
|
|
62235
|
-
if (isKey(
|
|
62236
|
-
return matchesStrictComparable(toKey(
|
|
63061
|
+
function baseMatchesProperty(path10, srcValue) {
|
|
63062
|
+
if (isKey(path10) && isStrictComparable(srcValue)) {
|
|
63063
|
+
return matchesStrictComparable(toKey(path10), srcValue);
|
|
62237
63064
|
}
|
|
62238
63065
|
return function(object) {
|
|
62239
|
-
var objValue = get(object,
|
|
62240
|
-
return objValue === undefined2 && objValue === srcValue ? hasIn(object,
|
|
63066
|
+
var objValue = get(object, path10);
|
|
63067
|
+
return objValue === undefined2 && objValue === srcValue ? hasIn(object, path10) : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
|
|
62241
63068
|
};
|
|
62242
63069
|
}
|
|
62243
63070
|
function baseMerge(object, source, srcIndex, customizer, stack) {
|
|
@@ -62334,23 +63161,23 @@ var require_lodash = __commonJS({
|
|
|
62334
63161
|
});
|
|
62335
63162
|
}
|
|
62336
63163
|
function basePick(object, paths) {
|
|
62337
|
-
return basePickBy(object, paths, function(value,
|
|
62338
|
-
return hasIn(object,
|
|
63164
|
+
return basePickBy(object, paths, function(value, path10) {
|
|
63165
|
+
return hasIn(object, path10);
|
|
62339
63166
|
});
|
|
62340
63167
|
}
|
|
62341
63168
|
function basePickBy(object, paths, predicate) {
|
|
62342
63169
|
var index = -1, length = paths.length, result2 = {};
|
|
62343
63170
|
while (++index < length) {
|
|
62344
|
-
var
|
|
62345
|
-
if (predicate(value,
|
|
62346
|
-
baseSet(result2, castPath(
|
|
63171
|
+
var path10 = paths[index], value = baseGet(object, path10);
|
|
63172
|
+
if (predicate(value, path10)) {
|
|
63173
|
+
baseSet(result2, castPath(path10, object), value);
|
|
62347
63174
|
}
|
|
62348
63175
|
}
|
|
62349
63176
|
return result2;
|
|
62350
63177
|
}
|
|
62351
|
-
function basePropertyDeep(
|
|
63178
|
+
function basePropertyDeep(path10) {
|
|
62352
63179
|
return function(object) {
|
|
62353
|
-
return baseGet(object,
|
|
63180
|
+
return baseGet(object, path10);
|
|
62354
63181
|
};
|
|
62355
63182
|
}
|
|
62356
63183
|
function basePullAll(array, values2, iteratee2, comparator) {
|
|
@@ -62424,14 +63251,14 @@ var require_lodash = __commonJS({
|
|
|
62424
63251
|
var array = values(collection);
|
|
62425
63252
|
return shuffleSelf(array, baseClamp(n, 0, array.length));
|
|
62426
63253
|
}
|
|
62427
|
-
function baseSet(object,
|
|
63254
|
+
function baseSet(object, path10, value, customizer) {
|
|
62428
63255
|
if (!isObject(object)) {
|
|
62429
63256
|
return object;
|
|
62430
63257
|
}
|
|
62431
|
-
|
|
62432
|
-
var index = -1, length =
|
|
63258
|
+
path10 = castPath(path10, object);
|
|
63259
|
+
var index = -1, length = path10.length, lastIndex = length - 1, nested = object;
|
|
62433
63260
|
while (nested != null && ++index < length) {
|
|
62434
|
-
var key = toKey(
|
|
63261
|
+
var key = toKey(path10[index]), newValue = value;
|
|
62435
63262
|
if (key === "__proto__" || key === "constructor" || key === "prototype") {
|
|
62436
63263
|
return object;
|
|
62437
63264
|
}
|
|
@@ -62439,7 +63266,7 @@ var require_lodash = __commonJS({
|
|
|
62439
63266
|
var objValue = nested[key];
|
|
62440
63267
|
newValue = customizer ? customizer(objValue, key, nested) : undefined2;
|
|
62441
63268
|
if (newValue === undefined2) {
|
|
62442
|
-
newValue = isObject(objValue) ? objValue : isIndex(
|
|
63269
|
+
newValue = isObject(objValue) ? objValue : isIndex(path10[index + 1]) ? [] : {};
|
|
62443
63270
|
}
|
|
62444
63271
|
}
|
|
62445
63272
|
assignValue(nested, key, newValue);
|
|
@@ -62605,14 +63432,14 @@ var require_lodash = __commonJS({
|
|
|
62605
63432
|
}
|
|
62606
63433
|
return result2;
|
|
62607
63434
|
}
|
|
62608
|
-
function baseUnset(object,
|
|
62609
|
-
|
|
62610
|
-
var index = -1, length =
|
|
63435
|
+
function baseUnset(object, path10) {
|
|
63436
|
+
path10 = castPath(path10, object);
|
|
63437
|
+
var index = -1, length = path10.length;
|
|
62611
63438
|
if (!length) {
|
|
62612
63439
|
return true;
|
|
62613
63440
|
}
|
|
62614
63441
|
while (++index < length) {
|
|
62615
|
-
var key = toKey(
|
|
63442
|
+
var key = toKey(path10[index]);
|
|
62616
63443
|
if (key === "__proto__" && !hasOwnProperty.call(object, "__proto__")) {
|
|
62617
63444
|
return false;
|
|
62618
63445
|
}
|
|
@@ -62620,11 +63447,11 @@ var require_lodash = __commonJS({
|
|
|
62620
63447
|
return false;
|
|
62621
63448
|
}
|
|
62622
63449
|
}
|
|
62623
|
-
var obj = parent(object,
|
|
62624
|
-
return obj == null || delete obj[toKey(last(
|
|
63450
|
+
var obj = parent(object, path10);
|
|
63451
|
+
return obj == null || delete obj[toKey(last(path10))];
|
|
62625
63452
|
}
|
|
62626
|
-
function baseUpdate(object,
|
|
62627
|
-
return baseSet(object,
|
|
63453
|
+
function baseUpdate(object, path10, updater, customizer) {
|
|
63454
|
+
return baseSet(object, path10, updater(baseGet(object, path10)), customizer);
|
|
62628
63455
|
}
|
|
62629
63456
|
function baseWhile(array, predicate, isDrop, fromRight) {
|
|
62630
63457
|
var length = array.length, index = fromRight ? length : -1;
|
|
@@ -63507,11 +64334,11 @@ var require_lodash = __commonJS({
|
|
|
63507
64334
|
var match = source.match(reWrapDetails);
|
|
63508
64335
|
return match ? match[1].split(reSplitDetails) : [];
|
|
63509
64336
|
}
|
|
63510
|
-
function hasPath(object,
|
|
63511
|
-
|
|
63512
|
-
var index = -1, length =
|
|
64337
|
+
function hasPath(object, path10, hasFunc) {
|
|
64338
|
+
path10 = castPath(path10, object);
|
|
64339
|
+
var index = -1, length = path10.length, result2 = false;
|
|
63513
64340
|
while (++index < length) {
|
|
63514
|
-
var key = toKey(
|
|
64341
|
+
var key = toKey(path10[index]);
|
|
63515
64342
|
if (!(result2 = object != null && hasFunc(object, key))) {
|
|
63516
64343
|
break;
|
|
63517
64344
|
}
|
|
@@ -63713,8 +64540,8 @@ var require_lodash = __commonJS({
|
|
|
63713
64540
|
return apply(func, this, otherArgs);
|
|
63714
64541
|
};
|
|
63715
64542
|
}
|
|
63716
|
-
function parent(object,
|
|
63717
|
-
return
|
|
64543
|
+
function parent(object, path10) {
|
|
64544
|
+
return path10.length < 2 ? object : baseGet(object, baseSlice(path10, 0, -1));
|
|
63718
64545
|
}
|
|
63719
64546
|
function reorder(array, indexes) {
|
|
63720
64547
|
var arrLength = array.length, length = nativeMin(indexes.length, arrLength), oldArray = copyArray(array);
|
|
@@ -64349,10 +65176,10 @@ var require_lodash = __commonJS({
|
|
|
64349
65176
|
}
|
|
64350
65177
|
return isString(collection) ? fromIndex <= length && collection.indexOf(value, fromIndex) > -1 : !!length && baseIndexOf(collection, value, fromIndex) > -1;
|
|
64351
65178
|
}
|
|
64352
|
-
var invokeMap = baseRest(function(collection,
|
|
64353
|
-
var index = -1, isFunc = typeof
|
|
65179
|
+
var invokeMap = baseRest(function(collection, path10, args) {
|
|
65180
|
+
var index = -1, isFunc = typeof path10 == "function", result2 = isArrayLike(collection) ? Array2(collection.length) : [];
|
|
64354
65181
|
baseEach(collection, function(value) {
|
|
64355
|
-
result2[++index] = isFunc ? apply(
|
|
65182
|
+
result2[++index] = isFunc ? apply(path10, value, args) : baseInvoke(value, path10, args);
|
|
64356
65183
|
});
|
|
64357
65184
|
return result2;
|
|
64358
65185
|
});
|
|
@@ -65004,15 +65831,15 @@ var require_lodash = __commonJS({
|
|
|
65004
65831
|
function functionsIn(object) {
|
|
65005
65832
|
return object == null ? [] : baseFunctions(object, keysIn(object));
|
|
65006
65833
|
}
|
|
65007
|
-
function get(object,
|
|
65008
|
-
var result2 = object == null ? undefined2 : baseGet(object,
|
|
65834
|
+
function get(object, path10, defaultValue) {
|
|
65835
|
+
var result2 = object == null ? undefined2 : baseGet(object, path10);
|
|
65009
65836
|
return result2 === undefined2 ? defaultValue : result2;
|
|
65010
65837
|
}
|
|
65011
|
-
function has(object,
|
|
65012
|
-
return object != null && hasPath(object,
|
|
65838
|
+
function has(object, path10) {
|
|
65839
|
+
return object != null && hasPath(object, path10, baseHas);
|
|
65013
65840
|
}
|
|
65014
|
-
function hasIn(object,
|
|
65015
|
-
return object != null && hasPath(object,
|
|
65841
|
+
function hasIn(object, path10) {
|
|
65842
|
+
return object != null && hasPath(object, path10, baseHasIn);
|
|
65016
65843
|
}
|
|
65017
65844
|
var invert = createInverter(function(result2, value, key) {
|
|
65018
65845
|
if (value != null && typeof value.toString != "function") {
|
|
@@ -65065,10 +65892,10 @@ var require_lodash = __commonJS({
|
|
|
65065
65892
|
return result2;
|
|
65066
65893
|
}
|
|
65067
65894
|
var isDeep = false;
|
|
65068
|
-
paths = arrayMap(paths, function(
|
|
65069
|
-
|
|
65070
|
-
isDeep || (isDeep =
|
|
65071
|
-
return
|
|
65895
|
+
paths = arrayMap(paths, function(path10) {
|
|
65896
|
+
path10 = castPath(path10, object);
|
|
65897
|
+
isDeep || (isDeep = path10.length > 1);
|
|
65898
|
+
return path10;
|
|
65072
65899
|
});
|
|
65073
65900
|
copyObject(object, getAllKeysIn(object), result2);
|
|
65074
65901
|
if (isDeep) {
|
|
@@ -65094,19 +65921,19 @@ var require_lodash = __commonJS({
|
|
|
65094
65921
|
return [prop];
|
|
65095
65922
|
});
|
|
65096
65923
|
predicate = getIteratee(predicate);
|
|
65097
|
-
return basePickBy(object, props, function(value,
|
|
65098
|
-
return predicate(value,
|
|
65924
|
+
return basePickBy(object, props, function(value, path10) {
|
|
65925
|
+
return predicate(value, path10[0]);
|
|
65099
65926
|
});
|
|
65100
65927
|
}
|
|
65101
|
-
function result(object,
|
|
65102
|
-
|
|
65103
|
-
var index = -1, length =
|
|
65928
|
+
function result(object, path10, defaultValue) {
|
|
65929
|
+
path10 = castPath(path10, object);
|
|
65930
|
+
var index = -1, length = path10.length;
|
|
65104
65931
|
if (!length) {
|
|
65105
65932
|
length = 1;
|
|
65106
65933
|
object = undefined2;
|
|
65107
65934
|
}
|
|
65108
65935
|
while (++index < length) {
|
|
65109
|
-
var value = object == null ? undefined2 : object[toKey(
|
|
65936
|
+
var value = object == null ? undefined2 : object[toKey(path10[index])];
|
|
65110
65937
|
if (value === undefined2) {
|
|
65111
65938
|
index = length;
|
|
65112
65939
|
value = defaultValue;
|
|
@@ -65115,12 +65942,12 @@ var require_lodash = __commonJS({
|
|
|
65115
65942
|
}
|
|
65116
65943
|
return object;
|
|
65117
65944
|
}
|
|
65118
|
-
function set(object,
|
|
65119
|
-
return object == null ? object : baseSet(object,
|
|
65945
|
+
function set(object, path10, value) {
|
|
65946
|
+
return object == null ? object : baseSet(object, path10, value);
|
|
65120
65947
|
}
|
|
65121
|
-
function setWith(object,
|
|
65948
|
+
function setWith(object, path10, value, customizer) {
|
|
65122
65949
|
customizer = typeof customizer == "function" ? customizer : undefined2;
|
|
65123
|
-
return object == null ? object : baseSet(object,
|
|
65950
|
+
return object == null ? object : baseSet(object, path10, value, customizer);
|
|
65124
65951
|
}
|
|
65125
65952
|
var toPairs = createToPairs(keys);
|
|
65126
65953
|
var toPairsIn = createToPairs(keysIn);
|
|
@@ -65142,15 +65969,15 @@ var require_lodash = __commonJS({
|
|
|
65142
65969
|
});
|
|
65143
65970
|
return accumulator;
|
|
65144
65971
|
}
|
|
65145
|
-
function unset(object,
|
|
65146
|
-
return object == null ? true : baseUnset(object,
|
|
65972
|
+
function unset(object, path10) {
|
|
65973
|
+
return object == null ? true : baseUnset(object, path10);
|
|
65147
65974
|
}
|
|
65148
|
-
function update(object,
|
|
65149
|
-
return object == null ? object : baseUpdate(object,
|
|
65975
|
+
function update(object, path10, updater) {
|
|
65976
|
+
return object == null ? object : baseUpdate(object, path10, castFunction(updater));
|
|
65150
65977
|
}
|
|
65151
|
-
function updateWith(object,
|
|
65978
|
+
function updateWith(object, path10, updater, customizer) {
|
|
65152
65979
|
customizer = typeof customizer == "function" ? customizer : undefined2;
|
|
65153
|
-
return object == null ? object : baseUpdate(object,
|
|
65980
|
+
return object == null ? object : baseUpdate(object, path10, castFunction(updater), customizer);
|
|
65154
65981
|
}
|
|
65155
65982
|
function values(object) {
|
|
65156
65983
|
return object == null ? [] : baseValues(object, keys(object));
|
|
@@ -65536,17 +66363,17 @@ var require_lodash = __commonJS({
|
|
|
65536
66363
|
function matches(source) {
|
|
65537
66364
|
return baseMatches(baseClone(source, CLONE_DEEP_FLAG));
|
|
65538
66365
|
}
|
|
65539
|
-
function matchesProperty(
|
|
65540
|
-
return baseMatchesProperty(
|
|
66366
|
+
function matchesProperty(path10, srcValue) {
|
|
66367
|
+
return baseMatchesProperty(path10, baseClone(srcValue, CLONE_DEEP_FLAG));
|
|
65541
66368
|
}
|
|
65542
|
-
var method = baseRest(function(
|
|
66369
|
+
var method = baseRest(function(path10, args) {
|
|
65543
66370
|
return function(object) {
|
|
65544
|
-
return baseInvoke(object,
|
|
66371
|
+
return baseInvoke(object, path10, args);
|
|
65545
66372
|
};
|
|
65546
66373
|
});
|
|
65547
66374
|
var methodOf = baseRest(function(object, args) {
|
|
65548
|
-
return function(
|
|
65549
|
-
return baseInvoke(object,
|
|
66375
|
+
return function(path10) {
|
|
66376
|
+
return baseInvoke(object, path10, args);
|
|
65550
66377
|
};
|
|
65551
66378
|
});
|
|
65552
66379
|
function mixin(object, source, options) {
|
|
@@ -65593,12 +66420,12 @@ var require_lodash = __commonJS({
|
|
|
65593
66420
|
var over = createOver(arrayMap);
|
|
65594
66421
|
var overEvery = createOver(arrayEvery);
|
|
65595
66422
|
var overSome = createOver(arraySome);
|
|
65596
|
-
function property(
|
|
65597
|
-
return isKey(
|
|
66423
|
+
function property(path10) {
|
|
66424
|
+
return isKey(path10) ? baseProperty(toKey(path10)) : basePropertyDeep(path10);
|
|
65598
66425
|
}
|
|
65599
66426
|
function propertyOf(object) {
|
|
65600
|
-
return function(
|
|
65601
|
-
return object == null ? undefined2 : baseGet(object,
|
|
66427
|
+
return function(path10) {
|
|
66428
|
+
return object == null ? undefined2 : baseGet(object, path10);
|
|
65602
66429
|
};
|
|
65603
66430
|
}
|
|
65604
66431
|
var range = createRange();
|
|
@@ -66051,12 +66878,12 @@ var require_lodash = __commonJS({
|
|
|
66051
66878
|
LazyWrapper.prototype.findLast = function(predicate) {
|
|
66052
66879
|
return this.reverse().find(predicate);
|
|
66053
66880
|
};
|
|
66054
|
-
LazyWrapper.prototype.invokeMap = baseRest(function(
|
|
66055
|
-
if (typeof
|
|
66881
|
+
LazyWrapper.prototype.invokeMap = baseRest(function(path10, args) {
|
|
66882
|
+
if (typeof path10 == "function") {
|
|
66056
66883
|
return new LazyWrapper(this);
|
|
66057
66884
|
}
|
|
66058
66885
|
return this.map(function(value) {
|
|
66059
|
-
return baseInvoke(value,
|
|
66886
|
+
return baseInvoke(value, path10, args);
|
|
66060
66887
|
});
|
|
66061
66888
|
});
|
|
66062
66889
|
LazyWrapper.prototype.reject = function(predicate) {
|
|
@@ -72340,7 +73167,7 @@ var require_url2 = __commonJS({
|
|
|
72340
73167
|
*/
|
|
72341
73168
|
update(url) {
|
|
72342
73169
|
!url && (url = E);
|
|
72343
|
-
var parsedUrl = _.isString(url) ? Url.parse(url) : url, auth = parsedUrl.auth, protocol = parsedUrl.protocol, port = parsedUrl.port,
|
|
73170
|
+
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;
|
|
72344
73171
|
if (query) {
|
|
72345
73172
|
if (_.isString(query)) {
|
|
72346
73173
|
query = QueryParam.parse(query);
|
|
@@ -72360,9 +73187,9 @@ var require_url2 = __commonJS({
|
|
|
72360
73187
|
return v;
|
|
72361
73188
|
});
|
|
72362
73189
|
}
|
|
72363
|
-
if (_.isString(
|
|
72364
|
-
|
|
72365
|
-
|
|
73190
|
+
if (_.isString(path10)) {
|
|
73191
|
+
path10 && (path10 = path10.replace(regexes.trimPath, MATCH_1));
|
|
73192
|
+
path10 = path10 ? path10 === PATH_SEPARATOR ? [E] : path10.split(PATH_SEPARATOR) : void 0;
|
|
72366
73193
|
}
|
|
72367
73194
|
_.isString(host) && (host = host.split(regexes.splitDomain));
|
|
72368
73195
|
_.assign(
|
|
@@ -72384,7 +73211,7 @@ var require_url2 = __commonJS({
|
|
|
72384
73211
|
/**
|
|
72385
73212
|
* @type {Array<String>}
|
|
72386
73213
|
*/
|
|
72387
|
-
path:
|
|
73214
|
+
path: path10,
|
|
72388
73215
|
/**
|
|
72389
73216
|
* @type {String}
|
|
72390
73217
|
*/
|
|
@@ -72526,11 +73353,11 @@ var require_url2 = __commonJS({
|
|
|
72526
73353
|
* @example /something/postman?hi=notbye
|
|
72527
73354
|
*/
|
|
72528
73355
|
getPathWithQuery() {
|
|
72529
|
-
var
|
|
73356
|
+
var path10 = this.getPath(), queryString = this.getQueryString();
|
|
72530
73357
|
if (queryString) {
|
|
72531
|
-
|
|
73358
|
+
path10 += QUERY_SEPARATOR + queryString;
|
|
72532
73359
|
}
|
|
72533
|
-
return
|
|
73360
|
+
return path10;
|
|
72534
73361
|
},
|
|
72535
73362
|
/**
|
|
72536
73363
|
* Returns the host part of the URL
|
|
@@ -72570,9 +73397,9 @@ var require_url2 = __commonJS({
|
|
|
72570
73397
|
* @note not discontinue yet because it's used in Twitter APIs public collections
|
|
72571
73398
|
*/
|
|
72572
73399
|
getOAuth1BaseUrl() {
|
|
72573
|
-
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,
|
|
73400
|
+
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();
|
|
72574
73401
|
protocol = _.endsWith(protocol, PROTOCOL_SEPARATOR) ? protocol : protocol + PROTOCOL_SEPARATOR;
|
|
72575
|
-
return protocol.toLowerCase() + host.toLowerCase() +
|
|
73402
|
+
return protocol.toLowerCase() + host.toLowerCase() + path10;
|
|
72576
73403
|
}
|
|
72577
73404
|
}
|
|
72578
73405
|
);
|
|
@@ -72827,9 +73654,9 @@ var require_url_match_pattern = __commonJS({
|
|
|
72827
73654
|
* @param {String=} path The path to be checked if the pattern allows.
|
|
72828
73655
|
* @returns {Boolean=}
|
|
72829
73656
|
*/
|
|
72830
|
-
testPath(
|
|
73657
|
+
testPath(path10) {
|
|
72831
73658
|
var matchRegexObject = this._matchPatternObject;
|
|
72832
|
-
return !_.isEmpty(
|
|
73659
|
+
return !_.isEmpty(path10.match(matchRegexObject.path));
|
|
72833
73660
|
},
|
|
72834
73661
|
/**
|
|
72835
73662
|
* Tests the url string with the match pattern provided.
|
|
@@ -74578,7 +75405,7 @@ var require_request13 = __commonJS({
|
|
|
74578
75405
|
var HeaderList = require_header_list().HeaderList;
|
|
74579
75406
|
var RequestBody = require_request_body2().RequestBody;
|
|
74580
75407
|
var RequestAuth = require_request_auth().RequestAuth;
|
|
74581
|
-
var
|
|
75408
|
+
var Request2;
|
|
74582
75409
|
var DEFAULT_REQ_METHOD = "GET";
|
|
74583
75410
|
var CONTENT_LENGTH = "Content-Length";
|
|
74584
75411
|
var SP = " ";
|
|
@@ -74597,8 +75424,8 @@ var require_request13 = __commonJS({
|
|
|
74597
75424
|
* @extends {Property}
|
|
74598
75425
|
* @param {Request.definition} options -
|
|
74599
75426
|
*/
|
|
74600
|
-
|
|
74601
|
-
|
|
75427
|
+
Request2 = function PostmanRequest(options) {
|
|
75428
|
+
Request2.super_.apply(this, arguments);
|
|
74602
75429
|
typeof options === "string" && (options = {
|
|
74603
75430
|
url: options
|
|
74604
75431
|
});
|
|
@@ -74628,7 +75455,7 @@ var require_request13 = __commonJS({
|
|
|
74628
75455
|
Property
|
|
74629
75456
|
);
|
|
74630
75457
|
_.assign(
|
|
74631
|
-
|
|
75458
|
+
Request2.prototype,
|
|
74632
75459
|
/** @lends Request.prototype */
|
|
74633
75460
|
{
|
|
74634
75461
|
/**
|
|
@@ -74830,12 +75657,12 @@ var require_request13 = __commonJS({
|
|
|
74830
75657
|
* @returns {Request}
|
|
74831
75658
|
*/
|
|
74832
75659
|
clone: function() {
|
|
74833
|
-
return new
|
|
75660
|
+
return new Request2(this.toJSON());
|
|
74834
75661
|
}
|
|
74835
75662
|
}
|
|
74836
75663
|
);
|
|
74837
75664
|
_.assign(
|
|
74838
|
-
|
|
75665
|
+
Request2,
|
|
74839
75666
|
/** @lends Request */
|
|
74840
75667
|
{
|
|
74841
75668
|
/**
|
|
@@ -74853,12 +75680,12 @@ var require_request13 = __commonJS({
|
|
|
74853
75680
|
* @returns {Boolean}
|
|
74854
75681
|
*/
|
|
74855
75682
|
isRequest: function(obj) {
|
|
74856
|
-
return Boolean(obj) && (obj instanceof
|
|
75683
|
+
return Boolean(obj) && (obj instanceof Request2 || _.inSuperChain(obj.constructor, "_postman_propertyName", Request2._postman_propertyName));
|
|
74857
75684
|
}
|
|
74858
75685
|
}
|
|
74859
75686
|
);
|
|
74860
75687
|
module2.exports = {
|
|
74861
|
-
Request
|
|
75688
|
+
Request: Request2
|
|
74862
75689
|
};
|
|
74863
75690
|
}
|
|
74864
75691
|
});
|
|
@@ -76603,11 +77430,11 @@ var require_Mime = __commonJS({
|
|
|
76603
77430
|
}
|
|
76604
77431
|
}
|
|
76605
77432
|
};
|
|
76606
|
-
Mime.prototype.getType = function(
|
|
76607
|
-
|
|
76608
|
-
let last =
|
|
77433
|
+
Mime.prototype.getType = function(path10) {
|
|
77434
|
+
path10 = String(path10);
|
|
77435
|
+
let last = path10.replace(/^.*[/\\]/, "").toLowerCase();
|
|
76609
77436
|
let ext = last.replace(/^.*\./, "").toLowerCase();
|
|
76610
|
-
let hasPath = last.length <
|
|
77437
|
+
let hasPath = last.length < path10.length;
|
|
76611
77438
|
let hasDot = ext.length < last.length - 1;
|
|
76612
77439
|
return (hasDot || !hasPath) && this._types[ext] || null;
|
|
76613
77440
|
};
|
|
@@ -78838,7 +79665,7 @@ var require_response2 = __commonJS({
|
|
|
78838
79665
|
var LJSON = require_liquid_json();
|
|
78839
79666
|
var Property = require_property().Property;
|
|
78840
79667
|
var PropertyBase = require_property_base().PropertyBase;
|
|
78841
|
-
var
|
|
79668
|
+
var Request2 = require_request13().Request;
|
|
78842
79669
|
var CookieList = require_cookie_list().CookieList;
|
|
78843
79670
|
var HeaderList = require_header_list().HeaderList;
|
|
78844
79671
|
var contentInfo = require_content_info().contentInfo;
|
|
@@ -78909,7 +79736,7 @@ var require_response2 = __commonJS({
|
|
|
78909
79736
|
/**
|
|
78910
79737
|
* @type {Request}
|
|
78911
79738
|
*/
|
|
78912
|
-
originalRequest: options.originalRequest ? new
|
|
79739
|
+
originalRequest: options.originalRequest ? new Request2(options.originalRequest) : void 0,
|
|
78913
79740
|
/**
|
|
78914
79741
|
* @type {String}
|
|
78915
79742
|
*/
|
|
@@ -79256,7 +80083,7 @@ var require_item = __commonJS({
|
|
|
79256
80083
|
var Property = require_property().Property;
|
|
79257
80084
|
var PropertyList = require_property_list().PropertyList;
|
|
79258
80085
|
var EventList = require_event_list().EventList;
|
|
79259
|
-
var
|
|
80086
|
+
var Request2 = require_request13().Request;
|
|
79260
80087
|
var RequestAuth = require_request_auth().RequestAuth;
|
|
79261
80088
|
var Response2 = require_response2().Response;
|
|
79262
80089
|
var Item;
|
|
@@ -79317,7 +80144,7 @@ var require_item = __commonJS({
|
|
|
79317
80144
|
*
|
|
79318
80145
|
* @type {Request}
|
|
79319
80146
|
*/
|
|
79320
|
-
request: definition && new
|
|
80147
|
+
request: definition && new Request2(definition.request),
|
|
79321
80148
|
/**
|
|
79322
80149
|
* An Item also contains a list of sample responses that is expected when the request defined in the item is
|
|
79323
80150
|
* executed. The sample responses are useful in elaborating API usage and is also useful for other
|
|
@@ -79504,7 +80331,7 @@ var require_item = __commonJS({
|
|
|
79504
80331
|
*/
|
|
79505
80332
|
authorizeRequestUsing: function(type, options) {
|
|
79506
80333
|
if (!this.request) {
|
|
79507
|
-
this.request = new
|
|
80334
|
+
this.request = new Request2();
|
|
79508
80335
|
}
|
|
79509
80336
|
return this.request.authorizeUsing(type, options);
|
|
79510
80337
|
},
|
|
@@ -79514,12 +80341,12 @@ var require_item = __commonJS({
|
|
|
79514
80341
|
* @returns {Array<string>}
|
|
79515
80342
|
*/
|
|
79516
80343
|
getPath: function() {
|
|
79517
|
-
const
|
|
79518
|
-
|
|
80344
|
+
const path10 = [], pushItem = (item) => {
|
|
80345
|
+
path10.push(item.name);
|
|
79519
80346
|
};
|
|
79520
80347
|
pushItem(this);
|
|
79521
80348
|
this.forEachParent({ withRoot: true }, pushItem);
|
|
79522
|
-
return
|
|
80349
|
+
return path10.reverse();
|
|
79523
80350
|
}
|
|
79524
80351
|
}
|
|
79525
80352
|
);
|
|
@@ -79560,7 +80387,7 @@ var require_item_group = __commonJS({
|
|
|
79560
80387
|
var PropertyList = require_property_list().PropertyList;
|
|
79561
80388
|
var EventList = require_event_list().EventList;
|
|
79562
80389
|
var Item = require_item().Item;
|
|
79563
|
-
var
|
|
80390
|
+
var Request2 = require_request13().Request;
|
|
79564
80391
|
var RequestAuth = require_request_auth().RequestAuth;
|
|
79565
80392
|
var ItemGroup;
|
|
79566
80393
|
var OBJECT = "object";
|
|
@@ -79800,7 +80627,7 @@ var require_item_group = __commonJS({
|
|
|
79800
80627
|
* @note This function was previously (in v2 of SDK) used to clone request and populate headers. Now it is used to
|
|
79801
80628
|
* only set auth information to request
|
|
79802
80629
|
*/
|
|
79803
|
-
authorizeRequestsUsing:
|
|
80630
|
+
authorizeRequestsUsing: Request2.prototype.authorizeUsing
|
|
79804
80631
|
}
|
|
79805
80632
|
);
|
|
79806
80633
|
_.assign(
|
|
@@ -85239,8 +86066,8 @@ var require_Trie = __commonJS({
|
|
|
85239
86066
|
throw new Error("Trie.insert: key cannot be null or undefined");
|
|
85240
86067
|
}
|
|
85241
86068
|
let node = this.root;
|
|
85242
|
-
const
|
|
85243
|
-
for (const segment of
|
|
86069
|
+
const path10 = this.getPath(key);
|
|
86070
|
+
for (const segment of path10) {
|
|
85244
86071
|
if (!node.children.has(segment)) {
|
|
85245
86072
|
node.children.set(segment, new TrieNode());
|
|
85246
86073
|
}
|
|
@@ -85257,8 +86084,8 @@ var require_Trie = __commonJS({
|
|
|
85257
86084
|
return [];
|
|
85258
86085
|
}
|
|
85259
86086
|
let node = this.root;
|
|
85260
|
-
const
|
|
85261
|
-
for (const segment of
|
|
86087
|
+
const path10 = this.getPath(prefix);
|
|
86088
|
+
for (const segment of path10) {
|
|
85262
86089
|
const child2 = node.children.get(segment);
|
|
85263
86090
|
if (!child2) {
|
|
85264
86091
|
return [];
|
|
@@ -85274,8 +86101,8 @@ var require_Trie = __commonJS({
|
|
|
85274
86101
|
return [];
|
|
85275
86102
|
}
|
|
85276
86103
|
let node = this.root;
|
|
85277
|
-
const
|
|
85278
|
-
for (const segment of
|
|
86104
|
+
const path10 = this.getPath(prefix);
|
|
86105
|
+
for (const segment of path10) {
|
|
85279
86106
|
const child2 = node.children.get(segment);
|
|
85280
86107
|
if (!child2) {
|
|
85281
86108
|
return [];
|
|
@@ -85283,7 +86110,7 @@ var require_Trie = __commonJS({
|
|
|
85283
86110
|
node = child2;
|
|
85284
86111
|
}
|
|
85285
86112
|
const results = [];
|
|
85286
|
-
this._collectEntries(node,
|
|
86113
|
+
this._collectEntries(node, path10, results);
|
|
85287
86114
|
return results;
|
|
85288
86115
|
}
|
|
85289
86116
|
get(key) {
|
|
@@ -85291,8 +86118,8 @@ var require_Trie = __commonJS({
|
|
|
85291
86118
|
return void 0;
|
|
85292
86119
|
}
|
|
85293
86120
|
let node = this.root;
|
|
85294
|
-
const
|
|
85295
|
-
for (const segment of
|
|
86121
|
+
const path10 = this.getPath(key);
|
|
86122
|
+
for (const segment of path10) {
|
|
85296
86123
|
const child2 = node.children.get(segment);
|
|
85297
86124
|
if (!child2) {
|
|
85298
86125
|
return void 0;
|
|
@@ -85306,8 +86133,8 @@ var require_Trie = __commonJS({
|
|
|
85306
86133
|
return false;
|
|
85307
86134
|
}
|
|
85308
86135
|
let node = this.root;
|
|
85309
|
-
const
|
|
85310
|
-
for (const segment of
|
|
86136
|
+
const path10 = this.getPath(key);
|
|
86137
|
+
for (const segment of path10) {
|
|
85311
86138
|
const child2 = node.children.get(segment);
|
|
85312
86139
|
if (!child2) {
|
|
85313
86140
|
return false;
|
|
@@ -88616,17 +89443,17 @@ var require_visit = __commonJS({
|
|
|
88616
89443
|
visit2.BREAK = BREAK;
|
|
88617
89444
|
visit2.SKIP = SKIP;
|
|
88618
89445
|
visit2.REMOVE = REMOVE;
|
|
88619
|
-
function visit_(key, node, visitor,
|
|
88620
|
-
const ctrl = callVisitor(key, node, visitor,
|
|
89446
|
+
function visit_(key, node, visitor, path10) {
|
|
89447
|
+
const ctrl = callVisitor(key, node, visitor, path10);
|
|
88621
89448
|
if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
|
|
88622
|
-
replaceNode(key,
|
|
88623
|
-
return visit_(key, ctrl, visitor,
|
|
89449
|
+
replaceNode(key, path10, ctrl);
|
|
89450
|
+
return visit_(key, ctrl, visitor, path10);
|
|
88624
89451
|
}
|
|
88625
89452
|
if (typeof ctrl !== "symbol") {
|
|
88626
89453
|
if (identity.isCollection(node)) {
|
|
88627
|
-
|
|
89454
|
+
path10 = Object.freeze(path10.concat(node));
|
|
88628
89455
|
for (let i = 0; i < node.items.length; ++i) {
|
|
88629
|
-
const ci = visit_(i, node.items[i], visitor,
|
|
89456
|
+
const ci = visit_(i, node.items[i], visitor, path10);
|
|
88630
89457
|
if (typeof ci === "number")
|
|
88631
89458
|
i = ci - 1;
|
|
88632
89459
|
else if (ci === BREAK)
|
|
@@ -88637,13 +89464,13 @@ var require_visit = __commonJS({
|
|
|
88637
89464
|
}
|
|
88638
89465
|
}
|
|
88639
89466
|
} else if (identity.isPair(node)) {
|
|
88640
|
-
|
|
88641
|
-
const ck = visit_("key", node.key, visitor,
|
|
89467
|
+
path10 = Object.freeze(path10.concat(node));
|
|
89468
|
+
const ck = visit_("key", node.key, visitor, path10);
|
|
88642
89469
|
if (ck === BREAK)
|
|
88643
89470
|
return BREAK;
|
|
88644
89471
|
else if (ck === REMOVE)
|
|
88645
89472
|
node.key = null;
|
|
88646
|
-
const cv = visit_("value", node.value, visitor,
|
|
89473
|
+
const cv = visit_("value", node.value, visitor, path10);
|
|
88647
89474
|
if (cv === BREAK)
|
|
88648
89475
|
return BREAK;
|
|
88649
89476
|
else if (cv === REMOVE)
|
|
@@ -88664,17 +89491,17 @@ var require_visit = __commonJS({
|
|
|
88664
89491
|
visitAsync.BREAK = BREAK;
|
|
88665
89492
|
visitAsync.SKIP = SKIP;
|
|
88666
89493
|
visitAsync.REMOVE = REMOVE;
|
|
88667
|
-
async function visitAsync_(key, node, visitor,
|
|
88668
|
-
const ctrl = await callVisitor(key, node, visitor,
|
|
89494
|
+
async function visitAsync_(key, node, visitor, path10) {
|
|
89495
|
+
const ctrl = await callVisitor(key, node, visitor, path10);
|
|
88669
89496
|
if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
|
|
88670
|
-
replaceNode(key,
|
|
88671
|
-
return visitAsync_(key, ctrl, visitor,
|
|
89497
|
+
replaceNode(key, path10, ctrl);
|
|
89498
|
+
return visitAsync_(key, ctrl, visitor, path10);
|
|
88672
89499
|
}
|
|
88673
89500
|
if (typeof ctrl !== "symbol") {
|
|
88674
89501
|
if (identity.isCollection(node)) {
|
|
88675
|
-
|
|
89502
|
+
path10 = Object.freeze(path10.concat(node));
|
|
88676
89503
|
for (let i = 0; i < node.items.length; ++i) {
|
|
88677
|
-
const ci = await visitAsync_(i, node.items[i], visitor,
|
|
89504
|
+
const ci = await visitAsync_(i, node.items[i], visitor, path10);
|
|
88678
89505
|
if (typeof ci === "number")
|
|
88679
89506
|
i = ci - 1;
|
|
88680
89507
|
else if (ci === BREAK)
|
|
@@ -88685,13 +89512,13 @@ var require_visit = __commonJS({
|
|
|
88685
89512
|
}
|
|
88686
89513
|
}
|
|
88687
89514
|
} else if (identity.isPair(node)) {
|
|
88688
|
-
|
|
88689
|
-
const ck = await visitAsync_("key", node.key, visitor,
|
|
89515
|
+
path10 = Object.freeze(path10.concat(node));
|
|
89516
|
+
const ck = await visitAsync_("key", node.key, visitor, path10);
|
|
88690
89517
|
if (ck === BREAK)
|
|
88691
89518
|
return BREAK;
|
|
88692
89519
|
else if (ck === REMOVE)
|
|
88693
89520
|
node.key = null;
|
|
88694
|
-
const cv = await visitAsync_("value", node.value, visitor,
|
|
89521
|
+
const cv = await visitAsync_("value", node.value, visitor, path10);
|
|
88695
89522
|
if (cv === BREAK)
|
|
88696
89523
|
return BREAK;
|
|
88697
89524
|
else if (cv === REMOVE)
|
|
@@ -88718,23 +89545,23 @@ var require_visit = __commonJS({
|
|
|
88718
89545
|
}
|
|
88719
89546
|
return visitor;
|
|
88720
89547
|
}
|
|
88721
|
-
function callVisitor(key, node, visitor,
|
|
89548
|
+
function callVisitor(key, node, visitor, path10) {
|
|
88722
89549
|
if (typeof visitor === "function")
|
|
88723
|
-
return visitor(key, node,
|
|
89550
|
+
return visitor(key, node, path10);
|
|
88724
89551
|
if (identity.isMap(node))
|
|
88725
|
-
return visitor.Map?.(key, node,
|
|
89552
|
+
return visitor.Map?.(key, node, path10);
|
|
88726
89553
|
if (identity.isSeq(node))
|
|
88727
|
-
return visitor.Seq?.(key, node,
|
|
89554
|
+
return visitor.Seq?.(key, node, path10);
|
|
88728
89555
|
if (identity.isPair(node))
|
|
88729
|
-
return visitor.Pair?.(key, node,
|
|
89556
|
+
return visitor.Pair?.(key, node, path10);
|
|
88730
89557
|
if (identity.isScalar(node))
|
|
88731
|
-
return visitor.Scalar?.(key, node,
|
|
89558
|
+
return visitor.Scalar?.(key, node, path10);
|
|
88732
89559
|
if (identity.isAlias(node))
|
|
88733
|
-
return visitor.Alias?.(key, node,
|
|
89560
|
+
return visitor.Alias?.(key, node, path10);
|
|
88734
89561
|
return void 0;
|
|
88735
89562
|
}
|
|
88736
|
-
function replaceNode(key,
|
|
88737
|
-
const parent =
|
|
89563
|
+
function replaceNode(key, path10, node) {
|
|
89564
|
+
const parent = path10[path10.length - 1];
|
|
88738
89565
|
if (identity.isCollection(parent)) {
|
|
88739
89566
|
parent.items[key] = node;
|
|
88740
89567
|
} else if (identity.isPair(parent)) {
|
|
@@ -89344,10 +90171,10 @@ var require_Collection = __commonJS({
|
|
|
89344
90171
|
var createNode = require_createNode();
|
|
89345
90172
|
var identity = require_identity();
|
|
89346
90173
|
var Node = require_Node();
|
|
89347
|
-
function collectionFromPath(schema,
|
|
90174
|
+
function collectionFromPath(schema, path10, value) {
|
|
89348
90175
|
let v = value;
|
|
89349
|
-
for (let i =
|
|
89350
|
-
const k =
|
|
90176
|
+
for (let i = path10.length - 1; i >= 0; --i) {
|
|
90177
|
+
const k = path10[i];
|
|
89351
90178
|
if (typeof k === "number" && Number.isInteger(k) && k >= 0) {
|
|
89352
90179
|
const a = [];
|
|
89353
90180
|
a[k] = v;
|
|
@@ -89366,7 +90193,7 @@ var require_Collection = __commonJS({
|
|
|
89366
90193
|
sourceObjects: /* @__PURE__ */ new Map()
|
|
89367
90194
|
});
|
|
89368
90195
|
}
|
|
89369
|
-
var isEmptyPath = (
|
|
90196
|
+
var isEmptyPath = (path10) => path10 == null || typeof path10 === "object" && !!path10[Symbol.iterator]().next().done;
|
|
89370
90197
|
var Collection2 = class extends Node.NodeBase {
|
|
89371
90198
|
constructor(type, schema) {
|
|
89372
90199
|
super(type);
|
|
@@ -89396,11 +90223,11 @@ var require_Collection = __commonJS({
|
|
|
89396
90223
|
* be a Pair instance or a `{ key, value }` object, which may not have a key
|
|
89397
90224
|
* that already exists in the map.
|
|
89398
90225
|
*/
|
|
89399
|
-
addIn(
|
|
89400
|
-
if (isEmptyPath(
|
|
90226
|
+
addIn(path10, value) {
|
|
90227
|
+
if (isEmptyPath(path10))
|
|
89401
90228
|
this.add(value);
|
|
89402
90229
|
else {
|
|
89403
|
-
const [key, ...rest] =
|
|
90230
|
+
const [key, ...rest] = path10;
|
|
89404
90231
|
const node = this.get(key, true);
|
|
89405
90232
|
if (identity.isCollection(node))
|
|
89406
90233
|
node.addIn(rest, value);
|
|
@@ -89414,8 +90241,8 @@ var require_Collection = __commonJS({
|
|
|
89414
90241
|
* Removes a value from the collection.
|
|
89415
90242
|
* @returns `true` if the item was found and removed.
|
|
89416
90243
|
*/
|
|
89417
|
-
deleteIn(
|
|
89418
|
-
const [key, ...rest] =
|
|
90244
|
+
deleteIn(path10) {
|
|
90245
|
+
const [key, ...rest] = path10;
|
|
89419
90246
|
if (rest.length === 0)
|
|
89420
90247
|
return this.delete(key);
|
|
89421
90248
|
const node = this.get(key, true);
|
|
@@ -89429,8 +90256,8 @@ var require_Collection = __commonJS({
|
|
|
89429
90256
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
89430
90257
|
* `true` (collections are always returned intact).
|
|
89431
90258
|
*/
|
|
89432
|
-
getIn(
|
|
89433
|
-
const [key, ...rest] =
|
|
90259
|
+
getIn(path10, keepScalar) {
|
|
90260
|
+
const [key, ...rest] = path10;
|
|
89434
90261
|
const node = this.get(key, true);
|
|
89435
90262
|
if (rest.length === 0)
|
|
89436
90263
|
return !keepScalar && identity.isScalar(node) ? node.value : node;
|
|
@@ -89448,8 +90275,8 @@ var require_Collection = __commonJS({
|
|
|
89448
90275
|
/**
|
|
89449
90276
|
* Checks if the collection includes a value with the key `key`.
|
|
89450
90277
|
*/
|
|
89451
|
-
hasIn(
|
|
89452
|
-
const [key, ...rest] =
|
|
90278
|
+
hasIn(path10) {
|
|
90279
|
+
const [key, ...rest] = path10;
|
|
89453
90280
|
if (rest.length === 0)
|
|
89454
90281
|
return this.has(key);
|
|
89455
90282
|
const node = this.get(key, true);
|
|
@@ -89459,8 +90286,8 @@ var require_Collection = __commonJS({
|
|
|
89459
90286
|
* Sets a value in this collection. For `!!set`, `value` needs to be a
|
|
89460
90287
|
* boolean to add/remove the item from the set.
|
|
89461
90288
|
*/
|
|
89462
|
-
setIn(
|
|
89463
|
-
const [key, ...rest] =
|
|
90289
|
+
setIn(path10, value) {
|
|
90290
|
+
const [key, ...rest] = path10;
|
|
89464
90291
|
if (rest.length === 0) {
|
|
89465
90292
|
this.set(key, value);
|
|
89466
90293
|
} else {
|
|
@@ -91975,9 +92802,9 @@ var require_Document = __commonJS({
|
|
|
91975
92802
|
this.contents.add(value);
|
|
91976
92803
|
}
|
|
91977
92804
|
/** Adds a value to the document. */
|
|
91978
|
-
addIn(
|
|
92805
|
+
addIn(path10, value) {
|
|
91979
92806
|
if (assertCollection(this.contents))
|
|
91980
|
-
this.contents.addIn(
|
|
92807
|
+
this.contents.addIn(path10, value);
|
|
91981
92808
|
}
|
|
91982
92809
|
/**
|
|
91983
92810
|
* Create a new `Alias` node, ensuring that the target `node` has the required anchor.
|
|
@@ -92052,14 +92879,14 @@ var require_Document = __commonJS({
|
|
|
92052
92879
|
* Removes a value from the document.
|
|
92053
92880
|
* @returns `true` if the item was found and removed.
|
|
92054
92881
|
*/
|
|
92055
|
-
deleteIn(
|
|
92056
|
-
if (Collection2.isEmptyPath(
|
|
92882
|
+
deleteIn(path10) {
|
|
92883
|
+
if (Collection2.isEmptyPath(path10)) {
|
|
92057
92884
|
if (this.contents == null)
|
|
92058
92885
|
return false;
|
|
92059
92886
|
this.contents = null;
|
|
92060
92887
|
return true;
|
|
92061
92888
|
}
|
|
92062
|
-
return assertCollection(this.contents) ? this.contents.deleteIn(
|
|
92889
|
+
return assertCollection(this.contents) ? this.contents.deleteIn(path10) : false;
|
|
92063
92890
|
}
|
|
92064
92891
|
/**
|
|
92065
92892
|
* Returns item at `key`, or `undefined` if not found. By default unwraps
|
|
@@ -92074,10 +92901,10 @@ var require_Document = __commonJS({
|
|
|
92074
92901
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
92075
92902
|
* `true` (collections are always returned intact).
|
|
92076
92903
|
*/
|
|
92077
|
-
getIn(
|
|
92078
|
-
if (Collection2.isEmptyPath(
|
|
92904
|
+
getIn(path10, keepScalar) {
|
|
92905
|
+
if (Collection2.isEmptyPath(path10))
|
|
92079
92906
|
return !keepScalar && identity.isScalar(this.contents) ? this.contents.value : this.contents;
|
|
92080
|
-
return identity.isCollection(this.contents) ? this.contents.getIn(
|
|
92907
|
+
return identity.isCollection(this.contents) ? this.contents.getIn(path10, keepScalar) : void 0;
|
|
92081
92908
|
}
|
|
92082
92909
|
/**
|
|
92083
92910
|
* Checks if the document includes a value with the key `key`.
|
|
@@ -92088,10 +92915,10 @@ var require_Document = __commonJS({
|
|
|
92088
92915
|
/**
|
|
92089
92916
|
* Checks if the document includes a value at `path`.
|
|
92090
92917
|
*/
|
|
92091
|
-
hasIn(
|
|
92092
|
-
if (Collection2.isEmptyPath(
|
|
92918
|
+
hasIn(path10) {
|
|
92919
|
+
if (Collection2.isEmptyPath(path10))
|
|
92093
92920
|
return this.contents !== void 0;
|
|
92094
|
-
return identity.isCollection(this.contents) ? this.contents.hasIn(
|
|
92921
|
+
return identity.isCollection(this.contents) ? this.contents.hasIn(path10) : false;
|
|
92095
92922
|
}
|
|
92096
92923
|
/**
|
|
92097
92924
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
@@ -92108,13 +92935,13 @@ var require_Document = __commonJS({
|
|
|
92108
92935
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
92109
92936
|
* boolean to add/remove the item from the set.
|
|
92110
92937
|
*/
|
|
92111
|
-
setIn(
|
|
92112
|
-
if (Collection2.isEmptyPath(
|
|
92938
|
+
setIn(path10, value) {
|
|
92939
|
+
if (Collection2.isEmptyPath(path10)) {
|
|
92113
92940
|
this.contents = value;
|
|
92114
92941
|
} else if (this.contents == null) {
|
|
92115
|
-
this.contents = Collection2.collectionFromPath(this.schema, Array.from(
|
|
92942
|
+
this.contents = Collection2.collectionFromPath(this.schema, Array.from(path10), value);
|
|
92116
92943
|
} else if (assertCollection(this.contents)) {
|
|
92117
|
-
this.contents.setIn(
|
|
92944
|
+
this.contents.setIn(path10, value);
|
|
92118
92945
|
}
|
|
92119
92946
|
}
|
|
92120
92947
|
/**
|
|
@@ -94074,9 +94901,9 @@ var require_cst_visit = __commonJS({
|
|
|
94074
94901
|
visit2.BREAK = BREAK;
|
|
94075
94902
|
visit2.SKIP = SKIP;
|
|
94076
94903
|
visit2.REMOVE = REMOVE;
|
|
94077
|
-
visit2.itemAtPath = (cst,
|
|
94904
|
+
visit2.itemAtPath = (cst, path10) => {
|
|
94078
94905
|
let item = cst;
|
|
94079
|
-
for (const [field, index] of
|
|
94906
|
+
for (const [field, index] of path10) {
|
|
94080
94907
|
const tok = item?.[field];
|
|
94081
94908
|
if (tok && "items" in tok) {
|
|
94082
94909
|
item = tok.items[index];
|
|
@@ -94085,23 +94912,23 @@ var require_cst_visit = __commonJS({
|
|
|
94085
94912
|
}
|
|
94086
94913
|
return item;
|
|
94087
94914
|
};
|
|
94088
|
-
visit2.parentCollection = (cst,
|
|
94089
|
-
const parent = visit2.itemAtPath(cst,
|
|
94090
|
-
const field =
|
|
94915
|
+
visit2.parentCollection = (cst, path10) => {
|
|
94916
|
+
const parent = visit2.itemAtPath(cst, path10.slice(0, -1));
|
|
94917
|
+
const field = path10[path10.length - 1][0];
|
|
94091
94918
|
const coll = parent?.[field];
|
|
94092
94919
|
if (coll && "items" in coll)
|
|
94093
94920
|
return coll;
|
|
94094
94921
|
throw new Error("Parent collection not found");
|
|
94095
94922
|
};
|
|
94096
|
-
function _visit(
|
|
94097
|
-
let ctrl = visitor(item,
|
|
94923
|
+
function _visit(path10, item, visitor) {
|
|
94924
|
+
let ctrl = visitor(item, path10);
|
|
94098
94925
|
if (typeof ctrl === "symbol")
|
|
94099
94926
|
return ctrl;
|
|
94100
94927
|
for (const field of ["key", "value"]) {
|
|
94101
94928
|
const token = item[field];
|
|
94102
94929
|
if (token && "items" in token) {
|
|
94103
94930
|
for (let i = 0; i < token.items.length; ++i) {
|
|
94104
|
-
const ci = _visit(Object.freeze(
|
|
94931
|
+
const ci = _visit(Object.freeze(path10.concat([[field, i]])), token.items[i], visitor);
|
|
94105
94932
|
if (typeof ci === "number")
|
|
94106
94933
|
i = ci - 1;
|
|
94107
94934
|
else if (ci === BREAK)
|
|
@@ -94112,10 +94939,10 @@ var require_cst_visit = __commonJS({
|
|
|
94112
94939
|
}
|
|
94113
94940
|
}
|
|
94114
94941
|
if (typeof ctrl === "function" && field === "key")
|
|
94115
|
-
ctrl = ctrl(item,
|
|
94942
|
+
ctrl = ctrl(item, path10);
|
|
94116
94943
|
}
|
|
94117
94944
|
}
|
|
94118
|
-
return typeof ctrl === "function" ? ctrl(item,
|
|
94945
|
+
return typeof ctrl === "function" ? ctrl(item, path10) : ctrl;
|
|
94119
94946
|
}
|
|
94120
94947
|
exports2.visit = visit2;
|
|
94121
94948
|
}
|
|
@@ -98446,7 +99273,7 @@ var require_split_collection = __commonJS({
|
|
|
98446
99273
|
if (items && items.length > 0) {
|
|
98447
99274
|
processItems(trie, rootPath, rootResourcesPath, items, serializeOpts, idMap, collection.id);
|
|
98448
99275
|
}
|
|
98449
|
-
const files = trie.entries().map(([
|
|
99276
|
+
const files = trie.entries().map(([path10, content]) => ({ path: path10, content }));
|
|
98450
99277
|
return idMap ? { files, rootPath, idMap } : { files, rootPath };
|
|
98451
99278
|
}
|
|
98452
99279
|
}
|
|
@@ -101320,8 +102147,8 @@ var require_utils5 = __commonJS({
|
|
|
101320
102147
|
var result = transform2[inputType][outputType](input);
|
|
101321
102148
|
return result;
|
|
101322
102149
|
};
|
|
101323
|
-
exports2.resolve = function(
|
|
101324
|
-
var parts =
|
|
102150
|
+
exports2.resolve = function(path10) {
|
|
102151
|
+
var parts = path10.split("/");
|
|
101325
102152
|
var result = [];
|
|
101326
102153
|
for (var index = 0; index < parts.length; index++) {
|
|
101327
102154
|
var part = parts[index];
|
|
@@ -107174,18 +108001,18 @@ var require_object = __commonJS({
|
|
|
107174
108001
|
var object = new ZipObject(name, zipObjectContent, o);
|
|
107175
108002
|
this.files[name] = object;
|
|
107176
108003
|
};
|
|
107177
|
-
var parentFolder = function(
|
|
107178
|
-
if (
|
|
107179
|
-
|
|
108004
|
+
var parentFolder = function(path10) {
|
|
108005
|
+
if (path10.slice(-1) === "/") {
|
|
108006
|
+
path10 = path10.substring(0, path10.length - 1);
|
|
107180
108007
|
}
|
|
107181
|
-
var lastSlash =
|
|
107182
|
-
return lastSlash > 0 ?
|
|
108008
|
+
var lastSlash = path10.lastIndexOf("/");
|
|
108009
|
+
return lastSlash > 0 ? path10.substring(0, lastSlash) : "";
|
|
107183
108010
|
};
|
|
107184
|
-
var forceTrailingSlash = function(
|
|
107185
|
-
if (
|
|
107186
|
-
|
|
108011
|
+
var forceTrailingSlash = function(path10) {
|
|
108012
|
+
if (path10.slice(-1) !== "/") {
|
|
108013
|
+
path10 += "/";
|
|
107187
108014
|
}
|
|
107188
|
-
return
|
|
108015
|
+
return path10;
|
|
107189
108016
|
};
|
|
107190
108017
|
var folderAdd = function(name, createFolders) {
|
|
107191
108018
|
createFolders = typeof createFolders !== "undefined" ? createFolders : defaults.createFolders;
|
|
@@ -110518,8 +111345,8 @@ function getIDToken(aud) {
|
|
|
110518
111345
|
|
|
110519
111346
|
// src/index.ts
|
|
110520
111347
|
var import_node_crypto4 = require("node:crypto");
|
|
110521
|
-
var
|
|
110522
|
-
var
|
|
111348
|
+
var import_node_fs6 = require("node:fs");
|
|
111349
|
+
var path9 = __toESM(require("node:path"), 1);
|
|
110523
111350
|
|
|
110524
111351
|
// node_modules/js-yaml/dist/js-yaml.mjs
|
|
110525
111352
|
var NOT_RESOLVED = /* @__PURE__ */ Symbol("NOT_RESOLVED");
|
|
@@ -110943,6 +111770,11 @@ var binaryTag = defineScalarTag("tag:yaml.org,2002:binary", {
|
|
|
110943
111770
|
});
|
|
110944
111771
|
var YAML_DATE_REGEXP = /* @__PURE__ */ new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$");
|
|
110945
111772
|
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]))?))?$");
|
|
111773
|
+
function makeUtcDate(year, month, day, hour = 0, minute = 0, second = 0, fraction = 0) {
|
|
111774
|
+
const date = new Date(Date.UTC(year, month, day, hour, minute, second, fraction));
|
|
111775
|
+
date.setUTCFullYear(year, month, day);
|
|
111776
|
+
return date;
|
|
111777
|
+
}
|
|
110946
111778
|
function resolveYamlTimestamp(source) {
|
|
110947
111779
|
let match = YAML_DATE_REGEXP.exec(source);
|
|
110948
111780
|
if (match === null) match = YAML_TIMESTAMP_REGEXP.exec(source);
|
|
@@ -110951,7 +111783,7 @@ function resolveYamlTimestamp(source) {
|
|
|
110951
111783
|
const month = +match[2] - 1;
|
|
110952
111784
|
const day = +match[3];
|
|
110953
111785
|
if (!match[4]) {
|
|
110954
|
-
const date2 =
|
|
111786
|
+
const date2 = makeUtcDate(year, month, day);
|
|
110955
111787
|
if (date2.getUTCFullYear() !== year || date2.getUTCMonth() !== month || date2.getUTCDate() !== day) return NOT_RESOLVED;
|
|
110956
111788
|
return date2;
|
|
110957
111789
|
}
|
|
@@ -110965,7 +111797,7 @@ function resolveYamlTimestamp(source) {
|
|
|
110965
111797
|
while (value.length < 3) value += "0";
|
|
110966
111798
|
fraction = +value;
|
|
110967
111799
|
}
|
|
110968
|
-
const date =
|
|
111800
|
+
const date = makeUtcDate(year, month, day, hour, minute, second, fraction);
|
|
110969
111801
|
if (date.getUTCFullYear() !== year || date.getUTCMonth() !== month || date.getUTCDate() !== day) return NOT_RESOLVED;
|
|
110970
111802
|
if (match[9]) {
|
|
110971
111803
|
const offsetHour = +match[10];
|
|
@@ -111063,7 +111895,11 @@ var mapTag = defineMappingTag("tag:yaml.org,2002:map", {
|
|
|
111063
111895
|
return Object.prototype.hasOwnProperty.call(container, String(key));
|
|
111064
111896
|
},
|
|
111065
111897
|
keys: (container) => Object.keys(container),
|
|
111066
|
-
get: (container, key) =>
|
|
111898
|
+
get: (container, key) => {
|
|
111899
|
+
const normalizedKey = String(key);
|
|
111900
|
+
if (!Object.prototype.hasOwnProperty.call(container, normalizedKey)) return null;
|
|
111901
|
+
return container[normalizedKey];
|
|
111902
|
+
}
|
|
111067
111903
|
});
|
|
111068
111904
|
var setTag = defineMappingTag("tag:yaml.org,2002:set", {
|
|
111069
111905
|
create: () => /* @__PURE__ */ new Set(),
|
|
@@ -111084,9 +111920,9 @@ var setTag = defineMappingTag("tag:yaml.org,2002:set", {
|
|
|
111084
111920
|
});
|
|
111085
111921
|
function createTagDefinitionMap() {
|
|
111086
111922
|
return {
|
|
111087
|
-
scalar:
|
|
111088
|
-
sequence:
|
|
111089
|
-
mapping:
|
|
111923
|
+
scalar: /* @__PURE__ */ Object.create(null),
|
|
111924
|
+
sequence: /* @__PURE__ */ Object.create(null),
|
|
111925
|
+
mapping: /* @__PURE__ */ Object.create(null)
|
|
111090
111926
|
};
|
|
111091
111927
|
}
|
|
111092
111928
|
function createTagDefinitionListMap() {
|
|
@@ -111256,7 +112092,11 @@ var legacyMapTag = defineMappingTag("tag:yaml.org,2002:map", {
|
|
|
111256
112092
|
return normalizedKey !== null && Object.prototype.hasOwnProperty.call(container, normalizedKey);
|
|
111257
112093
|
},
|
|
111258
112094
|
keys: (container) => Object.keys(container),
|
|
111259
|
-
get: (container, key) =>
|
|
112095
|
+
get: (container, key) => {
|
|
112096
|
+
const normalizedKey = String(key);
|
|
112097
|
+
if (!Object.prototype.hasOwnProperty.call(container, normalizedKey)) return null;
|
|
112098
|
+
return container[normalizedKey];
|
|
112099
|
+
}
|
|
111260
112100
|
});
|
|
111261
112101
|
var DEFAULT_SNIPPET_OPTIONS = {
|
|
111262
112102
|
maxLength: 79,
|
|
@@ -111592,10 +112432,10 @@ function getScalarValue(input, scalar) {
|
|
|
111592
112432
|
return getPlainValue(input, valueStart, valueEnd);
|
|
111593
112433
|
}
|
|
111594
112434
|
}
|
|
111595
|
-
var DEFAULT_TAG_HANDLERS = {
|
|
112435
|
+
var DEFAULT_TAG_HANDLERS = Object.assign(/* @__PURE__ */ Object.create(null), {
|
|
111596
112436
|
"!": "!",
|
|
111597
112437
|
"!!": "tag:yaml.org,2002:"
|
|
111598
|
-
};
|
|
112438
|
+
});
|
|
111599
112439
|
function tagPercentEncode(source) {
|
|
111600
112440
|
return encodeURI(source).replace(/!/g, "%21");
|
|
111601
112441
|
}
|
|
@@ -111848,6 +112688,10 @@ function constructFromEvents(events2, options) {
|
|
|
111848
112688
|
}
|
|
111849
112689
|
case 6: {
|
|
111850
112690
|
const frame = state.frames.pop();
|
|
112691
|
+
if (frame.kind === "mapping" && frame.hasKey) {
|
|
112692
|
+
state.position = frame.keyPosition;
|
|
112693
|
+
throwError$1(state, "incomplete mapping pair in event stream");
|
|
112694
|
+
}
|
|
111851
112695
|
if (frame.kind === "document") state.documents.push(frame.value);
|
|
111852
112696
|
else {
|
|
111853
112697
|
const value = frame.tag.carrierIsResult ? frame.value : finalizeCollection(state, frame.position, frame.tag, frame.value);
|
|
@@ -112518,10 +113362,6 @@ function parseNode(state, parentIndent, nodeContext, allowToSeek, allowCompact,
|
|
|
112518
113362
|
else if (state.lineIndent === parentIndent) indentStatus = 0;
|
|
112519
113363
|
else indentStatus = -1;
|
|
112520
113364
|
}
|
|
112521
|
-
if (state.position === state.lineStart && testDocumentSeparator(state)) {
|
|
112522
|
-
state.depth--;
|
|
112523
|
-
return false;
|
|
112524
|
-
}
|
|
112525
113365
|
if (indentStatus === 1) while (true) {
|
|
112526
113366
|
const ch = state.input.charCodeAt(state.position);
|
|
112527
113367
|
const propertyState = snapshotState(state);
|
|
@@ -113070,14 +113910,14 @@ function chooseScalarStyle(state, string, layout, singleLineOnly, forceQuote, in
|
|
|
113070
113910
|
if (char === CHAR_LINE_FEED) {
|
|
113071
113911
|
hasLineBreak = true;
|
|
113072
113912
|
if (shouldTrackWidth) {
|
|
113073
|
-
hasFoldableLine = hasFoldableLine || i - previousLineBreak - 1 > lineWidth && string[previousLineBreak + 1]
|
|
113913
|
+
hasFoldableLine = hasFoldableLine || i - previousLineBreak - 1 > lineWidth && !isMoreIndented(string[previousLineBreak + 1]);
|
|
113074
113914
|
previousLineBreak = i;
|
|
113075
113915
|
}
|
|
113076
113916
|
} else if (!isPrintable(char)) return STYLE_DOUBLE;
|
|
113077
113917
|
plain = plain && isPlainSafe(char, prevChar, inblock);
|
|
113078
113918
|
prevChar = char;
|
|
113079
113919
|
}
|
|
113080
|
-
hasFoldableLine = hasFoldableLine || shouldTrackWidth && i - previousLineBreak - 1 > lineWidth && string[previousLineBreak + 1]
|
|
113920
|
+
hasFoldableLine = hasFoldableLine || shouldTrackWidth && i - previousLineBreak - 1 > lineWidth && !isMoreIndented(string[previousLineBreak + 1]);
|
|
113081
113921
|
}
|
|
113082
113922
|
if (!hasLineBreak && !hasFoldableLine) {
|
|
113083
113923
|
if (plain && !forceQuote) return STYLE_PLAIN;
|
|
@@ -113142,27 +113982,30 @@ function encodeFlowBreaks(string, indent) {
|
|
|
113142
113982
|
function dropEndingNewline(string) {
|
|
113143
113983
|
return string[string.length - 1] === "\n" ? string.slice(0, -1) : string;
|
|
113144
113984
|
}
|
|
113985
|
+
function isMoreIndented(char) {
|
|
113986
|
+
return char === " " || char === " ";
|
|
113987
|
+
}
|
|
113145
113988
|
function foldBlockScalar(string, width) {
|
|
113146
113989
|
const lineRe = /(\n+)([^\n]*)/g;
|
|
113147
113990
|
let nextLF = string.indexOf("\n");
|
|
113148
113991
|
if (nextLF === -1) nextLF = string.length;
|
|
113149
113992
|
lineRe.lastIndex = nextLF;
|
|
113150
113993
|
let result = foldLine(string.slice(0, nextLF), width);
|
|
113151
|
-
let prevMoreIndented = string[0] === "\n" || string[0]
|
|
113994
|
+
let prevMoreIndented = string[0] === "\n" || isMoreIndented(string[0]);
|
|
113152
113995
|
let moreIndented;
|
|
113153
113996
|
let match;
|
|
113154
113997
|
while (match = lineRe.exec(string)) {
|
|
113155
113998
|
const prefix = match[1];
|
|
113156
113999
|
const line = match[2];
|
|
113157
|
-
moreIndented = line
|
|
114000
|
+
moreIndented = line !== "" && isMoreIndented(line[0]);
|
|
113158
114001
|
result += prefix + (!prevMoreIndented && !moreIndented && line !== "" ? "\n" : "") + foldLine(line, width);
|
|
113159
114002
|
prevMoreIndented = moreIndented;
|
|
113160
114003
|
}
|
|
113161
114004
|
return result;
|
|
113162
114005
|
}
|
|
113163
114006
|
function foldLine(line, width) {
|
|
113164
|
-
if (line === "" || line[0]
|
|
113165
|
-
const breakRe = / [^ ]/g;
|
|
114007
|
+
if (line === "" || isMoreIndented(line[0])) return line;
|
|
114008
|
+
const breakRe = / [^ \t]/g;
|
|
113166
114009
|
let match;
|
|
113167
114010
|
let start = 0;
|
|
113168
114011
|
let end;
|
|
@@ -114564,12 +115407,23 @@ var RepoMutationService = class {
|
|
|
114564
115407
|
resolvedCurrentRef
|
|
114565
115408
|
};
|
|
114566
115409
|
}
|
|
114567
|
-
await this.execute("git", [
|
|
115410
|
+
const commit = await this.execute("git", [
|
|
114568
115411
|
"commit",
|
|
114569
115412
|
"-m",
|
|
114570
115413
|
"chore: sync Postman artifacts and metadata"
|
|
114571
115414
|
]);
|
|
114572
|
-
|
|
115415
|
+
if (commit.exitCode !== 0) {
|
|
115416
|
+
throw new Error(
|
|
115417
|
+
secretMasker(commit.stderr || commit.stdout || "Failed to commit generated changes")
|
|
115418
|
+
);
|
|
115419
|
+
}
|
|
115420
|
+
const revision = await this.execute("git", ["rev-parse", "HEAD"]);
|
|
115421
|
+
let commitSha = revision.stdout.trim();
|
|
115422
|
+
if (revision.exitCode !== 0 || !commitSha) {
|
|
115423
|
+
throw new Error(
|
|
115424
|
+
secretMasker(revision.stderr || revision.stdout || "Failed to resolve generated commit")
|
|
115425
|
+
);
|
|
115426
|
+
}
|
|
114573
115427
|
if (options.repoWriteMode !== "commit-and-push") {
|
|
114574
115428
|
return {
|
|
114575
115429
|
commitSha,
|
|
@@ -114691,11 +115545,11 @@ function normalizeRepoUrl(url) {
|
|
|
114691
115545
|
const sshMatch = raw.match(/^git@([^:]+):(.+?)(?:\.git)?$/);
|
|
114692
115546
|
if (sshMatch) {
|
|
114693
115547
|
const host = sshMatch[1];
|
|
114694
|
-
const
|
|
115548
|
+
const path10 = sshMatch[2];
|
|
114695
115549
|
if (host === "ssh.dev.azure.com") {
|
|
114696
|
-
return normalizeAzureReposSshPath2(
|
|
115550
|
+
return normalizeAzureReposSshPath2(path10);
|
|
114697
115551
|
}
|
|
114698
|
-
return `https://${host}/${
|
|
115552
|
+
return `https://${host}/${path10}`;
|
|
114699
115553
|
}
|
|
114700
115554
|
try {
|
|
114701
115555
|
const parsed = new URL(raw);
|
|
@@ -114766,7 +115620,7 @@ function detectRepoContext(input, env = process.env) {
|
|
|
114766
115620
|
};
|
|
114767
115621
|
}
|
|
114768
115622
|
|
|
114769
|
-
// node_modules/@postman-
|
|
115623
|
+
// node_modules/@postman-cs/automation-core/dist/ci-context.js
|
|
114770
115624
|
function norm(value) {
|
|
114771
115625
|
const trimmed = (value ?? "").trim();
|
|
114772
115626
|
return trimmed.length > 0 ? trimmed : void 0;
|
|
@@ -114917,7 +115771,7 @@ function detectCiProviderContext(env = process.env) {
|
|
|
114917
115771
|
return { ciProvider: "unknown", runnerKind: "unknown" };
|
|
114918
115772
|
}
|
|
114919
115773
|
|
|
114920
|
-
// node_modules/@postman-
|
|
115774
|
+
// node_modules/@postman-cs/automation-core/dist/repo-context.js
|
|
114921
115775
|
function normalize2(value) {
|
|
114922
115776
|
const trimmed = (value ?? "").trim();
|
|
114923
115777
|
return trimmed.length > 0 ? trimmed : void 0;
|
|
@@ -114930,8 +115784,8 @@ function normalizeRepoUrl2(url) {
|
|
|
114930
115784
|
const sshMatch = raw.match(/^git@([^:]+):(.+?)(?:\.git)?$/);
|
|
114931
115785
|
if (sshMatch) {
|
|
114932
115786
|
const host = sshMatch[1];
|
|
114933
|
-
const
|
|
114934
|
-
return `https://${host}/${
|
|
115787
|
+
const path10 = sshMatch[2];
|
|
115788
|
+
return `https://${host}/${path10}`;
|
|
114935
115789
|
}
|
|
114936
115790
|
return raw.replace(/\.git$/, "");
|
|
114937
115791
|
}
|
|
@@ -115006,7 +115860,7 @@ function detectRepoContext2(input, env = process.env) {
|
|
|
115006
115860
|
};
|
|
115007
115861
|
}
|
|
115008
115862
|
|
|
115009
|
-
// node_modules/@postman-
|
|
115863
|
+
// node_modules/@postman-cs/automation-core/dist/telemetry.js
|
|
115010
115864
|
var import_node_crypto = require("node:crypto");
|
|
115011
115865
|
var import_undici2 = __toESM(require_undici(), 1);
|
|
115012
115866
|
var SCHEMA_VERSION = 3;
|
|
@@ -115146,7 +116000,7 @@ function createTelemetryContext(options) {
|
|
|
115146
116000
|
};
|
|
115147
116001
|
}
|
|
115148
116002
|
|
|
115149
|
-
// node_modules/@postman-
|
|
116003
|
+
// node_modules/@postman-cs/automation-core/dist/logger.js
|
|
115150
116004
|
var LEVEL_ORDER = {
|
|
115151
116005
|
debug: 10,
|
|
115152
116006
|
info: 20,
|
|
@@ -115326,7 +116180,7 @@ function createLogger(options) {
|
|
|
115326
116180
|
return root;
|
|
115327
116181
|
}
|
|
115328
116182
|
|
|
115329
|
-
// node_modules/@postman-
|
|
116183
|
+
// node_modules/@postman-cs/automation-core/dist/secrets-resolver.js
|
|
115330
116184
|
var SECRETS_RESOLVER_PROVIDERS = ["none", "aws", "azure", "gcp"];
|
|
115331
116185
|
var DEFAULT_SECRETS_RESOLVER_PROVIDER = "none";
|
|
115332
116186
|
function parseSecretsResolverProvider(value, fallback = DEFAULT_SECRETS_RESOLVER_PROVIDER) {
|
|
@@ -115369,7 +116223,7 @@ function secretsResolverEnvironmentKeys(provider) {
|
|
|
115369
116223
|
}
|
|
115370
116224
|
}
|
|
115371
116225
|
|
|
115372
|
-
// node_modules/@postman-
|
|
116226
|
+
// node_modules/@postman-cs/automation-core/dist/http/http-error.js
|
|
115373
116227
|
var REDACTED2 = "[REDACTED]";
|
|
115374
116228
|
var SENSITIVE_HEADER_NAMES = /* @__PURE__ */ new Set([
|
|
115375
116229
|
"authorization",
|
|
@@ -115528,7 +116382,7 @@ var HttpError = class _HttpError extends Error {
|
|
|
115528
116382
|
}
|
|
115529
116383
|
};
|
|
115530
116384
|
|
|
115531
|
-
// node_modules/@postman-
|
|
116385
|
+
// node_modules/@postman-cs/automation-core/dist/http/retry.js
|
|
115532
116386
|
function sleep(delayMs) {
|
|
115533
116387
|
return new Promise((resolve3) => {
|
|
115534
116388
|
setTimeout(resolve3, delayMs);
|
|
@@ -115592,7 +116446,7 @@ function isRetryableGatewayFailure(status, body = "") {
|
|
|
115592
116446
|
return isTransientHttpStatus(status) || RETRYABLE_GATEWAY_BODY.test(body);
|
|
115593
116447
|
}
|
|
115594
116448
|
|
|
115595
|
-
// node_modules/@postman-
|
|
116449
|
+
// node_modules/@postman-cs/automation-core/dist/http/gateway-client.js
|
|
115596
116450
|
var DEFAULT_POSTMAN_BIFROST_BASE_URL = "https://bifrost-premium-https-v4.gw.postman.com";
|
|
115597
116451
|
function isExpiredAuthError(status, body) {
|
|
115598
116452
|
return status === 401 || body.includes("UNAUTHENTICATED") || body.includes("authenticationError");
|
|
@@ -116679,8 +117533,8 @@ var BifrostInternalIntegrationAdapter = class {
|
|
|
116679
117533
|
* - 403 + error.meta.workspaceId -> linked-invisible
|
|
116680
117534
|
* - 200 + error.meta.workspaceId -> linked-invisible (proxy envelope)
|
|
116681
117535
|
*/
|
|
116682
|
-
async findWorkspaceForRepo(repoUrl,
|
|
116683
|
-
const fsPath =
|
|
117536
|
+
async findWorkspaceForRepo(repoUrl, path10 = "/") {
|
|
117537
|
+
const fsPath = path10 && path10.trim() ? path10.trim() : "/";
|
|
116684
117538
|
const url = `${this.bifrostBaseUrl}/ws/proxy`;
|
|
116685
117539
|
const payload = {
|
|
116686
117540
|
service: "workspaces",
|
|
@@ -116920,10 +117774,14 @@ var postmanRepoSyncActionContract = {
|
|
|
116920
117774
|
committerEmail: "support@postman.com"
|
|
116921
117775
|
},
|
|
116922
117776
|
inputs: {
|
|
116923
|
-
"
|
|
116924
|
-
description: "
|
|
117777
|
+
"working-directory": {
|
|
117778
|
+
description: "Repository-root-relative directory used for all local inputs and generated artifacts.",
|
|
116925
117779
|
required: false,
|
|
116926
|
-
default: "
|
|
117780
|
+
default: ""
|
|
117781
|
+
},
|
|
117782
|
+
"generate-ci-workflow": {
|
|
117783
|
+
description: "Whether to generate the CI workflow file. Defaults to true at the repository root and false when working-directory is set.",
|
|
117784
|
+
required: false
|
|
116927
117785
|
},
|
|
116928
117786
|
"ci-workflow-path": {
|
|
116929
117787
|
description: "Path to write the generated CI workflow file",
|
|
@@ -117269,8 +118127,8 @@ var PostmanAssetsClient = class {
|
|
|
117269
118127
|
this.fetchImpl = options.fetchImpl ?? fetch;
|
|
117270
118128
|
void (options.secretMasker ?? createSecretMasker([this.apiKey]));
|
|
117271
118129
|
}
|
|
117272
|
-
async request(
|
|
117273
|
-
const url =
|
|
118130
|
+
async request(path10, init = {}) {
|
|
118131
|
+
const url = path10.startsWith("http") ? path10 : `${this.baseUrl}${path10}`;
|
|
117274
118132
|
const response = await this.fetchImpl(url, {
|
|
117275
118133
|
...init,
|
|
117276
118134
|
headers: {
|
|
@@ -117815,9 +118673,9 @@ var PostmanGatewayAssetsClient = class {
|
|
|
117815
118673
|
const row = this.asRecord(value);
|
|
117816
118674
|
if (!row || row.type === "FOLDER") continue;
|
|
117817
118675
|
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;
|
|
117818
|
-
const
|
|
117819
|
-
if (
|
|
117820
|
-
rows.push({ ...row, path:
|
|
118676
|
+
const path10 = row.path.replace(/\\/g, "/").normalize("NFC");
|
|
118677
|
+
if (path10.startsWith("/") || path10.split("/").some((part) => part === ".." || !part)) throw new Error("CONTRACT_DEFINITION_PATH_INVALID");
|
|
118678
|
+
rows.push({ ...row, path: path10 });
|
|
117821
118679
|
}
|
|
117822
118680
|
const meta = this.asRecord(response?.meta);
|
|
117823
118681
|
const cursorValue = this.asRecord(meta?.cursor)?.next;
|
|
@@ -117830,9 +118688,9 @@ var PostmanGatewayAssetsClient = class {
|
|
|
117830
118688
|
}
|
|
117831
118689
|
const paths = /* @__PURE__ */ new Set();
|
|
117832
118690
|
for (const row of rows) {
|
|
117833
|
-
const
|
|
117834
|
-
if (paths.has(
|
|
117835
|
-
paths.add(
|
|
118691
|
+
const path10 = String(row.path).toLocaleLowerCase();
|
|
118692
|
+
if (paths.has(path10)) throw new Error("CONTRACT_DEFINITION_DUPLICATE_PATH");
|
|
118693
|
+
paths.add(path10);
|
|
117836
118694
|
}
|
|
117837
118695
|
const roots = rows.filter((row) => row.fileType === "ROOT");
|
|
117838
118696
|
if (roots.length !== 1) throw new Error("CONTRACT_DEFINITION_INVENTORY_INVALID");
|
|
@@ -119014,10 +119872,10 @@ function detectProvider(env) {
|
|
|
119014
119872
|
return "unknown";
|
|
119015
119873
|
}
|
|
119016
119874
|
function readGithubEvent(env) {
|
|
119017
|
-
const
|
|
119018
|
-
if (!
|
|
119875
|
+
const path10 = clean(env.GITHUB_EVENT_PATH);
|
|
119876
|
+
if (!path10) return void 0;
|
|
119019
119877
|
try {
|
|
119020
|
-
return JSON.parse((0, import_node_fs4.readFileSync)(
|
|
119878
|
+
return JSON.parse((0, import_node_fs4.readFileSync)(path10, "utf8"));
|
|
119021
119879
|
} catch {
|
|
119022
119880
|
return void 0;
|
|
119023
119881
|
}
|
|
@@ -119337,6 +120195,47 @@ function parseAssetMarker(description) {
|
|
|
119337
120195
|
return void 0;
|
|
119338
120196
|
}
|
|
119339
120197
|
|
|
120198
|
+
// src/lib/working-directory.ts
|
|
120199
|
+
var import_node_fs5 = require("node:fs");
|
|
120200
|
+
var import_node_path3 = __toESM(require("node:path"), 1);
|
|
120201
|
+
function invalidWorkingDirectory(message) {
|
|
120202
|
+
throw new Error(`Invalid working-directory: ${message}`);
|
|
120203
|
+
}
|
|
120204
|
+
function isOutside(root, candidate) {
|
|
120205
|
+
const relative4 = import_node_path3.default.relative(root, candidate);
|
|
120206
|
+
return relative4 === ".." || relative4.startsWith(`..${import_node_path3.default.sep}`) || import_node_path3.default.isAbsolute(relative4);
|
|
120207
|
+
}
|
|
120208
|
+
function activateWorkingDirectory(input, baseRoot) {
|
|
120209
|
+
const originalRoot = import_node_path3.default.resolve(baseRoot);
|
|
120210
|
+
const requested = input?.trim() ?? "";
|
|
120211
|
+
if (!requested) {
|
|
120212
|
+
return { changed: false, originalRoot, effectiveRoot: originalRoot };
|
|
120213
|
+
}
|
|
120214
|
+
if (import_node_path3.default.isAbsolute(requested)) {
|
|
120215
|
+
invalidWorkingDirectory("expected a repository-root-relative directory");
|
|
120216
|
+
}
|
|
120217
|
+
if (requested.split(/[\\/]/u).includes("..")) {
|
|
120218
|
+
invalidWorkingDirectory("path traversal is not allowed");
|
|
120219
|
+
}
|
|
120220
|
+
let originalRealPath;
|
|
120221
|
+
let effectiveRoot;
|
|
120222
|
+
try {
|
|
120223
|
+
originalRealPath = (0, import_node_fs5.realpathSync)(originalRoot);
|
|
120224
|
+
effectiveRoot = (0, import_node_fs5.realpathSync)(import_node_path3.default.resolve(originalRealPath, requested));
|
|
120225
|
+
} catch {
|
|
120226
|
+
invalidWorkingDirectory(`directory does not exist: ${requested}`);
|
|
120227
|
+
}
|
|
120228
|
+
if (isOutside(originalRealPath, effectiveRoot)) {
|
|
120229
|
+
invalidWorkingDirectory("resolved path must stay inside the repository root");
|
|
120230
|
+
}
|
|
120231
|
+
if (!(0, import_node_fs5.statSync)(effectiveRoot).isDirectory()) {
|
|
120232
|
+
invalidWorkingDirectory(`path is not a directory: ${requested}`);
|
|
120233
|
+
}
|
|
120234
|
+
process.chdir(effectiveRoot);
|
|
120235
|
+
process.env.GITHUB_WORKSPACE = effectiveRoot;
|
|
120236
|
+
return { changed: true, originalRoot: originalRealPath, effectiveRoot };
|
|
120237
|
+
}
|
|
120238
|
+
|
|
119340
120239
|
// src/index.ts
|
|
119341
120240
|
var identitySecretMasker = (input) => input;
|
|
119342
120241
|
function resolveRepoSyncMasker(dependencies) {
|
|
@@ -119584,7 +120483,22 @@ function resolveInputs(env = process.env) {
|
|
|
119584
120483
|
const postmanRegion = parsePostmanRegion(getInput2("postman-region", env));
|
|
119585
120484
|
const postmanStack = parsePostmanStack(getInput2("postman-stack", env));
|
|
119586
120485
|
const endpointProfile = resolvePostmanEndpointProfile(postmanStack, postmanRegion, env);
|
|
120486
|
+
const workingDirectory = getInput2("working-directory", env);
|
|
120487
|
+
const generateCiWorkflowInput = getInput2("generate-ci-workflow", env);
|
|
120488
|
+
let generateCiWorkflow = parseBooleanInput(generateCiWorkflowInput, true);
|
|
120489
|
+
let generateCiWorkflowDefaulted = false;
|
|
120490
|
+
if (workingDirectory) {
|
|
120491
|
+
if (!generateCiWorkflowInput) {
|
|
120492
|
+
generateCiWorkflow = false;
|
|
120493
|
+
generateCiWorkflowDefaulted = true;
|
|
120494
|
+
} else if (generateCiWorkflow) {
|
|
120495
|
+
throw new Error(
|
|
120496
|
+
"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."
|
|
120497
|
+
);
|
|
120498
|
+
}
|
|
120499
|
+
}
|
|
119587
120500
|
return {
|
|
120501
|
+
workingDirectory,
|
|
119588
120502
|
projectName: getInput2("project-name", env),
|
|
119589
120503
|
workspaceId: getInput2("workspace-id", env),
|
|
119590
120504
|
baselineCollectionId: getInput2("baseline-collection-id", env),
|
|
@@ -119626,7 +120540,8 @@ function resolveInputs(env = process.env) {
|
|
|
119626
120540
|
ghFallbackToken: getInput2("gh-fallback-token", env),
|
|
119627
120541
|
provider: repoContext.provider,
|
|
119628
120542
|
ciWorkflowBase64: getInput2("ci-workflow-base64", env),
|
|
119629
|
-
generateCiWorkflow
|
|
120543
|
+
generateCiWorkflow,
|
|
120544
|
+
generateCiWorkflowDefaulted,
|
|
119630
120545
|
ciRunnerOs: parseCiRunnerOs(getInput2("ci-runner-os", env)),
|
|
119631
120546
|
monitorType: getInput2("monitor-type", env) || "cloud",
|
|
119632
120547
|
ciWorkflowPath: getInput2("ci-workflow-path", env) || (repoContext.provider === "azure-devops" ? "azure-pipelines.yml" : ".github/workflows/ci.yml"),
|
|
@@ -119729,7 +120644,7 @@ var StateUnreadableError = class extends Error {
|
|
|
119729
120644
|
function readResourcesState() {
|
|
119730
120645
|
let raw;
|
|
119731
120646
|
try {
|
|
119732
|
-
raw = (0,
|
|
120647
|
+
raw = (0, import_node_fs6.readFileSync)(".postman/resources.yaml", "utf8");
|
|
119733
120648
|
} catch {
|
|
119734
120649
|
return null;
|
|
119735
120650
|
}
|
|
@@ -119786,7 +120701,7 @@ function getEnvironmentUidsFromResources(resourcesState) {
|
|
|
119786
120701
|
);
|
|
119787
120702
|
}
|
|
119788
120703
|
function normalizeToPosix(filePath) {
|
|
119789
|
-
return filePath.split(
|
|
120704
|
+
return filePath.split(path9.sep).join("/").replace(/\\/g, "/");
|
|
119790
120705
|
}
|
|
119791
120706
|
function canonicalizeRelativePath(value) {
|
|
119792
120707
|
return normalizeToPosix(String(value ?? "").trim()).replace(/^\.\/+/, "").replace(/\/{2,}/g, "/").replace(/\/+$/g, "");
|
|
@@ -119834,7 +120749,7 @@ function isSpecCandidateExtension(filePath) {
|
|
|
119834
120749
|
}
|
|
119835
120750
|
function readOpenApiSpecFile(fullPath) {
|
|
119836
120751
|
try {
|
|
119837
|
-
const raw = (0,
|
|
120752
|
+
const raw = (0, import_node_fs6.readFileSync)(fullPath, "utf8");
|
|
119838
120753
|
const parsed = fullPath.endsWith(".json") ? JSON.parse(raw) : load(raw);
|
|
119839
120754
|
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
119840
120755
|
return false;
|
|
@@ -119855,7 +120770,7 @@ function shouldIgnoreSpecDiscoveryEntry(entryName, currentDir, baseDir, ignoredP
|
|
|
119855
120770
|
if (LOCAL_SPEC_DISCOVERY_IGNORED_DIRS.has(entryName)) {
|
|
119856
120771
|
return true;
|
|
119857
120772
|
}
|
|
119858
|
-
const relative4 = normalizeToPosix(
|
|
120773
|
+
const relative4 = normalizeToPosix(path9.relative(baseDir, path9.join(currentDir, entryName)));
|
|
119859
120774
|
return ignoredPrefixes.some(
|
|
119860
120775
|
(prefix) => relative4 === prefix || relative4.startsWith(`${prefix}/`)
|
|
119861
120776
|
);
|
|
@@ -119871,7 +120786,7 @@ function scanLocalSpecReferences(baseDir = ".", options = {}) {
|
|
|
119871
120786
|
const { dir: currentDir, depth: currentDepth } = pendingDirs.shift();
|
|
119872
120787
|
let entries;
|
|
119873
120788
|
try {
|
|
119874
|
-
entries = (0,
|
|
120789
|
+
entries = (0, import_node_fs6.readdirSync)(currentDir, { withFileTypes: true }).sort(
|
|
119875
120790
|
(left, right) => left.name.localeCompare(right.name)
|
|
119876
120791
|
);
|
|
119877
120792
|
} catch {
|
|
@@ -119887,7 +120802,7 @@ function scanLocalSpecReferences(baseDir = ".", options = {}) {
|
|
|
119887
120802
|
if (shouldIgnoreSpecDiscoveryEntry(entry.name, currentDir, baseDir, ignoredPrefixes)) {
|
|
119888
120803
|
continue;
|
|
119889
120804
|
}
|
|
119890
|
-
const fullPath =
|
|
120805
|
+
const fullPath = path9.join(currentDir, entry.name);
|
|
119891
120806
|
if (entry.isDirectory()) {
|
|
119892
120807
|
const nextDepth = currentDepth + 1;
|
|
119893
120808
|
if (nextDepth > LOCAL_SPEC_DISCOVERY_MAX_DEPTH) {
|
|
@@ -119909,12 +120824,12 @@ function scanLocalSpecReferences(baseDir = ".", options = {}) {
|
|
|
119909
120824
|
}
|
|
119910
120825
|
let sizeBytes;
|
|
119911
120826
|
try {
|
|
119912
|
-
sizeBytes = (0,
|
|
120827
|
+
sizeBytes = (0, import_node_fs6.statSync)(fullPath).size;
|
|
119913
120828
|
} catch {
|
|
119914
120829
|
continue;
|
|
119915
120830
|
}
|
|
119916
120831
|
if (sizeBytes > LOCAL_SPEC_DISCOVERY_MAX_CANDIDATE_FILE_BYTES) {
|
|
119917
|
-
const repoRelativePath2 = normalizeToPosix(
|
|
120832
|
+
const repoRelativePath2 = normalizeToPosix(path9.relative(baseDir, fullPath));
|
|
119918
120833
|
failLocalSpecDiscoveryLimit(
|
|
119919
120834
|
`local spec discovery candidate ${repoRelativePath2} exceeds ${LOCAL_SPEC_DISCOVERY_MAX_CANDIDATE_FILE_BYTES} bytes.`
|
|
119920
120835
|
);
|
|
@@ -119922,14 +120837,14 @@ function scanLocalSpecReferences(baseDir = ".", options = {}) {
|
|
|
119922
120837
|
if (!readOpenApiSpecFile(fullPath)) {
|
|
119923
120838
|
continue;
|
|
119924
120839
|
}
|
|
119925
|
-
const repoRelativePath = normalizeToPosix(
|
|
120840
|
+
const repoRelativePath = normalizeToPosix(path9.relative(baseDir, fullPath));
|
|
119926
120841
|
if (found.has(repoRelativePath)) {
|
|
119927
120842
|
continue;
|
|
119928
120843
|
}
|
|
119929
120844
|
found.add(repoRelativePath);
|
|
119930
120845
|
refs.push({
|
|
119931
120846
|
repoRelativePath,
|
|
119932
|
-
configRelativePath: normalizeToPosix(
|
|
120847
|
+
configRelativePath: normalizeToPosix(path9.join("..", repoRelativePath))
|
|
119933
120848
|
});
|
|
119934
120849
|
}
|
|
119935
120850
|
}
|
|
@@ -119940,11 +120855,11 @@ function tryResolveExplicitSpecReference(explicitSpecPath) {
|
|
|
119940
120855
|
if (!normalizedExplicitPath) {
|
|
119941
120856
|
return void 0;
|
|
119942
120857
|
}
|
|
119943
|
-
const explicitFullPath =
|
|
119944
|
-
if ((0,
|
|
120858
|
+
const explicitFullPath = path9.resolve(normalizedExplicitPath);
|
|
120859
|
+
if ((0, import_node_fs6.existsSync)(explicitFullPath) && (0, import_node_fs6.statSync)(explicitFullPath).isFile()) {
|
|
119945
120860
|
return {
|
|
119946
120861
|
repoRelativePath: normalizedExplicitPath,
|
|
119947
|
-
configRelativePath: normalizeToPosix(
|
|
120862
|
+
configRelativePath: normalizeToPosix(path9.join("..", normalizedExplicitPath))
|
|
119948
120863
|
};
|
|
119949
120864
|
}
|
|
119950
120865
|
return void 0;
|
|
@@ -120007,6 +120922,7 @@ function readActionInputs(actionCore) {
|
|
|
120007
120922
|
const sslExtraCaCerts = readInput(actionCore, "ssl-extra-ca-certs");
|
|
120008
120923
|
const inputs = resolveInputs({
|
|
120009
120924
|
...process.env,
|
|
120925
|
+
INPUT_WORKING_DIRECTORY: readInput(actionCore, "working-directory"),
|
|
120010
120926
|
INPUT_PROJECT_NAME: projectName,
|
|
120011
120927
|
INPUT_WORKSPACE_ID: readInput(actionCore, "workspace-id"),
|
|
120012
120928
|
INPUT_BASELINE_COLLECTION_ID: readInput(actionCore, "baseline-collection-id"),
|
|
@@ -120339,8 +121255,8 @@ async function upsertMockEnvironment(inputs, dependencies, assetProjectName, moc
|
|
|
120339
121255
|
return "";
|
|
120340
121256
|
}
|
|
120341
121257
|
}
|
|
120342
|
-
function ensureDir(
|
|
120343
|
-
(0,
|
|
121258
|
+
function ensureDir(path10) {
|
|
121259
|
+
(0, import_node_fs6.mkdirSync)(path10, { recursive: true });
|
|
120344
121260
|
}
|
|
120345
121261
|
function getCollectionDirectoryName(kind, projectName) {
|
|
120346
121262
|
if (kind === "Baseline") {
|
|
@@ -120375,9 +121291,9 @@ function stripVolatileFields(obj) {
|
|
|
120375
121291
|
}
|
|
120376
121292
|
return obj;
|
|
120377
121293
|
}
|
|
120378
|
-
function writeJsonFile(
|
|
121294
|
+
function writeJsonFile(path10, content, normalize4 = false) {
|
|
120379
121295
|
const data = normalize4 ? stripVolatileFields(content) : content;
|
|
120380
|
-
(0,
|
|
121296
|
+
(0, import_node_fs6.writeFileSync)(path10, JSON.stringify(data, null, 2));
|
|
120381
121297
|
}
|
|
120382
121298
|
function sanitizeMockEnvironmentArtifact(content) {
|
|
120383
121299
|
if (Array.isArray(content)) {
|
|
@@ -120630,32 +121546,32 @@ function parsePrebuiltCollectionsJson(raw) {
|
|
|
120630
121546
|
function assertPathWithinArtifactRoot(targetPath, artifactDir, fieldName) {
|
|
120631
121547
|
assertPathWithinCwd(targetPath, fieldName);
|
|
120632
121548
|
assertPathWithinCwd(artifactDir, "artifact-dir");
|
|
120633
|
-
const cwd = (0,
|
|
120634
|
-
const artifactRoot =
|
|
120635
|
-
const resolved =
|
|
120636
|
-
const relativeToArtifact =
|
|
120637
|
-
if (!relativeToArtifact || relativeToArtifact.startsWith("..") ||
|
|
121549
|
+
const cwd = (0, import_node_fs6.realpathSync)(process.cwd());
|
|
121550
|
+
const artifactRoot = path9.resolve(cwd, artifactDir.trim());
|
|
121551
|
+
const resolved = path9.resolve(cwd, targetPath.trim());
|
|
121552
|
+
const relativeToArtifact = path9.relative(artifactRoot, resolved);
|
|
121553
|
+
if (!relativeToArtifact || relativeToArtifact.startsWith("..") || path9.isAbsolute(relativeToArtifact)) {
|
|
120638
121554
|
failPrebuiltCollections(
|
|
120639
121555
|
`${fieldName} must stay under artifact-dir (${artifactDir}); received ${targetPath}`
|
|
120640
121556
|
);
|
|
120641
121557
|
}
|
|
120642
121558
|
let existingPath = resolved;
|
|
120643
|
-
while (!(0,
|
|
120644
|
-
const parent =
|
|
121559
|
+
while (!(0, import_node_fs6.existsSync)(existingPath)) {
|
|
121560
|
+
const parent = path9.dirname(existingPath);
|
|
120645
121561
|
if (parent === existingPath) {
|
|
120646
121562
|
break;
|
|
120647
121563
|
}
|
|
120648
121564
|
existingPath = parent;
|
|
120649
121565
|
}
|
|
120650
|
-
const realExisting = (0,
|
|
120651
|
-
const realArtifactRoot = (0,
|
|
120652
|
-
const realRelative = realArtifactRoot ?
|
|
120653
|
-
if (realArtifactRoot && (realRelative.startsWith("..") ||
|
|
121566
|
+
const realExisting = (0, import_node_fs6.realpathSync)(existingPath);
|
|
121567
|
+
const realArtifactRoot = (0, import_node_fs6.existsSync)(artifactRoot) ? (0, import_node_fs6.realpathSync)(artifactRoot) : void 0;
|
|
121568
|
+
const realRelative = realArtifactRoot ? path9.relative(realArtifactRoot, realExisting) : "";
|
|
121569
|
+
if (realArtifactRoot && (realRelative.startsWith("..") || path9.isAbsolute(realRelative))) {
|
|
120654
121570
|
failPrebuiltCollections(
|
|
120655
121571
|
`${fieldName} resolves outside artifact-dir via symlink; received ${targetPath}`
|
|
120656
121572
|
);
|
|
120657
121573
|
}
|
|
120658
|
-
return normalizeToPosix(
|
|
121574
|
+
return normalizeToPosix(path9.relative(cwd, resolved));
|
|
120659
121575
|
}
|
|
120660
121576
|
function prebuiltDirectoryTraversalIdentity(absolutePath, stats, options = {}) {
|
|
120661
121577
|
const platform2 = options.platform ?? process.platform;
|
|
@@ -120663,7 +121579,7 @@ function prebuiltDirectoryTraversalIdentity(absolutePath, stats, options = {}) {
|
|
|
120663
121579
|
if (platform2 !== "win32" && !inodeIsZero) {
|
|
120664
121580
|
return `${stats.dev}:${stats.ino}`;
|
|
120665
121581
|
}
|
|
120666
|
-
const resolveCanonicalPath = options.resolveCanonicalPath ?? ((candidate) =>
|
|
121582
|
+
const resolveCanonicalPath = options.resolveCanonicalPath ?? ((candidate) => import_node_fs6.realpathSync.native(candidate));
|
|
120667
121583
|
const canonical = resolveCanonicalPath(absolutePath);
|
|
120668
121584
|
return platform2 === "win32" ? canonical.toLowerCase() : canonical;
|
|
120669
121585
|
}
|
|
@@ -120673,13 +121589,13 @@ function listPrebuiltCollectionTreeFiles(collectionPath, artifactDir) {
|
|
|
120673
121589
|
artifactDir,
|
|
120674
121590
|
"prebuilt collection path"
|
|
120675
121591
|
);
|
|
120676
|
-
const absRoot =
|
|
120677
|
-
if (!(0,
|
|
121592
|
+
const absRoot = path9.resolve(process.cwd(), confined);
|
|
121593
|
+
if (!(0, import_node_fs6.existsSync)(absRoot)) {
|
|
120678
121594
|
return [];
|
|
120679
121595
|
}
|
|
120680
121596
|
let rootStat;
|
|
120681
121597
|
try {
|
|
120682
|
-
rootStat = (0,
|
|
121598
|
+
rootStat = (0, import_node_fs6.lstatSync)(absRoot);
|
|
120683
121599
|
} catch {
|
|
120684
121600
|
return [];
|
|
120685
121601
|
}
|
|
@@ -120702,20 +121618,20 @@ function listPrebuiltCollectionTreeFiles(collectionPath, artifactDir) {
|
|
|
120702
121618
|
break;
|
|
120703
121619
|
}
|
|
120704
121620
|
const { absolute: currentAbsolute, depth: currentDepth } = current;
|
|
120705
|
-
const currentStat = (0,
|
|
121621
|
+
const currentStat = (0, import_node_fs6.lstatSync)(currentAbsolute);
|
|
120706
121622
|
if (currentStat.isSymbolicLink() || !currentStat.isDirectory()) {
|
|
120707
121623
|
failPrebuiltCollections(
|
|
120708
|
-
`prebuilt collection tree directory changed or became unsupported at ${normalizeToPosix(
|
|
121624
|
+
`prebuilt collection tree directory changed or became unsupported at ${normalizeToPosix(path9.relative(absRoot, currentAbsolute)) || "."}`
|
|
120709
121625
|
);
|
|
120710
121626
|
}
|
|
120711
121627
|
const currentKey = prebuiltDirectoryTraversalIdentity(currentAbsolute, currentStat);
|
|
120712
121628
|
if (seenDirectories.has(currentKey)) {
|
|
120713
121629
|
failPrebuiltCollections(
|
|
120714
|
-
`prebuilt collection tree directory cycle detected at ${normalizeToPosix(
|
|
121630
|
+
`prebuilt collection tree directory cycle detected at ${normalizeToPosix(path9.relative(absRoot, currentAbsolute)) || "."}`
|
|
120715
121631
|
);
|
|
120716
121632
|
}
|
|
120717
121633
|
seenDirectories.add(currentKey);
|
|
120718
|
-
const entries = (0,
|
|
121634
|
+
const entries = (0, import_node_fs6.readdirSync)(currentAbsolute, { withFileTypes: true }).sort(
|
|
120719
121635
|
(left, right) => left.name.localeCompare(right.name)
|
|
120720
121636
|
);
|
|
120721
121637
|
for (const entry of entries) {
|
|
@@ -120725,10 +121641,10 @@ function listPrebuiltCollectionTreeFiles(collectionPath, artifactDir) {
|
|
|
120725
121641
|
`prebuilt collection tree exceeded the ${PREBUILT_COLLECTION_MAX_TRAVERSAL_ENTRIES} traversal-entry budget`
|
|
120726
121642
|
);
|
|
120727
121643
|
}
|
|
120728
|
-
const abs =
|
|
121644
|
+
const abs = path9.join(currentAbsolute, entry.name);
|
|
120729
121645
|
if (entry.isSymbolicLink()) {
|
|
120730
121646
|
failPrebuiltCollections(
|
|
120731
|
-
`prebuilt collection tree must not contain symlinks; received ${normalizeToPosix(
|
|
121647
|
+
`prebuilt collection tree must not contain symlinks; received ${normalizeToPosix(path9.relative(absRoot, abs))}`
|
|
120732
121648
|
);
|
|
120733
121649
|
}
|
|
120734
121650
|
if (entry.isDirectory()) {
|
|
@@ -120743,18 +121659,18 @@ function listPrebuiltCollectionTreeFiles(collectionPath, artifactDir) {
|
|
|
120743
121659
|
}
|
|
120744
121660
|
if (!entry.isFile()) {
|
|
120745
121661
|
failPrebuiltCollections(
|
|
120746
|
-
`prebuilt collection tree contains unsupported entry type at ${normalizeToPosix(
|
|
121662
|
+
`prebuilt collection tree contains unsupported entry type at ${normalizeToPosix(path9.relative(absRoot, abs))}`
|
|
120747
121663
|
);
|
|
120748
121664
|
}
|
|
120749
|
-
const fileLstat = (0,
|
|
121665
|
+
const fileLstat = (0, import_node_fs6.lstatSync)(abs);
|
|
120750
121666
|
if (fileLstat.isSymbolicLink() || !fileLstat.isFile()) {
|
|
120751
121667
|
failPrebuiltCollections(
|
|
120752
|
-
`prebuilt collection tree file changed or became unsupported at ${normalizeToPosix(
|
|
121668
|
+
`prebuilt collection tree file changed or became unsupported at ${normalizeToPosix(path9.relative(absRoot, abs))}`
|
|
120753
121669
|
);
|
|
120754
121670
|
}
|
|
120755
121671
|
if (fileLstat.size > PREBUILT_COLLECTION_MAX_FILE_BYTES) {
|
|
120756
121672
|
failPrebuiltCollections(
|
|
120757
|
-
`prebuilt collection tree file ${normalizeToPosix(
|
|
121673
|
+
`prebuilt collection tree file ${normalizeToPosix(path9.relative(absRoot, abs))} exceeds the ${PREBUILT_COLLECTION_MAX_FILE_BYTES / (1024 * 1024)} MiB individual-file budget`
|
|
120758
121674
|
);
|
|
120759
121675
|
}
|
|
120760
121676
|
totalBytes += fileLstat.size;
|
|
@@ -120765,7 +121681,7 @@ function listPrebuiltCollectionTreeFiles(collectionPath, artifactDir) {
|
|
|
120765
121681
|
}
|
|
120766
121682
|
files.push({
|
|
120767
121683
|
absolute: abs,
|
|
120768
|
-
relative: normalizeToPosix(
|
|
121684
|
+
relative: normalizeToPosix(path9.relative(absRoot, abs)),
|
|
120769
121685
|
dev: fileLstat.dev,
|
|
120770
121686
|
ino: fileLstat.ino,
|
|
120771
121687
|
size: fileLstat.size
|
|
@@ -120849,8 +121765,8 @@ async function preparePrebuiltCollections(inputs) {
|
|
|
120849
121765
|
inputs.artifactDir,
|
|
120850
121766
|
`prebuilt ${entry.role} collection path`
|
|
120851
121767
|
);
|
|
120852
|
-
const absolute =
|
|
120853
|
-
if (!(0,
|
|
121768
|
+
const absolute = path9.resolve(process.cwd(), confinedPath);
|
|
121769
|
+
if (!(0, import_node_fs6.existsSync)(absolute)) {
|
|
120854
121770
|
prepared.set(entry.role, { entry, confinedPath });
|
|
120855
121771
|
continue;
|
|
120856
121772
|
}
|
|
@@ -120879,8 +121795,8 @@ function tryReusePrebuiltCollection(options) {
|
|
|
120879
121795
|
if (confined !== expectedNormalized) {
|
|
120880
121796
|
return false;
|
|
120881
121797
|
}
|
|
120882
|
-
const expectedName =
|
|
120883
|
-
if (
|
|
121798
|
+
const expectedName = path9.posix.basename(expectedNormalized);
|
|
121799
|
+
if (path9.posix.basename(confined) !== expectedName) {
|
|
120884
121800
|
return false;
|
|
120885
121801
|
}
|
|
120886
121802
|
return prepared.artifactDigest === entry.artifactDigest;
|
|
@@ -120975,26 +121891,26 @@ function assertPathWithinCwd(targetPath, fieldName) {
|
|
|
120975
121891
|
const originalPath = String(targetPath || "");
|
|
120976
121892
|
const rawPath = originalPath.trim();
|
|
120977
121893
|
const segments = rawPath.split(/[\\/]+/).filter(Boolean);
|
|
120978
|
-
if (!rawPath || hasControlCharacter2(originalPath) ||
|
|
121894
|
+
if (!rawPath || hasControlCharacter2(originalPath) || path9.isAbsolute(rawPath) || path9.win32.isAbsolute(rawPath) || segments.includes("..") || rawPath.startsWith(":") || hasControlCharacter2(rawPath)) {
|
|
120979
121895
|
throw new Error(`${fieldName} must stay within the repository root; received ${targetPath}`);
|
|
120980
121896
|
}
|
|
120981
|
-
const base = (0,
|
|
120982
|
-
const resolved =
|
|
120983
|
-
const relative4 =
|
|
120984
|
-
if (relative4.startsWith("..") ||
|
|
121897
|
+
const base = (0, import_node_fs6.realpathSync)(process.cwd());
|
|
121898
|
+
const resolved = path9.resolve(base, rawPath);
|
|
121899
|
+
const relative4 = path9.relative(base, resolved);
|
|
121900
|
+
if (relative4.startsWith("..") || path9.isAbsolute(relative4)) {
|
|
120985
121901
|
throw new Error(`${fieldName} must stay within the repository root; received ${targetPath}`);
|
|
120986
121902
|
}
|
|
120987
121903
|
let existingPath = resolved;
|
|
120988
|
-
while (!(0,
|
|
120989
|
-
const parent =
|
|
121904
|
+
while (!(0, import_node_fs6.existsSync)(existingPath)) {
|
|
121905
|
+
const parent = path9.dirname(existingPath);
|
|
120990
121906
|
if (parent === existingPath) {
|
|
120991
121907
|
break;
|
|
120992
121908
|
}
|
|
120993
121909
|
existingPath = parent;
|
|
120994
121910
|
}
|
|
120995
|
-
const realExistingPath = (0,
|
|
120996
|
-
const realRelative =
|
|
120997
|
-
if (realRelative.startsWith("..") ||
|
|
121911
|
+
const realExistingPath = (0, import_node_fs6.realpathSync)(existingPath);
|
|
121912
|
+
const realRelative = path9.relative(base, realExistingPath);
|
|
121913
|
+
if (realRelative.startsWith("..") || path9.isAbsolute(realRelative)) {
|
|
120998
121914
|
throw new Error(`${fieldName} must stay within the repository root; received ${targetPath}`);
|
|
120999
121915
|
}
|
|
121000
121916
|
}
|
|
@@ -121043,7 +121959,7 @@ async function exportArtifacts(inputs, dependencies, envUids, assetProjectName,
|
|
|
121043
121959
|
}
|
|
121044
121960
|
ensureDir(".postman");
|
|
121045
121961
|
assertPathWithinCwd(".postman/resources.yaml", "resources state target");
|
|
121046
|
-
(0,
|
|
121962
|
+
(0, import_node_fs6.writeFileSync)(".postman/resources.yaml", buildResourcesManifest(
|
|
121047
121963
|
durableWorkspaceId,
|
|
121048
121964
|
{},
|
|
121049
121965
|
{},
|
|
@@ -121110,8 +122026,8 @@ async function exportArtifacts(inputs, dependencies, envUids, assetProjectName,
|
|
|
121110
122026
|
ensureDir(specsDir);
|
|
121111
122027
|
ensureDir(".postman");
|
|
121112
122028
|
const globalsFilePath = `${globalsDir}/workspace.globals.yaml`;
|
|
121113
|
-
if (!(0,
|
|
121114
|
-
(0,
|
|
122029
|
+
if (!(0, import_node_fs6.existsSync)(globalsFilePath)) {
|
|
122030
|
+
(0, import_node_fs6.writeFileSync)(globalsFilePath, "name: Globals\nvalues: []\n");
|
|
121115
122031
|
}
|
|
121116
122032
|
if (inputs.generateCiWorkflow) {
|
|
121117
122033
|
const ciDir = inputs.ciWorkflowPath.split("/").slice(0, -1).join("/");
|
|
@@ -121157,7 +122073,7 @@ async function exportArtifacts(inputs, dependencies, envUids, assetProjectName,
|
|
|
121157
122073
|
);
|
|
121158
122074
|
}
|
|
121159
122075
|
assertPathWithinCwd(".postman/resources.yaml", "resources state target");
|
|
121160
|
-
(0,
|
|
122076
|
+
(0, import_node_fs6.writeFileSync)(".postman/resources.yaml", buildResourcesManifest(
|
|
121161
122077
|
durableWorkspaceId,
|
|
121162
122078
|
manifestCollections,
|
|
121163
122079
|
envUids,
|
|
@@ -121171,12 +122087,12 @@ async function exportArtifacts(inputs, dependencies, envUids, assetProjectName,
|
|
|
121171
122087
|
if (mappedSpec && Object.keys(manifestCollections).length > 0) {
|
|
121172
122088
|
let existingWorkflows;
|
|
121173
122089
|
try {
|
|
121174
|
-
existingWorkflows = (0,
|
|
122090
|
+
existingWorkflows = (0, import_node_fs6.readFileSync)(".postman/workflows.yaml", "utf8");
|
|
121175
122091
|
} catch {
|
|
121176
122092
|
existingWorkflows = void 0;
|
|
121177
122093
|
}
|
|
121178
122094
|
assertPathWithinCwd(".postman/workflows.yaml", "workflows state target");
|
|
121179
|
-
(0,
|
|
122095
|
+
(0, import_node_fs6.writeFileSync)(
|
|
121180
122096
|
".postman/workflows.yaml",
|
|
121181
122097
|
buildSpecCollectionWorkflowManifest(
|
|
121182
122098
|
mappedSpec.configRelativePath,
|
|
@@ -121232,13 +122148,13 @@ async function commitAndPushGeneratedFiles(inputs, dependencies, privateMockAuth
|
|
|
121232
122148
|
const dir = parts.slice(0, -1).join("/");
|
|
121233
122149
|
ensureDir(dir);
|
|
121234
122150
|
}
|
|
121235
|
-
(0,
|
|
122151
|
+
(0, import_node_fs6.writeFileSync)(inputs.ciWorkflowPath, ciWorkflow);
|
|
121236
122152
|
if (inputs.provider === "github" || inputs.provider === "unknown") {
|
|
121237
122153
|
const gcPath = ".github/workflows/postman-preview-gc.yml";
|
|
121238
122154
|
if (inputs.ciWorkflowPath.endsWith(".github/workflows/ci.yml") || inputs.ciWorkflowPath === ".github/workflows/ci.yml") {
|
|
121239
122155
|
assertPathWithinCwd(gcPath, "preview GC workflow path");
|
|
121240
122156
|
ensureDir(".github/workflows");
|
|
121241
|
-
(0,
|
|
122157
|
+
(0, import_node_fs6.writeFileSync)(gcPath, renderGcWorkflowTemplate());
|
|
121242
122158
|
}
|
|
121243
122159
|
}
|
|
121244
122160
|
}
|
|
@@ -121246,16 +122162,16 @@ async function commitAndPushGeneratedFiles(inputs, dependencies, privateMockAuth
|
|
|
121246
122162
|
return { commitSha: "", resolvedCurrentRef: "", pushed: false };
|
|
121247
122163
|
}
|
|
121248
122164
|
const provisionPath = ".github/workflows/provision.yml";
|
|
121249
|
-
const provisionExists = inputs.provider === "github" && (0,
|
|
122165
|
+
const provisionExists = inputs.provider === "github" && (0, import_node_fs6.existsSync)(provisionPath);
|
|
121250
122166
|
const gcWorkflowPath = ".github/workflows/postman-preview-gc.yml";
|
|
121251
|
-
const gcExists = inputs.generateCiWorkflow && (0,
|
|
122167
|
+
const gcExists = inputs.generateCiWorkflow && (0, import_node_fs6.existsSync)(gcWorkflowPath);
|
|
121252
122168
|
const stagePaths = (inputs.onboardingScope === "spec-only" ? [".postman/resources.yaml"] : [
|
|
121253
122169
|
inputs.artifactDir,
|
|
121254
122170
|
".postman",
|
|
121255
122171
|
inputs.generateCiWorkflow ? inputs.ciWorkflowPath : null,
|
|
121256
122172
|
gcExists ? gcWorkflowPath : null,
|
|
121257
122173
|
provisionExists ? provisionPath : null
|
|
121258
|
-
]).filter((entry) => typeof entry === "string" && ((0,
|
|
122174
|
+
]).filter((entry) => typeof entry === "string" && ((0, import_node_fs6.existsSync)(entry) || entry === provisionPath));
|
|
121259
122175
|
if (stagePaths.length === 0) {
|
|
121260
122176
|
dependencies.core.info("No generated repository paths were found; skipping repo mutation.");
|
|
121261
122177
|
return {
|
|
@@ -122200,6 +123116,7 @@ function createRepoSyncDependencies(inputs, resolved, factories, options = {}) {
|
|
|
122200
123116
|
listSpecVersionTags: gatewayAssets.listSpecVersionTags.bind(gatewayAssets)
|
|
122201
123117
|
};
|
|
122202
123118
|
const repoMutation = repository && (inputs.repoWriteMode === "commit-only" || inputs.repoWriteMode === "commit-and-push") ? new RepoMutationService({
|
|
123119
|
+
cwd: process.cwd(),
|
|
122203
123120
|
provider: inputs.provider,
|
|
122204
123121
|
repository,
|
|
122205
123122
|
repoUrl: inputs.repoUrl || void 0,
|
|
@@ -122265,7 +123182,16 @@ function runGatedSkip(inputs, decision, actionCore) {
|
|
|
122265
123182
|
return outputs;
|
|
122266
123183
|
}
|
|
122267
123184
|
async function runAction(actionCore = core_exports, actionExec = exec_exports) {
|
|
123185
|
+
activateWorkingDirectory(
|
|
123186
|
+
actionCore.getInput("working-directory"),
|
|
123187
|
+
process.env.GITHUB_WORKSPACE ?? process.cwd()
|
|
123188
|
+
);
|
|
122268
123189
|
const inputs = readActionInputs(actionCore);
|
|
123190
|
+
if (inputs.generateCiWorkflowDefaulted) {
|
|
123191
|
+
actionCore.info(
|
|
123192
|
+
"working-directory is set; generate-ci-workflow defaulted to false. Use the root monorepo dispatcher workflow."
|
|
123193
|
+
);
|
|
123194
|
+
}
|
|
122269
123195
|
const branchDecision = decideBranchTier(inputs);
|
|
122270
123196
|
if (branchDecision.tier === "gated") {
|
|
122271
123197
|
return runGatedSkip(inputs, branchDecision, actionCore);
|
|
@@ -122379,5 +123305,5 @@ postman-collection/index.js:
|
|
|
122379
123305
|
*)
|
|
122380
123306
|
|
|
122381
123307
|
js-yaml/dist/js-yaml.mjs:
|
|
122382
|
-
(*! js-yaml 5.2.
|
|
123308
|
+
(*! js-yaml 5.2.3 https://github.com/nodeca/js-yaml @license MIT *)
|
|
122383
123309
|
*/
|