@powerlines/schema 0.11.71 → 0.11.73
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/index.cjs +2111 -97
- package/dist/index.d.cts +1841 -11
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +1841 -13
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +1999 -15
- package/dist/index.mjs.map +1 -0
- package/package.json +14 -14
- package/dist/_virtual/_rolldown/runtime.cjs +0 -37
- package/dist/bundle.cjs +0 -55
- package/dist/bundle.d.cts +0 -21
- package/dist/bundle.d.cts.map +0 -1
- package/dist/bundle.d.mts +0 -23
- package/dist/bundle.d.mts.map +0 -1
- package/dist/bundle.mjs +0 -54
- package/dist/bundle.mjs.map +0 -1
- package/dist/codegen.cjs +0 -81
- package/dist/codegen.d.cts +0 -26
- package/dist/codegen.d.cts.map +0 -1
- package/dist/codegen.d.mts +0 -28
- package/dist/codegen.d.mts.map +0 -1
- package/dist/codegen.mjs +0 -77
- package/dist/codegen.mjs.map +0 -1
- package/dist/constants.cjs +0 -69
- package/dist/constants.d.cts +0 -17
- package/dist/constants.d.cts.map +0 -1
- package/dist/constants.d.mts +0 -19
- package/dist/constants.d.mts.map +0 -1
- package/dist/constants.mjs +0 -65
- package/dist/constants.mjs.map +0 -1
- package/dist/extract.cjs +0 -490
- package/dist/extract.d.cts +0 -125
- package/dist/extract.d.cts.map +0 -1
- package/dist/extract.d.mts +0 -127
- package/dist/extract.d.mts.map +0 -1
- package/dist/extract.mjs +0 -480
- package/dist/extract.mjs.map +0 -1
- package/dist/helpers.cjs +0 -171
- package/dist/helpers.d.cts +0 -111
- package/dist/helpers.d.cts.map +0 -1
- package/dist/helpers.d.mts +0 -113
- package/dist/helpers.d.mts.map +0 -1
- package/dist/helpers.mjs +0 -164
- package/dist/helpers.mjs.map +0 -1
- package/dist/metadata.cjs +0 -61
- package/dist/metadata.d.cts +0 -31
- package/dist/metadata.d.cts.map +0 -1
- package/dist/metadata.d.mts +0 -33
- package/dist/metadata.d.mts.map +0 -1
- package/dist/metadata.mjs +0 -60
- package/dist/metadata.mjs.map +0 -1
- package/dist/persistence.cjs +0 -82
- package/dist/persistence.d.cts +0 -47
- package/dist/persistence.d.cts.map +0 -1
- package/dist/persistence.d.mts +0 -49
- package/dist/persistence.d.mts.map +0 -1
- package/dist/persistence.mjs +0 -79
- package/dist/persistence.mjs.map +0 -1
- package/dist/reflection.cjs +0 -434
- package/dist/reflection.d.cts +0 -11
- package/dist/reflection.d.cts.map +0 -1
- package/dist/reflection.d.mts +0 -13
- package/dist/reflection.d.mts.map +0 -1
- package/dist/reflection.mjs +0 -433
- package/dist/reflection.mjs.map +0 -1
- package/dist/resolve.cjs +0 -113
- package/dist/resolve.d.cts +0 -36
- package/dist/resolve.d.cts.map +0 -1
- package/dist/resolve.d.mts +0 -38
- package/dist/resolve.d.mts.map +0 -1
- package/dist/resolve.mjs +0 -110
- package/dist/resolve.mjs.map +0 -1
- package/dist/type-checks.cjs +0 -642
- package/dist/type-checks.d.cts +0 -316
- package/dist/type-checks.d.cts.map +0 -1
- package/dist/type-checks.d.mts +0 -318
- package/dist/type-checks.d.mts.map +0 -1
- package/dist/type-checks.mjs +0 -603
- package/dist/type-checks.mjs.map +0 -1
- package/dist/types.d.cts +0 -1152
- package/dist/types.d.cts.map +0 -1
- package/dist/types.d.mts +0 -1154
- package/dist/types.d.mts.map +0 -1
- package/dist/validate.cjs +0 -35
- package/dist/validate.mjs +0 -33
- package/dist/validate.mjs.map +0 -1
package/dist/extract.d.mts
DELETED
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
import __tsdown_shims_path from 'node:path';
|
|
2
|
-
import __tsdown_shims_url from 'node:url';
|
|
3
|
-
import { BundleOptions } from "./bundle.mjs";
|
|
4
|
-
import { ExtractedSchema, JsonSchema, Schema, SchemaInput, SchemaInputVariant, SchemaSource, SchemaSourceInput, SchemaSourceVariant } from "./types.mjs";
|
|
5
|
-
import { Context } from "@powerlines/core";
|
|
6
|
-
import { Type } from "@powerlines/deepkit/vendor/type";
|
|
7
|
-
|
|
8
|
-
//#region src/extract.d.ts
|
|
9
|
-
/**
|
|
10
|
-
* Bundles all external references in a JSON Schema into a single schema document by collecting all reference targets and rewriting the references to point to the bundled definitions. This ensures that the resulting schema is self-contained and can be used independently without relying on external documents.
|
|
11
|
-
*
|
|
12
|
-
* @param schema - The JSON Schema to bundle references for.
|
|
13
|
-
* @returns A new JSON Schema with all references bundled and rewritten to point to the bundled definitions.
|
|
14
|
-
*/
|
|
15
|
-
declare function bundleReferences(schema: JsonSchema): JsonSchema;
|
|
16
|
-
/**
|
|
17
|
-
* Creates a hash string for a given schema definition input.
|
|
18
|
-
*/
|
|
19
|
-
declare function extractHash(variant: SchemaInputVariant, input: SchemaInput): string;
|
|
20
|
-
/**
|
|
21
|
-
* Converts a reflected Deepkit {@link Type} into a JSON Schema (draft-2020-12) representation.
|
|
22
|
-
*/
|
|
23
|
-
declare function extractReflection(reflection: Type): JsonSchema | undefined;
|
|
24
|
-
/**
|
|
25
|
-
* Extracts a JSON Schema from Zod, Standard Schema, Valibot, untyped, or JSON Schema inputs.
|
|
26
|
-
*
|
|
27
|
-
* @param schema - The schema input to extract a JSON Schema from.
|
|
28
|
-
* @returns The extracted JSON Schema, or `undefined` if the input is not a supported schema type.
|
|
29
|
-
*/
|
|
30
|
-
declare function extractJsonSchema(schema: unknown): JsonSchema | undefined;
|
|
31
|
-
/**
|
|
32
|
-
* Resolves the concrete source variant for a schema source input.
|
|
33
|
-
*
|
|
34
|
-
* @param input - The schema source input to inspect.
|
|
35
|
-
* @returns The resolved schema source variant.
|
|
36
|
-
* @throws Will throw an error when the input cannot be mapped to a supported source variant.
|
|
37
|
-
*/
|
|
38
|
-
declare function extractResolvedVariant(input: SchemaSourceInput): SchemaSourceVariant;
|
|
39
|
-
/**
|
|
40
|
-
* Determines the top-level input variant for schema extraction.
|
|
41
|
-
*
|
|
42
|
-
* @param input - The schema input to classify.
|
|
43
|
-
* @returns The resolved schema input variant.
|
|
44
|
-
*/
|
|
45
|
-
declare function extractVariant(input: SchemaInput): SchemaInputVariant;
|
|
46
|
-
/**
|
|
47
|
-
* Extracts and normalizes a JSON Schema from a concrete schema source input.
|
|
48
|
-
*
|
|
49
|
-
* @param input - The schema source input to extract from.
|
|
50
|
-
* @param variant - Optional source variant override. When omitted, the variant is inferred from the input.
|
|
51
|
-
* @returns A promise that resolves to a bundled JSON Schema.
|
|
52
|
-
* @throws Will throw an error if no valid JSON Schema can be extracted from the input.
|
|
53
|
-
*/
|
|
54
|
-
declare function extractSchema(input: SchemaSourceInput, variant?: SchemaInputVariant): Promise<JsonSchema>;
|
|
55
|
-
/**
|
|
56
|
-
* Builds source metadata for a schema input using a known source variant.
|
|
57
|
-
*
|
|
58
|
-
* @param variant - The schema source variant associated with the input.
|
|
59
|
-
* @param input - The schema source input to wrap.
|
|
60
|
-
* @returns The normalized schema source payload, including the source hash and variant.
|
|
61
|
-
* @throws Will throw an error if the provided variant is unsupported.
|
|
62
|
-
*/
|
|
63
|
-
declare function extractSource(variant: SchemaSourceVariant, input: SchemaSourceInput): SchemaSource;
|
|
64
|
-
/**
|
|
65
|
-
* 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 Deepkit Type object. If the input is a type definition reference (e.g. a file path with an export), it will be resolved and bundled using Rolldown to obtain the actual schema definition before extraction.
|
|
66
|
-
*
|
|
67
|
-
* @example
|
|
68
|
-
* ```ts
|
|
69
|
-
* // Resolve a schema definition from a file path
|
|
70
|
-
* const schema1 = await extract(context, "./schemas.ts#MySchema");
|
|
71
|
-
* // Resolve a schema definition from a JSON Schema object
|
|
72
|
-
* const schema2 = await extract(context, schemaObject);
|
|
73
|
-
* // Resolve a schema definition from a Zod schema
|
|
74
|
-
* const schema3 = await extract(context, zodSchema);
|
|
75
|
-
* // Resolve a schema definition from a reflected Deepkit Type object
|
|
76
|
-
* const schema4 = await extract(context, reflectionType);
|
|
77
|
-
* ```
|
|
78
|
-
*
|
|
79
|
-
* @see https://zod.dev/
|
|
80
|
-
* @see https://valibot.dev/
|
|
81
|
-
* @see https://standardschema.dev/json-schema#what-schema-libraries-support-this-spec
|
|
82
|
-
* @see https://json-schema.org/
|
|
83
|
-
* @see https://ajv.js.org/json-type-definition.html
|
|
84
|
-
* @see https://deepkit.io/en/documentation/runtime-types/reflection
|
|
85
|
-
*
|
|
86
|
-
* @param context - The context object providing access to the file system and cache path.
|
|
87
|
-
* @param input - The schema definition input to extract, which can be a Zod schema, a Valibot schema, any Standard JSON Schema type, a plain JSON Schema object, an untyped schema, or a reflected Deepkit Type object. If the input is a string or a type definition reference, it will be resolved and bundled to obtain the actual schema definition before extraction.
|
|
88
|
-
* @param options - Optional overrides for the Rolldown configuration used during extraction. This can include custom plugins, loaders, or other build options to control how the schema definition is resolved and bundled when the input is a type definition reference.
|
|
89
|
-
* @returns A promise that resolves to the extracted and normalized schema as a JSON Schema object. The function will attempt to extract a valid JSON Schema from the provided input, and if successful, it will return the schema. If the extraction process fails or if the input is not a valid schema definition, it will throw an error indicating the failure.
|
|
90
|
-
*/
|
|
91
|
-
declare function extractSchemaWithSource(context: Context, input: SchemaInput, options?: BundleOptions): Promise<ExtractedSchema>;
|
|
92
|
-
/**
|
|
93
|
-
* 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 Deepkit Type object. If the input is a type definition reference (e.g. a file path with an export), it will be resolved and bundled using Rolldown to obtain the actual schema definition before extraction.
|
|
94
|
-
*
|
|
95
|
-
* @example
|
|
96
|
-
* ```ts
|
|
97
|
-
* // Resolve a schema definition from a file path
|
|
98
|
-
* const schema1 = await extract(context, "./schemas.ts#MySchema");
|
|
99
|
-
* // Resolve a schema definition from a JSON Schema object
|
|
100
|
-
* const schema2 = await extract(context, schemaObject);
|
|
101
|
-
* // Resolve a schema definition from a Zod schema
|
|
102
|
-
* const schema3 = await extract(context, zodSchema);
|
|
103
|
-
* // Resolve a schema definition from a Valibot schema
|
|
104
|
-
* const schema4 = await extract(context, valibotSchema);
|
|
105
|
-
* // Resolve a schema definition from a reflected Deepkit Type object
|
|
106
|
-
* const schema5 = await extract(context, reflectionType);
|
|
107
|
-
* ```
|
|
108
|
-
*
|
|
109
|
-
* @see https://zod.dev/
|
|
110
|
-
* @see https://valibot.dev/
|
|
111
|
-
* @see https://standardschema.dev/json-schema#what-schema-libraries-support-this-spec
|
|
112
|
-
* @see https://json-schema.org/
|
|
113
|
-
* @see https://ajv.js.org/json-type-definition.html
|
|
114
|
-
* @see https://deepkit.io/en/documentation/runtime-types/reflection
|
|
115
|
-
* @see https://github.com/unjs/untyped
|
|
116
|
-
* @see https://www.typescriptlang.org/docs/handbook/2/types-from-types.html
|
|
117
|
-
*
|
|
118
|
-
* @param context - The context object providing access to the file system and cache path.
|
|
119
|
-
* @param input - The schema definition input to extract, which can be a Zod schema, a Valibot schema, any Standard JSON Schema type, a plain JSON Schema object, an untyped schema, or a reflected Deepkit Type object.
|
|
120
|
-
* @param options - Optional overrides for the Rolldown configuration used during extraction.
|
|
121
|
-
* @returns A promise that resolves to the extracted and normalized schema as a JSON Schema object.
|
|
122
|
-
* @throws Will throw an error if the input is not a valid schema definition or if the extraction process fails to produce a valid schema.
|
|
123
|
-
*/
|
|
124
|
-
declare function extract(context: Context, input: SchemaInput, options?: BundleOptions): Promise<Schema>;
|
|
125
|
-
//#endregion
|
|
126
|
-
export { bundleReferences, extract, extractHash, extractJsonSchema, extractReflection, extractResolvedVariant, extractSchema, extractSchemaWithSource, extractSource, extractVariant };
|
|
127
|
-
//# sourceMappingURL=extract.d.mts.map
|
package/dist/extract.d.mts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"extract.d.mts","names":[],"sources":["../src/extract.ts"],"mappings":";;;;;;;;;;;;;;iBAmPgB,gBAAA,CAAiB,MAAA,EAAQ,UAAA,GAAa,UAAU;;;;iBAgMhD,WAAA,CACd,OAAA,EAAS,kBAAA,EACT,KAAA,EAAO,WAAW;;;;iBAyCJ,iBAAA,CAAkB,UAAA,EAAY,IAAA,GAAO,UAAU;;;;AA3OC;AAgMhE;;iBAyDgB,iBAAA,CAAkB,MAAA,YAAkB,UAAU;;;;;;;AAvD1C;iBA2FJ,sBAAA,CACd,KAAA,EAAO,iBAAA,GACN,mBAAmB;;;;;;;iBA4BN,cAAA,CAAe,KAAA,EAAO,WAAA,GAAc,kBAAkB;AAhFP;AAc/D;;;;AAA8D;AAoC9D;;AAlD+D,iBAgGzC,aAAA,CACpB,KAAA,EAAO,iBAAA,EACP,OAAA,GAAU,kBAAA,GACT,OAAA,CAAQ,UAAA;;;;;;AA/CW;AA4BtB;;iBAwDgB,aAAA,CACd,OAAA,EAAS,mBAAA,EACT,KAAA,EAAO,iBAAA,GACN,YAAA;;;;;;AA3DmE;AAgBtE;;;;;;;;;;;;;;;;AAGqB;AAqCrB;;;;iBA0EsB,uBAAA,CACpB,OAAA,EAAS,OAAA,EACT,KAAA,EAAO,WAAA,EACP,OAAA,GAAS,aAAA,GACR,OAAA,CAAQ,eAAA;;;;;;;;;;AA3EI;AAuEf;;;;;;;;;;;;;;;;;;;AAI0B;AA+H1B;;iBAAsB,OAAA,CACpB,OAAA,EAAS,OAAA,EACT,KAAA,EAAO,WAAA,EACP,OAAA,GAAS,aAAA,GACR,OAAA,CAAQ,MAAA"}
|
package/dist/extract.mjs
DELETED
|
@@ -1,480 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import __tsdown_shims_path from 'node:path'
|
|
4
|
-
import __tsdown_shims_url from 'node:url'
|
|
5
|
-
|
|
6
|
-
const __TSDOWN_SHIM_FILENAME__ = /* @__PURE__ */ __tsdown_shims_url.fileURLToPath(import.meta.url)
|
|
7
|
-
const __TSDOWN_SHIM_DIRNAME__ = /* @__PURE__ */ __tsdown_shims_path.dirname(__TSDOWN_SHIM_FILENAME__)
|
|
8
|
-
|
|
9
|
-
import { VALID_SOURCE_FILE_EXTENSIONS } from "./constants.mjs";
|
|
10
|
-
import { isJsonSchema, isJsonSchemaObject, isSchema, isSchemaWithSource, isUntypedInput, isUntypedInputStrict, isUntypedSchema, isUntypedSchemaStrict, isValibotSchema } from "./type-checks.mjs";
|
|
11
|
-
import { getCacheDirectory, writeSchema } from "./persistence.mjs";
|
|
12
|
-
import { reflectionToJsonSchema } from "./reflection.mjs";
|
|
13
|
-
import { resolve } from "./resolve.mjs";
|
|
14
|
-
import defu from "defu";
|
|
15
|
-
import { isSetString } from "@stryke/type-checks";
|
|
16
|
-
import { findFileExtensionSafe } from "@stryke/path/find";
|
|
17
|
-
import { isSetObject as isSetObject$1 } from "@stryke/type-checks/is-set-object";
|
|
18
|
-
import { isFileReference } from "@powerlines/core";
|
|
19
|
-
import { esbuildPlugin } from "@powerlines/deepkit/esbuild-plugin";
|
|
20
|
-
import { deserializeType, isType, stringifyType } from "@powerlines/deepkit/vendor/type";
|
|
21
|
-
import { extractFileReference } from "@stryke/convert/extract-file-reference";
|
|
22
|
-
import { murmurhash } from "@stryke/hash";
|
|
23
|
-
import { deepClone } from "@stryke/helpers/deep-clone";
|
|
24
|
-
import { isStandardJsonSchema } from "@stryke/json";
|
|
25
|
-
import { joinPaths } from "@stryke/path/join";
|
|
26
|
-
import { list } from "@stryke/string-format/list";
|
|
27
|
-
import { extractJsonSchema, isZod3Type } from "@stryke/zod";
|
|
28
|
-
import { toJsonSchema } from "@valibot/to-json-schema";
|
|
29
|
-
|
|
30
|
-
//#region src/extract.ts
|
|
31
|
-
const SCHEMA_BUNDLE_BASE_URI = "https://powerlines.invalid/";
|
|
32
|
-
function normalizeUri(uri) {
|
|
33
|
-
return uri.endsWith("#") ? uri.slice(0, -1) : uri;
|
|
34
|
-
}
|
|
35
|
-
function stripUriFragment(uri) {
|
|
36
|
-
const hashIndex = uri.indexOf("#");
|
|
37
|
-
return hashIndex >= 0 ? uri.slice(0, hashIndex) : uri;
|
|
38
|
-
}
|
|
39
|
-
function escapeJsonPointerToken(token) {
|
|
40
|
-
return token.replaceAll("~", "~0").replaceAll("/", "~1");
|
|
41
|
-
}
|
|
42
|
-
function toJsonPointer(path) {
|
|
43
|
-
if (path.length === 0) return "";
|
|
44
|
-
return `/${path.map((segment) => escapeJsonPointerToken(segment)).join("/")}`;
|
|
45
|
-
}
|
|
46
|
-
function resolveUri(reference, baseUri) {
|
|
47
|
-
try {
|
|
48
|
-
return normalizeUri(new URL(reference, baseUri).toString());
|
|
49
|
-
} catch {
|
|
50
|
-
return normalizeUri(reference);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
function collectReferenceTargets(value, path, baseUri, uriToPointer, dynamicUriToFragment) {
|
|
54
|
-
if (!isSetObject$1(value)) return;
|
|
55
|
-
const schema = value;
|
|
56
|
-
const pointer = toJsonPointer(path);
|
|
57
|
-
const currentBaseUri = isSetString(schema.$id) ? resolveUri(schema.$id, baseUri) : baseUri;
|
|
58
|
-
const currentDocumentUri = stripUriFragment(currentBaseUri);
|
|
59
|
-
uriToPointer.set(currentBaseUri, pointer);
|
|
60
|
-
uriToPointer.set(currentDocumentUri, pointer);
|
|
61
|
-
if (isSetString(schema.$anchor)) uriToPointer.set(`${currentDocumentUri}#${schema.$anchor}`, pointer);
|
|
62
|
-
if (isSetString(schema.$dynamicAnchor)) {
|
|
63
|
-
const dynamicTarget = `${currentDocumentUri}#${schema.$dynamicAnchor}`;
|
|
64
|
-
uriToPointer.set(dynamicTarget, pointer);
|
|
65
|
-
dynamicUriToFragment.set(dynamicTarget, `#${schema.$dynamicAnchor}`);
|
|
66
|
-
}
|
|
67
|
-
for (const [key, child] of Object.entries(schema)) {
|
|
68
|
-
if (Array.isArray(child)) {
|
|
69
|
-
child.forEach((entry, index) => {
|
|
70
|
-
collectReferenceTargets(entry, [
|
|
71
|
-
...path,
|
|
72
|
-
key,
|
|
73
|
-
String(index)
|
|
74
|
-
], currentBaseUri, uriToPointer, dynamicUriToFragment);
|
|
75
|
-
});
|
|
76
|
-
continue;
|
|
77
|
-
}
|
|
78
|
-
collectReferenceTargets(child, [...path, key], currentBaseUri, uriToPointer, dynamicUriToFragment);
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
function rewriteReferenceTargets(value, path, baseUri, uriToPointer, dynamicUriToFragment) {
|
|
82
|
-
if (!isSetObject$1(value)) return;
|
|
83
|
-
const schema = value;
|
|
84
|
-
const currentBaseUri = isSetString(schema.$id) ? resolveUri(schema.$id, baseUri) : baseUri;
|
|
85
|
-
if (isSetString(schema.$ref)) {
|
|
86
|
-
const resolvedRefUri = resolveUri(schema.$ref, currentBaseUri);
|
|
87
|
-
const pointer = uriToPointer.get(resolvedRefUri) ?? uriToPointer.get(stripUriFragment(resolvedRefUri));
|
|
88
|
-
if (pointer !== void 0) schema.$ref = pointer.length > 0 ? `#${pointer}` : "#";
|
|
89
|
-
}
|
|
90
|
-
if (isSetString(schema.$dynamicRef)) {
|
|
91
|
-
const resolvedDynamicRefUri = resolveUri(schema.$dynamicRef, currentBaseUri);
|
|
92
|
-
const dynamicFragment = dynamicUriToFragment.get(resolvedDynamicRefUri);
|
|
93
|
-
if (dynamicFragment) schema.$dynamicRef = dynamicFragment;
|
|
94
|
-
else {
|
|
95
|
-
const pointer = uriToPointer.get(resolvedDynamicRefUri) ?? uriToPointer.get(stripUriFragment(resolvedDynamicRefUri));
|
|
96
|
-
if (pointer !== void 0) schema.$dynamicRef = pointer.length > 0 ? `#${pointer}` : "#";
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
for (const [key, child] of Object.entries(schema)) {
|
|
100
|
-
if (Array.isArray(child)) {
|
|
101
|
-
child.forEach((entry, index) => {
|
|
102
|
-
rewriteReferenceTargets(entry, [
|
|
103
|
-
...path,
|
|
104
|
-
key,
|
|
105
|
-
String(index)
|
|
106
|
-
], currentBaseUri, uriToPointer, dynamicUriToFragment);
|
|
107
|
-
});
|
|
108
|
-
continue;
|
|
109
|
-
}
|
|
110
|
-
rewriteReferenceTargets(child, [...path, key], currentBaseUri, uriToPointer, dynamicUriToFragment);
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
/**
|
|
114
|
-
* Bundles all external references in a JSON Schema into a single schema document by collecting all reference targets and rewriting the references to point to the bundled definitions. This ensures that the resulting schema is self-contained and can be used independently without relying on external documents.
|
|
115
|
-
*
|
|
116
|
-
* @param schema - The JSON Schema to bundle references for.
|
|
117
|
-
* @returns A new JSON Schema with all references bundled and rewritten to point to the bundled definitions.
|
|
118
|
-
*/
|
|
119
|
-
function bundleReferences(schema) {
|
|
120
|
-
if (!isSetObject$1(schema)) return schema;
|
|
121
|
-
const bundledSchema = deepClone(schema);
|
|
122
|
-
const baseUri = isSetString(bundledSchema.$id) ? resolveUri(bundledSchema.$id, SCHEMA_BUNDLE_BASE_URI) : SCHEMA_BUNDLE_BASE_URI;
|
|
123
|
-
const uriToPointer = /* @__PURE__ */ new Map();
|
|
124
|
-
const dynamicUriToFragment = /* @__PURE__ */ new Map();
|
|
125
|
-
collectReferenceTargets(bundledSchema, [], baseUri, uriToPointer, dynamicUriToFragment);
|
|
126
|
-
rewriteReferenceTargets(bundledSchema, [], baseUri, uriToPointer, dynamicUriToFragment);
|
|
127
|
-
return bundledSchema;
|
|
128
|
-
}
|
|
129
|
-
function convertNestedUntypedSchema(value) {
|
|
130
|
-
if (isUntypedSchema(value)) return convertUntypedSchemaToJsonSchema(value);
|
|
131
|
-
if (isSetObject$1(value)) {
|
|
132
|
-
if (isUntypedInput(value)) return convertUntypedInputToJsonSchema(value);
|
|
133
|
-
const nested = value;
|
|
134
|
-
if ("$schema" in nested && isUntypedSchema(nested.$schema)) return convertUntypedSchemaToJsonSchema(nested.$schema);
|
|
135
|
-
}
|
|
136
|
-
return value;
|
|
137
|
-
}
|
|
138
|
-
function convertNestedUntypedSchemaArray(value) {
|
|
139
|
-
if (!Array.isArray(value)) return value;
|
|
140
|
-
return value.map((item) => convertNestedUntypedSchema(item));
|
|
141
|
-
}
|
|
142
|
-
function convertValibotSchemaToJsonSchema(schema) {
|
|
143
|
-
return toJsonSchema(schema, { target: "draft-2020-12" });
|
|
144
|
-
}
|
|
145
|
-
function convertUntypedSchemaToJsonSchema(schema) {
|
|
146
|
-
const source = schema;
|
|
147
|
-
const jsonSchema = {};
|
|
148
|
-
for (const [key, value] of Object.entries(source)) {
|
|
149
|
-
if (key === "tsType" || key === "markdownType" || key === "tags" || key === "args" || key === "resolve") continue;
|
|
150
|
-
if (key === "id" && isSetString(value)) {
|
|
151
|
-
jsonSchema.$id = value;
|
|
152
|
-
continue;
|
|
153
|
-
}
|
|
154
|
-
if (key === "properties" || key === "patternProperties" || key === "dependentSchemas" || key === "$defs" || key === "definitions") {
|
|
155
|
-
if (!isSetObject$1(value)) {
|
|
156
|
-
jsonSchema[key] = value;
|
|
157
|
-
continue;
|
|
158
|
-
}
|
|
159
|
-
jsonSchema[key] = Object.fromEntries(Object.entries(value).map(([propertyKey, propertyValue]) => [propertyKey, convertNestedUntypedSchema(propertyValue)]));
|
|
160
|
-
continue;
|
|
161
|
-
}
|
|
162
|
-
if (key === "items" || key === "contains" || key === "if" || key === "then" || key === "else" || key === "not" || key === "propertyNames" || key === "additionalProperties" || key === "unevaluatedProperties") {
|
|
163
|
-
jsonSchema[key] = convertNestedUntypedSchema(value);
|
|
164
|
-
continue;
|
|
165
|
-
}
|
|
166
|
-
if (key === "oneOf" || key === "anyOf" || key === "allOf") {
|
|
167
|
-
jsonSchema[key] = convertNestedUntypedSchemaArray(value);
|
|
168
|
-
continue;
|
|
169
|
-
}
|
|
170
|
-
jsonSchema[key] = value;
|
|
171
|
-
}
|
|
172
|
-
return jsonSchema;
|
|
173
|
-
}
|
|
174
|
-
function convertUntypedInputToJsonSchema(input) {
|
|
175
|
-
const inputObject = input;
|
|
176
|
-
const base = isUntypedSchema(inputObject.$schema) ? convertUntypedSchemaToJsonSchema(inputObject.$schema) : {};
|
|
177
|
-
const properties = {};
|
|
178
|
-
for (const [key, value] of Object.entries(inputObject)) {
|
|
179
|
-
if (key.startsWith("$")) continue;
|
|
180
|
-
if (!isSetObject$1(value)) continue;
|
|
181
|
-
if (isUntypedInput(value)) {
|
|
182
|
-
properties[key] = convertUntypedInputToJsonSchema(value);
|
|
183
|
-
continue;
|
|
184
|
-
}
|
|
185
|
-
const nested = value;
|
|
186
|
-
if ("$schema" in nested && isUntypedSchema(nested.$schema)) {
|
|
187
|
-
properties[key] = convertUntypedSchemaToJsonSchema(nested.$schema);
|
|
188
|
-
continue;
|
|
189
|
-
}
|
|
190
|
-
if (isUntypedSchema(value)) properties[key] = convertUntypedSchemaToJsonSchema(value);
|
|
191
|
-
}
|
|
192
|
-
if (!isJsonSchemaObject(base)) throw new Error(`Failed to convert untyped input to JSON Schema. The base schema must be a valid JSON Schema object.`);
|
|
193
|
-
const mergedProperties = {
|
|
194
|
-
...isSetObject$1(base.properties) ? base.properties : {},
|
|
195
|
-
...properties
|
|
196
|
-
};
|
|
197
|
-
return {
|
|
198
|
-
...base,
|
|
199
|
-
type: base.type ?? "object",
|
|
200
|
-
...Object.keys(mergedProperties).length > 0 ? { properties: mergedProperties } : {}
|
|
201
|
-
};
|
|
202
|
-
}
|
|
203
|
-
/**
|
|
204
|
-
* Creates a hash string for a given schema definition input.
|
|
205
|
-
*/
|
|
206
|
-
function extractHash(variant, input) {
|
|
207
|
-
if (isSetString(input)) return murmurhash({
|
|
208
|
-
variant,
|
|
209
|
-
input
|
|
210
|
-
});
|
|
211
|
-
else if (typeof input === "boolean") return murmurhash({
|
|
212
|
-
variant,
|
|
213
|
-
input
|
|
214
|
-
});
|
|
215
|
-
else if (isSetObject$1(input)) {
|
|
216
|
-
if (isZod3Type(input)) return murmurhash({
|
|
217
|
-
variant,
|
|
218
|
-
input: input._def
|
|
219
|
-
});
|
|
220
|
-
else if (isType(input)) return murmurhash({
|
|
221
|
-
variant,
|
|
222
|
-
input: stringifyType(input)
|
|
223
|
-
});
|
|
224
|
-
else if (isStandardJsonSchema(input)) return murmurhash({
|
|
225
|
-
variant,
|
|
226
|
-
input: input["~standard"]
|
|
227
|
-
});
|
|
228
|
-
else if (isJsonSchema(input)) return murmurhash({
|
|
229
|
-
variant,
|
|
230
|
-
input
|
|
231
|
-
});
|
|
232
|
-
else if (isValibotSchema(input)) return murmurhash({
|
|
233
|
-
variant,
|
|
234
|
-
input: convertValibotSchemaToJsonSchema(input)
|
|
235
|
-
});
|
|
236
|
-
else if (isUntypedInput(input)) return murmurhash({
|
|
237
|
-
variant,
|
|
238
|
-
input: convertUntypedInputToJsonSchema(input)
|
|
239
|
-
});
|
|
240
|
-
else if (isUntypedSchema(input)) return murmurhash({
|
|
241
|
-
variant,
|
|
242
|
-
input: convertUntypedSchemaToJsonSchema(input)
|
|
243
|
-
});
|
|
244
|
-
}
|
|
245
|
-
throw new Error(`Failed to create an input hash for the provided schema definition input. The input must be a Zod schema, a Standard JSON Schema, a JSON Schema object, a Valibot BaseSchema, or a reflected Deepkit Type object.`);
|
|
246
|
-
}
|
|
247
|
-
/**
|
|
248
|
-
* Converts a reflected Deepkit {@link Type} into a JSON Schema (draft-2020-12) representation.
|
|
249
|
-
*/
|
|
250
|
-
function extractReflection(reflection) {
|
|
251
|
-
if (!isType(reflection)) return;
|
|
252
|
-
return reflectionToJsonSchema(reflection);
|
|
253
|
-
}
|
|
254
|
-
/**
|
|
255
|
-
* Extracts a JSON Schema from Zod, Standard Schema, Valibot, untyped, or JSON Schema inputs.
|
|
256
|
-
*
|
|
257
|
-
* @param schema - The schema input to extract a JSON Schema from.
|
|
258
|
-
* @returns The extracted JSON Schema, or `undefined` if the input is not a supported schema type.
|
|
259
|
-
*/
|
|
260
|
-
function extractJsonSchema$1(schema) {
|
|
261
|
-
if (isSetObject$1(schema)) {
|
|
262
|
-
if (isZod3Type(schema)) return extractJsonSchema(schema, { target: "draft-2020-12" });
|
|
263
|
-
if (isUntypedInputStrict(schema)) return convertUntypedInputToJsonSchema(schema);
|
|
264
|
-
if (isUntypedSchemaStrict(schema)) return convertUntypedSchemaToJsonSchema(schema);
|
|
265
|
-
if (isStandardJsonSchema(schema)) return schema["~standard"].jsonSchema.input({ target: "draft-2020-12" });
|
|
266
|
-
if (isValibotSchema(schema)) return convertValibotSchemaToJsonSchema(schema);
|
|
267
|
-
if (isJsonSchema(schema)) return schema;
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
/**
|
|
271
|
-
* Resolves the concrete source variant for a schema source input.
|
|
272
|
-
*
|
|
273
|
-
* @param input - The schema source input to inspect.
|
|
274
|
-
* @returns The resolved schema source variant.
|
|
275
|
-
* @throws Will throw an error when the input cannot be mapped to a supported source variant.
|
|
276
|
-
*/
|
|
277
|
-
function extractResolvedVariant(input) {
|
|
278
|
-
if (isSetObject$1(input)) {
|
|
279
|
-
if (isZod3Type(input)) return "zod3";
|
|
280
|
-
else if (isType(input)) return "reflection";
|
|
281
|
-
else if (isUntypedInputStrict(input) || isUntypedSchemaStrict(input)) return "untyped";
|
|
282
|
-
else if (isStandardJsonSchema(input)) return "standard-schema";
|
|
283
|
-
else if (isJsonSchema(input)) return "json-schema";
|
|
284
|
-
else if (isValibotSchema(input)) return "valibot";
|
|
285
|
-
}
|
|
286
|
-
throw new Error(`Failed to determine the variant of the provided schema definition input. The input must be a Zod schema, a Standard JSON Schema, a JSON Schema object, a Valibot BaseSchema, a reflected Deepkit Type object, or an Untyped schema.`);
|
|
287
|
-
}
|
|
288
|
-
/**
|
|
289
|
-
* Determines the top-level input variant for schema extraction.
|
|
290
|
-
*
|
|
291
|
-
* @param input - The schema input to classify.
|
|
292
|
-
* @returns The resolved schema input variant.
|
|
293
|
-
*/
|
|
294
|
-
function extractVariant(input) {
|
|
295
|
-
if (isSetString(input) || isFileReference(input)) return "file-reference";
|
|
296
|
-
return extractResolvedVariant(input);
|
|
297
|
-
}
|
|
298
|
-
/**
|
|
299
|
-
* Extracts and normalizes a JSON Schema from a concrete schema source input.
|
|
300
|
-
*
|
|
301
|
-
* @param input - The schema source input to extract from.
|
|
302
|
-
* @param variant - Optional source variant override. When omitted, the variant is inferred from the input.
|
|
303
|
-
* @returns A promise that resolves to a bundled JSON Schema.
|
|
304
|
-
* @throws Will throw an error if no valid JSON Schema can be extracted from the input.
|
|
305
|
-
*/
|
|
306
|
-
async function extractSchema(input, variant) {
|
|
307
|
-
if (isSchemaWithSource(input)) return input.schema;
|
|
308
|
-
const resolvedVariant = variant ?? extractResolvedVariant(input);
|
|
309
|
-
let schema;
|
|
310
|
-
if (resolvedVariant === "zod3" || resolvedVariant === "json-schema" || resolvedVariant === "standard-schema" || resolvedVariant === "untyped" || resolvedVariant === "valibot") schema = extractJsonSchema$1(input);
|
|
311
|
-
else if (resolvedVariant === "reflection") schema = extractReflection(input);
|
|
312
|
-
if (schema) return bundleReferences(schema);
|
|
313
|
-
throw new Error(`Failed to extract a valid schema from the provided input. The input must be a Zod schema, a Standard JSON Schema, a JSON Schema object, a Valibot BaseSchema, an untyped schema, or a reflected Deepkit Type object.`);
|
|
314
|
-
}
|
|
315
|
-
/**
|
|
316
|
-
* Builds source metadata for a schema input using a known source variant.
|
|
317
|
-
*
|
|
318
|
-
* @param variant - The schema source variant associated with the input.
|
|
319
|
-
* @param input - The schema source input to wrap.
|
|
320
|
-
* @returns The normalized schema source payload, including the source hash and variant.
|
|
321
|
-
* @throws Will throw an error if the provided variant is unsupported.
|
|
322
|
-
*/
|
|
323
|
-
function extractSource(variant, input) {
|
|
324
|
-
if (variant === "zod3") return {
|
|
325
|
-
hash: extractHash(variant, input),
|
|
326
|
-
variant: "zod3",
|
|
327
|
-
schema: input
|
|
328
|
-
};
|
|
329
|
-
else if (variant === "untyped") return {
|
|
330
|
-
hash: extractHash(variant, input),
|
|
331
|
-
variant: "untyped",
|
|
332
|
-
schema: input
|
|
333
|
-
};
|
|
334
|
-
else if (variant === "standard-schema") return {
|
|
335
|
-
hash: extractHash(variant, input),
|
|
336
|
-
variant: "standard-schema",
|
|
337
|
-
schema: input
|
|
338
|
-
};
|
|
339
|
-
else if (variant === "json-schema") return {
|
|
340
|
-
hash: extractHash(variant, input),
|
|
341
|
-
variant: "json-schema",
|
|
342
|
-
schema: input
|
|
343
|
-
};
|
|
344
|
-
else if (variant === "valibot") return {
|
|
345
|
-
hash: extractHash(variant, input),
|
|
346
|
-
variant: "valibot",
|
|
347
|
-
schema: input
|
|
348
|
-
};
|
|
349
|
-
else if (variant === "reflection") return {
|
|
350
|
-
hash: extractHash(variant, input),
|
|
351
|
-
variant: "reflection",
|
|
352
|
-
schema: input
|
|
353
|
-
};
|
|
354
|
-
throw new Error(`Failed to extract source information from the provided input. The input must be a Zod schema, a Standard JSON Schema, a JSON Schema object, an untyped schema, or a reflected Deepkit Type object.`);
|
|
355
|
-
}
|
|
356
|
-
/**
|
|
357
|
-
* 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 Deepkit Type object. If the input is a type definition reference (e.g. a file path with an export), it will be resolved and bundled using Rolldown to obtain the actual schema definition before extraction.
|
|
358
|
-
*
|
|
359
|
-
* @example
|
|
360
|
-
* ```ts
|
|
361
|
-
* // Resolve a schema definition from a file path
|
|
362
|
-
* const schema1 = await extract(context, "./schemas.ts#MySchema");
|
|
363
|
-
* // Resolve a schema definition from a JSON Schema object
|
|
364
|
-
* const schema2 = await extract(context, schemaObject);
|
|
365
|
-
* // Resolve a schema definition from a Zod schema
|
|
366
|
-
* const schema3 = await extract(context, zodSchema);
|
|
367
|
-
* // Resolve a schema definition from a reflected Deepkit Type object
|
|
368
|
-
* const schema4 = await extract(context, reflectionType);
|
|
369
|
-
* ```
|
|
370
|
-
*
|
|
371
|
-
* @see https://zod.dev/
|
|
372
|
-
* @see https://valibot.dev/
|
|
373
|
-
* @see https://standardschema.dev/json-schema#what-schema-libraries-support-this-spec
|
|
374
|
-
* @see https://json-schema.org/
|
|
375
|
-
* @see https://ajv.js.org/json-type-definition.html
|
|
376
|
-
* @see https://deepkit.io/en/documentation/runtime-types/reflection
|
|
377
|
-
*
|
|
378
|
-
* @param context - The context object providing access to the file system and cache path.
|
|
379
|
-
* @param input - The schema definition input to extract, which can be a Zod schema, a Valibot schema, any Standard JSON Schema type, a plain JSON Schema object, an untyped schema, or a reflected Deepkit Type object. If the input is a string or a type definition reference, it will be resolved and bundled to obtain the actual schema definition before extraction.
|
|
380
|
-
* @param options - Optional overrides for the Rolldown configuration used during extraction. This can include custom plugins, loaders, or other build options to control how the schema definition is resolved and bundled when the input is a type definition reference.
|
|
381
|
-
* @returns A promise that resolves to the extracted and normalized schema as a JSON Schema object. The function will attempt to extract a valid JSON Schema from the provided input, and if successful, it will return the schema. If the extraction process fails or if the input is not a valid schema definition, it will throw an error indicating the failure.
|
|
382
|
-
*/
|
|
383
|
-
async function extractSchemaWithSource(context, input, options = {}) {
|
|
384
|
-
if (isSchemaWithSource(input)) return input;
|
|
385
|
-
if (isSchema(input)) return {
|
|
386
|
-
...input,
|
|
387
|
-
source: {
|
|
388
|
-
hash: extractHash("json-schema", input.schema),
|
|
389
|
-
variant: "json-schema",
|
|
390
|
-
schema: input.schema
|
|
391
|
-
}
|
|
392
|
-
};
|
|
393
|
-
let source;
|
|
394
|
-
const variant = extractVariant(input);
|
|
395
|
-
const hash = extractHash(variant, input);
|
|
396
|
-
if (variant === "file-reference") {
|
|
397
|
-
const fileReference = extractFileReference(input);
|
|
398
|
-
if (!fileReference) throw new Error(`Failed to extract a valid file reference from the provided input "${JSON.stringify(input)}". Please ensure that the input is correctly formatted as a file reference (e.g. "./schema.ts#MySchema") and that the file exists at the specified path.`);
|
|
399
|
-
const extension = findFileExtensionSafe(fileReference.file);
|
|
400
|
-
if (extension && !VALID_SOURCE_FILE_EXTENSIONS.includes(extension)) throw new Error(`The provided schema file input "${fileReference.file}" has an invalid file extension (.${extension}). Please ensure that the file has one of the following extensions: ${list(VALID_SOURCE_FILE_EXTENSIONS, { conjunction: "or" })}.`);
|
|
401
|
-
let resolved = await resolve(context, input, defu(options, { plugins: [esbuildPlugin(context, {
|
|
402
|
-
reflection: "default",
|
|
403
|
-
level: "all"
|
|
404
|
-
})] }));
|
|
405
|
-
try {
|
|
406
|
-
const type = deserializeType(resolved);
|
|
407
|
-
if (isType(type)) resolved = type;
|
|
408
|
-
} catch {}
|
|
409
|
-
source = extractSource(extractResolvedVariant(resolved), resolved);
|
|
410
|
-
} else if ([
|
|
411
|
-
"json-schema",
|
|
412
|
-
"standard-schema",
|
|
413
|
-
"zod3",
|
|
414
|
-
"untyped",
|
|
415
|
-
"valibot",
|
|
416
|
-
"reflection"
|
|
417
|
-
].includes(variant)) source = extractSource(variant, input);
|
|
418
|
-
else throw new Error(`Invalid schema definition input "${variant}". The variant must be one of "file-reference", "json-schema", "standard-schema", "zod3", "valibot", "untyped", or "reflection".`);
|
|
419
|
-
return {
|
|
420
|
-
variant,
|
|
421
|
-
source,
|
|
422
|
-
schema: await extractSchema(source.schema, source.variant),
|
|
423
|
-
hash
|
|
424
|
-
};
|
|
425
|
-
}
|
|
426
|
-
/**
|
|
427
|
-
* 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 Deepkit Type object. If the input is a type definition reference (e.g. a file path with an export), it will be resolved and bundled using Rolldown to obtain the actual schema definition before extraction.
|
|
428
|
-
*
|
|
429
|
-
* @example
|
|
430
|
-
* ```ts
|
|
431
|
-
* // Resolve a schema definition from a file path
|
|
432
|
-
* const schema1 = await extract(context, "./schemas.ts#MySchema");
|
|
433
|
-
* // Resolve a schema definition from a JSON Schema object
|
|
434
|
-
* const schema2 = await extract(context, schemaObject);
|
|
435
|
-
* // Resolve a schema definition from a Zod schema
|
|
436
|
-
* const schema3 = await extract(context, zodSchema);
|
|
437
|
-
* // Resolve a schema definition from a Valibot schema
|
|
438
|
-
* const schema4 = await extract(context, valibotSchema);
|
|
439
|
-
* // Resolve a schema definition from a reflected Deepkit Type object
|
|
440
|
-
* const schema5 = await extract(context, reflectionType);
|
|
441
|
-
* ```
|
|
442
|
-
*
|
|
443
|
-
* @see https://zod.dev/
|
|
444
|
-
* @see https://valibot.dev/
|
|
445
|
-
* @see https://standardschema.dev/json-schema#what-schema-libraries-support-this-spec
|
|
446
|
-
* @see https://json-schema.org/
|
|
447
|
-
* @see https://ajv.js.org/json-type-definition.html
|
|
448
|
-
* @see https://deepkit.io/en/documentation/runtime-types/reflection
|
|
449
|
-
* @see https://github.com/unjs/untyped
|
|
450
|
-
* @see https://www.typescriptlang.org/docs/handbook/2/types-from-types.html
|
|
451
|
-
*
|
|
452
|
-
* @param context - The context object providing access to the file system and cache path.
|
|
453
|
-
* @param input - The schema definition input to extract, which can be a Zod schema, a Valibot schema, any Standard JSON Schema type, a plain JSON Schema object, an untyped schema, or a reflected Deepkit Type object.
|
|
454
|
-
* @param options - Optional overrides for the Rolldown configuration used during extraction.
|
|
455
|
-
* @returns A promise that resolves to the extracted and normalized schema as a JSON Schema object.
|
|
456
|
-
* @throws Will throw an error if the input is not a valid schema definition or if the extraction process fails to produce a valid schema.
|
|
457
|
-
*/
|
|
458
|
-
async function extract(context, input, options = {}) {
|
|
459
|
-
if (isSchemaWithSource(input) || isSchema(input)) return input;
|
|
460
|
-
let result;
|
|
461
|
-
const variant = extractVariant(input);
|
|
462
|
-
const hash = extractHash(variant, input);
|
|
463
|
-
const cacheFilePath = joinPaths(getCacheDirectory(context), `${hash}.json`);
|
|
464
|
-
if (context.config.skipCache !== true && context.fs.existsSync(cacheFilePath)) {
|
|
465
|
-
const schema = await context.fs.read(cacheFilePath);
|
|
466
|
-
if (schema) result = {
|
|
467
|
-
variant,
|
|
468
|
-
hash,
|
|
469
|
-
schema: JSON.parse(schema)
|
|
470
|
-
};
|
|
471
|
-
}
|
|
472
|
-
result ??= await extractSchemaWithSource(context, input, options);
|
|
473
|
-
if (!result?.schema) throw new Error(`Failed to extract a valid schema from the provided input. The input must be a Zod schema, a Valibot schema, any Standard JSON Schema type, a plain JSON Schema object, an untyped schema, or a reflected Deepkit Type object.`);
|
|
474
|
-
if (context.config.skipCache !== true) await writeSchema(context, result);
|
|
475
|
-
return result;
|
|
476
|
-
}
|
|
477
|
-
|
|
478
|
-
//#endregion
|
|
479
|
-
export { bundleReferences, extract, extractHash, extractJsonSchema$1 as extractJsonSchema, extractReflection, extractResolvedVariant, extractSchema, extractSchemaWithSource, extractSource, extractVariant };
|
|
480
|
-
//# sourceMappingURL=extract.mjs.map
|