@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.
- package/README.md +51 -15
- package/dist/__tests__/chain-dsl-canonicalizer.test.d.ts +2 -0
- package/dist/__tests__/chain-dsl-canonicalizer.test.d.ts.map +1 -0
- package/dist/__tests__/constraint-validator.test.d.ts +2 -0
- package/dist/__tests__/constraint-validator.test.d.ts.map +1 -0
- package/dist/__tests__/extension-api.test.d.ts +2 -0
- package/dist/__tests__/extension-api.test.d.ts.map +1 -0
- package/dist/__tests__/fixtures/example-a-builtins.d.ts +18 -0
- package/dist/__tests__/fixtures/example-a-builtins.d.ts.map +1 -1
- package/dist/__tests__/guards.test.d.ts +2 -0
- package/dist/__tests__/guards.test.d.ts.map +1 -0
- package/dist/__tests__/ir-analyzer.test.d.ts +11 -0
- package/dist/__tests__/ir-analyzer.test.d.ts.map +1 -0
- package/dist/__tests__/ir-jsdoc-constraints.test.d.ts +12 -0
- package/dist/__tests__/ir-jsdoc-constraints.test.d.ts.map +1 -0
- package/dist/__tests__/ir-json-schema-generator.test.d.ts +11 -0
- package/dist/__tests__/ir-json-schema-generator.test.d.ts.map +1 -0
- package/dist/__tests__/ir-ui-schema-generator.test.d.ts +2 -0
- package/dist/__tests__/ir-ui-schema-generator.test.d.ts.map +1 -0
- package/dist/__tests__/jsdoc-constraints.test.d.ts +4 -4
- package/dist/__tests__/parity/fixtures/address/chain-dsl.d.ts +9 -0
- package/dist/__tests__/parity/fixtures/address/chain-dsl.d.ts.map +1 -0
- package/dist/__tests__/parity/fixtures/address/expected-ir.d.ts +9 -0
- package/dist/__tests__/parity/fixtures/address/expected-ir.d.ts.map +1 -0
- package/dist/__tests__/parity/fixtures/address/tsdoc.d.ts +19 -0
- package/dist/__tests__/parity/fixtures/address/tsdoc.d.ts.map +1 -0
- package/dist/__tests__/parity/fixtures/product-config/chain-dsl.d.ts +13 -0
- package/dist/__tests__/parity/fixtures/product-config/chain-dsl.d.ts.map +1 -0
- package/dist/__tests__/parity/fixtures/product-config/expected-ir.d.ts +9 -0
- package/dist/__tests__/parity/fixtures/product-config/expected-ir.d.ts.map +1 -0
- package/dist/__tests__/parity/fixtures/product-config/tsdoc.d.ts +28 -0
- package/dist/__tests__/parity/fixtures/product-config/tsdoc.d.ts.map +1 -0
- package/dist/__tests__/parity/fixtures/user-registration/chain-dsl.d.ts +12 -0
- package/dist/__tests__/parity/fixtures/user-registration/chain-dsl.d.ts.map +1 -0
- package/dist/__tests__/parity/fixtures/user-registration/expected-ir.d.ts +9 -0
- package/dist/__tests__/parity/fixtures/user-registration/expected-ir.d.ts.map +1 -0
- package/dist/__tests__/parity/fixtures/user-registration/tsdoc.d.ts +19 -0
- package/dist/__tests__/parity/fixtures/user-registration/tsdoc.d.ts.map +1 -0
- package/dist/__tests__/parity/parity.test.d.ts +14 -0
- package/dist/__tests__/parity/parity.test.d.ts.map +1 -0
- package/dist/__tests__/parity/utils.d.ts +139 -0
- package/dist/__tests__/parity/utils.d.ts.map +1 -0
- package/dist/analyzer/class-analyzer.d.ts +54 -99
- package/dist/analyzer/class-analyzer.d.ts.map +1 -1
- package/dist/analyzer/jsdoc-constraints.d.ts +78 -30
- package/dist/analyzer/jsdoc-constraints.d.ts.map +1 -1
- package/dist/analyzer/tsdoc-parser.d.ts +61 -0
- package/dist/analyzer/tsdoc-parser.d.ts.map +1 -0
- package/dist/browser.cjs +998 -309
- package/dist/browser.cjs.map +1 -1
- package/dist/browser.d.ts +10 -6
- package/dist/browser.d.ts.map +1 -1
- package/dist/browser.js +996 -308
- package/dist/browser.js.map +1 -1
- package/dist/build.d.ts +65 -150
- package/dist/canonicalize/chain-dsl-canonicalizer.d.ts +18 -0
- package/dist/canonicalize/chain-dsl-canonicalizer.d.ts.map +1 -0
- package/dist/canonicalize/index.d.ts +8 -0
- package/dist/canonicalize/index.d.ts.map +1 -0
- package/dist/canonicalize/tsdoc-canonicalizer.d.ts +34 -0
- package/dist/canonicalize/tsdoc-canonicalizer.d.ts.map +1 -0
- package/dist/cli.cjs +1455 -1656
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +1459 -1647
- package/dist/cli.js.map +1 -1
- package/dist/extensions/index.d.ts +8 -0
- package/dist/extensions/index.d.ts.map +1 -0
- package/dist/extensions/registry.d.ts +55 -0
- package/dist/extensions/registry.d.ts.map +1 -0
- package/dist/generators/class-schema.d.ts +23 -38
- package/dist/generators/class-schema.d.ts.map +1 -1
- package/dist/generators/method-schema.d.ts +6 -8
- package/dist/generators/method-schema.d.ts.map +1 -1
- package/dist/index.cjs +1391 -1614
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +6 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1403 -1610
- package/dist/index.js.map +1 -1
- package/dist/internals.cjs +1642 -824
- package/dist/internals.cjs.map +1 -1
- package/dist/internals.d.ts +12 -3
- package/dist/internals.d.ts.map +1 -1
- package/dist/internals.js +1645 -820
- package/dist/internals.js.map +1 -1
- package/dist/json-schema/generator.d.ts +10 -5
- package/dist/json-schema/generator.d.ts.map +1 -1
- package/dist/json-schema/ir-generator.d.ts +84 -0
- package/dist/json-schema/ir-generator.d.ts.map +1 -0
- package/dist/json-schema/schema.d.ts +3 -3
- package/dist/json-schema/types.d.ts +5 -6
- package/dist/json-schema/types.d.ts.map +1 -1
- package/dist/ui-schema/generator.d.ts +5 -15
- package/dist/ui-schema/generator.d.ts.map +1 -1
- package/dist/ui-schema/ir-generator.d.ts +53 -0
- package/dist/ui-schema/ir-generator.d.ts.map +1 -0
- package/dist/validate/constraint-validator.d.ts +66 -0
- package/dist/validate/constraint-validator.d.ts.map +1 -0
- package/dist/validate/index.d.ts +9 -0
- package/dist/validate/index.d.ts.map +1 -0
- package/package.json +5 -4
- package/dist/__tests__/analyzer-edge-cases.test.d.ts +0 -13
- package/dist/__tests__/analyzer-edge-cases.test.d.ts.map +0 -1
- package/dist/__tests__/analyzer.test.d.ts +0 -5
- package/dist/__tests__/analyzer.test.d.ts.map +0 -1
- package/dist/__tests__/codegen.test.d.ts +0 -5
- package/dist/__tests__/codegen.test.d.ts.map +0 -1
- package/dist/__tests__/decorator-pipeline.test.d.ts +0 -11
- package/dist/__tests__/decorator-pipeline.test.d.ts.map +0 -1
- package/dist/__tests__/fixtures/example-b-decorators.d.ts +0 -5
- package/dist/__tests__/fixtures/example-b-decorators.d.ts.map +0 -1
- package/dist/__tests__/fixtures/example-b-extended.d.ts +0 -5
- package/dist/__tests__/fixtures/example-b-extended.d.ts.map +0 -1
- package/dist/__tests__/fixtures/example-c-custom.d.ts +0 -5
- package/dist/__tests__/fixtures/example-c-custom.d.ts.map +0 -1
- package/dist/__tests__/fixtures/example-c-decorators.d.ts +0 -5
- package/dist/__tests__/fixtures/example-c-decorators.d.ts.map +0 -1
- package/dist/__tests__/fixtures/example-d-mixed-decorators.d.ts +0 -6
- package/dist/__tests__/fixtures/example-d-mixed-decorators.d.ts.map +0 -1
- package/dist/__tests__/fixtures/example-e-decorators.d.ts +0 -11
- package/dist/__tests__/fixtures/example-e-decorators.d.ts.map +0 -1
- package/dist/__tests__/fixtures/example-e-no-namespace.d.ts +0 -5
- package/dist/__tests__/fixtures/example-e-no-namespace.d.ts.map +0 -1
- package/dist/__tests__/fixtures/example-jsdoc-constraints.d.ts +0 -16
- package/dist/__tests__/fixtures/example-jsdoc-constraints.d.ts.map +0 -1
- package/dist/__tests__/fixtures/example-nested-class.d.ts +0 -45
- package/dist/__tests__/fixtures/example-nested-class.d.ts.map +0 -1
- package/dist/__tests__/interface-types.test.d.ts +0 -11
- package/dist/__tests__/interface-types.test.d.ts.map +0 -1
- package/dist/analyzer/decorator-extractor.d.ts +0 -78
- package/dist/analyzer/decorator-extractor.d.ts.map +0 -1
- package/dist/analyzer/type-converter.d.ts +0 -75
- package/dist/analyzer/type-converter.d.ts.map +0 -1
- package/dist/codegen/index.d.ts +0 -75
- package/dist/codegen/index.d.ts.map +0 -1
package/README.md
CHANGED
|
@@ -79,13 +79,46 @@ const jsonSchema = generateJsonSchema(ContactForm);
|
|
|
79
79
|
const uiSchema = generateUiSchema(ContactForm);
|
|
80
80
|
```
|
|
81
81
|
|
|
82
|
+
### Canonical IR Pipeline
|
|
83
|
+
|
|
84
|
+
The build pipeline now flows through a Canonical Intermediate Representation (IR). When you call `buildFormSchemas()`, the form definition is first converted to IR, then the IR is compiled to JSON Schema and UI Schema:
|
|
85
|
+
|
|
86
|
+
```
|
|
87
|
+
FormSpec definition → Canonical IR → JSON Schema + UI Schema
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
This enables consistent processing regardless of whether forms are defined via the Chain DSL or analyzed from TypeScript source files.
|
|
91
|
+
|
|
92
|
+
### Generate from TypeScript Classes
|
|
93
|
+
|
|
94
|
+
Generate schemas from TypeScript class definitions using static analysis of JSDoc constraint tags:
|
|
95
|
+
|
|
96
|
+
```typescript
|
|
97
|
+
import { generateSchemasFromClass } from "@formspec/build";
|
|
98
|
+
|
|
99
|
+
const { jsonSchema, uiSchema } = generateSchemasFromClass({
|
|
100
|
+
filePath: "./src/forms.ts",
|
|
101
|
+
className: "UserForm",
|
|
102
|
+
});
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
The analyzer extracts type information and JSDoc constraint tags (e.g., `/** @Minimum 0 @Maximum 100 */`) from class properties to generate schemas.
|
|
106
|
+
|
|
107
|
+
### Entry Points
|
|
108
|
+
|
|
109
|
+
| Entry Point | Audience | Description |
|
|
110
|
+
| ------------------------- | ------------------ | ------------------------------------------------------------------------------------------------- |
|
|
111
|
+
| `@formspec/build` | Public API | `buildFormSchemas`, `writeSchemas`, `generateSchemasFromClass`, schema generators |
|
|
112
|
+
| `@formspec/build/browser` | Browser (playground) | Schema generators without Node.js `fs`/`path` — safe for bundlers |
|
|
113
|
+
| `@formspec/build/internals` | CLI (unstable) | Internal APIs: `createProgramContext`, `analyzeClass`, `generateClassSchemas` |
|
|
114
|
+
|
|
82
115
|
## Generated Output
|
|
83
116
|
|
|
84
|
-
### JSON Schema (
|
|
117
|
+
### JSON Schema (2020-12)
|
|
85
118
|
|
|
86
119
|
```json
|
|
87
120
|
{
|
|
88
|
-
"$schema": "https://json-schema.org/draft-
|
|
121
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
89
122
|
"type": "object",
|
|
90
123
|
"properties": {
|
|
91
124
|
"name": { "type": "string", "title": "Name" },
|
|
@@ -116,22 +149,25 @@ const uiSchema = generateUiSchema(ContactForm);
|
|
|
116
149
|
|
|
117
150
|
### Functions
|
|
118
151
|
|
|
119
|
-
| Function
|
|
120
|
-
|
|
|
121
|
-
| `buildFormSchemas(form)`
|
|
122
|
-
| `generateJsonSchema(form)`
|
|
123
|
-
| `generateUiSchema(form)`
|
|
124
|
-
| `writeSchemas(form, options)`
|
|
152
|
+
| Function | Description |
|
|
153
|
+
| ------------------------------------ | ------------------------------------------------------------------ |
|
|
154
|
+
| `buildFormSchemas(form)` | Generate both JSON Schema and UI Schema |
|
|
155
|
+
| `generateJsonSchema(form)` | Generate only JSON Schema |
|
|
156
|
+
| `generateUiSchema(form)` | Generate only UI Schema |
|
|
157
|
+
| `writeSchemas(form, options)` | Build and write schemas to disk |
|
|
158
|
+
| `generateSchemasFromClass(options)` | Generate schemas from a TypeScript class via static analysis |
|
|
159
|
+
| `generateSchemas(options)` | Generate schemas from a TypeScript type via static analysis |
|
|
125
160
|
|
|
126
161
|
### Types
|
|
127
162
|
|
|
128
|
-
| Type
|
|
129
|
-
|
|
|
130
|
-
| `BuildResult`
|
|
131
|
-
| `WriteSchemasOptions`
|
|
132
|
-
| `WriteSchemasResult`
|
|
133
|
-
| `
|
|
134
|
-
| `
|
|
163
|
+
| Type | Description |
|
|
164
|
+
| ------------------------- | --------------------------------------- |
|
|
165
|
+
| `BuildResult` | Return type of `buildFormSchemas` |
|
|
166
|
+
| `WriteSchemasOptions` | Options for `writeSchemas` |
|
|
167
|
+
| `WriteSchemasResult` | Return type of `writeSchemas` |
|
|
168
|
+
| `JsonSchema2020` | JSON Schema 2020-12 type |
|
|
169
|
+
| `GenerateFromClassOptions` | Options for `generateSchemasFromClass` |
|
|
170
|
+
| `UISchema` | JSON Forms UI Schema type |
|
|
135
171
|
|
|
136
172
|
## License
|
|
137
173
|
|
|
@@ -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 @@
|
|
|
1
|
+
{"version":3,"file":"constraint-validator.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/constraint-validator.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extension-api.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/extension-api.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,8 +1,26 @@
|
|
|
1
1
|
export declare class ExampleAForm {
|
|
2
|
+
/** @Field_displayName Full Name
|
|
3
|
+
* @Field_description Your legal name
|
|
4
|
+
* @MinLength 2
|
|
5
|
+
* @MaxLength 100
|
|
6
|
+
*/
|
|
2
7
|
name: string;
|
|
8
|
+
/** @Field_displayName Age
|
|
9
|
+
* @Minimum 0
|
|
10
|
+
* @Maximum 150
|
|
11
|
+
*/
|
|
3
12
|
age: number;
|
|
13
|
+
/** @Field_displayName Score
|
|
14
|
+
* @ExclusiveMinimum 0
|
|
15
|
+
*/
|
|
4
16
|
score: number;
|
|
17
|
+
/** @Field_displayName Email
|
|
18
|
+
* @Pattern ^[^@]+@[^@]+$
|
|
19
|
+
*/
|
|
5
20
|
email?: string;
|
|
21
|
+
/** @Field_displayName Country
|
|
22
|
+
* @EnumOptions [{"id":"us","label":"United States"},{"id":"ca","label":"Canada"}]
|
|
23
|
+
*/
|
|
6
24
|
country: "us" | "ca";
|
|
7
25
|
state?: string;
|
|
8
26
|
/** @deprecated Use email instead */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"example-a-builtins.d.ts","sourceRoot":"","sources":["../../../src/__tests__/fixtures/example-a-builtins.ts"],"names":[],"mappings":"
|
|
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 @@
|
|
|
1
|
+
{"version":3,"file":"guards.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/guards.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tests for the IR analysis pipeline.
|
|
3
|
+
*
|
|
4
|
+
* Verifies that `analyzeClassToIR`, `analyzeInterfaceToIR`, and
|
|
5
|
+
* `analyzeTypeAliasToIR` produce canonical IR nodes (FieldNode,
|
|
6
|
+
* TypeNode, ConstraintNode, AnnotationNode) directly.
|
|
7
|
+
*
|
|
8
|
+
* @see packages/core/src/types/ir.ts for IR type definitions
|
|
9
|
+
*/
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=ir-analyzer.test.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ir-analyzer.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/ir-analyzer.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tests for JSDoc constraint and annotation extraction to IR nodes.
|
|
3
|
+
*
|
|
4
|
+
* Verifies that {@link extractJSDocConstraintNodes} produces
|
|
5
|
+
* {@link ConstraintNode} and {@link extractJSDocAnnotationNodes} produces
|
|
6
|
+
* {@link AnnotationNode} directly.
|
|
7
|
+
*
|
|
8
|
+
* @see packages/core/src/types/ir.ts for IR type definitions
|
|
9
|
+
* @see packages/core/src/types/constraint-definitions.ts for BUILTIN_CONSTRAINT_DEFINITIONS
|
|
10
|
+
*/
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=ir-jsdoc-constraints.test.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ir-jsdoc-constraints.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/ir-jsdoc-constraints.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tests for `generateJsonSchemaFromIR`.
|
|
3
|
+
*
|
|
4
|
+
* All tests use hand-constructed FormIR objects and assert against expected
|
|
5
|
+
* JSON Schema 2020-12 output per design doc 003. Tests do NOT compare against
|
|
6
|
+
* the legacy `generateJsonSchema` function.
|
|
7
|
+
*
|
|
8
|
+
* @see scratch/design/003-json-schema-vocabulary.md
|
|
9
|
+
*/
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=ir-json-schema-generator.test.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ir-json-schema-generator.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/ir-json-schema-generator.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ir-ui-schema-generator.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/ir-ui-schema-generator.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Unit tests for JSDoc constraint
|
|
2
|
+
* Unit tests for JSDoc constraint extraction.
|
|
3
3
|
*
|
|
4
|
-
* Verifies that {@link extractJSDocConstraints} correctly parses
|
|
5
|
-
*
|
|
4
|
+
* Verifies that {@link extractJSDocConstraints} correctly parses JSDoc
|
|
5
|
+
* constraints into synthetic ConstraintInfo objects.
|
|
6
6
|
*
|
|
7
|
-
* @see packages/core/src/types/
|
|
7
|
+
* @see packages/core/src/types/constraint-definitions.ts for BUILTIN_CONSTRAINT_DEFINITIONS
|
|
8
8
|
*/
|
|
9
9
|
export {};
|
|
10
10
|
//# sourceMappingURL=jsdoc-constraints.test.d.ts.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parity fixture — address — chain DSL definition.
|
|
3
|
+
*
|
|
4
|
+
* A simple address form with string fields for street, city, and postal code.
|
|
5
|
+
* No constraints or annotations so the provenance-free IR can be compared
|
|
6
|
+
* directly with the TSDoc equivalent.
|
|
7
|
+
*/
|
|
8
|
+
export declare const addressForm: import("@formspec/core").FormSpec<readonly [import("@formspec/core").TextField<"street">, import("@formspec/core").TextField<"city">, import("@formspec/core").TextField<"postalCode">, import("@formspec/core").TextField<"country">]>;
|
|
9
|
+
//# sourceMappingURL=chain-dsl.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chain-dsl.d.ts","sourceRoot":"","sources":["../../../../../src/__tests__/parity/fixtures/address/chain-dsl.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,eAAO,MAAM,WAAW,yOAKvB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parity fixture — address — expected provenance-free IR.
|
|
3
|
+
*
|
|
4
|
+
* This is the canonical shape both the chain DSL and TSDoc surfaces must
|
|
5
|
+
* produce (after provenance stripping) for the address form.
|
|
6
|
+
*/
|
|
7
|
+
import type { ProvenanceFreeFormIR } from "../../utils.js";
|
|
8
|
+
export declare const expectedIR: ProvenanceFreeFormIR;
|
|
9
|
+
//# sourceMappingURL=expected-ir.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"expected-ir.d.ts","sourceRoot":"","sources":["../../../../../src/__tests__/parity/fixtures/address/expected-ir.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAE3D,eAAO,MAAM,UAAU,EAAE,oBAsCxB,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parity fixture — address — TSDoc class definition.
|
|
3
|
+
*
|
|
4
|
+
* Equivalent form definition using a TypeScript class.
|
|
5
|
+
* Must produce the same provenance-free IR as the chain DSL fixture.
|
|
6
|
+
*
|
|
7
|
+
* Field mapping:
|
|
8
|
+
* street: string (required) → field.text("street", { required: true })
|
|
9
|
+
* city: string (required) → field.text("city", { required: true })
|
|
10
|
+
* postalCode: string (required) → field.text("postalCode", { required: true })
|
|
11
|
+
* country: string (optional) → field.text("country")
|
|
12
|
+
*/
|
|
13
|
+
export declare class AddressForm {
|
|
14
|
+
street: string;
|
|
15
|
+
city: string;
|
|
16
|
+
postalCode: string;
|
|
17
|
+
country?: string;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=tsdoc.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tsdoc.d.ts","sourceRoot":"","sources":["../../../../../src/__tests__/parity/fixtures/address/tsdoc.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,qBAAa,WAAW;IACtB,MAAM,EAAG,MAAM,CAAC;IAChB,IAAI,EAAG,MAAM,CAAC;IACd,UAAU,EAAG,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parity fixture — product-config — chain DSL definition.
|
|
3
|
+
*
|
|
4
|
+
* A product configuration form with a nested object field for pricing.
|
|
5
|
+
* Uses field.objectWithConfig() to create an inline ObjectTypeNode — matching
|
|
6
|
+
* the anonymous inline object type used in the TSDoc fixture.
|
|
7
|
+
*
|
|
8
|
+
* Named classes/interfaces in the TSDoc fixture would produce a ReferenceTypeNode
|
|
9
|
+
* via the type registry, which would diverge from the chain DSL inline object.
|
|
10
|
+
* Both surfaces therefore use anonymous inline objects for the nested type.
|
|
11
|
+
*/
|
|
12
|
+
export declare const productConfigForm: import("@formspec/core").FormSpec<readonly [import("@formspec/core").TextField<"sku">, import("@formspec/core").TextField<"name">, import("@formspec/core").BooleanField<"available">, import("@formspec/core").ObjectField<"pricing", readonly [import("@formspec/core").NumberField<"basePrice">, import("@formspec/core").TextField<"currency">]>]>;
|
|
13
|
+
//# sourceMappingURL=chain-dsl.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chain-dsl.d.ts","sourceRoot":"","sources":["../../../../../src/__tests__/parity/fixtures/product-config/chain-dsl.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAIH,eAAO,MAAM,iBAAiB,wVAU7B,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parity fixture — product-config — expected provenance-free IR.
|
|
3
|
+
*
|
|
4
|
+
* This is the canonical shape both the chain DSL and TSDoc surfaces must
|
|
5
|
+
* produce (after provenance stripping) for the product-config form.
|
|
6
|
+
*/
|
|
7
|
+
import type { ProvenanceFreeFormIR } from "../../utils.js";
|
|
8
|
+
export declare const expectedIR: ProvenanceFreeFormIR;
|
|
9
|
+
//# sourceMappingURL=expected-ir.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"expected-ir.d.ts","sourceRoot":"","sources":["../../../../../src/__tests__/parity/fixtures/product-config/expected-ir.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAE3D,eAAO,MAAM,UAAU,EAAE,oBAyDxB,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parity fixture — product-config — TSDoc class definition.
|
|
3
|
+
*
|
|
4
|
+
* Equivalent form definition using a TypeScript class.
|
|
5
|
+
* Must produce the same provenance-free IR as the chain DSL fixture.
|
|
6
|
+
*
|
|
7
|
+
* The `pricing` field uses an anonymous inline object type so the TSDoc
|
|
8
|
+
* canonicalizer produces an inline ObjectTypeNode (not a ReferenceTypeNode).
|
|
9
|
+
* A named class or interface would be placed in the type registry and produce
|
|
10
|
+
* a ReferenceTypeNode, which would diverge from the chain DSL output.
|
|
11
|
+
*
|
|
12
|
+
* Field mapping:
|
|
13
|
+
* sku: string (required) → field.text("sku", { required: true })
|
|
14
|
+
* name: string (required) → field.text("name", { required: true })
|
|
15
|
+
* available: boolean (optional) → field.boolean("available")
|
|
16
|
+
* pricing.basePrice: number (required) → field.number("basePrice", { required: true })
|
|
17
|
+
* pricing.currency: string (required) → field.text("currency", { required: true })
|
|
18
|
+
*/
|
|
19
|
+
export declare class ProductConfigForm {
|
|
20
|
+
sku: string;
|
|
21
|
+
name: string;
|
|
22
|
+
available?: boolean;
|
|
23
|
+
pricing: {
|
|
24
|
+
basePrice: number;
|
|
25
|
+
currency: string;
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=tsdoc.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tsdoc.d.ts","sourceRoot":"","sources":["../../../../../src/__tests__/parity/fixtures/product-config/tsdoc.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,qBAAa,iBAAiB;IAC5B,GAAG,EAAG,MAAM,CAAC;IACb,IAAI,EAAG,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,OAAO,EAAG;QACR,SAAS,EAAE,MAAM,CAAC;QAClB,QAAQ,EAAE,MAAM,CAAC;KAClB,CAAC;CACH"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parity fixture — user-registration — chain DSL definition.
|
|
3
|
+
*
|
|
4
|
+
* A user registration form with a mix of text, boolean, and enum fields.
|
|
5
|
+
* No constraints or annotations so the provenance-free IR can be compared
|
|
6
|
+
* directly with the TSDoc equivalent.
|
|
7
|
+
*
|
|
8
|
+
* Uses plain string enum options to match the string literal union type
|
|
9
|
+
* produced by the TSDoc surface.
|
|
10
|
+
*/
|
|
11
|
+
export declare const userRegistrationForm: import("@formspec/core").FormSpec<readonly [import("@formspec/core").TextField<"email">, import("@formspec/core").TextField<"username">, import("@formspec/core").BooleanField<"agreedToTerms">, import("@formspec/core").StaticEnumField<"accountType", readonly ["personal", "business", "enterprise"]>]>;
|
|
12
|
+
//# sourceMappingURL=chain-dsl.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chain-dsl.d.ts","sourceRoot":"","sources":["../../../../../src/__tests__/parity/fixtures/user-registration/chain-dsl.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,eAAO,MAAM,oBAAoB,6SAKhC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parity fixture — user-registration — expected provenance-free IR.
|
|
3
|
+
*
|
|
4
|
+
* This is the canonical shape both the chain DSL and TSDoc surfaces must
|
|
5
|
+
* produce (after provenance stripping) for the user-registration form.
|
|
6
|
+
*/
|
|
7
|
+
import type { ProvenanceFreeFormIR } from "../../utils.js";
|
|
8
|
+
export declare const expectedIR: ProvenanceFreeFormIR;
|
|
9
|
+
//# sourceMappingURL=expected-ir.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"expected-ir.d.ts","sourceRoot":"","sources":["../../../../../src/__tests__/parity/fixtures/user-registration/expected-ir.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAE3D,eAAO,MAAM,UAAU,EAAE,oBAyCxB,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parity fixture — user-registration — TSDoc class definition.
|
|
3
|
+
*
|
|
4
|
+
* Equivalent form definition using a TypeScript class.
|
|
5
|
+
* Must produce the same provenance-free IR as the chain DSL fixture.
|
|
6
|
+
*
|
|
7
|
+
* Field mapping:
|
|
8
|
+
* email: string (required) → field.text("email", { required: true })
|
|
9
|
+
* username: string (required) → field.text("username", { required: true })
|
|
10
|
+
* agreedToTerms: boolean (required) → field.boolean("agreedToTerms", { required: true })
|
|
11
|
+
* accountType: "personal" | "business" | "enterprise" (req) → field.enum("accountType", [...] as const, { required: true })
|
|
12
|
+
*/
|
|
13
|
+
export declare class UserRegistrationForm {
|
|
14
|
+
email: string;
|
|
15
|
+
username: string;
|
|
16
|
+
agreedToTerms: boolean;
|
|
17
|
+
accountType: "personal" | "business" | "enterprise";
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=tsdoc.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tsdoc.d.ts","sourceRoot":"","sources":["../../../../../src/__tests__/parity/fixtures/user-registration/tsdoc.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,qBAAa,oBAAoB;IAC/B,KAAK,EAAG,MAAM,CAAC;IACf,QAAQ,EAAG,MAAM,CAAC;IAClB,aAAa,EAAG,OAAO,CAAC;IACxB,WAAW,EAAG,UAAU,GAAG,UAAU,GAAG,YAAY,CAAC;CACtD"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parity tests.
|
|
3
|
+
*
|
|
4
|
+
* Proves that both authoring surfaces (chain DSL and TSDoc/class annotations)
|
|
5
|
+
* produce identical intermediate representations (IR) for equivalent form
|
|
6
|
+
* definitions, modulo provenance metadata.
|
|
7
|
+
*
|
|
8
|
+
* Three-test pattern per fixture:
|
|
9
|
+
* 1. Chain DSL → IR matches expected IR
|
|
10
|
+
* 2. TSDoc class → IR matches expected IR
|
|
11
|
+
* 3. Chain DSL IR === TSDoc IR (modulo provenance)
|
|
12
|
+
*/
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=parity.test.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parity.test.d.ts","sourceRoot":"","sources":["../../../src/__tests__/parity/parity.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG"}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parity testing utilities.
|
|
3
|
+
*
|
|
4
|
+
* Provides:
|
|
5
|
+
* - `ProvenanceFree<T>` — type-level mapper that strips `provenance` fields from IR nodes
|
|
6
|
+
* - `stripProvenance(ir)` — runtime equivalent for `FormIR`
|
|
7
|
+
* - `compareIR(a, b)` — structured IR comparison after stripping provenance
|
|
8
|
+
*
|
|
9
|
+
* `ProvenanceFree<T>` is implemented as explicit per-type mapped interfaces rather
|
|
10
|
+
* than a generic deep-recursive mapped type. This keeps the type system's structural
|
|
11
|
+
* guarantees intact: if an IR node gains or loses a field, the provenance-free variants
|
|
12
|
+
* here will fail to compile, catching shape regressions at type-check time.
|
|
13
|
+
*/
|
|
14
|
+
import type { FormIR, FormIRElement, PrimitiveTypeNode, EnumMember, DynamicTypeNode, CustomTypeNode, NumericConstraintNode, LengthConstraintNode, PatternConstraintNode, ArrayCardinalityConstraintNode, EnumMemberConstraintNode, CustomConstraintNode, DisplayNameAnnotationNode, DescriptionAnnotationNode, PlaceholderAnnotationNode, DefaultValueAnnotationNode, DeprecatedAnnotationNode, FormatHintAnnotationNode, CustomAnnotationNode, JsonValue } from "@formspec/core";
|
|
15
|
+
/** Primitive type node has no `provenance` field — pass through unchanged. */
|
|
16
|
+
export type ProvenanceFreePrimitiveTypeNode = PrimitiveTypeNode;
|
|
17
|
+
/** Enum member has no `provenance` field. */
|
|
18
|
+
export type ProvenanceFreeEnumMember = EnumMember;
|
|
19
|
+
/** Enum type node has no `provenance` field. */
|
|
20
|
+
export interface ProvenanceFreeEnumTypeNode {
|
|
21
|
+
readonly kind: "enum";
|
|
22
|
+
readonly members: readonly ProvenanceFreeEnumMember[];
|
|
23
|
+
}
|
|
24
|
+
/** Array type node — items type is recursively provenance-free. */
|
|
25
|
+
export interface ProvenanceFreeArrayTypeNode {
|
|
26
|
+
readonly kind: "array";
|
|
27
|
+
readonly items: ProvenanceFreeTypeNode;
|
|
28
|
+
}
|
|
29
|
+
/** Object property with `provenance` stripped and nested types recursively mapped. */
|
|
30
|
+
export interface ProvenanceFreeObjectProperty {
|
|
31
|
+
readonly name: string;
|
|
32
|
+
readonly type: ProvenanceFreeTypeNode;
|
|
33
|
+
readonly optional: boolean;
|
|
34
|
+
readonly constraints: readonly ProvenanceFreeConstraintNode[];
|
|
35
|
+
readonly annotations: readonly ProvenanceFreeAnnotationNode[];
|
|
36
|
+
}
|
|
37
|
+
/** Object type node — properties are recursively provenance-free. */
|
|
38
|
+
export interface ProvenanceFreeObjectTypeNode {
|
|
39
|
+
readonly kind: "object";
|
|
40
|
+
readonly properties: readonly ProvenanceFreeObjectProperty[];
|
|
41
|
+
readonly additionalProperties: boolean;
|
|
42
|
+
}
|
|
43
|
+
/** Union type node — members are recursively provenance-free. */
|
|
44
|
+
export interface ProvenanceFreeUnionTypeNode {
|
|
45
|
+
readonly kind: "union";
|
|
46
|
+
readonly members: readonly ProvenanceFreeTypeNode[];
|
|
47
|
+
}
|
|
48
|
+
/** Reference type node — type arguments are recursively provenance-free. */
|
|
49
|
+
export interface ProvenanceFreeReferenceTypeNode {
|
|
50
|
+
readonly kind: "reference";
|
|
51
|
+
readonly name: string;
|
|
52
|
+
readonly typeArguments: readonly ProvenanceFreeTypeNode[];
|
|
53
|
+
}
|
|
54
|
+
/** Dynamic type node has no `provenance` field — pass through unchanged. */
|
|
55
|
+
export type ProvenanceFreeDynamicTypeNode = DynamicTypeNode;
|
|
56
|
+
/** Custom type node has no `provenance` field — pass through unchanged. */
|
|
57
|
+
export type ProvenanceFreeCustomTypeNode = CustomTypeNode;
|
|
58
|
+
/** Union of all provenance-free type node variants. */
|
|
59
|
+
export type ProvenanceFreeTypeNode = ProvenanceFreePrimitiveTypeNode | ProvenanceFreeEnumTypeNode | ProvenanceFreeArrayTypeNode | ProvenanceFreeObjectTypeNode | ProvenanceFreeUnionTypeNode | ProvenanceFreeReferenceTypeNode | ProvenanceFreeDynamicTypeNode | ProvenanceFreeCustomTypeNode;
|
|
60
|
+
export type ProvenanceFreeNumericConstraintNode = Omit<NumericConstraintNode, "provenance">;
|
|
61
|
+
export type ProvenanceFreeLengthConstraintNode = Omit<LengthConstraintNode, "provenance">;
|
|
62
|
+
export type ProvenanceFreePatternConstraintNode = Omit<PatternConstraintNode, "provenance">;
|
|
63
|
+
export type ProvenanceFreeArrayCardinalityConstraintNode = Omit<ArrayCardinalityConstraintNode, "provenance">;
|
|
64
|
+
export type ProvenanceFreeEnumMemberConstraintNode = Omit<EnumMemberConstraintNode, "provenance">;
|
|
65
|
+
export type ProvenanceFreeCustomConstraintNode = Omit<CustomConstraintNode, "provenance">;
|
|
66
|
+
export type ProvenanceFreeConstraintNode = ProvenanceFreeNumericConstraintNode | ProvenanceFreeLengthConstraintNode | ProvenanceFreePatternConstraintNode | ProvenanceFreeArrayCardinalityConstraintNode | ProvenanceFreeEnumMemberConstraintNode | ProvenanceFreeCustomConstraintNode;
|
|
67
|
+
export type ProvenanceFreeDisplayNameAnnotationNode = Omit<DisplayNameAnnotationNode, "provenance">;
|
|
68
|
+
export type ProvenanceFreeDescriptionAnnotationNode = Omit<DescriptionAnnotationNode, "provenance">;
|
|
69
|
+
export type ProvenanceFreePlaceholderAnnotationNode = Omit<PlaceholderAnnotationNode, "provenance">;
|
|
70
|
+
export type ProvenanceFreeDefaultValueAnnotationNode = Omit<DefaultValueAnnotationNode, "provenance">;
|
|
71
|
+
export type ProvenanceFreeDeprecatedAnnotationNode = Omit<DeprecatedAnnotationNode, "provenance">;
|
|
72
|
+
export type ProvenanceFreeFormatHintAnnotationNode = Omit<FormatHintAnnotationNode, "provenance">;
|
|
73
|
+
export type ProvenanceFreeCustomAnnotationNode = Omit<CustomAnnotationNode, "provenance">;
|
|
74
|
+
export type ProvenanceFreeAnnotationNode = ProvenanceFreeDisplayNameAnnotationNode | ProvenanceFreeDescriptionAnnotationNode | ProvenanceFreePlaceholderAnnotationNode | ProvenanceFreeDefaultValueAnnotationNode | ProvenanceFreeDeprecatedAnnotationNode | ProvenanceFreeFormatHintAnnotationNode | ProvenanceFreeCustomAnnotationNode;
|
|
75
|
+
/** Field node with `provenance` and `mergeHistory` stripped; nested structures recursively mapped. */
|
|
76
|
+
export interface ProvenanceFreeFieldNode {
|
|
77
|
+
readonly kind: "field";
|
|
78
|
+
readonly name: string;
|
|
79
|
+
readonly type: ProvenanceFreeTypeNode;
|
|
80
|
+
readonly required: boolean;
|
|
81
|
+
readonly constraints: readonly ProvenanceFreeConstraintNode[];
|
|
82
|
+
readonly annotations: readonly ProvenanceFreeAnnotationNode[];
|
|
83
|
+
}
|
|
84
|
+
/** Group layout node with `provenance` stripped; elements are recursively mapped. */
|
|
85
|
+
export interface ProvenanceFreeGroupLayoutNode {
|
|
86
|
+
readonly kind: "group";
|
|
87
|
+
readonly label: string;
|
|
88
|
+
readonly elements: readonly ProvenanceFreeFormIRElement[];
|
|
89
|
+
}
|
|
90
|
+
/** Conditional layout node with `provenance` stripped. */
|
|
91
|
+
export interface ProvenanceFreeConditionalLayoutNode {
|
|
92
|
+
readonly kind: "conditional";
|
|
93
|
+
readonly fieldName: string;
|
|
94
|
+
readonly value: JsonValue;
|
|
95
|
+
readonly elements: readonly ProvenanceFreeFormIRElement[];
|
|
96
|
+
}
|
|
97
|
+
/** Union of all provenance-free IR element types. */
|
|
98
|
+
export type ProvenanceFreeFormIRElement = ProvenanceFreeFieldNode | ProvenanceFreeGroupLayoutNode | ProvenanceFreeConditionalLayoutNode;
|
|
99
|
+
/** TypeDefinition with `provenance` stripped. */
|
|
100
|
+
export interface ProvenanceFreeTypeDefinition {
|
|
101
|
+
readonly name: string;
|
|
102
|
+
readonly type: ProvenanceFreeTypeNode;
|
|
103
|
+
}
|
|
104
|
+
/** The top-level `FormIR` with all `provenance` fields stripped. */
|
|
105
|
+
export interface ProvenanceFreeFormIR {
|
|
106
|
+
readonly kind: "form-ir";
|
|
107
|
+
readonly irVersion: string;
|
|
108
|
+
readonly elements: readonly ProvenanceFreeFormIRElement[];
|
|
109
|
+
readonly typeRegistry: Record<string, ProvenanceFreeTypeDefinition>;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* A structured description of a single difference between two IR trees.
|
|
113
|
+
* Path uses dot notation for object properties and `[n]` for array indices.
|
|
114
|
+
*/
|
|
115
|
+
export interface IRDifference {
|
|
116
|
+
/** JSONPath-like string describing where the difference is located. */
|
|
117
|
+
readonly path: string;
|
|
118
|
+
readonly expected: unknown;
|
|
119
|
+
readonly actual: unknown;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Strips all `provenance` (and `mergeHistory`) fields from a `FormIRElement`,
|
|
123
|
+
* returning a `ProvenanceFreeFormIRElement`.
|
|
124
|
+
*/
|
|
125
|
+
export declare function stripProvenanceFromElement(element: FormIRElement): ProvenanceFreeFormIRElement;
|
|
126
|
+
/**
|
|
127
|
+
* Strips all `provenance` and `mergeHistory` fields from a complete `FormIR`,
|
|
128
|
+
* returning a `ProvenanceFreeFormIR` suitable for structural comparison.
|
|
129
|
+
*/
|
|
130
|
+
export declare function stripProvenance(ir: FormIR): ProvenanceFreeFormIR;
|
|
131
|
+
/**
|
|
132
|
+
* Compares two `FormIR` objects structurally after stripping provenance.
|
|
133
|
+
*
|
|
134
|
+
* Returns an empty array when the IRs are identical modulo provenance.
|
|
135
|
+
* Returns one `IRDifference` per divergence found, with a JSONPath-like
|
|
136
|
+
* path string indicating where the difference occurs.
|
|
137
|
+
*/
|
|
138
|
+
export declare function compareIR(a: FormIR, b: FormIR): IRDifference[];
|
|
139
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/__tests__/parity/utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EACV,MAAM,EACN,aAAa,EAKb,iBAAiB,EACjB,UAAU,EAGV,eAAe,EACf,cAAc,EAEd,qBAAqB,EACrB,oBAAoB,EACpB,qBAAqB,EACrB,8BAA8B,EAC9B,wBAAwB,EACxB,oBAAoB,EAEpB,yBAAyB,EACzB,yBAAyB,EACzB,yBAAyB,EACzB,0BAA0B,EAC1B,wBAAwB,EACxB,wBAAwB,EACxB,oBAAoB,EACpB,SAAS,EACV,MAAM,gBAAgB,CAAC;AAUxB,8EAA8E;AAC9E,MAAM,MAAM,+BAA+B,GAAG,iBAAiB,CAAC;AAEhE,6CAA6C;AAC7C,MAAM,MAAM,wBAAwB,GAAG,UAAU,CAAC;AAElD,gDAAgD;AAChD,MAAM,WAAW,0BAA0B;IACzC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,SAAS,wBAAwB,EAAE,CAAC;CACvD;AAED,mEAAmE;AACnE,MAAM,WAAW,2BAA2B;IAC1C,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,KAAK,EAAE,sBAAsB,CAAC;CACxC;AAED,sFAAsF;AACtF,MAAM,WAAW,4BAA4B;IAC3C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,I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