@lousy-agents/mcp 5.21.15 → 5.21.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/127.js +8 -0
- package/dist/48.js +8 -0
- package/dist/564.js +36 -0
- package/dist/772.js +36 -0
- package/dist/873.js +60 -0
- package/dist/913.js +8 -0
- package/dist/mcp-server.js +1543 -1220
- package/package.json +1 -1
package/dist/mcp-server.js
CHANGED
|
@@ -6559,7 +6559,7 @@ function escapeJsonPtr(str) {
|
|
|
6559
6559
|
|
|
6560
6560
|
|
|
6561
6561
|
},
|
|
6562
|
-
|
|
6562
|
+
2517(__unused_rspack_module, __unused_rspack___webpack_exports__, __webpack_require__) {
|
|
6563
6563
|
// NAMESPACE OBJECT: ../../node_modules/micromark/lib/constructs.js
|
|
6564
6564
|
var constructs_namespaceObject = {};
|
|
6565
6565
|
__webpack_require__.r(constructs_namespaceObject);
|
|
@@ -6609,18 +6609,23 @@ function jsonStringifyReplacer(_, value) {
|
|
|
6609
6609
|
return value.toString();
|
|
6610
6610
|
return value;
|
|
6611
6611
|
}
|
|
6612
|
+
// the accessor lives on a shared prototype: an own accessor makes every box a dictionary-mode object (~360 B and a slow load per read against ~100 B and an inlined getter here)
|
|
6613
|
+
class Cached {
|
|
6614
|
+
constructor(getter) {
|
|
6615
|
+
this._getter = getter;
|
|
6616
|
+
this._value = undefined;
|
|
6617
|
+
}
|
|
6618
|
+
get value() {
|
|
6619
|
+
const getter = this._getter;
|
|
6620
|
+
if (getter !== undefined) {
|
|
6621
|
+
this._value = getter();
|
|
6622
|
+
this._getter = undefined;
|
|
6623
|
+
}
|
|
6624
|
+
return this._value;
|
|
6625
|
+
}
|
|
6626
|
+
}
|
|
6612
6627
|
function util_cached(getter) {
|
|
6613
|
-
|
|
6614
|
-
return {
|
|
6615
|
-
get value() {
|
|
6616
|
-
if (!set) {
|
|
6617
|
-
const value = getter();
|
|
6618
|
-
Object.defineProperty(this, "value", { value });
|
|
6619
|
-
return value;
|
|
6620
|
-
}
|
|
6621
|
-
throw new Error("cached value already set");
|
|
6622
|
-
},
|
|
6623
|
-
};
|
|
6628
|
+
return new Cached(getter);
|
|
6624
6629
|
}
|
|
6625
6630
|
function nullish(input) {
|
|
6626
6631
|
return input === null || input === undefined;
|
|
@@ -6675,6 +6680,71 @@ function util_assignProp(target, prop, value) {
|
|
|
6675
6680
|
configurable: true,
|
|
6676
6681
|
});
|
|
6677
6682
|
}
|
|
6683
|
+
/**
|
|
6684
|
+
* Whichever object a def's `shape` currently answers from: the one the caller passed until the first read, the frozen copy after it.
|
|
6685
|
+
*
|
|
6686
|
+
* Its keys and descriptors read without invoking anything, which is what lets a discriminated union check its discriminator, and the cycle walk read a shape, without resolving a getter that references the schema being constructed. A def that answers `shape` from an accessor of its own has none.
|
|
6687
|
+
*/
|
|
6688
|
+
function util_rawShape(def) {
|
|
6689
|
+
const desc = Object.getOwnPropertyDescriptor(def, "shape");
|
|
6690
|
+
return desc?.get ? desc.get.raw : desc?.value;
|
|
6691
|
+
}
|
|
6692
|
+
// where a builder reads its source's keys and descriptors, resolving only a shape a def answers for itself. A shape resolves by object spread, so only its enumerable keys are ever part of it.
|
|
6693
|
+
function sourceShape(schema) {
|
|
6694
|
+
return util_rawShape(schema._zod.def) ?? schema._zod.def.shape;
|
|
6695
|
+
}
|
|
6696
|
+
// a key whose value is not settled yet, self-caching so every read after the first gets the same one
|
|
6697
|
+
function deferProp(target, key, getter) {
|
|
6698
|
+
Object.defineProperty(target, key, {
|
|
6699
|
+
get() {
|
|
6700
|
+
const value = getter();
|
|
6701
|
+
util_assignProp(this, key, value);
|
|
6702
|
+
return value;
|
|
6703
|
+
},
|
|
6704
|
+
enumerable: true,
|
|
6705
|
+
configurable: true,
|
|
6706
|
+
});
|
|
6707
|
+
}
|
|
6708
|
+
// Writes a settled key. A plain assignment is much cheaper than `defineProperty` and produces the same descriptor, but it runs whatever setter already answers to the key — an accessor this shape deferred, or an inherited one, which `__proto__` has on every object and prototype pollution can add for any name.
|
|
6709
|
+
function putProp(target, key, value) {
|
|
6710
|
+
if (key in target)
|
|
6711
|
+
util_assignProp(target, key, value);
|
|
6712
|
+
else
|
|
6713
|
+
target[key] = value;
|
|
6714
|
+
}
|
|
6715
|
+
/**
|
|
6716
|
+
* Copies `keys` of `source`'s shape onto `target`, each value passed through `wrap`.
|
|
6717
|
+
*
|
|
6718
|
+
* A key the source has resolved is copied through now, so the derived shape states it outright and nothing has to resolve it to learn what it holds. A key the source still defers stays deferred, and reads back through the source's own `shape`, so it resolves once and both shapes get that one schema.
|
|
6719
|
+
*/
|
|
6720
|
+
function mirrorShape(target, source, keys, wrap) {
|
|
6721
|
+
const raw = sourceShape(source);
|
|
6722
|
+
for (const key of keys) {
|
|
6723
|
+
const desc = Object.getOwnPropertyDescriptor(raw, key);
|
|
6724
|
+
if (!desc.enumerable)
|
|
6725
|
+
continue;
|
|
6726
|
+
if (desc.get) {
|
|
6727
|
+
deferProp(target, key, () => {
|
|
6728
|
+
const value = source._zod.def.shape[key];
|
|
6729
|
+
return wrap ? wrap(value, key) : value;
|
|
6730
|
+
});
|
|
6731
|
+
}
|
|
6732
|
+
else
|
|
6733
|
+
putProp(target, key, wrap ? wrap(desc.value, key) : desc.value);
|
|
6734
|
+
}
|
|
6735
|
+
}
|
|
6736
|
+
// same, for a plain shape a caller passed rather than a schema's
|
|
6737
|
+
function mirrorProps(target, source) {
|
|
6738
|
+
for (const key of Reflect.ownKeys(source)) {
|
|
6739
|
+
const desc = Object.getOwnPropertyDescriptor(source, key);
|
|
6740
|
+
if (!desc.enumerable)
|
|
6741
|
+
continue;
|
|
6742
|
+
if (desc.get)
|
|
6743
|
+
deferProp(target, key, () => source[key]);
|
|
6744
|
+
else
|
|
6745
|
+
putProp(target, key, desc.value);
|
|
6746
|
+
}
|
|
6747
|
+
}
|
|
6678
6748
|
function mergeDefs(...defs) {
|
|
6679
6749
|
const mergedDescriptors = {};
|
|
6680
6750
|
for (const def of defs) {
|
|
@@ -6926,24 +6996,23 @@ function pick(schema, mask) {
|
|
|
6926
6996
|
if (hasChecks) {
|
|
6927
6997
|
throw new Error(".pick() cannot be used on object schemas containing refinements");
|
|
6928
6998
|
}
|
|
6929
|
-
const
|
|
6930
|
-
|
|
6931
|
-
|
|
6932
|
-
|
|
6933
|
-
|
|
6934
|
-
|
|
6935
|
-
|
|
6936
|
-
|
|
6937
|
-
|
|
6938
|
-
|
|
6939
|
-
|
|
6940
|
-
}
|
|
6941
|
-
|
|
6942
|
-
|
|
6943
|
-
|
|
6944
|
-
|
|
6945
|
-
|
|
6946
|
-
return util_clone(schema, def);
|
|
6999
|
+
const newShape = {};
|
|
7000
|
+
mirrorShape(newShape, schema, maskedKeys(schema, mask));
|
|
7001
|
+
return util_clone(schema, mergeDefs(currDef, { shape: newShape, checks: [] }));
|
|
7002
|
+
}
|
|
7003
|
+
// the mask keys that select something, checked against the source's shape without resolving it
|
|
7004
|
+
function maskedKeys(schema, mask) {
|
|
7005
|
+
const raw = sourceShape(schema);
|
|
7006
|
+
const keys = [];
|
|
7007
|
+
// `for...in` skips symbols, so a symbol in the mask would select nothing
|
|
7008
|
+
for (const key of Reflect.ownKeys(mask)) {
|
|
7009
|
+
if (!Object.getOwnPropertyDescriptor(raw, key)?.enumerable) {
|
|
7010
|
+
throw new Error(`Unrecognized key: "${String(key)}"`);
|
|
7011
|
+
}
|
|
7012
|
+
if (mask[key])
|
|
7013
|
+
keys.push(key);
|
|
7014
|
+
}
|
|
7015
|
+
return keys;
|
|
6947
7016
|
}
|
|
6948
7017
|
function omit(schema, mask) {
|
|
6949
7018
|
const currDef = schema._zod.def;
|
|
@@ -6952,23 +7021,10 @@ function omit(schema, mask) {
|
|
|
6952
7021
|
if (hasChecks) {
|
|
6953
7022
|
throw new Error(".omit() cannot be used on object schemas containing refinements");
|
|
6954
7023
|
}
|
|
6955
|
-
const
|
|
6956
|
-
|
|
6957
|
-
|
|
6958
|
-
|
|
6959
|
-
if (!Object.prototype.hasOwnProperty.call(currDef.shape, key)) {
|
|
6960
|
-
throw new Error(`Unrecognized key: "${String(key)}"`);
|
|
6961
|
-
}
|
|
6962
|
-
if (!mask[key])
|
|
6963
|
-
continue;
|
|
6964
|
-
delete newShape[key];
|
|
6965
|
-
}
|
|
6966
|
-
util_assignProp(this, "shape", newShape); // self-caching
|
|
6967
|
-
return newShape;
|
|
6968
|
-
},
|
|
6969
|
-
checks: [],
|
|
6970
|
-
});
|
|
6971
|
-
return util_clone(schema, def);
|
|
7024
|
+
const omitted = new Set(maskedKeys(schema, mask));
|
|
7025
|
+
const newShape = {};
|
|
7026
|
+
mirrorShape(newShape, schema, Reflect.ownKeys(sourceShape(schema)).filter((key) => !omitted.has(key)));
|
|
7027
|
+
return util_clone(schema, mergeDefs(currDef, { shape: newShape, checks: [] }));
|
|
6972
7028
|
}
|
|
6973
7029
|
function extend(schema, shape) {
|
|
6974
7030
|
if (!isPlainObject(shape)) {
|
|
@@ -6978,48 +7034,40 @@ function extend(schema, shape) {
|
|
|
6978
7034
|
const hasChecks = checks && checks.length > 0;
|
|
6979
7035
|
if (hasChecks) {
|
|
6980
7036
|
// Only throw if new shape overlaps with existing shape. Use getOwnPropertyDescriptor to check key existence without accessing values
|
|
6981
|
-
const existingShape = schema
|
|
7037
|
+
const existingShape = sourceShape(schema);
|
|
6982
7038
|
for (const key of Reflect.ownKeys(shape)) {
|
|
6983
7039
|
if (Object.getOwnPropertyDescriptor(existingShape, key) !== undefined) {
|
|
6984
7040
|
throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.");
|
|
6985
7041
|
}
|
|
6986
7042
|
}
|
|
6987
7043
|
}
|
|
6988
|
-
|
|
6989
|
-
|
|
6990
|
-
|
|
6991
|
-
|
|
6992
|
-
|
|
6993
|
-
|
|
6994
|
-
|
|
6995
|
-
return
|
|
7044
|
+
return util_clone(schema, mergeDefs(schema._zod.def, { shape: extended(schema, shape) }));
|
|
7045
|
+
}
|
|
7046
|
+
// the source's keys, then the caller's overlaid on top
|
|
7047
|
+
function extended(schema, shape) {
|
|
7048
|
+
const newShape = {};
|
|
7049
|
+
mirrorShape(newShape, schema, Reflect.ownKeys(sourceShape(schema)));
|
|
7050
|
+
mirrorProps(newShape, shape);
|
|
7051
|
+
return newShape;
|
|
6996
7052
|
}
|
|
6997
7053
|
function safeExtend(schema, shape) {
|
|
6998
7054
|
if (!isPlainObject(shape)) {
|
|
6999
7055
|
throw new Error("Invalid input to safeExtend: expected a plain object");
|
|
7000
7056
|
}
|
|
7001
|
-
|
|
7002
|
-
get shape() {
|
|
7003
|
-
const _shape = { ...schema._zod.def.shape, ...shape };
|
|
7004
|
-
util_assignProp(this, "shape", _shape); // self-caching
|
|
7005
|
-
return _shape;
|
|
7006
|
-
},
|
|
7007
|
-
});
|
|
7008
|
-
return util_clone(schema, def);
|
|
7057
|
+
return util_clone(schema, mergeDefs(schema._zod.def, { shape: extended(schema, shape) }));
|
|
7009
7058
|
}
|
|
7010
|
-
function
|
|
7059
|
+
function util_merge(a, b) {
|
|
7011
7060
|
if (!b?._zod?.def) {
|
|
7012
7061
|
throw new Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");
|
|
7013
7062
|
}
|
|
7014
7063
|
if (a._zod.def.checks?.length) {
|
|
7015
7064
|
throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");
|
|
7016
7065
|
}
|
|
7066
|
+
const newShape = {};
|
|
7067
|
+
mirrorShape(newShape, a, Reflect.ownKeys(sourceShape(a)));
|
|
7068
|
+
mirrorShape(newShape, b, Reflect.ownKeys(sourceShape(b)));
|
|
7017
7069
|
const def = mergeDefs(a._zod.def, {
|
|
7018
|
-
|
|
7019
|
-
const _shape = { ...a._zod.def.shape, ...b._zod.def.shape };
|
|
7020
|
-
util_assignProp(this, "shape", _shape); // self-caching
|
|
7021
|
-
return _shape;
|
|
7022
|
-
},
|
|
7070
|
+
shape: newShape,
|
|
7023
7071
|
get catchall() {
|
|
7024
7072
|
return b._zod.def.catchall;
|
|
7025
7073
|
},
|
|
@@ -7034,78 +7082,19 @@ function partial(Class, schema, mask, name = "partial") {
|
|
|
7034
7082
|
if (hasChecks) {
|
|
7035
7083
|
throw new Error(`.${name}() cannot be used on object schemas containing refinements`);
|
|
7036
7084
|
}
|
|
7037
|
-
const
|
|
7038
|
-
|
|
7039
|
-
|
|
7040
|
-
|
|
7041
|
-
|
|
7042
|
-
for (const key of Reflect.ownKeys(mask)) {
|
|
7043
|
-
if (!Object.prototype.hasOwnProperty.call(oldShape, key)) {
|
|
7044
|
-
throw new Error(`Unrecognized key: "${String(key)}"`);
|
|
7045
|
-
}
|
|
7046
|
-
if (!mask[key])
|
|
7047
|
-
continue;
|
|
7048
|
-
// if (oldShape[key]!._zod.optin === "optional") continue;
|
|
7049
|
-
shape[key] = Class
|
|
7050
|
-
? new Class({
|
|
7051
|
-
type: "optional",
|
|
7052
|
-
innerType: oldShape[key],
|
|
7053
|
-
})
|
|
7054
|
-
: oldShape[key];
|
|
7055
|
-
}
|
|
7056
|
-
}
|
|
7057
|
-
else {
|
|
7058
|
-
// the spread copies symbol keys; `for...in` would not reach them
|
|
7059
|
-
for (const key of Reflect.ownKeys(oldShape)) {
|
|
7060
|
-
// if (oldShape[key]!._zod.optin === "optional") continue;
|
|
7061
|
-
shape[key] = Class
|
|
7062
|
-
? new Class({
|
|
7063
|
-
type: "optional",
|
|
7064
|
-
innerType: oldShape[key],
|
|
7065
|
-
})
|
|
7066
|
-
: oldShape[key];
|
|
7067
|
-
}
|
|
7068
|
-
}
|
|
7069
|
-
util_assignProp(this, "shape", shape); // self-caching
|
|
7070
|
-
return shape;
|
|
7071
|
-
},
|
|
7072
|
-
checks: [],
|
|
7073
|
-
});
|
|
7074
|
-
return util_clone(schema, def);
|
|
7085
|
+
const selected = mask ? new Set(maskedKeys(schema, mask)) : undefined;
|
|
7086
|
+
const newShape = {};
|
|
7087
|
+
mirrorShape(newShape, schema, Reflect.ownKeys(sourceShape(schema)), Class &&
|
|
7088
|
+
((value, key) => (selected && !selected.has(key) ? value : new Class({ type: "optional", innerType: value }))));
|
|
7089
|
+
return util_clone(schema, mergeDefs(schema._zod.def, { shape: newShape, checks: [] }));
|
|
7075
7090
|
}
|
|
7076
7091
|
function util_required(Class, schema, mask) {
|
|
7077
|
-
const
|
|
7078
|
-
|
|
7079
|
-
|
|
7080
|
-
|
|
7081
|
-
|
|
7082
|
-
|
|
7083
|
-
if (!Object.prototype.hasOwnProperty.call(shape, key)) {
|
|
7084
|
-
throw new Error(`Unrecognized key: "${String(key)}"`);
|
|
7085
|
-
}
|
|
7086
|
-
if (!mask[key])
|
|
7087
|
-
continue;
|
|
7088
|
-
// overwrite with non-optional
|
|
7089
|
-
shape[key] = new Class({
|
|
7090
|
-
type: "nonoptional",
|
|
7091
|
-
innerType: oldShape[key],
|
|
7092
|
-
});
|
|
7093
|
-
}
|
|
7094
|
-
}
|
|
7095
|
-
else {
|
|
7096
|
-
for (const key of Reflect.ownKeys(oldShape)) {
|
|
7097
|
-
// overwrite with non-optional
|
|
7098
|
-
shape[key] = new Class({
|
|
7099
|
-
type: "nonoptional",
|
|
7100
|
-
innerType: oldShape[key],
|
|
7101
|
-
});
|
|
7102
|
-
}
|
|
7103
|
-
}
|
|
7104
|
-
util_assignProp(this, "shape", shape); // self-caching
|
|
7105
|
-
return shape;
|
|
7106
|
-
},
|
|
7107
|
-
});
|
|
7108
|
-
return util_clone(schema, def);
|
|
7092
|
+
const selected = mask ? new Set(maskedKeys(schema, mask)) : undefined;
|
|
7093
|
+
const newShape = {};
|
|
7094
|
+
mirrorShape(newShape, schema, Reflect.ownKeys(sourceShape(schema)), (value, key) =>
|
|
7095
|
+
// overwrite with non-optional
|
|
7096
|
+
selected && !selected.has(key) ? value : new Class({ type: "nonoptional", innerType: value }));
|
|
7097
|
+
return util_clone(schema, mergeDefs(schema._zod.def, { shape: newShape }));
|
|
7109
7098
|
}
|
|
7110
7099
|
// invalid_type | too_big | too_small | invalid_format | not_multiple_of | unrecognized_keys | invalid_union | invalid_key | invalid_element | invalid_value | custom
|
|
7111
7100
|
function aborted(x, startIndex = 0) {
|
|
@@ -7167,13 +7156,19 @@ function finalizeIssue(iss, ctx, config) {
|
|
|
7167
7156
|
unwrapMessage(config.customError?.(iss)) ??
|
|
7168
7157
|
unwrapMessage(config.localeError?.(iss)) ??
|
|
7169
7158
|
"Invalid input");
|
|
7170
|
-
|
|
7171
|
-
|
|
7172
|
-
|
|
7159
|
+
// an explicit own-key copy beats object rest with excluded keys, which v8 routes through a generic runtime call; Object.keys rather than for-in so an issue pushed with a prototype does not leak inherited keys, and an own __proto__ key is dropped rather than assigned through the setter
|
|
7160
|
+
const full = {};
|
|
7161
|
+
for (const k of Object.keys(iss)) {
|
|
7162
|
+
if (k === "inst" || k === "schema" || k === "continue" || k === "input" || k === "__proto__")
|
|
7163
|
+
continue;
|
|
7164
|
+
full[k] = iss[k];
|
|
7165
|
+
}
|
|
7166
|
+
full.path ?? (full.path = []);
|
|
7167
|
+
full.message = message;
|
|
7173
7168
|
if (ctx?.reportInput) {
|
|
7174
|
-
|
|
7169
|
+
full.input = iss.input;
|
|
7175
7170
|
}
|
|
7176
|
-
return
|
|
7171
|
+
return full;
|
|
7177
7172
|
}
|
|
7178
7173
|
function getSizableOrigin(input) {
|
|
7179
7174
|
if (input instanceof Set)
|
|
@@ -7320,6 +7315,24 @@ function util_own(inst, key, value, enumerable = true) {
|
|
|
7320
7315
|
function hide(inst, key, value) {
|
|
7321
7316
|
return util_own(inst, key, value, false);
|
|
7322
7317
|
}
|
|
7318
|
+
/** Adds members a table derives from the instance: each builds on first read and shadows as own data, and assignment shadows the same way, as when these were own properties. */
|
|
7319
|
+
function derived(computes, table) {
|
|
7320
|
+
for (const key in computes) {
|
|
7321
|
+
const compute = computes[key];
|
|
7322
|
+
// an object literal's accessor is configurable and enumerable, and `members` copies the descriptor as written
|
|
7323
|
+
Object.defineProperty(table, key, {
|
|
7324
|
+
configurable: true,
|
|
7325
|
+
enumerable: true,
|
|
7326
|
+
get() {
|
|
7327
|
+
return util_own(this, key, compute(this));
|
|
7328
|
+
},
|
|
7329
|
+
set(value) {
|
|
7330
|
+
util_own(this, key, value);
|
|
7331
|
+
},
|
|
7332
|
+
});
|
|
7333
|
+
}
|
|
7334
|
+
return table;
|
|
7335
|
+
}
|
|
7323
7336
|
function defineBound(proto, key, fn) {
|
|
7324
7337
|
Object.defineProperty(proto, key, {
|
|
7325
7338
|
configurable: true,
|
|
@@ -7486,7 +7499,7 @@ proto, params) {
|
|
|
7486
7499
|
_zodDesc.value = undefined;
|
|
7487
7500
|
}
|
|
7488
7501
|
}
|
|
7489
|
-
if (inst._zod.traits.has(name)) {
|
|
7502
|
+
else if (inst._zod.traits.has(name)) {
|
|
7490
7503
|
return;
|
|
7491
7504
|
}
|
|
7492
7505
|
inst._zod.traits.add(name);
|
|
@@ -7569,6 +7582,7 @@ function core_config(newConfig) {
|
|
|
7569
7582
|
}
|
|
7570
7583
|
|
|
7571
7584
|
;// CONCATENATED MODULE: ../../node_modules/zod/v4/core/memoizer.js
|
|
7585
|
+
|
|
7572
7586
|
class $ZodCyclicError extends Error {
|
|
7573
7587
|
constructor() {
|
|
7574
7588
|
super(`Cannot parse a reference cycle that closes through a transform`);
|
|
@@ -7578,32 +7592,62 @@ class $ZodCyclicError extends Error {
|
|
|
7578
7592
|
/** Keyed off the context object every schema in one parse call already shares. */
|
|
7579
7593
|
const STATE = "~memo";
|
|
7580
7594
|
const NO_ISSUES = [];
|
|
7595
|
+
// a value a cycle can close through
|
|
7596
|
+
function isRef(value) {
|
|
7597
|
+
return value !== null && typeof value === "object";
|
|
7598
|
+
}
|
|
7581
7599
|
// Receivers prefix paths in place, so the cache and every hand-out need their own copies.
|
|
7582
7600
|
function cloneIssues(issues) {
|
|
7583
7601
|
return issues.map((iss) => (iss.path ? { ...iss, path: iss.path.slice() } : { ...iss }));
|
|
7584
7602
|
}
|
|
7585
7603
|
const recursive = /*@__PURE__*/ new WeakMap();
|
|
7604
|
+
/** What the walk established, in order of certainty: ordered so the strongest answer among children wins. */
|
|
7605
|
+
const NONE = 0;
|
|
7606
|
+
const ASSUMED = 1;
|
|
7607
|
+
const PROVEN = 2;
|
|
7586
7608
|
/** Whether this schema's subtree contains a cycle, so one parse can re-enter it. */
|
|
7587
|
-
function isRecursive(inst, stack) {
|
|
7609
|
+
function isRecursive(inst, stack, resolve) {
|
|
7588
7610
|
const cached = recursive.get(inst);
|
|
7589
7611
|
if (cached !== undefined)
|
|
7590
|
-
return cached;
|
|
7612
|
+
return cached ? PROVEN : NONE;
|
|
7591
7613
|
// Relative to the walk in progress, so not cached.
|
|
7592
7614
|
if (stack.has(inst))
|
|
7593
|
-
return
|
|
7615
|
+
return PROVEN;
|
|
7594
7616
|
stack.add(inst);
|
|
7595
|
-
let result =
|
|
7617
|
+
let result = NONE;
|
|
7596
7618
|
const check = (child) => {
|
|
7597
|
-
if (
|
|
7598
|
-
|
|
7619
|
+
if (result !== PROVEN && child?._zod) {
|
|
7620
|
+
const answer = isRecursive(child, stack, resolve);
|
|
7621
|
+
if (answer > result)
|
|
7622
|
+
result = answer;
|
|
7623
|
+
}
|
|
7624
|
+
};
|
|
7625
|
+
// `Reflect.ownKeys` rather than `Object.keys`, so a cycle through a declared symbol key is still seen
|
|
7626
|
+
const shape = (sh, spread) => {
|
|
7627
|
+
let answer = NONE;
|
|
7628
|
+
for (const key of Reflect.ownKeys(sh)) {
|
|
7629
|
+
const desc = Object.getOwnPropertyDescriptor(sh, key);
|
|
7630
|
+
// an object resolves its shape by spread, so a key it does not enumerate is never parsed; `z.properties` reads every own key and so keeps them all
|
|
7631
|
+
if (spread && !desc.enumerable)
|
|
7632
|
+
continue;
|
|
7633
|
+
// resolving runs user code, and a factory mints a fresh subtree per read, so an edge the walk can't follow counts as a cycle
|
|
7634
|
+
const child = desc.get ? ASSUMED : desc.value?._zod ? isRecursive(desc.value, stack, resolve) : NONE;
|
|
7635
|
+
if (child > answer)
|
|
7636
|
+
answer = child;
|
|
7637
|
+
}
|
|
7638
|
+
return answer;
|
|
7639
|
+
};
|
|
7640
|
+
const merge = (answer) => {
|
|
7641
|
+
if (answer > result)
|
|
7642
|
+
result = answer;
|
|
7599
7643
|
};
|
|
7600
7644
|
const def = inst._zod.def;
|
|
7601
7645
|
const kind = def.type;
|
|
7602
7646
|
switch (kind) {
|
|
7603
7647
|
case "object": {
|
|
7604
|
-
|
|
7605
|
-
|
|
7606
|
-
|
|
7648
|
+
const raw = util_rawShape(def);
|
|
7649
|
+
// a def with no raw shape answers `shape` from an accessor of its own, and running that can mint a whole fresh subtree
|
|
7650
|
+
merge(raw ? shape(raw, true) : ASSUMED);
|
|
7607
7651
|
check(def.catchall);
|
|
7608
7652
|
break;
|
|
7609
7653
|
}
|
|
@@ -7650,10 +7694,13 @@ function isRecursive(inst, stack) {
|
|
|
7650
7694
|
check(def.input);
|
|
7651
7695
|
check(def.output);
|
|
7652
7696
|
break;
|
|
7653
|
-
//
|
|
7654
|
-
case "lazy":
|
|
7655
|
-
|
|
7697
|
+
// `$ZodLazy` caches its inner on the def, so a resolved edge is followed exactly
|
|
7698
|
+
case "lazy": {
|
|
7699
|
+
const inner = def._cachedInner ?? (resolve ? inst._zod.innerType : undefined);
|
|
7700
|
+
// walked with resolution off: one hop sees past the deferral, and a lazy that yields only another unresolved lazy is generative, so it stops there
|
|
7701
|
+
merge(inner ? isRecursive(inner, stack, false) : ASSUMED);
|
|
7656
7702
|
break;
|
|
7703
|
+
}
|
|
7657
7704
|
// a leaf by choice: `parts` are regex fragments, not data positions
|
|
7658
7705
|
case "template_literal":
|
|
7659
7706
|
// leaves
|
|
@@ -7697,8 +7744,13 @@ function isRecursive(inst, stack) {
|
|
|
7697
7744
|
}
|
|
7698
7745
|
}
|
|
7699
7746
|
stack.delete(inst);
|
|
7700
|
-
|
|
7701
|
-
|
|
7747
|
+
return settle(inst, result);
|
|
7748
|
+
}
|
|
7749
|
+
/** An assumed answer must not outlive the resolution that settles it, so only a certain one is cached. */
|
|
7750
|
+
function settle(inst, answer) {
|
|
7751
|
+
if (answer !== ASSUMED)
|
|
7752
|
+
recursive.set(inst, answer === PROVEN);
|
|
7753
|
+
return answer;
|
|
7702
7754
|
}
|
|
7703
7755
|
/**
|
|
7704
7756
|
* Whether one parse can re-enter this schema, i.e. its subtree contains a cycle.
|
|
@@ -7707,12 +7759,13 @@ function isRecursive(inst, stack) {
|
|
|
7707
7759
|
* generated fast path has no context to key on.
|
|
7708
7760
|
*/
|
|
7709
7761
|
function isRecursiveSchema(inst) {
|
|
7710
|
-
|
|
7762
|
+
// z.compile never parses, so nothing would ever resolve a lazy for it; it runs once and already treats a throw here as recursive
|
|
7763
|
+
return isRecursive(inst, new Set(), true) !== NONE;
|
|
7711
7764
|
}
|
|
7712
7765
|
function bucketFor(state, inst) {
|
|
7713
7766
|
let bucket = state.buckets.get(inst);
|
|
7714
7767
|
if (!bucket) {
|
|
7715
|
-
bucket = new
|
|
7768
|
+
bucket = new WeakMap();
|
|
7716
7769
|
state.buckets.set(inst, bucket);
|
|
7717
7770
|
}
|
|
7718
7771
|
return bucket;
|
|
@@ -7751,7 +7804,8 @@ const memoizer_memo = {
|
|
|
7751
7804
|
attach(inst) {
|
|
7752
7805
|
var _a;
|
|
7753
7806
|
let isRecursiveInst;
|
|
7754
|
-
|
|
7807
|
+
let rechecked = false;
|
|
7808
|
+
// a recursive schema is re-entered many times per parse and its bucket never changes
|
|
7755
7809
|
let lastCtx;
|
|
7756
7810
|
let lastBucket;
|
|
7757
7811
|
// Wraps `parse` in a deferred so it sees the container's final parse. Core's own deferred copies `parse` into `run` when there are no checks, and it ran first, so `run` is patched to match; with checks, `run` reads `parse` dynamically.
|
|
@@ -7760,21 +7814,26 @@ const memoizer_memo = {
|
|
|
7760
7814
|
const base = inst._zod.parse;
|
|
7761
7815
|
const wrapped = (payload, ctx) => {
|
|
7762
7816
|
if (isRecursiveInst === undefined) {
|
|
7763
|
-
|
|
7764
|
-
if (
|
|
7817
|
+
const walked = isRecursive(inst, new Set(), false);
|
|
7818
|
+
if (walked === NONE) {
|
|
7765
7819
|
// Nothing here can ever fire, so take it back out.
|
|
7766
7820
|
inst._zod.parse = base;
|
|
7767
7821
|
if (inst._zod.run === wrapped)
|
|
7768
7822
|
inst._zod.run = base;
|
|
7769
7823
|
return base(payload, ctx);
|
|
7770
7824
|
}
|
|
7825
|
+
// this parse resolves the deferred edges on its own path, so ask once more before latching
|
|
7826
|
+
if (walked === PROVEN || rechecked)
|
|
7827
|
+
isRecursiveInst = true;
|
|
7828
|
+
else
|
|
7829
|
+
rechecked = true;
|
|
7771
7830
|
}
|
|
7772
7831
|
const input = payload.value;
|
|
7773
|
-
if (input
|
|
7832
|
+
if (!isRef(input))
|
|
7774
7833
|
return base(payload, ctx);
|
|
7775
7834
|
let state = ctx[STATE];
|
|
7776
7835
|
if (!state) {
|
|
7777
|
-
state = { buckets: new
|
|
7836
|
+
state = { buckets: new WeakMap(), backEdges: undefined };
|
|
7778
7837
|
ctx[STATE] = state;
|
|
7779
7838
|
}
|
|
7780
7839
|
let bucket;
|
|
@@ -7796,7 +7855,7 @@ const memoizer_memo = {
|
|
|
7796
7855
|
else {
|
|
7797
7856
|
// Still being parsed: its own checks cover it, so skip them here.
|
|
7798
7857
|
payload.memo = true;
|
|
7799
|
-
state.backEdges ?? (state.backEdges = new
|
|
7858
|
+
state.backEdges ?? (state.backEdges = new WeakSet());
|
|
7800
7859
|
state.backEdges.add(hit.value);
|
|
7801
7860
|
}
|
|
7802
7861
|
return payload;
|
|
@@ -7832,7 +7891,7 @@ function memoizer() {
|
|
|
7832
7891
|
/** Whether this value is a node a back-edge resolved to before it finished. */
|
|
7833
7892
|
function isBackEdge(ctx, value) {
|
|
7834
7893
|
const backEdges = ctx[STATE]?.backEdges;
|
|
7835
|
-
return backEdges !== undefined && value
|
|
7894
|
+
return backEdges !== undefined && isRef(value) && backEdges.has(value);
|
|
7836
7895
|
}
|
|
7837
7896
|
|
|
7838
7897
|
;// CONCATENATED MODULE: ../../node_modules/zod/v4/core/regexes.js
|
|
@@ -7869,7 +7928,7 @@ const uuid4 = /*@__PURE__*/ (/* unused pure expression or super */ null && (uuid
|
|
|
7869
7928
|
const uuid6 = /*@__PURE__*/ (/* unused pure expression or super */ null && (uuid(6)));
|
|
7870
7929
|
const uuid7 = /*@__PURE__*/ (/* unused pure expression or super */ null && (uuid(7)));
|
|
7871
7930
|
/** Practical email validation */
|
|
7872
|
-
const email = /^(
|
|
7931
|
+
const email = /^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;
|
|
7873
7932
|
/** Equivalent to the HTML5 input[type=email] validation implemented by browsers. Source: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/email */
|
|
7874
7933
|
const html5Email = /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;
|
|
7875
7934
|
/** The classic emailregex.com regex for RFC 5322-compliant emails */
|
|
@@ -7879,8 +7938,8 @@ const unicodeEmail = /^[^\s@"]{1,64}@[^\s@]{1,255}$/u;
|
|
|
7879
7938
|
const idnEmail = (/* unused pure expression or super */ null && (unicodeEmail));
|
|
7880
7939
|
const browserEmail = /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;
|
|
7881
7940
|
// from https://thekevinscott.com/emojis-in-javascript/#writing-a-regular-expression
|
|
7882
|
-
// Single character class, not an alternation: the two properties overlap (U+1F9B0-U+1F9B3), so `(A|B)+` backtracks exponentially on a failed match.
|
|
7883
|
-
const _emoji = `^[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`;
|
|
7941
|
+
// Single character class, not an alternation: the two properties overlap (U+1F9B0-U+1F9B3), so `(A|B)+` backtracks exponentially on a failed match. The leading lookahead then demands one anchor — a pictograph, a regional indicator, or the enclosing keycap — because `\p{Emoji_Component}` on its own covers ASCII digits, `#`, `*`, ZWJ, variation selectors and skin tone modifiers, none of which is an emoji without a base.
|
|
7942
|
+
const _emoji = `^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`;
|
|
7884
7943
|
function emoji() {
|
|
7885
7944
|
return new RegExp(_emoji, "u");
|
|
7886
7945
|
}
|
|
@@ -7894,7 +7953,7 @@ const cidrv4 = /^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-
|
|
|
7894
7953
|
const 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])$/;
|
|
7895
7954
|
// https://stackoverflow.com/questions/7860392/determine-if-string-is-in-base64-using-javascript
|
|
7896
7955
|
const regexes_base64 = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/;
|
|
7897
|
-
const regexes_base64url = /^[A-Za-z0-9_-]
|
|
7956
|
+
const regexes_base64url = /^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/;
|
|
7898
7957
|
// based on https://stackoverflow.com/questions/106179/regular-expression-to-match-dns-hostname-or-ip-address
|
|
7899
7958
|
// export const hostname: RegExp = /^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/;
|
|
7900
7959
|
const regexes_hostname = /^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/;
|
|
@@ -7904,6 +7963,10 @@ const httpProtocol = /^https?$/;
|
|
|
7904
7963
|
const e164 = /^\+[1-9]\d{6,14}$/;
|
|
7905
7964
|
// Credit card shape: 12–19 digits, optionally separated by single spaces or single hyphens. ISO/IEC 7812 caps the PAN at 19 digits; 12 is the shortest issued length (Maestro).
|
|
7906
7965
|
const creditCard = /^\d(?:[ -]?\d){11,18}$/;
|
|
7966
|
+
// ISO 4217 alpha codes from the SIX list, regenerated by scripts/update-iso-4217.ts
|
|
7967
|
+
const currencyCode = /^(?:AED|AFN|ALL|AMD|AOA|ARS|AUD|AWG|AZN|BAM|BBD|BDT|BHD|BIF|BMD|BND|BOB|BOV|BRL|BSD|BTN|BWP|BYN|BZD|CAD|CDF|CHE|CHF|CHW|CLF|CLP|CNY|COP|COU|CRC|CUP|CVE|CZK|DJF|DKK|DOP|DZD|EGP|ERN|ETB|EUR|FJD|FKP|GBP|GEL|GHS|GIP|GMD|GNF|GTQ|GYD|HKD|HNL|HTG|HUF|IDR|ILS|INR|IQD|IRR|ISK|JMD|JOD|JPY|KES|KGS|KHR|KMF|KPW|KRW|KWD|KYD|KZT|LAK|LBP|LKR|LRD|LSL|LYD|MAD|MDL|MGA|MKD|MMK|MNT|MOP|MRU|MUR|MVR|MWK|MXN|MXV|MYR|MZN|NAD|NGN|NIO|NOK|NPR|NZD|OMR|PAB|PEN|PGK|PHP|PKR|PLN|PYG|QAR|RON|RSD|RUB|RWF|SAR|SBD|SCR|SDG|SEK|SGD|SHP|SLE|SOS|SRD|SSP|STN|SVC|SYP|SZL|THB|TJS|TMT|TND|TOP|TRY|TTD|TWD|TZS|UAH|UGX|USD|USN|UYI|UYU|UYW|UZS|VED|VES|VND|VUV|WST|XAD|XAF|XAG|XAU|XBA|XBB|XBC|XBD|XCD|XCG|XDR|XOF|XPD|XPF|XPT|XSU|XTS|XUA|XXX|YER|ZAR|ZMW|ZWG)$/;
|
|
7968
|
+
// iban electronic format: 2-letter country, check digits 02-98 (the only values `98 - remainder` can produce), 11-30 bban characters
|
|
7969
|
+
const regexes_iban = /^[A-Z]{2}(?!00|01|99)\d{2}[A-Z0-9]{11,30}$/;
|
|
7907
7970
|
const 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])))`;
|
|
7908
7971
|
/** Anchors a pattern source. The interpolation lives here rather than at the call site because
|
|
7909
7972
|
* esbuild will not drop a `@__PURE__` call whose own argument interpolates a variable, but it
|
|
@@ -7939,6 +8002,8 @@ function datetime(args) {
|
|
|
7939
8002
|
const timeRegex = args.local ? `${qualified}|${timeSource({ precision: args.precision })}` : qualified;
|
|
7940
8003
|
return new RegExp(`^${dateSource}T(?:${timeRegex})$`);
|
|
7941
8004
|
}
|
|
8005
|
+
// the unbounded form of `string()` as a literal, so every plain string shares one instance instead of building its own
|
|
8006
|
+
const anyString = /^[\s\S]{0,}$/;
|
|
7942
8007
|
const regexes_string = (params) => {
|
|
7943
8008
|
const regex = params ? `[\\s\\S]{${params?.minimum ?? 0},${params?.maximum ?? ""}}` : `[\\s\\S]*`;
|
|
7944
8009
|
return new RegExp(`^${regex}$`);
|
|
@@ -8016,16 +8081,6 @@ const numericOriginMap = {
|
|
|
8016
8081
|
const $ZodCheckLessThan = /*@__PURE__*/ $constructor("$ZodCheckLessThan", (inst, def) => {
|
|
8017
8082
|
$ZodCheck.init(inst, def);
|
|
8018
8083
|
const origin = numericOriginMap[typeof def.value];
|
|
8019
|
-
inst._zod.onattach.push((inst) => {
|
|
8020
|
-
const bag = inst._zod.bag;
|
|
8021
|
-
const curr = (def.inclusive ? bag.maximum : bag.exclusiveMaximum) ?? Number.POSITIVE_INFINITY;
|
|
8022
|
-
if (def.value < curr) {
|
|
8023
|
-
if (def.inclusive)
|
|
8024
|
-
bag.maximum = def.value;
|
|
8025
|
-
else
|
|
8026
|
-
bag.exclusiveMaximum = def.value;
|
|
8027
|
-
}
|
|
8028
|
-
});
|
|
8029
8084
|
inst._zod.check = (payload) => {
|
|
8030
8085
|
if (def.inclusive ? payload.value <= def.value : payload.value < def.value) {
|
|
8031
8086
|
return;
|
|
@@ -8044,16 +8099,6 @@ const $ZodCheckLessThan = /*@__PURE__*/ $constructor("$ZodCheckLessThan", (inst,
|
|
|
8044
8099
|
const $ZodCheckGreaterThan = /*@__PURE__*/ $constructor("$ZodCheckGreaterThan", (inst, def) => {
|
|
8045
8100
|
$ZodCheck.init(inst, def);
|
|
8046
8101
|
const origin = numericOriginMap[typeof def.value];
|
|
8047
|
-
inst._zod.onattach.push((inst) => {
|
|
8048
|
-
const bag = inst._zod.bag;
|
|
8049
|
-
const curr = (def.inclusive ? bag.minimum : bag.exclusiveMinimum) ?? Number.NEGATIVE_INFINITY;
|
|
8050
|
-
if (def.value > curr) {
|
|
8051
|
-
if (def.inclusive)
|
|
8052
|
-
bag.minimum = def.value;
|
|
8053
|
-
else
|
|
8054
|
-
bag.exclusiveMinimum = def.value;
|
|
8055
|
-
}
|
|
8056
|
-
});
|
|
8057
8102
|
inst._zod.check = (payload) => {
|
|
8058
8103
|
if (def.inclusive ? payload.value >= def.value : payload.value > def.value) {
|
|
8059
8104
|
return;
|
|
@@ -8072,10 +8117,6 @@ const $ZodCheckGreaterThan = /*@__PURE__*/ $constructor("$ZodCheckGreaterThan",
|
|
|
8072
8117
|
const $ZodCheckMultipleOf =
|
|
8073
8118
|
/*@__PURE__*/ $constructor("$ZodCheckMultipleOf", (inst, def) => {
|
|
8074
8119
|
$ZodCheck.init(inst, def);
|
|
8075
|
-
inst._zod.onattach.push((inst) => {
|
|
8076
|
-
var _a;
|
|
8077
|
-
(_a = inst._zod.bag).multipleOf ?? (_a.multipleOf = def.value);
|
|
8078
|
-
});
|
|
8079
8120
|
inst._zod.check = (payload) => {
|
|
8080
8121
|
if (typeof payload.value !== typeof def.value)
|
|
8081
8122
|
throw new Error("Cannot mix number and bigint in multiple_of check.");
|
|
@@ -8101,14 +8142,6 @@ const $ZodCheckNumberFormat = /*@__PURE__*/ $constructor("$ZodCheckNumberFormat"
|
|
|
8101
8142
|
const isInt = def.format?.includes("int");
|
|
8102
8143
|
const origin = isInt ? "int" : "number";
|
|
8103
8144
|
const [minimum, maximum] = NUMBER_FORMAT_RANGES[def.format];
|
|
8104
|
-
inst._zod.onattach.push((inst) => {
|
|
8105
|
-
const bag = inst._zod.bag;
|
|
8106
|
-
bag.format = def.format;
|
|
8107
|
-
bag.minimum = minimum;
|
|
8108
|
-
bag.maximum = maximum;
|
|
8109
|
-
if (isInt)
|
|
8110
|
-
bag.pattern = integer;
|
|
8111
|
-
});
|
|
8112
8145
|
inst._zod.check = (payload) => {
|
|
8113
8146
|
const input = payload.value;
|
|
8114
8147
|
if (isInt) {
|
|
@@ -8197,12 +8230,6 @@ const $ZodCheckNumberFormat = /*@__PURE__*/ $constructor("$ZodCheckNumberFormat"
|
|
|
8197
8230
|
const $ZodCheckBigIntFormat = /*@__PURE__*/ (/* unused pure expression or super */ null && (core.$constructor("$ZodCheckBigIntFormat", (inst, def) => {
|
|
8198
8231
|
$ZodCheck.init(inst, def); // no format checks
|
|
8199
8232
|
const [minimum, maximum] = util.BIGINT_FORMAT_RANGES[def.format];
|
|
8200
|
-
inst._zod.onattach.push((inst) => {
|
|
8201
|
-
const bag = inst._zod.bag;
|
|
8202
|
-
bag.format = def.format;
|
|
8203
|
-
bag.minimum = minimum;
|
|
8204
|
-
bag.maximum = maximum;
|
|
8205
|
-
});
|
|
8206
8233
|
inst._zod.check = (payload) => {
|
|
8207
8234
|
const input = payload.value;
|
|
8208
8235
|
if (input < minimum) {
|
|
@@ -8233,11 +8260,6 @@ const $ZodCheckMaxSize = /*@__PURE__*/ (/* unused pure expression or super */ nu
|
|
|
8233
8260
|
var _a;
|
|
8234
8261
|
$ZodCheck.init(inst, def);
|
|
8235
8262
|
(_a = inst._zod.def).when ?? (_a.when = _whenHasSize);
|
|
8236
|
-
inst._zod.onattach.push((inst) => {
|
|
8237
|
-
const curr = (inst._zod.bag.maximum ?? Number.POSITIVE_INFINITY);
|
|
8238
|
-
if (def.maximum < curr)
|
|
8239
|
-
inst._zod.bag.maximum = def.maximum;
|
|
8240
|
-
});
|
|
8241
8263
|
inst._zod.check = (payload) => {
|
|
8242
8264
|
const input = payload.value;
|
|
8243
8265
|
const size = input.size;
|
|
@@ -8258,11 +8280,6 @@ const $ZodCheckMinSize = /*@__PURE__*/ (/* unused pure expression or super */ nu
|
|
|
8258
8280
|
var _a;
|
|
8259
8281
|
$ZodCheck.init(inst, def);
|
|
8260
8282
|
(_a = inst._zod.def).when ?? (_a.when = _whenHasSize);
|
|
8261
|
-
inst._zod.onattach.push((inst) => {
|
|
8262
|
-
const curr = (inst._zod.bag.minimum ?? Number.NEGATIVE_INFINITY);
|
|
8263
|
-
if (def.minimum > curr)
|
|
8264
|
-
inst._zod.bag.minimum = def.minimum;
|
|
8265
|
-
});
|
|
8266
8283
|
inst._zod.check = (payload) => {
|
|
8267
8284
|
const input = payload.value;
|
|
8268
8285
|
const size = input.size;
|
|
@@ -8283,12 +8300,6 @@ const $ZodCheckSizeEquals = /*@__PURE__*/ (/* unused pure expression or super */
|
|
|
8283
8300
|
var _a;
|
|
8284
8301
|
$ZodCheck.init(inst, def);
|
|
8285
8302
|
(_a = inst._zod.def).when ?? (_a.when = _whenHasSize);
|
|
8286
|
-
inst._zod.onattach.push((inst) => {
|
|
8287
|
-
const bag = inst._zod.bag;
|
|
8288
|
-
bag.minimum = def.size;
|
|
8289
|
-
bag.maximum = def.size;
|
|
8290
|
-
bag.size = def.size;
|
|
8291
|
-
});
|
|
8292
8303
|
inst._zod.check = (payload) => {
|
|
8293
8304
|
const input = payload.value;
|
|
8294
8305
|
const size = input.size;
|
|
@@ -8310,11 +8321,6 @@ const $ZodCheckMaxLength = /*@__PURE__*/ $constructor("$ZodCheckMaxLength", (ins
|
|
|
8310
8321
|
var _a;
|
|
8311
8322
|
$ZodCheck.init(inst, def);
|
|
8312
8323
|
(_a = inst._zod.def).when ?? (_a.when = _whenHasLength);
|
|
8313
|
-
inst._zod.onattach.push((inst) => {
|
|
8314
|
-
const curr = (inst._zod.bag.maximum ?? Number.POSITIVE_INFINITY);
|
|
8315
|
-
if (def.maximum < curr)
|
|
8316
|
-
inst._zod.bag.maximum = def.maximum;
|
|
8317
|
-
});
|
|
8318
8324
|
inst._zod.check = (payload) => {
|
|
8319
8325
|
const input = payload.value;
|
|
8320
8326
|
const units = input.length;
|
|
@@ -8338,11 +8344,6 @@ const $ZodCheckMinLength = /*@__PURE__*/ $constructor("$ZodCheckMinLength", (ins
|
|
|
8338
8344
|
var _a;
|
|
8339
8345
|
$ZodCheck.init(inst, def);
|
|
8340
8346
|
(_a = inst._zod.def).when ?? (_a.when = _whenHasLength);
|
|
8341
|
-
inst._zod.onattach.push((inst) => {
|
|
8342
|
-
const curr = (inst._zod.bag.minimum ?? Number.NEGATIVE_INFINITY);
|
|
8343
|
-
if (def.minimum > curr)
|
|
8344
|
-
inst._zod.bag.minimum = def.minimum;
|
|
8345
|
-
});
|
|
8346
8347
|
inst._zod.check = (payload) => {
|
|
8347
8348
|
const input = payload.value;
|
|
8348
8349
|
const units = input.length;
|
|
@@ -8368,12 +8369,6 @@ const $ZodCheckLengthEquals = /*@__PURE__*/ $constructor("$ZodCheckLengthEquals"
|
|
|
8368
8369
|
var _a;
|
|
8369
8370
|
$ZodCheck.init(inst, def);
|
|
8370
8371
|
(_a = inst._zod.def).when ?? (_a.when = _whenHasLength);
|
|
8371
|
-
inst._zod.onattach.push((inst) => {
|
|
8372
|
-
const bag = inst._zod.bag;
|
|
8373
|
-
bag.minimum = def.length;
|
|
8374
|
-
bag.maximum = def.length;
|
|
8375
|
-
bag.length = def.length;
|
|
8376
|
-
});
|
|
8377
8372
|
inst._zod.check = (payload) => {
|
|
8378
8373
|
const input = payload.value;
|
|
8379
8374
|
const units = input.length;
|
|
@@ -8399,14 +8394,6 @@ const $ZodCheckLengthEquals = /*@__PURE__*/ $constructor("$ZodCheckLengthEquals"
|
|
|
8399
8394
|
const $ZodCheckStringFormat = /*@__PURE__*/ $constructor("$ZodCheckStringFormat", (inst, def) => {
|
|
8400
8395
|
var _a, _b;
|
|
8401
8396
|
$ZodCheck.init(inst, def);
|
|
8402
|
-
inst._zod.onattach.push((inst) => {
|
|
8403
|
-
const bag = inst._zod.bag;
|
|
8404
|
-
bag.format = def.format;
|
|
8405
|
-
if (def.pattern) {
|
|
8406
|
-
bag.patterns ?? (bag.patterns = new Set());
|
|
8407
|
-
bag.patterns.add(def.pattern);
|
|
8408
|
-
}
|
|
8409
|
-
});
|
|
8410
8397
|
if (def.pattern)
|
|
8411
8398
|
(_a = inst._zod).check ?? (_a.check = (payload) => {
|
|
8412
8399
|
def.pattern.lastIndex = 0;
|
|
@@ -8458,11 +8445,6 @@ const $ZodCheckIncludes = /*@__PURE__*/ $constructor("$ZodCheckIncludes", (inst,
|
|
|
8458
8445
|
// (`{N,}`), not exactly `position` chars (`{N}`).
|
|
8459
8446
|
const pattern = new RegExp(typeof def.position === "number" ? `^.{${def.position},}${escapedRegex}` : escapedRegex);
|
|
8460
8447
|
def.pattern = pattern;
|
|
8461
|
-
inst._zod.onattach.push((inst) => {
|
|
8462
|
-
const bag = inst._zod.bag;
|
|
8463
|
-
bag.patterns ?? (bag.patterns = new Set());
|
|
8464
|
-
bag.patterns.add(pattern);
|
|
8465
|
-
});
|
|
8466
8448
|
inst._zod.check = (payload) => {
|
|
8467
8449
|
if (payload.value.includes(def.includes, def.position))
|
|
8468
8450
|
return;
|
|
@@ -8481,11 +8463,6 @@ const $ZodCheckStartsWith = /*@__PURE__*/ $constructor("$ZodCheckStartsWith", (i
|
|
|
8481
8463
|
$ZodCheck.init(inst, def);
|
|
8482
8464
|
const pattern = new RegExp(`^${escapeRegex(def.prefix)}.*`);
|
|
8483
8465
|
def.pattern ?? (def.pattern = pattern);
|
|
8484
|
-
inst._zod.onattach.push((inst) => {
|
|
8485
|
-
const bag = inst._zod.bag;
|
|
8486
|
-
bag.patterns ?? (bag.patterns = new Set());
|
|
8487
|
-
bag.patterns.add(pattern);
|
|
8488
|
-
});
|
|
8489
8466
|
inst._zod.check = (payload) => {
|
|
8490
8467
|
if (payload.value.startsWith(def.prefix))
|
|
8491
8468
|
return;
|
|
@@ -8504,11 +8481,6 @@ const $ZodCheckEndsWith = /*@__PURE__*/ $constructor("$ZodCheckEndsWith", (inst,
|
|
|
8504
8481
|
$ZodCheck.init(inst, def);
|
|
8505
8482
|
const pattern = new RegExp(`.*${escapeRegex(def.suffix)}$`);
|
|
8506
8483
|
def.pattern ?? (def.pattern = pattern);
|
|
8507
|
-
inst._zod.onattach.push((inst) => {
|
|
8508
|
-
const bag = inst._zod.bag;
|
|
8509
|
-
bag.patterns ?? (bag.patterns = new Set());
|
|
8510
|
-
bag.patterns.add(pattern);
|
|
8511
|
-
});
|
|
8512
8484
|
inst._zod.check = (payload) => {
|
|
8513
8485
|
if (payload.value.endsWith(def.suffix))
|
|
8514
8486
|
return;
|
|
@@ -8545,12 +8517,40 @@ const $ZodCheckProperty = /*@__PURE__*/ (/* unused pure expression or super */ n
|
|
|
8545
8517
|
return;
|
|
8546
8518
|
};
|
|
8547
8519
|
})));
|
|
8520
|
+
const $ZodCheckProperties = /*@__PURE__*/ (/* unused pure expression or super */ null && (core.$constructor("$ZodCheckProperties", (inst, def) => {
|
|
8521
|
+
$ZodCheck.init(inst, def);
|
|
8522
|
+
util.hide(inst, Symbol.iterator, function* () {
|
|
8523
|
+
yield inst;
|
|
8524
|
+
});
|
|
8525
|
+
// key and schema snapshotted together: reading one live and the other cached lets a later mutation of the caller's shape object pair a stale key with a missing schema
|
|
8526
|
+
let entries;
|
|
8527
|
+
inst._zod.check = (payload) => {
|
|
8528
|
+
// the base schema already typed the value, so only a nullish one is rejected here: the properties read on a primitive too, matching z.property() on a string's length
|
|
8529
|
+
if (payload.value == null) {
|
|
8530
|
+
payload.issues.push({ expected: "object", code: "invalid_type", input: payload.value, inst });
|
|
8531
|
+
return undefined;
|
|
8532
|
+
}
|
|
8533
|
+
entries ?? (entries = Reflect.ownKeys(def.shape).map((key) => [key, def.shape[key]]));
|
|
8534
|
+
const input = payload.value;
|
|
8535
|
+
let proms;
|
|
8536
|
+
for (const [key, schema] of entries) {
|
|
8537
|
+
const result = schema._zod.run({ value: input[key], issues: [] }, {});
|
|
8538
|
+
if (result instanceof Promise) {
|
|
8539
|
+
proms ?? (proms = []);
|
|
8540
|
+
proms.push(result.then((result) => handleCheckPropertyResult(result, payload, key)));
|
|
8541
|
+
}
|
|
8542
|
+
else {
|
|
8543
|
+
handleCheckPropertyResult(result, payload, key);
|
|
8544
|
+
}
|
|
8545
|
+
}
|
|
8546
|
+
if (proms)
|
|
8547
|
+
return Promise.all(proms).then(() => undefined);
|
|
8548
|
+
return undefined;
|
|
8549
|
+
};
|
|
8550
|
+
})));
|
|
8548
8551
|
const $ZodCheckMimeType = /*@__PURE__*/ (/* unused pure expression or super */ null && (core.$constructor("$ZodCheckMimeType", (inst, def) => {
|
|
8549
8552
|
$ZodCheck.init(inst, def);
|
|
8550
8553
|
const mimeSet = new Set(def.mime);
|
|
8551
|
-
inst._zod.onattach.push((inst) => {
|
|
8552
|
-
inst._zod.bag.mime = def.mime;
|
|
8553
|
-
});
|
|
8554
8554
|
inst._zod.check = (payload) => {
|
|
8555
8555
|
if (mimeSet.has(payload.value.type))
|
|
8556
8556
|
return;
|
|
@@ -8578,10 +8578,15 @@ class Doc {
|
|
|
8578
8578
|
this.args = args;
|
|
8579
8579
|
this.closed = closed;
|
|
8580
8580
|
}
|
|
8581
|
+
// the compiler catches a child's throw and keeps writing into this doc, so the indent has to unwind with it
|
|
8581
8582
|
indented(fn) {
|
|
8582
8583
|
this.indent += 1;
|
|
8583
|
-
|
|
8584
|
-
|
|
8584
|
+
try {
|
|
8585
|
+
fn(this);
|
|
8586
|
+
}
|
|
8587
|
+
finally {
|
|
8588
|
+
this.indent -= 1;
|
|
8589
|
+
}
|
|
8585
8590
|
}
|
|
8586
8591
|
write(arg) {
|
|
8587
8592
|
if (typeof arg === "function") {
|
|
@@ -8605,439 +8610,11 @@ class Doc {
|
|
|
8605
8610
|
}
|
|
8606
8611
|
}
|
|
8607
8612
|
|
|
8608
|
-
;// CONCATENATED MODULE: ../../node_modules/zod/v4/core/errors.js
|
|
8609
|
-
|
|
8610
|
-
|
|
8611
|
-
/* Computing the message eagerly is expensive (pretty-printed JSON of all
|
|
8612
|
-
* issues), so defer it until first read. The accessor functions and
|
|
8613
|
-
* descriptors are shared across instances to keep error construction
|
|
8614
|
-
* cheap; the computed message is cached on the internals object. The
|
|
8615
|
-
* setter preserves plain assignment semantics for consumers that
|
|
8616
|
-
* overwrite `message`. */
|
|
8617
|
-
function _getMessage() {
|
|
8618
|
-
const internals = this._zod;
|
|
8619
|
-
internals.message ?? (internals.message = JSON.stringify(internals.def, jsonStringifyReplacer, 2));
|
|
8620
|
-
return internals.message;
|
|
8621
|
-
}
|
|
8622
|
-
function _setMessage(value) {
|
|
8623
|
-
this._zod.message = value;
|
|
8624
|
-
}
|
|
8625
|
-
const _messageDesc = {
|
|
8626
|
-
get: _getMessage,
|
|
8627
|
-
set: _setMessage,
|
|
8628
|
-
enumerable: true,
|
|
8629
|
-
configurable: true,
|
|
8630
|
-
};
|
|
8631
|
-
const errors_zodDesc = { value: undefined, enumerable: false };
|
|
8632
|
-
const _issuesDesc = { value: undefined, enumerable: false };
|
|
8633
|
-
/* Prototypes that already carry the lazy `toString`. Seeded with the
|
|
8634
|
-
* intrinsics so that `init` on a foreign object — it accepts any object —
|
|
8635
|
-
* can never install an accessor onto a prototype we do not own. */
|
|
8636
|
-
const _installedToString = /* @__PURE__ */ new WeakSet([Object.prototype, Error.prototype]);
|
|
8637
|
-
const errors_initializer = (inst, def) => {
|
|
8638
|
-
inst.name = "$ZodError";
|
|
8639
|
-
errors_zodDesc.value = inst._zod;
|
|
8640
|
-
Object.defineProperty(inst, "_zod", errors_zodDesc);
|
|
8641
|
-
_issuesDesc.value = def;
|
|
8642
|
-
Object.defineProperty(inst, "issues", _issuesDesc);
|
|
8643
|
-
// Clear the shared slots; a retained `value` pins the last error's issues.
|
|
8644
|
-
errors_zodDesc.value = undefined;
|
|
8645
|
-
_issuesDesc.value = undefined;
|
|
8646
|
-
Object.defineProperty(inst, "message", _messageDesc);
|
|
8647
|
-
/* `toString` lives as a non-enumerable lazy getter on the shared
|
|
8648
|
-
* prototype; on first access it caches a per-instance closure so
|
|
8649
|
-
* detached usage still works. */
|
|
8650
|
-
const proto = Object.getPrototypeOf(inst);
|
|
8651
|
-
if (!_installedToString.has(proto)) {
|
|
8652
|
-
_installedToString.add(proto);
|
|
8653
|
-
Object.defineProperty(proto, "toString", {
|
|
8654
|
-
configurable: true,
|
|
8655
|
-
enumerable: false,
|
|
8656
|
-
get() {
|
|
8657
|
-
const value = () => this.message;
|
|
8658
|
-
Object.defineProperty(this, "toString", { value, configurable: true, writable: true });
|
|
8659
|
-
return value;
|
|
8660
|
-
},
|
|
8661
|
-
set(value) {
|
|
8662
|
-
Object.defineProperty(this, "toString", { value, configurable: true, writable: true });
|
|
8663
|
-
},
|
|
8664
|
-
});
|
|
8665
|
-
}
|
|
8666
|
-
};
|
|
8667
|
-
const $ZodError = $constructor("$ZodError", errors_initializer);
|
|
8668
|
-
const $ZodRealError = $constructor("$ZodError", errors_initializer, undefined, {
|
|
8669
|
-
Parent: Error,
|
|
8670
|
-
});
|
|
8671
|
-
/** Get-or-create `obj[key]` as an own data property. A path segment naming an inherited member
|
|
8672
|
-
* ("toString", "constructor") would otherwise read through to the prototype, and assigning
|
|
8673
|
-
* "__proto__" would hit the setter instead of creating a key. */
|
|
8674
|
-
function errors_node(obj, key, make) {
|
|
8675
|
-
if (!Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
8676
|
-
if (key === "__proto__") {
|
|
8677
|
-
Object.defineProperty(obj, key, { value: make(), writable: true, enumerable: true, configurable: true });
|
|
8678
|
-
}
|
|
8679
|
-
else {
|
|
8680
|
-
obj[key] = make();
|
|
8681
|
-
}
|
|
8682
|
-
}
|
|
8683
|
-
return obj[key];
|
|
8684
|
-
}
|
|
8685
|
-
function flattenError(error, mapper = (issue) => issue.message) {
|
|
8686
|
-
const fieldErrors = {};
|
|
8687
|
-
const formErrors = [];
|
|
8688
|
-
for (const sub of error.issues) {
|
|
8689
|
-
if (sub.path.length > 0) {
|
|
8690
|
-
errors_node(fieldErrors, sub.path[0], () => []).push(mapper(sub));
|
|
8691
|
-
}
|
|
8692
|
-
else {
|
|
8693
|
-
formErrors.push(mapper(sub));
|
|
8694
|
-
}
|
|
8695
|
-
}
|
|
8696
|
-
return { formErrors, fieldErrors };
|
|
8697
|
-
}
|
|
8698
|
-
function formatError(error, mapper = (issue) => issue.message) {
|
|
8699
|
-
const fieldErrors = { _errors: [] };
|
|
8700
|
-
const processError = (error, path = []) => {
|
|
8701
|
-
for (const issue of error.issues) {
|
|
8702
|
-
if (issue.code === "invalid_union" && issue.errors.length) {
|
|
8703
|
-
issue.errors.map((issues) => processError({ issues }, [...path, ...issue.path]));
|
|
8704
|
-
}
|
|
8705
|
-
else if (issue.code === "invalid_key") {
|
|
8706
|
-
processError({ issues: issue.issues }, [...path, ...issue.path]);
|
|
8707
|
-
}
|
|
8708
|
-
else if (issue.code === "invalid_element") {
|
|
8709
|
-
processError({ issues: issue.issues }, [...path, ...issue.path]);
|
|
8710
|
-
}
|
|
8711
|
-
else {
|
|
8712
|
-
const fullpath = [...path, ...issue.path];
|
|
8713
|
-
if (fullpath.length === 0) {
|
|
8714
|
-
fieldErrors._errors.push(mapper(issue));
|
|
8715
|
-
}
|
|
8716
|
-
else {
|
|
8717
|
-
let curr = fieldErrors;
|
|
8718
|
-
let i = 0;
|
|
8719
|
-
while (i < fullpath.length) {
|
|
8720
|
-
const el = fullpath[i];
|
|
8721
|
-
const terminal = i === fullpath.length - 1;
|
|
8722
|
-
// `_errors` is reserved by this legacy format, so merge a matching path segment into the current node instead of treating its array as a child.
|
|
8723
|
-
if (el === "_errors") {
|
|
8724
|
-
if (terminal)
|
|
8725
|
-
curr._errors.push(mapper(issue));
|
|
8726
|
-
i++;
|
|
8727
|
-
continue;
|
|
8728
|
-
}
|
|
8729
|
-
// A path element may collide with an inherited property name such as
|
|
8730
|
-
// "__proto__" or "constructor". Truthiness checks read the prototype
|
|
8731
|
-
// (so no node is created, then ._errors.push throws), and bracket
|
|
8732
|
-
// assignment of "__proto__" hits the setter instead of creating an
|
|
8733
|
-
// own key. Guard the read with hasOwnProperty and create the node
|
|
8734
|
-
// with defineProperty so any path element becomes a real own key.
|
|
8735
|
-
if (!Object.prototype.hasOwnProperty.call(curr, el)) {
|
|
8736
|
-
Object.defineProperty(curr, el, {
|
|
8737
|
-
value: { _errors: [] },
|
|
8738
|
-
enumerable: true,
|
|
8739
|
-
writable: true,
|
|
8740
|
-
configurable: true,
|
|
8741
|
-
});
|
|
8742
|
-
}
|
|
8743
|
-
const node = curr[el];
|
|
8744
|
-
if (terminal) {
|
|
8745
|
-
node._errors.push(mapper(issue));
|
|
8746
|
-
}
|
|
8747
|
-
curr = node;
|
|
8748
|
-
i++;
|
|
8749
|
-
}
|
|
8750
|
-
}
|
|
8751
|
-
}
|
|
8752
|
-
}
|
|
8753
|
-
};
|
|
8754
|
-
processError(error);
|
|
8755
|
-
return fieldErrors;
|
|
8756
|
-
}
|
|
8757
|
-
function treeifyError(error, mapper = (issue) => issue.message) {
|
|
8758
|
-
const result = { errors: [] };
|
|
8759
|
-
const processError = (error, path = []) => {
|
|
8760
|
-
var _a;
|
|
8761
|
-
for (const issue of error.issues) {
|
|
8762
|
-
if (issue.code === "invalid_union" && issue.errors.length) {
|
|
8763
|
-
// regular union error
|
|
8764
|
-
issue.errors.map((issues) => processError({ issues }, [...path, ...issue.path]));
|
|
8765
|
-
}
|
|
8766
|
-
else if (issue.code === "invalid_key") {
|
|
8767
|
-
processError({ issues: issue.issues }, [...path, ...issue.path]);
|
|
8768
|
-
}
|
|
8769
|
-
else if (issue.code === "invalid_element") {
|
|
8770
|
-
processError({ issues: issue.issues }, [...path, ...issue.path]);
|
|
8771
|
-
}
|
|
8772
|
-
else {
|
|
8773
|
-
const fullpath = [...path, ...issue.path];
|
|
8774
|
-
if (fullpath.length === 0) {
|
|
8775
|
-
result.errors.push(mapper(issue));
|
|
8776
|
-
continue;
|
|
8777
|
-
}
|
|
8778
|
-
let curr = result;
|
|
8779
|
-
let i = 0;
|
|
8780
|
-
while (i < fullpath.length) {
|
|
8781
|
-
const el = fullpath[i];
|
|
8782
|
-
const terminal = i === fullpath.length - 1;
|
|
8783
|
-
if (typeof el === "string") {
|
|
8784
|
-
curr.properties ?? (curr.properties = {});
|
|
8785
|
-
// el may collide with an inherited property name ("__proto__",
|
|
8786
|
-
// "constructor", ...); ??= reads the prototype so the node is never
|
|
8787
|
-
// created and curr.errors.push throws. Guard with hasOwnProperty and
|
|
8788
|
-
// create the node with defineProperty so "__proto__" becomes a real
|
|
8789
|
-
// own key rather than invoking the prototype setter.
|
|
8790
|
-
if (!Object.prototype.hasOwnProperty.call(curr.properties, el)) {
|
|
8791
|
-
Object.defineProperty(curr.properties, el, {
|
|
8792
|
-
value: { errors: [] },
|
|
8793
|
-
enumerable: true,
|
|
8794
|
-
writable: true,
|
|
8795
|
-
configurable: true,
|
|
8796
|
-
});
|
|
8797
|
-
}
|
|
8798
|
-
curr = curr.properties[el];
|
|
8799
|
-
}
|
|
8800
|
-
else {
|
|
8801
|
-
curr.items ?? (curr.items = []);
|
|
8802
|
-
(_a = curr.items)[el] ?? (_a[el] = { errors: [] });
|
|
8803
|
-
curr = curr.items[el];
|
|
8804
|
-
}
|
|
8805
|
-
if (terminal) {
|
|
8806
|
-
curr.errors.push(mapper(issue));
|
|
8807
|
-
}
|
|
8808
|
-
i++;
|
|
8809
|
-
}
|
|
8810
|
-
}
|
|
8811
|
-
}
|
|
8812
|
-
};
|
|
8813
|
-
processError(error);
|
|
8814
|
-
return result;
|
|
8815
|
-
}
|
|
8816
|
-
/** Format a ZodError as a human-readable string in the following form.
|
|
8817
|
-
*
|
|
8818
|
-
* From
|
|
8819
|
-
*
|
|
8820
|
-
* ```ts
|
|
8821
|
-
* ZodError {
|
|
8822
|
-
* issues: [
|
|
8823
|
-
* {
|
|
8824
|
-
* expected: 'string',
|
|
8825
|
-
* code: 'invalid_type',
|
|
8826
|
-
* path: [ 'username' ],
|
|
8827
|
-
* message: 'Invalid input: expected string'
|
|
8828
|
-
* },
|
|
8829
|
-
* {
|
|
8830
|
-
* expected: 'number',
|
|
8831
|
-
* code: 'invalid_type',
|
|
8832
|
-
* path: [ 'favoriteNumbers', 1 ],
|
|
8833
|
-
* message: 'Invalid input: expected number'
|
|
8834
|
-
* }
|
|
8835
|
-
* ];
|
|
8836
|
-
* }
|
|
8837
|
-
* ```
|
|
8838
|
-
*
|
|
8839
|
-
* to
|
|
8840
|
-
*
|
|
8841
|
-
* ```
|
|
8842
|
-
* username
|
|
8843
|
-
* ✖ Expected number, received string at "username
|
|
8844
|
-
* favoriteNumbers[0]
|
|
8845
|
-
* ✖ Invalid input: expected number
|
|
8846
|
-
* ```
|
|
8847
|
-
*/
|
|
8848
|
-
function toDotPath(_path) {
|
|
8849
|
-
const segs = [];
|
|
8850
|
-
const path = _path.map((seg) => (typeof seg === "object" ? seg.key : seg));
|
|
8851
|
-
for (const seg of path) {
|
|
8852
|
-
if (typeof seg === "number")
|
|
8853
|
-
segs.push(`[${seg}]`);
|
|
8854
|
-
else if (typeof seg === "symbol")
|
|
8855
|
-
segs.push(`[${JSON.stringify(String(seg))}]`);
|
|
8856
|
-
else if (/[^\w$]/.test(seg))
|
|
8857
|
-
segs.push(`[${JSON.stringify(seg)}]`);
|
|
8858
|
-
else {
|
|
8859
|
-
if (segs.length)
|
|
8860
|
-
segs.push(".");
|
|
8861
|
-
segs.push(seg);
|
|
8862
|
-
}
|
|
8863
|
-
}
|
|
8864
|
-
return segs.join("");
|
|
8865
|
-
}
|
|
8866
|
-
function prettifyError(error) {
|
|
8867
|
-
const lines = [];
|
|
8868
|
-
// sort by path length
|
|
8869
|
-
const issues = [...error.issues].sort((a, b) => (a.path ?? []).length - (b.path ?? []).length);
|
|
8870
|
-
// Process each issue
|
|
8871
|
-
for (const issue of issues) {
|
|
8872
|
-
lines.push(`✖ ${issue.message}`);
|
|
8873
|
-
if (issue.path?.length)
|
|
8874
|
-
lines.push(` → at ${toDotPath(issue.path)}`);
|
|
8875
|
-
}
|
|
8876
|
-
// Convert Map to formatted string
|
|
8877
|
-
return lines.join("\n");
|
|
8878
|
-
}
|
|
8879
|
-
|
|
8880
|
-
;// CONCATENATED MODULE: ../../node_modules/zod/v4/core/parse.js
|
|
8881
|
-
|
|
8882
|
-
|
|
8883
|
-
|
|
8884
|
-
// Always both keys, so the `_params` read site in `_parse` sees one object shape rather than two.
|
|
8885
|
-
function finalizeParams(callee, params) {
|
|
8886
|
-
return { callee: params?.callee ?? callee, Err: params?.Err };
|
|
8887
|
-
}
|
|
8888
|
-
const parse_parse = (_Err) => {
|
|
8889
|
-
const fn = (schema, value, _ctx, _params) => {
|
|
8890
|
-
const ctx = _ctx ? { ..._ctx, async: false } : { async: false };
|
|
8891
|
-
const result = schema._zod.run({ value, issues: [] }, ctx);
|
|
8892
|
-
if (result instanceof Promise) {
|
|
8893
|
-
throw new $ZodAsyncError();
|
|
8894
|
-
}
|
|
8895
|
-
if (result.issues.length) {
|
|
8896
|
-
const e = new (_params?.Err ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx, core_config())));
|
|
8897
|
-
captureStackTrace(e, _params?.callee ?? fn);
|
|
8898
|
-
throw e;
|
|
8899
|
-
}
|
|
8900
|
-
return result.value;
|
|
8901
|
-
};
|
|
8902
|
-
return fn;
|
|
8903
|
-
};
|
|
8904
|
-
const core_parse_parse = /* @__PURE__*/ parse_parse($ZodRealError);
|
|
8905
|
-
const parse_parseAsync = (_Err) => {
|
|
8906
|
-
const fn = async (schema, value, _ctx, params) => {
|
|
8907
|
-
const ctx = _ctx ? { ..._ctx, async: true } : { async: true };
|
|
8908
|
-
let result = schema._zod.run({ value, issues: [] }, ctx);
|
|
8909
|
-
if (result instanceof Promise)
|
|
8910
|
-
result = await result;
|
|
8911
|
-
if (result.issues.length) {
|
|
8912
|
-
const e = new (params?.Err ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx, core_config())));
|
|
8913
|
-
captureStackTrace(e, params?.callee ?? fn);
|
|
8914
|
-
throw e;
|
|
8915
|
-
}
|
|
8916
|
-
return result.value;
|
|
8917
|
-
};
|
|
8918
|
-
return fn;
|
|
8919
|
-
};
|
|
8920
|
-
const core_parse_parseAsync = /* @__PURE__*/ parse_parseAsync($ZodRealError);
|
|
8921
|
-
const _safeParse = (_Err) => (schema, value, _ctx) => {
|
|
8922
|
-
const ctx = _ctx ? { ..._ctx, async: false } : { async: false };
|
|
8923
|
-
const result = schema._zod.run({ value, issues: [] }, ctx);
|
|
8924
|
-
if (result instanceof Promise) {
|
|
8925
|
-
throw new $ZodAsyncError();
|
|
8926
|
-
}
|
|
8927
|
-
return result.issues.length
|
|
8928
|
-
? {
|
|
8929
|
-
success: false,
|
|
8930
|
-
error: new (_Err ?? $ZodError)(result.issues.map((iss) => finalizeIssue(iss, ctx, core_config()))),
|
|
8931
|
-
}
|
|
8932
|
-
: { success: true, data: result.value };
|
|
8933
|
-
};
|
|
8934
|
-
const safeParse = /* @__PURE__*/ _safeParse($ZodRealError);
|
|
8935
|
-
const _safeParseAsync = (_Err) => async (schema, value, _ctx) => {
|
|
8936
|
-
const ctx = _ctx ? { ..._ctx, async: true } : { async: true };
|
|
8937
|
-
let result = schema._zod.run({ value, issues: [] }, ctx);
|
|
8938
|
-
if (result instanceof Promise)
|
|
8939
|
-
result = await result;
|
|
8940
|
-
return result.issues.length
|
|
8941
|
-
? {
|
|
8942
|
-
success: false,
|
|
8943
|
-
error: new _Err(result.issues.map((iss) => finalizeIssue(iss, ctx, core_config()))),
|
|
8944
|
-
}
|
|
8945
|
-
: { success: true, data: result.value };
|
|
8946
|
-
};
|
|
8947
|
-
const safeParseAsync = /* @__PURE__*/ _safeParseAsync($ZodRealError);
|
|
8948
|
-
// registry mirrors of the compiler's sentinels, so this module never imports the compiler
|
|
8949
|
-
const COMPILE_INVALID = /* @__PURE__ */ (/* unused pure expression or super */ null && (Symbol.for("zod.compile.invalid")));
|
|
8950
|
-
const COMPILE_FALLBACK = /* @__PURE__ */ (/* unused pure expression or super */ null && (Symbol.for("zod.compile.fallback")));
|
|
8951
|
-
// Deliberately tiny, because v8 will not inline a body carrying the fallback's object literals and throw. Everything that is not the compiled happy path lives in validateFallback, and that split is worth ~35% on a compiled schema.
|
|
8952
|
-
const validate = ((schema, value, _ctx) => {
|
|
8953
|
-
const validator = schema._zod.bag.validator;
|
|
8954
|
-
if (validator !== undefined && validator(value) !== COMPILE_INVALID)
|
|
8955
|
-
return true;
|
|
8956
|
-
return validateFallback(schema, value, _ctx);
|
|
8957
|
-
});
|
|
8958
|
-
function validateFallback(schema, value, _ctx) {
|
|
8959
|
-
const ctx = _ctx ? { ..._ctx, async: false } : { async: false };
|
|
8960
|
-
const fallbackRun = schema._zod.bag.fallbackRun;
|
|
8961
|
-
let result;
|
|
8962
|
-
if (fallbackRun) {
|
|
8963
|
-
// skip nested fast paths on the fallback, so user callbacks keep the at-most-twice bound
|
|
8964
|
-
ctx[COMPILE_FALLBACK] = true;
|
|
8965
|
-
result = fallbackRun({ value, issues: [] }, ctx);
|
|
8966
|
-
}
|
|
8967
|
-
else {
|
|
8968
|
-
result = schema._zod.run({ value, issues: [] }, ctx);
|
|
8969
|
-
}
|
|
8970
|
-
if (result instanceof Promise) {
|
|
8971
|
-
throw new core.$ZodAsyncError();
|
|
8972
|
-
}
|
|
8973
|
-
return result.issues.length === 0;
|
|
8974
|
-
}
|
|
8975
|
-
// no fast path: the compiler keeps async parses on the runtime, because a promise-returning callback that is not declared async compiles to a throw
|
|
8976
|
-
const validateAsync = async (schema, value, _ctx) => {
|
|
8977
|
-
const ctx = _ctx ? { ..._ctx, async: true } : { async: true };
|
|
8978
|
-
let result = schema._zod.run({ value, issues: [] }, ctx);
|
|
8979
|
-
if (result instanceof Promise)
|
|
8980
|
-
result = await result;
|
|
8981
|
-
return result.issues.length === 0;
|
|
8982
|
-
};
|
|
8983
|
-
const parse_encode = (_Err) => {
|
|
8984
|
-
const parse = parse_parse(_Err);
|
|
8985
|
-
const fn = (schema, value, _ctx, _params) => {
|
|
8986
|
-
const ctx = _ctx ? { ..._ctx, direction: "backward" } : { direction: "backward" };
|
|
8987
|
-
return parse(schema, value, ctx, finalizeParams(fn, _params));
|
|
8988
|
-
};
|
|
8989
|
-
return fn;
|
|
8990
|
-
};
|
|
8991
|
-
const encode = /* @__PURE__*/ parse_encode($ZodRealError);
|
|
8992
|
-
const parse_decode = (_Err) => {
|
|
8993
|
-
const parse = parse_parse(_Err);
|
|
8994
|
-
const fn = (schema, value, _ctx, _params) => {
|
|
8995
|
-
return parse(schema, value, _ctx, finalizeParams(fn, _params));
|
|
8996
|
-
};
|
|
8997
|
-
return fn;
|
|
8998
|
-
};
|
|
8999
|
-
const decode = /* @__PURE__*/ parse_decode($ZodRealError);
|
|
9000
|
-
const parse_encodeAsync = (_Err) => {
|
|
9001
|
-
const parseAsync = parse_parseAsync(_Err);
|
|
9002
|
-
const fn = async (schema, value, _ctx, _params) => {
|
|
9003
|
-
const ctx = _ctx ? { ..._ctx, direction: "backward" } : { direction: "backward" };
|
|
9004
|
-
return (await parseAsync(schema, value, ctx, finalizeParams(fn, _params)));
|
|
9005
|
-
};
|
|
9006
|
-
return fn;
|
|
9007
|
-
};
|
|
9008
|
-
const encodeAsync = /* @__PURE__*/ parse_encodeAsync($ZodRealError);
|
|
9009
|
-
const parse_decodeAsync = (_Err) => {
|
|
9010
|
-
const parseAsync = parse_parseAsync(_Err);
|
|
9011
|
-
const fn = async (schema, value, _ctx, _params) => {
|
|
9012
|
-
return await parseAsync(schema, value, _ctx, finalizeParams(fn, _params));
|
|
9013
|
-
};
|
|
9014
|
-
return fn;
|
|
9015
|
-
};
|
|
9016
|
-
const decodeAsync = /* @__PURE__*/ parse_decodeAsync($ZodRealError);
|
|
9017
|
-
const _safeEncode = (_Err) => (schema, value, _ctx) => {
|
|
9018
|
-
const ctx = _ctx ? { ..._ctx, direction: "backward" } : { direction: "backward" };
|
|
9019
|
-
return _safeParse(_Err)(schema, value, ctx);
|
|
9020
|
-
};
|
|
9021
|
-
const safeEncode = /* @__PURE__*/ _safeEncode($ZodRealError);
|
|
9022
|
-
const _safeDecode = (_Err) => (schema, value, _ctx) => {
|
|
9023
|
-
return _safeParse(_Err)(schema, value, _ctx);
|
|
9024
|
-
};
|
|
9025
|
-
const safeDecode = /* @__PURE__*/ _safeDecode($ZodRealError);
|
|
9026
|
-
const _safeEncodeAsync = (_Err) => async (schema, value, _ctx) => {
|
|
9027
|
-
const ctx = _ctx ? { ..._ctx, direction: "backward" } : { direction: "backward" };
|
|
9028
|
-
return _safeParseAsync(_Err)(schema, value, ctx);
|
|
9029
|
-
};
|
|
9030
|
-
const safeEncodeAsync = /* @__PURE__*/ _safeEncodeAsync($ZodRealError);
|
|
9031
|
-
const _safeDecodeAsync = (_Err) => async (schema, value, _ctx) => {
|
|
9032
|
-
return _safeParseAsync(_Err)(schema, value, _ctx);
|
|
9033
|
-
};
|
|
9034
|
-
const safeDecodeAsync = /* @__PURE__*/ _safeDecodeAsync($ZodRealError);
|
|
9035
|
-
|
|
9036
8613
|
;// CONCATENATED MODULE: ../../node_modules/zod/v4/core/versions.js
|
|
9037
8614
|
const versions_version = {
|
|
9038
8615
|
major: 4,
|
|
9039
|
-
minor:
|
|
9040
|
-
patch:
|
|
8616
|
+
minor: 6,
|
|
8617
|
+
patch: 5,
|
|
9041
8618
|
};
|
|
9042
8619
|
|
|
9043
8620
|
;// CONCATENATED MODULE: ../../node_modules/zod/v4/core/schemas.js
|
|
@@ -9171,16 +8748,24 @@ const $ZodType = /*@__PURE__*/ $constructor("$ZodType", (inst, def) => {
|
|
|
9171
8748
|
},
|
|
9172
8749
|
});
|
|
9173
8750
|
/** The Standard Schema surface for `inst`. Shared so wrappers can extend it without forcing it. */
|
|
9174
|
-
|
|
8751
|
+
// a Standard Schema result only reports issues, so a failure finalizes them straight off the raw payload: no ZodError, and no lazy result to read through
|
|
8752
|
+
const toStandardResult = (r, ctx) => r.issues.length ? { issues: r.issues.map((iss) => finalizeIssue(iss, ctx, core_config())) } : { value: r.value };
|
|
8753
|
+
async function validateAsync(inst, value) {
|
|
8754
|
+
const ctx = { async: true };
|
|
8755
|
+
return toStandardResult((await inst._zod.run({ value, issues: [] }, ctx)), ctx);
|
|
8756
|
+
}
|
|
9175
8757
|
function standardProps(inst) {
|
|
9176
8758
|
return {
|
|
9177
8759
|
validate: (value) => {
|
|
8760
|
+
const ctx = { async: false };
|
|
9178
8761
|
try {
|
|
9179
|
-
|
|
9180
|
-
|
|
9181
|
-
|
|
9182
|
-
return safeParseAsync(inst, value).then(toStandardResult);
|
|
8762
|
+
const r = inst._zod.run({ value, issues: [] }, ctx);
|
|
8763
|
+
if (!(r instanceof Promise))
|
|
8764
|
+
return toStandardResult(r, ctx);
|
|
9183
8765
|
}
|
|
8766
|
+
catch (_) { }
|
|
8767
|
+
// async function so a synchronously throwing check rejects instead of escaping validate
|
|
8768
|
+
return validateAsync(inst, value);
|
|
9184
8769
|
},
|
|
9185
8770
|
vendor: "zod",
|
|
9186
8771
|
version: 1,
|
|
@@ -9189,7 +8774,8 @@ function standardProps(inst) {
|
|
|
9189
8774
|
|
|
9190
8775
|
const $ZodString = /*@__PURE__*/ $constructor("$ZodString", (inst, def) => {
|
|
9191
8776
|
$ZodType.init(inst, def);
|
|
9192
|
-
|
|
8777
|
+
// a format's own pattern, else unbounded; a template literal derives the check-aware form itself
|
|
8778
|
+
inst._zod.pattern = def.pattern ?? anyString;
|
|
9193
8779
|
inst._zod.parse = (payload, _) => {
|
|
9194
8780
|
if (def.coerce)
|
|
9195
8781
|
try {
|
|
@@ -9243,15 +8829,37 @@ const $ZodEmail = /*@__PURE__*/ $constructor("$ZodEmail", (inst, def) => {
|
|
|
9243
8829
|
});
|
|
9244
8830
|
/** The `://` guard rejected the input before the URL constructor saw it. */
|
|
9245
8831
|
const URL_BAD_FORMAT = 1;
|
|
9246
|
-
/** The URL
|
|
8832
|
+
/** The URL parser rejected the input. */
|
|
9247
8833
|
const URL_UNPARSEABLE = 2;
|
|
9248
|
-
|
|
8834
|
+
function canParseURL(input) {
|
|
8835
|
+
try {
|
|
8836
|
+
if (typeof URL !== "undefined" && typeof URL.canParse === "function")
|
|
8837
|
+
return URL.canParse(input);
|
|
8838
|
+
new URL(input);
|
|
8839
|
+
return true;
|
|
8840
|
+
}
|
|
8841
|
+
catch {
|
|
8842
|
+
return false;
|
|
8843
|
+
}
|
|
8844
|
+
}
|
|
8845
|
+
function validateURL(trimmed, def) {
|
|
8846
|
+
if (!("normalize" in def) && !("hostname" in def) && !("protocol" in def)) {
|
|
8847
|
+
return canParseURL(trimmed) || URL_UNPARSEABLE;
|
|
8848
|
+
}
|
|
8849
|
+
return parseURLObject(trimmed, def);
|
|
8850
|
+
}
|
|
8851
|
+
/** Parses a URL while preserving the non-normalizing HTTP guard. */
|
|
9249
8852
|
function parseURLObject(trimmed, def) {
|
|
9250
8853
|
// When normalize is off, require :// for http/https URLs. This prevents strings like "http:example.com" or "https:/path" from being silently accepted
|
|
9251
8854
|
if (!def.normalize && def.protocol?.source === httpProtocol.source && !/^https?:\/\//i.test(trimmed)) {
|
|
9252
8855
|
return URL_BAD_FORMAT;
|
|
9253
8856
|
}
|
|
9254
8857
|
try {
|
|
8858
|
+
if (typeof URL !== "undefined") {
|
|
8859
|
+
const URLStatic = URL;
|
|
8860
|
+
if (typeof URLStatic.parse === "function")
|
|
8861
|
+
return URLStatic.parse(trimmed) ?? URL_UNPARSEABLE;
|
|
8862
|
+
}
|
|
9255
8863
|
// @ts-ignore
|
|
9256
8864
|
return new URL(trimmed);
|
|
9257
8865
|
}
|
|
@@ -9278,7 +8886,7 @@ const $ZodURL = /*@__PURE__*/ $constructor("$ZodURL", (inst, def) => {
|
|
|
9278
8886
|
try {
|
|
9279
8887
|
// Trim whitespace from input
|
|
9280
8888
|
const trimmed = payload.value.trim();
|
|
9281
|
-
const url =
|
|
8889
|
+
const url = validateURL(trimmed, def);
|
|
9282
8890
|
if (url === URL_BAD_FORMAT) {
|
|
9283
8891
|
payload.issues.push({
|
|
9284
8892
|
code: "invalid_format",
|
|
@@ -9300,6 +8908,10 @@ const $ZodURL = /*@__PURE__*/ $constructor("$ZodURL", (inst, def) => {
|
|
|
9300
8908
|
});
|
|
9301
8909
|
return;
|
|
9302
8910
|
}
|
|
8911
|
+
if (url === true) {
|
|
8912
|
+
payload.value = stripTabAndNewline(trimmed);
|
|
8913
|
+
return;
|
|
8914
|
+
}
|
|
9303
8915
|
if (def.hostname && !urlHostnameOk(url, def.hostname)) {
|
|
9304
8916
|
payload.issues.push({
|
|
9305
8917
|
code: "invalid_format",
|
|
@@ -9375,13 +8987,6 @@ const $ZodKSUID = /*@__PURE__*/ $constructor("$ZodKSUID", (inst, def) => {
|
|
|
9375
8987
|
const $ZodISODateTime = /*@__PURE__*/ $constructor("$ZodISODateTime", (inst, def) => {
|
|
9376
8988
|
def.pattern ?? (def.pattern = datetime(def));
|
|
9377
8989
|
$ZodStringFormat.init(inst, def);
|
|
9378
|
-
// these two drop the offset or seconds `date-time` requires — on the bag not the def, since `z.string().check(...)` lands the format on a different schema
|
|
9379
|
-
if (def.local || def.precision === -1) {
|
|
9380
|
-
inst._zod.bag.laxFormat = true;
|
|
9381
|
-
inst._zod.onattach.push((s) => {
|
|
9382
|
-
s._zod.bag.laxFormat = true;
|
|
9383
|
-
});
|
|
9384
|
-
}
|
|
9385
8990
|
});
|
|
9386
8991
|
const $ZodISODate = /*@__PURE__*/ $constructor("$ZodISODate", (inst, def) => {
|
|
9387
8992
|
def.pattern ?? (def.pattern = regexes_date);
|
|
@@ -9398,26 +9003,17 @@ const $ZodISODuration = /*@__PURE__*/ $constructor("$ZodISODuration", (inst, def
|
|
|
9398
9003
|
const $ZodIPv4 = /*@__PURE__*/ $constructor("$ZodIPv4", (inst, def) => {
|
|
9399
9004
|
def.pattern ?? (def.pattern = ipv4);
|
|
9400
9005
|
$ZodStringFormat.init(inst, def);
|
|
9401
|
-
inst._zod.bag.format = `ipv4`;
|
|
9402
9006
|
});
|
|
9403
9007
|
/** An IPv6 address is written with hex digits, colons and dots, and nothing else. The guard is what makes the check below an IPv6 check: `new URL("http://[...]")` parses an authority, not an address, so `@` and `\` re-delimit it and `"::@1\\"` validates against the host `0.0.0.1`. The URL parser also deletes ASCII tab, LF and CR rather than failing, which is how `"::1\n"` validated as `::1`. */
|
|
9404
9008
|
const ipv6Alphabet = /^[0-9a-fA-F:.]+$/;
|
|
9405
9009
|
function isValidIPv6(value) {
|
|
9406
9010
|
if (!ipv6Alphabet.test(value))
|
|
9407
9011
|
return false;
|
|
9408
|
-
|
|
9409
|
-
// @ts-ignore
|
|
9410
|
-
new URL(`http://[${value}]`);
|
|
9411
|
-
return true;
|
|
9412
|
-
}
|
|
9413
|
-
catch {
|
|
9414
|
-
return false;
|
|
9415
|
-
}
|
|
9012
|
+
return canParseURL(`http://[${value}]`);
|
|
9416
9013
|
}
|
|
9417
9014
|
const $ZodIPv6 = /*@__PURE__*/ $constructor("$ZodIPv6", (inst, def) => {
|
|
9418
9015
|
def.pattern ?? (def.pattern = ipv6);
|
|
9419
9016
|
$ZodStringFormat.init(inst, def);
|
|
9420
|
-
inst._zod.bag.format = `ipv6`;
|
|
9421
9017
|
inst._zod.check = (payload) => {
|
|
9422
9018
|
if (!isValidIPv6(payload.value)) {
|
|
9423
9019
|
payload.issues.push({
|
|
@@ -9433,7 +9029,6 @@ const $ZodIPv6 = /*@__PURE__*/ $constructor("$ZodIPv6", (inst, def) => {
|
|
|
9433
9029
|
const $ZodMAC = /*@__PURE__*/ (/* unused pure expression or super */ null && (core.$constructor("$ZodMAC", (inst, def) => {
|
|
9434
9030
|
def.pattern ?? (def.pattern = regexes.mac(def.delimiter));
|
|
9435
9031
|
$ZodStringFormat.init(inst, def);
|
|
9436
|
-
inst._zod.bag.format = `mac`;
|
|
9437
9032
|
})));
|
|
9438
9033
|
const $ZodCIDRv4 = /*@__PURE__*/ $constructor("$ZodCIDRv4", (inst, def) => {
|
|
9439
9034
|
def.pattern ?? (def.pattern = cidrv4);
|
|
@@ -9486,10 +9081,11 @@ function isValidBase64(data) {
|
|
|
9486
9081
|
return false;
|
|
9487
9082
|
}
|
|
9488
9083
|
}
|
|
9084
|
+
// lax on purpose: the quantified regexes.base64 overflows the regex stack on multi-MB input and its leading ^$| alternation leaks through template-literal composition; isValidBase64 enforces length and padding
|
|
9085
|
+
const base64Charset = /^[0-9a-zA-Z+/]*={0,2}$/;
|
|
9489
9086
|
const $ZodBase64 = /*@__PURE__*/ $constructor("$ZodBase64", (inst, def) => {
|
|
9490
|
-
def.pattern ?? (def.pattern =
|
|
9087
|
+
def.pattern ?? (def.pattern = base64Charset);
|
|
9491
9088
|
$ZodStringFormat.init(inst, def);
|
|
9492
|
-
inst._zod.bag.contentEncoding = "base64";
|
|
9493
9089
|
inst._zod.check = (payload) => {
|
|
9494
9090
|
if (isValidBase64(payload.value))
|
|
9495
9091
|
return;
|
|
@@ -9502,18 +9098,19 @@ const $ZodBase64 = /*@__PURE__*/ $constructor("$ZodBase64", (inst, def) => {
|
|
|
9502
9098
|
});
|
|
9503
9099
|
};
|
|
9504
9100
|
});
|
|
9505
|
-
//////////////////////////////
|
|
9101
|
+
////////////////////////////// ZodBase64URL //////////////////////////////
|
|
9102
|
+
// lax on purpose: the quantified regexes.base64url overflows the regex stack on multi-MB input; isValidBase64 enforces length on the padded string
|
|
9103
|
+
const base64urlCharset = /^[A-Za-z0-9_-]*$/;
|
|
9506
9104
|
function isValidBase64URL(data) {
|
|
9507
|
-
if (!
|
|
9105
|
+
if (!base64urlCharset.test(data))
|
|
9508
9106
|
return false;
|
|
9509
9107
|
const base64 = data.replace(/[-_]/g, (c) => (c === "-" ? "+" : "/"));
|
|
9510
9108
|
const padded = base64.padEnd(Math.ceil(base64.length / 4) * 4, "=");
|
|
9511
9109
|
return isValidBase64(padded);
|
|
9512
9110
|
}
|
|
9513
9111
|
const $ZodBase64URL = /*@__PURE__*/ $constructor("$ZodBase64URL", (inst, def) => {
|
|
9514
|
-
def.pattern ?? (def.pattern =
|
|
9112
|
+
def.pattern ?? (def.pattern = base64urlCharset);
|
|
9515
9113
|
$ZodStringFormat.init(inst, def);
|
|
9516
|
-
inst._zod.bag.contentEncoding = "base64url";
|
|
9517
9114
|
inst._zod.check = (payload) => {
|
|
9518
9115
|
if (isValidBase64URL(payload.value))
|
|
9519
9116
|
return;
|
|
@@ -9538,7 +9135,7 @@ function isLuhnAlgo(digits) {
|
|
|
9538
9135
|
let bit = 1;
|
|
9539
9136
|
let sum = 0;
|
|
9540
9137
|
while (length) {
|
|
9541
|
-
const value =
|
|
9138
|
+
const value = digits.charCodeAt(--length) - 48;
|
|
9542
9139
|
bit ^= 1;
|
|
9543
9140
|
sum += bit ? [0, 2, 4, 6, 8, 1, 3, 5, 7, 9][value] : value;
|
|
9544
9141
|
}
|
|
@@ -9565,6 +9162,42 @@ const $ZodCreditCard = /*@__PURE__*/ (/* unused pure expression or super */ null
|
|
|
9565
9162
|
});
|
|
9566
9163
|
};
|
|
9567
9164
|
})));
|
|
9165
|
+
////////////////////////////// ZodIBAN //////////////////////////////
|
|
9166
|
+
// iso 7064 mod 97-10 checksum without BigInt
|
|
9167
|
+
function isIso7064Mod97(iban) {
|
|
9168
|
+
let remainder = 0;
|
|
9169
|
+
const len = iban.length;
|
|
9170
|
+
for (let i = 4; i < len; i++) {
|
|
9171
|
+
const code = iban.charCodeAt(i);
|
|
9172
|
+
remainder = (code >= 65 ? remainder * 100 + (code - 55) : remainder * 10 + (code - 48)) % 97;
|
|
9173
|
+
}
|
|
9174
|
+
for (let i = 0; i < 4; i++) {
|
|
9175
|
+
const code = iban.charCodeAt(i);
|
|
9176
|
+
remainder = (code >= 65 ? remainder * 100 + (code - 55) : remainder * 10 + (code - 48)) % 97;
|
|
9177
|
+
}
|
|
9178
|
+
return remainder === 1;
|
|
9179
|
+
}
|
|
9180
|
+
function isValidIBAN(input) {
|
|
9181
|
+
if (!regexes.iban.test(input))
|
|
9182
|
+
return false;
|
|
9183
|
+
return isIso7064Mod97(input);
|
|
9184
|
+
}
|
|
9185
|
+
const $ZodIBAN = /*@__PURE__*/ (/* unused pure expression or super */ null && (core.$constructor("$ZodIBAN", (inst, def) => {
|
|
9186
|
+
// shape only — checksum is not expressible as a pattern
|
|
9187
|
+
def.pattern ?? (def.pattern = regexes.iban);
|
|
9188
|
+
$ZodStringFormat.init(inst, def);
|
|
9189
|
+
inst._zod.check = (payload) => {
|
|
9190
|
+
if (isValidIBAN(payload.value))
|
|
9191
|
+
return;
|
|
9192
|
+
payload.issues.push({
|
|
9193
|
+
code: "invalid_format",
|
|
9194
|
+
format: "iban",
|
|
9195
|
+
input: payload.value,
|
|
9196
|
+
inst,
|
|
9197
|
+
continue: !def.abort,
|
|
9198
|
+
});
|
|
9199
|
+
};
|
|
9200
|
+
})));
|
|
9568
9201
|
////////////////////////////// ZodJWT //////////////////////////////
|
|
9569
9202
|
function isValidJWT(token, algorithm = null) {
|
|
9570
9203
|
try {
|
|
@@ -9618,7 +9251,7 @@ const $ZodCustomStringFormat = /*@__PURE__*/ (/* unused pure expression or super
|
|
|
9618
9251
|
})));
|
|
9619
9252
|
const $ZodNumber = /*@__PURE__*/ $constructor("$ZodNumber", (inst, def) => {
|
|
9620
9253
|
$ZodType.init(inst, def);
|
|
9621
|
-
inst._zod.pattern =
|
|
9254
|
+
inst._zod.pattern = number;
|
|
9622
9255
|
inst._zod.parse = (payload, _ctx) => {
|
|
9623
9256
|
if (def.coerce)
|
|
9624
9257
|
try {
|
|
@@ -9826,6 +9459,7 @@ const $ZodArray = /*@__PURE__*/ $constructor("$ZodArray", (inst, def) => {
|
|
|
9826
9459
|
}
|
|
9827
9460
|
payload.value = memo ? memo.alloc(inst, payload, Array(input.length), ctx) : Array(input.length);
|
|
9828
9461
|
const proms = [];
|
|
9462
|
+
const abortEarly = ctx?.abortEarly;
|
|
9829
9463
|
for (let i = 0; i < input.length; i++) {
|
|
9830
9464
|
const item = input[i];
|
|
9831
9465
|
const result = def.element._zod.run({
|
|
@@ -9837,6 +9471,9 @@ const $ZodArray = /*@__PURE__*/ $constructor("$ZodArray", (inst, def) => {
|
|
|
9837
9471
|
}
|
|
9838
9472
|
else {
|
|
9839
9473
|
handleArrayResult(result, payload, i);
|
|
9474
|
+
// the element's payload is authoritative here, since handleArrayResult forwards every issue; an object's is not, because it drops a failed absent optional
|
|
9475
|
+
if (abortEarly && result.issues.length !== 0 && aborted(result))
|
|
9476
|
+
break;
|
|
9840
9477
|
}
|
|
9841
9478
|
}
|
|
9842
9479
|
if (proms.length) {
|
|
@@ -9871,7 +9508,7 @@ function handlePropertyResult(result, final, key, input, optin, optout) {
|
|
|
9871
9508
|
return;
|
|
9872
9509
|
}
|
|
9873
9510
|
if (result.value === undefined) {
|
|
9874
|
-
if (isPresent) {
|
|
9511
|
+
if (isPresent || (optin === "defaulted" && !isOptionalOut)) {
|
|
9875
9512
|
final.value[key] = undefined;
|
|
9876
9513
|
}
|
|
9877
9514
|
}
|
|
@@ -9903,14 +9540,21 @@ function normalizeDef(def) {
|
|
|
9903
9540
|
optionalKeys: new Set(okeys),
|
|
9904
9541
|
};
|
|
9905
9542
|
}
|
|
9906
|
-
function handleCatchall(proms, input, payload, ctx, def, inst) {
|
|
9543
|
+
function handleCatchall(proms, input, payload, ctx, def, inst, abortEarly) {
|
|
9907
9544
|
const unrecognized = [];
|
|
9908
9545
|
const keySet = def.keySet;
|
|
9909
9546
|
const _catchall = def.catchall._zod;
|
|
9910
9547
|
const t = _catchall.def.type;
|
|
9911
9548
|
const optin = _catchall.optin;
|
|
9912
9549
|
const optout = _catchall.optout;
|
|
9550
|
+
// starts at 0, not the current length: the shape phase already ran and may have aborted
|
|
9551
|
+
let seen = 0;
|
|
9913
9552
|
for (const key in input) {
|
|
9553
|
+
if (abortEarly && payload.issues.length !== seen) {
|
|
9554
|
+
if (aborted(payload, seen))
|
|
9555
|
+
break;
|
|
9556
|
+
seen = payload.issues.length;
|
|
9557
|
+
}
|
|
9914
9558
|
// Must precede the __proto__ branch: a declared key is not unrecognized, even though the shape loop deliberately strips __proto__ from the parsed output.
|
|
9915
9559
|
if (keySet.has(key))
|
|
9916
9560
|
continue;
|
|
@@ -9948,26 +9592,22 @@ function handleCatchall(proms, input, payload, ctx, def, inst) {
|
|
|
9948
9592
|
return payload;
|
|
9949
9593
|
});
|
|
9950
9594
|
}
|
|
9951
|
-
// Whichever object a def's `shape` currently answers from: the one the caller passed until the first read, the frozen copy after it. Keyed by def, so a def rebuilt by a builder is simply absent rather than inheriting the source's. Read its keys with `Object.keys`, which does not invoke them — that is what lets a discriminated union check its discriminator without resolving an option whose getters reference the union being constructed.
|
|
9952
|
-
const propShapes = new WeakMap();
|
|
9953
9595
|
const $ZodObject = /*@__PURE__*/ $constructor("$ZodObject", (inst, def) => {
|
|
9954
9596
|
// requires cast because technically $ZodObject doesn't extend
|
|
9955
9597
|
$ZodType.init(inst, def);
|
|
9956
|
-
// const sh = def.shape;
|
|
9957
9598
|
const desc = Object.getOwnPropertyDescriptor(def, "shape");
|
|
9958
|
-
|
|
9959
|
-
|
|
9960
|
-
|
|
9961
|
-
|
|
9962
|
-
|
|
9963
|
-
|
|
9964
|
-
|
|
9965
|
-
|
|
9966
|
-
|
|
9967
|
-
|
|
9968
|
-
|
|
9969
|
-
|
|
9970
|
-
});
|
|
9599
|
+
// a cloned def carries its source's accessor, which knows the shape it answers from; adopting that keeps the clone's keys readable without running it
|
|
9600
|
+
const sh = desc?.get ? desc.get.raw : (def.shape ?? {});
|
|
9601
|
+
if (sh) {
|
|
9602
|
+
// Freezes the shape on first read, so its getters resolve once and every later read sees the same schemas.
|
|
9603
|
+
const get = () => {
|
|
9604
|
+
const newSh = { ...sh };
|
|
9605
|
+
Object.defineProperty(def, "shape", { value: newSh });
|
|
9606
|
+
get.raw = newSh;
|
|
9607
|
+
return newSh;
|
|
9608
|
+
};
|
|
9609
|
+
get.raw = sh;
|
|
9610
|
+
Object.defineProperty(def, "shape", { get });
|
|
9971
9611
|
}
|
|
9972
9612
|
const _normalized = util_cached(() => normalizeDef(def));
|
|
9973
9613
|
defineLazyInternal(inst, "propValues", (zod) => {
|
|
@@ -10008,7 +9648,14 @@ const $ZodObject = /*@__PURE__*/ $constructor("$ZodObject", (inst, def) => {
|
|
|
10008
9648
|
payload.value = memo ? memo.alloc(inst, payload, {}, ctx) : {};
|
|
10009
9649
|
const proms = [];
|
|
10010
9650
|
const shape = value.shape;
|
|
9651
|
+
const abortEarly = ctx?.abortEarly;
|
|
9652
|
+
let seen = payload.issues.length;
|
|
10011
9653
|
for (const key of value.allKeys) {
|
|
9654
|
+
if (abortEarly && payload.issues.length !== seen) {
|
|
9655
|
+
if (aborted(payload, seen))
|
|
9656
|
+
break;
|
|
9657
|
+
seen = payload.issues.length;
|
|
9658
|
+
}
|
|
10012
9659
|
if (key === "__proto__")
|
|
10013
9660
|
continue;
|
|
10014
9661
|
const el = shape[key];
|
|
@@ -10025,7 +9672,7 @@ const $ZodObject = /*@__PURE__*/ $constructor("$ZodObject", (inst, def) => {
|
|
|
10025
9672
|
if (!catchall) {
|
|
10026
9673
|
return proms.length ? Promise.all(proms).then(() => payload) : payload;
|
|
10027
9674
|
}
|
|
10028
|
-
return handleCatchall(proms, input, payload, ctx, _normalized.value, inst);
|
|
9675
|
+
return handleCatchall(proms, input, payload, ctx, _normalized.value, inst, abortEarly === true);
|
|
10029
9676
|
};
|
|
10030
9677
|
});
|
|
10031
9678
|
const $ZodObjectJIT = /*@__PURE__*/ $constructor("$ZodObjectJIT", (inst, def) => {
|
|
@@ -10040,12 +9687,18 @@ const $ZodObjectJIT = /*@__PURE__*/ $constructor("$ZodObjectJIT", (inst, def) =>
|
|
|
10040
9687
|
// a symbol has no source literal, so it is read as `syms[i]` off the closed-over scope
|
|
10041
9688
|
const doc = new Doc(["payload", "ctx"], { shape, inst, memo, syms });
|
|
10042
9689
|
const parseStr = (k) => `shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`;
|
|
10043
|
-
//
|
|
9690
|
+
// prefixes in place, like util.prefixIssues. newResult must land before the early return: a catchall runs after this and would otherwise write onto the caller's input
|
|
10044
9691
|
const prefixStr = (id, k) => `
|
|
9692
|
+
let ${id}_ab = false;
|
|
10045
9693
|
for (let i = 0; i < ${id}.issues.length; i++) {
|
|
10046
9694
|
const iss = ${id}.issues[i];
|
|
10047
9695
|
iss.path = iss.path ? [${k}, ...iss.path] : [${k}];
|
|
10048
9696
|
payload.issues.push(iss);
|
|
9697
|
+
if (iss.continue !== true) ${id}_ab = true;
|
|
9698
|
+
}
|
|
9699
|
+
if (${id}_ab && ctx && ctx.abortEarly) {
|
|
9700
|
+
payload.value = newResult;
|
|
9701
|
+
return payload;
|
|
10049
9702
|
}`;
|
|
10050
9703
|
doc.write(`const input = payload.value;`);
|
|
10051
9704
|
const ids = Object.create(null);
|
|
@@ -10094,6 +9747,10 @@ const $ZodObjectJIT = /*@__PURE__*/ $constructor("$ZodObjectJIT", (inst, def) =>
|
|
|
10094
9747
|
input: undefined,
|
|
10095
9748
|
path: [${k}]
|
|
10096
9749
|
});
|
|
9750
|
+
if (ctx && ctx.abortEarly) {
|
|
9751
|
+
payload.value = newResult;
|
|
9752
|
+
return payload;
|
|
9753
|
+
}
|
|
10097
9754
|
}
|
|
10098
9755
|
|
|
10099
9756
|
if (${id}_present) {
|
|
@@ -10106,16 +9763,17 @@ const $ZodObjectJIT = /*@__PURE__*/ $constructor("$ZodObjectJIT", (inst, def) =>
|
|
|
10106
9763
|
doc.write(`
|
|
10107
9764
|
if (${id}.issues.length) {${prefixStr(id, k)}
|
|
10108
9765
|
}
|
|
10109
|
-
|
|
10110
|
-
|
|
10111
|
-
|
|
10112
|
-
|
|
10113
|
-
|
|
10114
|
-
|
|
9766
|
+
`);
|
|
9767
|
+
if (optin === "defaulted") {
|
|
9768
|
+
doc.write(`newResult[${k}] = ${id}.value;`);
|
|
9769
|
+
}
|
|
9770
|
+
else {
|
|
9771
|
+
doc.write(`
|
|
9772
|
+
if (${id}.value !== undefined || ${isPresent}) {
|
|
10115
9773
|
newResult[${k}] = ${id}.value;
|
|
10116
9774
|
}
|
|
10117
|
-
|
|
10118
9775
|
`);
|
|
9776
|
+
}
|
|
10119
9777
|
}
|
|
10120
9778
|
}
|
|
10121
9779
|
doc.write(`payload.value = newResult;`);
|
|
@@ -10149,7 +9807,7 @@ const $ZodObjectJIT = /*@__PURE__*/ $constructor("$ZodObjectJIT", (inst, def) =>
|
|
|
10149
9807
|
payload = fastpass(payload, ctx);
|
|
10150
9808
|
if (!catchall)
|
|
10151
9809
|
return payload;
|
|
10152
|
-
return handleCatchall([], input, payload, ctx, value, inst);
|
|
9810
|
+
return handleCatchall([], input, payload, ctx, value, inst, ctx?.abortEarly === true);
|
|
10153
9811
|
}
|
|
10154
9812
|
return superParse(payload, ctx);
|
|
10155
9813
|
};
|
|
@@ -10286,22 +9944,38 @@ const $ZodXor = /*@__PURE__*/ (/* unused pure expression or super */ null && (co
|
|
|
10286
9944
|
});
|
|
10287
9945
|
};
|
|
10288
9946
|
})));
|
|
10289
|
-
/** Returns the option
|
|
9947
|
+
/** Returns the option whose discriminator claims `value`, or throws if ambiguous. */
|
|
10290
9948
|
function getDiscriminatedOption(union, value) {
|
|
10291
9949
|
const internals = union._zod;
|
|
10292
9950
|
let map = internals.bag.optionsMap;
|
|
10293
9951
|
if (!map) {
|
|
10294
|
-
map =
|
|
10295
|
-
const { options, discriminator } = internals.def;
|
|
10296
|
-
for (const option of options) {
|
|
10297
|
-
// First declaration wins, matching the order the parse path resolves a duplicate in.
|
|
10298
|
-
for (const v of option._zod.propValues?.[discriminator] ?? [])
|
|
10299
|
-
if (!map.has(v))
|
|
10300
|
-
map.set(v, option);
|
|
10301
|
-
}
|
|
9952
|
+
map = discriminatorMap(internals.def);
|
|
10302
9953
|
internals.bag.optionsMap = map;
|
|
10303
9954
|
}
|
|
10304
|
-
|
|
9955
|
+
const option = map.get(value);
|
|
9956
|
+
if (option === null)
|
|
9957
|
+
throw new Error(`Ambiguous discriminator value "${String(value)}"`);
|
|
9958
|
+
return option;
|
|
9959
|
+
}
|
|
9960
|
+
function discriminatorMap(def) {
|
|
9961
|
+
const map = new Map();
|
|
9962
|
+
for (const option of def.options) {
|
|
9963
|
+
const values = option._zod.propValues?.[def.discriminator];
|
|
9964
|
+
if (!values || values.size === 0)
|
|
9965
|
+
throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(option)}"`);
|
|
9966
|
+
for (const value of values) {
|
|
9967
|
+
if (map.has(value)) {
|
|
9968
|
+
if (value !== undefined)
|
|
9969
|
+
throw new Error(`Duplicate discriminator value "${String(value)}"`);
|
|
9970
|
+
// keep the collision marked so a later member cannot reclaim it
|
|
9971
|
+
map.set(value, null);
|
|
9972
|
+
}
|
|
9973
|
+
else {
|
|
9974
|
+
map.set(value, option);
|
|
9975
|
+
}
|
|
9976
|
+
}
|
|
9977
|
+
}
|
|
9978
|
+
return map;
|
|
10305
9979
|
}
|
|
10306
9980
|
const $ZodDiscriminatedUnion =
|
|
10307
9981
|
/*@__PURE__*/
|
|
@@ -10311,10 +9985,13 @@ $constructor("$ZodDiscriminatedUnion", (inst, def) => {
|
|
|
10311
9985
|
const _super = inst._zod.parse;
|
|
10312
9986
|
defineLazyInternal(inst, "propValues", (zod) => {
|
|
10313
9987
|
const propValues = {};
|
|
9988
|
+
let undefinedCount = 0;
|
|
10314
9989
|
for (const option of zod.def.options) {
|
|
10315
9990
|
const pv = option._zod.propValues;
|
|
10316
9991
|
if (!pv || Object.keys(pv).length === 0)
|
|
10317
9992
|
throw new Error(`Invalid discriminated union option at index "${zod.def.options.indexOf(option)}"`);
|
|
9993
|
+
if (pv[zod.def.discriminator]?.has(undefined))
|
|
9994
|
+
undefinedCount++;
|
|
10318
9995
|
for (const [k, v] of Object.entries(pv)) {
|
|
10319
9996
|
if (!Object.prototype.hasOwnProperty.call(propValues, k)) {
|
|
10320
9997
|
util_assignProp(propValues, k, new Set());
|
|
@@ -10324,31 +10001,18 @@ $constructor("$ZodDiscriminatedUnion", (inst, def) => {
|
|
|
10324
10001
|
}
|
|
10325
10002
|
}
|
|
10326
10003
|
}
|
|
10004
|
+
if (!zod.def.unionFallback && undefinedCount > 1)
|
|
10005
|
+
propValues[zod.def.discriminator]?.delete(undefined);
|
|
10327
10006
|
return propValues;
|
|
10328
10007
|
});
|
|
10329
|
-
// Checked now rather than in the lookup map below, so an option that lacks the discriminator fails at the `discriminatedUnion` call instead of on the first object parsed. Options whose shape cannot be enumerated without resolving it — pipes
|
|
10008
|
+
// Checked now rather than in the lookup map below, so an option that lacks the discriminator fails at the `discriminatedUnion` call instead of on the first object parsed. Options whose shape cannot be enumerated without resolving it — pipes and lazies — are left to the map.
|
|
10330
10009
|
def.options.forEach((option, i) => {
|
|
10331
|
-
const propShape =
|
|
10010
|
+
const propShape = util_rawShape(option._zod.def);
|
|
10332
10011
|
if (propShape && !Object.prototype.hasOwnProperty.call(propShape, def.discriminator)) {
|
|
10333
10012
|
throw new Error(`Invalid discriminated union option at index "${i}"`);
|
|
10334
10013
|
}
|
|
10335
10014
|
});
|
|
10336
|
-
const disc = util_cached(() =>
|
|
10337
|
-
const opts = def.options;
|
|
10338
|
-
const map = new Map();
|
|
10339
|
-
for (const o of opts) {
|
|
10340
|
-
const values = o._zod.propValues?.[def.discriminator];
|
|
10341
|
-
if (!values || values.size === 0)
|
|
10342
|
-
throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(o)}"`);
|
|
10343
|
-
for (const v of values) {
|
|
10344
|
-
if (map.has(v)) {
|
|
10345
|
-
throw new Error(`Duplicate discriminator value "${String(v)}"`);
|
|
10346
|
-
}
|
|
10347
|
-
map.set(v, o);
|
|
10348
|
-
}
|
|
10349
|
-
}
|
|
10350
|
-
return map;
|
|
10351
|
-
});
|
|
10015
|
+
const disc = util_cached(() => discriminatorMap(def));
|
|
10352
10016
|
inst._zod.parse = (payload, ctx) => {
|
|
10353
10017
|
const input = payload.value;
|
|
10354
10018
|
if (!util_isObject(input)) {
|
|
@@ -10360,8 +10024,10 @@ $constructor("$ZodDiscriminatedUnion", (inst, def) => {
|
|
|
10360
10024
|
});
|
|
10361
10025
|
return payload;
|
|
10362
10026
|
}
|
|
10363
|
-
const
|
|
10364
|
-
|
|
10027
|
+
const value = input?.[def.discriminator];
|
|
10028
|
+
const opt = disc.value.get(value);
|
|
10029
|
+
// forward metadata cannot choose an encoder for an absent tag
|
|
10030
|
+
if (opt && (value !== undefined || ctx.direction !== "backward")) {
|
|
10365
10031
|
return opt._zod.run(payload, ctx);
|
|
10366
10032
|
}
|
|
10367
10033
|
// Fall back to union matching when the fast discriminator path fails:
|
|
@@ -10376,7 +10042,7 @@ $constructor("$ZodDiscriminatedUnion", (inst, def) => {
|
|
|
10376
10042
|
errors: [],
|
|
10377
10043
|
note: "No matching discriminator",
|
|
10378
10044
|
discriminator: def.discriminator,
|
|
10379
|
-
options: Array.from(disc.value.keys()),
|
|
10045
|
+
options: Array.from(disc.value.keys()).filter((value) => disc.value.get(value) !== null),
|
|
10380
10046
|
input,
|
|
10381
10047
|
path: [def.discriminator],
|
|
10382
10048
|
inst,
|
|
@@ -10549,6 +10215,9 @@ const $ZodTuple = /*@__PURE__*/ (/* unused pure expression or super */ null && (
|
|
|
10549
10215
|
}
|
|
10550
10216
|
// Run every item in parallel, collecting results into an indexed array. The post-processing in `handleTupleResults` walks them in order so it can decide whether an absent optional-output error can truncate the tail or must be reported to preserve required output.
|
|
10551
10217
|
const itemResults = new Array(items.length);
|
|
10218
|
+
// only tracked when there is a rest loop to skip
|
|
10219
|
+
const abortEarly = def.rest ? ctx?.abortEarly : undefined;
|
|
10220
|
+
let itemAborted = false;
|
|
10552
10221
|
for (let i = 0; i < items.length; i++) {
|
|
10553
10222
|
const r = items[i]._zod.run({ value: input[i], issues: [] }, ctx);
|
|
10554
10223
|
if (r instanceof Promise) {
|
|
@@ -10558,12 +10227,21 @@ const $ZodTuple = /*@__PURE__*/ (/* unused pure expression or super */ null && (
|
|
|
10558
10227
|
}
|
|
10559
10228
|
else {
|
|
10560
10229
|
itemResults[i] = r;
|
|
10230
|
+
if (abortEarly && !itemAborted && r.issues.length)
|
|
10231
|
+
itemAborted = util.aborted(r);
|
|
10561
10232
|
}
|
|
10562
10233
|
}
|
|
10563
|
-
|
|
10234
|
+
// sound because rest is non-empty exactly when every fixed index is present, the one case handleTupleResults cannot discard an item's issues
|
|
10235
|
+
if (def.rest && !itemAborted) {
|
|
10564
10236
|
let i = items.length - 1;
|
|
10565
10237
|
const rest = input.slice(items.length);
|
|
10238
|
+
let seen = payload.issues.length;
|
|
10566
10239
|
for (const el of rest) {
|
|
10240
|
+
if (abortEarly && payload.issues.length !== seen) {
|
|
10241
|
+
if (util.aborted(payload, seen))
|
|
10242
|
+
break;
|
|
10243
|
+
seen = payload.issues.length;
|
|
10244
|
+
}
|
|
10567
10245
|
i++;
|
|
10568
10246
|
const result = def.rest._zod.run({ value: el, issues: [] }, ctx);
|
|
10569
10247
|
if (result instanceof Promise) {
|
|
@@ -10645,6 +10323,7 @@ const $ZodRecord = /*@__PURE__*/ $constructor("$ZodRecord", (inst, def) => {
|
|
|
10645
10323
|
});
|
|
10646
10324
|
return payload;
|
|
10647
10325
|
}
|
|
10326
|
+
// no guard in either loop below: a record's invalid_key aborts but an enclosing intersection can reconcile it, so a stopped loop hides keys the sibling does not own and the intersection then rejects nothing
|
|
10648
10327
|
const proms = [];
|
|
10649
10328
|
const values = def.keyType._zod.values;
|
|
10650
10329
|
if (values && !def.partial) {
|
|
@@ -10816,7 +10495,14 @@ const $ZodMap = /*@__PURE__*/ (/* unused pure expression or super */ null && (co
|
|
|
10816
10495
|
}
|
|
10817
10496
|
const proms = [];
|
|
10818
10497
|
payload.value = memo ? memo.alloc(inst, payload, new Map(), ctx) : new Map();
|
|
10498
|
+
const abortEarly = ctx?.abortEarly;
|
|
10499
|
+
let seen = payload.issues.length;
|
|
10819
10500
|
for (const [key, value] of input) {
|
|
10501
|
+
if (abortEarly && payload.issues.length !== seen) {
|
|
10502
|
+
if (util.aborted(payload, seen))
|
|
10503
|
+
break;
|
|
10504
|
+
seen = payload.issues.length;
|
|
10505
|
+
}
|
|
10820
10506
|
const keyResult = def.keyType._zod.run({ value: key, issues: [] }, ctx);
|
|
10821
10507
|
const valueResult = def.valueType._zod.run({ value: value, issues: [] }, ctx);
|
|
10822
10508
|
if (keyResult instanceof Promise || valueResult instanceof Promise) {
|
|
@@ -10882,7 +10568,14 @@ const $ZodSet = /*@__PURE__*/ (/* unused pure expression or super */ null && (co
|
|
|
10882
10568
|
}
|
|
10883
10569
|
const proms = [];
|
|
10884
10570
|
payload.value = memo ? memo.alloc(inst, payload, new Set(), ctx) : new Set();
|
|
10571
|
+
const abortEarly = ctx?.abortEarly;
|
|
10572
|
+
let seen = payload.issues.length;
|
|
10885
10573
|
for (const item of input) {
|
|
10574
|
+
if (abortEarly && payload.issues.length !== seen) {
|
|
10575
|
+
if (util.aborted(payload, seen))
|
|
10576
|
+
break;
|
|
10577
|
+
seen = payload.issues.length;
|
|
10578
|
+
}
|
|
10886
10579
|
const result = def.valueType._zod.run({ value: item, issues: [] }, ctx);
|
|
10887
10580
|
if (result instanceof Promise) {
|
|
10888
10581
|
proms.push(result.then((result) => handleSetResult(result, payload)));
|
|
@@ -10906,9 +10599,11 @@ const $ZodEnum = /*@__PURE__*/ $constructor("$ZodEnum", (inst, def) => {
|
|
|
10906
10599
|
const values = getEnumValues(def.entries);
|
|
10907
10600
|
const valuesSet = new Set(values);
|
|
10908
10601
|
inst._zod.values = valuesSet;
|
|
10909
|
-
|
|
10910
|
-
|
|
10911
|
-
|
|
10602
|
+
defineLazyInternal(inst, "pattern", (zod) => {
|
|
10603
|
+
const patternValues = getEnumValues(zod.def.entries).filter((k) => propertyKeyTypes.has(typeof k));
|
|
10604
|
+
// unmatchable fallback, RE2-safe: an empty alternation would compile to /^()$/, which matches ""
|
|
10605
|
+
return new RegExp(patternValues.length ? `^(${patternValues.map((o) => escapeRegex(o.toString())).join("|")})$` : "^[^\\s\\S]$");
|
|
10606
|
+
});
|
|
10912
10607
|
inst._zod.parse = (payload, _ctx) => {
|
|
10913
10608
|
const input = payload.value;
|
|
10914
10609
|
if (valuesSet.has(input)) {
|
|
@@ -10927,12 +10622,15 @@ const $ZodLiteral = /*@__PURE__*/ $constructor("$ZodLiteral", (inst, def) => {
|
|
|
10927
10622
|
$ZodType.init(inst, def);
|
|
10928
10623
|
const values = new Set(def.values);
|
|
10929
10624
|
inst._zod.values = values;
|
|
10930
|
-
|
|
10931
|
-
|
|
10932
|
-
|
|
10933
|
-
|
|
10934
|
-
|
|
10935
|
-
|
|
10625
|
+
defineLazyInternal(inst, "pattern", (zod) => {
|
|
10626
|
+
const vals = zod.def.values;
|
|
10627
|
+
// unmatchable fallback, RE2-safe: an empty alternation would compile to /^()$/, which matches ""
|
|
10628
|
+
return new RegExp(vals.length
|
|
10629
|
+
? `^(${vals
|
|
10630
|
+
.map((o) => typeof o === "string" ? escapeRegex(o) : o ? escapeRegex(o.toString()) : String(o))
|
|
10631
|
+
.join("|")})$`
|
|
10632
|
+
: "^[^\\s\\S]$");
|
|
10633
|
+
});
|
|
10936
10634
|
inst._zod.parse = (payload, _ctx) => {
|
|
10937
10635
|
const input = payload.value;
|
|
10938
10636
|
if (values.has(input)) {
|
|
@@ -11296,22 +10994,67 @@ function handleReadonlyResult(payload) {
|
|
|
11296
10994
|
payload.value = Object.freeze(payload.value);
|
|
11297
10995
|
return payload;
|
|
11298
10996
|
}
|
|
10997
|
+
// a leaf's pattern source with its own checks folded in: the last pattern-carrying check wins, else length bounds narrow the catch-all, else an integer format narrows the number form. the fold lives here instead of on `_zod.pattern` so a bundle without template literals never pays for it
|
|
10998
|
+
function leafPattern(schema) {
|
|
10999
|
+
const def = schema._zod.def;
|
|
11000
|
+
let pattern = def.pattern;
|
|
11001
|
+
let isInt = !!def.format?.includes("int");
|
|
11002
|
+
let minimum;
|
|
11003
|
+
let maximum;
|
|
11004
|
+
for (const ch of def.checks ?? []) {
|
|
11005
|
+
const d = ch._zod.def;
|
|
11006
|
+
if (d.pattern)
|
|
11007
|
+
pattern = d.pattern;
|
|
11008
|
+
isInt || (isInt = !!d.format?.includes("int"));
|
|
11009
|
+
const lo = d.minimum ?? d.length;
|
|
11010
|
+
const hi = d.maximum ?? d.length;
|
|
11011
|
+
if (lo !== undefined && (minimum === undefined || lo > minimum))
|
|
11012
|
+
minimum = lo;
|
|
11013
|
+
if (hi !== undefined && (maximum === undefined || hi < maximum))
|
|
11014
|
+
maximum = hi;
|
|
11015
|
+
}
|
|
11016
|
+
if (pattern)
|
|
11017
|
+
return pattern.source;
|
|
11018
|
+
// an empty range matches nothing at runtime, and `{8,5}` is not a legal quantifier
|
|
11019
|
+
if (minimum !== undefined && maximum !== undefined && minimum > maximum)
|
|
11020
|
+
return "(?!)";
|
|
11021
|
+
if (minimum !== undefined || maximum !== undefined)
|
|
11022
|
+
return regexes.string({ minimum, maximum }).source;
|
|
11023
|
+
const own = schema._zod.pattern;
|
|
11024
|
+
return (isInt && own === regexes.number ? regexes.integer : own)?.source;
|
|
11025
|
+
}
|
|
11026
|
+
// a part's pattern source. a wrapper's pattern embeds its inner pattern's source verbatim, so the folded form is substituted in place without knowing the wrapper's own composition; a union's options are joined the way the union builds its own pattern
|
|
11027
|
+
function partPattern(schema) {
|
|
11028
|
+
const def = schema._zod.def;
|
|
11029
|
+
const own = schema._zod.pattern?.source;
|
|
11030
|
+
// lazy resolves its inner on the internals, not the def
|
|
11031
|
+
const inner = def.innerType ?? schema._zod.innerType;
|
|
11032
|
+
if (inner) {
|
|
11033
|
+
const before = inner._zod.pattern?.source;
|
|
11034
|
+
const after = partPattern(inner);
|
|
11035
|
+
if (own && before && after && after !== before) {
|
|
11036
|
+
return own.replace(util.cleanRegex(before), () => util.cleanRegex(after));
|
|
11037
|
+
}
|
|
11038
|
+
return own;
|
|
11039
|
+
}
|
|
11040
|
+
if (def.options) {
|
|
11041
|
+
const sources = def.options.map(partPattern);
|
|
11042
|
+
if (sources.every(Boolean))
|
|
11043
|
+
return `^(${sources.map((s) => util.cleanRegex(s)).join("|")})$`;
|
|
11044
|
+
}
|
|
11045
|
+
return leafPattern(schema);
|
|
11046
|
+
}
|
|
11299
11047
|
const $ZodTemplateLiteral = /*@__PURE__*/ (/* unused pure expression or super */ null && (core.$constructor("$ZodTemplateLiteral", (inst, def) => {
|
|
11300
11048
|
$ZodType.init(inst, def);
|
|
11301
11049
|
const regexParts = [];
|
|
11302
11050
|
for (const part of def.parts) {
|
|
11303
11051
|
if (typeof part === "object" && part !== null) {
|
|
11304
11052
|
// is Zod schema
|
|
11305
|
-
|
|
11306
|
-
|
|
11053
|
+
const source = partPattern(part);
|
|
11054
|
+
if (!source) {
|
|
11307
11055
|
throw new Error(`Invalid template literal part, no pattern found: ${[...part._zod.traits].shift()}`);
|
|
11308
11056
|
}
|
|
11309
|
-
|
|
11310
|
-
if (!source)
|
|
11311
|
-
throw new Error(`Invalid template literal part: ${part._zod.traits}`);
|
|
11312
|
-
const start = source.startsWith("^") ? 1 : 0;
|
|
11313
|
-
const end = source.endsWith("$") ? source.length - 1 : source.length;
|
|
11314
|
-
regexParts.push(source.slice(start, end));
|
|
11057
|
+
regexParts.push(util.cleanRegex(source));
|
|
11315
11058
|
}
|
|
11316
11059
|
else if (part === null || util.primitiveTypes.has(typeof part)) {
|
|
11317
11060
|
regexParts.push(util.escapeRegex(`${part}`));
|
|
@@ -11540,20 +11283,18 @@ const registries_globalRegistry = globalThis.__zod_globalRegistry;
|
|
|
11540
11283
|
|
|
11541
11284
|
|
|
11542
11285
|
|
|
11286
|
+
function snapshotChecks(def) {
|
|
11287
|
+
if (def.checks)
|
|
11288
|
+
def.checks = [...def.checks];
|
|
11289
|
+
return def;
|
|
11290
|
+
}
|
|
11543
11291
|
// @__NO_SIDE_EFFECTS__
|
|
11544
11292
|
function _string(Class, params) {
|
|
11545
|
-
return new Class({
|
|
11546
|
-
type: "string",
|
|
11547
|
-
...normalizeParams(params),
|
|
11548
|
-
});
|
|
11293
|
+
return new Class(snapshotChecks({ type: "string", ...normalizeParams(params) }));
|
|
11549
11294
|
}
|
|
11550
11295
|
// @__NO_SIDE_EFFECTS__
|
|
11551
11296
|
function _coercedString(Class, params) {
|
|
11552
|
-
return new Class({
|
|
11553
|
-
type: "string",
|
|
11554
|
-
coerce: true,
|
|
11555
|
-
...util.normalizeParams(params),
|
|
11556
|
-
});
|
|
11297
|
+
return new Class(snapshotChecks({ type: "string", coerce: true, ...util.normalizeParams(params) }));
|
|
11557
11298
|
}
|
|
11558
11299
|
// @__NO_SIDE_EFFECTS__
|
|
11559
11300
|
function _email(Class, params) {
|
|
@@ -11794,6 +11535,16 @@ function _creditCard(Class, params) {
|
|
|
11794
11535
|
});
|
|
11795
11536
|
}
|
|
11796
11537
|
// @__NO_SIDE_EFFECTS__
|
|
11538
|
+
function _iban(Class, params) {
|
|
11539
|
+
return new Class({
|
|
11540
|
+
type: "string",
|
|
11541
|
+
format: "iban",
|
|
11542
|
+
check: "string_format",
|
|
11543
|
+
abort: false,
|
|
11544
|
+
...util.normalizeParams(params),
|
|
11545
|
+
});
|
|
11546
|
+
}
|
|
11547
|
+
// @__NO_SIDE_EFFECTS__
|
|
11797
11548
|
function _jwt(Class, params) {
|
|
11798
11549
|
return new Class({
|
|
11799
11550
|
type: "string",
|
|
@@ -11852,20 +11603,11 @@ function _isoDuration(Class, params) {
|
|
|
11852
11603
|
}
|
|
11853
11604
|
// @__NO_SIDE_EFFECTS__
|
|
11854
11605
|
function _number(Class, params) {
|
|
11855
|
-
return new Class({
|
|
11856
|
-
type: "number",
|
|
11857
|
-
checks: [],
|
|
11858
|
-
...normalizeParams(params),
|
|
11859
|
-
});
|
|
11606
|
+
return new Class(snapshotChecks({ type: "number", checks: [], ...normalizeParams(params) }));
|
|
11860
11607
|
}
|
|
11861
11608
|
// @__NO_SIDE_EFFECTS__
|
|
11862
11609
|
function _coercedNumber(Class, params) {
|
|
11863
|
-
return new Class({
|
|
11864
|
-
type: "number",
|
|
11865
|
-
coerce: true,
|
|
11866
|
-
checks: [],
|
|
11867
|
-
...util.normalizeParams(params),
|
|
11868
|
-
});
|
|
11610
|
+
return new Class(snapshotChecks({ type: "number", coerce: true, checks: [], ...util.normalizeParams(params) }));
|
|
11869
11611
|
}
|
|
11870
11612
|
// @__NO_SIDE_EFFECTS__
|
|
11871
11613
|
function _int(Class, params) {
|
|
@@ -12212,8 +11954,12 @@ function _property(property, schema, params) {
|
|
|
12212
11954
|
});
|
|
12213
11955
|
}
|
|
12214
11956
|
// @__NO_SIDE_EFFECTS__
|
|
12215
|
-
function _properties(shape) {
|
|
12216
|
-
return
|
|
11957
|
+
function _properties(shape, params) {
|
|
11958
|
+
return new checks.$ZodCheckProperties({
|
|
11959
|
+
check: "properties",
|
|
11960
|
+
shape,
|
|
11961
|
+
...util.normalizeParams(params),
|
|
11962
|
+
});
|
|
12217
11963
|
}
|
|
12218
11964
|
// @__NO_SIDE_EFFECTS__
|
|
12219
11965
|
function _mime(types, params) {
|
|
@@ -12699,7 +12445,8 @@ function to_json_schema_handleUnrepresentable(schema, ctx, json, params, message
|
|
|
12699
12445
|
Object.assign(json, result);
|
|
12700
12446
|
return true;
|
|
12701
12447
|
}
|
|
12702
|
-
|
|
12448
|
+
// never rename this back to `process`: bundler polyfills inject a top-level `const process` that a lexical declaration of the same name collides with (#6397)
|
|
12449
|
+
function processSchema(schema, ctx, _params = { path: [], schemaPath: [] }) {
|
|
12703
12450
|
var _a;
|
|
12704
12451
|
const def = schema._zod.def;
|
|
12705
12452
|
// check for schema in seens
|
|
@@ -12745,7 +12492,7 @@ function to_json_schema_process(schema, ctx, _params = { path: [], schemaPath: [
|
|
|
12745
12492
|
// Also set ref if processor didn't (for inheritance)
|
|
12746
12493
|
if (!result.ref)
|
|
12747
12494
|
result.ref = parent;
|
|
12748
|
-
|
|
12495
|
+
processSchema(parent, ctx, params);
|
|
12749
12496
|
ctx.seen.get(parent).isParent = true;
|
|
12750
12497
|
}
|
|
12751
12498
|
}
|
|
@@ -12766,6 +12513,8 @@ function to_json_schema_process(schema, ctx, _params = { path: [], schemaPath: [
|
|
|
12766
12513
|
const _result = ctx.seen.get(schema);
|
|
12767
12514
|
return _result.schema;
|
|
12768
12515
|
}
|
|
12516
|
+
/** @deprecated Renamed to `processSchema`. An export alias declares no binding, so it is safe to keep. */
|
|
12517
|
+
|
|
12769
12518
|
// Escape a reference token for use in a JSON Pointer fragment (RFC 6901): `~` becomes `~0` and `/` becomes `~1`. The `~` replacement must run first.
|
|
12770
12519
|
function encodeJSONPointerSegment(segment) {
|
|
12771
12520
|
return segment.replace(/~/g, "~0").replace(/\//g, "~1");
|
|
@@ -12882,8 +12631,6 @@ function to_json_schema_extractDefs(ctx, schema
|
|
|
12882
12631
|
if (seen.count > 1) {
|
|
12883
12632
|
if (ctx.reused === "ref") {
|
|
12884
12633
|
extractToDef(entry);
|
|
12885
|
-
// biome-ignore lint:
|
|
12886
|
-
continue;
|
|
12887
12634
|
}
|
|
12888
12635
|
}
|
|
12889
12636
|
}
|
|
@@ -13277,14 +13024,14 @@ function isTransforming(_schema, _ctx) {
|
|
|
13277
13024
|
*/
|
|
13278
13025
|
const createToJSONSchemaMethod = (schema, processors = {}) => (params) => {
|
|
13279
13026
|
const ctx = to_json_schema_initializeContext({ ...params, processors });
|
|
13280
|
-
|
|
13027
|
+
processSchema(schema, ctx);
|
|
13281
13028
|
to_json_schema_extractDefs(ctx, schema);
|
|
13282
13029
|
return to_json_schema_finalize(ctx, schema);
|
|
13283
13030
|
};
|
|
13284
13031
|
const createStandardJSONSchemaMethod = (schema, io, processors = {}) => (params) => {
|
|
13285
13032
|
const { libraryOptions, target } = params ?? {};
|
|
13286
13033
|
const ctx = to_json_schema_initializeContext({ ...(libraryOptions ?? {}), target, io, processors });
|
|
13287
|
-
|
|
13034
|
+
processSchema(schema, ctx);
|
|
13288
13035
|
to_json_schema_extractDefs(ctx, schema);
|
|
13289
13036
|
return to_json_schema_finalize(ctx, schema);
|
|
13290
13037
|
};
|
|
@@ -13293,6 +13040,100 @@ const createStandardJSONSchemaMethod = (schema, io, processors = {}) => (params)
|
|
|
13293
13040
|
|
|
13294
13041
|
|
|
13295
13042
|
|
|
13043
|
+
|
|
13044
|
+
const narrowMin = (agg, key, value) => {
|
|
13045
|
+
if (agg[key] === undefined || value > agg[key])
|
|
13046
|
+
agg[key] = value;
|
|
13047
|
+
};
|
|
13048
|
+
const narrowMax = (agg, key, value) => {
|
|
13049
|
+
if (agg[key] === undefined || value < agg[key])
|
|
13050
|
+
agg[key] = value;
|
|
13051
|
+
};
|
|
13052
|
+
const narrowBoth = (agg, value) => {
|
|
13053
|
+
narrowMin(agg, "minimum", value);
|
|
13054
|
+
narrowMax(agg, "maximum", value);
|
|
13055
|
+
};
|
|
13056
|
+
const addDivisor = (agg, value) => {
|
|
13057
|
+
agg.multipleOf ?? (agg.multipleOf = []);
|
|
13058
|
+
if (!agg.multipleOf.includes(value))
|
|
13059
|
+
agg.multipleOf.push(value);
|
|
13060
|
+
};
|
|
13061
|
+
const addPattern = (agg, pattern) => {
|
|
13062
|
+
agg.patterns ?? (agg.patterns = new Set());
|
|
13063
|
+
agg.patterns.add(pattern);
|
|
13064
|
+
};
|
|
13065
|
+
const intersectMime = (agg, mime) => {
|
|
13066
|
+
agg.mime = agg.mime ? agg.mime.filter((m) => mime.includes(m)) : [...mime];
|
|
13067
|
+
};
|
|
13068
|
+
// last-wins, matching the bag's historical write order; the flag keeps an integer format from being lost to a later float one
|
|
13069
|
+
const setFormat = (agg, format) => {
|
|
13070
|
+
agg.format = format;
|
|
13071
|
+
if (format.includes("int"))
|
|
13072
|
+
agg.isInt = true;
|
|
13073
|
+
};
|
|
13074
|
+
const minContributor = (agg, def) => narrowMin(agg, "minimum", def.minimum);
|
|
13075
|
+
const maxContributor = (agg, def) => narrowMax(agg, "maximum", def.maximum);
|
|
13076
|
+
const formatContributor = (ranges) => (agg, def) => {
|
|
13077
|
+
setFormat(agg, def.format);
|
|
13078
|
+
const [minimum, maximum] = ranges[def.format];
|
|
13079
|
+
narrowMin(agg, "minimum", minimum);
|
|
13080
|
+
narrowMax(agg, "maximum", maximum);
|
|
13081
|
+
};
|
|
13082
|
+
const contributors = {
|
|
13083
|
+
greater_than: (agg, def) => narrowMin(agg, def.inclusive ? "minimum" : "exclusiveMinimum", def.value),
|
|
13084
|
+
less_than: (agg, def) => narrowMax(agg, def.inclusive ? "maximum" : "exclusiveMaximum", def.value),
|
|
13085
|
+
multiple_of: (agg, def) => addDivisor(agg, def.value),
|
|
13086
|
+
number_format: formatContributor(NUMBER_FORMAT_RANGES),
|
|
13087
|
+
bigint_format: formatContributor(BIGINT_FORMAT_RANGES),
|
|
13088
|
+
min_length: minContributor,
|
|
13089
|
+
max_length: maxContributor,
|
|
13090
|
+
length_equals: (agg, def) => narrowBoth(agg, def.length),
|
|
13091
|
+
min_size: minContributor,
|
|
13092
|
+
max_size: maxContributor,
|
|
13093
|
+
size_equals: (agg, def) => narrowBoth(agg, def.size),
|
|
13094
|
+
string_format: (agg, def) => {
|
|
13095
|
+
setFormat(agg, def.format);
|
|
13096
|
+
if (def.pattern)
|
|
13097
|
+
addPattern(agg, def.pattern);
|
|
13098
|
+
if (def.format === "base64" || def.format === "base64url")
|
|
13099
|
+
agg.contentEncoding = def.format;
|
|
13100
|
+
if (def.local || def.precision === -1)
|
|
13101
|
+
agg.laxFormat = true;
|
|
13102
|
+
},
|
|
13103
|
+
mime_type: (agg, def) => intersectMime(agg, def.mime),
|
|
13104
|
+
};
|
|
13105
|
+
function aggregateChecks(schema) {
|
|
13106
|
+
const agg = {};
|
|
13107
|
+
const def = schema._zod.def;
|
|
13108
|
+
// a format schema is its own first check, same rule as $ZodType init
|
|
13109
|
+
const list = schema._zod.traits.has("$ZodCheck")
|
|
13110
|
+
? [schema, ...(def.checks ?? [])]
|
|
13111
|
+
: (def.checks ?? []);
|
|
13112
|
+
for (const ch of list)
|
|
13113
|
+
contributors[ch._zod.def.check]?.(agg, ch._zod.def);
|
|
13114
|
+
// reconcile with the bag so third-party onattach contributions still land; first-party residue is never tighter than the fold, so merging it back is idempotent for one and additive for the other
|
|
13115
|
+
const bag = schema._zod.bag;
|
|
13116
|
+
if (bag.minimum !== undefined)
|
|
13117
|
+
narrowMin(agg, "minimum", bag.minimum);
|
|
13118
|
+
if (bag.exclusiveMinimum !== undefined)
|
|
13119
|
+
narrowMin(agg, "exclusiveMinimum", bag.exclusiveMinimum);
|
|
13120
|
+
if (bag.maximum !== undefined)
|
|
13121
|
+
narrowMax(agg, "maximum", bag.maximum);
|
|
13122
|
+
if (bag.exclusiveMaximum !== undefined)
|
|
13123
|
+
narrowMax(agg, "exclusiveMaximum", bag.exclusiveMaximum);
|
|
13124
|
+
if (bag.multipleOf !== undefined)
|
|
13125
|
+
addDivisor(agg, bag.multipleOf);
|
|
13126
|
+
if (bag.format !== undefined) {
|
|
13127
|
+
agg.format ?? (agg.format = bag.format);
|
|
13128
|
+
if (bag.format.includes("int"))
|
|
13129
|
+
agg.isInt = true;
|
|
13130
|
+
}
|
|
13131
|
+
if (bag.mime)
|
|
13132
|
+
intersectMime(agg, bag.mime);
|
|
13133
|
+
for (const pattern of bag.patterns ?? [])
|
|
13134
|
+
addPattern(agg, pattern);
|
|
13135
|
+
return agg;
|
|
13136
|
+
}
|
|
13296
13137
|
const formatMap = {
|
|
13297
13138
|
guid: "uuid",
|
|
13298
13139
|
url: "uri",
|
|
@@ -13301,11 +13142,16 @@ const formatMap = {
|
|
|
13301
13142
|
regex: "", // do not set
|
|
13302
13143
|
};
|
|
13303
13144
|
// ==================== SIMPLE TYPE PROCESSORS ====================
|
|
13145
|
+
// the runtime patterns are lax so parse paths never overflow the regex stack; the emitted schema swaps in the exact block forms, which zod itself never executes
|
|
13146
|
+
const exactPatterns = new Map([
|
|
13147
|
+
[base64Charset, regexes_base64],
|
|
13148
|
+
[base64urlCharset, regexes_base64url],
|
|
13149
|
+
]);
|
|
13150
|
+
const exactPattern = (p) => exactPatterns.get(p) ?? p;
|
|
13304
13151
|
const stringProcessor = (schema, ctx, _json, _params) => {
|
|
13305
13152
|
const json = _json;
|
|
13306
13153
|
json.type = "string";
|
|
13307
|
-
const { minimum, maximum, format, patterns, contentEncoding, laxFormat } = schema
|
|
13308
|
-
.bag;
|
|
13154
|
+
const { minimum, maximum, format, patterns, contentEncoding, laxFormat } = aggregateChecks(schema);
|
|
13309
13155
|
if (typeof minimum === "number")
|
|
13310
13156
|
json.minLength = minimum;
|
|
13311
13157
|
if (typeof maximum === "number")
|
|
@@ -13323,7 +13169,7 @@ const stringProcessor = (schema, ctx, _json, _params) => {
|
|
|
13323
13169
|
if (contentEncoding)
|
|
13324
13170
|
json.contentEncoding = contentEncoding;
|
|
13325
13171
|
if (patterns && patterns.size > 0) {
|
|
13326
|
-
const patternList = [...patterns];
|
|
13172
|
+
const patternList = [...patterns].map(exactPattern);
|
|
13327
13173
|
if (patternList.length === 1)
|
|
13328
13174
|
json.pattern = patternList[0].source;
|
|
13329
13175
|
else if (patternList.length > 1) {
|
|
@@ -13340,11 +13186,8 @@ const stringProcessor = (schema, ctx, _json, _params) => {
|
|
|
13340
13186
|
};
|
|
13341
13187
|
const numberProcessor = (schema, ctx, _json, params) => {
|
|
13342
13188
|
const json = _json;
|
|
13343
|
-
const { minimum, maximum,
|
|
13344
|
-
|
|
13345
|
-
json.type = "integer";
|
|
13346
|
-
else
|
|
13347
|
-
json.type = "number";
|
|
13189
|
+
const { minimum, maximum, multipleOf, exclusiveMaximum, exclusiveMinimum, isInt } = aggregateChecks(schema);
|
|
13190
|
+
json.type = isInt ? "integer" : "number";
|
|
13348
13191
|
// when both minimum and exclusiveMinimum exist, pick the more restrictive one
|
|
13349
13192
|
const exMin = typeof exclusiveMinimum === "number" && exclusiveMinimum >= (minimum ?? Number.NEGATIVE_INFINITY);
|
|
13350
13193
|
const exMax = typeof exclusiveMaximum === "number" && exclusiveMaximum <= (maximum ?? Number.POSITIVE_INFINITY);
|
|
@@ -13373,12 +13216,21 @@ const numberProcessor = (schema, ctx, _json, params) => {
|
|
|
13373
13216
|
else if (typeof maximum === "number") {
|
|
13374
13217
|
json.maximum = maximum;
|
|
13375
13218
|
}
|
|
13376
|
-
if (
|
|
13219
|
+
if (multipleOf) {
|
|
13377
13220
|
// JSON Schema requires a divisor strictly greater than zero, and a non-finite one does not survive JSON at all. A negative divisor accepts exactly what its absolute value accepts, so it still maps; zero, NaN and Infinity have no keyword form.
|
|
13378
|
-
|
|
13379
|
-
|
|
13380
|
-
|
|
13381
|
-
|
|
13221
|
+
const divisors = new Set();
|
|
13222
|
+
for (const divisor of multipleOf) {
|
|
13223
|
+
if (Number.isFinite(divisor) && divisor !== 0)
|
|
13224
|
+
divisors.add(Math.abs(divisor));
|
|
13225
|
+
else
|
|
13226
|
+
to_json_schema_handleUnrepresentable(schema, ctx, json, params, `A multipleOf divisor of ${divisor} cannot be represented in JSON Schema`);
|
|
13227
|
+
}
|
|
13228
|
+
// chained divisors are a conjunction the keyword cannot carry alone, so extras ride an allOf, same as stacked patterns
|
|
13229
|
+
const [first, ...rest] = divisors;
|
|
13230
|
+
if (first !== undefined)
|
|
13231
|
+
json.multipleOf = first;
|
|
13232
|
+
if (rest.length)
|
|
13233
|
+
json.allOf = [...(json.allOf ?? []), ...rest.map((m) => ({ multipleOf: m }))];
|
|
13382
13234
|
}
|
|
13383
13235
|
};
|
|
13384
13236
|
const booleanProcessor = (_schema, _ctx, json, _params) => {
|
|
@@ -13495,29 +13347,24 @@ const templateLiteralProcessor = (schema, _ctx, json, _params) => {
|
|
|
13495
13347
|
};
|
|
13496
13348
|
const fileProcessor = (schema, _ctx, json, _params) => {
|
|
13497
13349
|
const _json = json;
|
|
13498
|
-
|
|
13499
|
-
|
|
13500
|
-
|
|
13501
|
-
|
|
13502
|
-
};
|
|
13503
|
-
const { minimum, maximum, mime } = schema._zod.bag;
|
|
13350
|
+
_json.type = "string";
|
|
13351
|
+
_json.format = "binary";
|
|
13352
|
+
_json.contentEncoding = "binary";
|
|
13353
|
+
const { minimum, maximum, mime } = aggregateChecks(schema);
|
|
13504
13354
|
if (minimum !== undefined)
|
|
13505
|
-
|
|
13355
|
+
_json.minLength = minimum;
|
|
13506
13356
|
if (maximum !== undefined)
|
|
13507
|
-
|
|
13508
|
-
if (mime)
|
|
13509
|
-
|
|
13510
|
-
|
|
13511
|
-
|
|
13512
|
-
}
|
|
13513
|
-
|
|
13514
|
-
|
|
13515
|
-
|
|
13516
|
-
|
|
13517
|
-
|
|
13518
|
-
else {
|
|
13519
|
-
Object.assign(_json, file);
|
|
13520
|
-
}
|
|
13357
|
+
_json.maxLength = maximum;
|
|
13358
|
+
if (!mime)
|
|
13359
|
+
return;
|
|
13360
|
+
// an empty intersection means the mime checks share no value, so nothing passes at runtime; `anyOf` must be non-empty, so the false schema is `not: {}`
|
|
13361
|
+
if (mime.length === 0)
|
|
13362
|
+
_json.not = {};
|
|
13363
|
+
else if (mime.length === 1)
|
|
13364
|
+
_json.contentMediaType = mime[0];
|
|
13365
|
+
// only contentMediaType differs, so the shared props stay at the root
|
|
13366
|
+
else
|
|
13367
|
+
_json.anyOf = mime.map((m) => ({ contentMediaType: m }));
|
|
13521
13368
|
};
|
|
13522
13369
|
const successProcessor = (_schema, _ctx, json, _params) => {
|
|
13523
13370
|
json.type = "boolean";
|
|
@@ -13541,13 +13388,13 @@ const setProcessor = (schema, ctx, json, params) => {
|
|
|
13541
13388
|
const arrayProcessor = (schema, ctx, _json, params) => {
|
|
13542
13389
|
const json = _json;
|
|
13543
13390
|
const def = schema._zod.def;
|
|
13544
|
-
const { minimum, maximum } = schema
|
|
13391
|
+
const { minimum, maximum } = aggregateChecks(schema);
|
|
13545
13392
|
if (typeof minimum === "number")
|
|
13546
13393
|
json.minItems = minimum;
|
|
13547
13394
|
if (typeof maximum === "number")
|
|
13548
13395
|
json.maxItems = maximum;
|
|
13549
13396
|
json.type = "array";
|
|
13550
|
-
json.items =
|
|
13397
|
+
json.items = processSchema(def.element, ctx, {
|
|
13551
13398
|
...params,
|
|
13552
13399
|
path: [...params.path, "items"],
|
|
13553
13400
|
});
|
|
@@ -13581,24 +13428,21 @@ const objectProcessor = (schema, ctx, _json, params) => {
|
|
|
13581
13428
|
json.properties = {};
|
|
13582
13429
|
for (const key in shape) {
|
|
13583
13430
|
// assignProp so a __proto__ key becomes an own property instead of hitting the inherited setter on the plain {} we build into
|
|
13584
|
-
util_assignProp(json.properties, key,
|
|
13431
|
+
util_assignProp(json.properties, key, processSchema(shape[key], ctx, {
|
|
13585
13432
|
...params,
|
|
13586
13433
|
path: [...params.path, "properties", key],
|
|
13587
13434
|
}));
|
|
13588
13435
|
}
|
|
13589
13436
|
// required keys
|
|
13590
|
-
const
|
|
13591
|
-
const
|
|
13437
|
+
const requiredKeys = [];
|
|
13438
|
+
for (const key of Object.keys(shape)) {
|
|
13592
13439
|
const field = def.shape[key];
|
|
13593
|
-
if (ctx.io === "input") {
|
|
13594
|
-
|
|
13595
|
-
}
|
|
13596
|
-
else {
|
|
13597
|
-
return field._zod.optout === undefined;
|
|
13440
|
+
if (ctx.io === "input" ? inputOptin(field) === undefined : field._zod.optout === undefined) {
|
|
13441
|
+
requiredKeys.push(key);
|
|
13598
13442
|
}
|
|
13599
|
-
}
|
|
13600
|
-
if (requiredKeys.
|
|
13601
|
-
json.required =
|
|
13443
|
+
}
|
|
13444
|
+
if (requiredKeys.length > 0) {
|
|
13445
|
+
json.required = requiredKeys;
|
|
13602
13446
|
}
|
|
13603
13447
|
// catchall
|
|
13604
13448
|
if (def.catchall?._zod.def.type === "never") {
|
|
@@ -13611,7 +13455,7 @@ const objectProcessor = (schema, ctx, _json, params) => {
|
|
|
13611
13455
|
json.additionalProperties = false;
|
|
13612
13456
|
}
|
|
13613
13457
|
else if (def.catchall) {
|
|
13614
|
-
json.additionalProperties =
|
|
13458
|
+
json.additionalProperties = processSchema(def.catchall, ctx, {
|
|
13615
13459
|
...params,
|
|
13616
13460
|
path: [...params.path, "additionalProperties"],
|
|
13617
13461
|
});
|
|
@@ -13621,7 +13465,7 @@ const unionProcessor = (schema, ctx, json, params) => {
|
|
|
13621
13465
|
const def = schema._zod.def;
|
|
13622
13466
|
// Exclusive unions (inclusive === false) use oneOf (exactly one match) instead of anyOf (one or more matches). This includes both z.xor() and discriminated unions
|
|
13623
13467
|
const isExclusive = def.inclusive === false;
|
|
13624
|
-
const options = def.options.map((x, i) =>
|
|
13468
|
+
const options = def.options.map((x, i) => processSchema(x, ctx, {
|
|
13625
13469
|
...params,
|
|
13626
13470
|
path: [...params.path, isExclusive ? "oneOf" : "anyOf", i],
|
|
13627
13471
|
}));
|
|
@@ -13634,11 +13478,11 @@ const unionProcessor = (schema, ctx, json, params) => {
|
|
|
13634
13478
|
};
|
|
13635
13479
|
const intersectionProcessor = (schema, ctx, json, params) => {
|
|
13636
13480
|
const def = schema._zod.def;
|
|
13637
|
-
const a =
|
|
13481
|
+
const a = processSchema(def.left, ctx, {
|
|
13638
13482
|
...params,
|
|
13639
13483
|
path: [...params.path, "allOf", 0],
|
|
13640
13484
|
});
|
|
13641
|
-
const b =
|
|
13485
|
+
const b = processSchema(def.right, ctx, {
|
|
13642
13486
|
...params,
|
|
13643
13487
|
path: [...params.path, "allOf", 1],
|
|
13644
13488
|
});
|
|
@@ -13657,12 +13501,12 @@ const tupleProcessor = (schema, ctx, _json, params) => {
|
|
|
13657
13501
|
json.type = "array";
|
|
13658
13502
|
const prefixPath = ctx.target === "draft-2020-12" ? "prefixItems" : "items";
|
|
13659
13503
|
const restPath = ctx.target === "draft-2020-12" ? "items" : ctx.target === "openapi-3.0" ? "items" : "additionalItems";
|
|
13660
|
-
const prefixItems = def.items.map((x, i) =>
|
|
13504
|
+
const prefixItems = def.items.map((x, i) => processSchema(x, ctx, {
|
|
13661
13505
|
...params,
|
|
13662
13506
|
path: [...params.path, prefixPath, i],
|
|
13663
13507
|
}));
|
|
13664
13508
|
const rest = def.rest
|
|
13665
|
-
?
|
|
13509
|
+
? processSchema(def.rest, ctx, {
|
|
13666
13510
|
...params,
|
|
13667
13511
|
path: [...params.path, restPath, ...(ctx.target === "openapi-3.0" ? [def.items.length] : [])],
|
|
13668
13512
|
})
|
|
@@ -13716,7 +13560,7 @@ const tupleProcessor = (schema, ctx, _json, params) => {
|
|
|
13716
13560
|
json.maxItems = maxItems;
|
|
13717
13561
|
}
|
|
13718
13562
|
// explicit user-defined length checks take precedence
|
|
13719
|
-
const { minimum, maximum } = schema
|
|
13563
|
+
const { minimum, maximum } = aggregateChecks(schema);
|
|
13720
13564
|
if (typeof minimum === "number")
|
|
13721
13565
|
json.minItems = minimum;
|
|
13722
13566
|
if (typeof maximum === "number")
|
|
@@ -13809,23 +13653,22 @@ const recordProcessor = (schema, ctx, _json, params) => {
|
|
|
13809
13653
|
json.type = "object";
|
|
13810
13654
|
// For looseRecord with regex patterns, use patternProperties. This correctly represents "only validate keys matching the pattern" semantics and composes well with allOf (intersections)
|
|
13811
13655
|
const keyType = def.keyType;
|
|
13812
|
-
const
|
|
13813
|
-
const patterns = keyBag?.patterns;
|
|
13656
|
+
const patterns = aggregateChecks(keyType).patterns;
|
|
13814
13657
|
if (def.mode === "loose" && patterns && patterns.size > 0) {
|
|
13815
13658
|
// Use patternProperties for looseRecord with regex patterns
|
|
13816
|
-
const valueSchema =
|
|
13659
|
+
const valueSchema = processSchema(def.valueType, ctx, {
|
|
13817
13660
|
...params,
|
|
13818
13661
|
path: [...params.path, "patternProperties", "*"],
|
|
13819
13662
|
});
|
|
13820
13663
|
json.patternProperties = {};
|
|
13821
13664
|
for (const pattern of patterns) {
|
|
13822
|
-
util_assignProp(json.patternProperties, pattern.source, valueSchema);
|
|
13665
|
+
util_assignProp(json.patternProperties, exactPattern(pattern).source, valueSchema);
|
|
13823
13666
|
}
|
|
13824
13667
|
}
|
|
13825
13668
|
else {
|
|
13826
13669
|
// Default behavior: use propertyNames + additionalProperties
|
|
13827
13670
|
if (ctx.target === "draft-07" || ctx.target === "draft-2020-12") {
|
|
13828
|
-
json.propertyNames =
|
|
13671
|
+
json.propertyNames = processSchema(def.keyType, ctx, {
|
|
13829
13672
|
...params,
|
|
13830
13673
|
path: [...params.path, "propertyNames"],
|
|
13831
13674
|
});
|
|
@@ -13837,7 +13680,7 @@ const recordProcessor = (schema, ctx, _json, params) => {
|
|
|
13837
13680
|
}
|
|
13838
13681
|
pending.push(schema);
|
|
13839
13682
|
}
|
|
13840
|
-
json.additionalProperties =
|
|
13683
|
+
json.additionalProperties = processSchema(def.valueType, ctx, {
|
|
13841
13684
|
...params,
|
|
13842
13685
|
path: [...params.path, "additionalProperties"],
|
|
13843
13686
|
});
|
|
@@ -13855,7 +13698,7 @@ const recordProcessor = (schema, ctx, _json, params) => {
|
|
|
13855
13698
|
};
|
|
13856
13699
|
const nullableProcessor = (schema, ctx, json, params) => {
|
|
13857
13700
|
const def = schema._zod.def;
|
|
13858
|
-
const inner =
|
|
13701
|
+
const inner = processSchema(def.innerType, ctx, params);
|
|
13859
13702
|
const seen = ctx.seen.get(schema);
|
|
13860
13703
|
if (ctx.target === "openapi-3.0") {
|
|
13861
13704
|
seen.ref = def.innerType;
|
|
@@ -13867,7 +13710,7 @@ const nullableProcessor = (schema, ctx, json, params) => {
|
|
|
13867
13710
|
};
|
|
13868
13711
|
const nonoptionalProcessor = (schema, ctx, _json, params) => {
|
|
13869
13712
|
const def = schema._zod.def;
|
|
13870
|
-
|
|
13713
|
+
processSchema(def.innerType, ctx, params);
|
|
13871
13714
|
const seen = ctx.seen.get(schema);
|
|
13872
13715
|
seen.ref = def.innerType;
|
|
13873
13716
|
};
|
|
@@ -13890,7 +13733,7 @@ function serializeDefaultValue(value, schema, ctx, json, params) {
|
|
|
13890
13733
|
}
|
|
13891
13734
|
const defaultProcessor = (schema, ctx, json, params) => {
|
|
13892
13735
|
const def = schema._zod.def;
|
|
13893
|
-
|
|
13736
|
+
processSchema(def.innerType, ctx, params);
|
|
13894
13737
|
const seen = ctx.seen.get(schema);
|
|
13895
13738
|
seen.ref = def.innerType;
|
|
13896
13739
|
const value = serializeDefaultValue(def.defaultValue, schema, ctx, json, params);
|
|
@@ -13899,7 +13742,7 @@ const defaultProcessor = (schema, ctx, json, params) => {
|
|
|
13899
13742
|
};
|
|
13900
13743
|
const prefaultProcessor = (schema, ctx, json, params) => {
|
|
13901
13744
|
const def = schema._zod.def;
|
|
13902
|
-
|
|
13745
|
+
processSchema(def.innerType, ctx, params);
|
|
13903
13746
|
const seen = ctx.seen.get(schema);
|
|
13904
13747
|
seen.ref = def.innerType;
|
|
13905
13748
|
if (ctx.io !== "input")
|
|
@@ -13910,7 +13753,7 @@ const prefaultProcessor = (schema, ctx, json, params) => {
|
|
|
13910
13753
|
};
|
|
13911
13754
|
const catchProcessor = (schema, ctx, json, params) => {
|
|
13912
13755
|
const def = schema._zod.def;
|
|
13913
|
-
|
|
13756
|
+
processSchema(def.innerType, ctx, params);
|
|
13914
13757
|
const seen = ctx.seen.get(schema);
|
|
13915
13758
|
seen.ref = def.innerType;
|
|
13916
13759
|
let catchValue;
|
|
@@ -13927,32 +13770,32 @@ const pipeProcessor = (schema, ctx, _json, params) => {
|
|
|
13927
13770
|
const def = schema._zod.def;
|
|
13928
13771
|
const inIsTransform = def.in._zod.traits.has("$ZodTransform");
|
|
13929
13772
|
const innerType = ctx.io === "input" ? (inIsTransform ? def.out : def.in) : def.out;
|
|
13930
|
-
|
|
13773
|
+
processSchema(innerType, ctx, params);
|
|
13931
13774
|
const seen = ctx.seen.get(schema);
|
|
13932
13775
|
seen.ref = innerType;
|
|
13933
13776
|
};
|
|
13934
13777
|
const readonlyProcessor = (schema, ctx, json, params) => {
|
|
13935
13778
|
const def = schema._zod.def;
|
|
13936
|
-
|
|
13779
|
+
processSchema(def.innerType, ctx, params);
|
|
13937
13780
|
const seen = ctx.seen.get(schema);
|
|
13938
13781
|
seen.ref = def.innerType;
|
|
13939
13782
|
json.readOnly = true;
|
|
13940
13783
|
};
|
|
13941
13784
|
const promiseProcessor = (schema, ctx, _json, params) => {
|
|
13942
13785
|
const def = schema._zod.def;
|
|
13943
|
-
|
|
13786
|
+
processSchema(def.innerType, ctx, params);
|
|
13944
13787
|
const seen = ctx.seen.get(schema);
|
|
13945
13788
|
seen.ref = def.innerType;
|
|
13946
13789
|
};
|
|
13947
13790
|
const optionalProcessor = (schema, ctx, _json, params) => {
|
|
13948
13791
|
const def = schema._zod.def;
|
|
13949
|
-
|
|
13792
|
+
processSchema(def.innerType, ctx, params);
|
|
13950
13793
|
const seen = ctx.seen.get(schema);
|
|
13951
13794
|
seen.ref = def.innerType;
|
|
13952
13795
|
};
|
|
13953
13796
|
const lazyProcessor = (schema, ctx, _json, params) => {
|
|
13954
13797
|
const innerType = schema._zod.innerType;
|
|
13955
|
-
|
|
13798
|
+
processSchema(innerType, ctx, params);
|
|
13956
13799
|
const seen = ctx.seen.get(schema);
|
|
13957
13800
|
seen.ref = innerType;
|
|
13958
13801
|
};
|
|
@@ -14007,7 +13850,7 @@ function toJSONSchema(input, params) {
|
|
|
14007
13850
|
// First pass: process all schemas to build the seen map
|
|
14008
13851
|
for (const entry of registry._idmap.entries()) {
|
|
14009
13852
|
const [_, schema] = entry;
|
|
14010
|
-
|
|
13853
|
+
processSchema(schema, ctx);
|
|
14011
13854
|
}
|
|
14012
13855
|
const schemas = {};
|
|
14013
13856
|
const external = {
|
|
@@ -14033,7 +13876,7 @@ function toJSONSchema(input, params) {
|
|
|
14033
13876
|
}
|
|
14034
13877
|
// Single schema case
|
|
14035
13878
|
const ctx = to_json_schema_initializeContext({ ...params, processors: allProcessors });
|
|
14036
|
-
|
|
13879
|
+
processSchema(input, ctx);
|
|
14037
13880
|
to_json_schema_extractDefs(ctx, input);
|
|
14038
13881
|
return to_json_schema_finalize(ctx, input);
|
|
14039
13882
|
}
|
|
@@ -14079,7 +13922,9 @@ const en_error = () => {
|
|
|
14079
13922
|
base64url: "base64url-encoded string",
|
|
14080
13923
|
json_string: "JSON string",
|
|
14081
13924
|
e164: "E.164 number",
|
|
13925
|
+
currency_code: "currency code",
|
|
14082
13926
|
credit_card: "credit card number",
|
|
13927
|
+
iban: "IBAN",
|
|
14083
13928
|
jwt: "JWT",
|
|
14084
13929
|
template_literal: "input",
|
|
14085
13930
|
};
|
|
@@ -14103,65 +13948,511 @@ const en_error = () => {
|
|
|
14103
13948
|
const received = getTypeName(receivedType, issue.input);
|
|
14104
13949
|
return `Invalid input: expected ${expected}, received ${received}`;
|
|
14105
13950
|
}
|
|
14106
|
-
case "invalid_value":
|
|
14107
|
-
if (issue.values.length === 1)
|
|
14108
|
-
return `Invalid input: expected ${stringifyPrimitive(issue.values[0])}`;
|
|
14109
|
-
return `Invalid option: expected one of ${util_joinValues(issue.values, "|")}`;
|
|
14110
|
-
case "too_big": {
|
|
14111
|
-
const adj = issue.exact ? "exactly " : issue.inclusive ? "<=" : "<";
|
|
14112
|
-
const sizing = getSizing(issue.origin);
|
|
14113
|
-
if (sizing)
|
|
14114
|
-
return `Too big: expected ${issue.origin ?? "value"} to have ${adj}${issue.maximum.toString()} ${sizing.unit ?? "elements"}`;
|
|
14115
|
-
return `Too big: expected ${issue.origin ?? "value"} to be ${adj}${issue.maximum.toString()}`;
|
|
13951
|
+
case "invalid_value":
|
|
13952
|
+
if (issue.values.length === 1)
|
|
13953
|
+
return `Invalid input: expected ${stringifyPrimitive(issue.values[0])}`;
|
|
13954
|
+
return `Invalid option: expected one of ${util_joinValues(issue.values, "|")}`;
|
|
13955
|
+
case "too_big": {
|
|
13956
|
+
const adj = issue.exact ? "exactly " : issue.inclusive ? "<=" : "<";
|
|
13957
|
+
const sizing = getSizing(issue.origin);
|
|
13958
|
+
if (sizing)
|
|
13959
|
+
return `Too big: expected ${issue.origin ?? "value"} to have ${adj}${issue.maximum.toString()} ${sizing.unit ?? "elements"}`;
|
|
13960
|
+
return `Too big: expected ${issue.origin ?? "value"} to be ${adj}${issue.maximum.toString()}`;
|
|
13961
|
+
}
|
|
13962
|
+
case "too_small": {
|
|
13963
|
+
const adj = issue.exact ? "exactly " : issue.inclusive ? ">=" : ">";
|
|
13964
|
+
const sizing = getSizing(issue.origin);
|
|
13965
|
+
if (sizing) {
|
|
13966
|
+
return `Too small: expected ${issue.origin} to have ${adj}${issue.minimum.toString()} ${sizing.unit}`;
|
|
13967
|
+
}
|
|
13968
|
+
return `Too small: expected ${issue.origin} to be ${adj}${issue.minimum.toString()}`;
|
|
13969
|
+
}
|
|
13970
|
+
case "invalid_format": {
|
|
13971
|
+
const _issue = issue;
|
|
13972
|
+
if (_issue.format === "starts_with") {
|
|
13973
|
+
return `Invalid string: must start with "${_issue.prefix}"`;
|
|
13974
|
+
}
|
|
13975
|
+
if (_issue.format === "ends_with")
|
|
13976
|
+
return `Invalid string: must end with "${_issue.suffix}"`;
|
|
13977
|
+
if (_issue.format === "includes")
|
|
13978
|
+
return `Invalid string: must include "${_issue.includes}"`;
|
|
13979
|
+
if (_issue.format === "regex")
|
|
13980
|
+
return `Invalid string: must match pattern ${_issue.pattern}`;
|
|
13981
|
+
return `Invalid ${FormatDictionary[_issue.format] ?? issue.format}`;
|
|
13982
|
+
}
|
|
13983
|
+
case "not_multiple_of":
|
|
13984
|
+
return `Invalid number: must be a multiple of ${issue.divisor}`;
|
|
13985
|
+
case "unrecognized_keys":
|
|
13986
|
+
return `Unrecognized key${issue.keys.length > 1 ? "s" : ""}: ${util_joinValues(issue.keys, ", ")}`;
|
|
13987
|
+
case "invalid_key":
|
|
13988
|
+
return `Invalid key in ${issue.origin}`;
|
|
13989
|
+
case "invalid_union":
|
|
13990
|
+
if (issue.options && Array.isArray(issue.options) && issue.options.length > 0) {
|
|
13991
|
+
const opts = issue.options.map((o) => `'${o}'`).join(" | ");
|
|
13992
|
+
return `Invalid discriminator value. Expected ${opts}`;
|
|
13993
|
+
}
|
|
13994
|
+
if (issue.inclusive === false) {
|
|
13995
|
+
return "Invalid input: more than one option matched";
|
|
13996
|
+
}
|
|
13997
|
+
return "Invalid input";
|
|
13998
|
+
case "invalid_element":
|
|
13999
|
+
return `Invalid value in ${issue.origin}`;
|
|
14000
|
+
default:
|
|
14001
|
+
return `Invalid input`;
|
|
14002
|
+
}
|
|
14003
|
+
};
|
|
14004
|
+
};
|
|
14005
|
+
/* export default */ function en() {
|
|
14006
|
+
return {
|
|
14007
|
+
localeError: en_error(),
|
|
14008
|
+
};
|
|
14009
|
+
}
|
|
14010
|
+
|
|
14011
|
+
;// CONCATENATED MODULE: ../../node_modules/zod/v4/core/errors.js
|
|
14012
|
+
|
|
14013
|
+
|
|
14014
|
+
/* Computing the message eagerly is expensive (pretty-printed JSON of all
|
|
14015
|
+
* issues), so defer it until first read. The accessor functions and
|
|
14016
|
+
* descriptors are shared across instances to keep error construction
|
|
14017
|
+
* cheap; the computed message is cached on the internals object. The
|
|
14018
|
+
* setter preserves plain assignment semantics for consumers that
|
|
14019
|
+
* overwrite `message`. */
|
|
14020
|
+
function _getMessage() {
|
|
14021
|
+
const internals = this._zod;
|
|
14022
|
+
internals.message ?? (internals.message = JSON.stringify(internals.def, jsonStringifyReplacer, 2));
|
|
14023
|
+
return internals.message;
|
|
14024
|
+
}
|
|
14025
|
+
function _setMessage(value) {
|
|
14026
|
+
this._zod.message = value;
|
|
14027
|
+
}
|
|
14028
|
+
const _messageDesc = {
|
|
14029
|
+
get: _getMessage,
|
|
14030
|
+
set: _setMessage,
|
|
14031
|
+
enumerable: true,
|
|
14032
|
+
configurable: true,
|
|
14033
|
+
};
|
|
14034
|
+
const _issuesDesc = { value: undefined, enumerable: false };
|
|
14035
|
+
/* Prototypes that already carry the lazy `toString`. Seeded with the
|
|
14036
|
+
* intrinsics so that `init` on a foreign object — it accepts any object —
|
|
14037
|
+
* can never install an accessor onto a prototype we do not own. */
|
|
14038
|
+
const _installedToString = /* @__PURE__ */ new WeakSet([Object.prototype, Error.prototype]);
|
|
14039
|
+
const errors_initializer = (inst, def) => {
|
|
14040
|
+
inst.name = "$ZodError";
|
|
14041
|
+
// `_zod` is already non-enumerable: $constructor's init defined it with this same descriptor
|
|
14042
|
+
_issuesDesc.value = def;
|
|
14043
|
+
Object.defineProperty(inst, "issues", _issuesDesc);
|
|
14044
|
+
// Clear the shared slot; a retained `value` pins the last error's issues.
|
|
14045
|
+
_issuesDesc.value = undefined;
|
|
14046
|
+
Object.defineProperty(inst, "message", _messageDesc);
|
|
14047
|
+
/* `toString` lives as a non-enumerable lazy getter on the shared
|
|
14048
|
+
* prototype; on first access it caches a per-instance closure so
|
|
14049
|
+
* detached usage still works. */
|
|
14050
|
+
const proto = Object.getPrototypeOf(inst);
|
|
14051
|
+
if (!_installedToString.has(proto)) {
|
|
14052
|
+
_installedToString.add(proto);
|
|
14053
|
+
Object.defineProperty(proto, "toString", {
|
|
14054
|
+
configurable: true,
|
|
14055
|
+
enumerable: false,
|
|
14056
|
+
get() {
|
|
14057
|
+
const value = () => this.message;
|
|
14058
|
+
Object.defineProperty(this, "toString", { value, configurable: true, writable: true });
|
|
14059
|
+
return value;
|
|
14060
|
+
},
|
|
14061
|
+
set(value) {
|
|
14062
|
+
Object.defineProperty(this, "toString", { value, configurable: true, writable: true });
|
|
14063
|
+
},
|
|
14064
|
+
});
|
|
14065
|
+
}
|
|
14066
|
+
};
|
|
14067
|
+
const $ZodError = $constructor("$ZodError", errors_initializer);
|
|
14068
|
+
const $ZodRealError = $constructor("$ZodError", errors_initializer, undefined, {
|
|
14069
|
+
Parent: Error,
|
|
14070
|
+
});
|
|
14071
|
+
/** Get-or-create `obj[key]` as an own data property. A path segment naming an inherited member
|
|
14072
|
+
* ("toString", "constructor") would otherwise read through to the prototype, and assigning
|
|
14073
|
+
* "__proto__" would hit the setter instead of creating a key. */
|
|
14074
|
+
function errors_node(obj, key, make) {
|
|
14075
|
+
if (!Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
14076
|
+
if (key === "__proto__") {
|
|
14077
|
+
Object.defineProperty(obj, key, { value: make(), writable: true, enumerable: true, configurable: true });
|
|
14078
|
+
}
|
|
14079
|
+
else {
|
|
14080
|
+
obj[key] = make();
|
|
14081
|
+
}
|
|
14082
|
+
}
|
|
14083
|
+
return obj[key];
|
|
14084
|
+
}
|
|
14085
|
+
function flattenError(error, mapper = (issue) => issue.message) {
|
|
14086
|
+
const fieldErrors = {};
|
|
14087
|
+
const formErrors = [];
|
|
14088
|
+
for (const sub of error.issues) {
|
|
14089
|
+
if (sub.path.length > 0) {
|
|
14090
|
+
errors_node(fieldErrors, sub.path[0], () => []).push(mapper(sub));
|
|
14091
|
+
}
|
|
14092
|
+
else {
|
|
14093
|
+
formErrors.push(mapper(sub));
|
|
14094
|
+
}
|
|
14095
|
+
}
|
|
14096
|
+
return { formErrors, fieldErrors };
|
|
14097
|
+
}
|
|
14098
|
+
function formatError(error, mapper = (issue) => issue.message) {
|
|
14099
|
+
const fieldErrors = { _errors: [] };
|
|
14100
|
+
const processError = (error, path = []) => {
|
|
14101
|
+
for (const issue of error.issues) {
|
|
14102
|
+
if (issue.code === "invalid_union" && issue.errors.length) {
|
|
14103
|
+
issue.errors.map((issues) => processError({ issues }, [...path, ...issue.path]));
|
|
14104
|
+
}
|
|
14105
|
+
else if (issue.code === "invalid_key") {
|
|
14106
|
+
processError({ issues: issue.issues }, [...path, ...issue.path]);
|
|
14107
|
+
}
|
|
14108
|
+
else if (issue.code === "invalid_element") {
|
|
14109
|
+
processError({ issues: issue.issues }, [...path, ...issue.path]);
|
|
14110
|
+
}
|
|
14111
|
+
else {
|
|
14112
|
+
const fullpath = [...path, ...issue.path];
|
|
14113
|
+
if (fullpath.length === 0) {
|
|
14114
|
+
fieldErrors._errors.push(mapper(issue));
|
|
14115
|
+
}
|
|
14116
|
+
else {
|
|
14117
|
+
let curr = fieldErrors;
|
|
14118
|
+
let i = 0;
|
|
14119
|
+
while (i < fullpath.length) {
|
|
14120
|
+
const el = fullpath[i];
|
|
14121
|
+
const terminal = i === fullpath.length - 1;
|
|
14122
|
+
// `_errors` is reserved by this legacy format, so merge a matching path segment into the current node instead of treating its array as a child.
|
|
14123
|
+
if (el === "_errors") {
|
|
14124
|
+
if (terminal)
|
|
14125
|
+
curr._errors.push(mapper(issue));
|
|
14126
|
+
i++;
|
|
14127
|
+
continue;
|
|
14128
|
+
}
|
|
14129
|
+
// A path element may collide with an inherited property name such as
|
|
14130
|
+
// "__proto__" or "constructor". Truthiness checks read the prototype
|
|
14131
|
+
// (so no node is created, then ._errors.push throws), and bracket
|
|
14132
|
+
// assignment of "__proto__" hits the setter instead of creating an
|
|
14133
|
+
// own key. Guard the read with hasOwnProperty and create the node
|
|
14134
|
+
// with defineProperty so any path element becomes a real own key.
|
|
14135
|
+
if (!Object.prototype.hasOwnProperty.call(curr, el)) {
|
|
14136
|
+
Object.defineProperty(curr, el, {
|
|
14137
|
+
value: { _errors: [] },
|
|
14138
|
+
enumerable: true,
|
|
14139
|
+
writable: true,
|
|
14140
|
+
configurable: true,
|
|
14141
|
+
});
|
|
14142
|
+
}
|
|
14143
|
+
const node = curr[el];
|
|
14144
|
+
if (terminal) {
|
|
14145
|
+
node._errors.push(mapper(issue));
|
|
14146
|
+
}
|
|
14147
|
+
curr = node;
|
|
14148
|
+
i++;
|
|
14149
|
+
}
|
|
14150
|
+
}
|
|
14151
|
+
}
|
|
14152
|
+
}
|
|
14153
|
+
};
|
|
14154
|
+
processError(error);
|
|
14155
|
+
return fieldErrors;
|
|
14156
|
+
}
|
|
14157
|
+
function treeifyError(error, mapper = (issue) => issue.message) {
|
|
14158
|
+
const result = { errors: [] };
|
|
14159
|
+
const processError = (error, path = []) => {
|
|
14160
|
+
var _a;
|
|
14161
|
+
for (const issue of error.issues) {
|
|
14162
|
+
if (issue.code === "invalid_union" && issue.errors.length) {
|
|
14163
|
+
// regular union error
|
|
14164
|
+
issue.errors.map((issues) => processError({ issues }, [...path, ...issue.path]));
|
|
14116
14165
|
}
|
|
14117
|
-
|
|
14118
|
-
|
|
14119
|
-
const sizing = getSizing(issue.origin);
|
|
14120
|
-
if (sizing) {
|
|
14121
|
-
return `Too small: expected ${issue.origin} to have ${adj}${issue.minimum.toString()} ${sizing.unit}`;
|
|
14122
|
-
}
|
|
14123
|
-
return `Too small: expected ${issue.origin} to be ${adj}${issue.minimum.toString()}`;
|
|
14166
|
+
else if (issue.code === "invalid_key") {
|
|
14167
|
+
processError({ issues: issue.issues }, [...path, ...issue.path]);
|
|
14124
14168
|
}
|
|
14125
|
-
|
|
14126
|
-
|
|
14127
|
-
if (_issue.format === "starts_with") {
|
|
14128
|
-
return `Invalid string: must start with "${_issue.prefix}"`;
|
|
14129
|
-
}
|
|
14130
|
-
if (_issue.format === "ends_with")
|
|
14131
|
-
return `Invalid string: must end with "${_issue.suffix}"`;
|
|
14132
|
-
if (_issue.format === "includes")
|
|
14133
|
-
return `Invalid string: must include "${_issue.includes}"`;
|
|
14134
|
-
if (_issue.format === "regex")
|
|
14135
|
-
return `Invalid string: must match pattern ${_issue.pattern}`;
|
|
14136
|
-
return `Invalid ${FormatDictionary[_issue.format] ?? issue.format}`;
|
|
14169
|
+
else if (issue.code === "invalid_element") {
|
|
14170
|
+
processError({ issues: issue.issues }, [...path, ...issue.path]);
|
|
14137
14171
|
}
|
|
14138
|
-
|
|
14139
|
-
|
|
14140
|
-
|
|
14141
|
-
|
|
14142
|
-
|
|
14143
|
-
return `Invalid key in ${issue.origin}`;
|
|
14144
|
-
case "invalid_union":
|
|
14145
|
-
if (issue.options && Array.isArray(issue.options) && issue.options.length > 0) {
|
|
14146
|
-
const opts = issue.options.map((o) => `'${o}'`).join(" | ");
|
|
14147
|
-
return `Invalid discriminator value. Expected ${opts}`;
|
|
14172
|
+
else {
|
|
14173
|
+
const fullpath = [...path, ...issue.path];
|
|
14174
|
+
if (fullpath.length === 0) {
|
|
14175
|
+
result.errors.push(mapper(issue));
|
|
14176
|
+
continue;
|
|
14148
14177
|
}
|
|
14149
|
-
|
|
14150
|
-
|
|
14178
|
+
let curr = result;
|
|
14179
|
+
let i = 0;
|
|
14180
|
+
while (i < fullpath.length) {
|
|
14181
|
+
const el = fullpath[i];
|
|
14182
|
+
const terminal = i === fullpath.length - 1;
|
|
14183
|
+
if (typeof el === "string") {
|
|
14184
|
+
curr.properties ?? (curr.properties = {});
|
|
14185
|
+
// el may collide with an inherited property name ("__proto__",
|
|
14186
|
+
// "constructor", ...); ??= reads the prototype so the node is never
|
|
14187
|
+
// created and curr.errors.push throws. Guard with hasOwnProperty and
|
|
14188
|
+
// create the node with defineProperty so "__proto__" becomes a real
|
|
14189
|
+
// own key rather than invoking the prototype setter.
|
|
14190
|
+
if (!Object.prototype.hasOwnProperty.call(curr.properties, el)) {
|
|
14191
|
+
Object.defineProperty(curr.properties, el, {
|
|
14192
|
+
value: { errors: [] },
|
|
14193
|
+
enumerable: true,
|
|
14194
|
+
writable: true,
|
|
14195
|
+
configurable: true,
|
|
14196
|
+
});
|
|
14197
|
+
}
|
|
14198
|
+
curr = curr.properties[el];
|
|
14199
|
+
}
|
|
14200
|
+
else {
|
|
14201
|
+
curr.items ?? (curr.items = []);
|
|
14202
|
+
(_a = curr.items)[el] ?? (_a[el] = { errors: [] });
|
|
14203
|
+
curr = curr.items[el];
|
|
14204
|
+
}
|
|
14205
|
+
if (terminal) {
|
|
14206
|
+
curr.errors.push(mapper(issue));
|
|
14207
|
+
}
|
|
14208
|
+
i++;
|
|
14151
14209
|
}
|
|
14152
|
-
|
|
14153
|
-
|
|
14154
|
-
|
|
14155
|
-
|
|
14156
|
-
|
|
14210
|
+
}
|
|
14211
|
+
}
|
|
14212
|
+
};
|
|
14213
|
+
processError(error);
|
|
14214
|
+
return result;
|
|
14215
|
+
}
|
|
14216
|
+
/** Format a ZodError as a human-readable string in the following form.
|
|
14217
|
+
*
|
|
14218
|
+
* From
|
|
14219
|
+
*
|
|
14220
|
+
* ```ts
|
|
14221
|
+
* ZodError {
|
|
14222
|
+
* issues: [
|
|
14223
|
+
* {
|
|
14224
|
+
* expected: 'string',
|
|
14225
|
+
* code: 'invalid_type',
|
|
14226
|
+
* path: [ 'username' ],
|
|
14227
|
+
* message: 'Invalid input: expected string'
|
|
14228
|
+
* },
|
|
14229
|
+
* {
|
|
14230
|
+
* expected: 'number',
|
|
14231
|
+
* code: 'invalid_type',
|
|
14232
|
+
* path: [ 'favoriteNumbers', 1 ],
|
|
14233
|
+
* message: 'Invalid input: expected number'
|
|
14234
|
+
* }
|
|
14235
|
+
* ];
|
|
14236
|
+
* }
|
|
14237
|
+
* ```
|
|
14238
|
+
*
|
|
14239
|
+
* to
|
|
14240
|
+
*
|
|
14241
|
+
* ```
|
|
14242
|
+
* username
|
|
14243
|
+
* ✖ Expected number, received string at "username
|
|
14244
|
+
* favoriteNumbers[0]
|
|
14245
|
+
* ✖ Invalid input: expected number
|
|
14246
|
+
* ```
|
|
14247
|
+
*/
|
|
14248
|
+
function toDotPath(_path) {
|
|
14249
|
+
const segs = [];
|
|
14250
|
+
const path = _path.map((seg) => (typeof seg === "object" ? seg.key : seg));
|
|
14251
|
+
for (const seg of path) {
|
|
14252
|
+
if (typeof seg === "number")
|
|
14253
|
+
segs.push(`[${seg}]`);
|
|
14254
|
+
else if (typeof seg === "symbol")
|
|
14255
|
+
segs.push(`[${JSON.stringify(String(seg))}]`);
|
|
14256
|
+
else if (/[^\w$]/.test(seg))
|
|
14257
|
+
segs.push(`[${JSON.stringify(seg)}]`);
|
|
14258
|
+
else {
|
|
14259
|
+
if (segs.length)
|
|
14260
|
+
segs.push(".");
|
|
14261
|
+
segs.push(seg);
|
|
14262
|
+
}
|
|
14263
|
+
}
|
|
14264
|
+
return segs.join("");
|
|
14265
|
+
}
|
|
14266
|
+
function prettifyError(error) {
|
|
14267
|
+
const lines = [];
|
|
14268
|
+
// sort by path length
|
|
14269
|
+
const issues = [...error.issues].sort((a, b) => (a.path ?? []).length - (b.path ?? []).length);
|
|
14270
|
+
// Process each issue
|
|
14271
|
+
for (const issue of issues) {
|
|
14272
|
+
lines.push(`✖ ${issue.message}`);
|
|
14273
|
+
if (issue.path?.length)
|
|
14274
|
+
lines.push(` → at ${toDotPath(issue.path)}`);
|
|
14275
|
+
}
|
|
14276
|
+
// Convert Map to formatted string
|
|
14277
|
+
return lines.join("\n");
|
|
14278
|
+
}
|
|
14279
|
+
|
|
14280
|
+
;// CONCATENATED MODULE: ../../node_modules/zod/v4/core/parse.js
|
|
14281
|
+
|
|
14282
|
+
|
|
14283
|
+
|
|
14284
|
+
// Always both keys, so the `_params` read site in `_parse` sees one object shape rather than two.
|
|
14285
|
+
function finalizeParams(callee, params) {
|
|
14286
|
+
return { callee: params?.callee ?? callee, Err: params?.Err };
|
|
14287
|
+
}
|
|
14288
|
+
const parse_parse = (_Err) => {
|
|
14289
|
+
const fn = (schema, value, _ctx, _params) => {
|
|
14290
|
+
const ctx = _ctx ? { ..._ctx, async: false } : { async: false };
|
|
14291
|
+
const result = schema._zod.run({ value, issues: [] }, ctx);
|
|
14292
|
+
if (result instanceof Promise) {
|
|
14293
|
+
throw new $ZodAsyncError();
|
|
14294
|
+
}
|
|
14295
|
+
if (result.issues.length) {
|
|
14296
|
+
const e = new (_params?.Err ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx, core_config())));
|
|
14297
|
+
captureStackTrace(e, _params?.callee ?? fn);
|
|
14298
|
+
throw e;
|
|
14157
14299
|
}
|
|
14300
|
+
return result.value;
|
|
14158
14301
|
};
|
|
14302
|
+
return fn;
|
|
14159
14303
|
};
|
|
14160
|
-
|
|
14304
|
+
const core_parse_parse = /* @__PURE__*/ parse_parse($ZodRealError);
|
|
14305
|
+
const parse_parseAsync = (_Err) => {
|
|
14306
|
+
const fn = async (schema, value, _ctx, params) => {
|
|
14307
|
+
const ctx = _ctx ? { ..._ctx, async: true } : { async: true };
|
|
14308
|
+
let result = schema._zod.run({ value, issues: [] }, ctx);
|
|
14309
|
+
if (result instanceof Promise)
|
|
14310
|
+
result = await result;
|
|
14311
|
+
if (result.issues.length) {
|
|
14312
|
+
const e = new (params?.Err ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx, core_config())));
|
|
14313
|
+
captureStackTrace(e, params?.callee ?? fn);
|
|
14314
|
+
throw e;
|
|
14315
|
+
}
|
|
14316
|
+
return result.value;
|
|
14317
|
+
};
|
|
14318
|
+
return fn;
|
|
14319
|
+
};
|
|
14320
|
+
const core_parse_parseAsync = /* @__PURE__*/ parse_parseAsync($ZodRealError);
|
|
14321
|
+
const _safeParse = (_Err) => (schema, value, _ctx) => {
|
|
14322
|
+
const ctx = _ctx ? { ..._ctx, async: false } : { async: false };
|
|
14323
|
+
const result = schema._zod.run({ value, issues: [] }, ctx);
|
|
14324
|
+
if (result instanceof Promise) {
|
|
14325
|
+
throw new $ZodAsyncError();
|
|
14326
|
+
}
|
|
14327
|
+
return result.issues.length ? parse_failure(_Err, result.issues, ctx) : { success: true, data: result.value };
|
|
14328
|
+
};
|
|
14329
|
+
const safeParse = /* @__PURE__*/ _safeParse($ZodRealError);
|
|
14330
|
+
// the error is built on the first read of `error`: finalizing the issues and constructing the instance is most of a failing parse, and a caller that only branches on `success` never pays it. a getter in the literal keeps this small; the alternative, one shared accessor descriptor plus a hidden state slot, reads ~15% faster but costs ~75 B gzipped in every bundle
|
|
14331
|
+
function parse_failure(Err, issues, ctx) {
|
|
14332
|
+
let error;
|
|
14161
14333
|
return {
|
|
14162
|
-
|
|
14334
|
+
success: false,
|
|
14335
|
+
get error() {
|
|
14336
|
+
if (!error) {
|
|
14337
|
+
error = new Err(issues.map((iss) => finalizeIssue(iss, ctx, core_config())));
|
|
14338
|
+
// finalizeIssue drops `input`, so the built error holds nothing; keeping the raw issues past this point pins the parsed value for the life of the result
|
|
14339
|
+
issues = undefined;
|
|
14340
|
+
ctx = undefined;
|
|
14341
|
+
}
|
|
14342
|
+
return error;
|
|
14343
|
+
},
|
|
14344
|
+
set error(e) {
|
|
14345
|
+
error = e;
|
|
14346
|
+
// a replacement makes the getter's branch unreachable, so the captures have to go here too
|
|
14347
|
+
issues = undefined;
|
|
14348
|
+
ctx = undefined;
|
|
14349
|
+
},
|
|
14163
14350
|
};
|
|
14164
14351
|
}
|
|
14352
|
+
const _safeParseAsync = (_Err) => async (schema, value, _ctx) => {
|
|
14353
|
+
const ctx = _ctx ? { ..._ctx, async: true } : { async: true };
|
|
14354
|
+
let result = schema._zod.run({ value, issues: [] }, ctx);
|
|
14355
|
+
if (result instanceof Promise)
|
|
14356
|
+
result = await result;
|
|
14357
|
+
return result.issues.length ? parse_failure(_Err, result.issues, ctx) : { success: true, data: result.value };
|
|
14358
|
+
};
|
|
14359
|
+
const safeParseAsync = /* @__PURE__*/ _safeParseAsync($ZodRealError);
|
|
14360
|
+
// registry mirrors of the compiler's sentinels, so this module never imports the compiler
|
|
14361
|
+
const COMPILE_INVALID = /* @__PURE__ */ Symbol.for("zod.compile.invalid");
|
|
14362
|
+
const COMPILE_FALLBACK = /* @__PURE__ */ Symbol.for("zod.compile.fallback");
|
|
14363
|
+
// Deliberately tiny, because v8 will not inline a body carrying the fallback's object literals and throw. Everything that is not the compiled happy path lives in validateFallback, and that split is worth ~35% on a compiled schema.
|
|
14364
|
+
const validate = ((schema, value, _ctx) => {
|
|
14365
|
+
const validator = schema._zod.bag.validator;
|
|
14366
|
+
if (validator !== undefined) {
|
|
14367
|
+
if (validator(value) !== COMPILE_INVALID)
|
|
14368
|
+
return true;
|
|
14369
|
+
// a definite sentinel means the runtime would reject, so skip the re-parse; a ctx can still change the answer
|
|
14370
|
+
if (validator.definite === true && _ctx === undefined)
|
|
14371
|
+
return false;
|
|
14372
|
+
}
|
|
14373
|
+
return validateFallback(schema, value, _ctx);
|
|
14374
|
+
});
|
|
14375
|
+
function validateFallback(schema, value, _ctx) {
|
|
14376
|
+
const ctx = _ctx
|
|
14377
|
+
? { ..._ctx, async: false, abortEarly: true }
|
|
14378
|
+
: { async: false, abortEarly: true };
|
|
14379
|
+
const fallbackRun = schema._zod.bag.fallbackRun;
|
|
14380
|
+
let result;
|
|
14381
|
+
if (fallbackRun) {
|
|
14382
|
+
// skip nested fast paths on the fallback, so user callbacks keep the at-most-twice bound
|
|
14383
|
+
ctx[COMPILE_FALLBACK] = true;
|
|
14384
|
+
result = fallbackRun({ value, issues: [] }, ctx);
|
|
14385
|
+
}
|
|
14386
|
+
else {
|
|
14387
|
+
result = schema._zod.run({ value, issues: [] }, ctx);
|
|
14388
|
+
}
|
|
14389
|
+
if (result instanceof Promise) {
|
|
14390
|
+
throw new $ZodAsyncError();
|
|
14391
|
+
}
|
|
14392
|
+
return result.issues.length === 0;
|
|
14393
|
+
}
|
|
14394
|
+
// no fast path: the compiler keeps async parses on the runtime, because a promise-returning callback that is not declared async compiles to a throw
|
|
14395
|
+
const parse_validateAsync = async (schema, value, _ctx) => {
|
|
14396
|
+
const ctx = _ctx
|
|
14397
|
+
? { ..._ctx, async: true, abortEarly: true }
|
|
14398
|
+
: { async: true, abortEarly: true };
|
|
14399
|
+
let result = schema._zod.run({ value, issues: [] }, ctx);
|
|
14400
|
+
if (result instanceof Promise)
|
|
14401
|
+
result = await result;
|
|
14402
|
+
return result.issues.length === 0;
|
|
14403
|
+
};
|
|
14404
|
+
const parse_encode = (_Err) => {
|
|
14405
|
+
const parse = parse_parse(_Err);
|
|
14406
|
+
const fn = (schema, value, _ctx, _params) => {
|
|
14407
|
+
const ctx = _ctx ? { ..._ctx, direction: "backward" } : { direction: "backward" };
|
|
14408
|
+
return parse(schema, value, ctx, finalizeParams(fn, _params));
|
|
14409
|
+
};
|
|
14410
|
+
return fn;
|
|
14411
|
+
};
|
|
14412
|
+
const encode = /* @__PURE__*/ parse_encode($ZodRealError);
|
|
14413
|
+
const parse_decode = (_Err) => {
|
|
14414
|
+
const parse = parse_parse(_Err);
|
|
14415
|
+
const fn = (schema, value, _ctx, _params) => {
|
|
14416
|
+
return parse(schema, value, _ctx, finalizeParams(fn, _params));
|
|
14417
|
+
};
|
|
14418
|
+
return fn;
|
|
14419
|
+
};
|
|
14420
|
+
const decode = /* @__PURE__*/ parse_decode($ZodRealError);
|
|
14421
|
+
const parse_encodeAsync = (_Err) => {
|
|
14422
|
+
const parseAsync = parse_parseAsync(_Err);
|
|
14423
|
+
const fn = async (schema, value, _ctx, _params) => {
|
|
14424
|
+
const ctx = _ctx ? { ..._ctx, direction: "backward" } : { direction: "backward" };
|
|
14425
|
+
return (await parseAsync(schema, value, ctx, finalizeParams(fn, _params)));
|
|
14426
|
+
};
|
|
14427
|
+
return fn;
|
|
14428
|
+
};
|
|
14429
|
+
const encodeAsync = /* @__PURE__*/ parse_encodeAsync($ZodRealError);
|
|
14430
|
+
const parse_decodeAsync = (_Err) => {
|
|
14431
|
+
const parseAsync = parse_parseAsync(_Err);
|
|
14432
|
+
const fn = async (schema, value, _ctx, _params) => {
|
|
14433
|
+
return await parseAsync(schema, value, _ctx, finalizeParams(fn, _params));
|
|
14434
|
+
};
|
|
14435
|
+
return fn;
|
|
14436
|
+
};
|
|
14437
|
+
const decodeAsync = /* @__PURE__*/ parse_decodeAsync($ZodRealError);
|
|
14438
|
+
const _safeEncode = (_Err) => (schema, value, _ctx) => {
|
|
14439
|
+
const ctx = _ctx ? { ..._ctx, direction: "backward" } : { direction: "backward" };
|
|
14440
|
+
return _safeParse(_Err)(schema, value, ctx);
|
|
14441
|
+
};
|
|
14442
|
+
const safeEncode = /* @__PURE__*/ _safeEncode($ZodRealError);
|
|
14443
|
+
const _safeDecode = (_Err) => (schema, value, _ctx) => {
|
|
14444
|
+
return _safeParse(_Err)(schema, value, _ctx);
|
|
14445
|
+
};
|
|
14446
|
+
const safeDecode = /* @__PURE__*/ _safeDecode($ZodRealError);
|
|
14447
|
+
const _safeEncodeAsync = (_Err) => async (schema, value, _ctx) => {
|
|
14448
|
+
const ctx = _ctx ? { ..._ctx, direction: "backward" } : { direction: "backward" };
|
|
14449
|
+
return _safeParseAsync(_Err)(schema, value, ctx);
|
|
14450
|
+
};
|
|
14451
|
+
const safeEncodeAsync = /* @__PURE__*/ _safeEncodeAsync($ZodRealError);
|
|
14452
|
+
const _safeDecodeAsync = (_Err) => async (schema, value, _ctx) => {
|
|
14453
|
+
return _safeParseAsync(_Err)(schema, value, _ctx);
|
|
14454
|
+
};
|
|
14455
|
+
const safeDecodeAsync = /* @__PURE__*/ _safeDecodeAsync($ZodRealError);
|
|
14165
14456
|
|
|
14166
14457
|
;// CONCATENATED MODULE: ../../node_modules/zod/v4/classic/errors.js
|
|
14167
14458
|
|
|
@@ -14248,6 +14539,7 @@ const parse_safeDecodeAsync = /* @__PURE__ */ _safeDecodeAsync(ZodRealError);
|
|
|
14248
14539
|
|
|
14249
14540
|
|
|
14250
14541
|
|
|
14542
|
+
|
|
14251
14543
|
// Register English as the default locale on first ZodType construction. Hooked into the `ZodType` `$constructor` (rather than a top-level `config(en())` in `external.ts`) so bundlers honoring `sideEffects: false` can't tree-shake it out — see #5953, #5725. An explicit `z.config(z.locales.xx())` call wins regardless of order, since this only sets the default when none is present.
|
|
14252
14544
|
function _ensureDefaultLocale() {
|
|
14253
14545
|
if (!globalConfig.localeError)
|
|
@@ -14392,6 +14684,12 @@ const ZodType = /*@__PURE__*/ $constructor("ZodType", (inst, def) => {
|
|
|
14392
14684
|
set spa(value) {
|
|
14393
14685
|
util_own(this, "spa", value);
|
|
14394
14686
|
},
|
|
14687
|
+
validate(data, params) {
|
|
14688
|
+
return validate(this, data, params);
|
|
14689
|
+
},
|
|
14690
|
+
validateAsync(data, params) {
|
|
14691
|
+
return parse_validateAsync(this, data, params);
|
|
14692
|
+
},
|
|
14395
14693
|
encode: function _encode(data, params) {
|
|
14396
14694
|
return classic_parse_encode(this, data, params, { callee: _encode });
|
|
14397
14695
|
},
|
|
@@ -14433,10 +14731,11 @@ const _ZodString = /*@__PURE__*/ $constructor("_ZodString", (inst, def) => {
|
|
|
14433
14731
|
$ZodString.init(inst, def);
|
|
14434
14732
|
ZodType.init(inst, def);
|
|
14435
14733
|
inst._zod.processJSONSchema = (ctx, json, params) => stringProcessor(inst, ctx, json, params);
|
|
14436
|
-
|
|
14437
|
-
|
|
14438
|
-
inst
|
|
14439
|
-
inst
|
|
14734
|
+
},
|
|
14735
|
+
/*@__PURE__*/ derived({
|
|
14736
|
+
format: (inst) => aggregateChecks(inst).format ?? null,
|
|
14737
|
+
minLength: (inst) => aggregateChecks(inst).minimum ?? null,
|
|
14738
|
+
maxLength: (inst) => aggregateChecks(inst).maximum ?? null,
|
|
14440
14739
|
}, {
|
|
14441
14740
|
regex(...args) {
|
|
14442
14741
|
return this.check(_regex(...args));
|
|
@@ -14483,7 +14782,7 @@ const _ZodString = /*@__PURE__*/ $constructor("_ZodString", (inst, def) => {
|
|
|
14483
14782
|
slugify() {
|
|
14484
14783
|
return this.check(_slugify());
|
|
14485
14784
|
},
|
|
14486
|
-
});
|
|
14785
|
+
}));
|
|
14487
14786
|
const ZodString = /*@__PURE__*/ $constructor("ZodString", (inst, def) => {
|
|
14488
14787
|
$ZodString.init(inst, def);
|
|
14489
14788
|
_ZodString.init(inst, def);
|
|
@@ -14635,8 +14934,8 @@ function schemas_url(params) {
|
|
|
14635
14934
|
}
|
|
14636
14935
|
function httpUrl(params) {
|
|
14637
14936
|
return core._url(ZodURL, {
|
|
14638
|
-
protocol:
|
|
14639
|
-
hostname:
|
|
14937
|
+
protocol: regexes.httpProtocol,
|
|
14938
|
+
hostname: regexes.domain,
|
|
14640
14939
|
...util.normalizeParams(params),
|
|
14641
14940
|
});
|
|
14642
14941
|
}
|
|
@@ -14777,6 +15076,13 @@ const ZodCreditCard = /*@__PURE__*/ (/* unused pure expression or super */ null
|
|
|
14777
15076
|
function schemas_creditCard(params) {
|
|
14778
15077
|
return core._creditCard(ZodCreditCard, params);
|
|
14779
15078
|
}
|
|
15079
|
+
const ZodIBAN = /*@__PURE__*/ (/* unused pure expression or super */ null && (core.$constructor("ZodIBAN", (inst, def) => {
|
|
15080
|
+
core.$ZodIBAN.init(inst, def);
|
|
15081
|
+
ZodStringFormat.init(inst, def);
|
|
15082
|
+
})));
|
|
15083
|
+
function schemas_iban(params) {
|
|
15084
|
+
return core._iban(ZodIBAN, params);
|
|
15085
|
+
}
|
|
14780
15086
|
const ZodJWT = /*@__PURE__*/ $constructor("ZodJWT", (inst, def) => {
|
|
14781
15087
|
// ZodStringFormat.init(inst, def);
|
|
14782
15088
|
$ZodJWT.init(inst, def);
|
|
@@ -14794,10 +15100,13 @@ function stringFormat(format, fnOrRegex, _params = {}) {
|
|
|
14794
15100
|
return core._stringFormat(ZodCustomStringFormat, format, fnOrRegex, _params);
|
|
14795
15101
|
}
|
|
14796
15102
|
function schemas_hostname(_params) {
|
|
14797
|
-
return core._stringFormat(ZodCustomStringFormat, "hostname",
|
|
15103
|
+
return core._stringFormat(ZodCustomStringFormat, "hostname", regexes.hostname, _params);
|
|
14798
15104
|
}
|
|
14799
15105
|
function schemas_hex(_params) {
|
|
14800
|
-
return core._stringFormat(ZodCustomStringFormat, "hex",
|
|
15106
|
+
return core._stringFormat(ZodCustomStringFormat, "hex", regexes.hex, _params);
|
|
15107
|
+
}
|
|
15108
|
+
function schemas_currencyCode(_params) {
|
|
15109
|
+
return core._stringFormat(ZodCustomStringFormat, "currency_code", regexes.currencyCode, _params);
|
|
14801
15110
|
}
|
|
14802
15111
|
function schemas_hash(alg, params) {
|
|
14803
15112
|
const enc = params?.enc ?? "hex";
|
|
@@ -14811,14 +15120,22 @@ const ZodNumber = /*@__PURE__*/ $constructor("ZodNumber", (inst, def) => {
|
|
|
14811
15120
|
$ZodNumber.init(inst, def);
|
|
14812
15121
|
ZodType.init(inst, def);
|
|
14813
15122
|
inst._zod.processJSONSchema = (ctx, json, params) => numberProcessor(inst, ctx, json, params);
|
|
14814
|
-
const bag = inst._zod.bag;
|
|
14815
|
-
inst.minValue =
|
|
14816
|
-
Math.max(bag.minimum ?? Number.NEGATIVE_INFINITY, bag.exclusiveMinimum ?? Number.NEGATIVE_INFINITY) ?? null;
|
|
14817
|
-
inst.maxValue =
|
|
14818
|
-
Math.min(bag.maximum ?? Number.POSITIVE_INFINITY, bag.exclusiveMaximum ?? Number.POSITIVE_INFINITY) ?? null;
|
|
14819
|
-
inst.isInt = (bag.format ?? "").includes("int") || Number.isSafeInteger(bag.multipleOf ?? 0.5);
|
|
14820
15123
|
inst.isFinite = true;
|
|
14821
|
-
|
|
15124
|
+
},
|
|
15125
|
+
/*@__PURE__*/ derived({
|
|
15126
|
+
minValue: (inst) => {
|
|
15127
|
+
const { minimum, exclusiveMinimum } = aggregateChecks(inst);
|
|
15128
|
+
return Math.max(minimum ?? Number.NEGATIVE_INFINITY, exclusiveMinimum ?? Number.NEGATIVE_INFINITY);
|
|
15129
|
+
},
|
|
15130
|
+
maxValue: (inst) => {
|
|
15131
|
+
const { maximum, exclusiveMaximum } = aggregateChecks(inst);
|
|
15132
|
+
return Math.min(maximum ?? Number.POSITIVE_INFINITY, exclusiveMaximum ?? Number.POSITIVE_INFINITY);
|
|
15133
|
+
},
|
|
15134
|
+
isInt: (inst) => {
|
|
15135
|
+
const { isInt, multipleOf } = aggregateChecks(inst);
|
|
15136
|
+
return !!isInt || !!multipleOf?.some(Number.isSafeInteger);
|
|
15137
|
+
},
|
|
15138
|
+
format: (inst) => aggregateChecks(inst).format ?? null,
|
|
14822
15139
|
}, {
|
|
14823
15140
|
gt(value, params) {
|
|
14824
15141
|
return this.check(_gt(value, params));
|
|
@@ -14865,7 +15182,7 @@ const ZodNumber = /*@__PURE__*/ $constructor("ZodNumber", (inst, def) => {
|
|
|
14865
15182
|
finite() {
|
|
14866
15183
|
return this;
|
|
14867
15184
|
},
|
|
14868
|
-
});
|
|
15185
|
+
}));
|
|
14869
15186
|
function schemas_number(params) {
|
|
14870
15187
|
return _number(ZodNumber, params);
|
|
14871
15188
|
}
|
|
@@ -14900,10 +15217,11 @@ const ZodBigInt = /*@__PURE__*/ (/* unused pure expression or super */ null && (
|
|
|
14900
15217
|
core.$ZodBigInt.init(inst, def);
|
|
14901
15218
|
ZodType.init(inst, def);
|
|
14902
15219
|
inst._zod.processJSONSchema = (ctx, json, params) => processors.bigintProcessor(inst, ctx, json, params);
|
|
14903
|
-
|
|
14904
|
-
|
|
14905
|
-
inst
|
|
14906
|
-
inst
|
|
15220
|
+
},
|
|
15221
|
+
/*@__PURE__*/ util.derived({
|
|
15222
|
+
minValue: (inst) => processors.aggregateChecks(inst).minimum ?? null,
|
|
15223
|
+
maxValue: (inst) => processors.aggregateChecks(inst).maximum ?? null,
|
|
15224
|
+
format: (inst) => processors.aggregateChecks(inst).format ?? null,
|
|
14907
15225
|
}, {
|
|
14908
15226
|
gte(value, params) {
|
|
14909
15227
|
return this.check(checks.gte(value, params));
|
|
@@ -14938,7 +15256,7 @@ const ZodBigInt = /*@__PURE__*/ (/* unused pure expression or super */ null && (
|
|
|
14938
15256
|
multipleOf(value, params) {
|
|
14939
15257
|
return this.check(checks.multipleOf(value, params));
|
|
14940
15258
|
},
|
|
14941
|
-
})));
|
|
15259
|
+
}))));
|
|
14942
15260
|
function schemas_bigint(params) {
|
|
14943
15261
|
return core._bigint(ZodBigInt, params);
|
|
14944
15262
|
}
|
|
@@ -15017,10 +15335,17 @@ const ZodDate = /*@__PURE__*/ (/* unused pure expression or super */ null && (co
|
|
|
15017
15335
|
inst._zod.processJSONSchema = (ctx, json, params) => processors.dateProcessor(inst, ctx, json, params);
|
|
15018
15336
|
inst.min = (value, params) => inst.check(checks.gte(value, params));
|
|
15019
15337
|
inst.max = (value, params) => inst.check(checks.lte(value, params));
|
|
15020
|
-
|
|
15021
|
-
|
|
15022
|
-
|
|
15023
|
-
})
|
|
15338
|
+
},
|
|
15339
|
+
/*@__PURE__*/ util.derived({
|
|
15340
|
+
minDate: (inst) => {
|
|
15341
|
+
const { minimum } = processors.aggregateChecks(inst);
|
|
15342
|
+
return minimum ? new Date(minimum) : null;
|
|
15343
|
+
},
|
|
15344
|
+
maxDate: (inst) => {
|
|
15345
|
+
const { maximum } = processors.aggregateChecks(inst);
|
|
15346
|
+
return maximum ? new Date(maximum) : null;
|
|
15347
|
+
},
|
|
15348
|
+
}, {}))));
|
|
15024
15349
|
function schemas_date(params) {
|
|
15025
15350
|
return core._date(ZodDate, params);
|
|
15026
15351
|
}
|
|
@@ -15066,19 +15391,20 @@ const ZodObject = /*@__PURE__*/ $constructor("ZodObject", (inst, def) => {
|
|
|
15066
15391
|
return schemas_enum(Object.keys(this._zod.def.shape));
|
|
15067
15392
|
},
|
|
15068
15393
|
catchall(catchall) {
|
|
15069
|
-
|
|
15394
|
+
// `mergeDefs` rather than a spread: spreading reads `shape`, and resolving it can mint a whole fresh subtree
|
|
15395
|
+
return this.clone(mergeDefs(this._zod.def, { catchall: catchall }));
|
|
15070
15396
|
},
|
|
15071
15397
|
passthrough() {
|
|
15072
|
-
return this.clone(
|
|
15398
|
+
return this.clone(mergeDefs(this._zod.def, { catchall: schemas_unknown() }));
|
|
15073
15399
|
},
|
|
15074
15400
|
loose() {
|
|
15075
|
-
return this.clone(
|
|
15401
|
+
return this.clone(mergeDefs(this._zod.def, { catchall: schemas_unknown() }));
|
|
15076
15402
|
},
|
|
15077
15403
|
strict() {
|
|
15078
|
-
return this.clone(
|
|
15404
|
+
return this.clone(mergeDefs(this._zod.def, { catchall: never() }));
|
|
15079
15405
|
},
|
|
15080
15406
|
strip() {
|
|
15081
|
-
return this.clone(
|
|
15407
|
+
return this.clone(mergeDefs(this._zod.def, { catchall: undefined }));
|
|
15082
15408
|
},
|
|
15083
15409
|
extend(incoming) {
|
|
15084
15410
|
return extend(this, incoming);
|
|
@@ -15087,7 +15413,7 @@ const ZodObject = /*@__PURE__*/ $constructor("ZodObject", (inst, def) => {
|
|
|
15087
15413
|
return safeExtend(this, incoming);
|
|
15088
15414
|
},
|
|
15089
15415
|
merge(other) {
|
|
15090
|
-
return
|
|
15416
|
+
return util_merge(this, other);
|
|
15091
15417
|
},
|
|
15092
15418
|
pick(mask) {
|
|
15093
15419
|
return pick(this, mask);
|
|
@@ -15306,7 +15632,8 @@ const ZodEnum = /*@__PURE__*/ $constructor("ZodEnum", (inst, def) => {
|
|
|
15306
15632
|
ZodType.init(inst, def);
|
|
15307
15633
|
inst._zod.processJSONSchema = (ctx, json, params) => enumProcessor(inst, ctx, json, params);
|
|
15308
15634
|
inst.enum = def.entries;
|
|
15309
|
-
|
|
15635
|
+
// reuse the parsed value set so a numeric TS enum's reverse-mapping keys stay out
|
|
15636
|
+
inst.options = [...inst._zod.values];
|
|
15310
15637
|
const keys = new Set(Object.keys(def.entries));
|
|
15311
15638
|
inst.extract = (values, params) => {
|
|
15312
15639
|
const newEntries = {};
|
|
@@ -15688,8 +16015,16 @@ function superRefine(fn, params) {
|
|
|
15688
16015
|
// Re-export describe and meta from core
|
|
15689
16016
|
const schemas_describe = describe;
|
|
15690
16017
|
const schemas_meta = api_meta;
|
|
16018
|
+
const ZodInstanceOf = /*@__PURE__*/ (/* unused pure expression or super */ null && (core.$constructor("ZodInstanceOf", (inst, def) => {
|
|
16019
|
+
ZodCustom.init(inst, def);
|
|
16020
|
+
}, {
|
|
16021
|
+
properties(shape, params) {
|
|
16022
|
+
// asserts in place, so the narrowed output type is truthful without a wrapper
|
|
16023
|
+
return this.check(core._properties(shape, params));
|
|
16024
|
+
},
|
|
16025
|
+
})));
|
|
15691
16026
|
function _instanceof(cls, params = {}) {
|
|
15692
|
-
const inst = new
|
|
16027
|
+
const inst = new ZodInstanceOf({
|
|
15693
16028
|
type: "custom",
|
|
15694
16029
|
check: "custom",
|
|
15695
16030
|
fn: (data) => data instanceof cls,
|
|
@@ -18328,7 +18663,7 @@ function getErrorMap() {
|
|
|
18328
18663
|
var errorUtil_errorUtil;
|
|
18329
18664
|
(function (errorUtil) {
|
|
18330
18665
|
errorUtil.errToObj = (message) => typeof message === "string" ? { message } : message || {};
|
|
18331
|
-
// biome-ignore lint:
|
|
18666
|
+
// biome-ignore lint/suspicious/noShadowRestrictedNames: renaming churns 31 v3 call sites
|
|
18332
18667
|
errorUtil.toString = (message) => typeof message === "string" ? message : message?.message;
|
|
18333
18668
|
})(errorUtil_errorUtil || (errorUtil_errorUtil = {}));
|
|
18334
18669
|
|
|
@@ -22146,6 +22481,7 @@ const types_NEVER = (/* unused pure expression or super */ null && (INVALID));
|
|
|
22146
22481
|
|
|
22147
22482
|
|
|
22148
22483
|
|
|
22484
|
+
|
|
22149
22485
|
const ZodMiniType = /*@__PURE__*/ $constructor("ZodMiniType", (inst, def) => {
|
|
22150
22486
|
if (!inst._zod)
|
|
22151
22487
|
throw new Error("Uninitialized schema in ZodMiniType.");
|
|
@@ -22257,8 +22593,8 @@ function mini_schemas_url(params) {
|
|
|
22257
22593
|
// @__NO_SIDE_EFFECTS__
|
|
22258
22594
|
function schemas_httpUrl(params) {
|
|
22259
22595
|
return core._url(ZodMiniURL, {
|
|
22260
|
-
protocol:
|
|
22261
|
-
hostname:
|
|
22596
|
+
protocol: regexes.httpProtocol,
|
|
22597
|
+
hostname: regexes.domain,
|
|
22262
22598
|
...util.normalizeParams(params),
|
|
22263
22599
|
});
|
|
22264
22600
|
}
|
|
@@ -22402,6 +22738,14 @@ const ZodMiniCreditCard = /*@__PURE__*/ (/* unused pure expression or super */ n
|
|
|
22402
22738
|
function mini_schemas_creditCard(params) {
|
|
22403
22739
|
return core._creditCard(ZodMiniCreditCard, params);
|
|
22404
22740
|
}
|
|
22741
|
+
const ZodMiniIBAN = /*@__PURE__*/ (/* unused pure expression or super */ null && (core.$constructor("ZodMiniIBAN", (inst, def) => {
|
|
22742
|
+
core.$ZodIBAN.init(inst, def);
|
|
22743
|
+
ZodMiniStringFormat.init(inst, def);
|
|
22744
|
+
})));
|
|
22745
|
+
// @__NO_SIDE_EFFECTS__
|
|
22746
|
+
function mini_schemas_iban(params) {
|
|
22747
|
+
return core._iban(ZodMiniIBAN, params);
|
|
22748
|
+
}
|
|
22405
22749
|
const ZodMiniJWT = /*@__PURE__*/ (/* unused pure expression or super */ null && (core.$constructor("ZodMiniJWT", (inst, def) => {
|
|
22406
22750
|
core.$ZodJWT.init(inst, def);
|
|
22407
22751
|
ZodMiniStringFormat.init(inst, def);
|
|
@@ -22420,11 +22764,15 @@ function schemas_stringFormat(format, fnOrRegex, _params = {}) {
|
|
|
22420
22764
|
}
|
|
22421
22765
|
// @__NO_SIDE_EFFECTS__
|
|
22422
22766
|
function mini_schemas_hostname(_params) {
|
|
22423
|
-
return core._stringFormat(ZodMiniCustomStringFormat, "hostname",
|
|
22767
|
+
return core._stringFormat(ZodMiniCustomStringFormat, "hostname", regexes.hostname, _params);
|
|
22424
22768
|
}
|
|
22425
22769
|
// @__NO_SIDE_EFFECTS__
|
|
22426
22770
|
function mini_schemas_hex(_params) {
|
|
22427
|
-
return core._stringFormat(ZodMiniCustomStringFormat, "hex",
|
|
22771
|
+
return core._stringFormat(ZodMiniCustomStringFormat, "hex", regexes.hex, _params);
|
|
22772
|
+
}
|
|
22773
|
+
// @__NO_SIDE_EFFECTS__
|
|
22774
|
+
function mini_schemas_currencyCode(_params) {
|
|
22775
|
+
return core._stringFormat(ZodMiniCustomStringFormat, "currency_code", regexes.currencyCode, _params);
|
|
22428
22776
|
}
|
|
22429
22777
|
// @__NO_SIDE_EFFECTS__
|
|
22430
22778
|
function mini_schemas_hash(alg, params) {
|
|
@@ -22656,7 +23004,8 @@ function schemas_required(schema, mask) {
|
|
|
22656
23004
|
}
|
|
22657
23005
|
// @__NO_SIDE_EFFECTS__
|
|
22658
23006
|
function schemas_catchall(inst, catchall) {
|
|
22659
|
-
|
|
23007
|
+
// `mergeDefs` rather than a spread: spreading reads `shape`, and resolving it can mint a whole fresh subtree
|
|
23008
|
+
return inst.clone(util.mergeDefs(inst._zod.def, { catchall: catchall }));
|
|
22660
23009
|
}
|
|
22661
23010
|
const ZodMiniUnion = /*@__PURE__*/ (/* unused pure expression or super */ null && (core.$constructor("ZodMiniUnion", (inst, def) => {
|
|
22662
23011
|
core.$ZodUnion.init(inst, def);
|
|
@@ -22795,7 +23144,8 @@ function mini_schemas_set(valueType, params) {
|
|
|
22795
23144
|
const ZodMiniEnum = /*@__PURE__*/ (/* unused pure expression or super */ null && (core.$constructor("ZodMiniEnum", (inst, def) => {
|
|
22796
23145
|
core.$ZodEnum.init(inst, def);
|
|
22797
23146
|
ZodMiniType.init(inst, def);
|
|
22798
|
-
|
|
23147
|
+
// reuse the parsed value set so a numeric TS enum's reverse-mapping keys stay out
|
|
23148
|
+
inst.options = [...inst._zod.values];
|
|
22799
23149
|
})));
|
|
22800
23150
|
// @__NO_SIDE_EFFECTS__
|
|
22801
23151
|
function mini_schemas_enum(values, params) {
|
|
@@ -23825,7 +24175,7 @@ function parseStringDef(def, refs) {
|
|
|
23825
24175
|
addFormat(res, "idn-email", check.message, refs);
|
|
23826
24176
|
break;
|
|
23827
24177
|
case "pattern:zod":
|
|
23828
|
-
|
|
24178
|
+
string_addPattern(res, zodPatterns.email, check.message, refs);
|
|
23829
24179
|
break;
|
|
23830
24180
|
}
|
|
23831
24181
|
break;
|
|
@@ -23836,19 +24186,19 @@ function parseStringDef(def, refs) {
|
|
|
23836
24186
|
addFormat(res, "uuid", check.message, refs);
|
|
23837
24187
|
break;
|
|
23838
24188
|
case "regex":
|
|
23839
|
-
|
|
24189
|
+
string_addPattern(res, check.regex, check.message, refs);
|
|
23840
24190
|
break;
|
|
23841
24191
|
case "cuid":
|
|
23842
|
-
|
|
24192
|
+
string_addPattern(res, zodPatterns.cuid, check.message, refs);
|
|
23843
24193
|
break;
|
|
23844
24194
|
case "cuid2":
|
|
23845
|
-
|
|
24195
|
+
string_addPattern(res, zodPatterns.cuid2, check.message, refs);
|
|
23846
24196
|
break;
|
|
23847
24197
|
case "startsWith":
|
|
23848
|
-
|
|
24198
|
+
string_addPattern(res, RegExp(`^${escapeLiteralCheckValue(check.value, refs)}`), check.message, refs);
|
|
23849
24199
|
break;
|
|
23850
24200
|
case "endsWith":
|
|
23851
|
-
|
|
24201
|
+
string_addPattern(res, RegExp(`${escapeLiteralCheckValue(check.value, refs)}$`), check.message, refs);
|
|
23852
24202
|
break;
|
|
23853
24203
|
case "datetime":
|
|
23854
24204
|
addFormat(res, "date-time", check.message, refs);
|
|
@@ -23871,7 +24221,7 @@ function parseStringDef(def, refs) {
|
|
|
23871
24221
|
: check.value, check.message, refs);
|
|
23872
24222
|
break;
|
|
23873
24223
|
case "includes": {
|
|
23874
|
-
|
|
24224
|
+
string_addPattern(res, RegExp(escapeLiteralCheckValue(check.value, refs)), check.message, refs);
|
|
23875
24225
|
break;
|
|
23876
24226
|
}
|
|
23877
24227
|
case "ip": {
|
|
@@ -23884,25 +24234,25 @@ function parseStringDef(def, refs) {
|
|
|
23884
24234
|
break;
|
|
23885
24235
|
}
|
|
23886
24236
|
case "base64url":
|
|
23887
|
-
|
|
24237
|
+
string_addPattern(res, zodPatterns.base64url, check.message, refs);
|
|
23888
24238
|
break;
|
|
23889
24239
|
case "jwt":
|
|
23890
|
-
|
|
24240
|
+
string_addPattern(res, zodPatterns.jwt, check.message, refs);
|
|
23891
24241
|
break;
|
|
23892
24242
|
case "cidr": {
|
|
23893
24243
|
if (check.version !== "v6") {
|
|
23894
|
-
|
|
24244
|
+
string_addPattern(res, zodPatterns.ipv4Cidr, check.message, refs);
|
|
23895
24245
|
}
|
|
23896
24246
|
if (check.version !== "v4") {
|
|
23897
|
-
|
|
24247
|
+
string_addPattern(res, zodPatterns.ipv6Cidr, check.message, refs);
|
|
23898
24248
|
}
|
|
23899
24249
|
break;
|
|
23900
24250
|
}
|
|
23901
24251
|
case "emoji":
|
|
23902
|
-
|
|
24252
|
+
string_addPattern(res, zodPatterns.emoji(), check.message, refs);
|
|
23903
24253
|
break;
|
|
23904
24254
|
case "ulid": {
|
|
23905
|
-
|
|
24255
|
+
string_addPattern(res, zodPatterns.ulid, check.message, refs);
|
|
23906
24256
|
break;
|
|
23907
24257
|
}
|
|
23908
24258
|
case "base64": {
|
|
@@ -23916,14 +24266,14 @@ function parseStringDef(def, refs) {
|
|
|
23916
24266
|
break;
|
|
23917
24267
|
}
|
|
23918
24268
|
case "pattern:zod": {
|
|
23919
|
-
|
|
24269
|
+
string_addPattern(res, zodPatterns.base64, check.message, refs);
|
|
23920
24270
|
break;
|
|
23921
24271
|
}
|
|
23922
24272
|
}
|
|
23923
24273
|
break;
|
|
23924
24274
|
}
|
|
23925
24275
|
case "nanoid": {
|
|
23926
|
-
|
|
24276
|
+
string_addPattern(res, zodPatterns.nanoid, check.message, refs);
|
|
23927
24277
|
}
|
|
23928
24278
|
case "toLowerCase":
|
|
23929
24279
|
case "toUpperCase":
|
|
@@ -23985,7 +24335,7 @@ function addFormat(schema, value, message, refs) {
|
|
|
23985
24335
|
}
|
|
23986
24336
|
}
|
|
23987
24337
|
// Adds a "pattern" keyword to the schema. If a pattern exists, both patterns will be joined in an allOf-node, along with subsequent ones.
|
|
23988
|
-
function
|
|
24338
|
+
function string_addPattern(schema, regex, message, refs) {
|
|
23989
24339
|
if (schema.pattern || schema.allOf?.some((x) => x.pattern)) {
|
|
23990
24340
|
if (!schema.allOf) {
|
|
23991
24341
|
schema.allOf = [];
|
|
@@ -28415,7 +28765,7 @@ function util_safeExtend(schema, shape) {
|
|
|
28415
28765
|
});
|
|
28416
28766
|
return core_util_clone(schema, def);
|
|
28417
28767
|
}
|
|
28418
|
-
function
|
|
28768
|
+
function core_util_merge(a, b) {
|
|
28419
28769
|
if (!b?._zod?.def) {
|
|
28420
28770
|
throw new Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");
|
|
28421
28771
|
}
|
|
@@ -29959,7 +30309,7 @@ const errors_messageDesc = {
|
|
|
29959
30309
|
enumerable: true,
|
|
29960
30310
|
configurable: true,
|
|
29961
30311
|
};
|
|
29962
|
-
const
|
|
30312
|
+
const errors_zodDesc = { value: undefined, enumerable: false };
|
|
29963
30313
|
const errors_issuesDesc = { value: undefined, enumerable: false };
|
|
29964
30314
|
/* Prototypes that already carry the lazy `toString`. Seeded with the
|
|
29965
30315
|
* intrinsics so that `init` on a foreign object — it accepts any object —
|
|
@@ -29967,12 +30317,12 @@ const errors_issuesDesc = { value: undefined, enumerable: false };
|
|
|
29967
30317
|
const errors_installedToString = /* @__PURE__ */ new WeakSet([Object.prototype, Error.prototype]);
|
|
29968
30318
|
const core_errors_initializer = (inst, def) => {
|
|
29969
30319
|
inst.name = "$ZodError";
|
|
29970
|
-
|
|
29971
|
-
Object.defineProperty(inst, "_zod",
|
|
30320
|
+
errors_zodDesc.value = inst._zod;
|
|
30321
|
+
Object.defineProperty(inst, "_zod", errors_zodDesc);
|
|
29972
30322
|
errors_issuesDesc.value = def;
|
|
29973
30323
|
Object.defineProperty(inst, "issues", errors_issuesDesc);
|
|
29974
30324
|
// Clear the shared slots; a retained `value` pins the last error's issues.
|
|
29975
|
-
|
|
30325
|
+
errors_zodDesc.value = undefined;
|
|
29976
30326
|
errors_issuesDesc.value = undefined;
|
|
29977
30327
|
Object.defineProperty(inst, "message", errors_messageDesc);
|
|
29978
30328
|
/* `toString` lives as a non-enumerable lazy getter on the shared
|
|
@@ -30304,7 +30654,7 @@ function parse_validateFallback(schema, value, _ctx) {
|
|
|
30304
30654
|
return result.issues.length === 0;
|
|
30305
30655
|
}
|
|
30306
30656
|
// no fast path: the compiler keeps async parses on the runtime, because a promise-returning callback that is not declared async compiles to a throw
|
|
30307
|
-
const
|
|
30657
|
+
const core_parse_validateAsync = async (schema, value, _ctx) => {
|
|
30308
30658
|
const ctx = _ctx ? { ..._ctx, async: true } : { async: true };
|
|
30309
30659
|
let result = schema._zod.run({ value, issues: [] }, ctx);
|
|
30310
30660
|
if (result instanceof Promise)
|
|
@@ -31280,7 +31630,7 @@ function schemas_handleCatchall(proms, input, payload, ctx, def, inst) {
|
|
|
31280
31630
|
});
|
|
31281
31631
|
}
|
|
31282
31632
|
// Whichever object a def's `shape` currently answers from: the one the caller passed until the first read, the frozen copy after it. Keyed by def, so a def rebuilt by a builder is simply absent rather than inheriting the source's. Read its keys with `Object.keys`, which does not invoke them — that is what lets a discriminated union check its discriminator without resolving an option whose getters reference the union being constructed.
|
|
31283
|
-
const
|
|
31633
|
+
const propShapes = new WeakMap();
|
|
31284
31634
|
const schemas_$ZodObject = /*@__PURE__*/ core_$constructor("$ZodObject", (inst, def) => {
|
|
31285
31635
|
// requires cast because technically $ZodObject doesn't extend
|
|
31286
31636
|
schemas_$ZodType.init(inst, def);
|
|
@@ -31288,14 +31638,14 @@ const schemas_$ZodObject = /*@__PURE__*/ core_$constructor("$ZodObject", (inst,
|
|
|
31288
31638
|
const desc = Object.getOwnPropertyDescriptor(def, "shape");
|
|
31289
31639
|
if (!desc?.get) {
|
|
31290
31640
|
const sh = def.shape;
|
|
31291
|
-
|
|
31641
|
+
propShapes.set(def, sh);
|
|
31292
31642
|
Object.defineProperty(def, "shape", {
|
|
31293
31643
|
get: () => {
|
|
31294
31644
|
const newSh = { ...sh };
|
|
31295
31645
|
Object.defineProperty(def, "shape", {
|
|
31296
31646
|
value: newSh,
|
|
31297
31647
|
});
|
|
31298
|
-
|
|
31648
|
+
propShapes.set(def, newSh);
|
|
31299
31649
|
return newSh;
|
|
31300
31650
|
},
|
|
31301
31651
|
});
|
|
@@ -31659,7 +32009,7 @@ const schemas_$ZodDiscriminatedUnion =
|
|
|
31659
32009
|
});
|
|
31660
32010
|
// Checked now rather than in the lookup map below, so an option that lacks the discriminator fails at the `discriminatedUnion` call instead of on the first object parsed. Options whose shape cannot be enumerated without resolving it — pipes, lazies, and objects rebuilt by a builder such as `.extend()` — are left to the map.
|
|
31661
32011
|
def.options.forEach((option, i) => {
|
|
31662
|
-
const propShape =
|
|
32012
|
+
const propShape = propShapes.get(option._zod.def);
|
|
31663
32013
|
if (propShape && !Object.prototype.hasOwnProperty.call(propShape, def.discriminator)) {
|
|
31664
32014
|
throw new Error(`Invalid discriminated union option at index "${i}"`);
|
|
31665
32015
|
}
|
|
@@ -34029,7 +34379,7 @@ function core_to_json_schema_handleUnrepresentable(schema, ctx, json, params, me
|
|
|
34029
34379
|
Object.assign(json, result);
|
|
34030
34380
|
return true;
|
|
34031
34381
|
}
|
|
34032
|
-
function
|
|
34382
|
+
function to_json_schema_process(schema, ctx, _params = { path: [], schemaPath: [] }) {
|
|
34033
34383
|
var _a;
|
|
34034
34384
|
const def = schema._zod.def;
|
|
34035
34385
|
// check for schema in seens
|
|
@@ -34075,7 +34425,7 @@ function core_to_json_schema_process(schema, ctx, _params = { path: [], schemaPa
|
|
|
34075
34425
|
// Also set ref if processor didn't (for inheritance)
|
|
34076
34426
|
if (!result.ref)
|
|
34077
34427
|
result.ref = parent;
|
|
34078
|
-
|
|
34428
|
+
to_json_schema_process(parent, ctx, params);
|
|
34079
34429
|
ctx.seen.get(parent).isParent = true;
|
|
34080
34430
|
}
|
|
34081
34431
|
}
|
|
@@ -34605,14 +34955,14 @@ function to_json_schema_isTransforming(_schema, _ctx) {
|
|
|
34605
34955
|
*/
|
|
34606
34956
|
const to_json_schema_createToJSONSchemaMethod = (schema, processors = {}) => (params) => {
|
|
34607
34957
|
const ctx = core_to_json_schema_initializeContext({ ...params, processors });
|
|
34608
|
-
|
|
34958
|
+
to_json_schema_process(schema, ctx);
|
|
34609
34959
|
core_to_json_schema_extractDefs(ctx, schema);
|
|
34610
34960
|
return core_to_json_schema_finalize(ctx, schema);
|
|
34611
34961
|
};
|
|
34612
34962
|
const to_json_schema_createStandardJSONSchemaMethod = (schema, io, processors = {}) => (params) => {
|
|
34613
34963
|
const { libraryOptions, target } = params ?? {};
|
|
34614
34964
|
const ctx = core_to_json_schema_initializeContext({ ...(libraryOptions ?? {}), target, io, processors });
|
|
34615
|
-
|
|
34965
|
+
to_json_schema_process(schema, ctx);
|
|
34616
34966
|
core_to_json_schema_extractDefs(ctx, schema);
|
|
34617
34967
|
return core_to_json_schema_finalize(ctx, schema);
|
|
34618
34968
|
};
|
|
@@ -34874,7 +35224,7 @@ const json_schema_processors_arrayProcessor = (schema, ctx, _json, params) => {
|
|
|
34874
35224
|
if (typeof maximum === "number")
|
|
34875
35225
|
json.maxItems = maximum;
|
|
34876
35226
|
json.type = "array";
|
|
34877
|
-
json.items =
|
|
35227
|
+
json.items = to_json_schema_process(def.element, ctx, {
|
|
34878
35228
|
...params,
|
|
34879
35229
|
path: [...params.path, "items"],
|
|
34880
35230
|
});
|
|
@@ -34908,7 +35258,7 @@ const json_schema_processors_objectProcessor = (schema, ctx, _json, params) => {
|
|
|
34908
35258
|
json.properties = {};
|
|
34909
35259
|
for (const key in shape) {
|
|
34910
35260
|
// assignProp so a __proto__ key becomes an own property instead of hitting the inherited setter on the plain {} we build into
|
|
34911
|
-
core_util_assignProp(json.properties, key,
|
|
35261
|
+
core_util_assignProp(json.properties, key, to_json_schema_process(shape[key], ctx, {
|
|
34912
35262
|
...params,
|
|
34913
35263
|
path: [...params.path, "properties", key],
|
|
34914
35264
|
}));
|
|
@@ -34938,7 +35288,7 @@ const json_schema_processors_objectProcessor = (schema, ctx, _json, params) => {
|
|
|
34938
35288
|
json.additionalProperties = false;
|
|
34939
35289
|
}
|
|
34940
35290
|
else if (def.catchall) {
|
|
34941
|
-
json.additionalProperties =
|
|
35291
|
+
json.additionalProperties = to_json_schema_process(def.catchall, ctx, {
|
|
34942
35292
|
...params,
|
|
34943
35293
|
path: [...params.path, "additionalProperties"],
|
|
34944
35294
|
});
|
|
@@ -34948,7 +35298,7 @@ const json_schema_processors_unionProcessor = (schema, ctx, json, params) => {
|
|
|
34948
35298
|
const def = schema._zod.def;
|
|
34949
35299
|
// Exclusive unions (inclusive === false) use oneOf (exactly one match) instead of anyOf (one or more matches). This includes both z.xor() and discriminated unions
|
|
34950
35300
|
const isExclusive = def.inclusive === false;
|
|
34951
|
-
const options = def.options.map((x, i) =>
|
|
35301
|
+
const options = def.options.map((x, i) => to_json_schema_process(x, ctx, {
|
|
34952
35302
|
...params,
|
|
34953
35303
|
path: [...params.path, isExclusive ? "oneOf" : "anyOf", i],
|
|
34954
35304
|
}));
|
|
@@ -34961,11 +35311,11 @@ const json_schema_processors_unionProcessor = (schema, ctx, json, params) => {
|
|
|
34961
35311
|
};
|
|
34962
35312
|
const json_schema_processors_intersectionProcessor = (schema, ctx, json, params) => {
|
|
34963
35313
|
const def = schema._zod.def;
|
|
34964
|
-
const a =
|
|
35314
|
+
const a = to_json_schema_process(def.left, ctx, {
|
|
34965
35315
|
...params,
|
|
34966
35316
|
path: [...params.path, "allOf", 0],
|
|
34967
35317
|
});
|
|
34968
|
-
const b =
|
|
35318
|
+
const b = to_json_schema_process(def.right, ctx, {
|
|
34969
35319
|
...params,
|
|
34970
35320
|
path: [...params.path, "allOf", 1],
|
|
34971
35321
|
});
|
|
@@ -35094,7 +35444,7 @@ const json_schema_processors_recordProcessor = (schema, ctx, _json, params) => {
|
|
|
35094
35444
|
};
|
|
35095
35445
|
const json_schema_processors_nullableProcessor = (schema, ctx, json, params) => {
|
|
35096
35446
|
const def = schema._zod.def;
|
|
35097
|
-
const inner =
|
|
35447
|
+
const inner = to_json_schema_process(def.innerType, ctx, params);
|
|
35098
35448
|
const seen = ctx.seen.get(schema);
|
|
35099
35449
|
if (ctx.target === "openapi-3.0") {
|
|
35100
35450
|
seen.ref = def.innerType;
|
|
@@ -35106,7 +35456,7 @@ const json_schema_processors_nullableProcessor = (schema, ctx, json, params) =>
|
|
|
35106
35456
|
};
|
|
35107
35457
|
const json_schema_processors_nonoptionalProcessor = (schema, ctx, _json, params) => {
|
|
35108
35458
|
const def = schema._zod.def;
|
|
35109
|
-
|
|
35459
|
+
to_json_schema_process(def.innerType, ctx, params);
|
|
35110
35460
|
const seen = ctx.seen.get(schema);
|
|
35111
35461
|
seen.ref = def.innerType;
|
|
35112
35462
|
};
|
|
@@ -35129,7 +35479,7 @@ function json_schema_processors_serializeDefaultValue(value, schema, ctx, json,
|
|
|
35129
35479
|
}
|
|
35130
35480
|
const json_schema_processors_defaultProcessor = (schema, ctx, json, params) => {
|
|
35131
35481
|
const def = schema._zod.def;
|
|
35132
|
-
|
|
35482
|
+
to_json_schema_process(def.innerType, ctx, params);
|
|
35133
35483
|
const seen = ctx.seen.get(schema);
|
|
35134
35484
|
seen.ref = def.innerType;
|
|
35135
35485
|
const value = json_schema_processors_serializeDefaultValue(def.defaultValue, schema, ctx, json, params);
|
|
@@ -35138,7 +35488,7 @@ const json_schema_processors_defaultProcessor = (schema, ctx, json, params) => {
|
|
|
35138
35488
|
};
|
|
35139
35489
|
const json_schema_processors_prefaultProcessor = (schema, ctx, json, params) => {
|
|
35140
35490
|
const def = schema._zod.def;
|
|
35141
|
-
|
|
35491
|
+
to_json_schema_process(def.innerType, ctx, params);
|
|
35142
35492
|
const seen = ctx.seen.get(schema);
|
|
35143
35493
|
seen.ref = def.innerType;
|
|
35144
35494
|
if (ctx.io !== "input")
|
|
@@ -35149,7 +35499,7 @@ const json_schema_processors_prefaultProcessor = (schema, ctx, json, params) =>
|
|
|
35149
35499
|
};
|
|
35150
35500
|
const json_schema_processors_catchProcessor = (schema, ctx, json, params) => {
|
|
35151
35501
|
const def = schema._zod.def;
|
|
35152
|
-
|
|
35502
|
+
to_json_schema_process(def.innerType, ctx, params);
|
|
35153
35503
|
const seen = ctx.seen.get(schema);
|
|
35154
35504
|
seen.ref = def.innerType;
|
|
35155
35505
|
let catchValue;
|
|
@@ -35166,13 +35516,13 @@ const json_schema_processors_pipeProcessor = (schema, ctx, _json, params) => {
|
|
|
35166
35516
|
const def = schema._zod.def;
|
|
35167
35517
|
const inIsTransform = def.in._zod.traits.has("$ZodTransform");
|
|
35168
35518
|
const innerType = ctx.io === "input" ? (inIsTransform ? def.out : def.in) : def.out;
|
|
35169
|
-
|
|
35519
|
+
to_json_schema_process(innerType, ctx, params);
|
|
35170
35520
|
const seen = ctx.seen.get(schema);
|
|
35171
35521
|
seen.ref = innerType;
|
|
35172
35522
|
};
|
|
35173
35523
|
const json_schema_processors_readonlyProcessor = (schema, ctx, json, params) => {
|
|
35174
35524
|
const def = schema._zod.def;
|
|
35175
|
-
|
|
35525
|
+
to_json_schema_process(def.innerType, ctx, params);
|
|
35176
35526
|
const seen = ctx.seen.get(schema);
|
|
35177
35527
|
seen.ref = def.innerType;
|
|
35178
35528
|
json.readOnly = true;
|
|
@@ -35185,7 +35535,7 @@ const json_schema_processors_promiseProcessor = (schema, ctx, _json, params) =>
|
|
|
35185
35535
|
};
|
|
35186
35536
|
const json_schema_processors_optionalProcessor = (schema, ctx, _json, params) => {
|
|
35187
35537
|
const def = schema._zod.def;
|
|
35188
|
-
|
|
35538
|
+
to_json_schema_process(def.innerType, ctx, params);
|
|
35189
35539
|
const seen = ctx.seen.get(schema);
|
|
35190
35540
|
seen.ref = def.innerType;
|
|
35191
35541
|
};
|
|
@@ -36326,7 +36676,7 @@ const schemas_ZodObject = /*@__PURE__*/ core_$constructor("ZodObject", (inst, de
|
|
|
36326
36676
|
return util_safeExtend(this, incoming);
|
|
36327
36677
|
},
|
|
36328
36678
|
merge(other) {
|
|
36329
|
-
return
|
|
36679
|
+
return core_util_merge(this, other);
|
|
36330
36680
|
},
|
|
36331
36681
|
pick(mask) {
|
|
36332
36682
|
return util_pick(this, mask);
|
|
@@ -52618,7 +52968,6 @@ function createJiti(id, opts = {}) {
|
|
|
52618
52968
|
/* export default */ const lib_jiti = ((/* unused pure expression or super */ null && (createJiti)));
|
|
52619
52969
|
|
|
52620
52970
|
;// CONCATENATED MODULE: ../../node_modules/rc9/dist/_chunks/libs/flat.mjs
|
|
52621
|
-
//#region node_modules/.pnpm/flat@6.0.1/node_modules/flat/index.js
|
|
52622
52971
|
function isBuffer(obj) {
|
|
52623
52972
|
return obj && obj.constructor && typeof obj.constructor.isBuffer === "function" && obj.constructor.isBuffer(obj);
|
|
52624
52973
|
}
|
|
@@ -52700,7 +53049,6 @@ function flat_unflatten(target, opts) {
|
|
|
52700
53049
|
});
|
|
52701
53050
|
return result;
|
|
52702
53051
|
}
|
|
52703
|
-
//#endregion
|
|
52704
53052
|
|
|
52705
53053
|
|
|
52706
53054
|
;// CONCATENATED MODULE: ../../node_modules/destr/dist/index.mjs
|
|
@@ -52784,12 +53132,8 @@ function safeDestr(value, options = {}) {
|
|
|
52784
53132
|
|
|
52785
53133
|
|
|
52786
53134
|
|
|
52787
|
-
//#region src/index.ts
|
|
52788
53135
|
const RE_KEY_VAL = /^\s*([^\s=]+)\s*=\s*(.*)?\s*$/;
|
|
52789
53136
|
const RE_LINES = /\n|\r|\r\n/;
|
|
52790
|
-
/**
|
|
52791
|
-
* The default options for the configuration file.
|
|
52792
|
-
*/
|
|
52793
53137
|
const dist_defaults = {
|
|
52794
53138
|
name: ".conf",
|
|
52795
53139
|
dir: process.cwd(),
|
|
@@ -52820,121 +53164,74 @@ function dist_parse(contents, options = {}) {
|
|
|
52820
53164
|
}
|
|
52821
53165
|
return options.flat ? config : flat_unflatten(config, { overwrite: true });
|
|
52822
53166
|
}
|
|
52823
|
-
/**
|
|
52824
|
-
* Parses a configuration string into an object.
|
|
52825
|
-
* @param {string} contents - The configuration data as a raw string.
|
|
52826
|
-
* @param {RCOptions} [options={}] - Options to control the parsing behaviour. See {@link RCOptions}.
|
|
52827
|
-
* @returns {RC} - The parsed configuration object. See {@link RC}.
|
|
52828
|
-
*/
|
|
52829
53167
|
function parseFile(path, options) {
|
|
52830
53168
|
if (!(0,external_node_fs_.existsSync)(path)) return {};
|
|
52831
53169
|
return dist_parse((0,external_node_fs_.readFileSync)(path, "utf8"), options);
|
|
52832
53170
|
}
|
|
52833
|
-
/**
|
|
52834
|
-
* Reads a configuration file from a default or specified location and parses its contents.
|
|
52835
|
-
* @param {RCOptions|string} [options] - Options for reading the configuration file, or the name of the configuration file. See {@link RCOptions}.
|
|
52836
|
-
* @returns {RC} - The parsed configuration object. See {@link RC}.
|
|
52837
|
-
*/
|
|
52838
53171
|
function dist_read(options) {
|
|
52839
53172
|
options = withDefaults(options);
|
|
52840
53173
|
return parseFile((0,external_node_path_.resolve)(options.dir, options.name), options);
|
|
52841
53174
|
}
|
|
52842
|
-
/**
|
|
52843
|
-
* Reads a custom configuration file from a default or specified location and parses its contents.
|
|
52844
|
-
* @param {RCOptions|string} [options] - Options for reading the configuration file, or the name of the configuration file. See {@link RCOptions}.
|
|
52845
|
-
* @returns {RC} - The parsed configuration object.
|
|
52846
|
-
* @deprecated Use {@link readUserConfig} instead, which uses `~/.config` following XDG conventions.
|
|
52847
|
-
*/
|
|
52848
53175
|
function readUser(options) {
|
|
52849
53176
|
options = withDefaults(options);
|
|
52850
53177
|
options.dir = process.env.XDG_CONFIG_HOME || (0,external_node_os_.homedir)();
|
|
52851
53178
|
return dist_read(options);
|
|
52852
53179
|
}
|
|
52853
|
-
/**
|
|
52854
|
-
* Serialises a configuration object to a string format.
|
|
52855
|
-
* @param {RC} config - The configuration object to serialise. See {@link RC}.
|
|
52856
|
-
* @returns {string} - The serialised configuration string.
|
|
52857
|
-
*/
|
|
52858
53180
|
function serialize(config) {
|
|
52859
53181
|
return Object.entries(flatten(config)).map(([key, value]) => `${key}=${JSON.stringify(value)}`).join("\n");
|
|
52860
53182
|
}
|
|
52861
|
-
/**
|
|
52862
|
-
* Writes a configuration object to a file in a default or specified location.
|
|
52863
|
-
* @param {RC} config - The configuration object to write. See {@link RC}.
|
|
52864
|
-
* @param {RCOptions|string} [options] - Options for writing the configuration file, or the name of the configuration file. See {@link RCOptions}.
|
|
52865
|
-
*/
|
|
52866
53183
|
function dist_write(config, options) {
|
|
52867
|
-
|
|
52868
|
-
|
|
53184
|
+
_write(config, withDefaults(options), false);
|
|
53185
|
+
}
|
|
53186
|
+
function _write(config, options, secure) {
|
|
53187
|
+
const path = resolve(options.dir, options.name);
|
|
53188
|
+
mkdirSync(dirname(path), {
|
|
53189
|
+
recursive: true,
|
|
53190
|
+
...secure && { mode: 448 }
|
|
53191
|
+
});
|
|
53192
|
+
writeFileSync(path, serialize(config), {
|
|
53193
|
+
encoding: "utf8",
|
|
53194
|
+
...secure && { mode: 384 }
|
|
53195
|
+
});
|
|
53196
|
+
if (secure) chmodSync(path, 384);
|
|
52869
53197
|
}
|
|
52870
|
-
/**
|
|
52871
|
-
* Writes a custom configuration object to a file in a default or specified location.
|
|
52872
|
-
* @param {RC} config - The configuration object to write. See {@link RC}.
|
|
52873
|
-
* @param {RCOptions|string} [options] - Options for writing the configuration file, or the name of the configuration file. See {@link RCOptions}.
|
|
52874
|
-
* @deprecated Use {@link writeUserConfig} instead, which uses `~/.config` following XDG conventions.
|
|
52875
|
-
*/
|
|
52876
53198
|
function writeUser(config, options) {
|
|
52877
53199
|
options = withDefaults(options);
|
|
52878
53200
|
options.dir = process.env.XDG_CONFIG_HOME || homedir();
|
|
52879
|
-
|
|
53201
|
+
_write(config, options, true);
|
|
53202
|
+
}
|
|
53203
|
+
function userConfigDir() {
|
|
53204
|
+
return process.env.XDG_CONFIG_HOME || resolve(homedir(), ".config");
|
|
52880
53205
|
}
|
|
52881
|
-
/**
|
|
52882
|
-
* Reads a configuration file from `$XDG_CONFIG_HOME` or `$HOME/.config` and parses its contents.
|
|
52883
|
-
* @param {RCOptions|string} [options] - Options for reading the configuration file, or the name of the configuration file. See {@link RCOptions}.
|
|
52884
|
-
* @returns {RC} - The parsed configuration object.
|
|
52885
|
-
*/
|
|
52886
53206
|
function readUserConfig(options) {
|
|
52887
53207
|
options = withDefaults(options);
|
|
52888
|
-
options.dir =
|
|
53208
|
+
options.dir = userConfigDir();
|
|
52889
53209
|
return dist_read(options);
|
|
52890
53210
|
}
|
|
52891
|
-
/**
|
|
52892
|
-
* Writes a configuration object to a file in `$XDG_CONFIG_HOME` or `$HOME/.config`.
|
|
52893
|
-
* @param {RC} config - The configuration object to write. See {@link RC}.
|
|
52894
|
-
* @param {RCOptions|string} [options] - Options for writing the configuration file, or the name of the configuration file. See {@link RCOptions}.
|
|
52895
|
-
*/
|
|
52896
53211
|
function writeUserConfig(config, options) {
|
|
52897
53212
|
options = withDefaults(options);
|
|
52898
|
-
options.dir =
|
|
52899
|
-
|
|
53213
|
+
options.dir = userConfigDir();
|
|
53214
|
+
_write(config, options, true);
|
|
52900
53215
|
}
|
|
52901
|
-
/**
|
|
52902
|
-
* Updates a configuration object in `$XDG_CONFIG_HOME` or `$HOME/.config` by merging and writing the result.
|
|
52903
|
-
* @param {RC} config - The configuration object to update. See {@link RC}.
|
|
52904
|
-
* @param {RCOptions|string} [options] - Options for updating the configuration file, or the name of the configuration file. See {@link RCOptions}.
|
|
52905
|
-
* @returns {RC} - The updated configuration object.
|
|
52906
|
-
*/
|
|
52907
53216
|
function updateUserConfig(config, options) {
|
|
52908
53217
|
options = withDefaults(options);
|
|
52909
|
-
options.dir =
|
|
52910
|
-
return
|
|
53218
|
+
options.dir = userConfigDir();
|
|
53219
|
+
return _update(config, options, true);
|
|
52911
53220
|
}
|
|
52912
|
-
/**
|
|
52913
|
-
* Updates an existing configuration object by merging it with the contents of a configuration file and writing the result.
|
|
52914
|
-
* @param {RC} config - The configuration object to update. See {@link RC}.
|
|
52915
|
-
* @param {RCOptions|string} [options] - Options for updating the configuration file, or the name of the configuration file. See {@link RCOptions}.
|
|
52916
|
-
* @returns {RC} - The updated configuration object. See {@link RC}.
|
|
52917
|
-
*/
|
|
52918
53221
|
function update(config, options) {
|
|
52919
|
-
|
|
53222
|
+
return _update(config, withDefaults(options), false);
|
|
53223
|
+
}
|
|
53224
|
+
function _update(config, options, secure) {
|
|
52920
53225
|
if (!options.flat) config = unflatten(config, { overwrite: true });
|
|
52921
53226
|
const newConfig = defu(config, dist_read(options));
|
|
52922
|
-
|
|
53227
|
+
_write(newConfig, options, secure);
|
|
52923
53228
|
return newConfig;
|
|
52924
53229
|
}
|
|
52925
|
-
/**
|
|
52926
|
-
* Updates a custom configuration object by merging it with the contents of a configuration file in a default location and writing the result.
|
|
52927
|
-
* @param {RC} config - The configuration object to update. See {@link RC}.
|
|
52928
|
-
* @param {RCOptions|string} [options] - Options for updating the configuration file, or the name of the configuration file. See {@link RCOptions}.
|
|
52929
|
-
* @returns {RC} - The updated configuration object. See {@link RC}.
|
|
52930
|
-
* @deprecated Use {@link updateUserConfig} instead, which uses `~/.config` following XDG conventions.
|
|
52931
|
-
*/
|
|
52932
53230
|
function updateUser(config, options) {
|
|
52933
53231
|
options = withDefaults(options);
|
|
52934
53232
|
options.dir = process.env.XDG_CONFIG_HOME || homedir();
|
|
52935
|
-
return
|
|
53233
|
+
return _update(config, options, true);
|
|
52936
53234
|
}
|
|
52937
|
-
//#endregion
|
|
52938
53235
|
|
|
52939
53236
|
|
|
52940
53237
|
;// CONCATENATED MODULE: ../../node_modules/defu/dist/defu.mjs
|
|
@@ -53008,12 +53305,17 @@ const defuArrayFn = (/* unused pure expression or super */ null && (createDefu((
|
|
|
53008
53305
|
|
|
53009
53306
|
|
|
53010
53307
|
|
|
53011
|
-
// EXTERNAL MODULE: ../../node_modules/confbox/dist/_chunks/_format.mjs
|
|
53012
|
-
var _format = __webpack_require__(
|
|
53013
|
-
;// CONCATENATED MODULE: ../../node_modules/confbox/dist/_chunks/json.mjs
|
|
53014
|
-
|
|
53015
|
-
|
|
53016
|
-
|
|
53308
|
+
// EXTERNAL MODULE: ../../node_modules/pkg-types/node_modules/confbox/dist/_chunks/_format.mjs + 1 modules
|
|
53309
|
+
var _format = __webpack_require__(8655);
|
|
53310
|
+
;// CONCATENATED MODULE: ../../node_modules/pkg-types/node_modules/confbox/dist/_chunks/libs/strip-json-comments.mjs
|
|
53311
|
+
const strip_json_comments_e=Symbol(`singleComment`),strip_json_comments_t=Symbol(`multiComment`),strip_json_comments_n=()=>``,strip_json_comments_r=(e,t,n)=>e.slice(t,n).replace(/[^ \t\r\n]/g,` `),strip_json_comments_i=(e,t)=>{let n=t-1,r=0;for(;e[n]===`\\`;)--n,r+=1;return!!(r%2)};function strip_json_comments_a(a,{whitespace:o=!0,trailingCommas:s=!1}={}){if(typeof a!=`string`)throw TypeError(`Expected argument \`jsonString\` to be a \`string\`, got \`${typeof a}\``);let c=o?strip_json_comments_r:strip_json_comments_n,l=!1,u=!1,d=0,f=``,p=``,m=-1;for(let n=0;n<a.length;n++){let r=a[n],o=a[n+1];if(!u&&r===`"`&&(strip_json_comments_i(a,n)||(l=!l)),!l){if(!u&&r+o===`//`)f+=a.slice(d,n),d=n,u=strip_json_comments_e,n++;else if(u===strip_json_comments_e&&r+o===`\r
|
|
53312
|
+
`){n++,u=!1,f+=c(a,d,n),d=n;continue}else if(u===strip_json_comments_e&&r===`
|
|
53313
|
+
`)u=!1,f+=c(a,d,n),d=n;else if(!u&&r+o===`/*`){f+=a.slice(d,n),d=n,u=strip_json_comments_t,n++;continue}else if(u===strip_json_comments_t&&r+o===`*/`){n++,u=!1,f+=c(a,d,n+1),d=n+1;continue}else s&&!u&&(m===-1?r===`,`&&(p+=f+a.slice(d,n),f=``,d=n,m=n):r===`}`||r===`]`?(f+=a.slice(d,n),p+=c(f,0,1)+f.slice(1),f=``,d=n,m=-1):r!==` `&&r!==` `&&r!==`\r`&&r!==`
|
|
53314
|
+
`&&(f+=a.slice(d,n),d=n,m=-1))}}let h=u===strip_json_comments_e?c(a,d):a.slice(d);return p+f+h}
|
|
53315
|
+
;// CONCATENATED MODULE: ../../node_modules/pkg-types/node_modules/confbox/dist/jsonc.mjs
|
|
53316
|
+
function jsonc_i(r,i){let a=JSON.parse(strip_json_comments_a((0,_format/* .stripBOM */.xi)(r),{trailingCommas:i?.allowTrailingComma}));return (0,_format/* .storeFormat */.$Z)(r,a,i),a}function jsonc_a(e,t){return r(e,t)}
|
|
53317
|
+
;// CONCATENATED MODULE: ../../node_modules/pkg-types/node_modules/confbox/dist/json.mjs
|
|
53318
|
+
function json_r(e,r){let i=JSON.parse((0,_format/* .stripBOM */.xi)(e),r?.reviver);return (0,_format/* .storeFormat */.$Z)(e,i,r),i}function json_i(t,n){let r=e(t,n),i=JSON.stringify(t,n?.replacer,r.indent);return r.whitespace.start+i+r.whitespace.end}
|
|
53017
53319
|
;// CONCATENATED MODULE: ../../node_modules/pkg-types/dist/index.mjs
|
|
53018
53320
|
|
|
53019
53321
|
|
|
@@ -53022,6 +53324,7 @@ var jsonc = __webpack_require__(5975);
|
|
|
53022
53324
|
|
|
53023
53325
|
|
|
53024
53326
|
|
|
53327
|
+
|
|
53025
53328
|
const defaultFindOptions = {
|
|
53026
53329
|
startingFrom: ".",
|
|
53027
53330
|
rootPattern: /^node_modules$/,
|
|
@@ -53072,7 +53375,7 @@ function _resolvePath(id, opts = {}) {
|
|
|
53072
53375
|
from: opts.from || opts.parent || opts.url
|
|
53073
53376
|
});
|
|
53074
53377
|
}
|
|
53075
|
-
const FileCache$1 = /*
|
|
53378
|
+
const FileCache$1 = /* #__PURE__ */ (/* unused pure expression or super */ null && (new Map()));
|
|
53076
53379
|
function defineTSConfig(tsconfig) {
|
|
53077
53380
|
return tsconfig;
|
|
53078
53381
|
}
|
|
@@ -53080,7 +53383,8 @@ async function readTSConfig(id, options = {}) {
|
|
|
53080
53383
|
const resolvedPath = await resolveTSConfig(id, options);
|
|
53081
53384
|
const cache = options.cache && typeof options.cache !== "boolean" ? options.cache : FileCache$1;
|
|
53082
53385
|
if (options.cache && cache.has(resolvedPath)) return cache.get(resolvedPath);
|
|
53083
|
-
const
|
|
53386
|
+
const text = await promises.readFile(resolvedPath, "utf8");
|
|
53387
|
+
const parsed = parseJSONC(text);
|
|
53084
53388
|
cache.set(resolvedPath, parsed);
|
|
53085
53389
|
return parsed;
|
|
53086
53390
|
}
|
|
@@ -53115,7 +53419,7 @@ const workspaceFiles = [
|
|
|
53115
53419
|
"deno.json",
|
|
53116
53420
|
"deno.jsonc"
|
|
53117
53421
|
];
|
|
53118
|
-
const FileCache = /*
|
|
53422
|
+
const FileCache = /* #__PURE__ */ new Map();
|
|
53119
53423
|
function definePackageJSON(pkg) {
|
|
53120
53424
|
return pkg;
|
|
53121
53425
|
}
|
|
@@ -53131,9 +53435,13 @@ async function readPackage(id, options = {}) {
|
|
|
53131
53435
|
if (options.cache && cache.has(resolvedPath)) return cache.get(resolvedPath);
|
|
53132
53436
|
const blob = await promises.readFile(resolvedPath, "utf8");
|
|
53133
53437
|
let parsed;
|
|
53134
|
-
if (resolvedPath.endsWith(".json5"))
|
|
53135
|
-
|
|
53136
|
-
|
|
53438
|
+
if (resolvedPath.endsWith(".json5")) {
|
|
53439
|
+
const { parseJSON5 } = await __webpack_require__.e(/* import() */ 772).then(__webpack_require__.bind(__webpack_require__, 7103));
|
|
53440
|
+
parsed = parseJSON5(blob);
|
|
53441
|
+
} else if (resolvedPath.endsWith(".yaml")) {
|
|
53442
|
+
const { parseYAML } = await __webpack_require__.e(/* import() */ 873).then(__webpack_require__.bind(__webpack_require__, 7976));
|
|
53443
|
+
parsed = parseYAML(blob);
|
|
53444
|
+
} else try {
|
|
53137
53445
|
parsed = parseJSON(blob);
|
|
53138
53446
|
} catch {
|
|
53139
53447
|
parsed = parseJSONC(blob);
|
|
@@ -53143,9 +53451,13 @@ async function readPackage(id, options = {}) {
|
|
|
53143
53451
|
}
|
|
53144
53452
|
async function writePackage(path, pkg) {
|
|
53145
53453
|
let content;
|
|
53146
|
-
if (path.endsWith(".json5"))
|
|
53147
|
-
|
|
53148
|
-
|
|
53454
|
+
if (path.endsWith(".json5")) {
|
|
53455
|
+
const { stringifyJSON5 } = await __webpack_require__.e(/* import() */ 772).then(__webpack_require__.bind(__webpack_require__, 7103));
|
|
53456
|
+
content = stringifyJSON5(pkg);
|
|
53457
|
+
} else if (path.endsWith(".yaml")) {
|
|
53458
|
+
const { stringifyYAML } = await __webpack_require__.e(/* import() */ 873).then(__webpack_require__.bind(__webpack_require__, 7976));
|
|
53459
|
+
content = stringifyYAML(pkg);
|
|
53460
|
+
} else content = stringifyJSON(pkg);
|
|
53149
53461
|
await promises.writeFile(path, content);
|
|
53150
53462
|
}
|
|
53151
53463
|
async function readPackageJSON(id, options = {}) {
|
|
@@ -53155,9 +53467,9 @@ async function readPackageJSON(id, options = {}) {
|
|
|
53155
53467
|
const blob = await external_node_fs_.promises.readFile(resolvedPath, "utf8");
|
|
53156
53468
|
let parsed;
|
|
53157
53469
|
try {
|
|
53158
|
-
parsed =
|
|
53470
|
+
parsed = json_r(blob);
|
|
53159
53471
|
} catch {
|
|
53160
|
-
parsed = (
|
|
53472
|
+
parsed = jsonc_i(blob);
|
|
53161
53473
|
}
|
|
53162
53474
|
cache.set(resolvedPath, parsed);
|
|
53163
53475
|
return parsed;
|
|
@@ -53254,7 +53566,7 @@ const dependencyKeys = (/* unused pure expression or super */ null && ([
|
|
|
53254
53566
|
"optionalDependencies",
|
|
53255
53567
|
"peerDependencies"
|
|
53256
53568
|
]));
|
|
53257
|
-
const objectKeys = new Set([
|
|
53569
|
+
const objectKeys = /* @__PURE__ */ (/* unused pure expression or super */ null && (new Set([
|
|
53258
53570
|
"typesVersions",
|
|
53259
53571
|
"scripts",
|
|
53260
53572
|
"resolutions",
|
|
@@ -53267,7 +53579,7 @@ const objectKeys = new Set([
|
|
|
53267
53579
|
"optionalDependencies",
|
|
53268
53580
|
"engines",
|
|
53269
53581
|
"publishConfig"
|
|
53270
|
-
]);
|
|
53582
|
+
])));
|
|
53271
53583
|
const defaultFieldOrder = (/* unused pure expression or super */ null && ([
|
|
53272
53584
|
"$schema",
|
|
53273
53585
|
"name",
|
|
@@ -53316,11 +53628,12 @@ function defineGitConfig(config) {
|
|
|
53316
53628
|
async function resolveGitConfig(dir, opts) {
|
|
53317
53629
|
return findNearestFile(".git/config", {
|
|
53318
53630
|
...opts,
|
|
53319
|
-
startingFrom: dir
|
|
53631
|
+
startingFrom: _resolvePath(dir, opts)
|
|
53320
53632
|
});
|
|
53321
53633
|
}
|
|
53322
53634
|
async function readGitConfig(dir, opts) {
|
|
53323
|
-
|
|
53635
|
+
const path = await resolveGitConfig(dir, opts);
|
|
53636
|
+
return parseGitConfig(await readFile(path, "utf8"));
|
|
53324
53637
|
}
|
|
53325
53638
|
async function writeGitConfig(path, config) {
|
|
53326
53639
|
await writeFile(path, stringifyGitConfig(config));
|
|
@@ -53427,7 +53740,7 @@ const dist_normalize = (p) => p?.replace(/\\/g, "/");
|
|
|
53427
53740
|
const ASYNC_LOADERS = {
|
|
53428
53741
|
".yaml": () => __webpack_require__.e(/* import() */ 48).then(__webpack_require__.bind(__webpack_require__, 6115)).then((r) => r.parseYAML),
|
|
53429
53742
|
".yml": () => __webpack_require__.e(/* import() */ 48).then(__webpack_require__.bind(__webpack_require__, 6115)).then((r) => r.parseYAML),
|
|
53430
|
-
".jsonc": () =>
|
|
53743
|
+
".jsonc": () => __webpack_require__.e(/* import() */ 564).then(__webpack_require__.bind(__webpack_require__, 5975)).then((r) => r.parseJSONC),
|
|
53431
53744
|
".json5": () => __webpack_require__.e(/* import() */ 913).then(__webpack_require__.bind(__webpack_require__, 2576)).then((r) => r.parseJSON5),
|
|
53432
53745
|
".toml": () => __webpack_require__.e(/* import() */ 127).then(__webpack_require__.bind(__webpack_require__, 1674)).then((r) => r.parseTOML)
|
|
53433
53746
|
};
|
|
@@ -54179,7 +54492,7 @@ function core_util_safeExtend(schema, shape) {
|
|
|
54179
54492
|
});
|
|
54180
54493
|
return v4_core_util_clone(schema, def);
|
|
54181
54494
|
}
|
|
54182
|
-
function
|
|
54495
|
+
function v4_core_util_merge(a, b) {
|
|
54183
54496
|
if (!b?._zod?.def) {
|
|
54184
54497
|
throw new Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");
|
|
54185
54498
|
}
|
|
@@ -55723,7 +56036,7 @@ const core_errors_messageDesc = {
|
|
|
55723
56036
|
enumerable: true,
|
|
55724
56037
|
configurable: true,
|
|
55725
56038
|
};
|
|
55726
|
-
const
|
|
56039
|
+
const core_errors_zodDesc = { value: undefined, enumerable: false };
|
|
55727
56040
|
const core_errors_issuesDesc = { value: undefined, enumerable: false };
|
|
55728
56041
|
/* Prototypes that already carry the lazy `toString`. Seeded with the
|
|
55729
56042
|
* intrinsics so that `init` on a foreign object — it accepts any object —
|
|
@@ -55731,12 +56044,12 @@ const core_errors_issuesDesc = { value: undefined, enumerable: false };
|
|
|
55731
56044
|
const core_errors_installedToString = /* @__PURE__ */ new WeakSet([Object.prototype, Error.prototype]);
|
|
55732
56045
|
const v4_core_errors_initializer = (inst, def) => {
|
|
55733
56046
|
inst.name = "$ZodError";
|
|
55734
|
-
|
|
55735
|
-
Object.defineProperty(inst, "_zod",
|
|
56047
|
+
core_errors_zodDesc.value = inst._zod;
|
|
56048
|
+
Object.defineProperty(inst, "_zod", core_errors_zodDesc);
|
|
55736
56049
|
core_errors_issuesDesc.value = def;
|
|
55737
56050
|
Object.defineProperty(inst, "issues", core_errors_issuesDesc);
|
|
55738
56051
|
// Clear the shared slots; a retained `value` pins the last error's issues.
|
|
55739
|
-
|
|
56052
|
+
core_errors_zodDesc.value = undefined;
|
|
55740
56053
|
core_errors_issuesDesc.value = undefined;
|
|
55741
56054
|
Object.defineProperty(inst, "message", core_errors_messageDesc);
|
|
55742
56055
|
/* `toString` lives as a non-enumerable lazy getter on the shared
|
|
@@ -56068,7 +56381,7 @@ function core_parse_validateFallback(schema, value, _ctx) {
|
|
|
56068
56381
|
return result.issues.length === 0;
|
|
56069
56382
|
}
|
|
56070
56383
|
// no fast path: the compiler keeps async parses on the runtime, because a promise-returning callback that is not declared async compiles to a throw
|
|
56071
|
-
const
|
|
56384
|
+
const v4_core_parse_validateAsync = async (schema, value, _ctx) => {
|
|
56072
56385
|
const ctx = _ctx ? { ..._ctx, async: true } : { async: true };
|
|
56073
56386
|
let result = schema._zod.run({ value, issues: [] }, ctx);
|
|
56074
56387
|
if (result instanceof Promise)
|
|
@@ -57044,7 +57357,7 @@ function core_schemas_handleCatchall(proms, input, payload, ctx, def, inst) {
|
|
|
57044
57357
|
});
|
|
57045
57358
|
}
|
|
57046
57359
|
// Whichever object a def's `shape` currently answers from: the one the caller passed until the first read, the frozen copy after it. Keyed by def, so a def rebuilt by a builder is simply absent rather than inheriting the source's. Read its keys with `Object.keys`, which does not invoke them — that is what lets a discriminated union check its discriminator without resolving an option whose getters reference the union being constructed.
|
|
57047
|
-
const
|
|
57360
|
+
const schemas_propShapes = new WeakMap();
|
|
57048
57361
|
const core_schemas_$ZodObject = /*@__PURE__*/ core_core_$constructor("$ZodObject", (inst, def) => {
|
|
57049
57362
|
// requires cast because technically $ZodObject doesn't extend
|
|
57050
57363
|
core_schemas_$ZodType.init(inst, def);
|
|
@@ -57052,14 +57365,14 @@ const core_schemas_$ZodObject = /*@__PURE__*/ core_core_$constructor("$ZodObject
|
|
|
57052
57365
|
const desc = Object.getOwnPropertyDescriptor(def, "shape");
|
|
57053
57366
|
if (!desc?.get) {
|
|
57054
57367
|
const sh = def.shape;
|
|
57055
|
-
|
|
57368
|
+
schemas_propShapes.set(def, sh);
|
|
57056
57369
|
Object.defineProperty(def, "shape", {
|
|
57057
57370
|
get: () => {
|
|
57058
57371
|
const newSh = { ...sh };
|
|
57059
57372
|
Object.defineProperty(def, "shape", {
|
|
57060
57373
|
value: newSh,
|
|
57061
57374
|
});
|
|
57062
|
-
|
|
57375
|
+
schemas_propShapes.set(def, newSh);
|
|
57063
57376
|
return newSh;
|
|
57064
57377
|
},
|
|
57065
57378
|
});
|
|
@@ -57423,7 +57736,7 @@ const core_schemas_$ZodDiscriminatedUnion =
|
|
|
57423
57736
|
});
|
|
57424
57737
|
// Checked now rather than in the lookup map below, so an option that lacks the discriminator fails at the `discriminatedUnion` call instead of on the first object parsed. Options whose shape cannot be enumerated without resolving it — pipes, lazies, and objects rebuilt by a builder such as `.extend()` — are left to the map.
|
|
57425
57738
|
def.options.forEach((option, i) => {
|
|
57426
|
-
const propShape =
|
|
57739
|
+
const propShape = schemas_propShapes.get(option._zod.def);
|
|
57427
57740
|
if (propShape && !Object.prototype.hasOwnProperty.call(propShape, def.discriminator)) {
|
|
57428
57741
|
throw new Error(`Invalid discriminated union option at index "${i}"`);
|
|
57429
57742
|
}
|
|
@@ -59793,7 +60106,7 @@ function v4_core_to_json_schema_handleUnrepresentable(schema, ctx, json, params,
|
|
|
59793
60106
|
Object.assign(json, result);
|
|
59794
60107
|
return true;
|
|
59795
60108
|
}
|
|
59796
|
-
function
|
|
60109
|
+
function core_to_json_schema_process(schema, ctx, _params = { path: [], schemaPath: [] }) {
|
|
59797
60110
|
var _a;
|
|
59798
60111
|
const def = schema._zod.def;
|
|
59799
60112
|
// check for schema in seens
|
|
@@ -59839,7 +60152,7 @@ function v4_core_to_json_schema_process(schema, ctx, _params = { path: [], schem
|
|
|
59839
60152
|
// Also set ref if processor didn't (for inheritance)
|
|
59840
60153
|
if (!result.ref)
|
|
59841
60154
|
result.ref = parent;
|
|
59842
|
-
|
|
60155
|
+
core_to_json_schema_process(parent, ctx, params);
|
|
59843
60156
|
ctx.seen.get(parent).isParent = true;
|
|
59844
60157
|
}
|
|
59845
60158
|
}
|
|
@@ -60369,14 +60682,14 @@ function core_to_json_schema_isTransforming(_schema, _ctx) {
|
|
|
60369
60682
|
*/
|
|
60370
60683
|
const core_to_json_schema_createToJSONSchemaMethod = (schema, processors = {}) => (params) => {
|
|
60371
60684
|
const ctx = v4_core_to_json_schema_initializeContext({ ...params, processors });
|
|
60372
|
-
|
|
60685
|
+
core_to_json_schema_process(schema, ctx);
|
|
60373
60686
|
v4_core_to_json_schema_extractDefs(ctx, schema);
|
|
60374
60687
|
return v4_core_to_json_schema_finalize(ctx, schema);
|
|
60375
60688
|
};
|
|
60376
60689
|
const core_to_json_schema_createStandardJSONSchemaMethod = (schema, io, processors = {}) => (params) => {
|
|
60377
60690
|
const { libraryOptions, target } = params ?? {};
|
|
60378
60691
|
const ctx = v4_core_to_json_schema_initializeContext({ ...(libraryOptions ?? {}), target, io, processors });
|
|
60379
|
-
|
|
60692
|
+
core_to_json_schema_process(schema, ctx);
|
|
60380
60693
|
v4_core_to_json_schema_extractDefs(ctx, schema);
|
|
60381
60694
|
return v4_core_to_json_schema_finalize(ctx, schema);
|
|
60382
60695
|
};
|
|
@@ -60638,7 +60951,7 @@ const core_json_schema_processors_arrayProcessor = (schema, ctx, _json, params)
|
|
|
60638
60951
|
if (typeof maximum === "number")
|
|
60639
60952
|
json.maxItems = maximum;
|
|
60640
60953
|
json.type = "array";
|
|
60641
|
-
json.items =
|
|
60954
|
+
json.items = core_to_json_schema_process(def.element, ctx, {
|
|
60642
60955
|
...params,
|
|
60643
60956
|
path: [...params.path, "items"],
|
|
60644
60957
|
});
|
|
@@ -60672,7 +60985,7 @@ const core_json_schema_processors_objectProcessor = (schema, ctx, _json, params)
|
|
|
60672
60985
|
json.properties = {};
|
|
60673
60986
|
for (const key in shape) {
|
|
60674
60987
|
// assignProp so a __proto__ key becomes an own property instead of hitting the inherited setter on the plain {} we build into
|
|
60675
|
-
v4_core_util_assignProp(json.properties, key,
|
|
60988
|
+
v4_core_util_assignProp(json.properties, key, core_to_json_schema_process(shape[key], ctx, {
|
|
60676
60989
|
...params,
|
|
60677
60990
|
path: [...params.path, "properties", key],
|
|
60678
60991
|
}));
|
|
@@ -60702,7 +61015,7 @@ const core_json_schema_processors_objectProcessor = (schema, ctx, _json, params)
|
|
|
60702
61015
|
json.additionalProperties = false;
|
|
60703
61016
|
}
|
|
60704
61017
|
else if (def.catchall) {
|
|
60705
|
-
json.additionalProperties =
|
|
61018
|
+
json.additionalProperties = core_to_json_schema_process(def.catchall, ctx, {
|
|
60706
61019
|
...params,
|
|
60707
61020
|
path: [...params.path, "additionalProperties"],
|
|
60708
61021
|
});
|
|
@@ -60712,7 +61025,7 @@ const core_json_schema_processors_unionProcessor = (schema, ctx, json, params) =
|
|
|
60712
61025
|
const def = schema._zod.def;
|
|
60713
61026
|
// Exclusive unions (inclusive === false) use oneOf (exactly one match) instead of anyOf (one or more matches). This includes both z.xor() and discriminated unions
|
|
60714
61027
|
const isExclusive = def.inclusive === false;
|
|
60715
|
-
const options = def.options.map((x, i) =>
|
|
61028
|
+
const options = def.options.map((x, i) => core_to_json_schema_process(x, ctx, {
|
|
60716
61029
|
...params,
|
|
60717
61030
|
path: [...params.path, isExclusive ? "oneOf" : "anyOf", i],
|
|
60718
61031
|
}));
|
|
@@ -60725,11 +61038,11 @@ const core_json_schema_processors_unionProcessor = (schema, ctx, json, params) =
|
|
|
60725
61038
|
};
|
|
60726
61039
|
const core_json_schema_processors_intersectionProcessor = (schema, ctx, json, params) => {
|
|
60727
61040
|
const def = schema._zod.def;
|
|
60728
|
-
const a =
|
|
61041
|
+
const a = core_to_json_schema_process(def.left, ctx, {
|
|
60729
61042
|
...params,
|
|
60730
61043
|
path: [...params.path, "allOf", 0],
|
|
60731
61044
|
});
|
|
60732
|
-
const b =
|
|
61045
|
+
const b = core_to_json_schema_process(def.right, ctx, {
|
|
60733
61046
|
...params,
|
|
60734
61047
|
path: [...params.path, "allOf", 1],
|
|
60735
61048
|
});
|
|
@@ -60823,7 +61136,7 @@ const core_json_schema_processors_recordProcessor = (schema, ctx, _json, params)
|
|
|
60823
61136
|
const patterns = keyBag?.patterns;
|
|
60824
61137
|
if (def.mode === "loose" && patterns && patterns.size > 0) {
|
|
60825
61138
|
// Use patternProperties for looseRecord with regex patterns
|
|
60826
|
-
const valueSchema =
|
|
61139
|
+
const valueSchema = core_to_json_schema_process(def.valueType, ctx, {
|
|
60827
61140
|
...params,
|
|
60828
61141
|
path: [...params.path, "patternProperties", "*"],
|
|
60829
61142
|
});
|
|
@@ -60835,12 +61148,12 @@ const core_json_schema_processors_recordProcessor = (schema, ctx, _json, params)
|
|
|
60835
61148
|
else {
|
|
60836
61149
|
// Default behavior: use propertyNames + additionalProperties
|
|
60837
61150
|
if (ctx.target === "draft-07" || ctx.target === "draft-2020-12") {
|
|
60838
|
-
json.propertyNames =
|
|
61151
|
+
json.propertyNames = core_to_json_schema_process(def.keyType, ctx, {
|
|
60839
61152
|
...params,
|
|
60840
61153
|
path: [...params.path, "propertyNames"],
|
|
60841
61154
|
});
|
|
60842
61155
|
}
|
|
60843
|
-
json.additionalProperties =
|
|
61156
|
+
json.additionalProperties = core_to_json_schema_process(def.valueType, ctx, {
|
|
60844
61157
|
...params,
|
|
60845
61158
|
path: [...params.path, "additionalProperties"],
|
|
60846
61159
|
});
|
|
@@ -60858,7 +61171,7 @@ const core_json_schema_processors_recordProcessor = (schema, ctx, _json, params)
|
|
|
60858
61171
|
};
|
|
60859
61172
|
const core_json_schema_processors_nullableProcessor = (schema, ctx, json, params) => {
|
|
60860
61173
|
const def = schema._zod.def;
|
|
60861
|
-
const inner =
|
|
61174
|
+
const inner = core_to_json_schema_process(def.innerType, ctx, params);
|
|
60862
61175
|
const seen = ctx.seen.get(schema);
|
|
60863
61176
|
if (ctx.target === "openapi-3.0") {
|
|
60864
61177
|
seen.ref = def.innerType;
|
|
@@ -60870,7 +61183,7 @@ const core_json_schema_processors_nullableProcessor = (schema, ctx, json, params
|
|
|
60870
61183
|
};
|
|
60871
61184
|
const core_json_schema_processors_nonoptionalProcessor = (schema, ctx, _json, params) => {
|
|
60872
61185
|
const def = schema._zod.def;
|
|
60873
|
-
|
|
61186
|
+
core_to_json_schema_process(def.innerType, ctx, params);
|
|
60874
61187
|
const seen = ctx.seen.get(schema);
|
|
60875
61188
|
seen.ref = def.innerType;
|
|
60876
61189
|
};
|
|
@@ -60893,7 +61206,7 @@ function core_json_schema_processors_serializeDefaultValue(value, schema, ctx, j
|
|
|
60893
61206
|
}
|
|
60894
61207
|
const core_json_schema_processors_defaultProcessor = (schema, ctx, json, params) => {
|
|
60895
61208
|
const def = schema._zod.def;
|
|
60896
|
-
|
|
61209
|
+
core_to_json_schema_process(def.innerType, ctx, params);
|
|
60897
61210
|
const seen = ctx.seen.get(schema);
|
|
60898
61211
|
seen.ref = def.innerType;
|
|
60899
61212
|
const value = core_json_schema_processors_serializeDefaultValue(def.defaultValue, schema, ctx, json, params);
|
|
@@ -60902,7 +61215,7 @@ const core_json_schema_processors_defaultProcessor = (schema, ctx, json, params)
|
|
|
60902
61215
|
};
|
|
60903
61216
|
const core_json_schema_processors_prefaultProcessor = (schema, ctx, json, params) => {
|
|
60904
61217
|
const def = schema._zod.def;
|
|
60905
|
-
|
|
61218
|
+
core_to_json_schema_process(def.innerType, ctx, params);
|
|
60906
61219
|
const seen = ctx.seen.get(schema);
|
|
60907
61220
|
seen.ref = def.innerType;
|
|
60908
61221
|
if (ctx.io !== "input")
|
|
@@ -60913,7 +61226,7 @@ const core_json_schema_processors_prefaultProcessor = (schema, ctx, json, params
|
|
|
60913
61226
|
};
|
|
60914
61227
|
const core_json_schema_processors_catchProcessor = (schema, ctx, json, params) => {
|
|
60915
61228
|
const def = schema._zod.def;
|
|
60916
|
-
|
|
61229
|
+
core_to_json_schema_process(def.innerType, ctx, params);
|
|
60917
61230
|
const seen = ctx.seen.get(schema);
|
|
60918
61231
|
seen.ref = def.innerType;
|
|
60919
61232
|
let catchValue;
|
|
@@ -60930,13 +61243,13 @@ const core_json_schema_processors_pipeProcessor = (schema, ctx, _json, params) =
|
|
|
60930
61243
|
const def = schema._zod.def;
|
|
60931
61244
|
const inIsTransform = def.in._zod.traits.has("$ZodTransform");
|
|
60932
61245
|
const innerType = ctx.io === "input" ? (inIsTransform ? def.out : def.in) : def.out;
|
|
60933
|
-
|
|
61246
|
+
core_to_json_schema_process(innerType, ctx, params);
|
|
60934
61247
|
const seen = ctx.seen.get(schema);
|
|
60935
61248
|
seen.ref = innerType;
|
|
60936
61249
|
};
|
|
60937
61250
|
const core_json_schema_processors_readonlyProcessor = (schema, ctx, json, params) => {
|
|
60938
61251
|
const def = schema._zod.def;
|
|
60939
|
-
|
|
61252
|
+
core_to_json_schema_process(def.innerType, ctx, params);
|
|
60940
61253
|
const seen = ctx.seen.get(schema);
|
|
60941
61254
|
seen.ref = def.innerType;
|
|
60942
61255
|
json.readOnly = true;
|
|
@@ -60949,7 +61262,7 @@ const core_json_schema_processors_promiseProcessor = (schema, ctx, _json, params
|
|
|
60949
61262
|
};
|
|
60950
61263
|
const core_json_schema_processors_optionalProcessor = (schema, ctx, _json, params) => {
|
|
60951
61264
|
const def = schema._zod.def;
|
|
60952
|
-
|
|
61265
|
+
core_to_json_schema_process(def.innerType, ctx, params);
|
|
60953
61266
|
const seen = ctx.seen.get(schema);
|
|
60954
61267
|
seen.ref = def.innerType;
|
|
60955
61268
|
};
|
|
@@ -62090,7 +62403,7 @@ const classic_schemas_ZodObject = /*@__PURE__*/ core_core_$constructor("ZodObjec
|
|
|
62090
62403
|
return core_util_safeExtend(this, incoming);
|
|
62091
62404
|
},
|
|
62092
62405
|
merge(other) {
|
|
62093
|
-
return
|
|
62406
|
+
return v4_core_util_merge(this, other);
|
|
62094
62407
|
},
|
|
62095
62408
|
pick(mask) {
|
|
62096
62409
|
return core_util_pick(this, mask);
|
|
@@ -83848,7 +84161,7 @@ function trough() {
|
|
|
83848
84161
|
|
|
83849
84162
|
// Next or done.
|
|
83850
84163
|
if (fn) {
|
|
83851
|
-
|
|
84164
|
+
lib_wrap(fn, next)(...output)
|
|
83852
84165
|
} else {
|
|
83853
84166
|
callback(null, ...output)
|
|
83854
84167
|
}
|
|
@@ -83900,7 +84213,7 @@ function trough() {
|
|
|
83900
84213
|
* @returns {Run}
|
|
83901
84214
|
* Wrapped middleware.
|
|
83902
84215
|
*/
|
|
83903
|
-
function
|
|
84216
|
+
function lib_wrap(middleware, callback) {
|
|
83904
84217
|
/** @type {boolean} */
|
|
83905
84218
|
let called
|
|
83906
84219
|
|
|
@@ -89570,6 +89883,18 @@ function hasMalformedPercentEncoding (component) {
|
|
|
89570
89883
|
return false
|
|
89571
89884
|
}
|
|
89572
89885
|
|
|
89886
|
+
/**
|
|
89887
|
+
* Whether the host is a bracketed IP literal (RFC 3986 `IP-literal`).
|
|
89888
|
+
* An unterminated `[` is not a literal, so it must still be validated as a
|
|
89889
|
+
* reg-name instead of being waved through as an IP.
|
|
89890
|
+
*
|
|
89891
|
+
* @param {string} host
|
|
89892
|
+
* @returns {boolean}
|
|
89893
|
+
*/
|
|
89894
|
+
function isIPLiteral (host) {
|
|
89895
|
+
return host[0] === '[' && host[host.length - 1] === ']'
|
|
89896
|
+
}
|
|
89897
|
+
|
|
89573
89898
|
/**
|
|
89574
89899
|
* @param {RegExpMatchArray} matches
|
|
89575
89900
|
* @returns {boolean}
|
|
@@ -89579,7 +89904,7 @@ function hasMalformedComponentPercentEncoding (matches) {
|
|
|
89579
89904
|
// compatibility. Their parsing is intentionally left to normalizeIPv6.
|
|
89580
89905
|
const host = matches[4]
|
|
89581
89906
|
return hasMalformedPercentEncoding(matches[3]) ||
|
|
89582
|
-
(host !== undefined && !(host
|
|
89907
|
+
(host !== undefined && !isIPLiteral(host) && hasMalformedPercentEncoding(host)) ||
|
|
89583
89908
|
hasMalformedPercentEncoding(matches[6]) ||
|
|
89584
89909
|
hasMalformedPercentEncoding(matches[7]) ||
|
|
89585
89910
|
hasMalformedPercentEncoding(matches[8])
|
|
@@ -89597,7 +89922,7 @@ function canonicalizeHost (parsed, options, schemeHandler, isIP) {
|
|
|
89597
89922
|
!options.unicodeSupport &&
|
|
89598
89923
|
(!schemeHandler || !schemeHandler.unicodeSupport) &&
|
|
89599
89924
|
parsed.host &&
|
|
89600
|
-
parsed.host
|
|
89925
|
+
!isIPLiteral(parsed.host) &&
|
|
89601
89926
|
(options.domainHost || (schemeHandler && schemeHandler.domainHost)) &&
|
|
89602
89927
|
isIP === false &&
|
|
89603
89928
|
nonSimpleDomain(parsed.host)
|
|
@@ -89722,10 +90047,11 @@ function parseWithStatus (uri, opts) {
|
|
|
89722
90047
|
if (parsed.host) {
|
|
89723
90048
|
const ipv4result = isIPv4(parsed.host)
|
|
89724
90049
|
if (ipv4result === false) {
|
|
89725
|
-
const bracketedIPLiteral = parsed.host
|
|
90050
|
+
const bracketedIPLiteral = isIPLiteral(parsed.host)
|
|
90051
|
+
const hasIPLiteralBracket = parsed.host.indexOf('[') !== -1 || parsed.host.indexOf(']') !== -1
|
|
89726
90052
|
const ipv6result = normalizeIPv6(parsed.host)
|
|
89727
90053
|
isIP = ipv6result.isIPV6 || ipv6result.isIPVFuture === true
|
|
89728
|
-
malformedIPLiteral =
|
|
90054
|
+
malformedIPLiteral = hasIPLiteralBracket && (!bracketedIPLiteral || ipv6result.error === true)
|
|
89729
90055
|
parsed.host = isIP ? ipv6result.host : ipv6result.host.toLowerCase()
|
|
89730
90056
|
|
|
89731
90057
|
if (malformedIPLiteral) {
|
|
@@ -89755,15 +90081,21 @@ function parseWithStatus (uri, opts) {
|
|
|
89755
90081
|
const schemeHandler = getSchemeHandler(options.scheme || parsed.scheme)
|
|
89756
90082
|
|
|
89757
90083
|
// convert Unicode IDN -> ASCII IDN when the effective scheme uses domain hosts
|
|
89758
|
-
|
|
90084
|
+
if (!malformedIPLiteral) {
|
|
90085
|
+
malformedHost = canonicalizeHost(parsed, options, schemeHandler, isIP)
|
|
90086
|
+
}
|
|
89759
90087
|
|
|
89760
|
-
if (
|
|
89761
|
-
|
|
89762
|
-
|
|
89763
|
-
|
|
89764
|
-
|
|
89765
|
-
|
|
90088
|
+
if (uri.indexOf('%') !== -1 && parsed.host !== undefined && !malformedIPLiteral) {
|
|
90089
|
+
let host = isIP ? parsed.host : normalizePercentEncoding(parsed.host, true)
|
|
90090
|
+
if (!isIP) {
|
|
90091
|
+
// Fold reg-name case after decoding unreserved octets. The second
|
|
90092
|
+
// pass only restores uppercase hex in escapes that remain encoded.
|
|
90093
|
+
host = normalizePercentEncoding(host.toLowerCase())
|
|
89766
90094
|
}
|
|
90095
|
+
parsed.host = reescapeHostDelimiters(host, isIP)
|
|
90096
|
+
}
|
|
90097
|
+
|
|
90098
|
+
if (!schemeHandler || (schemeHandler && !schemeHandler.skipNormalize)) {
|
|
89767
90099
|
if (parsed.path) {
|
|
89768
90100
|
parsed.path = normalizePathEncoding(parsed.path)
|
|
89769
90101
|
}
|
|
@@ -90144,6 +90476,9 @@ const isUUID = RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\d
|
|
|
90144
90476
|
/** @type {(value: string) => boolean} */
|
|
90145
90477
|
const isIPv4 = RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u)
|
|
90146
90478
|
|
|
90479
|
+
/** @type {(value: string) => boolean} */
|
|
90480
|
+
const isPort = RegExp.prototype.test.bind(/^\d*$/u)
|
|
90481
|
+
|
|
90147
90482
|
/** @type {(value: string) => boolean} */
|
|
90148
90483
|
const isHexPair = RegExp.prototype.test.bind(/^[\da-f]{2}$/iu)
|
|
90149
90484
|
|
|
@@ -90851,8 +91186,12 @@ function recomposeAuthority (component) {
|
|
|
90851
91186
|
}
|
|
90852
91187
|
|
|
90853
91188
|
if (typeof component.port === 'number' || typeof component.port === 'string') {
|
|
91189
|
+
const port = String(component.port)
|
|
91190
|
+
if (!isPort(port)) {
|
|
91191
|
+
throw new TypeError('URI port is malformed.')
|
|
91192
|
+
}
|
|
90854
91193
|
uriTokens.push(':')
|
|
90855
|
-
uriTokens.push(
|
|
91194
|
+
uriTokens.push(port)
|
|
90856
91195
|
}
|
|
90857
91196
|
|
|
90858
91197
|
return uriTokens.length ? uriTokens.join('') : undefined
|
|
@@ -99234,35 +99573,19 @@ exports.visitAsync = visitAsync;
|
|
|
99234
99573
|
|
|
99235
99574
|
|
|
99236
99575
|
},
|
|
99237
|
-
|
|
99238
|
-
const t=Symbol.for(`__confbox_fmt__`),n=/^(\s+)/,r=/(\s+)$/;function i(e,t={}){return{sample:t.indent===void 0&&t.preserveIndentation!==!1&&e.slice(0,t?.sampleSize||1024),whiteSpace:t.preserveWhitespace===!1?void 0:{start:n.exec(e)?.[0]||``,end:r.exec(e)?.[0]||``}}}function a(e,n,r){!n||typeof n!=`object`||Object.defineProperty(n,t,{enumerable:!1,configurable:!0,writable:!0,value:i(e,r)})}function o(n,r){if(!n||typeof n!=`object`||!(t in n))return{indent:r?.indent??2,whitespace:{start:``,end:``}};let i=n[t];return{indent:r?.indent||e(i.sample||``).indent,whitespace:i.whiteSpace||{start:``,end:``}}}
|
|
99239
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
99240
|
-
n: () => (a)
|
|
99241
|
-
});
|
|
99242
|
-
|
|
99243
|
-
|
|
99244
|
-
},
|
|
99245
|
-
5975(__unused_rspack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
99576
|
+
8655(__unused_rspack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
99246
99577
|
|
|
99247
99578
|
// EXPORTS
|
|
99248
99579
|
__webpack_require__.d(__webpack_exports__, {
|
|
99249
|
-
|
|
99580
|
+
gV: () => (/* binding */ _format_s),
|
|
99581
|
+
$Z: () => (/* binding */ _format_o),
|
|
99582
|
+
xi: () => (/* binding */ _format_i)
|
|
99250
99583
|
});
|
|
99251
99584
|
|
|
99252
|
-
|
|
99253
|
-
|
|
99254
|
-
|
|
99255
|
-
|
|
99256
|
-
;// CONCATENATED MODULE: ../../node_modules/confbox/dist/_chunks/libs/jsonc-parser.mjs
|
|
99257
|
-
function jsonc_parser_e(e,i=!1){let a=e.length,o=0,s=``,c=0,l=16,u=0,d=0,f=0,p=0,m=0;function h(t,n){let r=0,i=0;for(;r<t||!n;){let t=e.charCodeAt(o);if(t>=48&&t<=57)i=i*16+t-48;else if(t>=65&&t<=70)i=i*16+t-65+10;else if(t>=97&&t<=102)i=i*16+t-97+10;else break;o++,r++}return r<t&&(i=-1),i}function g(e){o=e,s=``,c=0,l=16,m=0}function _(){let t=o;if(e.charCodeAt(o)===48)o++;else for(o++;o<e.length&&jsonc_parser_r(e.charCodeAt(o));)o++;if(o<e.length&&e.charCodeAt(o)===46)if(o++,o<e.length&&jsonc_parser_r(e.charCodeAt(o)))for(o++;o<e.length&&jsonc_parser_r(e.charCodeAt(o));)o++;else return m=3,e.substring(t,o);let n=o;if(o<e.length&&(e.charCodeAt(o)===69||e.charCodeAt(o)===101))if(o++,(o<e.length&&e.charCodeAt(o)===43||e.charCodeAt(o)===45)&&o++,o<e.length&&jsonc_parser_r(e.charCodeAt(o))){for(o++;o<e.length&&jsonc_parser_r(e.charCodeAt(o));)o++;n=o}else m=3;return e.substring(t,n)}function v(){let t=``,r=o;for(;;){if(o>=a){t+=e.substring(r,o),m=2;break}let i=e.charCodeAt(o);if(i===34){t+=e.substring(r,o),o++;break}if(i===92){if(t+=e.substring(r,o),o++,o>=a){m=2;break}switch(e.charCodeAt(o++)){case 34:t+=`"`;break;case 92:t+=`\\`;break;case 47:t+=`/`;break;case 98:t+=`\b`;break;case 102:t+=`\f`;break;case 110:t+=`
|
|
99258
|
-
`;break;case 114:t+=`\r`;break;case 116:t+=` `;break;case 117:let e=h(4,!0);e>=0?t+=String.fromCharCode(e):m=4;break;default:m=5}r=o;continue}if(i>=0&&i<=31)if(jsonc_parser_n(i)){t+=e.substring(r,o),m=2;break}else m=6;o++}return t}function y(){if(s=``,m=0,c=o,d=u,p=f,o>=a)return c=a,l=17;let i=e.charCodeAt(o);if(jsonc_parser_t(i)){do o++,s+=String.fromCharCode(i),i=e.charCodeAt(o);while(jsonc_parser_t(i));return l=15}if(jsonc_parser_n(i))return o++,s+=String.fromCharCode(i),i===13&&e.charCodeAt(o)===10&&(o++,s+=`
|
|
99259
|
-
`),u++,f=o,l=14;switch(i){case 123:return o++,l=1;case 125:return o++,l=2;case 91:return o++,l=3;case 93:return o++,l=4;case 58:return o++,l=6;case 44:return o++,l=5;case 34:return o++,s=v(),l=10;case 47:let t=o-1;if(e.charCodeAt(o+1)===47){for(o+=2;o<a&&!jsonc_parser_n(e.charCodeAt(o));)o++;return s=e.substring(t,o),l=12}if(e.charCodeAt(o+1)===42){o+=2;let r=a-1,i=!1;for(;o<r;){let t=e.charCodeAt(o);if(t===42&&e.charCodeAt(o+1)===47){o+=2,i=!0;break}o++,jsonc_parser_n(t)&&(t===13&&e.charCodeAt(o)===10&&o++,u++,f=o)}return i||(o++,m=1),s=e.substring(t,o),l=13}return s+=String.fromCharCode(i),o++,l=16;case 45:if(s+=String.fromCharCode(i),o++,o===a||!jsonc_parser_r(e.charCodeAt(o)))return l=16;case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return s+=_(),l=11;default:for(;o<a&&b(i);)o++,i=e.charCodeAt(o);if(c!==o){switch(s=e.substring(c,o),s){case`true`:return l=8;case`false`:return l=9;case`null`:return l=7}return l=16}return s+=String.fromCharCode(i),o++,l=16}}function b(e){if(jsonc_parser_t(e)||jsonc_parser_n(e))return!1;switch(e){case 125:case 93:case 123:case 91:case 34:case 58:case 44:case 47:return!1}return!0}function x(){let e;do e=y();while(e>=12&&e<=15);return e}return{setPosition:g,getPosition:()=>o,scan:i?x:y,getToken:()=>l,getTokenValue:()=>s,getTokenOffset:()=>c,getTokenLength:()=>o-c,getTokenStartLine:()=>d,getTokenStartCharacter:()=>c-p,getTokenError:()=>m}}function jsonc_parser_t(e){return e===32||e===9}function jsonc_parser_n(e){return e===10||e===13}function jsonc_parser_r(e){return e>=48&&e<=57}var jsonc_parser_i;(function(e){e[e.lineFeed=10]=`lineFeed`,e[e.carriageReturn=13]=`carriageReturn`,e[e.space=32]=`space`,e[e._0=48]=`_0`,e[e._1=49]=`_1`,e[e._2=50]=`_2`,e[e._3=51]=`_3`,e[e._4=52]=`_4`,e[e._5=53]=`_5`,e[e._6=54]=`_6`,e[e._7=55]=`_7`,e[e._8=56]=`_8`,e[e._9=57]=`_9`,e[e.a=97]=`a`,e[e.b=98]=`b`,e[e.c=99]=`c`,e[e.d=100]=`d`,e[e.e=101]=`e`,e[e.f=102]=`f`,e[e.g=103]=`g`,e[e.h=104]=`h`,e[e.i=105]=`i`,e[e.j=106]=`j`,e[e.k=107]=`k`,e[e.l=108]=`l`,e[e.m=109]=`m`,e[e.n=110]=`n`,e[e.o=111]=`o`,e[e.p=112]=`p`,e[e.q=113]=`q`,e[e.r=114]=`r`,e[e.s=115]=`s`,e[e.t=116]=`t`,e[e.u=117]=`u`,e[e.v=118]=`v`,e[e.w=119]=`w`,e[e.x=120]=`x`,e[e.y=121]=`y`,e[e.z=122]=`z`,e[e.A=65]=`A`,e[e.B=66]=`B`,e[e.C=67]=`C`,e[e.D=68]=`D`,e[e.E=69]=`E`,e[e.F=70]=`F`,e[e.G=71]=`G`,e[e.H=72]=`H`,e[e.I=73]=`I`,e[e.J=74]=`J`,e[e.K=75]=`K`,e[e.L=76]=`L`,e[e.M=77]=`M`,e[e.N=78]=`N`,e[e.O=79]=`O`,e[e.P=80]=`P`,e[e.Q=81]=`Q`,e[e.R=82]=`R`,e[e.S=83]=`S`,e[e.T=84]=`T`,e[e.U=85]=`U`,e[e.V=86]=`V`,e[e.W=87]=`W`,e[e.X=88]=`X`,e[e.Y=89]=`Y`,e[e.Z=90]=`Z`,e[e.asterisk=42]=`asterisk`,e[e.backslash=92]=`backslash`,e[e.closeBrace=125]=`closeBrace`,e[e.closeBracket=93]=`closeBracket`,e[e.colon=58]=`colon`,e[e.comma=44]=`comma`,e[e.dot=46]=`dot`,e[e.doubleQuote=34]=`doubleQuote`,e[e.minus=45]=`minus`,e[e.openBrace=123]=`openBrace`,e[e.openBracket=91]=`openBracket`,e[e.plus=43]=`plus`,e[e.slash=47]=`slash`,e[e.formFeed=12]=`formFeed`,e[e.tab=9]=`tab`})(jsonc_parser_i||={}),Array(20).fill(0).map((e,t)=>` `.repeat(t)),Array(200).fill(0).map((e,t)=>`
|
|
99260
|
-
`+` `.repeat(t)),Array(200).fill(0).map((e,t)=>`\r`+` `.repeat(t)),Array(200).fill(0).map((e,t)=>`\r
|
|
99261
|
-
`+` `.repeat(t)),Array(200).fill(0).map((e,t)=>`
|
|
99262
|
-
`+` `.repeat(t)),Array(200).fill(0).map((e,t)=>`\r`+` `.repeat(t)),Array(200).fill(0).map((e,t)=>`\r
|
|
99263
|
-
`+` `.repeat(t));var jsonc_parser_a;(function(e){e.DEFAULT={allowTrailingComma:!1}})(jsonc_parser_a||={});function jsonc_parser_o(e,t=[],n=jsonc_parser_a.DEFAULT){let r=null,i=[],o=[];function s(e){Array.isArray(i)?i.push(e):r!==null&&(i[r]=e)}return jsonc_parser_d(e,{onObjectBegin:()=>{let e={};s(e),o.push(i),i=e,r=null},onObjectProperty:e=>{r=e},onObjectEnd:()=>{i=o.pop()},onArrayBegin:()=>{let e=[];s(e),o.push(i),i=e,r=null},onArrayEnd:()=>{i=o.pop()},onLiteralValue:s,onError:(e,n,r)=>{t.push({error:e,offset:n,length:r})}},n),i[0]}function jsonc_parser_s(e){if(!e.parent||!e.parent.children)return[];let t=jsonc_parser_s(e.parent);if(e.parent.type===`property`){let n=e.parent.children[0].value;t.push(n)}else if(e.parent.type===`array`){let n=e.parent.children.indexOf(e);n!==-1&&t.push(n)}return t}function jsonc_parser_c(e){switch(e.type){case`array`:return e.children.map(jsonc_parser_c);case`object`:let t=Object.create(null);for(let n of e.children){let e=n.children[1];e&&(t[n.children[0].value]=jsonc_parser_c(e))}return t;case`null`:case`string`:case`number`:case`boolean`:return e.value;default:return}}function jsonc_parser_l(e,t,n=!1){return t>=e.offset&&t<e.offset+e.length||n&&t===e.offset+e.length}function jsonc_parser_u(e,t,n=!1){if(jsonc_parser_l(e,t,n)){let r=e.children;if(Array.isArray(r))for(let e=0;e<r.length&&r[e].offset<=t;e++){let i=jsonc_parser_u(r[e],t,n);if(i)return i}return e}}function jsonc_parser_d(t,n,r=jsonc_parser_a.DEFAULT){let i=jsonc_parser_e(t,!1),o=[],s=0;function c(e){return e?()=>s===0&&e(i.getTokenOffset(),i.getTokenLength(),i.getTokenStartLine(),i.getTokenStartCharacter()):()=>!0}function l(e){return e?t=>s===0&&e(t,i.getTokenOffset(),i.getTokenLength(),i.getTokenStartLine(),i.getTokenStartCharacter()):()=>!0}function u(e){return e?t=>s===0&&e(t,i.getTokenOffset(),i.getTokenLength(),i.getTokenStartLine(),i.getTokenStartCharacter(),()=>o.slice()):()=>!0}function d(e){return e?()=>{s>0?s++:e(i.getTokenOffset(),i.getTokenLength(),i.getTokenStartLine(),i.getTokenStartCharacter(),()=>o.slice())===!1&&(s=1)}:()=>!0}function f(e){return e?()=>{s>0&&s--,s===0&&e(i.getTokenOffset(),i.getTokenLength(),i.getTokenStartLine(),i.getTokenStartCharacter())}:()=>!0}let p=d(n.onObjectBegin),m=u(n.onObjectProperty),h=f(n.onObjectEnd),g=d(n.onArrayBegin),_=f(n.onArrayEnd),v=u(n.onLiteralValue),y=l(n.onSeparator),b=c(n.onComment),x=l(n.onError),S=r&&r.disallowComments,C=r&&r.allowTrailingComma;function w(){for(;;){let e=i.scan();switch(i.getTokenError()){case 4:T(14);break;case 5:T(15);break;case 3:T(13);break;case 1:S||T(11);break;case 2:T(12);break;case 6:T(16);break}switch(e){case 12:case 13:S?T(10):b();break;case 16:T(1);break;case 15:case 14:break;default:return e}}}function T(e,t=[],n=[]){if(x(e),t.length+n.length>0){let e=i.getToken();for(;e!==17;){if(t.indexOf(e)!==-1){w();break}else if(n.indexOf(e)!==-1)break;e=w()}}}function E(e){let t=i.getTokenValue();return e?v(t):(m(t),o.push(t)),w(),!0}function D(){switch(i.getToken()){case 11:let e=i.getTokenValue(),t=Number(e);isNaN(t)&&(T(2),t=0),v(t);break;case 7:v(null);break;case 8:v(!0);break;case 9:v(!1);break;default:return!1}return w(),!0}function O(){return i.getToken()===10?(E(!1),i.getToken()===6?(y(`:`),w(),j()||T(4,[],[2,5])):T(5,[],[2,5]),o.pop(),!0):(T(3,[],[2,5]),!1)}function k(){p(),w();let e=!1;for(;i.getToken()!==2&&i.getToken()!==17;){if(i.getToken()===5){if(e||T(4,[],[]),y(`,`),w(),i.getToken()===2&&C)break}else e&&T(6,[],[]);O()||T(4,[],[2,5]),e=!0}return h(),i.getToken()===2?w():T(7,[2],[]),!0}function A(){g(),w();let e=!0,t=!1;for(;i.getToken()!==4&&i.getToken()!==17;){if(i.getToken()===5){if(t||T(4,[],[]),y(`,`),w(),i.getToken()===4&&C)break}else t&&T(6,[],[]);e?(o.push(0),e=!1):o[o.length-1]++,j()||T(4,[],[4,5]),t=!0}return _(),e||o.pop(),i.getToken()===4?w():T(8,[4],[]),!0}function j(){switch(i.getToken()){case 3:return A();case 1:return k();case 10:return E(!0);default:return D()}}return w(),i.getToken()===17?r.allowEmptyContent?!0:(T(4,[],[]),!1):j()?(i.getToken()!==17&&T(9,[],[]),!0):(T(4,[],[]),!1)}var jsonc_parser_f;(function(e){e[e.None=0]=`None`,e[e.UnexpectedEndOfComment=1]=`UnexpectedEndOfComment`,e[e.UnexpectedEndOfString=2]=`UnexpectedEndOfString`,e[e.UnexpectedEndOfNumber=3]=`UnexpectedEndOfNumber`,e[e.InvalidUnicode=4]=`InvalidUnicode`,e[e.InvalidEscapeCharacter=5]=`InvalidEscapeCharacter`,e[e.InvalidCharacter=6]=`InvalidCharacter`})(jsonc_parser_f||={});var jsonc_parser_p;(function(e){e[e.OpenBraceToken=1]=`OpenBraceToken`,e[e.CloseBraceToken=2]=`CloseBraceToken`,e[e.OpenBracketToken=3]=`OpenBracketToken`,e[e.CloseBracketToken=4]=`CloseBracketToken`,e[e.CommaToken=5]=`CommaToken`,e[e.ColonToken=6]=`ColonToken`,e[e.NullKeyword=7]=`NullKeyword`,e[e.TrueKeyword=8]=`TrueKeyword`,e[e.FalseKeyword=9]=`FalseKeyword`,e[e.StringLiteral=10]=`StringLiteral`,e[e.NumericLiteral=11]=`NumericLiteral`,e[e.LineCommentTrivia=12]=`LineCommentTrivia`,e[e.BlockCommentTrivia=13]=`BlockCommentTrivia`,e[e.LineBreakTrivia=14]=`LineBreakTrivia`,e[e.Trivia=15]=`Trivia`,e[e.Unknown=16]=`Unknown`,e[e.EOF=17]=`EOF`})(jsonc_parser_p||={});const jsonc_parser_m=jsonc_parser_o;var jsonc_parser_h;(function(e){e[e.InvalidSymbol=1]=`InvalidSymbol`,e[e.InvalidNumberFormat=2]=`InvalidNumberFormat`,e[e.PropertyNameExpected=3]=`PropertyNameExpected`,e[e.ValueExpected=4]=`ValueExpected`,e[e.ColonExpected=5]=`ColonExpected`,e[e.CommaExpected=6]=`CommaExpected`,e[e.CloseBraceExpected=7]=`CloseBraceExpected`,e[e.CloseBracketExpected=8]=`CloseBracketExpected`,e[e.EndOfFileExpected=9]=`EndOfFileExpected`,e[e.InvalidCommentToken=10]=`InvalidCommentToken`,e[e.UnexpectedEndOfComment=11]=`UnexpectedEndOfComment`,e[e.UnexpectedEndOfString=12]=`UnexpectedEndOfString`,e[e.UnexpectedEndOfNumber=13]=`UnexpectedEndOfNumber`,e[e.InvalidUnicode=14]=`InvalidUnicode`,e[e.InvalidEscapeCharacter=15]=`InvalidEscapeCharacter`,e[e.InvalidCharacter=16]=`InvalidCharacter`})(jsonc_parser_h||={});
|
|
99264
|
-
;// CONCATENATED MODULE: ../../node_modules/confbox/dist/jsonc.mjs
|
|
99265
|
-
function jsonc_r(n,r){let i=jsonc_parser_m(n,r?.errors,r);return (0,_format.n)(n,i,r),i}function jsonc_i(e,t){return n(e,t)}
|
|
99585
|
+
;// CONCATENATED MODULE: ../../node_modules/pkg-types/node_modules/confbox/dist/_chunks/libs/detect-indent.mjs
|
|
99586
|
+
const detect_indent_e=/^(?:( )+|\t+)/,detect_indent_t=`space`;function detect_indent_n(e,n,r){return e&&n===detect_indent_t&&r===1}function detect_indent_r(r,a){let o=new Map,s=0,c,l;for(let u of r.split(/\n/g)){if(!u)continue;let r=u.match(detect_indent_e);if(r===null)s=0,c=``;else{let e=r[0].length,u=r[1]?detect_indent_t:`tab`;if(detect_indent_n(a,u,e))continue;u!==c&&(s=0),c=u;let d=1,f=0,p=e-s;if(s=e,p===0)d=0,f=1;else{let e=Math.abs(p);if(detect_indent_n(a,u,e))continue;l=detect_indent_i(u,e)}let m=o.get(l);o.set(l,m===void 0?[1,0]:[m[0]+d,m[1]+f])}}return o}function detect_indent_i(e,n){return(e===detect_indent_t?`s`:`t`)+String(n)}function detect_indent_a(e){return{type:e[0]===`s`?detect_indent_t:`tab`,amount:Number(e.slice(1))}}function detect_indent_o(e){let t,n=0,r=0;for(let[i,[a,o]]of e)(a>n||a===n&&o>r)&&(n=a,r=o,t=i);return t}function detect_indent_s(e,n){return(e===detect_indent_t?` `:` `).repeat(n)}function detect_indent_c(e){if(typeof e!=`string`)throw TypeError(`Expected a string`);let t=detect_indent_r(e,!0);t.size===0&&(t=detect_indent_r(e,!1));let n=detect_indent_o(t),i,c=0,l=``;return n!==void 0&&({type:i,amount:c}=detect_indent_a(n),l=detect_indent_s(i,c)),{amount:c,type:i,indent:l}}
|
|
99587
|
+
;// CONCATENATED MODULE: ../../node_modules/pkg-types/node_modules/confbox/dist/_chunks/_format.mjs
|
|
99588
|
+
const _format_t=Symbol.for(`__confbox_fmt__`),_format_n=/^(\s+)/,_format_r=/(\s+)$/;function _format_i(e){return e.charCodeAt(0)===65279?e.slice(1):e}function _format_a(e,t={}){return{sample:t.indent===void 0&&t.preserveIndentation!==!1&&_format_i(e).slice(0,t?.sampleSize||1024),whiteSpace:t.preserveWhitespace===!1?void 0:{start:_format_n.exec(e)?.[0]||``,end:_format_r.exec(e)?.[0]||``}}}function _format_o(e,n,r){!n||typeof n!=`object`||Object.defineProperty(n,_format_t,{enumerable:!1,configurable:!0,writable:!0,value:_format_a(e,r)})}function _format_s(n,r){if(!n||typeof n!=`object`||!(_format_t in n))return{indent:r?.indent??2,whitespace:{start:``,end:``}};let i=n[_format_t];return{indent:r?.indent||detect_indent_c(i.sample||``).indent,whitespace:i.whiteSpace||{start:``,end:``}}}
|
|
99266
99589
|
|
|
99267
99590
|
},
|
|
99268
99591
|
3770(module) {
|
|
@@ -99445,4 +99768,4 @@ if (installedChunkData !== 0) { // 0 means "already installed".'
|
|
|
99445
99768
|
// module factories are used so entry inlining is disabled
|
|
99446
99769
|
// startup
|
|
99447
99770
|
// Load entry module and return exports
|
|
99448
|
-
var __webpack_exports__ = __webpack_require__(
|
|
99771
|
+
var __webpack_exports__ = __webpack_require__(2517);
|