@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/cjs/index.js
CHANGED
|
@@ -547,11 +547,11 @@ __export(kind_exports, {
|
|
|
547
547
|
});
|
|
548
548
|
|
|
549
549
|
// node_modules/@sinclair/typebox/build/esm/type/symbols/symbols.mjs
|
|
550
|
-
var TransformKind = Symbol.for("TypeBox.Transform");
|
|
551
|
-
var ReadonlyKind = Symbol.for("TypeBox.Readonly");
|
|
552
|
-
var OptionalKind = Symbol.for("TypeBox.Optional");
|
|
553
|
-
var Hint = Symbol.for("TypeBox.Hint");
|
|
554
|
-
var Kind = Symbol.for("TypeBox.Kind");
|
|
550
|
+
var TransformKind = /* @__PURE__ */ Symbol.for("TypeBox.Transform");
|
|
551
|
+
var ReadonlyKind = /* @__PURE__ */ Symbol.for("TypeBox.Readonly");
|
|
552
|
+
var OptionalKind = /* @__PURE__ */ Symbol.for("TypeBox.Optional");
|
|
553
|
+
var Hint = /* @__PURE__ */ Symbol.for("TypeBox.Hint");
|
|
554
|
+
var Kind = /* @__PURE__ */ Symbol.for("TypeBox.Kind");
|
|
555
555
|
|
|
556
556
|
// node_modules/@sinclair/typebox/build/esm/type/guard/kind.mjs
|
|
557
557
|
function IsReadonly(value) {
|
|
@@ -2757,6 +2757,212 @@ openapi({
|
|
|
2757
2757
|
})`
|
|
2758
2758
|
};
|
|
2759
2759
|
var warned = {};
|
|
2760
|
+
var mergeObjectSchemas = (schemas) => {
|
|
2761
|
+
if (schemas.length === 0)
|
|
2762
|
+
return {
|
|
2763
|
+
schema: void 0,
|
|
2764
|
+
notObjects: []
|
|
2765
|
+
};
|
|
2766
|
+
if (schemas.length === 1)
|
|
2767
|
+
return schemas[0].type === "object" ? {
|
|
2768
|
+
schema: schemas[0],
|
|
2769
|
+
notObjects: []
|
|
2770
|
+
} : {
|
|
2771
|
+
schema: void 0,
|
|
2772
|
+
notObjects: schemas
|
|
2773
|
+
};
|
|
2774
|
+
let newSchema;
|
|
2775
|
+
const notObjects = [];
|
|
2776
|
+
let additionalPropertiesIsTrue = false;
|
|
2777
|
+
let additionalPropertiesIsFalse = false;
|
|
2778
|
+
for (const schema of schemas) {
|
|
2779
|
+
if (!schema) continue;
|
|
2780
|
+
if (schema.type !== "object") {
|
|
2781
|
+
notObjects.push(schema);
|
|
2782
|
+
continue;
|
|
2783
|
+
}
|
|
2784
|
+
if ("additionalProperties" in schema) {
|
|
2785
|
+
if (schema.additionalProperties === true)
|
|
2786
|
+
additionalPropertiesIsTrue = true;
|
|
2787
|
+
else if (schema.additionalProperties === false)
|
|
2788
|
+
additionalPropertiesIsFalse = true;
|
|
2789
|
+
}
|
|
2790
|
+
if (!newSchema) {
|
|
2791
|
+
newSchema = schema;
|
|
2792
|
+
continue;
|
|
2793
|
+
}
|
|
2794
|
+
newSchema = {
|
|
2795
|
+
...newSchema,
|
|
2796
|
+
...schema,
|
|
2797
|
+
properties: {
|
|
2798
|
+
...newSchema.properties,
|
|
2799
|
+
...schema.properties
|
|
2800
|
+
},
|
|
2801
|
+
required: [
|
|
2802
|
+
...newSchema?.required ?? [],
|
|
2803
|
+
...schema.required ?? []
|
|
2804
|
+
]
|
|
2805
|
+
};
|
|
2806
|
+
}
|
|
2807
|
+
if (newSchema) {
|
|
2808
|
+
if (newSchema.required)
|
|
2809
|
+
newSchema.required = [...new Set(newSchema.required)];
|
|
2810
|
+
if (additionalPropertiesIsFalse) newSchema.additionalProperties = false;
|
|
2811
|
+
else if (additionalPropertiesIsTrue)
|
|
2812
|
+
newSchema.additionalProperties = true;
|
|
2813
|
+
}
|
|
2814
|
+
return {
|
|
2815
|
+
schema: newSchema,
|
|
2816
|
+
notObjects
|
|
2817
|
+
};
|
|
2818
|
+
};
|
|
2819
|
+
var isTSchema = (value) => {
|
|
2820
|
+
if (!value || typeof value !== "object") return false;
|
|
2821
|
+
if (Kind in value) return true;
|
|
2822
|
+
const keys = Object.keys(value);
|
|
2823
|
+
if (keys.length > 0 && keys.every((k) => !isNaN(Number(k)))) {
|
|
2824
|
+
return false;
|
|
2825
|
+
}
|
|
2826
|
+
return false;
|
|
2827
|
+
};
|
|
2828
|
+
var normalizeSchemaReference = (schema) => {
|
|
2829
|
+
if (!schema) return void 0;
|
|
2830
|
+
if (typeof schema !== "string") return schema;
|
|
2831
|
+
return import_elysia.t.Ref(schema);
|
|
2832
|
+
};
|
|
2833
|
+
var mergeSchemaProperty = (existing, incoming, vendors) => {
|
|
2834
|
+
if (!existing) return incoming;
|
|
2835
|
+
if (!incoming) return existing;
|
|
2836
|
+
const existingSchema = normalizeSchemaReference(existing);
|
|
2837
|
+
let incomingSchema = normalizeSchemaReference(incoming);
|
|
2838
|
+
if (!existingSchema) return incoming;
|
|
2839
|
+
if (!incomingSchema) return existing;
|
|
2840
|
+
if (!isTSchema(incomingSchema) && incomingSchema["~standard"])
|
|
2841
|
+
incomingSchema = unwrapSchema(incomingSchema, vendors);
|
|
2842
|
+
if (!incomingSchema) return existing;
|
|
2843
|
+
const { schema: mergedSchema, notObjects } = mergeObjectSchemas([
|
|
2844
|
+
existingSchema,
|
|
2845
|
+
incomingSchema
|
|
2846
|
+
]);
|
|
2847
|
+
if (notObjects.length > 0) {
|
|
2848
|
+
if (mergedSchema) return import_elysia.t.Intersect([mergedSchema, ...notObjects]);
|
|
2849
|
+
return notObjects.length === 1 ? notObjects[0] : import_elysia.t.Intersect(notObjects);
|
|
2850
|
+
}
|
|
2851
|
+
return mergedSchema;
|
|
2852
|
+
};
|
|
2853
|
+
var unwrapResponseSchema = (schema, vendors) => typeof schema === "string" ? normalizeSchemaReference(schema) : !schema ? void 0 : isTSchema(schema) ? schema : (
|
|
2854
|
+
// @ts-ignore
|
|
2855
|
+
schema["~standard"] ? unwrapSchema(schema, vendors, "output") : Object.fromEntries(
|
|
2856
|
+
Object.entries(schema).map(([status, schema2]) => [
|
|
2857
|
+
status,
|
|
2858
|
+
typeof schema2 === "string" ? normalizeSchemaReference(schema2) : isTSchema(schema2) ? schema2 : unwrapSchema(schema2, vendors, "output")
|
|
2859
|
+
])
|
|
2860
|
+
)
|
|
2861
|
+
);
|
|
2862
|
+
var mergeResponseSchema = (_existing, _incoming, vendors) => {
|
|
2863
|
+
if (!_existing) return _incoming;
|
|
2864
|
+
if (!_incoming) return _existing;
|
|
2865
|
+
let existing = unwrapResponseSchema(_existing, vendors);
|
|
2866
|
+
let incoming = unwrapResponseSchema(_incoming, vendors);
|
|
2867
|
+
if (!existing && !incoming) return void 0;
|
|
2868
|
+
if (incoming && !existing) return incoming;
|
|
2869
|
+
if (existing && !incoming) return existing;
|
|
2870
|
+
if (isTSchema(existing) || existing?.["~standard"])
|
|
2871
|
+
existing = {
|
|
2872
|
+
200: existing
|
|
2873
|
+
};
|
|
2874
|
+
if (isTSchema(incoming) || incoming?.["~standard"])
|
|
2875
|
+
incoming = {
|
|
2876
|
+
200: incoming
|
|
2877
|
+
};
|
|
2878
|
+
const schema = {
|
|
2879
|
+
...incoming
|
|
2880
|
+
};
|
|
2881
|
+
for (const status of Object.keys(existing ?? {})) {
|
|
2882
|
+
const existingSchema = existing[status];
|
|
2883
|
+
const incomingSchema = incoming[status];
|
|
2884
|
+
if (existingSchema && incomingSchema)
|
|
2885
|
+
schema[status] = mergeSchemaProperty(
|
|
2886
|
+
existingSchema,
|
|
2887
|
+
incomingSchema,
|
|
2888
|
+
vendors
|
|
2889
|
+
);
|
|
2890
|
+
else if (existingSchema) schema[status] = existingSchema;
|
|
2891
|
+
else if (incomingSchema) schema[status] = incomingSchema;
|
|
2892
|
+
}
|
|
2893
|
+
return schema;
|
|
2894
|
+
};
|
|
2895
|
+
var mergeStandaloneValidators = (hooks, vendors) => {
|
|
2896
|
+
const merged = { ...hooks };
|
|
2897
|
+
if (!hooks.standaloneValidator?.length) return merged;
|
|
2898
|
+
for (const validator of hooks.standaloneValidator) {
|
|
2899
|
+
if (validator.body)
|
|
2900
|
+
merged.body = mergeSchemaProperty(
|
|
2901
|
+
merged.body,
|
|
2902
|
+
validator.body,
|
|
2903
|
+
vendors
|
|
2904
|
+
);
|
|
2905
|
+
if (validator.headers)
|
|
2906
|
+
merged.headers = mergeSchemaProperty(
|
|
2907
|
+
merged.headers,
|
|
2908
|
+
validator.headers,
|
|
2909
|
+
vendors
|
|
2910
|
+
);
|
|
2911
|
+
if (validator.query)
|
|
2912
|
+
merged.query = mergeSchemaProperty(
|
|
2913
|
+
merged.query,
|
|
2914
|
+
validator.query,
|
|
2915
|
+
vendors
|
|
2916
|
+
);
|
|
2917
|
+
if (validator.params)
|
|
2918
|
+
merged.params = mergeSchemaProperty(
|
|
2919
|
+
merged.params,
|
|
2920
|
+
validator.params,
|
|
2921
|
+
vendors
|
|
2922
|
+
);
|
|
2923
|
+
if (validator.cookie)
|
|
2924
|
+
merged.cookie = mergeSchemaProperty(
|
|
2925
|
+
merged.cookie,
|
|
2926
|
+
validator.cookie,
|
|
2927
|
+
vendors
|
|
2928
|
+
);
|
|
2929
|
+
if (validator.response)
|
|
2930
|
+
merged.response = mergeResponseSchema(
|
|
2931
|
+
merged.response,
|
|
2932
|
+
validator.response,
|
|
2933
|
+
vendors
|
|
2934
|
+
);
|
|
2935
|
+
}
|
|
2936
|
+
if (typeof merged.body === "string")
|
|
2937
|
+
merged.body = normalizeSchemaReference(merged.body);
|
|
2938
|
+
if (typeof merged.headers === "string")
|
|
2939
|
+
merged.headers = normalizeSchemaReference(merged.headers);
|
|
2940
|
+
if (typeof merged.query === "string")
|
|
2941
|
+
merged.query = normalizeSchemaReference(merged.query);
|
|
2942
|
+
if (typeof merged.params === "string")
|
|
2943
|
+
merged.params = normalizeSchemaReference(merged.params);
|
|
2944
|
+
if (typeof merged.cookie === "string")
|
|
2945
|
+
merged.cookie = normalizeSchemaReference(merged.cookie);
|
|
2946
|
+
if (merged.response && typeof merged.response !== "string") {
|
|
2947
|
+
const response = merged.response;
|
|
2948
|
+
if ("type" in response || "$ref" in response) {
|
|
2949
|
+
if (typeof response === "string")
|
|
2950
|
+
merged.response = normalizeSchemaReference(response);
|
|
2951
|
+
} else {
|
|
2952
|
+
for (const [status, schema] of Object.entries(response))
|
|
2953
|
+
if (typeof schema === "string")
|
|
2954
|
+
response[status] = normalizeSchemaReference(schema);
|
|
2955
|
+
}
|
|
2956
|
+
}
|
|
2957
|
+
return merged;
|
|
2958
|
+
};
|
|
2959
|
+
var flattenRoutes = (routes, vendors) => routes.map((route) => {
|
|
2960
|
+
if (!route.hooks?.standaloneValidator?.length) return route;
|
|
2961
|
+
return {
|
|
2962
|
+
...route,
|
|
2963
|
+
hooks: mergeStandaloneValidators(route.hooks, vendors)
|
|
2964
|
+
};
|
|
2965
|
+
});
|
|
2760
2966
|
var unwrapReference = (schema, definitions) => {
|
|
2761
2967
|
const ref = schema?.$ref;
|
|
2762
2968
|
if (!ref) return schema;
|
|
@@ -2764,13 +2970,15 @@ var unwrapReference = (schema, definitions) => {
|
|
|
2764
2970
|
if (ref && definitions[name]) schema = definitions[name];
|
|
2765
2971
|
return enumToOpenApi(schema);
|
|
2766
2972
|
};
|
|
2767
|
-
var unwrapSchema = (schema, mapJsonSchema) => {
|
|
2973
|
+
var unwrapSchema = (schema, mapJsonSchema, io = "input") => {
|
|
2768
2974
|
if (!schema) return;
|
|
2769
2975
|
if (typeof schema === "string") schema = toRef(schema);
|
|
2770
2976
|
if (Kind in schema) return enumToOpenApi(schema);
|
|
2771
2977
|
if (Kind in schema || !schema?.["~standard"]) return;
|
|
2772
2978
|
const vendor = schema["~standard"].vendor;
|
|
2773
2979
|
try {
|
|
2980
|
+
if (schema["~standard"]?.jsonSchema?.[io])
|
|
2981
|
+
return schema["~standard"]?.jsonSchema?.[io]?.();
|
|
2774
2982
|
if (mapJsonSchema?.[vendor] && typeof mapJsonSchema[vendor] === "function")
|
|
2775
2983
|
return enumToOpenApi(mapJsonSchema[vendor](schema));
|
|
2776
2984
|
switch (vendor) {
|
|
@@ -2865,7 +3073,6 @@ function toOpenAPISchema(app, exclude, references, vendors) {
|
|
|
2865
3073
|
const excludePaths = Array.isArray(exclude?.paths) ? exclude.paths : typeof exclude?.paths !== "undefined" ? [exclude.paths] : [];
|
|
2866
3074
|
const paths = /* @__PURE__ */ Object.create(null);
|
|
2867
3075
|
const definitions = app.getGlobalDefinitions?.().type;
|
|
2868
|
-
const routes = app.getGlobalRoutes();
|
|
2869
3076
|
if (references) {
|
|
2870
3077
|
if (!Array.isArray(references)) references = [references];
|
|
2871
3078
|
for (let i = 0; i < references.length; i++) {
|
|
@@ -2873,6 +3080,7 @@ function toOpenAPISchema(app, exclude, references, vendors) {
|
|
|
2873
3080
|
if (typeof reference === "function") references[i] = reference();
|
|
2874
3081
|
}
|
|
2875
3082
|
}
|
|
3083
|
+
const routes = flattenRoutes(app.getGlobalRoutes(), vendors);
|
|
2876
3084
|
for (const route of routes) {
|
|
2877
3085
|
if (route.hooks?.detail?.hide) continue;
|
|
2878
3086
|
const method = route.method.toLowerCase();
|
|
@@ -3062,7 +3270,7 @@ function toOpenAPISchema(app, exclude, references, vendors) {
|
|
|
3062
3270
|
if (typeof hooks.response === "object" && // TypeBox
|
|
3063
3271
|
!hooks.response.type && !hooks.response.$ref && !hooks.response["~standard"]) {
|
|
3064
3272
|
for (let [status, schema] of Object.entries(hooks.response)) {
|
|
3065
|
-
const response = unwrapSchema(schema, vendors);
|
|
3273
|
+
const response = unwrapSchema(schema, vendors, "output");
|
|
3066
3274
|
if (!response) continue;
|
|
3067
3275
|
const { type, description, $ref, ..._options } = unwrapReference(response, definitions);
|
|
3068
3276
|
operation.responses[status] = {
|
|
@@ -3079,7 +3287,7 @@ function toOpenAPISchema(app, exclude, references, vendors) {
|
|
|
3079
3287
|
};
|
|
3080
3288
|
}
|
|
3081
3289
|
} else {
|
|
3082
|
-
const response = unwrapSchema(hooks.response, vendors);
|
|
3290
|
+
const response = unwrapSchema(hooks.response, vendors, "output");
|
|
3083
3291
|
if (response) {
|
|
3084
3292
|
const {
|
|
3085
3293
|
type: _type,
|
|
@@ -3904,47 +4112,41 @@ function TypeBoxFromTypeBox(type) {
|
|
|
3904
4112
|
return CloneType(type);
|
|
3905
4113
|
}
|
|
3906
4114
|
|
|
3907
|
-
// node_modules/valibot/dist/index.
|
|
3908
|
-
var store;
|
|
4115
|
+
// node_modules/valibot/dist/index.mjs
|
|
4116
|
+
var store$4;
|
|
3909
4117
|
// @__NO_SIDE_EFFECTS__
|
|
3910
|
-
function getGlobalConfig(
|
|
4118
|
+
function getGlobalConfig(config$1) {
|
|
3911
4119
|
return {
|
|
3912
|
-
lang:
|
|
3913
|
-
message:
|
|
3914
|
-
abortEarly:
|
|
3915
|
-
abortPipeEarly:
|
|
4120
|
+
lang: config$1?.lang ?? store$4?.lang,
|
|
4121
|
+
message: config$1?.message,
|
|
4122
|
+
abortEarly: config$1?.abortEarly ?? store$4?.abortEarly,
|
|
4123
|
+
abortPipeEarly: config$1?.abortPipeEarly ?? store$4?.abortPipeEarly
|
|
3916
4124
|
};
|
|
3917
4125
|
}
|
|
3918
|
-
var
|
|
4126
|
+
var store$3;
|
|
3919
4127
|
// @__NO_SIDE_EFFECTS__
|
|
3920
4128
|
function getGlobalMessage(lang) {
|
|
3921
|
-
return
|
|
4129
|
+
return store$3?.get(lang);
|
|
3922
4130
|
}
|
|
3923
|
-
var
|
|
4131
|
+
var store$2;
|
|
3924
4132
|
// @__NO_SIDE_EFFECTS__
|
|
3925
4133
|
function getSchemaMessage(lang) {
|
|
3926
|
-
return
|
|
4134
|
+
return store$2?.get(lang);
|
|
3927
4135
|
}
|
|
3928
|
-
var
|
|
4136
|
+
var store$1;
|
|
3929
4137
|
// @__NO_SIDE_EFFECTS__
|
|
3930
4138
|
function getSpecificMessage(reference, lang) {
|
|
3931
|
-
return
|
|
4139
|
+
return store$1?.get(reference)?.get(lang);
|
|
3932
4140
|
}
|
|
3933
4141
|
// @__NO_SIDE_EFFECTS__
|
|
3934
4142
|
function _stringify(input) {
|
|
3935
4143
|
const type = typeof input;
|
|
3936
|
-
if (type === "string") {
|
|
3937
|
-
|
|
3938
|
-
|
|
3939
|
-
if (type === "number" || type === "bigint" || type === "boolean") {
|
|
3940
|
-
return `${input}`;
|
|
3941
|
-
}
|
|
3942
|
-
if (type === "object" || type === "function") {
|
|
3943
|
-
return (input && Object.getPrototypeOf(input)?.constructor?.name) ?? "null";
|
|
3944
|
-
}
|
|
4144
|
+
if (type === "string") return `"${input}"`;
|
|
4145
|
+
if (type === "number" || type === "bigint" || type === "boolean") return `${input}`;
|
|
4146
|
+
if (type === "object" || type === "function") return (input && Object.getPrototypeOf(input)?.constructor?.name) ?? "null";
|
|
3945
4147
|
return type;
|
|
3946
4148
|
}
|
|
3947
|
-
function _addIssue(context, label, dataset,
|
|
4149
|
+
function _addIssue(context, label, dataset, config$1, other) {
|
|
3948
4150
|
const input = other && "input" in other ? other.input : dataset.value;
|
|
3949
4151
|
const expected = other?.expected ?? context.expects ?? null;
|
|
3950
4152
|
const received = other?.received ?? /* @__PURE__ */ _stringify(input);
|
|
@@ -3958,48 +4160,49 @@ function _addIssue(context, label, dataset, config2, other) {
|
|
|
3958
4160
|
requirement: context.requirement,
|
|
3959
4161
|
path: other?.path,
|
|
3960
4162
|
issues: other?.issues,
|
|
3961
|
-
lang:
|
|
3962
|
-
abortEarly:
|
|
3963
|
-
abortPipeEarly:
|
|
4163
|
+
lang: config$1.lang,
|
|
4164
|
+
abortEarly: config$1.abortEarly,
|
|
4165
|
+
abortPipeEarly: config$1.abortPipeEarly
|
|
3964
4166
|
};
|
|
3965
4167
|
const isSchema = context.kind === "schema";
|
|
3966
|
-
const
|
|
3967
|
-
if (
|
|
3968
|
-
|
|
3969
|
-
|
|
3970
|
-
|
|
3971
|
-
) : message2;
|
|
3972
|
-
}
|
|
3973
|
-
if (isSchema) {
|
|
3974
|
-
dataset.typed = false;
|
|
3975
|
-
}
|
|
3976
|
-
if (dataset.issues) {
|
|
3977
|
-
dataset.issues.push(issue2);
|
|
3978
|
-
} else {
|
|
3979
|
-
dataset.issues = [issue2];
|
|
3980
|
-
}
|
|
4168
|
+
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);
|
|
4169
|
+
if (message$1 !== void 0) issue2.message = typeof message$1 === "function" ? message$1(issue2) : message$1;
|
|
4170
|
+
if (isSchema) dataset.typed = false;
|
|
4171
|
+
if (dataset.issues) dataset.issues.push(issue2);
|
|
4172
|
+
else dataset.issues = [issue2];
|
|
3981
4173
|
}
|
|
3982
4174
|
// @__NO_SIDE_EFFECTS__
|
|
3983
4175
|
function _getStandardProps(context) {
|
|
3984
4176
|
return {
|
|
3985
4177
|
version: 1,
|
|
3986
4178
|
vendor: "valibot",
|
|
3987
|
-
validate(
|
|
3988
|
-
return context["~run"]({ value:
|
|
4179
|
+
validate(value$1) {
|
|
4180
|
+
return context["~run"]({ value: value$1 }, /* @__PURE__ */ getGlobalConfig());
|
|
3989
4181
|
}
|
|
3990
4182
|
};
|
|
3991
4183
|
}
|
|
3992
4184
|
var NON_DIGIT_REGEX = /\D/gu;
|
|
3993
4185
|
// @__NO_SIDE_EFFECTS__
|
|
3994
4186
|
function _isLuhnAlgo(input) {
|
|
3995
|
-
const
|
|
3996
|
-
let
|
|
4187
|
+
const number$1 = input.replace(NON_DIGIT_REGEX, "");
|
|
4188
|
+
let length$1 = number$1.length;
|
|
3997
4189
|
let bit = 1;
|
|
3998
4190
|
let sum = 0;
|
|
3999
|
-
while (
|
|
4000
|
-
const
|
|
4191
|
+
while (length$1) {
|
|
4192
|
+
const value$1 = +number$1[--length$1];
|
|
4001
4193
|
bit ^= 1;
|
|
4002
|
-
sum += bit ? [
|
|
4194
|
+
sum += bit ? [
|
|
4195
|
+
0,
|
|
4196
|
+
2,
|
|
4197
|
+
4,
|
|
4198
|
+
6,
|
|
4199
|
+
8,
|
|
4200
|
+
1,
|
|
4201
|
+
3,
|
|
4202
|
+
5,
|
|
4203
|
+
7,
|
|
4204
|
+
9
|
|
4205
|
+
][value$1] : value$1;
|
|
4003
4206
|
}
|
|
4004
4207
|
return sum % 10 === 0;
|
|
4005
4208
|
}
|
|
@@ -4009,14 +4212,8 @@ var CUID2_REGEX = /^[a-z][\da-z]*$/u;
|
|
|
4009
4212
|
var DECIMAL_REGEX = /^[+-]?(?:\d*\.)?\d+$/u;
|
|
4010
4213
|
var DIGITS_REGEX = /^\d+$/u;
|
|
4011
4214
|
var EMAIL_REGEX = /^[\w+-]+(?:\.[\w+-]+)*@[\da-z]+(?:[.-][\da-z]+)*\.[a-z]{2,}$/iu;
|
|
4012
|
-
var EMOJI_REGEX = (
|
|
4013
|
-
|
|
4014
|
-
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")
|
|
4015
|
-
);
|
|
4016
|
-
var IPV4_REGEX = (
|
|
4017
|
-
// eslint-disable-next-line redos-detector/no-unsafe-regex -- false positive
|
|
4018
|
-
/^(?:(?:[1-9]|1\d|2[0-4])?\d|25[0-5])(?:\.(?:(?:[1-9]|1\d|2[0-4])?\d|25[0-5])){3}$/u
|
|
4019
|
-
);
|
|
4215
|
+
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");
|
|
4216
|
+
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;
|
|
4020
4217
|
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;
|
|
4021
4218
|
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;
|
|
4022
4219
|
var ISO_DATE_REGEX = /^\d{4}-(?:0[1-9]|1[0-2])-(?:[12]\d|0[1-9]|3[01])$/u;
|
|
@@ -4033,7 +4230,7 @@ var OCTAL_REGEX = /^(?:0o)?[0-7]+$/u;
|
|
|
4033
4230
|
var ULID_REGEX = /^[\da-hjkmnp-tv-zA-HJKMNP-TV-Z]{26}$/u;
|
|
4034
4231
|
var UUID_REGEX = /^[\da-f]{8}(?:-[\da-f]{4}){3}-[\da-f]{12}$/iu;
|
|
4035
4232
|
// @__NO_SIDE_EFFECTS__
|
|
4036
|
-
function base64(
|
|
4233
|
+
function base64(message$1) {
|
|
4037
4234
|
return {
|
|
4038
4235
|
kind: "validation",
|
|
4039
4236
|
type: "base64",
|
|
@@ -4041,17 +4238,15 @@ function base64(message2) {
|
|
|
4041
4238
|
async: false,
|
|
4042
4239
|
expects: null,
|
|
4043
4240
|
requirement: BASE64_REGEX,
|
|
4044
|
-
message:
|
|
4045
|
-
"~run"(dataset,
|
|
4046
|
-
if (dataset.typed && !this.requirement.test(dataset.value))
|
|
4047
|
-
_addIssue(this, "Base64", dataset, config2);
|
|
4048
|
-
}
|
|
4241
|
+
message: message$1,
|
|
4242
|
+
"~run"(dataset, config$1) {
|
|
4243
|
+
if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "Base64", dataset, config$1);
|
|
4049
4244
|
return dataset;
|
|
4050
4245
|
}
|
|
4051
4246
|
};
|
|
4052
4247
|
}
|
|
4053
4248
|
// @__NO_SIDE_EFFECTS__
|
|
4054
|
-
function bic(
|
|
4249
|
+
function bic(message$1) {
|
|
4055
4250
|
return {
|
|
4056
4251
|
kind: "validation",
|
|
4057
4252
|
type: "bic",
|
|
@@ -4059,11 +4254,9 @@ function bic(message2) {
|
|
|
4059
4254
|
async: false,
|
|
4060
4255
|
expects: null,
|
|
4061
4256
|
requirement: BIC_REGEX,
|
|
4062
|
-
message:
|
|
4063
|
-
"~run"(dataset,
|
|
4064
|
-
if (dataset.typed && !this.requirement.test(dataset.value))
|
|
4065
|
-
_addIssue(this, "BIC", dataset, config2);
|
|
4066
|
-
}
|
|
4257
|
+
message: message$1,
|
|
4258
|
+
"~run"(dataset, config$1) {
|
|
4259
|
+
if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "BIC", dataset, config$1);
|
|
4067
4260
|
return dataset;
|
|
4068
4261
|
}
|
|
4069
4262
|
};
|
|
@@ -4071,24 +4264,16 @@ function bic(message2) {
|
|
|
4071
4264
|
var CREDIT_CARD_REGEX = /^(?:\d{14,19}|\d{4}(?: \d{3,6}){2,4}|\d{4}(?:-\d{3,6}){2,4})$/u;
|
|
4072
4265
|
var SANITIZE_REGEX = /[- ]/gu;
|
|
4073
4266
|
var PROVIDER_REGEX_LIST = [
|
|
4074
|
-
// American Express
|
|
4075
4267
|
/^3[47]\d{13}$/u,
|
|
4076
|
-
// Diners Club
|
|
4077
4268
|
/^3(?:0[0-5]|[68]\d)\d{11,13}$/u,
|
|
4078
|
-
// Discover
|
|
4079
4269
|
/^6(?:011|5\d{2})\d{12,15}$/u,
|
|
4080
|
-
// JCB
|
|
4081
4270
|
/^(?:2131|1800|35\d{3})\d{11}$/u,
|
|
4082
|
-
// Mastercard
|
|
4083
|
-
// eslint-disable-next-line redos-detector/no-unsafe-regex
|
|
4084
4271
|
/^5[1-5]\d{2}|(?:222\d|22[3-9]\d|2[3-6]\d{2}|27[01]\d|2720)\d{12}$/u,
|
|
4085
|
-
// UnionPay
|
|
4086
4272
|
/^(?:6[27]\d{14,17}|81\d{14,17})$/u,
|
|
4087
|
-
// Visa
|
|
4088
4273
|
/^4\d{12}(?:\d{3,6})?$/u
|
|
4089
4274
|
];
|
|
4090
4275
|
// @__NO_SIDE_EFFECTS__
|
|
4091
|
-
function creditCard(
|
|
4276
|
+
function creditCard(message$1) {
|
|
4092
4277
|
return {
|
|
4093
4278
|
kind: "validation",
|
|
4094
4279
|
type: "credit_card",
|
|
@@ -4097,22 +4282,17 @@ function creditCard(message2) {
|
|
|
4097
4282
|
expects: null,
|
|
4098
4283
|
requirement(input) {
|
|
4099
4284
|
let sanitized;
|
|
4100
|
-
return CREDIT_CARD_REGEX.test(input) &&
|
|
4101
|
-
(sanitized = input.replace(SANITIZE_REGEX, "")) && // Check if it matches a provider
|
|
4102
|
-
PROVIDER_REGEX_LIST.some((regex2) => regex2.test(sanitized)) && // Check if passes luhn algorithm
|
|
4103
|
-
/* @__PURE__ */ _isLuhnAlgo(sanitized);
|
|
4285
|
+
return CREDIT_CARD_REGEX.test(input) && (sanitized = input.replace(SANITIZE_REGEX, "")) && PROVIDER_REGEX_LIST.some((regex$1) => regex$1.test(sanitized)) && /* @__PURE__ */ _isLuhnAlgo(sanitized);
|
|
4104
4286
|
},
|
|
4105
|
-
message:
|
|
4106
|
-
"~run"(dataset,
|
|
4107
|
-
if (dataset.typed && !this.requirement(dataset.value))
|
|
4108
|
-
_addIssue(this, "credit card", dataset, config2);
|
|
4109
|
-
}
|
|
4287
|
+
message: message$1,
|
|
4288
|
+
"~run"(dataset, config$1) {
|
|
4289
|
+
if (dataset.typed && !this.requirement(dataset.value)) _addIssue(this, "credit card", dataset, config$1);
|
|
4110
4290
|
return dataset;
|
|
4111
4291
|
}
|
|
4112
4292
|
};
|
|
4113
4293
|
}
|
|
4114
4294
|
// @__NO_SIDE_EFFECTS__
|
|
4115
|
-
function cuid2(
|
|
4295
|
+
function cuid2(message$1) {
|
|
4116
4296
|
return {
|
|
4117
4297
|
kind: "validation",
|
|
4118
4298
|
type: "cuid2",
|
|
@@ -4120,17 +4300,15 @@ function cuid2(message2) {
|
|
|
4120
4300
|
async: false,
|
|
4121
4301
|
expects: null,
|
|
4122
4302
|
requirement: CUID2_REGEX,
|
|
4123
|
-
message:
|
|
4124
|
-
"~run"(dataset,
|
|
4125
|
-
if (dataset.typed && !this.requirement.test(dataset.value))
|
|
4126
|
-
_addIssue(this, "Cuid2", dataset, config2);
|
|
4127
|
-
}
|
|
4303
|
+
message: message$1,
|
|
4304
|
+
"~run"(dataset, config$1) {
|
|
4305
|
+
if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "Cuid2", dataset, config$1);
|
|
4128
4306
|
return dataset;
|
|
4129
4307
|
}
|
|
4130
4308
|
};
|
|
4131
4309
|
}
|
|
4132
4310
|
// @__NO_SIDE_EFFECTS__
|
|
4133
|
-
function decimal(
|
|
4311
|
+
function decimal(message$1) {
|
|
4134
4312
|
return {
|
|
4135
4313
|
kind: "validation",
|
|
4136
4314
|
type: "decimal",
|
|
@@ -4138,17 +4316,15 @@ function decimal(message2) {
|
|
|
4138
4316
|
async: false,
|
|
4139
4317
|
expects: null,
|
|
4140
4318
|
requirement: DECIMAL_REGEX,
|
|
4141
|
-
message:
|
|
4142
|
-
"~run"(dataset,
|
|
4143
|
-
if (dataset.typed && !this.requirement.test(dataset.value))
|
|
4144
|
-
_addIssue(this, "decimal", dataset, config2);
|
|
4145
|
-
}
|
|
4319
|
+
message: message$1,
|
|
4320
|
+
"~run"(dataset, config$1) {
|
|
4321
|
+
if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "decimal", dataset, config$1);
|
|
4146
4322
|
return dataset;
|
|
4147
4323
|
}
|
|
4148
4324
|
};
|
|
4149
4325
|
}
|
|
4150
4326
|
// @__NO_SIDE_EFFECTS__
|
|
4151
|
-
function digits(
|
|
4327
|
+
function digits(message$1) {
|
|
4152
4328
|
return {
|
|
4153
4329
|
kind: "validation",
|
|
4154
4330
|
type: "digits",
|
|
@@ -4156,17 +4332,15 @@ function digits(message2) {
|
|
|
4156
4332
|
async: false,
|
|
4157
4333
|
expects: null,
|
|
4158
4334
|
requirement: DIGITS_REGEX,
|
|
4159
|
-
message:
|
|
4160
|
-
"~run"(dataset,
|
|
4161
|
-
if (dataset.typed && !this.requirement.test(dataset.value))
|
|
4162
|
-
_addIssue(this, "digits", dataset, config2);
|
|
4163
|
-
}
|
|
4335
|
+
message: message$1,
|
|
4336
|
+
"~run"(dataset, config$1) {
|
|
4337
|
+
if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "digits", dataset, config$1);
|
|
4164
4338
|
return dataset;
|
|
4165
4339
|
}
|
|
4166
4340
|
};
|
|
4167
4341
|
}
|
|
4168
4342
|
// @__NO_SIDE_EFFECTS__
|
|
4169
|
-
function email(
|
|
4343
|
+
function email(message$1) {
|
|
4170
4344
|
return {
|
|
4171
4345
|
kind: "validation",
|
|
4172
4346
|
type: "email",
|
|
@@ -4174,17 +4348,15 @@ function email(message2) {
|
|
|
4174
4348
|
expects: null,
|
|
4175
4349
|
async: false,
|
|
4176
4350
|
requirement: EMAIL_REGEX,
|
|
4177
|
-
message:
|
|
4178
|
-
"~run"(dataset,
|
|
4179
|
-
if (dataset.typed && !this.requirement.test(dataset.value))
|
|
4180
|
-
_addIssue(this, "email", dataset, config2);
|
|
4181
|
-
}
|
|
4351
|
+
message: message$1,
|
|
4352
|
+
"~run"(dataset, config$1) {
|
|
4353
|
+
if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "email", dataset, config$1);
|
|
4182
4354
|
return dataset;
|
|
4183
4355
|
}
|
|
4184
4356
|
};
|
|
4185
4357
|
}
|
|
4186
4358
|
// @__NO_SIDE_EFFECTS__
|
|
4187
|
-
function emoji(
|
|
4359
|
+
function emoji(message$1) {
|
|
4188
4360
|
return {
|
|
4189
4361
|
kind: "validation",
|
|
4190
4362
|
type: "emoji",
|
|
@@ -4192,17 +4364,15 @@ function emoji(message2) {
|
|
|
4192
4364
|
async: false,
|
|
4193
4365
|
expects: null,
|
|
4194
4366
|
requirement: EMOJI_REGEX,
|
|
4195
|
-
message:
|
|
4196
|
-
"~run"(dataset,
|
|
4197
|
-
if (dataset.typed && !this.requirement.test(dataset.value))
|
|
4198
|
-
_addIssue(this, "emoji", dataset, config2);
|
|
4199
|
-
}
|
|
4367
|
+
message: message$1,
|
|
4368
|
+
"~run"(dataset, config$1) {
|
|
4369
|
+
if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "emoji", dataset, config$1);
|
|
4200
4370
|
return dataset;
|
|
4201
4371
|
}
|
|
4202
4372
|
};
|
|
4203
4373
|
}
|
|
4204
4374
|
// @__NO_SIDE_EFFECTS__
|
|
4205
|
-
function ip(
|
|
4375
|
+
function ip(message$1) {
|
|
4206
4376
|
return {
|
|
4207
4377
|
kind: "validation",
|
|
4208
4378
|
type: "ip",
|
|
@@ -4210,17 +4380,15 @@ function ip(message2) {
|
|
|
4210
4380
|
async: false,
|
|
4211
4381
|
expects: null,
|
|
4212
4382
|
requirement: IP_REGEX,
|
|
4213
|
-
message:
|
|
4214
|
-
"~run"(dataset,
|
|
4215
|
-
if (dataset.typed && !this.requirement.test(dataset.value))
|
|
4216
|
-
_addIssue(this, "IP", dataset, config2);
|
|
4217
|
-
}
|
|
4383
|
+
message: message$1,
|
|
4384
|
+
"~run"(dataset, config$1) {
|
|
4385
|
+
if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "IP", dataset, config$1);
|
|
4218
4386
|
return dataset;
|
|
4219
4387
|
}
|
|
4220
4388
|
};
|
|
4221
4389
|
}
|
|
4222
4390
|
// @__NO_SIDE_EFFECTS__
|
|
4223
|
-
function ipv4(
|
|
4391
|
+
function ipv4(message$1) {
|
|
4224
4392
|
return {
|
|
4225
4393
|
kind: "validation",
|
|
4226
4394
|
type: "ipv4",
|
|
@@ -4228,17 +4396,15 @@ function ipv4(message2) {
|
|
|
4228
4396
|
async: false,
|
|
4229
4397
|
expects: null,
|
|
4230
4398
|
requirement: IPV4_REGEX,
|
|
4231
|
-
message:
|
|
4232
|
-
"~run"(dataset,
|
|
4233
|
-
if (dataset.typed && !this.requirement.test(dataset.value))
|
|
4234
|
-
_addIssue(this, "IPv4", dataset, config2);
|
|
4235
|
-
}
|
|
4399
|
+
message: message$1,
|
|
4400
|
+
"~run"(dataset, config$1) {
|
|
4401
|
+
if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "IPv4", dataset, config$1);
|
|
4236
4402
|
return dataset;
|
|
4237
4403
|
}
|
|
4238
4404
|
};
|
|
4239
4405
|
}
|
|
4240
4406
|
// @__NO_SIDE_EFFECTS__
|
|
4241
|
-
function ipv6(
|
|
4407
|
+
function ipv6(message$1) {
|
|
4242
4408
|
return {
|
|
4243
4409
|
kind: "validation",
|
|
4244
4410
|
type: "ipv6",
|
|
@@ -4246,17 +4412,15 @@ function ipv6(message2) {
|
|
|
4246
4412
|
async: false,
|
|
4247
4413
|
expects: null,
|
|
4248
4414
|
requirement: IPV6_REGEX,
|
|
4249
|
-
message:
|
|
4250
|
-
"~run"(dataset,
|
|
4251
|
-
if (dataset.typed && !this.requirement.test(dataset.value))
|
|
4252
|
-
_addIssue(this, "IPv6", dataset, config2);
|
|
4253
|
-
}
|
|
4415
|
+
message: message$1,
|
|
4416
|
+
"~run"(dataset, config$1) {
|
|
4417
|
+
if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "IPv6", dataset, config$1);
|
|
4254
4418
|
return dataset;
|
|
4255
4419
|
}
|
|
4256
4420
|
};
|
|
4257
4421
|
}
|
|
4258
4422
|
// @__NO_SIDE_EFFECTS__
|
|
4259
|
-
function isoDate(
|
|
4423
|
+
function isoDate(message$1) {
|
|
4260
4424
|
return {
|
|
4261
4425
|
kind: "validation",
|
|
4262
4426
|
type: "iso_date",
|
|
@@ -4264,17 +4428,15 @@ function isoDate(message2) {
|
|
|
4264
4428
|
async: false,
|
|
4265
4429
|
expects: null,
|
|
4266
4430
|
requirement: ISO_DATE_REGEX,
|
|
4267
|
-
message:
|
|
4268
|
-
"~run"(dataset,
|
|
4269
|
-
if (dataset.typed && !this.requirement.test(dataset.value))
|
|
4270
|
-
_addIssue(this, "date", dataset, config2);
|
|
4271
|
-
}
|
|
4431
|
+
message: message$1,
|
|
4432
|
+
"~run"(dataset, config$1) {
|
|
4433
|
+
if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "date", dataset, config$1);
|
|
4272
4434
|
return dataset;
|
|
4273
4435
|
}
|
|
4274
4436
|
};
|
|
4275
4437
|
}
|
|
4276
4438
|
// @__NO_SIDE_EFFECTS__
|
|
4277
|
-
function isoDateTime(
|
|
4439
|
+
function isoDateTime(message$1) {
|
|
4278
4440
|
return {
|
|
4279
4441
|
kind: "validation",
|
|
4280
4442
|
type: "iso_date_time",
|
|
@@ -4282,17 +4444,15 @@ function isoDateTime(message2) {
|
|
|
4282
4444
|
async: false,
|
|
4283
4445
|
expects: null,
|
|
4284
4446
|
requirement: ISO_DATE_TIME_REGEX,
|
|
4285
|
-
message:
|
|
4286
|
-
"~run"(dataset,
|
|
4287
|
-
if (dataset.typed && !this.requirement.test(dataset.value))
|
|
4288
|
-
_addIssue(this, "date-time", dataset, config2);
|
|
4289
|
-
}
|
|
4447
|
+
message: message$1,
|
|
4448
|
+
"~run"(dataset, config$1) {
|
|
4449
|
+
if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "date-time", dataset, config$1);
|
|
4290
4450
|
return dataset;
|
|
4291
4451
|
}
|
|
4292
4452
|
};
|
|
4293
4453
|
}
|
|
4294
4454
|
// @__NO_SIDE_EFFECTS__
|
|
4295
|
-
function isoTime(
|
|
4455
|
+
function isoTime(message$1) {
|
|
4296
4456
|
return {
|
|
4297
4457
|
kind: "validation",
|
|
4298
4458
|
type: "iso_time",
|
|
@@ -4300,17 +4460,15 @@ function isoTime(message2) {
|
|
|
4300
4460
|
async: false,
|
|
4301
4461
|
expects: null,
|
|
4302
4462
|
requirement: ISO_TIME_REGEX,
|
|
4303
|
-
message:
|
|
4304
|
-
"~run"(dataset,
|
|
4305
|
-
if (dataset.typed && !this.requirement.test(dataset.value))
|
|
4306
|
-
_addIssue(this, "time", dataset, config2);
|
|
4307
|
-
}
|
|
4463
|
+
message: message$1,
|
|
4464
|
+
"~run"(dataset, config$1) {
|
|
4465
|
+
if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "time", dataset, config$1);
|
|
4308
4466
|
return dataset;
|
|
4309
4467
|
}
|
|
4310
4468
|
};
|
|
4311
4469
|
}
|
|
4312
4470
|
// @__NO_SIDE_EFFECTS__
|
|
4313
|
-
function isoTimeSecond(
|
|
4471
|
+
function isoTimeSecond(message$1) {
|
|
4314
4472
|
return {
|
|
4315
4473
|
kind: "validation",
|
|
4316
4474
|
type: "iso_time_second",
|
|
@@ -4318,17 +4476,15 @@ function isoTimeSecond(message2) {
|
|
|
4318
4476
|
async: false,
|
|
4319
4477
|
expects: null,
|
|
4320
4478
|
requirement: ISO_TIME_SECOND_REGEX,
|
|
4321
|
-
message:
|
|
4322
|
-
"~run"(dataset,
|
|
4323
|
-
if (dataset.typed && !this.requirement.test(dataset.value))
|
|
4324
|
-
_addIssue(this, "time-second", dataset, config2);
|
|
4325
|
-
}
|
|
4479
|
+
message: message$1,
|
|
4480
|
+
"~run"(dataset, config$1) {
|
|
4481
|
+
if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "time-second", dataset, config$1);
|
|
4326
4482
|
return dataset;
|
|
4327
4483
|
}
|
|
4328
4484
|
};
|
|
4329
4485
|
}
|
|
4330
4486
|
// @__NO_SIDE_EFFECTS__
|
|
4331
|
-
function isoTimestamp(
|
|
4487
|
+
function isoTimestamp(message$1) {
|
|
4332
4488
|
return {
|
|
4333
4489
|
kind: "validation",
|
|
4334
4490
|
type: "iso_timestamp",
|
|
@@ -4336,17 +4492,15 @@ function isoTimestamp(message2) {
|
|
|
4336
4492
|
async: false,
|
|
4337
4493
|
expects: null,
|
|
4338
4494
|
requirement: ISO_TIMESTAMP_REGEX,
|
|
4339
|
-
message:
|
|
4340
|
-
"~run"(dataset,
|
|
4341
|
-
if (dataset.typed && !this.requirement.test(dataset.value))
|
|
4342
|
-
_addIssue(this, "timestamp", dataset, config2);
|
|
4343
|
-
}
|
|
4495
|
+
message: message$1,
|
|
4496
|
+
"~run"(dataset, config$1) {
|
|
4497
|
+
if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "timestamp", dataset, config$1);
|
|
4344
4498
|
return dataset;
|
|
4345
4499
|
}
|
|
4346
4500
|
};
|
|
4347
4501
|
}
|
|
4348
4502
|
// @__NO_SIDE_EFFECTS__
|
|
4349
|
-
function isoWeek(
|
|
4503
|
+
function isoWeek(message$1) {
|
|
4350
4504
|
return {
|
|
4351
4505
|
kind: "validation",
|
|
4352
4506
|
type: "iso_week",
|
|
@@ -4354,17 +4508,15 @@ function isoWeek(message2) {
|
|
|
4354
4508
|
async: false,
|
|
4355
4509
|
expects: null,
|
|
4356
4510
|
requirement: ISO_WEEK_REGEX,
|
|
4357
|
-
message:
|
|
4358
|
-
"~run"(dataset,
|
|
4359
|
-
if (dataset.typed && !this.requirement.test(dataset.value))
|
|
4360
|
-
_addIssue(this, "week", dataset, config2);
|
|
4361
|
-
}
|
|
4511
|
+
message: message$1,
|
|
4512
|
+
"~run"(dataset, config$1) {
|
|
4513
|
+
if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "week", dataset, config$1);
|
|
4362
4514
|
return dataset;
|
|
4363
4515
|
}
|
|
4364
4516
|
};
|
|
4365
4517
|
}
|
|
4366
4518
|
// @__NO_SIDE_EFFECTS__
|
|
4367
|
-
function mac(
|
|
4519
|
+
function mac(message$1) {
|
|
4368
4520
|
return {
|
|
4369
4521
|
kind: "validation",
|
|
4370
4522
|
type: "mac",
|
|
@@ -4372,17 +4524,15 @@ function mac(message2) {
|
|
|
4372
4524
|
async: false,
|
|
4373
4525
|
expects: null,
|
|
4374
4526
|
requirement: MAC_REGEX,
|
|
4375
|
-
message:
|
|
4376
|
-
"~run"(dataset,
|
|
4377
|
-
if (dataset.typed && !this.requirement.test(dataset.value))
|
|
4378
|
-
_addIssue(this, "MAC", dataset, config2);
|
|
4379
|
-
}
|
|
4527
|
+
message: message$1,
|
|
4528
|
+
"~run"(dataset, config$1) {
|
|
4529
|
+
if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "MAC", dataset, config$1);
|
|
4380
4530
|
return dataset;
|
|
4381
4531
|
}
|
|
4382
4532
|
};
|
|
4383
4533
|
}
|
|
4384
4534
|
// @__NO_SIDE_EFFECTS__
|
|
4385
|
-
function mac48(
|
|
4535
|
+
function mac48(message$1) {
|
|
4386
4536
|
return {
|
|
4387
4537
|
kind: "validation",
|
|
4388
4538
|
type: "mac48",
|
|
@@ -4390,17 +4540,15 @@ function mac48(message2) {
|
|
|
4390
4540
|
async: false,
|
|
4391
4541
|
expects: null,
|
|
4392
4542
|
requirement: MAC48_REGEX,
|
|
4393
|
-
message:
|
|
4394
|
-
"~run"(dataset,
|
|
4395
|
-
if (dataset.typed && !this.requirement.test(dataset.value))
|
|
4396
|
-
_addIssue(this, "48-bit MAC", dataset, config2);
|
|
4397
|
-
}
|
|
4543
|
+
message: message$1,
|
|
4544
|
+
"~run"(dataset, config$1) {
|
|
4545
|
+
if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "48-bit MAC", dataset, config$1);
|
|
4398
4546
|
return dataset;
|
|
4399
4547
|
}
|
|
4400
4548
|
};
|
|
4401
4549
|
}
|
|
4402
4550
|
// @__NO_SIDE_EFFECTS__
|
|
4403
|
-
function mac64(
|
|
4551
|
+
function mac64(message$1) {
|
|
4404
4552
|
return {
|
|
4405
4553
|
kind: "validation",
|
|
4406
4554
|
type: "mac64",
|
|
@@ -4408,17 +4556,15 @@ function mac64(message2) {
|
|
|
4408
4556
|
async: false,
|
|
4409
4557
|
expects: null,
|
|
4410
4558
|
requirement: MAC64_REGEX,
|
|
4411
|
-
message:
|
|
4412
|
-
"~run"(dataset,
|
|
4413
|
-
if (dataset.typed && !this.requirement.test(dataset.value))
|
|
4414
|
-
_addIssue(this, "64-bit MAC", dataset, config2);
|
|
4415
|
-
}
|
|
4559
|
+
message: message$1,
|
|
4560
|
+
"~run"(dataset, config$1) {
|
|
4561
|
+
if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "64-bit MAC", dataset, config$1);
|
|
4416
4562
|
return dataset;
|
|
4417
4563
|
}
|
|
4418
4564
|
};
|
|
4419
4565
|
}
|
|
4420
4566
|
// @__NO_SIDE_EFFECTS__
|
|
4421
|
-
function nanoid(
|
|
4567
|
+
function nanoid(message$1) {
|
|
4422
4568
|
return {
|
|
4423
4569
|
kind: "validation",
|
|
4424
4570
|
type: "nanoid",
|
|
@@ -4426,17 +4572,15 @@ function nanoid(message2) {
|
|
|
4426
4572
|
async: false,
|
|
4427
4573
|
expects: null,
|
|
4428
4574
|
requirement: NANO_ID_REGEX,
|
|
4429
|
-
message:
|
|
4430
|
-
"~run"(dataset,
|
|
4431
|
-
if (dataset.typed && !this.requirement.test(dataset.value))
|
|
4432
|
-
_addIssue(this, "Nano ID", dataset, config2);
|
|
4433
|
-
}
|
|
4575
|
+
message: message$1,
|
|
4576
|
+
"~run"(dataset, config$1) {
|
|
4577
|
+
if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "Nano ID", dataset, config$1);
|
|
4434
4578
|
return dataset;
|
|
4435
4579
|
}
|
|
4436
4580
|
};
|
|
4437
4581
|
}
|
|
4438
4582
|
// @__NO_SIDE_EFFECTS__
|
|
4439
|
-
function octal(
|
|
4583
|
+
function octal(message$1) {
|
|
4440
4584
|
return {
|
|
4441
4585
|
kind: "validation",
|
|
4442
4586
|
type: "octal",
|
|
@@ -4444,17 +4588,15 @@ function octal(message2) {
|
|
|
4444
4588
|
async: false,
|
|
4445
4589
|
expects: null,
|
|
4446
4590
|
requirement: OCTAL_REGEX,
|
|
4447
|
-
message:
|
|
4448
|
-
"~run"(dataset,
|
|
4449
|
-
if (dataset.typed && !this.requirement.test(dataset.value))
|
|
4450
|
-
_addIssue(this, "octal", dataset, config2);
|
|
4451
|
-
}
|
|
4591
|
+
message: message$1,
|
|
4592
|
+
"~run"(dataset, config$1) {
|
|
4593
|
+
if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "octal", dataset, config$1);
|
|
4452
4594
|
return dataset;
|
|
4453
4595
|
}
|
|
4454
4596
|
};
|
|
4455
4597
|
}
|
|
4456
4598
|
// @__NO_SIDE_EFFECTS__
|
|
4457
|
-
function ulid(
|
|
4599
|
+
function ulid(message$1) {
|
|
4458
4600
|
return {
|
|
4459
4601
|
kind: "validation",
|
|
4460
4602
|
type: "ulid",
|
|
@@ -4462,17 +4604,15 @@ function ulid(message2) {
|
|
|
4462
4604
|
async: false,
|
|
4463
4605
|
expects: null,
|
|
4464
4606
|
requirement: ULID_REGEX,
|
|
4465
|
-
message:
|
|
4466
|
-
"~run"(dataset,
|
|
4467
|
-
if (dataset.typed && !this.requirement.test(dataset.value))
|
|
4468
|
-
_addIssue(this, "ULID", dataset, config2);
|
|
4469
|
-
}
|
|
4607
|
+
message: message$1,
|
|
4608
|
+
"~run"(dataset, config$1) {
|
|
4609
|
+
if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "ULID", dataset, config$1);
|
|
4470
4610
|
return dataset;
|
|
4471
4611
|
}
|
|
4472
4612
|
};
|
|
4473
4613
|
}
|
|
4474
4614
|
// @__NO_SIDE_EFFECTS__
|
|
4475
|
-
function url(
|
|
4615
|
+
function url(message$1) {
|
|
4476
4616
|
return {
|
|
4477
4617
|
kind: "validation",
|
|
4478
4618
|
type: "url",
|
|
@@ -4487,17 +4627,15 @@ function url(message2) {
|
|
|
4487
4627
|
return false;
|
|
4488
4628
|
}
|
|
4489
4629
|
},
|
|
4490
|
-
message:
|
|
4491
|
-
"~run"(dataset,
|
|
4492
|
-
if (dataset.typed && !this.requirement(dataset.value))
|
|
4493
|
-
_addIssue(this, "URL", dataset, config2);
|
|
4494
|
-
}
|
|
4630
|
+
message: message$1,
|
|
4631
|
+
"~run"(dataset, config$1) {
|
|
4632
|
+
if (dataset.typed && !this.requirement(dataset.value)) _addIssue(this, "URL", dataset, config$1);
|
|
4495
4633
|
return dataset;
|
|
4496
4634
|
}
|
|
4497
4635
|
};
|
|
4498
4636
|
}
|
|
4499
4637
|
// @__NO_SIDE_EFFECTS__
|
|
4500
|
-
function uuid(
|
|
4638
|
+
function uuid(message$1) {
|
|
4501
4639
|
return {
|
|
4502
4640
|
kind: "validation",
|
|
4503
4641
|
type: "uuid",
|
|
@@ -4505,64 +4643,55 @@ function uuid(message2) {
|
|
|
4505
4643
|
async: false,
|
|
4506
4644
|
expects: null,
|
|
4507
4645
|
requirement: UUID_REGEX,
|
|
4508
|
-
message:
|
|
4509
|
-
"~run"(dataset,
|
|
4510
|
-
if (dataset.typed && !this.requirement.test(dataset.value))
|
|
4511
|
-
_addIssue(this, "UUID", dataset, config2);
|
|
4512
|
-
}
|
|
4646
|
+
message: message$1,
|
|
4647
|
+
"~run"(dataset, config$1) {
|
|
4648
|
+
if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "UUID", dataset, config$1);
|
|
4513
4649
|
return dataset;
|
|
4514
4650
|
}
|
|
4515
4651
|
};
|
|
4516
4652
|
}
|
|
4517
4653
|
// @__NO_SIDE_EFFECTS__
|
|
4518
|
-
function string(
|
|
4654
|
+
function string(message$1) {
|
|
4519
4655
|
return {
|
|
4520
4656
|
kind: "schema",
|
|
4521
4657
|
type: "string",
|
|
4522
4658
|
reference: string,
|
|
4523
4659
|
expects: "string",
|
|
4524
4660
|
async: false,
|
|
4525
|
-
message:
|
|
4661
|
+
message: message$1,
|
|
4526
4662
|
get "~standard"() {
|
|
4527
4663
|
return /* @__PURE__ */ _getStandardProps(this);
|
|
4528
4664
|
},
|
|
4529
|
-
"~run"(dataset,
|
|
4530
|
-
if (typeof dataset.value === "string")
|
|
4531
|
-
|
|
4532
|
-
} else {
|
|
4533
|
-
_addIssue(this, "type", dataset, config2);
|
|
4534
|
-
}
|
|
4665
|
+
"~run"(dataset, config$1) {
|
|
4666
|
+
if (typeof dataset.value === "string") dataset.typed = true;
|
|
4667
|
+
else _addIssue(this, "type", dataset, config$1);
|
|
4535
4668
|
return dataset;
|
|
4536
4669
|
}
|
|
4537
4670
|
};
|
|
4538
4671
|
}
|
|
4539
4672
|
// @__NO_SIDE_EFFECTS__
|
|
4540
|
-
function pipe(...
|
|
4673
|
+
function pipe(...pipe$1) {
|
|
4541
4674
|
return {
|
|
4542
|
-
...
|
|
4543
|
-
pipe:
|
|
4675
|
+
...pipe$1[0],
|
|
4676
|
+
pipe: pipe$1,
|
|
4544
4677
|
get "~standard"() {
|
|
4545
4678
|
return /* @__PURE__ */ _getStandardProps(this);
|
|
4546
4679
|
},
|
|
4547
|
-
"~run"(dataset,
|
|
4548
|
-
for (const item of
|
|
4549
|
-
if (item.kind
|
|
4550
|
-
|
|
4551
|
-
|
|
4552
|
-
break;
|
|
4553
|
-
}
|
|
4554
|
-
if (!dataset.issues || !config2.abortEarly && !config2.abortPipeEarly) {
|
|
4555
|
-
dataset = item["~run"](dataset, config2);
|
|
4556
|
-
}
|
|
4680
|
+
"~run"(dataset, config$1) {
|
|
4681
|
+
for (const item of pipe$1) if (item.kind !== "metadata") {
|
|
4682
|
+
if (dataset.issues && (item.kind === "schema" || item.kind === "transformation")) {
|
|
4683
|
+
dataset.typed = false;
|
|
4684
|
+
break;
|
|
4557
4685
|
}
|
|
4686
|
+
if (!dataset.issues || !config$1.abortEarly && !config$1.abortPipeEarly) dataset = item["~run"](dataset, config$1);
|
|
4558
4687
|
}
|
|
4559
4688
|
return dataset;
|
|
4560
4689
|
}
|
|
4561
4690
|
};
|
|
4562
4691
|
}
|
|
4563
4692
|
// @__NO_SIDE_EFFECTS__
|
|
4564
|
-
function safeParse(schema, input,
|
|
4565
|
-
const dataset = schema["~run"]({ value: input }, /* @__PURE__ */ getGlobalConfig(
|
|
4693
|
+
function safeParse(schema, input, config$1) {
|
|
4694
|
+
const dataset = schema["~run"]({ value: input }, /* @__PURE__ */ getGlobalConfig(config$1));
|
|
4566
4695
|
return {
|
|
4567
4696
|
typed: dataset.typed,
|
|
4568
4697
|
success: !dataset.issues,
|
|
@@ -4867,30 +4996,39 @@ var NEVER = Object.freeze({
|
|
|
4867
4996
|
// @__NO_SIDE_EFFECTS__
|
|
4868
4997
|
function $constructor(name, initializer3, params) {
|
|
4869
4998
|
function init(inst, def) {
|
|
4870
|
-
|
|
4871
|
-
|
|
4872
|
-
|
|
4873
|
-
|
|
4874
|
-
|
|
4875
|
-
|
|
4999
|
+
if (!inst._zod) {
|
|
5000
|
+
Object.defineProperty(inst, "_zod", {
|
|
5001
|
+
value: {
|
|
5002
|
+
def,
|
|
5003
|
+
constr: _,
|
|
5004
|
+
traits: /* @__PURE__ */ new Set()
|
|
5005
|
+
},
|
|
5006
|
+
enumerable: false
|
|
5007
|
+
});
|
|
5008
|
+
}
|
|
5009
|
+
if (inst._zod.traits.has(name)) {
|
|
5010
|
+
return;
|
|
5011
|
+
}
|
|
4876
5012
|
inst._zod.traits.add(name);
|
|
4877
5013
|
initializer3(inst, def);
|
|
4878
|
-
|
|
4879
|
-
|
|
4880
|
-
|
|
5014
|
+
const proto = _.prototype;
|
|
5015
|
+
const keys = Object.keys(proto);
|
|
5016
|
+
for (let i = 0; i < keys.length; i++) {
|
|
5017
|
+
const k = keys[i];
|
|
5018
|
+
if (!(k in inst)) {
|
|
5019
|
+
inst[k] = proto[k].bind(inst);
|
|
5020
|
+
}
|
|
4881
5021
|
}
|
|
4882
|
-
inst._zod.constr = _;
|
|
4883
|
-
inst._zod.def = def;
|
|
4884
5022
|
}
|
|
4885
5023
|
const Parent = params?.Parent ?? Object;
|
|
4886
5024
|
class Definition extends Parent {
|
|
4887
5025
|
}
|
|
4888
5026
|
Object.defineProperty(Definition, "name", { value: name });
|
|
4889
5027
|
function _(def) {
|
|
4890
|
-
var
|
|
5028
|
+
var _a2;
|
|
4891
5029
|
const inst = params?.Parent ? new Definition() : this;
|
|
4892
5030
|
init(inst, def);
|
|
4893
|
-
(
|
|
5031
|
+
(_a2 = inst._zod).deferred ?? (_a2.deferred = []);
|
|
4894
5032
|
for (const fn of inst._zod.deferred) {
|
|
4895
5033
|
fn();
|
|
4896
5034
|
}
|
|
@@ -4907,7 +5045,6 @@ function $constructor(name, initializer3, params) {
|
|
|
4907
5045
|
Object.defineProperty(_, "name", { value: name });
|
|
4908
5046
|
return _;
|
|
4909
5047
|
}
|
|
4910
|
-
var $brand = Symbol("zod_brand");
|
|
4911
5048
|
var $ZodAsyncError = class extends Error {
|
|
4912
5049
|
constructor() {
|
|
4913
5050
|
super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`);
|
|
@@ -4984,6 +5121,7 @@ __export(util_exports, {
|
|
|
4984
5121
|
required: () => required,
|
|
4985
5122
|
safeExtend: () => safeExtend,
|
|
4986
5123
|
shallowClone: () => shallowClone,
|
|
5124
|
+
slugify: () => slugify,
|
|
4987
5125
|
stringifyPrimitive: () => stringifyPrimitive,
|
|
4988
5126
|
uint8ArrayToBase64: () => uint8ArrayToBase64,
|
|
4989
5127
|
uint8ArrayToBase64url: () => uint8ArrayToBase64url,
|
|
@@ -4999,7 +5137,7 @@ function assertNotEqual(val) {
|
|
|
4999
5137
|
function assertIs(_arg) {
|
|
5000
5138
|
}
|
|
5001
5139
|
function assertNever(_x) {
|
|
5002
|
-
throw new Error();
|
|
5140
|
+
throw new Error("Unexpected value in exhaustive check");
|
|
5003
5141
|
}
|
|
5004
5142
|
function assert(_) {
|
|
5005
5143
|
}
|
|
@@ -5052,7 +5190,7 @@ function floatSafeRemainder(val, step) {
|
|
|
5052
5190
|
const stepInt = Number.parseInt(step.toFixed(decCount).replace(".", ""));
|
|
5053
5191
|
return valInt % stepInt / 10 ** decCount;
|
|
5054
5192
|
}
|
|
5055
|
-
var EVALUATING = Symbol("evaluating");
|
|
5193
|
+
var EVALUATING = /* @__PURE__ */ Symbol("evaluating");
|
|
5056
5194
|
function defineLazy(object, key, getter) {
|
|
5057
5195
|
let value = void 0;
|
|
5058
5196
|
Object.defineProperty(object, key, {
|
|
@@ -5124,6 +5262,9 @@ function randomString(length = 10) {
|
|
|
5124
5262
|
function esc(str) {
|
|
5125
5263
|
return JSON.stringify(str);
|
|
5126
5264
|
}
|
|
5265
|
+
function slugify(input) {
|
|
5266
|
+
return input.toLowerCase().trim().replace(/[^\w\s-]/g, "").replace(/[\s_-]+/g, "-").replace(/^-+|-+$/g, "");
|
|
5267
|
+
}
|
|
5127
5268
|
var captureStackTrace = "captureStackTrace" in Error ? Error.captureStackTrace : (..._args) => {
|
|
5128
5269
|
};
|
|
5129
5270
|
function isObject(data) {
|
|
@@ -5147,6 +5288,8 @@ function isPlainObject(o) {
|
|
|
5147
5288
|
const ctor = o.constructor;
|
|
5148
5289
|
if (ctor === void 0)
|
|
5149
5290
|
return true;
|
|
5291
|
+
if (typeof ctor !== "function")
|
|
5292
|
+
return true;
|
|
5150
5293
|
const prot = ctor.prototype;
|
|
5151
5294
|
if (isObject(prot) === false)
|
|
5152
5295
|
return false;
|
|
@@ -5463,8 +5606,8 @@ function aborted(x, startIndex = 0) {
|
|
|
5463
5606
|
}
|
|
5464
5607
|
function prefixIssues(path, issues) {
|
|
5465
5608
|
return issues.map((iss) => {
|
|
5466
|
-
var
|
|
5467
|
-
(
|
|
5609
|
+
var _a2;
|
|
5610
|
+
(_a2 = iss).path ?? (_a2.path = []);
|
|
5468
5611
|
iss.path.unshift(path);
|
|
5469
5612
|
return iss;
|
|
5470
5613
|
});
|
|
@@ -5592,10 +5735,7 @@ function flattenError(error, mapper = (issue2) => issue2.message) {
|
|
|
5592
5735
|
}
|
|
5593
5736
|
return { formErrors, fieldErrors };
|
|
5594
5737
|
}
|
|
5595
|
-
function formatError(error,
|
|
5596
|
-
const mapper = _mapper || function(issue2) {
|
|
5597
|
-
return issue2.message;
|
|
5598
|
-
};
|
|
5738
|
+
function formatError(error, mapper = (issue2) => issue2.message) {
|
|
5599
5739
|
const fieldErrors = { _errors: [] };
|
|
5600
5740
|
const processError = (error2) => {
|
|
5601
5741
|
for (const issue2 of error2.issues) {
|
|
@@ -5732,7 +5872,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]
|
|
|
5732
5872
|
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])$/;
|
|
5733
5873
|
var base642 = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/;
|
|
5734
5874
|
var base64url = /^[A-Za-z0-9_-]*$/;
|
|
5735
|
-
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])?)*\.?$/;
|
|
5736
5875
|
var e164 = /^\+(?:[0-9]){6,14}[0-9]$/;
|
|
5737
5876
|
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])))`;
|
|
5738
5877
|
var date = /* @__PURE__ */ new RegExp(`^${dateSource}$`);
|
|
@@ -5769,10 +5908,10 @@ var uppercase = /^[^a-z]*$/;
|
|
|
5769
5908
|
|
|
5770
5909
|
// node_modules/zod/v4/core/checks.js
|
|
5771
5910
|
var $ZodCheck = /* @__PURE__ */ $constructor("$ZodCheck", (inst, def) => {
|
|
5772
|
-
var
|
|
5911
|
+
var _a2;
|
|
5773
5912
|
inst._zod ?? (inst._zod = {});
|
|
5774
5913
|
inst._zod.def = def;
|
|
5775
|
-
(
|
|
5914
|
+
(_a2 = inst._zod).onattach ?? (_a2.onattach = []);
|
|
5776
5915
|
});
|
|
5777
5916
|
var numericOriginMap = {
|
|
5778
5917
|
number: "number",
|
|
@@ -5838,8 +5977,8 @@ var $ZodCheckGreaterThan = /* @__PURE__ */ $constructor("$ZodCheckGreaterThan",
|
|
|
5838
5977
|
var $ZodCheckMultipleOf = /* @__PURE__ */ $constructor("$ZodCheckMultipleOf", (inst, def) => {
|
|
5839
5978
|
$ZodCheck.init(inst, def);
|
|
5840
5979
|
inst._zod.onattach.push((inst2) => {
|
|
5841
|
-
var
|
|
5842
|
-
(
|
|
5980
|
+
var _a2;
|
|
5981
|
+
(_a2 = inst2._zod.bag).multipleOf ?? (_a2.multipleOf = def.value);
|
|
5843
5982
|
});
|
|
5844
5983
|
inst._zod.check = (payload) => {
|
|
5845
5984
|
if (typeof payload.value !== typeof def.value)
|
|
@@ -5933,9 +6072,9 @@ var $ZodCheckNumberFormat = /* @__PURE__ */ $constructor("$ZodCheckNumberFormat"
|
|
|
5933
6072
|
};
|
|
5934
6073
|
});
|
|
5935
6074
|
var $ZodCheckMaxLength = /* @__PURE__ */ $constructor("$ZodCheckMaxLength", (inst, def) => {
|
|
5936
|
-
var
|
|
6075
|
+
var _a2;
|
|
5937
6076
|
$ZodCheck.init(inst, def);
|
|
5938
|
-
(
|
|
6077
|
+
(_a2 = inst._zod.def).when ?? (_a2.when = (payload) => {
|
|
5939
6078
|
const val = payload.value;
|
|
5940
6079
|
return !nullish(val) && val.length !== void 0;
|
|
5941
6080
|
});
|
|
@@ -5962,9 +6101,9 @@ var $ZodCheckMaxLength = /* @__PURE__ */ $constructor("$ZodCheckMaxLength", (ins
|
|
|
5962
6101
|
};
|
|
5963
6102
|
});
|
|
5964
6103
|
var $ZodCheckMinLength = /* @__PURE__ */ $constructor("$ZodCheckMinLength", (inst, def) => {
|
|
5965
|
-
var
|
|
6104
|
+
var _a2;
|
|
5966
6105
|
$ZodCheck.init(inst, def);
|
|
5967
|
-
(
|
|
6106
|
+
(_a2 = inst._zod.def).when ?? (_a2.when = (payload) => {
|
|
5968
6107
|
const val = payload.value;
|
|
5969
6108
|
return !nullish(val) && val.length !== void 0;
|
|
5970
6109
|
});
|
|
@@ -5991,9 +6130,9 @@ var $ZodCheckMinLength = /* @__PURE__ */ $constructor("$ZodCheckMinLength", (ins
|
|
|
5991
6130
|
};
|
|
5992
6131
|
});
|
|
5993
6132
|
var $ZodCheckLengthEquals = /* @__PURE__ */ $constructor("$ZodCheckLengthEquals", (inst, def) => {
|
|
5994
|
-
var
|
|
6133
|
+
var _a2;
|
|
5995
6134
|
$ZodCheck.init(inst, def);
|
|
5996
|
-
(
|
|
6135
|
+
(_a2 = inst._zod.def).when ?? (_a2.when = (payload) => {
|
|
5997
6136
|
const val = payload.value;
|
|
5998
6137
|
return !nullish(val) && val.length !== void 0;
|
|
5999
6138
|
});
|
|
@@ -6022,7 +6161,7 @@ var $ZodCheckLengthEquals = /* @__PURE__ */ $constructor("$ZodCheckLengthEquals"
|
|
|
6022
6161
|
};
|
|
6023
6162
|
});
|
|
6024
6163
|
var $ZodCheckStringFormat = /* @__PURE__ */ $constructor("$ZodCheckStringFormat", (inst, def) => {
|
|
6025
|
-
var
|
|
6164
|
+
var _a2, _b;
|
|
6026
6165
|
$ZodCheck.init(inst, def);
|
|
6027
6166
|
inst._zod.onattach.push((inst2) => {
|
|
6028
6167
|
const bag = inst2._zod.bag;
|
|
@@ -6033,7 +6172,7 @@ var $ZodCheckStringFormat = /* @__PURE__ */ $constructor("$ZodCheckStringFormat"
|
|
|
6033
6172
|
}
|
|
6034
6173
|
});
|
|
6035
6174
|
if (def.pattern)
|
|
6036
|
-
(
|
|
6175
|
+
(_a2 = inst._zod).check ?? (_a2.check = (payload) => {
|
|
6037
6176
|
def.pattern.lastIndex = 0;
|
|
6038
6177
|
if (def.pattern.test(payload.value))
|
|
6039
6178
|
return;
|
|
@@ -6192,13 +6331,13 @@ var Doc = class {
|
|
|
6192
6331
|
// node_modules/zod/v4/core/versions.js
|
|
6193
6332
|
var version = {
|
|
6194
6333
|
major: 4,
|
|
6195
|
-
minor:
|
|
6196
|
-
patch:
|
|
6334
|
+
minor: 2,
|
|
6335
|
+
patch: 1
|
|
6197
6336
|
};
|
|
6198
6337
|
|
|
6199
6338
|
// node_modules/zod/v4/core/schemas.js
|
|
6200
6339
|
var $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
|
|
6201
|
-
var
|
|
6340
|
+
var _a2;
|
|
6202
6341
|
inst ?? (inst = {});
|
|
6203
6342
|
inst._zod.def = def;
|
|
6204
6343
|
inst._zod.bag = inst._zod.bag || {};
|
|
@@ -6213,7 +6352,7 @@ var $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
|
|
|
6213
6352
|
}
|
|
6214
6353
|
}
|
|
6215
6354
|
if (checks.length === 0) {
|
|
6216
|
-
(
|
|
6355
|
+
(_a2 = inst._zod).deferred ?? (_a2.deferred = []);
|
|
6217
6356
|
inst._zod.deferred?.push(() => {
|
|
6218
6357
|
inst._zod.run = inst._zod.parse;
|
|
6219
6358
|
});
|
|
@@ -6371,7 +6510,7 @@ var $ZodURL = /* @__PURE__ */ $constructor("$ZodURL", (inst, def) => {
|
|
|
6371
6510
|
code: "invalid_format",
|
|
6372
6511
|
format: "url",
|
|
6373
6512
|
note: "Invalid hostname",
|
|
6374
|
-
pattern: hostname.source,
|
|
6513
|
+
pattern: def.hostname.source,
|
|
6375
6514
|
input: payload.value,
|
|
6376
6515
|
inst,
|
|
6377
6516
|
continue: !def.abort
|
|
@@ -6456,18 +6595,12 @@ var $ZodISODuration = /* @__PURE__ */ $constructor("$ZodISODuration", (inst, def
|
|
|
6456
6595
|
var $ZodIPv4 = /* @__PURE__ */ $constructor("$ZodIPv4", (inst, def) => {
|
|
6457
6596
|
def.pattern ?? (def.pattern = ipv42);
|
|
6458
6597
|
$ZodStringFormat.init(inst, def);
|
|
6459
|
-
inst._zod.
|
|
6460
|
-
const bag = inst2._zod.bag;
|
|
6461
|
-
bag.format = `ipv4`;
|
|
6462
|
-
});
|
|
6598
|
+
inst._zod.bag.format = `ipv4`;
|
|
6463
6599
|
});
|
|
6464
6600
|
var $ZodIPv6 = /* @__PURE__ */ $constructor("$ZodIPv6", (inst, def) => {
|
|
6465
6601
|
def.pattern ?? (def.pattern = ipv62);
|
|
6466
6602
|
$ZodStringFormat.init(inst, def);
|
|
6467
|
-
inst._zod.
|
|
6468
|
-
const bag = inst2._zod.bag;
|
|
6469
|
-
bag.format = `ipv6`;
|
|
6470
|
-
});
|
|
6603
|
+
inst._zod.bag.format = `ipv6`;
|
|
6471
6604
|
inst._zod.check = (payload) => {
|
|
6472
6605
|
try {
|
|
6473
6606
|
new URL(`http://[${payload.value}]`);
|
|
@@ -6529,9 +6662,7 @@ function isValidBase64(data) {
|
|
|
6529
6662
|
var $ZodBase64 = /* @__PURE__ */ $constructor("$ZodBase64", (inst, def) => {
|
|
6530
6663
|
def.pattern ?? (def.pattern = base642);
|
|
6531
6664
|
$ZodStringFormat.init(inst, def);
|
|
6532
|
-
inst._zod.
|
|
6533
|
-
inst2._zod.bag.contentEncoding = "base64";
|
|
6534
|
-
});
|
|
6665
|
+
inst._zod.bag.contentEncoding = "base64";
|
|
6535
6666
|
inst._zod.check = (payload) => {
|
|
6536
6667
|
if (isValidBase64(payload.value))
|
|
6537
6668
|
return;
|
|
@@ -6554,9 +6685,7 @@ function isValidBase64URL(data) {
|
|
|
6554
6685
|
var $ZodBase64URL = /* @__PURE__ */ $constructor("$ZodBase64URL", (inst, def) => {
|
|
6555
6686
|
def.pattern ?? (def.pattern = base64url);
|
|
6556
6687
|
$ZodStringFormat.init(inst, def);
|
|
6557
|
-
inst._zod.
|
|
6558
|
-
inst2._zod.bag.contentEncoding = "base64url";
|
|
6559
|
-
});
|
|
6688
|
+
inst._zod.bag.contentEncoding = "base64url";
|
|
6560
6689
|
inst._zod.check = (payload) => {
|
|
6561
6690
|
if (isValidBase64URL(payload.value))
|
|
6562
6691
|
return;
|
|
@@ -6631,7 +6760,7 @@ var $ZodNumber = /* @__PURE__ */ $constructor("$ZodNumber", (inst, def) => {
|
|
|
6631
6760
|
return payload;
|
|
6632
6761
|
};
|
|
6633
6762
|
});
|
|
6634
|
-
var $ZodNumberFormat = /* @__PURE__ */ $constructor("$
|
|
6763
|
+
var $ZodNumberFormat = /* @__PURE__ */ $constructor("$ZodNumberFormat", (inst, def) => {
|
|
6635
6764
|
$ZodCheckNumberFormat.init(inst, def);
|
|
6636
6765
|
$ZodNumber.init(inst, def);
|
|
6637
6766
|
});
|
|
@@ -6858,7 +6987,7 @@ function handleCatchall(proms, input, payload, ctx, def, inst) {
|
|
|
6858
6987
|
const keySet = def.keySet;
|
|
6859
6988
|
const _catchall = def.catchall._zod;
|
|
6860
6989
|
const t2 = _catchall.def.type;
|
|
6861
|
-
for (const key
|
|
6990
|
+
for (const key in input) {
|
|
6862
6991
|
if (keySet.has(key))
|
|
6863
6992
|
continue;
|
|
6864
6993
|
if (t2 === "never") {
|
|
@@ -6888,6 +7017,19 @@ function handleCatchall(proms, input, payload, ctx, def, inst) {
|
|
|
6888
7017
|
}
|
|
6889
7018
|
var $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
|
|
6890
7019
|
$ZodType.init(inst, def);
|
|
7020
|
+
const desc = Object.getOwnPropertyDescriptor(def, "shape");
|
|
7021
|
+
if (!desc?.get) {
|
|
7022
|
+
const sh = def.shape;
|
|
7023
|
+
Object.defineProperty(def, "shape", {
|
|
7024
|
+
get: () => {
|
|
7025
|
+
const newSh = { ...sh };
|
|
7026
|
+
Object.defineProperty(def, "shape", {
|
|
7027
|
+
value: newSh
|
|
7028
|
+
});
|
|
7029
|
+
return newSh;
|
|
7030
|
+
}
|
|
7031
|
+
});
|
|
7032
|
+
}
|
|
6891
7033
|
const _normalized = cached(() => normalizeDef(def));
|
|
6892
7034
|
defineLazy(inst._zod, "propValues", () => {
|
|
6893
7035
|
const shape = def.shape;
|
|
@@ -7078,6 +7220,7 @@ var $ZodUnion = /* @__PURE__ */ $constructor("$ZodUnion", (inst, def) => {
|
|
|
7078
7220
|
};
|
|
7079
7221
|
});
|
|
7080
7222
|
var $ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("$ZodDiscriminatedUnion", (inst, def) => {
|
|
7223
|
+
def.inclusive = false;
|
|
7081
7224
|
$ZodUnion.init(inst, def);
|
|
7082
7225
|
const _super = inst._zod.parse;
|
|
7083
7226
|
defineLazy(inst._zod, "propValues", () => {
|
|
@@ -7220,7 +7363,6 @@ function handleIntersectionResults(result, left, right) {
|
|
|
7220
7363
|
var $ZodTuple = /* @__PURE__ */ $constructor("$ZodTuple", (inst, def) => {
|
|
7221
7364
|
$ZodType.init(inst, def);
|
|
7222
7365
|
const items = def.items;
|
|
7223
|
-
const optStart = items.length - [...items].reverse().findIndex((item) => item._zod.optin !== "optional");
|
|
7224
7366
|
inst._zod.parse = (payload, ctx) => {
|
|
7225
7367
|
const input = payload.value;
|
|
7226
7368
|
if (!Array.isArray(input)) {
|
|
@@ -7234,6 +7376,8 @@ var $ZodTuple = /* @__PURE__ */ $constructor("$ZodTuple", (inst, def) => {
|
|
|
7234
7376
|
}
|
|
7235
7377
|
payload.value = [];
|
|
7236
7378
|
const proms = [];
|
|
7379
|
+
const reversedIndex = [...items].reverse().findIndex((item) => item._zod.optin !== "optional");
|
|
7380
|
+
const optStart = reversedIndex === -1 ? 0 : items.length - reversedIndex;
|
|
7237
7381
|
if (!def.rest) {
|
|
7238
7382
|
const tooBig = input.length > items.length;
|
|
7239
7383
|
const tooSmall = input.length < optStart - 1;
|
|
@@ -7304,11 +7448,13 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
|
|
|
7304
7448
|
return payload;
|
|
7305
7449
|
}
|
|
7306
7450
|
const proms = [];
|
|
7307
|
-
|
|
7308
|
-
|
|
7451
|
+
const values = def.keyType._zod.values;
|
|
7452
|
+
if (values) {
|
|
7309
7453
|
payload.value = {};
|
|
7454
|
+
const recordKeys = /* @__PURE__ */ new Set();
|
|
7310
7455
|
for (const key of values) {
|
|
7311
7456
|
if (typeof key === "string" || typeof key === "number" || typeof key === "symbol") {
|
|
7457
|
+
recordKeys.add(typeof key === "number" ? key.toString() : key);
|
|
7312
7458
|
const result = def.valueType._zod.run({ value: input[key], issues: [] }, ctx);
|
|
7313
7459
|
if (result instanceof Promise) {
|
|
7314
7460
|
proms.push(result.then((result2) => {
|
|
@@ -7327,7 +7473,7 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
|
|
|
7327
7473
|
}
|
|
7328
7474
|
let unrecognized;
|
|
7329
7475
|
for (const key in input) {
|
|
7330
|
-
if (!
|
|
7476
|
+
if (!recordKeys.has(key)) {
|
|
7331
7477
|
unrecognized = unrecognized ?? [];
|
|
7332
7478
|
unrecognized.push(key);
|
|
7333
7479
|
}
|
|
@@ -7350,15 +7496,18 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
|
|
|
7350
7496
|
throw new Error("Async schemas not supported in object keys currently");
|
|
7351
7497
|
}
|
|
7352
7498
|
if (keyResult.issues.length) {
|
|
7353
|
-
|
|
7354
|
-
|
|
7355
|
-
|
|
7356
|
-
|
|
7357
|
-
|
|
7358
|
-
|
|
7359
|
-
|
|
7360
|
-
|
|
7361
|
-
|
|
7499
|
+
if (def.mode === "loose") {
|
|
7500
|
+
payload.value[key] = input[key];
|
|
7501
|
+
} else {
|
|
7502
|
+
payload.issues.push({
|
|
7503
|
+
code: "invalid_key",
|
|
7504
|
+
origin: "record",
|
|
7505
|
+
issues: keyResult.issues.map((iss) => finalizeIssue(iss, ctx, config())),
|
|
7506
|
+
input: key,
|
|
7507
|
+
path: [key],
|
|
7508
|
+
inst
|
|
7509
|
+
});
|
|
7510
|
+
}
|
|
7362
7511
|
continue;
|
|
7363
7512
|
}
|
|
7364
7513
|
const result = def.valueType._zod.run({ value: input[key], issues: [] }, ctx);
|
|
@@ -7408,11 +7557,12 @@ var $ZodLiteral = /* @__PURE__ */ $constructor("$ZodLiteral", (inst, def) => {
|
|
|
7408
7557
|
if (def.values.length === 0) {
|
|
7409
7558
|
throw new Error("Cannot create literal schema with no valid values");
|
|
7410
7559
|
}
|
|
7411
|
-
|
|
7560
|
+
const values = new Set(def.values);
|
|
7561
|
+
inst._zod.values = values;
|
|
7412
7562
|
inst._zod.pattern = new RegExp(`^(${def.values.map((o) => typeof o === "string" ? escapeRegex(o) : o ? escapeRegex(o.toString()) : String(o)).join("|")})$`);
|
|
7413
7563
|
inst._zod.parse = (payload, _ctx) => {
|
|
7414
7564
|
const input = payload.value;
|
|
7415
|
-
if (
|
|
7565
|
+
if (values.has(input)) {
|
|
7416
7566
|
return payload;
|
|
7417
7567
|
}
|
|
7418
7568
|
payload.issues.push({
|
|
@@ -7628,8 +7778,8 @@ var $ZodReadonly = /* @__PURE__ */ $constructor("$ZodReadonly", (inst, def) => {
|
|
|
7628
7778
|
$ZodType.init(inst, def);
|
|
7629
7779
|
defineLazy(inst._zod, "propValues", () => def.innerType._zod.propValues);
|
|
7630
7780
|
defineLazy(inst._zod, "values", () => def.innerType._zod.values);
|
|
7631
|
-
defineLazy(inst._zod, "optin", () => def.innerType
|
|
7632
|
-
defineLazy(inst._zod, "optout", () => def.innerType
|
|
7781
|
+
defineLazy(inst._zod, "optin", () => def.innerType?._zod?.optin);
|
|
7782
|
+
defineLazy(inst._zod, "optout", () => def.innerType?._zod?.optout);
|
|
7633
7783
|
inst._zod.parse = (payload, ctx) => {
|
|
7634
7784
|
if (ctx.direction === "backward") {
|
|
7635
7785
|
return def.innerType._zod.run(payload, ctx);
|
|
@@ -7686,21 +7836,20 @@ function handleRefineResult(result, payload, input, inst) {
|
|
|
7686
7836
|
}
|
|
7687
7837
|
|
|
7688
7838
|
// node_modules/zod/v4/core/registries.js
|
|
7689
|
-
var
|
|
7690
|
-
var $input = Symbol("ZodInput");
|
|
7839
|
+
var _a;
|
|
7691
7840
|
var $ZodRegistry = class {
|
|
7692
7841
|
constructor() {
|
|
7693
7842
|
this._map = /* @__PURE__ */ new WeakMap();
|
|
7694
7843
|
this._idmap = /* @__PURE__ */ new Map();
|
|
7695
7844
|
}
|
|
7696
7845
|
add(schema, ..._meta) {
|
|
7697
|
-
const
|
|
7698
|
-
this._map.set(schema,
|
|
7699
|
-
if (
|
|
7700
|
-
if (this._idmap.has(
|
|
7701
|
-
throw new Error(`ID ${
|
|
7846
|
+
const meta2 = _meta[0];
|
|
7847
|
+
this._map.set(schema, meta2);
|
|
7848
|
+
if (meta2 && typeof meta2 === "object" && "id" in meta2) {
|
|
7849
|
+
if (this._idmap.has(meta2.id)) {
|
|
7850
|
+
throw new Error(`ID ${meta2.id} already exists in the registry`);
|
|
7702
7851
|
}
|
|
7703
|
-
this._idmap.set(
|
|
7852
|
+
this._idmap.set(meta2.id, schema);
|
|
7704
7853
|
}
|
|
7705
7854
|
return this;
|
|
7706
7855
|
}
|
|
@@ -7710,9 +7859,9 @@ var $ZodRegistry = class {
|
|
|
7710
7859
|
return this;
|
|
7711
7860
|
}
|
|
7712
7861
|
remove(schema) {
|
|
7713
|
-
const
|
|
7714
|
-
if (
|
|
7715
|
-
this._idmap.delete(
|
|
7862
|
+
const meta2 = this._map.get(schema);
|
|
7863
|
+
if (meta2 && typeof meta2 === "object" && "id" in meta2) {
|
|
7864
|
+
this._idmap.delete(meta2.id);
|
|
7716
7865
|
}
|
|
7717
7866
|
this._map.delete(schema);
|
|
7718
7867
|
return this;
|
|
@@ -7734,7 +7883,8 @@ var $ZodRegistry = class {
|
|
|
7734
7883
|
function registry() {
|
|
7735
7884
|
return new $ZodRegistry();
|
|
7736
7885
|
}
|
|
7737
|
-
|
|
7886
|
+
(_a = globalThis).__zod_globalRegistry ?? (_a.__zod_globalRegistry = registry());
|
|
7887
|
+
var globalRegistry = globalThis.__zod_globalRegistry;
|
|
7738
7888
|
|
|
7739
7889
|
// node_modules/zod/v4/core/api.js
|
|
7740
7890
|
function _string(Class2, params) {
|
|
@@ -8125,6 +8275,9 @@ function _toLowerCase() {
|
|
|
8125
8275
|
function _toUpperCase() {
|
|
8126
8276
|
return _overwrite((input) => input.toUpperCase());
|
|
8127
8277
|
}
|
|
8278
|
+
function _slugify() {
|
|
8279
|
+
return _overwrite((input) => slugify(input));
|
|
8280
|
+
}
|
|
8128
8281
|
function _array(Class2, element, params) {
|
|
8129
8282
|
return new Class2({
|
|
8130
8283
|
type: "array",
|
|
@@ -8173,6 +8326,701 @@ function _check(fn, params) {
|
|
|
8173
8326
|
return ch;
|
|
8174
8327
|
}
|
|
8175
8328
|
|
|
8329
|
+
// node_modules/zod/v4/core/to-json-schema.js
|
|
8330
|
+
function initializeContext(params) {
|
|
8331
|
+
let target = params?.target ?? "draft-2020-12";
|
|
8332
|
+
if (target === "draft-4")
|
|
8333
|
+
target = "draft-04";
|
|
8334
|
+
if (target === "draft-7")
|
|
8335
|
+
target = "draft-07";
|
|
8336
|
+
return {
|
|
8337
|
+
processors: params.processors ?? {},
|
|
8338
|
+
metadataRegistry: params?.metadata ?? globalRegistry,
|
|
8339
|
+
target,
|
|
8340
|
+
unrepresentable: params?.unrepresentable ?? "throw",
|
|
8341
|
+
override: params?.override ?? (() => {
|
|
8342
|
+
}),
|
|
8343
|
+
io: params?.io ?? "output",
|
|
8344
|
+
counter: 0,
|
|
8345
|
+
seen: /* @__PURE__ */ new Map(),
|
|
8346
|
+
cycles: params?.cycles ?? "ref",
|
|
8347
|
+
reused: params?.reused ?? "inline",
|
|
8348
|
+
external: params?.external ?? void 0
|
|
8349
|
+
};
|
|
8350
|
+
}
|
|
8351
|
+
function process2(schema, ctx, _params = { path: [], schemaPath: [] }) {
|
|
8352
|
+
var _a2;
|
|
8353
|
+
const def = schema._zod.def;
|
|
8354
|
+
const seen = ctx.seen.get(schema);
|
|
8355
|
+
if (seen) {
|
|
8356
|
+
seen.count++;
|
|
8357
|
+
const isCycle = _params.schemaPath.includes(schema);
|
|
8358
|
+
if (isCycle) {
|
|
8359
|
+
seen.cycle = _params.path;
|
|
8360
|
+
}
|
|
8361
|
+
return seen.schema;
|
|
8362
|
+
}
|
|
8363
|
+
const result = { schema: {}, count: 1, cycle: void 0, path: _params.path };
|
|
8364
|
+
ctx.seen.set(schema, result);
|
|
8365
|
+
const overrideSchema = schema._zod.toJSONSchema?.();
|
|
8366
|
+
if (overrideSchema) {
|
|
8367
|
+
result.schema = overrideSchema;
|
|
8368
|
+
} else {
|
|
8369
|
+
const params = {
|
|
8370
|
+
..._params,
|
|
8371
|
+
schemaPath: [..._params.schemaPath, schema],
|
|
8372
|
+
path: _params.path
|
|
8373
|
+
};
|
|
8374
|
+
const parent = schema._zod.parent;
|
|
8375
|
+
if (parent) {
|
|
8376
|
+
result.ref = parent;
|
|
8377
|
+
process2(parent, ctx, params);
|
|
8378
|
+
ctx.seen.get(parent).isParent = true;
|
|
8379
|
+
} else if (schema._zod.processJSONSchema) {
|
|
8380
|
+
schema._zod.processJSONSchema(ctx, result.schema, params);
|
|
8381
|
+
} else {
|
|
8382
|
+
const _json = result.schema;
|
|
8383
|
+
const processor = ctx.processors[def.type];
|
|
8384
|
+
if (!processor) {
|
|
8385
|
+
throw new Error(`[toJSONSchema]: Non-representable type encountered: ${def.type}`);
|
|
8386
|
+
}
|
|
8387
|
+
processor(schema, ctx, _json, params);
|
|
8388
|
+
}
|
|
8389
|
+
}
|
|
8390
|
+
const meta2 = ctx.metadataRegistry.get(schema);
|
|
8391
|
+
if (meta2)
|
|
8392
|
+
Object.assign(result.schema, meta2);
|
|
8393
|
+
if (ctx.io === "input" && isTransforming(schema)) {
|
|
8394
|
+
delete result.schema.examples;
|
|
8395
|
+
delete result.schema.default;
|
|
8396
|
+
}
|
|
8397
|
+
if (ctx.io === "input" && result.schema._prefault)
|
|
8398
|
+
(_a2 = result.schema).default ?? (_a2.default = result.schema._prefault);
|
|
8399
|
+
delete result.schema._prefault;
|
|
8400
|
+
const _result = ctx.seen.get(schema);
|
|
8401
|
+
return _result.schema;
|
|
8402
|
+
}
|
|
8403
|
+
function extractDefs(ctx, schema) {
|
|
8404
|
+
const root = ctx.seen.get(schema);
|
|
8405
|
+
if (!root)
|
|
8406
|
+
throw new Error("Unprocessed schema. This is a bug in Zod.");
|
|
8407
|
+
const makeURI = (entry) => {
|
|
8408
|
+
const defsSegment = ctx.target === "draft-2020-12" ? "$defs" : "definitions";
|
|
8409
|
+
if (ctx.external) {
|
|
8410
|
+
const externalId = ctx.external.registry.get(entry[0])?.id;
|
|
8411
|
+
const uriGenerator = ctx.external.uri ?? ((id2) => id2);
|
|
8412
|
+
if (externalId) {
|
|
8413
|
+
return { ref: uriGenerator(externalId) };
|
|
8414
|
+
}
|
|
8415
|
+
const id = entry[1].defId ?? entry[1].schema.id ?? `schema${ctx.counter++}`;
|
|
8416
|
+
entry[1].defId = id;
|
|
8417
|
+
return { defId: id, ref: `${uriGenerator("__shared")}#/${defsSegment}/${id}` };
|
|
8418
|
+
}
|
|
8419
|
+
if (entry[1] === root) {
|
|
8420
|
+
return { ref: "#" };
|
|
8421
|
+
}
|
|
8422
|
+
const uriPrefix = `#`;
|
|
8423
|
+
const defUriPrefix = `${uriPrefix}/${defsSegment}/`;
|
|
8424
|
+
const defId = entry[1].schema.id ?? `__schema${ctx.counter++}`;
|
|
8425
|
+
return { defId, ref: defUriPrefix + defId };
|
|
8426
|
+
};
|
|
8427
|
+
const extractToDef = (entry) => {
|
|
8428
|
+
if (entry[1].schema.$ref) {
|
|
8429
|
+
return;
|
|
8430
|
+
}
|
|
8431
|
+
const seen = entry[1];
|
|
8432
|
+
const { ref, defId } = makeURI(entry);
|
|
8433
|
+
seen.def = { ...seen.schema };
|
|
8434
|
+
if (defId)
|
|
8435
|
+
seen.defId = defId;
|
|
8436
|
+
const schema2 = seen.schema;
|
|
8437
|
+
for (const key in schema2) {
|
|
8438
|
+
delete schema2[key];
|
|
8439
|
+
}
|
|
8440
|
+
schema2.$ref = ref;
|
|
8441
|
+
};
|
|
8442
|
+
if (ctx.cycles === "throw") {
|
|
8443
|
+
for (const entry of ctx.seen.entries()) {
|
|
8444
|
+
const seen = entry[1];
|
|
8445
|
+
if (seen.cycle) {
|
|
8446
|
+
throw new Error(`Cycle detected: #/${seen.cycle?.join("/")}/<root>
|
|
8447
|
+
|
|
8448
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`);
|
|
8449
|
+
}
|
|
8450
|
+
}
|
|
8451
|
+
}
|
|
8452
|
+
for (const entry of ctx.seen.entries()) {
|
|
8453
|
+
const seen = entry[1];
|
|
8454
|
+
if (schema === entry[0]) {
|
|
8455
|
+
extractToDef(entry);
|
|
8456
|
+
continue;
|
|
8457
|
+
}
|
|
8458
|
+
if (ctx.external) {
|
|
8459
|
+
const ext = ctx.external.registry.get(entry[0])?.id;
|
|
8460
|
+
if (schema !== entry[0] && ext) {
|
|
8461
|
+
extractToDef(entry);
|
|
8462
|
+
continue;
|
|
8463
|
+
}
|
|
8464
|
+
}
|
|
8465
|
+
const id = ctx.metadataRegistry.get(entry[0])?.id;
|
|
8466
|
+
if (id) {
|
|
8467
|
+
extractToDef(entry);
|
|
8468
|
+
continue;
|
|
8469
|
+
}
|
|
8470
|
+
if (seen.cycle) {
|
|
8471
|
+
extractToDef(entry);
|
|
8472
|
+
continue;
|
|
8473
|
+
}
|
|
8474
|
+
if (seen.count > 1) {
|
|
8475
|
+
if (ctx.reused === "ref") {
|
|
8476
|
+
extractToDef(entry);
|
|
8477
|
+
continue;
|
|
8478
|
+
}
|
|
8479
|
+
}
|
|
8480
|
+
}
|
|
8481
|
+
}
|
|
8482
|
+
function finalize(ctx, schema) {
|
|
8483
|
+
const root = ctx.seen.get(schema);
|
|
8484
|
+
if (!root)
|
|
8485
|
+
throw new Error("Unprocessed schema. This is a bug in Zod.");
|
|
8486
|
+
const flattenRef = (zodSchema) => {
|
|
8487
|
+
const seen = ctx.seen.get(zodSchema);
|
|
8488
|
+
const schema2 = seen.def ?? seen.schema;
|
|
8489
|
+
const _cached = { ...schema2 };
|
|
8490
|
+
if (seen.ref === null) {
|
|
8491
|
+
return;
|
|
8492
|
+
}
|
|
8493
|
+
const ref = seen.ref;
|
|
8494
|
+
seen.ref = null;
|
|
8495
|
+
if (ref) {
|
|
8496
|
+
flattenRef(ref);
|
|
8497
|
+
const refSchema = ctx.seen.get(ref).schema;
|
|
8498
|
+
if (refSchema.$ref && (ctx.target === "draft-07" || ctx.target === "draft-04" || ctx.target === "openapi-3.0")) {
|
|
8499
|
+
schema2.allOf = schema2.allOf ?? [];
|
|
8500
|
+
schema2.allOf.push(refSchema);
|
|
8501
|
+
} else {
|
|
8502
|
+
Object.assign(schema2, refSchema);
|
|
8503
|
+
Object.assign(schema2, _cached);
|
|
8504
|
+
}
|
|
8505
|
+
}
|
|
8506
|
+
if (!seen.isParent)
|
|
8507
|
+
ctx.override({
|
|
8508
|
+
zodSchema,
|
|
8509
|
+
jsonSchema: schema2,
|
|
8510
|
+
path: seen.path ?? []
|
|
8511
|
+
});
|
|
8512
|
+
};
|
|
8513
|
+
for (const entry of [...ctx.seen.entries()].reverse()) {
|
|
8514
|
+
flattenRef(entry[0]);
|
|
8515
|
+
}
|
|
8516
|
+
const result = {};
|
|
8517
|
+
if (ctx.target === "draft-2020-12") {
|
|
8518
|
+
result.$schema = "https://json-schema.org/draft/2020-12/schema";
|
|
8519
|
+
} else if (ctx.target === "draft-07") {
|
|
8520
|
+
result.$schema = "http://json-schema.org/draft-07/schema#";
|
|
8521
|
+
} else if (ctx.target === "draft-04") {
|
|
8522
|
+
result.$schema = "http://json-schema.org/draft-04/schema#";
|
|
8523
|
+
} else if (ctx.target === "openapi-3.0") {
|
|
8524
|
+
} else {
|
|
8525
|
+
}
|
|
8526
|
+
if (ctx.external?.uri) {
|
|
8527
|
+
const id = ctx.external.registry.get(schema)?.id;
|
|
8528
|
+
if (!id)
|
|
8529
|
+
throw new Error("Schema is missing an `id` property");
|
|
8530
|
+
result.$id = ctx.external.uri(id);
|
|
8531
|
+
}
|
|
8532
|
+
Object.assign(result, root.def ?? root.schema);
|
|
8533
|
+
const defs = ctx.external?.defs ?? {};
|
|
8534
|
+
for (const entry of ctx.seen.entries()) {
|
|
8535
|
+
const seen = entry[1];
|
|
8536
|
+
if (seen.def && seen.defId) {
|
|
8537
|
+
defs[seen.defId] = seen.def;
|
|
8538
|
+
}
|
|
8539
|
+
}
|
|
8540
|
+
if (ctx.external) {
|
|
8541
|
+
} else {
|
|
8542
|
+
if (Object.keys(defs).length > 0) {
|
|
8543
|
+
if (ctx.target === "draft-2020-12") {
|
|
8544
|
+
result.$defs = defs;
|
|
8545
|
+
} else {
|
|
8546
|
+
result.definitions = defs;
|
|
8547
|
+
}
|
|
8548
|
+
}
|
|
8549
|
+
}
|
|
8550
|
+
try {
|
|
8551
|
+
const finalized = JSON.parse(JSON.stringify(result));
|
|
8552
|
+
Object.defineProperty(finalized, "~standard", {
|
|
8553
|
+
value: {
|
|
8554
|
+
...schema["~standard"],
|
|
8555
|
+
jsonSchema: {
|
|
8556
|
+
input: createStandardJSONSchemaMethod(schema, "input"),
|
|
8557
|
+
output: createStandardJSONSchemaMethod(schema, "output")
|
|
8558
|
+
}
|
|
8559
|
+
},
|
|
8560
|
+
enumerable: false,
|
|
8561
|
+
writable: false
|
|
8562
|
+
});
|
|
8563
|
+
return finalized;
|
|
8564
|
+
} catch (_err) {
|
|
8565
|
+
throw new Error("Error converting schema to JSON.");
|
|
8566
|
+
}
|
|
8567
|
+
}
|
|
8568
|
+
function isTransforming(_schema, _ctx) {
|
|
8569
|
+
const ctx = _ctx ?? { seen: /* @__PURE__ */ new Set() };
|
|
8570
|
+
if (ctx.seen.has(_schema))
|
|
8571
|
+
return false;
|
|
8572
|
+
ctx.seen.add(_schema);
|
|
8573
|
+
const def = _schema._zod.def;
|
|
8574
|
+
if (def.type === "transform")
|
|
8575
|
+
return true;
|
|
8576
|
+
if (def.type === "array")
|
|
8577
|
+
return isTransforming(def.element, ctx);
|
|
8578
|
+
if (def.type === "set")
|
|
8579
|
+
return isTransforming(def.valueType, ctx);
|
|
8580
|
+
if (def.type === "lazy")
|
|
8581
|
+
return isTransforming(def.getter(), ctx);
|
|
8582
|
+
if (def.type === "promise" || def.type === "optional" || def.type === "nonoptional" || def.type === "nullable" || def.type === "readonly" || def.type === "default" || def.type === "prefault") {
|
|
8583
|
+
return isTransforming(def.innerType, ctx);
|
|
8584
|
+
}
|
|
8585
|
+
if (def.type === "intersection") {
|
|
8586
|
+
return isTransforming(def.left, ctx) || isTransforming(def.right, ctx);
|
|
8587
|
+
}
|
|
8588
|
+
if (def.type === "record" || def.type === "map") {
|
|
8589
|
+
return isTransforming(def.keyType, ctx) || isTransforming(def.valueType, ctx);
|
|
8590
|
+
}
|
|
8591
|
+
if (def.type === "pipe") {
|
|
8592
|
+
return isTransforming(def.in, ctx) || isTransforming(def.out, ctx);
|
|
8593
|
+
}
|
|
8594
|
+
if (def.type === "object") {
|
|
8595
|
+
for (const key in def.shape) {
|
|
8596
|
+
if (isTransforming(def.shape[key], ctx))
|
|
8597
|
+
return true;
|
|
8598
|
+
}
|
|
8599
|
+
return false;
|
|
8600
|
+
}
|
|
8601
|
+
if (def.type === "union") {
|
|
8602
|
+
for (const option of def.options) {
|
|
8603
|
+
if (isTransforming(option, ctx))
|
|
8604
|
+
return true;
|
|
8605
|
+
}
|
|
8606
|
+
return false;
|
|
8607
|
+
}
|
|
8608
|
+
if (def.type === "tuple") {
|
|
8609
|
+
for (const item of def.items) {
|
|
8610
|
+
if (isTransforming(item, ctx))
|
|
8611
|
+
return true;
|
|
8612
|
+
}
|
|
8613
|
+
if (def.rest && isTransforming(def.rest, ctx))
|
|
8614
|
+
return true;
|
|
8615
|
+
return false;
|
|
8616
|
+
}
|
|
8617
|
+
return false;
|
|
8618
|
+
}
|
|
8619
|
+
var createToJSONSchemaMethod = (schema, processors = {}) => (params) => {
|
|
8620
|
+
const ctx = initializeContext({ ...params, processors });
|
|
8621
|
+
process2(schema, ctx);
|
|
8622
|
+
extractDefs(ctx, schema);
|
|
8623
|
+
return finalize(ctx, schema);
|
|
8624
|
+
};
|
|
8625
|
+
var createStandardJSONSchemaMethod = (schema, io) => (params) => {
|
|
8626
|
+
const { libraryOptions, target } = params ?? {};
|
|
8627
|
+
const ctx = initializeContext({ ...libraryOptions ?? {}, target, io, processors: {} });
|
|
8628
|
+
process2(schema, ctx);
|
|
8629
|
+
extractDefs(ctx, schema);
|
|
8630
|
+
return finalize(ctx, schema);
|
|
8631
|
+
};
|
|
8632
|
+
|
|
8633
|
+
// node_modules/zod/v4/core/json-schema-processors.js
|
|
8634
|
+
var formatMap = {
|
|
8635
|
+
guid: "uuid",
|
|
8636
|
+
url: "uri",
|
|
8637
|
+
datetime: "date-time",
|
|
8638
|
+
json_string: "json-string",
|
|
8639
|
+
regex: ""
|
|
8640
|
+
// do not set
|
|
8641
|
+
};
|
|
8642
|
+
var stringProcessor = (schema, ctx, _json, _params) => {
|
|
8643
|
+
const json = _json;
|
|
8644
|
+
json.type = "string";
|
|
8645
|
+
const { minimum, maximum, format, patterns, contentEncoding } = schema._zod.bag;
|
|
8646
|
+
if (typeof minimum === "number")
|
|
8647
|
+
json.minLength = minimum;
|
|
8648
|
+
if (typeof maximum === "number")
|
|
8649
|
+
json.maxLength = maximum;
|
|
8650
|
+
if (format) {
|
|
8651
|
+
json.format = formatMap[format] ?? format;
|
|
8652
|
+
if (json.format === "")
|
|
8653
|
+
delete json.format;
|
|
8654
|
+
}
|
|
8655
|
+
if (contentEncoding)
|
|
8656
|
+
json.contentEncoding = contentEncoding;
|
|
8657
|
+
if (patterns && patterns.size > 0) {
|
|
8658
|
+
const regexes = [...patterns];
|
|
8659
|
+
if (regexes.length === 1)
|
|
8660
|
+
json.pattern = regexes[0].source;
|
|
8661
|
+
else if (regexes.length > 1) {
|
|
8662
|
+
json.allOf = [
|
|
8663
|
+
...regexes.map((regex) => ({
|
|
8664
|
+
...ctx.target === "draft-07" || ctx.target === "draft-04" || ctx.target === "openapi-3.0" ? { type: "string" } : {},
|
|
8665
|
+
pattern: regex.source
|
|
8666
|
+
}))
|
|
8667
|
+
];
|
|
8668
|
+
}
|
|
8669
|
+
}
|
|
8670
|
+
};
|
|
8671
|
+
var numberProcessor = (schema, ctx, _json, _params) => {
|
|
8672
|
+
const json = _json;
|
|
8673
|
+
const { minimum, maximum, format, multipleOf, exclusiveMaximum, exclusiveMinimum } = schema._zod.bag;
|
|
8674
|
+
if (typeof format === "string" && format.includes("int"))
|
|
8675
|
+
json.type = "integer";
|
|
8676
|
+
else
|
|
8677
|
+
json.type = "number";
|
|
8678
|
+
if (typeof exclusiveMinimum === "number") {
|
|
8679
|
+
if (ctx.target === "draft-04" || ctx.target === "openapi-3.0") {
|
|
8680
|
+
json.minimum = exclusiveMinimum;
|
|
8681
|
+
json.exclusiveMinimum = true;
|
|
8682
|
+
} else {
|
|
8683
|
+
json.exclusiveMinimum = exclusiveMinimum;
|
|
8684
|
+
}
|
|
8685
|
+
}
|
|
8686
|
+
if (typeof minimum === "number") {
|
|
8687
|
+
json.minimum = minimum;
|
|
8688
|
+
if (typeof exclusiveMinimum === "number" && ctx.target !== "draft-04") {
|
|
8689
|
+
if (exclusiveMinimum >= minimum)
|
|
8690
|
+
delete json.minimum;
|
|
8691
|
+
else
|
|
8692
|
+
delete json.exclusiveMinimum;
|
|
8693
|
+
}
|
|
8694
|
+
}
|
|
8695
|
+
if (typeof exclusiveMaximum === "number") {
|
|
8696
|
+
if (ctx.target === "draft-04" || ctx.target === "openapi-3.0") {
|
|
8697
|
+
json.maximum = exclusiveMaximum;
|
|
8698
|
+
json.exclusiveMaximum = true;
|
|
8699
|
+
} else {
|
|
8700
|
+
json.exclusiveMaximum = exclusiveMaximum;
|
|
8701
|
+
}
|
|
8702
|
+
}
|
|
8703
|
+
if (typeof maximum === "number") {
|
|
8704
|
+
json.maximum = maximum;
|
|
8705
|
+
if (typeof exclusiveMaximum === "number" && ctx.target !== "draft-04") {
|
|
8706
|
+
if (exclusiveMaximum <= maximum)
|
|
8707
|
+
delete json.maximum;
|
|
8708
|
+
else
|
|
8709
|
+
delete json.exclusiveMaximum;
|
|
8710
|
+
}
|
|
8711
|
+
}
|
|
8712
|
+
if (typeof multipleOf === "number")
|
|
8713
|
+
json.multipleOf = multipleOf;
|
|
8714
|
+
};
|
|
8715
|
+
var booleanProcessor = (_schema, _ctx, json, _params) => {
|
|
8716
|
+
json.type = "boolean";
|
|
8717
|
+
};
|
|
8718
|
+
var bigintProcessor = (_schema, ctx, _json, _params) => {
|
|
8719
|
+
if (ctx.unrepresentable === "throw") {
|
|
8720
|
+
throw new Error("BigInt cannot be represented in JSON Schema");
|
|
8721
|
+
}
|
|
8722
|
+
};
|
|
8723
|
+
var symbolProcessor = (_schema, ctx, _json, _params) => {
|
|
8724
|
+
if (ctx.unrepresentable === "throw") {
|
|
8725
|
+
throw new Error("Symbols cannot be represented in JSON Schema");
|
|
8726
|
+
}
|
|
8727
|
+
};
|
|
8728
|
+
var nullProcessor = (_schema, ctx, json, _params) => {
|
|
8729
|
+
if (ctx.target === "openapi-3.0") {
|
|
8730
|
+
json.type = "string";
|
|
8731
|
+
json.nullable = true;
|
|
8732
|
+
json.enum = [null];
|
|
8733
|
+
} else {
|
|
8734
|
+
json.type = "null";
|
|
8735
|
+
}
|
|
8736
|
+
};
|
|
8737
|
+
var undefinedProcessor = (_schema, ctx, _json, _params) => {
|
|
8738
|
+
if (ctx.unrepresentable === "throw") {
|
|
8739
|
+
throw new Error("Undefined cannot be represented in JSON Schema");
|
|
8740
|
+
}
|
|
8741
|
+
};
|
|
8742
|
+
var voidProcessor = (_schema, ctx, _json, _params) => {
|
|
8743
|
+
if (ctx.unrepresentable === "throw") {
|
|
8744
|
+
throw new Error("Void cannot be represented in JSON Schema");
|
|
8745
|
+
}
|
|
8746
|
+
};
|
|
8747
|
+
var neverProcessor = (_schema, _ctx, json, _params) => {
|
|
8748
|
+
json.not = {};
|
|
8749
|
+
};
|
|
8750
|
+
var anyProcessor = (_schema, _ctx, _json, _params) => {
|
|
8751
|
+
};
|
|
8752
|
+
var unknownProcessor = (_schema, _ctx, _json, _params) => {
|
|
8753
|
+
};
|
|
8754
|
+
var dateProcessor = (_schema, ctx, _json, _params) => {
|
|
8755
|
+
if (ctx.unrepresentable === "throw") {
|
|
8756
|
+
throw new Error("Date cannot be represented in JSON Schema");
|
|
8757
|
+
}
|
|
8758
|
+
};
|
|
8759
|
+
var enumProcessor = (schema, _ctx, json, _params) => {
|
|
8760
|
+
const def = schema._zod.def;
|
|
8761
|
+
const values = getEnumValues(def.entries);
|
|
8762
|
+
if (values.every((v) => typeof v === "number"))
|
|
8763
|
+
json.type = "number";
|
|
8764
|
+
if (values.every((v) => typeof v === "string"))
|
|
8765
|
+
json.type = "string";
|
|
8766
|
+
json.enum = values;
|
|
8767
|
+
};
|
|
8768
|
+
var literalProcessor = (schema, ctx, json, _params) => {
|
|
8769
|
+
const def = schema._zod.def;
|
|
8770
|
+
const vals = [];
|
|
8771
|
+
for (const val of def.values) {
|
|
8772
|
+
if (val === void 0) {
|
|
8773
|
+
if (ctx.unrepresentable === "throw") {
|
|
8774
|
+
throw new Error("Literal `undefined` cannot be represented in JSON Schema");
|
|
8775
|
+
} else {
|
|
8776
|
+
}
|
|
8777
|
+
} else if (typeof val === "bigint") {
|
|
8778
|
+
if (ctx.unrepresentable === "throw") {
|
|
8779
|
+
throw new Error("BigInt literals cannot be represented in JSON Schema");
|
|
8780
|
+
} else {
|
|
8781
|
+
vals.push(Number(val));
|
|
8782
|
+
}
|
|
8783
|
+
} else {
|
|
8784
|
+
vals.push(val);
|
|
8785
|
+
}
|
|
8786
|
+
}
|
|
8787
|
+
if (vals.length === 0) {
|
|
8788
|
+
} else if (vals.length === 1) {
|
|
8789
|
+
const val = vals[0];
|
|
8790
|
+
json.type = val === null ? "null" : typeof val;
|
|
8791
|
+
if (ctx.target === "draft-04" || ctx.target === "openapi-3.0") {
|
|
8792
|
+
json.enum = [val];
|
|
8793
|
+
} else {
|
|
8794
|
+
json.const = val;
|
|
8795
|
+
}
|
|
8796
|
+
} else {
|
|
8797
|
+
if (vals.every((v) => typeof v === "number"))
|
|
8798
|
+
json.type = "number";
|
|
8799
|
+
if (vals.every((v) => typeof v === "string"))
|
|
8800
|
+
json.type = "string";
|
|
8801
|
+
if (vals.every((v) => typeof v === "boolean"))
|
|
8802
|
+
json.type = "boolean";
|
|
8803
|
+
if (vals.every((v) => v === null))
|
|
8804
|
+
json.type = "null";
|
|
8805
|
+
json.enum = vals;
|
|
8806
|
+
}
|
|
8807
|
+
};
|
|
8808
|
+
var customProcessor = (_schema, ctx, _json, _params) => {
|
|
8809
|
+
if (ctx.unrepresentable === "throw") {
|
|
8810
|
+
throw new Error("Custom types cannot be represented in JSON Schema");
|
|
8811
|
+
}
|
|
8812
|
+
};
|
|
8813
|
+
var transformProcessor = (_schema, ctx, _json, _params) => {
|
|
8814
|
+
if (ctx.unrepresentable === "throw") {
|
|
8815
|
+
throw new Error("Transforms cannot be represented in JSON Schema");
|
|
8816
|
+
}
|
|
8817
|
+
};
|
|
8818
|
+
var arrayProcessor = (schema, ctx, _json, params) => {
|
|
8819
|
+
const json = _json;
|
|
8820
|
+
const def = schema._zod.def;
|
|
8821
|
+
const { minimum, maximum } = schema._zod.bag;
|
|
8822
|
+
if (typeof minimum === "number")
|
|
8823
|
+
json.minItems = minimum;
|
|
8824
|
+
if (typeof maximum === "number")
|
|
8825
|
+
json.maxItems = maximum;
|
|
8826
|
+
json.type = "array";
|
|
8827
|
+
json.items = process2(def.element, ctx, { ...params, path: [...params.path, "items"] });
|
|
8828
|
+
};
|
|
8829
|
+
var objectProcessor = (schema, ctx, _json, params) => {
|
|
8830
|
+
const json = _json;
|
|
8831
|
+
const def = schema._zod.def;
|
|
8832
|
+
json.type = "object";
|
|
8833
|
+
json.properties = {};
|
|
8834
|
+
const shape = def.shape;
|
|
8835
|
+
for (const key in shape) {
|
|
8836
|
+
json.properties[key] = process2(shape[key], ctx, {
|
|
8837
|
+
...params,
|
|
8838
|
+
path: [...params.path, "properties", key]
|
|
8839
|
+
});
|
|
8840
|
+
}
|
|
8841
|
+
const allKeys = new Set(Object.keys(shape));
|
|
8842
|
+
const requiredKeys = new Set([...allKeys].filter((key) => {
|
|
8843
|
+
const v = def.shape[key]._zod;
|
|
8844
|
+
if (ctx.io === "input") {
|
|
8845
|
+
return v.optin === void 0;
|
|
8846
|
+
} else {
|
|
8847
|
+
return v.optout === void 0;
|
|
8848
|
+
}
|
|
8849
|
+
}));
|
|
8850
|
+
if (requiredKeys.size > 0) {
|
|
8851
|
+
json.required = Array.from(requiredKeys);
|
|
8852
|
+
}
|
|
8853
|
+
if (def.catchall?._zod.def.type === "never") {
|
|
8854
|
+
json.additionalProperties = false;
|
|
8855
|
+
} else if (!def.catchall) {
|
|
8856
|
+
if (ctx.io === "output")
|
|
8857
|
+
json.additionalProperties = false;
|
|
8858
|
+
} else if (def.catchall) {
|
|
8859
|
+
json.additionalProperties = process2(def.catchall, ctx, {
|
|
8860
|
+
...params,
|
|
8861
|
+
path: [...params.path, "additionalProperties"]
|
|
8862
|
+
});
|
|
8863
|
+
}
|
|
8864
|
+
};
|
|
8865
|
+
var unionProcessor = (schema, ctx, json, params) => {
|
|
8866
|
+
const def = schema._zod.def;
|
|
8867
|
+
const isExclusive = def.inclusive === false;
|
|
8868
|
+
const options = def.options.map((x, i) => process2(x, ctx, {
|
|
8869
|
+
...params,
|
|
8870
|
+
path: [...params.path, isExclusive ? "oneOf" : "anyOf", i]
|
|
8871
|
+
}));
|
|
8872
|
+
if (isExclusive) {
|
|
8873
|
+
json.oneOf = options;
|
|
8874
|
+
} else {
|
|
8875
|
+
json.anyOf = options;
|
|
8876
|
+
}
|
|
8877
|
+
};
|
|
8878
|
+
var intersectionProcessor = (schema, ctx, json, params) => {
|
|
8879
|
+
const def = schema._zod.def;
|
|
8880
|
+
const a = process2(def.left, ctx, {
|
|
8881
|
+
...params,
|
|
8882
|
+
path: [...params.path, "allOf", 0]
|
|
8883
|
+
});
|
|
8884
|
+
const b = process2(def.right, ctx, {
|
|
8885
|
+
...params,
|
|
8886
|
+
path: [...params.path, "allOf", 1]
|
|
8887
|
+
});
|
|
8888
|
+
const isSimpleIntersection = (val) => "allOf" in val && Object.keys(val).length === 1;
|
|
8889
|
+
const allOf = [
|
|
8890
|
+
...isSimpleIntersection(a) ? a.allOf : [a],
|
|
8891
|
+
...isSimpleIntersection(b) ? b.allOf : [b]
|
|
8892
|
+
];
|
|
8893
|
+
json.allOf = allOf;
|
|
8894
|
+
};
|
|
8895
|
+
var tupleProcessor = (schema, ctx, _json, params) => {
|
|
8896
|
+
const json = _json;
|
|
8897
|
+
const def = schema._zod.def;
|
|
8898
|
+
json.type = "array";
|
|
8899
|
+
const prefixPath = ctx.target === "draft-2020-12" ? "prefixItems" : "items";
|
|
8900
|
+
const restPath = ctx.target === "draft-2020-12" ? "items" : ctx.target === "openapi-3.0" ? "items" : "additionalItems";
|
|
8901
|
+
const prefixItems = def.items.map((x, i) => process2(x, ctx, {
|
|
8902
|
+
...params,
|
|
8903
|
+
path: [...params.path, prefixPath, i]
|
|
8904
|
+
}));
|
|
8905
|
+
const rest = def.rest ? process2(def.rest, ctx, {
|
|
8906
|
+
...params,
|
|
8907
|
+
path: [...params.path, restPath, ...ctx.target === "openapi-3.0" ? [def.items.length] : []]
|
|
8908
|
+
}) : null;
|
|
8909
|
+
if (ctx.target === "draft-2020-12") {
|
|
8910
|
+
json.prefixItems = prefixItems;
|
|
8911
|
+
if (rest) {
|
|
8912
|
+
json.items = rest;
|
|
8913
|
+
}
|
|
8914
|
+
} else if (ctx.target === "openapi-3.0") {
|
|
8915
|
+
json.items = {
|
|
8916
|
+
anyOf: prefixItems
|
|
8917
|
+
};
|
|
8918
|
+
if (rest) {
|
|
8919
|
+
json.items.anyOf.push(rest);
|
|
8920
|
+
}
|
|
8921
|
+
json.minItems = prefixItems.length;
|
|
8922
|
+
if (!rest) {
|
|
8923
|
+
json.maxItems = prefixItems.length;
|
|
8924
|
+
}
|
|
8925
|
+
} else {
|
|
8926
|
+
json.items = prefixItems;
|
|
8927
|
+
if (rest) {
|
|
8928
|
+
json.additionalItems = rest;
|
|
8929
|
+
}
|
|
8930
|
+
}
|
|
8931
|
+
const { minimum, maximum } = schema._zod.bag;
|
|
8932
|
+
if (typeof minimum === "number")
|
|
8933
|
+
json.minItems = minimum;
|
|
8934
|
+
if (typeof maximum === "number")
|
|
8935
|
+
json.maxItems = maximum;
|
|
8936
|
+
};
|
|
8937
|
+
var recordProcessor = (schema, ctx, _json, params) => {
|
|
8938
|
+
const json = _json;
|
|
8939
|
+
const def = schema._zod.def;
|
|
8940
|
+
json.type = "object";
|
|
8941
|
+
if (ctx.target === "draft-07" || ctx.target === "draft-2020-12") {
|
|
8942
|
+
json.propertyNames = process2(def.keyType, ctx, {
|
|
8943
|
+
...params,
|
|
8944
|
+
path: [...params.path, "propertyNames"]
|
|
8945
|
+
});
|
|
8946
|
+
}
|
|
8947
|
+
json.additionalProperties = process2(def.valueType, ctx, {
|
|
8948
|
+
...params,
|
|
8949
|
+
path: [...params.path, "additionalProperties"]
|
|
8950
|
+
});
|
|
8951
|
+
};
|
|
8952
|
+
var nullableProcessor = (schema, ctx, json, params) => {
|
|
8953
|
+
const def = schema._zod.def;
|
|
8954
|
+
const inner = process2(def.innerType, ctx, params);
|
|
8955
|
+
const seen = ctx.seen.get(schema);
|
|
8956
|
+
if (ctx.target === "openapi-3.0") {
|
|
8957
|
+
seen.ref = def.innerType;
|
|
8958
|
+
json.nullable = true;
|
|
8959
|
+
} else {
|
|
8960
|
+
json.anyOf = [inner, { type: "null" }];
|
|
8961
|
+
}
|
|
8962
|
+
};
|
|
8963
|
+
var nonoptionalProcessor = (schema, ctx, _json, params) => {
|
|
8964
|
+
const def = schema._zod.def;
|
|
8965
|
+
process2(def.innerType, ctx, params);
|
|
8966
|
+
const seen = ctx.seen.get(schema);
|
|
8967
|
+
seen.ref = def.innerType;
|
|
8968
|
+
};
|
|
8969
|
+
var defaultProcessor = (schema, ctx, json, params) => {
|
|
8970
|
+
const def = schema._zod.def;
|
|
8971
|
+
process2(def.innerType, ctx, params);
|
|
8972
|
+
const seen = ctx.seen.get(schema);
|
|
8973
|
+
seen.ref = def.innerType;
|
|
8974
|
+
json.default = JSON.parse(JSON.stringify(def.defaultValue));
|
|
8975
|
+
};
|
|
8976
|
+
var prefaultProcessor = (schema, ctx, json, params) => {
|
|
8977
|
+
const def = schema._zod.def;
|
|
8978
|
+
process2(def.innerType, ctx, params);
|
|
8979
|
+
const seen = ctx.seen.get(schema);
|
|
8980
|
+
seen.ref = def.innerType;
|
|
8981
|
+
if (ctx.io === "input")
|
|
8982
|
+
json._prefault = JSON.parse(JSON.stringify(def.defaultValue));
|
|
8983
|
+
};
|
|
8984
|
+
var catchProcessor = (schema, ctx, json, params) => {
|
|
8985
|
+
const def = schema._zod.def;
|
|
8986
|
+
process2(def.innerType, ctx, params);
|
|
8987
|
+
const seen = ctx.seen.get(schema);
|
|
8988
|
+
seen.ref = def.innerType;
|
|
8989
|
+
let catchValue;
|
|
8990
|
+
try {
|
|
8991
|
+
catchValue = def.catchValue(void 0);
|
|
8992
|
+
} catch {
|
|
8993
|
+
throw new Error("Dynamic catch values are not supported in JSON Schema");
|
|
8994
|
+
}
|
|
8995
|
+
json.default = catchValue;
|
|
8996
|
+
};
|
|
8997
|
+
var pipeProcessor = (schema, ctx, _json, params) => {
|
|
8998
|
+
const def = schema._zod.def;
|
|
8999
|
+
const innerType = ctx.io === "input" ? def.in._zod.def.type === "transform" ? def.out : def.in : def.out;
|
|
9000
|
+
process2(innerType, ctx, params);
|
|
9001
|
+
const seen = ctx.seen.get(schema);
|
|
9002
|
+
seen.ref = innerType;
|
|
9003
|
+
};
|
|
9004
|
+
var readonlyProcessor = (schema, ctx, json, params) => {
|
|
9005
|
+
const def = schema._zod.def;
|
|
9006
|
+
process2(def.innerType, ctx, params);
|
|
9007
|
+
const seen = ctx.seen.get(schema);
|
|
9008
|
+
seen.ref = def.innerType;
|
|
9009
|
+
json.readOnly = true;
|
|
9010
|
+
};
|
|
9011
|
+
var promiseProcessor = (schema, ctx, _json, params) => {
|
|
9012
|
+
const def = schema._zod.def;
|
|
9013
|
+
process2(def.innerType, ctx, params);
|
|
9014
|
+
const seen = ctx.seen.get(schema);
|
|
9015
|
+
seen.ref = def.innerType;
|
|
9016
|
+
};
|
|
9017
|
+
var optionalProcessor = (schema, ctx, _json, params) => {
|
|
9018
|
+
const def = schema._zod.def;
|
|
9019
|
+
process2(def.innerType, ctx, params);
|
|
9020
|
+
const seen = ctx.seen.get(schema);
|
|
9021
|
+
seen.ref = def.innerType;
|
|
9022
|
+
};
|
|
9023
|
+
|
|
8176
9024
|
// node_modules/zod/v4/classic/iso.js
|
|
8177
9025
|
var ZodISODateTime = /* @__PURE__ */ $constructor("ZodISODateTime", (inst, def) => {
|
|
8178
9026
|
$ZodISODateTime.init(inst, def);
|
|
@@ -8260,25 +9108,28 @@ var safeDecodeAsync = /* @__PURE__ */ _safeDecodeAsync(ZodRealError);
|
|
|
8260
9108
|
// node_modules/zod/v4/classic/schemas.js
|
|
8261
9109
|
var ZodType = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
|
|
8262
9110
|
$ZodType.init(inst, def);
|
|
9111
|
+
Object.assign(inst["~standard"], {
|
|
9112
|
+
jsonSchema: {
|
|
9113
|
+
input: createStandardJSONSchemaMethod(inst, "input"),
|
|
9114
|
+
output: createStandardJSONSchemaMethod(inst, "output")
|
|
9115
|
+
}
|
|
9116
|
+
});
|
|
9117
|
+
inst.toJSONSchema = createToJSONSchemaMethod(inst, {});
|
|
8263
9118
|
inst.def = def;
|
|
8264
9119
|
inst.type = def.type;
|
|
8265
9120
|
Object.defineProperty(inst, "_def", { value: def });
|
|
8266
9121
|
inst.check = (...checks) => {
|
|
8267
|
-
return inst.clone(
|
|
8268
|
-
|
|
8269
|
-
...def,
|
|
8270
|
-
checks: [
|
|
8271
|
-
|
|
8272
|
-
|
|
8273
|
-
]
|
|
8274
|
-
}
|
|
8275
|
-
// { parent: true }
|
|
8276
|
-
);
|
|
9122
|
+
return inst.clone(util_exports.mergeDefs(def, {
|
|
9123
|
+
checks: [
|
|
9124
|
+
...def.checks ?? [],
|
|
9125
|
+
...checks.map((ch) => typeof ch === "function" ? { _zod: { check: ch, def: { check: "custom" }, onattach: [] } } : ch)
|
|
9126
|
+
]
|
|
9127
|
+
}));
|
|
8277
9128
|
};
|
|
8278
9129
|
inst.clone = (def2, params) => clone(inst, def2, params);
|
|
8279
9130
|
inst.brand = () => inst;
|
|
8280
|
-
inst.register = ((reg,
|
|
8281
|
-
reg.add(inst,
|
|
9131
|
+
inst.register = ((reg, meta2) => {
|
|
9132
|
+
reg.add(inst, meta2);
|
|
8282
9133
|
return inst;
|
|
8283
9134
|
});
|
|
8284
9135
|
inst.parse = (data, params) => parse2(inst, data, params, { callee: inst.parse });
|
|
@@ -8336,6 +9187,7 @@ var ZodType = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
|
|
|
8336
9187
|
var _ZodString = /* @__PURE__ */ $constructor("_ZodString", (inst, def) => {
|
|
8337
9188
|
$ZodString.init(inst, def);
|
|
8338
9189
|
ZodType.init(inst, def);
|
|
9190
|
+
inst._zod.processJSONSchema = (ctx, json, params) => stringProcessor(inst, ctx, json, params);
|
|
8339
9191
|
const bag = inst._zod.bag;
|
|
8340
9192
|
inst.format = bag.format ?? null;
|
|
8341
9193
|
inst.minLength = bag.minimum ?? null;
|
|
@@ -8354,6 +9206,7 @@ var _ZodString = /* @__PURE__ */ $constructor("_ZodString", (inst, def) => {
|
|
|
8354
9206
|
inst.normalize = (...args) => inst.check(_normalize(...args));
|
|
8355
9207
|
inst.toLowerCase = () => inst.check(_toLowerCase());
|
|
8356
9208
|
inst.toUpperCase = () => inst.check(_toUpperCase());
|
|
9209
|
+
inst.slugify = () => inst.check(_slugify());
|
|
8357
9210
|
});
|
|
8358
9211
|
var ZodString = /* @__PURE__ */ $constructor("ZodString", (inst, def) => {
|
|
8359
9212
|
$ZodString.init(inst, def);
|
|
@@ -8472,6 +9325,7 @@ var ZodJWT = /* @__PURE__ */ $constructor("ZodJWT", (inst, def) => {
|
|
|
8472
9325
|
var ZodNumber = /* @__PURE__ */ $constructor("ZodNumber", (inst, def) => {
|
|
8473
9326
|
$ZodNumber.init(inst, def);
|
|
8474
9327
|
ZodType.init(inst, def);
|
|
9328
|
+
inst._zod.processJSONSchema = (ctx, json, params) => numberProcessor(inst, ctx, json, params);
|
|
8475
9329
|
inst.gt = (value, params) => inst.check(_gt(value, params));
|
|
8476
9330
|
inst.gte = (value, params) => inst.check(_gte(value, params));
|
|
8477
9331
|
inst.min = (value, params) => inst.check(_gte(value, params));
|
|
@@ -8504,10 +9358,12 @@ function int(params) {
|
|
|
8504
9358
|
var ZodBoolean = /* @__PURE__ */ $constructor("ZodBoolean", (inst, def) => {
|
|
8505
9359
|
$ZodBoolean.init(inst, def);
|
|
8506
9360
|
ZodType.init(inst, def);
|
|
9361
|
+
inst._zod.processJSONSchema = (ctx, json, params) => booleanProcessor(inst, ctx, json, params);
|
|
8507
9362
|
});
|
|
8508
9363
|
var ZodBigInt = /* @__PURE__ */ $constructor("ZodBigInt", (inst, def) => {
|
|
8509
9364
|
$ZodBigInt.init(inst, def);
|
|
8510
9365
|
ZodType.init(inst, def);
|
|
9366
|
+
inst._zod.processJSONSchema = (ctx, json, params) => bigintProcessor(inst, ctx, json, params);
|
|
8511
9367
|
inst.gte = (value, params) => inst.check(_gte(value, params));
|
|
8512
9368
|
inst.min = (value, params) => inst.check(_gte(value, params));
|
|
8513
9369
|
inst.gt = (value, params) => inst.check(_gt(value, params));
|
|
@@ -8529,22 +9385,27 @@ var ZodBigInt = /* @__PURE__ */ $constructor("ZodBigInt", (inst, def) => {
|
|
|
8529
9385
|
var ZodSymbol = /* @__PURE__ */ $constructor("ZodSymbol", (inst, def) => {
|
|
8530
9386
|
$ZodSymbol.init(inst, def);
|
|
8531
9387
|
ZodType.init(inst, def);
|
|
9388
|
+
inst._zod.processJSONSchema = (ctx, json, params) => symbolProcessor(inst, ctx, json, params);
|
|
8532
9389
|
});
|
|
8533
9390
|
var ZodUndefined = /* @__PURE__ */ $constructor("ZodUndefined", (inst, def) => {
|
|
8534
9391
|
$ZodUndefined.init(inst, def);
|
|
8535
9392
|
ZodType.init(inst, def);
|
|
9393
|
+
inst._zod.processJSONSchema = (ctx, json, params) => undefinedProcessor(inst, ctx, json, params);
|
|
8536
9394
|
});
|
|
8537
9395
|
var ZodNull = /* @__PURE__ */ $constructor("ZodNull", (inst, def) => {
|
|
8538
9396
|
$ZodNull.init(inst, def);
|
|
8539
9397
|
ZodType.init(inst, def);
|
|
9398
|
+
inst._zod.processJSONSchema = (ctx, json, params) => nullProcessor(inst, ctx, json, params);
|
|
8540
9399
|
});
|
|
8541
9400
|
var ZodAny = /* @__PURE__ */ $constructor("ZodAny", (inst, def) => {
|
|
8542
9401
|
$ZodAny.init(inst, def);
|
|
8543
9402
|
ZodType.init(inst, def);
|
|
9403
|
+
inst._zod.processJSONSchema = (ctx, json, params) => anyProcessor(inst, ctx, json, params);
|
|
8544
9404
|
});
|
|
8545
9405
|
var ZodUnknown = /* @__PURE__ */ $constructor("ZodUnknown", (inst, def) => {
|
|
8546
9406
|
$ZodUnknown.init(inst, def);
|
|
8547
9407
|
ZodType.init(inst, def);
|
|
9408
|
+
inst._zod.processJSONSchema = (ctx, json, params) => unknownProcessor(inst, ctx, json, params);
|
|
8548
9409
|
});
|
|
8549
9410
|
function unknown() {
|
|
8550
9411
|
return _unknown(ZodUnknown);
|
|
@@ -8552,6 +9413,7 @@ function unknown() {
|
|
|
8552
9413
|
var ZodNever = /* @__PURE__ */ $constructor("ZodNever", (inst, def) => {
|
|
8553
9414
|
$ZodNever.init(inst, def);
|
|
8554
9415
|
ZodType.init(inst, def);
|
|
9416
|
+
inst._zod.processJSONSchema = (ctx, json, params) => neverProcessor(inst, ctx, json, params);
|
|
8555
9417
|
});
|
|
8556
9418
|
function never(params) {
|
|
8557
9419
|
return _never(ZodNever, params);
|
|
@@ -8559,10 +9421,12 @@ function never(params) {
|
|
|
8559
9421
|
var ZodVoid = /* @__PURE__ */ $constructor("ZodVoid", (inst, def) => {
|
|
8560
9422
|
$ZodVoid.init(inst, def);
|
|
8561
9423
|
ZodType.init(inst, def);
|
|
9424
|
+
inst._zod.processJSONSchema = (ctx, json, params) => voidProcessor(inst, ctx, json, params);
|
|
8562
9425
|
});
|
|
8563
9426
|
var ZodDate = /* @__PURE__ */ $constructor("ZodDate", (inst, def) => {
|
|
8564
9427
|
$ZodDate.init(inst, def);
|
|
8565
9428
|
ZodType.init(inst, def);
|
|
9429
|
+
inst._zod.processJSONSchema = (ctx, json, params) => dateProcessor(inst, ctx, json, params);
|
|
8566
9430
|
inst.min = (value, params) => inst.check(_gte(value, params));
|
|
8567
9431
|
inst.max = (value, params) => inst.check(_lte(value, params));
|
|
8568
9432
|
const c = inst._zod.bag;
|
|
@@ -8572,6 +9436,7 @@ var ZodDate = /* @__PURE__ */ $constructor("ZodDate", (inst, def) => {
|
|
|
8572
9436
|
var ZodArray = /* @__PURE__ */ $constructor("ZodArray", (inst, def) => {
|
|
8573
9437
|
$ZodArray.init(inst, def);
|
|
8574
9438
|
ZodType.init(inst, def);
|
|
9439
|
+
inst._zod.processJSONSchema = (ctx, json, params) => arrayProcessor(inst, ctx, json, params);
|
|
8575
9440
|
inst.element = def.element;
|
|
8576
9441
|
inst.min = (minLength, params) => inst.check(_minLength(minLength, params));
|
|
8577
9442
|
inst.nonempty = (params) => inst.check(_minLength(1, params));
|
|
@@ -8585,7 +9450,10 @@ function array(element, params) {
|
|
|
8585
9450
|
var ZodObject = /* @__PURE__ */ $constructor("ZodObject", (inst, def) => {
|
|
8586
9451
|
$ZodObjectJIT.init(inst, def);
|
|
8587
9452
|
ZodType.init(inst, def);
|
|
8588
|
-
|
|
9453
|
+
inst._zod.processJSONSchema = (ctx, json, params) => objectProcessor(inst, ctx, json, params);
|
|
9454
|
+
util_exports.defineLazy(inst, "shape", () => {
|
|
9455
|
+
return def.shape;
|
|
9456
|
+
});
|
|
8589
9457
|
inst.keyof = () => _enum(Object.keys(inst._zod.def.shape));
|
|
8590
9458
|
inst.catchall = (catchall) => inst.clone({ ...inst._zod.def, catchall });
|
|
8591
9459
|
inst.passthrough = () => inst.clone({ ...inst._zod.def, catchall: unknown() });
|
|
@@ -8607,6 +9475,7 @@ var ZodObject = /* @__PURE__ */ $constructor("ZodObject", (inst, def) => {
|
|
|
8607
9475
|
var ZodUnion = /* @__PURE__ */ $constructor("ZodUnion", (inst, def) => {
|
|
8608
9476
|
$ZodUnion.init(inst, def);
|
|
8609
9477
|
ZodType.init(inst, def);
|
|
9478
|
+
inst._zod.processJSONSchema = (ctx, json, params) => unionProcessor(inst, ctx, json, params);
|
|
8610
9479
|
inst.options = def.options;
|
|
8611
9480
|
});
|
|
8612
9481
|
function union(options, params) {
|
|
@@ -8623,6 +9492,7 @@ var ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("ZodDiscriminatedUnion"
|
|
|
8623
9492
|
var ZodIntersection = /* @__PURE__ */ $constructor("ZodIntersection", (inst, def) => {
|
|
8624
9493
|
$ZodIntersection.init(inst, def);
|
|
8625
9494
|
ZodType.init(inst, def);
|
|
9495
|
+
inst._zod.processJSONSchema = (ctx, json, params) => intersectionProcessor(inst, ctx, json, params);
|
|
8626
9496
|
});
|
|
8627
9497
|
function intersection(left, right) {
|
|
8628
9498
|
return new ZodIntersection({
|
|
@@ -8634,6 +9504,7 @@ function intersection(left, right) {
|
|
|
8634
9504
|
var ZodTuple = /* @__PURE__ */ $constructor("ZodTuple", (inst, def) => {
|
|
8635
9505
|
$ZodTuple.init(inst, def);
|
|
8636
9506
|
ZodType.init(inst, def);
|
|
9507
|
+
inst._zod.processJSONSchema = (ctx, json, params) => tupleProcessor(inst, ctx, json, params);
|
|
8637
9508
|
inst.rest = (rest) => inst.clone({
|
|
8638
9509
|
...inst._zod.def,
|
|
8639
9510
|
rest
|
|
@@ -8642,12 +9513,14 @@ var ZodTuple = /* @__PURE__ */ $constructor("ZodTuple", (inst, def) => {
|
|
|
8642
9513
|
var ZodRecord = /* @__PURE__ */ $constructor("ZodRecord", (inst, def) => {
|
|
8643
9514
|
$ZodRecord.init(inst, def);
|
|
8644
9515
|
ZodType.init(inst, def);
|
|
9516
|
+
inst._zod.processJSONSchema = (ctx, json, params) => recordProcessor(inst, ctx, json, params);
|
|
8645
9517
|
inst.keyType = def.keyType;
|
|
8646
9518
|
inst.valueType = def.valueType;
|
|
8647
9519
|
});
|
|
8648
9520
|
var ZodEnum = /* @__PURE__ */ $constructor("ZodEnum", (inst, def) => {
|
|
8649
9521
|
$ZodEnum.init(inst, def);
|
|
8650
9522
|
ZodType.init(inst, def);
|
|
9523
|
+
inst._zod.processJSONSchema = (ctx, json, params) => enumProcessor(inst, ctx, json, params);
|
|
8651
9524
|
inst.enum = def.entries;
|
|
8652
9525
|
inst.options = Object.values(def.entries);
|
|
8653
9526
|
const keys = new Set(Object.keys(def.entries));
|
|
@@ -8693,6 +9566,7 @@ function _enum(values, params) {
|
|
|
8693
9566
|
var ZodLiteral = /* @__PURE__ */ $constructor("ZodLiteral", (inst, def) => {
|
|
8694
9567
|
$ZodLiteral.init(inst, def);
|
|
8695
9568
|
ZodType.init(inst, def);
|
|
9569
|
+
inst._zod.processJSONSchema = (ctx, json, params) => literalProcessor(inst, ctx, json, params);
|
|
8696
9570
|
inst.values = new Set(def.values);
|
|
8697
9571
|
Object.defineProperty(inst, "value", {
|
|
8698
9572
|
get() {
|
|
@@ -8706,6 +9580,7 @@ var ZodLiteral = /* @__PURE__ */ $constructor("ZodLiteral", (inst, def) => {
|
|
|
8706
9580
|
var ZodTransform = /* @__PURE__ */ $constructor("ZodTransform", (inst, def) => {
|
|
8707
9581
|
$ZodTransform.init(inst, def);
|
|
8708
9582
|
ZodType.init(inst, def);
|
|
9583
|
+
inst._zod.processJSONSchema = (ctx, json, params) => transformProcessor(inst, ctx, json, params);
|
|
8709
9584
|
inst._zod.parse = (payload, _ctx) => {
|
|
8710
9585
|
if (_ctx.direction === "backward") {
|
|
8711
9586
|
throw new $ZodEncodeError(inst.constructor.name);
|
|
@@ -8743,6 +9618,7 @@ function transform(fn) {
|
|
|
8743
9618
|
var ZodOptional = /* @__PURE__ */ $constructor("ZodOptional", (inst, def) => {
|
|
8744
9619
|
$ZodOptional.init(inst, def);
|
|
8745
9620
|
ZodType.init(inst, def);
|
|
9621
|
+
inst._zod.processJSONSchema = (ctx, json, params) => optionalProcessor(inst, ctx, json, params);
|
|
8746
9622
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
8747
9623
|
});
|
|
8748
9624
|
function optional(innerType) {
|
|
@@ -8754,6 +9630,7 @@ function optional(innerType) {
|
|
|
8754
9630
|
var ZodNullable = /* @__PURE__ */ $constructor("ZodNullable", (inst, def) => {
|
|
8755
9631
|
$ZodNullable.init(inst, def);
|
|
8756
9632
|
ZodType.init(inst, def);
|
|
9633
|
+
inst._zod.processJSONSchema = (ctx, json, params) => nullableProcessor(inst, ctx, json, params);
|
|
8757
9634
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
8758
9635
|
});
|
|
8759
9636
|
function nullable(innerType) {
|
|
@@ -8765,6 +9642,7 @@ function nullable(innerType) {
|
|
|
8765
9642
|
var ZodDefault = /* @__PURE__ */ $constructor("ZodDefault", (inst, def) => {
|
|
8766
9643
|
$ZodDefault.init(inst, def);
|
|
8767
9644
|
ZodType.init(inst, def);
|
|
9645
|
+
inst._zod.processJSONSchema = (ctx, json, params) => defaultProcessor(inst, ctx, json, params);
|
|
8768
9646
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
8769
9647
|
inst.removeDefault = inst.unwrap;
|
|
8770
9648
|
});
|
|
@@ -8780,6 +9658,7 @@ function _default(innerType, defaultValue) {
|
|
|
8780
9658
|
var ZodPrefault = /* @__PURE__ */ $constructor("ZodPrefault", (inst, def) => {
|
|
8781
9659
|
$ZodPrefault.init(inst, def);
|
|
8782
9660
|
ZodType.init(inst, def);
|
|
9661
|
+
inst._zod.processJSONSchema = (ctx, json, params) => prefaultProcessor(inst, ctx, json, params);
|
|
8783
9662
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
8784
9663
|
});
|
|
8785
9664
|
function prefault(innerType, defaultValue) {
|
|
@@ -8794,6 +9673,7 @@ function prefault(innerType, defaultValue) {
|
|
|
8794
9673
|
var ZodNonOptional = /* @__PURE__ */ $constructor("ZodNonOptional", (inst, def) => {
|
|
8795
9674
|
$ZodNonOptional.init(inst, def);
|
|
8796
9675
|
ZodType.init(inst, def);
|
|
9676
|
+
inst._zod.processJSONSchema = (ctx, json, params) => nonoptionalProcessor(inst, ctx, json, params);
|
|
8797
9677
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
8798
9678
|
});
|
|
8799
9679
|
function nonoptional(innerType, params) {
|
|
@@ -8806,6 +9686,7 @@ function nonoptional(innerType, params) {
|
|
|
8806
9686
|
var ZodCatch = /* @__PURE__ */ $constructor("ZodCatch", (inst, def) => {
|
|
8807
9687
|
$ZodCatch.init(inst, def);
|
|
8808
9688
|
ZodType.init(inst, def);
|
|
9689
|
+
inst._zod.processJSONSchema = (ctx, json, params) => catchProcessor(inst, ctx, json, params);
|
|
8809
9690
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
8810
9691
|
inst.removeCatch = inst.unwrap;
|
|
8811
9692
|
});
|
|
@@ -8819,6 +9700,7 @@ function _catch(innerType, catchValue) {
|
|
|
8819
9700
|
var ZodPipe = /* @__PURE__ */ $constructor("ZodPipe", (inst, def) => {
|
|
8820
9701
|
$ZodPipe.init(inst, def);
|
|
8821
9702
|
ZodType.init(inst, def);
|
|
9703
|
+
inst._zod.processJSONSchema = (ctx, json, params) => pipeProcessor(inst, ctx, json, params);
|
|
8822
9704
|
inst.in = def.in;
|
|
8823
9705
|
inst.out = def.out;
|
|
8824
9706
|
});
|
|
@@ -8833,6 +9715,7 @@ function pipe2(in_, out) {
|
|
|
8833
9715
|
var ZodReadonly = /* @__PURE__ */ $constructor("ZodReadonly", (inst, def) => {
|
|
8834
9716
|
$ZodReadonly.init(inst, def);
|
|
8835
9717
|
ZodType.init(inst, def);
|
|
9718
|
+
inst._zod.processJSONSchema = (ctx, json, params) => readonlyProcessor(inst, ctx, json, params);
|
|
8836
9719
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
8837
9720
|
});
|
|
8838
9721
|
function readonly(innerType) {
|
|
@@ -8844,11 +9727,13 @@ function readonly(innerType) {
|
|
|
8844
9727
|
var ZodPromise = /* @__PURE__ */ $constructor("ZodPromise", (inst, def) => {
|
|
8845
9728
|
$ZodPromise.init(inst, def);
|
|
8846
9729
|
ZodType.init(inst, def);
|
|
9730
|
+
inst._zod.processJSONSchema = (ctx, json, params) => promiseProcessor(inst, ctx, json, params);
|
|
8847
9731
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
8848
9732
|
});
|
|
8849
9733
|
var ZodCustom = /* @__PURE__ */ $constructor("ZodCustom", (inst, def) => {
|
|
8850
9734
|
$ZodCustom.init(inst, def);
|
|
8851
9735
|
ZodType.init(inst, def);
|
|
9736
|
+
inst._zod.processJSONSchema = (ctx, json, params) => customProcessor(inst, ctx, json, params);
|
|
8852
9737
|
});
|
|
8853
9738
|
function refine(fn, _params = {}) {
|
|
8854
9739
|
return _refine(ZodCustom, fn, _params);
|
|
@@ -9322,7 +10207,8 @@ var openapi = ({
|
|
|
9322
10207
|
}
|
|
9323
10208
|
};
|
|
9324
10209
|
};
|
|
9325
|
-
const app = new import_elysia2.Elysia({ name: "@elysiajs/openapi" })
|
|
10210
|
+
const app = new import_elysia2.Elysia({ name: "@elysiajs/openapi" });
|
|
10211
|
+
app.use((app2) => {
|
|
9326
10212
|
if (provider === null) return app2;
|
|
9327
10213
|
const page = () => new Response(
|
|
9328
10214
|
provider === "swagger-ui" ? SwaggerUIRender(info, {
|