@powerlines/schema 0.11.45 → 0.11.46
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/bundle.cjs +1 -1
- package/dist/bundle.d.cts +1 -1
- package/dist/bundle.d.mts +1 -1
- package/dist/bundle.mjs +1 -1
- package/dist/bundle.mjs.map +1 -1
- package/dist/codegen.cjs +28 -22
- package/dist/codegen.d.cts +11 -11
- package/dist/codegen.d.cts.map +1 -1
- package/dist/codegen.d.mts +11 -11
- package/dist/codegen.d.mts.map +1 -1
- package/dist/codegen.mjs +36 -30
- package/dist/codegen.mjs.map +1 -1
- package/dist/constants.cjs +15 -11
- package/dist/constants.d.cts +4 -3
- package/dist/constants.d.cts.map +1 -1
- package/dist/constants.d.mts +4 -3
- package/dist/constants.d.mts.map +1 -1
- package/dist/constants.mjs +13 -10
- package/dist/constants.mjs.map +1 -1
- package/dist/extract.cjs +158 -20
- package/dist/extract.d.cts +55 -16
- package/dist/extract.d.cts.map +1 -1
- package/dist/extract.d.mts +55 -16
- package/dist/extract.d.mts.map +1 -1
- package/dist/extract.mjs +158 -22
- package/dist/extract.mjs.map +1 -1
- package/dist/helpers.cjs +43 -8
- package/dist/helpers.d.cts +40 -6
- package/dist/helpers.d.cts.map +1 -1
- package/dist/helpers.d.mts +40 -6
- package/dist/helpers.d.mts.map +1 -1
- package/dist/helpers.mjs +43 -10
- package/dist/helpers.mjs.map +1 -1
- package/dist/index.cjs +39 -7
- package/dist/index.d.cts +8 -8
- package/dist/index.d.mts +8 -8
- package/dist/index.mjs +7 -7
- package/dist/metadata.cjs +9 -35
- package/dist/metadata.d.cts +5 -26
- package/dist/metadata.d.cts.map +1 -1
- package/dist/metadata.d.mts +5 -26
- package/dist/metadata.d.mts.map +1 -1
- package/dist/metadata.mjs +9 -33
- package/dist/metadata.mjs.map +1 -1
- package/dist/persistence.d.cts +4 -4
- package/dist/persistence.d.cts.map +1 -1
- package/dist/persistence.d.mts +4 -4
- package/dist/persistence.d.mts.map +1 -1
- package/dist/persistence.mjs.map +1 -1
- package/dist/reflection.cjs +72 -50
- package/dist/reflection.d.cts +1 -1
- package/dist/reflection.d.cts.map +1 -1
- package/dist/reflection.d.mts +1 -1
- package/dist/reflection.d.mts.map +1 -1
- package/dist/reflection.mjs +74 -52
- package/dist/reflection.mjs.map +1 -1
- package/dist/type-checks.cjs +363 -83
- package/dist/type-checks.d.cts +138 -16
- package/dist/type-checks.d.cts.map +1 -1
- package/dist/type-checks.d.mts +138 -16
- package/dist/type-checks.d.mts.map +1 -1
- package/dist/type-checks.mjs +336 -85
- package/dist/type-checks.mjs.map +1 -1
- package/dist/types.d.cts +901 -176
- package/dist/types.d.cts.map +1 -1
- package/dist/types.d.mts +901 -176
- package/dist/types.d.mts.map +1 -1
- package/dist/validate.mjs.map +1 -1
- package/package.json +5 -5
package/dist/extract.cjs
CHANGED
|
@@ -7,16 +7,115 @@ let defu = require("defu");
|
|
|
7
7
|
defu = require_runtime.__toESM(defu, 1);
|
|
8
8
|
let _stryke_type_checks = require("@stryke/type-checks");
|
|
9
9
|
let _stryke_type_checks_is_set_object = require("@stryke/type-checks/is-set-object");
|
|
10
|
-
let _stryke_json = require("@stryke/json");
|
|
11
10
|
let _powerlines_core = require("@powerlines/core");
|
|
12
11
|
let _powerlines_deepkit_rolldown_plugin = require("@powerlines/deepkit/rolldown-plugin");
|
|
13
12
|
let _powerlines_deepkit_vendor_type = require("@powerlines/deepkit/vendor/type");
|
|
14
13
|
let _stryke_hash = require("@stryke/hash");
|
|
14
|
+
let _stryke_helpers_deep_clone = require("@stryke/helpers/deep-clone");
|
|
15
|
+
let _stryke_json = require("@stryke/json");
|
|
15
16
|
let _stryke_path_join = require("@stryke/path/join");
|
|
16
17
|
let _stryke_zod = require("@stryke/zod");
|
|
17
18
|
let _valibot_to_json_schema = require("@valibot/to-json-schema");
|
|
18
19
|
|
|
19
20
|
//#region src/extract.ts
|
|
21
|
+
const SCHEMA_BUNDLE_BASE_URI = "https://powerlines.invalid/";
|
|
22
|
+
function normalizeUri(uri) {
|
|
23
|
+
return uri.endsWith("#") ? uri.slice(0, -1) : uri;
|
|
24
|
+
}
|
|
25
|
+
function stripUriFragment(uri) {
|
|
26
|
+
const hashIndex = uri.indexOf("#");
|
|
27
|
+
return hashIndex >= 0 ? uri.slice(0, hashIndex) : uri;
|
|
28
|
+
}
|
|
29
|
+
function escapeJsonPointerToken(token) {
|
|
30
|
+
return token.replaceAll("~", "~0").replaceAll("/", "~1");
|
|
31
|
+
}
|
|
32
|
+
function toJsonPointer(path) {
|
|
33
|
+
if (path.length === 0) return "";
|
|
34
|
+
return `/${path.map((segment) => escapeJsonPointerToken(segment)).join("/")}`;
|
|
35
|
+
}
|
|
36
|
+
function resolveUri(reference, baseUri) {
|
|
37
|
+
try {
|
|
38
|
+
return normalizeUri(new URL(reference, baseUri).toString());
|
|
39
|
+
} catch {
|
|
40
|
+
return normalizeUri(reference);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
function collectReferenceTargets(value, path, baseUri, uriToPointer, dynamicUriToFragment) {
|
|
44
|
+
if (!(0, _stryke_type_checks_is_set_object.isSetObject)(value)) return;
|
|
45
|
+
const schema = value;
|
|
46
|
+
const pointer = toJsonPointer(path);
|
|
47
|
+
const currentBaseUri = (0, _stryke_type_checks.isSetString)(schema.$id) ? resolveUri(schema.$id, baseUri) : baseUri;
|
|
48
|
+
const currentDocumentUri = stripUriFragment(currentBaseUri);
|
|
49
|
+
uriToPointer.set(currentBaseUri, pointer);
|
|
50
|
+
uriToPointer.set(currentDocumentUri, pointer);
|
|
51
|
+
if ((0, _stryke_type_checks.isSetString)(schema.$anchor)) uriToPointer.set(`${currentDocumentUri}#${schema.$anchor}`, pointer);
|
|
52
|
+
if ((0, _stryke_type_checks.isSetString)(schema.$dynamicAnchor)) {
|
|
53
|
+
const dynamicTarget = `${currentDocumentUri}#${schema.$dynamicAnchor}`;
|
|
54
|
+
uriToPointer.set(dynamicTarget, pointer);
|
|
55
|
+
dynamicUriToFragment.set(dynamicTarget, `#${schema.$dynamicAnchor}`);
|
|
56
|
+
}
|
|
57
|
+
for (const [key, child] of Object.entries(schema)) {
|
|
58
|
+
if (Array.isArray(child)) {
|
|
59
|
+
child.forEach((entry, index) => {
|
|
60
|
+
collectReferenceTargets(entry, [
|
|
61
|
+
...path,
|
|
62
|
+
key,
|
|
63
|
+
String(index)
|
|
64
|
+
], currentBaseUri, uriToPointer, dynamicUriToFragment);
|
|
65
|
+
});
|
|
66
|
+
continue;
|
|
67
|
+
}
|
|
68
|
+
collectReferenceTargets(child, [...path, key], currentBaseUri, uriToPointer, dynamicUriToFragment);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
function rewriteReferenceTargets(value, path, baseUri, uriToPointer, dynamicUriToFragment) {
|
|
72
|
+
if (!(0, _stryke_type_checks_is_set_object.isSetObject)(value)) return;
|
|
73
|
+
const schema = value;
|
|
74
|
+
const currentBaseUri = (0, _stryke_type_checks.isSetString)(schema.$id) ? resolveUri(schema.$id, baseUri) : baseUri;
|
|
75
|
+
if ((0, _stryke_type_checks.isSetString)(schema.$ref)) {
|
|
76
|
+
const resolvedRefUri = resolveUri(schema.$ref, currentBaseUri);
|
|
77
|
+
const pointer = uriToPointer.get(resolvedRefUri) ?? uriToPointer.get(stripUriFragment(resolvedRefUri));
|
|
78
|
+
if (pointer !== void 0) schema.$ref = pointer.length > 0 ? `#${pointer}` : "#";
|
|
79
|
+
}
|
|
80
|
+
if ((0, _stryke_type_checks.isSetString)(schema.$dynamicRef)) {
|
|
81
|
+
const resolvedDynamicRefUri = resolveUri(schema.$dynamicRef, currentBaseUri);
|
|
82
|
+
const dynamicFragment = dynamicUriToFragment.get(resolvedDynamicRefUri);
|
|
83
|
+
if (dynamicFragment) schema.$dynamicRef = dynamicFragment;
|
|
84
|
+
else {
|
|
85
|
+
const pointer = uriToPointer.get(resolvedDynamicRefUri) ?? uriToPointer.get(stripUriFragment(resolvedDynamicRefUri));
|
|
86
|
+
if (pointer !== void 0) schema.$dynamicRef = pointer.length > 0 ? `#${pointer}` : "#";
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
for (const [key, child] of Object.entries(schema)) {
|
|
90
|
+
if (Array.isArray(child)) {
|
|
91
|
+
child.forEach((entry, index) => {
|
|
92
|
+
rewriteReferenceTargets(entry, [
|
|
93
|
+
...path,
|
|
94
|
+
key,
|
|
95
|
+
String(index)
|
|
96
|
+
], currentBaseUri, uriToPointer, dynamicUriToFragment);
|
|
97
|
+
});
|
|
98
|
+
continue;
|
|
99
|
+
}
|
|
100
|
+
rewriteReferenceTargets(child, [...path, key], currentBaseUri, uriToPointer, dynamicUriToFragment);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* 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.
|
|
105
|
+
*
|
|
106
|
+
* @param schema - The JSON Schema to bundle references for.
|
|
107
|
+
* @returns A new JSON Schema with all references bundled and rewritten to point to the bundled definitions.
|
|
108
|
+
*/
|
|
109
|
+
function bundleReferences(schema) {
|
|
110
|
+
if (!(0, _stryke_type_checks_is_set_object.isSetObject)(schema)) return schema;
|
|
111
|
+
const bundledSchema = (0, _stryke_helpers_deep_clone.deepClone)(schema);
|
|
112
|
+
const baseUri = (0, _stryke_type_checks.isSetString)(bundledSchema.$id) ? resolveUri(bundledSchema.$id, SCHEMA_BUNDLE_BASE_URI) : SCHEMA_BUNDLE_BASE_URI;
|
|
113
|
+
const uriToPointer = /* @__PURE__ */ new Map();
|
|
114
|
+
const dynamicUriToFragment = /* @__PURE__ */ new Map();
|
|
115
|
+
collectReferenceTargets(bundledSchema, [], baseUri, uriToPointer, dynamicUriToFragment);
|
|
116
|
+
rewriteReferenceTargets(bundledSchema, [], baseUri, uriToPointer, dynamicUriToFragment);
|
|
117
|
+
return bundledSchema;
|
|
118
|
+
}
|
|
20
119
|
function convertNestedUntypedSchema(value) {
|
|
21
120
|
if (require_type_checks.isUntypedSchema(value)) return convertUntypedSchemaToJsonSchema(value);
|
|
22
121
|
if ((0, _stryke_type_checks_is_set_object.isSetObject)(value)) {
|
|
@@ -31,7 +130,7 @@ function convertNestedUntypedSchemaArray(value) {
|
|
|
31
130
|
return value.map((item) => convertNestedUntypedSchema(item));
|
|
32
131
|
}
|
|
33
132
|
function convertValibotSchemaToJsonSchema(schema) {
|
|
34
|
-
return (0, _valibot_to_json_schema.toJsonSchema)(schema, { target: "draft-
|
|
133
|
+
return (0, _valibot_to_json_schema.toJsonSchema)(schema, { target: "draft-2020-12" });
|
|
35
134
|
}
|
|
36
135
|
function convertUntypedSchemaToJsonSchema(schema) {
|
|
37
136
|
const source = schema;
|
|
@@ -99,6 +198,10 @@ function extractHash(variant, input) {
|
|
|
99
198
|
variant,
|
|
100
199
|
input
|
|
101
200
|
});
|
|
201
|
+
else if (typeof input === "boolean") return (0, _stryke_hash.murmurhash)({
|
|
202
|
+
variant,
|
|
203
|
+
input
|
|
204
|
+
});
|
|
102
205
|
else if ((0, _stryke_type_checks_is_set_object.isSetObject)(input)) {
|
|
103
206
|
if ((0, _stryke_zod.isZod3Type)(input)) return (0, _stryke_hash.murmurhash)({
|
|
104
207
|
variant,
|
|
@@ -132,7 +235,7 @@ function extractHash(variant, input) {
|
|
|
132
235
|
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.`);
|
|
133
236
|
}
|
|
134
237
|
/**
|
|
135
|
-
* Converts a reflected Deepkit {@link Type} into a JSON Schema (draft-
|
|
238
|
+
* Converts a reflected Deepkit {@link Type} into a JSON Schema (draft-2020-12) representation.
|
|
136
239
|
*/
|
|
137
240
|
function extractReflection(reflection) {
|
|
138
241
|
if (!(0, _powerlines_deepkit_vendor_type.isType)(reflection)) return;
|
|
@@ -151,7 +254,15 @@ function extractJsonSchema(schema) {
|
|
|
151
254
|
if (require_type_checks.isJsonSchema(schema)) return schema;
|
|
152
255
|
}
|
|
153
256
|
}
|
|
257
|
+
/**
|
|
258
|
+
* Resolves the concrete source variant for a schema source input.
|
|
259
|
+
*
|
|
260
|
+
* @param input - The schema source input to inspect.
|
|
261
|
+
* @returns The resolved schema source variant.
|
|
262
|
+
* @throws Will throw an error when the input cannot be mapped to a supported source variant.
|
|
263
|
+
*/
|
|
154
264
|
function extractResolvedVariant(input) {
|
|
265
|
+
if (typeof input === "boolean") return "json-schema";
|
|
155
266
|
if ((0, _stryke_type_checks_is_set_object.isSetObject)(input)) {
|
|
156
267
|
if ((0, _stryke_zod.isZod3Type)(input)) return "zod3";
|
|
157
268
|
else if ((0, _stryke_json.isStandardJsonSchema)(input)) return "standard-schema";
|
|
@@ -162,19 +273,41 @@ function extractResolvedVariant(input) {
|
|
|
162
273
|
}
|
|
163
274
|
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.`);
|
|
164
275
|
}
|
|
276
|
+
/**
|
|
277
|
+
* Determines the top-level input variant for schema extraction.
|
|
278
|
+
*
|
|
279
|
+
* @param input - The schema input to classify.
|
|
280
|
+
* @returns The resolved schema input variant.
|
|
281
|
+
*/
|
|
165
282
|
function extractVariant(input) {
|
|
166
283
|
if ((0, _stryke_type_checks.isSetString)(input) || (0, _powerlines_core.isTypeDefinition)(input)) return "type-definition";
|
|
167
284
|
return extractResolvedVariant(input);
|
|
168
285
|
}
|
|
169
|
-
|
|
170
|
-
|
|
286
|
+
/**
|
|
287
|
+
* Extracts and normalizes a JSON Schema from a concrete schema source input.
|
|
288
|
+
*
|
|
289
|
+
* @param input - The schema source input to extract from.
|
|
290
|
+
* @param variant - Optional source variant override. When omitted, the variant is inferred from the input.
|
|
291
|
+
* @returns A promise that resolves to a bundled JSON Schema.
|
|
292
|
+
* @throws Will throw an error if no valid JSON Schema can be extracted from the input.
|
|
293
|
+
*/
|
|
294
|
+
async function extractSchema(input, variant) {
|
|
295
|
+
if (require_type_checks.isSchemaWithSource(input)) return input.schema;
|
|
171
296
|
const resolvedVariant = variant ?? extractResolvedVariant(input);
|
|
172
297
|
let schema;
|
|
173
298
|
if (resolvedVariant === "zod3" || resolvedVariant === "json-schema" || resolvedVariant === "standard-schema" || resolvedVariant === "untyped" || resolvedVariant === "valibot") schema = extractJsonSchema(input);
|
|
174
299
|
else if (resolvedVariant === "reflection") schema = extractReflection(input);
|
|
175
|
-
if (schema) return schema;
|
|
300
|
+
if (schema) return bundleReferences(schema);
|
|
176
301
|
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.`);
|
|
177
302
|
}
|
|
303
|
+
/**
|
|
304
|
+
* Builds source metadata for a schema input using a known source variant.
|
|
305
|
+
*
|
|
306
|
+
* @param variant - The schema source variant associated with the input.
|
|
307
|
+
* @param input - The schema source input to wrap.
|
|
308
|
+
* @returns The normalized schema source payload, including the source hash and variant.
|
|
309
|
+
* @throws Will throw an error if the provided variant is unsupported.
|
|
310
|
+
*/
|
|
178
311
|
function extractSource(variant, input) {
|
|
179
312
|
if (variant === "zod3") return {
|
|
180
313
|
hash: extractHash(variant, input),
|
|
@@ -209,7 +342,7 @@ function extractSource(variant, input) {
|
|
|
209
342
|
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.`);
|
|
210
343
|
}
|
|
211
344
|
/**
|
|
212
|
-
* Extracts a JSON Schema from a given schema definition input, which can be a Zod schema, a Standard JSON Schema, a JSON Schema object, an untyped schema, or a
|
|
345
|
+
* 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.
|
|
213
346
|
*
|
|
214
347
|
* @example
|
|
215
348
|
* ```ts
|
|
@@ -223,19 +356,20 @@ function extractSource(variant, input) {
|
|
|
223
356
|
* const schema4 = await extract(context, reflectionType);
|
|
224
357
|
* ```
|
|
225
358
|
*
|
|
226
|
-
* @see https://
|
|
359
|
+
* @see https://zod.dev/
|
|
360
|
+
* @see https://valibot.dev/
|
|
227
361
|
* @see https://standardschema.dev/json-schema#what-schema-libraries-support-this-spec
|
|
228
362
|
* @see https://json-schema.org/
|
|
229
363
|
* @see https://ajv.js.org/json-type-definition.html
|
|
230
364
|
* @see https://deepkit.io/en/documentation/runtime-types/reflection
|
|
231
365
|
*
|
|
232
366
|
* @param context - The context object providing access to the file system and cache path.
|
|
233
|
-
* @param input - The schema definition input to extract, which can be a Zod schema, a Standard JSON Schema, a 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.
|
|
234
|
-
* @param options - Optional overrides for the
|
|
367
|
+
* @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.
|
|
368
|
+
* @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.
|
|
235
369
|
* @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.
|
|
236
370
|
*/
|
|
237
|
-
async function
|
|
238
|
-
if (require_type_checks.
|
|
371
|
+
async function extractSchemaWithSource(context, input, options = {}) {
|
|
372
|
+
if (require_type_checks.isSchemaWithSource(input)) return input;
|
|
239
373
|
if (require_type_checks.isSchema(input)) return {
|
|
240
374
|
...input,
|
|
241
375
|
source: {
|
|
@@ -258,18 +392,19 @@ async function extractSchema(context, input, options = {}) {
|
|
|
258
392
|
"standard-schema",
|
|
259
393
|
"zod3",
|
|
260
394
|
"untyped",
|
|
395
|
+
"valibot",
|
|
261
396
|
"reflection"
|
|
262
397
|
].includes(variant)) source = extractSource(variant, input);
|
|
263
398
|
else throw new Error(`Invalid schema definition input "${variant}". The variant must be one of "type-definition", "json-schema", "standard-schema", "zod3", "untyped", or "reflection".`);
|
|
264
399
|
return {
|
|
265
400
|
variant,
|
|
266
401
|
source,
|
|
267
|
-
schema: await
|
|
402
|
+
schema: await extractSchema(source.schema, source.variant),
|
|
268
403
|
hash
|
|
269
404
|
};
|
|
270
405
|
}
|
|
271
406
|
/**
|
|
272
|
-
* Extracts a JSON Schema from a given schema definition input, which can be a Zod schema, a Standard JSON Schema, a JSON Schema object, an untyped schema, or a
|
|
407
|
+
* 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.
|
|
273
408
|
*
|
|
274
409
|
* @example
|
|
275
410
|
* ```ts
|
|
@@ -283,7 +418,8 @@ async function extractSchema(context, input, options = {}) {
|
|
|
283
418
|
* const schema4 = await extract(context, reflectionType);
|
|
284
419
|
* ```
|
|
285
420
|
*
|
|
286
|
-
* @see https://
|
|
421
|
+
* @see https://zod.dev/
|
|
422
|
+
* @see https://valibot.dev/
|
|
287
423
|
* @see https://standardschema.dev/json-schema#what-schema-libraries-support-this-spec
|
|
288
424
|
* @see https://json-schema.org/
|
|
289
425
|
* @see https://ajv.js.org/json-type-definition.html
|
|
@@ -292,13 +428,13 @@ async function extractSchema(context, input, options = {}) {
|
|
|
292
428
|
* @see https://www.typescriptlang.org/docs/handbook/2/types-from-types.html
|
|
293
429
|
*
|
|
294
430
|
* @param context - The context object providing access to the file system and cache path.
|
|
295
|
-
* @param input - The schema definition input to extract, which can be a Zod schema, a Standard JSON Schema, a JSON Schema object, an untyped schema, or a reflected Deepkit Type object.
|
|
296
|
-
* @param options - Optional overrides for the
|
|
431
|
+
* @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.
|
|
432
|
+
* @param options - Optional overrides for the Rolldown configuration used during extraction.
|
|
297
433
|
* @returns A promise that resolves to the extracted and normalized schema as a JSON Schema object.
|
|
298
434
|
* @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.
|
|
299
435
|
*/
|
|
300
436
|
async function extract(context, input, options = {}) {
|
|
301
|
-
if (require_type_checks.
|
|
437
|
+
if (require_type_checks.isSchemaWithSource(input) || require_type_checks.isSchema(input)) return input;
|
|
302
438
|
let result;
|
|
303
439
|
const variant = extractVariant(input);
|
|
304
440
|
const hash = extractHash(variant, input);
|
|
@@ -311,18 +447,20 @@ async function extract(context, input, options = {}) {
|
|
|
311
447
|
schema: JSON.parse(schema)
|
|
312
448
|
};
|
|
313
449
|
}
|
|
314
|
-
result ??= await
|
|
315
|
-
if (!result?.schema) 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, an untyped schema, or a reflected Deepkit Type object.`);
|
|
450
|
+
result ??= await extractSchemaWithSource(context, input, options);
|
|
451
|
+
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.`);
|
|
316
452
|
if (context.config.skipCache !== true) await require_persistence.writeSchema(context, result);
|
|
317
453
|
return result;
|
|
318
454
|
}
|
|
319
455
|
|
|
320
456
|
//#endregion
|
|
457
|
+
exports.bundleReferences = bundleReferences;
|
|
321
458
|
exports.extract = extract;
|
|
322
459
|
exports.extractHash = extractHash;
|
|
323
460
|
exports.extractJsonSchema = extractJsonSchema;
|
|
324
461
|
exports.extractReflection = extractReflection;
|
|
325
462
|
exports.extractResolvedVariant = extractResolvedVariant;
|
|
326
463
|
exports.extractSchema = extractSchema;
|
|
464
|
+
exports.extractSchemaWithSource = extractSchemaWithSource;
|
|
327
465
|
exports.extractSource = extractSource;
|
|
328
466
|
exports.extractVariant = extractVariant;
|
package/dist/extract.d.cts
CHANGED
|
@@ -4,23 +4,60 @@ import { BuildOptions } from "rolldown";
|
|
|
4
4
|
import { Type } from "@powerlines/deepkit/vendor/type";
|
|
5
5
|
|
|
6
6
|
//#region src/extract.d.ts
|
|
7
|
+
/**
|
|
8
|
+
* 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.
|
|
9
|
+
*
|
|
10
|
+
* @param schema - The JSON Schema to bundle references for.
|
|
11
|
+
* @returns A new JSON Schema with all references bundled and rewritten to point to the bundled definitions.
|
|
12
|
+
*/
|
|
13
|
+
declare function bundleReferences(schema: JsonSchema): JsonSchema;
|
|
7
14
|
/**
|
|
8
15
|
* Creates a hash string for a given schema definition input.
|
|
9
16
|
*/
|
|
10
|
-
declare function extractHash
|
|
17
|
+
declare function extractHash(variant: SchemaInputVariant, input: SchemaInput): string;
|
|
11
18
|
/**
|
|
12
|
-
* Converts a reflected Deepkit {@link Type} into a JSON Schema (draft-
|
|
19
|
+
* Converts a reflected Deepkit {@link Type} into a JSON Schema (draft-2020-12) representation.
|
|
13
20
|
*/
|
|
14
|
-
declare function extractReflection
|
|
21
|
+
declare function extractReflection(reflection: Type): JsonSchema | undefined;
|
|
15
22
|
/**
|
|
16
23
|
* Extracts a JSON Schema from Zod, Standard Schema, Valibot, untyped, or JSON Schema inputs.
|
|
17
24
|
*/
|
|
18
|
-
declare function extractJsonSchema
|
|
25
|
+
declare function extractJsonSchema(schema: unknown): JsonSchema | undefined;
|
|
26
|
+
/**
|
|
27
|
+
* Resolves the concrete source variant for a schema source input.
|
|
28
|
+
*
|
|
29
|
+
* @param input - The schema source input to inspect.
|
|
30
|
+
* @returns The resolved schema source variant.
|
|
31
|
+
* @throws Will throw an error when the input cannot be mapped to a supported source variant.
|
|
32
|
+
*/
|
|
19
33
|
declare function extractResolvedVariant(input: SchemaSourceInput): SchemaSourceVariant;
|
|
20
|
-
|
|
34
|
+
/**
|
|
35
|
+
* Determines the top-level input variant for schema extraction.
|
|
36
|
+
*
|
|
37
|
+
* @param input - The schema input to classify.
|
|
38
|
+
* @returns The resolved schema input variant.
|
|
39
|
+
*/
|
|
40
|
+
declare function extractVariant(input: SchemaInput): SchemaInputVariant;
|
|
41
|
+
/**
|
|
42
|
+
* Extracts and normalizes a JSON Schema from a concrete schema source input.
|
|
43
|
+
*
|
|
44
|
+
* @param input - The schema source input to extract from.
|
|
45
|
+
* @param variant - Optional source variant override. When omitted, the variant is inferred from the input.
|
|
46
|
+
* @returns A promise that resolves to a bundled JSON Schema.
|
|
47
|
+
* @throws Will throw an error if no valid JSON Schema can be extracted from the input.
|
|
48
|
+
*/
|
|
49
|
+
declare function extractSchema(input: SchemaSourceInput, variant?: SchemaInputVariant): Promise<JsonSchema>;
|
|
50
|
+
/**
|
|
51
|
+
* Builds source metadata for a schema input using a known source variant.
|
|
52
|
+
*
|
|
53
|
+
* @param variant - The schema source variant associated with the input.
|
|
54
|
+
* @param input - The schema source input to wrap.
|
|
55
|
+
* @returns The normalized schema source payload, including the source hash and variant.
|
|
56
|
+
* @throws Will throw an error if the provided variant is unsupported.
|
|
57
|
+
*/
|
|
21
58
|
declare function extractSource(variant: SchemaSourceVariant, input: SchemaSourceInput): SchemaSource;
|
|
22
59
|
/**
|
|
23
|
-
* Extracts a JSON Schema from a given schema definition input, which can be a Zod schema, a Standard JSON Schema, a JSON Schema object, an untyped schema, or a
|
|
60
|
+
* 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.
|
|
24
61
|
*
|
|
25
62
|
* @example
|
|
26
63
|
* ```ts
|
|
@@ -34,20 +71,21 @@ declare function extractSource(variant: SchemaSourceVariant, input: SchemaSource
|
|
|
34
71
|
* const schema4 = await extract(context, reflectionType);
|
|
35
72
|
* ```
|
|
36
73
|
*
|
|
37
|
-
* @see https://
|
|
74
|
+
* @see https://zod.dev/
|
|
75
|
+
* @see https://valibot.dev/
|
|
38
76
|
* @see https://standardschema.dev/json-schema#what-schema-libraries-support-this-spec
|
|
39
77
|
* @see https://json-schema.org/
|
|
40
78
|
* @see https://ajv.js.org/json-type-definition.html
|
|
41
79
|
* @see https://deepkit.io/en/documentation/runtime-types/reflection
|
|
42
80
|
*
|
|
43
81
|
* @param context - The context object providing access to the file system and cache path.
|
|
44
|
-
* @param input - The schema definition input to extract, which can be a Zod schema, a Standard JSON Schema, a 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.
|
|
45
|
-
* @param options - Optional overrides for the
|
|
82
|
+
* @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.
|
|
83
|
+
* @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.
|
|
46
84
|
* @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.
|
|
47
85
|
*/
|
|
48
|
-
declare function
|
|
86
|
+
declare function extractSchemaWithSource(context: Context, input: SchemaInput, options?: Partial<BuildOptions>): Promise<ExtractedSchema>;
|
|
49
87
|
/**
|
|
50
|
-
* Extracts a JSON Schema from a given schema definition input, which can be a Zod schema, a Standard JSON Schema, a JSON Schema object, an untyped schema, or a
|
|
88
|
+
* 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.
|
|
51
89
|
*
|
|
52
90
|
* @example
|
|
53
91
|
* ```ts
|
|
@@ -61,7 +99,8 @@ declare function extractSchema<T = unknown>(context: Context, input: SchemaInput
|
|
|
61
99
|
* const schema4 = await extract(context, reflectionType);
|
|
62
100
|
* ```
|
|
63
101
|
*
|
|
64
|
-
* @see https://
|
|
102
|
+
* @see https://zod.dev/
|
|
103
|
+
* @see https://valibot.dev/
|
|
65
104
|
* @see https://standardschema.dev/json-schema#what-schema-libraries-support-this-spec
|
|
66
105
|
* @see https://json-schema.org/
|
|
67
106
|
* @see https://ajv.js.org/json-type-definition.html
|
|
@@ -70,12 +109,12 @@ declare function extractSchema<T = unknown>(context: Context, input: SchemaInput
|
|
|
70
109
|
* @see https://www.typescriptlang.org/docs/handbook/2/types-from-types.html
|
|
71
110
|
*
|
|
72
111
|
* @param context - The context object providing access to the file system and cache path.
|
|
73
|
-
* @param input - The schema definition input to extract, which can be a Zod schema, a Standard JSON Schema, a JSON Schema object, an untyped schema, or a reflected Deepkit Type object.
|
|
74
|
-
* @param options - Optional overrides for the
|
|
112
|
+
* @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.
|
|
113
|
+
* @param options - Optional overrides for the Rolldown configuration used during extraction.
|
|
75
114
|
* @returns A promise that resolves to the extracted and normalized schema as a JSON Schema object.
|
|
76
115
|
* @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.
|
|
77
116
|
*/
|
|
78
|
-
declare function extract
|
|
117
|
+
declare function extract(context: Context, input: SchemaInput, options?: Partial<BuildOptions>): Promise<Schema>;
|
|
79
118
|
//#endregion
|
|
80
|
-
export { extract, extractHash, extractJsonSchema, extractReflection, extractResolvedVariant, extractSchema, extractSource, extractVariant };
|
|
119
|
+
export { bundleReferences, extract, extractHash, extractJsonSchema, extractReflection, extractResolvedVariant, extractSchema, extractSchemaWithSource, extractSource, extractVariant };
|
|
81
120
|
//# sourceMappingURL=extract.d.cts.map
|
package/dist/extract.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extract.d.cts","names":[],"sources":["../src/extract.ts"],"mappings":";;;;;;;;
|
|
1
|
+
{"version":3,"file":"extract.d.cts","names":[],"sources":["../src/extract.ts"],"mappings":";;;;;;;;AAuOA;;;;iBAAgB,gBAAA,CAAiB,MAAA,EAAQ,UAAA,GAAa,UAAU;;;;iBAgMhD,WAAA,CACd,OAAA,EAAS,kBAAA,EACT,KAAA,EAAO,WAAW;AAFpB;;;AAAA,iBA2CgB,iBAAA,CAAkB,UAAA,EAAY,IAAA,GAAO,UAAU;;;;iBAW/C,iBAAA,CAAkB,MAAA,YAAkB,UAAU;;AApD1C;AAyCpB;;;;;iBA6CgB,sBAAA,CACd,KAAA,EAAO,iBAAA,GACN,mBAAmB;;;AA/CyC;AAW/D;;;iBAoEgB,cAAA,CAAe,KAAA,EAAO,WAAA,GAAc,kBAAkB;AApER;AAkC9D;;;;;;;AAlC8D,iBAoFxC,aAAA,CACpB,KAAA,EAAO,iBAAA,EACP,OAAA,GAAU,kBAAA,GACT,OAAA,CAAQ,UAAA;AAnDW;AAgCtB;;;;;;;AAhCsB,iBAwFN,aAAA,CACd,OAAA,EAAS,mBAAA,EACT,KAAA,EAAO,iBAAA,GACN,YAAA;AA3DmE;AAgBtE;;;;;;;;;;;;;;;;AAGqB;AAqCrB;;;;;;;;;AAxDsE,iBAkIhD,uBAAA,CACpB,OAAA,EAAS,OAAA,EACT,KAAA,EAAO,WAAA,EACP,OAAA,GAAS,OAAA,CAAQ,YAAA,IAChB,OAAA,CAAQ,eAAA;;;;;AA3EI;AAuEf;;;;;;;;;;;;;;;;;;;;;AAI0B;AA6F1B;;;iBAAsB,OAAA,CACpB,OAAA,EAAS,OAAA,EACT,KAAA,EAAO,WAAA,EACP,OAAA,GAAS,OAAA,CAAQ,YAAA,IAChB,OAAA,CAAQ,MAAA"}
|
package/dist/extract.d.mts
CHANGED
|
@@ -4,23 +4,60 @@ import { Context } from "@powerlines/core";
|
|
|
4
4
|
import { Type } from "@powerlines/deepkit/vendor/type";
|
|
5
5
|
|
|
6
6
|
//#region src/extract.d.ts
|
|
7
|
+
/**
|
|
8
|
+
* 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.
|
|
9
|
+
*
|
|
10
|
+
* @param schema - The JSON Schema to bundle references for.
|
|
11
|
+
* @returns A new JSON Schema with all references bundled and rewritten to point to the bundled definitions.
|
|
12
|
+
*/
|
|
13
|
+
declare function bundleReferences(schema: JsonSchema): JsonSchema;
|
|
7
14
|
/**
|
|
8
15
|
* Creates a hash string for a given schema definition input.
|
|
9
16
|
*/
|
|
10
|
-
declare function extractHash
|
|
17
|
+
declare function extractHash(variant: SchemaInputVariant, input: SchemaInput): string;
|
|
11
18
|
/**
|
|
12
|
-
* Converts a reflected Deepkit {@link Type} into a JSON Schema (draft-
|
|
19
|
+
* Converts a reflected Deepkit {@link Type} into a JSON Schema (draft-2020-12) representation.
|
|
13
20
|
*/
|
|
14
|
-
declare function extractReflection
|
|
21
|
+
declare function extractReflection(reflection: Type): JsonSchema | undefined;
|
|
15
22
|
/**
|
|
16
23
|
* Extracts a JSON Schema from Zod, Standard Schema, Valibot, untyped, or JSON Schema inputs.
|
|
17
24
|
*/
|
|
18
|
-
declare function extractJsonSchema
|
|
25
|
+
declare function extractJsonSchema(schema: unknown): JsonSchema | undefined;
|
|
26
|
+
/**
|
|
27
|
+
* Resolves the concrete source variant for a schema source input.
|
|
28
|
+
*
|
|
29
|
+
* @param input - The schema source input to inspect.
|
|
30
|
+
* @returns The resolved schema source variant.
|
|
31
|
+
* @throws Will throw an error when the input cannot be mapped to a supported source variant.
|
|
32
|
+
*/
|
|
19
33
|
declare function extractResolvedVariant(input: SchemaSourceInput): SchemaSourceVariant;
|
|
20
|
-
|
|
34
|
+
/**
|
|
35
|
+
* Determines the top-level input variant for schema extraction.
|
|
36
|
+
*
|
|
37
|
+
* @param input - The schema input to classify.
|
|
38
|
+
* @returns The resolved schema input variant.
|
|
39
|
+
*/
|
|
40
|
+
declare function extractVariant(input: SchemaInput): SchemaInputVariant;
|
|
41
|
+
/**
|
|
42
|
+
* Extracts and normalizes a JSON Schema from a concrete schema source input.
|
|
43
|
+
*
|
|
44
|
+
* @param input - The schema source input to extract from.
|
|
45
|
+
* @param variant - Optional source variant override. When omitted, the variant is inferred from the input.
|
|
46
|
+
* @returns A promise that resolves to a bundled JSON Schema.
|
|
47
|
+
* @throws Will throw an error if no valid JSON Schema can be extracted from the input.
|
|
48
|
+
*/
|
|
49
|
+
declare function extractSchema(input: SchemaSourceInput, variant?: SchemaInputVariant): Promise<JsonSchema>;
|
|
50
|
+
/**
|
|
51
|
+
* Builds source metadata for a schema input using a known source variant.
|
|
52
|
+
*
|
|
53
|
+
* @param variant - The schema source variant associated with the input.
|
|
54
|
+
* @param input - The schema source input to wrap.
|
|
55
|
+
* @returns The normalized schema source payload, including the source hash and variant.
|
|
56
|
+
* @throws Will throw an error if the provided variant is unsupported.
|
|
57
|
+
*/
|
|
21
58
|
declare function extractSource(variant: SchemaSourceVariant, input: SchemaSourceInput): SchemaSource;
|
|
22
59
|
/**
|
|
23
|
-
* Extracts a JSON Schema from a given schema definition input, which can be a Zod schema, a Standard JSON Schema, a JSON Schema object, an untyped schema, or a
|
|
60
|
+
* 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.
|
|
24
61
|
*
|
|
25
62
|
* @example
|
|
26
63
|
* ```ts
|
|
@@ -34,20 +71,21 @@ declare function extractSource(variant: SchemaSourceVariant, input: SchemaSource
|
|
|
34
71
|
* const schema4 = await extract(context, reflectionType);
|
|
35
72
|
* ```
|
|
36
73
|
*
|
|
37
|
-
* @see https://
|
|
74
|
+
* @see https://zod.dev/
|
|
75
|
+
* @see https://valibot.dev/
|
|
38
76
|
* @see https://standardschema.dev/json-schema#what-schema-libraries-support-this-spec
|
|
39
77
|
* @see https://json-schema.org/
|
|
40
78
|
* @see https://ajv.js.org/json-type-definition.html
|
|
41
79
|
* @see https://deepkit.io/en/documentation/runtime-types/reflection
|
|
42
80
|
*
|
|
43
81
|
* @param context - The context object providing access to the file system and cache path.
|
|
44
|
-
* @param input - The schema definition input to extract, which can be a Zod schema, a Standard JSON Schema, a 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.
|
|
45
|
-
* @param options - Optional overrides for the
|
|
82
|
+
* @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.
|
|
83
|
+
* @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.
|
|
46
84
|
* @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.
|
|
47
85
|
*/
|
|
48
|
-
declare function
|
|
86
|
+
declare function extractSchemaWithSource(context: Context, input: SchemaInput, options?: Partial<BuildOptions>): Promise<ExtractedSchema>;
|
|
49
87
|
/**
|
|
50
|
-
* Extracts a JSON Schema from a given schema definition input, which can be a Zod schema, a Standard JSON Schema, a JSON Schema object, an untyped schema, or a
|
|
88
|
+
* 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.
|
|
51
89
|
*
|
|
52
90
|
* @example
|
|
53
91
|
* ```ts
|
|
@@ -61,7 +99,8 @@ declare function extractSchema<T = unknown>(context: Context, input: SchemaInput
|
|
|
61
99
|
* const schema4 = await extract(context, reflectionType);
|
|
62
100
|
* ```
|
|
63
101
|
*
|
|
64
|
-
* @see https://
|
|
102
|
+
* @see https://zod.dev/
|
|
103
|
+
* @see https://valibot.dev/
|
|
65
104
|
* @see https://standardschema.dev/json-schema#what-schema-libraries-support-this-spec
|
|
66
105
|
* @see https://json-schema.org/
|
|
67
106
|
* @see https://ajv.js.org/json-type-definition.html
|
|
@@ -70,12 +109,12 @@ declare function extractSchema<T = unknown>(context: Context, input: SchemaInput
|
|
|
70
109
|
* @see https://www.typescriptlang.org/docs/handbook/2/types-from-types.html
|
|
71
110
|
*
|
|
72
111
|
* @param context - The context object providing access to the file system and cache path.
|
|
73
|
-
* @param input - The schema definition input to extract, which can be a Zod schema, a Standard JSON Schema, a JSON Schema object, an untyped schema, or a reflected Deepkit Type object.
|
|
74
|
-
* @param options - Optional overrides for the
|
|
112
|
+
* @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.
|
|
113
|
+
* @param options - Optional overrides for the Rolldown configuration used during extraction.
|
|
75
114
|
* @returns A promise that resolves to the extracted and normalized schema as a JSON Schema object.
|
|
76
115
|
* @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.
|
|
77
116
|
*/
|
|
78
|
-
declare function extract
|
|
117
|
+
declare function extract(context: Context, input: SchemaInput, options?: Partial<BuildOptions>): Promise<Schema>;
|
|
79
118
|
//#endregion
|
|
80
|
-
export { extract, extractHash, extractJsonSchema, extractReflection, extractResolvedVariant, extractSchema, extractSource, extractVariant };
|
|
119
|
+
export { bundleReferences, extract, extractHash, extractJsonSchema, extractReflection, extractResolvedVariant, extractSchema, extractSchemaWithSource, extractSource, extractVariant };
|
|
81
120
|
//# sourceMappingURL=extract.d.mts.map
|
package/dist/extract.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extract.d.mts","names":[],"sources":["../src/extract.ts"],"mappings":";;;;;;;;
|
|
1
|
+
{"version":3,"file":"extract.d.mts","names":[],"sources":["../src/extract.ts"],"mappings":";;;;;;;;AAuOA;;;;iBAAgB,gBAAA,CAAiB,MAAA,EAAQ,UAAA,GAAa,UAAU;;;;iBAgMhD,WAAA,CACd,OAAA,EAAS,kBAAA,EACT,KAAA,EAAO,WAAW;AAFpB;;;AAAA,iBA2CgB,iBAAA,CAAkB,UAAA,EAAY,IAAA,GAAO,UAAU;;;;iBAW/C,iBAAA,CAAkB,MAAA,YAAkB,UAAU;;AApD1C;AAyCpB;;;;;iBA6CgB,sBAAA,CACd,KAAA,EAAO,iBAAA,GACN,mBAAmB;;;AA/CyC;AAW/D;;;iBAoEgB,cAAA,CAAe,KAAA,EAAO,WAAA,GAAc,kBAAkB;AApER;AAkC9D;;;;;;;AAlC8D,iBAoFxC,aAAA,CACpB,KAAA,EAAO,iBAAA,EACP,OAAA,GAAU,kBAAA,GACT,OAAA,CAAQ,UAAA;AAnDW;AAgCtB;;;;;;;AAhCsB,iBAwFN,aAAA,CACd,OAAA,EAAS,mBAAA,EACT,KAAA,EAAO,iBAAA,GACN,YAAA;AA3DmE;AAgBtE;;;;;;;;;;;;;;;;AAGqB;AAqCrB;;;;;;;;;AAxDsE,iBAkIhD,uBAAA,CACpB,OAAA,EAAS,OAAA,EACT,KAAA,EAAO,WAAA,EACP,OAAA,GAAS,OAAA,CAAQ,YAAA,IAChB,OAAA,CAAQ,eAAA;;;;;AA3EI;AAuEf;;;;;;;;;;;;;;;;;;;;;AAI0B;AA6F1B;;;iBAAsB,OAAA,CACpB,OAAA,EAAS,OAAA,EACT,KAAA,EAAO,WAAA,EACP,OAAA,GAAS,OAAA,CAAQ,YAAA,IAChB,OAAA,CAAQ,MAAA"}
|