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