@telorun/analyzer 0.61.0 → 0.62.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/analyzer.d.ts.map +1 -1
- package/dist/analyzer.js +130 -9
- package/dist/builtins.d.ts.map +1 -1
- package/dist/builtins.js +69 -12
- package/dist/cel-bindings.d.ts +0 -6
- package/dist/cel-bindings.d.ts.map +1 -1
- package/dist/cel-bindings.js +3 -28
- package/dist/definition-registry.d.ts +17 -0
- package/dist/definition-registry.d.ts.map +1 -1
- package/dist/definition-registry.js +31 -2
- package/dist/identifier-name.d.ts +114 -0
- package/dist/identifier-name.d.ts.map +1 -0
- package/dist/identifier-name.js +183 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -0
- package/dist/manifest-schemas.d.ts +81 -0
- package/dist/manifest-schemas.d.ts.map +1 -1
- package/dist/manifest-schemas.js +208 -6
- package/dist/release/payload-digest.d.ts +7 -3
- package/dist/release/payload-digest.d.ts.map +1 -1
- package/dist/release/payload-digest.js +7 -3
- package/dist/requires-block.d.ts +125 -0
- package/dist/requires-block.d.ts.map +1 -0
- package/dist/requires-block.js +182 -0
- package/dist/schema-keywords.d.ts +68 -0
- package/dist/schema-keywords.d.ts.map +1 -0
- package/dist/schema-keywords.js +324 -0
- package/dist/schema-region.d.ts +12 -1
- package/dist/schema-region.d.ts.map +1 -1
- package/dist/schema-region.js +12 -1
- package/dist/telo-version.d.ts +3 -0
- package/dist/telo-version.d.ts.map +1 -0
- package/dist/telo-version.js +8 -0
- package/dist/types.d.ts +31 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/validate-identifier-names.d.ts +31 -0
- package/dist/validate-identifier-names.d.ts.map +1 -0
- package/dist/validate-identifier-names.js +144 -0
- package/dist/validate-observed-state.d.ts +9 -2
- package/dist/validate-observed-state.d.ts.map +1 -1
- package/dist/validate-observed-state.js +9 -2
- package/dist/validate-references.d.ts.map +1 -1
- package/dist/validate-references.js +5 -26
- package/dist/validate-requires.d.ts +49 -0
- package/dist/validate-requires.d.ts.map +1 -0
- package/dist/validate-requires.js +99 -0
- package/dist/value-type-keyword.d.ts +1 -1
- package/dist/value-type-keyword.d.ts.map +1 -1
- package/dist/value-type-keyword.js +1 -0
- package/dist/version-range.d.ts +88 -0
- package/dist/version-range.d.ts.map +1 -0
- package/dist/version-range.js +173 -0
- package/package.json +2 -2
- package/src/analyzer.ts +146 -10
- package/src/builtins.ts +73 -12
- package/src/cel-bindings.ts +3 -28
- package/src/definition-registry.ts +30 -2
- package/src/identifier-name.ts +228 -0
- package/src/index.ts +34 -0
- package/src/manifest-schemas.ts +223 -4
- package/src/release/payload-digest.ts +7 -3
- package/src/requires-block.ts +253 -0
- package/src/schema-keywords.ts +359 -0
- package/src/schema-region.ts +12 -1
- package/src/telo-version.ts +9 -0
- package/src/types.ts +32 -0
- package/src/validate-identifier-names.ts +173 -0
- package/src/validate-observed-state.ts +9 -2
- package/src/validate-references.ts +5 -26
- package/src/validate-requires.ts +129 -0
- package/src/value-type-keyword.ts +1 -0
- package/src/version-range.ts +238 -0
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Naming rules for every author-written Telo identifier — resource instances,
|
|
3
|
+
* kinds, modules, import aliases, step names, config declarations and CEL
|
|
4
|
+
* bindings. The single reader, so no surface re-derives the vocabulary; the
|
|
5
|
+
* `ref-slot.ts` / `zone-slot.ts` precedent.
|
|
6
|
+
*
|
|
7
|
+
* **The rules exist because Telo has no lexer.** A name is a YAML scalar, so
|
|
8
|
+
* nothing rejects its shape where it is declared, and every consequence
|
|
9
|
+
* surfaces later at a CEL site that references it — or not at all. Probed
|
|
10
|
+
* against the engine the runtime actually uses (`@marcbachmann/cel-js`):
|
|
11
|
+
*
|
|
12
|
+
* resources.my-server.url → EVALUATES, as `resources.my - server.url`
|
|
13
|
+
* resources.in → ParseError: Expected IDENTIFIER, got IN
|
|
14
|
+
* resources.2fa → ParseError
|
|
15
|
+
* resources.for → parses fine
|
|
16
|
+
*
|
|
17
|
+
* The first line is the one that decides the design. When a bare name is in
|
|
18
|
+
* scope — which `x-telo-bindings-from` deliberately makes possible — a
|
|
19
|
+
* hyphenated resource name yields a wrong number with no diagnostic anywhere.
|
|
20
|
+
* That is a swallowed error in the reference grammar, not a style preference.
|
|
21
|
+
* The last line is why the reserved set here is the whole keyword list rather
|
|
22
|
+
* than the subset today's parser happens to reject in field position: which
|
|
23
|
+
* keywords tokenize there is a property of a dependency, and a name that
|
|
24
|
+
* breaks on a parser upgrade was never safe.
|
|
25
|
+
*
|
|
26
|
+
* **Three tiers, because they fail in three different ways.**
|
|
27
|
+
*
|
|
28
|
+
* 1. `INVALID_NAME` (error, every surface) — not a CEL-safe identifier, or a
|
|
29
|
+
* CEL keyword. Below this line the name is unreferenceable or silently
|
|
30
|
+
* mis-referenced. This subsumes the old dot-only rule, which was the
|
|
31
|
+
* strictest special case of it: `!ref` splits on the first dot.
|
|
32
|
+
*
|
|
33
|
+
* 2. `INVALID_TYPE_NAME` (error) — a type-level name not starting uppercase.
|
|
34
|
+
* An error rather than a warning because half the reference grammar already
|
|
35
|
+
* rejects the alternative: `EXTENDS_ALIAS_PATTERN` in the kernel's manifest
|
|
36
|
+
* schema hard-rejects `extends: foo.Bar`, while nothing rejects the
|
|
37
|
+
* `metadata.name: foo` that produced it. A lowercase kind is a kind nobody
|
|
38
|
+
* can extend, so this only moves an existing failure to where it is
|
|
39
|
+
* fixable.
|
|
40
|
+
*
|
|
41
|
+
* 3. `NAME_CASE_CONVENTION` (warning) — a value-level name not starting
|
|
42
|
+
* lowercase. Warn-only, Rust's `non_snake_case` posture: a name is
|
|
43
|
+
* occasionally dictated from outside, and Telo has no `#[allow]`, so a hard
|
|
44
|
+
* error would leave no escape.
|
|
45
|
+
*
|
|
46
|
+
* **The convention: case encodes what the name denotes.** PascalCase names a
|
|
47
|
+
* *type* — something writable in `kind:` / `extends:` / an `x-telo-ref` or type
|
|
48
|
+
* slot. camelCase names a *value* — something holding data at runtime, read
|
|
49
|
+
* through `resources.` / `steps.` / `variables.` in CEL. That is what
|
|
50
|
+
* distinguishes `kind: Console.WriteLine` from `!ref Console.writeLine`, two
|
|
51
|
+
* character-identical grammars otherwise, and the collision is not
|
|
52
|
+
* hypothetical: it is the sanctioned singleton pattern (declare
|
|
53
|
+
* `kind: Self.WriteLine`, export the instance, withhold the kind).
|
|
54
|
+
*
|
|
55
|
+
* **Only the first character is checked.** A full camelCase pattern would
|
|
56
|
+
* relitigate `httpApi` vs `httpAPI` and `OAuthClient` vs `OauthClient` with no
|
|
57
|
+
* benefit — the first character is what carries the type/value signal, and a
|
|
58
|
+
* stricter rule would fight legitimate names containing acronyms or digits
|
|
59
|
+
* while owning a judgement nobody asked this pass to make. An
|
|
60
|
+
* entirely-acronym type name (`SQL`, `AI`) passes unchanged.
|
|
61
|
+
*
|
|
62
|
+
* **No `DiagnosticFix`.** A fix is a whole-value replacement for ONE node,
|
|
63
|
+
* and a rename is only correct when every reference moves with it — offering
|
|
64
|
+
* one here would rewrite `metadata.name` and break every `!ref` and CEL read
|
|
65
|
+
* of it. Renaming belongs to a refactor that owns the reference graph.
|
|
66
|
+
*
|
|
67
|
+
* Browser-safe: pure string predicates, no I/O, no Node built-ins.
|
|
68
|
+
*/
|
|
69
|
+
import { DiagnosticSeverity } from "./types.js";
|
|
70
|
+
/**
|
|
71
|
+
* CEL keywords. A name matching one is unreachable — `true` lexes as a
|
|
72
|
+
* literal, `in` as an operator — so it is reserved everywhere a name becomes a
|
|
73
|
+
* CEL identifier, which is every surface this file governs.
|
|
74
|
+
*/
|
|
75
|
+
export const CEL_RESERVED_WORDS = [
|
|
76
|
+
"as",
|
|
77
|
+
"break",
|
|
78
|
+
"const",
|
|
79
|
+
"continue",
|
|
80
|
+
"else",
|
|
81
|
+
"false",
|
|
82
|
+
"for",
|
|
83
|
+
"function",
|
|
84
|
+
"if",
|
|
85
|
+
"import",
|
|
86
|
+
"in",
|
|
87
|
+
"let",
|
|
88
|
+
"loop",
|
|
89
|
+
"namespace",
|
|
90
|
+
"null",
|
|
91
|
+
"package",
|
|
92
|
+
"return",
|
|
93
|
+
"true",
|
|
94
|
+
"var",
|
|
95
|
+
"void",
|
|
96
|
+
"while",
|
|
97
|
+
];
|
|
98
|
+
const RESERVED = new Set(CEL_RESERVED_WORDS);
|
|
99
|
+
/** What a CEL identifier may be — and therefore what a name that will be read
|
|
100
|
+
* through `resources.` / `steps.` / `variables.` must be. */
|
|
101
|
+
const CEL_IDENTIFIER_RE = /^[A-Za-z_][A-Za-z0-9_]*$/;
|
|
102
|
+
/** Document kinds whose `metadata.name` is type-level. Everything else
|
|
103
|
+
* declaring a name is a resource instance, whose level is decided by its
|
|
104
|
+
* kind's capability (see {@link NameLevel}). */
|
|
105
|
+
export const TYPE_LEVEL_DOC_KINDS = new Set([
|
|
106
|
+
"Telo.Application",
|
|
107
|
+
"Telo.Library",
|
|
108
|
+
"Telo.Definition",
|
|
109
|
+
"Telo.Abstract",
|
|
110
|
+
"Telo.Import",
|
|
111
|
+
]);
|
|
112
|
+
/**
|
|
113
|
+
* Check one author-written name.
|
|
114
|
+
*
|
|
115
|
+
* `surface` is the noun phrase naming what was declared ("resource name",
|
|
116
|
+
* "step name", "import alias"), used as the message's subject.
|
|
117
|
+
*
|
|
118
|
+
* Returns the first violation only: the tiers are ordered by how badly the
|
|
119
|
+
* name is broken, and telling an author their unparseable name is also
|
|
120
|
+
* miscased buries the part that matters.
|
|
121
|
+
*/
|
|
122
|
+
export function checkName(name, level, surface) {
|
|
123
|
+
const subject = `${surface} '${name}'`;
|
|
124
|
+
if (!CEL_IDENTIFIER_RE.test(name)) {
|
|
125
|
+
return {
|
|
126
|
+
tier: "grammar",
|
|
127
|
+
code: "INVALID_NAME",
|
|
128
|
+
severity: DiagnosticSeverity.Error,
|
|
129
|
+
message: `${subject} must match /^[A-Za-z_][A-Za-z0-9_]*$/ — ${grammarReason(name, level)}`,
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
if (RESERVED.has(name)) {
|
|
133
|
+
return {
|
|
134
|
+
tier: "reserved",
|
|
135
|
+
code: "INVALID_NAME",
|
|
136
|
+
severity: DiagnosticSeverity.Error,
|
|
137
|
+
message: `${subject} is a CEL keyword, so no expression can reference it. Rename it.`,
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
const first = name[0];
|
|
141
|
+
if (level === "type" && !(first >= "A" && first <= "Z")) {
|
|
142
|
+
return {
|
|
143
|
+
tier: "case",
|
|
144
|
+
code: "INVALID_TYPE_NAME",
|
|
145
|
+
severity: DiagnosticSeverity.Error,
|
|
146
|
+
message: `${subject} must start with an uppercase letter — it names a type, and the ` +
|
|
147
|
+
`alias-qualified grammar of 'kind:' / 'extends:' accepts only PascalCase.`,
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
if (level === "value" && !(first >= "a" && first <= "z")) {
|
|
151
|
+
return {
|
|
152
|
+
tier: "case",
|
|
153
|
+
code: "NAME_CASE_CONVENTION",
|
|
154
|
+
severity: DiagnosticSeverity.Warning,
|
|
155
|
+
message: `${subject} should start with a lowercase letter — camelCase names a value (read ` +
|
|
156
|
+
`through a CEL scope), PascalCase names a type.`,
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
return undefined;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Why the character set is what it is — which differs by level, and saying so
|
|
163
|
+
* accurately matters more than one shared sentence. A value-level name becomes
|
|
164
|
+
* a CEL identifier. A type-level name never does: it is a kind prefix or
|
|
165
|
+
* suffix, so what constrains it is the alias-qualified `<Alias>.<Kind>` grammar
|
|
166
|
+
* (`EXTENDS_ALIAS_PATTERN` in the kernel's manifest schema), which accepts the
|
|
167
|
+
* same characters for its own reasons.
|
|
168
|
+
*/
|
|
169
|
+
function grammarReason(name, level) {
|
|
170
|
+
if (level === "type") {
|
|
171
|
+
return name.includes(".")
|
|
172
|
+
? `a '.' separates the two halves of every '<Alias>.<Kind>' reference, so a dotted name cannot appear in either.`
|
|
173
|
+
: `that is the character set the alias-qualified '<Alias>.<Kind>' grammar accepts on both sides.`;
|
|
174
|
+
}
|
|
175
|
+
if (name.includes("-")) {
|
|
176
|
+
return (`it becomes a CEL identifier and CEL reads '-' as subtraction, so where a bare name is in ` +
|
|
177
|
+
`scope this evaluates as arithmetic instead of failing.`);
|
|
178
|
+
}
|
|
179
|
+
if (name.includes(".")) {
|
|
180
|
+
return `in a '!ref' the first '.' separates the import alias from the name.`;
|
|
181
|
+
}
|
|
182
|
+
return `it becomes a CEL identifier, so as written it cannot be referenced.`;
|
|
183
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -7,6 +7,8 @@ export { collectZoneModuleDocuments, flattenForAnalyzer, flattenLoadedModule, fo
|
|
|
7
7
|
export { buildEvalPaths, evalPathCovers } from "./eval-paths.js";
|
|
8
8
|
export { BINDINGS_ANNOTATION, bindingContextProperties, bindingDependencies, findBindingSites, resolveBindingOrder, } from "./cel-bindings.js";
|
|
9
9
|
export type { BindingSites } from "./cel-bindings.js";
|
|
10
|
+
export { CEL_RESERVED_WORDS, TYPE_LEVEL_DOC_KINDS, checkName, } from "./identifier-name.js";
|
|
11
|
+
export type { NameLevel, NameViolation } from "./identifier-name.js";
|
|
10
12
|
export { applyObservedStateNode, buildObservedStateIndex, buildObservedStateResourcesSchema, collectRunReachableNames, observedStateRead, validateObservedStateDeclarations, OBSERVED_STATE_SCHEMA, } from "./validate-observed-state.js";
|
|
11
13
|
export type { AnalyzedResource, ObservedStateRead } from "./validate-observed-state.js";
|
|
12
14
|
export { moduleScopedDefResolver, scopeResolverForModule } from "./alias-resolver.js";
|
|
@@ -26,6 +28,13 @@ export type { RefSlot, RefUse, RefUseCases } from "./ref-slot.js";
|
|
|
26
28
|
export { ANNOTATION_KEYWORDS, registerTeloKeywords, valueTypeKeyword, } from "./value-type-keyword.js";
|
|
27
29
|
export { applyTextEdits, isPlainSafe, quoteStyleOf, renderFixReplacement, } from "./yaml-source-edit.js";
|
|
28
30
|
export type { QuoteStyle, TextEdit } from "./yaml-source-edit.js";
|
|
31
|
+
export { KNOWN_HOST_AXES, evaluateRequires, readRequires } from "./requires-block.js";
|
|
32
|
+
export type { HostAxis, HostVersions, ReadRequiresResult, RequiresBlock, RequiresIssue, RequiresVerdict, } from "./requires-block.js";
|
|
33
|
+
export { TELO_SURFACE_VERSION } from "./telo-version.js";
|
|
34
|
+
export { validateRequires } from "./validate-requires.js";
|
|
35
|
+
export type { ValidateRequiresOptions } from "./validate-requires.js";
|
|
36
|
+
export { isUnsatisfiable, lowerBound, parseVersionRange, rangeAccepts, upperBound, } from "./version-range.js";
|
|
37
|
+
export type { ComparatorOperator, VersionComparator, VersionRange, VersionRangeResult, } from "./version-range.js";
|
|
29
38
|
export { hasProvidesZone, hasRequiresZone, readProvidesZone, readRequiresZone, rewriteRequiresZoneKind, } from "./zone-slot.js";
|
|
30
39
|
export type { ProvidesZoneSlot, RequiresZoneSlot } from "./zone-slot.js";
|
|
31
40
|
export { deriveLibraryExportRequirements, projectZoneRequirements, runZoneAnalysis, zoneDocumentsSignature, } from "./resolve-zone-requirements.js";
|
|
@@ -88,6 +97,7 @@ export type { CelNode, CelSegment } from "./cel-ast.js";
|
|
|
88
97
|
export { DEFAULT_MANIFEST_FILENAME, DiagnosticSeverity, diagnosticFix } from "./types.js";
|
|
89
98
|
export type { AnalysisDiagnostic, AnalysisOptions, DiagnosticData, DiagnosticFix, LoaderInitOptions, LoadOptions, ManifestSource, Position, PositionIndex, Range } from "./types.js";
|
|
90
99
|
export * from "./manifest-schemas.js";
|
|
100
|
+
export * from "./schema-keywords.js";
|
|
91
101
|
export { DERIVED_METADATA_FIELDS, authoredModuleMetadata, } from "./module-metadata-scope.js";
|
|
92
102
|
export * from "./release/index.js";
|
|
93
103
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":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{ collectZoneModuleDocuments, flattenForAnalyzer, flattenLoadedModule, forwardReExportManifests, parseExportEntry, reExportSpecsFromExports, resolveExportedKinds, selectModuleManifestsForAnalysis, stampExportedKinds, stampReExportedKinds, } from "./flatten-for-analyzer.js";
|
|
5
5
|
export { buildEvalPaths, evalPathCovers } from "./eval-paths.js";
|
|
6
6
|
export { BINDINGS_ANNOTATION, bindingContextProperties, bindingDependencies, findBindingSites, resolveBindingOrder, } from "./cel-bindings.js";
|
|
7
|
+
export { CEL_RESERVED_WORDS, TYPE_LEVEL_DOC_KINDS, checkName, } from "./identifier-name.js";
|
|
7
8
|
export { applyObservedStateNode, buildObservedStateIndex, buildObservedStateResourcesSchema, collectRunReachableNames, observedStateRead, validateObservedStateDeclarations, OBSERVED_STATE_SCHEMA, } from "./validate-observed-state.js";
|
|
8
9
|
export { moduleScopedDefResolver, scopeResolverForModule } from "./alias-resolver.js";
|
|
9
10
|
export { ancestorChain, contractDeclarer, controllerBearingAncestor, effectiveAuthorSchema, effectiveContractField, effectiveStatusSchema, hasOwnControllerOrTemplate, inheritedCapability, isInheritedDelegation, mappingFieldFor, needsContractMapping, resolveParent, } from "./extends-resolution.js";
|
|
@@ -14,6 +15,10 @@ export { buildReferenceFieldMap, isRefEntry, isScopeEntry } from "./reference-fi
|
|
|
14
15
|
export { hasDeclaredUse, isRefSlot, isRefUse, possibleUses, readRefSlot, REF_USES, refSlotAnnotation, rewriteRefSlotKinds, transfersControl, } from "./ref-slot.js";
|
|
15
16
|
export { ANNOTATION_KEYWORDS, registerTeloKeywords, valueTypeKeyword, } from "./value-type-keyword.js";
|
|
16
17
|
export { applyTextEdits, isPlainSafe, quoteStyleOf, renderFixReplacement, } from "./yaml-source-edit.js";
|
|
18
|
+
export { KNOWN_HOST_AXES, evaluateRequires, readRequires } from "./requires-block.js";
|
|
19
|
+
export { TELO_SURFACE_VERSION } from "./telo-version.js";
|
|
20
|
+
export { validateRequires } from "./validate-requires.js";
|
|
21
|
+
export { isUnsatisfiable, lowerBound, parseVersionRange, rangeAccepts, upperBound, } from "./version-range.js";
|
|
17
22
|
export { hasProvidesZone, hasRequiresZone, readProvidesZone, readRequiresZone, rewriteRequiresZoneKind, } from "./zone-slot.js";
|
|
18
23
|
export { deriveLibraryExportRequirements, projectZoneRequirements, runZoneAnalysis, zoneDocumentsSignature, } from "./resolve-zone-requirements.js";
|
|
19
24
|
export { validateZoneSlotDeclarations } from "./validate-zone-slots.js";
|
|
@@ -53,6 +58,9 @@ export { documentToAst, parseToAst } from "./yaml-ast.js";
|
|
|
53
58
|
export { CelParseError, buildCelSegments, wrapCelAst } from "./cel-ast.js";
|
|
54
59
|
export { DEFAULT_MANIFEST_FILENAME, DiagnosticSeverity, diagnosticFix } from "./types.js";
|
|
55
60
|
export * from "./manifest-schemas.js";
|
|
61
|
+
// The JSON Schema vocabulary a manifest may write, as data — the source both the
|
|
62
|
+
// validating fragments and the IDE's completion are built from.
|
|
63
|
+
export * from "./schema-keywords.js";
|
|
56
64
|
// The release model — module identity, fragments, the ledger, the edge graph and
|
|
57
65
|
// version planning. Pure data in, plan out, so the editor and the CLI release
|
|
58
66
|
// from one model.
|
|
@@ -236,6 +236,64 @@ export declare const InvokeStepSchema: {
|
|
|
236
236
|
};
|
|
237
237
|
};
|
|
238
238
|
};
|
|
239
|
+
/**
|
|
240
|
+
* A JSON Schema an author writes as a manifest VALUE — an `inputType:`, an
|
|
241
|
+
* `outputType:`, a `status:` block, an API route's `request.schema`.
|
|
242
|
+
*
|
|
243
|
+
* Declared so the surfaces that read a slot's schema learn what lives there. A
|
|
244
|
+
* slot spelled `type: object` told them "some object": completion offered
|
|
245
|
+
* nothing from the first key down, hover had nothing to show, and a misspelled
|
|
246
|
+
* keyword travelled to a runtime failure that named the wrong field.
|
|
247
|
+
*
|
|
248
|
+
* OPEN, deliberately (`additionalProperties: true`, `type` admitting the
|
|
249
|
+
* boolean form a nested `additionalProperties: false` takes). The keyword set
|
|
250
|
+
* below is draft-07's — the dialect AJV actually runs — and everything outside
|
|
251
|
+
* it, every `x-telo-*` annotation included, passes through untouched. Closing
|
|
252
|
+
* this would reject the next annotation the moment a module invented one, for a
|
|
253
|
+
* check nobody asked for; what it buys as it stands is the value of a keyword
|
|
254
|
+
* an author DID write (`required: "name"`, `type: 5`) being wrong at
|
|
255
|
+
* `telo check` rather than at dispatch.
|
|
256
|
+
*
|
|
257
|
+
* RECURSIVE, which is why it is not expanded in place like the fragments above
|
|
258
|
+
* it: a schema's properties hold schemas. `expandManifestFragments` rewrites a
|
|
259
|
+
* reference to this to the document-local `#/$defs/JsonSchema7` and hoists one
|
|
260
|
+
* copy to the enclosing schema's root, so the pointer resolves inside whatever
|
|
261
|
+
* AJV compiles, and the editor's local-only `$ref` resolver keeps working.
|
|
262
|
+
*/
|
|
263
|
+
export declare const JsonSchema7Schema: {
|
|
264
|
+
title: string;
|
|
265
|
+
description: string;
|
|
266
|
+
type: string[];
|
|
267
|
+
properties: import("./schema-keywords.js").SchemaKeywords;
|
|
268
|
+
additionalProperties: boolean;
|
|
269
|
+
};
|
|
270
|
+
/**
|
|
271
|
+
* The schema a KIND declares for its own configuration — a `Telo.Definition`'s
|
|
272
|
+
* `schema:` block.
|
|
273
|
+
*
|
|
274
|
+
* The same body as {@link JsonSchema7Schema}, under its own name because the
|
|
275
|
+
* name is the discriminator: a kind's schema is where the `x-telo-*` vocabulary
|
|
276
|
+
* belongs (`x-telo-eval`, `x-telo-ref`, `x-telo-scope`, …) and a plain data
|
|
277
|
+
* schema is where it does not. Completion reads the `x-telo-fragment` stamp to
|
|
278
|
+
* decide which vocabulary to offer, exactly as a retry-budget consumer reads
|
|
279
|
+
* which of `RetryPolicy` / `RetryAttempts` a slot pointed at.
|
|
280
|
+
*
|
|
281
|
+
* The annotations are NOT properties here — see `schema-keywords.ts` for why a
|
|
282
|
+
* literal `x-telo-*` key inside a hoisted `properties` map would read to the
|
|
283
|
+
* annotation walkers as a slot the author never wrote.
|
|
284
|
+
*/
|
|
285
|
+
export declare const KindSchemaSchema: {
|
|
286
|
+
title: string;
|
|
287
|
+
description: string;
|
|
288
|
+
type: string[];
|
|
289
|
+
properties: import("./schema-keywords.js").SchemaKeywords;
|
|
290
|
+
additionalProperties: boolean;
|
|
291
|
+
};
|
|
292
|
+
/** True when a slot's `x-telo-fragment` stamp says it holds author-written JSON
|
|
293
|
+
* Schema — a kind's `schema:`, a `status:` block, a `Telo.JsonSchema`'s own
|
|
294
|
+
* `schema`. The one accessor every consumer asks, so no surface re-spells the
|
|
295
|
+
* set. */
|
|
296
|
+
export declare function isSchemaFragment(name: string | undefined): boolean;
|
|
239
297
|
/** Root schema registered with AJV under {@link MANIFEST_SCHEMA_URI}. Carries
|
|
240
298
|
* `$defs` only — it isn't validated against directly. */
|
|
241
299
|
export declare const ManifestRootSchema: {
|
|
@@ -371,6 +429,20 @@ export declare const ManifestRootSchema: {
|
|
|
371
429
|
};
|
|
372
430
|
};
|
|
373
431
|
};
|
|
432
|
+
JsonSchema7: {
|
|
433
|
+
title: string;
|
|
434
|
+
description: string;
|
|
435
|
+
type: string[];
|
|
436
|
+
properties: import("./schema-keywords.js").SchemaKeywords;
|
|
437
|
+
additionalProperties: boolean;
|
|
438
|
+
};
|
|
439
|
+
KindSchema: {
|
|
440
|
+
title: string;
|
|
441
|
+
description: string;
|
|
442
|
+
type: string[];
|
|
443
|
+
properties: import("./schema-keywords.js").SchemaKeywords;
|
|
444
|
+
additionalProperties: boolean;
|
|
445
|
+
};
|
|
374
446
|
};
|
|
375
447
|
};
|
|
376
448
|
/** A private, expanded copy of a fragment, for a consumer that must EMBED one
|
|
@@ -398,6 +470,15 @@ export declare function manifestFragment(name: string): Record<string, unknown>;
|
|
|
398
470
|
* loaded manifest see the same expanded shape.
|
|
399
471
|
*/
|
|
400
472
|
export declare function expandManifestFragments(node: unknown, seen?: Set<object>): void;
|
|
473
|
+
/**
|
|
474
|
+
* Expand fragments in a schema that never passes through the loader —
|
|
475
|
+
* `builtins.ts` is not a manifest, so its slots have to arrive already
|
|
476
|
+
* localized, with the hoisted `$defs` at the root of the schema AJV compiles.
|
|
477
|
+
*
|
|
478
|
+
* Returns the same object, expanded in place, for use as a declaration
|
|
479
|
+
* initializer.
|
|
480
|
+
*/
|
|
481
|
+
export declare function withSchemaFragments<T extends Record<string, unknown>>(schema: T): T;
|
|
401
482
|
/** Stamped by {@link expandManifestFragments} with the name of the shared
|
|
402
483
|
* fragment a slot pointed at. Derived, never author-written. */
|
|
403
484
|
export declare const X_TELO_FRAGMENT = "x-telo-fragment";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"manifest-schemas.d.ts","sourceRoot":"","sources":["../src/manifest-schemas.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;
|
|
1
|
+
{"version":3,"file":"manifest-schemas.d.ts","sourceRoot":"","sources":["../src/manifest-schemas.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAKH,eAAO,MAAM,mBAAmB,oBAAoB,CAAC;AAErD,sEAAsE;AACtE,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAExD;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;yEA8ByE;AACzE,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoB7B,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwD7B,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,mBAAmB;;;;;;CAM/B,CAAC;AAEF;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8C5B,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,iBAAiB;;;;;;CAM7B,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,gBAAgB;;;;;;CAO5B,CAAC;AAUF;;;WAGW;AACX,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAElE;AAiCD;0DAC0D;AAC1D,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAU9B,CAAC;AAIF;;;0EAG0E;AAC1E,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAmBtE;AAID;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,cAAoB,GAAG,IAAI,CAGrF;AA0HD;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC,GAAG,CAAC,CAGnF;AA+DD;iEACiE;AACjE,eAAO,MAAM,eAAe,oBAAoB,CAAC;AAEjD;uDACuD;AACvD,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAItE"}
|
package/dist/manifest-schemas.js
CHANGED
|
@@ -27,6 +27,8 @@
|
|
|
27
27
|
* Adding a fragment means putting it under `$defs` in {@link ManifestRootSchema}
|
|
28
28
|
* and `$ref`-ing it from module schemas. Browser-safe: no Node built-ins.
|
|
29
29
|
*/
|
|
30
|
+
import { jsonSchemaKeywords } from "./schema-keywords.js";
|
|
31
|
+
import { SCHEMA_REGION_KEYS } from "./schema-region.js";
|
|
30
32
|
export const MANIFEST_SCHEMA_URI = "telo://manifest";
|
|
31
33
|
/** `$ref` to a fragment in this set, as a module schema writes it. */
|
|
32
34
|
export function manifestFragmentRef(name) {
|
|
@@ -236,6 +238,88 @@ export const InvokeStepSchema = {
|
|
|
236
238
|
},
|
|
237
239
|
},
|
|
238
240
|
};
|
|
241
|
+
/**
|
|
242
|
+
* A JSON Schema an author writes as a manifest VALUE — an `inputType:`, an
|
|
243
|
+
* `outputType:`, a `status:` block, an API route's `request.schema`.
|
|
244
|
+
*
|
|
245
|
+
* Declared so the surfaces that read a slot's schema learn what lives there. A
|
|
246
|
+
* slot spelled `type: object` told them "some object": completion offered
|
|
247
|
+
* nothing from the first key down, hover had nothing to show, and a misspelled
|
|
248
|
+
* keyword travelled to a runtime failure that named the wrong field.
|
|
249
|
+
*
|
|
250
|
+
* OPEN, deliberately (`additionalProperties: true`, `type` admitting the
|
|
251
|
+
* boolean form a nested `additionalProperties: false` takes). The keyword set
|
|
252
|
+
* below is draft-07's — the dialect AJV actually runs — and everything outside
|
|
253
|
+
* it, every `x-telo-*` annotation included, passes through untouched. Closing
|
|
254
|
+
* this would reject the next annotation the moment a module invented one, for a
|
|
255
|
+
* check nobody asked for; what it buys as it stands is the value of a keyword
|
|
256
|
+
* an author DID write (`required: "name"`, `type: 5`) being wrong at
|
|
257
|
+
* `telo check` rather than at dispatch.
|
|
258
|
+
*
|
|
259
|
+
* RECURSIVE, which is why it is not expanded in place like the fragments above
|
|
260
|
+
* it: a schema's properties hold schemas. `expandManifestFragments` rewrites a
|
|
261
|
+
* reference to this to the document-local `#/$defs/JsonSchema7` and hoists one
|
|
262
|
+
* copy to the enclosing schema's root, so the pointer resolves inside whatever
|
|
263
|
+
* AJV compiles, and the editor's local-only `$ref` resolver keeps working.
|
|
264
|
+
*/
|
|
265
|
+
export const JsonSchema7Schema = {
|
|
266
|
+
title: "JSON Schema",
|
|
267
|
+
description: "The shape of a value, as JSON Schema (draft-07).",
|
|
268
|
+
type: ["object", "boolean"],
|
|
269
|
+
properties: jsonSchemaKeywords(hoistedDefKey("JsonSchema7")),
|
|
270
|
+
additionalProperties: true,
|
|
271
|
+
};
|
|
272
|
+
/**
|
|
273
|
+
* The schema a KIND declares for its own configuration — a `Telo.Definition`'s
|
|
274
|
+
* `schema:` block.
|
|
275
|
+
*
|
|
276
|
+
* The same body as {@link JsonSchema7Schema}, under its own name because the
|
|
277
|
+
* name is the discriminator: a kind's schema is where the `x-telo-*` vocabulary
|
|
278
|
+
* belongs (`x-telo-eval`, `x-telo-ref`, `x-telo-scope`, …) and a plain data
|
|
279
|
+
* schema is where it does not. Completion reads the `x-telo-fragment` stamp to
|
|
280
|
+
* decide which vocabulary to offer, exactly as a retry-budget consumer reads
|
|
281
|
+
* which of `RetryPolicy` / `RetryAttempts` a slot pointed at.
|
|
282
|
+
*
|
|
283
|
+
* The annotations are NOT properties here — see `schema-keywords.ts` for why a
|
|
284
|
+
* literal `x-telo-*` key inside a hoisted `properties` map would read to the
|
|
285
|
+
* annotation walkers as a slot the author never wrote.
|
|
286
|
+
*/
|
|
287
|
+
export const KindSchemaSchema = {
|
|
288
|
+
title: "Kind schema",
|
|
289
|
+
description: "The configuration a resource of this kind accepts, as JSON Schema plus the `x-telo-*` annotations that say how each field behaves.",
|
|
290
|
+
type: ["object", "boolean"],
|
|
291
|
+
properties: jsonSchemaKeywords(hoistedDefKey("KindSchema")),
|
|
292
|
+
additionalProperties: true,
|
|
293
|
+
};
|
|
294
|
+
/** The fragments that describe author-written JSON Schema, whichever vocabulary
|
|
295
|
+
* they admit. They are also exactly the RECURSIVE ones — a schema is the only
|
|
296
|
+
* shape in this set that contains itself — so a reference to one is localized
|
|
297
|
+
* and hoisted rather than expanded in place ({@link localizeRecursiveFragment});
|
|
298
|
+
* should a self-containing fragment that is not a schema ever land, the two
|
|
299
|
+
* ideas split and this set stays the one about schemas. */
|
|
300
|
+
const SCHEMA_FRAGMENTS = new Set(["JsonSchema7", "KindSchema"]);
|
|
301
|
+
/** True when a slot's `x-telo-fragment` stamp says it holds author-written JSON
|
|
302
|
+
* Schema — a kind's `schema:`, a `status:` block, a `Telo.JsonSchema`'s own
|
|
303
|
+
* `schema`. The one accessor every consumer asks, so no surface re-spells the
|
|
304
|
+
* set. */
|
|
305
|
+
export function isSchemaFragment(name) {
|
|
306
|
+
return name !== undefined && SCHEMA_FRAGMENTS.has(name);
|
|
307
|
+
}
|
|
308
|
+
/**
|
|
309
|
+
* The `$defs` key a hoisted fragment is written under, and the one its own
|
|
310
|
+
* self-reference points at.
|
|
311
|
+
*
|
|
312
|
+
* NAMESPACED so a collision is unrepresentable rather than diagnosable: `$defs`
|
|
313
|
+
* is the author's namespace, and a kind declaring its own `$defs: { KindSchema:
|
|
314
|
+
* … }` beside a slot pointing at the fragment would otherwise have its shape
|
|
315
|
+
* silently validate every such slot — a wrong-but-plausible validation, which is
|
|
316
|
+
* worse than a loud failure and impossible to see. With a reserved key the two
|
|
317
|
+
* coexist, and "already present" can only mean a previous hoist of the same
|
|
318
|
+
* fragment, which is what makes {@link hoistFragmentDef}'s skip provably safe.
|
|
319
|
+
*/
|
|
320
|
+
function hoistedDefKey(name) {
|
|
321
|
+
return `telo:${name}`;
|
|
322
|
+
}
|
|
239
323
|
/** Recursively freeze, so the fragment set cannot be edited through any of the
|
|
240
324
|
* references handed out. `fragmentFor` clones precisely because downstream
|
|
241
325
|
* passes rewrite schemas in place — `resolveSchemaRefKinds` rewrites the very
|
|
@@ -260,6 +344,8 @@ export const ManifestRootSchema = {
|
|
|
260
344
|
RetryPolicy: RetryPolicySchema,
|
|
261
345
|
RetryAttempts: RetryAttemptsSchema,
|
|
262
346
|
InvokeStep: InvokeStepSchema,
|
|
347
|
+
JsonSchema7: JsonSchema7Schema,
|
|
348
|
+
KindSchema: KindSchemaSchema,
|
|
263
349
|
},
|
|
264
350
|
};
|
|
265
351
|
deepFreeze(ManifestRootSchema);
|
|
@@ -272,6 +358,14 @@ export function manifestFragment(name) {
|
|
|
272
358
|
if (!fragment || typeof fragment !== "object") {
|
|
273
359
|
throw new Error(`Unknown manifest fragment '${name}'`);
|
|
274
360
|
}
|
|
361
|
+
if (SCHEMA_FRAGMENTS.has(name)) {
|
|
362
|
+
// A recursive fragment has no expanded form — that is the whole reason it is
|
|
363
|
+
// localized instead. Embedding one would hand the consumer a body whose
|
|
364
|
+
// `#/$defs` pointers resolve against nothing.
|
|
365
|
+
throw new Error(`Manifest fragment '${name}' is recursive and cannot be embedded — ` +
|
|
366
|
+
`point a slot at it with $ref: "${manifestFragmentRef(name)}" and pass the ` +
|
|
367
|
+
`enclosing schema through withSchemaFragments().`);
|
|
368
|
+
}
|
|
275
369
|
const copy = structuredClone(fragment);
|
|
276
370
|
expandManifestFragments(copy);
|
|
277
371
|
copy[X_TELO_FRAGMENT] = name;
|
|
@@ -298,6 +392,26 @@ const FRAGMENT_PREFIX = `${MANIFEST_SCHEMA_URI}#/$defs/`;
|
|
|
298
392
|
* loaded manifest see the same expanded shape.
|
|
299
393
|
*/
|
|
300
394
|
export function expandManifestFragments(node, seen = new Set()) {
|
|
395
|
+
if (!node || typeof node !== "object")
|
|
396
|
+
return;
|
|
397
|
+
walkFragments(node, seen, { hoistTarget: node, depth: 0 });
|
|
398
|
+
}
|
|
399
|
+
/**
|
|
400
|
+
* Descend one key. A TOP-LEVEL schema-valued key (`schema:`, `inputType:`,
|
|
401
|
+
* `status:`, …) opens a new hoist target, because that node is what a validator
|
|
402
|
+
* compiles: a `#/$defs/…` pointer written below it resolves against IT, not
|
|
403
|
+
* against the document. Depth-anchored for the reason migrations anchor `under`
|
|
404
|
+
* at top-level keys — a slot DESCRIBING a field named `schema` is not itself a
|
|
405
|
+
* schema region, and treating it as one would scatter `$defs` blocks into the
|
|
406
|
+
* middle of a kind's property map.
|
|
407
|
+
*/
|
|
408
|
+
function childContext(ctx, key, value) {
|
|
409
|
+
if (ctx.depth === 0 && SCHEMA_REGION_KEYS.includes(key) && isPlainObject(value)) {
|
|
410
|
+
return { hoistTarget: value, depth: 1 };
|
|
411
|
+
}
|
|
412
|
+
return { hoistTarget: ctx.hoistTarget, depth: ctx.depth + 1 };
|
|
413
|
+
}
|
|
414
|
+
function walkFragments(node, seen, ctx) {
|
|
301
415
|
if (!node || typeof node !== "object")
|
|
302
416
|
return;
|
|
303
417
|
if (seen.has(node))
|
|
@@ -305,23 +419,111 @@ export function expandManifestFragments(node, seen = new Set()) {
|
|
|
305
419
|
seen.add(node);
|
|
306
420
|
if (Array.isArray(node)) {
|
|
307
421
|
for (let i = 0; i < node.length; i++) {
|
|
308
|
-
const
|
|
309
|
-
if (
|
|
310
|
-
node[i] =
|
|
311
|
-
else
|
|
312
|
-
|
|
422
|
+
const localized = localizeRecursiveFragment(node[i], ctx);
|
|
423
|
+
if (localized)
|
|
424
|
+
node[i] = localized;
|
|
425
|
+
else {
|
|
426
|
+
const fragment = fragmentFor(node[i]);
|
|
427
|
+
if (fragment)
|
|
428
|
+
node[i] = fragment;
|
|
429
|
+
else
|
|
430
|
+
walkFragments(node[i], seen, { ...ctx, depth: ctx.depth + 1 });
|
|
431
|
+
}
|
|
313
432
|
}
|
|
314
433
|
return;
|
|
315
434
|
}
|
|
316
435
|
const obj = node;
|
|
317
436
|
for (const [key, value] of Object.entries(obj)) {
|
|
437
|
+
const localized = localizeRecursiveFragment(value, ctx);
|
|
438
|
+
if (localized) {
|
|
439
|
+
obj[key] = localized;
|
|
440
|
+
continue;
|
|
441
|
+
}
|
|
318
442
|
const fragment = fragmentFor(value);
|
|
319
443
|
if (fragment)
|
|
320
444
|
obj[key] = fragment;
|
|
321
445
|
else
|
|
322
|
-
|
|
446
|
+
walkFragments(value, seen, childContext(ctx, key, value));
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
/**
|
|
450
|
+
* Rewrite a reference to a RECURSIVE fragment to the document-local pointer,
|
|
451
|
+
* hoisting one copy of the fragment into the enclosing schema's `$defs`.
|
|
452
|
+
*
|
|
453
|
+
* Localized rather than inlined because the shape contains itself: inlining
|
|
454
|
+
* cannot terminate, which is what the "closed, non-recursive set" caveat above
|
|
455
|
+
* says. Localized rather than left pointing at `telo://manifest` because two
|
|
456
|
+
* consumers cannot follow a foreign URI — the editor's resolver throws on any
|
|
457
|
+
* `$ref` that does not start with `#/`, and that throw takes the whole canvas
|
|
458
|
+
* down, exactly as gating fragment expansion once did.
|
|
459
|
+
*
|
|
460
|
+
* Siblings written beside the `$ref` are kept, but draft-07 makes `$ref`
|
|
461
|
+
* exclusive, so they reach the human surfaces (completion, hover, the editor)
|
|
462
|
+
* and not AJV. A slot adds a `title` / `description` that way; a slot narrowing
|
|
463
|
+
* the shape would be silently ignored and should declare its own schema.
|
|
464
|
+
*/
|
|
465
|
+
function localizeRecursiveFragment(value, ctx) {
|
|
466
|
+
if (!isPlainObject(value))
|
|
467
|
+
return undefined;
|
|
468
|
+
const ref = value.$ref;
|
|
469
|
+
if (typeof ref !== "string" || !ref.startsWith(FRAGMENT_PREFIX))
|
|
470
|
+
return undefined;
|
|
471
|
+
const name = ref.slice(FRAGMENT_PREFIX.length);
|
|
472
|
+
if (!SCHEMA_FRAGMENTS.has(name))
|
|
473
|
+
return undefined;
|
|
474
|
+
hoistFragmentDef(ctx.hoistTarget, name);
|
|
475
|
+
return { ...value, $ref: `#/$defs/${hoistedDefKey(name)}`, [X_TELO_FRAGMENT]: name };
|
|
476
|
+
}
|
|
477
|
+
/** Add `name` (and anything it references in turn) to `target.$defs`, cloned —
|
|
478
|
+
* the fragment set is frozen, and later passes rewrite schemas in place. */
|
|
479
|
+
function hoistFragmentDef(target, name) {
|
|
480
|
+
const defs = (target.$defs ??= {});
|
|
481
|
+
const pending = [name];
|
|
482
|
+
while (pending.length > 0) {
|
|
483
|
+
const next = pending.pop();
|
|
484
|
+
const key = hoistedDefKey(next);
|
|
485
|
+
if (defs[key])
|
|
486
|
+
continue;
|
|
487
|
+
const fragment = ManifestRootSchema.$defs[next];
|
|
488
|
+
if (!fragment || typeof fragment !== "object")
|
|
489
|
+
continue;
|
|
490
|
+
// Stamped on the hoisted body, not only on the slot that pointed at it: a
|
|
491
|
+
// schema nests, so the node a consumer resolves two levels down is the
|
|
492
|
+
// fragment reached through its own self-reference, with no slot in sight.
|
|
493
|
+
// That node is exactly where an annotation like `x-telo-eval` is written,
|
|
494
|
+
// so it is where the stamp has to be readable.
|
|
495
|
+
defs[key] = { ...structuredClone(fragment), [X_TELO_FRAGMENT]: next };
|
|
496
|
+
for (const nested of SCHEMA_FRAGMENTS) {
|
|
497
|
+
if (nested !== next && referencesLocalDef(defs[key], nested))
|
|
498
|
+
pending.push(nested);
|
|
499
|
+
}
|
|
323
500
|
}
|
|
324
501
|
}
|
|
502
|
+
/** Does a hoisted fragment point at another one? Cheap and structural: the set
|
|
503
|
+
* is small and a missed edge would leave an unresolvable pointer, which AJV
|
|
504
|
+
* reports loudly rather than silently skipping. */
|
|
505
|
+
function referencesLocalDef(node, name) {
|
|
506
|
+
if (!node || typeof node !== "object")
|
|
507
|
+
return false;
|
|
508
|
+
if (Array.isArray(node))
|
|
509
|
+
return node.some((item) => referencesLocalDef(item, name));
|
|
510
|
+
const obj = node;
|
|
511
|
+
if (obj.$ref === `#/$defs/${hoistedDefKey(name)}`)
|
|
512
|
+
return true;
|
|
513
|
+
return Object.values(obj).some((value) => referencesLocalDef(value, name));
|
|
514
|
+
}
|
|
515
|
+
/**
|
|
516
|
+
* Expand fragments in a schema that never passes through the loader —
|
|
517
|
+
* `builtins.ts` is not a manifest, so its slots have to arrive already
|
|
518
|
+
* localized, with the hoisted `$defs` at the root of the schema AJV compiles.
|
|
519
|
+
*
|
|
520
|
+
* Returns the same object, expanded in place, for use as a declaration
|
|
521
|
+
* initializer.
|
|
522
|
+
*/
|
|
523
|
+
export function withSchemaFragments(schema) {
|
|
524
|
+
expandManifestFragments(schema);
|
|
525
|
+
return schema;
|
|
526
|
+
}
|
|
325
527
|
/**
|
|
326
528
|
* The fragment a node references, expanded and merged with whatever the node
|
|
327
529
|
* declared beside the `$ref`, or undefined when it references none.
|