@intentius/chant-lexicon-pulumi 0.124.98 → 0.124.99
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/adopt.d.ts +0 -1
- package/dist/capability-plugin.d.ts +0 -1
- package/dist/change-set.d.ts +0 -1
- package/dist/changed-units.d.ts +0 -1
- package/dist/check-step.d.ts +0 -1
- package/dist/ci-setup.d.ts +0 -1
- package/dist/codegen/docs-cli.d.ts +0 -1
- package/dist/codegen/docs.d.ts +0 -1
- package/dist/codegen/package.d.ts +0 -1
- package/dist/composites/pulumi-adopt-op.d.ts +0 -1
- package/dist/composites/pulumi-watch-op.d.ts +0 -1
- package/dist/config.d.ts +0 -1
- package/dist/describe-resources.d.ts +0 -1
- package/dist/drift-read.d.ts +0 -1
- package/dist/drift-record.d.ts +0 -1
- package/dist/engine-events.d.ts +0 -1
- package/dist/engine-graph.d.ts +0 -1
- package/dist/exit-codes.d.ts +0 -1
- package/dist/index.d.ts +0 -1
- package/dist/init-templates.d.ts +0 -1
- package/dist/integrity.json +2 -2
- package/dist/lint/audit-catalog.d.ts +0 -1
- package/dist/lint/post-synth/index.d.ts +0 -1
- package/dist/lint/post-synth/member-read-helpers.d.ts +0 -1
- package/dist/lint/post-synth/pul001.d.ts +0 -1
- package/dist/lint/post-synth/pul002.d.ts +0 -1
- package/dist/lint/post-synth/pul003.d.ts +0 -1
- package/dist/lint/post-synth/pul004.d.ts +0 -1
- package/dist/lint/post-synth/pul005.d.ts +0 -1
- package/dist/lint/post-synth/pul006.d.ts +0 -1
- package/dist/lint/post-synth/pul007.d.ts +0 -1
- package/dist/lint/post-synth/pul008.d.ts +0 -1
- package/dist/lint/post-synth/pul009.d.ts +0 -1
- package/dist/lint/post-synth/pul010.d.ts +0 -1
- package/dist/lint/post-synth/pul011.d.ts +0 -1
- package/dist/lint/post-synth/pul012.d.ts +0 -1
- package/dist/lint/post-synth/pul013.d.ts +0 -1
- package/dist/lint/post-synth/pul014.d.ts +0 -1
- package/dist/lint/post-synth/pul015.d.ts +0 -1
- package/dist/lint/rules/index.d.ts +0 -1
- package/dist/lint/rules/member-dir-absolute.d.ts +0 -1
- package/dist/lock-rows.d.ts +0 -1
- package/dist/lsp/completions.d.ts +0 -1
- package/dist/lsp/documents.d.ts +0 -1
- package/dist/lsp/hover.d.ts +0 -1
- package/dist/lsp/keys.d.ts +0 -1
- package/dist/lsp/object-path.d.ts +0 -1
- package/dist/lsp/yaml-cursor.d.ts +0 -1
- package/dist/manifest.json +1 -1
- package/dist/member-engine.d.ts +0 -1
- package/dist/member-outputs.d.ts +0 -1
- package/dist/op/activities/index.d.ts +0 -1
- package/dist/op/activities/pulumi-adopt.d.ts +0 -1
- package/dist/op/activities/pulumi.d.ts +0 -1
- package/dist/op/activity-contracts.d.ts +0 -1
- package/dist/op/builders.d.ts +0 -1
- package/dist/package-cli.d.ts +0 -1
- package/dist/plan-shape.d.ts +0 -1
- package/dist/planned-output-changes.d.ts +0 -1
- package/dist/plugin.d.ts +0 -1
- package/dist/plunge-timings.d.ts +0 -1
- package/dist/preview-tips.d.ts +0 -1
- package/dist/pulumi-up.d.ts +0 -1
- package/dist/release-copy.d.ts +0 -1
- package/dist/review-stack.d.ts +0 -1
- package/dist/run.d.ts +0 -1
- package/dist/serializer.d.ts +0 -1
- package/dist/stack-export-snapshot.d.ts +0 -1
- package/dist/stack-ops.d.ts +0 -1
- package/dist/stack-outputs.d.ts +0 -1
- package/dist/stack-references.d.ts +0 -1
- package/dist/trace-facts.d.ts +0 -1
- package/dist/values.d.ts +0 -1
- package/dist/workspace-member.d.ts +0 -1
- package/package.json +3 -4
- package/dist/adopt.d.ts.map +0 -1
- package/dist/capability-plugin.d.ts.map +0 -1
- package/dist/change-set.d.ts.map +0 -1
- package/dist/changed-units.d.ts.map +0 -1
- package/dist/check-step.d.ts.map +0 -1
- package/dist/ci-setup.d.ts.map +0 -1
- package/dist/codegen/docs-cli.d.ts.map +0 -1
- package/dist/codegen/docs.d.ts.map +0 -1
- package/dist/codegen/package.d.ts.map +0 -1
- package/dist/composites/pulumi-adopt-op.d.ts.map +0 -1
- package/dist/composites/pulumi-watch-op.d.ts.map +0 -1
- package/dist/config.d.ts.map +0 -1
- package/dist/describe-resources.d.ts.map +0 -1
- package/dist/drift-read.d.ts.map +0 -1
- package/dist/drift-record.d.ts.map +0 -1
- package/dist/engine-events.d.ts.map +0 -1
- package/dist/engine-graph.d.ts.map +0 -1
- package/dist/exit-codes.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/init-templates.d.ts.map +0 -1
- package/dist/lint/audit-catalog.d.ts.map +0 -1
- package/dist/lint/post-synth/index.d.ts.map +0 -1
- package/dist/lint/post-synth/member-read-helpers.d.ts.map +0 -1
- package/dist/lint/post-synth/pul001.d.ts.map +0 -1
- package/dist/lint/post-synth/pul002.d.ts.map +0 -1
- package/dist/lint/post-synth/pul003.d.ts.map +0 -1
- package/dist/lint/post-synth/pul004.d.ts.map +0 -1
- package/dist/lint/post-synth/pul005.d.ts.map +0 -1
- package/dist/lint/post-synth/pul006.d.ts.map +0 -1
- package/dist/lint/post-synth/pul007.d.ts.map +0 -1
- package/dist/lint/post-synth/pul008.d.ts.map +0 -1
- package/dist/lint/post-synth/pul009.d.ts.map +0 -1
- package/dist/lint/post-synth/pul010.d.ts.map +0 -1
- package/dist/lint/post-synth/pul011.d.ts.map +0 -1
- package/dist/lint/post-synth/pul012.d.ts.map +0 -1
- package/dist/lint/post-synth/pul013.d.ts.map +0 -1
- package/dist/lint/post-synth/pul014.d.ts.map +0 -1
- package/dist/lint/post-synth/pul015.d.ts.map +0 -1
- package/dist/lint/rules/index.d.ts.map +0 -1
- package/dist/lint/rules/member-dir-absolute.d.ts.map +0 -1
- package/dist/lock-rows.d.ts.map +0 -1
- package/dist/lsp/completions.d.ts.map +0 -1
- package/dist/lsp/documents.d.ts.map +0 -1
- package/dist/lsp/hover.d.ts.map +0 -1
- package/dist/lsp/keys.d.ts.map +0 -1
- package/dist/lsp/object-path.d.ts.map +0 -1
- package/dist/lsp/yaml-cursor.d.ts.map +0 -1
- package/dist/member-engine.d.ts.map +0 -1
- package/dist/member-outputs.d.ts.map +0 -1
- package/dist/op/activities/index.d.ts.map +0 -1
- package/dist/op/activities/pulumi-adopt.d.ts.map +0 -1
- package/dist/op/activities/pulumi.d.ts.map +0 -1
- package/dist/op/activity-contracts.d.ts.map +0 -1
- package/dist/op/builders.d.ts.map +0 -1
- package/dist/package-cli.d.ts.map +0 -1
- package/dist/plan-shape.d.ts.map +0 -1
- package/dist/planned-output-changes.d.ts.map +0 -1
- package/dist/plugin.d.ts.map +0 -1
- package/dist/plunge-timings.d.ts.map +0 -1
- package/dist/preview-tips.d.ts.map +0 -1
- package/dist/pulumi-up.d.ts.map +0 -1
- package/dist/release-copy.d.ts.map +0 -1
- package/dist/review-stack.d.ts.map +0 -1
- package/dist/run.d.ts.map +0 -1
- package/dist/serializer.d.ts.map +0 -1
- package/dist/stack-export-snapshot.d.ts.map +0 -1
- package/dist/stack-ops.d.ts.map +0 -1
- package/dist/stack-outputs.d.ts.map +0 -1
- package/dist/stack-references.d.ts.map +0 -1
- package/dist/trace-facts.d.ts.map +0 -1
- package/dist/values.d.ts.map +0 -1
- package/dist/workspace-member.d.ts.map +0 -1
- package/src/adopt.ts +0 -202
- package/src/capability-plugin.ts +0 -34
- package/src/change-set.test.ts +0 -245
- package/src/change-set.ts +0 -508
- package/src/changed-units.test.ts +0 -87
- package/src/changed-units.ts +0 -96
- package/src/check-step.test.ts +0 -191
- package/src/check-step.ts +0 -316
- package/src/ci-setup.test.ts +0 -234
- package/src/ci-setup.ts +0 -224
- package/src/codegen/docs-cli.ts +0 -4
- package/src/codegen/docs.ts +0 -58
- package/src/codegen/package.ts +0 -63
- package/src/composites/pulumi-adopt-op.test.ts +0 -258
- package/src/composites/pulumi-adopt-op.ts +0 -193
- package/src/composites/pulumi-watch-op.test.ts +0 -42
- package/src/composites/pulumi-watch-op.ts +0 -85
- package/src/config.ts +0 -43
- package/src/describe-resources.test.ts +0 -112
- package/src/describe-resources.ts +0 -118
- package/src/drift-read.test.ts +0 -178
- package/src/drift-read.ts +0 -94
- package/src/drift-record.test.ts +0 -197
- package/src/drift-record.ts +0 -326
- package/src/engine-events.test.ts +0 -160
- package/src/engine-events.ts +0 -395
- package/src/engine-graph.test.ts +0 -141
- package/src/engine-graph.ts +0 -149
- package/src/exit-codes.test.ts +0 -21
- package/src/exit-codes.ts +0 -71
- package/src/index.ts +0 -139
- package/src/init-templates.ts +0 -85
- package/src/lint/audit-catalog.test.ts +0 -33
- package/src/lint/audit-catalog.ts +0 -174
- package/src/lint/post-synth/index.ts +0 -35
- package/src/lint/post-synth/member-read-helpers.ts +0 -122
- package/src/lint/post-synth/post-synth.test.ts +0 -245
- package/src/lint/post-synth/pul001.ts +0 -38
- package/src/lint/post-synth/pul002.ts +0 -38
- package/src/lint/post-synth/pul003.ts +0 -43
- package/src/lint/post-synth/pul004.ts +0 -32
- package/src/lint/post-synth/pul005.ts +0 -31
- package/src/lint/post-synth/pul006.ts +0 -31
- package/src/lint/post-synth/pul007.ts +0 -35
- package/src/lint/post-synth/pul008.ts +0 -35
- package/src/lint/post-synth/pul009.ts +0 -32
- package/src/lint/post-synth/pul010.ts +0 -42
- package/src/lint/post-synth/pul011.ts +0 -38
- package/src/lint/post-synth/pul012.ts +0 -35
- package/src/lint/post-synth/pul013.ts +0 -35
- package/src/lint/post-synth/pul014.ts +0 -32
- package/src/lint/post-synth/pul015.ts +0 -39
- package/src/lint/rules/index.ts +0 -7
- package/src/lint/rules/member-dir-absolute.test.ts +0 -37
- package/src/lint/rules/member-dir-absolute.ts +0 -83
- package/src/lock-rows.test.ts +0 -60
- package/src/lock-rows.ts +0 -56
- package/src/lsp/completions.test.ts +0 -69
- package/src/lsp/completions.ts +0 -119
- package/src/lsp/documents.ts +0 -48
- package/src/lsp/hover.test.ts +0 -56
- package/src/lsp/hover.ts +0 -83
- package/src/lsp/keys.ts +0 -169
- package/src/lsp/object-path.ts +0 -71
- package/src/lsp/yaml-cursor.ts +0 -85
- package/src/member-engine.test.ts +0 -112
- package/src/member-engine.ts +0 -97
- package/src/member-outputs.test.ts +0 -339
- package/src/member-outputs.ts +0 -157
- package/src/op/activities/index.ts +0 -36
- package/src/op/activities/pulumi-adopt.ts +0 -345
- package/src/op/activities/pulumi.ts +0 -136
- package/src/op/activity-contracts.ts +0 -129
- package/src/op/builders.ts +0 -67
- package/src/package-cli.ts +0 -14
- package/src/plan-shape.test.ts +0 -91
- package/src/plan-shape.ts +0 -105
- package/src/planned-output-changes.test.ts +0 -85
- package/src/planned-output-changes.ts +0 -141
- package/src/plugin.test.ts +0 -96
- package/src/plugin.ts +0 -272
- package/src/plunge-timings.test.ts +0 -241
- package/src/plunge-timings.ts +0 -115
- package/src/plunge-up-failed.test.ts +0 -54
- package/src/pr-note.test.ts +0 -87
- package/src/preview-generated.test.ts +0 -124
- package/src/preview-tips.test.ts +0 -134
- package/src/preview-tips.ts +0 -128
- package/src/pulumi-up.test.ts +0 -581
- package/src/pulumi-up.ts +0 -1102
- package/src/pulumi-urn-node.test.ts +0 -94
- package/src/release-copy.test.ts +0 -162
- package/src/release-copy.ts +0 -223
- package/src/review-stack.test.ts +0 -254
- package/src/review-stack.ts +0 -266
- package/src/run-plan-flags.test.ts +0 -53
- package/src/run.test.ts +0 -540
- package/src/run.ts +0 -1129
- package/src/serializer.test.ts +0 -9
- package/src/serializer.ts +0 -15
- package/src/skills/chant-pulumi-plunge.md +0 -51
- package/src/skills/chant-pulumi-stack-export.md +0 -54
- package/src/skills/chant-pulumi.md +0 -83
- package/src/stack-export-snapshot.test.ts +0 -192
- package/src/stack-export-snapshot.ts +0 -312
- package/src/stack-ops.fake-binary.test.ts +0 -323
- package/src/stack-ops.test.ts +0 -511
- package/src/stack-ops.ts +0 -1082
- package/src/stack-outputs.ts +0 -66
- package/src/stack-references.test.ts +0 -96
- package/src/stack-references.ts +0 -110
- package/src/testdata/plunge-drift/README.md +0 -10
- package/src/testdata/plunge-drift/assets-drifted.ndjson +0 -3
- package/src/testdata/plunge-drift/component-unsupported.ndjson +0 -3
- package/src/testdata/plunge-drift/role-in-sync.ndjson +0 -3
- package/src/testdata/plunge-drift/settled-empty.ndjson +0 -2
- package/src/testdata/plunge-graph/Pulumi.yaml +0 -4
- package/src/testdata/plunge-graph/README.md +0 -12
- package/src/testdata/plunge-graph/engine-graph.json +0 -158
- package/src/testdata/plunge-graph/stack-export.json +0 -49
- package/src/testdata/plunge-member/Pulumi.yaml +0 -4
- package/src/testdata/plunge-member/README.md +0 -3
- package/src/testdata/plunge-member/stack-export.json +0 -480
- package/src/testdata/plunge-outputs/Pulumi.yaml +0 -9
- package/src/testdata/plunge-outputs/README.md +0 -7
- package/src/testdata/plunge-outputs/stack-export.json +0 -2003
- package/src/testdata/plunge-outputs/stack-output.json +0 -19
- package/src/testdata/pulumi-member/Pulumi.yaml +0 -2
- package/src/testdata/pulumi-member/README.md +0 -50
- package/src/testdata/pulumi-member/recording/Pulumi.dev.yaml +0 -19
- package/src/testdata/pulumi-member/recording/Pulumi.yaml +0 -7
- package/src/testdata/pulumi-member/recording/index.js +0 -47
- package/src/testdata/pulumi-member/recording/package-lock.json +0 -2707
- package/src/testdata/pulumi-member/recording/package.json +0 -9
- package/src/testdata/pulumi-member/stack-export.json +0 -746
- package/src/testdata/pulumi-outputs/Pulumi.yaml +0 -7
- package/src/testdata/pulumi-outputs/README.md +0 -9
- package/src/testdata/pulumi-outputs/preview-replaced.json +0 -2894
- package/src/testdata/pulumi-outputs/preview-settled.json +0 -2894
- package/src/testdata/pulumi-outputs/stack-export.json +0 -1919
- package/src/testdata/pulumi-outputs/stack-output.json +0 -19
- package/src/testdata/pulumi-preview/Pulumi.yaml +0 -7
- package/src/testdata/pulumi-preview/README.md +0 -9
- package/src/testdata/pulumi-preview/preview-create.json +0 -992
- package/src/testdata/pulumi-preview/preview.json +0 -2894
- package/src/testdata/pulumi-preview/stack-export.json +0 -1919
- package/src/testdata/pulumi-refresh/Pulumi.yaml +0 -7
- package/src/testdata/pulumi-refresh/README.md +0 -14
- package/src/testdata/pulumi-refresh/all.json +0 -3742
- package/src/testdata/pulumi-refresh/bucket-edited.json +0 -468
- package/src/testdata/pulumi-refresh/policy-deleted.json +0 -95
- package/src/testdata/pulumi-refresh/queue-edited.json +0 -250
- package/src/testdata/pulumi-refresh/role-same.json +0 -242
- package/src/testdata/pulumi-refresh/secret-edited.json +0 -247
- package/src/testdata/pulumi-refresh/stack-export.json +0 -1907
- package/src/testdata/pulumi-stream/README.md +0 -16
- package/src/testdata/pulumi-stream/preview-stream.ndjson +0 -42
- package/src/testdata/pulumi-stream/up-failed-plunge.ndjson +0 -5
- package/src/testdata/pulumi-unexported/Pulumi.yaml +0 -2
- package/src/testdata/pulumi-urn-node/Pulumi.yaml +0 -7
- package/src/testdata/pulumi-urn-node/README.md +0 -9
- package/src/testdata/pulumi-urn-node/preview.json +0 -2894
- package/src/testdata/pulumi-urn-node/stack-export.json +0 -1919
- package/src/trace-facts.test.ts +0 -38
- package/src/trace-facts.ts +0 -83
- package/src/values.ts +0 -147
- package/src/workspace-kinds.test.ts +0 -47
- package/src/workspace-member.test.ts +0 -127
- package/src/workspace-member.ts +0 -304
package/src/workspace-member.ts
DELETED
|
@@ -1,304 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Reading a pulumi workspace member into the graph (#3179).
|
|
3
|
-
*
|
|
4
|
-
* `chant workspace graph` writes a reader project for a member of kind
|
|
5
|
-
* `pulumi`, with `pulumi.member` in its config (see `workspace-kinds.json`).
|
|
6
|
-
* The plugin's `buildRoots` hook calls {@link readPulumiMember} with the
|
|
7
|
-
* `pulumi stack export` the index store holds for the member (#4546): the
|
|
8
|
-
* `pulumi-up` capability writes it, secrets stripped, after each apply
|
|
9
|
-
* (`./stack-export-snapshot.ts`, `refs/chant/snapshots` by default). When
|
|
10
|
-
* the store holds none, the read takes the export the member has checked in,
|
|
11
|
-
* at {@link PULUMI_EXPORT_FILE} in its directory. The graph read never runs
|
|
12
|
-
* the program or `pulumi`: with no export there are no nodes, and
|
|
13
|
-
* `meta.pulumiMember` says `exported: false` and why.
|
|
14
|
-
*
|
|
15
|
-
* The kind lived in the terraform lexicon until #4453 moved it here. The
|
|
16
|
-
* ruling on #4450 lets chant run `pulumi preview` and `pulumi refresh
|
|
17
|
-
* --preview-only` for a Pulumi member, so the old "chant never calls
|
|
18
|
-
* `pulumi`" rule now covers this graph read only. The change set
|
|
19
|
-
* (`./change-set.ts`) and drift (`./drift-record.ts`) run those two
|
|
20
|
-
* commands, which change nothing, and the outputs read (`./member-outputs.ts`,
|
|
21
|
-
* #4455) adds `pulumi stack output --json --show-secrets=false`; nothing else.
|
|
22
|
-
*
|
|
23
|
-
* Nodes are the export's resources, keyed `<label>/<urn tail>`, where the tail
|
|
24
|
-
* is the URN after its stack and project (`aws:s3/bucket:Bucket::assets`).
|
|
25
|
-
* That is the rule in `@intentius/chant/pulumi-urn` (#4456), which a
|
|
26
|
-
* change set over `pulumi preview --json` and a drift record use too, so all
|
|
27
|
-
* three put a resource on the same node. Provider resources
|
|
28
|
-
* (`pulumi:providers:*`) and the root `pulumi:pulumi:Stack` are left out; the
|
|
29
|
-
* resources that name them are not edged to them. Edges come from each
|
|
30
|
-
* resource's `dependencies` and `parent`, kept only when the target is a node,
|
|
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.
|
|
34
|
-
*
|
|
35
|
-
* A member on plunge may also check in {@link PULUMI_ENGINE_GRAPH_FILE}
|
|
36
|
-
* beside the export: what `plunge graph --json --stack <stack>` printed
|
|
37
|
-
* (#4529, the document designed on #4520). When it is there, each node whose
|
|
38
|
-
* URN it lists gets the engine's facts (`IRNode.facts`: ownership, the
|
|
39
|
-
* markers plunge's record says it wrote, how ownership is known, cloud IDs,
|
|
40
|
-
* record versions), and its `property` edges join the graph with `grain:
|
|
41
|
-
* "property"` and the property's name as `viaAttr`. Its `dependencies`,
|
|
42
|
-
* `parent` and `provider` edges are not taken: the export already gives the
|
|
43
|
-
* first two, and providers have no node. The read still runs nothing. A
|
|
44
|
-
* stock member's `engine-graph.json`, if one is there, is not read.
|
|
45
|
-
*/
|
|
46
|
-
import { existsSync, readFileSync } from "node:fs";
|
|
47
|
-
import { basename, join } from "node:path";
|
|
48
|
-
import { DECLARABLE_MARKER, type Declarable } from "@intentius/chant/declarable";
|
|
49
|
-
import type { EntityReference } from "@intentius/chant/graph-ir";
|
|
50
|
-
import type { EngineFacts } from "@intentius/chant/engine-facts";
|
|
51
|
-
import { isPulumiNodeless, pulumiNodeKey } from "@intentius/chant/pulumi-urn";
|
|
52
|
-
import { PULUMI_ENGINE_GRAPH_FILE, readPlungeEngineGraph } from "./engine-graph";
|
|
53
|
-
import { pulumiMemberEngine } from "./member-engine";
|
|
54
|
-
|
|
55
|
-
/** The conventional place of the export, in the member's directory. */
|
|
56
|
-
export const PULUMI_EXPORT_FILE = "stack-export.json";
|
|
57
|
-
|
|
58
|
-
export interface PulumiMemberConfig {
|
|
59
|
-
/** The member's directory, absolute. */
|
|
60
|
-
dir: string;
|
|
61
|
-
/** Names the entities (`<label>/...`): the member's name. */
|
|
62
|
-
label?: string;
|
|
63
|
-
/** What runs the stack, when the config says; see `./run.ts`'s `pulumiMemberEngine`. The graph read ignores it. */
|
|
64
|
-
engine?: "pulumi" | "plunge";
|
|
65
|
-
/** The stack the drift read passes as `--stack`, when the config says. The graph read ignores it. */
|
|
66
|
-
stack?: string;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
/** What the read found, carried on the graph's `meta.pulumiMember`. */
|
|
70
|
-
export interface PulumiMemberReport {
|
|
71
|
-
/** The export read: relative to the member's directory, or `<store>:<env>/<key>` for the index store's. */
|
|
72
|
-
export?: string;
|
|
73
|
-
/** Where the export came from (#4546): the index store, or the checked-in file. Absent on a read before #4546. */
|
|
74
|
-
exportSource?: "store" | "file";
|
|
75
|
-
objects: number;
|
|
76
|
-
/** False when the member has no readable export. */
|
|
77
|
-
exported: boolean;
|
|
78
|
-
/** Why nothing was read; set with `exported: false`. */
|
|
79
|
-
reason?: string;
|
|
80
|
-
/**
|
|
81
|
-
* How many `deployment.pending_operations` the export records, set only
|
|
82
|
-
* when there are some (#4468). Pulumi writes one for each step an update
|
|
83
|
-
* started and never finished, so a non-zero count means the last update was
|
|
84
|
-
* interrupted and the stack may hold resources its state does not. PUL002
|
|
85
|
-
* reports it.
|
|
86
|
-
*/
|
|
87
|
-
pendingOperations?: number;
|
|
88
|
-
/**
|
|
89
|
-
* The member's checked-in {@link PULUMI_ENGINE_GRAPH_FILE} (#4529), set
|
|
90
|
-
* only for a member on plunge that has one. `read: false` with `reason`
|
|
91
|
-
* when it could not be read; the graph is then the export's alone.
|
|
92
|
-
*/
|
|
93
|
-
engineGraph?: PulumiMemberEngineGraphReport;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
/** What the read took from a plunge member's engine graph (#4529). */
|
|
97
|
-
export interface PulumiMemberEngineGraphReport {
|
|
98
|
-
/** The file, relative to the member's directory. */
|
|
99
|
-
file: string;
|
|
100
|
-
read: boolean;
|
|
101
|
-
/** Why it was not read; set with `read: false`. */
|
|
102
|
-
reason?: string;
|
|
103
|
-
/** The stack plunge read, from `meta.engineGraph.scope`. */
|
|
104
|
-
stack?: string;
|
|
105
|
-
/** When plunge's record read started, from `meta.engineGraph.observedAt`. */
|
|
106
|
-
observedAt?: string;
|
|
107
|
-
/** How many of the graph's nodes carry facts the document gave. */
|
|
108
|
-
facts?: number;
|
|
109
|
-
/** How many `property` edges joined the graph. */
|
|
110
|
-
propertyEdges?: number;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
interface ExportedResource {
|
|
114
|
-
urn?: unknown;
|
|
115
|
-
type?: unknown;
|
|
116
|
-
parent?: unknown;
|
|
117
|
-
dependencies?: unknown;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
/** An export the index store held for the member, read by the caller (#4546). */
|
|
121
|
-
export interface PulumiMemberStoredExport {
|
|
122
|
-
doc: unknown;
|
|
123
|
-
/** The store, for messages. */
|
|
124
|
-
where: string;
|
|
125
|
-
/** `<env>/<stack>__pulumi-export`. */
|
|
126
|
-
key: string;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
export function readPulumiMember(opts: { member: PulumiMemberConfig; stored?: PulumiMemberStoredExport }): {
|
|
130
|
-
entities: Map<string, Declarable>;
|
|
131
|
-
warnings: string[];
|
|
132
|
-
report: PulumiMemberReport;
|
|
133
|
-
/** The parsed export, when there is one that reads as JSON. The post-synth checks read it; `meta` does not carry it. */
|
|
134
|
-
doc?: unknown;
|
|
135
|
-
} {
|
|
136
|
-
const { member } = opts;
|
|
137
|
-
const label = member.label ?? basename(member.dir);
|
|
138
|
-
const missing = (reason: string) => ({
|
|
139
|
-
entities: new Map<string, Declarable>(),
|
|
140
|
-
warnings: [`pulumi member "${label}" was not read: ${reason}`],
|
|
141
|
-
report: { objects: 0, exported: false, reason } as PulumiMemberReport,
|
|
142
|
-
});
|
|
143
|
-
|
|
144
|
-
const file = join(member.dir, PULUMI_EXPORT_FILE);
|
|
145
|
-
const stored = opts.stored;
|
|
146
|
-
const exportName = stored ? `${stored.where}:${stored.key}` : PULUMI_EXPORT_FILE;
|
|
147
|
-
if (!stored && !existsSync(file)) {
|
|
148
|
-
return missing(
|
|
149
|
-
`no export in the index store and no ${PULUMI_EXPORT_FILE} in the member; an apply through chant's pulumi-up writes the export to the store, or run \`pulumi stack export --file ${PULUMI_EXPORT_FILE}\` and check it in (the graph read does not run the program)`,
|
|
150
|
-
);
|
|
151
|
-
}
|
|
152
|
-
let resources: ExportedResource[];
|
|
153
|
-
let pendingOperations = 0;
|
|
154
|
-
let doc: { deployment?: { resources?: unknown; pending_operations?: unknown } };
|
|
155
|
-
try {
|
|
156
|
-
doc = (stored ? stored.doc : JSON.parse(readFileSync(file, "utf-8"))) as { deployment?: { resources?: unknown; pending_operations?: unknown } };
|
|
157
|
-
const list = doc?.deployment?.resources;
|
|
158
|
-
if (list !== undefined && !Array.isArray(list)) return missing(`${exportName} has a deployment.resources that is not a list`);
|
|
159
|
-
resources = (list ?? []) as ExportedResource[];
|
|
160
|
-
const pending = doc?.deployment?.pending_operations;
|
|
161
|
-
pendingOperations = Array.isArray(pending) ? pending.length : 0;
|
|
162
|
-
} catch (e) {
|
|
163
|
-
return missing(`${PULUMI_EXPORT_FILE} is not readable JSON: ${(e as Error).message}`);
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
const keyOf = new Map<string, string>();
|
|
167
|
-
for (const r of resources) {
|
|
168
|
-
if (typeof r?.urn !== "string" || typeof r.type !== "string" || isPulumiNodeless(r.type)) continue;
|
|
169
|
-
const tail = pulumiNodeKey(r.urn);
|
|
170
|
-
if (tail !== null) keyOf.set(r.urn, `${label}/${tail}`);
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
const warnings: string[] = [];
|
|
174
|
-
const engine = pulumiMemberEngine(member.dir, member.engine).engine === "plunge" ? readMemberEngineGraph(member.dir, label, warnings) : undefined;
|
|
175
|
-
|
|
176
|
-
const entities = new Map<string, Declarable>();
|
|
177
|
-
let withFacts = 0;
|
|
178
|
-
let propertyEdges = 0;
|
|
179
|
-
for (const r of resources) {
|
|
180
|
-
const key = typeof r?.urn === "string" ? keyOf.get(r.urn) : undefined;
|
|
181
|
-
if (!key) continue;
|
|
182
|
-
const urn = r.urn as string;
|
|
183
|
-
const references = new Map<string, EntityReference>();
|
|
184
|
-
const add = (to: string | undefined, via: string, grain: "instance" | "property") => {
|
|
185
|
-
if (to && to !== key) references.set(`${to}|${via}|${grain}`, { to, viaAttr: via, grain });
|
|
186
|
-
};
|
|
187
|
-
const node = (u: unknown) => (typeof u === "string" ? keyOf.get(u) : undefined);
|
|
188
|
-
add(node(r.parent), "parent", "instance");
|
|
189
|
-
for (const d of Array.isArray(r.dependencies) ? r.dependencies : []) add(node(d), "dependencies", "instance");
|
|
190
|
-
for (const e of engine?.propertyEdges.get(urn) ?? []) {
|
|
191
|
-
const before = references.size;
|
|
192
|
-
add(node(e.to), e.viaAttr, "property");
|
|
193
|
-
if (references.size > before) propertyEdges++;
|
|
194
|
-
}
|
|
195
|
-
const entity = {
|
|
196
|
-
lexicon: "pulumi",
|
|
197
|
-
entityType: r.type as string,
|
|
198
|
-
kind: "resource",
|
|
199
|
-
props: {},
|
|
200
|
-
references: [...references.values()],
|
|
201
|
-
[DECLARABLE_MARKER]: true,
|
|
202
|
-
} as unknown as Declarable;
|
|
203
|
-
const facts = engine?.facts.get(urn);
|
|
204
|
-
if (facts) {
|
|
205
|
-
// Not enumerable: core's `entityFacts` reads it onto `IRNode.facts`, and a
|
|
206
|
-
// chant older than #4529 does not project it into the node's attrs.
|
|
207
|
-
Object.defineProperty(entity, "facts", { value: facts, enumerable: false });
|
|
208
|
-
withFacts++;
|
|
209
|
-
}
|
|
210
|
-
entities.set(key, entity);
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
const report: PulumiMemberReport = { export: exportName, exportSource: stored ? "store" : "file", objects: entities.size, exported: true };
|
|
214
|
-
if (pendingOperations > 0) report.pendingOperations = pendingOperations;
|
|
215
|
-
if (engine) report.engineGraph = engine.report.read ? { ...engine.report, facts: withFacts, propertyEdges } : engine.report;
|
|
216
|
-
return { entities, warnings, report, doc };
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
/**
|
|
220
|
-
* A plunge member's checked-in engine graph, indexed by URN, or undefined
|
|
221
|
-
* when the member has none. One that does not read leaves a warning and a
|
|
222
|
-
* report saying why, and the graph is the export's alone.
|
|
223
|
-
*/
|
|
224
|
-
function readMemberEngineGraph(
|
|
225
|
-
dir: string,
|
|
226
|
-
label: string,
|
|
227
|
-
warnings: string[],
|
|
228
|
-
): { facts: Map<string, EngineFacts>; propertyEdges: Map<string, { to: string; viaAttr: string }[]>; report: PulumiMemberEngineGraphReport } | undefined {
|
|
229
|
-
const file = join(dir, PULUMI_ENGINE_GRAPH_FILE);
|
|
230
|
-
if (!existsSync(file)) return undefined;
|
|
231
|
-
const unread = (reason: string) => {
|
|
232
|
-
warnings.push(`pulumi member "${label}": ${PULUMI_ENGINE_GRAPH_FILE} was not read: ${reason}; the graph has no engine facts`);
|
|
233
|
-
return { facts: new Map(), propertyEdges: new Map(), report: { file: PULUMI_ENGINE_GRAPH_FILE, read: false, reason } };
|
|
234
|
-
};
|
|
235
|
-
let parsed: unknown;
|
|
236
|
-
try {
|
|
237
|
-
parsed = JSON.parse(readFileSync(file, "utf-8")) as unknown;
|
|
238
|
-
} catch (e) {
|
|
239
|
-
return unread(`it is not readable JSON: ${(e as Error).message}`);
|
|
240
|
-
}
|
|
241
|
-
const read = readPlungeEngineGraph(parsed);
|
|
242
|
-
if ("error" in read) return unread(read.error);
|
|
243
|
-
const { graph } = read;
|
|
244
|
-
const facts = new Map<string, EngineFacts>();
|
|
245
|
-
for (const n of graph.nodes) if (n.facts) facts.set(n.urn, n.facts);
|
|
246
|
-
const propertyEdges = new Map<string, { to: string; viaAttr: string }[]>();
|
|
247
|
-
for (const e of graph.edges) {
|
|
248
|
-
if (e.grain !== "property") continue;
|
|
249
|
-
const list = propertyEdges.get(e.from) ?? [];
|
|
250
|
-
list.push({ to: e.to, viaAttr: e.viaAttr });
|
|
251
|
-
propertyEdges.set(e.from, list);
|
|
252
|
-
}
|
|
253
|
-
return {
|
|
254
|
-
facts,
|
|
255
|
-
propertyEdges,
|
|
256
|
-
report: {
|
|
257
|
-
file: PULUMI_ENGINE_GRAPH_FILE,
|
|
258
|
-
read: true,
|
|
259
|
-
...(graph.scope ? { stack: graph.scope.stack } : {}),
|
|
260
|
-
...(graph.observedAt ? { observedAt: graph.observedAt } : {}),
|
|
261
|
-
},
|
|
262
|
-
};
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
/**
|
|
266
|
-
* What the last member read in this process saw, for the post-synth checks
|
|
267
|
-
* PUL003 to PUL015 (`./lint/post-synth/`). It holds the parsed export, so it
|
|
268
|
-
* stays in the process and never reaches the graph's `meta`, which carries
|
|
269
|
-
* only {@link PulumiMemberReport}.
|
|
270
|
-
*/
|
|
271
|
-
export interface PulumiMemberRead {
|
|
272
|
-
/** The member's directory, absolute. */
|
|
273
|
-
dir: string;
|
|
274
|
-
/** The label the entities are keyed by. */
|
|
275
|
-
label: string;
|
|
276
|
-
/** `pulumi.member.engine`, when the config sets it. */
|
|
277
|
-
engine?: "pulumi" | "plunge";
|
|
278
|
-
/** `pulumi.member.stack`, when the config sets it. */
|
|
279
|
-
stack?: string;
|
|
280
|
-
/** The parsed export, the index store's or the checked-in `stack-export.json`; undefined when there is none or it is not JSON. */
|
|
281
|
-
doc?: unknown;
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
let lastRead: PulumiMemberRead | undefined;
|
|
285
|
-
|
|
286
|
-
/** Left by the plugin's `buildRoots` beside the report; see {@link PulumiMemberRead}. */
|
|
287
|
-
export function setLastMemberRead(read: PulumiMemberRead | undefined): void {
|
|
288
|
-
lastRead = read;
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
export function lastMemberRead(): PulumiMemberRead | undefined {
|
|
292
|
-
return lastRead;
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
let lastReport: PulumiMemberReport | undefined;
|
|
296
|
-
|
|
297
|
-
/** The report of the read in this process, left for `graphMeta` (see the aws member reader). */
|
|
298
|
-
export function setLastMemberReport(report: PulumiMemberReport | undefined): void {
|
|
299
|
-
lastReport = report;
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
export function lastMemberReport(): PulumiMemberReport | undefined {
|
|
303
|
-
return lastReport;
|
|
304
|
-
}
|