@pulumi/pulumi 3.163.0-alpha.xdc88586 → 3.163.0-alpha.xffc5a7c

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 (70) hide show
  1. package/automation/cmd.js +92 -111
  2. package/automation/cmd.js.map +1 -1
  3. package/automation/localWorkspace.js +383 -476
  4. package/automation/localWorkspace.js.map +1 -1
  5. package/automation/remoteWorkspace.js +38 -55
  6. package/automation/remoteWorkspace.js.map +1 -1
  7. package/automation/server.js +6 -16
  8. package/automation/server.js.map +1 -1
  9. package/automation/stack.js +537 -608
  10. package/automation/stack.js.map +1 -1
  11. package/cmd/dynamic-provider/index.js +204 -235
  12. package/cmd/dynamic-provider/index.js.map +1 -1
  13. package/cmd/run/error.js +3 -3
  14. package/cmd/run/error.js.map +1 -1
  15. package/cmd/run/run.js +322 -336
  16. package/cmd/run/run.js.map +1 -1
  17. package/cmd/run/tracing.js +1 -2
  18. package/cmd/run/tracing.js.map +1 -1
  19. package/cmd/run-plugin/run.js +13 -17
  20. package/cmd/run-plugin/run.js.map +1 -1
  21. package/cmd/run-policy-pack/run.js +12 -16
  22. package/cmd/run-policy-pack/run.js.map +1 -1
  23. package/output.js +61 -78
  24. package/output.js.map +1 -1
  25. package/package.json +1 -1
  26. package/provider/experimental/analyzer.js +43 -46
  27. package/provider/experimental/analyzer.js.map +1 -1
  28. package/provider/experimental/provider.js +22 -36
  29. package/provider/experimental/provider.js.map +1 -1
  30. package/provider/server.js +359 -397
  31. package/provider/server.js.map +1 -1
  32. package/resource.js +29 -41
  33. package/resource.js.map +1 -1
  34. package/runtime/asyncIterableUtil.js +6 -17
  35. package/runtime/asyncIterableUtil.js.map +1 -1
  36. package/runtime/callbacks.js +254 -269
  37. package/runtime/callbacks.js.map +1 -1
  38. package/runtime/closure/codePaths.js +117 -135
  39. package/runtime/closure/codePaths.js.map +1 -1
  40. package/runtime/closure/createClosure.js +807 -871
  41. package/runtime/closure/createClosure.js.map +1 -1
  42. package/runtime/closure/parseFunction.js +2 -3
  43. package/runtime/closure/parseFunction.js.map +1 -1
  44. package/runtime/closure/serializeClosure.js +17 -30
  45. package/runtime/closure/serializeClosure.js.map +1 -1
  46. package/runtime/closure/v8.js +166 -190
  47. package/runtime/closure/v8.js.map +1 -1
  48. package/runtime/closure/v8Hooks.js +19 -34
  49. package/runtime/closure/v8Hooks.js.map +1 -1
  50. package/runtime/dependsOn.js +61 -80
  51. package/runtime/dependsOn.js.map +1 -1
  52. package/runtime/invoke.js +155 -170
  53. package/runtime/invoke.js.map +1 -1
  54. package/runtime/mocks.js +77 -96
  55. package/runtime/mocks.js.map +1 -1
  56. package/runtime/resource.js +238 -252
  57. package/runtime/resource.js.map +1 -1
  58. package/runtime/rpc.js +193 -215
  59. package/runtime/rpc.js.map +1 -1
  60. package/runtime/settings.js +70 -87
  61. package/runtime/settings.js.map +1 -1
  62. package/runtime/stack.js +111 -131
  63. package/runtime/stack.js.map +1 -1
  64. package/stackReference.js +39 -58
  65. package/stackReference.js.map +1 -1
  66. package/tsutils.js +1 -2
  67. package/tsutils.js.map +1 -1
  68. package/utils.js +2 -3
  69. package/utils.js.map +1 -1
  70. package/version.js +1 -1
@@ -12,15 +12,6 @@
12
12
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
13
  // See the License for the specific language governing permissions and
14
14
  // limitations under the License.
