@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/index.mjs
CHANGED
|
@@ -525,11 +525,11 @@ __export(kind_exports, {
|
|
|
525
525
|
});
|
|
526
526
|
|
|
527
527
|
// node_modules/@sinclair/typebox/build/esm/type/symbols/symbols.mjs
|
|
528
|
-
var TransformKind = Symbol.for("TypeBox.Transform");
|
|
529
|
-
var ReadonlyKind = Symbol.for("TypeBox.Readonly");
|
|
530
|
-
var OptionalKind = Symbol.for("TypeBox.Optional");
|
|
531
|
-
var Hint = Symbol.for("TypeBox.Hint");
|
|
532
|
-
var Kind = Symbol.for("TypeBox.Kind");
|
|
528
|
+
var TransformKind = /* @__PURE__ */ Symbol.for("TypeBox.Transform");
|
|
529
|
+
var ReadonlyKind = /* @__PURE__ */ Symbol.for("TypeBox.Readonly");
|
|
530
|
+
var OptionalKind = /* @__PURE__ */ Symbol.for("TypeBox.Optional");
|
|
531
|
+
var Hint = /* @__PURE__ */ Symbol.for("TypeBox.Hint");
|
|
532
|
+
var Kind = /* @__PURE__ */ Symbol.for("TypeBox.Kind");
|
|
533
533
|
|
|
534
534
|
// node_modules/@sinclair/typebox/build/esm/type/guard/kind.mjs
|
|
535
535
|
function IsReadonly(value) {
|
|
@@ -2674,7 +2674,9 @@ function Void(options) {
|
|
|
2674
2674
|
|
|
2675
2675
|
// src/openapi.ts
|
|
2676
2676
|
var capitalize = (word) => word.charAt(0).toUpperCase() + word.slice(1);
|
|
2677
|
-
var toRef = (name) => t.Ref(
|
|
2677
|
+
var toRef = (name) => t.Ref(
|
|
2678
|
+
name.startsWith("#/") ? name : `#/components/schemas/${name}`
|
|
2679
|
+
);
|
|
2678
2680
|
var toOperationId = (method, paths) => {
|
|
2679
2681
|
let operationId = method.toLowerCase();
|
|
2680
2682
|
if (!paths || paths === "/") return operationId + "Index";
|
|
@@ -2735,6 +2737,219 @@ openapi({
|
|
|
2735
2737
|
})`
|
|
2736
2738
|
};
|
|
2737
2739
|
var warned = {};
|
|
2740
|
+
var mergeObjectSchemas = (schemas) => {
|
|
2741
|
+
if (schemas.length === 0)
|
|
2742
|
+
return {
|
|
2743
|
+
schema: void 0,
|
|
2744
|
+
notObjects: []
|
|
2745
|
+
};
|
|
2746
|
+
if (schemas.length === 1)
|
|
2747
|
+
return schemas[0].type === "object" ? {
|
|
2748
|
+
schema: schemas[0],
|
|
2749
|
+
notObjects: []
|
|
2750
|
+
} : {
|
|
2751
|
+
schema: void 0,
|
|
2752
|
+
notObjects: schemas
|
|
2753
|
+
};
|
|
2754
|
+
let newSchema;
|
|
2755
|
+
const notObjects = [];
|
|
2756
|
+
let additionalPropertiesIsTrue = false;
|
|
2757
|
+
let additionalPropertiesIsFalse = false;
|
|
2758
|
+
for (const schema of schemas) {
|
|
2759
|
+
if (!schema) continue;
|
|
2760
|
+
if (schema.type !== "object") {
|
|
2761
|
+
notObjects.push(schema);
|
|
2762
|
+
continue;
|
|
2763
|
+
}
|
|
2764
|
+
if ("additionalProperties" in schema) {
|
|
2765
|
+
if (schema.additionalProperties === true)
|
|
2766
|
+
additionalPropertiesIsTrue = true;
|
|
2767
|
+
else if (schema.additionalProperties === false)
|
|
2768
|
+
additionalPropertiesIsFalse = true;
|
|
2769
|
+
}
|
|
2770
|
+
if (!newSchema) {
|
|
2771
|
+
newSchema = schema;
|
|
2772
|
+
continue;
|
|
2773
|
+
}
|
|
2774
|
+
newSchema = {
|
|
2775
|
+
...newSchema,
|
|
2776
|
+
...schema,
|
|
2777
|
+
properties: {
|
|
2778
|
+
...newSchema.properties,
|
|
2779
|
+
...schema.properties
|
|
2780
|
+
},
|
|
2781
|
+
required: [
|
|
2782
|
+
...newSchema?.required ?? [],
|
|
2783
|
+
...schema.required ?? []
|
|
2784
|
+
]
|
|
2785
|
+
};
|
|
2786
|
+
}
|
|
2787
|
+
if (newSchema) {
|
|
2788
|
+
if (newSchema.required)
|
|
2789
|
+
newSchema.required = [...new Set(newSchema.required)];
|
|
2790
|
+
if (additionalPropertiesIsFalse) newSchema.additionalProperties = false;
|
|
2791
|
+
else if (additionalPropertiesIsTrue)
|
|
2792
|
+
newSchema.additionalProperties = true;
|
|
2793
|
+
}
|
|
2794
|
+
return {
|
|
2795
|
+
schema: newSchema,
|
|
2796
|
+
notObjects
|
|
2797
|
+
};
|
|
2798
|
+
};
|
|
2799
|
+
var isTSchema = (value) => {
|
|
2800
|
+
if (!value || typeof value !== "object") return false;
|
|
2801
|
+
if (Kind in value) return true;
|
|
2802
|
+
const keys = Object.keys(value);
|
|
2803
|
+
if (keys.length > 0 && keys.every((k) => !isNaN(Number(k)))) {
|
|
2804
|
+
return false;
|
|
2805
|
+
}
|
|
2806
|
+
return false;
|
|
2807
|
+
};
|
|
2808
|
+
var normalizeSchemaReference = (schema) => {
|
|
2809
|
+
if (!schema) return void 0;
|
|
2810
|
+
if (typeof schema !== "string") return schema;
|
|
2811
|
+
return toRef(schema);
|
|
2812
|
+
};
|
|
2813
|
+
var mergeSchemaProperty = (existing, incoming, vendors) => {
|
|
2814
|
+
if (!existing) return incoming;
|
|
2815
|
+
if (!incoming) return existing;
|
|
2816
|
+
let existingSchema = normalizeSchemaReference(existing);
|
|
2817
|
+
let incomingSchema = normalizeSchemaReference(incoming);
|
|
2818
|
+
if (!existingSchema) return incoming;
|
|
2819
|
+
if (!incomingSchema) return existing;
|
|
2820
|
+
if (!isTSchema(incomingSchema) && incomingSchema["~standard"])
|
|
2821
|
+
incomingSchema = unwrapSchema(incomingSchema, vendors);
|
|
2822
|
+
if (!isTSchema(existingSchema) && existingSchema["~standard"])
|
|
2823
|
+
existingSchema = unwrapSchema(existingSchema, vendors);
|
|
2824
|
+
if (!incomingSchema) return existingSchema;
|
|
2825
|
+
if (!existingSchema) return incomingSchema;
|
|
2826
|
+
const { schema: mergedSchema, notObjects } = mergeObjectSchemas([
|
|
2827
|
+
existingSchema,
|
|
2828
|
+
incomingSchema
|
|
2829
|
+
]);
|
|
2830
|
+
if (notObjects.length > 0) {
|
|
2831
|
+
if (mergedSchema) return t.Intersect([mergedSchema, ...notObjects]);
|
|
2832
|
+
return notObjects.length === 1 ? notObjects[0] : t.Intersect(notObjects);
|
|
2833
|
+
}
|
|
2834
|
+
return mergedSchema;
|
|
2835
|
+
};
|
|
2836
|
+
var unwrapResponseSchema = (schema, vendors) => typeof schema === "string" ? normalizeSchemaReference(schema) : !schema ? void 0 : isTSchema(schema) ? schema : (
|
|
2837
|
+
// @ts-ignore
|
|
2838
|
+
schema["~standard"] ? unwrapSchema(schema, vendors, "output") : Object.fromEntries(
|
|
2839
|
+
Object.entries(schema).map(([status, schema2]) => [
|
|
2840
|
+
status,
|
|
2841
|
+
typeof schema2 === "string" ? normalizeSchemaReference(schema2) : isTSchema(schema2) ? schema2 : unwrapSchema(
|
|
2842
|
+
schema2,
|
|
2843
|
+
vendors,
|
|
2844
|
+
"output"
|
|
2845
|
+
)
|
|
2846
|
+
])
|
|
2847
|
+
)
|
|
2848
|
+
);
|
|
2849
|
+
var mergeResponseSchema = (_existing, _incoming, vendors) => {
|
|
2850
|
+
if (!_existing) return _incoming;
|
|
2851
|
+
if (!_incoming) return _existing;
|
|
2852
|
+
let existing = unwrapResponseSchema(_existing, vendors);
|
|
2853
|
+
let incoming = unwrapResponseSchema(_incoming, vendors);
|
|
2854
|
+
if (!existing && !incoming) return void 0;
|
|
2855
|
+
if (incoming && !existing) return incoming;
|
|
2856
|
+
if (existing && !incoming) return existing;
|
|
2857
|
+
if (isTSchema(existing) || existing?.["~standard"])
|
|
2858
|
+
existing = {
|
|
2859
|
+
200: existing
|
|
2860
|
+
};
|
|
2861
|
+
if (isTSchema(incoming) || incoming?.["~standard"])
|
|
2862
|
+
incoming = {
|
|
2863
|
+
200: incoming
|
|
2864
|
+
};
|
|
2865
|
+
const schema = {
|
|
2866
|
+
...incoming
|
|
2867
|
+
};
|
|
2868
|
+
for (const status of Object.keys(existing ?? {})) {
|
|
2869
|
+
const existingSchema = existing[status];
|
|
2870
|
+
const incomingSchema = incoming[status];
|
|
2871
|
+
if (existingSchema && incomingSchema)
|
|
2872
|
+
schema[status] = mergeSchemaProperty(
|
|
2873
|
+
existingSchema,
|
|
2874
|
+
incomingSchema,
|
|
2875
|
+
vendors
|
|
2876
|
+
);
|
|
2877
|
+
else if (existingSchema) schema[status] = existingSchema;
|
|
2878
|
+
else if (incomingSchema) schema[status] = incomingSchema;
|
|
2879
|
+
}
|
|
2880
|
+
return schema;
|
|
2881
|
+
};
|
|
2882
|
+
var mergeStandaloneValidators = (hooks, vendors) => {
|
|
2883
|
+
const merged = { ...hooks };
|
|
2884
|
+
if (!hooks.standaloneValidator?.length) return merged;
|
|
2885
|
+
for (const validator of hooks.standaloneValidator) {
|
|
2886
|
+
if (validator.body)
|
|
2887
|
+
merged.body = mergeSchemaProperty(
|
|
2888
|
+
merged.body,
|
|
2889
|
+
validator.body,
|
|
2890
|
+
vendors
|
|
2891
|
+
);
|
|
2892
|
+
if (validator.headers)
|
|
2893
|
+
merged.headers = mergeSchemaProperty(
|
|
2894
|
+
merged.headers,
|
|
2895
|
+
validator.headers,
|
|
2896
|
+
vendors
|
|
2897
|
+
);
|
|
2898
|
+
if (validator.query)
|
|
2899
|
+
merged.query = mergeSchemaProperty(
|
|
2900
|
+
merged.query,
|
|
2901
|
+
validator.query,
|
|
2902
|
+
vendors
|
|
2903
|
+
);
|
|
2904
|
+
if (validator.params)
|
|
2905
|
+
merged.params = mergeSchemaProperty(
|
|
2906
|
+
merged.params,
|
|
2907
|
+
validator.params,
|
|
2908
|
+
vendors
|
|
2909
|
+
);
|
|
2910
|
+
if (validator.cookie)
|
|
2911
|
+
merged.cookie = mergeSchemaProperty(
|
|
2912
|
+
merged.cookie,
|
|
2913
|
+
validator.cookie,
|
|
2914
|
+
vendors
|
|
2915
|
+
);
|
|
2916
|
+
if (validator.response)
|
|
2917
|
+
merged.response = mergeResponseSchema(
|
|
2918
|
+
merged.response,
|
|
2919
|
+
validator.response,
|
|
2920
|
+
vendors
|
|
2921
|
+
);
|
|
2922
|
+
}
|
|
2923
|
+
if (typeof merged.body === "string")
|
|
2924
|
+
merged.body = normalizeSchemaReference(merged.body);
|
|
2925
|
+
if (typeof merged.headers === "string")
|
|
2926
|
+
merged.headers = normalizeSchemaReference(merged.headers);
|
|
2927
|
+
if (typeof merged.query === "string")
|
|
2928
|
+
merged.query = normalizeSchemaReference(merged.query);
|
|
2929
|
+
if (typeof merged.params === "string")
|
|
2930
|
+
merged.params = normalizeSchemaReference(merged.params);
|
|
2931
|
+
if (typeof merged.cookie === "string")
|
|
2932
|
+
merged.cookie = normalizeSchemaReference(merged.cookie);
|
|
2933
|
+
if (merged.response && typeof merged.response !== "string") {
|
|
2934
|
+
const response = merged.response;
|
|
2935
|
+
if ("type" in response || "$ref" in response) {
|
|
2936
|
+
if (typeof response === "string")
|
|
2937
|
+
merged.response = normalizeSchemaReference(response);
|
|
2938
|
+
} else {
|
|
2939
|
+
for (const [status, schema] of Object.entries(response))
|
|
2940
|
+
if (typeof schema === "string")
|
|
2941
|
+
response[status] = normalizeSchemaReference(schema);
|
|
2942
|
+
}
|
|
2943
|
+
}
|
|
2944
|
+
return merged;
|
|
2945
|
+
};
|
|
2946
|
+
var flattenRoutes = (routes, vendors) => routes.map((route) => {
|
|
2947
|
+
if (!route.hooks?.standaloneValidator?.length) return route;
|
|
2948
|
+
return {
|
|
2949
|
+
...route,
|
|
2950
|
+
hooks: mergeStandaloneValidators(route.hooks, vendors)
|
|
2951
|
+
};
|
|
2952
|
+
});
|
|
2738
2953
|
var unwrapReference = (schema, definitions) => {
|
|
2739
2954
|
const ref = schema?.$ref;
|
|
2740
2955
|
if (!ref) return schema;
|
|
@@ -2742,13 +2957,20 @@ var unwrapReference = (schema, definitions) => {
|
|
|
2742
2957
|
if (ref && definitions[name]) schema = definitions[name];
|
|
2743
2958
|
return enumToOpenApi(schema);
|
|
2744
2959
|
};
|
|
2745
|
-
var unwrapSchema = (schema, mapJsonSchema) => {
|
|
2960
|
+
var unwrapSchema = (schema, mapJsonSchema, io = "input") => {
|
|
2746
2961
|
if (!schema) return;
|
|
2747
2962
|
if (typeof schema === "string") schema = toRef(schema);
|
|
2748
2963
|
if (Kind in schema) return enumToOpenApi(schema);
|
|
2749
|
-
if (
|
|
2964
|
+
if (!schema?.["~standard"] && // @ts-ignore
|
|
2965
|
+
(schema.$schema || schema.type || schema.properties || schema.items))
|
|
2966
|
+
return schema;
|
|
2967
|
+
if (!schema?.["~standard"]) return;
|
|
2750
2968
|
const vendor = schema["~standard"].vendor;
|
|
2751
2969
|
try {
|
|
2970
|
+
if (schema["~standard"]?.jsonSchema?.[io])
|
|
2971
|
+
return schema["~standard"]?.jsonSchema?.[io]?.({
|
|
2972
|
+
target: "draft-2020-12"
|
|
2973
|
+
});
|
|
2752
2974
|
if (mapJsonSchema?.[vendor] && typeof mapJsonSchema[vendor] === "function")
|
|
2753
2975
|
return enumToOpenApi(mapJsonSchema[vendor](schema));
|
|
2754
2976
|
switch (vendor) {
|
|
@@ -2843,7 +3065,6 @@ function toOpenAPISchema(app, exclude, references, vendors) {
|
|
|
2843
3065
|
const excludePaths = Array.isArray(exclude?.paths) ? exclude.paths : typeof exclude?.paths !== "undefined" ? [exclude.paths] : [];
|
|
2844
3066
|
const paths = /* @__PURE__ */ Object.create(null);
|
|
2845
3067
|
const definitions = app.getGlobalDefinitions?.().type;
|
|
2846
|
-
const routes = app.getGlobalRoutes();
|
|
2847
3068
|
if (references) {
|
|
2848
3069
|
if (!Array.isArray(references)) references = [references];
|
|
2849
3070
|
for (let i = 0; i < references.length; i++) {
|
|
@@ -2851,6 +3072,7 @@ function toOpenAPISchema(app, exclude, references, vendors) {
|
|
|
2851
3072
|
if (typeof reference === "function") references[i] = reference();
|
|
2852
3073
|
}
|
|
2853
3074
|
}
|
|
3075
|
+
const routes = flattenRoutes(app.getGlobalRoutes(), vendors);
|
|
2854
3076
|
for (const route of routes) {
|
|
2855
3077
|
if (route.hooks?.detail?.hide) continue;
|
|
2856
3078
|
const method = route.method.toLowerCase();
|
|
@@ -3040,7 +3262,7 @@ function toOpenAPISchema(app, exclude, references, vendors) {
|
|
|
3040
3262
|
if (typeof hooks.response === "object" && // TypeBox
|
|
3041
3263
|
!hooks.response.type && !hooks.response.$ref && !hooks.response["~standard"]) {
|
|
3042
3264
|
for (let [status, schema] of Object.entries(hooks.response)) {
|
|
3043
|
-
const response = unwrapSchema(schema, vendors);
|
|
3265
|
+
const response = unwrapSchema(schema, vendors, "output");
|
|
3044
3266
|
if (!response) continue;
|
|
3045
3267
|
const { type, description, $ref, ..._options } = unwrapReference(response, definitions);
|
|
3046
3268
|
operation.responses[status] = {
|
|
@@ -3057,7 +3279,11 @@ function toOpenAPISchema(app, exclude, references, vendors) {
|
|
|
3057
3279
|
};
|
|
3058
3280
|
}
|
|
3059
3281
|
} else {
|
|
3060
|
-
const response = unwrapSchema(
|
|
3282
|
+
const response = unwrapSchema(
|
|
3283
|
+
hooks.response,
|
|
3284
|
+
vendors,
|
|
3285
|
+
"output"
|
|
3286
|
+
);
|
|
3061
3287
|
if (response) {
|
|
3062
3288
|
const {
|
|
3063
3289
|
type: _type,
|
|
@@ -3882,47 +4108,41 @@ function TypeBoxFromTypeBox(type) {
|
|
|
3882
4108
|
return CloneType(type);
|
|
3883
4109
|
}
|
|
3884
4110
|
|
|
3885
|
-
// node_modules/valibot/dist/index.
|
|
3886
|
-
var store;
|
|
4111
|
+
// node_modules/valibot/dist/index.mjs
|
|
4112
|
+
var store$4;
|
|
3887
4113
|
// @__NO_SIDE_EFFECTS__
|
|
3888
|
-
function getGlobalConfig(
|
|
4114
|
+
function getGlobalConfig(config$1) {
|
|
3889
4115
|
return {
|
|
3890
|
-
lang:
|
|
3891
|
-
message:
|
|
3892
|
-
abortEarly:
|
|
3893
|
-
abortPipeEarly:
|
|
4116
|
+
lang: config$1?.lang ?? store$4?.lang,
|
|
4117
|
+
message: config$1?.message,
|
|
4118
|
+
abortEarly: config$1?.abortEarly ?? store$4?.abortEarly,
|
|
4119
|
+
abortPipeEarly: config$1?.abortPipeEarly ?? store$4?.abortPipeEarly
|
|
3894
4120
|
};
|
|
3895
4121
|
}
|
|
3896
|
-
var
|
|
4122
|
+
var store$3;
|
|
3897
4123
|
// @__NO_SIDE_EFFECTS__
|
|
3898
4124
|
function getGlobalMessage(lang) {
|
|
3899
|
-
return
|
|
4125
|
+
return store$3?.get(lang);
|
|
3900
4126
|
}
|
|
3901
|
-
var
|
|
4127
|
+
var store$2;
|
|
3902
4128
|
// @__NO_SIDE_EFFECTS__
|
|
3903
4129
|
function getSchemaMessage(lang) {
|
|
3904
|
-
return
|
|
4130
|
+
return store$2?.get(lang);
|
|
3905
4131
|
}
|
|
3906
|
-
var
|
|
4132
|
+
var store$1;
|
|
3907
4133
|
// @__NO_SIDE_EFFECTS__
|
|
3908
4134
|
function getSpecificMessage(reference, lang) {
|
|
3909
|
-
return
|
|
4135
|
+
return store$1?.get(reference)?.get(lang);
|
|
3910
4136
|
}
|
|
3911
4137
|
// @__NO_SIDE_EFFECTS__
|
|
3912
4138
|
function _stringify(input) {
|
|
3913
4139
|
const type = typeof input;
|
|
3914
|
-
if (type === "string") {
|
|
3915
|
-
|
|
3916
|
-
|
|
3917
|
-
if (type === "number" || type === "bigint" || type === "boolean") {
|
|
3918
|
-
return `${input}`;
|
|
3919
|
-
}
|
|
3920
|
-
if (type === "object" || type === "function") {
|
|
3921
|
-
return (input && Object.getPrototypeOf(input)?.constructor?.name) ?? "null";
|
|
3922
|
-
}
|
|
4140
|
+
if (type === "string") return `"${input}"`;
|
|
4141
|
+
if (type === "number" || type === "bigint" || type === "boolean") return `${input}`;
|
|
4142
|
+
if (type === "object" || type === "function") return (input && Object.getPrototypeOf(input)?.constructor?.name) ?? "null";
|
|
3923
4143
|
return type;
|
|
3924
4144
|
}
|
|
3925
|
-
function _addIssue(context, label, dataset,
|
|
4145
|
+
function _addIssue(context, label, dataset, config$1, other) {
|
|
3926
4146
|
const input = other && "input" in other ? other.input : dataset.value;
|
|
3927
4147
|
const expected = other?.expected ?? context.expects ?? null;
|
|
3928
4148
|
const received = other?.received ?? /* @__PURE__ */ _stringify(input);
|
|
@@ -3936,48 +4156,49 @@ function _addIssue(context, label, dataset, config2, other) {
|
|
|
3936
4156
|
requirement: context.requirement,
|
|
3937
4157
|
path: other?.path,
|
|
3938
4158
|
issues: other?.issues,
|
|
3939
|
-
lang:
|
|
3940
|
-
abortEarly:
|
|
3941
|
-
abortPipeEarly:
|
|
4159
|
+
lang: config$1.lang,
|
|
4160
|
+
abortEarly: config$1.abortEarly,
|
|
4161
|
+
abortPipeEarly: config$1.abortPipeEarly
|
|
3942
4162
|
};
|
|
3943
4163
|
const isSchema = context.kind === "schema";
|
|
3944
|
-
const
|
|
3945
|
-
if (
|
|
3946
|
-
|
|
3947
|
-
|
|
3948
|
-
|
|
3949
|
-
) : message2;
|
|
3950
|
-
}
|
|
3951
|
-
if (isSchema) {
|
|
3952
|
-
dataset.typed = false;
|
|
3953
|
-
}
|
|
3954
|
-
if (dataset.issues) {
|
|
3955
|
-
dataset.issues.push(issue2);
|
|
3956
|
-
} else {
|
|
3957
|
-
dataset.issues = [issue2];
|
|
3958
|
-
}
|
|
4164
|
+
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);
|
|
4165
|
+
if (message$1 !== void 0) issue2.message = typeof message$1 === "function" ? message$1(issue2) : message$1;
|
|
4166
|
+
if (isSchema) dataset.typed = false;
|
|
4167
|
+
if (dataset.issues) dataset.issues.push(issue2);
|
|
4168
|
+
else dataset.issues = [issue2];
|
|
3959
4169
|
}
|
|
3960
4170
|
// @__NO_SIDE_EFFECTS__
|
|
3961
4171
|
function _getStandardProps(context) {
|
|
3962
4172
|
return {
|
|
3963
4173
|
version: 1,
|
|
3964
4174
|
vendor: "valibot",
|
|
3965
|
-
validate(
|
|
3966
|
-
return context["~run"]({ value:
|
|
4175
|
+
validate(value$1) {
|
|
4176
|
+
return context["~run"]({ value: value$1 }, /* @__PURE__ */ getGlobalConfig());
|
|
3967
4177
|
}
|
|
3968
4178
|
};
|
|
3969
4179
|
}
|
|
3970
4180
|
var NON_DIGIT_REGEX = /\D/gu;
|
|
3971
4181
|
// @__NO_SIDE_EFFECTS__
|
|
3972
4182
|
function _isLuhnAlgo(input) {
|
|
3973
|
-
const
|
|
3974
|
-
let
|
|
4183
|
+
const number$1 = input.replace(NON_DIGIT_REGEX, "");
|
|
4184
|
+
let length$1 = number$1.length;
|
|
3975
4185
|
let bit = 1;
|
|
3976
4186
|
let sum = 0;
|
|
3977
|
-
while (
|
|
3978
|
-
const
|
|
4187
|
+
while (length$1) {
|
|
4188
|
+
const value$1 = +number$1[--length$1];
|
|
3979
4189
|
bit ^= 1;
|
|
3980
|
-
sum += bit ? [
|
|
4190
|
+
sum += bit ? [
|
|
4191
|
+
0,
|
|
4192
|
+
2,
|
|
4193
|
+
4,
|
|
4194
|
+
6,
|
|
4195
|
+
8,
|
|
4196
|
+
1,
|
|
4197
|
+
3,
|
|
4198
|
+
5,
|
|
4199
|
+
7,
|
|
4200
|
+
9
|
|
4201
|
+
][value$1] : value$1;
|
|
3981
4202
|
}
|
|
3982
4203
|
return sum % 10 === 0;
|
|
3983
4204
|
}
|
|
@@ -3987,14 +4208,8 @@ var CUID2_REGEX = /^[a-z][\da-z]*$/u;
|
|
|
3987
4208
|
var DECIMAL_REGEX = /^[+-]?(?:\d*\.)?\d+$/u;
|
|
3988
4209
|
var DIGITS_REGEX = /^\d+$/u;
|
|
3989
4210
|
var EMAIL_REGEX = /^[\w+-]+(?:\.[\w+-]+)*@[\da-z]+(?:[.-][\da-z]+)*\.[a-z]{2,}$/iu;
|
|
3990
|
-
var EMOJI_REGEX = (
|
|
3991
|
-
|
|
3992
|
-
new RegExp("^(?:[\\u{1F1E6}-\\u{1F1FF}]{2}|\\u{1F3F4}[\\u{E0061}-\\u{E007A}]{2}[\\u{E0030}-\\u{E0039}\\u{E0061}-\\u{E007A}]{1,3}\\u{E007F}|(?:\\p{Emoji}\\uFE0F\\u20E3?|\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|\\p{Emoji_Presentation})(?:\\u200D(?:\\p{Emoji}\\uFE0F\\u20E3?|\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|\\p{Emoji_Presentation}))*)+$", "u")
|
|
3993
|
-
);
|
|
3994
|
-
var IPV4_REGEX = (
|
|
3995
|
-
// eslint-disable-next-line redos-detector/no-unsafe-regex -- false positive
|
|
3996
|
-
/^(?:(?:[1-9]|1\d|2[0-4])?\d|25[0-5])(?:\.(?:(?:[1-9]|1\d|2[0-4])?\d|25[0-5])){3}$/u
|
|
3997
|
-
);
|
|
4211
|
+
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");
|
|
4212
|
+
var IPV4_REGEX = /^(?:(?:[1-9]|1\d|2[0-4])?\d|25[0-5])(?:\.(?:(?:[1-9]|1\d|2[0-4])?\d|25[0-5])){3}$/u;
|
|
3998
4213
|
var IPV6_REGEX = /^(?:(?:[\da-f]{1,4}:){7}[\da-f]{1,4}|(?:[\da-f]{1,4}:){1,7}:|(?:[\da-f]{1,4}:){1,6}:[\da-f]{1,4}|(?:[\da-f]{1,4}:){1,5}(?::[\da-f]{1,4}){1,2}|(?:[\da-f]{1,4}:){1,4}(?::[\da-f]{1,4}){1,3}|(?:[\da-f]{1,4}:){1,3}(?::[\da-f]{1,4}){1,4}|(?:[\da-f]{1,4}:){1,2}(?::[\da-f]{1,4}){1,5}|[\da-f]{1,4}:(?::[\da-f]{1,4}){1,6}|:(?:(?::[\da-f]{1,4}){1,7}|:)|fe80:(?::[\da-f]{0,4}){0,4}%[\da-z]+|::(?:f{4}(?::0{1,4})?:)?(?:(?:25[0-5]|(?:2[0-4]|1?\d)?\d)\.){3}(?:25[0-5]|(?:2[0-4]|1?\d)?\d)|(?:[\da-f]{1,4}:){1,4}:(?:(?:25[0-5]|(?:2[0-4]|1?\d)?\d)\.){3}(?:25[0-5]|(?:2[0-4]|1?\d)?\d))$/iu;
|
|
3999
4214
|
var IP_REGEX = /^(?:(?:[1-9]|1\d|2[0-4])?\d|25[0-5])(?:\.(?:(?:[1-9]|1\d|2[0-4])?\d|25[0-5])){3}$|^(?:(?:[\da-f]{1,4}:){7}[\da-f]{1,4}|(?:[\da-f]{1,4}:){1,7}:|(?:[\da-f]{1,4}:){1,6}:[\da-f]{1,4}|(?:[\da-f]{1,4}:){1,5}(?::[\da-f]{1,4}){1,2}|(?:[\da-f]{1,4}:){1,4}(?::[\da-f]{1,4}){1,3}|(?:[\da-f]{1,4}:){1,3}(?::[\da-f]{1,4}){1,4}|(?:[\da-f]{1,4}:){1,2}(?::[\da-f]{1,4}){1,5}|[\da-f]{1,4}:(?::[\da-f]{1,4}){1,6}|:(?:(?::[\da-f]{1,4}){1,7}|:)|fe80:(?::[\da-f]{0,4}){0,4}%[\da-z]+|::(?:f{4}(?::0{1,4})?:)?(?:(?:25[0-5]|(?:2[0-4]|1?\d)?\d)\.){3}(?:25[0-5]|(?:2[0-4]|1?\d)?\d)|(?:[\da-f]{1,4}:){1,4}:(?:(?:25[0-5]|(?:2[0-4]|1?\d)?\d)\.){3}(?:25[0-5]|(?:2[0-4]|1?\d)?\d))$/iu;
|
|
4000
4215
|
var ISO_DATE_REGEX = /^\d{4}-(?:0[1-9]|1[0-2])-(?:[12]\d|0[1-9]|3[01])$/u;
|
|
@@ -4011,7 +4226,7 @@ var OCTAL_REGEX = /^(?:0o)?[0-7]+$/u;
|
|
|
4011
4226
|
var ULID_REGEX = /^[\da-hjkmnp-tv-zA-HJKMNP-TV-Z]{26}$/u;
|
|
4012
4227
|
var UUID_REGEX = /^[\da-f]{8}(?:-[\da-f]{4}){3}-[\da-f]{12}$/iu;
|
|
4013
4228
|
// @__NO_SIDE_EFFECTS__
|
|
4014
|
-
function base64(
|
|
4229
|
+
function base64(message$1) {
|
|
4015
4230
|
return {
|
|
4016
4231
|
kind: "validation",
|
|
4017
4232
|
type: "base64",
|
|
@@ -4019,17 +4234,15 @@ function base64(message2) {
|
|
|
4019
4234
|
async: false,
|
|
4020
4235
|
expects: null,
|
|
4021
4236
|
requirement: BASE64_REGEX,
|
|
4022
|
-
message:
|
|
4023
|
-
"~run"(dataset,
|
|
4024
|
-
if (dataset.typed && !this.requirement.test(dataset.value))
|
|
4025
|
-
_addIssue(this, "Base64", dataset, config2);
|
|
4026
|
-
}
|
|
4237
|
+
message: message$1,
|
|
4238
|
+
"~run"(dataset, config$1) {
|
|
4239
|
+
if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "Base64", dataset, config$1);
|
|
4027
4240
|
return dataset;
|
|
4028
4241
|
}
|
|
4029
4242
|
};
|
|
4030
4243
|
}
|
|
4031
4244
|
// @__NO_SIDE_EFFECTS__
|
|
4032
|
-
function bic(
|
|
4245
|
+
function bic(message$1) {
|
|
4033
4246
|
return {
|
|
4034
4247
|
kind: "validation",
|
|
4035
4248
|
type: "bic",
|
|
@@ -4037,11 +4250,9 @@ function bic(message2) {
|
|
|
4037
4250
|
async: false,
|
|
4038
4251
|
expects: null,
|
|
4039
4252
|
requirement: BIC_REGEX,
|
|
4040
|
-
message:
|
|
4041
|
-
"~run"(dataset,
|
|
4042
|
-
if (dataset.typed && !this.requirement.test(dataset.value))
|
|
4043
|
-
_addIssue(this, "BIC", dataset, config2);
|
|
4044
|
-
}
|
|
4253
|
+
message: message$1,
|
|
4254
|
+
"~run"(dataset, config$1) {
|
|
4255
|
+
if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "BIC", dataset, config$1);
|
|
4045
4256
|
return dataset;
|
|
4046
4257
|
}
|
|
4047
4258
|
};
|
|
@@ -4049,24 +4260,16 @@ function bic(message2) {
|
|
|
4049
4260
|
var CREDIT_CARD_REGEX = /^(?:\d{14,19}|\d{4}(?: \d{3,6}){2,4}|\d{4}(?:-\d{3,6}){2,4})$/u;
|
|
4050
4261
|
var SANITIZE_REGEX = /[- ]/gu;
|
|
4051
4262
|
var PROVIDER_REGEX_LIST = [
|
|
4052
|
-
// American Express
|
|
4053
4263
|
/^3[47]\d{13}$/u,
|
|
4054
|
-
// Diners Club
|
|
4055
4264
|
/^3(?:0[0-5]|[68]\d)\d{11,13}$/u,
|
|
4056
|
-
// Discover
|
|
4057
4265
|
/^6(?:011|5\d{2})\d{12,15}$/u,
|
|
4058
|
-
// JCB
|
|
4059
4266
|
/^(?:2131|1800|35\d{3})\d{11}$/u,
|
|
4060
|
-
// Mastercard
|
|
4061
|
-
// eslint-disable-next-line redos-detector/no-unsafe-regex
|
|
4062
4267
|
/^5[1-5]\d{2}|(?:222\d|22[3-9]\d|2[3-6]\d{2}|27[01]\d|2720)\d{12}$/u,
|
|
4063
|
-
// UnionPay
|
|
4064
4268
|
/^(?:6[27]\d{14,17}|81\d{14,17})$/u,
|
|
4065
|
-
// Visa
|
|
4066
4269
|
/^4\d{12}(?:\d{3,6})?$/u
|
|
4067
4270
|
];
|
|
4068
4271
|
// @__NO_SIDE_EFFECTS__
|
|
4069
|
-
function creditCard(
|
|
4272
|
+
function creditCard(message$1) {
|
|
4070
4273
|
return {
|
|
4071
4274
|
kind: "validation",
|
|
4072
4275
|
type: "credit_card",
|
|
@@ -4075,22 +4278,17 @@ function creditCard(message2) {
|
|
|
4075
4278
|
expects: null,
|
|
4076
4279
|
requirement(input) {
|
|
4077
4280
|
let sanitized;
|
|
4078
|
-
return CREDIT_CARD_REGEX.test(input) &&
|
|
4079
|
-
(sanitized = input.replace(SANITIZE_REGEX, "")) && // Check if it matches a provider
|
|
4080
|
-
PROVIDER_REGEX_LIST.some((regex2) => regex2.test(sanitized)) && // Check if passes luhn algorithm
|
|
4081
|
-
/* @__PURE__ */ _isLuhnAlgo(sanitized);
|
|
4281
|
+
return CREDIT_CARD_REGEX.test(input) && (sanitized = input.replace(SANITIZE_REGEX, "")) && PROVIDER_REGEX_LIST.some((regex$1) => regex$1.test(sanitized)) && /* @__PURE__ */ _isLuhnAlgo(sanitized);
|
|
4082
4282
|
},
|
|
4083
|
-
message:
|
|
4084
|
-
"~run"(dataset,
|
|
4085
|
-
if (dataset.typed && !this.requirement(dataset.value))
|
|
4086
|
-
_addIssue(this, "credit card", dataset, config2);
|
|
4087
|
-
}
|
|
4283
|
+
message: message$1,
|
|
4284
|
+
"~run"(dataset, config$1) {
|
|
4285
|
+
if (dataset.typed && !this.requirement(dataset.value)) _addIssue(this, "credit card", dataset, config$1);
|
|
4088
4286
|
return dataset;
|
|
4089
4287
|
}
|
|
4090
4288
|
};
|
|
4091
4289
|
}
|
|
4092
4290
|
// @__NO_SIDE_EFFECTS__
|
|
4093
|
-
function cuid2(
|
|
4291
|
+
function cuid2(message$1) {
|
|
4094
4292
|
return {
|
|
4095
4293
|
kind: "validation",
|
|
4096
4294
|
type: "cuid2",
|
|
@@ -4098,17 +4296,15 @@ function cuid2(message2) {
|
|
|
4098
4296
|
async: false,
|
|
4099
4297
|
expects: null,
|
|
4100
4298
|
requirement: CUID2_REGEX,
|
|
4101
|
-
message:
|
|
4102
|
-
"~run"(dataset,
|
|
4103
|
-
if (dataset.typed && !this.requirement.test(dataset.value))
|
|
4104
|
-
_addIssue(this, "Cuid2", dataset, config2);
|
|
4105
|
-
}
|
|
4299
|
+
message: message$1,
|
|
4300
|
+
"~run"(dataset, config$1) {
|
|
4301
|
+
if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "Cuid2", dataset, config$1);
|
|
4106
4302
|
return dataset;
|
|
4107
4303
|
}
|
|
4108
4304
|
};
|
|
4109
4305
|
}
|
|
4110
4306
|
// @__NO_SIDE_EFFECTS__
|
|
4111
|
-
function decimal(
|
|
4307
|
+
function decimal(message$1) {
|
|
4112
4308
|
return {
|
|
4113
4309
|
kind: "validation",
|
|
4114
4310
|
type: "decimal",
|
|
@@ -4116,17 +4312,15 @@ function decimal(message2) {
|
|
|
4116
4312
|
async: false,
|
|
4117
4313
|
expects: null,
|
|
4118
4314
|
requirement: DECIMAL_REGEX,
|
|
4119
|
-
message:
|
|
4120
|
-
"~run"(dataset,
|
|
4121
|
-
if (dataset.typed && !this.requirement.test(dataset.value))
|
|
4122
|
-
_addIssue(this, "decimal", dataset, config2);
|
|
4123
|
-
}
|
|
4315
|
+
message: message$1,
|
|
4316
|
+
"~run"(dataset, config$1) {
|
|
4317
|
+
if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "decimal", dataset, config$1);
|
|
4124
4318
|
return dataset;
|
|
4125
4319
|
}
|
|
4126
4320
|
};
|
|
4127
4321
|
}
|
|
4128
4322
|
// @__NO_SIDE_EFFECTS__
|
|
4129
|
-
function digits(
|
|
4323
|
+
function digits(message$1) {
|
|
4130
4324
|
return {
|
|
4131
4325
|
kind: "validation",
|
|
4132
4326
|
type: "digits",
|
|
@@ -4134,17 +4328,15 @@ function digits(message2) {
|
|
|
4134
4328
|
async: false,
|
|
4135
4329
|
expects: null,
|
|
4136
4330
|
requirement: DIGITS_REGEX,
|
|
4137
|
-
message:
|
|
4138
|
-
"~run"(dataset,
|
|
4139
|
-
if (dataset.typed && !this.requirement.test(dataset.value))
|
|
4140
|
-
_addIssue(this, "digits", dataset, config2);
|
|
4141
|
-
}
|
|
4331
|
+
message: message$1,
|
|
4332
|
+
"~run"(dataset, config$1) {
|
|
4333
|
+
if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "digits", dataset, config$1);
|
|
4142
4334
|
return dataset;
|
|
4143
4335
|
}
|
|
4144
4336
|
};
|
|
4145
4337
|
}
|
|
4146
4338
|
// @__NO_SIDE_EFFECTS__
|
|
4147
|
-
function email(
|
|
4339
|
+
function email(message$1) {
|
|
4148
4340
|
return {
|
|
4149
4341
|
kind: "validation",
|
|
4150
4342
|
type: "email",
|
|
@@ -4152,17 +4344,15 @@ function email(message2) {
|
|
|
4152
4344
|
expects: null,
|
|
4153
4345
|
async: false,
|
|
4154
4346
|
requirement: EMAIL_REGEX,
|
|
4155
|
-
message:
|
|
4156
|
-
"~run"(dataset,
|
|
4157
|
-
if (dataset.typed && !this.requirement.test(dataset.value))
|
|
4158
|
-
_addIssue(this, "email", dataset, config2);
|
|
4159
|
-
}
|
|
4347
|
+
message: message$1,
|
|
4348
|
+
"~run"(dataset, config$1) {
|
|
4349
|
+
if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "email", dataset, config$1);
|
|
4160
4350
|
return dataset;
|
|
4161
4351
|
}
|
|
4162
4352
|
};
|
|
4163
4353
|
}
|
|
4164
4354
|
// @__NO_SIDE_EFFECTS__
|
|
4165
|
-
function emoji(
|
|
4355
|
+
function emoji(message$1) {
|
|
4166
4356
|
return {
|
|
4167
4357
|
kind: "validation",
|
|
4168
4358
|
type: "emoji",
|
|
@@ -4170,17 +4360,15 @@ function emoji(message2) {
|
|
|
4170
4360
|
async: false,
|
|
4171
4361
|
expects: null,
|
|
4172
4362
|
requirement: EMOJI_REGEX,
|
|
4173
|
-
message:
|
|
4174
|
-
"~run"(dataset,
|
|
4175
|
-
if (dataset.typed && !this.requirement.test(dataset.value))
|
|
4176
|
-
_addIssue(this, "emoji", dataset, config2);
|
|
4177
|
-
}
|
|
4363
|
+
message: message$1,
|
|
4364
|
+
"~run"(dataset, config$1) {
|
|
4365
|
+
if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "emoji", dataset, config$1);
|
|
4178
4366
|
return dataset;
|
|
4179
4367
|
}
|
|
4180
4368
|
};
|
|
4181
4369
|
}
|
|
4182
4370
|
// @__NO_SIDE_EFFECTS__
|
|
4183
|
-
function ip(
|
|
4371
|
+
function ip(message$1) {
|
|
4184
4372
|
return {
|
|
4185
4373
|
kind: "validation",
|
|
4186
4374
|
type: "ip",
|
|
@@ -4188,17 +4376,15 @@ function ip(message2) {
|
|
|
4188
4376
|
async: false,
|
|
4189
4377
|
expects: null,
|
|
4190
4378
|
requirement: IP_REGEX,
|
|
4191
|
-
message:
|
|
4192
|
-
"~run"(dataset,
|
|
4193
|
-
if (dataset.typed && !this.requirement.test(dataset.value))
|
|
4194
|
-
_addIssue(this, "IP", dataset, config2);
|
|
4195
|
-
}
|
|
4379
|
+
message: message$1,
|
|
4380
|
+
"~run"(dataset, config$1) {
|
|
4381
|
+
if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "IP", dataset, config$1);
|
|
4196
4382
|
return dataset;
|
|
4197
4383
|
}
|
|
4198
4384
|
};
|
|
4199
4385
|
}
|
|
4200
4386
|
// @__NO_SIDE_EFFECTS__
|
|
4201
|
-
function ipv4(
|
|
4387
|
+
function ipv4(message$1) {
|
|
4202
4388
|
return {
|
|
4203
4389
|
kind: "validation",
|
|
4204
4390
|
type: "ipv4",
|
|
@@ -4206,17 +4392,15 @@ function ipv4(message2) {
|
|
|
4206
4392
|
async: false,
|
|
4207
4393
|
expects: null,
|
|
4208
4394
|
requirement: IPV4_REGEX,
|
|
4209
|
-
message:
|
|
4210
|
-
"~run"(dataset,
|
|
4211
|
-
if (dataset.typed && !this.requirement.test(dataset.value))
|
|
4212
|
-
_addIssue(this, "IPv4", dataset, config2);
|
|
4213
|
-
}
|
|
4395
|
+
message: message$1,
|
|
4396
|
+
"~run"(dataset, config$1) {
|
|
4397
|
+
if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "IPv4", dataset, config$1);
|
|
4214
4398
|
return dataset;
|
|
4215
4399
|
}
|
|
4216
4400
|
};
|
|
4217
4401
|
}
|
|
4218
4402
|
// @__NO_SIDE_EFFECTS__
|
|
4219
|
-
function ipv6(
|
|
4403
|
+
function ipv6(message$1) {
|
|
4220
4404
|
return {
|
|
4221
4405
|
kind: "validation",
|
|
4222
4406
|
type: "ipv6",
|
|
@@ -4224,17 +4408,15 @@ function ipv6(message2) {
|
|
|
4224
4408
|
async: false,
|
|
4225
4409
|
expects: null,
|
|
4226
4410
|
requirement: IPV6_REGEX,
|
|
4227
|
-
message:
|
|
4228
|
-
"~run"(dataset,
|
|
4229
|
-
if (dataset.typed && !this.requirement.test(dataset.value))
|
|
4230
|
-
_addIssue(this, "IPv6", dataset, config2);
|
|
4231
|
-
}
|
|
4411
|
+
message: message$1,
|
|
4412
|
+
"~run"(dataset, config$1) {
|
|
4413
|
+
if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "IPv6", dataset, config$1);
|
|
4232
4414
|
return dataset;
|
|
4233
4415
|
}
|
|
4234
4416
|
};
|
|
4235
4417
|
}
|
|
4236
4418
|
// @__NO_SIDE_EFFECTS__
|
|
4237
|
-
function isoDate(
|
|
4419
|
+
function isoDate(message$1) {
|
|
4238
4420
|
return {
|
|
4239
4421
|
kind: "validation",
|
|
4240
4422
|
type: "iso_date",
|
|
@@ -4242,17 +4424,15 @@ function isoDate(message2) {
|
|
|
4242
4424
|
async: false,
|
|
4243
4425
|
expects: null,
|
|
4244
4426
|
requirement: ISO_DATE_REGEX,
|
|
4245
|
-
message:
|
|
4246
|
-
"~run"(dataset,
|
|
4247
|
-
if (dataset.typed && !this.requirement.test(dataset.value))
|
|
4248
|
-
_addIssue(this, "date", dataset, config2);
|
|
4249
|
-
}
|
|
4427
|
+
message: message$1,
|
|
4428
|
+
"~run"(dataset, config$1) {
|
|
4429
|
+
if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "date", dataset, config$1);
|
|
4250
4430
|
return dataset;
|
|
4251
4431
|
}
|
|
4252
4432
|
};
|
|
4253
4433
|
}
|
|
4254
4434
|
// @__NO_SIDE_EFFECTS__
|
|
4255
|
-
function isoDateTime(
|
|
4435
|
+
function isoDateTime(message$1) {
|
|
4256
4436
|
return {
|
|
4257
4437
|
kind: "validation",
|
|
4258
4438
|
type: "iso_date_time",
|
|
@@ -4260,17 +4440,15 @@ function isoDateTime(message2) {
|
|
|
4260
4440
|
async: false,
|
|
4261
4441
|
expects: null,
|
|
4262
4442
|
requirement: ISO_DATE_TIME_REGEX,
|
|
4263
|
-
message:
|
|
4264
|
-
"~run"(dataset,
|
|
4265
|
-
if (dataset.typed && !this.requirement.test(dataset.value))
|
|
4266
|
-
_addIssue(this, "date-time", dataset, config2);
|
|
4267
|
-
}
|
|
4443
|
+
message: message$1,
|
|
4444
|
+
"~run"(dataset, config$1) {
|
|
4445
|
+
if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "date-time", dataset, config$1);
|
|
4268
4446
|
return dataset;
|
|
4269
4447
|
}
|
|
4270
4448
|
};
|
|
4271
4449
|
}
|
|
4272
4450
|
// @__NO_SIDE_EFFECTS__
|
|
4273
|
-
function isoTime(
|
|
4451
|
+
function isoTime(message$1) {
|
|
4274
4452
|
return {
|
|
4275
4453
|
kind: "validation",
|
|
4276
4454
|
type: "iso_time",
|
|
@@ -4278,17 +4456,15 @@ function isoTime(message2) {
|
|
|
4278
4456
|
async: false,
|
|
4279
4457
|
expects: null,
|
|
4280
4458
|
requirement: ISO_TIME_REGEX,
|
|
4281
|
-
message:
|
|
4282
|
-
"~run"(dataset,
|
|
4283
|
-
if (dataset.typed && !this.requirement.test(dataset.value))
|
|
4284
|
-
_addIssue(this, "time", dataset, config2);
|
|
4285
|
-
}
|
|
4459
|
+
message: message$1,
|
|
4460
|
+
"~run"(dataset, config$1) {
|
|
4461
|
+
if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "time", dataset, config$1);
|
|
4286
4462
|
return dataset;
|
|
4287
4463
|
}
|
|
4288
4464
|
};
|
|
4289
4465
|
}
|
|
4290
4466
|
// @__NO_SIDE_EFFECTS__
|
|
4291
|
-
function isoTimeSecond(
|
|
4467
|
+
function isoTimeSecond(message$1) {
|
|
4292
4468
|
return {
|
|
4293
4469
|
kind: "validation",
|
|
4294
4470
|
type: "iso_time_second",
|
|
@@ -4296,17 +4472,15 @@ function isoTimeSecond(message2) {
|
|
|
4296
4472
|
async: false,
|
|
4297
4473
|
expects: null,
|
|
4298
4474
|
requirement: ISO_TIME_SECOND_REGEX,
|
|
4299
|
-
message:
|
|
4300
|
-
"~run"(dataset,
|
|
4301
|
-
if (dataset.typed && !this.requirement.test(dataset.value))
|
|
4302
|
-
_addIssue(this, "time-second", dataset, config2);
|
|
4303
|
-
}
|
|
4475
|
+
message: message$1,
|
|
4476
|
+
"~run"(dataset, config$1) {
|
|
4477
|
+
if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "time-second", dataset, config$1);
|
|
4304
4478
|
return dataset;
|
|
4305
4479
|
}
|
|
4306
4480
|
};
|
|
4307
4481
|
}
|
|
4308
4482
|
// @__NO_SIDE_EFFECTS__
|
|
4309
|
-
function isoTimestamp(
|
|
4483
|
+
function isoTimestamp(message$1) {
|
|
4310
4484
|
return {
|
|
4311
4485
|
kind: "validation",
|
|
4312
4486
|
type: "iso_timestamp",
|
|
@@ -4314,17 +4488,15 @@ function isoTimestamp(message2) {
|
|
|
4314
4488
|
async: false,
|
|
4315
4489
|
expects: null,
|
|
4316
4490
|
requirement: ISO_TIMESTAMP_REGEX,
|
|
4317
|
-
message:
|
|
4318
|
-
"~run"(dataset,
|
|
4319
|
-
if (dataset.typed && !this.requirement.test(dataset.value))
|
|
4320
|
-
_addIssue(this, "timestamp", dataset, config2);
|
|
4321
|
-
}
|
|
4491
|
+
message: message$1,
|
|
4492
|
+
"~run"(dataset, config$1) {
|
|
4493
|
+
if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "timestamp", dataset, config$1);
|
|
4322
4494
|
return dataset;
|
|
4323
4495
|
}
|
|
4324
4496
|
};
|
|
4325
4497
|
}
|
|
4326
4498
|
// @__NO_SIDE_EFFECTS__
|
|
4327
|
-
function isoWeek(
|
|
4499
|
+
function isoWeek(message$1) {
|
|
4328
4500
|
return {
|
|
4329
4501
|
kind: "validation",
|
|
4330
4502
|
type: "iso_week",
|
|
@@ -4332,17 +4504,15 @@ function isoWeek(message2) {
|
|
|
4332
4504
|
async: false,
|
|
4333
4505
|
expects: null,
|
|
4334
4506
|
requirement: ISO_WEEK_REGEX,
|
|
4335
|
-
message:
|
|
4336
|
-
"~run"(dataset,
|
|
4337
|
-
if (dataset.typed && !this.requirement.test(dataset.value))
|
|
4338
|
-
_addIssue(this, "week", dataset, config2);
|
|
4339
|
-
}
|
|
4507
|
+
message: message$1,
|
|
4508
|
+
"~run"(dataset, config$1) {
|
|
4509
|
+
if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "week", dataset, config$1);
|
|
4340
4510
|
return dataset;
|
|
4341
4511
|
}
|
|
4342
4512
|
};
|
|
4343
4513
|
}
|
|
4344
4514
|
// @__NO_SIDE_EFFECTS__
|
|
4345
|
-
function mac(
|
|
4515
|
+
function mac(message$1) {
|
|
4346
4516
|
return {
|
|
4347
4517
|
kind: "validation",
|
|
4348
4518
|
type: "mac",
|
|
@@ -4350,17 +4520,15 @@ function mac(message2) {
|
|
|
4350
4520
|
async: false,
|
|
4351
4521
|
expects: null,
|
|
4352
4522
|
requirement: MAC_REGEX,
|
|
4353
|
-
message:
|
|
4354
|
-
"~run"(dataset,
|
|
4355
|
-
if (dataset.typed && !this.requirement.test(dataset.value))
|
|
4356
|
-
_addIssue(this, "MAC", dataset, config2);
|
|
4357
|
-
}
|
|
4523
|
+
message: message$1,
|
|
4524
|
+
"~run"(dataset, config$1) {
|
|
4525
|
+
if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "MAC", dataset, config$1);
|
|
4358
4526
|
return dataset;
|
|
4359
4527
|
}
|
|
4360
4528
|
};
|
|
4361
4529
|
}
|
|
4362
4530
|
// @__NO_SIDE_EFFECTS__
|
|
4363
|
-
function mac48(
|
|
4531
|
+
function mac48(message$1) {
|
|
4364
4532
|
return {
|
|
4365
4533
|
kind: "validation",
|
|
4366
4534
|
type: "mac48",
|
|
@@ -4368,17 +4536,15 @@ function mac48(message2) {
|
|
|
4368
4536
|
async: false,
|
|
4369
4537
|
expects: null,
|
|
4370
4538
|
requirement: MAC48_REGEX,
|
|
4371
|
-
message:
|
|
4372
|
-
"~run"(dataset,
|
|
4373
|
-
if (dataset.typed && !this.requirement.test(dataset.value))
|
|
4374
|
-
_addIssue(this, "48-bit MAC", dataset, config2);
|
|
4375
|
-
}
|
|
4539
|
+
message: message$1,
|
|
4540
|
+
"~run"(dataset, config$1) {
|
|
4541
|
+
if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "48-bit MAC", dataset, config$1);
|
|
4376
4542
|
return dataset;
|
|
4377
4543
|
}
|
|
4378
4544
|
};
|
|
4379
4545
|
}
|
|
4380
4546
|
// @__NO_SIDE_EFFECTS__
|
|
4381
|
-
function mac64(
|
|
4547
|
+
function mac64(message$1) {
|
|
4382
4548
|
return {
|
|
4383
4549
|
kind: "validation",
|
|
4384
4550
|
type: "mac64",
|
|
@@ -4386,17 +4552,15 @@ function mac64(message2) {
|
|
|
4386
4552
|
async: false,
|
|
4387
4553
|
expects: null,
|
|
4388
4554
|
requirement: MAC64_REGEX,
|
|
4389
|
-
message:
|
|
4390
|
-
"~run"(dataset,
|
|
4391
|
-
if (dataset.typed && !this.requirement.test(dataset.value))
|
|
4392
|
-
_addIssue(this, "64-bit MAC", dataset, config2);
|
|
4393
|
-
}
|
|
4555
|
+
message: message$1,
|
|
4556
|
+
"~run"(dataset, config$1) {
|
|
4557
|
+
if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "64-bit MAC", dataset, config$1);
|
|
4394
4558
|
return dataset;
|
|
4395
4559
|
}
|
|
4396
4560
|
};
|
|
4397
4561
|
}
|
|
4398
4562
|
// @__NO_SIDE_EFFECTS__
|
|
4399
|
-
function nanoid(
|
|
4563
|
+
function nanoid(message$1) {
|
|
4400
4564
|
return {
|
|
4401
4565
|
kind: "validation",
|
|
4402
4566
|
type: "nanoid",
|
|
@@ -4404,17 +4568,15 @@ function nanoid(message2) {
|
|
|
4404
4568
|
async: false,
|
|
4405
4569
|
expects: null,
|
|
4406
4570
|
requirement: NANO_ID_REGEX,
|
|
4407
|
-
message:
|
|
4408
|
-
"~run"(dataset,
|
|
4409
|
-
if (dataset.typed && !this.requirement.test(dataset.value))
|
|
4410
|
-
_addIssue(this, "Nano ID", dataset, config2);
|
|
4411
|
-
}
|
|
4571
|
+
message: message$1,
|
|
4572
|
+
"~run"(dataset, config$1) {
|
|
4573
|
+
if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "Nano ID", dataset, config$1);
|
|
4412
4574
|
return dataset;
|
|
4413
4575
|
}
|
|
4414
4576
|
};
|
|
4415
4577
|
}
|
|
4416
4578
|
// @__NO_SIDE_EFFECTS__
|
|
4417
|
-
function octal(
|
|
4579
|
+
function octal(message$1) {
|
|
4418
4580
|
return {
|
|
4419
4581
|
kind: "validation",
|
|
4420
4582
|
type: "octal",
|
|
@@ -4422,17 +4584,15 @@ function octal(message2) {
|
|
|
4422
4584
|
async: false,
|
|
4423
4585
|
expects: null,
|
|
4424
4586
|
requirement: OCTAL_REGEX,
|
|
4425
|
-
message:
|
|
4426
|
-
"~run"(dataset,
|
|
4427
|
-
if (dataset.typed && !this.requirement.test(dataset.value))
|
|
4428
|
-
_addIssue(this, "octal", dataset, config2);
|
|
4429
|
-
}
|
|
4587
|
+
message: message$1,
|
|
4588
|
+
"~run"(dataset, config$1) {
|
|
4589
|
+
if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "octal", dataset, config$1);
|
|
4430
4590
|
return dataset;
|
|
4431
4591
|
}
|
|
4432
4592
|
};
|
|
4433
4593
|
}
|
|
4434
4594
|
// @__NO_SIDE_EFFECTS__
|
|
4435
|
-
function ulid(
|
|
4595
|
+
function ulid(message$1) {
|
|
4436
4596
|
return {
|
|
4437
4597
|
kind: "validation",
|
|
4438
4598
|
type: "ulid",
|
|
@@ -4440,17 +4600,15 @@ function ulid(message2) {
|
|
|
4440
4600
|
async: false,
|
|
4441
4601
|
expects: null,
|
|
4442
4602
|
requirement: ULID_REGEX,
|
|
4443
|
-
message:
|
|
4444
|
-
"~run"(dataset,
|
|
4445
|
-
if (dataset.typed && !this.requirement.test(dataset.value))
|
|
4446
|
-
_addIssue(this, "ULID", dataset, config2);
|
|
4447
|
-
}
|
|
4603
|
+
message: message$1,
|
|
4604
|
+
"~run"(dataset, config$1) {
|
|
4605
|
+
if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "ULID", dataset, config$1);
|
|
4448
4606
|
return dataset;
|
|
4449
4607
|
}
|
|
4450
4608
|
};
|
|
4451
4609
|
}
|
|
4452
4610
|
// @__NO_SIDE_EFFECTS__
|
|
4453
|
-
function url(
|
|
4611
|
+
function url(message$1) {
|
|
4454
4612
|
return {
|
|
4455
4613
|
kind: "validation",
|
|
4456
4614
|
type: "url",
|
|
@@ -4465,17 +4623,15 @@ function url(message2) {
|
|
|
4465
4623
|
return false;
|
|
4466
4624
|
}
|
|
4467
4625
|
},
|
|
4468
|
-
message:
|
|
4469
|
-
"~run"(dataset,
|
|
4470
|
-
if (dataset.typed && !this.requirement(dataset.value))
|
|
4471
|
-
_addIssue(this, "URL", dataset, config2);
|
|
4472
|
-
}
|
|
4626
|
+
message: message$1,
|
|
4627
|
+
"~run"(dataset, config$1) {
|
|
4628
|
+
if (dataset.typed && !this.requirement(dataset.value)) _addIssue(this, "URL", dataset, config$1);
|
|
4473
4629
|
return dataset;
|
|
4474
4630
|
}
|
|
4475
4631
|
};
|
|
4476
4632
|
}
|
|
4477
4633
|
// @__NO_SIDE_EFFECTS__
|
|
4478
|
-
function uuid(
|
|
4634
|
+
function uuid(message$1) {
|
|
4479
4635
|
return {
|
|
4480
4636
|
kind: "validation",
|
|
4481
4637
|
type: "uuid",
|
|
@@ -4483,64 +4639,55 @@ function uuid(message2) {
|
|
|
4483
4639
|
async: false,
|
|
4484
4640
|
expects: null,
|
|
4485
4641
|
requirement: UUID_REGEX,
|
|
4486
|
-
message:
|
|
4487
|
-
"~run"(dataset,
|
|
4488
|
-
if (dataset.typed && !this.requirement.test(dataset.value))
|
|
4489
|
-
_addIssue(this, "UUID", dataset, config2);
|
|
4490
|
-
}
|
|
4642
|
+
message: message$1,
|
|
4643
|
+
"~run"(dataset, config$1) {
|
|
4644
|
+
if (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, "UUID", dataset, config$1);
|
|
4491
4645
|
return dataset;
|
|
4492
4646
|
}
|
|
4493
4647
|
};
|
|
4494
4648
|
}
|
|
4495
4649
|
// @__NO_SIDE_EFFECTS__
|
|
4496
|
-
function string(
|
|
4650
|
+
function string(message$1) {
|
|
4497
4651
|
return {
|
|
4498
4652
|
kind: "schema",
|
|
4499
4653
|
type: "string",
|
|
4500
4654
|
reference: string,
|
|
4501
4655
|
expects: "string",
|
|
4502
4656
|
async: false,
|
|
4503
|
-
message:
|
|
4657
|
+
message: message$1,
|
|
4504
4658
|
get "~standard"() {
|
|
4505
4659
|
return /* @__PURE__ */ _getStandardProps(this);
|
|
4506
4660
|
},
|
|
4507
|
-
"~run"(dataset,
|
|
4508
|
-
if (typeof dataset.value === "string")
|
|
4509
|
-
|
|
4510
|
-
} else {
|
|
4511
|
-
_addIssue(this, "type", dataset, config2);
|
|
4512
|
-
}
|
|
4661
|
+
"~run"(dataset, config$1) {
|
|
4662
|
+
if (typeof dataset.value === "string") dataset.typed = true;
|
|
4663
|
+
else _addIssue(this, "type", dataset, config$1);
|
|
4513
4664
|
return dataset;
|
|
4514
4665
|
}
|
|
4515
4666
|
};
|
|
4516
4667
|
}
|
|
4517
4668
|
// @__NO_SIDE_EFFECTS__
|
|
4518
|
-
function pipe(...
|
|
4669
|
+
function pipe(...pipe$1) {
|
|
4519
4670
|
return {
|
|
4520
|
-
...
|
|
4521
|
-
pipe:
|
|
4671
|
+
...pipe$1[0],
|
|
4672
|
+
pipe: pipe$1,
|
|
4522
4673
|
get "~standard"() {
|
|
4523
4674
|
return /* @__PURE__ */ _getStandardProps(this);
|
|
4524
4675
|
},
|
|
4525
|
-
"~run"(dataset,
|
|
4526
|
-
for (const item of
|
|
4527
|
-
if (item.kind
|
|
4528
|
-
|
|
4529
|
-
|
|
4530
|
-
break;
|
|
4531
|
-
}
|
|
4532
|
-
if (!dataset.issues || !config2.abortEarly && !config2.abortPipeEarly) {
|
|
4533
|
-
dataset = item["~run"](dataset, config2);
|
|
4534
|
-
}
|
|
4676
|
+
"~run"(dataset, config$1) {
|
|
4677
|
+
for (const item of pipe$1) if (item.kind !== "metadata") {
|
|
4678
|
+
if (dataset.issues && (item.kind === "schema" || item.kind === "transformation")) {
|
|
4679
|
+
dataset.typed = false;
|
|
4680
|
+
break;
|
|
4535
4681
|
}
|
|
4682
|
+
if (!dataset.issues || !config$1.abortEarly && !config$1.abortPipeEarly) dataset = item["~run"](dataset, config$1);
|
|
4536
4683
|
}
|
|
4537
4684
|
return dataset;
|
|
4538
4685
|
}
|
|
4539
4686
|
};
|
|
4540
4687
|
}
|
|
4541
4688
|
// @__NO_SIDE_EFFECTS__
|
|
4542
|
-
function safeParse(schema, input,
|
|
4543
|
-
const dataset = schema["~run"]({ value: input }, /* @__PURE__ */ getGlobalConfig(
|
|
4689
|
+
function safeParse(schema, input, config$1) {
|
|
4690
|
+
const dataset = schema["~run"]({ value: input }, /* @__PURE__ */ getGlobalConfig(config$1));
|
|
4544
4691
|
return {
|
|
4545
4692
|
typed: dataset.typed,
|
|
4546
4693
|
success: !dataset.issues,
|
|
@@ -4845,30 +4992,39 @@ var NEVER = Object.freeze({
|
|
|
4845
4992
|
// @__NO_SIDE_EFFECTS__
|
|
4846
4993
|
function $constructor(name, initializer3, params) {
|
|
4847
4994
|
function init(inst, def) {
|
|
4848
|
-
|
|
4849
|
-
|
|
4850
|
-
|
|
4851
|
-
|
|
4852
|
-
|
|
4853
|
-
|
|
4995
|
+
if (!inst._zod) {
|
|
4996
|
+
Object.defineProperty(inst, "_zod", {
|
|
4997
|
+
value: {
|
|
4998
|
+
def,
|
|
4999
|
+
constr: _,
|
|
5000
|
+
traits: /* @__PURE__ */ new Set()
|
|
5001
|
+
},
|
|
5002
|
+
enumerable: false
|
|
5003
|
+
});
|
|
5004
|
+
}
|
|
5005
|
+
if (inst._zod.traits.has(name)) {
|
|
5006
|
+
return;
|
|
5007
|
+
}
|
|
4854
5008
|
inst._zod.traits.add(name);
|
|
4855
5009
|
initializer3(inst, def);
|
|
4856
|
-
|
|
4857
|
-
|
|
4858
|
-
|
|
5010
|
+
const proto = _.prototype;
|
|
5011
|
+
const keys = Object.keys(proto);
|
|
5012
|
+
for (let i = 0; i < keys.length; i++) {
|
|
5013
|
+
const k = keys[i];
|
|
5014
|
+
if (!(k in inst)) {
|
|
5015
|
+
inst[k] = proto[k].bind(inst);
|
|
5016
|
+
}
|
|
4859
5017
|
}
|
|
4860
|
-
inst._zod.constr = _;
|
|
4861
|
-
inst._zod.def = def;
|
|
4862
5018
|
}
|
|
4863
5019
|
const Parent = params?.Parent ?? Object;
|
|
4864
5020
|
class Definition extends Parent {
|
|
4865
5021
|
}
|
|
4866
5022
|
Object.defineProperty(Definition, "name", { value: name });
|
|
4867
5023
|
function _(def) {
|
|
4868
|
-
var
|
|
5024
|
+
var _a2;
|
|
4869
5025
|
const inst = params?.Parent ? new Definition() : this;
|
|
4870
5026
|
init(inst, def);
|
|
4871
|
-
(
|
|
5027
|
+
(_a2 = inst._zod).deferred ?? (_a2.deferred = []);
|
|
4872
5028
|
for (const fn of inst._zod.deferred) {
|
|
4873
5029
|
fn();
|
|
4874
5030
|
}
|
|
@@ -4885,7 +5041,6 @@ function $constructor(name, initializer3, params) {
|
|
|
4885
5041
|
Object.defineProperty(_, "name", { value: name });
|
|
4886
5042
|
return _;
|
|
4887
5043
|
}
|
|
4888
|
-
var $brand = Symbol("zod_brand");
|
|
4889
5044
|
var $ZodAsyncError = class extends Error {
|
|
4890
5045
|
constructor() {
|
|
4891
5046
|
super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`);
|
|
@@ -4962,6 +5117,7 @@ __export(util_exports, {
|
|
|
4962
5117
|
required: () => required,
|
|
4963
5118
|
safeExtend: () => safeExtend,
|
|
4964
5119
|
shallowClone: () => shallowClone,
|
|
5120
|
+
slugify: () => slugify,
|
|
4965
5121
|
stringifyPrimitive: () => stringifyPrimitive,
|
|
4966
5122
|
uint8ArrayToBase64: () => uint8ArrayToBase64,
|
|
4967
5123
|
uint8ArrayToBase64url: () => uint8ArrayToBase64url,
|
|
@@ -4977,7 +5133,7 @@ function assertNotEqual(val) {
|
|
|
4977
5133
|
function assertIs(_arg) {
|
|
4978
5134
|
}
|
|
4979
5135
|
function assertNever(_x) {
|
|
4980
|
-
throw new Error();
|
|
5136
|
+
throw new Error("Unexpected value in exhaustive check");
|
|
4981
5137
|
}
|
|
4982
5138
|
function assert(_) {
|
|
4983
5139
|
}
|
|
@@ -5030,7 +5186,7 @@ function floatSafeRemainder(val, step) {
|
|
|
5030
5186
|
const stepInt = Number.parseInt(step.toFixed(decCount).replace(".", ""));
|
|
5031
5187
|
return valInt % stepInt / 10 ** decCount;
|
|
5032
5188
|
}
|
|
5033
|
-
var EVALUATING = Symbol("evaluating");
|
|
5189
|
+
var EVALUATING = /* @__PURE__ */ Symbol("evaluating");
|
|
5034
5190
|
function defineLazy(object, key, getter) {
|
|
5035
5191
|
let value = void 0;
|
|
5036
5192
|
Object.defineProperty(object, key, {
|
|
@@ -5102,6 +5258,9 @@ function randomString(length = 10) {
|
|
|
5102
5258
|
function esc(str) {
|
|
5103
5259
|
return JSON.stringify(str);
|
|
5104
5260
|
}
|
|
5261
|
+
function slugify(input) {
|
|
5262
|
+
return input.toLowerCase().trim().replace(/[^\w\s-]/g, "").replace(/[\s_-]+/g, "-").replace(/^-+|-+$/g, "");
|
|
5263
|
+
}
|
|
5105
5264
|
var captureStackTrace = "captureStackTrace" in Error ? Error.captureStackTrace : (..._args) => {
|
|
5106
5265
|
};
|
|
5107
5266
|
function isObject(data) {
|
|
@@ -5125,6 +5284,8 @@ function isPlainObject(o) {
|
|
|
5125
5284
|
const ctor = o.constructor;
|
|
5126
5285
|
if (ctor === void 0)
|
|
5127
5286
|
return true;
|
|
5287
|
+
if (typeof ctor !== "function")
|
|
5288
|
+
return true;
|
|
5128
5289
|
const prot = ctor.prototype;
|
|
5129
5290
|
if (isObject(prot) === false)
|
|
5130
5291
|
return false;
|
|
@@ -5441,8 +5602,8 @@ function aborted(x, startIndex = 0) {
|
|
|
5441
5602
|
}
|
|
5442
5603
|
function prefixIssues(path, issues) {
|
|
5443
5604
|
return issues.map((iss) => {
|
|
5444
|
-
var
|
|
5445
|
-
(
|
|
5605
|
+
var _a2;
|
|
5606
|
+
(_a2 = iss).path ?? (_a2.path = []);
|
|
5446
5607
|
iss.path.unshift(path);
|
|
5447
5608
|
return iss;
|
|
5448
5609
|
});
|
|
@@ -5570,10 +5731,7 @@ function flattenError(error, mapper = (issue2) => issue2.message) {
|
|
|
5570
5731
|
}
|
|
5571
5732
|
return { formErrors, fieldErrors };
|
|
5572
5733
|
}
|
|
5573
|
-
function formatError(error,
|
|
5574
|
-
const mapper = _mapper || function(issue2) {
|
|
5575
|
-
return issue2.message;
|
|
5576
|
-
};
|
|
5734
|
+
function formatError(error, mapper = (issue2) => issue2.message) {
|
|
5577
5735
|
const fieldErrors = { _errors: [] };
|
|
5578
5736
|
const processError = (error2) => {
|
|
5579
5737
|
for (const issue2 of error2.issues) {
|
|
@@ -5710,7 +5868,6 @@ var cidrv4 = /^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]
|
|
|
5710
5868
|
var cidrv6 = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/;
|
|
5711
5869
|
var base642 = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/;
|
|
5712
5870
|
var base64url = /^[A-Za-z0-9_-]*$/;
|
|
5713
|
-
var hostname = /^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/;
|
|
5714
5871
|
var e164 = /^\+(?:[0-9]){6,14}[0-9]$/;
|
|
5715
5872
|
var dateSource = `(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`;
|
|
5716
5873
|
var date = /* @__PURE__ */ new RegExp(`^${dateSource}$`);
|
|
@@ -5747,10 +5904,10 @@ var uppercase = /^[^a-z]*$/;
|
|
|
5747
5904
|
|
|
5748
5905
|
// node_modules/zod/v4/core/checks.js
|
|
5749
5906
|
var $ZodCheck = /* @__PURE__ */ $constructor("$ZodCheck", (inst, def) => {
|
|
5750
|
-
var
|
|
5907
|
+
var _a2;
|
|
5751
5908
|
inst._zod ?? (inst._zod = {});
|
|
5752
5909
|
inst._zod.def = def;
|
|
5753
|
-
(
|
|
5910
|
+
(_a2 = inst._zod).onattach ?? (_a2.onattach = []);
|
|
5754
5911
|
});
|
|
5755
5912
|
var numericOriginMap = {
|
|
5756
5913
|
number: "number",
|
|
@@ -5816,8 +5973,8 @@ var $ZodCheckGreaterThan = /* @__PURE__ */ $constructor("$ZodCheckGreaterThan",
|
|
|
5816
5973
|
var $ZodCheckMultipleOf = /* @__PURE__ */ $constructor("$ZodCheckMultipleOf", (inst, def) => {
|
|
5817
5974
|
$ZodCheck.init(inst, def);
|
|
5818
5975
|
inst._zod.onattach.push((inst2) => {
|
|
5819
|
-
var
|
|
5820
|
-
(
|
|
5976
|
+
var _a2;
|
|
5977
|
+
(_a2 = inst2._zod.bag).multipleOf ?? (_a2.multipleOf = def.value);
|
|
5821
5978
|
});
|
|
5822
5979
|
inst._zod.check = (payload) => {
|
|
5823
5980
|
if (typeof payload.value !== typeof def.value)
|
|
@@ -5911,9 +6068,9 @@ var $ZodCheckNumberFormat = /* @__PURE__ */ $constructor("$ZodCheckNumberFormat"
|
|
|
5911
6068
|
};
|
|
5912
6069
|
});
|
|
5913
6070
|
var $ZodCheckMaxLength = /* @__PURE__ */ $constructor("$ZodCheckMaxLength", (inst, def) => {
|
|
5914
|
-
var
|
|
6071
|
+
var _a2;
|
|
5915
6072
|
$ZodCheck.init(inst, def);
|
|
5916
|
-
(
|
|
6073
|
+
(_a2 = inst._zod.def).when ?? (_a2.when = (payload) => {
|
|
5917
6074
|
const val = payload.value;
|
|
5918
6075
|
return !nullish(val) && val.length !== void 0;
|
|
5919
6076
|
});
|
|
@@ -5940,9 +6097,9 @@ var $ZodCheckMaxLength = /* @__PURE__ */ $constructor("$ZodCheckMaxLength", (ins
|
|
|
5940
6097
|
};
|
|
5941
6098
|
});
|
|
5942
6099
|
var $ZodCheckMinLength = /* @__PURE__ */ $constructor("$ZodCheckMinLength", (inst, def) => {
|
|
5943
|
-
var
|
|
6100
|
+
var _a2;
|
|
5944
6101
|
$ZodCheck.init(inst, def);
|
|
5945
|
-
(
|
|
6102
|
+
(_a2 = inst._zod.def).when ?? (_a2.when = (payload) => {
|
|
5946
6103
|
const val = payload.value;
|
|
5947
6104
|
return !nullish(val) && val.length !== void 0;
|
|
5948
6105
|
});
|
|
@@ -5969,9 +6126,9 @@ var $ZodCheckMinLength = /* @__PURE__ */ $constructor("$ZodCheckMinLength", (ins
|
|
|
5969
6126
|
};
|
|
5970
6127
|
});
|
|
5971
6128
|
var $ZodCheckLengthEquals = /* @__PURE__ */ $constructor("$ZodCheckLengthEquals", (inst, def) => {
|
|
5972
|
-
var
|
|
6129
|
+
var _a2;
|
|
5973
6130
|
$ZodCheck.init(inst, def);
|
|
5974
|
-
(
|
|
6131
|
+
(_a2 = inst._zod.def).when ?? (_a2.when = (payload) => {
|
|
5975
6132
|
const val = payload.value;
|
|
5976
6133
|
return !nullish(val) && val.length !== void 0;
|
|
5977
6134
|
});
|
|
@@ -6000,7 +6157,7 @@ var $ZodCheckLengthEquals = /* @__PURE__ */ $constructor("$ZodCheckLengthEquals"
|
|
|
6000
6157
|
};
|
|
6001
6158
|
});
|
|
6002
6159
|
var $ZodCheckStringFormat = /* @__PURE__ */ $constructor("$ZodCheckStringFormat", (inst, def) => {
|
|
6003
|
-
var
|
|
6160
|
+
var _a2, _b;
|
|
6004
6161
|
$ZodCheck.init(inst, def);
|
|
6005
6162
|
inst._zod.onattach.push((inst2) => {
|
|
6006
6163
|
const bag = inst2._zod.bag;
|
|
@@ -6011,7 +6168,7 @@ var $ZodCheckStringFormat = /* @__PURE__ */ $constructor("$ZodCheckStringFormat"
|
|
|
6011
6168
|
}
|
|
6012
6169
|
});
|
|
6013
6170
|
if (def.pattern)
|
|
6014
|
-
(
|
|
6171
|
+
(_a2 = inst._zod).check ?? (_a2.check = (payload) => {
|
|
6015
6172
|
def.pattern.lastIndex = 0;
|
|
6016
6173
|
if (def.pattern.test(payload.value))
|
|
6017
6174
|
return;
|
|
@@ -6170,13 +6327,13 @@ var Doc = class {
|
|
|
6170
6327
|
// node_modules/zod/v4/core/versions.js
|
|
6171
6328
|
var version = {
|
|
6172
6329
|
major: 4,
|
|
6173
|
-
minor:
|
|
6174
|
-
patch:
|
|
6330
|
+
minor: 2,
|
|
6331
|
+
patch: 1
|
|
6175
6332
|
};
|
|
6176
6333
|
|
|
6177
6334
|
// node_modules/zod/v4/core/schemas.js
|
|
6178
6335
|
var $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
|
|
6179
|
-
var
|
|
6336
|
+
var _a2;
|
|
6180
6337
|
inst ?? (inst = {});
|
|
6181
6338
|
inst._zod.def = def;
|
|
6182
6339
|
inst._zod.bag = inst._zod.bag || {};
|
|
@@ -6191,7 +6348,7 @@ var $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
|
|
|
6191
6348
|
}
|
|
6192
6349
|
}
|
|
6193
6350
|
if (checks.length === 0) {
|
|
6194
|
-
(
|
|
6351
|
+
(_a2 = inst._zod).deferred ?? (_a2.deferred = []);
|
|
6195
6352
|
inst._zod.deferred?.push(() => {
|
|
6196
6353
|
inst._zod.run = inst._zod.parse;
|
|
6197
6354
|
});
|
|
@@ -6349,7 +6506,7 @@ var $ZodURL = /* @__PURE__ */ $constructor("$ZodURL", (inst, def) => {
|
|
|
6349
6506
|
code: "invalid_format",
|
|
6350
6507
|
format: "url",
|
|
6351
6508
|
note: "Invalid hostname",
|
|
6352
|
-
pattern: hostname.source,
|
|
6509
|
+
pattern: def.hostname.source,
|
|
6353
6510
|
input: payload.value,
|
|
6354
6511
|
inst,
|
|
6355
6512
|
continue: !def.abort
|
|
@@ -6434,18 +6591,12 @@ var $ZodISODuration = /* @__PURE__ */ $constructor("$ZodISODuration", (inst, def
|
|
|
6434
6591
|
var $ZodIPv4 = /* @__PURE__ */ $constructor("$ZodIPv4", (inst, def) => {
|
|
6435
6592
|
def.pattern ?? (def.pattern = ipv42);
|
|
6436
6593
|
$ZodStringFormat.init(inst, def);
|
|
6437
|
-
inst._zod.
|
|
6438
|
-
const bag = inst2._zod.bag;
|
|
6439
|
-
bag.format = `ipv4`;
|
|
6440
|
-
});
|
|
6594
|
+
inst._zod.bag.format = `ipv4`;
|
|
6441
6595
|
});
|
|
6442
6596
|
var $ZodIPv6 = /* @__PURE__ */ $constructor("$ZodIPv6", (inst, def) => {
|
|
6443
6597
|
def.pattern ?? (def.pattern = ipv62);
|
|
6444
6598
|
$ZodStringFormat.init(inst, def);
|
|
6445
|
-
inst._zod.
|
|
6446
|
-
const bag = inst2._zod.bag;
|
|
6447
|
-
bag.format = `ipv6`;
|
|
6448
|
-
});
|
|
6599
|
+
inst._zod.bag.format = `ipv6`;
|
|
6449
6600
|
inst._zod.check = (payload) => {
|
|
6450
6601
|
try {
|
|
6451
6602
|
new URL(`http://[${payload.value}]`);
|
|
@@ -6507,9 +6658,7 @@ function isValidBase64(data) {
|
|
|
6507
6658
|
var $ZodBase64 = /* @__PURE__ */ $constructor("$ZodBase64", (inst, def) => {
|
|
6508
6659
|
def.pattern ?? (def.pattern = base642);
|
|
6509
6660
|
$ZodStringFormat.init(inst, def);
|
|
6510
|
-
inst._zod.
|
|
6511
|
-
inst2._zod.bag.contentEncoding = "base64";
|
|
6512
|
-
});
|
|
6661
|
+
inst._zod.bag.contentEncoding = "base64";
|
|
6513
6662
|
inst._zod.check = (payload) => {
|
|
6514
6663
|
if (isValidBase64(payload.value))
|
|
6515
6664
|
return;
|
|
@@ -6532,9 +6681,7 @@ function isValidBase64URL(data) {
|
|
|
6532
6681
|
var $ZodBase64URL = /* @__PURE__ */ $constructor("$ZodBase64URL", (inst, def) => {
|
|
6533
6682
|
def.pattern ?? (def.pattern = base64url);
|
|
6534
6683
|
$ZodStringFormat.init(inst, def);
|
|
6535
|
-
inst._zod.
|
|
6536
|
-
inst2._zod.bag.contentEncoding = "base64url";
|
|
6537
|
-
});
|
|
6684
|
+
inst._zod.bag.contentEncoding = "base64url";
|
|
6538
6685
|
inst._zod.check = (payload) => {
|
|
6539
6686
|
if (isValidBase64URL(payload.value))
|
|
6540
6687
|
return;
|
|
@@ -6609,7 +6756,7 @@ var $ZodNumber = /* @__PURE__ */ $constructor("$ZodNumber", (inst, def) => {
|
|
|
6609
6756
|
return payload;
|
|
6610
6757
|
};
|
|
6611
6758
|
});
|
|
6612
|
-
var $ZodNumberFormat = /* @__PURE__ */ $constructor("$
|
|
6759
|
+
var $ZodNumberFormat = /* @__PURE__ */ $constructor("$ZodNumberFormat", (inst, def) => {
|
|
6613
6760
|
$ZodCheckNumberFormat.init(inst, def);
|
|
6614
6761
|
$ZodNumber.init(inst, def);
|
|
6615
6762
|
});
|
|
@@ -6836,7 +6983,7 @@ function handleCatchall(proms, input, payload, ctx, def, inst) {
|
|
|
6836
6983
|
const keySet = def.keySet;
|
|
6837
6984
|
const _catchall = def.catchall._zod;
|
|
6838
6985
|
const t2 = _catchall.def.type;
|
|
6839
|
-
for (const key
|
|
6986
|
+
for (const key in input) {
|
|
6840
6987
|
if (keySet.has(key))
|
|
6841
6988
|
continue;
|
|
6842
6989
|
if (t2 === "never") {
|
|
@@ -6866,6 +7013,19 @@ function handleCatchall(proms, input, payload, ctx, def, inst) {
|
|
|
6866
7013
|
}
|
|
6867
7014
|
var $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
|
|
6868
7015
|
$ZodType.init(inst, def);
|
|
7016
|
+
const desc = Object.getOwnPropertyDescriptor(def, "shape");
|
|
7017
|
+
if (!desc?.get) {
|
|
7018
|
+
const sh = def.shape;
|
|
7019
|
+
Object.defineProperty(def, "shape", {
|
|
7020
|
+
get: () => {
|
|
7021
|
+
const newSh = { ...sh };
|
|
7022
|
+
Object.defineProperty(def, "shape", {
|
|
7023
|
+
value: newSh
|
|
7024
|
+
});
|
|
7025
|
+
return newSh;
|
|
7026
|
+
}
|
|
7027
|
+
});
|
|
7028
|
+
}
|
|
6869
7029
|
const _normalized = cached(() => normalizeDef(def));
|
|
6870
7030
|
defineLazy(inst._zod, "propValues", () => {
|
|
6871
7031
|
const shape = def.shape;
|
|
@@ -7056,6 +7216,7 @@ var $ZodUnion = /* @__PURE__ */ $constructor("$ZodUnion", (inst, def) => {
|
|
|
7056
7216
|
};
|
|
7057
7217
|
});
|
|
7058
7218
|
var $ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("$ZodDiscriminatedUnion", (inst, def) => {
|
|
7219
|
+
def.inclusive = false;
|
|
7059
7220
|
$ZodUnion.init(inst, def);
|
|
7060
7221
|
const _super = inst._zod.parse;
|
|
7061
7222
|
defineLazy(inst._zod, "propValues", () => {
|
|
@@ -7198,7 +7359,6 @@ function handleIntersectionResults(result, left, right) {
|
|
|
7198
7359
|
var $ZodTuple = /* @__PURE__ */ $constructor("$ZodTuple", (inst, def) => {
|
|
7199
7360
|
$ZodType.init(inst, def);
|
|
7200
7361
|
const items = def.items;
|
|
7201
|
-
const optStart = items.length - [...items].reverse().findIndex((item) => item._zod.optin !== "optional");
|
|
7202
7362
|
inst._zod.parse = (payload, ctx) => {
|
|
7203
7363
|
const input = payload.value;
|
|
7204
7364
|
if (!Array.isArray(input)) {
|
|
@@ -7212,6 +7372,8 @@ var $ZodTuple = /* @__PURE__ */ $constructor("$ZodTuple", (inst, def) => {
|
|
|
7212
7372
|
}
|
|
7213
7373
|
payload.value = [];
|
|
7214
7374
|
const proms = [];
|
|
7375
|
+
const reversedIndex = [...items].reverse().findIndex((item) => item._zod.optin !== "optional");
|
|
7376
|
+
const optStart = reversedIndex === -1 ? 0 : items.length - reversedIndex;
|
|
7215
7377
|
if (!def.rest) {
|
|
7216
7378
|
const tooBig = input.length > items.length;
|
|
7217
7379
|
const tooSmall = input.length < optStart - 1;
|
|
@@ -7282,11 +7444,13 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
|
|
|
7282
7444
|
return payload;
|
|
7283
7445
|
}
|
|
7284
7446
|
const proms = [];
|
|
7285
|
-
|
|
7286
|
-
|
|
7447
|
+
const values = def.keyType._zod.values;
|
|
7448
|
+
if (values) {
|
|
7287
7449
|
payload.value = {};
|
|
7450
|
+
const recordKeys = /* @__PURE__ */ new Set();
|
|
7288
7451
|
for (const key of values) {
|
|
7289
7452
|
if (typeof key === "string" || typeof key === "number" || typeof key === "symbol") {
|
|
7453
|
+
recordKeys.add(typeof key === "number" ? key.toString() : key);
|
|
7290
7454
|
const result = def.valueType._zod.run({ value: input[key], issues: [] }, ctx);
|
|
7291
7455
|
if (result instanceof Promise) {
|
|
7292
7456
|
proms.push(result.then((result2) => {
|
|
@@ -7305,7 +7469,7 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
|
|
|
7305
7469
|
}
|
|
7306
7470
|
let unrecognized;
|
|
7307
7471
|
for (const key in input) {
|
|
7308
|
-
if (!
|
|
7472
|
+
if (!recordKeys.has(key)) {
|
|
7309
7473
|
unrecognized = unrecognized ?? [];
|
|
7310
7474
|
unrecognized.push(key);
|
|
7311
7475
|
}
|
|
@@ -7328,15 +7492,18 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
|
|
|
7328
7492
|
throw new Error("Async schemas not supported in object keys currently");
|
|
7329
7493
|
}
|
|
7330
7494
|
if (keyResult.issues.length) {
|
|
7331
|
-
|
|
7332
|
-
|
|
7333
|
-
|
|
7334
|
-
|
|
7335
|
-
|
|
7336
|
-
|
|
7337
|
-
|
|
7338
|
-
|
|
7339
|
-
|
|
7495
|
+
if (def.mode === "loose") {
|
|
7496
|
+
payload.value[key] = input[key];
|
|
7497
|
+
} else {
|
|
7498
|
+
payload.issues.push({
|
|
7499
|
+
code: "invalid_key",
|
|
7500
|
+
origin: "record",
|
|
7501
|
+
issues: keyResult.issues.map((iss) => finalizeIssue(iss, ctx, config())),
|
|
7502
|
+
input: key,
|
|
7503
|
+
path: [key],
|
|
7504
|
+
inst
|
|
7505
|
+
});
|
|
7506
|
+
}
|
|
7340
7507
|
continue;
|
|
7341
7508
|
}
|
|
7342
7509
|
const result = def.valueType._zod.run({ value: input[key], issues: [] }, ctx);
|
|
@@ -7386,11 +7553,12 @@ var $ZodLiteral = /* @__PURE__ */ $constructor("$ZodLiteral", (inst, def) => {
|
|
|
7386
7553
|
if (def.values.length === 0) {
|
|
7387
7554
|
throw new Error("Cannot create literal schema with no valid values");
|
|
7388
7555
|
}
|
|
7389
|
-
|
|
7556
|
+
const values = new Set(def.values);
|
|
7557
|
+
inst._zod.values = values;
|
|
7390
7558
|
inst._zod.pattern = new RegExp(`^(${def.values.map((o) => typeof o === "string" ? escapeRegex(o) : o ? escapeRegex(o.toString()) : String(o)).join("|")})$`);
|
|
7391
7559
|
inst._zod.parse = (payload, _ctx) => {
|
|
7392
7560
|
const input = payload.value;
|
|
7393
|
-
if (
|
|
7561
|
+
if (values.has(input)) {
|
|
7394
7562
|
return payload;
|
|
7395
7563
|
}
|
|
7396
7564
|
payload.issues.push({
|
|
@@ -7606,8 +7774,8 @@ var $ZodReadonly = /* @__PURE__ */ $constructor("$ZodReadonly", (inst, def) => {
|
|
|
7606
7774
|
$ZodType.init(inst, def);
|
|
7607
7775
|
defineLazy(inst._zod, "propValues", () => def.innerType._zod.propValues);
|
|
7608
7776
|
defineLazy(inst._zod, "values", () => def.innerType._zod.values);
|
|
7609
|
-
defineLazy(inst._zod, "optin", () => def.innerType
|
|
7610
|
-
defineLazy(inst._zod, "optout", () => def.innerType
|
|
7777
|
+
defineLazy(inst._zod, "optin", () => def.innerType?._zod?.optin);
|
|
7778
|
+
defineLazy(inst._zod, "optout", () => def.innerType?._zod?.optout);
|
|
7611
7779
|
inst._zod.parse = (payload, ctx) => {
|
|
7612
7780
|
if (ctx.direction === "backward") {
|
|
7613
7781
|
return def.innerType._zod.run(payload, ctx);
|
|
@@ -7664,21 +7832,20 @@ function handleRefineResult(result, payload, input, inst) {
|
|
|
7664
7832
|
}
|
|
7665
7833
|
|
|
7666
7834
|
// node_modules/zod/v4/core/registries.js
|
|
7667
|
-
var
|
|
7668
|
-
var $input = Symbol("ZodInput");
|
|
7835
|
+
var _a;
|
|
7669
7836
|
var $ZodRegistry = class {
|
|
7670
7837
|
constructor() {
|
|
7671
7838
|
this._map = /* @__PURE__ */ new WeakMap();
|
|
7672
7839
|
this._idmap = /* @__PURE__ */ new Map();
|
|
7673
7840
|
}
|
|
7674
7841
|
add(schema, ..._meta) {
|
|
7675
|
-
const
|
|
7676
|
-
this._map.set(schema,
|
|
7677
|
-
if (
|
|
7678
|
-
if (this._idmap.has(
|
|
7679
|
-
throw new Error(`ID ${
|
|
7842
|
+
const meta2 = _meta[0];
|
|
7843
|
+
this._map.set(schema, meta2);
|
|
7844
|
+
if (meta2 && typeof meta2 === "object" && "id" in meta2) {
|
|
7845
|
+
if (this._idmap.has(meta2.id)) {
|
|
7846
|
+
throw new Error(`ID ${meta2.id} already exists in the registry`);
|
|
7680
7847
|
}
|
|
7681
|
-
this._idmap.set(
|
|
7848
|
+
this._idmap.set(meta2.id, schema);
|
|
7682
7849
|
}
|
|
7683
7850
|
return this;
|
|
7684
7851
|
}
|
|
@@ -7688,9 +7855,9 @@ var $ZodRegistry = class {
|
|
|
7688
7855
|
return this;
|
|
7689
7856
|
}
|
|
7690
7857
|
remove(schema) {
|
|
7691
|
-
const
|
|
7692
|
-
if (
|
|
7693
|
-
this._idmap.delete(
|
|
7858
|
+
const meta2 = this._map.get(schema);
|
|
7859
|
+
if (meta2 && typeof meta2 === "object" && "id" in meta2) {
|
|
7860
|
+
this._idmap.delete(meta2.id);
|
|
7694
7861
|
}
|
|
7695
7862
|
this._map.delete(schema);
|
|
7696
7863
|
return this;
|
|
@@ -7712,7 +7879,8 @@ var $ZodRegistry = class {
|
|
|
7712
7879
|
function registry() {
|
|
7713
7880
|
return new $ZodRegistry();
|
|
7714
7881
|
}
|
|
7715
|
-
|
|
7882
|
+
(_a = globalThis).__zod_globalRegistry ?? (_a.__zod_globalRegistry = registry());
|
|
7883
|
+
var globalRegistry = globalThis.__zod_globalRegistry;
|
|
7716
7884
|
|
|
7717
7885
|
// node_modules/zod/v4/core/api.js
|
|
7718
7886
|
function _string(Class2, params) {
|
|
@@ -8103,6 +8271,9 @@ function _toLowerCase() {
|
|
|
8103
8271
|
function _toUpperCase() {
|
|
8104
8272
|
return _overwrite((input) => input.toUpperCase());
|
|
8105
8273
|
}
|
|
8274
|
+
function _slugify() {
|
|
8275
|
+
return _overwrite((input) => slugify(input));
|
|
8276
|
+
}
|
|
8106
8277
|
function _array(Class2, element, params) {
|
|
8107
8278
|
return new Class2({
|
|
8108
8279
|
type: "array",
|
|
@@ -8151,6 +8322,701 @@ function _check(fn, params) {
|
|
|
8151
8322
|
return ch;
|
|
8152
8323
|
}
|
|
8153
8324
|
|
|
8325
|
+
// node_modules/zod/v4/core/to-json-schema.js
|
|
8326
|
+
function initializeContext(params) {
|
|
8327
|
+
let target = params?.target ?? "draft-2020-12";
|
|
8328
|
+
if (target === "draft-4")
|
|
8329
|
+
target = "draft-04";
|
|
8330
|
+
if (target === "draft-7")
|
|
8331
|
+
target = "draft-07";
|
|
8332
|
+
return {
|
|
8333
|
+
processors: params.processors ?? {},
|
|
8334
|
+
metadataRegistry: params?.metadata ?? globalRegistry,
|
|
8335
|
+
target,
|
|
8336
|
+
unrepresentable: params?.unrepresentable ?? "throw",
|
|
8337
|
+
override: params?.override ?? (() => {
|
|
8338
|
+
}),
|
|
8339
|
+
io: params?.io ?? "output",
|
|
8340
|
+
counter: 0,
|
|
8341
|
+
seen: /* @__PURE__ */ new Map(),
|
|
8342
|
+
cycles: params?.cycles ?? "ref",
|
|
8343
|
+
reused: params?.reused ?? "inline",
|
|
8344
|
+
external: params?.external ?? void 0
|
|
8345
|
+
};
|
|
8346
|
+
}
|
|
8347
|
+
function process2(schema, ctx, _params = { path: [], schemaPath: [] }) {
|
|
8348
|
+
var _a2;
|
|
8349
|
+
const def = schema._zod.def;
|
|
8350
|
+
const seen = ctx.seen.get(schema);
|
|
8351
|
+
if (seen) {
|
|
8352
|
+
seen.count++;
|
|
8353
|
+
const isCycle = _params.schemaPath.includes(schema);
|
|
8354
|
+
if (isCycle) {
|
|
8355
|
+
seen.cycle = _params.path;
|
|
8356
|
+
}
|
|
8357
|
+
return seen.schema;
|
|
8358
|
+
}
|
|
8359
|
+
const result = { schema: {}, count: 1, cycle: void 0, path: _params.path };
|
|
8360
|
+
ctx.seen.set(schema, result);
|
|
8361
|
+
const overrideSchema = schema._zod.toJSONSchema?.();
|
|
8362
|
+
if (overrideSchema) {
|
|
8363
|
+
result.schema = overrideSchema;
|
|
8364
|
+
} else {
|
|
8365
|
+
const params = {
|
|
8366
|
+
..._params,
|
|
8367
|
+
schemaPath: [..._params.schemaPath, schema],
|
|
8368
|
+
path: _params.path
|
|
8369
|
+
};
|
|
8370
|
+
const parent = schema._zod.parent;
|
|
8371
|
+
if (parent) {
|
|
8372
|
+
result.ref = parent;
|
|
8373
|
+
process2(parent, ctx, params);
|
|
8374
|
+
ctx.seen.get(parent).isParent = true;
|
|
8375
|
+
} else if (schema._zod.processJSONSchema) {
|
|
8376
|
+
schema._zod.processJSONSchema(ctx, result.schema, params);
|
|
8377
|
+
} else {
|
|
8378
|
+
const _json = result.schema;
|
|
8379
|
+
const processor = ctx.processors[def.type];
|
|
8380
|
+
if (!processor) {
|
|
8381
|
+
throw new Error(`[toJSONSchema]: Non-representable type encountered: ${def.type}`);
|
|
8382
|
+
}
|
|
8383
|
+
processor(schema, ctx, _json, params);
|
|
8384
|
+
}
|
|
8385
|
+
}
|
|
8386
|
+
const meta2 = ctx.metadataRegistry.get(schema);
|
|
8387
|
+
if (meta2)
|
|
8388
|
+
Object.assign(result.schema, meta2);
|
|
8389
|
+
if (ctx.io === "input" && isTransforming(schema)) {
|
|
8390
|
+
delete result.schema.examples;
|
|
8391
|
+
delete result.schema.default;
|
|
8392
|
+
}
|
|
8393
|
+
if (ctx.io === "input" && result.schema._prefault)
|
|
8394
|
+
(_a2 = result.schema).default ?? (_a2.default = result.schema._prefault);
|
|
8395
|
+
delete result.schema._prefault;
|
|
8396
|
+
const _result = ctx.seen.get(schema);
|
|
8397
|
+
return _result.schema;
|
|
8398
|
+
}
|
|
8399
|
+
function extractDefs(ctx, schema) {
|
|
8400
|
+
const root = ctx.seen.get(schema);
|
|
8401
|
+
if (!root)
|
|
8402
|
+
throw new Error("Unprocessed schema. This is a bug in Zod.");
|
|
8403
|
+
const makeURI = (entry) => {
|
|
8404
|
+
const defsSegment = ctx.target === "draft-2020-12" ? "$defs" : "definitions";
|
|
8405
|
+
if (ctx.external) {
|
|
8406
|
+
const externalId = ctx.external.registry.get(entry[0])?.id;
|
|
8407
|
+
const uriGenerator = ctx.external.uri ?? ((id2) => id2);
|
|
8408
|
+
if (externalId) {
|
|
8409
|
+
return { ref: uriGenerator(externalId) };
|
|
8410
|
+
}
|
|
8411
|
+
const id = entry[1].defId ?? entry[1].schema.id ?? `schema${ctx.counter++}`;
|
|
8412
|
+
entry[1].defId = id;
|
|
8413
|
+
return { defId: id, ref: `${uriGenerator("__shared")}#/${defsSegment}/${id}` };
|
|
8414
|
+
}
|
|
8415
|
+
if (entry[1] === root) {
|
|
8416
|
+
return { ref: "#" };
|
|
8417
|
+
}
|
|
8418
|
+
const uriPrefix = `#`;
|
|
8419
|
+
const defUriPrefix = `${uriPrefix}/${defsSegment}/`;
|
|
8420
|
+
const defId = entry[1].schema.id ?? `__schema${ctx.counter++}`;
|
|
8421
|
+
return { defId, ref: defUriPrefix + defId };
|
|
8422
|
+
};
|
|
8423
|
+
const extractToDef = (entry) => {
|
|
8424
|
+
if (entry[1].schema.$ref) {
|
|
8425
|
+
return;
|
|
8426
|
+
}
|
|
8427
|
+
const seen = entry[1];
|
|
8428
|
+
const { ref, defId } = makeURI(entry);
|
|
8429
|
+
seen.def = { ...seen.schema };
|
|
8430
|
+
if (defId)
|
|
8431
|
+
seen.defId = defId;
|
|
8432
|
+
const schema2 = seen.schema;
|
|
8433
|
+
for (const key in schema2) {
|
|
8434
|
+
delete schema2[key];
|
|
8435
|
+
}
|
|
8436
|
+
schema2.$ref = ref;
|
|
8437
|
+
};
|
|
8438
|
+
if (ctx.cycles === "throw") {
|
|
8439
|
+
for (const entry of ctx.seen.entries()) {
|
|
8440
|
+
const seen = entry[1];
|
|
8441
|
+
if (seen.cycle) {
|
|
8442
|
+
throw new Error(`Cycle detected: #/${seen.cycle?.join("/")}/<root>
|
|
8443
|
+
|
|
8444
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`);
|
|
8445
|
+
}
|
|
8446
|
+
}
|
|
8447
|
+
}
|
|
8448
|
+
for (const entry of ctx.seen.entries()) {
|
|
8449
|
+
const seen = entry[1];
|
|
8450
|
+
if (schema === entry[0]) {
|
|
8451
|
+
extractToDef(entry);
|
|
8452
|
+
continue;
|
|
8453
|
+
}
|
|
8454
|
+
if (ctx.external) {
|
|
8455
|
+
const ext = ctx.external.registry.get(entry[0])?.id;
|
|
8456
|
+
if (schema !== entry[0] && ext) {
|
|
8457
|
+
extractToDef(entry);
|
|
8458
|
+
continue;
|
|
8459
|
+
}
|
|
8460
|
+
}
|
|
8461
|
+
const id = ctx.metadataRegistry.get(entry[0])?.id;
|
|
8462
|
+
if (id) {
|
|
8463
|
+
extractToDef(entry);
|
|
8464
|
+
continue;
|
|
8465
|
+
}
|
|
8466
|
+
if (seen.cycle) {
|
|
8467
|
+
extractToDef(entry);
|
|
8468
|
+
continue;
|
|
8469
|
+
}
|
|
8470
|
+
if (seen.count > 1) {
|
|
8471
|
+
if (ctx.reused === "ref") {
|
|
8472
|
+
extractToDef(entry);
|
|
8473
|
+
continue;
|
|
8474
|
+
}
|
|
8475
|
+
}
|
|
8476
|
+
}
|
|
8477
|
+
}
|
|
8478
|
+
function finalize(ctx, schema) {
|
|
8479
|
+
const root = ctx.seen.get(schema);
|
|
8480
|
+
if (!root)
|
|
8481
|
+
throw new Error("Unprocessed schema. This is a bug in Zod.");
|
|
8482
|
+
const flattenRef = (zodSchema) => {
|
|
8483
|
+
const seen = ctx.seen.get(zodSchema);
|
|
8484
|
+
const schema2 = seen.def ?? seen.schema;
|
|
8485
|
+
const _cached = { ...schema2 };
|
|
8486
|
+
if (seen.ref === null) {
|
|
8487
|
+
return;
|
|
8488
|
+
}
|
|
8489
|
+
const ref = seen.ref;
|
|
8490
|
+
seen.ref = null;
|
|
8491
|
+
if (ref) {
|
|
8492
|
+
flattenRef(ref);
|
|
8493
|
+
const refSchema = ctx.seen.get(ref).schema;
|
|
8494
|
+
if (refSchema.$ref && (ctx.target === "draft-07" || ctx.target === "draft-04" || ctx.target === "openapi-3.0")) {
|
|
8495
|
+
schema2.allOf = schema2.allOf ?? [];
|
|
8496
|
+
schema2.allOf.push(refSchema);
|
|
8497
|
+
} else {
|
|
8498
|
+
Object.assign(schema2, refSchema);
|
|
8499
|
+
Object.assign(schema2, _cached);
|
|
8500
|
+
}
|
|
8501
|
+
}
|
|
8502
|
+
if (!seen.isParent)
|
|
8503
|
+
ctx.override({
|
|
8504
|
+
zodSchema,
|
|
8505
|
+
jsonSchema: schema2,
|
|
8506
|
+
path: seen.path ?? []
|
|
8507
|
+
});
|
|
8508
|
+
};
|
|
8509
|
+
for (const entry of [...ctx.seen.entries()].reverse()) {
|
|
8510
|
+
flattenRef(entry[0]);
|
|
8511
|
+
}
|
|
8512
|
+
const result = {};
|
|
8513
|
+
if (ctx.target === "draft-2020-12") {
|
|
8514
|
+
result.$schema = "https://json-schema.org/draft/2020-12/schema";
|
|
8515
|
+
} else if (ctx.target === "draft-07") {
|
|
8516
|
+
result.$schema = "http://json-schema.org/draft-07/schema#";
|
|
8517
|
+
} else if (ctx.target === "draft-04") {
|
|
8518
|
+
result.$schema = "http://json-schema.org/draft-04/schema#";
|
|
8519
|
+
} else if (ctx.target === "openapi-3.0") {
|
|
8520
|
+
} else {
|
|
8521
|
+
}
|
|
8522
|
+
if (ctx.external?.uri) {
|
|
8523
|
+
const id = ctx.external.registry.get(schema)?.id;
|
|
8524
|
+
if (!id)
|
|
8525
|
+
throw new Error("Schema is missing an `id` property");
|
|
8526
|
+
result.$id = ctx.external.uri(id);
|
|
8527
|
+
}
|
|
8528
|
+
Object.assign(result, root.def ?? root.schema);
|
|
8529
|
+
const defs = ctx.external?.defs ?? {};
|
|
8530
|
+
for (const entry of ctx.seen.entries()) {
|
|
8531
|
+
const seen = entry[1];
|
|
8532
|
+
if (seen.def && seen.defId) {
|
|
8533
|
+
defs[seen.defId] = seen.def;
|
|
8534
|
+
}
|
|
8535
|
+
}
|
|
8536
|
+
if (ctx.external) {
|
|
8537
|
+
} else {
|
|
8538
|
+
if (Object.keys(defs).length > 0) {
|
|
8539
|
+
if (ctx.target === "draft-2020-12") {
|
|
8540
|
+
result.$defs = defs;
|
|
8541
|
+
} else {
|
|
8542
|
+
result.definitions = defs;
|
|
8543
|
+
}
|
|
8544
|
+
}
|
|
8545
|
+
}
|
|
8546
|
+
try {
|
|
8547
|
+
const finalized = JSON.parse(JSON.stringify(result));
|
|
8548
|
+
Object.defineProperty(finalized, "~standard", {
|
|
8549
|
+
value: {
|
|
8550
|
+
...schema["~standard"],
|
|
8551
|
+
jsonSchema: {
|
|
8552
|
+
input: createStandardJSONSchemaMethod(schema, "input"),
|
|
8553
|
+
output: createStandardJSONSchemaMethod(schema, "output")
|
|
8554
|
+
}
|
|
8555
|
+
},
|
|
8556
|
+
enumerable: false,
|
|
8557
|
+
writable: false
|
|
8558
|
+
});
|
|
8559
|
+
return finalized;
|
|
8560
|
+
} catch (_err) {
|
|
8561
|
+
throw new Error("Error converting schema to JSON.");
|
|
8562
|
+
}
|
|
8563
|
+
}
|
|
8564
|
+
function isTransforming(_schema, _ctx) {
|
|
8565
|
+
const ctx = _ctx ?? { seen: /* @__PURE__ */ new Set() };
|
|
8566
|
+
if (ctx.seen.has(_schema))
|
|
8567
|
+
return false;
|
|
8568
|
+
ctx.seen.add(_schema);
|
|
8569
|
+
const def = _schema._zod.def;
|
|
8570
|
+
if (def.type === "transform")
|
|
8571
|
+
return true;
|
|
8572
|
+
if (def.type === "array")
|
|
8573
|
+
return isTransforming(def.element, ctx);
|
|
8574
|
+
if (def.type === "set")
|
|
8575
|
+
return isTransforming(def.valueType, ctx);
|
|
8576
|
+
if (def.type === "lazy")
|
|
8577
|
+
return isTransforming(def.getter(), ctx);
|
|
8578
|
+
if (def.type === "promise" || def.type === "optional" || def.type === "nonoptional" || def.type === "nullable" || def.type === "readonly" || def.type === "default" || def.type === "prefault") {
|
|
8579
|
+
return isTransforming(def.innerType, ctx);
|
|
8580
|
+
}
|
|
8581
|
+
if (def.type === "intersection") {
|
|
8582
|
+
return isTransforming(def.left, ctx) || isTransforming(def.right, ctx);
|
|
8583
|
+
}
|
|
8584
|
+
if (def.type === "record" || def.type === "map") {
|
|
8585
|
+
return isTransforming(def.keyType, ctx) || isTransforming(def.valueType, ctx);
|
|
8586
|
+
}
|
|
8587
|
+
if (def.type === "pipe") {
|
|
8588
|
+
return isTransforming(def.in, ctx) || isTransforming(def.out, ctx);
|
|
8589
|
+
}
|
|
8590
|
+
if (def.type === "object") {
|
|
8591
|
+
for (const key in def.shape) {
|
|
8592
|
+
if (isTransforming(def.shape[key], ctx))
|
|
8593
|
+
return true;
|
|
8594
|
+
}
|
|
8595
|
+
return false;
|
|
8596
|
+
}
|
|
8597
|
+
if (def.type === "union") {
|
|
8598
|
+
for (const option of def.options) {
|
|
8599
|
+
if (isTransforming(option, ctx))
|
|
8600
|
+
return true;
|
|
8601
|
+
}
|
|
8602
|
+
return false;
|
|
8603
|
+
}
|
|
8604
|
+
if (def.type === "tuple") {
|
|
8605
|
+
for (const item of def.items) {
|
|
8606
|
+
if (isTransforming(item, ctx))
|
|
8607
|
+
return true;
|
|
8608
|
+
}
|
|
8609
|
+
if (def.rest && isTransforming(def.rest, ctx))
|
|
8610
|
+
return true;
|
|
8611
|
+
return false;
|
|
8612
|
+
}
|
|
8613
|
+
return false;
|
|
8614
|
+
}
|
|
8615
|
+
var createToJSONSchemaMethod = (schema, processors = {}) => (params) => {
|
|
8616
|
+
const ctx = initializeContext({ ...params, processors });
|
|
8617
|
+
process2(schema, ctx);
|
|
8618
|
+
extractDefs(ctx, schema);
|
|
8619
|
+
return finalize(ctx, schema);
|
|
8620
|
+
};
|
|
8621
|
+
var createStandardJSONSchemaMethod = (schema, io) => (params) => {
|
|
8622
|
+
const { libraryOptions, target } = params ?? {};
|
|
8623
|
+
const ctx = initializeContext({ ...libraryOptions ?? {}, target, io, processors: {} });
|
|
8624
|
+
process2(schema, ctx);
|
|
8625
|
+
extractDefs(ctx, schema);
|
|
8626
|
+
return finalize(ctx, schema);
|
|
8627
|
+
};
|
|
8628
|
+
|
|
8629
|
+
// node_modules/zod/v4/core/json-schema-processors.js
|
|
8630
|
+
var formatMap = {
|
|
8631
|
+
guid: "uuid",
|
|
8632
|
+
url: "uri",
|
|
8633
|
+
datetime: "date-time",
|
|
8634
|
+
json_string: "json-string",
|
|
8635
|
+
regex: ""
|
|
8636
|
+
// do not set
|
|
8637
|
+
};
|
|
8638
|
+
var stringProcessor = (schema, ctx, _json, _params) => {
|
|
8639
|
+
const json = _json;
|
|
8640
|
+
json.type = "string";
|
|
8641
|
+
const { minimum, maximum, format, patterns, contentEncoding } = schema._zod.bag;
|
|
8642
|
+
if (typeof minimum === "number")
|
|
8643
|
+
json.minLength = minimum;
|
|
8644
|
+
if (typeof maximum === "number")
|
|
8645
|
+
json.maxLength = maximum;
|
|
8646
|
+
if (format) {
|
|
8647
|
+
json.format = formatMap[format] ?? format;
|
|
8648
|
+
if (json.format === "")
|
|
8649
|
+
delete json.format;
|
|
8650
|
+
}
|
|
8651
|
+
if (contentEncoding)
|
|
8652
|
+
json.contentEncoding = contentEncoding;
|
|
8653
|
+
if (patterns && patterns.size > 0) {
|
|
8654
|
+
const regexes = [...patterns];
|
|
8655
|
+
if (regexes.length === 1)
|
|
8656
|
+
json.pattern = regexes[0].source;
|
|
8657
|
+
else if (regexes.length > 1) {
|
|
8658
|
+
json.allOf = [
|
|
8659
|
+
...regexes.map((regex) => ({
|
|
8660
|
+
...ctx.target === "draft-07" || ctx.target === "draft-04" || ctx.target === "openapi-3.0" ? { type: "string" } : {},
|
|
8661
|
+
pattern: regex.source
|
|
8662
|
+
}))
|
|
8663
|
+
];
|
|
8664
|
+
}
|
|
8665
|
+
}
|
|
8666
|
+
};
|
|
8667
|
+
var numberProcessor = (schema, ctx, _json, _params) => {
|
|
8668
|
+
const json = _json;
|
|
8669
|
+
const { minimum, maximum, format, multipleOf, exclusiveMaximum, exclusiveMinimum } = schema._zod.bag;
|
|
8670
|
+
if (typeof format === "string" && format.includes("int"))
|
|
8671
|
+
json.type = "integer";
|
|
8672
|
+
else
|
|
8673
|
+
json.type = "number";
|
|
8674
|
+
if (typeof exclusiveMinimum === "number") {
|
|
8675
|
+
if (ctx.target === "draft-04" || ctx.target === "openapi-3.0") {
|
|
8676
|
+
json.minimum = exclusiveMinimum;
|
|
8677
|
+
json.exclusiveMinimum = true;
|
|
8678
|
+
} else {
|
|
8679
|
+
json.exclusiveMinimum = exclusiveMinimum;
|
|
8680
|
+
}
|
|
8681
|
+
}
|
|
8682
|
+
if (typeof minimum === "number") {
|
|
8683
|
+
json.minimum = minimum;
|
|
8684
|
+
if (typeof exclusiveMinimum === "number" && ctx.target !== "draft-04") {
|
|
8685
|
+
if (exclusiveMinimum >= minimum)
|
|
8686
|
+
delete json.minimum;
|
|
8687
|
+
else
|
|
8688
|
+
delete json.exclusiveMinimum;
|
|
8689
|
+
}
|
|
8690
|
+
}
|
|
8691
|
+
if (typeof exclusiveMaximum === "number") {
|
|
8692
|
+
if (ctx.target === "draft-04" || ctx.target === "openapi-3.0") {
|
|
8693
|
+
json.maximum = exclusiveMaximum;
|
|
8694
|
+
json.exclusiveMaximum = true;
|
|
8695
|
+
} else {
|
|
8696
|
+
json.exclusiveMaximum = exclusiveMaximum;
|
|
8697
|
+
}
|
|
8698
|
+
}
|
|
8699
|
+
if (typeof maximum === "number") {
|
|
8700
|
+
json.maximum = maximum;
|
|
8701
|
+
if (typeof exclusiveMaximum === "number" && ctx.target !== "draft-04") {
|
|
8702
|
+
if (exclusiveMaximum <= maximum)
|
|
8703
|
+
delete json.maximum;
|
|
8704
|
+
else
|
|
8705
|
+
delete json.exclusiveMaximum;
|
|
8706
|
+
}
|
|
8707
|
+
}
|
|
8708
|
+
if (typeof multipleOf === "number")
|
|
8709
|
+
json.multipleOf = multipleOf;
|
|
8710
|
+
};
|
|
8711
|
+
var booleanProcessor = (_schema, _ctx, json, _params) => {
|
|
8712
|
+
json.type = "boolean";
|
|
8713
|
+
};
|
|
8714
|
+
var bigintProcessor = (_schema, ctx, _json, _params) => {
|
|
8715
|
+
if (ctx.unrepresentable === "throw") {
|
|
8716
|
+
throw new Error("BigInt cannot be represented in JSON Schema");
|
|
8717
|
+
}
|
|
8718
|
+
};
|
|
8719
|
+
var symbolProcessor = (_schema, ctx, _json, _params) => {
|
|
8720
|
+
if (ctx.unrepresentable === "throw") {
|
|
8721
|
+
throw new Error("Symbols cannot be represented in JSON Schema");
|
|
8722
|
+
}
|
|
8723
|
+
};
|
|
8724
|
+
var nullProcessor = (_schema, ctx, json, _params) => {
|
|
8725
|
+
if (ctx.target === "openapi-3.0") {
|
|
8726
|
+
json.type = "string";
|
|
8727
|
+
json.nullable = true;
|
|
8728
|
+
json.enum = [null];
|
|
8729
|
+
} else {
|
|
8730
|
+
json.type = "null";
|
|
8731
|
+
}
|
|
8732
|
+
};
|
|
8733
|
+
var undefinedProcessor = (_schema, ctx, _json, _params) => {
|
|
8734
|
+
if (ctx.unrepresentable === "throw") {
|
|
8735
|
+
throw new Error("Undefined cannot be represented in JSON Schema");
|
|
8736
|
+
}
|
|
8737
|
+
};
|
|
8738
|
+
var voidProcessor = (_schema, ctx, _json, _params) => {
|
|
8739
|
+
if (ctx.unrepresentable === "throw") {
|
|
8740
|
+
throw new Error("Void cannot be represented in JSON Schema");
|
|
8741
|
+
}
|
|
8742
|
+
};
|
|
8743
|
+
var neverProcessor = (_schema, _ctx, json, _params) => {
|
|
8744
|
+
json.not = {};
|
|
8745
|
+
};
|
|
8746
|
+
var anyProcessor = (_schema, _ctx, _json, _params) => {
|
|
8747
|
+
};
|
|
8748
|
+
var unknownProcessor = (_schema, _ctx, _json, _params) => {
|
|
8749
|
+
};
|
|
8750
|
+
var dateProcessor = (_schema, ctx, _json, _params) => {
|
|
8751
|
+
if (ctx.unrepresentable === "throw") {
|
|
8752
|
+
throw new Error("Date cannot be represented in JSON Schema");
|
|
8753
|
+
}
|
|
8754
|
+
};
|
|
8755
|
+
var enumProcessor = (schema, _ctx, json, _params) => {
|
|
8756
|
+
const def = schema._zod.def;
|
|
8757
|
+
const values = getEnumValues(def.entries);
|
|
8758
|
+
if (values.every((v) => typeof v === "number"))
|
|
8759
|
+
json.type = "number";
|
|
8760
|
+
if (values.every((v) => typeof v === "string"))
|
|
8761
|
+
json.type = "string";
|
|
8762
|
+
json.enum = values;
|
|
8763
|
+
};
|
|
8764
|
+
var literalProcessor = (schema, ctx, json, _params) => {
|
|
8765
|
+
const def = schema._zod.def;
|
|
8766
|
+
const vals = [];
|
|
8767
|
+
for (const val of def.values) {
|
|
8768
|
+
if (val === void 0) {
|
|
8769
|
+
if (ctx.unrepresentable === "throw") {
|
|
8770
|
+
throw new Error("Literal `undefined` cannot be represented in JSON Schema");
|
|
8771
|
+
} else {
|
|
8772
|
+
}
|
|
8773
|
+
} else if (typeof val === "bigint") {
|
|
8774
|
+
if (ctx.unrepresentable === "throw") {
|
|
8775
|
+
throw new Error("BigInt literals cannot be represented in JSON Schema");
|
|
8776
|
+
} else {
|
|
8777
|
+
vals.push(Number(val));
|
|
8778
|
+
}
|
|
8779
|
+
} else {
|
|
8780
|
+
vals.push(val);
|
|
8781
|
+
}
|
|
8782
|
+
}
|
|
8783
|
+
if (vals.length === 0) {
|
|
8784
|
+
} else if (vals.length === 1) {
|
|
8785
|
+
const val = vals[0];
|
|
8786
|
+
json.type = val === null ? "null" : typeof val;
|
|
8787
|
+
if (ctx.target === "draft-04" || ctx.target === "openapi-3.0") {
|
|
8788
|
+
json.enum = [val];
|
|
8789
|
+
} else {
|
|
8790
|
+
json.const = val;
|
|
8791
|
+
}
|
|
8792
|
+
} else {
|
|
8793
|
+
if (vals.every((v) => typeof v === "number"))
|
|
8794
|
+
json.type = "number";
|
|
8795
|
+
if (vals.every((v) => typeof v === "string"))
|
|
8796
|
+
json.type = "string";
|
|
8797
|
+
if (vals.every((v) => typeof v === "boolean"))
|
|
8798
|
+
json.type = "boolean";
|
|
8799
|
+
if (vals.every((v) => v === null))
|
|
8800
|
+
json.type = "null";
|
|
8801
|
+
json.enum = vals;
|
|
8802
|
+
}
|
|
8803
|
+
};
|
|
8804
|
+
var customProcessor = (_schema, ctx, _json, _params) => {
|
|
8805
|
+
if (ctx.unrepresentable === "throw") {
|
|
8806
|
+
throw new Error("Custom types cannot be represented in JSON Schema");
|
|
8807
|
+
}
|
|
8808
|
+
};
|
|
8809
|
+
var transformProcessor = (_schema, ctx, _json, _params) => {
|
|
8810
|
+
if (ctx.unrepresentable === "throw") {
|
|
8811
|
+
throw new Error("Transforms cannot be represented in JSON Schema");
|
|
8812
|
+
}
|
|
8813
|
+
};
|
|
8814
|
+
var arrayProcessor = (schema, ctx, _json, params) => {
|
|
8815
|
+
const json = _json;
|
|
8816
|
+
const def = schema._zod.def;
|
|
8817
|
+
const { minimum, maximum } = schema._zod.bag;
|
|
8818
|
+
if (typeof minimum === "number")
|
|
8819
|
+
json.minItems = minimum;
|
|
8820
|
+
if (typeof maximum === "number")
|
|
8821
|
+
json.maxItems = maximum;
|
|
8822
|
+
json.type = "array";
|
|
8823
|
+
json.items = process2(def.element, ctx, { ...params, path: [...params.path, "items"] });
|
|
8824
|
+
};
|
|
8825
|
+
var objectProcessor = (schema, ctx, _json, params) => {
|
|
8826
|
+
const json = _json;
|
|
8827
|
+
const def = schema._zod.def;
|
|
8828
|
+
json.type = "object";
|
|
8829
|
+
json.properties = {};
|
|
8830
|
+
const shape = def.shape;
|
|
8831
|
+
for (const key in shape) {
|
|
8832
|
+
json.properties[key] = process2(shape[key], ctx, {
|
|
8833
|
+
...params,
|
|
8834
|
+
path: [...params.path, "properties", key]
|
|
8835
|
+
});
|
|
8836
|
+
}
|
|
8837
|
+
const allKeys = new Set(Object.keys(shape));
|
|
8838
|
+
const requiredKeys = new Set([...allKeys].filter((key) => {
|
|
8839
|
+
const v = def.shape[key]._zod;
|
|
8840
|
+
if (ctx.io === "input") {
|
|
8841
|
+
return v.optin === void 0;
|
|
8842
|
+
} else {
|
|
8843
|
+
return v.optout === void 0;
|
|
8844
|
+
}
|
|
8845
|
+
}));
|
|
8846
|
+
if (requiredKeys.size > 0) {
|
|
8847
|
+
json.required = Array.from(requiredKeys);
|
|
8848
|
+
}
|
|
8849
|
+
if (def.catchall?._zod.def.type === "never") {
|
|
8850
|
+
json.additionalProperties = false;
|
|
8851
|
+
} else if (!def.catchall) {
|
|
8852
|
+
if (ctx.io === "output")
|
|
8853
|
+
json.additionalProperties = false;
|
|
8854
|
+
} else if (def.catchall) {
|
|
8855
|
+
json.additionalProperties = process2(def.catchall, ctx, {
|
|
8856
|
+
...params,
|
|
8857
|
+
path: [...params.path, "additionalProperties"]
|
|
8858
|
+
});
|
|
8859
|
+
}
|
|
8860
|
+
};
|
|
8861
|
+
var unionProcessor = (schema, ctx, json, params) => {
|
|
8862
|
+
const def = schema._zod.def;
|
|
8863
|
+
const isExclusive = def.inclusive === false;
|
|
8864
|
+
const options = def.options.map((x, i) => process2(x, ctx, {
|
|
8865
|
+
...params,
|
|
8866
|
+
path: [...params.path, isExclusive ? "oneOf" : "anyOf", i]
|
|
8867
|
+
}));
|
|
8868
|
+
if (isExclusive) {
|
|
8869
|
+
json.oneOf = options;
|
|
8870
|
+
} else {
|
|
8871
|
+
json.anyOf = options;
|
|
8872
|
+
}
|
|
8873
|
+
};
|
|
8874
|
+
var intersectionProcessor = (schema, ctx, json, params) => {
|
|
8875
|
+
const def = schema._zod.def;
|
|
8876
|
+
const a = process2(def.left, ctx, {
|
|
8877
|
+
...params,
|
|
8878
|
+
path: [...params.path, "allOf", 0]
|
|
8879
|
+
});
|
|
8880
|
+
const b = process2(def.right, ctx, {
|
|
8881
|
+
...params,
|
|
8882
|
+
path: [...params.path, "allOf", 1]
|
|
8883
|
+
});
|
|
8884
|
+
const isSimpleIntersection = (val) => "allOf" in val && Object.keys(val).length === 1;
|
|
8885
|
+
const allOf = [
|
|
8886
|
+
...isSimpleIntersection(a) ? a.allOf : [a],
|
|
8887
|
+
...isSimpleIntersection(b) ? b.allOf : [b]
|
|
8888
|
+
];
|
|
8889
|
+
json.allOf = allOf;
|
|
8890
|
+
};
|
|
8891
|
+
var tupleProcessor = (schema, ctx, _json, params) => {
|
|
8892
|
+
const json = _json;
|
|
8893
|
+
const def = schema._zod.def;
|
|
8894
|
+
json.type = "array";
|
|
8895
|
+
const prefixPath = ctx.target === "draft-2020-12" ? "prefixItems" : "items";
|
|
8896
|
+
const restPath = ctx.target === "draft-2020-12" ? "items" : ctx.target === "openapi-3.0" ? "items" : "additionalItems";
|
|
8897
|
+
const prefixItems = def.items.map((x, i) => process2(x, ctx, {
|
|
8898
|
+
...params,
|
|
8899
|
+
path: [...params.path, prefixPath, i]
|
|
8900
|
+
}));
|
|
8901
|
+
const rest = def.rest ? process2(def.rest, ctx, {
|
|
8902
|
+
...params,
|
|
8903
|
+
path: [...params.path, restPath, ...ctx.target === "openapi-3.0" ? [def.items.length] : []]
|
|
8904
|
+
}) : null;
|
|
8905
|
+
if (ctx.target === "draft-2020-12") {
|
|
8906
|
+
json.prefixItems = prefixItems;
|
|
8907
|
+
if (rest) {
|
|
8908
|
+
json.items = rest;
|
|
8909
|
+
}
|
|
8910
|
+
} else if (ctx.target === "openapi-3.0") {
|
|
8911
|
+
json.items = {
|
|
8912
|
+
anyOf: prefixItems
|
|
8913
|
+
};
|
|
8914
|
+
if (rest) {
|
|
8915
|
+
json.items.anyOf.push(rest);
|
|
8916
|
+
}
|
|
8917
|
+
json.minItems = prefixItems.length;
|
|
8918
|
+
if (!rest) {
|
|
8919
|
+
json.maxItems = prefixItems.length;
|
|
8920
|
+
}
|
|
8921
|
+
} else {
|
|
8922
|
+
json.items = prefixItems;
|
|
8923
|
+
if (rest) {
|
|
8924
|
+
json.additionalItems = rest;
|
|
8925
|
+
}
|
|
8926
|
+
}
|
|
8927
|
+
const { minimum, maximum } = schema._zod.bag;
|
|
8928
|
+
if (typeof minimum === "number")
|
|
8929
|
+
json.minItems = minimum;
|
|
8930
|
+
if (typeof maximum === "number")
|
|
8931
|
+
json.maxItems = maximum;
|
|
8932
|
+
};
|
|
8933
|
+
var recordProcessor = (schema, ctx, _json, params) => {
|
|
8934
|
+
const json = _json;
|
|
8935
|
+
const def = schema._zod.def;
|
|
8936
|
+
json.type = "object";
|
|
8937
|
+
if (ctx.target === "draft-07" || ctx.target === "draft-2020-12") {
|
|
8938
|
+
json.propertyNames = process2(def.keyType, ctx, {
|
|
8939
|
+
...params,
|
|
8940
|
+
path: [...params.path, "propertyNames"]
|
|
8941
|
+
});
|
|
8942
|
+
}
|
|
8943
|
+
json.additionalProperties = process2(def.valueType, ctx, {
|
|
8944
|
+
...params,
|
|
8945
|
+
path: [...params.path, "additionalProperties"]
|
|
8946
|
+
});
|
|
8947
|
+
};
|
|
8948
|
+
var nullableProcessor = (schema, ctx, json, params) => {
|
|
8949
|
+
const def = schema._zod.def;
|
|
8950
|
+
const inner = process2(def.innerType, ctx, params);
|
|
8951
|
+
const seen = ctx.seen.get(schema);
|
|
8952
|
+
if (ctx.target === "openapi-3.0") {
|
|
8953
|
+
seen.ref = def.innerType;
|
|
8954
|
+
json.nullable = true;
|
|
8955
|
+
} else {
|
|
8956
|
+
json.anyOf = [inner, { type: "null" }];
|
|
8957
|
+
}
|
|
8958
|
+
};
|
|
8959
|
+
var nonoptionalProcessor = (schema, ctx, _json, params) => {
|
|
8960
|
+
const def = schema._zod.def;
|
|
8961
|
+
process2(def.innerType, ctx, params);
|
|
8962
|
+
const seen = ctx.seen.get(schema);
|
|
8963
|
+
seen.ref = def.innerType;
|
|
8964
|
+
};
|
|
8965
|
+
var defaultProcessor = (schema, ctx, json, params) => {
|
|
8966
|
+
const def = schema._zod.def;
|
|
8967
|
+
process2(def.innerType, ctx, params);
|
|
8968
|
+
const seen = ctx.seen.get(schema);
|
|
8969
|
+
seen.ref = def.innerType;
|
|
8970
|
+
json.default = JSON.parse(JSON.stringify(def.defaultValue));
|
|
8971
|
+
};
|
|
8972
|
+
var prefaultProcessor = (schema, ctx, json, params) => {
|
|
8973
|
+
const def = schema._zod.def;
|
|
8974
|
+
process2(def.innerType, ctx, params);
|
|
8975
|
+
const seen = ctx.seen.get(schema);
|
|
8976
|
+
seen.ref = def.innerType;
|
|
8977
|
+
if (ctx.io === "input")
|
|
8978
|
+
json._prefault = JSON.parse(JSON.stringify(def.defaultValue));
|
|
8979
|
+
};
|
|
8980
|
+
var catchProcessor = (schema, ctx, json, params) => {
|
|
8981
|
+
const def = schema._zod.def;
|
|
8982
|
+
process2(def.innerType, ctx, params);
|
|
8983
|
+
const seen = ctx.seen.get(schema);
|
|
8984
|
+
seen.ref = def.innerType;
|
|
8985
|
+
let catchValue;
|
|
8986
|
+
try {
|
|
8987
|
+
catchValue = def.catchValue(void 0);
|
|
8988
|
+
} catch {
|
|
8989
|
+
throw new Error("Dynamic catch values are not supported in JSON Schema");
|
|
8990
|
+
}
|
|
8991
|
+
json.default = catchValue;
|
|
8992
|
+
};
|
|
8993
|
+
var pipeProcessor = (schema, ctx, _json, params) => {
|
|
8994
|
+
const def = schema._zod.def;
|
|
8995
|
+
const innerType = ctx.io === "input" ? def.in._zod.def.type === "transform" ? def.out : def.in : def.out;
|
|
8996
|
+
process2(innerType, ctx, params);
|
|
8997
|
+
const seen = ctx.seen.get(schema);
|
|
8998
|
+
seen.ref = innerType;
|
|
8999
|
+
};
|
|
9000
|
+
var readonlyProcessor = (schema, ctx, json, params) => {
|
|
9001
|
+
const def = schema._zod.def;
|
|
9002
|
+
process2(def.innerType, ctx, params);
|
|
9003
|
+
const seen = ctx.seen.get(schema);
|
|
9004
|
+
seen.ref = def.innerType;
|
|
9005
|
+
json.readOnly = true;
|
|
9006
|
+
};
|
|
9007
|
+
var promiseProcessor = (schema, ctx, _json, params) => {
|
|
9008
|
+
const def = schema._zod.def;
|
|
9009
|
+
process2(def.innerType, ctx, params);
|
|
9010
|
+
const seen = ctx.seen.get(schema);
|
|
9011
|
+
seen.ref = def.innerType;
|
|
9012
|
+
};
|
|
9013
|
+
var optionalProcessor = (schema, ctx, _json, params) => {
|
|
9014
|
+
const def = schema._zod.def;
|
|
9015
|
+
process2(def.innerType, ctx, params);
|
|
9016
|
+
const seen = ctx.seen.get(schema);
|
|
9017
|
+
seen.ref = def.innerType;
|
|
9018
|
+
};
|
|
9019
|
+
|
|
8154
9020
|
// node_modules/zod/v4/classic/iso.js
|
|
8155
9021
|
var ZodISODateTime = /* @__PURE__ */ $constructor("ZodISODateTime", (inst, def) => {
|
|
8156
9022
|
$ZodISODateTime.init(inst, def);
|
|
@@ -8238,25 +9104,28 @@ var safeDecodeAsync = /* @__PURE__ */ _safeDecodeAsync(ZodRealError);
|
|
|
8238
9104
|
// node_modules/zod/v4/classic/schemas.js
|
|
8239
9105
|
var ZodType = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
|
|
8240
9106
|
$ZodType.init(inst, def);
|
|
9107
|
+
Object.assign(inst["~standard"], {
|
|
9108
|
+
jsonSchema: {
|
|
9109
|
+
input: createStandardJSONSchemaMethod(inst, "input"),
|
|
9110
|
+
output: createStandardJSONSchemaMethod(inst, "output")
|
|
9111
|
+
}
|
|
9112
|
+
});
|
|
9113
|
+
inst.toJSONSchema = createToJSONSchemaMethod(inst, {});
|
|
8241
9114
|
inst.def = def;
|
|
8242
9115
|
inst.type = def.type;
|
|
8243
9116
|
Object.defineProperty(inst, "_def", { value: def });
|
|
8244
9117
|
inst.check = (...checks) => {
|
|
8245
|
-
return inst.clone(
|
|
8246
|
-
|
|
8247
|
-
...def,
|
|
8248
|
-
checks: [
|
|
8249
|
-
|
|
8250
|
-
|
|
8251
|
-
]
|
|
8252
|
-
}
|
|
8253
|
-
// { parent: true }
|
|
8254
|
-
);
|
|
9118
|
+
return inst.clone(util_exports.mergeDefs(def, {
|
|
9119
|
+
checks: [
|
|
9120
|
+
...def.checks ?? [],
|
|
9121
|
+
...checks.map((ch) => typeof ch === "function" ? { _zod: { check: ch, def: { check: "custom" }, onattach: [] } } : ch)
|
|
9122
|
+
]
|
|
9123
|
+
}));
|
|
8255
9124
|
};
|
|
8256
9125
|
inst.clone = (def2, params) => clone(inst, def2, params);
|
|
8257
9126
|
inst.brand = () => inst;
|
|
8258
|
-
inst.register = ((reg,
|
|
8259
|
-
reg.add(inst,
|
|
9127
|
+
inst.register = ((reg, meta2) => {
|
|
9128
|
+
reg.add(inst, meta2);
|
|
8260
9129
|
return inst;
|
|
8261
9130
|
});
|
|
8262
9131
|
inst.parse = (data, params) => parse2(inst, data, params, { callee: inst.parse });
|
|
@@ -8314,6 +9183,7 @@ var ZodType = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
|
|
|
8314
9183
|
var _ZodString = /* @__PURE__ */ $constructor("_ZodString", (inst, def) => {
|
|
8315
9184
|
$ZodString.init(inst, def);
|
|
8316
9185
|
ZodType.init(inst, def);
|
|
9186
|
+
inst._zod.processJSONSchema = (ctx, json, params) => stringProcessor(inst, ctx, json, params);
|
|
8317
9187
|
const bag = inst._zod.bag;
|
|
8318
9188
|
inst.format = bag.format ?? null;
|
|
8319
9189
|
inst.minLength = bag.minimum ?? null;
|
|
@@ -8332,6 +9202,7 @@ var _ZodString = /* @__PURE__ */ $constructor("_ZodString", (inst, def) => {
|
|
|
8332
9202
|
inst.normalize = (...args) => inst.check(_normalize(...args));
|
|
8333
9203
|
inst.toLowerCase = () => inst.check(_toLowerCase());
|
|
8334
9204
|
inst.toUpperCase = () => inst.check(_toUpperCase());
|
|
9205
|
+
inst.slugify = () => inst.check(_slugify());
|
|
8335
9206
|
});
|
|
8336
9207
|
var ZodString = /* @__PURE__ */ $constructor("ZodString", (inst, def) => {
|
|
8337
9208
|
$ZodString.init(inst, def);
|
|
@@ -8450,6 +9321,7 @@ var ZodJWT = /* @__PURE__ */ $constructor("ZodJWT", (inst, def) => {
|
|
|
8450
9321
|
var ZodNumber = /* @__PURE__ */ $constructor("ZodNumber", (inst, def) => {
|
|
8451
9322
|
$ZodNumber.init(inst, def);
|
|
8452
9323
|
ZodType.init(inst, def);
|
|
9324
|
+
inst._zod.processJSONSchema = (ctx, json, params) => numberProcessor(inst, ctx, json, params);
|
|
8453
9325
|
inst.gt = (value, params) => inst.check(_gt(value, params));
|
|
8454
9326
|
inst.gte = (value, params) => inst.check(_gte(value, params));
|
|
8455
9327
|
inst.min = (value, params) => inst.check(_gte(value, params));
|
|
@@ -8482,10 +9354,12 @@ function int(params) {
|
|
|
8482
9354
|
var ZodBoolean = /* @__PURE__ */ $constructor("ZodBoolean", (inst, def) => {
|
|
8483
9355
|
$ZodBoolean.init(inst, def);
|
|
8484
9356
|
ZodType.init(inst, def);
|
|
9357
|
+
inst._zod.processJSONSchema = (ctx, json, params) => booleanProcessor(inst, ctx, json, params);
|
|
8485
9358
|
});
|
|
8486
9359
|
var ZodBigInt = /* @__PURE__ */ $constructor("ZodBigInt", (inst, def) => {
|
|
8487
9360
|
$ZodBigInt.init(inst, def);
|
|
8488
9361
|
ZodType.init(inst, def);
|
|
9362
|
+
inst._zod.processJSONSchema = (ctx, json, params) => bigintProcessor(inst, ctx, json, params);
|
|
8489
9363
|
inst.gte = (value, params) => inst.check(_gte(value, params));
|
|
8490
9364
|
inst.min = (value, params) => inst.check(_gte(value, params));
|
|
8491
9365
|
inst.gt = (value, params) => inst.check(_gt(value, params));
|
|
@@ -8507,22 +9381,27 @@ var ZodBigInt = /* @__PURE__ */ $constructor("ZodBigInt", (inst, def) => {
|
|
|
8507
9381
|
var ZodSymbol = /* @__PURE__ */ $constructor("ZodSymbol", (inst, def) => {
|
|
8508
9382
|
$ZodSymbol.init(inst, def);
|
|
8509
9383
|
ZodType.init(inst, def);
|
|
9384
|
+
inst._zod.processJSONSchema = (ctx, json, params) => symbolProcessor(inst, ctx, json, params);
|
|
8510
9385
|
});
|
|
8511
9386
|
var ZodUndefined = /* @__PURE__ */ $constructor("ZodUndefined", (inst, def) => {
|
|
8512
9387
|
$ZodUndefined.init(inst, def);
|
|
8513
9388
|
ZodType.init(inst, def);
|
|
9389
|
+
inst._zod.processJSONSchema = (ctx, json, params) => undefinedProcessor(inst, ctx, json, params);
|
|
8514
9390
|
});
|
|
8515
9391
|
var ZodNull = /* @__PURE__ */ $constructor("ZodNull", (inst, def) => {
|
|
8516
9392
|
$ZodNull.init(inst, def);
|
|
8517
9393
|
ZodType.init(inst, def);
|
|
9394
|
+
inst._zod.processJSONSchema = (ctx, json, params) => nullProcessor(inst, ctx, json, params);
|
|
8518
9395
|
});
|
|
8519
9396
|
var ZodAny = /* @__PURE__ */ $constructor("ZodAny", (inst, def) => {
|
|
8520
9397
|
$ZodAny.init(inst, def);
|
|
8521
9398
|
ZodType.init(inst, def);
|
|
9399
|
+
inst._zod.processJSONSchema = (ctx, json, params) => anyProcessor(inst, ctx, json, params);
|
|
8522
9400
|
});
|
|
8523
9401
|
var ZodUnknown = /* @__PURE__ */ $constructor("ZodUnknown", (inst, def) => {
|
|
8524
9402
|
$ZodUnknown.init(inst, def);
|
|
8525
9403
|
ZodType.init(inst, def);
|
|
9404
|
+
inst._zod.processJSONSchema = (ctx, json, params) => unknownProcessor(inst, ctx, json, params);
|
|
8526
9405
|
});
|
|
8527
9406
|
function unknown() {
|
|
8528
9407
|
return _unknown(ZodUnknown);
|
|
@@ -8530,6 +9409,7 @@ function unknown() {
|
|
|
8530
9409
|
var ZodNever = /* @__PURE__ */ $constructor("ZodNever", (inst, def) => {
|
|
8531
9410
|
$ZodNever.init(inst, def);
|
|
8532
9411
|
ZodType.init(inst, def);
|
|
9412
|
+
inst._zod.processJSONSchema = (ctx, json, params) => neverProcessor(inst, ctx, json, params);
|
|
8533
9413
|
});
|
|
8534
9414
|
function never(params) {
|
|
8535
9415
|
return _never(ZodNever, params);
|
|
@@ -8537,10 +9417,12 @@ function never(params) {
|
|
|
8537
9417
|
var ZodVoid = /* @__PURE__ */ $constructor("ZodVoid", (inst, def) => {
|
|
8538
9418
|
$ZodVoid.init(inst, def);
|
|
8539
9419
|
ZodType.init(inst, def);
|
|
9420
|
+
inst._zod.processJSONSchema = (ctx, json, params) => voidProcessor(inst, ctx, json, params);
|
|
8540
9421
|
});
|
|
8541
9422
|
var ZodDate = /* @__PURE__ */ $constructor("ZodDate", (inst, def) => {
|
|
8542
9423
|
$ZodDate.init(inst, def);
|
|
8543
9424
|
ZodType.init(inst, def);
|
|
9425
|
+
inst._zod.processJSONSchema = (ctx, json, params) => dateProcessor(inst, ctx, json, params);
|
|
8544
9426
|
inst.min = (value, params) => inst.check(_gte(value, params));
|
|
8545
9427
|
inst.max = (value, params) => inst.check(_lte(value, params));
|
|
8546
9428
|
const c = inst._zod.bag;
|
|
@@ -8550,6 +9432,7 @@ var ZodDate = /* @__PURE__ */ $constructor("ZodDate", (inst, def) => {
|
|
|
8550
9432
|
var ZodArray = /* @__PURE__ */ $constructor("ZodArray", (inst, def) => {
|
|
8551
9433
|
$ZodArray.init(inst, def);
|
|
8552
9434
|
ZodType.init(inst, def);
|
|
9435
|
+
inst._zod.processJSONSchema = (ctx, json, params) => arrayProcessor(inst, ctx, json, params);
|
|
8553
9436
|
inst.element = def.element;
|
|
8554
9437
|
inst.min = (minLength, params) => inst.check(_minLength(minLength, params));
|
|
8555
9438
|
inst.nonempty = (params) => inst.check(_minLength(1, params));
|
|
@@ -8563,7 +9446,10 @@ function array(element, params) {
|
|
|
8563
9446
|
var ZodObject = /* @__PURE__ */ $constructor("ZodObject", (inst, def) => {
|
|
8564
9447
|
$ZodObjectJIT.init(inst, def);
|
|
8565
9448
|
ZodType.init(inst, def);
|
|
8566
|
-
|
|
9449
|
+
inst._zod.processJSONSchema = (ctx, json, params) => objectProcessor(inst, ctx, json, params);
|
|
9450
|
+
util_exports.defineLazy(inst, "shape", () => {
|
|
9451
|
+
return def.shape;
|
|
9452
|
+
});
|
|
8567
9453
|
inst.keyof = () => _enum(Object.keys(inst._zod.def.shape));
|
|
8568
9454
|
inst.catchall = (catchall) => inst.clone({ ...inst._zod.def, catchall });
|
|
8569
9455
|
inst.passthrough = () => inst.clone({ ...inst._zod.def, catchall: unknown() });
|
|
@@ -8585,6 +9471,7 @@ var ZodObject = /* @__PURE__ */ $constructor("ZodObject", (inst, def) => {
|
|
|
8585
9471
|
var ZodUnion = /* @__PURE__ */ $constructor("ZodUnion", (inst, def) => {
|
|
8586
9472
|
$ZodUnion.init(inst, def);
|
|
8587
9473
|
ZodType.init(inst, def);
|
|
9474
|
+
inst._zod.processJSONSchema = (ctx, json, params) => unionProcessor(inst, ctx, json, params);
|
|
8588
9475
|
inst.options = def.options;
|
|
8589
9476
|
});
|
|
8590
9477
|
function union(options, params) {
|
|
@@ -8601,6 +9488,7 @@ var ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("ZodDiscriminatedUnion"
|
|
|
8601
9488
|
var ZodIntersection = /* @__PURE__ */ $constructor("ZodIntersection", (inst, def) => {
|
|
8602
9489
|
$ZodIntersection.init(inst, def);
|
|
8603
9490
|
ZodType.init(inst, def);
|
|
9491
|
+
inst._zod.processJSONSchema = (ctx, json, params) => intersectionProcessor(inst, ctx, json, params);
|
|
8604
9492
|
});
|
|
8605
9493
|
function intersection(left, right) {
|
|
8606
9494
|
return new ZodIntersection({
|
|
@@ -8612,6 +9500,7 @@ function intersection(left, right) {
|
|
|
8612
9500
|
var ZodTuple = /* @__PURE__ */ $constructor("ZodTuple", (inst, def) => {
|
|
8613
9501
|
$ZodTuple.init(inst, def);
|
|
8614
9502
|
ZodType.init(inst, def);
|
|
9503
|
+
inst._zod.processJSONSchema = (ctx, json, params) => tupleProcessor(inst, ctx, json, params);
|
|
8615
9504
|
inst.rest = (rest) => inst.clone({
|
|
8616
9505
|
...inst._zod.def,
|
|
8617
9506
|
rest
|
|
@@ -8620,12 +9509,14 @@ var ZodTuple = /* @__PURE__ */ $constructor("ZodTuple", (inst, def) => {
|
|
|
8620
9509
|
var ZodRecord = /* @__PURE__ */ $constructor("ZodRecord", (inst, def) => {
|
|
8621
9510
|
$ZodRecord.init(inst, def);
|
|
8622
9511
|
ZodType.init(inst, def);
|
|
9512
|
+
inst._zod.processJSONSchema = (ctx, json, params) => recordProcessor(inst, ctx, json, params);
|
|
8623
9513
|
inst.keyType = def.keyType;
|
|
8624
9514
|
inst.valueType = def.valueType;
|
|
8625
9515
|
});
|
|
8626
9516
|
var ZodEnum = /* @__PURE__ */ $constructor("ZodEnum", (inst, def) => {
|
|
8627
9517
|
$ZodEnum.init(inst, def);
|
|
8628
9518
|
ZodType.init(inst, def);
|
|
9519
|
+
inst._zod.processJSONSchema = (ctx, json, params) => enumProcessor(inst, ctx, json, params);
|
|
8629
9520
|
inst.enum = def.entries;
|
|
8630
9521
|
inst.options = Object.values(def.entries);
|
|
8631
9522
|
const keys = new Set(Object.keys(def.entries));
|
|
@@ -8671,6 +9562,7 @@ function _enum(values, params) {
|
|
|
8671
9562
|
var ZodLiteral = /* @__PURE__ */ $constructor("ZodLiteral", (inst, def) => {
|
|
8672
9563
|
$ZodLiteral.init(inst, def);
|
|
8673
9564
|
ZodType.init(inst, def);
|
|
9565
|
+
inst._zod.processJSONSchema = (ctx, json, params) => literalProcessor(inst, ctx, json, params);
|
|
8674
9566
|
inst.values = new Set(def.values);
|
|
8675
9567
|
Object.defineProperty(inst, "value", {
|
|
8676
9568
|
get() {
|
|
@@ -8684,6 +9576,7 @@ var ZodLiteral = /* @__PURE__ */ $constructor("ZodLiteral", (inst, def) => {
|
|
|
8684
9576
|
var ZodTransform = /* @__PURE__ */ $constructor("ZodTransform", (inst, def) => {
|
|
8685
9577
|
$ZodTransform.init(inst, def);
|
|
8686
9578
|
ZodType.init(inst, def);
|
|
9579
|
+
inst._zod.processJSONSchema = (ctx, json, params) => transformProcessor(inst, ctx, json, params);
|
|
8687
9580
|
inst._zod.parse = (payload, _ctx) => {
|
|
8688
9581
|
if (_ctx.direction === "backward") {
|
|
8689
9582
|
throw new $ZodEncodeError(inst.constructor.name);
|
|
@@ -8721,6 +9614,7 @@ function transform(fn) {
|
|
|
8721
9614
|
var ZodOptional = /* @__PURE__ */ $constructor("ZodOptional", (inst, def) => {
|
|
8722
9615
|
$ZodOptional.init(inst, def);
|
|
8723
9616
|
ZodType.init(inst, def);
|
|
9617
|
+
inst._zod.processJSONSchema = (ctx, json, params) => optionalProcessor(inst, ctx, json, params);
|
|
8724
9618
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
8725
9619
|
});
|
|
8726
9620
|
function optional(innerType) {
|
|
@@ -8732,6 +9626,7 @@ function optional(innerType) {
|
|
|
8732
9626
|
var ZodNullable = /* @__PURE__ */ $constructor("ZodNullable", (inst, def) => {
|
|
8733
9627
|
$ZodNullable.init(inst, def);
|
|
8734
9628
|
ZodType.init(inst, def);
|
|
9629
|
+
inst._zod.processJSONSchema = (ctx, json, params) => nullableProcessor(inst, ctx, json, params);
|
|
8735
9630
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
8736
9631
|
});
|
|
8737
9632
|
function nullable(innerType) {
|
|
@@ -8743,6 +9638,7 @@ function nullable(innerType) {
|
|
|
8743
9638
|
var ZodDefault = /* @__PURE__ */ $constructor("ZodDefault", (inst, def) => {
|
|
8744
9639
|
$ZodDefault.init(inst, def);
|
|
8745
9640
|
ZodType.init(inst, def);
|
|
9641
|
+
inst._zod.processJSONSchema = (ctx, json, params) => defaultProcessor(inst, ctx, json, params);
|
|
8746
9642
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
8747
9643
|
inst.removeDefault = inst.unwrap;
|
|
8748
9644
|
});
|
|
@@ -8758,6 +9654,7 @@ function _default(innerType, defaultValue) {
|
|
|
8758
9654
|
var ZodPrefault = /* @__PURE__ */ $constructor("ZodPrefault", (inst, def) => {
|
|
8759
9655
|
$ZodPrefault.init(inst, def);
|
|
8760
9656
|
ZodType.init(inst, def);
|
|
9657
|
+
inst._zod.processJSONSchema = (ctx, json, params) => prefaultProcessor(inst, ctx, json, params);
|
|
8761
9658
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
8762
9659
|
});
|
|
8763
9660
|
function prefault(innerType, defaultValue) {
|
|
@@ -8772,6 +9669,7 @@ function prefault(innerType, defaultValue) {
|
|
|
8772
9669
|
var ZodNonOptional = /* @__PURE__ */ $constructor("ZodNonOptional", (inst, def) => {
|
|
8773
9670
|
$ZodNonOptional.init(inst, def);
|
|
8774
9671
|
ZodType.init(inst, def);
|
|
9672
|
+
inst._zod.processJSONSchema = (ctx, json, params) => nonoptionalProcessor(inst, ctx, json, params);
|
|
8775
9673
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
8776
9674
|
});
|
|
8777
9675
|
function nonoptional(innerType, params) {
|
|
@@ -8784,6 +9682,7 @@ function nonoptional(innerType, params) {
|
|
|
8784
9682
|
var ZodCatch = /* @__PURE__ */ $constructor("ZodCatch", (inst, def) => {
|
|
8785
9683
|
$ZodCatch.init(inst, def);
|
|
8786
9684
|
ZodType.init(inst, def);
|
|
9685
|
+
inst._zod.processJSONSchema = (ctx, json, params) => catchProcessor(inst, ctx, json, params);
|
|
8787
9686
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
8788
9687
|
inst.removeCatch = inst.unwrap;
|
|
8789
9688
|
});
|
|
@@ -8797,6 +9696,7 @@ function _catch(innerType, catchValue) {
|
|
|
8797
9696
|
var ZodPipe = /* @__PURE__ */ $constructor("ZodPipe", (inst, def) => {
|
|
8798
9697
|
$ZodPipe.init(inst, def);
|
|
8799
9698
|
ZodType.init(inst, def);
|
|
9699
|
+
inst._zod.processJSONSchema = (ctx, json, params) => pipeProcessor(inst, ctx, json, params);
|
|
8800
9700
|
inst.in = def.in;
|
|
8801
9701
|
inst.out = def.out;
|
|
8802
9702
|
});
|
|
@@ -8811,6 +9711,7 @@ function pipe2(in_, out) {
|
|
|
8811
9711
|
var ZodReadonly = /* @__PURE__ */ $constructor("ZodReadonly", (inst, def) => {
|
|
8812
9712
|
$ZodReadonly.init(inst, def);
|
|
8813
9713
|
ZodType.init(inst, def);
|
|
9714
|
+
inst._zod.processJSONSchema = (ctx, json, params) => readonlyProcessor(inst, ctx, json, params);
|
|
8814
9715
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
8815
9716
|
});
|
|
8816
9717
|
function readonly(innerType) {
|
|
@@ -8822,11 +9723,13 @@ function readonly(innerType) {
|
|
|
8822
9723
|
var ZodPromise = /* @__PURE__ */ $constructor("ZodPromise", (inst, def) => {
|
|
8823
9724
|
$ZodPromise.init(inst, def);
|
|
8824
9725
|
ZodType.init(inst, def);
|
|
9726
|
+
inst._zod.processJSONSchema = (ctx, json, params) => promiseProcessor(inst, ctx, json, params);
|
|
8825
9727
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
8826
9728
|
});
|
|
8827
9729
|
var ZodCustom = /* @__PURE__ */ $constructor("ZodCustom", (inst, def) => {
|
|
8828
9730
|
$ZodCustom.init(inst, def);
|
|
8829
9731
|
ZodType.init(inst, def);
|
|
9732
|
+
inst._zod.processJSONSchema = (ctx, json, params) => customProcessor(inst, ctx, json, params);
|
|
8830
9733
|
});
|
|
8831
9734
|
function refine(fn, _params = {}) {
|
|
8832
9735
|
return _refine(ZodCustom, fn, _params);
|
|
@@ -9300,7 +10203,8 @@ var openapi = ({
|
|
|
9300
10203
|
}
|
|
9301
10204
|
};
|
|
9302
10205
|
};
|
|
9303
|
-
const app = new Elysia({ name: "@elysiajs/openapi" })
|
|
10206
|
+
const app = new Elysia({ name: "@elysiajs/openapi" });
|
|
10207
|
+
app.use((app2) => {
|
|
9304
10208
|
if (provider === null) return app2;
|
|
9305
10209
|
const page = () => new Response(
|
|
9306
10210
|
provider === "swagger-ui" ? SwaggerUIRender(info, {
|