@formspec/build 0.1.0-alpha.11 → 0.1.0-alpha.13

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 (135) hide show
  1. package/README.md +51 -15
  2. package/dist/__tests__/chain-dsl-canonicalizer.test.d.ts +2 -0
  3. package/dist/__tests__/chain-dsl-canonicalizer.test.d.ts.map +1 -0
  4. package/dist/__tests__/constraint-validator.test.d.ts +2 -0
  5. package/dist/__tests__/constraint-validator.test.d.ts.map +1 -0
  6. package/dist/__tests__/extension-api.test.d.ts +2 -0
  7. package/dist/__tests__/extension-api.test.d.ts.map +1 -0
  8. package/dist/__tests__/fixtures/example-a-builtins.d.ts +18 -0
  9. package/dist/__tests__/fixtures/example-a-builtins.d.ts.map +1 -1
  10. package/dist/__tests__/guards.test.d.ts +2 -0
  11. package/dist/__tests__/guards.test.d.ts.map +1 -0
  12. package/dist/__tests__/ir-analyzer.test.d.ts +11 -0
  13. package/dist/__tests__/ir-analyzer.test.d.ts.map +1 -0
  14. package/dist/__tests__/ir-jsdoc-constraints.test.d.ts +12 -0
  15. package/dist/__tests__/ir-jsdoc-constraints.test.d.ts.map +1 -0
  16. package/dist/__tests__/ir-json-schema-generator.test.d.ts +11 -0
  17. package/dist/__tests__/ir-json-schema-generator.test.d.ts.map +1 -0
  18. package/dist/__tests__/ir-ui-schema-generator.test.d.ts +2 -0
  19. package/dist/__tests__/ir-ui-schema-generator.test.d.ts.map +1 -0
  20. package/dist/__tests__/jsdoc-constraints.test.d.ts +4 -4
  21. package/dist/__tests__/parity/fixtures/address/chain-dsl.d.ts +9 -0
  22. package/dist/__tests__/parity/fixtures/address/chain-dsl.d.ts.map +1 -0
  23. package/dist/__tests__/parity/fixtures/address/expected-ir.d.ts +9 -0
  24. package/dist/__tests__/parity/fixtures/address/expected-ir.d.ts.map +1 -0
  25. package/dist/__tests__/parity/fixtures/address/tsdoc.d.ts +19 -0
  26. package/dist/__tests__/parity/fixtures/address/tsdoc.d.ts.map +1 -0
  27. package/dist/__tests__/parity/fixtures/product-config/chain-dsl.d.ts +13 -0
  28. package/dist/__tests__/parity/fixtures/product-config/chain-dsl.d.ts.map +1 -0
  29. package/dist/__tests__/parity/fixtures/product-config/expected-ir.d.ts +9 -0
  30. package/dist/__tests__/parity/fixtures/product-config/expected-ir.d.ts.map +1 -0
  31. package/dist/__tests__/parity/fixtures/product-config/tsdoc.d.ts +28 -0
  32. package/dist/__tests__/parity/fixtures/product-config/tsdoc.d.ts.map +1 -0
  33. package/dist/__tests__/parity/fixtures/user-registration/chain-dsl.d.ts +12 -0
  34. package/dist/__tests__/parity/fixtures/user-registration/chain-dsl.d.ts.map +1 -0
  35. package/dist/__tests__/parity/fixtures/user-registration/expected-ir.d.ts +9 -0
  36. package/dist/__tests__/parity/fixtures/user-registration/expected-ir.d.ts.map +1 -0
  37. package/dist/__tests__/parity/fixtures/user-registration/tsdoc.d.ts +19 -0
  38. package/dist/__tests__/parity/fixtures/user-registration/tsdoc.d.ts.map +1 -0
  39. package/dist/__tests__/parity/parity.test.d.ts +14 -0
  40. package/dist/__tests__/parity/parity.test.d.ts.map +1 -0
  41. package/dist/__tests__/parity/utils.d.ts +139 -0
  42. package/dist/__tests__/parity/utils.d.ts.map +1 -0
  43. package/dist/analyzer/class-analyzer.d.ts +54 -99
  44. package/dist/analyzer/class-analyzer.d.ts.map +1 -1
  45. package/dist/analyzer/jsdoc-constraints.d.ts +78 -30
  46. package/dist/analyzer/jsdoc-constraints.d.ts.map +1 -1
  47. package/dist/analyzer/tsdoc-parser.d.ts +61 -0
  48. package/dist/analyzer/tsdoc-parser.d.ts.map +1 -0
  49. package/dist/browser.cjs +998 -309
  50. package/dist/browser.cjs.map +1 -1
  51. package/dist/browser.d.ts +10 -6
  52. package/dist/browser.d.ts.map +1 -1
  53. package/dist/browser.js +996 -308
  54. package/dist/browser.js.map +1 -1
  55. package/dist/build.d.ts +65 -150
  56. package/dist/canonicalize/chain-dsl-canonicalizer.d.ts +18 -0
  57. package/dist/canonicalize/chain-dsl-canonicalizer.d.ts.map +1 -0
  58. package/dist/canonicalize/index.d.ts +8 -0
  59. package/dist/canonicalize/index.d.ts.map +1 -0
  60. package/dist/canonicalize/tsdoc-canonicalizer.d.ts +34 -0
  61. package/dist/canonicalize/tsdoc-canonicalizer.d.ts.map +1 -0
  62. package/dist/cli.cjs +1455 -1656
  63. package/dist/cli.cjs.map +1 -1
  64. package/dist/cli.js +1459 -1647
  65. package/dist/cli.js.map +1 -1
  66. package/dist/extensions/index.d.ts +8 -0
  67. package/dist/extensions/index.d.ts.map +1 -0
  68. package/dist/extensions/registry.d.ts +55 -0
  69. package/dist/extensions/registry.d.ts.map +1 -0
  70. package/dist/generators/class-schema.d.ts +23 -38
  71. package/dist/generators/class-schema.d.ts.map +1 -1
  72. package/dist/generators/method-schema.d.ts +6 -8
  73. package/dist/generators/method-schema.d.ts.map +1 -1
  74. package/dist/index.cjs +1391 -1614
  75. package/dist/index.cjs.map +1 -1
  76. package/dist/index.d.ts +6 -8
  77. package/dist/index.d.ts.map +1 -1
  78. package/dist/index.js +1403 -1610
  79. package/dist/index.js.map +1 -1
  80. package/dist/internals.cjs +1642 -824
  81. package/dist/internals.cjs.map +1 -1
  82. package/dist/internals.d.ts +12 -3
  83. package/dist/internals.d.ts.map +1 -1
  84. package/dist/internals.js +1645 -820
  85. package/dist/internals.js.map +1 -1
  86. package/dist/json-schema/generator.d.ts +10 -5
  87. package/dist/json-schema/generator.d.ts.map +1 -1
  88. package/dist/json-schema/ir-generator.d.ts +84 -0
  89. package/dist/json-schema/ir-generator.d.ts.map +1 -0
  90. package/dist/json-schema/schema.d.ts +3 -3
  91. package/dist/json-schema/types.d.ts +5 -6
  92. package/dist/json-schema/types.d.ts.map +1 -1
  93. package/dist/ui-schema/generator.d.ts +5 -15
  94. package/dist/ui-schema/generator.d.ts.map +1 -1
  95. package/dist/ui-schema/ir-generator.d.ts +53 -0
  96. package/dist/ui-schema/ir-generator.d.ts.map +1 -0
  97. package/dist/validate/constraint-validator.d.ts +66 -0
  98. package/dist/validate/constraint-validator.d.ts.map +1 -0
  99. package/dist/validate/index.d.ts +9 -0
  100. package/dist/validate/index.d.ts.map +1 -0
  101. package/package.json +5 -4
  102. package/dist/__tests__/analyzer-edge-cases.test.d.ts +0 -13
  103. package/dist/__tests__/analyzer-edge-cases.test.d.ts.map +0 -1
  104. package/dist/__tests__/analyzer.test.d.ts +0 -5
  105. package/dist/__tests__/analyzer.test.d.ts.map +0 -1
  106. package/dist/__tests__/codegen.test.d.ts +0 -5
  107. package/dist/__tests__/codegen.test.d.ts.map +0 -1
  108. package/dist/__tests__/decorator-pipeline.test.d.ts +0 -11
  109. package/dist/__tests__/decorator-pipeline.test.d.ts.map +0 -1
  110. package/dist/__tests__/fixtures/example-b-decorators.d.ts +0 -5
  111. package/dist/__tests__/fixtures/example-b-decorators.d.ts.map +0 -1
  112. package/dist/__tests__/fixtures/example-b-extended.d.ts +0 -5
  113. package/dist/__tests__/fixtures/example-b-extended.d.ts.map +0 -1
  114. package/dist/__tests__/fixtures/example-c-custom.d.ts +0 -5
  115. package/dist/__tests__/fixtures/example-c-custom.d.ts.map +0 -1
  116. package/dist/__tests__/fixtures/example-c-decorators.d.ts +0 -5
  117. package/dist/__tests__/fixtures/example-c-decorators.d.ts.map +0 -1
  118. package/dist/__tests__/fixtures/example-d-mixed-decorators.d.ts +0 -6
  119. package/dist/__tests__/fixtures/example-d-mixed-decorators.d.ts.map +0 -1
  120. package/dist/__tests__/fixtures/example-e-decorators.d.ts +0 -11
  121. package/dist/__tests__/fixtures/example-e-decorators.d.ts.map +0 -1
  122. package/dist/__tests__/fixtures/example-e-no-namespace.d.ts +0 -5
  123. package/dist/__tests__/fixtures/example-e-no-namespace.d.ts.map +0 -1
  124. package/dist/__tests__/fixtures/example-jsdoc-constraints.d.ts +0 -16
  125. package/dist/__tests__/fixtures/example-jsdoc-constraints.d.ts.map +0 -1
  126. package/dist/__tests__/fixtures/example-nested-class.d.ts +0 -45
  127. package/dist/__tests__/fixtures/example-nested-class.d.ts.map +0 -1
  128. package/dist/__tests__/interface-types.test.d.ts +0 -11
  129. package/dist/__tests__/interface-types.test.d.ts.map +0 -1
  130. package/dist/analyzer/decorator-extractor.d.ts +0 -78
  131. package/dist/analyzer/decorator-extractor.d.ts.map +0 -1
  132. package/dist/analyzer/type-converter.d.ts +0 -75
  133. package/dist/analyzer/type-converter.d.ts.map +0 -1
  134. package/dist/codegen/index.d.ts +0 -75
  135. package/dist/codegen/index.d.ts.map +0 -1
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Extension registry for `@formspec/build`.
3
+ *
4
+ * @packageDocumentation
5
+ */
6
+ export { createExtensionRegistry } from "./registry.js";
7
+ export type { ExtensionRegistry } from "./registry.js";
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/extensions/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AACxD,YAAY,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC"}
@@ -0,0 +1,55 @@
1
+ /**
2
+ * Extension registry for resolving custom types, constraints, and annotations
3
+ * during JSON Schema generation and IR validation.
4
+ *
5
+ * The registry is created from a list of {@link ExtensionDefinition} objects
6
+ * and provides O(1) lookup by fully-qualified ID (extensionId + "/" + name).
7
+ *
8
+ * @packageDocumentation
9
+ */
10
+ import type { ExtensionDefinition, CustomTypeRegistration, CustomConstraintRegistration, CustomAnnotationRegistration } from "@formspec/core";
11
+ /**
12
+ * A registry of extensions that provides lookup by fully-qualified ID.
13
+ *
14
+ * Type IDs follow the format: `<extensionId>/<typeName>`
15
+ * Constraint IDs follow the format: `<extensionId>/<constraintName>`
16
+ * Annotation IDs follow the format: `<extensionId>/<annotationName>`
17
+ */
18
+ export interface ExtensionRegistry {
19
+ /** The extensions registered in this registry (in registration order). */
20
+ readonly extensions: readonly ExtensionDefinition[];
21
+ /**
22
+ * Look up a custom type registration by its fully-qualified type ID.
23
+ *
24
+ * @param typeId - The fully-qualified type ID (e.g., "x-stripe/monetary/Decimal").
25
+ * @returns The registration if found, otherwise `undefined`.
26
+ */
27
+ findType(typeId: string): CustomTypeRegistration | undefined;
28
+ /**
29
+ * Look up a custom constraint registration by its fully-qualified constraint ID.
30
+ *
31
+ * @param constraintId - The fully-qualified constraint ID.
32
+ * @returns The registration if found, otherwise `undefined`.
33
+ */
34
+ findConstraint(constraintId: string): CustomConstraintRegistration | undefined;
35
+ /**
36
+ * Look up a custom annotation registration by its fully-qualified annotation ID.
37
+ *
38
+ * @param annotationId - The fully-qualified annotation ID.
39
+ * @returns The registration if found, otherwise `undefined`.
40
+ */
41
+ findAnnotation(annotationId: string): CustomAnnotationRegistration | undefined;
42
+ }
43
+ /**
44
+ * Creates an extension registry from a list of extension definitions.
45
+ *
46
+ * The registry indexes all types, constraints, and annotations by their
47
+ * fully-qualified IDs (`<extensionId>/<name>`) for O(1) lookup during
48
+ * generation and validation.
49
+ *
50
+ * @param extensions - The extension definitions to register.
51
+ * @returns An {@link ExtensionRegistry} instance.
52
+ * @throws If duplicate type/constraint/annotation IDs are detected across extensions.
53
+ */
54
+ export declare function createExtensionRegistry(extensions: readonly ExtensionDefinition[]): ExtensionRegistry;
55
+ //# sourceMappingURL=registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/extensions/registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EACV,mBAAmB,EACnB,sBAAsB,EACtB,4BAA4B,EAC5B,4BAA4B,EAC7B,MAAM,gBAAgB,CAAC;AAMxB;;;;;;GAMG;AACH,MAAM,WAAW,iBAAiB;IAChC,0EAA0E;IAC1E,QAAQ,CAAC,UAAU,EAAE,SAAS,mBAAmB,EAAE,CAAC;IAEpD;;;;;OAKG;IACH,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,sBAAsB,GAAG,SAAS,CAAC;IAE7D;;;;;OAKG;IACH,cAAc,CAAC,YAAY,EAAE,MAAM,GAAG,4BAA4B,GAAG,SAAS,CAAC;IAE/E;;;;;OAKG;IACH,cAAc,CAAC,YAAY,EAAE,MAAM,GAAG,4BAA4B,GAAG,SAAS,CAAC;CAChF;AAMD;;;;;;;;;;GAUG;AACH,wBAAgB,uBAAuB,CACrC,UAAU,EAAE,SAAS,mBAAmB,EAAE,GACzC,iBAAiB,CA2CnB"}
@@ -1,44 +1,34 @@
1
1
  /**
2
2
  * Class schema generator.
3
3
  *
4
- * Generates JSON Schema and FormSpec/UI Schema from statically analyzed
5
- * class fields and decorators.
4
+ * Generates JSON Schema 2020-12 and JSON Forms UI Schema from statically
5
+ * analyzed class/interface/type alias declarations, routing through the
6
+ * canonical FormIR pipeline.
6
7
  */
