@formspec/core 0.1.0-alpha.2 → 0.1.0-alpha.23
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 +85 -0
- package/dist/__tests__/constraint-definitions.test.d.ts +2 -0
- package/dist/__tests__/constraint-definitions.test.d.ts.map +1 -0
- package/dist/__tests__/guards.test.d.ts +2 -0
- package/dist/__tests__/guards.test.d.ts.map +1 -0
- package/dist/core-alpha.d.ts +1441 -0
- package/dist/core-beta.d.ts +1441 -0
- package/dist/core-internal.d.ts +1441 -0
- package/dist/core.d.ts +917 -0
- package/dist/extensions/index.d.ts +283 -0
- package/dist/extensions/index.d.ts.map +1 -0
- package/dist/guards.d.ts +73 -0
- package/dist/guards.d.ts.map +1 -0
- package/dist/index.cjs +130 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +6 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +85 -12
- package/dist/index.js.map +1 -1
- package/dist/internals.cjs +165 -0
- package/dist/internals.cjs.map +1 -0
- package/dist/internals.d.ts +13 -0
- package/dist/internals.d.ts.map +1 -0
- package/dist/internals.js +115 -0
- package/dist/internals.js.map +1 -0
- package/dist/types/constraint-definitions.d.ts +64 -0
- package/dist/types/constraint-definitions.d.ts.map +1 -0
- package/dist/types/data-source.d.ts +8 -0
- package/dist/types/data-source.d.ts.map +1 -1
- package/dist/types/elements.d.ts +40 -0
- package/dist/types/elements.d.ts.map +1 -1
- package/dist/types/field-state.d.ts +4 -0
- package/dist/types/field-state.d.ts.map +1 -1
- package/dist/types/form-state.d.ts +2 -0
- package/dist/types/form-state.d.ts.map +1 -1
- package/dist/types/index.d.ts +4 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/ir.d.ts +578 -0
- package/dist/types/ir.d.ts.map +1 -0
- package/dist/types/predicate.d.ts +4 -0
- package/dist/types/predicate.d.ts.map +1 -1
- package/dist/types/validity.d.ts +2 -0
- package/dist/types/validity.d.ts.map +1 -1
- package/package.json +25 -8
- package/dist/types/data-source.js +0 -2
- package/dist/types/data-source.js.map +0 -1
- package/dist/types/elements.js +0 -8
- package/dist/types/elements.js.map +0 -1
- package/dist/types/field-state.js +0 -17
- package/dist/types/field-state.js.map +0 -1
- package/dist/types/form-state.js +0 -2
- package/dist/types/form-state.js.map +0 -1
- package/dist/types/index.js +0 -3
- package/dist/types/index.js.map +0 -1
- package/dist/types/predicate.js +0 -7
- package/dist/types/predicate.js.map +0 -1
- package/dist/types/validity.js +0 -2
- package/dist/types/validity.js.map +0 -1
|
@@ -0,0 +1,578 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Canonical Intermediate Representation (IR) types for FormSpec.
|
|
3
|
+
*
|
|
4
|
+
* The IR is the shared intermediate structure that both authoring surfaces
|
|
5
|
+
* (chain DSL and TSDoc-annotated types) compile to. All downstream operations
|
|
6
|
+
* — JSON Schema generation, UI Schema generation, constraint validation,
|
|
7
|
+
* diagnostics — consume the IR exclusively.
|
|
8
|
+
*
|
|
9
|
+
* All types are plain, serializable objects (no live compiler references).
|
|
10
|
+
*
|
|
11
|
+
* @see {@link https://github.com/stripe/formspec-workspace/blob/main/scratch/design/001-canonical-ir.md}
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* The current IR format version. Centralized here so all canonicalizers
|
|
15
|
+
* and consumers reference a single source of truth.
|
|
16
|
+
*
|
|
17
|
+
* @beta
|
|
18
|
+
*/
|
|
19
|
+
export declare const IR_VERSION: "0.1.0";
|
|
20
|
+
/**
|
|
21
|
+
* A JSON-serializable value. All IR nodes must be representable as JSON.
|
|
22
|
+
*
|
|
23
|
+
* @beta
|
|
24
|
+
*/
|
|
25
|
+
export type JsonValue = null | boolean | number | string | readonly JsonValue[] | {
|
|
26
|
+
readonly [key: string]: JsonValue;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Describes the origin of an IR node.
|
|
30
|
+
* Enables diagnostics that point to the source of a contradiction or error.
|
|
31
|
+
*
|
|
32
|
+
* @beta
|
|
33
|
+
*/
|
|
34
|
+
export interface Provenance {
|
|
35
|
+
/** The authoring surface that produced this node. */
|
|
36
|
+
readonly surface: "tsdoc" | "chain-dsl" | "extension" | "inferred";
|
|
37
|
+
/** Absolute path to the source file. */
|
|
38
|
+
readonly file: string;
|
|
39
|
+
/** 1-based line number in the source file. */
|
|
40
|
+
readonly line: number;
|
|
41
|
+
/** 0-based column number in the source file. */
|
|
42
|
+
readonly column: number;
|
|
43
|
+
/** Length of the source span in characters (for IDE underline ranges). */
|
|
44
|
+
readonly length?: number;
|
|
45
|
+
/**
|
|
46
|
+
* The specific tag, call, or construct that produced this node.
|
|
47
|
+
* Examples: `@minimum`, `field.number({ min: 0 })`, `optional`
|
|
48
|
+
*/
|
|
49
|
+
readonly tagName?: string;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* A path targeting a sub-field within a complex type.
|
|
53
|
+
* Used by constraints and annotations to target nested properties.
|
|
54
|
+
*
|
|
55
|
+
* @beta
|
|
56
|
+
*/
|
|
57
|
+
export interface PathTarget {
|
|
58
|
+
/**
|
|
59
|
+
* Sequence of property names forming a path from the annotated field's type
|
|
60
|
+
* to the target sub-field.
|
|
61
|
+
* e.g., `["value"]` or `["address", "zip"]`
|
|
62
|
+
*/
|
|
63
|
+
readonly segments: readonly string[];
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Discriminated union of all type representations in the IR.
|
|
67
|
+
*
|
|
68
|
+
* @beta
|
|
69
|
+
*/
|
|
70
|
+
export type TypeNode = PrimitiveTypeNode | EnumTypeNode | ArrayTypeNode | ObjectTypeNode | RecordTypeNode | UnionTypeNode | ReferenceTypeNode | DynamicTypeNode | CustomTypeNode;
|
|
71
|
+
/**
|
|
72
|
+
* Primitive types mapping directly to JSON Schema primitives.
|
|
73
|
+
*
|
|
74
|
+
* Note: integer is NOT a primitive kind — integer semantics are expressed
|
|
75
|
+
* via a `multipleOf: 1` constraint on a number type.
|
|
76
|
+
*
|
|
77
|
+
* @beta
|
|
78
|
+
*/
|
|
79
|
+
export interface PrimitiveTypeNode {
|
|
80
|
+
readonly kind: "primitive";
|
|
81
|
+
readonly primitiveKind: "string" | "number" | "integer" | "bigint" | "boolean" | "null";
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* A member of a static enum type.
|
|
85
|
+
*
|
|
86
|
+
* @beta
|
|
87
|
+
*/
|
|
88
|
+
export interface EnumMember {
|
|
89
|
+
/** The serialized value stored in data. */
|
|
90
|
+
readonly value: string | number;
|
|
91
|
+
/** Optional per-member display name. */
|
|
92
|
+
readonly displayName?: string;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Static enum type with members known at build time.
|
|
96
|
+
*
|
|
97
|
+
* @beta
|
|
98
|
+
*/
|
|
99
|
+
export interface EnumTypeNode {
|
|
100
|
+
readonly kind: "enum";
|
|
101
|
+
readonly members: readonly EnumMember[];
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Array type with a single items type.
|
|
105
|
+
*
|
|
106
|
+
* @beta
|
|
107
|
+
*/
|
|
108
|
+
export interface ArrayTypeNode {
|
|
109
|
+
readonly kind: "array";
|
|
110
|
+
readonly items: TypeNode;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* A named property within an object type.
|
|
114
|
+
*
|
|
115
|
+
* @beta
|
|
116
|
+
*/
|
|
117
|
+
export interface ObjectProperty {
|
|
118
|
+
readonly name: string;
|
|
119
|
+
readonly type: TypeNode;
|
|
120
|
+
readonly optional: boolean;
|
|
121
|
+
/**
|
|
122
|
+
* Use-site constraints on this property.
|
|
123
|
+
* Distinct from constraints on the property's type — these are
|
|
124
|
+
* use-site constraints (e.g., `@minimum :amount 0` targets the
|
|
125
|
+
* `amount` property of a `MonetaryAmount` field).
|
|
126
|
+
*/
|
|
127
|
+
readonly constraints: readonly ConstraintNode[];
|
|
128
|
+
/** Use-site annotations on this property. */
|
|
129
|
+
readonly annotations: readonly AnnotationNode[];
|
|
130
|
+
readonly provenance: Provenance;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Object type with named properties.
|
|
134
|
+
*
|
|
135
|
+
* @beta
|
|
136
|
+
*/
|
|
137
|
+
export interface ObjectTypeNode {
|
|
138
|
+
readonly kind: "object";
|
|
139
|
+
/**
|
|
140
|
+
* Named properties of this object. Order is preserved from the source
|
|
141
|
+
* declaration for deterministic output.
|
|
142
|
+
*/
|
|
143
|
+
readonly properties: readonly ObjectProperty[];
|
|
144
|
+
/**
|
|
145
|
+
* Whether additional properties beyond those listed are permitted.
|
|
146
|
+
* Ordinary static object types default to true under the current spec.
|
|
147
|
+
* Explicitly closed-object modes may still set this to false.
|
|
148
|
+
*/
|
|
149
|
+
readonly additionalProperties: boolean;
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Record (dictionary) type — an object with a string index signature and no
|
|
153
|
+
* named properties. Corresponds to `Record<string, T>` or `{ [k: string]: T }`.
|
|
154
|
+
*
|
|
155
|
+
* Emitted as `{ "type": "object", "additionalProperties": <value schema> }` in
|
|
156
|
+
* JSON Schema per spec 003 §2.5.
|
|
157
|
+
*
|
|
158
|
+
* @beta
|
|
159
|
+
*/
|
|
160
|
+
export interface RecordTypeNode {
|
|
161
|
+
readonly kind: "record";
|
|
162
|
+
/** The type of each value in the dictionary. */
|
|
163
|
+
readonly valueType: TypeNode;
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Union type for non-enum unions. Nullable types are represented as `T | null`.
|
|
167
|
+
*
|
|
168
|
+
* @beta
|
|
169
|
+
*/
|
|
170
|
+
export interface UnionTypeNode {
|
|
171
|
+
readonly kind: "union";
|
|
172
|
+
readonly members: readonly TypeNode[];
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Named type reference preserved for `$defs` and `$ref` emission.
|
|
176
|
+
*
|
|
177
|
+
* @beta
|
|
178
|
+
*/
|
|
179
|
+
export interface ReferenceTypeNode {
|
|
180
|
+
readonly kind: "reference";
|
|
181
|
+
/**
|
|
182
|
+
* The fully-qualified name of the referenced type.
|
|
183
|
+
* For TypeScript interfaces/type aliases: `"<module>#<TypeName>"`.
|
|
184
|
+
* For built-in types: the primitive kind string.
|
|
185
|
+
*/
|
|
186
|
+
readonly name: string;
|
|
187
|
+
/**
|
|
188
|
+
* Type arguments if this is a generic instantiation.
|
|
189
|
+
* e.g., `Array<string>` → `{ name: "Array", typeArguments: [PrimitiveTypeNode("string")] }`
|
|
190
|
+
*/
|
|
191
|
+
readonly typeArguments: readonly TypeNode[];
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Dynamic type whose schema is resolved at runtime from a named data source.
|
|
195
|
+
*
|
|
196
|
+
* @beta
|
|
197
|
+
*/
|
|
198
|
+
export interface DynamicTypeNode {
|
|
199
|
+
readonly kind: "dynamic";
|
|
200
|
+
readonly dynamicKind: "enum" | "schema";
|
|
201
|
+
/** Key identifying the runtime data source or schema provider. */
|
|
202
|
+
readonly sourceKey: string;
|
|
203
|
+
/**
|
|
204
|
+
* For dynamic enums: field names whose current values are passed as
|
|
205
|
+
* parameters to the data source resolver.
|
|
206
|
+
*/
|
|
207
|
+
readonly parameterFields: readonly string[];
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* Custom type registered by an extension.
|
|
211
|
+
*
|
|
212
|
+
* @beta
|
|
213
|
+
*/
|
|
214
|
+
export interface CustomTypeNode {
|
|
215
|
+
readonly kind: "custom";
|
|
216
|
+
/**
|
|
217
|
+
* The extension-qualified type identifier.
|
|
218
|
+
* Format: `"<vendor-prefix>/<extension-name>/<type-name>"`
|
|
219
|
+
* e.g., `"x-stripe/monetary/MonetaryAmount"`
|
|
220
|
+
*/
|
|
221
|
+
readonly typeId: string;
|
|
222
|
+
/**
|
|
223
|
+
* Opaque payload serialized by the extension that registered this type.
|
|
224
|
+
* Must be JSON-serializable.
|
|
225
|
+
*/
|
|
226
|
+
readonly payload: JsonValue;
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* Discriminated union of all constraint types.
|
|
230
|
+
* Constraints are set-influencing: they narrow the set of valid values.
|
|
231
|
+
*
|
|
232
|
+
* @beta
|
|
233
|
+
*/
|
|
234
|
+
export type ConstraintNode = NumericConstraintNode | LengthConstraintNode | PatternConstraintNode | ArrayCardinalityConstraintNode | EnumMemberConstraintNode | ConstConstraintNode | CustomConstraintNode;
|
|
235
|
+
/**
|
|
236
|
+
* Numeric constraints: bounds and multipleOf.
|
|
237
|
+
*
|
|
238
|
+
* `minimum` and `maximum` are inclusive; `exclusiveMinimum` and
|
|
239
|
+
* `exclusiveMaximum` are exclusive bounds (matching JSON Schema 2020-12
|
|
240
|
+
* semantics).
|
|
241
|
+
*
|
|
242
|
+
* Type applicability: may only attach to fields with `PrimitiveTypeNode("number")`
|
|
243
|
+
* or a `ReferenceTypeNode` that resolves to one.
|
|
244
|
+
*
|
|
245
|
+
* @beta
|
|
246
|
+
*/
|
|
247
|
+
export interface NumericConstraintNode {
|
|
248
|
+
readonly kind: "constraint";
|
|
249
|
+
readonly constraintKind: "minimum" | "maximum" | "exclusiveMinimum" | "exclusiveMaximum" | "multipleOf";
|
|
250
|
+
readonly value: number;
|
|
251
|
+
/** If present, targets a nested sub-field rather than the field itself. */
|
|
252
|
+
readonly path?: PathTarget;
|
|
253
|
+
readonly provenance: Provenance;
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
* String length and array item count constraints.
|
|
257
|
+
*
|
|
258
|
+
* `minLength`/`maxLength` apply to strings; `minItems`/`maxItems` apply to
|
|
259
|
+
* arrays. They share the same node shape because the composition rules are
|
|
260
|
+
* identical.
|
|
261
|
+
*
|
|
262
|
+
* Type applicability: `minLength`/`maxLength` require `PrimitiveTypeNode("string")`;
|
|
263
|
+
* `minItems`/`maxItems` require `ArrayTypeNode`.
|
|
264
|
+
*
|
|
265
|
+
* @beta
|
|
266
|
+
*/
|
|
267
|
+
export interface LengthConstraintNode {
|
|
268
|
+
readonly kind: "constraint";
|
|
269
|
+
readonly constraintKind: "minLength" | "maxLength" | "minItems" | "maxItems";
|
|
270
|
+
readonly value: number;
|
|
271
|
+
readonly path?: PathTarget;
|
|
272
|
+
readonly provenance: Provenance;
|
|
273
|
+
}
|
|
274
|
+
/**
|
|
275
|
+
* String pattern constraint (ECMA-262 regex without delimiters).
|
|
276
|
+
*
|
|
277
|
+
* Multiple `pattern` constraints on the same field compose via intersection:
|
|
278
|
+
* all patterns must match simultaneously.
|
|
279
|
+
*
|
|
280
|
+
* Type applicability: requires `PrimitiveTypeNode("string")`.
|
|
281
|
+
*
|
|
282
|
+
* @beta
|
|
283
|
+
*/
|
|
284
|
+
export interface PatternConstraintNode {
|
|
285
|
+
readonly kind: "constraint";
|
|
286
|
+
readonly constraintKind: "pattern";
|
|
287
|
+
/** ECMA-262 regular expression, without delimiters. */
|
|
288
|
+
readonly pattern: string;
|
|
289
|
+
readonly path?: PathTarget;
|
|
290
|
+
readonly provenance: Provenance;
|
|
291
|
+
}
|
|
292
|
+
/**
|
|
293
|
+
* Array uniqueness constraint.
|
|
294
|
+
*
|
|
295
|
+
* @beta
|
|
296
|
+
*/
|
|
297
|
+
export interface ArrayCardinalityConstraintNode {
|
|
298
|
+
readonly kind: "constraint";
|
|
299
|
+
readonly constraintKind: "uniqueItems";
|
|
300
|
+
readonly value: true;
|
|
301
|
+
readonly path?: PathTarget;
|
|
302
|
+
readonly provenance: Provenance;
|
|
303
|
+
}
|
|
304
|
+
/**
|
|
305
|
+
* Enum member subset constraint that only narrows the allowed member set.
|
|
306
|
+
*
|
|
307
|
+
* @beta
|
|
308
|
+
*/
|
|
309
|
+
export interface EnumMemberConstraintNode {
|
|
310
|
+
readonly kind: "constraint";
|
|
311
|
+
readonly constraintKind: "allowedMembers";
|
|
312
|
+
readonly members: readonly (string | number)[];
|
|
313
|
+
readonly path?: PathTarget;
|
|
314
|
+
readonly provenance: Provenance;
|
|
315
|
+
}
|
|
316
|
+
/**
|
|
317
|
+
* Literal-value equality constraint.
|
|
318
|
+
*
|
|
319
|
+
* @beta
|
|
320
|
+
*/
|
|
321
|
+
export interface ConstConstraintNode {
|
|
322
|
+
readonly kind: "constraint";
|
|
323
|
+
readonly constraintKind: "const";
|
|
324
|
+
readonly value: JsonValue;
|
|
325
|
+
readonly path?: PathTarget;
|
|
326
|
+
readonly provenance: Provenance;
|
|
327
|
+
}
|
|
328
|
+
/**
|
|
329
|
+
* Extension-registered custom constraint.
|
|
330
|
+
*
|
|
331
|
+
* @beta
|
|
332
|
+
*/
|
|
333
|
+
export interface CustomConstraintNode {
|
|
334
|
+
readonly kind: "constraint";
|
|
335
|
+
readonly constraintKind: "custom";
|
|
336
|
+
/** Extension-qualified ID: `"<vendor-prefix>/<extension-name>/<constraint-name>"` */
|
|
337
|
+
readonly constraintId: string;
|
|
338
|
+
/** JSON-serializable payload defined by the extension. */
|
|
339
|
+
readonly payload: JsonValue;
|
|
340
|
+
/** How this constraint composes with others of the same `constraintId`. */
|
|
341
|
+
readonly compositionRule: "intersect" | "override";
|
|
342
|
+
readonly path?: PathTarget;
|
|
343
|
+
readonly provenance: Provenance;
|
|
344
|
+
}
|
|
345
|
+
/**
|
|
346
|
+
* Discriminated union of all annotation types.
|
|
347
|
+
* Annotations are value-influencing: they describe or present a field
|
|
348
|
+
* but do not affect which values are valid.
|
|
349
|
+
*
|
|
350
|
+
* @beta
|
|
351
|
+
*/
|
|
352
|
+
export type AnnotationNode = DisplayNameAnnotationNode | DescriptionAnnotationNode | RemarksAnnotationNode | FormatAnnotationNode | PlaceholderAnnotationNode | DefaultValueAnnotationNode | DeprecatedAnnotationNode | FormatHintAnnotationNode | CustomAnnotationNode;
|
|
353
|
+
/**
|
|
354
|
+
* Display-name annotation.
|
|
355
|
+
*
|
|
356
|
+
* @beta
|
|
357
|
+
*/
|
|
358
|
+
export interface DisplayNameAnnotationNode {
|
|
359
|
+
readonly kind: "annotation";
|
|
360
|
+
readonly annotationKind: "displayName";
|
|
361
|
+
readonly value: string;
|
|
362
|
+
readonly provenance: Provenance;
|
|
363
|
+
}
|
|
364
|
+
/**
|
|
365
|
+
* Description annotation.
|
|
366
|
+
*
|
|
367
|
+
* @beta
|
|
368
|
+
*/
|
|
369
|
+
export interface DescriptionAnnotationNode {
|
|
370
|
+
readonly kind: "annotation";
|
|
371
|
+
readonly annotationKind: "description";
|
|
372
|
+
readonly value: string;
|
|
373
|
+
readonly provenance: Provenance;
|
|
374
|
+
}
|
|
375
|
+
/**
|
|
376
|
+
* Remarks annotation — programmatic-persona documentation carried via
|
|
377
|
+
* the `x-<vendor>-remarks` JSON Schema extension keyword.
|
|
378
|
+
*
|
|
379
|
+
* Populated from `@remarks` TSDoc tag content. SDK codegen can include
|
|
380
|
+
* this in doc comments; API Documenter renders the source `@remarks`
|
|
381
|
+
* natively in a dedicated Remarks section.
|
|
382
|
+
*
|
|
383
|
+
* @beta
|
|
384
|
+
*/
|
|
385
|
+
export interface RemarksAnnotationNode {
|
|
386
|
+
readonly kind: "annotation";
|
|
387
|
+
readonly annotationKind: "remarks";
|
|
388
|
+
readonly value: string;
|
|
389
|
+
readonly provenance: Provenance;
|
|
390
|
+
}
|
|
391
|
+
/**
|
|
392
|
+
* Schema format annotation, for example `email`, `date`, or `uri`.
|
|
393
|
+
*
|
|
394
|
+
* @beta
|
|
395
|
+
*/
|
|
396
|
+
export interface FormatAnnotationNode {
|
|
397
|
+
readonly kind: "annotation";
|
|
398
|
+
readonly annotationKind: "format";
|
|
399
|
+
readonly value: string;
|
|
400
|
+
readonly provenance: Provenance;
|
|
401
|
+
}
|
|
402
|
+
/**
|
|
403
|
+
* Placeholder annotation.
|
|
404
|
+
*
|
|
405
|
+
* @beta
|
|
406
|
+
*/
|
|
407
|
+
export interface PlaceholderAnnotationNode {
|
|
408
|
+
readonly kind: "annotation";
|
|
409
|
+
readonly annotationKind: "placeholder";
|
|
410
|
+
readonly value: string;
|
|
411
|
+
readonly provenance: Provenance;
|
|
412
|
+
}
|
|
413
|
+
/**
|
|
414
|
+
* Default-value annotation.
|
|
415
|
+
*
|
|
416
|
+
* @beta
|
|
417
|
+
*/
|
|
418
|
+
export interface DefaultValueAnnotationNode {
|
|
419
|
+
readonly kind: "annotation";
|
|
420
|
+
readonly annotationKind: "defaultValue";
|
|
421
|
+
/** Must be JSON-serializable and type-compatible (verified during Validate phase). */
|
|
422
|
+
readonly value: JsonValue;
|
|
423
|
+
readonly provenance: Provenance;
|
|
424
|
+
}
|
|
425
|
+
/**
|
|
426
|
+
* Deprecated annotation.
|
|
427
|
+
*
|
|
428
|
+
* @beta
|
|
429
|
+
*/
|
|
430
|
+
export interface DeprecatedAnnotationNode {
|
|
431
|
+
readonly kind: "annotation";
|
|
432
|
+
readonly annotationKind: "deprecated";
|
|
433
|
+
/** Optional deprecation message. */
|
|
434
|
+
readonly message?: string;
|
|
435
|
+
readonly provenance: Provenance;
|
|
436
|
+
}
|
|
437
|
+
/**
|
|
438
|
+
* UI rendering hint — does not affect schema validation.
|
|
439
|
+
* Unlike FormatAnnotationNode, this never emits a JSON Schema `format`.
|
|
440
|
+
*
|
|
441
|
+
* @beta
|
|
442
|
+
*/
|
|
443
|
+
export interface FormatHintAnnotationNode {
|
|
444
|
+
readonly kind: "annotation";
|
|
445
|
+
readonly annotationKind: "formatHint";
|
|
446
|
+
/** Renderer-specific format identifier: "textarea", "radio", "date", "color", etc. */
|
|
447
|
+
readonly format: string;
|
|
448
|
+
readonly provenance: Provenance;
|
|
449
|
+
}
|
|
450
|
+
/**
|
|
451
|
+
* Extension-registered custom annotation.
|
|
452
|
+
*
|
|
453
|
+
* @beta
|
|
454
|
+
*/
|
|
455
|
+
export interface CustomAnnotationNode {
|
|
456
|
+
readonly kind: "annotation";
|
|
457
|
+
readonly annotationKind: "custom";
|
|
458
|
+
/** Extension-qualified ID: `"<vendor-prefix>/<extension-name>/<annotation-name>"` */
|
|
459
|
+
readonly annotationId: string;
|
|
460
|
+
readonly value: JsonValue;
|
|
461
|
+
readonly provenance: Provenance;
|
|
462
|
+
}
|
|
463
|
+
/**
|
|
464
|
+
* A single form field after canonicalization.
|
|
465
|
+
*
|
|
466
|
+
* @beta
|
|
467
|
+
*/
|
|
468
|
+
export interface FieldNode {
|
|
469
|
+
readonly kind: "field";
|
|
470
|
+
/** The field's key in the data schema. */
|
|
471
|
+
readonly name: string;
|
|
472
|
+
/** The resolved type of this field. */
|
|
473
|
+
readonly type: TypeNode;
|
|
474
|
+
/** Whether this field is required in the data schema. */
|
|
475
|
+
readonly required: boolean;
|
|
476
|
+
/** Set-influencing constraints, after merging. */
|
|
477
|
+
readonly constraints: readonly ConstraintNode[];
|
|
478
|
+
/** Value-influencing annotations, after merging. */
|
|
479
|
+
readonly annotations: readonly AnnotationNode[];
|
|
480
|
+
/** Where this field was declared. */
|
|
481
|
+
readonly provenance: Provenance;
|
|
482
|
+
/**
|
|
483
|
+
* Debug only — ordered list of constraint/annotation nodes that participated
|
|
484
|
+
* in merging, including dominated ones.
|
|
485
|
+
*/
|
|
486
|
+
readonly mergeHistory?: readonly {
|
|
487
|
+
readonly node: ConstraintNode | AnnotationNode;
|
|
488
|
+
readonly dominated: boolean;
|
|
489
|
+
}[];
|
|
490
|
+
}
|
|
491
|
+
/**
|
|
492
|
+
* Union of layout node types.
|
|
493
|
+
*
|
|
494
|
+
* @beta
|
|
495
|
+
*/
|
|
496
|
+
export type LayoutNode = GroupLayoutNode | ConditionalLayoutNode;
|
|
497
|
+
/**
|
|
498
|
+
* A visual grouping of form elements.
|
|
499
|
+
*
|
|
500
|
+
* @beta
|
|
501
|
+
*/
|
|
502
|
+
export interface GroupLayoutNode {
|
|
503
|
+
readonly kind: "group";
|
|
504
|
+
readonly label: string;
|
|
505
|
+
/** Elements contained in this group — may be fields or nested groups. */
|
|
506
|
+
readonly elements: readonly FormIRElement[];
|
|
507
|
+
readonly provenance: Provenance;
|
|
508
|
+
}
|
|
509
|
+
/**
|
|
510
|
+
* Conditional visibility based on another field's value.
|
|
511
|
+
*
|
|
512
|
+
* @beta
|
|
513
|
+
*/
|
|
514
|
+
export interface ConditionalLayoutNode {
|
|
515
|
+
readonly kind: "conditional";
|
|
516
|
+
/** The field whose value triggers visibility. */
|
|
517
|
+
readonly fieldName: string;
|
|
518
|
+
/** The value that makes the condition true (SHOW). */
|
|
519
|
+
readonly value: JsonValue;
|
|
520
|
+
/** Elements shown when the condition is met. */
|
|
521
|
+
readonly elements: readonly FormIRElement[];
|
|
522
|
+
readonly provenance: Provenance;
|
|
523
|
+
}
|
|
524
|
+
/**
|
|
525
|
+
* Union of all IR element types.
|
|
526
|
+
*
|
|
527
|
+
* @beta
|
|
528
|
+
*/
|
|
529
|
+
export type FormIRElement = FieldNode | LayoutNode;
|
|
530
|
+
/**
|
|
531
|
+
* A named type definition stored in the type registry.
|
|
532
|
+
*
|
|
533
|
+
* @beta
|
|
534
|
+
*/
|
|
535
|
+
export interface TypeDefinition {
|
|
536
|
+
/** The fully-qualified reference name (key in the registry). */
|
|
537
|
+
readonly name: string;
|
|
538
|
+
/** The resolved type node. */
|
|
539
|
+
readonly type: TypeNode;
|
|
540
|
+
/** Constraints declared on the named type itself. */
|
|
541
|
+
readonly constraints?: readonly ConstraintNode[];
|
|
542
|
+
/** Root-level value metadata for a named type definition. */
|
|
543
|
+
readonly annotations?: readonly AnnotationNode[];
|
|
544
|
+
/** Where this type was declared. */
|
|
545
|
+
readonly provenance: Provenance;
|
|
546
|
+
}
|
|
547
|
+
/**
|
|
548
|
+
* The complete Canonical Intermediate Representation for a form.
|
|
549
|
+
*
|
|
550
|
+
* Output of the Canonicalize phase; input to Validate, Generate (JSON Schema),
|
|
551
|
+
* and Generate (UI Schema) phases.
|
|
552
|
+
*
|
|
553
|
+
* Serializable to JSON — no live compiler objects.
|
|
554
|
+
*
|
|
555
|
+
* @beta
|
|
556
|
+
*/
|
|
557
|
+
export interface FormIR {
|
|
558
|
+
readonly kind: "form-ir";
|
|
559
|
+
/**
|
|
560
|
+
* Schema version for the IR format itself.
|
|
561
|
+
* Should equal `IR_VERSION`.
|
|
562
|
+
*/
|
|
563
|
+
readonly irVersion: string;
|
|
564
|
+
/** Top-level elements of the form: fields and layout nodes. */
|
|
565
|
+
readonly elements: readonly FormIRElement[];
|
|
566
|
+
/** Root-level annotations derived from the source declaration itself. */
|
|
567
|
+
readonly rootAnnotations?: readonly AnnotationNode[];
|
|
568
|
+
/**
|
|
569
|
+
* Registry of named types referenced by fields in this form.
|
|
570
|
+
* Keys are fully-qualified type names matching `ReferenceTypeNode.name`.
|
|
571
|
+
*/
|
|
572
|
+
readonly typeRegistry: Readonly<Record<string, TypeDefinition>>;
|
|
573
|
+
/** Root-level metadata for the form itself. */
|
|
574
|
+
readonly annotations?: readonly AnnotationNode[];
|
|
575
|
+
/** Provenance of the form definition itself. */
|
|
576
|
+
readonly provenance: Provenance;
|
|
577
|
+
}
|
|
578
|
+
//# sourceMappingURL=ir.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ir.d.ts","sourceRoot":"","sources":["../../src/types/ir.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAMH;;;;;GAKG;AACH,eAAO,MAAM,UAAU,EAAG,OAAgB,CAAC;AAM3C;;;;GAIG;AACH,MAAM,MAAM,SAAS,GACjB,IAAI,GACJ,OAAO,GACP,MAAM,GACN,MAAM,GACN,SAAS,SAAS,EAAE,GACpB;IAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,CAAC;AAM1C;;;;;GAKG;AACH,MAAM,WAAW,UAAU;IACzB,qDAAqD;IACrD,QAAQ,CAAC,OAAO,EAAE,OAAO,GAAG,WAAW,GAAG,WAAW,GAAG,UAAU,CAAC;IACnE,wCAAwC;IACxC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,8CAA8C;IAC9C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,gDAAgD;IAChD,QAAQ,CAAC,MAAM,EAAE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M,aAAa,GAAG,SAAS,GAAG,UAAU,CAAC;AAMnD;;;;GAIG;AACH,MAAM,WAAW,cAAc;IAC7B,gEAAgE;IAChE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,8BAA8B;IAC9B,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IACxB,qDAAqD;IACrD,QAAQ,CAAC,WAAW,CAAC,EAAE,SAAS,cAAc,EAAE,CAAC;IACjD,6DAA6D;IAC7D,QAAQ,CAAC,WAAW,CAAC,EAAE,SAAS,cAAc,EAAE,CAAC;IACjD,oCAAoC;IACpC,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC;CACjC;AAMD;;;;;;;;;GASG;AACH,MAAM,WAAW,MAAM;IACrB,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IACzB;;;OAGG;IACH,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,+DAA+D;IAC/D,QAAQ,CAAC,QAAQ,EAAE,SAAS,aAAa,EAAE,CAAC;IAC5C,yEAAyE;IACzE,QAAQ,CAAC,eAAe,CAAC,EAAE,SAAS,cAAc,EAAE,CAAC;IACrD;;;OAGG;IACH,QAAQ,CAAC,YAAY,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC,CAAC;IAChE,+CAA+C;IAC/C,QAAQ,CAAC,WAAW,CAAC,EAAE,SAAS,cAAc,EAAE,CAAC;IACjD,gDAAgD;IAChD,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC;CACjC"}
|
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
*
|
|
9
9
|
* @typeParam K - The field name to check
|
|
10
10
|
* @typeParam V - The value to compare against
|
|
11
|
+
*
|
|
12
|
+
* @public
|
|
11
13
|
*/
|
|
12
14
|
export interface EqualsPredicate<K extends string, V> {
|
|
13
15
|
/** Predicate type discriminator */
|
|
@@ -24,6 +26,8 @@ export interface EqualsPredicate<K extends string, V> {
|
|
|
24
26
|
* - `OneOfPredicate` - field value is one of several options
|
|
25
27
|
* - `NotPredicate` - negation of another predicate
|
|
26
28
|
* - `AndPredicate` / `OrPredicate` - logical combinations
|
|
29
|
+
*
|
|
30
|
+
* @public
|
|
27
31
|
*/
|
|
28
32
|
export type Predicate<K extends string = string, V = unknown> = EqualsPredicate<K, V>;
|
|
29
33
|
//# sourceMappingURL=predicate.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"predicate.d.ts","sourceRoot":"","sources":["../../src/types/predicate.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH
|
|
1
|
+
{"version":3,"file":"predicate.d.ts","sourceRoot":"","sources":["../../src/types/predicate.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;GAOG;AACH,MAAM,WAAW,eAAe,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC;IAClD,mCAAmC;IACnC,QAAQ,CAAC,UAAU,EAAE,QAAQ,CAAC;IAC9B,iCAAiC;IACjC,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAC;IAClB,sCAAsC;IACtC,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAC;CACnB;AAED;;;;;;;;;GASG;AACH,MAAM,MAAM,SAAS,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,EAAE,CAAC,GAAG,OAAO,IAAI,eAAe,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC"}
|
package/dist/types/validity.d.ts
CHANGED
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
* - `"valid"` - All validations pass
|
|
5
5
|
* - `"invalid"` - One or more validations failed
|
|
6
6
|
* - `"unknown"` - Validation state not yet determined (e.g., async validation pending)
|
|
7
|
+
*
|
|
8
|
+
* @public
|
|
7
9
|
*/
|
|
8
10
|
export type Validity = "valid" | "invalid" | "unknown";
|
|
9
11
|
//# sourceMappingURL=validity.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validity.d.ts","sourceRoot":"","sources":["../../src/types/validity.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"validity.d.ts","sourceRoot":"","sources":["../../src/types/validity.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,MAAM,MAAM,QAAQ,GAAG,OAAO,GAAG,SAAS,GAAG,SAAS,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,30 +1,47 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@formspec/core",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.23",
|
|
4
4
|
"description": "Core utilities for formspec",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"main": "./dist/index.
|
|
6
|
+
"main": "./dist/index.cjs",
|
|
7
|
+
"module": "./dist/index.js",
|
|
7
8
|
"types": "./dist/core.d.ts",
|
|
8
9
|
"exports": {
|
|
9
10
|
".": {
|
|
10
11
|
"types": "./dist/core.d.ts",
|
|
11
|
-
"import": "./dist/index.js"
|
|
12
|
+
"import": "./dist/index.js",
|
|
13
|
+
"require": "./dist/index.cjs"
|
|
14
|
+
},
|
|
15
|
+
"./internals": {
|
|
16
|
+
"types": "./dist/internals.d.ts",
|
|
17
|
+
"import": "./dist/internals.js",
|
|
18
|
+
"require": "./dist/internals.cjs"
|
|
12
19
|
}
|
|
13
20
|
},
|
|
14
21
|
"files": [
|
|
15
|
-
"dist"
|
|
22
|
+
"dist",
|
|
23
|
+
"README.md"
|
|
16
24
|
],
|
|
25
|
+
"devDependencies": {
|
|
26
|
+
"tsd": "^0.31.0",
|
|
27
|
+
"vitest": "^3.2.4"
|
|
28
|
+
},
|
|
29
|
+
"tsd": {
|
|
30
|
+
"directory": "src/__tests__"
|
|
31
|
+
},
|
|
17
32
|
"publishConfig": {
|
|
18
33
|
"access": "public"
|
|
19
34
|
},
|
|
20
35
|
"keywords": [],
|
|
21
36
|
"license": "UNLICENSED",
|
|
22
37
|
"scripts": {
|
|
23
|
-
"build": "tsc",
|
|
38
|
+
"build": "tsup && tsc --emitDeclarationOnly && pnpm run api-extractor:local",
|
|
24
39
|
"clean": "rm -rf dist temp",
|
|
25
40
|
"typecheck": "tsc --noEmit",
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"api-
|
|
41
|
+
"test": "vitest run && tsd",
|
|
42
|
+
"test:types": "tsd",
|
|
43
|
+
"api-extractor": "api-extractor run && node ../../scripts/normalize-generated-markdown.mjs api-report",
|
|
44
|
+
"api-extractor:local": "api-extractor run --local && node ../../scripts/normalize-generated-markdown.mjs api-report",
|
|
45
|
+
"api-documenter": "api-documenter markdown -i temp -o docs && node ../../scripts/normalize-generated-markdown.mjs docs"
|
|
29
46
|
}
|
|
30
47
|
}
|