@forge/cli 6.5.0-next.9 → 6.6.0-next.14

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 (65) hide show
  1. package/CHANGELOG.md +191 -0
  2. package/npm-shrinkwrap.json +109 -109
  3. package/out/autocomplete/autocomplete-config.json +11 -0
  4. package/out/command-line/command.d.ts.map +1 -1
  5. package/out/command-line/command.js +1 -1
  6. package/out/command-line/controller/deploy-controller.d.ts +3 -2
  7. package/out/command-line/controller/deploy-controller.d.ts.map +1 -1
  8. package/out/command-line/controller/deploy-controller.js +9 -2
  9. package/out/command-line/controller/install-controller.d.ts +1 -0
  10. package/out/command-line/controller/install-controller.d.ts.map +1 -1
  11. package/out/command-line/controller/install-controller.js +25 -12
  12. package/out/command-line/controller/tunnel-controller.d.ts.map +1 -1
  13. package/out/command-line/controller/tunnel-controller.js +4 -4
  14. package/out/command-line/dependency-injection.d.ts +4 -0
  15. package/out/command-line/dependency-injection.d.ts.map +1 -1
  16. package/out/command-line/dependency-injection.js +18 -9
  17. package/out/command-line/environment.d.ts +1 -0
  18. package/out/command-line/environment.d.ts.map +1 -1
  19. package/out/command-line/environment.js +8 -8
  20. package/out/command-line/index.d.ts.map +1 -1
  21. package/out/command-line/index.js +2 -0
  22. package/out/command-line/register-app-commands.d.ts.map +1 -1
  23. package/out/command-line/register-app-commands.js +23 -23
  24. package/out/command-line/register-environment-commands.d.ts +4 -2
  25. package/out/command-line/register-environment-commands.d.ts.map +1 -1
  26. package/out/command-line/register-environment-commands.js +39 -4
  27. package/out/command-line/register-storage-commands.d.ts +11 -0
  28. package/out/command-line/register-storage-commands.d.ts.map +1 -0
  29. package/out/command-line/register-storage-commands.js +48 -0
  30. package/out/command-line/register-tunnel-commands.d.ts.map +1 -1
  31. package/out/command-line/register-tunnel-commands.js +1 -0
  32. package/out/command-line/view/deploy-view.d.ts +3 -2
  33. package/out/command-line/view/deploy-view.d.ts.map +1 -1
  34. package/out/command-line/view/deploy-view.js +9 -5
  35. package/out/command-line/view/install-view.d.ts +4 -7
  36. package/out/command-line/view/install-view.d.ts.map +1 -1
  37. package/out/command-line/view/install-view.js +4 -17
  38. package/out/command-line/view/tunnel-view.d.ts +1 -1
  39. package/out/command-line/view/tunnel-view.d.ts.map +1 -1
  40. package/out/command-line/view/tunnel-view.js +6 -1
  41. package/out/deploy/packager/nativeui-bundler.js +1 -1
  42. package/out/deploy/packager/runtime-bundler.js +1 -1
  43. package/out/entities/graphql-client.d.ts +7 -0
  44. package/out/entities/graphql-client.d.ts.map +1 -0
  45. package/out/entities/graphql-client.js +36 -0
  46. package/out/entities/list-indexes.d.ts +27 -0
  47. package/out/entities/list-indexes.d.ts.map +1 -0
  48. package/out/entities/list-indexes.js +61 -0
  49. package/out/environment/graphql-client.d.ts +10 -2
  50. package/out/environment/graphql-client.d.ts.map +1 -1
  51. package/out/environment/graphql-client.js +36 -1
  52. package/out/environment/list-environment.d.ts +17 -0
  53. package/out/environment/list-environment.d.ts.map +1 -0
  54. package/out/environment/list-environment.js +16 -0
  55. package/out/installations/graphql-client.d.ts +5 -4
  56. package/out/installations/graphql-client.d.ts.map +1 -1
  57. package/out/installations/graphql-client.js +15 -4
  58. package/out/migration-keys/graphql-client.js +1 -1
  59. package/out/service/installation-service.d.ts +8 -2
  60. package/out/service/installation-service.d.ts.map +1 -1
  61. package/out/service/installation-service.js +8 -2
  62. package/out/service/tunnel-service.d.ts +1 -0
  63. package/out/service/tunnel-service.d.ts.map +1 -1
  64. package/out/service/tunnel-service.js +2 -5
  65. package/package.json +10 -10
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.registerCommands = exports.createEnvironmentHandler = void 0;
3
+ exports.registerCommands = exports.listEnvironmentHandler = exports.createEnvironmentHandler = void 0;
4
4
  const cli_shared_1 = require("@forge/cli-shared");
5
5
  const COMMAND_NAME = 'environment';
