@forge/cli 6.8.2 → 6.9.0-next.22

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 (34) hide show
  1. package/CHANGELOG.md +237 -0
  2. package/npm-shrinkwrap.json +211 -209
  3. package/out/command-line/dependency-injection.d.ts +2 -0
  4. package/out/command-line/dependency-injection.d.ts.map +1 -1
  5. package/out/command-line/dependency-injection.js +3 -0
  6. package/out/command-line/register-environment-commands.d.ts +7 -0
  7. package/out/command-line/register-environment-commands.d.ts.map +1 -1
  8. package/out/command-line/register-environment-commands.js +110 -7
  9. package/out/command-line/register-environment-variables-commands.d.ts +3 -0
  10. package/out/command-line/register-environment-variables-commands.d.ts.map +1 -1
  11. package/out/command-line/register-environment-variables-commands.js +25 -22
  12. package/out/command-line/version-info.js +1 -1
  13. package/out/command-line/view/tunnel-view.d.ts.map +1 -1
  14. package/out/command-line/view/tunnel-view.js +1 -1
  15. package/out/deploy/deployer/deploy-monitor-graphql-client.d.ts +2 -7
  16. package/out/deploy/deployer/deploy-monitor-graphql-client.d.ts.map +1 -1
  17. package/out/deploy/deployer/deploy-monitor-graphql-client.js +4 -10
  18. package/out/deploy/deployer/deployer.d.ts +9 -9
  19. package/out/deploy/deployer/deployer.d.ts.map +1 -1
  20. package/out/deploy/deployer/deployer.js +24 -25
  21. package/out/environment/delete-environment.d.ts +27 -0
  22. package/out/environment/delete-environment.d.ts.map +1 -0
  23. package/out/environment/delete-environment.js +14 -0
  24. package/out/environment/graphql-client.d.ts +5 -1
  25. package/out/environment/graphql-client.d.ts.map +1 -1
  26. package/out/environment/graphql-client.js +58 -1
  27. package/out/installations/graphql-client.d.ts +1 -1
  28. package/out/installations/graphql-client.d.ts.map +1 -1
  29. package/out/installations/graphql-client.js +11 -10
  30. package/out/service/resources-uploader-service.js +3 -3
  31. package/out/service/tunnel-service.d.ts +4 -1
  32. package/out/service/tunnel-service.d.ts.map +1 -1
  33. package/out/service/tunnel-service.js +10 -1
  34. package/package.json +15 -15
@@ -10,6 +10,7 @@ import { ListContributorsCommand } from '../contributors/list-contributors';
10
10
  import { RemoveContributorsCommand } from '../contributors/remove-contributors';
11
11
  import { CreateEnvironmentCommand } from '../environment/create-environment';
12
12
  import { ListEnvironmentCommand } from '../environment/list-environment';
13
+ import { DeleteEnvironmentCommand } from '../environment/delete-environment';
13
14
  import { InstallAppSiteCommand } from '../installations/install-app-site';
14
15
  import { UninstallAppCommand } from '../installations/uninstall-app';
15
16
  import { InstallationService } from '../service/installation-service';
@@ -53,6 +54,7 @@ export declare const getDependencies: (cliDetails: CLIDetails | undefined) => Pr
53
54
  removeContributorsCommand: RemoveContributorsCommand;
54
55
  createEnvironmentCommand: CreateEnvironmentCommand;
55
56
  listEnvironmentCommand: ListEnvironmentCommand;
57
+ deleteEnvironmentCommand: DeleteEnvironmentCommand;
56
58
  viewAppLogsCommand: ViewAppLogsCommand;
57
59
  getWebTriggerURLCommand: GetWebTriggerURLCommand;
58
60
  listEntitiesIndexesCommand: ListEntitiesIndexesCommand;
