@forge/cli 0.0.0-experimental-e8bfa83 → 0.0.0-experimental-c3effe3
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 +3781 -7
- package/README.md +18 -19
- package/npm-shrinkwrap.json +2709 -3555
- 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 +24 -20
- 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/bin/cli.js +0 -2
- package/out/bin/postinstall.js +9 -2
- package/out/command-line/anon-user-id.js +6 -10
- package/out/command-line/command.d.ts +27 -8
- package/out/command-line/command.d.ts.map +1 -1
- package/out/command-line/command.js +188 -50
- package/out/command-line/controller/autocomplete-controller.d.ts +1 -0
- package/out/command-line/controller/autocomplete-controller.d.ts.map +1 -1
- package/out/command-line/controller/autocomplete-controller.js +11 -1
- 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 +52 -22
- package/out/command-line/index.d.ts.map +1 -1
- package/out/command-line/index.js +10 -30
- 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-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 +22 -7
- 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-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/installations/graphql-client.d.ts +19 -13
- package/out/installations/graphql-client.d.ts.map +1 -1
- package/out/installations/graphql-client.js +161 -56
- 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 +3 -2
- package/out/service/resource-packaging-service.d.ts.map +1 -1
- package/out/service/resource-packaging-service.js +6 -2
- 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 +17 -17
- 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,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
|
|
@@ -268,7 +358,7 @@ class InstallationsGraphqlClient {
|
|
|
268
358
|
}
|
|
269
359
|
async getCloudId(site) {
|
|
270
360
|
const query = `
|
|
271
|
-
query
|
|
361
|
+
query forge_cli_getCloudIfForTenantContexts($hostNames: [String!]) {
|
|
272
362
|
tenantContexts(hostNames: $hostNames) {
|
|
273
363
|
cloudId
|
|
274
364
|
}
|
|
@@ -280,24 +370,39 @@ class InstallationsGraphqlClient {
|
|
|
280
370
|
const tenantContexts = result.tenantContexts || [];
|
|
281
371
|
return tenantContextsToCloudId(site, tenantContexts);
|
|
282
372
|
}
|
|
283
|
-
async
|
|
373
|
+
async getVersions(appId, environmentKey, firstN = 1) {
|
|
284
374
|
const query = `
|
|
285
|
-
query
|
|
375
|
+
query forge_cli_getApplicationEnvironmentLatestVersions($appId: ID!, $environmentKey: String!, $firstN: Int!) {
|
|
286
376
|
app(id: $appId) {
|
|
287
377
|
environmentByKey(key: $environmentKey) {
|
|
288
|
-
|
|
378
|
+
versions(first: $firstN) {
|
|
379
|
+
nodes {
|
|
380
|
+
permissions {
|
|
381
|
+
egress {
|
|
382
|
+
addresses
|
|
383
|
+
}
|
|
384
|
+
scopes {
|
|
385
|
+
key
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
}
|
|
289
390
|
}
|
|
290
391
|
}
|
|
291
392
|
}
|
|
292
393
|
`;
|
|
293
|
-
const result = await this.graphqlClient.query(query, {
|
|
394
|
+
const result = await this.graphqlClient.query(query, {
|
|
395
|
+
appId,
|
|
396
|
+
environmentKey,
|
|
397
|
+
firstN
|
|
398
|
+
});
|
|
294
399
|
if (!result.app) {
|
|
295
400
|
throw new MissingAppError();
|
|
296
401
|
}
|
|
297
402
|
if (!result.app.environmentByKey) {
|
|
298
403
|
throw new EnvironmentNotFoundError();
|
|
299
404
|
}
|
|
300
|
-
return result.app.environmentByKey.
|
|
405
|
+
return result.app.environmentByKey.versions;
|
|
301
406
|
}
|
|
302
407
|
}
|
|
303
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"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GraphqlClient = void 0;
|
|
4
|
+
const cli_shared_1 = require("@forge/cli-shared");
|
|
5
|
+
class GraphqlClient {
|
|
6
|
+
constructor(graphqlClient) {
|
|
7
|
+
this.graphqlClient = graphqlClient;
|
|
8
|
+
}
|
|
9
|
+
async getLatestMigrationKeys(appId, environmentKey) {
|
|
10
|
+
var _a, _b;
|
|
11
|
+
const query = `
|
|
12
|
+
query forge_cli_getMigrationKeys($id: ID!, $key: String!) {
|
|
13
|
+
app(id: $id) {
|
|
14
|
+
environmentByKey(key: $key) {
|
|
15
|
+
id
|
|
16
|
+
versions(first: 1) {
|
|
17
|
+
edges {
|
|
18
|
+
node {
|
|
19
|
+
isLatest
|
|
20
|
+
migrationKeys {
|
|
21
|
+
jira
|
|
22
|
+
confluence
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
marketplaceApp {
|
|
29
|
+
appKey
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
`;
|
|
34
|
+
const result = await this.graphqlClient.query(query, {
|
|
35
|
+
id: appId,
|
|
36
|
+
key: environmentKey
|
|
37
|
+
});
|
|
38
|
+
if (!result.app) {
|
|
39
|
+
throw new cli_shared_1.MissingAppError();
|
|
40
|
+
}
|
|
41
|
+
if (!result.app.environmentByKey) {
|
|
42
|
+
throw new cli_shared_1.MissingAppEnvironmentError();
|
|
43
|
+
}
|
|
44
|
+
const mpacAppKey = (_a = result.app.marketplaceApp) === null || _a === void 0 ? void 0 : _a.appKey;
|
|
45
|
+
const versions = result.app.environmentByKey.versions;
|
|
46
|
+
let migrationKeys;
|
|
47
|
+
for (const edge of (versions === null || versions === void 0 ? void 0 : versions.edges) || []) {
|
|
48
|
+
if (edge) {
|
|
49
|
+
migrationKeys = (_b = edge.node) === null || _b === void 0 ? void 0 : _b.migrationKeys;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return { migrationKeys, mpacAppKey };
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
exports.GraphqlClient = GraphqlClient;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { AppConfigProvider } from '@forge/cli-shared';
|
|
2
|
+
export interface ProviderDetails {
|
|
3
|
+
environment: string;
|
|
4
|
+
providerKey: string;
|
|
5
|
+
clientSecret: string;
|
|
6
|
+
}
|
|
7
|
+
export interface AppProviderDetails extends ProviderDetails {
|
|
8
|
+
appId: string;
|
|
9
|
+
}
|
|
10
|
+
export interface ConfigureProviderClient {
|
|
11
|
+
configureProvider(details: AppProviderDetails): Promise<void>;
|
|
12
|
+
}
|
|
13
|
+
export declare class ConfigureProviderCommand {
|
|
14
|
+
private readonly client;
|
|
15
|
+
private readonly getAppConfig;
|
|
16
|
+
constructor(client: ConfigureProviderClient, getAppConfig: AppConfigProvider);
|
|
17
|
+
execute(details: ProviderDetails): Promise<void>;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=configure-provider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"configure-provider.d.ts","sourceRoot":"","sources":["../../src/providers/configure-provider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAEtD,MAAM,WAAW,eAAe;IAC9B,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,kBAAmB,SAAQ,eAAe;IACzD,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,uBAAuB;IACtC,iBAAiB,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC/D;AAED,qBAAa,wBAAwB;IACvB,OAAO,CAAC,QAAQ,CAAC,MAAM;IAA2B,OAAO,CAAC,QAAQ,CAAC,YAAY;gBAA9D,MAAM,EAAE,uBAAuB,EAAmB,YAAY,EAAE,iBAAiB;IAEjG,OAAO,CAAC,OAAO,EAAE,eAAe;CAO9C"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ConfigureProviderCommand = void 0;
|
|
4
|
+
class ConfigureProviderCommand {
|
|
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.configureProvider(Object.assign(Object.assign({}, details), { appId }));
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
exports.ConfigureProviderCommand = ConfigureProviderCommand;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { GraphQLClient } from '@forge/cli-shared';
|
|
2
|
+
import { AppProviderDetails, ConfigureProviderClient } from './configure-provider';
|
|
3
|
+
export declare class MissingAppError extends Error {
|
|
4
|
+
}
|
|
5
|
+
export declare class MissingAppEnvironmentError extends Error {
|
|
6
|
+
}
|
|
7
|
+
export declare class GraphqlClient implements ConfigureProviderClient {
|
|
8
|
+
private readonly graphqlClient;
|
|
9
|
+
constructor(graphqlClient: GraphQLClient);
|
|
10
|
+
configureProvider(details: AppProviderDetails): Promise<void>;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=graphql-client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graphql-client.d.ts","sourceRoot":"","sources":["../../src/providers/graphql-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,aAAa,EAAwB,MAAM,mBAAmB,CAAC;AAElF,OAAO,EAAE,kBAAkB,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAEnF,qBAAa,eAAgB,SAAQ,KAAK;CAAG;AAC7C,qBAAa,0BAA2B,SAAQ,KAAK;CAAG;AAExD,qBAAa,aAAc,YAAW,uBAAuB;IAC/C,OAAO,CAAC,QAAQ,CAAC,aAAa;gBAAb,aAAa,EAAE,aAAa;IAE5C,iBAAiB,CAAC,OAAO,EAAE,kBAAkB;CA0C3D"}
|