@intentius/chant 0.18.11 → 0.18.12
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/graph-ir.d.ts +15 -3
- package/dist/graph-ir.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/graph-ir.test.ts +35 -0
- package/src/graph-ir.ts +60 -11
package/dist/graph-ir.d.ts
CHANGED
|
@@ -93,15 +93,27 @@ export interface IRExport {
|
|
|
93
93
|
/** Producer-side attribute the output reads (e.g. "Arn"). */
|
|
94
94
|
attr?: string;
|
|
95
95
|
}
|
|
96
|
+
/** A cross-stack import this stack consumes — a `Parameter` fed from another
|
|
97
|
+
* stack's output at deploy time. A viewer matches an import `name` to another
|
|
98
|
+
* stack's export `name` to draw the cross-stack edge; the parameter's in-stack
|
|
99
|
+
* consumers are ordinary `$ref` edges to `node` (#513). */
|
|
100
|
+
export interface IRImport {
|
|
101
|
+
/** Parameter name — the cross-stack handle (e.g. "clusterArn"). */
|
|
102
|
+
name: string;
|
|
103
|
+
/** Logical name of the parameter node. */
|
|
104
|
+
node: string;
|
|
105
|
+
}
|
|
96
106
|
/** The full graph IR for a project at the default (declarable) detail level. */
|
|
97
107
|
export interface GraphIR {
|
|
98
108
|
nodes: IRNode[];
|
|
99
109
|
edges: IREdge[];
|
|
100
110
|
groups: IRGroups;
|
|
101
|
-
/** Outputs this stack publishes for other stacks to import.
|
|
102
|
-
* nodes (`AWS::CloudFormation::Parameter` etc.); a viewer matches an import's
|
|
103
|
-
* name to an export's name to draw the cross-stack edge to its producer (#513). */
|
|
111
|
+
/** Outputs this stack publishes for other stacks to import (#513). */
|
|
104
112
|
exports?: IRExport[];
|
|
113
|
+
/** Parameters this stack imports from other stacks. A viewer matches an import's
|
|
114
|
+
* `name` to another stack's export `name` to draw the cross-stack edge; the
|
|
115
|
+
* parameter's in-stack consumers are ordinary `$ref` edges to it (#513). */
|
|
116
|
+
imports?: IRImport[];
|
|
105
117
|
}
|
|
106
118
|
/**
|
|
107
119
|
* Build the graph IR from resolved entities (the output of `discover`). Pure and
|
package/dist/graph-ir.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graph-ir.d.ts","sourceRoot":"","sources":["../src/graph-ir.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,UAAU,EAAgB,MAAM,cAAc,CAAC;AAI7D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAElD;;;;;;;;GAQG;AAEH,iFAAiF;AACjF,MAAM,WAAW,SAAS;IACxB,8EAA8E;IAC9E,IAAI,EAAE,MAAM,CAAC;IACb;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,wEAAwE;AACxE,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;CACd;AAED,iCAAiC;AACjC,MAAM,WAAW,MAAM;IACrB,kEAAkE;IAClE,EAAE,EAAE,MAAM,CAAC;IACX,wCAAwC;IACxC,IAAI,EAAE,MAAM,CAAC;IACb,mDAAmD;IACnD,OAAO,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;;OAGG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,yEAAyE;IACzE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B,mCAAmC;IACnC,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CACjC;AAED,qEAAqE;AACrE,MAAM,WAAW,MAAM;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,yCAAyC;IACzC,IAAI,EAAE,KAAK,CAAC;IACZ,8EAA8E;IAC9E,OAAO,CAAC,EAAE,MAAM,C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,6DAA6D;IAC7D,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;;2DAG2D;AAC3D,MAAM,WAAW,QAAQ;IACvB,mEAAmE;IACnE,IAAI,EAAE,MAAM,CAAC;IACb,0CAA0C;IAC1C,IAAI,EAAE,MAAM,CAAC;CACd;AAED,gFAAgF;AAChF,MAAM,WAAW,OAAO;IACtB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,MAAM,EAAE,QAAQ,CAAC;IACjB,sEAAsE;IACtE,OAAO,CAAC,EAAE,QAAQ,EAAE,CAAC;IACrB;;gFAE4E;IAC5E,OAAO,CAAC,EAAE,QAAQ,EAAE,CAAC;CACtB;AAwKD;;;;GAIG;AACH,wBAAgB,YAAY,CAC1B,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,EACjC,WAAW,CAAC,EAAE,MAAM,GACnB,OAAO,CAsFT;AAQD;4EAC4E;AAC5E,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;CAC7C;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,gBAAgB,CAAC,YAAY,EAAE,eAAe,EAAE,GAAG,OAAO,CA+BzE;AAED;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,GAAG,OAAO,CAUvE;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,GAAG,OAAO,CAgC7E"}
|
package/package.json
CHANGED
package/src/graph-ir.test.ts
CHANGED
|
@@ -5,11 +5,17 @@ import { AttrRef } from "./attrref";
|
|
|
5
5
|
import { LexiconOutput } from "./lexicon-output";
|
|
6
6
|
import { resolveAttrRefs } from "./discovery/resolve";
|
|
7
7
|
import { setProvenance } from "./provenance";
|
|
8
|
+
import { INTRINSIC_MARKER } from "./intrinsic";
|
|
8
9
|
|
|
9
10
|
function decl<T extends object>(base: T): Declarable & T {
|
|
10
11
|
return { [DECLARABLE_MARKER]: true, ...base } as Declarable & T;
|
|
11
12
|
}
|
|
12
13
|
|
|
14
|
+
/** A `Ref`-style intrinsic (CloudFormation `{ Ref: name }` shape). */
|
|
15
|
+
function ref(targetName: string): object {
|
|
16
|
+
return { [INTRINSIC_MARKER]: true, toJSON: () => ({ Ref: targetName }) };
|
|
17
|
+
}
|
|
18
|
+
|
|
13
19
|
describe("buildGraphIr", () => {
|
|
14
20
|
test("emits a node per resource with kind, lexicon, and scrubbed attrs", () => {
|
|
15
21
|
const vpc = decl({ lexicon: "gcp", entityType: "Vpc", props: { autoCreateSubnetworks: false } });
|
|
@@ -26,6 +32,35 @@ describe("buildGraphIr", () => {
|
|
|
26
32
|
expect(ir.nodes[0].attrs).not.toHaveProperty("entityType");
|
|
27
33
|
});
|
|
28
34
|
|
|
35
|
+
test("resolves a Ref-to-node intrinsic into an edge + $ref, and lists parameter imports (#513)", () => {
|
|
36
|
+
const cluster = decl({ lexicon: "aws", entityType: "AWS::CloudFormation::Parameter" });
|
|
37
|
+
const service = decl({ lexicon: "aws", entityType: "AWS::ECS::Service", props: { Cluster: ref("clusterArn") } });
|
|
38
|
+
const entities = new Map<string, Declarable>([
|
|
39
|
+
["clusterArn", cluster],
|
|
40
|
+
["service", service],
|
|
41
|
+
]);
|
|
42
|
+
resolveAttrRefs(entities);
|
|
43
|
+
|
|
44
|
+
const ir = buildGraphIr(entities);
|
|
45
|
+
// The Ref becomes a real dependency edge, not a dropped intrinsic.
|
|
46
|
+
expect(ir.edges).toContainEqual({ from: "service", to: "clusterArn", kind: "ref", viaAttr: "Cluster" });
|
|
47
|
+
// attrs mirror the edge as a $ref envelope, not {$intrinsic}.
|
|
48
|
+
expect(ir.nodes.find((n) => n.id === "service")!.attrs.Cluster).toEqual({ $ref: "clusterArn" });
|
|
49
|
+
// Parameter nodes are surfaced as import handles.
|
|
50
|
+
expect(ir.imports).toEqual([{ name: "clusterArn", node: "clusterArn" }]);
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
test("a Ref to a non-node (pseudo-parameter) stays an opaque intrinsic — no phantom edge (#513)", () => {
|
|
54
|
+
const service = decl({ lexicon: "aws", entityType: "AWS::ECS::Service", props: { Region: ref("AWS::Region") } });
|
|
55
|
+
const entities = new Map<string, Declarable>([["service", service]]);
|
|
56
|
+
resolveAttrRefs(entities);
|
|
57
|
+
|
|
58
|
+
const ir = buildGraphIr(entities);
|
|
59
|
+
expect(ir.edges).toEqual([]);
|
|
60
|
+
expect(ir.nodes[0].attrs.Region).toEqual({ $intrinsic: true });
|
|
61
|
+
expect(ir.imports).toBeUndefined();
|
|
62
|
+
});
|
|
63
|
+
|
|
29
64
|
test("derives ref edges labelled with the consumer property", () => {
|
|
30
65
|
const vpc = decl({ lexicon: "gcp", entityType: "Vpc" });
|
|
31
66
|
const subnet = decl({ lexicon: "gcp", entityType: "Subnet", props: { network: new AttrRef(vpc, "id") } });
|
package/src/graph-ir.ts
CHANGED
|
@@ -107,15 +107,28 @@ export interface IRExport {
|
|
|
107
107
|
attr?: string;
|
|
108
108
|
}
|
|
109
109
|
|
|
110
|
+
/** A cross-stack import this stack consumes — a `Parameter` fed from another
|
|
111
|
+
* stack's output at deploy time. A viewer matches an import `name` to another
|
|
112
|
+
* stack's export `name` to draw the cross-stack edge; the parameter's in-stack
|
|
113
|
+
* consumers are ordinary `$ref` edges to `node` (#513). */
|
|
114
|
+
export interface IRImport {
|
|
115
|
+
/** Parameter name — the cross-stack handle (e.g. "clusterArn"). */
|
|
116
|
+
name: string;
|
|
117
|
+
/** Logical name of the parameter node. */
|
|
118
|
+
node: string;
|
|
119
|
+
}
|
|
120
|
+
|
|
110
121
|
/** The full graph IR for a project at the default (declarable) detail level. */
|
|
111
122
|
export interface GraphIR {
|
|
112
123
|
nodes: IRNode[];
|
|
113
124
|
edges: IREdge[];
|
|
114
125
|
groups: IRGroups;
|
|
115
|
-
/** Outputs this stack publishes for other stacks to import.
|
|
116
|
-
* nodes (`AWS::CloudFormation::Parameter` etc.); a viewer matches an import's
|
|
117
|
-
* name to an export's name to draw the cross-stack edge to its producer (#513). */
|
|
126
|
+
/** Outputs this stack publishes for other stacks to import (#513). */
|
|
118
127
|
exports?: IRExport[];
|
|
128
|
+
/** Parameters this stack imports from other stacks. A viewer matches an import's
|
|
129
|
+
* `name` to another stack's export `name` to draw the cross-stack edge; the
|
|
130
|
+
* parameter's in-stack consumers are ordinary `$ref` edges to it (#513). */
|
|
131
|
+
imports?: IRImport[];
|
|
119
132
|
}
|
|
120
133
|
|
|
121
134
|
/** A node is anything that serializes to a resource — not a property or output. */
|
|
@@ -134,6 +147,22 @@ function relFile(file: string | undefined, projectPath?: string): string | undef
|
|
|
134
147
|
return file;
|
|
135
148
|
}
|
|
136
149
|
|
|
150
|
+
/** The logical name a `Ref`-style intrinsic points at, or undefined. Lexicon-
|
|
151
|
+
* agnostic: reads the intrinsic's `toJSON()` for the CloudFormation `{ Ref: name }`
|
|
152
|
+
* shape (aws `RefIntrinsic` etc.). A `Ref` to a node is a real dependency edge,
|
|
153
|
+
* not an opaque intrinsic (#513) — so we resolve it rather than flatten it. */
|
|
154
|
+
function refIntrinsicTarget(value: unknown): string | undefined {
|
|
155
|
+
try {
|
|
156
|
+
const json = (value as { toJSON?: () => unknown }).toJSON?.();
|
|
157
|
+
if (json && typeof json === "object" && typeof (json as { Ref?: unknown }).Ref === "string") {
|
|
158
|
+
return (json as { Ref: string }).Ref;
|
|
159
|
+
}
|
|
160
|
+
} catch {
|
|
161
|
+
// Unresolvable at graph-build time — leave it as an opaque intrinsic.
|
|
162
|
+
}
|
|
163
|
+
return undefined;
|
|
164
|
+
}
|
|
165
|
+
|
|
137
166
|
/** Resolve the producer (logical name) an AttrRef points at. */
|
|
138
167
|
function refTarget(ref: AttrRef, reverse: Map<object, string>): string | undefined {
|
|
139
168
|
// Nested refs (under `props`) aren't assigned a logical name by resolveAttrRefs,
|
|
@@ -143,7 +172,7 @@ function refTarget(ref: AttrRef, reverse: Map<object, string>): string | undefin
|
|
|
143
172
|
}
|
|
144
173
|
|
|
145
174
|
/** Project a value into a JSON-safe, scrubbed form. References become `{ $ref }`. */
|
|
146
|
-
function project(value: unknown, seen: Set<unknown>, reverse: Map<object, string>): unknown {
|
|
175
|
+
function project(value: unknown, seen: Set<unknown>, reverse: Map<object, string>, nodeIds: Set<string>): unknown {
|
|
147
176
|
if (value === null) return null;
|
|
148
177
|
const t = typeof value;
|
|
149
178
|
if (t === "string" || t === "number" || t === "boolean") return value;
|
|
@@ -157,8 +186,12 @@ function project(value: unknown, seen: Set<unknown>, reverse: Map<object, string
|
|
|
157
186
|
const to = refTarget(value, reverse);
|
|
158
187
|
return { $ref: to ? `${to}.${value.attribute}` : value.attribute } satisfies AttrRefEnvelope;
|
|
159
188
|
}
|
|
160
|
-
// Other intrinsics (interpolations, pseudo-parameters): mark, don't inline.
|
|
161
189
|
if ((value as Record<symbol, unknown>)[INTRINSIC_MARKER] === true) {
|
|
190
|
+
// A `Ref` to a known node is a real reference — surface it as `$ref` so attrs
|
|
191
|
+
// match the edge (#513). Other intrinsics (interpolations, pseudo-parameters,
|
|
192
|
+
// Ref to a non-node) stay opaque.
|
|
193
|
+
const to = refIntrinsicTarget(value);
|
|
194
|
+
if (to && nodeIds.has(to)) return { $ref: to } satisfies AttrRefEnvelope;
|
|
162
195
|
return { $intrinsic: true };
|
|
163
196
|
}
|
|
164
197
|
|
|
@@ -168,20 +201,20 @@ function project(value: unknown, seen: Set<unknown>, reverse: Map<object, string
|
|
|
168
201
|
// Nested declarables (e.g. an inlined property-kind resource) keep their
|
|
169
202
|
// config in a non-enumerable `props` bag, like top-level nodes — project that.
|
|
170
203
|
if (isDeclarable(value)) {
|
|
171
|
-
const out = projectConfig(value, seen, reverse);
|
|
204
|
+
const out = projectConfig(value, seen, reverse, nodeIds);
|
|
172
205
|
seen.delete(value);
|
|
173
206
|
return out;
|
|
174
207
|
}
|
|
175
208
|
|
|
176
209
|
if (Array.isArray(value)) {
|
|
177
|
-
const out = value.map((v) => project(v, seen, reverse)).filter((v) => v !== undefined);
|
|
210
|
+
const out = value.map((v) => project(v, seen, reverse, nodeIds)).filter((v) => v !== undefined);
|
|
178
211
|
seen.delete(value);
|
|
179
212
|
return out;
|
|
180
213
|
}
|
|
181
214
|
|
|
182
215
|
const out: Record<string, unknown> = {};
|
|
183
216
|
for (const [k, v] of Object.entries(value as Record<string, unknown>)) {
|
|
184
|
-
const p = project(v, seen, reverse);
|
|
217
|
+
const p = project(v, seen, reverse, nodeIds);
|
|
185
218
|
if (p !== undefined) out[k] = p;
|
|
186
219
|
}
|
|
187
220
|
seen.delete(value);
|
|
@@ -212,10 +245,11 @@ function projectConfig(
|
|
|
212
245
|
entity: Declarable,
|
|
213
246
|
seen: Set<unknown>,
|
|
214
247
|
reverse: Map<object, string>,
|
|
248
|
+
nodeIds: Set<string>,
|
|
215
249
|
): Record<string, unknown> {
|
|
216
250
|
const out: Record<string, unknown> = {};
|
|
217
251
|
for (const [k, v] of configRoots(entity)) {
|
|
218
|
-
const p = project(v, seen, reverse);
|
|
252
|
+
const p = project(v, seen, reverse, nodeIds);
|
|
219
253
|
if (p !== undefined) out[k] = p;
|
|
220
254
|
}
|
|
221
255
|
return out;
|
|
@@ -239,7 +273,13 @@ function collectEdges(
|
|
|
239
273
|
}
|
|
240
274
|
return;
|
|
241
275
|
}
|
|
242
|
-
if ((value as Record<symbol, unknown>)[INTRINSIC_MARKER] === true)
|
|
276
|
+
if ((value as Record<symbol, unknown>)[INTRINSIC_MARKER] === true) {
|
|
277
|
+
// A `Ref` to a known node (a Parameter, or a resource) is a real dependency
|
|
278
|
+
// — resolve it to an edge instead of dropping it as an opaque intrinsic (#513).
|
|
279
|
+
const to = refIntrinsicTarget(value);
|
|
280
|
+
if (to && to !== from && nodeIds.has(to)) edges.push({ from, to, kind: "ref", viaAttr });
|
|
281
|
+
return;
|
|
282
|
+
}
|
|
243
283
|
if (seen.has(value)) return;
|
|
244
284
|
seen.add(value);
|
|
245
285
|
if (Array.isArray(value)) {
|
|
@@ -287,7 +327,7 @@ export function buildGraphIr(
|
|
|
287
327
|
id: name,
|
|
288
328
|
kind: entity.entityType,
|
|
289
329
|
lexicon: entity.lexicon,
|
|
290
|
-
attrs: projectConfig(entity, new Set(), reverse),
|
|
330
|
+
attrs: projectConfig(entity, new Set(), reverse, nodeIds),
|
|
291
331
|
};
|
|
292
332
|
if (prov?.composite) node.compositeParent = prov.composite;
|
|
293
333
|
if (prov?.compositeInstance) node.compositeInstance = prov.compositeInstance;
|
|
@@ -339,8 +379,17 @@ export function buildGraphIr(
|
|
|
339
379
|
}
|
|
340
380
|
exports.sort((a, b) => a.name.localeCompare(b.name));
|
|
341
381
|
|
|
382
|
+
// Cross-stack imports: parameter nodes are the handles this stack imports by,
|
|
383
|
+
// matched to another stack's export names (#513). Detected by kind — the aws
|
|
384
|
+
// `Parameter` is the cross-stack input mechanism.
|
|
385
|
+
const imports: IRImport[] = nodes
|
|
386
|
+
.filter((n) => /(^|::)Parameter$/i.test(n.kind))
|
|
387
|
+
.map((n) => ({ name: n.id, node: n.id }))
|
|
388
|
+
.sort((a, b) => a.name.localeCompare(b.name));
|
|
389
|
+
|
|
342
390
|
const ir: GraphIR = { nodes, edges, groups };
|
|
343
391
|
if (exports.length) ir.exports = exports;
|
|
392
|
+
if (imports.length) ir.imports = imports;
|
|
344
393
|
return ir;
|
|
345
394
|
}
|
|
346
395
|
|