@formspec/build 0.1.0-alpha.57 → 0.1.0-alpha.59
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 +29 -0
- package/dist/analyzer/class-analyzer.d.ts.map +1 -1
- package/dist/analyzer/tsdoc-parser.d.ts.map +1 -1
- package/dist/browser.cjs +126 -31
- package/dist/browser.cjs.map +1 -1
- package/dist/browser.js +129 -32
- package/dist/browser.js.map +1 -1
- package/dist/build-alpha.d.ts +431 -12
- package/dist/build-beta.d.ts +399 -12
- package/dist/build-internal.d.ts +460 -12
- package/dist/build.d.ts +399 -12
- package/dist/cli.cjs +625 -326
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +586 -279
- 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/index.cjs +615 -315
- 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 +585 -277
- package/dist/index.js.map +1 -1
- package/dist/internals.cjs +589 -289
- package/dist/internals.cjs.map +1 -1
- package/dist/internals.js +554 -246
- package/dist/internals.js.map +1 -1
- package/package.json +5 -5
package/dist/build-alpha.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,15 @@ 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
|
+
/* Excluded from this release type: setupDiagnostics */
|
|
737
1031
|
/**
|
|
738
1032
|
* Look up a custom type registration by its fully-qualified type ID.
|
|
739
1033
|
*
|
|
740
1034
|
* @param typeId - The fully-qualified type ID (e.g., "x-stripe/monetary/Decimal").
|
|
741
1035
|
* @returns The registration if found, otherwise `undefined`.
|
|
742
1036
|
*/
|
|
743
|
-
findType(typeId: string):
|
|
1037
|
+
findType(typeId: string): CustomTypeRegistration_2 | undefined;
|
|
744
1038
|
/**
|
|
745
1039
|
* Look up a custom type registration by a TypeScript-facing type name.
|
|
746
1040
|
*
|
|
@@ -779,20 +1073,20 @@ export declare interface ExtensionRegistry {
|
|
|
779
1073
|
* @param constraintId - The fully-qualified constraint ID.
|
|
780
1074
|
* @returns The registration if found, otherwise `undefined`.
|
|
781
1075
|
*/
|
|
782
|
-
findConstraint(constraintId: string):
|
|
1076
|
+
findConstraint(constraintId: string): CustomConstraintRegistration_2 | undefined;
|
|
783
1077
|
/**
|
|
784
1078
|
* Look up a TSDoc custom constraint-tag registration by tag name.
|
|
785
1079
|
*/
|
|
786
1080
|
findConstraintTag(tagName: string): {
|
|
787
1081
|
readonly extensionId: string;
|
|
788
|
-
readonly registration:
|
|
1082
|
+
readonly registration: ConstraintTagRegistration_2;
|
|
789
1083
|
} | undefined;
|
|
790
1084
|
/**
|
|
791
1085
|
* Look up built-in tag broadening for a given custom type ID.
|
|
792
1086
|
*/
|
|
793
1087
|
findBuiltinConstraintBroadening(typeId: string, tagName: string): {
|
|
794
1088
|
readonly extensionId: string;
|
|
795
|
-
readonly registration:
|
|
1089
|
+
readonly registration: BuiltinConstraintBroadeningRegistration_2;
|
|
796
1090
|
} | undefined;
|
|
797
1091
|
/**
|
|
798
1092
|
* Look up a custom annotation registration by its fully-qualified annotation ID.
|
|
@@ -800,7 +1094,7 @@ export declare interface ExtensionRegistry {
|
|
|
800
1094
|
* @param annotationId - The fully-qualified annotation ID.
|
|
801
1095
|
* @returns The registration if found, otherwise `undefined`.
|
|
802
1096
|
*/
|
|
803
|
-
findAnnotation(annotationId: string):
|
|
1097
|
+
findAnnotation(annotationId: string): CustomAnnotationRegistration_2 | undefined;
|
|
804
1098
|
}
|
|
805
1099
|
|
|
806
1100
|
/**
|
|
@@ -810,6 +1104,13 @@ export declare interface ExtensionRegistry {
|
|
|
810
1104
|
*/
|
|
811
1105
|
declare type ExtensionTypeKind = "primitive" | "enum" | "array" | "object" | "record" | "union" | "reference" | "dynamic" | "custom";
|
|
812
1106
|
|
|
1107
|
+
/**
|
|
1108
|
+
* Top-level type kinds that extension applicability hooks may inspect.
|
|
1109
|
+
*
|
|
1110
|
+
* @public
|
|
1111
|
+
*/
|
|
1112
|
+
declare type ExtensionTypeKind_2 = "primitive" | "enum" | "array" | "object" | "record" | "union" | "reference" | "dynamic" | "custom";
|
|
1113
|
+
|
|
813
1114
|
/**
|
|
814
1115
|
* The result of a successful extension type lookup.
|
|
815
1116
|
*
|
|
@@ -823,7 +1124,7 @@ export declare interface ExtensionTypeLookupResult {
|
|
|
823
1124
|
/** The fully-qualified extension ID (e.g., "x-stripe/monetary"). */
|
|
824
1125
|
readonly extensionId: string;
|
|
825
1126
|
/** The custom type registration matched by this lookup. */
|
|
826
|
-
readonly registration:
|
|
1127
|
+
readonly registration: CustomTypeRegistration_2;
|
|
827
1128
|
}
|
|
828
1129
|
|
|
829
1130
|
/**
|
|
@@ -888,7 +1189,7 @@ export declare interface FormSpecConfig {
|
|
|
888
1189
|
* Extension definitions providing custom types, constraints,
|
|
889
1190
|
* annotations, and vocabulary keywords.
|
|
890
1191
|
*/
|
|
891
|
-
readonly extensions?: readonly
|
|
1192
|
+
readonly extensions?: readonly ExtensionDefinition_3[];
|
|
892
1193
|
/** Constraint surface configuration — controls which field types,
|
|
893
1194
|
* layouts, UI features, and field/control options are allowed. */
|
|
894
1195
|
readonly constraints?: ConstraintConfig;
|
|
@@ -1681,6 +1982,13 @@ declare interface LayoutTypeConstraints {
|
|
|
1681
1982
|
*/
|
|
1682
1983
|
declare type MetadataAuthoringSurface = "tsdoc" | "chain-dsl";
|
|
1683
1984
|
|
|
1985
|
+
/**
|
|
1986
|
+
* Authoring surfaces that can contribute metadata.
|
|
1987
|
+
*
|
|
1988
|
+
* @public
|
|
1989
|
+
*/
|
|
1990
|
+
declare type MetadataAuthoringSurface_2 = "tsdoc" | "chain-dsl";
|
|
1991
|
+
|
|
1684
1992
|
/**
|
|
1685
1993
|
* Declaration categories that metadata policy can target.
|
|
1686
1994
|
*
|
|
@@ -1688,6 +1996,13 @@ declare type MetadataAuthoringSurface = "tsdoc" | "chain-dsl";
|
|
|
1688
1996
|
*/
|
|
1689
1997
|
declare type MetadataDeclarationKind = "type" | "field" | "method";
|
|
1690
1998
|
|
|
1999
|
+
/**
|
|
2000
|
+
* Declaration categories that metadata policy can target.
|
|
2001
|
+
*
|
|
2002
|
+
* @public
|
|
2003
|
+
*/
|
|
2004
|
+
declare type MetadataDeclarationKind_2 = "type" | "field" | "method";
|
|
2005
|
+
|
|
1691
2006
|
/**
|
|
1692
2007
|
* Build-facing context passed to metadata inference callbacks.
|
|
1693
2008
|
*
|
|
@@ -1707,19 +2022,38 @@ declare interface MetadataInferenceContext {
|
|
|
1707
2022
|
readonly buildContext?: unknown;
|
|
1708
2023
|
}
|
|
1709
2024
|
|
|
2025
|
+
/**
|
|
2026
|
+
* Build-facing context passed to metadata inference callbacks.
|
|
2027
|
+
*
|
|
2028
|
+
* `buildContext` is intentionally opaque so browser/runtime packages do not
|
|
2029
|
+
* need to depend on TypeScript compiler types.
|
|
2030
|
+
*
|
|
2031
|
+
* @public
|
|
2032
|
+
*/
|
|
2033
|
+
declare interface MetadataInferenceContext_2 {
|
|
2034
|
+
/** Authoring surface the metadata is being resolved for. */
|
|
2035
|
+
readonly surface: MetadataAuthoringSurface_2;
|
|
2036
|
+
/** Declaration kind currently being resolved. */
|
|
2037
|
+
readonly declarationKind: MetadataDeclarationKind_2;
|
|
2038
|
+
/** Logical identifier before any metadata policy is applied. */
|
|
2039
|
+
readonly logicalName: string;
|
|
2040
|
+
/** Optional build-only context supplied by the resolver. */
|
|
2041
|
+
readonly buildContext?: unknown;
|
|
2042
|
+
}
|
|
2043
|
+
|
|
1710
2044
|
/**
|
|
1711
2045
|
* Callback used to infer a scalar metadata value.
|
|
1712
2046
|
*
|
|
1713
2047
|
* @public
|
|
1714
2048
|
*/
|
|
1715
|
-
declare type MetadataInferenceFn = (context:
|
|
2049
|
+
declare type MetadataInferenceFn = (context: MetadataInferenceContext_2) => string;
|
|
1716
2050
|
|
|
1717
2051
|
/**
|
|
1718
2052
|
* Context passed to pluralization callbacks.
|
|
1719
2053
|
*
|
|
1720
2054
|
* @public
|
|
1721
2055
|
*/
|
|
1722
|
-
declare interface MetadataPluralizationContext extends
|
|
2056
|
+
declare interface MetadataPluralizationContext extends MetadataInferenceContext_2 {
|
|
1723
2057
|
/** Singular value that pluralization should derive from. */
|
|
1724
2058
|
readonly singular: string;
|
|
1725
2059
|
}
|
|
@@ -1803,6 +2137,23 @@ declare interface MetadataQualifierRegistration {
|
|
|
1803
2137
|
readonly inferValue?: MetadataSlotInferenceFn | undefined;
|
|
1804
2138
|
}
|
|
1805
2139
|
|
|
2140
|
+
/**
|
|
2141
|
+
* Supported qualifier registration for an extensible metadata slot.
|
|
2142
|
+
*
|
|
2143
|
+
* @public
|
|
2144
|
+
*/
|
|
2145
|
+
declare interface MetadataQualifierRegistration_2 {
|
|
2146
|
+
/** Qualifier text without the leading colon. */
|
|
2147
|
+
readonly qualifier: string;
|
|
2148
|
+
/**
|
|
2149
|
+
* Optional source qualifier to use as the base input for this qualifier's
|
|
2150
|
+
* inference hook. Defaults to the slot's bare/default value when omitted.
|
|
2151
|
+
*/
|
|
2152
|
+
readonly sourceQualifier?: string | undefined;
|
|
2153
|
+
/** Optional inference hook for this qualified value. */
|
|
2154
|
+
readonly inferValue?: MetadataSlotInferenceFn_2 | undefined;
|
|
2155
|
+
}
|
|
2156
|
+
|
|
1806
2157
|
/**
|
|
1807
2158
|
* Stable slot identifier for extensible metadata analysis.
|
|
1808
2159
|
*
|
|
@@ -1810,6 +2161,13 @@ declare interface MetadataQualifierRegistration {
|
|
|
1810
2161
|
*/
|
|
1811
2162
|
declare type MetadataSlotId = string;
|
|
1812
2163
|
|
|
2164
|
+
/**
|
|
2165
|
+
* Stable slot identifier for extensible metadata analysis.
|
|
2166
|
+
*
|
|
2167
|
+
* @public
|
|
2168
|
+
*/
|
|
2169
|
+
declare type MetadataSlotId_2 = string;
|
|
2170
|
+
|
|
1813
2171
|
/**
|
|
1814
2172
|
* Context passed to extensible metadata inference hooks.
|
|
1815
2173
|
*
|
|
@@ -1826,6 +2184,22 @@ declare interface MetadataSlotInferenceContext extends MetadataInferenceContext
|
|
|
1826
2184
|
readonly baseValue?: string | undefined;
|
|
1827
2185
|
}
|
|
1828
2186
|
|
|
2187
|
+
/**
|
|
2188
|
+
* Context passed to extensible metadata inference hooks.
|
|
2189
|
+
*
|
|
2190
|
+
* @public
|
|
2191
|
+
*/
|
|
2192
|
+
declare interface MetadataSlotInferenceContext_2 extends MetadataInferenceContext_2 {
|
|
2193
|
+
/** Stable logical slot identifier. */
|
|
2194
|
+
readonly slotId: MetadataSlotId_2;
|
|
2195
|
+
/** Tag name associated with the slot, without the `@` prefix. */
|
|
2196
|
+
readonly tagName: string;
|
|
2197
|
+
/** Optional qualifier being inferred (for example `plural`). */
|
|
2198
|
+
readonly qualifier?: string | undefined;
|
|
2199
|
+
/** Resolved bare/default value used as the base input for derived qualifiers. */
|
|
2200
|
+
readonly baseValue?: string | undefined;
|
|
2201
|
+
}
|
|
2202
|
+
|
|
1829
2203
|
/**
|
|
1830
2204
|
* Callback used to infer an extensible metadata slot value.
|
|
1831
2205
|
*
|
|
@@ -1833,6 +2207,13 @@ declare interface MetadataSlotInferenceContext extends MetadataInferenceContext
|
|
|
1833
2207
|
*/
|
|
1834
2208
|
declare type MetadataSlotInferenceFn = (context: MetadataSlotInferenceContext) => string;
|
|
1835
2209
|
|
|
2210
|
+
/**
|
|
2211
|
+
* Callback used to infer an extensible metadata slot value.
|
|
2212
|
+
*
|
|
2213
|
+
* @public
|
|
2214
|
+
*/
|
|
2215
|
+
declare type MetadataSlotInferenceFn_2 = (context: MetadataSlotInferenceContext_2) => string;
|
|
2216
|
+
|
|
1836
2217
|
/**
|
|
1837
2218
|
* Extensible metadata slot definition shared across build- and lint-time analysis.
|
|
1838
2219
|
*
|
|
@@ -1858,6 +2239,31 @@ declare interface MetadataSlotRegistration {
|
|
|
1858
2239
|
readonly isApplicable?: ((context: MetadataInferenceContext) => boolean) | undefined;
|
|
1859
2240
|
}
|
|
1860
2241
|
|
|
2242
|
+
/**
|
|
2243
|
+
* Extensible metadata slot definition shared across build- and lint-time analysis.
|
|
2244
|
+
*
|
|
2245
|
+
* @public
|
|
2246
|
+
*/
|
|
2247
|
+
declare interface MetadataSlotRegistration_2 {
|
|
2248
|
+
/** Stable logical slot identifier. */
|
|
2249
|
+
readonly slotId: MetadataSlotId_2;
|
|
2250
|
+
/** Tag name associated with this slot, without the `@` prefix. */
|
|
2251
|
+
readonly tagName: string;
|
|
2252
|
+
/** Declaration kinds where the slot is meaningful. */
|
|
2253
|
+
readonly declarationKinds: readonly MetadataDeclarationKind_2[];
|
|
2254
|
+
/** Whether a bare tag without a qualifier is supported. Defaults to true. */
|
|
2255
|
+
readonly allowBare?: boolean | undefined;
|
|
2256
|
+
/** Supported qualifiers for this slot. */
|
|
2257
|
+
readonly qualifiers?: readonly MetadataQualifierRegistration_2[] | undefined;
|
|
2258
|
+
/** Optional inference hook for the bare/default slot value. */
|
|
2259
|
+
readonly inferValue?: MetadataSlotInferenceFn_2 | undefined;
|
|
2260
|
+
/**
|
|
2261
|
+
* Optional applicability hook for declaration-specific rules beyond
|
|
2262
|
+
* declaration kind. `buildContext` may carry compiler objects.
|
|
2263
|
+
*/
|
|
2264
|
+
readonly isApplicable?: ((context: MetadataInferenceContext_2) => boolean) | undefined;
|
|
2265
|
+
}
|
|
2266
|
+
|
|
1861
2267
|
/**
|
|
1862
2268
|
* Supported declaration kinds for standalone metadata resolution.
|
|
1863
2269
|
*
|
|
@@ -2200,6 +2606,7 @@ export declare interface StaticSchemaGenerationOptions {
|
|
|
2200
2606
|
readonly configPath?: string | undefined;
|
|
2201
2607
|
}
|
|
2202
2608
|
|
|
2609
|
+
/* Excluded from this release type: SyntheticCompilerDiagnostic */
|
|
2203
2610
|
export { TextField }
|
|
2204
2611
|
|
|
2205
2612
|
/**
|
|
@@ -2363,6 +2770,18 @@ declare interface VocabularyKeywordRegistration {
|
|
|
2363
2770
|
readonly schema: ExtensionPayloadValue;
|
|
2364
2771
|
}
|
|
2365
2772
|
|
|
2773
|
+
/**
|
|
2774
|
+
* Registration for a vocabulary keyword to include in a JSON Schema `$vocabulary` declaration.
|
|
2775
|
+
*
|
|
2776
|
+
* @public
|
|
2777
|
+
*/
|
|
2778
|
+
declare interface VocabularyKeywordRegistration_2 {
|
|
2779
|
+
/** The keyword name (without vendor prefix). */
|
|
2780
|
+
readonly keyword: string;
|
|
2781
|
+
/** JSON Schema that describes the valid values for this keyword. */
|
|
2782
|
+
readonly schema: ExtensionPayloadValue_2;
|
|
2783
|
+
}
|
|
2784
|
+
|
|
2366
2785
|
/**
|
|
2367
2786
|
* Builds and writes both JSON Schema and UI Schema files to disk.
|
|
2368
2787
|
*
|