@telorun/analyzer 0.58.0 → 0.60.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 +9 -2
- package/dist/analyzer.d.ts.map +1 -1
- package/dist/analyzer.js +38 -10
- package/dist/builtins.d.ts.map +1 -1
- package/dist/builtins.js +16 -42
- package/dist/cel-environment.d.ts.map +1 -1
- package/dist/cel-environment.js +35 -0
- package/dist/flatten-for-analyzer.d.ts +4 -0
- package/dist/flatten-for-analyzer.d.ts.map +1 -1
- package/dist/flatten-for-analyzer.js +8 -0
- package/dist/index.d.ts +6 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -2
- package/dist/invocation-contract.d.ts +37 -0
- package/dist/invocation-contract.d.ts.map +1 -1
- package/dist/invocation-contract.js +81 -1
- package/dist/kernel-globals.d.ts +1 -1
- package/dist/kernel-globals.d.ts.map +1 -1
- package/dist/kernel-globals.js +15 -1
- package/dist/manifest-schemas.d.ts +407 -0
- package/dist/manifest-schemas.d.ts.map +1 -0
- package/dist/manifest-schemas.js +396 -0
- package/dist/module-file-claims.d.ts +6 -0
- package/dist/module-file-claims.d.ts.map +1 -1
- package/dist/module-file-claims.js +4 -0
- package/dist/module-metadata-scope.d.ts +44 -0
- package/dist/module-metadata-scope.d.ts.map +1 -0
- package/dist/module-metadata-scope.js +82 -0
- package/dist/parse-loaded-file.d.ts.map +1 -1
- package/dist/parse-loaded-file.js +16 -0
- package/dist/release/bump-level.d.ts +46 -0
- package/dist/release/bump-level.d.ts.map +1 -0
- package/dist/release/bump-level.js +80 -0
- package/dist/release/changelog.d.ts +36 -0
- package/dist/release/changelog.d.ts.map +1 -0
- package/dist/release/changelog.js +53 -0
- package/dist/release/fragment.d.ts +48 -0
- package/dist/release/fragment.d.ts.map +1 -0
- package/dist/release/fragment.js +84 -0
- package/dist/release/index.d.ts +26 -0
- package/dist/release/index.d.ts.map +1 -0
- package/dist/release/index.js +18 -0
- package/dist/release/ledger.d.ts +53 -0
- package/dist/release/ledger.d.ts.map +1 -0
- package/dist/release/ledger.js +109 -0
- package/dist/release/payload-digest.d.ts +63 -0
- package/dist/release/payload-digest.d.ts.map +1 -0
- package/dist/release/payload-digest.js +65 -0
- package/dist/release/release-plan.d.ts +128 -0
- package/dist/release/release-plan.d.ts.map +1 -0
- package/dist/release/release-plan.js +277 -0
- package/dist/release/version-stamp.d.ts +50 -0
- package/dist/release/version-stamp.d.ts.map +1 -0
- package/dist/release/version-stamp.js +119 -0
- package/dist/release/workspace-config.d.ts +41 -0
- package/dist/release/workspace-config.d.ts.map +1 -0
- package/dist/release/workspace-config.js +60 -0
- package/dist/schema-compat.d.ts +18 -0
- package/dist/schema-compat.d.ts.map +1 -1
- package/dist/schema-compat.js +71 -7
- package/dist/validate-cel-context.d.ts.map +1 -1
- package/dist/validate-cel-context.js +69 -13
- package/dist/validate-step-inputs.d.ts +1 -1
- package/dist/validate-step-inputs.d.ts.map +1 -1
- package/dist/validate-step-inputs.js +99 -8
- package/package.json +3 -3
- package/src/analyzer.ts +41 -10
- package/src/builtins.ts +16 -42
- package/src/cel-environment.ts +37 -0
- package/src/flatten-for-analyzer.ts +12 -0
- package/src/index.ts +18 -3
- package/src/invocation-contract.ts +92 -1
- package/src/kernel-globals.ts +23 -1
- package/src/manifest-schemas.ts +408 -0
- package/src/module-file-claims.ts +10 -0
- package/src/module-metadata-scope.ts +88 -0
- package/src/parse-loaded-file.ts +16 -0
- package/src/release/bump-level.ts +95 -0
- package/src/release/changelog.ts +62 -0
- package/src/release/fragment.ts +130 -0
- package/src/release/index.ts +66 -0
- package/src/release/ledger.ts +142 -0
- package/src/release/payload-digest.ts +83 -0
- package/src/release/release-plan.ts +392 -0
- package/src/release/version-stamp.ts +142 -0
- package/src/release/workspace-config.ts +81 -0
- package/src/schema-compat.ts +69 -5
- package/src/validate-cel-context.ts +82 -13
- package/src/validate-step-inputs.ts +109 -9
package/dist/analyzer.d.ts
CHANGED
|
@@ -27,8 +27,15 @@ export declare function containerOf(path: string): string;
|
|
|
27
27
|
* Non-refs and unresolved refs pass through unchanged. */
|
|
28
28
|
export declare function resolveLocalRef(schema: Record<string, any> | undefined, root: Record<string, any>): Record<string, any> | undefined;
|
|
29
29
|
/** Gather property schemas from a (possibly variant-bearing) object schema:
|
|
30
|
-
* top-level `properties` plus every `oneOf` / `anyOf` / `allOf` branch.
|
|
31
|
-
|
|
30
|
+
* top-level `properties` plus every `oneOf` / `anyOf` / `allOf` branch.
|
|
31
|
+
*
|
|
32
|
+
* Each branch is resolved through {@link resolveLocalRef} first, so a branch
|
|
33
|
+
* that points at a shared shape — a `oneOf` arm that IS the kernel's dispatch
|
|
34
|
+
* site — contributes its properties like an inline one. Without that, pointing a
|
|
35
|
+
* composer at a shared shape would silently empty every role-driven lookup that
|
|
36
|
+
* reads this (the inputs slot, the retry policy, the eval paths), which is a
|
|
37
|
+
* failure with no diagnostic attached to it. */
|
|
38
|
+
export declare function gatherPropertySchemas(schema: Record<string, any>, root?: Record<string, any>): Array<[string, Record<string, any>]>;
|
|
32
39
|
/**
|
|
33
40
|
* Generic, role-driven walk over an `x-telo-step-context` step array. Calls
|
|
34
41
|
* `visit(step, stepPath)` for every step — top-level and nested through the
|
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,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAWzE,OAAO,EACL,aAAa,EAEb,KAAK,YAAY,EAElB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAIL,KAAK,WAAW,EACjB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAE9D,OAAO,EACL,KAAK,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AAe,CAAC,EAAE,eAAe,GAChC,kBAAkB,EAAE;IAq7CvB,aAAa,CACX,SAAS,EAAE,gBAAgB,EAAE,EAC7B,OAAO,CAAC,EAAE,eAAe,EACzB,QAAQ,CAAC,EAAE,gBAAgB,EAC3B,eAAe,CAAC,EAAE,eAAe,GAChC,kBAAkB,EAAE;IAMvB,SAAS,CACP,SAAS,EAAE,gBAAgB,EAAE,EAC7B,QAAQ,EAAE,gBAAgB,EAI1B,kBAAkB,CAAC,EAAE,gBAAgB,EAAE,GACtC,gBAAgB,EAAE;IAyBrB,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;CAsB5F"}
|
package/dist/analyzer.js
CHANGED
|
@@ -17,6 +17,7 @@ import { REF_VALIDATION_SKIP_KINDS } from "./system-kinds.js";
|
|
|
17
17
|
import { resolveRefSentinels } from "./resolve-ref-sentinels.js";
|
|
18
18
|
import { resolveSchemaRefKinds } from "./resolve-schema-ref-kinds.js";
|
|
19
19
|
import { runZoneAnalysis } from "./resolve-zone-requirements.js";
|
|
20
|
+
import { MANIFEST_SCHEMA_URI, ManifestRootSchema } from "./manifest-schemas.js";
|
|
20
21
|
import { validateZoneSlotDeclarations } from "./validate-zone-slots.js";
|
|
21
22
|
import { validateDynamicSelectors, validateRefSlotDeclarations, } from "./validate-ref-slots.js";
|
|
22
23
|
import { validateValueTypeSlots, } from "./validate-value-type-slots.js";
|
|
@@ -201,23 +202,48 @@ export function resolveLocalRef(schema, root) {
|
|
|
201
202
|
if (resolved && typeof resolved === "object")
|
|
202
203
|
return resolved;
|
|
203
204
|
}
|
|
205
|
+
// A kernel-owned structural fragment (`telo://manifest#/$defs/InvokeStep`).
|
|
206
|
+
// Resolved HERE rather than by each walker: this is the one chokepoint every
|
|
207
|
+
// structural walk already goes through — the step-array walks, the call graph,
|
|
208
|
+
// the zone projection, the eval-path collector — so a composer that points at a
|
|
209
|
+
// shared shape stays legible to all of them at once. Nothing is inlined into
|
|
210
|
+
// the stored schema, which keeps validator-cache identity stable and matches
|
|
211
|
+
// what `resolveSchemaTypeRefs` does for a named user type.
|
|
212
|
+
if (typeof ref === "string" && ref.startsWith(BUILTIN_FRAGMENT_PREFIX)) {
|
|
213
|
+
const defName = ref.slice(BUILTIN_FRAGMENT_PREFIX.length);
|
|
214
|
+
const resolved = ManifestRootSchema.$defs[defName];
|
|
215
|
+
if (resolved && typeof resolved === "object")
|
|
216
|
+
return resolved;
|
|
217
|
+
}
|
|
204
218
|
return schema;
|
|
205
219
|
}
|
|
220
|
+
const BUILTIN_FRAGMENT_PREFIX = `${MANIFEST_SCHEMA_URI}#/$defs/`;
|
|
206
221
|
/** Gather property schemas from a (possibly variant-bearing) object schema:
|
|
207
|
-
* top-level `properties` plus every `oneOf` / `anyOf` / `allOf` branch.
|
|
208
|
-
|
|
222
|
+
* top-level `properties` plus every `oneOf` / `anyOf` / `allOf` branch.
|
|
223
|
+
*
|
|
224
|
+
* Each branch is resolved through {@link resolveLocalRef} first, so a branch
|
|
225
|
+
* that points at a shared shape — a `oneOf` arm that IS the kernel's dispatch
|
|
226
|
+
* site — contributes its properties like an inline one. Without that, pointing a
|
|
227
|
+
* composer at a shared shape would silently empty every role-driven lookup that
|
|
228
|
+
* reads this (the inputs slot, the retry policy, the eval paths), which is a
|
|
229
|
+
* failure with no diagnostic attached to it. */
|
|
230
|
+
export function gatherPropertySchemas(schema, root) {
|
|
209
231
|
const out = [];
|
|
210
|
-
|
|
211
|
-
|
|
232
|
+
const base = resolveLocalRef(schema, root ?? schema) ?? schema;
|
|
233
|
+
if (base.properties && typeof base.properties === "object") {
|
|
234
|
+
for (const [k, v] of Object.entries(base.properties)) {
|
|
212
235
|
out.push([k, v]);
|
|
213
236
|
}
|
|
214
237
|
}
|
|
215
238
|
for (const variantKey of ["oneOf", "anyOf", "allOf"]) {
|
|
216
|
-
const arr =
|
|
239
|
+
const arr = base[variantKey];
|
|
217
240
|
if (!Array.isArray(arr))
|
|
218
241
|
continue;
|
|
219
|
-
for (const
|
|
220
|
-
if (
|
|
242
|
+
for (const raw of arr) {
|
|
243
|
+
if (!raw || typeof raw !== "object")
|
|
244
|
+
continue;
|
|
245
|
+
const variant = resolveLocalRef(raw, root ?? schema) ?? raw;
|
|
246
|
+
if (variant.properties) {
|
|
221
247
|
for (const [k, v] of Object.entries(variant.properties)) {
|
|
222
248
|
out.push([k, v]);
|
|
223
249
|
}
|
|
@@ -1681,9 +1707,11 @@ export class StaticAnalyzer {
|
|
|
1681
1707
|
severity: DiagnosticSeverity.Error,
|
|
1682
1708
|
code: issue.code ?? "CONTRACT_INPUTS_MISMATCH",
|
|
1683
1709
|
source: SOURCE,
|
|
1684
|
-
message: issue.code
|
|
1685
|
-
? `${m.kind}/${stepName}:
|
|
1686
|
-
:
|
|
1710
|
+
message: issue.code === "LIVE_VALUE_RETRIED"
|
|
1711
|
+
? `${m.kind}/${stepName}: at '${issue.path}', ${issue.message}`
|
|
1712
|
+
: issue.code
|
|
1713
|
+
? `${m.kind}/${stepName}: inputs at '${issue.path}' flow into ${issue.targetLabel} with disagreeing type arguments: ${issue.message}`
|
|
1714
|
+
: `${m.kind}/${stepName}: inputs at '${issue.path}' do not satisfy ${issue.targetLabel}'s declared inputType: ${issue.message}`,
|
|
1687
1715
|
data: {
|
|
1688
1716
|
resource: { kind: m.kind, name: stepName ?? "" },
|
|
1689
1717
|
filePath: stepFile,
|
package/dist/builtins.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"builtins.d.ts","sourceRoot":"","sources":["../src/builtins.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"builtins.d.ts","sourceRoot":"","sources":["../src/builtins.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AA6JvD,eAAO,MAAM,eAAe,EAAE,kBAAkB,EA0rB/C,CAAC"}
|
package/dist/builtins.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { manifestFragment } from "./manifest-schemas.js";
|
|
1
2
|
import { OBSERVED_STATE_SCHEMA } from "./validate-observed-state.js";
|
|
2
3
|
/** Descriptive provenance a module declares about itself, shared by
|
|
3
4
|
* `Telo.Application` and `Telo.Library`.
|
|
@@ -606,48 +607,21 @@ export const KERNEL_BUILTINS = [
|
|
|
606
607
|
},
|
|
607
608
|
additionalProperties: false,
|
|
608
609
|
},
|
|
609
|
-
// Inline flat invoke step
|
|
610
|
-
// with
|
|
611
|
-
//
|
|
612
|
-
//
|
|
613
|
-
//
|
|
614
|
-
//
|
|
615
|
-
//
|
|
616
|
-
//
|
|
617
|
-
//
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
"x-telo-topology-role": "invoke",
|
|
625
|
-
"x-telo-ref": {
|
|
626
|
-
kind: "Telo.Executable",
|
|
627
|
-
use: "call",
|
|
628
|
-
inputs: "/inputs",
|
|
629
|
-
},
|
|
630
|
-
type: "object",
|
|
631
|
-
required: ["kind", "name"],
|
|
632
|
-
properties: {
|
|
633
|
-
kind: { type: "string" },
|
|
634
|
-
name: { type: "string" },
|
|
635
|
-
},
|
|
636
|
-
additionalProperties: true,
|
|
637
|
-
},
|
|
638
|
-
inputs: {
|
|
639
|
-
// Same annotation Run.Sequence steps carry: it is what makes
|
|
640
|
-
// a boot target's inputs visible to the call-site contract
|
|
641
|
-
// check and to the wiring rule. Without it the kernel would
|
|
642
|
-
// validate these at dispatch and nothing before it.
|
|
643
|
-
"x-telo-topology-role": "inputs",
|
|
644
|
-
type: "object",
|
|
645
|
-
additionalProperties: true,
|
|
646
|
-
},
|
|
647
|
-
when: { type: "string" },
|
|
648
|
-
},
|
|
649
|
-
additionalProperties: false,
|
|
650
|
-
},
|
|
610
|
+
// Inline flat invoke step, discriminated by the `invoke` key —
|
|
611
|
+
// THE dispatch site, shared with every `Run` step array rather
|
|
612
|
+
// than restated here. Restating it is what made `retry:` a schema
|
|
613
|
+
// error at boot while working one line away in a sequence: not a
|
|
614
|
+
// decision about boot, just a copy that never grew the field.
|
|
615
|
+
// Control flow (if/while/switch/try) is still not available here —
|
|
616
|
+
// reach for Run.Sequence.
|
|
617
|
+
// An expanded, stamped COPY. `builtins.ts` is not a manifest, so it
|
|
618
|
+
// never passes through the loader's expansion — embedding the
|
|
619
|
+
// fragment object itself would leave the nested `retry` as an
|
|
620
|
+
// unresolved `$ref` with no `x-telo-fragment` stamp, which is
|
|
621
|
+
// exactly what made LIVE_VALUE_RETRIED silently skip every boot
|
|
622
|
+
// target. A copy, because this is a module-level singleton and
|
|
623
|
+
// `resolveSchemaRefKinds` rewrites the `x-telo-ref` inside it.
|
|
624
|
+
manifestFragment("InvokeStep"),
|
|
651
625
|
],
|
|
652
626
|
},
|
|
653
627
|
},
|
|
@@ -1 +1 @@
|
|
|
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;
|
|
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;AAcrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC1D,YAAY,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAEvD;;;;;;;;;uEASuE;AACvE,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,WAAW,EACpB,QAAQ,EAAE,gBAAgB,EAC1B,kBAAkB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,EAI/C,kBAAkB,CAAC,EAAE,gBAAgB,GACpC,WAAW,CAgGb;AAuBD;;;;;;8DAM8D;AAC9D,wBAAgB,8BAA8B,CAC5C,OAAO,EAAE,WAAW,EACpB,cAAc,EAAE,gBAAgB,GAAG,SAAS,GAC3C,WAAW,CAkCb"}
|
package/dist/cel-environment.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { authoredModuleMetadata, moduleMetadataSchema } from "./module-metadata-scope.js";
|
|
1
2
|
import { jsonSchemaToCelType, VALUE_BRAND_BASE } from "./schema-compat.js";
|
|
2
3
|
/** Transport protocol on a `ports` entry → the nominal CEL brand its resolved
|
|
3
4
|
* value carries. Mirrors the `protocol` enum in the Application schema, and
|
|
@@ -74,6 +75,28 @@ rootModuleManifest) {
|
|
|
74
75
|
}
|
|
75
76
|
env.registerVariable("secrets", "map");
|
|
76
77
|
env.registerVariable("resources", "map");
|
|
78
|
+
// `module` — the declaring module's own `metadata`, so a manifest reads its
|
|
79
|
+
// version instead of restating it. A resource forwarded from an imported
|
|
80
|
+
// library reads THAT library's metadata, stamped as
|
|
81
|
+
// `metadata.moduleGlobals.module`.
|
|
82
|
+
//
|
|
83
|
+
// Falls back to an OPEN map, never to `manifest.metadata`: for a resource
|
|
84
|
+
// doc that is the RESOURCE's metadata (`{name: <resource name>}`), and
|
|
85
|
+
// closing `module` over it would turn a `module.version` that resolves
|
|
86
|
+
// perfectly well at runtime into a hard error the author cannot act on. A
|
|
87
|
+
// static check that is wrong in the rejecting direction is the worse
|
|
88
|
+
// polarity.
|
|
89
|
+
const moduleSchema = moduleMetadataSchema(manifest.metadata?.moduleGlobals?.module ?? rootModuleManifest?.metadata);
|
|
90
|
+
if (moduleSchema) {
|
|
91
|
+
const schema = {};
|
|
92
|
+
for (const [key, property] of Object.entries(moduleSchema.properties)) {
|
|
93
|
+
schema[key] = jsonSchemaToCelType(property);
|
|
94
|
+
}
|
|
95
|
+
env.registerVariable({ name: "module", schema });
|
|
96
|
+
}
|
|
97
|
+
else {
|
|
98
|
+
env.registerVariable("module", "map");
|
|
99
|
+
}
|
|
77
100
|
if (extraContextSchema?.properties) {
|
|
78
101
|
for (const [name, propSchema] of Object.entries(extraContextSchema.properties)) {
|
|
79
102
|
if (!env.hasVariable(name)) {
|
|
@@ -133,5 +156,17 @@ export function buildImportInputCelEnvironment(baseEnv, moduleManifest) {
|
|
|
133
156
|
for (const name of ["resources", "ports"]) {
|
|
134
157
|
env.registerVariable({ name, schema: {} });
|
|
135
158
|
}
|
|
159
|
+
// `module` IS part of it: the importer's own identity is config, and passing
|
|
160
|
+
// its version down to a child is the case the binding exists for.
|
|
161
|
+
const metadata = authoredModuleMetadata(mod?.metadata);
|
|
162
|
+
if (Object.keys(metadata).length > 0) {
|
|
163
|
+
const schema = {};
|
|
164
|
+
for (const key of Object.keys(metadata))
|
|
165
|
+
schema[key] = "dyn";
|
|
166
|
+
env.registerVariable({ name: "module", schema });
|
|
167
|
+
}
|
|
168
|
+
else {
|
|
169
|
+
env.registerVariable("module", "map");
|
|
170
|
+
}
|
|
136
171
|
return env;
|
|
137
172
|
}
|
|
@@ -53,6 +53,10 @@ export interface ModuleGlobals {
|
|
|
53
53
|
variables?: Record<string, unknown>;
|
|
54
54
|
secrets?: Record<string, unknown>;
|
|
55
55
|
ports?: Record<string, unknown>;
|
|
56
|
+
/** The declaring module's own `metadata` — what `module.<field>` reads. Its
|
|
57
|
+
* values, not a schema, because the fields are literals in the manifest and
|
|
58
|
+
* the module a resource belongs to is fixed at analysis time. */
|
|
59
|
+
module?: Record<string, unknown>;
|
|
56
60
|
}
|
|
57
61
|
/** Produce the flat manifest list `analyze()` consumes today.
|
|
58
62
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flatten-for-analyzer.d.ts","sourceRoot":"","sources":["../src/flatten-for-analyzer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAGnE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAEtE;;yEAEyE;AACzE,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;;4CAI4C;AAC5C,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,iBAAiB,CAGjE;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;6EA6B6E;AAC7E,wBAAgB,gCAAgC,CAC9C,eAAe,EAAE,gBAAgB,EAAE,EACnC,MAAM,EAAE,OAAO,GACd,gBAAgB,EAAE,CAmCpB;AAED;;;6CAG6C;AAC7C,MAAM,WAAW,aAAa;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACpC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAClC,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"flatten-for-analyzer.d.ts","sourceRoot":"","sources":["../src/flatten-for-analyzer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAGnE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAEtE;;yEAEyE;AACzE,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;;4CA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,CAAC;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,CAAA;CAAE,CAAC,EACvF,aAAa,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,GACnE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CA2ClC;AAED;;;;;4DAK4D;AAC5D,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,aAAa,CAAC;IAAE,QAAQ,EAAE,gBAAgB,CAAC;IAAC,YAAY,EAAE,MAAM,CAAA;CAAE,CAAC,EAC5E,aAAa,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,GAC9C,IAAI,CAWN;AAED;;;;;;;;;;;;;;iGAciG;AACjG,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,aAAa,CAAC;IAAE,QAAQ,EAAE,gBAAgB,CAAC;IAAC,YAAY,EAAE,MAAM,CAAA;CAAE,CAAC,EAC5E,aAAa,EAAE,WAAW,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC,GACpD,IAAI,CAMN;AAgDD;;;;;oEAKoE;AACpE,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,WAAW,GAAG,mBAAmB,EAAE,CAuBpF;AAED;;;;;6BAK6B;AAC7B,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,YAAY,GAAG,gBAAgB,EAAE,CAEzE"}
|
|
@@ -92,6 +92,14 @@ function readModuleGlobals(libDoc) {
|
|
|
92
92
|
if (block && typeof block === "object" && !Array.isArray(block))
|
|
93
93
|
globals[key] = block;
|
|
94
94
|
}
|
|
95
|
+
// `module` is the declaring module's own identity, so it travels with a
|
|
96
|
+
// forwarded manifest for the same reason the config blocks do: a library's
|
|
97
|
+
// `module.version` is the LIBRARY's, and typing it from the consumer's entry
|
|
98
|
+
// doc would report the app's version to the library that asked.
|
|
99
|
+
const metadata = doc.metadata;
|
|
100
|
+
if (metadata && typeof metadata === "object" && !Array.isArray(metadata)) {
|
|
101
|
+
globals.module = metadata;
|
|
102
|
+
}
|
|
95
103
|
return Object.keys(globals).length > 0 ? globals : undefined;
|
|
96
104
|
}
|
|
97
105
|
function withModuleGlobals(m, moduleGlobals) {
|
package/dist/index.d.ts
CHANGED
|
@@ -13,8 +13,8 @@ export { moduleScopedDefResolver, scopeResolverForModule } from "./alias-resolve
|
|
|
13
13
|
export type { ModuleScopes } from "./alias-resolver.js";
|
|
14
14
|
export { ancestorChain, contractDeclarer, controllerBearingAncestor, effectiveAuthorSchema, effectiveContractField, effectiveStatusSchema, hasOwnControllerOrTemplate, inheritedCapability, isInheritedDelegation, mappingFieldFor, needsContractMapping, resolveParent, } from "./extends-resolution.js";
|
|
15
15
|
export type { ContractDirection, DefResolver } from "./extends-resolution.js";
|
|
16
|
-
export { defaultBearingPaths, PERMISSIVE_CONTRACT, resolveContract, resolveContractSchema, withLiveValuesSkipped, } from "./invocation-contract.js";
|
|
17
|
-
export type { ContractOrigin, ContractScope, ResolvedContract } from "./invocation-contract.js";
|
|
16
|
+
export { defaultBearingPaths, declaredScalarPaths, PERMISSIVE_CONTRACT, resolveContract, resolveContractSchema, withLiveValuesSkipped, } from "./invocation-contract.js";
|
|
17
|
+
export type { ContractOrigin, ContractScope, DeclaredScalarForm, DeclaredScalarPath, ResolvedContract, } from "./invocation-contract.js";
|
|
18
18
|
export { hasIntermediateWildcard, parseRedactionPath, RedactionPathError, } from "./redaction-path.js";
|
|
19
19
|
export type { RedactionSegment } from "./redaction-path.js";
|
|
20
20
|
export { buildCallGraph, projectToPairs, resourceId } from "./call-graph.js";
|
|
@@ -37,7 +37,7 @@ export { validateDynamicSelectors, validateRefSlotDeclarations } from "./validat
|
|
|
37
37
|
export type { RefSlotIssue } from "./validate-ref-slots.js";
|
|
38
38
|
export { validateValueTypeSlots } from "./validate-value-type-slots.js";
|
|
39
39
|
export type { ValueTypeSlotIssue } from "./validate-value-type-slots.js";
|
|
40
|
-
export { checkSchemaCompatibility } from "./schema-compat.js";
|
|
40
|
+
export { checkSchemaCompatibility, selectUnionBranch } from "./schema-compat.js";
|
|
41
41
|
export type { CompatibilityResult } from "./schema-compat.js";
|
|
42
42
|
export { visitManifest } from "./manifest-visitor.js";
|
|
43
43
|
export type { CelSiteEvent, ManifestVisitor, RefSiteEvent, ResourceEnterEvent, ResourceExitEvent, ScopeBoundaryEvent, SchemaFromSiteEvent, VisitOptions, } from "./manifest-visitor.js";
|
|
@@ -85,4 +85,7 @@ export { CelParseError, buildCelSegments, wrapCelAst } from "./cel-ast.js";
|
|
|
85
85
|
export type { CelNode, CelSegment } from "./cel-ast.js";
|
|
86
86
|
export { DEFAULT_MANIFEST_FILENAME, DiagnosticSeverity, diagnosticFix } from "./types.js";
|
|
87
87
|
export type { AnalysisDiagnostic, AnalysisOptions, DiagnosticData, DiagnosticFix, LoaderInitOptions, LoadOptions, ManifestSource, Position, PositionIndex, Range } from "./types.js";
|
|
88
|
+
export * from "./manifest-schemas.js";
|
|
89
|
+
export { DERIVED_METADATA_FIELDS, authoredModuleMetadata, } from "./module-metadata-scope.js";
|
|
90
|
+
export * from "./release/index.js";
|
|
88
91
|
//# 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,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,mB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AAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC1D,YAAY,EAAE,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAC9F,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC3E,YAAY,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AACxD,OAAO,EAAE,yBAAyB,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC1F,YAAY,EACR,kBAAkB,EAClB,eAAe,EACf,cAAc,EACd,aAAa,EACb,iBAAiB,EACjB,WAAW,EACX,cAAc,EACd,QAAQ,EACR,aAAa,EACb,KAAK,EACR,MAAM,YAAY,CAAC;AACpB,cAAc,uBAAuB,CAAC;AAItC,OAAO,EACL,uBAAuB,EACvB,sBAAsB,GACvB,MAAM,4BAA4B,CAAC;AACpC,cAAc,oBAAoB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -7,7 +7,7 @@ export { BINDINGS_ANNOTATION, bindingContextProperties, bindingDependencies, fin
|
|
|
7
7
|
export { applyObservedStateNode, buildObservedStateIndex, buildObservedStateResourcesSchema, collectRunReachableNames, observedStateRead, validateObservedStateDeclarations, OBSERVED_STATE_SCHEMA, } from "./validate-observed-state.js";
|
|
8
8
|
export { moduleScopedDefResolver, scopeResolverForModule } from "./alias-resolver.js";
|
|
9
9
|
export { ancestorChain, contractDeclarer, controllerBearingAncestor, effectiveAuthorSchema, effectiveContractField, effectiveStatusSchema, hasOwnControllerOrTemplate, inheritedCapability, isInheritedDelegation, mappingFieldFor, needsContractMapping, resolveParent, } from "./extends-resolution.js";
|
|
10
|
-
export { defaultBearingPaths, PERMISSIVE_CONTRACT, resolveContract, resolveContractSchema, withLiveValuesSkipped, } from "./invocation-contract.js";
|
|
10
|
+
export { defaultBearingPaths, declaredScalarPaths, PERMISSIVE_CONTRACT, resolveContract, resolveContractSchema, withLiveValuesSkipped, } from "./invocation-contract.js";
|
|
11
11
|
export { hasIntermediateWildcard, parseRedactionPath, RedactionPathError, } from "./redaction-path.js";
|
|
12
12
|
export { buildCallGraph, projectToPairs, resourceId } from "./call-graph.js";
|
|
13
13
|
export { buildReferenceFieldMap, isRefEntry, isScopeEntry } from "./reference-field-map.js";
|
|
@@ -19,7 +19,7 @@ export { deriveLibraryExportRequirements, projectZoneRequirements, runZoneAnalys
|
|
|
19
19
|
export { validateZoneSlotDeclarations } from "./validate-zone-slots.js";
|
|
20
20
|
export { validateDynamicSelectors, validateRefSlotDeclarations } from "./validate-ref-slots.js";
|
|
21
21
|
export { validateValueTypeSlots } from "./validate-value-type-slots.js";
|
|
22
|
-
export { checkSchemaCompatibility } from "./schema-compat.js";
|
|
22
|
+
export { checkSchemaCompatibility, selectUnionBranch } from "./schema-compat.js";
|
|
23
23
|
export { visitManifest } from "./manifest-visitor.js";
|
|
24
24
|
export { Loader } from "./manifest-loader.js";
|
|
25
25
|
export { isModuleKind, MODULE_KINDS } from "./module-kinds.js";
|
|
@@ -51,3 +51,9 @@ export { withSyntheticPositions } from "./with-synthetic-positions.js";
|
|
|
51
51
|
export { documentToAst, parseToAst } from "./yaml-ast.js";
|
|
52
52
|
export { CelParseError, buildCelSegments, wrapCelAst } from "./cel-ast.js";
|
|
53
53
|
export { DEFAULT_MANIFEST_FILENAME, DiagnosticSeverity, diagnosticFix } from "./types.js";
|
|
54
|
+
export * from "./manifest-schemas.js";
|
|
55
|
+
// The release model — module identity, fragments, the ledger, the edge graph and
|
|
56
|
+
// version planning. Pure data in, plan out, so the editor and the CLI release
|
|
57
|
+
// from one model.
|
|
58
|
+
export { DERIVED_METADATA_FIELDS, authoredModuleMetadata, } from "./module-metadata-scope.js";
|
|
59
|
+
export * from "./release/index.js";
|
|
@@ -105,4 +105,41 @@ export declare function defaultBearingPaths(schema: Record<string, any>,
|
|
|
105
105
|
* declares its defaults behind the reference, and a walk that cannot follow
|
|
106
106
|
* it would report none, leaving the caller's data shared where a fill lands. */
|
|
107
107
|
resolveRef?: (ref: string) => Record<string, any> | undefined): string[][];
|
|
108
|
+
/** The scalar form a declared node's value takes at runtime. `int64` and
|
|
109
|
+
* `double` are the two JSON scalars whose runtime representation is NOT decided
|
|
110
|
+
* by the value that arrives: a CEL integer is a BigInt and a CEL double a JS
|
|
111
|
+
* number, and both are `typeof "number" | "bigint"` away from what a declaration
|
|
112
|
+
* says they are. Everything else — string, boolean, object, array, and every
|
|
113
|
+
* `instance` value type — is already its own representation, so it is not
|
|
114
|
+
* listed and never rewritten. */
|
|
115
|
+
export type DeclaredScalarForm = "int64" | "double";
|
|
116
|
+
export interface DeclaredScalarPath {
|
|
117
|
+
readonly path: string[];
|
|
118
|
+
readonly form: DeclaredScalarForm;
|
|
119
|
+
}
|
|
120
|
+
/** Every path in `schema` whose declared type fixes a scalar representation —
|
|
121
|
+
* the leaves a value must carry in that form for the contract to be TRUE, not
|
|
122
|
+
* merely to pass.
|
|
123
|
+
*
|
|
124
|
+
* A declared shape says what the value IS, the same service a JSON Schema gives
|
|
125
|
+
* an HTTP response serializer. Telo's CEL layer takes it literally:
|
|
126
|
+
* `jsonSchemaToCelType` maps `integer` to CEL `int` and `number` to `double`,
|
|
127
|
+
* and a CEL int IS a BigInt — so a controller handing back a plain JS number at
|
|
128
|
+
* an `integer` slot makes the declaration a lie that surfaces nowhere until an
|
|
129
|
+
* expression composes it, as `result.n + 1` type-checking statically and then
|
|
130
|
+
* dying at dispatch with `no such overload: dyn<double> + int`.
|
|
131
|
+
*
|
|
132
|
+
* A VALUE TYPE is read through the same rule rather than beside it: a `json`
|
|
133
|
+
* representation refines a JSON type and contributes its `base` (so
|
|
134
|
+
* `Telo.TcpPort` is an `int64` slot), while an `instance` representation
|
|
135
|
+
* REPLACES the JSON layer — a byte buffer and a stream handle are already their
|
|
136
|
+
* own representation, nothing converts to them, and the walk stops there rather
|
|
137
|
+
* than descending into a value that is not a plain container.
|
|
138
|
+
*
|
|
139
|
+
* Bounded by the schema's declarations rather than by the size of the payload,
|
|
140
|
+
* exactly as {@link defaultBearingPaths} is: a contract declaring no such
|
|
141
|
+
* scalar walks nothing at dispatch. A union counts when it names exactly one of
|
|
142
|
+
* the two — `["integer", "null"]` is still the integer branch, while
|
|
143
|
+
* `["integer", "number"]` fixes nothing and is left alone. */
|
|
144
|
+
export declare function declaredScalarPaths(schema: Record<string, any>, resolveRef?: (ref: string) => Record<string, any> | undefined): DeclaredScalarPath[];
|
|
108
145
|
//# sourceMappingURL=invocation-contract.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"invocation-contract.d.ts","sourceRoot":"","sources":["../src/invocation-contract.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,kBAAkB,
|
|
1
|
+
{"version":3,"file":"invocation-contract.d.ts","sourceRoot":"","sources":["../src/invocation-contract.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,kBAAkB,EAAe,MAAM,cAAc,CAAC;AAChF,OAAO,EACL,KAAK,iBAAiB,EAEtB,KAAK,WAAW,EAEjB,MAAM,yBAAyB,CAAC;AAGjC,YAAY,EAAE,iBAAiB,EAAE,CAAC;AAElC;;;;;;;;;;;;GAYG;AAEH;;oCAEoC;AACpC,MAAM,MAAM,cAAc,GAAG,UAAU,GAAG,MAAM,CAAC;AAEjD,MAAM,WAAW,gBAAgB;IAC/B,oDAAoD;IACpD,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC5B,MAAM,EAAE,cAAc,CAAC;IACvB;gFAC4E;IAC5E,UAAU,CAAC,EAAE,kBAAkB,CAAC;CACjC;AAED,MAAM,WAAW,aAAa;IAC5B;;kEAE8D;IAC9D,iBAAiB,EAAE,WAAW,CAAC;IAC/B;;;;;;;;;OASG;IACH,gBAAgB,CAAC,GAAG,EAAE,kBAAkB,GAAG,SAAS,GAAG,MAAM,CAAC,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D,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,CAAC;IACxB,QAAQ,CAAC,IAAI,EAAE,kBAAkB,CAAC;CACnC;AAED;;;;;;;;;;;;;;;;;;;;;;;+DAuB+D;AAC/D,wBAAgB,mBAAmB,CACjC,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,kBAAkB,EAAE,CAoCtB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isLiveSlot } from "@telorun/sdk";
|
|
1
|
+
import { isLiveSlot, valueTypeOf } from "@telorun/sdk";
|
|
2
2
|
import { contractDeclarer, effectiveContractField, } from "./extends-resolution.js";
|
|
3
3
|
import { resolveTypeFieldToSchema } from "./validate-cel-context.js";
|
|
4
4
|
/** The fallback for a target that declares no contract: anything goes. Not
|
|
@@ -203,3 +203,83 @@ resolveRef) {
|
|
|
203
203
|
walk(schema, [], []);
|
|
204
204
|
return out;
|
|
205
205
|
}
|
|
206
|
+
/** Every path in `schema` whose declared type fixes a scalar representation —
|
|
207
|
+
* the leaves a value must carry in that form for the contract to be TRUE, not
|
|
208
|
+
* merely to pass.
|
|
209
|
+
*
|
|
210
|
+
* A declared shape says what the value IS, the same service a JSON Schema gives
|
|
211
|
+
* an HTTP response serializer. Telo's CEL layer takes it literally:
|
|
212
|
+
* `jsonSchemaToCelType` maps `integer` to CEL `int` and `number` to `double`,
|
|
213
|
+
* and a CEL int IS a BigInt — so a controller handing back a plain JS number at
|
|
214
|
+
* an `integer` slot makes the declaration a lie that surfaces nowhere until an
|
|
215
|
+
* expression composes it, as `result.n + 1` type-checking statically and then
|
|
216
|
+
* dying at dispatch with `no such overload: dyn<double> + int`.
|
|
217
|
+
*
|
|
218
|
+
* A VALUE TYPE is read through the same rule rather than beside it: a `json`
|
|
219
|
+
* representation refines a JSON type and contributes its `base` (so
|
|
220
|
+
* `Telo.TcpPort` is an `int64` slot), while an `instance` representation
|
|
221
|
+
* REPLACES the JSON layer — a byte buffer and a stream handle are already their
|
|
222
|
+
* own representation, nothing converts to them, and the walk stops there rather
|
|
223
|
+
* than descending into a value that is not a plain container.
|
|
224
|
+
*
|
|
225
|
+
* Bounded by the schema's declarations rather than by the size of the payload,
|
|
226
|
+
* exactly as {@link defaultBearingPaths} is: a contract declaring no such
|
|
227
|
+
* scalar walks nothing at dispatch. A union counts when it names exactly one of
|
|
228
|
+
* the two — `["integer", "null"]` is still the integer branch, while
|
|
229
|
+
* `["integer", "number"]` fixes nothing and is left alone. */
|
|
230
|
+
export function declaredScalarPaths(schema, resolveRef) {
|
|
231
|
+
const out = [];
|
|
232
|
+
const walk = (node, path, chain) => {
|
|
233
|
+
if (!node || typeof node !== "object")
|
|
234
|
+
return;
|
|
235
|
+
let s = node;
|
|
236
|
+
if (chain.includes(s))
|
|
237
|
+
return;
|
|
238
|
+
if (resolveRef && typeof s.$ref === "string") {
|
|
239
|
+
const target = resolveRef(s.$ref);
|
|
240
|
+
if (!target || chain.includes(target))
|
|
241
|
+
return;
|
|
242
|
+
s = { ...target, ...s, $ref: undefined };
|
|
243
|
+
}
|
|
244
|
+
const here = [...chain, node];
|
|
245
|
+
const entry = valueTypeOf(s);
|
|
246
|
+
// An `instance` representation replaces the JSON layer: it is its own
|
|
247
|
+
// representation, so there is nothing to normalize to and nothing below it
|
|
248
|
+
// that is a plain container to walk.
|
|
249
|
+
if (entry && entry.representation === "instance")
|
|
250
|
+
return;
|
|
251
|
+
const form = scalarFormOf(entry && entry.base !== undefined ? entry.base : s.type);
|
|
252
|
+
if (form && path.length > 0)
|
|
253
|
+
out.push({ path, form });
|
|
254
|
+
const properties = s.properties;
|
|
255
|
+
if (properties) {
|
|
256
|
+
for (const [key, child] of Object.entries(properties))
|
|
257
|
+
walk(child, [...path, key], here);
|
|
258
|
+
}
|
|
259
|
+
for (const branch of ["allOf", "anyOf", "oneOf"]) {
|
|
260
|
+
const list = s[branch];
|
|
261
|
+
if (Array.isArray(list))
|
|
262
|
+
for (const child of list)
|
|
263
|
+
walk(child, path, here);
|
|
264
|
+
}
|
|
265
|
+
if (s.items)
|
|
266
|
+
walk(s.items, [...path, "[]"], here);
|
|
267
|
+
};
|
|
268
|
+
walk(schema, [], []);
|
|
269
|
+
return out;
|
|
270
|
+
}
|
|
271
|
+
function scalarFormOf(declared) {
|
|
272
|
+
if (declared === "integer")
|
|
273
|
+
return "int64";
|
|
274
|
+
if (declared === "number")
|
|
275
|
+
return "double";
|
|
276
|
+
if (!Array.isArray(declared))
|
|
277
|
+
return undefined;
|
|
278
|
+
const integer = declared.includes("integer");
|
|
279
|
+
const number = declared.includes("number");
|
|
280
|
+
// A union naming both fixes nothing — either representation satisfies it, so
|
|
281
|
+
// rewriting one into the other would be a choice the declaration never made.
|
|
282
|
+
if (integer === number)
|
|
283
|
+
return undefined;
|
|
284
|
+
return integer ? "int64" : "double";
|
|
285
|
+
}
|
package/dist/kernel-globals.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ import type { ResourceManifest } from "@telorun/sdk";
|
|
|
10
10
|
* by declaring a typed `variables:`/`secrets:` entry with an `env:` binding
|
|
11
11
|
* and referencing `variables.X` / `secrets.X`.
|
|
12
12
|
*/
|
|
13
|
-
export declare const KERNEL_GLOBAL_NAMES: readonly ["variables", "secrets", "resources", "ports"];
|
|
13
|
+
export declare const KERNEL_GLOBAL_NAMES: readonly ["variables", "secrets", "resources", "ports", "module"];
|
|
14
14
|
/** Kernel globals as ONE resource's declaring module sees them. */
|
|
15
15
|
export interface KernelGlobalsIndex {
|
|
16
16
|
forResource(m: ResourceManifest): Record<string, any>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kernel-globals.d.ts","sourceRoot":"","sources":["../src/kernel-globals.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"kernel-globals.d.ts","sourceRoot":"","sources":["../src/kernel-globals.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAKrD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,mBAAmB,mEAMtB,CAAC;AASX,mEAAmE;AACnE,MAAM,WAAW,kBAAkB;IACjC,WAAW,CAAC,CAAC,EAAE,gBAAgB,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CACvD;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,uBAAuB,CACrC,SAAS,EAAE,gBAAgB,EAAE;AAC7B;;;2CAG2C;AAC3C,SAAS,CAAC,EAAE,WAAW,CAAC,MAAM,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;CAAE,CAAC,GAC9E,kBAAkB,CA0BpB;AAkHD;;;;;;;GAOG;AACH,wBAAgB,6BAA6B,CAC3C,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAClC,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GACjC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CASrB"}
|
package/dist/kernel-globals.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { moduleMetadataSchema } from "./module-metadata-scope.js";
|
|
1
2
|
import { residualEntrySchemaMap } from "./residual-schema.js";
|
|
2
3
|
import { applyObservedStateNode } from "./validate-observed-state.js";
|
|
3
4
|
/**
|
|
@@ -11,7 +12,13 @@ import { applyObservedStateNode } from "./validate-observed-state.js";
|
|
|
11
12
|
* by declaring a typed `variables:`/`secrets:` entry with an `env:` binding
|
|
12
13
|
* and referencing `variables.X` / `secrets.X`.
|
|
13
14
|
*/
|
|
14
|
-
export const KERNEL_GLOBAL_NAMES = [
|
|
15
|
+
export const KERNEL_GLOBAL_NAMES = [
|
|
16
|
+
"variables",
|
|
17
|
+
"secrets",
|
|
18
|
+
"resources",
|
|
19
|
+
"ports",
|
|
20
|
+
"module",
|
|
21
|
+
];
|
|
15
22
|
const SYSTEM_KINDS = new Set([
|
|
16
23
|
"Telo.Definition",
|
|
17
24
|
"Telo.Application",
|
|
@@ -76,9 +83,16 @@ function globalsSchema(doc, resourcesSchema) {
|
|
|
76
83
|
secrets: buildSchemaMapSchema(doc?.secrets),
|
|
77
84
|
resources: resourcesSchema,
|
|
78
85
|
ports: buildPortsSchema(doc?.ports),
|
|
86
|
+
module: buildModuleSchema(doc),
|
|
79
87
|
},
|
|
80
88
|
};
|
|
81
89
|
}
|
|
90
|
+
/** The `module` namespace. Derived by `moduleMetadataSchema`, the same call the
|
|
91
|
+
* CEL environment types from, so the two cannot disagree about which fields
|
|
92
|
+
* exist or whether the namespace is closed. */
|
|
93
|
+
function buildModuleSchema(doc) {
|
|
94
|
+
return (moduleMetadataSchema((doc?.module ?? doc?.metadata)) ?? { type: "object", additionalProperties: true });
|
|
95
|
+
}
|
|
82
96
|
/** Every non-system resource name in the set, plus the scope-declared ones. */
|
|
83
97
|
function buildResourcesSchema(manifests, resources) {
|
|
84
98
|
const resourceProps = {};
|