@intentius/chant-lexicon-pulumi 0.124.101 → 0.124.103

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.
Files changed (71) hide show
  1. package/dist/change-set.d.ts +5 -0
  2. package/dist/change-set.js +4 -0
  3. package/dist/chant-floors.d.ts +36 -0
  4. package/dist/chant-floors.js +36 -0
  5. package/dist/cost-hold.d.ts +45 -0
  6. package/dist/cost-hold.js +49 -0
  7. package/dist/describe-resources.d.ts +10 -0
  8. package/dist/describe-resources.js +79 -3
  9. package/dist/disruption.d.ts +50 -0
  10. package/dist/disruption.js +104 -0
  11. package/dist/engine-graph.d.ts +1 -1
  12. package/dist/engine-graph.js +40 -1
  13. package/dist/health-targets.d.ts +25 -0
  14. package/dist/health-targets.js +57 -0
  15. package/dist/index.d.ts +7 -0
  16. package/dist/index.js +8 -0
  17. package/dist/integrity.json +18 -18
  18. package/dist/lint/post-synth/member-read-helpers.d.ts +1 -1
  19. package/dist/lint/post-synth/member-read-helpers.js +1 -1
  20. package/dist/lint/post-synth/pul001.js +1 -1
  21. package/dist/lint/post-synth/pul002.js +1 -1
  22. package/dist/lint/post-synth/pul003.js +1 -1
  23. package/dist/lint/post-synth/pul004.js +1 -1
  24. package/dist/lint/post-synth/pul005.js +1 -1
  25. package/dist/lint/post-synth/pul006.js +1 -1
  26. package/dist/lint/post-synth/pul007.js +1 -1
  27. package/dist/lint/post-synth/pul008.js +1 -1
  28. package/dist/lint/post-synth/pul009.js +1 -1
  29. package/dist/lint/post-synth/pul010.js +1 -1
  30. package/dist/lint/post-synth/pul011.js +1 -1
  31. package/dist/lint/post-synth/pul012.js +1 -1
  32. package/dist/lint/post-synth/pul013.js +1 -1
  33. package/dist/lint/post-synth/pul014.js +1 -1
  34. package/dist/lint/post-synth/pul015.js +1 -1
  35. package/dist/manifest.json +1 -1
  36. package/dist/member-outputs.js +1 -1
  37. package/dist/member-report.d.ts +32 -0
  38. package/dist/member-report.js +23 -0
  39. package/dist/plugin.js +35 -2
  40. package/dist/preview-observation.d.ts +97 -0
  41. package/dist/preview-observation.js +218 -0
  42. package/dist/pulumi-up.d.ts +44 -3
  43. package/dist/pulumi-up.js +71 -11
  44. package/dist/reference-catalog.d.ts +84 -0
  45. package/dist/reference-catalog.js +383 -0
  46. package/dist/reference-props.d.ts +19 -0
  47. package/dist/reference-props.js +93 -0
  48. package/dist/rules/member-read-helpers.ts +1 -1
  49. package/dist/rules/pul001.ts +1 -1
  50. package/dist/rules/pul002.ts +1 -1
  51. package/dist/rules/pul003.ts +1 -1
  52. package/dist/rules/pul004.ts +1 -1
  53. package/dist/rules/pul005.ts +1 -1
  54. package/dist/rules/pul006.ts +1 -1
  55. package/dist/rules/pul007.ts +1 -1
  56. package/dist/rules/pul008.ts +1 -1
  57. package/dist/rules/pul009.ts +1 -1
  58. package/dist/rules/pul010.ts +1 -1
  59. package/dist/rules/pul011.ts +1 -1
  60. package/dist/rules/pul012.ts +1 -1
  61. package/dist/rules/pul013.ts +1 -1
  62. package/dist/rules/pul014.ts +1 -1
  63. package/dist/rules/pul015.ts +1 -1
  64. package/dist/run.js +1 -1
  65. package/dist/stack-export-snapshot.js +1 -1
  66. package/dist/stack-references.js +6 -1
  67. package/dist/workspace-member.d.ts +1 -26
  68. package/dist/workspace-member.js +11 -21
  69. package/dist/workspace-stack-reads.d.ts +12 -0
  70. package/dist/workspace-stack-reads.js +60 -0
  71. package/package.json +3 -3
@@ -9,7 +9,7 @@
9
9
  */
10
10
  import type { PostSynthCheck, PostSynthContext, PostSynthDiagnostic } from "@intentius/chant/lint/post-synth";
11
11
  import { isPulumiNodeless } from "@intentius/chant/pulumi-urn";
12
- import { PULUMI_EXPORT_FILE } from "../../workspace-member";
12
+ import { PULUMI_EXPORT_FILE } from "../../member-report";
13
13
  import { finding, memberExport } from "./member-read-helpers";
