@telorun/analyzer 0.71.0 → 0.73.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.map +1 -1
- package/dist/analyzer.js +92 -15
- package/dist/builtins.d.ts.map +1 -1
- package/dist/builtins.js +71 -97
- package/dist/catch-scope.d.ts +72 -0
- package/dist/catch-scope.d.ts.map +1 -0
- package/dist/catch-scope.js +102 -0
- package/dist/cel-scope-query.d.ts.map +1 -1
- package/dist/cel-scope-query.js +32 -11
- package/dist/cel-scope.d.ts.map +1 -1
- package/dist/cel-scope.js +1 -0
- package/dist/deprecation.d.ts +21 -0
- package/dist/deprecation.d.ts.map +1 -0
- package/dist/deprecation.js +26 -0
- package/dist/eval-paths.d.ts +36 -5
- package/dist/eval-paths.d.ts.map +1 -1
- package/dist/eval-paths.js +47 -6
- package/dist/extends-resolution.d.ts +12 -0
- package/dist/extends-resolution.d.ts.map +1 -1
- package/dist/extends-resolution.js +23 -0
- package/dist/index.d.ts +4 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -2
- package/dist/manifest-visitor.d.ts +17 -1
- package/dist/manifest-visitor.d.ts.map +1 -1
- package/dist/manifest-visitor.js +5 -1
- package/dist/migrations/report.d.ts +1 -1
- package/dist/migrations/report.d.ts.map +1 -1
- package/dist/migrations/report.js +5 -0
- package/dist/nearest-name.d.ts +22 -0
- package/dist/nearest-name.d.ts.map +1 -0
- package/dist/nearest-name.js +43 -0
- package/dist/ref-slot.d.ts +15 -0
- package/dist/ref-slot.d.ts.map +1 -1
- package/dist/ref-slot.js +7 -0
- package/dist/release/destinations.d.ts +59 -0
- package/dist/release/destinations.d.ts.map +1 -0
- package/dist/release/destinations.js +75 -0
- package/dist/release/index.d.ts +6 -2
- package/dist/release/index.d.ts.map +1 -1
- package/dist/release/index.js +3 -1
- package/dist/release/ledger.d.ts +20 -11
- package/dist/release/ledger.d.ts.map +1 -1
- package/dist/release/ledger.js +43 -14
- package/dist/release/release-plan.d.ts +3 -2
- package/dist/release/release-plan.d.ts.map +1 -1
- package/dist/release/release-plan.js +12 -19
- package/dist/release/workspace-config.d.ts +114 -34
- package/dist/release/workspace-config.d.ts.map +1 -1
- package/dist/release/workspace-config.js +322 -38
- package/dist/release/workspace-schema.d.ts +41 -0
- package/dist/release/workspace-schema.d.ts.map +1 -0
- package/dist/release/workspace-schema.js +77 -0
- package/dist/resolve-throws-union.d.ts +29 -1
- package/dist/resolve-throws-union.d.ts.map +1 -1
- package/dist/resolve-throws-union.js +111 -16
- package/dist/schema-compat.d.ts.map +1 -1
- package/dist/schema-compat.js +13 -1
- package/dist/schema-error-report.d.ts +7 -0
- package/dist/schema-error-report.d.ts.map +1 -1
- package/dist/schema-error-report.js +57 -8
- package/dist/schema-keywords.d.ts.map +1 -1
- package/dist/schema-keywords.js +3 -1
- package/dist/schema-walk.d.ts +27 -0
- package/dist/schema-walk.d.ts.map +1 -1
- package/dist/schema-walk.js +44 -0
- package/dist/telo-version.d.ts +1 -1
- package/dist/telo-version.js +1 -1
- package/dist/template-body.d.ts +10 -0
- package/dist/template-body.d.ts.map +1 -1
- package/dist/template-body.js +25 -0
- package/dist/types.d.ts +17 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +11 -0
- package/dist/validate-cel-context.d.ts +23 -8
- package/dist/validate-cel-context.d.ts.map +1 -1
- package/dist/validate-cel-context.js +48 -16
- package/dist/validate-exports.d.ts +28 -0
- package/dist/validate-exports.d.ts.map +1 -0
- package/dist/validate-exports.js +146 -0
- package/dist/validate-extends.d.ts.map +1 -1
- package/dist/validate-extends.js +37 -1
- package/dist/validate-identifier-names.d.ts +2 -2
- package/dist/validate-identifier-names.d.ts.map +1 -1
- package/dist/validate-identifier-names.js +22 -7
- package/dist/validate-provider-coherence.d.ts +4 -8
- package/dist/validate-provider-coherence.d.ts.map +1 -1
- package/dist/validate-provider-coherence.js +12 -123
- package/dist/validate-ref-slots.d.ts +1 -1
- package/dist/validate-ref-slots.d.ts.map +1 -1
- package/dist/validate-ref-slots.js +34 -0
- package/dist/validate-references.d.ts.map +1 -1
- package/dist/validate-references.js +168 -63
- package/dist/validate-template-body.d.ts +36 -0
- package/dist/validate-template-body.d.ts.map +1 -0
- package/dist/validate-template-body.js +246 -0
- package/dist/validate-throws-coverage.d.ts.map +1 -1
- package/dist/validate-throws-coverage.js +236 -85
- package/package.json +3 -2
- package/src/analyzer.ts +118 -12
- package/src/builtins.ts +85 -97
- package/src/catch-scope.ts +157 -0
- package/src/cel-scope-query.ts +28 -9
- package/src/cel-scope.ts +1 -0
- package/src/deprecation.ts +36 -0
- package/src/eval-paths.ts +53 -6
- package/src/extends-resolution.ts +24 -0
- package/src/index.ts +9 -1
- package/src/manifest-visitor.ts +19 -2
- package/src/migrations/report.ts +5 -1
- package/src/nearest-name.ts +47 -0
- package/src/ref-slot.ts +19 -0
- package/src/release/destinations.ts +105 -0
- package/src/release/index.ts +33 -2
- package/src/release/ledger.ts +51 -21
- package/src/release/release-plan.ts +16 -26
- package/src/release/workspace-config.ts +483 -47
- package/src/release/workspace-schema.ts +99 -0
- package/src/resolve-throws-union.ts +139 -21
- package/src/schema-compat.ts +13 -0
- package/src/schema-error-report.ts +66 -10
- package/src/schema-keywords.ts +4 -1
- package/src/schema-walk.ts +56 -0
- package/src/telo-version.ts +1 -1
- package/src/template-body.ts +25 -0
- package/src/types.ts +18 -0
- package/src/validate-cel-context.ts +57 -16
- package/src/validate-exports.ts +185 -0
- package/src/validate-extends.ts +43 -0
- package/src/validate-identifier-names.ts +28 -9
- package/src/validate-provider-coherence.ts +17 -127
- package/src/validate-ref-slots.ts +41 -1
- package/src/validate-references.ts +174 -63
- package/src/validate-template-body.ts +274 -0
- package/src/validate-throws-coverage.ts +333 -92
- package/dist/validate-template-dispatch.d.ts +0 -27
- package/dist/validate-template-dispatch.d.ts.map +0 -1
- package/dist/validate-template-dispatch.js +0 -95
- package/src/validate-template-dispatch.ts +0 -99
|
@@ -2,7 +2,9 @@ import { isTaggedSentinel } from "@telorun/templating";
|
|
|
2
2
|
import { scopeResolverForModule } from "./alias-resolver.js";
|
|
3
3
|
import { resolveScopedName } from "./call-graph.js";
|
|
4
4
|
import { refSentinelTarget } from "./ref-sentinel-target.js";
|
|
5
|
+
import { possibleUses, transfersControl } from "./ref-slot.js";
|
|
5
6
|
import { readStepSlot } from "./step-slot.js";
|
|
7
|
+
import { forEachDrivenSlot } from "./schema-walk.js";
|
|
6
8
|
/** Code a non-`InvokeError` failure surfaces as inside a `catch` block. Mirrors
|
|
7
9
|
* `PLAIN_ERROR_CODE` in `@telorun/run`'s `toSequenceError`: any invoke can throw
|
|
8
10
|
* a plain error, which the catch sees as `error.code === "INTERNAL_ERROR"`. */
|
|
@@ -179,6 +181,16 @@ export function resolveThrowsUnion(manifest, ctx) {
|
|
|
179
181
|
ctx.inProgress.delete(name);
|
|
180
182
|
}
|
|
181
183
|
}
|
|
184
|
+
/**
|
|
185
|
+
* `throws.inherit: true` — the union a composer's own STEP BODIES reach.
|
|
186
|
+
*
|
|
187
|
+
* Deliberately steps only, and not every slot the resource drives: `inherit` is
|
|
188
|
+
* a DECLARATION that a kind's union is the union of what it dispatches, and a
|
|
189
|
+
* kind that does not make that claim must not have it inferred — a kind holding
|
|
190
|
+
* a `call` ref it catches internally would silently gain codes it never lets
|
|
191
|
+
* escape. What a CATCH SCOPE needs is a different question with a different
|
|
192
|
+
* answer, and it has its own resolver below.
|
|
193
|
+
*/
|
|
182
194
|
function resolveInherited(manifest, definition, ctx, ownerModule) {
|
|
183
195
|
const result = { codes: new Map(), unbounded: false };
|
|
184
196
|
const props = definition.schema?.properties;
|
|
@@ -195,6 +207,54 @@ function resolveInherited(manifest, definition, ctx, ownerModule) {
|
|
|
195
207
|
}
|
|
196
208
|
return result;
|
|
197
209
|
}
|
|
210
|
+
/**
|
|
211
|
+
* The union a SCOPE-LEVEL `catches:` list can be asked to render — everything
|
|
212
|
+
* the resource it is written on drives, transitively.
|
|
213
|
+
*
|
|
214
|
+
* `x-telo-catches-for: ""` is itself the claim that this is the denominator, so
|
|
215
|
+
* nothing is inferred from a kind that did not opt in, and no definition has to
|
|
216
|
+
* declare a `throws:` block to carry a catch scope (the kernel forbids one on a
|
|
217
|
+
* `Telo.Service` and a `Telo.Mount`, and rightly: what a router renders is not
|
|
218
|
+
* what a router THROWS).
|
|
219
|
+
*
|
|
220
|
+
* Three edges, three answers. A **step body** contributes its own traversal,
|
|
221
|
+
* subtraction included. A **control-transferring ref** contributes the target's
|
|
222
|
+
* own declared union — a route handler is a leaf here, and asking what IT drives
|
|
223
|
+
* would credit this scope with codes the handler catches internally. A
|
|
224
|
+
* **`throwsThrough` ref** recurses, because the target is another scope on the
|
|
225
|
+
* same ladder: a server renders what its mounts' routes throw, not what the
|
|
226
|
+
* mounts themselves declare.
|
|
227
|
+
*/
|
|
228
|
+
export function resolveScopeUnion(manifest, definition, ctx, seen = new Set()) {
|
|
229
|
+
const result = { codes: new Map(), unbounded: false };
|
|
230
|
+
if (seen.has(manifest))
|
|
231
|
+
return result;
|
|
232
|
+
seen.add(manifest);
|
|
233
|
+
const ownerModule = manifest.metadata?.module;
|
|
234
|
+
forEachDrivenSlot(definition.schema, manifest, (driven) => {
|
|
235
|
+
if (driven.kind === "step") {
|
|
236
|
+
unionInto(result, collectStepArrayThrows(driven.data, driven.slot.invoke, undefined, ctx, ownerModule));
|
|
237
|
+
return;
|
|
238
|
+
}
|
|
239
|
+
if (driven.slot.throwsThrough) {
|
|
240
|
+
const target = resolveRefManifest(driven.data, ctx, ownerModule);
|
|
241
|
+
const targetDef = target
|
|
242
|
+
? definitionFor(target.kind, ctx.defs, ctx.aliases, scopeResolverFor(ctx, target.metadata?.module))
|
|
243
|
+
: undefined;
|
|
244
|
+
if (target && targetDef)
|
|
245
|
+
unionInto(result, resolveScopeUnion(target, targetDef, ctx, seen));
|
|
246
|
+
// A target that cannot be resolved says nothing about what it throws, so
|
|
247
|
+
// the scope's union is no longer enumerable.
|
|
248
|
+
else
|
|
249
|
+
result.unbounded = true;
|
|
250
|
+
return;
|
|
251
|
+
}
|
|
252
|
+
if (!possibleUses(driven.slot).some(transfersControl))
|
|
253
|
+
return;
|
|
254
|
+
unionInto(result, resolveRefTargetThrows(driven.data, ctx, ownerModule));
|
|
255
|
+
});
|
|
256
|
+
return result;
|
|
257
|
+
}
|
|
198
258
|
function collectStepArrayThrows(steps, invokeField, enclosingTryCodes, ctx, ownerModule) {
|
|
199
259
|
const result = emptyUnion();
|
|
200
260
|
for (const step of steps) {
|
|
@@ -289,10 +349,25 @@ function cloneUnion(u) {
|
|
|
289
349
|
return out;
|
|
290
350
|
}
|
|
291
351
|
function resolveStepInvokeThrows(step, invokeField, enclosingTryCodes, ctx, ownerModule) {
|
|
292
|
-
|
|
293
|
-
|
|
352
|
+
return resolveRefTargetThrows(step[invokeField], ctx, ownerModule, () => resolvePassthroughAtCallSite(step, enclosingTryCodes));
|
|
353
|
+
}
|
|
354
|
+
/**
|
|
355
|
+
* The effective throw union behind a resolved reference value.
|
|
356
|
+
*
|
|
357
|
+
* Shared by both ways a resource drives another: a step's `invoke:` and a
|
|
358
|
+
* reference slot that carries throws. The two used to differ only in where the
|
|
359
|
+
* ref value was read from, and keeping one copy is what stops a router's
|
|
360
|
+
* denominator and a sequence's from disagreeing about what a name resolves to.
|
|
361
|
+
*
|
|
362
|
+
* `onPassthrough` is the one genuine difference: a passthrough kind's union is a
|
|
363
|
+
* property of the CALL SITE (`inputs.code`), which only a step has. A reference
|
|
364
|
+
* slot has no such site, so the union is unbounded there rather than guessed.
|
|
365
|
+
*/
|
|
366
|
+
function resolveRefTargetThrows(refValue, ctx, ownerModule, onPassthrough) {
|
|
367
|
+
if (!refValue || typeof refValue !== "object" || Array.isArray(refValue))
|
|
294
368
|
return emptyUnion();
|
|
295
|
-
const
|
|
369
|
+
const ref = refValue;
|
|
370
|
+
const invokedKind = ref.kind;
|
|
296
371
|
// A reference that still carries its parse-time sentinel — a library-internal
|
|
297
372
|
// `!ref` inside a manifest forwarded into a consumer's flat set, where Phase
|
|
298
373
|
// 2.5 had nothing to resolve it against. The target is in the declaring
|
|
@@ -302,7 +377,7 @@ function resolveStepInvokeThrows(step, invokeField, enclosingTryCodes, ctx, owne
|
|
|
302
377
|
// its consumer and get the consumer's `catches:` rejected for the code the
|
|
303
378
|
// entry point documents.
|
|
304
379
|
if (!invokedKind) {
|
|
305
|
-
const sentinel = refSentinelTarget(
|
|
380
|
+
const sentinel = refSentinelTarget(ref);
|
|
306
381
|
if (!sentinel)
|
|
307
382
|
return emptyUnion();
|
|
308
383
|
const target = findSentinelTarget(ctx, sentinel, ownerModule);
|
|
@@ -311,26 +386,19 @@ function resolveStepInvokeThrows(step, invokeField, enclosingTryCodes, ctx, owne
|
|
|
311
386
|
return { codes: new Map(), unbounded: true };
|
|
312
387
|
}
|
|
313
388
|
// The invoked kind's alias resolves in the OWNER manifest's lexical scope (the
|
|
314
|
-
//
|
|
389
|
+
// resource that declares the slot), so a library's step referencing its own
|
|
315
390
|
// import resolves against that library, not the consumer.
|
|
316
391
|
const scopeResolver = scopeResolverFor(ctx, ownerModule);
|
|
317
392
|
const definition = definitionFor(invokedKind, ctx.defs, ctx.aliases, scopeResolver);
|
|
318
393
|
if (!definition)
|
|
319
394
|
return { codes: new Map(), unbounded: true };
|
|
320
395
|
if (definition.throws?.passthrough) {
|
|
321
|
-
return
|
|
396
|
+
return onPassthrough ? onPassthrough() : { codes: new Map(), unbounded: true };
|
|
322
397
|
}
|
|
323
398
|
// Named manifest: resolve the full chain (covers transitive inherit).
|
|
324
|
-
const
|
|
325
|
-
if (
|
|
326
|
-
|
|
327
|
-
const target = findTarget(ctx, invokeName, ownerModule, (m) => m.kind === invokedKind ||
|
|
328
|
-
ctx.aliases.resolveKind(m.kind) === invokedKind ||
|
|
329
|
-
m.kind === ctx.aliases.resolveKind(invokedKind) ||
|
|
330
|
-
(scopedInvokedKind !== undefined && m.kind === scopedInvokedKind));
|
|
331
|
-
if (target)
|
|
332
|
-
return resolveThrowsUnion(target, ctx);
|
|
333
|
-
}
|
|
399
|
+
const target = resolveRefManifest(ref, ctx, ownerModule);
|
|
400
|
+
if (target)
|
|
401
|
+
return resolveThrowsUnion(target, ctx);
|
|
334
402
|
// Fall back to the definition's own explicit codes. Mark unbounded when the
|
|
335
403
|
// definition depends on call-site or transitive resolution we couldn't
|
|
336
404
|
// perform (no specific target manifest to recurse into).
|
|
@@ -338,6 +406,33 @@ function resolveStepInvokeThrows(step, invokeField, enclosingTryCodes, ctx, owne
|
|
|
338
406
|
const unbounded = definition.throws?.inherit === true || definition.throws?.passthrough === true;
|
|
339
407
|
return { codes, unbounded };
|
|
340
408
|
}
|
|
409
|
+
/**
|
|
410
|
+
* The manifest a resolved reference value names, in either shape it arrives in —
|
|
411
|
+
* a `{kind, name}` pair, or a `!ref` still carrying its parse-time sentinel.
|
|
412
|
+
*
|
|
413
|
+
* Exported because the catch-scope enclosure walk asks the same question about
|
|
414
|
+
* the same values; resolving a name twice by two rules is how two passes end up
|
|
415
|
+
* disagreeing about which resource a slot points at.
|
|
416
|
+
*/
|
|
417
|
+
export function resolveRefManifest(refValue, ctx, ownerModule) {
|
|
418
|
+
if (!refValue || typeof refValue !== "object" || Array.isArray(refValue))
|
|
419
|
+
return undefined;
|
|
420
|
+
const ref = refValue;
|
|
421
|
+
const kind = ref.kind;
|
|
422
|
+
if (!kind) {
|
|
423
|
+
const sentinel = refSentinelTarget(ref);
|
|
424
|
+
return sentinel ? findSentinelTarget(ctx, sentinel, ownerModule) : undefined;
|
|
425
|
+
}
|
|
426
|
+
const name = ref.name;
|
|
427
|
+
if (!name)
|
|
428
|
+
return undefined;
|
|
429
|
+
const scopeResolver = scopeResolverFor(ctx, ownerModule);
|
|
430
|
+
const scopedKind = scopeResolver?.resolveKind(kind);
|
|
431
|
+
return findTarget(ctx, name, ownerModule, (m) => m.kind === kind ||
|
|
432
|
+
ctx.aliases.resolveKind(m.kind) === kind ||
|
|
433
|
+
m.kind === ctx.aliases.resolveKind(kind) ||
|
|
434
|
+
(scopedKind !== undefined && m.kind === scopedKind));
|
|
435
|
+
}
|
|
341
436
|
/** Resolve a passthrough-style invocable at a specific call site. Recognised forms
|
|
342
437
|
* (see "passthrough: true" in the plan):
|
|
343
438
|
* - constant literal (no template) → `{ <literal> }`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema-compat.d.ts","sourceRoot":"","sources":["../src/schema-compat.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"schema-compat.d.ts","sourceRoot":"","sources":["../src/schema-compat.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAgB,KAAK,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAG1E,QAAA,MAAM,GAAG,KAA0C,CAAC;AAEpD;;;;;;;mCAOmC;AACnC,wBAAgB,SAAS,IAAI,YAAY,CAAC,OAAO,GAAG,CAAC,CAYpD;AAKD,MAAM,WAAW,mBAAmB;IAClC,UAAU,EAAE,OAAO,CAAC;IACpB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB;AAYD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC3B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC3B,UAAU,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,SAAS,GAC5D,mBAAmB,CAIrB;AAuKD,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC9E,YAAY,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAa5D,0GAA0G;AAC1G,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,WAAW,EAAE,CAmB/F;AAED;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ED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import AjvModule from "ajv";
|
|
2
2
|
import addFormats from "ajv-formats";
|
|
3
3
|
import { isRefSentinel, isTaggedSentinel, producedTypeOf, } from "@telorun/templating";
|
|
4
|
-
import { celBaseOfValueType, celTypeOfValueType, readValueTypeSlot, valueBrandBases, valueTypeOf, valueTypePlaceholder, } from "@telorun/sdk";
|
|
4
|
+
import { celBaseOfValueType, celTypeOfValueType, isCompiledValue, readValueTypeSlot, valueBrandBases, valueTypeOf, valueTypePlaceholder, } from "@telorun/sdk";
|
|
5
5
|
import { ManifestRootSchema } from "./manifest-schemas.js";
|
|
6
6
|
import { schemaIssues } from "./schema-error-report.js";
|
|
7
7
|
import { registerTeloKeywords } from "./value-type-keyword.js";
|
|
@@ -709,6 +709,18 @@ export function substituteCelFields(data, schema, rootSchema, options = {}) {
|
|
|
709
709
|
mark();
|
|
710
710
|
return celPlaceholderForSchema(resolved);
|
|
711
711
|
}
|
|
712
|
+
// The same fact in its third spelling. An expression reaches this walk as a
|
|
713
|
+
// `${{ … }}` string or a `!cel` sentinel BEFORE `precompileDoc`, and as a
|
|
714
|
+
// CompiledValue after — so a caller running under `compile: true` (every
|
|
715
|
+
// `telo run`, unlike `telo check`) handed one to AJV as a plain object, and a
|
|
716
|
+
// slot typed `boolean` rejected a `when:` the author wrote correctly. The
|
|
717
|
+
// kernel's `stripCompiledValues` has always substituted here; missing it on
|
|
718
|
+
// this side made one manifest mean two things depending on which command read
|
|
719
|
+
// it.
|
|
720
|
+
if (isCompiledValue(data)) {
|
|
721
|
+
mark();
|
|
722
|
+
return celPlaceholderForSchema(resolved);
|
|
723
|
+
}
|
|
712
724
|
if (Array.isArray(data)) {
|
|
713
725
|
const item = resolveRefIn((resolved.items ?? {}), root, external);
|
|
714
726
|
return data.map((element, i) => substituteCelFields(element, item.schema, item.root, {
|
|
@@ -42,6 +42,13 @@ export interface SchemaIssue {
|
|
|
42
42
|
message: string;
|
|
43
43
|
/** Dotted path to the field (e.g. "config.handler"). Empty string means root. */
|
|
44
44
|
path: string;
|
|
45
|
+
/** The AJV keyword that produced it, so a consumer can key on WHAT failed
|
|
46
|
+
* rather than on how the sentence reads. Prose is the renderer's to change;
|
|
47
|
+
* a caller matching on it breaks silently when it does, and mis-fires on any
|
|
48
|
+
* other issue whose text happens to quote the same name. */
|
|
49
|
+
keyword?: string;
|
|
50
|
+
/** For `required`, the property that is missing. */
|
|
51
|
+
missingProperty?: string;
|
|
45
52
|
}
|
|
46
53
|
export declare function formatSingleError(err: AjvErrorLike): string;
|
|
47
54
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema-error-report.d.ts","sourceRoot":"","sources":["../src/schema-error-report.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH;gDACgD;AAChD,MAAM,WAAW,YAAY;IAC3B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC7B,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,mFAAmF;AACnF,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,iFAAiF;IACjF,IAAI,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"schema-error-report.d.ts","sourceRoot":"","sources":["../src/schema-error-report.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH;gDACgD;AAChD,MAAM,WAAW,YAAY;IAC3B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC7B,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,mFAAmF;AACnF,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,iFAAiF;IACjF,IAAI,EAAE,MAAM,CAAC;IACb;;;iEAG6D;IAC7D,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,oDAAoD;IACpD,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAuCD,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,YAAY,GAAG,MAAM,CA6B3D;AAoGD;;;;;;;;;;;GAWG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,YAAY,EAAE,GAAG,IAAI,GAAG,SAAS,GAAG,YAAY,EAAE,CAsF5F;AAqHD;;sFAEsF;AACtF,wBAAgB,cAAc,CAAC,GAAG,EAAE,YAAY,GAAG,MAAM,CAaxD;AAED,4EAA4E;AAC5E,wBAAgB,YAAY,CAAC,MAAM,EAAE,YAAY,EAAE,GAAG,IAAI,GAAG,SAAS,GAAG,WAAW,EAAE,CAUrF;AAED,+EAA+E;AAC/E,wBAAgB,eAAe,CAAC,MAAM,EAAE,YAAY,EAAE,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,CAIjF"}
|
|
@@ -32,9 +32,38 @@ const UNION_KEYWORDS = new Set(["anyOf", "oneOf"]);
|
|
|
32
32
|
* not of that branch's shape at all — as opposed to being that shape and wrong
|
|
33
33
|
* further in. These are what make a branch implausible. */
|
|
34
34
|
const SHAPE_KEYWORDS = new Set(["required", "type", "additionalProperties", "enum", "const"]);
|
|
35
|
+
/** Keywords that exist to DISCRIMINATE, so a mismatch is positive evidence that
|
|
36
|
+
* the value is not this branch — at any depth, not only at the union node.
|
|
37
|
+
*
|
|
38
|
+
* Depth is otherwise the tiebreak, and it inverts exactly here: a branch that
|
|
39
|
+
* agreed on the discriminator and failed one constraint reported at the union
|
|
40
|
+
* node loses to every branch that disagreed about the discriminator one level
|
|
41
|
+
* in. That is how a `capability: Telo.Service` document declaring a forbidden
|
|
42
|
+
* key was reported as `/capability must be equal to constant` — naming neither
|
|
43
|
+
* the key at fault nor a branch the value could ever have been. */
|
|
44
|
+
const DISCRIMINATOR_KEYWORDS = new Set(["const", "enum"]);
|
|
45
|
+
/** RFC 6901 escapes: `~1` is a literal `/` in the key, `~0` a literal `~`.
|
|
46
|
+
* Decoded wherever a segment is shown or matched, because encoded it is not the
|
|
47
|
+
* key the manifest holds — a content map (`application/json`) anchors nowhere
|
|
48
|
+
* and reads wrong in the sentence. `~0` is expanded LAST, or `~01` would decode
|
|
49
|
+
* to `/` instead of the literal `~1` it encodes. */
|
|
50
|
+
function unescapeSegment(part) {
|
|
51
|
+
return part.replace(/~1/g, "/").replace(/~0/g, "~");
|
|
52
|
+
}
|
|
53
|
+
/** The whole pointer, segment by segment, for prose that quotes it verbatim. */
|
|
54
|
+
function unescapePointer(pointer) {
|
|
55
|
+
return pointer
|
|
56
|
+
.split("/")
|
|
57
|
+
.map((segment, i) => (i === 0 ? segment : unescapeSegment(segment)))
|
|
58
|
+
.join("/");
|
|
59
|
+
}
|
|
35
60
|
/* ------------------------------------------------------------------ prose */
|
|
36
61
|
export function formatSingleError(err) {
|
|
37
|
-
|
|
62
|
+
// Unescaped for the same reason the path is: a reader acting on this sentence
|
|
63
|
+
// needs the key the manifest holds (`application/json`), not its RFC 6901
|
|
64
|
+
// encoding. Reporting one form in `path` and the other in `message` made one
|
|
65
|
+
// diagnostic disagree with itself.
|
|
66
|
+
const p = unescapePointer(err.instancePath || "") || "/";
|
|
38
67
|
const params = err.params ?? {};
|
|
39
68
|
switch (err.keyword) {
|
|
40
69
|
case "additionalProperties":
|
|
@@ -45,6 +74,16 @@ export function formatSingleError(err) {
|
|
|
45
74
|
return `${p} ${err.message ?? "is invalid"} (${params.allowedValues?.join(" | ")})`;
|
|
46
75
|
case "type":
|
|
47
76
|
return `${p} must be ${params.type}${describeActual(err)}`;
|
|
77
|
+
// A `false` schema at a property is how a branch forbids a key it otherwise
|
|
78
|
+
// declares. AJV's own text ("boolean schema is false") describes the schema
|
|
79
|
+
// rather than the value, and the path is the only part a reader can act on.
|
|
80
|
+
case "false schema":
|
|
81
|
+
return `${p} is not allowed here`;
|
|
82
|
+
// `not:` says a forbidden shape matched, and AJV reports nothing about the
|
|
83
|
+
// inner schema — so the honest message says where, and no more. A branch
|
|
84
|
+
// that wants to name the key writes `properties: { <key>: false }` instead.
|
|
85
|
+
case "not":
|
|
86
|
+
return `${p} matches a shape that is not allowed here`;
|
|
48
87
|
default:
|
|
49
88
|
return `${p} ${err.message ?? "is invalid"}`;
|
|
50
89
|
}
|
|
@@ -109,9 +148,14 @@ function describeAlternatives(errors, unionInstancePath) {
|
|
|
109
148
|
return phrases.length > 0 ? phrases : ["another shape"];
|
|
110
149
|
}
|
|
111
150
|
/** Is this branch a plausible reading of the value — does it accept the value's
|
|
112
|
-
* shape at the union node itself, and
|
|
151
|
+
* shape at the union node itself, and agree with every discriminator it pins? */
|
|
113
152
|
function isPlausible(errors, unionInstancePath) {
|
|
114
|
-
return !errors.some((e) =>
|
|
153
|
+
return !errors.some((e) => {
|
|
154
|
+
const keyword = e.keyword ?? "";
|
|
155
|
+
if (DISCRIMINATOR_KEYWORDS.has(keyword))
|
|
156
|
+
return true;
|
|
157
|
+
return (e.instancePath || "") === unionInstancePath && SHAPE_KEYWORDS.has(keyword);
|
|
158
|
+
});
|
|
115
159
|
}
|
|
116
160
|
function isUnder(child, parent) {
|
|
117
161
|
return parent === "" ? child !== "" : child.startsWith(parent + "/");
|
|
@@ -332,7 +376,7 @@ export function ajvErrorToPath(err) {
|
|
|
332
376
|
if (/^\d+$/.test(part))
|
|
333
377
|
result += `[${part}]`;
|
|
334
378
|
else
|
|
335
|
-
result += result ? `.${part}` : part;
|
|
379
|
+
result += result ? `.${unescapeSegment(part)}` : unescapeSegment(part);
|
|
336
380
|
}
|
|
337
381
|
if (err.keyword === "required" && err.params?.missingProperty) {
|
|
338
382
|
const missing = err.params.missingProperty;
|
|
@@ -342,10 +386,15 @@ export function ajvErrorToPath(err) {
|
|
|
342
386
|
}
|
|
343
387
|
/** Reduced, path-anchored issues — what a diagnostic list is built from. */
|
|
344
388
|
export function schemaIssues(errors) {
|
|
345
|
-
return reduceSchemaErrors(errors).map((err) =>
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
389
|
+
return reduceSchemaErrors(errors).map((err) => {
|
|
390
|
+
const missing = (err.params ?? {}).missingProperty;
|
|
391
|
+
return {
|
|
392
|
+
message: formatSingleError(err),
|
|
393
|
+
path: ajvErrorToPath(err),
|
|
394
|
+
...(err.keyword ? { keyword: err.keyword } : {}),
|
|
395
|
+
...(typeof missing === "string" ? { missingProperty: missing } : {}),
|
|
396
|
+
};
|
|
397
|
+
});
|
|
349
398
|
}
|
|
350
399
|
/** Reduced, rendered as one sentence — what a thrown runtime error carries. */
|
|
351
400
|
export function formatAjvErrors(errors) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema-keywords.d.ts","sourceRoot":"","sources":["../src/schema-keywords.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3C,4EAA4E;AAC5E,QAAA,MAAM,gBAAgB,EAAG,kBAA2B,CAAC;AACrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAE9D;iDACiD;AACjD,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;AASrE;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,cAAc,CAuJ/D;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,uBAAuB,EAAE,MAAM,CAMxC,OAAO,CAAC,CAAC,OAAO,mBAAmB,CAAC,CAAC,MAAM,CAAC,EAAE,OAAO,gBAAgB,CAAC,GACtE,OAAO,WAAW,EACpB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,
|
|
1
|
+
{"version":3,"file":"schema-keywords.d.ts","sourceRoot":"","sources":["../src/schema-keywords.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3C,4EAA4E;AAC5E,QAAA,MAAM,gBAAgB,EAAG,kBAA2B,CAAC;AACrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAE9D;iDACiD;AACjD,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;AASrE;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,cAAc,CAuJ/D;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,uBAAuB,EAAE,MAAM,CAMxC,OAAO,CAAC,CAAC,OAAO,mBAAmB,CAAC,CAAC,MAAM,CAAC,EAAE,OAAO,gBAAgB,CAAC,GACtE,OAAO,WAAW,EACpB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CA2JxB,CAAC;AAEF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,4BAA4B,EAAE,MAAM,CAC/C,OAAO,gBAAgB,EACvB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAQxB,CAAC"}
|
package/dist/schema-keywords.js
CHANGED
|
@@ -340,7 +340,9 @@ export const TELO_SCHEMA_ANNOTATIONS = {
|
|
|
340
340
|
},
|
|
341
341
|
"x-telo-catches-for": {
|
|
342
342
|
title: "Catches for",
|
|
343
|
-
description: "
|
|
343
|
+
description: "Whose failures this catch list renders: a sibling field naming the handler, " +
|
|
344
|
+
"or the EMPTY string for everything this resource drives — a scope-level list, " +
|
|
345
|
+
"which owes coverage of nothing itself and answers for every site it encloses.",
|
|
344
346
|
type: "string",
|
|
345
347
|
},
|
|
346
348
|
};
|
package/dist/schema-walk.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { type RefSlot } from "./ref-slot.js";
|
|
2
|
+
import { type StepSlot } from "./step-slot.js";
|
|
1
3
|
/** Resolve a local `$ref` (only `#/$defs/<name>` form) against the root schema.
|
|
2
4
|
* Non-refs and unresolved refs pass through unchanged. */
|
|
3
5
|
export declare function resolveLocalRef(schema: Record<string, any> | undefined, root: Record<string, any>): Record<string, any> | undefined;
|
|
@@ -22,4 +24,29 @@ export declare function gatherPropertySchemas(schema: Record<string, any>, root?
|
|
|
22
24
|
* hardcoded; recursion is driven entirely by the schema annotations.
|
|
23
25
|
*/
|
|
24
26
|
export declare function walkStepArray(steps: unknown[], stepItemSchema: Record<string, any> | undefined, rootSchema: Record<string, any>, basePath: string, visit: (step: Record<string, any>, stepPath: string) => void): void;
|
|
27
|
+
/** A slot through which a resource drives another. */
|
|
28
|
+
export type DrivenSlot = {
|
|
29
|
+
kind: "step";
|
|
30
|
+
slot: StepSlot;
|
|
31
|
+
data: unknown[];
|
|
32
|
+
path: string;
|
|
33
|
+
} | {
|
|
34
|
+
kind: "ref";
|
|
35
|
+
slot: RefSlot;
|
|
36
|
+
data: unknown;
|
|
37
|
+
path: string;
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* Every slot of one resource through which it drives another, schema and data in
|
|
41
|
+
* tandem.
|
|
42
|
+
*
|
|
43
|
+
* One traversal with two consumers — the inherited union here, and the catch
|
|
44
|
+
* scope enclosure in `validate-throws-coverage.ts` — because both ask the same
|
|
45
|
+
* structural question and two copies would eventually disagree about where the
|
|
46
|
+
* walk stops. It terminates on the manifest's own depth, and it stops AT a step
|
|
47
|
+
* slot (that traversal owns everything below it, `try`/`catch` subtraction
|
|
48
|
+
* included) and AT a reference slot (a resolved ref is a leaf, `{kind, name}`,
|
|
49
|
+
* with nothing beneath it to visit).
|
|
50
|
+
*/
|
|
51
|
+
export declare function forEachDrivenSlot(schema: unknown, data: unknown, visit: (slot: DrivenSlot) => void, path?: string): void;
|
|
25
52
|
//# sourceMappingURL=schema-walk.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema-walk.d.ts","sourceRoot":"","sources":["../src/schema-walk.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"schema-walk.d.ts","sourceRoot":"","sources":["../src/schema-walk.ts"],"names":[],"mappings":"AAWA,OAAO,EAAe,KAAK,OAAO,EAAE,MAAM,eAAe,CAAC;AAC1D,OAAO,EAAgB,KAAK,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE7D;2DAC2D;AAC3D,wBAAgB,eAAe,CAC7B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,SAAS,EACvC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GACxB,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,SAAS,CAqBjC;AAID;;;;;;;;iDAQiD;AACjD,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC3B,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GACzB,KAAK,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC,CAsBtC;AAED;;;;;;;;;GASG;AACH,wBAAgB,aAAa,CAC3B,KAAK,EAAE,OAAO,EAAE,EAChB,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,SAAS,EAC/C,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC/B,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,QAAQ,EAAE,MAAM,KAAK,IAAI,GAC3D,IAAI,CAiDN;AACD,sDAAsD;AACtD,MAAM,MAAM,UAAU,GAClB;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,QAAQ,CAAC;IAAC,IAAI,EAAE,OAAO,EAAE,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAC/D;IAAE,IAAI,EAAE,KAAK,CAAC;IAAC,IAAI,EAAE,OAAO,CAAC;IAAC,IAAI,EAAE,OAAO,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAEhE;;;;;;;;;;;GAWG;AACH,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,OAAO,EACf,IAAI,EAAE,OAAO,EACb,KAAK,EAAE,CAAC,IAAI,EAAE,UAAU,KAAK,IAAI,EACjC,IAAI,SAAK,GACR,IAAI,CA8BN"}
|
package/dist/schema-walk.js
CHANGED
|
@@ -9,6 +9,8 @@
|
|
|
9
9
|
* scope rule is consumed by the IDE, which must not pull the pass in behind it.
|
|
10
10
|
*/
|
|
11
11
|
import { MANIFEST_SCHEMA_URI, ManifestRootSchema } from "./manifest-schemas.js";
|
|
12
|
+
import { readRefSlot } from "./ref-slot.js";
|
|
13
|
+
import { readStepSlot } from "./step-slot.js";
|
|
12
14
|
/** Resolve a local `$ref` (only `#/$defs/<name>` form) against the root schema.
|
|
13
15
|
* Non-refs and unresolved refs pass through unchanged. */
|
|
14
16
|
export function resolveLocalRef(schema, root) {
|
|
@@ -124,3 +126,45 @@ export function walkStepArray(steps, stepItemSchema, rootSchema, basePath, visit
|
|
|
124
126
|
}
|
|
125
127
|
});
|
|
126
128
|
}
|
|
129
|
+
/**
|
|
130
|
+
* Every slot of one resource through which it drives another, schema and data in
|
|
131
|
+
* tandem.
|
|
132
|
+
*
|
|
133
|
+
* One traversal with two consumers — the inherited union here, and the catch
|
|
134
|
+
* scope enclosure in `validate-throws-coverage.ts` — because both ask the same
|
|
135
|
+
* structural question and two copies would eventually disagree about where the
|
|
136
|
+
* walk stops. It terminates on the manifest's own depth, and it stops AT a step
|
|
137
|
+
* slot (that traversal owns everything below it, `try`/`catch` subtraction
|
|
138
|
+
* included) and AT a reference slot (a resolved ref is a leaf, `{kind, name}`,
|
|
139
|
+
* with nothing beneath it to visit).
|
|
140
|
+
*/
|
|
141
|
+
export function forEachDrivenSlot(schema, data, visit, path = "") {
|
|
142
|
+
if (!schema || typeof schema !== "object" || data === undefined || data === null)
|
|
143
|
+
return;
|
|
144
|
+
const node = schema;
|
|
145
|
+
const stepSlot = readStepSlot(node);
|
|
146
|
+
if (stepSlot) {
|
|
147
|
+
if (Array.isArray(data))
|
|
148
|
+
visit({ kind: "step", slot: stepSlot, data, path });
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
const refSlot = readRefSlot(node);
|
|
152
|
+
if (refSlot) {
|
|
153
|
+
visit({ kind: "ref", slot: refSlot, data, path });
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
const props = node.properties;
|
|
157
|
+
if (props && typeof data === "object" && !Array.isArray(data)) {
|
|
158
|
+
const obj = data;
|
|
159
|
+
for (const [key, propSchema] of Object.entries(props)) {
|
|
160
|
+
if (obj[key] === undefined)
|
|
161
|
+
continue;
|
|
162
|
+
forEachDrivenSlot(propSchema, obj[key], visit, path ? `${path}.${key}` : key);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
if (node.items && Array.isArray(data)) {
|
|
166
|
+
for (const [i, item] of data.entries()) {
|
|
167
|
+
forEachDrivenSlot(node.items, item, visit, `${path}[${i}]`);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
package/dist/telo-version.d.ts
CHANGED
package/dist/telo-version.js
CHANGED
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
// its release identity, this is the scale a module's `requires.telo` range is
|
|
6
6
|
// written against, and every kernel in every language reports the same scale.
|
|
7
7
|
/** The surface generation this analyzer implements. */
|
|
8
|
-
export const TELO_SURFACE_VERSION = "0.
|
|
8
|
+
export const TELO_SURFACE_VERSION = "0.89.0";
|
package/dist/template-body.d.ts
CHANGED
|
@@ -33,6 +33,16 @@ export interface TemplateBody {
|
|
|
33
33
|
/** The template bodies a manifest declares — empty for anything that is not a
|
|
34
34
|
* `Telo.Definition` with a `resources:` array. */
|
|
35
35
|
export declare function templateBodies(m: ResourceManifest, registry: DefinitionRegistry, aliases: AliasResolver | undefined, scopes: ModuleScopes | undefined): TemplateBody[];
|
|
36
|
+
/** What a definition's dispatch slot names: the `resources:` entry a `!ref` at
|
|
37
|
+
* `slot` (`invoke` / `provide` / `run` / `mount`) resolves to, with its kind.
|
|
38
|
+
* The entry is matched by its LITERAL `metadata.name`; a slot holding anything
|
|
39
|
+
* but a `!ref`, or naming no entry, resolves to nothing — `validate-template-body`
|
|
40
|
+
* is what reports either. `Self.<entry>` is the explicit self-qualifier. */
|
|
41
|
+
export declare function dispatchTargetOf(definition: Record<string, any>, slot: string): {
|
|
42
|
+
entry: Record<string, any> | undefined;
|
|
43
|
+
kind: string;
|
|
44
|
+
name: string;
|
|
45
|
+
} | undefined;
|
|
36
46
|
/** True when a CEL path lies at or inside a body's own subtree. */
|
|
37
47
|
export declare function pathInBody(path: string, prefix: string): boolean;
|
|
38
48
|
/** The body a CEL path belongs to, or undefined for a path in the definition's
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"template-body.d.ts","sourceRoot":"","sources":["../src/template-body.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"template-body.d.ts","sourceRoot":"","sources":["../src/template-body.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAEzE,OAAO,KAAK,EAAE,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AG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAQxF"}
|
package/dist/template-body.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { isRefSentinel } from "@telorun/templating";
|
|
1
2
|
import { moduleAliasScope } from "./module-alias-scope.js";
|
|
2
3
|
/** The template bodies a manifest declares — empty for anything that is not a
|
|
3
4
|
* `Telo.Definition` with a `resources:` array. */
|
|
@@ -30,6 +31,30 @@ export function templateBodies(m, registry, aliases, scopes) {
|
|
|
30
31
|
}
|
|
31
32
|
return out;
|
|
32
33
|
}
|
|
34
|
+
/** What a definition's dispatch slot names: the `resources:` entry a `!ref` at
|
|
35
|
+
* `slot` (`invoke` / `provide` / `run` / `mount`) resolves to, with its kind.
|
|
36
|
+
* The entry is matched by its LITERAL `metadata.name`; a slot holding anything
|
|
37
|
+
* but a `!ref`, or naming no entry, resolves to nothing — `validate-template-body`
|
|
38
|
+
* is what reports either. `Self.<entry>` is the explicit self-qualifier. */
|
|
39
|
+
export function dispatchTargetOf(definition, slot) {
|
|
40
|
+
const value = definition[slot];
|
|
41
|
+
if (!isRefSentinel(value))
|
|
42
|
+
return undefined;
|
|
43
|
+
const source = value.source;
|
|
44
|
+
const name = source.startsWith("Self.") ? source.slice("Self.".length) : source;
|
|
45
|
+
const bodies = definition.resources;
|
|
46
|
+
if (!Array.isArray(bodies))
|
|
47
|
+
return undefined;
|
|
48
|
+
for (const body of bodies) {
|
|
49
|
+
if (!body || typeof body !== "object")
|
|
50
|
+
continue;
|
|
51
|
+
const entry = body;
|
|
52
|
+
if (entry.metadata?.name !== name || typeof entry.kind !== "string")
|
|
53
|
+
continue;
|
|
54
|
+
return { entry, kind: entry.kind, name };
|
|
55
|
+
}
|
|
56
|
+
return undefined;
|
|
57
|
+
}
|
|
33
58
|
/** True when a CEL path lies at or inside a body's own subtree. */
|
|
34
59
|
export function pathInBody(path, prefix) {
|
|
35
60
|
return (path === prefix || path.startsWith(`${prefix}.`) || path.startsWith(`${prefix}[`));
|
package/dist/types.d.ts
CHANGED
|
@@ -9,6 +9,18 @@ export declare const DiagnosticSeverity: {
|
|
|
9
9
|
readonly Hint: 4;
|
|
10
10
|
};
|
|
11
11
|
export type DiagnosticSeverity = (typeof DiagnosticSeverity)[keyof typeof DiagnosticSeverity];
|
|
12
|
+
/** Matches LSP DiagnosticTag values exactly.
|
|
13
|
+
* https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#diagnosticTag
|
|
14
|
+
*
|
|
15
|
+
* Declared whole rather than trimmed to what Telo emits today, for the reason
|
|
16
|
+
* the severity ladder above is: it is someone else's closed vocabulary, and a
|
|
17
|
+
* partial copy of one is what drifts. `Unnecessary` (rendered faded) has an
|
|
18
|
+
* obvious future consumer in the unused-declaration checks. */
|
|
19
|
+
export declare const DiagnosticTag: {
|
|
20
|
+
readonly Unnecessary: 1;
|
|
21
|
+
readonly Deprecated: 2;
|
|
22
|
+
};
|
|
23
|
+
export type DiagnosticTag = (typeof DiagnosticTag)[keyof typeof DiagnosticTag];
|
|
12
24
|
/** Default entry-point filename when a directory is given instead of a file. */
|
|
13
25
|
export declare const DEFAULT_MANIFEST_FILENAME = "telo.yaml";
|
|
14
26
|
export interface Position {
|
|
@@ -65,6 +77,11 @@ export interface AnalysisDiagnostic {
|
|
|
65
77
|
/** e.g. "telo-analyzer" */
|
|
66
78
|
source?: string;
|
|
67
79
|
message: string;
|
|
80
|
+
/** What KIND of thing this is, orthogonal to how loudly it asks to be dealt
|
|
81
|
+
* with. A deprecation is warning-grade *and* a deprecation; severity alone
|
|
82
|
+
* can only say the first, which is why an editor renders a deprecated symbol
|
|
83
|
+
* struck through rather than merely yellow. */
|
|
84
|
+
tags?: DiagnosticTag[];
|
|
68
85
|
/** Telo-specific extras such as { resource: { kind, name }, path } */
|
|
69
86
|
data?: unknown;
|
|
70
87
|
}
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","s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EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,qBAAqB,EAAE,aAAa,CAAC,CAAC;CAC5E"}
|
package/dist/types.js
CHANGED
|
@@ -6,6 +6,17 @@ export const DiagnosticSeverity = {
|
|
|
6
6
|
Information: 3,
|
|
7
7
|
Hint: 4,
|
|
8
8
|
};
|
|
9
|
+
/** Matches LSP DiagnosticTag values exactly.
|
|
10
|
+
* https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#diagnosticTag
|
|
11
|
+
*
|
|
12
|
+
* Declared whole rather than trimmed to what Telo emits today, for the reason
|
|
13
|
+
* the severity ladder above is: it is someone else's closed vocabulary, and a
|
|
14
|
+
* partial copy of one is what drifts. `Unnecessary` (rendered faded) has an
|
|
15
|
+
* obvious future consumer in the unused-declaration checks. */
|
|
16
|
+
export const DiagnosticTag = {
|
|
17
|
+
Unnecessary: 1,
|
|
18
|
+
Deprecated: 2,
|
|
19
|
+
};
|
|
9
20
|
/** Default entry-point filename when a directory is given instead of a file. */
|
|
10
21
|
export const DEFAULT_MANIFEST_FILENAME = "telo.yaml";
|
|
11
22
|
/** Single reader for a diagnostic's fix, so no consumer re-derives the shape
|