@formspec/build 0.1.0-alpha.58 → 0.1.0-alpha.61
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/analyzer/builtin-brands.d.ts +10 -7
- package/dist/analyzer/builtin-brands.d.ts.map +1 -1
- package/dist/analyzer/class-analyzer.d.ts +30 -1
- package/dist/analyzer/class-analyzer.d.ts.map +1 -1
- package/dist/analyzer/jsdoc-constraints.d.ts +0 -6
- package/dist/analyzer/jsdoc-constraints.d.ts.map +1 -1
- package/dist/analyzer/tsdoc-parser.d.ts +2 -5
- package/dist/analyzer/tsdoc-parser.d.ts.map +1 -1
- package/dist/browser.cjs +127 -32
- package/dist/browser.cjs.map +1 -1
- package/dist/browser.js +130 -33
- package/dist/browser.js.map +1 -1
- package/dist/build-alpha.d.ts +432 -12
- package/dist/build-beta.d.ts +400 -12
- package/dist/build-internal.d.ts +463 -12
- package/dist/build.d.ts +400 -12
- package/dist/canonicalize/chain-dsl-canonicalizer.d.ts +2 -1
- package/dist/canonicalize/chain-dsl-canonicalizer.d.ts.map +1 -1
- package/dist/canonicalize/tsdoc-canonicalizer.d.ts +2 -1
- package/dist/canonicalize/tsdoc-canonicalizer.d.ts.map +1 -1
- package/dist/cli.cjs +610 -629
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +573 -586
- package/dist/cli.js.map +1 -1
- package/dist/extensions/registry.d.ts +19 -1
- package/dist/extensions/registry.d.ts.map +1 -1
- package/dist/extensions/resolve-custom-type.d.ts.map +1 -1
- package/dist/extensions/ts-type-utils.d.ts +0 -11
- package/dist/extensions/ts-type-utils.d.ts.map +1 -1
- package/dist/generators/class-schema.d.ts.map +1 -1
- package/dist/generators/method-schema.d.ts +3 -2
- package/dist/generators/method-schema.d.ts.map +1 -1
- package/dist/index.cjs +600 -618
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +571 -583
- package/dist/index.js.map +1 -1
- package/dist/internals.cjs +573 -591
- package/dist/internals.cjs.map +1 -1
- package/dist/internals.js +540 -552
- package/dist/internals.js.map +1 -1
- package/dist/metadata/index.d.ts +1 -4
- package/dist/metadata/index.d.ts.map +1 -1
- package/dist/metadata/policy.d.ts +2 -6
- package/dist/metadata/policy.d.ts.map +1 -1
- package/dist/metadata/resolve.d.ts +3 -2
- package/dist/metadata/resolve.d.ts.map +1 -1
- package/dist/ui-schema/schema.d.ts +11 -28
- package/dist/ui-schema/schema.d.ts.map +1 -1
- package/package.json +7 -7
package/dist/build-internal.d.ts
CHANGED
|
@@ -162,6 +162,21 @@ declare interface BuiltinConstraintBroadeningRegistration_2 {
|
|
|
162
162
|
readonly parseValue: (raw: string) => ExtensionPayloadValue;
|
|
163
163
|
}
|
|
164
164
|
|
|
165
|
+
/**
|
|
166
|
+
* Registration for mapping a built-in TSDoc tag onto a custom constraint when
|
|
167
|
+
* it is used on a particular custom type.
|
|
168
|
+
*
|
|
169
|
+
* @public
|
|
170
|
+
*/
|
|
171
|
+
declare interface BuiltinConstraintBroadeningRegistration_3 {
|
|
172
|
+
/** The built-in tag being broadened, without the `@` prefix. */
|
|
173
|
+
readonly tagName: BuiltinConstraintName_2;
|
|
174
|
+
/** The custom constraint to emit for this built-in tag. */
|
|
175
|
+
readonly constraintName: string;
|
|
176
|
+
/** Parser from raw TSDoc text to extension payload. */
|
|
177
|
+
readonly parseValue: (raw: string) => ExtensionPayloadValue_2;
|
|
178
|
+
}
|
|
179
|
+
|
|
165
180
|
/**
|
|
166
181
|
* Type of a built-in constraint name.
|
|
167
182
|
*
|
|
@@ -169,6 +184,13 @@ declare interface BuiltinConstraintBroadeningRegistration_2 {
|
|
|
169
184
|
*/
|
|
170
185
|
declare type BuiltinConstraintName = "minimum" | "maximum" | "exclusiveMinimum" | "exclusiveMaximum" | "multipleOf" | "minLength" | "maxLength" | "minItems" | "maxItems" | "uniqueItems" | "pattern" | "const" | "enumOptions";
|
|
171
186
|
|
|
187
|
+
/**
|
|
188
|
+
* Type of a built-in constraint name.
|
|
189
|
+
*
|
|
190
|
+
* @public
|
|
191
|
+
*/
|
|
192
|
+
declare type BuiltinConstraintName_2 = "minimum" | "maximum" | "exclusiveMinimum" | "exclusiveMaximum" | "multipleOf" | "minLength" | "maxLength" | "minItems" | "maxItems" | "uniqueItems" | "pattern" | "const" | "enumOptions";
|
|
193
|
+
|
|
172
194
|
/**
|
|
173
195
|
* A Categorization element (tab-based layout).
|
|
174
196
|
*
|
|
@@ -247,6 +269,24 @@ declare interface ConstraintSemanticRole {
|
|
|
247
269
|
readonly inclusive: boolean;
|
|
248
270
|
}
|
|
249
271
|
|
|
272
|
+
/**
|
|
273
|
+
* Semantic metadata for ordered custom constraints that should participate in
|
|
274
|
+
* the generic contradiction/broadening logic.
|
|
275
|
+
*
|
|
276
|
+
* @public
|
|
277
|
+
*/
|
|
278
|
+
declare interface ConstraintSemanticRole_2 {
|
|
279
|
+
/**
|
|
280
|
+
* Logical family identifier shared by related constraints, for example
|
|
281
|
+
* `"decimal-bound"` or `"date-bound"`.
|
|
282
|
+
*/
|
|
283
|
+
readonly family: string;
|
|
284
|
+
/** Whether this constraint acts as a lower or upper bound. */
|
|
285
|
+
readonly bound: "lower" | "upper" | "exact";
|
|
286
|
+
/** Whether equality is allowed when comparing against the bound. */
|
|
287
|
+
readonly inclusive: boolean;
|
|
288
|
+
}
|
|
289
|
+
|
|
250
290
|
export { ConstraintTagRegistration }
|
|
251
291
|
|
|
252
292
|
/**
|
|
@@ -269,6 +309,26 @@ declare interface ConstraintTagRegistration_2 {
|
|
|
269
309
|
readonly isApplicableToType?: (type: ExtensionApplicableType) => boolean;
|
|
270
310
|
}
|
|
271
311
|
|
|
312
|
+
/**
|
|
313
|
+
* Declarative authoring-side registration for a custom TSDoc constraint tag.
|
|
314
|
+
*
|
|
315
|
+
* @public
|
|
316
|
+
*/
|
|
317
|
+
declare interface ConstraintTagRegistration_3 {
|
|
318
|
+
/** Tag name without the `@` prefix, e.g. `"maxSigFig"`. */
|
|
319
|
+
readonly tagName: string;
|
|
320
|
+
/** The custom constraint that this tag should produce. */
|
|
321
|
+
readonly constraintName: string;
|
|
322
|
+
/** Parser from raw TSDoc text to JSON-serializable payload. */
|
|
323
|
+
readonly parseValue: (raw: string) => ExtensionPayloadValue_2;
|
|
324
|
+
/**
|
|
325
|
+
* Optional precise applicability predicate for the field type being parsed.
|
|
326
|
+
* When omitted, the target custom constraint registration controls type
|
|
327
|
+
* applicability during validation.
|
|
328
|
+
*/
|
|
329
|
+
readonly isApplicableToType?: (type: ExtensionApplicableType_2) => boolean;
|
|
330
|
+
}
|
|
331
|
+
|
|
272
332
|
/**
|
|
273
333
|
* A Control element that binds to a JSON Schema property.
|
|
274
334
|
*
|
|
@@ -323,7 +383,7 @@ declare interface ControlOptionConstraints {
|
|
|
323
383
|
*
|
|
324
384
|
* @public
|
|
325
385
|
*/
|
|
326
|
-
export declare function createExtensionRegistry(extensions: readonly
|
|
386
|
+
export declare function createExtensionRegistry(extensions: readonly ExtensionDefinition_2[]): MutableExtensionRegistry;
|
|
327
387
|
|
|
328
388
|
/**
|
|
329
389
|
* Creates a supported static build context for a source file.
|
|
@@ -366,6 +426,24 @@ declare interface CustomAnnotationRegistration_2 {
|
|
|
366
426
|
readonly toJsonSchema?: (value: ExtensionPayloadValue, vendorPrefix: string) => Record<string, unknown>;
|
|
367
427
|
}
|
|
368
428
|
|
|
429
|
+
/**
|
|
430
|
+
* Registration for a custom annotation that may produce JSON Schema keywords.
|
|
431
|
+
*
|
|
432
|
+
* Custom annotations are referenced by FormSpec's internal custom-annotation nodes.
|
|
433
|
+
* They describe or present a field but do not affect which values are valid.
|
|
434
|
+
*
|
|
435
|
+
* @public
|
|
436
|
+
*/
|
|
437
|
+
declare interface CustomAnnotationRegistration_3 {
|
|
438
|
+
/** The annotation name, unique within the extension. */
|
|
439
|
+
readonly annotationName: string;
|
|
440
|
+
/**
|
|
441
|
+
* Optionally converts the annotation value into JSON Schema keywords.
|
|
442
|
+
* If omitted, the annotation has no JSON Schema representation (UI-only).
|
|
443
|
+
*/
|
|
444
|
+
readonly toJsonSchema?: (value: ExtensionPayloadValue_2, vendorPrefix: string) => Record<string, unknown>;
|
|
445
|
+
}
|
|
446
|
+
|
|
369
447
|
export { CustomConstraintRegistration }
|
|
370
448
|
|
|
371
449
|
/**
|
|
@@ -426,6 +504,64 @@ declare interface CustomConstraintRegistration_2 {
|
|
|
426
504
|
readonly emitsVocabularyKeywords?: boolean;
|
|
427
505
|
}
|
|
428
506
|
|
|
507
|
+
/**
|
|
508
|
+
* Registration for a custom constraint that maps to JSON Schema keywords.
|
|
509
|
+
*
|
|
510
|
+
* Custom constraints are referenced by FormSpec's internal custom-constraint nodes.
|
|
511
|
+
*
|
|
512
|
+
* @public
|
|
513
|
+
*/
|
|
514
|
+
declare interface CustomConstraintRegistration_3 {
|
|
515
|
+
/** The constraint name, unique within the extension. */
|
|
516
|
+
readonly constraintName: string;
|
|
517
|
+
/**
|
|
518
|
+
* How this constraint composes with other constraints of the same kind.
|
|
519
|
+
* - "intersect": combine with logical AND (both must hold)
|
|
520
|
+
* - "override": last writer wins
|
|
521
|
+
*/
|
|
522
|
+
readonly compositionRule: "intersect" | "override";
|
|
523
|
+
/**
|
|
524
|
+
* TypeNode kinds this constraint is applicable to, or `null` for any type.
|
|
525
|
+
* Used by the validator to emit TYPE_MISMATCH diagnostics.
|
|
526
|
+
*/
|
|
527
|
+
readonly applicableTypes: readonly ExtensionApplicableType_2["kind"][] | null;
|
|
528
|
+
/**
|
|
529
|
+
* Optional precise type predicate used when kind-level applicability is too
|
|
530
|
+
* broad (for example, constraints that apply to integer-like primitives but
|
|
531
|
+
* not strings).
|
|
532
|
+
*/
|
|
533
|
+
readonly isApplicableToType?: (type: ExtensionApplicableType_2) => boolean;
|
|
534
|
+
/**
|
|
535
|
+
* Optional comparator for payloads belonging to the same custom constraint.
|
|
536
|
+
* Return values follow the `Array.prototype.sort()` contract.
|
|
537
|
+
*/
|
|
538
|
+
readonly comparePayloads?: (left: ExtensionPayloadValue_2, right: ExtensionPayloadValue_2) => number;
|
|
539
|
+
/**
|
|
540
|
+
* Optional semantic family metadata for generic contradiction/broadening
|
|
541
|
+
* handling across ordered constraints.
|
|
542
|
+
*/
|
|
543
|
+
readonly semanticRole?: ConstraintSemanticRole_2;
|
|
544
|
+
/**
|
|
545
|
+
* Converts the custom constraint's payload into JSON Schema keywords.
|
|
546
|
+
*
|
|
547
|
+
* @param payload - The opaque JSON payload stored on the custom constraint node.
|
|
548
|
+
* @param vendorPrefix - The vendor prefix for extension keywords.
|
|
549
|
+
* @returns A JSON Schema fragment with the constraint keywords.
|
|
550
|
+
*/
|
|
551
|
+
readonly toJsonSchema: (payload: ExtensionPayloadValue_2, vendorPrefix: string) => Record<string, unknown>;
|
|
552
|
+
/**
|
|
553
|
+
* When true, `toJsonSchema` may emit vocabulary keywords that do not carry
|
|
554
|
+
* the vendor prefix. By default, all keys returned from `toJsonSchema` must
|
|
555
|
+
* start with `${vendorPrefix}-`; setting this flag relaxes that check so
|
|
556
|
+
* the constraint can produce standard or custom vocabulary keywords such as
|
|
557
|
+
* `decimalMinimum`.
|
|
558
|
+
*
|
|
559
|
+
* Use this for constraints that define their own JSON Schema vocabulary
|
|
560
|
+
* rather than namespacing under the vendor prefix.
|
|
561
|
+
*/
|
|
562
|
+
readonly emitsVocabularyKeywords?: boolean;
|
|
563
|
+
}
|
|
564
|
+
|
|
429
565
|
export { CustomTypeRegistration }
|
|
430
566
|
|
|
431
567
|
/**
|
|
@@ -477,6 +613,39 @@ declare interface CustomTypeRegistration_2 {
|
|
|
477
613
|
* @returns A JSON Schema fragment representing this type.
|
|
478
614
|
*/
|
|
479
615
|
readonly toJsonSchema: (payload: ExtensionPayloadValue, vendorPrefix: string) => Record<string, unknown>;
|
|
616
|
+
/**
|
|
617
|
+
* Optional hook that coerces a `@defaultValue` literal into the serialized
|
|
618
|
+
* form that validates against the schema produced by `toJsonSchema`.
|
|
619
|
+
*
|
|
620
|
+
* `@defaultValue` arguments are parsed as JavaScript literals (numbers,
|
|
621
|
+
* booleans, strings, etc.) and injected into the emitted JSON Schema as-is.
|
|
622
|
+
* For custom types whose JSON Schema representation has a different runtime
|
|
623
|
+
* shape than the parsed literal (for example, `Decimal` emits
|
|
624
|
+
* `{ type: "string" }` but authors write `@defaultValue 9.99`), the literal
|
|
625
|
+
* must be coerced so that the emitted `default` keyword conforms to the
|
|
626
|
+
* schema.
|
|
627
|
+
*
|
|
628
|
+
* When this hook is omitted, the build pipeline falls back to a best-effort
|
|
629
|
+
* inference that only inspects a top-level `type` keyword on the schema
|
|
630
|
+
* returned by `toJsonSchema` (e.g., `"string"` output causes non-string
|
|
631
|
+
* literals to be stringified). The fallback does NOT handle `oneOf`,
|
|
632
|
+
* `anyOf`, or array-form `type` keywords — extensions that emit composite
|
|
633
|
+
* schemas must provide this hook explicitly. Likewise, extensions that need
|
|
634
|
+
* bespoke serialization (e.g., Date → ISO-8601 string) should provide the
|
|
635
|
+
* hook.
|
|
636
|
+
*
|
|
637
|
+
* Errors thrown from this hook propagate as build errors; the pipeline does
|
|
638
|
+
* not catch them.
|
|
639
|
+
*
|
|
640
|
+
* @param parsed - The JS literal extracted from `@defaultValue` (already
|
|
641
|
+
* parsed from TSDoc text; typically `number | string | boolean | null`).
|
|
642
|
+
* @param payload - The custom-type payload attached to the IR node.
|
|
643
|
+
* @returns The coerced value to emit as the JSON Schema `default`. Return
|
|
644
|
+
* `parsed` unchanged to opt out of coercion for a specific value.
|
|
645
|
+
*
|
|
646
|
+
* @alpha
|
|
647
|
+
*/
|
|
648
|
+
readonly serializeDefault?: (parsed: unknown, payload: ExtensionPayloadValue) => unknown;
|
|
480
649
|
/**
|
|
481
650
|
* Optional broadening of built-in constraint tags so they can apply to this
|
|
482
651
|
* custom type without modifying the core built-in constraint tables.
|
|
@@ -484,6 +653,63 @@ declare interface CustomTypeRegistration_2 {
|
|
|
484
653
|
readonly builtinConstraintBroadenings?: readonly BuiltinConstraintBroadeningRegistration_2[];
|
|
485
654
|
}
|
|
486
655
|
|
|
656
|
+
/**
|
|
657
|
+
* Registration for a custom type that maps to a JSON Schema representation.
|
|
658
|
+
*
|
|
659
|
+
* Custom types are referenced by FormSpec's internal custom-type IR nodes and
|
|
660
|
+
* resolved to JSON Schema via `toJsonSchema` during generation.
|
|
661
|
+
*
|
|
662
|
+
* @public
|
|
663
|
+
*/
|
|
664
|
+
declare interface CustomTypeRegistration_3 {
|
|
665
|
+
/** The type name, unique within the extension. */
|
|
666
|
+
readonly typeName: string;
|
|
667
|
+
/**
|
|
668
|
+
* Optional TypeScript surface names that should resolve to this custom type
|
|
669
|
+
* during TSDoc/class analysis. Defaults to `typeName` when omitted.
|
|
670
|
+
* @deprecated Prefer `brand` for structural detection or type parameters
|
|
671
|
+
* on `defineCustomType<T>()` for symbol-based detection. String name
|
|
672
|
+
* matching will be removed in a future major version.
|
|
673
|
+
*/
|
|
674
|
+
readonly tsTypeNames?: readonly string[];
|
|
675
|
+
/**
|
|
676
|
+
* Optional brand identifier for structural type detection.
|
|
677
|
+
*
|
|
678
|
+
* When provided, the type resolver checks `type.getProperties()` for a
|
|
679
|
+
* computed property whose name matches this identifier. This is more
|
|
680
|
+
* reliable than `tsTypeNames` for aliased branded types because it does not
|
|
681
|
+
* depend on the local type name.
|
|
682
|
+
*
|
|
683
|
+
* Brand detection is attempted after name-based resolution (`tsTypeNames`)
|
|
684
|
+
* as a structural fallback. If both match, name-based resolution wins.
|
|
685
|
+
*
|
|
686
|
+
* The value should match the identifier text of a `unique symbol` declaration
|
|
687
|
+
* used as a computed property key on the branded type. For example, if the
|
|
688
|
+
* type is `string & { readonly [__decimalBrand]: true }`, the brand is
|
|
689
|
+
* `"__decimalBrand"`.
|
|
690
|
+
*
|
|
691
|
+
* Brand identifiers are stored as plain strings in the extension registry, so
|
|
692
|
+
* they must be unique across the extensions loaded into the same build.
|
|
693
|
+
*
|
|
694
|
+
* Note: `"__integerBrand"` is reserved for the builtin Integer type.
|
|
695
|
+
*/
|
|
696
|
+
readonly brand?: string;
|
|
697
|
+
/**
|
|
698
|
+
* Converts the custom type's payload into a JSON Schema fragment.
|
|
699
|
+
*
|
|
700
|
+
* @param payload - The opaque JSON payload stored on the custom type node.
|
|
701
|
+
* @param vendorPrefix - The vendor prefix for extension keywords (e.g., "x-stripe").
|
|
702
|
+
* @returns A JSON Schema fragment representing this type.
|
|
703
|
+
*/
|
|
704
|
+
readonly toJsonSchema: (payload: ExtensionPayloadValue_2, vendorPrefix: string) => Record<string, unknown>;
|
|
705
|
+
/* Excluded from this release type: serializeDefault */
|
|
706
|
+
/**
|
|
707
|
+
* Optional broadening of built-in constraint tags so they can apply to this
|
|
708
|
+
* custom type without modifying the core built-in constraint tables.
|
|
709
|
+
*/
|
|
710
|
+
readonly builtinConstraintBroadenings?: readonly BuiltinConstraintBroadeningRegistration_3[];
|
|
711
|
+
}
|
|
712
|
+
|
|
487
713
|
/**
|
|
488
714
|
* Per-declaration metadata policy input.
|
|
489
715
|
*
|
|
@@ -616,7 +842,7 @@ declare interface EnumMemberDisplayNameRequireExplicitPolicyInput {
|
|
|
616
842
|
*/
|
|
617
843
|
declare interface EnumMemberMetadataInferenceContext {
|
|
618
844
|
/** Authoring surface the enum originated from. */
|
|
619
|
-
readonly surface:
|
|
845
|
+
readonly surface: MetadataAuthoringSurface_2;
|
|
620
846
|
/** Logical member identifier used for policy inference. */
|
|
621
847
|
readonly logicalName: string;
|
|
622
848
|
/** Underlying enum value before stringification. */
|
|
@@ -672,6 +898,25 @@ declare type ExtensionApplicableType = {
|
|
|
672
898
|
readonly kind: Exclude<ExtensionTypeKind, "primitive" | "custom">;
|
|
673
899
|
};
|
|
674
900
|
|
|
901
|
+
/**
|
|
902
|
+
* A curated type shape exposed to extension applicability hooks.
|
|
903
|
+
*
|
|
904
|
+
* This intentionally exposes only the fields needed to determine tag/type
|
|
905
|
+
* applicability without committing the entire canonical IR as public API.
|
|
906
|
+
*
|
|
907
|
+
* @public
|
|
908
|
+
*/
|
|
909
|
+
declare type ExtensionApplicableType_2 = {
|
|
910
|
+
readonly kind: "primitive";
|
|
911
|
+
readonly primitiveKind: "string" | "number" | "integer" | "bigint" | "boolean" | "null";
|
|
912
|
+
} | {
|
|
913
|
+
readonly kind: "custom";
|
|
914
|
+
readonly typeId: string;
|
|
915
|
+
readonly payload: ExtensionPayloadValue_2;
|
|
916
|
+
} | {
|
|
917
|
+
readonly kind: Exclude<ExtensionTypeKind_2, "primitive" | "custom">;
|
|
918
|
+
};
|
|
919
|
+
|
|
675
920
|
export { ExtensionDefinition }
|
|
676
921
|
|
|
677
922
|
/**
|
|
@@ -713,6 +958,45 @@ declare interface ExtensionDefinition_2 {
|
|
|
713
958
|
readonly vocabularyKeywords?: readonly VocabularyKeywordRegistration[];
|
|
714
959
|
}
|
|
715
960
|
|
|
961
|
+
/**
|
|
962
|
+
* A complete extension definition bundling types, constraints, annotations,
|
|
963
|
+
* and vocabulary keywords.
|
|
964
|
+
*
|
|
965
|
+
* @example
|
|
966
|
+
* ```typescript
|
|
967
|
+
* const monetaryExtension = defineExtension({
|
|
968
|
+
* extensionId: "x-stripe/monetary",
|
|
969
|
+
* types: [
|
|
970
|
+
* defineCustomType({
|
|
971
|
+
* typeName: "Decimal",
|
|
972
|
+
* toJsonSchema: (_payload, prefix) => ({
|
|
973
|
+
* type: "string",
|
|
974
|
+
* [`${prefix}-decimal`]: true,
|
|
975
|
+
* }),
|
|
976
|
+
* }),
|
|
977
|
+
* ],
|
|
978
|
+
* });
|
|
979
|
+
* ```
|
|
980
|
+
*
|
|
981
|
+
* @public
|
|
982
|
+
*/
|
|
983
|
+
declare interface ExtensionDefinition_3 {
|
|
984
|
+
/** Globally unique extension identifier, e.g., "x-stripe/monetary". */
|
|
985
|
+
readonly extensionId: string;
|
|
986
|
+
/** Custom type registrations provided by this extension. */
|
|
987
|
+
readonly types?: readonly CustomTypeRegistration_3[];
|
|
988
|
+
/** Custom constraint registrations provided by this extension. */
|
|
989
|
+
readonly constraints?: readonly CustomConstraintRegistration_3[];
|
|
990
|
+
/** Authoring-side TSDoc tag registrations provided by this extension. */
|
|
991
|
+
readonly constraintTags?: readonly ConstraintTagRegistration_3[];
|
|
992
|
+
/** Metadata-slot registrations shared by build- and lint-time analysis. */
|
|
993
|
+
readonly metadataSlots?: readonly MetadataSlotRegistration_2[];
|
|
994
|
+
/** Custom annotation registrations provided by this extension. */
|
|
995
|
+
readonly annotations?: readonly CustomAnnotationRegistration_3[];
|
|
996
|
+
/** Vocabulary keyword registrations provided by this extension. */
|
|
997
|
+
readonly vocabularyKeywords?: readonly VocabularyKeywordRegistration_2[];
|
|
998
|
+
}
|
|
999
|
+
|
|
716
1000
|
/**
|
|
717
1001
|
* A JSON-serializable payload value used by extension registration hooks.
|
|
718
1002
|
*
|
|
@@ -722,6 +1006,15 @@ declare type ExtensionPayloadValue = null | boolean | number | string | readonly
|
|
|
722
1006
|
readonly [key: string]: ExtensionPayloadValue;
|
|
723
1007
|
};
|
|
724
1008
|
|
|
1009
|
+
/**
|
|
1010
|
+
* A JSON-serializable payload value used by extension registration hooks.
|
|
1011
|
+
*
|
|
1012
|
+
* @public
|
|
1013
|
+
*/
|
|
1014
|
+
declare type ExtensionPayloadValue_2 = null | boolean | number | string | readonly ExtensionPayloadValue_2[] | {
|
|
1015
|
+
readonly [key: string]: ExtensionPayloadValue_2;
|
|
1016
|
+
};
|
|
1017
|
+
|
|
725
1018
|
/**
|
|
726
1019
|
* A registry of extensions that provides lookup by fully-qualified ID.
|
|
727
1020
|
*
|
|
@@ -733,14 +1026,31 @@ declare type ExtensionPayloadValue = null | boolean | number | string | readonly
|
|
|
733
1026
|
*/
|
|
734
1027
|
export declare interface ExtensionRegistry {
|
|
735
1028
|
/** The extensions registered in this registry (in registration order). */
|
|
736
|
-
readonly extensions: readonly
|
|
1029
|
+
readonly extensions: readonly ExtensionDefinition_2[];
|
|
1030
|
+
/**
|
|
1031
|
+
* Setup diagnostics detected during registry construction.
|
|
1032
|
+
*
|
|
1033
|
+
* These diagnostics represent configuration errors in the extension
|
|
1034
|
+
* registrations — e.g. unsupported TypeScript built-in type overrides,
|
|
1035
|
+
* invalid type-name identifiers, or duplicate registrations. They are
|
|
1036
|
+
* computed ONCE at `createExtensionRegistry` call time (§4 Phase 4 Slice C)
|
|
1037
|
+
* and carried on the registry so consumers can emit them without re-running
|
|
1038
|
+
* the validation on every analysis call.
|
|
1039
|
+
*
|
|
1040
|
+
* Consumers should check this array at the start of each analysis pass and
|
|
1041
|
+
* short-circuit if it is non-empty — the registry is unusable for
|
|
1042
|
+
* constraint-type validation when setup diagnostics are present.
|
|
1043
|
+
*
|
|
1044
|
+
* @internal
|
|
1045
|
+
*/
|
|
1046
|
+
readonly setupDiagnostics: readonly SetupDiagnostic[];
|
|
737
1047
|
/**
|
|
738
1048
|
* Look up a custom type registration by its fully-qualified type ID.
|
|
739
1049
|
*
|
|
740
1050
|
* @param typeId - The fully-qualified type ID (e.g., "x-stripe/monetary/Decimal").
|
|
741
1051
|
* @returns The registration if found, otherwise `undefined`.
|
|
742
1052
|
*/
|
|
743
|
-
findType(typeId: string):
|
|
1053
|
+
findType(typeId: string): CustomTypeRegistration_2 | undefined;
|
|
744
1054
|
/**
|
|
745
1055
|
* Look up a custom type registration by a TypeScript-facing type name.
|
|
746
1056
|
*
|
|
@@ -779,20 +1089,20 @@ export declare interface ExtensionRegistry {
|
|
|
779
1089
|
* @param constraintId - The fully-qualified constraint ID.
|
|
780
1090
|
* @returns The registration if found, otherwise `undefined`.
|
|
781
1091
|
*/
|
|
782
|
-
findConstraint(constraintId: string):
|
|
1092
|
+
findConstraint(constraintId: string): CustomConstraintRegistration_2 | undefined;
|
|
783
1093
|
/**
|
|
784
1094
|
* Look up a TSDoc custom constraint-tag registration by tag name.
|
|
785
1095
|
*/
|
|
786
1096
|
findConstraintTag(tagName: string): {
|
|
787
1097
|
readonly extensionId: string;
|
|
788
|
-
readonly registration:
|
|
1098
|
+
readonly registration: ConstraintTagRegistration_2;
|
|
789
1099
|
} | undefined;
|
|
790
1100
|
/**
|
|
791
1101
|
* Look up built-in tag broadening for a given custom type ID.
|
|
792
1102
|
*/
|
|
793
1103
|
findBuiltinConstraintBroadening(typeId: string, tagName: string): {
|
|
794
1104
|
readonly extensionId: string;
|
|
795
|
-
readonly registration:
|
|
1105
|
+
readonly registration: BuiltinConstraintBroadeningRegistration_2;
|
|
796
1106
|
} | undefined;
|
|
797
1107
|
/**
|
|
798
1108
|
* Look up a custom annotation registration by its fully-qualified annotation ID.
|
|
@@ -800,7 +1110,7 @@ export declare interface ExtensionRegistry {
|
|
|
800
1110
|
* @param annotationId - The fully-qualified annotation ID.
|
|
801
1111
|
* @returns The registration if found, otherwise `undefined`.
|
|
802
1112
|
*/
|
|
803
|
-
findAnnotation(annotationId: string):
|
|
1113
|
+
findAnnotation(annotationId: string): CustomAnnotationRegistration_2 | undefined;
|
|
804
1114
|
}
|
|
805
1115
|
|
|
806
1116
|
/**
|
|
@@ -810,6 +1120,13 @@ export declare interface ExtensionRegistry {
|
|
|
810
1120
|
*/
|
|
811
1121
|
declare type ExtensionTypeKind = "primitive" | "enum" | "array" | "object" | "record" | "union" | "reference" | "dynamic" | "custom";
|
|
812
1122
|
|
|
1123
|
+
/**
|
|
1124
|
+
* Top-level type kinds that extension applicability hooks may inspect.
|
|
1125
|
+
*
|
|
1126
|
+
* @public
|
|
1127
|
+
*/
|
|
1128
|
+
declare type ExtensionTypeKind_2 = "primitive" | "enum" | "array" | "object" | "record" | "union" | "reference" | "dynamic" | "custom";
|
|
1129
|
+
|
|
813
1130
|
/**
|
|
814
1131
|
* The result of a successful extension type lookup.
|
|
815
1132
|
*
|
|
@@ -823,7 +1140,7 @@ export declare interface ExtensionTypeLookupResult {
|
|
|
823
1140
|
/** The fully-qualified extension ID (e.g., "x-stripe/monetary"). */
|
|
824
1141
|
readonly extensionId: string;
|
|
825
1142
|
/** The custom type registration matched by this lookup. */
|
|
826
|
-
readonly registration:
|
|
1143
|
+
readonly registration: CustomTypeRegistration_2;
|
|
827
1144
|
}
|
|
828
1145
|
|
|
829
1146
|
/**
|
|
@@ -888,7 +1205,7 @@ export declare interface FormSpecConfig {
|
|
|
888
1205
|
* Extension definitions providing custom types, constraints,
|
|
889
1206
|
* annotations, and vocabulary keywords.
|
|
890
1207
|
*/
|
|
891
|
-
readonly extensions?: readonly
|
|
1208
|
+
readonly extensions?: readonly ExtensionDefinition_3[];
|
|
892
1209
|
/** Constraint surface configuration — controls which field types,
|
|
893
1210
|
* layouts, UI features, and field/control options are allowed. */
|
|
894
1211
|
readonly constraints?: ConstraintConfig;
|
|
@@ -1681,6 +1998,13 @@ declare interface LayoutTypeConstraints {
|
|
|
1681
1998
|
*/
|
|
1682
1999
|
declare type MetadataAuthoringSurface = "tsdoc" | "chain-dsl";
|
|
1683
2000
|
|
|
2001
|
+
/**
|
|
2002
|
+
* Authoring surfaces that can contribute metadata.
|
|
2003
|
+
*
|
|
2004
|
+
* @public
|
|
2005
|
+
*/
|
|
2006
|
+
declare type MetadataAuthoringSurface_2 = "tsdoc" | "chain-dsl";
|
|
2007
|
+
|
|
1684
2008
|
/**
|
|
1685
2009
|
* Declaration categories that metadata policy can target.
|
|
1686
2010
|
*
|
|
@@ -1688,6 +2012,13 @@ declare type MetadataAuthoringSurface = "tsdoc" | "chain-dsl";
|
|
|
1688
2012
|
*/
|
|
1689
2013
|
declare type MetadataDeclarationKind = "type" | "field" | "method";
|
|
1690
2014
|
|
|
2015
|
+
/**
|
|
2016
|
+
* Declaration categories that metadata policy can target.
|
|
2017
|
+
*
|
|
2018
|
+
* @public
|
|
2019
|
+
*/
|
|
2020
|
+
declare type MetadataDeclarationKind_2 = "type" | "field" | "method";
|
|
2021
|
+
|
|
1691
2022
|
/**
|
|
1692
2023
|
* Build-facing context passed to metadata inference callbacks.
|
|
1693
2024
|
*
|
|
@@ -1707,19 +2038,38 @@ declare interface MetadataInferenceContext {
|
|
|
1707
2038
|
readonly buildContext?: unknown;
|
|
1708
2039
|
}
|
|
1709
2040
|
|
|
2041
|
+
/**
|
|
2042
|
+
* Build-facing context passed to metadata inference callbacks.
|
|
2043
|
+
*
|
|
2044
|
+
* `buildContext` is intentionally opaque so browser/runtime packages do not
|
|
2045
|
+
* need to depend on TypeScript compiler types.
|
|
2046
|
+
*
|
|
2047
|
+
* @public
|
|
2048
|
+
*/
|
|
2049
|
+
declare interface MetadataInferenceContext_2 {
|
|
2050
|
+
/** Authoring surface the metadata is being resolved for. */
|
|
2051
|
+
readonly surface: MetadataAuthoringSurface_2;
|
|
2052
|
+
/** Declaration kind currently being resolved. */
|
|
2053
|
+
readonly declarationKind: MetadataDeclarationKind_2;
|
|
2054
|
+
/** Logical identifier before any metadata policy is applied. */
|
|
2055
|
+
readonly logicalName: string;
|
|
2056
|
+
/** Optional build-only context supplied by the resolver. */
|
|
2057
|
+
readonly buildContext?: unknown;
|
|
2058
|
+
}
|
|
2059
|
+
|
|
1710
2060
|
/**
|
|
1711
2061
|
* Callback used to infer a scalar metadata value.
|
|
1712
2062
|
*
|
|
1713
2063
|
* @public
|
|
1714
2064
|
*/
|
|
1715
|
-
declare type MetadataInferenceFn = (context:
|
|
2065
|
+
declare type MetadataInferenceFn = (context: MetadataInferenceContext_2) => string;
|
|
1716
2066
|
|
|
1717
2067
|
/**
|
|
1718
2068
|
* Context passed to pluralization callbacks.
|
|
1719
2069
|
*
|
|
1720
2070
|
* @public
|
|
1721
2071
|
*/
|
|
1722
|
-
declare interface MetadataPluralizationContext extends
|
|
2072
|
+
declare interface MetadataPluralizationContext extends MetadataInferenceContext_2 {
|
|
1723
2073
|
/** Singular value that pluralization should derive from. */
|
|
1724
2074
|
readonly singular: string;
|
|
1725
2075
|
}
|
|
@@ -1803,6 +2153,23 @@ declare interface MetadataQualifierRegistration {
|
|
|
1803
2153
|
readonly inferValue?: MetadataSlotInferenceFn | undefined;
|
|
1804
2154
|
}
|
|
1805
2155
|
|
|
2156
|
+
/**
|
|
2157
|
+
* Supported qualifier registration for an extensible metadata slot.
|
|
2158
|
+
*
|
|
2159
|
+
* @public
|
|
2160
|
+
*/
|
|
2161
|
+
declare interface MetadataQualifierRegistration_2 {
|
|
2162
|
+
/** Qualifier text without the leading colon. */
|
|
2163
|
+
readonly qualifier: string;
|
|
2164
|
+
/**
|
|
2165
|
+
* Optional source qualifier to use as the base input for this qualifier's
|
|
2166
|
+
* inference hook. Defaults to the slot's bare/default value when omitted.
|
|
2167
|
+
*/
|
|
2168
|
+
readonly sourceQualifier?: string | undefined;
|
|
2169
|
+
/** Optional inference hook for this qualified value. */
|
|
2170
|
+
readonly inferValue?: MetadataSlotInferenceFn_2 | undefined;
|
|
2171
|
+
}
|
|
2172
|
+
|
|
1806
2173
|
/**
|
|
1807
2174
|
* Stable slot identifier for extensible metadata analysis.
|
|
1808
2175
|
*
|
|
@@ -1810,6 +2177,13 @@ declare interface MetadataQualifierRegistration {
|
|
|
1810
2177
|
*/
|
|
1811
2178
|
declare type MetadataSlotId = string;
|
|
1812
2179
|
|
|
2180
|
+
/**
|
|
2181
|
+
* Stable slot identifier for extensible metadata analysis.
|
|
2182
|
+
*
|
|
2183
|
+
* @public
|
|
2184
|
+
*/
|
|
2185
|
+
declare type MetadataSlotId_2 = string;
|
|
2186
|
+
|
|
1813
2187
|
/**
|
|
1814
2188
|
* Context passed to extensible metadata inference hooks.
|
|
1815
2189
|
*
|
|
@@ -1826,6 +2200,22 @@ declare interface MetadataSlotInferenceContext extends MetadataInferenceContext
|
|
|
1826
2200
|
readonly baseValue?: string | undefined;
|
|
1827
2201
|
}
|
|
1828
2202
|
|
|
2203
|
+
/**
|
|
2204
|
+
* Context passed to extensible metadata inference hooks.
|
|
2205
|
+
*
|
|
2206
|
+
* @public
|
|
2207
|
+
*/
|
|
2208
|
+
declare interface MetadataSlotInferenceContext_2 extends MetadataInferenceContext_2 {
|
|
2209
|
+
/** Stable logical slot identifier. */
|
|
2210
|
+
readonly slotId: MetadataSlotId_2;
|
|
2211
|
+
/** Tag name associated with the slot, without the `@` prefix. */
|
|
2212
|
+
readonly tagName: string;
|
|
2213
|
+
/** Optional qualifier being inferred (for example `plural`). */
|
|
2214
|
+
readonly qualifier?: string | undefined;
|
|
2215
|
+
/** Resolved bare/default value used as the base input for derived qualifiers. */
|
|
2216
|
+
readonly baseValue?: string | undefined;
|
|
2217
|
+
}
|
|
2218
|
+
|
|
1829
2219
|
/**
|
|
1830
2220
|
* Callback used to infer an extensible metadata slot value.
|
|
1831
2221
|
*
|
|
@@ -1833,6 +2223,13 @@ declare interface MetadataSlotInferenceContext extends MetadataInferenceContext
|
|
|
1833
2223
|
*/
|
|
1834
2224
|
declare type MetadataSlotInferenceFn = (context: MetadataSlotInferenceContext) => string;
|
|
1835
2225
|
|
|
2226
|
+
/**
|
|
2227
|
+
* Callback used to infer an extensible metadata slot value.
|
|
2228
|
+
*
|
|
2229
|
+
* @public
|
|
2230
|
+
*/
|
|
2231
|
+
declare type MetadataSlotInferenceFn_2 = (context: MetadataSlotInferenceContext_2) => string;
|
|
2232
|
+
|
|
1836
2233
|
/**
|
|
1837
2234
|
* Extensible metadata slot definition shared across build- and lint-time analysis.
|
|
1838
2235
|
*
|
|
@@ -1858,6 +2255,31 @@ declare interface MetadataSlotRegistration {
|
|
|
1858
2255
|
readonly isApplicable?: ((context: MetadataInferenceContext) => boolean) | undefined;
|
|
1859
2256
|
}
|
|
1860
2257
|
|
|
2258
|
+
/**
|
|
2259
|
+
* Extensible metadata slot definition shared across build- and lint-time analysis.
|
|
2260
|
+
*
|
|
2261
|
+
* @public
|
|
2262
|
+
*/
|
|
2263
|
+
declare interface MetadataSlotRegistration_2 {
|
|
2264
|
+
/** Stable logical slot identifier. */
|
|
2265
|
+
readonly slotId: MetadataSlotId_2;
|
|
2266
|
+
/** Tag name associated with this slot, without the `@` prefix. */
|
|
2267
|
+
readonly tagName: string;
|
|
2268
|
+
/** Declaration kinds where the slot is meaningful. */
|
|
2269
|
+
readonly declarationKinds: readonly MetadataDeclarationKind_2[];
|
|
2270
|
+
/** Whether a bare tag without a qualifier is supported. Defaults to true. */
|
|
2271
|
+
readonly allowBare?: boolean | undefined;
|
|
2272
|
+
/** Supported qualifiers for this slot. */
|
|
2273
|
+
readonly qualifiers?: readonly MetadataQualifierRegistration_2[] | undefined;
|
|
2274
|
+
/** Optional inference hook for the bare/default slot value. */
|
|
2275
|
+
readonly inferValue?: MetadataSlotInferenceFn_2 | undefined;
|
|
2276
|
+
/**
|
|
2277
|
+
* Optional applicability hook for declaration-specific rules beyond
|
|
2278
|
+
* declaration kind. `buildContext` may carry compiler objects.
|
|
2279
|
+
*/
|
|
2280
|
+
readonly isApplicable?: ((context: MetadataInferenceContext_2) => boolean) | undefined;
|
|
2281
|
+
}
|
|
2282
|
+
|
|
1861
2283
|
/**
|
|
1862
2284
|
* Supported declaration kinds for standalone metadata resolution.
|
|
1863
2285
|
*
|
|
@@ -2116,6 +2538,23 @@ export declare interface SchemaGenerationTarget {
|
|
|
2116
2538
|
*/
|
|
2117
2539
|
export declare type SchemaSourceDeclaration = ts.ClassDeclaration | ts.InterfaceDeclaration | ts.TypeAliasDeclaration;
|
|
2118
2540
|
|
|
2541
|
+
/**
|
|
2542
|
+
* Setup-time diagnostic produced by the `_validateExtensionSetup` helper.
|
|
2543
|
+
*
|
|
2544
|
+
* The `kind` field distinguishes between a "setup" failure (invalid type
|
|
2545
|
+
* name, duplicate registration) and an unsupported built-in override.
|
|
2546
|
+
*
|
|
2547
|
+
* @internal
|
|
2548
|
+
*/
|
|
2549
|
+
export declare interface SetupDiagnostic {
|
|
2550
|
+
/** The category of diagnostic. */
|
|
2551
|
+
readonly kind: "unsupported-custom-type-override" | "synthetic-setup";
|
|
2552
|
+
/** TypeScript diagnostic code, or -1 for non-TypeScript diagnostics. */
|
|
2553
|
+
readonly code: number;
|
|
2554
|
+
/** Human-readable description of the diagnostic. */
|
|
2555
|
+
readonly message: string;
|
|
2556
|
+
}
|
|
2557
|
+
|
|
2119
2558
|
/**
|
|
2120
2559
|
* Severity level for constraint violations.
|
|
2121
2560
|
* - "error": Violation fails validation
|
|
@@ -2363,6 +2802,18 @@ declare interface VocabularyKeywordRegistration {
|
|
|
2363
2802
|
readonly schema: ExtensionPayloadValue;
|
|
2364
2803
|
}
|
|
2365
2804
|
|
|
2805
|
+
/**
|
|
2806
|
+
* Registration for a vocabulary keyword to include in a JSON Schema `$vocabulary` declaration.
|
|
2807
|
+
*
|
|
2808
|
+
* @public
|
|
2809
|
+
*/
|
|
2810
|
+
declare interface VocabularyKeywordRegistration_2 {
|
|
2811
|
+
/** The keyword name (without vendor prefix). */
|
|
2812
|
+
readonly keyword: string;
|
|
2813
|
+
/** JSON Schema that describes the valid values for this keyword. */
|
|
2814
|
+
readonly schema: ExtensionPayloadValue_2;
|
|
2815
|
+
}
|
|
2816
|
+
|
|
2366
2817
|
/**
|
|
2367
2818
|
* Builds and writes both JSON Schema and UI Schema files to disk.
|
|
2368
2819
|
*
|