schemair 0.2.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 +140 -39
- package/dist/authoring/index.d.cts +1 -1
- package/dist/authoring/index.d.ts +1 -1
- package/dist/authoring/index.js +1 -1
- package/dist/{authoring-D3V0iyTe.js → authoring-DyJNYs5o.js} +1 -1
- 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.d.cts +2 -2
- package/dist/definition/index.d.ts +2 -2
- package/dist/definition/index.js +1 -1
- package/dist/{index-DDMwVy2I.d.cts → index-1sDuqu05.d.ts} +6 -1
- package/dist/index-BFSMT_2d.d.ts +53 -0
- package/dist/{index-DM5DSLLL.d.ts → index-BGz7L_Fq.d.cts} +4 -30
- package/dist/{index-bQy-C-1l.d.ts → index-BTtdqi_M.d.ts} +9 -9
- package/dist/index-BfbClf6R.d.cts +20 -0
- package/dist/{index-CQynt7ft.d.cts → index-CK7Is7vy.d.cts} +9 -9
- package/dist/index-CUGhtuwA.d.cts +53 -0
- package/dist/{index-DXWoNYFB.d.ts → index-CV8EZQy8.d.ts} +1 -1
- package/dist/index-CzNxjqVg.d.cts +47 -0
- package/dist/{index-CIim1dG7.d.cts → index-DGHMUZ5m.d.cts} +1 -1
- package/dist/{index-CBbd4hXJ.d.ts → index-DxvfPmw6.d.ts} +4 -11
- package/dist/index-T6nFhvGQ.d.ts +20 -0
- package/dist/{index-CNjYUKvu.d.cts → index-ba_52Yu9.d.cts} +4 -11
- package/dist/index-hrcM9oJe.d.ts +47 -0
- package/dist/{index-4aMF0cTE.d.ts → index-i7Au-FQ6.d.cts} +6 -1
- package/dist/{index-DhmHCGpT.d.cts → index-mu1znI1F.d.ts} +4 -30
- package/dist/index.cjs +10 -10
- package/dist/index.d.cts +9 -7
- package/dist/index.d.ts +9 -7
- package/dist/index.js +9 -7
- package/dist/integrations/json-schema/index.d.cts +1 -1
- package/dist/integrations/json-schema/index.d.ts +1 -1
- package/dist/integrations/json-schema/index.js +1 -1
- package/dist/integrations/standard-schema/index.cjs +4 -4
- package/dist/integrations/standard-schema/index.d.cts +5 -5
- package/dist/integrations/standard-schema/index.d.ts +5 -5
- package/dist/integrations/standard-schema/index.js +5 -5
- package/dist/payload/index.cjs +44 -81
- package/dist/payload/index.d.cts +2 -2
- package/dist/payload/index.d.ts +2 -2
- package/dist/payload/index.js +45 -81
- package/dist/relations/index.cjs +2 -5
- 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-Cymx4iTc.cjs → relations-NUVJkAG8.cjs} +11 -232
- package/dist/{relations-ysXDmi-Z.js → relations-QtnCRW9x.js} +13 -216
- 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.d.cts +2 -2
- package/dist/spec/index.d.ts +2 -2
- package/dist/spec/index.js +1 -1
- package/dist/standard/index.d.cts +2 -2
- package/dist/standard/index.d.ts +2 -2
- package/dist/standard/index.js +2 -2
- package/dist/type-interpreter/index.cjs +2 -6
- package/dist/type-interpreter/index.d.cts +2 -2
- package/dist/type-interpreter/index.d.ts +2 -2
- package/dist/type-interpreter/index.js +2 -2
- package/dist/{type-interpreter-DnrId8aM.js → type-interpreter-BA8gcLUU.js} +57 -280
- package/dist/{type-interpreter-OLt2W2yd.cjs → type-interpreter-D8xETgq1.cjs} +55 -302
- package/package.json +23 -3
- package/dist/index-BqfGAU1K.d.ts +0 -56
- package/dist/index-D3mfwaSO.d.cts +0 -56
- /package/dist/{chunk-BgLxgFZR.js → chunk-bFfwrPtJ.js} +0 -0
- /package/dist/{definition-DmYnDmQO.js → definition-BH_LzXGc.js} +0 -0
- /package/dist/{standard-DhKsxu9U.js → standard-BGMgbbEQ.js} +0 -0
package/README.md
CHANGED
|
@@ -1,11 +1,28 @@
|
|
|
1
1
|
# SchemaIR for TypeScript
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
[](https://www.npmjs.com/package/schemair)
|
|
4
|
+
[](https://github.com/schemair/schemair/actions/workflows/ci.yml)
|
|
5
|
+
[](https://github.com/schemair/schemair/blob/main/LICENSE)
|
|
6
|
+
|
|
7
|
+
**Types as data.**
|
|
8
|
+
|
|
9
|
+
SchemaIR is a language-independent protocol and intermediate representation
|
|
10
|
+
for portable data contracts, operation definitions, and type calculations.
|
|
11
|
+
|
|
12
|
+
The [`schemair` package](https://www.npmjs.com/package/schemair) is the
|
|
13
|
+
TypeScript implementation. It represents contracts, operations, and type
|
|
14
|
+
expressions as serializable data.
|
|
15
|
+
|
|
16
|
+
For the protocol's theory, IR model, design philosophy, standard vocabulary,
|
|
17
|
+
cross-language boundaries, and conformance rules, see the [SchemaIR project
|
|
18
|
+
README](https://github.com/schemair/schemair#readme) and the [protocol
|
|
19
|
+
specification](https://github.com/schemair/schemair/tree/main/spec). This page
|
|
20
|
+
focuses on using SchemaIR from TypeScript and JavaScript.
|
|
21
|
+
|
|
22
|
+
## About this implementation
|
|
23
|
+
|
|
24
|
+
The package exports model types, definition and payload validators,
|
|
25
|
+
assignability checks, a type expression interpreter, and authoring builders.
|
|
9
26
|
|
|
10
27
|
The `schemair/authoring` entry point exposes two namespaces: `schema` contains
|
|
11
28
|
builders for serializable `SchemaNode` contracts, while `expression` contains
|
|
@@ -25,11 +42,16 @@ context. Core validation and relation APIs remain provider-driven; import
|
|
|
25
42
|
`standardPayloadContext` or `standardRelationContext` when the standard
|
|
26
43
|
vocabulary policy is wanted.
|
|
27
44
|
|
|
45
|
+
This binding implements the shared protocol and conformance rules. See the
|
|
46
|
+
[implementation matrix](../IMPLEMENTATIONS.md) for coverage and status.
|
|
47
|
+
|
|
28
48
|
## Install
|
|
29
49
|
|
|
30
50
|
Install the published package from npm:
|
|
31
51
|
|
|
32
52
|
```sh
|
|
53
|
+
npm install schemair
|
|
54
|
+
# or
|
|
33
55
|
pnpm add schemair
|
|
34
56
|
```
|
|
35
57
|
|
|
@@ -37,7 +59,7 @@ To work on the implementation in this repository, run `pnpm install` in this
|
|
|
37
59
|
directory. The published package provides ESM `.js` files for `import` and CJS
|
|
38
60
|
`.cjs` files for `require`, with matching TypeScript declarations.
|
|
39
61
|
|
|
40
|
-
##
|
|
62
|
+
## Quick start
|
|
41
63
|
|
|
42
64
|
Builders return ordinary serializable objects. You can also write the same
|
|
43
65
|
`SchemaNode` data directly or read it from JSON. Validate untrusted definitions
|
|
@@ -62,6 +84,26 @@ if (result.status !== 'accepted') console.error(result.issues);
|
|
|
62
84
|
needed `resolveRef`, `semanticProvider`, or `constraintProvider` in the payload
|
|
63
85
|
context. Missing capabilities can produce `unknown`.
|
|
64
86
|
|
|
87
|
+
For a catalog-backed schema, resolve refs once and reuse the snapshot for
|
|
88
|
+
synchronous validation:
|
|
89
|
+
|
|
90
|
+
```ts
|
|
91
|
+
import { resolveSchemaReferencesAsync } from 'schemair/resolve';
|
|
92
|
+
import { validatePayload } from 'schemair/payload';
|
|
93
|
+
|
|
94
|
+
const closure = await resolveSchemaReferencesAsync(schema, { resolveRef });
|
|
95
|
+
if (closure.status !== 'resolved') throw new Error(closure.issues[0]?.message);
|
|
96
|
+
const result = validatePayload(value, schema, { refs: closure.graph.refs });
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
The `refs` context is a list of `{ refPath, schema }` entries. The path uses
|
|
100
|
+
the same string-array shape as a `SchemaNode` ref; callers do not need to
|
|
101
|
+
encode it into an object key.
|
|
102
|
+
|
|
103
|
+
The validator does not perform catalog I/O when `refs` is supplied. Semantic
|
|
104
|
+
and constraint providers are synchronous; prepare any external policy data
|
|
105
|
+
before checking the payload.
|
|
106
|
+
|
|
65
107
|
## Infer a TypeScript payload type
|
|
66
108
|
|
|
67
109
|
`Infer<Schema, Registry>` is available when the schema is authored in TypeScript and its
|
|
@@ -195,7 +237,7 @@ extension paths produce `unknown` and need an appropriate host provider.
|
|
|
195
237
|
An annotation such as `std/string/secret/password` labels a string; it imposes no
|
|
196
238
|
password-strength validation. `standardSchemaSatisfiability` reports
|
|
197
239
|
`inhabited`, `emptySet`, or `unknown`; an undecidable combination is never
|
|
198
|
-
silently treated as empty. See the [standard vocabulary specification](
|
|
240
|
+
silently treated as empty. See the [standard vocabulary specification](https://github.com/schemair/schemair/blob/main/spec/protocol/standard-vocabulary.md)
|
|
199
241
|
for portable semantics and implementation boundaries.
|
|
200
242
|
|
|
201
243
|
## Define an operation
|
|
@@ -282,6 +324,25 @@ for (const issue of relation.issues) {
|
|
|
282
324
|
}
|
|
283
325
|
```
|
|
284
326
|
|
|
327
|
+
The `schemair/compatibility` entry point reports both substitution directions
|
|
328
|
+
for a previous and next schema or operation. `previousToNext` asks whether
|
|
329
|
+
values accepted by the previous declaration are accepted by the next one;
|
|
330
|
+
`nextToPrevious` checks the reverse. Each side preserves the original relation
|
|
331
|
+
result and diagnostics, while the report summarizes the pair as
|
|
332
|
+
`compatible`, `breaking`, `unknown`, or `invalid`.
|
|
333
|
+
|
|
334
|
+
```ts
|
|
335
|
+
import { reportSchemaCompatibility } from 'schemair/compatibility';
|
|
336
|
+
|
|
337
|
+
const report = reportSchemaCompatibility(previousSchema, nextSchema);
|
|
338
|
+
if (report.status === 'breaking') {
|
|
339
|
+
console.log(report.previousToNext.relation.issues);
|
|
340
|
+
}
|
|
341
|
+
```
|
|
342
|
+
|
|
343
|
+
This is a relation-based compatibility report. It does not choose a migration,
|
|
344
|
+
versioning, or publication policy for the host.
|
|
345
|
+
|
|
285
346
|
`validateStructuredOperationDefinition` and
|
|
286
347
|
`validateStructuredOperationContainerDefinition` apply the same checks and
|
|
287
348
|
reject binary payloads anywhere in the declaration. Their boolean companions,
|
|
@@ -307,7 +368,9 @@ if (relation.status === 'assignable') {
|
|
|
307
368
|
|
|
308
369
|
The result is `assignable`, `incompatible`, `unknown`, or `rejected`. Supply
|
|
309
370
|
resolver and provider callbacks in the relation context when comparison needs
|
|
310
|
-
external information.
|
|
371
|
+
external information. If references have already been loaded by a host, pass
|
|
372
|
+
the immutable snapshot as `refs`; relation checking then remains synchronous and
|
|
373
|
+
does not perform catalog I/O.
|
|
311
374
|
|
|
312
375
|
## Evaluate expressions
|
|
313
376
|
|
|
@@ -315,6 +378,31 @@ The type interpreter calculates authoring-time expressions. An evaluated
|
|
|
315
378
|
result always has a `term`; it also has `schema` when that term can be
|
|
316
379
|
materialized as a `SchemaNode`.
|
|
317
380
|
|
|
381
|
+
For a synchronous, fully materialized run, load the reachable reference
|
|
382
|
+
closure first and pass its immutable graph to the interpreter:
|
|
383
|
+
|
|
384
|
+
```ts
|
|
385
|
+
import { evaluateExpression } from 'schemair/type-interpreter';
|
|
386
|
+
import { resolveSchemaReferencesAsync } from 'schemair/resolve';
|
|
387
|
+
|
|
388
|
+
const closure = await resolveSchemaReferencesAsync(expression, { resolveRef });
|
|
389
|
+
if (closure.status !== 'resolved') throw new Error(closure.issues[0]?.message);
|
|
390
|
+
|
|
391
|
+
const result = evaluateExpression(expression, { refs: closure.graph.refs });
|
|
392
|
+
```
|
|
393
|
+
|
|
394
|
+
`resolveSchemaReferencesAsync` recursively loads every external reference reachable
|
|
395
|
+
from the entry, including references inside resolved schemas. It preserves ref
|
|
396
|
+
paths rather than inlining schemas. The `schemair/resolve` loader performs
|
|
397
|
+
host-owned asynchronous I/O. `evaluateExpression` then uses the explicit `refs`
|
|
398
|
+
snapshot, so the same evaluation request can run in a worker, server process,
|
|
399
|
+
or WASM implementation. Term relations and solvers may additionally use
|
|
400
|
+
explicit synchronous host policy callbacks.
|
|
401
|
+
`selfRef` remains local to each schema root; recursive external refs stay as
|
|
402
|
+
graph edges during loading and are bounded by the closure limits. The returned
|
|
403
|
+
graph exposes those edges as `graph.cycles`. Resolve a closure once when refs
|
|
404
|
+
come from a database or network, then reuse its snapshot across these calls.
|
|
405
|
+
|
|
318
406
|
```ts
|
|
319
407
|
import { schema as s, expression as e } from 'schemair/authoring';
|
|
320
408
|
import { evaluateExpression } from 'schemair/type-interpreter';
|
|
@@ -331,6 +419,11 @@ Unbound type variables remain in the evaluated term and appear in
|
|
|
331
419
|
with structured issues. `checkTypeTermRelation` compares expression terms;
|
|
332
420
|
`solveTypeVariables` infers invocation-local bindings for generic ports.
|
|
333
421
|
|
|
422
|
+
Evaluation validates portable declarations before computing their results,
|
|
423
|
+
including constraints on unresolved terms. It does not mutate input
|
|
424
|
+
declarations and accepts frozen declarations. Type-variable upper bounds use
|
|
425
|
+
the same preloaded reference environment as the binding being checked.
|
|
426
|
+
|
|
334
427
|
## Compare expression terms
|
|
335
428
|
|
|
336
429
|
Unlike `checkSchemaRelation`, this API also compares terms that cannot become
|
|
@@ -379,44 +472,49 @@ if (solution.status === 'solved') {
|
|
|
379
472
|
When a variable has no evidence, the solver lists it in `unresolved` instead
|
|
380
473
|
of inventing a binding. Inspect `status` and `issues` before using a result.
|
|
381
474
|
|
|
382
|
-
##
|
|
475
|
+
## Asynchronous boundaries
|
|
383
476
|
|
|
384
|
-
|
|
385
|
-
|
|
477
|
+
Schema definition validation, expression evaluation, schema and operation
|
|
478
|
+
relations, compatibility reports, type-variable solving, and payload validation are synchronous
|
|
479
|
+
calculations. They accept in-memory data and synchronous callbacks. When refs
|
|
480
|
+
are stored remotely, use `resolveSchemaReferencesAsync` or `resolveOperationClosureAsync`
|
|
481
|
+
from `schemair/resolve` to load them first, then pass the resulting `refs`
|
|
482
|
+
snapshot to the calculation. For an in-memory catalog, use the synchronous
|
|
483
|
+
`resolveSchemaReferences` or `resolveOperationClosure` instead. Both modes
|
|
484
|
+
share traversal, caching, limits, and diagnostics. Sync loaders reject promise
|
|
485
|
+
results with an `incomplete` diagnostic; async loaders accept both immediate
|
|
486
|
+
and promise results.
|
|
386
487
|
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
| `checkSchemaRelation` | `checkSchemaRelationAsync` |
|
|
391
|
-
| `evaluateExpression` | `evaluateExpressionAsync` |
|
|
392
|
-
| `checkTypeTermRelation` | `checkTypeTermRelationAsync` |
|
|
393
|
-
| `solveTypeVariables` | `solveTypeVariablesAsync` |
|
|
488
|
+
```ts
|
|
489
|
+
import { resolveSchemaReferences } from 'schemair/resolve';
|
|
490
|
+
import { schema as s } from 'schemair/authoring';
|
|
394
491
|
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
492
|
+
const loaded = resolveSchemaReferences(s.ref(['UserName']), {
|
|
493
|
+
resolveRef: (path) => path[0] === 'UserName' ? s.string() : undefined,
|
|
494
|
+
});
|
|
495
|
+
```
|
|
398
496
|
|
|
399
|
-
For example, a reference catalog
|
|
497
|
+
For example, load a reference catalog from a database before checking a value:
|
|
400
498
|
|
|
401
499
|
```ts
|
|
402
500
|
import { schema as s } from 'schemair/authoring';
|
|
403
|
-
import {
|
|
501
|
+
import { validatePayload } from 'schemair/payload';
|
|
502
|
+
import { resolveSchemaReferencesAsync } from 'schemair/resolve';
|
|
404
503
|
|
|
405
504
|
const user = s.record([s.requiredField('name', s.string())]);
|
|
406
|
-
const
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
);
|
|
505
|
+
const ref = s.ref(['catalog', 'user']);
|
|
506
|
+
const loaded = await resolveSchemaReferencesAsync(ref, {
|
|
507
|
+
resolveRef: async (path) =>
|
|
508
|
+
path.join('/') === 'catalog/user' ? user : undefined,
|
|
509
|
+
});
|
|
510
|
+
if (loaded.status !== 'resolved') throw new Error(loaded.issues[0]?.message);
|
|
511
|
+
const result = validatePayload({ name: 'Ada' }, ref, { refs: loaded.graph.refs });
|
|
414
512
|
console.log(result.status); // 'accepted'
|
|
415
513
|
```
|
|
416
514
|
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
515
|
+
Semantic and constraint providers are synchronous policies. Prepare external
|
|
516
|
+
policy data before validation. Database uniqueness, permissions, and other
|
|
517
|
+
business checks belong in the host workflow rather than the core validator.
|
|
420
518
|
|
|
421
519
|
## Standard Schema integration
|
|
422
520
|
|
|
@@ -431,12 +529,13 @@ const standard = schemaIRToStandardSchema(
|
|
|
431
529
|
s.record([s.requiredField('name', s.string())]),
|
|
432
530
|
);
|
|
433
531
|
|
|
434
|
-
const result =
|
|
532
|
+
const result = standard['~standard'].validate({ name: 'Ada' });
|
|
435
533
|
```
|
|
436
534
|
|
|
437
|
-
The adapter
|
|
438
|
-
|
|
439
|
-
|
|
535
|
+
The adapter uses synchronous payload validation with preloaded `refs` and
|
|
536
|
+
synchronous `resolveRef`, `semanticProvider`, and `constraintProvider`
|
|
537
|
+
callbacks. Load external references before constructing the adapter.
|
|
538
|
+
Successful validation returns the original
|
|
440
539
|
input reference. Failed, unknown, unsupported, and unresolved validation
|
|
441
540
|
outcomes are projected to Standard Schema `issues`; native SchemaIR payload
|
|
442
541
|
diagnostics remain available through `schemair/payload`.
|
|
@@ -517,7 +616,9 @@ callbacks, and required diagnostics.
|
|
|
517
616
|
| `schemair/definition` | Schema definition validation |
|
|
518
617
|
| `schemair/payload` | Payload validation |
|
|
519
618
|
| `schemair/relations` | SchemaNode assignability |
|
|
619
|
+
| `schemair/compatibility` | Directional schema and operation compatibility reports |
|
|
520
620
|
| `schemair/type-interpreter` | Expression evaluation and type-term relations |
|
|
621
|
+
| `schemair/resolve` | Host-owned synchronous and asynchronous schema and operation reference loading |
|
|
521
622
|
| `schemair/authoring` | `schema` builders, `expression` builders, and TypeScript-only `Infer<Schema>` |
|
|
522
623
|
| `schemair/standard` | Standard semantic/constraint paths, registries, predicates, and relation helpers |
|
|
523
624
|
| `schemair/standard-schema` | Standard Schema runtime adapter |
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as InferOperationOutput, c as expression_d_exports, d as InferFailureReason, f as InferRef, h as StaticSchemaRegistryEntry, i as InferOperationInput, l as schema_d_exports, m as StaticSchemaRegistry, n as InferOperationEmits, o as InferOperationPayload, p as InferResult, r as InferOperationErrors, s as OperationRegistry, t as InferOperation, u as Infer } from "../index-
|
|
1
|
+
import { a as InferOperationOutput, c as expression_d_exports, d as InferFailureReason, f as InferRef, h as StaticSchemaRegistryEntry, i as InferOperationInput, l as schema_d_exports, m as StaticSchemaRegistry, n as InferOperationEmits, o as InferOperationPayload, p as InferResult, r as InferOperationErrors, s as OperationRegistry, t as InferOperation, u as Infer } from "../index-CK7Is7vy.cjs";
|
|
2
2
|
export { Infer, InferFailureReason, InferOperation, InferOperationEmits, InferOperationErrors, InferOperationInput, InferOperationOutput, InferOperationPayload, InferRef, InferResult, OperationRegistry, StaticSchemaRegistry, StaticSchemaRegistryEntry, expression_d_exports as expression, schema_d_exports as schema };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as InferOperationOutput, c as expression_d_exports, d as InferFailureReason, f as InferRef, h as StaticSchemaRegistryEntry, i as InferOperationInput, l as schema_d_exports, m as StaticSchemaRegistry, n as InferOperationEmits, o as InferOperationPayload, p as InferResult, r as InferOperationErrors, s as OperationRegistry, t as InferOperation, u as Infer } from "../index-
|
|
1
|
+
import { a as InferOperationOutput, c as expression_d_exports, d as InferFailureReason, f as InferRef, h as StaticSchemaRegistryEntry, i as InferOperationInput, l as schema_d_exports, m as StaticSchemaRegistry, n as InferOperationEmits, o as InferOperationPayload, p as InferResult, r as InferOperationErrors, s as OperationRegistry, t as InferOperation, u as Infer } from "../index-BTtdqi_M.js";
|
|
2
2
|
export { Infer, InferFailureReason, InferOperation, InferOperationEmits, InferOperationErrors, InferOperationInput, InferOperationOutput, InferOperationPayload, InferRef, InferResult, OperationRegistry, StaticSchemaRegistry, StaticSchemaRegistryEntry, expression_d_exports as expression, schema_d_exports as schema };
|
package/dist/authoring/index.js
CHANGED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
const require_relations = require('../relations-NUVJkAG8.cjs');
|
|
2
|
+
|
|
3
|
+
//#region src/compatibility/index.ts
|
|
4
|
+
function status(relation) {
|
|
5
|
+
if (relation.status === "assignable") return "compatible";
|
|
6
|
+
if (relation.status === "incompatible") return "breaking";
|
|
7
|
+
if (relation.status === "unknown") return "unknown";
|
|
8
|
+
return "invalid";
|
|
9
|
+
}
|
|
10
|
+
function check(relation) {
|
|
11
|
+
return {
|
|
12
|
+
status: status(relation),
|
|
13
|
+
relation
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
function combine(left, right) {
|
|
17
|
+
if (left.status === "invalid" || right.status === "invalid") return "invalid";
|
|
18
|
+
if (left.status === "breaking" || right.status === "breaking") return "breaking";
|
|
19
|
+
if (left.status === "unknown" || right.status === "unknown") return "unknown";
|
|
20
|
+
return "compatible";
|
|
21
|
+
}
|
|
22
|
+
function reportSchemaCompatibility(previous, next, context = {}) {
|
|
23
|
+
const previousToNext = check(require_relations.checkSchemaRelation(previous, next, context));
|
|
24
|
+
const nextToPrevious = check(require_relations.checkSchemaRelation(next, previous, context));
|
|
25
|
+
return {
|
|
26
|
+
previousToNext,
|
|
27
|
+
nextToPrevious,
|
|
28
|
+
status: combine(previousToNext, nextToPrevious)
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
function reportOperationCompatibility(previous, next, context = {}) {
|
|
32
|
+
const previousToNext = check(require_relations.checkOperationRelation(previous, next, context));
|
|
33
|
+
const nextToPrevious = check(require_relations.checkOperationRelation(next, previous, context));
|
|
34
|
+
return {
|
|
35
|
+
previousToNext,
|
|
36
|
+
nextToPrevious,
|
|
37
|
+
status: combine(previousToNext, nextToPrevious)
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
//#endregion
|
|
42
|
+
exports.reportOperationCompatibility = reportOperationCompatibility;
|
|
43
|
+
exports.reportSchemaCompatibility = reportSchemaCompatibility;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { a as reportSchemaCompatibility, i as reportOperationCompatibility, n as CompatibilityReport, r as CompatibilityStatus, t as CompatibilityCheck } from "../index-BfbClf6R.cjs";
|
|
2
|
+
export { CompatibilityCheck, CompatibilityReport, CompatibilityStatus, reportOperationCompatibility, reportSchemaCompatibility };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { a as reportSchemaCompatibility, i as reportOperationCompatibility, n as CompatibilityReport, r as CompatibilityStatus, t as CompatibilityCheck } from "../index-T6nFhvGQ.js";
|
|
2
|
+
export { CompatibilityCheck, CompatibilityReport, CompatibilityStatus, reportOperationCompatibility, reportSchemaCompatibility };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { r as checkSchemaRelation, t as checkOperationRelation } from "../relations-QtnCRW9x.js";
|
|
2
|
+
|
|
3
|
+
//#region src/compatibility/index.ts
|
|
4
|
+
function status(relation) {
|
|
5
|
+
if (relation.status === "assignable") return "compatible";
|
|
6
|
+
if (relation.status === "incompatible") return "breaking";
|
|
7
|
+
if (relation.status === "unknown") return "unknown";
|
|
8
|
+
return "invalid";
|
|
9
|
+
}
|
|
10
|
+
function check(relation) {
|
|
11
|
+
return {
|
|
12
|
+
status: status(relation),
|
|
13
|
+
relation
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
function combine(left, right) {
|
|
17
|
+
if (left.status === "invalid" || right.status === "invalid") return "invalid";
|
|
18
|
+
if (left.status === "breaking" || right.status === "breaking") return "breaking";
|
|
19
|
+
if (left.status === "unknown" || right.status === "unknown") return "unknown";
|
|
20
|
+
return "compatible";
|
|
21
|
+
}
|
|
22
|
+
function reportSchemaCompatibility(previous, next, context = {}) {
|
|
23
|
+
const previousToNext = check(checkSchemaRelation(previous, next, context));
|
|
24
|
+
const nextToPrevious = check(checkSchemaRelation(next, previous, context));
|
|
25
|
+
return {
|
|
26
|
+
previousToNext,
|
|
27
|
+
nextToPrevious,
|
|
28
|
+
status: combine(previousToNext, nextToPrevious)
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
function reportOperationCompatibility(previous, next, context = {}) {
|
|
32
|
+
const previousToNext = check(checkOperationRelation(previous, next, context));
|
|
33
|
+
const nextToPrevious = check(checkOperationRelation(next, previous, context));
|
|
34
|
+
return {
|
|
35
|
+
previousToNext,
|
|
36
|
+
nextToPrevious,
|
|
37
|
+
status: combine(previousToNext, nextToPrevious)
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
//#endregion
|
|
42
|
+
export { reportOperationCompatibility, reportSchemaCompatibility };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { ct as SchemaNode, et as JsonValue } from "../index-
|
|
2
|
-
import { _ as validateStructuredOperationDefinition, a as validateSchemaTypeTermDefinition, b as SchemaNodeDefinitionValidationResult, c as OperationDefinitionPath, d as StructuredOperationDefinitionValidationResult, f as isStructuredOperationContainerDefinition, g as validateStructuredOperationContainerDefinition, h as validateOperationDefinition, i as validateSchemaTypeExprDefinition, l as OperationDefinitionValidationResult, m as validateOperationContainerDefinition, n as SchemaTypeExprDefinitionValidationResult, o as OperationContainerDefinitionValidationResult, p as isStructuredOperationDefinition, r as SchemaTypeTermDefinitionValidationResult, s as OperationDefinitionDiagnostic, t as SchemaTypeDefinitionDiagnostic, u as StructuredOperationContainerDefinitionValidationResult, v as SchemaNodeDefinitionDiagnostic, x as validateSchemaNodeDefinition, y as SchemaNodeDefinitionPath } from "../index-
|
|
1
|
+
import { ct as SchemaNode, et as JsonValue } from "../index-i7Au-FQ6.cjs";
|
|
2
|
+
import { _ as validateStructuredOperationDefinition, a as validateSchemaTypeTermDefinition, b as SchemaNodeDefinitionValidationResult, c as OperationDefinitionPath, d as StructuredOperationDefinitionValidationResult, f as isStructuredOperationContainerDefinition, g as validateStructuredOperationContainerDefinition, h as validateOperationDefinition, i as validateSchemaTypeExprDefinition, l as OperationDefinitionValidationResult, m as validateOperationContainerDefinition, n as SchemaTypeExprDefinitionValidationResult, o as OperationContainerDefinitionValidationResult, p as isStructuredOperationDefinition, r as SchemaTypeTermDefinitionValidationResult, s as OperationDefinitionDiagnostic, t as SchemaTypeDefinitionDiagnostic, u as StructuredOperationContainerDefinitionValidationResult, v as SchemaNodeDefinitionDiagnostic, x as validateSchemaNodeDefinition, y as SchemaNodeDefinitionPath } from "../index-DGHMUZ5m.cjs";
|
|
3
3
|
export { JsonValue, OperationContainerDefinitionValidationResult, OperationDefinitionDiagnostic, OperationDefinitionPath, OperationDefinitionValidationResult, SchemaNode, SchemaNodeDefinitionDiagnostic, SchemaNodeDefinitionPath, SchemaNodeDefinitionValidationResult, SchemaTypeDefinitionDiagnostic, SchemaTypeExprDefinitionValidationResult, SchemaTypeTermDefinitionValidationResult, StructuredOperationContainerDefinitionValidationResult, StructuredOperationDefinitionValidationResult, isStructuredOperationContainerDefinition, isStructuredOperationDefinition, validateOperationContainerDefinition, validateOperationDefinition, validateSchemaNodeDefinition, validateSchemaTypeExprDefinition, validateSchemaTypeTermDefinition, validateStructuredOperationContainerDefinition, validateStructuredOperationDefinition };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { ct as SchemaNode, et as JsonValue } from "../index-
|
|
2
|
-
import { _ as validateStructuredOperationDefinition, a as validateSchemaTypeTermDefinition, b as SchemaNodeDefinitionValidationResult, c as OperationDefinitionPath, d as StructuredOperationDefinitionValidationResult, f as isStructuredOperationContainerDefinition, g as validateStructuredOperationContainerDefinition, h as validateOperationDefinition, i as validateSchemaTypeExprDefinition, l as OperationDefinitionValidationResult, m as validateOperationContainerDefinition, n as SchemaTypeExprDefinitionValidationResult, o as OperationContainerDefinitionValidationResult, p as isStructuredOperationDefinition, r as SchemaTypeTermDefinitionValidationResult, s as OperationDefinitionDiagnostic, t as SchemaTypeDefinitionDiagnostic, u as StructuredOperationContainerDefinitionValidationResult, v as SchemaNodeDefinitionDiagnostic, x as validateSchemaNodeDefinition, y as SchemaNodeDefinitionPath } from "../index-
|
|
1
|
+
import { ct as SchemaNode, et as JsonValue } from "../index-1sDuqu05.js";
|
|
2
|
+
import { _ as validateStructuredOperationDefinition, a as validateSchemaTypeTermDefinition, b as SchemaNodeDefinitionValidationResult, c as OperationDefinitionPath, d as StructuredOperationDefinitionValidationResult, f as isStructuredOperationContainerDefinition, g as validateStructuredOperationContainerDefinition, h as validateOperationDefinition, i as validateSchemaTypeExprDefinition, l as OperationDefinitionValidationResult, m as validateOperationContainerDefinition, n as SchemaTypeExprDefinitionValidationResult, o as OperationContainerDefinitionValidationResult, p as isStructuredOperationDefinition, r as SchemaTypeTermDefinitionValidationResult, s as OperationDefinitionDiagnostic, t as SchemaTypeDefinitionDiagnostic, u as StructuredOperationContainerDefinitionValidationResult, v as SchemaNodeDefinitionDiagnostic, x as validateSchemaNodeDefinition, y as SchemaNodeDefinitionPath } from "../index-CV8EZQy8.js";
|
|
3
3
|
export { JsonValue, OperationContainerDefinitionValidationResult, OperationDefinitionDiagnostic, OperationDefinitionPath, OperationDefinitionValidationResult, SchemaNode, SchemaNodeDefinitionDiagnostic, SchemaNodeDefinitionPath, SchemaNodeDefinitionValidationResult, SchemaTypeDefinitionDiagnostic, SchemaTypeExprDefinitionValidationResult, SchemaTypeTermDefinitionValidationResult, StructuredOperationContainerDefinitionValidationResult, StructuredOperationDefinitionValidationResult, isStructuredOperationContainerDefinition, isStructuredOperationDefinition, validateOperationContainerDefinition, validateOperationDefinition, validateSchemaNodeDefinition, validateSchemaTypeExprDefinition, validateSchemaTypeTermDefinition, validateStructuredOperationContainerDefinition, validateStructuredOperationDefinition };
|
package/dist/definition/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { c as validateOperationContainerDefinition, d as validateStructuredOperationDefinition, f as validateSchemaNodeDefinition, l as validateOperationDefinition, n as validateSchemaTypeTermDefinition, o as isStructuredOperationContainerDefinition, s as isStructuredOperationDefinition, t as validateSchemaTypeExprDefinition, u as validateStructuredOperationContainerDefinition } from "../definition-
|
|
1
|
+
import { c as validateOperationContainerDefinition, d as validateStructuredOperationDefinition, f as validateSchemaNodeDefinition, l as validateOperationDefinition, n as validateSchemaTypeTermDefinition, o as isStructuredOperationContainerDefinition, s as isStructuredOperationDefinition, t as validateSchemaTypeExprDefinition, u as validateStructuredOperationContainerDefinition } from "../definition-BH_LzXGc.js";
|
|
2
2
|
|
|
3
3
|
export { isStructuredOperationContainerDefinition, isStructuredOperationDefinition, validateOperationContainerDefinition, validateOperationDefinition, validateSchemaNodeDefinition, validateSchemaTypeExprDefinition, validateSchemaTypeTermDefinition, validateStructuredOperationContainerDefinition, validateStructuredOperationDefinition };
|
|
@@ -82,6 +82,11 @@ interface SchemaSelfRefNode {
|
|
|
82
82
|
}
|
|
83
83
|
/** Closed serializable SchemaIR contract model. */
|
|
84
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
|
+
}
|
|
85
90
|
//#endregion
|
|
86
91
|
//#region src/spec/operation.d.ts
|
|
87
92
|
type OperationBinaryMetadata = {
|
|
@@ -365,4 +370,4 @@ declare const STANDARD_SEMANTIC_DEFINITIONS: ReadonlyArray<StandardSemanticDefin
|
|
|
365
370
|
declare const STANDARD_SEMANTIC_RELATIONS: ReadonlyArray<StandardSemanticRelation>;
|
|
366
371
|
declare const STANDARD_CONSTRAINT_DEFINITIONS: ReadonlyArray<StandardConstraintDefinition>;
|
|
367
372
|
//#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 _,
|
|
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 };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { L as SchemaTypeTerm, ct as SchemaNode, y as SchemaTypeExpr } from "./index-
|
|
2
|
-
import {
|
|
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
3
|
|
|
4
4
|
//#region src/type-interpreter/interpreter.d.ts
|
|
5
5
|
type TypeInterpreterPath = readonly (string | number)[];
|
|
@@ -23,30 +23,14 @@ type TypeInterpreterResult = {
|
|
|
23
23
|
readonly status: 'rejected';
|
|
24
24
|
readonly issues: readonly TypeInterpreterDiagnostic[];
|
|
25
25
|
};
|
|
26
|
-
type TypeInterpreterRefResolution = SchemaNode | {
|
|
27
|
-
readonly status: 'resolved';
|
|
28
|
-
readonly schema: SchemaNode;
|
|
29
|
-
} | {
|
|
30
|
-
readonly status: 'unknown' | 'unsupported';
|
|
31
|
-
readonly message?: string;
|
|
32
|
-
} | undefined;
|
|
33
|
-
type AsyncTypeInterpreterRefResolution = TypeInterpreterRefResolution | PromiseLike<TypeInterpreterRefResolution>;
|
|
34
26
|
interface TypeInterpreterContext {
|
|
35
27
|
readonly typeVars?: Readonly<Record<string, SchemaTypeTerm>>;
|
|
36
|
-
readonly
|
|
37
|
-
readonly maxDepth?: number;
|
|
38
|
-
readonly maxSteps?: number;
|
|
39
|
-
}
|
|
40
|
-
interface AsyncTypeInterpreterContext {
|
|
41
|
-
readonly typeVars?: Readonly<Record<string, SchemaTypeTerm>>;
|
|
42
|
-
readonly resolveRef?: (refPath: readonly string[]) => AsyncTypeInterpreterRefResolution;
|
|
28
|
+
readonly refs?: readonly SchemaRefEntry[];
|
|
43
29
|
readonly maxDepth?: number;
|
|
44
30
|
readonly maxSteps?: number;
|
|
45
31
|
}
|
|
46
32
|
declare function evaluateExpression(term: unknown, context?: TypeInterpreterContext): TypeInterpreterResult;
|
|
47
|
-
declare function evaluateExpressionAsync(term: unknown, context?: AsyncTypeInterpreterContext): Promise<TypeInterpreterResult>;
|
|
48
33
|
declare const evaluateSchemaTypeTerm: typeof evaluateExpression;
|
|
49
|
-
declare const evaluateSchemaTypeTermAsync: typeof evaluateExpressionAsync;
|
|
50
34
|
//#endregion
|
|
51
35
|
//#region src/type-interpreter/term-relation.d.ts
|
|
52
36
|
interface TypeTermRelationContext {
|
|
@@ -54,17 +38,11 @@ interface TypeTermRelationContext {
|
|
|
54
38
|
readonly relation?: RelationContext;
|
|
55
39
|
readonly hostTypeRelation?: (sourcePath: readonly string[], targetPath: readonly string[]) => HostTypeRelationDecision;
|
|
56
40
|
}
|
|
57
|
-
interface AsyncTypeTermRelationContext {
|
|
58
|
-
readonly interpreter?: AsyncTypeInterpreterContext;
|
|
59
|
-
readonly relation?: AsyncRelationContext;
|
|
60
|
-
readonly hostTypeRelation?: (sourcePath: readonly string[], targetPath: readonly string[]) => HostTypeRelationDecision | PromiseLike<HostTypeRelationDecision>;
|
|
61
|
-
}
|
|
62
41
|
type HostTypeRelationDecision = boolean | {
|
|
63
42
|
readonly status: 'assignable' | 'incompatible' | 'unknown' | 'unsupported';
|
|
64
43
|
readonly message?: string;
|
|
65
44
|
};
|
|
66
45
|
declare function checkTypeTermRelation(source: SchemaTypeTerm, target: SchemaTypeTerm, context?: TypeTermRelationContext): RelationResult;
|
|
67
|
-
declare function checkTypeTermRelationAsync(source: SchemaTypeTerm, target: SchemaTypeTerm, context?: AsyncTypeTermRelationContext): Promise<RelationResult>;
|
|
68
46
|
//#endregion
|
|
69
47
|
//#region src/type-interpreter/type-variable-solver.d.ts
|
|
70
48
|
interface TypeVariableConstraint {
|
|
@@ -90,10 +68,6 @@ interface TypeVariableSolverResult {
|
|
|
90
68
|
interface TypeVariableSolverContext extends TypeTermRelationContext {
|
|
91
69
|
readonly interpreter?: TypeInterpreterContext;
|
|
92
70
|
}
|
|
93
|
-
interface AsyncTypeVariableSolverContext extends AsyncTypeTermRelationContext {
|
|
94
|
-
readonly interpreter?: AsyncTypeInterpreterContext;
|
|
95
|
-
}
|
|
96
71
|
declare function solveTypeVariables(input: TypeVariableSolverInput, context?: TypeVariableSolverContext): TypeVariableSolverResult;
|
|
97
|
-
declare function solveTypeVariablesAsync(input: TypeVariableSolverInput, context?: AsyncTypeVariableSolverContext): Promise<TypeVariableSolverResult>;
|
|
98
72
|
//#endregion
|
|
99
|
-
export {
|
|
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 };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { G as OperationChannelDefinition, H as SchemaVariantSelector, L as SchemaTypeTerm, _t as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { G as OperationChannelDefinition, H as SchemaVariantSelector, L as SchemaTypeTerm, _t as SchemaSelfRefNode, a as StandardSemanticDefinition, at as SchemaConstraint, bt as SchemaTaggedUnionVariant, ct as SchemaNode, dt as SchemaNumberNode, ft as SchemaPrimitiveNode, gt as SchemaRefNode, i as StandardConstraintDefinition, it as SchemaBooleanNode, lt as SchemaNullNode, mt as SchemaRecordNode, ot as SchemaLiteralNode, p as SchemaFieldSelector, pt as SchemaRecordField, q as OperationDefinition, rt as SchemaArrayNode, st as SchemaLiteralUnionNode, tt as LiteralValue, ut as SchemaNullableNode, vt as SchemaStringNode, xt as SchemaTupleNode, y as SchemaTypeExpr, yt as SchemaTaggedUnionNode } from "./index-1sDuqu05.js";
|
|
2
|
+
import { s as PayloadValidationContext, t as ConstraintProvider, u as SemanticProvider } from "./index-hrcM9oJe.js";
|
|
3
|
+
import { i as RelationContext } from "./index-DxvfPmw6.js";
|
|
4
4
|
|
|
5
5
|
//#region src/standard/runtime.d.ts
|
|
6
6
|
type StandardSemanticResolution = 'standard' | 'extension' | 'unresolved';
|
|
@@ -71,13 +71,13 @@ declare function isStandardConstraintOwner(node: SchemaNode): node is StandardCo
|
|
|
71
71
|
declare function buildStandardConstraintProfile(node: StandardConstraintOwner, options?: BuildStandardConstraintProfileOptions): StandardConstraintProfile;
|
|
72
72
|
//#endregion
|
|
73
73
|
//#region src/standard/payload.d.ts
|
|
74
|
-
declare const standardSemanticProvider:
|
|
74
|
+
declare const standardSemanticProvider: SemanticProvider;
|
|
75
75
|
declare function standardConstraintTarget(node: SchemaNode): string;
|
|
76
|
-
declare const standardConstraintProvider:
|
|
77
|
-
declare const standardSemanticRegistry: Readonly<Record<string,
|
|
78
|
-
declare const standardConstraintRegistry: Readonly<Record<string,
|
|
76
|
+
declare const standardConstraintProvider: ConstraintProvider;
|
|
77
|
+
declare const standardSemanticRegistry: Readonly<Record<string, SemanticProvider>>;
|
|
78
|
+
declare const standardConstraintRegistry: Readonly<Record<string, ConstraintProvider>>;
|
|
79
79
|
/** Opt in explicitly; core validation never silently installs vocabulary policy. */
|
|
80
|
-
declare const standardPayloadContext:
|
|
80
|
+
declare const standardPayloadContext: PayloadValidationContext;
|
|
81
81
|
//#endregion
|
|
82
82
|
//#region src/standard/operations.d.ts
|
|
83
83
|
type StandardSchemaOperationResult = {
|
|
@@ -101,7 +101,7 @@ interface StandardProviderContext {
|
|
|
101
101
|
declare function createStandardRelationContext(options?: StandardProviderContext): RelationContext;
|
|
102
102
|
declare const standardRelationContext: RelationContext;
|
|
103
103
|
declare const standardVocabularyProvider: Readonly<{
|
|
104
|
-
payload:
|
|
104
|
+
payload: PayloadValidationContext;
|
|
105
105
|
relation: RelationContext;
|
|
106
106
|
refine: typeof refineStandardSchema;
|
|
107
107
|
intersect: typeof intersectStandardSchemas;
|