@forge/cli 0.0.0-experimental-819498d → 0.0.0-experimental-3b4aabe

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 (122) hide show
  1. package/CHANGELOG.md +2889 -7
  2. package/README.md +18 -19
  3. package/npm-shrinkwrap.json +3036 -3598
  4. package/out/autocomplete/autocomplete-config.json +16 -26
  5. package/out/bin/cli.js +0 -2
  6. package/out/bin/postinstall.js +1 -1
  7. package/out/command-line/anon-user-id.js +6 -10
  8. package/out/command-line/command.d.ts +7 -1
  9. package/out/command-line/command.d.ts.map +1 -1
  10. package/out/command-line/command.js +39 -9
  11. package/out/command-line/controller/deploy-controller.d.ts +13 -2
  12. package/out/command-line/controller/deploy-controller.d.ts.map +1 -1
  13. package/out/command-line/controller/deploy-controller.js +67 -5
  14. package/out/command-line/controller/install-controller.d.ts +2 -1
  15. package/out/command-line/controller/install-controller.d.ts.map +1 -1
  16. package/out/command-line/controller/install-controller.js +28 -32
  17. package/out/command-line/controller/lint-controller.js +1 -1
  18. package/out/command-line/controller/pre-command-controller.js +1 -1
  19. package/out/command-line/controller/prerequisites-controller.d.ts +11 -0
  20. package/out/command-line/controller/prerequisites-controller.d.ts.map +1 -0
  21. package/out/command-line/controller/prerequisites-controller.js +34 -0
  22. package/out/command-line/controller/stubController.d.ts +9 -0
  23. package/out/command-line/controller/stubController.d.ts.map +1 -0
  24. package/out/command-line/controller/stubController.js +15 -0
  25. package/out/command-line/dependency-injection.d.ts +11 -3
  26. package/out/command-line/dependency-injection.d.ts.map +1 -1
  27. package/out/command-line/dependency-injection.js +34 -17
  28. package/out/command-line/index.d.ts.map +1 -1
  29. package/out/command-line/index.js +4 -0
  30. package/out/command-line/register-app-commands.d.ts.map +1 -1
  31. package/out/command-line/register-app-commands.js +1 -9
  32. package/out/command-line/register-authentication-command.d.ts.map +1 -1
  33. package/out/command-line/register-authentication-command.js +0 -16
  34. package/out/command-line/register-deployment-commands.d.ts +8 -0
  35. package/out/command-line/register-deployment-commands.d.ts.map +1 -1
  36. package/out/command-line/register-environment-variables-commands.d.ts +1 -1
  37. package/out/command-line/register-environment-variables-commands.d.ts.map +1 -1
  38. package/out/command-line/register-environment-variables-commands.js +22 -7
  39. package/out/command-line/register-installation-commands.d.ts +1 -1
  40. package/out/command-line/register-installation-commands.d.ts.map +1 -1
  41. package/out/command-line/register-installation-commands.js +19 -13
  42. package/out/command-line/register-providers-commands.d.ts +3 -0
  43. package/out/command-line/register-providers-commands.d.ts.map +1 -0
  44. package/out/command-line/register-providers-commands.js +43 -0
  45. package/out/command-line/register-webtrigger-commands.d.ts.map +1 -1
  46. package/out/command-line/register-webtrigger-commands.js +9 -11
  47. package/out/command-line/unique-machine-id.d.ts.map +1 -1
  48. package/out/command-line/unique-machine-id.js +1 -10
  49. package/out/command-line/version-info.d.ts +1 -0
  50. package/out/command-line/version-info.d.ts.map +1 -1
  51. package/out/command-line/version-info.js +3 -2
  52. package/out/command-line/view/deploy-view.d.ts +7 -1
  53. package/out/command-line/view/deploy-view.d.ts.map +1 -1
  54. package/out/command-line/view/deploy-view.js +21 -3
  55. package/out/command-line/view/install-view.d.ts +5 -5
  56. package/out/command-line/view/install-view.d.ts.map +1 -1
  57. package/out/command-line/view/install-view.js +20 -15
  58. package/out/command-line/view/lint-view.d.ts +3 -2
  59. package/out/command-line/view/lint-view.d.ts.map +1 -1
  60. package/out/command-line/view/lint-view.js +3 -0
  61. package/out/command-line/view/lite-lint-view.d.ts +3 -2
  62. package/out/command-line/view/lite-lint-view.d.ts.map +1 -1
  63. package/out/command-line/view/lite-lint-view.js +3 -0
  64. package/out/deploy/deployer/deploy-monitor-graphql-client.js +1 -1
  65. package/out/deploy/deployer/trigger-deploy-graphql-client.js +1 -1
  66. package/out/deploy/packager/archiver.d.ts +3 -2
  67. package/out/deploy/packager/archiver.d.ts.map +1 -1
  68. package/out/deploy/packager/archiver.js +10 -2
  69. package/out/deploy/packager/packager.d.ts.map +1 -1
  70. package/out/deploy/packager/packager.js +20 -20
  71. package/out/deploy/uploader/artifact-graphql-client.js +2 -2
  72. package/out/environment-variables/graphql-client.d.ts +1 -1
  73. package/out/environment-variables/graphql-client.js +3 -3
  74. package/out/installations/graphql-client.d.ts +7 -8
  75. package/out/installations/graphql-client.d.ts.map +1 -1
  76. package/out/installations/graphql-client.js +70 -32
  77. package/out/installations/install-app-site.d.ts +2 -8
  78. package/out/installations/install-app-site.d.ts.map +1 -1
  79. package/out/installations/install-app-site.js +2 -3
  80. package/out/installations/uninstall-app.d.ts +0 -1
  81. package/out/installations/uninstall-app.d.ts.map +1 -1
  82. package/out/installations/uninstall-app.js +2 -4
  83. package/out/migration-keys/graphql-client.d.ts +8 -0
  84. package/out/migration-keys/graphql-client.d.ts.map +1 -0
  85. package/out/migration-keys/graphql-client.js +55 -0
  86. package/out/providers/configure-provider.d.ts +19 -0
  87. package/out/providers/configure-provider.d.ts.map +1 -0
  88. package/out/providers/configure-provider.js +14 -0
  89. package/out/providers/graphql-client.d.ts +12 -0
  90. package/out/providers/graphql-client.d.ts.map +1 -0
  91. package/out/providers/graphql-client.js +47 -0
  92. package/out/service/installation-service.d.ts +13 -11
  93. package/out/service/installation-service.d.ts.map +1 -1
  94. package/out/service/installation-service.js +38 -13
  95. package/out/service/lint-service.d.ts +2 -2
  96. package/out/service/lint-service.d.ts.map +1 -1
  97. package/out/service/lint-service.js +2 -2
  98. package/out/service/lite-lint-service.d.ts +3 -3
  99. package/out/service/lite-lint-service.d.ts.map +1 -1
  100. package/out/service/lite-lint-service.js +2 -2
  101. package/out/service/migration-keys-service.d.ts +19 -0
  102. package/out/service/migration-keys-service.d.ts.map +1 -0
  103. package/out/service/migration-keys-service.js +14 -0
  104. package/out/service/resource-packaging-service.d.ts +3 -2
  105. package/out/service/resource-packaging-service.d.ts.map +1 -1
  106. package/out/service/resource-packaging-service.js +6 -2
  107. package/out/service/tunnel-service.d.ts.map +1 -1
  108. package/out/service/tunnel-service.js +6 -4
  109. package/out/webtrigger/get-webtrigger-url.d.ts +10 -4
  110. package/out/webtrigger/get-webtrigger-url.d.ts.map +1 -1
  111. package/out/webtrigger/get-webtrigger-url.js +11 -18
  112. package/out/webtrigger/graphql-client.d.ts +14 -0
  113. package/out/webtrigger/graphql-client.d.ts.map +1 -0
  114. package/out/webtrigger/graphql-client.js +52 -0
  115. package/out/workers/forge-cli-workers.js +1 -1
  116. package/package.json +14 -13
  117. package/out/bin/preinstall.d.ts +0 -3
  118. package/out/bin/preinstall.d.ts.map +0 -1
  119. package/out/bin/preinstall.js +0 -9
  120. package/out/command-line/cli-prerequisites.d.ts +0 -3
  121. package/out/command-line/cli-prerequisites.d.ts.map +0 -1
  122. package/out/command-line/cli-prerequisites.js +0 -37