@@ -1 +1 @@
1
- {"version":3,"file":"dependency-injection.d.ts","sourceRoot":"","sources":["../../src/command-line/dependency-injection.ts"],"names":[],"mappings":"AAIA,OAAO,EASL,UAAU,EACV,aAAa,EAEb,UAAU,EAGV,gBAAgB,EAGhB,kBAAkB,EAUlB,YAAY,EACZ,aAAa,EAOb,kBAAkB,EAIlB,kBAAkB,EAEnB,MAAM,mBAAmB,CAAC;AAc3B,OAAO,EAAE,uBAAuB,EAAE,MAAM,sCAAsC,CAAC;AAE/E,OAAO,EAML,0BAA0B,EAG3B,MAAM,WAAW,CAAC;AAEnB,OAAO,EAAE,gCAAgC,EAAE,MAAM,sDAAsD,CAAC;AAExG,OAAO,EAAE,+BAA+B,EAAE,MAAM,qDAAqD,CAAC;AACtG,OAAO,EAAE,6BAA6B,EAAE,MAAM,mDAAmD,CAAC;AAIlG,OAAO,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AAG3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6 +23,7 @@ const graphql_client_4 = require("../contributors/graphql-client");
23
23
  const graphql_client_5 = require("../entities/graphql-client");
24
24
  const create_environment_1 = require("../environment/create-environment");
25
25
  const list_environment_1 = require("../environment/list-environment");
26
+ const delete_environment_1 = require("../environment/delete-environment");
26
27
  const graphql_client_6 = require("../environment/graphql-client");
27
28
  const graphql_client_7 = require("../installations/graphql-client");
28
29
  const site_translation_1 = require("../installations/site-translation");
@@ -125,6 +126,7 @@ const getDependencies = async (cliDetails) => {
125
126
  const environmentClient = new graphql_client_6.GraphqlClient(graphQLClient);
126
127
  const createEnvironmentCommand = new create_environment_1.CreateEnvironmentCommand(environmentClient, assertiveAppConfigReader);
127
128
  const listEnvironmentCommand = new list_environment_1.ListEnvironmentCommand(environmentClient, assertiveAppConfigReader);
129
+ const deleteEnvironmentCommand = new delete_environment_1.DeleteEnvironmentCommand(environmentClient, assertiveAppConfigReader);
128
130
  const migrationKeysClient = new graphql_client_2.GraphqlClient(graphQLClient);
129
131
  const migrationKeysService = new migration_keys_service_1.MigrationKeysService(migrationKeysClient, assertiveAppConfigReader);
130
132
  const appEnvironmentClient = new cli_shared_1.AppEnvironmentsGraphqlClient(graphQLClient);
@@ -206,6 +208,7 @@ const getDependencies = async (cliDetails) => {
206
208
  removeContributorsCommand,
207
209
  createEnvironmentCommand,
208
210
  listEnvironmentCommand,
211
+ deleteEnvironmentCommand,
209
212
  viewAppLogsCommand,
210
213
  getWebTriggerURLCommand,
211
214
  listEntitiesIndexesCommand
@@ -2,7 +2,14 @@ import { UI } from '@forge/cli-shared';
2
2
  import { Dependencies } from './dependency-injection';
3
3
  import { CreateEnvironmentCommand } from '../environment/create-environment';
4
4
  import { ListEnvironmentCommand } from '../environment/list-environment';
5
+ import { DeleteEnvironmentCommand } from '../environment/delete-environment';
6
+ interface RemoveEnvironmentArgs {
7
+ environment?: string[];
8
+ nonInteractive?: boolean;
9
+ }
5
10
  export declare const createEnvironmentHandler: (ui: UI, createEnvironmentCommand: CreateEnvironmentCommand, environmentKey?: string) => Promise<void>;
6
11
  export declare const listEnvironmentHandler: (ui: UI, listEnvironmentCommand: ListEnvironmentCommand) => Promise<void>;
12
+ export declare const deleteEnvironmentHandler: (ui: UI, options: RemoveEnvironmentArgs, listEnvironmentCommand: ListEnvironmentCommand, deleteEnvironmentCommand: DeleteEnvironmentCommand) => Promise<void>;
7
13
  export declare const registerCommands: (deps: Dependencies) => void;
14
+ export {};
8
15
  //# sourceMappingURL=register-environment-commands.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"register-environment-commands.d.ts","sourceRoot":"","sources":["../../src/command-line/register-environment-commands.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAQ,MAAM,mBAAmB,CAAC;AAE7C,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAEtD,OAAO,EAAE,wBAAwB,EAAE,MAAM,mCAAmC,CAAC;AAC7E,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AAIzE,eAAO,MAAM,wBAAwB,OAC/B,EAAE,4BACoB,wBAAwB,mBACjC,MAAM,kBAmBxB,CAAC;AAEF,eAAO,MAAM,sBAAsB,OAAc,EAAE,0BAA0B,sBAAsB,kBAiClG,CAAC;AA8BF,eAAO,MAAM,gBAAgB,SAAU,YAAY,KAAG,IAMrD,CAAC"}
1
+ {"version":3,"file":"register-environment-commands.d.ts","sourceRoot":"","sources":["../../src/command-line/register-environment-commands.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,EAAE,EAMH,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAEtD,OAAO,EAAE,wBAAwB,EAAE,MAAM,mCAAmC,CAAC;AAC7E,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AACzE,OAAO,EAAE,wBAAwB,EAA2B,MAAM,mCAAmC,CAAC;AAMtG,UAAU,qBAAqB;IAC7B,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED,eAAO,MAAM,wBAAwB,OAC/B,EAAE,4BACoB,wBAAwB,mBACjC,MAAM,kBAoBxB,CAAC;AAEF,eAAO,MAAM,sBAAsB,OAAc,EAAE,0BAA0B,sBAAsB,kBAiClG,CAAC;AAEF,eAAO,MAAM,wBAAwB,OAC/B,EAAE,WACG,qBAAqB,0BACN,sBAAsB,4BACpB,wBAAwB,kBAmCnD,CAAC;AA+IF,eAAO,MAAM,gBAAgB,SAAU,YAAY,KAAG,IAOrD,CAAC"}
@@ -1,17 +1,22 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.registerCommands = exports.listEnvironmentHandler = exports.createEnvironmentHandler = void 0;
3
+ exports.registerCommands = exports.deleteEnvironmentHandler = exports.listEnvironmentHandler = exports.createEnvironmentHandler = void 0;
4
+ const tslib_1 = require("tslib");
4
5
  const cli_shared_1 = require("@forge/cli-shared");
6
+ const chalk_1 = tslib_1.__importDefault(require("chalk"));
7
+ const errors_1 = require("./errors");
5
8
  const COMMAND_NAME = 'environment';
6
9
  const createEnvironmentHandler = async (ui, createEnvironmentCommand, environmentKey) => {
7
- ui.info(cli_shared_1.Text.createEnvironment.overview);
8
- ui.emptyLine();
9
10
  if (!environmentKey) {
11
+ ui.info(cli_shared_1.Text.createEnvironment.overview);
12
+ ui.emptyLine();
10
13
  environmentKey = await ui.promptForText(cli_shared_1.Text.createEnvironment.promptEnvironmentKey);
11
14
  ui.emptyLine();
12
15
  }
13
- const args = { environmentKey };
14
- await ui.displayProgress(() => createEnvironmentCommand.execute(args), cli_shared_1.Text.createEnvironment.cmd.start, cli_shared_1.Text.createEnvironment.cmd.success(environmentKey));
16
+ const args = {
17
+ environmentKey: (0, cli_shared_1.optionToEnvironment)(environmentKey)
18
+ };
19
+ await ui.displayProgress(() => createEnvironmentCommand.execute(args), cli_shared_1.Text.createEnvironment.cmd.start, cli_shared_1.Text.createEnvironment.cmd.success(environmentKey, cli_shared_1.AppEnvironmentType.Development, cli_shared_1.environmentToOption));
15
20
  ui.emptyLine();
16
21
  ui.info(cli_shared_1.Text.createEnvironment.successMessage);
17
22
  };
@@ -27,10 +32,10 @@ const listEnvironmentHandler = async (ui, listEnvironmentCommand) => {
27
32
  ['type', 'Type'],
28
33
  ['name', 'Name'],
29
34
  ['lastDeployedAt', 'Last deployed at']
30
- ], environments.map(({ type, key: name, lastDeployedAt }) => {
35
+ ], environments.map(({ type, key, lastDeployedAt }) => {
31
36
  return {
32
37
  type,
33
- name,
38
+ name: (0, cli_shared_1.environmentToOption)(key),
34
39
  lastDeployedAt
35
40
  };
36
41
  }), {
@@ -44,6 +49,92 @@ const listEnvironmentHandler = async (ui, listEnvironmentCommand) => {
44
49
  });
45
50
  };
46
51
  exports.listEnvironmentHandler = listEnvironmentHandler;
52
+ const deleteEnvironmentHandler = async (ui, options, listEnvironmentCommand, deleteEnvironmentCommand) => {
53
+ let confirmDeleteEnvironments = false;
54
+ let environmentKeys = options.environment;
55
+ const nonInteractive = options.nonInteractive;
56
+ if (!environmentKeys) {
57
+ environmentKeys = await getEnvironmentKeysToDelete(ui, listEnvironmentCommand);
58
+ }
59
+ if (!environmentKeys) {
60
+ return;
61
+ }
62
+ environmentKeys = environmentKeys.map(cli_shared_1.optionToEnvironment);
63
+ if (nonInteractive) {
64
+ confirmDeleteEnvironments = true;
65
+ }
66
+ if (!confirmDeleteEnvironments) {
67
+ confirmDeleteEnvironments = await getDeleteConfirmation(ui, environmentKeys);
68
+ }
69
+ if (!confirmDeleteEnvironments) {
70
+ return;
71
+ }
72
+ ui.emptyLine();
73
+ const { deletedEnvironments, successful } = await deleteEnvironments(ui, deleteEnvironmentCommand, environmentKeys);
74
+ ui.emptyLine();
75
+ displayDeleteResult(ui, deletedEnvironments, successful);
76
+ };
77
+ exports.deleteEnvironmentHandler = deleteEnvironmentHandler;
78
+ const getEnvironmentKeysToDelete = async (ui, listEnvironmentCommand) => {
79
+ const environments = (await listEnvironmentCommand.execute())
80
+ .filter((env) => env.type === cli_shared_1.AppEnvironmentType.Development && env.key !== cli_shared_1.DEFAULT_ENVIRONMENT_KEY)
81
+ .sort((a, b) => Number(a.lastDeployedAt) - Number(b.lastDeployedAt));
82
+ if (environments.length === 0) {
83
+ ui.info(cli_shared_1.Text.deleteEnvironment.noEnvironmentMessage);
84
+ return;
85
+ }
86
+ ui.info(cli_shared_1.Text.deleteEnvironment.overview);
87
+ ui.emptyLine();
88
+ const selectedEnvironmentIndexes = await ui.promptForTable(cli_shared_1.Text.deleteEnvironment.prompt, cli_shared_1.Text.deleteEnvironment.info, ['Name', 'Last deployed at'], environments.map(({ key, lastDeployedAt }) => ({
89
+ names: [(0, cli_shared_1.environmentToOption)(key), new Date(Number(lastDeployedAt)).toISOString()]
90
+ })));
91
+ return selectedEnvironmentIndexes.map((index) => environments[index].key);
92
+ };
93
+ const getDeleteConfirmation = async (ui, environmentKeys) => {
94
+ ui.info(cli_shared_1.Text.deleteEnvironment.confirmationInfo);
95
+ ui.emptyLine();
96
+ environmentKeys.forEach((envKey) => {
97
+ ui.info(chalk_1.default.grey((0, cli_shared_1.environmentToOption)(envKey)));
98
+ });
99
+ ui.emptyLine();
100
+ ui.warn(cli_shared_1.Text.deleteEnvironment.warningMessage);
101
+ ui.emptyLine();
102
+ return ui.confirm(cli_shared_1.Text.deleteEnvironment.promptConfirmation);
103
+ };
104
+ const deleteEnvironments = async (ui, deleteEnvironmentCommand, environmentKeys) => {
105
+ let successful = false;
106
+ const args = { environmentKeys };
107
+ const deletedEnvironments = await ui.displayProgress(() => deleteEnvironmentCommand.batchExecute(args), cli_shared_1.Text.deleteEnvironment.cmd.start, (result) => {
108
+ successful = result.every(({ successful }) => successful);
109
+ return {
110
+ successful,
111
+ message: cli_shared_1.Text.deleteEnvironment.cmd.start
112
+ };
113
+ });
114
+ return {
115
+ deletedEnvironments,
116
+ successful
117
+ };
118
+ };
119
+ const displayDeleteResult = (ui, deletedEnvironments, deleteSuccessful) => {
120
+ const deferredErrors = [];
121
+ const successfulDelete = deletedEnvironments.filter((env) => env.successful);
122
+ const failedDelete = deletedEnvironments.filter((env) => !env.successful);
123
+ successfulDelete.forEach(({ environmentKey }) => {
124
+ ui.info(cli_shared_1.Text.deleteEnvironment.individualSuccessMessage(environmentKey, cli_shared_1.AppEnvironmentType.Development, cli_shared_1.environmentToOption));
125
+ });
126
+ failedDelete.forEach(({ error }) => {
127
+ if (error !== undefined) {
128
+ ui.error(error);
129
+ deferredErrors.push(error);
130
+ }
131
+ });
132
+ if (!deleteSuccessful) {
133
+ throw new errors_1.DeferredErrors(deferredErrors);
134
+ }
135
+ ui.emptyLine();
136
+ ui.info(cli_shared_1.Text.deleteEnvironment.successMessage);
137
+ };
47
138
  const registerCreateEnvironmentCommand = (parent, { ui, commands: { createEnvironmentCommand } }) => {
48
139
  parent
49
140
  .command('create')
@@ -64,10 +155,22 @@ const registerListEnvironmentCommand = (parent, { ui, commands: { listEnvironmen
64
155
  await (0, exports.listEnvironmentHandler)(ui, listEnvironmentCommand);
65
156
  });
66
157
  };
158
+ const registerDeleteEnvironmentCommand = (parent, { ui, commands: { listEnvironmentCommand, deleteEnvironmentCommand } }) => {
159
+ parent
160
+ .command('delete')
161
+ .requireAppId()
162
+ .description(cli_shared_1.Text.deleteEnvironment.cmd.desc)
163
+ .option('-e, --environment [environments...]', cli_shared_1.Text.deleteEnvironment.optionEnvironmentKey)
164
+ .nonInteractiveOption('--environment')
165
+ .action(async (options) => {
166
+ await (0, exports.deleteEnvironmentHandler)(ui, options, listEnvironmentCommand, deleteEnvironmentCommand);
167
+ });
168
+ };
67
169
  const registerCommands = (deps) => {
68
170
  const { cmd } = deps;
69
171
  const environment = cmd.command(COMMAND_NAME).description(cli_shared_1.Text.environment.desc);
70
172
  registerCreateEnvironmentCommand(environment, deps);
71
173
  registerListEnvironmentCommand(environment, deps);
174
+ registerDeleteEnvironmentCommand(environment, deps);
72
175
  };
73
176
  exports.registerCommands = registerCommands;
@@ -1,3 +1,6 @@
1
+ import { UI } from '@forge/cli-shared';
1
2
  import { Dependencies } from './dependency-injection';
3
+ import { ListEnvironmentVariablesCommand } from '../environment-variables/list-environment-variables';
4
+ export declare function listEnvironmentVariableCommandHandler(ui: UI, listEnvironmentVariablesCommand: ListEnvironmentVariablesCommand, environment: string, json: boolean): Promise<void>;
2
5
  export declare const registerCommands: ({ cmd, ...deps }: Dependencies) => void;
3
6
  //# sourceMappingURL=register-environment-variables-commands.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"register-environment-variables-commands.d.ts","sourceRoot":"","sources":["../../src/command-line/register-environment-variables-commands.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AA2HtD,eAAO,MAAM,gBAAgB,qBAAsB,YAAY,KAAG,IAOjE,CAAC"}
1
+ {"version":3,"file":"register-environment-variables-commands.d.ts","sourceRoot":"","sources":["../../src/command-line/register-environment-variables-commands.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAmD,MAAM,mBAAmB,CAAC;AAExF,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,+BAA+B,EAAE,MAAM,qDAAqD,CAAC;AA2EtG,wBAAsB,qCAAqC,CACzD,EAAE,EAAE,EAAE,EACN,+BAA+B,EAAE,+BAA+B,EAChE,WAAW,EAAE,MAAM,EACnB,IAAI,EAAE,OAAO,iBAwBd;AA4BD,eAAO,MAAM,gBAAgB,qBAAsB,YAAY,KAAG,IAOjE,CAAC"}
@@ -1,9 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.registerCommands = void 0;
3
+ exports.registerCommands = exports.listEnvironmentVariableCommandHandler = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const cli_shared_1 = require("@forge/cli-shared");
6
- const cli_shared_2 = require("@forge/cli-shared");
7
6
  const COMMAND_NAME = 'variables';
8
7
  const SET_COMMAND_NAME = 'set';
9
8
  const registerSetEnvironmentVariableCommand = ({ cmd, ui, commands: { setEnvironmentVariableCommand } }) => {
@@ -14,7 +13,7 @@ const registerSetEnvironmentVariableCommand = ({ cmd, ui, commands: { setEnviron
14
13
  .option('--encrypt', cli_shared_1.Text.varsSet.optionSecret, false)
15
14
  .environmentOption()
16
15
  .action(async (key, value, { environment, encrypt }) => {
17
- ui.info(cli_shared_1.Text.varsSet.overview(environment, cli_shared_2.environmentToOption));
16
+ ui.info(cli_shared_1.Text.varsSet.overview(environment, (0, cli_shared_1.guessEnvironmentType)(environment), cli_shared_1.environmentToOption));
18
17
  ui.info(cli_shared_1.Text.ctrlC);
19
18
  ui.emptyLine();
20
19
  if (!value && !encrypt) {
@@ -48,7 +47,7 @@ const registerDeleteEnvironmentVariableCommand = ({ cmd, ui, commands: { deleteE
48
47
  .description(cli_shared_1.Text.varsUnset.cmd.desc)
49
48
  .environmentOption()
50
49
  .action(async (key, { environment }) => {
51
- ui.info(cli_shared_1.Text.varsUnset.cmd.start(environment, cli_shared_2.environmentToOption));
50
+ ui.info(cli_shared_1.Text.varsUnset.cmd.start(environment, (0, cli_shared_1.guessEnvironmentType)(environment), cli_shared_1.environmentToOption));
52
51
  ui.info(cli_shared_1.Text.ctrlC);
53
52
  await deleteEnvironmentVariableCommand.execute({ environment, key });
54
53
  ui.info(cli_shared_1.Text.varsUnset.cmd.success(key));
@@ -56,6 +55,27 @@ const registerDeleteEnvironmentVariableCommand = ({ cmd, ui, commands: { deleteE
56
55
  });
57
56
  };
58
57
  const LIST_COMMAND_NAME = 'list';
58
+ async function listEnvironmentVariableCommandHandler(ui, listEnvironmentVariablesCommand, environment, json) {
59
+ const variables = await listEnvironmentVariablesCommand.execute({ environment });
60
+ ui.table([
61
+ ['encrypted', 'Encrypted?'],
62
+ ['key', 'Key'],
63
+ ['value', 'Value']
64
+ ], variables === null || variables === void 0 ? void 0 : variables.map(({ encrypt: encrypted, key, value }) => ({
65
+ encrypted,
66
+ key,
67
+ value: encrypted ? cli_shared_1.Text.varsList.encryptedValue : value
68
+ })), {
69
+ json,
70
+ emptyMessage: cli_shared_1.Text.varsList.empty(environment, (0, cli_shared_1.guessEnvironmentType)(environment), cli_shared_1.environmentToOption),
71
+ preMessage: cli_shared_1.Text.varsList.overview(environment, (0, cli_shared_1.guessEnvironmentType)(environment), cli_shared_1.environmentToOption),
72
+ postMessage: cli_shared_1.Text.varsList.postfix,
73
+ format: {
74
+ encrypted: (value) => (value ? '✔' : '')
75
+ }
76
+ });
77
+ }
78
+ exports.listEnvironmentVariableCommandHandler = listEnvironmentVariableCommandHandler;
59
79
  const registerListEnvironmentVariableCommand = ({ cmd, ui, commands: { listEnvironmentVariablesCommand } }) => {
60
80
  cmd
61
81
  .command(LIST_COMMAND_NAME)
@@ -64,24 +84,7 @@ const registerListEnvironmentVariableCommand = ({ cmd, ui, commands: { listEnvir
64
84
  .environmentOption()
65
85
  .jsonOption()
66
86
  .action(async ({ environment, json }) => {
67
- const variables = await listEnvironmentVariablesCommand.execute({ environment });
68
- ui.table([
69
- ['encrypted', 'Encrypted?'],
70
- ['key', 'Key'],
71
- ['value', 'Value']
72
- ], variables === null || variables === void 0 ? void 0 : variables.map(({ encrypt: encrypted, key, value }) => ({
73
- encrypted,
74
- key,
75
- value: encrypted ? cli_shared_1.Text.varsList.encryptedValue : value
76
- })), {
77
- json,
78
- emptyMessage: cli_shared_1.Text.varsList.empty(environment, cli_shared_2.environmentToOption),
79
- preMessage: cli_shared_1.Text.varsList.overview(environment, cli_shared_2.environmentToOption),
80
- postMessage: cli_shared_1.Text.varsList.postfix,
81
- format: {
82
- encrypted: (value) => (value ? '✔' : '')
83
- }
84
- });
87
+ await listEnvironmentVariableCommandHandler(ui, listEnvironmentVariablesCommand, environment, json);
85
88
  });
86
89
  };
87
90
  const DEPRECATED_SET_COMMAND = 'variables:set';
@@ -23,7 +23,7 @@ const getCLIDetails = () => {
23
23
  }
24
24
  };
25
25
  exports.getCLIDetails = getCLIDetails;
26
- const supportedNodeMajorVersions = [14, 16, 18];
26
+ const supportedNodeMajorVersions = [16, 18];
27
27
  exports.semverSupportedNodeVersion = supportedNodeMajorVersions.map((v) => `${v}.x`).join(' || ');
28
28
  exports.humanReadableSupportedNodeVersion = supportedNodeMajorVersions
29
29
  .map((v) => `${v}.x`)
@@ -1 +1 @@
1
- {"version":3,"file":"tunnel-view.d.ts","sourceRoot":"","sources":["../../../src/command-line/view/tunnel-view.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,aAAa,EAGb,WAAW,EAGX,SAAS,EACV,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAGpC,MAAM,WAAW,yBAAyB;IACxC,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,SAAS,EAAE,MAAM,IAAI,CAAC;CACvB;AAED,qBAAa,eAAgB,SAAQ,SAAS;CAAG;AAEjD,qBAAa,UAAU;IACT,OAAO,CAAC,QAAQ,CAAC,EAAE;gBAAF,EAAE,EAAE,aAAa;IAEvC,cAAc,CAAC,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI;IAW7C,qBAAqB,CAAC,MAAM,EAAE,OAAO,WAAW,GAAG,CAAC,GAAG,EAAE,KAAK,KAAK,OAAO,CAAC,IAAI,CAAC;IAQhF,iBAAiB,CAAC,UAAU,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,GAAG,MAAM;IA+BxE,iBAAiB,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM;IAQpG,sBAAsB,CAC3B,yBAAyB,EAAE,UAAU,CAAC,OAAO,KAAK,CAAC,EACnD,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,EAAE,yBAAyB,GAC3D,OAAO,CAAC,IAAI,CAAC;CAyCjB"}
1
+ {"version":3,"file":"tunnel-view.d.ts","sourceRoot":"","sources":["../../../src/command-line/view/tunnel-view.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,aAAa,EAGb,WAAW,EAIX,SAAS,EACV,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAGpC,MAAM,WAAW,yBAAyB;IACxC,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,SAAS,EAAE,MAAM,IAAI,CAAC;CACvB;AAED,qBAAa,eAAgB,SAAQ,SAAS;CAAG;AAEjD,qBAAa,UAAU;IACT,OAAO,CAAC,QAAQ,CAAC,EAAE;gBAAF,EAAE,EAAE,aAAa;IAEvC,cAAc,CAAC,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI;IAa7C,qBAAqB,CAAC,MAAM,EAAE,OAAO,WAAW,GAAG,CAAC,GAAG,EAAE,KAAK,KAAK,OAAO,CAAC,IAAI,CAAC;IAQhF,iBAAiB,CAAC,UAAU,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,GAAG,MAAM;IA+BxE,iBAAiB,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM;IAQpG,sBAAsB,CAC3B,yBAAyB,EAAE,UAAU,CAAC,OAAO,KAAK,CAAC,EACnD,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,EAAE,yBAAyB,GAC3D,OAAO,CAAC,IAAI,CAAC;CAyCjB"}
@@ -15,7 +15,7 @@ class TunnelView {
15
15
  this.ui.info(cli_shared_1.Text.tunnel.preamble);
16
16
  if (environmentKey && environmentKey !== cli_shared_1.DEFAULT_ENVIRONMENT_KEY) {
17
17
  this.ui.emptyLine();
18
- this.ui.info(cli_shared_1.Text.tunnel.startingTunnel(environmentKey, cli_shared_1.environmentToOption));
18
+ this.ui.info(cli_shared_1.Text.tunnel.startingTunnel(environmentKey, (0, cli_shared_1.guessEnvironmentType)(environmentKey), cli_shared_1.environmentToOption));
19
19
  this.ui.emptyLine();
20
20
  }
21
21
  this.ui.info(cli_shared_1.Text.ctrlC);
@@ -4,13 +4,8 @@ export interface DeployMonitorDetails {
4
4
  deploymentId: string;
5
5
  environmentKey: string;
6
6
  }
7
- export declare enum DeployMonitorStatus {
8
- InProgress = "IN_PROGRESS",
9
- Done = "DONE",
10
- Failed = "FAILED"
11
- }
12
- export declare type DeployMonitor = Pick<AppDeployment, 'stages'> & Pick<AppDeployment, 'errorDetails'> & {
13
- status: DeployMonitorStatus;
7
+ export declare type DeployMonitor = Pick<AppDeployment, 'stages' | 'errorDetails' | 'status'> & {
8
+ requestId: string;
14
9
  };
15
10
  export declare type DeployMonitorEvent = AppDeploymentLogEvent | AppDeploymentSnapshotLogEvent | AppDeploymentTransitionEvent;
16
11
  export interface DeployMonitorClient {
@@ -1 +1 @@
1
- {"version":3,"file":"deploy-monitor-graphql-client.d.ts","sourceRoot":"","sources":["../../../src/deploy/deployer/deploy-monitor-graphql-client.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,qBAAqB,EACrB,6BAA6B,EAC7B,4BAA4B,EAC5B,aAAa,EAEd,MAAM,mBAAmB,CAAC;AAI3B,MAAM,WAAW,oBAAoB;IACnC,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,oBAAY,mBAAmB;IAC7B,UAAU,gBAAgB;IAC1B,IAAI,SAAS;IACb,MAAM,WAAW;CAClB;AAED,oBAAY,aAAa,GAAG,IAAI,CAAC,aAAa,EAAE,QAAQ,CAAC,GACvD,IAAI,CAAC,aAAa,EAAE,cAAc,CAAC,GAAG;IAAE,MAAM,EAAE,mBAAmB,CAAA;CAAE,CAAC;AAGxE,oBAAY,kBAAkB,GAAG,q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-1,19 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DeployMonitorGraphqlClient = exports.DeployMonitorStatus = void 0;
3
+ exports.DeployMonitorGraphqlClient = void 0;
4
4
  const trigger_deploy_graphql_client_1 = require("./trigger-deploy-graphql-client");
5
- var DeployMonitorStatus;
6
- (function (DeployMonitorStatus) {
7
- DeployMonitorStatus["InProgress"] = "IN_PROGRESS";
8
- DeployMonitorStatus["Done"] = "DONE";
9
- DeployMonitorStatus["Failed"] = "FAILED";
10
- })(DeployMonitorStatus = exports.DeployMonitorStatus || (exports.DeployMonitorStatus = {}));
11
5
  class DeployMonitorGraphqlClient {
12
6
  constructor(graphqlClient) {
13
7
  this.graphqlClient = graphqlClient;
14
8
  }
15
9
  async getDeployment({ appId, environmentKey, deploymentId }) {
16
- const result = await this.graphqlClient.query(`
10
+ const { appDeployment, requestId } = await this.graphqlClient.query(`
17
11
  query forge_cli_getApplicationDeploymentStatus($appId: ID!, $environmentKey: String!, $id: ID!) {
18
12
  appDeployment(appId: $appId, environmentKey: $environmentKey, id: $id) {
19
13
  status
@@ -48,10 +42,10 @@ class DeployMonitorGraphqlClient {
48
42
  environmentKey,
49
43
  id: deploymentId
50
44
  });
51
- if (!result.appDeployment) {
45
+ if (!appDeployment) {
52
46
  throw new trigger_deploy_graphql_client_1.NoDeploymentError();
53
47
  }
54
- return result.appDeployment;
48
+ return Object.assign(Object.assign({}, appDeployment), { requestId });
55
49
  }
56
50
  }
57
51
  exports.DeployMonitorGraphqlClient = DeployMonitorGraphqlClient;
@@ -1,19 +1,19 @@
1
- import { AppConfigProvider, Pause, UI, BaseError } from '@forge/cli-shared';
2
- import { DeployMonitorClient, DeployMonitorStatus } from './deploy-monitor-graphql-client';
1
+ import { AppConfigProvider, AppDeploymentStatus, Pause, UI, BaseError } from '@forge/cli-shared';
2
+ import { DeployMonitorClient } from './deploy-monitor-graphql-client';
3
3
  import { TriggerDeployClient } from './trigger-deploy-graphql-client';
4
4
  export declare class AppDeploymentFailedError extends BaseError {
5
- private readonly userError?;
6
- constructor(userError?: boolean | undefined, message?: string);
5
+ private readonly userError;
6
+ constructor(userError?: boolean, requestId?: string | undefined, message?: string);
7
7
  isUserError(): boolean;
8
8
  }
9
9
  export declare class AppSnapshotFailedError extends BaseError {
10
- private readonly userError?;
11
- constructor(userError?: boolean | undefined, message?: string);
10
+ private readonly userError;
11
+ constructor(userError?: boolean, requestId?: string | undefined, message?: string);
12
12
  isUserError(): boolean;
13
13
  }
14
14
  export declare class HostedResourceDeploymentFailedError extends BaseError {
15
- private readonly userError?;
16
- constructor(userError?: boolean | undefined, message?: string);
15
+ private readonly userError;
16
+ constructor(userError?: boolean, requestId?: string | undefined, message?: string);
17
17
  isUserError(): boolean;
18
18
  }
19
19
  export interface Deployer {
@@ -29,7 +29,7 @@ export declare class ArtifactDeployer implements Deployer {
29
29
  deploy(environmentKey: string, artifactUrl: string, hostedResourceUploadId?: string): Promise<void>;
30
30
  private doDeploy;
31
31
  pollAndCheckEvents(appId: string, environmentKey: string, deploymentId: string, totalStreamed: number): Promise<{
32
- status: DeployMonitorStatus;
32
+ status: AppDeploymentStatus;
33
33
  totalStreamed: number;
34
34
  }>;
35
35
  private monitorDeployment;
@@ -1 +1 @@
1
- {"version":3,"file":"deployer.d.ts","sourceRoot":"","sources":["../../../src/deploy/deployer/deployer.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EAOjB,KAAK,EAEL,EAAE,EAEF,SAAS,EACV,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,mBAAmB,EAAsB,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAC/G,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAItE,qBAAa,wBAAyB,SAAQ,SAAS;IACzC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC;gBAAV,SAAS,CAAC,qBAAS,EAAE,OAAO,CAAC,EAAE,MAAM;IAG3D,WAAW,I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AAC,QAAQ,CAAC,KAAK;IACtB,OAAO,CAAC,QAAQ,CAAC,EAAE;gBAJF,gBAAgB,EAAE,iBAAiB,EACnC,YAAY,EAAE,mBAAmB,EACjC,mBAAmB,EAAE,mBAAmB,EACxC,KAAK,EAAE,KAAK,EACZ,EAAE,EAAE,EAAE;IAGZ,MAAM,CAAC,cAAc,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,sBAAsB,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;YAMlG,QAAQ;IAcT,kBAAkB,CAAC,KAAK,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM;;;;YA2BpG,iBAAiB;IAa/B,OAAO,CAAC,gBAAgB;IAsBxB,OAAO,CAAC,0BAA0B;IA6BlC,OAAO,CAAC,gBAAgB;CAsDzB"}
@@ -2,35 +2,34 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ArtifactDeployer = exports.HostedResourceDeploymentFailedError = exports.AppSnapshotFailedError = exports.AppDeploymentFailedError = void 0;
4
4
  const cli_shared_1 = require("@forge/cli-shared");
5
- const deploy_monitor_graphql_client_1 = require("./deploy-monitor-graphql-client");
6
5
  const DEPLOYMENT_EVENT_POLL_INTERVAL = 500;
7
6
  class AppDeploymentFailedError extends cli_shared_1.BaseError {
8
- constructor(userError, message) {
9
- super(message);
7
+ constructor(userError = false, requestId, message) {
8
+ super(requestId, `${message} (requestId: ${requestId || 'unknown'})`);
10
9
  this.userError = userError;
11
10
  }
12
11
  isUserError() {
13
- return Boolean(this.userError);
12
+ return this.userError;
14
13
  }
15
14
  }
16
15
  exports.AppDeploymentFailedError = AppDeploymentFailedError;
17
16
  class AppSnapshotFailedError extends cli_shared_1.BaseError {
18
- constructor(userError, message) {
19
- super(message);
17
+ constructor(userError = false, requestId, message) {
18
+ super(requestId, message);
20
19
  this.userError = userError;
21
20
  }
22
21
  isUserError() {
23
- return Boolean(this.userError);
22
+ return this.userError;
24
23
  }
25
24
  }
26
25
  exports.AppSnapshotFailedError = AppSnapshotFailedError;
27
26
  class HostedResourceDeploymentFailedError extends cli_shared_1.BaseError {
28
- constructor(userError, message) {
29
- super(message);
27
+ constructor(userError = false, requestId, message) {
28
+ super(requestId, message);
30
29
  this.userError = userError;
31
30
  }
32
31
  isUserError() {
33
- return Boolean(this.userError);
32
+ return this.userError;
34
33
  }
35
34
  }
36
35
  exports.HostedResourceDeploymentFailedError = HostedResourceDeploymentFailedError;
@@ -65,7 +64,7 @@ class ArtifactDeployer {
65
64
  });
66
65
  }
67
66
  async pollAndCheckEvents(appId, environmentKey, deploymentId, totalStreamed) {
68
- const { stages, status, errorDetails } = await this.deployMonitorClient.getDeployment({
67
+ const { stages, status, errorDetails, requestId } = await this.deployMonitorClient.getDeployment({
69
68
  appId,
70
69
  environmentKey,
71
70
  deploymentId
@@ -78,8 +77,8 @@ class ArtifactDeployer {
78
77
  }
79
78
  totalStreamed = events.length;
80
79
  }
81
- if (status === deploy_monitor_graphql_client_1.DeployMonitorStatus.Failed) {
82
- this.handleErrorEvent(errorDetails);
80
+ if (status === cli_shared_1.AppDeploymentStatus.Failed) {
81
+ this.handleErrorEvent(errorDetails, requestId);
83
82
  }
84
83
  return {
85
84
  status,
@@ -88,8 +87,8 @@ class ArtifactDeployer {
88
87
  }
89
88
  async monitorDeployment(appId, environmentKey, deploymentId) {
90
89
  let totalStreamed = 0;
91
- let status = deploy_monitor_graphql_client_1.DeployMonitorStatus.InProgress;
92
- while (status !== deploy_monitor_graphql_client_1.DeployMonitorStatus.Done) {
90
+ let status = cli_shared_1.AppDeploymentStatus.InProgress;
91
+ while (status !== cli_shared_1.AppDeploymentStatus.Done) {
93
92
  const checks = await this.pollAndCheckEvents(appId, environmentKey, deploymentId, totalStreamed);
94
93
  totalStreamed = checks.totalStreamed;
95
94
  status = checks.status;
@@ -140,26 +139,26 @@ class ArtifactDeployer {
140
139
  }
141
140
  };
142
141
  }
143
- handleErrorEvent(errorDetails) {
142
+ handleErrorEvent(errorDetails, requestId) {
144
143
  var _a;
145
144
  if (errorDetails) {
146
145
  const { code, message } = errorDetails;
147
146
  if (code === 'APP_CODE_SNAPSHOT_FAILED') {
148
- throw new AppSnapshotFailedError(true, cli_shared_1.Text.snapshot.error('App code snapshot error', message));
147
+ throw new AppSnapshotFailedError(true, requestId, cli_shared_1.Text.snapshot.error('App code snapshot error', message));
149
148
  }
150
149
  if (code === 'APP_CODE_SNAPSHOT_TIMEOUT') {
151
- throw new AppSnapshotFailedError(false, cli_shared_1.Text.snapshot.timeout);
150
+ throw new AppSnapshotFailedError(false, requestId, cli_shared_1.Text.snapshot.timeout);
152
151
  }
153
152
  if (code === 'ENVIRONMENT_UPDATE_VALIDATION_FAILED') {
154
153
  const causeMessage = (_a = errorDetails === null || errorDetails === void 0 ? void 0 : errorDetails.fields) === null || _a === void 0 ? void 0 : _a.validationResult.message.replace(/Upsert.*Details /, '');
155
154
  if ((causeMessage === null || causeMessage === void 0 ? void 0 : causeMessage.startsWith('Invalid URL')) && causeMessage.includes('EGRESS')) {
156
- throw new AppDeploymentFailedError(true, cli_shared_1.Text.deploy.egressURL.invalidURLError(causeMessage));
155
+ throw new AppDeploymentFailedError(true, requestId, cli_shared_1.Text.deploy.egressURL.invalidURLError(causeMessage));
157
156
  }
158
157
  else if (causeMessage === null || causeMessage === void 0 ? void 0 : causeMessage.startsWith('Egress permission URL')) {
159
- throw new AppDeploymentFailedError(true, cli_shared_1.Text.deploy.egressURL.tooManyURLCharactersError(causeMessage));
158
+ throw new AppDeploymentFailedError(true, requestId, cli_shared_1.Text.deploy.egressURL.tooManyURLCharactersError(causeMessage));
160
159
  }
161
160
  else if (causeMessage === null || causeMessage === void 0 ? void 0 : causeMessage.includes('permission URLs provided, exceeding')) {
162
- throw new AppDeploymentFailedError(true, cli_shared_1.Text.deploy.egressURL.tooManyUrlsError(causeMessage));
161
+ throw new AppDeploymentFailedError(true, requestId, cli_shared_1.Text.deploy.egressURL.tooManyUrlsError(causeMessage));
163
162
  }
164
163
  }
165
164
  if ([
@@ -168,20 +167,20 @@ class ArtifactDeployer {
168
167
  'HOSTED_RESOURCE_FILE_PATH_REFERS_TO_PARENT',
169
168
  'HOSTED_RESOURCE_INVALID_EGRESS_PERMISSIONS'
170
169
  ].includes(code)) {
171
- throw new HostedResourceDeploymentFailedError(true, cli_shared_1.Text.hostedResources.error(message));
170
+ throw new HostedResourceDeploymentFailedError(true, requestId, cli_shared_1.Text.hostedResources.error(message));
172
171
  }
173
172
  if ([
174
173
  'HOSTED_RESOURCE_FAILED_TO_FETCH',
175
174
  'HOSTED_RESOURCE_FAILED_TO_COPY',
176
175
  'HOSTED_RESOURCE_UPLOAD_ID_MISSING'
177
176
  ].includes(code)) {
178
- throw new HostedResourceDeploymentFailedError(false, cli_shared_1.Text.hostedResources.error(message));
177
+ throw new HostedResourceDeploymentFailedError(false, requestId, cli_shared_1.Text.hostedResources.error(message));
179
178
  }
180
179
  if (code === 'HOSTED_RESOURCES_LAMBDA_TIMEOUT') {
181
- throw new HostedResourceDeploymentFailedError(false, cli_shared_1.Text.hostedResources.error(cli_shared_1.Text.hostedResources.lambdaTimeout));
180
+ throw new HostedResourceDeploymentFailedError(false, requestId, cli_shared_1.Text.hostedResources.error(cli_shared_1.Text.hostedResources.lambdaTimeout));
182
181
  }
183
182
  }
184
- throw new AppDeploymentFailedError(false, cli_shared_1.Text.deploy.taskDeploy.serverStepFailed);
183
+ throw new AppDeploymentFailedError(false, requestId, cli_shared_1.Text.deploy.taskDeploy.serverStepFailed);
185
184
  }
186
185
  }
187
186
  exports.ArtifactDeployer = ArtifactDeployer;
@@ -0,0 +1,27 @@
1
+ import { AppConfigProvider } from '@forge/cli-shared';
2
+ export interface DeleteEnvironmentOutput {
3
+ environmentKey: string;
4
+ successful: boolean;
5
+ error?: Error;
6
+ }
7
+ export interface DeleteEnvironmentDetails {
8
+ appId: string;
9
+ environmentKey: string;
10
+ }
11
+ export interface BatchEnvironmentDetails {
12
+ environmentKeys: string[];
13
+ }
14
+ export interface BatchDeleteEnvironmentDetails extends BatchEnvironmentDetails {
15
+ appId: string;
16
+ }
17
+ export interface DeleteEnvironmentClient {
18
+ deleteEnvironment(details: DeleteEnvironmentDetails): Promise<boolean>;
19
+ deleteEnvironments(details: BatchDeleteEnvironmentDetails): Promise<DeleteEnvironmentOutput[]>;
20
+ }
21
+ export declare class DeleteEnvironmentCommand {
22
+ private readonly client;
23
+ private readonly getAppConfig;
24
+ constructor(client: DeleteEnvironmentClient, getAppConfig: AppConfigProvider);
25
+ batchExecute(details: BatchEnvironmentDetails): Promise<DeleteEnvironmentOutput[]>;
26
+ }
27
+ //# sourceMappingURL=delete-environment.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delete-environment.d.ts","sourceRoot":"","sources":["../../src/environment/delete-environment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAEtD,MAAM,WAAW,uBAAuB;IACtC,cAAc,EAAE,MAAM,CAAC;IACvB,UAAU,EAAE,OAAO,CAAC;IACpB,KAAK,CAAC,EAAE,KAAK,CAAC;CACf;AAED,MAAM,WAAW,wBAAwB;IACvC,KAAK,EAAE,MAAM,CAAC;IACd,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,uBAAuB;IACtC,eAAe,EAAE,MAAM,EAAE,CAAC;CAC3B;AAED,MAAM,WAAW,6BAA8B,SAAQ,uBAAuB;IAC5E,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,uBAAuB;IACtC,iBAAiB,CAAC,OAAO,EAAE,wBAAwB,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACvE,kBAAkB,CAAC,OAAO,EAAE,6BAA6B,GAAG,OAAO,CAAC,uBAAuB,EAAE,CAAC,CAAC;CAChG;AAED,qBAAa,wBAAwB;IACvB,OAAO,CAAC,QAAQ,CAAC,MAAM;IAA2B,OAAO,CAAC,QAAQ,CAAC,YAAY;gBAA9D,MAAM,EAAE,uBAAuB,EAAmB,YAAY,EAAE,iBAAiB;IAEjG,YAAY,CAAC,OAAO,EAAE,uBAAuB;CAO3D"}