14
14
 
15
15
  export const pul014: PostSynthCheck = {
@@ -15,7 +15,7 @@
15
15
  */
16
16
  import type { PostSynthCheck, PostSynthContext, PostSynthDiagnostic } from "@intentius/chant/lint/post-synth";
17
17
  import { pulumiMemberEngine } from "../../run";
18
- import { lastMemberRead } from "../../workspace-member";
18
+ import { lastMemberRead } from "../../member-report";
19
19
  import { finding } from "./member-read-helpers";
20
20
 
21
21
  export const pul015: PostSynthCheck = {
package/dist/run.js CHANGED
@@ -121,7 +121,7 @@ import { pulumiExportResources, pulumiPreviewPart } from "./change-set.js";
121
121
  import { pulumiRefreshArgs, pulumiRefreshDocumentRecords, pulumiRefreshDriftRecords } from "./drift-record.js";
122
122
  import { plungeDriftArgs, plungeDriftStreamRecords } from "./drift-record.js";
123
123
  import { pulumiMemberEngine } from "./member-engine.js";
124
- import { PULUMI_EXPORT_FILE } from "./workspace-member.js";
124
+ import { PULUMI_EXPORT_FILE } from "./member-report.js";
125
125
  const execFileAsync = promisify(execFile);
126
126
  /**
127
127
  * The engine's environment: no update check, and no PULUMI_SKIP_CONFIRMATIONS, which stands for `--yes` and
@@ -44,7 +44,7 @@ import { pulumiExportResources } from "./change-set.js";
44
44
  import { pulumiExportedOutputValues } from "./member-outputs.js";
45
45
  import { defaultPlungeRunner, defaultPulumiRunner, pulumiRunFailure, readMemberExport, runAllowedPlunge, runAllowedPulumi, } from "./run.js";
46
46
  import { isObject, PULUMI_BLINDED_SECRET, PULUMI_SECRET_SIG, PULUMI_SIG_KEY } from "./values.js";
47
- import { PULUMI_EXPORT_FILE } from "./workspace-member.js";
47
+ import { PULUMI_EXPORT_FILE } from "./member-report.js";
48
48
  const execFileAsync = promisify(execFile);
49
49
  /** The store key's suffix: `<stack>__pulumi-export`, beside the lexicon snapshot's `<stack>__pulumi`. */
50
50
  export const PULUMI_EXPORT_SNAPSHOT_SUFFIX = "pulumi-export";
@@ -18,7 +18,12 @@
18
18
  * waves put the referenced stack first, a failed upstream holds the reader,
19
19
  * and a reader whose upstream's plan cannot say a value waits for its `up`.
20
20
  *
21
- * What adds no edge, and is reported on the plan by name
21
+ * `graphReads` (`./pulumi-up.ts`, #5331) is the same reader for `chant graph
22
+ * --components`: an edge from the reader's component to the upstream's, one
23
+ * per output the export recorded (secret ones by name), and for a reference
24
+ * to a stack no step applies, a node marked external to draw the edge to.
25
+ *
26
+ * What adds no edge to the wave order, and is reported on the plan by name
22
27
  * (`PulumiUpArtifact.stackReferences.outside`): a reference to a stack no
23
28
  * step in the project applies, one two steps could own, and one whose
24
29
  * export recorded no output that is not secret (core reads a stack's
@@ -1,6 +1,4 @@
1
1
  import { type Declarable } from "@intentius/chant/declarable";
2
- /** The conventional place of the export, in the member's directory. */
3
- export declare const PULUMI_EXPORT_FILE = "stack-export.json";
4
2
  export interface PulumiMemberConfig {
5
3
  /** The member's directory, absolute. */
6
4
  dir: string;
@@ -71,27 +69,4 @@ export declare function readPulumiMember(opts: {
71
69
  /** The parsed export, when there is one that reads as JSON. The post-synth checks read it; `meta` does not carry it. */
72
70
  doc?: unknown;
73
71
  };
74
- /**
75
- * What the last member read in this process saw, for the post-synth checks
76
- * PUL003 to PUL015 (`./lint/post-synth/`). It holds the parsed export, so it
77
- * stays in the process and never reaches the graph's `meta`, which carries
78
- * only {@link PulumiMemberReport}.
79
- */
80
- export interface PulumiMemberRead {
81
- /** The member's directory, absolute. */
82
- dir: string;
83
- /** The label the entities are keyed by. */
84
- label: string;
85
- /** `pulumi.member.engine`, when the config sets it. */
86
- engine?: "pulumi" | "plunge";
87
- /** `pulumi.member.stack`, when the config sets it. */
88
- stack?: string;
89
- /** The parsed export, the index store's or the checked-in `stack-export.json`; undefined when there is none or it is not JSON. */
90
- doc?: unknown;
91
- }
92
- /** Left by the plugin's `buildRoots` beside the report; see {@link PulumiMemberRead}. */
93
- export declare function setLastMemberRead(read: PulumiMemberRead | undefined): void;
94
- export declare function lastMemberRead(): PulumiMemberRead | undefined;
95
- /** The report of the read in this process, left for `graphMeta` (see the aws member reader). */
96
- export declare function setLastMemberReport(report: PulumiMemberReport | undefined): void;
97
- export declare function lastMemberReport(): PulumiMemberReport | undefined;
72
+ export { PULUMI_EXPORT_FILE, lastMemberRead, lastMemberReport, setLastMemberRead, setLastMemberReport, type PulumiMemberRead } from "./member-report.js";
@@ -29,8 +29,10 @@
29
29
  * resources that name them are not edged to them. Edges come from each
30
30
  * resource's `dependencies` and `parent`, kept only when the target is a node,
31
31
  * each with `grain: "instance"` (#4529): it joins two resources, not two
32
- * blocks of source. Inputs and outputs are not copied into the node, since an
33
- * export can hold secrets.
32
+ * blocks of source. A node carries the values its resource is named by and
33
+ * names others by (`./reference-props.ts`, #5330): inputs and the top-level
34
+ * string outputs, minus secrets and credential-like keys, for the lexicon's
35
+ * `referenceCatalog` to read. Nothing else of the inputs and outputs is copied.
34
36
  *
35
37
  * A member on plunge may also check in {@link PULUMI_ENGINE_GRAPH_FILE}
36
38
  * beside the export: what `plunge graph --json --stack <stack>` printed
@@ -49,8 +51,8 @@ import { DECLARABLE_MARKER } from "@intentius/chant/declarable";
49
51
  import { isPulumiNodeless, pulumiNodeKey } from "@intentius/chant/pulumi-urn";
50
52
  import { PULUMI_ENGINE_GRAPH_FILE, readPlungeEngineGraph } from "./engine-graph.js";
51
53
  import { pulumiMemberEngine } from "./member-engine.js";
52
- /** The conventional place of the export, in the member's directory. */
53
- export const PULUMI_EXPORT_FILE = "stack-export.json";
54
+ import { referenceProps } from "./reference-props.js";
55
+ import { PULUMI_EXPORT_FILE } from "./member-report.js";
54
56
  export function readPulumiMember(opts) {
55
57
  const { member } = opts;
56
58
  const label = member.label ?? basename(member.dir);
@@ -113,12 +115,15 @@ export function readPulumiMember(opts) {
113
115
  if (references.size > before)
114
116
  propertyEdges++;
115
117
  }
118
+ // The component that registered it (#5403): the export's `parent`, when that is a node.
119
+ const component = node(r.parent);
116
120
  const entity = {
117
121
  lexicon: "pulumi",
118
122
  entityType: r.type,
119
123
  kind: "resource",
120
- props: {},
124
+ props: referenceProps(r),
121
125
  references: [...references.values()],
126
+ ...(component && component !== key ? { component } : {}),
122
127
  [DECLARABLE_MARKER]: true,
123
128
  };
124
129
  const facts = engine?.facts.get(urn);
@@ -184,19 +189,4 @@ function readMemberEngineGraph(dir, label, warnings) {
184
189
  },
185
190
  };
186
191
  }
187
- let lastRead;
188
- /** Left by the plugin's `buildRoots` beside the report; see {@link PulumiMemberRead}. */
189
- export function setLastMemberRead(read) {
190
- lastRead = read;
191
- }
192
- export function lastMemberRead() {
193
- return lastRead;
194
- }
195
- let lastReport;
196
- /** The report of the read in this process, left for `graphMeta` (see the aws member reader). */
197
- export function setLastMemberReport(report) {
198
- lastReport = report;
199
- }
200
- export function lastMemberReport() {
201
- return lastReport;
202
- }
192
+ export { PULUMI_EXPORT_FILE, lastMemberRead, lastMemberReport, setLastMemberRead, setLastMemberReport } from "./member-report.js";
@@ -0,0 +1,12 @@
1
+ import type { LexiconStackReads } from "@intentius/chant/lexicon";
2
+ export declare function pulumiWorkspaceStackReads(ctx: {
3
+ root: string;
4
+ env?: string;
5
+ members: readonly {
6
+ name: string;
7
+ dir: string;
8
+ kind: string;
9
+ }[];
10
+ }, opts?: {
11
+ exportStore?: null;
12
+ }): Promise<LexiconStackReads | undefined>;
@@ -0,0 +1,60 @@
1
+ /**
2
+ * `StackReference` reads between workspace members (#5331), for `chant
3
+ * workspace graph`. The graph composition asks the lexicon once with every
4
+ * declared member; each member of kind `pulumi` is a step of the same shape
5
+ * `pulumi-up` takes (`dir`, `stack`), and {@link pulumiStackReads}, the
6
+ * reader behind `declaredReads` and `graphReads`, finds its references. A
7
+ * reference to the stack another member applies is a read of that member; one
8
+ * to a stack no member applies is external.
9
+ *
10
+ * A member's stack is `--env` when the member has a `Pulumi.<env>.yaml`
11
+ * (the stack the environment deploys), else the stack its checked-in export
12
+ * records. A member with neither takes part in no read. The node each member
13
+ * is drawn as is `pulumi:pulumi:Stack`, the type token of the stack's own
14
+ * resource, which the member read leaves out.
15
+ */
16
+ import { existsSync, readFileSync } from "node:fs";
17
+ import { isAbsolute, join, resolve } from "node:path";
18
+ import { PULUMI_STACK_TYPE } from "@intentius/chant/pulumi-urn";
19
+ import { pulumiStackReads } from "./pulumi-up.js";
20
+ import { PULUMI_EXPORT_FILE } from "./member-report.js";
21
+ import { isObject } from "./values.js";
22
+ /** The stack a checked-in export records: the stack of its first URN (`urn:pulumi:<stack>::<project>::...`). */
23
+ function exportedStack(dir) {
24
+ try {
25
+ const doc = JSON.parse(readFileSync(join(dir, PULUMI_EXPORT_FILE), "utf-8"));
26
+ const list = isObject(doc) && isObject(doc.deployment) && Array.isArray(doc.deployment.resources) ? doc.deployment.resources : [];
27
+ for (const r of list) {
28
+ const urn = isObject(r) && typeof r.urn === "string" ? r.urn : undefined;
29
+ const m = urn ? /^urn:pulumi:([^:]+)::/.exec(urn) : undefined;
30
+ if (m)
31
+ return m[1];
32
+ }
33
+ }
34
+ catch {
35
+ // No readable export: the member has no stack to name.
36
+ }
37
+ return undefined;
38
+ }
39
+ export async function pulumiWorkspaceStackReads(ctx, opts = {}) {
40
+ const steps = ctx.members
41
+ .filter((m) => m.kind === "pulumi")
42
+ .map((m) => {
43
+ const dir = isAbsolute(m.dir) ? m.dir : resolve(ctx.root, m.dir);
44
+ const stack = ctx.env && existsSync(join(dir, `Pulumi.${ctx.env}.yaml`)) ? ctx.env : exportedStack(dir);
45
+ return stack === undefined ? undefined : { component: m.name, index: 0, step: { dir, stack } };
46
+ })
47
+ .filter((s) => s !== undefined);
48
+ if (steps.length === 0)
49
+ return undefined;
50
+ const reads = await pulumiStackReads({ root: ctx.root }, steps, opts);
51
+ return {
52
+ lexicon: "pulumi",
53
+ stacks: steps.map((s) => ({ member: s.component, id: PULUMI_STACK_TYPE, kind: PULUMI_STACK_TYPE, attrs: { stack: s.step.stack } })),
54
+ reads: reads.flatMap((r) => {
55
+ const where = "upstream" in r.target ? { upstream: r.target.upstream } : { external: r.target.external };
56
+ const outputs = [...r.outputs, ...r.secretOutputs].sort();
57
+ return outputs.length === 0 ? [{ reader: r.reader, ...where }] : outputs.map((output) => ({ reader: r.reader, ...where, output }));
58
+ }),
59
+ };
60
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intentius/chant-lexicon-pulumi",
3
- "version": "0.124.101",
3
+ "version": "0.124.103",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist/",
@@ -41,7 +41,7 @@
41
41
  "bundle": "tsx src/package-cli.ts",
42
42
  "docs": "npx tsx src/codegen/docs-cli.ts",
43
43
  "build": "../../scripts/tsc7.sh -p tsconfig.build.json --sourceMap false && tsc-alias -p tsconfig.build.json && node ../../scripts/copy-lexicon-assets.mjs",
44
- "prepack": "npm run generate && npm run bundle && npm run validate && npm run build"
44
+ "prepack": "npm run generate && npm run bundle && npm run validate && tsx ../../scripts/release-floors.ts --lexicon pulumi --pack npm run build"
45
45
  },
46
46
  "devDependencies": {
47
47
  "@intentius/chant": "*",
@@ -53,7 +53,7 @@
53
53
  "access": "public"
54
54
  },
55
55
  "peerDependencies": {
56
- "@intentius/chant": "^0.124.101",
56
+ "@intentius/chant": "^0.124.110",
57
57
  "zod": "^4.3.6"
58
58
  },
59
59
  "description": "pulumi lexicon for chant: a Pulumi program as a workspace member, its preview in the change set and its refresh as drift records",