6
- const createEnvironmentHandler = async (ui, createEnvironmentCommand, environmentKey) => {
6
+ const createEnvironmentHandler = async (ui, createEnvironmentCommand, listEnvironmentCommand, environmentKey) => {
7
7
  ui.info(cli_shared_1.Text.createEnvironment.overview);
8
8
  ui.emptyLine();
9
9
  if (!environmentKey) {
@@ -16,7 +16,32 @@ const createEnvironmentHandler = async (ui, createEnvironmentCommand, environmen
16
16
  ui.info(cli_shared_1.Text.createEnvironment.successMessage);
17
17
  };
18
18
  exports.createEnvironmentHandler = createEnvironmentHandler;
19
- const registerCreateEnvironmentCommand = (parent, { ui, commands: { createEnvironmentCommand } }) => {
19
+ const listEnvironmentHandler = async (ui, listEnvironmentCommand) => {
20
+ const envOrder = {
21
+ PRODUCTION: 1,
22
+ STAGING: 2,
23
+ DEVELOPMENT: 3
24
+ };
25
+ const environments = (await listEnvironmentCommand.execute()).sort((a, b) => a.type === b.type ? Number(a.lastDeployedAt) - Number(b.lastDeployedAt) : envOrder[a.type] - envOrder[b.type]);
26
+ ui.table([
27
+ ['type', 'Type'],
28
+ ['name', 'Name'],
29
+ ['lastDeployedAt', 'Last deployed at']
30
+ ], environments.map(({ type, key: name, lastDeployedAt }) => {
31
+ return {
32
+ type,
33
+ name,
34
+ lastDeployedAt
35
+ };
36
+ }), {
37
+ preMessage: cli_shared_1.Text.listEnvironment.overview,
38
+ format: {
39
+ lastDeployedAt: (value) => new Date(Number(value)).toISOString()
40
+ }
41
+ });
42
+ };
43
+ exports.listEnvironmentHandler = listEnvironmentHandler;
44
+ const registerCreateEnvironmentCommand = (parent, { ui, commands: { createEnvironmentCommand, listEnvironmentCommand } }) => {
20
45
  parent
21
46
  .command('create')
22
47
  .requireAppId()
@@ -24,12 +49,22 @@ const registerCreateEnvironmentCommand = (parent, { ui, commands: { createEnviro
24
49
  .option('-e, --environment [environment]', cli_shared_1.Text.createEnvironment.optionEnvironmentKey)
25
50
  .nonInteractiveOption('--environment')
26
51
  .action(async ({ environment }) => {
27
- await (0, exports.createEnvironmentHandler)(ui, createEnvironmentCommand, environment);
52
+ await (0, exports.createEnvironmentHandler)(ui, createEnvironmentCommand, listEnvironmentCommand, environment);
53
+ });
54
+ };
55
+ const registerListEnvironmentCommand = (parent, { ui, commands: { listEnvironmentCommand } }) => {
56
+ parent
57
+ .command('list')
58
+ .requireAppId()
59
+ .description(cli_shared_1.Text.listEnvironment.cmd.desc)
60
+ .action(async () => {
61
+ await (0, exports.listEnvironmentHandler)(ui, listEnvironmentCommand);
28
62
  });
29
63
  };
30
64
  const registerCommands = (deps) => {
31
65
  const { cmd } = deps;
32
66
  const environment = cmd.command(COMMAND_NAME).description(cli_shared_1.Text.environment.desc);
33
67
  registerCreateEnvironmentCommand(environment, deps);
68
+ registerListEnvironmentCommand(environment, deps);
34
69
  };
35
70
  exports.registerCommands = registerCommands;
@@ -0,0 +1,11 @@
1
+ import { ConfigFile } from '@forge/cli-shared';
2
+ import { Dependencies } from './dependency-injection';
3
+ export declare function getManifestEntities(configFile: ConfigFile): Promise<{
4
+ entities: string[];
5
+ }>;
6
+ export interface ListIndexesData {
7
+ environment: string;
8
+ }
9
+ export declare function listIndexes(data: ListIndexesData, configFile: ConfigFile, { ui, commands: { listEntitiesIndexesCommand } }: Dependencies): Promise<void>;
10
+ export declare const registerCommands: (deps: Dependencies) => void;
11
+ //# sourceMappingURL=register-storage-commands.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"register-storage-commands.d.ts","sourceRoot":"","sources":["../../src/command-line/register-storage-commands.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAA6B,MAAM,mBAAmB,CAAC;AAE1E,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAKtD,wBAAsB,mBAAmB,CAAC,UAAU,EAAE,UAAU;;GAG/D;AAED,MAAM,WAAW,eAAe;IAC9B,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,wBAAsB,WAAW,CAC/B,IAAI,EAAE,eAAe,EACrB,UAAU,EAAE,UAAU,EACtB,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE,0BAA0B,EAAE,EAAE,EAAE,YAAY,iBAoB/D;AAqBD,eAAO,MAAM,gBAAgB,SAAU,YAAY,KAAG,IAOrD,CAAC"}
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.registerCommands = exports.listIndexes = exports.getManifestEntities = void 0;
4
+ const cli_shared_1 = require("@forge/cli-shared");
5
+ const COMMAND_NAME = 'storage';
6
+ async function getManifestEntities(configFile) {
7
+ var _a, _b;
8
+ const manifest = await configFile.readConfig();
9
+ return { entities: ((_b = (_a = manifest.app.storage) === null || _a === void 0 ? void 0 : _a.entities) === null || _b === void 0 ? void 0 : _b.map((entity) => entity.name)) || [] };
10
+ }
11
+ exports.getManifestEntities = getManifestEntities;
12
+ async function listIndexes(data, configFile, { ui, commands: { listEntitiesIndexesCommand } }) {
13
+ const { entities } = await getManifestEntities(configFile);
14
+ if (!entities.length) {
15
+ throw new Error(cli_shared_1.Text.entitiesIndexesList.missingEntities);
16
+ }
17
+ const result = await listEntitiesIndexesCommand.execute((0, cli_shared_1.optionToEnvironment)(data.environment || 'development'), entities);
18
+ ui.table([
19
+ ['entityName', 'Entity name'],
20
+ ['indexName', 'Index name'],
21
+ ['indexStatus', 'Index status']
22
+ ], result.indexes);
23
+ }
24
+ exports.listIndexes = listIndexes;
25
+ const registerListCustomEntityIndexCommand = (parent, configFile, deps) => {
26
+ parent
27
+ .command('list')
28
+ .requireAppId()
29
+ .environmentOption()
30
+ .description(cli_shared_1.Text.entitiesIndexesList.cmd.desc)
31
+ .action(async (data) => {
32
+ await listIndexes(data, configFile, deps);
33
+ });
34
+ };
35
+ const registerCustomEntitiesIndexesCommand = (parent, { ui }) => {
36
+ return parent.command('indexes').requireAppId().description(cli_shared_1.Text.entitiesIndexes.cmd.desc);
37
+ };
38
+ const registerCustomEntitiesCommand = (parent, { ui }) => {
39
+ return parent.command('entities').requireAppId().description(cli_shared_1.Text.entitiesIndexes.cmd.desc);
40
+ };
41
+ const registerCommands = (deps) => {
42
+ const { cmd, configFile } = deps;
43
+ const storage = cmd.command(COMMAND_NAME).description(cli_shared_1.Text.storage.cmd.desc);
44
+ const customEntitiesCommand = registerCustomEntitiesCommand(storage, deps);
45
+ const customEntitiesIndexesCommand = registerCustomEntitiesIndexesCommand(customEntitiesCommand, deps);
46
+ registerListCustomEntityIndexCommand(customEntitiesIndexesCommand, configFile, deps);
47
+ };
48
+ exports.registerCommands = registerCommands;
@@ -1 +1 @@
1
- {"version":3,"file":"register-tunnel-commands.d.ts","sourceRoot":"","sources":["../../src/command-line/register-tunnel-commands.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAGtD,eAAO,MAAM,gBAAgB,mDAAoD,YAAY,KAAG,IAS/F,CAAC"}
1
+ {"version":3,"file":"register-tunnel-commands.d.ts","sourceRoot":"","sources":["../../src/command-line/register-tunnel-commands.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAGtD,eAAO,MAAM,gBAAgB,mDAAoD,YAAY,KAAG,IAU/F,CAAC"}
@@ -7,6 +7,7 @@ const registerCommands = ({ cmd, ui, controllers: { tunnelController } }) => {
7
7
  .command('tunnel')
8
8
  .requireAppId()
9
9
  .description(cli_shared_1.Text.tunnel.cmd)
10
+ .environmentOption()
10
11
  .option('-d, --debug', cli_shared_1.Text.tunnel.optionDebugger)
11
12
  .action(async (options) => {
12
13
  await tunnelController.run(options, ui);
@@ -1,4 +1,4 @@
1
- import { UI } from '@forge/cli-shared';
1
+ import { AppEnvironmentDetails, UI } from '@forge/cli-shared';
2
2
  import { LintResult } from '@forge/lint';
3
3
  import { DeploymentResult } from '../register-deployment-commands';
4
4
  export declare class DeployView {
@@ -8,6 +8,7 @@ export declare class DeployView {
8
8
  displayStart(environment: string): void;
9
9
  displayLintRunning(): void;
10
10
  displayOutdatedInstallationsMessage(): void;
11
+ displayIndexingCommand(environment: string): void;
11
12
  displayLintErrors(lintResults: LintResult[]): void;
12
13
  displayLintWarnings(warnings: number): void;
13
14
  displayNoLintProblems(): void;
@@ -16,6 +17,6 @@ export declare class DeployView {
16
17
  displayMPACAppConnectKeyChangeError(mpacAppKey: string, connectKey: string): void;
17
18
  promptToContinueDeletingConnectKey(): Promise<boolean>;
18
19
  promptToContinueChangingConnectKey(): Promise<boolean>;
19
- reportDeploymentProgress(id: string, environment: string, showDistributionPageLink: boolean, deployCallback: () => Promise<DeploymentResult>): Promise<DeploymentResult>;
20
+ reportDeploymentProgress({ appAri, name, environmentKey, environmentType }: AppEnvironmentDetails, showDistributionPageLink: boolean, deployCallback: () => Promise<DeploymentResult>): Promise<DeploymentResult>;
20
21
  }
21
22
  //# sourceMappingURL=deploy-view.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"deploy-view.d.ts","sourceRoot":"","sources":["../../../src/command-line/view/deploy-view.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAuC,MAAM,mBAAmB,CAAC;AAC5E,OAAO,EAAqB,UAAU,EAAE,MAAM,aAAa,CAAC;AAE5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAEnE,qBAAa,UAAU;IACT,OAAO,CAAC,QAAQ,CAAC,EAAE;gBAAF,EAAE,EAAE,EAAE;IAE5B,SAAS,IAAI,EAAE;IAIf,YAAY,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI;IAIvC,kBAAkB,IAAI,IAAI;IAI1B,mCAAmC,IAAI,IAAI;IAK3C,iBAAiB,CAAC,WAAW,EAAE,UAAU,EAAE,GAAG,IAAI;IAKlD,mBAAmB,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;IAI3C,qBAAqB,IAAI,IAAI;IAI7B,8BAA8B,CAAC,WAAW,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,IAAI;IAInG,8BAA8B,CAAC,WAAW,EAAE,M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,GAAG,IAAI;IAI3E,kCAAkC,IAAI,OAAO,CAAC,OAAO,CAAC;IAItD,kCAAkC,IAAI,OAAO,CAAC,OAAO,CAAC;IAItD,wBAAwB,CACnC,EAAE,MAAM,EAAE,IAAI,EAAE,cAAc,EAAE,eAAe,EAAE,EAAE,qBAAqB,EACxE,wBAAwB,EAAE,OAAO,EACjC,cAAc,EAAE,MAAM,OAAO,CAAC,gBAAgB,CAAC,GAC9C,OAAO,CAAC,gBAAgB,CAAC;CAY7B"}
@@ -21,6 +21,10 @@ class DeployView {
21
21
  this.ui.emptyLine();
22
22
  this.ui.warn(cli_shared_1.Text.deploy.outdatedInstallations);
23
23
  }
24
+ displayIndexingCommand(environment) {
25
+ this.ui.emptyLine();
26
+ this.ui.info(cli_shared_1.Text.deploy.listIndexes(environment));
27
+ }
24
28
  displayLintErrors(lintResults) {
25
29
  this.ui.info(cli_shared_1.Text.deploy.taskLint.lintError);
26
30
  (0, lint_1.reportLintResults)(this.ui, lintResults);
@@ -46,11 +50,11 @@ class DeployView {
46
50
  async promptToContinueChangingConnectKey() {
47
51
  return await this.ui.confirm(cli_shared_1.Text.deploy.connectKeyChange.continueChange);
48
52
  }
49
- async reportDeploymentProgress(id, environment, showDistributionPageLink, deployCallback) {
50
- const result = await this.ui.displayProgress(() => deployCallback(), cli_shared_1.Text.deploy.cmd.start2(environment, cli_shared_1.environmentToOption), cli_shared_1.Text.deploy.cmd.success);
51
- this.ui.info(cli_shared_1.Text.deploy.cmd.successDetails(environment, cli_shared_1.environmentToOption));
52
- if (environment === 'production' && showDistributionPageLink) {
53
- this.ui.info(cli_shared_1.Text.deploy.cmd.distributePageLink((0, cs_ari_1.parseAppAri)((0, cs_ari_1.parse)(id)).appId));
53
+ async reportDeploymentProgress({ appAri, name, environmentKey, environmentType }, showDistributionPageLink, deployCallback) {
54
+ const result = await this.ui.displayProgress(() => deployCallback(), cli_shared_1.Text.deploy.cmd.start2(name, environmentKey, environmentType, cli_shared_1.environmentToOption), cli_shared_1.Text.deploy.cmd.success);
55
+ this.ui.info(cli_shared_1.Text.deploy.cmd.successDetails(name, environmentKey, environmentType, cli_shared_1.environmentToOption));
56
+ if (environmentType === cli_shared_1.AppEnvironmentType.Production && showDistributionPageLink) {
57
+ this.ui.info(cli_shared_1.Text.deploy.cmd.distributePageLink((0, cs_ari_1.parseAppAri)((0, cs_ari_1.parse)(appAri)).appId));
54
58
  }
55
59
  return result;
56
60
  }
@@ -1,18 +1,15 @@
1
- import { UI, FeatureFlagReader, UserError } from '@forge/cli-shared';
1
+ import { UI, AddedScope } from '@forge/cli-shared';
2
2
  import { AppEnvironmentPermissions, Installation } from '../../service/installation-service';
3
3
  interface InstallOrUpgradeCommandText {
4
- listScopes: (scopes: string[]) => string;
4
+ listScopes: (scopes: AddedScope[]) => string;
5
5
  listEgressAddresses: (egressAddresses: string[]) => string;
6
6
  permissionsMismatch: (environment: string) => string;
7
7
  promptForPermissionsConfirmation: (permissionsMismatchInDevelopment: boolean) => string;
8
8
  }
9
- export declare class NoScopesError extends UserError {
10
- }
11
9
  export declare class InstallView {
12
10
  private readonly ui;
13
- private readonly featureFlags;
14
- constructor(ui: UI, featureFlags: FeatureFlagReader);
15
- promptForPermissionsConfirmation({ scopes, egressAddresses, addedScopes }: AppEnvironmentPermissions, manifestScopes: string[], manifestEgressAddresses: string[], environment: string, confirmScopes: boolean, nonInteractive: boolean, text: InstallOrUpgradeCommandText): Promise<boolean>;
11
+ constructor(ui: UI);
12
+ promptForPermissionsConfirmation({ scopes, egressAddresses }: AppEnvironmentPermissions, addedScopes: AddedScope[], manifestScopes: string[], manifestEgressAddresses: string[], environment: string, confirmScopes: boolean, nonInteractive: boolean, text: InstallOrUpgradeCommandText): Promise<boolean>;
16
13
  promptForUpgrade(installations: Installation[]): Promise<Installation>;
17
14
  }
18
15
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"install-view.d.ts","sourceRoot":"","sources":["../../../src/command-line/view/install-view.ts"],"names":[],"mappings":"AAAA,OAA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U,EAAE,KAAK,MAAM,CAAC;IAC7C,mBAAmB,EAAE,CAAC,eAAe,EAAE,MAAM,EAAE,KAAK,MAAM,CAAC;IAC3D,mBAAmB,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,MAAM,CAAC;IACrD,gCAAgC,EAAE,CAAC,gCAAgC,EAAE,OAAO,KAAK,MAAM,CAAC;CACzF;AAED,qBAAa,WAAW;IACV,OAAO,CAAC,QAAQ,CAAC,EAAE;gBAAF,EAAE,EAAE,EAAE;IAEtB,gCAAgC,CAC3C,EAAE,MAAM,EAAE,eAAe,EAAE,EAAE,yBAAyB,EACtD,WAAW,EAAE,UAAU,EAAE,EACzB,cAAc,EAAE,MAAM,EAAE,EACxB,uBAAuB,EAAE,MAAM,EAAE,EACjC,WAAW,EAAE,MAAM,EACnB,aAAa,EAAE,OAAO,EACtB,cAAc,EAAE,OAAO,EACvB,IAAI,EAAE,2BAA2B,GAChC,OAAO,CAAC,OAAO,CAAC;IA+BN,gBAAgB,CAAC,aAAa,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC,YAAY,CAAC;CAqBpF"}
@@ -1,35 +1,22 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.InstallView = exports.NoScopesError = void 0;
3
+ exports.InstallView = void 0;
4
4
  const cli_shared_1 = require("@forge/cli-shared");
5
5
  const egress_1 = require("@forge/egress");
6
6
  const lodash_1 = require("lodash");
7
- class NoScopesError extends cli_shared_1.UserError {
8
- }
9
- exports.NoScopesError = NoScopesError;
10
7
  class InstallView {
11
- constructor(ui, featureFlags) {
8
+ constructor(ui) {
12
9
  this.ui = ui;
13
- this.featureFlags = featureFlags;
14
10
  }
15
- async promptForPermissionsConfirmation({ scopes, egressAddresses, addedScopes }, manifestScopes, manifestEgressAddresses, environment, confirmScopes, nonInteractive, text) {
16
- const hasDefaultReadMeScope = await this.featureFlags.readMeScopeAddedByXLS();
17
- if (hasDefaultReadMeScope && scopes.length === 0) {
18
- throw new NoScopesError();
19
- }
11
+ async promptForPermissionsConfirmation({ scopes, egressAddresses }, addedScopes, manifestScopes, manifestEgressAddresses, environment, confirmScopes, nonInteractive, text) {
20
12
  if (addedScopes.length)
21
13
  this.ui.info(text.listScopes(addedScopes));
22
14
  if (egressAddresses.length)
23
15
  this.ui.info(text.listEgressAddresses(egressAddresses));
24
- const manifestScopesSet = new Set(manifestScopes);
25
- if (hasDefaultReadMeScope) {
26
- manifestScopesSet.add('read:me');
27
- }
28
- const cleanedManifestScopes = [...manifestScopesSet];
29
16
  const groupedManifestEgressAddresses = (0, egress_1.sortAndGroupEgressPermissionsByDomain)(manifestEgressAddresses);
30
17
  let permissionsMismatchWithManifest = false;
31
18
  if ((0, cli_shared_1.environmentToOption)(environment) === cli_shared_1.DEFAULT_ENVIRONMENT_OPTION) {
32
- const scopesMismatch = !(0, lodash_1.isEqual)([...cleanedManifestScopes].sort(), [...scopes].sort());
19
+ const scopesMismatch = !(0, lodash_1.isEqual)([...manifestScopes].sort(), [...scopes].sort());
33
20
  const egressAddressesMismatch = !(0, lodash_1.isEqual)([...groupedManifestEgressAddresses].sort(), [...egressAddresses].sort());
34
21
  permissionsMismatchWithManifest = scopesMismatch || egressAddressesMismatch;
35
22
  if (permissionsMismatchWithManifest) {
@@ -11,7 +11,7 @@ export declare class TunnelViewError extends UserError {
11
11
  export declare class TunnelView {
12
12
  private readonly ui;
13
13
  constructor(ui: CommandLineUI);
14
- dockerPreamble(): void;
14
+ dockerPreamble(environmentKey?: string): void;
15
15
  getTunnelErrorHandler(exitFn: typeof exitOnError): (err: Error) => Promise<void>;
16
16
  updatePullPercent(dataBuffer: Buffer, dockerPullPercent: number): number;
17
17
  calculateProgress(progress: string, regex: RegExp, dockerPullPercent: number, clamp: number): number;
@@ -1 +1 @@
1
- {"version":3,"file":"tunnel-view.d.ts","sourceRoot":"","sources":["../../../src/command-line/view/tunnel-view.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,WAAW,EAAk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,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"}
@@ -11,8 +11,13 @@ class TunnelView {
11
11
  constructor(ui) {
12
12
  this.ui = ui;
13
13
  }
14
- dockerPreamble() {
14
+ dockerPreamble(environmentKey) {
15
15
  this.ui.info(cli_shared_1.Text.tunnel.preamble);
16
+ if (environmentKey && environmentKey !== cli_shared_1.DEFAULT_ENVIRONMENT_KEY) {
17
+ this.ui.emptyLine();
18
+ this.ui.info(cli_shared_1.Text.tunnel.startingTunnel(environmentKey, cli_shared_1.environmentToOption));
19
+ this.ui.emptyLine();
20
+ }
16
21
  this.ui.info(cli_shared_1.Text.ctrlC);
17
22
  this.ui.emptyLine();
18
23
  }
@@ -16,7 +16,7 @@ class NativeUIBundler {
16
16
  if (entryPoints.length > 0) {
17
17
  let bundlerOutputs;
18
18
  try {
19
- bundlerOutputs = await Promise.all(entryPoints.map((entrypoint) => this.bundler([entrypoint])));
19
+ bundlerOutputs = await Promise.all(entryPoints.map((entrypoint) => this.bundler(this.logger, [entrypoint])));
20
20
  }
21
21
  catch (e) {
22
22
  throw new packager_1.BundlerError(e.message);
@@ -21,7 +21,7 @@ class RuntimeBundler {
21
21
  if (entryPoints.length > 0) {
22
22
  let bundlerResponse;
23
23
  try {
24
- bundlerResponse = await this.bundler(process.cwd(), entryPoints);
24
+ bundlerResponse = await this.bundler(this.logger, process.cwd(), entryPoints);
25
25
  }
26
26
  catch (e) {
27
27
  throw new packager_1.BundlerError(e.message);
@@ -0,0 +1,7 @@
1
+ import { GraphQLClient } from '@forge/cli-shared';
2
+ export declare class EntitiesGraphqlClient {
3
+ private readonly graphQLClient;
4
+ constructor(graphQLClient: GraphQLClient);
5
+ getEntitiesDefinitions(oauthClientId: string, entities: string[]): Promise<any[]>;
6
+ }
7
+ //# sourceMappingURL=graphql-client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graphql-client.d.ts","sourceRoot":"","sources":["../../src/entities/graphql-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAElD,qBAAa,qBAAqB;IACpB,OAAO,CAAC,QAAQ,CAAC,aAAa;gBAAb,aAAa,EAAE,aAAa;IAE5C,sBAAsB,CAAC,aAAa,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;CA+B/F"}
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EntitiesGraphqlClient = void 0;
4
+ class EntitiesGraphqlClient {
5
+ constructor(graphQLClient) {
6
+ this.graphQLClient = graphQLClient;
7
+ }
8
+ async getEntitiesDefinitions(oauthClientId, entities) {
9
+ var _a;
10
+ const query = `
11
+ query forge_cli_getAppOauthClientIdDetails($oauthClientId: String!, $entities: [String!]!) {
12
+ ersLifecycle {
13
+ customEntityDefinitions(
14
+ entities: $entities
15
+ oauthClientId: $oauthClientId
16
+ ) {
17
+ indexes {
18
+ name
19
+ partition
20
+ range
21
+ status
22
+ }
23
+ name
24
+ status
25
+ }
26
+ }
27
+ }
28
+ `;
29
+ const result = await this.graphQLClient.query(query, {
30
+ oauthClientId,
31
+ entities
32
+ });
33
+ return ((_a = result === null || result === void 0 ? void 0 : result.ersLifecycle) === null || _a === void 0 ? void 0 : _a.customEntityDefinitions) || [];
34
+ }
35
+ }
36
+ exports.EntitiesGraphqlClient = EntitiesGraphqlClient;
@@ -0,0 +1,27 @@
1
+ import { AppConfigProvider, AppOauthClientIdClient } from '@forge/cli-shared';
2
+ export interface CustomEntityIndex {
3
+ entityName: string;
4
+ indexName: string;
5
+ indexStatus: CustomEntityIndexStatus;
6
+ }
7
+ export declare enum CustomEntityIndexStatus {
8
+ ACTIVE = "ACTIVE",
9
+ CREATING = "CREATING"
10
+ }
11
+ export interface AppCustomEntitiesIndexes {
12
+ appId: string;
13
+ oauthClientId: string;
14
+ environmentId: string;
15
+ indexes: CustomEntityIndex[];
16
+ }
17
+ export interface EntitiesClient {
18
+ getEntitiesDefinitions(oauthClientId: string, entities: string[]): Promise<any[]>;
19
+ }
20
+ export declare class ListEntitiesIndexesCommand {
21
+ private readonly getAppConfig;
22
+ private readonly appOauthClient;
23
+ private readonly entitiesGraphqlClient;
24
+ constructor(getAppConfig: AppConfigProvider, appOauthClient: AppOauthClientIdClient, entitiesGraphqlClient: EntitiesClient);
25
+ execute(environment: string, entities: string[]): Promise<AppCustomEntitiesIndexes>;
26
+ }
27
+ //# sourceMappingURL=list-indexes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list-indexes.d.ts","sourceRoot":"","sources":["../../src/entities/list-indexes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAE9E,MAAM,WAAW,iBAAiB;IAChC,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,uBAAuB,CAAC;CACtC;AAED,oBAAY,uBAAuB;IACjC,MAAM,WAAW;IACjB,QAAQ,aAAa;CACtB;AAED,MAAM,WAAW,wBAAwB;IACvC,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,iBAAiB,EAAE,CAAC;CAC9B;AAED,MAAM,WAAW,cAAc;IAC7B,sBAAsB,CAAC,aAAa,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;CACnF;AAED,qBAAa,0BAA0B;IAEnC,OAAO,CAAC,QAAQ,CAAC,YAAY;IAC7B,OAAO,CAAC,QAAQ,CAAC,cAAc;IAC/B,OAAO,CAAC,QAAQ,CAAC,qBAAqB;gBAFrB,YAAY,EAAE,iBAAiB,EAC/B,cAAc,EAAE,sBAAsB,EACtC,qBAAqB,EAAE,cAAc;IAG3C,OAAO,CAAC,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,wBAAwB,CAAC;CA+CjG"}
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ListEntitiesIndexesCommand = exports.CustomEntityIndexStatus = void 0;
4
+ var CustomEntityIndexStatus;
5
+ (function (CustomEntityIndexStatus) {
6
+ CustomEntityIndexStatus["ACTIVE"] = "ACTIVE";
7
+ CustomEntityIndexStatus["CREATING"] = "CREATING";
8
+ })(CustomEntityIndexStatus = exports.CustomEntityIndexStatus || (exports.CustomEntityIndexStatus = {}));
9
+ class ListEntitiesIndexesCommand {
10
+ constructor(getAppConfig, appOauthClient, entitiesGraphqlClient) {
11
+ this.getAppConfig = getAppConfig;
12
+ this.appOauthClient = appOauthClient;
13
+ this.entitiesGraphqlClient = entitiesGraphqlClient;
14
+ }
15
+ async execute(environment, entities) {
16
+ var _a;
17
+ const { id: appId } = await this.getAppConfig();
18
+ const { environmentId, oauthClientId } = await this.appOauthClient.getAppOauthClientIdDetails(appId, environment);
19
+ const results = await this.entitiesGraphqlClient.getEntitiesDefinitions(oauthClientId, entities);
20
+ const transformedIndexes = [];
21
+ const indexesToExclude = ['by-contextAri'];
22
+ for (const entity of results) {
23
+ const [, , , ...entityName] = entity.name.split('_');
24
+ for (const index of (_a = entity.indexes) !== null && _a !== void 0 ? _a : []) {
25
+ if (indexesToExclude.indexOf(index.name) < 0) {
26
+ transformedIndexes.push({
27
+ entityName: entityName.join('_'),
28
+ indexName: index.name,
29
+ indexStatus: index.status
30
+ });
31
+ }
32
+ }
33
+ }
34
+ transformedIndexes.sort((index1, index2) => {
35
+ if (index1.indexStatus > index2.indexStatus) {
36
+ return -1;
37
+ }
38
+ else if (index1.indexStatus < index2.indexStatus) {
39
+ return 1;
40
+ }
41
+ else {
42
+ if (index1.entityName < index2.entityName) {
43
+ return -1;
44
+ }
45
+ else if (index1.entityName > index2.entityName) {
46
+ return 1;
47
+ }
48
+ else {
49
+ return 0;
50
+ }
51
+ }
52
+ });
53
+ return {
54
+ appId,
55
+ environmentId,
56
+ oauthClientId,
57
+ indexes: transformedIndexes
58
+ };
59
+ }
60
+ }
61
+ exports.ListEntitiesIndexesCommand = ListEntitiesIndexesCommand;
@@ -1,8 +1,16 @@
1
- import { GraphQLClient } from '@forge/cli-shared';
1
+ import { AppEnvironmentType, GraphQLClient, UserError } from '@forge/cli-shared';
2
2
  import { AppEnvironmentDetails, CreateEnvironmentClient } from './create-environment';
3
- export declare class GraphqlClient implements CreateEnvironmentClient {
3
+ import { ListEnvironmentClient, ListEnvironmentDetails } from './list-environment';
4
+ export declare class MissingAppError extends UserError {
5
+ }
6
+ export declare class GraphqlClient implements CreateEnvironmentClient, ListEnvironmentClient {
4
7
  private readonly graphqlClient;
5
8
  constructor(graphqlClient: GraphQLClient);
6
9
  createEnvironment(details: AppEnvironmentDetails): Promise<void>;
10
+ listEnvironment(details: ListEnvironmentDetails): Promise<{
11
+ type: AppEnvironmentType;
12
+ key: string;
13
+ lastDeployedAt: string;
14
+ }[]>;
7
15
  }
8
16
  //# sourceMappingURL=graphql-client.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"graphql-client.d.ts","sourceRoot":"","sources":["../../src/environment/graphql-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,aAAa,EAEd,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAEtF,qBAAa,aAAc,YAAW,uBAAuB;IAC/C,OAAO,CAAC,QAAQ,CAAC,aAAa;gBAAb,aAAa,EAAE,aAAa;IAE5C,iBAAiB,CAAC,OAAO,EAAE,qBAAqB;CA+C9D"}
1
+ {"version":3,"file":"graphql-client.d.ts","sourceRoot":"","sources":["../../src/environment/graphql-client.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAGlB,aAAa,EAGb,SAAS,EACV,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AACtF,OAAO,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAEnF,qBAAa,eAAgB,SAAQ,SAAS;CAAG;AAEjD,qBAAa,aAAc,YAAW,uBAAuB,EAAE,qBAAqB;IACtE,OAAO,CAAC,QAAQ,CAAC,aAAa;gBAAb,aAAa,EAAE,aAAa;IAE5C,iBAAiB,CAAC,OAAO,EAAE,qBAAqB;IAgDhD,eAAe,CAAC,OAAO,EAAE,sBAAsB;;;;;CAkC7D"}
@@ -1,7 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.GraphqlClient = void 0;
3
+ exports.GraphqlClient = exports.MissingAppError = void 0;
4
4
  const cli_shared_1 = require("@forge/cli-shared");
5
+ class MissingAppError extends cli_shared_1.UserError {
6
+ }
7
+ exports.MissingAppError = MissingAppError;
5
8
  class GraphqlClient {
6
9
  constructor(graphqlClient) {
7
10
  this.graphqlClient = graphqlClient;
@@ -43,5 +46,37 @@ class GraphqlClient {
43
46
  });
44
47
  }
45
48
  }
49
+ async listEnvironment(details) {
50
+ const query = `
51
+ query forge_cli_listEnvironment($id: ID!) {
52
+ app(id: $id) {
53
+ environments {
54
+ key
55
+ type
56
+ createdAt
57
+ versions(first: 1) {
58
+ nodes {
59
+ updatedAt
60
+ }
61
+ }
62
+ }
63
+ }
64
+ }
65
+ `;
66
+ const { app } = await this.graphqlClient.query(query, {
67
+ id: details.appId
68
+ });
69
+ if (!app) {
70
+ throw new MissingAppError();
71
+ }
72
+ return app.environments.map((environment) => {
73
+ var _a, _b, _c;
74
+ return {
75
+ type: environment.type,
76
+ key: environment.key,
77
+ lastDeployedAt: ((_c = (_b = (_a = environment.versions) === null || _a === void 0 ? void 0 : _a.nodes) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.updatedAt) || environment.createdAt
78
+ };
79
+ });
80
+ }
46
81
  }
47
82
  exports.GraphqlClient = GraphqlClient;
@@ -0,0 +1,17 @@
1
+ import { AppConfigProvider, AppEnvironment } from '@forge/cli-shared';
2
+ export interface ListEnvironmentDetails {
3
+ appId: string;
4
+ }
5
+ export interface ListEnvironmentOutput extends Pick<AppEnvironment, 'key' | 'type'> {
6
+ lastDeployedAt: string;
7
+ }
8
+ export interface ListEnvironmentClient {
9
+ listEnvironment(details: ListEnvironmentDetails): Promise<ListEnvironmentOutput[]>;
10
+ }
11
+ export declare class ListEnvironmentCommand {
12
+ private readonly client;
13
+ private readonly getAppConfig;
14
+ constructor(client: ListEnvironmentClient, getAppConfig: AppConfigProvider);
15
+ execute(): Promise<ListEnvironmentOutput[]>;
16
+ }
17
+ //# sourceMappingURL=list-environment.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list-environment.d.ts","sourceRoot":"","sources":["../../src/environment/list-environment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEtE,MAAM,WAAW,sBAAsB;IACrC,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,qBAAsB,SAAQ,IAAI,CAAC,cAAc,EAAE,KAAK,GAAG,MAAM,CAAC;IACjF,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,qBAAqB;IACpC,eAAe,CAAC,OAAO,EAAE,sBAAsB,GAAG,OAAO,CAAC,qBAAqB,EAAE,CAAC,CAAC;CACpF;AAED,qBAAa,sBAAsB;IACrB,OAAO,CAAC,QAAQ,CAAC,MAAM;IAAyB,OAAO,CAAC,QAAQ,CAAC,YAAY;gBAA5D,MAAM,EAAE,qBAAqB,EAAmB,YAAY,EAAE,iBAAiB;IAE/F,OAAO;CAMrB"}
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ListEnvironmentCommand = void 0;
4
+ class ListEnvironmentCommand {
5
+ constructor(client, getAppConfig) {
6
+ this.client = client;
7
+ this.getAppConfig = getAppConfig;
8
+ }
9
+ async execute() {
10
+ const { id: appId } = await this.getAppConfig();
11
+ return this.client.listEnvironment({
12
+ appId
13
+ });
14
+ }
15
+ }
16
+ exports.ListEnvironmentCommand = ListEnvironmentCommand;
@@ -1,6 +1,6 @@
1
- import { AppEnvironment, AppUninstallationInput, GraphQLClient, GraphQlMutationError, Pause, BaseError, UserError } from '@forge/cli-shared';
1
+ import { AppUninstallationInput, GraphQLClient, GraphQlMutationError, Pause, BaseError, UserError } from '@forge/cli-shared';
2
2
  import { AppInstallSiteDetails, InstallAppClient } from './install-app-site';
3
- import { Installation, ListAppInstallationsClient, UpgradeAppInstallationsClient } from '../service/installation-service';
3
+ import { AppEnvironmentVersionData, Installation, ListAppInstallationsClient, UpgradeAppInstallationsClient } from '../service/installation-service';
4
4
  import { UninstallAppClient, UninstallAppOutput } from './uninstall-app';
5
5
  import { SiteTranslator } from './site-translation';
6
6
  export declare const UNINSTALLATION_EVENT_POLL_INTERVAL = 500;
@@ -25,7 +25,8 @@ export declare class UpgradeError extends GraphQlMutationError {
25
25
  statusCode: number | undefined;
26
26
  });
27
27
  }
28
- export declare class EnvironmentNotFoundError extends Error {
28
+ export declare class EnvironmentNotFoundError extends UserError {
29
+ constructor(environmentKey: string);
29
30
  }
30
31
  export declare class MissingTaskIdError extends Error {
31
32
  }
@@ -70,6 +71,6 @@ export declare class InstallationsGraphqlClient implements InstallAppClient, Lis
70
71
  private getCombinedHostnameMap;
71
72
  private resolveInstallationsHostnames;
72
73
  private getAllInstallations;
73
- getVersions(appId: string, environmentKey: string, firstN?: number): Promise<AppEnvironment['versions']>;
74
+ getVersions(appId: string, environmentKey: string, firstN?: number): Promise<AppEnvironmentVersionData>;
74
75
  }
75
76
  //# sourceMappingURL=graphql-client.d.ts.map