@telorun/analyzer 0.56.1 → 0.58.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 +5 -0
- package/dist/analyzer.d.ts.map +1 -1
- package/dist/analyzer.js +232 -94
- package/dist/cel-environment.d.ts.map +1 -1
- package/dist/cel-environment.js +6 -3
- package/dist/definition-registry.d.ts +5 -0
- package/dist/definition-registry.d.ts.map +1 -1
- package/dist/definition-registry.js +9 -0
- package/dist/index.d.ts +14 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -3
- package/dist/invocation-contract.d.ts +21 -13
- package/dist/invocation-contract.d.ts.map +1 -1
- package/dist/invocation-contract.js +43 -46
- package/dist/loaded-types.d.ts +13 -0
- package/dist/loaded-types.d.ts.map +1 -1
- package/dist/manifest-loader.d.ts +8 -1
- package/dist/manifest-loader.d.ts.map +1 -1
- package/dist/manifest-loader.js +33 -6
- package/dist/manifest-visitor.d.ts +4 -0
- package/dist/manifest-visitor.d.ts.map +1 -1
- package/dist/manifest-visitor.js +3 -3
- package/dist/migrations/driver.d.ts +69 -0
- package/dist/migrations/driver.d.ts.map +1 -0
- package/dist/migrations/driver.js +200 -0
- package/dist/migrations/entries/index.d.ts +3 -0
- package/dist/migrations/entries/index.d.ts.map +1 -0
- package/dist/migrations/entries/index.js +9 -0
- package/dist/migrations/entries/normalize-value-types.json +48 -0
- package/dist/migrations/entries/ref-slot-scalar-type.json +20 -0
- package/dist/migrations/entry-data.d.ts +25 -0
- package/dist/migrations/entry-data.d.ts.map +1 -0
- package/dist/migrations/entry-data.js +171 -0
- package/dist/migrations/index.d.ts +22 -0
- package/dist/migrations/index.d.ts.map +1 -0
- package/dist/migrations/index.js +19 -0
- package/dist/migrations/match.d.ts +162 -0
- package/dist/migrations/match.d.ts.map +1 -0
- package/dist/migrations/match.js +295 -0
- package/dist/migrations/patch.d.ts +68 -0
- package/dist/migrations/patch.d.ts.map +1 -0
- package/dist/migrations/patch.js +236 -0
- package/dist/migrations/provenance.d.ts +25 -0
- package/dist/migrations/provenance.d.ts.map +1 -0
- package/dist/migrations/provenance.js +118 -0
- package/dist/migrations/registry.d.ts +35 -0
- package/dist/migrations/registry.d.ts.map +1 -0
- package/dist/migrations/registry.js +35 -0
- package/dist/migrations/report.d.ts +28 -0
- package/dist/migrations/report.d.ts.map +1 -0
- package/dist/migrations/report.js +144 -0
- package/dist/migrations/types.d.ts +115 -0
- package/dist/migrations/types.d.ts.map +1 -0
- package/dist/migrations/types.js +24 -0
- package/dist/migrations/yaml-edit.d.ts +21 -0
- package/dist/migrations/yaml-edit.d.ts.map +1 -0
- package/dist/migrations/yaml-edit.js +245 -0
- package/dist/module-file-claims.d.ts +65 -0
- package/dist/module-file-claims.d.ts.map +1 -0
- package/dist/module-file-claims.js +106 -0
- package/dist/parse-loaded-file.d.ts +8 -0
- package/dist/parse-loaded-file.d.ts.map +1 -1
- package/dist/parse-loaded-file.js +22 -13
- package/dist/resolve-schema-type-refs.d.ts +29 -12
- package/dist/resolve-schema-type-refs.d.ts.map +1 -1
- package/dist/resolve-schema-type-refs.js +89 -16
- package/dist/schema-compat.d.ts +35 -9
- package/dist/schema-compat.d.ts.map +1 -1
- package/dist/schema-compat.js +181 -54
- package/dist/schema-region.d.ts +33 -0
- package/dist/schema-region.d.ts.map +1 -0
- package/dist/schema-region.js +45 -0
- package/dist/types.d.ts +51 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +6 -0
- package/dist/validate-cel-context.d.ts.map +1 -1
- package/dist/validate-cel-context.js +29 -3
- package/dist/validate-include-placement.d.ts +26 -0
- package/dist/validate-include-placement.d.ts.map +1 -0
- package/dist/validate-include-placement.js +67 -0
- package/dist/validate-step-inputs.d.ts +8 -1
- package/dist/validate-step-inputs.d.ts.map +1 -1
- package/dist/validate-step-inputs.js +47 -2
- package/dist/validate-throws-coverage.d.ts.map +1 -1
- package/dist/validate-throws-coverage.js +15 -12
- package/dist/validate-value-type-slots.d.ts +43 -0
- package/dist/validate-value-type-slots.d.ts.map +1 -0
- package/dist/validate-value-type-slots.js +142 -0
- package/dist/value-type-keyword.d.ts +60 -0
- package/dist/value-type-keyword.d.ts.map +1 -0
- package/dist/value-type-keyword.js +119 -0
- package/dist/yaml-source-edit.d.ts +56 -0
- package/dist/yaml-source-edit.d.ts.map +1 -0
- package/dist/yaml-source-edit.js +93 -0
- package/package.json +4 -3
- package/src/analyzer.ts +276 -129
- package/src/cel-environment.ts +6 -3
- package/src/definition-registry.ts +10 -0
- package/src/index.ts +31 -3
- package/src/invocation-contract.ts +43 -48
- package/src/loaded-types.ts +13 -0
- package/src/manifest-loader.ts +37 -6
- package/src/manifest-visitor.ts +11 -3
- package/src/migrations/driver.ts +262 -0
- package/src/migrations/entries/index.ts +10 -0
- package/src/migrations/entries/normalize-value-types.json +48 -0
- package/src/migrations/entries/ref-slot-scalar-type.json +20 -0
- package/src/migrations/entry-data.ts +207 -0
- package/src/migrations/index.ts +22 -0
- package/src/migrations/match.ts +382 -0
- package/src/migrations/patch.ts +265 -0
- package/src/migrations/provenance.ts +167 -0
- package/src/migrations/registry.ts +40 -0
- package/src/migrations/report.ts +169 -0
- package/src/migrations/types.ts +144 -0
- package/src/migrations/yaml-edit.ts +260 -0
- package/src/module-file-claims.ts +168 -0
- package/src/parse-loaded-file.ts +31 -12
- package/src/resolve-schema-type-refs.ts +93 -16
- package/src/schema-compat.ts +218 -62
- package/src/schema-region.ts +46 -0
- package/src/types.ts +54 -0
- package/src/validate-cel-context.ts +36 -3
- package/src/validate-include-placement.ts +70 -0
- package/src/validate-step-inputs.ts +56 -1
- package/src/validate-throws-coverage.ts +16 -11
- package/src/validate-value-type-slots.ts +182 -0
- package/src/value-type-keyword.ts +135 -0
- package/src/yaml-source-edit.ts +106 -0
- package/dist/binary-slot.d.ts +0 -39
- package/dist/binary-slot.d.ts.map +0 -1
- package/dist/binary-slot.js +0 -58
- package/src/binary-slot.ts +0 -71
package/src/binary-slot.ts
DELETED
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import * as AjvNS from "ajv";
|
|
2
|
-
import type { KeywordDefinition } from "ajv";
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* `x-telo-binary: true` — the annotation that gives a byte buffer a declared
|
|
6
|
-
* identity, and the single accessor every surface reads it through (the
|
|
7
|
-
* `ref-slot.ts` precedent).
|
|
8
|
-
*
|
|
9
|
-
* WHY AN ANNOTATION RATHER THAN A TYPE. Bytes are not expressible in JSON
|
|
10
|
-
* Schema's type vocabulary. `type: object` is the closest fit and it is a lie
|
|
11
|
-
* that costs a real check: every arbitrary object satisfies it, so a mistyped
|
|
12
|
-
* `content: { foo: bar }` reaches the controller instead of failing statically.
|
|
13
|
-
* `type: binary` would fix the honesty and break everything else — AJV refuses
|
|
14
|
-
* to compile an unknown type at all (`type must be JSONType or JSONType[]`),
|
|
15
|
-
* with no option to allow it, so the schema would produce no validator; and a
|
|
16
|
-
* published `telo.yaml` would stop being JSON Schema, which is what the hub, the
|
|
17
|
-
* editor and any third-party reader consume. An `x-` keyword is ignored by
|
|
18
|
-
* unaware tooling BY SPECIFICATION, so it degrades to "unconstrained" rather
|
|
19
|
-
* than to "cannot validate this kind at all".
|
|
20
|
-
*
|
|
21
|
-
* ONE RULE, BOTH HALVES. The keyword is implemented as AJV CODEGEN rather than a
|
|
22
|
-
* `validate` function so it inlines into standalone-compiled validators — the
|
|
23
|
-
* kernel compiles and caches those, and a function-valued keyword would not
|
|
24
|
-
* survive serialization. The analyzer registers the identical keyword, and
|
|
25
|
-
* `celPlaceholderForSchema` hands a real `Uint8Array` to a CEL leaf at a binary
|
|
26
|
-
* slot, so static and runtime agree by construction instead of by two rules kept
|
|
27
|
-
* in step. What falls out is the check the annotation exists for: **bytes can
|
|
28
|
-
* never be manifest-authored** — no YAML literal is a `Uint8Array` — so a literal
|
|
29
|
-
* at a binary slot is rejected while a value arriving by reference passes.
|
|
30
|
-
*/
|
|
31
|
-
|
|
32
|
-
export const X_TELO_BINARY = "x-telo-binary";
|
|
33
|
-
|
|
34
|
-
/** True when this schema node declares its value to be raw bytes. */
|
|
35
|
-
export function isBinarySlot(schema: unknown): boolean {
|
|
36
|
-
return (
|
|
37
|
-
typeof schema === "object" &&
|
|
38
|
-
schema !== null &&
|
|
39
|
-
(schema as Record<string, unknown>)[X_TELO_BINARY] === true
|
|
40
|
-
);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
// AJV's codegen template tag. The package is consumed in both ESM and CJS interop
|
|
44
|
-
// shapes, so the named export may sit on the namespace or behind `.default` —
|
|
45
|
-
// the same fallback `schema-compat` uses to reach the constructor. Skipping it
|
|
46
|
-
// would leave `codegen` undefined under a loader that does not detect AJV's named
|
|
47
|
-
// CJS re-exports, and the keyword would throw on its first compile.
|
|
48
|
-
type CodegenTag = (s: TemplateStringsArray, ...a: unknown[]) => unknown;
|
|
49
|
-
const ajvExports = (AjvNS as any).default ?? AjvNS;
|
|
50
|
-
const codegen: CodegenTag = ajvExports._ ?? (AjvNS as any)._;
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* The AJV keyword. `Uint8Array` is the structural test rather than any richer
|
|
54
|
-
* notion of "binary": it is what every byte producer in the runtime hands over
|
|
55
|
-
* (`Buffer` extends it, so Node buffers pass), and it is the one check that means
|
|
56
|
-
* the same thing in a browser-side analyzer and in the kernel.
|
|
57
|
-
*/
|
|
58
|
-
export function binaryKeyword(): KeywordDefinition {
|
|
59
|
-
return {
|
|
60
|
-
keyword: X_TELO_BINARY,
|
|
61
|
-
schemaType: "boolean",
|
|
62
|
-
code(cxt: any) {
|
|
63
|
-
// `x-telo-binary: false` states nothing, so it constrains nothing.
|
|
64
|
-
if (cxt.schema !== true) return;
|
|
65
|
-
cxt.pass(codegen`${cxt.data} instanceof Uint8Array`);
|
|
66
|
-
},
|
|
67
|
-
error: {
|
|
68
|
-
message: "must be raw bytes (a Uint8Array) — bytes cannot be written inline in a manifest",
|
|
69
|
-
},
|
|
70
|
-
} as KeywordDefinition;
|
|
71
|
-
}
|