@formspec/build 0.1.0-alpha.2 → 0.1.0-alpha.20

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 (177) hide show
  1. package/README.md +120 -0
  2. package/dist/__tests__/alias-chain-propagation.test.d.ts +9 -0
  3. package/dist/__tests__/alias-chain-propagation.test.d.ts.map +1 -0
  4. package/dist/__tests__/chain-dsl-canonicalizer.test.d.ts +2 -0
  5. package/dist/__tests__/chain-dsl-canonicalizer.test.d.ts.map +1 -0
  6. package/dist/__tests__/class-schema.test.d.ts +2 -0
  7. package/dist/__tests__/class-schema.test.d.ts.map +1 -0
  8. package/dist/__tests__/constraint-validator.test.d.ts +2 -0
  9. package/dist/__tests__/constraint-validator.test.d.ts.map +1 -0
  10. package/dist/__tests__/date-extension.integration.test.d.ts +2 -0
  11. package/dist/__tests__/date-extension.integration.test.d.ts.map +1 -0
  12. package/dist/__tests__/extension-api.test.d.ts +2 -0
  13. package/dist/__tests__/extension-api.test.d.ts.map +1 -0
  14. package/dist/__tests__/extension-runtime.integration.test.d.ts +2 -0
  15. package/dist/__tests__/extension-runtime.integration.test.d.ts.map +1 -0
  16. package/dist/__tests__/fixtures/alias-chains.d.ts +37 -0
  17. package/dist/__tests__/fixtures/alias-chains.d.ts.map +1 -0
  18. package/dist/__tests__/fixtures/class-schema-regressions.d.ts +87 -0
  19. package/dist/__tests__/fixtures/class-schema-regressions.d.ts.map +1 -0
  20. package/dist/__tests__/fixtures/edge-cases.d.ts +132 -0
  21. package/dist/__tests__/fixtures/edge-cases.d.ts.map +1 -0
  22. package/dist/__tests__/fixtures/example-a-builtins.d.ts +30 -0
  23. package/dist/__tests__/fixtures/example-a-builtins.d.ts.map +1 -0
  24. package/dist/__tests__/fixtures/example-date-extension.d.ts +12 -0
  25. package/dist/__tests__/fixtures/example-date-extension.d.ts.map +1 -0
  26. package/dist/__tests__/fixtures/example-interface-types.d.ts +102 -0
  27. package/dist/__tests__/fixtures/example-interface-types.d.ts.map +1 -0
  28. package/dist/__tests__/fixtures/example-numeric-extension.d.ts +20 -0
  29. package/dist/__tests__/fixtures/example-numeric-extension.d.ts.map +1 -0
  30. package/dist/__tests__/fixtures/extension-forms.d.ts +7 -0
  31. package/dist/__tests__/fixtures/extension-forms.d.ts.map +1 -0
  32. package/dist/__tests__/fixtures/mixed-authoring-shipping-address.d.ts +31 -0
  33. package/dist/__tests__/fixtures/mixed-authoring-shipping-address.d.ts.map +1 -0
  34. package/dist/__tests__/fixtures/named-primitive-aliases.d.ts +15 -0
  35. package/dist/__tests__/fixtures/named-primitive-aliases.d.ts.map +1 -0
  36. package/dist/__tests__/fixtures/nested-array-path-constraints.d.ts +14 -0
  37. package/dist/__tests__/fixtures/nested-array-path-constraints.d.ts.map +1 -0
  38. package/dist/__tests__/fixtures/sample-forms.d.ts +65 -0
  39. package/dist/__tests__/fixtures/sample-forms.d.ts.map +1 -0
  40. package/dist/__tests__/generate-schemas.test.d.ts +2 -0
  41. package/dist/__tests__/generate-schemas.test.d.ts.map +1 -0
  42. package/dist/__tests__/guards.test.d.ts +2 -0
  43. package/dist/__tests__/guards.test.d.ts.map +1 -0
  44. package/dist/__tests__/ir-analyzer.test.d.ts +11 -0
  45. package/dist/__tests__/ir-analyzer.test.d.ts.map +1 -0
  46. package/dist/__tests__/ir-jsdoc-constraints.test.d.ts +12 -0
  47. package/dist/__tests__/ir-jsdoc-constraints.test.d.ts.map +1 -0
  48. package/dist/__tests__/ir-json-schema-generator.test.d.ts +11 -0
  49. package/dist/__tests__/ir-json-schema-generator.test.d.ts.map +1 -0
  50. package/dist/__tests__/ir-ui-schema-generator.test.d.ts +2 -0
  51. package/dist/__tests__/ir-ui-schema-generator.test.d.ts.map +1 -0
  52. package/dist/__tests__/mixed-authoring.test.d.ts +2 -0
  53. package/dist/__tests__/mixed-authoring.test.d.ts.map +1 -0
  54. package/dist/__tests__/numeric-extension.integration.test.d.ts +2 -0
  55. package/dist/__tests__/numeric-extension.integration.test.d.ts.map +1 -0
  56. package/dist/__tests__/parity/fixtures/address/chain-dsl.d.ts +9 -0
  57. package/dist/__tests__/parity/fixtures/address/chain-dsl.d.ts.map +1 -0
  58. package/dist/__tests__/parity/fixtures/address/expected-ir.d.ts +9 -0
  59. package/dist/__tests__/parity/fixtures/address/expected-ir.d.ts.map +1 -0
  60. package/dist/__tests__/parity/fixtures/address/tsdoc.d.ts +19 -0
  61. package/dist/__tests__/parity/fixtures/address/tsdoc.d.ts.map +1 -0
  62. package/dist/__tests__/parity/fixtures/plan-status/chain-dsl.d.ts +19 -0
  63. package/dist/__tests__/parity/fixtures/plan-status/chain-dsl.d.ts.map +1 -0
  64. package/dist/__tests__/parity/fixtures/plan-status/expected-ir.d.ts +6 -0
  65. package/dist/__tests__/parity/fixtures/plan-status/expected-ir.d.ts.map +1 -0
  66. package/dist/__tests__/parity/fixtures/plan-status/tsdoc.d.ts +17 -0
  67. package/dist/__tests__/parity/fixtures/plan-status/tsdoc.d.ts.map +1 -0
  68. package/dist/__tests__/parity/fixtures/product-config/chain-dsl.d.ts +13 -0
  69. package/dist/__tests__/parity/fixtures/product-config/chain-dsl.d.ts.map +1 -0
  70. package/dist/__tests__/parity/fixtures/product-config/expected-ir.d.ts +9 -0
  71. package/dist/__tests__/parity/fixtures/product-config/expected-ir.d.ts.map +1 -0
  72. package/dist/__tests__/parity/fixtures/product-config/tsdoc.d.ts +28 -0
  73. package/dist/__tests__/parity/fixtures/product-config/tsdoc.d.ts.map +1 -0
  74. package/dist/__tests__/parity/fixtures/usd-cents/chain-dsl.d.ts +9 -0
  75. package/dist/__tests__/parity/fixtures/usd-cents/chain-dsl.d.ts.map +1 -0
  76. package/dist/__tests__/parity/fixtures/usd-cents/expected-ir.d.ts +6 -0
  77. package/dist/__tests__/parity/fixtures/usd-cents/expected-ir.d.ts.map +1 -0
  78. package/dist/__tests__/parity/fixtures/usd-cents/tsdoc.d.ts +19 -0
  79. package/dist/__tests__/parity/fixtures/usd-cents/tsdoc.d.ts.map +1 -0
  80. package/dist/__tests__/parity/fixtures/user-registration/chain-dsl.d.ts +12 -0
  81. package/dist/__tests__/parity/fixtures/user-registration/chain-dsl.d.ts.map +1 -0
  82. package/dist/__tests__/parity/fixtures/user-registration/expected-ir.d.ts +9 -0
  83. package/dist/__tests__/parity/fixtures/user-registration/expected-ir.d.ts.map +1 -0
  84. package/dist/__tests__/parity/fixtures/user-registration/tsdoc.d.ts +19 -0
  85. package/dist/__tests__/parity/fixtures/user-registration/tsdoc.d.ts.map +1 -0
  86. package/dist/__tests__/parity/parity.test.d.ts +18 -0
  87. package/dist/__tests__/parity/parity.test.d.ts.map +1 -0
  88. package/dist/__tests__/parity/utils.d.ts +151 -0
  89. package/dist/__tests__/parity/utils.d.ts.map +1 -0
  90. package/dist/__tests__/path-target-parser.test.d.ts +9 -0
  91. package/dist/__tests__/path-target-parser.test.d.ts.map +1 -0
  92. package/dist/analyzer/class-analyzer.d.ts +100 -0
  93. package/dist/analyzer/class-analyzer.d.ts.map +1 -0
  94. package/dist/analyzer/jsdoc-constraints.d.ts +53 -0
  95. package/dist/analyzer/jsdoc-constraints.d.ts.map +1 -0
  96. package/dist/analyzer/program.d.ts +68 -0
  97. package/dist/analyzer/program.d.ts.map +1 -0
  98. package/dist/analyzer/tsdoc-parser.d.ts +122 -0
  99. package/dist/analyzer/tsdoc-parser.d.ts.map +1 -0
  100. package/dist/browser.cjs +1291 -0
  101. package/dist/browser.cjs.map +1 -0
  102. package/dist/browser.d.ts +73 -0
  103. package/dist/browser.d.ts.map +1 -0
  104. package/dist/browser.js +1242 -0
  105. package/dist/browser.js.map +1 -0
  106. package/dist/build.d.ts +996 -0
  107. package/dist/canonicalize/chain-dsl-canonicalizer.d.ts +18 -0
  108. package/dist/canonicalize/chain-dsl-canonicalizer.d.ts.map +1 -0
  109. package/dist/canonicalize/index.d.ts +8 -0
  110. package/dist/canonicalize/index.d.ts.map +1 -0
  111. package/dist/canonicalize/tsdoc-canonicalizer.d.ts +34 -0
  112. package/dist/canonicalize/tsdoc-canonicalizer.d.ts.map +1 -0
  113. package/dist/cli.cjs +3862 -0
  114. package/dist/cli.cjs.map +1 -0
  115. package/dist/cli.js +3826 -103
  116. package/dist/cli.js.map +1 -1
  117. package/dist/extensions/index.d.ts +8 -0
  118. package/dist/extensions/index.d.ts.map +1 -0
  119. package/dist/extensions/registry.d.ts +79 -0
  120. package/dist/extensions/registry.d.ts.map +1 -0
  121. package/dist/generators/class-schema.d.ts +99 -0
  122. package/dist/generators/class-schema.d.ts.map +1 -0
  123. package/dist/generators/method-schema.d.ts +65 -0
  124. package/dist/generators/method-schema.d.ts.map +1 -0
  125. package/dist/generators/mixed-authoring.d.ts +45 -0
  126. package/dist/generators/mixed-authoring.d.ts.map +1 -0
  127. package/dist/index.cjs +3627 -0
  128. package/dist/index.cjs.map +1 -0
  129. package/dist/index.d.ts +33 -8
  130. package/dist/index.d.ts.map +1 -1
  131. package/dist/index.js +3587 -106
  132. package/dist/index.js.map +1 -1
  133. package/dist/internals.cjs +3371 -0
  134. package/dist/internals.cjs.map +1 -0
  135. package/dist/internals.d.ts +30 -0
  136. package/dist/internals.d.ts.map +1 -0
  137. package/dist/internals.js +3345 -0
  138. package/dist/internals.js.map +1 -0
  139. package/dist/json-schema/generator.d.ts +16 -5
  140. package/dist/json-schema/generator.d.ts.map +1 -1
  141. package/dist/json-schema/ir-generator.d.ts +108 -0
  142. package/dist/json-schema/ir-generator.d.ts.map +1 -0
  143. package/dist/json-schema/schema.d.ts +16 -0
  144. package/dist/json-schema/schema.d.ts.map +1 -0
  145. package/dist/json-schema/types.d.ts +29 -2
  146. package/dist/json-schema/types.d.ts.map +1 -1
  147. package/dist/ui-schema/generator.d.ts +5 -0
  148. package/dist/ui-schema/generator.d.ts.map +1 -1
  149. package/dist/ui-schema/ir-generator.d.ts +53 -0
  150. package/dist/ui-schema/ir-generator.d.ts.map +1 -0
  151. package/dist/ui-schema/schema.d.ts +357 -0
  152. package/dist/ui-schema/schema.d.ts.map +1 -0
  153. package/dist/ui-schema/types.d.ts +8 -73
  154. package/dist/ui-schema/types.d.ts.map +1 -1
  155. package/dist/validate/constraint-validator.d.ts +23 -0
  156. package/dist/validate/constraint-validator.d.ts.map +1 -0
  157. package/dist/validate/index.d.ts +9 -0
  158. package/dist/validate/index.d.ts.map +1 -0
  159. package/package.json +27 -7
  160. package/dist/__tests__/cli.test.js +0 -178
  161. package/dist/__tests__/cli.test.js.map +0 -1
  162. package/dist/__tests__/edge-cases.test.js +0 -217
  163. package/dist/__tests__/edge-cases.test.js.map +0 -1
  164. package/dist/__tests__/generator.test.js +0 -225
  165. package/dist/__tests__/generator.test.js.map +0 -1
  166. package/dist/__tests__/integration.test.js +0 -163
  167. package/dist/__tests__/integration.test.js.map +0 -1
  168. package/dist/__tests__/write-schemas.test.js +0 -196
  169. package/dist/__tests__/write-schemas.test.js.map +0 -1
  170. package/dist/json-schema/generator.js +0 -161
  171. package/dist/json-schema/generator.js.map +0 -1
  172. package/dist/json-schema/types.js +0 -7
  173. package/dist/json-schema/types.js.map +0 -1
  174. package/dist/ui-schema/generator.js +0 -150
  175. package/dist/ui-schema/generator.js.map +0 -1
  176. package/dist/ui-schema/types.js +0 -8
  177. package/dist/ui-schema/types.js.map +0 -1
