@xyo-network/hash 5.6.2 → 6.0.0
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/browser/index-browser.mjs +1 -1
- package/dist/browser/index-browser.mjs.map +7 -1
- package/dist/browser/index.mjs +1 -1
- package/dist/browser/index.mjs.map +7 -1
- package/dist/browser/worker/subtleHash-bundle.mjs +2 -2
- package/dist/browser/worker/subtleHash.mjs +1 -1
- package/dist/browser/worker/subtleHash.mjs.map +7 -1
- package/dist/browser/worker/wasmHash-bundle.mjs +206 -3492
- package/dist/browser/worker/wasmHash.mjs +1 -1
- package/dist/browser/worker/wasmHash.mjs.map +7 -1
- package/dist/neutral/index.mjs +1 -1
- package/dist/neutral/index.mjs.map +7 -1
- package/dist/node/index.mjs +1 -1
- package/dist/node/index.mjs.map +7 -1
- package/dist/node/worker/subtleHashNode.mjs +1 -1
- package/dist/node/worker/subtleHashNode.mjs.map +7 -1
- package/dist/node/worker/wasmHashNode.mjs +1 -1
- package/dist/node/worker/wasmHashNode.mjs.map +7 -1
- package/package.json +33 -30
|
@@ -1,12 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
(() => {
|
|
3
|
-
|
|
4
|
-
var __export = (target, all) => {
|
|
5
|
-
for (var name in all)
|
|
6
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
// ../../../../../../node_modules/.pnpm/@xylabs+typeof@5.1.1/node_modules/@xylabs/typeof/dist/neutral/index.mjs
|
|
3
|
+
// ../../../../../../node_modules/.pnpm/@xylabs+typeof@6.0.0/node_modules/@xylabs/typeof/dist/neutral/index.mjs
|
|
10
4
|
function isUndefined(value) {
|
|
11
5
|
return value === void 0;
|
|
12
6
|
}
|
|
@@ -20,7 +14,7 @@
|
|
|
20
14
|
// ../../../../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/core.js
|
|
21
15
|
var _a;
|
|
22
16
|
// @__NO_SIDE_EFFECTS__
|
|
23
|
-
function $constructor(name,
|
|
17
|
+
function $constructor(name, initializer2, params) {
|
|
24
18
|
function init(inst, def) {
|
|
25
19
|
if (!inst._zod) {
|
|
26
20
|
Object.defineProperty(inst, "_zod", {
|
|
@@ -36,7 +30,7 @@
|
|
|
36
30
|
return;
|
|
37
31
|
}
|
|
38
32
|
inst._zod.traits.add(name);
|
|
39
|
-
|
|
33
|
+
initializer2(inst, def);
|
|
40
34
|
const proto = _.prototype;
|
|
41
35
|
const keys = Object.keys(proto);
|
|
42
36
|
for (let i = 0; i < keys.length; i++) {
|
|
@@ -51,10 +45,10 @@
|
|
|
51
45
|
}
|
|
52
46
|
Object.defineProperty(Definition, "name", { value: name });
|
|
53
47
|
function _(def) {
|
|
54
|
-
var
|
|
48
|
+
var _a3;
|
|
55
49
|
const inst = params?.Parent ? new Definition() : this;
|
|
56
50
|
init(inst, def);
|
|
57
|
-
(
|
|
51
|
+
(_a3 = inst._zod).deferred ?? (_a3.deferred = []);
|
|
58
52
|
for (const fn of inst._zod.deferred) {
|
|
59
53
|
fn();
|
|
60
54
|
}
|
|
@@ -91,127 +85,16 @@
|
|
|
91
85
|
}
|
|
92
86
|
|
|
93
87
|
// ../../../../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/util.js
|
|
94
|
-
var util_exports = {};
|
|
95
|
-
__export(util_exports, {
|
|
96
|
-
BIGINT_FORMAT_RANGES: () => BIGINT_FORMAT_RANGES,
|
|
97
|
-
Class: () => Class,
|
|
98
|
-
NUMBER_FORMAT_RANGES: () => NUMBER_FORMAT_RANGES,
|
|
99
|
-
aborted: () => aborted,
|
|
100
|
-
allowsEval: () => allowsEval,
|
|
101
|
-
assert: () => assert,
|
|
102
|
-
assertEqual: () => assertEqual,
|
|
103
|
-
assertIs: () => assertIs,
|
|
104
|
-
assertNever: () => assertNever,
|
|
105
|
-
assertNotEqual: () => assertNotEqual,
|
|
106
|
-
assignProp: () => assignProp,
|
|
107
|
-
base64ToUint8Array: () => base64ToUint8Array,
|
|
108
|
-
base64urlToUint8Array: () => base64urlToUint8Array,
|
|
109
|
-
cached: () => cached,
|
|
110
|
-
captureStackTrace: () => captureStackTrace,
|
|
111
|
-
cleanEnum: () => cleanEnum,
|
|
112
|
-
cleanRegex: () => cleanRegex,
|
|
113
|
-
clone: () => clone,
|
|
114
|
-
cloneDef: () => cloneDef,
|
|
115
|
-
createTransparentProxy: () => createTransparentProxy,
|
|
116
|
-
defineLazy: () => defineLazy,
|
|
117
|
-
esc: () => esc,
|
|
118
|
-
escapeRegex: () => escapeRegex,
|
|
119
|
-
explicitlyAborted: () => explicitlyAborted,
|
|
120
|
-
extend: () => extend,
|
|
121
|
-
finalizeIssue: () => finalizeIssue,
|
|
122
|
-
floatSafeRemainder: () => floatSafeRemainder,
|
|
123
|
-
getElementAtPath: () => getElementAtPath,
|
|
124
|
-
getEnumValues: () => getEnumValues,
|
|
125
|
-
getLengthableOrigin: () => getLengthableOrigin,
|
|
126
|
-
getParsedType: () => getParsedType,
|
|
127
|
-
getSizableOrigin: () => getSizableOrigin,
|
|
128
|
-
hexToUint8Array: () => hexToUint8Array,
|
|
129
|
-
isObject: () => isObject,
|
|
130
|
-
isPlainObject: () => isPlainObject,
|
|
131
|
-
issue: () => issue,
|
|
132
|
-
joinValues: () => joinValues,
|
|
133
|
-
jsonStringifyReplacer: () => jsonStringifyReplacer,
|
|
134
|
-
merge: () => merge,
|
|
135
|
-
mergeDefs: () => mergeDefs,
|
|
136
|
-
normalizeParams: () => normalizeParams,
|
|
137
|
-
nullish: () => nullish,
|
|
138
|
-
numKeys: () => numKeys,
|
|
139
|
-
objectClone: () => objectClone,
|
|
140
|
-
omit: () => omit,
|
|
141
|
-
optionalKeys: () => optionalKeys,
|
|
142
|
-
parsedType: () => parsedType,
|
|
143
|
-
partial: () => partial,
|
|
144
|
-
pick: () => pick,
|
|
145
|
-
prefixIssues: () => prefixIssues,
|
|
146
|
-
primitiveTypes: () => primitiveTypes,
|
|
147
|
-
promiseAllObject: () => promiseAllObject,
|
|
148
|
-
propertyKeyTypes: () => propertyKeyTypes,
|
|
149
|
-
randomString: () => randomString,
|
|
150
|
-
required: () => required,
|
|
151
|
-
safeExtend: () => safeExtend,
|
|
152
|
-
shallowClone: () => shallowClone,
|
|
153
|
-
slugify: () => slugify,
|
|
154
|
-
stringifyPrimitive: () => stringifyPrimitive,
|
|
155
|
-
uint8ArrayToBase64: () => uint8ArrayToBase64,
|
|
156
|
-
uint8ArrayToBase64url: () => uint8ArrayToBase64url,
|
|
157
|
-
uint8ArrayToHex: () => uint8ArrayToHex,
|
|
158
|
-
unwrapMessage: () => unwrapMessage
|
|
159
|
-
});
|
|
160
|
-
function assertEqual(val) {
|
|
161
|
-
return val;
|
|
162
|
-
}
|
|
163
|
-
function assertNotEqual(val) {
|
|
164
|
-
return val;
|
|
165
|
-
}
|
|
166
|
-
function assertIs(_arg) {
|
|
167
|
-
}
|
|
168
|
-
function assertNever(_x) {
|
|
169
|
-
throw new Error("Unexpected value in exhaustive check");
|
|
170
|
-
}
|
|
171
|
-
function assert(_) {
|
|
172
|
-
}
|
|
173
|
-
function getEnumValues(entries) {
|
|
174
|
-
const numericValues = Object.values(entries).filter((v) => typeof v === "number");
|
|
175
|
-
const values = Object.entries(entries).filter(([k, _]) => numericValues.indexOf(+k) === -1).map(([_, v]) => v);
|
|
176
|
-
return values;
|
|
177
|
-
}
|
|
178
|
-
function joinValues(array2, separator = "|") {
|
|
179
|
-
return array2.map((val) => stringifyPrimitive(val)).join(separator);
|
|
180
|
-
}
|
|
181
88
|
function jsonStringifyReplacer(_, value) {
|
|
182
89
|
if (typeof value === "bigint")
|
|
183
90
|
return value.toString();
|
|
184
91
|
return value;
|
|
185
92
|
}
|
|
186
|
-
function cached(getter) {
|
|
187
|
-
const set = false;
|
|
188
|
-
return {
|
|
189
|
-
get value() {
|
|
190
|
-
if (!set) {
|
|
191
|
-
const value = getter();
|
|
192
|
-
Object.defineProperty(this, "value", { value });
|
|
193
|
-
return value;
|
|
194
|
-
}
|
|
195
|
-
throw new Error("cached value already set");
|
|
196
|
-
}
|
|
197
|
-
};
|
|
198
|
-
}
|
|
199
|
-
function nullish(input) {
|
|
200
|
-
return input === null || input === void 0;
|
|
201
|
-
}
|
|
202
93
|
function cleanRegex(source) {
|
|
203
94
|
const start = source.startsWith("^") ? 1 : 0;
|
|
204
95
|
const end = source.endsWith("$") ? source.length - 1 : source.length;
|
|
205
96
|
return source.slice(start, end);
|
|
206
97
|
}
|
|
207
|
-
function floatSafeRemainder(val, step) {
|
|
208
|
-
const ratio = val / step;
|
|
209
|
-
const roundedRatio = Math.round(ratio);
|
|
210
|
-
const tolerance = Number.EPSILON * Math.max(Math.abs(ratio), 1);
|
|
211
|
-
if (Math.abs(ratio - roundedRatio) < tolerance)
|
|
212
|
-
return 0;
|
|
213
|
-
return ratio - roundedRatio;
|
|
214
|
-
}
|
|
215
98
|
var EVALUATING = /* @__PURE__ */ Symbol("evaluating");
|
|
216
99
|
function defineLazy(object, key, getter) {
|
|
217
100
|
let value = void 0;
|
|
@@ -235,170 +118,8 @@
|
|
|
235
118
|
configurable: true
|
|
236
119
|
});
|
|
237
120
|
}
|
|
238
|
-
function objectClone(obj) {
|
|
239
|
-
return Object.create(Object.getPrototypeOf(obj), Object.getOwnPropertyDescriptors(obj));
|
|
240
|
-
}
|
|
241
|
-
function assignProp(target, prop, value) {
|
|
242
|
-
Object.defineProperty(target, prop, {
|
|
243
|
-
value,
|
|
244
|
-
writable: true,
|
|
245
|
-
enumerable: true,
|
|
246
|
-
configurable: true
|
|
247
|
-
});
|
|
248
|
-
}
|
|
249
|
-
function mergeDefs(...defs) {
|
|
250
|
-
const mergedDescriptors = {};
|
|
251
|
-
for (const def of defs) {
|
|
252
|
-
const descriptors = Object.getOwnPropertyDescriptors(def);
|
|
253
|
-
Object.assign(mergedDescriptors, descriptors);
|
|
254
|
-
}
|
|
255
|
-
return Object.defineProperties({}, mergedDescriptors);
|
|
256
|
-
}
|
|
257
|
-
function cloneDef(schema) {
|
|
258
|
-
return mergeDefs(schema._zod.def);
|
|
259
|
-
}
|
|
260
|
-
function getElementAtPath(obj, path) {
|
|
261
|
-
if (!path)
|
|
262
|
-
return obj;
|
|
263
|
-
return path.reduce((acc, key) => acc?.[key], obj);
|
|
264
|
-
}
|
|
265
|
-
function promiseAllObject(promisesObj) {
|
|
266
|
-
const keys = Object.keys(promisesObj);
|
|
267
|
-
const promises = keys.map((key) => promisesObj[key]);
|
|
268
|
-
return Promise.all(promises).then((results) => {
|
|
269
|
-
const resolvedObj = {};
|
|
270
|
-
for (let i = 0; i < keys.length; i++) {
|
|
271
|
-
resolvedObj[keys[i]] = results[i];
|
|
272
|
-
}
|
|
273
|
-
return resolvedObj;
|
|
274
|
-
});
|
|
275
|
-
}
|
|
276
|
-
function randomString(length = 10) {
|
|
277
|
-
const chars = "abcdefghijklmnopqrstuvwxyz";
|
|
278
|
-
let str = "";
|
|
279
|
-
for (let i = 0; i < length; i++) {
|
|
280
|
-
str += chars[Math.floor(Math.random() * chars.length)];
|
|
281
|
-
}
|
|
282
|
-
return str;
|
|
283
|
-
}
|
|
284
|
-
function esc(str) {
|
|
285
|
-
return JSON.stringify(str);
|
|
286
|
-
}
|
|
287
|
-
function slugify(input) {
|
|
288
|
-
return input.toLowerCase().trim().replace(/[^\w\s-]/g, "").replace(/[\s_-]+/g, "-").replace(/^-+|-+$/g, "");
|
|
289
|
-
}
|
|
290
121
|
var captureStackTrace = "captureStackTrace" in Error ? Error.captureStackTrace : (..._args) => {
|
|
291
122
|
};
|
|
292
|
-
function isObject(data) {
|
|
293
|
-
return typeof data === "object" && data !== null && !Array.isArray(data);
|
|
294
|
-
}
|
|
295
|
-
var allowsEval = /* @__PURE__ */ cached(() => {
|
|
296
|
-
if (globalConfig.jitless) {
|
|
297
|
-
return false;
|
|
298
|
-
}
|
|
299
|
-
if (typeof navigator !== "undefined" && navigator?.userAgent?.includes("Cloudflare")) {
|
|
300
|
-
return false;
|
|
301
|
-
}
|
|
302
|
-
try {
|
|
303
|
-
const F = Function;
|
|
304
|
-
new F("");
|
|
305
|
-
return true;
|
|
306
|
-
} catch (_) {
|
|
307
|
-
return false;
|
|
308
|
-
}
|
|
309
|
-
});
|
|
310
|
-
function isPlainObject(o) {
|
|
311
|
-
if (isObject(o) === false)
|
|
312
|
-
return false;
|
|
313
|
-
const ctor = o.constructor;
|
|
314
|
-
if (ctor === void 0)
|
|
315
|
-
return true;
|
|
316
|
-
if (typeof ctor !== "function")
|
|
317
|
-
return true;
|
|
318
|
-
const prot = ctor.prototype;
|
|
319
|
-
if (isObject(prot) === false)
|
|
320
|
-
return false;
|
|
321
|
-
if (Object.prototype.hasOwnProperty.call(prot, "isPrototypeOf") === false) {
|
|
322
|
-
return false;
|
|
323
|
-
}
|
|
324
|
-
return true;
|
|
325
|
-
}
|
|
326
|
-
function shallowClone(o) {
|
|
327
|
-
if (isPlainObject(o))
|
|
328
|
-
return { ...o };
|
|
329
|
-
if (Array.isArray(o))
|
|
330
|
-
return [...o];
|
|
331
|
-
if (o instanceof Map)
|
|
332
|
-
return new Map(o);
|
|
333
|
-
if (o instanceof Set)
|
|
334
|
-
return new Set(o);
|
|
335
|
-
return o;
|
|
336
|
-
}
|
|
337
|
-
function numKeys(data) {
|
|
338
|
-
let keyCount = 0;
|
|
339
|
-
for (const key in data) {
|
|
340
|
-
if (Object.prototype.hasOwnProperty.call(data, key)) {
|
|
341
|
-
keyCount++;
|
|
342
|
-
}
|
|
343
|
-
}
|
|
344
|
-
return keyCount;
|
|
345
|
-
}
|
|
346
|
-
var getParsedType = (data) => {
|
|
347
|
-
const t = typeof data;
|
|
348
|
-
switch (t) {
|
|
349
|
-
case "undefined":
|
|
350
|
-
return "undefined";
|
|
351
|
-
case "string":
|
|
352
|
-
return "string";
|
|
353
|
-
case "number":
|
|
354
|
-
return Number.isNaN(data) ? "nan" : "number";
|
|
355
|
-
case "boolean":
|
|
356
|
-
return "boolean";
|
|
357
|
-
case "function":
|
|
358
|
-
return "function";
|
|
359
|
-
case "bigint":
|
|
360
|
-
return "bigint";
|
|
361
|
-
case "symbol":
|
|
362
|
-
return "symbol";
|
|
363
|
-
case "object":
|
|
364
|
-
if (Array.isArray(data)) {
|
|
365
|
-
return "array";
|
|
366
|
-
}
|
|
367
|
-
if (data === null) {
|
|
368
|
-
return "null";
|
|
369
|
-
}
|
|
370
|
-
if (data.then && typeof data.then === "function" && data.catch && typeof data.catch === "function") {
|
|
371
|
-
return "promise";
|
|
372
|
-
}
|
|
373
|
-
if (typeof Map !== "undefined" && data instanceof Map) {
|
|
374
|
-
return "map";
|
|
375
|
-
}
|
|
376
|
-
if (typeof Set !== "undefined" && data instanceof Set) {
|
|
377
|
-
return "set";
|
|
378
|
-
}
|
|
379
|
-
if (typeof Date !== "undefined" && data instanceof Date) {
|
|
380
|
-
return "date";
|
|
381
|
-
}
|
|
382
|
-
if (typeof File !== "undefined" && data instanceof File) {
|
|
383
|
-
return "file";
|
|
384
|
-
}
|
|
385
|
-
return "object";
|
|
386
|
-
default:
|
|
387
|
-
throw new Error(`Unknown data type: ${t}`);
|
|
388
|
-
}
|
|
389
|
-
};
|
|
390
|
-
var propertyKeyTypes = /* @__PURE__ */ new Set(["string", "number", "symbol"]);
|
|
391
|
-
var primitiveTypes = /* @__PURE__ */ new Set([
|
|
392
|
-
"string",
|
|
393
|
-
"number",
|
|
394
|
-
"bigint",
|
|
395
|
-
"boolean",
|
|
396
|
-
"symbol",
|
|
397
|
-
"undefined"
|
|
398
|
-
]);
|
|
399
|
-
function escapeRegex(str) {
|
|
400
|
-
return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
401
|
-
}
|
|
402
123
|
function clone(inst, def, params) {
|
|
403
124
|
const cl = new inst._zod.constr(def ?? inst._zod.def);
|
|
404
125
|
if (!def || params?.parent)
|
|
@@ -421,51 +142,6 @@
|
|
|
421
142
|
return { ...params, error: () => params.error };
|
|
422
143
|
return params;
|
|
423
144
|
}
|
|
424
|
-
function createTransparentProxy(getter) {
|
|
425
|
-
let target;
|
|
426
|
-
return new Proxy({}, {
|
|
427
|
-
get(_, prop, receiver) {
|
|
428
|
-
target ?? (target = getter());
|
|
429
|
-
return Reflect.get(target, prop, receiver);
|
|
430
|
-
},
|
|
431
|
-
set(_, prop, value, receiver) {
|
|
432
|
-
target ?? (target = getter());
|
|
433
|
-
return Reflect.set(target, prop, value, receiver);
|
|
434
|
-
},
|
|
435
|
-
has(_, prop) {
|
|
436
|
-
target ?? (target = getter());
|
|
437
|
-
return Reflect.has(target, prop);
|
|
438
|
-
},
|
|
439
|
-
deleteProperty(_, prop) {
|
|
440
|
-
target ?? (target = getter());
|
|
441
|
-
return Reflect.deleteProperty(target, prop);
|
|
442
|
-
},
|
|
443
|
-
ownKeys(_) {
|
|
444
|
-
target ?? (target = getter());
|
|
445
|
-
return Reflect.ownKeys(target);
|
|
446
|
-
},
|
|
447
|
-
getOwnPropertyDescriptor(_, prop) {
|
|
448
|
-
target ?? (target = getter());
|
|
449
|
-
return Reflect.getOwnPropertyDescriptor(target, prop);
|
|
450
|
-
},
|
|
451
|
-
defineProperty(_, prop, descriptor) {
|
|
452
|
-
target ?? (target = getter());
|
|
453
|
-
return Reflect.defineProperty(target, prop, descriptor);
|
|
454
|
-
}
|
|
455
|
-
});
|
|
456
|
-
}
|
|
457
|
-
function stringifyPrimitive(value) {
|
|
458
|
-
if (typeof value === "bigint")
|
|
459
|
-
return value.toString() + "n";
|
|
460
|
-
if (typeof value === "string")
|
|
461
|
-
return `"${value}"`;
|
|
462
|
-
return `${value}`;
|
|
463
|
-
}
|
|
464
|
-
function optionalKeys(shape) {
|
|
465
|
-
return Object.keys(shape).filter((k) => {
|
|
466
|
-
return shape[k]._zod.optin === "optional" && shape[k]._zod.optout === "optional";
|
|
467
|
-
});
|
|
468
|
-
}
|
|
469
145
|
var NUMBER_FORMAT_RANGES = {
|
|
470
146
|
safeint: [Number.MIN_SAFE_INTEGER, Number.MAX_SAFE_INTEGER],
|
|
471
147
|
int32: [-2147483648, 2147483647],
|
|
@@ -473,182 +149,6 @@
|
|
|
473
149
|
float32: [-34028234663852886e22, 34028234663852886e22],
|
|
474
150
|
float64: [-Number.MAX_VALUE, Number.MAX_VALUE]
|
|
475
151
|
};
|
|
476
|
-
var BIGINT_FORMAT_RANGES = {
|
|
477
|
-
int64: [/* @__PURE__ */ BigInt("-9223372036854775808"), /* @__PURE__ */ BigInt("9223372036854775807")],
|
|
478
|
-
uint64: [/* @__PURE__ */ BigInt(0), /* @__PURE__ */ BigInt("18446744073709551615")]
|
|
479
|
-
};
|
|
480
|
-
function pick(schema, mask) {
|
|
481
|
-
const currDef = schema._zod.def;
|
|
482
|
-
const checks = currDef.checks;
|
|
483
|
-
const hasChecks = checks && checks.length > 0;
|
|
484
|
-
if (hasChecks) {
|
|
485
|
-
throw new Error(".pick() cannot be used on object schemas containing refinements");
|
|
486
|
-
}
|
|
487
|
-
const def = mergeDefs(schema._zod.def, {
|
|
488
|
-
get shape() {
|
|
489
|
-
const newShape = {};
|
|
490
|
-
for (const key in mask) {
|
|
491
|
-
if (!(key in currDef.shape)) {
|
|
492
|
-
throw new Error(`Unrecognized key: "${key}"`);
|
|
493
|
-
}
|
|
494
|
-
if (!mask[key])
|
|
495
|
-
continue;
|
|
496
|
-
newShape[key] = currDef.shape[key];
|
|
497
|
-
}
|
|
498
|
-
assignProp(this, "shape", newShape);
|
|
499
|
-
return newShape;
|
|
500
|
-
},
|
|
501
|
-
checks: []
|
|
502
|
-
});
|
|
503
|
-
return clone(schema, def);
|
|
504
|
-
}
|
|
505
|
-
function omit(schema, mask) {
|
|
506
|
-
const currDef = schema._zod.def;
|
|
507
|
-
const checks = currDef.checks;
|
|
508
|
-
const hasChecks = checks && checks.length > 0;
|
|
509
|
-
if (hasChecks) {
|
|
510
|
-
throw new Error(".omit() cannot be used on object schemas containing refinements");
|
|
511
|
-
}
|
|
512
|
-
const def = mergeDefs(schema._zod.def, {
|
|
513
|
-
get shape() {
|
|
514
|
-
const newShape = { ...schema._zod.def.shape };
|
|
515
|
-
for (const key in mask) {
|
|
516
|
-
if (!(key in currDef.shape)) {
|
|
517
|
-
throw new Error(`Unrecognized key: "${key}"`);
|
|
518
|
-
}
|
|
519
|
-
if (!mask[key])
|
|
520
|
-
continue;
|
|
521
|
-
delete newShape[key];
|
|
522
|
-
}
|
|
523
|
-
assignProp(this, "shape", newShape);
|
|
524
|
-
return newShape;
|
|
525
|
-
},
|
|
526
|
-
checks: []
|
|
527
|
-
});
|
|
528
|
-
return clone(schema, def);
|
|
529
|
-
}
|
|
530
|
-
function extend(schema, shape) {
|
|
531
|
-
if (!isPlainObject(shape)) {
|
|
532
|
-
throw new Error("Invalid input to extend: expected a plain object");
|
|
533
|
-
}
|
|
534
|
-
const checks = schema._zod.def.checks;
|
|
535
|
-
const hasChecks = checks && checks.length > 0;
|
|
536
|
-
if (hasChecks) {
|
|
537
|
-
const existingShape = schema._zod.def.shape;
|
|
538
|
-
for (const key in shape) {
|
|
539
|
-
if (Object.getOwnPropertyDescriptor(existingShape, key) !== void 0) {
|
|
540
|
-
throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.");
|
|
541
|
-
}
|
|
542
|
-
}
|
|
543
|
-
}
|
|
544
|
-
const def = mergeDefs(schema._zod.def, {
|
|
545
|
-
get shape() {
|
|
546
|
-
const _shape = { ...schema._zod.def.shape, ...shape };
|
|
547
|
-
assignProp(this, "shape", _shape);
|
|
548
|
-
return _shape;
|
|
549
|
-
}
|
|
550
|
-
});
|
|
551
|
-
return clone(schema, def);
|
|
552
|
-
}
|
|
553
|
-
function safeExtend(schema, shape) {
|
|
554
|
-
if (!isPlainObject(shape)) {
|
|
555
|
-
throw new Error("Invalid input to safeExtend: expected a plain object");
|
|
556
|
-
}
|
|
557
|
-
const def = mergeDefs(schema._zod.def, {
|
|
558
|
-
get shape() {
|
|
559
|
-
const _shape = { ...schema._zod.def.shape, ...shape };
|
|
560
|
-
assignProp(this, "shape", _shape);
|
|
561
|
-
return _shape;
|
|
562
|
-
}
|
|
563
|
-
});
|
|
564
|
-
return clone(schema, def);
|
|
565
|
-
}
|
|
566
|
-
function merge(a, b) {
|
|
567
|
-
if (a._zod.def.checks?.length) {
|
|
568
|
-
throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");
|
|
569
|
-
}
|
|
570
|
-
const def = mergeDefs(a._zod.def, {
|
|
571
|
-
get shape() {
|
|
572
|
-
const _shape = { ...a._zod.def.shape, ...b._zod.def.shape };
|
|
573
|
-
assignProp(this, "shape", _shape);
|
|
574
|
-
return _shape;
|
|
575
|
-
},
|
|
576
|
-
get catchall() {
|
|
577
|
-
return b._zod.def.catchall;
|
|
578
|
-
},
|
|
579
|
-
checks: b._zod.def.checks ?? []
|
|
580
|
-
});
|
|
581
|
-
return clone(a, def);
|
|
582
|
-
}
|
|
583
|
-
function partial(Class2, schema, mask) {
|
|
584
|
-
const currDef = schema._zod.def;
|
|
585
|
-
const checks = currDef.checks;
|
|
586
|
-
const hasChecks = checks && checks.length > 0;
|
|
587
|
-
if (hasChecks) {
|
|
588
|
-
throw new Error(".partial() cannot be used on object schemas containing refinements");
|
|
589
|
-
}
|
|
590
|
-
const def = mergeDefs(schema._zod.def, {
|
|
591
|
-
get shape() {
|
|
592
|
-
const oldShape = schema._zod.def.shape;
|
|
593
|
-
const shape = { ...oldShape };
|
|
594
|
-
if (mask) {
|
|
595
|
-
for (const key in mask) {
|
|
596
|
-
if (!(key in oldShape)) {
|
|
597
|
-
throw new Error(`Unrecognized key: "${key}"`);
|
|
598
|
-
}
|
|
599
|
-
if (!mask[key])
|
|
600
|
-
continue;
|
|
601
|
-
shape[key] = Class2 ? new Class2({
|
|
602
|
-
type: "optional",
|
|
603
|
-
innerType: oldShape[key]
|
|
604
|
-
}) : oldShape[key];
|
|
605
|
-
}
|
|
606
|
-
} else {
|
|
607
|
-
for (const key in oldShape) {
|
|
608
|
-
shape[key] = Class2 ? new Class2({
|
|
609
|
-
type: "optional",
|
|
610
|
-
innerType: oldShape[key]
|
|
611
|
-
}) : oldShape[key];
|
|
612
|
-
}
|
|
613
|
-
}
|
|
614
|
-
assignProp(this, "shape", shape);
|
|
615
|
-
return shape;
|
|
616
|
-
},
|
|
617
|
-
checks: []
|
|
618
|
-
});
|
|
619
|
-
return clone(schema, def);
|
|
620
|
-
}
|
|
621
|
-
function required(Class2, schema, mask) {
|
|
622
|
-
const def = mergeDefs(schema._zod.def, {
|
|
623
|
-
get shape() {
|
|
624
|
-
const oldShape = schema._zod.def.shape;
|
|
625
|
-
const shape = { ...oldShape };
|
|
626
|
-
if (mask) {
|
|
627
|
-
for (const key in mask) {
|
|
628
|
-
if (!(key in shape)) {
|
|
629
|
-
throw new Error(`Unrecognized key: "${key}"`);
|
|
630
|
-
}
|
|
631
|
-
if (!mask[key])
|
|
632
|
-
continue;
|
|
633
|
-
shape[key] = new Class2({
|
|
634
|
-
type: "nonoptional",
|
|
635
|
-
innerType: oldShape[key]
|
|
636
|
-
});
|
|
637
|
-
}
|
|
638
|
-
} else {
|
|
639
|
-
for (const key in oldShape) {
|
|
640
|
-
shape[key] = new Class2({
|
|
641
|
-
type: "nonoptional",
|
|
642
|
-
innerType: oldShape[key]
|
|
643
|
-
});
|
|
644
|
-
}
|
|
645
|
-
}
|
|
646
|
-
assignProp(this, "shape", shape);
|
|
647
|
-
return shape;
|
|
648
|
-
}
|
|
649
|
-
});
|
|
650
|
-
return clone(schema, def);
|
|
651
|
-
}
|
|
652
152
|
function aborted(x, startIndex = 0) {
|
|
653
153
|
if (x.aborted === true)
|
|
654
154
|
return true;
|
|
@@ -669,14 +169,6 @@
|
|
|
669
169
|
}
|
|
670
170
|
return false;
|
|
671
171
|
}
|
|
672
|
-
function prefixIssues(path, issues) {
|
|
673
|
-
return issues.map((iss) => {
|
|
674
|
-
var _a4;
|
|
675
|
-
(_a4 = iss).path ?? (_a4.path = []);
|
|
676
|
-
iss.path.unshift(path);
|
|
677
|
-
return iss;
|
|
678
|
-
});
|
|
679
|
-
}
|
|
680
172
|
function unwrapMessage(message) {
|
|
681
173
|
return typeof message === "string" ? message : message?.message;
|
|
682
174
|
}
|
|
@@ -690,43 +182,6 @@
|
|
|
690
182
|
}
|
|
691
183
|
return rest;
|
|
692
184
|
}
|
|
693
|
-
function getSizableOrigin(input) {
|
|
694
|
-
if (input instanceof Set)
|
|
695
|
-
return "set";
|
|
696
|
-
if (input instanceof Map)
|
|
697
|
-
return "map";
|
|
698
|
-
if (input instanceof File)
|
|
699
|
-
return "file";
|
|
700
|
-
return "unknown";
|
|
701
|
-
}
|
|
702
|
-
function getLengthableOrigin(input) {
|
|
703
|
-
if (Array.isArray(input))
|
|
704
|
-
return "array";
|
|
705
|
-
if (typeof input === "string")
|
|
706
|
-
return "string";
|
|
707
|
-
return "unknown";
|
|
708
|
-
}
|
|
709
|
-
function parsedType(data) {
|
|
710
|
-
const t = typeof data;
|
|
711
|
-
switch (t) {
|
|
712
|
-
case "number": {
|
|
713
|
-
return Number.isNaN(data) ? "nan" : "number";
|
|
714
|
-
}
|
|
715
|
-
case "object": {
|
|
716
|
-
if (data === null) {
|
|
717
|
-
return "null";
|
|
718
|
-
}
|
|
719
|
-
if (Array.isArray(data)) {
|
|
720
|
-
return "array";
|
|
721
|
-
}
|
|
722
|
-
const obj = data;
|
|
723
|
-
if (obj && Object.getPrototypeOf(obj) !== Object.prototype && "constructor" in obj && obj.constructor) {
|
|
724
|
-
return obj.constructor.name;
|
|
725
|
-
}
|
|
726
|
-
}
|
|
727
|
-
}
|
|
728
|
-
return t;
|
|
729
|
-
}
|
|
730
185
|
function issue(...args) {
|
|
731
186
|
const [iss, input, inst] = args;
|
|
732
187
|
if (typeof iss === "string") {
|
|
@@ -739,52 +194,6 @@
|
|
|
739
194
|
}
|
|
740
195
|
return { ...iss };
|
|
741
196
|
}
|
|
742
|
-
function cleanEnum(obj) {
|
|
743
|
-
return Object.entries(obj).filter(([k, _]) => {
|
|
744
|
-
return Number.isNaN(Number.parseInt(k, 10));
|
|
745
|
-
}).map((el) => el[1]);
|
|
746
|
-
}
|
|
747
|
-
function base64ToUint8Array(base642) {
|
|
748
|
-
const binaryString = atob(base642);
|
|
749
|
-
const bytes = new Uint8Array(binaryString.length);
|
|
750
|
-
for (let i = 0; i < binaryString.length; i++) {
|
|
751
|
-
bytes[i] = binaryString.charCodeAt(i);
|
|
752
|
-
}
|
|
753
|
-
return bytes;
|
|
754
|
-
}
|
|
755
|
-
function uint8ArrayToBase64(bytes) {
|
|
756
|
-
let binaryString = "";
|
|
757
|
-
for (let i = 0; i < bytes.length; i++) {
|
|
758
|
-
binaryString += String.fromCharCode(bytes[i]);
|
|
759
|
-
}
|
|
760
|
-
return btoa(binaryString);
|
|
761
|
-
}
|
|
762
|
-
function base64urlToUint8Array(base64url2) {
|
|
763
|
-
const base642 = base64url2.replace(/-/g, "+").replace(/_/g, "/");
|
|
764
|
-
const padding = "=".repeat((4 - base642.length % 4) % 4);
|
|
765
|
-
return base64ToUint8Array(base642 + padding);
|
|
766
|
-
}
|
|
767
|
-
function uint8ArrayToBase64url(bytes) {
|
|
768
|
-
return uint8ArrayToBase64(bytes).replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
|
|
769
|
-
}
|
|
770
|
-
function hexToUint8Array(hex) {
|
|
771
|
-
const cleanHex = hex.replace(/^0x/, "");
|
|
772
|
-
if (cleanHex.length % 2 !== 0) {
|
|
773
|
-
throw new Error("Invalid hex string length");
|
|
774
|
-
}
|
|
775
|
-
const bytes = new Uint8Array(cleanHex.length / 2);
|
|
776
|
-
for (let i = 0; i < cleanHex.length; i += 2) {
|
|
777
|
-
bytes[i / 2] = Number.parseInt(cleanHex.slice(i, i + 2), 16);
|
|
778
|
-
}
|
|
779
|
-
return bytes;
|
|
780
|
-
}
|
|
781
|
-
function uint8ArrayToHex(bytes) {
|
|
782
|
-
return Array.from(bytes).map((b) => b.toString(16).padStart(2, "0")).join("");
|
|
783
|
-
}
|
|
784
|
-
var Class = class {
|
|
785
|
-
constructor(..._args) {
|
|
786
|
-
}
|
|
787
|
-
};
|
|
788
197
|
|
|
789
198
|
// ../../../../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/errors.js
|
|
790
199
|
var initializer = (inst, def) => {
|
|
@@ -805,55 +214,6 @@
|
|
|
805
214
|
};
|
|
806
215
|
var $ZodError = $constructor("$ZodError", initializer);
|
|
807
216
|
var $ZodRealError = $constructor("$ZodError", initializer, { Parent: Error });
|
|
808
|
-
function flattenError(error, mapper = (issue2) => issue2.message) {
|
|
809
|
-
const fieldErrors = {};
|
|
810
|
-
const formErrors = [];
|
|
811
|
-
for (const sub of error.issues) {
|
|
812
|
-
if (sub.path.length > 0) {
|
|
813
|
-
fieldErrors[sub.path[0]] = fieldErrors[sub.path[0]] || [];
|
|
814
|
-
fieldErrors[sub.path[0]].push(mapper(sub));
|
|
815
|
-
} else {
|
|
816
|
-
formErrors.push(mapper(sub));
|
|
817
|
-
}
|
|
818
|
-
}
|
|
819
|
-
return { formErrors, fieldErrors };
|
|
820
|
-
}
|
|
821
|
-
function formatError(error, mapper = (issue2) => issue2.message) {
|
|
822
|
-
const fieldErrors = { _errors: [] };
|
|
823
|
-
const processError = (error2, path = []) => {
|
|
824
|
-
for (const issue2 of error2.issues) {
|
|
825
|
-
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
826
|
-
issue2.errors.map((issues) => processError({ issues }, [...path, ...issue2.path]));
|
|
827
|
-
} else if (issue2.code === "invalid_key") {
|
|
828
|
-
processError({ issues: issue2.issues }, [...path, ...issue2.path]);
|
|
829
|
-
} else if (issue2.code === "invalid_element") {
|
|
830
|
-
processError({ issues: issue2.issues }, [...path, ...issue2.path]);
|
|
831
|
-
} else {
|
|
832
|
-
const fullpath = [...path, ...issue2.path];
|
|
833
|
-
if (fullpath.length === 0) {
|
|
834
|
-
fieldErrors._errors.push(mapper(issue2));
|
|
835
|
-
} else {
|
|
836
|
-
let curr = fieldErrors;
|
|
837
|
-
let i = 0;
|
|
838
|
-
while (i < fullpath.length) {
|
|
839
|
-
const el = fullpath[i];
|
|
840
|
-
const terminal = i === fullpath.length - 1;
|
|
841
|
-
if (!terminal) {
|
|
842
|
-
curr[el] = curr[el] || { _errors: [] };
|
|
843
|
-
} else {
|
|
844
|
-
curr[el] = curr[el] || { _errors: [] };
|
|
845
|
-
curr[el]._errors.push(mapper(issue2));
|
|
846
|
-
}
|
|
847
|
-
curr = curr[el];
|
|
848
|
-
i++;
|
|
849
|
-
}
|
|
850
|
-
}
|
|
851
|
-
}
|
|
852
|
-
}
|
|
853
|
-
};
|
|
854
|
-
processError(error);
|
|
855
|
-
return fieldErrors;
|
|
856
|
-
}
|
|
857
217
|
|
|
858
218
|
// ../../../../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/parse.js
|
|
859
219
|
var _parse = (_Err) => (schema, value, _ctx, _params) => {
|
|
@@ -869,6 +229,7 @@
|
|
|
869
229
|
}
|
|
870
230
|
return result.value;
|
|
871
231
|
};
|
|
232
|
+
var parse = /* @__PURE__ */ _parse($ZodRealError);
|
|
872
233
|
var _parseAsync = (_Err) => async (schema, value, _ctx, params) => {
|
|
873
234
|
const ctx = _ctx ? { ..._ctx, async: true } : { async: true };
|
|
874
235
|
let result = schema._zod.run({ value, issues: [] }, ctx);
|
|
@@ -881,6 +242,7 @@
|
|
|
881
242
|
}
|
|
882
243
|
return result.value;
|
|
883
244
|
};
|
|
245
|
+
var parseAsync = /* @__PURE__ */ _parseAsync($ZodRealError);
|
|
884
246
|
var _safeParse = (_Err) => (schema, value, _ctx) => {
|
|
885
247
|
const ctx = _ctx ? { ..._ctx, async: false } : { async: false };
|
|
886
248
|
const result = schema._zod.run({ value, issues: [] }, ctx);
|
|
@@ -904,132 +266,29 @@
|
|
|
904
266
|
} : { success: true, data: result.value };
|
|
905
267
|
};
|
|
906
268
|
var safeParseAsync = /* @__PURE__ */ _safeParseAsync($ZodRealError);
|
|
907
|
-
var _encode = (_Err) => (schema, value, _ctx) => {
|
|
908
|
-
const ctx = _ctx ? { ..._ctx, direction: "backward" } : { direction: "backward" };
|
|
909
|
-
return _parse(_Err)(schema, value, ctx);
|
|
910
|
-
};
|
|
911
|
-
var _decode = (_Err) => (schema, value, _ctx) => {
|
|
912
|
-
return _parse(_Err)(schema, value, _ctx);
|
|
913
|
-
};
|
|
914
|
-
var _encodeAsync = (_Err) => async (schema, value, _ctx) => {
|
|
915
|
-
const ctx = _ctx ? { ..._ctx, direction: "backward" } : { direction: "backward" };
|
|
916
|
-
return _parseAsync(_Err)(schema, value, ctx);
|
|
917
|
-
};
|
|
918
|
-
var _decodeAsync = (_Err) => async (schema, value, _ctx) => {
|
|
919
|
-
return _parseAsync(_Err)(schema, value, _ctx);
|
|
920
|
-
};
|
|
921
|
-
var _safeEncode = (_Err) => (schema, value, _ctx) => {
|
|
922
|
-
const ctx = _ctx ? { ..._ctx, direction: "backward" } : { direction: "backward" };
|
|
923
|
-
return _safeParse(_Err)(schema, value, ctx);
|
|
924
|
-
};
|
|
925
|
-
var _safeDecode = (_Err) => (schema, value, _ctx) => {
|
|
926
|
-
return _safeParse(_Err)(schema, value, _ctx);
|
|
927
|
-
};
|
|
928
|
-
var _safeEncodeAsync = (_Err) => async (schema, value, _ctx) => {
|
|
929
|
-
const ctx = _ctx ? { ..._ctx, direction: "backward" } : { direction: "backward" };
|
|
930
|
-
return _safeParseAsync(_Err)(schema, value, ctx);
|
|
931
|
-
};
|
|
932
|
-
var _safeDecodeAsync = (_Err) => async (schema, value, _ctx) => {
|
|
933
|
-
return _safeParseAsync(_Err)(schema, value, _ctx);
|
|
934
|
-
};
|
|
935
269
|
|
|
936
270
|
// ../../../../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/regexes.js
|
|
937
|
-
var cuid = /^[cC][0-9a-z]{6,}$/;
|
|
938
|
-
var cuid2 = /^[0-9a-z]+$/;
|
|
939
|
-
var ulid = /^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/;
|
|
940
|
-
var xid = /^[0-9a-vA-V]{20}$/;
|
|
941
|
-
var ksuid = /^[A-Za-z0-9]{27}$/;
|
|
942
|
-
var nanoid = /^[a-zA-Z0-9_-]{21}$/;
|
|
943
|
-
var duration = /^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;
|
|
944
|
-
var guid = /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/;
|
|
945
|
-
var uuid = (version2) => {
|
|
946
|
-
if (!version2)
|
|
947
|
-
return /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;
|
|
948
|
-
return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${version2}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`);
|
|
949
|
-
};
|
|
950
|
-
var email = /^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;
|
|
951
|
-
var _emoji = `^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;
|
|
952
|
-
function emoji() {
|
|
953
|
-
return new RegExp(_emoji, "u");
|
|
954
|
-
}
|
|
955
|
-
var ipv4 = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/;
|
|
956
|
-
var ipv6 = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/;
|
|
957
|
-
var cidrv4 = /^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/;
|
|
958
|
-
var cidrv6 = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/;
|
|
959
|
-
var base64 = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/;
|
|
960
|
-
var base64url = /^[A-Za-z0-9_-]*$/;
|
|
961
|
-
var httpProtocol = /^https?$/;
|
|
962
|
-
var e164 = /^\+[1-9]\d{6,14}$/;
|
|
963
271
|
var dateSource = `(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`;
|
|
964
272
|
var date = /* @__PURE__ */ new RegExp(`^${dateSource}$`);
|
|
965
|
-
function timeSource(args) {
|
|
966
|
-
const hhmm = `(?:[01]\\d|2[0-3]):[0-5]\\d`;
|
|
967
|
-
const regex = typeof args.precision === "number" ? args.precision === -1 ? `${hhmm}` : args.precision === 0 ? `${hhmm}:[0-5]\\d` : `${hhmm}:[0-5]\\d\\.\\d{${args.precision}}` : `${hhmm}(?::[0-5]\\d(?:\\.\\d+)?)?`;
|
|
968
|
-
return regex;
|
|
969
|
-
}
|
|
970
|
-
function time(args) {
|
|
971
|
-
return new RegExp(`^${timeSource(args)}$`);
|
|
972
|
-
}
|
|
973
|
-
function datetime(args) {
|
|
974
|
-
const time3 = timeSource({ precision: args.precision });
|
|
975
|
-
const opts = ["Z"];
|
|
976
|
-
if (args.local)
|
|
977
|
-
opts.push("");
|
|
978
|
-
if (args.offset)
|
|
979
|
-
opts.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);
|
|
980
|
-
const timeRegex = `${time3}(?:${opts.join("|")})`;
|
|
981
|
-
return new RegExp(`^${dateSource}T(?:${timeRegex})$`);
|
|
982
|
-
}
|
|
983
273
|
var string = (params) => {
|
|
984
274
|
const regex = params ? `[\\s\\S]{${params?.minimum ?? 0},${params?.maximum ?? ""}}` : `[\\s\\S]*`;
|
|
985
275
|
return new RegExp(`^${regex}$`);
|
|
986
276
|
};
|
|
987
277
|
var bigint = /^-?\d+n?$/;
|
|
988
|
-
var integer = /^-?\d+$/;
|
|
989
278
|
var number = /^-?\d+(?:\.\d+)?$/;
|
|
990
|
-
var lowercase = /^[^A-Z]*$/;
|
|
991
|
-
var uppercase = /^[^a-z]*$/;
|
|
992
279
|
|
|
993
280
|
// ../../../../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/checks.js
|
|
994
281
|
var $ZodCheck = /* @__PURE__ */ $constructor("$ZodCheck", (inst, def) => {
|
|
995
|
-
var
|
|
282
|
+
var _a3;
|
|
996
283
|
inst._zod ?? (inst._zod = {});
|
|
997
284
|
inst._zod.def = def;
|
|
998
|
-
(
|
|
285
|
+
(_a3 = inst._zod).onattach ?? (_a3.onattach = []);
|
|
999
286
|
});
|
|
1000
287
|
var numericOriginMap = {
|
|
1001
288
|
number: "number",
|
|
1002
289
|
bigint: "bigint",
|
|
1003
290
|
object: "date"
|
|
1004
291
|
};
|
|
1005
|
-
var $ZodCheckLessThan = /* @__PURE__ */ $constructor("$ZodCheckLessThan", (inst, def) => {
|
|
1006
|
-
$ZodCheck.init(inst, def);
|
|
1007
|
-
const origin = numericOriginMap[typeof def.value];
|
|
1008
|
-
inst._zod.onattach.push((inst2) => {
|
|
1009
|
-
const bag = inst2._zod.bag;
|
|
1010
|
-
const curr = (def.inclusive ? bag.maximum : bag.exclusiveMaximum) ?? Number.POSITIVE_INFINITY;
|
|
1011
|
-
if (def.value < curr) {
|
|
1012
|
-
if (def.inclusive)
|
|
1013
|
-
bag.maximum = def.value;
|
|
1014
|
-
else
|
|
1015
|
-
bag.exclusiveMaximum = def.value;
|
|
1016
|
-
}
|
|
1017
|
-
});
|
|
1018
|
-
inst._zod.check = (payload) => {
|
|
1019
|
-
if (def.inclusive ? payload.value <= def.value : payload.value < def.value) {
|
|
1020
|
-
return;
|
|
1021
|
-
}
|
|
1022
|
-
payload.issues.push({
|
|
1023
|
-
origin,
|
|
1024
|
-
code: "too_big",
|
|
1025
|
-
maximum: typeof def.value === "object" ? def.value.getTime() : def.value,
|
|
1026
|
-
input: payload.value,
|
|
1027
|
-
inclusive: def.inclusive,
|
|
1028
|
-
inst,
|
|
1029
|
-
continue: !def.abort
|
|
1030
|
-
});
|
|
1031
|
-
};
|
|
1032
|
-
});
|
|
1033
292
|
var $ZodCheckGreaterThan = /* @__PURE__ */ $constructor("$ZodCheckGreaterThan", (inst, def) => {
|
|
1034
293
|
$ZodCheck.init(inst, def);
|
|
1035
294
|
const origin = numericOriginMap[typeof def.value];
|
|
@@ -1058,231 +317,41 @@
|
|
|
1058
317
|
});
|
|
1059
318
|
};
|
|
1060
319
|
});
|
|
1061
|
-
var $
|
|
1062
|
-
|
|
1063
|
-
inst._zod.onattach.push((inst2) => {
|
|
1064
|
-
var _a4;
|
|
1065
|
-
(_a4 = inst2._zod.bag).multipleOf ?? (_a4.multipleOf = def.value);
|
|
1066
|
-
});
|
|
1067
|
-
inst._zod.check = (payload) => {
|
|
1068
|
-
if (typeof payload.value !== typeof def.value)
|
|
1069
|
-
throw new Error("Cannot mix number and bigint in multiple_of check.");
|
|
1070
|
-
const isMultiple = typeof payload.value === "bigint" ? payload.value % def.value === BigInt(0) : floatSafeRemainder(payload.value, def.value) === 0;
|
|
1071
|
-
if (isMultiple)
|
|
1072
|
-
return;
|
|
1073
|
-
payload.issues.push({
|
|
1074
|
-
origin: typeof payload.value,
|
|
1075
|
-
code: "not_multiple_of",
|
|
1076
|
-
divisor: def.value,
|
|
1077
|
-
input: payload.value,
|
|
1078
|
-
inst,
|
|
1079
|
-
continue: !def.abort
|
|
1080
|
-
});
|
|
1081
|
-
};
|
|
1082
|
-
});
|
|
1083
|
-
var $ZodCheckNumberFormat = /* @__PURE__ */ $constructor("$ZodCheckNumberFormat", (inst, def) => {
|
|
320
|
+
var $ZodCheckStringFormat = /* @__PURE__ */ $constructor("$ZodCheckStringFormat", (inst, def) => {
|
|
321
|
+
var _a3, _b;
|
|
1084
322
|
$ZodCheck.init(inst, def);
|
|
1085
|
-
def.format = def.format || "float64";
|
|
1086
|
-
const isInt = def.format?.includes("int");
|
|
1087
|
-
const origin = isInt ? "int" : "number";
|
|
1088
|
-
const [minimum, maximum] = NUMBER_FORMAT_RANGES[def.format];
|
|
1089
323
|
inst._zod.onattach.push((inst2) => {
|
|
1090
324
|
const bag = inst2._zod.bag;
|
|
1091
325
|
bag.format = def.format;
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
326
|
+
if (def.pattern) {
|
|
327
|
+
bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
|
|
328
|
+
bag.patterns.add(def.pattern);
|
|
329
|
+
}
|
|
1096
330
|
});
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
if (
|
|
1101
|
-
payload.issues.push({
|
|
1102
|
-
expected: origin,
|
|
1103
|
-
format: def.format,
|
|
1104
|
-
code: "invalid_type",
|
|
1105
|
-
continue: false,
|
|
1106
|
-
input,
|
|
1107
|
-
inst
|
|
1108
|
-
});
|
|
1109
|
-
return;
|
|
1110
|
-
}
|
|
1111
|
-
if (!Number.isSafeInteger(input)) {
|
|
1112
|
-
if (input > 0) {
|
|
1113
|
-
payload.issues.push({
|
|
1114
|
-
input,
|
|
1115
|
-
code: "too_big",
|
|
1116
|
-
maximum: Number.MAX_SAFE_INTEGER,
|
|
1117
|
-
note: "Integers must be within the safe integer range.",
|
|
1118
|
-
inst,
|
|
1119
|
-
origin,
|
|
1120
|
-
inclusive: true,
|
|
1121
|
-
continue: !def.abort
|
|
1122
|
-
});
|
|
1123
|
-
} else {
|
|
1124
|
-
payload.issues.push({
|
|
1125
|
-
input,
|
|
1126
|
-
code: "too_small",
|
|
1127
|
-
minimum: Number.MIN_SAFE_INTEGER,
|
|
1128
|
-
note: "Integers must be within the safe integer range.",
|
|
1129
|
-
inst,
|
|
1130
|
-
origin,
|
|
1131
|
-
inclusive: true,
|
|
1132
|
-
continue: !def.abort
|
|
1133
|
-
});
|
|
1134
|
-
}
|
|
331
|
+
if (def.pattern)
|
|
332
|
+
(_a3 = inst._zod).check ?? (_a3.check = (payload) => {
|
|
333
|
+
def.pattern.lastIndex = 0;
|
|
334
|
+
if (def.pattern.test(payload.value))
|
|
1135
335
|
return;
|
|
1136
|
-
}
|
|
1137
|
-
}
|
|
1138
|
-
if (input < minimum) {
|
|
1139
|
-
payload.issues.push({
|
|
1140
|
-
origin: "number",
|
|
1141
|
-
input,
|
|
1142
|
-
code: "too_small",
|
|
1143
|
-
minimum,
|
|
1144
|
-
inclusive: true,
|
|
1145
|
-
inst,
|
|
1146
|
-
continue: !def.abort
|
|
1147
|
-
});
|
|
1148
|
-
}
|
|
1149
|
-
if (input > maximum) {
|
|
1150
336
|
payload.issues.push({
|
|
1151
|
-
origin: "
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
337
|
+
origin: "string",
|
|
338
|
+
code: "invalid_format",
|
|
339
|
+
format: def.format,
|
|
340
|
+
input: payload.value,
|
|
341
|
+
...def.pattern ? { pattern: def.pattern.toString() } : {},
|
|
1156
342
|
inst,
|
|
1157
343
|
continue: !def.abort
|
|
1158
344
|
});
|
|
1159
|
-
}
|
|
1160
|
-
|
|
345
|
+
});
|
|
346
|
+
else
|
|
347
|
+
(_b = inst._zod).check ?? (_b.check = () => {
|
|
348
|
+
});
|
|
1161
349
|
});
|
|
1162
|
-
var $
|
|
1163
|
-
|
|
1164
|
-
$ZodCheck.init(inst, def);
|
|
1165
|
-
(_a4 = inst._zod.def).when ?? (_a4.when = (payload) => {
|
|
1166
|
-
const val = payload.value;
|
|
1167
|
-
return !nullish(val) && val.length !== void 0;
|
|
1168
|
-
});
|
|
1169
|
-
inst._zod.onattach.push((inst2) => {
|
|
1170
|
-
const curr = inst2._zod.bag.maximum ?? Number.POSITIVE_INFINITY;
|
|
1171
|
-
if (def.maximum < curr)
|
|
1172
|
-
inst2._zod.bag.maximum = def.maximum;
|
|
1173
|
-
});
|
|
350
|
+
var $ZodCheckRegex = /* @__PURE__ */ $constructor("$ZodCheckRegex", (inst, def) => {
|
|
351
|
+
$ZodCheckStringFormat.init(inst, def);
|
|
1174
352
|
inst._zod.check = (payload) => {
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
if (length <= def.maximum)
|
|
1178
|
-
return;
|
|
1179
|
-
const origin = getLengthableOrigin(input);
|
|
1180
|
-
payload.issues.push({
|
|
1181
|
-
origin,
|
|
1182
|
-
code: "too_big",
|
|
1183
|
-
maximum: def.maximum,
|
|
1184
|
-
inclusive: true,
|
|
1185
|
-
input,
|
|
1186
|
-
inst,
|
|
1187
|
-
continue: !def.abort
|
|
1188
|
-
});
|
|
1189
|
-
};
|
|
1190
|
-
});
|
|
1191
|
-
var $ZodCheckMinLength = /* @__PURE__ */ $constructor("$ZodCheckMinLength", (inst, def) => {
|
|
1192
|
-
var _a4;
|
|
1193
|
-
$ZodCheck.init(inst, def);
|
|
1194
|
-
(_a4 = inst._zod.def).when ?? (_a4.when = (payload) => {
|
|
1195
|
-
const val = payload.value;
|
|
1196
|
-
return !nullish(val) && val.length !== void 0;
|
|
1197
|
-
});
|
|
1198
|
-
inst._zod.onattach.push((inst2) => {
|
|
1199
|
-
const curr = inst2._zod.bag.minimum ?? Number.NEGATIVE_INFINITY;
|
|
1200
|
-
if (def.minimum > curr)
|
|
1201
|
-
inst2._zod.bag.minimum = def.minimum;
|
|
1202
|
-
});
|
|
1203
|
-
inst._zod.check = (payload) => {
|
|
1204
|
-
const input = payload.value;
|
|
1205
|
-
const length = input.length;
|
|
1206
|
-
if (length >= def.minimum)
|
|
1207
|
-
return;
|
|
1208
|
-
const origin = getLengthableOrigin(input);
|
|
1209
|
-
payload.issues.push({
|
|
1210
|
-
origin,
|
|
1211
|
-
code: "too_small",
|
|
1212
|
-
minimum: def.minimum,
|
|
1213
|
-
inclusive: true,
|
|
1214
|
-
input,
|
|
1215
|
-
inst,
|
|
1216
|
-
continue: !def.abort
|
|
1217
|
-
});
|
|
1218
|
-
};
|
|
1219
|
-
});
|
|
1220
|
-
var $ZodCheckLengthEquals = /* @__PURE__ */ $constructor("$ZodCheckLengthEquals", (inst, def) => {
|
|
1221
|
-
var _a4;
|
|
1222
|
-
$ZodCheck.init(inst, def);
|
|
1223
|
-
(_a4 = inst._zod.def).when ?? (_a4.when = (payload) => {
|
|
1224
|
-
const val = payload.value;
|
|
1225
|
-
return !nullish(val) && val.length !== void 0;
|
|
1226
|
-
});
|
|
1227
|
-
inst._zod.onattach.push((inst2) => {
|
|
1228
|
-
const bag = inst2._zod.bag;
|
|
1229
|
-
bag.minimum = def.length;
|
|
1230
|
-
bag.maximum = def.length;
|
|
1231
|
-
bag.length = def.length;
|
|
1232
|
-
});
|
|
1233
|
-
inst._zod.check = (payload) => {
|
|
1234
|
-
const input = payload.value;
|
|
1235
|
-
const length = input.length;
|
|
1236
|
-
if (length === def.length)
|
|
1237
|
-
return;
|
|
1238
|
-
const origin = getLengthableOrigin(input);
|
|
1239
|
-
const tooBig = length > def.length;
|
|
1240
|
-
payload.issues.push({
|
|
1241
|
-
origin,
|
|
1242
|
-
...tooBig ? { code: "too_big", maximum: def.length } : { code: "too_small", minimum: def.length },
|
|
1243
|
-
inclusive: true,
|
|
1244
|
-
exact: true,
|
|
1245
|
-
input: payload.value,
|
|
1246
|
-
inst,
|
|
1247
|
-
continue: !def.abort
|
|
1248
|
-
});
|
|
1249
|
-
};
|
|
1250
|
-
});
|
|
1251
|
-
var $ZodCheckStringFormat = /* @__PURE__ */ $constructor("$ZodCheckStringFormat", (inst, def) => {
|
|
1252
|
-
var _a4, _b;
|
|
1253
|
-
$ZodCheck.init(inst, def);
|
|
1254
|
-
inst._zod.onattach.push((inst2) => {
|
|
1255
|
-
const bag = inst2._zod.bag;
|
|
1256
|
-
bag.format = def.format;
|
|
1257
|
-
if (def.pattern) {
|
|
1258
|
-
bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
|
|
1259
|
-
bag.patterns.add(def.pattern);
|
|
1260
|
-
}
|
|
1261
|
-
});
|
|
1262
|
-
if (def.pattern)
|
|
1263
|
-
(_a4 = inst._zod).check ?? (_a4.check = (payload) => {
|
|
1264
|
-
def.pattern.lastIndex = 0;
|
|
1265
|
-
if (def.pattern.test(payload.value))
|
|
1266
|
-
return;
|
|
1267
|
-
payload.issues.push({
|
|
1268
|
-
origin: "string",
|
|
1269
|
-
code: "invalid_format",
|
|
1270
|
-
format: def.format,
|
|
1271
|
-
input: payload.value,
|
|
1272
|
-
...def.pattern ? { pattern: def.pattern.toString() } : {},
|
|
1273
|
-
inst,
|
|
1274
|
-
continue: !def.abort
|
|
1275
|
-
});
|
|
1276
|
-
});
|
|
1277
|
-
else
|
|
1278
|
-
(_b = inst._zod).check ?? (_b.check = () => {
|
|
1279
|
-
});
|
|
1280
|
-
});
|
|
1281
|
-
var $ZodCheckRegex = /* @__PURE__ */ $constructor("$ZodCheckRegex", (inst, def) => {
|
|
1282
|
-
$ZodCheckStringFormat.init(inst, def);
|
|
1283
|
-
inst._zod.check = (payload) => {
|
|
1284
|
-
def.pattern.lastIndex = 0;
|
|
1285
|
-
if (def.pattern.test(payload.value))
|
|
353
|
+
def.pattern.lastIndex = 0;
|
|
354
|
+
if (def.pattern.test(payload.value))
|
|
1286
355
|
return;
|
|
1287
356
|
payload.issues.push({
|
|
1288
357
|
origin: "string",
|
|
@@ -1295,90 +364,6 @@
|
|
|
1295
364
|
});
|
|
1296
365
|
};
|
|
1297
366
|
});
|
|
1298
|
-
var $ZodCheckLowerCase = /* @__PURE__ */ $constructor("$ZodCheckLowerCase", (inst, def) => {
|
|
1299
|
-
def.pattern ?? (def.pattern = lowercase);
|
|
1300
|
-
$ZodCheckStringFormat.init(inst, def);
|
|
1301
|
-
});
|
|
1302
|
-
var $ZodCheckUpperCase = /* @__PURE__ */ $constructor("$ZodCheckUpperCase", (inst, def) => {
|
|
1303
|
-
def.pattern ?? (def.pattern = uppercase);
|
|
1304
|
-
$ZodCheckStringFormat.init(inst, def);
|
|
1305
|
-
});
|
|
1306
|
-
var $ZodCheckIncludes = /* @__PURE__ */ $constructor("$ZodCheckIncludes", (inst, def) => {
|
|
1307
|
-
$ZodCheck.init(inst, def);
|
|
1308
|
-
const escapedRegex = escapeRegex(def.includes);
|
|
1309
|
-
const pattern = new RegExp(typeof def.position === "number" ? `^.{${def.position}}${escapedRegex}` : escapedRegex);
|
|
1310
|
-
def.pattern = pattern;
|
|
1311
|
-
inst._zod.onattach.push((inst2) => {
|
|
1312
|
-
const bag = inst2._zod.bag;
|
|
1313
|
-
bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
|
|
1314
|
-
bag.patterns.add(pattern);
|
|
1315
|
-
});
|
|
1316
|
-
inst._zod.check = (payload) => {
|
|
1317
|
-
if (payload.value.includes(def.includes, def.position))
|
|
1318
|
-
return;
|
|
1319
|
-
payload.issues.push({
|
|
1320
|
-
origin: "string",
|
|
1321
|
-
code: "invalid_format",
|
|
1322
|
-
format: "includes",
|
|
1323
|
-
includes: def.includes,
|
|
1324
|
-
input: payload.value,
|
|
1325
|
-
inst,
|
|
1326
|
-
continue: !def.abort
|
|
1327
|
-
});
|
|
1328
|
-
};
|
|
1329
|
-
});
|
|
1330
|
-
var $ZodCheckStartsWith = /* @__PURE__ */ $constructor("$ZodCheckStartsWith", (inst, def) => {
|
|
1331
|
-
$ZodCheck.init(inst, def);
|
|
1332
|
-
const pattern = new RegExp(`^${escapeRegex(def.prefix)}.*`);
|
|
1333
|
-
def.pattern ?? (def.pattern = pattern);
|
|
1334
|
-
inst._zod.onattach.push((inst2) => {
|
|
1335
|
-
const bag = inst2._zod.bag;
|
|
1336
|
-
bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
|
|
1337
|
-
bag.patterns.add(pattern);
|
|
1338
|
-
});
|
|
1339
|
-
inst._zod.check = (payload) => {
|
|
1340
|
-
if (payload.value.startsWith(def.prefix))
|
|
1341
|
-
return;
|
|
1342
|
-
payload.issues.push({
|
|
1343
|
-
origin: "string",
|
|
1344
|
-
code: "invalid_format",
|
|
1345
|
-
format: "starts_with",
|
|
1346
|
-
prefix: def.prefix,
|
|
1347
|
-
input: payload.value,
|
|
1348
|
-
inst,
|
|
1349
|
-
continue: !def.abort
|
|
1350
|
-
});
|
|
1351
|
-
};
|
|
1352
|
-
});
|
|
1353
|
-
var $ZodCheckEndsWith = /* @__PURE__ */ $constructor("$ZodCheckEndsWith", (inst, def) => {
|
|
1354
|
-
$ZodCheck.init(inst, def);
|
|
1355
|
-
const pattern = new RegExp(`.*${escapeRegex(def.suffix)}$`);
|
|
1356
|
-
def.pattern ?? (def.pattern = pattern);
|
|
1357
|
-
inst._zod.onattach.push((inst2) => {
|
|
1358
|
-
const bag = inst2._zod.bag;
|
|
1359
|
-
bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
|
|
1360
|
-
bag.patterns.add(pattern);
|
|
1361
|
-
});
|
|
1362
|
-
inst._zod.check = (payload) => {
|
|
1363
|
-
if (payload.value.endsWith(def.suffix))
|
|
1364
|
-
return;
|
|
1365
|
-
payload.issues.push({
|
|
1366
|
-
origin: "string",
|
|
1367
|
-
code: "invalid_format",
|
|
1368
|
-
format: "ends_with",
|
|
1369
|
-
suffix: def.suffix,
|
|
1370
|
-
input: payload.value,
|
|
1371
|
-
inst,
|
|
1372
|
-
continue: !def.abort
|
|
1373
|
-
});
|
|
1374
|
-
};
|
|
1375
|
-
});
|
|
1376
|
-
var $ZodCheckOverwrite = /* @__PURE__ */ $constructor("$ZodCheckOverwrite", (inst, def) => {
|
|
1377
|
-
$ZodCheck.init(inst, def);
|
|
1378
|
-
inst._zod.check = (payload) => {
|
|
1379
|
-
payload.value = def.tx(payload.value);
|
|
1380
|
-
};
|
|
1381
|
-
});
|
|
1382
367
|
|
|
1383
368
|
// ../../../../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/versions.js
|
|
1384
369
|
var version = {
|
|
@@ -1389,7 +374,7 @@
|
|
|
1389
374
|
|
|
1390
375
|
// ../../../../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/schemas.js
|
|
1391
376
|
var $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
|
|
1392
|
-
var
|
|
377
|
+
var _a3;
|
|
1393
378
|
inst ?? (inst = {});
|
|
1394
379
|
inst._zod.def = def;
|
|
1395
380
|
inst._zod.bag = inst._zod.bag || {};
|
|
@@ -1404,7 +389,7 @@
|
|
|
1404
389
|
}
|
|
1405
390
|
}
|
|
1406
391
|
if (checks.length === 0) {
|
|
1407
|
-
(
|
|
392
|
+
(_a3 = inst._zod).deferred ?? (_a3.deferred = []);
|
|
1408
393
|
inst._zod.deferred?.push(() => {
|
|
1409
394
|
inst._zod.run = inst._zod.parse;
|
|
1410
395
|
});
|
|
@@ -1519,292 +504,6 @@
|
|
|
1519
504
|
return payload;
|
|
1520
505
|
};
|
|
1521
506
|
});
|
|
1522
|
-
var $ZodStringFormat = /* @__PURE__ */ $constructor("$ZodStringFormat", (inst, def) => {
|
|
1523
|
-
$ZodCheckStringFormat.init(inst, def);
|
|
1524
|
-
$ZodString.init(inst, def);
|
|
1525
|
-
});
|
|
1526
|
-
var $ZodGUID = /* @__PURE__ */ $constructor("$ZodGUID", (inst, def) => {
|
|
1527
|
-
def.pattern ?? (def.pattern = guid);
|
|
1528
|
-
$ZodStringFormat.init(inst, def);
|
|
1529
|
-
});
|
|
1530
|
-
var $ZodUUID = /* @__PURE__ */ $constructor("$ZodUUID", (inst, def) => {
|
|
1531
|
-
if (def.version) {
|
|
1532
|
-
const versionMap = {
|
|
1533
|
-
v1: 1,
|
|
1534
|
-
v2: 2,
|
|
1535
|
-
v3: 3,
|
|
1536
|
-
v4: 4,
|
|
1537
|
-
v5: 5,
|
|
1538
|
-
v6: 6,
|
|
1539
|
-
v7: 7,
|
|
1540
|
-
v8: 8
|
|
1541
|
-
};
|
|
1542
|
-
const v = versionMap[def.version];
|
|
1543
|
-
if (v === void 0)
|
|
1544
|
-
throw new Error(`Invalid UUID version: "${def.version}"`);
|
|
1545
|
-
def.pattern ?? (def.pattern = uuid(v));
|
|
1546
|
-
} else
|
|
1547
|
-
def.pattern ?? (def.pattern = uuid());
|
|
1548
|
-
$ZodStringFormat.init(inst, def);
|
|
1549
|
-
});
|
|
1550
|
-
var $ZodEmail = /* @__PURE__ */ $constructor("$ZodEmail", (inst, def) => {
|
|
1551
|
-
def.pattern ?? (def.pattern = email);
|
|
1552
|
-
$ZodStringFormat.init(inst, def);
|
|
1553
|
-
});
|
|
1554
|
-
var $ZodURL = /* @__PURE__ */ $constructor("$ZodURL", (inst, def) => {
|
|
1555
|
-
$ZodStringFormat.init(inst, def);
|
|
1556
|
-
inst._zod.check = (payload) => {
|
|
1557
|
-
try {
|
|
1558
|
-
const trimmed = payload.value.trim();
|
|
1559
|
-
if (!def.normalize && def.protocol?.source === httpProtocol.source) {
|
|
1560
|
-
if (!/^https?:\/\//i.test(trimmed)) {
|
|
1561
|
-
payload.issues.push({
|
|
1562
|
-
code: "invalid_format",
|
|
1563
|
-
format: "url",
|
|
1564
|
-
note: "Invalid URL format",
|
|
1565
|
-
input: payload.value,
|
|
1566
|
-
inst,
|
|
1567
|
-
continue: !def.abort
|
|
1568
|
-
});
|
|
1569
|
-
return;
|
|
1570
|
-
}
|
|
1571
|
-
}
|
|
1572
|
-
const url = new URL(trimmed);
|
|
1573
|
-
if (def.hostname) {
|
|
1574
|
-
def.hostname.lastIndex = 0;
|
|
1575
|
-
if (!def.hostname.test(url.hostname)) {
|
|
1576
|
-
payload.issues.push({
|
|
1577
|
-
code: "invalid_format",
|
|
1578
|
-
format: "url",
|
|
1579
|
-
note: "Invalid hostname",
|
|
1580
|
-
pattern: def.hostname.source,
|
|
1581
|
-
input: payload.value,
|
|
1582
|
-
inst,
|
|
1583
|
-
continue: !def.abort
|
|
1584
|
-
});
|
|
1585
|
-
}
|
|
1586
|
-
}
|
|
1587
|
-
if (def.protocol) {
|
|
1588
|
-
def.protocol.lastIndex = 0;
|
|
1589
|
-
if (!def.protocol.test(url.protocol.endsWith(":") ? url.protocol.slice(0, -1) : url.protocol)) {
|
|
1590
|
-
payload.issues.push({
|
|
1591
|
-
code: "invalid_format",
|
|
1592
|
-
format: "url",
|
|
1593
|
-
note: "Invalid protocol",
|
|
1594
|
-
pattern: def.protocol.source,
|
|
1595
|
-
input: payload.value,
|
|
1596
|
-
inst,
|
|
1597
|
-
continue: !def.abort
|
|
1598
|
-
});
|
|
1599
|
-
}
|
|
1600
|
-
}
|
|
1601
|
-
if (def.normalize) {
|
|
1602
|
-
payload.value = url.href;
|
|
1603
|
-
} else {
|
|
1604
|
-
payload.value = trimmed;
|
|
1605
|
-
}
|
|
1606
|
-
return;
|
|
1607
|
-
} catch (_) {
|
|
1608
|
-
payload.issues.push({
|
|
1609
|
-
code: "invalid_format",
|
|
1610
|
-
format: "url",
|
|
1611
|
-
input: payload.value,
|
|
1612
|
-
inst,
|
|
1613
|
-
continue: !def.abort
|
|
1614
|
-
});
|
|
1615
|
-
}
|
|
1616
|
-
};
|
|
1617
|
-
});
|
|
1618
|
-
var $ZodEmoji = /* @__PURE__ */ $constructor("$ZodEmoji", (inst, def) => {
|
|
1619
|
-
def.pattern ?? (def.pattern = emoji());
|
|
1620
|
-
$ZodStringFormat.init(inst, def);
|
|
1621
|
-
});
|
|
1622
|
-
var $ZodNanoID = /* @__PURE__ */ $constructor("$ZodNanoID", (inst, def) => {
|
|
1623
|
-
def.pattern ?? (def.pattern = nanoid);
|
|
1624
|
-
$ZodStringFormat.init(inst, def);
|
|
1625
|
-
});
|
|
1626
|
-
var $ZodCUID = /* @__PURE__ */ $constructor("$ZodCUID", (inst, def) => {
|
|
1627
|
-
def.pattern ?? (def.pattern = cuid);
|
|
1628
|
-
$ZodStringFormat.init(inst, def);
|
|
1629
|
-
});
|
|
1630
|
-
var $ZodCUID2 = /* @__PURE__ */ $constructor("$ZodCUID2", (inst, def) => {
|
|
1631
|
-
def.pattern ?? (def.pattern = cuid2);
|
|
1632
|
-
$ZodStringFormat.init(inst, def);
|
|
1633
|
-
});
|
|
1634
|
-
var $ZodULID = /* @__PURE__ */ $constructor("$ZodULID", (inst, def) => {
|
|
1635
|
-
def.pattern ?? (def.pattern = ulid);
|
|
1636
|
-
$ZodStringFormat.init(inst, def);
|
|
1637
|
-
});
|
|
1638
|
-
var $ZodXID = /* @__PURE__ */ $constructor("$ZodXID", (inst, def) => {
|
|
1639
|
-
def.pattern ?? (def.pattern = xid);
|
|
1640
|
-
$ZodStringFormat.init(inst, def);
|
|
1641
|
-
});
|
|
1642
|
-
var $ZodKSUID = /* @__PURE__ */ $constructor("$ZodKSUID", (inst, def) => {
|
|
1643
|
-
def.pattern ?? (def.pattern = ksuid);
|
|
1644
|
-
$ZodStringFormat.init(inst, def);
|
|
1645
|
-
});
|
|
1646
|
-
var $ZodISODateTime = /* @__PURE__ */ $constructor("$ZodISODateTime", (inst, def) => {
|
|
1647
|
-
def.pattern ?? (def.pattern = datetime(def));
|
|
1648
|
-
$ZodStringFormat.init(inst, def);
|
|
1649
|
-
});
|
|
1650
|
-
var $ZodISODate = /* @__PURE__ */ $constructor("$ZodISODate", (inst, def) => {
|
|
1651
|
-
def.pattern ?? (def.pattern = date);
|
|
1652
|
-
$ZodStringFormat.init(inst, def);
|
|
1653
|
-
});
|
|
1654
|
-
var $ZodISOTime = /* @__PURE__ */ $constructor("$ZodISOTime", (inst, def) => {
|
|
1655
|
-
def.pattern ?? (def.pattern = time(def));
|
|
1656
|
-
$ZodStringFormat.init(inst, def);
|
|
1657
|
-
});
|
|
1658
|
-
var $ZodISODuration = /* @__PURE__ */ $constructor("$ZodISODuration", (inst, def) => {
|
|
1659
|
-
def.pattern ?? (def.pattern = duration);
|
|
1660
|
-
$ZodStringFormat.init(inst, def);
|
|
1661
|
-
});
|
|
1662
|
-
var $ZodIPv4 = /* @__PURE__ */ $constructor("$ZodIPv4", (inst, def) => {
|
|
1663
|
-
def.pattern ?? (def.pattern = ipv4);
|
|
1664
|
-
$ZodStringFormat.init(inst, def);
|
|
1665
|
-
inst._zod.bag.format = `ipv4`;
|
|
1666
|
-
});
|
|
1667
|
-
var $ZodIPv6 = /* @__PURE__ */ $constructor("$ZodIPv6", (inst, def) => {
|
|
1668
|
-
def.pattern ?? (def.pattern = ipv6);
|
|
1669
|
-
$ZodStringFormat.init(inst, def);
|
|
1670
|
-
inst._zod.bag.format = `ipv6`;
|
|
1671
|
-
inst._zod.check = (payload) => {
|
|
1672
|
-
try {
|
|
1673
|
-
new URL(`http://[${payload.value}]`);
|
|
1674
|
-
} catch {
|
|
1675
|
-
payload.issues.push({
|
|
1676
|
-
code: "invalid_format",
|
|
1677
|
-
format: "ipv6",
|
|
1678
|
-
input: payload.value,
|
|
1679
|
-
inst,
|
|
1680
|
-
continue: !def.abort
|
|
1681
|
-
});
|
|
1682
|
-
}
|
|
1683
|
-
};
|
|
1684
|
-
});
|
|
1685
|
-
var $ZodCIDRv4 = /* @__PURE__ */ $constructor("$ZodCIDRv4", (inst, def) => {
|
|
1686
|
-
def.pattern ?? (def.pattern = cidrv4);
|
|
1687
|
-
$ZodStringFormat.init(inst, def);
|
|
1688
|
-
});
|
|
1689
|
-
var $ZodCIDRv6 = /* @__PURE__ */ $constructor("$ZodCIDRv6", (inst, def) => {
|
|
1690
|
-
def.pattern ?? (def.pattern = cidrv6);
|
|
1691
|
-
$ZodStringFormat.init(inst, def);
|
|
1692
|
-
inst._zod.check = (payload) => {
|
|
1693
|
-
const parts = payload.value.split("/");
|
|
1694
|
-
try {
|
|
1695
|
-
if (parts.length !== 2)
|
|
1696
|
-
throw new Error();
|
|
1697
|
-
const [address, prefix] = parts;
|
|
1698
|
-
if (!prefix)
|
|
1699
|
-
throw new Error();
|
|
1700
|
-
const prefixNum = Number(prefix);
|
|
1701
|
-
if (`${prefixNum}` !== prefix)
|
|
1702
|
-
throw new Error();
|
|
1703
|
-
if (prefixNum < 0 || prefixNum > 128)
|
|
1704
|
-
throw new Error();
|
|
1705
|
-
new URL(`http://[${address}]`);
|
|
1706
|
-
} catch {
|
|
1707
|
-
payload.issues.push({
|
|
1708
|
-
code: "invalid_format",
|
|
1709
|
-
format: "cidrv6",
|
|
1710
|
-
input: payload.value,
|
|
1711
|
-
inst,
|
|
1712
|
-
continue: !def.abort
|
|
1713
|
-
});
|
|
1714
|
-
}
|
|
1715
|
-
};
|
|
1716
|
-
});
|
|
1717
|
-
function isValidBase64(data) {
|
|
1718
|
-
if (data === "")
|
|
1719
|
-
return true;
|
|
1720
|
-
if (/\s/.test(data))
|
|
1721
|
-
return false;
|
|
1722
|
-
if (data.length % 4 !== 0)
|
|
1723
|
-
return false;
|
|
1724
|
-
try {
|
|
1725
|
-
atob(data);
|
|
1726
|
-
return true;
|
|
1727
|
-
} catch {
|
|
1728
|
-
return false;
|
|
1729
|
-
}
|
|
1730
|
-
}
|
|
1731
|
-
var $ZodBase64 = /* @__PURE__ */ $constructor("$ZodBase64", (inst, def) => {
|
|
1732
|
-
def.pattern ?? (def.pattern = base64);
|
|
1733
|
-
$ZodStringFormat.init(inst, def);
|
|
1734
|
-
inst._zod.bag.contentEncoding = "base64";
|
|
1735
|
-
inst._zod.check = (payload) => {
|
|
1736
|
-
if (isValidBase64(payload.value))
|
|
1737
|
-
return;
|
|
1738
|
-
payload.issues.push({
|
|
1739
|
-
code: "invalid_format",
|
|
1740
|
-
format: "base64",
|
|
1741
|
-
input: payload.value,
|
|
1742
|
-
inst,
|
|
1743
|
-
continue: !def.abort
|
|
1744
|
-
});
|
|
1745
|
-
};
|
|
1746
|
-
});
|
|
1747
|
-
function isValidBase64URL(data) {
|
|
1748
|
-
if (!base64url.test(data))
|
|
1749
|
-
return false;
|
|
1750
|
-
const base642 = data.replace(/[-_]/g, (c) => c === "-" ? "+" : "/");
|
|
1751
|
-
const padded = base642.padEnd(Math.ceil(base642.length / 4) * 4, "=");
|
|
1752
|
-
return isValidBase64(padded);
|
|
1753
|
-
}
|
|
1754
|
-
var $ZodBase64URL = /* @__PURE__ */ $constructor("$ZodBase64URL", (inst, def) => {
|
|
1755
|
-
def.pattern ?? (def.pattern = base64url);
|
|
1756
|
-
$ZodStringFormat.init(inst, def);
|
|
1757
|
-
inst._zod.bag.contentEncoding = "base64url";
|
|
1758
|
-
inst._zod.check = (payload) => {
|
|
1759
|
-
if (isValidBase64URL(payload.value))
|
|
1760
|
-
return;
|
|
1761
|
-
payload.issues.push({
|
|
1762
|
-
code: "invalid_format",
|
|
1763
|
-
format: "base64url",
|
|
1764
|
-
input: payload.value,
|
|
1765
|
-
inst,
|
|
1766
|
-
continue: !def.abort
|
|
1767
|
-
});
|
|
1768
|
-
};
|
|
1769
|
-
});
|
|
1770
|
-
var $ZodE164 = /* @__PURE__ */ $constructor("$ZodE164", (inst, def) => {
|
|
1771
|
-
def.pattern ?? (def.pattern = e164);
|
|
1772
|
-
$ZodStringFormat.init(inst, def);
|
|
1773
|
-
});
|
|
1774
|
-
function isValidJWT(token, algorithm = null) {
|
|
1775
|
-
try {
|
|
1776
|
-
const tokensParts = token.split(".");
|
|
1777
|
-
if (tokensParts.length !== 3)
|
|
1778
|
-
return false;
|
|
1779
|
-
const [header] = tokensParts;
|
|
1780
|
-
if (!header)
|
|
1781
|
-
return false;
|
|
1782
|
-
const parsedHeader = JSON.parse(atob(header));
|
|
1783
|
-
if ("typ" in parsedHeader && parsedHeader?.typ !== "JWT")
|
|
1784
|
-
return false;
|
|
1785
|
-
if (!parsedHeader.alg)
|
|
1786
|
-
return false;
|
|
1787
|
-
if (algorithm && (!("alg" in parsedHeader) || parsedHeader.alg !== algorithm))
|
|
1788
|
-
return false;
|
|
1789
|
-
return true;
|
|
1790
|
-
} catch {
|
|
1791
|
-
return false;
|
|
1792
|
-
}
|
|
1793
|
-
}
|
|
1794
|
-
var $ZodJWT = /* @__PURE__ */ $constructor("$ZodJWT", (inst, def) => {
|
|
1795
|
-
$ZodStringFormat.init(inst, def);
|
|
1796
|
-
inst._zod.check = (payload) => {
|
|
1797
|
-
if (isValidJWT(payload.value, def.alg))
|
|
1798
|
-
return;
|
|
1799
|
-
payload.issues.push({
|
|
1800
|
-
code: "invalid_format",
|
|
1801
|
-
format: "jwt",
|
|
1802
|
-
input: payload.value,
|
|
1803
|
-
inst,
|
|
1804
|
-
continue: !def.abort
|
|
1805
|
-
});
|
|
1806
|
-
};
|
|
1807
|
-
});
|
|
1808
507
|
var $ZodNumber = /* @__PURE__ */ $constructor("$ZodNumber", (inst, def) => {
|
|
1809
508
|
$ZodType.init(inst, def);
|
|
1810
509
|
inst._zod.pattern = inst._zod.bag.pattern ?? number;
|
|
@@ -1829,10 +528,6 @@
|
|
|
1829
528
|
return payload;
|
|
1830
529
|
};
|
|
1831
530
|
});
|
|
1832
|
-
var $ZodNumberFormat = /* @__PURE__ */ $constructor("$ZodNumberFormat", (inst, def) => {
|
|
1833
|
-
$ZodCheckNumberFormat.init(inst, def);
|
|
1834
|
-
$ZodNumber.init(inst, def);
|
|
1835
|
-
});
|
|
1836
531
|
var $ZodBigInt = /* @__PURE__ */ $constructor("$ZodBigInt", (inst, def) => {
|
|
1837
532
|
$ZodType.init(inst, def);
|
|
1838
533
|
inst._zod.pattern = bigint;
|
|
@@ -1853,51 +548,12 @@
|
|
|
1853
548
|
return payload;
|
|
1854
549
|
};
|
|
1855
550
|
});
|
|
1856
|
-
function
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
var $ZodArray = /* @__PURE__ */ $constructor("$ZodArray", (inst, def) => {
|
|
1863
|
-
$ZodType.init(inst, def);
|
|
1864
|
-
inst._zod.parse = (payload, ctx) => {
|
|
1865
|
-
const input = payload.value;
|
|
1866
|
-
if (!Array.isArray(input)) {
|
|
1867
|
-
payload.issues.push({
|
|
1868
|
-
expected: "array",
|
|
1869
|
-
code: "invalid_type",
|
|
1870
|
-
input,
|
|
1871
|
-
inst
|
|
1872
|
-
});
|
|
1873
|
-
return payload;
|
|
1874
|
-
}
|
|
1875
|
-
payload.value = Array(input.length);
|
|
1876
|
-
const proms = [];
|
|
1877
|
-
for (let i = 0; i < input.length; i++) {
|
|
1878
|
-
const item = input[i];
|
|
1879
|
-
const result = def.element._zod.run({
|
|
1880
|
-
value: item,
|
|
1881
|
-
issues: []
|
|
1882
|
-
}, ctx);
|
|
1883
|
-
if (result instanceof Promise) {
|
|
1884
|
-
proms.push(result.then((result2) => handleArrayResult(result2, payload, i)));
|
|
1885
|
-
} else {
|
|
1886
|
-
handleArrayResult(result, payload, i);
|
|
1887
|
-
}
|
|
1888
|
-
}
|
|
1889
|
-
if (proms.length) {
|
|
1890
|
-
return Promise.all(proms).then(() => payload);
|
|
1891
|
-
}
|
|
1892
|
-
return payload;
|
|
1893
|
-
};
|
|
1894
|
-
});
|
|
1895
|
-
function handleUnionResults(results, final, inst, ctx) {
|
|
1896
|
-
for (const result of results) {
|
|
1897
|
-
if (result.issues.length === 0) {
|
|
1898
|
-
final.value = result.value;
|
|
1899
|
-
return final;
|
|
1900
|
-
}
|
|
551
|
+
function handleUnionResults(results, final, inst, ctx) {
|
|
552
|
+
for (const result of results) {
|
|
553
|
+
if (result.issues.length === 0) {
|
|
554
|
+
final.value = result.value;
|
|
555
|
+
return final;
|
|
556
|
+
}
|
|
1901
557
|
}
|
|
1902
558
|
const nonaborted = results.filter((r) => !aborted(r));
|
|
1903
559
|
if (nonaborted.length === 1) {
|
|
@@ -1957,104 +613,6 @@
|
|
|
1957
613
|
});
|
|
1958
614
|
};
|
|
1959
615
|
});
|
|
1960
|
-
var $ZodIntersection = /* @__PURE__ */ $constructor("$ZodIntersection", (inst, def) => {
|
|
1961
|
-
$ZodType.init(inst, def);
|
|
1962
|
-
inst._zod.parse = (payload, ctx) => {
|
|
1963
|
-
const input = payload.value;
|
|
1964
|
-
const left = def.left._zod.run({ value: input, issues: [] }, ctx);
|
|
1965
|
-
const right = def.right._zod.run({ value: input, issues: [] }, ctx);
|
|
1966
|
-
const async = left instanceof Promise || right instanceof Promise;
|
|
1967
|
-
if (async) {
|
|
1968
|
-
return Promise.all([left, right]).then(([left2, right2]) => {
|
|
1969
|
-
return handleIntersectionResults(payload, left2, right2);
|
|
1970
|
-
});
|
|
1971
|
-
}
|
|
1972
|
-
return handleIntersectionResults(payload, left, right);
|
|
1973
|
-
};
|
|
1974
|
-
});
|
|
1975
|
-
function mergeValues(a, b) {
|
|
1976
|
-
if (a === b) {
|
|
1977
|
-
return { valid: true, data: a };
|
|
1978
|
-
}
|
|
1979
|
-
if (a instanceof Date && b instanceof Date && +a === +b) {
|
|
1980
|
-
return { valid: true, data: a };
|
|
1981
|
-
}
|
|
1982
|
-
if (isPlainObject(a) && isPlainObject(b)) {
|
|
1983
|
-
const bKeys = Object.keys(b);
|
|
1984
|
-
const sharedKeys = Object.keys(a).filter((key) => bKeys.indexOf(key) !== -1);
|
|
1985
|
-
const newObj = { ...a, ...b };
|
|
1986
|
-
for (const key of sharedKeys) {
|
|
1987
|
-
const sharedValue = mergeValues(a[key], b[key]);
|
|
1988
|
-
if (!sharedValue.valid) {
|
|
1989
|
-
return {
|
|
1990
|
-
valid: false,
|
|
1991
|
-
mergeErrorPath: [key, ...sharedValue.mergeErrorPath]
|
|
1992
|
-
};
|
|
1993
|
-
}
|
|
1994
|
-
newObj[key] = sharedValue.data;
|
|
1995
|
-
}
|
|
1996
|
-
return { valid: true, data: newObj };
|
|
1997
|
-
}
|
|
1998
|
-
if (Array.isArray(a) && Array.isArray(b)) {
|
|
1999
|
-
if (a.length !== b.length) {
|
|
2000
|
-
return { valid: false, mergeErrorPath: [] };
|
|
2001
|
-
}
|
|
2002
|
-
const newArray = [];
|
|
2003
|
-
for (let index = 0; index < a.length; index++) {
|
|
2004
|
-
const itemA = a[index];
|
|
2005
|
-
const itemB = b[index];
|
|
2006
|
-
const sharedValue = mergeValues(itemA, itemB);
|
|
2007
|
-
if (!sharedValue.valid) {
|
|
2008
|
-
return {
|
|
2009
|
-
valid: false,
|
|
2010
|
-
mergeErrorPath: [index, ...sharedValue.mergeErrorPath]
|
|
2011
|
-
};
|
|
2012
|
-
}
|
|
2013
|
-
newArray.push(sharedValue.data);
|
|
2014
|
-
}
|
|
2015
|
-
return { valid: true, data: newArray };
|
|
2016
|
-
}
|
|
2017
|
-
return { valid: false, mergeErrorPath: [] };
|
|
2018
|
-
}
|
|
2019
|
-
function handleIntersectionResults(result, left, right) {
|
|
2020
|
-
const unrecKeys = /* @__PURE__ */ new Map();
|
|
2021
|
-
let unrecIssue;
|
|
2022
|
-
for (const iss of left.issues) {
|
|
2023
|
-
if (iss.code === "unrecognized_keys") {
|
|
2024
|
-
unrecIssue ?? (unrecIssue = iss);
|
|
2025
|
-
for (const k of iss.keys) {
|
|
2026
|
-
if (!unrecKeys.has(k))
|
|
2027
|
-
unrecKeys.set(k, {});
|
|
2028
|
-
unrecKeys.get(k).l = true;
|
|
2029
|
-
}
|
|
2030
|
-
} else {
|
|
2031
|
-
result.issues.push(iss);
|
|
2032
|
-
}
|
|
2033
|
-
}
|
|
2034
|
-
for (const iss of right.issues) {
|
|
2035
|
-
if (iss.code === "unrecognized_keys") {
|
|
2036
|
-
for (const k of iss.keys) {
|
|
2037
|
-
if (!unrecKeys.has(k))
|
|
2038
|
-
unrecKeys.set(k, {});
|
|
2039
|
-
unrecKeys.get(k).r = true;
|
|
2040
|
-
}
|
|
2041
|
-
} else {
|
|
2042
|
-
result.issues.push(iss);
|
|
2043
|
-
}
|
|
2044
|
-
}
|
|
2045
|
-
const bothKeys = [...unrecKeys].filter(([, f]) => f.l && f.r).map(([k]) => k);
|
|
2046
|
-
if (bothKeys.length && unrecIssue) {
|
|
2047
|
-
result.issues.push({ ...unrecIssue, keys: bothKeys });
|
|
2048
|
-
}
|
|
2049
|
-
if (aborted(result))
|
|
2050
|
-
return result;
|
|
2051
|
-
const merged = mergeValues(left.value, right.value);
|
|
2052
|
-
if (!merged.valid) {
|
|
2053
|
-
throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(merged.mergeErrorPath)}`);
|
|
2054
|
-
}
|
|
2055
|
-
result.value = merged.data;
|
|
2056
|
-
return result;
|
|
2057
|
-
}
|
|
2058
616
|
var $ZodTransform = /* @__PURE__ */ $constructor("$ZodTransform", (inst, def) => {
|
|
2059
617
|
$ZodType.init(inst, def);
|
|
2060
618
|
inst._zod.optin = "optional";
|
|
@@ -2079,168 +637,6 @@
|
|
|
2079
637
|
return payload;
|
|
2080
638
|
};
|
|
2081
639
|
});
|
|
2082
|
-
function handleOptionalResult(result, input) {
|
|
2083
|
-
if (input === void 0 && (result.issues.length || result.fallback)) {
|
|
2084
|
-
return { issues: [], value: void 0 };
|
|
2085
|
-
}
|
|
2086
|
-
return result;
|
|
2087
|
-
}
|
|
2088
|
-
var $ZodOptional = /* @__PURE__ */ $constructor("$ZodOptional", (inst, def) => {
|
|
2089
|
-
$ZodType.init(inst, def);
|
|
2090
|
-
inst._zod.optin = "optional";
|
|
2091
|
-
inst._zod.optout = "optional";
|
|
2092
|
-
defineLazy(inst._zod, "values", () => {
|
|
2093
|
-
return def.innerType._zod.values ? /* @__PURE__ */ new Set([...def.innerType._zod.values, void 0]) : void 0;
|
|
2094
|
-
});
|
|
2095
|
-
defineLazy(inst._zod, "pattern", () => {
|
|
2096
|
-
const pattern = def.innerType._zod.pattern;
|
|
2097
|
-
return pattern ? new RegExp(`^(${cleanRegex(pattern.source)})?$`) : void 0;
|
|
2098
|
-
});
|
|
2099
|
-
inst._zod.parse = (payload, ctx) => {
|
|
2100
|
-
if (def.innerType._zod.optin === "optional") {
|
|
2101
|
-
const input = payload.value;
|
|
2102
|
-
const result = def.innerType._zod.run(payload, ctx);
|
|
2103
|
-
if (result instanceof Promise)
|
|
2104
|
-
return result.then((r) => handleOptionalResult(r, input));
|
|
2105
|
-
return handleOptionalResult(result, input);
|
|
2106
|
-
}
|
|
2107
|
-
if (payload.value === void 0) {
|
|
2108
|
-
return payload;
|
|
2109
|
-
}
|
|
2110
|
-
return def.innerType._zod.run(payload, ctx);
|
|
2111
|
-
};
|
|
2112
|
-
});
|
|
2113
|
-
var $ZodExactOptional = /* @__PURE__ */ $constructor("$ZodExactOptional", (inst, def) => {
|
|
2114
|
-
$ZodOptional.init(inst, def);
|
|
2115
|
-
defineLazy(inst._zod, "values", () => def.innerType._zod.values);
|
|
2116
|
-
defineLazy(inst._zod, "pattern", () => def.innerType._zod.pattern);
|
|
2117
|
-
inst._zod.parse = (payload, ctx) => {
|
|
2118
|
-
return def.innerType._zod.run(payload, ctx);
|
|
2119
|
-
};
|
|
2120
|
-
});
|
|
2121
|
-
var $ZodNullable = /* @__PURE__ */ $constructor("$ZodNullable", (inst, def) => {
|
|
2122
|
-
$ZodType.init(inst, def);
|
|
2123
|
-
defineLazy(inst._zod, "optin", () => def.innerType._zod.optin);
|
|
2124
|
-
defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
|
|
2125
|
-
defineLazy(inst._zod, "pattern", () => {
|
|
2126
|
-
const pattern = def.innerType._zod.pattern;
|
|
2127
|
-
return pattern ? new RegExp(`^(${cleanRegex(pattern.source)}|null)$`) : void 0;
|
|
2128
|
-
});
|
|
2129
|
-
defineLazy(inst._zod, "values", () => {
|
|
2130
|
-
return def.innerType._zod.values ? /* @__PURE__ */ new Set([...def.innerType._zod.values, null]) : void 0;
|
|
2131
|
-
});
|
|
2132
|
-
inst._zod.parse = (payload, ctx) => {
|
|
2133
|
-
if (payload.value === null)
|
|
2134
|
-
return payload;
|
|
2135
|
-
return def.innerType._zod.run(payload, ctx);
|
|
2136
|
-
};
|
|
2137
|
-
});
|
|
2138
|
-
var $ZodDefault = /* @__PURE__ */ $constructor("$ZodDefault", (inst, def) => {
|
|
2139
|
-
$ZodType.init(inst, def);
|
|
2140
|
-
inst._zod.optin = "optional";
|
|
2141
|
-
defineLazy(inst._zod, "values", () => def.innerType._zod.values);
|
|
2142
|
-
inst._zod.parse = (payload, ctx) => {
|
|
2143
|
-
if (ctx.direction === "backward") {
|
|
2144
|
-
return def.innerType._zod.run(payload, ctx);
|
|
2145
|
-
}
|
|
2146
|
-
if (payload.value === void 0) {
|
|
2147
|
-
payload.value = def.defaultValue;
|
|
2148
|
-
return payload;
|
|
2149
|
-
}
|
|
2150
|
-
const result = def.innerType._zod.run(payload, ctx);
|
|
2151
|
-
if (result instanceof Promise) {
|
|
2152
|
-
return result.then((result2) => handleDefaultResult(result2, def));
|
|
2153
|
-
}
|
|
2154
|
-
return handleDefaultResult(result, def);
|
|
2155
|
-
};
|
|
2156
|
-
});
|
|
2157
|
-
function handleDefaultResult(payload, def) {
|
|
2158
|
-
if (payload.value === void 0) {
|
|
2159
|
-
payload.value = def.defaultValue;
|
|
2160
|
-
}
|
|
2161
|
-
return payload;
|
|
2162
|
-
}
|
|
2163
|
-
var $ZodPrefault = /* @__PURE__ */ $constructor("$ZodPrefault", (inst, def) => {
|
|
2164
|
-
$ZodType.init(inst, def);
|
|
2165
|
-
inst._zod.optin = "optional";
|
|
2166
|
-
defineLazy(inst._zod, "values", () => def.innerType._zod.values);
|
|
2167
|
-
inst._zod.parse = (payload, ctx) => {
|
|
2168
|
-
if (ctx.direction === "backward") {
|
|
2169
|
-
return def.innerType._zod.run(payload, ctx);
|
|
2170
|
-
}
|
|
2171
|
-
if (payload.value === void 0) {
|
|
2172
|
-
payload.value = def.defaultValue;
|
|
2173
|
-
}
|
|
2174
|
-
return def.innerType._zod.run(payload, ctx);
|
|
2175
|
-
};
|
|
2176
|
-
});
|
|
2177
|
-
var $ZodNonOptional = /* @__PURE__ */ $constructor("$ZodNonOptional", (inst, def) => {
|
|
2178
|
-
$ZodType.init(inst, def);
|
|
2179
|
-
defineLazy(inst._zod, "values", () => {
|
|
2180
|
-
const v = def.innerType._zod.values;
|
|
2181
|
-
return v ? new Set([...v].filter((x) => x !== void 0)) : void 0;
|
|
2182
|
-
});
|
|
2183
|
-
inst._zod.parse = (payload, ctx) => {
|
|
2184
|
-
const result = def.innerType._zod.run(payload, ctx);
|
|
2185
|
-
if (result instanceof Promise) {
|
|
2186
|
-
return result.then((result2) => handleNonOptionalResult(result2, inst));
|
|
2187
|
-
}
|
|
2188
|
-
return handleNonOptionalResult(result, inst);
|
|
2189
|
-
};
|
|
2190
|
-
});
|
|
2191
|
-
function handleNonOptionalResult(payload, inst) {
|
|
2192
|
-
if (!payload.issues.length && payload.value === void 0) {
|
|
2193
|
-
payload.issues.push({
|
|
2194
|
-
code: "invalid_type",
|
|
2195
|
-
expected: "nonoptional",
|
|
2196
|
-
input: payload.value,
|
|
2197
|
-
inst
|
|
2198
|
-
});
|
|
2199
|
-
}
|
|
2200
|
-
return payload;
|
|
2201
|
-
}
|
|
2202
|
-
var $ZodCatch = /* @__PURE__ */ $constructor("$ZodCatch", (inst, def) => {
|
|
2203
|
-
$ZodType.init(inst, def);
|
|
2204
|
-
inst._zod.optin = "optional";
|
|
2205
|
-
defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
|
|
2206
|
-
defineLazy(inst._zod, "values", () => def.innerType._zod.values);
|
|
2207
|
-
inst._zod.parse = (payload, ctx) => {
|
|
2208
|
-
if (ctx.direction === "backward") {
|
|
2209
|
-
return def.innerType._zod.run(payload, ctx);
|
|
2210
|
-
}
|
|
2211
|
-
const result = def.innerType._zod.run(payload, ctx);
|
|
2212
|
-
if (result instanceof Promise) {
|
|
2213
|
-
return result.then((result2) => {
|
|
2214
|
-
payload.value = result2.value;
|
|
2215
|
-
if (result2.issues.length) {
|
|
2216
|
-
payload.value = def.catchValue({
|
|
2217
|
-
...payload,
|
|
2218
|
-
error: {
|
|
2219
|
-
issues: result2.issues.map((iss) => finalizeIssue(iss, ctx, config()))
|
|
2220
|
-
},
|
|
2221
|
-
input: payload.value
|
|
2222
|
-
});
|
|
2223
|
-
payload.issues = [];
|
|
2224
|
-
payload.fallback = true;
|
|
2225
|
-
}
|
|
2226
|
-
return payload;
|
|
2227
|
-
});
|
|
2228
|
-
}
|
|
2229
|
-
payload.value = result.value;
|
|
2230
|
-
if (result.issues.length) {
|
|
2231
|
-
payload.value = def.catchValue({
|
|
2232
|
-
...payload,
|
|
2233
|
-
error: {
|
|
2234
|
-
issues: result.issues.map((iss) => finalizeIssue(iss, ctx, config()))
|
|
2235
|
-
},
|
|
2236
|
-
input: payload.value
|
|
2237
|
-
});
|
|
2238
|
-
payload.issues = [];
|
|
2239
|
-
payload.fallback = true;
|
|
2240
|
-
}
|
|
2241
|
-
return payload;
|
|
2242
|
-
};
|
|
2243
|
-
});
|
|
2244
640
|
var $ZodPipe = /* @__PURE__ */ $constructor("$ZodPipe", (inst, def) => {
|
|
2245
641
|
$ZodType.init(inst, def);
|
|
2246
642
|
defineLazy(inst._zod, "values", () => def.in._zod.values);
|
|
@@ -2269,27 +665,6 @@
|
|
|
2269
665
|
}
|
|
2270
666
|
return next._zod.run({ value: left.value, issues: left.issues, fallback: left.fallback }, ctx);
|
|
2271
667
|
}
|
|
2272
|
-
var $ZodReadonly = /* @__PURE__ */ $constructor("$ZodReadonly", (inst, def) => {
|
|
2273
|
-
$ZodType.init(inst, def);
|
|
2274
|
-
defineLazy(inst._zod, "propValues", () => def.innerType._zod.propValues);
|
|
2275
|
-
defineLazy(inst._zod, "values", () => def.innerType._zod.values);
|
|
2276
|
-
defineLazy(inst._zod, "optin", () => def.innerType?._zod?.optin);
|
|
2277
|
-
defineLazy(inst._zod, "optout", () => def.innerType?._zod?.optout);
|
|
2278
|
-
inst._zod.parse = (payload, ctx) => {
|
|
2279
|
-
if (ctx.direction === "backward") {
|
|
2280
|
-
return def.innerType._zod.run(payload, ctx);
|
|
2281
|
-
}
|
|
2282
|
-
const result = def.innerType._zod.run(payload, ctx);
|
|
2283
|
-
if (result instanceof Promise) {
|
|
2284
|
-
return result.then(handleReadonlyResult);
|
|
2285
|
-
}
|
|
2286
|
-
return handleReadonlyResult(result);
|
|
2287
|
-
};
|
|
2288
|
-
});
|
|
2289
|
-
function handleReadonlyResult(payload) {
|
|
2290
|
-
payload.value = Object.freeze(payload.value);
|
|
2291
|
-
return payload;
|
|
2292
|
-
}
|
|
2293
668
|
var $ZodCustom = /* @__PURE__ */ $constructor("$ZodCustom", (inst, def) => {
|
|
2294
669
|
$ZodCheck.init(inst, def);
|
|
2295
670
|
$ZodType.init(inst, def);
|
|
@@ -2320,1854 +695,169 @@
|
|
|
2320
695
|
};
|
|
2321
696
|
if (inst._zod.def.params)
|
|
2322
697
|
_iss.params = inst._zod.def.params;
|
|
2323
|
-
payload.issues.push(issue(_iss));
|
|
2324
|
-
}
|
|
2325
|
-
}
|
|
2326
|
-
|
|
2327
|
-
// ../../../../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/registries.js
|
|
2328
|
-
var _a2;
|
|
2329
|
-
var $ZodRegistry = class {
|
|
2330
|
-
constructor() {
|
|
2331
|
-
this._map = /* @__PURE__ */ new WeakMap();
|
|
2332
|
-
this._idmap = /* @__PURE__ */ new Map();
|
|
2333
|
-
}
|
|
2334
|
-
add(schema, ..._meta) {
|
|
2335
|
-
const meta2 = _meta[0];
|
|
2336
|
-
this._map.set(schema, meta2);
|
|
2337
|
-
if (meta2 && typeof meta2 === "object" && "id" in meta2) {
|
|
2338
|
-
this._idmap.set(meta2.id, schema);
|
|
2339
|
-
}
|
|
2340
|
-
return this;
|
|
2341
|
-
}
|
|
2342
|
-
clear() {
|
|
2343
|
-
this._map = /* @__PURE__ */ new WeakMap();
|
|
2344
|
-
this._idmap = /* @__PURE__ */ new Map();
|
|
2345
|
-
return this;
|
|
2346
|
-
}
|
|
2347
|
-
remove(schema) {
|
|
2348
|
-
const meta2 = this._map.get(schema);
|
|
2349
|
-
if (meta2 && typeof meta2 === "object" && "id" in meta2) {
|
|
2350
|
-
this._idmap.delete(meta2.id);
|
|
2351
|
-
}
|
|
2352
|
-
this._map.delete(schema);
|
|
2353
|
-
return this;
|
|
2354
|
-
}
|
|
2355
|
-
get(schema) {
|
|
2356
|
-
const p = schema._zod.parent;
|
|
2357
|
-
if (p) {
|
|
2358
|
-
const pm = { ...this.get(p) ?? {} };
|
|
2359
|
-
delete pm.id;
|
|
2360
|
-
const f = { ...pm, ...this._map.get(schema) };
|
|
2361
|
-
return Object.keys(f).length ? f : void 0;
|
|
2362
|
-
}
|
|
2363
|
-
return this._map.get(schema);
|
|
2364
|
-
}
|
|
2365
|
-
has(schema) {
|
|
2366
|
-
return this._map.has(schema);
|
|
2367
|
-
}
|
|
2368
|
-
};
|
|
2369
|
-
function registry() {
|
|
2370
|
-
return new $ZodRegistry();
|
|
2371
|
-
}
|
|
2372
|
-
(_a2 = globalThis).__zod_globalRegistry ?? (_a2.__zod_globalRegistry = registry());
|
|
2373
|
-
var globalRegistry = globalThis.__zod_globalRegistry;
|
|
2374
|
-
|
|
2375
|
-
// ../../../../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/api.js
|
|
2376
|
-
// @__NO_SIDE_EFFECTS__
|
|
2377
|
-
function _string(Class2, params) {
|
|
2378
|
-
return new Class2({
|
|
2379
|
-
type: "string",
|
|
2380
|
-
...normalizeParams(params)
|
|
2381
|
-
});
|
|
2382
|
-
}
|
|
2383
|
-
// @__NO_SIDE_EFFECTS__
|
|
2384
|
-
function _email(Class2, params) {
|
|
2385
|
-
return new Class2({
|
|
2386
|
-
type: "string",
|
|
2387
|
-
format: "email",
|
|
2388
|
-
check: "string_format",
|
|
2389
|
-
abort: false,
|
|
2390
|
-
...normalizeParams(params)
|
|
2391
|
-
});
|
|
2392
|
-
}
|
|
2393
|
-
// @__NO_SIDE_EFFECTS__
|
|
2394
|
-
function _guid(Class2, params) {
|
|
2395
|
-
return new Class2({
|
|
2396
|
-
type: "string",
|
|
2397
|
-
format: "guid",
|
|
2398
|
-
check: "string_format",
|
|
2399
|
-
abort: false,
|
|
2400
|
-
...normalizeParams(params)
|
|
2401
|
-
});
|
|
2402
|
-
}
|
|
2403
|
-
// @__NO_SIDE_EFFECTS__
|
|
2404
|
-
function _uuid(Class2, params) {
|
|
2405
|
-
return new Class2({
|
|
2406
|
-
type: "string",
|
|
2407
|
-
format: "uuid",
|
|
2408
|
-
check: "string_format",
|
|
2409
|
-
abort: false,
|
|
2410
|
-
...normalizeParams(params)
|
|
2411
|
-
});
|
|
2412
|
-
}
|
|
2413
|
-
// @__NO_SIDE_EFFECTS__
|
|
2414
|
-
function _uuidv4(Class2, params) {
|
|
2415
|
-
return new Class2({
|
|
2416
|
-
type: "string",
|
|
2417
|
-
format: "uuid",
|
|
2418
|
-
check: "string_format",
|
|
2419
|
-
abort: false,
|
|
2420
|
-
version: "v4",
|
|
2421
|
-
...normalizeParams(params)
|
|
2422
|
-
});
|
|
2423
|
-
}
|
|
2424
|
-
// @__NO_SIDE_EFFECTS__
|
|
2425
|
-
function _uuidv6(Class2, params) {
|
|
2426
|
-
return new Class2({
|
|
2427
|
-
type: "string",
|
|
2428
|
-
format: "uuid",
|
|
2429
|
-
check: "string_format",
|
|
2430
|
-
abort: false,
|
|
2431
|
-
version: "v6",
|
|
2432
|
-
...normalizeParams(params)
|
|
2433
|
-
});
|
|
2434
|
-
}
|
|
2435
|
-
// @__NO_SIDE_EFFECTS__
|
|
2436
|
-
function _uuidv7(Class2, params) {
|
|
2437
|
-
return new Class2({
|
|
2438
|
-
type: "string",
|
|
2439
|
-
format: "uuid",
|
|
2440
|
-
check: "string_format",
|
|
2441
|
-
abort: false,
|
|
2442
|
-
version: "v7",
|
|
2443
|
-
...normalizeParams(params)
|
|
2444
|
-
});
|
|
2445
|
-
}
|
|
2446
|
-
// @__NO_SIDE_EFFECTS__
|
|
2447
|
-
function _url(Class2, params) {
|
|
2448
|
-
return new Class2({
|
|
2449
|
-
type: "string",
|
|
2450
|
-
format: "url",
|
|
2451
|
-
check: "string_format",
|
|
2452
|
-
abort: false,
|
|
2453
|
-
...normalizeParams(params)
|
|
2454
|
-
});
|
|
2455
|
-
}
|
|
2456
|
-
// @__NO_SIDE_EFFECTS__
|
|
2457
|
-
function _emoji2(Class2, params) {
|
|
2458
|
-
return new Class2({
|
|
2459
|
-
type: "string",
|
|
2460
|
-
format: "emoji",
|
|
2461
|
-
check: "string_format",
|
|
2462
|
-
abort: false,
|
|
2463
|
-
...normalizeParams(params)
|
|
2464
|
-
});
|
|
2465
|
-
}
|
|
2466
|
-
// @__NO_SIDE_EFFECTS__
|
|
2467
|
-
function _nanoid(Class2, params) {
|
|
2468
|
-
return new Class2({
|
|
2469
|
-
type: "string",
|
|
2470
|
-
format: "nanoid",
|
|
2471
|
-
check: "string_format",
|
|
2472
|
-
abort: false,
|
|
2473
|
-
...normalizeParams(params)
|
|
2474
|
-
});
|
|
2475
|
-
}
|
|
2476
|
-
// @__NO_SIDE_EFFECTS__
|
|
2477
|
-
function _cuid(Class2, params) {
|
|
2478
|
-
return new Class2({
|
|
2479
|
-
type: "string",
|
|
2480
|
-
format: "cuid",
|
|
2481
|
-
check: "string_format",
|
|
2482
|
-
abort: false,
|
|
2483
|
-
...normalizeParams(params)
|
|
2484
|
-
});
|
|
2485
|
-
}
|
|
2486
|
-
// @__NO_SIDE_EFFECTS__
|
|
2487
|
-
function _cuid2(Class2, params) {
|
|
2488
|
-
return new Class2({
|
|
2489
|
-
type: "string",
|
|
2490
|
-
format: "cuid2",
|
|
2491
|
-
check: "string_format",
|
|
2492
|
-
abort: false,
|
|
2493
|
-
...normalizeParams(params)
|
|
2494
|
-
});
|
|
2495
|
-
}
|
|
2496
|
-
// @__NO_SIDE_EFFECTS__
|
|
2497
|
-
function _ulid(Class2, params) {
|
|
2498
|
-
return new Class2({
|
|
2499
|
-
type: "string",
|
|
2500
|
-
format: "ulid",
|
|
2501
|
-
check: "string_format",
|
|
2502
|
-
abort: false,
|
|
2503
|
-
...normalizeParams(params)
|
|
2504
|
-
});
|
|
2505
|
-
}
|
|
2506
|
-
// @__NO_SIDE_EFFECTS__
|
|
2507
|
-
function _xid(Class2, params) {
|
|
2508
|
-
return new Class2({
|
|
2509
|
-
type: "string",
|
|
2510
|
-
format: "xid",
|
|
2511
|
-
check: "string_format",
|
|
2512
|
-
abort: false,
|
|
2513
|
-
...normalizeParams(params)
|
|
2514
|
-
});
|
|
2515
|
-
}
|
|
2516
|
-
// @__NO_SIDE_EFFECTS__
|
|
2517
|
-
function _ksuid(Class2, params) {
|
|
2518
|
-
return new Class2({
|
|
2519
|
-
type: "string",
|
|
2520
|
-
format: "ksuid",
|
|
2521
|
-
check: "string_format",
|
|
2522
|
-
abort: false,
|
|
2523
|
-
...normalizeParams(params)
|
|
2524
|
-
});
|
|
2525
|
-
}
|
|
2526
|
-
// @__NO_SIDE_EFFECTS__
|
|
2527
|
-
function _ipv4(Class2, params) {
|
|
2528
|
-
return new Class2({
|
|
2529
|
-
type: "string",
|
|
2530
|
-
format: "ipv4",
|
|
2531
|
-
check: "string_format",
|
|
2532
|
-
abort: false,
|
|
2533
|
-
...normalizeParams(params)
|
|
2534
|
-
});
|
|
2535
|
-
}
|
|
2536
|
-
// @__NO_SIDE_EFFECTS__
|
|
2537
|
-
function _ipv6(Class2, params) {
|
|
2538
|
-
return new Class2({
|
|
2539
|
-
type: "string",
|
|
2540
|
-
format: "ipv6",
|
|
2541
|
-
check: "string_format",
|
|
2542
|
-
abort: false,
|
|
2543
|
-
...normalizeParams(params)
|
|
2544
|
-
});
|
|
2545
|
-
}
|
|
2546
|
-
// @__NO_SIDE_EFFECTS__
|
|
2547
|
-
function _cidrv4(Class2, params) {
|
|
2548
|
-
return new Class2({
|
|
2549
|
-
type: "string",
|
|
2550
|
-
format: "cidrv4",
|
|
2551
|
-
check: "string_format",
|
|
2552
|
-
abort: false,
|
|
2553
|
-
...normalizeParams(params)
|
|
2554
|
-
});
|
|
2555
|
-
}
|
|
2556
|
-
// @__NO_SIDE_EFFECTS__
|
|
2557
|
-
function _cidrv6(Class2, params) {
|
|
2558
|
-
return new Class2({
|
|
2559
|
-
type: "string",
|
|
2560
|
-
format: "cidrv6",
|
|
2561
|
-
check: "string_format",
|
|
2562
|
-
abort: false,
|
|
2563
|
-
...normalizeParams(params)
|
|
2564
|
-
});
|
|
2565
|
-
}
|
|
2566
|
-
// @__NO_SIDE_EFFECTS__
|
|
2567
|
-
function _base64(Class2, params) {
|
|
2568
|
-
return new Class2({
|
|
2569
|
-
type: "string",
|
|
2570
|
-
format: "base64",
|
|
2571
|
-
check: "string_format",
|
|
2572
|
-
abort: false,
|
|
2573
|
-
...normalizeParams(params)
|
|
2574
|
-
});
|
|
2575
|
-
}
|
|
2576
|
-
// @__NO_SIDE_EFFECTS__
|
|
2577
|
-
function _base64url(Class2, params) {
|
|
2578
|
-
return new Class2({
|
|
2579
|
-
type: "string",
|
|
2580
|
-
format: "base64url",
|
|
2581
|
-
check: "string_format",
|
|
2582
|
-
abort: false,
|
|
2583
|
-
...normalizeParams(params)
|
|
2584
|
-
});
|
|
2585
|
-
}
|
|
2586
|
-
// @__NO_SIDE_EFFECTS__
|
|
2587
|
-
function _e164(Class2, params) {
|
|
2588
|
-
return new Class2({
|
|
2589
|
-
type: "string",
|
|
2590
|
-
format: "e164",
|
|
2591
|
-
check: "string_format",
|
|
2592
|
-
abort: false,
|
|
2593
|
-
...normalizeParams(params)
|
|
2594
|
-
});
|
|
2595
|
-
}
|
|
2596
|
-
// @__NO_SIDE_EFFECTS__
|
|
2597
|
-
function _jwt(Class2, params) {
|
|
2598
|
-
return new Class2({
|
|
2599
|
-
type: "string",
|
|
2600
|
-
format: "jwt",
|
|
2601
|
-
check: "string_format",
|
|
2602
|
-
abort: false,
|
|
2603
|
-
...normalizeParams(params)
|
|
2604
|
-
});
|
|
2605
|
-
}
|
|
2606
|
-
// @__NO_SIDE_EFFECTS__
|
|
2607
|
-
function _isoDateTime(Class2, params) {
|
|
2608
|
-
return new Class2({
|
|
2609
|
-
type: "string",
|
|
2610
|
-
format: "datetime",
|
|
2611
|
-
check: "string_format",
|
|
2612
|
-
offset: false,
|
|
2613
|
-
local: false,
|
|
2614
|
-
precision: null,
|
|
2615
|
-
...normalizeParams(params)
|
|
2616
|
-
});
|
|
2617
|
-
}
|
|
2618
|
-
// @__NO_SIDE_EFFECTS__
|
|
2619
|
-
function _isoDate(Class2, params) {
|
|
2620
|
-
return new Class2({
|
|
2621
|
-
type: "string",
|
|
2622
|
-
format: "date",
|
|
2623
|
-
check: "string_format",
|
|
2624
|
-
...normalizeParams(params)
|
|
2625
|
-
});
|
|
2626
|
-
}
|
|
2627
|
-
// @__NO_SIDE_EFFECTS__
|
|
2628
|
-
function _isoTime(Class2, params) {
|
|
2629
|
-
return new Class2({
|
|
2630
|
-
type: "string",
|
|
2631
|
-
format: "time",
|
|
2632
|
-
check: "string_format",
|
|
2633
|
-
precision: null,
|
|
2634
|
-
...normalizeParams(params)
|
|
2635
|
-
});
|
|
2636
|
-
}
|
|
2637
|
-
// @__NO_SIDE_EFFECTS__
|
|
2638
|
-
function _isoDuration(Class2, params) {
|
|
2639
|
-
return new Class2({
|
|
2640
|
-
type: "string",
|
|
2641
|
-
format: "duration",
|
|
2642
|
-
check: "string_format",
|
|
2643
|
-
...normalizeParams(params)
|
|
2644
|
-
});
|
|
2645
|
-
}
|
|
2646
|
-
// @__NO_SIDE_EFFECTS__
|
|
2647
|
-
function _number(Class2, params) {
|
|
2648
|
-
return new Class2({
|
|
2649
|
-
type: "number",
|
|
2650
|
-
checks: [],
|
|
2651
|
-
...normalizeParams(params)
|
|
2652
|
-
});
|
|
2653
|
-
}
|
|
2654
|
-
// @__NO_SIDE_EFFECTS__
|
|
2655
|
-
function _int(Class2, params) {
|
|
2656
|
-
return new Class2({
|
|
2657
|
-
type: "number",
|
|
2658
|
-
check: "number_format",
|
|
2659
|
-
abort: false,
|
|
2660
|
-
format: "safeint",
|
|
2661
|
-
...normalizeParams(params)
|
|
2662
|
-
});
|
|
2663
|
-
}
|
|
2664
|
-
// @__NO_SIDE_EFFECTS__
|
|
2665
|
-
function _bigint(Class2, params) {
|
|
2666
|
-
return new Class2({
|
|
2667
|
-
type: "bigint",
|
|
2668
|
-
...normalizeParams(params)
|
|
2669
|
-
});
|
|
2670
|
-
}
|
|
2671
|
-
// @__NO_SIDE_EFFECTS__
|
|
2672
|
-
function _lt(value, params) {
|
|
2673
|
-
return new $ZodCheckLessThan({
|
|
2674
|
-
check: "less_than",
|
|
2675
|
-
...normalizeParams(params),
|
|
2676
|
-
value,
|
|
2677
|
-
inclusive: false
|
|
2678
|
-
});
|
|
2679
|
-
}
|
|
2680
|
-
// @__NO_SIDE_EFFECTS__
|
|
2681
|
-
function _lte(value, params) {
|
|
2682
|
-
return new $ZodCheckLessThan({
|
|
2683
|
-
check: "less_than",
|
|
2684
|
-
...normalizeParams(params),
|
|
2685
|
-
value,
|
|
2686
|
-
inclusive: true
|
|
2687
|
-
});
|
|
2688
|
-
}
|
|
2689
|
-
// @__NO_SIDE_EFFECTS__
|
|
2690
|
-
function _gt(value, params) {
|
|
2691
|
-
return new $ZodCheckGreaterThan({
|
|
2692
|
-
check: "greater_than",
|
|
2693
|
-
...normalizeParams(params),
|
|
2694
|
-
value,
|
|
2695
|
-
inclusive: false
|
|
2696
|
-
});
|
|
2697
|
-
}
|
|
2698
|
-
// @__NO_SIDE_EFFECTS__
|
|
2699
|
-
function _gte(value, params) {
|
|
2700
|
-
return new $ZodCheckGreaterThan({
|
|
2701
|
-
check: "greater_than",
|
|
2702
|
-
...normalizeParams(params),
|
|
2703
|
-
value,
|
|
2704
|
-
inclusive: true
|
|
2705
|
-
});
|
|
2706
|
-
}
|
|
2707
|
-
// @__NO_SIDE_EFFECTS__
|
|
2708
|
-
function _multipleOf(value, params) {
|
|
2709
|
-
return new $ZodCheckMultipleOf({
|
|
2710
|
-
check: "multiple_of",
|
|
2711
|
-
...normalizeParams(params),
|
|
2712
|
-
value
|
|
2713
|
-
});
|
|
2714
|
-
}
|
|
2715
|
-
// @__NO_SIDE_EFFECTS__
|
|
2716
|
-
function _maxLength(maximum, params) {
|
|
2717
|
-
const ch = new $ZodCheckMaxLength({
|
|
2718
|
-
check: "max_length",
|
|
2719
|
-
...normalizeParams(params),
|
|
2720
|
-
maximum
|
|
2721
|
-
});
|
|
2722
|
-
return ch;
|
|
2723
|
-
}
|
|
2724
|
-
// @__NO_SIDE_EFFECTS__
|
|
2725
|
-
function _minLength(minimum, params) {
|
|
2726
|
-
return new $ZodCheckMinLength({
|
|
2727
|
-
check: "min_length",
|
|
2728
|
-
...normalizeParams(params),
|
|
2729
|
-
minimum
|
|
2730
|
-
});
|
|
2731
|
-
}
|
|
2732
|
-
// @__NO_SIDE_EFFECTS__
|
|
2733
|
-
function _length(length, params) {
|
|
2734
|
-
return new $ZodCheckLengthEquals({
|
|
2735
|
-
check: "length_equals",
|
|
2736
|
-
...normalizeParams(params),
|
|
2737
|
-
length
|
|
2738
|
-
});
|
|
2739
|
-
}
|
|
2740
|
-
// @__NO_SIDE_EFFECTS__
|
|
2741
|
-
function _regex(pattern, params) {
|
|
2742
|
-
return new $ZodCheckRegex({
|
|
2743
|
-
check: "string_format",
|
|
2744
|
-
format: "regex",
|
|
2745
|
-
...normalizeParams(params),
|
|
2746
|
-
pattern
|
|
2747
|
-
});
|
|
2748
|
-
}
|
|
2749
|
-
// @__NO_SIDE_EFFECTS__
|
|
2750
|
-
function _lowercase(params) {
|
|
2751
|
-
return new $ZodCheckLowerCase({
|
|
2752
|
-
check: "string_format",
|
|
2753
|
-
format: "lowercase",
|
|
2754
|
-
...normalizeParams(params)
|
|
2755
|
-
});
|
|
2756
|
-
}
|
|
2757
|
-
// @__NO_SIDE_EFFECTS__
|
|
2758
|
-
function _uppercase(params) {
|
|
2759
|
-
return new $ZodCheckUpperCase({
|
|
2760
|
-
check: "string_format",
|
|
2761
|
-
format: "uppercase",
|
|
2762
|
-
...normalizeParams(params)
|
|
2763
|
-
});
|
|
2764
|
-
}
|
|
2765
|
-
// @__NO_SIDE_EFFECTS__
|
|
2766
|
-
function _includes(includes, params) {
|
|
2767
|
-
return new $ZodCheckIncludes({
|
|
2768
|
-
check: "string_format",
|
|
2769
|
-
format: "includes",
|
|
2770
|
-
...normalizeParams(params),
|
|
2771
|
-
includes
|
|
2772
|
-
});
|
|
2773
|
-
}
|
|
2774
|
-
// @__NO_SIDE_EFFECTS__
|
|
2775
|
-
function _startsWith(prefix, params) {
|
|
2776
|
-
return new $ZodCheckStartsWith({
|
|
2777
|
-
check: "string_format",
|
|
2778
|
-
format: "starts_with",
|
|
2779
|
-
...normalizeParams(params),
|
|
2780
|
-
prefix
|
|
2781
|
-
});
|
|
2782
|
-
}
|
|
2783
|
-
// @__NO_SIDE_EFFECTS__
|
|
2784
|
-
function _endsWith(suffix, params) {
|
|
2785
|
-
return new $ZodCheckEndsWith({
|
|
2786
|
-
check: "string_format",
|
|
2787
|
-
format: "ends_with",
|
|
2788
|
-
...normalizeParams(params),
|
|
2789
|
-
suffix
|
|
2790
|
-
});
|
|
2791
|
-
}
|
|
2792
|
-
// @__NO_SIDE_EFFECTS__
|
|
2793
|
-
function _overwrite(tx) {
|
|
2794
|
-
return new $ZodCheckOverwrite({
|
|
2795
|
-
check: "overwrite",
|
|
2796
|
-
tx
|
|
2797
|
-
});
|
|
2798
|
-
}
|
|
2799
|
-
// @__NO_SIDE_EFFECTS__
|
|
2800
|
-
function _normalize(form) {
|
|
2801
|
-
return /* @__PURE__ */ _overwrite((input) => input.normalize(form));
|
|
2802
|
-
}
|
|
2803
|
-
// @__NO_SIDE_EFFECTS__
|
|
2804
|
-
function _trim() {
|
|
2805
|
-
return /* @__PURE__ */ _overwrite((input) => input.trim());
|
|
2806
|
-
}
|
|
2807
|
-
// @__NO_SIDE_EFFECTS__
|
|
2808
|
-
function _toLowerCase() {
|
|
2809
|
-
return /* @__PURE__ */ _overwrite((input) => input.toLowerCase());
|
|
2810
|
-
}
|
|
2811
|
-
// @__NO_SIDE_EFFECTS__
|
|
2812
|
-
function _toUpperCase() {
|
|
2813
|
-
return /* @__PURE__ */ _overwrite((input) => input.toUpperCase());
|
|
2814
|
-
}
|
|
2815
|
-
// @__NO_SIDE_EFFECTS__
|
|
2816
|
-
function _slugify() {
|
|
2817
|
-
return /* @__PURE__ */ _overwrite((input) => slugify(input));
|
|
2818
|
-
}
|
|
2819
|
-
// @__NO_SIDE_EFFECTS__
|
|
2820
|
-
function _array(Class2, element, params) {
|
|
2821
|
-
return new Class2({
|
|
2822
|
-
type: "array",
|
|
2823
|
-
element,
|
|
2824
|
-
// get element() {
|
|
2825
|
-
// return element;
|
|
2826
|
-
// },
|
|
2827
|
-
...normalizeParams(params)
|
|
2828
|
-
});
|
|
2829
|
-
}
|
|
2830
|
-
// @__NO_SIDE_EFFECTS__
|
|
2831
|
-
function _refine(Class2, fn, _params) {
|
|
2832
|
-
const schema = new Class2({
|
|
2833
|
-
type: "custom",
|
|
2834
|
-
check: "custom",
|
|
2835
|
-
fn,
|
|
2836
|
-
...normalizeParams(_params)
|
|
2837
|
-
});
|
|
2838
|
-
return schema;
|
|
2839
|
-
}
|
|
2840
|
-
// @__NO_SIDE_EFFECTS__
|
|
2841
|
-
function _superRefine(fn, params) {
|
|
2842
|
-
const ch = /* @__PURE__ */ _check((payload) => {
|
|
2843
|
-
payload.addIssue = (issue2) => {
|
|
2844
|
-
if (typeof issue2 === "string") {
|
|
2845
|
-
payload.issues.push(issue(issue2, payload.value, ch._zod.def));
|
|
2846
|
-
} else {
|
|
2847
|
-
const _issue = issue2;
|
|
2848
|
-
if (_issue.fatal)
|
|
2849
|
-
_issue.continue = false;
|
|
2850
|
-
_issue.code ?? (_issue.code = "custom");
|
|
2851
|
-
_issue.input ?? (_issue.input = payload.value);
|
|
2852
|
-
_issue.inst ?? (_issue.inst = ch);
|
|
2853
|
-
_issue.continue ?? (_issue.continue = !ch._zod.def.abort);
|
|
2854
|
-
payload.issues.push(issue(_issue));
|
|
2855
|
-
}
|
|
2856
|
-
};
|
|
2857
|
-
return fn(payload.value, payload);
|
|
2858
|
-
}, params);
|
|
2859
|
-
return ch;
|
|
2860
|
-
}
|
|
2861
|
-
// @__NO_SIDE_EFFECTS__
|
|
2862
|
-
function _check(fn, params) {
|
|
2863
|
-
const ch = new $ZodCheck({
|
|
2864
|
-
check: "custom",
|
|
2865
|
-
...normalizeParams(params)
|
|
2866
|
-
});
|
|
2867
|
-
ch._zod.check = fn;
|
|
2868
|
-
return ch;
|
|
2869
|
-
}
|
|
2870
|
-
|
|
2871
|
-
// ../../../../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/to-json-schema.js
|
|
2872
|
-
function initializeContext(params) {
|
|
2873
|
-
let target = params?.target ?? "draft-2020-12";
|
|
2874
|
-
if (target === "draft-4")
|
|
2875
|
-
target = "draft-04";
|
|
2876
|
-
if (target === "draft-7")
|
|
2877
|
-
target = "draft-07";
|
|
2878
|
-
return {
|
|
2879
|
-
processors: params.processors ?? {},
|
|
2880
|
-
metadataRegistry: params?.metadata ?? globalRegistry,
|
|
2881
|
-
target,
|
|
2882
|
-
unrepresentable: params?.unrepresentable ?? "throw",
|
|
2883
|
-
override: params?.override ?? (() => {
|
|
2884
|
-
}),
|
|
2885
|
-
io: params?.io ?? "output",
|
|
2886
|
-
counter: 0,
|
|
2887
|
-
seen: /* @__PURE__ */ new Map(),
|
|
2888
|
-
cycles: params?.cycles ?? "ref",
|
|
2889
|
-
reused: params?.reused ?? "inline",
|
|
2890
|
-
external: params?.external ?? void 0
|
|
2891
|
-
};
|
|
2892
|
-
}
|
|
2893
|
-
function process2(schema, ctx, _params = { path: [], schemaPath: [] }) {
|
|
2894
|
-
var _a4;
|
|
2895
|
-
const def = schema._zod.def;
|
|
2896
|
-
const seen = ctx.seen.get(schema);
|
|
2897
|
-
if (seen) {
|
|
2898
|
-
seen.count++;
|
|
2899
|
-
const isCycle = _params.schemaPath.includes(schema);
|
|
2900
|
-
if (isCycle) {
|
|
2901
|
-
seen.cycle = _params.path;
|
|
2902
|
-
}
|
|
2903
|
-
return seen.schema;
|
|
2904
|
-
}
|
|
2905
|
-
const result = { schema: {}, count: 1, cycle: void 0, path: _params.path };
|
|
2906
|
-
ctx.seen.set(schema, result);
|
|
2907
|
-
const overrideSchema = schema._zod.toJSONSchema?.();
|
|
2908
|
-
if (overrideSchema) {
|
|
2909
|
-
result.schema = overrideSchema;
|
|
2910
|
-
} else {
|
|
2911
|
-
const params = {
|
|
2912
|
-
..._params,
|
|
2913
|
-
schemaPath: [..._params.schemaPath, schema],
|
|
2914
|
-
path: _params.path
|
|
2915
|
-
};
|
|
2916
|
-
if (schema._zod.processJSONSchema) {
|
|
2917
|
-
schema._zod.processJSONSchema(ctx, result.schema, params);
|
|
2918
|
-
} else {
|
|
2919
|
-
const _json = result.schema;
|
|
2920
|
-
const processor = ctx.processors[def.type];
|
|
2921
|
-
if (!processor) {
|
|
2922
|
-
throw new Error(`[toJSONSchema]: Non-representable type encountered: ${def.type}`);
|
|
2923
|
-
}
|
|
2924
|
-
processor(schema, ctx, _json, params);
|
|
2925
|
-
}
|
|
2926
|
-
const parent = schema._zod.parent;
|
|
2927
|
-
if (parent) {
|
|
2928
|
-
if (!result.ref)
|
|
2929
|
-
result.ref = parent;
|
|
2930
|
-
process2(parent, ctx, params);
|
|
2931
|
-
ctx.seen.get(parent).isParent = true;
|
|
2932
|
-
}
|
|
2933
|
-
}
|
|
2934
|
-
const meta2 = ctx.metadataRegistry.get(schema);
|
|
2935
|
-
if (meta2)
|
|
2936
|
-
Object.assign(result.schema, meta2);
|
|
2937
|
-
if (ctx.io === "input" && isTransforming(schema)) {
|
|
2938
|
-
delete result.schema.examples;
|
|
2939
|
-
delete result.schema.default;
|
|
2940
|
-
}
|
|
2941
|
-
if (ctx.io === "input" && "_prefault" in result.schema)
|
|
2942
|
-
(_a4 = result.schema).default ?? (_a4.default = result.schema._prefault);
|
|
2943
|
-
delete result.schema._prefault;
|
|
2944
|
-
const _result = ctx.seen.get(schema);
|
|
2945
|
-
return _result.schema;
|
|
2946
|
-
}
|
|
2947
|
-
function extractDefs(ctx, schema) {
|
|
2948
|
-
const root = ctx.seen.get(schema);
|
|
2949
|
-
if (!root)
|
|
2950
|
-
throw new Error("Unprocessed schema. This is a bug in Zod.");
|
|
2951
|
-
const idToSchema = /* @__PURE__ */ new Map();
|
|
2952
|
-
for (const entry of ctx.seen.entries()) {
|
|
2953
|
-
const id = ctx.metadataRegistry.get(entry[0])?.id;
|
|
2954
|
-
if (id) {
|
|
2955
|
-
const existing = idToSchema.get(id);
|
|
2956
|
-
if (existing && existing !== entry[0]) {
|
|
2957
|
-
throw new Error(`Duplicate schema id "${id}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);
|
|
2958
|
-
}
|
|
2959
|
-
idToSchema.set(id, entry[0]);
|
|
2960
|
-
}
|
|
2961
|
-
}
|
|
2962
|
-
const makeURI = (entry) => {
|
|
2963
|
-
const defsSegment = ctx.target === "draft-2020-12" ? "$defs" : "definitions";
|
|
2964
|
-
if (ctx.external) {
|
|
2965
|
-
const externalId = ctx.external.registry.get(entry[0])?.id;
|
|
2966
|
-
const uriGenerator = ctx.external.uri ?? ((id2) => id2);
|
|
2967
|
-
if (externalId) {
|
|
2968
|
-
return { ref: uriGenerator(externalId) };
|
|
2969
|
-
}
|
|
2970
|
-
const id = entry[1].defId ?? entry[1].schema.id ?? `schema${ctx.counter++}`;
|
|
2971
|
-
entry[1].defId = id;
|
|
2972
|
-
return { defId: id, ref: `${uriGenerator("__shared")}#/${defsSegment}/${id}` };
|
|
2973
|
-
}
|
|
2974
|
-
if (entry[1] === root) {
|
|
2975
|
-
return { ref: "#" };
|
|
2976
|
-
}
|
|
2977
|
-
const uriPrefix = `#`;
|
|
2978
|
-
const defUriPrefix = `${uriPrefix}/${defsSegment}/`;
|
|
2979
|
-
const defId = entry[1].schema.id ?? `__schema${ctx.counter++}`;
|
|
2980
|
-
return { defId, ref: defUriPrefix + defId };
|
|
2981
|
-
};
|
|
2982
|
-
const extractToDef = (entry) => {
|
|
2983
|
-
if (entry[1].schema.$ref) {
|
|
2984
|
-
return;
|
|
2985
|
-
}
|
|
2986
|
-
const seen = entry[1];
|
|
2987
|
-
const { ref, defId } = makeURI(entry);
|
|
2988
|
-
seen.def = { ...seen.schema };
|
|
2989
|
-
if (defId)
|
|
2990
|
-
seen.defId = defId;
|
|
2991
|
-
const schema2 = seen.schema;
|
|
2992
|
-
for (const key in schema2) {
|
|
2993
|
-
delete schema2[key];
|
|
2994
|
-
}
|
|
2995
|
-
schema2.$ref = ref;
|
|
2996
|
-
};
|
|
2997
|
-
if (ctx.cycles === "throw") {
|
|
2998
|
-
for (const entry of ctx.seen.entries()) {
|
|
2999
|
-
const seen = entry[1];
|
|
3000
|
-
if (seen.cycle) {
|
|
3001
|
-
throw new Error(`Cycle detected: #/${seen.cycle?.join("/")}/<root>
|
|
3002
|
-
|
|
3003
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`);
|
|
3004
|
-
}
|
|
3005
|
-
}
|
|
3006
|
-
}
|
|
3007
|
-
for (const entry of ctx.seen.entries()) {
|
|
3008
|
-
const seen = entry[1];
|
|
3009
|
-
if (schema === entry[0]) {
|
|
3010
|
-
extractToDef(entry);
|
|
3011
|
-
continue;
|
|
3012
|
-
}
|
|
3013
|
-
if (ctx.external) {
|
|
3014
|
-
const ext = ctx.external.registry.get(entry[0])?.id;
|
|
3015
|
-
if (schema !== entry[0] && ext) {
|
|
3016
|
-
extractToDef(entry);
|
|
3017
|
-
continue;
|
|
3018
|
-
}
|
|
3019
|
-
}
|
|
3020
|
-
const id = ctx.metadataRegistry.get(entry[0])?.id;
|
|
3021
|
-
if (id) {
|
|
3022
|
-
extractToDef(entry);
|
|
3023
|
-
continue;
|
|
3024
|
-
}
|
|
3025
|
-
if (seen.cycle) {
|
|
3026
|
-
extractToDef(entry);
|
|
3027
|
-
continue;
|
|
3028
|
-
}
|
|
3029
|
-
if (seen.count > 1) {
|
|
3030
|
-
if (ctx.reused === "ref") {
|
|
3031
|
-
extractToDef(entry);
|
|
3032
|
-
continue;
|
|
3033
|
-
}
|
|
3034
|
-
}
|
|
3035
|
-
}
|
|
3036
|
-
}
|
|
3037
|
-
function finalize(ctx, schema) {
|
|
3038
|
-
const root = ctx.seen.get(schema);
|
|
3039
|
-
if (!root)
|
|
3040
|
-
throw new Error("Unprocessed schema. This is a bug in Zod.");
|
|
3041
|
-
const flattenRef = (zodSchema) => {
|
|
3042
|
-
const seen = ctx.seen.get(zodSchema);
|
|
3043
|
-
if (seen.ref === null)
|
|
3044
|
-
return;
|
|
3045
|
-
const schema2 = seen.def ?? seen.schema;
|
|
3046
|
-
const _cached = { ...schema2 };
|
|
3047
|
-
const ref = seen.ref;
|
|
3048
|
-
seen.ref = null;
|
|
3049
|
-
if (ref) {
|
|
3050
|
-
flattenRef(ref);
|
|
3051
|
-
const refSeen = ctx.seen.get(ref);
|
|
3052
|
-
const refSchema = refSeen.schema;
|
|
3053
|
-
if (refSchema.$ref && (ctx.target === "draft-07" || ctx.target === "draft-04" || ctx.target === "openapi-3.0")) {
|
|
3054
|
-
schema2.allOf = schema2.allOf ?? [];
|
|
3055
|
-
schema2.allOf.push(refSchema);
|
|
3056
|
-
} else {
|
|
3057
|
-
Object.assign(schema2, refSchema);
|
|
3058
|
-
}
|
|
3059
|
-
Object.assign(schema2, _cached);
|
|
3060
|
-
const isParentRef = zodSchema._zod.parent === ref;
|
|
3061
|
-
if (isParentRef) {
|
|
3062
|
-
for (const key in schema2) {
|
|
3063
|
-
if (key === "$ref" || key === "allOf")
|
|
3064
|
-
continue;
|
|
3065
|
-
if (!(key in _cached)) {
|
|
3066
|
-
delete schema2[key];
|
|
3067
|
-
}
|
|
3068
|
-
}
|
|
3069
|
-
}
|
|
3070
|
-
if (refSchema.$ref && refSeen.def) {
|
|
3071
|
-
for (const key in schema2) {
|
|
3072
|
-
if (key === "$ref" || key === "allOf")
|
|
3073
|
-
continue;
|
|
3074
|
-
if (key in refSeen.def && JSON.stringify(schema2[key]) === JSON.stringify(refSeen.def[key])) {
|
|
3075
|
-
delete schema2[key];
|
|
3076
|
-
}
|
|
3077
|
-
}
|
|
3078
|
-
}
|
|
3079
|
-
}
|
|
3080
|
-
const parent = zodSchema._zod.parent;
|
|
3081
|
-
if (parent && parent !== ref) {
|
|
3082
|
-
flattenRef(parent);
|
|
3083
|
-
const parentSeen = ctx.seen.get(parent);
|
|
3084
|
-
if (parentSeen?.schema.$ref) {
|
|
3085
|
-
schema2.$ref = parentSeen.schema.$ref;
|
|
3086
|
-
if (parentSeen.def) {
|
|
3087
|
-
for (const key in schema2) {
|
|
3088
|
-
if (key === "$ref" || key === "allOf")
|
|
3089
|
-
continue;
|
|
3090
|
-
if (key in parentSeen.def && JSON.stringify(schema2[key]) === JSON.stringify(parentSeen.def[key])) {
|
|
3091
|
-
delete schema2[key];
|
|
3092
|
-
}
|
|
3093
|
-
}
|
|
3094
|
-
}
|
|
3095
|
-
}
|
|
3096
|
-
}
|
|
3097
|
-
ctx.override({
|
|
3098
|
-
zodSchema,
|
|
3099
|
-
jsonSchema: schema2,
|
|
3100
|
-
path: seen.path ?? []
|
|
3101
|
-
});
|
|
3102
|
-
};
|
|
3103
|
-
for (const entry of [...ctx.seen.entries()].reverse()) {
|
|
3104
|
-
flattenRef(entry[0]);
|
|
3105
|
-
}
|
|
3106
|
-
const result = {};
|
|
3107
|
-
if (ctx.target === "draft-2020-12") {
|
|
3108
|
-
result.$schema = "https://json-schema.org/draft/2020-12/schema";
|
|
3109
|
-
} else if (ctx.target === "draft-07") {
|
|
3110
|
-
result.$schema = "http://json-schema.org/draft-07/schema#";
|
|
3111
|
-
} else if (ctx.target === "draft-04") {
|
|
3112
|
-
result.$schema = "http://json-schema.org/draft-04/schema#";
|
|
3113
|
-
} else if (ctx.target === "openapi-3.0") {
|
|
3114
|
-
} else {
|
|
3115
|
-
}
|
|
3116
|
-
if (ctx.external?.uri) {
|
|
3117
|
-
const id = ctx.external.registry.get(schema)?.id;
|
|
3118
|
-
if (!id)
|
|
3119
|
-
throw new Error("Schema is missing an `id` property");
|
|
3120
|
-
result.$id = ctx.external.uri(id);
|
|
3121
|
-
}
|
|
3122
|
-
Object.assign(result, root.def ?? root.schema);
|
|
3123
|
-
const rootMetaId = ctx.metadataRegistry.get(schema)?.id;
|
|
3124
|
-
if (rootMetaId !== void 0 && result.id === rootMetaId)
|
|
3125
|
-
delete result.id;
|
|
3126
|
-
const defs = ctx.external?.defs ?? {};
|
|
3127
|
-
for (const entry of ctx.seen.entries()) {
|
|
3128
|
-
const seen = entry[1];
|
|
3129
|
-
if (seen.def && seen.defId) {
|
|
3130
|
-
if (seen.def.id === seen.defId)
|
|
3131
|
-
delete seen.def.id;
|
|
3132
|
-
defs[seen.defId] = seen.def;
|
|
3133
|
-
}
|
|
3134
|
-
}
|
|
3135
|
-
if (ctx.external) {
|
|
3136
|
-
} else {
|
|
3137
|
-
if (Object.keys(defs).length > 0) {
|
|
3138
|
-
if (ctx.target === "draft-2020-12") {
|
|
3139
|
-
result.$defs = defs;
|
|
3140
|
-
} else {
|
|
3141
|
-
result.definitions = defs;
|
|
3142
|
-
}
|
|
3143
|
-
}
|
|
3144
|
-
}
|
|
3145
|
-
try {
|
|
3146
|
-
const finalized = JSON.parse(JSON.stringify(result));
|
|
3147
|
-
Object.defineProperty(finalized, "~standard", {
|
|
3148
|
-
value: {
|
|
3149
|
-
...schema["~standard"],
|
|
3150
|
-
jsonSchema: {
|
|
3151
|
-
input: createStandardJSONSchemaMethod(schema, "input", ctx.processors),
|
|
3152
|
-
output: createStandardJSONSchemaMethod(schema, "output", ctx.processors)
|
|
3153
|
-
}
|
|
3154
|
-
},
|
|
3155
|
-
enumerable: false,
|
|
3156
|
-
writable: false
|
|
3157
|
-
});
|
|
3158
|
-
return finalized;
|
|
3159
|
-
} catch (_err) {
|
|
3160
|
-
throw new Error("Error converting schema to JSON.");
|
|
3161
|
-
}
|
|
3162
|
-
}
|
|
3163
|
-
function isTransforming(_schema, _ctx) {
|
|
3164
|
-
const ctx = _ctx ?? { seen: /* @__PURE__ */ new Set() };
|
|
3165
|
-
if (ctx.seen.has(_schema))
|
|
3166
|
-
return false;
|
|
3167
|
-
ctx.seen.add(_schema);
|
|
3168
|
-
const def = _schema._zod.def;
|
|
3169
|
-
if (def.type === "transform")
|
|
3170
|
-
return true;
|
|
3171
|
-
if (def.type === "array")
|
|
3172
|
-
return isTransforming(def.element, ctx);
|
|
3173
|
-
if (def.type === "set")
|
|
3174
|
-
return isTransforming(def.valueType, ctx);
|
|
3175
|
-
if (def.type === "lazy")
|
|
3176
|
-
return isTransforming(def.getter(), ctx);
|
|
3177
|
-
if (def.type === "promise" || def.type === "optional" || def.type === "nonoptional" || def.type === "nullable" || def.type === "readonly" || def.type === "default" || def.type === "prefault") {
|
|
3178
|
-
return isTransforming(def.innerType, ctx);
|
|
3179
|
-
}
|
|
3180
|
-
if (def.type === "intersection") {
|
|
3181
|
-
return isTransforming(def.left, ctx) || isTransforming(def.right, ctx);
|
|
3182
|
-
}
|
|
3183
|
-
if (def.type === "record" || def.type === "map") {
|
|
3184
|
-
return isTransforming(def.keyType, ctx) || isTransforming(def.valueType, ctx);
|
|
3185
|
-
}
|
|
3186
|
-
if (def.type === "pipe") {
|
|
3187
|
-
if (_schema._zod.traits.has("$ZodCodec"))
|
|
3188
|
-
return true;
|
|
3189
|
-
return isTransforming(def.in, ctx) || isTransforming(def.out, ctx);
|
|
3190
|
-
}
|
|
3191
|
-
if (def.type === "object") {
|
|
3192
|
-
for (const key in def.shape) {
|
|
3193
|
-
if (isTransforming(def.shape[key], ctx))
|
|
3194
|
-
return true;
|
|
3195
|
-
}
|
|
3196
|
-
return false;
|
|
3197
|
-
}
|
|
3198
|
-
if (def.type === "union") {
|
|
3199
|
-
for (const option of def.options) {
|
|
3200
|
-
if (isTransforming(option, ctx))
|
|
3201
|
-
return true;
|
|
3202
|
-
}
|
|
3203
|
-
return false;
|
|
3204
|
-
}
|
|
3205
|
-
if (def.type === "tuple") {
|
|
3206
|
-
for (const item of def.items) {
|
|
3207
|
-
if (isTransforming(item, ctx))
|
|
3208
|
-
return true;
|
|
3209
|
-
}
|
|
3210
|
-
if (def.rest && isTransforming(def.rest, ctx))
|
|
3211
|
-
return true;
|
|
3212
|
-
return false;
|
|
3213
|
-
}
|
|
3214
|
-
return false;
|
|
3215
|
-
}
|
|
3216
|
-
var createToJSONSchemaMethod = (schema, processors = {}) => (params) => {
|
|
3217
|
-
const ctx = initializeContext({ ...params, processors });
|
|
3218
|
-
process2(schema, ctx);
|
|
3219
|
-
extractDefs(ctx, schema);
|
|
3220
|
-
return finalize(ctx, schema);
|
|
3221
|
-
};
|
|
3222
|
-
var createStandardJSONSchemaMethod = (schema, io, processors = {}) => (params) => {
|
|
3223
|
-
const { libraryOptions, target } = params ?? {};
|
|
3224
|
-
const ctx = initializeContext({ ...libraryOptions ?? {}, target, io, processors });
|
|
3225
|
-
process2(schema, ctx);
|
|
3226
|
-
extractDefs(ctx, schema);
|
|
3227
|
-
return finalize(ctx, schema);
|
|
3228
|
-
};
|
|
3229
|
-
|
|
3230
|
-
// ../../../../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/json-schema-processors.js
|
|
3231
|
-
var formatMap = {
|
|
3232
|
-
guid: "uuid",
|
|
3233
|
-
url: "uri",
|
|
3234
|
-
datetime: "date-time",
|
|
3235
|
-
json_string: "json-string",
|
|
3236
|
-
regex: ""
|
|
3237
|
-
// do not set
|
|
3238
|
-
};
|
|
3239
|
-
var stringProcessor = (schema, ctx, _json, _params) => {
|
|
3240
|
-
const json = _json;
|
|
3241
|
-
json.type = "string";
|
|
3242
|
-
const { minimum, maximum, format, patterns, contentEncoding } = schema._zod.bag;
|
|
3243
|
-
if (typeof minimum === "number")
|
|
3244
|
-
json.minLength = minimum;
|
|
3245
|
-
if (typeof maximum === "number")
|
|
3246
|
-
json.maxLength = maximum;
|
|
3247
|
-
if (format) {
|
|
3248
|
-
json.format = formatMap[format] ?? format;
|
|
3249
|
-
if (json.format === "")
|
|
3250
|
-
delete json.format;
|
|
3251
|
-
if (format === "time") {
|
|
3252
|
-
delete json.format;
|
|
3253
|
-
}
|
|
3254
|
-
}
|
|
3255
|
-
if (contentEncoding)
|
|
3256
|
-
json.contentEncoding = contentEncoding;
|
|
3257
|
-
if (patterns && patterns.size > 0) {
|
|
3258
|
-
const regexes = [...patterns];
|
|
3259
|
-
if (regexes.length === 1)
|
|
3260
|
-
json.pattern = regexes[0].source;
|
|
3261
|
-
else if (regexes.length > 1) {
|
|
3262
|
-
json.allOf = [
|
|
3263
|
-
...regexes.map((regex) => ({
|
|
3264
|
-
...ctx.target === "draft-07" || ctx.target === "draft-04" || ctx.target === "openapi-3.0" ? { type: "string" } : {},
|
|
3265
|
-
pattern: regex.source
|
|
3266
|
-
}))
|
|
3267
|
-
];
|
|
3268
|
-
}
|
|
3269
|
-
}
|
|
3270
|
-
};
|
|
3271
|
-
var numberProcessor = (schema, ctx, _json, _params) => {
|
|
3272
|
-
const json = _json;
|
|
3273
|
-
const { minimum, maximum, format, multipleOf, exclusiveMaximum, exclusiveMinimum } = schema._zod.bag;
|
|
3274
|
-
if (typeof format === "string" && format.includes("int"))
|
|
3275
|
-
json.type = "integer";
|
|
3276
|
-
else
|
|
3277
|
-
json.type = "number";
|
|
3278
|
-
const exMin = typeof exclusiveMinimum === "number" && exclusiveMinimum >= (minimum ?? Number.NEGATIVE_INFINITY);
|
|
3279
|
-
const exMax = typeof exclusiveMaximum === "number" && exclusiveMaximum <= (maximum ?? Number.POSITIVE_INFINITY);
|
|
3280
|
-
const legacy = ctx.target === "draft-04" || ctx.target === "openapi-3.0";
|
|
3281
|
-
if (exMin) {
|
|
3282
|
-
if (legacy) {
|
|
3283
|
-
json.minimum = exclusiveMinimum;
|
|
3284
|
-
json.exclusiveMinimum = true;
|
|
3285
|
-
} else {
|
|
3286
|
-
json.exclusiveMinimum = exclusiveMinimum;
|
|
3287
|
-
}
|
|
3288
|
-
} else if (typeof minimum === "number") {
|
|
3289
|
-
json.minimum = minimum;
|
|
3290
|
-
}
|
|
3291
|
-
if (exMax) {
|
|
3292
|
-
if (legacy) {
|
|
3293
|
-
json.maximum = exclusiveMaximum;
|
|
3294
|
-
json.exclusiveMaximum = true;
|
|
3295
|
-
} else {
|
|
3296
|
-
json.exclusiveMaximum = exclusiveMaximum;
|
|
3297
|
-
}
|
|
3298
|
-
} else if (typeof maximum === "number") {
|
|
3299
|
-
json.maximum = maximum;
|
|
3300
|
-
}
|
|
3301
|
-
if (typeof multipleOf === "number")
|
|
3302
|
-
json.multipleOf = multipleOf;
|
|
3303
|
-
};
|
|
3304
|
-
var bigintProcessor = (_schema, ctx, _json, _params) => {
|
|
3305
|
-
if (ctx.unrepresentable === "throw") {
|
|
3306
|
-
throw new Error("BigInt cannot be represented in JSON Schema");
|
|
3307
|
-
}
|
|
3308
|
-
};
|
|
3309
|
-
var customProcessor = (_schema, ctx, _json, _params) => {
|
|
3310
|
-
if (ctx.unrepresentable === "throw") {
|
|
3311
|
-
throw new Error("Custom types cannot be represented in JSON Schema");
|
|
3312
|
-
}
|
|
3313
|
-
};
|
|
3314
|
-
var transformProcessor = (_schema, ctx, _json, _params) => {
|
|
3315
|
-
if (ctx.unrepresentable === "throw") {
|
|
3316
|
-
throw new Error("Transforms cannot be represented in JSON Schema");
|
|
698
|
+
payload.issues.push(issue(_iss));
|
|
3317
699
|
}
|
|
3318
|
-
}
|
|
3319
|
-
|
|
3320
|
-
|
|
3321
|
-
|
|
3322
|
-
|
|
3323
|
-
|
|
3324
|
-
|
|
3325
|
-
|
|
3326
|
-
json.maxItems = maximum;
|
|
3327
|
-
json.type = "array";
|
|
3328
|
-
json.items = process2(def.element, ctx, {
|
|
3329
|
-
...params,
|
|
3330
|
-
path: [...params.path, "items"]
|
|
700
|
+
}
|
|
701
|
+
|
|
702
|
+
// ../../../../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/api.js
|
|
703
|
+
// @__NO_SIDE_EFFECTS__
|
|
704
|
+
function _string(Class, params) {
|
|
705
|
+
return new Class({
|
|
706
|
+
type: "string",
|
|
707
|
+
...normalizeParams(params)
|
|
3331
708
|
});
|
|
3332
|
-
}
|
|
3333
|
-
|
|
3334
|
-
|
|
3335
|
-
|
|
3336
|
-
|
|
3337
|
-
|
|
3338
|
-
|
|
3339
|
-
}));
|
|
3340
|
-
if (isExclusive) {
|
|
3341
|
-
json.oneOf = options;
|
|
3342
|
-
} else {
|
|
3343
|
-
json.anyOf = options;
|
|
3344
|
-
}
|
|
3345
|
-
};
|
|
3346
|
-
var intersectionProcessor = (schema, ctx, json, params) => {
|
|
3347
|
-
const def = schema._zod.def;
|
|
3348
|
-
const a = process2(def.left, ctx, {
|
|
3349
|
-
...params,
|
|
3350
|
-
path: [...params.path, "allOf", 0]
|
|
709
|
+
}
|
|
710
|
+
// @__NO_SIDE_EFFECTS__
|
|
711
|
+
function _number(Class, params) {
|
|
712
|
+
return new Class({
|
|
713
|
+
type: "number",
|
|
714
|
+
checks: [],
|
|
715
|
+
...normalizeParams(params)
|
|
3351
716
|
});
|
|
3352
|
-
|
|
3353
|
-
|
|
3354
|
-
|
|
717
|
+
}
|
|
718
|
+
// @__NO_SIDE_EFFECTS__
|
|
719
|
+
function _bigint(Class, params) {
|
|
720
|
+
return new Class({
|
|
721
|
+
type: "bigint",
|
|
722
|
+
...normalizeParams(params)
|
|
3355
723
|
});
|
|
3356
|
-
const isSimpleIntersection = (val) => "allOf" in val && Object.keys(val).length === 1;
|
|
3357
|
-
const allOf = [
|
|
3358
|
-
...isSimpleIntersection(a) ? a.allOf : [a],
|
|
3359
|
-
...isSimpleIntersection(b) ? b.allOf : [b]
|
|
3360
|
-
];
|
|
3361
|
-
json.allOf = allOf;
|
|
3362
|
-
};
|
|
3363
|
-
var nullableProcessor = (schema, ctx, json, params) => {
|
|
3364
|
-
const def = schema._zod.def;
|
|
3365
|
-
const inner = process2(def.innerType, ctx, params);
|
|
3366
|
-
const seen = ctx.seen.get(schema);
|
|
3367
|
-
if (ctx.target === "openapi-3.0") {
|
|
3368
|
-
seen.ref = def.innerType;
|
|
3369
|
-
json.nullable = true;
|
|
3370
|
-
} else {
|
|
3371
|
-
json.anyOf = [inner, { type: "null" }];
|
|
3372
|
-
}
|
|
3373
|
-
};
|
|
3374
|
-
var nonoptionalProcessor = (schema, ctx, _json, params) => {
|
|
3375
|
-
const def = schema._zod.def;
|
|
3376
|
-
process2(def.innerType, ctx, params);
|
|
3377
|
-
const seen = ctx.seen.get(schema);
|
|
3378
|
-
seen.ref = def.innerType;
|
|
3379
|
-
};
|
|
3380
|
-
var defaultProcessor = (schema, ctx, json, params) => {
|
|
3381
|
-
const def = schema._zod.def;
|
|
3382
|
-
process2(def.innerType, ctx, params);
|
|
3383
|
-
const seen = ctx.seen.get(schema);
|
|
3384
|
-
seen.ref = def.innerType;
|
|
3385
|
-
json.default = JSON.parse(JSON.stringify(def.defaultValue));
|
|
3386
|
-
};
|
|
3387
|
-
var prefaultProcessor = (schema, ctx, json, params) => {
|
|
3388
|
-
const def = schema._zod.def;
|
|
3389
|
-
process2(def.innerType, ctx, params);
|
|
3390
|
-
const seen = ctx.seen.get(schema);
|
|
3391
|
-
seen.ref = def.innerType;
|
|
3392
|
-
if (ctx.io === "input")
|
|
3393
|
-
json._prefault = JSON.parse(JSON.stringify(def.defaultValue));
|
|
3394
|
-
};
|
|
3395
|
-
var catchProcessor = (schema, ctx, json, params) => {
|
|
3396
|
-
const def = schema._zod.def;
|
|
3397
|
-
process2(def.innerType, ctx, params);
|
|
3398
|
-
const seen = ctx.seen.get(schema);
|
|
3399
|
-
seen.ref = def.innerType;
|
|
3400
|
-
let catchValue;
|
|
3401
|
-
try {
|
|
3402
|
-
catchValue = def.catchValue(void 0);
|
|
3403
|
-
} catch {
|
|
3404
|
-
throw new Error("Dynamic catch values are not supported in JSON Schema");
|
|
3405
|
-
}
|
|
3406
|
-
json.default = catchValue;
|
|
3407
|
-
};
|
|
3408
|
-
var pipeProcessor = (schema, ctx, _json, params) => {
|
|
3409
|
-
const def = schema._zod.def;
|
|
3410
|
-
const inIsTransform = def.in._zod.traits.has("$ZodTransform");
|
|
3411
|
-
const innerType = ctx.io === "input" ? inIsTransform ? def.out : def.in : def.out;
|
|
3412
|
-
process2(innerType, ctx, params);
|
|
3413
|
-
const seen = ctx.seen.get(schema);
|
|
3414
|
-
seen.ref = innerType;
|
|
3415
|
-
};
|
|
3416
|
-
var readonlyProcessor = (schema, ctx, json, params) => {
|
|
3417
|
-
const def = schema._zod.def;
|
|
3418
|
-
process2(def.innerType, ctx, params);
|
|
3419
|
-
const seen = ctx.seen.get(schema);
|
|
3420
|
-
seen.ref = def.innerType;
|
|
3421
|
-
json.readOnly = true;
|
|
3422
|
-
};
|
|
3423
|
-
var optionalProcessor = (schema, ctx, _json, params) => {
|
|
3424
|
-
const def = schema._zod.def;
|
|
3425
|
-
process2(def.innerType, ctx, params);
|
|
3426
|
-
const seen = ctx.seen.get(schema);
|
|
3427
|
-
seen.ref = def.innerType;
|
|
3428
|
-
};
|
|
3429
|
-
|
|
3430
|
-
// ../../../../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/iso.js
|
|
3431
|
-
var ZodISODateTime = /* @__PURE__ */ $constructor("ZodISODateTime", (inst, def) => {
|
|
3432
|
-
$ZodISODateTime.init(inst, def);
|
|
3433
|
-
ZodStringFormat.init(inst, def);
|
|
3434
|
-
});
|
|
3435
|
-
function datetime2(params) {
|
|
3436
|
-
return _isoDateTime(ZodISODateTime, params);
|
|
3437
724
|
}
|
|
3438
|
-
|
|
3439
|
-
|
|
3440
|
-
|
|
3441
|
-
|
|
3442
|
-
|
|
3443
|
-
|
|
725
|
+
// @__NO_SIDE_EFFECTS__
|
|
726
|
+
function _gte(value, params) {
|
|
727
|
+
return new $ZodCheckGreaterThan({
|
|
728
|
+
check: "greater_than",
|
|
729
|
+
...normalizeParams(params),
|
|
730
|
+
value,
|
|
731
|
+
inclusive: true
|
|
732
|
+
});
|
|
3444
733
|
}
|
|
3445
|
-
|
|
3446
|
-
|
|
3447
|
-
|
|
3448
|
-
});
|
|
3449
|
-
function time2(params) {
|
|
3450
|
-
return _isoTime(ZodISOTime, params);
|
|
734
|
+
// @__NO_SIDE_EFFECTS__
|
|
735
|
+
function _nonnegative(params) {
|
|
736
|
+
return /* @__PURE__ */ _gte(0, params);
|
|
3451
737
|
}
|
|
3452
|
-
|
|
3453
|
-
|
|
3454
|
-
|
|
3455
|
-
|
|
3456
|
-
|
|
3457
|
-
|
|
738
|
+
// @__NO_SIDE_EFFECTS__
|
|
739
|
+
function _regex(pattern, params) {
|
|
740
|
+
return new $ZodCheckRegex({
|
|
741
|
+
check: "string_format",
|
|
742
|
+
format: "regex",
|
|
743
|
+
...normalizeParams(params),
|
|
744
|
+
pattern
|
|
745
|
+
});
|
|
3458
746
|
}
|
|
3459
|
-
|
|
3460
|
-
|
|
3461
|
-
|
|
3462
|
-
|
|
3463
|
-
|
|
3464
|
-
|
|
3465
|
-
|
|
3466
|
-
value: (mapper) => formatError(inst, mapper)
|
|
3467
|
-
// enumerable: false,
|
|
3468
|
-
},
|
|
3469
|
-
flatten: {
|
|
3470
|
-
value: (mapper) => flattenError(inst, mapper)
|
|
3471
|
-
// enumerable: false,
|
|
3472
|
-
},
|
|
3473
|
-
addIssue: {
|
|
3474
|
-
value: (issue2) => {
|
|
3475
|
-
inst.issues.push(issue2);
|
|
3476
|
-
inst.message = JSON.stringify(inst.issues, jsonStringifyReplacer, 2);
|
|
3477
|
-
}
|
|
3478
|
-
// enumerable: false,
|
|
3479
|
-
},
|
|
3480
|
-
addIssues: {
|
|
3481
|
-
value: (issues2) => {
|
|
3482
|
-
inst.issues.push(...issues2);
|
|
3483
|
-
inst.message = JSON.stringify(inst.issues, jsonStringifyReplacer, 2);
|
|
3484
|
-
}
|
|
3485
|
-
// enumerable: false,
|
|
3486
|
-
},
|
|
3487
|
-
isEmpty: {
|
|
3488
|
-
get() {
|
|
3489
|
-
return inst.issues.length === 0;
|
|
3490
|
-
}
|
|
3491
|
-
// enumerable: false,
|
|
3492
|
-
}
|
|
747
|
+
// @__NO_SIDE_EFFECTS__
|
|
748
|
+
function _refine(Class, fn, _params) {
|
|
749
|
+
const schema = new Class({
|
|
750
|
+
type: "custom",
|
|
751
|
+
check: "custom",
|
|
752
|
+
fn,
|
|
753
|
+
...normalizeParams(_params)
|
|
3493
754
|
});
|
|
3494
|
-
|
|
3495
|
-
var ZodRealError = /* @__PURE__ */ $constructor("ZodError", initializer2, {
|
|
3496
|
-
Parent: Error
|
|
3497
|
-
});
|
|
3498
|
-
|
|
3499
|
-
// ../../../../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/parse.js
|
|
3500
|
-
var parse2 = /* @__PURE__ */ _parse(ZodRealError);
|
|
3501
|
-
var parseAsync2 = /* @__PURE__ */ _parseAsync(ZodRealError);
|
|
3502
|
-
var safeParse2 = /* @__PURE__ */ _safeParse(ZodRealError);
|
|
3503
|
-
var safeParseAsync2 = /* @__PURE__ */ _safeParseAsync(ZodRealError);
|
|
3504
|
-
var encode = /* @__PURE__ */ _encode(ZodRealError);
|
|
3505
|
-
var decode = /* @__PURE__ */ _decode(ZodRealError);
|
|
3506
|
-
var encodeAsync = /* @__PURE__ */ _encodeAsync(ZodRealError);
|
|
3507
|
-
var decodeAsync = /* @__PURE__ */ _decodeAsync(ZodRealError);
|
|
3508
|
-
var safeEncode = /* @__PURE__ */ _safeEncode(ZodRealError);
|
|
3509
|
-
var safeDecode = /* @__PURE__ */ _safeDecode(ZodRealError);
|
|
3510
|
-
var safeEncodeAsync = /* @__PURE__ */ _safeEncodeAsync(ZodRealError);
|
|
3511
|
-
var safeDecodeAsync = /* @__PURE__ */ _safeDecodeAsync(ZodRealError);
|
|
3512
|
-
|
|
3513
|
-
// ../../../../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/schemas.js
|
|
3514
|
-
var _installedGroups = /* @__PURE__ */ new WeakMap();
|
|
3515
|
-
function _installLazyMethods(inst, group, methods) {
|
|
3516
|
-
const proto = Object.getPrototypeOf(inst);
|
|
3517
|
-
let installed = _installedGroups.get(proto);
|
|
3518
|
-
if (!installed) {
|
|
3519
|
-
installed = /* @__PURE__ */ new Set();
|
|
3520
|
-
_installedGroups.set(proto, installed);
|
|
3521
|
-
}
|
|
3522
|
-
if (installed.has(group))
|
|
3523
|
-
return;
|
|
3524
|
-
installed.add(group);
|
|
3525
|
-
for (const key in methods) {
|
|
3526
|
-
const fn = methods[key];
|
|
3527
|
-
Object.defineProperty(proto, key, {
|
|
3528
|
-
configurable: true,
|
|
3529
|
-
enumerable: false,
|
|
3530
|
-
get() {
|
|
3531
|
-
const bound = fn.bind(this);
|
|
3532
|
-
Object.defineProperty(this, key, {
|
|
3533
|
-
configurable: true,
|
|
3534
|
-
writable: true,
|
|
3535
|
-
enumerable: true,
|
|
3536
|
-
value: bound
|
|
3537
|
-
});
|
|
3538
|
-
return bound;
|
|
3539
|
-
},
|
|
3540
|
-
set(v) {
|
|
3541
|
-
Object.defineProperty(this, key, {
|
|
3542
|
-
configurable: true,
|
|
3543
|
-
writable: true,
|
|
3544
|
-
enumerable: true,
|
|
3545
|
-
value: v
|
|
3546
|
-
});
|
|
3547
|
-
}
|
|
3548
|
-
});
|
|
3549
|
-
}
|
|
755
|
+
return schema;
|
|
3550
756
|
}
|
|
3551
|
-
|
|
757
|
+
|
|
758
|
+
// ../../../../../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/mini/schemas.js
|
|
759
|
+
var ZodMiniType = /* @__PURE__ */ $constructor("ZodMiniType", (inst, def) => {
|
|
760
|
+
if (!inst._zod)
|
|
761
|
+
throw new Error("Uninitialized schema in ZodMiniType.");
|
|
3552
762
|
$ZodType.init(inst, def);
|
|
3553
|
-
Object.assign(inst["~standard"], {
|
|
3554
|
-
jsonSchema: {
|
|
3555
|
-
input: createStandardJSONSchemaMethod(inst, "input"),
|
|
3556
|
-
output: createStandardJSONSchemaMethod(inst, "output")
|
|
3557
|
-
}
|
|
3558
|
-
});
|
|
3559
|
-
inst.toJSONSchema = createToJSONSchemaMethod(inst, {});
|
|
3560
763
|
inst.def = def;
|
|
3561
764
|
inst.type = def.type;
|
|
3562
|
-
|
|
3563
|
-
inst.
|
|
3564
|
-
inst.
|
|
3565
|
-
inst.
|
|
3566
|
-
inst.
|
|
3567
|
-
|
|
3568
|
-
|
|
3569
|
-
|
|
3570
|
-
|
|
3571
|
-
|
|
3572
|
-
|
|
3573
|
-
|
|
3574
|
-
|
|
3575
|
-
|
|
3576
|
-
|
|
3577
|
-
|
|
3578
|
-
|
|
3579
|
-
|
|
3580
|
-
|
|
3581
|
-
|
|
3582
|
-
|
|
3583
|
-
]
|
|
3584
|
-
}), { parent: true });
|
|
3585
|
-
},
|
|
3586
|
-
with(...chks) {
|
|
3587
|
-
return this.check(...chks);
|
|
3588
|
-
},
|
|
3589
|
-
clone(def2, params) {
|
|
3590
|
-
return clone(this, def2, params);
|
|
3591
|
-
},
|
|
3592
|
-
brand() {
|
|
3593
|
-
return this;
|
|
3594
|
-
},
|
|
3595
|
-
register(reg, meta2) {
|
|
3596
|
-
reg.add(this, meta2);
|
|
3597
|
-
return this;
|
|
3598
|
-
},
|
|
3599
|
-
refine(check, params) {
|
|
3600
|
-
return this.check(refine(check, params));
|
|
3601
|
-
},
|
|
3602
|
-
superRefine(refinement, params) {
|
|
3603
|
-
return this.check(superRefine(refinement, params));
|
|
3604
|
-
},
|
|
3605
|
-
overwrite(fn) {
|
|
3606
|
-
return this.check(_overwrite(fn));
|
|
3607
|
-
},
|
|
3608
|
-
optional() {
|
|
3609
|
-
return optional(this);
|
|
3610
|
-
},
|
|
3611
|
-
exactOptional() {
|
|
3612
|
-
return exactOptional(this);
|
|
3613
|
-
},
|
|
3614
|
-
nullable() {
|
|
3615
|
-
return nullable(this);
|
|
3616
|
-
},
|
|
3617
|
-
nullish() {
|
|
3618
|
-
return optional(nullable(this));
|
|
3619
|
-
},
|
|
3620
|
-
nonoptional(params) {
|
|
3621
|
-
return nonoptional(this, params);
|
|
3622
|
-
},
|
|
3623
|
-
array() {
|
|
3624
|
-
return array(this);
|
|
3625
|
-
},
|
|
3626
|
-
or(arg) {
|
|
3627
|
-
return union([this, arg]);
|
|
3628
|
-
},
|
|
3629
|
-
and(arg) {
|
|
3630
|
-
return intersection(this, arg);
|
|
3631
|
-
},
|
|
3632
|
-
transform(tx) {
|
|
3633
|
-
return pipe(this, transform(tx));
|
|
3634
|
-
},
|
|
3635
|
-
default(d) {
|
|
3636
|
-
return _default(this, d);
|
|
3637
|
-
},
|
|
3638
|
-
prefault(d) {
|
|
3639
|
-
return prefault(this, d);
|
|
3640
|
-
},
|
|
3641
|
-
catch(params) {
|
|
3642
|
-
return _catch(this, params);
|
|
3643
|
-
},
|
|
3644
|
-
pipe(target) {
|
|
3645
|
-
return pipe(this, target);
|
|
3646
|
-
},
|
|
3647
|
-
readonly() {
|
|
3648
|
-
return readonly(this);
|
|
3649
|
-
},
|
|
3650
|
-
describe(description) {
|
|
3651
|
-
const cl = this.clone();
|
|
3652
|
-
globalRegistry.add(cl, { description });
|
|
3653
|
-
return cl;
|
|
3654
|
-
},
|
|
3655
|
-
meta(...args) {
|
|
3656
|
-
if (args.length === 0)
|
|
3657
|
-
return globalRegistry.get(this);
|
|
3658
|
-
const cl = this.clone();
|
|
3659
|
-
globalRegistry.add(cl, args[0]);
|
|
3660
|
-
return cl;
|
|
3661
|
-
},
|
|
3662
|
-
isOptional() {
|
|
3663
|
-
return this.safeParse(void 0).success;
|
|
3664
|
-
},
|
|
3665
|
-
isNullable() {
|
|
3666
|
-
return this.safeParse(null).success;
|
|
3667
|
-
},
|
|
3668
|
-
apply(fn) {
|
|
3669
|
-
return fn(this);
|
|
3670
|
-
}
|
|
3671
|
-
});
|
|
3672
|
-
Object.defineProperty(inst, "description", {
|
|
3673
|
-
get() {
|
|
3674
|
-
return globalRegistry.get(inst)?.description;
|
|
3675
|
-
},
|
|
3676
|
-
configurable: true
|
|
3677
|
-
});
|
|
3678
|
-
return inst;
|
|
3679
|
-
});
|
|
3680
|
-
var _ZodString = /* @__PURE__ */ $constructor("_ZodString", (inst, def) => {
|
|
3681
|
-
$ZodString.init(inst, def);
|
|
3682
|
-
ZodType.init(inst, def);
|
|
3683
|
-
inst._zod.processJSONSchema = (ctx, json, params) => stringProcessor(inst, ctx, json, params);
|
|
3684
|
-
const bag = inst._zod.bag;
|
|
3685
|
-
inst.format = bag.format ?? null;
|
|
3686
|
-
inst.minLength = bag.minimum ?? null;
|
|
3687
|
-
inst.maxLength = bag.maximum ?? null;
|
|
3688
|
-
_installLazyMethods(inst, "_ZodString", {
|
|
3689
|
-
regex(...args) {
|
|
3690
|
-
return this.check(_regex(...args));
|
|
3691
|
-
},
|
|
3692
|
-
includes(...args) {
|
|
3693
|
-
return this.check(_includes(...args));
|
|
3694
|
-
},
|
|
3695
|
-
startsWith(...args) {
|
|
3696
|
-
return this.check(_startsWith(...args));
|
|
3697
|
-
},
|
|
3698
|
-
endsWith(...args) {
|
|
3699
|
-
return this.check(_endsWith(...args));
|
|
3700
|
-
},
|
|
3701
|
-
min(...args) {
|
|
3702
|
-
return this.check(_minLength(...args));
|
|
3703
|
-
},
|
|
3704
|
-
max(...args) {
|
|
3705
|
-
return this.check(_maxLength(...args));
|
|
3706
|
-
},
|
|
3707
|
-
length(...args) {
|
|
3708
|
-
return this.check(_length(...args));
|
|
3709
|
-
},
|
|
3710
|
-
nonempty(...args) {
|
|
3711
|
-
return this.check(_minLength(1, ...args));
|
|
3712
|
-
},
|
|
3713
|
-
lowercase(params) {
|
|
3714
|
-
return this.check(_lowercase(params));
|
|
3715
|
-
},
|
|
3716
|
-
uppercase(params) {
|
|
3717
|
-
return this.check(_uppercase(params));
|
|
3718
|
-
},
|
|
3719
|
-
trim() {
|
|
3720
|
-
return this.check(_trim());
|
|
3721
|
-
},
|
|
3722
|
-
normalize(...args) {
|
|
3723
|
-
return this.check(_normalize(...args));
|
|
3724
|
-
},
|
|
3725
|
-
toLowerCase() {
|
|
3726
|
-
return this.check(_toLowerCase());
|
|
3727
|
-
},
|
|
3728
|
-
toUpperCase() {
|
|
3729
|
-
return this.check(_toUpperCase());
|
|
3730
|
-
},
|
|
3731
|
-
slugify() {
|
|
3732
|
-
return this.check(_slugify());
|
|
3733
|
-
}
|
|
765
|
+
inst.parse = (data, params) => parse(inst, data, params, { callee: inst.parse });
|
|
766
|
+
inst.safeParse = (data, params) => safeParse(inst, data, params);
|
|
767
|
+
inst.parseAsync = async (data, params) => parseAsync(inst, data, params, { callee: inst.parseAsync });
|
|
768
|
+
inst.safeParseAsync = async (data, params) => safeParseAsync(inst, data, params);
|
|
769
|
+
inst.check = (...checks) => {
|
|
770
|
+
return inst.clone({
|
|
771
|
+
...def,
|
|
772
|
+
checks: [
|
|
773
|
+
...def.checks ?? [],
|
|
774
|
+
...checks.map((ch) => typeof ch === "function" ? {
|
|
775
|
+
_zod: { check: ch, def: { check: "custom" }, onattach: [] }
|
|
776
|
+
} : ch)
|
|
777
|
+
]
|
|
778
|
+
}, { parent: true });
|
|
779
|
+
};
|
|
780
|
+
inst.with = inst.check;
|
|
781
|
+
inst.clone = (_def, params) => clone(inst, _def, params);
|
|
782
|
+
inst.brand = () => inst;
|
|
783
|
+
inst.register = ((reg, meta2) => {
|
|
784
|
+
reg.add(inst, meta2);
|
|
785
|
+
return inst;
|
|
3734
786
|
});
|
|
787
|
+
inst.apply = (fn) => fn(inst);
|
|
3735
788
|
});
|
|
3736
|
-
var
|
|
789
|
+
var ZodMiniString = /* @__PURE__ */ $constructor("ZodMiniString", (inst, def) => {
|
|
3737
790
|
$ZodString.init(inst, def);
|
|
3738
|
-
|
|
3739
|
-
inst.email = (params) => inst.check(_email(ZodEmail, params));
|
|
3740
|
-
inst.url = (params) => inst.check(_url(ZodURL, params));
|
|
3741
|
-
inst.jwt = (params) => inst.check(_jwt(ZodJWT, params));
|
|
3742
|
-
inst.emoji = (params) => inst.check(_emoji2(ZodEmoji, params));
|
|
3743
|
-
inst.guid = (params) => inst.check(_guid(ZodGUID, params));
|
|
3744
|
-
inst.uuid = (params) => inst.check(_uuid(ZodUUID, params));
|
|
3745
|
-
inst.uuidv4 = (params) => inst.check(_uuidv4(ZodUUID, params));
|
|
3746
|
-
inst.uuidv6 = (params) => inst.check(_uuidv6(ZodUUID, params));
|
|
3747
|
-
inst.uuidv7 = (params) => inst.check(_uuidv7(ZodUUID, params));
|
|
3748
|
-
inst.nanoid = (params) => inst.check(_nanoid(ZodNanoID, params));
|
|
3749
|
-
inst.guid = (params) => inst.check(_guid(ZodGUID, params));
|
|
3750
|
-
inst.cuid = (params) => inst.check(_cuid(ZodCUID, params));
|
|
3751
|
-
inst.cuid2 = (params) => inst.check(_cuid2(ZodCUID2, params));
|
|
3752
|
-
inst.ulid = (params) => inst.check(_ulid(ZodULID, params));
|
|
3753
|
-
inst.base64 = (params) => inst.check(_base64(ZodBase64, params));
|
|
3754
|
-
inst.base64url = (params) => inst.check(_base64url(ZodBase64URL, params));
|
|
3755
|
-
inst.xid = (params) => inst.check(_xid(ZodXID, params));
|
|
3756
|
-
inst.ksuid = (params) => inst.check(_ksuid(ZodKSUID, params));
|
|
3757
|
-
inst.ipv4 = (params) => inst.check(_ipv4(ZodIPv4, params));
|
|
3758
|
-
inst.ipv6 = (params) => inst.check(_ipv6(ZodIPv6, params));
|
|
3759
|
-
inst.cidrv4 = (params) => inst.check(_cidrv4(ZodCIDRv4, params));
|
|
3760
|
-
inst.cidrv6 = (params) => inst.check(_cidrv6(ZodCIDRv6, params));
|
|
3761
|
-
inst.e164 = (params) => inst.check(_e164(ZodE164, params));
|
|
3762
|
-
inst.datetime = (params) => inst.check(datetime2(params));
|
|
3763
|
-
inst.date = (params) => inst.check(date2(params));
|
|
3764
|
-
inst.time = (params) => inst.check(time2(params));
|
|
3765
|
-
inst.duration = (params) => inst.check(duration2(params));
|
|
791
|
+
ZodMiniType.init(inst, def);
|
|
3766
792
|
});
|
|
793
|
+
// @__NO_SIDE_EFFECTS__
|
|
3767
794
|
function string2(params) {
|
|
3768
|
-
return _string(
|
|
795
|
+
return _string(ZodMiniString, params);
|
|
3769
796
|
}
|
|
3770
|
-
var
|
|
3771
|
-
$ZodStringFormat.init(inst, def);
|
|
3772
|
-
_ZodString.init(inst, def);
|
|
3773
|
-
});
|
|
3774
|
-
var ZodEmail = /* @__PURE__ */ $constructor("ZodEmail", (inst, def) => {
|
|
3775
|
-
$ZodEmail.init(inst, def);
|
|
3776
|
-
ZodStringFormat.init(inst, def);
|
|
3777
|
-
});
|
|
3778
|
-
var ZodGUID = /* @__PURE__ */ $constructor("ZodGUID", (inst, def) => {
|
|
3779
|
-
$ZodGUID.init(inst, def);
|
|
3780
|
-
ZodStringFormat.init(inst, def);
|
|
3781
|
-
});
|
|
3782
|
-
var ZodUUID = /* @__PURE__ */ $constructor("ZodUUID", (inst, def) => {
|
|
3783
|
-
$ZodUUID.init(inst, def);
|
|
3784
|
-
ZodStringFormat.init(inst, def);
|
|
3785
|
-
});
|
|
3786
|
-
var ZodURL = /* @__PURE__ */ $constructor("ZodURL", (inst, def) => {
|
|
3787
|
-
$ZodURL.init(inst, def);
|
|
3788
|
-
ZodStringFormat.init(inst, def);
|
|
3789
|
-
});
|
|
3790
|
-
var ZodEmoji = /* @__PURE__ */ $constructor("ZodEmoji", (inst, def) => {
|
|
3791
|
-
$ZodEmoji.init(inst, def);
|
|
3792
|
-
ZodStringFormat.init(inst, def);
|
|
3793
|
-
});
|
|
3794
|
-
var ZodNanoID = /* @__PURE__ */ $constructor("ZodNanoID", (inst, def) => {
|
|
3795
|
-
$ZodNanoID.init(inst, def);
|
|
3796
|
-
ZodStringFormat.init(inst, def);
|
|
3797
|
-
});
|
|
3798
|
-
var ZodCUID = /* @__PURE__ */ $constructor("ZodCUID", (inst, def) => {
|
|
3799
|
-
$ZodCUID.init(inst, def);
|
|
3800
|
-
ZodStringFormat.init(inst, def);
|
|
3801
|
-
});
|
|
3802
|
-
var ZodCUID2 = /* @__PURE__ */ $constructor("ZodCUID2", (inst, def) => {
|
|
3803
|
-
$ZodCUID2.init(inst, def);
|
|
3804
|
-
ZodStringFormat.init(inst, def);
|
|
3805
|
-
});
|
|
3806
|
-
var ZodULID = /* @__PURE__ */ $constructor("ZodULID", (inst, def) => {
|
|
3807
|
-
$ZodULID.init(inst, def);
|
|
3808
|
-
ZodStringFormat.init(inst, def);
|
|
3809
|
-
});
|
|
3810
|
-
var ZodXID = /* @__PURE__ */ $constructor("ZodXID", (inst, def) => {
|
|
3811
|
-
$ZodXID.init(inst, def);
|
|
3812
|
-
ZodStringFormat.init(inst, def);
|
|
3813
|
-
});
|
|
3814
|
-
var ZodKSUID = /* @__PURE__ */ $constructor("ZodKSUID", (inst, def) => {
|
|
3815
|
-
$ZodKSUID.init(inst, def);
|
|
3816
|
-
ZodStringFormat.init(inst, def);
|
|
3817
|
-
});
|
|
3818
|
-
var ZodIPv4 = /* @__PURE__ */ $constructor("ZodIPv4", (inst, def) => {
|
|
3819
|
-
$ZodIPv4.init(inst, def);
|
|
3820
|
-
ZodStringFormat.init(inst, def);
|
|
3821
|
-
});
|
|
3822
|
-
var ZodIPv6 = /* @__PURE__ */ $constructor("ZodIPv6", (inst, def) => {
|
|
3823
|
-
$ZodIPv6.init(inst, def);
|
|
3824
|
-
ZodStringFormat.init(inst, def);
|
|
3825
|
-
});
|
|
3826
|
-
var ZodCIDRv4 = /* @__PURE__ */ $constructor("ZodCIDRv4", (inst, def) => {
|
|
3827
|
-
$ZodCIDRv4.init(inst, def);
|
|
3828
|
-
ZodStringFormat.init(inst, def);
|
|
3829
|
-
});
|
|
3830
|
-
var ZodCIDRv6 = /* @__PURE__ */ $constructor("ZodCIDRv6", (inst, def) => {
|
|
3831
|
-
$ZodCIDRv6.init(inst, def);
|
|
3832
|
-
ZodStringFormat.init(inst, def);
|
|
3833
|
-
});
|
|
3834
|
-
var ZodBase64 = /* @__PURE__ */ $constructor("ZodBase64", (inst, def) => {
|
|
3835
|
-
$ZodBase64.init(inst, def);
|
|
3836
|
-
ZodStringFormat.init(inst, def);
|
|
3837
|
-
});
|
|
3838
|
-
var ZodBase64URL = /* @__PURE__ */ $constructor("ZodBase64URL", (inst, def) => {
|
|
3839
|
-
$ZodBase64URL.init(inst, def);
|
|
3840
|
-
ZodStringFormat.init(inst, def);
|
|
3841
|
-
});
|
|
3842
|
-
var ZodE164 = /* @__PURE__ */ $constructor("ZodE164", (inst, def) => {
|
|
3843
|
-
$ZodE164.init(inst, def);
|
|
3844
|
-
ZodStringFormat.init(inst, def);
|
|
3845
|
-
});
|
|
3846
|
-
var ZodJWT = /* @__PURE__ */ $constructor("ZodJWT", (inst, def) => {
|
|
3847
|
-
$ZodJWT.init(inst, def);
|
|
3848
|
-
ZodStringFormat.init(inst, def);
|
|
3849
|
-
});
|
|
3850
|
-
var ZodNumber = /* @__PURE__ */ $constructor("ZodNumber", (inst, def) => {
|
|
797
|
+
var ZodMiniNumber = /* @__PURE__ */ $constructor("ZodMiniNumber", (inst, def) => {
|
|
3851
798
|
$ZodNumber.init(inst, def);
|
|
3852
|
-
|
|
3853
|
-
inst._zod.processJSONSchema = (ctx, json, params) => numberProcessor(inst, ctx, json, params);
|
|
3854
|
-
_installLazyMethods(inst, "ZodNumber", {
|
|
3855
|
-
gt(value, params) {
|
|
3856
|
-
return this.check(_gt(value, params));
|
|
3857
|
-
},
|
|
3858
|
-
gte(value, params) {
|
|
3859
|
-
return this.check(_gte(value, params));
|
|
3860
|
-
},
|
|
3861
|
-
min(value, params) {
|
|
3862
|
-
return this.check(_gte(value, params));
|
|
3863
|
-
},
|
|
3864
|
-
lt(value, params) {
|
|
3865
|
-
return this.check(_lt(value, params));
|
|
3866
|
-
},
|
|
3867
|
-
lte(value, params) {
|
|
3868
|
-
return this.check(_lte(value, params));
|
|
3869
|
-
},
|
|
3870
|
-
max(value, params) {
|
|
3871
|
-
return this.check(_lte(value, params));
|
|
3872
|
-
},
|
|
3873
|
-
int(params) {
|
|
3874
|
-
return this.check(int(params));
|
|
3875
|
-
},
|
|
3876
|
-
safe(params) {
|
|
3877
|
-
return this.check(int(params));
|
|
3878
|
-
},
|
|
3879
|
-
positive(params) {
|
|
3880
|
-
return this.check(_gt(0, params));
|
|
3881
|
-
},
|
|
3882
|
-
nonnegative(params) {
|
|
3883
|
-
return this.check(_gte(0, params));
|
|
3884
|
-
},
|
|
3885
|
-
negative(params) {
|
|
3886
|
-
return this.check(_lt(0, params));
|
|
3887
|
-
},
|
|
3888
|
-
nonpositive(params) {
|
|
3889
|
-
return this.check(_lte(0, params));
|
|
3890
|
-
},
|
|
3891
|
-
multipleOf(value, params) {
|
|
3892
|
-
return this.check(_multipleOf(value, params));
|
|
3893
|
-
},
|
|
3894
|
-
step(value, params) {
|
|
3895
|
-
return this.check(_multipleOf(value, params));
|
|
3896
|
-
},
|
|
3897
|
-
finite() {
|
|
3898
|
-
return this;
|
|
3899
|
-
}
|
|
3900
|
-
});
|
|
3901
|
-
const bag = inst._zod.bag;
|
|
3902
|
-
inst.minValue = Math.max(bag.minimum ?? Number.NEGATIVE_INFINITY, bag.exclusiveMinimum ?? Number.NEGATIVE_INFINITY) ?? null;
|
|
3903
|
-
inst.maxValue = Math.min(bag.maximum ?? Number.POSITIVE_INFINITY, bag.exclusiveMaximum ?? Number.POSITIVE_INFINITY) ?? null;
|
|
3904
|
-
inst.isInt = (bag.format ?? "").includes("int") || Number.isSafeInteger(bag.multipleOf ?? 0.5);
|
|
3905
|
-
inst.isFinite = true;
|
|
3906
|
-
inst.format = bag.format ?? null;
|
|
799
|
+
ZodMiniType.init(inst, def);
|
|
3907
800
|
});
|
|
801
|
+
// @__NO_SIDE_EFFECTS__
|
|
3908
802
|
function number2(params) {
|
|
3909
|
-
return _number(
|
|
803
|
+
return _number(ZodMiniNumber, params);
|
|
3910
804
|
}
|
|
3911
|
-
var
|
|
3912
|
-
$ZodNumberFormat.init(inst, def);
|
|
3913
|
-
ZodNumber.init(inst, def);
|
|
3914
|
-
});
|
|
3915
|
-
function int(params) {
|
|
3916
|
-
return _int(ZodNumberFormat, params);
|
|
3917
|
-
}
|
|
3918
|
-
var ZodBigInt = /* @__PURE__ */ $constructor("ZodBigInt", (inst, def) => {
|
|
805
|
+
var ZodMiniBigInt = /* @__PURE__ */ $constructor("ZodMiniBigInt", (inst, def) => {
|
|
3919
806
|
$ZodBigInt.init(inst, def);
|
|
3920
|
-
|
|
3921
|
-
inst._zod.processJSONSchema = (ctx, json, params) => bigintProcessor(inst, ctx, json, params);
|
|
3922
|
-
inst.gte = (value, params) => inst.check(_gte(value, params));
|
|
3923
|
-
inst.min = (value, params) => inst.check(_gte(value, params));
|
|
3924
|
-
inst.gt = (value, params) => inst.check(_gt(value, params));
|
|
3925
|
-
inst.gte = (value, params) => inst.check(_gte(value, params));
|
|
3926
|
-
inst.min = (value, params) => inst.check(_gte(value, params));
|
|
3927
|
-
inst.lt = (value, params) => inst.check(_lt(value, params));
|
|
3928
|
-
inst.lte = (value, params) => inst.check(_lte(value, params));
|
|
3929
|
-
inst.max = (value, params) => inst.check(_lte(value, params));
|
|
3930
|
-
inst.positive = (params) => inst.check(_gt(BigInt(0), params));
|
|
3931
|
-
inst.negative = (params) => inst.check(_lt(BigInt(0), params));
|
|
3932
|
-
inst.nonpositive = (params) => inst.check(_lte(BigInt(0), params));
|
|
3933
|
-
inst.nonnegative = (params) => inst.check(_gte(BigInt(0), params));
|
|
3934
|
-
inst.multipleOf = (value, params) => inst.check(_multipleOf(value, params));
|
|
3935
|
-
const bag = inst._zod.bag;
|
|
3936
|
-
inst.minValue = bag.minimum ?? null;
|
|
3937
|
-
inst.maxValue = bag.maximum ?? null;
|
|
3938
|
-
inst.format = bag.format ?? null;
|
|
807
|
+
ZodMiniType.init(inst, def);
|
|
3939
808
|
});
|
|
809
|
+
// @__NO_SIDE_EFFECTS__
|
|
3940
810
|
function bigint2(params) {
|
|
3941
|
-
return _bigint(
|
|
3942
|
-
}
|
|
3943
|
-
var ZodArray = /* @__PURE__ */ $constructor("ZodArray", (inst, def) => {
|
|
3944
|
-
$ZodArray.init(inst, def);
|
|
3945
|
-
ZodType.init(inst, def);
|
|
3946
|
-
inst._zod.processJSONSchema = (ctx, json, params) => arrayProcessor(inst, ctx, json, params);
|
|
3947
|
-
inst.element = def.element;
|
|
3948
|
-
_installLazyMethods(inst, "ZodArray", {
|
|
3949
|
-
min(n, params) {
|
|
3950
|
-
return this.check(_minLength(n, params));
|
|
3951
|
-
},
|
|
3952
|
-
nonempty(params) {
|
|
3953
|
-
return this.check(_minLength(1, params));
|
|
3954
|
-
},
|
|
3955
|
-
max(n, params) {
|
|
3956
|
-
return this.check(_maxLength(n, params));
|
|
3957
|
-
},
|
|
3958
|
-
length(n, params) {
|
|
3959
|
-
return this.check(_length(n, params));
|
|
3960
|
-
},
|
|
3961
|
-
unwrap() {
|
|
3962
|
-
return this.element;
|
|
3963
|
-
}
|
|
3964
|
-
});
|
|
3965
|
-
});
|
|
3966
|
-
function array(element, params) {
|
|
3967
|
-
return _array(ZodArray, element, params);
|
|
811
|
+
return _bigint(ZodMiniBigInt, params);
|
|
3968
812
|
}
|
|
3969
|
-
var
|
|
813
|
+
var ZodMiniUnion = /* @__PURE__ */ $constructor("ZodMiniUnion", (inst, def) => {
|
|
3970
814
|
$ZodUnion.init(inst, def);
|
|
3971
|
-
|
|
3972
|
-
inst._zod.processJSONSchema = (ctx, json, params) => unionProcessor(inst, ctx, json, params);
|
|
3973
|
-
inst.options = def.options;
|
|
815
|
+
ZodMiniType.init(inst, def);
|
|
3974
816
|
});
|
|
817
|
+
// @__NO_SIDE_EFFECTS__
|
|
3975
818
|
function union(options, params) {
|
|
3976
|
-
return new
|
|
819
|
+
return new ZodMiniUnion({
|
|
3977
820
|
type: "union",
|
|
3978
821
|
options,
|
|
3979
|
-
...
|
|
3980
|
-
});
|
|
3981
|
-
}
|
|
3982
|
-
var ZodIntersection = /* @__PURE__ */ $constructor("ZodIntersection", (inst, def) => {
|
|
3983
|
-
$ZodIntersection.init(inst, def);
|
|
3984
|
-
ZodType.init(inst, def);
|
|
3985
|
-
inst._zod.processJSONSchema = (ctx, json, params) => intersectionProcessor(inst, ctx, json, params);
|
|
3986
|
-
});
|
|
3987
|
-
function intersection(left, right) {
|
|
3988
|
-
return new ZodIntersection({
|
|
3989
|
-
type: "intersection",
|
|
3990
|
-
left,
|
|
3991
|
-
right
|
|
822
|
+
...normalizeParams(params)
|
|
3992
823
|
});
|
|
3993
824
|
}
|
|
3994
|
-
var
|
|
825
|
+
var ZodMiniTransform = /* @__PURE__ */ $constructor("ZodMiniTransform", (inst, def) => {
|
|
3995
826
|
$ZodTransform.init(inst, def);
|
|
3996
|
-
|
|
3997
|
-
inst._zod.processJSONSchema = (ctx, json, params) => transformProcessor(inst, ctx, json, params);
|
|
3998
|
-
inst._zod.parse = (payload, _ctx) => {
|
|
3999
|
-
if (_ctx.direction === "backward") {
|
|
4000
|
-
throw new $ZodEncodeError(inst.constructor.name);
|
|
4001
|
-
}
|
|
4002
|
-
payload.addIssue = (issue2) => {
|
|
4003
|
-
if (typeof issue2 === "string") {
|
|
4004
|
-
payload.issues.push(util_exports.issue(issue2, payload.value, def));
|
|
4005
|
-
} else {
|
|
4006
|
-
const _issue = issue2;
|
|
4007
|
-
if (_issue.fatal)
|
|
4008
|
-
_issue.continue = false;
|
|
4009
|
-
_issue.code ?? (_issue.code = "custom");
|
|
4010
|
-
_issue.input ?? (_issue.input = payload.value);
|
|
4011
|
-
_issue.inst ?? (_issue.inst = inst);
|
|
4012
|
-
payload.issues.push(util_exports.issue(_issue));
|
|
4013
|
-
}
|
|
4014
|
-
};
|
|
4015
|
-
const output = def.transform(payload.value, payload);
|
|
4016
|
-
if (output instanceof Promise) {
|
|
4017
|
-
return output.then((output2) => {
|
|
4018
|
-
payload.value = output2;
|
|
4019
|
-
payload.fallback = true;
|
|
4020
|
-
return payload;
|
|
4021
|
-
});
|
|
4022
|
-
}
|
|
4023
|
-
payload.value = output;
|
|
4024
|
-
payload.fallback = true;
|
|
4025
|
-
return payload;
|
|
4026
|
-
};
|
|
827
|
+
ZodMiniType.init(inst, def);
|
|
4027
828
|
});
|
|
829
|
+
// @__NO_SIDE_EFFECTS__
|
|
4028
830
|
function transform(fn) {
|
|
4029
|
-
return new
|
|
831
|
+
return new ZodMiniTransform({
|
|
4030
832
|
type: "transform",
|
|
4031
833
|
transform: fn
|
|
4032
834
|
});
|
|
4033
835
|
}
|
|
4034
|
-
var
|
|
4035
|
-
$ZodOptional.init(inst, def);
|
|
4036
|
-
ZodType.init(inst, def);
|
|
4037
|
-
inst._zod.processJSONSchema = (ctx, json, params) => optionalProcessor(inst, ctx, json, params);
|
|
4038
|
-
inst.unwrap = () => inst._zod.def.innerType;
|
|
4039
|
-
});
|
|
4040
|
-
function optional(innerType) {
|
|
4041
|
-
return new ZodOptional({
|
|
4042
|
-
type: "optional",
|
|
4043
|
-
innerType
|
|
4044
|
-
});
|
|
4045
|
-
}
|
|
4046
|
-
var ZodExactOptional = /* @__PURE__ */ $constructor("ZodExactOptional", (inst, def) => {
|
|
4047
|
-
$ZodExactOptional.init(inst, def);
|
|
4048
|
-
ZodType.init(inst, def);
|
|
4049
|
-
inst._zod.processJSONSchema = (ctx, json, params) => optionalProcessor(inst, ctx, json, params);
|
|
4050
|
-
inst.unwrap = () => inst._zod.def.innerType;
|
|
4051
|
-
});
|
|
4052
|
-
function exactOptional(innerType) {
|
|
4053
|
-
return new ZodExactOptional({
|
|
4054
|
-
type: "optional",
|
|
4055
|
-
innerType
|
|
4056
|
-
});
|
|
4057
|
-
}
|
|
4058
|
-
var ZodNullable = /* @__PURE__ */ $constructor("ZodNullable", (inst, def) => {
|
|
4059
|
-
$ZodNullable.init(inst, def);
|
|
4060
|
-
ZodType.init(inst, def);
|
|
4061
|
-
inst._zod.processJSONSchema = (ctx, json, params) => nullableProcessor(inst, ctx, json, params);
|
|
4062
|
-
inst.unwrap = () => inst._zod.def.innerType;
|
|
4063
|
-
});
|
|
4064
|
-
function nullable(innerType) {
|
|
4065
|
-
return new ZodNullable({
|
|
4066
|
-
type: "nullable",
|
|
4067
|
-
innerType
|
|
4068
|
-
});
|
|
4069
|
-
}
|
|
4070
|
-
var ZodDefault = /* @__PURE__ */ $constructor("ZodDefault", (inst, def) => {
|
|
4071
|
-
$ZodDefault.init(inst, def);
|
|
4072
|
-
ZodType.init(inst, def);
|
|
4073
|
-
inst._zod.processJSONSchema = (ctx, json, params) => defaultProcessor(inst, ctx, json, params);
|
|
4074
|
-
inst.unwrap = () => inst._zod.def.innerType;
|
|
4075
|
-
inst.removeDefault = inst.unwrap;
|
|
4076
|
-
});
|
|
4077
|
-
function _default(innerType, defaultValue) {
|
|
4078
|
-
return new ZodDefault({
|
|
4079
|
-
type: "default",
|
|
4080
|
-
innerType,
|
|
4081
|
-
get defaultValue() {
|
|
4082
|
-
return typeof defaultValue === "function" ? defaultValue() : util_exports.shallowClone(defaultValue);
|
|
4083
|
-
}
|
|
4084
|
-
});
|
|
4085
|
-
}
|
|
4086
|
-
var ZodPrefault = /* @__PURE__ */ $constructor("ZodPrefault", (inst, def) => {
|
|
4087
|
-
$ZodPrefault.init(inst, def);
|
|
4088
|
-
ZodType.init(inst, def);
|
|
4089
|
-
inst._zod.processJSONSchema = (ctx, json, params) => prefaultProcessor(inst, ctx, json, params);
|
|
4090
|
-
inst.unwrap = () => inst._zod.def.innerType;
|
|
4091
|
-
});
|
|
4092
|
-
function prefault(innerType, defaultValue) {
|
|
4093
|
-
return new ZodPrefault({
|
|
4094
|
-
type: "prefault",
|
|
4095
|
-
innerType,
|
|
4096
|
-
get defaultValue() {
|
|
4097
|
-
return typeof defaultValue === "function" ? defaultValue() : util_exports.shallowClone(defaultValue);
|
|
4098
|
-
}
|
|
4099
|
-
});
|
|
4100
|
-
}
|
|
4101
|
-
var ZodNonOptional = /* @__PURE__ */ $constructor("ZodNonOptional", (inst, def) => {
|
|
4102
|
-
$ZodNonOptional.init(inst, def);
|
|
4103
|
-
ZodType.init(inst, def);
|
|
4104
|
-
inst._zod.processJSONSchema = (ctx, json, params) => nonoptionalProcessor(inst, ctx, json, params);
|
|
4105
|
-
inst.unwrap = () => inst._zod.def.innerType;
|
|
4106
|
-
});
|
|
4107
|
-
function nonoptional(innerType, params) {
|
|
4108
|
-
return new ZodNonOptional({
|
|
4109
|
-
type: "nonoptional",
|
|
4110
|
-
innerType,
|
|
4111
|
-
...util_exports.normalizeParams(params)
|
|
4112
|
-
});
|
|
4113
|
-
}
|
|
4114
|
-
var ZodCatch = /* @__PURE__ */ $constructor("ZodCatch", (inst, def) => {
|
|
4115
|
-
$ZodCatch.init(inst, def);
|
|
4116
|
-
ZodType.init(inst, def);
|
|
4117
|
-
inst._zod.processJSONSchema = (ctx, json, params) => catchProcessor(inst, ctx, json, params);
|
|
4118
|
-
inst.unwrap = () => inst._zod.def.innerType;
|
|
4119
|
-
inst.removeCatch = inst.unwrap;
|
|
4120
|
-
});
|
|
4121
|
-
function _catch(innerType, catchValue) {
|
|
4122
|
-
return new ZodCatch({
|
|
4123
|
-
type: "catch",
|
|
4124
|
-
innerType,
|
|
4125
|
-
catchValue: typeof catchValue === "function" ? catchValue : () => catchValue
|
|
4126
|
-
});
|
|
4127
|
-
}
|
|
4128
|
-
var ZodPipe = /* @__PURE__ */ $constructor("ZodPipe", (inst, def) => {
|
|
836
|
+
var ZodMiniPipe = /* @__PURE__ */ $constructor("ZodMiniPipe", (inst, def) => {
|
|
4129
837
|
$ZodPipe.init(inst, def);
|
|
4130
|
-
|
|
4131
|
-
inst._zod.processJSONSchema = (ctx, json, params) => pipeProcessor(inst, ctx, json, params);
|
|
4132
|
-
inst.in = def.in;
|
|
4133
|
-
inst.out = def.out;
|
|
838
|
+
ZodMiniType.init(inst, def);
|
|
4134
839
|
});
|
|
840
|
+
// @__NO_SIDE_EFFECTS__
|
|
4135
841
|
function pipe(in_, out) {
|
|
4136
|
-
return new
|
|
842
|
+
return new ZodMiniPipe({
|
|
4137
843
|
type: "pipe",
|
|
4138
844
|
in: in_,
|
|
4139
845
|
out
|
|
4140
|
-
// ...util.normalizeParams(params),
|
|
4141
846
|
});
|
|
4142
847
|
}
|
|
4143
|
-
var
|
|
4144
|
-
$ZodReadonly.init(inst, def);
|
|
4145
|
-
ZodType.init(inst, def);
|
|
4146
|
-
inst._zod.processJSONSchema = (ctx, json, params) => readonlyProcessor(inst, ctx, json, params);
|
|
4147
|
-
inst.unwrap = () => inst._zod.def.innerType;
|
|
4148
|
-
});
|
|
4149
|
-
function readonly(innerType) {
|
|
4150
|
-
return new ZodReadonly({
|
|
4151
|
-
type: "readonly",
|
|
4152
|
-
innerType
|
|
4153
|
-
});
|
|
4154
|
-
}
|
|
4155
|
-
var ZodCustom = /* @__PURE__ */ $constructor("ZodCustom", (inst, def) => {
|
|
848
|
+
var ZodMiniCustom = /* @__PURE__ */ $constructor("ZodMiniCustom", (inst, def) => {
|
|
4156
849
|
$ZodCustom.init(inst, def);
|
|
4157
|
-
|
|
4158
|
-
inst._zod.processJSONSchema = (ctx, json, params) => customProcessor(inst, ctx, json, params);
|
|
850
|
+
ZodMiniType.init(inst, def);
|
|
4159
851
|
});
|
|
852
|
+
// @__NO_SIDE_EFFECTS__
|
|
4160
853
|
function refine(fn, _params = {}) {
|
|
4161
|
-
return _refine(
|
|
4162
|
-
}
|
|
4163
|
-
function superRefine(fn, params) {
|
|
4164
|
-
return _superRefine(fn, params);
|
|
854
|
+
return _refine(ZodMiniCustom, fn, _params);
|
|
4165
855
|
}
|
|
4166
856
|
|
|
4167
|
-
// ../../../../../../node_modules/.pnpm/@xylabs+error@
|
|
4168
|
-
var assertError = (value,
|
|
4169
|
-
if (!isUndefined(
|
|
4170
|
-
const assertString = typeof
|
|
857
|
+
// ../../../../../../node_modules/.pnpm/@xylabs+error@6.0.0/node_modules/@xylabs/error/dist/neutral/index.mjs
|
|
858
|
+
var assertError = (value, assert, defaultMessage) => {
|
|
859
|
+
if (!isUndefined(assert)) {
|
|
860
|
+
const assertString = typeof assert === "string" ? assert : typeof assert === "boolean" ? defaultMessage : assert(value, defaultMessage);
|
|
4171
861
|
if (isString(assertString) || assertString === true) {
|
|
4172
862
|
throw new Error(assertString === true ? defaultMessage : assertString);
|
|
4173
863
|
}
|
|
@@ -4175,7 +865,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
4175
865
|
return void 0;
|
|
4176
866
|
};
|
|
4177
867
|
|
|
4178
|
-
// ../../../../../../node_modules/.pnpm/@xylabs+hex@
|
|
868
|
+
// ../../../../../../node_modules/.pnpm/@xylabs+hex@6.0.0_zod@4.4.3/node_modules/@xylabs/hex/dist/neutral/index.mjs
|
|
4179
869
|
var HexRegExMinMax = (minBytes = 0, maxBytes = Number.MAX_SAFE_INTEGER / 2) => {
|
|
4180
870
|
return new RegExp(`^[a-f0-9]{${minBytes * 2},${maxBytes * 2}}$`);
|
|
4181
871
|
};
|
|
@@ -4186,7 +876,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
4186
876
|
var HexRegExWithPrefix = /^0x[0-9a-f]+$/;
|
|
4187
877
|
var ADDRESS_LENGTH = 40;
|
|
4188
878
|
var AddressRegEx = HexRegExMinMax(ADDRESS_LENGTH / 2, ADDRESS_LENGTH / 2);
|
|
4189
|
-
var AddressZod =
|
|
879
|
+
var AddressZod = pipe(
|
|
880
|
+
string2().check(_regex(AddressRegEx)),
|
|
881
|
+
transform((v) => v)
|
|
882
|
+
);
|
|
4190
883
|
var bitsToNibbles = (value) => {
|
|
4191
884
|
const nibbles = value >> 2;
|
|
4192
885
|
if (value !== nibbles << 2) throw new Error("Bits for nibbles must multiple of 4");
|
|
@@ -4244,31 +937,42 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
4244
937
|
}
|
|
4245
938
|
}
|
|
4246
939
|
};
|
|
4247
|
-
var HexZod =
|
|
940
|
+
var HexZod = pipe(
|
|
941
|
+
string2().check(_regex(HexRegEx, { error: "Invalid hex format" })),
|
|
942
|
+
transform((val) => val)
|
|
943
|
+
);
|
|
4248
944
|
var toHex = (value, config2 = {}) => {
|
|
4249
945
|
const { prefix = false } = config2;
|
|
4250
946
|
return hexFrom(value, { prefix, ...config2 });
|
|
4251
947
|
};
|
|
4252
|
-
var AddressValidationZod =
|
|
4253
|
-
|
|
4254
|
-
|
|
4255
|
-
|
|
4256
|
-
|
|
4257
|
-
|
|
4258
|
-
|
|
4259
|
-
|
|
4260
|
-
|
|
948
|
+
var AddressValidationZod = pipe(
|
|
949
|
+
string2().check(
|
|
950
|
+
refine((x) => HexZod.safeParse(x).success),
|
|
951
|
+
refine((x) => x.length === ADDRESS_LENGTH, { error: (e) => new Error(`Address must have 40 characters [${e.input}]`) })
|
|
952
|
+
),
|
|
953
|
+
transform((v) => v)
|
|
954
|
+
);
|
|
955
|
+
var AddressTransformZod = pipe(
|
|
956
|
+
pipe(
|
|
957
|
+
union([string2(), bigint2(), number2()]),
|
|
958
|
+
transform((value) => {
|
|
959
|
+
if (typeof value === "bigint") {
|
|
960
|
+
return value.toString(16).padStart(ADDRESS_LENGTH, "0");
|
|
961
|
+
}
|
|
962
|
+
if (typeof value === "string") {
|
|
963
|
+
return value.startsWith("0x") ? value.slice(2) : value;
|
|
4261
964
|
}
|
|
4262
|
-
return value;
|
|
4263
|
-
}
|
|
4264
|
-
case "number": {
|
|
4265
965
|
return BigInt(value).toString(16).padStart(ADDRESS_LENGTH, "0");
|
|
4266
|
-
}
|
|
4267
|
-
|
|
4268
|
-
|
|
966
|
+
})
|
|
967
|
+
).check(refine((x) => AddressValidationZod.safeParse(x).success)),
|
|
968
|
+
transform((x) => x)
|
|
969
|
+
);
|
|
4269
970
|
var EthAddressRegEx = HexRegExMinMaxMixedCaseWithPrefix(20, 20);
|
|
4270
|
-
var EthAddressToStringZod = string2().
|
|
4271
|
-
var EthAddressFromStringZod =
|
|
971
|
+
var EthAddressToStringZod = string2().check(_regex(EthAddressRegEx));
|
|
972
|
+
var EthAddressFromStringZod = pipe(
|
|
973
|
+
string2().check(_regex(EthAddressRegEx)),
|
|
974
|
+
transform((v) => toEthAddress(v))
|
|
975
|
+
);
|
|
4272
976
|
var toEthAddress = (value, config2 = {}) => {
|
|
4273
977
|
const { bitLength = 160, prefix = false } = config2;
|
|
4274
978
|
return `0x${hexFrom(value, {
|
|
@@ -4282,13 +986,14 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
4282
986
|
const loweredValue = typeof value === "string" ? value.toLowerCase() : value;
|
|
4283
987
|
return isHex(loweredValue, { bitLength, prefix });
|
|
4284
988
|
};
|
|
4285
|
-
var EthAddressZod = string2().
|
|
4286
|
-
|
|
989
|
+
var EthAddressZod = string2().check(
|
|
990
|
+
_regex(EthAddressRegEx, { error: "Invalid address format" }),
|
|
991
|
+
refine(isEthAddress)
|
|
4287
992
|
);
|
|
4288
993
|
var isHash = (value, bitLength = 256) => {
|
|
4289
994
|
return isHex(value, { bitLength });
|
|
4290
995
|
};
|
|
4291
|
-
function asHash(value,
|
|
996
|
+
function asHash(value, assert) {
|
|
4292
997
|
let stringValue = void 0;
|
|
4293
998
|
switch (typeof value) {
|
|
4294
999
|
case "string": {
|
|
@@ -4296,23 +1001,32 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
4296
1001
|
break;
|
|
4297
1002
|
}
|
|
4298
1003
|
default: {
|
|
4299
|
-
return isUndefined(
|
|
1004
|
+
return isUndefined(assert) ? void 0 : assertError(value, assert, `Unsupported type [${typeof value}]`);
|
|
4300
1005
|
}
|
|
4301
1006
|
}
|
|
4302
|
-
return isHash(stringValue) ? stringValue : assertError(value,
|
|
1007
|
+
return isHash(stringValue) ? stringValue : assertError(value, assert, `Value is not a Hash [${value}]`);
|
|
4303
1008
|
}
|
|
4304
1009
|
var HASH_LENGTH = 32;
|
|
4305
1010
|
var HashRegEx = HexRegExMinMax(HASH_LENGTH, HASH_LENGTH);
|
|
4306
|
-
var HashZod =
|
|
4307
|
-
|
|
4308
|
-
|
|
1011
|
+
var HashZod = pipe(
|
|
1012
|
+
string2().check(_regex(HashRegEx, { error: "Invalid hex format" })),
|
|
1013
|
+
transform((val) => val)
|
|
1014
|
+
);
|
|
1015
|
+
var HashToJsonZod = pipe(HashZod, transform((v) => v));
|
|
1016
|
+
var JsonToHashZod = pipe(string2(), transform((v) => asHash(v, true)));
|
|
4309
1017
|
function hexToBigInt(hex) {
|
|
4310
1018
|
return BigInt(hexFromHexString(hex, { prefix: true }));
|
|
4311
1019
|
}
|
|
4312
|
-
var BigIntToJsonZod =
|
|
4313
|
-
|
|
1020
|
+
var BigIntToJsonZod = pipe(
|
|
1021
|
+
bigint2().check(_nonnegative()),
|
|
1022
|
+
transform((x) => toHex(x))
|
|
1023
|
+
);
|
|
1024
|
+
var JsonToBigIntZod = pipe(
|
|
1025
|
+
string2(),
|
|
1026
|
+
transform((x) => hexToBigInt(toHex(x)))
|
|
1027
|
+
);
|
|
4314
1028
|
|
|
4315
|
-
// ../../../../../../node_modules/.pnpm/@xylabs+threads@
|
|
1029
|
+
// ../../../../../../node_modules/.pnpm/@xylabs+threads@6.0.0_debug@4.4.3_observable-fns@0.6.1/node_modules/@xylabs/threads/dist/browser/worker/worker.browser.mjs
|
|
4316
1030
|
var DefaultErrorSerializer = {
|
|
4317
1031
|
deserialize(message) {
|
|
4318
1032
|
return Object.assign(new Error(message.message), {
|
|
@@ -4610,7 +1324,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
4610
1324
|
});
|
|
4611
1325
|
}
|
|
4612
1326
|
};
|
|
4613
|
-
var
|
|
1327
|
+
var _a2;
|
|
4614
1328
|
function getGlobal() {
|
|
4615
1329
|
if (typeof globalThis !== "undefined")
|
|
4616
1330
|
return globalThis;
|
|
@@ -4621,7 +1335,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
4621
1335
|
return global;
|
|
4622
1336
|
}
|
|
4623
1337
|
var globalObject = getGlobal();
|
|
4624
|
-
var nodeBuffer = (
|
|
1338
|
+
var nodeBuffer = (_a2 = globalObject.Buffer) !== null && _a2 !== void 0 ? _a2 : null;
|
|
4625
1339
|
var textEncoder = globalObject.TextEncoder ? new globalObject.TextEncoder() : null;
|
|
4626
1340
|
function hexCharCodesToInt(a, b) {
|
|
4627
1341
|
return (a & 15) + (a >> 6 | a >> 3 & 8) << 4 | (b & 15) + (b >> 6 | b >> 3 & 8);
|