@forge/cli 0.0.0-experimental-383053a → 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.
- package/CHANGELOG.md +3872 -7
- package/README.md +18 -19
- package/npm-shrinkwrap.json +3100 -3556
- package/out/analytics-client/analytics-client.d.ts +3 -1
- package/out/analytics-client/analytics-client.d.ts.map +1 -1
- package/out/analytics-client/analytics-client.js +5 -1
- package/out/autocomplete/autocomplete-config.json +232 -212
- package/out/autocomplete/index.d.ts.map +1 -1
- package/out/autocomplete/index.js +12 -8
- package/out/autocomplete/isSupportedShell.d.ts +2 -0
- package/out/autocomplete/isSupportedShell.d.ts.map +1 -0
- package/out/autocomplete/isSupportedShell.js +11 -0
- package/out/autocomplete/types.d.ts +5 -1
- package/out/autocomplete/types.d.ts.map +1 -1
- package/out/autocomplete/util.d.ts +1 -1
- package/out/autocomplete/util.d.ts.map +1 -1
- package/out/autocomplete/util.js +3 -3
- package/out/bin/cli.js +0 -2
- package/out/bin/postinstall.js +10 -1
- package/out/command-line/anon-user-id.js +6 -10
- package/out/command-line/command.d.ts +28 -8
- package/out/command-line/command.d.ts.map +1 -1
- package/out/command-line/command.js +190 -49
- package/out/command-line/controller/assertUnreachable.d.ts +2 -0
- package/out/command-line/controller/assertUnreachable.d.ts.map +1 -0
- package/out/command-line/controller/assertUnreachable.js +7 -0
- package/out/command-line/controller/autocomplete-controller.d.ts +2 -1
- package/out/command-line/controller/autocomplete-controller.d.ts.map +1 -1
- package/out/command-line/controller/autocomplete-controller.js +29 -3
- package/out/command-line/controller/deploy-controller.d.ts +13 -2
- package/out/command-line/controller/deploy-controller.d.ts.map +1 -1
- package/out/command-line/controller/deploy-controller.js +79 -5
- package/out/command-line/controller/getNodeVersion.d.ts +2 -0
- package/out/command-line/controller/getNodeVersion.d.ts.map +1 -0
- package/out/command-line/controller/getNodeVersion.js +7 -0
- package/out/command-line/controller/install-controller.d.ts +5 -4
- package/out/command-line/controller/install-controller.d.ts.map +1 -1
- package/out/command-line/controller/install-controller.js +31 -56
- package/out/command-line/controller/lint-controller.js +1 -1
- package/out/command-line/controller/pre-command-controller.d.ts +8 -1
- package/out/command-line/controller/pre-command-controller.d.ts.map +1 -1
- package/out/command-line/controller/pre-command-controller.js +22 -2
- package/out/command-line/controller/prerequisites-controller.d.ts +11 -0
- package/out/command-line/controller/prerequisites-controller.d.ts.map +1 -0
- package/out/command-line/controller/prerequisites-controller.js +34 -0
- package/out/command-line/controller/settings-controller.d.ts +19 -0
- package/out/command-line/controller/settings-controller.d.ts.map +1 -0
- package/out/command-line/controller/settings-controller.js +48 -0
- package/out/command-line/controller/stubController.d.ts +9 -0
- package/out/command-line/controller/stubController.d.ts.map +1 -0
- package/out/command-line/controller/stubController.js +15 -0
- package/out/command-line/dependency-injection.d.ts +13 -3
- package/out/command-line/dependency-injection.d.ts.map +1 -1
- package/out/command-line/dependency-injection.js +53 -22
- package/out/command-line/index.d.ts +2 -38
- package/out/command-line/index.d.ts.map +1 -1
- package/out/command-line/index.js +22 -43
- package/out/command-line/register-app-commands.d.ts.map +1 -1
- package/out/command-line/register-app-commands.js +2 -12
- package/out/command-line/register-authentication-command.d.ts.map +1 -1
- package/out/command-line/register-authentication-command.js +1 -16
- package/out/command-line/register-autocomplete-commands.d.ts +0 -2
- package/out/command-line/register-autocomplete-commands.d.ts.map +1 -1
- package/out/command-line/register-autocomplete-commands.js +2 -9
- package/out/command-line/register-deployment-commands.d.ts +8 -0
- package/out/command-line/register-deployment-commands.d.ts.map +1 -1
- package/out/command-line/register-deployment-commands.js +1 -0
- package/out/command-line/register-environment-variables-commands.d.ts +1 -1
- package/out/command-line/register-environment-variables-commands.d.ts.map +1 -1
- package/out/command-line/register-environment-variables-commands.js +27 -10
- package/out/command-line/register-installation-commands.d.ts +4 -1
- package/out/command-line/register-installation-commands.d.ts.map +1 -1
- package/out/command-line/register-installation-commands.js +39 -23
- package/out/command-line/register-log-commands.d.ts +1 -0
- package/out/command-line/register-log-commands.d.ts.map +1 -1
- package/out/command-line/register-log-commands.js +26 -3
- package/out/command-line/register-providers-commands.d.ts +3 -0
- package/out/command-line/register-providers-commands.d.ts.map +1 -0
- package/out/command-line/register-providers-commands.js +43 -0
- package/out/command-line/register-settings-commands.d.ts +3 -0
- package/out/command-line/register-settings-commands.d.ts.map +1 -0
- package/out/command-line/register-settings-commands.js +37 -0
- package/out/command-line/register-webtrigger-commands.d.ts.map +1 -1
- package/out/command-line/register-webtrigger-commands.js +9 -11
- package/out/command-line/unique-machine-id.d.ts +1 -0
- package/out/command-line/unique-machine-id.d.ts.map +1 -1
- package/out/command-line/unique-machine-id.js +3 -12
- package/out/command-line/version-info.d.ts +1 -0
- package/out/command-line/version-info.d.ts.map +1 -1
- package/out/command-line/version-info.js +3 -2
- package/out/command-line/view/analytics-settings-view.d.ts +7 -0
- package/out/command-line/view/analytics-settings-view.d.ts.map +1 -0
- package/out/command-line/view/analytics-settings-view.js +18 -0
- package/out/command-line/view/deploy-view.d.ts +7 -1
- package/out/command-line/view/deploy-view.d.ts.map +1 -1
- package/out/command-line/view/deploy-view.js +25 -3
- package/out/command-line/view/install-view.d.ts +5 -3
- package/out/command-line/view/install-view.d.ts.map +1 -1
- package/out/command-line/view/install-view.js +19 -10
- package/out/command-line/view/lint-view.d.ts +3 -2
- package/out/command-line/view/lint-view.d.ts.map +1 -1
- package/out/command-line/view/lint-view.js +3 -0
- package/out/command-line/view/lite-lint-view.d.ts +3 -2
- package/out/command-line/view/lite-lint-view.d.ts.map +1 -1
- package/out/command-line/view/lite-lint-view.js +3 -0
- package/out/command-line/view/settings-view.d.ts +8 -0
- package/out/command-line/view/settings-view.d.ts.map +1 -0
- package/out/command-line/view/settings-view.js +21 -0
- package/out/deploy/deployer/deploy-monitor-graphql-client.js +1 -1
- package/out/deploy/deployer/deployer.d.ts.map +1 -1
- package/out/deploy/deployer/deployer.js +17 -1
- package/out/deploy/deployer/trigger-deploy-graphql-client.d.ts.map +1 -1
- package/out/deploy/deployer/trigger-deploy-graphql-client.js +9 -6
- package/out/deploy/packager/archiver.d.ts +3 -2
- package/out/deploy/packager/archiver.d.ts.map +1 -1
- package/out/deploy/packager/archiver.js +10 -2
- package/out/deploy/packager/packager.d.ts.map +1 -1
- package/out/deploy/packager/packager.js +20 -20
- package/out/deploy/uploader/artifact-graphql-client.d.ts.map +1 -1
- package/out/deploy/uploader/artifact-graphql-client.js +12 -9
- package/out/environment-variables/graphql-client.d.ts +1 -1
- package/out/environment-variables/graphql-client.d.ts.map +1 -1
- package/out/environment-variables/graphql-client.js +19 -13
- package/out/environment-variables/list-environment-variables.d.ts +2 -2
- package/out/environment-variables/list-environment-variables.d.ts.map +1 -1
- package/out/installations/graphql-client.d.ts +19 -13
- package/out/installations/graphql-client.d.ts.map +1 -1
- package/out/installations/graphql-client.js +168 -61
- package/out/installations/install-app-site.d.ts +2 -12
- package/out/installations/install-app-site.d.ts.map +1 -1
- package/out/installations/install-app-site.js +3 -14
- package/out/installations/uninstall-app.d.ts +5 -3
- package/out/installations/uninstall-app.d.ts.map +1 -1
- package/out/installations/uninstall-app.js +7 -7
- package/out/migration-keys/graphql-client.d.ts +8 -0
- package/out/migration-keys/graphql-client.d.ts.map +1 -0
- package/out/migration-keys/graphql-client.js +55 -0
- package/out/providers/configure-provider.d.ts +19 -0
- package/out/providers/configure-provider.d.ts.map +1 -0
- package/out/providers/configure-provider.js +14 -0
- package/out/providers/graphql-client.d.ts +12 -0
- package/out/providers/graphql-client.d.ts.map +1 -0
- package/out/providers/graphql-client.js +47 -0
- package/out/service/cached-config-service.d.ts +8 -0
- package/out/service/cached-config-service.d.ts.map +1 -0
- package/out/service/cached-config-service.js +16 -0
- package/out/service/installation-service.d.ts +13 -13
- package/out/service/installation-service.d.ts.map +1 -1
- package/out/service/installation-service.js +38 -23
- package/out/service/lint-service.d.ts +2 -2
- package/out/service/lint-service.d.ts.map +1 -1
- package/out/service/lint-service.js +3 -3
- package/out/service/lite-lint-service.d.ts +3 -3
- package/out/service/lite-lint-service.d.ts.map +1 -1
- package/out/service/lite-lint-service.js +2 -2
- package/out/service/migration-keys-service.d.ts +19 -0
- package/out/service/migration-keys-service.d.ts.map +1 -0
- package/out/service/migration-keys-service.js +14 -0
- package/out/service/port-finding-service.d.ts +12 -0
- package/out/service/port-finding-service.d.ts.map +1 -0
- package/out/service/port-finding-service.js +34 -0
- package/out/service/resource-packaging-service.d.ts +4 -4
- package/out/service/resource-packaging-service.d.ts.map +1 -1
- package/out/service/resource-packaging-service.js +9 -22
- package/out/service/tunnel-service.d.ts +6 -2
- package/out/service/tunnel-service.d.ts.map +1 -1
- package/out/service/tunnel-service.js +53 -12
- package/out/webtrigger/get-webtrigger-url.d.ts +10 -4
- package/out/webtrigger/get-webtrigger-url.d.ts.map +1 -1
- package/out/webtrigger/get-webtrigger-url.js +11 -18
- package/out/webtrigger/graphql-client.d.ts +14 -0
- package/out/webtrigger/graphql-client.d.ts.map +1 -0
- package/out/webtrigger/graphql-client.js +52 -0
- package/out/workers/analytics-message-worker.d.ts +3 -1
- package/out/workers/analytics-message-worker.d.ts.map +1 -1
- package/out/workers/analytics-message-worker.js +9 -2
- package/out/workers/forge-cli-workers.js +6 -1
- package/package.json +19 -18
- package/out/bin/preinstall.d.ts +0 -3
- package/out/bin/preinstall.d.ts.map +0 -1
- package/out/bin/preinstall.js +0 -9
- package/out/command-line/cli-prerequisites.d.ts +0 -3
- package/out/command-line/cli-prerequisites.d.ts.map +0 -1
- package/out/command-line/cli-prerequisites.js +0 -37
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import { URL } from 'url';
|
|
3
|
-
import { AppEnvironment, GraphQLClient, GraphQlMutationError } from '@forge/cli-shared';
|
|
3
|
+
import { AppEnvironment, GraphQLClient, GraphQlMutationError, Pause } from '@forge/cli-shared';
|
|
4
4
|
import { AppUninstallationInput } from '@forge/cli-shared';
|
|
5
5
|
import { AppInstallSiteDetails, InstallAppClient } from './install-app-site';
|
|
6
6
|
import { Installation, ListAppInstallationsClient, UpgradeAppInstallationsClient } from '../service/installation-service';
|
|
7
7
|
import { UninstallAppClient, UninstallAppOutput } from './uninstall-app';
|
|
8
|
+
export declare const UNINSTALLATION_EVENT_POLL_INTERVAL = 500;
|
|
8
9
|
export declare const ALREADY_UPGRADED_CODE = "INSTALLATION_ALREADY_UPGRADED";
|
|
10
|
+
export declare class PermissionDeniedError extends GraphQlMutationError {
|
|
11
|
+
constructor(requestId?: string, appId?: string);
|
|
12
|
+
}
|
|
9
13
|
export declare class AlreadyInstalledError extends GraphQlMutationError {
|
|
10
14
|
constructor();
|
|
11
15
|
}
|
|
@@ -17,10 +21,14 @@ export declare class UpgradeError extends GraphQlMutationError {
|
|
|
17
21
|
}
|
|
18
22
|
export declare class EnvironmentNotFoundError extends Error {
|
|
19
23
|
}
|
|
20
|
-
export declare class
|
|
24
|
+
export declare class MissingTaskIdError extends Error {
|
|
25
|
+
}
|
|
26
|
+
export declare class InstallationRequestFailedError extends Error {
|
|
21
27
|
}
|
|
22
28
|
export declare class MissingAppError extends Error {
|
|
23
29
|
}
|
|
30
|
+
export declare class MissingAppUninstallTask extends Error {
|
|
31
|
+
}
|
|
24
32
|
export declare class InstallationNotFoundError extends Error {
|
|
25
33
|
}
|
|
26
34
|
export declare class UnknownSiteWithoutCloudIdError extends Error {
|
|
@@ -31,24 +39,22 @@ export declare class InvalidAtlassianSiteError extends Error {
|
|
|
31
39
|
}
|
|
32
40
|
export declare class InstallationsGraphqlClient implements InstallAppClient, ListAppInstallationsClient, UninstallAppClient, UpgradeAppInstallationsClient {
|
|
33
41
|
private readonly graphqlClient;
|
|
42
|
+
private readonly pause;
|
|
34
43
|
static buildInstallationContext(product: string, cloudId: string): string;
|
|
35
|
-
constructor(graphqlClient: GraphQLClient);
|
|
36
|
-
installAppIntoSite({ environmentKey, site, product, appId }: AppInstallSiteDetails): Promise<
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
upgradeInstallation({ site, product, environmentKey, appId }: AppInstallSiteDetails): Promise<{
|
|
41
|
-
installationId: string;
|
|
42
|
-
authorizationUrl: string | null | undefined;
|
|
43
|
-
}>;
|
|
44
|
-
uninstallApp(input: AppUninstallationInput): Promise<void>;
|
|
44
|
+
constructor(graphqlClient: GraphQLClient, pause: Pause);
|
|
45
|
+
installAppIntoSite({ environmentKey, site, product, appId }: AppInstallSiteDetails): Promise<void>;
|
|
46
|
+
upgradeInstallation({ site, product, environmentKey, appId }: AppInstallSiteDetails): Promise<void>;
|
|
47
|
+
private monitorAppInstallOrUpgrade;
|
|
48
|
+
uninstallApp(input: AppUninstallationInput): Promise<boolean>;
|
|
45
49
|
uninstallMultipleApps(apps: AppUninstallationInput[]): Promise<Partial<UninstallAppOutput>[]>;
|
|
46
50
|
listInstallations(appId: string): Promise<Installation[]>;
|
|
47
51
|
getInstallation(appId: string, installationId: string): Promise<Installation>;
|
|
52
|
+
private getAppInstallationTask;
|
|
53
|
+
private monitorUninstallApp;
|
|
48
54
|
private createCloudIdToHostnameMap;
|
|
49
55
|
private resolveInstallationsHostnames;
|
|
50
56
|
private getAllInstallations;
|
|
51
57
|
private getCloudId;
|
|
52
|
-
|
|
58
|
+
getVersions(appId: string, environmentKey: string, firstN?: number): Promise<AppEnvironment['versions']>;
|
|
53
59
|
}
|
|
54
60
|
//# sourceMappingURL=graphql-client.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graphql-client.d.ts","sourceRoot":"","sources":["../../src/installations/graphql-client.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAC1B,OAAO,
|
|
1
|
+
{"version":3,"file":"graphql-client.d.ts","sourceRoot":"","sources":["../../src/installations/graphql-client.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAC1B,OAAO,EACL,cAAc,EAGd,aAAa,EACb,oBAAoB,EAEpB,KAAK,EACN,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAEL,sBAAsB,EAQvB,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC7E,OAAO,EACL,YAAY,EACZ,0BAA0B,EAC1B,6BAA6B,EAC9B,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAEzE,eAAO,MAAM,kCAAkC,MAAM,CAAC;AAgBtD,eAAO,MAAM,qBAAqB,kCAAkC,CAAC;AAMrE,qBAAa,qBAAsB,SAAQ,oBAAoB;gBACjD,SAAS,SAAY,EAAE,KAAK,SAAY;CAGrD;AAED,qBAAa,qBAAsB,SAAQ,oBAAoB;;CAI9D;AAED,qBAAa,iBAAkB,SAAQ,oBAAoB;gBAC7C,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,SAAS;CAGtD;AAED,qBAAa,YAAa,SAAQ,oBAAoB;gBACxC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,SAAS;CAGtD;AAED,qBAAa,wBAAyB,SAAQ,KAAK;CAAG;AACtD,qBAAa,kBAAmB,SAAQ,KAAK;CAAG;AAChD,qBAAa,8BAA+B,SAAQ,KAAK;CAAG;AAC5D,qBAAa,eAAgB,SAAQ,KAAK;CAAG;AAC7C,qBAAa,uBAAwB,SAAQ,KAAK;CAAG;AACrD,qBAAa,yBAA0B,SAAQ,KAAK;CAAG;AAEvD,qBAAa,8BAA+B,SAAQ,KAAK;;CAIxD;AAED,qBAAa,yBAA0B,SAAQ,KAAK;gBACtC,GAAG,EAAE,GAAG;CAGrB;AAuBD,qBAAa,0BACX,YAAW,gBAAgB,EAAE,0BAA0B,EAAE,kBAAkB,EAAE,6BAA6B;IAW9F,OAAO,CAAC,QAAQ,CAAC,aAAa;IAAiB,OAAO,CAAC,QAAQ,CAAC,KAAK;WAVnE,wBAAwB,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;gBAU1C,aAAa,EAAE,aAAa,EAAmB,KAAK,EAAE,KAAK;IAE3E,kBAAkB,CAAC,EAAE,cAAc,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,qBAAqB;IAoDlF,mBAAmB,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,cAAc,EAAE,KAAK,EAAE,EAAE,qBAAqB;YA8ClF,0BAA0B;IAe3B,YAAY,CAAC,KAAK,EAAE,sBAAsB,GAAG,OAAO,CAAC,OAAO,CAAC;IAgC7D,qBAAqB,CAAC,IAAI,EAAE,sBAAsB,EAAE,GAAG,OAAO,CAAC,OAAO,CAAC,kBAAkB,CAAC,EAAE,CAAC;IAmB7F,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC;IAKzD,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC;YAS5E,sBAAsB;YA8BtB,mBAAmB;YAiBnB,0BAA0B;YAsC1B,6BAA6B;YAqC7B,mBAAmB;YAsCnB,UAAU;IAgBX,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,SAAI,GAAG,OAAO,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC;CAqCjH"}
|
|
@@ -1,50 +1,65 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.InstallationsGraphqlClient = exports.InvalidAtlassianSiteError = exports.UnknownSiteWithoutCloudIdError = exports.InstallationNotFoundError = exports.MissingAppError = exports.
|
|
3
|
+
exports.InstallationsGraphqlClient = exports.InvalidAtlassianSiteError = exports.UnknownSiteWithoutCloudIdError = exports.InstallationNotFoundError = exports.MissingAppUninstallTask = exports.MissingAppError = exports.InstallationRequestFailedError = exports.MissingTaskIdError = exports.EnvironmentNotFoundError = exports.UpgradeError = exports.InstallationError = exports.AlreadyInstalledError = exports.PermissionDeniedError = exports.ALREADY_UPGRADED_CODE = exports.UNINSTALLATION_EVENT_POLL_INTERVAL = void 0;
|
|
4
4
|
const cs_ari_1 = require("@forge/util/packages/cs-ari");
|
|
5
5
|
const cli_shared_1 = require("@forge/cli-shared");
|
|
6
6
|
const cli_shared_2 = require("@forge/cli-shared");
|
|
7
|
+
const cli_shared_3 = require("@forge/cli-shared");
|
|
8
|
+
exports.UNINSTALLATION_EVENT_POLL_INTERVAL = 500;
|
|
7
9
|
exports.ALREADY_UPGRADED_CODE = 'INSTALLATION_ALREADY_UPGRADED';
|
|
8
10
|
const ALREADY_INSTALLED_CODE = 'APP_ALREADY_INSTALLED';
|
|
11
|
+
const PERMISSION_DENIED = 'PERMISSION_DENIED';
|
|
12
|
+
class PermissionDeniedError extends cli_shared_1.GraphQlMutationError {
|
|
13
|
+
constructor(requestId = 'unknown', appId = 'unknown') {
|
|
14
|
+
super(cli_shared_3.Text.install.error.permissionsDeniedInstructions(requestId, appId), PERMISSION_DENIED);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
exports.PermissionDeniedError = PermissionDeniedError;
|
|
9
18
|
class AlreadyInstalledError extends cli_shared_1.GraphQlMutationError {
|
|
10
19
|
constructor() {
|
|
11
|
-
super(
|
|
20
|
+
super(cli_shared_3.Text.install.error.alreadyInstalledError, ALREADY_INSTALLED_CODE);
|
|
12
21
|
}
|
|
13
22
|
}
|
|
14
23
|
exports.AlreadyInstalledError = AlreadyInstalledError;
|
|
15
24
|
class InstallationError extends cli_shared_1.GraphQlMutationError {
|
|
16
25
|
constructor(message, code) {
|
|
17
|
-
super(
|
|
26
|
+
super(cli_shared_3.Text.install.error.serverSideInstallationError(message), code);
|
|
18
27
|
}
|
|
19
28
|
}
|
|
20
29
|
exports.InstallationError = InstallationError;
|
|
21
30
|
class UpgradeError extends cli_shared_1.GraphQlMutationError {
|
|
22
31
|
constructor(message, code) {
|
|
23
|
-
super(
|
|
32
|
+
super(cli_shared_3.Text.upgrade.error.serverSideInstallationError(message), code);
|
|
24
33
|
}
|
|
25
34
|
}
|
|
26
35
|
exports.UpgradeError = UpgradeError;
|
|
27
36
|
class EnvironmentNotFoundError extends Error {
|
|
28
37
|
}
|
|
29
38
|
exports.EnvironmentNotFoundError = EnvironmentNotFoundError;
|
|
30
|
-
class
|
|
39
|
+
class MissingTaskIdError extends Error {
|
|
40
|
+
}
|
|
41
|
+
exports.MissingTaskIdError = MissingTaskIdError;
|
|
42
|
+
class InstallationRequestFailedError extends Error {
|
|
31
43
|
}
|
|
32
|
-
exports.
|
|
44
|
+
exports.InstallationRequestFailedError = InstallationRequestFailedError;
|
|
33
45
|
class MissingAppError extends Error {
|
|
34
46
|
}
|
|
35
47
|
exports.MissingAppError = MissingAppError;
|
|
48
|
+
class MissingAppUninstallTask extends Error {
|
|
49
|
+
}
|
|
50
|
+
exports.MissingAppUninstallTask = MissingAppUninstallTask;
|
|
36
51
|
class InstallationNotFoundError extends Error {
|
|
37
52
|
}
|
|
38
53
|
exports.InstallationNotFoundError = InstallationNotFoundError;
|
|
39
54
|
class UnknownSiteWithoutCloudIdError extends Error {
|
|
40
55
|
constructor() {
|
|
41
|
-
super(
|
|
56
|
+
super(cli_shared_3.Text.installList.noCloudId);
|
|
42
57
|
}
|
|
43
58
|
}
|
|
44
59
|
exports.UnknownSiteWithoutCloudIdError = UnknownSiteWithoutCloudIdError;
|
|
45
60
|
class InvalidAtlassianSiteError extends Error {
|
|
46
61
|
constructor(url) {
|
|
47
|
-
super(
|
|
62
|
+
super(cli_shared_3.Text.install.error.invalidAtlassianSite(url));
|
|
48
63
|
}
|
|
49
64
|
}
|
|
50
65
|
exports.InvalidAtlassianSiteError = InvalidAtlassianSiteError;
|
|
@@ -65,8 +80,9 @@ const tenantContextsToCloudId = (url, contexts) => {
|
|
|
65
80
|
return context.cloudId;
|
|
66
81
|
};
|
|
67
82
|
class InstallationsGraphqlClient {
|
|
68
|
-
constructor(graphqlClient) {
|
|
83
|
+
constructor(graphqlClient, pause) {
|
|
69
84
|
this.graphqlClient = graphqlClient;
|
|
85
|
+
this.pause = pause;
|
|
70
86
|
}
|
|
71
87
|
static buildInstallationContext(product, cloudId) {
|
|
72
88
|
const ari = new cs_ari_1.ResourceIdentifier({
|
|
@@ -80,15 +96,16 @@ class InstallationsGraphqlClient {
|
|
|
80
96
|
const cloudId = await this.getCloudId(site);
|
|
81
97
|
const installationContext = InstallationsGraphqlClient.buildInstallationContext(product, cloudId);
|
|
82
98
|
const query = `
|
|
83
|
-
mutation
|
|
99
|
+
mutation forge_cli_installApplication($input: AppInstallationInput!) {
|
|
84
100
|
installApp(input: $input) {
|
|
85
101
|
success
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
102
|
+
taskId
|
|
103
|
+
errors {
|
|
104
|
+
message
|
|
105
|
+
extensions {
|
|
106
|
+
errorType
|
|
107
|
+
}
|
|
89
108
|
}
|
|
90
|
-
installationId
|
|
91
|
-
authorizationUrl
|
|
92
109
|
}
|
|
93
110
|
}
|
|
94
111
|
`;
|
|
@@ -96,34 +113,40 @@ class InstallationsGraphqlClient {
|
|
|
96
113
|
input: {
|
|
97
114
|
installationContext,
|
|
98
115
|
appId,
|
|
99
|
-
environmentKey
|
|
116
|
+
environmentKey,
|
|
117
|
+
async: true
|
|
100
118
|
}
|
|
101
119
|
};
|
|
102
|
-
const { response: { installApp: { success,
|
|
120
|
+
const { response: { installApp: { success, taskId, errors } }, requestId } = await this.graphqlClient.mutate(query, variables);
|
|
121
|
+
const error = cli_shared_2.getError(errors);
|
|
103
122
|
if (!success) {
|
|
104
|
-
if (
|
|
123
|
+
if (error.code === ALREADY_INSTALLED_CODE) {
|
|
105
124
|
throw new AlreadyInstalledError();
|
|
106
125
|
}
|
|
107
|
-
|
|
126
|
+
if (error.code === PERMISSION_DENIED) {
|
|
127
|
+
throw new PermissionDeniedError(requestId, cs_ari_1.parse(appId).resourceId);
|
|
128
|
+
}
|
|
129
|
+
throw new InstallationError(`${error.message} (requestId: ${requestId || 'unknown'})`, error.code);
|
|
108
130
|
}
|
|
109
|
-
if (!
|
|
110
|
-
throw new
|
|
131
|
+
if (!taskId) {
|
|
132
|
+
throw new MissingTaskIdError(error.message);
|
|
111
133
|
}
|
|
112
|
-
|
|
134
|
+
await this.monitorAppInstallOrUpgrade(taskId);
|
|
113
135
|
}
|
|
114
136
|
async upgradeInstallation({ site, product, environmentKey, appId }) {
|
|
115
137
|
const cloudId = await this.getCloudId(site);
|
|
116
138
|
const installationContext = InstallationsGraphqlClient.buildInstallationContext(product, cloudId);
|
|
117
139
|
const query = `
|
|
118
|
-
mutation
|
|
140
|
+
mutation forge_cli_upgradeApplication($input: AppInstallationUpgradeInput!) {
|
|
119
141
|
upgradeApp(input: $input) {
|
|
120
142
|
success
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
143
|
+
taskId
|
|
144
|
+
errors {
|
|
145
|
+
message
|
|
146
|
+
extensions {
|
|
147
|
+
errorType
|
|
148
|
+
}
|
|
124
149
|
}
|
|
125
|
-
installationId
|
|
126
|
-
authorizationUrl
|
|
127
150
|
}
|
|
128
151
|
}
|
|
129
152
|
`;
|
|
@@ -131,41 +154,63 @@ class InstallationsGraphqlClient {
|
|
|
131
154
|
input: {
|
|
132
155
|
installationContext,
|
|
133
156
|
appId,
|
|
134
|
-
environmentKey
|
|
157
|
+
environmentKey,
|
|
158
|
+
async: true
|
|
135
159
|
}
|
|
136
160
|
};
|
|
137
|
-
const { response: { upgradeApp: { success,
|
|
161
|
+
const { response: { upgradeApp: { success, errors, taskId } }, requestId } = await this.graphqlClient.mutate(query, variables);
|
|
162
|
+
const error = cli_shared_2.getError(errors);
|
|
138
163
|
if (!success) {
|
|
139
|
-
throw new UpgradeError(`${message} (requestId: ${requestId || 'unknown'})`,
|
|
164
|
+
throw new UpgradeError(`${error.message} (requestId: ${requestId || 'unknown'})`, error.code);
|
|
140
165
|
}
|
|
141
|
-
if (!
|
|
142
|
-
throw new
|
|
166
|
+
if (!taskId) {
|
|
167
|
+
throw new MissingTaskIdError(error.message);
|
|
168
|
+
}
|
|
169
|
+
await this.monitorAppInstallOrUpgrade(taskId);
|
|
170
|
+
}
|
|
171
|
+
async monitorAppInstallOrUpgrade(taskId) {
|
|
172
|
+
let status = cli_shared_1.AppTaskState.Pending;
|
|
173
|
+
while (status !== cli_shared_1.AppTaskState.Complete) {
|
|
174
|
+
const { state, errors } = await this.getAppInstallationTask(taskId);
|
|
175
|
+
status = state;
|
|
176
|
+
if (status === cli_shared_1.AppTaskState.Failed) {
|
|
177
|
+
throw new InstallationRequestFailedError((errors === null || errors === void 0 ? void 0 : errors[0].message) || undefined);
|
|
178
|
+
}
|
|
179
|
+
if (status !== cli_shared_1.AppTaskState.Complete)
|
|
180
|
+
await this.pause(exports.UNINSTALLATION_EVENT_POLL_INTERVAL);
|
|
143
181
|
}
|
|
144
|
-
return { installationId, authorizationUrl };
|
|
145
182
|
}
|
|
146
183
|
async uninstallApp(input) {
|
|
147
184
|
const query = `
|
|
148
|
-
mutation
|
|
185
|
+
mutation forge_cli_uninstallApplication($input: AppUninstallationInput!) {
|
|
149
186
|
uninstallApp(input: $input) {
|
|
150
187
|
success
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
188
|
+
taskId
|
|
189
|
+
errors {
|
|
190
|
+
message
|
|
191
|
+
extensions {
|
|
192
|
+
errorType
|
|
193
|
+
}
|
|
154
194
|
}
|
|
155
195
|
}
|
|
156
196
|
}
|
|
157
197
|
`;
|
|
158
|
-
const { response: { uninstallApp: { success,
|
|
198
|
+
const { response: { uninstallApp: { success, errors, taskId } }, requestId } = await this.graphqlClient.mutate(query, { input });
|
|
199
|
+
const error = cli_shared_2.getError(errors);
|
|
159
200
|
if (!success) {
|
|
160
|
-
throw new cli_shared_1.GraphQlMutationError(`${message} (requestId: ${requestId || 'unknown'})`,
|
|
201
|
+
throw new cli_shared_1.GraphQlMutationError(`${error.message} (requestId: ${requestId || 'unknown'})`, error.code);
|
|
161
202
|
}
|
|
203
|
+
return this.monitorUninstallApp(taskId);
|
|
162
204
|
}
|
|
163
205
|
async uninstallMultipleApps(apps) {
|
|
164
206
|
const uninstallsResult = [];
|
|
165
207
|
for (const app of apps) {
|
|
166
208
|
try {
|
|
167
|
-
await Promise.all([
|
|
168
|
-
|
|
209
|
+
const [success] = await Promise.all([
|
|
210
|
+
this.uninstallApp(app),
|
|
211
|
+
new Promise((resolve) => setTimeout(resolve, 1000))
|
|
212
|
+
]);
|
|
213
|
+
uninstallsResult.push(Object.assign(Object.assign({}, app), { successful: success }));
|
|
169
214
|
}
|
|
170
215
|
catch (err) {
|
|
171
216
|
uninstallsResult.push(Object.assign(Object.assign({}, app), { successful: false }));
|
|
@@ -183,21 +228,65 @@ class InstallationsGraphqlClient {
|
|
|
183
228
|
if (matchedInstallation) {
|
|
184
229
|
return matchedInstallation;
|
|
185
230
|
}
|
|
186
|
-
throw new InstallationNotFoundError(
|
|
231
|
+
throw new InstallationNotFoundError(cli_shared_3.Text.installationId.errors.notFound(installationId));
|
|
232
|
+
}
|
|
233
|
+
async getAppInstallationTask(taskId) {
|
|
234
|
+
const query = `
|
|
235
|
+
query forge_cli_getInstallationTask($id: ID!) {
|
|
236
|
+
appInstallationTask(id: $id) {
|
|
237
|
+
state
|
|
238
|
+
errors {
|
|
239
|
+
message
|
|
240
|
+
extensions {
|
|
241
|
+
errorType
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
`;
|
|
247
|
+
const { appInstallationTask } = await this.graphqlClient.query(query, {
|
|
248
|
+
id: taskId
|
|
249
|
+
});
|
|
250
|
+
if (!appInstallationTask) {
|
|
251
|
+
throw new MissingAppUninstallTask(cli_shared_3.Text.uninstall.missingUninstallTask);
|
|
252
|
+
}
|
|
253
|
+
const { state, errors } = appInstallationTask;
|
|
254
|
+
return {
|
|
255
|
+
errors,
|
|
256
|
+
state
|
|
257
|
+
};
|
|
258
|
+
}
|
|
259
|
+
async monitorUninstallApp(taskId) {
|
|
260
|
+
let status = cli_shared_1.AppTaskState.Pending;
|
|
261
|
+
while (status !== cli_shared_1.AppTaskState.Complete) {
|
|
262
|
+
const { state } = await this.getAppInstallationTask(taskId);
|
|
263
|
+
status = state;
|
|
264
|
+
if (status === cli_shared_1.AppTaskState.Failed) {
|
|
265
|
+
return false;
|
|
266
|
+
}
|
|
267
|
+
if (status !== cli_shared_1.AppTaskState.Complete)
|
|
268
|
+
await this.pause(exports.UNINSTALLATION_EVENT_POLL_INTERVAL);
|
|
269
|
+
}
|
|
270
|
+
return true;
|
|
187
271
|
}
|
|
188
272
|
async createCloudIdToHostnameMap(cloudIds) {
|
|
189
|
-
const
|
|
273
|
+
const MAX_CLOUD_IDS_AT_ONCE = 20;
|
|
274
|
+
const cloudIdsChunks = [];
|
|
275
|
+
for (let i = 0; i < cloudIds.length; i += MAX_CLOUD_IDS_AT_ONCE) {
|
|
276
|
+
cloudIdsChunks.push(cloudIds.slice(i, i + MAX_CLOUD_IDS_AT_ONCE));
|
|
277
|
+
}
|
|
190
278
|
const query = `
|
|
191
|
-
query
|
|
279
|
+
query forge_cli_getHostnameForTenantContexts($cloudIds: [ID!]!) {
|
|
192
280
|
tenantContexts(cloudIds: $cloudIds) {
|
|
193
281
|
hostName
|
|
194
282
|
}
|
|
195
283
|
}
|
|
196
284
|
`;
|
|
197
|
-
const
|
|
198
|
-
cloudIds
|
|
199
|
-
});
|
|
200
|
-
const tenantContexts = result.tenantContexts || [];
|
|
285
|
+
const results = await Promise.all(cloudIdsChunks.map((cloudIdsChunk) => this.graphqlClient.query(query, {
|
|
286
|
+
cloudIds: cloudIdsChunk
|
|
287
|
+
})));
|
|
288
|
+
const tenantContexts = [].concat(...results.map((result) => result.tenantContexts || []));
|
|
289
|
+
const cloudIdToHostname = {};
|
|
201
290
|
cloudIds.forEach((cloudId, index) => {
|
|
202
291
|
const maybeHostname = tenantToHostname(tenantContexts[index]);
|
|
203
292
|
cloudIdToHostname[cloudId] = maybeHostname || cloudId;
|
|
@@ -225,6 +314,7 @@ class InstallationsGraphqlClient {
|
|
|
225
314
|
id: installation.id,
|
|
226
315
|
product: context.resourceOwner,
|
|
227
316
|
environmentKey: environment,
|
|
317
|
+
context: installation.installationContext,
|
|
228
318
|
site,
|
|
229
319
|
version: installation.version || {
|
|
230
320
|
isLatest: false
|
|
@@ -234,7 +324,7 @@ class InstallationsGraphqlClient {
|
|
|
234
324
|
}
|
|
235
325
|
async getAllInstallations(appId) {
|
|
236
326
|
const query = `
|
|
237
|
-
query
|
|
327
|
+
query forge_cli_getApplicationInstallations($id: ID!) {
|
|
238
328
|
app(id: $id) {
|
|
239
329
|
environments {
|
|
240
330
|
key
|
|
@@ -255,18 +345,20 @@ class InstallationsGraphqlClient {
|
|
|
255
345
|
}
|
|
256
346
|
const output = [];
|
|
257
347
|
for (const { key, installations } of result.app.environments) {
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
348
|
+
if (installations) {
|
|
349
|
+
for (const installation of installations) {
|
|
350
|
+
output.push({
|
|
351
|
+
environment: key,
|
|
352
|
+
installation
|
|
353
|
+
});
|
|
354
|
+
}
|
|
263
355
|
}
|
|
264
356
|
}
|
|
265
357
|
return output;
|
|
266
358
|
}
|
|
267
359
|
async getCloudId(site) {
|
|
268
360
|
const query = `
|
|
269
|
-
query
|
|
361
|
+
query forge_cli_getCloudIfForTenantContexts($hostNames: [String!]) {
|
|
270
362
|
tenantContexts(hostNames: $hostNames) {
|
|
271
363
|
cloudId
|
|
272
364
|
}
|
|
@@ -278,24 +370,39 @@ class InstallationsGraphqlClient {
|
|
|
278
370
|
const tenantContexts = result.tenantContexts || [];
|
|
279
371
|
return tenantContextsToCloudId(site, tenantContexts);
|
|
280
372
|
}
|
|
281
|
-
async
|
|
373
|
+
async getVersions(appId, environmentKey, firstN = 1) {
|
|
282
374
|
const query = `
|
|
283
|
-
query
|
|
375
|
+
query forge_cli_getApplicationEnvironmentLatestVersions($appId: ID!, $environmentKey: String!, $firstN: Int!) {
|
|
284
376
|
app(id: $appId) {
|
|
285
377
|
environmentByKey(key: $environmentKey) {
|
|
286
|
-
|
|
378
|
+
versions(first: $firstN) {
|
|
379
|
+
nodes {
|
|
380
|
+
permissions {
|
|
381
|
+
egress {
|
|
382
|
+
addresses
|
|
383
|
+
}
|
|
384
|
+
scopes {
|
|
385
|
+
key
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
}
|
|
287
390
|
}
|
|
288
391
|
}
|
|
289
392
|
}
|
|
290
393
|
`;
|
|
291
|
-
const result = await this.graphqlClient.query(query, {
|
|
394
|
+
const result = await this.graphqlClient.query(query, {
|
|
395
|
+
appId,
|
|
396
|
+
environmentKey,
|
|
397
|
+
firstN
|
|
398
|
+
});
|
|
292
399
|
if (!result.app) {
|
|
293
400
|
throw new MissingAppError();
|
|
294
401
|
}
|
|
295
402
|
if (!result.app.environmentByKey) {
|
|
296
403
|
throw new EnvironmentNotFoundError();
|
|
297
404
|
}
|
|
298
|
-
return result.app.environmentByKey.
|
|
405
|
+
return result.app.environmentByKey.versions;
|
|
299
406
|
}
|
|
300
407
|
}
|
|
301
408
|
exports.InstallationsGraphqlClient = InstallationsGraphqlClient;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import { URL } from 'url';
|
|
3
3
|
import { AppConfigProvider } from '@forge/cli-shared';
|
|
4
|
-
export declare const REDIRECT_URL_3LO = "https://cli-3lo--app.ap-southeast-2.dev.public.atl-paas.net/result.html";
|
|
5
4
|
export interface TriggerAppSiteInstallDetails {
|
|
6
5
|
site: URL;
|
|
7
6
|
product: string;
|
|
@@ -10,22 +9,13 @@ export interface TriggerAppSiteInstallDetails {
|
|
|
10
9
|
export interface AppInstallSiteDetails extends TriggerAppSiteInstallDetails {
|
|
11
10
|
appId: string;
|
|
12
11
|
}
|
|
13
|
-
export interface InstallationResult {
|
|
14
|
-
installationId: string;
|
|
15
|
-
authorizationUrl?: string;
|
|
16
|
-
}
|
|
17
12
|
export interface InstallAppClient {
|
|
18
|
-
installAppIntoSite(appInstallDetails: AppInstallSiteDetails): Promise<
|
|
13
|
+
installAppIntoSite(appInstallDetails: AppInstallSiteDetails): Promise<void>;
|
|
19
14
|
}
|
|
20
15
|
export declare class InstallAppSiteCommand {
|
|
21
16
|
private readonly getAppConfig;
|
|
22
17
|
private readonly installAppClient;
|
|
23
18
|
constructor(getAppConfig: AppConfigProvider, installAppClient: InstallAppClient);
|
|
24
|
-
execute({ environmentKey, site, product }: TriggerAppSiteInstallDetails): Promise<
|
|
25
|
-
installationId: string;
|
|
26
|
-
authorizationUrl?: string | undefined;
|
|
27
|
-
appName: string;
|
|
28
|
-
}>;
|
|
29
|
-
private addRedirectUrl;
|
|
19
|
+
execute({ environmentKey, site, product }: TriggerAppSiteInstallDetails): Promise<void>;
|
|
30
20
|
}
|
|
31
21
|
//# sourceMappingURL=install-app-site.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"install-app-site.d.ts","sourceRoot":"","sources":["../../src/installations/install-app-site.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAC1B,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAEtD,
|
|
1
|
+
{"version":3,"file":"install-app-site.d.ts","sourceRoot":"","sources":["../../src/installations/install-app-site.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAC1B,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAEtD,MAAM,WAAW,4BAA4B;IAC3C,IAAI,EAAE,GAAG,CAAC;IACV,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,qBAAsB,SAAQ,4BAA4B;IACzE,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,gBAAgB;IAC/B,kBAAkB,CAAC,iBAAiB,EAAE,qBAAqB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC7E;AAED,qBAAa,qBAAqB;IACpB,OAAO,CAAC,QAAQ,CAAC,YAAY;IAAqB,OAAO,CAAC,QAAQ,CAAC,gBAAgB;gBAAlE,YAAY,EAAE,iBAAiB,EAAmB,gBAAgB,EAAE,gBAAgB;IAEpG,OAAO,CAAC,EAAE,cAAc,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,4BAA4B;CASrF"}
|
|
@@ -1,30 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.InstallAppSiteCommand =
|
|
4
|
-
const url_1 = require("url");
|
|
5
|
-
exports.REDIRECT_URL_3LO = 'https://cli-3lo--app.ap-southeast-2.dev.public.atl-paas.net/result.html';
|
|
3
|
+
exports.InstallAppSiteCommand = void 0;
|
|
6
4
|
class InstallAppSiteCommand {
|
|
7
5
|
constructor(getAppConfig, installAppClient) {
|
|
8
6
|
this.getAppConfig = getAppConfig;
|
|
9
7
|
this.installAppClient = installAppClient;
|
|
10
8
|
}
|
|
11
9
|
async execute({ environmentKey, site, product }) {
|
|
12
|
-
const { id: appId
|
|
13
|
-
|
|
10
|
+
const { id: appId } = await this.getAppConfig();
|
|
11
|
+
return await this.installAppClient.installAppIntoSite({
|
|
14
12
|
appId,
|
|
15
13
|
environmentKey,
|
|
16
14
|
site,
|
|
17
15
|
product
|
|
18
16
|
});
|
|
19
|
-
if (result.authorizationUrl) {
|
|
20
|
-
result.authorizationUrl = this.addRedirectUrl(result.authorizationUrl);
|
|
21
|
-
}
|
|
22
|
-
return Object.assign({ appName }, result);
|
|
23
|
-
}
|
|
24
|
-
addRedirectUrl(authorizationUrl) {
|
|
25
|
-
const url = new url_1.URL(authorizationUrl);
|
|
26
|
-
url.searchParams.append('redirectUrl', exports.REDIRECT_URL_3LO);
|
|
27
|
-
return url.toString();
|
|
28
17
|
}
|
|
29
18
|
}
|
|
30
19
|
exports.InstallAppSiteCommand = InstallAppSiteCommand;
|
|
@@ -2,16 +2,18 @@ import { AppConfigProvider } from '@forge/cli-shared';
|
|
|
2
2
|
import { AppUninstallationInput } from '@forge/cli-shared';
|
|
3
3
|
import { Installation } from '../service/installation-service';
|
|
4
4
|
export interface UninstallAppOutput {
|
|
5
|
-
appName: string;
|
|
6
5
|
product: string;
|
|
7
6
|
site: string;
|
|
8
7
|
environmentKey: string;
|
|
9
8
|
successful?: boolean;
|
|
10
9
|
}
|
|
10
|
+
export interface AsyncAppUninstallationInput extends AppUninstallationInput {
|
|
11
|
+
async: true;
|
|
12
|
+
}
|
|
11
13
|
export interface UninstallAppClient {
|
|
12
|
-
uninstallApp(input: AppUninstallationInput): Promise<void>;
|
|
13
|
-
uninstallMultipleApps(input: AppUninstallationInput[]): Promise<Partial<UninstallAppOutput>[]>;
|
|
14
14
|
getInstallation(appId: string, installationId: string): Promise<Installation>;
|
|
15
|
+
uninstallApp(input: AsyncAppUninstallationInput): Promise<boolean>;
|
|
16
|
+
uninstallMultipleApps(input: AsyncAppUninstallationInput[]): Promise<Partial<UninstallAppOutput>[]>;
|
|
15
17
|
}
|
|
16
18
|
export declare class UninstallAppCommand {
|
|
17
19
|
private readonly getAppConfig;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uninstall-app.d.ts","sourceRoot":"","sources":["../../src/installations/uninstall-app.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAE/D,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,MAAM,CAAC;IAChB,
|
|
1
|
+
{"version":3,"file":"uninstall-app.d.ts","sourceRoot":"","sources":["../../src/installations/uninstall-app.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAE/D,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,cAAc,EAAE,MAAM,CAAC;IACvB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,MAAM,WAAW,2BAA4B,SAAQ,sBAAsB;IACzE,KAAK,EAAE,IAAI,CAAC;CACb;AAED,MAAM,WAAW,kBAAkB;IACjC,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;IAC9E,YAAY,CAAC,KAAK,EAAE,2BAA2B,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACnE,qBAAqB,CAAC,KAAK,EAAE,2BAA2B,EAAE,GAAG,OAAO,CAAC,OAAO,CAAC,kBAAkB,CAAC,EAAE,CAAC,CAAC;CACrG;AAED,qBAAa,mBAAmB;IAClB,OAAO,CAAC,QAAQ,CAAC,YAAY;IAAqB,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAAxD,YAAY,EAAE,iBAAiB,EAAmB,MAAM,EAAE,kBAAkB;IAE5F,OAAO,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAY5D,YAAY,CACvB,eAAe,GAAE,MAAM,EAAO,EAC9B,iBAAiB,CAAC,EAAE,YAAY,EAAE,GACjC,OAAO,CAAC,kBAAkB,EAAE,CAAC;CA4BjC"}
|
|
@@ -7,18 +7,18 @@ class UninstallAppCommand {
|
|
|
7
7
|
this.client = client;
|
|
8
8
|
}
|
|
9
9
|
async execute(installationId) {
|
|
10
|
-
const { id: appId
|
|
10
|
+
const { id: appId } = await this.getAppConfig();
|
|
11
11
|
const { product, site, environmentKey } = await this.client.getInstallation(appId, installationId);
|
|
12
|
-
await this.client.uninstallApp({ appId, environmentKey, installationId });
|
|
12
|
+
const success = await this.client.uninstallApp({ appId, environmentKey, installationId, async: true });
|
|
13
13
|
return {
|
|
14
|
-
appName,
|
|
15
14
|
product,
|
|
16
15
|
site,
|
|
17
|
-
environmentKey
|
|
16
|
+
environmentKey,
|
|
17
|
+
successful: success
|
|
18
18
|
};
|
|
19
19
|
}
|
|
20
20
|
async batchExecute(installationIds = [], installationInfos) {
|
|
21
|
-
const { id: appId
|
|
21
|
+
const { id: appId } = await this.getAppConfig();
|
|
22
22
|
let appsInstallInfo;
|
|
23
23
|
if (installationInfos && installationInfos.length) {
|
|
24
24
|
appsInstallInfo = installationInfos;
|
|
@@ -29,10 +29,10 @@ class UninstallAppCommand {
|
|
|
29
29
|
const uninstallOutput = await this.client.uninstallMultipleApps(appsInstallInfo.map((installInfo) => ({
|
|
30
30
|
appId,
|
|
31
31
|
environmentKey: installInfo.environmentKey,
|
|
32
|
-
installationId: installInfo.id
|
|
32
|
+
installationId: installInfo.id,
|
|
33
|
+
async: true
|
|
33
34
|
})));
|
|
34
35
|
return appsInstallInfo.map(({ product, site, environmentKey }, index) => ({
|
|
35
|
-
appName,
|
|
36
36
|
product,
|
|
37
37
|
site,
|
|
38
38
|
environmentKey,
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { GraphQLClient } from '@forge/cli-shared';
|
|
2
|
+
import { AppEnvironmentMigrationKeys } from '../service/migration-keys-service';
|
|
3
|
+
export declare class GraphqlClient {
|
|
4
|
+
private readonly graphqlClient;
|
|
5
|
+
constructor(graphqlClient: GraphQLClient);
|
|
6
|
+
getLatestMigrationKeys(appId: string, environmentKey: string): Promise<AppEnvironmentMigrationKeys>;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=graphql-client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graphql-client.d.ts","sourceRoot":"","sources":["../../src/migration-keys/graphql-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAA+C,MAAM,mBAAmB,CAAC;AAC/F,OAAO,EAAE,2BAA2B,EAAE,MAAM,mCAAmC,CAAC;AAChF,qBAAa,aAAa;IACZ,OAAO,CAAC,QAAQ,CAAC,aAAa;gBAAb,aAAa,EAAE,aAAa;IAE5C,sBAAsB,CAAC,KAAK,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,2BAA2B,CAAC;CA+CjH"}
|