@telorun/analyzer 0.11.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +2 -2
- package/README.md +3 -3
- package/dist/analysis-registry.d.ts +7 -0
- package/dist/analysis-registry.d.ts.map +1 -1
- package/dist/analysis-registry.js +38 -0
- package/dist/analyzer.d.ts.map +1 -1
- package/dist/analyzer.js +53 -9
- package/dist/builtins.d.ts.map +1 -1
- package/dist/builtins.js +44 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/kernel-globals.d.ts.map +1 -1
- package/dist/kernel-globals.js +9 -11
- package/dist/manifest-loader.d.ts +23 -1
- package/dist/manifest-loader.d.ts.map +1 -1
- package/dist/manifest-loader.js +66 -3
- package/dist/normalize-inline-resources.d.ts.map +1 -1
- package/dist/normalize-inline-resources.js +26 -14
- package/dist/position-metadata.d.ts +5 -1
- package/dist/position-metadata.d.ts.map +1 -1
- package/dist/position-metadata.js +8 -1
- package/dist/reference-field-map.d.ts +21 -4
- package/dist/reference-field-map.d.ts.map +1 -1
- package/dist/reference-field-map.js +35 -19
- package/dist/residual-schema.d.ts +23 -0
- package/dist/residual-schema.d.ts.map +1 -0
- package/dist/residual-schema.js +45 -0
- package/dist/rewrite-synthetic-origins.d.ts +10 -0
- package/dist/rewrite-synthetic-origins.d.ts.map +1 -0
- package/dist/rewrite-synthetic-origins.js +55 -0
- package/dist/types.d.ts +12 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/validate-cel-context.d.ts +5 -0
- package/dist/validate-cel-context.d.ts.map +1 -1
- package/dist/validate-cel-context.js +27 -15
- package/dist/validate-provider-coherence.d.ts +23 -0
- package/dist/validate-provider-coherence.d.ts.map +1 -0
- package/dist/validate-provider-coherence.js +148 -0
- package/dist/validate-references.js +24 -24
- package/package.json +7 -4
- package/src/analysis-registry.ts +37 -0
- package/src/analyzer.ts +55 -11
- package/src/builtins.ts +44 -1
- package/src/index.ts +1 -0
- package/src/kernel-globals.ts +9 -11
- package/src/manifest-loader.ts +69 -4
- package/src/normalize-inline-resources.ts +48 -13
- package/src/position-metadata.ts +8 -1
- package/src/reference-field-map.ts +46 -18
- package/src/residual-schema.ts +49 -0
- package/src/rewrite-synthetic-origins.ts +75 -0
- package/src/types.ts +12 -0
- package/src/validate-cel-context.ts +28 -15
- package/src/validate-provider-coherence.ts +166 -0
- package/src/validate-references.ts +24 -24
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ResourceManifest } from "@telorun/sdk";
|
|
2
|
-
import { isRefEntry, isScopeEntry, isSchemaFromEntry, isInlineResource, resolveFieldValues, type RefFieldEntry } from "./reference-field-map.js";
|
|
2
|
+
import { isRefEntry, isScopeEntry, isSchemaFromEntry, isInlineResource, resolveFieldEntries, resolveFieldValues, type RefFieldEntry } from "./reference-field-map.js";
|
|
3
3
|
import { navigateJsonPointer } from "./schema-compat.js";
|
|
4
4
|
import { DiagnosticSeverity, type AnalysisDiagnostic, type AnalysisContext } from "./types.js";
|
|
5
5
|
import type { AliasResolver } from "./alias-resolver.js";
|
|
@@ -142,7 +142,7 @@ export function validateReferences(
|
|
|
142
142
|
}
|
|
143
143
|
}
|
|
144
144
|
|
|
145
|
-
for (const val of
|
|
145
|
+
for (const { value: val, path: concretePath } of resolveFieldEntries(r, fieldPath)) {
|
|
146
146
|
if (!val) continue;
|
|
147
147
|
|
|
148
148
|
// Name-only reference (plain string) — look up by name to validate.
|
|
@@ -166,8 +166,8 @@ export function validateReferences(
|
|
|
166
166
|
severity: DiagnosticSeverity.Error,
|
|
167
167
|
code: "UNRESOLVED_REFERENCE",
|
|
168
168
|
source: SOURCE,
|
|
169
|
-
message: `${resourceLabel}: reference at '${
|
|
170
|
-
data: { resource: resourceData, filePath, path:
|
|
169
|
+
message: `${resourceLabel}: reference at '${concretePath}' → resource '${val}' not found`,
|
|
170
|
+
data: { resource: resourceData, filePath, path: concretePath },
|
|
171
171
|
});
|
|
172
172
|
continue;
|
|
173
173
|
}
|
|
@@ -177,8 +177,8 @@ export function validateReferences(
|
|
|
177
177
|
severity: DiagnosticSeverity.Error,
|
|
178
178
|
code: "REFERENCE_KIND_MISMATCH",
|
|
179
179
|
source: SOURCE,
|
|
180
|
-
message: `${resourceLabel}: reference at '${
|
|
181
|
-
data: { resource: resourceData, filePath, path:
|
|
180
|
+
message: `${resourceLabel}: reference at '${concretePath}' → ${kindErrors.join("; ")}`,
|
|
181
|
+
data: { resource: resourceData, filePath, path: concretePath },
|
|
182
182
|
});
|
|
183
183
|
}
|
|
184
184
|
continue;
|
|
@@ -196,8 +196,8 @@ export function validateReferences(
|
|
|
196
196
|
severity: DiagnosticSeverity.Error,
|
|
197
197
|
code: "INVALID_REFERENCE",
|
|
198
198
|
source: SOURCE,
|
|
199
|
-
message: `${resourceLabel}: reference at '${
|
|
200
|
-
data: { resource: resourceData, filePath, path:
|
|
199
|
+
message: `${resourceLabel}: reference at '${concretePath}' must have string 'kind' and 'name' fields`,
|
|
200
|
+
data: { resource: resourceData, filePath, path: concretePath },
|
|
201
201
|
});
|
|
202
202
|
continue;
|
|
203
203
|
}
|
|
@@ -209,8 +209,8 @@ export function validateReferences(
|
|
|
209
209
|
severity: DiagnosticSeverity.Error,
|
|
210
210
|
code: "REFERENCE_KIND_MISMATCH",
|
|
211
211
|
source: SOURCE,
|
|
212
|
-
message: `${resourceLabel}: reference at '${
|
|
213
|
-
data: { resource: resourceData, filePath, path:
|
|
212
|
+
message: `${resourceLabel}: reference at '${concretePath}' → ${kindErrors.join("; ")}`,
|
|
213
|
+
data: { resource: resourceData, filePath, path: concretePath },
|
|
214
214
|
});
|
|
215
215
|
}
|
|
216
216
|
|
|
@@ -223,8 +223,8 @@ export function validateReferences(
|
|
|
223
223
|
severity: DiagnosticSeverity.Error,
|
|
224
224
|
code: "UNRESOLVED_REFERENCE",
|
|
225
225
|
source: SOURCE,
|
|
226
|
-
message: `${resourceLabel}: reference at '${
|
|
227
|
-
data: { resource: resourceData, filePath, path:
|
|
226
|
+
message: `${resourceLabel}: reference at '${concretePath}' → resource '${refVal.name}' not found`,
|
|
227
|
+
data: { resource: resourceData, filePath, path: concretePath },
|
|
228
228
|
});
|
|
229
229
|
}
|
|
230
230
|
}
|
|
@@ -317,7 +317,7 @@ export function validateReferences(
|
|
|
317
317
|
continue;
|
|
318
318
|
}
|
|
319
319
|
|
|
320
|
-
for (const fieldValue of
|
|
320
|
+
for (const { value: fieldValue, path: concretePath } of resolveFieldEntries(r, fieldPath)) {
|
|
321
321
|
if (fieldValue == null) continue;
|
|
322
322
|
const issues = registry.validateWithRefs(fieldValue, subSchema as Record<string, any>);
|
|
323
323
|
for (const issue of issues) {
|
|
@@ -325,8 +325,8 @@ export function validateReferences(
|
|
|
325
325
|
severity: DiagnosticSeverity.Error,
|
|
326
326
|
code: "DEPENDENT_SCHEMA_MISMATCH",
|
|
327
327
|
source: SOURCE,
|
|
328
|
-
message: `${resourceLabel}: '${
|
|
329
|
-
data: { resource: resourceData, filePath, path:
|
|
328
|
+
message: `${resourceLabel}: '${concretePath}' does not match schema from '${anchorName}${jsonPointer}': ${issue}`,
|
|
329
|
+
data: { resource: resourceData, filePath, path: concretePath },
|
|
330
330
|
});
|
|
331
331
|
}
|
|
332
332
|
}
|
|
@@ -347,10 +347,10 @@ export function validateReferences(
|
|
|
347
347
|
const anchorValues = resolveFieldValues(r, anchorPath);
|
|
348
348
|
if (anchorValues.length === 0) continue; // anchor field not set — nothing to validate
|
|
349
349
|
|
|
350
|
-
const
|
|
350
|
+
const fieldEntries = resolveFieldEntries(r, fieldPath);
|
|
351
351
|
|
|
352
|
-
for (let i = 0; i <
|
|
353
|
-
const fieldValue =
|
|
352
|
+
for (let i = 0; i < fieldEntries.length; i++) {
|
|
353
|
+
const { value: fieldValue, path: concretePath } = fieldEntries[i];
|
|
354
354
|
if (fieldValue == null) continue;
|
|
355
355
|
|
|
356
356
|
// For absolute paths, the single anchor applies to all field values.
|
|
@@ -367,8 +367,8 @@ export function validateReferences(
|
|
|
367
367
|
severity: DiagnosticSeverity.Error,
|
|
368
368
|
code: "SCHEMA_FROM_MISSING_PATH",
|
|
369
369
|
source: SOURCE,
|
|
370
|
-
message: `${resourceLabel}: x-telo-schema-from at '${
|
|
371
|
-
data: { resource: resourceData, filePath, path:
|
|
370
|
+
message: `${resourceLabel}: x-telo-schema-from at '${concretePath}' → kind '${refVal.kind}' has no schema`,
|
|
371
|
+
data: { resource: resourceData, filePath, path: concretePath },
|
|
372
372
|
});
|
|
373
373
|
continue;
|
|
374
374
|
}
|
|
@@ -379,8 +379,8 @@ export function validateReferences(
|
|
|
379
379
|
severity: DiagnosticSeverity.Error,
|
|
380
380
|
code: "SCHEMA_FROM_MISSING_PATH",
|
|
381
381
|
source: SOURCE,
|
|
382
|
-
message: `${resourceLabel}: x-telo-schema-from at '${
|
|
383
|
-
data: { resource: resourceData, filePath, path:
|
|
382
|
+
message: `${resourceLabel}: x-telo-schema-from at '${concretePath}' → kind '${refVal.kind}' has no schema path '${jsonPointer}'`,
|
|
383
|
+
data: { resource: resourceData, filePath, path: concretePath },
|
|
384
384
|
});
|
|
385
385
|
continue;
|
|
386
386
|
}
|
|
@@ -391,8 +391,8 @@ export function validateReferences(
|
|
|
391
391
|
severity: DiagnosticSeverity.Error,
|
|
392
392
|
code: "DEPENDENT_SCHEMA_MISMATCH",
|
|
393
393
|
source: SOURCE,
|
|
394
|
-
message: `${resourceLabel}: '${
|
|
395
|
-
data: { resource: resourceData, filePath, path:
|
|
394
|
+
message: `${resourceLabel}: '${concretePath}' does not match schema from '${refVal.kind}${jsonPointer}': ${issue}`,
|
|
395
|
+
data: { resource: resourceData, filePath, path: concretePath },
|
|
396
396
|
});
|
|
397
397
|
}
|
|
398
398
|
}
|