@forge/cli 0.0.0-experimental-c3effe3 → 0.0.0-experimental-820808c
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 +21 -7
- package/npm-shrinkwrap.json +111 -5108
- package/out/analytics-client/analytics-client.d.ts +0 -24
- package/out/analytics-client/analytics-client.d.ts.map +1 -1
- package/out/analytics-client/analytics-client.js +0 -115
- package/out/analytics-client/analytics-message-handler.d.ts +1 -5
- package/out/analytics-client/analytics-message-handler.d.ts.map +1 -1
- package/out/analytics-client/analytics-message-handler.js +2 -30
- package/out/autocomplete/autocomplete-config.json +2 -242
- package/out/bin/cli.d.ts +0 -1
- package/out/bin/cli.d.ts.map +1 -1
- package/out/bin/cli.js +1 -4
- package/out/bin/postinstall.d.ts +0 -1
- package/out/bin/postinstall.js +1 -22
- package/out/storage/local-file-storage.d.ts +0 -2
- package/out/storage/local-file-storage.d.ts.map +1 -1
- package/out/storage/local-file-storage.js +1 -9
- package/package.json +3 -44
- package/out/autocomplete/index.d.ts +0 -5
- package/out/autocomplete/index.d.ts.map +0 -1
- package/out/autocomplete/index.js +0 -40
- package/out/autocomplete/types.d.ts +0 -14
- package/out/autocomplete/types.d.ts.map +0 -1
- package/out/autocomplete/types.js +0 -2
- package/out/autocomplete/util.d.ts +0 -6
- package/out/autocomplete/util.d.ts.map +0 -1
- package/out/autocomplete/util.js +0 -13
- package/out/command-line/anon-user-id.d.ts +0 -3
- package/out/command-line/anon-user-id.d.ts.map +0 -1
- package/out/command-line/anon-user-id.js +0 -17
- package/out/command-line/command.d.ts +0 -81
- package/out/command-line/command.d.ts.map +0 -1
- package/out/command-line/command.js +0 -382
- package/out/command-line/controller/assertUnreachable.d.ts +0 -2
- package/out/command-line/controller/assertUnreachable.d.ts.map +0 -1
- package/out/command-line/controller/assertUnreachable.js +0 -7
- package/out/command-line/controller/autocomplete-controller.d.ts +0 -12
- package/out/command-line/controller/autocomplete-controller.d.ts.map +0 -1
- package/out/command-line/controller/autocomplete-controller.js +0 -54
- package/out/command-line/controller/deploy-controller.d.ts +0 -43
- package/out/command-line/controller/deploy-controller.d.ts.map +0 -1
- package/out/command-line/controller/deploy-controller.js +0 -139
- package/out/command-line/controller/feedback-controller.d.ts +0 -9
- package/out/command-line/controller/feedback-controller.d.ts.map +0 -1
- package/out/command-line/controller/feedback-controller.js +0 -19
- package/out/command-line/controller/getNodeVersion.d.ts +0 -2
- package/out/command-line/controller/getNodeVersion.d.ts.map +0 -1
- package/out/command-line/controller/getNodeVersion.js +0 -7
- package/out/command-line/controller/install-controller.d.ts +0 -35
- package/out/command-line/controller/install-controller.d.ts.map +0 -1
- package/out/command-line/controller/install-controller.js +0 -154
- package/out/command-line/controller/lint-controller.d.ts +0 -9
- package/out/command-line/controller/lint-controller.d.ts.map +0 -1
- package/out/command-line/controller/lint-controller.js +0 -20
- package/out/command-line/controller/pre-command-controller.d.ts +0 -25
- package/out/command-line/controller/pre-command-controller.d.ts.map +0 -1
- package/out/command-line/controller/pre-command-controller.js +0 -57
- package/out/command-line/controller/prerequisites-controller.d.ts +0 -11
- package/out/command-line/controller/prerequisites-controller.d.ts.map +0 -1
- package/out/command-line/controller/prerequisites-controller.js +0 -34
- package/out/command-line/controller/settings-controller.d.ts +0 -19
- package/out/command-line/controller/settings-controller.d.ts.map +0 -1
- package/out/command-line/controller/settings-controller.js +0 -48
- package/out/command-line/controller/stubController.d.ts +0 -9
- package/out/command-line/controller/stubController.d.ts.map +0 -1
- package/out/command-line/controller/stubController.js +0 -15
- package/out/command-line/controller/tunnel-controller.d.ts +0 -14
- package/out/command-line/controller/tunnel-controller.d.ts.map +0 -1
- package/out/command-line/controller/tunnel-controller.js +0 -43
- package/out/command-line/dependency-injection.d.ts +0 -69
- package/out/command-line/dependency-injection.d.ts.map +0 -1
- package/out/command-line/dependency-injection.js +0 -188
- package/out/command-line/environment.d.ts +0 -2
- package/out/command-line/environment.d.ts.map +0 -1
- package/out/command-line/environment.js +0 -15
- package/out/command-line/errors.d.ts +0 -6
- package/out/command-line/errors.d.ts.map +0 -1
- package/out/command-line/errors.js +0 -12
- package/out/command-line/index.d.ts +0 -5
- package/out/command-line/index.d.ts.map +0 -1
- package/out/command-line/index.js +0 -66
- package/out/command-line/register-app-commands.d.ts +0 -10
- package/out/command-line/register-app-commands.d.ts.map +0 -1
- package/out/command-line/register-app-commands.js +0 -128
- package/out/command-line/register-authentication-command.d.ts +0 -16
- package/out/command-line/register-authentication-command.d.ts.map +0 -1
- package/out/command-line/register-authentication-command.js +0 -92
- package/out/command-line/register-autocomplete-commands.d.ts +0 -3
- package/out/command-line/register-autocomplete-commands.d.ts.map +0 -1
- package/out/command-line/register-autocomplete-commands.js +0 -13
- package/out/command-line/register-deployment-commands.d.ts +0 -22
- package/out/command-line/register-deployment-commands.d.ts.map +0 -1
- package/out/command-line/register-deployment-commands.js +0 -15
- package/out/command-line/register-environment-variables-commands.d.ts +0 -3
- package/out/command-line/register-environment-variables-commands.d.ts.map +0 -1
- package/out/command-line/register-environment-variables-commands.js +0 -99
- package/out/command-line/register-feedback-commands.d.ts +0 -3
- package/out/command-line/register-feedback-commands.d.ts.map +0 -1
- package/out/command-line/register-feedback-commands.js +0 -31
- package/out/command-line/register-installation-commands.d.ts +0 -6
- package/out/command-line/register-installation-commands.d.ts.map +0 -1
- package/out/command-line/register-installation-commands.js +0 -140
- package/out/command-line/register-lint-command.d.ts +0 -8
- package/out/command-line/register-lint-command.d.ts.map +0 -1
- package/out/command-line/register-lint-command.js +0 -15
- package/out/command-line/register-log-commands.d.ts +0 -4
- package/out/command-line/register-log-commands.d.ts.map +0 -1
- package/out/command-line/register-log-commands.js +0 -138
- package/out/command-line/register-providers-commands.d.ts +0 -3
- package/out/command-line/register-providers-commands.d.ts.map +0 -1
- package/out/command-line/register-providers-commands.js +0 -43
- package/out/command-line/register-settings-commands.d.ts +0 -3
- package/out/command-line/register-settings-commands.d.ts.map +0 -1
- package/out/command-line/register-settings-commands.js +0 -37
- package/out/command-line/register-tunnel-commands.d.ts +0 -3
- package/out/command-line/register-tunnel-commands.d.ts.map +0 -1
- package/out/command-line/register-tunnel-commands.js +0 -14
- package/out/command-line/register-webtrigger-commands.d.ts +0 -3
- package/out/command-line/register-webtrigger-commands.d.ts.map +0 -1
- package/out/command-line/register-webtrigger-commands.js +0 -55
- package/out/command-line/unique-machine-id.d.ts +0 -3
- package/out/command-line/unique-machine-id.d.ts.map +0 -1
- package/out/command-line/unique-machine-id.js +0 -18
- package/out/command-line/version-info.d.ts +0 -8
- package/out/command-line/version-info.d.ts.map +0 -1
- package/out/command-line/version-info.js +0 -34
- package/out/command-line/view/analytics-settings-view.d.ts +0 -7
- package/out/command-line/view/analytics-settings-view.d.ts.map +0 -1
- package/out/command-line/view/analytics-settings-view.js +0 -18
- package/out/command-line/view/deploy-view.d.ts +0 -21
- package/out/command-line/view/deploy-view.d.ts.map +0 -1
- package/out/command-line/view/deploy-view.js +0 -58
- package/out/command-line/view/install-view.d.ts +0 -18
- package/out/command-line/view/install-view.d.ts.map +0 -1
- package/out/command-line/view/install-view.js +0 -55
- package/out/command-line/view/lint-view.d.ts +0 -12
- package/out/command-line/view/lint-view.d.ts.map +0 -1
- package/out/command-line/view/lint-view.js +0 -31
- package/out/command-line/view/lite-lint-view.d.ts +0 -10
- package/out/command-line/view/lite-lint-view.d.ts.map +0 -1
- package/out/command-line/view/lite-lint-view.js +0 -18
- package/out/command-line/view/settings-view.d.ts +0 -8
- package/out/command-line/view/settings-view.d.ts.map +0 -1
- package/out/command-line/view/settings-view.js +0 -21
- package/out/command-line/view/tunnel-view.d.ts +0 -18
- package/out/command-line/view/tunnel-view.d.ts.map +0 -1
- package/out/command-line/view/tunnel-view.js +0 -89
- package/out/deploy/deployer/deploy-monitor-graphql-client.d.ts +0 -24
- package/out/deploy/deployer/deploy-monitor-graphql-client.d.ts.map +0 -1
- package/out/deploy/deployer/deploy-monitor-graphql-client.js +0 -57
- package/out/deploy/deployer/deployer.d.ts +0 -31
- package/out/deploy/deployer/deployer.d.ts.map +0 -1
- package/out/deploy/deployer/deployer.js +0 -154
- package/out/deploy/deployer/index.d.ts +0 -4
- package/out/deploy/deployer/index.d.ts.map +0 -1
- package/out/deploy/deployer/index.js +0 -6
- package/out/deploy/deployer/trigger-deploy-graphql-client.d.ts +0 -19
- package/out/deploy/deployer/trigger-deploy-graphql-client.d.ts.map +0 -1
- package/out/deploy/deployer/trigger-deploy-graphql-client.js +0 -45
- package/out/deploy/index.d.ts +0 -5
- package/out/deploy/index.d.ts.map +0 -1
- package/out/deploy/index.js +0 -7
- package/out/deploy/package-upload-deploy.d.ts +0 -18
- package/out/deploy/package-upload-deploy.d.ts.map +0 -1
- package/out/deploy/package-upload-deploy.js +0 -28
- package/out/deploy/packager/archiver.d.ts +0 -24
- package/out/deploy/packager/archiver.d.ts.map +0 -1
- package/out/deploy/packager/archiver.js +0 -62
- package/out/deploy/packager/index.d.ts +0 -3
- package/out/deploy/packager/index.d.ts.map +0 -1
- package/out/deploy/packager/index.js +0 -5
- package/out/deploy/packager/packager.d.ts +0 -35
- package/out/deploy/packager/packager.d.ts.map +0 -1
- package/out/deploy/packager/packager.js +0 -61
- package/out/deploy/uploader/artifact-graphql-client.d.ts +0 -26
- package/out/deploy/uploader/artifact-graphql-client.d.ts.map +0 -1
- package/out/deploy/uploader/artifact-graphql-client.js +0 -92
- package/out/deploy/uploader/index.d.ts +0 -3
- package/out/deploy/uploader/index.d.ts.map +0 -1
- package/out/deploy/uploader/index.js +0 -5
- package/out/deploy/uploader/uploader.d.ts +0 -19
- package/out/deploy/uploader/uploader.d.ts.map +0 -1
- package/out/deploy/uploader/uploader.js +0 -43
- package/out/environment-variables/delete-environment-variable.d.ts +0 -18
- package/out/environment-variables/delete-environment-variable.d.ts.map +0 -1
- package/out/environment-variables/delete-environment-variable.js +0 -14
- package/out/environment-variables/graphql-client.d.ts +0 -16
- package/out/environment-variables/graphql-client.d.ts.map +0 -1
- package/out/environment-variables/graphql-client.js +0 -105
- package/out/environment-variables/list-environment-variables.d.ts +0 -22
- package/out/environment-variables/list-environment-variables.d.ts.map +0 -1
- package/out/environment-variables/list-environment-variables.js +0 -14
- package/out/environment-variables/set-environment-variable.d.ts +0 -20
- package/out/environment-variables/set-environment-variable.d.ts.map +0 -1
- package/out/environment-variables/set-environment-variable.js +0 -14
- package/out/installations/graphql-client.d.ts +0 -60
- package/out/installations/graphql-client.d.ts.map +0 -1
- package/out/installations/graphql-client.js +0 -408
- package/out/installations/install-app-site.d.ts +0 -21
- package/out/installations/install-app-site.d.ts.map +0 -1
- package/out/installations/install-app-site.js +0 -19
- package/out/installations/shared.d.ts +0 -5
- package/out/installations/shared.d.ts.map +0 -1
- package/out/installations/shared.js +0 -19
- package/out/installations/uninstall-app.d.ts +0 -25
- package/out/installations/uninstall-app.d.ts.map +0 -1
- package/out/installations/uninstall-app.js +0 -43
- package/out/migration-keys/graphql-client.d.ts +0 -8
- package/out/migration-keys/graphql-client.d.ts.map +0 -1
- package/out/migration-keys/graphql-client.js +0 -55
- package/out/providers/configure-provider.d.ts +0 -19
- package/out/providers/configure-provider.d.ts.map +0 -1
- package/out/providers/configure-provider.js +0 -14
- package/out/providers/graphql-client.d.ts +0 -12
- package/out/providers/graphql-client.d.ts.map +0 -1
- package/out/providers/graphql-client.js +0 -47
- package/out/service/cached-config-service.d.ts +0 -8
- package/out/service/cached-config-service.d.ts.map +0 -1
- package/out/service/cached-config-service.js +0 -16
- package/out/service/command-suggestion-service.d.ts +0 -4
- package/out/service/command-suggestion-service.d.ts.map +0 -1
- package/out/service/command-suggestion-service.js +0 -17
- package/out/service/docker-service.d.ts +0 -24
- package/out/service/docker-service.d.ts.map +0 -1
- package/out/service/docker-service.js +0 -71
- package/out/service/installation-service.d.ts +0 -51
- package/out/service/installation-service.d.ts.map +0 -1
- package/out/service/installation-service.js +0 -89
- package/out/service/lint-service.d.ts +0 -23
- package/out/service/lint-service.d.ts.map +0 -1
- package/out/service/lint-service.js +0 -39
- package/out/service/lite-lint-service.d.ts +0 -10
- package/out/service/lite-lint-service.d.ts.map +0 -1
- package/out/service/lite-lint-service.js +0 -27
- package/out/service/migration-keys-service.d.ts +0 -19
- package/out/service/migration-keys-service.d.ts.map +0 -1
- package/out/service/migration-keys-service.js +0 -14
- package/out/service/port-finding-service.d.ts +0 -12
- package/out/service/port-finding-service.d.ts.map +0 -1
- package/out/service/port-finding-service.js +0 -34
- package/out/service/resource-packaging-service.d.ts +0 -46
- package/out/service/resource-packaging-service.d.ts.map +0 -1
- package/out/service/resource-packaging-service.js +0 -128
- package/out/service/resources-uploader-service.d.ts +0 -16
- package/out/service/resources-uploader-service.d.ts.map +0 -1
- package/out/service/resources-uploader-service.js +0 -34
- package/out/service/tunnel-analytics-service.d.ts +0 -11
- package/out/service/tunnel-analytics-service.d.ts.map +0 -1
- package/out/service/tunnel-analytics-service.js +0 -24
- package/out/service/tunnel-service.d.ts +0 -49
- package/out/service/tunnel-service.d.ts.map +0 -1
- package/out/service/tunnel-service.js +0 -190
- package/out/webtrigger/get-webtrigger-url.d.ts +0 -27
- package/out/webtrigger/get-webtrigger-url.d.ts.map +0 -1
- package/out/webtrigger/get-webtrigger-url.js +0 -26
- package/out/webtrigger/graphql-client.d.ts +0 -14
- package/out/webtrigger/graphql-client.d.ts.map +0 -1
- package/out/webtrigger/graphql-client.js +0 -52
- package/out/workers/analytics-message-worker.d.ts +0 -12
- package/out/workers/analytics-message-worker.d.ts.map +0 -1
- package/out/workers/analytics-message-worker.js +0 -29
- package/out/workers/forge-cli-workers.d.ts +0 -2
- package/out/workers/forge-cli-workers.d.ts.map +0 -1
- package/out/workers/forge-cli-workers.js +0 -21
- package/out/workers/tunnel-clean-up-worker.d.ts +0 -8
- package/out/workers/tunnel-clean-up-worker.d.ts.map +0 -1
- package/out/workers/tunnel-clean-up-worker.js +0 -31
- package/out/workers/version-check-worker.d.ts +0 -8
- package/out/workers/version-check-worker.d.ts.map +0 -1
- package/out/workers/version-check-worker.js +0 -20
- package/out/workers/worker-info.d.ts +0 -8
- package/out/workers/worker-info.d.ts.map +0 -1
- package/out/workers/worker-info.js +0 -14
- package/out/workers/worker.d.ts +0 -6
- package/out/workers/worker.d.ts.map +0 -1
- package/out/workers/worker.js +0 -7
- package/out/workers/workers-starter.d.ts +0 -5
- package/out/workers/workers-starter.d.ts.map +0 -1
- package/out/workers/workers-starter.js +0 -22
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SetEnvironmentVariableCommand = void 0;
|
|
4
|
-
class SetEnvironmentVariableCommand {
|
|
5
|
-
constructor(client, getAppConfig) {
|
|
6
|
-
this.client = client;
|
|
7
|
-
this.getAppConfig = getAppConfig;
|
|
8
|
-
}
|
|
9
|
-
async execute(details) {
|
|
10
|
-
const { id: appId } = await this.getAppConfig();
|
|
11
|
-
await this.client.setEnvironmentVariable(Object.assign(Object.assign({}, details), { appId }));
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
exports.SetEnvironmentVariableCommand = SetEnvironmentVariableCommand;
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import { URL } from 'url';
|
|
3
|
-
import { AppEnvironment, GraphQLClient, GraphQlMutationError, Pause } from '@forge/cli-shared';
|
|
4
|
-
import { AppUninstallationInput } from '@forge/cli-shared';
|
|
5
|
-
import { AppInstallSiteDetails, InstallAppClient } from './install-app-site';
|
|
6
|
-
import { Installation, ListAppInstallationsClient, UpgradeAppInstallationsClient } from '../service/installation-service';
|
|
7
|
-
import { UninstallAppClient, UninstallAppOutput } from './uninstall-app';
|
|
8
|
-
export declare const UNINSTALLATION_EVENT_POLL_INTERVAL = 500;
|
|
9
|
-
export declare const ALREADY_UPGRADED_CODE = "INSTALLATION_ALREADY_UPGRADED";
|
|
10
|
-
export declare class PermissionDeniedError extends GraphQlMutationError {
|
|
11
|
-
constructor(requestId?: string, appId?: string);
|
|
12
|
-
}
|
|
13
|
-
export declare class AlreadyInstalledError extends GraphQlMutationError {
|
|
14
|
-
constructor();
|
|
15
|
-
}
|
|
16
|
-
export declare class InstallationError extends GraphQlMutationError {
|
|
17
|
-
constructor(message: string, code: string | undefined);
|
|
18
|
-
}
|
|
19
|
-
export declare class UpgradeError extends GraphQlMutationError {
|
|
20
|
-
constructor(message: string, code: string | undefined);
|
|
21
|
-
}
|
|
22
|
-
export declare class EnvironmentNotFoundError extends Error {
|
|
23
|
-
}
|
|
24
|
-
export declare class MissingTaskIdError extends Error {
|
|
25
|
-
}
|
|
26
|
-
export declare class InstallationRequestFailedError extends Error {
|
|
27
|
-
}
|
|
28
|
-
export declare class MissingAppError extends Error {
|
|
29
|
-
}
|
|
30
|
-
export declare class MissingAppUninstallTask extends Error {
|
|
31
|
-
}
|
|
32
|
-
export declare class InstallationNotFoundError extends Error {
|
|
33
|
-
}
|
|
34
|
-
export declare class UnknownSiteWithoutCloudIdError extends Error {
|
|
35
|
-
constructor();
|
|
36
|
-
}
|
|
37
|
-
export declare class InvalidAtlassianSiteError extends Error {
|
|
38
|
-
constructor(url: URL);
|
|
39
|
-
}
|
|
40
|
-
export declare class InstallationsGraphqlClient implements InstallAppClient, ListAppInstallationsClient, UninstallAppClient, UpgradeAppInstallationsClient {
|
|
41
|
-
private readonly graphqlClient;
|
|
42
|
-
private readonly pause;
|
|
43
|
-
static buildInstallationContext(product: string, cloudId: string): string;
|
|
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>;
|
|
49
|
-
uninstallMultipleApps(apps: AppUninstallationInput[]): Promise<Partial<UninstallAppOutput>[]>;
|
|
50
|
-
listInstallations(appId: string): Promise<Installation[]>;
|
|
51
|
-
getInstallation(appId: string, installationId: string): Promise<Installation>;
|
|
52
|
-
private getAppInstallationTask;
|
|
53
|
-
private monitorUninstallApp;
|
|
54
|
-
private createCloudIdToHostnameMap;
|
|
55
|
-
private resolveInstallationsHostnames;
|
|
56
|
-
private getAllInstallations;
|
|
57
|
-
private getCloudId;
|
|
58
|
-
getVersions(appId: string, environmentKey: string, firstN?: number): Promise<AppEnvironment['versions']>;
|
|
59
|
-
}
|
|
60
|
-
//# sourceMappingURL=graphql-client.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
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,408 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
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
|
-
const cs_ari_1 = require("@forge/util/packages/cs-ari");
|
|
5
|
-
const cli_shared_1 = require("@forge/cli-shared");
|
|
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;
|
|
9
|
-
exports.ALREADY_UPGRADED_CODE = 'INSTALLATION_ALREADY_UPGRADED';
|
|
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;
|
|
18
|
-
class AlreadyInstalledError extends cli_shared_1.GraphQlMutationError {
|
|
19
|
-
constructor() {
|
|
20
|
-
super(cli_shared_3.Text.install.error.alreadyInstalledError, ALREADY_INSTALLED_CODE);
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
exports.AlreadyInstalledError = AlreadyInstalledError;
|
|
24
|
-
class InstallationError extends cli_shared_1.GraphQlMutationError {
|
|
25
|
-
constructor(message, code) {
|
|
26
|
-
super(cli_shared_3.Text.install.error.serverSideInstallationError(message), code);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
exports.InstallationError = InstallationError;
|
|
30
|
-
class UpgradeError extends cli_shared_1.GraphQlMutationError {
|
|
31
|
-
constructor(message, code) {
|
|
32
|
-
super(cli_shared_3.Text.upgrade.error.serverSideInstallationError(message), code);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
exports.UpgradeError = UpgradeError;
|
|
36
|
-
class EnvironmentNotFoundError extends Error {
|
|
37
|
-
}
|
|
38
|
-
exports.EnvironmentNotFoundError = EnvironmentNotFoundError;
|
|
39
|
-
class MissingTaskIdError extends Error {
|
|
40
|
-
}
|
|
41
|
-
exports.MissingTaskIdError = MissingTaskIdError;
|
|
42
|
-
class InstallationRequestFailedError extends Error {
|
|
43
|
-
}
|
|
44
|
-
exports.InstallationRequestFailedError = InstallationRequestFailedError;
|
|
45
|
-
class MissingAppError extends Error {
|
|
46
|
-
}
|
|
47
|
-
exports.MissingAppError = MissingAppError;
|
|
48
|
-
class MissingAppUninstallTask extends Error {
|
|
49
|
-
}
|
|
50
|
-
exports.MissingAppUninstallTask = MissingAppUninstallTask;
|
|
51
|
-
class InstallationNotFoundError extends Error {
|
|
52
|
-
}
|
|
53
|
-
exports.InstallationNotFoundError = InstallationNotFoundError;
|
|
54
|
-
class UnknownSiteWithoutCloudIdError extends Error {
|
|
55
|
-
constructor() {
|
|
56
|
-
super(cli_shared_3.Text.installList.noCloudId);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
exports.UnknownSiteWithoutCloudIdError = UnknownSiteWithoutCloudIdError;
|
|
60
|
-
class InvalidAtlassianSiteError extends Error {
|
|
61
|
-
constructor(url) {
|
|
62
|
-
super(cli_shared_3.Text.install.error.invalidAtlassianSite(url));
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
exports.InvalidAtlassianSiteError = InvalidAtlassianSiteError;
|
|
66
|
-
const tenantToHostname = (tenantInfo) => {
|
|
67
|
-
if (!tenantInfo) {
|
|
68
|
-
return null;
|
|
69
|
-
}
|
|
70
|
-
return tenantInfo.hostName || null;
|
|
71
|
-
};
|
|
72
|
-
const tenantContextsToCloudId = (url, contexts) => {
|
|
73
|
-
if (!contexts.length) {
|
|
74
|
-
throw new InvalidAtlassianSiteError(url);
|
|
75
|
-
}
|
|
76
|
-
const context = contexts[0];
|
|
77
|
-
if (!context || !context.cloudId) {
|
|
78
|
-
throw new InvalidAtlassianSiteError(url);
|
|
79
|
-
}
|
|
80
|
-
return context.cloudId;
|
|
81
|
-
};
|
|
82
|
-
class InstallationsGraphqlClient {
|
|
83
|
-
constructor(graphqlClient, pause) {
|
|
84
|
-
this.graphqlClient = graphqlClient;
|
|
85
|
-
this.pause = pause;
|
|
86
|
-
}
|
|
87
|
-
static buildInstallationContext(product, cloudId) {
|
|
88
|
-
const ari = new cs_ari_1.ResourceIdentifier({
|
|
89
|
-
resourceOwner: product.toLowerCase(),
|
|
90
|
-
resourceType: 'site',
|
|
91
|
-
resourceId: cloudId
|
|
92
|
-
});
|
|
93
|
-
return ari.toString();
|
|
94
|
-
}
|
|
95
|
-
async installAppIntoSite({ environmentKey, site, product, appId }) {
|
|
96
|
-
const cloudId = await this.getCloudId(site);
|
|
97
|
-
const installationContext = InstallationsGraphqlClient.buildInstallationContext(product, cloudId);
|
|
98
|
-
const query = `
|
|
99
|
-
mutation forge_cli_installApplication($input: AppInstallationInput!) {
|
|
100
|
-
installApp(input: $input) {
|
|
101
|
-
success
|
|
102
|
-
taskId
|
|
103
|
-
errors {
|
|
104
|
-
message
|
|
105
|
-
extensions {
|
|
106
|
-
errorType
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
`;
|
|
112
|
-
const variables = {
|
|
113
|
-
input: {
|
|
114
|
-
installationContext,
|
|
115
|
-
appId,
|
|
116
|
-
environmentKey,
|
|
117
|
-
async: true
|
|
118
|
-
}
|
|
119
|
-
};
|
|
120
|
-
const { response: { installApp: { success, taskId, errors } }, requestId } = await this.graphqlClient.mutate(query, variables);
|
|
121
|
-
const error = cli_shared_2.getError(errors);
|
|
122
|
-
if (!success) {
|
|
123
|
-
if (error.code === ALREADY_INSTALLED_CODE) {
|
|
124
|
-
throw new AlreadyInstalledError();
|
|
125
|
-
}
|
|
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);
|
|
130
|
-
}
|
|
131
|
-
if (!taskId) {
|
|
132
|
-
throw new MissingTaskIdError(error.message);
|
|
133
|
-
}
|
|
134
|
-
await this.monitorAppInstallOrUpgrade(taskId);
|
|
135
|
-
}
|
|
136
|
-
async upgradeInstallation({ site, product, environmentKey, appId }) {
|
|
137
|
-
const cloudId = await this.getCloudId(site);
|
|
138
|
-
const installationContext = InstallationsGraphqlClient.buildInstallationContext(product, cloudId);
|
|
139
|
-
const query = `
|
|
140
|
-
mutation forge_cli_upgradeApplication($input: AppInstallationUpgradeInput!) {
|
|
141
|
-
upgradeApp(input: $input) {
|
|
142
|
-
success
|
|
143
|
-
taskId
|
|
144
|
-
errors {
|
|
145
|
-
message
|
|
146
|
-
extensions {
|
|
147
|
-
errorType
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
`;
|
|
153
|
-
const variables = {
|
|
154
|
-
input: {
|
|
155
|
-
installationContext,
|
|
156
|
-
appId,
|
|
157
|
-
environmentKey,
|
|
158
|
-
async: true
|
|
159
|
-
}
|
|
160
|
-
};
|
|
161
|
-
const { response: { upgradeApp: { success, errors, taskId } }, requestId } = await this.graphqlClient.mutate(query, variables);
|
|
162
|
-
const error = cli_shared_2.getError(errors);
|
|
163
|
-
if (!success) {
|
|
164
|
-
throw new UpgradeError(`${error.message} (requestId: ${requestId || 'unknown'})`, error.code);
|
|
165
|
-
}
|
|
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);
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
async uninstallApp(input) {
|
|
184
|
-
const query = `
|
|
185
|
-
mutation forge_cli_uninstallApplication($input: AppUninstallationInput!) {
|
|
186
|
-
uninstallApp(input: $input) {
|
|
187
|
-
success
|
|
188
|
-
taskId
|
|
189
|
-
errors {
|
|
190
|
-
message
|
|
191
|
-
extensions {
|
|
192
|
-
errorType
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
`;
|
|
198
|
-
const { response: { uninstallApp: { success, errors, taskId } }, requestId } = await this.graphqlClient.mutate(query, { input });
|
|
199
|
-
const error = cli_shared_2.getError(errors);
|
|
200
|
-
if (!success) {
|
|
201
|
-
throw new cli_shared_1.GraphQlMutationError(`${error.message} (requestId: ${requestId || 'unknown'})`, error.code);
|
|
202
|
-
}
|
|
203
|
-
return this.monitorUninstallApp(taskId);
|
|
204
|
-
}
|
|
205
|
-
async uninstallMultipleApps(apps) {
|
|
206
|
-
const uninstallsResult = [];
|
|
207
|
-
for (const app of apps) {
|
|
208
|
-
try {
|
|
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 }));
|
|
214
|
-
}
|
|
215
|
-
catch (err) {
|
|
216
|
-
uninstallsResult.push(Object.assign(Object.assign({}, app), { successful: false }));
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
return uninstallsResult;
|
|
220
|
-
}
|
|
221
|
-
async listInstallations(appId) {
|
|
222
|
-
const installations = await this.getAllInstallations(appId);
|
|
223
|
-
return await this.resolveInstallationsHostnames(installations);
|
|
224
|
-
}
|
|
225
|
-
async getInstallation(appId, installationId) {
|
|
226
|
-
const installations = await this.listInstallations(appId);
|
|
227
|
-
const matchedInstallation = installations.find(({ id }) => id === installationId);
|
|
228
|
-
if (matchedInstallation) {
|
|
229
|
-
return matchedInstallation;
|
|
230
|
-
}
|
|
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;
|
|
271
|
-
}
|
|
272
|
-
async createCloudIdToHostnameMap(cloudIds) {
|
|
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
|
-
}
|
|
278
|
-
const query = `
|
|
279
|
-
query forge_cli_getHostnameForTenantContexts($cloudIds: [ID!]!) {
|
|
280
|
-
tenantContexts(cloudIds: $cloudIds) {
|
|
281
|
-
hostName
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
|
-
`;
|
|
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 = {};
|
|
290
|
-
cloudIds.forEach((cloudId, index) => {
|
|
291
|
-
const maybeHostname = tenantToHostname(tenantContexts[index]);
|
|
292
|
-
cloudIdToHostname[cloudId] = maybeHostname || cloudId;
|
|
293
|
-
});
|
|
294
|
-
return cloudIdToHostname;
|
|
295
|
-
}
|
|
296
|
-
async resolveInstallationsHostnames(installations) {
|
|
297
|
-
if (!installations.length) {
|
|
298
|
-
return [];
|
|
299
|
-
}
|
|
300
|
-
const installationContexts = installations.map(({ installation }) => {
|
|
301
|
-
const context = cs_ari_1.parse(installation.installationContext);
|
|
302
|
-
const cloudId = context.resourceId;
|
|
303
|
-
if (!cloudId) {
|
|
304
|
-
throw new UnknownSiteWithoutCloudIdError();
|
|
305
|
-
}
|
|
306
|
-
return context;
|
|
307
|
-
});
|
|
308
|
-
const uniqueCloudIds = [...new Set(installationContexts.map((context) => context.resourceId))];
|
|
309
|
-
const cloudIdToHostname = await this.createCloudIdToHostnameMap(uniqueCloudIds);
|
|
310
|
-
return installationContexts.map((context, i) => {
|
|
311
|
-
const { environment, installation } = installations[i];
|
|
312
|
-
const site = cloudIdToHostname[context.resourceId];
|
|
313
|
-
return {
|
|
314
|
-
id: installation.id,
|
|
315
|
-
product: context.resourceOwner,
|
|
316
|
-
environmentKey: environment,
|
|
317
|
-
context: installation.installationContext,
|
|
318
|
-
site,
|
|
319
|
-
version: installation.version || {
|
|
320
|
-
isLatest: false
|
|
321
|
-
}
|
|
322
|
-
};
|
|
323
|
-
});
|
|
324
|
-
}
|
|
325
|
-
async getAllInstallations(appId) {
|
|
326
|
-
const query = `
|
|
327
|
-
query forge_cli_getApplicationInstallations($id: ID!) {
|
|
328
|
-
app(id: $id) {
|
|
329
|
-
environments {
|
|
330
|
-
key
|
|
331
|
-
installations {
|
|
332
|
-
id
|
|
333
|
-
installationContext,
|
|
334
|
-
version {
|
|
335
|
-
isLatest
|
|
336
|
-
}
|
|
337
|
-
}
|
|
338
|
-
}
|
|
339
|
-
}
|
|
340
|
-
}
|
|
341
|
-
`;
|
|
342
|
-
const result = await this.graphqlClient.query(query, { id: appId });
|
|
343
|
-
if (!result.app) {
|
|
344
|
-
throw new MissingAppError();
|
|
345
|
-
}
|
|
346
|
-
const output = [];
|
|
347
|
-
for (const { key, installations } of result.app.environments) {
|
|
348
|
-
if (installations) {
|
|
349
|
-
for (const installation of installations) {
|
|
350
|
-
output.push({
|
|
351
|
-
environment: key,
|
|
352
|
-
installation
|
|
353
|
-
});
|
|
354
|
-
}
|
|
355
|
-
}
|
|
356
|
-
}
|
|
357
|
-
return output;
|
|
358
|
-
}
|
|
359
|
-
async getCloudId(site) {
|
|
360
|
-
const query = `
|
|
361
|
-
query forge_cli_getCloudIfForTenantContexts($hostNames: [String!]) {
|
|
362
|
-
tenantContexts(hostNames: $hostNames) {
|
|
363
|
-
cloudId
|
|
364
|
-
}
|
|
365
|
-
}
|
|
366
|
-
`;
|
|
367
|
-
const result = await this.graphqlClient.query(query, {
|
|
368
|
-
hostNames: [site.hostname]
|
|
369
|
-
});
|
|
370
|
-
const tenantContexts = result.tenantContexts || [];
|
|
371
|
-
return tenantContextsToCloudId(site, tenantContexts);
|
|
372
|
-
}
|
|
373
|
-
async getVersions(appId, environmentKey, firstN = 1) {
|
|
374
|
-
const query = `
|
|
375
|
-
query forge_cli_getApplicationEnvironmentLatestVersions($appId: ID!, $environmentKey: String!, $firstN: Int!) {
|
|
376
|
-
app(id: $appId) {
|
|
377
|
-
environmentByKey(key: $environmentKey) {
|
|
378
|
-
versions(first: $firstN) {
|
|
379
|
-
nodes {
|
|
380
|
-
permissions {
|
|
381
|
-
egress {
|
|
382
|
-
addresses
|
|
383
|
-
}
|
|
384
|
-
scopes {
|
|
385
|
-
key
|
|
386
|
-
}
|
|
387
|
-
}
|
|
388
|
-
}
|
|
389
|
-
}
|
|
390
|
-
}
|
|
391
|
-
}
|
|
392
|
-
}
|
|
393
|
-
`;
|
|
394
|
-
const result = await this.graphqlClient.query(query, {
|
|
395
|
-
appId,
|
|
396
|
-
environmentKey,
|
|
397
|
-
firstN
|
|
398
|
-
});
|
|
399
|
-
if (!result.app) {
|
|
400
|
-
throw new MissingAppError();
|
|
401
|
-
}
|
|
402
|
-
if (!result.app.environmentByKey) {
|
|
403
|
-
throw new EnvironmentNotFoundError();
|
|
404
|
-
}
|
|
405
|
-
return result.app.environmentByKey.versions;
|
|
406
|
-
}
|
|
407
|
-
}
|
|
408
|
-
exports.InstallationsGraphqlClient = InstallationsGraphqlClient;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import { URL } from 'url';
|
|
3
|
-
import { AppConfigProvider } from '@forge/cli-shared';
|
|
4
|
-
export interface TriggerAppSiteInstallDetails {
|
|
5
|
-
site: URL;
|
|
6
|
-
product: string;
|
|
7
|
-
environmentKey: string;
|
|
8
|
-
}
|
|
9
|
-
export interface AppInstallSiteDetails extends TriggerAppSiteInstallDetails {
|
|
10
|
-
appId: string;
|
|
11
|
-
}
|
|
12
|
-
export interface InstallAppClient {
|
|
13
|
-
installAppIntoSite(appInstallDetails: AppInstallSiteDetails): Promise<void>;
|
|
14
|
-
}
|
|
15
|
-
export declare class InstallAppSiteCommand {
|
|
16
|
-
private readonly getAppConfig;
|
|
17
|
-
private readonly installAppClient;
|
|
18
|
-
constructor(getAppConfig: AppConfigProvider, installAppClient: InstallAppClient);
|
|
19
|
-
execute({ environmentKey, site, product }: TriggerAppSiteInstallDetails): Promise<void>;
|
|
20
|
-
}
|
|
21
|
-
//# sourceMappingURL=install-app-site.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
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,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.InstallAppSiteCommand = void 0;
|
|
4
|
-
class InstallAppSiteCommand {
|
|
5
|
-
constructor(getAppConfig, installAppClient) {
|
|
6
|
-
this.getAppConfig = getAppConfig;
|
|
7
|
-
this.installAppClient = installAppClient;
|
|
8
|
-
}
|
|
9
|
-
async execute({ environmentKey, site, product }) {
|
|
10
|
-
const { id: appId } = await this.getAppConfig();
|
|
11
|
-
return await this.installAppClient.installAppIntoSite({
|
|
12
|
-
appId,
|
|
13
|
-
environmentKey,
|
|
14
|
-
site,
|
|
15
|
-
product
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
exports.InstallAppSiteCommand = InstallAppSiteCommand;
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { Installation } from '../service/installation-service';
|
|
2
|
-
export declare class UninstallAppError extends Error {
|
|
3
|
-
}
|
|
4
|
-
export declare const getHangingIdentityInstallationsFromSite: (allInstallations: Installation[], remainingApps: Installation[], sites: Set<string>) => Installation[];
|
|
5
|
-
//# sourceMappingURL=shared.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../src/installations/shared.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAE/D,qBAAa,iBAAkB,SAAQ,KAAK;CAAG;AAE/C,eAAO,MAAM,uCAAuC,qBAChC,YAAY,EAAE,iBACjB,YAAY,EAAE,SACtB,GAAG,CAAC,MAAM,CAAC,KACjB,YAAY,EAkBd,CAAC"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getHangingIdentityInstallationsFromSite = exports.UninstallAppError = void 0;
|
|
4
|
-
class UninstallAppError extends Error {
|
|
5
|
-
}
|
|
6
|
-
exports.UninstallAppError = UninstallAppError;
|
|
7
|
-
exports.getHangingIdentityInstallationsFromSite = (allInstallations, remainingApps, sites) => {
|
|
8
|
-
const hangingIdentityInstalls = [];
|
|
9
|
-
sites.forEach((site) => {
|
|
10
|
-
const shouldUninstallIdentity = remainingApps.filter((app) => app.site === site).length === 0;
|
|
11
|
-
if (shouldUninstallIdentity) {
|
|
12
|
-
const identityInstall = allInstallations.find((install) => install.site === site && install.product === 'identity');
|
|
13
|
-
if (identityInstall) {
|
|
14
|
-
hangingIdentityInstalls.push(identityInstall);
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
return hangingIdentityInstalls;
|
|
19
|
-
};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { AppConfigProvider } from '@forge/cli-shared';
|
|
2
|
-
import { AppUninstallationInput } from '@forge/cli-shared';
|
|
3
|
-
import { Installation } from '../service/installation-service';
|
|
4
|
-
export interface UninstallAppOutput {
|
|
5
|
-
product: string;
|
|
6
|
-
site: string;
|
|
7
|
-
environmentKey: string;
|
|
8
|
-
successful?: boolean;
|
|
9
|
-
}
|
|
10
|
-
export interface AsyncAppUninstallationInput extends AppUninstallationInput {
|
|
11
|
-
async: true;
|
|
12
|
-
}
|
|
13
|
-
export interface UninstallAppClient {
|
|
14
|
-
getInstallation(appId: string, installationId: string): Promise<Installation>;
|
|
15
|
-
uninstallApp(input: AsyncAppUninstallationInput): Promise<boolean>;
|
|
16
|
-
uninstallMultipleApps(input: AsyncAppUninstallationInput[]): Promise<Partial<UninstallAppOutput>[]>;
|
|
17
|
-
}
|
|
18
|
-
export declare class UninstallAppCommand {
|
|
19
|
-
private readonly getAppConfig;
|
|
20
|
-
private readonly client;
|
|
21
|
-
constructor(getAppConfig: AppConfigProvider, client: UninstallAppClient);
|
|
22
|
-
execute(installationId: string): Promise<UninstallAppOutput>;
|
|
23
|
-
batchExecute(installationIds?: string[], installationInfos?: Installation[]): Promise<UninstallAppOutput[]>;
|
|
24
|
-
}
|
|
25
|
-
//# sourceMappingURL=uninstall-app.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.UninstallAppCommand = void 0;
|
|
4
|
-
class UninstallAppCommand {
|
|
5
|
-
constructor(getAppConfig, client) {
|
|
6
|
-
this.getAppConfig = getAppConfig;
|
|
7
|
-
this.client = client;
|
|
8
|
-
}
|
|
9
|
-
async execute(installationId) {
|
|
10
|
-
const { id: appId } = await this.getAppConfig();
|
|
11
|
-
const { product, site, environmentKey } = await this.client.getInstallation(appId, installationId);
|
|
12
|
-
const success = await this.client.uninstallApp({ appId, environmentKey, installationId, async: true });
|
|
13
|
-
return {
|
|
14
|
-
product,
|
|
15
|
-
site,
|
|
16
|
-
environmentKey,
|
|
17
|
-
successful: success
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
async batchExecute(installationIds = [], installationInfos) {
|
|
21
|
-
const { id: appId } = await this.getAppConfig();
|
|
22
|
-
let appsInstallInfo;
|
|
23
|
-
if (installationInfos && installationInfos.length) {
|
|
24
|
-
appsInstallInfo = installationInfos;
|
|
25
|
-
}
|
|
26
|
-
else {
|
|
27
|
-
appsInstallInfo = await Promise.all(installationIds.map((installId) => this.client.getInstallation(appId, installId)));
|
|
28
|
-
}
|
|
29
|
-
const uninstallOutput = await this.client.uninstallMultipleApps(appsInstallInfo.map((installInfo) => ({
|
|
30
|
-
appId,
|
|
31
|
-
environmentKey: installInfo.environmentKey,
|
|
32
|
-
installationId: installInfo.id,
|
|
33
|
-
async: true
|
|
34
|
-
})));
|
|
35
|
-
return appsInstallInfo.map(({ product, site, environmentKey }, index) => ({
|
|
36
|
-
product,
|
|
37
|
-
site,
|
|
38
|
-
environmentKey,
|
|
39
|
-
successful: uninstallOutput[index].successful
|
|
40
|
-
}));
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
exports.UninstallAppCommand = UninstallAppCommand;
|
|
@@ -1,8 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|