@telorun/analyzer 0.65.0 → 0.66.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/dist/analyzer.d.ts +1 -1
- package/dist/analyzer.d.ts.map +1 -1
- package/dist/analyzer.js +157 -63
- package/dist/call-graph.d.ts.map +1 -1
- package/dist/call-graph.js +7 -1
- package/dist/cel-environment.d.ts +12 -0
- package/dist/cel-environment.d.ts.map +1 -1
- package/dist/cel-environment.js +35 -19
- package/dist/cel-scope.d.ts.map +1 -1
- package/dist/cel-scope.js +24 -4
- package/dist/definition-registry.d.ts +24 -0
- package/dist/definition-registry.d.ts.map +1 -1
- package/dist/definition-registry.js +41 -0
- package/dist/eval-paths.d.ts +68 -0
- package/dist/eval-paths.d.ts.map +1 -1
- package/dist/eval-paths.js +138 -0
- package/dist/flatten-for-analyzer.d.ts +1 -1
- package/dist/flatten-for-analyzer.js +1 -1
- package/dist/import-resolution-diagnostics.d.ts +1 -1
- package/dist/import-resolution-diagnostics.js +1 -1
- package/dist/index.d.ts +9 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -5
- package/dist/manifest-visitor.d.ts.map +1 -1
- package/dist/manifest-visitor.js +8 -1
- package/dist/migrations/entries/index.d.ts.map +1 -1
- package/dist/migrations/entries/index.js +2 -0
- package/dist/migrations/entries/schema-prepare-bucket.json +27 -0
- package/dist/peer-binding.d.ts +232 -0
- package/dist/peer-binding.d.ts.map +1 -0
- package/dist/peer-binding.js +418 -0
- package/dist/ref-slot.d.ts +13 -0
- package/dist/ref-slot.d.ts.map +1 -1
- package/dist/ref-slot.js +26 -0
- package/dist/reference-field-map.d.ts +28 -0
- package/dist/reference-field-map.d.ts.map +1 -1
- package/dist/reference-field-map.js +25 -0
- package/dist/referrer-rule.d.ts +17 -0
- package/dist/referrer-rule.d.ts.map +1 -1
- package/dist/referrer-rule.js +4 -1
- package/dist/release/index.d.ts +1 -1
- package/dist/release/index.js +1 -1
- package/dist/resource-rule.d.ts +40 -27
- package/dist/resource-rule.d.ts.map +1 -1
- package/dist/resource-rule.js +61 -7
- package/dist/rule-condition.d.ts +11 -0
- package/dist/rule-condition.d.ts.map +1 -1
- package/dist/rule-condition.js +13 -0
- package/dist/schema-projection.d.ts +106 -4
- package/dist/schema-projection.d.ts.map +1 -1
- package/dist/schema-projection.js +206 -18
- package/dist/telo-version.d.ts +1 -1
- package/dist/telo-version.js +1 -1
- package/dist/validate-cel-context.d.ts +1 -17
- package/dist/validate-cel-context.d.ts.map +1 -1
- package/dist/validate-cel-context.js +5 -70
- package/dist/validate-reference-forms.d.ts +10 -0
- package/dist/validate-reference-forms.d.ts.map +1 -1
- package/dist/validate-reference-forms.js +23 -0
- package/dist/validate-references.d.ts.map +1 -1
- package/dist/validate-references.js +9 -2
- package/dist/validate-referrer-rules.d.ts +38 -4
- package/dist/validate-referrer-rules.d.ts.map +1 -1
- package/dist/validate-referrer-rules.js +139 -31
- package/dist/validate-resource-rules.d.ts +11 -2
- package/dist/validate-resource-rules.d.ts.map +1 -1
- package/dist/validate-resource-rules.js +18 -12
- package/dist/validate-schema-projection.d.ts.map +1 -1
- package/dist/validate-schema-projection.js +33 -2
- package/dist/with-synthetic-positions.d.ts +1 -1
- package/dist/with-synthetic-positions.js +1 -1
- package/package.json +3 -3
- package/src/analyzer.ts +191 -68
- package/src/call-graph.ts +7 -1
- package/src/cel-environment.ts +48 -19
- package/src/cel-scope.ts +24 -6
- package/src/definition-registry.ts +42 -0
- package/src/eval-paths.ts +152 -0
- package/src/flatten-for-analyzer.ts +1 -1
- package/src/import-resolution-diagnostics.ts +1 -1
- package/src/index.ts +45 -4
- package/src/manifest-visitor.ts +8 -1
- package/src/migrations/entries/index.ts +2 -0
- package/src/migrations/entries/schema-prepare-bucket.json +27 -0
- package/src/peer-binding.ts +641 -0
- package/src/ref-slot.ts +36 -0
- package/src/reference-field-map.ts +42 -0
- package/src/referrer-rule.ts +20 -1
- package/src/release/index.ts +1 -1
- package/src/resource-rule.ts +69 -7
- package/src/rule-condition.ts +15 -0
- package/src/schema-projection.ts +283 -20
- package/src/telo-version.ts +1 -1
- package/src/validate-cel-context.ts +6 -71
- package/src/validate-reference-forms.ts +22 -0
- package/src/validate-references.ts +15 -2
- package/src/validate-referrer-rules.ts +215 -28
- package/src/validate-resource-rules.ts +26 -12
- package/src/validate-schema-projection.ts +50 -1
- package/src/with-synthetic-positions.ts +1 -1
|
@@ -26,6 +26,7 @@ import {
|
|
|
26
26
|
projectionKeyMap,
|
|
27
27
|
rawSchemaProjection,
|
|
28
28
|
readSchemaProjection,
|
|
29
|
+
schemaMapBranch,
|
|
29
30
|
schemaProjectionIsMisplaced,
|
|
30
31
|
} from "./schema-projection.js";
|
|
31
32
|
|
|
@@ -118,6 +119,48 @@ export function validateSchemaProjection(manifest: ResourceManifest): SchemaProj
|
|
|
118
119
|
];
|
|
119
120
|
}
|
|
120
121
|
|
|
122
|
+
const reference = raw.reference;
|
|
123
|
+
if (reference !== undefined) {
|
|
124
|
+
if (!isObject(reference)) {
|
|
125
|
+
issues.push(
|
|
126
|
+
issue(
|
|
127
|
+
"SCHEMA_PROJECTION_INVALID",
|
|
128
|
+
`${base}.reference`,
|
|
129
|
+
`'reference' says how an entry whose '${projection.key}' holds a REFERENCE projects. ` +
|
|
130
|
+
`It is an object naming 'from' (the target field to read), 'keyword' (the schema ` +
|
|
131
|
+
`keyword its values become) and one of 'base' / 'baseFrom'.`,
|
|
132
|
+
),
|
|
133
|
+
);
|
|
134
|
+
} else {
|
|
135
|
+
const absent = ["from", "keyword"].filter((f) => typeof reference[f] !== "string");
|
|
136
|
+
if (absent.length > 0) {
|
|
137
|
+
issues.push(
|
|
138
|
+
issue(
|
|
139
|
+
"SCHEMA_PROJECTION_INVALID",
|
|
140
|
+
`${base}.reference`,
|
|
141
|
+
`'reference' is missing ${absent.map((f) => `'${f}'`).join(" and ")}. Without them a ` +
|
|
142
|
+
`referenced entry projects to nothing, so it vanishes from every consumer's view.`,
|
|
143
|
+
),
|
|
144
|
+
);
|
|
145
|
+
}
|
|
146
|
+
const bases = ["base", "baseFrom"].filter((f) => reference[f] !== undefined);
|
|
147
|
+
if (bases.length !== 1) {
|
|
148
|
+
issues.push(
|
|
149
|
+
issue(
|
|
150
|
+
"SCHEMA_PROJECTION_INVALID",
|
|
151
|
+
`${base}.reference`,
|
|
152
|
+
bases.length === 0
|
|
153
|
+
? `'reference' declares neither 'base' nor 'baseFrom', so the projected node has no ` +
|
|
154
|
+
`type. Write 'base' where the named type IS its own base type, or 'baseFrom' ` +
|
|
155
|
+
`naming the target field that holds a value of this kind's own map.`
|
|
156
|
+
: `'reference' declares both 'base' and 'baseFrom'. They are two answers to one ` +
|
|
157
|
+
`question — where the projected node's type comes from — so declare exactly one.`,
|
|
158
|
+
),
|
|
159
|
+
);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
|
|
121
164
|
const map = projectionKeyMap(schema, projection);
|
|
122
165
|
if (!map) {
|
|
123
166
|
return [
|
|
@@ -180,5 +223,11 @@ function keySchema(
|
|
|
180
223
|
: undefined;
|
|
181
224
|
if (!isObject(entry) || !isObject(entry.properties)) return undefined;
|
|
182
225
|
const field = entry.properties[key];
|
|
183
|
-
|
|
226
|
+
if (!isObject(field)) return undefined;
|
|
227
|
+
// The vocabulary may sit on a BRANCH — a slot unioning a closed value set with
|
|
228
|
+
// a reference — and the branch carrying the map is the one whose `enum` the map
|
|
229
|
+
// has to answer for. Reading the union node instead finds no `enum` at all, so
|
|
230
|
+
// the completeness check would silently stop running exactly where the two
|
|
231
|
+
// halves can disagree. Asked through the single reader, never re-derived here.
|
|
232
|
+
return schemaMapBranch(field) ?? field;
|
|
184
233
|
}
|
|
@@ -10,7 +10,7 @@ import { REF_VALIDATION_SKIP_KINDS } from "./system-kinds.js";
|
|
|
10
10
|
* manifest (the dedup that backs `DUPLICATE_RESOURCE_NAME` reads
|
|
11
11
|
* `(source, sourceLine)` to distinguish pipeline echoes from real
|
|
12
12
|
* collisions). Production callers — the `Loader`, `flattenForAnalyzer`,
|
|
13
|
-
*
|
|
13
|
+
* telo studio's `emitDocsFor`, the VSCode extension — all stamp
|
|
14
14
|
* positions already. This helper is the escape hatch for **programmatic
|
|
15
15
|
* callers** (tests, ad-hoc scripts) that construct `ResourceManifest`
|
|
16
16
|
* literals without going through a loader: it gives every otherwise-naked
|