@elysiajs/openapi 1.4.11 → 1.4.12
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/bun.lock +79 -144
- package/dist/cjs/gen/index.js +1021 -344
- package/dist/cjs/index.js +1235 -349
- package/dist/cjs/openapi.d.ts +1 -1
- package/dist/cjs/openapi.js +213 -9
- package/dist/gen/index.mjs +1021 -344
- package/dist/index.mjs +1235 -349
- package/dist/openapi.d.ts +1 -1
- package/dist/openapi.mjs +213 -9
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -525,11 +525,11 @@ __export(kind_exports, {
|
|
|
525
525
|
});
|
|
526
526
|
|
|
527
527
|
// node_modules/@sinclair/typebox/build/esm/type/symbols/symbols.mjs
|
|
528
|
-
var TransformKind = Symbol.for("TypeBox.Transform");
|
|
529
|
-
var ReadonlyKind = Symbol.for("TypeBox.Readonly");
|
|
530
|
-
var OptionalKind = Symbol.for("TypeBox.Optional");
|
|
531
|
-
var Hint = Symbol.for("TypeBox.Hint");
|
|
532
|
-
var Kind = Symbol.for("TypeBox.Kind");
|
|
528
|
+
var TransformKind = /* @__PURE__ */ Symbol.for("TypeBox.Transform");
|
|
529
|
+
var ReadonlyKind = /* @__PURE__ */ Symbol.for("TypeBox.Readonly");
|
|
530
|
+
var OptionalKind = /* @__PURE__ */ Symbol.for("TypeBox.Optional");
|
|
531
|
+
var Hint = /* @__PURE__ */ Symbol.for("TypeBox.Hint");
|
|
532
|
+
var Kind = /* @__PURE__ */ Symbol.for("TypeBox.Kind");
|
|
533
533
|
|
|
534
534
|
// node_modules/@sinclair/typebox/build/esm/type/guard/kind.mjs
|
|
535
535
|
function IsReadonly(value) {
|
|
@@ -2735,6 +2735,212 @@ openapi({
|
|
|
2735
2735
|
})`
|
|
2736
2736
|
};
|
|
2737
2737
|
var warned = {};
|
|
2738
|
+
var mergeObjectSchemas = (schemas) => {
|
|
2739
|
+
if (schemas.length === 0)
|
|
2740
|
+
return {
|
|
2741
|
+
schema: void 0,
|
|
2742
|
+
notObjects: []
|
|
2743
|
+
};
|
|
2744
|
+
if (schemas.length === 1)
|
|
2745
|
+
return schemas[0].type === "object" ? {
|
|
2746
|
+
schema: schemas[0],
|
|
2747
|
+
notObjects: []
|
|
2748
|
+
} : {
|
|
2749
|
+
schema: void 0,
|
|
2750
|
+
notObjects: schemas
|
|
2751
|
+
};
|
|
2752
|
+
let newSchema;
|
|
2753
|
+
const notObjects = [];
|
|
2754
|
+
let additionalPropertiesIsTrue = false;
|
|
2755
|
+
let additionalPropertiesIsFalse = false;
|
|
2756
|
+
for (const schema of schemas) {
|
|
2757
|
+
if (!schema) continue;
|
|
2758
|
+
if (schema.type !== "object") {
|
|
2759
|
+
notObjects.push(schema);
|
|
2760
|
+
continue;
|
|
2761
|
+
}
|
|
2762
|
+
if ("additionalProperties" in schema) {
|
|
2763
|
+
if (schema.additionalProperties === true)
|
|
2764
|
+
additionalPropertiesIsTrue = true;
|
|
2765
|
+
else if (schema.additionalProperties === false)
|
|
2766
|
+
additionalPropertiesIsFalse = true;
|
|
2767
|
+
}
|
|
2768
|
+
if (!newSchema) {
|
|
2769
|
+
newSchema = schema;
|
|
2770
|
+
continue;
|
|
2771
|
+
}
|
|
2772
|
+
newSchema = {
|
|
2773
|
+
...newSchema,
|
|
2774
|
+
...schema,
|
|
2775
|
+
properties: {
|
|
2776
|
+
...newSchema.properties,
|
|
2777
|
+
...schema.properties
|
|
2778
|
+
},
|
|
2779
|
+
required: [
|
|
2780
|
+
...newSchema?.required ?? [],
|
|
2781
|
+
...schema.required ?? []
|
|
2782
|
+
]
|
|
2783
|
+
};
|
|
2784
|
+
}
|
|
2785
|
+
if (newSchema) {
|
|
2786
|
+
if (newSchema.required)
|
|
2787
|
+
newSchema.required = [...new Set(newSchema.required)];
|
|
2788
|
+
if (additionalPropertiesIsFalse) newSchema.additionalProperties = false;
|
|
2789
|
+
else if (additionalPropertiesIsTrue)
|
|
2790
|
+
newSchema.additionalProperties = true;
|
|
2791
|
+
}
|
|
2792
|
+
return {
|
|
2793
|
+
schema: newSchema,
|
|
2794
|
+
notObjects
|
|
2795
|
+
};
|
|
2796
|
+
};
|
|
2797
|
+
var isTSchema = (value) => {
|
|
2798
|
+
if (!value || typeof value !== "object") return false;
|
|
2799
|
+
if (Kind in value) return true;
|
|
2800
|
+
const keys = Object.keys(value);
|
|
2801
|
+
if (keys.length > 0 && keys.every((k) => !isNaN(Number(k)))) {
|
|
2802
|
+
return false;
|
|
2803
|
+
}
|
|
2804
|
+
return false;
|
|
2805
|
+
};
|
|
2806
|
+
var normalizeSchemaReference = (schema) => {
|
|
2807
|
+
if (!schema) return void 0;
|
|
2808
|
+
if (typeof schema !== "string") return schema;
|
|
2809
|
+
return t.Ref(schema);
|
|
2810
|
+
};
|
|
2811
|
+
var mergeSchemaProperty = (existing, incoming, vendors) => {
|
|
2812
|
+
if (!existing) return incoming;
|
|
2813
|
+
if (!incoming) return existing;
|
|
2814
|
+
const existingSchema = normalizeSchemaReference(existing);
|
|
2815
|
+
let incomingSchema = normalizeSchemaReference(incoming);
|
|
2816
|
+
if (!existingSchema) return incoming;
|
|
2817
|
+
if (!incomingSchema) return existing;
|
|
2818
|
+
if (!isTSchema(incomingSchema) && incomingSchema["~standard"])
|
|
2819
|
+
incomingSchema = unwrapSchema(incomingSchema, vendors);
|
|
2820
|
+
if (!incomingSchema) return existing;
|
|
2821
|
+
const { schema: mergedSchema, notObjects } = mergeObjectSchemas([
|
|
2822
|
+
existingSchema,
|
|
2823
|
+
incomingSchema
|
|
2824
|
+
]);
|
|
2825
|
+
if (notObjects.length > 0) {
|
|
2826
|
+
if (mergedSchema) return t.Intersect([mergedSchema, ...notObjects]);
|
|
2827
|
+
return notObjects.length === 1 ? notObjects[0] : t.Intersect(notObjects);
|
|
2828
|
+
}
|
|
2829
|
+
return mergedSchema;
|
|
2830
|
+
};
|
|
2831
|
+
var unwrapResponseSchema = (schema, vendors) => typeof schema === "string" ? normalizeSchemaReference(schema) : !schema ? void 0 : isTSchema(schema) ? schema : (
|
|
2832
|
+
// @ts-ignore
|
|
2833
|
+
schema["~standard"] ? unwrapSchema(schema, vendors, "output") : Object.fromEntries(
|
|
2834
|
+
Object.entries(schema).map(([status, schema2]) => [
|
|
2835
|
+
status,
|
|
2836
|
+
typeof schema2 === "string" ? normalizeSchemaReference(schema2) : isTSchema(schema2) ? schema2 : unwrapSchema(schema2, vendors, "output")
|
|
2837
|
+
])
|
|
2838
|
+
)
|
|
2839
|
+
);
|
|
2840
|
+
var mergeResponseSchema = (_existing, _incoming, vendors) => {
|
|
2841
|
+
if (!_existing) return _incoming;
|
|
2842
|
+
if (!_incoming) return _existing;
|
|
2843
|
+
let existing = unwrapResponseSchema(_existing, vendors);
|
|
2844
|
+
let incoming = unwrapResponseSchema(_incoming, vendors);
|
|
2845
|
+
if (!existing && !incoming) return void 0;
|
|
2846
|
+
if (incoming && !existing) return incoming;
|
|
2847
|
+
if (existing && !incoming) return existing;
|
|
2848
|
+
if (isTSchema(existing) || existing?.["~standard"])
|
|
2849
|
+
existing = {
|
|
2850
|
+
200: existing
|
|
2851
|
+
};
|
|
2852
|
+
if (isTSchema(incoming) || incoming?.["~standard"])
|
|
2853
|
+
incoming = {
|
|
2854
|
+
200: incoming
|
|
2855
|
+
};
|
|
2856
|
+
const schema = {
|
|
2857
|
+
...incoming
|
|
2858
|
+
};
|
|
2859
|
+
for (const status of Object.keys(existing ?? {})) {
|
|
2860
|
+
const existingSchema = existing[status];
|
|
2861
|
+
const incomingSchema = incoming[status];
|
|
2862
|
+
if (existingSchema && incomingSchema)
|
|
2863
|
+
schema[status] = mergeSchemaProperty(
|
|
2864
|
+
existingSchema,
|
|
2865
|
+
incomingSchema,
|
|
2866
|
+
vendors
|
|
2867
|
+
);
|
|
2868
|
+
else if (existingSchema) schema[status] = existingSchema;
|
|
2869
|
+
else if (incomingSchema) schema[status] = incomingSchema;
|
|
2870
|
+
}
|
|
2871
|
+
return schema;
|
|
2872
|
+
};
|
|
2873
|
+
var mergeStandaloneValidators = (hooks, vendors) => {
|
|
2874
|
+
const merged = { ...hooks };
|
|
2875
|
+
if (!hooks.standaloneValidator?.length) return merged;
|
|
2876
|
+
for (const validator of hooks.standaloneValidator) {
|
|
2877
|
+
if (validator.body)
|
|
2878
|
+
merged.body = mergeSchemaProperty(
|
|
2879
|
+
merged.body,
|
|
2880
|
+
validator.body,
|
|
2881
|
+
vendors
|
|
2882
|
+
);
|
|
2883
|
+
if (validator.headers)
|
|
2884
|
+
merged.headers = mergeSchemaProperty(
|
|
2885
|
+
merged.headers,
|
|
2886
|
+
validator.headers,
|
|
2887
|
+
vendors
|
|
2888
|
+
);
|
|
2889
|
+
if (validator.query)
|
|
2890
|
+
merged.query = mergeSchemaProperty(
|
|
2891
|
+
merged.query,
|
|
2892
|
+
validator.query,
|
|
2893
|
+
vendors
|
|
2894
|
+
);
|
|
2895
|
+
if (validator.params)
|
|
2896
|
+
merged.params = mergeSchemaProperty(
|
|
2897
|
+
merged.params,
|
|
2898
|
+
validator.params,
|
|
2899
|
+
vendors
|
|
2900
|
+
);
|
|
2901
|
+
if (validator.cookie)
|
|
2902
|
+
merged.cookie = mergeSchemaProperty(
|
|
2903
|
+
merged.cookie,
|
|
2904
|
+
validator.cookie,
|
|
2905
|
+
vendors
|
|
2906
|
+
);
|
|
2907
|
+
if (validator.response)
|
|
2908
|
+
merged.response = mergeResponseSchema(
|
|
2909
|
+
merged.response,
|
|
2910
|
+
validator.response,
|
|
2911
|
+
vendors
|
|
2912
|
+
);
|
|
2913
|
+
}
|
|
2914
|
+
if (typeof merged.body === "string")
|
|
2915
|
+
merged.body = normalizeSchemaReference(merged.body);
|
|
2916
|
+
if (typeof merged.headers === "string")
|
|
2917
|
+
merged.headers = normalizeSchemaReference(merged.headers);
|
|
2918
|
+
if (typeof merged.query === "string")
|
|
2919
|
+
merged.query = normalizeSchemaReference(merged.query);
|
|
2920
|
+
if (typeof merged.params === "string")
|
|
2921
|
+
merged.params = normalizeSchemaReference(merged.params);
|
|
2922
|
+
if (typeof merged.cookie === "string")
|
|
2923
|
+
merged.cookie = normalizeSchemaReference(merged.cookie);
|
|
2924
|
+
if (merged.response && typeof merged.response !== "string") {
|
|
2925
|
+
const response = merged.response;
|
|
2926
|
+
if ("type" in response || "$ref" in response) {
|
|
2927
|
+
if (typeof response === "string")
|
|
2928
|
+
merged.response = normalizeSchemaReference(response);
|
|
2929
|
+
} else {
|
|
2930
|
+
for (const [status, schema] of Object.entries(response))
|
|
2931
|
+
if (typeof schema === "string")
|
|
2932
|
+
response[status] = normalizeSchemaReference(schema);
|
|
2933
|
+
}
|
|
2934
|
+
}
|
|
2935
|
+
return merged;
|
|
2936
|
+
};
|
|
2937
|
+
var flattenRoutes = (routes, vendors) => routes.map((route) => {
|
|
2938
|
+
if (!route.hooks?.standaloneValidator?.length) return route;
|
|
2939
|
+
return {
|
|
2940
|
+
...route,
|
|
2941
|
+
hooks: mergeStandaloneValidators(route.hooks, vendors)
|
|
2942
|
+
};
|
|
2943
|
+
});
|
|
2738
2944
|
var unwrapReference = (schema, definitions) => {
|
|
2739
2945
|
const ref = schema?.$ref;
|
|
2740
2946
|
if (!ref) return schema;
|
|
@@ -2742,13 +2948,15 @@ var unwrapReference = (schema, definitions) => {
|
|
|
2742
2948
|
if (ref && definitions[name]) schema = definitions[name];
|
|
2743
2949
|
return enumToOpenApi(schema);
|
|
2744
2950
|
};
|
|
2745
|
-
var unwrapSchema = (schema, mapJsonSchema) => {
|
|
2951
|
+
var unwrapSchema = (schema, mapJsonSchema, io = "input") => {
|
|
2746
2952
|
if (!schema) return;
|
|
2747
2953
|
if (typeof schema === "string") schema = toRef(schema);
|
|
2748
2954
|
if (Kind in schema) return enumToOpenApi(schema);
|
|
2749
2955
|
if (Kind in schema || !schema?.["~standard"]) return;
|
|
2750
2956
|
const vendor = schema["~standard"].vendor;
|
|
2751
2957
|
try {
|
|
2958
|
+
if (schema["~standard"]?.jsonSchema?.[io])
|
|
2959
|
+
return schema["~standard"]?.jsonSchema?.[io]?.();
|
|
2752
2960
|
if (mapJsonSchema?.[vendor] && typeof mapJsonSchema[vendor] === "function")
|
|
2753
2961
|
return enumToOpenApi(mapJsonSchema[vendor](schema));
|
|
2754
2962
|
switch (vendor) {
|
|
@@ -2843,7 +3051,6 @@ function toOpenAPISchema(app, exclude, references, vendors) {
|
|
|
2843
3051
|
const excludePaths = Array.isArray(exclude?.paths) ? exclude.paths : typeof exclude?.paths !== "undefined" ? [exclude.paths] : [];
|
|
2844
3052
|
const paths = /* @__PURE__ */ Object.create(null);
|
|
2845
3053
|
const definitions = app.getGlobalDefinitions?.().type;
|
|
2846
|
-
const routes = app.getGlobalRoutes();
|
|
2847
3054
|
if (references) {
|
|
2848
3055
|
if (!Array.isArray(references)) references = [references];
|
|
2849
3056
|
for (let i = 0; i < references.length; i++) {
|
|
@@ -2851,6 +3058,7 @@ function toOpenAPISchema(app, exclude, references, vendors) {
|
|
|
2851
3058
|
if (typeof reference === "function") references[i] = reference();
|
|
2852
3059
|
}
|
|
2853
3060
|
}
|
|
3061
|
+
const routes = flattenRoutes(app.getGlobalRoutes(), vendors);
|
|
2854
3062
|
for (const route of routes) {
|
|
2855
3063
|
if (route.hooks?.detail?.hide) continue;
|
|
2856
3064
|
const method = route.method.toLowerCase();
|
|
@@ -3040,7 +3248,7 @@ function toOpenAPISchema(app, exclude, references, vendors) {
|
|
|
3040
3248
|
if (typeof hooks.response === "object" && // TypeBox
|
|
3041
3249
|
!hooks.response.type && !hooks.response.$ref && !hooks.response["~standard"]) {
|
|
3042
3250
|
for (let [status, schema] of Object.entries(hooks.response)) {
|
|
3043
|
-
const response = unwrapSchema(schema, vendors);
|
|
3251
|
+
const response = unwrapSchema(schema, vendors, "output");
|
|
3044
3252
|
if (!response) continue;
|
|
3045
3253
|
const { type, description, $ref, ..._options } = unwrapReference(response, definitions);
|
|
3046
3254
|
operation.responses[status] = {
|
|
@@ -3057,7 +3265,7 @@ function toOpenAPISchema(app, exclude, references, vendors) {
|
|
|
3057
3265
|
};
|
|
3058
3266
|
}
|
|
3059
3267
|
} else {
|
|
3060
|
-
const response = unwrapSchema(hooks.response, vendors);
|
|
3268
|
+
const response = unwrapSchema(hooks.response, vendors, "output");
|
|
3061
3269
|
if (response) {
|
|
3062
3270
|
const {
|
|
3063
3271
|
type: _type,
|
|
@@ -3882,47 +4090,41 @@ function TypeBoxFromTypeBox(type) {
|
|
|
3882
4090
|
return CloneType(type);
|
|
3883
4091
|
}
|
|
3884
4092
|
|
|
3885
|
-
// node_modules/valibot/dist/index.
|
|
3886
|
-
var store;
|
|
4093
|
+
// node_modules/valibot/dist/index.mjs
|
|
4094
|
+
var store$4;
|
|
3887
4095
|
// @__NO_SIDE_EFFECTS__
|
|
3888
|
-
function getGlobalConfig(
|
|
4096
|
+
function getGlobalConfig(config$1) {
|
|
3889
4097
|
return {
|
|
3890
|
-
lang:
|
|
3891
|
-
message:
|
|
3892
|
-
abortEarly:
|
|
3893
|
-
abortPipeEarly:
|
|
4098
|
+
lang: config$1?.lang ?? store$4?.lang,
|
|
4099
|
+
message: config$1?.message,
|
|
4100
|
+
abortEarly: config$1?.abortEarly ?? store$4?.abortEarly,
|
|
4101
|
+
abortPipeEarly: config$1?.abortPipeEarly ?? store$4?.abortPipeEarly
|
|
3894
4102
|
};
|
|
3895
4103
|
}
|
|
3896
|
-
var
|
|
4104
|
+
var store$3;
|
|
3897
4105
|
// @__NO_SIDE_EFFECTS__
|
|
3898
4106
|
function getGlobalMessage(lang) {
|
|
3899
|
-
return
|
|
4107
|
+
return store$3?.get(lang);
|
|
3900
4108
|
}
|
|
3901
|
-
var
|
|
4109
|
+
var store$2;
|
|
3902
4110
|
// @__NO_SIDE_EFFECTS__
|
|
3903
4111
|
function getSchemaMessage(lang) {
|
|
3904
|
-
return
|
|
4112
|
+
return store$2?.get(lang);
|
|
3905
4113
|
}
|
|
3906
|
-
var
|
|
4114
|
+
var store$1;
|
|
3907
4115
|
// @__NO_SIDE_EFFECTS__
|
|
3908
4116
|
function getSpecificMessage(reference, lang) {
|
|
3909
|
-
return
|
|
4117
|
+
return store$1?.get(reference)?.get(lang);
|
|
3910
4118
|
}
|
|
3911
4119
|
// @__NO_SIDE_EFFECTS__
|
|
3912
4120
|
function _stringify(input) {
|
|
3913
4121
|
const type = typeof input;
|
|
3914
|
-
if (type === "string") {
|
|
3915
|
-
|
|
3916
|
-
|
|
3917
|
-
if (type === "number" || type === "bigint" || type === "boolean") {
|
|
3918
|
-
return `${input}`;
|
|
3919
|
-
}
|
|
3920
|
-
if (type === "object" || type === "function") {
|
|
3921
|
-
return (input && Object.getPrototypeOf(input)?.constructor?.name) ?? "null";
|
|
3922
|
-
}
|
|
4122
|
+
if (type === "string") return `"${input}"`;
|
|
4123
|
+
if (type === "number" || type === "bigint" || type === "boolean") return `${input}`;
|
|
4124
|
+
if (type === "object" || type === "function") return (input && Object.getPrototypeOf(input)?.constructor?.name) ?? "null";
|
|
3923
4125
|
return type;
|
|
3924
4126
|
}
|
|
3925
|
-
function _addIssue(context, label, dataset,
|
|
4127
|
+
function _addIssue(context, label, dataset, config$1, other) {
|
|
3926
4128
|
const input = other && "input" in other ? other.input : dataset.value;
|
|
3927
4129
|
const expected = other?.expected ?? context.expects ?? null;
|
|
3928
4130
|
const received = other?.received ?? /* @__PURE__ */ _stringify(input);
|
|
@@ -3936,48 +4138,49 @@ function _addIssue(context, label, dataset, config2, other) {
|
|
|
3936
4138
|
requirement: context.requirement,
|
|
3937
4139
|
path: other?.path,
|
|
3938
4140
|
issues: other?.issues,
|
|
3939
|
-
lang:
|
|
3940
|
-
abortEarly:
|
|
3941
|
-
abortPipeEarly:
|
|
4141
|
+
lang: config$1.lang,
|
|
4142
|
+
abortEarly: config$1.abortEarly,
|
|
4143
|
+
abortPipeEarly: config$1.abortPipeEarly
|
|
3942
4144
|
};
|
|
3943
4145
|
const isSchema = context.kind === "schema";
|
|
3944
|
-
const
|
|
3945
|
-
if (
|
|
3946
|
-
|
|
3947
|
-
|
|
3948
|
-
|
|
3949
|
-
) : message2;
|
|
3950
|
-
}
|
|
3951
|
-
if (isSchema) {
|
|
3952
|
-
dataset.typed = false;
|
|
3953
|
-
}
|
|
3954
|
-
if (dataset.issues) {
|
|
3955
|
-
dataset.issues.push(issue2);
|
|
3956
|
-
} else {
|
|
3957
|
-
dataset.issues = [issue2];
|
|
3958
|
-
}
|
|
4146
|
+
const message$1 = other?.message ?? context.message ?? /* @__PURE__ */ getSpecificMessage(context.reference, issue2.lang) ?? (isSchema ? /* @__PURE__ */ getSchemaMessage(issue2.lang) : null) ?? config$1.message ?? /* @__PURE__ */ getGlobalMessage(issue2.lang);
|
|
4147
|
+
if (message$1 !== void 0) issue2.message = typeof message$1 === "function" ? message$1(issue2) : message$1;
|
|
4148
|
+
if (isSchema) dataset.typed = false;
|
|
4149
|
+
if (dataset.issues) dataset.issues.push(issue2);
|
|
4150
|
+
else dataset.issues = [issue2];
|
|
3959
4151
|
}
|
|
3960
4152
|
// @__NO_SIDE_EFFECTS__
|
|
3961
4153
|
function _getStandardProps(context) {
|
|
3962
4154
|
return {
|
|
3963
4155
|
version: 1,
|
|
3964
4156
|
vendor: "valibot",
|
|
3965
|
-
validate(
|
|
3966
|
-
return context["~run"]({ value:
|
|
4157
|
+
validate(value$1) {
|
|
4158
|
+
return context["~run"]({ value: value$1 }, /* @__PURE__ */ getGlobalConfig());
|
|
3967
4159
|
}
|
|
3968
4160
|
};
|
|
3969
4161
|
}
|
|
3970
4162
|
var NON_DIGIT_REGEX = /\D/gu;
|
|
3971
4163
|
// @__NO_SIDE_EFFECTS__
|
|
3972
4164
|
function _isLuhnAlgo(input) {
|
|
3973
|
-
const
|
|
3974
|
-
let
|
|
4165
|
+
const number$1 = input.replace(NON_DIGIT_REGEX, "");
|
|
4166
|
+
let length$1 = number$1.length;
|
|
3975
4167
|
let bit = 1;
|
|
3976
4168
|
let sum = 0;
|
|
3977
|
-
while (
|
|
3978
|
-
const
|
|
4169
|
+
while (length$1) {
|
|
4170
|
+
const value$1 = +number$1[--length$1];
|
|
3979
4171
|
bit ^= 1;
|
|
3980
|
-
sum += bit ? [
|
|
4172
|
+
sum += bit ? [
|
|
4173
|
+
0,
|
|
4174
|
+
2,
|
|
4175
|
+
4,
|
|
4176
|
+
6,
|
|
4177
|
+
8,
|
|
4178
|
+
1,
|
|
4179
|
+
3,
|
|
4180
|
+
5,
|
|
4181
|
+
7,
|
|
4182
|
+
9
|
|
4183
|
+
][value$1] : value$1;
|
|
3981
4184
|
}
|
|
3982
4185
|
return sum % 10 === 0;
|
|
3983
4186
|
}
|
|
@@ -3987,14 +4190,8 @@ var CUID2_REGEX = /^[a-z][\da-z]*$/u;
|
|
|
3987
4190
|
var DECIMAL_REGEX = /^[+-]?(?:\d*\.)?\d+$/u;
|
|
3988
4191
|
var DIGITS_REGEX = /^\d+$/u;
|
|
3989
4192
|
var EMAIL_REGEX = /^[\w+-]+(?:\.[\w+-]+)*@[\da-z]+(?:[.-][\da-z]+)*\.[a-z]{2,}$/iu;
|
|
3990
|
-
var EMOJI_REGEX = (
|
|
3991
|
-
|
|
3992
|
-
new RegExp("^(?:[\\u{1F1E6}-\\u{1F1FF}]{2}|\\u{1F3F4}[\\u{E0061}-\\u{E007A}]{2}[\\u{E0030}-\\u{E0039}\\u{E0061}-\\u{E007A}]{1,3}\\u{E007F}|(?:\\p{Emoji}\\uFE0F\\u20E3?|\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|\\p{Emoji_Presentation})(?:\\u200D(?:\\p{Emoji}\\uFE0F\\u20E3?|\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|\\p{Emoji_Presentation}))*)+$", "u")
|
|
3993
|
-
);
|
|
3994
|
-
var IPV4_REGEX = (
|
|
3995
|
-
// eslint-disable-next-line redos-detector/no-unsafe-regex -- false positive
|
|
3996
|
-
/^(?:(?:[1-9]|1\d|2[0-4])?\d|25[0-5])(?:\.(?:(?:[1-9]|1\d|2[0-4])?\d|25[0-5])){3}$/u
|
|
3997
|
-
);
|
|
4193
|
+
var EMOJI_REGEX = new RegExp("^(?:[\\u{1F1E6}-\\u{1F1FF}]{2}|\\u{1F3F4}[\\u{E0061}-\\u{E007A}]{2}[\\u{E0030}-\\u{E0039}\\u{E0061}-\\u{E007A}]{1,3}\\u{E007F}|(?:\\p{Emoji}\\uFE0F\\u20E3?|\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|(?![\\p{Emoji_Modifier_Base}\\u{1F1E6}-\\u{1F1FF}])\\p{Emoji_Presentation})(?:\\u200D(?:\\p{Emoji}\\uFE0F\\u20E3?|\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|(?![\\p{Emoji_Modifier_Base}\\u{1F1E6}-\\u{1F1FF}])\\p{Emoji_Presentation}))*)+$", "u");
|
|
4194
|
+
var IPV4_REGEX = /^(?:(?:[1-9]|1\d|2[0-4])?\d|25[0-5])(?:\.(?:(?:[1-9]|1\d|2[0-4])?\d|25[0-5])){3}$/u;
|
|
3998
4195
|
var IPV6_REGEX = /^(?:(?:[\da-f]{1,4}:){7}[\da-f]{1,4}|(?:[\da-f]{1,4}:){1,7}:|(?:[\da-f]{1,4}:){1,6}:[\da-f]{1,4}|(?:[\da-f]{1,4}:){1,5}(?::[\da-f]{1,4}){1,2}|(?:[\da-f]{1,4}:){1,4}(?::[\da-f]{1,4}){1,3}|(?:[\da-f]{1,4}:){1,3}(?::[\da-f]{1,4}){1,4}|(?:[\da-f]{1,4}:){1,2}(?::[\da-f]{1,4}){1,5}|[\da-f]{1,4}:(?::[\da-f]{1,4}){1,6}|:(?:(?::[\da-f]{1,4}){1,7}|:)|fe80:(?::[\da-f]{0,4}){0,4}%[\da-z]+|::(?:f{4}(?::0{1,4})?:)?(?:(?:25[0-5]|(?:2[0-4]|1?\d)?\d)\.){3}(?:25[0-5]|(?:2[0-4]|1?\d)?\d)|(?:[\da-f]{1,4}:){1,4}:(?:(?:25[0-5]|(?:2[0-4]|1?\d)?\d)\.){3}(?:25[0-5]|(?:2[0-4]|1?\d)?\d))$/iu;
|
|
3999
4196
|
var IP_REGEX = /^(?:(?:[1-9]|1\d|2[0-4])?\d|25[0-5])(?:\.(?:(?:[1-9]|1\d|2[0-4])?\d|25[0-5])){3}$|^(?:(?:[\da-f]{1,4}:){7}[\da-f]{1,4}|(?:[\da-f]{1,4}:){1,7}:|(?:[\da-f]{1,4}:){1,6}:[\da-f]{1,4}|(?:[\da-f]{1,4}:){1,5}(?::[\da-f]{1,4}){1,2}|(?:[\da-f]{1,4}:){1,4}(?::[\da-f]{1,4}){1,3}|(?:[\da-f]{1,4}:){1,3}(?::[\da-f]{1,4}){1,4}|(?:[\da-f]{1,4}:){1,2}(?::[\da-f]{1,4}){1,5}|[\da-f]{1,4}:(?::[\da-f]{1,4}){1,6}|:(?:(?::[\da-f]{1,4}){1,7}|:)|fe80:(?::[\da-f]{0,4}){0,4}%[\da-z]+|::(?:f{4}(?::0{1,4})?:)?(?:(?:25[0-5]|(?:2[0-4]|1?\d)?\d)\.){3}(?:25[0-5]|(?:2[0-4]|1?\d)?\d)|(?:[\da-f]{1,4}:){1,4}:(?:(?:25[0-5]|(?:2[0-4]|1?\d)?\d)\.){3}(?:25[0-5]|(?:2[0-4]|1?\d)?\d))$/iu;
|
|
4000
4197
|
var ISO_DATE_REGEX = /^\d{4}-(?:0[1-9]|1[0-2])-(?:[12]\d|0[1-9]|3[01])$/u;
|
|
@@ -4011,7 +4208,7 @@ var OCTAL_REGEX = /^(?:0o)?[0-7]+$/u;
|
|
|
4011
4208
|
var ULID_REGEX = /^[\da-hjkmnp-tv-zA-HJKMNP-TV-Z]{26}$/u;
|
|
4012
4209
|
var UUID_REGEX = /^[\da-f]{8}(?:-[\da-f]{4}){3}-[\da-f]{12}$/iu;
|
|
4013
4210
|
// @__NO_SIDE_EFFECTS__
|
|
4014
|
-
function base64(
|
|
4211
|
+
function base64(message$1) {
|
|
4015
4212
|
return {
|
|
4016
4213
|
kind: "validation",
|
|
4017
4214
|
type: "base64",
|
|
@@ -4019,17 +4216,15 @@ function base64(message2) {
|
|
|
4019
4216
|
async: false,
|
|
4020
4217
|
expects: null,
|
|
4021
4218
|
requirement: BASE64_REGEX,
|
|
4022
|
-
message:
|
|
4023
|
-
"~run"(dataset,
|
|
4024
|
-
if (dataset.typed && !this.requirement.test(dataset.value))
|
|
4025
|
-
_addIssue(this, "Base64", dataset, config2);
|
|
4026
|
-
}
|
|
4219
|
+
message: message$1,
|
|
4220
|
+
"~run"(dataset, config$1) {
|
|
4221
|
+
if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "Base64", dataset, config$1);
|
|
4027
4222
|
return dataset;
|
|
4028
4223
|
}
|
|
4029
4224
|
};
|
|
4030
4225
|
}
|
|
4031
4226
|
// @__NO_SIDE_EFFECTS__
|
|
4032
|
-
function bic(
|
|
4227
|
+
function bic(message$1) {
|
|
4033
4228
|
return {
|
|
4034
4229
|
kind: "validation",
|
|
4035
4230
|
type: "bic",
|
|
@@ -4037,11 +4232,9 @@ function bic(message2) {
|
|
|
4037
4232
|
async: false,
|
|
4038
4233
|
expects: null,
|
|
4039
4234
|
requirement: BIC_REGEX,
|
|
4040
|
-
message:
|
|
4041
|
-
"~run"(dataset,
|
|
4042
|
-
if (dataset.typed && !this.requirement.test(dataset.value))
|
|
4043
|
-
_addIssue(this, "BIC", dataset, config2);
|
|
4044
|
-
}
|
|
4235
|
+
message: message$1,
|
|
4236
|
+
"~run"(dataset, config$1) {
|
|
4237
|
+
if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "BIC", dataset, config$1);
|
|
4045
4238
|
return dataset;
|
|
4046
4239
|
}
|
|
4047
4240
|
};
|
|
@@ -4049,24 +4242,16 @@ function bic(message2) {
|
|
|
4049
4242
|
var CREDIT_CARD_REGEX = /^(?:\d{14,19}|\d{4}(?: \d{3,6}){2,4}|\d{4}(?:-\d{3,6}){2,4})$/u;
|
|
4050
4243
|
var SANITIZE_REGEX = /[- ]/gu;
|
|
4051
4244
|
var PROVIDER_REGEX_LIST = [
|
|
4052
|
-
// American Express
|
|
4053
4245
|
/^3[47]\d{13}$/u,
|
|
4054
|
-
// Diners Club
|
|
4055
4246
|
/^3(?:0[0-5]|[68]\d)\d{11,13}$/u,
|
|
4056
|
-
// Discover
|
|
4057
4247
|
/^6(?:011|5\d{2})\d{12,15}$/u,
|
|
4058
|
-
// JCB
|
|
4059
4248
|
/^(?:2131|1800|35\d{3})\d{11}$/u,
|
|
4060
|
-
// Mastercard
|
|
4061
|
-
// eslint-disable-next-line redos-detector/no-unsafe-regex
|
|
4062
4249
|
/^5[1-5]\d{2}|(?:222\d|22[3-9]\d|2[3-6]\d{2}|27[01]\d|2720)\d{12}$/u,
|
|
4063
|
-
// UnionPay
|
|
4064
4250
|
/^(?:6[27]\d{14,17}|81\d{14,17})$/u,
|
|
4065
|
-
// Visa
|
|
4066
4251
|
/^4\d{12}(?:\d{3,6})?$/u
|
|
4067
4252
|
];
|
|
4068
4253
|
// @__NO_SIDE_EFFECTS__
|
|
4069
|
-
function creditCard(
|
|
4254
|
+
function creditCard(message$1) {
|
|
4070
4255
|
return {
|
|
4071
4256
|
kind: "validation",
|
|
4072
4257
|
type: "credit_card",
|
|
@@ -4075,22 +4260,17 @@ function creditCard(message2) {
|
|
|
4075
4260
|
expects: null,
|
|
4076
4261
|
requirement(input) {
|
|
4077
4262
|
let sanitized;
|
|
4078
|
-
return CREDIT_CARD_REGEX.test(input) &&
|
|
4079
|
-
(sanitized = input.replace(SANITIZE_REGEX, "")) && // Check if it matches a provider
|
|
4080
|
-
PROVIDER_REGEX_LIST.some((regex2) => regex2.test(sanitized)) && // Check if passes luhn algorithm
|
|
4081
|
-
/* @__PURE__ */ _isLuhnAlgo(sanitized);
|
|
4263
|
+
return CREDIT_CARD_REGEX.test(input) && (sanitized = input.replace(SANITIZE_REGEX, "")) && PROVIDER_REGEX_LIST.some((regex$1) => regex$1.test(sanitized)) && /* @__PURE__ */ _isLuhnAlgo(sanitized);
|
|
4082
4264
|
},
|
|
4083
|
-
message:
|
|
4084
|
-
"~run"(dataset,
|
|
4085
|
-
if (dataset.typed && !this.requirement(dataset.value))
|
|
4086
|
-
_addIssue(this, "credit card", dataset, config2);
|
|
4087
|
-
}
|
|
4265
|
+
message: message$1,
|
|
4266
|
+
"~run"(dataset, config$1) {
|
|
4267
|
+
if (dataset.typed && !this.requirement(dataset.value)) _addIssue(this, "credit card", dataset, config$1);
|
|
4088
4268
|
return dataset;
|
|
4089
4269
|
}
|
|
4090
4270
|
};
|
|
4091
4271
|
}
|
|
4092
4272
|
// @__NO_SIDE_EFFECTS__
|
|
4093
|
-
function cuid2(
|
|
4273
|
+
function cuid2(message$1) {
|
|
4094
4274
|
return {
|
|
4095
4275
|
kind: "validation",
|
|
4096
4276
|
type: "cuid2",
|
|
@@ -4098,17 +4278,15 @@ function cuid2(message2) {
|
|
|
4098
4278
|
async: false,
|
|
4099
4279
|
expects: null,
|
|
4100
4280
|
requirement: CUID2_REGEX,
|
|
4101
|
-
message:
|
|
4102
|
-
"~run"(dataset,
|
|
4103
|
-
if (dataset.typed && !this.requirement.test(dataset.value))
|
|
4104
|
-
_addIssue(this, "Cuid2", dataset, config2);
|
|
4105
|
-
}
|
|
4281
|
+
message: message$1,
|
|
4282
|
+
"~run"(dataset, config$1) {
|
|
4283
|
+
if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "Cuid2", dataset, config$1);
|
|
4106
4284
|
return dataset;
|
|
4107
4285
|
}
|
|
4108
4286
|
};
|
|
4109
4287
|
}
|
|
4110
4288
|
// @__NO_SIDE_EFFECTS__
|
|
4111
|
-
function decimal(
|
|
4289
|
+
function decimal(message$1) {
|
|
4112
4290
|
return {
|
|
4113
4291
|
kind: "validation",
|
|
4114
4292
|
type: "decimal",
|
|
@@ -4116,17 +4294,15 @@ function decimal(message2) {
|
|
|
4116
4294
|
async: false,
|
|
4117
4295
|
expects: null,
|
|
4118
4296
|
requirement: DECIMAL_REGEX,
|
|
4119
|
-
message:
|
|
4120
|
-
"~run"(dataset,
|
|
4121
|
-
if (dataset.typed && !this.requirement.test(dataset.value))
|
|
4122
|
-
_addIssue(this, "decimal", dataset, config2);
|
|
4123
|
-
}
|
|
4297
|
+
message: message$1,
|
|
4298
|
+
"~run"(dataset, config$1) {
|
|
4299
|
+
if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "decimal", dataset, config$1);
|
|
4124
4300
|
return dataset;
|
|
4125
4301
|
}
|
|
4126
4302
|
};
|
|
4127
4303
|
}
|
|
4128
4304
|
// @__NO_SIDE_EFFECTS__
|
|
4129
|
-
function digits(
|
|
4305
|
+
function digits(message$1) {
|
|
4130
4306
|
return {
|
|
4131
4307
|
kind: "validation",
|
|
4132
4308
|
type: "digits",
|
|
@@ -4134,17 +4310,15 @@ function digits(message2) {
|
|
|
4134
4310
|
async: false,
|
|
4135
4311
|
expects: null,
|
|
4136
4312
|
requirement: DIGITS_REGEX,
|
|
4137
|
-
message:
|
|
4138
|
-
"~run"(dataset,
|
|
4139
|
-
if (dataset.typed && !this.requirement.test(dataset.value))
|
|
4140
|
-
_addIssue(this, "digits", dataset, config2);
|
|
4141
|
-
}
|
|
4313
|
+
message: message$1,
|
|
4314
|
+
"~run"(dataset, config$1) {
|
|
4315
|
+
if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "digits", dataset, config$1);
|
|
4142
4316
|
return dataset;
|
|
4143
4317
|
}
|
|
4144
4318
|
};
|
|
4145
4319
|
}
|
|
4146
4320
|
// @__NO_SIDE_EFFECTS__
|
|
4147
|
-
function email(
|
|
4321
|
+
function email(message$1) {
|
|
4148
4322
|
return {
|
|
4149
4323
|
kind: "validation",
|
|
4150
4324
|
type: "email",
|
|
@@ -4152,17 +4326,15 @@ function email(message2) {
|
|
|
4152
4326
|
expects: null,
|
|
4153
4327
|
async: false,
|
|
4154
4328
|
requirement: EMAIL_REGEX,
|
|
4155
|
-
message:
|
|
4156
|
-
"~run"(dataset,
|
|
4157
|
-
if (dataset.typed && !this.requirement.test(dataset.value))
|
|
4158
|
-
_addIssue(this, "email", dataset, config2);
|
|
4159
|
-
}
|
|
4329
|
+
message: message$1,
|
|
4330
|
+
"~run"(dataset, config$1) {
|
|
4331
|
+
if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "email", dataset, config$1);
|
|
4160
4332
|
return dataset;
|
|
4161
4333
|
}
|
|
4162
4334
|
};
|
|
4163
4335
|
}
|
|
4164
4336
|
// @__NO_SIDE_EFFECTS__
|
|
4165
|
-
function emoji(
|
|
4337
|
+
function emoji(message$1) {
|
|
4166
4338
|
return {
|
|
4167
4339
|
kind: "validation",
|
|
4168
4340
|
type: "emoji",
|
|
@@ -4170,17 +4342,15 @@ function emoji(message2) {
|
|
|
4170
4342
|
async: false,
|
|
4171
4343
|
expects: null,
|
|
4172
4344
|
requirement: EMOJI_REGEX,
|
|
4173
|
-
message:
|
|
4174
|
-
"~run"(dataset,
|
|
4175
|
-
if (dataset.typed && !this.requirement.test(dataset.value))
|
|
4176
|
-
_addIssue(this, "emoji", dataset, config2);
|
|
4177
|
-
}
|
|
4345
|
+
message: message$1,
|
|
4346
|
+
"~run"(dataset, config$1) {
|
|
4347
|
+
if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "emoji", dataset, config$1);
|
|
4178
4348
|
return dataset;
|
|
4179
4349
|
}
|
|
4180
4350
|
};
|
|
4181
4351
|
}
|
|
4182
4352
|
// @__NO_SIDE_EFFECTS__
|
|
4183
|
-
function ip(
|
|
4353
|
+
function ip(message$1) {
|
|
4184
4354
|
return {
|
|
4185
4355
|
kind: "validation",
|
|
4186
4356
|
type: "ip",
|
|
@@ -4188,17 +4358,15 @@ function ip(message2) {
|
|
|
4188
4358
|
async: false,
|
|
4189
4359
|
expects: null,
|
|
4190
4360
|
requirement: IP_REGEX,
|
|
4191
|
-
message:
|
|
4192
|
-
"~run"(dataset,
|
|
4193
|
-
if (dataset.typed && !this.requirement.test(dataset.value))
|
|
4194
|
-
_addIssue(this, "IP", dataset, config2);
|
|
4195
|
-
}
|
|
4361
|
+
message: message$1,
|
|
4362
|
+
"~run"(dataset, config$1) {
|
|
4363
|
+
if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "IP", dataset, config$1);
|
|
4196
4364
|
return dataset;
|
|
4197
4365
|
}
|
|
4198
4366
|
};
|
|
4199
4367
|
}
|
|
4200
4368
|
// @__NO_SIDE_EFFECTS__
|
|
4201
|
-
function ipv4(
|
|
4369
|
+
function ipv4(message$1) {
|
|
4202
4370
|
return {
|
|
4203
4371
|
kind: "validation",
|
|
4204
4372
|
type: "ipv4",
|
|
@@ -4206,17 +4374,15 @@ function ipv4(message2) {
|
|
|
4206
4374
|
async: false,
|
|
4207
4375
|
expects: null,
|
|
4208
4376
|
requirement: IPV4_REGEX,
|
|
4209
|
-
message:
|
|
4210
|
-
"~run"(dataset,
|
|
4211
|
-
if (dataset.typed && !this.requirement.test(dataset.value))
|
|
4212
|
-
_addIssue(this, "IPv4", dataset, config2);
|
|
4213
|
-
}
|
|
4377
|
+
message: message$1,
|
|
4378
|
+
"~run"(dataset, config$1) {
|
|
4379
|
+
if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "IPv4", dataset, config$1);
|
|
4214
4380
|
return dataset;
|
|
4215
4381
|
}
|
|
4216
4382
|
};
|
|
4217
4383
|
}
|
|
4218
4384
|
// @__NO_SIDE_EFFECTS__
|
|
4219
|
-
function ipv6(
|
|
4385
|
+
function ipv6(message$1) {
|
|
4220
4386
|
return {
|
|
4221
4387
|
kind: "validation",
|
|
4222
4388
|
type: "ipv6",
|
|
@@ -4224,17 +4390,15 @@ function ipv6(message2) {
|
|
|
4224
4390
|
async: false,
|
|
4225
4391
|
expects: null,
|
|
4226
4392
|
requirement: IPV6_REGEX,
|
|
4227
|
-
message:
|
|
4228
|
-
"~run"(dataset,
|
|
4229
|
-
if (dataset.typed && !this.requirement.test(dataset.value))
|
|
4230
|
-
_addIssue(this, "IPv6", dataset, config2);
|
|
4231
|
-
}
|
|
4393
|
+
message: message$1,
|
|
4394
|
+
"~run"(dataset, config$1) {
|
|
4395
|
+
if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "IPv6", dataset, config$1);
|
|
4232
4396
|
return dataset;
|
|
4233
4397
|
}
|
|
4234
4398
|
};
|
|
4235
4399
|
}
|
|
4236
4400
|
// @__NO_SIDE_EFFECTS__
|
|
4237
|
-
function isoDate(
|
|
4401
|
+
function isoDate(message$1) {
|
|
4238
4402
|
return {
|
|
4239
4403
|
kind: "validation",
|
|
4240
4404
|
type: "iso_date",
|
|
@@ -4242,17 +4406,15 @@ function isoDate(message2) {
|
|
|
4242
4406
|
async: false,
|
|
4243
4407
|
expects: null,
|
|
4244
4408
|
requirement: ISO_DATE_REGEX,
|
|
4245
|
-
message:
|
|
4246
|
-
"~run"(dataset,
|
|
4247
|
-
if (dataset.typed && !this.requirement.test(dataset.value))
|
|
4248
|
-
_addIssue(this, "date", dataset, config2);
|
|
4249
|
-
}
|
|
4409
|
+
message: message$1,
|
|
4410
|
+
"~run"(dataset, config$1) {
|
|
4411
|
+
if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "date", dataset, config$1);
|
|
4250
4412
|
return dataset;
|
|
4251
4413
|
}
|
|
4252
4414
|
};
|
|
4253
4415
|
}
|
|
4254
4416
|
// @__NO_SIDE_EFFECTS__
|
|
4255
|
-
function isoDateTime(
|
|
4417
|
+
function isoDateTime(message$1) {
|
|
4256
4418
|
return {
|
|
4257
4419
|
kind: "validation",
|
|
4258
4420
|
type: "iso_date_time",
|
|
@@ -4260,17 +4422,15 @@ function isoDateTime(message2) {
|
|
|
4260
4422
|
async: false,
|
|
4261
4423
|
expects: null,
|
|
4262
4424
|
requirement: ISO_DATE_TIME_REGEX,
|
|
4263
|
-
message:
|
|
4264
|
-
"~run"(dataset,
|
|
4265
|
-
if (dataset.typed && !this.requirement.test(dataset.value))
|
|
4266
|
-
_addIssue(this, "date-time", dataset, config2);
|
|
4267
|
-
}
|
|
4425
|
+
message: message$1,
|
|
4426
|
+
"~run"(dataset, config$1) {
|
|
4427
|
+
if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "date-time", dataset, config$1);
|
|
4268
4428
|
return dataset;
|
|
4269
4429
|
}
|
|
4270
4430
|
};
|
|
4271
4431
|
}
|
|
4272
4432
|
// @__NO_SIDE_EFFECTS__
|
|
4273
|
-
function isoTime(
|
|
4433
|
+
function isoTime(message$1) {
|
|
4274
4434
|
return {
|
|
4275
4435
|
kind: "validation",
|
|
4276
4436
|
type: "iso_time",
|
|
@@ -4278,17 +4438,15 @@ function isoTime(message2) {
|
|
|
4278
4438
|
async: false,
|
|
4279
4439
|
expects: null,
|
|
4280
4440
|
requirement: ISO_TIME_REGEX,
|
|
4281
|
-
message:
|
|
4282
|
-
"~run"(dataset,
|
|
4283
|
-
if (dataset.typed && !this.requirement.test(dataset.value))
|
|
4284
|
-
_addIssue(this, "time", dataset, config2);
|
|
4285
|
-
}
|
|
4441
|
+
message: message$1,
|
|
4442
|
+
"~run"(dataset, config$1) {
|
|
4443
|
+
if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "time", dataset, config$1);
|
|
4286
4444
|
return dataset;
|
|
4287
4445
|
}
|
|
4288
4446
|
};
|
|
4289
4447
|
}
|
|
4290
4448
|
// @__NO_SIDE_EFFECTS__
|
|
4291
|
-
function isoTimeSecond(
|
|
4449
|
+
function isoTimeSecond(message$1) {
|
|
4292
4450
|
return {
|
|
4293
4451
|
kind: "validation",
|
|
4294
4452
|
type: "iso_time_second",
|
|
@@ -4296,17 +4454,15 @@ function isoTimeSecond(message2) {
|
|
|
4296
4454
|
async: false,
|
|
4297
4455
|
expects: null,
|
|
4298
4456
|
requirement: ISO_TIME_SECOND_REGEX,
|
|
4299
|
-
message:
|
|
4300
|
-
"~run"(dataset,
|
|
4301
|
-
if (dataset.typed && !this.requirement.test(dataset.value))
|
|
4302
|
-
_addIssue(this, "time-second", dataset, config2);
|
|
4303
|
-
}
|
|
4457
|
+
message: message$1,
|
|
4458
|
+
"~run"(dataset, config$1) {
|
|
4459
|
+
if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "time-second", dataset, config$1);
|
|
4304
4460
|
return dataset;
|
|
4305
4461
|
}
|
|
4306
4462
|
};
|
|
4307
4463
|
}
|
|
4308
4464
|
// @__NO_SIDE_EFFECTS__
|
|
4309
|
-
function isoTimestamp(
|
|
4465
|
+
function isoTimestamp(message$1) {
|
|
4310
4466
|
return {
|
|
4311
4467
|
kind: "validation",
|
|
4312
4468
|
type: "iso_timestamp",
|
|
@@ -4314,17 +4470,15 @@ function isoTimestamp(message2) {
|
|
|
4314
4470
|
async: false,
|
|
4315
4471
|
expects: null,
|
|
4316
4472
|
requirement: ISO_TIMESTAMP_REGEX,
|
|
4317
|
-
message:
|
|
4318
|
-
"~run"(dataset,
|
|
4319
|
-
if (dataset.typed && !this.requirement.test(dataset.value))
|
|
4320
|
-
_addIssue(this, "timestamp", dataset, config2);
|
|
4321
|
-
}
|
|
4473
|
+
message: message$1,
|
|
4474
|
+
"~run"(dataset, config$1) {
|
|
4475
|
+
if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "timestamp", dataset, config$1);
|
|
4322
4476
|
return dataset;
|
|
4323
4477
|
}
|
|
4324
4478
|
};
|
|
4325
4479
|
}
|
|
4326
4480
|
// @__NO_SIDE_EFFECTS__
|
|
4327
|
-
function isoWeek(
|
|
4481
|
+
function isoWeek(message$1) {
|
|
4328
4482
|
return {
|
|
4329
4483
|
kind: "validation",
|
|
4330
4484
|
type: "iso_week",
|
|
@@ -4332,17 +4486,15 @@ function isoWeek(message2) {
|
|
|
4332
4486
|
async: false,
|
|
4333
4487
|
expects: null,
|
|
4334
4488
|
requirement: ISO_WEEK_REGEX,
|
|
4335
|
-
message:
|
|
4336
|
-
"~run"(dataset,
|
|
4337
|
-
if (dataset.typed && !this.requirement.test(dataset.value))
|
|
4338
|
-
_addIssue(this, "week", dataset, config2);
|
|
4339
|
-
}
|
|
4489
|
+
message: message$1,
|
|
4490
|
+
"~run"(dataset, config$1) {
|
|
4491
|
+
if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "week", dataset, config$1);
|
|
4340
4492
|
return dataset;
|
|
4341
4493
|
}
|
|
4342
4494
|
};
|
|
4343
4495
|
}
|
|
4344
4496
|
// @__NO_SIDE_EFFECTS__
|
|
4345
|
-
function mac(
|
|
4497
|
+
function mac(message$1) {
|
|
4346
4498
|
return {
|
|
4347
4499
|
kind: "validation",
|
|
4348
4500
|
type: "mac",
|
|
@@ -4350,17 +4502,15 @@ function mac(message2) {
|
|
|
4350
4502
|
async: false,
|
|
4351
4503
|
expects: null,
|
|
4352
4504
|
requirement: MAC_REGEX,
|
|
4353
|
-
message:
|
|
4354
|
-
"~run"(dataset,
|
|
4355
|
-
if (dataset.typed && !this.requirement.test(dataset.value))
|
|
4356
|
-
_addIssue(this, "MAC", dataset, config2);
|
|
4357
|
-
}
|
|
4505
|
+
message: message$1,
|
|
4506
|
+
"~run"(dataset, config$1) {
|
|
4507
|
+
if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "MAC", dataset, config$1);
|
|
4358
4508
|
return dataset;
|
|
4359
4509
|
}
|
|
4360
4510
|
};
|
|
4361
4511
|
}
|
|
4362
4512
|
// @__NO_SIDE_EFFECTS__
|
|
4363
|
-
function mac48(
|
|
4513
|
+
function mac48(message$1) {
|
|
4364
4514
|
return {
|
|
4365
4515
|
kind: "validation",
|
|
4366
4516
|
type: "mac48",
|
|
@@ -4368,17 +4518,15 @@ function mac48(message2) {
|
|
|
4368
4518
|
async: false,
|
|
4369
4519
|
expects: null,
|
|
4370
4520
|
requirement: MAC48_REGEX,
|
|
4371
|
-
message:
|
|
4372
|
-
"~run"(dataset,
|
|
4373
|
-
if (dataset.typed && !this.requirement.test(dataset.value))
|
|
4374
|
-
_addIssue(this, "48-bit MAC", dataset, config2);
|
|
4375
|
-
}
|
|
4521
|
+
message: message$1,
|
|
4522
|
+
"~run"(dataset, config$1) {
|
|
4523
|
+
if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "48-bit MAC", dataset, config$1);
|
|
4376
4524
|
return dataset;
|
|
4377
4525
|
}
|
|
4378
4526
|
};
|
|
4379
4527
|
}
|
|
4380
4528
|
// @__NO_SIDE_EFFECTS__
|
|
4381
|
-
function mac64(
|
|
4529
|
+
function mac64(message$1) {
|
|
4382
4530
|
return {
|
|
4383
4531
|
kind: "validation",
|
|
4384
4532
|
type: "mac64",
|
|
@@ -4386,17 +4534,15 @@ function mac64(message2) {
|
|
|
4386
4534
|
async: false,
|
|
4387
4535
|
expects: null,
|
|
4388
4536
|
requirement: MAC64_REGEX,
|
|
4389
|
-
message:
|
|
4390
|
-
"~run"(dataset,
|
|
4391
|
-
if (dataset.typed && !this.requirement.test(dataset.value))
|
|
4392
|
-
_addIssue(this, "64-bit MAC", dataset, config2);
|
|
4393
|
-
}
|
|
4537
|
+
message: message$1,
|
|
4538
|
+
"~run"(dataset, config$1) {
|
|
4539
|
+
if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "64-bit MAC", dataset, config$1);
|
|
4394
4540
|
return dataset;
|
|
4395
4541
|
}
|
|
4396
4542
|
};
|
|
4397
4543
|
}
|
|
4398
4544
|
// @__NO_SIDE_EFFECTS__
|
|
4399
|
-
function nanoid(
|
|
4545
|
+
function nanoid(message$1) {
|
|
4400
4546
|
return {
|
|
4401
4547
|
kind: "validation",
|
|
4402
4548
|
type: "nanoid",
|
|
@@ -4404,17 +4550,15 @@ function nanoid(message2) {
|
|
|
4404
4550
|
async: false,
|
|
4405
4551
|
expects: null,
|
|
4406
4552
|
requirement: NANO_ID_REGEX,
|
|
4407
|
-
message:
|
|
4408
|
-
"~run"(dataset,
|
|
4409
|
-
if (dataset.typed && !this.requirement.test(dataset.value))
|
|
4410
|
-
_addIssue(this, "Nano ID", dataset, config2);
|
|
4411
|
-
}
|
|
4553
|
+
message: message$1,
|
|
4554
|
+
"~run"(dataset, config$1) {
|
|
4555
|
+
if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "Nano ID", dataset, config$1);
|
|
4412
4556
|
return dataset;
|
|
4413
4557
|
}
|
|
4414
4558
|
};
|
|
4415
4559
|
}
|
|
4416
4560
|
// @__NO_SIDE_EFFECTS__
|
|
4417
|
-
function octal(
|
|
4561
|
+
function octal(message$1) {
|
|
4418
4562
|
return {
|
|
4419
4563
|
kind: "validation",
|
|
4420
4564
|
type: "octal",
|
|
@@ -4422,17 +4566,15 @@ function octal(message2) {
|
|
|
4422
4566
|
async: false,
|
|
4423
4567
|
expects: null,
|
|
4424
4568
|
requirement: OCTAL_REGEX,
|
|
4425
|
-
message:
|
|
4426
|
-
"~run"(dataset,
|
|
4427
|
-
if (dataset.typed && !this.requirement.test(dataset.value))
|
|
4428
|
-
_addIssue(this, "octal", dataset, config2);
|
|
4429
|
-
}
|
|
4569
|
+
message: message$1,
|
|
4570
|
+
"~run"(dataset, config$1) {
|
|
4571
|
+
if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "octal", dataset, config$1);
|
|
4430
4572
|
return dataset;
|
|
4431
4573
|
}
|
|
4432
4574
|
};
|
|
4433
4575
|
}
|
|
4434
4576
|
// @__NO_SIDE_EFFECTS__
|
|
4435
|
-
function ulid(
|
|
4577
|
+
function ulid(message$1) {
|
|
4436
4578
|
return {
|
|
4437
4579
|
kind: "validation",
|
|
4438
4580
|
type: "ulid",
|
|
@@ -4440,17 +4582,15 @@ function ulid(message2) {
|
|
|
4440
4582
|
async: false,
|
|
4441
4583
|
expects: null,
|
|
4442
4584
|
requirement: ULID_REGEX,
|
|
4443
|
-
message:
|
|
4444
|
-
"~run"(dataset,
|
|
4445
|
-
if (dataset.typed && !this.requirement.test(dataset.value))
|
|
4446
|
-
_addIssue(this, "ULID", dataset, config2);
|
|
4447
|
-
}
|
|
4585
|
+
message: message$1,
|
|
4586
|
+
"~run"(dataset, config$1) {
|
|
4587
|
+
if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "ULID", dataset, config$1);
|
|
4448
4588
|
return dataset;
|
|
4449
4589
|
}
|
|
4450
4590
|
};
|
|
4451
4591
|
}
|
|
4452
4592
|
// @__NO_SIDE_EFFECTS__
|
|
4453
|
-
function url(
|
|
4593
|
+
function url(message$1) {
|
|
4454
4594
|
return {
|
|
4455
4595
|
kind: "validation",
|
|
4456
4596
|
type: "url",
|
|
@@ -4465,17 +4605,15 @@ function url(message2) {
|
|
|
4465
4605
|
return false;
|
|
4466
4606
|
}
|
|
4467
4607
|
},
|
|
4468
|
-
message:
|
|
4469
|
-
"~run"(dataset,
|
|
4470
|
-
if (dataset.typed && !this.requirement(dataset.value))
|
|
4471
|
-
_addIssue(this, "URL", dataset, config2);
|
|
4472
|
-
}
|
|
4608
|
+
message: message$1,
|
|
4609
|
+
"~run"(dataset, config$1) {
|
|
4610
|
+
if (dataset.typed && !this.requirement(dataset.value)) _addIssue(this, "URL", dataset, config$1);
|
|
4473
4611
|
return dataset;
|
|
4474
4612
|
}
|
|
4475
4613
|
};
|
|
4476
4614
|
}
|
|
4477
4615
|
// @__NO_SIDE_EFFECTS__
|
|
4478
|
-
function uuid(
|
|
4616
|
+
function uuid(message$1) {
|
|
4479
4617
|
return {
|
|
4480
4618
|
kind: "validation",
|
|
4481
4619
|
type: "uuid",
|
|
@@ -4483,64 +4621,55 @@ function uuid(message2) {
|
|
|
4483
4621
|
async: false,
|
|
4484
4622
|
expects: null,
|
|
4485
4623
|
requirement: UUID_REGEX,
|
|
4486
|
-
message:
|
|
4487
|
-
"~run"(dataset,
|
|
4488
|
-
if (dataset.typed && !this.requirement.test(dataset.value))
|
|
4489
|
-
_addIssue(this, "UUID", dataset, config2);
|
|
4490
|
-
}
|
|
4624
|
+
message: message$1,
|
|
4625
|
+
"~run"(dataset, config$1) {
|
|
4626
|
+
if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "UUID", dataset, config$1);
|
|
4491
4627
|
return dataset;
|
|
4492
4628
|
}
|
|
4493
4629
|
};
|
|
4494
4630
|
}
|
|
4495
4631
|
// @__NO_SIDE_EFFECTS__
|
|
4496
|
-
function string(
|
|
4632
|
+
function string(message$1) {
|
|
4497
4633
|
return {
|
|
4498
4634
|
kind: "schema",
|
|
4499
4635
|
type: "string",
|
|
4500
4636
|
reference: string,
|
|
4501
4637
|
expects: "string",
|
|
4502
4638
|
async: false,
|
|
4503
|
-
message:
|
|
4639
|
+
message: message$1,
|
|
4504
4640
|
get "~standard"() {
|
|
4505
4641
|
return /* @__PURE__ */ _getStandardProps(this);
|
|
4506
4642
|
},
|
|
4507
|
-
"~run"(dataset,
|
|
4508
|
-
if (typeof dataset.value === "string")
|
|
4509
|
-
|
|
4510
|
-
} else {
|
|
4511
|
-
_addIssue(this, "type", dataset, config2);
|
|
4512
|
-
}
|
|
4643
|
+
"~run"(dataset, config$1) {
|
|
4644
|
+
if (typeof dataset.value === "string") dataset.typed = true;
|
|
4645
|
+
else _addIssue(this, "type", dataset, config$1);
|
|
4513
4646
|
return dataset;
|
|
4514
4647
|
}
|
|
4515
4648
|
};
|
|
4516
4649
|
}
|
|
4517
4650
|
// @__NO_SIDE_EFFECTS__
|
|
4518
|
-
function pipe(...
|
|
4651
|
+
function pipe(...pipe$1) {
|
|
4519
4652
|
return {
|
|
4520
|
-
...
|
|
4521
|
-
pipe:
|
|
4653
|
+
...pipe$1[0],
|
|
4654
|
+
pipe: pipe$1,
|
|
4522
4655
|
get "~standard"() {
|
|
4523
4656
|
return /* @__PURE__ */ _getStandardProps(this);
|
|
4524
4657
|
},
|
|
4525
|
-
"~run"(dataset,
|
|
4526
|
-
for (const item of
|
|
4527
|
-
if (item.kind
|
|
4528
|
-
|
|
4529
|
-
|
|
4530
|
-
break;
|
|
4531
|
-
}
|
|
4532
|
-
if (!dataset.issues || !config2.abortEarly && !config2.abortPipeEarly) {
|
|
4533
|
-
dataset = item["~run"](dataset, config2);
|
|
4534
|
-
}
|
|
4658
|
+
"~run"(dataset, config$1) {
|
|
4659
|
+
for (const item of pipe$1) if (item.kind !== "metadata") {
|
|
4660
|
+
if (dataset.issues && (item.kind === "schema" || item.kind === "transformation")) {
|
|
4661
|
+
dataset.typed = false;
|
|
4662
|
+
break;
|
|
4535
4663
|
}
|
|
4664
|
+
if (!dataset.issues || !config$1.abortEarly && !config$1.abortPipeEarly) dataset = item["~run"](dataset, config$1);
|
|
4536
4665
|
}
|
|
4537
4666
|
return dataset;
|
|
4538
4667
|
}
|
|
4539
4668
|
};
|
|
4540
4669
|
}
|
|
4541
4670
|
// @__NO_SIDE_EFFECTS__
|
|
4542
|
-
function safeParse(schema, input,
|
|
4543
|
-
const dataset = schema["~run"]({ value: input }, /* @__PURE__ */ getGlobalConfig(
|
|
4671
|
+
function safeParse(schema, input, config$1) {
|
|
4672
|
+
const dataset = schema["~run"]({ value: input }, /* @__PURE__ */ getGlobalConfig(config$1));
|
|
4544
4673
|
return {
|
|
4545
4674
|
typed: dataset.typed,
|
|
4546
4675
|
success: !dataset.issues,
|
|
@@ -4845,30 +4974,39 @@ var NEVER = Object.freeze({
|
|
|
4845
4974
|
// @__NO_SIDE_EFFECTS__
|
|
4846
4975
|
function $constructor(name, initializer3, params) {
|
|
4847
4976
|
function init(inst, def) {
|
|
4848
|
-
|
|
4849
|
-
|
|
4850
|
-
|
|
4851
|
-
|
|
4852
|
-
|
|
4853
|
-
|
|
4977
|
+
if (!inst._zod) {
|
|
4978
|
+
Object.defineProperty(inst, "_zod", {
|
|
4979
|
+
value: {
|
|
4980
|
+
def,
|
|
4981
|
+
constr: _,
|
|
4982
|
+
traits: /* @__PURE__ */ new Set()
|
|
4983
|
+
},
|
|
4984
|
+
enumerable: false
|
|
4985
|
+
});
|
|
4986
|
+
}
|
|
4987
|
+
if (inst._zod.traits.has(name)) {
|
|
4988
|
+
return;
|
|
4989
|
+
}
|
|
4854
4990
|
inst._zod.traits.add(name);
|
|
4855
4991
|
initializer3(inst, def);
|
|
4856
|
-
|
|
4857
|
-
|
|
4858
|
-
|
|
4992
|
+
const proto = _.prototype;
|
|
4993
|
+
const keys = Object.keys(proto);
|
|
4994
|
+
for (let i = 0; i < keys.length; i++) {
|
|
4995
|
+
const k = keys[i];
|
|
4996
|
+
if (!(k in inst)) {
|
|
4997
|
+
inst[k] = proto[k].bind(inst);
|
|
4998
|
+
}
|
|
4859
4999
|
}
|
|
4860
|
-
inst._zod.constr = _;
|
|
4861
|
-
inst._zod.def = def;
|
|
4862
5000
|
}
|
|
4863
5001
|
const Parent = params?.Parent ?? Object;
|
|
4864
5002
|
class Definition extends Parent {
|
|
4865
5003
|
}
|
|
4866
5004
|
Object.defineProperty(Definition, "name", { value: name });
|
|
4867
5005
|
function _(def) {
|
|
4868
|
-
var
|
|
5006
|
+
var _a2;
|
|
4869
5007
|
const inst = params?.Parent ? new Definition() : this;
|
|
4870
5008
|
init(inst, def);
|
|
4871
|
-
(
|
|
5009
|
+
(_a2 = inst._zod).deferred ?? (_a2.deferred = []);
|
|
4872
5010
|
for (const fn of inst._zod.deferred) {
|
|
4873
5011
|
fn();
|
|
4874
5012
|
}
|
|
@@ -4885,7 +5023,6 @@ function $constructor(name, initializer3, params) {
|
|
|
4885
5023
|
Object.defineProperty(_, "name", { value: name });
|
|
4886
5024
|
return _;
|
|
4887
5025
|
}
|
|
4888
|
-
var $brand = Symbol("zod_brand");
|
|
4889
5026
|
var $ZodAsyncError = class extends Error {
|
|
4890
5027
|
constructor() {
|
|
4891
5028
|
super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`);
|
|
@@ -4962,6 +5099,7 @@ __export(util_exports, {
|
|
|
4962
5099
|
required: () => required,
|
|
4963
5100
|
safeExtend: () => safeExtend,
|
|
4964
5101
|
shallowClone: () => shallowClone,
|
|
5102
|
+
slugify: () => slugify,
|
|
4965
5103
|
stringifyPrimitive: () => stringifyPrimitive,
|
|
4966
5104
|
uint8ArrayToBase64: () => uint8ArrayToBase64,
|
|
4967
5105
|
uint8ArrayToBase64url: () => uint8ArrayToBase64url,
|
|
@@ -4977,7 +5115,7 @@ function assertNotEqual(val) {
|
|
|
4977
5115
|
function assertIs(_arg) {
|
|
4978
5116
|
}
|
|
4979
5117
|
function assertNever(_x) {
|
|
4980
|
-
throw new Error();
|
|
5118
|
+
throw new Error("Unexpected value in exhaustive check");
|
|
4981
5119
|
}
|
|
4982
5120
|
function assert(_) {
|
|
4983
5121
|
}
|
|
@@ -5030,7 +5168,7 @@ function floatSafeRemainder(val, step) {
|
|
|
5030
5168
|
const stepInt = Number.parseInt(step.toFixed(decCount).replace(".", ""));
|
|
5031
5169
|
return valInt % stepInt / 10 ** decCount;
|
|
5032
5170
|
}
|
|
5033
|
-
var EVALUATING = Symbol("evaluating");
|
|
5171
|
+
var EVALUATING = /* @__PURE__ */ Symbol("evaluating");
|
|
5034
5172
|
function defineLazy(object, key, getter) {
|
|
5035
5173
|
let value = void 0;
|
|
5036
5174
|
Object.defineProperty(object, key, {
|
|
@@ -5102,6 +5240,9 @@ function randomString(length = 10) {
|
|
|
5102
5240
|
function esc(str) {
|
|
5103
5241
|
return JSON.stringify(str);
|
|
5104
5242
|
}
|
|
5243
|
+
function slugify(input) {
|
|
5244
|
+
return input.toLowerCase().trim().replace(/[^\w\s-]/g, "").replace(/[\s_-]+/g, "-").replace(/^-+|-+$/g, "");
|
|
5245
|
+
}
|
|
5105
5246
|
var captureStackTrace = "captureStackTrace" in Error ? Error.captureStackTrace : (..._args) => {
|
|
5106
5247
|
};
|
|
5107
5248
|
function isObject(data) {
|
|
@@ -5125,6 +5266,8 @@ function isPlainObject(o) {
|
|
|
5125
5266
|
const ctor = o.constructor;
|
|
5126
5267
|
if (ctor === void 0)
|
|
5127
5268
|
return true;
|
|
5269
|
+
if (typeof ctor !== "function")
|
|
5270
|
+
return true;
|
|
5128
5271
|
const prot = ctor.prototype;
|
|
5129
5272
|
if (isObject(prot) === false)
|
|
5130
5273
|
return false;
|
|
@@ -5441,8 +5584,8 @@ function aborted(x, startIndex = 0) {
|
|
|
5441
5584
|
}
|
|
5442
5585
|
function prefixIssues(path, issues) {
|
|
5443
5586
|
return issues.map((iss) => {
|
|
5444
|
-
var
|
|
5445
|
-
(
|
|
5587
|
+
var _a2;
|
|
5588
|
+
(_a2 = iss).path ?? (_a2.path = []);
|
|
5446
5589
|
iss.path.unshift(path);
|
|
5447
5590
|
return iss;
|
|
5448
5591
|
});
|
|
@@ -5570,10 +5713,7 @@ function flattenError(error, mapper = (issue2) => issue2.message) {
|
|
|
5570
5713
|
}
|
|
5571
5714
|
return { formErrors, fieldErrors };
|
|
5572
5715
|
}
|
|
5573
|
-
function formatError(error,
|
|
5574
|
-
const mapper = _mapper || function(issue2) {
|
|
5575
|
-
return issue2.message;
|
|
5576
|
-
};
|
|
5716
|
+
function formatError(error, mapper = (issue2) => issue2.message) {
|
|
5577
5717
|
const fieldErrors = { _errors: [] };
|
|
5578
5718
|
const processError = (error2) => {
|
|
5579
5719
|
for (const issue2 of error2.issues) {
|
|
@@ -5710,7 +5850,6 @@ var cidrv4 = /^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]
|
|
|
5710
5850
|
var cidrv6 = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/;
|
|
5711
5851
|
var base642 = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/;
|
|
5712
5852
|
var base64url = /^[A-Za-z0-9_-]*$/;
|
|
5713
|
-
var 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])?)*\.?$/;
|
|
5714
5853
|
var e164 = /^\+(?:[0-9]){6,14}[0-9]$/;
|
|
5715
5854
|
var dateSource = `(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`;
|
|
5716
5855
|
var date = /* @__PURE__ */ new RegExp(`^${dateSource}$`);
|
|
@@ -5747,10 +5886,10 @@ var uppercase = /^[^a-z]*$/;
|
|
|
5747
5886
|
|
|
5748
5887
|
// node_modules/zod/v4/core/checks.js
|
|
5749
5888
|
var $ZodCheck = /* @__PURE__ */ $constructor("$ZodCheck", (inst, def) => {
|
|
5750
|
-
var
|
|
5889
|
+
var _a2;
|
|
5751
5890
|
inst._zod ?? (inst._zod = {});
|
|
5752
5891
|
inst._zod.def = def;
|
|
5753
|
-
(
|
|
5892
|
+
(_a2 = inst._zod).onattach ?? (_a2.onattach = []);
|
|
5754
5893
|
});
|
|
5755
5894
|
var numericOriginMap = {
|
|
5756
5895
|
number: "number",
|
|
@@ -5816,8 +5955,8 @@ var $ZodCheckGreaterThan = /* @__PURE__ */ $constructor("$ZodCheckGreaterThan",
|
|
|
5816
5955
|
var $ZodCheckMultipleOf = /* @__PURE__ */ $constructor("$ZodCheckMultipleOf", (inst, def) => {
|
|
5817
5956
|
$ZodCheck.init(inst, def);
|
|
5818
5957
|
inst._zod.onattach.push((inst2) => {
|
|
5819
|
-
var
|
|
5820
|
-
(
|
|
5958
|
+
var _a2;
|
|
5959
|
+
(_a2 = inst2._zod.bag).multipleOf ?? (_a2.multipleOf = def.value);
|
|
5821
5960
|
});
|
|
5822
5961
|
inst._zod.check = (payload) => {
|
|
5823
5962
|
if (typeof payload.value !== typeof def.value)
|
|
@@ -5911,9 +6050,9 @@ var $ZodCheckNumberFormat = /* @__PURE__ */ $constructor("$ZodCheckNumberFormat"
|
|
|
5911
6050
|
};
|
|
5912
6051
|
});
|
|
5913
6052
|
var $ZodCheckMaxLength = /* @__PURE__ */ $constructor("$ZodCheckMaxLength", (inst, def) => {
|
|
5914
|
-
var
|
|
6053
|
+
var _a2;
|
|
5915
6054
|
$ZodCheck.init(inst, def);
|
|
5916
|
-
(
|
|
6055
|
+
(_a2 = inst._zod.def).when ?? (_a2.when = (payload) => {
|
|
5917
6056
|
const val = payload.value;
|
|
5918
6057
|
return !nullish(val) && val.length !== void 0;
|
|
5919
6058
|
});
|
|
@@ -5940,9 +6079,9 @@ var $ZodCheckMaxLength = /* @__PURE__ */ $constructor("$ZodCheckMaxLength", (ins
|
|
|
5940
6079
|
};
|
|
5941
6080
|
});
|
|
5942
6081
|
var $ZodCheckMinLength = /* @__PURE__ */ $constructor("$ZodCheckMinLength", (inst, def) => {
|
|
5943
|
-
var
|
|
6082
|
+
var _a2;
|
|
5944
6083
|
$ZodCheck.init(inst, def);
|
|
5945
|
-
(
|
|
6084
|
+
(_a2 = inst._zod.def).when ?? (_a2.when = (payload) => {
|
|
5946
6085
|
const val = payload.value;
|
|
5947
6086
|
return !nullish(val) && val.length !== void 0;
|
|
5948
6087
|
});
|
|
@@ -5969,9 +6108,9 @@ var $ZodCheckMinLength = /* @__PURE__ */ $constructor("$ZodCheckMinLength", (ins
|
|
|
5969
6108
|
};
|
|
5970
6109
|
});
|
|
5971
6110
|
var $ZodCheckLengthEquals = /* @__PURE__ */ $constructor("$ZodCheckLengthEquals", (inst, def) => {
|
|
5972
|
-
var
|
|
6111
|
+
var _a2;
|
|
5973
6112
|
$ZodCheck.init(inst, def);
|
|
5974
|
-
(
|
|
6113
|
+
(_a2 = inst._zod.def).when ?? (_a2.when = (payload) => {
|
|
5975
6114
|
const val = payload.value;
|
|
5976
6115
|
return !nullish(val) && val.length !== void 0;
|
|
5977
6116
|
});
|
|
@@ -6000,7 +6139,7 @@ var $ZodCheckLengthEquals = /* @__PURE__ */ $constructor("$ZodCheckLengthEquals"
|
|
|
6000
6139
|
};
|
|
6001
6140
|
});
|
|
6002
6141
|
var $ZodCheckStringFormat = /* @__PURE__ */ $constructor("$ZodCheckStringFormat", (inst, def) => {
|
|
6003
|
-
var
|
|
6142
|
+
var _a2, _b;
|
|
6004
6143
|
$ZodCheck.init(inst, def);
|
|
6005
6144
|
inst._zod.onattach.push((inst2) => {
|
|
6006
6145
|
const bag = inst2._zod.bag;
|
|
@@ -6011,7 +6150,7 @@ var $ZodCheckStringFormat = /* @__PURE__ */ $constructor("$ZodCheckStringFormat"
|
|
|
6011
6150
|
}
|
|
6012
6151
|
});
|
|
6013
6152
|
if (def.pattern)
|
|
6014
|
-
(
|
|
6153
|
+
(_a2 = inst._zod).check ?? (_a2.check = (payload) => {
|
|
6015
6154
|
def.pattern.lastIndex = 0;
|
|
6016
6155
|
if (def.pattern.test(payload.value))
|
|
6017
6156
|
return;
|
|
@@ -6170,13 +6309,13 @@ var Doc = class {
|
|
|
6170
6309
|
// node_modules/zod/v4/core/versions.js
|
|
6171
6310
|
var version = {
|
|
6172
6311
|
major: 4,
|
|
6173
|
-
minor:
|
|
6174
|
-
patch:
|
|
6312
|
+
minor: 2,
|
|
6313
|
+
patch: 1
|
|
6175
6314
|
};
|
|
6176
6315
|
|
|
6177
6316
|
// node_modules/zod/v4/core/schemas.js
|
|
6178
6317
|
var $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
|
|
6179
|
-
var
|
|
6318
|
+
var _a2;
|
|
6180
6319
|
inst ?? (inst = {});
|
|
6181
6320
|
inst._zod.def = def;
|
|
6182
6321
|
inst._zod.bag = inst._zod.bag || {};
|
|
@@ -6191,7 +6330,7 @@ var $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
|
|
|
6191
6330
|
}
|
|
6192
6331
|
}
|
|
6193
6332
|
if (checks.length === 0) {
|
|
6194
|
-
(
|
|
6333
|
+
(_a2 = inst._zod).deferred ?? (_a2.deferred = []);
|
|
6195
6334
|
inst._zod.deferred?.push(() => {
|
|
6196
6335
|
inst._zod.run = inst._zod.parse;
|
|
6197
6336
|
});
|
|
@@ -6349,7 +6488,7 @@ var $ZodURL = /* @__PURE__ */ $constructor("$ZodURL", (inst, def) => {
|
|
|
6349
6488
|
code: "invalid_format",
|
|
6350
6489
|
format: "url",
|
|
6351
6490
|
note: "Invalid hostname",
|
|
6352
|
-
pattern: hostname.source,
|
|
6491
|
+
pattern: def.hostname.source,
|
|
6353
6492
|
input: payload.value,
|
|
6354
6493
|
inst,
|
|
6355
6494
|
continue: !def.abort
|
|
@@ -6434,18 +6573,12 @@ var $ZodISODuration = /* @__PURE__ */ $constructor("$ZodISODuration", (inst, def
|
|
|
6434
6573
|
var $ZodIPv4 = /* @__PURE__ */ $constructor("$ZodIPv4", (inst, def) => {
|
|
6435
6574
|
def.pattern ?? (def.pattern = ipv42);
|
|
6436
6575
|
$ZodStringFormat.init(inst, def);
|
|
6437
|
-
inst._zod.
|
|
6438
|
-
const bag = inst2._zod.bag;
|
|
6439
|
-
bag.format = `ipv4`;
|
|
6440
|
-
});
|
|
6576
|
+
inst._zod.bag.format = `ipv4`;
|
|
6441
6577
|
});
|
|
6442
6578
|
var $ZodIPv6 = /* @__PURE__ */ $constructor("$ZodIPv6", (inst, def) => {
|
|
6443
6579
|
def.pattern ?? (def.pattern = ipv62);
|
|
6444
6580
|
$ZodStringFormat.init(inst, def);
|
|
6445
|
-
inst._zod.
|
|
6446
|
-
const bag = inst2._zod.bag;
|
|
6447
|
-
bag.format = `ipv6`;
|
|
6448
|
-
});
|
|
6581
|
+
inst._zod.bag.format = `ipv6`;
|
|
6449
6582
|
inst._zod.check = (payload) => {
|
|
6450
6583
|
try {
|
|
6451
6584
|
new URL(`http://[${payload.value}]`);
|
|
@@ -6507,9 +6640,7 @@ function isValidBase64(data) {
|
|
|
6507
6640
|
var $ZodBase64 = /* @__PURE__ */ $constructor("$ZodBase64", (inst, def) => {
|
|
6508
6641
|
def.pattern ?? (def.pattern = base642);
|
|
6509
6642
|
$ZodStringFormat.init(inst, def);
|
|
6510
|
-
inst._zod.
|
|
6511
|
-
inst2._zod.bag.contentEncoding = "base64";
|
|
6512
|
-
});
|
|
6643
|
+
inst._zod.bag.contentEncoding = "base64";
|
|
6513
6644
|
inst._zod.check = (payload) => {
|
|
6514
6645
|
if (isValidBase64(payload.value))
|
|
6515
6646
|
return;
|
|
@@ -6532,9 +6663,7 @@ function isValidBase64URL(data) {
|
|
|
6532
6663
|
var $ZodBase64URL = /* @__PURE__ */ $constructor("$ZodBase64URL", (inst, def) => {
|
|
6533
6664
|
def.pattern ?? (def.pattern = base64url);
|
|
6534
6665
|
$ZodStringFormat.init(inst, def);
|
|
6535
|
-
inst._zod.
|
|
6536
|
-
inst2._zod.bag.contentEncoding = "base64url";
|
|
6537
|
-
});
|
|
6666
|
+
inst._zod.bag.contentEncoding = "base64url";
|
|
6538
6667
|
inst._zod.check = (payload) => {
|
|
6539
6668
|
if (isValidBase64URL(payload.value))
|
|
6540
6669
|
return;
|
|
@@ -6609,7 +6738,7 @@ var $ZodNumber = /* @__PURE__ */ $constructor("$ZodNumber", (inst, def) => {
|
|
|
6609
6738
|
return payload;
|
|
6610
6739
|
};
|
|
6611
6740
|
});
|
|
6612
|
-
var $ZodNumberFormat = /* @__PURE__ */ $constructor("$
|
|
6741
|
+
var $ZodNumberFormat = /* @__PURE__ */ $constructor("$ZodNumberFormat", (inst, def) => {
|
|
6613
6742
|
$ZodCheckNumberFormat.init(inst, def);
|
|
6614
6743
|
$ZodNumber.init(inst, def);
|
|
6615
6744
|
});
|
|
@@ -6836,7 +6965,7 @@ function handleCatchall(proms, input, payload, ctx, def, inst) {
|
|
|
6836
6965
|
const keySet = def.keySet;
|
|
6837
6966
|
const _catchall = def.catchall._zod;
|
|
6838
6967
|
const t2 = _catchall.def.type;
|
|
6839
|
-
for (const key
|
|
6968
|
+
for (const key in input) {
|
|
6840
6969
|
if (keySet.has(key))
|
|
6841
6970
|
continue;
|
|
6842
6971
|
if (t2 === "never") {
|
|
@@ -6866,6 +6995,19 @@ function handleCatchall(proms, input, payload, ctx, def, inst) {
|
|
|
6866
6995
|
}
|
|
6867
6996
|
var $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
|
|
6868
6997
|
$ZodType.init(inst, def);
|
|
6998
|
+
const desc = Object.getOwnPropertyDescriptor(def, "shape");
|
|
6999
|
+
if (!desc?.get) {
|
|
7000
|
+
const sh = def.shape;
|
|
7001
|
+
Object.defineProperty(def, "shape", {
|
|
7002
|
+
get: () => {
|
|
7003
|
+
const newSh = { ...sh };
|
|
7004
|
+
Object.defineProperty(def, "shape", {
|
|
7005
|
+
value: newSh
|
|
7006
|
+
});
|
|
7007
|
+
return newSh;
|
|
7008
|
+
}
|
|
7009
|
+
});
|
|
7010
|
+
}
|
|
6869
7011
|
const _normalized = cached(() => normalizeDef(def));
|
|
6870
7012
|
defineLazy(inst._zod, "propValues", () => {
|
|
6871
7013
|
const shape = def.shape;
|
|
@@ -7056,6 +7198,7 @@ var $ZodUnion = /* @__PURE__ */ $constructor("$ZodUnion", (inst, def) => {
|
|
|
7056
7198
|
};
|
|
7057
7199
|
});
|
|
7058
7200
|
var $ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("$ZodDiscriminatedUnion", (inst, def) => {
|
|
7201
|
+
def.inclusive = false;
|
|
7059
7202
|
$ZodUnion.init(inst, def);
|
|
7060
7203
|
const _super = inst._zod.parse;
|
|
7061
7204
|
defineLazy(inst._zod, "propValues", () => {
|
|
@@ -7198,7 +7341,6 @@ function handleIntersectionResults(result, left, right) {
|
|
|
7198
7341
|
var $ZodTuple = /* @__PURE__ */ $constructor("$ZodTuple", (inst, def) => {
|
|
7199
7342
|
$ZodType.init(inst, def);
|
|
7200
7343
|
const items = def.items;
|
|
7201
|
-
const optStart = items.length - [...items].reverse().findIndex((item) => item._zod.optin !== "optional");
|
|
7202
7344
|
inst._zod.parse = (payload, ctx) => {
|
|
7203
7345
|
const input = payload.value;
|
|
7204
7346
|
if (!Array.isArray(input)) {
|
|
@@ -7212,6 +7354,8 @@ var $ZodTuple = /* @__PURE__ */ $constructor("$ZodTuple", (inst, def) => {
|
|
|
7212
7354
|
}
|
|
7213
7355
|
payload.value = [];
|
|
7214
7356
|
const proms = [];
|
|
7357
|
+
const reversedIndex = [...items].reverse().findIndex((item) => item._zod.optin !== "optional");
|
|
7358
|
+
const optStart = reversedIndex === -1 ? 0 : items.length - reversedIndex;
|
|
7215
7359
|
if (!def.rest) {
|
|
7216
7360
|
const tooBig = input.length > items.length;
|
|
7217
7361
|
const tooSmall = input.length < optStart - 1;
|
|
@@ -7282,11 +7426,13 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
|
|
|
7282
7426
|
return payload;
|
|
7283
7427
|
}
|
|
7284
7428
|
const proms = [];
|
|
7285
|
-
|
|
7286
|
-
|
|
7429
|
+
const values = def.keyType._zod.values;
|
|
7430
|
+
if (values) {
|
|
7287
7431
|
payload.value = {};
|
|
7432
|
+
const recordKeys = /* @__PURE__ */ new Set();
|
|
7288
7433
|
for (const key of values) {
|
|
7289
7434
|
if (typeof key === "string" || typeof key === "number" || typeof key === "symbol") {
|
|
7435
|
+
recordKeys.add(typeof key === "number" ? key.toString() : key);
|
|
7290
7436
|
const result = def.valueType._zod.run({ value: input[key], issues: [] }, ctx);
|
|
7291
7437
|
if (result instanceof Promise) {
|
|
7292
7438
|
proms.push(result.then((result2) => {
|
|
@@ -7305,7 +7451,7 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
|
|
|
7305
7451
|
}
|
|
7306
7452
|
let unrecognized;
|
|
7307
7453
|
for (const key in input) {
|
|
7308
|
-
if (!
|
|
7454
|
+
if (!recordKeys.has(key)) {
|
|
7309
7455
|
unrecognized = unrecognized ?? [];
|
|
7310
7456
|
unrecognized.push(key);
|
|
7311
7457
|
}
|
|
@@ -7328,15 +7474,18 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
|
|
|
7328
7474
|
throw new Error("Async schemas not supported in object keys currently");
|
|
7329
7475
|
}
|
|
7330
7476
|
if (keyResult.issues.length) {
|
|
7331
|
-
|
|
7332
|
-
|
|
7333
|
-
|
|
7334
|
-
|
|
7335
|
-
|
|
7336
|
-
|
|
7337
|
-
|
|
7338
|
-
|
|
7339
|
-
|
|
7477
|
+
if (def.mode === "loose") {
|
|
7478
|
+
payload.value[key] = input[key];
|
|
7479
|
+
} else {
|
|
7480
|
+
payload.issues.push({
|
|
7481
|
+
code: "invalid_key",
|
|
7482
|
+
origin: "record",
|
|
7483
|
+
issues: keyResult.issues.map((iss) => finalizeIssue(iss, ctx, config())),
|
|
7484
|
+
input: key,
|
|
7485
|
+
path: [key],
|
|
7486
|
+
inst
|
|
7487
|
+
});
|
|
7488
|
+
}
|
|
7340
7489
|
continue;
|
|
7341
7490
|
}
|
|
7342
7491
|
const result = def.valueType._zod.run({ value: input[key], issues: [] }, ctx);
|
|
@@ -7386,11 +7535,12 @@ var $ZodLiteral = /* @__PURE__ */ $constructor("$ZodLiteral", (inst, def) => {
|
|
|
7386
7535
|
if (def.values.length === 0) {
|
|
7387
7536
|
throw new Error("Cannot create literal schema with no valid values");
|
|
7388
7537
|
}
|
|
7389
|
-
|
|
7538
|
+
const values = new Set(def.values);
|
|
7539
|
+
inst._zod.values = values;
|
|
7390
7540
|
inst._zod.pattern = new RegExp(`^(${def.values.map((o) => typeof o === "string" ? escapeRegex(o) : o ? escapeRegex(o.toString()) : String(o)).join("|")})$`);
|
|
7391
7541
|
inst._zod.parse = (payload, _ctx) => {
|
|
7392
7542
|
const input = payload.value;
|
|
7393
|
-
if (
|
|
7543
|
+
if (values.has(input)) {
|
|
7394
7544
|
return payload;
|
|
7395
7545
|
}
|
|
7396
7546
|
payload.issues.push({
|
|
@@ -7606,8 +7756,8 @@ var $ZodReadonly = /* @__PURE__ */ $constructor("$ZodReadonly", (inst, def) => {
|
|
|
7606
7756
|
$ZodType.init(inst, def);
|
|
7607
7757
|
defineLazy(inst._zod, "propValues", () => def.innerType._zod.propValues);
|
|
7608
7758
|
defineLazy(inst._zod, "values", () => def.innerType._zod.values);
|
|
7609
|
-
defineLazy(inst._zod, "optin", () => def.innerType
|
|
7610
|
-
defineLazy(inst._zod, "optout", () => def.innerType
|
|
7759
|
+
defineLazy(inst._zod, "optin", () => def.innerType?._zod?.optin);
|
|
7760
|
+
defineLazy(inst._zod, "optout", () => def.innerType?._zod?.optout);
|
|
7611
7761
|
inst._zod.parse = (payload, ctx) => {
|
|
7612
7762
|
if (ctx.direction === "backward") {
|
|
7613
7763
|
return def.innerType._zod.run(payload, ctx);
|
|
@@ -7664,21 +7814,20 @@ function handleRefineResult(result, payload, input, inst) {
|
|
|
7664
7814
|
}
|
|
7665
7815
|
|
|
7666
7816
|
// node_modules/zod/v4/core/registries.js
|
|
7667
|
-
var
|
|
7668
|
-
var $input = Symbol("ZodInput");
|
|
7817
|
+
var _a;
|
|
7669
7818
|
var $ZodRegistry = class {
|
|
7670
7819
|
constructor() {
|
|
7671
7820
|
this._map = /* @__PURE__ */ new WeakMap();
|
|
7672
7821
|
this._idmap = /* @__PURE__ */ new Map();
|
|
7673
7822
|
}
|
|
7674
7823
|
add(schema, ..._meta) {
|
|
7675
|
-
const
|
|
7676
|
-
this._map.set(schema,
|
|
7677
|
-
if (
|
|
7678
|
-
if (this._idmap.has(
|
|
7679
|
-
throw new Error(`ID ${
|
|
7824
|
+
const meta2 = _meta[0];
|
|
7825
|
+
this._map.set(schema, meta2);
|
|
7826
|
+
if (meta2 && typeof meta2 === "object" && "id" in meta2) {
|
|
7827
|
+
if (this._idmap.has(meta2.id)) {
|
|
7828
|
+
throw new Error(`ID ${meta2.id} already exists in the registry`);
|
|
7680
7829
|
}
|
|
7681
|
-
this._idmap.set(
|
|
7830
|
+
this._idmap.set(meta2.id, schema);
|
|
7682
7831
|
}
|
|
7683
7832
|
return this;
|
|
7684
7833
|
}
|
|
@@ -7688,9 +7837,9 @@ var $ZodRegistry = class {
|
|
|
7688
7837
|
return this;
|
|
7689
7838
|
}
|
|
7690
7839
|
remove(schema) {
|
|
7691
|
-
const
|
|
7692
|
-
if (
|
|
7693
|
-
this._idmap.delete(
|
|
7840
|
+
const meta2 = this._map.get(schema);
|
|
7841
|
+
if (meta2 && typeof meta2 === "object" && "id" in meta2) {
|
|
7842
|
+
this._idmap.delete(meta2.id);
|
|
7694
7843
|
}
|
|
7695
7844
|
this._map.delete(schema);
|
|
7696
7845
|
return this;
|
|
@@ -7712,7 +7861,8 @@ var $ZodRegistry = class {
|
|
|
7712
7861
|
function registry() {
|
|
7713
7862
|
return new $ZodRegistry();
|
|
7714
7863
|
}
|
|
7715
|
-
|
|
7864
|
+
(_a = globalThis).__zod_globalRegistry ?? (_a.__zod_globalRegistry = registry());
|
|
7865
|
+
var globalRegistry = globalThis.__zod_globalRegistry;
|
|
7716
7866
|
|
|
7717
7867
|
// node_modules/zod/v4/core/api.js
|
|
7718
7868
|
function _string(Class2, params) {
|
|
@@ -8103,6 +8253,9 @@ function _toLowerCase() {
|
|
|
8103
8253
|
function _toUpperCase() {
|
|
8104
8254
|
return _overwrite((input) => input.toUpperCase());
|
|
8105
8255
|
}
|
|
8256
|
+
function _slugify() {
|
|
8257
|
+
return _overwrite((input) => slugify(input));
|
|
8258
|
+
}
|
|
8106
8259
|
function _array(Class2, element, params) {
|
|
8107
8260
|
return new Class2({
|
|
8108
8261
|
type: "array",
|
|
@@ -8151,6 +8304,701 @@ function _check(fn, params) {
|
|
|
8151
8304
|
return ch;
|
|
8152
8305
|
}
|
|
8153
8306
|
|
|
8307
|
+
// node_modules/zod/v4/core/to-json-schema.js
|
|
8308
|
+
function initializeContext(params) {
|
|
8309
|
+
let target = params?.target ?? "draft-2020-12";
|
|
8310
|
+
if (target === "draft-4")
|
|
8311
|
+
target = "draft-04";
|
|
8312
|
+
if (target === "draft-7")
|
|
8313
|
+
target = "draft-07";
|
|
8314
|
+
return {
|
|
8315
|
+
processors: params.processors ?? {},
|
|
8316
|
+
metadataRegistry: params?.metadata ?? globalRegistry,
|
|
8317
|
+
target,
|
|
8318
|
+
unrepresentable: params?.unrepresentable ?? "throw",
|
|
8319
|
+
override: params?.override ?? (() => {
|
|
8320
|
+
}),
|
|
8321
|
+
io: params?.io ?? "output",
|
|
8322
|
+
counter: 0,
|
|
8323
|
+
seen: /* @__PURE__ */ new Map(),
|
|
8324
|
+
cycles: params?.cycles ?? "ref",
|
|
8325
|
+
reused: params?.reused ?? "inline",
|
|
8326
|
+
external: params?.external ?? void 0
|
|
8327
|
+
};
|
|
8328
|
+
}
|
|
8329
|
+
function process2(schema, ctx, _params = { path: [], schemaPath: [] }) {
|
|
8330
|
+
var _a2;
|
|
8331
|
+
const def = schema._zod.def;
|
|
8332
|
+
const seen = ctx.seen.get(schema);
|
|
8333
|
+
if (seen) {
|
|
8334
|
+
seen.count++;
|
|
8335
|
+
const isCycle = _params.schemaPath.includes(schema);
|
|
8336
|
+
if (isCycle) {
|
|
8337
|
+
seen.cycle = _params.path;
|
|
8338
|
+
}
|
|
8339
|
+
return seen.schema;
|
|
8340
|
+
}
|
|
8341
|
+
const result = { schema: {}, count: 1, cycle: void 0, path: _params.path };
|
|
8342
|
+
ctx.seen.set(schema, result);
|
|
8343
|
+
const overrideSchema = schema._zod.toJSONSchema?.();
|
|
8344
|
+
if (overrideSchema) {
|
|
8345
|
+
result.schema = overrideSchema;
|
|
8346
|
+
} else {
|
|
8347
|
+
const params = {
|
|
8348
|
+
..._params,
|
|
8349
|
+
schemaPath: [..._params.schemaPath, schema],
|
|
8350
|
+
path: _params.path
|
|
8351
|
+
};
|
|
8352
|
+
const parent = schema._zod.parent;
|
|
8353
|
+
if (parent) {
|
|
8354
|
+
result.ref = parent;
|
|
8355
|
+
process2(parent, ctx, params);
|
|
8356
|
+
ctx.seen.get(parent).isParent = true;
|
|
8357
|
+
} else if (schema._zod.processJSONSchema) {
|
|
8358
|
+
schema._zod.processJSONSchema(ctx, result.schema, params);
|
|
8359
|
+
} else {
|
|
8360
|
+
const _json = result.schema;
|
|
8361
|
+
const processor = ctx.processors[def.type];
|
|
8362
|
+
if (!processor) {
|
|
8363
|
+
throw new Error(`[toJSONSchema]: Non-representable type encountered: ${def.type}`);
|
|
8364
|
+
}
|
|
8365
|
+
processor(schema, ctx, _json, params);
|
|
8366
|
+
}
|
|
8367
|
+
}
|
|
8368
|
+
const meta2 = ctx.metadataRegistry.get(schema);
|
|
8369
|
+
if (meta2)
|
|
8370
|
+
Object.assign(result.schema, meta2);
|
|
8371
|
+
if (ctx.io === "input" && isTransforming(schema)) {
|
|
8372
|
+
delete result.schema.examples;
|
|
8373
|
+
delete result.schema.default;
|
|
8374
|
+
}
|
|
8375
|
+
if (ctx.io === "input" && result.schema._prefault)
|
|
8376
|
+
(_a2 = result.schema).default ?? (_a2.default = result.schema._prefault);
|
|
8377
|
+
delete result.schema._prefault;
|
|
8378
|
+
const _result = ctx.seen.get(schema);
|
|
8379
|
+
return _result.schema;
|
|
8380
|
+
}
|
|
8381
|
+
function extractDefs(ctx, schema) {
|
|
8382
|
+
const root = ctx.seen.get(schema);
|
|
8383
|
+
if (!root)
|
|
8384
|
+
throw new Error("Unprocessed schema. This is a bug in Zod.");
|
|
8385
|
+
const makeURI = (entry) => {
|
|
8386
|
+
const defsSegment = ctx.target === "draft-2020-12" ? "$defs" : "definitions";
|
|
8387
|
+
if (ctx.external) {
|
|
8388
|
+
const externalId = ctx.external.registry.get(entry[0])?.id;
|
|
8389
|
+
const uriGenerator = ctx.external.uri ?? ((id2) => id2);
|
|
8390
|
+
if (externalId) {
|
|
8391
|
+
return { ref: uriGenerator(externalId) };
|
|
8392
|
+
}
|
|
8393
|
+
const id = entry[1].defId ?? entry[1].schema.id ?? `schema${ctx.counter++}`;
|
|
8394
|
+
entry[1].defId = id;
|
|
8395
|
+
return { defId: id, ref: `${uriGenerator("__shared")}#/${defsSegment}/${id}` };
|
|
8396
|
+
}
|
|
8397
|
+
if (entry[1] === root) {
|
|
8398
|
+
return { ref: "#" };
|
|
8399
|
+
}
|
|
8400
|
+
const uriPrefix = `#`;
|
|
8401
|
+
const defUriPrefix = `${uriPrefix}/${defsSegment}/`;
|
|
8402
|
+
const defId = entry[1].schema.id ?? `__schema${ctx.counter++}`;
|
|
8403
|
+
return { defId, ref: defUriPrefix + defId };
|
|
8404
|
+
};
|
|
8405
|
+
const extractToDef = (entry) => {
|
|
8406
|
+
if (entry[1].schema.$ref) {
|
|
8407
|
+
return;
|
|
8408
|
+
}
|
|
8409
|
+
const seen = entry[1];
|
|
8410
|
+
const { ref, defId } = makeURI(entry);
|
|
8411
|
+
seen.def = { ...seen.schema };
|
|
8412
|
+
if (defId)
|
|
8413
|
+
seen.defId = defId;
|
|
8414
|
+
const schema2 = seen.schema;
|
|
8415
|
+
for (const key in schema2) {
|
|
8416
|
+
delete schema2[key];
|
|
8417
|
+
}
|
|
8418
|
+
schema2.$ref = ref;
|
|
8419
|
+
};
|
|
8420
|
+
if (ctx.cycles === "throw") {
|
|
8421
|
+
for (const entry of ctx.seen.entries()) {
|
|
8422
|
+
const seen = entry[1];
|
|
8423
|
+
if (seen.cycle) {
|
|
8424
|
+
throw new Error(`Cycle detected: #/${seen.cycle?.join("/")}/<root>
|
|
8425
|
+
|
|
8426
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`);
|
|
8427
|
+
}
|
|
8428
|
+
}
|
|
8429
|
+
}
|
|
8430
|
+
for (const entry of ctx.seen.entries()) {
|
|
8431
|
+
const seen = entry[1];
|
|
8432
|
+
if (schema === entry[0]) {
|
|
8433
|
+
extractToDef(entry);
|
|
8434
|
+
continue;
|
|
8435
|
+
}
|
|
8436
|
+
if (ctx.external) {
|
|
8437
|
+
const ext = ctx.external.registry.get(entry[0])?.id;
|
|
8438
|
+
if (schema !== entry[0] && ext) {
|
|
8439
|
+
extractToDef(entry);
|
|
8440
|
+
continue;
|
|
8441
|
+
}
|
|
8442
|
+
}
|
|
8443
|
+
const id = ctx.metadataRegistry.get(entry[0])?.id;
|
|
8444
|
+
if (id) {
|
|
8445
|
+
extractToDef(entry);
|
|
8446
|
+
continue;
|
|
8447
|
+
}
|
|
8448
|
+
if (seen.cycle) {
|
|
8449
|
+
extractToDef(entry);
|
|
8450
|
+
continue;
|
|
8451
|
+
}
|
|
8452
|
+
if (seen.count > 1) {
|
|
8453
|
+
if (ctx.reused === "ref") {
|
|
8454
|
+
extractToDef(entry);
|
|
8455
|
+
continue;
|
|
8456
|
+
}
|
|
8457
|
+
}
|
|
8458
|
+
}
|
|
8459
|
+
}
|
|
8460
|
+
function finalize(ctx, schema) {
|
|
8461
|
+
const root = ctx.seen.get(schema);
|
|
8462
|
+
if (!root)
|
|
8463
|
+
throw new Error("Unprocessed schema. This is a bug in Zod.");
|
|
8464
|
+
const flattenRef = (zodSchema) => {
|
|
8465
|
+
const seen = ctx.seen.get(zodSchema);
|
|
8466
|
+
const schema2 = seen.def ?? seen.schema;
|
|
8467
|
+
const _cached = { ...schema2 };
|
|
8468
|
+
if (seen.ref === null) {
|
|
8469
|
+
return;
|
|
8470
|
+
}
|
|
8471
|
+
const ref = seen.ref;
|
|
8472
|
+
seen.ref = null;
|
|
8473
|
+
if (ref) {
|
|
8474
|
+
flattenRef(ref);
|
|
8475
|
+
const refSchema = ctx.seen.get(ref).schema;
|
|
8476
|
+
if (refSchema.$ref && (ctx.target === "draft-07" || ctx.target === "draft-04" || ctx.target === "openapi-3.0")) {
|
|
8477
|
+
schema2.allOf = schema2.allOf ?? [];
|
|
8478
|
+
schema2.allOf.push(refSchema);
|
|
8479
|
+
} else {
|
|
8480
|
+
Object.assign(schema2, refSchema);
|
|
8481
|
+
Object.assign(schema2, _cached);
|
|
8482
|
+
}
|
|
8483
|
+
}
|
|
8484
|
+
if (!seen.isParent)
|
|
8485
|
+
ctx.override({
|
|
8486
|
+
zodSchema,
|
|
8487
|
+
jsonSchema: schema2,
|
|
8488
|
+
path: seen.path ?? []
|
|
8489
|
+
});
|
|
8490
|
+
};
|
|
8491
|
+
for (const entry of [...ctx.seen.entries()].reverse()) {
|
|
8492
|
+
flattenRef(entry[0]);
|
|
8493
|
+
}
|
|
8494
|
+
const result = {};
|
|
8495
|
+
if (ctx.target === "draft-2020-12") {
|
|
8496
|
+
result.$schema = "https://json-schema.org/draft/2020-12/schema";
|
|
8497
|
+
} else if (ctx.target === "draft-07") {
|
|
8498
|
+
result.$schema = "http://json-schema.org/draft-07/schema#";
|
|
8499
|
+
} else if (ctx.target === "draft-04") {
|
|
8500
|
+
result.$schema = "http://json-schema.org/draft-04/schema#";
|
|
8501
|
+
} else if (ctx.target === "openapi-3.0") {
|
|
8502
|
+
} else {
|
|
8503
|
+
}
|
|
8504
|
+
if (ctx.external?.uri) {
|
|
8505
|
+
const id = ctx.external.registry.get(schema)?.id;
|
|
8506
|
+
if (!id)
|
|
8507
|
+
throw new Error("Schema is missing an `id` property");
|
|
8508
|
+
result.$id = ctx.external.uri(id);
|
|
8509
|
+
}
|
|
8510
|
+
Object.assign(result, root.def ?? root.schema);
|
|
8511
|
+
const defs = ctx.external?.defs ?? {};
|
|
8512
|
+
for (const entry of ctx.seen.entries()) {
|
|
8513
|
+
const seen = entry[1];
|
|
8514
|
+
if (seen.def && seen.defId) {
|
|
8515
|
+
defs[seen.defId] = seen.def;
|
|
8516
|
+
}
|
|
8517
|
+
}
|
|
8518
|
+
if (ctx.external) {
|
|
8519
|
+
} else {
|
|
8520
|
+
if (Object.keys(defs).length > 0) {
|
|
8521
|
+
if (ctx.target === "draft-2020-12") {
|
|
8522
|
+
result.$defs = defs;
|
|
8523
|
+
} else {
|
|
8524
|
+
result.definitions = defs;
|
|
8525
|
+
}
|
|
8526
|
+
}
|
|
8527
|
+
}
|
|
8528
|
+
try {
|
|
8529
|
+
const finalized = JSON.parse(JSON.stringify(result));
|
|
8530
|
+
Object.defineProperty(finalized, "~standard", {
|
|
8531
|
+
value: {
|
|
8532
|
+
...schema["~standard"],
|
|
8533
|
+
jsonSchema: {
|
|
8534
|
+
input: createStandardJSONSchemaMethod(schema, "input"),
|
|
8535
|
+
output: createStandardJSONSchemaMethod(schema, "output")
|
|
8536
|
+
}
|
|
8537
|
+
},
|
|
8538
|
+
enumerable: false,
|
|
8539
|
+
writable: false
|
|
8540
|
+
});
|
|
8541
|
+
return finalized;
|
|
8542
|
+
} catch (_err) {
|
|
8543
|
+
throw new Error("Error converting schema to JSON.");
|
|
8544
|
+
}
|
|
8545
|
+
}
|
|
8546
|
+
function isTransforming(_schema, _ctx) {
|
|
8547
|
+
const ctx = _ctx ?? { seen: /* @__PURE__ */ new Set() };
|
|
8548
|
+
if (ctx.seen.has(_schema))
|
|
8549
|
+
return false;
|
|
8550
|
+
ctx.seen.add(_schema);
|
|
8551
|
+
const def = _schema._zod.def;
|
|
8552
|
+
if (def.type === "transform")
|
|
8553
|
+
return true;
|
|
8554
|
+
if (def.type === "array")
|
|
8555
|
+
return isTransforming(def.element, ctx);
|
|
8556
|
+
if (def.type === "set")
|
|
8557
|
+
return isTransforming(def.valueType, ctx);
|
|
8558
|
+
if (def.type === "lazy")
|
|
8559
|
+
return isTransforming(def.getter(), ctx);
|
|
8560
|
+
if (def.type === "promise" || def.type === "optional" || def.type === "nonoptional" || def.type === "nullable" || def.type === "readonly" || def.type === "default" || def.type === "prefault") {
|
|
8561
|
+
return isTransforming(def.innerType, ctx);
|
|
8562
|
+
}
|
|
8563
|
+
if (def.type === "intersection") {
|
|
8564
|
+
return isTransforming(def.left, ctx) || isTransforming(def.right, ctx);
|
|
8565
|
+
}
|
|
8566
|
+
if (def.type === "record" || def.type === "map") {
|
|
8567
|
+
return isTransforming(def.keyType, ctx) || isTransforming(def.valueType, ctx);
|
|
8568
|
+
}
|
|
8569
|
+
if (def.type === "pipe") {
|
|
8570
|
+
return isTransforming(def.in, ctx) || isTransforming(def.out, ctx);
|
|
8571
|
+
}
|
|
8572
|
+
if (def.type === "object") {
|
|
8573
|
+
for (const key in def.shape) {
|
|
8574
|
+
if (isTransforming(def.shape[key], ctx))
|
|
8575
|
+
return true;
|
|
8576
|
+
}
|
|
8577
|
+
return false;
|
|
8578
|
+
}
|
|
8579
|
+
if (def.type === "union") {
|
|
8580
|
+
for (const option of def.options) {
|
|
8581
|
+
if (isTransforming(option, ctx))
|
|
8582
|
+
return true;
|
|
8583
|
+
}
|
|
8584
|
+
return false;
|
|
8585
|
+
}
|
|
8586
|
+
if (def.type === "tuple") {
|
|
8587
|
+
for (const item of def.items) {
|
|
8588
|
+
if (isTransforming(item, ctx))
|
|
8589
|
+
return true;
|
|
8590
|
+
}
|
|
8591
|
+
if (def.rest && isTransforming(def.rest, ctx))
|
|
8592
|
+
return true;
|
|
8593
|
+
return false;
|
|
8594
|
+
}
|
|
8595
|
+
return false;
|
|
8596
|
+
}
|
|
8597
|
+
var createToJSONSchemaMethod = (schema, processors = {}) => (params) => {
|
|
8598
|
+
const ctx = initializeContext({ ...params, processors });
|
|
8599
|
+
process2(schema, ctx);
|
|
8600
|
+
extractDefs(ctx, schema);
|
|
8601
|
+
return finalize(ctx, schema);
|
|
8602
|
+
};
|
|
8603
|
+
var createStandardJSONSchemaMethod = (schema, io) => (params) => {
|
|
8604
|
+
const { libraryOptions, target } = params ?? {};
|
|
8605
|
+
const ctx = initializeContext({ ...libraryOptions ?? {}, target, io, processors: {} });
|
|
8606
|
+
process2(schema, ctx);
|
|
8607
|
+
extractDefs(ctx, schema);
|
|
8608
|
+
return finalize(ctx, schema);
|
|
8609
|
+
};
|
|
8610
|
+
|
|
8611
|
+
// node_modules/zod/v4/core/json-schema-processors.js
|
|
8612
|
+
var formatMap = {
|
|
8613
|
+
guid: "uuid",
|
|
8614
|
+
url: "uri",
|
|
8615
|
+
datetime: "date-time",
|
|
8616
|
+
json_string: "json-string",
|
|
8617
|
+
regex: ""
|
|
8618
|
+
// do not set
|
|
8619
|
+
};
|
|
8620
|
+
var stringProcessor = (schema, ctx, _json, _params) => {
|
|
8621
|
+
const json = _json;
|
|
8622
|
+
json.type = "string";
|
|
8623
|
+
const { minimum, maximum, format, patterns, contentEncoding } = schema._zod.bag;
|
|
8624
|
+
if (typeof minimum === "number")
|
|
8625
|
+
json.minLength = minimum;
|
|
8626
|
+
if (typeof maximum === "number")
|
|
8627
|
+
json.maxLength = maximum;
|
|
8628
|
+
if (format) {
|
|
8629
|
+
json.format = formatMap[format] ?? format;
|
|
8630
|
+
if (json.format === "")
|
|
8631
|
+
delete json.format;
|
|
8632
|
+
}
|
|
8633
|
+
if (contentEncoding)
|
|
8634
|
+
json.contentEncoding = contentEncoding;
|
|
8635
|
+
if (patterns && patterns.size > 0) {
|
|
8636
|
+
const regexes = [...patterns];
|
|
8637
|
+
if (regexes.length === 1)
|
|
8638
|
+
json.pattern = regexes[0].source;
|
|
8639
|
+
else if (regexes.length > 1) {
|
|
8640
|
+
json.allOf = [
|
|
8641
|
+
...regexes.map((regex) => ({
|
|
8642
|
+
...ctx.target === "draft-07" || ctx.target === "draft-04" || ctx.target === "openapi-3.0" ? { type: "string" } : {},
|
|
8643
|
+
pattern: regex.source
|
|
8644
|
+
}))
|
|
8645
|
+
];
|
|
8646
|
+
}
|
|
8647
|
+
}
|
|
8648
|
+
};
|
|
8649
|
+
var numberProcessor = (schema, ctx, _json, _params) => {
|
|
8650
|
+
const json = _json;
|
|
8651
|
+
const { minimum, maximum, format, multipleOf, exclusiveMaximum, exclusiveMinimum } = schema._zod.bag;
|
|
8652
|
+
if (typeof format === "string" && format.includes("int"))
|
|
8653
|
+
json.type = "integer";
|
|
8654
|
+
else
|
|
8655
|
+
json.type = "number";
|
|
8656
|
+
if (typeof exclusiveMinimum === "number") {
|
|
8657
|
+
if (ctx.target === "draft-04" || ctx.target === "openapi-3.0") {
|
|
8658
|
+
json.minimum = exclusiveMinimum;
|
|
8659
|
+
json.exclusiveMinimum = true;
|
|
8660
|
+
} else {
|
|
8661
|
+
json.exclusiveMinimum = exclusiveMinimum;
|
|
8662
|
+
}
|
|
8663
|
+
}
|
|
8664
|
+
if (typeof minimum === "number") {
|
|
8665
|
+
json.minimum = minimum;
|
|
8666
|
+
if (typeof exclusiveMinimum === "number" && ctx.target !== "draft-04") {
|
|
8667
|
+
if (exclusiveMinimum >= minimum)
|
|
8668
|
+
delete json.minimum;
|
|
8669
|
+
else
|
|
8670
|
+
delete json.exclusiveMinimum;
|
|
8671
|
+
}
|
|
8672
|
+
}
|
|
8673
|
+
if (typeof exclusiveMaximum === "number") {
|
|
8674
|
+
if (ctx.target === "draft-04" || ctx.target === "openapi-3.0") {
|
|
8675
|
+
json.maximum = exclusiveMaximum;
|
|
8676
|
+
json.exclusiveMaximum = true;
|
|
8677
|
+
} else {
|
|
8678
|
+
json.exclusiveMaximum = exclusiveMaximum;
|
|
8679
|
+
}
|
|
8680
|
+
}
|
|
8681
|
+
if (typeof maximum === "number") {
|
|
8682
|
+
json.maximum = maximum;
|
|
8683
|
+
if (typeof exclusiveMaximum === "number" && ctx.target !== "draft-04") {
|
|
8684
|
+
if (exclusiveMaximum <= maximum)
|
|
8685
|
+
delete json.maximum;
|
|
8686
|
+
else
|
|
8687
|
+
delete json.exclusiveMaximum;
|
|
8688
|
+
}
|
|
8689
|
+
}
|
|
8690
|
+
if (typeof multipleOf === "number")
|
|
8691
|
+
json.multipleOf = multipleOf;
|
|
8692
|
+
};
|
|
8693
|
+
var booleanProcessor = (_schema, _ctx, json, _params) => {
|
|
8694
|
+
json.type = "boolean";
|
|
8695
|
+
};
|
|
8696
|
+
var bigintProcessor = (_schema, ctx, _json, _params) => {
|
|
8697
|
+
if (ctx.unrepresentable === "throw") {
|
|
8698
|
+
throw new Error("BigInt cannot be represented in JSON Schema");
|
|
8699
|
+
}
|
|
8700
|
+
};
|
|
8701
|
+
var symbolProcessor = (_schema, ctx, _json, _params) => {
|
|
8702
|
+
if (ctx.unrepresentable === "throw") {
|
|
8703
|
+
throw new Error("Symbols cannot be represented in JSON Schema");
|
|
8704
|
+
}
|
|
8705
|
+
};
|
|
8706
|
+
var nullProcessor = (_schema, ctx, json, _params) => {
|
|
8707
|
+
if (ctx.target === "openapi-3.0") {
|
|
8708
|
+
json.type = "string";
|
|
8709
|
+
json.nullable = true;
|
|
8710
|
+
json.enum = [null];
|
|
8711
|
+
} else {
|
|
8712
|
+
json.type = "null";
|
|
8713
|
+
}
|
|
8714
|
+
};
|
|
8715
|
+
var undefinedProcessor = (_schema, ctx, _json, _params) => {
|
|
8716
|
+
if (ctx.unrepresentable === "throw") {
|
|
8717
|
+
throw new Error("Undefined cannot be represented in JSON Schema");
|
|
8718
|
+
}
|
|
8719
|
+
};
|
|
8720
|
+
var voidProcessor = (_schema, ctx, _json, _params) => {
|
|
8721
|
+
if (ctx.unrepresentable === "throw") {
|
|
8722
|
+
throw new Error("Void cannot be represented in JSON Schema");
|
|
8723
|
+
}
|
|
8724
|
+
};
|
|
8725
|
+
var neverProcessor = (_schema, _ctx, json, _params) => {
|
|
8726
|
+
json.not = {};
|
|
8727
|
+
};
|
|
8728
|
+
var anyProcessor = (_schema, _ctx, _json, _params) => {
|
|
8729
|
+
};
|
|
8730
|
+
var unknownProcessor = (_schema, _ctx, _json, _params) => {
|
|
8731
|
+
};
|
|
8732
|
+
var dateProcessor = (_schema, ctx, _json, _params) => {
|
|
8733
|
+
if (ctx.unrepresentable === "throw") {
|
|
8734
|
+
throw new Error("Date cannot be represented in JSON Schema");
|
|
8735
|
+
}
|
|
8736
|
+
};
|
|
8737
|
+
var enumProcessor = (schema, _ctx, json, _params) => {
|
|
8738
|
+
const def = schema._zod.def;
|
|
8739
|
+
const values = getEnumValues(def.entries);
|
|
8740
|
+
if (values.every((v) => typeof v === "number"))
|
|
8741
|
+
json.type = "number";
|
|
8742
|
+
if (values.every((v) => typeof v === "string"))
|
|
8743
|
+
json.type = "string";
|
|
8744
|
+
json.enum = values;
|
|
8745
|
+
};
|
|
8746
|
+
var literalProcessor = (schema, ctx, json, _params) => {
|
|
8747
|
+
const def = schema._zod.def;
|
|
8748
|
+
const vals = [];
|
|
8749
|
+
for (const val of def.values) {
|
|
8750
|
+
if (val === void 0) {
|
|
8751
|
+
if (ctx.unrepresentable === "throw") {
|
|
8752
|
+
throw new Error("Literal `undefined` cannot be represented in JSON Schema");
|
|
8753
|
+
} else {
|
|
8754
|
+
}
|
|
8755
|
+
} else if (typeof val === "bigint") {
|
|
8756
|
+
if (ctx.unrepresentable === "throw") {
|
|
8757
|
+
throw new Error("BigInt literals cannot be represented in JSON Schema");
|
|
8758
|
+
} else {
|
|
8759
|
+
vals.push(Number(val));
|
|
8760
|
+
}
|
|
8761
|
+
} else {
|
|
8762
|
+
vals.push(val);
|
|
8763
|
+
}
|
|
8764
|
+
}
|
|
8765
|
+
if (vals.length === 0) {
|
|
8766
|
+
} else if (vals.length === 1) {
|
|
8767
|
+
const val = vals[0];
|
|
8768
|
+
json.type = val === null ? "null" : typeof val;
|
|
8769
|
+
if (ctx.target === "draft-04" || ctx.target === "openapi-3.0") {
|
|
8770
|
+
json.enum = [val];
|
|
8771
|
+
} else {
|
|
8772
|
+
json.const = val;
|
|
8773
|
+
}
|
|
8774
|
+
} else {
|
|
8775
|
+
if (vals.every((v) => typeof v === "number"))
|
|
8776
|
+
json.type = "number";
|
|
8777
|
+
if (vals.every((v) => typeof v === "string"))
|
|
8778
|
+
json.type = "string";
|
|
8779
|
+
if (vals.every((v) => typeof v === "boolean"))
|
|
8780
|
+
json.type = "boolean";
|
|
8781
|
+
if (vals.every((v) => v === null))
|
|
8782
|
+
json.type = "null";
|
|
8783
|
+
json.enum = vals;
|
|
8784
|
+
}
|
|
8785
|
+
};
|
|
8786
|
+
var customProcessor = (_schema, ctx, _json, _params) => {
|
|
8787
|
+
if (ctx.unrepresentable === "throw") {
|
|
8788
|
+
throw new Error("Custom types cannot be represented in JSON Schema");
|
|
8789
|
+
}
|
|
8790
|
+
};
|
|
8791
|
+
var transformProcessor = (_schema, ctx, _json, _params) => {
|
|
8792
|
+
if (ctx.unrepresentable === "throw") {
|
|
8793
|
+
throw new Error("Transforms cannot be represented in JSON Schema");
|
|
8794
|
+
}
|
|
8795
|
+
};
|
|
8796
|
+
var arrayProcessor = (schema, ctx, _json, params) => {
|
|
8797
|
+
const json = _json;
|
|
8798
|
+
const def = schema._zod.def;
|
|
8799
|
+
const { minimum, maximum } = schema._zod.bag;
|
|
8800
|
+
if (typeof minimum === "number")
|
|
8801
|
+
json.minItems = minimum;
|
|
8802
|
+
if (typeof maximum === "number")
|
|
8803
|
+
json.maxItems = maximum;
|
|
8804
|
+
json.type = "array";
|
|
8805
|
+
json.items = process2(def.element, ctx, { ...params, path: [...params.path, "items"] });
|
|
8806
|
+
};
|
|
8807
|
+
var objectProcessor = (schema, ctx, _json, params) => {
|
|
8808
|
+
const json = _json;
|
|
8809
|
+
const def = schema._zod.def;
|
|
8810
|
+
json.type = "object";
|
|
8811
|
+
json.properties = {};
|
|
8812
|
+
const shape = def.shape;
|
|
8813
|
+
for (const key in shape) {
|
|
8814
|
+
json.properties[key] = process2(shape[key], ctx, {
|
|
8815
|
+
...params,
|
|
8816
|
+
path: [...params.path, "properties", key]
|
|
8817
|
+
});
|
|
8818
|
+
}
|
|
8819
|
+
const allKeys = new Set(Object.keys(shape));
|
|
8820
|
+
const requiredKeys = new Set([...allKeys].filter((key) => {
|
|
8821
|
+
const v = def.shape[key]._zod;
|
|
8822
|
+
if (ctx.io === "input") {
|
|
8823
|
+
return v.optin === void 0;
|
|
8824
|
+
} else {
|
|
8825
|
+
return v.optout === void 0;
|
|
8826
|
+
}
|
|
8827
|
+
}));
|
|
8828
|
+
if (requiredKeys.size > 0) {
|
|
8829
|
+
json.required = Array.from(requiredKeys);
|
|
8830
|
+
}
|
|
8831
|
+
if (def.catchall?._zod.def.type === "never") {
|
|
8832
|
+
json.additionalProperties = false;
|
|
8833
|
+
} else if (!def.catchall) {
|
|
8834
|
+
if (ctx.io === "output")
|
|
8835
|
+
json.additionalProperties = false;
|
|
8836
|
+
} else if (def.catchall) {
|
|
8837
|
+
json.additionalProperties = process2(def.catchall, ctx, {
|
|
8838
|
+
...params,
|
|
8839
|
+
path: [...params.path, "additionalProperties"]
|
|
8840
|
+
});
|
|
8841
|
+
}
|
|
8842
|
+
};
|
|
8843
|
+
var unionProcessor = (schema, ctx, json, params) => {
|
|
8844
|
+
const def = schema._zod.def;
|
|
8845
|
+
const isExclusive = def.inclusive === false;
|
|
8846
|
+
const options = def.options.map((x, i) => process2(x, ctx, {
|
|
8847
|
+
...params,
|
|
8848
|
+
path: [...params.path, isExclusive ? "oneOf" : "anyOf", i]
|
|
8849
|
+
}));
|
|
8850
|
+
if (isExclusive) {
|
|
8851
|
+
json.oneOf = options;
|
|
8852
|
+
} else {
|
|
8853
|
+
json.anyOf = options;
|
|
8854
|
+
}
|
|
8855
|
+
};
|
|
8856
|
+
var intersectionProcessor = (schema, ctx, json, params) => {
|
|
8857
|
+
const def = schema._zod.def;
|
|
8858
|
+
const a = process2(def.left, ctx, {
|
|
8859
|
+
...params,
|
|
8860
|
+
path: [...params.path, "allOf", 0]
|
|
8861
|
+
});
|
|
8862
|
+
const b = process2(def.right, ctx, {
|
|
8863
|
+
...params,
|
|
8864
|
+
path: [...params.path, "allOf", 1]
|
|
8865
|
+
});
|
|
8866
|
+
const isSimpleIntersection = (val) => "allOf" in val && Object.keys(val).length === 1;
|
|
8867
|
+
const allOf = [
|
|
8868
|
+
...isSimpleIntersection(a) ? a.allOf : [a],
|
|
8869
|
+
...isSimpleIntersection(b) ? b.allOf : [b]
|
|
8870
|
+
];
|
|
8871
|
+
json.allOf = allOf;
|
|
8872
|
+
};
|
|
8873
|
+
var tupleProcessor = (schema, ctx, _json, params) => {
|
|
8874
|
+
const json = _json;
|
|
8875
|
+
const def = schema._zod.def;
|
|
8876
|
+
json.type = "array";
|
|
8877
|
+
const prefixPath = ctx.target === "draft-2020-12" ? "prefixItems" : "items";
|
|
8878
|
+
const restPath = ctx.target === "draft-2020-12" ? "items" : ctx.target === "openapi-3.0" ? "items" : "additionalItems";
|
|
8879
|
+
const prefixItems = def.items.map((x, i) => process2(x, ctx, {
|
|
8880
|
+
...params,
|
|
8881
|
+
path: [...params.path, prefixPath, i]
|
|
8882
|
+
}));
|
|
8883
|
+
const rest = def.rest ? process2(def.rest, ctx, {
|
|
8884
|
+
...params,
|
|
8885
|
+
path: [...params.path, restPath, ...ctx.target === "openapi-3.0" ? [def.items.length] : []]
|
|
8886
|
+
}) : null;
|
|
8887
|
+
if (ctx.target === "draft-2020-12") {
|
|
8888
|
+
json.prefixItems = prefixItems;
|
|
8889
|
+
if (rest) {
|
|
8890
|
+
json.items = rest;
|
|
8891
|
+
}
|
|
8892
|
+
} else if (ctx.target === "openapi-3.0") {
|
|
8893
|
+
json.items = {
|
|
8894
|
+
anyOf: prefixItems
|
|
8895
|
+
};
|
|
8896
|
+
if (rest) {
|
|
8897
|
+
json.items.anyOf.push(rest);
|
|
8898
|
+
}
|
|
8899
|
+
json.minItems = prefixItems.length;
|
|
8900
|
+
if (!rest) {
|
|
8901
|
+
json.maxItems = prefixItems.length;
|
|
8902
|
+
}
|
|
8903
|
+
} else {
|
|
8904
|
+
json.items = prefixItems;
|
|
8905
|
+
if (rest) {
|
|
8906
|
+
json.additionalItems = rest;
|
|
8907
|
+
}
|
|
8908
|
+
}
|
|
8909
|
+
const { minimum, maximum } = schema._zod.bag;
|
|
8910
|
+
if (typeof minimum === "number")
|
|
8911
|
+
json.minItems = minimum;
|
|
8912
|
+
if (typeof maximum === "number")
|
|
8913
|
+
json.maxItems = maximum;
|
|
8914
|
+
};
|
|
8915
|
+
var recordProcessor = (schema, ctx, _json, params) => {
|
|
8916
|
+
const json = _json;
|
|
8917
|
+
const def = schema._zod.def;
|
|
8918
|
+
json.type = "object";
|
|
8919
|
+
if (ctx.target === "draft-07" || ctx.target === "draft-2020-12") {
|
|
8920
|
+
json.propertyNames = process2(def.keyType, ctx, {
|
|
8921
|
+
...params,
|
|
8922
|
+
path: [...params.path, "propertyNames"]
|
|
8923
|
+
});
|
|
8924
|
+
}
|
|
8925
|
+
json.additionalProperties = process2(def.valueType, ctx, {
|
|
8926
|
+
...params,
|
|
8927
|
+
path: [...params.path, "additionalProperties"]
|
|
8928
|
+
});
|
|
8929
|
+
};
|
|
8930
|
+
var nullableProcessor = (schema, ctx, json, params) => {
|
|
8931
|
+
const def = schema._zod.def;
|
|
8932
|
+
const inner = process2(def.innerType, ctx, params);
|
|
8933
|
+
const seen = ctx.seen.get(schema);
|
|
8934
|
+
if (ctx.target === "openapi-3.0") {
|
|
8935
|
+
seen.ref = def.innerType;
|
|
8936
|
+
json.nullable = true;
|
|
8937
|
+
} else {
|
|
8938
|
+
json.anyOf = [inner, { type: "null" }];
|
|
8939
|
+
}
|
|
8940
|
+
};
|
|
8941
|
+
var nonoptionalProcessor = (schema, ctx, _json, params) => {
|
|
8942
|
+
const def = schema._zod.def;
|
|
8943
|
+
process2(def.innerType, ctx, params);
|
|
8944
|
+
const seen = ctx.seen.get(schema);
|
|
8945
|
+
seen.ref = def.innerType;
|
|
8946
|
+
};
|
|
8947
|
+
var defaultProcessor = (schema, ctx, json, params) => {
|
|
8948
|
+
const def = schema._zod.def;
|
|
8949
|
+
process2(def.innerType, ctx, params);
|
|
8950
|
+
const seen = ctx.seen.get(schema);
|
|
8951
|
+
seen.ref = def.innerType;
|
|
8952
|
+
json.default = JSON.parse(JSON.stringify(def.defaultValue));
|
|
8953
|
+
};
|
|
8954
|
+
var prefaultProcessor = (schema, ctx, json, params) => {
|
|
8955
|
+
const def = schema._zod.def;
|
|
8956
|
+
process2(def.innerType, ctx, params);
|
|
8957
|
+
const seen = ctx.seen.get(schema);
|
|
8958
|
+
seen.ref = def.innerType;
|
|
8959
|
+
if (ctx.io === "input")
|
|
8960
|
+
json._prefault = JSON.parse(JSON.stringify(def.defaultValue));
|
|
8961
|
+
};
|
|
8962
|
+
var catchProcessor = (schema, ctx, json, params) => {
|
|
8963
|
+
const def = schema._zod.def;
|
|
8964
|
+
process2(def.innerType, ctx, params);
|
|
8965
|
+
const seen = ctx.seen.get(schema);
|
|
8966
|
+
seen.ref = def.innerType;
|
|
8967
|
+
let catchValue;
|
|
8968
|
+
try {
|
|
8969
|
+
catchValue = def.catchValue(void 0);
|
|
8970
|
+
} catch {
|
|
8971
|
+
throw new Error("Dynamic catch values are not supported in JSON Schema");
|
|
8972
|
+
}
|
|
8973
|
+
json.default = catchValue;
|
|
8974
|
+
};
|
|
8975
|
+
var pipeProcessor = (schema, ctx, _json, params) => {
|
|
8976
|
+
const def = schema._zod.def;
|
|
8977
|
+
const innerType = ctx.io === "input" ? def.in._zod.def.type === "transform" ? def.out : def.in : def.out;
|
|
8978
|
+
process2(innerType, ctx, params);
|
|
8979
|
+
const seen = ctx.seen.get(schema);
|
|
8980
|
+
seen.ref = innerType;
|
|
8981
|
+
};
|
|
8982
|
+
var readonlyProcessor = (schema, ctx, json, params) => {
|
|
8983
|
+
const def = schema._zod.def;
|
|
8984
|
+
process2(def.innerType, ctx, params);
|
|
8985
|
+
const seen = ctx.seen.get(schema);
|
|
8986
|
+
seen.ref = def.innerType;
|
|
8987
|
+
json.readOnly = true;
|
|
8988
|
+
};
|
|
8989
|
+
var promiseProcessor = (schema, ctx, _json, params) => {
|
|
8990
|
+
const def = schema._zod.def;
|
|
8991
|
+
process2(def.innerType, ctx, params);
|
|
8992
|
+
const seen = ctx.seen.get(schema);
|
|
8993
|
+
seen.ref = def.innerType;
|
|
8994
|
+
};
|
|
8995
|
+
var optionalProcessor = (schema, ctx, _json, params) => {
|
|
8996
|
+
const def = schema._zod.def;
|
|
8997
|
+
process2(def.innerType, ctx, params);
|
|
8998
|
+
const seen = ctx.seen.get(schema);
|
|
8999
|
+
seen.ref = def.innerType;
|
|
9000
|
+
};
|
|
9001
|
+
|
|
8154
9002
|
// node_modules/zod/v4/classic/iso.js
|
|
8155
9003
|
var ZodISODateTime = /* @__PURE__ */ $constructor("ZodISODateTime", (inst, def) => {
|
|
8156
9004
|
$ZodISODateTime.init(inst, def);
|
|
@@ -8238,25 +9086,28 @@ var safeDecodeAsync = /* @__PURE__ */ _safeDecodeAsync(ZodRealError);
|
|
|
8238
9086
|
// node_modules/zod/v4/classic/schemas.js
|
|
8239
9087
|
var ZodType = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
|
|
8240
9088
|
$ZodType.init(inst, def);
|
|
9089
|
+
Object.assign(inst["~standard"], {
|
|
9090
|
+
jsonSchema: {
|
|
9091
|
+
input: createStandardJSONSchemaMethod(inst, "input"),
|
|
9092
|
+
output: createStandardJSONSchemaMethod(inst, "output")
|
|
9093
|
+
}
|
|
9094
|
+
});
|
|
9095
|
+
inst.toJSONSchema = createToJSONSchemaMethod(inst, {});
|
|
8241
9096
|
inst.def = def;
|
|
8242
9097
|
inst.type = def.type;
|
|
8243
9098
|
Object.defineProperty(inst, "_def", { value: def });
|
|
8244
9099
|
inst.check = (...checks) => {
|
|
8245
|
-
return inst.clone(
|
|
8246
|
-
|
|
8247
|
-
...def,
|
|
8248
|
-
checks: [
|
|
8249
|
-
|
|
8250
|
-
|
|
8251
|
-
]
|
|
8252
|
-
}
|
|
8253
|
-
// { parent: true }
|
|
8254
|
-
);
|
|
9100
|
+
return inst.clone(util_exports.mergeDefs(def, {
|
|
9101
|
+
checks: [
|
|
9102
|
+
...def.checks ?? [],
|
|
9103
|
+
...checks.map((ch) => typeof ch === "function" ? { _zod: { check: ch, def: { check: "custom" }, onattach: [] } } : ch)
|
|
9104
|
+
]
|
|
9105
|
+
}));
|
|
8255
9106
|
};
|
|
8256
9107
|
inst.clone = (def2, params) => clone(inst, def2, params);
|
|
8257
9108
|
inst.brand = () => inst;
|
|
8258
|
-
inst.register = ((reg,
|
|
8259
|
-
reg.add(inst,
|
|
9109
|
+
inst.register = ((reg, meta2) => {
|
|
9110
|
+
reg.add(inst, meta2);
|
|
8260
9111
|
return inst;
|
|
8261
9112
|
});
|
|
8262
9113
|
inst.parse = (data, params) => parse2(inst, data, params, { callee: inst.parse });
|
|
@@ -8314,6 +9165,7 @@ var ZodType = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
|
|
|
8314
9165
|
var _ZodString = /* @__PURE__ */ $constructor("_ZodString", (inst, def) => {
|
|
8315
9166
|
$ZodString.init(inst, def);
|
|
8316
9167
|
ZodType.init(inst, def);
|
|
9168
|
+
inst._zod.processJSONSchema = (ctx, json, params) => stringProcessor(inst, ctx, json, params);
|
|
8317
9169
|
const bag = inst._zod.bag;
|
|
8318
9170
|
inst.format = bag.format ?? null;
|
|
8319
9171
|
inst.minLength = bag.minimum ?? null;
|
|
@@ -8332,6 +9184,7 @@ var _ZodString = /* @__PURE__ */ $constructor("_ZodString", (inst, def) => {
|
|
|
8332
9184
|
inst.normalize = (...args) => inst.check(_normalize(...args));
|
|
8333
9185
|
inst.toLowerCase = () => inst.check(_toLowerCase());
|
|
8334
9186
|
inst.toUpperCase = () => inst.check(_toUpperCase());
|
|
9187
|
+
inst.slugify = () => inst.check(_slugify());
|
|
8335
9188
|
});
|
|
8336
9189
|
var ZodString = /* @__PURE__ */ $constructor("ZodString", (inst, def) => {
|
|
8337
9190
|
$ZodString.init(inst, def);
|
|
@@ -8450,6 +9303,7 @@ var ZodJWT = /* @__PURE__ */ $constructor("ZodJWT", (inst, def) => {
|
|
|
8450
9303
|
var ZodNumber = /* @__PURE__ */ $constructor("ZodNumber", (inst, def) => {
|
|
8451
9304
|
$ZodNumber.init(inst, def);
|
|
8452
9305
|
ZodType.init(inst, def);
|
|
9306
|
+
inst._zod.processJSONSchema = (ctx, json, params) => numberProcessor(inst, ctx, json, params);
|
|
8453
9307
|
inst.gt = (value, params) => inst.check(_gt(value, params));
|
|
8454
9308
|
inst.gte = (value, params) => inst.check(_gte(value, params));
|
|
8455
9309
|
inst.min = (value, params) => inst.check(_gte(value, params));
|
|
@@ -8482,10 +9336,12 @@ function int(params) {
|
|
|
8482
9336
|
var ZodBoolean = /* @__PURE__ */ $constructor("ZodBoolean", (inst, def) => {
|
|
8483
9337
|
$ZodBoolean.init(inst, def);
|
|
8484
9338
|
ZodType.init(inst, def);
|
|
9339
|
+
inst._zod.processJSONSchema = (ctx, json, params) => booleanProcessor(inst, ctx, json, params);
|
|
8485
9340
|
});
|
|
8486
9341
|
var ZodBigInt = /* @__PURE__ */ $constructor("ZodBigInt", (inst, def) => {
|
|
8487
9342
|
$ZodBigInt.init(inst, def);
|
|
8488
9343
|
ZodType.init(inst, def);
|
|
9344
|
+
inst._zod.processJSONSchema = (ctx, json, params) => bigintProcessor(inst, ctx, json, params);
|
|
8489
9345
|
inst.gte = (value, params) => inst.check(_gte(value, params));
|
|
8490
9346
|
inst.min = (value, params) => inst.check(_gte(value, params));
|
|
8491
9347
|
inst.gt = (value, params) => inst.check(_gt(value, params));
|
|
@@ -8507,22 +9363,27 @@ var ZodBigInt = /* @__PURE__ */ $constructor("ZodBigInt", (inst, def) => {
|
|
|
8507
9363
|
var ZodSymbol = /* @__PURE__ */ $constructor("ZodSymbol", (inst, def) => {
|
|
8508
9364
|
$ZodSymbol.init(inst, def);
|
|
8509
9365
|
ZodType.init(inst, def);
|
|
9366
|
+
inst._zod.processJSONSchema = (ctx, json, params) => symbolProcessor(inst, ctx, json, params);
|
|
8510
9367
|
});
|
|
8511
9368
|
var ZodUndefined = /* @__PURE__ */ $constructor("ZodUndefined", (inst, def) => {
|
|
8512
9369
|
$ZodUndefined.init(inst, def);
|
|
8513
9370
|
ZodType.init(inst, def);
|
|
9371
|
+
inst._zod.processJSONSchema = (ctx, json, params) => undefinedProcessor(inst, ctx, json, params);
|
|
8514
9372
|
});
|
|
8515
9373
|
var ZodNull = /* @__PURE__ */ $constructor("ZodNull", (inst, def) => {
|
|
8516
9374
|
$ZodNull.init(inst, def);
|
|
8517
9375
|
ZodType.init(inst, def);
|
|
9376
|
+
inst._zod.processJSONSchema = (ctx, json, params) => nullProcessor(inst, ctx, json, params);
|
|
8518
9377
|
});
|
|
8519
9378
|
var ZodAny = /* @__PURE__ */ $constructor("ZodAny", (inst, def) => {
|
|
8520
9379
|
$ZodAny.init(inst, def);
|
|
8521
9380
|
ZodType.init(inst, def);
|
|
9381
|
+
inst._zod.processJSONSchema = (ctx, json, params) => anyProcessor(inst, ctx, json, params);
|
|
8522
9382
|
});
|
|
8523
9383
|
var ZodUnknown = /* @__PURE__ */ $constructor("ZodUnknown", (inst, def) => {
|
|
8524
9384
|
$ZodUnknown.init(inst, def);
|
|
8525
9385
|
ZodType.init(inst, def);
|
|
9386
|
+
inst._zod.processJSONSchema = (ctx, json, params) => unknownProcessor(inst, ctx, json, params);
|
|
8526
9387
|
});
|
|
8527
9388
|
function unknown() {
|
|
8528
9389
|
return _unknown(ZodUnknown);
|
|
@@ -8530,6 +9391,7 @@ function unknown() {
|
|
|
8530
9391
|
var ZodNever = /* @__PURE__ */ $constructor("ZodNever", (inst, def) => {
|
|
8531
9392
|
$ZodNever.init(inst, def);
|
|
8532
9393
|
ZodType.init(inst, def);
|
|
9394
|
+
inst._zod.processJSONSchema = (ctx, json, params) => neverProcessor(inst, ctx, json, params);
|
|
8533
9395
|
});
|
|
8534
9396
|
function never(params) {
|
|
8535
9397
|
return _never(ZodNever, params);
|
|
@@ -8537,10 +9399,12 @@ function never(params) {
|
|
|
8537
9399
|
var ZodVoid = /* @__PURE__ */ $constructor("ZodVoid", (inst, def) => {
|
|
8538
9400
|
$ZodVoid.init(inst, def);
|
|
8539
9401
|
ZodType.init(inst, def);
|
|
9402
|
+
inst._zod.processJSONSchema = (ctx, json, params) => voidProcessor(inst, ctx, json, params);
|
|
8540
9403
|
});
|
|
8541
9404
|
var ZodDate = /* @__PURE__ */ $constructor("ZodDate", (inst, def) => {
|
|
8542
9405
|
$ZodDate.init(inst, def);
|
|
8543
9406
|
ZodType.init(inst, def);
|
|
9407
|
+
inst._zod.processJSONSchema = (ctx, json, params) => dateProcessor(inst, ctx, json, params);
|
|
8544
9408
|
inst.min = (value, params) => inst.check(_gte(value, params));
|
|
8545
9409
|
inst.max = (value, params) => inst.check(_lte(value, params));
|
|
8546
9410
|
const c = inst._zod.bag;
|
|
@@ -8550,6 +9414,7 @@ var ZodDate = /* @__PURE__ */ $constructor("ZodDate", (inst, def) => {
|
|
|
8550
9414
|
var ZodArray = /* @__PURE__ */ $constructor("ZodArray", (inst, def) => {
|
|
8551
9415
|
$ZodArray.init(inst, def);
|
|
8552
9416
|
ZodType.init(inst, def);
|
|
9417
|
+
inst._zod.processJSONSchema = (ctx, json, params) => arrayProcessor(inst, ctx, json, params);
|
|
8553
9418
|
inst.element = def.element;
|
|
8554
9419
|
inst.min = (minLength, params) => inst.check(_minLength(minLength, params));
|
|
8555
9420
|
inst.nonempty = (params) => inst.check(_minLength(1, params));
|
|
@@ -8563,7 +9428,10 @@ function array(element, params) {
|
|
|
8563
9428
|
var ZodObject = /* @__PURE__ */ $constructor("ZodObject", (inst, def) => {
|
|
8564
9429
|
$ZodObjectJIT.init(inst, def);
|
|
8565
9430
|
ZodType.init(inst, def);
|
|
8566
|
-
|
|
9431
|
+
inst._zod.processJSONSchema = (ctx, json, params) => objectProcessor(inst, ctx, json, params);
|
|
9432
|
+
util_exports.defineLazy(inst, "shape", () => {
|
|
9433
|
+
return def.shape;
|
|
9434
|
+
});
|
|
8567
9435
|
inst.keyof = () => _enum(Object.keys(inst._zod.def.shape));
|
|
8568
9436
|
inst.catchall = (catchall) => inst.clone({ ...inst._zod.def, catchall });
|
|
8569
9437
|
inst.passthrough = () => inst.clone({ ...inst._zod.def, catchall: unknown() });
|
|
@@ -8585,6 +9453,7 @@ var ZodObject = /* @__PURE__ */ $constructor("ZodObject", (inst, def) => {
|
|
|
8585
9453
|
var ZodUnion = /* @__PURE__ */ $constructor("ZodUnion", (inst, def) => {
|
|
8586
9454
|
$ZodUnion.init(inst, def);
|
|
8587
9455
|
ZodType.init(inst, def);
|
|
9456
|
+
inst._zod.processJSONSchema = (ctx, json, params) => unionProcessor(inst, ctx, json, params);
|
|
8588
9457
|
inst.options = def.options;
|
|
8589
9458
|
});
|
|
8590
9459
|
function union(options, params) {
|
|
@@ -8601,6 +9470,7 @@ var ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("ZodDiscriminatedUnion"
|
|
|
8601
9470
|
var ZodIntersection = /* @__PURE__ */ $constructor("ZodIntersection", (inst, def) => {
|
|
8602
9471
|
$ZodIntersection.init(inst, def);
|
|
8603
9472
|
ZodType.init(inst, def);
|
|
9473
|
+
inst._zod.processJSONSchema = (ctx, json, params) => intersectionProcessor(inst, ctx, json, params);
|
|
8604
9474
|
});
|
|
8605
9475
|
function intersection(left, right) {
|
|
8606
9476
|
return new ZodIntersection({
|
|
@@ -8612,6 +9482,7 @@ function intersection(left, right) {
|
|
|
8612
9482
|
var ZodTuple = /* @__PURE__ */ $constructor("ZodTuple", (inst, def) => {
|
|
8613
9483
|
$ZodTuple.init(inst, def);
|
|
8614
9484
|
ZodType.init(inst, def);
|
|
9485
|
+
inst._zod.processJSONSchema = (ctx, json, params) => tupleProcessor(inst, ctx, json, params);
|
|
8615
9486
|
inst.rest = (rest) => inst.clone({
|
|
8616
9487
|
...inst._zod.def,
|
|
8617
9488
|
rest
|
|
@@ -8620,12 +9491,14 @@ var ZodTuple = /* @__PURE__ */ $constructor("ZodTuple", (inst, def) => {
|
|
|
8620
9491
|
var ZodRecord = /* @__PURE__ */ $constructor("ZodRecord", (inst, def) => {
|
|
8621
9492
|
$ZodRecord.init(inst, def);
|
|
8622
9493
|
ZodType.init(inst, def);
|
|
9494
|
+
inst._zod.processJSONSchema = (ctx, json, params) => recordProcessor(inst, ctx, json, params);
|
|
8623
9495
|
inst.keyType = def.keyType;
|
|
8624
9496
|
inst.valueType = def.valueType;
|
|
8625
9497
|
});
|
|
8626
9498
|
var ZodEnum = /* @__PURE__ */ $constructor("ZodEnum", (inst, def) => {
|
|
8627
9499
|
$ZodEnum.init(inst, def);
|
|
8628
9500
|
ZodType.init(inst, def);
|
|
9501
|
+
inst._zod.processJSONSchema = (ctx, json, params) => enumProcessor(inst, ctx, json, params);
|
|
8629
9502
|
inst.enum = def.entries;
|
|
8630
9503
|
inst.options = Object.values(def.entries);
|
|
8631
9504
|
const keys = new Set(Object.keys(def.entries));
|
|
@@ -8671,6 +9544,7 @@ function _enum(values, params) {
|
|
|
8671
9544
|
var ZodLiteral = /* @__PURE__ */ $constructor("ZodLiteral", (inst, def) => {
|
|
8672
9545
|
$ZodLiteral.init(inst, def);
|
|
8673
9546
|
ZodType.init(inst, def);
|
|
9547
|
+
inst._zod.processJSONSchema = (ctx, json, params) => literalProcessor(inst, ctx, json, params);
|
|
8674
9548
|
inst.values = new Set(def.values);
|
|
8675
9549
|
Object.defineProperty(inst, "value", {
|
|
8676
9550
|
get() {
|
|
@@ -8684,6 +9558,7 @@ var ZodLiteral = /* @__PURE__ */ $constructor("ZodLiteral", (inst, def) => {
|
|
|
8684
9558
|
var ZodTransform = /* @__PURE__ */ $constructor("ZodTransform", (inst, def) => {
|
|
8685
9559
|
$ZodTransform.init(inst, def);
|
|
8686
9560
|
ZodType.init(inst, def);
|
|
9561
|
+
inst._zod.processJSONSchema = (ctx, json, params) => transformProcessor(inst, ctx, json, params);
|
|
8687
9562
|
inst._zod.parse = (payload, _ctx) => {
|
|
8688
9563
|
if (_ctx.direction === "backward") {
|
|
8689
9564
|
throw new $ZodEncodeError(inst.constructor.name);
|
|
@@ -8721,6 +9596,7 @@ function transform(fn) {
|
|
|
8721
9596
|
var ZodOptional = /* @__PURE__ */ $constructor("ZodOptional", (inst, def) => {
|
|
8722
9597
|
$ZodOptional.init(inst, def);
|
|
8723
9598
|
ZodType.init(inst, def);
|
|
9599
|
+
inst._zod.processJSONSchema = (ctx, json, params) => optionalProcessor(inst, ctx, json, params);
|
|
8724
9600
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
8725
9601
|
});
|
|
8726
9602
|
function optional(innerType) {
|
|
@@ -8732,6 +9608,7 @@ function optional(innerType) {
|
|
|
8732
9608
|
var ZodNullable = /* @__PURE__ */ $constructor("ZodNullable", (inst, def) => {
|
|
8733
9609
|
$ZodNullable.init(inst, def);
|
|
8734
9610
|
ZodType.init(inst, def);
|
|
9611
|
+
inst._zod.processJSONSchema = (ctx, json, params) => nullableProcessor(inst, ctx, json, params);
|
|
8735
9612
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
8736
9613
|
});
|
|
8737
9614
|
function nullable(innerType) {
|
|
@@ -8743,6 +9620,7 @@ function nullable(innerType) {
|
|
|
8743
9620
|
var ZodDefault = /* @__PURE__ */ $constructor("ZodDefault", (inst, def) => {
|
|
8744
9621
|
$ZodDefault.init(inst, def);
|
|
8745
9622
|
ZodType.init(inst, def);
|
|
9623
|
+
inst._zod.processJSONSchema = (ctx, json, params) => defaultProcessor(inst, ctx, json, params);
|
|
8746
9624
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
8747
9625
|
inst.removeDefault = inst.unwrap;
|
|
8748
9626
|
});
|
|
@@ -8758,6 +9636,7 @@ function _default(innerType, defaultValue) {
|
|
|
8758
9636
|
var ZodPrefault = /* @__PURE__ */ $constructor("ZodPrefault", (inst, def) => {
|
|
8759
9637
|
$ZodPrefault.init(inst, def);
|
|
8760
9638
|
ZodType.init(inst, def);
|
|
9639
|
+
inst._zod.processJSONSchema = (ctx, json, params) => prefaultProcessor(inst, ctx, json, params);
|
|
8761
9640
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
8762
9641
|
});
|
|
8763
9642
|
function prefault(innerType, defaultValue) {
|
|
@@ -8772,6 +9651,7 @@ function prefault(innerType, defaultValue) {
|
|
|
8772
9651
|
var ZodNonOptional = /* @__PURE__ */ $constructor("ZodNonOptional", (inst, def) => {
|
|
8773
9652
|
$ZodNonOptional.init(inst, def);
|
|
8774
9653
|
ZodType.init(inst, def);
|
|
9654
|
+
inst._zod.processJSONSchema = (ctx, json, params) => nonoptionalProcessor(inst, ctx, json, params);
|
|
8775
9655
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
8776
9656
|
});
|
|
8777
9657
|
function nonoptional(innerType, params) {
|
|
@@ -8784,6 +9664,7 @@ function nonoptional(innerType, params) {
|
|
|
8784
9664
|
var ZodCatch = /* @__PURE__ */ $constructor("ZodCatch", (inst, def) => {
|
|
8785
9665
|
$ZodCatch.init(inst, def);
|
|
8786
9666
|
ZodType.init(inst, def);
|
|
9667
|
+
inst._zod.processJSONSchema = (ctx, json, params) => catchProcessor(inst, ctx, json, params);
|
|
8787
9668
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
8788
9669
|
inst.removeCatch = inst.unwrap;
|
|
8789
9670
|
});
|
|
@@ -8797,6 +9678,7 @@ function _catch(innerType, catchValue) {
|
|
|
8797
9678
|
var ZodPipe = /* @__PURE__ */ $constructor("ZodPipe", (inst, def) => {
|
|
8798
9679
|
$ZodPipe.init(inst, def);
|
|
8799
9680
|
ZodType.init(inst, def);
|
|
9681
|
+
inst._zod.processJSONSchema = (ctx, json, params) => pipeProcessor(inst, ctx, json, params);
|
|
8800
9682
|
inst.in = def.in;
|
|
8801
9683
|
inst.out = def.out;
|
|
8802
9684
|
});
|
|
@@ -8811,6 +9693,7 @@ function pipe2(in_, out) {
|
|
|
8811
9693
|
var ZodReadonly = /* @__PURE__ */ $constructor("ZodReadonly", (inst, def) => {
|
|
8812
9694
|
$ZodReadonly.init(inst, def);
|
|
8813
9695
|
ZodType.init(inst, def);
|
|
9696
|
+
inst._zod.processJSONSchema = (ctx, json, params) => readonlyProcessor(inst, ctx, json, params);
|
|
8814
9697
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
8815
9698
|
});
|
|
8816
9699
|
function readonly(innerType) {
|
|
@@ -8822,11 +9705,13 @@ function readonly(innerType) {
|
|
|
8822
9705
|
var ZodPromise = /* @__PURE__ */ $constructor("ZodPromise", (inst, def) => {
|
|
8823
9706
|
$ZodPromise.init(inst, def);
|
|
8824
9707
|
ZodType.init(inst, def);
|
|
9708
|
+
inst._zod.processJSONSchema = (ctx, json, params) => promiseProcessor(inst, ctx, json, params);
|
|
8825
9709
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
8826
9710
|
});
|
|
8827
9711
|
var ZodCustom = /* @__PURE__ */ $constructor("ZodCustom", (inst, def) => {
|
|
8828
9712
|
$ZodCustom.init(inst, def);
|
|
8829
9713
|
ZodType.init(inst, def);
|
|
9714
|
+
inst._zod.processJSONSchema = (ctx, json, params) => customProcessor(inst, ctx, json, params);
|
|
8830
9715
|
});
|
|
8831
9716
|
function refine(fn, _params = {}) {
|
|
8832
9717
|
return _refine(ZodCustom, fn, _params);
|
|
@@ -9300,7 +10185,8 @@ var openapi = ({
|
|
|
9300
10185
|
}
|
|
9301
10186
|
};
|
|
9302
10187
|
};
|
|
9303
|
-
const app = new Elysia({ name: "@elysiajs/openapi" })
|
|
10188
|
+
const app = new Elysia({ name: "@elysiajs/openapi" });
|
|
10189
|
+
app.use((app2) => {
|
|
9304
10190
|
if (provider === null) return app2;
|
|
9305
10191
|
const page = () => new Response(
|
|
9306
10192
|
provider === "swagger-ui" ? SwaggerUIRender(info, {
|