@power-plant/schema 0.0.36 → 0.0.37
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/{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 +22 -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
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { $ as
|
|
1
|
+
import { $ as SchemaEnvelopeOf, A as JsonSchemaNullable, B as JsonSchemaSchemaSource, C as JsonSchemaLiteral, D as JsonSchemaNativeEnum, E as JsonSchemaMetadataKeywords, F as JsonSchemaPrimitiveType, G as JsonSchemaType, H as JsonSchemaString, I as JsonSchemaPrimitiveUnion, J as JsonSchemaUnknown, K as JsonSchemaUndefined, L as JsonSchemaRecord, M as JsonSchemaNumberFormat, N as JsonSchemaObject, O as JsonSchemaNever, P as JsonSchemaOf, Q as SchemaEnvelope, R as JsonSchemaRecordPropertyNames, S as JsonSchemaLike, T as JsonSchemaMap, U as JsonSchemaStringFormat, V as JsonSchemaSet, W as JsonSchemaTuple, X as SchemaConfig, Y as ReflectionSchemaSource, Z as SchemaConfigVariant, _ as JsonSchemaFunction, _t as SCHEMA_RECORD_KEYWORDS, a as JsonSchema, at as UntypedConfigObject, b as JsonSchemaIntegerFormat, c as JsonSchemaAnyOf, ct as ValibotSchema, d as JsonSchemaBoolean, dt as JSON_SCHEMA_CONSTRUCTOR_KEY, et as SchemaSource, f as JsonSchemaConditionalKeywords, ft as JSON_SCHEMA_METADATA_KEYS, g as JsonSchemaEnum, gt as SCHEMA_ARRAY_CONCAT_KEYWORDS, h as JsonSchemaDecimalFormat, ht as JsonSchemaTypeNames, i as InferExtractOptions, it as StandardSchemaSchemaSource, j as JsonSchemaNumber, k as JsonSchemaNull, l as JsonSchemaArray, lt as ValibotSchemaSource, m as JsonSchemaDecimal, mt as JSON_SCHEMA_TYPES, n as BaseSchemaSource, nt as SchemaSourceVariant, o as JsonSchemaAllOf, ot as UntypedSchema, p as JsonSchemaDate, pt as JSON_SCHEMA_PRIMITIVE_TYPES, q as JsonSchemaUnion, r as ExtractedSchemaEnvelope, rt as SpecOf, s as JsonSchemaAny, st as UntypedSchemaSource, t as BaseExtractOptions, tt as SchemaSourceConfig, u as JsonSchemaBigint, ut as Zod3SchemaSource, v as JsonSchemaFunctionParameter, vt as SCHEMA_SINGLE_KEYWORDS, w as JsonSchemaLogicKeywords, x as JsonSchemaKeywords, y as JsonSchemaInteger, z as JsonSchemaRef } from "./types-BH-Q7QrB.cjs";
|
|
2
2
|
import { n as createStoragePromises, r as normalizeKey, t as mapStorageToFileSystem } from "./index-ldf5lukz.cjs";
|
|
3
|
+
import { Type } from "@deepkit/type";
|
|
3
4
|
import { StandardSchemaV1 } from "@standard-schema/spec";
|
|
4
5
|
import { InferLoadOptions } from "@stryke/resolve/types";
|
|
5
6
|
import { InputObject, Schema } from "untyped";
|
|
@@ -43,6 +44,10 @@ declare function bundleReferences(schema: JsonSchema): JsonSchema;
|
|
|
43
44
|
* Creates a hash string for a given schema definition input.
|
|
44
45
|
*/
|
|
45
46
|
declare function extractHash(variant: SchemaConfigVariant, input: SchemaConfig): string;
|
|
47
|
+
/**
|
|
48
|
+
* Converts a reflected Deepkit {@link Type} into a JSON Schema (draft-2020-12) representation.
|
|
49
|
+
*/
|
|
50
|
+
declare function extractReflection(reflection: Type): JsonSchema | undefined;
|
|
46
51
|
/**
|
|
47
52
|
* Extracts a JSON Schema from Zod, Standard Schema, Valibot, untyped, or JSON Schema inputs.
|
|
48
53
|
*
|
|
@@ -84,19 +89,18 @@ declare function extractSchema(input: SchemaSourceConfig, variant?: SchemaConfig
|
|
|
84
89
|
*/
|
|
85
90
|
declare function extractSource(variant: SchemaSourceVariant, input: SchemaSourceConfig): SchemaSource;
|
|
86
91
|
/**
|
|
87
|
-
* Resolves a type definition to a JSON Schema.
|
|
88
|
-
*
|
|
89
|
-
*
|
|
90
|
-
* [ts-json-schema-generator](https://github.com/vega/ts-json-schema-generator)
|
|
91
|
-
* using the referenced export name as the target type when one is provided.
|
|
92
|
+
* Resolves a type definition to a JSON Schema. Bundles the TypeScript module
|
|
93
|
+
* graph with esbuild using `@deepkit/type-compiler` reflection transformers,
|
|
94
|
+
* then converts the reflected Deepkit {@link Type} via {@link reflectionToJsonSchema}.
|
|
92
95
|
*
|
|
93
96
|
* @param input - The type definition to compile. This can be either a string or a {@link FileReference} object.
|
|
94
|
-
* @param options - Optional overrides
|
|
97
|
+
* @param options - Optional overrides for reflection and file resolution.
|
|
95
98
|
* @returns A promise that resolves to the generated JSON Schema.
|
|
99
|
+
* @see https://deepkit.io/en/documentation/runtime-types/reflection
|
|
96
100
|
*/
|
|
97
101
|
declare function extractTSType(input: FileReferenceInput, options?: InferLoadOptions<typeof input> & BaseExtractOptions): Promise<JsonSchema>;
|
|
98
102
|
/**
|
|
99
|
-
* Extracts a JSON Schema from a given schema definition input, which can be a Zod schema, a Valibot schema, any Standard JSON Schema type, a plain JSON Schema object, an untyped schema, or a {@link FileReferenceInput} to an exported TypeScript type definition or any of the previous options. If the input is a {@link FileReferenceInput} (e.g. a file path with an export), the source code will be bundled with [esbuild](esbuild.github.io) using [
|
|
103
|
+
* Extracts a JSON Schema from a given schema definition input, which can be a Zod schema, a Valibot schema, any Standard JSON Schema type, a plain JSON Schema object, an untyped schema, a Deepkit Type object, or a {@link FileReferenceInput} to an exported TypeScript type definition or any of the previous options. If the input is a {@link FileReferenceInput} (e.g. a file path with an export), the source code will be bundled with [esbuild](https://esbuild.github.io) using [@deepkit/type-compiler](https://deepkit.io/en/documentation/runtime-types/getting-started) reflection to obtain the actual schema definition before extraction.
|
|
100
104
|
*
|
|
101
105
|
* @example
|
|
102
106
|
* ```ts
|
|
@@ -110,8 +114,8 @@ declare function extractTSType(input: FileReferenceInput, options?: InferLoadOpt
|
|
|
110
114
|
* const schema4 = await extract(context, zodSchema);
|
|
111
115
|
* // Resolve a schema definition from a Valibot schema
|
|
112
116
|
* const schema5 = await extract(context, valibotSchema);
|
|
113
|
-
* // Resolve a schema definition from
|
|
114
|
-
* const schema6 = await extract(context,
|
|
117
|
+
* // Resolve a schema definition from a reflected Deepkit Type object
|
|
118
|
+
* const schema6 = await extract(context, reflectionType);
|
|
115
119
|
* ```
|
|
116
120
|
*
|
|
117
121
|
* @see https://zod.dev/
|
|
@@ -119,7 +123,7 @@ declare function extractTSType(input: FileReferenceInput, options?: InferLoadOpt
|
|
|
119
123
|
* @see https://standardschema.dev/json-schema#what-schema-libraries-support-this-spec
|
|
120
124
|
* @see https://json-schema.org/
|
|
121
125
|
* @see https://ajv.js.org/json-type-definition.html
|
|
122
|
-
* @see https://
|
|
126
|
+
* @see https://deepkit.io/en/documentation/runtime-types/reflection
|
|
123
127
|
* @see https://github.com/unjs/untyped
|
|
124
128
|
* @see https://www.typescriptlang.org/docs/handbook/2/types-from-types.html
|
|
125
129
|
*
|
|
@@ -130,7 +134,7 @@ declare function extractTSType(input: FileReferenceInput, options?: InferLoadOpt
|
|
|
130
134
|
*/
|
|
131
135
|
declare function extractSchemaWithSource<TSpec = any>(input: SchemaConfig, options?: InferExtractOptions<typeof input>): Promise<ExtractedSchemaEnvelope<TSpec>>;
|
|
132
136
|
/**
|
|
133
|
-
* Extracts a JSON Schema from a given schema definition input, which can be a Zod schema, a Valibot schema, any Standard JSON Schema type, a plain JSON Schema object, an untyped schema, or a {@link FileReferenceInput} to an exported TypeScript type definition or any of the previous options. If the input is a {@link FileReferenceInput} (e.g. a file path with an export), the source code will be bundled with [esbuild](esbuild.github.io) using [
|
|
137
|
+
* Extracts a JSON Schema from a given schema definition input, which can be a Zod schema, a Valibot schema, any Standard JSON Schema type, a plain JSON Schema object, an untyped schema, a Deepkit Type object, or a {@link FileReferenceInput} to an exported TypeScript type definition or any of the previous options. If the input is a {@link FileReferenceInput} (e.g. a file path with an export), the source code will be bundled with [esbuild](https://esbuild.github.io) using [@deepkit/type-compiler](https://deepkit.io/en/documentation/runtime-types/getting-started) reflection to obtain the actual schema definition before extraction.
|
|
134
138
|
*
|
|
135
139
|
* @example
|
|
136
140
|
* ```ts
|
|
@@ -144,8 +148,8 @@ declare function extractSchemaWithSource<TSpec = any>(input: SchemaConfig, optio
|
|
|
144
148
|
* const schema4 = await extract(context, zodSchema);
|
|
145
149
|
* // Resolve a schema definition from a Valibot schema
|
|
146
150
|
* const schema5 = await extract(context, valibotSchema);
|
|
147
|
-
* // Resolve a schema definition from
|
|
148
|
-
* const schema6 = await extract(context,
|
|
151
|
+
* // Resolve a schema definition from a reflected Deepkit Type object
|
|
152
|
+
* const schema6 = await extract(context, reflectionType);
|
|
149
153
|
* ```
|
|
150
154
|
*
|
|
151
155
|
* @see https://zod.dev/
|
|
@@ -153,7 +157,7 @@ declare function extractSchemaWithSource<TSpec = any>(input: SchemaConfig, optio
|
|
|
153
157
|
* @see https://standardschema.dev/json-schema#what-schema-libraries-support-this-spec
|
|
154
158
|
* @see https://json-schema.org/
|
|
155
159
|
* @see https://ajv.js.org/json-type-definition.html
|
|
156
|
-
* @see https://
|
|
160
|
+
* @see https://deepkit.io/en/documentation/runtime-types/reflection
|
|
157
161
|
* @see https://github.com/unjs/untyped
|
|
158
162
|
* @see https://www.typescriptlang.org/docs/handbook/2/types-from-types.html
|
|
159
163
|
*
|
|
@@ -672,5 +676,5 @@ declare function isSchemaWithSource(input: unknown): input is ExtractedSchemaEnv
|
|
|
672
676
|
*/
|
|
673
677
|
declare function isSchemaObject(input: unknown): input is SchemaEnvelope<JsonSchemaObject>;
|
|
674
678
|
//#endregion
|
|
675
|
-
export { type BaseExtractOptions, type BaseSchemaSource, type ExtractedSchemaEnvelope, GetPropertyResult, type InferExtractOptions, JSON_SCHEMA_CONSTRUCTOR_KEY, JSON_SCHEMA_METADATA_KEYS, JSON_SCHEMA_PRIMITIVE_TYPES, JSON_SCHEMA_TYPES, type JsonSchema, type JsonSchemaAllOf, type JsonSchemaAny, type JsonSchemaAnyOf, type JsonSchemaArray, type JsonSchemaBigint, type JsonSchemaBoolean, type JsonSchemaConditionalKeywords, type JsonSchemaDate, type JsonSchemaDecimal, type JsonSchemaDecimalFormat, type JsonSchemaEnum, type JsonSchemaFunctionParameter, type JsonSchemaInteger, type JsonSchemaIntegerFormat, type JsonSchemaKeywords, type JsonSchemaLike, type JsonSchemaLiteral, type JsonSchemaLogicKeywords, type JsonSchemaMap, type JsonSchemaMetadataKeywords, type JsonSchemaNativeEnum, type JsonSchemaNever, type JsonSchemaNull, type JsonSchemaNullable, type JsonSchemaNumber, type JsonSchemaNumberFormat, type JsonSchemaObject, type JsonSchemaOf, type JsonSchemaPrimitiveType, type JsonSchemaPrimitiveUnion, type JsonSchemaRecord, type JsonSchemaRecordPropertyNames, type JsonSchemaRef, type JsonSchemaSchemaSource, type JsonSchemaSet, type JsonSchemaString, type JsonSchemaStringFormat, type JsonSchemaTuple, type JsonSchemaType, JsonSchemaTypeNames, type JsonSchemaUndefined, type JsonSchemaUnion, type JsonSchemaUnknown, SCHEMA_ARRAY_CONCAT_KEYWORDS, SCHEMA_RECORD_KEYWORDS, SCHEMA_SINGLE_KEYWORDS, type SchemaConfig, type SchemaConfigVariant, type SchemaEnvelope, type SchemaEnvelopeOf, type SchemaSource, type SchemaSourceConfig, type SchemaSourceVariant, type SpecOf, type StandardSchemaSchemaSource, type UntypedConfigObject, type UntypedSchema, type UntypedSchemaSource, type ValibotSchema, type ValibotSchemaSource, type Zod3SchemaSource, addProperty, applyJsonSchemaMetadata, assertSchemasDoNotContradict, bundleReferences, createStoragePromises, extract, extractHash, extractJsonSchema, extractResolvedVariant, extractSchema, extractSchemaWithSource, extractSource, extractTSType, extractVariant, findSchemaContradictions, getJsonSchema, getJsonSchemaObject, getPrimarySchemaType, getProperties, getPropertiesList, getProperty, hasJsonSchemaConstructorFlag, isFileReference, isJsonSchema, isJsonSchemaAllOf, isJsonSchemaAny, isJsonSchemaAnyOf, isJsonSchemaArray, isJsonSchemaBigint, isJsonSchemaBoolean, isJsonSchemaDate, isJsonSchemaDecimal, isJsonSchemaEnum, isJsonSchemaInteger, isJsonSchemaKeywords, isJsonSchemaLiteral, isJsonSchemaMap, isJsonSchemaNativeEnum, isJsonSchemaNever, isJsonSchemaNull, isJsonSchemaNullable, isJsonSchemaNumber, isJsonSchemaObject, isJsonSchemaPrimitiveType, isJsonSchemaPrimitiveUnion, isJsonSchemaRecord, isJsonSchemaRef, isJsonSchemaSet, isJsonSchemaString, isJsonSchemaTuple, isJsonSchemaType, isJsonSchemaUndefined, isJsonSchemaUnion, isJsonSchemaUnknown, isNullOnlyJsonSchema, isPropertyOptional, isSchema, isSchemaNullable, isSchemaObject, isSchemaOf, isSchemaWithSource, isStandardSchema, isUntypedConfig, isUntypedConfigStrict, isUntypedInput, isUntypedInputStrict, isUntypedSchema, isUntypedSchemaStrict, isValibotSchema, isValidSchemaConfigFile, isValidSchemaInputFile, mapStorageToFileSystem, merge, mergeMetadata, normalizeKey, readSchemaTypes, traverseSchema };
|
|
679
|
+
export { type BaseExtractOptions, type BaseSchemaSource, type ExtractedSchemaEnvelope, GetPropertyResult, type InferExtractOptions, JSON_SCHEMA_CONSTRUCTOR_KEY, JSON_SCHEMA_METADATA_KEYS, JSON_SCHEMA_PRIMITIVE_TYPES, JSON_SCHEMA_TYPES, type JsonSchema, type JsonSchemaAllOf, type JsonSchemaAny, type JsonSchemaAnyOf, type JsonSchemaArray, type JsonSchemaBigint, type JsonSchemaBoolean, type JsonSchemaConditionalKeywords, type JsonSchemaDate, type JsonSchemaDecimal, type JsonSchemaDecimalFormat, type JsonSchemaEnum, type JsonSchemaFunction, type JsonSchemaFunctionParameter, type JsonSchemaInteger, type JsonSchemaIntegerFormat, type JsonSchemaKeywords, type JsonSchemaLike, type JsonSchemaLiteral, type JsonSchemaLogicKeywords, type JsonSchemaMap, type JsonSchemaMetadataKeywords, type JsonSchemaNativeEnum, type JsonSchemaNever, type JsonSchemaNull, type JsonSchemaNullable, type JsonSchemaNumber, type JsonSchemaNumberFormat, type JsonSchemaObject, type JsonSchemaOf, type JsonSchemaPrimitiveType, type JsonSchemaPrimitiveUnion, type JsonSchemaRecord, type JsonSchemaRecordPropertyNames, type JsonSchemaRef, type JsonSchemaSchemaSource, type JsonSchemaSet, type JsonSchemaString, type JsonSchemaStringFormat, type JsonSchemaTuple, type JsonSchemaType, JsonSchemaTypeNames, type JsonSchemaUndefined, type JsonSchemaUnion, type JsonSchemaUnknown, type ReflectionSchemaSource, SCHEMA_ARRAY_CONCAT_KEYWORDS, SCHEMA_RECORD_KEYWORDS, SCHEMA_SINGLE_KEYWORDS, type SchemaConfig, type SchemaConfigVariant, type SchemaEnvelope, type SchemaEnvelopeOf, type SchemaSource, type SchemaSourceConfig, type SchemaSourceVariant, type SpecOf, type StandardSchemaSchemaSource, type UntypedConfigObject, type UntypedSchema, type UntypedSchemaSource, type ValibotSchema, type ValibotSchemaSource, type Zod3SchemaSource, addProperty, applyJsonSchemaMetadata, assertSchemasDoNotContradict, bundleReferences, createStoragePromises, extract, extractHash, extractJsonSchema, extractReflection, extractResolvedVariant, extractSchema, extractSchemaWithSource, extractSource, extractTSType, extractVariant, findSchemaContradictions, getJsonSchema, getJsonSchemaObject, getPrimarySchemaType, getProperties, getPropertiesList, getProperty, hasJsonSchemaConstructorFlag, isFileReference, isJsonSchema, isJsonSchemaAllOf, isJsonSchemaAny, isJsonSchemaAnyOf, isJsonSchemaArray, isJsonSchemaBigint, isJsonSchemaBoolean, isJsonSchemaDate, isJsonSchemaDecimal, isJsonSchemaEnum, isJsonSchemaInteger, isJsonSchemaKeywords, isJsonSchemaLiteral, isJsonSchemaMap, isJsonSchemaNativeEnum, isJsonSchemaNever, isJsonSchemaNull, isJsonSchemaNullable, isJsonSchemaNumber, isJsonSchemaObject, isJsonSchemaPrimitiveType, isJsonSchemaPrimitiveUnion, isJsonSchemaRecord, isJsonSchemaRef, isJsonSchemaSet, isJsonSchemaString, isJsonSchemaTuple, isJsonSchemaType, isJsonSchemaUndefined, isJsonSchemaUnion, isJsonSchemaUnknown, isNullOnlyJsonSchema, isPropertyOptional, isSchema, isSchemaNullable, isSchemaObject, isSchemaOf, isSchemaWithSource, isStandardSchema, isUntypedConfig, isUntypedConfigStrict, isUntypedInput, isUntypedInputStrict, isUntypedSchema, isUntypedSchemaStrict, isValibotSchema, isValidSchemaConfigFile, isValidSchemaInputFile, mapStorageToFileSystem, merge, mergeMetadata, normalizeKey, readSchemaTypes, traverseSchema };
|
|
676
680
|
//# sourceMappingURL=index.d.cts.map
|
package/dist/index.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/compatibility.ts","../src/extract.ts","../src/helpers.ts","../src/metadata.ts","../src/type-checks.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/compatibility.ts","../src/extract.ts","../src/help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B,SAAS;;;;;;;iBAyB7C,kBAAkB,iBAAiB,SAAS;;;;;;;iBA8B5C,sBACd,iBACC,SAAS;;;;;;;iBAoBI,2BACd,iBACC,SAAS;;;;;;;iBAsEI,kBAAkB,iBAAiB,SAAS;;;;;;;iBAmB5C,oBACd,iBACC,SAAS;;;;;;;iBAUI,kBAAkB,iBAAiB,SAAS;;;;;;;iBAkB5C,gBAAgB,iBAAiB,SAAS;;;;;;;iBAgB1C,iBAAiB,iBAAiB,SAAS;;;;;;;iBAqB3C,gBACd,iBACC,SAAS;;;;;;;;;;;iBA2BI,6BAA6B;;;;;;;;;;iBAoB7B,aAAa,iBAAiB,SAAS;;;;;;;;;;iBAsCvC,qBAAqB,iBAAiB,SAAS;;;;;;;;;;iBAa/C,gBAAgB,iBAAiB,SAAS;;;;;;;;;;;iBAyD1C,sBAAsB,iBAAiB,SAAS;;;;;;;;;;;cAmBnD,uBAAc;iBAEX,gBAAgB,iBAAiB,SAAS;;;;;;;;;;;;cA2B7C,6BAAoB;iBAEjB,sBACd,iBACC,SAAS;;;;;;;iBAuBI,SAAS,iBAAiB,SAAS;;;;;;;iBAkBnC,WAAW,OACzB,iBACC,SAAS,iBAAiB;;;;;;;iBAUb,mBAAmB,iBAAiB,SAAS;;;;;;;iBAiB7C,eACd,iBACC,SAAS,eAAe"}
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { $ as
|
|
1
|
+
import { $ as SchemaEnvelopeOf, A as JsonSchemaNullable, B as JsonSchemaSchemaSource, C as JsonSchemaLiteral, D as JsonSchemaNativeEnum, E as JsonSchemaMetadataKeywords, F as JsonSchemaPrimitiveType, G as JsonSchemaType, H as JsonSchemaString, I as JsonSchemaPrimitiveUnion, J as JsonSchemaUnknown, K as JsonSchemaUndefined, L as JsonSchemaRecord, M as JsonSchemaNumberFormat, N as JsonSchemaObject, O as JsonSchemaNever, P as JsonSchemaOf, Q as SchemaEnvelope, R as JsonSchemaRecordPropertyNames, S as JsonSchemaLike, T as JsonSchemaMap, U as JsonSchemaStringFormat, V as JsonSchemaSet, W as JsonSchemaTuple, X as SchemaConfig, Y as ReflectionSchemaSource, Z as SchemaConfigVariant, _ as JsonSchemaFunction, _t as SCHEMA_RECORD_KEYWORDS, a as JsonSchema, at as UntypedConfigObject, b as JsonSchemaIntegerFormat, c as JsonSchemaAnyOf, ct as ValibotSchema, d as JsonSchemaBoolean, dt as JSON_SCHEMA_CONSTRUCTOR_KEY, et as SchemaSource, f as JsonSchemaConditionalKeywords, ft as JSON_SCHEMA_METADATA_KEYS, g as JsonSchemaEnum, gt as SCHEMA_ARRAY_CONCAT_KEYWORDS, h as JsonSchemaDecimalFormat, ht as JsonSchemaTypeNames, i as InferExtractOptions, it as StandardSchemaSchemaSource, j as JsonSchemaNumber, k as JsonSchemaNull, l as JsonSchemaArray, lt as ValibotSchemaSource, m as JsonSchemaDecimal, mt as JSON_SCHEMA_TYPES, n as BaseSchemaSource, nt as SchemaSourceVariant, o as JsonSchemaAllOf, ot as UntypedSchema, p as JsonSchemaDate, pt as JSON_SCHEMA_PRIMITIVE_TYPES, q as JsonSchemaUnion, r as ExtractedSchemaEnvelope, rt as SpecOf, s as JsonSchemaAny, st as UntypedSchemaSource, t as BaseExtractOptions, tt as SchemaSourceConfig, u as JsonSchemaBigint, ut as Zod3SchemaSource, v as JsonSchemaFunctionParameter, vt as SCHEMA_SINGLE_KEYWORDS, w as JsonSchemaLogicKeywords, x as JsonSchemaKeywords, y as JsonSchemaInteger, z as JsonSchemaRef } from "./types-BrSNvUQg.mjs";
|
|
2
2
|
import { n as createStoragePromises, r as normalizeKey, t as mapStorageToFileSystem } from "./index-C7q4X7Bo.mjs";
|
|
3
|
+
import { Type } from "@deepkit/type";
|
|
3
4
|
import { BaseSchema } from "valibot";
|
|
4
5
|
import { StandardSchemaV1 } from "@standard-schema/spec";
|
|
5
6
|
import { InferLoadOptions } from "@stryke/resolve/types";
|
|
@@ -43,6 +44,10 @@ declare function bundleReferences(schema: JsonSchema): JsonSchema;
|
|
|
43
44
|
* Creates a hash string for a given schema definition input.
|
|
44
45
|
*/
|
|
45
46
|
declare function extractHash(variant: SchemaConfigVariant, input: SchemaConfig): string;
|
|
47
|
+
/**
|
|
48
|
+
* Converts a reflected Deepkit {@link Type} into a JSON Schema (draft-2020-12) representation.
|
|
49
|
+
*/
|
|
50
|
+
declare function extractReflection(reflection: Type): JsonSchema | undefined;
|
|
46
51
|
/**
|
|
47
52
|
* Extracts a JSON Schema from Zod, Standard Schema, Valibot, untyped, or JSON Schema inputs.
|
|
48
53
|
*
|
|
@@ -84,19 +89,18 @@ declare function extractSchema(input: SchemaSourceConfig, variant?: SchemaConfig
|
|
|
84
89
|
*/
|
|
85
90
|
declare function extractSource(variant: SchemaSourceVariant, input: SchemaSourceConfig): SchemaSource;
|
|
86
91
|
/**
|
|
87
|
-
* Resolves a type definition to a JSON Schema.
|
|
88
|
-
*
|
|
89
|
-
*
|
|
90
|
-
* [ts-json-schema-generator](https://github.com/vega/ts-json-schema-generator)
|
|
91
|
-
* using the referenced export name as the target type when one is provided.
|
|
92
|
+
* Resolves a type definition to a JSON Schema. Bundles the TypeScript module
|
|
93
|
+
* graph with esbuild using `@deepkit/type-compiler` reflection transformers,
|
|
94
|
+
* then converts the reflected Deepkit {@link Type} via {@link reflectionToJsonSchema}.
|
|
92
95
|
*
|
|
93
96
|
* @param input - The type definition to compile. This can be either a string or a {@link FileReference} object.
|
|
94
|
-
* @param options - Optional overrides
|
|
97
|
+
* @param options - Optional overrides for reflection and file resolution.
|
|
95
98
|
* @returns A promise that resolves to the generated JSON Schema.
|
|
99
|
+
* @see https://deepkit.io/en/documentation/runtime-types/reflection
|
|
96
100
|
*/
|
|
97
101
|
declare function extractTSType(input: FileReferenceInput, options?: InferLoadOptions<typeof input> & BaseExtractOptions): Promise<JsonSchema>;
|
|
98
102
|
/**
|
|
99
|
-
* Extracts a JSON Schema from a given schema definition input, which can be a Zod schema, a Valibot schema, any Standard JSON Schema type, a plain JSON Schema object, an untyped schema, or a {@link FileReferenceInput} to an exported TypeScript type definition or any of the previous options. If the input is a {@link FileReferenceInput} (e.g. a file path with an export), the source code will be bundled with [esbuild](esbuild.github.io) using [
|
|
103
|
+
* Extracts a JSON Schema from a given schema definition input, which can be a Zod schema, a Valibot schema, any Standard JSON Schema type, a plain JSON Schema object, an untyped schema, a Deepkit Type object, or a {@link FileReferenceInput} to an exported TypeScript type definition or any of the previous options. If the input is a {@link FileReferenceInput} (e.g. a file path with an export), the source code will be bundled with [esbuild](https://esbuild.github.io) using [@deepkit/type-compiler](https://deepkit.io/en/documentation/runtime-types/getting-started) reflection to obtain the actual schema definition before extraction.
|
|
100
104
|
*
|
|
101
105
|
* @example
|
|
102
106
|
* ```ts
|
|
@@ -110,8 +114,8 @@ declare function extractTSType(input: FileReferenceInput, options?: InferLoadOpt
|
|
|
110
114
|
* const schema4 = await extract(context, zodSchema);
|
|
111
115
|
* // Resolve a schema definition from a Valibot schema
|
|
112
116
|
* const schema5 = await extract(context, valibotSchema);
|
|
113
|
-
* // Resolve a schema definition from
|
|
114
|
-
* const schema6 = await extract(context,
|
|
117
|
+
* // Resolve a schema definition from a reflected Deepkit Type object
|
|
118
|
+
* const schema6 = await extract(context, reflectionType);
|
|
115
119
|
* ```
|
|
116
120
|
*
|
|
117
121
|
* @see https://zod.dev/
|
|
@@ -119,7 +123,7 @@ declare function extractTSType(input: FileReferenceInput, options?: InferLoadOpt
|
|
|
119
123
|
* @see https://standardschema.dev/json-schema#what-schema-libraries-support-this-spec
|
|
120
124
|
* @see https://json-schema.org/
|
|
121
125
|
* @see https://ajv.js.org/json-type-definition.html
|
|
122
|
-
* @see https://
|
|
126
|
+
* @see https://deepkit.io/en/documentation/runtime-types/reflection
|
|
123
127
|
* @see https://github.com/unjs/untyped
|
|
124
128
|
* @see https://www.typescriptlang.org/docs/handbook/2/types-from-types.html
|
|
125
129
|
*
|
|
@@ -130,7 +134,7 @@ declare function extractTSType(input: FileReferenceInput, options?: InferLoadOpt
|
|
|
130
134
|
*/
|
|
131
135
|
declare function extractSchemaWithSource<TSpec = any>(input: SchemaConfig, options?: InferExtractOptions<typeof input>): Promise<ExtractedSchemaEnvelope<TSpec>>;
|
|
132
136
|
/**
|
|
133
|
-
* Extracts a JSON Schema from a given schema definition input, which can be a Zod schema, a Valibot schema, any Standard JSON Schema type, a plain JSON Schema object, an untyped schema, or a {@link FileReferenceInput} to an exported TypeScript type definition or any of the previous options. If the input is a {@link FileReferenceInput} (e.g. a file path with an export), the source code will be bundled with [esbuild](esbuild.github.io) using [
|
|
137
|
+
* Extracts a JSON Schema from a given schema definition input, which can be a Zod schema, a Valibot schema, any Standard JSON Schema type, a plain JSON Schema object, an untyped schema, a Deepkit Type object, or a {@link FileReferenceInput} to an exported TypeScript type definition or any of the previous options. If the input is a {@link FileReferenceInput} (e.g. a file path with an export), the source code will be bundled with [esbuild](https://esbuild.github.io) using [@deepkit/type-compiler](https://deepkit.io/en/documentation/runtime-types/getting-started) reflection to obtain the actual schema definition before extraction.
|
|
134
138
|
*
|
|
135
139
|
* @example
|
|
136
140
|
* ```ts
|
|
@@ -144,8 +148,8 @@ declare function extractSchemaWithSource<TSpec = any>(input: SchemaConfig, optio
|
|
|
144
148
|
* const schema4 = await extract(context, zodSchema);
|
|
145
149
|
* // Resolve a schema definition from a Valibot schema
|
|
146
150
|
* const schema5 = await extract(context, valibotSchema);
|
|
147
|
-
* // Resolve a schema definition from
|
|
148
|
-
* const schema6 = await extract(context,
|
|
151
|
+
* // Resolve a schema definition from a reflected Deepkit Type object
|
|
152
|
+
* const schema6 = await extract(context, reflectionType);
|
|
149
153
|
* ```
|
|
150
154
|
*
|
|
151
155
|
* @see https://zod.dev/
|
|
@@ -153,7 +157,7 @@ declare function extractSchemaWithSource<TSpec = any>(input: SchemaConfig, optio
|
|
|
153
157
|
* @see https://standardschema.dev/json-schema#what-schema-libraries-support-this-spec
|
|
154
158
|
* @see https://json-schema.org/
|
|
155
159
|
* @see https://ajv.js.org/json-type-definition.html
|
|
156
|
-
* @see https://
|
|
160
|
+
* @see https://deepkit.io/en/documentation/runtime-types/reflection
|
|
157
161
|
* @see https://github.com/unjs/untyped
|
|
158
162
|
* @see https://www.typescriptlang.org/docs/handbook/2/types-from-types.html
|
|
159
163
|
*
|
|
@@ -672,5 +676,5 @@ declare function isSchemaWithSource(input: unknown): input is ExtractedSchemaEnv
|
|
|
672
676
|
*/
|
|
673
677
|
declare function isSchemaObject(input: unknown): input is SchemaEnvelope<JsonSchemaObject>;
|
|
674
678
|
//#endregion
|
|
675
|
-
export { type BaseExtractOptions, type BaseSchemaSource, type ExtractedSchemaEnvelope, GetPropertyResult, type InferExtractOptions, JSON_SCHEMA_CONSTRUCTOR_KEY, JSON_SCHEMA_METADATA_KEYS, JSON_SCHEMA_PRIMITIVE_TYPES, JSON_SCHEMA_TYPES, type JsonSchema, type JsonSchemaAllOf, type JsonSchemaAny, type JsonSchemaAnyOf, type JsonSchemaArray, type JsonSchemaBigint, type JsonSchemaBoolean, type JsonSchemaConditionalKeywords, type JsonSchemaDate, type JsonSchemaDecimal, type JsonSchemaDecimalFormat, type JsonSchemaEnum, type JsonSchemaFunctionParameter, type JsonSchemaInteger, type JsonSchemaIntegerFormat, type JsonSchemaKeywords, type JsonSchemaLike, type JsonSchemaLiteral, type JsonSchemaLogicKeywords, type JsonSchemaMap, type JsonSchemaMetadataKeywords, type JsonSchemaNativeEnum, type JsonSchemaNever, type JsonSchemaNull, type JsonSchemaNullable, type JsonSchemaNumber, type JsonSchemaNumberFormat, type JsonSchemaObject, type JsonSchemaOf, type JsonSchemaPrimitiveType, type JsonSchemaPrimitiveUnion, type JsonSchemaRecord, type JsonSchemaRecordPropertyNames, type JsonSchemaRef, type JsonSchemaSchemaSource, type JsonSchemaSet, type JsonSchemaString, type JsonSchemaStringFormat, type JsonSchemaTuple, type JsonSchemaType, JsonSchemaTypeNames, type JsonSchemaUndefined, type JsonSchemaUnion, type JsonSchemaUnknown, SCHEMA_ARRAY_CONCAT_KEYWORDS, SCHEMA_RECORD_KEYWORDS, SCHEMA_SINGLE_KEYWORDS, type SchemaConfig, type SchemaConfigVariant, type SchemaEnvelope, type SchemaEnvelopeOf, type SchemaSource, type SchemaSourceConfig, type SchemaSourceVariant, type SpecOf, type StandardSchemaSchemaSource, type UntypedConfigObject, type UntypedSchema, type UntypedSchemaSource, type ValibotSchema, type ValibotSchemaSource, type Zod3SchemaSource, addProperty, applyJsonSchemaMetadata, assertSchemasDoNotContradict, bundleReferences, createStoragePromises, extract, extractHash, extractJsonSchema, extractResolvedVariant, extractSchema, extractSchemaWithSource, extractSource, extractTSType, extractVariant, findSchemaContradictions, getJsonSchema, getJsonSchemaObject, getPrimarySchemaType, getProperties, getPropertiesList, getProperty, hasJsonSchemaConstructorFlag, isFileReference, isJsonSchema, isJsonSchemaAllOf, isJsonSchemaAny, isJsonSchemaAnyOf, isJsonSchemaArray, isJsonSchemaBigint, isJsonSchemaBoolean, isJsonSchemaDate, isJsonSchemaDecimal, isJsonSchemaEnum, isJsonSchemaInteger, isJsonSchemaKeywords, isJsonSchemaLiteral, isJsonSchemaMap, isJsonSchemaNativeEnum, isJsonSchemaNever, isJsonSchemaNull, isJsonSchemaNullable, isJsonSchemaNumber, isJsonSchemaObject, isJsonSchemaPrimitiveType, isJsonSchemaPrimitiveUnion, isJsonSchemaRecord, isJsonSchemaRef, isJsonSchemaSet, isJsonSchemaString, isJsonSchemaTuple, isJsonSchemaType, isJsonSchemaUndefined, isJsonSchemaUnion, isJsonSchemaUnknown, isNullOnlyJsonSchema, isPropertyOptional, isSchema, isSchemaNullable, isSchemaObject, isSchemaOf, isSchemaWithSource, isStandardSchema, isUntypedConfig, isUntypedConfigStrict, isUntypedInput, isUntypedInputStrict, isUntypedSchema, isUntypedSchemaStrict, isValibotSchema, isValidSchemaConfigFile, isValidSchemaInputFile, mapStorageToFileSystem, merge, mergeMetadata, normalizeKey, readSchemaTypes, traverseSchema };
|
|
679
|
+
export { type BaseExtractOptions, type BaseSchemaSource, type ExtractedSchemaEnvelope, GetPropertyResult, type InferExtractOptions, JSON_SCHEMA_CONSTRUCTOR_KEY, JSON_SCHEMA_METADATA_KEYS, JSON_SCHEMA_PRIMITIVE_TYPES, JSON_SCHEMA_TYPES, type JsonSchema, type JsonSchemaAllOf, type JsonSchemaAny, type JsonSchemaAnyOf, type JsonSchemaArray, type JsonSchemaBigint, type JsonSchemaBoolean, type JsonSchemaConditionalKeywords, type JsonSchemaDate, type JsonSchemaDecimal, type JsonSchemaDecimalFormat, type JsonSchemaEnum, type JsonSchemaFunction, type JsonSchemaFunctionParameter, type JsonSchemaInteger, type JsonSchemaIntegerFormat, type JsonSchemaKeywords, type JsonSchemaLike, type JsonSchemaLiteral, type JsonSchemaLogicKeywords, type JsonSchemaMap, type JsonSchemaMetadataKeywords, type JsonSchemaNativeEnum, type JsonSchemaNever, type JsonSchemaNull, type JsonSchemaNullable, type JsonSchemaNumber, type JsonSchemaNumberFormat, type JsonSchemaObject, type JsonSchemaOf, type JsonSchemaPrimitiveType, type JsonSchemaPrimitiveUnion, type JsonSchemaRecord, type JsonSchemaRecordPropertyNames, type JsonSchemaRef, type JsonSchemaSchemaSource, type JsonSchemaSet, type JsonSchemaString, type JsonSchemaStringFormat, type JsonSchemaTuple, type JsonSchemaType, JsonSchemaTypeNames, type JsonSchemaUndefined, type JsonSchemaUnion, type JsonSchemaUnknown, type ReflectionSchemaSource, SCHEMA_ARRAY_CONCAT_KEYWORDS, SCHEMA_RECORD_KEYWORDS, SCHEMA_SINGLE_KEYWORDS, type SchemaConfig, type SchemaConfigVariant, type SchemaEnvelope, type SchemaEnvelopeOf, type SchemaSource, type SchemaSourceConfig, type SchemaSourceVariant, type SpecOf, type StandardSchemaSchemaSource, type UntypedConfigObject, type UntypedSchema, type UntypedSchemaSource, type ValibotSchema, type ValibotSchemaSource, type Zod3SchemaSource, addProperty, applyJsonSchemaMetadata, assertSchemasDoNotContradict, bundleReferences, createStoragePromises, extract, extractHash, extractJsonSchema, extractReflection, extractResolvedVariant, extractSchema, extractSchemaWithSource, extractSource, extractTSType, extractVariant, findSchemaContradictions, getJsonSchema, getJsonSchemaObject, getPrimarySchemaType, getProperties, getPropertiesList, getProperty, hasJsonSchemaConstructorFlag, isFileReference, isJsonSchema, isJsonSchemaAllOf, isJsonSchemaAny, isJsonSchemaAnyOf, isJsonSchemaArray, isJsonSchemaBigint, isJsonSchemaBoolean, isJsonSchemaDate, isJsonSchemaDecimal, isJsonSchemaEnum, isJsonSchemaInteger, isJsonSchemaKeywords, isJsonSchemaLiteral, isJsonSchemaMap, isJsonSchemaNativeEnum, isJsonSchemaNever, isJsonSchemaNull, isJsonSchemaNullable, isJsonSchemaNumber, isJsonSchemaObject, isJsonSchemaPrimitiveType, isJsonSchemaPrimitiveUnion, isJsonSchemaRecord, isJsonSchemaRef, isJsonSchemaSet, isJsonSchemaString, isJsonSchemaTuple, isJsonSchemaType, isJsonSchemaUndefined, isJsonSchemaUnion, isJsonSchemaUnknown, isNullOnlyJsonSchema, isPropertyOptional, isSchema, isSchemaNullable, isSchemaObject, isSchemaOf, isSchemaWithSource, isStandardSchema, isUntypedConfig, isUntypedConfigStrict, isUntypedInput, isUntypedInputStrict, isUntypedSchema, isUntypedSchemaStrict, isValibotSchema, isValidSchemaConfigFile, isValidSchemaInputFile, mapStorageToFileSystem, merge, mergeMetadata, normalizeKey, readSchemaTypes, traverseSchema };
|
|
676
680
|
//# sourceMappingURL=index.d.mts.map
|