@forge/cli 9.3.0 → 10.0.0-next.11
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 +149 -0
- package/npm-shrinkwrap.json +50 -43
- package/out/analytics-client/analytics-client.js +39 -12
- package/out/analytics-client/analytics-message-handler.js +28 -27
- package/out/autocomplete/index.js +1 -2
- package/out/autocomplete/util.js +1 -1
- package/out/bin/postinstall.js +1 -1
- package/out/command-line/command.js +132 -116
- package/out/command-line/controller/autocomplete-controller.js +1 -0
- package/out/command-line/controller/default-environment-controller.js +8 -0
- package/out/command-line/controller/deploy-controller.js +25 -9
- package/out/command-line/controller/feedback-controller.js +2 -0
- package/out/command-line/controller/install-controller.js +11 -5
- package/out/command-line/controller/lint-controller.js +3 -1
- package/out/command-line/controller/pre-command-controller.js +6 -0
- package/out/command-line/controller/prerequisites-controller.js +3 -0
- package/out/command-line/controller/settings-controller.js +60 -57
- package/out/command-line/controller/tunnel-controller.js +8 -3
- package/out/command-line/dependency-injection.js +2 -2
- package/out/command-line/errors.js +1 -0
- package/out/command-line/register-authentication-command.js +1 -1
- package/out/command-line/register-environment-variables-commands.js +6 -8
- package/out/command-line/register-installation-commands.js +5 -7
- package/out/command-line/register-log-commands.js +1 -1
- package/out/command-line/register-settings-commands.js +3 -5
- package/out/command-line/register-storage-commands.js +1 -2
- package/out/command-line/sentry.js +4 -1
- package/out/command-line/version-info.js +1 -1
- package/out/command-line/view/analytics-settings-view.js +1 -0
- package/out/command-line/view/deploy-view.js +1 -0
- package/out/command-line/view/install-view.js +1 -0
- package/out/command-line/view/lint-view.js +2 -0
- package/out/command-line/view/lite-lint-view.js +2 -0
- package/out/command-line/view/settings-view.js +1 -0
- package/out/command-line/view/tunnel-view.js +4 -4
- package/out/deploy/deployer/deploy-monitor-graphql-client.js +2 -1
- package/out/deploy/deployer/deployer.js +11 -4
- package/out/deploy/deployer/trigger-deploy-graphql-client.js +1 -0
- package/out/deploy/package-upload-deploy.js +4 -0
- package/out/deploy/packager/archiver.js +19 -15
- package/out/deploy/packager/nativeui-bundler.js +6 -1
- package/out/deploy/packager/packager.js +7 -1
- package/out/deploy/packager/runtime-bundler.d.ts +3 -2
- package/out/deploy/packager/runtime-bundler.d.ts.map +1 -1
- package/out/deploy/packager/runtime-bundler.js +14 -5
- package/out/deploy/uploader/artifact-graphql-client.js +1 -0
- package/out/deploy/uploader/uploader.js +5 -0
- package/out/entities/graphql-client.js +2 -2
- package/out/entities/list-indexes.js +1 -0
- package/out/environment/create-environment.js +6 -1
- package/out/environment/delete-environment.js +6 -1
- package/out/environment/graphql-client.js +6 -3
- package/out/environment/list-environment.js +2 -0
- package/out/environment-variables/delete-environment-variable.js +6 -1
- package/out/environment-variables/graphql-client.js +1 -0
- package/out/environment-variables/list-environment-variables.js +6 -1
- package/out/environment-variables/set-environment-variable.js +6 -1
- package/out/installations/graphql-client.d.ts +1 -0
- package/out/installations/graphql-client.d.ts.map +1 -1
- package/out/installations/graphql-client.js +43 -25
- package/out/installations/install-app-site.js +2 -0
- package/out/installations/site-translation/cloudid-products.js +1 -0
- package/out/installations/uninstall-app.js +2 -0
- package/out/migration-keys/graphql-client.js +4 -4
- package/out/providers/configure-provider.js +6 -1
- package/out/providers/graphql-client.js +1 -0
- package/out/service/cached-config-service.js +1 -0
- package/out/service/custom-entities-service.js +4 -2
- package/out/service/docker-service.js +5 -1
- package/out/service/installation-service.js +7 -4
- package/out/service/lint-service.js +2 -0
- package/out/service/lite-lint-service.js +2 -0
- package/out/service/migration-keys-service.js +2 -0
- package/out/service/port-finding-service.js +1 -0
- package/out/service/resource-packaging-service.js +5 -0
- package/out/service/resources-uploader-service.js +2 -0
- package/out/service/tunnel-analytics-service.js +10 -3
- package/out/service/tunnel-service.js +19 -10
- package/out/storage/local-file-storage.js +2 -2
- package/out/webtrigger/get-webtrigger-url.js +4 -0
- package/out/webtrigger/graphql-client.js +2 -1
- package/out/workers/analytics-message-worker.js +3 -0
- package/out/workers/version-check-worker.js +1 -0
- package/package.json +7 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime-bundler.d.ts","sourceRoot":"","sources":["../../../src/deploy/packager/runtime-bundler.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAiB,mBAAmB,EAAkB,MAAM,gBAAgB,CAAC;AAC7F,OAAO,
|
|
1
|
+
{"version":3,"file":"runtime-bundler.d.ts","sourceRoot":"","sources":["../../../src/deploy/packager/runtime-bundler.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAiB,mBAAmB,EAAkB,MAAM,gBAAgB,CAAC;AAC7F,OAAO,EAEL,OAAO,EACP,MAAM,EAIN,UAAU,EACX,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAEtC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAItC,MAAM,WAAW,mBAAmB;IAClC,kBAAkB,EAAE,MAAM,CAAC;IAC3B,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;CACvB;AAED,qBAAa,cAAc;IAEvB,OAAO,CAAC,QAAQ,CAAC,eAAe;IAChC,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,UAAU;gBAHV,eAAe,EAAE,MAAM,QAAQ,EAC/B,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,OAAO,CAAC,mBAAmB,CAAC,EACrC,UAAU,EAAE,UAAU;cAGzB,WAAW,CAAC,QAAQ,EAAE,QAAQ,EAAE,WAAW,EAAE,mBAAmB,EAAE,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;cAsCtF,mBAAmB,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;cAgBtD,UAAU,CACxB,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,OAAO,EAAE,EACnB,aAAa,EAAE,GAAG,CAAC,SAAS,CAAC,GAC5B,OAAO,CAAC,MAAM,EAAE,CAAC;IAUP,MAAM,CAAC,QAAQ,EAAE,OAAO,EAAE,EAAE,aAAa,CAAC,EAAE,GAAG,CAAC,SAAS,CAAC,GAAG,OAAO,CAAC,mBAAmB,CAAC;CAUvG;AAED,qBAAa,qBAAsB,SAAQ,cAAc;IAC1C,MAAM,CAAC,QAAQ,EAAE,OAAO,EAAE,EAAE,aAAa,CAAC,EAAE,GAAG,CAAC,SAAS,CAAC,GAAG,OAAO,CAAC,mBAAmB,CAAC;CAMvG;AAED,qBAAa,kBAAmB,SAAQ,cAAc;cACpC,UAAU,CACxB,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,OAAO,EAAE,EACnB,aAAa,EAAE,GAAG,CAAC,SAAS,CAAC,GAC5B,OAAO,CAAC,MAAM,EAAE,CAAC;CASrB"}
|
|
@@ -7,10 +7,15 @@ const cli_shared_1 = require("@forge/cli-shared");
|
|
|
7
7
|
const packager_1 = require("./packager");
|
|
8
8
|
const node_1 = require("@forge/bundler/out/config/node");
|
|
9
9
|
class RuntimeBundler {
|
|
10
|
-
|
|
10
|
+
archiverFactory;
|
|
11
|
+
logger;
|
|
12
|
+
bundler;
|
|
13
|
+
configFile;
|
|
14
|
+
constructor(archiverFactory, logger, bundler, configFile) {
|
|
11
15
|
this.archiverFactory = archiverFactory;
|
|
12
16
|
this.logger = logger;
|
|
13
17
|
this.bundler = bundler;
|
|
18
|
+
this.configFile = configFile;
|
|
14
19
|
}
|
|
15
20
|
async packageCode(archiver, entryPoints) {
|
|
16
21
|
const moduleList = [];
|
|
@@ -43,9 +48,14 @@ class RuntimeBundler {
|
|
|
43
48
|
}
|
|
44
49
|
async packageDependencies(archiver) {
|
|
45
50
|
for (const fileName of cli_shared_1.dependencyFileNames) {
|
|
46
|
-
if ((0, fs_1.existsSync)(fileName)) {
|
|
47
|
-
|
|
51
|
+
if (!(0, fs_1.existsSync)(fileName)) {
|
|
52
|
+
continue;
|
|
48
53
|
}
|
|
54
|
+
if (fileName === cli_shared_1.manifestFileName) {
|
|
55
|
+
archiver.addFile(fileName, Buffer.from(this.configFile.readConfigAsString()));
|
|
56
|
+
continue;
|
|
57
|
+
}
|
|
58
|
+
archiver.addFileFrom(fileName, fileName);
|
|
49
59
|
}
|
|
50
60
|
}
|
|
51
61
|
async packageAll(archiver, handlers, packageConfig) {
|
|
@@ -74,9 +84,8 @@ class SandboxRuntimeBundler extends RuntimeBundler {
|
|
|
74
84
|
exports.SandboxRuntimeBundler = SandboxRuntimeBundler;
|
|
75
85
|
class NodeRuntimeBundler extends RuntimeBundler {
|
|
76
86
|
async packageAll(archiver, handlers, packageConfig) {
|
|
77
|
-
var _a;
|
|
78
87
|
const moduleList = await super.packageAll(archiver, handlers, packageConfig);
|
|
79
|
-
const files = await new cli_shared_1.FileSystemReader().getFileGlobList(
|
|
88
|
+
const files = await new cli_shared_1.FileSystemReader().getFileGlobList(packageConfig?.extraFiles ?? []);
|
|
80
89
|
files.forEach((fileName) => {
|
|
81
90
|
archiver.addFileFrom(fileName, fileName);
|
|
82
91
|
});
|
|
@@ -3,6 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.AppArchiveUploader = void 0;
|
|
4
4
|
const cli_shared_1 = require("@forge/cli-shared");
|
|
5
5
|
class AppArchiveUploader {
|
|
6
|
+
getConfiguredApp;
|
|
7
|
+
artifact;
|
|
8
|
+
uploader;
|
|
9
|
+
logger;
|
|
10
|
+
uploaderService;
|
|
6
11
|
constructor(getConfiguredApp, artifact, uploader, logger, uploaderService) {
|
|
7
12
|
this.getConfiguredApp = getConfiguredApp;
|
|
8
13
|
this.artifact = artifact;
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.EntitiesGraphqlClient = void 0;
|
|
4
4
|
class EntitiesGraphqlClient {
|
|
5
|
+
graphQLClient;
|
|
5
6
|
constructor(graphQLClient) {
|
|
6
7
|
this.graphQLClient = graphQLClient;
|
|
7
8
|
}
|
|
8
9
|
async getEntitiesDefinitions(oauthClientId) {
|
|
9
|
-
var _a;
|
|
10
10
|
const query = `
|
|
11
11
|
query forge_cli_getAppOauthClientIdDetails($oauthClientId: String!) {
|
|
12
12
|
ersLifecycle {
|
|
@@ -28,7 +28,7 @@ class EntitiesGraphqlClient {
|
|
|
28
28
|
const result = await this.graphQLClient.query(query, {
|
|
29
29
|
oauthClientId
|
|
30
30
|
});
|
|
31
|
-
return
|
|
31
|
+
return result?.ersLifecycle?.doneEntitiesFromERS || [];
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
exports.EntitiesGraphqlClient = EntitiesGraphqlClient;
|
|
@@ -7,6 +7,7 @@ var CustomEntityIndexStatus;
|
|
|
7
7
|
CustomEntityIndexStatus["CREATING"] = "CREATING";
|
|
8
8
|
})(CustomEntityIndexStatus = exports.CustomEntityIndexStatus || (exports.CustomEntityIndexStatus = {}));
|
|
9
9
|
class ListEntitiesIndexesCommand {
|
|
10
|
+
customEntitiesService;
|
|
10
11
|
constructor(customEntitiesService) {
|
|
11
12
|
this.customEntitiesService = customEntitiesService;
|
|
12
13
|
}
|
|
@@ -2,13 +2,18 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.CreateEnvironmentCommand = void 0;
|
|
4
4
|
class CreateEnvironmentCommand {
|
|
5
|
+
client;
|
|
6
|
+
getAppConfig;
|
|
5
7
|
constructor(client, getAppConfig) {
|
|
6
8
|
this.client = client;
|
|
7
9
|
this.getAppConfig = getAppConfig;
|
|
8
10
|
}
|
|
9
11
|
async execute(details) {
|
|
10
12
|
const { id: appId } = await this.getAppConfig();
|
|
11
|
-
await this.client.createEnvironment(
|
|
13
|
+
await this.client.createEnvironment({
|
|
14
|
+
...details,
|
|
15
|
+
appId
|
|
16
|
+
});
|
|
12
17
|
}
|
|
13
18
|
}
|
|
14
19
|
exports.CreateEnvironmentCommand = CreateEnvironmentCommand;
|
|
@@ -2,13 +2,18 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.DeleteEnvironmentCommand = void 0;
|
|
4
4
|
class DeleteEnvironmentCommand {
|
|
5
|
+
client;
|
|
6
|
+
getAppConfig;
|
|
5
7
|
constructor(client, getAppConfig) {
|
|
6
8
|
this.client = client;
|
|
7
9
|
this.getAppConfig = getAppConfig;
|
|
8
10
|
}
|
|
9
11
|
async batchExecute(details) {
|
|
10
12
|
const { id: appId } = await this.getAppConfig();
|
|
11
|
-
return this.client.deleteEnvironments(
|
|
13
|
+
return this.client.deleteEnvironments({
|
|
14
|
+
...details,
|
|
15
|
+
appId
|
|
16
|
+
});
|
|
12
17
|
}
|
|
13
18
|
}
|
|
14
19
|
exports.DeleteEnvironmentCommand = DeleteEnvironmentCommand;
|
|
@@ -7,6 +7,7 @@ class MissingAppError extends cli_shared_1.UserError {
|
|
|
7
7
|
}
|
|
8
8
|
exports.MissingAppError = MissingAppError;
|
|
9
9
|
class GraphqlClient {
|
|
10
|
+
graphqlClient;
|
|
10
11
|
constructor(graphqlClient) {
|
|
11
12
|
this.graphqlClient = graphqlClient;
|
|
12
13
|
}
|
|
@@ -71,11 +72,10 @@ class GraphqlClient {
|
|
|
71
72
|
throw new MissingAppError();
|
|
72
73
|
}
|
|
73
74
|
return app.environments.map((environment) => {
|
|
74
|
-
var _a, _b, _c;
|
|
75
75
|
return {
|
|
76
76
|
type: environment.type,
|
|
77
77
|
key: environment.key,
|
|
78
|
-
lastDeployedAt:
|
|
78
|
+
lastDeployedAt: environment.versions?.nodes?.[0]?.updatedAt || environment.createdAt
|
|
79
79
|
};
|
|
80
80
|
});
|
|
81
81
|
}
|
|
@@ -83,7 +83,10 @@ class GraphqlClient {
|
|
|
83
83
|
const results = [];
|
|
84
84
|
for (const environmentKey of details.environmentKeys) {
|
|
85
85
|
try {
|
|
86
|
-
const success = await this.deleteEnvironment(
|
|
86
|
+
const success = await this.deleteEnvironment({
|
|
87
|
+
...details,
|
|
88
|
+
environmentKey
|
|
89
|
+
});
|
|
87
90
|
results.push({ environmentKey, successful: success });
|
|
88
91
|
}
|
|
89
92
|
catch (err) {
|
|
@@ -2,13 +2,18 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.DeleteEnvironmentVariableCommand = void 0;
|
|
4
4
|
class DeleteEnvironmentVariableCommand {
|
|
5
|
+
client;
|
|
6
|
+
getAppConfig;
|
|
5
7
|
constructor(client, getAppConfig) {
|
|
6
8
|
this.client = client;
|
|
7
9
|
this.getAppConfig = getAppConfig;
|
|
8
10
|
}
|
|
9
11
|
async execute(details) {
|
|
10
12
|
const { id: appId } = await this.getAppConfig();
|
|
11
|
-
await this.client.deleteEnvironmentVariable(
|
|
13
|
+
await this.client.deleteEnvironmentVariable({
|
|
14
|
+
...details,
|
|
15
|
+
appId
|
|
16
|
+
});
|
|
12
17
|
}
|
|
13
18
|
}
|
|
14
19
|
exports.DeleteEnvironmentVariableCommand = DeleteEnvironmentVariableCommand;
|
|
@@ -2,13 +2,18 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ListEnvironmentVariablesCommand = void 0;
|
|
4
4
|
class ListEnvironmentVariablesCommand {
|
|
5
|
+
client;
|
|
6
|
+
getAppConfig;
|
|
5
7
|
constructor(client, getAppConfig) {
|
|
6
8
|
this.client = client;
|
|
7
9
|
this.getAppConfig = getAppConfig;
|
|
8
10
|
}
|
|
9
11
|
async execute(details) {
|
|
10
12
|
const { id: appId } = await this.getAppConfig();
|
|
11
|
-
return await this.client.listEnvironmentVariables(
|
|
13
|
+
return await this.client.listEnvironmentVariables({
|
|
14
|
+
...details,
|
|
15
|
+
appId
|
|
16
|
+
});
|
|
12
17
|
}
|
|
13
18
|
}
|
|
14
19
|
exports.ListEnvironmentVariablesCommand = ListEnvironmentVariablesCommand;
|
|
@@ -2,13 +2,18 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SetEnvironmentVariableCommand = void 0;
|
|
4
4
|
class SetEnvironmentVariableCommand {
|
|
5
|
+
client;
|
|
6
|
+
getAppConfig;
|
|
5
7
|
constructor(client, getAppConfig) {
|
|
6
8
|
this.client = client;
|
|
7
9
|
this.getAppConfig = getAppConfig;
|
|
8
10
|
}
|
|
9
11
|
async execute(details) {
|
|
10
12
|
const { id: appId } = await this.getAppConfig();
|
|
11
|
-
await this.client.setEnvironmentVariable(
|
|
13
|
+
await this.client.setEnvironmentVariable({
|
|
14
|
+
...details,
|
|
15
|
+
appId
|
|
16
|
+
});
|
|
12
17
|
}
|
|
13
18
|
}
|
|
14
19
|
exports.SetEnvironmentVariableCommand = SetEnvironmentVariableCommand;
|
|
@@ -67,6 +67,7 @@ export declare class InstallationsGraphqlClient implements InstallAppClient, Lis
|
|
|
67
67
|
listInstallations(appId: string): Promise<Installation[]>;
|
|
68
68
|
getInstallation(appId: string, installationId: string): Promise<Installation>;
|
|
69
69
|
private getAppInstallationTask;
|
|
70
|
+
private getAppInstallationTaskRetry;
|
|
70
71
|
private monitorUninstallApp;
|
|
71
72
|
private getResourceArisForProduct;
|
|
72
73
|
private getCombinedHostnameMap;
|
|
@@ -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":"AAKA,OAAO,EAKL,sBAAsB,EAKtB,aAAa,EACb,oBAAoB,EAOpB,KAAK,EAGL,SAAS,EACT,SAAS,EACT,iBAAiB,EAClB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC7E,OAAO,EACL,yBAAyB,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,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;YAqCtB,2BAA2B;YAY3B,mBAAmB;IAiBjC,OAAO,CAAC,yBAAyB;YAOnB,sBAAsB;YAoBtB,6BAA6B;YAmC7B,mBAAmB;IAsEpB,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,SAAI,GAAG,OAAO,CAAC,yBAAyB,CAAC;CAyChH"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.InstallationsGraphqlClient = exports.UnknownSiteWithoutResourceIdError = exports.InstallationNotFoundError = exports.MissingAppUninstallTask = exports.MissingAppEnvironmentError = 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 exponential_backoff_1 = require("exponential-backoff");
|
|
4
5
|
const ari_1 = require("@forge/util/packages/ari");
|
|
5
6
|
const cli_shared_1 = require("@forge/cli-shared");
|
|
6
7
|
const harmonized_app_installation_errors_1 = require("./harmonized-apps/harmonized-app-installation-errors");
|
|
@@ -46,6 +47,8 @@ class MissingTaskIdError extends Error {
|
|
|
46
47
|
}
|
|
47
48
|
exports.MissingTaskIdError = MissingTaskIdError;
|
|
48
49
|
class InstallationRequestFailedError extends cli_shared_1.BaseError {
|
|
50
|
+
userError;
|
|
51
|
+
code;
|
|
49
52
|
constructor(userError, code, message, requestId) {
|
|
50
53
|
super(requestId, message);
|
|
51
54
|
this.userError = userError;
|
|
@@ -75,15 +78,13 @@ class UnknownSiteWithoutResourceIdError extends Error {
|
|
|
75
78
|
}
|
|
76
79
|
exports.UnknownSiteWithoutResourceIdError = UnknownSiteWithoutResourceIdError;
|
|
77
80
|
class InstallationsGraphqlClient {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
this.WORKSPACE_RESOURCE_TYPE = 'workspace';
|
|
86
|
-
}
|
|
81
|
+
graphqlClient;
|
|
82
|
+
cloudIdTranslator;
|
|
83
|
+
bitbucketTranslator;
|
|
84
|
+
pause;
|
|
85
|
+
featureFlagReader;
|
|
86
|
+
SITE_RESOURCE_TYPE = 'site';
|
|
87
|
+
WORKSPACE_RESOURCE_TYPE = 'workspace';
|
|
87
88
|
static buildInstallationContext(product, resourceId, resourceType) {
|
|
88
89
|
const ari = ari_1.AnyAri.create({
|
|
89
90
|
resourceOwner: (0, cli_shared_1.ariResourceOwner)(product),
|
|
@@ -92,6 +93,13 @@ class InstallationsGraphqlClient {
|
|
|
92
93
|
});
|
|
93
94
|
return ari.toString();
|
|
94
95
|
}
|
|
96
|
+
constructor(graphqlClient, cloudIdTranslator, bitbucketTranslator, pause, featureFlagReader) {
|
|
97
|
+
this.graphqlClient = graphqlClient;
|
|
98
|
+
this.cloudIdTranslator = cloudIdTranslator;
|
|
99
|
+
this.bitbucketTranslator = bitbucketTranslator;
|
|
100
|
+
this.pause = pause;
|
|
101
|
+
this.featureFlagReader = featureFlagReader;
|
|
102
|
+
}
|
|
95
103
|
async buildInstallationContext(product, site) {
|
|
96
104
|
const ari = await this.getProductTranslation(product).buildInstallationContext(product, site);
|
|
97
105
|
return ari.toString();
|
|
@@ -187,20 +195,20 @@ class InstallationsGraphqlClient {
|
|
|
187
195
|
await this.monitorAppInstallOrUpgrade(taskId);
|
|
188
196
|
}
|
|
189
197
|
async monitorAppInstallOrUpgrade(taskId) {
|
|
190
|
-
var _a, _b, _c, _d, _e;
|
|
191
198
|
let status = cli_shared_1.AppTaskState.Pending;
|
|
192
199
|
while (status !== cli_shared_1.AppTaskState.Complete) {
|
|
193
|
-
const
|
|
194
|
-
status = state;
|
|
200
|
+
const result = await this.getAppInstallationTaskRetry(taskId);
|
|
201
|
+
status = result.state;
|
|
195
202
|
if (status === cli_shared_1.AppTaskState.Failed) {
|
|
203
|
+
const { errors, requestId } = result;
|
|
196
204
|
const shouldDisplayHarmonizedAppInstallationErrors = await this.featureFlagReader.shouldDisplayErrorsForHarmonizedApps();
|
|
197
|
-
const error = errors
|
|
198
|
-
const statusCode =
|
|
205
|
+
const error = errors?.[0];
|
|
206
|
+
const statusCode = error?.extensions?.statusCode;
|
|
199
207
|
const isUserError = statusCode && statusCode >= 400 && statusCode < 500 ? true : false;
|
|
200
|
-
const code =
|
|
208
|
+
const code = error?.extensions?.errorType ?? undefined;
|
|
201
209
|
throw new InstallationRequestFailedError(isUserError, code, shouldDisplayHarmonizedAppInstallationErrors
|
|
202
|
-
? (0, harmonized_app_installation_errors_1.expandHarmonizedAppInstallationError)(code,
|
|
203
|
-
:
|
|
210
|
+
? (0, harmonized_app_installation_errors_1.expandHarmonizedAppInstallationError)(code, error?.message ?? undefined)
|
|
211
|
+
: error?.message ?? undefined, requestId);
|
|
204
212
|
}
|
|
205
213
|
if (status !== cli_shared_1.AppTaskState.Complete)
|
|
206
214
|
await this.pause(exports.UNINSTALLATION_EVENT_POLL_INTERVAL);
|
|
@@ -241,10 +249,10 @@ class InstallationsGraphqlClient {
|
|
|
241
249
|
this.uninstallApp(app),
|
|
242
250
|
new Promise((resolve) => setTimeout(resolve, 1000))
|
|
243
251
|
]);
|
|
244
|
-
uninstallsResult.push(
|
|
252
|
+
uninstallsResult.push({ ...app, successful: success });
|
|
245
253
|
}
|
|
246
254
|
catch (err) {
|
|
247
|
-
uninstallsResult.push(
|
|
255
|
+
uninstallsResult.push({ ...app, successful: false });
|
|
248
256
|
}
|
|
249
257
|
}
|
|
250
258
|
return uninstallsResult;
|
|
@@ -289,10 +297,19 @@ class InstallationsGraphqlClient {
|
|
|
289
297
|
requestId
|
|
290
298
|
};
|
|
291
299
|
}
|
|
300
|
+
async getAppInstallationTaskRetry(taskId) {
|
|
301
|
+
return (0, exponential_backoff_1.backOff)(() => this.getAppInstallationTask(taskId), {
|
|
302
|
+
startingDelay: 5000,
|
|
303
|
+
numOfAttempts: 40,
|
|
304
|
+
maxDelay: 20000,
|
|
305
|
+
jitter: 'full',
|
|
306
|
+
retry: (e) => e instanceof cli_shared_1.GraphQLProviderServiceError && e.getCode() === 'TOO_MANY_REQUESTS'
|
|
307
|
+
});
|
|
308
|
+
}
|
|
292
309
|
async monitorUninstallApp(taskId) {
|
|
293
310
|
let status = cli_shared_1.AppTaskState.Pending;
|
|
294
311
|
while (status !== cli_shared_1.AppTaskState.Complete) {
|
|
295
|
-
const { state } = await this.
|
|
312
|
+
const { state } = await this.getAppInstallationTaskRetry(taskId);
|
|
296
313
|
status = state;
|
|
297
314
|
if (status === cli_shared_1.AppTaskState.Failed) {
|
|
298
315
|
return false;
|
|
@@ -310,7 +327,10 @@ class InstallationsGraphqlClient {
|
|
|
310
327
|
const workspaceAriToHostname = await this.bitbucketTranslator.getSitesForResourceAris(bitbucketAris);
|
|
311
328
|
const cloudIdAris = this.getResourceArisForProduct(installationContexts, this.cloudIdTranslator.ariBelongsToProduct);
|
|
312
329
|
const siteAriToHostname = await this.cloudIdTranslator.getSitesForResourceAris(cloudIdAris);
|
|
313
|
-
const combinedAriToHostname =
|
|
330
|
+
const combinedAriToHostname = {
|
|
331
|
+
...siteAriToHostname,
|
|
332
|
+
...workspaceAriToHostname
|
|
333
|
+
};
|
|
314
334
|
return combinedAriToHostname;
|
|
315
335
|
}
|
|
316
336
|
async resolveInstallationsHostnames(installations) {
|
|
@@ -343,7 +363,6 @@ class InstallationsGraphqlClient {
|
|
|
343
363
|
});
|
|
344
364
|
}
|
|
345
365
|
async getAllInstallations(appId) {
|
|
346
|
-
var _a, _b;
|
|
347
366
|
const query = `
|
|
348
367
|
query forge_cli_getEcosystemInstallationsByApp($filter: AppInstallationsByAppFilter!, $first: Int, $after: String) {
|
|
349
368
|
ecosystem {
|
|
@@ -380,7 +399,7 @@ class InstallationsGraphqlClient {
|
|
|
380
399
|
first: 100,
|
|
381
400
|
after: cursor
|
|
382
401
|
}));
|
|
383
|
-
if (!
|
|
402
|
+
if (!result?.ecosystem?.appInstallationsByApp?.nodes) {
|
|
384
403
|
throw new MissingAppError();
|
|
385
404
|
}
|
|
386
405
|
const { nodes, pageInfo } = result.ecosystem.appInstallationsByApp;
|
|
@@ -402,7 +421,6 @@ class InstallationsGraphqlClient {
|
|
|
402
421
|
return output;
|
|
403
422
|
}
|
|
404
423
|
async getVersions(appId, environmentKey, firstN = 1) {
|
|
405
|
-
var _a;
|
|
406
424
|
const query = `
|
|
407
425
|
query forge_cli_getApplicationEnvironmentLatestVersions($appId: ID!, $environmentKey: String!, $firstN: Int!) {
|
|
408
426
|
app(id: $appId) {
|
|
@@ -436,7 +454,7 @@ class InstallationsGraphqlClient {
|
|
|
436
454
|
throw new EnvironmentNotFoundError(environmentKey);
|
|
437
455
|
}
|
|
438
456
|
return {
|
|
439
|
-
nodes:
|
|
457
|
+
nodes: result.app.environmentByKey.versions?.nodes,
|
|
440
458
|
environmentType: result.app.environmentByKey.type
|
|
441
459
|
};
|
|
442
460
|
}
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.InstallAppSiteCommand = void 0;
|
|
4
4
|
class InstallAppSiteCommand {
|
|
5
|
+
getAppConfig;
|
|
6
|
+
installAppClient;
|
|
5
7
|
constructor(getAppConfig, installAppClient) {
|
|
6
8
|
this.getAppConfig = getAppConfig;
|
|
7
9
|
this.installAppClient = installAppClient;
|
|
@@ -3,11 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.GraphqlClient = void 0;
|
|
4
4
|
const cli_shared_1 = require("@forge/cli-shared");
|
|
5
5
|
class GraphqlClient {
|
|
6
|
+
graphqlClient;
|
|
6
7
|
constructor(graphqlClient) {
|
|
7
8
|
this.graphqlClient = graphqlClient;
|
|
8
9
|
}
|
|
9
10
|
async getLatestMigrationKeys(appId, environmentKey) {
|
|
10
|
-
var _a, _b;
|
|
11
11
|
const marketplaceQuery = (0, cli_shared_1.isFedrampEnv)() ? '' : 'marketplaceApp { appKey }';
|
|
12
12
|
const query = `
|
|
13
13
|
query forge_cli_getMigrationKeys($id: ID!, $key: String!) {
|
|
@@ -40,12 +40,12 @@ class GraphqlClient {
|
|
|
40
40
|
if (!result.app.environmentByKey) {
|
|
41
41
|
throw new cli_shared_1.MissingAppEnvironmentError(environmentKey);
|
|
42
42
|
}
|
|
43
|
-
const mpacAppKey =
|
|
43
|
+
const mpacAppKey = result.app.marketplaceApp?.appKey;
|
|
44
44
|
const versions = result.app.environmentByKey.versions;
|
|
45
45
|
let migrationKeys;
|
|
46
|
-
for (const edge of
|
|
46
|
+
for (const edge of versions?.edges || []) {
|
|
47
47
|
if (edge) {
|
|
48
|
-
migrationKeys =
|
|
48
|
+
migrationKeys = edge.node?.migrationKeys;
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
return { migrationKeys, mpacAppKey };
|
|
@@ -2,13 +2,18 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ConfigureProviderCommand = void 0;
|
|
4
4
|
class ConfigureProviderCommand {
|
|
5
|
+
client;
|
|
6
|
+
getAppConfig;
|
|
5
7
|
constructor(client, getAppConfig) {
|
|
6
8
|
this.client = client;
|
|
7
9
|
this.getAppConfig = getAppConfig;
|
|
8
10
|
}
|
|
9
11
|
async execute(details) {
|
|
10
12
|
const { id: appId } = await this.getAppConfig();
|
|
11
|
-
await this.client.configureProvider(
|
|
13
|
+
await this.client.configureProvider({
|
|
14
|
+
...details,
|
|
15
|
+
appId
|
|
16
|
+
});
|
|
12
17
|
}
|
|
13
18
|
}
|
|
14
19
|
exports.ConfigureProviderCommand = ConfigureProviderCommand;
|
|
@@ -5,6 +5,7 @@ const ANALYTICS_PREFERENCES_KEY = 'analytics-preferences';
|
|
|
5
5
|
const DEFAULT_ENVIRONMENT_KEY = 'default-environment';
|
|
6
6
|
const NGROK_CONFIG_PATH_KEY = 'ngrok-config-path';
|
|
7
7
|
class CachedConfigService {
|
|
8
|
+
cachedConf;
|
|
8
9
|
constructor(cachedConf) {
|
|
9
10
|
this.cachedConf = cachedConf;
|
|
10
11
|
}
|
|
@@ -4,6 +4,9 @@ exports.CustomEntitiesService = void 0;
|
|
|
4
4
|
const cli_shared_1 = require("@forge/cli-shared");
|
|
5
5
|
const list_indexes_1 = require("../entities/list-indexes");
|
|
6
6
|
class CustomEntitiesService {
|
|
7
|
+
appConfigProvider;
|
|
8
|
+
appOauthClient;
|
|
9
|
+
entitiesGraphqlClient;
|
|
7
10
|
constructor(appConfigProvider, appOauthClient, entitiesGraphqlClient) {
|
|
8
11
|
this.appConfigProvider = appConfigProvider;
|
|
9
12
|
this.appOauthClient = appOauthClient;
|
|
@@ -24,7 +27,6 @@ class CustomEntitiesService {
|
|
|
24
27
|
return transformedIndexes;
|
|
25
28
|
}
|
|
26
29
|
async listEntitiesIndexes(environment) {
|
|
27
|
-
var _a;
|
|
28
30
|
const { id: appId } = await this.appConfigProvider();
|
|
29
31
|
const { environmentId, oauthClientId } = await this.appOauthClient.getAppOauthClientIdDetails(appId, environment);
|
|
30
32
|
const results = await this.entitiesGraphqlClient.getEntitiesDefinitions(oauthClientId);
|
|
@@ -34,7 +36,7 @@ class CustomEntitiesService {
|
|
|
34
36
|
const [, , , ...entityName] = entity.name.split('_');
|
|
35
37
|
const transformedIndexesPerEntity = [];
|
|
36
38
|
let byKeyIndex = {};
|
|
37
|
-
for (const index of
|
|
39
|
+
for (const index of entity.indexes ?? []) {
|
|
38
40
|
if (indexesToExclude.indexOf(index.name) < 0) {
|
|
39
41
|
if (index.name === 'by-key') {
|
|
40
42
|
byKeyIndex = {
|
|
@@ -8,6 +8,7 @@ const command_exists_1 = tslib_1.__importDefault(require("command-exists"));
|
|
|
8
8
|
const cross_spawn_1 = require("cross-spawn");
|
|
9
9
|
const cli_shared_1 = require("@forge/cli-shared");
|
|
10
10
|
class DockerError extends cli_shared_1.UserError {
|
|
11
|
+
code;
|
|
11
12
|
constructor(message, code) {
|
|
12
13
|
super(message);
|
|
13
14
|
this.code = code;
|
|
@@ -46,7 +47,10 @@ class DockerService {
|
|
|
46
47
|
downloadImage(imageName) {
|
|
47
48
|
this.verifyInstalled();
|
|
48
49
|
return (0, cross_spawn_1.spawn)('docker', ['pull', imageName], {
|
|
49
|
-
env:
|
|
50
|
+
env: {
|
|
51
|
+
...process.env,
|
|
52
|
+
DOCKER_CLI_HINTS: '0'
|
|
53
|
+
}
|
|
50
54
|
});
|
|
51
55
|
}
|
|
52
56
|
startCleanupWorker(pids, containerName) {
|
|
@@ -8,6 +8,9 @@ const graphql_client_1 = require("../installations/graphql-client");
|
|
|
8
8
|
const IDENTITY_PRODUCT_NAME = 'identity';
|
|
9
9
|
const JIRA_SERVICE_DESK_PRODUCT_NAME = 'jira-servicedesk';
|
|
10
10
|
class InstallationService {
|
|
11
|
+
getAppConfig;
|
|
12
|
+
listInstallationsClient;
|
|
13
|
+
upgradeAppInstallationsClient;
|
|
11
14
|
constructor(getAppConfig, listInstallationsClient, upgradeAppInstallationsClient) {
|
|
12
15
|
this.getAppConfig = getAppConfig;
|
|
13
16
|
this.listInstallationsClient = listInstallationsClient;
|
|
@@ -27,7 +30,7 @@ class InstallationService {
|
|
|
27
30
|
async listAppInstallations(filter) {
|
|
28
31
|
const { id: appId } = await this.getAppConfig();
|
|
29
32
|
const installations = await this.listInstallationsClient.listInstallations(appId);
|
|
30
|
-
return { installations: this.filterInstallations(installations,
|
|
33
|
+
return { installations: this.filterInstallations(installations, { ...filter }) };
|
|
31
34
|
}
|
|
32
35
|
async listNonTechnicalAppInstallations(filter) {
|
|
33
36
|
const { installations } = await this.listAppInstallations(filter);
|
|
@@ -61,17 +64,17 @@ class InstallationService {
|
|
|
61
64
|
}
|
|
62
65
|
}
|
|
63
66
|
getPermissionsFromAppEnvironmentVersion(appEnvironmentVersion) {
|
|
64
|
-
const permissions = appEnvironmentVersion
|
|
67
|
+
const permissions = appEnvironmentVersion?.permissions[0];
|
|
65
68
|
if (!permissions) {
|
|
66
69
|
return { scopes: [], egressAddresses: [] };
|
|
67
70
|
}
|
|
68
71
|
const scopes = permissions.scopes.map((s) => s.key);
|
|
69
|
-
const egressAddresses =
|
|
72
|
+
const egressAddresses = permissions?.egress ? (0, cli_shared_1.flatMap)(permissions.egress, ({ addresses }) => addresses ?? []) : [];
|
|
70
73
|
return { scopes, egressAddresses };
|
|
71
74
|
}
|
|
72
75
|
async getAppEnvironmentPermissions(appId, environmentKey) {
|
|
73
76
|
const versionDetails = await this.listInstallationsClient.getVersions(appId, environmentKey, 2);
|
|
74
|
-
const versions = versionDetails
|
|
77
|
+
const versions = versionDetails?.nodes;
|
|
75
78
|
if (!versions || versions.length === 0)
|
|
76
79
|
return;
|
|
77
80
|
const [{ scopes, egressAddresses }, oldVersion] = versions.map((appEnvironmentVersion) => this.getPermissionsFromAppEnvironmentVersion(appEnvironmentVersion));
|
|
@@ -7,6 +7,8 @@ const lint_1 = require("@forge/lint");
|
|
|
7
7
|
const path_1 = tslib_1.__importDefault(require("path"));
|
|
8
8
|
exports.DEFAULT_DIRECTORY = './src';
|
|
9
9
|
class LintService {
|
|
10
|
+
configFile;
|
|
11
|
+
fileSystemReader;
|
|
10
12
|
constructor(configFile, fileSystemReader) {
|
|
11
13
|
this.configFile = configFile;
|
|
12
14
|
this.fileSystemReader = fileSystemReader;
|