@formspec/build 0.1.0-alpha.15 → 0.1.0-alpha.17
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/__tests__/fixtures/edge-cases.d.ts +11 -0
- package/dist/__tests__/fixtures/edge-cases.d.ts.map +1 -1
- package/dist/__tests__/fixtures/example-numeric-extension.d.ts +20 -0
- package/dist/__tests__/fixtures/example-numeric-extension.d.ts.map +1 -0
- package/dist/__tests__/fixtures/mixed-authoring-shipping-address.d.ts +31 -0
- package/dist/__tests__/fixtures/mixed-authoring-shipping-address.d.ts.map +1 -0
- package/dist/__tests__/mixed-authoring.test.d.ts +2 -0
- package/dist/__tests__/mixed-authoring.test.d.ts.map +1 -0
- package/dist/__tests__/numeric-extension.integration.test.d.ts +2 -0
- package/dist/__tests__/numeric-extension.integration.test.d.ts.map +1 -0
- package/dist/__tests__/parity/utils.d.ts +5 -3
- package/dist/__tests__/parity/utils.d.ts.map +1 -1
- package/dist/analyzer/class-analyzer.d.ts +8 -5
- package/dist/analyzer/class-analyzer.d.ts.map +1 -1
- package/dist/analyzer/jsdoc-constraints.d.ts +3 -2
- package/dist/analyzer/jsdoc-constraints.d.ts.map +1 -1
- package/dist/analyzer/tsdoc-parser.d.ts +38 -4
- package/dist/analyzer/tsdoc-parser.d.ts.map +1 -1
- package/dist/browser.cjs +371 -21
- package/dist/browser.cjs.map +1 -1
- package/dist/browser.d.ts.map +1 -1
- package/dist/browser.js +371 -21
- package/dist/browser.js.map +1 -1
- package/dist/build.d.ts +67 -3
- package/dist/canonicalize/tsdoc-canonicalizer.d.ts.map +1 -1
- package/dist/cli.cjs +1159 -150
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +1159 -150
- package/dist/cli.js.map +1 -1
- package/dist/extensions/registry.d.ts +25 -1
- package/dist/extensions/registry.d.ts.map +1 -1
- package/dist/generators/class-schema.d.ts +4 -4
- package/dist/generators/class-schema.d.ts.map +1 -1
- package/dist/generators/mixed-authoring.d.ts +45 -0
- package/dist/generators/mixed-authoring.d.ts.map +1 -0
- package/dist/index.cjs +1146 -149
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1145 -149
- package/dist/index.js.map +1 -1
- package/dist/internals.cjs +1156 -149
- package/dist/internals.cjs.map +1 -1
- package/dist/internals.js +1154 -147
- package/dist/internals.js.map +1 -1
- package/dist/json-schema/ir-generator.d.ts +3 -2
- package/dist/json-schema/ir-generator.d.ts.map +1 -1
- package/dist/ui-schema/ir-generator.d.ts.map +1 -1
- package/dist/validate/constraint-validator.d.ts.map +1 -1
- package/package.json +3 -3
- package/dist/__tests__/jsdoc-constraints.test.d.ts +0 -9
- package/dist/__tests__/jsdoc-constraints.test.d.ts.map +0 -1
package/dist/build.d.ts
CHANGED
|
@@ -23,6 +23,8 @@
|
|
|
23
23
|
* @packageDocumentation
|
|
24
24
|
*/
|
|
25
25
|
|
|
26
|
+
import type { BuiltinConstraintBroadeningRegistration } from '@formspec/core';
|
|
27
|
+
import type { ConstraintTagRegistration } from '@formspec/core';
|
|
26
28
|
import type { CustomAnnotationRegistration } from '@formspec/core';
|
|
27
29
|
import type { CustomConstraintRegistration } from '@formspec/core';
|
|
28
30
|
import type { CustomTypeRegistration } from '@formspec/core';
|
|
@@ -30,6 +32,7 @@ import type { ExtensionDefinition } from '@formspec/core';
|
|
|
30
32
|
import type { FormElement } from '@formspec/core';
|
|
31
33
|
import type { FormIR } from '@formspec/core';
|
|
32
34
|
import type { FormSpec } from '@formspec/core';
|
|
35
|
+
import type { JsonValue } from '@formspec/core';
|
|
33
36
|
import { z } from 'zod';
|
|
34
37
|
|
|
35
38
|
/**
|
|
@@ -69,6 +72,32 @@ export declare function buildFormSchemas<E extends readonly FormElement[]>(form:
|
|
|
69
72
|
*/
|
|
70
73
|
export declare type BuildFormSchemasOptions = GenerateJsonSchemaOptions;
|
|
71
74
|
|
|
75
|
+
/**
|
|
76
|
+
* Builds JSON Schema and UI Schema from a TSDoc-derived model with ChainDSL
|
|
77
|
+
* field overlays.
|
|
78
|
+
*
|
|
79
|
+
* Overlays are matched by field name. The static model wins for structure,
|
|
80
|
+
* ordering, and constraints; ChainDSL overlays may contribute dynamic runtime
|
|
81
|
+
* field metadata such as dynamic enum or dynamic schema keywords, and may fill
|
|
82
|
+
* in missing annotations.
|
|
83
|
+
*/
|
|
84
|
+
export declare function buildMixedAuthoringSchemas(options: BuildMixedAuthoringSchemasOptions): MixedAuthoringSchemas;
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Options for generating mixed-authoring schemas.
|
|
88
|
+
*
|
|
89
|
+
* The `typeName` can resolve to a class, interface, or object type alias, just
|
|
90
|
+
* like `generateSchemas()`.
|
|
91
|
+
*/
|
|
92
|
+
export declare interface BuildMixedAuthoringSchemasOptions extends GenerateJsonSchemaFromIROptions {
|
|
93
|
+
/** Path to the TypeScript source file. */
|
|
94
|
+
readonly filePath: string;
|
|
95
|
+
/** Name of the class, interface, or type alias to analyze. */
|
|
96
|
+
readonly typeName: string;
|
|
97
|
+
/** ChainDSL overlays to apply to the static model. Groups and conditionals are flattened by field name. */
|
|
98
|
+
readonly overlays: FormSpec<readonly FormElement[]>;
|
|
99
|
+
}
|
|
100
|
+
|
|
72
101
|
/**
|
|
73
102
|
* Result of building form schemas.
|
|
74
103
|
*/
|
|
@@ -250,6 +279,16 @@ export declare interface ExtensionRegistry {
|
|
|
250
279
|
* @returns The registration if found, otherwise `undefined`.
|
|
251
280
|
*/
|
|
252
281
|
findType(typeId: string): CustomTypeRegistration | undefined;
|
|
282
|
+
/**
|
|
283
|
+
* Look up a custom type registration by a TypeScript-facing type name.
|
|
284
|
+
*
|
|
285
|
+
* This is used during TSDoc/class analysis to resolve extension-defined
|
|
286
|
+
* custom types from source-level declarations.
|
|
287
|
+
*/
|
|
288
|
+
findTypeByName(typeName: string): {
|
|
289
|
+
readonly extensionId: string;
|
|
290
|
+
readonly registration: CustomTypeRegistration;
|
|
291
|
+
} | undefined;
|
|
253
292
|
/**
|
|
254
293
|
* Look up a custom constraint registration by its fully-qualified constraint ID.
|
|
255
294
|
*
|
|
@@ -257,6 +296,20 @@ export declare interface ExtensionRegistry {
|
|
|
257
296
|
* @returns The registration if found, otherwise `undefined`.
|
|
258
297
|
*/
|
|
259
298
|
findConstraint(constraintId: string): CustomConstraintRegistration | undefined;
|
|
299
|
+
/**
|
|
300
|
+
* Look up a TSDoc custom constraint-tag registration by tag name.
|
|
301
|
+
*/
|
|
302
|
+
findConstraintTag(tagName: string): {
|
|
303
|
+
readonly extensionId: string;
|
|
304
|
+
readonly registration: ConstraintTagRegistration;
|
|
305
|
+
} | undefined;
|
|
306
|
+
/**
|
|
307
|
+
* Look up built-in tag broadening for a given custom type ID.
|
|
308
|
+
*/
|
|
309
|
+
findBuiltinConstraintBroadening(typeId: string, tagName: string): {
|
|
310
|
+
readonly extensionId: string;
|
|
311
|
+
readonly registration: BuiltinConstraintBroadeningRegistration;
|
|
312
|
+
} | undefined;
|
|
260
313
|
/**
|
|
261
314
|
* Look up a custom annotation registration by its fully-qualified annotation ID.
|
|
262
315
|
*
|
|
@@ -272,7 +325,7 @@ export declare type FormSpecSchemaExtensions = Record<`x-formspec-${string}`, un
|
|
|
272
325
|
/**
|
|
273
326
|
* Options for generating schemas from a decorated class.
|
|
274
327
|
*/
|
|
275
|
-
export declare interface GenerateFromClassOptions {
|
|
328
|
+
export declare interface GenerateFromClassOptions extends GenerateJsonSchemaFromIROptions {
|
|
276
329
|
/** Path to the TypeScript source file */
|
|
277
330
|
filePath: string;
|
|
278
331
|
/** Class name to analyze */
|
|
@@ -431,7 +484,7 @@ export declare function generateSchemasFromClass(options: GenerateFromClassOptio
|
|
|
431
484
|
/**
|
|
432
485
|
* Options for generating schemas from a named type (class, interface, or type alias).
|
|
433
486
|
*/
|
|
434
|
-
export declare interface GenerateSchemasOptions {
|
|
487
|
+
export declare interface GenerateSchemasOptions extends GenerateJsonSchemaFromIROptions {
|
|
435
488
|
/** Path to the TypeScript source file */
|
|
436
489
|
filePath: string;
|
|
437
490
|
/** Name of the exported class, interface, or type alias to analyze */
|
|
@@ -538,7 +591,7 @@ export declare interface JsonSchema2020 {
|
|
|
538
591
|
items?: JsonSchema2020;
|
|
539
592
|
additionalProperties?: boolean | JsonSchema2020;
|
|
540
593
|
enum?: readonly (string | number)[];
|
|
541
|
-
const?:
|
|
594
|
+
const?: JsonValue;
|
|
542
595
|
allOf?: readonly JsonSchema2020[];
|
|
543
596
|
oneOf?: readonly JsonSchema2020[];
|
|
544
597
|
anyOf?: readonly JsonSchema2020[];
|
|
@@ -553,6 +606,7 @@ export declare interface JsonSchema2020 {
|
|
|
553
606
|
maxItems?: number;
|
|
554
607
|
pattern?: string;
|
|
555
608
|
uniqueItems?: boolean;
|
|
609
|
+
format?: string;
|
|
556
610
|
title?: string;
|
|
557
611
|
description?: string;
|
|
558
612
|
default?: unknown;
|
|
@@ -726,6 +780,16 @@ export declare const labelElementSchema: z.ZodObject<{
|
|
|
726
780
|
options: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
727
781
|
}, z.ZodTypeAny, "passthrough">>;
|
|
728
782
|
|
|
783
|
+
/**
|
|
784
|
+
* Result of generating schemas from a mixed-authoring composition.
|
|
785
|
+
*/
|
|
786
|
+
export declare interface MixedAuthoringSchemas {
|
|
787
|
+
/** JSON Schema 2020-12 for validation. */
|
|
788
|
+
readonly jsonSchema: JsonSchema2020;
|
|
789
|
+
/** JSON Forms UI Schema for rendering. */
|
|
790
|
+
readonly uiSchema: UISchema;
|
|
791
|
+
}
|
|
792
|
+
|
|
729
793
|
/**
|
|
730
794
|
* Rule for conditional element visibility/enablement.
|
|
731
795
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tsdoc-canonicalizer.d.ts","sourceRoot":"","sources":["../../src/canonicalize/tsdoc-canonicalizer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EACV,MAAM,EAMP,MAAM,gBAAgB,CAAC;AAExB,OAAO,KAAK,EAAE,eAAe,EAAuB,MAAM,+BAA+B,CAAC;AAE1F;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,wCAAwC;IACxC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,eAAe,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"tsdoc-canonicalizer.d.ts","sourceRoot":"","sources":["../../src/canonicalize/tsdoc-canonicalizer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EACV,MAAM,EAMP,MAAM,gBAAgB,CAAC;AAExB,OAAO,KAAK,EAAE,eAAe,EAAuB,MAAM,+BAA+B,CAAC;AAE1F;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,wCAAwC;IACxC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,eAAe,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,MAAM,CAqBzF"}
|