@base44-preview/cli 0.0.49-pr.453.20f6e7b → 0.0.49-pr.453.765cc14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/index.js +1910 -1910
- package/dist/cli/index.js.map +21 -21
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -220132,825 +220132,6 @@ class TimeoutError extends Error {
|
|
|
220132
220132
|
}
|
|
220133
220133
|
}
|
|
220134
220134
|
|
|
220135
|
-
// ../../node_modules/ky/distribution/errors/HTTPError.js
|
|
220136
|
-
class HTTPError extends Error {
|
|
220137
|
-
response;
|
|
220138
|
-
request;
|
|
220139
|
-
options;
|
|
220140
|
-
constructor(response, request, options) {
|
|
220141
|
-
const code = response.status || response.status === 0 ? response.status : "";
|
|
220142
|
-
const title = response.statusText ?? "";
|
|
220143
|
-
const status = `${code} ${title}`.trim();
|
|
220144
|
-
const reason = status ? `status code ${status}` : "an unknown error";
|
|
220145
|
-
super(`Request failed with ${reason}: ${request.method} ${request.url}`);
|
|
220146
|
-
this.name = "HTTPError";
|
|
220147
|
-
this.response = response;
|
|
220148
|
-
this.request = request;
|
|
220149
|
-
this.options = options;
|
|
220150
|
-
}
|
|
220151
|
-
}
|
|
220152
|
-
|
|
220153
|
-
// ../../node_modules/ky/distribution/errors/NonError.js
|
|
220154
|
-
class NonError extends Error {
|
|
220155
|
-
name = "NonError";
|
|
220156
|
-
value;
|
|
220157
|
-
constructor(value) {
|
|
220158
|
-
let message = "Non-error value was thrown";
|
|
220159
|
-
try {
|
|
220160
|
-
if (typeof value === "string") {
|
|
220161
|
-
message = value;
|
|
220162
|
-
} else if (value && typeof value === "object" && "message" in value && typeof value.message === "string") {
|
|
220163
|
-
message = value.message;
|
|
220164
|
-
}
|
|
220165
|
-
} catch {}
|
|
220166
|
-
super(message);
|
|
220167
|
-
this.value = value;
|
|
220168
|
-
}
|
|
220169
|
-
}
|
|
220170
|
-
|
|
220171
|
-
// ../../node_modules/ky/distribution/errors/ForceRetryError.js
|
|
220172
|
-
class ForceRetryError extends Error {
|
|
220173
|
-
name = "ForceRetryError";
|
|
220174
|
-
customDelay;
|
|
220175
|
-
code;
|
|
220176
|
-
customRequest;
|
|
220177
|
-
constructor(options) {
|
|
220178
|
-
const cause = options?.cause ? options.cause instanceof Error ? options.cause : new NonError(options.cause) : undefined;
|
|
220179
|
-
super(options?.code ? `Forced retry: ${options.code}` : "Forced retry", cause ? { cause } : undefined);
|
|
220180
|
-
this.customDelay = options?.delay;
|
|
220181
|
-
this.code = options?.code;
|
|
220182
|
-
this.customRequest = options?.request;
|
|
220183
|
-
}
|
|
220184
|
-
}
|
|
220185
|
-
|
|
220186
|
-
// ../../node_modules/ky/distribution/core/constants.js
|
|
220187
|
-
var supportsRequestStreams = (() => {
|
|
220188
|
-
let duplexAccessed = false;
|
|
220189
|
-
let hasContentType = false;
|
|
220190
|
-
const supportsReadableStream = typeof globalThis.ReadableStream === "function";
|
|
220191
|
-
const supportsRequest = typeof globalThis.Request === "function";
|
|
220192
|
-
if (supportsReadableStream && supportsRequest) {
|
|
220193
|
-
try {
|
|
220194
|
-
hasContentType = new globalThis.Request("https://empty.invalid", {
|
|
220195
|
-
body: new globalThis.ReadableStream,
|
|
220196
|
-
method: "POST",
|
|
220197
|
-
get duplex() {
|
|
220198
|
-
duplexAccessed = true;
|
|
220199
|
-
return "half";
|
|
220200
|
-
}
|
|
220201
|
-
}).headers.has("Content-Type");
|
|
220202
|
-
} catch (error) {
|
|
220203
|
-
if (error instanceof Error && error.message === "unsupported BodyInit type") {
|
|
220204
|
-
return false;
|
|
220205
|
-
}
|
|
220206
|
-
throw error;
|
|
220207
|
-
}
|
|
220208
|
-
}
|
|
220209
|
-
return duplexAccessed && !hasContentType;
|
|
220210
|
-
})();
|
|
220211
|
-
var supportsAbortController = typeof globalThis.AbortController === "function";
|
|
220212
|
-
var supportsAbortSignal = typeof globalThis.AbortSignal === "function" && typeof globalThis.AbortSignal.any === "function";
|
|
220213
|
-
var supportsResponseStreams = typeof globalThis.ReadableStream === "function";
|
|
220214
|
-
var supportsFormData = typeof globalThis.FormData === "function";
|
|
220215
|
-
var requestMethods = ["get", "post", "put", "patch", "head", "delete"];
|
|
220216
|
-
var validate = () => {
|
|
220217
|
-
return;
|
|
220218
|
-
};
|
|
220219
|
-
validate();
|
|
220220
|
-
var responseTypes = {
|
|
220221
|
-
json: "application/json",
|
|
220222
|
-
text: "text/*",
|
|
220223
|
-
formData: "multipart/form-data",
|
|
220224
|
-
arrayBuffer: "*/*",
|
|
220225
|
-
blob: "*/*",
|
|
220226
|
-
bytes: "*/*"
|
|
220227
|
-
};
|
|
220228
|
-
var maxSafeTimeout = 2147483647;
|
|
220229
|
-
var usualFormBoundarySize = new TextEncoder().encode("------WebKitFormBoundaryaxpyiPgbbPti10Rw").length;
|
|
220230
|
-
var stop = Symbol("stop");
|
|
220231
|
-
|
|
220232
|
-
class RetryMarker {
|
|
220233
|
-
options;
|
|
220234
|
-
constructor(options) {
|
|
220235
|
-
this.options = options;
|
|
220236
|
-
}
|
|
220237
|
-
}
|
|
220238
|
-
var retry = (options) => new RetryMarker(options);
|
|
220239
|
-
var kyOptionKeys = {
|
|
220240
|
-
json: true,
|
|
220241
|
-
parseJson: true,
|
|
220242
|
-
stringifyJson: true,
|
|
220243
|
-
searchParams: true,
|
|
220244
|
-
prefixUrl: true,
|
|
220245
|
-
retry: true,
|
|
220246
|
-
timeout: true,
|
|
220247
|
-
hooks: true,
|
|
220248
|
-
throwHttpErrors: true,
|
|
220249
|
-
onDownloadProgress: true,
|
|
220250
|
-
onUploadProgress: true,
|
|
220251
|
-
fetch: true,
|
|
220252
|
-
context: true
|
|
220253
|
-
};
|
|
220254
|
-
var vendorSpecificOptions = {
|
|
220255
|
-
next: true
|
|
220256
|
-
};
|
|
220257
|
-
var requestOptionsRegistry = {
|
|
220258
|
-
method: true,
|
|
220259
|
-
headers: true,
|
|
220260
|
-
body: true,
|
|
220261
|
-
mode: true,
|
|
220262
|
-
credentials: true,
|
|
220263
|
-
cache: true,
|
|
220264
|
-
redirect: true,
|
|
220265
|
-
referrer: true,
|
|
220266
|
-
referrerPolicy: true,
|
|
220267
|
-
integrity: true,
|
|
220268
|
-
keepalive: true,
|
|
220269
|
-
signal: true,
|
|
220270
|
-
window: true,
|
|
220271
|
-
duplex: true
|
|
220272
|
-
};
|
|
220273
|
-
|
|
220274
|
-
// ../../node_modules/ky/distribution/utils/body.js
|
|
220275
|
-
var getBodySize = (body) => {
|
|
220276
|
-
if (!body) {
|
|
220277
|
-
return 0;
|
|
220278
|
-
}
|
|
220279
|
-
if (body instanceof FormData) {
|
|
220280
|
-
let size = 0;
|
|
220281
|
-
for (const [key, value] of body) {
|
|
220282
|
-
size += usualFormBoundarySize;
|
|
220283
|
-
size += new TextEncoder().encode(`Content-Disposition: form-data; name="${key}"`).length;
|
|
220284
|
-
size += typeof value === "string" ? new TextEncoder().encode(value).length : value.size;
|
|
220285
|
-
}
|
|
220286
|
-
return size;
|
|
220287
|
-
}
|
|
220288
|
-
if (body instanceof Blob) {
|
|
220289
|
-
return body.size;
|
|
220290
|
-
}
|
|
220291
|
-
if (body instanceof ArrayBuffer) {
|
|
220292
|
-
return body.byteLength;
|
|
220293
|
-
}
|
|
220294
|
-
if (typeof body === "string") {
|
|
220295
|
-
return new TextEncoder().encode(body).length;
|
|
220296
|
-
}
|
|
220297
|
-
if (body instanceof URLSearchParams) {
|
|
220298
|
-
return new TextEncoder().encode(body.toString()).length;
|
|
220299
|
-
}
|
|
220300
|
-
if ("byteLength" in body) {
|
|
220301
|
-
return body.byteLength;
|
|
220302
|
-
}
|
|
220303
|
-
if (typeof body === "object" && body !== null) {
|
|
220304
|
-
try {
|
|
220305
|
-
const jsonString = JSON.stringify(body);
|
|
220306
|
-
return new TextEncoder().encode(jsonString).length;
|
|
220307
|
-
} catch {
|
|
220308
|
-
return 0;
|
|
220309
|
-
}
|
|
220310
|
-
}
|
|
220311
|
-
return 0;
|
|
220312
|
-
};
|
|
220313
|
-
var withProgress = (stream, totalBytes, onProgress) => {
|
|
220314
|
-
let previousChunk;
|
|
220315
|
-
let transferredBytes = 0;
|
|
220316
|
-
return stream.pipeThrough(new TransformStream({
|
|
220317
|
-
transform(currentChunk, controller) {
|
|
220318
|
-
controller.enqueue(currentChunk);
|
|
220319
|
-
if (previousChunk) {
|
|
220320
|
-
transferredBytes += previousChunk.byteLength;
|
|
220321
|
-
let percent = totalBytes === 0 ? 0 : transferredBytes / totalBytes;
|
|
220322
|
-
if (percent >= 1) {
|
|
220323
|
-
percent = 1 - Number.EPSILON;
|
|
220324
|
-
}
|
|
220325
|
-
onProgress?.({ percent, totalBytes: Math.max(totalBytes, transferredBytes), transferredBytes }, previousChunk);
|
|
220326
|
-
}
|
|
220327
|
-
previousChunk = currentChunk;
|
|
220328
|
-
},
|
|
220329
|
-
flush() {
|
|
220330
|
-
if (previousChunk) {
|
|
220331
|
-
transferredBytes += previousChunk.byteLength;
|
|
220332
|
-
onProgress?.({ percent: 1, totalBytes: Math.max(totalBytes, transferredBytes), transferredBytes }, previousChunk);
|
|
220333
|
-
}
|
|
220334
|
-
}
|
|
220335
|
-
}));
|
|
220336
|
-
};
|
|
220337
|
-
var streamResponse = (response, onDownloadProgress) => {
|
|
220338
|
-
if (!response.body) {
|
|
220339
|
-
return response;
|
|
220340
|
-
}
|
|
220341
|
-
if (response.status === 204) {
|
|
220342
|
-
return new Response(null, {
|
|
220343
|
-
status: response.status,
|
|
220344
|
-
statusText: response.statusText,
|
|
220345
|
-
headers: response.headers
|
|
220346
|
-
});
|
|
220347
|
-
}
|
|
220348
|
-
const totalBytes = Math.max(0, Number(response.headers.get("content-length")) || 0);
|
|
220349
|
-
return new Response(withProgress(response.body, totalBytes, onDownloadProgress), {
|
|
220350
|
-
status: response.status,
|
|
220351
|
-
statusText: response.statusText,
|
|
220352
|
-
headers: response.headers
|
|
220353
|
-
});
|
|
220354
|
-
};
|
|
220355
|
-
var streamRequest = (request, onUploadProgress, originalBody) => {
|
|
220356
|
-
if (!request.body) {
|
|
220357
|
-
return request;
|
|
220358
|
-
}
|
|
220359
|
-
const totalBytes = getBodySize(originalBody ?? request.body);
|
|
220360
|
-
return new Request(request, {
|
|
220361
|
-
duplex: "half",
|
|
220362
|
-
body: withProgress(request.body, totalBytes, onUploadProgress)
|
|
220363
|
-
});
|
|
220364
|
-
};
|
|
220365
|
-
|
|
220366
|
-
// ../../node_modules/ky/distribution/utils/is.js
|
|
220367
|
-
var isObject = (value) => value !== null && typeof value === "object";
|
|
220368
|
-
|
|
220369
|
-
// ../../node_modules/ky/distribution/utils/merge.js
|
|
220370
|
-
var validateAndMerge = (...sources) => {
|
|
220371
|
-
for (const source of sources) {
|
|
220372
|
-
if ((!isObject(source) || Array.isArray(source)) && source !== undefined) {
|
|
220373
|
-
throw new TypeError("The `options` argument must be an object");
|
|
220374
|
-
}
|
|
220375
|
-
}
|
|
220376
|
-
return deepMerge({}, ...sources);
|
|
220377
|
-
};
|
|
220378
|
-
var mergeHeaders = (source1 = {}, source2 = {}) => {
|
|
220379
|
-
const result = new globalThis.Headers(source1);
|
|
220380
|
-
const isHeadersInstance = source2 instanceof globalThis.Headers;
|
|
220381
|
-
const source = new globalThis.Headers(source2);
|
|
220382
|
-
for (const [key, value] of source.entries()) {
|
|
220383
|
-
if (isHeadersInstance && value === "undefined" || value === undefined) {
|
|
220384
|
-
result.delete(key);
|
|
220385
|
-
} else {
|
|
220386
|
-
result.set(key, value);
|
|
220387
|
-
}
|
|
220388
|
-
}
|
|
220389
|
-
return result;
|
|
220390
|
-
};
|
|
220391
|
-
function newHookValue(original, incoming, property) {
|
|
220392
|
-
return Object.hasOwn(incoming, property) && incoming[property] === undefined ? [] : deepMerge(original[property] ?? [], incoming[property] ?? []);
|
|
220393
|
-
}
|
|
220394
|
-
var mergeHooks = (original = {}, incoming = {}) => ({
|
|
220395
|
-
beforeRequest: newHookValue(original, incoming, "beforeRequest"),
|
|
220396
|
-
beforeRetry: newHookValue(original, incoming, "beforeRetry"),
|
|
220397
|
-
afterResponse: newHookValue(original, incoming, "afterResponse"),
|
|
220398
|
-
beforeError: newHookValue(original, incoming, "beforeError")
|
|
220399
|
-
});
|
|
220400
|
-
var appendSearchParameters = (target, source) => {
|
|
220401
|
-
const result = new URLSearchParams;
|
|
220402
|
-
for (const input of [target, source]) {
|
|
220403
|
-
if (input === undefined) {
|
|
220404
|
-
continue;
|
|
220405
|
-
}
|
|
220406
|
-
if (input instanceof URLSearchParams) {
|
|
220407
|
-
for (const [key, value] of input.entries()) {
|
|
220408
|
-
result.append(key, value);
|
|
220409
|
-
}
|
|
220410
|
-
} else if (Array.isArray(input)) {
|
|
220411
|
-
for (const pair of input) {
|
|
220412
|
-
if (!Array.isArray(pair) || pair.length !== 2) {
|
|
220413
|
-
throw new TypeError("Array search parameters must be provided in [[key, value], ...] format");
|
|
220414
|
-
}
|
|
220415
|
-
result.append(String(pair[0]), String(pair[1]));
|
|
220416
|
-
}
|
|
220417
|
-
} else if (isObject(input)) {
|
|
220418
|
-
for (const [key, value] of Object.entries(input)) {
|
|
220419
|
-
if (value !== undefined) {
|
|
220420
|
-
result.append(key, String(value));
|
|
220421
|
-
}
|
|
220422
|
-
}
|
|
220423
|
-
} else {
|
|
220424
|
-
const parameters = new URLSearchParams(input);
|
|
220425
|
-
for (const [key, value] of parameters.entries()) {
|
|
220426
|
-
result.append(key, value);
|
|
220427
|
-
}
|
|
220428
|
-
}
|
|
220429
|
-
}
|
|
220430
|
-
return result;
|
|
220431
|
-
};
|
|
220432
|
-
var deepMerge = (...sources) => {
|
|
220433
|
-
let returnValue = {};
|
|
220434
|
-
let headers = {};
|
|
220435
|
-
let hooks = {};
|
|
220436
|
-
let searchParameters;
|
|
220437
|
-
const signals = [];
|
|
220438
|
-
for (const source of sources) {
|
|
220439
|
-
if (Array.isArray(source)) {
|
|
220440
|
-
if (!Array.isArray(returnValue)) {
|
|
220441
|
-
returnValue = [];
|
|
220442
|
-
}
|
|
220443
|
-
returnValue = [...returnValue, ...source];
|
|
220444
|
-
} else if (isObject(source)) {
|
|
220445
|
-
for (let [key, value] of Object.entries(source)) {
|
|
220446
|
-
if (key === "signal" && value instanceof globalThis.AbortSignal) {
|
|
220447
|
-
signals.push(value);
|
|
220448
|
-
continue;
|
|
220449
|
-
}
|
|
220450
|
-
if (key === "context") {
|
|
220451
|
-
if (value !== undefined && value !== null && (!isObject(value) || Array.isArray(value))) {
|
|
220452
|
-
throw new TypeError("The `context` option must be an object");
|
|
220453
|
-
}
|
|
220454
|
-
returnValue = {
|
|
220455
|
-
...returnValue,
|
|
220456
|
-
context: value === undefined || value === null ? {} : { ...returnValue.context, ...value }
|
|
220457
|
-
};
|
|
220458
|
-
continue;
|
|
220459
|
-
}
|
|
220460
|
-
if (key === "searchParams") {
|
|
220461
|
-
if (value === undefined || value === null) {
|
|
220462
|
-
searchParameters = undefined;
|
|
220463
|
-
} else {
|
|
220464
|
-
searchParameters = searchParameters === undefined ? value : appendSearchParameters(searchParameters, value);
|
|
220465
|
-
}
|
|
220466
|
-
continue;
|
|
220467
|
-
}
|
|
220468
|
-
if (isObject(value) && key in returnValue) {
|
|
220469
|
-
value = deepMerge(returnValue[key], value);
|
|
220470
|
-
}
|
|
220471
|
-
returnValue = { ...returnValue, [key]: value };
|
|
220472
|
-
}
|
|
220473
|
-
if (isObject(source.hooks)) {
|
|
220474
|
-
hooks = mergeHooks(hooks, source.hooks);
|
|
220475
|
-
returnValue.hooks = hooks;
|
|
220476
|
-
}
|
|
220477
|
-
if (isObject(source.headers)) {
|
|
220478
|
-
headers = mergeHeaders(headers, source.headers);
|
|
220479
|
-
returnValue.headers = headers;
|
|
220480
|
-
}
|
|
220481
|
-
}
|
|
220482
|
-
}
|
|
220483
|
-
if (searchParameters !== undefined) {
|
|
220484
|
-
returnValue.searchParams = searchParameters;
|
|
220485
|
-
}
|
|
220486
|
-
if (signals.length > 0) {
|
|
220487
|
-
if (signals.length === 1) {
|
|
220488
|
-
returnValue.signal = signals[0];
|
|
220489
|
-
} else if (supportsAbortSignal) {
|
|
220490
|
-
returnValue.signal = AbortSignal.any(signals);
|
|
220491
|
-
} else {
|
|
220492
|
-
returnValue.signal = signals.at(-1);
|
|
220493
|
-
}
|
|
220494
|
-
}
|
|
220495
|
-
return returnValue;
|
|
220496
|
-
};
|
|
220497
|
-
|
|
220498
|
-
// ../../node_modules/ky/distribution/utils/normalize.js
|
|
220499
|
-
var normalizeRequestMethod = (input) => requestMethods.includes(input) ? input.toUpperCase() : input;
|
|
220500
|
-
var retryMethods = ["get", "put", "head", "delete", "options", "trace"];
|
|
220501
|
-
var retryStatusCodes = [408, 413, 429, 500, 502, 503, 504];
|
|
220502
|
-
var retryAfterStatusCodes = [413, 429, 503];
|
|
220503
|
-
var defaultRetryOptions = {
|
|
220504
|
-
limit: 2,
|
|
220505
|
-
methods: retryMethods,
|
|
220506
|
-
statusCodes: retryStatusCodes,
|
|
220507
|
-
afterStatusCodes: retryAfterStatusCodes,
|
|
220508
|
-
maxRetryAfter: Number.POSITIVE_INFINITY,
|
|
220509
|
-
backoffLimit: Number.POSITIVE_INFINITY,
|
|
220510
|
-
delay: (attemptCount) => 0.3 * 2 ** (attemptCount - 1) * 1000,
|
|
220511
|
-
jitter: undefined,
|
|
220512
|
-
retryOnTimeout: false
|
|
220513
|
-
};
|
|
220514
|
-
var normalizeRetryOptions = (retry2 = {}) => {
|
|
220515
|
-
if (typeof retry2 === "number") {
|
|
220516
|
-
return {
|
|
220517
|
-
...defaultRetryOptions,
|
|
220518
|
-
limit: retry2
|
|
220519
|
-
};
|
|
220520
|
-
}
|
|
220521
|
-
if (retry2.methods && !Array.isArray(retry2.methods)) {
|
|
220522
|
-
throw new Error("retry.methods must be an array");
|
|
220523
|
-
}
|
|
220524
|
-
retry2.methods &&= retry2.methods.map((method) => method.toLowerCase());
|
|
220525
|
-
if (retry2.statusCodes && !Array.isArray(retry2.statusCodes)) {
|
|
220526
|
-
throw new Error("retry.statusCodes must be an array");
|
|
220527
|
-
}
|
|
220528
|
-
const normalizedRetry = Object.fromEntries(Object.entries(retry2).filter(([, value]) => value !== undefined));
|
|
220529
|
-
return {
|
|
220530
|
-
...defaultRetryOptions,
|
|
220531
|
-
...normalizedRetry
|
|
220532
|
-
};
|
|
220533
|
-
};
|
|
220534
|
-
|
|
220535
|
-
// ../../node_modules/ky/distribution/errors/TimeoutError.js
|
|
220536
|
-
class TimeoutError2 extends Error {
|
|
220537
|
-
request;
|
|
220538
|
-
constructor(request) {
|
|
220539
|
-
super(`Request timed out: ${request.method} ${request.url}`);
|
|
220540
|
-
this.name = "TimeoutError";
|
|
220541
|
-
this.request = request;
|
|
220542
|
-
}
|
|
220543
|
-
}
|
|
220544
|
-
|
|
220545
|
-
// ../../node_modules/ky/distribution/utils/timeout.js
|
|
220546
|
-
async function timeout(request, init, abortController, options) {
|
|
220547
|
-
return new Promise((resolve, reject) => {
|
|
220548
|
-
const timeoutId = setTimeout(() => {
|
|
220549
|
-
if (abortController) {
|
|
220550
|
-
abortController.abort();
|
|
220551
|
-
}
|
|
220552
|
-
reject(new TimeoutError2(request));
|
|
220553
|
-
}, options.timeout);
|
|
220554
|
-
options.fetch(request, init).then(resolve).catch(reject).then(() => {
|
|
220555
|
-
clearTimeout(timeoutId);
|
|
220556
|
-
});
|
|
220557
|
-
});
|
|
220558
|
-
}
|
|
220559
|
-
|
|
220560
|
-
// ../../node_modules/ky/distribution/utils/delay.js
|
|
220561
|
-
async function delay(ms, { signal }) {
|
|
220562
|
-
return new Promise((resolve, reject) => {
|
|
220563
|
-
if (signal) {
|
|
220564
|
-
signal.throwIfAborted();
|
|
220565
|
-
signal.addEventListener("abort", abortHandler, { once: true });
|
|
220566
|
-
}
|
|
220567
|
-
function abortHandler() {
|
|
220568
|
-
clearTimeout(timeoutId);
|
|
220569
|
-
reject(signal.reason);
|
|
220570
|
-
}
|
|
220571
|
-
const timeoutId = setTimeout(() => {
|
|
220572
|
-
signal?.removeEventListener("abort", abortHandler);
|
|
220573
|
-
resolve();
|
|
220574
|
-
}, ms);
|
|
220575
|
-
});
|
|
220576
|
-
}
|
|
220577
|
-
|
|
220578
|
-
// ../../node_modules/ky/distribution/utils/options.js
|
|
220579
|
-
var findUnknownOptions = (request, options) => {
|
|
220580
|
-
const unknownOptions = {};
|
|
220581
|
-
for (const key in options) {
|
|
220582
|
-
if (!Object.hasOwn(options, key)) {
|
|
220583
|
-
continue;
|
|
220584
|
-
}
|
|
220585
|
-
if (!(key in requestOptionsRegistry) && !(key in kyOptionKeys) && (!(key in request) || (key in vendorSpecificOptions))) {
|
|
220586
|
-
unknownOptions[key] = options[key];
|
|
220587
|
-
}
|
|
220588
|
-
}
|
|
220589
|
-
return unknownOptions;
|
|
220590
|
-
};
|
|
220591
|
-
var hasSearchParameters = (search) => {
|
|
220592
|
-
if (search === undefined) {
|
|
220593
|
-
return false;
|
|
220594
|
-
}
|
|
220595
|
-
if (Array.isArray(search)) {
|
|
220596
|
-
return search.length > 0;
|
|
220597
|
-
}
|
|
220598
|
-
if (search instanceof URLSearchParams) {
|
|
220599
|
-
return search.size > 0;
|
|
220600
|
-
}
|
|
220601
|
-
if (typeof search === "object") {
|
|
220602
|
-
return Object.keys(search).length > 0;
|
|
220603
|
-
}
|
|
220604
|
-
if (typeof search === "string") {
|
|
220605
|
-
return search.trim().length > 0;
|
|
220606
|
-
}
|
|
220607
|
-
return Boolean(search);
|
|
220608
|
-
};
|
|
220609
|
-
|
|
220610
|
-
// ../../node_modules/ky/distribution/utils/type-guards.js
|
|
220611
|
-
function isHTTPError(error) {
|
|
220612
|
-
return error instanceof HTTPError || error?.name === HTTPError.name;
|
|
220613
|
-
}
|
|
220614
|
-
function isTimeoutError(error) {
|
|
220615
|
-
return error instanceof TimeoutError2 || error?.name === TimeoutError2.name;
|
|
220616
|
-
}
|
|
220617
|
-
|
|
220618
|
-
// ../../node_modules/ky/distribution/core/Ky.js
|
|
220619
|
-
class Ky {
|
|
220620
|
-
static create(input, options) {
|
|
220621
|
-
const ky = new Ky(input, options);
|
|
220622
|
-
const function_ = async () => {
|
|
220623
|
-
if (typeof ky.#options.timeout === "number" && ky.#options.timeout > maxSafeTimeout) {
|
|
220624
|
-
throw new RangeError(`The \`timeout\` option cannot be greater than ${maxSafeTimeout}`);
|
|
220625
|
-
}
|
|
220626
|
-
await Promise.resolve();
|
|
220627
|
-
let response = await ky.#fetch();
|
|
220628
|
-
for (const hook of ky.#options.hooks.afterResponse) {
|
|
220629
|
-
const clonedResponse = ky.#decorateResponse(response.clone());
|
|
220630
|
-
let modifiedResponse;
|
|
220631
|
-
try {
|
|
220632
|
-
modifiedResponse = await hook(ky.request, ky.#getNormalizedOptions(), clonedResponse, { retryCount: ky.#retryCount });
|
|
220633
|
-
} catch (error) {
|
|
220634
|
-
ky.#cancelResponseBody(clonedResponse);
|
|
220635
|
-
ky.#cancelResponseBody(response);
|
|
220636
|
-
throw error;
|
|
220637
|
-
}
|
|
220638
|
-
if (modifiedResponse instanceof RetryMarker) {
|
|
220639
|
-
ky.#cancelResponseBody(clonedResponse);
|
|
220640
|
-
ky.#cancelResponseBody(response);
|
|
220641
|
-
throw new ForceRetryError(modifiedResponse.options);
|
|
220642
|
-
}
|
|
220643
|
-
const nextResponse = modifiedResponse instanceof globalThis.Response ? modifiedResponse : response;
|
|
220644
|
-
if (clonedResponse !== nextResponse) {
|
|
220645
|
-
ky.#cancelResponseBody(clonedResponse);
|
|
220646
|
-
}
|
|
220647
|
-
if (response !== nextResponse) {
|
|
220648
|
-
ky.#cancelResponseBody(response);
|
|
220649
|
-
}
|
|
220650
|
-
response = nextResponse;
|
|
220651
|
-
}
|
|
220652
|
-
ky.#decorateResponse(response);
|
|
220653
|
-
if (!response.ok && (typeof ky.#options.throwHttpErrors === "function" ? ky.#options.throwHttpErrors(response.status) : ky.#options.throwHttpErrors)) {
|
|
220654
|
-
let error = new HTTPError(response, ky.request, ky.#getNormalizedOptions());
|
|
220655
|
-
for (const hook of ky.#options.hooks.beforeError) {
|
|
220656
|
-
error = await hook(error, { retryCount: ky.#retryCount });
|
|
220657
|
-
}
|
|
220658
|
-
throw error;
|
|
220659
|
-
}
|
|
220660
|
-
if (ky.#options.onDownloadProgress) {
|
|
220661
|
-
if (typeof ky.#options.onDownloadProgress !== "function") {
|
|
220662
|
-
throw new TypeError("The `onDownloadProgress` option must be a function");
|
|
220663
|
-
}
|
|
220664
|
-
if (!supportsResponseStreams) {
|
|
220665
|
-
throw new Error("Streams are not supported in your environment. `ReadableStream` is missing.");
|
|
220666
|
-
}
|
|
220667
|
-
const progressResponse = response.clone();
|
|
220668
|
-
ky.#cancelResponseBody(response);
|
|
220669
|
-
return streamResponse(progressResponse, ky.#options.onDownloadProgress);
|
|
220670
|
-
}
|
|
220671
|
-
return response;
|
|
220672
|
-
};
|
|
220673
|
-
const result = ky.#retry(function_).finally(() => {
|
|
220674
|
-
const originalRequest = ky.#originalRequest;
|
|
220675
|
-
ky.#cancelBody(originalRequest?.body ?? undefined);
|
|
220676
|
-
ky.#cancelBody(ky.request.body ?? undefined);
|
|
220677
|
-
});
|
|
220678
|
-
for (const [type, mimeType] of Object.entries(responseTypes)) {
|
|
220679
|
-
if (type === "bytes" && typeof globalThis.Response?.prototype?.bytes !== "function") {
|
|
220680
|
-
continue;
|
|
220681
|
-
}
|
|
220682
|
-
result[type] = async () => {
|
|
220683
|
-
ky.request.headers.set("accept", ky.request.headers.get("accept") || mimeType);
|
|
220684
|
-
const response = await result;
|
|
220685
|
-
if (type === "json") {
|
|
220686
|
-
if (response.status === 204) {
|
|
220687
|
-
return "";
|
|
220688
|
-
}
|
|
220689
|
-
const text = await response.text();
|
|
220690
|
-
if (text === "") {
|
|
220691
|
-
return "";
|
|
220692
|
-
}
|
|
220693
|
-
if (options.parseJson) {
|
|
220694
|
-
return options.parseJson(text);
|
|
220695
|
-
}
|
|
220696
|
-
return JSON.parse(text);
|
|
220697
|
-
}
|
|
220698
|
-
return response[type]();
|
|
220699
|
-
};
|
|
220700
|
-
}
|
|
220701
|
-
return result;
|
|
220702
|
-
}
|
|
220703
|
-
static #normalizeSearchParams(searchParams) {
|
|
220704
|
-
if (searchParams && typeof searchParams === "object" && !Array.isArray(searchParams) && !(searchParams instanceof URLSearchParams)) {
|
|
220705
|
-
return Object.fromEntries(Object.entries(searchParams).filter(([, value]) => value !== undefined));
|
|
220706
|
-
}
|
|
220707
|
-
return searchParams;
|
|
220708
|
-
}
|
|
220709
|
-
request;
|
|
220710
|
-
#abortController;
|
|
220711
|
-
#retryCount = 0;
|
|
220712
|
-
#input;
|
|
220713
|
-
#options;
|
|
220714
|
-
#originalRequest;
|
|
220715
|
-
#userProvidedAbortSignal;
|
|
220716
|
-
#cachedNormalizedOptions;
|
|
220717
|
-
constructor(input, options = {}) {
|
|
220718
|
-
this.#input = input;
|
|
220719
|
-
this.#options = {
|
|
220720
|
-
...options,
|
|
220721
|
-
headers: mergeHeaders(this.#input.headers, options.headers),
|
|
220722
|
-
hooks: mergeHooks({
|
|
220723
|
-
beforeRequest: [],
|
|
220724
|
-
beforeRetry: [],
|
|
220725
|
-
beforeError: [],
|
|
220726
|
-
afterResponse: []
|
|
220727
|
-
}, options.hooks),
|
|
220728
|
-
method: normalizeRequestMethod(options.method ?? this.#input.method ?? "GET"),
|
|
220729
|
-
prefixUrl: String(options.prefixUrl || ""),
|
|
220730
|
-
retry: normalizeRetryOptions(options.retry),
|
|
220731
|
-
throwHttpErrors: options.throwHttpErrors ?? true,
|
|
220732
|
-
timeout: options.timeout ?? 1e4,
|
|
220733
|
-
fetch: options.fetch ?? globalThis.fetch.bind(globalThis),
|
|
220734
|
-
context: options.context ?? {}
|
|
220735
|
-
};
|
|
220736
|
-
if (typeof this.#input !== "string" && !(this.#input instanceof URL || this.#input instanceof globalThis.Request)) {
|
|
220737
|
-
throw new TypeError("`input` must be a string, URL, or Request");
|
|
220738
|
-
}
|
|
220739
|
-
if (this.#options.prefixUrl && typeof this.#input === "string") {
|
|
220740
|
-
if (this.#input.startsWith("/")) {
|
|
220741
|
-
throw new Error("`input` must not begin with a slash when using `prefixUrl`");
|
|
220742
|
-
}
|
|
220743
|
-
if (!this.#options.prefixUrl.endsWith("/")) {
|
|
220744
|
-
this.#options.prefixUrl += "/";
|
|
220745
|
-
}
|
|
220746
|
-
this.#input = this.#options.prefixUrl + this.#input;
|
|
220747
|
-
}
|
|
220748
|
-
if (supportsAbortController && supportsAbortSignal) {
|
|
220749
|
-
this.#userProvidedAbortSignal = this.#options.signal ?? this.#input.signal;
|
|
220750
|
-
this.#abortController = new globalThis.AbortController;
|
|
220751
|
-
this.#options.signal = this.#userProvidedAbortSignal ? AbortSignal.any([this.#userProvidedAbortSignal, this.#abortController.signal]) : this.#abortController.signal;
|
|
220752
|
-
}
|
|
220753
|
-
if (supportsRequestStreams) {
|
|
220754
|
-
this.#options.duplex = "half";
|
|
220755
|
-
}
|
|
220756
|
-
if (this.#options.json !== undefined) {
|
|
220757
|
-
this.#options.body = this.#options.stringifyJson?.(this.#options.json) ?? JSON.stringify(this.#options.json);
|
|
220758
|
-
this.#options.headers.set("content-type", this.#options.headers.get("content-type") ?? "application/json");
|
|
220759
|
-
}
|
|
220760
|
-
const userProvidedContentType = options.headers && new globalThis.Headers(options.headers).has("content-type");
|
|
220761
|
-
if (this.#input instanceof globalThis.Request && (supportsFormData && this.#options.body instanceof globalThis.FormData || this.#options.body instanceof URLSearchParams) && !userProvidedContentType) {
|
|
220762
|
-
this.#options.headers.delete("content-type");
|
|
220763
|
-
}
|
|
220764
|
-
this.request = new globalThis.Request(this.#input, this.#options);
|
|
220765
|
-
if (hasSearchParameters(this.#options.searchParams)) {
|
|
220766
|
-
const textSearchParams = typeof this.#options.searchParams === "string" ? this.#options.searchParams.replace(/^\?/, "") : new URLSearchParams(Ky.#normalizeSearchParams(this.#options.searchParams)).toString();
|
|
220767
|
-
const searchParams = "?" + textSearchParams;
|
|
220768
|
-
const url = this.request.url.replace(/(?:\?.*?)?(?=#|$)/, searchParams);
|
|
220769
|
-
this.request = new globalThis.Request(url, this.#options);
|
|
220770
|
-
}
|
|
220771
|
-
if (this.#options.onUploadProgress) {
|
|
220772
|
-
if (typeof this.#options.onUploadProgress !== "function") {
|
|
220773
|
-
throw new TypeError("The `onUploadProgress` option must be a function");
|
|
220774
|
-
}
|
|
220775
|
-
if (!supportsRequestStreams) {
|
|
220776
|
-
throw new Error("Request streams are not supported in your environment. The `duplex` option for `Request` is not available.");
|
|
220777
|
-
}
|
|
220778
|
-
this.request = this.#wrapRequestWithUploadProgress(this.request, this.#options.body ?? undefined);
|
|
220779
|
-
}
|
|
220780
|
-
}
|
|
220781
|
-
#calculateDelay() {
|
|
220782
|
-
const retryDelay = this.#options.retry.delay(this.#retryCount);
|
|
220783
|
-
let jitteredDelay = retryDelay;
|
|
220784
|
-
if (this.#options.retry.jitter === true) {
|
|
220785
|
-
jitteredDelay = Math.random() * retryDelay;
|
|
220786
|
-
} else if (typeof this.#options.retry.jitter === "function") {
|
|
220787
|
-
jitteredDelay = this.#options.retry.jitter(retryDelay);
|
|
220788
|
-
if (!Number.isFinite(jitteredDelay) || jitteredDelay < 0) {
|
|
220789
|
-
jitteredDelay = retryDelay;
|
|
220790
|
-
}
|
|
220791
|
-
}
|
|
220792
|
-
const backoffLimit = this.#options.retry.backoffLimit ?? Number.POSITIVE_INFINITY;
|
|
220793
|
-
return Math.min(backoffLimit, jitteredDelay);
|
|
220794
|
-
}
|
|
220795
|
-
async#calculateRetryDelay(error) {
|
|
220796
|
-
this.#retryCount++;
|
|
220797
|
-
if (this.#retryCount > this.#options.retry.limit) {
|
|
220798
|
-
throw error;
|
|
220799
|
-
}
|
|
220800
|
-
const errorObject = error instanceof Error ? error : new NonError(error);
|
|
220801
|
-
if (errorObject instanceof ForceRetryError) {
|
|
220802
|
-
return errorObject.customDelay ?? this.#calculateDelay();
|
|
220803
|
-
}
|
|
220804
|
-
if (!this.#options.retry.methods.includes(this.request.method.toLowerCase())) {
|
|
220805
|
-
throw error;
|
|
220806
|
-
}
|
|
220807
|
-
if (this.#options.retry.shouldRetry !== undefined) {
|
|
220808
|
-
const result = await this.#options.retry.shouldRetry({ error: errorObject, retryCount: this.#retryCount });
|
|
220809
|
-
if (result === false) {
|
|
220810
|
-
throw error;
|
|
220811
|
-
}
|
|
220812
|
-
if (result === true) {
|
|
220813
|
-
return this.#calculateDelay();
|
|
220814
|
-
}
|
|
220815
|
-
}
|
|
220816
|
-
if (isTimeoutError(error) && !this.#options.retry.retryOnTimeout) {
|
|
220817
|
-
throw error;
|
|
220818
|
-
}
|
|
220819
|
-
if (isHTTPError(error)) {
|
|
220820
|
-
if (!this.#options.retry.statusCodes.includes(error.response.status)) {
|
|
220821
|
-
throw error;
|
|
220822
|
-
}
|
|
220823
|
-
const retryAfter = error.response.headers.get("Retry-After") ?? error.response.headers.get("RateLimit-Reset") ?? error.response.headers.get("X-RateLimit-Retry-After") ?? error.response.headers.get("X-RateLimit-Reset") ?? error.response.headers.get("X-Rate-Limit-Reset");
|
|
220824
|
-
if (retryAfter && this.#options.retry.afterStatusCodes.includes(error.response.status)) {
|
|
220825
|
-
let after = Number(retryAfter) * 1000;
|
|
220826
|
-
if (Number.isNaN(after)) {
|
|
220827
|
-
after = Date.parse(retryAfter) - Date.now();
|
|
220828
|
-
} else if (after >= Date.parse("2024-01-01")) {
|
|
220829
|
-
after -= Date.now();
|
|
220830
|
-
}
|
|
220831
|
-
const max = this.#options.retry.maxRetryAfter ?? after;
|
|
220832
|
-
return after < max ? after : max;
|
|
220833
|
-
}
|
|
220834
|
-
if (error.response.status === 413) {
|
|
220835
|
-
throw error;
|
|
220836
|
-
}
|
|
220837
|
-
}
|
|
220838
|
-
return this.#calculateDelay();
|
|
220839
|
-
}
|
|
220840
|
-
#decorateResponse(response) {
|
|
220841
|
-
if (this.#options.parseJson) {
|
|
220842
|
-
response.json = async () => this.#options.parseJson(await response.text());
|
|
220843
|
-
}
|
|
220844
|
-
return response;
|
|
220845
|
-
}
|
|
220846
|
-
#cancelBody(body) {
|
|
220847
|
-
if (!body) {
|
|
220848
|
-
return;
|
|
220849
|
-
}
|
|
220850
|
-
body.cancel().catch(() => {
|
|
220851
|
-
return;
|
|
220852
|
-
});
|
|
220853
|
-
}
|
|
220854
|
-
#cancelResponseBody(response) {
|
|
220855
|
-
this.#cancelBody(response.body ?? undefined);
|
|
220856
|
-
}
|
|
220857
|
-
async#retry(function_) {
|
|
220858
|
-
try {
|
|
220859
|
-
return await function_();
|
|
220860
|
-
} catch (error) {
|
|
220861
|
-
const ms = Math.min(await this.#calculateRetryDelay(error), maxSafeTimeout);
|
|
220862
|
-
if (this.#retryCount < 1) {
|
|
220863
|
-
throw error;
|
|
220864
|
-
}
|
|
220865
|
-
await delay(ms, this.#userProvidedAbortSignal ? { signal: this.#userProvidedAbortSignal } : {});
|
|
220866
|
-
if (error instanceof ForceRetryError && error.customRequest) {
|
|
220867
|
-
const managedRequest = this.#options.signal ? new globalThis.Request(error.customRequest, { signal: this.#options.signal }) : new globalThis.Request(error.customRequest);
|
|
220868
|
-
this.#assignRequest(managedRequest);
|
|
220869
|
-
}
|
|
220870
|
-
for (const hook of this.#options.hooks.beforeRetry) {
|
|
220871
|
-
const hookResult = await hook({
|
|
220872
|
-
request: this.request,
|
|
220873
|
-
options: this.#getNormalizedOptions(),
|
|
220874
|
-
error,
|
|
220875
|
-
retryCount: this.#retryCount
|
|
220876
|
-
});
|
|
220877
|
-
if (hookResult instanceof globalThis.Request) {
|
|
220878
|
-
this.#assignRequest(hookResult);
|
|
220879
|
-
break;
|
|
220880
|
-
}
|
|
220881
|
-
if (hookResult instanceof globalThis.Response) {
|
|
220882
|
-
return hookResult;
|
|
220883
|
-
}
|
|
220884
|
-
if (hookResult === stop) {
|
|
220885
|
-
return;
|
|
220886
|
-
}
|
|
220887
|
-
}
|
|
220888
|
-
return this.#retry(function_);
|
|
220889
|
-
}
|
|
220890
|
-
}
|
|
220891
|
-
async#fetch() {
|
|
220892
|
-
if (this.#abortController?.signal.aborted) {
|
|
220893
|
-
this.#abortController = new globalThis.AbortController;
|
|
220894
|
-
this.#options.signal = this.#userProvidedAbortSignal ? AbortSignal.any([this.#userProvidedAbortSignal, this.#abortController.signal]) : this.#abortController.signal;
|
|
220895
|
-
this.request = new globalThis.Request(this.request, { signal: this.#options.signal });
|
|
220896
|
-
}
|
|
220897
|
-
for (const hook of this.#options.hooks.beforeRequest) {
|
|
220898
|
-
const result = await hook(this.request, this.#getNormalizedOptions(), { retryCount: this.#retryCount });
|
|
220899
|
-
if (result instanceof Response) {
|
|
220900
|
-
return result;
|
|
220901
|
-
}
|
|
220902
|
-
if (result instanceof globalThis.Request) {
|
|
220903
|
-
this.#assignRequest(result);
|
|
220904
|
-
break;
|
|
220905
|
-
}
|
|
220906
|
-
}
|
|
220907
|
-
const nonRequestOptions = findUnknownOptions(this.request, this.#options);
|
|
220908
|
-
this.#originalRequest = this.request;
|
|
220909
|
-
this.request = this.#originalRequest.clone();
|
|
220910
|
-
if (this.#options.timeout === false) {
|
|
220911
|
-
return this.#options.fetch(this.#originalRequest, nonRequestOptions);
|
|
220912
|
-
}
|
|
220913
|
-
return timeout(this.#originalRequest, nonRequestOptions, this.#abortController, this.#options);
|
|
220914
|
-
}
|
|
220915
|
-
#getNormalizedOptions() {
|
|
220916
|
-
if (!this.#cachedNormalizedOptions) {
|
|
220917
|
-
const { hooks, ...normalizedOptions } = this.#options;
|
|
220918
|
-
this.#cachedNormalizedOptions = Object.freeze(normalizedOptions);
|
|
220919
|
-
}
|
|
220920
|
-
return this.#cachedNormalizedOptions;
|
|
220921
|
-
}
|
|
220922
|
-
#assignRequest(request) {
|
|
220923
|
-
this.#cachedNormalizedOptions = undefined;
|
|
220924
|
-
this.request = this.#wrapRequestWithUploadProgress(request);
|
|
220925
|
-
}
|
|
220926
|
-
#wrapRequestWithUploadProgress(request, originalBody) {
|
|
220927
|
-
if (!this.#options.onUploadProgress || !request.body) {
|
|
220928
|
-
return request;
|
|
220929
|
-
}
|
|
220930
|
-
return streamRequest(request, this.#options.onUploadProgress, originalBody ?? this.#options.body ?? undefined);
|
|
220931
|
-
}
|
|
220932
|
-
}
|
|
220933
|
-
// ../../node_modules/ky/distribution/index.js
|
|
220934
|
-
/*! MIT License © Sindre Sorhus */
|
|
220935
|
-
var createInstance = (defaults) => {
|
|
220936
|
-
const ky = (input, options) => Ky.create(input, validateAndMerge(defaults, options));
|
|
220937
|
-
for (const method of requestMethods) {
|
|
220938
|
-
ky[method] = (input, options) => Ky.create(input, validateAndMerge(defaults, options, { method }));
|
|
220939
|
-
}
|
|
220940
|
-
ky.create = (newDefaults) => createInstance(validateAndMerge(newDefaults));
|
|
220941
|
-
ky.extend = (newDefaults) => {
|
|
220942
|
-
if (typeof newDefaults === "function") {
|
|
220943
|
-
newDefaults = newDefaults(defaults ?? {});
|
|
220944
|
-
}
|
|
220945
|
-
return createInstance(validateAndMerge(defaults, newDefaults));
|
|
220946
|
-
};
|
|
220947
|
-
ky.stop = stop;
|
|
220948
|
-
ky.retry = retry;
|
|
220949
|
-
return ky;
|
|
220950
|
-
};
|
|
220951
|
-
var ky = createInstance();
|
|
220952
|
-
var distribution_default = ky;
|
|
220953
|
-
|
|
220954
220135
|
// ../../node_modules/zod/v4/classic/external.js
|
|
220955
220136
|
var exports_external = {};
|
|
220956
220137
|
__export(exports_external, {
|
|
@@ -221578,7 +220759,7 @@ __export(exports_util, {
|
|
|
221578
220759
|
joinValues: () => joinValues,
|
|
221579
220760
|
issue: () => issue,
|
|
221580
220761
|
isPlainObject: () => isPlainObject,
|
|
221581
|
-
isObject: () =>
|
|
220762
|
+
isObject: () => isObject,
|
|
221582
220763
|
hexToUint8Array: () => hexToUint8Array,
|
|
221583
220764
|
getSizableOrigin: () => getSizableOrigin,
|
|
221584
220765
|
getParsedType: () => getParsedType,
|
|
@@ -221747,7 +220928,7 @@ function slugify(input) {
|
|
|
221747
220928
|
return input.toLowerCase().trim().replace(/[^\w\s-]/g, "").replace(/[\s_-]+/g, "-").replace(/^-+|-+$/g, "");
|
|
221748
220929
|
}
|
|
221749
220930
|
var captureStackTrace = "captureStackTrace" in Error ? Error.captureStackTrace : (..._args) => {};
|
|
221750
|
-
function
|
|
220931
|
+
function isObject(data) {
|
|
221751
220932
|
return typeof data === "object" && data !== null && !Array.isArray(data);
|
|
221752
220933
|
}
|
|
221753
220934
|
var allowsEval = cached(() => {
|
|
@@ -221763,7 +220944,7 @@ var allowsEval = cached(() => {
|
|
|
221763
220944
|
}
|
|
221764
220945
|
});
|
|
221765
220946
|
function isPlainObject(o) {
|
|
221766
|
-
if (
|
|
220947
|
+
if (isObject(o) === false)
|
|
221767
220948
|
return false;
|
|
221768
220949
|
const ctor = o.constructor;
|
|
221769
220950
|
if (ctor === undefined)
|
|
@@ -221771,7 +220952,7 @@ function isPlainObject(o) {
|
|
|
221771
220952
|
if (typeof ctor !== "function")
|
|
221772
220953
|
return true;
|
|
221773
220954
|
const prot = ctor.prototype;
|
|
221774
|
-
if (
|
|
220955
|
+
if (isObject(prot) === false)
|
|
221775
220956
|
return false;
|
|
221776
220957
|
if (Object.prototype.hasOwnProperty.call(prot, "isPrototypeOf") === false) {
|
|
221777
220958
|
return false;
|
|
@@ -223924,13 +223105,13 @@ var $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
|
|
|
223924
223105
|
}
|
|
223925
223106
|
return propValues;
|
|
223926
223107
|
});
|
|
223927
|
-
const
|
|
223108
|
+
const isObject2 = isObject;
|
|
223928
223109
|
const catchall = def.catchall;
|
|
223929
223110
|
let value;
|
|
223930
223111
|
inst._zod.parse = (payload, ctx) => {
|
|
223931
223112
|
value ?? (value = _normalized.value);
|
|
223932
223113
|
const input = payload.value;
|
|
223933
|
-
if (!
|
|
223114
|
+
if (!isObject2(input)) {
|
|
223934
223115
|
payload.issues.push({
|
|
223935
223116
|
expected: "object",
|
|
223936
223117
|
code: "invalid_type",
|
|
@@ -224028,7 +223209,7 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
|
|
|
224028
223209
|
return (payload, ctx) => fn(shape, payload, ctx);
|
|
224029
223210
|
};
|
|
224030
223211
|
let fastpass;
|
|
224031
|
-
const
|
|
223212
|
+
const isObject2 = isObject;
|
|
224032
223213
|
const jit = !globalConfig.jitless;
|
|
224033
223214
|
const allowsEval2 = allowsEval;
|
|
224034
223215
|
const fastEnabled = jit && allowsEval2.value;
|
|
@@ -224037,7 +223218,7 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
|
|
|
224037
223218
|
inst._zod.parse = (payload, ctx) => {
|
|
224038
223219
|
value ?? (value = _normalized.value);
|
|
224039
223220
|
const input = payload.value;
|
|
224040
|
-
if (!
|
|
223221
|
+
if (!isObject2(input)) {
|
|
224041
223222
|
payload.issues.push({
|
|
224042
223223
|
expected: "object",
|
|
224043
223224
|
code: "invalid_type",
|
|
@@ -224215,7 +223396,7 @@ var $ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("$ZodDiscriminatedUnio
|
|
|
224215
223396
|
});
|
|
224216
223397
|
inst._zod.parse = (payload, ctx) => {
|
|
224217
223398
|
const input = payload.value;
|
|
224218
|
-
if (!
|
|
223399
|
+
if (!isObject(input)) {
|
|
224219
223400
|
payload.issues.push({
|
|
224220
223401
|
code: "invalid_type",
|
|
224221
223402
|
expected: "object",
|
|
@@ -233429,1060 +232610,2029 @@ function object(shape, params) {
|
|
|
233429
232610
|
};
|
|
233430
232611
|
return new ZodObject(def);
|
|
233431
232612
|
}
|
|
233432
|
-
function strictObject(shape, params) {
|
|
233433
|
-
return new ZodObject({
|
|
233434
|
-
type: "object",
|
|
233435
|
-
shape,
|
|
233436
|
-
catchall: never(),
|
|
233437
|
-
...exports_util.normalizeParams(params)
|
|
232613
|
+
function strictObject(shape, params) {
|
|
232614
|
+
return new ZodObject({
|
|
232615
|
+
type: "object",
|
|
232616
|
+
shape,
|
|
232617
|
+
catchall: never(),
|
|
232618
|
+
...exports_util.normalizeParams(params)
|
|
232619
|
+
});
|
|
232620
|
+
}
|
|
232621
|
+
function looseObject(shape, params) {
|
|
232622
|
+
return new ZodObject({
|
|
232623
|
+
type: "object",
|
|
232624
|
+
shape,
|
|
232625
|
+
catchall: unknown(),
|
|
232626
|
+
...exports_util.normalizeParams(params)
|
|
232627
|
+
});
|
|
232628
|
+
}
|
|
232629
|
+
var ZodUnion = /* @__PURE__ */ $constructor("ZodUnion", (inst, def) => {
|
|
232630
|
+
$ZodUnion.init(inst, def);
|
|
232631
|
+
ZodType.init(inst, def);
|
|
232632
|
+
inst._zod.processJSONSchema = (ctx, json, params) => unionProcessor(inst, ctx, json, params);
|
|
232633
|
+
inst.options = def.options;
|
|
232634
|
+
});
|
|
232635
|
+
function union(options, params) {
|
|
232636
|
+
return new ZodUnion({
|
|
232637
|
+
type: "union",
|
|
232638
|
+
options,
|
|
232639
|
+
...exports_util.normalizeParams(params)
|
|
232640
|
+
});
|
|
232641
|
+
}
|
|
232642
|
+
var ZodXor = /* @__PURE__ */ $constructor("ZodXor", (inst, def) => {
|
|
232643
|
+
ZodUnion.init(inst, def);
|
|
232644
|
+
$ZodXor.init(inst, def);
|
|
232645
|
+
inst._zod.processJSONSchema = (ctx, json, params) => unionProcessor(inst, ctx, json, params);
|
|
232646
|
+
inst.options = def.options;
|
|
232647
|
+
});
|
|
232648
|
+
function xor(options, params) {
|
|
232649
|
+
return new ZodXor({
|
|
232650
|
+
type: "union",
|
|
232651
|
+
options,
|
|
232652
|
+
inclusive: false,
|
|
232653
|
+
...exports_util.normalizeParams(params)
|
|
232654
|
+
});
|
|
232655
|
+
}
|
|
232656
|
+
var ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("ZodDiscriminatedUnion", (inst, def) => {
|
|
232657
|
+
ZodUnion.init(inst, def);
|
|
232658
|
+
$ZodDiscriminatedUnion.init(inst, def);
|
|
232659
|
+
});
|
|
232660
|
+
function discriminatedUnion(discriminator, options, params) {
|
|
232661
|
+
return new ZodDiscriminatedUnion({
|
|
232662
|
+
type: "union",
|
|
232663
|
+
options,
|
|
232664
|
+
discriminator,
|
|
232665
|
+
...exports_util.normalizeParams(params)
|
|
232666
|
+
});
|
|
232667
|
+
}
|
|
232668
|
+
var ZodIntersection = /* @__PURE__ */ $constructor("ZodIntersection", (inst, def) => {
|
|
232669
|
+
$ZodIntersection.init(inst, def);
|
|
232670
|
+
ZodType.init(inst, def);
|
|
232671
|
+
inst._zod.processJSONSchema = (ctx, json, params) => intersectionProcessor(inst, ctx, json, params);
|
|
232672
|
+
});
|
|
232673
|
+
function intersection(left, right) {
|
|
232674
|
+
return new ZodIntersection({
|
|
232675
|
+
type: "intersection",
|
|
232676
|
+
left,
|
|
232677
|
+
right
|
|
232678
|
+
});
|
|
232679
|
+
}
|
|
232680
|
+
var ZodTuple = /* @__PURE__ */ $constructor("ZodTuple", (inst, def) => {
|
|
232681
|
+
$ZodTuple.init(inst, def);
|
|
232682
|
+
ZodType.init(inst, def);
|
|
232683
|
+
inst._zod.processJSONSchema = (ctx, json, params) => tupleProcessor(inst, ctx, json, params);
|
|
232684
|
+
inst.rest = (rest) => inst.clone({
|
|
232685
|
+
...inst._zod.def,
|
|
232686
|
+
rest
|
|
232687
|
+
});
|
|
232688
|
+
});
|
|
232689
|
+
function tuple(items, _paramsOrRest, _params) {
|
|
232690
|
+
const hasRest = _paramsOrRest instanceof $ZodType;
|
|
232691
|
+
const params = hasRest ? _params : _paramsOrRest;
|
|
232692
|
+
const rest = hasRest ? _paramsOrRest : null;
|
|
232693
|
+
return new ZodTuple({
|
|
232694
|
+
type: "tuple",
|
|
232695
|
+
items,
|
|
232696
|
+
rest,
|
|
232697
|
+
...exports_util.normalizeParams(params)
|
|
232698
|
+
});
|
|
232699
|
+
}
|
|
232700
|
+
var ZodRecord = /* @__PURE__ */ $constructor("ZodRecord", (inst, def) => {
|
|
232701
|
+
$ZodRecord.init(inst, def);
|
|
232702
|
+
ZodType.init(inst, def);
|
|
232703
|
+
inst._zod.processJSONSchema = (ctx, json, params) => recordProcessor(inst, ctx, json, params);
|
|
232704
|
+
inst.keyType = def.keyType;
|
|
232705
|
+
inst.valueType = def.valueType;
|
|
232706
|
+
});
|
|
232707
|
+
function record(keyType, valueType, params) {
|
|
232708
|
+
return new ZodRecord({
|
|
232709
|
+
type: "record",
|
|
232710
|
+
keyType,
|
|
232711
|
+
valueType,
|
|
232712
|
+
...exports_util.normalizeParams(params)
|
|
232713
|
+
});
|
|
232714
|
+
}
|
|
232715
|
+
function partialRecord(keyType, valueType, params) {
|
|
232716
|
+
const k2 = clone(keyType);
|
|
232717
|
+
k2._zod.values = undefined;
|
|
232718
|
+
return new ZodRecord({
|
|
232719
|
+
type: "record",
|
|
232720
|
+
keyType: k2,
|
|
232721
|
+
valueType,
|
|
232722
|
+
...exports_util.normalizeParams(params)
|
|
232723
|
+
});
|
|
232724
|
+
}
|
|
232725
|
+
function looseRecord(keyType, valueType, params) {
|
|
232726
|
+
return new ZodRecord({
|
|
232727
|
+
type: "record",
|
|
232728
|
+
keyType,
|
|
232729
|
+
valueType,
|
|
232730
|
+
mode: "loose",
|
|
232731
|
+
...exports_util.normalizeParams(params)
|
|
232732
|
+
});
|
|
232733
|
+
}
|
|
232734
|
+
var ZodMap = /* @__PURE__ */ $constructor("ZodMap", (inst, def) => {
|
|
232735
|
+
$ZodMap.init(inst, def);
|
|
232736
|
+
ZodType.init(inst, def);
|
|
232737
|
+
inst._zod.processJSONSchema = (ctx, json, params) => mapProcessor(inst, ctx, json, params);
|
|
232738
|
+
inst.keyType = def.keyType;
|
|
232739
|
+
inst.valueType = def.valueType;
|
|
232740
|
+
inst.min = (...args) => inst.check(_minSize(...args));
|
|
232741
|
+
inst.nonempty = (params) => inst.check(_minSize(1, params));
|
|
232742
|
+
inst.max = (...args) => inst.check(_maxSize(...args));
|
|
232743
|
+
inst.size = (...args) => inst.check(_size(...args));
|
|
232744
|
+
});
|
|
232745
|
+
function map(keyType, valueType, params) {
|
|
232746
|
+
return new ZodMap({
|
|
232747
|
+
type: "map",
|
|
232748
|
+
keyType,
|
|
232749
|
+
valueType,
|
|
232750
|
+
...exports_util.normalizeParams(params)
|
|
232751
|
+
});
|
|
232752
|
+
}
|
|
232753
|
+
var ZodSet = /* @__PURE__ */ $constructor("ZodSet", (inst, def) => {
|
|
232754
|
+
$ZodSet.init(inst, def);
|
|
232755
|
+
ZodType.init(inst, def);
|
|
232756
|
+
inst._zod.processJSONSchema = (ctx, json, params) => setProcessor(inst, ctx, json, params);
|
|
232757
|
+
inst.min = (...args) => inst.check(_minSize(...args));
|
|
232758
|
+
inst.nonempty = (params) => inst.check(_minSize(1, params));
|
|
232759
|
+
inst.max = (...args) => inst.check(_maxSize(...args));
|
|
232760
|
+
inst.size = (...args) => inst.check(_size(...args));
|
|
232761
|
+
});
|
|
232762
|
+
function set(valueType, params) {
|
|
232763
|
+
return new ZodSet({
|
|
232764
|
+
type: "set",
|
|
232765
|
+
valueType,
|
|
232766
|
+
...exports_util.normalizeParams(params)
|
|
232767
|
+
});
|
|
232768
|
+
}
|
|
232769
|
+
var ZodEnum = /* @__PURE__ */ $constructor("ZodEnum", (inst, def) => {
|
|
232770
|
+
$ZodEnum.init(inst, def);
|
|
232771
|
+
ZodType.init(inst, def);
|
|
232772
|
+
inst._zod.processJSONSchema = (ctx, json, params) => enumProcessor(inst, ctx, json, params);
|
|
232773
|
+
inst.enum = def.entries;
|
|
232774
|
+
inst.options = Object.values(def.entries);
|
|
232775
|
+
const keys = new Set(Object.keys(def.entries));
|
|
232776
|
+
inst.extract = (values, params) => {
|
|
232777
|
+
const newEntries = {};
|
|
232778
|
+
for (const value of values) {
|
|
232779
|
+
if (keys.has(value)) {
|
|
232780
|
+
newEntries[value] = def.entries[value];
|
|
232781
|
+
} else
|
|
232782
|
+
throw new Error(`Key ${value} not found in enum`);
|
|
232783
|
+
}
|
|
232784
|
+
return new ZodEnum({
|
|
232785
|
+
...def,
|
|
232786
|
+
checks: [],
|
|
232787
|
+
...exports_util.normalizeParams(params),
|
|
232788
|
+
entries: newEntries
|
|
232789
|
+
});
|
|
232790
|
+
};
|
|
232791
|
+
inst.exclude = (values, params) => {
|
|
232792
|
+
const newEntries = { ...def.entries };
|
|
232793
|
+
for (const value of values) {
|
|
232794
|
+
if (keys.has(value)) {
|
|
232795
|
+
delete newEntries[value];
|
|
232796
|
+
} else
|
|
232797
|
+
throw new Error(`Key ${value} not found in enum`);
|
|
232798
|
+
}
|
|
232799
|
+
return new ZodEnum({
|
|
232800
|
+
...def,
|
|
232801
|
+
checks: [],
|
|
232802
|
+
...exports_util.normalizeParams(params),
|
|
232803
|
+
entries: newEntries
|
|
232804
|
+
});
|
|
232805
|
+
};
|
|
232806
|
+
});
|
|
232807
|
+
function _enum2(values, params) {
|
|
232808
|
+
const entries = Array.isArray(values) ? Object.fromEntries(values.map((v) => [v, v])) : values;
|
|
232809
|
+
return new ZodEnum({
|
|
232810
|
+
type: "enum",
|
|
232811
|
+
entries,
|
|
232812
|
+
...exports_util.normalizeParams(params)
|
|
232813
|
+
});
|
|
232814
|
+
}
|
|
232815
|
+
function nativeEnum(entries, params) {
|
|
232816
|
+
return new ZodEnum({
|
|
232817
|
+
type: "enum",
|
|
232818
|
+
entries,
|
|
232819
|
+
...exports_util.normalizeParams(params)
|
|
232820
|
+
});
|
|
232821
|
+
}
|
|
232822
|
+
var ZodLiteral = /* @__PURE__ */ $constructor("ZodLiteral", (inst, def) => {
|
|
232823
|
+
$ZodLiteral.init(inst, def);
|
|
232824
|
+
ZodType.init(inst, def);
|
|
232825
|
+
inst._zod.processJSONSchema = (ctx, json, params) => literalProcessor(inst, ctx, json, params);
|
|
232826
|
+
inst.values = new Set(def.values);
|
|
232827
|
+
Object.defineProperty(inst, "value", {
|
|
232828
|
+
get() {
|
|
232829
|
+
if (def.values.length > 1) {
|
|
232830
|
+
throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");
|
|
232831
|
+
}
|
|
232832
|
+
return def.values[0];
|
|
232833
|
+
}
|
|
232834
|
+
});
|
|
232835
|
+
});
|
|
232836
|
+
function literal(value, params) {
|
|
232837
|
+
return new ZodLiteral({
|
|
232838
|
+
type: "literal",
|
|
232839
|
+
values: Array.isArray(value) ? value : [value],
|
|
232840
|
+
...exports_util.normalizeParams(params)
|
|
232841
|
+
});
|
|
232842
|
+
}
|
|
232843
|
+
var ZodFile = /* @__PURE__ */ $constructor("ZodFile", (inst, def) => {
|
|
232844
|
+
$ZodFile.init(inst, def);
|
|
232845
|
+
ZodType.init(inst, def);
|
|
232846
|
+
inst._zod.processJSONSchema = (ctx, json, params) => fileProcessor(inst, ctx, json, params);
|
|
232847
|
+
inst.min = (size, params) => inst.check(_minSize(size, params));
|
|
232848
|
+
inst.max = (size, params) => inst.check(_maxSize(size, params));
|
|
232849
|
+
inst.mime = (types, params) => inst.check(_mime(Array.isArray(types) ? types : [types], params));
|
|
232850
|
+
});
|
|
232851
|
+
function file(params) {
|
|
232852
|
+
return _file(ZodFile, params);
|
|
232853
|
+
}
|
|
232854
|
+
var ZodTransform = /* @__PURE__ */ $constructor("ZodTransform", (inst, def) => {
|
|
232855
|
+
$ZodTransform.init(inst, def);
|
|
232856
|
+
ZodType.init(inst, def);
|
|
232857
|
+
inst._zod.processJSONSchema = (ctx, json, params) => transformProcessor(inst, ctx, json, params);
|
|
232858
|
+
inst._zod.parse = (payload, _ctx) => {
|
|
232859
|
+
if (_ctx.direction === "backward") {
|
|
232860
|
+
throw new $ZodEncodeError(inst.constructor.name);
|
|
232861
|
+
}
|
|
232862
|
+
payload.addIssue = (issue2) => {
|
|
232863
|
+
if (typeof issue2 === "string") {
|
|
232864
|
+
payload.issues.push(exports_util.issue(issue2, payload.value, def));
|
|
232865
|
+
} else {
|
|
232866
|
+
const _issue = issue2;
|
|
232867
|
+
if (_issue.fatal)
|
|
232868
|
+
_issue.continue = false;
|
|
232869
|
+
_issue.code ?? (_issue.code = "custom");
|
|
232870
|
+
_issue.input ?? (_issue.input = payload.value);
|
|
232871
|
+
_issue.inst ?? (_issue.inst = inst);
|
|
232872
|
+
payload.issues.push(exports_util.issue(_issue));
|
|
232873
|
+
}
|
|
232874
|
+
};
|
|
232875
|
+
const output = def.transform(payload.value, payload);
|
|
232876
|
+
if (output instanceof Promise) {
|
|
232877
|
+
return output.then((output2) => {
|
|
232878
|
+
payload.value = output2;
|
|
232879
|
+
return payload;
|
|
232880
|
+
});
|
|
232881
|
+
}
|
|
232882
|
+
payload.value = output;
|
|
232883
|
+
return payload;
|
|
232884
|
+
};
|
|
232885
|
+
});
|
|
232886
|
+
function transform(fn) {
|
|
232887
|
+
return new ZodTransform({
|
|
232888
|
+
type: "transform",
|
|
232889
|
+
transform: fn
|
|
232890
|
+
});
|
|
232891
|
+
}
|
|
232892
|
+
var ZodOptional = /* @__PURE__ */ $constructor("ZodOptional", (inst, def) => {
|
|
232893
|
+
$ZodOptional.init(inst, def);
|
|
232894
|
+
ZodType.init(inst, def);
|
|
232895
|
+
inst._zod.processJSONSchema = (ctx, json, params) => optionalProcessor(inst, ctx, json, params);
|
|
232896
|
+
inst.unwrap = () => inst._zod.def.innerType;
|
|
232897
|
+
});
|
|
232898
|
+
function optional(innerType) {
|
|
232899
|
+
return new ZodOptional({
|
|
232900
|
+
type: "optional",
|
|
232901
|
+
innerType
|
|
232902
|
+
});
|
|
232903
|
+
}
|
|
232904
|
+
var ZodExactOptional = /* @__PURE__ */ $constructor("ZodExactOptional", (inst, def) => {
|
|
232905
|
+
$ZodExactOptional.init(inst, def);
|
|
232906
|
+
ZodType.init(inst, def);
|
|
232907
|
+
inst._zod.processJSONSchema = (ctx, json, params) => optionalProcessor(inst, ctx, json, params);
|
|
232908
|
+
inst.unwrap = () => inst._zod.def.innerType;
|
|
232909
|
+
});
|
|
232910
|
+
function exactOptional(innerType) {
|
|
232911
|
+
return new ZodExactOptional({
|
|
232912
|
+
type: "optional",
|
|
232913
|
+
innerType
|
|
232914
|
+
});
|
|
232915
|
+
}
|
|
232916
|
+
var ZodNullable = /* @__PURE__ */ $constructor("ZodNullable", (inst, def) => {
|
|
232917
|
+
$ZodNullable.init(inst, def);
|
|
232918
|
+
ZodType.init(inst, def);
|
|
232919
|
+
inst._zod.processJSONSchema = (ctx, json, params) => nullableProcessor(inst, ctx, json, params);
|
|
232920
|
+
inst.unwrap = () => inst._zod.def.innerType;
|
|
232921
|
+
});
|
|
232922
|
+
function nullable(innerType) {
|
|
232923
|
+
return new ZodNullable({
|
|
232924
|
+
type: "nullable",
|
|
232925
|
+
innerType
|
|
232926
|
+
});
|
|
232927
|
+
}
|
|
232928
|
+
function nullish2(innerType) {
|
|
232929
|
+
return optional(nullable(innerType));
|
|
232930
|
+
}
|
|
232931
|
+
var ZodDefault = /* @__PURE__ */ $constructor("ZodDefault", (inst, def) => {
|
|
232932
|
+
$ZodDefault.init(inst, def);
|
|
232933
|
+
ZodType.init(inst, def);
|
|
232934
|
+
inst._zod.processJSONSchema = (ctx, json, params) => defaultProcessor(inst, ctx, json, params);
|
|
232935
|
+
inst.unwrap = () => inst._zod.def.innerType;
|
|
232936
|
+
inst.removeDefault = inst.unwrap;
|
|
232937
|
+
});
|
|
232938
|
+
function _default2(innerType, defaultValue) {
|
|
232939
|
+
return new ZodDefault({
|
|
232940
|
+
type: "default",
|
|
232941
|
+
innerType,
|
|
232942
|
+
get defaultValue() {
|
|
232943
|
+
return typeof defaultValue === "function" ? defaultValue() : exports_util.shallowClone(defaultValue);
|
|
232944
|
+
}
|
|
232945
|
+
});
|
|
232946
|
+
}
|
|
232947
|
+
var ZodPrefault = /* @__PURE__ */ $constructor("ZodPrefault", (inst, def) => {
|
|
232948
|
+
$ZodPrefault.init(inst, def);
|
|
232949
|
+
ZodType.init(inst, def);
|
|
232950
|
+
inst._zod.processJSONSchema = (ctx, json, params) => prefaultProcessor(inst, ctx, json, params);
|
|
232951
|
+
inst.unwrap = () => inst._zod.def.innerType;
|
|
232952
|
+
});
|
|
232953
|
+
function prefault(innerType, defaultValue) {
|
|
232954
|
+
return new ZodPrefault({
|
|
232955
|
+
type: "prefault",
|
|
232956
|
+
innerType,
|
|
232957
|
+
get defaultValue() {
|
|
232958
|
+
return typeof defaultValue === "function" ? defaultValue() : exports_util.shallowClone(defaultValue);
|
|
232959
|
+
}
|
|
232960
|
+
});
|
|
232961
|
+
}
|
|
232962
|
+
var ZodNonOptional = /* @__PURE__ */ $constructor("ZodNonOptional", (inst, def) => {
|
|
232963
|
+
$ZodNonOptional.init(inst, def);
|
|
232964
|
+
ZodType.init(inst, def);
|
|
232965
|
+
inst._zod.processJSONSchema = (ctx, json, params) => nonoptionalProcessor(inst, ctx, json, params);
|
|
232966
|
+
inst.unwrap = () => inst._zod.def.innerType;
|
|
232967
|
+
});
|
|
232968
|
+
function nonoptional(innerType, params) {
|
|
232969
|
+
return new ZodNonOptional({
|
|
232970
|
+
type: "nonoptional",
|
|
232971
|
+
innerType,
|
|
232972
|
+
...exports_util.normalizeParams(params)
|
|
232973
|
+
});
|
|
232974
|
+
}
|
|
232975
|
+
var ZodSuccess = /* @__PURE__ */ $constructor("ZodSuccess", (inst, def) => {
|
|
232976
|
+
$ZodSuccess.init(inst, def);
|
|
232977
|
+
ZodType.init(inst, def);
|
|
232978
|
+
inst._zod.processJSONSchema = (ctx, json, params) => successProcessor(inst, ctx, json, params);
|
|
232979
|
+
inst.unwrap = () => inst._zod.def.innerType;
|
|
232980
|
+
});
|
|
232981
|
+
function success(innerType) {
|
|
232982
|
+
return new ZodSuccess({
|
|
232983
|
+
type: "success",
|
|
232984
|
+
innerType
|
|
232985
|
+
});
|
|
232986
|
+
}
|
|
232987
|
+
var ZodCatch = /* @__PURE__ */ $constructor("ZodCatch", (inst, def) => {
|
|
232988
|
+
$ZodCatch.init(inst, def);
|
|
232989
|
+
ZodType.init(inst, def);
|
|
232990
|
+
inst._zod.processJSONSchema = (ctx, json, params) => catchProcessor(inst, ctx, json, params);
|
|
232991
|
+
inst.unwrap = () => inst._zod.def.innerType;
|
|
232992
|
+
inst.removeCatch = inst.unwrap;
|
|
232993
|
+
});
|
|
232994
|
+
function _catch2(innerType, catchValue) {
|
|
232995
|
+
return new ZodCatch({
|
|
232996
|
+
type: "catch",
|
|
232997
|
+
innerType,
|
|
232998
|
+
catchValue: typeof catchValue === "function" ? catchValue : () => catchValue
|
|
232999
|
+
});
|
|
233000
|
+
}
|
|
233001
|
+
var ZodNaN = /* @__PURE__ */ $constructor("ZodNaN", (inst, def) => {
|
|
233002
|
+
$ZodNaN.init(inst, def);
|
|
233003
|
+
ZodType.init(inst, def);
|
|
233004
|
+
inst._zod.processJSONSchema = (ctx, json, params) => nanProcessor(inst, ctx, json, params);
|
|
233005
|
+
});
|
|
233006
|
+
function nan(params) {
|
|
233007
|
+
return _nan(ZodNaN, params);
|
|
233008
|
+
}
|
|
233009
|
+
var ZodPipe = /* @__PURE__ */ $constructor("ZodPipe", (inst, def) => {
|
|
233010
|
+
$ZodPipe.init(inst, def);
|
|
233011
|
+
ZodType.init(inst, def);
|
|
233012
|
+
inst._zod.processJSONSchema = (ctx, json, params) => pipeProcessor(inst, ctx, json, params);
|
|
233013
|
+
inst.in = def.in;
|
|
233014
|
+
inst.out = def.out;
|
|
233015
|
+
});
|
|
233016
|
+
function pipe(in_, out) {
|
|
233017
|
+
return new ZodPipe({
|
|
233018
|
+
type: "pipe",
|
|
233019
|
+
in: in_,
|
|
233020
|
+
out
|
|
233438
233021
|
});
|
|
233439
233022
|
}
|
|
233440
|
-
|
|
233441
|
-
|
|
233442
|
-
|
|
233443
|
-
|
|
233444
|
-
|
|
233445
|
-
|
|
233023
|
+
var ZodCodec = /* @__PURE__ */ $constructor("ZodCodec", (inst, def) => {
|
|
233024
|
+
ZodPipe.init(inst, def);
|
|
233025
|
+
$ZodCodec.init(inst, def);
|
|
233026
|
+
});
|
|
233027
|
+
function codec(in_, out, params) {
|
|
233028
|
+
return new ZodCodec({
|
|
233029
|
+
type: "pipe",
|
|
233030
|
+
in: in_,
|
|
233031
|
+
out,
|
|
233032
|
+
transform: params.decode,
|
|
233033
|
+
reverseTransform: params.encode
|
|
233446
233034
|
});
|
|
233447
233035
|
}
|
|
233448
|
-
var
|
|
233449
|
-
$
|
|
233036
|
+
var ZodReadonly = /* @__PURE__ */ $constructor("ZodReadonly", (inst, def) => {
|
|
233037
|
+
$ZodReadonly.init(inst, def);
|
|
233450
233038
|
ZodType.init(inst, def);
|
|
233451
|
-
inst._zod.processJSONSchema = (ctx, json, params) =>
|
|
233452
|
-
inst.
|
|
233039
|
+
inst._zod.processJSONSchema = (ctx, json, params) => readonlyProcessor(inst, ctx, json, params);
|
|
233040
|
+
inst.unwrap = () => inst._zod.def.innerType;
|
|
233453
233041
|
});
|
|
233454
|
-
function
|
|
233455
|
-
return new
|
|
233456
|
-
type: "
|
|
233457
|
-
|
|
233458
|
-
...exports_util.normalizeParams(params)
|
|
233042
|
+
function readonly(innerType) {
|
|
233043
|
+
return new ZodReadonly({
|
|
233044
|
+
type: "readonly",
|
|
233045
|
+
innerType
|
|
233459
233046
|
});
|
|
233460
233047
|
}
|
|
233461
|
-
var
|
|
233462
|
-
|
|
233463
|
-
|
|
233464
|
-
inst._zod.processJSONSchema = (ctx, json, params) =>
|
|
233465
|
-
inst.options = def.options;
|
|
233048
|
+
var ZodTemplateLiteral = /* @__PURE__ */ $constructor("ZodTemplateLiteral", (inst, def) => {
|
|
233049
|
+
$ZodTemplateLiteral.init(inst, def);
|
|
233050
|
+
ZodType.init(inst, def);
|
|
233051
|
+
inst._zod.processJSONSchema = (ctx, json, params) => templateLiteralProcessor(inst, ctx, json, params);
|
|
233466
233052
|
});
|
|
233467
|
-
function
|
|
233468
|
-
return new
|
|
233469
|
-
type: "
|
|
233470
|
-
|
|
233471
|
-
inclusive: false,
|
|
233053
|
+
function templateLiteral(parts, params) {
|
|
233054
|
+
return new ZodTemplateLiteral({
|
|
233055
|
+
type: "template_literal",
|
|
233056
|
+
parts,
|
|
233472
233057
|
...exports_util.normalizeParams(params)
|
|
233473
233058
|
});
|
|
233474
233059
|
}
|
|
233475
|
-
var
|
|
233476
|
-
|
|
233477
|
-
|
|
233060
|
+
var ZodLazy = /* @__PURE__ */ $constructor("ZodLazy", (inst, def) => {
|
|
233061
|
+
$ZodLazy.init(inst, def);
|
|
233062
|
+
ZodType.init(inst, def);
|
|
233063
|
+
inst._zod.processJSONSchema = (ctx, json, params) => lazyProcessor(inst, ctx, json, params);
|
|
233064
|
+
inst.unwrap = () => inst._zod.def.getter();
|
|
233478
233065
|
});
|
|
233479
|
-
function
|
|
233480
|
-
return new
|
|
233481
|
-
type: "
|
|
233482
|
-
|
|
233483
|
-
discriminator,
|
|
233484
|
-
...exports_util.normalizeParams(params)
|
|
233066
|
+
function lazy(getter) {
|
|
233067
|
+
return new ZodLazy({
|
|
233068
|
+
type: "lazy",
|
|
233069
|
+
getter
|
|
233485
233070
|
});
|
|
233486
233071
|
}
|
|
233487
|
-
var
|
|
233488
|
-
$
|
|
233072
|
+
var ZodPromise = /* @__PURE__ */ $constructor("ZodPromise", (inst, def) => {
|
|
233073
|
+
$ZodPromise.init(inst, def);
|
|
233489
233074
|
ZodType.init(inst, def);
|
|
233490
|
-
inst._zod.processJSONSchema = (ctx, json, params) =>
|
|
233075
|
+
inst._zod.processJSONSchema = (ctx, json, params) => promiseProcessor(inst, ctx, json, params);
|
|
233076
|
+
inst.unwrap = () => inst._zod.def.innerType;
|
|
233491
233077
|
});
|
|
233492
|
-
function
|
|
233493
|
-
return new
|
|
233494
|
-
type: "
|
|
233495
|
-
|
|
233496
|
-
right
|
|
233078
|
+
function promise(innerType) {
|
|
233079
|
+
return new ZodPromise({
|
|
233080
|
+
type: "promise",
|
|
233081
|
+
innerType
|
|
233497
233082
|
});
|
|
233498
233083
|
}
|
|
233499
|
-
var
|
|
233500
|
-
$
|
|
233084
|
+
var ZodFunction = /* @__PURE__ */ $constructor("ZodFunction", (inst, def) => {
|
|
233085
|
+
$ZodFunction.init(inst, def);
|
|
233501
233086
|
ZodType.init(inst, def);
|
|
233502
|
-
inst._zod.processJSONSchema = (ctx, json, params) =>
|
|
233503
|
-
inst.rest = (rest) => inst.clone({
|
|
233504
|
-
...inst._zod.def,
|
|
233505
|
-
rest
|
|
233506
|
-
});
|
|
233087
|
+
inst._zod.processJSONSchema = (ctx, json, params) => functionProcessor(inst, ctx, json, params);
|
|
233507
233088
|
});
|
|
233508
|
-
function
|
|
233509
|
-
|
|
233510
|
-
|
|
233511
|
-
|
|
233512
|
-
|
|
233513
|
-
type: "tuple",
|
|
233514
|
-
items,
|
|
233515
|
-
rest,
|
|
233516
|
-
...exports_util.normalizeParams(params)
|
|
233089
|
+
function _function(params) {
|
|
233090
|
+
return new ZodFunction({
|
|
233091
|
+
type: "function",
|
|
233092
|
+
input: Array.isArray(params?.input) ? tuple(params?.input) : params?.input ?? array(unknown()),
|
|
233093
|
+
output: params?.output ?? unknown()
|
|
233517
233094
|
});
|
|
233518
233095
|
}
|
|
233519
|
-
var
|
|
233520
|
-
$
|
|
233096
|
+
var ZodCustom = /* @__PURE__ */ $constructor("ZodCustom", (inst, def) => {
|
|
233097
|
+
$ZodCustom.init(inst, def);
|
|
233521
233098
|
ZodType.init(inst, def);
|
|
233522
|
-
inst._zod.processJSONSchema = (ctx, json, params) =>
|
|
233523
|
-
inst.keyType = def.keyType;
|
|
233524
|
-
inst.valueType = def.valueType;
|
|
233099
|
+
inst._zod.processJSONSchema = (ctx, json, params) => customProcessor(inst, ctx, json, params);
|
|
233525
233100
|
});
|
|
233526
|
-
function
|
|
233527
|
-
|
|
233528
|
-
|
|
233529
|
-
keyType,
|
|
233530
|
-
valueType,
|
|
233531
|
-
...exports_util.normalizeParams(params)
|
|
233101
|
+
function check(fn) {
|
|
233102
|
+
const ch = new $ZodCheck({
|
|
233103
|
+
check: "custom"
|
|
233532
233104
|
});
|
|
233105
|
+
ch._zod.check = fn;
|
|
233106
|
+
return ch;
|
|
233533
233107
|
}
|
|
233534
|
-
function
|
|
233535
|
-
|
|
233536
|
-
k2._zod.values = undefined;
|
|
233537
|
-
return new ZodRecord({
|
|
233538
|
-
type: "record",
|
|
233539
|
-
keyType: k2,
|
|
233540
|
-
valueType,
|
|
233541
|
-
...exports_util.normalizeParams(params)
|
|
233542
|
-
});
|
|
233108
|
+
function custom(fn, _params) {
|
|
233109
|
+
return _custom(ZodCustom, fn ?? (() => true), _params);
|
|
233543
233110
|
}
|
|
233544
|
-
function
|
|
233545
|
-
return
|
|
233546
|
-
|
|
233547
|
-
|
|
233548
|
-
|
|
233549
|
-
|
|
233111
|
+
function refine(fn, _params = {}) {
|
|
233112
|
+
return _refine(ZodCustom, fn, _params);
|
|
233113
|
+
}
|
|
233114
|
+
function superRefine(fn) {
|
|
233115
|
+
return _superRefine(fn);
|
|
233116
|
+
}
|
|
233117
|
+
var describe2 = describe;
|
|
233118
|
+
var meta2 = meta;
|
|
233119
|
+
function _instanceof(cls, params = {}) {
|
|
233120
|
+
const inst = new ZodCustom({
|
|
233121
|
+
type: "custom",
|
|
233122
|
+
check: "custom",
|
|
233123
|
+
fn: (data) => data instanceof cls,
|
|
233124
|
+
abort: true,
|
|
233550
233125
|
...exports_util.normalizeParams(params)
|
|
233551
233126
|
});
|
|
233127
|
+
inst._zod.bag.Class = cls;
|
|
233128
|
+
inst._zod.check = (payload) => {
|
|
233129
|
+
if (!(payload.value instanceof cls)) {
|
|
233130
|
+
payload.issues.push({
|
|
233131
|
+
code: "invalid_type",
|
|
233132
|
+
expected: cls.name,
|
|
233133
|
+
input: payload.value,
|
|
233134
|
+
inst,
|
|
233135
|
+
path: [...inst._zod.def.path ?? []]
|
|
233136
|
+
});
|
|
233137
|
+
}
|
|
233138
|
+
};
|
|
233139
|
+
return inst;
|
|
233552
233140
|
}
|
|
233553
|
-
var
|
|
233554
|
-
|
|
233555
|
-
|
|
233556
|
-
|
|
233557
|
-
|
|
233558
|
-
|
|
233559
|
-
|
|
233560
|
-
|
|
233561
|
-
inst.max = (...args) => inst.check(_maxSize(...args));
|
|
233562
|
-
inst.size = (...args) => inst.check(_size(...args));
|
|
233563
|
-
});
|
|
233564
|
-
function map(keyType, valueType, params) {
|
|
233565
|
-
return new ZodMap({
|
|
233566
|
-
type: "map",
|
|
233567
|
-
keyType,
|
|
233568
|
-
valueType,
|
|
233569
|
-
...exports_util.normalizeParams(params)
|
|
233141
|
+
var stringbool = (...args) => _stringbool({
|
|
233142
|
+
Codec: ZodCodec,
|
|
233143
|
+
Boolean: ZodBoolean,
|
|
233144
|
+
String: ZodString
|
|
233145
|
+
}, ...args);
|
|
233146
|
+
function json(params) {
|
|
233147
|
+
const jsonSchema = lazy(() => {
|
|
233148
|
+
return union([string2(params), number2(), boolean2(), _null3(), array(jsonSchema), record(string2(), jsonSchema)]);
|
|
233570
233149
|
});
|
|
233150
|
+
return jsonSchema;
|
|
233571
233151
|
}
|
|
233572
|
-
|
|
233573
|
-
|
|
233574
|
-
|
|
233575
|
-
|
|
233576
|
-
|
|
233577
|
-
|
|
233578
|
-
|
|
233579
|
-
|
|
233580
|
-
|
|
233581
|
-
|
|
233582
|
-
|
|
233583
|
-
|
|
233584
|
-
|
|
233585
|
-
|
|
233152
|
+
function preprocess(fn, schema) {
|
|
233153
|
+
return pipe(transform(fn), schema);
|
|
233154
|
+
}
|
|
233155
|
+
// ../../node_modules/zod/v4/classic/compat.js
|
|
233156
|
+
var ZodIssueCode = {
|
|
233157
|
+
invalid_type: "invalid_type",
|
|
233158
|
+
too_big: "too_big",
|
|
233159
|
+
too_small: "too_small",
|
|
233160
|
+
invalid_format: "invalid_format",
|
|
233161
|
+
not_multiple_of: "not_multiple_of",
|
|
233162
|
+
unrecognized_keys: "unrecognized_keys",
|
|
233163
|
+
invalid_union: "invalid_union",
|
|
233164
|
+
invalid_key: "invalid_key",
|
|
233165
|
+
invalid_element: "invalid_element",
|
|
233166
|
+
invalid_value: "invalid_value",
|
|
233167
|
+
custom: "custom"
|
|
233168
|
+
};
|
|
233169
|
+
function setErrorMap(map2) {
|
|
233170
|
+
config({
|
|
233171
|
+
customError: map2
|
|
233586
233172
|
});
|
|
233587
233173
|
}
|
|
233588
|
-
|
|
233589
|
-
|
|
233590
|
-
|
|
233591
|
-
|
|
233592
|
-
|
|
233593
|
-
|
|
233594
|
-
|
|
233595
|
-
|
|
233596
|
-
|
|
233597
|
-
|
|
233598
|
-
|
|
233599
|
-
|
|
233600
|
-
|
|
233601
|
-
|
|
233174
|
+
function getErrorMap() {
|
|
233175
|
+
return config().customError;
|
|
233176
|
+
}
|
|
233177
|
+
var ZodFirstPartyTypeKind;
|
|
233178
|
+
(function(ZodFirstPartyTypeKind2) {})(ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {}));
|
|
233179
|
+
// ../../node_modules/zod/v4/classic/from-json-schema.js
|
|
233180
|
+
var z2 = {
|
|
233181
|
+
...exports_schemas2,
|
|
233182
|
+
...exports_checks2,
|
|
233183
|
+
iso: exports_iso
|
|
233184
|
+
};
|
|
233185
|
+
var RECOGNIZED_KEYS = new Set([
|
|
233186
|
+
"$schema",
|
|
233187
|
+
"$ref",
|
|
233188
|
+
"$defs",
|
|
233189
|
+
"definitions",
|
|
233190
|
+
"$id",
|
|
233191
|
+
"id",
|
|
233192
|
+
"$comment",
|
|
233193
|
+
"$anchor",
|
|
233194
|
+
"$vocabulary",
|
|
233195
|
+
"$dynamicRef",
|
|
233196
|
+
"$dynamicAnchor",
|
|
233197
|
+
"type",
|
|
233198
|
+
"enum",
|
|
233199
|
+
"const",
|
|
233200
|
+
"anyOf",
|
|
233201
|
+
"oneOf",
|
|
233202
|
+
"allOf",
|
|
233203
|
+
"not",
|
|
233204
|
+
"properties",
|
|
233205
|
+
"required",
|
|
233206
|
+
"additionalProperties",
|
|
233207
|
+
"patternProperties",
|
|
233208
|
+
"propertyNames",
|
|
233209
|
+
"minProperties",
|
|
233210
|
+
"maxProperties",
|
|
233211
|
+
"items",
|
|
233212
|
+
"prefixItems",
|
|
233213
|
+
"additionalItems",
|
|
233214
|
+
"minItems",
|
|
233215
|
+
"maxItems",
|
|
233216
|
+
"uniqueItems",
|
|
233217
|
+
"contains",
|
|
233218
|
+
"minContains",
|
|
233219
|
+
"maxContains",
|
|
233220
|
+
"minLength",
|
|
233221
|
+
"maxLength",
|
|
233222
|
+
"pattern",
|
|
233223
|
+
"format",
|
|
233224
|
+
"minimum",
|
|
233225
|
+
"maximum",
|
|
233226
|
+
"exclusiveMinimum",
|
|
233227
|
+
"exclusiveMaximum",
|
|
233228
|
+
"multipleOf",
|
|
233229
|
+
"description",
|
|
233230
|
+
"default",
|
|
233231
|
+
"contentEncoding",
|
|
233232
|
+
"contentMediaType",
|
|
233233
|
+
"contentSchema",
|
|
233234
|
+
"unevaluatedItems",
|
|
233235
|
+
"unevaluatedProperties",
|
|
233236
|
+
"if",
|
|
233237
|
+
"then",
|
|
233238
|
+
"else",
|
|
233239
|
+
"dependentSchemas",
|
|
233240
|
+
"dependentRequired",
|
|
233241
|
+
"nullable",
|
|
233242
|
+
"readOnly"
|
|
233243
|
+
]);
|
|
233244
|
+
function detectVersion(schema, defaultTarget) {
|
|
233245
|
+
const $schema = schema.$schema;
|
|
233246
|
+
if ($schema === "https://json-schema.org/draft/2020-12/schema") {
|
|
233247
|
+
return "draft-2020-12";
|
|
233248
|
+
}
|
|
233249
|
+
if ($schema === "http://json-schema.org/draft-07/schema#") {
|
|
233250
|
+
return "draft-7";
|
|
233251
|
+
}
|
|
233252
|
+
if ($schema === "http://json-schema.org/draft-04/schema#") {
|
|
233253
|
+
return "draft-4";
|
|
233254
|
+
}
|
|
233255
|
+
return defaultTarget ?? "draft-2020-12";
|
|
233256
|
+
}
|
|
233257
|
+
function resolveRef(ref, ctx) {
|
|
233258
|
+
if (!ref.startsWith("#")) {
|
|
233259
|
+
throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
|
|
233260
|
+
}
|
|
233261
|
+
const path = ref.slice(1).split("/").filter(Boolean);
|
|
233262
|
+
if (path.length === 0) {
|
|
233263
|
+
return ctx.rootSchema;
|
|
233264
|
+
}
|
|
233265
|
+
const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
|
|
233266
|
+
if (path[0] === defsKey) {
|
|
233267
|
+
const key = path[1];
|
|
233268
|
+
if (!key || !ctx.defs[key]) {
|
|
233269
|
+
throw new Error(`Reference not found: ${ref}`);
|
|
233602
233270
|
}
|
|
233603
|
-
return
|
|
233604
|
-
|
|
233605
|
-
|
|
233606
|
-
|
|
233607
|
-
|
|
233271
|
+
return ctx.defs[key];
|
|
233272
|
+
}
|
|
233273
|
+
throw new Error(`Reference not found: ${ref}`);
|
|
233274
|
+
}
|
|
233275
|
+
function convertBaseSchema(schema, ctx) {
|
|
233276
|
+
if (schema.not !== undefined) {
|
|
233277
|
+
if (typeof schema.not === "object" && Object.keys(schema.not).length === 0) {
|
|
233278
|
+
return z2.never();
|
|
233279
|
+
}
|
|
233280
|
+
throw new Error("not is not supported in Zod (except { not: {} } for never)");
|
|
233281
|
+
}
|
|
233282
|
+
if (schema.unevaluatedItems !== undefined) {
|
|
233283
|
+
throw new Error("unevaluatedItems is not supported");
|
|
233284
|
+
}
|
|
233285
|
+
if (schema.unevaluatedProperties !== undefined) {
|
|
233286
|
+
throw new Error("unevaluatedProperties is not supported");
|
|
233287
|
+
}
|
|
233288
|
+
if (schema.if !== undefined || schema.then !== undefined || schema.else !== undefined) {
|
|
233289
|
+
throw new Error("Conditional schemas (if/then/else) are not supported");
|
|
233290
|
+
}
|
|
233291
|
+
if (schema.dependentSchemas !== undefined || schema.dependentRequired !== undefined) {
|
|
233292
|
+
throw new Error("dependentSchemas and dependentRequired are not supported");
|
|
233293
|
+
}
|
|
233294
|
+
if (schema.$ref) {
|
|
233295
|
+
const refPath = schema.$ref;
|
|
233296
|
+
if (ctx.refs.has(refPath)) {
|
|
233297
|
+
return ctx.refs.get(refPath);
|
|
233298
|
+
}
|
|
233299
|
+
if (ctx.processing.has(refPath)) {
|
|
233300
|
+
return z2.lazy(() => {
|
|
233301
|
+
if (!ctx.refs.has(refPath)) {
|
|
233302
|
+
throw new Error(`Circular reference not resolved: ${refPath}`);
|
|
233303
|
+
}
|
|
233304
|
+
return ctx.refs.get(refPath);
|
|
233305
|
+
});
|
|
233306
|
+
}
|
|
233307
|
+
ctx.processing.add(refPath);
|
|
233308
|
+
const resolved = resolveRef(refPath, ctx);
|
|
233309
|
+
const zodSchema2 = convertSchema(resolved, ctx);
|
|
233310
|
+
ctx.refs.set(refPath, zodSchema2);
|
|
233311
|
+
ctx.processing.delete(refPath);
|
|
233312
|
+
return zodSchema2;
|
|
233313
|
+
}
|
|
233314
|
+
if (schema.enum !== undefined) {
|
|
233315
|
+
const enumValues = schema.enum;
|
|
233316
|
+
if (ctx.version === "openapi-3.0" && schema.nullable === true && enumValues.length === 1 && enumValues[0] === null) {
|
|
233317
|
+
return z2.null();
|
|
233318
|
+
}
|
|
233319
|
+
if (enumValues.length === 0) {
|
|
233320
|
+
return z2.never();
|
|
233321
|
+
}
|
|
233322
|
+
if (enumValues.length === 1) {
|
|
233323
|
+
return z2.literal(enumValues[0]);
|
|
233324
|
+
}
|
|
233325
|
+
if (enumValues.every((v) => typeof v === "string")) {
|
|
233326
|
+
return z2.enum(enumValues);
|
|
233327
|
+
}
|
|
233328
|
+
const literalSchemas = enumValues.map((v) => z2.literal(v));
|
|
233329
|
+
if (literalSchemas.length < 2) {
|
|
233330
|
+
return literalSchemas[0];
|
|
233331
|
+
}
|
|
233332
|
+
return z2.union([literalSchemas[0], literalSchemas[1], ...literalSchemas.slice(2)]);
|
|
233333
|
+
}
|
|
233334
|
+
if (schema.const !== undefined) {
|
|
233335
|
+
return z2.literal(schema.const);
|
|
233336
|
+
}
|
|
233337
|
+
const type = schema.type;
|
|
233338
|
+
if (Array.isArray(type)) {
|
|
233339
|
+
const typeSchemas = type.map((t) => {
|
|
233340
|
+
const typeSchema = { ...schema, type: t };
|
|
233341
|
+
return convertBaseSchema(typeSchema, ctx);
|
|
233608
233342
|
});
|
|
233609
|
-
|
|
233610
|
-
|
|
233611
|
-
|
|
233612
|
-
|
|
233613
|
-
|
|
233614
|
-
|
|
233615
|
-
|
|
233616
|
-
|
|
233343
|
+
if (typeSchemas.length === 0) {
|
|
233344
|
+
return z2.never();
|
|
233345
|
+
}
|
|
233346
|
+
if (typeSchemas.length === 1) {
|
|
233347
|
+
return typeSchemas[0];
|
|
233348
|
+
}
|
|
233349
|
+
return z2.union(typeSchemas);
|
|
233350
|
+
}
|
|
233351
|
+
if (!type) {
|
|
233352
|
+
return z2.any();
|
|
233353
|
+
}
|
|
233354
|
+
let zodSchema;
|
|
233355
|
+
switch (type) {
|
|
233356
|
+
case "string": {
|
|
233357
|
+
let stringSchema = z2.string();
|
|
233358
|
+
if (schema.format) {
|
|
233359
|
+
const format = schema.format;
|
|
233360
|
+
if (format === "email") {
|
|
233361
|
+
stringSchema = stringSchema.check(z2.email());
|
|
233362
|
+
} else if (format === "uri" || format === "uri-reference") {
|
|
233363
|
+
stringSchema = stringSchema.check(z2.url());
|
|
233364
|
+
} else if (format === "uuid" || format === "guid") {
|
|
233365
|
+
stringSchema = stringSchema.check(z2.uuid());
|
|
233366
|
+
} else if (format === "date-time") {
|
|
233367
|
+
stringSchema = stringSchema.check(z2.iso.datetime());
|
|
233368
|
+
} else if (format === "date") {
|
|
233369
|
+
stringSchema = stringSchema.check(z2.iso.date());
|
|
233370
|
+
} else if (format === "time") {
|
|
233371
|
+
stringSchema = stringSchema.check(z2.iso.time());
|
|
233372
|
+
} else if (format === "duration") {
|
|
233373
|
+
stringSchema = stringSchema.check(z2.iso.duration());
|
|
233374
|
+
} else if (format === "ipv4") {
|
|
233375
|
+
stringSchema = stringSchema.check(z2.ipv4());
|
|
233376
|
+
} else if (format === "ipv6") {
|
|
233377
|
+
stringSchema = stringSchema.check(z2.ipv6());
|
|
233378
|
+
} else if (format === "mac") {
|
|
233379
|
+
stringSchema = stringSchema.check(z2.mac());
|
|
233380
|
+
} else if (format === "cidr") {
|
|
233381
|
+
stringSchema = stringSchema.check(z2.cidrv4());
|
|
233382
|
+
} else if (format === "cidr-v6") {
|
|
233383
|
+
stringSchema = stringSchema.check(z2.cidrv6());
|
|
233384
|
+
} else if (format === "base64") {
|
|
233385
|
+
stringSchema = stringSchema.check(z2.base64());
|
|
233386
|
+
} else if (format === "base64url") {
|
|
233387
|
+
stringSchema = stringSchema.check(z2.base64url());
|
|
233388
|
+
} else if (format === "e164") {
|
|
233389
|
+
stringSchema = stringSchema.check(z2.e164());
|
|
233390
|
+
} else if (format === "jwt") {
|
|
233391
|
+
stringSchema = stringSchema.check(z2.jwt());
|
|
233392
|
+
} else if (format === "emoji") {
|
|
233393
|
+
stringSchema = stringSchema.check(z2.emoji());
|
|
233394
|
+
} else if (format === "nanoid") {
|
|
233395
|
+
stringSchema = stringSchema.check(z2.nanoid());
|
|
233396
|
+
} else if (format === "cuid") {
|
|
233397
|
+
stringSchema = stringSchema.check(z2.cuid());
|
|
233398
|
+
} else if (format === "cuid2") {
|
|
233399
|
+
stringSchema = stringSchema.check(z2.cuid2());
|
|
233400
|
+
} else if (format === "ulid") {
|
|
233401
|
+
stringSchema = stringSchema.check(z2.ulid());
|
|
233402
|
+
} else if (format === "xid") {
|
|
233403
|
+
stringSchema = stringSchema.check(z2.xid());
|
|
233404
|
+
} else if (format === "ksuid") {
|
|
233405
|
+
stringSchema = stringSchema.check(z2.ksuid());
|
|
233406
|
+
}
|
|
233407
|
+
}
|
|
233408
|
+
if (typeof schema.minLength === "number") {
|
|
233409
|
+
stringSchema = stringSchema.min(schema.minLength);
|
|
233410
|
+
}
|
|
233411
|
+
if (typeof schema.maxLength === "number") {
|
|
233412
|
+
stringSchema = stringSchema.max(schema.maxLength);
|
|
233413
|
+
}
|
|
233414
|
+
if (schema.pattern) {
|
|
233415
|
+
stringSchema = stringSchema.regex(new RegExp(schema.pattern));
|
|
233416
|
+
}
|
|
233417
|
+
zodSchema = stringSchema;
|
|
233418
|
+
break;
|
|
233617
233419
|
}
|
|
233618
|
-
|
|
233619
|
-
|
|
233620
|
-
|
|
233621
|
-
|
|
233622
|
-
|
|
233623
|
-
});
|
|
233624
|
-
};
|
|
233625
|
-
});
|
|
233626
|
-
function _enum2(values, params) {
|
|
233627
|
-
const entries = Array.isArray(values) ? Object.fromEntries(values.map((v) => [v, v])) : values;
|
|
233628
|
-
return new ZodEnum({
|
|
233629
|
-
type: "enum",
|
|
233630
|
-
entries,
|
|
233631
|
-
...exports_util.normalizeParams(params)
|
|
233632
|
-
});
|
|
233633
|
-
}
|
|
233634
|
-
function nativeEnum(entries, params) {
|
|
233635
|
-
return new ZodEnum({
|
|
233636
|
-
type: "enum",
|
|
233637
|
-
entries,
|
|
233638
|
-
...exports_util.normalizeParams(params)
|
|
233639
|
-
});
|
|
233640
|
-
}
|
|
233641
|
-
var ZodLiteral = /* @__PURE__ */ $constructor("ZodLiteral", (inst, def) => {
|
|
233642
|
-
$ZodLiteral.init(inst, def);
|
|
233643
|
-
ZodType.init(inst, def);
|
|
233644
|
-
inst._zod.processJSONSchema = (ctx, json, params) => literalProcessor(inst, ctx, json, params);
|
|
233645
|
-
inst.values = new Set(def.values);
|
|
233646
|
-
Object.defineProperty(inst, "value", {
|
|
233647
|
-
get() {
|
|
233648
|
-
if (def.values.length > 1) {
|
|
233649
|
-
throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");
|
|
233420
|
+
case "number":
|
|
233421
|
+
case "integer": {
|
|
233422
|
+
let numberSchema = type === "integer" ? z2.number().int() : z2.number();
|
|
233423
|
+
if (typeof schema.minimum === "number") {
|
|
233424
|
+
numberSchema = numberSchema.min(schema.minimum);
|
|
233650
233425
|
}
|
|
233651
|
-
|
|
233426
|
+
if (typeof schema.maximum === "number") {
|
|
233427
|
+
numberSchema = numberSchema.max(schema.maximum);
|
|
233428
|
+
}
|
|
233429
|
+
if (typeof schema.exclusiveMinimum === "number") {
|
|
233430
|
+
numberSchema = numberSchema.gt(schema.exclusiveMinimum);
|
|
233431
|
+
} else if (schema.exclusiveMinimum === true && typeof schema.minimum === "number") {
|
|
233432
|
+
numberSchema = numberSchema.gt(schema.minimum);
|
|
233433
|
+
}
|
|
233434
|
+
if (typeof schema.exclusiveMaximum === "number") {
|
|
233435
|
+
numberSchema = numberSchema.lt(schema.exclusiveMaximum);
|
|
233436
|
+
} else if (schema.exclusiveMaximum === true && typeof schema.maximum === "number") {
|
|
233437
|
+
numberSchema = numberSchema.lt(schema.maximum);
|
|
233438
|
+
}
|
|
233439
|
+
if (typeof schema.multipleOf === "number") {
|
|
233440
|
+
numberSchema = numberSchema.multipleOf(schema.multipleOf);
|
|
233441
|
+
}
|
|
233442
|
+
zodSchema = numberSchema;
|
|
233443
|
+
break;
|
|
233652
233444
|
}
|
|
233653
|
-
|
|
233654
|
-
|
|
233655
|
-
|
|
233656
|
-
return new ZodLiteral({
|
|
233657
|
-
type: "literal",
|
|
233658
|
-
values: Array.isArray(value) ? value : [value],
|
|
233659
|
-
...exports_util.normalizeParams(params)
|
|
233660
|
-
});
|
|
233661
|
-
}
|
|
233662
|
-
var ZodFile = /* @__PURE__ */ $constructor("ZodFile", (inst, def) => {
|
|
233663
|
-
$ZodFile.init(inst, def);
|
|
233664
|
-
ZodType.init(inst, def);
|
|
233665
|
-
inst._zod.processJSONSchema = (ctx, json, params) => fileProcessor(inst, ctx, json, params);
|
|
233666
|
-
inst.min = (size, params) => inst.check(_minSize(size, params));
|
|
233667
|
-
inst.max = (size, params) => inst.check(_maxSize(size, params));
|
|
233668
|
-
inst.mime = (types, params) => inst.check(_mime(Array.isArray(types) ? types : [types], params));
|
|
233669
|
-
});
|
|
233670
|
-
function file(params) {
|
|
233671
|
-
return _file(ZodFile, params);
|
|
233672
|
-
}
|
|
233673
|
-
var ZodTransform = /* @__PURE__ */ $constructor("ZodTransform", (inst, def) => {
|
|
233674
|
-
$ZodTransform.init(inst, def);
|
|
233675
|
-
ZodType.init(inst, def);
|
|
233676
|
-
inst._zod.processJSONSchema = (ctx, json, params) => transformProcessor(inst, ctx, json, params);
|
|
233677
|
-
inst._zod.parse = (payload, _ctx) => {
|
|
233678
|
-
if (_ctx.direction === "backward") {
|
|
233679
|
-
throw new $ZodEncodeError(inst.constructor.name);
|
|
233445
|
+
case "boolean": {
|
|
233446
|
+
zodSchema = z2.boolean();
|
|
233447
|
+
break;
|
|
233680
233448
|
}
|
|
233681
|
-
|
|
233682
|
-
|
|
233683
|
-
|
|
233449
|
+
case "null": {
|
|
233450
|
+
zodSchema = z2.null();
|
|
233451
|
+
break;
|
|
233452
|
+
}
|
|
233453
|
+
case "object": {
|
|
233454
|
+
const shape = {};
|
|
233455
|
+
const properties = schema.properties || {};
|
|
233456
|
+
const requiredSet = new Set(schema.required || []);
|
|
233457
|
+
for (const [key, propSchema] of Object.entries(properties)) {
|
|
233458
|
+
const propZodSchema = convertSchema(propSchema, ctx);
|
|
233459
|
+
shape[key] = requiredSet.has(key) ? propZodSchema : propZodSchema.optional();
|
|
233460
|
+
}
|
|
233461
|
+
if (schema.propertyNames) {
|
|
233462
|
+
const keySchema = convertSchema(schema.propertyNames, ctx);
|
|
233463
|
+
const valueSchema = schema.additionalProperties && typeof schema.additionalProperties === "object" ? convertSchema(schema.additionalProperties, ctx) : z2.any();
|
|
233464
|
+
if (Object.keys(shape).length === 0) {
|
|
233465
|
+
zodSchema = z2.record(keySchema, valueSchema);
|
|
233466
|
+
break;
|
|
233467
|
+
}
|
|
233468
|
+
const objectSchema2 = z2.object(shape).passthrough();
|
|
233469
|
+
const recordSchema = z2.looseRecord(keySchema, valueSchema);
|
|
233470
|
+
zodSchema = z2.intersection(objectSchema2, recordSchema);
|
|
233471
|
+
break;
|
|
233472
|
+
}
|
|
233473
|
+
if (schema.patternProperties) {
|
|
233474
|
+
const patternProps = schema.patternProperties;
|
|
233475
|
+
const patternKeys = Object.keys(patternProps);
|
|
233476
|
+
const looseRecords = [];
|
|
233477
|
+
for (const pattern of patternKeys) {
|
|
233478
|
+
const patternValue = convertSchema(patternProps[pattern], ctx);
|
|
233479
|
+
const keySchema = z2.string().regex(new RegExp(pattern));
|
|
233480
|
+
looseRecords.push(z2.looseRecord(keySchema, patternValue));
|
|
233481
|
+
}
|
|
233482
|
+
const schemasToIntersect = [];
|
|
233483
|
+
if (Object.keys(shape).length > 0) {
|
|
233484
|
+
schemasToIntersect.push(z2.object(shape).passthrough());
|
|
233485
|
+
}
|
|
233486
|
+
schemasToIntersect.push(...looseRecords);
|
|
233487
|
+
if (schemasToIntersect.length === 0) {
|
|
233488
|
+
zodSchema = z2.object({}).passthrough();
|
|
233489
|
+
} else if (schemasToIntersect.length === 1) {
|
|
233490
|
+
zodSchema = schemasToIntersect[0];
|
|
233491
|
+
} else {
|
|
233492
|
+
let result = z2.intersection(schemasToIntersect[0], schemasToIntersect[1]);
|
|
233493
|
+
for (let i = 2;i < schemasToIntersect.length; i++) {
|
|
233494
|
+
result = z2.intersection(result, schemasToIntersect[i]);
|
|
233495
|
+
}
|
|
233496
|
+
zodSchema = result;
|
|
233497
|
+
}
|
|
233498
|
+
break;
|
|
233499
|
+
}
|
|
233500
|
+
const objectSchema = z2.object(shape);
|
|
233501
|
+
if (schema.additionalProperties === false) {
|
|
233502
|
+
zodSchema = objectSchema.strict();
|
|
233503
|
+
} else if (typeof schema.additionalProperties === "object") {
|
|
233504
|
+
zodSchema = objectSchema.catchall(convertSchema(schema.additionalProperties, ctx));
|
|
233684
233505
|
} else {
|
|
233685
|
-
|
|
233686
|
-
if (_issue.fatal)
|
|
233687
|
-
_issue.continue = false;
|
|
233688
|
-
_issue.code ?? (_issue.code = "custom");
|
|
233689
|
-
_issue.input ?? (_issue.input = payload.value);
|
|
233690
|
-
_issue.inst ?? (_issue.inst = inst);
|
|
233691
|
-
payload.issues.push(exports_util.issue(_issue));
|
|
233506
|
+
zodSchema = objectSchema.passthrough();
|
|
233692
233507
|
}
|
|
233693
|
-
|
|
233694
|
-
const output = def.transform(payload.value, payload);
|
|
233695
|
-
if (output instanceof Promise) {
|
|
233696
|
-
return output.then((output2) => {
|
|
233697
|
-
payload.value = output2;
|
|
233698
|
-
return payload;
|
|
233699
|
-
});
|
|
233508
|
+
break;
|
|
233700
233509
|
}
|
|
233701
|
-
|
|
233702
|
-
|
|
233703
|
-
|
|
233704
|
-
|
|
233705
|
-
|
|
233706
|
-
|
|
233707
|
-
|
|
233708
|
-
|
|
233709
|
-
|
|
233710
|
-
|
|
233711
|
-
|
|
233712
|
-
|
|
233713
|
-
|
|
233714
|
-
|
|
233715
|
-
|
|
233716
|
-
|
|
233717
|
-
|
|
233718
|
-
|
|
233719
|
-
|
|
233720
|
-
|
|
233721
|
-
|
|
233722
|
-
|
|
233723
|
-
|
|
233724
|
-
|
|
233725
|
-
|
|
233726
|
-
|
|
233727
|
-
|
|
233728
|
-
}
|
|
233729
|
-
|
|
233730
|
-
|
|
233731
|
-
|
|
233732
|
-
|
|
233733
|
-
|
|
233734
|
-
|
|
233735
|
-
|
|
233736
|
-
|
|
233737
|
-
|
|
233738
|
-
|
|
233739
|
-
|
|
233740
|
-
}
|
|
233741
|
-
|
|
233742
|
-
|
|
233743
|
-
|
|
233744
|
-
|
|
233745
|
-
|
|
233746
|
-
}
|
|
233747
|
-
function nullish2(innerType) {
|
|
233748
|
-
return optional(nullable(innerType));
|
|
233749
|
-
}
|
|
233750
|
-
var ZodDefault = /* @__PURE__ */ $constructor("ZodDefault", (inst, def) => {
|
|
233751
|
-
$ZodDefault.init(inst, def);
|
|
233752
|
-
ZodType.init(inst, def);
|
|
233753
|
-
inst._zod.processJSONSchema = (ctx, json, params) => defaultProcessor(inst, ctx, json, params);
|
|
233754
|
-
inst.unwrap = () => inst._zod.def.innerType;
|
|
233755
|
-
inst.removeDefault = inst.unwrap;
|
|
233756
|
-
});
|
|
233757
|
-
function _default2(innerType, defaultValue) {
|
|
233758
|
-
return new ZodDefault({
|
|
233759
|
-
type: "default",
|
|
233760
|
-
innerType,
|
|
233761
|
-
get defaultValue() {
|
|
233762
|
-
return typeof defaultValue === "function" ? defaultValue() : exports_util.shallowClone(defaultValue);
|
|
233510
|
+
case "array": {
|
|
233511
|
+
const prefixItems = schema.prefixItems;
|
|
233512
|
+
const items = schema.items;
|
|
233513
|
+
if (prefixItems && Array.isArray(prefixItems)) {
|
|
233514
|
+
const tupleItems = prefixItems.map((item) => convertSchema(item, ctx));
|
|
233515
|
+
const rest = items && typeof items === "object" && !Array.isArray(items) ? convertSchema(items, ctx) : undefined;
|
|
233516
|
+
if (rest) {
|
|
233517
|
+
zodSchema = z2.tuple(tupleItems).rest(rest);
|
|
233518
|
+
} else {
|
|
233519
|
+
zodSchema = z2.tuple(tupleItems);
|
|
233520
|
+
}
|
|
233521
|
+
if (typeof schema.minItems === "number") {
|
|
233522
|
+
zodSchema = zodSchema.check(z2.minLength(schema.minItems));
|
|
233523
|
+
}
|
|
233524
|
+
if (typeof schema.maxItems === "number") {
|
|
233525
|
+
zodSchema = zodSchema.check(z2.maxLength(schema.maxItems));
|
|
233526
|
+
}
|
|
233527
|
+
} else if (Array.isArray(items)) {
|
|
233528
|
+
const tupleItems = items.map((item) => convertSchema(item, ctx));
|
|
233529
|
+
const rest = schema.additionalItems && typeof schema.additionalItems === "object" ? convertSchema(schema.additionalItems, ctx) : undefined;
|
|
233530
|
+
if (rest) {
|
|
233531
|
+
zodSchema = z2.tuple(tupleItems).rest(rest);
|
|
233532
|
+
} else {
|
|
233533
|
+
zodSchema = z2.tuple(tupleItems);
|
|
233534
|
+
}
|
|
233535
|
+
if (typeof schema.minItems === "number") {
|
|
233536
|
+
zodSchema = zodSchema.check(z2.minLength(schema.minItems));
|
|
233537
|
+
}
|
|
233538
|
+
if (typeof schema.maxItems === "number") {
|
|
233539
|
+
zodSchema = zodSchema.check(z2.maxLength(schema.maxItems));
|
|
233540
|
+
}
|
|
233541
|
+
} else if (items !== undefined) {
|
|
233542
|
+
const element = convertSchema(items, ctx);
|
|
233543
|
+
let arraySchema = z2.array(element);
|
|
233544
|
+
if (typeof schema.minItems === "number") {
|
|
233545
|
+
arraySchema = arraySchema.min(schema.minItems);
|
|
233546
|
+
}
|
|
233547
|
+
if (typeof schema.maxItems === "number") {
|
|
233548
|
+
arraySchema = arraySchema.max(schema.maxItems);
|
|
233549
|
+
}
|
|
233550
|
+
zodSchema = arraySchema;
|
|
233551
|
+
} else {
|
|
233552
|
+
zodSchema = z2.array(z2.any());
|
|
233553
|
+
}
|
|
233554
|
+
break;
|
|
233763
233555
|
}
|
|
233764
|
-
|
|
233556
|
+
default:
|
|
233557
|
+
throw new Error(`Unsupported type: ${type}`);
|
|
233558
|
+
}
|
|
233559
|
+
if (schema.description) {
|
|
233560
|
+
zodSchema = zodSchema.describe(schema.description);
|
|
233561
|
+
}
|
|
233562
|
+
if (schema.default !== undefined) {
|
|
233563
|
+
zodSchema = zodSchema.default(schema.default);
|
|
233564
|
+
}
|
|
233565
|
+
return zodSchema;
|
|
233765
233566
|
}
|
|
233766
|
-
|
|
233767
|
-
|
|
233768
|
-
|
|
233769
|
-
|
|
233770
|
-
|
|
233771
|
-
|
|
233772
|
-
|
|
233773
|
-
|
|
233774
|
-
|
|
233775
|
-
|
|
233776
|
-
|
|
233777
|
-
|
|
233567
|
+
function convertSchema(schema, ctx) {
|
|
233568
|
+
if (typeof schema === "boolean") {
|
|
233569
|
+
return schema ? z2.any() : z2.never();
|
|
233570
|
+
}
|
|
233571
|
+
let baseSchema = convertBaseSchema(schema, ctx);
|
|
233572
|
+
const hasExplicitType = schema.type || schema.enum !== undefined || schema.const !== undefined;
|
|
233573
|
+
if (schema.anyOf && Array.isArray(schema.anyOf)) {
|
|
233574
|
+
const options = schema.anyOf.map((s) => convertSchema(s, ctx));
|
|
233575
|
+
const anyOfUnion = z2.union(options);
|
|
233576
|
+
baseSchema = hasExplicitType ? z2.intersection(baseSchema, anyOfUnion) : anyOfUnion;
|
|
233577
|
+
}
|
|
233578
|
+
if (schema.oneOf && Array.isArray(schema.oneOf)) {
|
|
233579
|
+
const options = schema.oneOf.map((s) => convertSchema(s, ctx));
|
|
233580
|
+
const oneOfUnion = z2.xor(options);
|
|
233581
|
+
baseSchema = hasExplicitType ? z2.intersection(baseSchema, oneOfUnion) : oneOfUnion;
|
|
233582
|
+
}
|
|
233583
|
+
if (schema.allOf && Array.isArray(schema.allOf)) {
|
|
233584
|
+
if (schema.allOf.length === 0) {
|
|
233585
|
+
baseSchema = hasExplicitType ? baseSchema : z2.any();
|
|
233586
|
+
} else {
|
|
233587
|
+
let result = hasExplicitType ? baseSchema : convertSchema(schema.allOf[0], ctx);
|
|
233588
|
+
const startIdx = hasExplicitType ? 0 : 1;
|
|
233589
|
+
for (let i = startIdx;i < schema.allOf.length; i++) {
|
|
233590
|
+
result = z2.intersection(result, convertSchema(schema.allOf[i], ctx));
|
|
233591
|
+
}
|
|
233592
|
+
baseSchema = result;
|
|
233778
233593
|
}
|
|
233779
|
-
}
|
|
233780
|
-
|
|
233781
|
-
|
|
233782
|
-
|
|
233783
|
-
|
|
233784
|
-
|
|
233785
|
-
|
|
233786
|
-
}
|
|
233787
|
-
|
|
233788
|
-
|
|
233789
|
-
|
|
233790
|
-
|
|
233791
|
-
|
|
233792
|
-
}
|
|
233793
|
-
|
|
233794
|
-
|
|
233795
|
-
|
|
233796
|
-
|
|
233797
|
-
|
|
233798
|
-
|
|
233799
|
-
|
|
233800
|
-
|
|
233801
|
-
|
|
233802
|
-
|
|
233803
|
-
|
|
233804
|
-
|
|
233805
|
-
|
|
233806
|
-
|
|
233807
|
-
|
|
233808
|
-
ZodType.init(inst, def);
|
|
233809
|
-
inst._zod.processJSONSchema = (ctx, json, params) => catchProcessor(inst, ctx, json, params);
|
|
233810
|
-
inst.unwrap = () => inst._zod.def.innerType;
|
|
233811
|
-
inst.removeCatch = inst.unwrap;
|
|
233812
|
-
});
|
|
233813
|
-
function _catch2(innerType, catchValue) {
|
|
233814
|
-
return new ZodCatch({
|
|
233815
|
-
type: "catch",
|
|
233816
|
-
innerType,
|
|
233817
|
-
catchValue: typeof catchValue === "function" ? catchValue : () => catchValue
|
|
233818
|
-
});
|
|
233819
|
-
}
|
|
233820
|
-
var ZodNaN = /* @__PURE__ */ $constructor("ZodNaN", (inst, def) => {
|
|
233821
|
-
$ZodNaN.init(inst, def);
|
|
233822
|
-
ZodType.init(inst, def);
|
|
233823
|
-
inst._zod.processJSONSchema = (ctx, json, params) => nanProcessor(inst, ctx, json, params);
|
|
233824
|
-
});
|
|
233825
|
-
function nan(params) {
|
|
233826
|
-
return _nan(ZodNaN, params);
|
|
233827
|
-
}
|
|
233828
|
-
var ZodPipe = /* @__PURE__ */ $constructor("ZodPipe", (inst, def) => {
|
|
233829
|
-
$ZodPipe.init(inst, def);
|
|
233830
|
-
ZodType.init(inst, def);
|
|
233831
|
-
inst._zod.processJSONSchema = (ctx, json, params) => pipeProcessor(inst, ctx, json, params);
|
|
233832
|
-
inst.in = def.in;
|
|
233833
|
-
inst.out = def.out;
|
|
233834
|
-
});
|
|
233835
|
-
function pipe(in_, out) {
|
|
233836
|
-
return new ZodPipe({
|
|
233837
|
-
type: "pipe",
|
|
233838
|
-
in: in_,
|
|
233839
|
-
out
|
|
233840
|
-
});
|
|
233841
|
-
}
|
|
233842
|
-
var ZodCodec = /* @__PURE__ */ $constructor("ZodCodec", (inst, def) => {
|
|
233843
|
-
ZodPipe.init(inst, def);
|
|
233844
|
-
$ZodCodec.init(inst, def);
|
|
233845
|
-
});
|
|
233846
|
-
function codec(in_, out, params) {
|
|
233847
|
-
return new ZodCodec({
|
|
233848
|
-
type: "pipe",
|
|
233849
|
-
in: in_,
|
|
233850
|
-
out,
|
|
233851
|
-
transform: params.decode,
|
|
233852
|
-
reverseTransform: params.encode
|
|
233853
|
-
});
|
|
233854
|
-
}
|
|
233855
|
-
var ZodReadonly = /* @__PURE__ */ $constructor("ZodReadonly", (inst, def) => {
|
|
233856
|
-
$ZodReadonly.init(inst, def);
|
|
233857
|
-
ZodType.init(inst, def);
|
|
233858
|
-
inst._zod.processJSONSchema = (ctx, json, params) => readonlyProcessor(inst, ctx, json, params);
|
|
233859
|
-
inst.unwrap = () => inst._zod.def.innerType;
|
|
233860
|
-
});
|
|
233861
|
-
function readonly(innerType) {
|
|
233862
|
-
return new ZodReadonly({
|
|
233863
|
-
type: "readonly",
|
|
233864
|
-
innerType
|
|
233865
|
-
});
|
|
233866
|
-
}
|
|
233867
|
-
var ZodTemplateLiteral = /* @__PURE__ */ $constructor("ZodTemplateLiteral", (inst, def) => {
|
|
233868
|
-
$ZodTemplateLiteral.init(inst, def);
|
|
233869
|
-
ZodType.init(inst, def);
|
|
233870
|
-
inst._zod.processJSONSchema = (ctx, json, params) => templateLiteralProcessor(inst, ctx, json, params);
|
|
233871
|
-
});
|
|
233872
|
-
function templateLiteral(parts, params) {
|
|
233873
|
-
return new ZodTemplateLiteral({
|
|
233874
|
-
type: "template_literal",
|
|
233875
|
-
parts,
|
|
233876
|
-
...exports_util.normalizeParams(params)
|
|
233877
|
-
});
|
|
233878
|
-
}
|
|
233879
|
-
var ZodLazy = /* @__PURE__ */ $constructor("ZodLazy", (inst, def) => {
|
|
233880
|
-
$ZodLazy.init(inst, def);
|
|
233881
|
-
ZodType.init(inst, def);
|
|
233882
|
-
inst._zod.processJSONSchema = (ctx, json, params) => lazyProcessor(inst, ctx, json, params);
|
|
233883
|
-
inst.unwrap = () => inst._zod.def.getter();
|
|
233884
|
-
});
|
|
233885
|
-
function lazy(getter) {
|
|
233886
|
-
return new ZodLazy({
|
|
233887
|
-
type: "lazy",
|
|
233888
|
-
getter
|
|
233889
|
-
});
|
|
233890
|
-
}
|
|
233891
|
-
var ZodPromise = /* @__PURE__ */ $constructor("ZodPromise", (inst, def) => {
|
|
233892
|
-
$ZodPromise.init(inst, def);
|
|
233893
|
-
ZodType.init(inst, def);
|
|
233894
|
-
inst._zod.processJSONSchema = (ctx, json, params) => promiseProcessor(inst, ctx, json, params);
|
|
233895
|
-
inst.unwrap = () => inst._zod.def.innerType;
|
|
233896
|
-
});
|
|
233897
|
-
function promise(innerType) {
|
|
233898
|
-
return new ZodPromise({
|
|
233899
|
-
type: "promise",
|
|
233900
|
-
innerType
|
|
233901
|
-
});
|
|
233594
|
+
}
|
|
233595
|
+
if (schema.nullable === true && ctx.version === "openapi-3.0") {
|
|
233596
|
+
baseSchema = z2.nullable(baseSchema);
|
|
233597
|
+
}
|
|
233598
|
+
if (schema.readOnly === true) {
|
|
233599
|
+
baseSchema = z2.readonly(baseSchema);
|
|
233600
|
+
}
|
|
233601
|
+
const extraMeta = {};
|
|
233602
|
+
const coreMetadataKeys = ["$id", "id", "$comment", "$anchor", "$vocabulary", "$dynamicRef", "$dynamicAnchor"];
|
|
233603
|
+
for (const key of coreMetadataKeys) {
|
|
233604
|
+
if (key in schema) {
|
|
233605
|
+
extraMeta[key] = schema[key];
|
|
233606
|
+
}
|
|
233607
|
+
}
|
|
233608
|
+
const contentMetadataKeys = ["contentEncoding", "contentMediaType", "contentSchema"];
|
|
233609
|
+
for (const key of contentMetadataKeys) {
|
|
233610
|
+
if (key in schema) {
|
|
233611
|
+
extraMeta[key] = schema[key];
|
|
233612
|
+
}
|
|
233613
|
+
}
|
|
233614
|
+
for (const key of Object.keys(schema)) {
|
|
233615
|
+
if (!RECOGNIZED_KEYS.has(key)) {
|
|
233616
|
+
extraMeta[key] = schema[key];
|
|
233617
|
+
}
|
|
233618
|
+
}
|
|
233619
|
+
if (Object.keys(extraMeta).length > 0) {
|
|
233620
|
+
ctx.registry.add(baseSchema, extraMeta);
|
|
233621
|
+
}
|
|
233622
|
+
return baseSchema;
|
|
233902
233623
|
}
|
|
233903
|
-
|
|
233904
|
-
|
|
233905
|
-
|
|
233906
|
-
|
|
233907
|
-
|
|
233908
|
-
|
|
233909
|
-
|
|
233910
|
-
|
|
233911
|
-
|
|
233912
|
-
|
|
233913
|
-
|
|
233624
|
+
function fromJSONSchema(schema, params) {
|
|
233625
|
+
if (typeof schema === "boolean") {
|
|
233626
|
+
return schema ? z2.any() : z2.never();
|
|
233627
|
+
}
|
|
233628
|
+
const version2 = detectVersion(schema, params?.defaultTarget);
|
|
233629
|
+
const defs = schema.$defs || schema.definitions || {};
|
|
233630
|
+
const ctx = {
|
|
233631
|
+
version: version2,
|
|
233632
|
+
defs,
|
|
233633
|
+
refs: new Map,
|
|
233634
|
+
processing: new Set,
|
|
233635
|
+
rootSchema: schema,
|
|
233636
|
+
registry: params?.registry ?? globalRegistry
|
|
233637
|
+
};
|
|
233638
|
+
return convertSchema(schema, ctx);
|
|
233914
233639
|
}
|
|
233915
|
-
|
|
233916
|
-
|
|
233917
|
-
|
|
233918
|
-
|
|
233640
|
+
// ../../node_modules/zod/v4/classic/coerce.js
|
|
233641
|
+
var exports_coerce = {};
|
|
233642
|
+
__export(exports_coerce, {
|
|
233643
|
+
string: () => string3,
|
|
233644
|
+
number: () => number3,
|
|
233645
|
+
date: () => date4,
|
|
233646
|
+
boolean: () => boolean3,
|
|
233647
|
+
bigint: () => bigint3
|
|
233919
233648
|
});
|
|
233920
|
-
function
|
|
233921
|
-
|
|
233922
|
-
check: "custom"
|
|
233923
|
-
});
|
|
233924
|
-
ch._zod.check = fn;
|
|
233925
|
-
return ch;
|
|
233649
|
+
function string3(params) {
|
|
233650
|
+
return _coercedString(ZodString, params);
|
|
233926
233651
|
}
|
|
233927
|
-
function
|
|
233928
|
-
return
|
|
233652
|
+
function number3(params) {
|
|
233653
|
+
return _coercedNumber(ZodNumber, params);
|
|
233929
233654
|
}
|
|
233930
|
-
function
|
|
233931
|
-
return
|
|
233655
|
+
function boolean3(params) {
|
|
233656
|
+
return _coercedBoolean(ZodBoolean, params);
|
|
233932
233657
|
}
|
|
233933
|
-
function
|
|
233934
|
-
return
|
|
233658
|
+
function bigint3(params) {
|
|
233659
|
+
return _coercedBigint(ZodBigInt, params);
|
|
233935
233660
|
}
|
|
233936
|
-
|
|
233937
|
-
|
|
233938
|
-
function _instanceof(cls, params = {}) {
|
|
233939
|
-
const inst = new ZodCustom({
|
|
233940
|
-
type: "custom",
|
|
233941
|
-
check: "custom",
|
|
233942
|
-
fn: (data) => data instanceof cls,
|
|
233943
|
-
abort: true,
|
|
233944
|
-
...exports_util.normalizeParams(params)
|
|
233945
|
-
});
|
|
233946
|
-
inst._zod.bag.Class = cls;
|
|
233947
|
-
inst._zod.check = (payload) => {
|
|
233948
|
-
if (!(payload.value instanceof cls)) {
|
|
233949
|
-
payload.issues.push({
|
|
233950
|
-
code: "invalid_type",
|
|
233951
|
-
expected: cls.name,
|
|
233952
|
-
input: payload.value,
|
|
233953
|
-
inst,
|
|
233954
|
-
path: [...inst._zod.def.path ?? []]
|
|
233955
|
-
});
|
|
233956
|
-
}
|
|
233957
|
-
};
|
|
233958
|
-
return inst;
|
|
233661
|
+
function date4(params) {
|
|
233662
|
+
return _coercedDate(ZodDate, params);
|
|
233959
233663
|
}
|
|
233960
|
-
|
|
233961
|
-
|
|
233962
|
-
|
|
233963
|
-
|
|
233964
|
-
|
|
233965
|
-
|
|
233966
|
-
|
|
233967
|
-
|
|
233968
|
-
|
|
233969
|
-
|
|
233664
|
+
|
|
233665
|
+
// ../../node_modules/zod/v4/classic/external.js
|
|
233666
|
+
config(en_default());
|
|
233667
|
+
// src/core/auth/schema.ts
|
|
233668
|
+
var AuthDataSchema = exports_external.object({
|
|
233669
|
+
accessToken: exports_external.string().min(1, "Token cannot be empty"),
|
|
233670
|
+
refreshToken: exports_external.string().min(1, "Refresh token cannot be empty"),
|
|
233671
|
+
expiresAt: exports_external.number().int().positive("Expires at must be a positive integer"),
|
|
233672
|
+
email: exports_external.email(),
|
|
233673
|
+
name: exports_external.string().min(1, "Name cannot be empty")
|
|
233674
|
+
});
|
|
233675
|
+
var DeviceCodeResponseSchema = exports_external.object({
|
|
233676
|
+
device_code: exports_external.string().min(1, "Device code cannot be empty"),
|
|
233677
|
+
user_code: exports_external.string().min(1, "User code cannot be empty"),
|
|
233678
|
+
verification_uri: exports_external.url("Invalid verification URL"),
|
|
233679
|
+
expires_in: exports_external.number().int().positive("Expires in must be a positive integer"),
|
|
233680
|
+
interval: exports_external.number().int().positive("Interval in must be a positive integer")
|
|
233681
|
+
}).transform((data) => ({
|
|
233682
|
+
deviceCode: data.device_code,
|
|
233683
|
+
userCode: data.user_code,
|
|
233684
|
+
verificationUri: data.verification_uri,
|
|
233685
|
+
expiresIn: data.expires_in,
|
|
233686
|
+
interval: data.interval
|
|
233687
|
+
}));
|
|
233688
|
+
var TokenResponseSchema = exports_external.object({
|
|
233689
|
+
access_token: exports_external.string().min(1, "Token cannot be empty"),
|
|
233690
|
+
token_type: exports_external.string().min(1, "Token type cannot be empty"),
|
|
233691
|
+
expires_in: exports_external.number().int().positive("Expires in must be a positive integer"),
|
|
233692
|
+
refresh_token: exports_external.string().min(1, "Refresh token cannot be empty"),
|
|
233693
|
+
scope: exports_external.string().optional()
|
|
233694
|
+
}).transform((data) => ({
|
|
233695
|
+
accessToken: data.access_token,
|
|
233696
|
+
tokenType: data.token_type,
|
|
233697
|
+
expiresIn: data.expires_in,
|
|
233698
|
+
refreshToken: data.refresh_token,
|
|
233699
|
+
scope: data.scope
|
|
233700
|
+
}));
|
|
233701
|
+
var OAuthErrorSchema = exports_external.object({
|
|
233702
|
+
error: exports_external.string(),
|
|
233703
|
+
error_description: exports_external.string().optional()
|
|
233704
|
+
});
|
|
233705
|
+
var UserInfoSchema = exports_external.object({
|
|
233706
|
+
email: exports_external.email(),
|
|
233707
|
+
name: exports_external.string()
|
|
233708
|
+
});
|
|
233709
|
+
|
|
233710
|
+
// src/core/clients/base44-client.ts
|
|
233711
|
+
import { randomUUID as randomUUID2 } from "node:crypto";
|
|
233712
|
+
|
|
233713
|
+
// ../../node_modules/ky/distribution/errors/HTTPError.js
|
|
233714
|
+
class HTTPError extends Error {
|
|
233715
|
+
response;
|
|
233716
|
+
request;
|
|
233717
|
+
options;
|
|
233718
|
+
constructor(response, request, options) {
|
|
233719
|
+
const code = response.status || response.status === 0 ? response.status : "";
|
|
233720
|
+
const title = response.statusText ?? "";
|
|
233721
|
+
const status = `${code} ${title}`.trim();
|
|
233722
|
+
const reason = status ? `status code ${status}` : "an unknown error";
|
|
233723
|
+
super(`Request failed with ${reason}: ${request.method} ${request.url}`);
|
|
233724
|
+
this.name = "HTTPError";
|
|
233725
|
+
this.response = response;
|
|
233726
|
+
this.request = request;
|
|
233727
|
+
this.options = options;
|
|
233728
|
+
}
|
|
233970
233729
|
}
|
|
233971
|
-
|
|
233972
|
-
|
|
233730
|
+
|
|
233731
|
+
// ../../node_modules/ky/distribution/errors/NonError.js
|
|
233732
|
+
class NonError extends Error {
|
|
233733
|
+
name = "NonError";
|
|
233734
|
+
value;
|
|
233735
|
+
constructor(value) {
|
|
233736
|
+
let message = "Non-error value was thrown";
|
|
233737
|
+
try {
|
|
233738
|
+
if (typeof value === "string") {
|
|
233739
|
+
message = value;
|
|
233740
|
+
} else if (value && typeof value === "object" && "message" in value && typeof value.message === "string") {
|
|
233741
|
+
message = value.message;
|
|
233742
|
+
}
|
|
233743
|
+
} catch {}
|
|
233744
|
+
super(message);
|
|
233745
|
+
this.value = value;
|
|
233746
|
+
}
|
|
233973
233747
|
}
|
|
233974
|
-
|
|
233975
|
-
|
|
233976
|
-
|
|
233977
|
-
|
|
233978
|
-
|
|
233979
|
-
|
|
233980
|
-
|
|
233981
|
-
|
|
233982
|
-
|
|
233983
|
-
|
|
233984
|
-
|
|
233985
|
-
|
|
233986
|
-
|
|
233987
|
-
}
|
|
233988
|
-
function setErrorMap(map2) {
|
|
233989
|
-
config({
|
|
233990
|
-
customError: map2
|
|
233991
|
-
});
|
|
233748
|
+
|
|
233749
|
+
// ../../node_modules/ky/distribution/errors/ForceRetryError.js
|
|
233750
|
+
class ForceRetryError extends Error {
|
|
233751
|
+
name = "ForceRetryError";
|
|
233752
|
+
customDelay;
|
|
233753
|
+
code;
|
|
233754
|
+
customRequest;
|
|
233755
|
+
constructor(options) {
|
|
233756
|
+
const cause = options?.cause ? options.cause instanceof Error ? options.cause : new NonError(options.cause) : undefined;
|
|
233757
|
+
super(options?.code ? `Forced retry: ${options.code}` : "Forced retry", cause ? { cause } : undefined);
|
|
233758
|
+
this.customDelay = options?.delay;
|
|
233759
|
+
this.code = options?.code;
|
|
233760
|
+
this.customRequest = options?.request;
|
|
233761
|
+
}
|
|
233992
233762
|
}
|
|
233993
|
-
|
|
233994
|
-
|
|
233763
|
+
|
|
233764
|
+
// ../../node_modules/ky/distribution/core/constants.js
|
|
233765
|
+
var supportsRequestStreams = (() => {
|
|
233766
|
+
let duplexAccessed = false;
|
|
233767
|
+
let hasContentType = false;
|
|
233768
|
+
const supportsReadableStream = typeof globalThis.ReadableStream === "function";
|
|
233769
|
+
const supportsRequest = typeof globalThis.Request === "function";
|
|
233770
|
+
if (supportsReadableStream && supportsRequest) {
|
|
233771
|
+
try {
|
|
233772
|
+
hasContentType = new globalThis.Request("https://empty.invalid", {
|
|
233773
|
+
body: new globalThis.ReadableStream,
|
|
233774
|
+
method: "POST",
|
|
233775
|
+
get duplex() {
|
|
233776
|
+
duplexAccessed = true;
|
|
233777
|
+
return "half";
|
|
233778
|
+
}
|
|
233779
|
+
}).headers.has("Content-Type");
|
|
233780
|
+
} catch (error48) {
|
|
233781
|
+
if (error48 instanceof Error && error48.message === "unsupported BodyInit type") {
|
|
233782
|
+
return false;
|
|
233783
|
+
}
|
|
233784
|
+
throw error48;
|
|
233785
|
+
}
|
|
233786
|
+
}
|
|
233787
|
+
return duplexAccessed && !hasContentType;
|
|
233788
|
+
})();
|
|
233789
|
+
var supportsAbortController = typeof globalThis.AbortController === "function";
|
|
233790
|
+
var supportsAbortSignal = typeof globalThis.AbortSignal === "function" && typeof globalThis.AbortSignal.any === "function";
|
|
233791
|
+
var supportsResponseStreams = typeof globalThis.ReadableStream === "function";
|
|
233792
|
+
var supportsFormData = typeof globalThis.FormData === "function";
|
|
233793
|
+
var requestMethods = ["get", "post", "put", "patch", "head", "delete"];
|
|
233794
|
+
var validate = () => {
|
|
233795
|
+
return;
|
|
233796
|
+
};
|
|
233797
|
+
validate();
|
|
233798
|
+
var responseTypes = {
|
|
233799
|
+
json: "application/json",
|
|
233800
|
+
text: "text/*",
|
|
233801
|
+
formData: "multipart/form-data",
|
|
233802
|
+
arrayBuffer: "*/*",
|
|
233803
|
+
blob: "*/*",
|
|
233804
|
+
bytes: "*/*"
|
|
233805
|
+
};
|
|
233806
|
+
var maxSafeTimeout = 2147483647;
|
|
233807
|
+
var usualFormBoundarySize = new TextEncoder().encode("------WebKitFormBoundaryaxpyiPgbbPti10Rw").length;
|
|
233808
|
+
var stop = Symbol("stop");
|
|
233809
|
+
|
|
233810
|
+
class RetryMarker {
|
|
233811
|
+
options;
|
|
233812
|
+
constructor(options) {
|
|
233813
|
+
this.options = options;
|
|
233814
|
+
}
|
|
233995
233815
|
}
|
|
233996
|
-
var
|
|
233997
|
-
|
|
233998
|
-
|
|
233999
|
-
|
|
234000
|
-
|
|
234001
|
-
|
|
234002
|
-
|
|
233816
|
+
var retry = (options) => new RetryMarker(options);
|
|
233817
|
+
var kyOptionKeys = {
|
|
233818
|
+
json: true,
|
|
233819
|
+
parseJson: true,
|
|
233820
|
+
stringifyJson: true,
|
|
233821
|
+
searchParams: true,
|
|
233822
|
+
prefixUrl: true,
|
|
233823
|
+
retry: true,
|
|
233824
|
+
timeout: true,
|
|
233825
|
+
hooks: true,
|
|
233826
|
+
throwHttpErrors: true,
|
|
233827
|
+
onDownloadProgress: true,
|
|
233828
|
+
onUploadProgress: true,
|
|
233829
|
+
fetch: true,
|
|
233830
|
+
context: true
|
|
234003
233831
|
};
|
|
234004
|
-
var
|
|
234005
|
-
|
|
234006
|
-
|
|
234007
|
-
|
|
234008
|
-
|
|
234009
|
-
|
|
234010
|
-
|
|
234011
|
-
|
|
234012
|
-
|
|
234013
|
-
|
|
234014
|
-
|
|
234015
|
-
|
|
234016
|
-
|
|
234017
|
-
|
|
234018
|
-
|
|
234019
|
-
|
|
234020
|
-
|
|
234021
|
-
|
|
234022
|
-
|
|
234023
|
-
|
|
234024
|
-
|
|
234025
|
-
|
|
234026
|
-
|
|
234027
|
-
|
|
234028
|
-
"minProperties",
|
|
234029
|
-
"maxProperties",
|
|
234030
|
-
"items",
|
|
234031
|
-
"prefixItems",
|
|
234032
|
-
"additionalItems",
|
|
234033
|
-
"minItems",
|
|
234034
|
-
"maxItems",
|
|
234035
|
-
"uniqueItems",
|
|
234036
|
-
"contains",
|
|
234037
|
-
"minContains",
|
|
234038
|
-
"maxContains",
|
|
234039
|
-
"minLength",
|
|
234040
|
-
"maxLength",
|
|
234041
|
-
"pattern",
|
|
234042
|
-
"format",
|
|
234043
|
-
"minimum",
|
|
234044
|
-
"maximum",
|
|
234045
|
-
"exclusiveMinimum",
|
|
234046
|
-
"exclusiveMaximum",
|
|
234047
|
-
"multipleOf",
|
|
234048
|
-
"description",
|
|
234049
|
-
"default",
|
|
234050
|
-
"contentEncoding",
|
|
234051
|
-
"contentMediaType",
|
|
234052
|
-
"contentSchema",
|
|
234053
|
-
"unevaluatedItems",
|
|
234054
|
-
"unevaluatedProperties",
|
|
234055
|
-
"if",
|
|
234056
|
-
"then",
|
|
234057
|
-
"else",
|
|
234058
|
-
"dependentSchemas",
|
|
234059
|
-
"dependentRequired",
|
|
234060
|
-
"nullable",
|
|
234061
|
-
"readOnly"
|
|
234062
|
-
]);
|
|
234063
|
-
function detectVersion(schema, defaultTarget) {
|
|
234064
|
-
const $schema = schema.$schema;
|
|
234065
|
-
if ($schema === "https://json-schema.org/draft/2020-12/schema") {
|
|
234066
|
-
return "draft-2020-12";
|
|
233832
|
+
var vendorSpecificOptions = {
|
|
233833
|
+
next: true
|
|
233834
|
+
};
|
|
233835
|
+
var requestOptionsRegistry = {
|
|
233836
|
+
method: true,
|
|
233837
|
+
headers: true,
|
|
233838
|
+
body: true,
|
|
233839
|
+
mode: true,
|
|
233840
|
+
credentials: true,
|
|
233841
|
+
cache: true,
|
|
233842
|
+
redirect: true,
|
|
233843
|
+
referrer: true,
|
|
233844
|
+
referrerPolicy: true,
|
|
233845
|
+
integrity: true,
|
|
233846
|
+
keepalive: true,
|
|
233847
|
+
signal: true,
|
|
233848
|
+
window: true,
|
|
233849
|
+
duplex: true
|
|
233850
|
+
};
|
|
233851
|
+
|
|
233852
|
+
// ../../node_modules/ky/distribution/utils/body.js
|
|
233853
|
+
var getBodySize = (body) => {
|
|
233854
|
+
if (!body) {
|
|
233855
|
+
return 0;
|
|
234067
233856
|
}
|
|
234068
|
-
if (
|
|
234069
|
-
|
|
233857
|
+
if (body instanceof FormData) {
|
|
233858
|
+
let size = 0;
|
|
233859
|
+
for (const [key, value] of body) {
|
|
233860
|
+
size += usualFormBoundarySize;
|
|
233861
|
+
size += new TextEncoder().encode(`Content-Disposition: form-data; name="${key}"`).length;
|
|
233862
|
+
size += typeof value === "string" ? new TextEncoder().encode(value).length : value.size;
|
|
233863
|
+
}
|
|
233864
|
+
return size;
|
|
234070
233865
|
}
|
|
234071
|
-
if (
|
|
234072
|
-
return
|
|
233866
|
+
if (body instanceof Blob) {
|
|
233867
|
+
return body.size;
|
|
234073
233868
|
}
|
|
234074
|
-
|
|
234075
|
-
|
|
234076
|
-
function resolveRef(ref, ctx) {
|
|
234077
|
-
if (!ref.startsWith("#")) {
|
|
234078
|
-
throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
|
|
233869
|
+
if (body instanceof ArrayBuffer) {
|
|
233870
|
+
return body.byteLength;
|
|
234079
233871
|
}
|
|
234080
|
-
|
|
234081
|
-
|
|
234082
|
-
return ctx.rootSchema;
|
|
233872
|
+
if (typeof body === "string") {
|
|
233873
|
+
return new TextEncoder().encode(body).length;
|
|
234083
233874
|
}
|
|
234084
|
-
|
|
234085
|
-
|
|
234086
|
-
|
|
234087
|
-
|
|
234088
|
-
|
|
233875
|
+
if (body instanceof URLSearchParams) {
|
|
233876
|
+
return new TextEncoder().encode(body.toString()).length;
|
|
233877
|
+
}
|
|
233878
|
+
if ("byteLength" in body) {
|
|
233879
|
+
return body.byteLength;
|
|
233880
|
+
}
|
|
233881
|
+
if (typeof body === "object" && body !== null) {
|
|
233882
|
+
try {
|
|
233883
|
+
const jsonString = JSON.stringify(body);
|
|
233884
|
+
return new TextEncoder().encode(jsonString).length;
|
|
233885
|
+
} catch {
|
|
233886
|
+
return 0;
|
|
233887
|
+
}
|
|
233888
|
+
}
|
|
233889
|
+
return 0;
|
|
233890
|
+
};
|
|
233891
|
+
var withProgress = (stream, totalBytes, onProgress) => {
|
|
233892
|
+
let previousChunk;
|
|
233893
|
+
let transferredBytes = 0;
|
|
233894
|
+
return stream.pipeThrough(new TransformStream({
|
|
233895
|
+
transform(currentChunk, controller) {
|
|
233896
|
+
controller.enqueue(currentChunk);
|
|
233897
|
+
if (previousChunk) {
|
|
233898
|
+
transferredBytes += previousChunk.byteLength;
|
|
233899
|
+
let percent = totalBytes === 0 ? 0 : transferredBytes / totalBytes;
|
|
233900
|
+
if (percent >= 1) {
|
|
233901
|
+
percent = 1 - Number.EPSILON;
|
|
233902
|
+
}
|
|
233903
|
+
onProgress?.({ percent, totalBytes: Math.max(totalBytes, transferredBytes), transferredBytes }, previousChunk);
|
|
233904
|
+
}
|
|
233905
|
+
previousChunk = currentChunk;
|
|
233906
|
+
},
|
|
233907
|
+
flush() {
|
|
233908
|
+
if (previousChunk) {
|
|
233909
|
+
transferredBytes += previousChunk.byteLength;
|
|
233910
|
+
onProgress?.({ percent: 1, totalBytes: Math.max(totalBytes, transferredBytes), transferredBytes }, previousChunk);
|
|
233911
|
+
}
|
|
233912
|
+
}
|
|
233913
|
+
}));
|
|
233914
|
+
};
|
|
233915
|
+
var streamResponse = (response, onDownloadProgress) => {
|
|
233916
|
+
if (!response.body) {
|
|
233917
|
+
return response;
|
|
233918
|
+
}
|
|
233919
|
+
if (response.status === 204) {
|
|
233920
|
+
return new Response(null, {
|
|
233921
|
+
status: response.status,
|
|
233922
|
+
statusText: response.statusText,
|
|
233923
|
+
headers: response.headers
|
|
233924
|
+
});
|
|
233925
|
+
}
|
|
233926
|
+
const totalBytes = Math.max(0, Number(response.headers.get("content-length")) || 0);
|
|
233927
|
+
return new Response(withProgress(response.body, totalBytes, onDownloadProgress), {
|
|
233928
|
+
status: response.status,
|
|
233929
|
+
statusText: response.statusText,
|
|
233930
|
+
headers: response.headers
|
|
233931
|
+
});
|
|
233932
|
+
};
|
|
233933
|
+
var streamRequest = (request, onUploadProgress, originalBody) => {
|
|
233934
|
+
if (!request.body) {
|
|
233935
|
+
return request;
|
|
233936
|
+
}
|
|
233937
|
+
const totalBytes = getBodySize(originalBody ?? request.body);
|
|
233938
|
+
return new Request(request, {
|
|
233939
|
+
duplex: "half",
|
|
233940
|
+
body: withProgress(request.body, totalBytes, onUploadProgress)
|
|
233941
|
+
});
|
|
233942
|
+
};
|
|
233943
|
+
|
|
233944
|
+
// ../../node_modules/ky/distribution/utils/is.js
|
|
233945
|
+
var isObject2 = (value) => value !== null && typeof value === "object";
|
|
233946
|
+
|
|
233947
|
+
// ../../node_modules/ky/distribution/utils/merge.js
|
|
233948
|
+
var validateAndMerge = (...sources) => {
|
|
233949
|
+
for (const source of sources) {
|
|
233950
|
+
if ((!isObject2(source) || Array.isArray(source)) && source !== undefined) {
|
|
233951
|
+
throw new TypeError("The `options` argument must be an object");
|
|
233952
|
+
}
|
|
233953
|
+
}
|
|
233954
|
+
return deepMerge({}, ...sources);
|
|
233955
|
+
};
|
|
233956
|
+
var mergeHeaders = (source1 = {}, source2 = {}) => {
|
|
233957
|
+
const result = new globalThis.Headers(source1);
|
|
233958
|
+
const isHeadersInstance = source2 instanceof globalThis.Headers;
|
|
233959
|
+
const source = new globalThis.Headers(source2);
|
|
233960
|
+
for (const [key, value] of source.entries()) {
|
|
233961
|
+
if (isHeadersInstance && value === "undefined" || value === undefined) {
|
|
233962
|
+
result.delete(key);
|
|
233963
|
+
} else {
|
|
233964
|
+
result.set(key, value);
|
|
233965
|
+
}
|
|
233966
|
+
}
|
|
233967
|
+
return result;
|
|
233968
|
+
};
|
|
233969
|
+
function newHookValue(original, incoming, property) {
|
|
233970
|
+
return Object.hasOwn(incoming, property) && incoming[property] === undefined ? [] : deepMerge(original[property] ?? [], incoming[property] ?? []);
|
|
233971
|
+
}
|
|
233972
|
+
var mergeHooks = (original = {}, incoming = {}) => ({
|
|
233973
|
+
beforeRequest: newHookValue(original, incoming, "beforeRequest"),
|
|
233974
|
+
beforeRetry: newHookValue(original, incoming, "beforeRetry"),
|
|
233975
|
+
afterResponse: newHookValue(original, incoming, "afterResponse"),
|
|
233976
|
+
beforeError: newHookValue(original, incoming, "beforeError")
|
|
233977
|
+
});
|
|
233978
|
+
var appendSearchParameters = (target, source) => {
|
|
233979
|
+
const result = new URLSearchParams;
|
|
233980
|
+
for (const input of [target, source]) {
|
|
233981
|
+
if (input === undefined) {
|
|
233982
|
+
continue;
|
|
233983
|
+
}
|
|
233984
|
+
if (input instanceof URLSearchParams) {
|
|
233985
|
+
for (const [key, value] of input.entries()) {
|
|
233986
|
+
result.append(key, value);
|
|
233987
|
+
}
|
|
233988
|
+
} else if (Array.isArray(input)) {
|
|
233989
|
+
for (const pair of input) {
|
|
233990
|
+
if (!Array.isArray(pair) || pair.length !== 2) {
|
|
233991
|
+
throw new TypeError("Array search parameters must be provided in [[key, value], ...] format");
|
|
233992
|
+
}
|
|
233993
|
+
result.append(String(pair[0]), String(pair[1]));
|
|
233994
|
+
}
|
|
233995
|
+
} else if (isObject2(input)) {
|
|
233996
|
+
for (const [key, value] of Object.entries(input)) {
|
|
233997
|
+
if (value !== undefined) {
|
|
233998
|
+
result.append(key, String(value));
|
|
233999
|
+
}
|
|
234000
|
+
}
|
|
234001
|
+
} else {
|
|
234002
|
+
const parameters = new URLSearchParams(input);
|
|
234003
|
+
for (const [key, value] of parameters.entries()) {
|
|
234004
|
+
result.append(key, value);
|
|
234005
|
+
}
|
|
234006
|
+
}
|
|
234007
|
+
}
|
|
234008
|
+
return result;
|
|
234009
|
+
};
|
|
234010
|
+
var deepMerge = (...sources) => {
|
|
234011
|
+
let returnValue = {};
|
|
234012
|
+
let headers = {};
|
|
234013
|
+
let hooks = {};
|
|
234014
|
+
let searchParameters;
|
|
234015
|
+
const signals = [];
|
|
234016
|
+
for (const source of sources) {
|
|
234017
|
+
if (Array.isArray(source)) {
|
|
234018
|
+
if (!Array.isArray(returnValue)) {
|
|
234019
|
+
returnValue = [];
|
|
234020
|
+
}
|
|
234021
|
+
returnValue = [...returnValue, ...source];
|
|
234022
|
+
} else if (isObject2(source)) {
|
|
234023
|
+
for (let [key, value] of Object.entries(source)) {
|
|
234024
|
+
if (key === "signal" && value instanceof globalThis.AbortSignal) {
|
|
234025
|
+
signals.push(value);
|
|
234026
|
+
continue;
|
|
234027
|
+
}
|
|
234028
|
+
if (key === "context") {
|
|
234029
|
+
if (value !== undefined && value !== null && (!isObject2(value) || Array.isArray(value))) {
|
|
234030
|
+
throw new TypeError("The `context` option must be an object");
|
|
234031
|
+
}
|
|
234032
|
+
returnValue = {
|
|
234033
|
+
...returnValue,
|
|
234034
|
+
context: value === undefined || value === null ? {} : { ...returnValue.context, ...value }
|
|
234035
|
+
};
|
|
234036
|
+
continue;
|
|
234037
|
+
}
|
|
234038
|
+
if (key === "searchParams") {
|
|
234039
|
+
if (value === undefined || value === null) {
|
|
234040
|
+
searchParameters = undefined;
|
|
234041
|
+
} else {
|
|
234042
|
+
searchParameters = searchParameters === undefined ? value : appendSearchParameters(searchParameters, value);
|
|
234043
|
+
}
|
|
234044
|
+
continue;
|
|
234045
|
+
}
|
|
234046
|
+
if (isObject2(value) && key in returnValue) {
|
|
234047
|
+
value = deepMerge(returnValue[key], value);
|
|
234048
|
+
}
|
|
234049
|
+
returnValue = { ...returnValue, [key]: value };
|
|
234050
|
+
}
|
|
234051
|
+
if (isObject2(source.hooks)) {
|
|
234052
|
+
hooks = mergeHooks(hooks, source.hooks);
|
|
234053
|
+
returnValue.hooks = hooks;
|
|
234054
|
+
}
|
|
234055
|
+
if (isObject2(source.headers)) {
|
|
234056
|
+
headers = mergeHeaders(headers, source.headers);
|
|
234057
|
+
returnValue.headers = headers;
|
|
234058
|
+
}
|
|
234089
234059
|
}
|
|
234090
|
-
return ctx.defs[key];
|
|
234091
234060
|
}
|
|
234092
|
-
|
|
234093
|
-
|
|
234094
|
-
function convertBaseSchema(schema, ctx) {
|
|
234095
|
-
if (schema.not !== undefined) {
|
|
234096
|
-
if (typeof schema.not === "object" && Object.keys(schema.not).length === 0) {
|
|
234097
|
-
return z2.never();
|
|
234098
|
-
}
|
|
234099
|
-
throw new Error("not is not supported in Zod (except { not: {} } for never)");
|
|
234061
|
+
if (searchParameters !== undefined) {
|
|
234062
|
+
returnValue.searchParams = searchParameters;
|
|
234100
234063
|
}
|
|
234101
|
-
if (
|
|
234102
|
-
|
|
234064
|
+
if (signals.length > 0) {
|
|
234065
|
+
if (signals.length === 1) {
|
|
234066
|
+
returnValue.signal = signals[0];
|
|
234067
|
+
} else if (supportsAbortSignal) {
|
|
234068
|
+
returnValue.signal = AbortSignal.any(signals);
|
|
234069
|
+
} else {
|
|
234070
|
+
returnValue.signal = signals.at(-1);
|
|
234071
|
+
}
|
|
234103
234072
|
}
|
|
234104
|
-
|
|
234105
|
-
|
|
234073
|
+
return returnValue;
|
|
234074
|
+
};
|
|
234075
|
+
|
|
234076
|
+
// ../../node_modules/ky/distribution/utils/normalize.js
|
|
234077
|
+
var normalizeRequestMethod = (input) => requestMethods.includes(input) ? input.toUpperCase() : input;
|
|
234078
|
+
var retryMethods = ["get", "put", "head", "delete", "options", "trace"];
|
|
234079
|
+
var retryStatusCodes = [408, 413, 429, 500, 502, 503, 504];
|
|
234080
|
+
var retryAfterStatusCodes = [413, 429, 503];
|
|
234081
|
+
var defaultRetryOptions = {
|
|
234082
|
+
limit: 2,
|
|
234083
|
+
methods: retryMethods,
|
|
234084
|
+
statusCodes: retryStatusCodes,
|
|
234085
|
+
afterStatusCodes: retryAfterStatusCodes,
|
|
234086
|
+
maxRetryAfter: Number.POSITIVE_INFINITY,
|
|
234087
|
+
backoffLimit: Number.POSITIVE_INFINITY,
|
|
234088
|
+
delay: (attemptCount) => 0.3 * 2 ** (attemptCount - 1) * 1000,
|
|
234089
|
+
jitter: undefined,
|
|
234090
|
+
retryOnTimeout: false
|
|
234091
|
+
};
|
|
234092
|
+
var normalizeRetryOptions = (retry2 = {}) => {
|
|
234093
|
+
if (typeof retry2 === "number") {
|
|
234094
|
+
return {
|
|
234095
|
+
...defaultRetryOptions,
|
|
234096
|
+
limit: retry2
|
|
234097
|
+
};
|
|
234106
234098
|
}
|
|
234107
|
-
if (
|
|
234108
|
-
throw new Error("
|
|
234099
|
+
if (retry2.methods && !Array.isArray(retry2.methods)) {
|
|
234100
|
+
throw new Error("retry.methods must be an array");
|
|
234109
234101
|
}
|
|
234110
|
-
|
|
234111
|
-
|
|
234102
|
+
retry2.methods &&= retry2.methods.map((method) => method.toLowerCase());
|
|
234103
|
+
if (retry2.statusCodes && !Array.isArray(retry2.statusCodes)) {
|
|
234104
|
+
throw new Error("retry.statusCodes must be an array");
|
|
234112
234105
|
}
|
|
234113
|
-
|
|
234114
|
-
|
|
234115
|
-
|
|
234116
|
-
|
|
234117
|
-
|
|
234118
|
-
|
|
234119
|
-
|
|
234120
|
-
|
|
234121
|
-
|
|
234122
|
-
|
|
234123
|
-
|
|
234124
|
-
|
|
234125
|
-
|
|
234126
|
-
|
|
234127
|
-
const resolved = resolveRef(refPath, ctx);
|
|
234128
|
-
const zodSchema2 = convertSchema(resolved, ctx);
|
|
234129
|
-
ctx.refs.set(refPath, zodSchema2);
|
|
234130
|
-
ctx.processing.delete(refPath);
|
|
234131
|
-
return zodSchema2;
|
|
234106
|
+
const normalizedRetry = Object.fromEntries(Object.entries(retry2).filter(([, value]) => value !== undefined));
|
|
234107
|
+
return {
|
|
234108
|
+
...defaultRetryOptions,
|
|
234109
|
+
...normalizedRetry
|
|
234110
|
+
};
|
|
234111
|
+
};
|
|
234112
|
+
|
|
234113
|
+
// ../../node_modules/ky/distribution/errors/TimeoutError.js
|
|
234114
|
+
class TimeoutError2 extends Error {
|
|
234115
|
+
request;
|
|
234116
|
+
constructor(request) {
|
|
234117
|
+
super(`Request timed out: ${request.method} ${request.url}`);
|
|
234118
|
+
this.name = "TimeoutError";
|
|
234119
|
+
this.request = request;
|
|
234132
234120
|
}
|
|
234133
|
-
|
|
234134
|
-
|
|
234135
|
-
|
|
234136
|
-
|
|
234137
|
-
|
|
234138
|
-
|
|
234139
|
-
|
|
234121
|
+
}
|
|
234122
|
+
|
|
234123
|
+
// ../../node_modules/ky/distribution/utils/timeout.js
|
|
234124
|
+
async function timeout(request, init, abortController, options) {
|
|
234125
|
+
return new Promise((resolve, reject) => {
|
|
234126
|
+
const timeoutId = setTimeout(() => {
|
|
234127
|
+
if (abortController) {
|
|
234128
|
+
abortController.abort();
|
|
234129
|
+
}
|
|
234130
|
+
reject(new TimeoutError2(request));
|
|
234131
|
+
}, options.timeout);
|
|
234132
|
+
options.fetch(request, init).then(resolve).catch(reject).then(() => {
|
|
234133
|
+
clearTimeout(timeoutId);
|
|
234134
|
+
});
|
|
234135
|
+
});
|
|
234136
|
+
}
|
|
234137
|
+
|
|
234138
|
+
// ../../node_modules/ky/distribution/utils/delay.js
|
|
234139
|
+
async function delay(ms, { signal }) {
|
|
234140
|
+
return new Promise((resolve, reject) => {
|
|
234141
|
+
if (signal) {
|
|
234142
|
+
signal.throwIfAborted();
|
|
234143
|
+
signal.addEventListener("abort", abortHandler, { once: true });
|
|
234140
234144
|
}
|
|
234141
|
-
|
|
234142
|
-
|
|
234145
|
+
function abortHandler() {
|
|
234146
|
+
clearTimeout(timeoutId);
|
|
234147
|
+
reject(signal.reason);
|
|
234143
234148
|
}
|
|
234144
|
-
|
|
234145
|
-
|
|
234149
|
+
const timeoutId = setTimeout(() => {
|
|
234150
|
+
signal?.removeEventListener("abort", abortHandler);
|
|
234151
|
+
resolve();
|
|
234152
|
+
}, ms);
|
|
234153
|
+
});
|
|
234154
|
+
}
|
|
234155
|
+
|
|
234156
|
+
// ../../node_modules/ky/distribution/utils/options.js
|
|
234157
|
+
var findUnknownOptions = (request, options) => {
|
|
234158
|
+
const unknownOptions = {};
|
|
234159
|
+
for (const key in options) {
|
|
234160
|
+
if (!Object.hasOwn(options, key)) {
|
|
234161
|
+
continue;
|
|
234146
234162
|
}
|
|
234147
|
-
|
|
234148
|
-
|
|
234149
|
-
return literalSchemas[0];
|
|
234163
|
+
if (!(key in requestOptionsRegistry) && !(key in kyOptionKeys) && (!(key in request) || (key in vendorSpecificOptions))) {
|
|
234164
|
+
unknownOptions[key] = options[key];
|
|
234150
234165
|
}
|
|
234151
|
-
return z2.union([literalSchemas[0], literalSchemas[1], ...literalSchemas.slice(2)]);
|
|
234152
234166
|
}
|
|
234153
|
-
|
|
234154
|
-
|
|
234167
|
+
return unknownOptions;
|
|
234168
|
+
};
|
|
234169
|
+
var hasSearchParameters = (search) => {
|
|
234170
|
+
if (search === undefined) {
|
|
234171
|
+
return false;
|
|
234155
234172
|
}
|
|
234156
|
-
|
|
234157
|
-
|
|
234158
|
-
const typeSchemas = type.map((t) => {
|
|
234159
|
-
const typeSchema = { ...schema, type: t };
|
|
234160
|
-
return convertBaseSchema(typeSchema, ctx);
|
|
234161
|
-
});
|
|
234162
|
-
if (typeSchemas.length === 0) {
|
|
234163
|
-
return z2.never();
|
|
234164
|
-
}
|
|
234165
|
-
if (typeSchemas.length === 1) {
|
|
234166
|
-
return typeSchemas[0];
|
|
234167
|
-
}
|
|
234168
|
-
return z2.union(typeSchemas);
|
|
234173
|
+
if (Array.isArray(search)) {
|
|
234174
|
+
return search.length > 0;
|
|
234169
234175
|
}
|
|
234170
|
-
if (
|
|
234171
|
-
return
|
|
234176
|
+
if (search instanceof URLSearchParams) {
|
|
234177
|
+
return search.size > 0;
|
|
234172
234178
|
}
|
|
234173
|
-
|
|
234174
|
-
|
|
234175
|
-
|
|
234176
|
-
|
|
234177
|
-
|
|
234178
|
-
|
|
234179
|
-
|
|
234180
|
-
|
|
234181
|
-
|
|
234182
|
-
|
|
234183
|
-
|
|
234184
|
-
|
|
234185
|
-
|
|
234186
|
-
|
|
234187
|
-
|
|
234188
|
-
|
|
234189
|
-
|
|
234190
|
-
|
|
234191
|
-
|
|
234192
|
-
|
|
234193
|
-
|
|
234194
|
-
|
|
234195
|
-
|
|
234196
|
-
|
|
234197
|
-
|
|
234198
|
-
|
|
234199
|
-
|
|
234200
|
-
|
|
234201
|
-
|
|
234202
|
-
|
|
234203
|
-
|
|
234204
|
-
|
|
234205
|
-
}
|
|
234206
|
-
|
|
234207
|
-
|
|
234208
|
-
|
|
234209
|
-
}
|
|
234210
|
-
|
|
234211
|
-
|
|
234212
|
-
|
|
234213
|
-
|
|
234214
|
-
|
|
234215
|
-
|
|
234216
|
-
|
|
234217
|
-
|
|
234218
|
-
|
|
234219
|
-
|
|
234220
|
-
|
|
234221
|
-
} else if (format === "xid") {
|
|
234222
|
-
stringSchema = stringSchema.check(z2.xid());
|
|
234223
|
-
} else if (format === "ksuid") {
|
|
234224
|
-
stringSchema = stringSchema.check(z2.ksuid());
|
|
234179
|
+
if (typeof search === "object") {
|
|
234180
|
+
return Object.keys(search).length > 0;
|
|
234181
|
+
}
|
|
234182
|
+
if (typeof search === "string") {
|
|
234183
|
+
return search.trim().length > 0;
|
|
234184
|
+
}
|
|
234185
|
+
return Boolean(search);
|
|
234186
|
+
};
|
|
234187
|
+
|
|
234188
|
+
// ../../node_modules/ky/distribution/utils/type-guards.js
|
|
234189
|
+
function isHTTPError(error48) {
|
|
234190
|
+
return error48 instanceof HTTPError || error48?.name === HTTPError.name;
|
|
234191
|
+
}
|
|
234192
|
+
function isTimeoutError(error48) {
|
|
234193
|
+
return error48 instanceof TimeoutError2 || error48?.name === TimeoutError2.name;
|
|
234194
|
+
}
|
|
234195
|
+
|
|
234196
|
+
// ../../node_modules/ky/distribution/core/Ky.js
|
|
234197
|
+
class Ky {
|
|
234198
|
+
static create(input, options) {
|
|
234199
|
+
const ky = new Ky(input, options);
|
|
234200
|
+
const function_ = async () => {
|
|
234201
|
+
if (typeof ky.#options.timeout === "number" && ky.#options.timeout > maxSafeTimeout) {
|
|
234202
|
+
throw new RangeError(`The \`timeout\` option cannot be greater than ${maxSafeTimeout}`);
|
|
234203
|
+
}
|
|
234204
|
+
await Promise.resolve();
|
|
234205
|
+
let response = await ky.#fetch();
|
|
234206
|
+
for (const hook of ky.#options.hooks.afterResponse) {
|
|
234207
|
+
const clonedResponse = ky.#decorateResponse(response.clone());
|
|
234208
|
+
let modifiedResponse;
|
|
234209
|
+
try {
|
|
234210
|
+
modifiedResponse = await hook(ky.request, ky.#getNormalizedOptions(), clonedResponse, { retryCount: ky.#retryCount });
|
|
234211
|
+
} catch (error48) {
|
|
234212
|
+
ky.#cancelResponseBody(clonedResponse);
|
|
234213
|
+
ky.#cancelResponseBody(response);
|
|
234214
|
+
throw error48;
|
|
234215
|
+
}
|
|
234216
|
+
if (modifiedResponse instanceof RetryMarker) {
|
|
234217
|
+
ky.#cancelResponseBody(clonedResponse);
|
|
234218
|
+
ky.#cancelResponseBody(response);
|
|
234219
|
+
throw new ForceRetryError(modifiedResponse.options);
|
|
234220
|
+
}
|
|
234221
|
+
const nextResponse = modifiedResponse instanceof globalThis.Response ? modifiedResponse : response;
|
|
234222
|
+
if (clonedResponse !== nextResponse) {
|
|
234223
|
+
ky.#cancelResponseBody(clonedResponse);
|
|
234224
|
+
}
|
|
234225
|
+
if (response !== nextResponse) {
|
|
234226
|
+
ky.#cancelResponseBody(response);
|
|
234225
234227
|
}
|
|
234228
|
+
response = nextResponse;
|
|
234226
234229
|
}
|
|
234227
|
-
|
|
234228
|
-
|
|
234230
|
+
ky.#decorateResponse(response);
|
|
234231
|
+
if (!response.ok && (typeof ky.#options.throwHttpErrors === "function" ? ky.#options.throwHttpErrors(response.status) : ky.#options.throwHttpErrors)) {
|
|
234232
|
+
let error48 = new HTTPError(response, ky.request, ky.#getNormalizedOptions());
|
|
234233
|
+
for (const hook of ky.#options.hooks.beforeError) {
|
|
234234
|
+
error48 = await hook(error48, { retryCount: ky.#retryCount });
|
|
234235
|
+
}
|
|
234236
|
+
throw error48;
|
|
234229
234237
|
}
|
|
234230
|
-
if (
|
|
234231
|
-
|
|
234238
|
+
if (ky.#options.onDownloadProgress) {
|
|
234239
|
+
if (typeof ky.#options.onDownloadProgress !== "function") {
|
|
234240
|
+
throw new TypeError("The `onDownloadProgress` option must be a function");
|
|
234241
|
+
}
|
|
234242
|
+
if (!supportsResponseStreams) {
|
|
234243
|
+
throw new Error("Streams are not supported in your environment. `ReadableStream` is missing.");
|
|
234244
|
+
}
|
|
234245
|
+
const progressResponse = response.clone();
|
|
234246
|
+
ky.#cancelResponseBody(response);
|
|
234247
|
+
return streamResponse(progressResponse, ky.#options.onDownloadProgress);
|
|
234232
234248
|
}
|
|
234233
|
-
|
|
234234
|
-
|
|
234249
|
+
return response;
|
|
234250
|
+
};
|
|
234251
|
+
const result = ky.#retry(function_).finally(() => {
|
|
234252
|
+
const originalRequest = ky.#originalRequest;
|
|
234253
|
+
ky.#cancelBody(originalRequest?.body ?? undefined);
|
|
234254
|
+
ky.#cancelBody(ky.request.body ?? undefined);
|
|
234255
|
+
});
|
|
234256
|
+
for (const [type, mimeType] of Object.entries(responseTypes)) {
|
|
234257
|
+
if (type === "bytes" && typeof globalThis.Response?.prototype?.bytes !== "function") {
|
|
234258
|
+
continue;
|
|
234235
234259
|
}
|
|
234236
|
-
|
|
234237
|
-
|
|
234260
|
+
result[type] = async () => {
|
|
234261
|
+
ky.request.headers.set("accept", ky.request.headers.get("accept") || mimeType);
|
|
234262
|
+
const response = await result;
|
|
234263
|
+
if (type === "json") {
|
|
234264
|
+
if (response.status === 204) {
|
|
234265
|
+
return "";
|
|
234266
|
+
}
|
|
234267
|
+
const text = await response.text();
|
|
234268
|
+
if (text === "") {
|
|
234269
|
+
return "";
|
|
234270
|
+
}
|
|
234271
|
+
if (options.parseJson) {
|
|
234272
|
+
return options.parseJson(text);
|
|
234273
|
+
}
|
|
234274
|
+
return JSON.parse(text);
|
|
234275
|
+
}
|
|
234276
|
+
return response[type]();
|
|
234277
|
+
};
|
|
234238
234278
|
}
|
|
234239
|
-
|
|
234240
|
-
|
|
234241
|
-
|
|
234242
|
-
|
|
234243
|
-
|
|
234244
|
-
|
|
234245
|
-
|
|
234246
|
-
|
|
234247
|
-
|
|
234248
|
-
|
|
234249
|
-
|
|
234250
|
-
|
|
234251
|
-
|
|
234252
|
-
|
|
234253
|
-
|
|
234254
|
-
|
|
234255
|
-
|
|
234256
|
-
|
|
234279
|
+
return result;
|
|
234280
|
+
}
|
|
234281
|
+
static #normalizeSearchParams(searchParams) {
|
|
234282
|
+
if (searchParams && typeof searchParams === "object" && !Array.isArray(searchParams) && !(searchParams instanceof URLSearchParams)) {
|
|
234283
|
+
return Object.fromEntries(Object.entries(searchParams).filter(([, value]) => value !== undefined));
|
|
234284
|
+
}
|
|
234285
|
+
return searchParams;
|
|
234286
|
+
}
|
|
234287
|
+
request;
|
|
234288
|
+
#abortController;
|
|
234289
|
+
#retryCount = 0;
|
|
234290
|
+
#input;
|
|
234291
|
+
#options;
|
|
234292
|
+
#originalRequest;
|
|
234293
|
+
#userProvidedAbortSignal;
|
|
234294
|
+
#cachedNormalizedOptions;
|
|
234295
|
+
constructor(input, options = {}) {
|
|
234296
|
+
this.#input = input;
|
|
234297
|
+
this.#options = {
|
|
234298
|
+
...options,
|
|
234299
|
+
headers: mergeHeaders(this.#input.headers, options.headers),
|
|
234300
|
+
hooks: mergeHooks({
|
|
234301
|
+
beforeRequest: [],
|
|
234302
|
+
beforeRetry: [],
|
|
234303
|
+
beforeError: [],
|
|
234304
|
+
afterResponse: []
|
|
234305
|
+
}, options.hooks),
|
|
234306
|
+
method: normalizeRequestMethod(options.method ?? this.#input.method ?? "GET"),
|
|
234307
|
+
prefixUrl: String(options.prefixUrl || ""),
|
|
234308
|
+
retry: normalizeRetryOptions(options.retry),
|
|
234309
|
+
throwHttpErrors: options.throwHttpErrors ?? true,
|
|
234310
|
+
timeout: options.timeout ?? 1e4,
|
|
234311
|
+
fetch: options.fetch ?? globalThis.fetch.bind(globalThis),
|
|
234312
|
+
context: options.context ?? {}
|
|
234313
|
+
};
|
|
234314
|
+
if (typeof this.#input !== "string" && !(this.#input instanceof URL || this.#input instanceof globalThis.Request)) {
|
|
234315
|
+
throw new TypeError("`input` must be a string, URL, or Request");
|
|
234316
|
+
}
|
|
234317
|
+
if (this.#options.prefixUrl && typeof this.#input === "string") {
|
|
234318
|
+
if (this.#input.startsWith("/")) {
|
|
234319
|
+
throw new Error("`input` must not begin with a slash when using `prefixUrl`");
|
|
234257
234320
|
}
|
|
234258
|
-
if (
|
|
234259
|
-
|
|
234321
|
+
if (!this.#options.prefixUrl.endsWith("/")) {
|
|
234322
|
+
this.#options.prefixUrl += "/";
|
|
234260
234323
|
}
|
|
234261
|
-
|
|
234262
|
-
break;
|
|
234324
|
+
this.#input = this.#options.prefixUrl + this.#input;
|
|
234263
234325
|
}
|
|
234264
|
-
|
|
234265
|
-
|
|
234266
|
-
|
|
234326
|
+
if (supportsAbortController && supportsAbortSignal) {
|
|
234327
|
+
this.#userProvidedAbortSignal = this.#options.signal ?? this.#input.signal;
|
|
234328
|
+
this.#abortController = new globalThis.AbortController;
|
|
234329
|
+
this.#options.signal = this.#userProvidedAbortSignal ? AbortSignal.any([this.#userProvidedAbortSignal, this.#abortController.signal]) : this.#abortController.signal;
|
|
234267
234330
|
}
|
|
234268
|
-
|
|
234269
|
-
|
|
234270
|
-
break;
|
|
234331
|
+
if (supportsRequestStreams) {
|
|
234332
|
+
this.#options.duplex = "half";
|
|
234271
234333
|
}
|
|
234272
|
-
|
|
234273
|
-
|
|
234274
|
-
|
|
234275
|
-
|
|
234276
|
-
|
|
234277
|
-
|
|
234278
|
-
|
|
234334
|
+
if (this.#options.json !== undefined) {
|
|
234335
|
+
this.#options.body = this.#options.stringifyJson?.(this.#options.json) ?? JSON.stringify(this.#options.json);
|
|
234336
|
+
this.#options.headers.set("content-type", this.#options.headers.get("content-type") ?? "application/json");
|
|
234337
|
+
}
|
|
234338
|
+
const userProvidedContentType = options.headers && new globalThis.Headers(options.headers).has("content-type");
|
|
234339
|
+
if (this.#input instanceof globalThis.Request && (supportsFormData && this.#options.body instanceof globalThis.FormData || this.#options.body instanceof URLSearchParams) && !userProvidedContentType) {
|
|
234340
|
+
this.#options.headers.delete("content-type");
|
|
234341
|
+
}
|
|
234342
|
+
this.request = new globalThis.Request(this.#input, this.#options);
|
|
234343
|
+
if (hasSearchParameters(this.#options.searchParams)) {
|
|
234344
|
+
const textSearchParams = typeof this.#options.searchParams === "string" ? this.#options.searchParams.replace(/^\?/, "") : new URLSearchParams(Ky.#normalizeSearchParams(this.#options.searchParams)).toString();
|
|
234345
|
+
const searchParams = "?" + textSearchParams;
|
|
234346
|
+
const url2 = this.request.url.replace(/(?:\?.*?)?(?=#|$)/, searchParams);
|
|
234347
|
+
this.request = new globalThis.Request(url2, this.#options);
|
|
234348
|
+
}
|
|
234349
|
+
if (this.#options.onUploadProgress) {
|
|
234350
|
+
if (typeof this.#options.onUploadProgress !== "function") {
|
|
234351
|
+
throw new TypeError("The `onUploadProgress` option must be a function");
|
|
234279
234352
|
}
|
|
234280
|
-
if (
|
|
234281
|
-
|
|
234282
|
-
const valueSchema = schema.additionalProperties && typeof schema.additionalProperties === "object" ? convertSchema(schema.additionalProperties, ctx) : z2.any();
|
|
234283
|
-
if (Object.keys(shape).length === 0) {
|
|
234284
|
-
zodSchema = z2.record(keySchema, valueSchema);
|
|
234285
|
-
break;
|
|
234286
|
-
}
|
|
234287
|
-
const objectSchema2 = z2.object(shape).passthrough();
|
|
234288
|
-
const recordSchema = z2.looseRecord(keySchema, valueSchema);
|
|
234289
|
-
zodSchema = z2.intersection(objectSchema2, recordSchema);
|
|
234290
|
-
break;
|
|
234353
|
+
if (!supportsRequestStreams) {
|
|
234354
|
+
throw new Error("Request streams are not supported in your environment. The `duplex` option for `Request` is not available.");
|
|
234291
234355
|
}
|
|
234292
|
-
|
|
234293
|
-
|
|
234294
|
-
|
|
234295
|
-
|
|
234296
|
-
|
|
234297
|
-
|
|
234298
|
-
|
|
234299
|
-
|
|
234300
|
-
|
|
234301
|
-
|
|
234302
|
-
|
|
234303
|
-
|
|
234304
|
-
|
|
234305
|
-
|
|
234306
|
-
|
|
234307
|
-
|
|
234308
|
-
|
|
234309
|
-
|
|
234310
|
-
|
|
234311
|
-
|
|
234312
|
-
|
|
234313
|
-
|
|
234314
|
-
|
|
234315
|
-
|
|
234316
|
-
|
|
234317
|
-
|
|
234356
|
+
this.request = this.#wrapRequestWithUploadProgress(this.request, this.#options.body ?? undefined);
|
|
234357
|
+
}
|
|
234358
|
+
}
|
|
234359
|
+
#calculateDelay() {
|
|
234360
|
+
const retryDelay = this.#options.retry.delay(this.#retryCount);
|
|
234361
|
+
let jitteredDelay = retryDelay;
|
|
234362
|
+
if (this.#options.retry.jitter === true) {
|
|
234363
|
+
jitteredDelay = Math.random() * retryDelay;
|
|
234364
|
+
} else if (typeof this.#options.retry.jitter === "function") {
|
|
234365
|
+
jitteredDelay = this.#options.retry.jitter(retryDelay);
|
|
234366
|
+
if (!Number.isFinite(jitteredDelay) || jitteredDelay < 0) {
|
|
234367
|
+
jitteredDelay = retryDelay;
|
|
234368
|
+
}
|
|
234369
|
+
}
|
|
234370
|
+
const backoffLimit = this.#options.retry.backoffLimit ?? Number.POSITIVE_INFINITY;
|
|
234371
|
+
return Math.min(backoffLimit, jitteredDelay);
|
|
234372
|
+
}
|
|
234373
|
+
async#calculateRetryDelay(error48) {
|
|
234374
|
+
this.#retryCount++;
|
|
234375
|
+
if (this.#retryCount > this.#options.retry.limit) {
|
|
234376
|
+
throw error48;
|
|
234377
|
+
}
|
|
234378
|
+
const errorObject = error48 instanceof Error ? error48 : new NonError(error48);
|
|
234379
|
+
if (errorObject instanceof ForceRetryError) {
|
|
234380
|
+
return errorObject.customDelay ?? this.#calculateDelay();
|
|
234381
|
+
}
|
|
234382
|
+
if (!this.#options.retry.methods.includes(this.request.method.toLowerCase())) {
|
|
234383
|
+
throw error48;
|
|
234384
|
+
}
|
|
234385
|
+
if (this.#options.retry.shouldRetry !== undefined) {
|
|
234386
|
+
const result = await this.#options.retry.shouldRetry({ error: errorObject, retryCount: this.#retryCount });
|
|
234387
|
+
if (result === false) {
|
|
234388
|
+
throw error48;
|
|
234318
234389
|
}
|
|
234319
|
-
|
|
234320
|
-
|
|
234321
|
-
zodSchema = objectSchema.strict();
|
|
234322
|
-
} else if (typeof schema.additionalProperties === "object") {
|
|
234323
|
-
zodSchema = objectSchema.catchall(convertSchema(schema.additionalProperties, ctx));
|
|
234324
|
-
} else {
|
|
234325
|
-
zodSchema = objectSchema.passthrough();
|
|
234390
|
+
if (result === true) {
|
|
234391
|
+
return this.#calculateDelay();
|
|
234326
234392
|
}
|
|
234327
|
-
break;
|
|
234328
234393
|
}
|
|
234329
|
-
|
|
234330
|
-
|
|
234331
|
-
|
|
234332
|
-
|
|
234333
|
-
|
|
234334
|
-
|
|
234335
|
-
|
|
234336
|
-
|
|
234337
|
-
|
|
234338
|
-
|
|
234339
|
-
|
|
234340
|
-
|
|
234341
|
-
|
|
234342
|
-
|
|
234343
|
-
if (typeof schema.maxItems === "number") {
|
|
234344
|
-
zodSchema = zodSchema.check(z2.maxLength(schema.maxItems));
|
|
234345
|
-
}
|
|
234346
|
-
} else if (Array.isArray(items)) {
|
|
234347
|
-
const tupleItems = items.map((item) => convertSchema(item, ctx));
|
|
234348
|
-
const rest = schema.additionalItems && typeof schema.additionalItems === "object" ? convertSchema(schema.additionalItems, ctx) : undefined;
|
|
234349
|
-
if (rest) {
|
|
234350
|
-
zodSchema = z2.tuple(tupleItems).rest(rest);
|
|
234351
|
-
} else {
|
|
234352
|
-
zodSchema = z2.tuple(tupleItems);
|
|
234353
|
-
}
|
|
234354
|
-
if (typeof schema.minItems === "number") {
|
|
234355
|
-
zodSchema = zodSchema.check(z2.minLength(schema.minItems));
|
|
234356
|
-
}
|
|
234357
|
-
if (typeof schema.maxItems === "number") {
|
|
234358
|
-
zodSchema = zodSchema.check(z2.maxLength(schema.maxItems));
|
|
234359
|
-
}
|
|
234360
|
-
} else if (items !== undefined) {
|
|
234361
|
-
const element = convertSchema(items, ctx);
|
|
234362
|
-
let arraySchema = z2.array(element);
|
|
234363
|
-
if (typeof schema.minItems === "number") {
|
|
234364
|
-
arraySchema = arraySchema.min(schema.minItems);
|
|
234365
|
-
}
|
|
234366
|
-
if (typeof schema.maxItems === "number") {
|
|
234367
|
-
arraySchema = arraySchema.max(schema.maxItems);
|
|
234394
|
+
if (isTimeoutError(error48) && !this.#options.retry.retryOnTimeout) {
|
|
234395
|
+
throw error48;
|
|
234396
|
+
}
|
|
234397
|
+
if (isHTTPError(error48)) {
|
|
234398
|
+
if (!this.#options.retry.statusCodes.includes(error48.response.status)) {
|
|
234399
|
+
throw error48;
|
|
234400
|
+
}
|
|
234401
|
+
const retryAfter = error48.response.headers.get("Retry-After") ?? error48.response.headers.get("RateLimit-Reset") ?? error48.response.headers.get("X-RateLimit-Retry-After") ?? error48.response.headers.get("X-RateLimit-Reset") ?? error48.response.headers.get("X-Rate-Limit-Reset");
|
|
234402
|
+
if (retryAfter && this.#options.retry.afterStatusCodes.includes(error48.response.status)) {
|
|
234403
|
+
let after = Number(retryAfter) * 1000;
|
|
234404
|
+
if (Number.isNaN(after)) {
|
|
234405
|
+
after = Date.parse(retryAfter) - Date.now();
|
|
234406
|
+
} else if (after >= Date.parse("2024-01-01")) {
|
|
234407
|
+
after -= Date.now();
|
|
234368
234408
|
}
|
|
234369
|
-
|
|
234370
|
-
|
|
234371
|
-
|
|
234409
|
+
const max = this.#options.retry.maxRetryAfter ?? after;
|
|
234410
|
+
return after < max ? after : max;
|
|
234411
|
+
}
|
|
234412
|
+
if (error48.response.status === 413) {
|
|
234413
|
+
throw error48;
|
|
234372
234414
|
}
|
|
234373
|
-
break;
|
|
234374
234415
|
}
|
|
234375
|
-
|
|
234376
|
-
throw new Error(`Unsupported type: ${type}`);
|
|
234377
|
-
}
|
|
234378
|
-
if (schema.description) {
|
|
234379
|
-
zodSchema = zodSchema.describe(schema.description);
|
|
234380
|
-
}
|
|
234381
|
-
if (schema.default !== undefined) {
|
|
234382
|
-
zodSchema = zodSchema.default(schema.default);
|
|
234416
|
+
return this.#calculateDelay();
|
|
234383
234417
|
}
|
|
234384
|
-
|
|
234385
|
-
|
|
234386
|
-
|
|
234387
|
-
|
|
234388
|
-
return
|
|
234418
|
+
#decorateResponse(response) {
|
|
234419
|
+
if (this.#options.parseJson) {
|
|
234420
|
+
response.json = async () => this.#options.parseJson(await response.text());
|
|
234421
|
+
}
|
|
234422
|
+
return response;
|
|
234389
234423
|
}
|
|
234390
|
-
|
|
234391
|
-
|
|
234392
|
-
|
|
234393
|
-
|
|
234394
|
-
|
|
234395
|
-
|
|
234424
|
+
#cancelBody(body) {
|
|
234425
|
+
if (!body) {
|
|
234426
|
+
return;
|
|
234427
|
+
}
|
|
234428
|
+
body.cancel().catch(() => {
|
|
234429
|
+
return;
|
|
234430
|
+
});
|
|
234396
234431
|
}
|
|
234397
|
-
|
|
234398
|
-
|
|
234399
|
-
const oneOfUnion = z2.xor(options);
|
|
234400
|
-
baseSchema = hasExplicitType ? z2.intersection(baseSchema, oneOfUnion) : oneOfUnion;
|
|
234432
|
+
#cancelResponseBody(response) {
|
|
234433
|
+
this.#cancelBody(response.body ?? undefined);
|
|
234401
234434
|
}
|
|
234402
|
-
|
|
234403
|
-
|
|
234404
|
-
|
|
234405
|
-
}
|
|
234406
|
-
|
|
234407
|
-
|
|
234408
|
-
|
|
234409
|
-
result = z2.intersection(result, convertSchema(schema.allOf[i], ctx));
|
|
234435
|
+
async#retry(function_) {
|
|
234436
|
+
try {
|
|
234437
|
+
return await function_();
|
|
234438
|
+
} catch (error48) {
|
|
234439
|
+
const ms = Math.min(await this.#calculateRetryDelay(error48), maxSafeTimeout);
|
|
234440
|
+
if (this.#retryCount < 1) {
|
|
234441
|
+
throw error48;
|
|
234410
234442
|
}
|
|
234411
|
-
|
|
234443
|
+
await delay(ms, this.#userProvidedAbortSignal ? { signal: this.#userProvidedAbortSignal } : {});
|
|
234444
|
+
if (error48 instanceof ForceRetryError && error48.customRequest) {
|
|
234445
|
+
const managedRequest = this.#options.signal ? new globalThis.Request(error48.customRequest, { signal: this.#options.signal }) : new globalThis.Request(error48.customRequest);
|
|
234446
|
+
this.#assignRequest(managedRequest);
|
|
234447
|
+
}
|
|
234448
|
+
for (const hook of this.#options.hooks.beforeRetry) {
|
|
234449
|
+
const hookResult = await hook({
|
|
234450
|
+
request: this.request,
|
|
234451
|
+
options: this.#getNormalizedOptions(),
|
|
234452
|
+
error: error48,
|
|
234453
|
+
retryCount: this.#retryCount
|
|
234454
|
+
});
|
|
234455
|
+
if (hookResult instanceof globalThis.Request) {
|
|
234456
|
+
this.#assignRequest(hookResult);
|
|
234457
|
+
break;
|
|
234458
|
+
}
|
|
234459
|
+
if (hookResult instanceof globalThis.Response) {
|
|
234460
|
+
return hookResult;
|
|
234461
|
+
}
|
|
234462
|
+
if (hookResult === stop) {
|
|
234463
|
+
return;
|
|
234464
|
+
}
|
|
234465
|
+
}
|
|
234466
|
+
return this.#retry(function_);
|
|
234412
234467
|
}
|
|
234413
234468
|
}
|
|
234414
|
-
|
|
234415
|
-
|
|
234416
|
-
|
|
234417
|
-
|
|
234418
|
-
|
|
234419
|
-
}
|
|
234420
|
-
const extraMeta = {};
|
|
234421
|
-
const coreMetadataKeys = ["$id", "id", "$comment", "$anchor", "$vocabulary", "$dynamicRef", "$dynamicAnchor"];
|
|
234422
|
-
for (const key of coreMetadataKeys) {
|
|
234423
|
-
if (key in schema) {
|
|
234424
|
-
extraMeta[key] = schema[key];
|
|
234469
|
+
async#fetch() {
|
|
234470
|
+
if (this.#abortController?.signal.aborted) {
|
|
234471
|
+
this.#abortController = new globalThis.AbortController;
|
|
234472
|
+
this.#options.signal = this.#userProvidedAbortSignal ? AbortSignal.any([this.#userProvidedAbortSignal, this.#abortController.signal]) : this.#abortController.signal;
|
|
234473
|
+
this.request = new globalThis.Request(this.request, { signal: this.#options.signal });
|
|
234425
234474
|
}
|
|
234426
|
-
|
|
234427
|
-
|
|
234428
|
-
|
|
234429
|
-
|
|
234430
|
-
|
|
234475
|
+
for (const hook of this.#options.hooks.beforeRequest) {
|
|
234476
|
+
const result = await hook(this.request, this.#getNormalizedOptions(), { retryCount: this.#retryCount });
|
|
234477
|
+
if (result instanceof Response) {
|
|
234478
|
+
return result;
|
|
234479
|
+
}
|
|
234480
|
+
if (result instanceof globalThis.Request) {
|
|
234481
|
+
this.#assignRequest(result);
|
|
234482
|
+
break;
|
|
234483
|
+
}
|
|
234484
|
+
}
|
|
234485
|
+
const nonRequestOptions = findUnknownOptions(this.request, this.#options);
|
|
234486
|
+
this.#originalRequest = this.request;
|
|
234487
|
+
this.request = this.#originalRequest.clone();
|
|
234488
|
+
if (this.#options.timeout === false) {
|
|
234489
|
+
return this.#options.fetch(this.#originalRequest, nonRequestOptions);
|
|
234431
234490
|
}
|
|
234491
|
+
return timeout(this.#originalRequest, nonRequestOptions, this.#abortController, this.#options);
|
|
234432
234492
|
}
|
|
234433
|
-
|
|
234434
|
-
if (!
|
|
234435
|
-
|
|
234493
|
+
#getNormalizedOptions() {
|
|
234494
|
+
if (!this.#cachedNormalizedOptions) {
|
|
234495
|
+
const { hooks, ...normalizedOptions } = this.#options;
|
|
234496
|
+
this.#cachedNormalizedOptions = Object.freeze(normalizedOptions);
|
|
234436
234497
|
}
|
|
234498
|
+
return this.#cachedNormalizedOptions;
|
|
234437
234499
|
}
|
|
234438
|
-
|
|
234439
|
-
|
|
234500
|
+
#assignRequest(request) {
|
|
234501
|
+
this.#cachedNormalizedOptions = undefined;
|
|
234502
|
+
this.request = this.#wrapRequestWithUploadProgress(request);
|
|
234503
|
+
}
|
|
234504
|
+
#wrapRequestWithUploadProgress(request, originalBody) {
|
|
234505
|
+
if (!this.#options.onUploadProgress || !request.body) {
|
|
234506
|
+
return request;
|
|
234507
|
+
}
|
|
234508
|
+
return streamRequest(request, this.#options.onUploadProgress, originalBody ?? this.#options.body ?? undefined);
|
|
234440
234509
|
}
|
|
234441
|
-
return baseSchema;
|
|
234442
234510
|
}
|
|
234443
|
-
|
|
234444
|
-
|
|
234445
|
-
|
|
234511
|
+
// ../../node_modules/ky/distribution/index.js
|
|
234512
|
+
/*! MIT License © Sindre Sorhus */
|
|
234513
|
+
var createInstance = (defaults) => {
|
|
234514
|
+
const ky = (input, options) => Ky.create(input, validateAndMerge(defaults, options));
|
|
234515
|
+
for (const method of requestMethods) {
|
|
234516
|
+
ky[method] = (input, options) => Ky.create(input, validateAndMerge(defaults, options, { method }));
|
|
234446
234517
|
}
|
|
234447
|
-
|
|
234448
|
-
|
|
234449
|
-
|
|
234450
|
-
|
|
234451
|
-
|
|
234452
|
-
|
|
234453
|
-
processing: new Set,
|
|
234454
|
-
rootSchema: schema,
|
|
234455
|
-
registry: params?.registry ?? globalRegistry
|
|
234518
|
+
ky.create = (newDefaults) => createInstance(validateAndMerge(newDefaults));
|
|
234519
|
+
ky.extend = (newDefaults) => {
|
|
234520
|
+
if (typeof newDefaults === "function") {
|
|
234521
|
+
newDefaults = newDefaults(defaults ?? {});
|
|
234522
|
+
}
|
|
234523
|
+
return createInstance(validateAndMerge(defaults, newDefaults));
|
|
234456
234524
|
};
|
|
234457
|
-
|
|
234458
|
-
|
|
234459
|
-
|
|
234460
|
-
|
|
234461
|
-
|
|
234462
|
-
|
|
234463
|
-
|
|
234464
|
-
|
|
234465
|
-
|
|
234466
|
-
|
|
234525
|
+
ky.stop = stop;
|
|
234526
|
+
ky.retry = retry;
|
|
234527
|
+
return ky;
|
|
234528
|
+
};
|
|
234529
|
+
var ky = createInstance();
|
|
234530
|
+
var distribution_default = ky;
|
|
234531
|
+
|
|
234532
|
+
// src/core/config.ts
|
|
234533
|
+
import { homedir } from "node:os";
|
|
234534
|
+
import { join } from "node:path";
|
|
234535
|
+
|
|
234536
|
+
// src/core/consts.ts
|
|
234537
|
+
var PROJECT_SUBDIR = "base44";
|
|
234538
|
+
var CONFIG_FILE_EXTENSION = "jsonc";
|
|
234539
|
+
var CONFIG_FILE_EXTENSION_GLOB = "{json,jsonc}";
|
|
234540
|
+
var FUNCTION_CONFIG_GLOB = `**/function.${CONFIG_FILE_EXTENSION_GLOB}`;
|
|
234541
|
+
var ENTRY_FILE_GLOB = "**/entry.{js,ts}";
|
|
234542
|
+
var ENTRY_IGNORE_DOT_PATHS = ["**/*.*/**"];
|
|
234543
|
+
var APP_CONFIG_PATTERN = `**/.app.${CONFIG_FILE_EXTENSION_GLOB}`;
|
|
234544
|
+
var PROJECT_CONFIG_PATTERNS = [
|
|
234545
|
+
`${PROJECT_SUBDIR}/config.${CONFIG_FILE_EXTENSION_GLOB}`,
|
|
234546
|
+
`config.${CONFIG_FILE_EXTENSION_GLOB}`
|
|
234547
|
+
];
|
|
234548
|
+
var TYPES_OUTPUT_SUBDIR = ".types";
|
|
234549
|
+
var TYPES_FILENAME = "types.d.ts";
|
|
234550
|
+
var AUTH_CLIENT_ID = "base44_cli";
|
|
234551
|
+
|
|
234552
|
+
// src/core/project/schema.ts
|
|
234553
|
+
var TemplateSchema = exports_external.object({
|
|
234554
|
+
id: exports_external.string(),
|
|
234555
|
+
name: exports_external.string(),
|
|
234556
|
+
description: exports_external.string(),
|
|
234557
|
+
path: exports_external.string()
|
|
234467
234558
|
});
|
|
234468
|
-
|
|
234469
|
-
|
|
234559
|
+
var TemplatesConfigSchema = exports_external.object({
|
|
234560
|
+
templates: exports_external.array(TemplateSchema)
|
|
234561
|
+
});
|
|
234562
|
+
var SiteConfigSchema = exports_external.object({
|
|
234563
|
+
buildCommand: exports_external.string().optional(),
|
|
234564
|
+
serveCommand: exports_external.string().optional(),
|
|
234565
|
+
outputDirectory: exports_external.string().optional(),
|
|
234566
|
+
installCommand: exports_external.string().optional()
|
|
234567
|
+
});
|
|
234568
|
+
var ProjectConfigSchema = exports_external.object({
|
|
234569
|
+
name: exports_external.string({
|
|
234570
|
+
error: "App name cannot be empty"
|
|
234571
|
+
}).min(1, "App name cannot be empty"),
|
|
234572
|
+
description: exports_external.string().optional(),
|
|
234573
|
+
site: SiteConfigSchema.optional(),
|
|
234574
|
+
entitiesDir: exports_external.string().optional().default("entities"),
|
|
234575
|
+
functionsDir: exports_external.string().optional().default("functions"),
|
|
234576
|
+
agentsDir: exports_external.string().optional().default("agents"),
|
|
234577
|
+
connectorsDir: exports_external.string().optional().default("connectors"),
|
|
234578
|
+
authDir: exports_external.string().optional().default("auth")
|
|
234579
|
+
});
|
|
234580
|
+
var AppConfigSchema = exports_external.object({
|
|
234581
|
+
id: exports_external.string().min(1, "id cannot be empty")
|
|
234582
|
+
});
|
|
234583
|
+
var CreateProjectResponseSchema = exports_external.looseObject({
|
|
234584
|
+
id: exports_external.string()
|
|
234585
|
+
});
|
|
234586
|
+
var ProjectSchema = exports_external.object({
|
|
234587
|
+
id: exports_external.string(),
|
|
234588
|
+
name: exports_external.string(),
|
|
234589
|
+
user_description: exports_external.string().optional().nullable(),
|
|
234590
|
+
is_managed_source_code: exports_external.boolean().optional()
|
|
234591
|
+
}).transform((data) => ({
|
|
234592
|
+
id: data.id,
|
|
234593
|
+
name: data.name,
|
|
234594
|
+
userDescription: data.user_description,
|
|
234595
|
+
isManagedSourceCode: data.is_managed_source_code
|
|
234596
|
+
}));
|
|
234597
|
+
var ProjectsResponseSchema = exports_external.array(ProjectSchema);
|
|
234598
|
+
var TestOverridesSchema = exports_external.object({
|
|
234599
|
+
appConfig: exports_external.object({
|
|
234600
|
+
id: exports_external.string(),
|
|
234601
|
+
projectRoot: exports_external.string()
|
|
234602
|
+
}).optional(),
|
|
234603
|
+
latestVersion: exports_external.string().nullable().optional()
|
|
234604
|
+
});
|
|
234605
|
+
|
|
234606
|
+
// src/core/config.ts
|
|
234607
|
+
function getBase44GlobalDir() {
|
|
234608
|
+
return join(homedir(), ".base44");
|
|
234470
234609
|
}
|
|
234471
|
-
function
|
|
234472
|
-
return
|
|
234610
|
+
function getAuthFilePath() {
|
|
234611
|
+
return join(getBase44GlobalDir(), "auth", "auth.json");
|
|
234473
234612
|
}
|
|
234474
|
-
function
|
|
234475
|
-
return
|
|
234613
|
+
function getAppConfigPath(projectRoot) {
|
|
234614
|
+
return join(projectRoot, PROJECT_SUBDIR, ".app.jsonc");
|
|
234476
234615
|
}
|
|
234477
|
-
function
|
|
234478
|
-
return
|
|
234616
|
+
function getTypesOutputPath(projectRoot) {
|
|
234617
|
+
return join(projectRoot, PROJECT_SUBDIR, TYPES_OUTPUT_SUBDIR, TYPES_FILENAME);
|
|
234479
234618
|
}
|
|
234480
|
-
function
|
|
234481
|
-
return
|
|
234619
|
+
function getBase44ApiUrl() {
|
|
234620
|
+
return process.env.BASE44_API_URL || "https://app.base44.com";
|
|
234621
|
+
}
|
|
234622
|
+
function getTestOverrides() {
|
|
234623
|
+
const raw = process.env.BASE44_CLI_TEST_OVERRIDES;
|
|
234624
|
+
if (!raw) {
|
|
234625
|
+
return null;
|
|
234626
|
+
}
|
|
234627
|
+
try {
|
|
234628
|
+
const parsed = JSON.parse(raw);
|
|
234629
|
+
const result = TestOverridesSchema.safeParse(parsed);
|
|
234630
|
+
return result.success ? result.data : null;
|
|
234631
|
+
} catch {
|
|
234632
|
+
return null;
|
|
234633
|
+
}
|
|
234482
234634
|
}
|
|
234483
234635
|
|
|
234484
|
-
// ../../node_modules/zod/v4/classic/external.js
|
|
234485
|
-
config(en_default());
|
|
234486
234636
|
// src/core/clients/schemas.ts
|
|
234487
234637
|
var ApiErrorResponseSchema = exports_external.looseObject({
|
|
234488
234638
|
message: exports_external.unknown().optional(),
|
|
@@ -234794,156 +234944,6 @@ function isUserError(error48) {
|
|
|
234794
234944
|
return error48 instanceof UserError;
|
|
234795
234945
|
}
|
|
234796
234946
|
|
|
234797
|
-
// src/core/auth/schema.ts
|
|
234798
|
-
var AuthDataSchema = exports_external.object({
|
|
234799
|
-
accessToken: exports_external.string().min(1, "Token cannot be empty"),
|
|
234800
|
-
refreshToken: exports_external.string().min(1, "Refresh token cannot be empty"),
|
|
234801
|
-
expiresAt: exports_external.number().int().positive("Expires at must be a positive integer"),
|
|
234802
|
-
email: exports_external.email(),
|
|
234803
|
-
name: exports_external.string().min(1, "Name cannot be empty")
|
|
234804
|
-
});
|
|
234805
|
-
var DeviceCodeResponseSchema = exports_external.object({
|
|
234806
|
-
device_code: exports_external.string().min(1, "Device code cannot be empty"),
|
|
234807
|
-
user_code: exports_external.string().min(1, "User code cannot be empty"),
|
|
234808
|
-
verification_uri: exports_external.url("Invalid verification URL"),
|
|
234809
|
-
expires_in: exports_external.number().int().positive("Expires in must be a positive integer"),
|
|
234810
|
-
interval: exports_external.number().int().positive("Interval in must be a positive integer")
|
|
234811
|
-
}).transform((data) => ({
|
|
234812
|
-
deviceCode: data.device_code,
|
|
234813
|
-
userCode: data.user_code,
|
|
234814
|
-
verificationUri: data.verification_uri,
|
|
234815
|
-
expiresIn: data.expires_in,
|
|
234816
|
-
interval: data.interval
|
|
234817
|
-
}));
|
|
234818
|
-
var TokenResponseSchema = exports_external.object({
|
|
234819
|
-
access_token: exports_external.string().min(1, "Token cannot be empty"),
|
|
234820
|
-
token_type: exports_external.string().min(1, "Token type cannot be empty"),
|
|
234821
|
-
expires_in: exports_external.number().int().positive("Expires in must be a positive integer"),
|
|
234822
|
-
refresh_token: exports_external.string().min(1, "Refresh token cannot be empty"),
|
|
234823
|
-
scope: exports_external.string().optional()
|
|
234824
|
-
}).transform((data) => ({
|
|
234825
|
-
accessToken: data.access_token,
|
|
234826
|
-
tokenType: data.token_type,
|
|
234827
|
-
expiresIn: data.expires_in,
|
|
234828
|
-
refreshToken: data.refresh_token,
|
|
234829
|
-
scope: data.scope
|
|
234830
|
-
}));
|
|
234831
|
-
var OAuthErrorSchema = exports_external.object({
|
|
234832
|
-
error: exports_external.string(),
|
|
234833
|
-
error_description: exports_external.string().optional()
|
|
234834
|
-
});
|
|
234835
|
-
var UserInfoSchema = exports_external.object({
|
|
234836
|
-
email: exports_external.email(),
|
|
234837
|
-
name: exports_external.string()
|
|
234838
|
-
});
|
|
234839
|
-
|
|
234840
|
-
// src/core/clients/base44-client.ts
|
|
234841
|
-
import { randomUUID as randomUUID2 } from "node:crypto";
|
|
234842
|
-
|
|
234843
|
-
// src/core/config.ts
|
|
234844
|
-
import { homedir } from "node:os";
|
|
234845
|
-
import { join } from "node:path";
|
|
234846
|
-
|
|
234847
|
-
// src/core/consts.ts
|
|
234848
|
-
var PROJECT_SUBDIR = "base44";
|
|
234849
|
-
var CONFIG_FILE_EXTENSION = "jsonc";
|
|
234850
|
-
var CONFIG_FILE_EXTENSION_GLOB = "{json,jsonc}";
|
|
234851
|
-
var FUNCTION_CONFIG_GLOB = `**/function.${CONFIG_FILE_EXTENSION_GLOB}`;
|
|
234852
|
-
var ENTRY_FILE_GLOB = "**/entry.{js,ts}";
|
|
234853
|
-
var ENTRY_IGNORE_DOT_PATHS = ["**/*.*/**"];
|
|
234854
|
-
var APP_CONFIG_PATTERN = `**/.app.${CONFIG_FILE_EXTENSION_GLOB}`;
|
|
234855
|
-
var PROJECT_CONFIG_PATTERNS = [
|
|
234856
|
-
`${PROJECT_SUBDIR}/config.${CONFIG_FILE_EXTENSION_GLOB}`,
|
|
234857
|
-
`config.${CONFIG_FILE_EXTENSION_GLOB}`
|
|
234858
|
-
];
|
|
234859
|
-
var TYPES_OUTPUT_SUBDIR = ".types";
|
|
234860
|
-
var TYPES_FILENAME = "types.d.ts";
|
|
234861
|
-
var AUTH_CLIENT_ID = "base44_cli";
|
|
234862
|
-
|
|
234863
|
-
// src/core/project/schema.ts
|
|
234864
|
-
var TemplateSchema = exports_external.object({
|
|
234865
|
-
id: exports_external.string(),
|
|
234866
|
-
name: exports_external.string(),
|
|
234867
|
-
description: exports_external.string(),
|
|
234868
|
-
path: exports_external.string()
|
|
234869
|
-
});
|
|
234870
|
-
var TemplatesConfigSchema = exports_external.object({
|
|
234871
|
-
templates: exports_external.array(TemplateSchema)
|
|
234872
|
-
});
|
|
234873
|
-
var SiteConfigSchema = exports_external.object({
|
|
234874
|
-
buildCommand: exports_external.string().optional(),
|
|
234875
|
-
serveCommand: exports_external.string().optional(),
|
|
234876
|
-
outputDirectory: exports_external.string().optional(),
|
|
234877
|
-
installCommand: exports_external.string().optional()
|
|
234878
|
-
});
|
|
234879
|
-
var ProjectConfigSchema = exports_external.object({
|
|
234880
|
-
name: exports_external.string({
|
|
234881
|
-
error: "App name cannot be empty"
|
|
234882
|
-
}).min(1, "App name cannot be empty"),
|
|
234883
|
-
description: exports_external.string().optional(),
|
|
234884
|
-
site: SiteConfigSchema.optional(),
|
|
234885
|
-
entitiesDir: exports_external.string().optional().default("entities"),
|
|
234886
|
-
functionsDir: exports_external.string().optional().default("functions"),
|
|
234887
|
-
agentsDir: exports_external.string().optional().default("agents"),
|
|
234888
|
-
connectorsDir: exports_external.string().optional().default("connectors"),
|
|
234889
|
-
authDir: exports_external.string().optional().default("auth")
|
|
234890
|
-
});
|
|
234891
|
-
var AppConfigSchema = exports_external.object({
|
|
234892
|
-
id: exports_external.string().min(1, "id cannot be empty")
|
|
234893
|
-
});
|
|
234894
|
-
var CreateProjectResponseSchema = exports_external.looseObject({
|
|
234895
|
-
id: exports_external.string()
|
|
234896
|
-
});
|
|
234897
|
-
var ProjectSchema = exports_external.object({
|
|
234898
|
-
id: exports_external.string(),
|
|
234899
|
-
name: exports_external.string(),
|
|
234900
|
-
user_description: exports_external.string().optional().nullable(),
|
|
234901
|
-
is_managed_source_code: exports_external.boolean().optional()
|
|
234902
|
-
}).transform((data) => ({
|
|
234903
|
-
id: data.id,
|
|
234904
|
-
name: data.name,
|
|
234905
|
-
userDescription: data.user_description,
|
|
234906
|
-
isManagedSourceCode: data.is_managed_source_code
|
|
234907
|
-
}));
|
|
234908
|
-
var ProjectsResponseSchema = exports_external.array(ProjectSchema);
|
|
234909
|
-
var TestOverridesSchema = exports_external.object({
|
|
234910
|
-
appConfig: exports_external.object({
|
|
234911
|
-
id: exports_external.string(),
|
|
234912
|
-
projectRoot: exports_external.string()
|
|
234913
|
-
}).optional(),
|
|
234914
|
-
latestVersion: exports_external.string().nullable().optional()
|
|
234915
|
-
});
|
|
234916
|
-
|
|
234917
|
-
// src/core/config.ts
|
|
234918
|
-
function getBase44GlobalDir() {
|
|
234919
|
-
return join(homedir(), ".base44");
|
|
234920
|
-
}
|
|
234921
|
-
function getAuthFilePath() {
|
|
234922
|
-
return join(getBase44GlobalDir(), "auth", "auth.json");
|
|
234923
|
-
}
|
|
234924
|
-
function getAppConfigPath(projectRoot) {
|
|
234925
|
-
return join(projectRoot, PROJECT_SUBDIR, ".app.jsonc");
|
|
234926
|
-
}
|
|
234927
|
-
function getTypesOutputPath(projectRoot) {
|
|
234928
|
-
return join(projectRoot, PROJECT_SUBDIR, TYPES_OUTPUT_SUBDIR, TYPES_FILENAME);
|
|
234929
|
-
}
|
|
234930
|
-
function getBase44ApiUrl() {
|
|
234931
|
-
return process.env.BASE44_API_URL || "https://app.base44.com";
|
|
234932
|
-
}
|
|
234933
|
-
function getTestOverrides() {
|
|
234934
|
-
const raw = process.env.BASE44_CLI_TEST_OVERRIDES;
|
|
234935
|
-
if (!raw) {
|
|
234936
|
-
return null;
|
|
234937
|
-
}
|
|
234938
|
-
try {
|
|
234939
|
-
const parsed = JSON.parse(raw);
|
|
234940
|
-
const result = TestOverridesSchema.safeParse(parsed);
|
|
234941
|
-
return result.success ? result.data : null;
|
|
234942
|
-
} catch {
|
|
234943
|
-
return null;
|
|
234944
|
-
}
|
|
234945
|
-
}
|
|
234946
|
-
|
|
234947
234947
|
// src/core/utils/fs.ts
|
|
234948
234948
|
var import_json5 = __toESM(require_lib(), 1);
|
|
234949
234949
|
import {
|
|
@@ -260142,4 +260142,4 @@ export {
|
|
|
260142
260142
|
CLIExitError
|
|
260143
260143
|
};
|
|
260144
260144
|
|
|
260145
|
-
//# debugId=
|
|
260145
|
+
//# debugId=DCFE80A2CD93B81E64756E2164756E21
|