7
- import type * as ts from "typescript";
8
- import type { ClassAnalysis, FieldInfo } from "../analyzer/class-analyzer.js";
9
- import type { ExtendedJSONSchema7 } from "../json-schema/types.js";
10
8
  import type { UISchema } from "../ui-schema/types.js";
9
+ import { type IRClassAnalysis } from "../analyzer/class-analyzer.js";
10
+ import { type TSDocSource } from "../canonicalize/index.js";
11
+ import { type JsonSchema2020 } from "../json-schema/ir-generator.js";
11
12
  /**
12
13
  * Generated schemas for a class.
13
14
  */
14
15
  export interface ClassSchemas {
15
- /** JSON Schema for validation */
16
- jsonSchema: ExtendedJSONSchema7;
16
+ /** JSON Schema 2020-12 for validation */
17
+ jsonSchema: JsonSchema2020;
17
18
  /** JSON Forms UI Schema for rendering */
18
19
  uiSchema: UISchema;
19
20
  }
20
21
  /**
21
- * Generates JSON Schema and FormSpec from a class analysis.
22
+ * Generates JSON Schema 2020-12 and UI Schema from an IR class analysis.
22
23
  *
23
- * Uses static type information and decorator metadata to build
24
- * complete schema definitions for a class's fields.
24
+ * Routes through the canonical IR pipeline:
25
+ * IRClassAnalysis canonicalizeTSDoc FormIR JSON Schema / UI Schema
25
26
  *
26
- * @param analysis - The class analysis result
27
- * @param checker - TypeScript type checker
28
- * @returns Generated JSON Schema and FormSpec
27
+ * @param analysis - The IR analysis result (from analyzeClassToIR, analyzeInterfaceToIR, or analyzeTypeAliasToIR)
28
+ * @param source - Optional source file metadata for provenance
29
+ * @returns Generated JSON Schema and UI Schema
29
30
  */
