@telorun/analyzer 0.46.0 → 0.48.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 +8 -2
- package/dist/artifact-layer-index.d.ts +55 -0
- package/dist/artifact-layer-index.d.ts.map +1 -0
- package/dist/artifact-layer-index.js +116 -0
- package/dist/artifact-selector.d.ts +81 -0
- package/dist/artifact-selector.d.ts.map +1 -0
- package/dist/artifact-selector.js +122 -0
- package/dist/builtins.d.ts.map +1 -1
- package/dist/builtins.js +58 -19
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/resolve-ref-sentinels.d.ts +13 -1
- package/dist/resolve-ref-sentinels.d.ts.map +1 -1
- package/dist/resolve-ref-sentinels.js +56 -5
- package/dist/validate-cel-context.d.ts.map +1 -1
- package/dist/validate-cel-context.js +17 -1
- package/dist/validate-module-artifact.d.ts +27 -0
- package/dist/validate-module-artifact.d.ts.map +1 -0
- package/dist/validate-module-artifact.js +131 -0
- package/dist/validate-references.d.ts.map +1 -1
- package/dist/validate-references.js +8 -2
- package/package.json +2 -2
- package/src/analyzer.ts +14 -2
- package/src/artifact-layer-index.ts +162 -0
- package/src/artifact-selector.ts +171 -0
- package/src/builtins.ts +61 -19
- package/src/index.ts +25 -0
- package/src/resolve-ref-sentinels.ts +68 -4
- package/src/validate-cel-context.ts +20 -1
- package/src/validate-module-artifact.ts +141 -0
- package/src/validate-references.ts +8 -2
package/dist/analyzer.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"analyzer.d.ts","sourceRoot":"","sources":["../src/analyzer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAsB,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAKzE,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAIL,KAAK,WA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AAA;KAAE;CAsB5F"}
|
package/dist/analyzer.js
CHANGED
|
@@ -24,6 +24,7 @@ import { extractAccessChains, extractCelRegionScopes, extractContextsFromSchema,
|
|
|
24
24
|
import { buildEvalPaths, evalPathsCover } from "./eval-paths.js";
|
|
25
25
|
import { validateExtends } from "./validate-extends.js";
|
|
26
26
|
import { validateLogging } from "./validate-logging.js";
|
|
27
|
+
import { validateModuleArtifact } from "./validate-module-artifact.js";
|
|
27
28
|
import { validateBaseMapping } from "./validate-base-mapping.js";
|
|
28
29
|
import { validateNestedInlineResources } from "./validate-nested-inline.js";
|
|
29
30
|
import { validateProviderCoherence } from "./validate-provider-coherence.js";
|
|
@@ -973,7 +974,7 @@ export class StaticAnalyzer {
|
|
|
973
974
|
// {kind, name} objects so downstream phases (validation, dependency graph,
|
|
974
975
|
// kernel controllers) see a uniform shape. Runs after normalize so both
|
|
975
976
|
// original and inline-extracted manifests have their sentinels resolved.
|
|
976
|
-
resolveRefSentinels(allManifests, aliases, aliasesByModule);
|
|
977
|
+
resolveRefSentinels(allManifests, aliases, aliasesByModule, [], defs);
|
|
977
978
|
// Phase 2.6: register each named `Telo.Type` resource's schema under its
|
|
978
979
|
// canonical module-scoped id (`telo://<module>/<name>`), validate
|
|
979
980
|
// `telo://Self|Alias/Type` schema refs resolve to one, then rewrite those
|
|
@@ -1015,6 +1016,11 @@ export class StaticAnalyzer {
|
|
|
1015
1016
|
// §14.1 / §10.3: redaction paths and `on_full: block` are statically
|
|
1016
1017
|
// detectable, so they fail `telo check` rather than only at boot.
|
|
1017
1018
|
diagnostics.push(...validateLogging(allManifests, defs, aliases, aliasesByModule));
|
|
1019
|
+
// Module-artifact surface: bundled-controller selector qualifiers and the
|
|
1020
|
+
// published `layers:` index. Every case is decidable from the manifest and
|
|
1021
|
+
// would otherwise fail on a consumer's machine — or, for a mistyped platform
|
|
1022
|
+
// axis, silently offer one platform's binary to every host.
|
|
1023
|
+
diagnostics.push(...validateModuleArtifact(allManifests));
|
|
1018
1024
|
}
|
|
1019
1025
|
resolveSchemaTypeRefs(allManifests, aliases, aliasesByModule);
|
|
1020
1026
|
// Trusted-input fast path: when the caller has already attested that
|
|
@@ -1642,7 +1648,7 @@ export class StaticAnalyzer {
|
|
|
1642
1648
|
// Resolve !ref sentinels after normalize so both the original and
|
|
1643
1649
|
// inline-extracted manifests get their refs canonicalized to
|
|
1644
1650
|
// {kind, name} for the kernel that consumes this output.
|
|
1645
|
-
resolveRefSentinels(normalized, ctx.aliases, ctx.aliasesByModule, crossModuleTargets ?? []);
|
|
1651
|
+
resolveRefSentinels(normalized, ctx.aliases, ctx.aliasesByModule, crossModuleTargets ?? [], ctx.definitions);
|
|
1646
1652
|
// Canonicalize import-scoped schema `$ref`s (`telo://Self|Alias/Type`) so the
|
|
1647
1653
|
// kernel that executes this output compiles inputs/outputs against the same
|
|
1648
1654
|
// ids the type controllers register their schemas under.
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The **layer index** of `kernel/specs/module-artifact.md` — the `layers:` block
|
|
3
|
+
* a published `telo.yaml` carries, listing every layer of the module artifact
|
|
4
|
+
* except the manifest layer itself.
|
|
5
|
+
*
|
|
6
|
+
* Why it lives in `telo.yaml` rather than in the OCI manifest, which has layers
|
|
7
|
+
* natively: a Telo import is pinned to a hash of `telo.yaml` and nothing else.
|
|
8
|
+
* The OCI manifest sits one level up, is fetched by a reference that is usually
|
|
9
|
+
* a mutable tag, and is never hashed by Telo — so digests held only there would
|
|
10
|
+
* leave the pin proving nothing about the payload. Pinning the OCI manifest
|
|
11
|
+
* instead is circular: `telo.yaml` is one of its layers.
|
|
12
|
+
*
|
|
13
|
+
* The manifest layer therefore has no entry — a hash of `telo.yaml` cannot sit
|
|
14
|
+
* inside `telo.yaml`. It is pinned by the importer's `#sha256-...` instead, so
|
|
15
|
+
* the chain reads `import pin -> telo.yaml -> blob digest -> layer contents`.
|
|
16
|
+
*
|
|
17
|
+
* Each entry carries two digests, answering different questions:
|
|
18
|
+
* - `blob` — the OCI blob digest over the pushed bytes. It *addresses* the
|
|
19
|
+
* layer, so a client pulls by digest and never reads the OCI layer list, and
|
|
20
|
+
* it verifies the transfer. Publish pushes payload blobs first and injects
|
|
21
|
+
* their digests here, then pushes the manifest blob, so nothing is circular.
|
|
22
|
+
* - `integrity` — the content digest (`computeFilesIntegrity`) over that
|
|
23
|
+
* layer's own files, independent of tar/gzip framing. It verifies what is
|
|
24
|
+
* already extracted on disk and can be re-derived from it without re-tarring,
|
|
25
|
+
* which is what makes a per-layer cache marker checkable.
|
|
26
|
+
*
|
|
27
|
+
* Browser-safe: `telo check`, the editor and the hub validate an index through
|
|
28
|
+
* this module; only the kernel fetches and extracts.
|
|
29
|
+
*/
|
|
30
|
+
import { type ArtifactSelector, type LayerRole, type PlatformTarget } from "./artifact-selector.js";
|
|
31
|
+
export interface ArtifactLayer {
|
|
32
|
+
role: LayerRole;
|
|
33
|
+
/** Present on `controller` layers only. */
|
|
34
|
+
selector?: ArtifactSelector;
|
|
35
|
+
/** OCI blob digest — addresses the layer and verifies the transfer. */
|
|
36
|
+
blob: string;
|
|
37
|
+
/** Content digest over the layer's files — verifies what is on disk. */
|
|
38
|
+
integrity: string;
|
|
39
|
+
}
|
|
40
|
+
export declare class LayerIndexError extends Error {
|
|
41
|
+
readonly code = "INVALID_LAYER_INDEX";
|
|
42
|
+
constructor(detail: string);
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Parse and validate a `layers:` value off an owner document. Order is
|
|
46
|
+
* preserved — when several controller layers match a target, precedence is
|
|
47
|
+
* declaration order, so the author controls it.
|
|
48
|
+
*/
|
|
49
|
+
export declare function parseLayerIndex(value: unknown, describe?: string): ArtifactLayer[];
|
|
50
|
+
/** The singleton layer for a role, or undefined when the artifact has none. */
|
|
51
|
+
export declare function singletonLayer(layers: readonly ArtifactLayer[], role: Exclude<LayerRole, "controller">): ArtifactLayer | undefined;
|
|
52
|
+
/** Every controller layer matching `target`, in declaration order. Used by
|
|
53
|
+
* `telo install` to warm a cache for one platform. */
|
|
54
|
+
export declare function matchControllerLayers(layers: readonly ArtifactLayer[], target: PlatformTarget): ArtifactLayer[];
|
|
55
|
+
//# sourceMappingURL=artifact-layer-index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"artifact-layer-index.d.ts","sourceRoot":"","sources":["../src/artifact-layer-index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,EAKL,KAAK,gBAAgB,EACrB,KAAK,SAAS,EACd,KAAK,cAAc,EACpB,MAAM,wBAAwB,CAAC;AAQhC,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,SAAS,CAAC;IAChB,2CAA2C;IAC3C,QAAQ,CAAC,EAAE,gBAAgB,CAAC;IAC5B,uEAAuE;IACvE,IAAI,EAAE,MAAM,CAAC;IACb,wEAAwE;IACxE,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,qBAAa,eAAgB,SAAQ,KAAK;IACxC,QAAQ,CAAC,IAAI,yBAAyB;gBAE1B,MAAM,EAAE,MAAM;CAI3B;AAiBD;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,SAAW,GAAG,aAAa,EAAE,CAyDpF;AAED,+EAA+E;AAC/E,wBAAgB,cAAc,CAC5B,MAAM,EAAE,SAAS,aAAa,EAAE,EAChC,IAAI,EAAE,OAAO,CAAC,SAAS,EAAE,YAAY,CAAC,GACrC,aAAa,GAAG,SAAS,CAE3B;AAED;uDACuD;AACvD,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,SAAS,aAAa,EAAE,EAChC,MAAM,EAAE,cAAc,GACrB,aAAa,EAAE,CAIjB"}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The **layer index** of `kernel/specs/module-artifact.md` — the `layers:` block
|
|
3
|
+
* a published `telo.yaml` carries, listing every layer of the module artifact
|
|
4
|
+
* except the manifest layer itself.
|
|
5
|
+
*
|
|
6
|
+
* Why it lives in `telo.yaml` rather than in the OCI manifest, which has layers
|
|
7
|
+
* natively: a Telo import is pinned to a hash of `telo.yaml` and nothing else.
|
|
8
|
+
* The OCI manifest sits one level up, is fetched by a reference that is usually
|
|
9
|
+
* a mutable tag, and is never hashed by Telo — so digests held only there would
|
|
10
|
+
* leave the pin proving nothing about the payload. Pinning the OCI manifest
|
|
11
|
+
* instead is circular: `telo.yaml` is one of its layers.
|
|
12
|
+
*
|
|
13
|
+
* The manifest layer therefore has no entry — a hash of `telo.yaml` cannot sit
|
|
14
|
+
* inside `telo.yaml`. It is pinned by the importer's `#sha256-...` instead, so
|
|
15
|
+
* the chain reads `import pin -> telo.yaml -> blob digest -> layer contents`.
|
|
16
|
+
*
|
|
17
|
+
* Each entry carries two digests, answering different questions:
|
|
18
|
+
* - `blob` — the OCI blob digest over the pushed bytes. It *addresses* the
|
|
19
|
+
* layer, so a client pulls by digest and never reads the OCI layer list, and
|
|
20
|
+
* it verifies the transfer. Publish pushes payload blobs first and injects
|
|
21
|
+
* their digests here, then pushes the manifest blob, so nothing is circular.
|
|
22
|
+
* - `integrity` — the content digest (`computeFilesIntegrity`) over that
|
|
23
|
+
* layer's own files, independent of tar/gzip framing. It verifies what is
|
|
24
|
+
* already extracted on disk and can be re-derived from it without re-tarring,
|
|
25
|
+
* which is what makes a per-layer cache marker checkable.
|
|
26
|
+
*
|
|
27
|
+
* Browser-safe: `telo check`, the editor and the hub validate an index through
|
|
28
|
+
* this module; only the kernel fetches and extracts.
|
|
29
|
+
*/
|
|
30
|
+
import { isLayerRole, normalizeSelector, selectorKey, selectorMatches, } from "./artifact-selector.js";
|
|
31
|
+
/** OCI content digest: `sha256:` + 64 lowercase hex. */
|
|
32
|
+
const BLOB_DIGEST = /^sha256:[0-9a-f]{64}$/;
|
|
33
|
+
/** Telo content digest: `sha256-` + unpadded base64url of 32 bytes. */
|
|
34
|
+
const CONTENT_DIGEST = /^sha256-[A-Za-z0-9_-]{43}$/;
|
|
35
|
+
export class LayerIndexError extends Error {
|
|
36
|
+
code = "INVALID_LAYER_INDEX";
|
|
37
|
+
constructor(detail) {
|
|
38
|
+
super(detail);
|
|
39
|
+
this.name = "LayerIndexError";
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
function digest(field, raw, describe) {
|
|
43
|
+
if (typeof raw !== "string" || raw === "") {
|
|
44
|
+
throw new LayerIndexError(`${describe}: ${field} is required and must be a string.`);
|
|
45
|
+
}
|
|
46
|
+
const pattern = field === "blob" ? BLOB_DIGEST : CONTENT_DIGEST;
|
|
47
|
+
if (!pattern.test(raw)) {
|
|
48
|
+
throw new LayerIndexError(field === "blob"
|
|
49
|
+
? `${describe}: blob '${raw}' is not an OCI digest (expected 'sha256:' + 64 hex characters).`
|
|
50
|
+
: `${describe}: integrity '${raw}' is not a content digest (expected 'sha256-' + 43 base64url characters).`);
|
|
51
|
+
}
|
|
52
|
+
return raw;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Parse and validate a `layers:` value off an owner document. Order is
|
|
56
|
+
* preserved — when several controller layers match a target, precedence is
|
|
57
|
+
* declaration order, so the author controls it.
|
|
58
|
+
*/
|
|
59
|
+
export function parseLayerIndex(value, describe = "layers") {
|
|
60
|
+
if (!Array.isArray(value)) {
|
|
61
|
+
throw new LayerIndexError(`${describe}: expected an array of layer entries.`);
|
|
62
|
+
}
|
|
63
|
+
const layers = [];
|
|
64
|
+
const seenSelectors = new Set();
|
|
65
|
+
const seenSingletons = new Set();
|
|
66
|
+
value.forEach((raw, index) => {
|
|
67
|
+
const where = `${describe}[${index}]`;
|
|
68
|
+
if (typeof raw !== "object" || raw === null || Array.isArray(raw)) {
|
|
69
|
+
throw new LayerIndexError(`${where}: expected an object.`);
|
|
70
|
+
}
|
|
71
|
+
const entry = raw;
|
|
72
|
+
if (!isLayerRole(entry.role)) {
|
|
73
|
+
throw new LayerIndexError(`${where}: role must be one of 'controller', 'assets', 'common'; got ` +
|
|
74
|
+
`${entry.role === undefined ? "nothing" : `'${String(entry.role)}'`}.`);
|
|
75
|
+
}
|
|
76
|
+
const role = entry.role;
|
|
77
|
+
let selector;
|
|
78
|
+
if (role === "controller") {
|
|
79
|
+
if (entry.selector === undefined) {
|
|
80
|
+
throw new LayerIndexError(`${where}: a controller layer must declare a selector.`);
|
|
81
|
+
}
|
|
82
|
+
selector = normalizeSelector(entry.selector, where);
|
|
83
|
+
const key = selectorKey(selector);
|
|
84
|
+
if (seenSelectors.has(key)) {
|
|
85
|
+
throw new LayerIndexError(`${where}: a second controller layer claims the selector ${key}. ` +
|
|
86
|
+
`Each selector addresses exactly one layer.`);
|
|
87
|
+
}
|
|
88
|
+
seenSelectors.add(key);
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
if (entry.selector !== undefined) {
|
|
92
|
+
throw new LayerIndexError(`${where}: a '${role}' layer must not declare a selector — it is a singleton.`);
|
|
93
|
+
}
|
|
94
|
+
if (seenSingletons.has(role)) {
|
|
95
|
+
throw new LayerIndexError(`${where}: a second '${role}' layer is declared.`);
|
|
96
|
+
}
|
|
97
|
+
seenSingletons.add(role);
|
|
98
|
+
}
|
|
99
|
+
layers.push({
|
|
100
|
+
role,
|
|
101
|
+
...(selector ? { selector } : {}),
|
|
102
|
+
blob: digest("blob", entry.blob, where),
|
|
103
|
+
integrity: digest("integrity", entry.integrity, where),
|
|
104
|
+
});
|
|
105
|
+
});
|
|
106
|
+
return layers;
|
|
107
|
+
}
|
|
108
|
+
/** The singleton layer for a role, or undefined when the artifact has none. */
|
|
109
|
+
export function singletonLayer(layers, role) {
|
|
110
|
+
return layers.find((l) => l.role === role);
|
|
111
|
+
}
|
|
112
|
+
/** Every controller layer matching `target`, in declaration order. Used by
|
|
113
|
+
* `telo install` to warm a cache for one platform. */
|
|
114
|
+
export function matchControllerLayers(layers, target) {
|
|
115
|
+
return layers.filter((l) => l.role === "controller" && l.selector !== undefined && selectorMatches(l.selector, target));
|
|
116
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The **selector** of `kernel/specs/module-artifact.md` — the tuple a bundled
|
|
3
|
+
* controller candidate is chosen by, and the key a controller layer of a module
|
|
4
|
+
* artifact is stored under.
|
|
5
|
+
*
|
|
6
|
+
* A selector is `format` plus the optional platform axes `os` / `arch` / `libc`.
|
|
7
|
+
* Matching is one rule, applied per axis: an axis the selector omits accepts
|
|
8
|
+
* anything, an axis it states must be equal. That is what lets a `js` controller
|
|
9
|
+
* be platform-neutral and a `napi` controller be pinned to one triple, with no
|
|
10
|
+
* special case for either.
|
|
11
|
+
*
|
|
12
|
+
* Browser-safe and dependency-free by construction. Three consumers must agree
|
|
13
|
+
* on this grammar or a published artifact stops loading: `telo publish`
|
|
14
|
+
* (partitioning files into layers), `telo install --platform` (deciding which
|
|
15
|
+
* layers to pre-fetch), and the kernel's bundle controller loader (matching a
|
|
16
|
+
* candidate against the host). Keeping it here — beside the redaction path
|
|
17
|
+
* parser, for the same reason — means one implementation rather than three that
|
|
18
|
+
* drift.
|
|
19
|
+
*
|
|
20
|
+
* PURL *syntax* is deliberately not parsed here. Callers hand in the format and
|
|
21
|
+
* an already-decoded qualifier map, so this module owns selector semantics while
|
|
22
|
+
* the caller owns its own package-URL library. The Node vocabulary is likewise
|
|
23
|
+
* not known here: `process.platform` / `process.arch` are mapped to the
|
|
24
|
+
* canonical OCI/GOOS names at the kernel boundary, since these values are
|
|
25
|
+
* published into OCI descriptors.
|
|
26
|
+
*/
|
|
27
|
+
/** The role a layer plays in a module artifact. `controller` layers carry a
|
|
28
|
+
* selector; `assets` and `common` are singletons and carry none. */
|
|
29
|
+
export type LayerRole = "controller" | "assets" | "common";
|
|
30
|
+
export declare const LAYER_ROLES: readonly LayerRole[];
|
|
31
|
+
export declare function isLayerRole(value: unknown): value is LayerRole;
|
|
32
|
+
/** The platform axes, in canonical order. Not a closed vocabulary of *values* —
|
|
33
|
+
* new architectures appear without a Telo release — only of axis names. */
|
|
34
|
+
export declare const PLATFORM_AXES: readonly ["os", "arch", "libc"];
|
|
35
|
+
export type PlatformAxis = (typeof PLATFORM_AXES)[number];
|
|
36
|
+
export interface ArtifactSelector {
|
|
37
|
+
/** Bundled controller format: the PURL name segment (`js`, `napi`, `wasm`, …). */
|
|
38
|
+
format: string;
|
|
39
|
+
os?: string;
|
|
40
|
+
arch?: string;
|
|
41
|
+
libc?: string;
|
|
42
|
+
}
|
|
43
|
+
/** What a selector is matched against: the host the kernel runs on, or the
|
|
44
|
+
* target `telo install --platform` is warming a cache for. An axis left
|
|
45
|
+
* undetermined (a host whose libc cannot be detected) matches no selector that
|
|
46
|
+
* constrains it — refusing to load is the safe direction for a native binary. */
|
|
47
|
+
export interface PlatformTarget {
|
|
48
|
+
format?: string;
|
|
49
|
+
os?: string;
|
|
50
|
+
arch?: string;
|
|
51
|
+
libc?: string;
|
|
52
|
+
}
|
|
53
|
+
export declare class ArtifactSelectorError extends Error {
|
|
54
|
+
readonly code = "INVALID_ARTIFACT_SELECTOR";
|
|
55
|
+
constructor(detail: string);
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Build a selector from a controller candidate's format and qualifier map.
|
|
59
|
+
* Qualifier keys other than the platform axes are ignored — `path` and the
|
|
60
|
+
* sibling list live in the same map and are not part of the selector.
|
|
61
|
+
*/
|
|
62
|
+
export declare function selectorFromQualifiers(format: unknown, qualifiers: Readonly<Record<string, unknown>> | undefined, describe?: string): ArtifactSelector;
|
|
63
|
+
/** Validate and normalize a selector read off a published layer index. */
|
|
64
|
+
export declare function normalizeSelector(value: unknown, describe?: string): ArtifactSelector;
|
|
65
|
+
/**
|
|
66
|
+
* The canonical stable key for a selector: sorted `axis=value` pairs joined by
|
|
67
|
+
* `;`. Used to group entry points into layers at publish time and to detect two
|
|
68
|
+
* layers claiming the same selector. Sorted and fully qualified so no two
|
|
69
|
+
* distinct selectors can collide and no one selector has two spellings.
|
|
70
|
+
*/
|
|
71
|
+
export declare function selectorKey(selector: ArtifactSelector): string;
|
|
72
|
+
/** Human-facing rendering for diagnostics and the publish partition printout. */
|
|
73
|
+
export declare function describeSelector(selector: ArtifactSelector): string;
|
|
74
|
+
/**
|
|
75
|
+
* The matching rule: every axis the selector states must equal the target's;
|
|
76
|
+
* every axis it omits accepts anything. A target axis left undetermined matches
|
|
77
|
+
* only a selector that does not constrain it — a host whose libc is unknown must
|
|
78
|
+
* not be handed a `libc=gnu` binary on the assumption it will run.
|
|
79
|
+
*/
|
|
80
|
+
export declare function selectorMatches(selector: ArtifactSelector, target: PlatformTarget): boolean;
|
|
81
|
+
//# sourceMappingURL=artifact-selector.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"artifact-selector.d.ts","sourceRoot":"","sources":["../src/artifact-selector.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH;qEACqE;AACrE,MAAM,MAAM,SAAS,GAAG,YAAY,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAE3D,eAAO,MAAM,WAAW,EAAE,SAAS,SAAS,EAAuC,CAAC;AAEpF,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,SAAS,CAE9D;AAED;4EAC4E;AAC5E,eAAO,MAAM,aAAa,iCAAkC,CAAC;AAE7D,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,CAAC,CAAC;AAE1D,MAAM,WAAW,gBAAgB;IAC/B,kFAAkF;IAClF,MAAM,EAAE,MAAM,CAAC;IACf,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;;kFAGkF;AAClF,MAAM,WAAW,cAAc;IAC7B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,qBAAa,qBAAsB,SAAQ,KAAK;IAC9C,QAAQ,CAAC,IAAI,+BAA+B;gBAEhC,MAAM,EAAE,MAAM;CAI3B;AAsBD;;;;GAIG;AACH,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,OAAO,EACf,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,SAAS,EACzD,QAAQ,SAAwB,GAC/B,gBAAgB,CAUlB;AAED,0EAA0E;AAC1E,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,OAAO,EACd,QAAQ,SAAmB,GAC1B,gBAAgB,CAelB;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,QAAQ,EAAE,gBAAgB,GAAG,MAAM,CAO9D;AAED,iFAAiF;AACjF,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,gBAAgB,GAAG,MAAM,CAKnE;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,gBAAgB,EAAE,MAAM,EAAE,cAAc,GAAG,OAAO,CAQ3F"}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The **selector** of `kernel/specs/module-artifact.md` — the tuple a bundled
|
|
3
|
+
* controller candidate is chosen by, and the key a controller layer of a module
|
|
4
|
+
* artifact is stored under.
|
|
5
|
+
*
|
|
6
|
+
* A selector is `format` plus the optional platform axes `os` / `arch` / `libc`.
|
|
7
|
+
* Matching is one rule, applied per axis: an axis the selector omits accepts
|
|
8
|
+
* anything, an axis it states must be equal. That is what lets a `js` controller
|
|
9
|
+
* be platform-neutral and a `napi` controller be pinned to one triple, with no
|
|
10
|
+
* special case for either.
|
|
11
|
+
*
|
|
12
|
+
* Browser-safe and dependency-free by construction. Three consumers must agree
|
|
13
|
+
* on this grammar or a published artifact stops loading: `telo publish`
|
|
14
|
+
* (partitioning files into layers), `telo install --platform` (deciding which
|
|
15
|
+
* layers to pre-fetch), and the kernel's bundle controller loader (matching a
|
|
16
|
+
* candidate against the host). Keeping it here — beside the redaction path
|
|
17
|
+
* parser, for the same reason — means one implementation rather than three that
|
|
18
|
+
* drift.
|
|
19
|
+
*
|
|
20
|
+
* PURL *syntax* is deliberately not parsed here. Callers hand in the format and
|
|
21
|
+
* an already-decoded qualifier map, so this module owns selector semantics while
|
|
22
|
+
* the caller owns its own package-URL library. The Node vocabulary is likewise
|
|
23
|
+
* not known here: `process.platform` / `process.arch` are mapped to the
|
|
24
|
+
* canonical OCI/GOOS names at the kernel boundary, since these values are
|
|
25
|
+
* published into OCI descriptors.
|
|
26
|
+
*/
|
|
27
|
+
export const LAYER_ROLES = ["controller", "assets", "common"];
|
|
28
|
+
export function isLayerRole(value) {
|
|
29
|
+
return typeof value === "string" && LAYER_ROLES.includes(value);
|
|
30
|
+
}
|
|
31
|
+
/** The platform axes, in canonical order. Not a closed vocabulary of *values* —
|
|
32
|
+
* new architectures appear without a Telo release — only of axis names. */
|
|
33
|
+
export const PLATFORM_AXES = ["os", "arch", "libc"];
|
|
34
|
+
export class ArtifactSelectorError extends Error {
|
|
35
|
+
code = "INVALID_ARTIFACT_SELECTOR";
|
|
36
|
+
constructor(detail) {
|
|
37
|
+
super(detail);
|
|
38
|
+
this.name = "ArtifactSelectorError";
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
/** Canonical token shape for every selector value. Lowercase, so the same
|
|
42
|
+
* platform written two ways is one layer rather than two. */
|
|
43
|
+
const TOKEN = /^[a-z0-9][a-z0-9_.-]*$/;
|
|
44
|
+
function normalizeToken(axis, raw, describe) {
|
|
45
|
+
if (typeof raw !== "string") {
|
|
46
|
+
throw new ArtifactSelectorError(`${describe}: ${axis} must be a string, got ${raw === null ? "null" : typeof raw}.`);
|
|
47
|
+
}
|
|
48
|
+
const value = raw.trim().toLowerCase();
|
|
49
|
+
if (!TOKEN.test(value)) {
|
|
50
|
+
throw new ArtifactSelectorError(`${describe}: ${axis} value '${raw}' is not a canonical token. ` +
|
|
51
|
+
`Use lowercase letters, digits, '.', '-' or '_', starting with a letter or digit.`);
|
|
52
|
+
}
|
|
53
|
+
return value;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Build a selector from a controller candidate's format and qualifier map.
|
|
57
|
+
* Qualifier keys other than the platform axes are ignored — `path` and the
|
|
58
|
+
* sibling list live in the same map and are not part of the selector.
|
|
59
|
+
*/
|
|
60
|
+
export function selectorFromQualifiers(format, qualifiers, describe = "controller selector") {
|
|
61
|
+
const selector = {
|
|
62
|
+
format: normalizeToken("format", format, describe),
|
|
63
|
+
};
|
|
64
|
+
for (const axis of PLATFORM_AXES) {
|
|
65
|
+
const raw = qualifiers?.[axis];
|
|
66
|
+
if (raw === undefined || raw === "")
|
|
67
|
+
continue;
|
|
68
|
+
selector[axis] = normalizeToken(axis, raw, describe);
|
|
69
|
+
}
|
|
70
|
+
return selector;
|
|
71
|
+
}
|
|
72
|
+
/** Validate and normalize a selector read off a published layer index. */
|
|
73
|
+
export function normalizeSelector(value, describe = "layer selector") {
|
|
74
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
75
|
+
throw new ArtifactSelectorError(`${describe}: expected an object of selector axes.`);
|
|
76
|
+
}
|
|
77
|
+
const record = value;
|
|
78
|
+
const unknown = Object.keys(record).filter((k) => k !== "format" && !PLATFORM_AXES.includes(k));
|
|
79
|
+
if (unknown.length > 0) {
|
|
80
|
+
throw new ArtifactSelectorError(`${describe}: unknown selector ${unknown.length === 1 ? "axis" : "axes"} ` +
|
|
81
|
+
`${unknown.map((k) => `'${k}'`).join(", ")}. Known axes: format, ${PLATFORM_AXES.join(", ")}.`);
|
|
82
|
+
}
|
|
83
|
+
return selectorFromQualifiers(record.format, record, describe);
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* The canonical stable key for a selector: sorted `axis=value` pairs joined by
|
|
87
|
+
* `;`. Used to group entry points into layers at publish time and to detect two
|
|
88
|
+
* layers claiming the same selector. Sorted and fully qualified so no two
|
|
89
|
+
* distinct selectors can collide and no one selector has two spellings.
|
|
90
|
+
*/
|
|
91
|
+
export function selectorKey(selector) {
|
|
92
|
+
const pairs = [`format=${selector.format}`];
|
|
93
|
+
for (const axis of PLATFORM_AXES) {
|
|
94
|
+
const value = selector[axis];
|
|
95
|
+
if (value !== undefined)
|
|
96
|
+
pairs.push(`${axis}=${value}`);
|
|
97
|
+
}
|
|
98
|
+
return pairs.sort().join(";");
|
|
99
|
+
}
|
|
100
|
+
/** Human-facing rendering for diagnostics and the publish partition printout. */
|
|
101
|
+
export function describeSelector(selector) {
|
|
102
|
+
const platform = PLATFORM_AXES.map((axis) => selector[axis]).filter((v) => v !== undefined);
|
|
103
|
+
return platform.length === 0 ? selector.format : `${selector.format} (${platform.join("/")})`;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* The matching rule: every axis the selector states must equal the target's;
|
|
107
|
+
* every axis it omits accepts anything. A target axis left undetermined matches
|
|
108
|
+
* only a selector that does not constrain it — a host whose libc is unknown must
|
|
109
|
+
* not be handed a `libc=gnu` binary on the assumption it will run.
|
|
110
|
+
*/
|
|
111
|
+
export function selectorMatches(selector, target) {
|
|
112
|
+
if (target.format !== undefined && selector.format !== target.format)
|
|
113
|
+
return false;
|
|
114
|
+
for (const axis of PLATFORM_AXES) {
|
|
115
|
+
const constraint = selector[axis];
|
|
116
|
+
if (constraint === undefined)
|
|
117
|
+
continue;
|
|
118
|
+
if (target[axis] !== constraint)
|
|
119
|
+
return false;
|
|
120
|
+
}
|
|
121
|
+
return true;
|
|
122
|
+
}
|
package/dist/builtins.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"builtins.d.ts","sourceRoot":"","sources":["../src/builtins.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"builtins.d.ts","sourceRoot":"","sources":["../src/builtins.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AA2JvD,eAAO,MAAM,eAAe,EAAE,kBAAkB,EA0nB/C,CAAC"}
|
package/dist/builtins.js
CHANGED
|
@@ -20,6 +20,50 @@ const PROVENANCE_METADATA = {
|
|
|
20
20
|
license: { type: "string" },
|
|
21
21
|
documentation: { type: "string" },
|
|
22
22
|
};
|
|
23
|
+
/** Author-declared subset of `files:` that ships in the artifact's lazily
|
|
24
|
+
* materialized `assets` layer. Optional: an unclaimed file joins the `common`
|
|
25
|
+
* layer, which is pulled alongside any controller layer, so omitting this costs
|
|
26
|
+
* laziness rather than correctness. See kernel/specs/module-artifact.md. */
|
|
27
|
+
const ASSETS_FILES_SCHEMA = {
|
|
28
|
+
type: "array",
|
|
29
|
+
items: { type: "string" },
|
|
30
|
+
};
|
|
31
|
+
/** The published layer index, written by `telo publish` (never hand-authored).
|
|
32
|
+
* One entry per layer except the manifest layer, which cannot list its own hash
|
|
33
|
+
* inside itself and is pinned by the importer's `#sha256-...` instead. Shape and
|
|
34
|
+
* matching rules are normative in kernel/specs/module-artifact.md; the parser
|
|
35
|
+
* that enforces them is `artifact-layer-index.ts`. */
|
|
36
|
+
const LAYER_INDEX_SCHEMA = {
|
|
37
|
+
type: "array",
|
|
38
|
+
items: {
|
|
39
|
+
type: "object",
|
|
40
|
+
required: ["role", "blob", "integrity"],
|
|
41
|
+
properties: {
|
|
42
|
+
role: { type: "string", enum: ["controller", "assets", "common"] },
|
|
43
|
+
selector: {
|
|
44
|
+
type: "object",
|
|
45
|
+
required: ["format"],
|
|
46
|
+
properties: {
|
|
47
|
+
format: { type: "string" },
|
|
48
|
+
os: { type: "string" },
|
|
49
|
+
arch: { type: "string" },
|
|
50
|
+
libc: { type: "string" },
|
|
51
|
+
},
|
|
52
|
+
additionalProperties: false,
|
|
53
|
+
},
|
|
54
|
+
blob: { type: "string", pattern: "^sha256:[0-9a-f]{64}$" },
|
|
55
|
+
integrity: { type: "string", pattern: "^sha256-[A-Za-z0-9_-]{43}$" },
|
|
56
|
+
},
|
|
57
|
+
additionalProperties: false,
|
|
58
|
+
},
|
|
59
|
+
};
|
|
60
|
+
/** The pre-layers payload digest, superseded by the per-layer `integrity` values
|
|
61
|
+
* in `layers:`. Accepted and ignored, for one reason only: a module published in
|
|
62
|
+
* the old single-blob shape must reach the *actionable* failure — the controller
|
|
63
|
+
* loader's "republish the module" error — instead of dying earlier on
|
|
64
|
+
* `must NOT have additional properties`, which tells an author nothing. Nothing
|
|
65
|
+
* reads this field. */
|
|
66
|
+
const LEGACY_FILES_INTEGRITY_SCHEMA = { type: "string" };
|
|
23
67
|
/** The six named levels of `kernel/specs/logging.md` §5.1. The full 1–24 OTel
|
|
24
68
|
* range stays valid on the wire; only these are nameable in a manifest. */
|
|
25
69
|
const LOG_LEVEL_ENUM = ["trace", "debug", "info", "warn", "error", "fatal"];
|
|
@@ -520,21 +564,18 @@ export const KERNEL_BUILTINS = [
|
|
|
520
564
|
type: "array",
|
|
521
565
|
items: { type: "string" },
|
|
522
566
|
},
|
|
523
|
-
// Files bundled alongside `telo.yaml` into the module's
|
|
524
|
-
//
|
|
525
|
-
//
|
|
526
|
-
//
|
|
527
|
-
//
|
|
528
|
-
// reads the assets. See kernel/nodejs/plans/bundle-controllers.md.
|
|
567
|
+
// Files bundled alongside `telo.yaml` into the module's artifact —
|
|
568
|
+
// controller bundles, static assets served by Http.Static, templates,
|
|
569
|
+
// etc. Ordered `.gitignore`-style patterns resolved against the manifest
|
|
570
|
+
// dir at publish time. Analyzer-only role: accept the field (the schema
|
|
571
|
+
// is additionalProperties:false); the analyzer never reads the payload.
|
|
529
572
|
files: {
|
|
530
573
|
type: "array",
|
|
531
574
|
items: { type: "string" },
|
|
532
575
|
},
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
// extract time. See plans/federated-registries.md.
|
|
537
|
-
filesIntegrity: { type: "string" },
|
|
576
|
+
assets: ASSETS_FILES_SCHEMA,
|
|
577
|
+
layers: LAYER_INDEX_SCHEMA,
|
|
578
|
+
filesIntegrity: LEGACY_FILES_INTEGRITY_SCHEMA,
|
|
538
579
|
// Inline imports — name-keyed map sugar for separate `Telo.Import`
|
|
539
580
|
// documents. The key is the PascalCase alias (the import's
|
|
540
581
|
// `metadata.name`). Each value is either a bare source string
|
|
@@ -671,18 +712,16 @@ export const KERNEL_BUILTINS = [
|
|
|
671
712
|
type: "array",
|
|
672
713
|
items: { type: "string" },
|
|
673
714
|
},
|
|
674
|
-
// Files bundled into the module's
|
|
675
|
-
//
|
|
676
|
-
// templates, migrations, seed data).
|
|
715
|
+
// Files bundled into the module's artifact — same semantics as the
|
|
716
|
+
// Telo.Application `files` field above (a library may ship bundled
|
|
717
|
+
// controllers, templates, migrations, seed data).
|
|
677
718
|
files: {
|
|
678
719
|
type: "array",
|
|
679
720
|
items: { type: "string" },
|
|
680
721
|
},
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
// extract time. See plans/federated-registries.md.
|
|
685
|
-
filesIntegrity: { type: "string" },
|
|
722
|
+
assets: ASSETS_FILES_SCHEMA,
|
|
723
|
+
layers: LAYER_INDEX_SCHEMA,
|
|
724
|
+
filesIntegrity: LEGACY_FILES_INTEGRITY_SCHEMA,
|
|
686
725
|
// Inline imports — same name-keyed map sugar as Telo.Application; the
|
|
687
726
|
// loader desugars each entry into a synthetic Telo.Import. See the
|
|
688
727
|
// Application schema above and analyzer/nodejs/src/inline-imports.ts.
|
package/dist/index.d.ts
CHANGED
|
@@ -44,6 +44,11 @@ export type { ParsedVersionedRef } from "./sources/versioned-ref.js";
|
|
|
44
44
|
export { isLocalPathSource } from "./sources/local-path-ref.js";
|
|
45
45
|
export { MANIFEST_CACHE_BASE_URL, ManifestCacheSource, isHttpsModuleRef, manifestCacheKey, manifestCacheUrl, ociManifestCacheCoords, urlManifestCacheCoords, } from "./sources/manifest-cache.js";
|
|
46
46
|
export type { ManifestCacheCoords } from "./sources/manifest-cache.js";
|
|
47
|
+
export { LAYER_ROLES, PLATFORM_AXES, ArtifactSelectorError, describeSelector, isLayerRole, normalizeSelector, selectorFromQualifiers, selectorKey, selectorMatches, } from "./artifact-selector.js";
|
|
48
|
+
export type { ArtifactSelector, LayerRole, PlatformAxis, PlatformTarget, } from "./artifact-selector.js";
|
|
49
|
+
export { LayerIndexError, matchControllerLayers, parseLayerIndex, singletonLayer, } from "./artifact-layer-index.js";
|
|
50
|
+
export type { ArtifactLayer } from "./artifact-layer-index.js";
|
|
51
|
+
export { validateModuleArtifact } from "./validate-module-artifact.js";
|
|
47
52
|
export { withSyntheticPositions } from "./with-synthetic-positions.js";
|
|
48
53
|
export { documentToAst, parseToAst } from "./yaml-ast.js";
|
|
49
54
|
export type { AstDocument, AstMap, AstNode, AstPair, AstScalar, AstSeq } from "./yaml-ast.js";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,YAAY,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,2BAA2B,EAAE,MAAM,oCAAoC,CAAC;AACjF,YAAY,EACR,cAAc,EACd,UAAU,EACV,UAAU,EACV,WAAW,EACX,YAAY,EACZ,UAAU,GACb,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACH,kBAAkB,EAClB,mBAAmB,EACnB,wBAAwB,EACxB,gBAAgB,EAChB,wBAAwB,EACxB,oBAAoB,EACpB,gCAAgC,EAChC,kBAAkB,EAClB,oBAAoB,EACpB,KAAK,iBAAiB,EACtB,KAAK,YAAY,GACpB,MAAM,2BAA2B,CAAC;A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AAC;AAC9F,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC5D,YAAY,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AACxD,OAAO,EAAE,yBAAyB,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAC3E,YAAY,EACR,kBAAkB,EAClB,eAAe,EACf,iBAAiB,EACjB,WAAW,EACX,cAAc,EACd,QAAQ,EACR,aAAa,EACb,KAAK,EACR,MAAM,YAAY,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -26,6 +26,9 @@ export { OCI_SCHEME, isOciRef, parseOciRef } from "./sources/oci-ref.js";
|
|
|
26
26
|
export { parseVersionedRef, withRefVersion } from "./sources/versioned-ref.js";
|
|
27
27
|
export { isLocalPathSource } from "./sources/local-path-ref.js";
|
|
28
28
|
export { MANIFEST_CACHE_BASE_URL, ManifestCacheSource, isHttpsModuleRef, manifestCacheKey, manifestCacheUrl, ociManifestCacheCoords, urlManifestCacheCoords, } from "./sources/manifest-cache.js";
|
|
29
|
+
export { LAYER_ROLES, PLATFORM_AXES, ArtifactSelectorError, describeSelector, isLayerRole, normalizeSelector, selectorFromQualifiers, selectorKey, selectorMatches, } from "./artifact-selector.js";
|
|
30
|
+
export { LayerIndexError, matchControllerLayers, parseLayerIndex, singletonLayer, } from "./artifact-layer-index.js";
|
|
31
|
+
export { validateModuleArtifact } from "./validate-module-artifact.js";
|
|
29
32
|
export { withSyntheticPositions } from "./with-synthetic-positions.js";
|
|
30
33
|
export { documentToAst, parseToAst } from "./yaml-ast.js";
|
|
31
34
|
export { buildCelSegments, wrapCelAst } from "./cel-ast.js";
|
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
import type { ResourceManifest } from "@telorun/sdk";
|
|
2
2
|
import type { AliasResolver } from "./alias-resolver.js";
|
|
3
|
+
import { type ReferenceFieldMap } from "./reference-field-map.js";
|
|
4
|
+
/** The slice of the definition registry this pass needs: a kind's field map, from
|
|
5
|
+
* which the `x-telo-scope` slots are read. */
|
|
6
|
+
export interface ScopeFieldMapSource {
|
|
7
|
+
getFieldMapForKind(kind: string, aliases?: {
|
|
8
|
+
resolveKind(k: string): string | undefined;
|
|
9
|
+
}): ReferenceFieldMap | undefined;
|
|
10
|
+
}
|
|
3
11
|
/**
|
|
4
12
|
* Rewrites every `!ref <name>` sentinel in each non-system resource's value tree
|
|
5
13
|
* to `{kind, name}` (local) or `{kind, name, alias}` (cross-module), in place.
|
|
@@ -36,5 +44,9 @@ import type { AliasResolver } from "./alias-resolver.js";
|
|
|
36
44
|
* `metadata.module` that isn't a root module) are resolution TARGETS only — they are not
|
|
37
45
|
* re-walked as sources here, since their own ref slots belong to their own module scope.
|
|
38
46
|
*/
|
|
39
|
-
export declare function resolveRefSentinels(resources: ResourceManifest[], aliases?: AliasResolver, aliasesByModule?: Map<string, AliasResolver>, crossModuleTargets?: ResourceManifest[]
|
|
47
|
+
export declare function resolveRefSentinels(resources: ResourceManifest[], aliases?: AliasResolver, aliasesByModule?: Map<string, AliasResolver>, crossModuleTargets?: ResourceManifest[],
|
|
48
|
+
/** Supplies each kind's `x-telo-scope` slots. Without it a scoped name cannot be
|
|
49
|
+
* told from a module-level one, and a shadowed `!ref` resolves to the resource
|
|
50
|
+
* it shadows — so both call sites pass it. */
|
|
51
|
+
defs?: ScopeFieldMapSource): void;
|
|
40
52
|
//# sourceMappingURL=resolve-ref-sentinels.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolve-ref-sentinels.d.ts","sourceRoot":"","sources":["../src/resolve-ref-sentinels.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAErD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"resolve-ref-sentinels.d.ts","sourceRoot":"","sources":["../src/resolve-ref-sentinels.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAErD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAGL,KAAK,iBAAiB,EACvB,MAAM,0BAA0B,CAAC;AAGlC;+CAC+C;AAC/C,MAAM,WAAW,mBAAmB;IAClC,kBAAkB,CAChB,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE;QAAE,WAAW,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAA;KAAE,GACvD,iBAAiB,GAAG,SAAS,CAAC;CAClC;AAMD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,wBAAgB,mBAAmB,CACjC,SAAS,EAAE,gBAAgB,EAAE,EAC7B,OAAO,CAAC,EAAE,aAAa,EACvB,eAAe,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,aAAa,CAAC,EAK5C,kBAAkB,GAAE,gBAAgB,EAAO;AAC3C;;+CAE+C;AAC/C,IAAI,CAAC,EAAE,mBAAmB,GACzB,IAAI,CA8HN"}
|