schemair 0.1.0 → 0.2.0
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 +420 -11
- package/dist/authoring/index.cjs +13 -350
- package/dist/authoring/index.d.cts +2 -90
- package/dist/authoring/index.d.ts +2 -90
- package/dist/authoring/index.js +2 -304
- package/dist/authoring-D3V0iyTe.js +362 -0
- package/dist/authoring-Dnrg5TXm.cjs +389 -0
- package/dist/chunk-BgLxgFZR.js +18 -0
- package/dist/definition/index.cjs +10 -2
- package/dist/definition/index.d.cts +3 -21
- package/dist/definition/index.d.ts +3 -21
- package/dist/definition/index.js +2 -2
- package/dist/definition-BLLBpLKv.cjs +1187 -0
- package/dist/definition-DmYnDmQO.js +1115 -0
- package/dist/index-4aMF0cTE.d.ts +368 -0
- package/dist/index-BqfGAU1K.d.ts +56 -0
- package/dist/{index-eK2Xgrwp.d.ts → index-CBbd4hXJ.d.ts} +13 -2
- package/dist/index-CIim1dG7.d.cts +92 -0
- package/dist/{index-TACcK_mi.d.cts → index-CNjYUKvu.d.cts} +13 -2
- package/dist/index-CQynt7ft.d.cts +420 -0
- package/dist/index-D3mfwaSO.d.cts +56 -0
- package/dist/index-DDMwVy2I.d.cts +368 -0
- package/dist/index-DM5DSLLL.d.ts +99 -0
- package/dist/index-DXWoNYFB.d.ts +92 -0
- package/dist/index-DhmHCGpT.d.cts +99 -0
- package/dist/index-bQy-C-1l.d.ts +418 -0
- package/dist/index.cjs +64 -52
- package/dist/index.d.cts +7 -7
- package/dist/index.d.ts +7 -7
- package/dist/index.js +7 -5
- package/dist/integrations/json-schema/index.cjs +328 -0
- package/dist/integrations/json-schema/index.d.cts +53 -0
- package/dist/integrations/json-schema/index.d.ts +53 -0
- package/dist/integrations/json-schema/index.js +324 -0
- package/dist/integrations/standard-schema/index.cjs +32 -0
- package/dist/integrations/standard-schema/index.d.cts +22 -0
- package/dist/integrations/standard-schema/index.d.ts +22 -0
- package/dist/integrations/standard-schema/index.js +32 -0
- package/dist/payload/index.cjs +1 -1
- package/dist/payload/index.d.cts +1 -55
- package/dist/payload/index.d.ts +1 -55
- package/dist/payload/index.js +1 -1
- package/dist/relations/index.cjs +3 -1
- package/dist/relations/index.d.cts +2 -2
- package/dist/relations/index.d.ts +2 -2
- package/dist/relations/index.js +2 -2
- package/dist/{relations-CMz_0nf4.cjs → relations-Cymx4iTc.cjs} +158 -5
- package/dist/{relations-By0bK3UK.js → relations-ysXDmi-Z.js} +147 -6
- package/dist/spec/index.cjs +9 -0
- package/dist/spec/index.d.cts +2 -2
- package/dist/spec/index.d.ts +2 -2
- package/dist/spec/index.js +3 -1
- package/dist/standard/index.cjs +810 -0
- package/dist/standard/index.d.cts +3 -0
- package/dist/standard/index.d.ts +3 -0
- package/dist/standard/index.js +777 -0
- package/dist/standard-DhKsxu9U.js +471 -0
- package/dist/standard-etPFZDJI.cjs +513 -0
- package/dist/type-interpreter/index.cjs +3 -3
- package/dist/type-interpreter/index.d.cts +2 -99
- package/dist/type-interpreter/index.d.ts +2 -99
- package/dist/type-interpreter/index.js +2 -2
- package/dist/{type-interpreter-Ck0VDhzn.js → type-interpreter-DnrId8aM.js} +5 -284
- package/dist/{type-interpreter-DAIBUqKf.cjs → type-interpreter-OLt2W2yd.cjs} +15 -294
- package/package.json +38 -3
- package/dist/definition-BXj3T94L.js +0 -467
- package/dist/definition-DSZZTz4e.cjs +0 -473
- package/dist/index-CEzHfht2.d.ts +0 -269
- package/dist/index-rzkFjgrt.d.cts +0 -269
|
@@ -0,0 +1,368 @@
|
|
|
1
|
+
//#region src/spec/schema.d.ts
|
|
2
|
+
/** JSON values allowed in opaque constraint arguments. */
|
|
3
|
+
type JsonValue = null | boolean | number | string | JsonValue[] | {
|
|
4
|
+
[key: string]: JsonValue;
|
|
5
|
+
};
|
|
6
|
+
type PrimitiveName = 'string' | 'number' | 'boolean' | 'null';
|
|
7
|
+
type LiteralValue = string | number | boolean;
|
|
8
|
+
interface SchemaConstraint {
|
|
9
|
+
constraintPath: string[];
|
|
10
|
+
args?: JsonValue;
|
|
11
|
+
}
|
|
12
|
+
interface SchemaStringNode {
|
|
13
|
+
kind: 'primitive';
|
|
14
|
+
name: 'string';
|
|
15
|
+
semanticPath?: string[];
|
|
16
|
+
constraints?: SchemaConstraint[];
|
|
17
|
+
}
|
|
18
|
+
interface SchemaNumberNode {
|
|
19
|
+
kind: 'primitive';
|
|
20
|
+
name: 'number';
|
|
21
|
+
semanticPath?: string[];
|
|
22
|
+
constraints?: SchemaConstraint[];
|
|
23
|
+
}
|
|
24
|
+
interface SchemaBooleanNode {
|
|
25
|
+
kind: 'primitive';
|
|
26
|
+
name: 'boolean';
|
|
27
|
+
}
|
|
28
|
+
interface SchemaNullNode {
|
|
29
|
+
kind: 'primitive';
|
|
30
|
+
name: 'null';
|
|
31
|
+
}
|
|
32
|
+
type SchemaPrimitiveNode = SchemaStringNode | SchemaNumberNode | SchemaBooleanNode | SchemaNullNode;
|
|
33
|
+
interface SchemaLiteralNode {
|
|
34
|
+
kind: 'literal';
|
|
35
|
+
literal: LiteralValue;
|
|
36
|
+
}
|
|
37
|
+
interface SchemaRecordField {
|
|
38
|
+
key: string;
|
|
39
|
+
schema: SchemaNode;
|
|
40
|
+
required?: boolean;
|
|
41
|
+
description?: string;
|
|
42
|
+
}
|
|
43
|
+
interface SchemaRecordNode {
|
|
44
|
+
kind: 'record';
|
|
45
|
+
fields: SchemaRecordField[];
|
|
46
|
+
additionalFields?: true | SchemaNode;
|
|
47
|
+
constraints?: SchemaConstraint[];
|
|
48
|
+
}
|
|
49
|
+
interface SchemaArrayNode {
|
|
50
|
+
kind: 'array';
|
|
51
|
+
elementSchema: SchemaNode;
|
|
52
|
+
constraints?: SchemaConstraint[];
|
|
53
|
+
}
|
|
54
|
+
interface SchemaTupleNode {
|
|
55
|
+
kind: 'tuple';
|
|
56
|
+
elementSchemas: SchemaNode[];
|
|
57
|
+
}
|
|
58
|
+
interface SchemaLiteralUnionNode {
|
|
59
|
+
kind: 'literalUnion';
|
|
60
|
+
values: [LiteralValue, LiteralValue, ...LiteralValue[]];
|
|
61
|
+
}
|
|
62
|
+
interface SchemaNullableNode {
|
|
63
|
+
kind: 'nullable';
|
|
64
|
+
value: SchemaNode;
|
|
65
|
+
}
|
|
66
|
+
interface SchemaTaggedUnionVariant {
|
|
67
|
+
key: string;
|
|
68
|
+
schema: SchemaRecordNode;
|
|
69
|
+
description?: string;
|
|
70
|
+
}
|
|
71
|
+
interface SchemaTaggedUnionNode {
|
|
72
|
+
kind: 'taggedUnion';
|
|
73
|
+
discriminator: string;
|
|
74
|
+
variants: SchemaTaggedUnionVariant[];
|
|
75
|
+
}
|
|
76
|
+
interface SchemaRefNode {
|
|
77
|
+
kind: 'ref';
|
|
78
|
+
refPath: string[];
|
|
79
|
+
}
|
|
80
|
+
interface SchemaSelfRefNode {
|
|
81
|
+
kind: 'selfRef';
|
|
82
|
+
}
|
|
83
|
+
/** Closed serializable SchemaIR contract model. */
|
|
84
|
+
type SchemaNode = SchemaPrimitiveNode | SchemaLiteralNode | SchemaRecordNode | SchemaArrayNode | SchemaTupleNode | SchemaLiteralUnionNode | SchemaNullableNode | SchemaTaggedUnionNode | SchemaRefNode | SchemaSelfRefNode;
|
|
85
|
+
//#endregion
|
|
86
|
+
//#region src/spec/operation.d.ts
|
|
87
|
+
type OperationBinaryMetadata = {
|
|
88
|
+
kind: 'mime';
|
|
89
|
+
value: string;
|
|
90
|
+
};
|
|
91
|
+
type OperationPayloadDefinition = StructuredOperationPayloadDefinition | {
|
|
92
|
+
kind: 'binary';
|
|
93
|
+
meta?: OperationBinaryMetadata;
|
|
94
|
+
};
|
|
95
|
+
interface OperationErrorDefinition {
|
|
96
|
+
description?: string;
|
|
97
|
+
data?: SchemaNode;
|
|
98
|
+
}
|
|
99
|
+
interface OperationChannelDefinition {
|
|
100
|
+
description?: string;
|
|
101
|
+
data?: OperationPayloadDefinition;
|
|
102
|
+
errors?: Record<string, OperationErrorDefinition>;
|
|
103
|
+
}
|
|
104
|
+
interface OperationDefinition {
|
|
105
|
+
description?: string;
|
|
106
|
+
input?: OperationPayloadDefinition;
|
|
107
|
+
output?: OperationPayloadDefinition;
|
|
108
|
+
errors?: Record<string, OperationErrorDefinition>;
|
|
109
|
+
emits?: Record<string, OperationChannelDefinition>;
|
|
110
|
+
}
|
|
111
|
+
/** Short model name used by migration-facing APIs. */
|
|
112
|
+
type Operation = OperationDefinition;
|
|
113
|
+
interface OperationContainerDefinition {
|
|
114
|
+
description?: string;
|
|
115
|
+
operations?: Record<string, OperationDefinition>;
|
|
116
|
+
containers?: Record<string, OperationContainerDefinition>;
|
|
117
|
+
}
|
|
118
|
+
interface StructuredOperationPayloadDefinition {
|
|
119
|
+
kind: 'structured';
|
|
120
|
+
schema: SchemaNode;
|
|
121
|
+
}
|
|
122
|
+
interface StructuredOperationChannelDefinition {
|
|
123
|
+
description?: string;
|
|
124
|
+
data?: StructuredOperationPayloadDefinition;
|
|
125
|
+
errors?: Record<string, OperationErrorDefinition>;
|
|
126
|
+
}
|
|
127
|
+
interface StructuredOperationDefinition {
|
|
128
|
+
description?: string;
|
|
129
|
+
input?: StructuredOperationPayloadDefinition;
|
|
130
|
+
output?: StructuredOperationPayloadDefinition;
|
|
131
|
+
errors?: Record<string, OperationErrorDefinition>;
|
|
132
|
+
emits?: Record<string, StructuredOperationChannelDefinition>;
|
|
133
|
+
}
|
|
134
|
+
interface StructuredOperationContainerDefinition {
|
|
135
|
+
description?: string;
|
|
136
|
+
operations?: Record<string, StructuredOperationDefinition>;
|
|
137
|
+
containers?: Record<string, StructuredOperationContainerDefinition>;
|
|
138
|
+
}
|
|
139
|
+
//#endregion
|
|
140
|
+
//#region src/spec/expression.d.ts
|
|
141
|
+
interface SchemaTypeVariableExpr {
|
|
142
|
+
kind: 'typeVar';
|
|
143
|
+
name: string;
|
|
144
|
+
extends?: SchemaTypeTerm;
|
|
145
|
+
}
|
|
146
|
+
interface SchemaTypeOpaqueHostExpr {
|
|
147
|
+
kind: 'opaqueHostType';
|
|
148
|
+
hostPath: string[];
|
|
149
|
+
}
|
|
150
|
+
interface SchemaTypeAbsentExpr {
|
|
151
|
+
kind: 'absent';
|
|
152
|
+
}
|
|
153
|
+
interface SchemaTypeNeverExpr {
|
|
154
|
+
kind: 'never';
|
|
155
|
+
}
|
|
156
|
+
interface SchemaTypeUnknownExpr {
|
|
157
|
+
kind: 'unknown';
|
|
158
|
+
}
|
|
159
|
+
interface SchemaTypeMaybeAbsentExpr {
|
|
160
|
+
kind: 'maybeAbsent';
|
|
161
|
+
value: SchemaTypeTerm;
|
|
162
|
+
}
|
|
163
|
+
interface SchemaTypeArrayExpr {
|
|
164
|
+
kind: 'arrayOf';
|
|
165
|
+
element: SchemaTypeTerm;
|
|
166
|
+
constraints?: SchemaConstraint[];
|
|
167
|
+
}
|
|
168
|
+
interface SchemaTypeTupleExpr {
|
|
169
|
+
kind: 'tupleOf';
|
|
170
|
+
elements: SchemaTypeTerm[];
|
|
171
|
+
}
|
|
172
|
+
interface SchemaTypeRecordExpr {
|
|
173
|
+
kind: 'recordOf';
|
|
174
|
+
fields: {
|
|
175
|
+
key: string;
|
|
176
|
+
value: SchemaTypeTerm;
|
|
177
|
+
required?: boolean;
|
|
178
|
+
description?: string;
|
|
179
|
+
}[];
|
|
180
|
+
additionalFields?: true | SchemaTypeTerm;
|
|
181
|
+
constraints?: SchemaConstraint[];
|
|
182
|
+
}
|
|
183
|
+
type SchemaFieldSelector = {
|
|
184
|
+
kind: 'all';
|
|
185
|
+
} | {
|
|
186
|
+
kind: 'keys';
|
|
187
|
+
keys: string[];
|
|
188
|
+
onMissing: 'error' | 'ignore';
|
|
189
|
+
};
|
|
190
|
+
type SchemaVariantSelector = SchemaFieldSelector;
|
|
191
|
+
interface SchemaTypeElementOfExpr {
|
|
192
|
+
kind: 'elementOf';
|
|
193
|
+
source: SchemaTypeTerm;
|
|
194
|
+
}
|
|
195
|
+
interface SchemaTypeValueOfExpr {
|
|
196
|
+
kind: 'valueOf';
|
|
197
|
+
source: SchemaTypeTerm;
|
|
198
|
+
}
|
|
199
|
+
interface SchemaTypeElementAtExpr {
|
|
200
|
+
kind: 'elementAt';
|
|
201
|
+
source: SchemaTypeTerm;
|
|
202
|
+
index: number;
|
|
203
|
+
}
|
|
204
|
+
interface SchemaTypeFieldOfExpr {
|
|
205
|
+
kind: 'fieldOf';
|
|
206
|
+
source: SchemaTypeTerm;
|
|
207
|
+
key: string;
|
|
208
|
+
}
|
|
209
|
+
interface SchemaTypeKeyOfExpr {
|
|
210
|
+
kind: 'keyOf';
|
|
211
|
+
source: SchemaTypeTerm;
|
|
212
|
+
}
|
|
213
|
+
interface SchemaTypeFieldsOfExpr {
|
|
214
|
+
kind: 'fieldsOf';
|
|
215
|
+
source: SchemaTypeTerm;
|
|
216
|
+
fields: SchemaFieldSelector;
|
|
217
|
+
}
|
|
218
|
+
interface SchemaTypePickFieldsExpr {
|
|
219
|
+
kind: 'pickFields';
|
|
220
|
+
source: SchemaTypeTerm;
|
|
221
|
+
fields: SchemaFieldSelector;
|
|
222
|
+
}
|
|
223
|
+
interface SchemaTypeOmitFieldsExpr {
|
|
224
|
+
kind: 'omitFields';
|
|
225
|
+
source: SchemaTypeTerm;
|
|
226
|
+
fields: SchemaFieldSelector;
|
|
227
|
+
}
|
|
228
|
+
interface SchemaTypePartialFieldsExpr {
|
|
229
|
+
kind: 'partialFields';
|
|
230
|
+
source: SchemaTypeTerm;
|
|
231
|
+
fields: SchemaFieldSelector;
|
|
232
|
+
}
|
|
233
|
+
interface SchemaTypeRequiredFieldsExpr {
|
|
234
|
+
kind: 'requiredFields';
|
|
235
|
+
source: SchemaTypeTerm;
|
|
236
|
+
fields: SchemaFieldSelector;
|
|
237
|
+
}
|
|
238
|
+
interface SchemaTypeMergeRecordsExpr {
|
|
239
|
+
kind: 'mergeRecords';
|
|
240
|
+
sources: SchemaTypeTerm[];
|
|
241
|
+
conflict: 'leftWins' | 'rightWins' | 'error';
|
|
242
|
+
}
|
|
243
|
+
interface SchemaTypeNullableExpr {
|
|
244
|
+
kind: 'nullableOf';
|
|
245
|
+
value: SchemaTypeTerm;
|
|
246
|
+
}
|
|
247
|
+
interface SchemaTypeTaggedUnionExpr {
|
|
248
|
+
kind: 'taggedUnionOf';
|
|
249
|
+
discriminator: string;
|
|
250
|
+
variants: {
|
|
251
|
+
key: string;
|
|
252
|
+
value: SchemaTypeTerm;
|
|
253
|
+
description?: string;
|
|
254
|
+
}[];
|
|
255
|
+
}
|
|
256
|
+
interface SchemaTypeIntersectExpr {
|
|
257
|
+
kind: 'intersect';
|
|
258
|
+
sources: SchemaTypeTerm[];
|
|
259
|
+
}
|
|
260
|
+
interface SchemaTypeRefineExpr {
|
|
261
|
+
kind: 'refine';
|
|
262
|
+
source: SchemaTypeTerm;
|
|
263
|
+
fields: {
|
|
264
|
+
key: string;
|
|
265
|
+
require?: true;
|
|
266
|
+
intersectWith?: SchemaTypeTerm;
|
|
267
|
+
addConstraints?: SchemaConstraint[];
|
|
268
|
+
}[];
|
|
269
|
+
}
|
|
270
|
+
interface SchemaTypeExcludeVariantsExpr {
|
|
271
|
+
kind: 'excludeVariants';
|
|
272
|
+
source: SchemaTypeTerm;
|
|
273
|
+
variants: SchemaVariantSelector;
|
|
274
|
+
}
|
|
275
|
+
interface SchemaTypeExtractVariantsExpr {
|
|
276
|
+
kind: 'extractVariants';
|
|
277
|
+
source: SchemaTypeTerm;
|
|
278
|
+
variants: SchemaVariantSelector;
|
|
279
|
+
}
|
|
280
|
+
type SchemaTypeExpr = SchemaTypeVariableExpr | SchemaTypeOpaqueHostExpr | SchemaTypeAbsentExpr | SchemaTypeNeverExpr | SchemaTypeUnknownExpr | SchemaTypeMaybeAbsentExpr | SchemaTypeArrayExpr | SchemaTypeTupleExpr | SchemaTypeRecordExpr | SchemaTypeElementOfExpr | SchemaTypeValueOfExpr | SchemaTypeElementAtExpr | SchemaTypeFieldOfExpr | SchemaTypeKeyOfExpr | SchemaTypeFieldsOfExpr | SchemaTypePickFieldsExpr | SchemaTypeOmitFieldsExpr | SchemaTypePartialFieldsExpr | SchemaTypeRequiredFieldsExpr | SchemaTypeMergeRecordsExpr | SchemaTypeNullableExpr | SchemaTypeTaggedUnionExpr | SchemaTypeIntersectExpr | SchemaTypeRefineExpr | SchemaTypeExcludeVariantsExpr | SchemaTypeExtractVariantsExpr;
|
|
281
|
+
type SchemaTypeTerm = SchemaNode | SchemaTypeExpr;
|
|
282
|
+
/** Short model name used by migration-facing APIs. */
|
|
283
|
+
type Expression = SchemaTypeExpr;
|
|
284
|
+
/** Kept here so consumers can share the JSON-compatible expression boundary. */
|
|
285
|
+
type ExpressionArgument = JsonValue;
|
|
286
|
+
//#endregion
|
|
287
|
+
//#region src/spec/standard/paths.d.ts
|
|
288
|
+
declare const STANDARD_SEMANTIC_PATHS: {
|
|
289
|
+
readonly string: {
|
|
290
|
+
readonly date: readonly ["std", "string", "date"];
|
|
291
|
+
readonly datetime: readonly ["std", "string", "datetime"];
|
|
292
|
+
readonly datetimeIso: readonly ["std", "string", "datetime", "iso"];
|
|
293
|
+
readonly email: readonly ["std", "string", "email"];
|
|
294
|
+
readonly url: readonly ["std", "string", "url"];
|
|
295
|
+
readonly ipV4: readonly ["std", "string", "ip", "v4"];
|
|
296
|
+
readonly ipV6: readonly ["std", "string", "ip", "v6"];
|
|
297
|
+
readonly uuid: readonly ["std", "string", "uuid"];
|
|
298
|
+
readonly uuidV4: readonly ["std", "string", "uuid", "v4"];
|
|
299
|
+
readonly json: readonly ["std", "string", "json"];
|
|
300
|
+
readonly base64: readonly ["std", "string", "base64"];
|
|
301
|
+
readonly base64url: readonly ["std", "string", "base64url"];
|
|
302
|
+
readonly hex: readonly ["std", "string", "hex"];
|
|
303
|
+
readonly decimal: readonly ["std", "string", "decimal"];
|
|
304
|
+
readonly bigint: readonly ["std", "string", "bigint"];
|
|
305
|
+
readonly secret: readonly ["std", "string", "secret"];
|
|
306
|
+
readonly token: readonly ["std", "string", "secret", "token"];
|
|
307
|
+
readonly password: readonly ["std", "string", "secret", "password"];
|
|
308
|
+
};
|
|
309
|
+
readonly number: {
|
|
310
|
+
readonly integer: readonly ["std", "number", "integer"];
|
|
311
|
+
readonly safeInteger: readonly ["std", "number", "safeInteger"];
|
|
312
|
+
readonly epochMillis: readonly ["std", "number", "epochMillis"];
|
|
313
|
+
readonly epochSeconds: readonly ["std", "number", "epochSeconds"];
|
|
314
|
+
};
|
|
315
|
+
};
|
|
316
|
+
declare const STANDARD_SEMANTIC_PATH_LIST: ReadonlyArray<readonly string[]>;
|
|
317
|
+
declare const STANDARD_CONSTRAINT_PATHS: {
|
|
318
|
+
readonly string: {
|
|
319
|
+
readonly minLength: readonly ["std", "minLength"];
|
|
320
|
+
readonly maxLength: readonly ["std", "maxLength"];
|
|
321
|
+
readonly pattern: readonly ["std", "pattern"];
|
|
322
|
+
};
|
|
323
|
+
readonly number: {
|
|
324
|
+
readonly minimum: readonly ["std", "minimum"];
|
|
325
|
+
readonly maximum: readonly ["std", "maximum"];
|
|
326
|
+
readonly exclusiveMinimum: readonly ["std", "exclusiveMinimum"];
|
|
327
|
+
readonly exclusiveMaximum: readonly ["std", "exclusiveMaximum"];
|
|
328
|
+
readonly multipleOf: readonly ["std", "multipleOf"];
|
|
329
|
+
};
|
|
330
|
+
readonly array: {
|
|
331
|
+
readonly minItems: readonly ["std", "minItems"];
|
|
332
|
+
readonly maxItems: readonly ["std", "maxItems"];
|
|
333
|
+
readonly uniqueItems: readonly ["std", "uniqueItems"];
|
|
334
|
+
};
|
|
335
|
+
readonly record: {
|
|
336
|
+
readonly minProperties: readonly ["std", "minProperties"];
|
|
337
|
+
readonly maxProperties: readonly ["std", "maxProperties"];
|
|
338
|
+
};
|
|
339
|
+
};
|
|
340
|
+
declare const STANDARD_CONSTRAINT_PATH_LIST: ReadonlyArray<readonly string[]>;
|
|
341
|
+
//#endregion
|
|
342
|
+
//#region src/spec/standard/definitions.d.ts
|
|
343
|
+
interface StandardSemanticDefinition {
|
|
344
|
+
path: readonly string[];
|
|
345
|
+
label: string;
|
|
346
|
+
description: string;
|
|
347
|
+
primitive: 'string' | 'number';
|
|
348
|
+
role: 'validation' | 'annotation';
|
|
349
|
+
}
|
|
350
|
+
interface StandardSemanticRelation {
|
|
351
|
+
source: readonly string[];
|
|
352
|
+
target: readonly string[];
|
|
353
|
+
kind: 'acceptedSetSubset';
|
|
354
|
+
}
|
|
355
|
+
interface StandardConstraintDefinition {
|
|
356
|
+
path: readonly string[];
|
|
357
|
+
label: string;
|
|
358
|
+
description: string;
|
|
359
|
+
target: 'string' | 'number' | 'array' | 'record';
|
|
360
|
+
argsType: 'number' | 'string' | 'boolean';
|
|
361
|
+
argsDomain: 'finiteNumber' | 'nonNegativeInteger' | 'positiveNumber' | 'regexSource' | 'boolean';
|
|
362
|
+
}
|
|
363
|
+
declare const STANDARD_SEMANTIC_DEFINITIONS: ReadonlyArray<StandardSemanticDefinition>;
|
|
364
|
+
/** Explicit accepted-set implications; carrier types are not semantic paths. */
|
|
365
|
+
declare const STANDARD_SEMANTIC_RELATIONS: ReadonlyArray<StandardSemanticRelation>;
|
|
366
|
+
declare const STANDARD_CONSTRAINT_DEFINITIONS: ReadonlyArray<StandardConstraintDefinition>;
|
|
367
|
+
//#endregion
|
|
368
|
+
export { StructuredOperationPayloadDefinition as $, SchemaTypeOpaqueHostExpr as A, SchemaTypeValueOfExpr as B, SchemaTypeIntersectExpr as C, SchemaTypeNeverExpr as D, SchemaTypeMergeRecordsExpr as E, SchemaTypeRequiredFieldsExpr as F, OperationChannelDefinition as G, SchemaVariantSelector as H, SchemaTypeTaggedUnionExpr as I, OperationErrorDefinition as J, OperationContainerDefinition as K, SchemaTypeTerm as L, SchemaTypePickFieldsExpr as M, SchemaTypeRecordExpr as N, SchemaTypeNullableExpr as O, SchemaTypeRefineExpr as P, StructuredOperationDefinition as Q, SchemaTypeTupleExpr as R, SchemaTypeFieldsOfExpr as S, SchemaTypeMaybeAbsentExpr as T, Operation as U, SchemaTypeVariableExpr as V, OperationBinaryMetadata as W, StructuredOperationChannelDefinition as X, OperationPayloadDefinition as Y, StructuredOperationContainerDefinition as Z, SchemaTypeElementOfExpr as _, SchemaStringNode as _t, StandardSemanticDefinition as a, SchemaConstraint as at, SchemaTypeExtractVariantsExpr as b, SchemaTupleNode as bt, STANDARD_CONSTRAINT_PATH_LIST as c, SchemaNode as ct, Expression as d, SchemaNumberNode as dt, JsonValue as et, ExpressionArgument as f, SchemaPrimitiveNode as ft, SchemaTypeElementAtExpr as g, SchemaSelfRefNode as gt, SchemaTypeArrayExpr as h, SchemaRefNode as ht, StandardConstraintDefinition as i, SchemaBooleanNode as it, SchemaTypePartialFieldsExpr as j, SchemaTypeOmitFieldsExpr as k, STANDARD_SEMANTIC_PATHS as l, SchemaNullNode as lt, SchemaTypeAbsentExpr as m, SchemaRecordNode as mt, STANDARD_SEMANTIC_DEFINITIONS as n, PrimitiveName as nt, StandardSemanticRelation as o, SchemaLiteralNode as ot, SchemaFieldSelector as p, SchemaRecordField as pt, OperationDefinition as q, STANDARD_SEMANTIC_RELATIONS as r, SchemaArrayNode as rt, STANDARD_CONSTRAINT_PATHS as s, SchemaLiteralUnionNode as st, STANDARD_CONSTRAINT_DEFINITIONS as t, LiteralValue as tt, STANDARD_SEMANTIC_PATH_LIST as u, SchemaNullableNode as ut, SchemaTypeExcludeVariantsExpr as v, SchemaTaggedUnionNode as vt, SchemaTypeKeyOfExpr as w, SchemaTypeFieldOfExpr as x, SchemaTypeExpr as y, SchemaTaggedUnionVariant as yt, SchemaTypeUnknownExpr as z };
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { ct as SchemaNode } from "./index-4aMF0cTE.js";
|
|
2
|
+
|
|
3
|
+
//#region src/payload/validator.d.ts
|
|
4
|
+
type PayloadPath = readonly (string | number)[];
|
|
5
|
+
interface PayloadValidationDiagnostic {
|
|
6
|
+
readonly code: string;
|
|
7
|
+
readonly path: PayloadPath;
|
|
8
|
+
readonly message: string;
|
|
9
|
+
}
|
|
10
|
+
type PayloadValidationResult = {
|
|
11
|
+
readonly status: 'accepted';
|
|
12
|
+
readonly issues: readonly [];
|
|
13
|
+
} | {
|
|
14
|
+
readonly status: 'rejected' | 'unknown';
|
|
15
|
+
readonly issues: readonly PayloadValidationDiagnostic[];
|
|
16
|
+
};
|
|
17
|
+
type PayloadProviderDecision = boolean | {
|
|
18
|
+
readonly status: 'accepted' | 'rejected' | 'unknown' | 'unsupported';
|
|
19
|
+
readonly message?: string;
|
|
20
|
+
};
|
|
21
|
+
interface PayloadProviderContext {
|
|
22
|
+
readonly path: PayloadPath;
|
|
23
|
+
readonly schema: SchemaNode;
|
|
24
|
+
readonly rootSchema: SchemaNode;
|
|
25
|
+
}
|
|
26
|
+
interface PayloadResolutionContext extends PayloadProviderContext {
|
|
27
|
+
readonly refPath: readonly string[];
|
|
28
|
+
}
|
|
29
|
+
type PayloadResolution = SchemaNode | {
|
|
30
|
+
readonly status: 'resolved';
|
|
31
|
+
readonly schema: SchemaNode;
|
|
32
|
+
} | {
|
|
33
|
+
readonly status: 'unknown' | 'unsupported';
|
|
34
|
+
readonly message?: string;
|
|
35
|
+
} | undefined;
|
|
36
|
+
type SemanticProvider = (semanticPath: readonly string[], value: unknown, context: PayloadProviderContext) => PayloadProviderDecision | Promise<PayloadProviderDecision | undefined> | undefined;
|
|
37
|
+
type ConstraintProvider = (constraintPath: readonly string[], args: unknown, value: unknown, context: PayloadProviderContext) => PayloadProviderDecision | Promise<PayloadProviderDecision | undefined> | undefined;
|
|
38
|
+
type SyncSemanticProvider = (semanticPath: readonly string[], value: unknown, context: PayloadProviderContext) => PayloadProviderDecision | undefined;
|
|
39
|
+
type SyncConstraintProvider = (constraintPath: readonly string[], args: unknown, value: unknown, context: PayloadProviderContext) => PayloadProviderDecision | undefined;
|
|
40
|
+
type SyncPayloadResolution = PayloadResolution;
|
|
41
|
+
interface SyncPayloadValidationContext {
|
|
42
|
+
readonly resolveRef?: (refPath: readonly string[], context: PayloadResolutionContext) => SyncPayloadResolution;
|
|
43
|
+
readonly semanticProvider?: SyncSemanticProvider;
|
|
44
|
+
readonly constraintProvider?: SyncConstraintProvider;
|
|
45
|
+
}
|
|
46
|
+
interface PayloadValidationContext {
|
|
47
|
+
readonly resolveRef?: (refPath: readonly string[], context: PayloadResolutionContext) => PayloadResolution | Promise<PayloadResolution>;
|
|
48
|
+
readonly semanticProvider?: SemanticProvider;
|
|
49
|
+
readonly constraintProvider?: ConstraintProvider;
|
|
50
|
+
}
|
|
51
|
+
/** Context accepted by the asynchronous payload validation entry point. */
|
|
52
|
+
type AsyncPayloadValidationContext = PayloadValidationContext;
|
|
53
|
+
declare function validatePayload(value: unknown, schema: SchemaNode, context?: SyncPayloadValidationContext): PayloadValidationResult;
|
|
54
|
+
declare function validatePayloadAsync(value: unknown, schema: SchemaNode, context?: AsyncPayloadValidationContext): Promise<PayloadValidationResult>;
|
|
55
|
+
//#endregion
|
|
56
|
+
export { validatePayloadAsync as _, PayloadProviderDecision as a, PayloadValidationContext as c, SemanticProvider as d, SyncConstraintProvider as f, validatePayload as g, SyncSemanticProvider as h, PayloadProviderContext as i, PayloadValidationDiagnostic as l, SyncPayloadValidationContext as m, ConstraintProvider as n, PayloadResolution as o, SyncPayloadResolution as p, PayloadPath as r, PayloadResolutionContext as s, AsyncPayloadValidationContext as t, PayloadValidationResult as u };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { at as SchemaConstraint, ct as SchemaNode } from "./index-4aMF0cTE.js";
|
|
2
2
|
|
|
3
3
|
//#region src/relations/validator.d.ts
|
|
4
4
|
type RelationPath = readonly (string | number)[];
|
|
@@ -6,6 +6,7 @@ interface RelationDiagnostic {
|
|
|
6
6
|
readonly code: string;
|
|
7
7
|
readonly path: RelationPath;
|
|
8
8
|
readonly message: string;
|
|
9
|
+
readonly details?: Readonly<Record<string, unknown>>;
|
|
9
10
|
}
|
|
10
11
|
type RelationStatus = 'assignable' | 'incompatible' | 'unknown' | 'rejected';
|
|
11
12
|
interface RelationResult {
|
|
@@ -50,4 +51,14 @@ declare const checkSchemaAssignability: typeof checkSchemaRelation;
|
|
|
50
51
|
declare function checkSchemaRelationAsync(source: unknown, target: unknown, context?: AsyncRelationContext): Promise<RelationResult>;
|
|
51
52
|
declare const checkSchemaAssignabilityAsync: typeof checkSchemaRelationAsync;
|
|
52
53
|
//#endregion
|
|
53
|
-
|
|
54
|
+
//#region src/relations/operation.d.ts
|
|
55
|
+
type OperationRelationComponent = 'definition' | 'input' | 'output' | 'error' | 'emission';
|
|
56
|
+
type OperationRelationDirection = 'source-to-target' | 'target-to-source';
|
|
57
|
+
/** Can source replace target for callers using the target contract?
|
|
58
|
+
* Provider contexts describe each directed schema comparison; input reverses sides.
|
|
59
|
+
*/
|
|
60
|
+
declare function checkOperationRelation(source: unknown, target: unknown, context?: RelationContext): RelationResult;
|
|
61
|
+
/** Async companion with the same substitution rules and schema-local providers. */
|
|
62
|
+
declare function checkOperationRelationAsync(source: unknown, target: unknown, context?: AsyncRelationContext): Promise<RelationResult>;
|
|
63
|
+
//#endregion
|
|
64
|
+
export { checkSchemaAssignabilityAsync as _, AsyncRelationContext as a, RelationPath as c, RelationResolution as d, RelationResolutionContext as f, checkSchemaAssignability as g, RelationStatus as h, checkOperationRelationAsync as i, RelationProviderContext as l, RelationSide as m, OperationRelationDirection as n, RelationContext as o, RelationResult as p, checkOperationRelation as r, RelationDiagnostic as s, OperationRelationComponent as t, RelationProviderDecision as u, checkSchemaRelation as v, checkSchemaRelationAsync as y };
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { K as OperationContainerDefinition, L as SchemaTypeTerm, Q as StructuredOperationDefinition, Z as StructuredOperationContainerDefinition, ct as SchemaNode, q as OperationDefinition, y as SchemaTypeExpr } from "./index-DDMwVy2I.cjs";
|
|
2
|
+
|
|
3
|
+
//#region src/definition/validator.d.ts
|
|
4
|
+
type SchemaNodeDefinitionPath = readonly (string | number)[];
|
|
5
|
+
interface SchemaNodeDefinitionDiagnostic {
|
|
6
|
+
readonly code: string;
|
|
7
|
+
readonly path: SchemaNodeDefinitionPath;
|
|
8
|
+
readonly message: string;
|
|
9
|
+
}
|
|
10
|
+
type SchemaNodeDefinitionValidationResult = {
|
|
11
|
+
readonly ok: true;
|
|
12
|
+
readonly node: SchemaNode;
|
|
13
|
+
readonly issues: readonly [];
|
|
14
|
+
} | {
|
|
15
|
+
readonly ok: false;
|
|
16
|
+
readonly issues: readonly SchemaNodeDefinitionDiagnostic[];
|
|
17
|
+
};
|
|
18
|
+
/** Validate only the serializable structural definition of one SchemaNode. */
|
|
19
|
+
declare function validateSchemaNodeDefinition(value: unknown): SchemaNodeDefinitionValidationResult;
|
|
20
|
+
//#endregion
|
|
21
|
+
//#region src/definition/operation-validator.d.ts
|
|
22
|
+
type OperationDefinitionPath = readonly (string | number)[];
|
|
23
|
+
interface OperationDefinitionDiagnostic {
|
|
24
|
+
readonly code: string;
|
|
25
|
+
readonly path: OperationDefinitionPath;
|
|
26
|
+
readonly message: string;
|
|
27
|
+
}
|
|
28
|
+
type OperationDefinitionValidationResult = {
|
|
29
|
+
readonly ok: true;
|
|
30
|
+
readonly operation: OperationDefinition;
|
|
31
|
+
readonly issues: readonly [];
|
|
32
|
+
} | {
|
|
33
|
+
readonly ok: false;
|
|
34
|
+
readonly issues: readonly OperationDefinitionDiagnostic[];
|
|
35
|
+
};
|
|
36
|
+
type OperationContainerDefinitionValidationResult = {
|
|
37
|
+
readonly ok: true;
|
|
38
|
+
readonly container: OperationContainerDefinition;
|
|
39
|
+
readonly issues: readonly [];
|
|
40
|
+
} | {
|
|
41
|
+
readonly ok: false;
|
|
42
|
+
readonly issues: readonly OperationDefinitionDiagnostic[];
|
|
43
|
+
};
|
|
44
|
+
type StructuredOperationDefinitionValidationResult = {
|
|
45
|
+
readonly ok: true;
|
|
46
|
+
readonly operation: StructuredOperationDefinition;
|
|
47
|
+
readonly issues: readonly [];
|
|
48
|
+
} | {
|
|
49
|
+
readonly ok: false;
|
|
50
|
+
readonly issues: readonly OperationDefinitionDiagnostic[];
|
|
51
|
+
};
|
|
52
|
+
type StructuredOperationContainerDefinitionValidationResult = {
|
|
53
|
+
readonly ok: true;
|
|
54
|
+
readonly container: StructuredOperationContainerDefinition;
|
|
55
|
+
readonly issues: readonly [];
|
|
56
|
+
} | {
|
|
57
|
+
readonly ok: false;
|
|
58
|
+
readonly issues: readonly OperationDefinitionDiagnostic[];
|
|
59
|
+
};
|
|
60
|
+
declare function validateOperationDefinition(value: unknown): OperationDefinitionValidationResult;
|
|
61
|
+
declare function validateOperationContainerDefinition(value: unknown): OperationContainerDefinitionValidationResult;
|
|
62
|
+
declare function validateStructuredOperationDefinition(value: unknown): StructuredOperationDefinitionValidationResult;
|
|
63
|
+
declare function validateStructuredOperationContainerDefinition(value: unknown): StructuredOperationContainerDefinitionValidationResult;
|
|
64
|
+
declare function isStructuredOperationDefinition(value: unknown): value is StructuredOperationDefinition;
|
|
65
|
+
declare function isStructuredOperationContainerDefinition(value: unknown): value is StructuredOperationContainerDefinition;
|
|
66
|
+
//#endregion
|
|
67
|
+
//#region src/definition/expression-validator.d.ts
|
|
68
|
+
interface SchemaTypeDefinitionDiagnostic {
|
|
69
|
+
readonly code: string;
|
|
70
|
+
readonly path: readonly (string | number)[];
|
|
71
|
+
readonly message: string;
|
|
72
|
+
}
|
|
73
|
+
type SchemaTypeExprDefinitionValidationResult = {
|
|
74
|
+
readonly ok: true;
|
|
75
|
+
readonly expression: SchemaTypeExpr;
|
|
76
|
+
readonly issues: readonly [];
|
|
77
|
+
} | {
|
|
78
|
+
readonly ok: false;
|
|
79
|
+
readonly issues: readonly SchemaTypeDefinitionDiagnostic[];
|
|
80
|
+
};
|
|
81
|
+
type SchemaTypeTermDefinitionValidationResult = {
|
|
82
|
+
readonly ok: true;
|
|
83
|
+
readonly term: SchemaTypeTerm;
|
|
84
|
+
readonly issues: readonly [];
|
|
85
|
+
} | {
|
|
86
|
+
readonly ok: false;
|
|
87
|
+
readonly issues: readonly SchemaTypeDefinitionDiagnostic[];
|
|
88
|
+
};
|
|
89
|
+
declare function validateSchemaTypeExprDefinition(value: unknown): SchemaTypeExprDefinitionValidationResult;
|
|
90
|
+
declare function validateSchemaTypeTermDefinition(value: unknown): SchemaTypeTermDefinitionValidationResult;
|
|
91
|
+
//#endregion
|
|
92
|
+
export { validateStructuredOperationDefinition as _, validateSchemaTypeTermDefinition as a, SchemaNodeDefinitionValidationResult as b, OperationDefinitionPath as c, StructuredOperationDefinitionValidationResult as d, isStructuredOperationContainerDefinition as f, validateStructuredOperationContainerDefinition as g, validateOperationDefinition as h, validateSchemaTypeExprDefinition as i, OperationDefinitionValidationResult as l, validateOperationContainerDefinition as m, SchemaTypeExprDefinitionValidationResult as n, OperationContainerDefinitionValidationResult as o, isStructuredOperationDefinition as p, SchemaTypeTermDefinitionValidationResult as r, OperationDefinitionDiagnostic as s, SchemaTypeDefinitionDiagnostic as t, StructuredOperationContainerDefinitionValidationResult as u, SchemaNodeDefinitionDiagnostic as v, validateSchemaNodeDefinition as x, SchemaNodeDefinitionPath as y };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { at as SchemaConstraint, ct as SchemaNode } from "./index-DDMwVy2I.cjs";
|
|
2
2
|
|
|
3
3
|
//#region src/relations/validator.d.ts
|
|
4
4
|
type RelationPath = readonly (string | number)[];
|
|
@@ -6,6 +6,7 @@ interface RelationDiagnostic {
|
|
|
6
6
|
readonly code: string;
|
|
7
7
|
readonly path: RelationPath;
|
|
8
8
|
readonly message: string;
|
|
9
|
+
readonly details?: Readonly<Record<string, unknown>>;
|
|
9
10
|
}
|
|
10
11
|
type RelationStatus = 'assignable' | 'incompatible' | 'unknown' | 'rejected';
|
|
11
12
|
interface RelationResult {
|
|
@@ -50,4 +51,14 @@ declare const checkSchemaAssignability: typeof checkSchemaRelation;
|
|
|
50
51
|
declare function checkSchemaRelationAsync(source: unknown, target: unknown, context?: AsyncRelationContext): Promise<RelationResult>;
|
|
51
52
|
declare const checkSchemaAssignabilityAsync: typeof checkSchemaRelationAsync;
|
|
52
53
|
//#endregion
|
|
53
|
-
|
|
54
|
+
//#region src/relations/operation.d.ts
|
|
55
|
+
type OperationRelationComponent = 'definition' | 'input' | 'output' | 'error' | 'emission';
|
|
56
|
+
type OperationRelationDirection = 'source-to-target' | 'target-to-source';
|
|
57
|
+
/** Can source replace target for callers using the target contract?
|
|
58
|
+
* Provider contexts describe each directed schema comparison; input reverses sides.
|
|
59
|
+
*/
|
|
60
|
+
declare function checkOperationRelation(source: unknown, target: unknown, context?: RelationContext): RelationResult;
|
|
61
|
+
/** Async companion with the same substitution rules and schema-local providers. */
|
|
62
|
+
declare function checkOperationRelationAsync(source: unknown, target: unknown, context?: AsyncRelationContext): Promise<RelationResult>;
|
|
63
|
+
//#endregion
|
|
64
|
+
export { checkSchemaAssignabilityAsync as _, AsyncRelationContext as a, RelationPath as c, RelationResolution as d, RelationResolutionContext as f, checkSchemaAssignability as g, RelationStatus as h, checkOperationRelationAsync as i, RelationProviderContext as l, RelationSide as m, OperationRelationDirection as n, RelationContext as o, RelationResult as p, checkOperationRelation as r, RelationDiagnostic as s, OperationRelationComponent as t, RelationProviderDecision as u, checkSchemaRelation as v, checkSchemaRelationAsync as y };
|