@forge/cli 4.5.2-next.4 → 5.0.0-next.1
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 +51 -0
- package/npm-shrinkwrap.json +295 -18
- package/out/analytics-client/analytics-client.d.ts +0 -1
- package/out/analytics-client/analytics-client.d.ts.map +1 -1
- package/out/analytics-client/analytics-client.js +0 -15
- package/out/command-line/command.d.ts.map +1 -1
- package/out/command-line/command.js +5 -4
- package/out/command-line/controller/feedback-controller.d.ts.map +1 -1
- package/out/command-line/controller/feedback-controller.js +2 -2
- package/out/command-line/controller/install-controller.d.ts.map +1 -1
- package/out/command-line/controller/install-controller.js +8 -5
- package/out/command-line/controller/tunnel-controller.js +1 -1
- package/out/command-line/dependency-injection.d.ts +1 -0
- package/out/command-line/dependency-injection.d.ts.map +1 -1
- package/out/command-line/dependency-injection.js +11 -7
- package/out/command-line/register-authentication-command.d.ts.map +1 -1
- package/out/command-line/register-authentication-command.js +8 -6
- package/out/installations/graphql-client.d.ts +13 -12
- package/out/installations/graphql-client.d.ts.map +1 -1
- package/out/installations/graphql-client.js +48 -88
- package/out/installations/site-translation/bitbucket.d.ts +24 -0
- package/out/installations/site-translation/bitbucket.d.ts.map +1 -0
- package/out/installations/site-translation/bitbucket.js +112 -0
- package/out/installations/site-translation/cloudid-products.d.ts +17 -0
- package/out/installations/site-translation/cloudid-products.d.ts.map +1 -0
- package/out/installations/site-translation/cloudid-products.js +89 -0
- package/out/installations/site-translation/index.d.ts +4 -0
- package/out/installations/site-translation/index.d.ts.map +1 -0
- package/out/installations/site-translation/index.js +6 -0
- package/out/installations/site-translation/site-translation.d.ts +12 -0
- package/out/installations/site-translation/site-translation.d.ts.map +1 -0
- package/out/installations/site-translation/site-translation.js +2 -0
- package/out/service/tunnel-service.d.ts +4 -12
- package/out/service/tunnel-service.d.ts.map +1 -1
- package/package.json +5 -8
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"feedback-controller.d.ts","sourceRoot":"","sources":["../../../src/command-line/controller/feedback-controller.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,
|
|
1
|
+
{"version":3,"file":"feedback-controller.d.ts","sourceRoot":"","sources":["../../../src/command-line/controller/feedback-controller.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,kBAAkB,EAAsB,MAAM,mBAAmB,CAAC;AAC/E,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,qBAAa,kBAAkB;IACjB,OAAO,CAAC,QAAQ,CAAC,EAAE;IAAM,OAAO,CAAC,QAAQ,CAAC,kBAAkB;gBAA3C,EAAE,EAAE,EAAE,EAAmB,kBAAkB,EAAE,kBAAkB;IAE/E,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC;CAQ/D"}
|
|
@@ -8,11 +8,11 @@ class FeedbackController {
|
|
|
8
8
|
this.feedbackPostClient = feedbackPostClient;
|
|
9
9
|
}
|
|
10
10
|
async sendFeedback(feedback) {
|
|
11
|
-
const
|
|
11
|
+
const { email } = await cli_shared_1.getCredentialStore(this.ui).getCredentials();
|
|
12
12
|
return this.feedbackPostClient.sendFeedback({
|
|
13
13
|
summary: feedback.length <= 50 ? feedback : feedback.slice(0, 50) + '...',
|
|
14
14
|
description: feedback,
|
|
15
|
-
email
|
|
15
|
+
email
|
|
16
16
|
});
|
|
17
17
|
}
|
|
18
18
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"install-controller.d.ts","sourceRoot":"","sources":["../../../src/command-line/controller/install-controller.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,iBAAiB,EACjB,UAAU,EAEV,EAAE,
|
|
1
|
+
{"version":3,"file":"install-controller.d.ts","sourceRoot":"","sources":["../../../src/command-line/controller/install-controller.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,iBAAiB,EACjB,UAAU,EAEV,EAAE,EAUH,MAAM,m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li_shared_1.Text.installationContext.overviewProduct);
|
|
61
61
|
return await this.ui.promptForList(cli_shared_1.Text.installationContext.promptProduct, cli_shared_1.SUPPORTED_PRODUCTS);
|
|
62
62
|
}
|
|
63
|
-
async promptForSite() {
|
|
63
|
+
async promptForSite(product) {
|
|
64
64
|
this.ui.info(cli_shared_1.Text.installationContext.overviewSite);
|
|
65
|
-
const
|
|
65
|
+
const promptText = product && cli_shared_1.isWorkspaceProduct(product)
|
|
66
|
+
? cli_shared_1.Text.installationContext.promptWorkspace
|
|
67
|
+
: cli_shared_1.Text.installationContext.promptSite;
|
|
68
|
+
const trySite = await this.ui.promptForText(promptText);
|
|
66
69
|
if (!trySite) {
|
|
67
70
|
throw new cli_shared_1.ValidationError(cli_shared_1.Text.error.invalidSite);
|
|
68
71
|
}
|
|
69
|
-
return cli_shared_1.validateSite(trySite);
|
|
72
|
+
return cli_shared_1.validateSite(trySite, product);
|
|
70
73
|
}
|
|
71
74
|
async promptForUpgrade(siteOption, productOption, environmentOption) {
|
|
72
75
|
const { installations } = await this.installationService.listNonTechnicalAppInstallations({
|
|
@@ -76,7 +79,7 @@ class InstallController {
|
|
|
76
79
|
});
|
|
77
80
|
const { site, product, environmentKey } = await this.installView.promptForUpgrade(installations);
|
|
78
81
|
return {
|
|
79
|
-
site: cli_shared_1.validateSite(site),
|
|
82
|
+
site: cli_shared_1.validateSite(site, product),
|
|
80
83
|
product: cli_shared_1.capitalizeProduct(product),
|
|
81
84
|
environment: environmentKey
|
|
82
85
|
};
|
|
@@ -106,7 +109,7 @@ class InstallController {
|
|
|
106
109
|
product = upgradeResult.product;
|
|
107
110
|
}
|
|
108
111
|
product = product ? product : await this.promptForProduct();
|
|
109
|
-
site = site ? site : await this.promptForSite();
|
|
112
|
+
site = site ? site : await this.promptForSite(product);
|
|
110
113
|
this.ui.info(text.banner);
|
|
111
114
|
if (cli_shared_1.isSecureSite(site)) {
|
|
112
115
|
await this.securityPrompt(site);
|
|
@@ -11,7 +11,7 @@ class TunnelController {
|
|
|
11
11
|
this.tunnelView = tunnelView;
|
|
12
12
|
}
|
|
13
13
|
async run(tunnelOptions, ui) {
|
|
14
|
-
const creds = await cli_shared_1.
|
|
14
|
+
const creds = await cli_shared_1.getCredentialStore(ui).getCredentials();
|
|
15
15
|
const errorCallback = this.tunnelView.getTunnelErrorHandler(cli_shared_1.exitOnError);
|
|
16
16
|
if (process.env.FORGE_DEV_TUNNEL) {
|
|
17
17
|
return await this.localTunnelService.run(tunnelOptions, creds, ui.debugEnabled, errorCallback);
|
|
@@ -49,6 +49,7 @@ export declare const getDependencies: (cliDetails: CLIDetails | undefined) => Pr
|
|
|
49
49
|
featureFlagService: FeatureFlagService;
|
|
50
50
|
installationsService: InstallationService;
|
|
51
51
|
migrationKeysService: MigrationKeysService;
|
|
52
|
+
credentialStore: import("@forge/cli-shared/src").CredentialStore;
|
|
52
53
|
};
|
|
53
54
|
controllers: {
|
|
54
55
|
autocompleteController: AutocompleteController;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dependency-injection.d.ts","sourceRoot":"","sources":["../../src/command-line/dependency-injection.ts"],"names":[],"mappings":"AAEA,OAAO,EASL,UAAU,EACV,aAAa,EAEb,UAAU,EAGV,gBAAgB,EAGhB,kBAAkB,EAUlB,YAAY,EACZ,aAAa,EAOb,kBAAkB,EAIlB,kBAAkB,EACnB,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EAAE,uBAAuB,EAAE,MAAM,sCAAsC,CAAC;AAE/E,OAAO,EAML,0BAA0B,EAG3B,MAAM,WAAW,CAAC;AAEnB,OAAO,EAAE,gCAAgC,EAAE,MAAM,sDAAsD,CAAC;AAExG,OAAO,EAAE,+BAA+B,EAAE,MAAM,qDAAqD,CAAC;AACtG,OAAO,EAAE,6BAA6B,EAAE,MAAM,mDAAmD,CAAC;AAIlG,OAAO,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;
|
|
1
|
+
{"version":3,"file":"dependency-injection.d.ts","sourceR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E,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AACtE,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAWlE,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,uBAAuB,EAAE,MAAM,uCAAuC,CAAC;AAEhF,eAAO,MAAM,eAAe,eAAsB,UAAU,GAAG,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2PvE,CAAC;AAGF,aAAK,WAAW,CAAC,CAAC,IAAI,CAAC,SAAS,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC;AAC3D,oBAAY,YAAY,GAAG,WAAW,CAAC,UAAU,CAAC,OAAO,eAAe,CAAC,CAAC,CAAC"}
|
|
@@ -15,6 +15,7 @@ const graphql_client_2 = require("../migration-keys/graphql-client");
|
|
|
15
15
|
const configure_provider_1 = require("../providers/configure-provider");
|
|
16
16
|
const graphql_client_3 = require("../providers/graphql-client");
|
|
17
17
|
const graphql_client_4 = require("../installations/graphql-client");
|
|
18
|
+
const site_translation_1 = require("../installations/site-translation");
|
|
18
19
|
const install_app_site_1 = require("../installations/install-app-site");
|
|
19
20
|
const uninstall_app_1 = require("../installations/uninstall-app");
|
|
20
21
|
const cached_config_service_1 = require("../service/cached-config-service");
|
|
@@ -74,9 +75,9 @@ exports.getDependencies = async (cliDetails) => {
|
|
|
74
75
|
const preCommandController = new pre_command_controller_1.PreCommandController(liteLintService, liteLintView, configFile, cachedConfigService, analyticsSettingsView, settingsView);
|
|
75
76
|
cmd = new command_1.Command(ui, analyticsClientReporter, preCommandController, cliDetails);
|
|
76
77
|
const graphqlGateway = cli_shared_1.getGraphqlGateway();
|
|
77
|
-
const
|
|
78
|
-
const authenticator = new cli_shared_1.PersonalTokenAuthenticator(
|
|
79
|
-
const featureFlagService = new cli_shared_1.FeatureFlagService(ui, cliDetails,
|
|
78
|
+
const credentialStore = cli_shared_1.getCredentialStore(ui);
|
|
79
|
+
const authenticator = new cli_shared_1.PersonalTokenAuthenticator(credentialStore);
|
|
80
|
+
const featureFlagService = new cli_shared_1.FeatureFlagService(ui, cliDetails, credentialStore, appConfigReader);
|
|
80
81
|
const createGraphQLClient = (auth) => {
|
|
81
82
|
const minimalGraphQLRunner = new cli_shared_1.MinimalGraphQLRunner(auth, graphqlGateway, cliDetails);
|
|
82
83
|
const graphQLRunner = new cli_shared_1.DebuggingGraphqlRunner(minimalGraphQLRunner, graphqlGateway, ui);
|
|
@@ -86,8 +87,8 @@ exports.getDependencies = async (cliDetails) => {
|
|
|
86
87
|
const fileUploader = new cli_shared_1.HttpFileUploader(fileReader);
|
|
87
88
|
const feedbackPostClient = new cli_shared_1.HttpsFeedbackPostClient();
|
|
88
89
|
const zipAccessor = new cli_shared_1.UnzipperZipAccessor();
|
|
89
|
-
const loginCommand = new cli_shared_1.LoginCommand(createGraphQLClient,
|
|
90
|
-
const logoutCommand = new cli_shared_1.LogoutCommand(
|
|
90
|
+
const loginCommand = new cli_shared_1.LoginCommand(createGraphQLClient, credentialStore, ui);
|
|
91
|
+
const logoutCommand = new cli_shared_1.LogoutCommand(credentialStore);
|
|
91
92
|
const downloader = new cli_shared_1.TemplateServiceDownloader();
|
|
92
93
|
const extractor = new cli_shared_1.ZipTemplateExtractor(zipAccessor);
|
|
93
94
|
const lister = new cli_shared_1.TemplateServiceLister();
|
|
@@ -109,7 +110,9 @@ exports.getDependencies = async (cliDetails) => {
|
|
|
109
110
|
const globalEdgeClient = new cli_shared_1.GlobalEdgeHttpClient(globalEdgeFetchClient);
|
|
110
111
|
const logsClient = new cli_shared_1.LogsGraphQLClient(graphQLClient);
|
|
111
112
|
const viewAppLogsCommand = new cli_shared_1.ViewAppLogsCommand(assertiveAppConfigReader, appEnvironmentClient, globalEdgeClient, logsClient);
|
|
112
|
-
const
|
|
113
|
+
const bitbucketTranslation = new site_translation_1.BitbucketTranslator();
|
|
114
|
+
const cloudProductTranslation = new site_translation_1.CloudIdTranslator(graphQLClient);
|
|
115
|
+
const installationsClient = new graphql_client_4.InstallationsGraphqlClient(graphQLClient, cloudProductTranslation, bitbucketTranslation, cli_shared_1.pause);
|
|
113
116
|
const installAppSiteCommand = new install_app_site_1.InstallAppSiteCommand(assertiveAppConfigReader, installationsClient);
|
|
114
117
|
const uninstallAppCommand = new uninstall_app_1.UninstallAppCommand(assertiveAppConfigReader, installationsClient);
|
|
115
118
|
const deployMonitorClient = new deploy_1.DeployMonitorGraphqlClient(graphQLClient);
|
|
@@ -171,7 +174,8 @@ exports.getDependencies = async (cliDetails) => {
|
|
|
171
174
|
services: {
|
|
172
175
|
featureFlagService,
|
|
173
176
|
installationsService,
|
|
174
|
-
migrationKeysService
|
|
177
|
+
migrationKeysService,
|
|
178
|
+
credentialStore
|
|
175
179
|
},
|
|
176
180
|
controllers: {
|
|
177
181
|
autocompleteController,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"register-authentication-command.d.ts","sourceRoot":"","sources":["../../src/command-line/register-authentication-command.ts"],"names":[],"mappings":"AAEA,OAAO,
|
|
1
|
+
{"version":3,"file":"register-authentication-command.d.ts","sourceRoot":"","sources":["../../src/command-line/register-authentication-command.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,+BAA+B,EAIhC,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAQ,aAAa,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtE,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAYtD,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf;AAED,wBAAsB,mBAAmB,CACvC,EAAE,EAAE,aAAa,EACjB,eAAe,EAAE,MAAM,EACvB,YAAY,EAAE,YAAY,EAC1B,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,mBAAmB,GACpC,OAAO,CAAC;IAAE,KAAK,EAAE,+BAA+B,CAAC;IAAC,SAAS,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,GAAG,SAAS,CAAA;KAAE,CAAA;CAAE,CAAC,CAoCrH;AAiDD,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,YAAY,QAIlD"}
|
|
@@ -63,22 +63,24 @@ function registerLogoutCommand({ cmd, ui, commands: { logoutCommand } }) {
|
|
|
63
63
|
ui.info(cli_shared_2.Text.logout.loggedOut);
|
|
64
64
|
});
|
|
65
65
|
}
|
|
66
|
-
function registerWhoAmICommand({ cmd, ui, commands: { loginCommand } }) {
|
|
66
|
+
function registerWhoAmICommand({ cmd, ui, services: { credentialStore }, commands: { loginCommand } }) {
|
|
67
67
|
cmd
|
|
68
68
|
.command('whoami')
|
|
69
69
|
.description(cli_shared_2.Text.whoami.cmd)
|
|
70
70
|
.action(async () => {
|
|
71
71
|
try {
|
|
72
|
-
const credentials = await
|
|
72
|
+
const credentials = await credentialStore.getCredentials();
|
|
73
73
|
const { name, accountId } = await loginCommand.getUser(credentials);
|
|
74
74
|
ui.info(cli_shared_2.Text.whoami.success.personalCredentials(credentials.email, name, accountId));
|
|
75
75
|
}
|
|
76
76
|
catch (error) {
|
|
77
77
|
if (error instanceof cli_shared_1.UserNotFoundError) {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
78
|
+
if (process.env[cli_shared_1.EMAIL_KEY] && process.env[cli_shared_1.API_TOKEN_KEY]) {
|
|
79
|
+
throw new Error(cli_shared_2.Text.whoami.error.personalCredentialsEnv(cli_shared_1.EMAIL_KEY, cli_shared_1.API_TOKEN_KEY));
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
throw new Error(cli_shared_2.Text.whoami.error.personalCredentialsKeytar);
|
|
83
|
+
}
|
|
82
84
|
}
|
|
83
85
|
throw error;
|
|
84
86
|
}
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
import { URL } from 'url';
|
|
3
|
-
import { AppEnvironment, GraphQLClient, GraphQlMutationError, Pause } from '@forge/cli-shared';
|
|
4
|
-
import { AppUninstallationInput } from '@forge/cli-shared';
|
|
1
|
+
import { AppEnvironment, AppUninstallationInput, GraphQLClient, GraphQlMutationError, Pause } from '@forge/cli-shared';
|
|
5
2
|
import { AppInstallSiteDetails, InstallAppClient } from './install-app-site';
|
|
6
3
|
import { Installation, ListAppInstallationsClient, UpgradeAppInstallationsClient } from '../service/installation-service';
|
|
7
4
|
import { UninstallAppClient, UninstallAppOutput } from './uninstall-app';
|
|
5
|
+
import { SiteTranslator } from './site-translation';
|
|
8
6
|
export declare const UNINSTALLATION_EVENT_POLL_INTERVAL = 500;
|
|
9
7
|
export declare const ALREADY_UPGRADED_CODE = "INSTALLATION_ALREADY_UPGRADED";
|
|
10
8
|
export declare class PermissionDeniedError extends GraphQlMutationError {
|
|
@@ -31,17 +29,20 @@ export declare class MissingAppUninstallTask extends Error {
|
|
|
31
29
|
}
|
|
32
30
|
export declare class InstallationNotFoundError extends Error {
|
|
33
31
|
}
|
|
34
|
-
export declare class
|
|
32
|
+
export declare class UnknownSiteWithoutResourceIdError extends Error {
|
|
35
33
|
constructor();
|
|
36
34
|
}
|
|
37
|
-
export declare class InvalidAtlassianSiteError extends Error {
|
|
38
|
-
constructor(url: URL);
|
|
39
|
-
}
|
|
40
35
|
export declare class InstallationsGraphqlClient implements InstallAppClient, ListAppInstallationsClient, UninstallAppClient, UpgradeAppInstallationsClient {
|
|
41
36
|
private readonly graphqlClient;
|
|
37
|
+
private readonly cloudIdTranslator;
|
|
38
|
+
private readonly bitbucketTranslator;
|
|
42
39
|
private readonly pause;
|
|
43
|
-
|
|
44
|
-
|
|
40
|
+
SITE_RESOURCE_TYPE: string;
|
|
41
|
+
WORKSPACE_RESOURCE_TYPE: string;
|
|
42
|
+
static buildInstallationContext(product: string, resourceId: string, resourceType: string): string;
|
|
43
|
+
constructor(graphqlClient: GraphQLClient, cloudIdTranslator: SiteTranslator, bitbucketTranslator: SiteTranslator, pause: Pause);
|
|
44
|
+
private buildInstallationContext;
|
|
45
|
+
private getProductTranslation;
|
|
45
46
|
installAppIntoSite({ environmentKey, site, product, appId }: AppInstallSiteDetails): Promise<void>;
|
|
46
47
|
upgradeInstallation({ site, product, environmentKey, appId }: AppInstallSiteDetails): Promise<void>;
|
|
47
48
|
private monitorAppInstallOrUpgrade;
|
|
@@ -51,10 +52,10 @@ export declare class InstallationsGraphqlClient implements InstallAppClient, Lis
|
|
|
51
52
|
getInstallation(appId: string, installationId: string): Promise<Installation>;
|
|
52
53
|
private getAppInstallationTask;
|
|
53
54
|
private monitorUninstallApp;
|
|
54
|
-
private
|
|
55
|
+
private getResourceArisForProduct;
|
|
56
|
+
private getCombinedHostnameMap;
|
|
55
57
|
private resolveInstallationsHostnames;
|
|
56
58
|
private getAllInstallations;
|
|
57
|
-
private getCloudId;
|
|
58
59
|
getVersions(appId: string, environmentKey: string, firstN?: number): Promise<AppEnvironment['versions']>;
|
|
59
60
|
}
|
|
60
61
|
//# 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":"
|
|
1
|
+
{"version":3,"file":"graphql-client.d.ts","sourceRoot":"","sources":["../../src/installations/graphql-client.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,cAAc,EAId,sBAAsB,EAEtB,aAAa,EACb,oBAAoB,EAKpB,KAAK,EAIN,MAAM,mBAAmB,CAAC;AAE3B,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,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAA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qB;IAQhB,kBAAkB,CAAC,EAAE,cAAc,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,qBAAqB;IAmDlF,mBAAmB,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,cAAc,EAAE,KAAK,EAAE,EAAE,qBAAqB;YA6ClF,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;IAiBjC,OAAO,CAAC,yBAAyB;YAOnB,sBAAsB;YAoBtB,6BAA6B;YAkC7B,mBAAmB;IAsCpB,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,SAAI,GAAG,OAAO,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC;CAqCjH"}
|
|
@@ -1,35 +1,33 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.InstallationsGraphqlClient = exports.
|
|
3
|
+
exports.InstallationsGraphqlClient = exports.UnknownSiteWithoutResourceIdError = 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
|
-
const cli_shared_2 = require("@forge/cli-shared");
|
|
7
|
-
const cli_shared_3 = require("@forge/cli-shared");
|
|
8
6
|
exports.UNINSTALLATION_EVENT_POLL_INTERVAL = 500;
|
|
9
7
|
exports.ALREADY_UPGRADED_CODE = 'INSTALLATION_ALREADY_UPGRADED';
|
|
10
8
|
const ALREADY_INSTALLED_CODE = 'APP_ALREADY_INSTALLED';
|
|
11
9
|
const PERMISSION_DENIED = 'PERMISSION_DENIED';
|
|
12
10
|
class PermissionDeniedError extends cli_shared_1.GraphQlMutationError {
|
|
13
11
|
constructor(requestId = 'unknown', appId = 'unknown') {
|
|
14
|
-
super(
|
|
12
|
+
super(cli_shared_1.Text.install.error.permissionsDeniedInstructions(requestId, appId), PERMISSION_DENIED);
|
|
15
13
|
}
|
|
16
14
|
}
|
|
17
15
|
exports.PermissionDeniedError = PermissionDeniedError;
|
|
18
16
|
class AlreadyInstalledError extends cli_shared_1.GraphQlMutationError {
|
|
19
17
|
constructor() {
|
|
20
|
-
super(
|
|
18
|
+
super(cli_shared_1.Text.install.error.alreadyInstalledError, ALREADY_INSTALLED_CODE);
|
|
21
19
|
}
|
|
22
20
|
}
|
|
23
21
|
exports.AlreadyInstalledError = AlreadyInstalledError;
|
|
24
22
|
class InstallationError extends cli_shared_1.GraphQlMutationError {
|
|
25
23
|
constructor(message, code) {
|
|
26
|
-
super(
|
|
24
|
+
super(cli_shared_1.Text.install.error.serverSideInstallationError(message), code);
|
|
27
25
|
}
|
|
28
26
|
}
|
|
29
27
|
exports.InstallationError = InstallationError;
|
|
30
28
|
class UpgradeError extends cli_shared_1.GraphQlMutationError {
|
|
31
29
|
constructor(message, code) {
|
|
32
|
-
super(
|
|
30
|
+
super(cli_shared_1.Text.upgrade.error.serverSideInstallationError(message), code);
|
|
33
31
|
}
|
|
34
32
|
}
|
|
35
33
|
exports.UpgradeError = UpgradeError;
|
|
@@ -51,50 +49,41 @@ exports.MissingAppUninstallTask = MissingAppUninstallTask;
|
|
|
51
49
|
class InstallationNotFoundError extends Error {
|
|
52
50
|
}
|
|
53
51
|
exports.InstallationNotFoundError = InstallationNotFoundError;
|
|
54
|
-
class
|
|
52
|
+
class UnknownSiteWithoutResourceIdError extends Error {
|
|
55
53
|
constructor() {
|
|
56
|
-
super(
|
|
54
|
+
super(cli_shared_1.Text.installList.noResourceId);
|
|
57
55
|
}
|
|
58
56
|
}
|
|
59
|
-
exports.
|
|
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
|
-
};
|
|
57
|
+
exports.UnknownSiteWithoutResourceIdError = UnknownSiteWithoutResourceIdError;
|
|
82
58
|
class InstallationsGraphqlClient {
|
|
83
|
-
constructor(graphqlClient, pause) {
|
|
59
|
+
constructor(graphqlClient, cloudIdTranslator, bitbucketTranslator, pause) {
|
|
84
60
|
this.graphqlClient = graphqlClient;
|
|
61
|
+
this.cloudIdTranslator = cloudIdTranslator;
|
|
62
|
+
this.bitbucketTranslator = bitbucketTranslator;
|
|
85
63
|
this.pause = pause;
|
|
64
|
+
this.SITE_RESOURCE_TYPE = 'site';
|
|
65
|
+
this.WORKSPACE_RESOURCE_TYPE = 'workspace';
|
|
86
66
|
}
|
|
87
|
-
static buildInstallationContext(product,
|
|
67
|
+
static buildInstallationContext(product, resourceId, resourceType) {
|
|
88
68
|
const ari = new cs_ari_1.ResourceIdentifier({
|
|
89
69
|
resourceOwner: product.toLowerCase(),
|
|
90
|
-
resourceType:
|
|
91
|
-
resourceId:
|
|
70
|
+
resourceType: resourceType,
|
|
71
|
+
resourceId: resourceId
|
|
92
72
|
});
|
|
93
73
|
return ari.toString();
|
|
94
74
|
}
|
|
75
|
+
async buildInstallationContext(product, site) {
|
|
76
|
+
const ari = await this.getProductTranslation(product).buildInstallationContext(product, site);
|
|
77
|
+
return ari.toString();
|
|
78
|
+
}
|
|
79
|
+
getProductTranslation(product) {
|
|
80
|
+
if (product && cli_shared_1.isBitbucketProduct(product)) {
|
|
81
|
+
return this.bitbucketTranslator;
|
|
82
|
+
}
|
|
83
|
+
return this.cloudIdTranslator;
|
|
84
|
+
}
|
|
95
85
|
async installAppIntoSite({ environmentKey, site, product, appId }) {
|
|
96
|
-
const
|
|
97
|
-
const installationContext = InstallationsGraphqlClient.buildInstallationContext(product, cloudId);
|
|
86
|
+
const installationContext = await this.buildInstallationContext(product, site);
|
|
98
87
|
const query = `
|
|
99
88
|
mutation forge_cli_installApplication($input: AppInstallationInput!) {
|
|
100
89
|
installApp(input: $input) {
|
|
@@ -118,7 +107,7 @@ class InstallationsGraphqlClient {
|
|
|
118
107
|
}
|
|
119
108
|
};
|
|
120
109
|
const { response: { installApp: { success, taskId, errors } }, requestId } = await this.graphqlClient.mutate(query, variables);
|
|
121
|
-
const error =
|
|
110
|
+
const error = cli_shared_1.getError(errors);
|
|
122
111
|
if (!success) {
|
|
123
112
|
if (error.code === ALREADY_INSTALLED_CODE) {
|
|
124
113
|
throw new AlreadyInstalledError();
|
|
@@ -134,8 +123,7 @@ class InstallationsGraphqlClient {
|
|
|
134
123
|
await this.monitorAppInstallOrUpgrade(taskId);
|
|
135
124
|
}
|
|
136
125
|
async upgradeInstallation({ site, product, environmentKey, appId }) {
|
|
137
|
-
const
|
|
138
|
-
const installationContext = InstallationsGraphqlClient.buildInstallationContext(product, cloudId);
|
|
126
|
+
const installationContext = await this.buildInstallationContext(product, site);
|
|
139
127
|
const query = `
|
|
140
128
|
mutation forge_cli_upgradeApplication($input: AppInstallationUpgradeInput!) {
|
|
141
129
|
upgradeApp(input: $input) {
|
|
@@ -159,7 +147,7 @@ class InstallationsGraphqlClient {
|
|
|
159
147
|
}
|
|
160
148
|
};
|
|
161
149
|
const { response: { upgradeApp: { success, errors, taskId } }, requestId } = await this.graphqlClient.mutate(query, variables);
|
|
162
|
-
const error =
|
|
150
|
+
const error = cli_shared_1.getError(errors);
|
|
163
151
|
if (!success) {
|
|
164
152
|
throw new UpgradeError(`${error.message} (requestId: ${requestId || 'unknown'})`, error.code);
|
|
165
153
|
}
|
|
@@ -196,7 +184,7 @@ class InstallationsGraphqlClient {
|
|
|
196
184
|
}
|
|
197
185
|
`;
|
|
198
186
|
const { response: { uninstallApp: { success, errors, taskId } }, requestId } = await this.graphqlClient.mutate(query, { input });
|
|
199
|
-
const error =
|
|
187
|
+
const error = cli_shared_1.getError(errors);
|
|
200
188
|
if (!success) {
|
|
201
189
|
throw new cli_shared_1.GraphQlMutationError(`${error.message} (requestId: ${requestId || 'unknown'})`, error.code);
|
|
202
190
|
}
|
|
@@ -228,7 +216,7 @@ class InstallationsGraphqlClient {
|
|
|
228
216
|
if (matchedInstallation) {
|
|
229
217
|
return matchedInstallation;
|
|
230
218
|
}
|
|
231
|
-
throw new InstallationNotFoundError(
|
|
219
|
+
throw new InstallationNotFoundError(cli_shared_1.Text.installationId.errors.notFound(installationId));
|
|
232
220
|
}
|
|
233
221
|
async getAppInstallationTask(taskId) {
|
|
234
222
|
const query = `
|
|
@@ -248,7 +236,7 @@ class InstallationsGraphqlClient {
|
|
|
248
236
|
id: taskId
|
|
249
237
|
});
|
|
250
238
|
if (!appInstallationTask) {
|
|
251
|
-
throw new MissingAppUninstallTask(
|
|
239
|
+
throw new MissingAppUninstallTask(cli_shared_1.Text.uninstall.missingUninstallTask);
|
|
252
240
|
}
|
|
253
241
|
const { state, errors } = appInstallationTask;
|
|
254
242
|
return {
|
|
@@ -269,29 +257,16 @@ class InstallationsGraphqlClient {
|
|
|
269
257
|
}
|
|
270
258
|
return true;
|
|
271
259
|
}
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
const
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
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;
|
|
260
|
+
getResourceArisForProduct(installationContexts, condition) {
|
|
261
|
+
return [...new Set(installationContexts.filter((context) => condition(context)))];
|
|
262
|
+
}
|
|
263
|
+
async getCombinedHostnameMap(installationContexts) {
|
|
264
|
+
const bitbucketAris = this.getResourceArisForProduct(installationContexts, this.bitbucketTranslator.ariBelongsToProduct);
|
|
265
|
+
const workspaceAriToHostname = await this.bitbucketTranslator.getSitesForResourceAris(bitbucketAris);
|
|
266
|
+
const cloudIdAris = this.getResourceArisForProduct(installationContexts, this.cloudIdTranslator.ariBelongsToProduct);
|
|
267
|
+
const siteAriToHostname = await this.cloudIdTranslator.getSitesForResourceAris(cloudIdAris);
|
|
268
|
+
const combinedAriToHostname = Object.assign(Object.assign({}, siteAriToHostname), workspaceAriToHostname);
|
|
269
|
+
return combinedAriToHostname;
|
|
295
270
|
}
|
|
296
271
|
async resolveInstallationsHostnames(installations) {
|
|
297
272
|
if (!installations.length) {
|
|
@@ -299,17 +274,16 @@ class InstallationsGraphqlClient {
|
|
|
299
274
|
}
|
|
300
275
|
const installationContexts = installations.map(({ installation }) => {
|
|
301
276
|
const context = cs_ari_1.parse(installation.installationContext);
|
|
302
|
-
const
|
|
303
|
-
if (!
|
|
304
|
-
throw new
|
|
277
|
+
const resourceId = context.resourceId;
|
|
278
|
+
if (!resourceId) {
|
|
279
|
+
throw new UnknownSiteWithoutResourceIdError();
|
|
305
280
|
}
|
|
306
281
|
return context;
|
|
307
282
|
});
|
|
308
|
-
const
|
|
309
|
-
const cloudIdToHostname = await this.createCloudIdToHostnameMap(uniqueCloudIds);
|
|
283
|
+
const combinedAriToHostname = await this.getCombinedHostnameMap(installationContexts);
|
|
310
284
|
return installationContexts.map((context, i) => {
|
|
311
285
|
const { environment, installation } = installations[i];
|
|
312
|
-
const site =
|
|
286
|
+
const site = combinedAriToHostname[context.toString()];
|
|
313
287
|
return {
|
|
314
288
|
id: installation.id,
|
|
315
289
|
product: context.resourceOwner,
|
|
@@ -356,20 +330,6 @@ class InstallationsGraphqlClient {
|
|
|
356
330
|
}
|
|
357
331
|
return output;
|
|
358
332
|
}
|
|
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
333
|
async getVersions(appId, environmentKey, firstN = 1) {
|
|
374
334
|
const query = `
|
|
375
335
|
query forge_cli_getApplicationEnvironmentLatestVersions($appId: ID!, $environmentKey: String!, $firstN: Int!) {
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { SiteTranslator, ResourcefulAri } from './site-translation';
|
|
3
|
+
import { URL } from 'url';
|
|
4
|
+
import { Ari } from '@forge/util/packages/cs-ari';
|
|
5
|
+
export declare class InvalidWorkspaceError extends Error {
|
|
6
|
+
constructor(url: URL);
|
|
7
|
+
}
|
|
8
|
+
export declare class InvalidResponseError extends Error {
|
|
9
|
+
constructor(url: URL);
|
|
10
|
+
}
|
|
11
|
+
export declare const getBitbucketEndpoint: () => string;
|
|
12
|
+
export declare class BitbucketTranslator implements SiteTranslator {
|
|
13
|
+
ariBelongsToProduct(ari: ResourcefulAri): boolean;
|
|
14
|
+
buildInstallationContext(product: string, site: URL): Promise<Ari>;
|
|
15
|
+
getSitesForResourceAris(aris: ResourcefulAri[]): Promise<Record<string, string>>;
|
|
16
|
+
private getWorkspaceId;
|
|
17
|
+
getWorkspaceUrl(workspaceId: string): Promise<URL | null>;
|
|
18
|
+
private decorateWorkspaceId;
|
|
19
|
+
private extractWorkspaceId;
|
|
20
|
+
private buildFetchUrl;
|
|
21
|
+
private extractWorkspaceName;
|
|
22
|
+
private buildWorkspaceUrl;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=bitbucket.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bitbucket.d.ts","sourceRoot":"","sources":["../../../src/installations/site-translation/bitbucket.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpE,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAC1B,OAAO,EAAE,GAAG,EAAsB,MAAM,6BAA6B,CAAC;AAGtE,qBAAa,qBAAsB,SAAQ,KAAK;gBAClC,GAAG,EAAE,GAAG;CAGrB;AAED,qBAAa,oBAAqB,SAAQ,KAAK;gBACjC,GAAG,EAAE,GAAG;CAGrB;AAOD,eAAO,MAAM,oBAAoB,QAAO,MAEvC,CAAC;AAEF,qBAAa,mBAAoB,YAAW,cAAc;IACjD,mBAAmB,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO;IAI3C,wBAAwB,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC;IAUlE,uBAAuB,CAAC,IAAI,EAAE,cAAc,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;YAc/E,cAAc;IAwBf,eAAe,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,GAAG,IAAI,CAAC;IAsBtE,OAAO,CAAC,mBAAmB;IAI3B,OAAO,CAAC,kBAAkB;IAI1B,OAAO,CAAC,aAAa;IAKrB,OAAO,CAAC,oBAAoB;IAW5B,OAAO,CAAC,iBAAiB;CAG1B"}
|