@elysiajs/openapi 1.4.11 → 1.4.13
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 +1255 -351
- package/dist/cjs/openapi.d.ts +6 -1
- package/dist/cjs/openapi.js +233 -11
- package/dist/gen/index.mjs +1021 -344
- package/dist/index.mjs +1255 -351
- package/dist/openapi.d.ts +6 -1
- package/dist/openapi.mjs +233 -11
- package/package.json +3 -4
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) {
|
|
@@ -2696,7 +2696,9 @@ function Void(options) {
|
|
|
2696
2696
|
|
|
2697
2697
|
// src/openapi.ts
|
|
2698
2698
|
var capitalize = (word) => word.charAt(0).toUpperCase() + word.slice(1);
|
|
2699
|
-
var toRef = (name) => import_elysia.t.Ref(
|
|
2699
|
+
var toRef = (name) => import_elysia.t.Ref(
|
|
2700
|
+
name.startsWith("#/") ? name : `#/components/schemas/${name}`
|
|
2701
|
+
);
|
|
2700
2702
|
var toOperationId = (method, paths) => {
|
|
2701
2703
|
let operationId = method.toLowerCase();
|
|
2702
2704
|
if (!paths || paths === "/") return operationId + "Index";
|
|
@@ -2757,6 +2759,219 @@ openapi({
|
|
|
2757
2759
|
})`
|
|
2758
2760
|
};
|
|
2759
2761
|
var warned = {};
|
|
2762
|
+
var mergeObjectSchemas = (schemas) => {
|
|
2763
|
+
if (schemas.length === 0)
|
|
2764
|
+
return {
|
|
2765
|
+
schema: void 0,
|
|
2766
|
+
notObjects: []
|
|
2767
|
+
};
|
|
2768
|
+
if (schemas.length === 1)
|
|
2769
|
+
return schemas[0].type === "object" ? {
|
|
2770
|
+
schema: schemas[0],
|
|
2771
|
+
notObjects: []
|
|
2772
|
+
} : {
|
|
2773
|
+
schema: void 0,
|
|
2774
|
+
notObjects: schemas
|
|
2775
|
+
};
|
|
2776
|
+
let newSchema;
|
|
2777
|
+
const notObjects = [];
|
|
2778
|
+
let additionalPropertiesIsTrue = false;
|
|
2779
|
+
let additionalPropertiesIsFalse = false;
|
|
2780
|
+
for (const schema of schemas) {
|
|
2781
|
+
if (!schema) continue;
|
|
2782
|
+
if (schema.type !== "object") {
|
|
2783
|
+
notObjects.push(schema);
|
|
2784
|
+
continue;
|
|
2785
|
+
}
|
|
2786
|
+
if ("additionalProperties" in schema) {
|
|
2787
|
+
if (schema.additionalProperties === true)
|
|
2788
|
+
additionalPropertiesIsTrue = true;
|
|
2789
|
+
else if (schema.additionalProperties === false)
|
|
2790
|
+
additionalPropertiesIsFalse = true;
|
|
2791
|
+
}
|
|
2792
|
+
if (!newSchema) {
|
|
2793
|
+
newSchema = schema;
|
|
2794
|
+
continue;
|
|
2795
|
+
}
|
|
2796
|
+
newSchema = {
|
|
2797
|
+
...newSchema,
|
|
2798
|
+
...schema,
|
|
2799
|
+
properties: {
|
|
2800
|
+
...newSchema.properties,
|
|
2801
|
+
...schema.properties
|
|
2802
|
+
},
|
|
2803
|
+
required: [
|
|
2804
|
+
...newSchema?.required ?? [],
|
|
2805
|
+
...schema.required ?? []
|
|
2806
|
+
]
|
|
2807
|
+
};
|
|
2808
|
+
}
|
|
2809
|
+
if (newSchema) {
|
|
2810
|
+
if (newSchema.required)
|
|
2811
|
+
newSchema.required = [...new Set(newSchema.required)];
|
|
2812
|
+
if (additionalPropertiesIsFalse) newSchema.additionalProperties = false;
|
|
2813
|
+
else if (additionalPropertiesIsTrue)
|
|
2814
|
+
newSchema.additionalProperties = true;
|
|
2815
|
+
}
|
|
2816
|
+
return {
|
|
2817
|
+
schema: newSchema,
|
|
2818
|
+
notObjects
|
|
2819
|
+
};
|
|
2820
|
+
};
|
|
2821
|
+
var isTSchema = (value) => {
|
|
2822
|
+
if (!value || typeof value !== "object") return false;
|
|
2823
|
+
if (Kind in value) return true;
|
|
2824
|
+
const keys = Object.keys(value);
|
|
2825
|
+
if (keys.length > 0 && keys.every((k) => !isNaN(Number(k)))) {
|
|
2826
|
+
return false;
|
|
2827
|
+
}
|
|
2828
|
+
return false;
|
|
2829
|
+
};
|
|
2830
|
+
var normalizeSchemaReference = (schema) => {
|
|
2831
|
+
if (!schema) return void 0;
|
|
2832
|
+
if (typeof schema !== "string") return schema;
|
|
2833
|
+
return toRef(schema);
|
|
2834
|
+
};
|
|
2835
|
+
var mergeSchemaProperty = (existing, incoming, vendors) => {
|
|
2836
|
+
if (!existing) return incoming;
|
|
2837
|
+
if (!incoming) return existing;
|
|
2838
|
+
let existingSchema = normalizeSchemaReference(existing);
|
|
2839
|
+
let incomingSchema = normalizeSchemaReference(incoming);
|
|
2840
|
+
if (!existingSchema) return incoming;
|
|
2841
|
+
if (!incomingSchema) return existing;
|
|
2842
|
+
if (!isTSchema(incomingSchema) && incomingSchema["~standard"])
|
|
2843
|
+
incomingSchema = unwrapSchema(incomingSchema, vendors);
|
|
2844
|
+
if (!isTSchema(existingSchema) && existingSchema["~standard"])
|
|
2845
|
+
existingSchema = unwrapSchema(existingSchema, vendors);
|
|
2846
|
+
if (!incomingSchema) return existingSchema;
|
|
2847
|
+
if (!existingSchema) return incomingSchema;
|
|
2848
|
+
const { schema: mergedSchema, notObjects } = mergeObjectSchemas([
|
|
2849
|
+
existingSchema,
|
|
2850
|
+
incomingSchema
|
|
2851
|
+
]);
|
|
2852
|
+
if (notObjects.length > 0) {
|
|
2853
|
+
if (mergedSchema) return import_elysia.t.Intersect([mergedSchema, ...notObjects]);
|
|
2854
|
+
return notObjects.length === 1 ? notObjects[0] : import_elysia.t.Intersect(notObjects);
|
|
2855
|
+
}
|
|
2856
|
+
return mergedSchema;
|
|
2857
|
+
};
|
|
2858
|
+
var unwrapResponseSchema = (schema, vendors) => typeof schema === "string" ? normalizeSchemaReference(schema) : !schema ? void 0 : isTSchema(schema) ? schema : (
|
|
2859
|
+
// @ts-ignore
|
|
2860
|
+
schema["~standard"] ? unwrapSchema(schema, vendors, "output") : Object.fromEntries(
|
|
2861
|
+
Object.entries(schema).map(([status, schema2]) => [
|
|
2862
|
+
status,
|
|
2863
|
+
typeof schema2 === "string" ? normalizeSchemaReference(schema2) : isTSchema(schema2) ? schema2 : unwrapSchema(
|
|
2864
|
+
schema2,
|
|
2865
|
+
vendors,
|
|
2866
|
+
"output"
|
|
2867
|
+
)
|
|
2868
|
+
])
|
|
2869
|
+
)
|
|
2870
|
+
);
|
|
2871
|
+
var mergeResponseSchema = (_existing, _incoming, vendors) => {
|
|
2872
|
+
if (!_existing) return _incoming;
|
|
2873
|
+
if (!_incoming) return _existing;
|
|
2874
|
+
let existing = unwrapResponseSchema(_existing, vendors);
|
|
2875
|
+
let incoming = unwrapResponseSchema(_incoming, vendors);
|
|
2876
|
+
if (!existing && !incoming) return void 0;
|
|
2877
|
+
if (incoming && !existing) return incoming;
|
|
2878
|
+
if (existing && !incoming) return existing;
|
|
2879
|
+
if (isTSchema(existing) || existing?.["~standard"])
|
|
2880
|
+
existing = {
|
|
2881
|
+
200: existing
|
|
2882
|
+
};
|
|
2883
|
+
if (isTSchema(incoming) || incoming?.["~standard"])
|
|
2884
|
+
incoming = {
|
|
2885
|
+
200: incoming
|
|
2886
|
+
};
|
|
2887
|
+
const schema = {
|
|
2888
|
+
...incoming
|
|
2889
|
+
};
|
|
2890
|
+
for (const status of Object.keys(existing ?? {})) {
|
|
2891
|
+
const existingSchema = existing[status];
|
|
2892
|
+
const incomingSchema = incoming[status];
|
|
2893
|
+
if (existingSchema && incomingSchema)
|
|
2894
|
+
schema[status] = mergeSchemaProperty(
|
|
2895
|
+
existingSchema,
|
|
2896
|
+
incomingSchema,
|
|
2897
|
+
vendors
|
|
2898
|
+
);
|
|
2899
|
+
else if (existingSchema) schema[status] = existingSchema;
|
|
2900
|
+
else if (incomingSchema) schema[status] = incomingSchema;
|
|
2901
|
+
}
|
|
2902
|
+
return schema;
|
|
2903
|
+
};
|
|
2904
|
+
var mergeStandaloneValidators = (hooks, vendors) => {
|
|
2905
|
+
const merged = { ...hooks };
|
|
2906
|
+
if (!hooks.standaloneValidator?.length) return merged;
|
|
2907
|
+
for (const validator of hooks.standaloneValidator) {
|
|
2908
|
+
if (validator.body)
|
|
2909
|
+
merged.body = mergeSchemaProperty(
|
|
2910
|
+
merged.body,
|
|
2911
|
+
validator.body,
|
|
2912
|
+
vendors
|
|
2913
|
+
);
|
|
2914
|
+
if (validator.headers)
|
|
2915
|
+
merged.headers = mergeSchemaProperty(
|
|
2916
|
+
merged.headers,
|
|
2917
|
+
validator.headers,
|
|
2918
|
+
vendors
|
|
2919
|
+
);
|
|
2920
|
+
if (validator.query)
|
|
2921
|
+
merged.query = mergeSchemaProperty(
|
|
2922
|
+
merged.query,
|
|
2923
|
+
validator.query,
|
|
2924
|
+
vendors
|
|
2925
|
+
);
|
|
2926
|
+
if (validator.params)
|
|
2927
|
+
merged.params = mergeSchemaProperty(
|
|
2928
|
+
merged.params,
|
|
2929
|
+
validator.params,
|
|
2930
|
+
vendors
|
|
2931
|
+
);
|
|
2932
|
+
if (validator.cookie)
|
|
2933
|
+
merged.cookie = mergeSchemaProperty(
|
|
2934
|
+
merged.cookie,
|
|
2935
|
+
validator.cookie,
|
|
2936
|
+
vendors
|
|
2937
|
+
);
|
|
2938
|
+
if (validator.response)
|
|
2939
|
+
merged.response = mergeResponseSchema(
|
|
2940
|
+
merged.response,
|
|
2941
|
+
validator.response,
|
|
2942
|
+
vendors
|
|
2943
|
+
);
|
|
2944
|
+
}
|
|
2945
|
+
if (typeof merged.body === "string")
|
|
2946
|
+
merged.body = normalizeSchemaReference(merged.body);
|
|
2947
|
+
if (typeof merged.headers === "string")
|
|
2948
|
+
merged.headers = normalizeSchemaReference(merged.headers);
|
|
2949
|
+
if (typeof merged.query === "string")
|
|
2950
|
+
merged.query = normalizeSchemaReference(merged.query);
|
|
2951
|
+
if (typeof merged.params === "string")
|
|
2952
|
+
merged.params = normalizeSchemaReference(merged.params);
|
|
2953
|
+
if (typeof merged.cookie === "string")
|
|
2954
|
+
merged.cookie = normalizeSchemaReference(merged.cookie);
|
|
2955
|
+
if (merged.response && typeof merged.response !== "string") {
|
|
2956
|
+
const response = merged.response;
|
|
2957
|
+
if ("type" in response || "$ref" in response) {
|
|
2958
|
+
if (typeof response === "string")
|
|
2959
|
+
merged.response = normalizeSchemaReference(response);
|
|
2960
|
+
} else {
|
|
2961
|
+
for (const [status, schema] of Object.entries(response))
|
|
2962
|
+
if (typeof schema === "string")
|
|
2963
|
+
response[status] = normalizeSchemaReference(schema);
|
|
2964
|
+
}
|
|
2965
|
+
}
|
|
2966
|
+
return merged;
|
|
2967
|
+
};
|
|
2968
|
+
var flattenRoutes = (routes, vendors) => routes.map((route) => {
|
|
2969
|
+
if (!route.hooks?.standaloneValidator?.length) return route;
|
|
2970
|
+
return {
|
|
2971
|
+
...route,
|
|
2972
|
+
hooks: mergeStandaloneValidators(route.hooks, vendors)
|
|
2973
|
+
};
|
|
2974
|
+
});
|
|
2760
2975
|
var unwrapReference = (schema, definitions) => {
|
|
2761
2976
|
const ref = schema?.$ref;
|
|
2762
2977
|
if (!ref) return schema;
|
|
@@ -2764,13 +2979,20 @@ var unwrapReference = (schema, definitions) => {
|
|
|
2764
2979
|
if (ref && definitions[name]) schema = definitions[name];
|
|
2765
2980
|
return enumToOpenApi(schema);
|
|
2766
2981
|
};
|
|
2767
|
-
var unwrapSchema = (schema, mapJsonSchema) => {
|
|
2982
|
+
var unwrapSchema = (schema, mapJsonSchema, io = "input") => {
|
|
2768
2983
|
if (!schema) return;
|
|
2769
2984
|
if (typeof schema === "string") schema = toRef(schema);
|
|
2770
2985
|
if (Kind in schema) return enumToOpenApi(schema);
|
|
2771
|
-
if (
|
|
2986
|
+
if (!schema?.["~standard"] && // @ts-ignore
|
|
2987
|
+
(schema.$schema || schema.type || schema.properties || schema.items))
|
|
2988
|
+
return schema;
|
|
2989
|
+
if (!schema?.["~standard"]) return;
|
|
2772
2990
|
const vendor = schema["~standard"].vendor;
|
|
2773
2991
|
try {
|
|
2992
|
+
if (schema["~standard"]?.jsonSchema?.[io])
|
|
2993
|
+
return schema["~standard"]?.jsonSchema?.[io]?.({
|
|
2994
|
+
target: "draft-2020-12"
|
|
2995
|
+
});
|
|
2774
2996
|
if (mapJsonSchema?.[vendor] && typeof mapJsonSchema[vendor] === "function")
|
|
2775
2997
|
return enumToOpenApi(mapJsonSchema[vendor](schema));
|
|
2776
2998
|
switch (vendor) {
|
|
@@ -2865,7 +3087,6 @@ function toOpenAPISchema(app, exclude, references, vendors) {
|
|
|
2865
3087
|
const excludePaths = Array.isArray(exclude?.paths) ? exclude.paths : typeof exclude?.paths !== "undefined" ? [exclude.paths] : [];
|
|
2866
3088
|
const paths = /* @__PURE__ */ Object.create(null);
|
|
2867
3089
|
const definitions = app.getGlobalDefinitions?.().type;
|
|
2868
|
-
const routes = app.getGlobalRoutes();
|
|
2869
3090
|
if (references) {
|
|
2870
3091
|
if (!Array.isArray(references)) references = [references];
|
|
2871
3092
|
for (let i = 0; i < references.length; i++) {
|
|
@@ -2873,6 +3094,7 @@ function toOpenAPISchema(app, exclude, references, vendors) {
|
|
|
2873
3094
|
if (typeof reference === "function") references[i] = reference();
|
|
2874
3095
|
}
|
|
2875
3096
|
}
|
|
3097
|
+
const routes = flattenRoutes(app.getGlobalRoutes(), vendors);
|
|
2876
3098
|
for (const route of routes) {
|
|
2877
3099
|
if (route.hooks?.detail?.hide) continue;
|
|
2878
3100
|
const method = route.method.toLowerCase();
|
|
@@ -3062,7 +3284,7 @@ function toOpenAPISchema(app, exclude, references, vendors) {
|
|
|
3062
3284
|
if (typeof hooks.response === "object" && // TypeBox
|
|
3063
3285
|
!hooks.response.type && !hooks.response.$ref && !hooks.response["~standard"]) {
|
|
3064
3286
|
for (let [status, schema] of Object.entries(hooks.response)) {
|
|
3065
|
-
const response = unwrapSchema(schema, vendors);
|
|
3287
|
+
const response = unwrapSchema(schema, vendors, "output");
|
|
3066
3288
|
if (!response) continue;
|
|
3067
3289
|
const { type, description, $ref, ..._options } = unwrapReference(response, definitions);
|
|
3068
3290
|
operation.responses[status] = {
|
|
@@ -3079,7 +3301,11 @@ function toOpenAPISchema(app, exclude, references, vendors) {
|
|
|
3079
3301
|
};
|
|
3080
3302
|
}
|
|
3081
3303
|
} else {
|
|
3082
|
-
const response = unwrapSchema(
|
|
3304
|
+
const response = unwrapSchema(
|
|
3305
|
+
hooks.response,
|
|
3306
|
+
vendors,
|
|
3307
|
+
"output"
|
|
3308
|
+
);
|
|
3083
3309
|
if (response) {
|
|
3084
3310
|
const {
|
|
3085
3311
|
type: _type,
|
|
@@ -3904,47 +4130,41 @@ function TypeBoxFromTypeBox(type) {
|
|
|
3904
4130
|
return CloneType(type);
|
|
3905
4131
|
}
|
|
3906
4132
|
|
|
3907
|
-
// node_modules/valibot/dist/index.
|
|
3908
|
-
var store;
|
|
4133
|
+
// node_modules/valibot/dist/index.mjs
|
|
4134
|
+
var store$4;
|
|
3909
4135
|
// @__NO_SIDE_EFFECTS__
|
|
3910
|
-
function getGlobalConfig(
|
|
4136
|
+
function getGlobalConfig(config$1) {
|
|
3911
4137
|
return {
|
|
3912
|
-
lang:
|
|
3913
|
-
message:
|
|
3914
|
-
abortEarly:
|
|
3915
|
-
abortPipeEarly:
|
|
4138
|
+
lang: config$1?.lang ?? store$4?.lang,
|
|
4139
|
+
message: config$1?.message,
|
|
4140
|
+
abortEarly: config$1?.abortEarly ?? store$4?.abortEarly,
|
|
4141
|
+
abortPipeEarly: config$1?.abortPipeEarly ?? store$4?.abortPipeEarly
|
|
3916
4142
|
};
|
|
3917
4143
|
}
|
|
3918
|
-
var
|
|
4144
|
+
var store$3;
|
|
3919
4145
|
// @__NO_SIDE_EFFECTS__
|
|
3920
4146
|
function getGlobalMessage(lang) {
|
|
3921
|
-
return
|
|
4147
|
+
return store$3?.get(lang);
|
|
3922
4148
|
}
|
|
3923
|
-
var
|
|
4149
|
+
var store$2;
|
|
3924
4150
|
// @__NO_SIDE_EFFECTS__
|
|
3925
4151
|
function getSchemaMessage(lang) {
|
|
3926
|
-
return
|
|
4152
|
+
return store$2?.get(lang);
|
|
3927
4153
|
}
|
|
3928
|
-
var
|
|
4154
|
+
var store$1;
|
|
3929
4155
|
// @__NO_SIDE_EFFECTS__
|
|
3930
4156
|
function getSpecificMessage(reference, lang) {
|
|
3931
|
-
return
|
|
4157
|
+
return store$1?.get(reference)?.get(lang);
|
|
3932
4158
|
}
|
|
3933
4159
|
// @__NO_SIDE_EFFECTS__
|
|
3934
4160
|
function _stringify(input) {
|
|
3935
4161
|
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
|
-
}
|
|
4162
|
+
if (type === "string") return `"${input}"`;
|
|
4163
|
+
if (type === "number" || type === "bigint" || type === "boolean") return `${input}`;
|
|
4164
|
+
if (type === "object" || type === "function") return (input && Object.getPrototypeOf(input)?.constructor?.name) ?? "null";
|
|
3945
4165
|
return type;
|
|
3946
4166
|
}
|
|
3947
|
-
function _addIssue(context, label, dataset,
|
|
4167
|
+
function _addIssue(context, label, dataset, config$1, other) {
|
|
3948
4168
|
const input = other && "input" in other ? other.input : dataset.value;
|
|
3949
4169
|
const expected = other?.expected ?? context.expects ?? null;
|
|
3950
4170
|
const received = other?.received ?? /* @__PURE__ */ _stringify(input);
|
|
@@ -3958,48 +4178,49 @@ function _addIssue(context, label, dataset, config2, other) {
|
|
|
3958
4178
|
requirement: context.requirement,
|
|
3959
4179
|
path: other?.path,
|
|
3960
4180
|
issues: other?.issues,
|
|
3961
|
-
lang:
|
|
3962
|
-
abortEarly:
|
|
3963
|
-
abortPipeEarly:
|
|
4181
|
+
lang: config$1.lang,
|
|
4182
|
+
abortEarly: config$1.abortEarly,
|
|
4183
|
+
abortPipeEarly: config$1.abortPipeEarly
|
|
3964
4184
|
};
|
|
3965
4185
|
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
|
-
}
|
|
4186
|
+
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);
|
|
4187
|
+
if (message$1 !== void 0) issue2.message = typeof message$1 === "function" ? message$1(issue2) : message$1;
|
|
4188
|
+
if (isSchema) dataset.typed = false;
|
|
4189
|
+
if (dataset.issues) dataset.issues.push(issue2);
|
|
4190
|
+
else dataset.issues = [issue2];
|
|
3981
4191
|
}
|
|
3982
4192
|
// @__NO_SIDE_EFFECTS__
|
|
3983
4193
|
function _getStandardProps(context) {
|
|
3984
4194
|
return {
|
|
3985
4195
|
version: 1,
|
|
3986
4196
|
vendor: "valibot",
|
|
3987
|
-
validate(
|
|
3988
|
-
return context["~run"]({ value:
|
|
4197
|
+
validate(value$1) {
|
|
4198
|
+
return context["~run"]({ value: value$1 }, /* @__PURE__ */ getGlobalConfig());
|
|
3989
4199
|
}
|
|
3990
4200
|
};
|
|
3991
4201
|
}
|
|
3992
4202
|
var NON_DIGIT_REGEX = /\D/gu;
|
|
3993
4203
|
// @__NO_SIDE_EFFECTS__
|
|
3994
4204
|
function _isLuhnAlgo(input) {
|
|
3995
|
-
const
|
|
3996
|
-
let
|
|
4205
|
+
const number$1 = input.replace(NON_DIGIT_REGEX, "");
|
|
4206
|
+
let length$1 = number$1.length;
|
|
3997
4207
|
let bit = 1;
|
|
3998
4208
|
let sum = 0;
|
|
3999
|
-
while (
|
|
4000
|
-
const
|
|
4209
|
+
while (length$1) {
|
|
4210
|
+
const value$1 = +number$1[--length$1];
|
|
4001
4211
|
bit ^= 1;
|
|
4002
|
-
sum += bit ? [
|
|
4212
|
+
sum += bit ? [
|
|
4213
|
+
0,
|
|
4214
|
+
2,
|
|
4215
|
+
4,
|
|
4216
|
+
6,
|
|
4217
|
+
8,
|
|
4218
|
+
1,
|
|
4219
|
+
3,
|
|
4220
|
+
5,
|
|
4221
|
+
7,
|
|
4222
|
+
9
|
|
4223
|
+
][value$1] : value$1;
|
|
4003
4224
|
}
|
|
4004
4225
|
return sum % 10 === 0;
|
|
4005
4226
|
}
|
|
@@ -4009,14 +4230,8 @@ var CUID2_REGEX = /^[a-z][\da-z]*$/u;
|
|
|
4009
4230
|
var DECIMAL_REGEX = /^[+-]?(?:\d*\.)?\d+$/u;
|
|
4010
4231
|
var DIGITS_REGEX = /^\d+$/u;
|
|
4011
4232
|
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
|
-
);
|
|
4233
|
+
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");
|
|
4234
|
+
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
4235
|
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
4236
|
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
4237
|
var ISO_DATE_REGEX = /^\d{4}-(?:0[1-9]|1[0-2])-(?:[12]\d|0[1-9]|3[01])$/u;
|
|
@@ -4033,7 +4248,7 @@ var OCTAL_REGEX = /^(?:0o)?[0-7]+$/u;
|
|
|
4033
4248
|
var ULID_REGEX = /^[\da-hjkmnp-tv-zA-HJKMNP-TV-Z]{26}$/u;
|
|
4034
4249
|
var UUID_REGEX = /^[\da-f]{8}(?:-[\da-f]{4}){3}-[\da-f]{12}$/iu;
|
|
4035
4250
|
// @__NO_SIDE_EFFECTS__
|
|
4036
|
-
function base64(
|
|
4251
|
+
function base64(message$1) {
|
|
4037
4252
|
return {
|
|
4038
4253
|
kind: "validation",
|
|
4039
4254
|
type: "base64",
|
|
@@ -4041,17 +4256,15 @@ function base64(message2) {
|
|
|
4041
4256
|
async: false,
|
|
4042
4257
|
expects: null,
|
|
4043
4258
|
requirement: BASE64_REGEX,
|
|
4044
|
-
message:
|
|
4045
|
-
"~run"(dataset,
|
|
4046
|
-
if (dataset.typed && !this.requirement.test(dataset.value))
|
|
4047
|
-
_addIssue(this, "Base64", dataset, config2);
|
|
4048
|
-
}
|
|
4259
|
+
message: message$1,
|
|
4260
|
+
"~run"(dataset, config$1) {
|
|
4261
|
+
if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "Base64", dataset, config$1);
|
|
4049
4262
|
return dataset;
|
|
4050
4263
|
}
|
|
4051
4264
|
};
|
|
4052
4265
|
}
|
|
4053
4266
|
// @__NO_SIDE_EFFECTS__
|
|
4054
|
-
function bic(
|
|
4267
|
+
function bic(message$1) {
|
|
4055
4268
|
return {
|
|
4056
4269
|
kind: "validation",
|
|
4057
4270
|
type: "bic",
|
|
@@ -4059,11 +4272,9 @@ function bic(message2) {
|
|
|
4059
4272
|
async: false,
|
|
4060
4273
|
expects: null,
|
|
4061
4274
|
requirement: BIC_REGEX,
|
|
4062
|
-
message:
|
|
4063
|
-
"~run"(dataset,
|
|
4064
|
-
if (dataset.typed && !this.requirement.test(dataset.value))
|
|
4065
|
-
_addIssue(this, "BIC", dataset, config2);
|
|
4066
|
-
}
|
|
4275
|
+
message: message$1,
|
|
4276
|
+
"~run"(dataset, config$1) {
|
|
4277
|
+
if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "BIC", dataset, config$1);
|
|
4067
4278
|
return dataset;
|
|
4068
4279
|
}
|
|
4069
4280
|
};
|
|
@@ -4071,24 +4282,16 @@ function bic(message2) {
|
|
|
4071
4282
|
var CREDIT_CARD_REGEX = /^(?:\d{14,19}|\d{4}(?: \d{3,6}){2,4}|\d{4}(?:-\d{3,6}){2,4})$/u;
|
|
4072
4283
|
var SANITIZE_REGEX = /[- ]/gu;
|
|
4073
4284
|
var PROVIDER_REGEX_LIST = [
|
|
4074
|
-
// American Express
|
|
4075
4285
|
/^3[47]\d{13}$/u,
|
|
4076
|
-
// Diners Club
|
|
4077
4286
|
/^3(?:0[0-5]|[68]\d)\d{11,13}$/u,
|
|
4078
|
-
// Discover
|
|
4079
4287
|
/^6(?:011|5\d{2})\d{12,15}$/u,
|
|
4080
|
-
// JCB
|
|
4081
4288
|
/^(?:2131|1800|35\d{3})\d{11}$/u,
|
|
4082
|
-
// Mastercard
|
|
4083
|
-
// eslint-disable-next-line redos-detector/no-unsafe-regex
|
|
4084
4289
|
/^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
4290
|
/^(?:6[27]\d{14,17}|81\d{14,17})$/u,
|
|
4087
|
-
// Visa
|
|
4088
4291
|
/^4\d{12}(?:\d{3,6})?$/u
|
|
4089
4292
|
];
|
|
4090
4293
|
// @__NO_SIDE_EFFECTS__
|
|
4091
|
-
function creditCard(
|
|
4294
|
+
function creditCard(message$1) {
|
|
4092
4295
|
return {
|
|
4093
4296
|
kind: "validation",
|
|
4094
4297
|
type: "credit_card",
|
|
@@ -4097,22 +4300,17 @@ function creditCard(message2) {
|
|
|
4097
4300
|
expects: null,
|
|
4098
4301
|
requirement(input) {
|
|
4099
4302
|
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);
|
|
4303
|
+
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
4304
|
},
|
|
4105
|
-
message:
|
|
4106
|
-
"~run"(dataset,
|
|
4107
|
-
if (dataset.typed && !this.requirement(dataset.value))
|
|
4108
|
-
_addIssue(this, "credit card", dataset, config2);
|
|
4109
|
-
}
|
|
4305
|
+
message: message$1,
|
|
4306
|
+
"~run"(dataset, config$1) {
|
|
4307
|
+
if (dataset.typed && !this.requirement(dataset.value)) _addIssue(this, "credit card", dataset, config$1);
|
|
4110
4308
|
return dataset;
|
|
4111
4309
|
}
|
|
4112
4310
|
};
|
|
4113
4311
|
}
|
|
4114
4312
|
// @__NO_SIDE_EFFECTS__
|
|
4115
|
-
function cuid2(
|
|
4313
|
+
function cuid2(message$1) {
|
|
4116
4314
|
return {
|
|
4117
4315
|
kind: "validation",
|
|
4118
4316
|
type: "cuid2",
|
|
@@ -4120,17 +4318,15 @@ function cuid2(message2) {
|
|
|
4120
4318
|
async: false,
|
|
4121
4319
|
expects: null,
|
|
4122
4320
|
requirement: CUID2_REGEX,
|
|
4123
|
-
message:
|
|
4124
|
-
"~run"(dataset,
|
|
4125
|
-
if (dataset.typed && !this.requirement.test(dataset.value))
|
|
4126
|
-
_addIssue(this, "Cuid2", dataset, config2);
|
|
4127
|
-
}
|
|
4321
|
+
message: message$1,
|
|
4322
|
+
"~run"(dataset, config$1) {
|
|
4323
|
+
if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "Cuid2", dataset, config$1);
|
|
4128
4324
|
return dataset;
|
|
4129
4325
|
}
|
|
4130
4326
|
};
|
|
4131
4327
|
}
|
|
4132
4328
|
// @__NO_SIDE_EFFECTS__
|
|
4133
|
-
function decimal(
|
|
4329
|
+
function decimal(message$1) {
|
|
4134
4330
|
return {
|
|
4135
4331
|
kind: "validation",
|
|
4136
4332
|
type: "decimal",
|
|
@@ -4138,17 +4334,15 @@ function decimal(message2) {
|
|
|
4138
4334
|
async: false,
|
|
4139
4335
|
expects: null,
|
|
4140
4336
|
requirement: DECIMAL_REGEX,
|
|
4141
|
-
message:
|
|
4142
|
-
"~run"(dataset,
|
|
4143
|
-
if (dataset.typed && !this.requirement.test(dataset.value))
|
|
4144
|
-
_addIssue(this, "decimal", dataset, config2);
|
|
4145
|
-
}
|
|
4337
|
+
message: message$1,
|
|
4338
|
+
"~run"(dataset, config$1) {
|
|
4339
|
+
if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "decimal", dataset, config$1);
|
|
4146
4340
|
return dataset;
|
|
4147
4341
|
}
|
|
4148
4342
|
};
|
|
4149
4343
|
}
|
|
4150
4344
|
// @__NO_SIDE_EFFECTS__
|
|
4151
|
-
function digits(
|
|
4345
|
+
function digits(message$1) {
|
|
4152
4346
|
return {
|
|
4153
4347
|
kind: "validation",
|
|
4154
4348
|
type: "digits",
|
|
@@ -4156,17 +4350,15 @@ function digits(message2) {
|
|
|
4156
4350
|
async: false,
|
|
4157
4351
|
expects: null,
|
|
4158
4352
|
requirement: DIGITS_REGEX,
|
|
4159
|
-
message:
|
|
4160
|
-
"~run"(dataset,
|
|
4161
|
-
if (dataset.typed && !this.requirement.test(dataset.value))
|
|
4162
|
-
_addIssue(this, "digits", dataset, config2);
|
|
4163
|
-
}
|
|
4353
|
+
message: message$1,
|
|
4354
|
+
"~run"(dataset, config$1) {
|
|
4355
|
+
if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "digits", dataset, config$1);
|
|
4164
4356
|
return dataset;
|
|
4165
4357
|
}
|
|
4166
4358
|
};
|
|
4167
4359
|
}
|
|
4168
4360
|
// @__NO_SIDE_EFFECTS__
|
|
4169
|
-
function email(
|
|
4361
|
+
function email(message$1) {
|
|
4170
4362
|
return {
|
|
4171
4363
|
kind: "validation",
|
|
4172
4364
|
type: "email",
|
|
@@ -4174,17 +4366,15 @@ function email(message2) {
|
|
|
4174
4366
|
expects: null,
|
|
4175
4367
|
async: false,
|
|
4176
4368
|
requirement: EMAIL_REGEX,
|
|
4177
|
-
message:
|
|
4178
|
-
"~run"(dataset,
|
|
4179
|
-
if (dataset.typed && !this.requirement.test(dataset.value))
|
|
4180
|
-
_addIssue(this, "email", dataset, config2);
|
|
4181
|
-
}
|
|
4369
|
+
message: message$1,
|
|
4370
|
+
"~run"(dataset, config$1) {
|
|
4371
|
+
if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "email", dataset, config$1);
|
|
4182
4372
|
return dataset;
|
|
4183
4373
|
}
|
|
4184
4374
|
};
|
|
4185
4375
|
}
|
|
4186
4376
|
// @__NO_SIDE_EFFECTS__
|
|
4187
|
-
function emoji(
|
|
4377
|
+
function emoji(message$1) {
|
|
4188
4378
|
return {
|
|
4189
4379
|
kind: "validation",
|
|
4190
4380
|
type: "emoji",
|
|
@@ -4192,17 +4382,15 @@ function emoji(message2) {
|
|
|
4192
4382
|
async: false,
|
|
4193
4383
|
expects: null,
|
|
4194
4384
|
requirement: EMOJI_REGEX,
|
|
4195
|
-
message:
|
|
4196
|
-
"~run"(dataset,
|
|
4197
|
-
if (dataset.typed && !this.requirement.test(dataset.value))
|
|
4198
|
-
_addIssue(this, "emoji", dataset, config2);
|
|
4199
|
-
}
|
|
4385
|
+
message: message$1,
|
|
4386
|
+
"~run"(dataset, config$1) {
|
|
4387
|
+
if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "emoji", dataset, config$1);
|
|
4200
4388
|
return dataset;
|
|
4201
4389
|
}
|
|
4202
4390
|
};
|
|
4203
4391
|
}
|
|
4204
4392
|
// @__NO_SIDE_EFFECTS__
|
|
4205
|
-
function ip(
|
|
4393
|
+
function ip(message$1) {
|
|
4206
4394
|
return {
|
|
4207
4395
|
kind: "validation",
|
|
4208
4396
|
type: "ip",
|
|
@@ -4210,17 +4398,15 @@ function ip(message2) {
|
|
|
4210
4398
|
async: false,
|
|
4211
4399
|
expects: null,
|
|
4212
4400
|
requirement: IP_REGEX,
|
|
4213
|
-
message:
|
|
4214
|
-
"~run"(dataset,
|
|
4215
|
-
if (dataset.typed && !this.requirement.test(dataset.value))
|
|
4216
|
-
_addIssue(this, "IP", dataset, config2);
|
|
4217
|
-
}
|
|
4401
|
+
message: message$1,
|
|
4402
|
+
"~run"(dataset, config$1) {
|
|
4403
|
+
if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "IP", dataset, config$1);
|
|
4218
4404
|
return dataset;
|
|
4219
4405
|
}
|
|
4220
4406
|
};
|
|
4221
4407
|
}
|
|
4222
4408
|
// @__NO_SIDE_EFFECTS__
|
|
4223
|
-
function ipv4(
|
|
4409
|
+
function ipv4(message$1) {
|
|
4224
4410
|
return {
|
|
4225
4411
|
kind: "validation",
|
|
4226
4412
|
type: "ipv4",
|
|
@@ -4228,17 +4414,15 @@ function ipv4(message2) {
|
|
|
4228
4414
|
async: false,
|
|
4229
4415
|
expects: null,
|
|
4230
4416
|
requirement: IPV4_REGEX,
|
|
4231
|
-
message:
|
|
4232
|
-
"~run"(dataset,
|
|
4233
|
-
if (dataset.typed && !this.requirement.test(dataset.value))
|
|
4234
|
-
_addIssue(this, "IPv4", dataset, config2);
|
|
4235
|
-
}
|
|
4417
|
+
message: message$1,
|
|
4418
|
+
"~run"(dataset, config$1) {
|
|
4419
|
+
if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "IPv4", dataset, config$1);
|
|
4236
4420
|
return dataset;
|
|
4237
4421
|
}
|
|
4238
4422
|
};
|
|
4239
4423
|
}
|
|
4240
4424
|
// @__NO_SIDE_EFFECTS__
|
|
4241
|
-
function ipv6(
|
|
4425
|
+
function ipv6(message$1) {
|
|
4242
4426
|
return {
|
|
4243
4427
|
kind: "validation",
|
|
4244
4428
|
type: "ipv6",
|
|
@@ -4246,17 +4430,15 @@ function ipv6(message2) {
|
|
|
4246
4430
|
async: false,
|
|
4247
4431
|
expects: null,
|
|
4248
4432
|
requirement: IPV6_REGEX,
|
|
4249
|
-
message:
|
|
4250
|
-
"~run"(dataset,
|
|
4251
|
-
if (dataset.typed && !this.requirement.test(dataset.value))
|
|
4252
|
-
_addIssue(this, "IPv6", dataset, config2);
|
|
4253
|
-
}
|
|
4433
|
+
message: message$1,
|
|
4434
|
+
"~run"(dataset, config$1) {
|
|
4435
|
+
if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "IPv6", dataset, config$1);
|
|
4254
4436
|
return dataset;
|
|
4255
4437
|
}
|
|
4256
4438
|
};
|
|
4257
4439
|
}
|
|
4258
4440
|
// @__NO_SIDE_EFFECTS__
|
|
4259
|
-
function isoDate(
|
|
4441
|
+
function isoDate(message$1) {
|
|
4260
4442
|
return {
|
|
4261
4443
|
kind: "validation",
|
|
4262
4444
|
type: "iso_date",
|
|
@@ -4264,17 +4446,15 @@ function isoDate(message2) {
|
|
|
4264
4446
|
async: false,
|
|
4265
4447
|
expects: null,
|
|
4266
4448
|
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
|
-
}
|
|
4449
|
+
message: message$1,
|
|
4450
|
+
"~run"(dataset, config$1) {
|
|
4451
|
+
if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "date", dataset, config$1);
|
|
4272
4452
|
return dataset;
|
|
4273
4453
|
}
|
|
4274
4454
|
};
|
|
4275
4455
|
}
|
|
4276
4456
|
// @__NO_SIDE_EFFECTS__
|
|
4277
|
-
function isoDateTime(
|
|
4457
|
+
function isoDateTime(message$1) {
|
|
4278
4458
|
return {
|
|
4279
4459
|
kind: "validation",
|
|
4280
4460
|
type: "iso_date_time",
|
|
@@ -4282,17 +4462,15 @@ function isoDateTime(message2) {
|
|
|
4282
4462
|
async: false,
|
|
4283
4463
|
expects: null,
|
|
4284
4464
|
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
|
-
}
|
|
4465
|
+
message: message$1,
|
|
4466
|
+
"~run"(dataset, config$1) {
|
|
4467
|
+
if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "date-time", dataset, config$1);
|
|
4290
4468
|
return dataset;
|
|
4291
4469
|
}
|
|
4292
4470
|
};
|
|
4293
4471
|
}
|
|
4294
4472
|
// @__NO_SIDE_EFFECTS__
|
|
4295
|
-
function isoTime(
|
|
4473
|
+
function isoTime(message$1) {
|
|
4296
4474
|
return {
|
|
4297
4475
|
kind: "validation",
|
|
4298
4476
|
type: "iso_time",
|
|
@@ -4300,17 +4478,15 @@ function isoTime(message2) {
|
|
|
4300
4478
|
async: false,
|
|
4301
4479
|
expects: null,
|
|
4302
4480
|
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
|
-
}
|
|
4481
|
+
message: message$1,
|
|
4482
|
+
"~run"(dataset, config$1) {
|
|
4483
|
+
if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "time", dataset, config$1);
|
|
4308
4484
|
return dataset;
|
|
4309
4485
|
}
|
|
4310
4486
|
};
|
|
4311
4487
|
}
|
|
4312
4488
|
// @__NO_SIDE_EFFECTS__
|
|
4313
|
-
function isoTimeSecond(
|
|
4489
|
+
function isoTimeSecond(message$1) {
|
|
4314
4490
|
return {
|
|
4315
4491
|
kind: "validation",
|
|
4316
4492
|
type: "iso_time_second",
|
|
@@ -4318,17 +4494,15 @@ function isoTimeSecond(message2) {
|
|
|
4318
4494
|
async: false,
|
|
4319
4495
|
expects: null,
|
|
4320
4496
|
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
|
-
}
|
|
4497
|
+
message: message$1,
|
|
4498
|
+
"~run"(dataset, config$1) {
|
|
4499
|
+
if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "time-second", dataset, config$1);
|
|
4326
4500
|
return dataset;
|
|
4327
4501
|
}
|
|
4328
4502
|
};
|
|
4329
4503
|
}
|
|
4330
4504
|
// @__NO_SIDE_EFFECTS__
|
|
4331
|
-
function isoTimestamp(
|
|
4505
|
+
function isoTimestamp(message$1) {
|
|
4332
4506
|
return {
|
|
4333
4507
|
kind: "validation",
|
|
4334
4508
|
type: "iso_timestamp",
|
|
@@ -4336,17 +4510,15 @@ function isoTimestamp(message2) {
|
|
|
4336
4510
|
async: false,
|
|
4337
4511
|
expects: null,
|
|
4338
4512
|
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
|
-
}
|
|
4513
|
+
message: message$1,
|
|
4514
|
+
"~run"(dataset, config$1) {
|
|
4515
|
+
if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "timestamp", dataset, config$1);
|
|
4344
4516
|
return dataset;
|
|
4345
4517
|
}
|
|
4346
4518
|
};
|
|
4347
4519
|
}
|
|
4348
4520
|
// @__NO_SIDE_EFFECTS__
|
|
4349
|
-
function isoWeek(
|
|
4521
|
+
function isoWeek(message$1) {
|
|
4350
4522
|
return {
|
|
4351
4523
|
kind: "validation",
|
|
4352
4524
|
type: "iso_week",
|
|
@@ -4354,17 +4526,15 @@ function isoWeek(message2) {
|
|
|
4354
4526
|
async: false,
|
|
4355
4527
|
expects: null,
|
|
4356
4528
|
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
|
-
}
|
|
4529
|
+
message: message$1,
|
|
4530
|
+
"~run"(dataset, config$1) {
|
|
4531
|
+
if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "week", dataset, config$1);
|
|
4362
4532
|
return dataset;
|
|
4363
4533
|
}
|
|
4364
4534
|
};
|
|
4365
4535
|
}
|
|
4366
4536
|
// @__NO_SIDE_EFFECTS__
|
|
4367
|
-
function mac(
|
|
4537
|
+
function mac(message$1) {
|
|
4368
4538
|
return {
|
|
4369
4539
|
kind: "validation",
|
|
4370
4540
|
type: "mac",
|
|
@@ -4372,17 +4542,15 @@ function mac(message2) {
|
|
|
4372
4542
|
async: false,
|
|
4373
4543
|
expects: null,
|
|
4374
4544
|
requirement: MAC_REGEX,
|
|
4375
|
-
message:
|
|
4376
|
-
"~run"(dataset,
|
|
4377
|
-
if (dataset.typed && !this.requirement.test(dataset.value))
|
|
4378
|
-
_addIssue(this, "MAC", dataset, config2);
|
|
4379
|
-
}
|
|
4545
|
+
message: message$1,
|
|
4546
|
+
"~run"(dataset, config$1) {
|
|
4547
|
+
if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "MAC", dataset, config$1);
|
|
4380
4548
|
return dataset;
|
|
4381
4549
|
}
|
|
4382
4550
|
};
|
|
4383
4551
|
}
|
|
4384
4552
|
// @__NO_SIDE_EFFECTS__
|
|
4385
|
-
function mac48(
|
|
4553
|
+
function mac48(message$1) {
|
|
4386
4554
|
return {
|
|
4387
4555
|
kind: "validation",
|
|
4388
4556
|
type: "mac48",
|
|
@@ -4390,17 +4558,15 @@ function mac48(message2) {
|
|
|
4390
4558
|
async: false,
|
|
4391
4559
|
expects: null,
|
|
4392
4560
|
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
|
-
}
|
|
4561
|
+
message: message$1,
|
|
4562
|
+
"~run"(dataset, config$1) {
|
|
4563
|
+
if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "48-bit MAC", dataset, config$1);
|
|
4398
4564
|
return dataset;
|
|
4399
4565
|
}
|
|
4400
4566
|
};
|
|
4401
4567
|
}
|
|
4402
4568
|
// @__NO_SIDE_EFFECTS__
|
|
4403
|
-
function mac64(
|
|
4569
|
+
function mac64(message$1) {
|
|
4404
4570
|
return {
|
|
4405
4571
|
kind: "validation",
|
|
4406
4572
|
type: "mac64",
|
|
@@ -4408,17 +4574,15 @@ function mac64(message2) {
|
|
|
4408
4574
|
async: false,
|
|
4409
4575
|
expects: null,
|
|
4410
4576
|
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
|
-
}
|
|
4577
|
+
message: message$1,
|
|
4578
|
+
"~run"(dataset, config$1) {
|
|
4579
|
+
if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "64-bit MAC", dataset, config$1);
|
|
4416
4580
|
return dataset;
|
|
4417
4581
|
}
|
|
4418
4582
|
};
|
|
4419
4583
|
}
|
|
4420
4584
|
// @__NO_SIDE_EFFECTS__
|
|
4421
|
-
function nanoid(
|
|
4585
|
+
function nanoid(message$1) {
|
|
4422
4586
|
return {
|
|
4423
4587
|
kind: "validation",
|
|
4424
4588
|
type: "nanoid",
|
|
@@ -4426,17 +4590,15 @@ function nanoid(message2) {
|
|
|
4426
4590
|
async: false,
|
|
4427
4591
|
expects: null,
|
|
4428
4592
|
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
|
-
}
|
|
4593
|
+
message: message$1,
|
|
4594
|
+
"~run"(dataset, config$1) {
|
|
4595
|
+
if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "Nano ID", dataset, config$1);
|
|
4434
4596
|
return dataset;
|
|
4435
4597
|
}
|
|
4436
4598
|
};
|
|
4437
4599
|
}
|
|
4438
4600
|
// @__NO_SIDE_EFFECTS__
|
|
4439
|
-
function octal(
|
|
4601
|
+
function octal(message$1) {
|
|
4440
4602
|
return {
|
|
4441
4603
|
kind: "validation",
|
|
4442
4604
|
type: "octal",
|
|
@@ -4444,17 +4606,15 @@ function octal(message2) {
|
|
|
4444
4606
|
async: false,
|
|
4445
4607
|
expects: null,
|
|
4446
4608
|
requirement: OCTAL_REGEX,
|
|
4447
|
-
message:
|
|
4448
|
-
"~run"(dataset,
|
|
4449
|
-
if (dataset.typed && !this.requirement.test(dataset.value))
|
|
4450
|
-
_addIssue(this, "octal", dataset, config2);
|
|
4451
|
-
}
|
|
4609
|
+
message: message$1,
|
|
4610
|
+
"~run"(dataset, config$1) {
|
|
4611
|
+
if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "octal", dataset, config$1);
|
|
4452
4612
|
return dataset;
|
|
4453
4613
|
}
|
|
4454
4614
|
};
|
|
4455
4615
|
}
|
|
4456
4616
|
// @__NO_SIDE_EFFECTS__
|
|
4457
|
-
function ulid(
|
|
4617
|
+
function ulid(message$1) {
|
|
4458
4618
|
return {
|
|
4459
4619
|
kind: "validation",
|
|
4460
4620
|
type: "ulid",
|
|
@@ -4462,17 +4622,15 @@ function ulid(message2) {
|
|
|
4462
4622
|
async: false,
|
|
4463
4623
|
expects: null,
|
|
4464
4624
|
requirement: ULID_REGEX,
|
|
4465
|
-
message:
|
|
4466
|
-
"~run"(dataset,
|
|
4467
|
-
if (dataset.typed && !this.requirement.test(dataset.value))
|
|
4468
|
-
_addIssue(this, "ULID", dataset, config2);
|
|
4469
|
-
}
|
|
4625
|
+
message: message$1,
|
|
4626
|
+
"~run"(dataset, config$1) {
|
|
4627
|
+
if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "ULID", dataset, config$1);
|
|
4470
4628
|
return dataset;
|
|
4471
4629
|
}
|
|
4472
4630
|
};
|
|
4473
4631
|
}
|
|
4474
4632
|
// @__NO_SIDE_EFFECTS__
|
|
4475
|
-
function url(
|
|
4633
|
+
function url(message$1) {
|
|
4476
4634
|
return {
|
|
4477
4635
|
kind: "validation",
|
|
4478
4636
|
type: "url",
|
|
@@ -4487,17 +4645,15 @@ function url(message2) {
|
|
|
4487
4645
|
return false;
|
|
4488
4646
|
}
|
|
4489
4647
|
},
|
|
4490
|
-
message:
|
|
4491
|
-
"~run"(dataset,
|
|
4492
|
-
if (dataset.typed && !this.requirement(dataset.value))
|
|
4493
|
-
_addIssue(this, "URL", dataset, config2);
|
|
4494
|
-
}
|
|
4648
|
+
message: message$1,
|
|
4649
|
+
"~run"(dataset, config$1) {
|
|
4650
|
+
if (dataset.typed && !this.requirement(dataset.value)) _addIssue(this, "URL", dataset, config$1);
|
|
4495
4651
|
return dataset;
|
|
4496
4652
|
}
|
|
4497
4653
|
};
|
|
4498
4654
|
}
|
|
4499
4655
|
// @__NO_SIDE_EFFECTS__
|
|
4500
|
-
function uuid(
|
|
4656
|
+
function uuid(message$1) {
|
|
4501
4657
|
return {
|
|
4502
4658
|
kind: "validation",
|
|
4503
4659
|
type: "uuid",
|
|
@@ -4505,64 +4661,55 @@ function uuid(message2) {
|
|
|
4505
4661
|
async: false,
|
|
4506
4662
|
expects: null,
|
|
4507
4663
|
requirement: UUID_REGEX,
|
|
4508
|
-
message:
|
|
4509
|
-
"~run"(dataset,
|
|
4510
|
-
if (dataset.typed && !this.requirement.test(dataset.value))
|
|
4511
|
-
_addIssue(this, "UUID", dataset, config2);
|
|
4512
|
-
}
|
|
4664
|
+
message: message$1,
|
|
4665
|
+
"~run"(dataset, config$1) {
|
|
4666
|
+
if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "UUID", dataset, config$1);
|
|
4513
4667
|
return dataset;
|
|
4514
4668
|
}
|
|
4515
4669
|
};
|
|
4516
4670
|
}
|
|
4517
4671
|
// @__NO_SIDE_EFFECTS__
|
|
4518
|
-
function string(
|
|
4672
|
+
function string(message$1) {
|
|
4519
4673
|
return {
|
|
4520
4674
|
kind: "schema",
|
|
4521
4675
|
type: "string",
|
|
4522
4676
|
reference: string,
|
|
4523
4677
|
expects: "string",
|
|
4524
4678
|
async: false,
|
|
4525
|
-
message:
|
|
4679
|
+
message: message$1,
|
|
4526
4680
|
get "~standard"() {
|
|
4527
4681
|
return /* @__PURE__ */ _getStandardProps(this);
|
|
4528
4682
|
},
|
|
4529
|
-
"~run"(dataset,
|
|
4530
|
-
if (typeof dataset.value === "string")
|
|
4531
|
-
|
|
4532
|
-
} else {
|
|
4533
|
-
_addIssue(this, "type", dataset, config2);
|
|
4534
|
-
}
|
|
4683
|
+
"~run"(dataset, config$1) {
|
|
4684
|
+
if (typeof dataset.value === "string") dataset.typed = true;
|
|
4685
|
+
else _addIssue(this, "type", dataset, config$1);
|
|
4535
4686
|
return dataset;
|
|
4536
4687
|
}
|
|
4537
4688
|
};
|
|
4538
4689
|
}
|
|
4539
4690
|
// @__NO_SIDE_EFFECTS__
|
|
4540
|
-
function pipe(...
|
|
4691
|
+
function pipe(...pipe$1) {
|
|
4541
4692
|
return {
|
|
4542
|
-
...
|
|
4543
|
-
pipe:
|
|
4693
|
+
...pipe$1[0],
|
|
4694
|
+
pipe: pipe$1,
|
|
4544
4695
|
get "~standard"() {
|
|
4545
4696
|
return /* @__PURE__ */ _getStandardProps(this);
|
|
4546
4697
|
},
|
|
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
|
-
}
|
|
4698
|
+
"~run"(dataset, config$1) {
|
|
4699
|
+
for (const item of pipe$1) if (item.kind !== "metadata") {
|
|
4700
|
+
if (dataset.issues && (item.kind === "schema" || item.kind === "transformation")) {
|
|
4701
|
+
dataset.typed = false;
|
|
4702
|
+
break;
|
|
4557
4703
|
}
|
|
4704
|
+
if (!dataset.issues || !config$1.abortEarly && !config$1.abortPipeEarly) dataset = item["~run"](dataset, config$1);
|
|
4558
4705
|
}
|
|
4559
4706
|
return dataset;
|
|
4560
4707
|
}
|
|
4561
4708
|
};
|
|
4562
4709
|
}
|
|
4563
4710
|
// @__NO_SIDE_EFFECTS__
|
|
4564
|
-
function safeParse(schema, input,
|
|
4565
|
-
const dataset = schema["~run"]({ value: input }, /* @__PURE__ */ getGlobalConfig(
|
|
4711
|
+
function safeParse(schema, input, config$1) {
|
|
4712
|
+
const dataset = schema["~run"]({ value: input }, /* @__PURE__ */ getGlobalConfig(config$1));
|
|
4566
4713
|
return {
|
|
4567
4714
|
typed: dataset.typed,
|
|
4568
4715
|
success: !dataset.issues,
|
|
@@ -4867,30 +5014,39 @@ var NEVER = Object.freeze({
|
|
|
4867
5014
|
// @__NO_SIDE_EFFECTS__
|
|
4868
5015
|
function $constructor(name, initializer3, params) {
|
|
4869
5016
|
function init(inst, def) {
|
|
4870
|
-
|
|
4871
|
-
|
|
4872
|
-
|
|
4873
|
-
|
|
4874
|
-
|
|
4875
|
-
|
|
5017
|
+
if (!inst._zod) {
|
|
5018
|
+
Object.defineProperty(inst, "_zod", {
|
|
5019
|
+
value: {
|
|
5020
|
+
def,
|
|
5021
|
+
constr: _,
|
|
5022
|
+
traits: /* @__PURE__ */ new Set()
|
|
5023
|
+
},
|
|
5024
|
+
enumerable: false
|
|
5025
|
+
});
|
|
5026
|
+
}
|
|
5027
|
+
if (inst._zod.traits.has(name)) {
|
|
5028
|
+
return;
|
|
5029
|
+
}
|
|
4876
5030
|
inst._zod.traits.add(name);
|
|
4877
5031
|
initializer3(inst, def);
|
|
4878
|
-
|
|
4879
|
-
|
|
4880
|
-
|
|
5032
|
+
const proto = _.prototype;
|
|
5033
|
+
const keys = Object.keys(proto);
|
|
5034
|
+
for (let i = 0; i < keys.length; i++) {
|
|
5035
|
+
const k = keys[i];
|
|
5036
|
+
if (!(k in inst)) {
|
|
5037
|
+
inst[k] = proto[k].bind(inst);
|
|
5038
|
+
}
|
|
4881
5039
|
}
|
|
4882
|
-
inst._zod.constr = _;
|
|
4883
|
-
inst._zod.def = def;
|
|
4884
5040
|
}
|
|
4885
5041
|
const Parent = params?.Parent ?? Object;
|
|
4886
5042
|
class Definition extends Parent {
|
|
4887
5043
|
}
|
|
4888
5044
|
Object.defineProperty(Definition, "name", { value: name });
|
|
4889
5045
|
function _(def) {
|
|
4890
|
-
var
|
|
5046
|
+
var _a2;
|
|
4891
5047
|
const inst = params?.Parent ? new Definition() : this;
|
|
4892
5048
|
init(inst, def);
|
|
4893
|
-
(
|
|
5049
|
+
(_a2 = inst._zod).deferred ?? (_a2.deferred = []);
|
|
4894
5050
|
for (const fn of inst._zod.deferred) {
|
|
4895
5051
|
fn();
|
|
4896
5052
|
}
|
|
@@ -4907,7 +5063,6 @@ function $constructor(name, initializer3, params) {
|
|
|
4907
5063
|
Object.defineProperty(_, "name", { value: name });
|
|
4908
5064
|
return _;
|
|
4909
5065
|
}
|
|
4910
|
-
var $brand = Symbol("zod_brand");
|
|
4911
5066
|
var $ZodAsyncError = class extends Error {
|
|
4912
5067
|
constructor() {
|
|
4913
5068
|
super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`);
|
|
@@ -4984,6 +5139,7 @@ __export(util_exports, {
|
|
|
4984
5139
|
required: () => required,
|
|
4985
5140
|
safeExtend: () => safeExtend,
|
|
4986
5141
|
shallowClone: () => shallowClone,
|
|
5142
|
+
slugify: () => slugify,
|
|
4987
5143
|
stringifyPrimitive: () => stringifyPrimitive,
|
|
4988
5144
|
uint8ArrayToBase64: () => uint8ArrayToBase64,
|
|
4989
5145
|
uint8ArrayToBase64url: () => uint8ArrayToBase64url,
|
|
@@ -4999,7 +5155,7 @@ function assertNotEqual(val) {
|
|
|
4999
5155
|
function assertIs(_arg) {
|
|
5000
5156
|
}
|
|
5001
5157
|
function assertNever(_x) {
|
|
5002
|
-
throw new Error();
|
|
5158
|
+
throw new Error("Unexpected value in exhaustive check");
|
|
5003
5159
|
}
|
|
5004
5160
|
function assert(_) {
|
|
5005
5161
|
}
|
|
@@ -5052,7 +5208,7 @@ function floatSafeRemainder(val, step) {
|
|
|
5052
5208
|
const stepInt = Number.parseInt(step.toFixed(decCount).replace(".", ""));
|
|
5053
5209
|
return valInt % stepInt / 10 ** decCount;
|
|
5054
5210
|
}
|
|
5055
|
-
var EVALUATING = Symbol("evaluating");
|
|
5211
|
+
var EVALUATING = /* @__PURE__ */ Symbol("evaluating");
|
|
5056
5212
|
function defineLazy(object, key, getter) {
|
|
5057
5213
|
let value = void 0;
|
|
5058
5214
|
Object.defineProperty(object, key, {
|
|
@@ -5124,6 +5280,9 @@ function randomString(length = 10) {
|
|
|
5124
5280
|
function esc(str) {
|
|
5125
5281
|
return JSON.stringify(str);
|
|
5126
5282
|
}
|
|
5283
|
+
function slugify(input) {
|
|
5284
|
+
return input.toLowerCase().trim().replace(/[^\w\s-]/g, "").replace(/[\s_-]+/g, "-").replace(/^-+|-+$/g, "");
|
|
5285
|
+
}
|
|
5127
5286
|
var captureStackTrace = "captureStackTrace" in Error ? Error.captureStackTrace : (..._args) => {
|
|
5128
5287
|
};
|
|
5129
5288
|
function isObject(data) {
|
|
@@ -5147,6 +5306,8 @@ function isPlainObject(o) {
|
|
|
5147
5306
|
const ctor = o.constructor;
|
|
5148
5307
|
if (ctor === void 0)
|
|
5149
5308
|
return true;
|
|
5309
|
+
if (typeof ctor !== "function")
|
|
5310
|
+
return true;
|
|
5150
5311
|
const prot = ctor.prototype;
|
|
5151
5312
|
if (isObject(prot) === false)
|
|
5152
5313
|
return false;
|
|
@@ -5463,8 +5624,8 @@ function aborted(x, startIndex = 0) {
|
|
|
5463
5624
|
}
|
|
5464
5625
|
function prefixIssues(path, issues) {
|
|
5465
5626
|
return issues.map((iss) => {
|
|
5466
|
-
var
|
|
5467
|
-
(
|
|
5627
|
+
var _a2;
|
|
5628
|
+
(_a2 = iss).path ?? (_a2.path = []);
|
|
5468
5629
|
iss.path.unshift(path);
|
|
5469
5630
|
return iss;
|
|
5470
5631
|
});
|
|
@@ -5592,10 +5753,7 @@ function flattenError(error, mapper = (issue2) => issue2.message) {
|
|
|
5592
5753
|
}
|
|
5593
5754
|
return { formErrors, fieldErrors };
|
|
5594
5755
|
}
|
|
5595
|
-
function formatError(error,
|
|
5596
|
-
const mapper = _mapper || function(issue2) {
|
|
5597
|
-
return issue2.message;
|
|
5598
|
-
};
|
|
5756
|
+
function formatError(error, mapper = (issue2) => issue2.message) {
|
|
5599
5757
|
const fieldErrors = { _errors: [] };
|
|
5600
5758
|
const processError = (error2) => {
|
|
5601
5759
|
for (const issue2 of error2.issues) {
|
|
@@ -5732,7 +5890,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
5890
|
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
5891
|
var base642 = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/;
|
|
5734
5892
|
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
5893
|
var e164 = /^\+(?:[0-9]){6,14}[0-9]$/;
|
|
5737
5894
|
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
5895
|
var date = /* @__PURE__ */ new RegExp(`^${dateSource}$`);
|
|
@@ -5769,10 +5926,10 @@ var uppercase = /^[^a-z]*$/;
|
|
|
5769
5926
|
|
|
5770
5927
|
// node_modules/zod/v4/core/checks.js
|
|
5771
5928
|
var $ZodCheck = /* @__PURE__ */ $constructor("$ZodCheck", (inst, def) => {
|
|
5772
|
-
var
|
|
5929
|
+
var _a2;
|
|
5773
5930
|
inst._zod ?? (inst._zod = {});
|
|
5774
5931
|
inst._zod.def = def;
|
|
5775
|
-
(
|
|
5932
|
+
(_a2 = inst._zod).onattach ?? (_a2.onattach = []);
|
|
5776
5933
|
});
|
|
5777
5934
|
var numericOriginMap = {
|
|
5778
5935
|
number: "number",
|
|
@@ -5838,8 +5995,8 @@ var $ZodCheckGreaterThan = /* @__PURE__ */ $constructor("$ZodCheckGreaterThan",
|
|
|
5838
5995
|
var $ZodCheckMultipleOf = /* @__PURE__ */ $constructor("$ZodCheckMultipleOf", (inst, def) => {
|
|
5839
5996
|
$ZodCheck.init(inst, def);
|
|
5840
5997
|
inst._zod.onattach.push((inst2) => {
|
|
5841
|
-
var
|
|
5842
|
-
(
|
|
5998
|
+
var _a2;
|
|
5999
|
+
(_a2 = inst2._zod.bag).multipleOf ?? (_a2.multipleOf = def.value);
|
|
5843
6000
|
});
|
|
5844
6001
|
inst._zod.check = (payload) => {
|
|
5845
6002
|
if (typeof payload.value !== typeof def.value)
|
|
@@ -5933,9 +6090,9 @@ var $ZodCheckNumberFormat = /* @__PURE__ */ $constructor("$ZodCheckNumberFormat"
|
|
|
5933
6090
|
};
|
|
5934
6091
|
});
|
|
5935
6092
|
var $ZodCheckMaxLength = /* @__PURE__ */ $constructor("$ZodCheckMaxLength", (inst, def) => {
|
|
5936
|
-
var
|
|
6093
|
+
var _a2;
|
|
5937
6094
|
$ZodCheck.init(inst, def);
|
|
5938
|
-
(
|
|
6095
|
+
(_a2 = inst._zod.def).when ?? (_a2.when = (payload) => {
|
|
5939
6096
|
const val = payload.value;
|
|
5940
6097
|
return !nullish(val) && val.length !== void 0;
|
|
5941
6098
|
});
|
|
@@ -5962,9 +6119,9 @@ var $ZodCheckMaxLength = /* @__PURE__ */ $constructor("$ZodCheckMaxLength", (ins
|
|
|
5962
6119
|
};
|
|
5963
6120
|
});
|
|
5964
6121
|
var $ZodCheckMinLength = /* @__PURE__ */ $constructor("$ZodCheckMinLength", (inst, def) => {
|
|
5965
|
-
var
|
|
6122
|
+
var _a2;
|
|
5966
6123
|
$ZodCheck.init(inst, def);
|
|
5967
|
-
(
|
|
6124
|
+
(_a2 = inst._zod.def).when ?? (_a2.when = (payload) => {
|
|
5968
6125
|
const val = payload.value;
|
|
5969
6126
|
return !nullish(val) && val.length !== void 0;
|
|
5970
6127
|
});
|
|
@@ -5991,9 +6148,9 @@ var $ZodCheckMinLength = /* @__PURE__ */ $constructor("$ZodCheckMinLength", (ins
|
|
|
5991
6148
|
};
|
|
5992
6149
|
});
|
|
5993
6150
|
var $ZodCheckLengthEquals = /* @__PURE__ */ $constructor("$ZodCheckLengthEquals", (inst, def) => {
|
|
5994
|
-
var
|
|
6151
|
+
var _a2;
|
|
5995
6152
|
$ZodCheck.init(inst, def);
|
|
5996
|
-
(
|
|
6153
|
+
(_a2 = inst._zod.def).when ?? (_a2.when = (payload) => {
|
|
5997
6154
|
const val = payload.value;
|
|
5998
6155
|
return !nullish(val) && val.length !== void 0;
|
|
5999
6156
|
});
|
|
@@ -6022,7 +6179,7 @@ var $ZodCheckLengthEquals = /* @__PURE__ */ $constructor("$ZodCheckLengthEquals"
|
|
|
6022
6179
|
};
|
|
6023
6180
|
});
|
|
6024
6181
|
var $ZodCheckStringFormat = /* @__PURE__ */ $constructor("$ZodCheckStringFormat", (inst, def) => {
|
|
6025
|
-
var
|
|
6182
|
+
var _a2, _b;
|
|
6026
6183
|
$ZodCheck.init(inst, def);
|
|
6027
6184
|
inst._zod.onattach.push((inst2) => {
|
|
6028
6185
|
const bag = inst2._zod.bag;
|
|
@@ -6033,7 +6190,7 @@ var $ZodCheckStringFormat = /* @__PURE__ */ $constructor("$ZodCheckStringFormat"
|
|
|
6033
6190
|
}
|
|
6034
6191
|
});
|
|
6035
6192
|
if (def.pattern)
|
|
6036
|
-
(
|
|
6193
|
+
(_a2 = inst._zod).check ?? (_a2.check = (payload) => {
|
|
6037
6194
|
def.pattern.lastIndex = 0;
|
|
6038
6195
|
if (def.pattern.test(payload.value))
|
|
6039
6196
|
return;
|
|
@@ -6192,13 +6349,13 @@ var Doc = class {
|
|
|
6192
6349
|
// node_modules/zod/v4/core/versions.js
|
|
6193
6350
|
var version = {
|
|
6194
6351
|
major: 4,
|
|
6195
|
-
minor:
|
|
6196
|
-
patch:
|
|
6352
|
+
minor: 2,
|
|
6353
|
+
patch: 1
|
|
6197
6354
|
};
|
|
6198
6355
|
|
|
6199
6356
|
// node_modules/zod/v4/core/schemas.js
|
|
6200
6357
|
var $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
|
|
6201
|
-
var
|
|
6358
|
+
var _a2;
|
|
6202
6359
|
inst ?? (inst = {});
|
|
6203
6360
|
inst._zod.def = def;
|
|
6204
6361
|
inst._zod.bag = inst._zod.bag || {};
|
|
@@ -6213,7 +6370,7 @@ var $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
|
|
|
6213
6370
|
}
|
|
6214
6371
|
}
|
|
6215
6372
|
if (checks.length === 0) {
|
|
6216
|
-
(
|
|
6373
|
+
(_a2 = inst._zod).deferred ?? (_a2.deferred = []);
|
|
6217
6374
|
inst._zod.deferred?.push(() => {
|
|
6218
6375
|
inst._zod.run = inst._zod.parse;
|
|
6219
6376
|
});
|
|
@@ -6371,7 +6528,7 @@ var $ZodURL = /* @__PURE__ */ $constructor("$ZodURL", (inst, def) => {
|
|
|
6371
6528
|
code: "invalid_format",
|
|
6372
6529
|
format: "url",
|
|
6373
6530
|
note: "Invalid hostname",
|
|
6374
|
-
pattern: hostname.source,
|
|
6531
|
+
pattern: def.hostname.source,
|
|
6375
6532
|
input: payload.value,
|
|
6376
6533
|
inst,
|
|
6377
6534
|
continue: !def.abort
|
|
@@ -6456,18 +6613,12 @@ var $ZodISODuration = /* @__PURE__ */ $constructor("$ZodISODuration", (inst, def
|
|
|
6456
6613
|
var $ZodIPv4 = /* @__PURE__ */ $constructor("$ZodIPv4", (inst, def) => {
|
|
6457
6614
|
def.pattern ?? (def.pattern = ipv42);
|
|
6458
6615
|
$ZodStringFormat.init(inst, def);
|
|
6459
|
-
inst._zod.
|
|
6460
|
-
const bag = inst2._zod.bag;
|
|
6461
|
-
bag.format = `ipv4`;
|
|
6462
|
-
});
|
|
6616
|
+
inst._zod.bag.format = `ipv4`;
|
|
6463
6617
|
});
|
|
6464
6618
|
var $ZodIPv6 = /* @__PURE__ */ $constructor("$ZodIPv6", (inst, def) => {
|
|
6465
6619
|
def.pattern ?? (def.pattern = ipv62);
|
|
6466
6620
|
$ZodStringFormat.init(inst, def);
|
|
6467
|
-
inst._zod.
|
|
6468
|
-
const bag = inst2._zod.bag;
|
|
6469
|
-
bag.format = `ipv6`;
|
|
6470
|
-
});
|
|
6621
|
+
inst._zod.bag.format = `ipv6`;
|
|
6471
6622
|
inst._zod.check = (payload) => {
|
|
6472
6623
|
try {
|
|
6473
6624
|
new URL(`http://[${payload.value}]`);
|
|
@@ -6529,9 +6680,7 @@ function isValidBase64(data) {
|
|
|
6529
6680
|
var $ZodBase64 = /* @__PURE__ */ $constructor("$ZodBase64", (inst, def) => {
|
|
6530
6681
|
def.pattern ?? (def.pattern = base642);
|
|
6531
6682
|
$ZodStringFormat.init(inst, def);
|
|
6532
|
-
inst._zod.
|
|
6533
|
-
inst2._zod.bag.contentEncoding = "base64";
|
|
6534
|
-
});
|
|
6683
|
+
inst._zod.bag.contentEncoding = "base64";
|
|
6535
6684
|
inst._zod.check = (payload) => {
|
|
6536
6685
|
if (isValidBase64(payload.value))
|
|
6537
6686
|
return;
|
|
@@ -6554,9 +6703,7 @@ function isValidBase64URL(data) {
|
|
|
6554
6703
|
var $ZodBase64URL = /* @__PURE__ */ $constructor("$ZodBase64URL", (inst, def) => {
|
|
6555
6704
|
def.pattern ?? (def.pattern = base64url);
|
|
6556
6705
|
$ZodStringFormat.init(inst, def);
|
|
6557
|
-
inst._zod.
|
|
6558
|
-
inst2._zod.bag.contentEncoding = "base64url";
|
|
6559
|
-
});
|
|
6706
|
+
inst._zod.bag.contentEncoding = "base64url";
|
|
6560
6707
|
inst._zod.check = (payload) => {
|
|
6561
6708
|
if (isValidBase64URL(payload.value))
|
|
6562
6709
|
return;
|
|
@@ -6631,7 +6778,7 @@ var $ZodNumber = /* @__PURE__ */ $constructor("$ZodNumber", (inst, def) => {
|
|
|
6631
6778
|
return payload;
|
|
6632
6779
|
};
|
|
6633
6780
|
});
|
|
6634
|
-
var $ZodNumberFormat = /* @__PURE__ */ $constructor("$
|
|
6781
|
+
var $ZodNumberFormat = /* @__PURE__ */ $constructor("$ZodNumberFormat", (inst, def) => {
|
|
6635
6782
|
$ZodCheckNumberFormat.init(inst, def);
|
|
6636
6783
|
$ZodNumber.init(inst, def);
|
|
6637
6784
|
});
|
|
@@ -6858,7 +7005,7 @@ function handleCatchall(proms, input, payload, ctx, def, inst) {
|
|
|
6858
7005
|
const keySet = def.keySet;
|
|
6859
7006
|
const _catchall = def.catchall._zod;
|
|
6860
7007
|
const t2 = _catchall.def.type;
|
|
6861
|
-
for (const key
|
|
7008
|
+
for (const key in input) {
|
|
6862
7009
|
if (keySet.has(key))
|
|
6863
7010
|
continue;
|
|
6864
7011
|
if (t2 === "never") {
|
|
@@ -6888,6 +7035,19 @@ function handleCatchall(proms, input, payload, ctx, def, inst) {
|
|
|
6888
7035
|
}
|
|
6889
7036
|
var $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
|
|
6890
7037
|
$ZodType.init(inst, def);
|
|
7038
|
+
const desc = Object.getOwnPropertyDescriptor(def, "shape");
|
|
7039
|
+
if (!desc?.get) {
|
|
7040
|
+
const sh = def.shape;
|
|
7041
|
+
Object.defineProperty(def, "shape", {
|
|
7042
|
+
get: () => {
|
|
7043
|
+
const newSh = { ...sh };
|
|
7044
|
+
Object.defineProperty(def, "shape", {
|
|
7045
|
+
value: newSh
|
|
7046
|
+
});
|
|
7047
|
+
return newSh;
|
|
7048
|
+
}
|
|
7049
|
+
});
|
|
7050
|
+
}
|
|
6891
7051
|
const _normalized = cached(() => normalizeDef(def));
|
|
6892
7052
|
defineLazy(inst._zod, "propValues", () => {
|
|
6893
7053
|
const shape = def.shape;
|
|
@@ -7078,6 +7238,7 @@ var $ZodUnion = /* @__PURE__ */ $constructor("$ZodUnion", (inst, def) => {
|
|
|
7078
7238
|
};
|
|
7079
7239
|
});
|
|
7080
7240
|
var $ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("$ZodDiscriminatedUnion", (inst, def) => {
|
|
7241
|
+
def.inclusive = false;
|
|
7081
7242
|
$ZodUnion.init(inst, def);
|
|
7082
7243
|
const _super = inst._zod.parse;
|
|
7083
7244
|
defineLazy(inst._zod, "propValues", () => {
|
|
@@ -7220,7 +7381,6 @@ function handleIntersectionResults(result, left, right) {
|
|
|
7220
7381
|
var $ZodTuple = /* @__PURE__ */ $constructor("$ZodTuple", (inst, def) => {
|
|
7221
7382
|
$ZodType.init(inst, def);
|
|
7222
7383
|
const items = def.items;
|
|
7223
|
-
const optStart = items.length - [...items].reverse().findIndex((item) => item._zod.optin !== "optional");
|
|
7224
7384
|
inst._zod.parse = (payload, ctx) => {
|
|
7225
7385
|
const input = payload.value;
|
|
7226
7386
|
if (!Array.isArray(input)) {
|
|
@@ -7234,6 +7394,8 @@ var $ZodTuple = /* @__PURE__ */ $constructor("$ZodTuple", (inst, def) => {
|
|
|
7234
7394
|
}
|
|
7235
7395
|
payload.value = [];
|
|
7236
7396
|
const proms = [];
|
|
7397
|
+
const reversedIndex = [...items].reverse().findIndex((item) => item._zod.optin !== "optional");
|
|
7398
|
+
const optStart = reversedIndex === -1 ? 0 : items.length - reversedIndex;
|
|
7237
7399
|
if (!def.rest) {
|
|
7238
7400
|
const tooBig = input.length > items.length;
|
|
7239
7401
|
const tooSmall = input.length < optStart - 1;
|
|
@@ -7304,11 +7466,13 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
|
|
|
7304
7466
|
return payload;
|
|
7305
7467
|
}
|
|
7306
7468
|
const proms = [];
|
|
7307
|
-
|
|
7308
|
-
|
|
7469
|
+
const values = def.keyType._zod.values;
|
|
7470
|
+
if (values) {
|
|
7309
7471
|
payload.value = {};
|
|
7472
|
+
const recordKeys = /* @__PURE__ */ new Set();
|
|
7310
7473
|
for (const key of values) {
|
|
7311
7474
|
if (typeof key === "string" || typeof key === "number" || typeof key === "symbol") {
|
|
7475
|
+
recordKeys.add(typeof key === "number" ? key.toString() : key);
|
|
7312
7476
|
const result = def.valueType._zod.run({ value: input[key], issues: [] }, ctx);
|
|
7313
7477
|
if (result instanceof Promise) {
|
|
7314
7478
|
proms.push(result.then((result2) => {
|
|
@@ -7327,7 +7491,7 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
|
|
|
7327
7491
|
}
|
|
7328
7492
|
let unrecognized;
|
|
7329
7493
|
for (const key in input) {
|
|
7330
|
-
if (!
|
|
7494
|
+
if (!recordKeys.has(key)) {
|
|
7331
7495
|
unrecognized = unrecognized ?? [];
|
|
7332
7496
|
unrecognized.push(key);
|
|
7333
7497
|
}
|
|
@@ -7350,15 +7514,18 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
|
|
|
7350
7514
|
throw new Error("Async schemas not supported in object keys currently");
|
|
7351
7515
|
}
|
|
7352
7516
|
if (keyResult.issues.length) {
|
|
7353
|
-
|
|
7354
|
-
|
|
7355
|
-
|
|
7356
|
-
|
|
7357
|
-
|
|
7358
|
-
|
|
7359
|
-
|
|
7360
|
-
|
|
7361
|
-
|
|
7517
|
+
if (def.mode === "loose") {
|
|
7518
|
+
payload.value[key] = input[key];
|
|
7519
|
+
} else {
|
|
7520
|
+
payload.issues.push({
|
|
7521
|
+
code: "invalid_key",
|
|
7522
|
+
origin: "record",
|
|
7523
|
+
issues: keyResult.issues.map((iss) => finalizeIssue(iss, ctx, config())),
|
|
7524
|
+
input: key,
|
|
7525
|
+
path: [key],
|
|
7526
|
+
inst
|
|
7527
|
+
});
|
|
7528
|
+
}
|
|
7362
7529
|
continue;
|
|
7363
7530
|
}
|
|
7364
7531
|
const result = def.valueType._zod.run({ value: input[key], issues: [] }, ctx);
|
|
@@ -7408,11 +7575,12 @@ var $ZodLiteral = /* @__PURE__ */ $constructor("$ZodLiteral", (inst, def) => {
|
|
|
7408
7575
|
if (def.values.length === 0) {
|
|
7409
7576
|
throw new Error("Cannot create literal schema with no valid values");
|
|
7410
7577
|
}
|
|
7411
|
-
|
|
7578
|
+
const values = new Set(def.values);
|
|
7579
|
+
inst._zod.values = values;
|
|
7412
7580
|
inst._zod.pattern = new RegExp(`^(${def.values.map((o) => typeof o === "string" ? escapeRegex(o) : o ? escapeRegex(o.toString()) : String(o)).join("|")})$`);
|
|
7413
7581
|
inst._zod.parse = (payload, _ctx) => {
|
|
7414
7582
|
const input = payload.value;
|
|
7415
|
-
if (
|
|
7583
|
+
if (values.has(input)) {
|
|
7416
7584
|
return payload;
|
|
7417
7585
|
}
|
|
7418
7586
|
payload.issues.push({
|
|
@@ -7628,8 +7796,8 @@ var $ZodReadonly = /* @__PURE__ */ $constructor("$ZodReadonly", (inst, def) => {
|
|
|
7628
7796
|
$ZodType.init(inst, def);
|
|
7629
7797
|
defineLazy(inst._zod, "propValues", () => def.innerType._zod.propValues);
|
|
7630
7798
|
defineLazy(inst._zod, "values", () => def.innerType._zod.values);
|
|
7631
|
-
defineLazy(inst._zod, "optin", () => def.innerType
|
|
7632
|
-
defineLazy(inst._zod, "optout", () => def.innerType
|
|
7799
|
+
defineLazy(inst._zod, "optin", () => def.innerType?._zod?.optin);
|
|
7800
|
+
defineLazy(inst._zod, "optout", () => def.innerType?._zod?.optout);
|
|
7633
7801
|
inst._zod.parse = (payload, ctx) => {
|
|
7634
7802
|
if (ctx.direction === "backward") {
|
|
7635
7803
|
return def.innerType._zod.run(payload, ctx);
|
|
@@ -7686,21 +7854,20 @@ function handleRefineResult(result, payload, input, inst) {
|
|
|
7686
7854
|
}
|
|
7687
7855
|
|
|
7688
7856
|
// node_modules/zod/v4/core/registries.js
|
|
7689
|
-
var
|
|
7690
|
-
var $input = Symbol("ZodInput");
|
|
7857
|
+
var _a;
|
|
7691
7858
|
var $ZodRegistry = class {
|
|
7692
7859
|
constructor() {
|
|
7693
7860
|
this._map = /* @__PURE__ */ new WeakMap();
|
|
7694
7861
|
this._idmap = /* @__PURE__ */ new Map();
|
|
7695
7862
|
}
|
|
7696
7863
|
add(schema, ..._meta) {
|
|
7697
|
-
const
|
|
7698
|
-
this._map.set(schema,
|
|
7699
|
-
if (
|
|
7700
|
-
if (this._idmap.has(
|
|
7701
|
-
throw new Error(`ID ${
|
|
7864
|
+
const meta2 = _meta[0];
|
|
7865
|
+
this._map.set(schema, meta2);
|
|
7866
|
+
if (meta2 && typeof meta2 === "object" && "id" in meta2) {
|
|
7867
|
+
if (this._idmap.has(meta2.id)) {
|
|
7868
|
+
throw new Error(`ID ${meta2.id} already exists in the registry`);
|
|
7702
7869
|
}
|
|
7703
|
-
this._idmap.set(
|
|
7870
|
+
this._idmap.set(meta2.id, schema);
|
|
7704
7871
|
}
|
|
7705
7872
|
return this;
|
|
7706
7873
|
}
|
|
@@ -7710,9 +7877,9 @@ var $ZodRegistry = class {
|
|
|
7710
7877
|
return this;
|
|
7711
7878
|
}
|
|
7712
7879
|
remove(schema) {
|
|
7713
|
-
const
|
|
7714
|
-
if (
|
|
7715
|
-
this._idmap.delete(
|
|
7880
|
+
const meta2 = this._map.get(schema);
|
|
7881
|
+
if (meta2 && typeof meta2 === "object" && "id" in meta2) {
|
|
7882
|
+
this._idmap.delete(meta2.id);
|
|
7716
7883
|
}
|
|
7717
7884
|
this._map.delete(schema);
|
|
7718
7885
|
return this;
|
|
@@ -7734,7 +7901,8 @@ var $ZodRegistry = class {
|
|
|
7734
7901
|
function registry() {
|
|
7735
7902
|
return new $ZodRegistry();
|
|
7736
7903
|
}
|
|
7737
|
-
|
|
7904
|
+
(_a = globalThis).__zod_globalRegistry ?? (_a.__zod_globalRegistry = registry());
|
|
7905
|
+
var globalRegistry = globalThis.__zod_globalRegistry;
|
|
7738
7906
|
|
|
7739
7907
|
// node_modules/zod/v4/core/api.js
|
|
7740
7908
|
function _string(Class2, params) {
|
|
@@ -8125,6 +8293,9 @@ function _toLowerCase() {
|
|
|
8125
8293
|
function _toUpperCase() {
|
|
8126
8294
|
return _overwrite((input) => input.toUpperCase());
|
|
8127
8295
|
}
|
|
8296
|
+
function _slugify() {
|
|
8297
|
+
return _overwrite((input) => slugify(input));
|
|
8298
|
+
}
|
|
8128
8299
|
function _array(Class2, element, params) {
|
|
8129
8300
|
return new Class2({
|
|
8130
8301
|
type: "array",
|
|
@@ -8173,6 +8344,701 @@ function _check(fn, params) {
|
|
|
8173
8344
|
return ch;
|
|
8174
8345
|
}
|
|
8175
8346
|
|
|
8347
|
+
// node_modules/zod/v4/core/to-json-schema.js
|
|
8348
|
+
function initializeContext(params) {
|
|
8349
|
+
let target = params?.target ?? "draft-2020-12";
|
|
8350
|
+
if (target === "draft-4")
|
|
8351
|
+
target = "draft-04";
|
|
8352
|
+
if (target === "draft-7")
|
|
8353
|
+
target = "draft-07";
|
|
8354
|
+
return {
|
|
8355
|
+
processors: params.processors ?? {},
|
|
8356
|
+
metadataRegistry: params?.metadata ?? globalRegistry,
|
|
8357
|
+
target,
|
|
8358
|
+
unrepresentable: params?.unrepresentable ?? "throw",
|
|
8359
|
+
override: params?.override ?? (() => {
|
|
8360
|
+
}),
|
|
8361
|
+
io: params?.io ?? "output",
|
|
8362
|
+
counter: 0,
|
|
8363
|
+
seen: /* @__PURE__ */ new Map(),
|
|
8364
|
+
cycles: params?.cycles ?? "ref",
|
|
8365
|
+
reused: params?.reused ?? "inline",
|
|
8366
|
+
external: params?.external ?? void 0
|
|
8367
|
+
};
|
|
8368
|
+
}
|
|
8369
|
+
function process2(schema, ctx, _params = { path: [], schemaPath: [] }) {
|
|
8370
|
+
var _a2;
|
|
8371
|
+
const def = schema._zod.def;
|
|
8372
|
+
const seen = ctx.seen.get(schema);
|
|
8373
|
+
if (seen) {
|
|
8374
|
+
seen.count++;
|
|
8375
|
+
const isCycle = _params.schemaPath.includes(schema);
|
|
8376
|
+
if (isCycle) {
|
|
8377
|
+
seen.cycle = _params.path;
|
|
8378
|
+
}
|
|
8379
|
+
return seen.schema;
|
|
8380
|
+
}
|
|
8381
|
+
const result = { schema: {}, count: 1, cycle: void 0, path: _params.path };
|
|
8382
|
+
ctx.seen.set(schema, result);
|
|
8383
|
+
const overrideSchema = schema._zod.toJSONSchema?.();
|
|
8384
|
+
if (overrideSchema) {
|
|
8385
|
+
result.schema = overrideSchema;
|
|
8386
|
+
} else {
|
|
8387
|
+
const params = {
|
|
8388
|
+
..._params,
|
|
8389
|
+
schemaPath: [..._params.schemaPath, schema],
|
|
8390
|
+
path: _params.path
|
|
8391
|
+
};
|
|
8392
|
+
const parent = schema._zod.parent;
|
|
8393
|
+
if (parent) {
|
|
8394
|
+
result.ref = parent;
|
|
8395
|
+
process2(parent, ctx, params);
|
|
8396
|
+
ctx.seen.get(parent).isParent = true;
|
|
8397
|
+
} else if (schema._zod.processJSONSchema) {
|
|
8398
|
+
schema._zod.processJSONSchema(ctx, result.schema, params);
|
|
8399
|
+
} else {
|
|
8400
|
+
const _json = result.schema;
|
|
8401
|
+
const processor = ctx.processors[def.type];
|
|
8402
|
+
if (!processor) {
|
|
8403
|
+
throw new Error(`[toJSONSchema]: Non-representable type encountered: ${def.type}`);
|
|
8404
|
+
}
|
|
8405
|
+
processor(schema, ctx, _json, params);
|
|
8406
|
+
}
|
|
8407
|
+
}
|
|
8408
|
+
const meta2 = ctx.metadataRegistry.get(schema);
|
|
8409
|
+
if (meta2)
|
|
8410
|
+
Object.assign(result.schema, meta2);
|
|
8411
|
+
if (ctx.io === "input" && isTransforming(schema)) {
|
|
8412
|
+
delete result.schema.examples;
|
|
8413
|
+
delete result.schema.default;
|
|
8414
|
+
}
|
|
8415
|
+
if (ctx.io === "input" && result.schema._prefault)
|
|
8416
|
+
(_a2 = result.schema).default ?? (_a2.default = result.schema._prefault);
|
|
8417
|
+
delete result.schema._prefault;
|
|
8418
|
+
const _result = ctx.seen.get(schema);
|
|
8419
|
+
return _result.schema;
|
|
8420
|
+
}
|
|
8421
|
+
function extractDefs(ctx, schema) {
|
|
8422
|
+
const root = ctx.seen.get(schema);
|
|
8423
|
+
if (!root)
|
|
8424
|
+
throw new Error("Unprocessed schema. This is a bug in Zod.");
|
|
8425
|
+
const makeURI = (entry) => {
|
|
8426
|
+
const defsSegment = ctx.target === "draft-2020-12" ? "$defs" : "definitions";
|
|
8427
|
+
if (ctx.external) {
|
|
8428
|
+
const externalId = ctx.external.registry.get(entry[0])?.id;
|
|
8429
|
+
const uriGenerator = ctx.external.uri ?? ((id2) => id2);
|
|
8430
|
+
if (externalId) {
|
|
8431
|
+
return { ref: uriGenerator(externalId) };
|
|
8432
|
+
}
|
|
8433
|
+
const id = entry[1].defId ?? entry[1].schema.id ?? `schema${ctx.counter++}`;
|
|
8434
|
+
entry[1].defId = id;
|
|
8435
|
+
return { defId: id, ref: `${uriGenerator("__shared")}#/${defsSegment}/${id}` };
|
|
8436
|
+
}
|
|
8437
|
+
if (entry[1] === root) {
|
|
8438
|
+
return { ref: "#" };
|
|
8439
|
+
}
|
|
8440
|
+
const uriPrefix = `#`;
|
|
8441
|
+
const defUriPrefix = `${uriPrefix}/${defsSegment}/`;
|
|
8442
|
+
const defId = entry[1].schema.id ?? `__schema${ctx.counter++}`;
|
|
8443
|
+
return { defId, ref: defUriPrefix + defId };
|
|
8444
|
+
};
|
|
8445
|
+
const extractToDef = (entry) => {
|
|
8446
|
+
if (entry[1].schema.$ref) {
|
|
8447
|
+
return;
|
|
8448
|
+
}
|
|
8449
|
+
const seen = entry[1];
|
|
8450
|
+
const { ref, defId } = makeURI(entry);
|
|
8451
|
+
seen.def = { ...seen.schema };
|
|
8452
|
+
if (defId)
|
|
8453
|
+
seen.defId = defId;
|
|
8454
|
+
const schema2 = seen.schema;
|
|
8455
|
+
for (const key in schema2) {
|
|
8456
|
+
delete schema2[key];
|
|
8457
|
+
}
|
|
8458
|
+
schema2.$ref = ref;
|
|
8459
|
+
};
|
|
8460
|
+
if (ctx.cycles === "throw") {
|
|
8461
|
+
for (const entry of ctx.seen.entries()) {
|
|
8462
|
+
const seen = entry[1];
|
|
8463
|
+
if (seen.cycle) {
|
|
8464
|
+
throw new Error(`Cycle detected: #/${seen.cycle?.join("/")}/<root>
|
|
8465
|
+
|
|
8466
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`);
|
|
8467
|
+
}
|
|
8468
|
+
}
|
|
8469
|
+
}
|
|
8470
|
+
for (const entry of ctx.seen.entries()) {
|
|
8471
|
+
const seen = entry[1];
|
|
8472
|
+
if (schema === entry[0]) {
|
|
8473
|
+
extractToDef(entry);
|
|
8474
|
+
continue;
|
|
8475
|
+
}
|
|
8476
|
+
if (ctx.external) {
|
|
8477
|
+
const ext = ctx.external.registry.get(entry[0])?.id;
|
|
8478
|
+
if (schema !== entry[0] && ext) {
|
|
8479
|
+
extractToDef(entry);
|
|
8480
|
+
continue;
|
|
8481
|
+
}
|
|
8482
|
+
}
|
|
8483
|
+
const id = ctx.metadataRegistry.get(entry[0])?.id;
|
|
8484
|
+
if (id) {
|
|
8485
|
+
extractToDef(entry);
|
|
8486
|
+
continue;
|
|
8487
|
+
}
|
|
8488
|
+
if (seen.cycle) {
|
|
8489
|
+
extractToDef(entry);
|
|
8490
|
+
continue;
|
|
8491
|
+
}
|
|
8492
|
+
if (seen.count > 1) {
|
|
8493
|
+
if (ctx.reused === "ref") {
|
|
8494
|
+
extractToDef(entry);
|
|
8495
|
+
continue;
|
|
8496
|
+
}
|
|
8497
|
+
}
|
|
8498
|
+
}
|
|
8499
|
+
}
|
|
8500
|
+
function finalize(ctx, schema) {
|
|
8501
|
+
const root = ctx.seen.get(schema);
|
|
8502
|
+
if (!root)
|
|
8503
|
+
throw new Error("Unprocessed schema. This is a bug in Zod.");
|
|
8504
|
+
const flattenRef = (zodSchema) => {
|
|
8505
|
+
const seen = ctx.seen.get(zodSchema);
|
|
8506
|
+
const schema2 = seen.def ?? seen.schema;
|
|
8507
|
+
const _cached = { ...schema2 };
|
|
8508
|
+
if (seen.ref === null) {
|
|
8509
|
+
return;
|
|
8510
|
+
}
|
|
8511
|
+
const ref = seen.ref;
|
|
8512
|
+
seen.ref = null;
|
|
8513
|
+
if (ref) {
|
|
8514
|
+
flattenRef(ref);
|
|
8515
|
+
const refSchema = ctx.seen.get(ref).schema;
|
|
8516
|
+
if (refSchema.$ref && (ctx.target === "draft-07" || ctx.target === "draft-04" || ctx.target === "openapi-3.0")) {
|
|
8517
|
+
schema2.allOf = schema2.allOf ?? [];
|
|
8518
|
+
schema2.allOf.push(refSchema);
|
|
8519
|
+
} else {
|
|
8520
|
+
Object.assign(schema2, refSchema);
|
|
8521
|
+
Object.assign(schema2, _cached);
|
|
8522
|
+
}
|
|
8523
|
+
}
|
|
8524
|
+
if (!seen.isParent)
|
|
8525
|
+
ctx.override({
|
|
8526
|
+
zodSchema,
|
|
8527
|
+
jsonSchema: schema2,
|
|
8528
|
+
path: seen.path ?? []
|
|
8529
|
+
});
|
|
8530
|
+
};
|
|
8531
|
+
for (const entry of [...ctx.seen.entries()].reverse()) {
|
|
8532
|
+
flattenRef(entry[0]);
|
|
8533
|
+
}
|
|
8534
|
+
const result = {};
|
|
8535
|
+
if (ctx.target === "draft-2020-12") {
|
|
8536
|
+
result.$schema = "https://json-schema.org/draft/2020-12/schema";
|
|
8537
|
+
} else if (ctx.target === "draft-07") {
|
|
8538
|
+
result.$schema = "http://json-schema.org/draft-07/schema#";
|
|
8539
|
+
} else if (ctx.target === "draft-04") {
|
|
8540
|
+
result.$schema = "http://json-schema.org/draft-04/schema#";
|
|
8541
|
+
} else if (ctx.target === "openapi-3.0") {
|
|
8542
|
+
} else {
|
|
8543
|
+
}
|
|
8544
|
+
if (ctx.external?.uri) {
|
|
8545
|
+
const id = ctx.external.registry.get(schema)?.id;
|
|
8546
|
+
if (!id)
|
|
8547
|
+
throw new Error("Schema is missing an `id` property");
|
|
8548
|
+
result.$id = ctx.external.uri(id);
|
|
8549
|
+
}
|
|
8550
|
+
Object.assign(result, root.def ?? root.schema);
|
|
8551
|
+
const defs = ctx.external?.defs ?? {};
|
|
8552
|
+
for (const entry of ctx.seen.entries()) {
|
|
8553
|
+
const seen = entry[1];
|
|
8554
|
+
if (seen.def && seen.defId) {
|
|
8555
|
+
defs[seen.defId] = seen.def;
|
|
8556
|
+
}
|
|
8557
|
+
}
|
|
8558
|
+
if (ctx.external) {
|
|
8559
|
+
} else {
|
|
8560
|
+
if (Object.keys(defs).length > 0) {
|
|
8561
|
+
if (ctx.target === "draft-2020-12") {
|
|
8562
|
+
result.$defs = defs;
|
|
8563
|
+
} else {
|
|
8564
|
+
result.definitions = defs;
|
|
8565
|
+
}
|
|
8566
|
+
}
|
|
8567
|
+
}
|
|
8568
|
+
try {
|
|
8569
|
+
const finalized = JSON.parse(JSON.stringify(result));
|
|
8570
|
+
Object.defineProperty(finalized, "~standard", {
|
|
8571
|
+
value: {
|
|
8572
|
+
...schema["~standard"],
|
|
8573
|
+
jsonSchema: {
|
|
8574
|
+
input: createStandardJSONSchemaMethod(schema, "input"),
|
|
8575
|
+
output: createStandardJSONSchemaMethod(schema, "output")
|
|
8576
|
+
}
|
|
8577
|
+
},
|
|
8578
|
+
enumerable: false,
|
|
8579
|
+
writable: false
|
|
8580
|
+
});
|
|
8581
|
+
return finalized;
|
|
8582
|
+
} catch (_err) {
|
|
8583
|
+
throw new Error("Error converting schema to JSON.");
|
|
8584
|
+
}
|
|
8585
|
+
}
|
|
8586
|
+
function isTransforming(_schema, _ctx) {
|
|
8587
|
+
const ctx = _ctx ?? { seen: /* @__PURE__ */ new Set() };
|
|
8588
|
+
if (ctx.seen.has(_schema))
|
|
8589
|
+
return false;
|
|
8590
|
+
ctx.seen.add(_schema);
|
|
8591
|
+
const def = _schema._zod.def;
|
|
8592
|
+
if (def.type === "transform")
|
|
8593
|
+
return true;
|
|
8594
|
+
if (def.type === "array")
|
|
8595
|
+
return isTransforming(def.element, ctx);
|
|
8596
|
+
if (def.type === "set")
|
|
8597
|
+
return isTransforming(def.valueType, ctx);
|
|
8598
|
+
if (def.type === "lazy")
|
|
8599
|
+
return isTransforming(def.getter(), ctx);
|
|
8600
|
+
if (def.type === "promise" || def.type === "optional" || def.type === "nonoptional" || def.type === "nullable" || def.type === "readonly" || def.type === "default" || def.type === "prefault") {
|
|
8601
|
+
return isTransforming(def.innerType, ctx);
|
|
8602
|
+
}
|
|
8603
|
+
if (def.type === "intersection") {
|
|
8604
|
+
return isTransforming(def.left, ctx) || isTransforming(def.right, ctx);
|
|
8605
|
+
}
|
|
8606
|
+
if (def.type === "record" || def.type === "map") {
|
|
8607
|
+
return isTransforming(def.keyType, ctx) || isTransforming(def.valueType, ctx);
|
|
8608
|
+
}
|
|
8609
|
+
if (def.type === "pipe") {
|
|
8610
|
+
return isTransforming(def.in, ctx) || isTransforming(def.out, ctx);
|
|
8611
|
+
}
|
|
8612
|
+
if (def.type === "object") {
|
|
8613
|
+
for (const key in def.shape) {
|
|
8614
|
+
if (isTransforming(def.shape[key], ctx))
|
|
8615
|
+
return true;
|
|
8616
|
+
}
|
|
8617
|
+
return false;
|
|
8618
|
+
}
|
|
8619
|
+
if (def.type === "union") {
|
|
8620
|
+
for (const option of def.options) {
|
|
8621
|
+
if (isTransforming(option, ctx))
|
|
8622
|
+
return true;
|
|
8623
|
+
}
|
|
8624
|
+
return false;
|
|
8625
|
+
}
|
|
8626
|
+
if (def.type === "tuple") {
|
|
8627
|
+
for (const item of def.items) {
|
|
8628
|
+
if (isTransforming(item, ctx))
|
|
8629
|
+
return true;
|
|
8630
|
+
}
|
|
8631
|
+
if (def.rest && isTransforming(def.rest, ctx))
|
|
8632
|
+
return true;
|
|
8633
|
+
return false;
|
|
8634
|
+
}
|
|
8635
|
+
return false;
|
|
8636
|
+
}
|
|
8637
|
+
var createToJSONSchemaMethod = (schema, processors = {}) => (params) => {
|
|
8638
|
+
const ctx = initializeContext({ ...params, processors });
|
|
8639
|
+
process2(schema, ctx);
|
|
8640
|
+
extractDefs(ctx, schema);
|
|
8641
|
+
return finalize(ctx, schema);
|
|
8642
|
+
};
|
|
8643
|
+
var createStandardJSONSchemaMethod = (schema, io) => (params) => {
|
|
8644
|
+
const { libraryOptions, target } = params ?? {};
|
|
8645
|
+
const ctx = initializeContext({ ...libraryOptions ?? {}, target, io, processors: {} });
|
|
8646
|
+
process2(schema, ctx);
|
|
8647
|
+
extractDefs(ctx, schema);
|
|
8648
|
+
return finalize(ctx, schema);
|
|
8649
|
+
};
|
|
8650
|
+
|
|
8651
|
+
// node_modules/zod/v4/core/json-schema-processors.js
|
|
8652
|
+
var formatMap = {
|
|
8653
|
+
guid: "uuid",
|
|
8654
|
+
url: "uri",
|
|
8655
|
+
datetime: "date-time",
|
|
8656
|
+
json_string: "json-string",
|
|
8657
|
+
regex: ""
|
|
8658
|
+
// do not set
|
|
8659
|
+
};
|
|
8660
|
+
var stringProcessor = (schema, ctx, _json, _params) => {
|
|
8661
|
+
const json = _json;
|
|
8662
|
+
json.type = "string";
|
|
8663
|
+
const { minimum, maximum, format, patterns, contentEncoding } = schema._zod.bag;
|
|
8664
|
+
if (typeof minimum === "number")
|
|
8665
|
+
json.minLength = minimum;
|
|
8666
|
+
if (typeof maximum === "number")
|
|
8667
|
+
json.maxLength = maximum;
|
|
8668
|
+
if (format) {
|
|
8669
|
+
json.format = formatMap[format] ?? format;
|
|
8670
|
+
if (json.format === "")
|
|
8671
|
+
delete json.format;
|
|
8672
|
+
}
|
|
8673
|
+
if (contentEncoding)
|
|
8674
|
+
json.contentEncoding = contentEncoding;
|
|
8675
|
+
if (patterns && patterns.size > 0) {
|
|
8676
|
+
const regexes = [...patterns];
|
|
8677
|
+
if (regexes.length === 1)
|
|
8678
|
+
json.pattern = regexes[0].source;
|
|
8679
|
+
else if (regexes.length > 1) {
|
|
8680
|
+
json.allOf = [
|
|
8681
|
+
...regexes.map((regex) => ({
|
|
8682
|
+
...ctx.target === "draft-07" || ctx.target === "draft-04" || ctx.target === "openapi-3.0" ? { type: "string" } : {},
|
|
8683
|
+
pattern: regex.source
|
|
8684
|
+
}))
|
|
8685
|
+
];
|
|
8686
|
+
}
|
|
8687
|
+
}
|
|
8688
|
+
};
|
|
8689
|
+
var numberProcessor = (schema, ctx, _json, _params) => {
|
|
8690
|
+
const json = _json;
|
|
8691
|
+
const { minimum, maximum, format, multipleOf, exclusiveMaximum, exclusiveMinimum } = schema._zod.bag;
|
|
8692
|
+
if (typeof format === "string" && format.includes("int"))
|
|
8693
|
+
json.type = "integer";
|
|
8694
|
+
else
|
|
8695
|
+
json.type = "number";
|
|
8696
|
+
if (typeof exclusiveMinimum === "number") {
|
|
8697
|
+
if (ctx.target === "draft-04" || ctx.target === "openapi-3.0") {
|
|
8698
|
+
json.minimum = exclusiveMinimum;
|
|
8699
|
+
json.exclusiveMinimum = true;
|
|
8700
|
+
} else {
|
|
8701
|
+
json.exclusiveMinimum = exclusiveMinimum;
|
|
8702
|
+
}
|
|
8703
|
+
}
|
|
8704
|
+
if (typeof minimum === "number") {
|
|
8705
|
+
json.minimum = minimum;
|
|
8706
|
+
if (typeof exclusiveMinimum === "number" && ctx.target !== "draft-04") {
|
|
8707
|
+
if (exclusiveMinimum >= minimum)
|
|
8708
|
+
delete json.minimum;
|
|
8709
|
+
else
|
|
8710
|
+
delete json.exclusiveMinimum;
|
|
8711
|
+
}
|
|
8712
|
+
}
|
|
8713
|
+
if (typeof exclusiveMaximum === "number") {
|
|
8714
|
+
if (ctx.target === "draft-04" || ctx.target === "openapi-3.0") {
|
|
8715
|
+
json.maximum = exclusiveMaximum;
|
|
8716
|
+
json.exclusiveMaximum = true;
|
|
8717
|
+
} else {
|
|
8718
|
+
json.exclusiveMaximum = exclusiveMaximum;
|
|
8719
|
+
}
|
|
8720
|
+
}
|
|
8721
|
+
if (typeof maximum === "number") {
|
|
8722
|
+
json.maximum = maximum;
|
|
8723
|
+
if (typeof exclusiveMaximum === "number" && ctx.target !== "draft-04") {
|
|
8724
|
+
if (exclusiveMaximum <= maximum)
|
|
8725
|
+
delete json.maximum;
|
|
8726
|
+
else
|
|
8727
|
+
delete json.exclusiveMaximum;
|
|
8728
|
+
}
|
|
8729
|
+
}
|
|
8730
|
+
if (typeof multipleOf === "number")
|
|
8731
|
+
json.multipleOf = multipleOf;
|
|
8732
|
+
};
|
|
8733
|
+
var booleanProcessor = (_schema, _ctx, json, _params) => {
|
|
8734
|
+
json.type = "boolean";
|
|
8735
|
+
};
|
|
8736
|
+
var bigintProcessor = (_schema, ctx, _json, _params) => {
|
|
8737
|
+
if (ctx.unrepresentable === "throw") {
|
|
8738
|
+
throw new Error("BigInt cannot be represented in JSON Schema");
|
|
8739
|
+
}
|
|
8740
|
+
};
|
|
8741
|
+
var symbolProcessor = (_schema, ctx, _json, _params) => {
|
|
8742
|
+
if (ctx.unrepresentable === "throw") {
|
|
8743
|
+
throw new Error("Symbols cannot be represented in JSON Schema");
|
|
8744
|
+
}
|
|
8745
|
+
};
|
|
8746
|
+
var nullProcessor = (_schema, ctx, json, _params) => {
|
|
8747
|
+
if (ctx.target === "openapi-3.0") {
|
|
8748
|
+
json.type = "string";
|
|
8749
|
+
json.nullable = true;
|
|
8750
|
+
json.enum = [null];
|
|
8751
|
+
} else {
|
|
8752
|
+
json.type = "null";
|
|
8753
|
+
}
|
|
8754
|
+
};
|
|
8755
|
+
var undefinedProcessor = (_schema, ctx, _json, _params) => {
|
|
8756
|
+
if (ctx.unrepresentable === "throw") {
|
|
8757
|
+
throw new Error("Undefined cannot be represented in JSON Schema");
|
|
8758
|
+
}
|
|
8759
|
+
};
|
|
8760
|
+
var voidProcessor = (_schema, ctx, _json, _params) => {
|
|
8761
|
+
if (ctx.unrepresentable === "throw") {
|
|
8762
|
+
throw new Error("Void cannot be represented in JSON Schema");
|
|
8763
|
+
}
|
|
8764
|
+
};
|
|
8765
|
+
var neverProcessor = (_schema, _ctx, json, _params) => {
|
|
8766
|
+
json.not = {};
|
|
8767
|
+
};
|
|
8768
|
+
var anyProcessor = (_schema, _ctx, _json, _params) => {
|
|
8769
|
+
};
|
|
8770
|
+
var unknownProcessor = (_schema, _ctx, _json, _params) => {
|
|
8771
|
+
};
|
|
8772
|
+
var dateProcessor = (_schema, ctx, _json, _params) => {
|
|
8773
|
+
if (ctx.unrepresentable === "throw") {
|
|
8774
|
+
throw new Error("Date cannot be represented in JSON Schema");
|
|
8775
|
+
}
|
|
8776
|
+
};
|
|
8777
|
+
var enumProcessor = (schema, _ctx, json, _params) => {
|
|
8778
|
+
const def = schema._zod.def;
|
|
8779
|
+
const values = getEnumValues(def.entries);
|
|
8780
|
+
if (values.every((v) => typeof v === "number"))
|
|
8781
|
+
json.type = "number";
|
|
8782
|
+
if (values.every((v) => typeof v === "string"))
|
|
8783
|
+
json.type = "string";
|
|
8784
|
+
json.enum = values;
|
|
8785
|
+
};
|
|
8786
|
+
var literalProcessor = (schema, ctx, json, _params) => {
|
|
8787
|
+
const def = schema._zod.def;
|
|
8788
|
+
const vals = [];
|
|
8789
|
+
for (const val of def.values) {
|
|
8790
|
+
if (val === void 0) {
|
|
8791
|
+
if (ctx.unrepresentable === "throw") {
|
|
8792
|
+
throw new Error("Literal `undefined` cannot be represented in JSON Schema");
|
|
8793
|
+
} else {
|
|
8794
|
+
}
|
|
8795
|
+
} else if (typeof val === "bigint") {
|
|
8796
|
+
if (ctx.unrepresentable === "throw") {
|
|
8797
|
+
throw new Error("BigInt literals cannot be represented in JSON Schema");
|
|
8798
|
+
} else {
|
|
8799
|
+
vals.push(Number(val));
|
|
8800
|
+
}
|
|
8801
|
+
} else {
|
|
8802
|
+
vals.push(val);
|
|
8803
|
+
}
|
|
8804
|
+
}
|
|
8805
|
+
if (vals.length === 0) {
|
|
8806
|
+
} else if (vals.length === 1) {
|
|
8807
|
+
const val = vals[0];
|
|
8808
|
+
json.type = val === null ? "null" : typeof val;
|
|
8809
|
+
if (ctx.target === "draft-04" || ctx.target === "openapi-3.0") {
|
|
8810
|
+
json.enum = [val];
|
|
8811
|
+
} else {
|
|
8812
|
+
json.const = val;
|
|
8813
|
+
}
|
|
8814
|
+
} else {
|
|
8815
|
+
if (vals.every((v) => typeof v === "number"))
|
|
8816
|
+
json.type = "number";
|
|
8817
|
+
if (vals.every((v) => typeof v === "string"))
|
|
8818
|
+
json.type = "string";
|
|
8819
|
+
if (vals.every((v) => typeof v === "boolean"))
|
|
8820
|
+
json.type = "boolean";
|
|
8821
|
+
if (vals.every((v) => v === null))
|
|
8822
|
+
json.type = "null";
|
|
8823
|
+
json.enum = vals;
|
|
8824
|
+
}
|
|
8825
|
+
};
|
|
8826
|
+
var customProcessor = (_schema, ctx, _json, _params) => {
|
|
8827
|
+
if (ctx.unrepresentable === "throw") {
|
|
8828
|
+
throw new Error("Custom types cannot be represented in JSON Schema");
|
|
8829
|
+
}
|
|
8830
|
+
};
|
|
8831
|
+
var transformProcessor = (_schema, ctx, _json, _params) => {
|
|
8832
|
+
if (ctx.unrepresentable === "throw") {
|
|
8833
|
+
throw new Error("Transforms cannot be represented in JSON Schema");
|
|
8834
|
+
}
|
|
8835
|
+
};
|
|
8836
|
+
var arrayProcessor = (schema, ctx, _json, params) => {
|
|
8837
|
+
const json = _json;
|
|
8838
|
+
const def = schema._zod.def;
|
|
8839
|
+
const { minimum, maximum } = schema._zod.bag;
|
|
8840
|
+
if (typeof minimum === "number")
|
|
8841
|
+
json.minItems = minimum;
|
|
8842
|
+
if (typeof maximum === "number")
|
|
8843
|
+
json.maxItems = maximum;
|
|
8844
|
+
json.type = "array";
|
|
8845
|
+
json.items = process2(def.element, ctx, { ...params, path: [...params.path, "items"] });
|
|
8846
|
+
};
|
|
8847
|
+
var objectProcessor = (schema, ctx, _json, params) => {
|
|
8848
|
+
const json = _json;
|
|
8849
|
+
const def = schema._zod.def;
|
|
8850
|
+
json.type = "object";
|
|
8851
|
+
json.properties = {};
|
|
8852
|
+
const shape = def.shape;
|
|
8853
|
+
for (const key in shape) {
|
|
8854
|
+
json.properties[key] = process2(shape[key], ctx, {
|
|
8855
|
+
...params,
|
|
8856
|
+
path: [...params.path, "properties", key]
|
|
8857
|
+
});
|
|
8858
|
+
}
|
|
8859
|
+
const allKeys = new Set(Object.keys(shape));
|
|
8860
|
+
const requiredKeys = new Set([...allKeys].filter((key) => {
|
|
8861
|
+
const v = def.shape[key]._zod;
|
|
8862
|
+
if (ctx.io === "input") {
|
|
8863
|
+
return v.optin === void 0;
|
|
8864
|
+
} else {
|
|
8865
|
+
return v.optout === void 0;
|
|
8866
|
+
}
|
|
8867
|
+
}));
|
|
8868
|
+
if (requiredKeys.size > 0) {
|
|
8869
|
+
json.required = Array.from(requiredKeys);
|
|
8870
|
+
}
|
|
8871
|
+
if (def.catchall?._zod.def.type === "never") {
|
|
8872
|
+
json.additionalProperties = false;
|
|
8873
|
+
} else if (!def.catchall) {
|
|
8874
|
+
if (ctx.io === "output")
|
|
8875
|
+
json.additionalProperties = false;
|
|
8876
|
+
} else if (def.catchall) {
|
|
8877
|
+
json.additionalProperties = process2(def.catchall, ctx, {
|
|
8878
|
+
...params,
|
|
8879
|
+
path: [...params.path, "additionalProperties"]
|
|
8880
|
+
});
|
|
8881
|
+
}
|
|
8882
|
+
};
|
|
8883
|
+
var unionProcessor = (schema, ctx, json, params) => {
|
|
8884
|
+
const def = schema._zod.def;
|
|
8885
|
+
const isExclusive = def.inclusive === false;
|
|
8886
|
+
const options = def.options.map((x, i) => process2(x, ctx, {
|
|
8887
|
+
...params,
|
|
8888
|
+
path: [...params.path, isExclusive ? "oneOf" : "anyOf", i]
|
|
8889
|
+
}));
|
|
8890
|
+
if (isExclusive) {
|
|
8891
|
+
json.oneOf = options;
|
|
8892
|
+
} else {
|
|
8893
|
+
json.anyOf = options;
|
|
8894
|
+
}
|
|
8895
|
+
};
|
|
8896
|
+
var intersectionProcessor = (schema, ctx, json, params) => {
|
|
8897
|
+
const def = schema._zod.def;
|
|
8898
|
+
const a = process2(def.left, ctx, {
|
|
8899
|
+
...params,
|
|
8900
|
+
path: [...params.path, "allOf", 0]
|
|
8901
|
+
});
|
|
8902
|
+
const b = process2(def.right, ctx, {
|
|
8903
|
+
...params,
|
|
8904
|
+
path: [...params.path, "allOf", 1]
|
|
8905
|
+
});
|
|
8906
|
+
const isSimpleIntersection = (val) => "allOf" in val && Object.keys(val).length === 1;
|
|
8907
|
+
const allOf = [
|
|
8908
|
+
...isSimpleIntersection(a) ? a.allOf : [a],
|
|
8909
|
+
...isSimpleIntersection(b) ? b.allOf : [b]
|
|
8910
|
+
];
|
|
8911
|
+
json.allOf = allOf;
|
|
8912
|
+
};
|
|
8913
|
+
var tupleProcessor = (schema, ctx, _json, params) => {
|
|
8914
|
+
const json = _json;
|
|
8915
|
+
const def = schema._zod.def;
|
|
8916
|
+
json.type = "array";
|
|
8917
|
+
const prefixPath = ctx.target === "draft-2020-12" ? "prefixItems" : "items";
|
|
8918
|
+
const restPath = ctx.target === "draft-2020-12" ? "items" : ctx.target === "openapi-3.0" ? "items" : "additionalItems";
|
|
8919
|
+
const prefixItems = def.items.map((x, i) => process2(x, ctx, {
|
|
8920
|
+
...params,
|
|
8921
|
+
path: [...params.path, prefixPath, i]
|
|
8922
|
+
}));
|
|
8923
|
+
const rest = def.rest ? process2(def.rest, ctx, {
|
|
8924
|
+
...params,
|
|
8925
|
+
path: [...params.path, restPath, ...ctx.target === "openapi-3.0" ? [def.items.length] : []]
|
|
8926
|
+
}) : null;
|
|
8927
|
+
if (ctx.target === "draft-2020-12") {
|
|
8928
|
+
json.prefixItems = prefixItems;
|
|
8929
|
+
if (rest) {
|
|
8930
|
+
json.items = rest;
|
|
8931
|
+
}
|
|
8932
|
+
} else if (ctx.target === "openapi-3.0") {
|
|
8933
|
+
json.items = {
|
|
8934
|
+
anyOf: prefixItems
|
|
8935
|
+
};
|
|
8936
|
+
if (rest) {
|
|
8937
|
+
json.items.anyOf.push(rest);
|
|
8938
|
+
}
|
|
8939
|
+
json.minItems = prefixItems.length;
|
|
8940
|
+
if (!rest) {
|
|
8941
|
+
json.maxItems = prefixItems.length;
|
|
8942
|
+
}
|
|
8943
|
+
} else {
|
|
8944
|
+
json.items = prefixItems;
|
|
8945
|
+
if (rest) {
|
|
8946
|
+
json.additionalItems = rest;
|
|
8947
|
+
}
|
|
8948
|
+
}
|
|
8949
|
+
const { minimum, maximum } = schema._zod.bag;
|
|
8950
|
+
if (typeof minimum === "number")
|
|
8951
|
+
json.minItems = minimum;
|
|
8952
|
+
if (typeof maximum === "number")
|
|
8953
|
+
json.maxItems = maximum;
|
|
8954
|
+
};
|
|
8955
|
+
var recordProcessor = (schema, ctx, _json, params) => {
|
|
8956
|
+
const json = _json;
|
|
8957
|
+
const def = schema._zod.def;
|
|
8958
|
+
json.type = "object";
|
|
8959
|
+
if (ctx.target === "draft-07" || ctx.target === "draft-2020-12") {
|
|
8960
|
+
json.propertyNames = process2(def.keyType, ctx, {
|
|
8961
|
+
...params,
|
|
8962
|
+
path: [...params.path, "propertyNames"]
|
|
8963
|
+
});
|
|
8964
|
+
}
|
|
8965
|
+
json.additionalProperties = process2(def.valueType, ctx, {
|
|
8966
|
+
...params,
|
|
8967
|
+
path: [...params.path, "additionalProperties"]
|
|
8968
|
+
});
|
|
8969
|
+
};
|
|
8970
|
+
var nullableProcessor = (schema, ctx, json, params) => {
|
|
8971
|
+
const def = schema._zod.def;
|
|
8972
|
+
const inner = process2(def.innerType, ctx, params);
|
|
8973
|
+
const seen = ctx.seen.get(schema);
|
|
8974
|
+
if (ctx.target === "openapi-3.0") {
|
|
8975
|
+
seen.ref = def.innerType;
|
|
8976
|
+
json.nullable = true;
|
|
8977
|
+
} else {
|
|
8978
|
+
json.anyOf = [inner, { type: "null" }];
|
|
8979
|
+
}
|
|
8980
|
+
};
|
|
8981
|
+
var nonoptionalProcessor = (schema, ctx, _json, params) => {
|
|
8982
|
+
const def = schema._zod.def;
|
|
8983
|
+
process2(def.innerType, ctx, params);
|
|
8984
|
+
const seen = ctx.seen.get(schema);
|
|
8985
|
+
seen.ref = def.innerType;
|
|
8986
|
+
};
|
|
8987
|
+
var defaultProcessor = (schema, ctx, json, params) => {
|
|
8988
|
+
const def = schema._zod.def;
|
|
8989
|
+
process2(def.innerType, ctx, params);
|
|
8990
|
+
const seen = ctx.seen.get(schema);
|
|
8991
|
+
seen.ref = def.innerType;
|
|
8992
|
+
json.default = JSON.parse(JSON.stringify(def.defaultValue));
|
|
8993
|
+
};
|
|
8994
|
+
var prefaultProcessor = (schema, ctx, json, params) => {
|
|
8995
|
+
const def = schema._zod.def;
|
|
8996
|
+
process2(def.innerType, ctx, params);
|
|
8997
|
+
const seen = ctx.seen.get(schema);
|
|
8998
|
+
seen.ref = def.innerType;
|
|
8999
|
+
if (ctx.io === "input")
|
|
9000
|
+
json._prefault = JSON.parse(JSON.stringify(def.defaultValue));
|
|
9001
|
+
};
|
|
9002
|
+
var catchProcessor = (schema, ctx, json, params) => {
|
|
9003
|
+
const def = schema._zod.def;
|
|
9004
|
+
process2(def.innerType, ctx, params);
|
|
9005
|
+
const seen = ctx.seen.get(schema);
|
|
9006
|
+
seen.ref = def.innerType;
|
|
9007
|
+
let catchValue;
|
|
9008
|
+
try {
|
|
9009
|
+
catchValue = def.catchValue(void 0);
|
|
9010
|
+
} catch {
|
|
9011
|
+
throw new Error("Dynamic catch values are not supported in JSON Schema");
|
|
9012
|
+
}
|
|
9013
|
+
json.default = catchValue;
|
|
9014
|
+
};
|
|
9015
|
+
var pipeProcessor = (schema, ctx, _json, params) => {
|
|
9016
|
+
const def = schema._zod.def;
|
|
9017
|
+
const innerType = ctx.io === "input" ? def.in._zod.def.type === "transform" ? def.out : def.in : def.out;
|
|
9018
|
+
process2(innerType, ctx, params);
|
|
9019
|
+
const seen = ctx.seen.get(schema);
|
|
9020
|
+
seen.ref = innerType;
|
|
9021
|
+
};
|
|
9022
|
+
var readonlyProcessor = (schema, ctx, json, params) => {
|
|
9023
|
+
const def = schema._zod.def;
|
|
9024
|
+
process2(def.innerType, ctx, params);
|
|
9025
|
+
const seen = ctx.seen.get(schema);
|
|
9026
|
+
seen.ref = def.innerType;
|
|
9027
|
+
json.readOnly = true;
|
|
9028
|
+
};
|
|
9029
|
+
var promiseProcessor = (schema, ctx, _json, params) => {
|
|
9030
|
+
const def = schema._zod.def;
|
|
9031
|
+
process2(def.innerType, ctx, params);
|
|
9032
|
+
const seen = ctx.seen.get(schema);
|
|
9033
|
+
seen.ref = def.innerType;
|
|
9034
|
+
};
|
|
9035
|
+
var optionalProcessor = (schema, ctx, _json, params) => {
|
|
9036
|
+
const def = schema._zod.def;
|
|
9037
|
+
process2(def.innerType, ctx, params);
|
|
9038
|
+
const seen = ctx.seen.get(schema);
|
|
9039
|
+
seen.ref = def.innerType;
|
|
9040
|
+
};
|
|
9041
|
+
|
|
8176
9042
|
// node_modules/zod/v4/classic/iso.js
|
|
8177
9043
|
var ZodISODateTime = /* @__PURE__ */ $constructor("ZodISODateTime", (inst, def) => {
|
|
8178
9044
|
$ZodISODateTime.init(inst, def);
|
|
@@ -8260,25 +9126,28 @@ var safeDecodeAsync = /* @__PURE__ */ _safeDecodeAsync(ZodRealError);
|
|
|
8260
9126
|
// node_modules/zod/v4/classic/schemas.js
|
|
8261
9127
|
var ZodType = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
|
|
8262
9128
|
$ZodType.init(inst, def);
|
|
9129
|
+
Object.assign(inst["~standard"], {
|
|
9130
|
+
jsonSchema: {
|
|
9131
|
+
input: createStandardJSONSchemaMethod(inst, "input"),
|
|
9132
|
+
output: createStandardJSONSchemaMethod(inst, "output")
|
|
9133
|
+
}
|
|
9134
|
+
});
|
|
9135
|
+
inst.toJSONSchema = createToJSONSchemaMethod(inst, {});
|
|
8263
9136
|
inst.def = def;
|
|
8264
9137
|
inst.type = def.type;
|
|
8265
9138
|
Object.defineProperty(inst, "_def", { value: def });
|
|
8266
9139
|
inst.check = (...checks) => {
|
|
8267
|
-
return inst.clone(
|
|
8268
|
-
|
|
8269
|
-
...def,
|
|
8270
|
-
checks: [
|
|
8271
|
-
|
|
8272
|
-
|
|
8273
|
-
]
|
|
8274
|
-
}
|
|
8275
|
-
// { parent: true }
|
|
8276
|
-
);
|
|
9140
|
+
return inst.clone(util_exports.mergeDefs(def, {
|
|
9141
|
+
checks: [
|
|
9142
|
+
...def.checks ?? [],
|
|
9143
|
+
...checks.map((ch) => typeof ch === "function" ? { _zod: { check: ch, def: { check: "custom" }, onattach: [] } } : ch)
|
|
9144
|
+
]
|
|
9145
|
+
}));
|
|
8277
9146
|
};
|
|
8278
9147
|
inst.clone = (def2, params) => clone(inst, def2, params);
|
|
8279
9148
|
inst.brand = () => inst;
|
|
8280
|
-
inst.register = ((reg,
|
|
8281
|
-
reg.add(inst,
|
|
9149
|
+
inst.register = ((reg, meta2) => {
|
|
9150
|
+
reg.add(inst, meta2);
|
|
8282
9151
|
return inst;
|
|
8283
9152
|
});
|
|
8284
9153
|
inst.parse = (data, params) => parse2(inst, data, params, { callee: inst.parse });
|
|
@@ -8336,6 +9205,7 @@ var ZodType = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
|
|
|
8336
9205
|
var _ZodString = /* @__PURE__ */ $constructor("_ZodString", (inst, def) => {
|
|
8337
9206
|
$ZodString.init(inst, def);
|
|
8338
9207
|
ZodType.init(inst, def);
|
|
9208
|
+
inst._zod.processJSONSchema = (ctx, json, params) => stringProcessor(inst, ctx, json, params);
|
|
8339
9209
|
const bag = inst._zod.bag;
|
|
8340
9210
|
inst.format = bag.format ?? null;
|
|
8341
9211
|
inst.minLength = bag.minimum ?? null;
|
|
@@ -8354,6 +9224,7 @@ var _ZodString = /* @__PURE__ */ $constructor("_ZodString", (inst, def) => {
|
|
|
8354
9224
|
inst.normalize = (...args) => inst.check(_normalize(...args));
|
|
8355
9225
|
inst.toLowerCase = () => inst.check(_toLowerCase());
|
|
8356
9226
|
inst.toUpperCase = () => inst.check(_toUpperCase());
|
|
9227
|
+
inst.slugify = () => inst.check(_slugify());
|
|
8357
9228
|
});
|
|
8358
9229
|
var ZodString = /* @__PURE__ */ $constructor("ZodString", (inst, def) => {
|
|
8359
9230
|
$ZodString.init(inst, def);
|
|
@@ -8472,6 +9343,7 @@ var ZodJWT = /* @__PURE__ */ $constructor("ZodJWT", (inst, def) => {
|
|
|
8472
9343
|
var ZodNumber = /* @__PURE__ */ $constructor("ZodNumber", (inst, def) => {
|
|
8473
9344
|
$ZodNumber.init(inst, def);
|
|
8474
9345
|
ZodType.init(inst, def);
|
|
9346
|
+
inst._zod.processJSONSchema = (ctx, json, params) => numberProcessor(inst, ctx, json, params);
|
|
8475
9347
|
inst.gt = (value, params) => inst.check(_gt(value, params));
|
|
8476
9348
|
inst.gte = (value, params) => inst.check(_gte(value, params));
|
|
8477
9349
|
inst.min = (value, params) => inst.check(_gte(value, params));
|
|
@@ -8504,10 +9376,12 @@ function int(params) {
|
|
|
8504
9376
|
var ZodBoolean = /* @__PURE__ */ $constructor("ZodBoolean", (inst, def) => {
|
|
8505
9377
|
$ZodBoolean.init(inst, def);
|
|
8506
9378
|
ZodType.init(inst, def);
|
|
9379
|
+
inst._zod.processJSONSchema = (ctx, json, params) => booleanProcessor(inst, ctx, json, params);
|
|
8507
9380
|
});
|
|
8508
9381
|
var ZodBigInt = /* @__PURE__ */ $constructor("ZodBigInt", (inst, def) => {
|
|
8509
9382
|
$ZodBigInt.init(inst, def);
|
|
8510
9383
|
ZodType.init(inst, def);
|
|
9384
|
+
inst._zod.processJSONSchema = (ctx, json, params) => bigintProcessor(inst, ctx, json, params);
|
|
8511
9385
|
inst.gte = (value, params) => inst.check(_gte(value, params));
|
|
8512
9386
|
inst.min = (value, params) => inst.check(_gte(value, params));
|
|
8513
9387
|
inst.gt = (value, params) => inst.check(_gt(value, params));
|
|
@@ -8529,22 +9403,27 @@ var ZodBigInt = /* @__PURE__ */ $constructor("ZodBigInt", (inst, def) => {
|
|
|
8529
9403
|
var ZodSymbol = /* @__PURE__ */ $constructor("ZodSymbol", (inst, def) => {
|
|
8530
9404
|
$ZodSymbol.init(inst, def);
|
|
8531
9405
|
ZodType.init(inst, def);
|
|
9406
|
+
inst._zod.processJSONSchema = (ctx, json, params) => symbolProcessor(inst, ctx, json, params);
|
|
8532
9407
|
});
|
|
8533
9408
|
var ZodUndefined = /* @__PURE__ */ $constructor("ZodUndefined", (inst, def) => {
|
|
8534
9409
|
$ZodUndefined.init(inst, def);
|
|
8535
9410
|
ZodType.init(inst, def);
|
|
9411
|
+
inst._zod.processJSONSchema = (ctx, json, params) => undefinedProcessor(inst, ctx, json, params);
|
|
8536
9412
|
});
|
|
8537
9413
|
var ZodNull = /* @__PURE__ */ $constructor("ZodNull", (inst, def) => {
|
|
8538
9414
|
$ZodNull.init(inst, def);
|
|
8539
9415
|
ZodType.init(inst, def);
|
|
9416
|
+
inst._zod.processJSONSchema = (ctx, json, params) => nullProcessor(inst, ctx, json, params);
|
|
8540
9417
|
});
|
|
8541
9418
|
var ZodAny = /* @__PURE__ */ $constructor("ZodAny", (inst, def) => {
|
|
8542
9419
|
$ZodAny.init(inst, def);
|
|
8543
9420
|
ZodType.init(inst, def);
|
|
9421
|
+
inst._zod.processJSONSchema = (ctx, json, params) => anyProcessor(inst, ctx, json, params);
|
|
8544
9422
|
});
|
|
8545
9423
|
var ZodUnknown = /* @__PURE__ */ $constructor("ZodUnknown", (inst, def) => {
|
|
8546
9424
|
$ZodUnknown.init(inst, def);
|
|
8547
9425
|
ZodType.init(inst, def);
|
|
9426
|
+
inst._zod.processJSONSchema = (ctx, json, params) => unknownProcessor(inst, ctx, json, params);
|
|
8548
9427
|
});
|
|
8549
9428
|
function unknown() {
|
|
8550
9429
|
return _unknown(ZodUnknown);
|
|
@@ -8552,6 +9431,7 @@ function unknown() {
|
|
|
8552
9431
|
var ZodNever = /* @__PURE__ */ $constructor("ZodNever", (inst, def) => {
|
|
8553
9432
|
$ZodNever.init(inst, def);
|
|
8554
9433
|
ZodType.init(inst, def);
|
|
9434
|
+
inst._zod.processJSONSchema = (ctx, json, params) => neverProcessor(inst, ctx, json, params);
|
|
8555
9435
|
});
|
|
8556
9436
|
function never(params) {
|
|
8557
9437
|
return _never(ZodNever, params);
|
|
@@ -8559,10 +9439,12 @@ function never(params) {
|
|
|
8559
9439
|
var ZodVoid = /* @__PURE__ */ $constructor("ZodVoid", (inst, def) => {
|
|
8560
9440
|
$ZodVoid.init(inst, def);
|
|
8561
9441
|
ZodType.init(inst, def);
|
|
9442
|
+
inst._zod.processJSONSchema = (ctx, json, params) => voidProcessor(inst, ctx, json, params);
|
|
8562
9443
|
});
|
|
8563
9444
|
var ZodDate = /* @__PURE__ */ $constructor("ZodDate", (inst, def) => {
|
|
8564
9445
|
$ZodDate.init(inst, def);
|
|
8565
9446
|
ZodType.init(inst, def);
|
|
9447
|
+
inst._zod.processJSONSchema = (ctx, json, params) => dateProcessor(inst, ctx, json, params);
|
|
8566
9448
|
inst.min = (value, params) => inst.check(_gte(value, params));
|
|
8567
9449
|
inst.max = (value, params) => inst.check(_lte(value, params));
|
|
8568
9450
|
const c = inst._zod.bag;
|
|
@@ -8572,6 +9454,7 @@ var ZodDate = /* @__PURE__ */ $constructor("ZodDate", (inst, def) => {
|
|
|
8572
9454
|
var ZodArray = /* @__PURE__ */ $constructor("ZodArray", (inst, def) => {
|
|
8573
9455
|
$ZodArray.init(inst, def);
|
|
8574
9456
|
ZodType.init(inst, def);
|
|
9457
|
+
inst._zod.processJSONSchema = (ctx, json, params) => arrayProcessor(inst, ctx, json, params);
|
|
8575
9458
|
inst.element = def.element;
|
|
8576
9459
|
inst.min = (minLength, params) => inst.check(_minLength(minLength, params));
|
|
8577
9460
|
inst.nonempty = (params) => inst.check(_minLength(1, params));
|
|
@@ -8585,7 +9468,10 @@ function array(element, params) {
|
|
|
8585
9468
|
var ZodObject = /* @__PURE__ */ $constructor("ZodObject", (inst, def) => {
|
|
8586
9469
|
$ZodObjectJIT.init(inst, def);
|
|
8587
9470
|
ZodType.init(inst, def);
|
|
8588
|
-
|
|
9471
|
+
inst._zod.processJSONSchema = (ctx, json, params) => objectProcessor(inst, ctx, json, params);
|
|
9472
|
+
util_exports.defineLazy(inst, "shape", () => {
|
|
9473
|
+
return def.shape;
|
|
9474
|
+
});
|
|
8589
9475
|
inst.keyof = () => _enum(Object.keys(inst._zod.def.shape));
|
|
8590
9476
|
inst.catchall = (catchall) => inst.clone({ ...inst._zod.def, catchall });
|
|
8591
9477
|
inst.passthrough = () => inst.clone({ ...inst._zod.def, catchall: unknown() });
|
|
@@ -8607,6 +9493,7 @@ var ZodObject = /* @__PURE__ */ $constructor("ZodObject", (inst, def) => {
|
|
|
8607
9493
|
var ZodUnion = /* @__PURE__ */ $constructor("ZodUnion", (inst, def) => {
|
|
8608
9494
|
$ZodUnion.init(inst, def);
|
|
8609
9495
|
ZodType.init(inst, def);
|
|
9496
|
+
inst._zod.processJSONSchema = (ctx, json, params) => unionProcessor(inst, ctx, json, params);
|
|
8610
9497
|
inst.options = def.options;
|
|
8611
9498
|
});
|
|
8612
9499
|
function union(options, params) {
|
|
@@ -8623,6 +9510,7 @@ var ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("ZodDiscriminatedUnion"
|
|
|
8623
9510
|
var ZodIntersection = /* @__PURE__ */ $constructor("ZodIntersection", (inst, def) => {
|
|
8624
9511
|
$ZodIntersection.init(inst, def);
|
|
8625
9512
|
ZodType.init(inst, def);
|
|
9513
|
+
inst._zod.processJSONSchema = (ctx, json, params) => intersectionProcessor(inst, ctx, json, params);
|
|
8626
9514
|
});
|
|
8627
9515
|
function intersection(left, right) {
|
|
8628
9516
|
return new ZodIntersection({
|
|
@@ -8634,6 +9522,7 @@ function intersection(left, right) {
|
|
|
8634
9522
|
var ZodTuple = /* @__PURE__ */ $constructor("ZodTuple", (inst, def) => {
|
|
8635
9523
|
$ZodTuple.init(inst, def);
|
|
8636
9524
|
ZodType.init(inst, def);
|
|
9525
|
+
inst._zod.processJSONSchema = (ctx, json, params) => tupleProcessor(inst, ctx, json, params);
|
|
8637
9526
|
inst.rest = (rest) => inst.clone({
|
|
8638
9527
|
...inst._zod.def,
|
|
8639
9528
|
rest
|
|
@@ -8642,12 +9531,14 @@ var ZodTuple = /* @__PURE__ */ $constructor("ZodTuple", (inst, def) => {
|
|
|
8642
9531
|
var ZodRecord = /* @__PURE__ */ $constructor("ZodRecord", (inst, def) => {
|
|
8643
9532
|
$ZodRecord.init(inst, def);
|
|
8644
9533
|
ZodType.init(inst, def);
|
|
9534
|
+
inst._zod.processJSONSchema = (ctx, json, params) => recordProcessor(inst, ctx, json, params);
|
|
8645
9535
|
inst.keyType = def.keyType;
|
|
8646
9536
|
inst.valueType = def.valueType;
|
|
8647
9537
|
});
|
|
8648
9538
|
var ZodEnum = /* @__PURE__ */ $constructor("ZodEnum", (inst, def) => {
|
|
8649
9539
|
$ZodEnum.init(inst, def);
|
|
8650
9540
|
ZodType.init(inst, def);
|
|
9541
|
+
inst._zod.processJSONSchema = (ctx, json, params) => enumProcessor(inst, ctx, json, params);
|
|
8651
9542
|
inst.enum = def.entries;
|
|
8652
9543
|
inst.options = Object.values(def.entries);
|
|
8653
9544
|
const keys = new Set(Object.keys(def.entries));
|
|
@@ -8693,6 +9584,7 @@ function _enum(values, params) {
|
|
|
8693
9584
|
var ZodLiteral = /* @__PURE__ */ $constructor("ZodLiteral", (inst, def) => {
|
|
8694
9585
|
$ZodLiteral.init(inst, def);
|
|
8695
9586
|
ZodType.init(inst, def);
|
|
9587
|
+
inst._zod.processJSONSchema = (ctx, json, params) => literalProcessor(inst, ctx, json, params);
|
|
8696
9588
|
inst.values = new Set(def.values);
|
|
8697
9589
|
Object.defineProperty(inst, "value", {
|
|
8698
9590
|
get() {
|
|
@@ -8706,6 +9598,7 @@ var ZodLiteral = /* @__PURE__ */ $constructor("ZodLiteral", (inst, def) => {
|
|
|
8706
9598
|
var ZodTransform = /* @__PURE__ */ $constructor("ZodTransform", (inst, def) => {
|
|
8707
9599
|
$ZodTransform.init(inst, def);
|
|
8708
9600
|
ZodType.init(inst, def);
|
|
9601
|
+
inst._zod.processJSONSchema = (ctx, json, params) => transformProcessor(inst, ctx, json, params);
|
|
8709
9602
|
inst._zod.parse = (payload, _ctx) => {
|
|
8710
9603
|
if (_ctx.direction === "backward") {
|
|
8711
9604
|
throw new $ZodEncodeError(inst.constructor.name);
|
|
@@ -8743,6 +9636,7 @@ function transform(fn) {
|
|
|
8743
9636
|
var ZodOptional = /* @__PURE__ */ $constructor("ZodOptional", (inst, def) => {
|
|
8744
9637
|
$ZodOptional.init(inst, def);
|
|
8745
9638
|
ZodType.init(inst, def);
|
|
9639
|
+
inst._zod.processJSONSchema = (ctx, json, params) => optionalProcessor(inst, ctx, json, params);
|
|
8746
9640
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
8747
9641
|
});
|
|
8748
9642
|
function optional(innerType) {
|
|
@@ -8754,6 +9648,7 @@ function optional(innerType) {
|
|
|
8754
9648
|
var ZodNullable = /* @__PURE__ */ $constructor("ZodNullable", (inst, def) => {
|
|
8755
9649
|
$ZodNullable.init(inst, def);
|
|
8756
9650
|
ZodType.init(inst, def);
|
|
9651
|
+
inst._zod.processJSONSchema = (ctx, json, params) => nullableProcessor(inst, ctx, json, params);
|
|
8757
9652
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
8758
9653
|
});
|
|
8759
9654
|
function nullable(innerType) {
|
|
@@ -8765,6 +9660,7 @@ function nullable(innerType) {
|
|
|
8765
9660
|
var ZodDefault = /* @__PURE__ */ $constructor("ZodDefault", (inst, def) => {
|
|
8766
9661
|
$ZodDefault.init(inst, def);
|
|
8767
9662
|
ZodType.init(inst, def);
|
|
9663
|
+
inst._zod.processJSONSchema = (ctx, json, params) => defaultProcessor(inst, ctx, json, params);
|
|
8768
9664
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
8769
9665
|
inst.removeDefault = inst.unwrap;
|
|
8770
9666
|
});
|
|
@@ -8780,6 +9676,7 @@ function _default(innerType, defaultValue) {
|
|
|
8780
9676
|
var ZodPrefault = /* @__PURE__ */ $constructor("ZodPrefault", (inst, def) => {
|
|
8781
9677
|
$ZodPrefault.init(inst, def);
|
|
8782
9678
|
ZodType.init(inst, def);
|
|
9679
|
+
inst._zod.processJSONSchema = (ctx, json, params) => prefaultProcessor(inst, ctx, json, params);
|
|
8783
9680
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
8784
9681
|
});
|
|
8785
9682
|
function prefault(innerType, defaultValue) {
|
|
@@ -8794,6 +9691,7 @@ function prefault(innerType, defaultValue) {
|
|
|
8794
9691
|
var ZodNonOptional = /* @__PURE__ */ $constructor("ZodNonOptional", (inst, def) => {
|
|
8795
9692
|
$ZodNonOptional.init(inst, def);
|
|
8796
9693
|
ZodType.init(inst, def);
|
|
9694
|
+
inst._zod.processJSONSchema = (ctx, json, params) => nonoptionalProcessor(inst, ctx, json, params);
|
|
8797
9695
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
8798
9696
|
});
|
|
8799
9697
|
function nonoptional(innerType, params) {
|
|
@@ -8806,6 +9704,7 @@ function nonoptional(innerType, params) {
|
|
|
8806
9704
|
var ZodCatch = /* @__PURE__ */ $constructor("ZodCatch", (inst, def) => {
|
|
8807
9705
|
$ZodCatch.init(inst, def);
|
|
8808
9706
|
ZodType.init(inst, def);
|
|
9707
|
+
inst._zod.processJSONSchema = (ctx, json, params) => catchProcessor(inst, ctx, json, params);
|
|
8809
9708
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
8810
9709
|
inst.removeCatch = inst.unwrap;
|
|
8811
9710
|
});
|
|
@@ -8819,6 +9718,7 @@ function _catch(innerType, catchValue) {
|
|
|
8819
9718
|
var ZodPipe = /* @__PURE__ */ $constructor("ZodPipe", (inst, def) => {
|
|
8820
9719
|
$ZodPipe.init(inst, def);
|
|
8821
9720
|
ZodType.init(inst, def);
|
|
9721
|
+
inst._zod.processJSONSchema = (ctx, json, params) => pipeProcessor(inst, ctx, json, params);
|
|
8822
9722
|
inst.in = def.in;
|
|
8823
9723
|
inst.out = def.out;
|
|
8824
9724
|
});
|
|
@@ -8833,6 +9733,7 @@ function pipe2(in_, out) {
|
|
|
8833
9733
|
var ZodReadonly = /* @__PURE__ */ $constructor("ZodReadonly", (inst, def) => {
|
|
8834
9734
|
$ZodReadonly.init(inst, def);
|
|
8835
9735
|
ZodType.init(inst, def);
|
|
9736
|
+
inst._zod.processJSONSchema = (ctx, json, params) => readonlyProcessor(inst, ctx, json, params);
|
|
8836
9737
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
8837
9738
|
});
|
|
8838
9739
|
function readonly(innerType) {
|
|
@@ -8844,11 +9745,13 @@ function readonly(innerType) {
|
|
|
8844
9745
|
var ZodPromise = /* @__PURE__ */ $constructor("ZodPromise", (inst, def) => {
|
|
8845
9746
|
$ZodPromise.init(inst, def);
|
|
8846
9747
|
ZodType.init(inst, def);
|
|
9748
|
+
inst._zod.processJSONSchema = (ctx, json, params) => promiseProcessor(inst, ctx, json, params);
|
|
8847
9749
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
8848
9750
|
});
|
|
8849
9751
|
var ZodCustom = /* @__PURE__ */ $constructor("ZodCustom", (inst, def) => {
|
|
8850
9752
|
$ZodCustom.init(inst, def);
|
|
8851
9753
|
ZodType.init(inst, def);
|
|
9754
|
+
inst._zod.processJSONSchema = (ctx, json, params) => customProcessor(inst, ctx, json, params);
|
|
8852
9755
|
});
|
|
8853
9756
|
function refine(fn, _params = {}) {
|
|
8854
9757
|
return _refine(ZodCustom, fn, _params);
|
|
@@ -9322,7 +10225,8 @@ var openapi = ({
|
|
|
9322
10225
|
}
|
|
9323
10226
|
};
|
|
9324
10227
|
};
|
|
9325
|
-
const app = new import_elysia2.Elysia({ name: "@elysiajs/openapi" })
|
|
10228
|
+
const app = new import_elysia2.Elysia({ name: "@elysiajs/openapi" });
|
|
10229
|
+
app.use((app2) => {
|
|
9326
10230
|
if (provider === null) return app2;
|
|
9327
10231
|
const page = () => new Response(
|
|
9328
10232
|
provider === "swagger-ui" ? SwaggerUIRender(info, {
|