@formspec/build 0.1.0-alpha.15 → 0.1.0-alpha.17
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/dist/__tests__/fixtures/edge-cases.d.ts +11 -0
- package/dist/__tests__/fixtures/edge-cases.d.ts.map +1 -1
- package/dist/__tests__/fixtures/example-numeric-extension.d.ts +20 -0
- package/dist/__tests__/fixtures/example-numeric-extension.d.ts.map +1 -0
- package/dist/__tests__/fixtures/mixed-authoring-shipping-address.d.ts +31 -0
- package/dist/__tests__/fixtures/mixed-authoring-shipping-address.d.ts.map +1 -0
- package/dist/__tests__/mixed-authoring.test.d.ts +2 -0
- package/dist/__tests__/mixed-authoring.test.d.ts.map +1 -0
- package/dist/__tests__/numeric-extension.integration.test.d.ts +2 -0
- package/dist/__tests__/numeric-extension.integration.test.d.ts.map +1 -0
- package/dist/__tests__/parity/utils.d.ts +5 -3
- package/dist/__tests__/parity/utils.d.ts.map +1 -1
- package/dist/analyzer/class-analyzer.d.ts +8 -5
- package/dist/analyzer/class-analyzer.d.ts.map +1 -1
- package/dist/analyzer/jsdoc-constraints.d.ts +3 -2
- package/dist/analyzer/jsdoc-constraints.d.ts.map +1 -1
- package/dist/analyzer/tsdoc-parser.d.ts +38 -4
- package/dist/analyzer/tsdoc-parser.d.ts.map +1 -1
- package/dist/browser.cjs +371 -21
- package/dist/browser.cjs.map +1 -1
- package/dist/browser.d.ts.map +1 -1
- package/dist/browser.js +371 -21
- package/dist/browser.js.map +1 -1
- package/dist/build.d.ts +67 -3
- package/dist/canonicalize/tsdoc-canonicalizer.d.ts.map +1 -1
- package/dist/cli.cjs +1159 -150
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +1159 -150
- package/dist/cli.js.map +1 -1
- package/dist/extensions/registry.d.ts +25 -1
- package/dist/extensions/registry.d.ts.map +1 -1
- package/dist/generators/class-schema.d.ts +4 -4
- package/dist/generators/class-schema.d.ts.map +1 -1
- package/dist/generators/mixed-authoring.d.ts +45 -0
- package/dist/generators/mixed-authoring.d.ts.map +1 -0
- package/dist/index.cjs +1146 -149
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1145 -149
- package/dist/index.js.map +1 -1
- package/dist/internals.cjs +1156 -149
- package/dist/internals.cjs.map +1 -1
- package/dist/internals.js +1154 -147
- package/dist/internals.js.map +1 -1
- package/dist/json-schema/ir-generator.d.ts +3 -2
- package/dist/json-schema/ir-generator.d.ts.map +1 -1
- package/dist/ui-schema/ir-generator.d.ts.map +1 -1
- package/dist/validate/constraint-validator.d.ts.map +1 -1
- package/package.json +3 -3
- package/dist/__tests__/jsdoc-constraints.test.d.ts +0 -9
- package/dist/__tests__/jsdoc-constraints.test.d.ts.map +0 -1
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*
|
|
8
8
|
* @packageDocumentation
|
|
9
9
|
*/
|
|
10
|
-
import type { ExtensionDefinition, CustomTypeRegistration, CustomConstraintRegistration, CustomAnnotationRegistration } from "@formspec/core";
|
|
10
|
+
import type { ExtensionDefinition, CustomTypeRegistration, CustomConstraintRegistration, CustomAnnotationRegistration, ConstraintTagRegistration, BuiltinConstraintBroadeningRegistration } from "@formspec/core";
|
|
11
11
|
/**
|
|
12
12
|
* A registry of extensions that provides lookup by fully-qualified ID.
|
|
13
13
|
*
|
|
@@ -25,6 +25,16 @@ export interface ExtensionRegistry {
|
|
|
25
25
|
* @returns The registration if found, otherwise `undefined`.
|
|
26
26
|
*/
|
|
27
27
|
findType(typeId: string): CustomTypeRegistration | undefined;
|
|
28
|
+
/**
|
|
29
|
+
* Look up a custom type registration by a TypeScript-facing type name.
|
|
30
|
+
*
|
|
31
|
+
* This is used during TSDoc/class analysis to resolve extension-defined
|
|
32
|
+
* custom types from source-level declarations.
|
|
33
|
+
*/
|
|
34
|
+
findTypeByName(typeName: string): {
|
|
35
|
+
readonly extensionId: string;
|
|
36
|
+
readonly registration: CustomTypeRegistration;
|
|
37
|
+
} | undefined;
|
|
28
38
|
/**
|
|
29
39
|
* Look up a custom constraint registration by its fully-qualified constraint ID.
|
|
30
40
|
*
|
|
@@ -32,6 +42,20 @@ export interface ExtensionRegistry {
|
|
|
32
42
|
* @returns The registration if found, otherwise `undefined`.
|
|
33
43
|
*/
|
|
34
44
|
findConstraint(constraintId: string): CustomConstraintRegistration | undefined;
|
|
45
|
+
/**
|
|
46
|
+
* Look up a TSDoc custom constraint-tag registration by tag name.
|
|
47
|
+
*/
|
|
48
|
+
findConstraintTag(tagName: string): {
|
|
49
|
+
readonly extensionId: string;
|
|
50
|
+
readonly registration: ConstraintTagRegistration;
|
|
51
|
+
} | undefined;
|
|
52
|
+
/**
|
|
53
|
+
* Look up built-in tag broadening for a given custom type ID.
|
|
54
|
+
*/
|
|
55
|
+
findBuiltinConstraintBroadening(typeId: string, tagName: string): {
|
|
56
|
+
readonly extensionId: string;
|
|
57
|
+
readonly registration: BuiltinConstraintBroadeningRegistration;
|
|
58
|
+
} | undefined;
|
|
35
59
|
/**
|
|
36
60
|
* Look up a custom annotation registration by its fully-qualified annotation ID.
|
|
37
61
|
*
|
|
@@ -1 +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,
|
|
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,EAC5B,yBAAyB,EACzB,uCAAuC,EACxC,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;IAC7D;;;;;OAKG;IACH,cAAc,CACZ,QAAQ,EAAE,MAAM,GACf;QAAE,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,YAAY,EAAE,sBAAsB,CAAA;KAAE,GAAG,SAAS,CAAC;IAE/F;;;;;OAKG;IACH,cAAc,CAAC,YAAY,EAAE,MAAM,GAAG,4BAA4B,GAAG,SAAS,CAAC;IAC/E;;OAEG;IACH,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG;QAClC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;QAC7B,QAAQ,CAAC,YAAY,EAAE,yBAAyB,CAAC;KAClD,GAAG,SAAS,CAAC;IACd;;OAEG;IACH,+BAA+B,CAC7B,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,GACd;QACD,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;QAC7B,QAAQ,CAAC,YAAY,EAAE,uCAAuC,CAAC;KAChE,GAAG,SAAS,CAAC;IAEd;;;;;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,CA8FnB"}
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
import type { UISchema } from "../ui-schema/types.js";
|
|
9
9
|
import { type IRClassAnalysis } from "../analyzer/class-analyzer.js";
|
|
10
10
|
import { type TSDocSource } from "../canonicalize/index.js";
|
|
11
|
-
import { type JsonSchema2020 } from "../json-schema/ir-generator.js";
|
|
11
|
+
import { type GenerateJsonSchemaFromIROptions, type JsonSchema2020 } from "../json-schema/ir-generator.js";
|
|
12
12
|
/**
|
|
13
13
|
* Generated schemas for a class.
|
|
14
14
|
*/
|
|
@@ -28,11 +28,11 @@ export interface ClassSchemas {
|
|
|
28
28
|
* @param source - Optional source file metadata for provenance
|
|
29
29
|
* @returns Generated JSON Schema and UI Schema
|
|
30
30
|
*/
|
|
31
|
-
export declare function generateClassSchemas(analysis: IRClassAnalysis, source?: TSDocSource): ClassSchemas;
|
|
31
|
+
export declare function generateClassSchemas(analysis: IRClassAnalysis, source?: TSDocSource, options?: GenerateJsonSchemaFromIROptions): ClassSchemas;
|
|
32
32
|
/**
|
|
33
33
|
* Options for generating schemas from a decorated class.
|
|
34
34
|
*/
|
|
35
|
-
export interface GenerateFromClassOptions {
|
|
35
|
+
export interface GenerateFromClassOptions extends GenerateJsonSchemaFromIROptions {
|
|
36
36
|
/** Path to the TypeScript source file */
|
|
37
37
|
filePath: string;
|
|
38
38
|
/** Class name to analyze */
|
|
@@ -70,7 +70,7 @@ export declare function generateSchemasFromClass(options: GenerateFromClassOptio
|
|
|
70
70
|
/**
|
|
71
71
|
* Options for generating schemas from a named type (class, interface, or type alias).
|
|
72
72
|
*/
|
|
73
|
-
export interface GenerateSchemasOptions {
|
|
73
|
+
export interface GenerateSchemasOptions extends GenerateJsonSchemaFromIROptions {
|
|
74
74
|
/** Path to the TypeScript source file */
|
|
75
75
|
filePath: string;
|
|
76
76
|
/** Name of the exported class, interface, or type alias to analyze */
|
|
@@ -1 +1 @@
|
|
|
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,
|
|
1
|
+
{"version":3,"file":"class-schema.d.ts","sourceRoot":"","sources":["../../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|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Mixed-authoring schema generator.
|
|
3
|
+
*
|
|
4
|
+
* Composes a statically analyzed TSDoc/class/interface/type-alias model with
|
|
5
|
+
* ChainDSL-authored field overlays. The static model remains authoritative for
|
|
6
|
+
* structure and constraints; overlays may add runtime field behavior such as
|
|
7
|
+
* dynamic enum or dynamic schema metadata.
|
|
8
|
+
*/
|
|
9
|
+
import type { FormElement, FormSpec } from "@formspec/core";
|
|
10
|
+
import type { GenerateJsonSchemaFromIROptions, JsonSchema2020 } from "../json-schema/ir-generator.js";
|
|
11
|
+
import type { UISchema } from "../ui-schema/types.js";
|
|
12
|
+
/**
|
|
13
|
+
* Result of generating schemas from a mixed-authoring composition.
|
|
14
|
+
*/
|
|
15
|
+
export interface MixedAuthoringSchemas {
|
|
16
|
+
/** JSON Schema 2020-12 for validation. */
|
|
17
|
+
readonly jsonSchema: JsonSchema2020;
|
|
18
|
+
/** JSON Forms UI Schema for rendering. */
|
|
19
|
+
readonly uiSchema: UISchema;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Options for generating mixed-authoring schemas.
|
|
23
|
+
*
|
|
24
|
+
* The `typeName` can resolve to a class, interface, or object type alias, just
|
|
25
|
+
* like `generateSchemas()`.
|
|
26
|
+
*/
|
|
27
|
+
export interface BuildMixedAuthoringSchemasOptions extends GenerateJsonSchemaFromIROptions {
|
|
28
|
+
/** Path to the TypeScript source file. */
|
|
29
|
+
readonly filePath: string;
|
|
30
|
+
/** Name of the class, interface, or type alias to analyze. */
|
|
31
|
+
readonly typeName: string;
|
|
32
|
+
/** ChainDSL overlays to apply to the static model. Groups and conditionals are flattened by field name. */
|
|
33
|
+
readonly overlays: FormSpec<readonly FormElement[]>;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Builds JSON Schema and UI Schema from a TSDoc-derived model with ChainDSL
|
|
37
|
+
* field overlays.
|
|
38
|
+
*
|
|
39
|
+
* Overlays are matched by field name. The static model wins for structure,
|
|
40
|
+
* ordering, and constraints; ChainDSL overlays may contribute dynamic runtime
|
|
41
|
+
* field metadata such as dynamic enum or dynamic schema keywords, and may fill
|
|
42
|
+
* in missing annotations.
|
|
43
|
+
*/
|
|
44
|
+
export declare function buildMixedAuthoringSchemas(options: BuildMixedAuthoringSchemasOptions): MixedAuthoringSchemas;
|
|
45
|
+
//# sourceMappingURL=mixed-authoring.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mixed-authoring.d.ts","sourceRoot":"","sources":["../../src/generators/mixed-authoring.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAGV,WAAW,EAEX,QAAQ,EAET,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EACV,+BAA+B,EAC/B,cAAc,EACf,MAAM,gCAAgC,CAAC;AAGxC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAmBtD;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,0CAA0C;IAC1C,QAAQ,CAAC,UAAU,EAAE,cAAc,CAAC;IACpC,0CAA0C;IAC1C,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;CAC7B;AAED;;;;;GAKG;AACH,MAAM,WAAW,iCAAkC,SAAQ,+BAA+B;IACxF,0CAA0C;IAC1C,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,8DAA8D;IAC9D,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,2GAA2G;IAC3G,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC,SAAS,WAAW,EAAE,CAAC,CAAC;CACrD;AAED;;;;;;;;GAQG;AACH,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,iCAAiC,GACzC,qBAAqB,CAUvB"}
|