15
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
16
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
17
- return new (P || (P = Promise))(function (resolve, reject) {
18
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
19
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
20
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
21
- step((generator = generator.apply(thisArg, _arguments || [])).next());
22
- });
23
- };
24
15
  var __importStar = (this && this.__importStar) || function (mod) {
25
16
  if (mod && mod.__esModule) return mod;
26
17
  var result = {};
@@ -78,10 +69,10 @@ class LocalWorkspace {
78
69
  this.remote = remote;
79
70
  this.remoteGitProgramArgs = remoteGitProgramArgs;
80
71
  this.remotePreRunCommands = remotePreRunCommands;
81
- this.remoteEnvVars = Object.assign({}, remoteEnvVars);
72
+ this.remoteEnvVars = { ...remoteEnvVars };
82
73
  this.remoteSkipInstallDependencies = remoteSkipInstallDependencies;
83
74
  this.remoteInheritSettings = remoteInheritSettings;
84
- envs = Object.assign({}, envVars);
75
+ envs = { ...envVars };
85
76
  }
86
77
  if (!dir) {
87
78
  dir = fs.mkdtempSync(upath.joinSafe(os.tmpdir(), "automation-"));
@@ -89,7 +80,8 @@ class LocalWorkspace {
89
80
  this.workDir = dir;
90
81
  this.envVars = envs;
91
82
  const skipVersionCheck = !!this.envVars[SKIP_VERSION_CHECK_VAR] || !!process.env[SKIP_VERSION_CHECK_VAR];
92
- const pulumiCommand = (opts === null || opts === void 0 ? void 0 : opts.pulumiCommand) ? Promise.resolve(opts.pulumiCommand)
83
+ const pulumiCommand = opts?.pulumiCommand
84
+ ? Promise.resolve(opts.pulumiCommand)
93
85
  : cmd_1.PulumiCommand.get({ skipVersionCheck });
94
86
  const readinessPromises = [
95
87
  pulumiCommand.then((p) => {
@@ -100,10 +92,10 @@ class LocalWorkspace {
100
92
  return this.checkRemoteSupport();
101
93
  }),
102
94
  ];
103
- if (opts === null || opts === void 0 ? void 0 : opts.projectSettings) {
95
+ if (opts?.projectSettings) {
104
96
  readinessPromises.push(this.saveProjectSettings(opts.projectSettings));
105
97
  }
106
- if (opts === null || opts === void 0 ? void 0 : opts.stackSettings) {
98
+ if (opts?.stackSettings) {
107
99
  for (const [name, value] of Object.entries(opts.stackSettings)) {
108
100
  readinessPromises.push(this.saveStackSettings(name, value));
109
101
  }
@@ -136,87 +128,75 @@ class LocalWorkspace {
136
128
  *
137
129
  * @param opts Options used to configure the Workspace
138
130
  */
139
- static create(opts) {
140
- return __awaiter(this, void 0, void 0, function* () {
141
- const ws = new LocalWorkspace(opts);
142
- yield ws.ready;
143
- return ws;
144
- });
131
+ static async create(opts) {
132
+ const ws = new LocalWorkspace(opts);
133
+ await ws.ready;
134
+ return ws;
145
135
  }
146
- static createStack(args, opts) {
147
- return __awaiter(this, void 0, void 0, function* () {
148
- if (isInlineProgramArgs(args)) {
149
- return yield this.inlineSourceStackHelper(args, stack_1.Stack.create, opts);
150
- }
151
- else if (isLocalProgramArgs(args)) {
152
- return yield this.localSourceStackHelper(args, stack_1.Stack.create, opts);
153
- }
154
- throw new Error(`unexpected args: ${args}`);
155
- });
136
+ static async createStack(args, opts) {
137
+ if (isInlineProgramArgs(args)) {
138
+ return await this.inlineSourceStackHelper(args, stack_1.Stack.create, opts);
139
+ }
140
+ else if (isLocalProgramArgs(args)) {
141
+ return await this.localSourceStackHelper(args, stack_1.Stack.create, opts);
142
+ }
143
+ throw new Error(`unexpected args: ${args}`);
156
144
  }
157
- static selectStack(args, opts) {
158
- return __awaiter(this, void 0, void 0, function* () {
159
- if (isInlineProgramArgs(args)) {
160
- return yield this.inlineSourceStackHelper(args, stack_1.Stack.select, opts);
161
- }
162
- else if (isLocalProgramArgs(args)) {
163
- return yield this.localSourceStackHelper(args, stack_1.Stack.select, opts);
164
- }
165
- throw new Error(`unexpected args: ${args}`);
166
- });
145
+ static async selectStack(args, opts) {
146
+ if (isInlineProgramArgs(args)) {
147
+ return await this.inlineSourceStackHelper(args, stack_1.Stack.select, opts);
148
+ }
149
+ else if (isLocalProgramArgs(args)) {
150
+ return await this.localSourceStackHelper(args, stack_1.Stack.select, opts);
151
+ }
152
+ throw new Error(`unexpected args: ${args}`);
167
153
  }
168
- static createOrSelectStack(args, opts) {
169
- return __awaiter(this, void 0, void 0, function* () {
170
- if (isInlineProgramArgs(args)) {
171
- return yield this.inlineSourceStackHelper(args, stack_1.Stack.createOrSelect, opts);
172
- }
173
- else if (isLocalProgramArgs(args)) {
174
- return yield this.localSourceStackHelper(args, stack_1.Stack.createOrSelect, opts);
175
- }
176
- throw new Error(`unexpected args: ${args}`);
177
- });
154
+ static async createOrSelectStack(args, opts) {
155
+ if (isInlineProgramArgs(args)) {
156
+ return await this.inlineSourceStackHelper(args, stack_1.Stack.createOrSelect, opts);
157
+ }
158
+ else if (isLocalProgramArgs(args)) {
159
+ return await this.localSourceStackHelper(args, stack_1.Stack.createOrSelect, opts);
160
+ }
161
+ throw new Error(`unexpected args: ${args}`);
178
162
  }
179
- static localSourceStackHelper(args, initFn, opts) {
180
- return __awaiter(this, void 0, void 0, function* () {
181
- let wsOpts = { workDir: args.workDir };
182
- if (opts) {
183
- wsOpts = Object.assign(Object.assign({}, opts), { workDir: args.workDir });
184
- }
185
- const ws = new LocalWorkspace(wsOpts);
186
- yield ws.ready;
187
- return yield initFn(args.stackName, ws);
188
- });
163
+ static async localSourceStackHelper(args, initFn, opts) {
164
+ let wsOpts = { workDir: args.workDir };
165
+ if (opts) {
166
+ wsOpts = { ...opts, workDir: args.workDir };
167
+ }
168
+ const ws = new LocalWorkspace(wsOpts);
169
+ await ws.ready;
170
+ return await initFn(args.stackName, ws);
189
171
  }
190
- static inlineSourceStackHelper(args, initFn, opts) {
191
- return __awaiter(this, void 0, void 0, function* () {
192
- let wsOpts = { program: args.program };
193
- if (opts) {
194
- wsOpts = Object.assign(Object.assign({}, opts), { program: args.program });
195
- }
196
- if (!wsOpts.projectSettings) {
197
- if (wsOpts.workDir) {
198
- try {
199
- // Try to load the project settings.
200
- loadProjectSettings(wsOpts.workDir);
172
+ static async inlineSourceStackHelper(args, initFn, opts) {
173
+ let wsOpts = { program: args.program };
174
+ if (opts) {
175
+ wsOpts = { ...opts, program: args.program };
176
+ }
177
+ if (!wsOpts.projectSettings) {
178
+ if (wsOpts.workDir) {
179
+ try {
180
+ // Try to load the project settings.
181
+ loadProjectSettings(wsOpts.workDir);
182
+ }
183
+ catch (e) {
184
+ // If it failed to find the project settings file, set a default project.
185
+ if (e.toString().includes("failed to find project settings")) {
186
+ wsOpts.projectSettings = defaultProject(args.projectName);
201
187
  }
202
- catch (e) {
203
- // If it failed to find the project settings file, set a default project.
204
- if (e.toString().includes("failed to find project settings")) {
205
- wsOpts.projectSettings = defaultProject(args.projectName);
206
- }
207
- else {
208
- throw e;
209
- }
188
+ else {
189
+ throw e;
210
190
  }
211
191
  }
212
- else {
213
- wsOpts.projectSettings = defaultProject(args.projectName);
214
- }
215
192
  }
216
- const ws = new LocalWorkspace(wsOpts);
217
- yield ws.ready;
218
- return yield initFn(args.stackName, ws);
219
- });
193
+ else {
194
+ wsOpts.projectSettings = defaultProject(args.projectName);
195
+ }
196
+ }
197
+ const ws = new LocalWorkspace(wsOpts);
198
+ await ws.ready;
199
+ return await initFn(args.stackName, ws);
220
200
  }
221
201
  /**
222
202
  * Returns the settings object for the current project if any
@@ -224,10 +204,8 @@ class LocalWorkspace {
224
204
  * in the workspace. A workspace can contain only a single project at a
225
205
  * time.
226
206
  */
227
- projectSettings() {
228
- return __awaiter(this, void 0, void 0, function* () {
229
- return loadProjectSettings(this.workDir);
230
- });
207
+ async projectSettings() {
208
+ return loadProjectSettings(this.workDir);
231
209
  }
232
210
  /**
233
211
  * Overwrites the settings object in the current project. There can only be
@@ -238,26 +216,24 @@ class LocalWorkspace {
238
216
  * @param settings
239
217
  * The settings object to save to the Workspace.
240
218
  */
241
- saveProjectSettings(settings) {
242
- return __awaiter(this, void 0, void 0, function* () {
243
- let foundExt = ".yaml";
244
- for (const ext of settingsExtensions) {
245
- const testPath = upath.joinSafe(this.workDir, `Pulumi${ext}`);
246
- if (fs.existsSync(testPath)) {
247
- foundExt = ext;
248
- break;
249
- }
250
- }
251
- const path = upath.joinSafe(this.workDir, `Pulumi${foundExt}`);
252
- let contents;
253
- if (foundExt === ".json") {
254
- contents = JSON.stringify(settings, null, 4);
219
+ async saveProjectSettings(settings) {
220
+ let foundExt = ".yaml";
221
+ for (const ext of settingsExtensions) {
222
+ const testPath = upath.joinSafe(this.workDir, `Pulumi${ext}`);
223
+ if (fs.existsSync(testPath)) {
224
+ foundExt = ext;
225
+ break;
255
226
  }
256
- else {
257
- contents = yaml.safeDump(settings, { skipInvalid: true });
258
- }
259
- return fs.writeFileSync(path, contents);
260
- });
227
+ }
228
+ const path = upath.joinSafe(this.workDir, `Pulumi${foundExt}`);
229
+ let contents;
230
+ if (foundExt === ".json") {
231
+ contents = JSON.stringify(settings, null, 4);
232
+ }
233
+ else {
234
+ contents = yaml.safeDump(settings, { skipInvalid: true });
235
+ }
236
+ return fs.writeFileSync(path, contents);
261
237
  }
262
238
  /**
263
239
  * Returns the settings object for the stack matching the specified stack
@@ -267,32 +243,30 @@ class LocalWorkspace {
267
243
  * @param stackName
268
244
  * The stack to retrieve settings from.
269
245
  */
270
- stackSettings(stackName) {
271
- return __awaiter(this, void 0, void 0, function* () {
272
- const stackSettingsName = getStackSettingsName(stackName);
273
- for (const ext of settingsExtensions) {
274
- const isJSON = ext === ".json";
275
- const path = upath.joinSafe(this.workDir, `Pulumi.${stackSettingsName}${ext}`);
276
- if (!fs.existsSync(path)) {
277
- continue;
278
- }
279
- const contents = fs.readFileSync(path).toString();
280
- let stackSettings;
281
- if (isJSON) {
282
- stackSettings = JSON.parse(contents);
283
- }
284
- stackSettings = yaml.safeLoad(contents);
285
- // Transform the serialized representation back to what we expect.
286
- for (const key of stackSettings_1.stackSettingsSerDeKeys) {
287
- if (stackSettings.hasOwnProperty(key[0])) {
288
- stackSettings[key[1]] = stackSettings[key[0]];
289
- delete stackSettings[key[0]];
290
- }
246
+ async stackSettings(stackName) {
247
+ const stackSettingsName = getStackSettingsName(stackName);
248
+ for (const ext of settingsExtensions) {
249
+ const isJSON = ext === ".json";
250
+ const path = upath.joinSafe(this.workDir, `Pulumi.${stackSettingsName}${ext}`);
251
+ if (!fs.existsSync(path)) {
252
+ continue;
253
+ }
254
+ const contents = fs.readFileSync(path).toString();
255
+ let stackSettings;
256
+ if (isJSON) {
257
+ stackSettings = JSON.parse(contents);
258
+ }
259
+ stackSettings = yaml.safeLoad(contents);
260
+ // Transform the serialized representation back to what we expect.
261
+ for (const key of stackSettings_1.stackSettingsSerDeKeys) {
262
+ if (stackSettings.hasOwnProperty(key[0])) {
263
+ stackSettings[key[1]] = stackSettings[key[0]];
264
+ delete stackSettings[key[0]];
291
265
  }
292
- return stackSettings;
293
266
  }
294
- throw new Error(`failed to find stack settings file in workdir: ${this.workDir}`);
295
- });
267
+ return stackSettings;
268
+ }
269
+ throw new Error(`failed to find stack settings file in workdir: ${this.workDir}`);
296
270
  }
297
271
  /**
298
272
  * Overwrites the settings object for the stack matching the specified stack
@@ -304,35 +278,33 @@ class LocalWorkspace {
304
278
  * @param settings
305
279
  * The settings object to save.
306
280
  */
307
- saveStackSettings(stackName, settings) {
308
- return __awaiter(this, void 0, void 0, function* () {
309
- const stackSettingsName = getStackSettingsName(stackName);
310
- let foundExt = ".yaml";
311
- for (const ext of settingsExtensions) {
312
- const testPath = upath.joinSafe(this.workDir, `Pulumi.${stackSettingsName}${ext}`);
313
- if (fs.existsSync(testPath)) {
314
- foundExt = ext;
315
- break;
316
- }
317
- }
318
- const path = upath.joinSafe(this.workDir, `Pulumi.${stackSettingsName}${foundExt}`);
319
- const serializeSettings = Object.assign({}, settings);
320
- let contents;
321
- // Transform the keys to the serialized representation that we expect.
322
- for (const key of stackSettings_1.stackSettingsSerDeKeys) {
323
- if (serializeSettings.hasOwnProperty(key[1])) {
324
- serializeSettings[key[0]] = serializeSettings[key[1]];
325
- delete serializeSettings[key[1]];
326
- }
281
+ async saveStackSettings(stackName, settings) {
282
+ const stackSettingsName = getStackSettingsName(stackName);
283
+ let foundExt = ".yaml";
284
+ for (const ext of settingsExtensions) {
285
+ const testPath = upath.joinSafe(this.workDir, `Pulumi.${stackSettingsName}${ext}`);
286
+ if (fs.existsSync(testPath)) {
287
+ foundExt = ext;
288
+ break;
327
289
  }
328
- if (foundExt === ".json") {
329
- contents = JSON.stringify(serializeSettings, null, 4);
330
- }
331
- else {
332
- contents = yaml.safeDump(serializeSettings, { skipInvalid: true });
290
+ }
291
+ const path = upath.joinSafe(this.workDir, `Pulumi.${stackSettingsName}${foundExt}`);
292
+ const serializeSettings = { ...settings };
293
+ let contents;
294
+ // Transform the keys to the serialized representation that we expect.
295
+ for (const key of stackSettings_1.stackSettingsSerDeKeys) {
296
+ if (serializeSettings.hasOwnProperty(key[1])) {
297
+ serializeSettings[key[0]] = serializeSettings[key[1]];
298
+ delete serializeSettings[key[1]];
333
299
  }
334
- return fs.writeFileSync(path, contents);
335
- });
300
+ }
301
+ if (foundExt === ".json") {
302
+ contents = JSON.stringify(serializeSettings, null, 4);
303
+ }
304
+ else {
305
+ contents = yaml.safeDump(serializeSettings, { skipInvalid: true });
306
+ }
307
+ return fs.writeFileSync(path, contents);
336
308
  }
337
309
  /**
338
310
  * Creates and sets a new stack with the stack name, failing if one already
@@ -340,17 +312,15 @@ class LocalWorkspace {
340
312
  *
341
313
  * @param stackName The stack to create.
342
314
  */
343
- createStack(stackName) {
344
- return __awaiter(this, void 0, void 0, function* () {
345
- const args = ["stack", "init", stackName];
346
- if (this.secretsProvider) {
347
- args.push("--secrets-provider", this.secretsProvider);
348
- }
349
- if (this.isRemote) {
350
- args.push("--no-select");
351
- }
352
- yield this.runPulumiCmd(args);
353
- });
315
+ async createStack(stackName) {
316
+ const args = ["stack", "init", stackName];
317
+ if (this.secretsProvider) {
318
+ args.push("--secrets-provider", this.secretsProvider);
319
+ }
320
+ if (this.isRemote) {
321
+ args.push("--no-select");
322
+ }
323
+ await this.runPulumiCmd(args);
354
324
  }
355
325
  /**
356
326
  * Selects and sets an existing stack matching the stack name, failing if
@@ -358,35 +328,31 @@ class LocalWorkspace {
358
328
  *
359
329
  * @param stackName The stack to select.
360
330
  */
361
- selectStack(stackName) {
362
- return __awaiter(this, void 0, void 0, function* () {
363
- // If this is a remote workspace, we don't want to actually select the stack (which would modify global state);
364
- // but we will ensure the stack exists by calling `pulumi stack`.
365
- const args = ["stack"];
366
- if (!this.isRemote) {
367
- args.push("select");
368
- }
369
- args.push("--stack", stackName);
370
- yield this.runPulumiCmd(args);
371
- });
331
+ async selectStack(stackName) {
332
+ // If this is a remote workspace, we don't want to actually select the stack (which would modify global state);
333
+ // but we will ensure the stack exists by calling `pulumi stack`.
334
+ const args = ["stack"];
335
+ if (!this.isRemote) {
336
+ args.push("select");
337
+ }
338
+ args.push("--stack", stackName);
339
+ await this.runPulumiCmd(args);
372
340
  }
373
341
  /**
374
342
  * Deletes the stack and all associated configuration and history.
375
343
  *
376
344
  * @param stackName The stack to remove
377
345
  */
378
- removeStack(stackName, opts) {
379
- return __awaiter(this, void 0, void 0, function* () {
380
- const args = ["stack", "rm", "--yes"];
381
- if (opts === null || opts === void 0 ? void 0 : opts.force) {
382
- args.push("--force");
383
- }
384
- if (opts === null || opts === void 0 ? void 0 : opts.preserveConfig) {
385
- args.push("--preserve-config");
386
- }
387
- args.push(stackName);
388
- yield this.runPulumiCmd(args);
389
- });
346
+ async removeStack(stackName, opts) {
347
+ const args = ["stack", "rm", "--yes"];
348
+ if (opts?.force) {
349
+ args.push("--force");
350
+ }
351
+ if (opts?.preserveConfig) {
352
+ args.push("--preserve-config");
353
+ }
354
+ args.push(stackName);
355
+ await this.runPulumiCmd(args);
390
356
  }
391
357
  /**
392
358
  * Adds environments to the end of a stack's import list. Imported
@@ -399,39 +365,35 @@ class LocalWorkspace {
399
365
  * @param environments
400
366
  * The names of the environments to add to the stack's configuration
401
367
  */
402
- addEnvironments(stackName, ...environments) {
403
- return __awaiter(this, void 0, void 0, function* () {
404
- let ver = this._pulumiVersion;
405
- if (ver === undefined) {
406
- // Assume an old version. Doesn't really matter what this is as long as it's pre-3.95.
407
- ver = semver.parse("3.0.0");
408
- }
409
- // 3.95 added this command (https://github.com/pulumi/pulumi/releases/tag/v3.95.0)
410
- if (ver.compare("3.95.0") < 0) {
411
- throw new Error(`addEnvironments requires Pulumi version >= 3.95.0`);
412
- }
413
- yield this.runPulumiCmd(["config", "env", "add", ...environments, "--stack", stackName, "--yes"]);
414
- });
368
+ async addEnvironments(stackName, ...environments) {
369
+ let ver = this._pulumiVersion;
370
+ if (ver === undefined) {
371
+ // Assume an old version. Doesn't really matter what this is as long as it's pre-3.95.
372
+ ver = semver.parse("3.0.0");
373
+ }
374
+ // 3.95 added this command (https://github.com/pulumi/pulumi/releases/tag/v3.95.0)
375
+ if (ver.compare("3.95.0") < 0) {
376
+ throw new Error(`addEnvironments requires Pulumi version >= 3.95.0`);
377
+ }
378
+ await this.runPulumiCmd(["config", "env", "add", ...environments, "--stack", stackName, "--yes"]);
415
379
  }
416
380
  /**
417
381
  * Returns the list of environments associated with the specified stack name.
418
382
  *
419
383
  * @param stackName The stack to operate on
420
384
  */
421
- listEnvironments(stackName) {
422
- return __awaiter(this, void 0, void 0, function* () {
423
- let ver = this._pulumiVersion;
424
- if (ver === undefined) {
425
- // Assume an old version. Doesn't really matter what this is as long as it's pre-3.99.
426
- ver = semver.parse("3.0.0");
427
- }
428
- // 3.99 added this command (https://github.com/pulumi/pulumi/releases/tag/v3.99.0)
429
- if (ver.compare("3.99.0") < 0) {
430
- throw new Error(`listEnvironments requires Pulumi version >= 3.99.0`);
431
- }
432
- const result = yield this.runPulumiCmd(["config", "env", "ls", "--stack", stackName, "--json"]);
433
- return JSON.parse(result.stdout);
434
- });
385
+ async listEnvironments(stackName) {
386
+ let ver = this._pulumiVersion;
387
+ if (ver === undefined) {
388
+ // Assume an old version. Doesn't really matter what this is as long as it's pre-3.99.
389
+ ver = semver.parse("3.0.0");
390
+ }
391
+ // 3.99 added this command (https://github.com/pulumi/pulumi/releases/tag/v3.99.0)
392
+ if (ver.compare("3.99.0") < 0) {
393
+ throw new Error(`listEnvironments requires Pulumi version >= 3.99.0`);
394
+ }
395
+ const result = await this.runPulumiCmd(["config", "env", "ls", "--stack", stackName, "--json"]);
396
+ return JSON.parse(result.stdout);
435
397
  }
436
398
  /**
437
399
  * Removes an environment from a stack's import list.
@@ -441,19 +403,17 @@ class LocalWorkspace {
441
403
  * @param environment
442
404
  * The name of the environment to remove from the stack's configuration
443
405
  */
444
- removeEnvironment(stackName, environment) {
445
- return __awaiter(this, void 0, void 0, function* () {
446
- let ver = this._pulumiVersion;
447
- if (ver === undefined) {
448
- // Assume an old version. Doesn't really matter what this is as long as it's pre-3.95.
449
- ver = semver.parse("3.0.0");
450
- }
451
- // 3.95 added this command (https://github.com/pulumi/pulumi/releases/tag/v3.95.0)
452
- if (ver.compare("3.95.0") < 0) {
453
- throw new Error(`removeEnvironments requires Pulumi version >= 3.95.0`);
454
- }
455
- yield this.runPulumiCmd(["config", "env", "rm", environment, "--stack", stackName, "--yes"]);
456
- });
406
+ async removeEnvironment(stackName, environment) {
407
+ let ver = this._pulumiVersion;
408
+ if (ver === undefined) {
409
+ // Assume an old version. Doesn't really matter what this is as long as it's pre-3.95.
410
+ ver = semver.parse("3.0.0");
411
+ }
412
+ // 3.95 added this command (https://github.com/pulumi/pulumi/releases/tag/v3.95.0)
413
+ if (ver.compare("3.95.0") < 0) {
414
+ throw new Error(`removeEnvironments requires Pulumi version >= 3.95.0`);
415
+ }
416
+ await this.runPulumiCmd(["config", "env", "rm", environment, "--stack", stackName, "--yes"]);
457
417
  }
458
418
  /**
459
419
  * Returns the value associated with the specified stack name and key,
@@ -467,16 +427,14 @@ class LocalWorkspace {
467
427
  * @param path
468
428
  * The key contains a path to a property in a map or list to get
469
429
  */
470
- getConfig(stackName, key, path) {
471
- return __awaiter(this, void 0, void 0, function* () {
472
- const args = ["config", "get"];
473
- if (path) {
474
- args.push("--path");
475
- }
476
- args.push(key, "--json", "--stack", stackName);
477
- const result = yield this.runPulumiCmd(args);
478
- return JSON.parse(result.stdout);
479
- });
430
+ async getConfig(stackName, key, path) {
431
+ const args = ["config", "get"];
432
+ if (path) {
433
+ args.push("--path");
434
+ }
435
+ args.push(key, "--json", "--stack", stackName);
436
+ const result = await this.runPulumiCmd(args);
437
+ return JSON.parse(result.stdout);
480
438
  }
481
439
  /**
482
440
  * Returns the config map for the specified stack name, scoped to the
@@ -486,11 +444,9 @@ class LocalWorkspace {
486
444
  * @param stackName
487
445
  * The stack to read config from
488
446
  */
489
- getAllConfig(stackName) {
490
- return __awaiter(this, void 0, void 0, function* () {
491
- const result = yield this.runPulumiCmd(["config", "--show-secrets", "--json", "--stack", stackName]);
492
- return JSON.parse(result.stdout);
493
- });
447
+ async getAllConfig(stackName) {
448
+ const result = await this.runPulumiCmd(["config", "--show-secrets", "--json", "--stack", stackName]);
449
+ return JSON.parse(result.stdout);
494
450
  }
495
451
  /**
496
452
  * Sets the specified key-value pair on the provided stack name. {@link
@@ -506,16 +462,14 @@ class LocalWorkspace {
506
462
  * @param path
507
463
  * The key contains a path to a property in a map or list to set
508
464
  */
509
- setConfig(stackName, key, value, path) {
510
- return __awaiter(this, void 0, void 0, function* () {
511
- const args = ["config", "set"];
512
- if (path) {
513
- args.push("--path");
514
- }
515
- const secretArg = value.secret ? "--secret" : "--plaintext";
516
- args.push(key, "--stack", stackName, secretArg, "--non-interactive", "--", value.value);
517
- yield this.runPulumiCmd(args);
518
- });
465
+ async setConfig(stackName, key, value, path) {
466
+ const args = ["config", "set"];
467
+ if (path) {
468
+ args.push("--path");
469
+ }
470
+ const secretArg = value.secret ? "--secret" : "--plaintext";
471
+ args.push(key, "--stack", stackName, secretArg, "--non-interactive", "--", value.value);
472
+ await this.runPulumiCmd(args);
519
473
  }
520
474
  /**
521
475
  * Sets all values in the provided config map for the specified stack name.
@@ -529,18 +483,16 @@ class LocalWorkspace {
529
483
  * @param path
530
484
  * The keys contain a path to a property in a map or list to set
531
485
  */
532
- setAllConfig(stackName, config, path) {
533
- return __awaiter(this, void 0, void 0, function* () {
534
- const args = ["config", "set-all", "--stack", stackName];
535
- if (path) {
536
- args.push("--path");
537
- }
538
- for (const [key, value] of Object.entries(config)) {
539
- const secretArg = value.secret ? "--secret" : "--plaintext";
540
- args.push(secretArg, `${key}=${value.value}`);
541
- }
542
- yield this.runPulumiCmd(args);
543
- });
486
+ async setAllConfig(stackName, config, path) {
487
+ const args = ["config", "set-all", "--stack", stackName];
488
+ if (path) {
489
+ args.push("--path");
490
+ }
491
+ for (const [key, value] of Object.entries(config)) {
492
+ const secretArg = value.secret ? "--secret" : "--plaintext";
493
+ args.push(secretArg, `${key}=${value.value}`);
494
+ }
495
+ await this.runPulumiCmd(args);
544
496
  }
545
497
  /**
546
498
  * Removes the specified key-value pair on the provided stack name. Will
@@ -554,14 +506,12 @@ class LocalWorkspace {
554
506
  * @param path
555
507
  * The key contains a path to a property in a map or list to remove
556
508
  */
557
- removeConfig(stackName, key, path) {
558
- return __awaiter(this, void 0, void 0, function* () {
559
- const args = ["config", "rm", key, "--stack", stackName];
560
- if (path) {
561
- args.push("--path");
562
- }
563
- yield this.runPulumiCmd(args);
564
- });
509
+ async removeConfig(stackName, key, path) {
510
+ const args = ["config", "rm", key, "--stack", stackName];
511
+ if (path) {
512
+ args.push("--path");
513
+ }
514
+ await this.runPulumiCmd(args);
565
515
  }
566
516
  /**
567
517
  * Removes all values in the provided key list for the specified stack name
@@ -575,15 +525,13 @@ class LocalWorkspace {
575
525
  * @param path
576
526
  * The keys contain a path to a property in a map or list to remove
577
527
  */
578
- removeAllConfig(stackName, keys, path) {
579
- return __awaiter(this, void 0, void 0, function* () {
580
- const args = ["config", "rm-all", "--stack", stackName];
581
- if (path) {
582
- args.push("--path");
583
- }
584
- args.push(...keys);
585
- yield this.runPulumiCmd(args);
586
- });
528
+ async removeAllConfig(stackName, keys, path) {
529
+ const args = ["config", "rm-all", "--stack", stackName];
530
+ if (path) {
531
+ args.push("--path");
532
+ }
533
+ args.push(...keys);
534
+ await this.runPulumiCmd(args);
587
535
  }
588
536
  /**
589
537
  * Gets and sets the config map used with the last update for the stack
@@ -593,11 +541,9 @@ class LocalWorkspace {
593
541
  * @param stackName
594
542
  * The stack to refresh
595
543
  */
596
- refreshConfig(stackName) {
597
- return __awaiter(this, void 0, void 0, function* () {
598
- yield this.runPulumiCmd(["config", "refresh", "--force", "--stack", stackName]);
599
- return this.getAllConfig(stackName);
600
- });
544
+ async refreshConfig(stackName) {
545
+ await this.runPulumiCmd(["config", "refresh", "--force", "--stack", stackName]);
546
+ return this.getAllConfig(stackName);
601
547
  }
602
548
  /**
603
549
  * Returns the value associated with the specified stack name and key,
@@ -608,11 +554,9 @@ class LocalWorkspace {
608
554
  * @param key
609
555
  * The key to use for the tag lookup.
610
556
  */
611
- getTag(stackName, key) {
612
- return __awaiter(this, void 0, void 0, function* () {
613
- const result = yield this.runPulumiCmd(["stack", "tag", "get", key, "--stack", stackName]);
614
- return result.stdout.trim();
615
- });
557
+ async getTag(stackName, key) {
558
+ const result = await this.runPulumiCmd(["stack", "tag", "get", key, "--stack", stackName]);
559
+ return result.stdout.trim();
616
560
  }
617
561
  /**
618
562
  * Sets the specified key-value pair on the stack with the given name.
@@ -624,10 +568,8 @@ class LocalWorkspace {
624
568
  * @param value
625
569
  * The tag value to set.
626
570
  */
627
- setTag(stackName, key, value) {
628
- return __awaiter(this, void 0, void 0, function* () {
629
- yield this.runPulumiCmd(["stack", "tag", "set", key, value, "--stack", stackName]);
630
- });
571
+ async setTag(stackName, key, value) {
572
+ await this.runPulumiCmd(["stack", "tag", "set", key, value, "--stack", stackName]);
631
573
  }
632
574
  /**
633
575
  * Removes the specified key-value pair on the stack with the given name.
@@ -637,10 +579,8 @@ class LocalWorkspace {
637
579
  * @param key
638
580
  * The tag key to remove.
639
581
  */
640
- removeTag(stackName, key) {
641
- return __awaiter(this, void 0, void 0, function* () {
642
- yield this.runPulumiCmd(["stack", "tag", "rm", key, "--stack", stackName]);
643
- });
582
+ async removeTag(stackName, key) {
583
+ await this.runPulumiCmd(["stack", "tag", "rm", key, "--stack", stackName]);
644
584
  }
645
585
  /**
646
586
  * Returns the tag map for the specified stack, scoped to the current
@@ -649,46 +589,40 @@ class LocalWorkspace {
649
589
  * @param stackName
650
590
  * The stack to read tag metadata from.
651
591
  */
652
- listTags(stackName) {
653
- return __awaiter(this, void 0, void 0, function* () {
654
- const result = yield this.runPulumiCmd(["stack", "tag", "ls", "--json", "--stack", stackName]);
655
- return JSON.parse(result.stdout);
656
- });
592
+ async listTags(stackName) {
593
+ const result = await this.runPulumiCmd(["stack", "tag", "ls", "--json", "--stack", stackName]);
594
+ return JSON.parse(result.stdout);
657
595
  }
658
596
  /**
659
597
  * Returns information about the currently authenticated user.
660
598
  */
661
- whoAmI() {
662
- return __awaiter(this, void 0, void 0, function* () {
663
- let ver = this._pulumiVersion;
664
- if (ver === undefined) {
665
- // Assume an old version. Doesn't really matter what this is as long as it's pre-3.58.
666
- ver = semver.parse("3.0.0");
667
- }
668
- // 3.58 added the --json flag (https://github.com/pulumi/pulumi/releases/tag/v3.58.0)
669
- if (ver.compare("3.58.0") >= 0) {
670
- const result = yield this.runPulumiCmd(["whoami", "--json"]);
671
- return JSON.parse(result.stdout);
672
- }
673
- else {
674
- const result = yield this.runPulumiCmd(["whoami"]);
675
- return { user: result.stdout.trim() };
676
- }
677
- });
599
+ async whoAmI() {
600
+ let ver = this._pulumiVersion;
601
+ if (ver === undefined) {
602
+ // Assume an old version. Doesn't really matter what this is as long as it's pre-3.58.
603
+ ver = semver.parse("3.0.0");
604
+ }
605
+ // 3.58 added the --json flag (https://github.com/pulumi/pulumi/releases/tag/v3.58.0)
606
+ if (ver.compare("3.58.0") >= 0) {
607
+ const result = await this.runPulumiCmd(["whoami", "--json"]);
608
+ return JSON.parse(result.stdout);
609
+ }
610
+ else {
611
+ const result = await this.runPulumiCmd(["whoami"]);
612
+ return { user: result.stdout.trim() };
613
+ }
678
614
  }
679
615
  /**
680
616
  * Returns a summary of the currently selected stack, if any.
681
617
  */
682
- stack() {
683
- return __awaiter(this, void 0, void 0, function* () {
684
- const stacks = yield this.listStacks();
685
- for (const stack of stacks) {
686
- if (stack.current) {
687
- return stack;
688
- }
618
+ async stack() {
619
+ const stacks = await this.listStacks();
620
+ for (const stack of stacks) {
621
+ if (stack.current) {
622
+ return stack;
689
623
  }
690
- return undefined;
691
- });
624
+ }
625
+ return undefined;
692
626
  }
693
627
  /**
694
628
  * Returns all stacks from the underlying backend based on the provided
@@ -698,54 +632,50 @@ class LocalWorkspace {
698
632
  * @param opts
699
633
  * Options to customize the behavior of the list.
700
634
  */
701
- listStacks(opts) {
702
- return __awaiter(this, void 0, void 0, function* () {
703
- const args = ["stack", "ls", "--json"];
704
- if (opts) {
705
- if (opts.all) {
706
- args.push("--all");
707
- }
635
+ async listStacks(opts) {
636
+ const args = ["stack", "ls", "--json"];
637
+ if (opts) {
638
+ if (opts.all) {
639
+ args.push("--all");
708
640
  }
709
- const result = yield this.runPulumiCmd(args);
710
- return JSON.parse(result.stdout);
711
- });
641
+ }
642
+ const result = await this.runPulumiCmd(args);
643
+ return JSON.parse(result.stdout);
712
644
  }
713
645
  /**
714
646
  * Install plugin and language dependencies needed for the project.
715
647
  *
716
648
  * @param opts Options to customize the behavior of install.
717
649
  */
718
- install(opts) {
719
- return __awaiter(this, void 0, void 0, function* () {
720
- let ver = this._pulumiVersion;
721
- if (ver === undefined) {
722
- ver = semver.parse("3.0.0");
723
- }
724
- if (ver.compare("3.91.0") < 0) {
725
- // Pulumi 3.91.0 added the `pulumi install` command.
726
- // https://github.com/pulumi/pulumi/releases/tag/v3.91.0
727
- throw new Error(`pulumi install requires Pulumi version >= 3.91.0`);
728
- }
729
- const args = [];
730
- if (opts === null || opts === void 0 ? void 0 : opts.useLanguageVersionTools) {
731
- if (ver.compare("3.130.0") < 0) {
732
- // Pulumi 3.130.0 introduced the `--use-language-version-tools` flag.
733
- // https://github.com/pulumi/pulumi/releases/tag/v3.130.0
734
- throw new Error(`useLanguageVersionTools requires Pulumi version >= 3.130.0`);
735
- }
736
- args.push("--use-language-version-tools");
737
- }
738
- if (opts === null || opts === void 0 ? void 0 : opts.noPlugins) {
739
- args.push("--no-plugins");
740
- }
741
- if (opts === null || opts === void 0 ? void 0 : opts.noDependencies) {
742
- args.push("--no-dependencies");
743
- }
744
- if (opts === null || opts === void 0 ? void 0 : opts.reinstall) {
745
- args.push("--reinstall");
650
+ async install(opts) {
651
+ let ver = this._pulumiVersion;
652
+ if (ver === undefined) {
653
+ ver = semver.parse("3.0.0");
654
+ }
655
+ if (ver.compare("3.91.0") < 0) {
656
+ // Pulumi 3.91.0 added the `pulumi install` command.
657
+ // https://github.com/pulumi/pulumi/releases/tag/v3.91.0
658
+ throw new Error(`pulumi install requires Pulumi version >= 3.91.0`);
659
+ }
660
+ const args = [];
661
+ if (opts?.useLanguageVersionTools) {
662
+ if (ver.compare("3.130.0") < 0) {
663
+ // Pulumi 3.130.0 introduced the `--use-language-version-tools` flag.
664
+ // https://github.com/pulumi/pulumi/releases/tag/v3.130.0
665
+ throw new Error(`useLanguageVersionTools requires Pulumi version >= 3.130.0`);
746
666
  }
747
- yield this.runPulumiCmd(["install", ...args]);
748
- });
667
+ args.push("--use-language-version-tools");
668
+ }
669
+ if (opts?.noPlugins) {
670
+ args.push("--no-plugins");
671
+ }
672
+ if (opts?.noDependencies) {
673
+ args.push("--no-dependencies");
674
+ }
675
+ if (opts?.reinstall) {
676
+ args.push("--reinstall");
677
+ }
678
+ await this.runPulumiCmd(["install", ...args]);
749
679
  }
750
680
  /**
751
681
  * Installs a plugin in the workspace, for example to use cloud providers
@@ -758,10 +688,8 @@ class LocalWorkspace {
758
688
  * @param kind
759
689
  * The kind of plugin, defaults to "resource"
760
690
  */
761
- installPlugin(name, version, kind = "resource") {
762
- return __awaiter(this, void 0, void 0, function* () {
763
- yield this.runPulumiCmd(["plugin", "install", kind, name, version]);
764
- });
691
+ async installPlugin(name, version, kind = "resource") {
692
+ await this.runPulumiCmd(["plugin", "install", kind, name, version]);
765
693
  }
766
694
  /**
767
695
  * Installs a plugin in the workspace from a third party server.
@@ -773,10 +701,8 @@ class LocalWorkspace {
773
701
  * @param server
774
702
  * The server to install the plugin from
775
703
  */
776
- installPluginFromServer(name, version, server) {
777
- return __awaiter(this, void 0, void 0, function* () {
778
- yield this.runPulumiCmd(["plugin", "install", "resource", name, version, "--server", server]);
779
- });
704
+ async installPluginFromServer(name, version, server) {
705
+ await this.runPulumiCmd(["plugin", "install", "resource", name, version, "--server", server]);
780
706
  }
781
707
  /**
782
708
  * Removes a plugin from the workspace matching the specified name and version.
@@ -789,31 +715,27 @@ class LocalWorkspace {
789
715
  * @param kind
790
716
  * The kind of plugin, defaults to "resource".
791
717
  */
792
- removePlugin(name, versionRange, kind = "resource") {
793
- return __awaiter(this, void 0, void 0, function* () {
794
- const args = ["plugin", "rm", kind];
795
- if (name) {
796
- args.push(name);
797
- }
798
- if (versionRange) {
799
- args.push(versionRange);
800
- }
801
- args.push("--yes");
802
- yield this.runPulumiCmd(args);
803
- });
718
+ async removePlugin(name, versionRange, kind = "resource") {
719
+ const args = ["plugin", "rm", kind];
720
+ if (name) {
721
+ args.push(name);
722
+ }
723
+ if (versionRange) {
724
+ args.push(versionRange);
725
+ }
726
+ args.push("--yes");
727
+ await this.runPulumiCmd(args);
804
728
  }
805
729
  /**
806
730
  * Returns a list of all plugins installed in the workspace.
807
731
  */
808
- listPlugins() {
809
- return __awaiter(this, void 0, void 0, function* () {
810
- const result = yield this.runPulumiCmd(["plugin", "ls", "--json"]);
811
- return JSON.parse(result.stdout, (key, value) => {
812
- if (key === "installTime" || key === "lastUsedTime") {
813
- return new Date(value);
814
- }
815
- return value;
816
- });
732
+ async listPlugins() {
733
+ const result = await this.runPulumiCmd(["plugin", "ls", "--json"]);
734
+ return JSON.parse(result.stdout, (key, value) => {
735
+ if (key === "installTime" || key === "lastUsedTime") {
736
+ return new Date(value);
737
+ }
738
+ return value;
817
739
  });
818
740
  }
819
741
  /**
@@ -824,11 +746,9 @@ class LocalWorkspace {
824
746
  * @param stackName
825
747
  * The name of the stack.
826
748
  */
827
- exportStack(stackName) {
828
- return __awaiter(this, void 0, void 0, function* () {
829
- const result = yield this.runPulumiCmd(["stack", "export", "--show-secrets", "--stack", stackName]);
830
- return JSON.parse(result.stdout);
831
- });
749
+ async exportStack(stackName) {
750
+ const result = await this.runPulumiCmd(["stack", "export", "--show-secrets", "--stack", stackName]);
751
+ return JSON.parse(result.stdout);
832
752
  }
833
753
  /**
834
754
  * Imports the given deployment state into a pre-existing stack. This can be
@@ -840,42 +760,38 @@ class LocalWorkspace {
840
760
  * @param state
841
761
  * The stack state to import.
842
762
  */
843
- importStack(stackName, state) {
844
- return __awaiter(this, void 0, void 0, function* () {
845
- const randomSuffix = Math.floor(100000 + Math.random() * 900000);
846
- const filepath = upath.joinSafe(os.tmpdir(), `automation-${randomSuffix}`);
847
- const contents = JSON.stringify(state, null, 4);
848
- fs.writeFileSync(filepath, contents);
849
- yield this.runPulumiCmd(["stack", "import", "--file", filepath, "--stack", stackName]);
850
- fs.unlinkSync(filepath);
851
- });
763
+ async importStack(stackName, state) {
764
+ const randomSuffix = Math.floor(100000 + Math.random() * 900000);
765
+ const filepath = upath.joinSafe(os.tmpdir(), `automation-${randomSuffix}`);
766
+ const contents = JSON.stringify(state, null, 4);
767
+ fs.writeFileSync(filepath, contents);
768
+ await this.runPulumiCmd(["stack", "import", "--file", filepath, "--stack", stackName]);
769
+ fs.unlinkSync(filepath);
852
770
  }
853
771
  /**
854
772
  * Gets the current set of Stack outputs from the last {@link Stack.up}.
855
773
  *
856
774
  * @param stackName The name of the stack.
857
775
  */
858
- stackOutputs(stackName) {
859
- return __awaiter(this, void 0, void 0, function* () {
860
- // TODO: do this in parallel after this is fixed https://github.com/pulumi/pulumi/issues/6050
861
- const maskedResult = yield this.runPulumiCmd(["stack", "output", "--json", "--stack", stackName]);
862
- const plaintextResult = yield this.runPulumiCmd([
863
- "stack",
864
- "output",
865
- "--json",
866
- "--show-secrets",
867
- "--stack",
868
- stackName,
869
- ]);
870
- const maskedOuts = JSON.parse(maskedResult.stdout);
871
- const plaintextOuts = JSON.parse(plaintextResult.stdout);
872
- const outputs = {};
873
- for (const [key, value] of Object.entries(plaintextOuts)) {
874
- const secret = maskedOuts[key] === "[secret]";
875
- outputs[key] = { value, secret };
876
- }
877
- return outputs;
878
- });
776
+ async stackOutputs(stackName) {
777
+ // TODO: do this in parallel after this is fixed https://github.com/pulumi/pulumi/issues/6050
778
+ const maskedResult = await this.runPulumiCmd(["stack", "output", "--json", "--stack", stackName]);
779
+ const plaintextResult = await this.runPulumiCmd([
780
+ "stack",
781
+ "output",
782
+ "--json",
783
+ "--show-secrets",
784
+ "--stack",
785
+ stackName,
786
+ ]);
787
+ const maskedOuts = JSON.parse(maskedResult.stdout);
788
+ const plaintextOuts = JSON.parse(plaintextResult.stdout);
789
+ const outputs = {};
790
+ for (const [key, value] of Object.entries(plaintextOuts)) {
791
+ const secret = maskedOuts[key] === "[secret]";
792
+ outputs[key] = { value, secret };
793
+ }
794
+ return outputs;
879
795
  }
880
796
  /**
881
797
  * A hook to provide additional args to every CLI commands before they are
@@ -884,10 +800,8 @@ class LocalWorkspace {
884
800
  * Presently, {@link LocalWorkspace} does not utilize this extensibility
885
801
  * point.
886
802
  */
887
- serializeArgsForOp(_) {
888
- return __awaiter(this, void 0, void 0, function* () {
889
- return [];
890
- });
803
+ async serializeArgsForOp(_) {
804
+ return [];
891
805
  }
892
806
  /**
893
807
  * A hook executed after every command. Called with the stack name. An
@@ -895,37 +809,31 @@ class LocalWorkspace {
895
809
  * create/modify a `Pulumi.stack.yaml`) {@link LocalWorkspace} does not
896
810
  * utilize this extensibility point.
897
811
  */
898
- postCommandCallback(_) {
899
- return __awaiter(this, void 0, void 0, function* () {
900
- return;
901
- });
812
+ async postCommandCallback(_) {
813
+ return;
902
814
  }
903
- checkRemoteSupport() {
904
- return __awaiter(this, void 0, void 0, function* () {
905
- const optOut = !!this.envVars[SKIP_VERSION_CHECK_VAR] || !!process.env[SKIP_VERSION_CHECK_VAR];
906
- // If remote was specified, ensure the CLI supports it.
907
- if (!optOut && this.isRemote) {
908
- // See if `--remote` is present in `pulumi preview --help`'s output.
909
- const previewResult = yield this.runPulumiCmd(["preview", "--help"]);
910
- const previewOutput = previewResult.stdout.trim();
911
- if (!previewOutput.includes("--remote")) {
912
- throw new Error("The Pulumi CLI does not support remote operations. Please upgrade.");
913
- }
815
+ async checkRemoteSupport() {
816
+ const optOut = !!this.envVars[SKIP_VERSION_CHECK_VAR] || !!process.env[SKIP_VERSION_CHECK_VAR];
817
+ // If remote was specified, ensure the CLI supports it.
818
+ if (!optOut && this.isRemote) {
819
+ // See if `--remote` is present in `pulumi preview --help`'s output.
820
+ const previewResult = await this.runPulumiCmd(["preview", "--help"]);
821
+ const previewOutput = previewResult.stdout.trim();
822
+ if (!previewOutput.includes("--remote")) {
823
+ throw new Error("The Pulumi CLI does not support remote operations. Please upgrade.");
914
824
  }
915
- });
825
+ }
916
826
  }
917
- runPulumiCmd(args) {
918
- return __awaiter(this, void 0, void 0, function* () {
919
- let envs = {};
920
- if (this.pulumiHome) {
921
- envs["PULUMI_HOME"] = this.pulumiHome;
922
- }
923
- if (this.isRemote) {
924
- envs["PULUMI_EXPERIMENTAL"] = "true";
925
- }
926
- envs = Object.assign(Object.assign({}, envs), this.envVars);
927
- return this.pulumiCommand.run(args, this.workDir, envs);
928
- });
827
+ async runPulumiCmd(args) {
828
+ let envs = {};
829
+ if (this.pulumiHome) {
830
+ envs["PULUMI_HOME"] = this.pulumiHome;
831
+ }
832
+ if (this.isRemote) {
833
+ envs["PULUMI_EXPERIMENTAL"] = "true";
834
+ }
835
+ envs = { ...envs, ...this.envVars };
836
+ return this.pulumiCommand.run(args, this.workDir, envs);
929
837
  }
930
838
  /**
931
839
  * @internal
@@ -937,7 +845,6 @@ class LocalWorkspace {
937
845
  * @internal
938
846
  */
939
847
  remoteArgs() {
940
- var _a, _b;
941
848
  const args = [];
942
849
  if (!this.isRemote) {
943
850
  return args;
@@ -976,7 +883,7 @@ class LocalWorkspace {
976
883
  }
977
884
  }
978
885
  }
979
- for (const key of Object.keys((_a = this.remoteEnvVars) !== null && _a !== void 0 ? _a : {})) {
886
+ for (const key of Object.keys(this.remoteEnvVars ?? {})) {
980
887
  const val = this.remoteEnvVars[key];
981
888
  if (typeof val === "string") {
982
889
  args.push("--remote-env", `${key}=${val}`);
@@ -988,7 +895,7 @@ class LocalWorkspace {
988
895
  throw new Error(`unexpected env value '${val}' for key '${key}'`);
989
896
  }
990
897
  }
991
- for (const command of (_b = this.remotePreRunCommands) !== null && _b !== void 0 ? _b : []) {
898
+ for (const command of this.remotePreRunCommands ?? []) {
992
899
  args.push("--remote-pre-run-command", command);
993
900
  }
994
901
  if (this.remoteSkipInstallDependencies) {