@telorun/analyzer 0.1.3 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/dist/analyzer.d.ts +6 -0
- package/dist/analyzer.d.ts.map +1 -1
- package/dist/analyzer.js +45 -25
- package/dist/builtins.d.ts.map +1 -1
- package/dist/builtins.js +56 -24
- package/dist/cel-environment.d.ts +12 -5
- package/dist/cel-environment.d.ts.map +1 -1
- package/dist/cel-environment.js +31 -17
- package/dist/definition-registry.d.ts +5 -5
- package/dist/definition-registry.d.ts.map +1 -1
- package/dist/definition-registry.js +10 -10
- package/dist/dependency-graph.d.ts.map +1 -1
- package/dist/dependency-graph.js +9 -2
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/kernel-globals.d.ts +6 -2
- package/dist/kernel-globals.d.ts.map +1 -1
- package/dist/kernel-globals.js +14 -8
- package/dist/manifest-loader.d.ts +9 -1
- package/dist/manifest-loader.d.ts.map +1 -1
- package/dist/manifest-loader.js +165 -11
- package/dist/module-kinds.d.ts +4 -0
- package/dist/module-kinds.d.ts.map +1 -0
- package/dist/module-kinds.js +4 -0
- package/dist/normalize-inline-resources.d.ts.map +1 -1
- package/dist/normalize-inline-resources.js +6 -1
- package/dist/precompile.d.ts +3 -2
- package/dist/precompile.d.ts.map +1 -1
- package/dist/precompile.js +13 -11
- package/dist/reference-field-map.d.ts +1 -1
- package/dist/resolve-throws-union.d.ts +30 -0
- package/dist/resolve-throws-union.d.ts.map +1 -0
- package/dist/resolve-throws-union.js +252 -0
- package/dist/types.d.ts +11 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/validate-cel-context.js +1 -1
- package/dist/validate-references.d.ts.map +1 -1
- package/dist/validate-references.js +19 -12
- package/dist/validate-throws-coverage.d.ts +8 -0
- package/dist/validate-throws-coverage.d.ts.map +1 -0
- package/dist/validate-throws-coverage.js +461 -0
- package/package.json +3 -3
- package/src/analyzer.ts +60 -26
- package/src/builtins.ts +56 -24
- package/src/cel-environment.ts +40 -17
- package/src/definition-registry.ts +10 -10
- package/src/dependency-graph.ts +9 -2
- package/src/index.ts +2 -1
- package/src/kernel-globals.ts +19 -10
- package/src/manifest-loader.ts +202 -17
- package/src/module-kinds.ts +6 -0
- package/src/normalize-inline-resources.ts +6 -1
- package/src/precompile.ts +14 -11
- package/src/reference-field-map.ts +1 -1
- package/src/resolve-throws-union.ts +345 -0
- package/src/types.ts +13 -0
- package/src/validate-cel-context.ts +1 -1
- package/src/validate-references.ts +19 -12
- package/src/validate-throws-coverage.ts +565 -0
- package/dist/adapters/node-adapter.d.ts +0 -15
- package/dist/adapters/node-adapter.d.ts.map +0 -1
- package/dist/adapters/node-adapter.js +0 -33
- package/src/adapters/node-adapter.ts +0 -38
package/README.md
CHANGED
|
@@ -34,7 +34,7 @@ Manifests also support directives for dynamic generation: `$let`, `$if`, `$for`,
|
|
|
34
34
|
Here is an example Telo application that defines a simple HTTP API:
|
|
35
35
|
|
|
36
36
|
```yaml
|
|
37
|
-
kind:
|
|
37
|
+
kind: Telo.Application
|
|
38
38
|
metadata:
|
|
39
39
|
name: feedback
|
|
40
40
|
version: 1.0.0
|
|
@@ -45,12 +45,12 @@ targets:
|
|
|
45
45
|
- Migrations
|
|
46
46
|
- Server
|
|
47
47
|
---
|
|
48
|
-
kind:
|
|
48
|
+
kind: Telo.Import
|
|
49
49
|
metadata:
|
|
50
50
|
name: Http
|
|
51
51
|
source: ../modules/http-server
|
|
52
52
|
---
|
|
53
|
-
kind:
|
|
53
|
+
kind: Telo.Import
|
|
54
54
|
metadata:
|
|
55
55
|
name: Sql
|
|
56
56
|
source: ../modules/sql
|
package/dist/analyzer.d.ts
CHANGED
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
import type { ResourceManifest } from "@telorun/sdk";
|
|
2
2
|
import { AnalysisRegistry } from "./analysis-registry.js";
|
|
3
|
+
import { type CelHandlers } from "./cel-environment.js";
|
|
3
4
|
import { type AnalysisDiagnostic, type AnalysisOptions } from "./types.js";
|
|
5
|
+
export interface StaticAnalyzerOptions {
|
|
6
|
+
celHandlers?: CelHandlers;
|
|
7
|
+
}
|
|
4
8
|
export declare class StaticAnalyzer {
|
|
9
|
+
private readonly celEnv;
|
|
10
|
+
constructor(options?: StaticAnalyzerOptions);
|
|
5
11
|
analyze(manifests: ResourceManifest[], options?: AnalysisOptions, registry?: AnalysisRegistry): AnalysisDiagnostic[];
|
|
6
12
|
analyzeErrors(manifests: ResourceManifest[], options?: AnalysisOptions, registry?: AnalysisRegistry): AnalysisDiagnostic[];
|
|
7
13
|
normalize(manifests: ResourceManifest[], registry: AnalysisRegistry): ResourceManifest[];
|
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;
|
|
1
|
+
{"version":3,"file":"analyzer.d.ts","sourceRoot":"","sources":["../src/analyzer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAsB,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAGzE,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAGL,KAAK,WAAW,EACjB,MAAM,sBAAsB,CAAC;AAY9B,OAAO,EAAsB,KAAK,kBAAkB,EAAE,KAAK,eAAe,EAAE,MAAM,YAAY,CAAC;AAsP/F,MAAM,WAAW,qBAAqB;IACpC,WAAW,CAAC,EAAE,WAAW,CAAC;CAC3B;AAED,qBAAa,cAAc;IACzB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAc;gBAEzB,OAAO,GAAE,qBAA0B;IAI/C,OAAO,CACL,SAAS,EAAE,gBAAgB,EAAE,EAC7B,OAAO,CAAC,EAAE,eAAe,EACzB,QAAQ,CAAC,EAAE,gBAAgB,GAC1B,kBAAkB,EAAE;IA0PvB,aAAa,CACX,SAAS,EAAE,gBAAgB,EAAE,EAC7B,OAAO,CAAC,EAAE,eAAe,EACzB,QAAQ,CAAC,EAAE,gBAAgB,GAC1B,kBAAkB,EAAE;IAMvB,SAAS,CAAC,SAAS,EAAE,gBAAgB,EAAE,EAAE,QAAQ,EAAE,gBAAgB,GAAG,gBAAgB,EAAE;IAKxF,OAAO,CACL,SAAS,EAAE,gBAAgB,EAAE,EAC7B,QAAQ,EAAE,gBAAgB,GACzB;QAAE,WAAW,EAAE,kBAAkB,EAAE,CAAC;QAAC,KAAK,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;QAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE;CAiB5F"}
|
package/dist/analyzer.js
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import { AliasResolver } from "./alias-resolver.js";
|
|
2
|
-
import { buildTypedCelEnvironment,
|
|
2
|
+
import { buildCelEnvironment, buildTypedCelEnvironment, } from "./cel-environment.js";
|
|
3
3
|
import { DefinitionRegistry } from "./definition-registry.js";
|
|
4
4
|
import { buildDependencyGraph, formatCycle } from "./dependency-graph.js";
|
|
5
5
|
import { buildKernelGlobalsSchema, mergeKernelGlobalsIntoContext } from "./kernel-globals.js";
|
|
6
|
+
import { isModuleKind } from "./module-kinds.js";
|
|
6
7
|
import { normalizeInlineResources } from "./normalize-inline-resources.js";
|
|
7
8
|
import { celTypeSatisfiesJsonSchema, substituteCelFields, validateAgainstSchema, } from "./schema-compat.js";
|
|
8
9
|
import { DiagnosticSeverity } from "./types.js";
|
|
9
10
|
import { extractAccessChains, getManifestItem, pathMatchesScope, resolveContextAnnotations, resolveTypeFieldToSchema, validateChainAgainstSchema, } from "./validate-cel-context.js";
|
|
10
11
|
import { validateReferences } from "./validate-references.js";
|
|
12
|
+
import { validateThrowsCoverage } from "./validate-throws-coverage.js";
|
|
11
13
|
const TEMPLATE_REGEX = /\$\{\{\s*([^}]+?)\s*\}\}/g;
|
|
12
14
|
function walkCelExpressions(value, path, cb) {
|
|
13
15
|
if (typeof value === "string") {
|
|
@@ -133,19 +135,19 @@ const CEL_PURE_RE = /^\s*\$\{\{[^}]*\}\}\s*$/;
|
|
|
133
135
|
const CEL_EXPR_RE = /\$\{\{\s*([^}]+?)\s*\}\}/;
|
|
134
136
|
/** Recursively walk `data`+`schema` together, type-checking every pure CEL template
|
|
135
137
|
* string via `env.check()`. Returns `SchemaIssue[]` for any type mismatches found. */
|
|
136
|
-
function collectCelTypeIssues(data, schema, path, definition, manifest,
|
|
138
|
+
function collectCelTypeIssues(data, schema, path, definition, manifest, baseTypedEnv, rootEnv) {
|
|
137
139
|
const issues = [];
|
|
138
140
|
if (typeof data === "string" && CEL_PURE_RE.test(data)) {
|
|
139
141
|
const exprMatch = data.match(CEL_EXPR_RE);
|
|
140
142
|
if (exprMatch) {
|
|
141
143
|
const expr = exprMatch[1].trim();
|
|
142
144
|
// Merge x-telo-context variables for this path if applicable
|
|
143
|
-
let typedEnv =
|
|
145
|
+
let typedEnv = baseTypedEnv;
|
|
144
146
|
if (definition.schema) {
|
|
145
147
|
for (const ctx of extractContextsFromSchema(definition.schema)) {
|
|
146
148
|
if (!pathMatchesScope(path, ctx.scope))
|
|
147
149
|
continue;
|
|
148
|
-
typedEnv = buildTypedCelEnvironment(manifest, ctx.schema);
|
|
150
|
+
typedEnv = buildTypedCelEnvironment(rootEnv, manifest, ctx.schema);
|
|
149
151
|
break;
|
|
150
152
|
}
|
|
151
153
|
}
|
|
@@ -156,7 +158,16 @@ function collectCelTypeIssues(data, schema, path, definition, manifest, baseEnv)
|
|
|
156
158
|
catch {
|
|
157
159
|
/* degrade gracefully */
|
|
158
160
|
}
|
|
159
|
-
if (checkResult?.valid && checkResult.
|
|
161
|
+
if (checkResult?.valid === false && checkResult.error) {
|
|
162
|
+
// env.check() rejected the expression itself — e.g. wrong method, wrong
|
|
163
|
+
// argument types, wrong operator overload. Surface the first line of the
|
|
164
|
+
// error message; the tail is a source-code caret diagram we don't need.
|
|
165
|
+
const message = String(checkResult.error.message ?? checkResult.error)
|
|
166
|
+
.split("\n")[0]
|
|
167
|
+
.trim();
|
|
168
|
+
issues.push({ message: `CEL type error: ${message}`, path });
|
|
169
|
+
}
|
|
170
|
+
else if (checkResult?.valid && checkResult.type && schema) {
|
|
160
171
|
const celType = checkResult.type.split("<")[0];
|
|
161
172
|
if (!celTypeSatisfiesJsonSchema(celType, schema)) {
|
|
162
173
|
issues.push({
|
|
@@ -171,18 +182,22 @@ function collectCelTypeIssues(data, schema, path, definition, manifest, baseEnv)
|
|
|
171
182
|
if (Array.isArray(data)) {
|
|
172
183
|
const itemSchema = (schema.items ?? {});
|
|
173
184
|
for (let i = 0; i < data.length; i++) {
|
|
174
|
-
issues.push(...collectCelTypeIssues(data[i], itemSchema, `${path}[${i}]`, definition, manifest,
|
|
185
|
+
issues.push(...collectCelTypeIssues(data[i], itemSchema, `${path}[${i}]`, definition, manifest, baseTypedEnv, rootEnv));
|
|
175
186
|
}
|
|
176
187
|
}
|
|
177
188
|
else if (data !== null && typeof data === "object") {
|
|
178
189
|
const props = (schema.properties ?? {});
|
|
179
190
|
for (const [k, v] of Object.entries(data)) {
|
|
180
|
-
issues.push(...collectCelTypeIssues(v, (props[k] ?? {}), path ? `${path}.${k}` : k, definition, manifest,
|
|
191
|
+
issues.push(...collectCelTypeIssues(v, (props[k] ?? {}), path ? `${path}.${k}` : k, definition, manifest, baseTypedEnv, rootEnv));
|
|
181
192
|
}
|
|
182
193
|
}
|
|
183
194
|
return issues;
|
|
184
195
|
}
|
|
185
196
|
export class StaticAnalyzer {
|
|
197
|
+
celEnv;
|
|
198
|
+
constructor(options = {}) {
|
|
199
|
+
this.celEnv = buildCelEnvironment(options.celHandlers);
|
|
200
|
+
}
|
|
186
201
|
analyze(manifests, options, registry) {
|
|
187
202
|
const diagnostics = [];
|
|
188
203
|
// Use pre-seeded registries from the provided AnalysisRegistry, or create fresh ones.
|
|
@@ -192,18 +207,19 @@ export class StaticAnalyzer {
|
|
|
192
207
|
const aliases = ctx?.aliases ?? new AliasResolver();
|
|
193
208
|
const defs = ctx?.definitions ?? new DefinitionRegistry();
|
|
194
209
|
// Register module identities and aliases.
|
|
195
|
-
// The root
|
|
196
|
-
// identity
|
|
197
|
-
// by the loader (so we don't
|
|
198
|
-
//
|
|
210
|
+
// The root module doc (Telo.Application or Telo.Library) provides its own
|
|
211
|
+
// identity; imported modules surface their identity via resolvedModuleName/
|
|
212
|
+
// resolvedNamespace stamped onto the Telo.Import by the loader (so we don't
|
|
213
|
+
// need to include imported module manifests in the analysis set, avoiding false
|
|
214
|
+
// reference errors in the parent context).
|
|
199
215
|
for (const m of manifests) {
|
|
200
|
-
if (m.kind
|
|
216
|
+
if (isModuleKind(m.kind)) {
|
|
201
217
|
const namespace = m.metadata.namespace ?? null;
|
|
202
218
|
const moduleName = m.metadata.name;
|
|
203
219
|
if (moduleName)
|
|
204
220
|
defs.registerModuleIdentity(namespace, moduleName);
|
|
205
221
|
}
|
|
206
|
-
if (m.kind === "
|
|
222
|
+
if (m.kind === "Telo.Import") {
|
|
207
223
|
const alias = m.metadata.name;
|
|
208
224
|
const source = m.source;
|
|
209
225
|
const exportedKinds = m.exports?.kinds ?? [];
|
|
@@ -218,11 +234,11 @@ export class StaticAnalyzer {
|
|
|
218
234
|
}
|
|
219
235
|
}
|
|
220
236
|
}
|
|
221
|
-
// Register definitions from
|
|
237
|
+
// Register definitions from Telo.Definition resources.
|
|
222
238
|
// Normalize alias-prefixed `capability` to canonical form so extendedBy lookup works
|
|
223
239
|
// (e.g. "Workflow.Backend" → "workflow.Backend" when "Workflow" is a known alias).
|
|
224
240
|
for (const m of manifests) {
|
|
225
|
-
if (m.kind === "
|
|
241
|
+
if (m.kind === "Telo.Definition") {
|
|
226
242
|
const def = m;
|
|
227
243
|
const resolvedCapability = def.capability
|
|
228
244
|
? (aliases.resolveKind(def.capability) ?? def.capability)
|
|
@@ -244,17 +260,18 @@ export class StaticAnalyzer {
|
|
|
244
260
|
const kernelGlobals = buildKernelGlobalsSchema(allManifests);
|
|
245
261
|
// Validate each non-definition, non-system resource
|
|
246
262
|
for (const m of allManifests) {
|
|
263
|
+
const filePath = m.metadata?.source;
|
|
247
264
|
if (!m.kind || !m.metadata?.name) {
|
|
248
265
|
diagnostics.push({
|
|
249
266
|
severity: DiagnosticSeverity.Error,
|
|
250
267
|
code: "MISSING_KIND_OR_NAME",
|
|
251
268
|
source: SOURCE,
|
|
252
269
|
message: "Resource is missing required 'kind' or 'metadata.name' field.",
|
|
253
|
-
data: { path: !m.kind ? "kind" : "metadata.name" },
|
|
270
|
+
data: { filePath, path: !m.kind ? "kind" : "metadata.name" },
|
|
254
271
|
});
|
|
255
272
|
continue;
|
|
256
273
|
}
|
|
257
|
-
if (m.kind === "
|
|
274
|
+
if (m.kind === "Telo.Definition" || m.kind === "Telo.Abstract") {
|
|
258
275
|
continue;
|
|
259
276
|
}
|
|
260
277
|
const resource = { kind: m.kind, name: m.metadata?.name };
|
|
@@ -276,8 +293,8 @@ export class StaticAnalyzer {
|
|
|
276
293
|
severity: DiagnosticSeverity.Error,
|
|
277
294
|
code: "UNDEFINED_KIND",
|
|
278
295
|
source: SOURCE,
|
|
279
|
-
message: `No
|
|
280
|
-
data: { resource, path: "kind" },
|
|
296
|
+
message: `No Telo.Definition found for kind '${m.kind}'.${hint}`,
|
|
297
|
+
data: { resource, filePath, path: "kind" },
|
|
281
298
|
});
|
|
282
299
|
continue;
|
|
283
300
|
}
|
|
@@ -296,8 +313,8 @@ export class StaticAnalyzer {
|
|
|
296
313
|
}
|
|
297
314
|
: definition.schema;
|
|
298
315
|
// Phase 1: CEL type checking — walk data+schema together, check env.check() return types
|
|
299
|
-
const
|
|
300
|
-
const celIssues = collectCelTypeIssues(m, schema, "", definition, m,
|
|
316
|
+
const baseTypedEnv = buildTypedCelEnvironment(this.celEnv, m);
|
|
317
|
+
const celIssues = collectCelTypeIssues(m, schema, "", definition, m, baseTypedEnv, this.celEnv);
|
|
301
318
|
// Phase 2+3: AJV on substituted data — CEL fields replaced with typed placeholders
|
|
302
319
|
const ajvIssues = validateAgainstSchema(substituteCelFields(m, schema), schema);
|
|
303
320
|
const issues = [...celIssues, ...ajvIssues];
|
|
@@ -307,7 +324,7 @@ export class StaticAnalyzer {
|
|
|
307
324
|
code: "SCHEMA_VIOLATION",
|
|
308
325
|
source: SOURCE,
|
|
309
326
|
message: `${m.kind}/${resource.name}: ${issue.message}`,
|
|
310
|
-
data: { resource, path: issue.path },
|
|
327
|
+
data: { resource, filePath, path: issue.path },
|
|
311
328
|
});
|
|
312
329
|
}
|
|
313
330
|
}
|
|
@@ -316,6 +333,7 @@ export class StaticAnalyzer {
|
|
|
316
333
|
// Validate CEL syntax and context variable access in all manifests
|
|
317
334
|
for (const m of allManifests) {
|
|
318
335
|
const resource = { kind: m.kind, name: m.metadata?.name };
|
|
336
|
+
const filePath = m.metadata?.source;
|
|
319
337
|
const resolvedKind = aliases.resolveKind(m.kind);
|
|
320
338
|
const mDefinition = defs.resolve(m.kind) ?? (resolvedKind ? defs.resolve(resolvedKind) : undefined);
|
|
321
339
|
// Pre-compute step context for manifests with x-telo-step-context
|
|
@@ -325,7 +343,7 @@ export class StaticAnalyzer {
|
|
|
325
343
|
walkCelExpressions(m, "", (expr, path) => {
|
|
326
344
|
let parsed;
|
|
327
345
|
try {
|
|
328
|
-
parsed =
|
|
346
|
+
parsed = this.celEnv.parse(expr);
|
|
329
347
|
}
|
|
330
348
|
catch (e) {
|
|
331
349
|
diagnostics.push({
|
|
@@ -333,7 +351,7 @@ export class StaticAnalyzer {
|
|
|
333
351
|
code: "CEL_SYNTAX_ERROR",
|
|
334
352
|
source: SOURCE,
|
|
335
353
|
message: `CEL syntax error at ${path}: ${e instanceof Error ? e.message : String(e)}`,
|
|
336
|
-
data: { resource, path },
|
|
354
|
+
data: { resource, filePath, path },
|
|
337
355
|
});
|
|
338
356
|
return;
|
|
339
357
|
}
|
|
@@ -381,13 +399,15 @@ export class StaticAnalyzer {
|
|
|
381
399
|
code: "CEL_UNKNOWN_FIELD",
|
|
382
400
|
source: SOURCE,
|
|
383
401
|
message: `${m.kind}/${resource.name}: CEL at '${path}': ${err}`,
|
|
384
|
-
data: { resource, path },
|
|
402
|
+
data: { resource, filePath, path },
|
|
385
403
|
});
|
|
386
404
|
}
|
|
387
405
|
});
|
|
388
406
|
}
|
|
389
407
|
// Validate resource references (Phase 3)
|
|
390
408
|
diagnostics.push(...validateReferences(allManifests, { aliases, definitions: defs }));
|
|
409
|
+
// Validate throws: declarations and catches: coverage (rules 1, 2, 4, 7)
|
|
410
|
+
diagnostics.push(...validateThrowsCoverage(allManifests, defs, aliases, this.celEnv));
|
|
391
411
|
return diagnostics;
|
|
392
412
|
}
|
|
393
413
|
analyzeErrors(manifests, options, registry) {
|
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;AAEvD,eAAO,MAAM,eAAe,EAAE,kBAAkB,
|
|
1
|
+
{"version":3,"file":"builtins.d.ts","sourceRoot":"","sources":["../src/builtins.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAEvD,eAAO,MAAM,eAAe,EAAE,kBAAkB,EA4I/C,CAAC"}
|
package/dist/builtins.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
export const KERNEL_BUILTINS = [
|
|
2
|
-
{ kind: "
|
|
3
|
-
{ kind: "
|
|
4
|
-
{ kind: "
|
|
5
|
-
{ kind: "
|
|
6
|
-
{ kind: "
|
|
7
|
-
{ kind: "
|
|
2
|
+
{ kind: "Telo.Abstract", metadata: { name: "Template", module: "Telo" } },
|
|
3
|
+
{ kind: "Telo.Abstract", metadata: { name: "Runnable", module: "Telo" } },
|
|
4
|
+
{ kind: "Telo.Abstract", metadata: { name: "Service", module: "Telo" } },
|
|
5
|
+
{ kind: "Telo.Abstract", metadata: { name: "Invocable", module: "Telo" } },
|
|
6
|
+
{ kind: "Telo.Abstract", metadata: { name: "Mount", module: "Telo" } },
|
|
7
|
+
{ kind: "Telo.Abstract", metadata: { name: "Type", module: "Telo" } },
|
|
8
8
|
{
|
|
9
|
-
kind: "
|
|
10
|
-
metadata: { name: "Provider", module: "
|
|
9
|
+
kind: "Telo.Abstract",
|
|
10
|
+
metadata: { name: "Provider", module: "Telo" },
|
|
11
11
|
schema: { "x-telo-eval": "compile" },
|
|
12
12
|
},
|
|
13
13
|
{
|
|
14
|
-
kind: "
|
|
15
|
-
metadata: { name: "Abstract", module: "
|
|
16
|
-
capability: "
|
|
14
|
+
kind: "Telo.Definition",
|
|
15
|
+
metadata: { name: "Abstract", module: "Telo" },
|
|
16
|
+
capability: "Telo.Template",
|
|
17
17
|
schema: {
|
|
18
18
|
type: "object",
|
|
19
19
|
properties: {
|
|
@@ -31,15 +31,15 @@ export const KERNEL_BUILTINS = [
|
|
|
31
31
|
},
|
|
32
32
|
},
|
|
33
33
|
{
|
|
34
|
-
kind: "
|
|
35
|
-
metadata: { name: "Definition", module: "
|
|
36
|
-
capability: "
|
|
34
|
+
kind: "Telo.Definition",
|
|
35
|
+
metadata: { name: "Definition", module: "Telo" },
|
|
36
|
+
capability: "Telo.Template",
|
|
37
37
|
schema: { type: "object" },
|
|
38
38
|
},
|
|
39
39
|
{
|
|
40
|
-
kind: "
|
|
41
|
-
metadata: { name: "Import", module: "
|
|
42
|
-
capability: "
|
|
40
|
+
kind: "Telo.Definition",
|
|
41
|
+
metadata: { name: "Import", module: "Telo" },
|
|
42
|
+
capability: "Telo.Template",
|
|
43
43
|
schema: {
|
|
44
44
|
type: "object",
|
|
45
45
|
properties: {
|
|
@@ -59,9 +59,9 @@ export const KERNEL_BUILTINS = [
|
|
|
59
59
|
},
|
|
60
60
|
},
|
|
61
61
|
{
|
|
62
|
-
kind: "
|
|
63
|
-
metadata: { name: "
|
|
64
|
-
capability: "
|
|
62
|
+
kind: "Telo.Definition",
|
|
63
|
+
metadata: { name: "Application", module: "Telo" },
|
|
64
|
+
capability: "Telo.Template",
|
|
65
65
|
schema: {
|
|
66
66
|
type: "object",
|
|
67
67
|
properties: {
|
|
@@ -83,17 +83,49 @@ export const KERNEL_BUILTINS = [
|
|
|
83
83
|
default: "shared",
|
|
84
84
|
},
|
|
85
85
|
keepAlive: { type: "boolean", default: false },
|
|
86
|
-
variables: { type: "object" },
|
|
87
|
-
secrets: { type: "object" },
|
|
88
86
|
targets: {
|
|
89
87
|
type: "array",
|
|
90
88
|
items: {
|
|
91
89
|
anyOf: [
|
|
92
|
-
{ type: "string", "x-telo-ref": "
|
|
93
|
-
{ type: "string", "x-telo-ref": "
|
|
90
|
+
{ type: "string", "x-telo-ref": "telo#Runnable" },
|
|
91
|
+
{ type: "string", "x-telo-ref": "telo#Service" },
|
|
94
92
|
],
|
|
95
93
|
},
|
|
96
94
|
},
|
|
95
|
+
include: {
|
|
96
|
+
type: "array",
|
|
97
|
+
items: { type: "string" },
|
|
98
|
+
},
|
|
99
|
+
},
|
|
100
|
+
required: ["metadata"],
|
|
101
|
+
additionalProperties: false,
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
kind: "Telo.Definition",
|
|
106
|
+
metadata: { name: "Library", module: "Telo" },
|
|
107
|
+
capability: "Telo.Template",
|
|
108
|
+
schema: {
|
|
109
|
+
type: "object",
|
|
110
|
+
properties: {
|
|
111
|
+
kind: { type: "string" },
|
|
112
|
+
metadata: {
|
|
113
|
+
type: "object",
|
|
114
|
+
properties: {
|
|
115
|
+
name: { type: "string" },
|
|
116
|
+
version: { type: "string" },
|
|
117
|
+
source: { type: "string" },
|
|
118
|
+
module: { type: "string" },
|
|
119
|
+
},
|
|
120
|
+
required: ["name"],
|
|
121
|
+
additionalProperties: true,
|
|
122
|
+
},
|
|
123
|
+
variables: { type: "object" },
|
|
124
|
+
secrets: { type: "object" },
|
|
125
|
+
include: {
|
|
126
|
+
type: "array",
|
|
127
|
+
items: { type: "string" },
|
|
128
|
+
},
|
|
97
129
|
exports: {
|
|
98
130
|
type: "object",
|
|
99
131
|
properties: {
|
|
@@ -1,15 +1,22 @@
|
|
|
1
|
-
import type { ResourceManifest } from "@telorun/sdk";
|
|
2
1
|
import { Environment } from "@marcbachmann/cel-js";
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
import type { ResourceManifest } from "@telorun/sdk";
|
|
3
|
+
export interface CelHandlers {
|
|
4
|
+
sha256: (s: string) => string;
|
|
5
|
+
}
|
|
6
|
+
/** Build a CEL `Environment` with Telo's stdlib of functions. Always registers the
|
|
7
|
+
* same function signatures (so `env.check()` succeeds for type-inference) — the
|
|
8
|
+
* handlers govern what the function does when called at runtime. Analyzer-only
|
|
9
|
+
* callers can omit handlers; runtime callers (kernel) must supply real ones. */
|
|
10
|
+
export declare function buildCelEnvironment(handlers?: CelHandlers): Environment;
|
|
11
|
+
/** Clone `baseEnv` and register typed variable declarations so that
|
|
5
12
|
* `env.check(expr)` can infer return types for expressions referencing known variables.
|
|
6
13
|
*
|
|
7
14
|
* - `variables`: typed from the manifest's `variables` field if it is a schema map
|
|
8
|
-
* (only `
|
|
15
|
+
* (only module-identity docs — `Telo.Application` / `Telo.Library` — carry this); otherwise registered as `map` (dyn).
|
|
9
16
|
* - `secrets`, `resources`, `env`: always `map` (dyn — output schemas unknown).
|
|
10
17
|
* - `extraContextSchema`: additional variables from an `x-telo-context` annotation.
|
|
11
18
|
*
|
|
12
19
|
* NOTE: The set of kernel globals registered here must match `KERNEL_GLOBAL_NAMES`
|
|
13
20
|
* in kernel-globals.ts, which is used for chain-access validation. */
|
|
14
|
-
export declare function buildTypedCelEnvironment(manifest: ResourceManifest, extraContextSchema?: Record<string, any> | null): Environment;
|
|
21
|
+
export declare function buildTypedCelEnvironment(baseEnv: Environment, manifest: ResourceManifest, extraContextSchema?: Record<string, any> | null): Environment;
|
|
15
22
|
//# sourceMappingURL=cel-environment.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cel-environment.d.ts","sourceRoot":"","sources":["../src/cel-environment.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"cel-environment.d.ts","sourceRoot":"","sources":["../src/cel-environment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAGrD,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC;CAC/B;AAaD;;;iFAGiF;AACjF,wBAAgB,mBAAmB,CAAC,QAAQ,GAAE,WAA2B,GAAG,WAAW,CActF;AAED;;;;;;;;;uEASuE;AACvE,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,WAAW,EACpB,QAAQ,EAAE,gBAAgB,EAC1B,kBAAkB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,GAC9C,WAAW,CAyCb"}
|
package/dist/cel-environment.js
CHANGED
|
@@ -1,30 +1,44 @@
|
|
|
1
1
|
import { Environment } from "@marcbachmann/cel-js";
|
|
2
2
|
import { jsonSchemaToCelType } from "./schema-compat.js";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
3
|
+
const stub = (name) => () => {
|
|
4
|
+
throw new Error(`${name}() is not available in this environment. ` +
|
|
5
|
+
`Construct StaticAnalyzer or Loader with celHandlers to enable it.`);
|
|
6
|
+
};
|
|
7
|
+
const STUB_HANDLERS = {
|
|
8
|
+
sha256: stub("sha256"),
|
|
9
|
+
};
|
|
10
|
+
/** Build a CEL `Environment` with Telo's stdlib of functions. Always registers the
|
|
11
|
+
* same function signatures (so `env.check()` succeeds for type-inference) — the
|
|
12
|
+
* handlers govern what the function does when called at runtime. Analyzer-only
|
|
13
|
+
* callers can omit handlers; runtime callers (kernel) must supply real ones. */
|
|
14
|
+
export function buildCelEnvironment(handlers = STUB_HANDLERS) {
|
|
15
|
+
return new Environment({ unlistedVariablesAreDyn: true })
|
|
16
|
+
.registerFunction("join(list, string): string", (list, sep) => list.map(String).join(sep))
|
|
17
|
+
.registerFunction("keys(map): list", (map) => {
|
|
18
|
+
if (map instanceof Map)
|
|
19
|
+
return [...map.keys()];
|
|
20
|
+
return Object.keys(map);
|
|
21
|
+
})
|
|
22
|
+
.registerFunction("values(map): list", (map) => {
|
|
23
|
+
if (map instanceof Map)
|
|
24
|
+
return [...map.values()];
|
|
25
|
+
return Object.values(map);
|
|
26
|
+
})
|
|
27
|
+
.registerFunction("sha256(string): string", (s) => handlers.sha256(s));
|
|
28
|
+
}
|
|
29
|
+
/** Clone `baseEnv` and register typed variable declarations so that
|
|
16
30
|
* `env.check(expr)` can infer return types for expressions referencing known variables.
|
|
17
31
|
*
|
|
18
32
|
* - `variables`: typed from the manifest's `variables` field if it is a schema map
|
|
19
|
-
* (only `
|
|
33
|
+
* (only module-identity docs — `Telo.Application` / `Telo.Library` — carry this); otherwise registered as `map` (dyn).
|
|
20
34
|
* - `secrets`, `resources`, `env`: always `map` (dyn — output schemas unknown).
|
|
21
35
|
* - `extraContextSchema`: additional variables from an `x-telo-context` annotation.
|
|
22
36
|
*
|
|
23
37
|
* NOTE: The set of kernel globals registered here must match `KERNEL_GLOBAL_NAMES`
|
|
24
38
|
* in kernel-globals.ts, which is used for chain-access validation. */
|
|
25
|
-
export function buildTypedCelEnvironment(manifest, extraContextSchema) {
|
|
39
|
+
export function buildTypedCelEnvironment(baseEnv, manifest, extraContextSchema) {
|
|
26
40
|
try {
|
|
27
|
-
const env =
|
|
41
|
+
const env = baseEnv.clone();
|
|
28
42
|
// Build typed ObjectSchema from manifest.variables if it looks like a schema map
|
|
29
43
|
const vars = manifest.variables;
|
|
30
44
|
if (vars !== null && typeof vars === "object" && !Array.isArray(vars)) {
|
|
@@ -56,6 +70,6 @@ export function buildTypedCelEnvironment(manifest, extraContextSchema) {
|
|
|
56
70
|
return env;
|
|
57
71
|
}
|
|
58
72
|
catch {
|
|
59
|
-
return
|
|
73
|
+
return baseEnv.clone();
|
|
60
74
|
}
|
|
61
75
|
}
|
|
@@ -13,16 +13,16 @@ export declare class DefinitionRegistry {
|
|
|
13
13
|
/** Reverse inheritance index: parent kind → direct child kinds. */
|
|
14
14
|
private readonly extendedBy;
|
|
15
15
|
/** Module identity table: identity string → canonical module name.
|
|
16
|
-
* "
|
|
16
|
+
* "telo" → "Telo", "std/pipeline" → "pipeline", etc. */
|
|
17
17
|
private readonly identityMap;
|
|
18
18
|
/** Reverse identity table: canonical module name → full identity string.
|
|
19
|
-
* "
|
|
19
|
+
* "Telo" → "telo", "pipeline" → "std/pipeline", etc.
|
|
20
20
|
* Used to compute definition $id values for the AJV schema store. */
|
|
21
21
|
private readonly reverseIdentityMap;
|
|
22
22
|
register(definition: ResourceDefinition): void;
|
|
23
23
|
/** Register a module identity for x-telo-ref resolution.
|
|
24
|
-
* Call once per
|
|
25
|
-
* @param namespace The module's metadata.namespace (e.g. "std"), or null for
|
|
24
|
+
* Call once per module doc (Telo.Application or Telo.Library) when the manifest is loaded.
|
|
25
|
+
* @param namespace The module's metadata.namespace (e.g. "std"), or null for telo built-ins.
|
|
26
26
|
* @param moduleName The module's metadata.name (e.g. "pipeline", "http-server"). */
|
|
27
27
|
registerModuleIdentity(namespace: string | null, moduleName: string): void;
|
|
28
28
|
/** Computes the $id for a definition schema: "<identity>/<TypeName>".
|
|
@@ -36,7 +36,7 @@ export declare class DefinitionRegistry {
|
|
|
36
36
|
* Splits on "#", looks up the left side in the identity table, and returns
|
|
37
37
|
* "<canonicalModule>.<TypeName>".
|
|
38
38
|
*
|
|
39
|
-
* "
|
|
39
|
+
* "telo#Invocable" → "Telo.Invocable"
|
|
40
40
|
* "std/pipeline#Job" → "pipeline.Job"
|
|
41
41
|
* "std/http-server#Server" → "http-server.Server"
|
|
42
42
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"definition-registry.d.ts","sourceRoot":"","sources":["../src/definition-registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAEvD,OAAO,EAA0B,KAAK,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAG1F,+EAA+E;AAC/E,qBAAa,kBAAkB;;IAK7B;;sFAEkF;IAClF,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAe;IACnC,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAAqB;IAEzD,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAyC;IAC9D,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAwC;IAClE,mEAAmE;IACnE,OAAO,CAAC,QAAQ,CAAC,UAAU,CAA+B;IAC1D;
|
|
1
|
+
{"version":3,"file":"definition-registry.d.ts","sourceRoot":"","sources":["../src/definition-registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAEvD,OAAO,EAA0B,KAAK,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAG1F,+EAA+E;AAC/E,qBAAa,kBAAkB;;IAK7B;;sFAEkF;IAClF,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAe;IACnC,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAAqB;IAEzD,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAyC;IAC9D,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAwC;IAClE,mEAAmE;IACnE,OAAO,CAAC,QAAQ,CAAC,UAAU,CAA+B;IAC1D;6DACyD;IACzD,OAAO,CAAC,QAAQ,CAAC,WAAW,CAA6B;IACzD;;0EAEsE;IACtE,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAA6B;IAEhE,QAAQ,CAAC,UAAU,EAAE,kBAAkB,GAAG,IAAI;IAwB9C;;;yFAGqF;IACrF,sBAAsB,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,EAAE,UAAU,EAAE,MAAM,GAAG,IAAI;IAgB1E;4EACwE;IACxE,SAAS,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAMnE;wFACoF;IACpF,gBAAgB,CAAC,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM,EAAE;IAWtE,OAAO,CAAC,iBAAiB;IAczB;;;;;;;;4FAQwF;IACxF,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAUhD,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,kBAAkB,GAAG,SAAS;IAIrD,+FAA+F;IAC/F,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,iBAAiB,GAAG,SAAS;IAIxD,gGAAgG;IAChG,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;IAOhC;;qEAEiE;IACjE,YAAY,CAAC,YAAY,EAAE,MAAM,GAAG,kBAAkB,EAAE;IAgBxD,KAAK,IAAI,MAAM,EAAE;CAGlB"}
|
|
@@ -17,10 +17,10 @@ export class DefinitionRegistry {
|
|
|
17
17
|
/** Reverse inheritance index: parent kind → direct child kinds. */
|
|
18
18
|
extendedBy = new Map();
|
|
19
19
|
/** Module identity table: identity string → canonical module name.
|
|
20
|
-
* "
|
|
20
|
+
* "telo" → "Telo", "std/pipeline" → "pipeline", etc. */
|
|
21
21
|
identityMap = new Map();
|
|
22
22
|
/** Reverse identity table: canonical module name → full identity string.
|
|
23
|
-
* "
|
|
23
|
+
* "Telo" → "telo", "pipeline" → "std/pipeline", etc.
|
|
24
24
|
* Used to compute definition $id values for the AJV schema store. */
|
|
25
25
|
reverseIdentityMap = new Map();
|
|
26
26
|
register(definition) {
|
|
@@ -37,10 +37,10 @@ export class DefinitionRegistry {
|
|
|
37
37
|
this.extendedBy.set(definition.capability, [key]);
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
|
-
// Auto-register the
|
|
41
|
-
if (definition.kind === "
|
|
42
|
-
this.identityMap.set("
|
|
43
|
-
this.reverseIdentityMap.set("
|
|
40
|
+
// Auto-register the telo identity when any Telo built-in is registered.
|
|
41
|
+
if (definition.kind === "Telo.Abstract" && mod === "Telo") {
|
|
42
|
+
this.identityMap.set("telo", "Telo");
|
|
43
|
+
this.reverseIdentityMap.set("Telo", "telo");
|
|
44
44
|
}
|
|
45
45
|
// If identity is already known, register the schema in AJV immediately.
|
|
46
46
|
if (mod && definition.schema) {
|
|
@@ -48,11 +48,11 @@ export class DefinitionRegistry {
|
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
50
|
/** Register a module identity for x-telo-ref resolution.
|
|
51
|
-
* Call once per
|
|
52
|
-
* @param namespace The module's metadata.namespace (e.g. "std"), or null for
|
|
51
|
+
* Call once per module doc (Telo.Application or Telo.Library) when the manifest is loaded.
|
|
52
|
+
* @param namespace The module's metadata.namespace (e.g. "std"), or null for telo built-ins.
|
|
53
53
|
* @param moduleName The module's metadata.name (e.g. "pipeline", "http-server"). */
|
|
54
54
|
registerModuleIdentity(namespace, moduleName) {
|
|
55
|
-
const identity = namespace ? `${namespace}/${moduleName}` : "
|
|
55
|
+
const identity = namespace ? `${namespace}/${moduleName}` : "telo";
|
|
56
56
|
this.identityMap.set(identity, moduleName);
|
|
57
57
|
this.reverseIdentityMap.set(moduleName, identity);
|
|
58
58
|
// Retroactively register AJV schemas for definitions of this module already in the registry.
|
|
@@ -98,7 +98,7 @@ export class DefinitionRegistry {
|
|
|
98
98
|
* Splits on "#", looks up the left side in the identity table, and returns
|
|
99
99
|
* "<canonicalModule>.<TypeName>".
|
|
100
100
|
*
|
|
101
|
-
* "
|
|
101
|
+
* "telo#Invocable" → "Telo.Invocable"
|
|
102
102
|
* "std/pipeline#Job" → "pipeline.Job"
|
|
103
103
|
* "std/http-server#Server" → "http-server.Server"
|
|
104
104
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dependency-graph.d.ts","sourceRoot":"","sources":["../src/dependency-graph.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAGnE,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,eAAe;IAC9B;kDAC8C;IAC9C,KAAK,CAAC,EAAE,aAAa,CAAC,YAAY,CAAC,CAAC;IACpC;oFACgF;IAChF,KAAK,CAAC,EAAE,aAAa,CAAC,YAAY,CAAC,CAAC;CACrC;
|
|
1
|
+
{"version":3,"file":"dependency-graph.d.ts","sourceRoot":"","sources":["../src/dependency-graph.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAGnE,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,eAAe;IAC9B;kDAC8C;IAC9C,KAAK,CAAC,EAAE,aAAa,CAAC,YAAY,CAAC,CAAC;IACpC;oFACgF;IAChF,KAAK,CAAC,EAAE,aAAa,CAAC,YAAY,CAAC,CAAC;CACrC;AAcD;;;;;;;;;;;GAWG;AACH,wBAAgB,oBAAoB,CAClC,SAAS,EAAE,gBAAgB,EAAE,EAC7B,QAAQ,EAAE,kBAAkB,EAC5B,OAAO,CAAC,EAAE,aAAa,GACtB,eAAe,CAsFjB;AAED;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,aAAa,CAAC,YAAY,CAAC,GAAG,MAAM,CAOtE"}
|
package/dist/dependency-graph.js
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import { isRefEntry, isScopeEntry, resolveFieldValues } from "./reference-field-map.js";
|
|
2
|
-
/** System resource kinds that are not runtime nodes in the dependency graph.
|
|
3
|
-
|
|
2
|
+
/** System resource kinds that are not runtime nodes in the dependency graph.
|
|
3
|
+
* Module-identity docs (Telo.Application, Telo.Library) are intentionally
|
|
4
|
+
* not in this set: an Application's `targets` use `x-telo-ref` to real
|
|
5
|
+
* Runnable/Service resources, so the Application legitimately depends on
|
|
6
|
+
* them in boot order — modeling that as a graph edge is correct. A Library
|
|
7
|
+
* has no `targets`, so it becomes a zero-edge node, which is harmless.
|
|
8
|
+
* If the graph is ever consumed as "things to init", skip these kinds at
|
|
9
|
+
* the consumer site; the controller already runs them separately. */
|
|
10
|
+
const SYSTEM_KINDS = new Set(["Telo.Definition", "Telo.Import"]);
|
|
4
11
|
const nodeKey = (kind, name) => `${kind}\0${name}`;
|
|
5
12
|
/**
|
|
6
13
|
* Builds a directed acyclic graph (DAG) of runtime resource dependencies and
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
export { HttpAdapter } from "./adapters/http-adapter.js";
|
|
2
|
-
export { createNodeAdapter, NodeAdapter } from "./adapters/node-adapter.js";
|
|
3
2
|
export { RegistryAdapter } from "./adapters/registry-adapter.js";
|
|
4
3
|
export { AnalysisRegistry } from "./analysis-registry.js";
|
|
5
4
|
export { StaticAnalyzer } from "./analyzer.js";
|
|
6
5
|
export { Loader } from "./manifest-loader.js";
|
|
6
|
+
export { MODULE_KINDS, isModuleKind } from "./module-kinds.js";
|
|
7
|
+
export type { ModuleKind } from "./module-kinds.js";
|
|
7
8
|
export { DEFAULT_MANIFEST_FILENAME, DiagnosticSeverity } from "./types.js";
|
|
8
9
|
export type { AnalysisDiagnostic, AnalysisOptions, LoaderInitOptions, LoadOptions, ManifestAdapter, Position, PositionIndex, Range } from "./types.js";
|
|
9
10
|
//# sourceMappingURL=index.d.ts.map
|
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,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAC/D,YAAY,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,yBAAyB,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAC3E,YAAY,EACR,kBAAkB,EAClB,eAAe,EAAE,iBAAiB,EAAE,WAAW,EAAE,eAAe,EAChE,QAAQ,EACR,aAAa,EACb,KAAK,EACR,MAAM,YAAY,CAAC"}
|