30
- export declare function generateClassSchemas(analysis: ClassAnalysis, checker: ts.TypeChecker): ClassSchemas;
31
- /**
32
- * Generates JSON Schema for a single field.
33
- *
34
- * Useful for generating schemas for method return types
35
- * or individual field extraction.
36
- *
37
- * @param field - The field information
38
- * @param checker - TypeScript type checker
39
- * @returns JSON Schema for the field's type
40
- */
41
- export declare function generateFieldSchema(field: FieldInfo, checker: ts.TypeChecker): ExtendedJSONSchema7;
31
+ export declare function generateClassSchemas(analysis: IRClassAnalysis, source?: TSDocSource): ClassSchemas;
42
32
  /**
43
33
  * Options for generating schemas from a decorated class.
44
34
  */
@@ -52,16 +42,16 @@ export interface GenerateFromClassOptions {
52
42
  * Result of generating schemas from a decorated class.
53
43
  */
54
44
  export interface GenerateFromClassResult {
55
- /** JSON Schema for validation */
56
- jsonSchema: ExtendedJSONSchema7;
45
+ /** JSON Schema 2020-12 for validation */
46
+ jsonSchema: JsonSchema2020;
57
47
  /** JSON Forms UI Schema for rendering */
58
48
  uiSchema: UISchema;
59
49
  }
60
50
  /**
61
- * Generates JSON Schema and FormSpec/UI Schema from a decorated TypeScript class.
51
+ * Generates JSON Schema and UI Schema from a decorated TypeScript class.
62
52
  *
63
53
  * This is a high-level entry point that handles the entire pipeline:
64
- * creating a TypeScript program, finding the class, analyzing it,
54
+ * creating a TypeScript program, finding the class, analyzing it to IR,
65
55
  * and generating schemas — all in one call.
66
56
  *
67
57
  * @example
@@ -74,7 +64,7 @@ export interface GenerateFromClassResult {
74
64
  * ```
75
65
  *
76
66
  * @param options - File path, class name, and optional compiler options
77
- * @returns Generated JSON Schema and FormSpec/UI Schema
67
+ * @returns Generated JSON Schema and UI Schema
78
68
  */
79
69
  export declare function generateSchemasFromClass(options: GenerateFromClassOptions): GenerateFromClassResult;
80
70
  /**
@@ -87,20 +77,15 @@ export interface GenerateSchemasOptions {
87
77
  typeName: string;
88
78
  }
89
79
  /**
90
- * Generates JSON Schema and FormSpec/UI Schema from a named TypeScript
80
+ * Generates JSON Schema and UI Schema from a named TypeScript
91
81
  * type — a decorated class, an interface with TSDoc tags, or a type alias.
92
82
  *
93
83
  * This is the recommended entry point. It automatically detects whether
94
84
  * the name resolves to a class, interface, or type alias and uses the
95
- * appropriate analysis pipeline:
96
- *
97
- * - **Classes**: extracts decorators and JSDoc constraints
98
- * - **Interfaces**: extracts TSDoc tags (`@Field_displayName`, `@Minimum`, etc.)
99
- * - **Type aliases**: object literal bodies analyzed like interfaces
85
+ * appropriate IR analysis pipeline.
100
86
  *
101
87
  * @example
102
88
  * ```typescript
103
- * // Works with both classes and interfaces — caller doesn't need to know
104
89
  * const result = generateSchemas({
105
90
  * filePath: "./src/config.ts",
106
91
  * typeName: "DiscountConfig",
@@ -108,7 +93,7 @@ export interface GenerateSchemasOptions {
108
93
  * ```
109
94
  *
110
95
  * @param options - File path and type name
111
- * @returns Generated JSON Schema and FormSpec/UI Schema
96
+ * @returns Generated JSON Schema and UI Schema
112
97
  */
113
98
  export declare function generateSchemas(options: GenerateSchemasOptions): GenerateFromClassResult;
114
99
  //# sourceMappingURL=class-schema.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"class-schema.d.ts","sourceRoot":"","sources":["../../src/generators/class-schema.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,KAAK,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAO9E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AACnE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAUtD;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,iCAAiC;IACjC,UAAU,EAAE,mBAAmB,CAAC;IAChC,yCAAyC;IACzC,QAAQ,EAAE,QAAQ,CAAC;CACpB;AAED;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,aAAa,EACvB,OAAO,EAAE,EAAE,CAAC,WAAW,GACtB,YAAY,CAsCd;AAED;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,SAAS,EAChB,OAAO,EAAE,EAAE,CAAC,WAAW,GACtB,mBAAmB,CAGrB;AAED;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC,yCAAyC;IACzC,QAAQ,EAAE,MAAM,CAAC;IACjB,4BAA4B;IAC5B,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,iCAAiC;IACjC,UAAU,EAAE,mBAAmB,CAAC;IAChC,yCAAyC;IACzC,QAAQ,EAAE,QAAQ,CAAC;CACpB;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,wBAAwB,GAChC,uBAAuB,CAUzB;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,yCAAyC;IACzC,QAAQ,EAAE,MAAM,CAAC;IACjB,sEAAsE;IACtE,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,sBAAsB,GAAG,uBAAuB,CA8BxF"}
1
+ {"version":3,"file":"class-schema.d.ts","sourceRoot":"","sources":["../../src/generators/class-schema.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAOtD,OAAO,EAIL,KAAK,eAAe,EACrB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAqB,KAAK,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAC/E,OAAO,EAA4B,KAAK,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAG/F;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,yCAAyC;IACzC,UAAU,EAAE,cAAc,CAAC;IAC3B,yCAAyC;IACzC,QAAQ,EAAE,QAAQ,CAAC;CACpB;AAED;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,eAAe,EACzB,MAAM,CAAC,EAAE,WAAW,GACnB,YAAY,CAMd;AAED;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC,yCAAyC;IACzC,QAAQ,EAAE,MAAM,CAAC;IACjB,4BAA4B;IAC5B,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,yCAAyC;IACzC,UAAU,EAAE,cAAc,CAAC;IAC3B,yCAAyC;IACzC,QAAQ,EAAE,QAAQ,CAAC;CACpB;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,wBAAwB,GAChC,uBAAuB,CAUzB;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,yCAAyC;IACzC,QAAQ,EAAE,MAAM,CAAC;IACjB,sEAAsE;IACtE,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,sBAAsB,GAAG,uBAAuB,CA+BxF"}
@@ -1,14 +1,12 @@
1
1
  /**
2
2
  * Method schema generator.
3
3
  *
4
- * Generates schemas for method parameters and return types:
5
- * - Parameters using FormSpec (InferSchema<typeof X>) -> runtime generation
6
- * - Parameters with regular types -> static type conversion
7
- * - Return types -> static type conversion
4
+ * Generates schemas for method parameters and return types, routing through
5
+ * the canonical IR pipeline (TypeScript type TypeNode → JSON Schema 2020-12).
8
6
  */
9
7
  import type * as ts from "typescript";
10
8
  import type { MethodInfo } from "../analyzer/class-analyzer.js";
11
- import type { ExtendedJSONSchema7 } from "../json-schema/types.js";
9
+ import { type JsonSchema2020 } from "../json-schema/ir-generator.js";
12
10
  /**
13
11
  * Runtime-loaded FormSpec schemas, compatible with the CLI's FormSpecSchemas type.
14
12
  */
@@ -29,14 +27,14 @@ export interface MethodSchemas {
29
27
  /** Parameter schemas (from FormSpec or static analysis) */
30
28
  params: MethodParamsSchemas | null;
31
29
  /** Return type schema */
32
- returnType: ExtendedJSONSchema7;
30
+ returnType: JsonSchema2020;
33
31
  }
34
32
  /**
35
33
  * Parameter schemas for a method.
36
34
  */
37
35
  export interface MethodParamsSchemas {
38
36
  /** JSON Schema for parameters */
39
- jsonSchema: ExtendedJSONSchema7;
37
+ jsonSchema: JsonSchema2020;
40
38
  /** UI Schema / FormSpec for parameters (if available) */
41
39
  uiSchema: object | null;
42
40
  /** Name of the FormSpec export used (if any) */
@@ -47,7 +45,7 @@ export interface MethodParamsSchemas {
47
45
  *
48
46
  * If a parameter references a FormSpec via `InferSchema<typeof X>`,
49
47
  * the schemas are taken from the loaded FormSpec at runtime.
50
- * Otherwise, schemas are generated from static type analysis.
48
+ * Otherwise, schemas are generated from static type analysis via the IR.
51
49
  *
52
50
  * @param method - The method information from static analysis
53
51
  * @param checker - TypeScript type checker
@@ -1 +1 @@
1
- {"version":3,"file":"method-schema.d.ts","sourceRoot":"","sources":["../../src/generators/method-schema.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,KAAK,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,KAAK,EAAE,UAAU,EAAiB,MAAM,+BAA+B,CAAC;AAE/E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAEnE;;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,mBAAmB,CAAC;CACjC;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,iCAAiC;IACjC,UAAU,EAAE,mBAAmB,CAAC;IAChC,yDAAyD;IACzD,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,gDAAgD;IAChD,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;CAC/B;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,UAAU,EAClB,OAAO,EAAE,EAAE,CAAC,WAAW,EACvB,eAAe,EAAE,GAAG,CAAC,MAAM,EAAE,qBAAqB,CAAC,GAClD,aAAa,CAYf;AAuED;;;;;;;GAOG;AACH,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,UAAU,EAAE,GAAG,GAAG,CAAC,MAAM,CAAC,CAY5E"}
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;AACtC,OAAO,KAAK,EAAE,UAAU,EAAiB,MAAM,+BAA+B,CAAC;AAG/E,OAAO,EAA4B,KAAK,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAG/F;;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;AA4CD;;;;;;;;;;;GAWG;AACH,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,UAAU,EAClB,OAAO,EAAE,EAAE,CAAC,WAAW,EACvB,eAAe,EAAE,GAAG,CAAC,MAAM,EAAE,qBAAqB,CAAC,GAClD,aAAa,CAYf;AAmED;;;;;;;GAOG;AACH,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,UAAU,EAAE,GAAG,GAAG,CAAC,MAAM,CAAC,CAY5E"}