schemair 0.1.0 → 0.3.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 +542 -32
- 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-Dnrg5TXm.cjs +389 -0
- package/dist/authoring-DyJNYs5o.js +362 -0
- package/dist/chunk-bFfwrPtJ.js +18 -0
- package/dist/compatibility/index.cjs +43 -0
- package/dist/compatibility/index.d.cts +2 -0
- package/dist/compatibility/index.d.ts +2 -0
- package/dist/compatibility/index.js +42 -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-BH_LzXGc.js +1115 -0
- package/dist/definition-BLLBpLKv.cjs +1187 -0
- package/dist/index-1sDuqu05.d.ts +373 -0
- package/dist/index-BFSMT_2d.d.ts +53 -0
- package/dist/index-BGz7L_Fq.d.cts +73 -0
- package/dist/index-BTtdqi_M.d.ts +418 -0
- package/dist/index-BfbClf6R.d.cts +20 -0
- package/dist/index-CK7Is7vy.d.cts +420 -0
- package/dist/index-CUGhtuwA.d.cts +53 -0
- package/dist/index-CV8EZQy8.d.ts +92 -0
- package/dist/index-CzNxjqVg.d.cts +47 -0
- package/dist/index-DGHMUZ5m.d.cts +92 -0
- package/dist/{index-eK2Xgrwp.d.ts → index-DxvfPmw6.d.ts} +13 -9
- package/dist/index-T6nFhvGQ.d.ts +20 -0
- package/dist/{index-TACcK_mi.d.cts → index-ba_52Yu9.d.cts} +13 -9
- package/dist/index-hrcM9oJe.d.ts +47 -0
- package/dist/index-i7Au-FQ6.d.cts +373 -0
- package/dist/index-mu1znI1F.d.ts +73 -0
- package/dist/index.cjs +70 -58
- package/dist/index.d.cts +9 -7
- package/dist/index.d.ts +9 -7
- package/dist/index.js +10 -6
- 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 +45 -82
- package/dist/payload/index.d.cts +2 -56
- package/dist/payload/index.d.ts +2 -56
- package/dist/payload/index.js +45 -81
- package/dist/relations/index.cjs +3 -4
- 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-NUVJkAG8.cjs} +143 -211
- package/dist/{relations-By0bK3UK.js → relations-QtnCRW9x.js} +140 -202
- package/dist/resolve/index.cjs +308 -0
- package/dist/resolve/index.d.cts +2 -0
- package/dist/resolve/index.d.ts +2 -0
- package/dist/resolve/index.js +305 -0
- package/dist/schema-ref-key-BHVFVfj1.cjs +26 -0
- package/dist/schema-ref-key-DR__tPr-.js +14 -0
- 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-BGMgbbEQ.js +471 -0
- package/dist/standard-etPFZDJI.cjs +513 -0
- package/dist/type-interpreter/index.cjs +3 -7
- 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-BA8gcLUU.js} +58 -560
- package/dist/{type-interpreter-DAIBUqKf.cjs → type-interpreter-D8xETgq1.cjs} +63 -589
- package/package.json +60 -5
- 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,373 @@
|
|
|
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
|
+
/** A host-provided schema bound for an external `refPath`. */
|
|
86
|
+
interface SchemaRefEntry {
|
|
87
|
+
readonly refPath: readonly string[];
|
|
88
|
+
readonly schema: SchemaNode;
|
|
89
|
+
}
|
|
90
|
+
//#endregion
|
|
91
|
+
//#region src/spec/operation.d.ts
|
|
92
|
+
type OperationBinaryMetadata = {
|
|
93
|
+
kind: 'mime';
|
|
94
|
+
value: string;
|
|
95
|
+
};
|
|
96
|
+
type OperationPayloadDefinition = StructuredOperationPayloadDefinition | {
|
|
97
|
+
kind: 'binary';
|
|
98
|
+
meta?: OperationBinaryMetadata;
|
|
99
|
+
};
|
|
100
|
+
interface OperationErrorDefinition {
|
|
101
|
+
description?: string;
|
|
102
|
+
data?: SchemaNode;
|
|
103
|
+
}
|
|
104
|
+
interface OperationChannelDefinition {
|
|
105
|
+
description?: string;
|
|
106
|
+
data?: OperationPayloadDefinition;
|
|
107
|
+
errors?: Record<string, OperationErrorDefinition>;
|
|
108
|
+
}
|
|
109
|
+
interface OperationDefinition {
|
|
110
|
+
description?: string;
|
|
111
|
+
input?: OperationPayloadDefinition;
|
|
112
|
+
output?: OperationPayloadDefinition;
|
|
113
|
+
errors?: Record<string, OperationErrorDefinition>;
|
|
114
|
+
emits?: Record<string, OperationChannelDefinition>;
|
|
115
|
+
}
|
|
116
|
+
/** Short model name used by migration-facing APIs. */
|
|
117
|
+
type Operation = OperationDefinition;
|
|
118
|
+
interface OperationContainerDefinition {
|
|
119
|
+
description?: string;
|
|
120
|
+
operations?: Record<string, OperationDefinition>;
|
|
121
|
+
containers?: Record<string, OperationContainerDefinition>;
|
|
122
|
+
}
|
|
123
|
+
interface StructuredOperationPayloadDefinition {
|
|
124
|
+
kind: 'structured';
|
|
125
|
+
schema: SchemaNode;
|
|
126
|
+
}
|
|
127
|
+
interface StructuredOperationChannelDefinition {
|
|
128
|
+
description?: string;
|
|
129
|
+
data?: StructuredOperationPayloadDefinition;
|
|
130
|
+
errors?: Record<string, OperationErrorDefinition>;
|
|
131
|
+
}
|
|
132
|
+
interface StructuredOperationDefinition {
|
|
133
|
+
description?: string;
|
|
134
|
+
input?: StructuredOperationPayloadDefinition;
|
|
135
|
+
output?: StructuredOperationPayloadDefinition;
|
|
136
|
+
errors?: Record<string, OperationErrorDefinition>;
|
|
137
|
+
emits?: Record<string, StructuredOperationChannelDefinition>;
|
|
138
|
+
}
|
|
139
|
+
interface StructuredOperationContainerDefinition {
|
|
140
|
+
description?: string;
|
|
141
|
+
operations?: Record<string, StructuredOperationDefinition>;
|
|
142
|
+
containers?: Record<string, StructuredOperationContainerDefinition>;
|
|
143
|
+
}
|
|
144
|
+
//#endregion
|
|
145
|
+
//#region src/spec/expression.d.ts
|
|
146
|
+
interface SchemaTypeVariableExpr {
|
|
147
|
+
kind: 'typeVar';
|
|
148
|
+
name: string;
|
|
149
|
+
extends?: SchemaTypeTerm;
|
|
150
|
+
}
|
|
151
|
+
interface SchemaTypeOpaqueHostExpr {
|
|
152
|
+
kind: 'opaqueHostType';
|
|
153
|
+
hostPath: string[];
|
|
154
|
+
}
|
|
155
|
+
interface SchemaTypeAbsentExpr {
|
|
156
|
+
kind: 'absent';
|
|
157
|
+
}
|
|
158
|
+
interface SchemaTypeNeverExpr {
|
|
159
|
+
kind: 'never';
|
|
160
|
+
}
|
|
161
|
+
interface SchemaTypeUnknownExpr {
|
|
162
|
+
kind: 'unknown';
|
|
163
|
+
}
|
|
164
|
+
interface SchemaTypeMaybeAbsentExpr {
|
|
165
|
+
kind: 'maybeAbsent';
|
|
166
|
+
value: SchemaTypeTerm;
|
|
167
|
+
}
|
|
168
|
+
interface SchemaTypeArrayExpr {
|
|
169
|
+
kind: 'arrayOf';
|
|
170
|
+
element: SchemaTypeTerm;
|
|
171
|
+
constraints?: SchemaConstraint[];
|
|
172
|
+
}
|
|
173
|
+
interface SchemaTypeTupleExpr {
|
|
174
|
+
kind: 'tupleOf';
|
|
175
|
+
elements: SchemaTypeTerm[];
|
|
176
|
+
}
|
|
177
|
+
interface SchemaTypeRecordExpr {
|
|
178
|
+
kind: 'recordOf';
|
|
179
|
+
fields: {
|
|
180
|
+
key: string;
|
|
181
|
+
value: SchemaTypeTerm;
|
|
182
|
+
required?: boolean;
|
|
183
|
+
description?: string;
|
|
184
|
+
}[];
|
|
185
|
+
additionalFields?: true | SchemaTypeTerm;
|
|
186
|
+
constraints?: SchemaConstraint[];
|
|
187
|
+
}
|
|
188
|
+
type SchemaFieldSelector = {
|
|
189
|
+
kind: 'all';
|
|
190
|
+
} | {
|
|
191
|
+
kind: 'keys';
|
|
192
|
+
keys: string[];
|
|
193
|
+
onMissing: 'error' | 'ignore';
|
|
194
|
+
};
|
|
195
|
+
type SchemaVariantSelector = SchemaFieldSelector;
|
|
196
|
+
interface SchemaTypeElementOfExpr {
|
|
197
|
+
kind: 'elementOf';
|
|
198
|
+
source: SchemaTypeTerm;
|
|
199
|
+
}
|
|
200
|
+
interface SchemaTypeValueOfExpr {
|
|
201
|
+
kind: 'valueOf';
|
|
202
|
+
source: SchemaTypeTerm;
|
|
203
|
+
}
|
|
204
|
+
interface SchemaTypeElementAtExpr {
|
|
205
|
+
kind: 'elementAt';
|
|
206
|
+
source: SchemaTypeTerm;
|
|
207
|
+
index: number;
|
|
208
|
+
}
|
|
209
|
+
interface SchemaTypeFieldOfExpr {
|
|
210
|
+
kind: 'fieldOf';
|
|
211
|
+
source: SchemaTypeTerm;
|
|
212
|
+
key: string;
|
|
213
|
+
}
|
|
214
|
+
interface SchemaTypeKeyOfExpr {
|
|
215
|
+
kind: 'keyOf';
|
|
216
|
+
source: SchemaTypeTerm;
|
|
217
|
+
}
|
|
218
|
+
interface SchemaTypeFieldsOfExpr {
|
|
219
|
+
kind: 'fieldsOf';
|
|
220
|
+
source: SchemaTypeTerm;
|
|
221
|
+
fields: SchemaFieldSelector;
|
|
222
|
+
}
|
|
223
|
+
interface SchemaTypePickFieldsExpr {
|
|
224
|
+
kind: 'pickFields';
|
|
225
|
+
source: SchemaTypeTerm;
|
|
226
|
+
fields: SchemaFieldSelector;
|
|
227
|
+
}
|
|
228
|
+
interface SchemaTypeOmitFieldsExpr {
|
|
229
|
+
kind: 'omitFields';
|
|
230
|
+
source: SchemaTypeTerm;
|
|
231
|
+
fields: SchemaFieldSelector;
|
|
232
|
+
}
|
|
233
|
+
interface SchemaTypePartialFieldsExpr {
|
|
234
|
+
kind: 'partialFields';
|
|
235
|
+
source: SchemaTypeTerm;
|
|
236
|
+
fields: SchemaFieldSelector;
|
|
237
|
+
}
|
|
238
|
+
interface SchemaTypeRequiredFieldsExpr {
|
|
239
|
+
kind: 'requiredFields';
|
|
240
|
+
source: SchemaTypeTerm;
|
|
241
|
+
fields: SchemaFieldSelector;
|
|
242
|
+
}
|
|
243
|
+
interface SchemaTypeMergeRecordsExpr {
|
|
244
|
+
kind: 'mergeRecords';
|
|
245
|
+
sources: SchemaTypeTerm[];
|
|
246
|
+
conflict: 'leftWins' | 'rightWins' | 'error';
|
|
247
|
+
}
|
|
248
|
+
interface SchemaTypeNullableExpr {
|
|
249
|
+
kind: 'nullableOf';
|
|
250
|
+
value: SchemaTypeTerm;
|
|
251
|
+
}
|
|
252
|
+
interface SchemaTypeTaggedUnionExpr {
|
|
253
|
+
kind: 'taggedUnionOf';
|
|
254
|
+
discriminator: string;
|
|
255
|
+
variants: {
|
|
256
|
+
key: string;
|
|
257
|
+
value: SchemaTypeTerm;
|
|
258
|
+
description?: string;
|
|
259
|
+
}[];
|
|
260
|
+
}
|
|
261
|
+
interface SchemaTypeIntersectExpr {
|
|
262
|
+
kind: 'intersect';
|
|
263
|
+
sources: SchemaTypeTerm[];
|
|
264
|
+
}
|
|
265
|
+
interface SchemaTypeRefineExpr {
|
|
266
|
+
kind: 'refine';
|
|
267
|
+
source: SchemaTypeTerm;
|
|
268
|
+
fields: {
|
|
269
|
+
key: string;
|
|
270
|
+
require?: true;
|
|
271
|
+
intersectWith?: SchemaTypeTerm;
|
|
272
|
+
addConstraints?: SchemaConstraint[];
|
|
273
|
+
}[];
|
|
274
|
+
}
|
|
275
|
+
interface SchemaTypeExcludeVariantsExpr {
|
|
276
|
+
kind: 'excludeVariants';
|
|
277
|
+
source: SchemaTypeTerm;
|
|
278
|
+
variants: SchemaVariantSelector;
|
|
279
|
+
}
|
|
280
|
+
interface SchemaTypeExtractVariantsExpr {
|
|
281
|
+
kind: 'extractVariants';
|
|
282
|
+
source: SchemaTypeTerm;
|
|
283
|
+
variants: SchemaVariantSelector;
|
|
284
|
+
}
|
|
285
|
+
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;
|
|
286
|
+
type SchemaTypeTerm = SchemaNode | SchemaTypeExpr;
|
|
287
|
+
/** Short model name used by migration-facing APIs. */
|
|
288
|
+
type Expression = SchemaTypeExpr;
|
|
289
|
+
/** Kept here so consumers can share the JSON-compatible expression boundary. */
|
|
290
|
+
type ExpressionArgument = JsonValue;
|
|
291
|
+
//#endregion
|
|
292
|
+
//#region src/spec/standard/paths.d.ts
|
|
293
|
+
declare const STANDARD_SEMANTIC_PATHS: {
|
|
294
|
+
readonly string: {
|
|
295
|
+
readonly date: readonly ["std", "string", "date"];
|
|
296
|
+
readonly datetime: readonly ["std", "string", "datetime"];
|
|
297
|
+
readonly datetimeIso: readonly ["std", "string", "datetime", "iso"];
|
|
298
|
+
readonly email: readonly ["std", "string", "email"];
|
|
299
|
+
readonly url: readonly ["std", "string", "url"];
|
|
300
|
+
readonly ipV4: readonly ["std", "string", "ip", "v4"];
|
|
301
|
+
readonly ipV6: readonly ["std", "string", "ip", "v6"];
|
|
302
|
+
readonly uuid: readonly ["std", "string", "uuid"];
|
|
303
|
+
readonly uuidV4: readonly ["std", "string", "uuid", "v4"];
|
|
304
|
+
readonly json: readonly ["std", "string", "json"];
|
|
305
|
+
readonly base64: readonly ["std", "string", "base64"];
|
|
306
|
+
readonly base64url: readonly ["std", "string", "base64url"];
|
|
307
|
+
readonly hex: readonly ["std", "string", "hex"];
|
|
308
|
+
readonly decimal: readonly ["std", "string", "decimal"];
|
|
309
|
+
readonly bigint: readonly ["std", "string", "bigint"];
|
|
310
|
+
readonly secret: readonly ["std", "string", "secret"];
|
|
311
|
+
readonly token: readonly ["std", "string", "secret", "token"];
|
|
312
|
+
readonly password: readonly ["std", "string", "secret", "password"];
|
|
313
|
+
};
|
|
314
|
+
readonly number: {
|
|
315
|
+
readonly integer: readonly ["std", "number", "integer"];
|
|
316
|
+
readonly safeInteger: readonly ["std", "number", "safeInteger"];
|
|
317
|
+
readonly epochMillis: readonly ["std", "number", "epochMillis"];
|
|
318
|
+
readonly epochSeconds: readonly ["std", "number", "epochSeconds"];
|
|
319
|
+
};
|
|
320
|
+
};
|
|
321
|
+
declare const STANDARD_SEMANTIC_PATH_LIST: ReadonlyArray<readonly string[]>;
|
|
322
|
+
declare const STANDARD_CONSTRAINT_PATHS: {
|
|
323
|
+
readonly string: {
|
|
324
|
+
readonly minLength: readonly ["std", "minLength"];
|
|
325
|
+
readonly maxLength: readonly ["std", "maxLength"];
|
|
326
|
+
readonly pattern: readonly ["std", "pattern"];
|
|
327
|
+
};
|
|
328
|
+
readonly number: {
|
|
329
|
+
readonly minimum: readonly ["std", "minimum"];
|
|
330
|
+
readonly maximum: readonly ["std", "maximum"];
|
|
331
|
+
readonly exclusiveMinimum: readonly ["std", "exclusiveMinimum"];
|
|
332
|
+
readonly exclusiveMaximum: readonly ["std", "exclusiveMaximum"];
|
|
333
|
+
readonly multipleOf: readonly ["std", "multipleOf"];
|
|
334
|
+
};
|
|
335
|
+
readonly array: {
|
|
336
|
+
readonly minItems: readonly ["std", "minItems"];
|
|
337
|
+
readonly maxItems: readonly ["std", "maxItems"];
|
|
338
|
+
readonly uniqueItems: readonly ["std", "uniqueItems"];
|
|
339
|
+
};
|
|
340
|
+
readonly record: {
|
|
341
|
+
readonly minProperties: readonly ["std", "minProperties"];
|
|
342
|
+
readonly maxProperties: readonly ["std", "maxProperties"];
|
|
343
|
+
};
|
|
344
|
+
};
|
|
345
|
+
declare const STANDARD_CONSTRAINT_PATH_LIST: ReadonlyArray<readonly string[]>;
|
|
346
|
+
//#endregion
|
|
347
|
+
//#region src/spec/standard/definitions.d.ts
|
|
348
|
+
interface StandardSemanticDefinition {
|
|
349
|
+
path: readonly string[];
|
|
350
|
+
label: string;
|
|
351
|
+
description: string;
|
|
352
|
+
primitive: 'string' | 'number';
|
|
353
|
+
role: 'validation' | 'annotation';
|
|
354
|
+
}
|
|
355
|
+
interface StandardSemanticRelation {
|
|
356
|
+
source: readonly string[];
|
|
357
|
+
target: readonly string[];
|
|
358
|
+
kind: 'acceptedSetSubset';
|
|
359
|
+
}
|
|
360
|
+
interface StandardConstraintDefinition {
|
|
361
|
+
path: readonly string[];
|
|
362
|
+
label: string;
|
|
363
|
+
description: string;
|
|
364
|
+
target: 'string' | 'number' | 'array' | 'record';
|
|
365
|
+
argsType: 'number' | 'string' | 'boolean';
|
|
366
|
+
argsDomain: 'finiteNumber' | 'nonNegativeInteger' | 'positiveNumber' | 'regexSource' | 'boolean';
|
|
367
|
+
}
|
|
368
|
+
declare const STANDARD_SEMANTIC_DEFINITIONS: ReadonlyArray<StandardSemanticDefinition>;
|
|
369
|
+
/** Explicit accepted-set implications; carrier types are not semantic paths. */
|
|
370
|
+
declare const STANDARD_SEMANTIC_RELATIONS: ReadonlyArray<StandardSemanticRelation>;
|
|
371
|
+
declare const STANDARD_CONSTRAINT_DEFINITIONS: ReadonlyArray<StandardConstraintDefinition>;
|
|
372
|
+
//#endregion
|
|
373
|
+
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 _, SchemaSelfRefNode as _t, StandardSemanticDefinition as a, SchemaConstraint as at, SchemaTypeExtractVariantsExpr as b, SchemaTaggedUnionVariant 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, SchemaRefNode as gt, SchemaTypeArrayExpr as h, SchemaRefEntry 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, SchemaStringNode as vt, SchemaTypeKeyOfExpr as w, SchemaTypeFieldOfExpr as x, SchemaTupleNode as xt, SchemaTypeExpr as y, SchemaTaggedUnionNode as yt, SchemaTypeUnknownExpr as z };
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { ct as SchemaNode, gt as SchemaRefNode, ht as SchemaRefEntry, q as OperationDefinition } from "./index-1sDuqu05.js";
|
|
2
|
+
|
|
3
|
+
//#region src/resolve/schema-closure.d.ts
|
|
4
|
+
interface SchemaClosureDiagnostic {
|
|
5
|
+
readonly code: string;
|
|
6
|
+
readonly path: readonly (string | number)[];
|
|
7
|
+
readonly message: string;
|
|
8
|
+
}
|
|
9
|
+
type SchemaRefResolution = SchemaNode | {
|
|
10
|
+
readonly status: 'resolved';
|
|
11
|
+
readonly schema: SchemaNode;
|
|
12
|
+
} | {
|
|
13
|
+
readonly status: 'unknown' | 'unsupported';
|
|
14
|
+
readonly message?: string;
|
|
15
|
+
} | undefined;
|
|
16
|
+
interface ResolvedSchemaGraph {
|
|
17
|
+
readonly refs: readonly SchemaRefEntry[];
|
|
18
|
+
/** External graph edges that point back to an active ref during loading. */
|
|
19
|
+
readonly cycles: readonly (readonly string[])[];
|
|
20
|
+
}
|
|
21
|
+
type SchemaClosureStatus = 'resolved' | 'incomplete' | 'rejected';
|
|
22
|
+
interface SchemaClosureResult {
|
|
23
|
+
readonly status: SchemaClosureStatus;
|
|
24
|
+
readonly graph: ResolvedSchemaGraph;
|
|
25
|
+
readonly issues: readonly SchemaClosureDiagnostic[];
|
|
26
|
+
}
|
|
27
|
+
interface SchemaClosureContext {
|
|
28
|
+
readonly resolveRef?: (refPath: readonly string[], context: SchemaClosureResolutionContext) => SchemaRefResolution;
|
|
29
|
+
readonly refs?: readonly SchemaRefEntry[];
|
|
30
|
+
readonly maxDepth?: number;
|
|
31
|
+
readonly maxNodes?: number;
|
|
32
|
+
readonly maxSteps?: number;
|
|
33
|
+
}
|
|
34
|
+
/** Async loading accepts both synchronous and asynchronous host resolvers. */
|
|
35
|
+
interface AsyncSchemaClosureContext extends Omit<SchemaClosureContext, 'resolveRef'> {
|
|
36
|
+
readonly resolveRef?: (refPath: readonly string[], context: SchemaClosureResolutionContext) => SchemaRefResolution | PromiseLike<SchemaRefResolution>;
|
|
37
|
+
}
|
|
38
|
+
/** Context supplied while the host resolves one ref during closure loading. */
|
|
39
|
+
interface SchemaClosureResolutionContext {
|
|
40
|
+
readonly path: readonly (string | number)[];
|
|
41
|
+
readonly refPath: readonly string[];
|
|
42
|
+
readonly ref: SchemaRefNode;
|
|
43
|
+
readonly depth: number;
|
|
44
|
+
}
|
|
45
|
+
/** Load references using a synchronous host resolver. */
|
|
46
|
+
declare function resolveSchemaReferences(entry: unknown, context?: SchemaClosureContext): SchemaClosureResult;
|
|
47
|
+
/** Load references using a synchronous or asynchronous host resolver. */
|
|
48
|
+
declare function resolveSchemaReferencesAsync(entry: unknown, context?: AsyncSchemaClosureContext): Promise<SchemaClosureResult>;
|
|
49
|
+
/** Resolve all external schema refs reachable from an operation declaration. */
|
|
50
|
+
declare function resolveOperationClosure(entry: OperationDefinition, context?: SchemaClosureContext): SchemaClosureResult;
|
|
51
|
+
declare function resolveOperationClosureAsync(entry: OperationDefinition, context?: AsyncSchemaClosureContext): Promise<SchemaClosureResult>;
|
|
52
|
+
//#endregion
|
|
53
|
+
export { SchemaClosureResolutionContext as a, SchemaRefResolution as c, resolveSchemaReferences as d, resolveSchemaReferencesAsync as f, SchemaClosureDiagnostic as i, resolveOperationClosure as l, ResolvedSchemaGraph as n, SchemaClosureResult as o, SchemaClosureContext as r, SchemaClosureStatus as s, AsyncSchemaClosureContext as t, resolveOperationClosureAsync as u };
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { L as SchemaTypeTerm, ct as SchemaNode, ht as SchemaRefEntry, y as SchemaTypeExpr } from "./index-i7Au-FQ6.cjs";
|
|
2
|
+
import { d as RelationResult, i as RelationContext } from "./index-ba_52Yu9.cjs";
|
|
3
|
+
|
|
4
|
+
//#region src/type-interpreter/interpreter.d.ts
|
|
5
|
+
type TypeInterpreterPath = readonly (string | number)[];
|
|
6
|
+
interface TypeInterpreterDiagnostic {
|
|
7
|
+
readonly code: string;
|
|
8
|
+
readonly path: TypeInterpreterPath;
|
|
9
|
+
readonly message: string;
|
|
10
|
+
}
|
|
11
|
+
type TypeInterpreterStatus = 'evaluated' | 'incomplete' | 'rejected';
|
|
12
|
+
type EvaluatedTypeTerm = SchemaNode | SchemaTypeExpr;
|
|
13
|
+
type TypeInterpreterResult = {
|
|
14
|
+
readonly status: 'evaluated';
|
|
15
|
+
readonly term: EvaluatedTypeTerm;
|
|
16
|
+
readonly schema?: SchemaNode;
|
|
17
|
+
readonly unresolvedTypeVars?: readonly string[];
|
|
18
|
+
readonly issues: readonly TypeInterpreterDiagnostic[];
|
|
19
|
+
} | {
|
|
20
|
+
readonly status: 'incomplete';
|
|
21
|
+
readonly issues: readonly TypeInterpreterDiagnostic[];
|
|
22
|
+
} | {
|
|
23
|
+
readonly status: 'rejected';
|
|
24
|
+
readonly issues: readonly TypeInterpreterDiagnostic[];
|
|
25
|
+
};
|
|
26
|
+
interface TypeInterpreterContext {
|
|
27
|
+
readonly typeVars?: Readonly<Record<string, SchemaTypeTerm>>;
|
|
28
|
+
readonly refs?: readonly SchemaRefEntry[];
|
|
29
|
+
readonly maxDepth?: number;
|
|
30
|
+
readonly maxSteps?: number;
|
|
31
|
+
}
|
|
32
|
+
declare function evaluateExpression(term: unknown, context?: TypeInterpreterContext): TypeInterpreterResult;
|
|
33
|
+
declare const evaluateSchemaTypeTerm: typeof evaluateExpression;
|
|
34
|
+
//#endregion
|
|
35
|
+
//#region src/type-interpreter/term-relation.d.ts
|
|
36
|
+
interface TypeTermRelationContext {
|
|
37
|
+
readonly interpreter?: TypeInterpreterContext;
|
|
38
|
+
readonly relation?: RelationContext;
|
|
39
|
+
readonly hostTypeRelation?: (sourcePath: readonly string[], targetPath: readonly string[]) => HostTypeRelationDecision;
|
|
40
|
+
}
|
|
41
|
+
type HostTypeRelationDecision = boolean | {
|
|
42
|
+
readonly status: 'assignable' | 'incompatible' | 'unknown' | 'unsupported';
|
|
43
|
+
readonly message?: string;
|
|
44
|
+
};
|
|
45
|
+
declare function checkTypeTermRelation(source: SchemaTypeTerm, target: SchemaTypeTerm, context?: TypeTermRelationContext): RelationResult;
|
|
46
|
+
//#endregion
|
|
47
|
+
//#region src/type-interpreter/type-variable-solver.d.ts
|
|
48
|
+
interface TypeVariableConstraint {
|
|
49
|
+
readonly source: SchemaTypeTerm;
|
|
50
|
+
readonly target: SchemaTypeTerm;
|
|
51
|
+
}
|
|
52
|
+
interface TypeVariableSolverInput {
|
|
53
|
+
readonly variables: readonly string[];
|
|
54
|
+
readonly constraints: readonly TypeVariableConstraint[];
|
|
55
|
+
}
|
|
56
|
+
interface TypeVariableSolverIssue {
|
|
57
|
+
readonly code: string;
|
|
58
|
+
readonly constraint?: number;
|
|
59
|
+
readonly variable?: string;
|
|
60
|
+
readonly message: string;
|
|
61
|
+
}
|
|
62
|
+
interface TypeVariableSolverResult {
|
|
63
|
+
readonly status: 'solved' | 'unknown' | 'incompatible' | 'rejected';
|
|
64
|
+
readonly bindings: Readonly<Record<string, EvaluatedTypeTerm>>;
|
|
65
|
+
readonly unresolved: readonly string[];
|
|
66
|
+
readonly issues: readonly TypeVariableSolverIssue[];
|
|
67
|
+
}
|
|
68
|
+
interface TypeVariableSolverContext extends TypeTermRelationContext {
|
|
69
|
+
readonly interpreter?: TypeInterpreterContext;
|
|
70
|
+
}
|
|
71
|
+
declare function solveTypeVariables(input: TypeVariableSolverInput, context?: TypeVariableSolverContext): TypeVariableSolverResult;
|
|
72
|
+
//#endregion
|
|
73
|
+
export { evaluateSchemaTypeTerm as _, TypeVariableSolverResult as a, TypeTermRelationContext as c, TypeInterpreterContext as d, TypeInterpreterDiagnostic as f, evaluateExpression as g, TypeInterpreterStatus as h, TypeVariableSolverIssue as i, checkTypeTermRelation as l, TypeInterpreterResult as m, TypeVariableSolverContext as n, solveTypeVariables as o, TypeInterpreterPath as p, TypeVariableSolverInput as r, HostTypeRelationDecision as s, TypeVariableConstraint as t, EvaluatedTypeTerm as u };
|