@formspec/build 0.1.0-alpha.5 → 0.1.0-alpha.50

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.
Files changed (119) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +238 -93
  3. package/dist/analyzer/class-analyzer.d.ts +135 -0
  4. package/dist/analyzer/class-analyzer.d.ts.map +1 -0
  5. package/dist/analyzer/jsdoc-constraints.d.ts +53 -0
  6. package/dist/analyzer/jsdoc-constraints.d.ts.map +1 -0
  7. package/dist/analyzer/program.d.ts +97 -0
  8. package/dist/analyzer/program.d.ts.map +1 -0
  9. package/dist/analyzer/tsdoc-parser.d.ts +124 -0
  10. package/dist/analyzer/tsdoc-parser.d.ts.map +1 -0
  11. package/dist/browser.cjs +2212 -0
  12. package/dist/browser.cjs.map +1 -0
  13. package/dist/browser.d.ts +74 -0
  14. package/dist/browser.d.ts.map +1 -0
  15. package/dist/browser.js +2167 -0
  16. package/dist/browser.js.map +1 -0
  17. package/dist/build-alpha.d.ts +2408 -0
  18. package/dist/build-beta.d.ts +2408 -0
  19. package/dist/build-internal.d.ts +2408 -0
  20. package/dist/build.d.ts +2209 -151
  21. package/dist/canonicalize/chain-dsl-canonicalizer.d.ts +22 -0
  22. package/dist/canonicalize/chain-dsl-canonicalizer.d.ts.map +1 -0
  23. package/dist/canonicalize/index.d.ts +8 -0
  24. package/dist/canonicalize/index.d.ts.map +1 -0
  25. package/dist/canonicalize/tsdoc-canonicalizer.d.ts +38 -0
  26. package/dist/canonicalize/tsdoc-canonicalizer.d.ts.map +1 -0
  27. package/dist/cli.cjs +7111 -0
  28. package/dist/cli.cjs.map +1 -0
  29. package/dist/cli.js +7070 -103
  30. package/dist/cli.js.map +1 -1
  31. package/dist/extensions/index.d.ts +8 -0
  32. package/dist/extensions/index.d.ts.map +1 -0
  33. package/dist/extensions/registry.d.ts +142 -0
  34. package/dist/extensions/registry.d.ts.map +1 -0
  35. package/dist/extensions/resolve-custom-type.d.ts +37 -0
  36. package/dist/extensions/resolve-custom-type.d.ts.map +1 -0
  37. package/dist/extensions/symbol-registry.d.ts +33 -0
  38. package/dist/extensions/symbol-registry.d.ts.map +1 -0
  39. package/dist/extensions/ts-type-utils.d.ts +40 -0
  40. package/dist/extensions/ts-type-utils.d.ts.map +1 -0
  41. package/dist/generators/class-schema.d.ts +392 -0
  42. package/dist/generators/class-schema.d.ts.map +1 -0
  43. package/dist/generators/discovered-schema.d.ts +152 -0
  44. package/dist/generators/discovered-schema.d.ts.map +1 -0
  45. package/dist/generators/method-schema.d.ts +72 -0
  46. package/dist/generators/method-schema.d.ts.map +1 -0
  47. package/dist/generators/mixed-authoring.d.ts +52 -0
  48. package/dist/generators/mixed-authoring.d.ts.map +1 -0
  49. package/dist/index.cjs +6786 -0
  50. package/dist/index.cjs.map +1 -0
  51. package/dist/index.d.ts +51 -8
  52. package/dist/index.d.ts.map +1 -1
  53. package/dist/index.js +6751 -107
  54. package/dist/index.js.map +1 -1
  55. package/dist/internals.cjs +5736 -0
  56. package/dist/internals.cjs.map +1 -0
  57. package/dist/internals.d.ts +32 -0
  58. package/dist/internals.d.ts.map +1 -0
  59. package/dist/internals.js +5706 -0
  60. package/dist/internals.js.map +1 -0
  61. package/dist/json-schema/generator.d.ts +32 -6
  62. package/dist/json-schema/generator.d.ts.map +1 -1
  63. package/dist/json-schema/ir-generator.d.ts +149 -0
  64. package/dist/json-schema/ir-generator.d.ts.map +1 -0
  65. package/dist/json-schema/schema.d.ts +23 -0
  66. package/dist/json-schema/schema.d.ts.map +1 -0
  67. package/dist/json-schema/types.d.ts +76 -2
  68. package/dist/json-schema/types.d.ts.map +1 -1
  69. package/dist/metadata/collision-guards.d.ts +3 -0
  70. package/dist/metadata/collision-guards.d.ts.map +1 -0
  71. package/dist/metadata/index.d.ts +7 -0
  72. package/dist/metadata/index.d.ts.map +1 -0
  73. package/dist/metadata/policy.d.ts +12 -0
  74. package/dist/metadata/policy.d.ts.map +1 -0
  75. package/dist/metadata/resolve.d.ts +21 -0
  76. package/dist/metadata/resolve.d.ts.map +1 -0
  77. package/dist/static-build.d.ts +61 -0
  78. package/dist/static-build.d.ts.map +1 -0
  79. package/dist/ui-schema/generator.d.ts +18 -2
  80. package/dist/ui-schema/generator.d.ts.map +1 -1
  81. package/dist/ui-schema/ir-generator.d.ts +54 -0
  82. package/dist/ui-schema/ir-generator.d.ts.map +1 -0
  83. package/dist/ui-schema/schema.d.ts +429 -0
  84. package/dist/ui-schema/schema.d.ts.map +1 -0
  85. package/dist/ui-schema/types.d.ts +179 -35
  86. package/dist/ui-schema/types.d.ts.map +1 -1
  87. package/dist/validate/constraint-validator.d.ts +85 -0
  88. package/dist/validate/constraint-validator.d.ts.map +1 -0
  89. package/dist/validate/index.d.ts +9 -0
  90. package/dist/validate/index.d.ts.map +1 -0
  91. package/package.json +30 -11
  92. package/dist/__tests__/cli.test.d.ts +0 -2
  93. package/dist/__tests__/cli.test.d.ts.map +0 -1
  94. package/dist/__tests__/cli.test.js +0 -178
  95. package/dist/__tests__/cli.test.js.map +0 -1
  96. package/dist/__tests__/edge-cases.test.d.ts +0 -7
  97. package/dist/__tests__/edge-cases.test.d.ts.map +0 -1
  98. package/dist/__tests__/edge-cases.test.js +0 -217
  99. package/dist/__tests__/edge-cases.test.js.map +0 -1
  100. package/dist/__tests__/generator.test.d.ts +0 -2
  101. package/dist/__tests__/generator.test.d.ts.map +0 -1
  102. package/dist/__tests__/generator.test.js +0 -234
  103. package/dist/__tests__/generator.test.js.map +0 -1
  104. package/dist/__tests__/integration.test.d.ts +0 -8
  105. package/dist/__tests__/integration.test.d.ts.map +0 -1
  106. package/dist/__tests__/integration.test.js +0 -163
  107. package/dist/__tests__/integration.test.js.map +0 -1
  108. package/dist/__tests__/write-schemas.test.d.ts +0 -2
  109. package/dist/__tests__/write-schemas.test.d.ts.map +0 -1
  110. package/dist/__tests__/write-schemas.test.js +0 -196
  111. package/dist/__tests__/write-schemas.test.js.map +0 -1
  112. package/dist/json-schema/generator.js +0 -167
  113. package/dist/json-schema/generator.js.map +0 -1
  114. package/dist/json-schema/types.js +0 -7
  115. package/dist/json-schema/types.js.map +0 -1
  116. package/dist/ui-schema/generator.js +0 -150
  117. package/dist/ui-schema/generator.js.map +0 -1
  118. package/dist/ui-schema/types.js +0 -8
  119. package/dist/ui-schema/types.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"class-schema.d.ts","sourceRoot":"","sources":["../../src/generators/class-schema.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AACjC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAC1D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AASvD,OAAO,EAEL,KAAK,8BAA8B,EACnC,KAAK,eAAe,EACrB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAqB,KAAK,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAC/E,OAAO,EAEL,KAAK,+BAA+B,EACpC,KAAK,cAAc,EACpB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAEL,KAAK,iBAAiB,EAEvB,MAAM,wBAAwB,CAAC;AAGhC,OAAO,EAAc,KAAK,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAE7E,YAAY,EAAE,8BAA8B,EAAE,MAAM,+BAA+B,CAAC;AAEpF;;;;GAIG;AACH,MAAM,WAAW,YAAY;IAC3B,yCAAyC;IACzC,UAAU,EAAE,cAAc,CAAC;IAC3B,yCAAyC;IACzC,QAAQ,EAAE,QAAQ,CAAC;CACpB;AAED;;;;GAIG;AACH,MAAM,WAAW,0BAA0B;IACzC,8EAA8E;IAC9E,QAAQ,CAAC,EAAE,EAAE,OAAO,CAAC;IACrB,qEAAqE;IACrE,QAAQ,CAAC,WAAW,EAAE,SAAS,oBAAo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"@formspec/core";
3
+ import type { UISchema } from "../ui-schema/types.js";
4
+ import type { StaticBuildContext } from "../static-build.js";
5
+ import { type StaticSchemaGenerationOptions } from "./class-schema.js";
6
+ import { type JsonSchema2020 } from "../json-schema/ir-generator.js";
7
+ /**
8
+ * Generated schemas for a discovered declaration or signature type.
9
+ *
10
+ * `uiSchema` is `null` when the discovered type does not have an object-shaped
11
+ * root that can be represented as a JSON Forms layout.
12
+ *
13
+ * @public
14
+ */
15
+ export interface DiscoveredTypeSchemas {
16
+ /** JSON Schema 2020-12 for the resolved type. */
17
+ readonly jsonSchema: JsonSchema2020;
18
+ /** UI Schema for object-shaped roots, or `null` when not applicable. */
19
+ readonly uiSchema: UISchema | null;
20
+ /**
21
+ * Resolved type-level metadata used during generation, when available.
22
+ *
23
+ * This preserves explicit and inferred naming metadata such as singular and
24
+ * plural API/display names for consumers that need the resolved values in
25
+ * addition to the emitted schema artifacts.
26
+ */
27
+ readonly resolvedMetadata?: ResolvedMetadata | undefined;
28
+ }
29
+ /**
30
+ * Supported declaration kinds for declaration-driven schema generation.
31
+ *
32
+ * @public
33
+ */
34
+ export type SchemaSourceDeclaration = ts.ClassDeclaration | ts.InterfaceDeclaration | ts.TypeAliasDeclaration;
35
+ /**
36
+ * Supported declaration kinds for standalone metadata resolution.
37
+ *
38
+ * This helper is intentionally limited to named type declarations,
39
+ * methods/functions, and object-like properties. It does not currently expose
40
+ * parameter or variable metadata resolution on the public build surface.
41
+ *
42
+ * @public
43
+ */
44
+ export type MetadataSourceDeclaration = SchemaSourceDeclaration | ts.MethodDeclaration | ts.FunctionDeclaration | ts.PropertyDeclaration | ts.PropertySignature;
45
+ /**
46
+ * Options for generating schemas from a resolved declaration.
47
+ *
48
+ * @public
49
+ */
50
+ export interface GenerateSchemasFromDeclarationOptions extends StaticSchemaGenerationOptions {
51
+ /** Supported build context used for checker access and related analysis. */
52
+ readonly context: StaticBuildContext;
53
+ /** Declaration to turn into schemas. */
54
+ readonly declaration: SchemaSourceDeclaration;
55
+ }
56
+ /**
57
+ * Options for generating schemas from a resolved TypeScript type.
58
+ *
59
+ * @public
60
+ */
61
+ export interface GenerateSchemasFromTypeOptions extends StaticSchemaGenerationOptions {
62
+ /** Supported build context used for checker access and related analysis. */
63
+ readonly context: StaticBuildContext;
64
+ /** TypeScript type to turn into schemas. */
65
+ readonly type: ts.Type;
66
+ /**
67
+ * Optional source node associated with the type.
68
+ *
69
+ * When provided, FormSpec uses it as the source location for provenance and
70
+ * inline-type analysis.
71
+ */
72
+ readonly sourceNode?: ts.Node | undefined;
73
+ /** Optional logical name used for anonymous roots. */
74
+ readonly name?: string | undefined;
75
+ }
76
+ /**
77
+ * Options for generating schemas from a method or function parameter type.
78
+ *
79
+ * @public
80
+ */
81
+ export interface GenerateSchemasFromParameterOptions extends StaticSchemaGenerationOptions {
82
+ /** Supported build context used for checker access and related analysis. */
83
+ readonly context: StaticBuildContext;
84
+ /** Parameter declaration whose type should be converted into schemas. */
85
+ readonly parameter: ts.ParameterDeclaration;
86
+ }
87
+ /**
88
+ * Options for generating schemas from a method or function return type.
89
+ *
90
+ * @public
91
+ */
92
+ export interface GenerateSchemasFromReturnTypeOptions extends StaticSchemaGenerationOptions {
93
+ /** Supported build context used for checker access and related analysis. */
94
+ readonly context: StaticBuildContext;
95
+ /** Signature declaration whose return type should be converted into schemas. */
96
+ readonly declaration: ts.SignatureDeclaration;
97
+ }
98
+ /**
99
+ * Options for resolving metadata from a declaration against the active
100
+ * metadata policy.
101
+ *
102
+ * @public
103
+ */
104
+ export interface ResolveDeclarationMetadataOptions extends StaticSchemaGenerationOptions {
105
+ /** Supported build context used for checker access and related analysis. */
106
+ readonly context: StaticBuildContext;
107
+ /** Declaration whose metadata should be resolved. */
108
+ readonly declaration: MetadataSourceDeclaration;
109
+ }
110
+ /**
111
+ * Generates schemas from a resolved declaration using the supported public
112
+ * static-build workflow.
113
+ *
114
+ * Named declarations reuse the same analyzer semantics as FormSpec's existing
115
+ * top-level generation APIs. Non-object type aliases fall back to the generic
116
+ * resolved-type entry point.
117
+ *
118
+ * @public
119
+ */
120
+ export declare function generateSchemasFromDeclaration(options: GenerateSchemasFromDeclarationOptions): DiscoveredTypeSchemas;
121
+ /**
122
+ * Generates schemas from a resolved TypeScript type.
123
+ *
124
+ * This is the advanced public entry point for build tooling that already uses
125
+ * the TypeScript compiler API to discover types before handing them to
126
+ * FormSpec.
127
+ *
128
+ * @public
129
+ */
130
+ export declare function generateSchemasFromType(options: GenerateSchemasFromTypeOptions): DiscoveredTypeSchemas;
131
+ /**
132
+ * Generates schemas for a method or function parameter type.
133
+ *
134
+ * @public
135
+ */
136
+ export declare function generateSchemasFromParameter(options: GenerateSchemasFromParameterOptions): DiscoveredTypeSchemas;
137
+ /**
138
+ * Generates schemas for a method or function return type.
139
+ *
140
+ * Awaited `Promise<T>`-style return types are unwrapped before generation.
141
+ *
142
+ * @public
143
+ */
144
+ export declare function generateSchemasFromReturnType(options: GenerateSchemasFromReturnTypeOptions): DiscoveredTypeSchemas;
145
+ /**
146
+ * Resolves metadata from a declaration using FormSpec's configured metadata
147
+ * policy for the matching declaration kind.
148
+ *
149
+ * @public
150
+ */
151
+ export declare function resolveDeclarationMetadata(options: ResolveDeclarationMetadataOptions): ResolvedMetadata | undefined;
152
+ //# sourceMappingURL=discovered-schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"discovered-schema.d.ts","sourceRoot":"","sources":["../../src/generators/discovered-schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AAQjC,OAAO,KAAK,EAAuB,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAC5E,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAU7D,OAAO,EAIL,KAAK,6BAA6B,EACnC,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAA4B,KAAK,cAAc,EA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,EAAE,kBAAkB,CAAC;IACrC,yEAAyE;IACzE,QAAQ,CAAC,SAAS,EAAE,EAAE,CAAC,oBAAoB,CAAC;CAC7C;AAED;;;;GAIG;AACH,MAAM,WAAW,oCAAqC,SAAQ,6BAA6B;IACzF,4EAA4E;IAC5E,QAAQ,CAAC,OAAO,EAAE,kBAAkB,CAAC;IACrC,gFAAgF;IAChF,QAAQ,CAAC,WAAW,EAAE,EAAE,CAAC,oBAAoB,CAAC;CAC/C;AAED;;;;;GAKG;AACH,MAAM,WAAW,iCAAkC,SAAQ,6BAA6B;IACtF,4EAA4E;IAC5E,QAAQ,CAAC,OAAO,EAAE,kBAAkB,CAAC;IACrC,qDAAqD;IACrD,QAAQ,CAAC,WAAW,EAAE,yBAAyB,CAAC;CACjD;AAyWD;;;;;;;;;GASG;AACH,wBAAgB,8BAA8B,CAC5C,OAAO,EAAE,qCAAqC,GAC7C,qBAAqB,CAgFvB;AAED;;;;;;;;GAQG;AACH,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,8BAA8B,GACtC,qBAAqB,CAEvB;AAED;;;;GAIG;AACH,wBAAgB,4BAA4B,CAC1C,OAAO,EAAE,mCAAmC,GAC3C,qBAAqB,CAOvB;AAED;;;;;;GAMG;AACH,wBAAgB,6BAA6B,CAC3C,OAAO,EAAE,oCAAoC,GAC5C,qBAAqB,CAyBvB;AAED;;;;;GAKG;AACH,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,iCAAiC,GACzC,gBAAgB,GAAG,SAAS,CAiB9B"}
@@ -0,0 +1,72 @@
1
+ /**
2
+ * Method schema generator.
3
+ *
4
+ * Generates schemas for method parameters and return types, routing through
5
+ * the canonical IR pipeline (TypeScript type → TypeNode → JSON Schema 2020-12).
6
+ */
7
+ import type * as ts from "typescript";
8
+ import type { MethodInfo } from "../analyzer/class-analyzer.js";
9
+ import { type GenerateJsonSchemaFromIROptions, type JsonSchema2020 } from "../json-schema/ir-generator.js";
10
+ /**
11
+ * Runtime-loaded FormSpec schemas, compatible with the CLI's FormSpecSchemas type.
12
+ */
13
+ export interface LoadedFormSpecSchemas {
14
+ /** The FormSpec export name */
15
+ name: string;
16
+ /** Generated JSON Schema */
17
+ jsonSchema: unknown;
18
+ /** Generated UI Schema (FormSpec/JSON Forms) */
19
+ uiSchema: unknown;
20
+ }
21
+ /**
22
+ * Generated schemas for a method.
23
+ */
24
+ export interface MethodSchemas {
25
+ /** Method name */
26
+ name: string;
27
+ /** Parameter schemas (from FormSpec or static analysis) */
28
+ params: MethodParamsSchemas | null;
29
+ /** Return type schema */
30
+ returnType: JsonSchema2020;
31
+ }
32
+ /**
33
+ * Parameter schemas for a method.
34
+ */
35
+ export interface MethodParamsSchemas {
36
+ /** JSON Schema for parameters */
37
+ jsonSchema: JsonSchema2020;
38
+ /** UI Schema / FormSpec for parameters (if available) */
39
+ uiSchema: object | null;
40
+ /** Name of the FormSpec export used (if any) */
41
+ formSpecExport: string | null;
42
+ }
43
+ /**
44
+ * Options for generating method schemas.
45
+ */
46
+ export interface GenerateMethodSchemasOptions {
47
+ /** JSON Schema representation to use for static enums. */
48
+ readonly enumSerialization?: GenerateJsonSchemaFromIROptions["enumSerialization"] | undefined;
49
+ }
50
+ /**
51
+ * Generates schemas for a method's parameters and return type.
52
+ *
53
+ * If a parameter references a FormSpec via `InferSchema<typeof X>`,
54
+ * the schemas are taken from the loaded FormSpec at runtime.
55
+ * Otherwise, schemas are generated from static type analysis via the IR.
56
+ *
57
+ * @param method - The method information from static analysis
58
+ * @param checker - TypeScript type checker
59
+ * @param loadedFormSpecs - Map of FormSpec export names to their schemas
60
+ * @returns Generated method schemas
61
+ */
62
+ export declare function generateMethodSchemas(method: MethodInfo, checker: ts.TypeChecker, loadedFormSpecs: Map<string, LoadedFormSpecSchemas>, options?: GenerateMethodSchemasOptions): MethodSchemas;
63
+ /**
64
+ * Collects all FormSpec export names referenced by methods.
65
+ *
66
+ * Use this to determine which exports to load at runtime.
67
+ *
68
+ * @param methods - Array of method infos
69
+ * @returns Set of FormSpec export names
70
+ */
71
+ export declare function collectFormSpecReferences(methods: MethodInfo[]): Set<string>;
72
+ //# sourceMappingURL=method-schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"method-schema.d.ts","sourceRoot":"","sources":["../../src/generators/method-schema.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,KAAK,EAAE,MAAM,YAAY,CAAC;AAEtC,OAAO,KAAK,EAAE,UAAU,EAAiB,MAAM,+BAA+B,CAAC;AAG/E,OAAO,EAEL,KAAK,+BAA+B,EACpC,KAAK,cAAc,EACpB,MAAM,gCAAgC,CAAC;AAGxC;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,+BAA+B;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,4BAA4B;IAC5B,UAAU,EAAE,OAAO,CAAC;IACpB,gDAAgD;IAChD,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,kBAAkB;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,2DAA2D;IAC3D,MAAM,EAAE,mBAAmB,GAAG,IAAI,CAAC;IACnC,yBAAyB;IACzB,UAAU,EAAE,cAAc,CAAC;CAC5B;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,iCAAiC;IACjC,UAAU,EAAE,cAAc,CAAC;IAC3B,yDAAyD;IACzD,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,gDAAgD;IAChD,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;CAC/B;AAED;;GAEG;AACH,MAAM,WAAW,4BAA4B;IAC3C,0DAA0D;IAC1D,QAAQ,CAAC,iBAAiB,CAAC,EAAE,+BAA+B,CAAC,mBAAmB,CAAC,GAAG,SAAS,CAAC;CAC/F;AAyED;;;;;;;;;;;GAWG;AACH,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,UAAU,EAClB,OAAO,EAAE,EAAE,CAAC,WAAW,EACvB,eAAe,EAAE,GAAG,CAAC,MAAM,EAAE,qBAAqB,CAAC,EACnD,OAAO,CAAC,EAAE,4BAA4B,GACrC,aAAa,CAYf;AAoED;;;;;;;GAOG;AACH,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,UAAU,EAAE,GAAG,GAAG,CAAC,MAAM,CAAC,CAY5E"}
@@ -0,0 +1,52 @@
1
+ /**
2
+ * Mixed-authoring schema generator.
3
+ *
4
+ * Composes a statically analyzed TSDoc/class/interface/type-alias model with
5
+ * ChainDSL-authored field overlays. The static model remains authoritative for
6
+ * structure and constraints; overlays may add runtime field behavior such as
7
+ * dynamic enum or dynamic schema metadata.
8
+ */
9
+ import type { FormElement, FormSpec } from "@formspec/core";
10
+ import type { JsonSchema2020 } from "../json-schema/ir-generator.js";
11
+ import type { UISchema } from "../ui-schema/types.js";
12
+ import type { StaticSchemaGenerationOptions } from "./class-schema.js";
13
+ /**
14
+ * Result of generating schemas from a mixed-authoring composition.
15
+ *
16
+ * @public
17
+ */
18
+ export interface MixedAuthoringSchemas {
19
+ /** JSON Schema 2020-12 for validation. */
20
+ readonly jsonSchema: JsonSchema2020;
21
+ /** JSON Forms UI Schema for rendering. */
22
+ readonly uiSchema: UISchema;
23
+ }
24
+ /**
25
+ * Options for generating mixed-authoring schemas.
26
+ *
27
+ * The `typeName` can resolve to a class, interface, or object type alias, just
28
+ * like `generateSchemas()`.
29
+ *
30
+ * @public
31
+ */
32
+ export interface BuildMixedAuthoringSchemasOptions extends StaticSchemaGenerationOptions {
33
+ /** Path to the TypeScript source file. */
34
+ readonly filePath: string;
35
+ /** Name of the class, interface, or type alias to analyze. */
36
+ readonly typeName: string;
37
+ /** ChainDSL overlays to apply to the static model. Groups and conditionals are flattened by field name. */
38
+ readonly overlays: FormSpec<readonly FormElement[]>;
39
+ }
40
+ /**
41
+ * Builds JSON Schema and UI Schema from a TSDoc-derived model with ChainDSL
42
+ * field overlays.
43
+ *
44
+ * Overlays are matched by field name. The static model wins for structure,
45
+ * ordering, and constraints; ChainDSL overlays may contribute dynamic runtime
46
+ * field metadata such as dynamic enum or dynamic schema keywords, and may fill
47
+ * in missing annotations.
48
+ *
49
+ * @public
50
+ */
51
+ export declare function buildMixedAuthoringSchemas(options: BuildMixedAuthoringSchemasOptions): MixedAuthoringSchemas;
52
+ //# sourceMappingURL=mixed-authoring.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mixed-authoring.d.ts","sourceRoot":"","sources":["../../src/generators/mixed-authoring.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE5D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAGrE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAItD,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,mBAAmB,CAAC;AAGvE;;;;GAIG;AACH,MAAM,WAAW,qBAAqB;IACpC,0CAA0C;IAC1C,QAAQ,CAAC,UAAU,EAAE,cAAc,CAAC;IACpC,0CAA0C;IAC1C,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;CAC7B;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,iCAAkC,SAAQ,6BAA6B;IACtF,0CAA0C;IAC1C,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,8DAA8D;IAC9D,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,2GAA2G;IAC3G,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC,SAAS,WAAW,EAAE,CAAC,CAAC;CACrD;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,iCAAiC,GACzC,qBAAqB,CAwBvB"}