@@ -32,9 +32,6 @@
32
32
  "--environment": {
33
33
  "requireUserArg": true
34
34
  },
35
- "--non-interactive": {
36
- "requireUserArg": false
37
- },
38
35
  "--help": {
39
36
  "requireUserArg": false
40
37
  }
@@ -102,17 +99,6 @@
102
99
  "--token": {
103
100
  "requireUserArg": true
104
101
  },
105
- "--non-interactive": {
106
- "requireUserArg": false
107
- },
108
- "--help": {
109
- "requireUserArg": false
110
- }
111
- },
112
- "login:ci": {
113
- "--verbose": {
114
- "requireUserArg": false
115
- },
116
102
  "--help": {
117
103
  "requireUserArg": false
118
104
  }
@@ -148,6 +134,14 @@
148
134
  "requireUserArg": false
149
135
  }
150
136
  },
137
+ "providers": {
138
+ "--verbose": {
139
+ "requireUserArg": false
140
+ },
141
+ "--help": {
142
+ "requireUserArg": false
143
+ }
144
+ },
151
145
  "register": {
152
146
  "--verbose": {
153
147
  "requireUserArg": false
@@ -183,26 +177,25 @@
183
177
  "requireUserArg": false
184
178
  }
185
179
  },
186
- "variables:list": {
180
+ "variables": {
187
181
  "--verbose": {
188
182
  "requireUserArg": false
189
183
  },
190
- "--environment": {
191
- "requireUserArg": true
192
- },
193
184
  "--help": {
194
185
  "requireUserArg": false
195
186
  }
196
187
  },
197
- "variables:set": {
188
+ "variables:list": {
198
189
  "--verbose": {
199
190
  "requireUserArg": false
200
191
  },
201
- "--encrypt": {
192
+ "--help": {
193
+ "requireUserArg": false
194
+ }
195
+ },
196
+ "variables:set": {
197
+ "--verbose": {
202
198
  "requireUserArg": false
203
- },
204
- "--environment": {
205
- "requireUserArg": true
206
199
  },
207
200
  "--help": {
208
201
  "requireUserArg": false
@@ -212,9 +205,6 @@
212
205
  "--verbose": {
213
206
  "requireUserArg": false
214
207
  },
215
- "--environment": {
216
- "requireUserArg": true
217
- },
218
208
  "--help": {
219
209
  "requireUserArg": false
220
210
  }
package/out/bin/cli.js CHANGED
@@ -3,6 +3,4 @@
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  require("../autocomplete");
5
5
  const command_line_1 = require("../command-line");
6
- const cli_prerequisites_1 = require("../command-line/cli-prerequisites");
7
- cli_prerequisites_1.checkNodeVersion();
8
6
  command_line_1.main();
@@ -10,7 +10,7 @@ const isSupportedShell_1 = require("../autocomplete/isSupportedShell");
10
10
  const unique_machine_id_1 = require("../command-line/unique-machine-id");
11
11
  const cached_config_service_1 = require("../service/cached-config-service");
12
12
  const ui = new cli_shared_1.CommandLineUI(() => true);
13
- const cachedConf = new cli_shared_1.CachedConf(unique_machine_id_1.FORGE_CLI_PACKAGE);
13
+ const cachedConf = cli_shared_1.CachedConf.getCache(unique_machine_id_1.FORGE_CLI_PACKAGE);
14
14
  const configService = new cached_config_service_1.CachedConfigService(cachedConf);
15
15
  const analyticsClientReporter = new analytics_client_1.AnalyticsClientReporter(new local_file_storage_1.LocalFileStorage(), ui, configService);
16
16
  const cliDetails = version_info_1.getCLIDetails();
@@ -7,15 +7,11 @@ const cli_shared_1 = require("@forge/cli-shared");
7
7
  const ANON_ID_CACHE_KEY = 'anonId';
8
8
  function getAnonId(createNew = false) {
9
9
  const cachedConf = cli_shared_1.CachedConf.getCache('@forge/cli');
10
- const storedAnonId = cachedConf.get(ANON_ID_CACHE_KEY);
11
- if (storedAnonId) {
12
- return storedAnonId;
13
- }
14
- if (!createNew) {
15
- return undefined;
16
- }
17
- const generatedAnonId = uuid_1.default();
18
- cachedConf.set(ANON_ID_CACHE_KEY, generatedAnonId);
19
- return generatedAnonId;
10
+ return cachedConf.cached(ANON_ID_CACHE_KEY, () => {
11
+ if (!createNew) {
12
+ return undefined;
13
+ }
14
+ return uuid_1.default();
15
+ });
20
16
  }
21
17
  exports.getAnonId = getAnonId;
@@ -4,6 +4,7 @@ import { PersonalApiCredentialsValidated } from '@forge/cli-shared';
4
4
  import { UI } from '@forge/cli-shared';
5
5
  import { CLIDetails } from '@forge/cli-shared';
6
6
  import { PreCommandController } from './controller/pre-command-controller';
7
+ import { StubController } from './controller/stubController';
7
8
  declare type PreconditionCallback = (...args: any[]) => any;
8
9
  declare type ActionResult = Promise<{
9
10
  creds?: PersonalApiCredentialsValidated;
@@ -38,9 +39,12 @@ export declare class Command {
38
39
  private requiresAnalyticsConsent;
39
40
  private requiredOptionFlags;
40
41
  private preconditionFn;
42
+ private options;
43
+ private commands;
41
44
  constructor(ui: UI, analyticsClient: AnalyticsClientReporter, preCommandController: PreCommandController, cliDetails: CLIDetails | undefined, cmd?: commander.Command, expectsArguments?: boolean, analyticsName?: string | undefined);
42
45
  version(str: string, flags?: string): this;
43
- command(name: string): Command;
46
+ command(name: string, opts?: commander.CommandOptions): Command;
47
+ deprecatedCommand(oldName: string, newName: string, stubController: StubController): void;
44
48
  getAnalyticsName(): string | undefined;
45
49
  deprecate(newCommand: string): this;
46
50
  description(desc: string): this;
@@ -55,6 +59,8 @@ export declare class Command {
55
59
  exitOverride: (listener: (err: any) => void) => this;
56
60
  getDefinedCommands(): commander.Command[];
57
61
  getDefinedOptions(): commander.Option[];
62
+ getCmdName(): string;
63
+ getCommands(): Command[];
58
64
  environmentOption(): this;
59
65
  siteAndProductOption(): this;
60
66
  requireNoAuthentication(): this;
@@ -1 +1 @@
1
- {"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../src/command-line/command.ts"],"names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YAAY,CAAC,EAAE,GAAG,GACjB,IAAI;IAgBA,YAAY,CAAC,EAAE,EAAE,oBAAoB,GAAG,IAAI;IAK5C,mBAAmB,IAAI,IAAI;IAK3B,YAAY,IAAI,IAAI;IAKpB,oBAAoB,CAAC,GAAG,IAAI,EAAE,MAAM,EAAE,GAAG,IAAI;IAM7C,MAAM,CAAC,EAAE,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,YAAY,GAAG,IAAI;IAK5C,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,SAAS,CAAC;IA0B/C,YAAY,mBAAoB,GAAG,KAAK,IAAI,KAAG,IAAI,CAGxD;IAEK,kBAAkB,IAAI,SAAS,CAAC,OAAO,EAAE;IAIzC,iBAAiB,IAAI,SAAS,CAAC,MAAM,EAAE;IAIvC,UAAU,IAAI,MAAM;IAIpB,WAAW,IAAI,OAAO,EAAE;IAMxB,iBAAiB,IAAI,IAAI;IAazB,oBAAoB,IAAI,IAAI;IAW5B,uBAAuB,IAAI,IAAI;IAK/B,yBAAyB,IAAI,IAAI;IAKxC,OAAO,CAAC,8BAA8B;IAW/B,eAAe,mBAA0B,GAAG,EAAE,4BAA4B,GAAG,EAAE,mBA+DpF;IAEK,eAAe,CAAC,GAAG,EAAE,mBAAmB,GAAG,IAAI;YAKxC,kBAAkB;YAUlB,mBAAmB;IASjC,OAAO,CAAC,YAAY;YAgBN,eAAe;IAmB7B,OAAO,CAAC,oBAAoB;IAyB5B,OAAO,CAAC,kBAAkB,CAExB;IAEF,OAAO,CAAC,cAAc;IAwCtB,OAAO,CAAC,eAAe;CAyBxB"}
@@ -36,6 +36,8 @@ class Command {
36
36
  this.requiresAnalyticsConsent = true;
37
37
  this.requiredOptionFlags = [];
38
38
  this.preconditionFn = [];
39
+ this.options = [];
40
+ this.commands = [];
39
41
  this.exitOverride = (listener) => {
40
42
  this.cmd.exitOverride((err) => listener(err));
41
43
  return this;
@@ -104,22 +106,32 @@ class Command {
104
106
  }
105
107
  version(str, flags) {
106
108
  this.cmd.version(str, flags);
109
+ flags = flags || '-V, --version';
110
+ const versionOption = new commander_1.Option(flags, 'output the version number');
111
+ this.options.push(versionOption);
107
112
  return this;
108
113
  }
109
- command(name) {
114
+ command(name, opts) {
110
115
  const cmd = this.cmd
111
- .command(name)
116
+ .command(name, opts)
112
117
  .allowUnknownOption(false)
113
- .allowExcessArguments(false)
114
- .option('--verbose', cli_shared_3.Text.optionVerbose);
118
+ .allowExcessArguments(false);
115
119
  const trimmedName = name.trim();
116
120
  const expectsArguments = trimmedName.endsWith(']') || trimmedName.endsWith('>');
117
121
  const subCommand = new Command(this.ui, this.analyticsClient, this.preCommandController, this.cliDetails, cmd, expectsArguments, Command.concatenateNames(this.analyticsName, cmd.name()));
122
+ subCommand.option('--verbose', cli_shared_3.Text.optionVerbose);
118
123
  subCommand.exitOverride((err) => {
119
124
  throw new WrapperError(err, subCommand.cmd.name());
120
125
  });
126
+ this.commands.push(subCommand);
121
127
  return subCommand;
122
128
  }
129
+ deprecatedCommand(oldName, newName, stubController) {
130
+ this.command(oldName, { hidden: true })
131
+ .requireNoAuthentication()
132
+ .requireNoAnalyticsConsent()
133
+ .action(() => stubController.run({ oldName, newName }));
134
+ }
123
135
  getAnalyticsName() {
124
136
  return this.analyticsName;
125
137
  }
@@ -133,6 +145,14 @@ class Command {
133
145
  }
134
146
  option(flags, description, fn, defaultValue) {
135
147
  this.cmd.option(flags, description, fn, defaultValue);
148
+ const option = new commander_1.Option(flags, description);
149
+ if (typeof fn === 'function') {
150
+ option.default(defaultValue).argParser(fn);
151
+ }
152
+ else {
153
+ option.default(fn);
154
+ }
155
+ this.options.push(option);
136
156
  return this;
137
157
  }
138
158
  precondition(fn) {
@@ -182,10 +202,16 @@ class Command {
182
202
  return this.cmd.commands;
183
203
  }
184
204
  getDefinedOptions() {
185
- return this.cmd.options;
205
+ return this.options;
206
+ }
207
+ getCmdName() {
208
+ return this.cmd.name();
209
+ }
210
+ getCommands() {
211
+ return this.commands;
186
212
  }
187
213
  environmentOption() {
188
- this.cmd.option('-e, --environment [environment]', cli_shared_3.Text.env.option(cli_shared_2.DEFAULT_ENVIRONMENT_OPTION, cli_shared_2.VALID_ENVIRONMENT_OPTIONS));
214
+ this.option('-e, --environment [environment]', cli_shared_3.Text.env.option(cli_shared_2.DEFAULT_ENVIRONMENT_OPTION, cli_shared_2.VALID_ENVIRONMENT_OPTIONS));
189
215
  this.precondition(() => {
190
216
  this.cmd.opts().environment = environment_1.checkEnvironmentOption(this.cmd.opts().environment || cli_shared_2.DEFAULT_ENVIRONMENT_OPTION);
191
217
  return { appEnv: this.cmd.opts().environment };
@@ -193,8 +219,8 @@ class Command {
193
219
  return this;
194
220
  }
195
221
  siteAndProductOption() {
196
- this.cmd.option('-s, --site [site]', cli_shared_3.Text.optionSite);
197
- this.cmd.option('-p, --product [product]', cli_shared_3.Text.optionProduct(cli_shared_2.SUPPORTED_PRODUCTS));
222
+ this.option('-s, --site [site]', cli_shared_3.Text.optionSite);
223
+ this.option('-p, --product [product]', cli_shared_3.Text.optionProduct(cli_shared_2.SUPPORTED_PRODUCTS));
198
224
  this.precondition(() => {
199
225
  return this.validateContext();
200
226
  });
@@ -283,7 +309,11 @@ class Command {
283
309
  const { command: lastCommand, index: lastCommandIndex } = this.findLastValidCommand(argv);
284
310
  const badLastArg = argv[lastCommandIndex + 1];
285
311
  const suggestionService = new command_suggestion_service_1.default();
286
- const suggestions = suggestionService.getSuggestions(badLastArg, lastCommand.commands.map((cmd) => cmd.name()));
312
+ const suggestions = suggestionService.getSuggestions(badLastArg, lastCommand.commands
313
+ .filter((cmd) => {
314
+ return cmd._hidden !== true;
315
+ })
316
+ .map((cmd) => cmd.name()));
287
317
  errorMessage.push(cli_shared_3.Text.invalidCmd(argv.slice(2, lastCommandIndex + 2).join(' ')));
288
318
  if (suggestions.length) {
289
319
  errorMessage.push(`Did you mean:`);
@@ -2,6 +2,7 @@ import { AppConfigProvider, ConfigFile, HiddenError } from '@forge/cli-shared';
2
2
  import { LintService } from '../../service/lint-service';
3
3
  import { DeployView } from '../view/deploy-view';
4
4
  import { InstallationService } from '../../service/installation-service';
5
+ import { MigrationKeysService } from '../../service/migration-keys-service';
5
6
  import { ResourcePackagingService } from '../../service/resource-packaging-service';
6
7
  import { ErrorWithAnalytics } from '../command';
7
8
  import { PackageUploadDeployCommand } from '../../deploy';
@@ -15,18 +16,28 @@ export declare class DeployLintFailureError extends HiddenError implements Error
15
16
  constructor(scopes: string[]);
16
17
  getAttributes(): Record<string, string[]>;
17
18
  }
19
+ export declare class InvalidConnectKeyError extends HiddenError implements ErrorWithAnalytics {
20
+ private readonly reason;
21
+ constructor(reason: string);
22
+ getAttributes(): Record<string, string>;
23
+ }
18
24
  export declare class DeployController {
19
25
  private readonly appConfigProvider;
20
26
  private readonly configFile;
21
27
  private readonly lintService;
22
28
  private readonly installationsService;
29
+ private readonly migrationKeysService;
23
30
  private readonly deployView;
24
31
  private readonly packageUploadDeployCommand;
25
32
  private readonly resourcePackagingService;
26
- constructor(appConfigProvider: AppConfigProvider, configFile: ConfigFile, lintService: LintService, installationsService: InstallationService, deployView: DeployView, packageUploadDeployCommand: PackageUploadDeployCommand, resourcePackagingService: ResourcePackagingService);
33
+ constructor(appConfigProvider: AppConfigProvider, configFile: ConfigFile, lintService: LintService, installationsService: InstallationService, migrationKeysService: MigrationKeysService, deployView: DeployView, packageUploadDeployCommand: PackageUploadDeployCommand, resourcePackagingService: ResourcePackagingService);
34
+ private isMpacProductionApp;
35
+ private connectKeyDeleted;
36
+ private connectKeyChanged;
37
+ private validateConnectKeyChange;
27
38
  private verifyPreDeployment;
28
39
  private verifyPostDeployment;
29
- run({ environment, verify }: DeployOptions): Promise<DeploymentResult>;
40
+ run({ environment, verify }: DeployOptions): Promise<DeploymentResult | void>;
30
41
  }
31
42
  export {};
32
43
  //# sourceMappingURL=deploy-controller.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"deploy-controller.d.ts","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AC,iBAAiB;IAClC,OAAO,CAAC,QAAQ,CAAC,UAAU;IAC3B,OAAO,CAAC,QAAQ,CAAC,WAAW;IAC5B,OAAO,CAAC,QAAQ,CAAC,oBAAoB;IACrC,OAAO,CAAC,QAAQ,CAAC,oBAAoB;IACrC,OAAO,CAAC,QAAQ,CAAC,UAAU;IAC3B,OAAO,CAAC,QAAQ,CAAC,0BAA0B;IAC3C,OAAO,CAAC,QAAQ,CAAC,wBAAwB;gBAPxB,iBAAiB,EAAE,iBAAiB,EACpC,UAAU,EAAE,UAAU,EACtB,WAAW,EAAE,WAAW,EACxB,oBAAoB,EAAE,mBAAmB,EACzC,oBAAoB,EAAE,oBAAoB,EAC1C,UAAU,EAAE,UAAU,EACtB,0BAA0B,EAAE,0BAA0B,EACtD,wBAAwB,EAAE,wBAAwB;IAGrE,OAAO,CAAC,mBAAmB;IAI3B,OAAO,CAAC,iBAAiB;IAIzB,OAAO,CAAC,iBAAiB;YAGX,wBAAwB;YAwBxB,mBAAmB;YAiBnB,oBAAoB;IAOrB,GAAG,CAAC,EAAE,WAAW,EAAE,MAAM,EAAE,EAAE,aAAa,GAAG,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC;CAsD3F"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DeployController = exports.DeployLintFailureError = void 0;
3
+ exports.DeployController = exports.InvalidConnectKeyError = exports.DeployLintFailureError = void 0;
4
4
  const cli_shared_1 = require("@forge/cli-shared");
5
5
  class DeployLintFailureError extends cli_shared_1.HiddenError {
6
6
  constructor(scopes) {
@@ -14,19 +14,62 @@ class DeployLintFailureError extends cli_shared_1.HiddenError {
14
14
  }
15
15
  }
16
16
  exports.DeployLintFailureError = DeployLintFailureError;
17
+ class InvalidConnectKeyError extends cli_shared_1.HiddenError {
18
+ constructor(reason) {
19
+ super();
20
+ this.reason = reason;
21
+ }
22
+ getAttributes() {
23
+ return {
24
+ reason: this.reason
25
+ };
26
+ }
27
+ }
28
+ exports.InvalidConnectKeyError = InvalidConnectKeyError;
17
29
  class DeployController {
18
- constructor(appConfigProvider, configFile, lintService, installationsService, deployView, packageUploadDeployCommand, resourcePackagingService) {
30
+ constructor(appConfigProvider, configFile, lintService, installationsService, migrationKeysService, deployView, packageUploadDeployCommand, resourcePackagingService) {
19
31
  this.appConfigProvider = appConfigProvider;
20
32
  this.configFile = configFile;
21
33
  this.lintService = lintService;
22
34
  this.installationsService = installationsService;
35
+ this.migrationKeysService = migrationKeysService;
23
36
  this.deployView = deployView;
24
37
  this.packageUploadDeployCommand = packageUploadDeployCommand;
25
38
  this.resourcePackagingService = resourcePackagingService;
26
39
  }
40
+ isMpacProductionApp(mpacAppKey, environment) {
41
+ return !!(mpacAppKey && environment === 'production');
42
+ }
43
+ connectKeyDeleted(connectKey, comparisonKey) {
44
+ return !!(!connectKey && comparisonKey);
45
+ }
46
+ connectKeyChanged(connectKey, comparisonKey) {
47
+ return !!(comparisonKey && connectKey && connectKey !== comparisonKey);
48
+ }
49
+ async validateConnectKeyChange(environment, keys) {
50
+ const { migrationKeys, mpacAppKey } = keys;
51
+ const connectKey = await this.configFile.getConnectKey();
52
+ const migrationKey = (migrationKeys === null || migrationKeys === void 0 ? void 0 : migrationKeys.confluence) || (migrationKeys === null || migrationKeys === void 0 ? void 0 : migrationKeys.jira);
53
+ const isMpacApp = this.isMpacProductionApp(mpacAppKey, environment);
54
+ if (this.connectKeyDeleted(connectKey, migrationKey)) {
55
+ this.deployView.displayConnectKeyDeleteWarning(environment);
56
+ const proceed = await this.deployView.promptToContinueDeletingConnectKey();
57
+ return { proceed, connectKeyDeleted: proceed, connectKeyChanged: false };
58
+ }
59
+ else if (isMpacApp && this.connectKeyChanged(connectKey, mpacAppKey)) {
60
+ this.deployView.displayMPACAppConnectKeyChangeError(mpacAppKey, connectKey);
61
+ throw new InvalidConnectKeyError(cli_shared_1.Text.deploy.connectKeyChange.mpacAppConnectKeyChangeAnalyticsError);
62
+ }
63
+ else if (!isMpacApp && this.connectKeyChanged(connectKey, migrationKey)) {
64
+ this.deployView.displayConnectKeyChangeWarning(environment, migrationKey, connectKey);
65
+ const proceed = await this.deployView.promptToContinueChangingConnectKey();
66
+ return { proceed, connectKeyChanged: proceed, connectKeyDeleted: false };
67
+ }
68
+ return { proceed: true, connectKeyChanged: false, connectKeyDeleted: false };
69
+ }
27
70
  async verifyPreDeployment(environment) {
28
71
  this.deployView.displayLintRunning();
29
- const { lintResults } = await this.lintService.run(environment, { fix: false });
72
+ const { lintResults } = await this.lintService.run(environment, { fix: false }, this.deployView.getLogger());
30
73
  const problemCount = this.lintService.problemCount(lintResults);
31
74
  if (problemCount.errors) {
32
75
  this.deployView.displayLintErrors(lintResults);
@@ -48,10 +91,19 @@ class DeployController {
48
91
  }
49
92
  async run({ environment, verify }) {
50
93
  this.deployView.displayStart(environment);
94
+ let hasConnectKeyChanged = false;
95
+ let hasConnectKeyDeleted = false;
51
96
  if (verify) {
52
97
  await this.verifyPreDeployment(environment);
98
+ const keys = await this.migrationKeysService.getMigrationKeysForAppEnvironment(environment);
99
+ const { proceed, connectKeyChanged, connectKeyDeleted } = await this.validateConnectKeyChange(environment, keys);
100
+ if (!proceed) {
101
+ return;
102
+ }
103
+ hasConnectKeyChanged = connectKeyChanged;
104
+ hasConnectKeyDeleted = connectKeyDeleted;
53
105
  }
54
- const { name, id } = await this.appConfigProvider();
106
+ const { id } = await this.appConfigProvider();
55
107
  const handlers = await this.configFile.getAppHandlers();
56
108
  const resources = await this.configFile.getResources();
57
109
  const archives = await this.resourcePackagingService.zipResources(resources);
@@ -67,10 +119,20 @@ class DeployController {
67
119
  throw err;
68
120
  }
69
121
  }
70
- const analytics = await this.deployView.reportDeploymentProgress(id, name, environment, hasProdInstallations, () => this.packageUploadDeployCommand.execute({ handlers, environmentKey: environment, archives }));
122
+ const analytics = await this.deployView.reportDeploymentProgress(id, environment, hasProdInstallations, () => this.packageUploadDeployCommand.execute({ handlers, environmentKey: environment, archives }));
71
123
  if (verify) {
72
124
  await this.verifyPostDeployment(environment);
73
125
  }
126
+ try {
127
+ analytics.analytics.egressPermissionList = await this.configFile.getEgressPermissions();
128
+ analytics.analytics.connectKey = hasConnectKeyChanged
129
+ ? { action: 'changed', value: await this.configFile.getConnectKey() }
130
+ : hasConnectKeyDeleted
131
+ ? { action: 'deleted' }
132
+ : {};
133
+ }
134
+ catch (e) {
135
+ }
74
136
  return analytics;
75
137
  }
76
138
  }
@@ -9,6 +9,7 @@ interface InstallViewProps {
9
9
  site?: URL;
10
10
  product?: string;
11
11
  upgrade: boolean;
12
+ nonInteractive?: boolean;
12
13
  confirmScopes: boolean;
13
14
  }
14
15
  export declare class NoDeploymentError extends Error {
@@ -28,7 +29,7 @@ export declare class InstallController {
28
29
  private promptForSite;
29
30
  private promptForUpgrade;
30
31
  private getUniqueInstallationProductsFromScopes;
31
- run({ environment, site, product, upgrade, confirmScopes }: InstallViewProps): Promise<void>;
32
+ run({ environment, site, product, upgrade, confirmScopes, nonInteractive }: InstallViewProps): Promise<void>;
32
33
  }
33
34
  export {};
34
35
  //# sourceMappingURL=install-controller.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"install-controller.d.ts","sourceRoot":"","sources":["../../../src/command-line/controller/install-controller.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,iBAAiB,EACjB,UAAU,EAEV,EAAE,EAQH,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAC1B,OAAO,EAAE,qBAAqB,EAAsB,MAAM,sCAAsC,CAAC;AACjG,OAAO,EAAE,mBAAmB,EAA2C,MAAM,oCAAoC,CAAC;AAClH,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEnD,UAAU,gBAAgB;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,GAAG,CAAC;IACX,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;IACjB,aAAa,EAAE,OAAO,CAAC;CACxB;AAkBD,qBAAa,iBAAkB,SAAQ,KAAK;gBAC9B,WAAW,EAAE,MAAM;CAGhC;AAgBD,qBAAa,iBAAiB;IAE1B,OAAO,CAAC,QAAQ,CAAC,iBAAiB;IAClC,OAAO,CAAC,QAAQ,CAAC,UAAU;IAC3B,OAAO,CAAC,QAAQ,CAAC,EAAE;IACnB,OAAO,CAAC,QAAQ,CAAC,qBAAqB;IACtC,OAAO,CAAC,QAAQ,CAAC,mBAAmB;IACpC,OAAO,CAAC,QAAQ,CAAC,WAAW;gBALX,iBAAiB,EAAE,iBAAiB,EACpC,UAAU,EAAE,UAAU,EACtB,EAAE,EAAE,EAAE,EACN,qBAAqB,EAAE,qBAAqB,EAC5C,mBAAmB,EAAE,mBAAmB,EACxC,WAAW,EAAE,WAAW;YAG7B,cAAc;YAmBd,gBAAgB;YAqChB,gBAAgB;YAKhB,aAAa;YAWb,gBAAgB;IAoB9B,OAAO,CAAC,uCAAuC;IAalC,GAAG,CAAC,EAAE,WAAW,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC;CA6E1G"}
1
+ {"version":3,"file":"install-controller.d.ts","sourceRoot":"","sources":["../../../src/command-line/controller/install-controller.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,iBAAiB,EACjB,UAAU,EAEV,EAAE,EASH,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAC1B,OAAO,EAAE,qBAAqB,EAAE,MAAM,sCAAsC,CAAC;AAC7E,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEnD,UAAU,gBAAgB;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,GAAG,CAAC;IACX,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;IACjB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,aAAa,EAAE,OAAO,CAAC;CACxB;AAiBD,qBAAa,iBAAkB,SAAQ,KAAK;gBAC9B,WAAW,EAAE,MAAM;CAGhC;AAQD,qBAAa,iBAAiB;IAE1B,OAAO,CAAC,QAAQ,CAAC,iBAAiB;IAClC,OAAO,CAAC,QAAQ,CAAC,UAAU;IAC3B,OAAO,CAAC,QAAQ,CAAC,EAAE;IACnB,OAAO,CAAC,QAAQ,CAAC,qBAAqB;IACtC,OAAO,CAAC,QAAQ,CAAC,mBAAmB;IACpC,OAAO,CAAC,QAAQ,CAAC,WAAW;gBALX,iBAAiB,EAAE,iBAAiB,EACpC,UAAU,EAAE,UAAU,EACtB,EAAE,EAAE,EAAE,EACN,qBAAqB,EAAE,qBAAqB,EAC5C,mBAAmB,EAAE,mBAAmB,EACxC,WAAW,EAAE,WAAW;YAG7B,cAAc;YAmBd,gBAAgB;YAsChB,gBAAgB;YAKhB,aAAa;YAWb,gBAAgB;IAoB9B,OAAO,CAAC,uCAAuC;IAalC,GAAG,CAAC,EACf,WAAW,EACX,IAAI,EACJ,OAAO,EACP,OAAO,EACP,aAAa,EACb,cAAc,EACf,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC;CAuFpC"}
@@ -8,12 +8,6 @@ class NoDeploymentError extends Error {
8
8
  }
9
9
  }
10
10
  exports.NoDeploymentError = NoDeploymentError;
11
- const isInstallationResult = (result) => {
12
- return !!result.installationId;
13
- };
14
- const isAlreadyUpgradedResult = (result) => {
15
- return result.alreadyUpdated === true;
16
- };
17
11
  class InstallController {
18
12
  constructor(appConfigProvider, configFile, ui, installAppSiteCommand, installationService, installView) {
19
13
  this.appConfigProvider = appConfigProvider;
@@ -39,30 +33,26 @@ class InstallController {
39
33
  }
40
34
  }
41
35
  }
42
- async installOrUpgrade(upgrade, environment, site, product, name, appId, text) {
36
+ async installOrUpgrade(upgrade, environment, site, product, appId, text) {
43
37
  return this.ui.displayProgress(async () => {
44
38
  if (upgrade) {
45
- return await this.installationService.upgradeInstallation(site, product, environment, appId);
39
+ const isAlreadyUpdated = await this.installationService.upgradeInstallation(site, product, environment, appId);
40
+ return isAlreadyUpdated;
46
41
  }
47
42
  else {
48
- return await this.installAppSiteCommand.execute({
43
+ await this.installAppSiteCommand.execute({
49
44
  environmentKey: environment,
50
45
  site,
51
46
  product
52
47
  });
48
+ return false;
53
49
  }
54
- }, text.cmd.start(name, cli_shared_1.environmentToOption(environment)), (result) => {
55
- if (result.alreadyUpdated) {
50
+ }, text.cmd.start(cli_shared_1.environmentToOption(environment)), (alreadyUpdated) => {
51
+ if (alreadyUpdated) {
56
52
  return cli_shared_1.Text.upgrade.alreadyUpdated.spinner;
57
53
  }
58
- else if (isInstallationResult(result)) {
59
- return text.cmd.end(false);
60
- }
61
54
  else {
62
- return {
63
- successful: false,
64
- message: cli_shared_1.Text.upgrade.cmd.error
65
- };
55
+ return text.cmd.end(false);
66
56
  }
67
57
  });
68
58
  }
@@ -79,7 +69,7 @@ class InstallController {
79
69
  return cli_shared_1.validateSite(trySite);
80
70
  }
81
71
  async promptForUpgrade(siteOption, productOption, environmentOption) {
82
- const { installations } = await this.installationService.listNonIdentityAppInstallations({
72
+ const { installations } = await this.installationService.listNonTechnicalAppInstallations({
83
73
  site: siteOption === null || siteOption === void 0 ? void 0 : siteOption.host,
84
74
  product: productOption,
85
75
  environment: environmentOption
@@ -105,10 +95,11 @@ class InstallController {
105
95
  });
106
96
  return products.size > 0 ? Array.from(products) : undefined;
107
97
  }
108
- async run({ environment, site, product, upgrade, confirmScopes }) {
109
- const { name, id } = await this.appConfigProvider();
98
+ async run({ environment, site, product, upgrade, confirmScopes, nonInteractive }) {
99
+ var _a;
100
+ const { id } = await this.appConfigProvider();
110
101
  const text = upgrade ? cli_shared_1.Text.upgrade : cli_shared_1.Text.install;
111
- if (upgrade) {
102
+ if (upgrade && (!site || !product)) {
112
103
  const upgradeResult = await this.promptForUpgrade(site, product, environment);
113
104
  environment = upgradeResult.environment;
114
105
  site = upgradeResult.site;
@@ -120,27 +111,32 @@ class InstallController {
120
111
  if (cli_shared_1.isSecureSite(site)) {
121
112
  await this.securityPrompt(site);
122
113
  }
123
- const environmentScopes = await this.installationService.getScopes(id, environment);
124
- if (!environmentScopes || environmentScopes.length === 0) {
114
+ const environmentPermissions = await this.installationService.getAppEnvironmentPermissions(id, environment);
115
+ if (!(environmentPermissions === null || environmentPermissions === void 0 ? void 0 : environmentPermissions.scopes) || environmentPermissions.scopes.length === 0) {
125
116
  this.ui.error(new NoDeploymentError(environment), { pad: false });
126
117
  return;
127
118
  }
128
- const { permissions } = await this.configFile.readConfig();
129
- const manifestScopes = permissions === null || permissions === void 0 ? void 0 : permissions.scopes;
130
- const scopesConfirmationResult = await this.installView.promptForScopesConfirmation(environmentScopes, manifestScopes, environment, confirmScopes, text);
119
+ const { scopes: environmentScopes } = environmentPermissions;
120
+ const [{ permissions }, manifestEgressEntries] = await Promise.all([
121
+ this.configFile.readConfig(),
122
+ this.configFile.getEgressPermissions()
123
+ ]);
124
+ const manifestEgressAddresses = cli_shared_1.flatMap(manifestEgressEntries, ({ domains }) => domains !== null && domains !== void 0 ? domains : []);
125
+ const manifestScopes = (_a = permissions === null || permissions === void 0 ? void 0 : permissions.scopes) !== null && _a !== void 0 ? _a : [];
126
+ const scopesConfirmationResult = await this.installView.promptForPermissionsConfirmation(environmentPermissions, manifestScopes, manifestEgressAddresses, environment, confirmScopes, !!nonInteractive, text);
131
127
  if (!scopesConfirmationResult)
132
128
  return;
133
- const installationInfo = await this.installOrUpgrade(upgrade, environment, site, product, name, id, text);
134
- if (isAlreadyUpgradedResult(installationInfo)) {
135
- this.ui.info(cli_shared_1.Text.upgrade.alreadyUpdated.banner(name, environment, cli_shared_1.environmentToOption, product, site.host));
129
+ const isAlreadyUpdated = await this.installOrUpgrade(upgrade, environment, site, product, id, text);
130
+ if (isAlreadyUpdated) {
131
+ this.ui.info(cli_shared_1.Text.upgrade.alreadyUpdated.banner(environment, cli_shared_1.environmentToOption, product, site.host));
136
132
  }
137
133
  else {
138
134
  this.ui.emptyLine();
139
- this.ui.info(text.success.banner(name, environment, cli_shared_1.environmentToOption, product, site.host));
135
+ this.ui.info(text.success.banner(environment, cli_shared_1.environmentToOption, product, site.host));
140
136
  const uniqueProductsFromScopes = this.getUniqueInstallationProductsFromScopes(environmentScopes);
141
137
  if (!uniqueProductsFromScopes || uniqueProductsFromScopes.length <= 1)
142
138
  return;
143
- const { installations } = await this.installationService.listNonIdentityAppInstallations({
139
+ const { installations } = await this.installationService.listNonTechnicalAppInstallations({
144
140
  site: site.host,
145
141
  environment
146
142
  });
@@ -8,7 +8,7 @@ class LintController {
8
8
  }
9
9
  async run(environment, fix) {
10
10
  !fix && this.lintView.showBlurb();
11
- const runResult = await this.lintService.run(environment, { fix });
11
+ const runResult = await this.lintService.run(environment, { fix }, this.lintView.getLogger());
12
12
  if (runResult === null || runResult === void 0 ? void 0 : runResult.fixResults) {
13
13
  this.lintView.reportFixResult(runResult.fixResults);
14
14
  }
@@ -18,7 +18,7 @@ class PreCommandController {
18
18
  this.settingsView = settingsView;
19
19
  }
20
20
  async runChecks(strict) {
21
- const report = await this.service.run(strict);
21
+ const report = await this.service.run(strict, this.view.getLogger());
22
22
  if (this.service.hasErrors(report)) {
23
23
  this.view.reportErrors(report);
24
24
  throw new PreCommandValidationError();
@@ -0,0 +1,11 @@
1
+ import { CLIDetails, FeatureFlagReader, Logger } from '@forge/cli-shared';
2
+ export declare class PrerequisitesController {
3
+ private readonly logger;
4
+ private readonly featureFlags;
5
+ private readonly cliDetails;
6
+ constructor(logger: Logger, featureFlags: FeatureFlagReader, cliDetails: CLIDetails | undefined);
7
+ check(): Promise<void>;
8
+ private checkNodeVersion;
9
+ private checkCustomWarning;
10
+ }
11
+ //# sourceMappingURL=prerequisites-controller.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prerequisites-controller.d.ts","sourceRoot":"","sources":["../../../src/command-line/controller/prerequisites-controller.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAe,iBAAiB,EAAE,MAAM,EAAQ,MAAM,mBAAmB,CAAC;AAI7F,qBAAa,uBAAuB;IAEhC,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,YAAY;IAC7B,OAAO,CAAC,QAAQ,CAAC,UAAU;gBAFV,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,iBAAiB,EAC/B,UAAU,EAAE,UAAU,GAAG,SAAS;IAG/C,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAK5B,OAAO,CAAC,gBAAgB;YAcV,kBAAkB;CAMjC"}