@power-plant/schema 0.0.36 → 0.0.38
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/dist/codegen.cjs +1 -1
- package/dist/codegen.d.cts +1 -1
- package/dist/codegen.d.mts +1 -1
- package/dist/codegen.mjs +7 -7
- package/dist/deepkit.cjs +9 -0
- package/dist/deepkit.d.cts +1 -0
- package/dist/deepkit.d.mts +1 -0
- package/dist/deepkit.mjs +3 -0
- package/dist/{helpers-CQS3qnsv.cjs → helpers-DbFdMcOB.cjs} +1 -1
- package/dist/{helpers-BxWdDZn4.mjs → helpers-_8ADIMSN.mjs} +2 -2
- package/dist/helpers-_8ADIMSN.mjs.map +1 -0
- package/dist/index.cjs +576 -98
- package/dist/index.d.cts +20 -16
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +20 -16
- package/dist/index.mjs +578 -102
- package/dist/{types-OH3Npqz2.d.mts → types-BH-Q7QrB.d.cts} +103 -76
- package/dist/types-BH-Q7QrB.d.cts.map +1 -0
- package/dist/{types-CEGqfUA4.d.cts → types-BrSNvUQg.d.mts} +103 -76
- package/dist/types-BrSNvUQg.d.mts.map +1 -0
- package/dist/valibot.d.cts +1 -1
- package/dist/valibot.d.mts +1 -1
- package/dist/zod.cjs +1 -1
- package/dist/zod.d.cts +1 -1
- package/dist/zod.d.mts +1 -1
- package/dist/zod.mjs +1 -1
- package/package.json +36 -19
- package/dist/helpers-BxWdDZn4.mjs.map +0 -1
- package/dist/types-CEGqfUA4.d.cts.map +0 -1
- package/dist/types-OH3Npqz2.d.mts.map +0 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { BaseIssue, BaseSchema } from "valibot";
|
|
1
|
+
import { ReceiveType, Type } from "@deepkit/type";
|
|
3
2
|
import { StandardJSONSchemaV1 } from "@standard-schema/spec";
|
|
4
3
|
import { InferLoadOptions, LoadReference } from "@stryke/resolve/types";
|
|
5
4
|
import { Storage } from "unstorage";
|
|
6
5
|
import { InputObject, Schema } from "untyped";
|
|
6
|
+
import { BaseIssue, BaseSchema } from "valibot";
|
|
7
7
|
import * as z3 from "zod/v3";
|
|
8
8
|
//#region src/constants.d.ts
|
|
9
9
|
declare const JsonSchemaTypeNames: {
|
|
@@ -72,36 +72,6 @@ type JsonSchemaNumberFormat = JsonSchemaDecimalFormat | JsonSchemaIntegerFormat;
|
|
|
72
72
|
* Semantic format names for JSON Schema string types.
|
|
73
73
|
*/
|
|
74
74
|
type JsonSchemaStringFormat = "binary" | "date" | "time" | "date-time" | "iso-time" | "iso-date-time" | "duration" | "uri" | "uri-reference" | "uri-template" | "url" | "email" | "hostname" | "ipv4" | "ipv6" | "regex" | "uuid" | "json-pointer" | "json-pointer-uri-fragment" | "relative-json-pointer" | "byte" | "password";
|
|
75
|
-
/**
|
|
76
|
-
* A single function parameter entry emitted when `function` is true.
|
|
77
|
-
*
|
|
78
|
-
* @remarks
|
|
79
|
-
* Power Plant extension used with `ts-json-schema-generator` `functions: "schema"` mode.
|
|
80
|
-
* Boolean flags are omitted when false. Defaults live on `schema.default`.
|
|
81
|
-
*/
|
|
82
|
-
interface JsonSchemaFunctionParameter {
|
|
83
|
-
/**
|
|
84
|
-
* Parameter name. Binding-pattern parameters use synthetic names (`$0`, `$1`, ...).
|
|
85
|
-
* Rest parameter names omit the `...` prefix.
|
|
86
|
-
*/
|
|
87
|
-
name: string;
|
|
88
|
-
/**
|
|
89
|
-
* JSON Schema for the parameter value.
|
|
90
|
-
*/
|
|
91
|
-
schema: JsonSchema;
|
|
92
|
-
/**
|
|
93
|
-
* True when the parameter is declared with `?`.
|
|
94
|
-
*/
|
|
95
|
-
optional?: boolean;
|
|
96
|
-
/**
|
|
97
|
-
* True when the parameter is a rest parameter (`...args`).
|
|
98
|
-
*/
|
|
99
|
-
rest?: boolean;
|
|
100
|
-
/**
|
|
101
|
-
* True when the parameter is a `this` parameter.
|
|
102
|
-
*/
|
|
103
|
-
this?: boolean;
|
|
104
|
-
}
|
|
105
75
|
/**
|
|
106
76
|
* Metadata and annotation keywords shared across JSON Schema shapes.
|
|
107
77
|
*
|
|
@@ -166,43 +136,6 @@ interface JsonSchemaMetadataKeywords {
|
|
|
166
136
|
* @see https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-validation-01#section-8.2.7
|
|
167
137
|
*/
|
|
168
138
|
$dynamicAnchor?: string;
|
|
169
|
-
/**
|
|
170
|
-
* An indicator specifying if the schema is a function or not.
|
|
171
|
-
*
|
|
172
|
-
* @remarks
|
|
173
|
-
* This is an internal property used by Power Plant - it is not part of the JSON Schema specification.
|
|
174
|
-
* When true, `parameters` describes the function arguments in declaration order and `returns`
|
|
175
|
-
* describes the return value (omitted for `void` / `undefined` / `never`).
|
|
176
|
-
*
|
|
177
|
-
* Constructor schemas also emit an own-property `"constructor": true` on the wire (see
|
|
178
|
-
* `JSON_SCHEMA_CONSTRUCTOR_KEY`). That key is intentionally omitted from this interface
|
|
179
|
-
* because a TypeScript `constructor` property collides with `Object.prototype.constructor` and
|
|
180
|
-
* breaks assignability across the schema union. Read it with `hasJsonSchemaConstructorFlag`.
|
|
181
|
-
*/
|
|
182
|
-
function?: boolean;
|
|
183
|
-
/**
|
|
184
|
-
* When true, the function is asynchronous (`async` and/or returns `Promise<T>`).
|
|
185
|
-
*
|
|
186
|
-
* @remarks
|
|
187
|
-
* This is an internal property used by Power Plant - it is not part of the JSON Schema specification.
|
|
188
|
-
* When set, `returns` describes the unwrapped `T` from `Promise<T>` (one layer).
|
|
189
|
-
*/
|
|
190
|
-
async?: boolean;
|
|
191
|
-
/**
|
|
192
|
-
* Ordered function parameters when `function` is true.
|
|
193
|
-
*
|
|
194
|
-
* @remarks
|
|
195
|
-
* Always present for function schemas (may be an empty array). Each entry wraps a parameter
|
|
196
|
-
* schema with metadata such as `name`, `optional`, `rest`, and `this`.
|
|
197
|
-
*/
|
|
198
|
-
parameters?: JsonSchemaFunctionParameter[];
|
|
199
|
-
/**
|
|
200
|
-
* Return-value schema when `function` is true.
|
|
201
|
-
*
|
|
202
|
-
* @remarks
|
|
203
|
-
* Omitted for `void`, `undefined`, and `never` return types.
|
|
204
|
-
*/
|
|
205
|
-
returns?: JsonSchema;
|
|
206
139
|
/**
|
|
207
140
|
* A name for the schema, which can be used by documentation tools or other libraries that support this feature to provide a human-readable name or description for the schema. The presence of this property does not affect the validation behavior of the schema itself, but it can provide additional context or information about the schema when used in conjunction with compatible tools.
|
|
208
141
|
*/
|
|
@@ -1059,13 +992,86 @@ interface JsonSchemaRef extends JsonSchemaKeywords {
|
|
|
1059
992
|
*/
|
|
1060
993
|
$ref: string;
|
|
1061
994
|
}
|
|
995
|
+
interface JsonSchemaFunction extends JsonSchemaKeywords {
|
|
996
|
+
/**
|
|
997
|
+
* Declares whether values are numbers or integers.
|
|
998
|
+
*/
|
|
999
|
+
type: "object";
|
|
1000
|
+
/**
|
|
1001
|
+
* An indicator specifying if the schema is a function or not.
|
|
1002
|
+
*
|
|
1003
|
+
* @remarks
|
|
1004
|
+
* This is an internal property used by Power Plant - it is not part of the JSON Schema specification.
|
|
1005
|
+
* When true, `parameters` describes the function arguments in declaration order and `returns`
|
|
1006
|
+
* describes the return value (omitted for `void` / `undefined` / `never`).
|
|
1007
|
+
*
|
|
1008
|
+
* Constructor schemas also emit an own-property `"constructor": true` on the wire (see
|
|
1009
|
+
* `JSON_SCHEMA_CONSTRUCTOR_KEY`). That key is intentionally omitted from this interface
|
|
1010
|
+
* because a TypeScript `constructor` property collides with `Object.prototype.constructor` and
|
|
1011
|
+
* breaks assignability across the schema union. Read it with `hasJsonSchemaConstructorFlag`.
|
|
1012
|
+
*/
|
|
1013
|
+
function: true;
|
|
1014
|
+
/**
|
|
1015
|
+
* When true, the function is asynchronous (`async` and/or returns `Promise<T>`).
|
|
1016
|
+
*
|
|
1017
|
+
* @remarks
|
|
1018
|
+
* This is an internal property used by Power Plant - it is not part of the JSON Schema specification.
|
|
1019
|
+
* When set, `returns` describes the unwrapped `T` from `Promise<T>` (one layer).
|
|
1020
|
+
*/
|
|
1021
|
+
async?: boolean;
|
|
1022
|
+
/**
|
|
1023
|
+
* Ordered function parameters when `function` is true.
|
|
1024
|
+
*
|
|
1025
|
+
* @remarks
|
|
1026
|
+
* Always present for function schemas (may be an empty array). Each entry wraps a parameter
|
|
1027
|
+
* schema with metadata such as `name`, `optional`, `rest`, and `this`.
|
|
1028
|
+
*/
|
|
1029
|
+
parameters?: JsonSchemaFunctionParameter[];
|
|
1030
|
+
/**
|
|
1031
|
+
* Return-value schema when `function` is true.
|
|
1032
|
+
*
|
|
1033
|
+
* @remarks
|
|
1034
|
+
* Omitted for `void`, `undefined`, and `never` return types.
|
|
1035
|
+
*/
|
|
1036
|
+
returns?: JsonSchema;
|
|
1037
|
+
}
|
|
1038
|
+
/**
|
|
1039
|
+
* A single function parameter entry emitted when `function` is true.
|
|
1040
|
+
*
|
|
1041
|
+
* @remarks
|
|
1042
|
+
* Power Plant extension for function parameter schemas emitted from Deepkit reflection.
|
|
1043
|
+
* Boolean flags are omitted when false. Defaults live on `schema.default`.
|
|
1044
|
+
*/
|
|
1045
|
+
interface JsonSchemaFunctionParameter extends JsonSchemaKeywords {
|
|
1046
|
+
/**
|
|
1047
|
+
* Parameter name. Binding-pattern parameters use synthetic names (`$0`, `$1`, ...).
|
|
1048
|
+
* Rest parameter names omit the `...` prefix.
|
|
1049
|
+
*/
|
|
1050
|
+
name: string;
|
|
1051
|
+
/**
|
|
1052
|
+
* JSON Schema for the parameter value.
|
|
1053
|
+
*/
|
|
1054
|
+
schema: JsonSchema;
|
|
1055
|
+
/**
|
|
1056
|
+
* True when the parameter is declared with `?`.
|
|
1057
|
+
*/
|
|
1058
|
+
optional?: boolean;
|
|
1059
|
+
/**
|
|
1060
|
+
* True when the parameter is a rest parameter (`...args`).
|
|
1061
|
+
*/
|
|
1062
|
+
rest?: boolean;
|
|
1063
|
+
/**
|
|
1064
|
+
* True when the parameter is a `this` parameter.
|
|
1065
|
+
*/
|
|
1066
|
+
this?: boolean;
|
|
1067
|
+
}
|
|
1062
1068
|
/**
|
|
1063
1069
|
* JSON Schema (draft 2020-12) type that can be used to validate JSON data. It is a union of all the specific JSON Schema types, as well as the metadata properties that can be included in any JSON Schema.
|
|
1064
1070
|
*
|
|
1065
1071
|
* @see https://json-schema.org/draft/2020-12
|
|
1066
1072
|
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01
|
|
1067
1073
|
*/
|
|
1068
|
-
type JsonSchema = JsonSchemaString | JsonSchemaInteger | JsonSchemaDecimal | JsonSchemaBigint | JsonSchemaBoolean | JsonSchemaDate | JsonSchemaEnum | JsonSchemaLiteral | JsonSchemaNativeEnum | JsonSchemaNull | JsonSchemaArray | JsonSchemaObject | JsonSchemaRecord | JsonSchemaTuple | JsonSchemaUnion | JsonSchemaUndefined | JsonSchemaRef | JsonSchemaNever | JsonSchemaMap | JsonSchemaAny | JsonSchemaNullable | JsonSchemaAllOf | JsonSchemaUnknown | JsonSchemaSet;
|
|
1074
|
+
type JsonSchema = JsonSchemaString | JsonSchemaInteger | JsonSchemaDecimal | JsonSchemaBigint | JsonSchemaBoolean | JsonSchemaDate | JsonSchemaEnum | JsonSchemaLiteral | JsonSchemaNativeEnum | JsonSchemaNull | JsonSchemaArray | JsonSchemaObject | JsonSchemaRecord | JsonSchemaTuple | JsonSchemaUnion | JsonSchemaUndefined | JsonSchemaRef | JsonSchemaNever | JsonSchemaMap | JsonSchemaAny | JsonSchemaNullable | JsonSchemaAllOf | JsonSchemaUnknown | JsonSchemaSet | JsonSchemaFunction;
|
|
1069
1075
|
/**
|
|
1070
1076
|
* An object containing common JSON Schema metadata properties that can be included in any schema type. This interface is used to define the shared metadata properties that can be present in all JSON Schema types, such as `$id`, `$schema`, `title`, `description`, and others. It serves as a base for all specific JSON Schema types, allowing them to include these common metadata properties without having to redefine them in each type.
|
|
1071
1077
|
*/
|
|
@@ -1233,7 +1239,7 @@ type SpecOf<TJsonSchema extends JsonSchema> = TJsonSchema extends JsonSchemaNeve
|
|
|
1233
1239
|
/**
|
|
1234
1240
|
* Supported source variants from which a schema can be extracted.
|
|
1235
1241
|
*/
|
|
1236
|
-
type SchemaSourceVariant = "standard-schema" | "json-schema" | "zod3" | "untyped" | "valibot";
|
|
1242
|
+
type SchemaSourceVariant = "standard-schema" | "json-schema" | "zod3" | "untyped" | "valibot" | "reflection";
|
|
1237
1243
|
/**
|
|
1238
1244
|
* Accepted schema input variants, including raw type definitions.
|
|
1239
1245
|
*/
|
|
@@ -1257,7 +1263,7 @@ type ValibotSchema<TInput = unknown, TOutput = unknown, TIssue extends BaseIssue
|
|
|
1257
1263
|
/**
|
|
1258
1264
|
* Raw schema source input union before normalization.
|
|
1259
1265
|
*/
|
|
1260
|
-
type SchemaSourceConfig<TSpec = any> = StandardJSONSchemaV1<TSpec> | JsonSchemaOf<TSpec> | z3.ZodType<TSpec, any, any> | UntypedConfigObject | UntypedSchema | ValibotSchema<TSpec>;
|
|
1266
|
+
type SchemaSourceConfig<TSpec = any> = StandardJSONSchemaV1<TSpec> | JsonSchemaOf<TSpec> | z3.ZodType<TSpec, any, any> | UntypedConfigObject | UntypedSchema | ValibotSchema<TSpec> | Type | ReceiveType<TSpec>;
|
|
1261
1267
|
/**
|
|
1262
1268
|
* Any accepted schema input, including normalized schemas and references.
|
|
1263
1269
|
*
|
|
@@ -1295,11 +1301,23 @@ type BaseExtractOptions = {
|
|
|
1295
1301
|
* An optional working directory to use for resolving file references. If provided, the working directory will be used to resolve file references, which can improve performance by avoiding redundant file resolution operations. If not provided, the current working directory will be used.
|
|
1296
1302
|
*/
|
|
1297
1303
|
cwd?: string;
|
|
1304
|
+
/**
|
|
1305
|
+
* An optional path to a `tsconfig.json` used when reflecting TypeScript types.
|
|
1306
|
+
*/
|
|
1307
|
+
tsconfig?: string;
|
|
1298
1308
|
/**
|
|
1299
1309
|
* An optional logger to use for logging messages. If provided, the logger will be used to log messages, which can improve performance by avoiding redundant logging operations. If not provided, the default logger will be used.
|
|
1300
1310
|
*/
|
|
1301
1311
|
logger?: Logger;
|
|
1302
|
-
|
|
1312
|
+
/**
|
|
1313
|
+
* An optional mode for the reflection.
|
|
1314
|
+
*/
|
|
1315
|
+
reflection?: string[] | "default" | "explicit" | "never" | undefined;
|
|
1316
|
+
/**
|
|
1317
|
+
* An optional list of paths to exclude from the reflection.
|
|
1318
|
+
*/
|
|
1319
|
+
exclude?: string[];
|
|
1320
|
+
};
|
|
1303
1321
|
type InferExtractOptions<T extends SchemaConfig> = (T extends LoadReference ? Omit<InferLoadOptions<T>, "fs"> : {}) & BaseExtractOptions;
|
|
1304
1322
|
/**
|
|
1305
1323
|
* A schema envelope that contains the normalized schema and its source variant.
|
|
@@ -1382,10 +1400,19 @@ interface ValibotSchemaSource<TSpec = any> extends BaseSchemaSource<TSpec> {
|
|
|
1382
1400
|
/** The original Valibot schema input. */
|
|
1383
1401
|
schema: ValibotSchema<TSpec>;
|
|
1384
1402
|
}
|
|
1403
|
+
/**
|
|
1404
|
+
* Source descriptor for Deepkit reflection type inputs.
|
|
1405
|
+
*/
|
|
1406
|
+
interface ReflectionSchemaSource<TSpec = any> extends BaseSchemaSource<TSpec> {
|
|
1407
|
+
/** Indicates the source input is a Deepkit reflection {@link Type}. */
|
|
1408
|
+
variant: "reflection";
|
|
1409
|
+
/** The original Deepkit reflection type. */
|
|
1410
|
+
schema: Type;
|
|
1411
|
+
}
|
|
1385
1412
|
/**
|
|
1386
1413
|
* Union of all normalized schema source descriptor variants.
|
|
1387
1414
|
*/
|
|
1388
|
-
type SchemaSource<TSpec = any> = JsonSchemaSchemaSource<TSpec> | StandardSchemaSchemaSource<TSpec> | Zod3SchemaSource<TSpec> | UntypedSchemaSource<TSpec> | ValibotSchemaSource<TSpec>;
|
|
1415
|
+
type SchemaSource<TSpec = any> = JsonSchemaSchemaSource<TSpec> | StandardSchemaSchemaSource<TSpec> | Zod3SchemaSource<TSpec> | UntypedSchemaSource<TSpec> | ValibotSchemaSource<TSpec> | ReflectionSchemaSource<TSpec>;
|
|
1389
1416
|
/**
|
|
1390
1417
|
* A normalized schema plus metadata about the source that produced it.
|
|
1391
1418
|
*/
|
|
@@ -1422,5 +1449,5 @@ declare module "zod" {
|
|
|
1422
1449
|
}
|
|
1423
1450
|
}
|
|
1424
1451
|
//#endregion
|
|
1425
|
-
export {
|
|
1426
|
-
//# sourceMappingURL=types-
|
|
1452
|
+
export { SchemaEnvelopeOf as $, JsonSchemaNullable as A, JsonSchemaSchemaSource as B, JsonSchemaLiteral as C, JsonSchemaNativeEnum as D, JsonSchemaMetadataKeywords as E, JsonSchemaPrimitiveType as F, JsonSchemaType as G, JsonSchemaString as H, JsonSchemaPrimitiveUnion as I, JsonSchemaUnknown as J, JsonSchemaUndefined as K, JsonSchemaRecord as L, JsonSchemaNumberFormat as M, JsonSchemaObject as N, JsonSchemaNever as O, JsonSchemaOf as P, SchemaEnvelope as Q, JsonSchemaRecordPropertyNames as R, JsonSchemaLike as S, JsonSchemaMap as T, JsonSchemaStringFormat as U, JsonSchemaSet as V, JsonSchemaTuple as W, SchemaConfig as X, ReflectionSchemaSource as Y, SchemaConfigVariant as Z, JsonSchemaFunction as _, SCHEMA_RECORD_KEYWORDS as _t, JsonSchema as a, UntypedConfigObject as at, JsonSchemaIntegerFormat as b, JsonSchemaAnyOf as c, ValibotSchema as ct, JsonSchemaBoolean as d, JSON_SCHEMA_CONSTRUCTOR_KEY as dt, SchemaSource as et, JsonSchemaConditionalKeywords as f, JSON_SCHEMA_METADATA_KEYS as ft, JsonSchemaEnum as g, SCHEMA_ARRAY_CONCAT_KEYWORDS as gt, JsonSchemaDecimalFormat as h, JsonSchemaTypeNames as ht, InferExtractOptions as i, StandardSchemaSchemaSource as it, JsonSchemaNumber as j, JsonSchemaNull as k, JsonSchemaArray as l, ValibotSchemaSource as lt, JsonSchemaDecimal as m, JSON_SCHEMA_TYPES as mt, BaseSchemaSource as n, SchemaSourceVariant as nt, JsonSchemaAllOf as o, UntypedSchema as ot, JsonSchemaDate as p, JSON_SCHEMA_PRIMITIVE_TYPES as pt, JsonSchemaUnion as q, ExtractedSchemaEnvelope as r, SpecOf as rt, JsonSchemaAny as s, UntypedSchemaSource as st, BaseExtractOptions as t, SchemaSourceConfig as tt, JsonSchemaBigint as u, Zod3SchemaSource as ut, JsonSchemaFunctionParameter as v, SCHEMA_SINGLE_KEYWORDS as vt, JsonSchemaLogicKeywords as w, JsonSchemaKeywords as x, JsonSchemaInteger as y, JsonSchemaRef as z };
|
|
1453
|
+
//# sourceMappingURL=types-BH-Q7QrB.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types-BH-Q7QrB.d.cts","names":[],"sources":["../src/constants.ts","../src/types.ts"],"mappings":";;;;;;;;cAoBa;;;;;;;;;cAUA;cAQA;cAMA;;;;;;;;;cAkCA;;;;;cAMA,wBAAsB;;;;;cAYtB,wBAAsB;;;;;cAiBtB,8BAA4B;;;;;;;;KC5E7B,kCACF;;;;;;KAOE,yBAAyB;;;;KAKzB;;;;KAaA;;;;KAKA,yBACV,0BAA0B;;;;KAKhB;;;;;;UA6BK;;;;;;;EAOf;;;;;;;EAQA;;;;;;;EAWA,cAAc;;;;;;;EAQd;;;;;;EAOA;;;;;;;;;EAUA,QAAQ,eAAe;;;;;;;;EASvB;;;;;;;EAQA;;;;EAKA;;;;EAKA;;;;EAKA;;;;EAKA;;;;EAKA;;;;EAKA;IACc;IAAe;IAAsB;;;;;EAMnD;;;;EAKA;;;;EAKA;IAGM;IAAkB;IAAgB;;;;;EAKxC;;;;EAKA;;;;;;EAOA;;;;EAKA;;;;EAKA;;;;EAKA;;;;;;;;UASe;;;;;;;;;EASf,QAAQ;;;;;;;;;EAUR,QAAQ;;;;;;;;;EAUR,QAAQ;;;;;;;;;EAUR,MAAM;;;;;;;;UASS;;;;;;;;;EASf,KAAK;;;;;;;;;EAUL,OAAO;;;;;;;;;EAUP,OAAO;;;;;KAMG,qBAAqB,6BAC/B,0BACA;;;;KAKU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ACA,mBAAmB,SACnB,eAAe,aAAa;UAEtB;EACR,QAAQ;EACR,OAAO;EACP,OAAO;EACP,QAAQ;;KAGE;;;;EAIV,UAAU;;;;EAKV;;;;EAKA;;;;EAKA,SAAS;;;;EAKT;;;;EAKA;;KAGU,oBAAoB,UAAU,iBACvC,UAAU,gBACP,KAAK,iBAAiB,kBAGxB;;;;UAKa,eAAe,oBAAoB,aAAa;;;;EAI/D;;;;EAKA,SAAS;;;;EAKT,QAAQ;;;;;;;;;KAUE,iBAAiB,SAAS,eAAe,aAAa;;;;UAKjD,iBAAiB;;EAEhC;;EAGA,SAAS;;EAGT,QAAQ,mBAAmB;;;;;UAMZ,uBACf,qBACQ,iBAAiB;;EAEzB;;EAGA,QAAQ,aAAa;;;;;UAMN,2BACf,qBACQ,iBAAiB;;EAEzB;;EAGA,QAAQ,qBAAqB;;;;;UAMd,iBAAiB,qBAAqB,iBAAiB;;EAEtE;;EAGA,QAAQ,GAAG,QAAQ;;;;;UAMJ,oBACf,qBACQ,iBAAiB;;EAEzB;;EAGA,QAAQ,sBAAsB;;;;;UAMf,oBACf,qBACQ,iBAAiB;;EAEzB;;EAGA,QAAQ,cAAc;;;;;UAMP,uBACf,qBACQ,iBAAiB;;EAEzB;;EAGA,QAAQ;;;;;KAME,aAAa,eACrB,uBAAuB,SACvB,2BAA2B,SAC3B,iBAAiB,SACjB,oBAAoB,SACpB,oBAAoB,SACpB,uBAAuB;;;;UAKV,wBACf,qBACQ,iBAAiB;;;;EAIzB,QAAQ,aAAa;;;YAIX;IACR;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;MACc;MAAe;MAAsB;;IACnD;IACA;IACA;IACA;IACA;KACC"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import { ReceiveType, Type } from "@deepkit/type";
|
|
2
|
+
import { BaseIssue, BaseSchema } from "valibot";
|
|
1
3
|
import { StandardJSONSchemaV1 } from "@standard-schema/spec";
|
|
2
4
|
import { InferLoadOptions, LoadReference } from "@stryke/resolve/types";
|
|
3
|
-
import { Config } from "ts-json-schema-generator/dist/src/Config.js";
|
|
4
5
|
import { Storage } from "unstorage";
|
|
5
6
|
import { InputObject, Schema } from "untyped";
|
|
6
|
-
import { BaseIssue, BaseSchema } from "valibot";
|
|
7
7
|
import * as z3 from "zod/v3";
|
|
8
8
|
//#region src/constants.d.ts
|
|
9
9
|
declare const JsonSchemaTypeNames: {
|
|
@@ -72,36 +72,6 @@ type JsonSchemaNumberFormat = JsonSchemaDecimalFormat | JsonSchemaIntegerFormat;
|
|
|
72
72
|
* Semantic format names for JSON Schema string types.
|
|
73
73
|
*/
|
|
74
74
|
type JsonSchemaStringFormat = "binary" | "date" | "time" | "date-time" | "iso-time" | "iso-date-time" | "duration" | "uri" | "uri-reference" | "uri-template" | "url" | "email" | "hostname" | "ipv4" | "ipv6" | "regex" | "uuid" | "json-pointer" | "json-pointer-uri-fragment" | "relative-json-pointer" | "byte" | "password";
|
|
75
|
-
/**
|
|
76
|
-
* A single function parameter entry emitted when `function` is true.
|
|
77
|
-
*
|
|
78
|
-
* @remarks
|
|
79
|
-
* Power Plant extension used with `ts-json-schema-generator` `functions: "schema"` mode.
|
|
80
|
-
* Boolean flags are omitted when false. Defaults live on `schema.default`.
|
|
81
|
-
*/
|
|
82
|
-
interface JsonSchemaFunctionParameter {
|
|
83
|
-
/**
|
|
84
|
-
* Parameter name. Binding-pattern parameters use synthetic names (`$0`, `$1`, ...).
|
|
85
|
-
* Rest parameter names omit the `...` prefix.
|
|
86
|
-
*/
|
|
87
|
-
name: string;
|
|
88
|
-
/**
|
|
89
|
-
* JSON Schema for the parameter value.
|
|
90
|
-
*/
|
|
91
|
-
schema: JsonSchema;
|
|
92
|
-
/**
|
|
93
|
-
* True when the parameter is declared with `?`.
|
|
94
|
-
*/
|
|
95
|
-
optional?: boolean;
|
|
96
|
-
/**
|
|
97
|
-
* True when the parameter is a rest parameter (`...args`).
|
|
98
|
-
*/
|
|
99
|
-
rest?: boolean;
|
|
100
|
-
/**
|
|
101
|
-
* True when the parameter is a `this` parameter.
|
|
102
|
-
*/
|
|
103
|
-
this?: boolean;
|
|
104
|
-
}
|
|
105
75
|
/**
|
|
106
76
|
* Metadata and annotation keywords shared across JSON Schema shapes.
|
|
107
77
|
*
|
|
@@ -166,43 +136,6 @@ interface JsonSchemaMetadataKeywords {
|
|
|
166
136
|
* @see https://datatracker.ietf.org/doc/html/draft-handrews-json-schema-validation-01#section-8.2.7
|
|
167
137
|
*/
|
|
168
138
|
$dynamicAnchor?: string;
|
|
169
|
-
/**
|
|
170
|
-
* An indicator specifying if the schema is a function or not.
|
|
171
|
-
*
|
|
172
|
-
* @remarks
|
|
173
|
-
* This is an internal property used by Power Plant - it is not part of the JSON Schema specification.
|
|
174
|
-
* When true, `parameters` describes the function arguments in declaration order and `returns`
|
|
175
|
-
* describes the return value (omitted for `void` / `undefined` / `never`).
|
|
176
|
-
*
|
|
177
|
-
* Constructor schemas also emit an own-property `"constructor": true` on the wire (see
|
|
178
|
-
* `JSON_SCHEMA_CONSTRUCTOR_KEY`). That key is intentionally omitted from this interface
|
|
179
|
-
* because a TypeScript `constructor` property collides with `Object.prototype.constructor` and
|
|
180
|
-
* breaks assignability across the schema union. Read it with `hasJsonSchemaConstructorFlag`.
|
|
181
|
-
*/
|
|
182
|
-
function?: boolean;
|
|
183
|
-
/**
|
|
184
|
-
* When true, the function is asynchronous (`async` and/or returns `Promise<T>`).
|
|
185
|
-
*
|
|
186
|
-
* @remarks
|
|
187
|
-
* This is an internal property used by Power Plant - it is not part of the JSON Schema specification.
|
|
188
|
-
* When set, `returns` describes the unwrapped `T` from `Promise<T>` (one layer).
|
|
189
|
-
*/
|
|
190
|
-
async?: boolean;
|
|
191
|
-
/**
|
|
192
|
-
* Ordered function parameters when `function` is true.
|
|
193
|
-
*
|
|
194
|
-
* @remarks
|
|
195
|
-
* Always present for function schemas (may be an empty array). Each entry wraps a parameter
|
|
196
|
-
* schema with metadata such as `name`, `optional`, `rest`, and `this`.
|
|
197
|
-
*/
|
|
198
|
-
parameters?: JsonSchemaFunctionParameter[];
|
|
199
|
-
/**
|
|
200
|
-
* Return-value schema when `function` is true.
|
|
201
|
-
*
|
|
202
|
-
* @remarks
|
|
203
|
-
* Omitted for `void`, `undefined`, and `never` return types.
|
|
204
|
-
*/
|
|
205
|
-
returns?: JsonSchema;
|
|
206
139
|
/**
|
|
207
140
|
* A name for the schema, which can be used by documentation tools or other libraries that support this feature to provide a human-readable name or description for the schema. The presence of this property does not affect the validation behavior of the schema itself, but it can provide additional context or information about the schema when used in conjunction with compatible tools.
|
|
208
141
|
*/
|
|
@@ -1059,13 +992,86 @@ interface JsonSchemaRef extends JsonSchemaKeywords {
|
|
|
1059
992
|
*/
|
|
1060
993
|
$ref: string;
|
|
1061
994
|
}
|
|
995
|
+
interface JsonSchemaFunction extends JsonSchemaKeywords {
|
|
996
|
+
/**
|
|
997
|
+
* Declares whether values are numbers or integers.
|
|
998
|
+
*/
|
|
999
|
+
type: "object";
|
|
1000
|
+
/**
|
|
1001
|
+
* An indicator specifying if the schema is a function or not.
|
|
1002
|
+
*
|
|
1003
|
+
* @remarks
|
|
1004
|
+
* This is an internal property used by Power Plant - it is not part of the JSON Schema specification.
|
|
1005
|
+
* When true, `parameters` describes the function arguments in declaration order and `returns`
|
|
1006
|
+
* describes the return value (omitted for `void` / `undefined` / `never`).
|
|
1007
|
+
*
|
|
1008
|
+
* Constructor schemas also emit an own-property `"constructor": true` on the wire (see
|
|
1009
|
+
* `JSON_SCHEMA_CONSTRUCTOR_KEY`). That key is intentionally omitted from this interface
|
|
1010
|
+
* because a TypeScript `constructor` property collides with `Object.prototype.constructor` and
|
|
1011
|
+
* breaks assignability across the schema union. Read it with `hasJsonSchemaConstructorFlag`.
|
|
1012
|
+
*/
|
|
1013
|
+
function: true;
|
|
1014
|
+
/**
|
|
1015
|
+
* When true, the function is asynchronous (`async` and/or returns `Promise<T>`).
|
|
1016
|
+
*
|
|
1017
|
+
* @remarks
|
|
1018
|
+
* This is an internal property used by Power Plant - it is not part of the JSON Schema specification.
|
|
1019
|
+
* When set, `returns` describes the unwrapped `T` from `Promise<T>` (one layer).
|
|
1020
|
+
*/
|
|
1021
|
+
async?: boolean;
|
|
1022
|
+
/**
|
|
1023
|
+
* Ordered function parameters when `function` is true.
|
|
1024
|
+
*
|
|
1025
|
+
* @remarks
|
|
1026
|
+
* Always present for function schemas (may be an empty array). Each entry wraps a parameter
|
|
1027
|
+
* schema with metadata such as `name`, `optional`, `rest`, and `this`.
|
|
1028
|
+
*/
|
|
1029
|
+
parameters?: JsonSchemaFunctionParameter[];
|
|
1030
|
+
/**
|
|
1031
|
+
* Return-value schema when `function` is true.
|
|
1032
|
+
*
|
|
1033
|
+
* @remarks
|
|
1034
|
+
* Omitted for `void`, `undefined`, and `never` return types.
|
|
1035
|
+
*/
|
|
1036
|
+
returns?: JsonSchema;
|
|
1037
|
+
}
|
|
1038
|
+
/**
|
|
1039
|
+
* A single function parameter entry emitted when `function` is true.
|
|
1040
|
+
*
|
|
1041
|
+
* @remarks
|
|
1042
|
+
* Power Plant extension for function parameter schemas emitted from Deepkit reflection.
|
|
1043
|
+
* Boolean flags are omitted when false. Defaults live on `schema.default`.
|
|
1044
|
+
*/
|
|
1045
|
+
interface JsonSchemaFunctionParameter extends JsonSchemaKeywords {
|
|
1046
|
+
/**
|
|
1047
|
+
* Parameter name. Binding-pattern parameters use synthetic names (`$0`, `$1`, ...).
|
|
1048
|
+
* Rest parameter names omit the `...` prefix.
|
|
1049
|
+
*/
|
|
1050
|
+
name: string;
|
|
1051
|
+
/**
|
|
1052
|
+
* JSON Schema for the parameter value.
|
|
1053
|
+
*/
|
|
1054
|
+
schema: JsonSchema;
|
|
1055
|
+
/**
|
|
1056
|
+
* True when the parameter is declared with `?`.
|
|
1057
|
+
*/
|
|
1058
|
+
optional?: boolean;
|
|
1059
|
+
/**
|
|
1060
|
+
* True when the parameter is a rest parameter (`...args`).
|
|
1061
|
+
*/
|
|
1062
|
+
rest?: boolean;
|
|
1063
|
+
/**
|
|
1064
|
+
* True when the parameter is a `this` parameter.
|
|
1065
|
+
*/
|
|
1066
|
+
this?: boolean;
|
|
1067
|
+
}
|
|
1062
1068
|
/**
|
|
1063
1069
|
* JSON Schema (draft 2020-12) type that can be used to validate JSON data. It is a union of all the specific JSON Schema types, as well as the metadata properties that can be included in any JSON Schema.
|
|
1064
1070
|
*
|
|
1065
1071
|
* @see https://json-schema.org/draft/2020-12
|
|
1066
1072
|
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01
|
|
1067
1073
|
*/
|
|
1068
|
-
type JsonSchema = JsonSchemaString | JsonSchemaInteger | JsonSchemaDecimal | JsonSchemaBigint | JsonSchemaBoolean | JsonSchemaDate | JsonSchemaEnum | JsonSchemaLiteral | JsonSchemaNativeEnum | JsonSchemaNull | JsonSchemaArray | JsonSchemaObject | JsonSchemaRecord | JsonSchemaTuple | JsonSchemaUnion | JsonSchemaUndefined | JsonSchemaRef | JsonSchemaNever | JsonSchemaMap | JsonSchemaAny | JsonSchemaNullable | JsonSchemaAllOf | JsonSchemaUnknown | JsonSchemaSet;
|
|
1074
|
+
type JsonSchema = JsonSchemaString | JsonSchemaInteger | JsonSchemaDecimal | JsonSchemaBigint | JsonSchemaBoolean | JsonSchemaDate | JsonSchemaEnum | JsonSchemaLiteral | JsonSchemaNativeEnum | JsonSchemaNull | JsonSchemaArray | JsonSchemaObject | JsonSchemaRecord | JsonSchemaTuple | JsonSchemaUnion | JsonSchemaUndefined | JsonSchemaRef | JsonSchemaNever | JsonSchemaMap | JsonSchemaAny | JsonSchemaNullable | JsonSchemaAllOf | JsonSchemaUnknown | JsonSchemaSet | JsonSchemaFunction;
|
|
1069
1075
|
/**
|
|
1070
1076
|
* An object containing common JSON Schema metadata properties that can be included in any schema type. This interface is used to define the shared metadata properties that can be present in all JSON Schema types, such as `$id`, `$schema`, `title`, `description`, and others. It serves as a base for all specific JSON Schema types, allowing them to include these common metadata properties without having to redefine them in each type.
|
|
1071
1077
|
*/
|
|
@@ -1233,7 +1239,7 @@ type SpecOf<TJsonSchema extends JsonSchema> = TJsonSchema extends JsonSchemaNeve
|
|
|
1233
1239
|
/**
|
|
1234
1240
|
* Supported source variants from which a schema can be extracted.
|
|
1235
1241
|
*/
|
|
1236
|
-
type SchemaSourceVariant = "standard-schema" | "json-schema" | "zod3" | "untyped" | "valibot";
|
|
1242
|
+
type SchemaSourceVariant = "standard-schema" | "json-schema" | "zod3" | "untyped" | "valibot" | "reflection";
|
|
1237
1243
|
/**
|
|
1238
1244
|
* Accepted schema input variants, including raw type definitions.
|
|
1239
1245
|
*/
|
|
@@ -1257,7 +1263,7 @@ type ValibotSchema<TInput = unknown, TOutput = unknown, TIssue extends BaseIssue
|
|
|
1257
1263
|
/**
|
|
1258
1264
|
* Raw schema source input union before normalization.
|
|
1259
1265
|
*/
|
|
1260
|
-
type SchemaSourceConfig<TSpec = any> = StandardJSONSchemaV1<TSpec> | JsonSchemaOf<TSpec> | z3.ZodType<TSpec, any, any> | UntypedConfigObject | UntypedSchema | ValibotSchema<TSpec>;
|
|
1266
|
+
type SchemaSourceConfig<TSpec = any> = StandardJSONSchemaV1<TSpec> | JsonSchemaOf<TSpec> | z3.ZodType<TSpec, any, any> | UntypedConfigObject | UntypedSchema | ValibotSchema<TSpec> | Type | ReceiveType<TSpec>;
|
|
1261
1267
|
/**
|
|
1262
1268
|
* Any accepted schema input, including normalized schemas and references.
|
|
1263
1269
|
*
|
|
@@ -1295,11 +1301,23 @@ type BaseExtractOptions = {
|
|
|
1295
1301
|
* An optional working directory to use for resolving file references. If provided, the working directory will be used to resolve file references, which can improve performance by avoiding redundant file resolution operations. If not provided, the current working directory will be used.
|
|
1296
1302
|
*/
|
|
1297
1303
|
cwd?: string;
|
|
1304
|
+
/**
|
|
1305
|
+
* An optional path to a `tsconfig.json` used when reflecting TypeScript types.
|
|
1306
|
+
*/
|
|
1307
|
+
tsconfig?: string;
|
|
1298
1308
|
/**
|
|
1299
1309
|
* An optional logger to use for logging messages. If provided, the logger will be used to log messages, which can improve performance by avoiding redundant logging operations. If not provided, the default logger will be used.
|
|
1300
1310
|
*/
|
|
1301
1311
|
logger?: Logger;
|
|
1302
|
-
|
|
1312
|
+
/**
|
|
1313
|
+
* An optional mode for the reflection.
|
|
1314
|
+
*/
|
|
1315
|
+
reflection?: string[] | "default" | "explicit" | "never" | undefined;
|
|
1316
|
+
/**
|
|
1317
|
+
* An optional list of paths to exclude from the reflection.
|
|
1318
|
+
*/
|
|
1319
|
+
exclude?: string[];
|
|
1320
|
+
};
|
|
1303
1321
|
type InferExtractOptions<T extends SchemaConfig> = (T extends LoadReference ? Omit<InferLoadOptions<T>, "fs"> : {}) & BaseExtractOptions;
|
|
1304
1322
|
/**
|
|
1305
1323
|
* A schema envelope that contains the normalized schema and its source variant.
|
|
@@ -1382,10 +1400,19 @@ interface ValibotSchemaSource<TSpec = any> extends BaseSchemaSource<TSpec> {
|
|
|
1382
1400
|
/** The original Valibot schema input. */
|
|
1383
1401
|
schema: ValibotSchema<TSpec>;
|
|
1384
1402
|
}
|
|
1403
|
+
/**
|
|
1404
|
+
* Source descriptor for Deepkit reflection type inputs.
|
|
1405
|
+
*/
|
|
1406
|
+
interface ReflectionSchemaSource<TSpec = any> extends BaseSchemaSource<TSpec> {
|
|
1407
|
+
/** Indicates the source input is a Deepkit reflection {@link Type}. */
|
|
1408
|
+
variant: "reflection";
|
|
1409
|
+
/** The original Deepkit reflection type. */
|
|
1410
|
+
schema: Type;
|
|
1411
|
+
}
|
|
1385
1412
|
/**
|
|
1386
1413
|
* Union of all normalized schema source descriptor variants.
|
|
1387
1414
|
*/
|
|
1388
|
-
type SchemaSource<TSpec = any> = JsonSchemaSchemaSource<TSpec> | StandardSchemaSchemaSource<TSpec> | Zod3SchemaSource<TSpec> | UntypedSchemaSource<TSpec> | ValibotSchemaSource<TSpec>;
|
|
1415
|
+
type SchemaSource<TSpec = any> = JsonSchemaSchemaSource<TSpec> | StandardSchemaSchemaSource<TSpec> | Zod3SchemaSource<TSpec> | UntypedSchemaSource<TSpec> | ValibotSchemaSource<TSpec> | ReflectionSchemaSource<TSpec>;
|
|
1389
1416
|
/**
|
|
1390
1417
|
* A normalized schema plus metadata about the source that produced it.
|
|
1391
1418
|
*/
|
|
@@ -1422,5 +1449,5 @@ declare module "zod" {
|
|
|
1422
1449
|
}
|
|
1423
1450
|
}
|
|
1424
1451
|
//#endregion
|
|
1425
|
-
export {
|
|
1426
|
-
//# sourceMappingURL=types-
|
|
1452
|
+
export { SchemaEnvelopeOf as $, JsonSchemaNullable as A, JsonSchemaSchemaSource as B, JsonSchemaLiteral as C, JsonSchemaNativeEnum as D, JsonSchemaMetadataKeywords as E, JsonSchemaPrimitiveType as F, JsonSchemaType as G, JsonSchemaString as H, JsonSchemaPrimitiveUnion as I, JsonSchemaUnknown as J, JsonSchemaUndefined as K, JsonSchemaRecord as L, JsonSchemaNumberFormat as M, JsonSchemaObject as N, JsonSchemaNever as O, JsonSchemaOf as P, SchemaEnvelope as Q, JsonSchemaRecordPropertyNames as R, JsonSchemaLike as S, JsonSchemaMap as T, JsonSchemaStringFormat as U, JsonSchemaSet as V, JsonSchemaTuple as W, SchemaConfig as X, ReflectionSchemaSource as Y, SchemaConfigVariant as Z, JsonSchemaFunction as _, SCHEMA_RECORD_KEYWORDS as _t, JsonSchema as a, UntypedConfigObject as at, JsonSchemaIntegerFormat as b, JsonSchemaAnyOf as c, ValibotSchema as ct, JsonSchemaBoolean as d, JSON_SCHEMA_CONSTRUCTOR_KEY as dt, SchemaSource as et, JsonSchemaConditionalKeywords as f, JSON_SCHEMA_METADATA_KEYS as ft, JsonSchemaEnum as g, SCHEMA_ARRAY_CONCAT_KEYWORDS as gt, JsonSchemaDecimalFormat as h, JsonSchemaTypeNames as ht, InferExtractOptions as i, StandardSchemaSchemaSource as it, JsonSchemaNumber as j, JsonSchemaNull as k, JsonSchemaArray as l, ValibotSchemaSource as lt, JsonSchemaDecimal as m, JSON_SCHEMA_TYPES as mt, BaseSchemaSource as n, SchemaSourceVariant as nt, JsonSchemaAllOf as o, UntypedSchema as ot, JsonSchemaDate as p, JSON_SCHEMA_PRIMITIVE_TYPES as pt, JsonSchemaUnion as q, ExtractedSchemaEnvelope as r, SpecOf as rt, JsonSchemaAny as s, UntypedSchemaSource as st, BaseExtractOptions as t, SchemaSourceConfig as tt, JsonSchemaBigint as u, Zod3SchemaSource as ut, JsonSchemaFunctionParameter as v, SCHEMA_SINGLE_KEYWORDS as vt, JsonSchemaLogicKeywords as w, JsonSchemaKeywords as x, JsonSchemaInteger as y, JsonSchemaRef as z };
|
|
1453
|
+
//# sourceMappingURL=types-BrSNvUQg.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types-BrSNvUQg.d.mts","names":[],"sources":["../src/constants.ts","../src/types.ts"],"mappings":""}
|
package/dist/valibot.d.cts
CHANGED
package/dist/valibot.d.mts
CHANGED
package/dist/zod.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
2
|
const require_rolldown_runtime = require('./rolldown-runtime-C_NdSu1c.cjs');
|
|
3
3
|
const require_constants = require('./constants-CEmLvTDd.cjs');
|
|
4
|
-
const require_helpers = require('./helpers-
|
|
4
|
+
const require_helpers = require('./helpers-DbFdMcOB.cjs');
|
|
5
5
|
let _stryke_helpers_deep_clone = require("@stryke/helpers/deep-clone");
|
|
6
6
|
let zod_mini = require("zod/mini");
|
|
7
7
|
zod_mini = require_rolldown_runtime.__toESM(zod_mini, 1);
|
package/dist/zod.d.cts
CHANGED
package/dist/zod.d.mts
CHANGED
package/dist/zod.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { i as JSON_SCHEMA_TYPES } from "./constants-BlppSDwG.mjs";
|
|
2
|
-
import { n as getJsonSchema, p as traverseSchema, v as isJsonSchemaAny } from "./helpers-
|
|
2
|
+
import { n as getJsonSchema, p as traverseSchema, v as isJsonSchemaAny } from "./helpers-_8ADIMSN.mjs";
|
|
3
3
|
import { deepClone } from "@stryke/helpers/deep-clone";
|
|
4
4
|
import * as z from "zod/mini";
|
|
5
5
|
import * as z4 from "zod/v4";
|