@formspec/build 0.1.0-alpha.26 → 0.1.0-alpha.28
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/LICENSE +21 -0
- package/README.md +3 -2
- package/dist/analyzer/class-analyzer.d.ts +1 -1
- package/dist/analyzer/class-analyzer.d.ts.map +1 -1
- package/dist/analyzer/program.d.ts +12 -0
- package/dist/analyzer/program.d.ts.map +1 -1
- package/dist/browser.cjs.map +1 -1
- package/dist/browser.d.ts +1 -0
- package/dist/browser.d.ts.map +1 -1
- package/dist/browser.js.map +1 -1
- package/dist/build-alpha.d.ts +48 -22
- package/dist/build-beta.d.ts +48 -22
- package/dist/build-internal.d.ts +48 -22
- package/dist/build.d.ts +151 -21
- package/dist/cli.cjs +609 -41
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +605 -36
- package/dist/cli.js.map +1 -1
- package/dist/generators/class-schema.d.ts +27 -0
- package/dist/generators/class-schema.d.ts.map +1 -1
- package/dist/generators/method-schema.d.ts.map +1 -1
- package/dist/generators/mixed-authoring.d.ts.map +1 -1
- package/dist/index.cjs +603 -39
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +5 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +599 -36
- package/dist/index.js.map +1 -1
- package/dist/internals.cjs +552 -34
- package/dist/internals.cjs.map +1 -1
- package/dist/internals.d.ts +1 -1
- package/dist/internals.d.ts.map +1 -1
- package/dist/internals.js +549 -31
- package/dist/internals.js.map +1 -1
- package/dist/json-schema/schema.d.ts +2 -2
- package/dist/json-schema/types.d.ts +4 -4
- package/dist/ui-schema/schema.d.ts +2 -7
- package/dist/ui-schema/schema.d.ts.map +1 -1
- package/package.json +7 -6
package/dist/build-alpha.d.ts
CHANGED
|
@@ -27,9 +27,7 @@ import { AnyField } from '@formspec/core';
|
|
|
27
27
|
import { ArrayField } from '@formspec/core';
|
|
28
28
|
import { BooleanField } from '@formspec/core';
|
|
29
29
|
import { BuiltinConstraintBroadeningRegistration } from '@formspec/core';
|
|
30
|
-
import { BuiltinConstraintName } from '@formspec/core';
|
|
31
30
|
import { Conditional } from '@formspec/core';
|
|
32
|
-
import { ConstraintSemanticRole } from '@formspec/core';
|
|
33
31
|
import { ConstraintTagRegistration } from '@formspec/core';
|
|
34
32
|
import { CustomAnnotationRegistration } from '@formspec/core';
|
|
35
33
|
import { CustomConstraintRegistration } from '@formspec/core';
|
|
@@ -38,10 +36,7 @@ import { DynamicEnumField } from '@formspec/core';
|
|
|
38
36
|
import { DynamicSchemaField } from '@formspec/core';
|
|
39
37
|
import { EnumOption } from '@formspec/core';
|
|
40
38
|
import { EnumOptionValue } from '@formspec/core';
|
|
41
|
-
import { ExtensionApplicableType } from '@formspec/core';
|
|
42
39
|
import { ExtensionDefinition } from '@formspec/core';
|
|
43
|
-
import { ExtensionPayloadValue } from '@formspec/core';
|
|
44
|
-
import { ExtensionTypeKind } from '@formspec/core';
|
|
45
40
|
import { FormElement } from '@formspec/core';
|
|
46
41
|
import { FormSpec } from '@formspec/core';
|
|
47
42
|
import { Group } from '@formspec/core';
|
|
@@ -49,7 +44,8 @@ import { NumberField } from '@formspec/core';
|
|
|
49
44
|
import { ObjectField } from '@formspec/core';
|
|
50
45
|
import { StaticEnumField } from '@formspec/core';
|
|
51
46
|
import { TextField } from '@formspec/core';
|
|
52
|
-
import
|
|
47
|
+
import * as ts from 'typescript';
|
|
48
|
+
import { z } from 'zod';
|
|
53
49
|
|
|
54
50
|
export { AnyField }
|
|
55
51
|
|
|
@@ -142,8 +138,6 @@ export declare interface BuildResult {
|
|
|
142
138
|
|
|
143
139
|
export { BuiltinConstraintBroadeningRegistration }
|
|
144
140
|
|
|
145
|
-
export { BuiltinConstraintName }
|
|
146
|
-
|
|
147
141
|
/**
|
|
148
142
|
* A Categorization element (tab-based layout).
|
|
149
143
|
*
|
|
@@ -186,8 +180,6 @@ export declare interface Category {
|
|
|
186
180
|
|
|
187
181
|
export { Conditional }
|
|
188
182
|
|
|
189
|
-
export { ConstraintSemanticRole }
|
|
190
|
-
|
|
191
183
|
export { ConstraintTagRegistration }
|
|
192
184
|
|
|
193
185
|
/**
|
|
@@ -242,16 +234,12 @@ export { EnumOptionValue }
|
|
|
242
234
|
/**
|
|
243
235
|
* JSON Schema with FormSpec extension properties for arbitrary `x-formspec-*` keys.
|
|
244
236
|
*
|
|
245
|
-
* @
|
|
237
|
+
* @public
|
|
246
238
|
*/
|
|
247
239
|
export declare type ExtendedJSONSchema7 = JSONSchema7 & FormSpecSchemaExtensions;
|
|
248
240
|
|
|
249
|
-
export { ExtensionApplicableType }
|
|
250
|
-
|
|
251
241
|
export { ExtensionDefinition }
|
|
252
242
|
|
|
253
|
-
export { ExtensionPayloadValue }
|
|
254
|
-
|
|
255
243
|
/**
|
|
256
244
|
* A registry of extensions that provides lookup by fully-qualified ID.
|
|
257
245
|
*
|
|
@@ -311,8 +299,6 @@ export declare interface ExtensionRegistry {
|
|
|
311
299
|
findAnnotation(annotationId: string): CustomAnnotationRegistration | undefined;
|
|
312
300
|
}
|
|
313
301
|
|
|
314
|
-
export { ExtensionTypeKind }
|
|
315
|
-
|
|
316
302
|
export { FormElement }
|
|
317
303
|
|
|
318
304
|
export { FormSpec }
|
|
@@ -320,7 +306,7 @@ export { FormSpec }
|
|
|
320
306
|
/**
|
|
321
307
|
* Extension properties for custom FormSpec constraint tags.
|
|
322
308
|
*
|
|
323
|
-
* @
|
|
309
|
+
* @public
|
|
324
310
|
*/
|
|
325
311
|
export declare type FormSpecSchemaExtensions = Record<`x-formspec-${string}`, unknown>;
|
|
326
312
|
|
|
@@ -439,6 +425,34 @@ export declare function generateSchemas(options: GenerateSchemasOptions): Genera
|
|
|
439
425
|
*/
|
|
440
426
|
export declare function generateSchemasFromClass(options: GenerateFromClassOptions): GenerateFromClassResult;
|
|
441
427
|
|
|
428
|
+
/**
|
|
429
|
+
* Generates JSON Schema and UI Schema from a named type within an existing
|
|
430
|
+
* TypeScript program supplied by the caller.
|
|
431
|
+
*
|
|
432
|
+
* This low-level entry point lets downstream tooling reuse a host-owned
|
|
433
|
+
* `Program` for both FormSpec extraction and other TypeScript analysis.
|
|
434
|
+
*
|
|
435
|
+
* @param options - Host program, file path, type name, and optional schema generation options
|
|
436
|
+
* @returns Generated JSON Schema and UI Schema
|
|
437
|
+
*
|
|
438
|
+
* @public
|
|
439
|
+
*/
|
|
440
|
+
export declare function generateSchemasFromProgram(options: GenerateSchemasFromProgramOptions): GenerateFromClassResult;
|
|
441
|
+
|
|
442
|
+
/**
|
|
443
|
+
* Options for generating schemas from a named type inside an existing TypeScript program.
|
|
444
|
+
*
|
|
445
|
+
* @public
|
|
446
|
+
*/
|
|
447
|
+
export declare interface GenerateSchemasFromProgramOptions extends StaticSchemaGenerationOptions {
|
|
448
|
+
/** Existing TypeScript program supplied by the caller. */
|
|
449
|
+
readonly program: ts.Program;
|
|
450
|
+
/** Path to the TypeScript source file */
|
|
451
|
+
readonly filePath: string;
|
|
452
|
+
/** Name of the exported class, interface, or type alias to analyze */
|
|
453
|
+
readonly typeName: string;
|
|
454
|
+
}
|
|
455
|
+
|
|
442
456
|
/**
|
|
443
457
|
* Options for generating schemas from a named type (class, interface, or type alias).
|
|
444
458
|
*
|
|
@@ -613,7 +627,7 @@ export declare interface JsonSchema2020 {
|
|
|
613
627
|
/**
|
|
614
628
|
* A JSON Schema definition (legacy subset used by Zod validator and types.ts).
|
|
615
629
|
*
|
|
616
|
-
* @
|
|
630
|
+
* @public
|
|
617
631
|
*/
|
|
618
632
|
export declare interface JSONSchema7 {
|
|
619
633
|
/** Declared JSON Schema dialect URI for the document root. */
|
|
@@ -695,6 +709,13 @@ export declare interface JSONSchema7 {
|
|
|
695
709
|
"x-formspec-schemaSource"?: string;
|
|
696
710
|
}
|
|
697
711
|
|
|
712
|
+
/**
|
|
713
|
+
* Zod schema for the legacy JSON Schema 7 subset used by `@formspec/build`.
|
|
714
|
+
*
|
|
715
|
+
* @public
|
|
716
|
+
*/
|
|
717
|
+
export declare const jsonSchema7Schema: z.ZodType<JSONSchema7>;
|
|
718
|
+
|
|
698
719
|
/**
|
|
699
720
|
* JSON Schema type definitions.
|
|
700
721
|
*
|
|
@@ -703,7 +724,7 @@ export declare interface JSONSchema7 {
|
|
|
703
724
|
/**
|
|
704
725
|
* JSON Schema primitive types.
|
|
705
726
|
*
|
|
706
|
-
* @
|
|
727
|
+
* @public
|
|
707
728
|
*/
|
|
708
729
|
export declare type JSONSchemaType = "string" | "number" | "integer" | "boolean" | "object" | "array" | "null";
|
|
709
730
|
|
|
@@ -873,6 +894,13 @@ export declare interface UISchemaElementBase {
|
|
|
873
894
|
*/
|
|
874
895
|
export declare type UISchemaElementType = "Control" | "VerticalLayout" | "HorizontalLayout" | "Group" | "Categorization" | "Category" | "Label";
|
|
875
896
|
|
|
897
|
+
/**
|
|
898
|
+
* Zod schema for the root UI Schema (layout types only).
|
|
899
|
+
*
|
|
900
|
+
* @public
|
|
901
|
+
*/
|
|
902
|
+
export declare const uiSchemaSchema: z.ZodType<UISchema>;
|
|
903
|
+
|
|
876
904
|
/**
|
|
877
905
|
* A vertical layout element.
|
|
878
906
|
*
|
|
@@ -891,8 +919,6 @@ export declare interface VerticalLayout {
|
|
|
891
919
|
readonly [k: string]: unknown;
|
|
892
920
|
}
|
|
893
921
|
|
|
894
|
-
export { VocabularyKeywordRegistration }
|
|
895
|
-
|
|
896
922
|
/**
|
|
897
923
|
* Builds and writes both JSON Schema and UI Schema files to disk.
|
|
898
924
|
*
|
package/dist/build-beta.d.ts
CHANGED
|
@@ -27,9 +27,7 @@ import { AnyField } from '@formspec/core';
|
|
|
27
27
|
import { ArrayField } from '@formspec/core';
|
|
28
28
|
import { BooleanField } from '@formspec/core';
|
|
29
29
|
import { BuiltinConstraintBroadeningRegistration } from '@formspec/core';
|
|
30
|
-
import { BuiltinConstraintName } from '@formspec/core';
|
|
31
30
|
import { Conditional } from '@formspec/core';
|
|
32
|
-
import { ConstraintSemanticRole } from '@formspec/core';
|
|
33
31
|
import { ConstraintTagRegistration } from '@formspec/core';
|
|
34
32
|
import { CustomAnnotationRegistration } from '@formspec/core';
|
|
35
33
|
import { CustomConstraintRegistration } from '@formspec/core';
|
|
@@ -38,10 +36,7 @@ import { DynamicEnumField } from '@formspec/core';
|
|
|
38
36
|
import { DynamicSchemaField } from '@formspec/core';
|
|
39
37
|
import { EnumOption } from '@formspec/core';
|
|
40
38
|
import { EnumOptionValue } from '@formspec/core';
|
|
41
|
-
import { ExtensionApplicableType } from '@formspec/core';
|
|
42
39
|
import { ExtensionDefinition } from '@formspec/core';
|
|
43
|
-
import { ExtensionPayloadValue } from '@formspec/core';
|
|
44
|
-
import { ExtensionTypeKind } from '@formspec/core';
|
|
45
40
|
import { FormElement } from '@formspec/core';
|
|
46
41
|
import { FormSpec } from '@formspec/core';
|
|
47
42
|
import { Group } from '@formspec/core';
|
|
@@ -49,7 +44,8 @@ import { NumberField } from '@formspec/core';
|
|
|
49
44
|
import { ObjectField } from '@formspec/core';
|
|
50
45
|
import { StaticEnumField } from '@formspec/core';
|
|
51
46
|
import { TextField } from '@formspec/core';
|
|
52
|
-
import
|
|
47
|
+
import * as ts from 'typescript';
|
|
48
|
+
import { z } from 'zod';
|
|
53
49
|
|
|
54
50
|
export { AnyField }
|
|
55
51
|
|
|
@@ -142,8 +138,6 @@ export declare interface BuildResult {
|
|
|
142
138
|
|
|
143
139
|
export { BuiltinConstraintBroadeningRegistration }
|
|
144
140
|
|
|
145
|
-
export { BuiltinConstraintName }
|
|
146
|
-
|
|
147
141
|
/**
|
|
148
142
|
* A Categorization element (tab-based layout).
|
|
149
143
|
*
|
|
@@ -186,8 +180,6 @@ export declare interface Category {
|
|
|
186
180
|
|
|
187
181
|
export { Conditional }
|
|
188
182
|
|
|
189
|
-
export { ConstraintSemanticRole }
|
|
190
|
-
|
|
191
183
|
export { ConstraintTagRegistration }
|
|
192
184
|
|
|
193
185
|
/**
|
|
@@ -242,16 +234,12 @@ export { EnumOptionValue }
|
|
|
242
234
|
/**
|
|
243
235
|
* JSON Schema with FormSpec extension properties for arbitrary `x-formspec-*` keys.
|
|
244
236
|
*
|
|
245
|
-
* @
|
|
237
|
+
* @public
|
|
246
238
|
*/
|
|
247
239
|
export declare type ExtendedJSONSchema7 = JSONSchema7 & FormSpecSchemaExtensions;
|
|
248
240
|
|
|
249
|
-
export { ExtensionApplicableType }
|
|
250
|
-
|
|
251
241
|
export { ExtensionDefinition }
|
|
252
242
|
|
|
253
|
-
export { ExtensionPayloadValue }
|
|
254
|
-
|
|
255
243
|
/**
|
|
256
244
|
* A registry of extensions that provides lookup by fully-qualified ID.
|
|
257
245
|
*
|
|
@@ -311,8 +299,6 @@ export declare interface ExtensionRegistry {
|
|
|
311
299
|
findAnnotation(annotationId: string): CustomAnnotationRegistration | undefined;
|
|
312
300
|
}
|
|
313
301
|
|
|
314
|
-
export { ExtensionTypeKind }
|
|
315
|
-
|
|
316
302
|
export { FormElement }
|
|
317
303
|
|
|
318
304
|
export { FormSpec }
|
|
@@ -320,7 +306,7 @@ export { FormSpec }
|
|
|
320
306
|
/**
|
|
321
307
|
* Extension properties for custom FormSpec constraint tags.
|
|
322
308
|
*
|
|
323
|
-
* @
|
|
309
|
+
* @public
|
|
324
310
|
*/
|
|
325
311
|
export declare type FormSpecSchemaExtensions = Record<`x-formspec-${string}`, unknown>;
|
|
326
312
|
|
|
@@ -439,6 +425,34 @@ export declare function generateSchemas(options: GenerateSchemasOptions): Genera
|
|
|
439
425
|
*/
|
|
440
426
|
export declare function generateSchemasFromClass(options: GenerateFromClassOptions): GenerateFromClassResult;
|
|
441
427
|
|
|
428
|
+
/**
|
|
429
|
+
* Generates JSON Schema and UI Schema from a named type within an existing
|
|
430
|
+
* TypeScript program supplied by the caller.
|
|
431
|
+
*
|
|
432
|
+
* This low-level entry point lets downstream tooling reuse a host-owned
|
|
433
|
+
* `Program` for both FormSpec extraction and other TypeScript analysis.
|
|
434
|
+
*
|
|
435
|
+
* @param options - Host program, file path, type name, and optional schema generation options
|
|
436
|
+
* @returns Generated JSON Schema and UI Schema
|
|
437
|
+
*
|
|
438
|
+
* @public
|
|
439
|
+
*/
|
|
440
|
+
export declare function generateSchemasFromProgram(options: GenerateSchemasFromProgramOptions): GenerateFromClassResult;
|
|
441
|
+
|
|
442
|
+
/**
|
|
443
|
+
* Options for generating schemas from a named type inside an existing TypeScript program.
|
|
444
|
+
*
|
|
445
|
+
* @public
|
|
446
|
+
*/
|
|
447
|
+
export declare interface GenerateSchemasFromProgramOptions extends StaticSchemaGenerationOptions {
|
|
448
|
+
/** Existing TypeScript program supplied by the caller. */
|
|
449
|
+
readonly program: ts.Program;
|
|
450
|
+
/** Path to the TypeScript source file */
|
|
451
|
+
readonly filePath: string;
|
|
452
|
+
/** Name of the exported class, interface, or type alias to analyze */
|
|
453
|
+
readonly typeName: string;
|
|
454
|
+
}
|
|
455
|
+
|
|
442
456
|
/**
|
|
443
457
|
* Options for generating schemas from a named type (class, interface, or type alias).
|
|
444
458
|
*
|
|
@@ -613,7 +627,7 @@ export declare interface JsonSchema2020 {
|
|
|
613
627
|
/**
|
|
614
628
|
* A JSON Schema definition (legacy subset used by Zod validator and types.ts).
|
|
615
629
|
*
|
|
616
|
-
* @
|
|
630
|
+
* @public
|
|
617
631
|
*/
|
|
618
632
|
export declare interface JSONSchema7 {
|
|
619
633
|
/** Declared JSON Schema dialect URI for the document root. */
|
|
@@ -695,6 +709,13 @@ export declare interface JSONSchema7 {
|
|
|
695
709
|
"x-formspec-schemaSource"?: string;
|
|
696
710
|
}
|
|
697
711
|
|
|
712
|
+
/**
|
|
713
|
+
* Zod schema for the legacy JSON Schema 7 subset used by `@formspec/build`.
|
|
714
|
+
*
|
|
715
|
+
* @public
|
|
716
|
+
*/
|
|
717
|
+
export declare const jsonSchema7Schema: z.ZodType<JSONSchema7>;
|
|
718
|
+
|
|
698
719
|
/**
|
|
699
720
|
* JSON Schema type definitions.
|
|
700
721
|
*
|
|
@@ -703,7 +724,7 @@ export declare interface JSONSchema7 {
|
|
|
703
724
|
/**
|
|
704
725
|
* JSON Schema primitive types.
|
|
705
726
|
*
|
|
706
|
-
* @
|
|
727
|
+
* @public
|
|
707
728
|
*/
|
|
708
729
|
export declare type JSONSchemaType = "string" | "number" | "integer" | "boolean" | "object" | "array" | "null";
|
|
709
730
|
|
|
@@ -873,6 +894,13 @@ export declare interface UISchemaElementBase {
|
|
|
873
894
|
*/
|
|
874
895
|
export declare type UISchemaElementType = "Control" | "VerticalLayout" | "HorizontalLayout" | "Group" | "Categorization" | "Category" | "Label";
|
|
875
896
|
|
|
897
|
+
/**
|
|
898
|
+
* Zod schema for the root UI Schema (layout types only).
|
|
899
|
+
*
|
|
900
|
+
* @public
|
|
901
|
+
*/
|
|
902
|
+
export declare const uiSchemaSchema: z.ZodType<UISchema>;
|
|
903
|
+
|
|
876
904
|
/**
|
|
877
905
|
* A vertical layout element.
|
|
878
906
|
*
|
|
@@ -891,8 +919,6 @@ export declare interface VerticalLayout {
|
|
|
891
919
|
readonly [k: string]: unknown;
|
|
892
920
|
}
|
|
893
921
|
|
|
894
|
-
export { VocabularyKeywordRegistration }
|
|
895
|
-
|
|
896
922
|
/**
|
|
897
923
|
* Builds and writes both JSON Schema and UI Schema files to disk.
|
|
898
924
|
*
|
package/dist/build-internal.d.ts
CHANGED
|
@@ -27,9 +27,7 @@ import { AnyField } from '@formspec/core';
|
|
|
27
27
|
import { ArrayField } from '@formspec/core';
|
|
28
28
|
import { BooleanField } from '@formspec/core';
|
|
29
29
|
import { BuiltinConstraintBroadeningRegistration } from '@formspec/core';
|
|
30
|
-
import { BuiltinConstraintName } from '@formspec/core';
|
|
31
30
|
import { Conditional } from '@formspec/core';
|
|
32
|
-
import { ConstraintSemanticRole } from '@formspec/core';
|
|
33
31
|
import { ConstraintTagRegistration } from '@formspec/core';
|
|
34
32
|
import { CustomAnnotationRegistration } from '@formspec/core';
|
|
35
33
|
import { CustomConstraintRegistration } from '@formspec/core';
|
|
@@ -38,10 +36,7 @@ import { DynamicEnumField } from '@formspec/core';
|
|
|
38
36
|
import { DynamicSchemaField } from '@formspec/core';
|
|
39
37
|
import { EnumOption } from '@formspec/core';
|
|
40
38
|
import { EnumOptionValue } from '@formspec/core';
|
|
41
|
-
import { ExtensionApplicableType } from '@formspec/core';
|
|
42
39
|
import { ExtensionDefinition } from '@formspec/core';
|
|
43
|
-
import { ExtensionPayloadValue } from '@formspec/core';
|
|
44
|
-
import { ExtensionTypeKind } from '@formspec/core';
|
|
45
40
|
import { FormElement } from '@formspec/core';
|
|
46
41
|
import { FormSpec } from '@formspec/core';
|
|
47
42
|
import { Group } from '@formspec/core';
|
|
@@ -49,7 +44,8 @@ import { NumberField } from '@formspec/core';
|
|
|
49
44
|
import { ObjectField } from '@formspec/core';
|
|
50
45
|
import { StaticEnumField } from '@formspec/core';
|
|
51
46
|
import { TextField } from '@formspec/core';
|
|
52
|
-
import
|
|
47
|
+
import * as ts from 'typescript';
|
|
48
|
+
import { z } from 'zod';
|
|
53
49
|
|
|
54
50
|
export { AnyField }
|
|
55
51
|
|
|
@@ -142,8 +138,6 @@ export declare interface BuildResult {
|
|
|
142
138
|
|
|
143
139
|
export { BuiltinConstraintBroadeningRegistration }
|
|
144
140
|
|
|
145
|
-
export { BuiltinConstraintName }
|
|
146
|
-
|
|
147
141
|
/**
|
|
148
142
|
* A Categorization element (tab-based layout).
|
|
149
143
|
*
|
|
@@ -186,8 +180,6 @@ export declare interface Category {
|
|
|
186
180
|
|
|
187
181
|
export { Conditional }
|
|
188
182
|
|
|
189
|
-
export { ConstraintSemanticRole }
|
|
190
|
-
|
|
191
183
|
export { ConstraintTagRegistration }
|
|
192
184
|
|
|
193
185
|
/**
|
|
@@ -242,16 +234,12 @@ export { EnumOptionValue }
|
|
|
242
234
|
/**
|
|
243
235
|
* JSON Schema with FormSpec extension properties for arbitrary `x-formspec-*` keys.
|
|
244
236
|
*
|
|
245
|
-
* @
|
|
237
|
+
* @public
|
|
246
238
|
*/
|
|
247
239
|
export declare type ExtendedJSONSchema7 = JSONSchema7 & FormSpecSchemaExtensions;
|
|
248
240
|
|
|
249
|
-
export { ExtensionApplicableType }
|
|
250
|
-
|
|
251
241
|
export { ExtensionDefinition }
|
|
252
242
|
|
|
253
|
-
export { ExtensionPayloadValue }
|
|
254
|
-
|
|
255
243
|
/**
|
|
256
244
|
* A registry of extensions that provides lookup by fully-qualified ID.
|
|
257
245
|
*
|
|
@@ -311,8 +299,6 @@ export declare interface ExtensionRegistry {
|
|
|
311
299
|
findAnnotation(annotationId: string): CustomAnnotationRegistration | undefined;
|
|
312
300
|
}
|
|
313
301
|
|
|
314
|
-
export { ExtensionTypeKind }
|
|
315
|
-
|
|
316
302
|
export { FormElement }
|
|
317
303
|
|
|
318
304
|
export { FormSpec }
|
|
@@ -320,7 +306,7 @@ export { FormSpec }
|
|
|
320
306
|
/**
|
|
321
307
|
* Extension properties for custom FormSpec constraint tags.
|
|
322
308
|
*
|
|
323
|
-
* @
|
|
309
|
+
* @public
|
|
324
310
|
*/
|
|
325
311
|
export declare type FormSpecSchemaExtensions = Record<`x-formspec-${string}`, unknown>;
|
|
326
312
|
|
|
@@ -439,6 +425,34 @@ export declare function generateSchemas(options: GenerateSchemasOptions): Genera
|
|
|
439
425
|
*/
|
|
440
426
|
export declare function generateSchemasFromClass(options: GenerateFromClassOptions): GenerateFromClassResult;
|
|
441
427
|
|
|
428
|
+
/**
|
|
429
|
+
* Generates JSON Schema and UI Schema from a named type within an existing
|
|
430
|
+
* TypeScript program supplied by the caller.
|
|
431
|
+
*
|
|
432
|
+
* This low-level entry point lets downstream tooling reuse a host-owned
|
|
433
|
+
* `Program` for both FormSpec extraction and other TypeScript analysis.
|
|
434
|
+
*
|
|
435
|
+
* @param options - Host program, file path, type name, and optional schema generation options
|
|
436
|
+
* @returns Generated JSON Schema and UI Schema
|
|
437
|
+
*
|
|
438
|
+
* @public
|
|
439
|
+
*/
|
|
440
|
+
export declare function generateSchemasFromProgram(options: GenerateSchemasFromProgramOptions): GenerateFromClassResult;
|
|
441
|
+
|
|
442
|
+
/**
|
|
443
|
+
* Options for generating schemas from a named type inside an existing TypeScript program.
|
|
444
|
+
*
|
|
445
|
+
* @public
|
|
446
|
+
*/
|
|
447
|
+
export declare interface GenerateSchemasFromProgramOptions extends StaticSchemaGenerationOptions {
|
|
448
|
+
/** Existing TypeScript program supplied by the caller. */
|
|
449
|
+
readonly program: ts.Program;
|
|
450
|
+
/** Path to the TypeScript source file */
|
|
451
|
+
readonly filePath: string;
|
|
452
|
+
/** Name of the exported class, interface, or type alias to analyze */
|
|
453
|
+
readonly typeName: string;
|
|
454
|
+
}
|
|
455
|
+
|
|
442
456
|
/**
|
|
443
457
|
* Options for generating schemas from a named type (class, interface, or type alias).
|
|
444
458
|
*
|
|
@@ -613,7 +627,7 @@ export declare interface JsonSchema2020 {
|
|
|
613
627
|
/**
|
|
614
628
|
* A JSON Schema definition (legacy subset used by Zod validator and types.ts).
|
|
615
629
|
*
|
|
616
|
-
* @
|
|
630
|
+
* @public
|
|
617
631
|
*/
|
|
618
632
|
export declare interface JSONSchema7 {
|
|
619
633
|
/** Declared JSON Schema dialect URI for the document root. */
|
|
@@ -695,6 +709,13 @@ export declare interface JSONSchema7 {
|
|
|
695
709
|
"x-formspec-schemaSource"?: string;
|
|
696
710
|
}
|
|
697
711
|
|
|
712
|
+
/**
|
|
713
|
+
* Zod schema for the legacy JSON Schema 7 subset used by `@formspec/build`.
|
|
714
|
+
*
|
|
715
|
+
* @public
|
|
716
|
+
*/
|
|
717
|
+
export declare const jsonSchema7Schema: z.ZodType<JSONSchema7>;
|
|
718
|
+
|
|
698
719
|
/**
|
|
699
720
|
* JSON Schema type definitions.
|
|
700
721
|
*
|
|
@@ -703,7 +724,7 @@ export declare interface JSONSchema7 {
|
|
|
703
724
|
/**
|
|
704
725
|
* JSON Schema primitive types.
|
|
705
726
|
*
|
|
706
|
-
* @
|
|
727
|
+
* @public
|
|
707
728
|
*/
|
|
708
729
|
export declare type JSONSchemaType = "string" | "number" | "integer" | "boolean" | "object" | "array" | "null";
|
|
709
730
|
|
|
@@ -873,6 +894,13 @@ export declare interface UISchemaElementBase {
|
|
|
873
894
|
*/
|
|
874
895
|
export declare type UISchemaElementType = "Control" | "VerticalLayout" | "HorizontalLayout" | "Group" | "Categorization" | "Category" | "Label";
|
|
875
896
|
|
|
897
|
+
/**
|
|
898
|
+
* Zod schema for the root UI Schema (layout types only).
|
|
899
|
+
*
|
|
900
|
+
* @public
|
|
901
|
+
*/
|
|
902
|
+
export declare const uiSchemaSchema: z.ZodType<UISchema>;
|
|
903
|
+
|
|
876
904
|
/**
|
|
877
905
|
* A vertical layout element.
|
|
878
906
|
*
|
|
@@ -891,8 +919,6 @@ export declare interface VerticalLayout {
|
|
|
891
919
|
readonly [k: string]: unknown;
|
|
892
920
|
}
|
|
893
921
|
|
|
894
|
-
export { VocabularyKeywordRegistration }
|
|
895
|
-
|
|
896
922
|
/**
|
|
897
923
|
* Builds and writes both JSON Schema and UI Schema files to disk.
|
|
898
924
|
*
|