@pstdio/sdk 0.35.0 → 0.36.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +33 -6
- package/dist/api/index.js +2200 -893
- package/dist/api.d.ts +4 -4
- package/dist/client/index.js +6 -4
- package/dist/client.d.ts +1 -1
- package/dist/data/index.js +4 -4
- package/dist/data.d.ts +2 -2
- package/dist/extensions/index.js +9 -5
- package/dist/extensions.d.ts +2 -2
- package/dist/hooks.d.ts +4 -4
- package/dist/{index-x7CdJPRb.d.ts → index-CJUDgZmO.d.ts} +87 -145
- package/dist/{index-Cm5A8d4m.d.ts → index-KZC6jRip.d.ts} +10 -7
- package/dist/{index-iez3LrOK.d.ts → index-uADamSuQ.d.ts} +1 -1
- package/dist/resources/index.js +2200 -893
- package/dist/resources.d.ts +3 -3
- package/dist/sessions-CPa_dPkI.d.ts +2 -0
- package/dist/skills-CPa_dPkI.d.ts +2 -0
- package/dist/testing.d.ts +1 -1
- package/package.json +1 -1
- package/dist/sessions-DcxmP7uF.d.ts +0 -2
- package/dist/skills-DcxmP7uF.d.ts +0 -2
package/dist/api/index.js
CHANGED
|
@@ -13,83 +13,7 @@ var __export = (target, all) => {
|
|
|
13
13
|
});
|
|
14
14
|
};
|
|
15
15
|
|
|
16
|
-
// ../../node_modules/.bun/zod@4.
|
|
17
|
-
var NEVER = Object.freeze({
|
|
18
|
-
status: "aborted"
|
|
19
|
-
});
|
|
20
|
-
function $constructor(name, initializer, params) {
|
|
21
|
-
function init(inst, def) {
|
|
22
|
-
if (!inst._zod) {
|
|
23
|
-
Object.defineProperty(inst, "_zod", {
|
|
24
|
-
value: {
|
|
25
|
-
def,
|
|
26
|
-
constr: _,
|
|
27
|
-
traits: new Set
|
|
28
|
-
},
|
|
29
|
-
enumerable: false
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
if (inst._zod.traits.has(name)) {
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
|
-
inst._zod.traits.add(name);
|
|
36
|
-
initializer(inst, def);
|
|
37
|
-
const proto = _.prototype;
|
|
38
|
-
const keys = Object.keys(proto);
|
|
39
|
-
for (let i = 0;i < keys.length; i++) {
|
|
40
|
-
const k = keys[i];
|
|
41
|
-
if (!(k in inst)) {
|
|
42
|
-
inst[k] = proto[k].bind(inst);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
const Parent = params?.Parent ?? Object;
|
|
47
|
-
|
|
48
|
-
class Definition extends Parent {
|
|
49
|
-
}
|
|
50
|
-
Object.defineProperty(Definition, "name", { value: name });
|
|
51
|
-
function _(def) {
|
|
52
|
-
var _a;
|
|
53
|
-
const inst = params?.Parent ? new Definition : this;
|
|
54
|
-
init(inst, def);
|
|
55
|
-
(_a = inst._zod).deferred ?? (_a.deferred = []);
|
|
56
|
-
for (const fn of inst._zod.deferred) {
|
|
57
|
-
fn();
|
|
58
|
-
}
|
|
59
|
-
return inst;
|
|
60
|
-
}
|
|
61
|
-
Object.defineProperty(_, "init", { value: init });
|
|
62
|
-
Object.defineProperty(_, Symbol.hasInstance, {
|
|
63
|
-
value: (inst) => {
|
|
64
|
-
if (params?.Parent && inst instanceof params.Parent)
|
|
65
|
-
return true;
|
|
66
|
-
return inst?._zod?.traits?.has(name);
|
|
67
|
-
}
|
|
68
|
-
});
|
|
69
|
-
Object.defineProperty(_, "name", { value: name });
|
|
70
|
-
return _;
|
|
71
|
-
}
|
|
72
|
-
var $brand = Symbol("zod_brand");
|
|
73
|
-
|
|
74
|
-
class $ZodAsyncError extends Error {
|
|
75
|
-
constructor() {
|
|
76
|
-
super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`);
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
class $ZodEncodeError extends Error {
|
|
81
|
-
constructor(name) {
|
|
82
|
-
super(`Encountered unidirectional transform during encode: ${name}`);
|
|
83
|
-
this.name = "ZodEncodeError";
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
var globalConfig = {};
|
|
87
|
-
function config(newConfig) {
|
|
88
|
-
if (newConfig)
|
|
89
|
-
Object.assign(globalConfig, newConfig);
|
|
90
|
-
return globalConfig;
|
|
91
|
-
}
|
|
92
|
-
// ../../node_modules/.bun/zod@4.3.6/node_modules/zod/v4/core/util.js
|
|
16
|
+
// ../../node_modules/.bun/zod@4.5.4/node_modules/zod/v4/core/util.js
|
|
93
17
|
function getEnumValues(entries) {
|
|
94
18
|
const numericValues = Object.values(entries).filter((v) => typeof v === "number");
|
|
95
19
|
const values = Object.entries(entries).filter(([k, _]) => numericValues.indexOf(+k) === -1).map(([_, v]) => v);
|
|
@@ -125,21 +49,14 @@ function cleanRegex(source) {
|
|
|
125
49
|
return source.slice(start, end);
|
|
126
50
|
}
|
|
127
51
|
function floatSafeRemainder(val, step) {
|
|
128
|
-
const
|
|
129
|
-
const
|
|
130
|
-
|
|
131
|
-
if (
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
}
|
|
137
|
-
const decCount = valDecCount > stepDecCount ? valDecCount : stepDecCount;
|
|
138
|
-
const valInt = Number.parseInt(val.toFixed(decCount).replace(".", ""));
|
|
139
|
-
const stepInt = Number.parseInt(step.toFixed(decCount).replace(".", ""));
|
|
140
|
-
return valInt % stepInt / 10 ** decCount;
|
|
141
|
-
}
|
|
142
|
-
var EVALUATING = Symbol("evaluating");
|
|
52
|
+
const ratio = val / step;
|
|
53
|
+
const roundedRatio = Math.round(ratio);
|
|
54
|
+
const tolerance = 4 * Number.EPSILON * Math.max(Math.abs(ratio), 1);
|
|
55
|
+
if (Math.abs(ratio - roundedRatio) < tolerance)
|
|
56
|
+
return 0;
|
|
57
|
+
return ratio - roundedRatio;
|
|
58
|
+
}
|
|
59
|
+
var EVALUATING = /* @__PURE__ */ Symbol("evaluating");
|
|
143
60
|
function defineLazy(object, key, getter) {
|
|
144
61
|
let value = undefined;
|
|
145
62
|
Object.defineProperty(object, key, {
|
|
@@ -187,7 +104,10 @@ var captureStackTrace = "captureStackTrace" in Error ? Error.captureStackTrace :
|
|
|
187
104
|
function isObject(data) {
|
|
188
105
|
return typeof data === "object" && data !== null && !Array.isArray(data);
|
|
189
106
|
}
|
|
190
|
-
var allowsEval = cached(() => {
|
|
107
|
+
var allowsEval = /* @__PURE__ */ cached(() => {
|
|
108
|
+
if (globalConfig.jitless) {
|
|
109
|
+
return false;
|
|
110
|
+
}
|
|
191
111
|
if (typeof navigator !== "undefined" && navigator?.userAgent?.includes("Cloudflare")) {
|
|
192
112
|
return false;
|
|
193
113
|
}
|
|
@@ -220,10 +140,13 @@ function shallowClone(o) {
|
|
|
220
140
|
return { ...o };
|
|
221
141
|
if (Array.isArray(o))
|
|
222
142
|
return [...o];
|
|
143
|
+
if (o instanceof Map)
|
|
144
|
+
return new Map(o);
|
|
145
|
+
if (o instanceof Set)
|
|
146
|
+
return new Set(o);
|
|
223
147
|
return o;
|
|
224
148
|
}
|
|
225
|
-
var propertyKeyTypes = new Set(["string", "number", "symbol"]);
|
|
226
|
-
var primitiveTypes = new Set(["string", "number", "bigint", "boolean", "symbol", "undefined"]);
|
|
149
|
+
var propertyKeyTypes = /* @__PURE__ */ new Set(["string", "number", "symbol"]);
|
|
227
150
|
function escapeRegex(str) {
|
|
228
151
|
return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
229
152
|
}
|
|
@@ -258,16 +181,16 @@ function stringifyPrimitive(value) {
|
|
|
258
181
|
}
|
|
259
182
|
function optionalKeys(shape) {
|
|
260
183
|
return Object.keys(shape).filter((k) => {
|
|
261
|
-
return shape[k]._zod.optin
|
|
184
|
+
return shape[k]._zod.optin !== undefined && shape[k]._zod.optout === "optional";
|
|
262
185
|
});
|
|
263
186
|
}
|
|
264
|
-
var NUMBER_FORMAT_RANGES = {
|
|
187
|
+
var NUMBER_FORMAT_RANGES = /* @__PURE__ */ (() => ({
|
|
265
188
|
safeint: [Number.MIN_SAFE_INTEGER, Number.MAX_SAFE_INTEGER],
|
|
266
189
|
int32: [-2147483648, 2147483647],
|
|
267
190
|
uint32: [0, 4294967295],
|
|
268
191
|
float32: [-340282346638528860000000000000000000000, 340282346638528860000000000000000000000],
|
|
269
192
|
float64: [-Number.MAX_VALUE, Number.MAX_VALUE]
|
|
270
|
-
};
|
|
193
|
+
}))();
|
|
271
194
|
function pick(schema, mask) {
|
|
272
195
|
const currDef = schema._zod.def;
|
|
273
196
|
const checks = currDef.checks;
|
|
@@ -278,13 +201,13 @@ function pick(schema, mask) {
|
|
|
278
201
|
const def = mergeDefs(schema._zod.def, {
|
|
279
202
|
get shape() {
|
|
280
203
|
const newShape = {};
|
|
281
|
-
for (const key
|
|
282
|
-
if (!(
|
|
283
|
-
throw new Error(`Unrecognized key: "${key}"`);
|
|
204
|
+
for (const key of Reflect.ownKeys(mask)) {
|
|
205
|
+
if (!Object.prototype.hasOwnProperty.call(currDef.shape, key)) {
|
|
206
|
+
throw new Error(`Unrecognized key: "${String(key)}"`);
|
|
284
207
|
}
|
|
285
208
|
if (!mask[key])
|
|
286
209
|
continue;
|
|
287
|
-
newShape
|
|
210
|
+
assignProp(newShape, key, currDef.shape[key]);
|
|
288
211
|
}
|
|
289
212
|
assignProp(this, "shape", newShape);
|
|
290
213
|
return newShape;
|
|
@@ -303,9 +226,9 @@ function omit(schema, mask) {
|
|
|
303
226
|
const def = mergeDefs(schema._zod.def, {
|
|
304
227
|
get shape() {
|
|
305
228
|
const newShape = { ...schema._zod.def.shape };
|
|
306
|
-
for (const key
|
|
307
|
-
if (!(
|
|
308
|
-
throw new Error(`Unrecognized key: "${key}"`);
|
|
229
|
+
for (const key of Reflect.ownKeys(mask)) {
|
|
230
|
+
if (!Object.prototype.hasOwnProperty.call(currDef.shape, key)) {
|
|
231
|
+
throw new Error(`Unrecognized key: "${String(key)}"`);
|
|
309
232
|
}
|
|
310
233
|
if (!mask[key])
|
|
311
234
|
continue;
|
|
@@ -326,7 +249,7 @@ function extend(schema, shape) {
|
|
|
326
249
|
const hasChecks = checks && checks.length > 0;
|
|
327
250
|
if (hasChecks) {
|
|
328
251
|
const existingShape = schema._zod.def.shape;
|
|
329
|
-
for (const key
|
|
252
|
+
for (const key of Reflect.ownKeys(shape)) {
|
|
330
253
|
if (Object.getOwnPropertyDescriptor(existingShape, key) !== undefined) {
|
|
331
254
|
throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.");
|
|
332
255
|
}
|
|
@@ -355,6 +278,12 @@ function safeExtend(schema, shape) {
|
|
|
355
278
|
return clone(schema, def);
|
|
356
279
|
}
|
|
357
280
|
function merge(a, b) {
|
|
281
|
+
if (!b?._zod?.def) {
|
|
282
|
+
throw new Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");
|
|
283
|
+
}
|
|
284
|
+
if (a._zod.def.checks?.length) {
|
|
285
|
+
throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");
|
|
286
|
+
}
|
|
358
287
|
const def = mergeDefs(a._zod.def, {
|
|
359
288
|
get shape() {
|
|
360
289
|
const _shape = { ...a._zod.def.shape, ...b._zod.def.shape };
|
|
@@ -364,25 +293,25 @@ function merge(a, b) {
|
|
|
364
293
|
get catchall() {
|
|
365
294
|
return b._zod.def.catchall;
|
|
366
295
|
},
|
|
367
|
-
checks: []
|
|
296
|
+
checks: b._zod.def.checks ?? []
|
|
368
297
|
});
|
|
369
298
|
return clone(a, def);
|
|
370
299
|
}
|
|
371
|
-
function partial(Class, schema, mask) {
|
|
300
|
+
function partial(Class, schema, mask, name = "partial") {
|
|
372
301
|
const currDef = schema._zod.def;
|
|
373
302
|
const checks = currDef.checks;
|
|
374
303
|
const hasChecks = checks && checks.length > 0;
|
|
375
304
|
if (hasChecks) {
|
|
376
|
-
throw new Error(
|
|
305
|
+
throw new Error(`.${name}() cannot be used on object schemas containing refinements`);
|
|
377
306
|
}
|
|
378
307
|
const def = mergeDefs(schema._zod.def, {
|
|
379
308
|
get shape() {
|
|
380
309
|
const oldShape = schema._zod.def.shape;
|
|
381
310
|
const shape = { ...oldShape };
|
|
382
311
|
if (mask) {
|
|
383
|
-
for (const key
|
|
384
|
-
if (!(key
|
|
385
|
-
throw new Error(`Unrecognized key: "${key}"`);
|
|
312
|
+
for (const key of Reflect.ownKeys(mask)) {
|
|
313
|
+
if (!Object.prototype.hasOwnProperty.call(oldShape, key)) {
|
|
314
|
+
throw new Error(`Unrecognized key: "${String(key)}"`);
|
|
386
315
|
}
|
|
387
316
|
if (!mask[key])
|
|
388
317
|
continue;
|
|
@@ -392,7 +321,7 @@ function partial(Class, schema, mask) {
|
|
|
392
321
|
}) : oldShape[key];
|
|
393
322
|
}
|
|
394
323
|
} else {
|
|
395
|
-
for (const key
|
|
324
|
+
for (const key of Reflect.ownKeys(oldShape)) {
|
|
396
325
|
shape[key] = Class ? new Class({
|
|
397
326
|
type: "optional",
|
|
398
327
|
innerType: oldShape[key]
|
|
@@ -412,9 +341,9 @@ function required(Class, schema, mask) {
|
|
|
412
341
|
const oldShape = schema._zod.def.shape;
|
|
413
342
|
const shape = { ...oldShape };
|
|
414
343
|
if (mask) {
|
|
415
|
-
for (const key
|
|
416
|
-
if (!(key
|
|
417
|
-
throw new Error(`Unrecognized key: "${key}"`);
|
|
344
|
+
for (const key of Reflect.ownKeys(mask)) {
|
|
345
|
+
if (!Object.prototype.hasOwnProperty.call(shape, key)) {
|
|
346
|
+
throw new Error(`Unrecognized key: "${String(key)}"`);
|
|
418
347
|
}
|
|
419
348
|
if (!mask[key])
|
|
420
349
|
continue;
|
|
@@ -424,7 +353,7 @@ function required(Class, schema, mask) {
|
|
|
424
353
|
});
|
|
425
354
|
}
|
|
426
355
|
} else {
|
|
427
|
-
for (const key
|
|
356
|
+
for (const key of Reflect.ownKeys(oldShape)) {
|
|
428
357
|
shape[key] = new Class({
|
|
429
358
|
type: "nonoptional",
|
|
430
359
|
innerType: oldShape[key]
|
|
@@ -447,6 +376,16 @@ function aborted(x, startIndex = 0) {
|
|
|
447
376
|
}
|
|
448
377
|
return false;
|
|
449
378
|
}
|
|
379
|
+
function explicitlyAborted(x, startIndex = 0) {
|
|
380
|
+
if (x.aborted === true)
|
|
381
|
+
return true;
|
|
382
|
+
for (let i = startIndex;i < x.issues.length; i++) {
|
|
383
|
+
if (x.issues[i]?.continue === false) {
|
|
384
|
+
return true;
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
return false;
|
|
388
|
+
}
|
|
450
389
|
function prefixIssues(path, issues) {
|
|
451
390
|
return issues.map((iss) => {
|
|
452
391
|
var _a;
|
|
@@ -458,18 +397,44 @@ function prefixIssues(path, issues) {
|
|
|
458
397
|
function unwrapMessage(message) {
|
|
459
398
|
return typeof message === "string" ? message : message?.message;
|
|
460
399
|
}
|
|
400
|
+
function attachSchema(issues, start, inst) {
|
|
401
|
+
var _a;
|
|
402
|
+
for (let i = start;i < issues.length; i++) {
|
|
403
|
+
(_a = issues[i]).schema ?? (_a.schema = inst);
|
|
404
|
+
}
|
|
405
|
+
}
|
|
461
406
|
function finalizeIssue(iss, ctx, config) {
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
407
|
+
var _a;
|
|
408
|
+
const traits = iss.inst?._zod?.traits;
|
|
409
|
+
if (traits?.has("$ZodType")) {
|
|
410
|
+
if (traits.has("$ZodCheck"))
|
|
411
|
+
(_a = iss).schema ?? (_a.schema = iss.inst);
|
|
412
|
+
else
|
|
413
|
+
iss.schema = iss.inst;
|
|
466
414
|
}
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
415
|
+
const schemaError = iss.schema !== iss.inst ? iss.schema?._zod.def?.error : undefined;
|
|
416
|
+
const message = iss.message ? iss.message : unwrapMessage(iss.inst?._zod.def?.error?.(iss)) ?? unwrapMessage(schemaError?.(iss)) ?? unwrapMessage(ctx?.error?.(iss)) ?? unwrapMessage(config.customError?.(iss)) ?? unwrapMessage(config.localeError?.(iss)) ?? "Invalid input";
|
|
417
|
+
const { inst: _inst, schema: _schema, continue: _continue, input: _input, ...rest } = iss;
|
|
418
|
+
rest.path ?? (rest.path = []);
|
|
419
|
+
rest.message = message;
|
|
420
|
+
if (ctx?.reportInput) {
|
|
421
|
+
rest.input = _input;
|
|
471
422
|
}
|
|
472
|
-
return
|
|
423
|
+
return rest;
|
|
424
|
+
}
|
|
425
|
+
var highSurrogate = /[\uD800-\uDBFF]/;
|
|
426
|
+
function codePointLength(str) {
|
|
427
|
+
const units = str.length;
|
|
428
|
+
if (!highSurrogate.test(str))
|
|
429
|
+
return units;
|
|
430
|
+
let count = units;
|
|
431
|
+
for (let i = 0;i < units - 1; i++) {
|
|
432
|
+
if ((str.charCodeAt(i) & 64512) === 55296 && (str.charCodeAt(i + 1) & 64512) === 56320) {
|
|
433
|
+
count--;
|
|
434
|
+
i++;
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
return count;
|
|
473
438
|
}
|
|
474
439
|
function getLengthableOrigin(input) {
|
|
475
440
|
if (Array.isArray(input))
|
|
@@ -511,33 +476,286 @@ function issue(...args) {
|
|
|
511
476
|
}
|
|
512
477
|
return { ...iss };
|
|
513
478
|
}
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
479
|
+
function members(proto, table) {
|
|
480
|
+
for (const key in table) {
|
|
481
|
+
const desc = Object.getOwnPropertyDescriptor(table, key);
|
|
482
|
+
if (desc.get)
|
|
483
|
+
Object.defineProperty(proto, key, { ...desc, enumerable: false });
|
|
484
|
+
else
|
|
485
|
+
defineBound(proto, key, desc.value);
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
function own(inst, key, value, enumerable = true) {
|
|
489
|
+
Object.defineProperty(inst, key, { configurable: true, writable: true, enumerable, value });
|
|
490
|
+
return value;
|
|
491
|
+
}
|
|
492
|
+
function hide(inst, key, value) {
|
|
493
|
+
return own(inst, key, value, false);
|
|
494
|
+
}
|
|
495
|
+
function defineBound(proto, key, fn) {
|
|
496
|
+
Object.defineProperty(proto, key, {
|
|
497
|
+
configurable: true,
|
|
498
|
+
get() {
|
|
499
|
+
return this == null ? fn : own(this, key, fn.bind(this));
|
|
500
|
+
},
|
|
501
|
+
set(value) {
|
|
502
|
+
own(this, key, value);
|
|
503
|
+
}
|
|
521
504
|
});
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
505
|
+
}
|
|
506
|
+
function claim(inst, sentinel) {
|
|
507
|
+
const proto = Object.getPrototypeOf(inst);
|
|
508
|
+
return sentinel in proto ? undefined : proto;
|
|
509
|
+
}
|
|
510
|
+
var installing;
|
|
511
|
+
var broke = false;
|
|
512
|
+
var breaker = {
|
|
513
|
+
configurable: true,
|
|
514
|
+
get() {
|
|
515
|
+
broke = true;
|
|
516
|
+
return;
|
|
517
|
+
}
|
|
518
|
+
};
|
|
519
|
+
function defineLazyInternal(inst, key, compute) {
|
|
520
|
+
const proto = Object.getPrototypeOf(inst._zod);
|
|
521
|
+
if (key in proto && installing !== inst._zod) {
|
|
522
|
+
installing = undefined;
|
|
523
|
+
return;
|
|
524
|
+
}
|
|
525
|
+
installing = inst._zod;
|
|
526
|
+
Object.defineProperty(proto, key, {
|
|
527
|
+
configurable: true,
|
|
528
|
+
get() {
|
|
529
|
+
Object.defineProperty(this, key, breaker);
|
|
530
|
+
const outer = broke;
|
|
531
|
+
broke = false;
|
|
532
|
+
try {
|
|
533
|
+
const value = compute(this);
|
|
534
|
+
if (broke)
|
|
535
|
+
delete this[key];
|
|
536
|
+
else
|
|
537
|
+
Object.defineProperty(this, key, { configurable: true, writable: true, value });
|
|
538
|
+
broke = broke || outer;
|
|
539
|
+
return value;
|
|
540
|
+
} catch (err) {
|
|
541
|
+
delete this[key];
|
|
542
|
+
broke = broke || outer;
|
|
543
|
+
throw err;
|
|
544
|
+
}
|
|
545
|
+
},
|
|
546
|
+
set(value) {
|
|
547
|
+
Object.defineProperty(this, key, { configurable: true, writable: true, value });
|
|
548
|
+
}
|
|
525
549
|
});
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
550
|
+
}
|
|
551
|
+
function installLazyProp(inst, key, make, enumerable) {
|
|
552
|
+
const proto = claim(inst, key);
|
|
553
|
+
if (!proto)
|
|
554
|
+
return;
|
|
555
|
+
Object.defineProperty(proto, key, {
|
|
556
|
+
configurable: true,
|
|
557
|
+
get() {
|
|
558
|
+
const desc = { configurable: true, writable: true, enumerable, value: undefined };
|
|
559
|
+
Object.defineProperty(this, key, desc);
|
|
560
|
+
desc.value = make(this);
|
|
561
|
+
Object.defineProperty(this, key, desc);
|
|
562
|
+
return desc.value;
|
|
563
|
+
},
|
|
564
|
+
set(value) {
|
|
565
|
+
Object.defineProperty(this, key, { configurable: true, writable: true, enumerable, value });
|
|
566
|
+
}
|
|
567
|
+
});
|
|
568
|
+
}
|
|
569
|
+
var CONSTANT_CATCH = "~constantCatch";
|
|
570
|
+
function constantCatch(value) {
|
|
571
|
+
const fn = () => value;
|
|
572
|
+
fn[CONSTANT_CATCH] = true;
|
|
573
|
+
return fn;
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
// ../../node_modules/.bun/zod@4.5.4/node_modules/zod/v4/core/core.js
|
|
577
|
+
var _a;
|
|
578
|
+
var _zodDesc = { value: undefined, enumerable: false };
|
|
579
|
+
var _E = "captureStackTrace" in Error ? Error : null;
|
|
580
|
+
function newError(Definition) {
|
|
581
|
+
const E = _E;
|
|
582
|
+
if (E) {
|
|
583
|
+
const saved = E.stackTraceLimit;
|
|
584
|
+
if (typeof saved === "number") {
|
|
585
|
+
try {
|
|
586
|
+
E.stackTraceLimit = 0;
|
|
587
|
+
} catch {
|
|
588
|
+
_E = null;
|
|
589
|
+
return new Definition;
|
|
590
|
+
}
|
|
591
|
+
try {
|
|
592
|
+
return new Definition;
|
|
593
|
+
} finally {
|
|
594
|
+
E.stackTraceLimit = saved;
|
|
595
|
+
}
|
|
596
|
+
}
|
|
597
|
+
}
|
|
598
|
+
return new Definition;
|
|
599
|
+
}
|
|
600
|
+
function $constructor(name, initializer, proto, params) {
|
|
601
|
+
const zodProto = {};
|
|
602
|
+
function Internals(def) {
|
|
603
|
+
this.def = def;
|
|
604
|
+
this.constr = _;
|
|
605
|
+
this.traits = new Set;
|
|
606
|
+
}
|
|
607
|
+
Internals.prototype = zodProto;
|
|
608
|
+
const protoMembers = proto;
|
|
609
|
+
const initialized = protoMembers && new WeakSet;
|
|
610
|
+
function init(inst, def) {
|
|
611
|
+
if (!inst._zod) {
|
|
612
|
+
_zodDesc.value = new Internals(def);
|
|
613
|
+
try {
|
|
614
|
+
Object.defineProperty(inst, "_zod", _zodDesc);
|
|
615
|
+
} finally {
|
|
616
|
+
_zodDesc.value = undefined;
|
|
617
|
+
}
|
|
618
|
+
}
|
|
619
|
+
if (inst._zod.traits.has(name)) {
|
|
620
|
+
return;
|
|
621
|
+
}
|
|
622
|
+
inst._zod.traits.add(name);
|
|
623
|
+
initializer(inst, def);
|
|
624
|
+
if (initialized) {
|
|
625
|
+
const own = Object.getPrototypeOf(inst);
|
|
626
|
+
const ctorProto = inst._zod.constr.prototype;
|
|
627
|
+
let up = own;
|
|
628
|
+
while (up && up !== ctorProto)
|
|
629
|
+
up = Object.getPrototypeOf(up);
|
|
630
|
+
const target = up ?? own;
|
|
631
|
+
if (!initialized.has(target)) {
|
|
632
|
+
initialized.add(target);
|
|
633
|
+
members(target, protoMembers);
|
|
634
|
+
}
|
|
635
|
+
}
|
|
636
|
+
const proto = _.prototype;
|
|
637
|
+
for (const k in proto) {
|
|
638
|
+
if (!Object.prototype.hasOwnProperty.call(proto, k))
|
|
639
|
+
continue;
|
|
640
|
+
if (!(k in inst)) {
|
|
641
|
+
inst[k] = proto[k].bind(inst);
|
|
642
|
+
}
|
|
643
|
+
}
|
|
644
|
+
}
|
|
645
|
+
const Parent = params?.Parent ?? Object;
|
|
646
|
+
|
|
647
|
+
class Definition extends Parent {
|
|
648
|
+
}
|
|
649
|
+
Object.defineProperty(Definition, "name", { value: name });
|
|
650
|
+
function _(def) {
|
|
651
|
+
const inst = params?.Parent ? newError(Definition) : this;
|
|
652
|
+
init(inst, def);
|
|
653
|
+
const deferred = inst._zod.deferred;
|
|
654
|
+
if (deferred) {
|
|
655
|
+
for (const fn of deferred) {
|
|
656
|
+
fn();
|
|
657
|
+
}
|
|
658
|
+
inst._zod.deferred = undefined;
|
|
659
|
+
}
|
|
660
|
+
const pp = globalThis.__zod_globalConfig?.postProcessor;
|
|
661
|
+
if (pp)
|
|
662
|
+
pp(inst);
|
|
663
|
+
return inst;
|
|
664
|
+
}
|
|
665
|
+
Object.defineProperty(_, "init", { value: init });
|
|
666
|
+
Object.defineProperty(_, Symbol.hasInstance, {
|
|
667
|
+
value: (inst) => {
|
|
668
|
+
if (params?.Parent && inst instanceof params.Parent)
|
|
669
|
+
return true;
|
|
670
|
+
return inst?._zod?.traits?.has(name);
|
|
671
|
+
}
|
|
530
672
|
});
|
|
673
|
+
Object.defineProperty(_, "name", { value: name });
|
|
674
|
+
return _;
|
|
675
|
+
}
|
|
676
|
+
class $ZodAsyncError extends Error {
|
|
677
|
+
constructor() {
|
|
678
|
+
super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`);
|
|
679
|
+
}
|
|
680
|
+
}
|
|
681
|
+
|
|
682
|
+
class $ZodEncodeError extends Error {
|
|
683
|
+
constructor(name) {
|
|
684
|
+
super(`Encountered unidirectional transform during encode: ${name}`);
|
|
685
|
+
this.name = "ZodEncodeError";
|
|
686
|
+
}
|
|
687
|
+
}
|
|
688
|
+
(_a = globalThis).__zod_globalConfig ?? (_a.__zod_globalConfig = {});
|
|
689
|
+
var globalConfig = globalThis.__zod_globalConfig;
|
|
690
|
+
function config(newConfig) {
|
|
691
|
+
if (newConfig)
|
|
692
|
+
Object.assign(globalConfig, newConfig);
|
|
693
|
+
return globalConfig;
|
|
694
|
+
}
|
|
695
|
+
// ../../node_modules/.bun/zod@4.5.4/node_modules/zod/v4/core/errors.js
|
|
696
|
+
function _getMessage() {
|
|
697
|
+
const internals = this._zod;
|
|
698
|
+
internals.message ?? (internals.message = JSON.stringify(internals.def, jsonStringifyReplacer, 2));
|
|
699
|
+
return internals.message;
|
|
700
|
+
}
|
|
701
|
+
function _setMessage(value) {
|
|
702
|
+
this._zod.message = value;
|
|
703
|
+
}
|
|
704
|
+
var _messageDesc = {
|
|
705
|
+
get: _getMessage,
|
|
706
|
+
set: _setMessage,
|
|
707
|
+
enumerable: true,
|
|
708
|
+
configurable: true
|
|
709
|
+
};
|
|
710
|
+
var _zodDesc2 = { value: undefined, enumerable: false };
|
|
711
|
+
var _issuesDesc = { value: undefined, enumerable: false };
|
|
712
|
+
var _installedToString = /* @__PURE__ */ new WeakSet([Object.prototype, Error.prototype]);
|
|
713
|
+
var initializer = (inst, def) => {
|
|
714
|
+
inst.name = "$ZodError";
|
|
715
|
+
_zodDesc2.value = inst._zod;
|
|
716
|
+
Object.defineProperty(inst, "_zod", _zodDesc2);
|
|
717
|
+
_issuesDesc.value = def;
|
|
718
|
+
Object.defineProperty(inst, "issues", _issuesDesc);
|
|
719
|
+
_zodDesc2.value = undefined;
|
|
720
|
+
_issuesDesc.value = undefined;
|
|
721
|
+
Object.defineProperty(inst, "message", _messageDesc);
|
|
722
|
+
const proto = Object.getPrototypeOf(inst);
|
|
723
|
+
if (!_installedToString.has(proto)) {
|
|
724
|
+
_installedToString.add(proto);
|
|
725
|
+
Object.defineProperty(proto, "toString", {
|
|
726
|
+
configurable: true,
|
|
727
|
+
enumerable: false,
|
|
728
|
+
get() {
|
|
729
|
+
const value = () => this.message;
|
|
730
|
+
Object.defineProperty(this, "toString", { value, configurable: true, writable: true });
|
|
731
|
+
return value;
|
|
732
|
+
},
|
|
733
|
+
set(value) {
|
|
734
|
+
Object.defineProperty(this, "toString", { value, configurable: true, writable: true });
|
|
735
|
+
}
|
|
736
|
+
});
|
|
737
|
+
}
|
|
531
738
|
};
|
|
532
739
|
var $ZodError = $constructor("$ZodError", initializer);
|
|
533
|
-
var $ZodRealError = $constructor("$ZodError", initializer, {
|
|
740
|
+
var $ZodRealError = $constructor("$ZodError", initializer, undefined, {
|
|
741
|
+
Parent: Error
|
|
742
|
+
});
|
|
743
|
+
function node(obj, key, make) {
|
|
744
|
+
if (!Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
745
|
+
if (key === "__proto__") {
|
|
746
|
+
Object.defineProperty(obj, key, { value: make(), writable: true, enumerable: true, configurable: true });
|
|
747
|
+
} else {
|
|
748
|
+
obj[key] = make();
|
|
749
|
+
}
|
|
750
|
+
}
|
|
751
|
+
return obj[key];
|
|
752
|
+
}
|
|
534
753
|
function flattenError(error, mapper = (issue) => issue.message) {
|
|
535
754
|
const fieldErrors = {};
|
|
536
755
|
const formErrors = [];
|
|
537
756
|
for (const sub of error.issues) {
|
|
538
757
|
if (sub.path.length > 0) {
|
|
539
|
-
fieldErrors
|
|
540
|
-
fieldErrors[sub.path[0]].push(mapper(sub));
|
|
758
|
+
node(fieldErrors, sub.path[0], () => []).push(mapper(sub));
|
|
541
759
|
} else {
|
|
542
760
|
formErrors.push(mapper(sub));
|
|
543
761
|
}
|
|
@@ -546,30 +764,45 @@ function flattenError(error, mapper = (issue) => issue.message) {
|
|
|
546
764
|
}
|
|
547
765
|
function formatError(error, mapper = (issue) => issue.message) {
|
|
548
766
|
const fieldErrors = { _errors: [] };
|
|
549
|
-
const processError = (error) => {
|
|
767
|
+
const processError = (error, path = []) => {
|
|
550
768
|
for (const issue of error.issues) {
|
|
551
769
|
if (issue.code === "invalid_union" && issue.errors.length) {
|
|
552
|
-
issue.errors.map((issues) => processError({ issues }));
|
|
770
|
+
issue.errors.map((issues) => processError({ issues }, [...path, ...issue.path]));
|
|
553
771
|
} else if (issue.code === "invalid_key") {
|
|
554
|
-
processError({ issues: issue.issues });
|
|
772
|
+
processError({ issues: issue.issues }, [...path, ...issue.path]);
|
|
555
773
|
} else if (issue.code === "invalid_element") {
|
|
556
|
-
processError({ issues: issue.issues });
|
|
557
|
-
} else if (issue.path.length === 0) {
|
|
558
|
-
fieldErrors._errors.push(mapper(issue));
|
|
774
|
+
processError({ issues: issue.issues }, [...path, ...issue.path]);
|
|
559
775
|
} else {
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
776
|
+
const fullpath = [...path, ...issue.path];
|
|
777
|
+
if (fullpath.length === 0) {
|
|
778
|
+
fieldErrors._errors.push(mapper(issue));
|
|
779
|
+
} else {
|
|
780
|
+
let curr = fieldErrors;
|
|
781
|
+
let i = 0;
|
|
782
|
+
while (i < fullpath.length) {
|
|
783
|
+
const el = fullpath[i];
|
|
784
|
+
const terminal = i === fullpath.length - 1;
|
|
785
|
+
if (el === "_errors") {
|
|
786
|
+
if (terminal)
|
|
787
|
+
curr._errors.push(mapper(issue));
|
|
788
|
+
i++;
|
|
789
|
+
continue;
|
|
790
|
+
}
|
|
791
|
+
if (!Object.prototype.hasOwnProperty.call(curr, el)) {
|
|
792
|
+
Object.defineProperty(curr, el, {
|
|
793
|
+
value: { _errors: [] },
|
|
794
|
+
enumerable: true,
|
|
795
|
+
writable: true,
|
|
796
|
+
configurable: true
|
|
797
|
+
});
|
|
798
|
+
}
|
|
799
|
+
const node = curr[el];
|
|
800
|
+
if (terminal) {
|
|
801
|
+
node._errors.push(mapper(issue));
|
|
802
|
+
}
|
|
803
|
+
curr = node;
|
|
804
|
+
i++;
|
|
570
805
|
}
|
|
571
|
-
curr = curr[el];
|
|
572
|
-
i++;
|
|
573
806
|
}
|
|
574
807
|
}
|
|
575
808
|
}
|
|
@@ -578,31 +811,40 @@ function formatError(error, mapper = (issue) => issue.message) {
|
|
|
578
811
|
return fieldErrors;
|
|
579
812
|
}
|
|
580
813
|
|
|
581
|
-
// ../../node_modules/.bun/zod@4.
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
814
|
+
// ../../node_modules/.bun/zod@4.5.4/node_modules/zod/v4/core/parse.js
|
|
815
|
+
function finalizeParams(callee, params) {
|
|
816
|
+
return { callee: params?.callee ?? callee, Err: params?.Err };
|
|
817
|
+
}
|
|
818
|
+
var _parse = (_Err) => {
|
|
819
|
+
const fn = (schema, value, _ctx, _params) => {
|
|
820
|
+
const ctx = _ctx ? { ..._ctx, async: false } : { async: false };
|
|
821
|
+
const result = schema._zod.run({ value, issues: [] }, ctx);
|
|
822
|
+
if (result instanceof Promise) {
|
|
823
|
+
throw new $ZodAsyncError;
|
|
824
|
+
}
|
|
825
|
+
if (result.issues.length) {
|
|
826
|
+
const e = new (_params?.Err ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())));
|
|
827
|
+
captureStackTrace(e, _params?.callee ?? fn);
|
|
828
|
+
throw e;
|
|
829
|
+
}
|
|
830
|
+
return result.value;
|
|
831
|
+
};
|
|
832
|
+
return fn;
|
|
594
833
|
};
|
|
595
|
-
var _parseAsync = (_Err) =>
|
|
596
|
-
const
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
result
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
834
|
+
var _parseAsync = (_Err) => {
|
|
835
|
+
const fn = async (schema, value, _ctx, params) => {
|
|
836
|
+
const ctx = _ctx ? { ..._ctx, async: true } : { async: true };
|
|
837
|
+
let result = schema._zod.run({ value, issues: [] }, ctx);
|
|
838
|
+
if (result instanceof Promise)
|
|
839
|
+
result = await result;
|
|
840
|
+
if (result.issues.length) {
|
|
841
|
+
const e = new (params?.Err ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())));
|
|
842
|
+
captureStackTrace(e, params?.callee ?? fn);
|
|
843
|
+
throw e;
|
|
844
|
+
}
|
|
845
|
+
return result.value;
|
|
846
|
+
};
|
|
847
|
+
return fn;
|
|
606
848
|
};
|
|
607
849
|
var _safeParse = (_Err) => (schema, value, _ctx) => {
|
|
608
850
|
const ctx = _ctx ? { ..._ctx, async: false } : { async: false };
|
|
@@ -617,7 +859,7 @@ var _safeParse = (_Err) => (schema, value, _ctx) => {
|
|
|
617
859
|
};
|
|
618
860
|
var safeParse = /* @__PURE__ */ _safeParse($ZodRealError);
|
|
619
861
|
var _safeParseAsync = (_Err) => async (schema, value, _ctx) => {
|
|
620
|
-
const ctx = _ctx ?
|
|
862
|
+
const ctx = _ctx ? { ..._ctx, async: true } : { async: true };
|
|
621
863
|
let result = schema._zod.run({ value, issues: [] }, ctx);
|
|
622
864
|
if (result instanceof Promise)
|
|
623
865
|
result = await result;
|
|
@@ -627,41 +869,60 @@ var _safeParseAsync = (_Err) => async (schema, value, _ctx) => {
|
|
|
627
869
|
} : { success: true, data: result.value };
|
|
628
870
|
};
|
|
629
871
|
var safeParseAsync = /* @__PURE__ */ _safeParseAsync($ZodRealError);
|
|
630
|
-
var _encode = (_Err) =>
|
|
631
|
-
const
|
|
632
|
-
|
|
872
|
+
var _encode = (_Err) => {
|
|
873
|
+
const parse = _parse(_Err);
|
|
874
|
+
const fn = (schema, value, _ctx, _params) => {
|
|
875
|
+
const ctx = _ctx ? { ..._ctx, direction: "backward" } : { direction: "backward" };
|
|
876
|
+
return parse(schema, value, ctx, finalizeParams(fn, _params));
|
|
877
|
+
};
|
|
878
|
+
return fn;
|
|
633
879
|
};
|
|
634
|
-
var _decode = (_Err) =>
|
|
635
|
-
|
|
880
|
+
var _decode = (_Err) => {
|
|
881
|
+
const parse = _parse(_Err);
|
|
882
|
+
const fn = (schema, value, _ctx, _params) => {
|
|
883
|
+
return parse(schema, value, _ctx, finalizeParams(fn, _params));
|
|
884
|
+
};
|
|
885
|
+
return fn;
|
|
636
886
|
};
|
|
637
|
-
var _encodeAsync = (_Err) =>
|
|
638
|
-
const
|
|
639
|
-
|
|
887
|
+
var _encodeAsync = (_Err) => {
|
|
888
|
+
const parseAsync = _parseAsync(_Err);
|
|
889
|
+
const fn = async (schema, value, _ctx, _params) => {
|
|
890
|
+
const ctx = _ctx ? { ..._ctx, direction: "backward" } : { direction: "backward" };
|
|
891
|
+
return await parseAsync(schema, value, ctx, finalizeParams(fn, _params));
|
|
892
|
+
};
|
|
893
|
+
return fn;
|
|
640
894
|
};
|
|
641
|
-
var _decodeAsync = (_Err) =>
|
|
642
|
-
|
|
895
|
+
var _decodeAsync = (_Err) => {
|
|
896
|
+
const parseAsync = _parseAsync(_Err);
|
|
897
|
+
const fn = async (schema, value, _ctx, _params) => {
|
|
898
|
+
return await parseAsync(schema, value, _ctx, finalizeParams(fn, _params));
|
|
899
|
+
};
|
|
900
|
+
return fn;
|
|
643
901
|
};
|
|
644
902
|
var _safeEncode = (_Err) => (schema, value, _ctx) => {
|
|
645
|
-
const ctx = _ctx ?
|
|
903
|
+
const ctx = _ctx ? { ..._ctx, direction: "backward" } : { direction: "backward" };
|
|
646
904
|
return _safeParse(_Err)(schema, value, ctx);
|
|
647
905
|
};
|
|
648
906
|
var _safeDecode = (_Err) => (schema, value, _ctx) => {
|
|
649
907
|
return _safeParse(_Err)(schema, value, _ctx);
|
|
650
908
|
};
|
|
651
909
|
var _safeEncodeAsync = (_Err) => async (schema, value, _ctx) => {
|
|
652
|
-
const ctx = _ctx ?
|
|
910
|
+
const ctx = _ctx ? { ..._ctx, direction: "backward" } : { direction: "backward" };
|
|
653
911
|
return _safeParseAsync(_Err)(schema, value, ctx);
|
|
654
912
|
};
|
|
655
913
|
var _safeDecodeAsync = (_Err) => async (schema, value, _ctx) => {
|
|
656
914
|
return _safeParseAsync(_Err)(schema, value, _ctx);
|
|
657
915
|
};
|
|
658
|
-
// ../../node_modules/.bun/zod@4.
|
|
659
|
-
var cuid = /^[cC][
|
|
916
|
+
// ../../node_modules/.bun/zod@4.5.4/node_modules/zod/v4/core/regexes.js
|
|
917
|
+
var cuid = /^[cC][0-9a-z]{6,}$/;
|
|
660
918
|
var cuid2 = /^[0-9a-z]+$/;
|
|
661
|
-
var ulid = /^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{
|
|
919
|
+
var ulid = /^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/;
|
|
662
920
|
var xid = /^[0-9a-vA-V]{20}$/;
|
|
663
921
|
var ksuid = /^[A-Za-z0-9]{27}$/;
|
|
664
922
|
var nanoid = /^[a-zA-Z0-9_-]{21}$/;
|
|
923
|
+
function nanoidOfLength(length) {
|
|
924
|
+
return new RegExp(`^[a-zA-Z0-9_-]{${length}}$`);
|
|
925
|
+
}
|
|
665
926
|
var duration = /^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;
|
|
666
927
|
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})$/;
|
|
667
928
|
var uuid = (version) => {
|
|
@@ -670,35 +931,37 @@ var uuid = (version) => {
|
|
|
670
931
|
return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${version}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`);
|
|
671
932
|
};
|
|
672
933
|
var email = /^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;
|
|
673
|
-
var _emoji = `^
|
|
934
|
+
var _emoji = `^[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`;
|
|
674
935
|
function emoji() {
|
|
675
936
|
return new RegExp(_emoji, "u");
|
|
676
937
|
}
|
|
677
938
|
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])$/;
|
|
678
939
|
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}|:))$/;
|
|
679
940
|
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])$/;
|
|
680
|
-
var cidrv6 = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}
|
|
941
|
+
var cidrv6 = /^(([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}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/;
|
|
681
942
|
var base64 = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/;
|
|
682
943
|
var base64url = /^[A-Za-z0-9_-]*$/;
|
|
944
|
+
var httpProtocol = /^https?$/;
|
|
683
945
|
var e164 = /^\+[1-9]\d{6,14}$/;
|
|
684
946
|
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])))`;
|
|
685
|
-
|
|
947
|
+
function anchor(source) {
|
|
948
|
+
return new RegExp(`^${source}$`);
|
|
949
|
+
}
|
|
950
|
+
var date = /* @__PURE__ */ anchor(dateSource);
|
|
686
951
|
function timeSource(args) {
|
|
687
952
|
const hhmm = `(?:[01]\\d|2[0-3]):[0-5]\\d`;
|
|
688
|
-
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+)?)?`;
|
|
953
|
+
const regex = typeof args.precision === "number" ? args.precision === -1 ? `${hhmm}` : args.precision === 0 ? `${hhmm}:[0-5]\\d` : `${hhmm}:[0-5]\\d\\.\\d{${args.precision}}` : args.seconds ? `${hhmm}:[0-5]\\d(?:\\.\\d+)?` : `${hhmm}(?::[0-5]\\d(?:\\.\\d+)?)?`;
|
|
689
954
|
return regex;
|
|
690
955
|
}
|
|
691
956
|
function time(args) {
|
|
692
957
|
return new RegExp(`^${timeSource(args)}$`);
|
|
693
958
|
}
|
|
694
959
|
function datetime(args) {
|
|
695
|
-
const time = timeSource({ precision: args.precision });
|
|
696
960
|
const opts = ["Z"];
|
|
697
|
-
if (args.local)
|
|
698
|
-
opts.push("");
|
|
699
961
|
if (args.offset)
|
|
700
962
|
opts.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);
|
|
701
|
-
const
|
|
963
|
+
const qualified = `${timeSource({ precision: args.precision, seconds: true })}(?:${opts.join("|")})`;
|
|
964
|
+
const timeRegex = args.local ? `${qualified}|${timeSource({ precision: args.precision })}` : qualified;
|
|
702
965
|
return new RegExp(`^${dateSource}T(?:${timeRegex})$`);
|
|
703
966
|
}
|
|
704
967
|
var string = (params) => {
|
|
@@ -713,13 +976,17 @@ var _null = /^null$/i;
|
|
|
713
976
|
var lowercase = /^[^A-Z]*$/;
|
|
714
977
|
var uppercase = /^[^a-z]*$/;
|
|
715
978
|
|
|
716
|
-
// ../../node_modules/.bun/zod@4.
|
|
979
|
+
// ../../node_modules/.bun/zod@4.5.4/node_modules/zod/v4/core/checks.js
|
|
717
980
|
var $ZodCheck = /* @__PURE__ */ $constructor("$ZodCheck", (inst, def) => {
|
|
718
981
|
var _a;
|
|
719
982
|
inst._zod ?? (inst._zod = {});
|
|
720
983
|
inst._zod.def = def;
|
|
721
984
|
(_a = inst._zod).onattach ?? (_a.onattach = []);
|
|
722
985
|
});
|
|
986
|
+
var _whenHasLength = (payload) => {
|
|
987
|
+
const val = payload.value;
|
|
988
|
+
return !nullish(val) && val.length !== undefined;
|
|
989
|
+
};
|
|
723
990
|
var numericOriginMap = {
|
|
724
991
|
number: "number",
|
|
725
992
|
bigint: "bigint",
|
|
@@ -743,7 +1010,7 @@ var $ZodCheckLessThan = /* @__PURE__ */ $constructor("$ZodCheckLessThan", (inst,
|
|
|
743
1010
|
return;
|
|
744
1011
|
}
|
|
745
1012
|
payload.issues.push({
|
|
746
|
-
origin,
|
|
1013
|
+
origin: numericOriginMap[typeof payload.value] ?? origin,
|
|
747
1014
|
code: "too_big",
|
|
748
1015
|
maximum: typeof def.value === "object" ? def.value.getTime() : def.value,
|
|
749
1016
|
input: payload.value,
|
|
@@ -771,7 +1038,7 @@ var $ZodCheckGreaterThan = /* @__PURE__ */ $constructor("$ZodCheckGreaterThan",
|
|
|
771
1038
|
return;
|
|
772
1039
|
}
|
|
773
1040
|
payload.issues.push({
|
|
774
|
-
origin,
|
|
1041
|
+
origin: numericOriginMap[typeof payload.value] ?? origin,
|
|
775
1042
|
code: "too_small",
|
|
776
1043
|
minimum: typeof def.value === "object" ? def.value.getTime() : def.value,
|
|
777
1044
|
input: payload.value,
|
|
@@ -790,7 +1057,7 @@ var $ZodCheckMultipleOf = /* @__PURE__ */ $constructor("$ZodCheckMultipleOf", (i
|
|
|
790
1057
|
inst._zod.check = (payload) => {
|
|
791
1058
|
if (typeof payload.value !== typeof def.value)
|
|
792
1059
|
throw new Error("Cannot mix number and bigint in multiple_of check.");
|
|
793
|
-
const isMultiple = typeof payload.value === "bigint" ? payload.value % def.value === BigInt(0) : floatSafeRemainder(payload.value, def.value) === 0;
|
|
1060
|
+
const isMultiple = typeof payload.value === "bigint" ? def.value !== BigInt(0) && payload.value % def.value === BigInt(0) : floatSafeRemainder(payload.value, def.value) === 0;
|
|
794
1061
|
if (isMultiple)
|
|
795
1062
|
return;
|
|
796
1063
|
payload.issues.push({
|
|
@@ -885,10 +1152,7 @@ var $ZodCheckNumberFormat = /* @__PURE__ */ $constructor("$ZodCheckNumberFormat"
|
|
|
885
1152
|
var $ZodCheckMaxLength = /* @__PURE__ */ $constructor("$ZodCheckMaxLength", (inst, def) => {
|
|
886
1153
|
var _a;
|
|
887
1154
|
$ZodCheck.init(inst, def);
|
|
888
|
-
(_a = inst._zod.def).when ?? (_a.when =
|
|
889
|
-
const val = payload.value;
|
|
890
|
-
return !nullish(val) && val.length !== undefined;
|
|
891
|
-
});
|
|
1155
|
+
(_a = inst._zod.def).when ?? (_a.when = _whenHasLength);
|
|
892
1156
|
inst._zod.onattach.push((inst) => {
|
|
893
1157
|
const curr = inst._zod.bag.maximum ?? Number.POSITIVE_INFINITY;
|
|
894
1158
|
if (def.maximum < curr)
|
|
@@ -896,7 +1160,8 @@ var $ZodCheckMaxLength = /* @__PURE__ */ $constructor("$ZodCheckMaxLength", (ins
|
|
|
896
1160
|
});
|
|
897
1161
|
inst._zod.check = (payload) => {
|
|
898
1162
|
const input = payload.value;
|
|
899
|
-
const
|
|
1163
|
+
const units = input.length;
|
|
1164
|
+
const length = typeof input === "string" && units > def.maximum ? codePointLength(input) : units;
|
|
900
1165
|
if (length <= def.maximum)
|
|
901
1166
|
return;
|
|
902
1167
|
const origin = getLengthableOrigin(input);
|
|
@@ -914,10 +1179,7 @@ var $ZodCheckMaxLength = /* @__PURE__ */ $constructor("$ZodCheckMaxLength", (ins
|
|
|
914
1179
|
var $ZodCheckMinLength = /* @__PURE__ */ $constructor("$ZodCheckMinLength", (inst, def) => {
|
|
915
1180
|
var _a;
|
|
916
1181
|
$ZodCheck.init(inst, def);
|
|
917
|
-
(_a = inst._zod.def).when ?? (_a.when =
|
|
918
|
-
const val = payload.value;
|
|
919
|
-
return !nullish(val) && val.length !== undefined;
|
|
920
|
-
});
|
|
1182
|
+
(_a = inst._zod.def).when ?? (_a.when = _whenHasLength);
|
|
921
1183
|
inst._zod.onattach.push((inst) => {
|
|
922
1184
|
const curr = inst._zod.bag.minimum ?? Number.NEGATIVE_INFINITY;
|
|
923
1185
|
if (def.minimum > curr)
|
|
@@ -925,7 +1187,8 @@ var $ZodCheckMinLength = /* @__PURE__ */ $constructor("$ZodCheckMinLength", (ins
|
|
|
925
1187
|
});
|
|
926
1188
|
inst._zod.check = (payload) => {
|
|
927
1189
|
const input = payload.value;
|
|
928
|
-
const
|
|
1190
|
+
const units = input.length;
|
|
1191
|
+
const length = typeof input === "string" && units >= def.minimum && units < def.minimum * 2 ? codePointLength(input) : units;
|
|
929
1192
|
if (length >= def.minimum)
|
|
930
1193
|
return;
|
|
931
1194
|
const origin = getLengthableOrigin(input);
|
|
@@ -943,10 +1206,7 @@ var $ZodCheckMinLength = /* @__PURE__ */ $constructor("$ZodCheckMinLength", (ins
|
|
|
943
1206
|
var $ZodCheckLengthEquals = /* @__PURE__ */ $constructor("$ZodCheckLengthEquals", (inst, def) => {
|
|
944
1207
|
var _a;
|
|
945
1208
|
$ZodCheck.init(inst, def);
|
|
946
|
-
(_a = inst._zod.def).when ?? (_a.when =
|
|
947
|
-
const val = payload.value;
|
|
948
|
-
return !nullish(val) && val.length !== undefined;
|
|
949
|
-
});
|
|
1209
|
+
(_a = inst._zod.def).when ?? (_a.when = _whenHasLength);
|
|
950
1210
|
inst._zod.onattach.push((inst) => {
|
|
951
1211
|
const bag = inst._zod.bag;
|
|
952
1212
|
bag.minimum = def.length;
|
|
@@ -955,7 +1215,8 @@ var $ZodCheckLengthEquals = /* @__PURE__ */ $constructor("$ZodCheckLengthEquals"
|
|
|
955
1215
|
});
|
|
956
1216
|
inst._zod.check = (payload) => {
|
|
957
1217
|
const input = payload.value;
|
|
958
|
-
const
|
|
1218
|
+
const units = input.length;
|
|
1219
|
+
const length = typeof input === "string" && units >= def.length && units <= def.length * 2 ? codePointLength(input) : units;
|
|
959
1220
|
if (length === def.length)
|
|
960
1221
|
return;
|
|
961
1222
|
const origin = getLengthableOrigin(input);
|
|
@@ -1028,7 +1289,7 @@ var $ZodCheckUpperCase = /* @__PURE__ */ $constructor("$ZodCheckUpperCase", (ins
|
|
|
1028
1289
|
var $ZodCheckIncludes = /* @__PURE__ */ $constructor("$ZodCheckIncludes", (inst, def) => {
|
|
1029
1290
|
$ZodCheck.init(inst, def);
|
|
1030
1291
|
const escapedRegex = escapeRegex(def.includes);
|
|
1031
|
-
const pattern = new RegExp(typeof def.position === "number" ? `^.{${def.position}}${escapedRegex}` : escapedRegex);
|
|
1292
|
+
const pattern = new RegExp(typeof def.position === "number" ? `^.{${def.position},}${escapedRegex}` : escapedRegex);
|
|
1032
1293
|
def.pattern = pattern;
|
|
1033
1294
|
inst._zod.onattach.push((inst) => {
|
|
1034
1295
|
const bag = inst._zod.bag;
|
|
@@ -1102,13 +1363,13 @@ var $ZodCheckOverwrite = /* @__PURE__ */ $constructor("$ZodCheckOverwrite", (ins
|
|
|
1102
1363
|
};
|
|
1103
1364
|
});
|
|
1104
1365
|
|
|
1105
|
-
// ../../node_modules/.bun/zod@4.
|
|
1366
|
+
// ../../node_modules/.bun/zod@4.5.4/node_modules/zod/v4/core/doc.js
|
|
1106
1367
|
class Doc {
|
|
1107
|
-
constructor(args = []) {
|
|
1368
|
+
constructor(args = [], closed = {}) {
|
|
1108
1369
|
this.content = [];
|
|
1109
1370
|
this.indent = 0;
|
|
1110
|
-
|
|
1111
|
-
|
|
1371
|
+
this.args = args;
|
|
1372
|
+
this.closed = closed;
|
|
1112
1373
|
}
|
|
1113
1374
|
indented(fn) {
|
|
1114
1375
|
this.indent += 1;
|
|
@@ -1132,32 +1393,31 @@ class Doc {
|
|
|
1132
1393
|
}
|
|
1133
1394
|
compile() {
|
|
1134
1395
|
const F = Function;
|
|
1135
|
-
const args = this?.args;
|
|
1136
1396
|
const content = this?.content ?? [``];
|
|
1137
|
-
const
|
|
1138
|
-
|
|
1139
|
-
`)
|
|
1397
|
+
const factory = new F(...Object.keys(this.closed), `return function (${this.args.join(", ")}) {
|
|
1398
|
+
${content.join(`
|
|
1399
|
+
`)}
|
|
1400
|
+
};`);
|
|
1401
|
+
return factory(...Object.values(this.closed));
|
|
1140
1402
|
}
|
|
1141
1403
|
}
|
|
1142
1404
|
|
|
1143
|
-
// ../../node_modules/.bun/zod@4.
|
|
1405
|
+
// ../../node_modules/.bun/zod@4.5.4/node_modules/zod/v4/core/versions.js
|
|
1144
1406
|
var version = {
|
|
1145
1407
|
major: 4,
|
|
1146
|
-
minor:
|
|
1147
|
-
patch:
|
|
1408
|
+
minor: 5,
|
|
1409
|
+
patch: 4
|
|
1148
1410
|
};
|
|
1149
1411
|
|
|
1150
|
-
// ../../node_modules/.bun/zod@4.
|
|
1412
|
+
// ../../node_modules/.bun/zod@4.5.4/node_modules/zod/v4/core/schemas.js
|
|
1151
1413
|
var $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
|
|
1152
1414
|
var _a;
|
|
1153
1415
|
inst ?? (inst = {});
|
|
1154
1416
|
inst._zod.def = def;
|
|
1155
1417
|
inst._zod.bag = inst._zod.bag || {};
|
|
1156
1418
|
inst._zod.version = version;
|
|
1157
|
-
const
|
|
1158
|
-
|
|
1159
|
-
checks.unshift(inst);
|
|
1160
|
-
}
|
|
1419
|
+
const defChecks = inst._zod.def.checks;
|
|
1420
|
+
const checks = inst._zod.traits.has("$ZodCheck") ? [inst, ...defChecks ?? []] : defChecks?.length ? [...defChecks] : [];
|
|
1161
1421
|
for (const ch of checks) {
|
|
1162
1422
|
for (const fn of ch._zod.onattach) {
|
|
1163
1423
|
fn(inst);
|
|
@@ -1170,10 +1430,14 @@ var $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
|
|
|
1170
1430
|
});
|
|
1171
1431
|
} else {
|
|
1172
1432
|
const runChecks = (payload, checks, ctx) => {
|
|
1433
|
+
if (payload.memo)
|
|
1434
|
+
return payload;
|
|
1173
1435
|
let isAborted = aborted(payload);
|
|
1174
1436
|
let asyncResult;
|
|
1175
1437
|
for (const ch of checks) {
|
|
1176
1438
|
if (ch._zod.def.when) {
|
|
1439
|
+
if (explicitlyAborted(payload))
|
|
1440
|
+
continue;
|
|
1177
1441
|
const shouldRun = ch._zod.def.when(payload);
|
|
1178
1442
|
if (!shouldRun)
|
|
1179
1443
|
continue;
|
|
@@ -1191,6 +1455,7 @@ var $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
|
|
|
1191
1455
|
const nextLen = payload.issues.length;
|
|
1192
1456
|
if (nextLen === currLen)
|
|
1193
1457
|
return;
|
|
1458
|
+
attachSchema(payload.issues, currLen, inst);
|
|
1194
1459
|
if (!isAborted)
|
|
1195
1460
|
isAborted = aborted(payload, currLen);
|
|
1196
1461
|
});
|
|
@@ -1198,6 +1463,7 @@ var $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
|
|
|
1198
1463
|
const nextLen = payload.issues.length;
|
|
1199
1464
|
if (nextLen === currLen)
|
|
1200
1465
|
continue;
|
|
1466
|
+
attachSchema(payload.issues, currLen, inst);
|
|
1201
1467
|
if (!isAborted)
|
|
1202
1468
|
isAborted = aborted(payload, currLen);
|
|
1203
1469
|
}
|
|
@@ -1244,19 +1510,28 @@ var $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
|
|
|
1244
1510
|
return runChecks(result, checks, ctx);
|
|
1245
1511
|
};
|
|
1246
1512
|
}
|
|
1247
|
-
|
|
1513
|
+
}, {
|
|
1514
|
+
get "~standard"() {
|
|
1515
|
+
return hide(this, "~standard", standardProps(this));
|
|
1516
|
+
},
|
|
1517
|
+
set "~standard"(value) {
|
|
1518
|
+
own(this, "~standard", value);
|
|
1519
|
+
}
|
|
1520
|
+
});
|
|
1521
|
+
var toStandardResult = (r) => r.success ? { value: r.data } : { issues: r.error?.issues };
|
|
1522
|
+
function standardProps(inst) {
|
|
1523
|
+
return {
|
|
1248
1524
|
validate: (value) => {
|
|
1249
1525
|
try {
|
|
1250
|
-
|
|
1251
|
-
return r.success ? { value: r.data } : { issues: r.error?.issues };
|
|
1526
|
+
return toStandardResult(safeParse(inst, value));
|
|
1252
1527
|
} catch (_) {
|
|
1253
|
-
return safeParseAsync(inst, value).then(
|
|
1528
|
+
return safeParseAsync(inst, value).then(toStandardResult);
|
|
1254
1529
|
}
|
|
1255
1530
|
},
|
|
1256
1531
|
vendor: "zod",
|
|
1257
1532
|
version: 1
|
|
1258
|
-
}
|
|
1259
|
-
}
|
|
1533
|
+
};
|
|
1534
|
+
}
|
|
1260
1535
|
var $ZodString = /* @__PURE__ */ $constructor("$ZodString", (inst, def) => {
|
|
1261
1536
|
$ZodType.init(inst, def);
|
|
1262
1537
|
inst._zod.pattern = [...inst?._zod.bag?.patterns ?? []].pop() ?? string(inst._zod.bag);
|
|
@@ -1308,45 +1583,80 @@ var $ZodEmail = /* @__PURE__ */ $constructor("$ZodEmail", (inst, def) => {
|
|
|
1308
1583
|
def.pattern ?? (def.pattern = email);
|
|
1309
1584
|
$ZodStringFormat.init(inst, def);
|
|
1310
1585
|
});
|
|
1586
|
+
var URL_BAD_FORMAT = 1;
|
|
1587
|
+
var URL_UNPARSEABLE = 2;
|
|
1588
|
+
function parseURLObject(trimmed, def) {
|
|
1589
|
+
if (!def.normalize && def.protocol?.source === httpProtocol.source && !/^https?:\/\//i.test(trimmed)) {
|
|
1590
|
+
return URL_BAD_FORMAT;
|
|
1591
|
+
}
|
|
1592
|
+
try {
|
|
1593
|
+
return new URL(trimmed);
|
|
1594
|
+
} catch {
|
|
1595
|
+
return URL_UNPARSEABLE;
|
|
1596
|
+
}
|
|
1597
|
+
}
|
|
1598
|
+
var asciiTabOrNewline = /[\t\n\r]/g;
|
|
1599
|
+
function stripTabAndNewline(value) {
|
|
1600
|
+
return value.replace(asciiTabOrNewline, "");
|
|
1601
|
+
}
|
|
1602
|
+
function urlHostnameOk(url, hostname) {
|
|
1603
|
+
hostname.lastIndex = 0;
|
|
1604
|
+
return hostname.test(url.hostname);
|
|
1605
|
+
}
|
|
1606
|
+
function urlProtocolOk(url, protocol) {
|
|
1607
|
+
protocol.lastIndex = 0;
|
|
1608
|
+
return protocol.test(url.protocol.endsWith(":") ? url.protocol.slice(0, -1) : url.protocol);
|
|
1609
|
+
}
|
|
1311
1610
|
var $ZodURL = /* @__PURE__ */ $constructor("$ZodURL", (inst, def) => {
|
|
1312
1611
|
$ZodStringFormat.init(inst, def);
|
|
1313
1612
|
inst._zod.check = (payload) => {
|
|
1314
1613
|
try {
|
|
1315
1614
|
const trimmed = payload.value.trim();
|
|
1316
|
-
const url =
|
|
1317
|
-
if (
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
continue: !def.abort
|
|
1328
|
-
});
|
|
1329
|
-
}
|
|
1615
|
+
const url = parseURLObject(trimmed, def);
|
|
1616
|
+
if (url === URL_BAD_FORMAT) {
|
|
1617
|
+
payload.issues.push({
|
|
1618
|
+
code: "invalid_format",
|
|
1619
|
+
format: "url",
|
|
1620
|
+
note: "Invalid URL format",
|
|
1621
|
+
input: payload.value,
|
|
1622
|
+
inst,
|
|
1623
|
+
continue: !def.abort
|
|
1624
|
+
});
|
|
1625
|
+
return;
|
|
1330
1626
|
}
|
|
1331
|
-
if (
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
inst,
|
|
1341
|
-
continue: !def.abort
|
|
1342
|
-
});
|
|
1343
|
-
}
|
|
1627
|
+
if (url === URL_UNPARSEABLE) {
|
|
1628
|
+
payload.issues.push({
|
|
1629
|
+
code: "invalid_format",
|
|
1630
|
+
format: "url",
|
|
1631
|
+
input: payload.value,
|
|
1632
|
+
inst,
|
|
1633
|
+
continue: !def.abort
|
|
1634
|
+
});
|
|
1635
|
+
return;
|
|
1344
1636
|
}
|
|
1345
|
-
if (def.
|
|
1346
|
-
payload.
|
|
1347
|
-
|
|
1348
|
-
|
|
1637
|
+
if (def.hostname && !urlHostnameOk(url, def.hostname)) {
|
|
1638
|
+
payload.issues.push({
|
|
1639
|
+
code: "invalid_format",
|
|
1640
|
+
format: "url",
|
|
1641
|
+
note: "Invalid hostname",
|
|
1642
|
+
pattern: def.hostname.source,
|
|
1643
|
+
input: payload.value,
|
|
1644
|
+
inst,
|
|
1645
|
+
continue: !def.abort
|
|
1646
|
+
});
|
|
1647
|
+
}
|
|
1648
|
+
if (def.protocol && !urlProtocolOk(url, def.protocol)) {
|
|
1649
|
+
payload.issues.push({
|
|
1650
|
+
code: "invalid_format",
|
|
1651
|
+
format: "url",
|
|
1652
|
+
note: "Invalid protocol",
|
|
1653
|
+
pattern: def.protocol.source,
|
|
1654
|
+
input: payload.value,
|
|
1655
|
+
inst,
|
|
1656
|
+
continue: !def.abort
|
|
1657
|
+
});
|
|
1349
1658
|
}
|
|
1659
|
+
payload.value = def.normalize ? url.href : stripTabAndNewline(trimmed);
|
|
1350
1660
|
return;
|
|
1351
1661
|
} catch (_) {
|
|
1352
1662
|
payload.issues.push({
|
|
@@ -1364,7 +1674,9 @@ var $ZodEmoji = /* @__PURE__ */ $constructor("$ZodEmoji", (inst, def) => {
|
|
|
1364
1674
|
$ZodStringFormat.init(inst, def);
|
|
1365
1675
|
});
|
|
1366
1676
|
var $ZodNanoID = /* @__PURE__ */ $constructor("$ZodNanoID", (inst, def) => {
|
|
1367
|
-
def.
|
|
1677
|
+
if (def.length !== undefined && (!Number.isInteger(def.length) || def.length < 1))
|
|
1678
|
+
throw new Error(`Invalid nanoid length: ${def.length}`);
|
|
1679
|
+
def.pattern ?? (def.pattern = def.length === undefined ? nanoid : nanoidOfLength(def.length));
|
|
1368
1680
|
$ZodStringFormat.init(inst, def);
|
|
1369
1681
|
});
|
|
1370
1682
|
var $ZodCUID = /* @__PURE__ */ $constructor("$ZodCUID", (inst, def) => {
|
|
@@ -1390,6 +1702,12 @@ var $ZodKSUID = /* @__PURE__ */ $constructor("$ZodKSUID", (inst, def) => {
|
|
|
1390
1702
|
var $ZodISODateTime = /* @__PURE__ */ $constructor("$ZodISODateTime", (inst, def) => {
|
|
1391
1703
|
def.pattern ?? (def.pattern = datetime(def));
|
|
1392
1704
|
$ZodStringFormat.init(inst, def);
|
|
1705
|
+
if (def.local || def.precision === -1) {
|
|
1706
|
+
inst._zod.bag.laxFormat = true;
|
|
1707
|
+
inst._zod.onattach.push((s) => {
|
|
1708
|
+
s._zod.bag.laxFormat = true;
|
|
1709
|
+
});
|
|
1710
|
+
}
|
|
1393
1711
|
});
|
|
1394
1712
|
var $ZodISODate = /* @__PURE__ */ $constructor("$ZodISODate", (inst, def) => {
|
|
1395
1713
|
def.pattern ?? (def.pattern = date);
|
|
@@ -1408,14 +1726,23 @@ var $ZodIPv4 = /* @__PURE__ */ $constructor("$ZodIPv4", (inst, def) => {
|
|
|
1408
1726
|
$ZodStringFormat.init(inst, def);
|
|
1409
1727
|
inst._zod.bag.format = `ipv4`;
|
|
1410
1728
|
});
|
|
1729
|
+
var ipv6Alphabet = /^[0-9a-fA-F:.]+$/;
|
|
1730
|
+
function isValidIPv6(value) {
|
|
1731
|
+
if (!ipv6Alphabet.test(value))
|
|
1732
|
+
return false;
|
|
1733
|
+
try {
|
|
1734
|
+
new URL(`http://[${value}]`);
|
|
1735
|
+
return true;
|
|
1736
|
+
} catch {
|
|
1737
|
+
return false;
|
|
1738
|
+
}
|
|
1739
|
+
}
|
|
1411
1740
|
var $ZodIPv6 = /* @__PURE__ */ $constructor("$ZodIPv6", (inst, def) => {
|
|
1412
1741
|
def.pattern ?? (def.pattern = ipv6);
|
|
1413
1742
|
$ZodStringFormat.init(inst, def);
|
|
1414
1743
|
inst._zod.bag.format = `ipv6`;
|
|
1415
1744
|
inst._zod.check = (payload) => {
|
|
1416
|
-
|
|
1417
|
-
new URL(`http://[${payload.value}]`);
|
|
1418
|
-
} catch {
|
|
1745
|
+
if (!isValidIPv6(payload.value)) {
|
|
1419
1746
|
payload.issues.push({
|
|
1420
1747
|
code: "invalid_format",
|
|
1421
1748
|
format: "ipv6",
|
|
@@ -1430,24 +1757,25 @@ var $ZodCIDRv4 = /* @__PURE__ */ $constructor("$ZodCIDRv4", (inst, def) => {
|
|
|
1430
1757
|
def.pattern ?? (def.pattern = cidrv4);
|
|
1431
1758
|
$ZodStringFormat.init(inst, def);
|
|
1432
1759
|
});
|
|
1760
|
+
function isValidCIDRv6(value) {
|
|
1761
|
+
const parts = value.split("/");
|
|
1762
|
+
if (parts.length !== 2)
|
|
1763
|
+
return false;
|
|
1764
|
+
const [address, prefix] = parts;
|
|
1765
|
+
if (!prefix)
|
|
1766
|
+
return false;
|
|
1767
|
+
const prefixNum = Number(prefix);
|
|
1768
|
+
if (`${prefixNum}` !== prefix)
|
|
1769
|
+
return false;
|
|
1770
|
+
if (prefixNum < 0 || prefixNum > 128)
|
|
1771
|
+
return false;
|
|
1772
|
+
return isValidIPv6(address);
|
|
1773
|
+
}
|
|
1433
1774
|
var $ZodCIDRv6 = /* @__PURE__ */ $constructor("$ZodCIDRv6", (inst, def) => {
|
|
1434
1775
|
def.pattern ?? (def.pattern = cidrv6);
|
|
1435
1776
|
$ZodStringFormat.init(inst, def);
|
|
1436
1777
|
inst._zod.check = (payload) => {
|
|
1437
|
-
|
|
1438
|
-
try {
|
|
1439
|
-
if (parts.length !== 2)
|
|
1440
|
-
throw new Error;
|
|
1441
|
-
const [address, prefix] = parts;
|
|
1442
|
-
if (!prefix)
|
|
1443
|
-
throw new Error;
|
|
1444
|
-
const prefixNum = Number(prefix);
|
|
1445
|
-
if (`${prefixNum}` !== prefix)
|
|
1446
|
-
throw new Error;
|
|
1447
|
-
if (prefixNum < 0 || prefixNum > 128)
|
|
1448
|
-
throw new Error;
|
|
1449
|
-
new URL(`http://[${address}]`);
|
|
1450
|
-
} catch {
|
|
1778
|
+
if (!isValidCIDRv6(payload.value)) {
|
|
1451
1779
|
payload.issues.push({
|
|
1452
1780
|
code: "invalid_format",
|
|
1453
1781
|
format: "cidrv6",
|
|
@@ -1461,6 +1789,8 @@ var $ZodCIDRv6 = /* @__PURE__ */ $constructor("$ZodCIDRv6", (inst, def) => {
|
|
|
1461
1789
|
function isValidBase64(data) {
|
|
1462
1790
|
if (data === "")
|
|
1463
1791
|
return true;
|
|
1792
|
+
if (/\s/.test(data))
|
|
1793
|
+
return false;
|
|
1464
1794
|
if (data.length % 4 !== 0)
|
|
1465
1795
|
return false;
|
|
1466
1796
|
try {
|
|
@@ -1559,7 +1889,7 @@ var $ZodNumber = /* @__PURE__ */ $constructor("$ZodNumber", (inst, def) => {
|
|
|
1559
1889
|
if (typeof input === "number" && !Number.isNaN(input) && Number.isFinite(input)) {
|
|
1560
1890
|
return payload;
|
|
1561
1891
|
}
|
|
1562
|
-
const received = typeof input === "number" ? Number.isNaN(input) ? "NaN" : !Number.isFinite(input) ?
|
|
1892
|
+
const received = typeof input === "number" ? Number.isNaN(input) ? "NaN" : !Number.isFinite(input) ? String(input) : undefined : undefined;
|
|
1563
1893
|
payload.issues.push({
|
|
1564
1894
|
expected: "number",
|
|
1565
1895
|
code: "invalid_type",
|
|
@@ -1677,6 +2007,8 @@ function handleArrayResult(result, final, index) {
|
|
|
1677
2007
|
}
|
|
1678
2008
|
var $ZodArray = /* @__PURE__ */ $constructor("$ZodArray", (inst, def) => {
|
|
1679
2009
|
$ZodType.init(inst, def);
|
|
2010
|
+
const memo = globalConfig.memoizer;
|
|
2011
|
+
memo?.attach(inst);
|
|
1680
2012
|
inst._zod.parse = (payload, ctx) => {
|
|
1681
2013
|
const input = payload.value;
|
|
1682
2014
|
if (!Array.isArray(input)) {
|
|
@@ -1688,7 +2020,7 @@ var $ZodArray = /* @__PURE__ */ $constructor("$ZodArray", (inst, def) => {
|
|
|
1688
2020
|
});
|
|
1689
2021
|
return payload;
|
|
1690
2022
|
}
|
|
1691
|
-
payload.value = Array(input.length);
|
|
2023
|
+
payload.value = memo ? memo.alloc(inst, payload, Array(input.length), ctx) : Array(input.length);
|
|
1692
2024
|
const proms = [];
|
|
1693
2025
|
for (let i = 0;i < input.length; i++) {
|
|
1694
2026
|
const item = input[i];
|
|
@@ -1708,32 +2040,53 @@ var $ZodArray = /* @__PURE__ */ $constructor("$ZodArray", (inst, def) => {
|
|
|
1708
2040
|
return payload;
|
|
1709
2041
|
};
|
|
1710
2042
|
});
|
|
1711
|
-
function handlePropertyResult(result, final, key, input,
|
|
2043
|
+
function handlePropertyResult(result, final, key, input, optin, optout) {
|
|
2044
|
+
const isPresent = key in input;
|
|
2045
|
+
const isOptionalOut = optout === "optional";
|
|
2046
|
+
if (!isPresent && isOptionalOut && optin === "optional") {
|
|
2047
|
+
return;
|
|
2048
|
+
}
|
|
1712
2049
|
if (result.issues.length) {
|
|
1713
|
-
if (isOptionalOut && !
|
|
2050
|
+
if (optin !== undefined && isOptionalOut && !isPresent) {
|
|
1714
2051
|
return;
|
|
1715
2052
|
}
|
|
1716
2053
|
final.issues.push(...prefixIssues(key, result.issues));
|
|
1717
2054
|
}
|
|
2055
|
+
if (!isPresent && optin === undefined) {
|
|
2056
|
+
if (!result.issues.length) {
|
|
2057
|
+
final.issues.push({
|
|
2058
|
+
code: "invalid_type",
|
|
2059
|
+
expected: "nonoptional",
|
|
2060
|
+
input: undefined,
|
|
2061
|
+
path: [key]
|
|
2062
|
+
});
|
|
2063
|
+
}
|
|
2064
|
+
return;
|
|
2065
|
+
}
|
|
1718
2066
|
if (result.value === undefined) {
|
|
1719
|
-
if (
|
|
2067
|
+
if (isPresent) {
|
|
1720
2068
|
final.value[key] = undefined;
|
|
1721
2069
|
}
|
|
1722
2070
|
} else {
|
|
1723
2071
|
final.value[key] = result.value;
|
|
1724
2072
|
}
|
|
1725
2073
|
}
|
|
2074
|
+
var NO_SYMBOL_KEYS = [];
|
|
1726
2075
|
function normalizeDef(def) {
|
|
1727
2076
|
const keys = Object.keys(def.shape);
|
|
1728
|
-
|
|
2077
|
+
const ownSymbols = Object.getOwnPropertySymbols(def.shape);
|
|
2078
|
+
const symbolKeys = ownSymbols.length ? ownSymbols : NO_SYMBOL_KEYS;
|
|
2079
|
+
const allKeys = symbolKeys.length ? [...keys, ...symbolKeys] : keys;
|
|
2080
|
+
for (const k of allKeys) {
|
|
1729
2081
|
if (!def.shape?.[k]?._zod?.traits?.has("$ZodType")) {
|
|
1730
|
-
throw new Error(`Invalid element at key "${k}": expected a Zod schema`);
|
|
2082
|
+
throw new Error(`Invalid element at key "${String(k)}": expected a Zod schema`);
|
|
1731
2083
|
}
|
|
1732
2084
|
}
|
|
1733
2085
|
const okeys = optionalKeys(def.shape);
|
|
1734
2086
|
return {
|
|
1735
2087
|
...def,
|
|
1736
|
-
|
|
2088
|
+
allKeys,
|
|
2089
|
+
symbolKeys,
|
|
1737
2090
|
keySet: new Set(keys),
|
|
1738
2091
|
numKeys: keys.length,
|
|
1739
2092
|
optionalKeys: new Set(okeys)
|
|
@@ -1744,19 +2097,25 @@ function handleCatchall(proms, input, payload, ctx, def, inst) {
|
|
|
1744
2097
|
const keySet = def.keySet;
|
|
1745
2098
|
const _catchall = def.catchall._zod;
|
|
1746
2099
|
const t = _catchall.def.type;
|
|
1747
|
-
const
|
|
2100
|
+
const optin = _catchall.optin;
|
|
2101
|
+
const optout = _catchall.optout;
|
|
1748
2102
|
for (const key in input) {
|
|
1749
2103
|
if (keySet.has(key))
|
|
1750
2104
|
continue;
|
|
2105
|
+
if (key === "__proto__") {
|
|
2106
|
+
if (t === "never")
|
|
2107
|
+
unrecognized.push(key);
|
|
2108
|
+
continue;
|
|
2109
|
+
}
|
|
1751
2110
|
if (t === "never") {
|
|
1752
2111
|
unrecognized.push(key);
|
|
1753
2112
|
continue;
|
|
1754
2113
|
}
|
|
1755
2114
|
const r = _catchall.run({ value: input[key], issues: [] }, ctx);
|
|
1756
2115
|
if (r instanceof Promise) {
|
|
1757
|
-
proms.push(r.then((r) => handlePropertyResult(r, payload, key, input,
|
|
2116
|
+
proms.push(r.then((r) => handlePropertyResult(r, payload, key, input, optin, optout)));
|
|
1758
2117
|
} else {
|
|
1759
|
-
handlePropertyResult(r, payload, key, input,
|
|
2118
|
+
handlePropertyResult(r, payload, key, input, optin, optout);
|
|
1760
2119
|
}
|
|
1761
2120
|
}
|
|
1762
2121
|
if (unrecognized.length) {
|
|
@@ -1764,7 +2123,8 @@ function handleCatchall(proms, input, payload, ctx, def, inst) {
|
|
|
1764
2123
|
code: "unrecognized_keys",
|
|
1765
2124
|
keys: unrecognized,
|
|
1766
2125
|
input,
|
|
1767
|
-
inst
|
|
2126
|
+
inst,
|
|
2127
|
+
continue: true
|
|
1768
2128
|
});
|
|
1769
2129
|
}
|
|
1770
2130
|
if (!proms.length)
|
|
@@ -1773,31 +2133,38 @@ function handleCatchall(proms, input, payload, ctx, def, inst) {
|
|
|
1773
2133
|
return payload;
|
|
1774
2134
|
});
|
|
1775
2135
|
}
|
|
2136
|
+
var propShapes = new WeakMap;
|
|
1776
2137
|
var $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
|
|
1777
2138
|
$ZodType.init(inst, def);
|
|
1778
2139
|
const desc = Object.getOwnPropertyDescriptor(def, "shape");
|
|
1779
2140
|
if (!desc?.get) {
|
|
1780
2141
|
const sh = def.shape;
|
|
2142
|
+
propShapes.set(def, sh);
|
|
1781
2143
|
Object.defineProperty(def, "shape", {
|
|
1782
2144
|
get: () => {
|
|
1783
2145
|
const newSh = { ...sh };
|
|
1784
2146
|
Object.defineProperty(def, "shape", {
|
|
1785
2147
|
value: newSh
|
|
1786
2148
|
});
|
|
2149
|
+
propShapes.set(def, newSh);
|
|
1787
2150
|
return newSh;
|
|
1788
2151
|
}
|
|
1789
2152
|
});
|
|
1790
2153
|
}
|
|
1791
2154
|
const _normalized = cached(() => normalizeDef(def));
|
|
1792
|
-
|
|
1793
|
-
const shape = def.shape;
|
|
2155
|
+
defineLazyInternal(inst, "propValues", (zod) => {
|
|
2156
|
+
const shape = zod.def.shape;
|
|
1794
2157
|
const propValues = {};
|
|
1795
2158
|
for (const key in shape) {
|
|
1796
2159
|
const field = shape[key]._zod;
|
|
1797
2160
|
if (field.values) {
|
|
1798
|
-
|
|
2161
|
+
if (!Object.prototype.hasOwnProperty.call(propValues, key)) {
|
|
2162
|
+
assignProp(propValues, key, new Set);
|
|
2163
|
+
}
|
|
1799
2164
|
for (const v of field.values)
|
|
1800
2165
|
propValues[key].add(v);
|
|
2166
|
+
if (field.optin !== undefined)
|
|
2167
|
+
propValues[key].add(undefined);
|
|
1801
2168
|
}
|
|
1802
2169
|
}
|
|
1803
2170
|
return propValues;
|
|
@@ -1805,6 +2172,8 @@ var $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
|
|
|
1805
2172
|
const isObject2 = isObject;
|
|
1806
2173
|
const catchall = def.catchall;
|
|
1807
2174
|
let value;
|
|
2175
|
+
const memo = globalConfig.memoizer;
|
|
2176
|
+
memo?.attach(inst);
|
|
1808
2177
|
inst._zod.parse = (payload, ctx) => {
|
|
1809
2178
|
value ?? (value = _normalized.value);
|
|
1810
2179
|
const input = payload.value;
|
|
@@ -1817,17 +2186,20 @@ var $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
|
|
|
1817
2186
|
});
|
|
1818
2187
|
return payload;
|
|
1819
2188
|
}
|
|
1820
|
-
payload.value = {};
|
|
2189
|
+
payload.value = memo ? memo.alloc(inst, payload, {}, ctx) : {};
|
|
1821
2190
|
const proms = [];
|
|
1822
2191
|
const shape = value.shape;
|
|
1823
|
-
for (const key of value.
|
|
2192
|
+
for (const key of value.allKeys) {
|
|
2193
|
+
if (key === "__proto__")
|
|
2194
|
+
continue;
|
|
1824
2195
|
const el = shape[key];
|
|
1825
|
-
const
|
|
2196
|
+
const optin = el._zod.optin;
|
|
2197
|
+
const optout = el._zod.optout;
|
|
1826
2198
|
const r = el._zod.run({ value: input[key], issues: [] }, ctx);
|
|
1827
2199
|
if (r instanceof Promise) {
|
|
1828
|
-
proms.push(r.then((r) => handlePropertyResult(r, payload, key, input,
|
|
2200
|
+
proms.push(r.then((r) => handlePropertyResult(r, payload, key, input, optin, optout)));
|
|
1829
2201
|
} else {
|
|
1830
|
-
handlePropertyResult(r, payload, key, input,
|
|
2202
|
+
handlePropertyResult(r, payload, key, input, optin, optout);
|
|
1831
2203
|
}
|
|
1832
2204
|
}
|
|
1833
2205
|
if (!catchall) {
|
|
@@ -1840,70 +2212,88 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
|
|
|
1840
2212
|
$ZodObject.init(inst, def);
|
|
1841
2213
|
const superParse = inst._zod.parse;
|
|
1842
2214
|
const _normalized = cached(() => normalizeDef(def));
|
|
2215
|
+
const memo = globalConfig.memoizer;
|
|
1843
2216
|
const generateFastpass = (shape) => {
|
|
1844
|
-
const doc = new Doc(["shape", "payload", "ctx"]);
|
|
1845
2217
|
const normalized = _normalized.value;
|
|
1846
|
-
const
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
2218
|
+
const syms = normalized.symbolKeys;
|
|
2219
|
+
const doc = new Doc(["payload", "ctx"], { shape, inst, memo, syms });
|
|
2220
|
+
const parseStr = (k) => `shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`;
|
|
2221
|
+
const prefixStr = (id, k) => `
|
|
2222
|
+
for (let i = 0; i < ${id}.issues.length; i++) {
|
|
2223
|
+
const iss = ${id}.issues[i];
|
|
2224
|
+
iss.path = iss.path ? [${k}, ...iss.path] : [${k}];
|
|
2225
|
+
payload.issues.push(iss);
|
|
2226
|
+
}`;
|
|
1850
2227
|
doc.write(`const input = payload.value;`);
|
|
1851
2228
|
const ids = Object.create(null);
|
|
1852
2229
|
let counter = 0;
|
|
1853
|
-
for (const key of normalized.
|
|
2230
|
+
for (const key of normalized.allKeys) {
|
|
1854
2231
|
ids[key] = `key_${counter++}`;
|
|
1855
2232
|
}
|
|
1856
|
-
doc.write(`const newResult = {};`);
|
|
1857
|
-
for (const key of normalized.
|
|
2233
|
+
doc.write(memo ? `const newResult = memo.alloc(inst, payload, {}, ctx);` : `const newResult = {};`);
|
|
2234
|
+
for (const key of normalized.allKeys) {
|
|
2235
|
+
if (key === "__proto__")
|
|
2236
|
+
continue;
|
|
1858
2237
|
const id = ids[key];
|
|
1859
|
-
const k = esc(key);
|
|
2238
|
+
const k = typeof key === "symbol" ? `syms[${syms.indexOf(key)}]` : esc(key);
|
|
2239
|
+
const isPresent = `${k} in input`;
|
|
1860
2240
|
const schema = shape[key];
|
|
2241
|
+
const optin = schema?._zod?.optin;
|
|
2242
|
+
const isOptionalIn = optin !== undefined;
|
|
1861
2243
|
const isOptionalOut = schema?._zod?.optout === "optional";
|
|
1862
|
-
doc.write(`const ${id} = ${parseStr(
|
|
1863
|
-
if (isOptionalOut) {
|
|
2244
|
+
doc.write(`const ${id} = ${parseStr(k)};`);
|
|
2245
|
+
if (isOptionalIn && isOptionalOut) {
|
|
2246
|
+
const assign = optin === "optional" ? `${id}_present` : `${id}.value !== undefined || ${id}_present`;
|
|
1864
2247
|
doc.write(`
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
...iss,
|
|
1869
|
-
path: iss.path ? [${k}, ...iss.path] : [${k}]
|
|
1870
|
-
})));
|
|
2248
|
+
const ${id}_present = ${isPresent};
|
|
2249
|
+
if (!${id}.issues.length || ${id}_present) {
|
|
2250
|
+
if (${id}.issues.length) {${prefixStr(id, k)}
|
|
1871
2251
|
}
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
if (${k} in input) {
|
|
1876
|
-
newResult[${k}] = undefined;
|
|
2252
|
+
|
|
2253
|
+
if (${assign}) {
|
|
2254
|
+
newResult[${k}] = ${id}.value;
|
|
1877
2255
|
}
|
|
1878
|
-
}
|
|
2256
|
+
}
|
|
2257
|
+
|
|
2258
|
+
`);
|
|
2259
|
+
} else if (!isOptionalIn) {
|
|
2260
|
+
doc.write(`
|
|
2261
|
+
const ${id}_present = ${isPresent};
|
|
2262
|
+
if (${id}.issues.length) {${prefixStr(id, k)}
|
|
2263
|
+
}
|
|
2264
|
+
if (!${id}_present && !${id}.issues.length) {
|
|
2265
|
+
payload.issues.push({
|
|
2266
|
+
code: "invalid_type",
|
|
2267
|
+
expected: "nonoptional",
|
|
2268
|
+
input: undefined,
|
|
2269
|
+
path: [${k}]
|
|
2270
|
+
});
|
|
2271
|
+
}
|
|
2272
|
+
|
|
2273
|
+
if (${id}_present) {
|
|
1879
2274
|
newResult[${k}] = ${id}.value;
|
|
1880
2275
|
}
|
|
1881
|
-
|
|
2276
|
+
|
|
1882
2277
|
`);
|
|
1883
2278
|
} else {
|
|
1884
2279
|
doc.write(`
|
|
1885
|
-
if (${id}.issues.length) {
|
|
1886
|
-
payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
|
|
1887
|
-
...iss,
|
|
1888
|
-
path: iss.path ? [${k}, ...iss.path] : [${k}]
|
|
1889
|
-
})));
|
|
2280
|
+
if (${id}.issues.length) {${prefixStr(id, k)}
|
|
1890
2281
|
}
|
|
1891
2282
|
|
|
1892
2283
|
if (${id}.value === undefined) {
|
|
1893
|
-
if (${
|
|
2284
|
+
if (${isPresent}) {
|
|
1894
2285
|
newResult[${k}] = undefined;
|
|
1895
2286
|
}
|
|
1896
2287
|
} else {
|
|
1897
2288
|
newResult[${k}] = ${id}.value;
|
|
1898
2289
|
}
|
|
1899
|
-
|
|
2290
|
+
|
|
1900
2291
|
`);
|
|
1901
2292
|
}
|
|
1902
2293
|
}
|
|
1903
2294
|
doc.write(`payload.value = newResult;`);
|
|
1904
2295
|
doc.write(`return payload;`);
|
|
1905
|
-
|
|
1906
|
-
return (payload, ctx) => fn(shape, payload, ctx);
|
|
2296
|
+
return doc.compile();
|
|
1907
2297
|
};
|
|
1908
2298
|
let fastpass;
|
|
1909
2299
|
const isObject2 = isObject;
|
|
@@ -1957,25 +2347,24 @@ function handleUnionResults(results, final, inst, ctx) {
|
|
|
1957
2347
|
}
|
|
1958
2348
|
var $ZodUnion = /* @__PURE__ */ $constructor("$ZodUnion", (inst, def) => {
|
|
1959
2349
|
$ZodType.init(inst, def);
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
if (def.options.every((o) => o._zod.values)) {
|
|
1964
|
-
return new Set(def.options.flatMap((option) => Array.from(option._zod.values)));
|
|
2350
|
+
defineLazyInternal(inst, "optin", (zod) => zod.def.options.some((o) => o._zod.optin === "defaulted") ? "defaulted" : zod.def.options.some((o) => o._zod.optin !== undefined) ? "optional" : undefined);
|
|
2351
|
+
defineLazyInternal(inst, "optout", (zod) => zod.def.options.some((o) => o._zod.optout === "optional") ? "optional" : undefined);
|
|
2352
|
+
defineLazyInternal(inst, "values", (zod) => {
|
|
2353
|
+
if (zod.def.options.every((o) => o._zod.values)) {
|
|
2354
|
+
return new Set(zod.def.options.flatMap((option) => Array.from(option._zod.values)));
|
|
1965
2355
|
}
|
|
1966
2356
|
return;
|
|
1967
2357
|
});
|
|
1968
|
-
|
|
1969
|
-
if (def.options.every((o) => o._zod.pattern)) {
|
|
1970
|
-
const patterns = def.options.map((o) => o._zod.pattern);
|
|
2358
|
+
defineLazyInternal(inst, "pattern", (zod) => {
|
|
2359
|
+
if (zod.def.options.every((o) => o._zod.pattern)) {
|
|
2360
|
+
const patterns = zod.def.options.map((o) => o._zod.pattern);
|
|
1971
2361
|
return new RegExp(`^(${patterns.map((p) => cleanRegex(p.source)).join("|")})$`);
|
|
1972
2362
|
}
|
|
1973
2363
|
return;
|
|
1974
2364
|
});
|
|
1975
|
-
const
|
|
1976
|
-
const first = def.options[0]._zod.run;
|
|
2365
|
+
const first = def.options.length === 1 ? def.options[0]._zod.run : null;
|
|
1977
2366
|
inst._zod.parse = (payload, ctx) => {
|
|
1978
|
-
if (
|
|
2367
|
+
if (first) {
|
|
1979
2368
|
return first(payload, ctx);
|
|
1980
2369
|
}
|
|
1981
2370
|
let async = false;
|
|
@@ -2005,15 +2394,16 @@ var $ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("$ZodDiscriminatedUnio
|
|
|
2005
2394
|
def.inclusive = false;
|
|
2006
2395
|
$ZodUnion.init(inst, def);
|
|
2007
2396
|
const _super = inst._zod.parse;
|
|
2008
|
-
|
|
2397
|
+
defineLazyInternal(inst, "propValues", (zod) => {
|
|
2009
2398
|
const propValues = {};
|
|
2010
|
-
for (const option of def.options) {
|
|
2399
|
+
for (const option of zod.def.options) {
|
|
2011
2400
|
const pv = option._zod.propValues;
|
|
2012
2401
|
if (!pv || Object.keys(pv).length === 0)
|
|
2013
|
-
throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(option)}"`);
|
|
2402
|
+
throw new Error(`Invalid discriminated union option at index "${zod.def.options.indexOf(option)}"`);
|
|
2014
2403
|
for (const [k, v] of Object.entries(pv)) {
|
|
2015
|
-
if (!propValues
|
|
2016
|
-
propValues
|
|
2404
|
+
if (!Object.prototype.hasOwnProperty.call(propValues, k)) {
|
|
2405
|
+
assignProp(propValues, k, new Set);
|
|
2406
|
+
}
|
|
2017
2407
|
for (const val of v) {
|
|
2018
2408
|
propValues[k].add(val);
|
|
2019
2409
|
}
|
|
@@ -2021,6 +2411,12 @@ var $ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("$ZodDiscriminatedUnio
|
|
|
2021
2411
|
}
|
|
2022
2412
|
return propValues;
|
|
2023
2413
|
});
|
|
2414
|
+
def.options.forEach((option, i) => {
|
|
2415
|
+
const propShape = propShapes.get(option._zod.def);
|
|
2416
|
+
if (propShape && !Object.prototype.hasOwnProperty.call(propShape, def.discriminator)) {
|
|
2417
|
+
throw new Error(`Invalid discriminated union option at index "${i}"`);
|
|
2418
|
+
}
|
|
2419
|
+
});
|
|
2024
2420
|
const disc = cached(() => {
|
|
2025
2421
|
const opts = def.options;
|
|
2026
2422
|
const map = new Map;
|
|
@@ -2052,7 +2448,7 @@ var $ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("$ZodDiscriminatedUnio
|
|
|
2052
2448
|
if (opt) {
|
|
2053
2449
|
return opt._zod.run(payload, ctx);
|
|
2054
2450
|
}
|
|
2055
|
-
if (def.unionFallback) {
|
|
2451
|
+
if (def.unionFallback || ctx.direction === "backward") {
|
|
2056
2452
|
return _super(payload, ctx);
|
|
2057
2453
|
}
|
|
2058
2454
|
payload.issues.push({
|
|
@@ -2060,6 +2456,7 @@ var $ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("$ZodDiscriminatedUnio
|
|
|
2060
2456
|
errors: [],
|
|
2061
2457
|
note: "No matching discriminator",
|
|
2062
2458
|
discriminator: def.discriminator,
|
|
2459
|
+
options: Array.from(disc.value.keys()),
|
|
2063
2460
|
input,
|
|
2064
2461
|
path: [def.discriminator],
|
|
2065
2462
|
inst
|
|
@@ -2093,7 +2490,11 @@ function mergeValues(a, b) {
|
|
|
2093
2490
|
const bKeys = Object.keys(b);
|
|
2094
2491
|
const sharedKeys = Object.keys(a).filter((key) => bKeys.indexOf(key) !== -1);
|
|
2095
2492
|
const newObj = { ...a, ...b };
|
|
2493
|
+
if (Object.prototype.hasOwnProperty.call(newObj, "__proto__"))
|
|
2494
|
+
delete newObj.__proto__;
|
|
2096
2495
|
for (const key of sharedKeys) {
|
|
2496
|
+
if (key === "__proto__")
|
|
2497
|
+
continue;
|
|
2097
2498
|
const sharedValue = mergeValues(a[key], b[key]);
|
|
2098
2499
|
if (!sharedValue.valid) {
|
|
2099
2500
|
return {
|
|
@@ -2129,37 +2530,49 @@ function mergeValues(a, b) {
|
|
|
2129
2530
|
function handleIntersectionResults(result, left, right) {
|
|
2130
2531
|
const unrecKeys = new Map;
|
|
2131
2532
|
let unrecIssue;
|
|
2132
|
-
|
|
2133
|
-
|
|
2533
|
+
const keyIssues = new Map;
|
|
2534
|
+
const collect = (iss, side) => {
|
|
2535
|
+
let keys;
|
|
2536
|
+
if (iss.code === "unrecognized_keys" && !iss.path?.length) {
|
|
2134
2537
|
unrecIssue ?? (unrecIssue = iss);
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2538
|
+
keys = iss.keys;
|
|
2539
|
+
} else if (iss.code === "invalid_key" && iss.origin === "record" && iss.path?.length === 1) {
|
|
2540
|
+
const k = String(iss.path[0]);
|
|
2541
|
+
if (!keyIssues.has(k))
|
|
2542
|
+
keyIssues.set(k, iss);
|
|
2543
|
+
keys = [k];
|
|
2140
2544
|
} else {
|
|
2141
|
-
|
|
2545
|
+
return false;
|
|
2142
2546
|
}
|
|
2547
|
+
for (const k of keys) {
|
|
2548
|
+
if (!unrecKeys.has(k))
|
|
2549
|
+
unrecKeys.set(k, {});
|
|
2550
|
+
unrecKeys.get(k)[side] = true;
|
|
2551
|
+
}
|
|
2552
|
+
return true;
|
|
2553
|
+
};
|
|
2554
|
+
for (const iss of left.issues) {
|
|
2555
|
+
if (!collect(iss, "l"))
|
|
2556
|
+
result.issues.push(iss);
|
|
2143
2557
|
}
|
|
2144
2558
|
for (const iss of right.issues) {
|
|
2145
|
-
if (iss
|
|
2146
|
-
for (const k of iss.keys) {
|
|
2147
|
-
if (!unrecKeys.has(k))
|
|
2148
|
-
unrecKeys.set(k, {});
|
|
2149
|
-
unrecKeys.get(k).r = true;
|
|
2150
|
-
}
|
|
2151
|
-
} else {
|
|
2559
|
+
if (!collect(iss, "r"))
|
|
2152
2560
|
result.issues.push(iss);
|
|
2153
|
-
}
|
|
2154
2561
|
}
|
|
2155
2562
|
const bothKeys = [...unrecKeys].filter(([, f]) => f.l && f.r).map(([k]) => k);
|
|
2156
|
-
if (bothKeys.length
|
|
2157
|
-
|
|
2563
|
+
if (bothKeys.length) {
|
|
2564
|
+
const aggregated = unrecIssue ? bothKeys.filter((k) => unrecIssue.keys.includes(k)) : [];
|
|
2565
|
+
if (aggregated.length)
|
|
2566
|
+
result.issues.push({ ...unrecIssue, keys: aggregated });
|
|
2567
|
+
for (const k of bothKeys) {
|
|
2568
|
+
if (!aggregated.includes(k) && keyIssues.has(k))
|
|
2569
|
+
result.issues.push(keyIssues.get(k));
|
|
2570
|
+
}
|
|
2158
2571
|
}
|
|
2159
|
-
if (aborted(result))
|
|
2160
|
-
return result;
|
|
2161
2572
|
const merged = mergeValues(left.value, right.value);
|
|
2162
2573
|
if (!merged.valid) {
|
|
2574
|
+
if (aborted(result))
|
|
2575
|
+
return result;
|
|
2163
2576
|
throw new Error(`Unmergable intersection. Error path: ` + `${JSON.stringify(merged.mergeErrorPath)}`);
|
|
2164
2577
|
}
|
|
2165
2578
|
result.value = merged.data;
|
|
@@ -2168,6 +2581,8 @@ function handleIntersectionResults(result, left, right) {
|
|
|
2168
2581
|
var $ZodTuple = /* @__PURE__ */ $constructor("$ZodTuple", (inst, def) => {
|
|
2169
2582
|
$ZodType.init(inst, def);
|
|
2170
2583
|
const items = def.items;
|
|
2584
|
+
const memo = globalConfig.memoizer;
|
|
2585
|
+
memo?.attach(inst);
|
|
2171
2586
|
inst._zod.parse = (payload, ctx) => {
|
|
2172
2587
|
const input = payload.value;
|
|
2173
2588
|
if (!Array.isArray(input)) {
|
|
@@ -2179,68 +2594,107 @@ var $ZodTuple = /* @__PURE__ */ $constructor("$ZodTuple", (inst, def) => {
|
|
|
2179
2594
|
});
|
|
2180
2595
|
return payload;
|
|
2181
2596
|
}
|
|
2182
|
-
payload.value = [];
|
|
2597
|
+
payload.value = memo ? memo.alloc(inst, payload, [], ctx) : [];
|
|
2183
2598
|
const proms = [];
|
|
2184
|
-
const
|
|
2185
|
-
const
|
|
2599
|
+
const optinStart = getTupleOptStart(items, "optin");
|
|
2600
|
+
const optoutStart = getTupleOptStart(items, "optout");
|
|
2186
2601
|
if (!def.rest) {
|
|
2187
|
-
|
|
2188
|
-
const tooSmall = input.length < optStart - 1;
|
|
2189
|
-
if (tooBig || tooSmall) {
|
|
2602
|
+
if (input.length < optinStart) {
|
|
2190
2603
|
payload.issues.push({
|
|
2191
|
-
|
|
2604
|
+
code: "too_small",
|
|
2605
|
+
minimum: optinStart,
|
|
2606
|
+
inclusive: true,
|
|
2192
2607
|
input,
|
|
2193
2608
|
inst,
|
|
2194
2609
|
origin: "array"
|
|
2195
2610
|
});
|
|
2196
2611
|
return payload;
|
|
2197
2612
|
}
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2613
|
+
if (input.length > items.length) {
|
|
2614
|
+
payload.issues.push({
|
|
2615
|
+
code: "too_big",
|
|
2616
|
+
maximum: items.length,
|
|
2617
|
+
inclusive: true,
|
|
2618
|
+
input,
|
|
2619
|
+
inst,
|
|
2620
|
+
origin: "array"
|
|
2621
|
+
});
|
|
2205
2622
|
}
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
}, ctx);
|
|
2210
|
-
if (
|
|
2211
|
-
proms.push(
|
|
2623
|
+
}
|
|
2624
|
+
const itemResults = new Array(items.length);
|
|
2625
|
+
for (let i = 0;i < items.length; i++) {
|
|
2626
|
+
const r = items[i]._zod.run({ value: input[i], issues: [] }, ctx);
|
|
2627
|
+
if (r instanceof Promise) {
|
|
2628
|
+
proms.push(r.then((rr) => {
|
|
2629
|
+
itemResults[i] = rr;
|
|
2630
|
+
}));
|
|
2212
2631
|
} else {
|
|
2213
|
-
|
|
2632
|
+
itemResults[i] = r;
|
|
2214
2633
|
}
|
|
2215
2634
|
}
|
|
2216
2635
|
if (def.rest) {
|
|
2636
|
+
let i = items.length - 1;
|
|
2217
2637
|
const rest = input.slice(items.length);
|
|
2218
2638
|
for (const el of rest) {
|
|
2219
2639
|
i++;
|
|
2220
|
-
const result = def.rest._zod.run({
|
|
2221
|
-
value: el,
|
|
2222
|
-
issues: []
|
|
2223
|
-
}, ctx);
|
|
2640
|
+
const result = def.rest._zod.run({ value: el, issues: [] }, ctx);
|
|
2224
2641
|
if (result instanceof Promise) {
|
|
2225
|
-
proms.push(result.then((
|
|
2642
|
+
proms.push(result.then((r) => handleTupleResult(r, payload, i)));
|
|
2226
2643
|
} else {
|
|
2227
2644
|
handleTupleResult(result, payload, i);
|
|
2228
2645
|
}
|
|
2229
2646
|
}
|
|
2230
2647
|
}
|
|
2231
|
-
if (proms.length)
|
|
2232
|
-
return Promise.all(proms).then(() => payload);
|
|
2233
|
-
|
|
2648
|
+
if (proms.length) {
|
|
2649
|
+
return Promise.all(proms).then(() => handleTupleResults(itemResults, payload, items, input, optoutStart));
|
|
2650
|
+
}
|
|
2651
|
+
return handleTupleResults(itemResults, payload, items, input, optoutStart);
|
|
2234
2652
|
};
|
|
2235
2653
|
});
|
|
2654
|
+
function getTupleOptStart(items, key) {
|
|
2655
|
+
for (let i = items.length - 1;i >= 0; i--) {
|
|
2656
|
+
const omittable = key === "optin" ? items[i]._zod.optin !== undefined : items[i]._zod.optout === "optional";
|
|
2657
|
+
if (!omittable)
|
|
2658
|
+
return i + 1;
|
|
2659
|
+
}
|
|
2660
|
+
return 0;
|
|
2661
|
+
}
|
|
2236
2662
|
function handleTupleResult(result, final, index) {
|
|
2237
2663
|
if (result.issues.length) {
|
|
2238
2664
|
final.issues.push(...prefixIssues(index, result.issues));
|
|
2239
2665
|
}
|
|
2240
2666
|
final.value[index] = result.value;
|
|
2241
2667
|
}
|
|
2668
|
+
function handleTupleResults(itemResults, final, items, input, optoutStart) {
|
|
2669
|
+
for (let i = 0;i < items.length; i++) {
|
|
2670
|
+
const r = itemResults[i];
|
|
2671
|
+
const isPresent = i < input.length;
|
|
2672
|
+
if (!isPresent && i >= optoutStart && items[i]._zod.optin === "optional") {
|
|
2673
|
+
final.value.length = i;
|
|
2674
|
+
break;
|
|
2675
|
+
}
|
|
2676
|
+
if (r.issues.length) {
|
|
2677
|
+
if (!isPresent && i >= optoutStart) {
|
|
2678
|
+
final.value.length = i;
|
|
2679
|
+
break;
|
|
2680
|
+
}
|
|
2681
|
+
final.issues.push(...prefixIssues(i, r.issues));
|
|
2682
|
+
}
|
|
2683
|
+
final.value[i] = r.value;
|
|
2684
|
+
}
|
|
2685
|
+
for (let i = final.value.length - 1;i >= input.length; i--) {
|
|
2686
|
+
if (items[i]._zod.optout === "optional" && final.value[i] === undefined) {
|
|
2687
|
+
final.value.length = i;
|
|
2688
|
+
} else {
|
|
2689
|
+
break;
|
|
2690
|
+
}
|
|
2691
|
+
}
|
|
2692
|
+
return final;
|
|
2693
|
+
}
|
|
2242
2694
|
var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
|
|
2243
2695
|
$ZodType.init(inst, def);
|
|
2696
|
+
const memo = globalConfig.memoizer;
|
|
2697
|
+
memo?.attach(inst);
|
|
2244
2698
|
inst._zod.parse = (payload, ctx) => {
|
|
2245
2699
|
const input = payload.value;
|
|
2246
2700
|
if (!isPlainObject(input)) {
|
|
@@ -2254,33 +2708,59 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
|
|
|
2254
2708
|
}
|
|
2255
2709
|
const proms = [];
|
|
2256
2710
|
const values = def.keyType._zod.values;
|
|
2257
|
-
if (values) {
|
|
2258
|
-
payload.value = {};
|
|
2711
|
+
if (values && !def.partial) {
|
|
2712
|
+
payload.value = memo ? memo.alloc(inst, payload, {}, ctx) : {};
|
|
2259
2713
|
const recordKeys = new Set;
|
|
2260
2714
|
for (const key of values) {
|
|
2261
2715
|
if (typeof key === "string" || typeof key === "number" || typeof key === "symbol") {
|
|
2262
2716
|
recordKeys.add(typeof key === "number" ? key.toString() : key);
|
|
2717
|
+
if (key === "__proto__")
|
|
2718
|
+
continue;
|
|
2719
|
+
const keyResult = def.keyType._zod.run({ value: key, issues: [] }, ctx);
|
|
2720
|
+
if (keyResult instanceof Promise) {
|
|
2721
|
+
throw new Error("Async schemas not supported in object keys currently");
|
|
2722
|
+
}
|
|
2723
|
+
if (keyResult.issues.length) {
|
|
2724
|
+
payload.issues.push({
|
|
2725
|
+
code: "invalid_key",
|
|
2726
|
+
origin: "record",
|
|
2727
|
+
issues: keyResult.issues.map((iss) => finalizeIssue(iss, ctx, config())),
|
|
2728
|
+
input: key,
|
|
2729
|
+
path: [key],
|
|
2730
|
+
inst
|
|
2731
|
+
});
|
|
2732
|
+
continue;
|
|
2733
|
+
}
|
|
2734
|
+
const outKey = keyResult.value;
|
|
2735
|
+
if (outKey === "__proto__")
|
|
2736
|
+
continue;
|
|
2263
2737
|
const result = def.valueType._zod.run({ value: input[key], issues: [] }, ctx);
|
|
2264
2738
|
if (result instanceof Promise) {
|
|
2265
2739
|
proms.push(result.then((result) => {
|
|
2266
2740
|
if (result.issues.length) {
|
|
2267
2741
|
payload.issues.push(...prefixIssues(key, result.issues));
|
|
2268
2742
|
}
|
|
2269
|
-
payload.value[
|
|
2743
|
+
payload.value[outKey] = result.value;
|
|
2270
2744
|
}));
|
|
2271
2745
|
} else {
|
|
2272
2746
|
if (result.issues.length) {
|
|
2273
2747
|
payload.issues.push(...prefixIssues(key, result.issues));
|
|
2274
2748
|
}
|
|
2275
|
-
payload.value[
|
|
2749
|
+
payload.value[outKey] = result.value;
|
|
2276
2750
|
}
|
|
2277
2751
|
}
|
|
2278
2752
|
}
|
|
2279
2753
|
let unrecognized;
|
|
2280
2754
|
for (const key in input) {
|
|
2281
2755
|
if (!recordKeys.has(key)) {
|
|
2282
|
-
|
|
2283
|
-
|
|
2756
|
+
if (def.mode === "loose") {
|
|
2757
|
+
if (key === "__proto__")
|
|
2758
|
+
continue;
|
|
2759
|
+
payload.value[key] = input[key];
|
|
2760
|
+
} else {
|
|
2761
|
+
unrecognized = unrecognized ?? [];
|
|
2762
|
+
unrecognized.push(key);
|
|
2763
|
+
}
|
|
2284
2764
|
}
|
|
2285
2765
|
}
|
|
2286
2766
|
if (unrecognized && unrecognized.length > 0) {
|
|
@@ -2288,14 +2768,18 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
|
|
|
2288
2768
|
code: "unrecognized_keys",
|
|
2289
2769
|
input,
|
|
2290
2770
|
inst,
|
|
2291
|
-
keys: unrecognized
|
|
2771
|
+
keys: unrecognized,
|
|
2772
|
+
continue: true
|
|
2292
2773
|
});
|
|
2293
2774
|
}
|
|
2294
2775
|
} else {
|
|
2295
|
-
payload.value = {};
|
|
2776
|
+
payload.value = memo ? memo.alloc(inst, payload, {}, ctx) : {};
|
|
2777
|
+
let unrecognized;
|
|
2296
2778
|
for (const key of Reflect.ownKeys(input)) {
|
|
2297
2779
|
if (key === "__proto__")
|
|
2298
2780
|
continue;
|
|
2781
|
+
if (!Object.prototype.propertyIsEnumerable.call(input, key))
|
|
2782
|
+
continue;
|
|
2299
2783
|
let keyResult = def.keyType._zod.run({ value: key, issues: [] }, ctx);
|
|
2300
2784
|
if (keyResult instanceof Promise) {
|
|
2301
2785
|
throw new Error("Async schemas not supported in object keys currently");
|
|
@@ -2313,6 +2797,9 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
|
|
|
2313
2797
|
if (keyResult.issues.length) {
|
|
2314
2798
|
if (def.mode === "loose") {
|
|
2315
2799
|
payload.value[key] = input[key];
|
|
2800
|
+
} else if (values) {
|
|
2801
|
+
unrecognized = unrecognized ?? [];
|
|
2802
|
+
unrecognized.push(key);
|
|
2316
2803
|
} else {
|
|
2317
2804
|
payload.issues.push({
|
|
2318
2805
|
code: "invalid_key",
|
|
@@ -2325,21 +2812,33 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
|
|
|
2325
2812
|
}
|
|
2326
2813
|
continue;
|
|
2327
2814
|
}
|
|
2815
|
+
const outKey = keyResult.value;
|
|
2816
|
+
if (outKey === "__proto__")
|
|
2817
|
+
continue;
|
|
2328
2818
|
const result = def.valueType._zod.run({ value: input[key], issues: [] }, ctx);
|
|
2329
2819
|
if (result instanceof Promise) {
|
|
2330
2820
|
proms.push(result.then((result) => {
|
|
2331
2821
|
if (result.issues.length) {
|
|
2332
2822
|
payload.issues.push(...prefixIssues(key, result.issues));
|
|
2333
2823
|
}
|
|
2334
|
-
payload.value[
|
|
2824
|
+
payload.value[outKey] = result.value;
|
|
2335
2825
|
}));
|
|
2336
2826
|
} else {
|
|
2337
2827
|
if (result.issues.length) {
|
|
2338
2828
|
payload.issues.push(...prefixIssues(key, result.issues));
|
|
2339
2829
|
}
|
|
2340
|
-
payload.value[
|
|
2830
|
+
payload.value[outKey] = result.value;
|
|
2341
2831
|
}
|
|
2342
2832
|
}
|
|
2833
|
+
if (unrecognized && unrecognized.length > 0) {
|
|
2834
|
+
payload.issues.push({
|
|
2835
|
+
code: "unrecognized_keys",
|
|
2836
|
+
input,
|
|
2837
|
+
inst,
|
|
2838
|
+
keys: unrecognized,
|
|
2839
|
+
continue: true
|
|
2840
|
+
});
|
|
2841
|
+
}
|
|
2343
2842
|
}
|
|
2344
2843
|
if (proms.length) {
|
|
2345
2844
|
return Promise.all(proms).then(() => payload);
|
|
@@ -2352,7 +2851,8 @@ var $ZodEnum = /* @__PURE__ */ $constructor("$ZodEnum", (inst, def) => {
|
|
|
2352
2851
|
const values = getEnumValues(def.entries);
|
|
2353
2852
|
const valuesSet = new Set(values);
|
|
2354
2853
|
inst._zod.values = valuesSet;
|
|
2355
|
-
|
|
2854
|
+
const patternValues = values.filter((k) => propertyKeyTypes.has(typeof k));
|
|
2855
|
+
inst._zod.pattern = new RegExp(patternValues.length ? `^(${patternValues.map((o) => escapeRegex(o.toString())).join("|")})$` : "^[^\\s\\S]$");
|
|
2356
2856
|
inst._zod.parse = (payload, _ctx) => {
|
|
2357
2857
|
const input = payload.value;
|
|
2358
2858
|
if (valuesSet.has(input)) {
|
|
@@ -2369,12 +2869,9 @@ var $ZodEnum = /* @__PURE__ */ $constructor("$ZodEnum", (inst, def) => {
|
|
|
2369
2869
|
});
|
|
2370
2870
|
var $ZodLiteral = /* @__PURE__ */ $constructor("$ZodLiteral", (inst, def) => {
|
|
2371
2871
|
$ZodType.init(inst, def);
|
|
2372
|
-
if (def.values.length === 0) {
|
|
2373
|
-
throw new Error("Cannot create literal schema with no valid values");
|
|
2374
|
-
}
|
|
2375
2872
|
const values = new Set(def.values);
|
|
2376
2873
|
inst._zod.values = values;
|
|
2377
|
-
inst._zod.pattern = new RegExp(`^(${def.values.map((o) => typeof o === "string" ? escapeRegex(o) : o ? escapeRegex(o.toString()) : String(o)).join("|")})$`);
|
|
2874
|
+
inst._zod.pattern = new RegExp(def.values.length ? `^(${def.values.map((o) => typeof o === "string" ? escapeRegex(o) : o ? escapeRegex(o.toString()) : String(o)).join("|")})$` : "^[^\\s\\S]$");
|
|
2378
2875
|
inst._zod.parse = (payload, _ctx) => {
|
|
2379
2876
|
const input = payload.value;
|
|
2380
2877
|
if (values.has(input)) {
|
|
@@ -2391,6 +2888,8 @@ var $ZodLiteral = /* @__PURE__ */ $constructor("$ZodLiteral", (inst, def) => {
|
|
|
2391
2888
|
});
|
|
2392
2889
|
var $ZodTransform = /* @__PURE__ */ $constructor("$ZodTransform", (inst, def) => {
|
|
2393
2890
|
$ZodType.init(inst, def);
|
|
2891
|
+
inst._zod.optin = "optional";
|
|
2892
|
+
globalConfig.memoizer?.guard(inst);
|
|
2394
2893
|
inst._zod.parse = (payload, ctx) => {
|
|
2395
2894
|
if (ctx.direction === "backward") {
|
|
2396
2895
|
throw new $ZodEncodeError(inst.constructor.name);
|
|
@@ -2410,54 +2909,52 @@ var $ZodTransform = /* @__PURE__ */ $constructor("$ZodTransform", (inst, def) =>
|
|
|
2410
2909
|
return payload;
|
|
2411
2910
|
};
|
|
2412
2911
|
});
|
|
2413
|
-
function handleOptionalResult(
|
|
2414
|
-
|
|
2415
|
-
|
|
2416
|
-
}
|
|
2417
|
-
return result;
|
|
2912
|
+
function handleOptionalResult(payload, result) {
|
|
2913
|
+
payload.value = result.issues.length ? undefined : result.value;
|
|
2914
|
+
return payload;
|
|
2418
2915
|
}
|
|
2419
2916
|
var $ZodOptional = /* @__PURE__ */ $constructor("$ZodOptional", (inst, def) => {
|
|
2420
2917
|
$ZodType.init(inst, def);
|
|
2421
|
-
inst._zod.optin
|
|
2918
|
+
defineLazyInternal(inst, "optin", (zod) => zod.def.innerType._zod.optin === "defaulted" ? "defaulted" : "optional");
|
|
2422
2919
|
inst._zod.optout = "optional";
|
|
2423
|
-
|
|
2424
|
-
|
|
2920
|
+
defineLazyInternal(inst, "values", (zod) => {
|
|
2921
|
+
const values = zod.def.innerType._zod.values;
|
|
2922
|
+
return values ? new Set([...values, undefined]) : undefined;
|
|
2425
2923
|
});
|
|
2426
|
-
|
|
2427
|
-
const pattern = def.innerType._zod.pattern;
|
|
2924
|
+
defineLazyInternal(inst, "pattern", (zod) => {
|
|
2925
|
+
const pattern = zod.def.innerType._zod.pattern;
|
|
2428
2926
|
return pattern ? new RegExp(`^(${cleanRegex(pattern.source)})?$`) : undefined;
|
|
2429
2927
|
});
|
|
2430
2928
|
inst._zod.parse = (payload, ctx) => {
|
|
2431
|
-
if (def.innerType._zod.optin === "optional") {
|
|
2432
|
-
const result = def.innerType._zod.run(payload, ctx);
|
|
2433
|
-
if (result instanceof Promise)
|
|
2434
|
-
return result.then((r) => handleOptionalResult(r, payload.value));
|
|
2435
|
-
return handleOptionalResult(result, payload.value);
|
|
2436
|
-
}
|
|
2437
2929
|
if (payload.value === undefined) {
|
|
2438
|
-
|
|
2930
|
+
if (def.innerType._zod.optin !== "defaulted")
|
|
2931
|
+
return payload;
|
|
2932
|
+
const result = def.innerType._zod.run({ value: payload.value, issues: [] }, ctx);
|
|
2933
|
+
if (result instanceof Promise)
|
|
2934
|
+
return result.then((result) => handleOptionalResult(payload, result));
|
|
2935
|
+
return handleOptionalResult(payload, result);
|
|
2439
2936
|
}
|
|
2440
2937
|
return def.innerType._zod.run(payload, ctx);
|
|
2441
2938
|
};
|
|
2442
2939
|
});
|
|
2443
2940
|
var $ZodExactOptional = /* @__PURE__ */ $constructor("$ZodExactOptional", (inst, def) => {
|
|
2444
2941
|
$ZodOptional.init(inst, def);
|
|
2445
|
-
|
|
2446
|
-
|
|
2942
|
+
defineLazyInternal(inst, "values", (zod) => zod.def.innerType._zod.values);
|
|
2943
|
+
defineLazyInternal(inst, "pattern", (zod) => zod.def.innerType._zod.pattern);
|
|
2447
2944
|
inst._zod.parse = (payload, ctx) => {
|
|
2448
2945
|
return def.innerType._zod.run(payload, ctx);
|
|
2449
2946
|
};
|
|
2450
2947
|
});
|
|
2451
2948
|
var $ZodNullable = /* @__PURE__ */ $constructor("$ZodNullable", (inst, def) => {
|
|
2452
2949
|
$ZodType.init(inst, def);
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
const pattern = def.innerType._zod.pattern;
|
|
2950
|
+
defineLazyInternal(inst, "optin", (zod) => zod.def.innerType._zod.optin);
|
|
2951
|
+
defineLazyInternal(inst, "optout", (zod) => zod.def.innerType._zod.optout);
|
|
2952
|
+
defineLazyInternal(inst, "pattern", (zod) => {
|
|
2953
|
+
const pattern = zod.def.innerType._zod.pattern;
|
|
2457
2954
|
return pattern ? new RegExp(`^(${cleanRegex(pattern.source)}|null)$`) : undefined;
|
|
2458
2955
|
});
|
|
2459
|
-
|
|
2460
|
-
return def.innerType._zod.values ? new Set([...def.innerType._zod.values, null]) : undefined;
|
|
2956
|
+
defineLazyInternal(inst, "values", (zod) => {
|
|
2957
|
+
return zod.def.innerType._zod.values ? new Set([...zod.def.innerType._zod.values, null]) : undefined;
|
|
2461
2958
|
});
|
|
2462
2959
|
inst._zod.parse = (payload, ctx) => {
|
|
2463
2960
|
if (payload.value === null)
|
|
@@ -2467,8 +2964,8 @@ var $ZodNullable = /* @__PURE__ */ $constructor("$ZodNullable", (inst, def) => {
|
|
|
2467
2964
|
});
|
|
2468
2965
|
var $ZodDefault = /* @__PURE__ */ $constructor("$ZodDefault", (inst, def) => {
|
|
2469
2966
|
$ZodType.init(inst, def);
|
|
2470
|
-
inst._zod.optin = "
|
|
2471
|
-
|
|
2967
|
+
inst._zod.optin = "defaulted";
|
|
2968
|
+
defineLazyInternal(inst, "values", (zod) => zod.def.innerType._zod.values);
|
|
2472
2969
|
inst._zod.parse = (payload, ctx) => {
|
|
2473
2970
|
if (ctx.direction === "backward") {
|
|
2474
2971
|
return def.innerType._zod.run(payload, ctx);
|
|
@@ -2492,8 +2989,8 @@ function handleDefaultResult(payload, def) {
|
|
|
2492
2989
|
}
|
|
2493
2990
|
var $ZodPrefault = /* @__PURE__ */ $constructor("$ZodPrefault", (inst, def) => {
|
|
2494
2991
|
$ZodType.init(inst, def);
|
|
2495
|
-
inst._zod.optin = "
|
|
2496
|
-
|
|
2992
|
+
inst._zod.optin = "defaulted";
|
|
2993
|
+
defineLazyInternal(inst, "values", (zod) => zod.def.innerType._zod.values);
|
|
2497
2994
|
inst._zod.parse = (payload, ctx) => {
|
|
2498
2995
|
if (ctx.direction === "backward") {
|
|
2499
2996
|
return def.innerType._zod.run(payload, ctx);
|
|
@@ -2506,8 +3003,8 @@ var $ZodPrefault = /* @__PURE__ */ $constructor("$ZodPrefault", (inst, def) => {
|
|
|
2506
3003
|
});
|
|
2507
3004
|
var $ZodNonOptional = /* @__PURE__ */ $constructor("$ZodNonOptional", (inst, def) => {
|
|
2508
3005
|
$ZodType.init(inst, def);
|
|
2509
|
-
|
|
2510
|
-
const v = def.innerType._zod.values;
|
|
3006
|
+
defineLazyInternal(inst, "values", (zod) => {
|
|
3007
|
+
const v = zod.def.innerType._zod.values;
|
|
2511
3008
|
return v ? new Set([...v].filter((x) => x !== undefined)) : undefined;
|
|
2512
3009
|
});
|
|
2513
3010
|
inst._zod.parse = (payload, ctx) => {
|
|
@@ -2529,52 +3026,45 @@ function handleNonOptionalResult(payload, inst) {
|
|
|
2529
3026
|
}
|
|
2530
3027
|
return payload;
|
|
2531
3028
|
}
|
|
3029
|
+
function handleCatchResult(payload, result, def, ctx) {
|
|
3030
|
+
if (!result.issues.length) {
|
|
3031
|
+
payload.value = result.value;
|
|
3032
|
+
if (result.memo)
|
|
3033
|
+
payload.memo = true;
|
|
3034
|
+
return payload;
|
|
3035
|
+
}
|
|
3036
|
+
payload.value = def.catchValue({
|
|
3037
|
+
...result,
|
|
3038
|
+
value: payload.value,
|
|
3039
|
+
error: {
|
|
3040
|
+
issues: result.issues.map((iss) => finalizeIssue(iss, ctx, config()))
|
|
3041
|
+
},
|
|
3042
|
+
input: payload.value
|
|
3043
|
+
});
|
|
3044
|
+
return payload;
|
|
3045
|
+
}
|
|
2532
3046
|
var $ZodCatch = /* @__PURE__ */ $constructor("$ZodCatch", (inst, def) => {
|
|
2533
3047
|
$ZodType.init(inst, def);
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
|
|
3048
|
+
defineLazyInternal(inst, "optin", (zod) => zod.def.innerType._zod.optin === "defaulted" ? "defaulted" : "optional");
|
|
3049
|
+
defineLazyInternal(inst, "optout", (zod) => zod.def.innerType._zod.optout);
|
|
3050
|
+
defineLazyInternal(inst, "values", (zod) => zod.def.innerType._zod.values);
|
|
2537
3051
|
inst._zod.parse = (payload, ctx) => {
|
|
2538
3052
|
if (ctx.direction === "backward") {
|
|
2539
3053
|
return def.innerType._zod.run(payload, ctx);
|
|
2540
3054
|
}
|
|
2541
|
-
const result = def.innerType._zod.run(payload, ctx);
|
|
3055
|
+
const result = def.innerType._zod.run({ value: payload.value, issues: [] }, ctx);
|
|
2542
3056
|
if (result instanceof Promise) {
|
|
2543
|
-
return result.then((result) =>
|
|
2544
|
-
payload.value = result.value;
|
|
2545
|
-
if (result.issues.length) {
|
|
2546
|
-
payload.value = def.catchValue({
|
|
2547
|
-
...payload,
|
|
2548
|
-
error: {
|
|
2549
|
-
issues: result.issues.map((iss) => finalizeIssue(iss, ctx, config()))
|
|
2550
|
-
},
|
|
2551
|
-
input: payload.value
|
|
2552
|
-
});
|
|
2553
|
-
payload.issues = [];
|
|
2554
|
-
}
|
|
2555
|
-
return payload;
|
|
2556
|
-
});
|
|
2557
|
-
}
|
|
2558
|
-
payload.value = result.value;
|
|
2559
|
-
if (result.issues.length) {
|
|
2560
|
-
payload.value = def.catchValue({
|
|
2561
|
-
...payload,
|
|
2562
|
-
error: {
|
|
2563
|
-
issues: result.issues.map((iss) => finalizeIssue(iss, ctx, config()))
|
|
2564
|
-
},
|
|
2565
|
-
input: payload.value
|
|
2566
|
-
});
|
|
2567
|
-
payload.issues = [];
|
|
3057
|
+
return result.then((result) => handleCatchResult(payload, result, def, ctx));
|
|
2568
3058
|
}
|
|
2569
|
-
return payload;
|
|
3059
|
+
return handleCatchResult(payload, result, def, ctx);
|
|
2570
3060
|
};
|
|
2571
3061
|
});
|
|
2572
3062
|
var $ZodPipe = /* @__PURE__ */ $constructor("$ZodPipe", (inst, def) => {
|
|
2573
3063
|
$ZodType.init(inst, def);
|
|
2574
|
-
|
|
2575
|
-
|
|
2576
|
-
|
|
2577
|
-
|
|
3064
|
+
defineLazyInternal(inst, "values", (zod) => zod.def.in._zod.values);
|
|
3065
|
+
defineLazyInternal(inst, "optin", (zod) => zod.def.in._zod.optin);
|
|
3066
|
+
defineLazyInternal(inst, "optout", (zod) => zod.def.out._zod.optout);
|
|
3067
|
+
defineLazyInternal(inst, "propValues", (zod) => zod.def.in._zod.propValues);
|
|
2578
3068
|
inst._zod.parse = (payload, ctx) => {
|
|
2579
3069
|
if (ctx.direction === "backward") {
|
|
2580
3070
|
const right = def.out._zod.run(payload, ctx);
|
|
@@ -2591,7 +3081,7 @@ var $ZodPipe = /* @__PURE__ */ $constructor("$ZodPipe", (inst, def) => {
|
|
|
2591
3081
|
};
|
|
2592
3082
|
});
|
|
2593
3083
|
function handlePipeResult(left, next, ctx) {
|
|
2594
|
-
if (left.issues.
|
|
3084
|
+
if (left.issues.some((iss) => iss.code !== "unrecognized_keys")) {
|
|
2595
3085
|
left.aborted = true;
|
|
2596
3086
|
return left;
|
|
2597
3087
|
}
|
|
@@ -2599,10 +3089,10 @@ function handlePipeResult(left, next, ctx) {
|
|
|
2599
3089
|
}
|
|
2600
3090
|
var $ZodReadonly = /* @__PURE__ */ $constructor("$ZodReadonly", (inst, def) => {
|
|
2601
3091
|
$ZodType.init(inst, def);
|
|
2602
|
-
|
|
2603
|
-
|
|
2604
|
-
|
|
2605
|
-
|
|
3092
|
+
defineLazyInternal(inst, "propValues", (zod) => zod.def.innerType._zod.propValues);
|
|
3093
|
+
defineLazyInternal(inst, "values", (zod) => zod.def.innerType._zod.values);
|
|
3094
|
+
defineLazyInternal(inst, "optin", (zod) => zod.def.innerType?._zod?.optin);
|
|
3095
|
+
defineLazyInternal(inst, "optout", (zod) => zod.def.innerType?._zod?.optout);
|
|
2606
3096
|
inst._zod.parse = (payload, ctx) => {
|
|
2607
3097
|
if (ctx.direction === "backward") {
|
|
2608
3098
|
return def.innerType._zod.run(payload, ctx);
|
|
@@ -2615,16 +3105,22 @@ var $ZodReadonly = /* @__PURE__ */ $constructor("$ZodReadonly", (inst, def) => {
|
|
|
2615
3105
|
};
|
|
2616
3106
|
});
|
|
2617
3107
|
function handleReadonlyResult(payload) {
|
|
2618
|
-
|
|
3108
|
+
if (!payload.memo)
|
|
3109
|
+
payload.value = Object.freeze(payload.value);
|
|
2619
3110
|
return payload;
|
|
2620
3111
|
}
|
|
2621
3112
|
var $ZodLazy = /* @__PURE__ */ $constructor("$ZodLazy", (inst, def) => {
|
|
2622
3113
|
$ZodType.init(inst, def);
|
|
2623
|
-
defineLazy(inst._zod, "innerType", () =>
|
|
2624
|
-
|
|
2625
|
-
|
|
2626
|
-
|
|
2627
|
-
|
|
3114
|
+
defineLazy(inst._zod, "innerType", () => {
|
|
3115
|
+
const d = def;
|
|
3116
|
+
if (!d._cachedInner)
|
|
3117
|
+
d._cachedInner = def.getter();
|
|
3118
|
+
return d._cachedInner;
|
|
3119
|
+
});
|
|
3120
|
+
defineLazyInternal(inst, "pattern", (zod) => zod.innerType?._zod?.pattern);
|
|
3121
|
+
defineLazyInternal(inst, "propValues", (zod) => zod.innerType?._zod?.propValues);
|
|
3122
|
+
defineLazyInternal(inst, "optin", (zod) => zod.innerType?._zod?.optin ?? undefined);
|
|
3123
|
+
defineLazyInternal(inst, "optout", (zod) => zod.innerType?._zod?.optout ?? undefined);
|
|
2628
3124
|
inst._zod.parse = (payload, ctx) => {
|
|
2629
3125
|
const inner = inst._zod.innerType;
|
|
2630
3126
|
return inner._zod.run(payload, ctx);
|
|
@@ -2660,7 +3156,240 @@ function handleRefineResult(result, payload, input, inst) {
|
|
|
2660
3156
|
payload.issues.push(issue(_iss));
|
|
2661
3157
|
}
|
|
2662
3158
|
}
|
|
2663
|
-
// ../../node_modules/.bun/zod@4.
|
|
3159
|
+
// ../../node_modules/.bun/zod@4.5.4/node_modules/zod/v4/core/memoizer.js
|
|
3160
|
+
class $ZodCyclicError extends Error {
|
|
3161
|
+
constructor() {
|
|
3162
|
+
super(`Cannot parse a reference cycle that closes through a transform`);
|
|
3163
|
+
this.name = "ZodCyclicError";
|
|
3164
|
+
}
|
|
3165
|
+
}
|
|
3166
|
+
var STATE = "~memo";
|
|
3167
|
+
var NO_ISSUES = [];
|
|
3168
|
+
function cloneIssues(issues) {
|
|
3169
|
+
return issues.map((iss) => iss.path ? { ...iss, path: iss.path.slice() } : { ...iss });
|
|
3170
|
+
}
|
|
3171
|
+
var recursive = /* @__PURE__ */ new WeakMap;
|
|
3172
|
+
function isRecursive(inst, stack) {
|
|
3173
|
+
const cached = recursive.get(inst);
|
|
3174
|
+
if (cached !== undefined)
|
|
3175
|
+
return cached;
|
|
3176
|
+
if (stack.has(inst))
|
|
3177
|
+
return true;
|
|
3178
|
+
stack.add(inst);
|
|
3179
|
+
let result = false;
|
|
3180
|
+
const check = (child) => {
|
|
3181
|
+
if (!result && child?._zod && isRecursive(child, stack))
|
|
3182
|
+
result = true;
|
|
3183
|
+
};
|
|
3184
|
+
const def = inst._zod.def;
|
|
3185
|
+
const kind = def.type;
|
|
3186
|
+
switch (kind) {
|
|
3187
|
+
case "object": {
|
|
3188
|
+
for (const key of Reflect.ownKeys(def.shape))
|
|
3189
|
+
check(def.shape[key]);
|
|
3190
|
+
check(def.catchall);
|
|
3191
|
+
break;
|
|
3192
|
+
}
|
|
3193
|
+
case "array":
|
|
3194
|
+
check(def.element);
|
|
3195
|
+
break;
|
|
3196
|
+
case "tuple":
|
|
3197
|
+
for (const el of def.items)
|
|
3198
|
+
check(el);
|
|
3199
|
+
check(def.rest);
|
|
3200
|
+
break;
|
|
3201
|
+
case "record":
|
|
3202
|
+
case "map":
|
|
3203
|
+
check(def.keyType);
|
|
3204
|
+
check(def.valueType);
|
|
3205
|
+
break;
|
|
3206
|
+
case "set":
|
|
3207
|
+
check(def.valueType);
|
|
3208
|
+
break;
|
|
3209
|
+
case "union":
|
|
3210
|
+
for (const el of def.options)
|
|
3211
|
+
check(el);
|
|
3212
|
+
break;
|
|
3213
|
+
case "intersection":
|
|
3214
|
+
check(def.left);
|
|
3215
|
+
check(def.right);
|
|
3216
|
+
break;
|
|
3217
|
+
case "optional":
|
|
3218
|
+
case "nullable":
|
|
3219
|
+
case "default":
|
|
3220
|
+
case "prefault":
|
|
3221
|
+
case "catch":
|
|
3222
|
+
case "readonly":
|
|
3223
|
+
case "nonoptional":
|
|
3224
|
+
case "promise":
|
|
3225
|
+
case "success":
|
|
3226
|
+
check(def.innerType);
|
|
3227
|
+
break;
|
|
3228
|
+
case "pipe":
|
|
3229
|
+
check(def.in);
|
|
3230
|
+
check(def.out);
|
|
3231
|
+
break;
|
|
3232
|
+
case "function":
|
|
3233
|
+
check(def.input);
|
|
3234
|
+
check(def.output);
|
|
3235
|
+
break;
|
|
3236
|
+
case "lazy":
|
|
3237
|
+
check(inst._zod.innerType);
|
|
3238
|
+
break;
|
|
3239
|
+
case "template_literal":
|
|
3240
|
+
case "string":
|
|
3241
|
+
case "number":
|
|
3242
|
+
case "int":
|
|
3243
|
+
case "boolean":
|
|
3244
|
+
case "bigint":
|
|
3245
|
+
case "symbol":
|
|
3246
|
+
case "undefined":
|
|
3247
|
+
case "null":
|
|
3248
|
+
case "void":
|
|
3249
|
+
case "never":
|
|
3250
|
+
case "any":
|
|
3251
|
+
case "unknown":
|
|
3252
|
+
case "date":
|
|
3253
|
+
case "nan":
|
|
3254
|
+
case "enum":
|
|
3255
|
+
case "literal":
|
|
3256
|
+
case "file":
|
|
3257
|
+
case "transform":
|
|
3258
|
+
case "custom":
|
|
3259
|
+
break;
|
|
3260
|
+
default: {
|
|
3261
|
+
for (const key in def) {
|
|
3262
|
+
const desc = Object.getOwnPropertyDescriptor(def, key);
|
|
3263
|
+
if (!desc || desc.get)
|
|
3264
|
+
continue;
|
|
3265
|
+
const value = desc.value;
|
|
3266
|
+
if (!value || typeof value !== "object")
|
|
3267
|
+
continue;
|
|
3268
|
+
if (value._zod)
|
|
3269
|
+
check(value);
|
|
3270
|
+
else if (Array.isArray(value))
|
|
3271
|
+
for (const el of value)
|
|
3272
|
+
check(el);
|
|
3273
|
+
}
|
|
3274
|
+
}
|
|
3275
|
+
}
|
|
3276
|
+
stack.delete(inst);
|
|
3277
|
+
recursive.set(inst, result);
|
|
3278
|
+
return result;
|
|
3279
|
+
}
|
|
3280
|
+
function bucketFor(state, inst) {
|
|
3281
|
+
let bucket = state.buckets.get(inst);
|
|
3282
|
+
if (!bucket) {
|
|
3283
|
+
bucket = new Map;
|
|
3284
|
+
state.buckets.set(inst, bucket);
|
|
3285
|
+
}
|
|
3286
|
+
return bucket;
|
|
3287
|
+
}
|
|
3288
|
+
var handoff;
|
|
3289
|
+
var open = [];
|
|
3290
|
+
var memo = {
|
|
3291
|
+
alloc(_inst, payload, empty) {
|
|
3292
|
+
const bucket = handoff;
|
|
3293
|
+
if (!bucket)
|
|
3294
|
+
return empty;
|
|
3295
|
+
handoff = undefined;
|
|
3296
|
+
const entry = { value: empty, issues: null };
|
|
3297
|
+
bucket.set(payload.value, entry);
|
|
3298
|
+
open.push(entry);
|
|
3299
|
+
return empty;
|
|
3300
|
+
},
|
|
3301
|
+
guard(inst) {
|
|
3302
|
+
var _a;
|
|
3303
|
+
(_a = inst._zod).deferred ?? (_a.deferred = []);
|
|
3304
|
+
inst._zod.deferred.push(() => {
|
|
3305
|
+
const base = inst._zod.parse;
|
|
3306
|
+
const wrapped = (payload, ctx) => {
|
|
3307
|
+
if (ctx.direction !== "backward" && isBackEdge(ctx, payload.value))
|
|
3308
|
+
throw new $ZodCyclicError;
|
|
3309
|
+
return base(payload, ctx);
|
|
3310
|
+
};
|
|
3311
|
+
inst._zod.parse = wrapped;
|
|
3312
|
+
if (inst._zod.run === base)
|
|
3313
|
+
inst._zod.run = wrapped;
|
|
3314
|
+
});
|
|
3315
|
+
},
|
|
3316
|
+
attach(inst) {
|
|
3317
|
+
var _a;
|
|
3318
|
+
let isRecursiveInst;
|
|
3319
|
+
let lastCtx;
|
|
3320
|
+
let lastBucket;
|
|
3321
|
+
(_a = inst._zod).deferred ?? (_a.deferred = []);
|
|
3322
|
+
inst._zod.deferred.push(() => {
|
|
3323
|
+
const base = inst._zod.parse;
|
|
3324
|
+
const wrapped = (payload, ctx) => {
|
|
3325
|
+
if (isRecursiveInst === undefined) {
|
|
3326
|
+
isRecursiveInst = isRecursive(inst, new Set);
|
|
3327
|
+
if (!isRecursiveInst) {
|
|
3328
|
+
inst._zod.parse = base;
|
|
3329
|
+
if (inst._zod.run === wrapped)
|
|
3330
|
+
inst._zod.run = base;
|
|
3331
|
+
return base(payload, ctx);
|
|
3332
|
+
}
|
|
3333
|
+
}
|
|
3334
|
+
const input = payload.value;
|
|
3335
|
+
if (input === null || typeof input !== "object")
|
|
3336
|
+
return base(payload, ctx);
|
|
3337
|
+
let state = ctx[STATE];
|
|
3338
|
+
if (!state) {
|
|
3339
|
+
state = { buckets: new Map, backEdges: undefined };
|
|
3340
|
+
ctx[STATE] = state;
|
|
3341
|
+
}
|
|
3342
|
+
let bucket;
|
|
3343
|
+
if (lastCtx === ctx) {
|
|
3344
|
+
bucket = lastBucket;
|
|
3345
|
+
} else {
|
|
3346
|
+
bucket = bucketFor(state, inst);
|
|
3347
|
+
lastCtx = ctx;
|
|
3348
|
+
lastBucket = bucket;
|
|
3349
|
+
}
|
|
3350
|
+
const hit = bucket.get(input);
|
|
3351
|
+
if (hit) {
|
|
3352
|
+
payload.value = hit.value;
|
|
3353
|
+
if (hit.issues) {
|
|
3354
|
+
if (hit.issues.length)
|
|
3355
|
+
payload.issues.push(...cloneIssues(hit.issues));
|
|
3356
|
+
} else {
|
|
3357
|
+
payload.memo = true;
|
|
3358
|
+
state.backEdges ?? (state.backEdges = new Set);
|
|
3359
|
+
state.backEdges.add(hit.value);
|
|
3360
|
+
}
|
|
3361
|
+
return payload;
|
|
3362
|
+
}
|
|
3363
|
+
handoff = bucket;
|
|
3364
|
+
const depth = open.length;
|
|
3365
|
+
const result = base(payload, ctx);
|
|
3366
|
+
handoff = undefined;
|
|
3367
|
+
const entry = open.length > depth ? open.pop() : undefined;
|
|
3368
|
+
if (result instanceof Promise) {
|
|
3369
|
+
return result.then((r) => {
|
|
3370
|
+
if (entry)
|
|
3371
|
+
entry.issues = r.issues.length ? cloneIssues(r.issues) : NO_ISSUES;
|
|
3372
|
+
return r;
|
|
3373
|
+
});
|
|
3374
|
+
}
|
|
3375
|
+
if (entry)
|
|
3376
|
+
entry.issues = result.issues.length ? cloneIssues(result.issues) : NO_ISSUES;
|
|
3377
|
+
return result;
|
|
3378
|
+
};
|
|
3379
|
+
inst._zod.parse = wrapped;
|
|
3380
|
+
if (inst._zod.run === base)
|
|
3381
|
+
inst._zod.run = wrapped;
|
|
3382
|
+
});
|
|
3383
|
+
}
|
|
3384
|
+
};
|
|
3385
|
+
function memoizer() {
|
|
3386
|
+
return memo;
|
|
3387
|
+
}
|
|
3388
|
+
function isBackEdge(ctx, value) {
|
|
3389
|
+
const backEdges = ctx[STATE]?.backEdges;
|
|
3390
|
+
return backEdges !== undefined && value !== null && typeof value === "object" && backEdges.has(value);
|
|
3391
|
+
}
|
|
3392
|
+
// ../../node_modules/.bun/zod@4.5.4/node_modules/zod/v4/locales/en.js
|
|
2664
3393
|
var error = () => {
|
|
2665
3394
|
const Sizable = {
|
|
2666
3395
|
string: { unit: "characters", verb: "to have" },
|
|
@@ -2700,18 +3429,25 @@ var error = () => {
|
|
|
2700
3429
|
base64url: "base64url-encoded string",
|
|
2701
3430
|
json_string: "JSON string",
|
|
2702
3431
|
e164: "E.164 number",
|
|
3432
|
+
credit_card: "credit card number",
|
|
2703
3433
|
jwt: "JWT",
|
|
2704
3434
|
template_literal: "input"
|
|
2705
3435
|
};
|
|
2706
3436
|
const TypeDictionary = {
|
|
2707
3437
|
nan: "NaN"
|
|
2708
3438
|
};
|
|
3439
|
+
function getTypeName(type, input) {
|
|
3440
|
+
if (type === "number" && typeof input === "number" && !Number.isFinite(input)) {
|
|
3441
|
+
return String(input);
|
|
3442
|
+
}
|
|
3443
|
+
return TypeDictionary[type] ?? type;
|
|
3444
|
+
}
|
|
2709
3445
|
return (issue) => {
|
|
2710
3446
|
switch (issue.code) {
|
|
2711
3447
|
case "invalid_type": {
|
|
2712
|
-
const expected =
|
|
3448
|
+
const expected = getTypeName(issue.expected);
|
|
2713
3449
|
const receivedType = parsedType(issue.input);
|
|
2714
|
-
const received =
|
|
3450
|
+
const received = getTypeName(receivedType, issue.input);
|
|
2715
3451
|
return `Invalid input: expected ${expected}, received ${received}`;
|
|
2716
3452
|
}
|
|
2717
3453
|
case "invalid_value":
|
|
@@ -2719,14 +3455,14 @@ var error = () => {
|
|
|
2719
3455
|
return `Invalid input: expected ${stringifyPrimitive(issue.values[0])}`;
|
|
2720
3456
|
return `Invalid option: expected one of ${joinValues(issue.values, "|")}`;
|
|
2721
3457
|
case "too_big": {
|
|
2722
|
-
const adj = issue.inclusive ? "<=" : "<";
|
|
3458
|
+
const adj = issue.exact ? "exactly " : issue.inclusive ? "<=" : "<";
|
|
2723
3459
|
const sizing = getSizing(issue.origin);
|
|
2724
3460
|
if (sizing)
|
|
2725
3461
|
return `Too big: expected ${issue.origin ?? "value"} to have ${adj}${issue.maximum.toString()} ${sizing.unit ?? "elements"}`;
|
|
2726
3462
|
return `Too big: expected ${issue.origin ?? "value"} to be ${adj}${issue.maximum.toString()}`;
|
|
2727
3463
|
}
|
|
2728
3464
|
case "too_small": {
|
|
2729
|
-
const adj = issue.inclusive ? ">=" : ">";
|
|
3465
|
+
const adj = issue.exact ? "exactly " : issue.inclusive ? ">=" : ">";
|
|
2730
3466
|
const sizing = getSizing(issue.origin);
|
|
2731
3467
|
if (sizing) {
|
|
2732
3468
|
return `Too small: expected ${issue.origin} to have ${adj}${issue.minimum.toString()} ${sizing.unit}`;
|
|
@@ -2753,6 +3489,13 @@ var error = () => {
|
|
|
2753
3489
|
case "invalid_key":
|
|
2754
3490
|
return `Invalid key in ${issue.origin}`;
|
|
2755
3491
|
case "invalid_union":
|
|
3492
|
+
if (issue.options && Array.isArray(issue.options) && issue.options.length > 0) {
|
|
3493
|
+
const opts = issue.options.map((o) => `'${o}'`).join(" | ");
|
|
3494
|
+
return `Invalid discriminator value. Expected ${opts}`;
|
|
3495
|
+
}
|
|
3496
|
+
if (issue.inclusive === false) {
|
|
3497
|
+
return "Invalid input: more than one option matched";
|
|
3498
|
+
}
|
|
2756
3499
|
return "Invalid input";
|
|
2757
3500
|
case "invalid_element":
|
|
2758
3501
|
return `Invalid value in ${issue.origin}`;
|
|
@@ -2766,11 +3509,8 @@ function en_default() {
|
|
|
2766
3509
|
localeError: error()
|
|
2767
3510
|
};
|
|
2768
3511
|
}
|
|
2769
|
-
// ../../node_modules/.bun/zod@4.
|
|
2770
|
-
var
|
|
2771
|
-
var $output = Symbol("ZodOutput");
|
|
2772
|
-
var $input = Symbol("ZodInput");
|
|
2773
|
-
|
|
3512
|
+
// ../../node_modules/.bun/zod@4.5.4/node_modules/zod/v4/core/registries.js
|
|
3513
|
+
var _a2;
|
|
2774
3514
|
class $ZodRegistry {
|
|
2775
3515
|
constructor() {
|
|
2776
3516
|
this._map = new WeakMap;
|
|
@@ -2814,9 +3554,9 @@ class $ZodRegistry {
|
|
|
2814
3554
|
function registry() {
|
|
2815
3555
|
return new $ZodRegistry;
|
|
2816
3556
|
}
|
|
2817
|
-
(
|
|
3557
|
+
(_a2 = globalThis).__zod_globalRegistry ?? (_a2.__zod_globalRegistry = registry());
|
|
2818
3558
|
var globalRegistry = globalThis.__zod_globalRegistry;
|
|
2819
|
-
// ../../node_modules/.bun/zod@4.
|
|
3559
|
+
// ../../node_modules/.bun/zod@4.5.4/node_modules/zod/v4/core/api.js
|
|
2820
3560
|
function _string(Class, params) {
|
|
2821
3561
|
return new Class({
|
|
2822
3562
|
type: "string",
|
|
@@ -3279,7 +4019,7 @@ function _refine(Class, fn, _params) {
|
|
|
3279
4019
|
});
|
|
3280
4020
|
return schema;
|
|
3281
4021
|
}
|
|
3282
|
-
function _superRefine(fn) {
|
|
4022
|
+
function _superRefine(fn, params) {
|
|
3283
4023
|
const ch = _check((payload) => {
|
|
3284
4024
|
payload.addIssue = (issue2) => {
|
|
3285
4025
|
if (typeof issue2 === "string") {
|
|
@@ -3289,14 +4029,15 @@ function _superRefine(fn) {
|
|
|
3289
4029
|
if (_issue.fatal)
|
|
3290
4030
|
_issue.continue = false;
|
|
3291
4031
|
_issue.code ?? (_issue.code = "custom");
|
|
3292
|
-
|
|
4032
|
+
if (!("input" in _issue))
|
|
4033
|
+
_issue.input = payload.value;
|
|
3293
4034
|
_issue.inst ?? (_issue.inst = ch);
|
|
3294
4035
|
_issue.continue ?? (_issue.continue = !ch._zod.def.abort);
|
|
3295
4036
|
payload.issues.push(issue(_issue));
|
|
3296
4037
|
}
|
|
3297
4038
|
};
|
|
3298
4039
|
return fn(payload.value, payload);
|
|
3299
|
-
});
|
|
4040
|
+
}, params);
|
|
3300
4041
|
return ch;
|
|
3301
4042
|
}
|
|
3302
4043
|
function _check(fn, params) {
|
|
@@ -3307,7 +4048,17 @@ function _check(fn, params) {
|
|
|
3307
4048
|
ch._zod.check = fn;
|
|
3308
4049
|
return ch;
|
|
3309
4050
|
}
|
|
3310
|
-
// ../../node_modules/.bun/zod@4.
|
|
4051
|
+
// ../../node_modules/.bun/zod@4.5.4/node_modules/zod/v4/core/to-json-schema.js
|
|
4052
|
+
function assignProps(target, ...sources) {
|
|
4053
|
+
for (const source of sources) {
|
|
4054
|
+
for (const key of Reflect.ownKeys(source)) {
|
|
4055
|
+
if (Object.prototype.propertyIsEnumerable.call(source, key)) {
|
|
4056
|
+
assignProp(target, key, source[key]);
|
|
4057
|
+
}
|
|
4058
|
+
}
|
|
4059
|
+
}
|
|
4060
|
+
return target;
|
|
4061
|
+
}
|
|
3311
4062
|
function initializeContext(params) {
|
|
3312
4063
|
let target = params?.target ?? "draft-2020-12";
|
|
3313
4064
|
if (target === "draft-4")
|
|
@@ -3323,11 +4074,24 @@ function initializeContext(params) {
|
|
|
3323
4074
|
io: params?.io ?? "output",
|
|
3324
4075
|
counter: 0,
|
|
3325
4076
|
seen: new Map,
|
|
4077
|
+
sharedDefsExtractedFor: undefined,
|
|
4078
|
+
sharedEmitDoneFor: undefined,
|
|
3326
4079
|
cycles: params?.cycles ?? "ref",
|
|
3327
4080
|
reused: params?.reused ?? "inline",
|
|
4081
|
+
intersections: [],
|
|
4082
|
+
deferred: [],
|
|
3328
4083
|
external: params?.external ?? undefined
|
|
3329
4084
|
};
|
|
3330
4085
|
}
|
|
4086
|
+
function handleUnrepresentable(schema, ctx, json, params, message) {
|
|
4087
|
+
const result = typeof ctx.unrepresentable === "function" ? ctx.unrepresentable({ zodSchema: schema, path: params.path, message }) : ctx.unrepresentable;
|
|
4088
|
+
if (result === "any")
|
|
4089
|
+
return false;
|
|
4090
|
+
if (result === undefined || result === "throw")
|
|
4091
|
+
throw new Error(message);
|
|
4092
|
+
Object.assign(json, result);
|
|
4093
|
+
return true;
|
|
4094
|
+
}
|
|
3331
4095
|
function process(schema, ctx, _params = { path: [], schemaPath: [] }) {
|
|
3332
4096
|
var _a;
|
|
3333
4097
|
const def = schema._zod.def;
|
|
@@ -3342,6 +4106,8 @@ function process(schema, ctx, _params = { path: [], schemaPath: [] }) {
|
|
|
3342
4106
|
}
|
|
3343
4107
|
const result = { schema: {}, count: 1, cycle: undefined, path: _params.path };
|
|
3344
4108
|
ctx.seen.set(schema, result);
|
|
4109
|
+
ctx.sharedDefsExtractedFor = undefined;
|
|
4110
|
+
ctx.sharedEmitDoneFor = undefined;
|
|
3345
4111
|
const overrideSchema = schema._zod.toJSONSchema?.();
|
|
3346
4112
|
if (overrideSchema) {
|
|
3347
4113
|
result.schema = overrideSchema;
|
|
@@ -3371,21 +4137,26 @@ function process(schema, ctx, _params = { path: [], schemaPath: [] }) {
|
|
|
3371
4137
|
}
|
|
3372
4138
|
const meta = ctx.metadataRegistry.get(schema);
|
|
3373
4139
|
if (meta)
|
|
3374
|
-
|
|
4140
|
+
assignProps(result.schema, meta);
|
|
3375
4141
|
if (ctx.io === "input" && isTransforming(schema)) {
|
|
3376
4142
|
delete result.schema.examples;
|
|
3377
4143
|
delete result.schema.default;
|
|
3378
4144
|
}
|
|
3379
|
-
if (ctx.io === "input" && result.schema
|
|
4145
|
+
if (ctx.io === "input" && "_prefault" in result.schema)
|
|
3380
4146
|
(_a = result.schema).default ?? (_a.default = result.schema._prefault);
|
|
3381
4147
|
delete result.schema._prefault;
|
|
3382
4148
|
const _result = ctx.seen.get(schema);
|
|
3383
4149
|
return _result.schema;
|
|
3384
4150
|
}
|
|
4151
|
+
function encodeJSONPointerSegment(segment) {
|
|
4152
|
+
return segment.replace(/~/g, "~0").replace(/\//g, "~1");
|
|
4153
|
+
}
|
|
3385
4154
|
function extractDefs(ctx, schema) {
|
|
3386
4155
|
const root = ctx.seen.get(schema);
|
|
3387
4156
|
if (!root)
|
|
3388
4157
|
throw new Error("Unprocessed schema. This is a bug in Zod.");
|
|
4158
|
+
if (ctx.external && ctx.sharedDefsExtractedFor === ctx.external)
|
|
4159
|
+
return;
|
|
3389
4160
|
const idToSchema = new Map;
|
|
3390
4161
|
for (const entry of ctx.seen.entries()) {
|
|
3391
4162
|
const id = ctx.metadataRegistry.get(entry[0])?.id;
|
|
@@ -3407,15 +4178,15 @@ function extractDefs(ctx, schema) {
|
|
|
3407
4178
|
}
|
|
3408
4179
|
const id = entry[1].defId ?? entry[1].schema.id ?? `schema${ctx.counter++}`;
|
|
3409
4180
|
entry[1].defId = id;
|
|
3410
|
-
return { defId: id, ref: `${uriGenerator("__shared")}#/${defsSegment}/${id}` };
|
|
3411
|
-
}
|
|
3412
|
-
if (entry[1] === root) {
|
|
3413
|
-
return { ref: "#" };
|
|
4181
|
+
return { defId: id, ref: `${uriGenerator("__shared")}#/${defsSegment}/${encodeJSONPointerSegment(id)}` };
|
|
3414
4182
|
}
|
|
3415
4183
|
const uriPrefix = `#`;
|
|
3416
4184
|
const defUriPrefix = `${uriPrefix}/${defsSegment}/`;
|
|
4185
|
+
if (entry[1] === root && !entry[1].schema.id) {
|
|
4186
|
+
return { ref: uriPrefix };
|
|
4187
|
+
}
|
|
3417
4188
|
const defId = entry[1].schema.id ?? `__schema${ctx.counter++}`;
|
|
3418
|
-
return { defId, ref: defUriPrefix + defId };
|
|
4189
|
+
return { defId, ref: defUriPrefix + encodeJSONPointerSegment(defId) };
|
|
3419
4190
|
};
|
|
3420
4191
|
const extractToDef = (entry) => {
|
|
3421
4192
|
if (entry[1].schema.$ref) {
|
|
@@ -3469,6 +4240,116 @@ function extractDefs(ctx, schema) {
|
|
|
3469
4240
|
}
|
|
3470
4241
|
}
|
|
3471
4242
|
}
|
|
4243
|
+
if (ctx.external)
|
|
4244
|
+
ctx.sharedDefsExtractedFor = ctx.external;
|
|
4245
|
+
}
|
|
4246
|
+
function compactTypeUnion(schema) {
|
|
4247
|
+
const options = schema.anyOf;
|
|
4248
|
+
if (!Array.isArray(options) || options.length === 0 || schema.type !== undefined)
|
|
4249
|
+
return;
|
|
4250
|
+
const types = [];
|
|
4251
|
+
for (const option of options) {
|
|
4252
|
+
if (!option || typeof option !== "object")
|
|
4253
|
+
return;
|
|
4254
|
+
compactTypeUnion(option);
|
|
4255
|
+
const keys = Object.keys(option);
|
|
4256
|
+
if (keys.length !== 1 || keys[0] !== "type")
|
|
4257
|
+
return;
|
|
4258
|
+
const type = option.type;
|
|
4259
|
+
for (const member of Array.isArray(type) ? type : [type]) {
|
|
4260
|
+
if (typeof member !== "string")
|
|
4261
|
+
return;
|
|
4262
|
+
if (!types.includes(member))
|
|
4263
|
+
types.push(member);
|
|
4264
|
+
}
|
|
4265
|
+
}
|
|
4266
|
+
delete schema.anyOf;
|
|
4267
|
+
schema.type = types.length === 1 ? types[0] : types;
|
|
4268
|
+
}
|
|
4269
|
+
var FOLDABLE_KEYS = new Set(["type", "properties", "required", "additionalProperties"]);
|
|
4270
|
+
var UNION_KEYS = ["oneOf", "anyOf"];
|
|
4271
|
+
function undeclaredConstraint(member) {
|
|
4272
|
+
const extra = member.additionalProperties;
|
|
4273
|
+
if (extra === undefined || extra === false || typeof extra !== "object" || extra === null)
|
|
4274
|
+
return null;
|
|
4275
|
+
return Object.keys(extra).length ? extra : null;
|
|
4276
|
+
}
|
|
4277
|
+
function foldObjects(members) {
|
|
4278
|
+
const objects = [];
|
|
4279
|
+
for (const member of members) {
|
|
4280
|
+
if (typeof member !== "object" || member.type !== "object")
|
|
4281
|
+
return null;
|
|
4282
|
+
for (const key in member) {
|
|
4283
|
+
if (!FOLDABLE_KEYS.has(key))
|
|
4284
|
+
return null;
|
|
4285
|
+
}
|
|
4286
|
+
objects.push(member);
|
|
4287
|
+
}
|
|
4288
|
+
const properties = {};
|
|
4289
|
+
const required = new Set;
|
|
4290
|
+
for (const object of objects) {
|
|
4291
|
+
for (const key in object.properties) {
|
|
4292
|
+
if (Object.prototype.hasOwnProperty.call(properties, key))
|
|
4293
|
+
continue;
|
|
4294
|
+
const parts = [];
|
|
4295
|
+
for (const other of objects) {
|
|
4296
|
+
const part = other.properties?.[key] ?? undeclaredConstraint(other);
|
|
4297
|
+
if (part === null || part === undefined)
|
|
4298
|
+
continue;
|
|
4299
|
+
if (!parts.some((seen) => JSON.stringify(seen) === JSON.stringify(part)))
|
|
4300
|
+
parts.push(part);
|
|
4301
|
+
}
|
|
4302
|
+
const merged = parts.length === 1 ? parts[0] : foldObjects(parts) ?? { allOf: parts };
|
|
4303
|
+
assignProp(properties, key, merged);
|
|
4304
|
+
}
|
|
4305
|
+
for (const key of object.required ?? [])
|
|
4306
|
+
required.add(key);
|
|
4307
|
+
}
|
|
4308
|
+
const folded = { type: "object", properties };
|
|
4309
|
+
if (required.size)
|
|
4310
|
+
folded.required = [...required];
|
|
4311
|
+
if (objects.every((object) => object.additionalProperties === false)) {
|
|
4312
|
+
folded.additionalProperties = false;
|
|
4313
|
+
} else {
|
|
4314
|
+
const constraints = [];
|
|
4315
|
+
for (const object of objects) {
|
|
4316
|
+
const constraint = undeclaredConstraint(object);
|
|
4317
|
+
if (constraint && !constraints.some((seen) => JSON.stringify(seen) === JSON.stringify(constraint)))
|
|
4318
|
+
constraints.push(constraint);
|
|
4319
|
+
}
|
|
4320
|
+
if (constraints.length === 1)
|
|
4321
|
+
folded.additionalProperties = constraints[0];
|
|
4322
|
+
else if (constraints.length > 1)
|
|
4323
|
+
folded.additionalProperties = { allOf: constraints };
|
|
4324
|
+
}
|
|
4325
|
+
return folded;
|
|
4326
|
+
}
|
|
4327
|
+
function foldIntersection(json) {
|
|
4328
|
+
const allOf = json.allOf;
|
|
4329
|
+
if (!Array.isArray(allOf) || allOf.length < 2)
|
|
4330
|
+
return;
|
|
4331
|
+
for (const key of FOLDABLE_KEYS)
|
|
4332
|
+
if (key in json)
|
|
4333
|
+
return;
|
|
4334
|
+
const unions = allOf.filter((m) => UNION_KEYS.some((k) => Array.isArray(m[k])));
|
|
4335
|
+
let folded = null;
|
|
4336
|
+
if (!unions.length) {
|
|
4337
|
+
folded = foldObjects(allOf);
|
|
4338
|
+
} else {
|
|
4339
|
+
const union = unions[0];
|
|
4340
|
+
const keyword = UNION_KEYS.find((k) => Array.isArray(union[k]));
|
|
4341
|
+
if (Object.keys(union).length !== 1)
|
|
4342
|
+
return;
|
|
4343
|
+
const rest = allOf.filter((m) => m !== union);
|
|
4344
|
+
const branches = union[keyword].map((branch) => foldObjects([...rest, branch]));
|
|
4345
|
+
if (branches.some((b) => !b))
|
|
4346
|
+
return;
|
|
4347
|
+
folded = { [keyword]: branches };
|
|
4348
|
+
}
|
|
4349
|
+
if (!folded)
|
|
4350
|
+
return;
|
|
4351
|
+
delete json.allOf;
|
|
4352
|
+
assignProps(json, folded);
|
|
3472
4353
|
}
|
|
3473
4354
|
function finalize(ctx, schema) {
|
|
3474
4355
|
const root = ctx.seen.get(schema);
|
|
@@ -3490,9 +4371,9 @@ function finalize(ctx, schema) {
|
|
|
3490
4371
|
schema.allOf = schema.allOf ?? [];
|
|
3491
4372
|
schema.allOf.push(refSchema);
|
|
3492
4373
|
} else {
|
|
3493
|
-
|
|
4374
|
+
assignProps(schema, refSchema);
|
|
3494
4375
|
}
|
|
3495
|
-
|
|
4376
|
+
assignProps(schema, _cached);
|
|
3496
4377
|
const isParentRef = zodSchema._zod.parent === ref;
|
|
3497
4378
|
if (isParentRef) {
|
|
3498
4379
|
for (const key in schema) {
|
|
@@ -3536,8 +4417,36 @@ function finalize(ctx, schema) {
|
|
|
3536
4417
|
path: seen.path ?? []
|
|
3537
4418
|
});
|
|
3538
4419
|
};
|
|
3539
|
-
|
|
3540
|
-
|
|
4420
|
+
if (!ctx.external || ctx.sharedEmitDoneFor !== ctx.external) {
|
|
4421
|
+
for (const entry of [...ctx.seen.entries()].reverse()) {
|
|
4422
|
+
flattenRef(entry[0]);
|
|
4423
|
+
}
|
|
4424
|
+
if (ctx.target !== "openapi-3.0") {
|
|
4425
|
+
for (const entry of ctx.seen.entries()) {
|
|
4426
|
+
compactTypeUnion(entry[1].def ?? entry[1].schema);
|
|
4427
|
+
}
|
|
4428
|
+
}
|
|
4429
|
+
for (const rewrite of ctx.deferred)
|
|
4430
|
+
rewrite();
|
|
4431
|
+
if (ctx.intersections.length) {
|
|
4432
|
+
const carriers = new Map;
|
|
4433
|
+
for (const seen of ctx.seen.values()) {
|
|
4434
|
+
for (const json of [seen.schema, seen.def]) {
|
|
4435
|
+
const allOf = json?.allOf;
|
|
4436
|
+
if (!Array.isArray(allOf))
|
|
4437
|
+
continue;
|
|
4438
|
+
const existing = carriers.get(allOf);
|
|
4439
|
+
if (existing)
|
|
4440
|
+
existing.push(json);
|
|
4441
|
+
else
|
|
4442
|
+
carriers.set(allOf, [json]);
|
|
4443
|
+
}
|
|
4444
|
+
}
|
|
4445
|
+
for (const allOf of ctx.intersections) {
|
|
4446
|
+
for (const json of carriers.get(allOf) ?? [])
|
|
4447
|
+
foldIntersection(json);
|
|
4448
|
+
}
|
|
4449
|
+
}
|
|
3541
4450
|
}
|
|
3542
4451
|
const result = {};
|
|
3543
4452
|
if (ctx.target === "draft-2020-12") {
|
|
@@ -3553,14 +4462,23 @@ function finalize(ctx, schema) {
|
|
|
3553
4462
|
throw new Error("Schema is missing an `id` property");
|
|
3554
4463
|
result.$id = ctx.external.uri(id);
|
|
3555
4464
|
}
|
|
3556
|
-
|
|
4465
|
+
assignProps(result, root.defId ? root.schema : root.def ?? root.schema);
|
|
4466
|
+
const rootMetaId = ctx.metadataRegistry.get(schema)?.id;
|
|
4467
|
+
if (rootMetaId !== undefined && result.id === rootMetaId)
|
|
4468
|
+
delete result.id;
|
|
3557
4469
|
const defs = ctx.external?.defs ?? {};
|
|
3558
|
-
|
|
3559
|
-
const seen
|
|
3560
|
-
|
|
3561
|
-
|
|
4470
|
+
if (!ctx.external || ctx.sharedEmitDoneFor !== ctx.external) {
|
|
4471
|
+
for (const entry of ctx.seen.entries()) {
|
|
4472
|
+
const seen = entry[1];
|
|
4473
|
+
if (seen.def && seen.defId) {
|
|
4474
|
+
if (seen.def.id === seen.defId)
|
|
4475
|
+
delete seen.def.id;
|
|
4476
|
+
assignProp(defs, seen.defId, seen.def);
|
|
4477
|
+
}
|
|
3562
4478
|
}
|
|
3563
4479
|
}
|
|
4480
|
+
if (ctx.external)
|
|
4481
|
+
ctx.sharedEmitDoneFor = ctx.external;
|
|
3564
4482
|
if (ctx.external) {} else {
|
|
3565
4483
|
if (Object.keys(defs).length > 0) {
|
|
3566
4484
|
if (ctx.target === "draft-2020-12") {
|
|
@@ -3602,7 +4520,7 @@ function isTransforming(_schema, _ctx) {
|
|
|
3602
4520
|
return isTransforming(def.valueType, ctx);
|
|
3603
4521
|
if (def.type === "lazy")
|
|
3604
4522
|
return isTransforming(def.getter(), ctx);
|
|
3605
|
-
if (def.type === "promise" || def.type === "optional" || def.type === "nonoptional" || def.type === "nullable" || def.type === "readonly" || def.type === "default" || def.type === "prefault") {
|
|
4523
|
+
if (def.type === "promise" || def.type === "optional" || def.type === "nonoptional" || def.type === "nullable" || def.type === "readonly" || def.type === "default" || def.type === "prefault" || def.type === "catch") {
|
|
3606
4524
|
return isTransforming(def.innerType, ctx);
|
|
3607
4525
|
}
|
|
3608
4526
|
if (def.type === "intersection") {
|
|
@@ -3612,6 +4530,8 @@ function isTransforming(_schema, _ctx) {
|
|
|
3612
4530
|
return isTransforming(def.keyType, ctx) || isTransforming(def.valueType, ctx);
|
|
3613
4531
|
}
|
|
3614
4532
|
if (def.type === "pipe") {
|
|
4533
|
+
if (_schema._zod.traits.has("$ZodCodec"))
|
|
4534
|
+
return true;
|
|
3615
4535
|
return isTransforming(def.in, ctx) || isTransforming(def.out, ctx);
|
|
3616
4536
|
}
|
|
3617
4537
|
if (def.type === "object") {
|
|
@@ -3652,7 +4572,7 @@ var createStandardJSONSchemaMethod = (schema, io, processors = {}) => (params) =
|
|
|
3652
4572
|
extractDefs(ctx, schema);
|
|
3653
4573
|
return finalize(ctx, schema);
|
|
3654
4574
|
};
|
|
3655
|
-
// ../../node_modules/.bun/zod@4.
|
|
4575
|
+
// ../../node_modules/.bun/zod@4.5.4/node_modules/zod/v4/core/json-schema-processors.js
|
|
3656
4576
|
var formatMap = {
|
|
3657
4577
|
guid: "uuid",
|
|
3658
4578
|
url: "uri",
|
|
@@ -3663,7 +4583,7 @@ var formatMap = {
|
|
|
3663
4583
|
var stringProcessor = (schema, ctx, _json, _params) => {
|
|
3664
4584
|
const json = _json;
|
|
3665
4585
|
json.type = "string";
|
|
3666
|
-
const { minimum, maximum, format, patterns, contentEncoding } = schema._zod.bag;
|
|
4586
|
+
const { minimum, maximum, format, patterns, contentEncoding, laxFormat } = schema._zod.bag;
|
|
3667
4587
|
if (typeof minimum === "number")
|
|
3668
4588
|
json.minLength = minimum;
|
|
3669
4589
|
if (typeof maximum === "number")
|
|
@@ -3672,19 +4592,19 @@ var stringProcessor = (schema, ctx, _json, _params) => {
|
|
|
3672
4592
|
json.format = formatMap[format] ?? format;
|
|
3673
4593
|
if (json.format === "")
|
|
3674
4594
|
delete json.format;
|
|
3675
|
-
if (format === "time") {
|
|
4595
|
+
if (format === "time" || laxFormat) {
|
|
3676
4596
|
delete json.format;
|
|
3677
4597
|
}
|
|
3678
4598
|
}
|
|
3679
4599
|
if (contentEncoding)
|
|
3680
4600
|
json.contentEncoding = contentEncoding;
|
|
3681
4601
|
if (patterns && patterns.size > 0) {
|
|
3682
|
-
const
|
|
3683
|
-
if (
|
|
3684
|
-
json.pattern =
|
|
3685
|
-
else if (
|
|
4602
|
+
const patternList = [...patterns];
|
|
4603
|
+
if (patternList.length === 1)
|
|
4604
|
+
json.pattern = patternList[0].source;
|
|
4605
|
+
else if (patternList.length > 1) {
|
|
3686
4606
|
json.allOf = [
|
|
3687
|
-
...
|
|
4607
|
+
...patternList.map((regex) => ({
|
|
3688
4608
|
...ctx.target === "draft-07" || ctx.target === "draft-04" || ctx.target === "openapi-3.0" ? { type: "string" } : {},
|
|
3689
4609
|
pattern: regex.source
|
|
3690
4610
|
}))
|
|
@@ -3692,57 +4612,48 @@ var stringProcessor = (schema, ctx, _json, _params) => {
|
|
|
3692
4612
|
}
|
|
3693
4613
|
}
|
|
3694
4614
|
};
|
|
3695
|
-
var numberProcessor = (schema, ctx, _json,
|
|
4615
|
+
var numberProcessor = (schema, ctx, _json, params) => {
|
|
3696
4616
|
const json = _json;
|
|
3697
4617
|
const { minimum, maximum, format, multipleOf, exclusiveMaximum, exclusiveMinimum } = schema._zod.bag;
|
|
3698
4618
|
if (typeof format === "string" && format.includes("int"))
|
|
3699
4619
|
json.type = "integer";
|
|
3700
4620
|
else
|
|
3701
4621
|
json.type = "number";
|
|
3702
|
-
|
|
3703
|
-
|
|
4622
|
+
const exMin = typeof exclusiveMinimum === "number" && exclusiveMinimum >= (minimum ?? Number.NEGATIVE_INFINITY);
|
|
4623
|
+
const exMax = typeof exclusiveMaximum === "number" && exclusiveMaximum <= (maximum ?? Number.POSITIVE_INFINITY);
|
|
4624
|
+
const legacy = ctx.target === "draft-04" || ctx.target === "openapi-3.0";
|
|
4625
|
+
if (exMin) {
|
|
4626
|
+
if (legacy) {
|
|
3704
4627
|
json.minimum = exclusiveMinimum;
|
|
3705
4628
|
json.exclusiveMinimum = true;
|
|
3706
4629
|
} else {
|
|
3707
4630
|
json.exclusiveMinimum = exclusiveMinimum;
|
|
3708
4631
|
}
|
|
3709
|
-
}
|
|
3710
|
-
if (typeof minimum === "number") {
|
|
4632
|
+
} else if (typeof minimum === "number") {
|
|
3711
4633
|
json.minimum = minimum;
|
|
3712
|
-
if (typeof exclusiveMinimum === "number" && ctx.target !== "draft-04") {
|
|
3713
|
-
if (exclusiveMinimum >= minimum)
|
|
3714
|
-
delete json.minimum;
|
|
3715
|
-
else
|
|
3716
|
-
delete json.exclusiveMinimum;
|
|
3717
|
-
}
|
|
3718
4634
|
}
|
|
3719
|
-
if (
|
|
3720
|
-
if (
|
|
4635
|
+
if (exMax) {
|
|
4636
|
+
if (legacy) {
|
|
3721
4637
|
json.maximum = exclusiveMaximum;
|
|
3722
4638
|
json.exclusiveMaximum = true;
|
|
3723
4639
|
} else {
|
|
3724
4640
|
json.exclusiveMaximum = exclusiveMaximum;
|
|
3725
4641
|
}
|
|
3726
|
-
}
|
|
3727
|
-
if (typeof maximum === "number") {
|
|
4642
|
+
} else if (typeof maximum === "number") {
|
|
3728
4643
|
json.maximum = maximum;
|
|
3729
|
-
if (typeof exclusiveMaximum === "number" && ctx.target !== "draft-04") {
|
|
3730
|
-
if (exclusiveMaximum <= maximum)
|
|
3731
|
-
delete json.maximum;
|
|
3732
|
-
else
|
|
3733
|
-
delete json.exclusiveMaximum;
|
|
3734
|
-
}
|
|
3735
4644
|
}
|
|
3736
|
-
if (typeof multipleOf === "number")
|
|
3737
|
-
|
|
4645
|
+
if (typeof multipleOf === "number") {
|
|
4646
|
+
if (Number.isFinite(multipleOf) && multipleOf !== 0)
|
|
4647
|
+
json.multipleOf = Math.abs(multipleOf);
|
|
4648
|
+
else
|
|
4649
|
+
handleUnrepresentable(schema, ctx, json, params, `A multipleOf divisor of ${multipleOf} cannot be represented in JSON Schema`);
|
|
4650
|
+
}
|
|
3738
4651
|
};
|
|
3739
4652
|
var booleanProcessor = (_schema, _ctx, json, _params) => {
|
|
3740
4653
|
json.type = "boolean";
|
|
3741
4654
|
};
|
|
3742
|
-
var bigintProcessor = (
|
|
3743
|
-
|
|
3744
|
-
throw new Error("BigInt cannot be represented in JSON Schema");
|
|
3745
|
-
}
|
|
4655
|
+
var bigintProcessor = (schema, ctx, json, params) => {
|
|
4656
|
+
handleUnrepresentable(schema, ctx, json, params, "BigInt cannot be represented in JSON Schema");
|
|
3746
4657
|
};
|
|
3747
4658
|
var nullProcessor = (_schema, ctx, json, _params) => {
|
|
3748
4659
|
if (ctx.target === "openapi-3.0") {
|
|
@@ -3757,34 +4668,37 @@ var neverProcessor = (_schema, _ctx, json, _params) => {
|
|
|
3757
4668
|
json.not = {};
|
|
3758
4669
|
};
|
|
3759
4670
|
var unknownProcessor = (_schema, _ctx, _json, _params) => {};
|
|
3760
|
-
var dateProcessor = (
|
|
3761
|
-
|
|
3762
|
-
throw new Error("Date cannot be represented in JSON Schema");
|
|
3763
|
-
}
|
|
4671
|
+
var dateProcessor = (schema, ctx, json, params) => {
|
|
4672
|
+
handleUnrepresentable(schema, ctx, json, params, "Date cannot be represented in JSON Schema");
|
|
3764
4673
|
};
|
|
3765
4674
|
var enumProcessor = (schema, _ctx, json, _params) => {
|
|
3766
4675
|
const def = schema._zod.def;
|
|
3767
4676
|
const values = getEnumValues(def.entries);
|
|
4677
|
+
if (values.length === 0) {
|
|
4678
|
+
json.not = {};
|
|
4679
|
+
return;
|
|
4680
|
+
}
|
|
3768
4681
|
if (values.every((v) => typeof v === "number"))
|
|
3769
4682
|
json.type = "number";
|
|
3770
4683
|
if (values.every((v) => typeof v === "string"))
|
|
3771
4684
|
json.type = "string";
|
|
3772
4685
|
json.enum = values;
|
|
3773
4686
|
};
|
|
3774
|
-
var literalProcessor = (schema, ctx, json,
|
|
4687
|
+
var literalProcessor = (schema, ctx, json, params) => {
|
|
3775
4688
|
const def = schema._zod.def;
|
|
4689
|
+
if (def.values.length === 0) {
|
|
4690
|
+
json.not = {};
|
|
4691
|
+
return;
|
|
4692
|
+
}
|
|
3776
4693
|
const vals = [];
|
|
3777
4694
|
for (const val of def.values) {
|
|
3778
4695
|
if (val === undefined) {
|
|
3779
|
-
if (ctx
|
|
3780
|
-
|
|
3781
|
-
}
|
|
4696
|
+
if (handleUnrepresentable(schema, ctx, json, params, "Literal `undefined` cannot be represented in JSON Schema"))
|
|
4697
|
+
return;
|
|
3782
4698
|
} else if (typeof val === "bigint") {
|
|
3783
|
-
if (ctx
|
|
3784
|
-
|
|
3785
|
-
|
|
3786
|
-
vals.push(Number(val));
|
|
3787
|
-
}
|
|
4699
|
+
if (handleUnrepresentable(schema, ctx, json, params, "BigInt literals cannot be represented in JSON Schema"))
|
|
4700
|
+
return;
|
|
4701
|
+
vals.push(Number(val));
|
|
3788
4702
|
} else {
|
|
3789
4703
|
vals.push(val);
|
|
3790
4704
|
}
|
|
@@ -3809,15 +4723,11 @@ var literalProcessor = (schema, ctx, json, _params) => {
|
|
|
3809
4723
|
json.enum = vals;
|
|
3810
4724
|
}
|
|
3811
4725
|
};
|
|
3812
|
-
var customProcessor = (
|
|
3813
|
-
|
|
3814
|
-
throw new Error("Custom types cannot be represented in JSON Schema");
|
|
3815
|
-
}
|
|
4726
|
+
var customProcessor = (schema, ctx, json, params) => {
|
|
4727
|
+
handleUnrepresentable(schema, ctx, json, params, "Custom types cannot be represented in JSON Schema");
|
|
3816
4728
|
};
|
|
3817
|
-
var transformProcessor = (
|
|
3818
|
-
|
|
3819
|
-
throw new Error("Transforms cannot be represented in JSON Schema");
|
|
3820
|
-
}
|
|
4729
|
+
var transformProcessor = (schema, ctx, json, params) => {
|
|
4730
|
+
handleUnrepresentable(schema, ctx, json, params, "Transforms cannot be represented in JSON Schema");
|
|
3821
4731
|
};
|
|
3822
4732
|
var arrayProcessor = (schema, ctx, _json, params) => {
|
|
3823
4733
|
const json = _json;
|
|
@@ -3828,27 +4738,44 @@ var arrayProcessor = (schema, ctx, _json, params) => {
|
|
|
3828
4738
|
if (typeof maximum === "number")
|
|
3829
4739
|
json.maxItems = maximum;
|
|
3830
4740
|
json.type = "array";
|
|
3831
|
-
json.items = process(def.element, ctx, {
|
|
4741
|
+
json.items = process(def.element, ctx, {
|
|
4742
|
+
...params,
|
|
4743
|
+
path: [...params.path, "items"]
|
|
4744
|
+
});
|
|
3832
4745
|
};
|
|
4746
|
+
function inputOptin(schema) {
|
|
4747
|
+
const def = schema._zod.def;
|
|
4748
|
+
if (def.type === "pipe" && def.in._zod.traits.has("$ZodTransform")) {
|
|
4749
|
+
return inputOptin(def.out);
|
|
4750
|
+
}
|
|
4751
|
+
if (def.type === "catch") {
|
|
4752
|
+
return inputOptin(def.innerType);
|
|
4753
|
+
}
|
|
4754
|
+
return schema._zod.optin;
|
|
4755
|
+
}
|
|
3833
4756
|
var objectProcessor = (schema, ctx, _json, params) => {
|
|
3834
4757
|
const json = _json;
|
|
3835
4758
|
const def = schema._zod.def;
|
|
4759
|
+
const shape = def.shape;
|
|
4760
|
+
const symbolKeys = Object.getOwnPropertySymbols(shape);
|
|
4761
|
+
if (symbolKeys.length && handleUnrepresentable(schema, ctx, json, params, "Symbol keys cannot be represented in JSON Schema")) {
|
|
4762
|
+
return;
|
|
4763
|
+
}
|
|
3836
4764
|
json.type = "object";
|
|
3837
4765
|
json.properties = {};
|
|
3838
|
-
const shape = def.shape;
|
|
3839
4766
|
for (const key in shape) {
|
|
3840
|
-
json.properties
|
|
4767
|
+
assignProp(json.properties, key, process(shape[key], ctx, {
|
|
3841
4768
|
...params,
|
|
3842
4769
|
path: [...params.path, "properties", key]
|
|
3843
|
-
});
|
|
4770
|
+
}));
|
|
3844
4771
|
}
|
|
3845
4772
|
const allKeys = new Set(Object.keys(shape));
|
|
3846
4773
|
const requiredKeys = new Set([...allKeys].filter((key) => {
|
|
3847
|
-
const
|
|
4774
|
+
const field = def.shape[key];
|
|
3848
4775
|
if (ctx.io === "input") {
|
|
3849
|
-
return
|
|
4776
|
+
return inputOptin(field) === undefined;
|
|
3850
4777
|
} else {
|
|
3851
|
-
return
|
|
4778
|
+
return field._zod.optout === undefined;
|
|
3852
4779
|
}
|
|
3853
4780
|
}));
|
|
3854
4781
|
if (requiredKeys.size > 0) {
|
|
@@ -3895,6 +4822,7 @@ var intersectionProcessor = (schema, ctx, json, params) => {
|
|
|
3895
4822
|
...isSimpleIntersection(b) ? b.allOf : [b]
|
|
3896
4823
|
];
|
|
3897
4824
|
json.allOf = allOf;
|
|
4825
|
+
ctx.intersections.push(allOf);
|
|
3898
4826
|
};
|
|
3899
4827
|
var tupleProcessor = (schema, ctx, _json, params) => {
|
|
3900
4828
|
const json = _json;
|
|
@@ -3910,11 +4838,27 @@ var tupleProcessor = (schema, ctx, _json, params) => {
|
|
|
3910
4838
|
...params,
|
|
3911
4839
|
path: [...params.path, restPath, ...ctx.target === "openapi-3.0" ? [def.items.length] : []]
|
|
3912
4840
|
}) : null;
|
|
4841
|
+
let minItems = def.items.length;
|
|
4842
|
+
while (minItems > 0) {
|
|
4843
|
+
const item = def.items[minItems - 1];
|
|
4844
|
+
const optional = ctx.io === "input" ? inputOptin(item) !== undefined : item._zod.optout === "optional";
|
|
4845
|
+
if (!optional)
|
|
4846
|
+
break;
|
|
4847
|
+
minItems--;
|
|
4848
|
+
}
|
|
4849
|
+
const maxItems = def.items.length;
|
|
4850
|
+
const isClosed = !def.rest;
|
|
3913
4851
|
if (ctx.target === "draft-2020-12") {
|
|
3914
4852
|
json.prefixItems = prefixItems;
|
|
3915
|
-
if (
|
|
4853
|
+
if (isClosed) {
|
|
4854
|
+
json.items = false;
|
|
4855
|
+
} else if (rest) {
|
|
3916
4856
|
json.items = rest;
|
|
3917
4857
|
}
|
|
4858
|
+
if (minItems > 0)
|
|
4859
|
+
json.minItems = minItems;
|
|
4860
|
+
if (isClosed)
|
|
4861
|
+
json.maxItems = maxItems;
|
|
3918
4862
|
} else if (ctx.target === "openapi-3.0") {
|
|
3919
4863
|
json.items = {
|
|
3920
4864
|
anyOf: prefixItems
|
|
@@ -3922,15 +4866,21 @@ var tupleProcessor = (schema, ctx, _json, params) => {
|
|
|
3922
4866
|
if (rest) {
|
|
3923
4867
|
json.items.anyOf.push(rest);
|
|
3924
4868
|
}
|
|
3925
|
-
|
|
3926
|
-
|
|
3927
|
-
|
|
3928
|
-
|
|
4869
|
+
if (minItems > 0)
|
|
4870
|
+
json.minItems = minItems;
|
|
4871
|
+
if (isClosed)
|
|
4872
|
+
json.maxItems = maxItems;
|
|
3929
4873
|
} else {
|
|
3930
4874
|
json.items = prefixItems;
|
|
3931
|
-
if (
|
|
4875
|
+
if (isClosed) {
|
|
4876
|
+
json.additionalItems = false;
|
|
4877
|
+
} else if (rest) {
|
|
3932
4878
|
json.additionalItems = rest;
|
|
3933
4879
|
}
|
|
4880
|
+
if (minItems > 0)
|
|
4881
|
+
json.minItems = minItems;
|
|
4882
|
+
if (isClosed)
|
|
4883
|
+
json.maxItems = maxItems;
|
|
3934
4884
|
}
|
|
3935
4885
|
const { minimum, maximum } = schema._zod.bag;
|
|
3936
4886
|
if (typeof minimum === "number")
|
|
@@ -3938,6 +4888,69 @@ var tupleProcessor = (schema, ctx, _json, params) => {
|
|
|
3938
4888
|
if (typeof maximum === "number")
|
|
3939
4889
|
json.maxItems = maximum;
|
|
3940
4890
|
};
|
|
4891
|
+
function stringifyKeyNames(bySchema, json, visited) {
|
|
4892
|
+
if (json.$ref) {
|
|
4893
|
+
if (visited.has(json))
|
|
4894
|
+
return json;
|
|
4895
|
+
visited.add(json);
|
|
4896
|
+
const def = bySchema.get(json)?.def;
|
|
4897
|
+
if (!def)
|
|
4898
|
+
return json;
|
|
4899
|
+
const inlined = stringifyKeyNames(bySchema, def, visited);
|
|
4900
|
+
return inlined === def ? json : inlined;
|
|
4901
|
+
}
|
|
4902
|
+
for (const keyword of ["anyOf", "oneOf"]) {
|
|
4903
|
+
const branches = json[keyword];
|
|
4904
|
+
if (!Array.isArray(branches))
|
|
4905
|
+
continue;
|
|
4906
|
+
const mapped = branches.map((branch) => stringifyKeyNames(bySchema, branch, visited));
|
|
4907
|
+
if (mapped.some((branch, i) => branch !== branches[i]))
|
|
4908
|
+
json = { ...json, [keyword]: mapped };
|
|
4909
|
+
}
|
|
4910
|
+
const types = Array.isArray(json.type) ? json.type : [json.type];
|
|
4911
|
+
const numericType = !types.includes("string") && types.some((t) => t === "number" || t === "integer");
|
|
4912
|
+
const values = json.enum ?? (json.const !== undefined ? [json.const] : undefined);
|
|
4913
|
+
if (!numericType && !values?.some((v) => typeof v === "number"))
|
|
4914
|
+
return json;
|
|
4915
|
+
const { minimum, maximum, exclusiveMinimum, exclusiveMaximum, multipleOf, format, id, ...rest } = json;
|
|
4916
|
+
if (rest.enum)
|
|
4917
|
+
rest.enum = rest.enum.map((v) => typeof v === "number" ? String(v) : v);
|
|
4918
|
+
else if (typeof rest.const === "number")
|
|
4919
|
+
rest.const = String(rest.const);
|
|
4920
|
+
if (!numericType)
|
|
4921
|
+
return rest;
|
|
4922
|
+
rest.type = "string";
|
|
4923
|
+
if (!values)
|
|
4924
|
+
rest.pattern = (types.includes("number") ? number : integer).source;
|
|
4925
|
+
return rest;
|
|
4926
|
+
}
|
|
4927
|
+
var pendingRecords = new WeakMap;
|
|
4928
|
+
function rewriteKeyNames(ctx) {
|
|
4929
|
+
const bySchema = new Map;
|
|
4930
|
+
for (const entry of ctx.seen.values()) {
|
|
4931
|
+
if (entry.def && !bySchema.has(entry.schema))
|
|
4932
|
+
bySchema.set(entry.schema, entry);
|
|
4933
|
+
}
|
|
4934
|
+
const rewrites = new Map;
|
|
4935
|
+
for (const record of pendingRecords.get(ctx) ?? []) {
|
|
4936
|
+
const seen = ctx.seen.get(record);
|
|
4937
|
+
const names = (seen?.def ?? seen?.schema)?.propertyNames;
|
|
4938
|
+
if (!names || names === true || rewrites.has(names))
|
|
4939
|
+
continue;
|
|
4940
|
+
const rewritten = stringifyKeyNames(bySchema, names, new Set);
|
|
4941
|
+
if (rewritten !== names)
|
|
4942
|
+
rewrites.set(names, rewritten);
|
|
4943
|
+
}
|
|
4944
|
+
if (!rewrites.size)
|
|
4945
|
+
return;
|
|
4946
|
+
for (const entry of ctx.seen.values()) {
|
|
4947
|
+
for (const carrier of [entry.schema, entry.def]) {
|
|
4948
|
+
const rewritten = carrier && rewrites.get(carrier.propertyNames);
|
|
4949
|
+
if (rewritten)
|
|
4950
|
+
carrier.propertyNames = rewritten;
|
|
4951
|
+
}
|
|
4952
|
+
}
|
|
4953
|
+
}
|
|
3941
4954
|
var recordProcessor = (schema, ctx, _json, params) => {
|
|
3942
4955
|
const json = _json;
|
|
3943
4956
|
const def = schema._zod.def;
|
|
@@ -3952,7 +4965,7 @@ var recordProcessor = (schema, ctx, _json, params) => {
|
|
|
3952
4965
|
});
|
|
3953
4966
|
json.patternProperties = {};
|
|
3954
4967
|
for (const pattern of patterns) {
|
|
3955
|
-
json.patternProperties
|
|
4968
|
+
assignProp(json.patternProperties, pattern.source, valueSchema);
|
|
3956
4969
|
}
|
|
3957
4970
|
} else {
|
|
3958
4971
|
if (ctx.target === "draft-07" || ctx.target === "draft-2020-12") {
|
|
@@ -3960,6 +4973,13 @@ var recordProcessor = (schema, ctx, _json, params) => {
|
|
|
3960
4973
|
...params,
|
|
3961
4974
|
path: [...params.path, "propertyNames"]
|
|
3962
4975
|
});
|
|
4976
|
+
let pending = pendingRecords.get(ctx);
|
|
4977
|
+
if (!pending) {
|
|
4978
|
+
pending = [];
|
|
4979
|
+
pendingRecords.set(ctx, pending);
|
|
4980
|
+
ctx.deferred.push(() => rewriteKeyNames(ctx));
|
|
4981
|
+
}
|
|
4982
|
+
pending.push(schema);
|
|
3963
4983
|
}
|
|
3964
4984
|
json.additionalProperties = process(def.valueType, ctx, {
|
|
3965
4985
|
...params,
|
|
@@ -3967,10 +4987,11 @@ var recordProcessor = (schema, ctx, _json, params) => {
|
|
|
3967
4987
|
});
|
|
3968
4988
|
}
|
|
3969
4989
|
const keyValues = keyType._zod.values;
|
|
3970
|
-
|
|
4990
|
+
const omittableOnInput = ctx.io === "input" && inputOptin(def.valueType) !== undefined;
|
|
4991
|
+
if (keyValues && !def.partial && !omittableOnInput) {
|
|
3971
4992
|
const validKeyValues = [...keyValues].filter((v) => typeof v === "string" || typeof v === "number");
|
|
3972
4993
|
if (validKeyValues.length > 0) {
|
|
3973
|
-
json.required = validKeyValues;
|
|
4994
|
+
json.required = validKeyValues.map(String);
|
|
3974
4995
|
}
|
|
3975
4996
|
}
|
|
3976
4997
|
};
|
|
@@ -3991,20 +5012,39 @@ var nonoptionalProcessor = (schema, ctx, _json, params) => {
|
|
|
3991
5012
|
const seen = ctx.seen.get(schema);
|
|
3992
5013
|
seen.ref = def.innerType;
|
|
3993
5014
|
};
|
|
5015
|
+
var UNREPRESENTABLE_DEFAULT = Symbol();
|
|
5016
|
+
function serializeDefaultValue(value, schema, ctx, json, params) {
|
|
5017
|
+
let unrepresentable = false;
|
|
5018
|
+
const serialized = JSON.stringify(value, (_, val) => {
|
|
5019
|
+
if (typeof val !== "bigint")
|
|
5020
|
+
return val;
|
|
5021
|
+
unrepresentable = true;
|
|
5022
|
+
return null;
|
|
5023
|
+
});
|
|
5024
|
+
if (!unrepresentable)
|
|
5025
|
+
return JSON.parse(serialized);
|
|
5026
|
+
handleUnrepresentable(schema, ctx, json, params, "BigInt defaults cannot be represented in JSON Schema");
|
|
5027
|
+
return UNREPRESENTABLE_DEFAULT;
|
|
5028
|
+
}
|
|
3994
5029
|
var defaultProcessor = (schema, ctx, json, params) => {
|
|
3995
5030
|
const def = schema._zod.def;
|
|
3996
5031
|
process(def.innerType, ctx, params);
|
|
3997
5032
|
const seen = ctx.seen.get(schema);
|
|
3998
5033
|
seen.ref = def.innerType;
|
|
3999
|
-
|
|
5034
|
+
const value = serializeDefaultValue(def.defaultValue, schema, ctx, json, params);
|
|
5035
|
+
if (value !== UNREPRESENTABLE_DEFAULT)
|
|
5036
|
+
json.default = value;
|
|
4000
5037
|
};
|
|
4001
5038
|
var prefaultProcessor = (schema, ctx, json, params) => {
|
|
4002
5039
|
const def = schema._zod.def;
|
|
4003
5040
|
process(def.innerType, ctx, params);
|
|
4004
5041
|
const seen = ctx.seen.get(schema);
|
|
4005
5042
|
seen.ref = def.innerType;
|
|
4006
|
-
if (ctx.io
|
|
4007
|
-
|
|
5043
|
+
if (ctx.io !== "input")
|
|
5044
|
+
return;
|
|
5045
|
+
const value = serializeDefaultValue(def.defaultValue, schema, ctx, json, params);
|
|
5046
|
+
if (value !== UNREPRESENTABLE_DEFAULT)
|
|
5047
|
+
json._prefault = value;
|
|
4008
5048
|
};
|
|
4009
5049
|
var catchProcessor = (schema, ctx, json, params) => {
|
|
4010
5050
|
const def = schema._zod.def;
|
|
@@ -4015,13 +5055,15 @@ var catchProcessor = (schema, ctx, json, params) => {
|
|
|
4015
5055
|
try {
|
|
4016
5056
|
catchValue = def.catchValue(undefined);
|
|
4017
5057
|
} catch {
|
|
4018
|
-
|
|
5058
|
+
handleUnrepresentable(schema, ctx, json, params, "Dynamic catch values are not supported in JSON Schema");
|
|
5059
|
+
return;
|
|
4019
5060
|
}
|
|
4020
5061
|
json.default = catchValue;
|
|
4021
5062
|
};
|
|
4022
5063
|
var pipeProcessor = (schema, ctx, _json, params) => {
|
|
4023
5064
|
const def = schema._zod.def;
|
|
4024
|
-
const
|
|
5065
|
+
const inIsTransform = def.in._zod.traits.has("$ZodTransform");
|
|
5066
|
+
const innerType = ctx.io === "input" ? inIsTransform ? def.out : def.in : def.out;
|
|
4025
5067
|
process(innerType, ctx, params);
|
|
4026
5068
|
const seen = ctx.seen.get(schema);
|
|
4027
5069
|
seen.ref = innerType;
|
|
@@ -4045,72 +5087,52 @@ var lazyProcessor = (schema, ctx, _json, params) => {
|
|
|
4045
5087
|
const seen = ctx.seen.get(schema);
|
|
4046
5088
|
seen.ref = innerType;
|
|
4047
5089
|
};
|
|
4048
|
-
// ../../node_modules/.bun/zod@4.
|
|
4049
|
-
var
|
|
4050
|
-
|
|
4051
|
-
|
|
4052
|
-
|
|
4053
|
-
|
|
4054
|
-
|
|
4055
|
-
|
|
4056
|
-
|
|
4057
|
-
|
|
4058
|
-
|
|
4059
|
-
|
|
4060
|
-
|
|
4061
|
-
|
|
4062
|
-
}
|
|
4063
|
-
var ZodISOTime = /* @__PURE__ */ $constructor("ZodISOTime", (inst, def) => {
|
|
4064
|
-
$ZodISOTime.init(inst, def);
|
|
4065
|
-
ZodStringFormat.init(inst, def);
|
|
4066
|
-
});
|
|
4067
|
-
function time2(params) {
|
|
4068
|
-
return _isoTime(ZodISOTime, params);
|
|
4069
|
-
}
|
|
4070
|
-
var ZodISODuration = /* @__PURE__ */ $constructor("ZodISODuration", (inst, def) => {
|
|
4071
|
-
$ZodISODuration.init(inst, def);
|
|
4072
|
-
ZodStringFormat.init(inst, def);
|
|
4073
|
-
});
|
|
4074
|
-
function duration2(params) {
|
|
4075
|
-
return _isoDuration(ZodISODuration, params);
|
|
5090
|
+
// ../../node_modules/.bun/zod@4.5.4/node_modules/zod/v4/classic/errors.js
|
|
5091
|
+
var _installedErrorProtos = /* @__PURE__ */ new WeakSet([Object.prototype, Error.prototype]);
|
|
5092
|
+
function _lazyMethod(proto, key, make) {
|
|
5093
|
+
Object.defineProperty(proto, key, {
|
|
5094
|
+
configurable: true,
|
|
5095
|
+
enumerable: false,
|
|
5096
|
+
get() {
|
|
5097
|
+
const value = make(this);
|
|
5098
|
+
Object.defineProperty(this, key, { value, configurable: true, writable: true });
|
|
5099
|
+
return value;
|
|
5100
|
+
},
|
|
5101
|
+
set(value) {
|
|
5102
|
+
Object.defineProperty(this, key, { value, configurable: true, writable: true });
|
|
5103
|
+
}
|
|
5104
|
+
});
|
|
4076
5105
|
}
|
|
4077
|
-
|
|
4078
|
-
// ../../node_modules/.bun/zod@4.3.6/node_modules/zod/v4/classic/errors.js
|
|
4079
5106
|
var initializer2 = (inst, issues) => {
|
|
4080
5107
|
$ZodError.init(inst, issues);
|
|
4081
5108
|
inst.name = "ZodError";
|
|
4082
|
-
Object.
|
|
4083
|
-
|
|
4084
|
-
|
|
4085
|
-
|
|
4086
|
-
|
|
4087
|
-
|
|
4088
|
-
|
|
4089
|
-
|
|
4090
|
-
|
|
4091
|
-
|
|
4092
|
-
|
|
4093
|
-
|
|
4094
|
-
|
|
4095
|
-
|
|
4096
|
-
|
|
4097
|
-
|
|
4098
|
-
|
|
4099
|
-
|
|
4100
|
-
|
|
4101
|
-
isEmpty: {
|
|
4102
|
-
get() {
|
|
4103
|
-
return inst.issues.length === 0;
|
|
4104
|
-
}
|
|
5109
|
+
const proto = Object.getPrototypeOf(inst);
|
|
5110
|
+
if (_installedErrorProtos.has(proto))
|
|
5111
|
+
return;
|
|
5112
|
+
_installedErrorProtos.add(proto);
|
|
5113
|
+
_lazyMethod(proto, "format", (self) => (mapper) => formatError(self, mapper));
|
|
5114
|
+
_lazyMethod(proto, "flatten", (self) => (mapper) => flattenError(self, mapper));
|
|
5115
|
+
_lazyMethod(proto, "addIssue", (self) => (issue) => {
|
|
5116
|
+
self.issues.push(issue);
|
|
5117
|
+
self.message = JSON.stringify(self.issues, jsonStringifyReplacer, 2);
|
|
5118
|
+
});
|
|
5119
|
+
_lazyMethod(proto, "addIssues", (self) => (issues) => {
|
|
5120
|
+
self.issues.push(...issues);
|
|
5121
|
+
self.message = JSON.stringify(self.issues, jsonStringifyReplacer, 2);
|
|
5122
|
+
});
|
|
5123
|
+
Object.defineProperty(proto, "isEmpty", {
|
|
5124
|
+
configurable: true,
|
|
5125
|
+
enumerable: false,
|
|
5126
|
+
get() {
|
|
5127
|
+
return this.issues.length === 0;
|
|
4105
5128
|
}
|
|
4106
5129
|
});
|
|
4107
5130
|
};
|
|
4108
|
-
var
|
|
4109
|
-
var ZodRealError = $constructor("ZodError", initializer2, {
|
|
5131
|
+
var ZodRealError = /* @__PURE__ */ $constructor("ZodError", initializer2, undefined, {
|
|
4110
5132
|
Parent: Error
|
|
4111
5133
|
});
|
|
4112
5134
|
|
|
4113
|
-
// ../../node_modules/.bun/zod@4.
|
|
5135
|
+
// ../../node_modules/.bun/zod@4.5.4/node_modules/zod/v4/classic/parse.js
|
|
4114
5136
|
var parse3 = /* @__PURE__ */ _parse(ZodRealError);
|
|
4115
5137
|
var parseAsync2 = /* @__PURE__ */ _parseAsync(ZodRealError);
|
|
4116
5138
|
var safeParse2 = /* @__PURE__ */ _safeParse(ZodRealError);
|
|
@@ -4124,89 +5146,179 @@ var safeDecode = /* @__PURE__ */ _safeDecode(ZodRealError);
|
|
|
4124
5146
|
var safeEncodeAsync = /* @__PURE__ */ _safeEncodeAsync(ZodRealError);
|
|
4125
5147
|
var safeDecodeAsync = /* @__PURE__ */ _safeDecodeAsync(ZodRealError);
|
|
4126
5148
|
|
|
4127
|
-
// ../../node_modules/.bun/zod@4.
|
|
5149
|
+
// ../../node_modules/.bun/zod@4.5.4/node_modules/zod/v4/classic/schemas.js
|
|
5150
|
+
function _ensureDefaultLocale() {
|
|
5151
|
+
if (!globalConfig.localeError)
|
|
5152
|
+
config(en_default());
|
|
5153
|
+
}
|
|
5154
|
+
function _ensureDefaultMemoizer() {
|
|
5155
|
+
if (!globalConfig.memoizer)
|
|
5156
|
+
config({ memoizer: memoizer() });
|
|
5157
|
+
}
|
|
4128
5158
|
var ZodType = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
|
|
5159
|
+
_ensureDefaultLocale();
|
|
4129
5160
|
$ZodType.init(inst, def);
|
|
4130
|
-
Object.assign(inst["~standard"], {
|
|
4131
|
-
jsonSchema: {
|
|
4132
|
-
input: createStandardJSONSchemaMethod(inst, "input"),
|
|
4133
|
-
output: createStandardJSONSchemaMethod(inst, "output")
|
|
4134
|
-
}
|
|
4135
|
-
});
|
|
4136
|
-
inst.toJSONSchema = createToJSONSchemaMethod(inst, {});
|
|
4137
5161
|
inst.def = def;
|
|
4138
5162
|
inst.type = def.type;
|
|
4139
|
-
|
|
4140
|
-
|
|
4141
|
-
|
|
5163
|
+
return inst;
|
|
5164
|
+
}, {
|
|
5165
|
+
check(...chks) {
|
|
5166
|
+
const def = this.def;
|
|
5167
|
+
return this.clone(mergeDefs(def, {
|
|
4142
5168
|
checks: [
|
|
4143
5169
|
...def.checks ?? [],
|
|
4144
|
-
...
|
|
5170
|
+
...chks.map((ch) => typeof ch === "function" ? { _zod: { check: ch, def: { check: "custom" }, onattach: [] } } : ch)
|
|
4145
5171
|
]
|
|
4146
|
-
}), {
|
|
4147
|
-
|
|
4148
|
-
|
|
4149
|
-
|
|
4150
|
-
|
|
4151
|
-
|
|
4152
|
-
|
|
4153
|
-
|
|
4154
|
-
|
|
4155
|
-
return
|
|
4156
|
-
}
|
|
4157
|
-
|
|
4158
|
-
|
|
4159
|
-
|
|
4160
|
-
|
|
4161
|
-
|
|
4162
|
-
|
|
4163
|
-
|
|
4164
|
-
|
|
4165
|
-
|
|
4166
|
-
|
|
4167
|
-
|
|
4168
|
-
|
|
4169
|
-
|
|
4170
|
-
|
|
4171
|
-
|
|
4172
|
-
|
|
4173
|
-
|
|
4174
|
-
|
|
4175
|
-
|
|
4176
|
-
|
|
4177
|
-
|
|
4178
|
-
|
|
4179
|
-
|
|
4180
|
-
|
|
4181
|
-
|
|
4182
|
-
|
|
4183
|
-
|
|
4184
|
-
|
|
4185
|
-
|
|
4186
|
-
|
|
4187
|
-
|
|
4188
|
-
|
|
5172
|
+
}), { parent: true });
|
|
5173
|
+
},
|
|
5174
|
+
with(...chks) {
|
|
5175
|
+
return this.check(...chks);
|
|
5176
|
+
},
|
|
5177
|
+
clone(def, params) {
|
|
5178
|
+
return clone(this, def, params);
|
|
5179
|
+
},
|
|
5180
|
+
brand() {
|
|
5181
|
+
return this;
|
|
5182
|
+
},
|
|
5183
|
+
register(reg, meta) {
|
|
5184
|
+
reg.add(this, meta);
|
|
5185
|
+
return this;
|
|
5186
|
+
},
|
|
5187
|
+
refine(check, params) {
|
|
5188
|
+
return this.check(refine(check, params));
|
|
5189
|
+
},
|
|
5190
|
+
superRefine(refinement, params) {
|
|
5191
|
+
return this.check(superRefine(refinement, params));
|
|
5192
|
+
},
|
|
5193
|
+
overwrite(fn) {
|
|
5194
|
+
return this.check(_overwrite(fn));
|
|
5195
|
+
},
|
|
5196
|
+
optional() {
|
|
5197
|
+
return optional(this);
|
|
5198
|
+
},
|
|
5199
|
+
exactOptional() {
|
|
5200
|
+
return exactOptional(this);
|
|
5201
|
+
},
|
|
5202
|
+
nullable() {
|
|
5203
|
+
return nullable(this);
|
|
5204
|
+
},
|
|
5205
|
+
nullish() {
|
|
5206
|
+
return optional(nullable(this));
|
|
5207
|
+
},
|
|
5208
|
+
nonoptional(params) {
|
|
5209
|
+
return nonoptional(this, params);
|
|
5210
|
+
},
|
|
5211
|
+
array() {
|
|
5212
|
+
return array(this);
|
|
5213
|
+
},
|
|
5214
|
+
or(arg) {
|
|
5215
|
+
return union([this, arg]);
|
|
5216
|
+
},
|
|
5217
|
+
and(arg) {
|
|
5218
|
+
return intersection(this, arg);
|
|
5219
|
+
},
|
|
5220
|
+
transform(tx) {
|
|
5221
|
+
return pipe(this, transform(tx));
|
|
5222
|
+
},
|
|
5223
|
+
default(d) {
|
|
5224
|
+
return _default(this, d);
|
|
5225
|
+
},
|
|
5226
|
+
prefault(d) {
|
|
5227
|
+
return prefault(this, d);
|
|
5228
|
+
},
|
|
5229
|
+
catch(params) {
|
|
5230
|
+
return _catch(this, params);
|
|
5231
|
+
},
|
|
5232
|
+
pipe(target) {
|
|
5233
|
+
return pipe(this, target);
|
|
5234
|
+
},
|
|
5235
|
+
readonly() {
|
|
5236
|
+
return readonly(this);
|
|
5237
|
+
},
|
|
5238
|
+
describe(description) {
|
|
5239
|
+
const cl = this.clone();
|
|
4189
5240
|
globalRegistry.add(cl, { description });
|
|
4190
5241
|
return cl;
|
|
4191
|
-
}
|
|
4192
|
-
|
|
4193
|
-
|
|
4194
|
-
return globalRegistry.get(
|
|
4195
|
-
|
|
4196
|
-
configurable: true
|
|
4197
|
-
});
|
|
4198
|
-
inst.meta = (...args) => {
|
|
4199
|
-
if (args.length === 0) {
|
|
4200
|
-
return globalRegistry.get(inst);
|
|
4201
|
-
}
|
|
4202
|
-
const cl = inst.clone();
|
|
5242
|
+
},
|
|
5243
|
+
meta(...args) {
|
|
5244
|
+
if (args.length === 0)
|
|
5245
|
+
return globalRegistry.get(this);
|
|
5246
|
+
const cl = this.clone();
|
|
4203
5247
|
globalRegistry.add(cl, args[0]);
|
|
4204
5248
|
return cl;
|
|
4205
|
-
}
|
|
4206
|
-
|
|
4207
|
-
|
|
4208
|
-
|
|
4209
|
-
|
|
5249
|
+
},
|
|
5250
|
+
isOptional() {
|
|
5251
|
+
return this.safeParse(undefined).success;
|
|
5252
|
+
},
|
|
5253
|
+
isNullable() {
|
|
5254
|
+
return this.safeParse(null).success;
|
|
5255
|
+
},
|
|
5256
|
+
apply(fn, ...args) {
|
|
5257
|
+
return args.length === 0 ? fn(this) : fn(this, ...args);
|
|
5258
|
+
},
|
|
5259
|
+
get "~standard"() {
|
|
5260
|
+
return hide(this, "~standard", {
|
|
5261
|
+
...standardProps(this),
|
|
5262
|
+
jsonSchema: {
|
|
5263
|
+
input: createStandardJSONSchemaMethod(this, "input"),
|
|
5264
|
+
output: createStandardJSONSchemaMethod(this, "output")
|
|
5265
|
+
}
|
|
5266
|
+
});
|
|
5267
|
+
},
|
|
5268
|
+
set "~standard"(value) {
|
|
5269
|
+
own(this, "~standard", value);
|
|
5270
|
+
},
|
|
5271
|
+
parse: function _parse(data, params) {
|
|
5272
|
+
return parse3(this, data, params, { callee: _parse });
|
|
5273
|
+
},
|
|
5274
|
+
parseAsync: async function _parseAsync(data, params) {
|
|
5275
|
+
return await parseAsync2(this, data, params, { callee: _parseAsync });
|
|
5276
|
+
},
|
|
5277
|
+
safeParse(data, params) {
|
|
5278
|
+
return safeParse2(this, data, params);
|
|
5279
|
+
},
|
|
5280
|
+
async safeParseAsync(data, params) {
|
|
5281
|
+
return safeParseAsync2(this, data, params);
|
|
5282
|
+
},
|
|
5283
|
+
get spa() {
|
|
5284
|
+
return this?.safeParseAsync;
|
|
5285
|
+
},
|
|
5286
|
+
set spa(value) {
|
|
5287
|
+
own(this, "spa", value);
|
|
5288
|
+
},
|
|
5289
|
+
encode: function _encode(data, params) {
|
|
5290
|
+
return encode(this, data, params, { callee: _encode });
|
|
5291
|
+
},
|
|
5292
|
+
decode: function _decode(data, params) {
|
|
5293
|
+
return decode(this, data, params, { callee: _decode });
|
|
5294
|
+
},
|
|
5295
|
+
encodeAsync: async function _encodeAsync(data, params) {
|
|
5296
|
+
return await encodeAsync(this, data, params, { callee: _encodeAsync });
|
|
5297
|
+
},
|
|
5298
|
+
decodeAsync: async function _decodeAsync(data, params) {
|
|
5299
|
+
return await decodeAsync(this, data, params, { callee: _decodeAsync });
|
|
5300
|
+
},
|
|
5301
|
+
safeEncode(data, params) {
|
|
5302
|
+
return safeEncode(this, data, params);
|
|
5303
|
+
},
|
|
5304
|
+
safeDecode(data, params) {
|
|
5305
|
+
return safeDecode(this, data, params);
|
|
5306
|
+
},
|
|
5307
|
+
async safeEncodeAsync(data, params) {
|
|
5308
|
+
return safeEncodeAsync(this, data, params);
|
|
5309
|
+
},
|
|
5310
|
+
async safeDecodeAsync(data, params) {
|
|
5311
|
+
return safeDecodeAsync(this, data, params);
|
|
5312
|
+
},
|
|
5313
|
+
toJSONSchema(params) {
|
|
5314
|
+
return createToJSONSchemaMethod(this, {})(params);
|
|
5315
|
+
},
|
|
5316
|
+
get description() {
|
|
5317
|
+
return globalRegistry.get(this)?.description;
|
|
5318
|
+
},
|
|
5319
|
+
get _def() {
|
|
5320
|
+
return this._zod.def;
|
|
5321
|
+
}
|
|
4210
5322
|
});
|
|
4211
5323
|
var _ZodString = /* @__PURE__ */ $constructor("_ZodString", (inst, def) => {
|
|
4212
5324
|
$ZodString.init(inst, def);
|
|
@@ -4216,52 +5328,135 @@ var _ZodString = /* @__PURE__ */ $constructor("_ZodString", (inst, def) => {
|
|
|
4216
5328
|
inst.format = bag.format ?? null;
|
|
4217
5329
|
inst.minLength = bag.minimum ?? null;
|
|
4218
5330
|
inst.maxLength = bag.maximum ?? null;
|
|
4219
|
-
|
|
4220
|
-
|
|
4221
|
-
|
|
4222
|
-
|
|
4223
|
-
|
|
4224
|
-
|
|
4225
|
-
|
|
4226
|
-
|
|
4227
|
-
|
|
4228
|
-
|
|
4229
|
-
|
|
4230
|
-
|
|
4231
|
-
|
|
4232
|
-
|
|
4233
|
-
|
|
5331
|
+
}, {
|
|
5332
|
+
regex(...args) {
|
|
5333
|
+
return this.check(_regex(...args));
|
|
5334
|
+
},
|
|
5335
|
+
includes(...args) {
|
|
5336
|
+
return this.check(_includes(...args));
|
|
5337
|
+
},
|
|
5338
|
+
startsWith(...args) {
|
|
5339
|
+
return this.check(_startsWith(...args));
|
|
5340
|
+
},
|
|
5341
|
+
endsWith(...args) {
|
|
5342
|
+
return this.check(_endsWith(...args));
|
|
5343
|
+
},
|
|
5344
|
+
min(...args) {
|
|
5345
|
+
return this.check(_minLength(...args));
|
|
5346
|
+
},
|
|
5347
|
+
max(...args) {
|
|
5348
|
+
return this.check(_maxLength(...args));
|
|
5349
|
+
},
|
|
5350
|
+
length(...args) {
|
|
5351
|
+
return this.check(_length(...args));
|
|
5352
|
+
},
|
|
5353
|
+
nonempty(...args) {
|
|
5354
|
+
return this.check(_minLength(1, ...args));
|
|
5355
|
+
},
|
|
5356
|
+
lowercase(params) {
|
|
5357
|
+
return this.check(_lowercase(params));
|
|
5358
|
+
},
|
|
5359
|
+
uppercase(params) {
|
|
5360
|
+
return this.check(_uppercase(params));
|
|
5361
|
+
},
|
|
5362
|
+
trim() {
|
|
5363
|
+
return this.check(_trim());
|
|
5364
|
+
},
|
|
5365
|
+
normalize(...args) {
|
|
5366
|
+
return this.check(_normalize(...args));
|
|
5367
|
+
},
|
|
5368
|
+
toLowerCase() {
|
|
5369
|
+
return this.check(_toLowerCase());
|
|
5370
|
+
},
|
|
5371
|
+
toUpperCase() {
|
|
5372
|
+
return this.check(_toUpperCase());
|
|
5373
|
+
},
|
|
5374
|
+
slugify() {
|
|
5375
|
+
return this.check(_slugify());
|
|
5376
|
+
}
|
|
4234
5377
|
});
|
|
4235
5378
|
var ZodString = /* @__PURE__ */ $constructor("ZodString", (inst, def) => {
|
|
4236
5379
|
$ZodString.init(inst, def);
|
|
4237
5380
|
_ZodString.init(inst, def);
|
|
4238
|
-
|
|
4239
|
-
|
|
4240
|
-
|
|
4241
|
-
|
|
4242
|
-
|
|
4243
|
-
|
|
4244
|
-
|
|
4245
|
-
|
|
4246
|
-
|
|
4247
|
-
|
|
4248
|
-
|
|
4249
|
-
|
|
4250
|
-
|
|
4251
|
-
|
|
4252
|
-
|
|
4253
|
-
|
|
4254
|
-
|
|
4255
|
-
|
|
4256
|
-
|
|
4257
|
-
|
|
4258
|
-
|
|
4259
|
-
|
|
4260
|
-
|
|
4261
|
-
|
|
4262
|
-
|
|
4263
|
-
|
|
4264
|
-
|
|
5381
|
+
}, {
|
|
5382
|
+
email(params) {
|
|
5383
|
+
return this.check(_email(ZodEmail, params));
|
|
5384
|
+
},
|
|
5385
|
+
url(params) {
|
|
5386
|
+
return this.check(_url(ZodURL, params));
|
|
5387
|
+
},
|
|
5388
|
+
jwt(params) {
|
|
5389
|
+
return this.check(_jwt(ZodJWT, params));
|
|
5390
|
+
},
|
|
5391
|
+
emoji(params) {
|
|
5392
|
+
return this.check(_emoji2(ZodEmoji, params));
|
|
5393
|
+
},
|
|
5394
|
+
guid(params) {
|
|
5395
|
+
return this.check(_guid(ZodGUID, params));
|
|
5396
|
+
},
|
|
5397
|
+
uuid(params) {
|
|
5398
|
+
return this.check(_uuid(ZodUUID, params));
|
|
5399
|
+
},
|
|
5400
|
+
uuidv4(params) {
|
|
5401
|
+
return this.check(_uuidv4(ZodUUID, params));
|
|
5402
|
+
},
|
|
5403
|
+
uuidv6(params) {
|
|
5404
|
+
return this.check(_uuidv6(ZodUUID, params));
|
|
5405
|
+
},
|
|
5406
|
+
uuidv7(params) {
|
|
5407
|
+
return this.check(_uuidv7(ZodUUID, params));
|
|
5408
|
+
},
|
|
5409
|
+
nanoid(params) {
|
|
5410
|
+
return this.check(_nanoid(ZodNanoID, params));
|
|
5411
|
+
},
|
|
5412
|
+
cuid(params) {
|
|
5413
|
+
return this.check(_cuid(ZodCUID, params));
|
|
5414
|
+
},
|
|
5415
|
+
cuid2(params) {
|
|
5416
|
+
return this.check(_cuid2(ZodCUID2, params));
|
|
5417
|
+
},
|
|
5418
|
+
ulid(params) {
|
|
5419
|
+
return this.check(_ulid(ZodULID, params));
|
|
5420
|
+
},
|
|
5421
|
+
base64(params) {
|
|
5422
|
+
return this.check(_base64(ZodBase64, params));
|
|
5423
|
+
},
|
|
5424
|
+
base64url(params) {
|
|
5425
|
+
return this.check(_base64url(ZodBase64URL, params));
|
|
5426
|
+
},
|
|
5427
|
+
xid(params) {
|
|
5428
|
+
return this.check(_xid(ZodXID, params));
|
|
5429
|
+
},
|
|
5430
|
+
ksuid(params) {
|
|
5431
|
+
return this.check(_ksuid(ZodKSUID, params));
|
|
5432
|
+
},
|
|
5433
|
+
ipv4(params) {
|
|
5434
|
+
return this.check(_ipv4(ZodIPv4, params));
|
|
5435
|
+
},
|
|
5436
|
+
ipv6(params) {
|
|
5437
|
+
return this.check(_ipv6(ZodIPv6, params));
|
|
5438
|
+
},
|
|
5439
|
+
cidrv4(params) {
|
|
5440
|
+
return this.check(_cidrv4(ZodCIDRv4, params));
|
|
5441
|
+
},
|
|
5442
|
+
cidrv6(params) {
|
|
5443
|
+
return this.check(_cidrv6(ZodCIDRv6, params));
|
|
5444
|
+
},
|
|
5445
|
+
e164(params) {
|
|
5446
|
+
return this.check(_e164(ZodE164, params));
|
|
5447
|
+
},
|
|
5448
|
+
datetime(params) {
|
|
5449
|
+
return this.check(_isoDateTime(ZodISODateTime, params));
|
|
5450
|
+
},
|
|
5451
|
+
date(params) {
|
|
5452
|
+
return this.check(_isoDate(ZodISODate, params));
|
|
5453
|
+
},
|
|
5454
|
+
time(params) {
|
|
5455
|
+
return this.check(_isoTime(ZodISOTime, params));
|
|
5456
|
+
},
|
|
5457
|
+
duration(params) {
|
|
5458
|
+
return this.check(_isoDuration(ZodISODuration, params));
|
|
5459
|
+
}
|
|
4265
5460
|
});
|
|
4266
5461
|
function string2(params) {
|
|
4267
5462
|
return _string(ZodString, params);
|
|
@@ -4270,6 +5465,22 @@ var ZodStringFormat = /* @__PURE__ */ $constructor("ZodStringFormat", (inst, def
|
|
|
4270
5465
|
$ZodStringFormat.init(inst, def);
|
|
4271
5466
|
_ZodString.init(inst, def);
|
|
4272
5467
|
});
|
|
5468
|
+
var ZodISODateTime = /* @__PURE__ */ $constructor("ZodISODateTime", (inst, def) => {
|
|
5469
|
+
$ZodISODateTime.init(inst, def);
|
|
5470
|
+
ZodStringFormat.init(inst, def);
|
|
5471
|
+
});
|
|
5472
|
+
var ZodISODate = /* @__PURE__ */ $constructor("ZodISODate", (inst, def) => {
|
|
5473
|
+
$ZodISODate.init(inst, def);
|
|
5474
|
+
ZodStringFormat.init(inst, def);
|
|
5475
|
+
});
|
|
5476
|
+
var ZodISOTime = /* @__PURE__ */ $constructor("ZodISOTime", (inst, def) => {
|
|
5477
|
+
$ZodISOTime.init(inst, def);
|
|
5478
|
+
ZodStringFormat.init(inst, def);
|
|
5479
|
+
});
|
|
5480
|
+
var ZodISODuration = /* @__PURE__ */ $constructor("ZodISODuration", (inst, def) => {
|
|
5481
|
+
$ZodISODuration.init(inst, def);
|
|
5482
|
+
ZodStringFormat.init(inst, def);
|
|
5483
|
+
});
|
|
4273
5484
|
var ZodEmail = /* @__PURE__ */ $constructor("ZodEmail", (inst, def) => {
|
|
4274
5485
|
$ZodEmail.init(inst, def);
|
|
4275
5486
|
ZodStringFormat.init(inst, def);
|
|
@@ -4353,27 +5564,58 @@ var ZodNumber = /* @__PURE__ */ $constructor("ZodNumber", (inst, def) => {
|
|
|
4353
5564
|
$ZodNumber.init(inst, def);
|
|
4354
5565
|
ZodType.init(inst, def);
|
|
4355
5566
|
inst._zod.processJSONSchema = (ctx, json, params) => numberProcessor(inst, ctx, json, params);
|
|
4356
|
-
inst.gt = (value, params) => inst.check(_gt(value, params));
|
|
4357
|
-
inst.gte = (value, params) => inst.check(_gte(value, params));
|
|
4358
|
-
inst.min = (value, params) => inst.check(_gte(value, params));
|
|
4359
|
-
inst.lt = (value, params) => inst.check(_lt(value, params));
|
|
4360
|
-
inst.lte = (value, params) => inst.check(_lte(value, params));
|
|
4361
|
-
inst.max = (value, params) => inst.check(_lte(value, params));
|
|
4362
|
-
inst.int = (params) => inst.check(int(params));
|
|
4363
|
-
inst.safe = (params) => inst.check(int(params));
|
|
4364
|
-
inst.positive = (params) => inst.check(_gt(0, params));
|
|
4365
|
-
inst.nonnegative = (params) => inst.check(_gte(0, params));
|
|
4366
|
-
inst.negative = (params) => inst.check(_lt(0, params));
|
|
4367
|
-
inst.nonpositive = (params) => inst.check(_lte(0, params));
|
|
4368
|
-
inst.multipleOf = (value, params) => inst.check(_multipleOf(value, params));
|
|
4369
|
-
inst.step = (value, params) => inst.check(_multipleOf(value, params));
|
|
4370
|
-
inst.finite = () => inst;
|
|
4371
5567
|
const bag = inst._zod.bag;
|
|
4372
5568
|
inst.minValue = Math.max(bag.minimum ?? Number.NEGATIVE_INFINITY, bag.exclusiveMinimum ?? Number.NEGATIVE_INFINITY) ?? null;
|
|
4373
5569
|
inst.maxValue = Math.min(bag.maximum ?? Number.POSITIVE_INFINITY, bag.exclusiveMaximum ?? Number.POSITIVE_INFINITY) ?? null;
|
|
4374
5570
|
inst.isInt = (bag.format ?? "").includes("int") || Number.isSafeInteger(bag.multipleOf ?? 0.5);
|
|
4375
5571
|
inst.isFinite = true;
|
|
4376
5572
|
inst.format = bag.format ?? null;
|
|
5573
|
+
}, {
|
|
5574
|
+
gt(value, params) {
|
|
5575
|
+
return this.check(_gt(value, params));
|
|
5576
|
+
},
|
|
5577
|
+
gte(value, params) {
|
|
5578
|
+
return this.check(_gte(value, params));
|
|
5579
|
+
},
|
|
5580
|
+
min(value, params) {
|
|
5581
|
+
return this.check(_gte(value, params));
|
|
5582
|
+
},
|
|
5583
|
+
lt(value, params) {
|
|
5584
|
+
return this.check(_lt(value, params));
|
|
5585
|
+
},
|
|
5586
|
+
lte(value, params) {
|
|
5587
|
+
return this.check(_lte(value, params));
|
|
5588
|
+
},
|
|
5589
|
+
max(value, params) {
|
|
5590
|
+
return this.check(_lte(value, params));
|
|
5591
|
+
},
|
|
5592
|
+
int(params) {
|
|
5593
|
+
return this.check(int(params));
|
|
5594
|
+
},
|
|
5595
|
+
safe(params) {
|
|
5596
|
+
return this.check(int(params));
|
|
5597
|
+
},
|
|
5598
|
+
positive(params) {
|
|
5599
|
+
return this.check(_gt(0, params));
|
|
5600
|
+
},
|
|
5601
|
+
nonnegative(params) {
|
|
5602
|
+
return this.check(_gte(0, params));
|
|
5603
|
+
},
|
|
5604
|
+
negative(params) {
|
|
5605
|
+
return this.check(_lt(0, params));
|
|
5606
|
+
},
|
|
5607
|
+
nonpositive(params) {
|
|
5608
|
+
return this.check(_lte(0, params));
|
|
5609
|
+
},
|
|
5610
|
+
multipleOf(value, params) {
|
|
5611
|
+
return this.check(_multipleOf(value, params));
|
|
5612
|
+
},
|
|
5613
|
+
step(value, params) {
|
|
5614
|
+
return this.check(_multipleOf(value, params));
|
|
5615
|
+
},
|
|
5616
|
+
finite() {
|
|
5617
|
+
return this;
|
|
5618
|
+
}
|
|
4377
5619
|
});
|
|
4378
5620
|
function number2(params) {
|
|
4379
5621
|
return _number(ZodNumber, params);
|
|
@@ -4397,23 +5639,44 @@ var ZodBigInt = /* @__PURE__ */ $constructor("ZodBigInt", (inst, def) => {
|
|
|
4397
5639
|
$ZodBigInt.init(inst, def);
|
|
4398
5640
|
ZodType.init(inst, def);
|
|
4399
5641
|
inst._zod.processJSONSchema = (ctx, json, params) => bigintProcessor(inst, ctx, json, params);
|
|
4400
|
-
inst.gte = (value, params) => inst.check(_gte(value, params));
|
|
4401
|
-
inst.min = (value, params) => inst.check(_gte(value, params));
|
|
4402
|
-
inst.gt = (value, params) => inst.check(_gt(value, params));
|
|
4403
|
-
inst.gte = (value, params) => inst.check(_gte(value, params));
|
|
4404
|
-
inst.min = (value, params) => inst.check(_gte(value, params));
|
|
4405
|
-
inst.lt = (value, params) => inst.check(_lt(value, params));
|
|
4406
|
-
inst.lte = (value, params) => inst.check(_lte(value, params));
|
|
4407
|
-
inst.max = (value, params) => inst.check(_lte(value, params));
|
|
4408
|
-
inst.positive = (params) => inst.check(_gt(BigInt(0), params));
|
|
4409
|
-
inst.negative = (params) => inst.check(_lt(BigInt(0), params));
|
|
4410
|
-
inst.nonpositive = (params) => inst.check(_lte(BigInt(0), params));
|
|
4411
|
-
inst.nonnegative = (params) => inst.check(_gte(BigInt(0), params));
|
|
4412
|
-
inst.multipleOf = (value, params) => inst.check(_multipleOf(value, params));
|
|
4413
5642
|
const bag = inst._zod.bag;
|
|
4414
5643
|
inst.minValue = bag.minimum ?? null;
|
|
4415
5644
|
inst.maxValue = bag.maximum ?? null;
|
|
4416
5645
|
inst.format = bag.format ?? null;
|
|
5646
|
+
}, {
|
|
5647
|
+
gte(value, params) {
|
|
5648
|
+
return this.check(_gte(value, params));
|
|
5649
|
+
},
|
|
5650
|
+
min(value, params) {
|
|
5651
|
+
return this.check(_gte(value, params));
|
|
5652
|
+
},
|
|
5653
|
+
gt(value, params) {
|
|
5654
|
+
return this.check(_gt(value, params));
|
|
5655
|
+
},
|
|
5656
|
+
lt(value, params) {
|
|
5657
|
+
return this.check(_lt(value, params));
|
|
5658
|
+
},
|
|
5659
|
+
lte(value, params) {
|
|
5660
|
+
return this.check(_lte(value, params));
|
|
5661
|
+
},
|
|
5662
|
+
max(value, params) {
|
|
5663
|
+
return this.check(_lte(value, params));
|
|
5664
|
+
},
|
|
5665
|
+
positive(params) {
|
|
5666
|
+
return this.check(_gt(BigInt(0), params));
|
|
5667
|
+
},
|
|
5668
|
+
negative(params) {
|
|
5669
|
+
return this.check(_lt(BigInt(0), params));
|
|
5670
|
+
},
|
|
5671
|
+
nonpositive(params) {
|
|
5672
|
+
return this.check(_lte(BigInt(0), params));
|
|
5673
|
+
},
|
|
5674
|
+
nonnegative(params) {
|
|
5675
|
+
return this.check(_gte(BigInt(0), params));
|
|
5676
|
+
},
|
|
5677
|
+
multipleOf(value, params) {
|
|
5678
|
+
return this.check(_multipleOf(value, params));
|
|
5679
|
+
}
|
|
4417
5680
|
});
|
|
4418
5681
|
var ZodNull = /* @__PURE__ */ $constructor("ZodNull", (inst, def) => {
|
|
4419
5682
|
$ZodNull.init(inst, def);
|
|
@@ -4450,43 +5713,80 @@ var ZodDate = /* @__PURE__ */ $constructor("ZodDate", (inst, def) => {
|
|
|
4450
5713
|
inst.maxDate = c.maximum ? new Date(c.maximum) : null;
|
|
4451
5714
|
});
|
|
4452
5715
|
var ZodArray = /* @__PURE__ */ $constructor("ZodArray", (inst, def) => {
|
|
5716
|
+
_ensureDefaultMemoizer();
|
|
4453
5717
|
$ZodArray.init(inst, def);
|
|
4454
5718
|
ZodType.init(inst, def);
|
|
4455
5719
|
inst._zod.processJSONSchema = (ctx, json, params) => arrayProcessor(inst, ctx, json, params);
|
|
4456
5720
|
inst.element = def.element;
|
|
4457
|
-
|
|
4458
|
-
|
|
4459
|
-
|
|
4460
|
-
|
|
4461
|
-
|
|
5721
|
+
}, {
|
|
5722
|
+
min(n, params) {
|
|
5723
|
+
return this.check(_minLength(n, params));
|
|
5724
|
+
},
|
|
5725
|
+
nonempty(params) {
|
|
5726
|
+
return this.check(_minLength(1, params));
|
|
5727
|
+
},
|
|
5728
|
+
max(n, params) {
|
|
5729
|
+
return this.check(_maxLength(n, params));
|
|
5730
|
+
},
|
|
5731
|
+
length(n, params) {
|
|
5732
|
+
return this.check(_length(n, params));
|
|
5733
|
+
},
|
|
5734
|
+
unwrap() {
|
|
5735
|
+
return this.element;
|
|
5736
|
+
}
|
|
4462
5737
|
});
|
|
4463
5738
|
function array(element, params) {
|
|
4464
5739
|
return _array(ZodArray, element, params);
|
|
4465
5740
|
}
|
|
4466
5741
|
var ZodObject = /* @__PURE__ */ $constructor("ZodObject", (inst, def) => {
|
|
5742
|
+
_ensureDefaultMemoizer();
|
|
4467
5743
|
$ZodObjectJIT.init(inst, def);
|
|
4468
5744
|
ZodType.init(inst, def);
|
|
4469
5745
|
inst._zod.processJSONSchema = (ctx, json, params) => objectProcessor(inst, ctx, json, params);
|
|
4470
|
-
|
|
4471
|
-
|
|
4472
|
-
|
|
4473
|
-
|
|
4474
|
-
|
|
4475
|
-
|
|
4476
|
-
|
|
4477
|
-
|
|
4478
|
-
|
|
4479
|
-
|
|
4480
|
-
|
|
4481
|
-
|
|
4482
|
-
|
|
4483
|
-
|
|
4484
|
-
|
|
4485
|
-
|
|
4486
|
-
|
|
4487
|
-
|
|
4488
|
-
|
|
4489
|
-
|
|
5746
|
+
installLazyProp(inst, "shape", (self) => self._zod.def.shape, false);
|
|
5747
|
+
}, {
|
|
5748
|
+
keyof() {
|
|
5749
|
+
return _enum(Object.keys(this._zod.def.shape));
|
|
5750
|
+
},
|
|
5751
|
+
catchall(catchall) {
|
|
5752
|
+
return this.clone({ ...this._zod.def, catchall });
|
|
5753
|
+
},
|
|
5754
|
+
passthrough() {
|
|
5755
|
+
return this.clone({ ...this._zod.def, catchall: unknown() });
|
|
5756
|
+
},
|
|
5757
|
+
loose() {
|
|
5758
|
+
return this.clone({ ...this._zod.def, catchall: unknown() });
|
|
5759
|
+
},
|
|
5760
|
+
strict() {
|
|
5761
|
+
return this.clone({ ...this._zod.def, catchall: never() });
|
|
5762
|
+
},
|
|
5763
|
+
strip() {
|
|
5764
|
+
return this.clone({ ...this._zod.def, catchall: undefined });
|
|
5765
|
+
},
|
|
5766
|
+
extend(incoming) {
|
|
5767
|
+
return extend(this, incoming);
|
|
5768
|
+
},
|
|
5769
|
+
safeExtend(incoming) {
|
|
5770
|
+
return safeExtend(this, incoming);
|
|
5771
|
+
},
|
|
5772
|
+
merge(other) {
|
|
5773
|
+
return merge(this, other);
|
|
5774
|
+
},
|
|
5775
|
+
pick(mask) {
|
|
5776
|
+
return pick(this, mask);
|
|
5777
|
+
},
|
|
5778
|
+
omit(mask) {
|
|
5779
|
+
return omit(this, mask);
|
|
5780
|
+
},
|
|
5781
|
+
partial(...args) {
|
|
5782
|
+
return partial(ZodOptional, this, args[0]);
|
|
5783
|
+
},
|
|
5784
|
+
exactPartial(...args) {
|
|
5785
|
+
return partial(ZodExactOptional, this, args[0], "exactPartial");
|
|
5786
|
+
},
|
|
5787
|
+
required(...args) {
|
|
5788
|
+
return required(ZodNonOptional, this, args[0]);
|
|
5789
|
+
}
|
|
4490
5790
|
});
|
|
4491
5791
|
function object(shape, params) {
|
|
4492
5792
|
const def = {
|
|
@@ -4542,13 +5842,26 @@ function intersection(left, right) {
|
|
|
4542
5842
|
});
|
|
4543
5843
|
}
|
|
4544
5844
|
var ZodTuple = /* @__PURE__ */ $constructor("ZodTuple", (inst, def) => {
|
|
5845
|
+
_ensureDefaultMemoizer();
|
|
4545
5846
|
$ZodTuple.init(inst, def);
|
|
4546
5847
|
ZodType.init(inst, def);
|
|
4547
5848
|
inst._zod.processJSONSchema = (ctx, json, params) => tupleProcessor(inst, ctx, json, params);
|
|
4548
|
-
|
|
4549
|
-
|
|
4550
|
-
|
|
4551
|
-
|
|
5849
|
+
}, {
|
|
5850
|
+
rest(rest) {
|
|
5851
|
+
return this.clone({
|
|
5852
|
+
...this._zod.def,
|
|
5853
|
+
rest
|
|
5854
|
+
});
|
|
5855
|
+
},
|
|
5856
|
+
partial() {
|
|
5857
|
+
const def = this._zod.def;
|
|
5858
|
+
if (def.checks?.length)
|
|
5859
|
+
throw new Error(".partial() cannot be used on tuple schemas containing refinements");
|
|
5860
|
+
return this.clone({
|
|
5861
|
+
...def,
|
|
5862
|
+
items: def.items.map((item) => new ZodOptional({ type: "optional", innerType: item }))
|
|
5863
|
+
});
|
|
5864
|
+
}
|
|
4552
5865
|
});
|
|
4553
5866
|
function tuple(items, _paramsOrRest, _params) {
|
|
4554
5867
|
const hasRest = _paramsOrRest instanceof $ZodType;
|
|
@@ -4562,6 +5875,7 @@ function tuple(items, _paramsOrRest, _params) {
|
|
|
4562
5875
|
});
|
|
4563
5876
|
}
|
|
4564
5877
|
var ZodRecord = /* @__PURE__ */ $constructor("ZodRecord", (inst, def) => {
|
|
5878
|
+
_ensureDefaultMemoizer();
|
|
4565
5879
|
$ZodRecord.init(inst, def);
|
|
4566
5880
|
ZodType.init(inst, def);
|
|
4567
5881
|
inst._zod.processJSONSchema = (ctx, json, params) => recordProcessor(inst, ctx, json, params);
|
|
@@ -4569,6 +5883,14 @@ var ZodRecord = /* @__PURE__ */ $constructor("ZodRecord", (inst, def) => {
|
|
|
4569
5883
|
inst.valueType = def.valueType;
|
|
4570
5884
|
});
|
|
4571
5885
|
function record(keyType, valueType, params) {
|
|
5886
|
+
if (!valueType || !valueType._zod) {
|
|
5887
|
+
return new ZodRecord({
|
|
5888
|
+
type: "record",
|
|
5889
|
+
keyType: string2(),
|
|
5890
|
+
valueType: keyType,
|
|
5891
|
+
...normalizeParams(valueType)
|
|
5892
|
+
});
|
|
5893
|
+
}
|
|
4572
5894
|
return new ZodRecord({
|
|
4573
5895
|
type: "record",
|
|
4574
5896
|
keyType,
|
|
@@ -4577,13 +5899,12 @@ function record(keyType, valueType, params) {
|
|
|
4577
5899
|
});
|
|
4578
5900
|
}
|
|
4579
5901
|
function partialRecord(keyType, valueType, params) {
|
|
4580
|
-
const k = clone(keyType);
|
|
4581
|
-
k._zod.values = undefined;
|
|
4582
5902
|
return new ZodRecord({
|
|
4583
5903
|
type: "record",
|
|
4584
|
-
keyType
|
|
5904
|
+
keyType,
|
|
4585
5905
|
valueType,
|
|
4586
|
-
...normalizeParams(params)
|
|
5906
|
+
...normalizeParams(params),
|
|
5907
|
+
partial: true
|
|
4587
5908
|
});
|
|
4588
5909
|
}
|
|
4589
5910
|
var ZodEnum = /* @__PURE__ */ $constructor("ZodEnum", (inst, def) => {
|
|
@@ -4654,6 +5975,7 @@ function literal(value, params) {
|
|
|
4654
5975
|
});
|
|
4655
5976
|
}
|
|
4656
5977
|
var ZodTransform = /* @__PURE__ */ $constructor("ZodTransform", (inst, def) => {
|
|
5978
|
+
_ensureDefaultMemoizer();
|
|
4657
5979
|
$ZodTransform.init(inst, def);
|
|
4658
5980
|
ZodType.init(inst, def);
|
|
4659
5981
|
inst._zod.processJSONSchema = (ctx, json, params) => transformProcessor(inst, ctx, json, params);
|
|
@@ -4669,7 +5991,8 @@ var ZodTransform = /* @__PURE__ */ $constructor("ZodTransform", (inst, def) => {
|
|
|
4669
5991
|
if (_issue.fatal)
|
|
4670
5992
|
_issue.continue = false;
|
|
4671
5993
|
_issue.code ?? (_issue.code = "custom");
|
|
4672
|
-
|
|
5994
|
+
if (!("input" in _issue))
|
|
5995
|
+
_issue.input = payload.value;
|
|
4673
5996
|
_issue.inst ?? (_issue.inst = inst);
|
|
4674
5997
|
payload.issues.push(issue(_issue));
|
|
4675
5998
|
}
|
|
@@ -4782,7 +6105,7 @@ function _catch(innerType, catchValue) {
|
|
|
4782
6105
|
return new ZodCatch({
|
|
4783
6106
|
type: "catch",
|
|
4784
6107
|
innerType,
|
|
4785
|
-
catchValue: typeof catchValue === "function" ? catchValue : ()
|
|
6108
|
+
catchValue: typeof catchValue === "function" ? catchValue : constantCatch(catchValue)
|
|
4786
6109
|
});
|
|
4787
6110
|
}
|
|
4788
6111
|
var ZodPipe = /* @__PURE__ */ $constructor("ZodPipe", (inst, def) => {
|
|
@@ -4831,8 +6154,8 @@ var ZodCustom = /* @__PURE__ */ $constructor("ZodCustom", (inst, def) => {
|
|
|
4831
6154
|
function refine(fn, _params = {}) {
|
|
4832
6155
|
return _refine(ZodCustom, fn, _params);
|
|
4833
6156
|
}
|
|
4834
|
-
function superRefine(fn) {
|
|
4835
|
-
return _superRefine(fn);
|
|
6157
|
+
function superRefine(fn, params) {
|
|
6158
|
+
return _superRefine(fn, params);
|
|
4836
6159
|
}
|
|
4837
6160
|
function json(params) {
|
|
4838
6161
|
const jsonSchema = lazy(() => {
|
|
@@ -4840,12 +6163,12 @@ function json(params) {
|
|
|
4840
6163
|
});
|
|
4841
6164
|
return jsonSchema;
|
|
4842
6165
|
}
|
|
4843
|
-
// ../../node_modules/.bun/zod@4.
|
|
6166
|
+
// ../../node_modules/.bun/zod@4.5.4/node_modules/zod/v4/classic/coerce.js
|
|
4844
6167
|
var exports_coerce = {};
|
|
4845
6168
|
__export(exports_coerce, {
|
|
4846
6169
|
bigint: () => bigint2,
|
|
4847
6170
|
boolean: () => boolean3,
|
|
4848
|
-
date: () =>
|
|
6171
|
+
date: () => date2,
|
|
4849
6172
|
number: () => number3,
|
|
4850
6173
|
string: () => string3
|
|
4851
6174
|
});
|
|
@@ -4861,12 +6184,9 @@ function boolean3(params) {
|
|
|
4861
6184
|
function bigint2(params) {
|
|
4862
6185
|
return _coercedBigint(ZodBigInt, params);
|
|
4863
6186
|
}
|
|
4864
|
-
function
|
|
6187
|
+
function date2(params) {
|
|
4865
6188
|
return _coercedDate(ZodDate, params);
|
|
4866
6189
|
}
|
|
4867
|
-
|
|
4868
|
-
// ../../node_modules/.bun/zod@4.3.6/node_modules/zod/v4/classic/external.js
|
|
4869
|
-
config(en_default());
|
|
4870
6190
|
// ../pstdio-api-contracts/src/activity.ts
|
|
4871
6191
|
var activityResourceTypeSchema = string2();
|
|
4872
6192
|
var activityActorTypeSchema = _enum(["user", "agent", "system"]);
|
|
@@ -5300,13 +6620,6 @@ var navigationTargetSchema = union([
|
|
|
5300
6620
|
]);
|
|
5301
6621
|
|
|
5302
6622
|
// ../pstdio-api-contracts/src/extensions/execute.ts
|
|
5303
|
-
var extensionRepoContextSchema = object({
|
|
5304
|
-
projectId: string2(),
|
|
5305
|
-
repoId: string2(),
|
|
5306
|
-
path: string2(),
|
|
5307
|
-
remote: string2().nullable().optional(),
|
|
5308
|
-
role: _enum(["default", "selected", "workspace"]).optional()
|
|
5309
|
-
});
|
|
5310
6623
|
var extensionSlotInvocationSchema = object({
|
|
5311
6624
|
id: string2(),
|
|
5312
6625
|
kind: extensionSlotKindSchema,
|
|
@@ -5332,7 +6645,6 @@ var commandExecuteRequestSchema = object({
|
|
|
5332
6645
|
resource: extensionResourceRefSchema.optional(),
|
|
5333
6646
|
attachment: extensionAttachmentInvocationSchema.optional(),
|
|
5334
6647
|
slot: extensionSlotInvocationSchema.optional(),
|
|
5335
|
-
repo: extensionRepoContextSchema.optional(),
|
|
5336
6648
|
source: commandSourceSchema.optional(),
|
|
5337
6649
|
metadata: jsonObjectSchema.optional()
|
|
5338
6650
|
});
|
|
@@ -5342,7 +6654,6 @@ var commandExecuteBodySchema = object({
|
|
|
5342
6654
|
resource: extensionResourceRefSchema.optional(),
|
|
5343
6655
|
attachment: extensionAttachmentInvocationSchema.optional(),
|
|
5344
6656
|
slot: extensionSlotInvocationSchema.optional(),
|
|
5345
|
-
repo: extensionRepoContextSchema.optional(),
|
|
5346
6657
|
source: commandSourceSchema.optional(),
|
|
5347
6658
|
metadata: jsonObjectSchema.optional()
|
|
5348
6659
|
});
|
|
@@ -6565,7 +7876,7 @@ var packageAsset = (path, baseUrl) => ({
|
|
|
6565
7876
|
baseUrl
|
|
6566
7877
|
});
|
|
6567
7878
|
// ../pstdio-api-contracts/src/extension-kernel/types/extension.ts
|
|
6568
|
-
var EXTENSION_API_VERSION = "1.0.0-alpha.
|
|
7879
|
+
var EXTENSION_API_VERSION = "1.0.0-alpha.13";
|
|
6569
7880
|
// ../pstdio-api-contracts/src/extension-kernel/types/webview-capabilities.ts
|
|
6570
7881
|
var WEBVIEW_HOST_CAPABILITY_VERSION = 1;
|
|
6571
7882
|
var WEBVIEW_DECLARABLE_CAPABILITIES = [
|
|
@@ -6697,8 +8008,13 @@ var mergeOrderedHistory = (known, native, key, merge, refineKey) => {
|
|
|
6697
8008
|
const refined = mergeOrderedHistory(known, native, refineKey(known, native), merge);
|
|
6698
8009
|
return refined;
|
|
6699
8010
|
}
|
|
6700
|
-
|
|
6701
|
-
|
|
8011
|
+
const paired = Math.min(known.length, native.length);
|
|
8012
|
+
if (known.slice(0, paired).every((item, index) => key(item) === key(native[index]))) {
|
|
8013
|
+
return [
|
|
8014
|
+
...known.slice(0, paired).map((item, index) => merge(item, native[index])),
|
|
8015
|
+
...known.slice(paired),
|
|
8016
|
+
...native.slice(paired)
|
|
8017
|
+
];
|
|
6702
8018
|
}
|
|
6703
8019
|
throw new HistoryConflict("ambiguous_interval");
|
|
6704
8020
|
}
|
|
@@ -6781,6 +8097,10 @@ var reconcileMessageHistory = (input, projection = {}) => {
|
|
|
6781
8097
|
}
|
|
6782
8098
|
};
|
|
6783
8099
|
// ../pstdio-api-contracts/src/projects.ts
|
|
8100
|
+
var initialWorkspaceSchema = object({
|
|
8101
|
+
provider_id: string2().min(1),
|
|
8102
|
+
params: serializableJsonObjectSchema.default({})
|
|
8103
|
+
});
|
|
6784
8104
|
var extensionSetupWarningSchema = object({
|
|
6785
8105
|
code: literal("extension_setup_failed"),
|
|
6786
8106
|
extension: string2(),
|
|
@@ -6799,30 +8119,17 @@ var projectSchema = object({
|
|
|
6799
8119
|
extension_warnings: array(extensionSetupWarningSchema).optional()
|
|
6800
8120
|
});
|
|
6801
8121
|
var createProjectInputSchema = object({
|
|
6802
|
-
name: string2().min(1).
|
|
6803
|
-
|
|
6804
|
-
}),
|
|
8122
|
+
name: string2().trim().min(1).optional(),
|
|
8123
|
+
initial_workspace: initialWorkspaceSchema,
|
|
6805
8124
|
agents: array(string2().min(1)).min(1).optional()
|
|
6806
8125
|
});
|
|
6807
8126
|
var updateProjectInputSchema = object({
|
|
8127
|
+
name: string2().trim().min(1).optional(),
|
|
6808
8128
|
default_agent_id: string2().min(1).nullable().optional(),
|
|
6809
8129
|
default_agent_model: string2().min(1).nullable().optional()
|
|
6810
8130
|
}).refine((value) => Object.keys(value).length > 0, {
|
|
6811
8131
|
message: "At least one field must be provided"
|
|
6812
8132
|
});
|
|
6813
|
-
// ../pstdio-api-contracts/src/repos.ts
|
|
6814
|
-
var repoSchema = object({
|
|
6815
|
-
id: string2(),
|
|
6816
|
-
name: string2(),
|
|
6817
|
-
path: string2(),
|
|
6818
|
-
display_name: string2().nullable(),
|
|
6819
|
-
created_at: string2(),
|
|
6820
|
-
updated_at: string2()
|
|
6821
|
-
});
|
|
6822
|
-
var registerRepoInputSchema = object({
|
|
6823
|
-
name: string2().min(1),
|
|
6824
|
-
path: string2().min(1)
|
|
6825
|
-
});
|
|
6826
8133
|
// ../pstdio-api-contracts/src/session-attachment-types.ts
|
|
6827
8134
|
var sessionAttachmentMimeTypesByExtension = {
|
|
6828
8135
|
c: "text/plain",
|
|
@@ -7161,7 +8468,7 @@ var workspaceSchema = object({
|
|
|
7161
8468
|
project_id: string2(),
|
|
7162
8469
|
name: string2(),
|
|
7163
8470
|
branch: string2().nullable(),
|
|
7164
|
-
|
|
8471
|
+
root_path: string2().nullable(),
|
|
7165
8472
|
provider_id: string2(),
|
|
7166
8473
|
provider_params_json: jsonObjectSchema,
|
|
7167
8474
|
provider_ref_json: workspaceProviderRefSchema.nullable(),
|
|
@@ -7174,6 +8481,8 @@ var workspaceSchema = object({
|
|
|
7174
8481
|
display_path: string2().nullable(),
|
|
7175
8482
|
is_default: boolean2(),
|
|
7176
8483
|
archived: boolean2(),
|
|
8484
|
+
initializing: boolean2(),
|
|
8485
|
+
setup_error: string2().nullable(),
|
|
7177
8486
|
workspace_shorthand: string2(),
|
|
7178
8487
|
startup_log_file_id: string2().nullable(),
|
|
7179
8488
|
anchors_json: array(workspaceAnchorSchema),
|
|
@@ -7183,10 +8492,8 @@ var workspaceSchema = object({
|
|
|
7183
8492
|
});
|
|
7184
8493
|
var createWorkspaceInputSchema = object({
|
|
7185
8494
|
project_id: string2().min(1),
|
|
7186
|
-
provider_id: string2().
|
|
8495
|
+
provider_id: string2().min(1),
|
|
7187
8496
|
params: jsonObjectSchema.optional(),
|
|
7188
|
-
repo_id: string2().optional(),
|
|
7189
|
-
base: string2().optional(),
|
|
7190
8497
|
anchors: array(workspaceAnchorSchema).optional(),
|
|
7191
8498
|
shorthand_base: string2().trim().min(1).optional()
|
|
7192
8499
|
});
|