@forge/cli 6.12.0 → 6.13.0-next.8
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 +105 -0
- package/npm-shrinkwrap.json +81 -77
- package/out/analytics-client/analytics-client.d.ts +1 -1
- package/out/analytics-client/analytics-client.d.ts.map +1 -1
- package/out/analytics-client/analytics-client.js +3 -1
- package/out/command-line/command.d.ts.map +1 -1
- package/out/command-line/command.js +1 -4
- package/out/command-line/controller/default-environment-controller.d.ts.map +1 -1
- package/out/command-line/controller/default-environment-controller.js +2 -2
- package/out/command-line/controller/deploy-controller.d.ts +5 -2
- package/out/command-line/controller/deploy-controller.d.ts.map +1 -1
- package/out/command-line/controller/deploy-controller.js +22 -5
- package/out/command-line/controller/install-controller.d.ts.map +1 -1
- package/out/command-line/controller/install-controller.js +5 -5
- package/out/command-line/controller/settings-controller.d.ts.map +1 -1
- package/out/command-line/controller/settings-controller.js +7 -4
- package/out/command-line/controller/tunnel-controller.d.ts +3 -3
- package/out/command-line/controller/tunnel-controller.d.ts.map +1 -1
- package/out/command-line/controller/tunnel-controller.js +3 -3
- package/out/command-line/dependency-injection.d.ts +5 -2
- package/out/command-line/dependency-injection.d.ts.map +1 -1
- package/out/command-line/dependency-injection.js +19 -13
- package/out/command-line/environment.d.ts.map +1 -1
- package/out/command-line/environment.js +1 -1
- package/out/command-line/register-app-commands.d.ts.map +1 -1
- package/out/command-line/register-app-commands.js +23 -24
- package/out/command-line/register-environment-commands.d.ts.map +1 -1
- package/out/command-line/register-environment-commands.js +2 -2
- package/out/command-line/register-environment-variables-commands.d.ts.map +1 -1
- package/out/command-line/register-environment-variables-commands.js +4 -4
- package/out/command-line/register-installation-commands.d.ts.map +1 -1
- package/out/command-line/register-installation-commands.js +2 -2
- package/out/command-line/register-providers-commands.d.ts.map +1 -1
- package/out/command-line/register-providers-commands.js +1 -2
- package/out/command-line/register-storage-commands.d.ts.map +1 -1
- package/out/command-line/register-storage-commands.js +4 -2
- package/out/command-line/view/deploy-view.d.ts +4 -2
- package/out/command-line/view/deploy-view.d.ts.map +1 -1
- package/out/command-line/view/deploy-view.js +13 -5
- package/out/command-line/view/install-view.js +1 -1
- package/out/command-line/view/settings-view.d.ts +1 -0
- package/out/command-line/view/settings-view.d.ts.map +1 -1
- package/out/command-line/view/settings-view.js +5 -0
- package/out/command-line/view/tunnel-view.d.ts.map +1 -1
- package/out/command-line/view/tunnel-view.js +1 -1
- package/out/entities/graphql-client.d.ts +1 -1
- package/out/entities/graphql-client.d.ts.map +1 -1
- package/out/entities/graphql-client.js +5 -7
- package/out/entities/list-indexes.d.ts +7 -7
- package/out/entities/list-indexes.d.ts.map +1 -1
- package/out/entities/list-indexes.js +4 -48
- package/out/environment/graphql-client.d.ts.map +1 -1
- package/out/environment/graphql-client.js +1 -1
- package/out/installations/graphql-client.d.ts.map +1 -1
- package/out/installations/graphql-client.js +1 -1
- package/out/service/custom-entities-service.d.ts +12 -0
- package/out/service/custom-entities-service.d.ts.map +1 -0
- package/out/service/custom-entities-service.js +76 -0
- package/out/service/docker-service.d.ts +2 -1
- package/out/service/docker-service.d.ts.map +1 -1
- package/out/service/docker-service.js +2 -2
- package/out/service/tunnel-analytics-service.d.ts +6 -2
- package/out/service/tunnel-analytics-service.d.ts.map +1 -1
- package/out/service/tunnel-analytics-service.js +11 -1
- package/out/service/tunnel-service.d.ts +7 -3
- package/out/service/tunnel-service.d.ts.map +1 -1
- package/out/service/tunnel-service.js +31 -5
- package/package.json +6 -6
|
@@ -11,8 +11,8 @@ class DeployView {
|
|
|
11
11
|
getLogger() {
|
|
12
12
|
return this.ui;
|
|
13
13
|
}
|
|
14
|
-
displayStart(environment) {
|
|
15
|
-
this.ui.info(cli_shared_1.Text.deploy.cmd.start1(environment,
|
|
14
|
+
displayStart(environment, environmentType) {
|
|
15
|
+
this.ui.info(cli_shared_1.Text.deploy.cmd.start1(environment, environmentType));
|
|
16
16
|
}
|
|
17
17
|
displayListAppInstallationsError() {
|
|
18
18
|
this.ui.info(cli_shared_1.Text.deploy.taskListInstallation.listInstallationError);
|
|
@@ -53,7 +53,7 @@ class DeployView {
|
|
|
53
53
|
this.ui.emptyLine();
|
|
54
54
|
}
|
|
55
55
|
displayEnvironmentCreationSuccessMessage(environment) {
|
|
56
|
-
this.ui.info(cli_shared_1.Text.createEnvironment.cmd.success(environment, cli_shared_1.AppEnvironmentType.Development
|
|
56
|
+
this.ui.info(cli_shared_1.Text.createEnvironment.cmd.success(environment, cli_shared_1.AppEnvironmentType.Development));
|
|
57
57
|
this.ui.emptyLine();
|
|
58
58
|
}
|
|
59
59
|
async promptToContinueDeletingConnectKey() {
|
|
@@ -67,9 +67,17 @@ class DeployView {
|
|
|
67
67
|
this.ui.emptyLine();
|
|
68
68
|
return confirm;
|
|
69
69
|
}
|
|
70
|
+
async promptToContinueDeploymentWhileReindexing() {
|
|
71
|
+
this.ui.emptyLine();
|
|
72
|
+
return await this.ui.confirm(cli_shared_1.Text.deploy.reindexingInProgress.continueDeployment);
|
|
73
|
+
}
|
|
74
|
+
displaySuccessfulDeploymentWhileReindexing() {
|
|
75
|
+
this.ui.emptyLine();
|
|
76
|
+
this.ui.info(cli_shared_1.Text.deploy.reindexingInProgress.successfulDeployment);
|
|
77
|
+
}
|
|
70
78
|
async reportDeploymentProgress({ appAri, name, environmentKey, environmentType }, showDistributionPageLink, deployCallback) {
|
|
71
|
-
const result = await this.ui.displayProgress(() => deployCallback(), cli_shared_1.Text.deploy.cmd.start2(name, environmentKey, environmentType
|
|
72
|
-
this.ui.info(cli_shared_1.Text.deploy.cmd.successDetails(name, environmentKey, environmentType
|
|
79
|
+
const result = await this.ui.displayProgress(() => deployCallback(), cli_shared_1.Text.deploy.cmd.start2(name, environmentKey, environmentType), cli_shared_1.Text.deploy.cmd.success);
|
|
80
|
+
this.ui.info(cli_shared_1.Text.deploy.cmd.successDetails(name, environmentKey, environmentType));
|
|
73
81
|
if (environmentType === cli_shared_1.AppEnvironmentType.Production && showDistributionPageLink) {
|
|
74
82
|
this.ui.info(cli_shared_1.Text.deploy.cmd.distributePageLink((0, cs_ari_1.parseAppAri)((0, cs_ari_1.parse)(appAri)).appId));
|
|
75
83
|
}
|
|
@@ -20,7 +20,7 @@ class InstallView {
|
|
|
20
20
|
const egressAddressesMismatch = !(0, lodash_1.isEqual)([...groupedManifestEgressAddresses].sort(), [...egressAddresses].sort());
|
|
21
21
|
permissionsMismatchWithManifest = scopesMismatch || egressAddressesMismatch;
|
|
22
22
|
if (permissionsMismatchWithManifest) {
|
|
23
|
-
this.ui.warn(text.permissionsMismatch(
|
|
23
|
+
this.ui.warn(text.permissionsMismatch(environment));
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
if (!confirmScopes && !nonInteractive) {
|
|
@@ -4,6 +4,7 @@ export declare class SettingsView {
|
|
|
4
4
|
private readonly ui;
|
|
5
5
|
constructor(ui: UI);
|
|
6
6
|
showSettings(preferences: [string, string, PreferenceValue][], json?: boolean): void;
|
|
7
|
+
showAdditionalInfo(message: string): void;
|
|
7
8
|
setSuccess(setting: string, value: string): void;
|
|
8
9
|
}
|
|
9
10
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"settings-view.d.ts","sourceRoot":"","sources":["../../../src/command-line/view/settings-view.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,EAAE,EAAE,MAAM,mBAAmB,CAAC;AAE7C,aAAK,eAAe,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC;AAEpD,qBAAa,YAAY;IACX,OAAO,CAAC,QAAQ,CAAC,EAAE;gBAAF,EAAE,EAAE,EAAE;IAE5B,YAAY,CAAC,WAAW,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,eAAe,CAAC,EAAE,EAAE,IAAI,CAAC,EAAE,OAAO;IAiB7E,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;CAIjD"}
|
|
1
|
+
{"version":3,"file":"settings-view.d.ts","sourceRoot":"","sources":["../../../src/command-line/view/settings-view.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,EAAE,EAAE,MAAM,mBAAmB,CAAC;AAE7C,aAAK,eAAe,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC;AAEpD,qBAAa,YAAY;IACX,OAAO,CAAC,QAAQ,CAAC,EAAE;gBAAF,EAAE,EAAE,EAAE;IAE5B,YAAY,CAAC,WAAW,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,eAAe,CAAC,EAAE,EAAE,IAAI,CAAC,EAAE,OAAO;IAiB7E,kBAAkB,CAAC,OAAO,EAAE,MAAM;IAMlC,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;CAIjD"}
|
|
@@ -18,6 +18,11 @@ class SettingsView {
|
|
|
18
18
|
}
|
|
19
19
|
});
|
|
20
20
|
}
|
|
21
|
+
showAdditionalInfo(message) {
|
|
22
|
+
this.ui.emptyLine();
|
|
23
|
+
this.ui.info(message);
|
|
24
|
+
this.ui.emptyLine();
|
|
25
|
+
}
|
|
21
26
|
setSuccess(setting, value) {
|
|
22
27
|
this.ui.info(cli_shared_1.Text.settings.set.success(setting, value));
|
|
23
28
|
this.ui.emptyLine();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tunnel-view.d.ts","sourceRoot":"","sources":["../../../src/command-line/view/tunnel-view.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,aAAa,
|
|
1
|
+
{"version":3,"file":"tunnel-view.d.ts","sourceRoot":"","sources":["../../../src/command-line/view/tunnel-view.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,aAAa,EAEb,WAAW,EAIX,SAAS,EACV,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAGpC,MAAM,WAAW,yBAAyB;IACxC,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,SAAS,EAAE,MAAM,IAAI,CAAC;CACvB;AAED,qBAAa,eAAgB,SAAQ,SAAS;CAAG;AAEjD,qBAAa,UAAU;IAET,OAAO,CAAC,QAAQ,CAAC,EAAE;IAD/B,OAAO,CAAC,QAAQ,CAAC,gCAAgC,CAAyC;gBAC7D,EAAE,EAAE,aAAa;IAEvC,cAAc,CAAC,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI;IAW7C,qBAAqB,CAAC,MAAM,EAAE,OAAO,WAAW,GAAG,CAAC,GAAG,EAAE,KAAK,KAAK,OAAO,CAAC,IAAI,CAAC;IAQhF,iBAAiB,CAAC,UAAU,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,GAAG,MAAM;IA+BxE,iBAAiB,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM;IAQpG,sBAAsB,CAC3B,yBAAyB,EAAE,UAAU,CAAC,OAAO,KAAK,CAAC,EACnD,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,EAAE,yBAAyB,GAC3D,OAAO,CAAC,IAAI,CAAC;CA4CjB"}
|
|
@@ -16,7 +16,7 @@ class TunnelView {
|
|
|
16
16
|
this.ui.info(cli_shared_1.Text.tunnel.preamble);
|
|
17
17
|
if (environmentKey && environmentKey !== cli_shared_1.DEFAULT_ENVIRONMENT_KEY) {
|
|
18
18
|
this.ui.emptyLine();
|
|
19
|
-
this.ui.info(cli_shared_1.Text.tunnel.startingTunnel(environmentKey, (0, cli_shared_1.guessEnvironmentType)(environmentKey)
|
|
19
|
+
this.ui.info(cli_shared_1.Text.tunnel.startingTunnel(environmentKey, (0, cli_shared_1.guessEnvironmentType)(environmentKey)));
|
|
20
20
|
this.ui.emptyLine();
|
|
21
21
|
}
|
|
22
22
|
this.ui.info(cli_shared_1.Text.ctrlC);
|
|
@@ -2,6 +2,6 @@ import { GraphQLClient } from '@forge/cli-shared';
|
|
|
2
2
|
export declare class EntitiesGraphqlClient {
|
|
3
3
|
private readonly graphQLClient;
|
|
4
4
|
constructor(graphQLClient: GraphQLClient);
|
|
5
|
-
getEntitiesDefinitions(oauthClientId: string
|
|
5
|
+
getEntitiesDefinitions(oauthClientId: string): Promise<any[]>;
|
|
6
6
|
}
|
|
7
7
|
//# sourceMappingURL=graphql-client.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graphql-client.d.ts","sourceRoot":"","sources":["../../src/entities/graphql-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAElD,qBAAa,qBAAqB;IACpB,OAAO,CAAC,QAAQ,CAAC,aAAa;gBAAb,aAAa,EAAE,aAAa;IAE5C,sBAAsB,CAAC,aAAa,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"graphql-client.d.ts","sourceRoot":"","sources":["../../src/entities/graphql-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAElD,qBAAa,qBAAqB;IACpB,OAAO,CAAC,QAAQ,CAAC,aAAa;gBAAb,aAAa,EAAE,aAAa;IAE5C,sBAAsB,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;CA0B3E"}
|
|
@@ -5,13 +5,12 @@ class EntitiesGraphqlClient {
|
|
|
5
5
|
constructor(graphQLClient) {
|
|
6
6
|
this.graphQLClient = graphQLClient;
|
|
7
7
|
}
|
|
8
|
-
async getEntitiesDefinitions(oauthClientId
|
|
8
|
+
async getEntitiesDefinitions(oauthClientId) {
|
|
9
9
|
var _a;
|
|
10
10
|
const query = `
|
|
11
|
-
query forge_cli_getAppOauthClientIdDetails($oauthClientId: String
|
|
11
|
+
query forge_cli_getAppOauthClientIdDetails($oauthClientId: String!) {
|
|
12
12
|
ersLifecycle {
|
|
13
|
-
|
|
14
|
-
entities: $entities
|
|
13
|
+
doneEntitiesFromERS(
|
|
15
14
|
oauthClientId: $oauthClientId
|
|
16
15
|
) {
|
|
17
16
|
indexes {
|
|
@@ -27,10 +26,9 @@ class EntitiesGraphqlClient {
|
|
|
27
26
|
}
|
|
28
27
|
`;
|
|
29
28
|
const result = await this.graphQLClient.query(query, {
|
|
30
|
-
oauthClientId
|
|
31
|
-
entities
|
|
29
|
+
oauthClientId
|
|
32
30
|
});
|
|
33
|
-
return ((_a = result === null || result === void 0 ? void 0 : result.ersLifecycle) === null || _a === void 0 ? void 0 : _a.
|
|
31
|
+
return ((_a = result === null || result === void 0 ? void 0 : result.ersLifecycle) === null || _a === void 0 ? void 0 : _a.doneEntitiesFromERS) || [];
|
|
34
32
|
}
|
|
35
33
|
}
|
|
36
34
|
exports.EntitiesGraphqlClient = EntitiesGraphqlClient;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CustomEntitiesService } from '../service/custom-entities-service';
|
|
2
2
|
export interface CustomEntityIndex {
|
|
3
3
|
entityName: string;
|
|
4
4
|
indexName: string;
|
|
5
5
|
indexStatus: CustomEntityIndexStatus;
|
|
6
|
+
partition: string;
|
|
7
|
+
range: string;
|
|
6
8
|
}
|
|
7
9
|
export declare enum CustomEntityIndexStatus {
|
|
8
10
|
ACTIVE = "ACTIVE",
|
|
@@ -15,13 +17,11 @@ export interface AppCustomEntitiesIndexes {
|
|
|
15
17
|
indexes: CustomEntityIndex[];
|
|
16
18
|
}
|
|
17
19
|
export interface EntitiesClient {
|
|
18
|
-
getEntitiesDefinitions(oauthClientId: string
|
|
20
|
+
getEntitiesDefinitions(oauthClientId: string): Promise<any[]>;
|
|
19
21
|
}
|
|
20
22
|
export declare class ListEntitiesIndexesCommand {
|
|
21
|
-
private readonly
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
constructor(getAppConfig: AppConfigProvider, appOauthClient: AppOauthClientIdClient, entitiesGraphqlClient: EntitiesClient);
|
|
25
|
-
execute(environment: string, entities: string[]): Promise<AppCustomEntitiesIndexes>;
|
|
23
|
+
private readonly customEntitiesService;
|
|
24
|
+
constructor(customEntitiesService: CustomEntitiesService);
|
|
25
|
+
execute(environment: string): Promise<AppCustomEntitiesIndexes>;
|
|
26
26
|
}
|
|
27
27
|
//# sourceMappingURL=list-indexes.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list-indexes.d.ts","sourceRoot":"","sources":["../../src/entities/list-indexes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"list-indexes.d.ts","sourceRoot":"","sources":["../../src/entities/list-indexes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAE3E,MAAM,WAAW,iBAAiB;IAChC,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,uBAAuB,CAAC;IACrC,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,oBAAY,uBAAuB;IACjC,MAAM,WAAW;IACjB,QAAQ,aAAa;CACtB;AAED,MAAM,WAAW,wBAAwB;IACvC,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,iBAAiB,EAAE,CAAC;CAC9B;AAED,MAAM,WAAW,cAAc;IAC7B,sBAAsB,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;CAC/D;AAED,qBAAa,0BAA0B;IACzB,OAAO,CAAC,QAAQ,CAAC,qBAAqB;gBAArB,qBAAqB,EAAE,qBAAqB;IAE5D,OAAO,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,wBAAwB,CAAC;CAG7E"}
|
|
@@ -7,55 +7,11 @@ var CustomEntityIndexStatus;
|
|
|
7
7
|
CustomEntityIndexStatus["CREATING"] = "CREATING";
|
|
8
8
|
})(CustomEntityIndexStatus = exports.CustomEntityIndexStatus || (exports.CustomEntityIndexStatus = {}));
|
|
9
9
|
class ListEntitiesIndexesCommand {
|
|
10
|
-
constructor(
|
|
11
|
-
this.
|
|
12
|
-
this.appOauthClient = appOauthClient;
|
|
13
|
-
this.entitiesGraphqlClient = entitiesGraphqlClient;
|
|
10
|
+
constructor(customEntitiesService) {
|
|
11
|
+
this.customEntitiesService = customEntitiesService;
|
|
14
12
|
}
|
|
15
|
-
async execute(environment
|
|
16
|
-
|
|
17
|
-
const { id: appId } = await this.getAppConfig();
|
|
18
|
-
const { environmentId, oauthClientId } = await this.appOauthClient.getAppOauthClientIdDetails(appId, environment);
|
|
19
|
-
const results = await this.entitiesGraphqlClient.getEntitiesDefinitions(oauthClientId, entities);
|
|
20
|
-
const transformedIndexes = [];
|
|
21
|
-
const indexesToExclude = ['by-context-ari'];
|
|
22
|
-
for (const entity of results) {
|
|
23
|
-
const [, , , ...entityName] = entity.name.split('_');
|
|
24
|
-
for (const index of (_a = entity.indexes) !== null && _a !== void 0 ? _a : []) {
|
|
25
|
-
if (indexesToExclude.indexOf(index.name) < 0) {
|
|
26
|
-
transformedIndexes.push({
|
|
27
|
-
entityName: entityName.join('_'),
|
|
28
|
-
indexName: index.name,
|
|
29
|
-
indexStatus: index.status
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
transformedIndexes.sort((index1, index2) => {
|
|
35
|
-
if (index1.indexStatus > index2.indexStatus) {
|
|
36
|
-
return -1;
|
|
37
|
-
}
|
|
38
|
-
else if (index1.indexStatus < index2.indexStatus) {
|
|
39
|
-
return 1;
|
|
40
|
-
}
|
|
41
|
-
else {
|
|
42
|
-
if (index1.entityName < index2.entityName) {
|
|
43
|
-
return -1;
|
|
44
|
-
}
|
|
45
|
-
else if (index1.entityName > index2.entityName) {
|
|
46
|
-
return 1;
|
|
47
|
-
}
|
|
48
|
-
else {
|
|
49
|
-
return 0;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
});
|
|
53
|
-
return {
|
|
54
|
-
appId,
|
|
55
|
-
environmentId,
|
|
56
|
-
oauthClientId,
|
|
57
|
-
indexes: transformedIndexes
|
|
58
|
-
};
|
|
13
|
+
async execute(environment) {
|
|
14
|
+
return await this.customEntitiesService.listEntitiesIndexes(environment);
|
|
59
15
|
}
|
|
60
16
|
}
|
|
61
17
|
exports.ListEntitiesIndexesCommand = ListEntitiesIndexesCommand;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graphql-client.d.ts","sourceRoot":"","sources":["../../src/environment/graphql-client.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,
|
|
1
|
+
{"version":3,"file":"graphql-client.d.ts","sourceRoot":"","sources":["../../src/environment/graphql-client.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAIlB,aAAa,EAIb,SAAS,EACV,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AACtF,OAAO,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AACnF,OAAO,EACL,6BAA6B,EAC7B,uBAAuB,EACvB,wBAAwB,EACxB,uBAAuB,EACxB,MAAM,sBAAsB,CAAC;AAE9B,eAAO,MAAM,0BAA0B,0BAA0B,CAAC;AAElE,qBAAa,eAAgB,SAAQ,SAAS;CAAG;AAEjD,qBAAa,aAAc,YAAW,uBAAuB,EAAE,qBAAqB,EAAE,uBAAuB;IAC/F,OAAO,CAAC,QAAQ,CAAC,aAAa;gBAAb,aAAa,EAAE,aAAa;IAE5C,iBAAiB,CAAC,OAAO,EAAE,qBAAqB;IAgDhD,eAAe,CAAC,OAAO,EAAE,sBAAsB;;;;;IAmC/C,kBAAkB,CAAC,OAAO,EAAE,6BAA6B;IAkBzD,iBAAiB,CAAC,OAAO,EAAE,wBAAwB;CAuDjE"}
|
|
@@ -124,7 +124,7 @@ class GraphqlClient {
|
|
|
124
124
|
const error = (0, cli_shared_1.getError)(errors);
|
|
125
125
|
let errorMessage = error.message;
|
|
126
126
|
if (error.code === exports.APP_HAS_INSTALLATIONS_CODE) {
|
|
127
|
-
errorMessage = cli_shared_1.Text.deleteEnvironment.hasInstallationError(details.environmentKey
|
|
127
|
+
errorMessage = cli_shared_1.Text.deleteEnvironment.hasInstallationError(details.environmentKey);
|
|
128
128
|
}
|
|
129
129
|
if (!success) {
|
|
130
130
|
throw new cli_shared_1.GraphQlMutationError(`${errorMessage} (requestId: ${requestId || 'unknown'})`, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graphql-client.d.ts","sourceRoot":"","sources":["../../src/installations/graphql-client.ts"],"names":[],"mappings":"AAEA,OAAO,EAKL,sBAAsB,EAItB,aAAa,EACb,oBAAoB,EAMpB,KAAK,EAGL,SAAS,EACT,SAAS,
|
|
1
|
+
{"version":3,"file":"graphql-client.d.ts","sourceRoot":"","sources":["../../src/installations/graphql-client.ts"],"names":[],"mappings":"AAEA,OAAO,EAKL,sBAAsB,EAItB,aAAa,EACb,oBAAoB,EAMpB,KAAK,EAGL,SAAS,EACT,SAAS,EACV,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC7E,OAAO,EACL,yBAAyB,EACzB,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,CAAC;AAEpD,eAAO,MAAM,kCAAkC,MAAM,CAAC;AAkBtD,eAAO,MAAM,qBAAqB,kCAAkC,CAAC;AAMrE,qBAAa,qBAAsB,SAAQ,oBAAoB;gBACjD,SAA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AK,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,SAAI,GAAG,OAAO,CAAC,yBAAyB,CAAC;CAyChH"}
|
|
@@ -37,7 +37,7 @@ class UpgradeError extends cli_shared_1.GraphQlMutationError {
|
|
|
37
37
|
exports.UpgradeError = UpgradeError;
|
|
38
38
|
class EnvironmentNotFoundError extends cli_shared_1.UserError {
|
|
39
39
|
constructor(environmentKey) {
|
|
40
|
-
super(cli_shared_1.Text.env.error.envNotExist(environmentKey
|
|
40
|
+
super(cli_shared_1.Text.env.error.envNotExist(environmentKey));
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
exports.EnvironmentNotFoundError = EnvironmentNotFoundError;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { AppConfigProvider, AppOauthClientIdClient } from '@forge/cli-shared';
|
|
2
|
+
import { AppCustomEntitiesIndexes, CustomEntityIndex, EntitiesClient } from '../entities/list-indexes';
|
|
3
|
+
export declare class CustomEntitiesService {
|
|
4
|
+
private readonly appConfigProvider;
|
|
5
|
+
private readonly appOauthClient;
|
|
6
|
+
private readonly entitiesGraphqlClient;
|
|
7
|
+
constructor(appConfigProvider: AppConfigProvider, appOauthClient: AppOauthClientIdClient, entitiesGraphqlClient: EntitiesClient);
|
|
8
|
+
sortTransformedIndexes(transformedIndexes: CustomEntityIndex[]): CustomEntityIndex[];
|
|
9
|
+
listEntitiesIndexes(environment: string): Promise<AppCustomEntitiesIndexes>;
|
|
10
|
+
isReindexingInProgress(environment: string): Promise<boolean>;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=custom-entities-service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"custom-entities-service.d.ts","sourceRoot":"","sources":["../../src/service/custom-entities-service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,sBAAsB,EAAuB,MAAM,mBAAmB,CAAC;AACnG,OAAO,EACL,wBAAwB,EACxB,iBAAiB,EAEjB,cAAc,EACf,MAAM,0BAA0B,CAAC;AAElC,qBAAa,qBAAqB;IAE9B,OAAO,CAAC,QAAQ,CAAC,iBAAiB;IAClC,OAAO,CAAC,QAAQ,CAAC,cAAc;IAC/B,OAAO,CAAC,QAAQ,CAAC,qBAAqB;gBAFrB,iBAAiB,EAAE,iBAAiB,EACpC,cAAc,EAAE,sBAAsB,EACtC,qBAAqB,EAAE,cAAc;IAGxD,sBAAsB,CAAC,kBAAkB,EAAE,iBAAiB,EAAE,GAAG,iBAAiB,EAAE;IAavE,mBAAmB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,wBAAwB,CAAC;IAkD3E,sBAAsB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;CAM3E"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CustomEntitiesService = void 0;
|
|
4
|
+
const cli_shared_1 = require("@forge/cli-shared");
|
|
5
|
+
const list_indexes_1 = require("../entities/list-indexes");
|
|
6
|
+
class CustomEntitiesService {
|
|
7
|
+
constructor(appConfigProvider, appOauthClient, entitiesGraphqlClient) {
|
|
8
|
+
this.appConfigProvider = appConfigProvider;
|
|
9
|
+
this.appOauthClient = appOauthClient;
|
|
10
|
+
this.entitiesGraphqlClient = entitiesGraphqlClient;
|
|
11
|
+
}
|
|
12
|
+
sortTransformedIndexes(transformedIndexes) {
|
|
13
|
+
transformedIndexes.sort((index1, index2) => {
|
|
14
|
+
if (index1.indexStatus > index2.indexStatus) {
|
|
15
|
+
return -1;
|
|
16
|
+
}
|
|
17
|
+
else if (index1.indexStatus < index2.indexStatus) {
|
|
18
|
+
return 1;
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
return 0;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
return transformedIndexes;
|
|
25
|
+
}
|
|
26
|
+
async listEntitiesIndexes(environment) {
|
|
27
|
+
var _a;
|
|
28
|
+
const { id: appId } = await this.appConfigProvider();
|
|
29
|
+
const { environmentId, oauthClientId } = await this.appOauthClient.getAppOauthClientIdDetails(appId, environment);
|
|
30
|
+
const results = await this.entitiesGraphqlClient.getEntitiesDefinitions(oauthClientId);
|
|
31
|
+
const transformedIndexes = [];
|
|
32
|
+
const indexesToExclude = ['by-context-ari'];
|
|
33
|
+
for (const entity of results) {
|
|
34
|
+
const [, , , ...entityName] = entity.name.split('_');
|
|
35
|
+
const transformedIndexesPerEntity = [];
|
|
36
|
+
let byKeyIndex = {};
|
|
37
|
+
for (const index of (_a = entity.indexes) !== null && _a !== void 0 ? _a : []) {
|
|
38
|
+
if (indexesToExclude.indexOf(index.name) < 0) {
|
|
39
|
+
if (index.name === 'by-key') {
|
|
40
|
+
byKeyIndex = {
|
|
41
|
+
entityName: entityName.join('_'),
|
|
42
|
+
indexName: index.name.concat(' (default)'),
|
|
43
|
+
indexStatus: index.status,
|
|
44
|
+
partition: index.partition.length ? index.partition.join(', ') : 'None',
|
|
45
|
+
range: 'key (data key)'
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
transformedIndexesPerEntity.push({
|
|
50
|
+
entityName: entityName.join('_'),
|
|
51
|
+
indexName: index.name,
|
|
52
|
+
indexStatus: index.status,
|
|
53
|
+
partition: index.partition.length ? index.partition.join(', ') : 'None',
|
|
54
|
+
range: index.range.length ? index.range.join(', ') : 'None'
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
this.sortTransformedIndexes(transformedIndexesPerEntity);
|
|
60
|
+
transformedIndexesPerEntity.push(byKeyIndex);
|
|
61
|
+
transformedIndexes.push(...transformedIndexesPerEntity);
|
|
62
|
+
}
|
|
63
|
+
return {
|
|
64
|
+
appId,
|
|
65
|
+
environmentId,
|
|
66
|
+
oauthClientId,
|
|
67
|
+
indexes: transformedIndexes
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
async isReindexingInProgress(environment) {
|
|
71
|
+
const { indexes: indexes } = await this.listEntitiesIndexes((0, cli_shared_1.optionToEnvironment)(environment || 'development'));
|
|
72
|
+
const indexStatuses = indexes.map((index) => index.indexStatus);
|
|
73
|
+
return indexStatuses.includes(list_indexes_1.CustomEntityIndexStatus.CREATING);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
exports.CustomEntitiesService = CustomEntitiesService;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { UserError } from '@forge/cli-shared';
|
|
1
2
|
import { spawn } from 'cross-spawn';
|
|
2
|
-
export declare class DockerError extends
|
|
3
|
+
export declare class DockerError extends UserError {
|
|
3
4
|
readonly code: DockerErrorCode;
|
|
4
5
|
constructor(message: string, code: DockerErrorCode);
|
|
5
6
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"docker-service.d.ts","sourceRoot":"","sources":["../../src/service/docker-service.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"docker-service.d.ts","sourceRoot":"","sources":["../../src/service/docker-service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAGpD,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAWpC,qBAAa,WAAY,SAAQ,SAAS;aACK,IAAI,EAAE,eAAe;gBAAtD,OAAO,EAAE,MAAM,EAAkB,IAAI,EAAE,eAAe;CAGnE;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf;AAED,eAAO,MAAM,oBAAoB,wCAAwC,CAAC;AAE1E,oBAAY,eAAe;IACzB,kBAAkB,IAAA;IAClB,aAAa,IAAA;CACd;AAED,qBAAa,aAAa;IACjB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,UAAU,CAAC,OAAO,KAAK,CAAC;IAIhD,gBAAgB,CAAC,YAAY,EAAE,OAAO,GAAG,OAAO,CAAC,aAAa,CAAC;IAwB/D,eAAe,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAI3D,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,UAAU,CAAC,OAAO,KAAK,CAAC;IAI1D,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,aAAa,EAAE,MAAM,GAAG,IAAI;IActE,OAAO,CAAC,WAAW;CAWpB"}
|
|
@@ -7,7 +7,7 @@ const command_exists_1 = tslib_1.__importDefault(require("command-exists"));
|
|
|
7
7
|
const child_process_1 = require("child_process");
|
|
8
8
|
const cross_spawn_1 = require("cross-spawn");
|
|
9
9
|
const path_1 = tslib_1.__importDefault(require("path"));
|
|
10
|
-
class DockerError extends
|
|
10
|
+
class DockerError extends cli_shared_1.UserError {
|
|
11
11
|
constructor(message, code) {
|
|
12
12
|
super(message);
|
|
13
13
|
this.code = code;
|
|
@@ -22,7 +22,7 @@ var DockerErrorCode;
|
|
|
22
22
|
})(DockerErrorCode = exports.DockerErrorCode || (exports.DockerErrorCode = {}));
|
|
23
23
|
class DockerService {
|
|
24
24
|
runContainer(args) {
|
|
25
|
-
return (0, cross_spawn_1.spawn)('docker', ['run', ...args], { stdio: 'inherit' });
|
|
25
|
+
return (0, cross_spawn_1.spawn)('docker', ['run', ...args], { stdio: ['inherit', 'inherit', 'pipe'] });
|
|
26
26
|
}
|
|
27
27
|
async getDockerVersion(debugEnabled) {
|
|
28
28
|
if (!command_exists_1.default.sync('docker')) {
|
|
@@ -1,11 +1,15 @@
|
|
|
1
|
-
import { PersonalApiCredentialsValidated } from '@forge/cli-shared';
|
|
1
|
+
import { PersonalApiCredentialsValidated, CLIDetails } from '@forge/cli-shared';
|
|
2
2
|
import { AnalyticsClientReporter } from '../analytics-client/analytics-client';
|
|
3
3
|
import { DownloadProgressCallbacks } from '../command-line/view/tunnel-view';
|
|
4
4
|
export declare class TunnelAnalyticsService {
|
|
5
5
|
private readonly analyticsClientReporter;
|
|
6
|
-
|
|
6
|
+
private readonly cliDetails;
|
|
7
|
+
constructor(analyticsClientReporter: AnalyticsClientReporter, cliDetails: CLIDetails | undefined);
|
|
7
8
|
reportDockerVersion(creds: PersonalApiCredentialsValidated, dockerVersion: string | null): void;
|
|
8
9
|
reportTunnelClosed(creds: PersonalApiCredentialsValidated): void;
|
|
10
|
+
reportTunnelFailure(creds: PersonalApiCredentialsValidated, errorName: string, attributes: {
|
|
11
|
+
[key: string]: any;
|
|
12
|
+
}): void;
|
|
9
13
|
getImageDownloadReporters(creds: PersonalApiCredentialsValidated): DownloadProgressCallbacks;
|
|
10
14
|
}
|
|
11
15
|
//# sourceMappingURL=tunnel-analytics-service.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tunnel-analytics-service.d.ts","sourceRoot":"","sources":["../../src/service/tunnel-analytics-service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,+BAA+B,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"tunnel-analytics-service.d.ts","sourceRoot":"","sources":["../../src/service/tunnel-analytics-service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,+BAA+B,EAAE,UAAU,EAAsB,MAAM,mBAAmB,CAAC;AACpG,OAAO,EAAE,uBAAuB,EAAE,MAAM,sCAAsC,CAAC;AAC/E,OAAO,EAAE,yBAAyB,EAAE,MAAM,kCAAkC,CAAC;AAE7E,qBAAa,sBAAsB;IAE/B,OAAO,CAAC,QAAQ,CAAC,uBAAuB;IACxC,OAAO,CAAC,QAAQ,CAAC,UAAU;gBADV,uBAAuB,EAAE,uBAAuB,EAChD,UAAU,EAAE,UAAU,GAAG,SAAS;IAG9C,mBAAmB,CAAC,KAAK,EAAE,+BAA+B,EAAE,aAAa,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;IAM/F,kBAAkB,CAAC,KAAK,EAAE,+BAA+B,GAAG,IAAI;IAIhE,mBAAmB,CACxB,KAAK,EAAE,+BAA+B,EACtC,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE;IAgB7B,yBAAyB,CAAC,KAAK,EAAE,+BAA+B,GAAG,yBAAyB;CAOpG"}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.TunnelAnalyticsService = void 0;
|
|
4
|
+
const cli_shared_1 = require("@forge/cli-shared");
|
|
4
5
|
class TunnelAnalyticsService {
|
|
5
|
-
constructor(analyticsClientReporter) {
|
|
6
|
+
constructor(analyticsClientReporter, cliDetails) {
|
|
6
7
|
this.analyticsClientReporter = analyticsClientReporter;
|
|
8
|
+
this.cliDetails = cliDetails;
|
|
7
9
|
}
|
|
8
10
|
reportDockerVersion(creds, dockerVersion) {
|
|
9
11
|
this.analyticsClientReporter.reportSuccess('docker version check', creds, {
|
|
@@ -13,6 +15,14 @@ class TunnelAnalyticsService {
|
|
|
13
15
|
reportTunnelClosed(creds) {
|
|
14
16
|
this.analyticsClientReporter.reportSuccess('close tunnel', creds, {});
|
|
15
17
|
}
|
|
18
|
+
reportTunnelFailure(creds, errorName, attributes) {
|
|
19
|
+
var _a, _b;
|
|
20
|
+
attributes = Object.assign({ error: errorName, version: (_a = this.cliDetails) === null || _a === void 0 ? void 0 : _a.version, latest: (_b = this.cliDetails) === null || _b === void 0 ? void 0 : _b.latest, isLatest: (0, cli_shared_1.isLatestCLIVersion)(this.cliDetails) }, attributes);
|
|
21
|
+
if (attributes.isUserError === undefined) {
|
|
22
|
+
attributes = Object.assign(Object.assign({}, attributes), { isUserError: false });
|
|
23
|
+
}
|
|
24
|
+
this.analyticsClientReporter.reportInvokeFailure('tunnel', creds, attributes);
|
|
25
|
+
}
|
|
16
26
|
getImageDownloadReporters(creds) {
|
|
17
27
|
return {
|
|
18
28
|
onStart: () => this.analyticsClientReporter.reportSuccess('image download started', creds, {}),
|
|
@@ -11,6 +11,9 @@ export interface TunnelOptions {
|
|
|
11
11
|
export declare const CONTAINER_NAME = "forge-tunnel-docker";
|
|
12
12
|
export declare const IMAGE_NAME: string;
|
|
13
13
|
export declare class HiddenDockerTunnelError extends HiddenError {
|
|
14
|
+
private readonly userError;
|
|
15
|
+
constructor(userError: boolean, message?: string);
|
|
16
|
+
isUserError(): boolean;
|
|
14
17
|
}
|
|
15
18
|
export declare type TunnelService = {
|
|
16
19
|
run(tunnelOptions: TunnelOptions, creds: PersonalApiCredentialsValidated, debugEnabled: boolean, onError?: (err: Error) => Promise<void>): Promise<void>;
|
|
@@ -23,8 +26,9 @@ export declare class InProcessTunnelService implements TunnelService {
|
|
|
23
26
|
private readonly startTunnelCommand;
|
|
24
27
|
private readonly tunnelInteractor;
|
|
25
28
|
private readonly configFilePortFindingService;
|
|
26
|
-
|
|
27
|
-
|
|
29
|
+
private readonly analyticsService;
|
|
30
|
+
constructor(ui: UI, startTunnelCommand: StartTunnelCommand, tunnelInteractor: TunnelInteractor, configFilePortFindingService: ConfigFilePortFindingService, analyticsService: TunnelAnalyticsService);
|
|
31
|
+
run(tunnelOptions: TunnelOptions, creds: PersonalApiCredentialsValidated, debugEnabled: boolean, onError?: (err: Error) => Promise<void>): Promise<void>;
|
|
28
32
|
}
|
|
29
33
|
declare abstract class TunnelServiceBase implements TunnelService {
|
|
30
34
|
protected readonly configFilePortFindingService: ConfigFilePortFindingService;
|
|
@@ -44,7 +48,7 @@ declare abstract class TunnelServiceBase implements TunnelService {
|
|
|
44
48
|
protected getVolumeOptions(): string[];
|
|
45
49
|
}
|
|
46
50
|
export declare class LocalTunnelService extends TunnelServiceBase {
|
|
47
|
-
run(tunnelOptions: TunnelOptions, creds:
|
|
51
|
+
run(tunnelOptions: TunnelOptions, creds: PersonalApiCredentialsValidated, debugEnabled: boolean, onError?: (err: Error) => Promise<void>): Promise<void>;
|
|
48
52
|
}
|
|
49
53
|
export declare class DockerTunnelService extends TunnelServiceBase {
|
|
50
54
|
private readonly dockerService;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tunnel-service.d.ts","sourceRoot":"","sources":["../../src/service/tunnel-service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAMpC,OAAO,EAIL,WAAW,
|
|
1
|
+
{"version":3,"file":"tunnel-service.d.ts","sourceRoot":"","sources":["../../src/service/tunnel-service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAMpC,OAAO,EAIL,WAAW,EAEX,sBAAsB,EACtB,+BAA+B,EAG/B,EAAE,EACF,SAAS,EACV,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAGrE,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,4BAA4B,EAAE,MAAM,wBAAwB,CAAC;AACtE,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AAEpE,MAAM,WAAW,aAAa;IAC5B,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAID,eAAO,MAAM,cAAc,wBAAwB,CAAC;AAcpD,eAAO,MAAM,UAAU,QAEuB,CAAC;AAE/C,qBAAa,uBAAwB,SAAQ,WAAW;IAC1C,OAAO,CAAC,QAAQ,CAAC,SAAS;gBAAT,SAAS,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,MAAM;IAI1D,WAAW,IAAI,OAAO;CAG9B;AAED,oBAAY,aAAa,GAAG;IAC1B,GAAG,CACD,aAAa,EAAE,aAAa,EAC5B,KAAK,EAAE,+BAA+B,EACtC,YAAY,EAAE,OAAO,EACrB,OAAO,CAAC,EAAE,CAAC,GAAG,EAA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AC;YAKnD,qBAAqB;CASpC"}
|
|
@@ -10,7 +10,6 @@ const semver_1 = require("semver");
|
|
|
10
10
|
const cli_shared_1 = require("@forge/cli-shared");
|
|
11
11
|
const version_info_1 = require("../command-line/version-info");
|
|
12
12
|
const DISABLE_TTY = process.env.DISABLE_TTY === 'true';
|
|
13
|
-
const CUR_WORK_APP_DIR = process.env.CUR_WORK_APP_DIR;
|
|
14
13
|
exports.CONTAINER_NAME = 'forge-tunnel-docker';
|
|
15
14
|
const cliDetails = (0, version_info_1.getCLIDetails)();
|
|
16
15
|
let versionTags;
|
|
@@ -29,6 +28,13 @@ exports.IMAGE_NAME = process.env.FORGE_DEV_DOCKER_TUNNEL
|
|
|
29
28
|
? 'local/forge-tunnel:test'
|
|
30
29
|
: `atlassian/forge-tunnel:${versionTags[0]}`;
|
|
31
30
|
class HiddenDockerTunnelError extends cli_shared_1.HiddenError {
|
|
31
|
+
constructor(userError, message) {
|
|
32
|
+
super(message);
|
|
33
|
+
this.userError = userError;
|
|
34
|
+
}
|
|
35
|
+
isUserError() {
|
|
36
|
+
return this.userError;
|
|
37
|
+
}
|
|
32
38
|
}
|
|
33
39
|
exports.HiddenDockerTunnelError = HiddenDockerTunnelError;
|
|
34
40
|
class DebugNotSupportedError extends cli_shared_1.UserError {
|
|
@@ -38,11 +44,12 @@ class DebugNotSupportedError extends cli_shared_1.UserError {
|
|
|
38
44
|
}
|
|
39
45
|
exports.DebugNotSupportedError = DebugNotSupportedError;
|
|
40
46
|
class InProcessTunnelService {
|
|
41
|
-
constructor(ui, startTunnelCommand, tunnelInteractor, configFilePortFindingService) {
|
|
47
|
+
constructor(ui, startTunnelCommand, tunnelInteractor, configFilePortFindingService, analyticsService) {
|
|
42
48
|
this.ui = ui;
|
|
43
49
|
this.startTunnelCommand = startTunnelCommand;
|
|
44
50
|
this.tunnelInteractor = tunnelInteractor;
|
|
45
51
|
this.configFilePortFindingService = configFilePortFindingService;
|
|
52
|
+
this.analyticsService = analyticsService;
|
|
46
53
|
}
|
|
47
54
|
async run(tunnelOptions, creds, debugEnabled, onError) {
|
|
48
55
|
try {
|
|
@@ -59,6 +66,7 @@ class InProcessTunnelService {
|
|
|
59
66
|
await this.tunnelInteractor.handleUserExitEvent(tunnel.stopFunction, monitor);
|
|
60
67
|
}
|
|
61
68
|
catch (e) {
|
|
69
|
+
this.analyticsService.reportTunnelFailure(creds, e.constructor.name, (0, cli_shared_1.isErrorWithAnalytics)(e) ? e.getAttributes() : {});
|
|
62
70
|
if (onError) {
|
|
63
71
|
await onError(e);
|
|
64
72
|
}
|
|
@@ -102,7 +110,7 @@ class TunnelServiceBase {
|
|
|
102
110
|
];
|
|
103
111
|
}
|
|
104
112
|
catch (e) {
|
|
105
|
-
throw new HiddenDockerTunnelError("Couldn't populate docker options for tunneling");
|
|
113
|
+
throw new HiddenDockerTunnelError(false, "Couldn't populate docker options for tunneling");
|
|
106
114
|
}
|
|
107
115
|
}
|
|
108
116
|
getPortOptions(port, resourcePorts, cspReporterPort) {
|
|
@@ -157,7 +165,7 @@ class TunnelServiceBase {
|
|
|
157
165
|
return [`-it`];
|
|
158
166
|
}
|
|
159
167
|
getVolumeOptions() {
|
|
160
|
-
const options = [`-v=${
|
|
168
|
+
const options = [`-v=${process.cwd()}:/app:cached`];
|
|
161
169
|
if (process.env.FORGE_DEV_DOCKER_TUNNEL) {
|
|
162
170
|
const monorepoRoot = (0, path_1.join)(__dirname, '../../../..');
|
|
163
171
|
options.push(`-v=${monorepoRoot}:/monorepo:cached`);
|
|
@@ -204,6 +212,7 @@ class DockerTunnelService extends TunnelServiceBase {
|
|
|
204
212
|
this.analyticsService = analyticsService;
|
|
205
213
|
}
|
|
206
214
|
async run(tunnelOptions, creds, debugEnabled) {
|
|
215
|
+
var _a;
|
|
207
216
|
await this.validateDockerVersion(creds, debugEnabled);
|
|
208
217
|
const dockerOptions = await this.getDockerOptions(tunnelOptions, debugEnabled, creds);
|
|
209
218
|
const port = await (0, portfinder_1.getPortPromise)();
|
|
@@ -223,6 +232,23 @@ class DockerTunnelService extends TunnelServiceBase {
|
|
|
223
232
|
...dockerOptions
|
|
224
233
|
]);
|
|
225
234
|
docker.on('exit', () => this.analyticsService.reportTunnelClosed(creds));
|
|
235
|
+
(_a = docker.stderr) === null || _a === void 0 ? void 0 : _a.on('data', (error) => {
|
|
236
|
+
var _a;
|
|
237
|
+
const errorMessage = error;
|
|
238
|
+
let errorJson;
|
|
239
|
+
try {
|
|
240
|
+
errorJson = JSON.parse(errorMessage);
|
|
241
|
+
}
|
|
242
|
+
catch (e) {
|
|
243
|
+
}
|
|
244
|
+
if (errorJson && errorJson.__tunnel_error__) {
|
|
245
|
+
const tunnelErrorDetails = errorJson;
|
|
246
|
+
this.analyticsService.reportTunnelFailure(creds, tunnelErrorDetails.name, tunnelErrorDetails.attributes);
|
|
247
|
+
}
|
|
248
|
+
else {
|
|
249
|
+
(_a = process.stderr) === null || _a === void 0 ? void 0 : _a.write(errorMessage);
|
|
250
|
+
}
|
|
251
|
+
});
|
|
226
252
|
this.dockerService.startCleanupWorker([docker.pid], exports.CONTAINER_NAME);
|
|
227
253
|
}
|
|
228
254
|
async bootstrapDocker() {
|
|
@@ -233,7 +259,7 @@ class DockerTunnelService extends TunnelServiceBase {
|
|
|
233
259
|
const { major, minor, full } = await this.dockerService.getDockerVersion(debugEnabled);
|
|
234
260
|
this.analyticsService.reportDockerVersion(creds, full);
|
|
235
261
|
if (major < 17 || (major === 17 && minor < 3)) {
|
|
236
|
-
throw new HiddenDockerTunnelError();
|
|
262
|
+
throw new HiddenDockerTunnelError(true);
|
|
237
263
|
}
|
|
238
264
|
}
|
|
239
265
|
}
|