package/README.md ADDED
@@ -0,0 +1,120 @@
1
+ # @formspec/build
2
+
3
+ Build-time schema generation for FormSpec.
4
+
5
+ This package covers:
6
+
7
+ - Chain DSL to JSON Schema / UI Schema compilation
8
+ - Static analysis of TypeScript classes, interfaces, and type aliases with TSDoc tags
9
+ - Canonical IR generation and validation
10
+ - Extension-aware schema generation with custom vendor keywords
11
+
12
+ ## Install
13
+
14
+ ```bash
15
+ pnpm add @formspec/build
16
+ ```
17
+
18
+ Most app code can use `formspec`, but use `@formspec/build` directly when you need static analysis or lower-level generation APIs.
19
+
20
+ ## Public Entry Points
21
+
22
+ | Entry point | Purpose |
23
+ | --------------------------- | -------------------------------------- |
24
+ | `@formspec/build` | Public build APIs |
25
+ | `@formspec/build/browser` | Browser-safe schema generation surface |
26
+ | `@formspec/build/internals` | Unstable internal APIs used by the CLI |
27
+
28
+ ## Chain DSL Generation
29
+
30
+ ```ts
31
+ import { buildFormSchemas } from "@formspec/build";
32
+ import { field, formspec } from "@formspec/dsl";
33
+
34
+ const form = formspec(
35
+ field.text("name", { required: true }),
36
+ field.enum("status", ["draft", "published"] as const)
37
+ );
38
+
39
+ const { jsonSchema, uiSchema } = buildFormSchemas(form);
40
+ ```
41
+
42
+ ## Static Analysis
43
+
44
+ `generateSchemas()` is the main entry point for TSDoc-backed generation.
45
+
46
+ ```ts
47
+ import { generateSchemas } from "@formspec/build";
48
+
49
+ const { jsonSchema, uiSchema } = generateSchemas({
50
+ filePath: "./src/forms.ts",
51
+ typeName: "ProductConfig",
52
+ });
53
+ ```
54
+
55
+ `generateSchemasFromClass()` remains available when the input is definitely a class declaration.
56
+
57
+ ```ts
58
+ import { generateSchemasFromClass } from "@formspec/build";
59
+
60
+ const result = generateSchemasFromClass({
61
+ filePath: "./src/forms.ts",
62
+ className: "ProductConfig",
63
+ });
64
+ ```
65
+
66
+ ### Supported TSDoc Examples
67
+
68
+ ```ts
69
+ export interface ProductConfig {
70
+ /** @displayName Product Name @minLength 1 */
71
+ name: string;
72
+
73
+ /** @format email */
74
+ supportEmail?: string;
75
+
76
+ /** @placeholder Search products */
77
+ query?: string;
78
+
79
+ /** @minimum 0 @maximum 9999.99 */
80
+ price: number;
81
+
82
+ /** @uniqueItems */
83
+ tags: string[];
84
+ }
85
+ ```
86
+
87
+ ## Extension-Aware Generation
88
+
89
+ Both chain and static generation APIs accept `extensionRegistry` and `vendorPrefix` where relevant.
90
+
91
+ ```ts
92
+ import { createExtensionRegistry, generateSchemas } from "@formspec/build";
93
+
94
+ const registry = createExtensionRegistry([myExtension]);
95
+
96
+ const result = generateSchemas({
97
+ filePath: "./src/forms.ts",
98
+ typeName: "Invoice",
99
+ extensionRegistry: registry,
100
+ vendorPrefix: "x-acme",
101
+ });
102
+ ```
103
+
104
+ Generation validates canonical IR before emitting schemas. Invalid inputs now fail generation with structured diagnostic codes surfaced in the thrown error.
105
+
106
+ ## Main Exports
107
+
108
+ - `buildFormSchemas(form, options?)`
109
+ - `generateJsonSchema(form, options?)`
110
+ - `generateUiSchema(form)`
111
+ - `writeSchemas(form, options)`
112
+ - `generateSchemas(options)`
113
+ - `generateSchemasFromClass(options)`
114
+ - `generateJsonSchemaFromIR(ir, options?)`
115
+ - `buildMixedAuthoringSchemas(options)`
116
+ - `createExtensionRegistry(extensions)`
117
+
118
+ ## License
119
+
120
+ UNLICENSED
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Tests for transitive type alias constraint propagation.
3
+ *
4
+ * Verifies that constraints declared on type aliases propagate transitively
5
+ * through alias chains (e.g., Integer → Percentage → field), and that
6
+ * excessively deep chains throw a clear error.
7
+ */
8
+ export {};
9
+ //# sourceMappingURL=alias-chain-propagation.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"alias-chain-propagation.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/alias-chain-propagation.test.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=chain-dsl-canonicalizer.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chain-dsl-canonicalizer.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/chain-dsl-canonicalizer.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=class-schema.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"class-schema.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/class-schema.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=constraint-validator.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constraint-validator.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/constraint-validator.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=date-extension.integration.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"date-extension.integration.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/date-extension.integration.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=extension-api.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extension-api.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/extension-api.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=extension-runtime.integration.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extension-runtime.integration.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/extension-runtime.integration.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,37 @@
1
+ /** @multipleOf 1 */
2
+ type Integer = number;
3
+ /** @minimum 0 @maximum 100 */
4
+ type Percentage = Integer;
5
+ export declare class TwoLevelChain {
6
+ /** @minimum 10 */
7
+ cpuUsage: Percentage;
8
+ memoryUsage: Percentage;
9
+ }
10
+ /** @minimum 0 */
11
+ type Base = number;
12
+ /** @maximum 1000 */
13
+ type Mid = Base;
14
+ /** @multipleOf 5 */
15
+ type Leaf = Mid;
16
+ export declare class ThreeLevelChain {
17
+ value: Leaf;
18
+ }
19
+ export declare class NoAlias {
20
+ /** @minimum 0 */
21
+ count: number;
22
+ }
23
+ type D0 = number;
24
+ type D1 = D0;
25
+ type D2 = D1;
26
+ type D3 = D2;
27
+ type D4 = D3;
28
+ type D5 = D4;
29
+ type D6 = D5;
30
+ type D7 = D6;
31
+ type D8 = D7;
32
+ type D9 = D8;
33
+ export declare class ExceedsMaxDepth {
34
+ value: D9;
35
+ }
36
+ export {};
37
+ //# sourceMappingURL=alias-chains.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"alias-chains.d.ts","sourceRoot":"","sources":["../../../src/__tests__/fixtures/alias-chains.ts"],"names":[],"mappings":"AAIA,oBAAoB;AACpB,KAAK,OAAO,GAAG,MAAM,CAAC;AAEtB,8BAA8B;AAC9B,KAAK,UAAU,GAAG,OAAO,CAAC;AAE1B,qBAAa,aAAa;IACxB,kBAAkB;IAClB,QAAQ,EAAG,UAAU,CAAC;IACtB,WAAW,EAAG,UAAU,CAAC;CAC1B;AAID,iBAAiB;AACjB,KAAK,IAAI,GAAG,MAAM,CAAC;AAEnB,oBAAoB;AACpB,KAAK,GAAG,GAAG,IAAI,CAAC;AAEhB,oBAAoB;AACpB,KAAK,IAAI,GAAG,GAAG,CAAC;AAEhB,qBAAa,eAAe;IAC1B,KAAK,EAAG,IAAI,CAAC;CACd;AAID,qBAAa,OAAO;IAClB,iBAAiB;IACjB,KAAK,EAAG,MAAM,CAAC;CAChB;AAOD,KAAK,EAAE,GAAG,MAAM,CAAC;AACjB,KAAK,EAAE,GAAG,EAAE,CAAC;AACb,KAAK,EAAE,GAAG,EAAE,CAAC;AACb,KAAK,EAAE,GAAG,EAAE,CAAC;AACb,KAAK,EAAE,GAAG,EAAE,CAAC;AACb,KAAK,EAAE,GAAG,EAAE,CAAC;AACb,KAAK,EAAE,GAAG,EAAE,CAAC;AACb,KAAK,EAAE,GAAG,EAAE,CAAC;AACb,KAAK,EAAE,GAAG,EAAE,CAAC;AACb,KAAK,EAAE,GAAG,EAAE,CAAC;AAEb,qBAAa,eAAe;IAC1B,KAAK,EAAG,EAAE,CAAC;CACZ"}
@@ -0,0 +1,87 @@
1
+ export declare class NotificationPreferences {
2
+ /** @defaultValue "email" */
3
+ channel?: string;
4
+ /** @defaultValue 3 */
5
+ retryCount?: number;
6
+ /** @defaultValue true */
7
+ enabled?: boolean;
8
+ /** @defaultValue null */
9
+ nickname?: string | null;
10
+ }
11
+ export declare class ContactForm {
12
+ /** @format email */
13
+ emailAddress: string;
14
+ /** @format date */
15
+ birthDate: string;
16
+ /** @format uri */
17
+ website: string;
18
+ }
19
+ export declare class SearchForm {
20
+ /** @placeholder Search by keyword... */
21
+ query: string;
22
+ }
23
+ export declare class SettingsForm {
24
+ /** @deprecated Use displayName instead */
25
+ legacyName: string;
26
+ /** @displayName Display Name */
27
+ displayName: string;
28
+ }
29
+ export declare class TagManager {
30
+ /** @minItems 1 @maxItems 10 @uniqueItems */
31
+ tags: string[];
32
+ }
33
+ export declare class SurveyForm {
34
+ /** @maxLength 280 */
35
+ responses: string[];
36
+ }
37
+ /**
38
+ * Summary text becomes the root schema description when no explicit tag is present.
39
+ */
40
+ export declare class DescriptionPrecedenceForm {
41
+ /**
42
+ * Summary that should be ignored.
43
+ * @remarks Ignored remarks.
44
+ * @description Explicit description wins.
45
+ */
46
+ explicit: string;
47
+ /** @remarks Remarks become description when no explicit description is present. */
48
+ remarks: string;
49
+ /** Summary text becomes the description when there are no explicit tags. */
50
+ summary: string;
51
+ }
52
+ export declare class PriceRange {
53
+ /** @minimum 100 @maximum 50 */
54
+ price: number;
55
+ }
56
+ export declare class MismatchedForm {
57
+ /** @minimum 0 */
58
+ label: string;
59
+ }
60
+ interface Address {
61
+ street: string;
62
+ city: string;
63
+ }
64
+ export declare class LocationForm {
65
+ /** @minLength :zipCode 5 */
66
+ address: Address;
67
+ }
68
+ interface Dimensions {
69
+ name: string;
70
+ width: number;
71
+ }
72
+ export declare class BoxForm {
73
+ /** @minimum :name 0 */
74
+ size: Dimensions;
75
+ }
76
+ /** @minimum 0 */
77
+ type SafeTemperature = number;
78
+ export declare class ThermostatForm {
79
+ /** @minimum -10 */
80
+ target: SafeTemperature;
81
+ }
82
+ /** @minimum 0 */
83
+ export declare class InvalidPlacementForm {
84
+ value: number;
85
+ }
86
+ export {};
87
+ //# sourceMappingURL=class-schema-regressions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"class-schema-regressions.d.ts","sourceRoot":"","sources":["../../../src/__tests__/fixtures/class-schema-regressions.ts"],"names":[],"mappings":"AAAA,qBAA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AM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf;AAED,qBAAa,OAAO;IAClB,uBAAuB;IACvB,IAAI,EAAG,UAAU,CAAC;CACnB;AAED,iBAAiB;AACjB,KAAK,eAAe,GAAG,MAAM,CAAC;AAE9B,qBAAa,cAAc;IACzB,mBAAmB;IACnB,MAAM,EAAG,eAAe,CAAC;CAC1B;AAED,iBAAiB;AACjB,qBAAa,oBAAoB;IAC/B,KAAK,EAAG,MAAM,CAAC;CAChB"}
@@ -0,0 +1,132 @@
1
+ /**
2
+ * Edge case fixtures for testing type converter and analyzer.
3
+ *
4
+ * These test various TypeScript type patterns that might cause issues.
5
+ */
6
+ /**
7
+ * Mixed type union (not just literals) - should produce oneOf.
8
+ */
9
+ export declare class MixedUnionTypes {
10
+ mixedPrimitive: string | number;
11
+ complexUnion: string | {
12
+ nested: boolean;
13
+ };
14
+ objectUnion: {
15
+ type: "a";
16
+ valueA: string;
17
+ } | {
18
+ type: "b";
19
+ valueB: number;
20
+ };
21
+ }
22
+ /**
23
+ * Various nullable patterns.
24
+ */
25
+ export declare class NullablePatterns {
26
+ nullableString: string | null;
27
+ undefinedString: string | undefined;
28
+ optionalNullable?: string | null;
29
+ tripleUnion: string | null | undefined;
30
+ nullableStatus: "active" | "inactive" | null;
31
+ }
32
+ /**
33
+ * Various array patterns.
34
+ */
35
+ export declare class ArrayEdgeCases {
36
+ strings: string[];
37
+ mixedArray: (string | number)[];
38
+ nullableArray: string[] | null;
39
+ objectArray: {
40
+ id: number;
41
+ name: string;
42
+ }[];
43
+ anyArray: unknown[];
44
+ nestedArray: string[][];
45
+ }
46
+ /**
47
+ * Self-referential dictionary type — used to verify the circular-reference
48
+ * guard in `tryResolveRecordType`. An index signature that references its
49
+ * own interface is the TS-valid equivalent of `Record<string, X>` where X
50
+ * is self-referential; without the guard, resolving the value type would
51
+ * recurse infinitely.
52
+ */
53
+ export interface SelfRefRecord {
54
+ [key: string]: SelfRefRecord;
55
+ }
56
+ export interface StringMap {
57
+ [key: string]: string;
58
+ }
59
+ /**
60
+ * Various object type patterns.
61
+ */
62
+ export declare class CircularNode {
63
+ id: string;
64
+ next?: CircularNode;
65
+ }
66
+ /**
67
+ * Various object type patterns.
68
+ */
69
+ export declare class ObjectEdgeCases {
70
+ emptyObject: {};
71
+ stringRecord: Record<string, string>;
72
+ namedStringMap: StringMap;
73
+ selfRefRecord: SelfRefRecord;
74
+ deepNested: {
75
+ level1: {
76
+ level2: {
77
+ level3: {
78
+ value: string;
79
+ };
80
+ };
81
+ };
82
+ };
83
+ optionalProps: {
84
+ required: string;
85
+ optional?: number;
86
+ };
87
+ }
88
+ /**
89
+ * Special TypeScript types.
90
+ */
91
+ export declare class SpecialTypes {
92
+ anyField: any;
93
+ unknownField: unknown;
94
+ voidField: void;
95
+ dateField: Date;
96
+ }
97
+ /**
98
+ * Various enum patterns.
99
+ */
100
+ export declare class EnumVariations {
101
+ singleLiteral: "only";
102
+ numberEnum: 1 | 2 | 3;
103
+ mixedLiterals: "string" | 42;
104
+ largeEnum: "a" | "b" | "c" | "d" | "e" | "f" | "g" | "h" | "i" | "j";
105
+ }
106
+ /**
107
+ * Simple class with no decorators for testing analyzer edge cases.
108
+ */
109
+ export declare class NoDecoratorsClass {
110
+ name: string;
111
+ count?: number;
112
+ active: boolean;
113
+ }
114
+ export declare const notFormSpec1: null;
115
+ export declare const notFormSpec2: undefined;
116
+ export declare const notFormSpec3 = "string";
117
+ export declare const notFormSpec4 = 123;
118
+ export declare const notFormSpec5: {
119
+ notElements: never[];
120
+ };
121
+ export declare const notFormSpec6: {
122
+ elements: string;
123
+ };
124
+ export declare const notFormSpec7: {
125
+ elements: {
126
+ missingType: boolean;
127
+ }[];
128
+ };
129
+ export declare const notFormSpec8: {
130
+ elements: null[];
131
+ };
132
+ //# sourceMappingURL=edge-cases.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"edge-cases.d.ts","sourceRoot":"","sources":["../../../src/__tests__/fixtures/edge-cases.ts"],"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C;AAChC,eAAO,MAAM,YAAY;;CAAsB,CAAC;AAChD,eAAO,MAAM,YAAY;;CAA4B,CAAC;AACtD,eAAO,MAAM,YAAY;;;;CAAwC,CAAC;AAClE,eAAO,MAAM,YAAY;;CAAuB,CAAC"}
@@ -0,0 +1,30 @@
1
+ export declare class ExampleAForm {
2
+ /** @displayName Full Name
3
+ * @description Your legal name
4
+ * @minLength 2
5
+ * @maxLength 100
6
+ */
7
+ name: string;
8
+ /** @displayName Age
9
+ * @minimum 0
10
+ * @maximum 150
11
+ */
12
+ age: number;
13
+ /** @displayName Score
14
+ * @exclusiveMinimum 0
15
+ */
16
+ score: number;
17
+ /** @displayName Email
18
+ * @pattern ^[^@]+@[^@]+$
19
+ */
20
+ email?: string;
21
+ /** @displayName Country
22
+ * @enumOptions [{"id":"us","label":"United States"},{"id":"ca","label":"Canada"}]
23
+ */
24
+ country: "us" | "ca";
25
+ state?: string;
26
+ /** @deprecated Use email instead */
27
+ fax?: string;
28
+ role: "admin" | "user";
29
+ }
30
+ //# sourceMappingURL=example-a-builtins.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"example-a-builtins.d.ts","sourceRoot":"","sources":["../../../src/__tests__/fixtures/example-a-builtins.ts"],"names":[],"mappings":"AAAA,qBAAa,YAAY;IACvB;;;;OAIG;IACH,IAAI,EAAG,MAAM,CAAC;IAEd;;;OAGG;IACH,GAAG,EAAG,MAAM,CAAC;IAEb;;OAEG;IACH,KAAK,EAAG,MAAM,CAAC;IAEf;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,OAAO,EAAG,IAAI,GAAG,IAAI,CAAC;IAEtB,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,oCAAoC;IACpC,GAAG,CAAC,EAAE,MAAM,CAAC;IAEb,IAAI,EAAE,OAAO,GAAG,MAAM,CAAU;CACjC"}
@@ -0,0 +1,12 @@
1
+ import { type ConstraintTagRegistration, type CustomConstraintRegistration, type CustomTypeRegistration } from "@formspec/core";
2
+ export declare const DATE_EXTENSION_ID = "x-formspec/example-date";
3
+ export declare const DATE_TIME_TYPE_ID = "x-formspec/example-date/DateTime";
4
+ export declare function parseCanonicalDateTime(raw: string): string;
5
+ export declare const dateTimeType: CustomTypeRegistration;
6
+ export declare const afterConstraint: CustomConstraintRegistration;
7
+ export declare const beforeConstraint: CustomConstraintRegistration;
8
+ export declare const afterTag: ConstraintTagRegistration;
9
+ export declare const beforeTag: ConstraintTagRegistration;
10
+ export declare const dateExtension: import("@formspec/core").ExtensionDefinition;
11
+ export declare function createDateExtensionRegistry(): import("../../extensions/registry.js").ExtensionRegistry;
12
+ //# sourceMappingURL=example-date-extension.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"example-date-extension.d.ts","sourceRoot":"","sources":["../../../src/__tests__/fixtures/example-date-extension.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,yBAAyB,EAC9B,KAAK,4BAA4B,EACjC,KAAK,sBAAsB,EAG5B,MAAM,gBAAgB,CAAC;AAGxB,eAAO,MAAM,iBAAiB,4BAA4B,CAAC;AAC3D,eAAO,MAAM,iBAAiB,qCAAkC,CAAC;AAKjE,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAc1D;AAoBD,eAAO,MAAM,YAAY,EAAE,sBASzB,CAAC;AAwBH,eAAO,MAAM,eAAe,8BAAiD,CAAC;AAC9E,eAAO,MAAM,gBAAgB,8BAAmD,CAAC;AAEjF,eAAO,MAAM,QAAQ,EAAE,yBAKrB,CAAC;AAEH,eAAO,MAAM,SAAS,EAAE,yBAKtB,CAAC;AAEH,eAAO,MAAM,aAAa,8CAKxB,CAAC;AAEH,wBAAgB,2BAA2B,6DAE1C"}
@@ -0,0 +1,102 @@
1
+ /**
2
+ * Test fixtures for interface and type alias analysis.
3
+ *
4
+ * Tests the TSDoc-based schema extraction pipeline for interfaces,
5
+ * type aliases, nested types, and edge cases.
6
+ */
7
+ export interface SimpleConfig {
8
+ /**
9
+ * @displayName Full Name
10
+ * @description The user's legal name
11
+ * @minLength 1
12
+ * @maxLength 200
13
+ */
14
+ name: string;
15
+ /** @displayName Age @minimum 0 @maximum 150 */
16
+ age: number;
17
+ /** @displayName Email @pattern ^[^@]+@[^@]+$ */
18
+ email?: string;
19
+ /** @displayName Active */
20
+ active: boolean;
21
+ }
22
+ export interface WithEnumOptions {
23
+ /**
24
+ * @displayName Status
25
+ * @enumOptions ["draft","active","archived"]
26
+ */
27
+ status: "draft" | "active" | "archived";
28
+ /**
29
+ * @displayName Priority
30
+ * @enumOptions [{"id":"low","label":"Low Priority"},{"id":"high","label":"High Priority"}]
31
+ */
32
+ priority: "low" | "high";
33
+ }
34
+ export interface EmptyInterface {
35
+ }
36
+ export interface OnlyOptionalFields {
37
+ /** @displayName Notes */
38
+ notes?: string;
39
+ /** @displayName Tags */
40
+ tags?: string;
41
+ }
42
+ /** @deprecated Use NewConfig instead */
43
+ export interface DeprecatedFieldInterface {
44
+ /** @deprecated Use fullName instead */
45
+ name?: string;
46
+ /** @displayName Full Name */
47
+ fullName: string;
48
+ }
49
+ export type SimpleTypeAlias = {
50
+ /** @displayName Label @minLength 1 */
51
+ label: string;
52
+ /** @displayName Count @minimum 0 */
53
+ count: number;
54
+ /** @displayName Description */
55
+ description?: string;
56
+ };
57
+ export type TypeAliasWithEnumOptions = {
58
+ /**
59
+ * @displayName Color
60
+ * @enumOptions ["red","green","blue"]
61
+ */
62
+ color: "red" | "green" | "blue";
63
+ };
64
+ export type StringAlias = string;
65
+ export type UnionAlias = "a" | "b" | "c";
66
+ /** @minimum 0 @maximum 100 */
67
+ export type Percent = number;
68
+ /** @minLength 1 @maxLength 255 @pattern ^[^@]+@[^@]+$ */
69
+ export type Email = string;
70
+ /** @displayName Discount Rate @description Percentage discount applied @minimum 0 @maximum 100 */
71
+ export type AnnotatedPercent = number;
72
+ export interface ConfigWithAliasedTypes {
73
+ /** @displayName Discount */
74
+ discount: Percent;
75
+ /** @displayName Contact Email */
76
+ contactEmail: Email;
77
+ /** @displayName Tax Rate */
78
+ taxRate: AnnotatedPercent;
79
+ }
80
+ export interface Address {
81
+ /** @displayName Street @minLength 1 @maxLength 200 */
82
+ street: string;
83
+ /** @displayName City @minLength 1 */
84
+ city: string;
85
+ /** @displayName Zip @pattern ^[0-9]{5}$ */
86
+ zip?: string;
87
+ }
88
+ export type ContactInfo = {
89
+ /** @displayName Email @pattern ^[^@]+@[^@]+$ */
90
+ email: string;
91
+ /** @displayName Phone @maxLength 20 */
92
+ phone?: string;
93
+ };
94
+ export interface NestedConfig {
95
+ /** @displayName Name */
96
+ name: string;
97
+ /** @displayName Address */
98
+ address: Address;
99
+ /** @displayName Contact */
100
+ contact: ContactInfo;
101
+ }
102
+ //# sourceMappingURL=example-interface-types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"example-interface-types.d.ts","sourceRoot":"","sources":["../../../src/__tests__/fixtures/example-interface-types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,MAAM,WAAW,YAAY;IAC3B;;;;;OAKG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb,+CAA+C;IAC/C,GAAG,EAAE,MAAM,CAAC;IAEZ,gDAAgD;IAChD,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,0BAA0B;IAC1B,MAAM,EAAE,OAAO,CAAC;CACjB;AAED,MAAM,WAAW,eAAe;IAC9B;;;OAGG;IACH,MAAM,EAAE,OAAO,GAAG,QAAQ,GAAG,UAAU,CAAC;IAExC;;;OAGG;IACH,QAAQ,EAAE,KAAK,GAAG,MAAM,CAAC;CAC1B;AAGD,MAAM,WAAW,cAAc;CAAG;AAElC,MAAM,WAAW,kBAAkB;IACjC,yBAAyB;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,wBAAwB;IACxB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,wCAAwC;AACxC,MAAM,WAAW,wBAAwB;IACvC,uCAAuC;IACvC,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OAAO,EAAE,OAAO,CAAC;IACjB,2BAA2B;IAC3B,OAAO,EAAE,WAAW,CAAC;CACtB"}
@@ -0,0 +1,20 @@
1
+ import { type ConstraintTagRegistration, type CustomTypeRegistration } from "@formspec/core";
2
+ export declare const NUMERIC_EXTENSION_ID = "x-formspec/example-numeric";
3
+ export declare const DECIMAL_TYPE_ID = "x-formspec/example-numeric/Decimal";
4
+ export declare const BIGINT_TYPE_ID = "x-formspec/example-numeric/BigInt";
5
+ export interface DecimalValue {
6
+ readonly coefficient: bigint;
7
+ readonly scale: number;
8
+ }
9
+ export declare function parseDecimal(raw: string): DecimalValue;
10
+ export declare function formatDecimal(value: DecimalValue): string;
11
+ export declare function compareDecimal(left: DecimalValue, right: DecimalValue): -1 | 0 | 1;
12
+ export declare function addDecimal(left: DecimalValue, right: DecimalValue): DecimalValue;
13
+ export declare function subtractDecimal(left: DecimalValue, right: DecimalValue): DecimalValue;
14
+ export declare const decimalType: CustomTypeRegistration;
15
+ export declare const bigIntType: CustomTypeRegistration;
16
+ export declare const maxSigFigTag: ConstraintTagRegistration;
17
+ export declare const maxDecimalPlacesTag: ConstraintTagRegistration;
18
+ export declare const numericExtension: import("@formspec/core").ExtensionDefinition;
19
+ export declare function createNumericExtensionRegistry(): import("../../extensions/registry.js").ExtensionRegistry;
20
+ //# sourceMappingURL=example-numeric-extension.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"example-numeric-extension.d.ts","sourceRoot":"","sources":["../../../src/__tests__/fixtures/example-numeric-extension.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,yBAAyB,EAE9B,KAAK,sBAAsB,EAG5B,MAAM,gBAAgB,CAAC;AAGxB,eAAO,MAAM,oBAAoB,+BAA+B,CAAC;AACjE,eAAO,MAAM,eAAe,uCAAoC,CAAC;AACjE,eAAO,MAAM,cAAc,sCAAmC,CAAC;AAE/D,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB;AAMD,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,YAAY,CAetD;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,YAAY,GAAG,MAAM,CAazD;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,YAAY,EAAE,KAAK,EAAE,YAAY,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CASlF;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,YAAY,EAAE,KAAK,EAAE,YAAY,GAAG,YAAY,CAQhF;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,YAAY,EAAE,KAAK,EAAE,YAAY,GAAG,YAAY,CAQrF;AAgDD,eAAO,MAAM,WAAW,EAAE,sBAkCxB,CAAC;AAEH,eAAO,MAAM,UAAU,EAAE,sBAOvB,CAAC;AA6FH,eAAO,MAAM,YAAY,EAAE,yBAKzB,CAAC;AAEH,eAAO,MAAM,mBAAmB,EAAE,yBAKhC,CAAC;AAEH,eAAO,MAAM,gBAAgB,8CAa3B,CAAC;AAEH,wBAAgB,8BAA8B,6DAE7C"}
@@ -0,0 +1,7 @@
1
+ type MoneyDecimal = string;
2
+ export interface BillingForm {
3
+ /** @minimum USD */
4
+ amount: MoneyDecimal;
5
+ }
6
+ export {};
7
+ //# sourceMappingURL=extension-forms.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extension-forms.d.ts","sourceRoot":"","sources":["../../../src/__tests__/fixtures/extension-forms.ts"],"names":[],"mappings":"AAAA,KAAK,YAAY,GAAG,MAAM,CAAC;AAE3B,MAAM,WAAW,WAAW;IAC1B,mBAAmB;IACnB,MAAM,EAAE,YAAY,CAAC;CACtB"}