@forge/cli 0.0.0-experimental-383053a → 0.0.0-experimental-3b4aabe
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 +3872 -7
- package/README.md +18 -19
- package/npm-shrinkwrap.json +3100 -3556
- 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 +232 -212
- package/out/autocomplete/index.d.ts.map +1 -1
- package/out/autocomplete/index.js +12 -8
- 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/autocomplete/types.d.ts +5 -1
- package/out/autocomplete/types.d.ts.map +1 -1
- package/out/autocomplete/util.d.ts +1 -1
- package/out/autocomplete/util.d.ts.map +1 -1
- package/out/autocomplete/util.js +3 -3
- package/out/bin/cli.js +0 -2
- package/out/bin/postinstall.js +10 -1
- package/out/command-line/anon-user-id.js +6 -10
- package/out/command-line/command.d.ts +28 -8
- package/out/command-line/command.d.ts.map +1 -1
- package/out/command-line/command.js +190 -49
- package/out/command-line/controller/assertUnreachable.d.ts +2 -0
- package/out/command-line/controller/assertUnreachable.d.ts.map +1 -0
- package/out/command-line/controller/assertUnreachable.js +7 -0
- package/out/command-line/controller/autocomplete-controller.d.ts +2 -1
- package/out/command-line/controller/autocomplete-controller.d.ts.map +1 -1
- package/out/command-line/controller/autocomplete-controller.js +29 -3
- 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 +53 -22
- package/out/command-line/index.d.ts +2 -38
- package/out/command-line/index.d.ts.map +1 -1
- package/out/command-line/index.js +22 -43
- 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-autocomplete-commands.d.ts +0 -2
- package/out/command-line/register-autocomplete-commands.d.ts.map +1 -1
- package/out/command-line/register-autocomplete-commands.js +2 -9
- 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 +27 -10
- 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-log-commands.d.ts +1 -0
- package/out/command-line/register-log-commands.d.ts.map +1 -1
- package/out/command-line/register-log-commands.js +26 -3
- 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/environment-variables/list-environment-variables.d.ts +2 -2
- package/out/environment-variables/list-environment-variables.d.ts.map +1 -1
- 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 +168 -61
- 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 +4 -4
- package/out/service/resource-packaging-service.d.ts.map +1 -1
- package/out/service/resource-packaging-service.js +9 -22
- 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 +19 -18
- 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,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DeployController = exports.DeployLintFailureError = void 0;
|
|
3
|
+
exports.DeployController = exports.InvalidConnectKeyError = exports.DeployLintFailureError = void 0;
|
|
4
4
|
const cli_shared_1 = require("@forge/cli-shared");
|
|
5
5
|
class DeployLintFailureError extends cli_shared_1.HiddenError {
|
|
6
6
|
constructor(scopes) {
|
|
@@ -14,19 +14,62 @@ class DeployLintFailureError extends cli_shared_1.HiddenError {
|
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
16
|
exports.DeployLintFailureError = DeployLintFailureError;
|
|
17
|
+
class InvalidConnectKeyError extends cli_shared_1.HiddenError {
|
|
18
|
+
constructor(reason) {
|
|
19
|
+
super();
|
|
20
|
+
this.reason = reason;
|
|
21
|
+
}
|
|
22
|
+
getAttributes() {
|
|
23
|
+
return {
|
|
24
|
+
reason: this.reason
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
exports.InvalidConnectKeyError = InvalidConnectKeyError;
|
|
17
29
|
class DeployController {
|
|
18
|
-
constructor(appConfigProvider, configFile, lintService, installationsService, deployView, packageUploadDeployCommand, resourcePackagingService) {
|
|
30
|
+
constructor(appConfigProvider, configFile, lintService, installationsService, migrationKeysService, deployView, packageUploadDeployCommand, resourcePackagingService) {
|
|
19
31
|
this.appConfigProvider = appConfigProvider;
|
|
20
32
|
this.configFile = configFile;
|
|
21
33
|
this.lintService = lintService;
|
|
22
34
|
this.installationsService = installationsService;
|
|
35
|
+
this.migrationKeysService = migrationKeysService;
|
|
23
36
|
this.deployView = deployView;
|
|
24
37
|
this.packageUploadDeployCommand = packageUploadDeployCommand;
|
|
25
38
|
this.resourcePackagingService = resourcePackagingService;
|
|
26
39
|
}
|
|
40
|
+
isMpacProductionApp(mpacAppKey, environment) {
|
|
41
|
+
return !!(mpacAppKey && environment === 'production');
|
|
42
|
+
}
|
|
43
|
+
connectKeyDeleted(connectKey, comparisonKey) {
|
|
44
|
+
return !!(!connectKey && comparisonKey);
|
|
45
|
+
}
|
|
46
|
+
connectKeyChanged(connectKey, comparisonKey) {
|
|
47
|
+
return !!(comparisonKey && connectKey && connectKey !== comparisonKey);
|
|
48
|
+
}
|
|
49
|
+
async validateConnectKeyChange(environment, keys) {
|
|
50
|
+
const { migrationKeys, mpacAppKey } = keys;
|
|
51
|
+
const connectKey = await this.configFile.getConnectKey();
|
|
52
|
+
const migrationKey = (migrationKeys === null || migrationKeys === void 0 ? void 0 : migrationKeys.confluence) || (migrationKeys === null || migrationKeys === void 0 ? void 0 : migrationKeys.jira);
|
|
53
|
+
const isMpacApp = this.isMpacProductionApp(mpacAppKey, environment);
|
|
54
|
+
if (this.connectKeyDeleted(connectKey, migrationKey)) {
|
|
55
|
+
this.deployView.displayConnectKeyDeleteWarning(environment);
|
|
56
|
+
const proceed = await this.deployView.promptToContinueDeletingConnectKey();
|
|
57
|
+
return { proceed, connectKeyDeleted: proceed, connectKeyChanged: false };
|
|
58
|
+
}
|
|
59
|
+
else if (isMpacApp && this.connectKeyChanged(connectKey, mpacAppKey)) {
|
|
60
|
+
this.deployView.displayMPACAppConnectKeyChangeError(mpacAppKey, connectKey);
|
|
61
|
+
throw new InvalidConnectKeyError(cli_shared_1.Text.deploy.connectKeyChange.mpacAppConnectKeyChangeAnalyticsError);
|
|
62
|
+
}
|
|
63
|
+
else if (!isMpacApp && this.connectKeyChanged(connectKey, migrationKey)) {
|
|
64
|
+
this.deployView.displayConnectKeyChangeWarning(environment, migrationKey, connectKey);
|
|
65
|
+
const proceed = await this.deployView.promptToContinueChangingConnectKey();
|
|
66
|
+
return { proceed, connectKeyChanged: proceed, connectKeyDeleted: false };
|
|
67
|
+
}
|
|
68
|
+
return { proceed: true, connectKeyChanged: false, connectKeyDeleted: false };
|
|
69
|
+
}
|
|
27
70
|
async verifyPreDeployment(environment) {
|
|
28
71
|
this.deployView.displayLintRunning();
|
|
29
|
-
const { lintResults } = await this.lintService.run(environment, { fix: false });
|
|
72
|
+
const { lintResults } = await this.lintService.run(environment, { fix: false }, this.deployView.getLogger());
|
|
30
73
|
const problemCount = this.lintService.problemCount(lintResults);
|
|
31
74
|
if (problemCount.errors) {
|
|
32
75
|
this.deployView.displayLintErrors(lintResults);
|
|
@@ -48,17 +91,48 @@ class DeployController {
|
|
|
48
91
|
}
|
|
49
92
|
async run({ environment, verify }) {
|
|
50
93
|
this.deployView.displayStart(environment);
|
|
94
|
+
let hasConnectKeyChanged = false;
|
|
95
|
+
let hasConnectKeyDeleted = false;
|
|
51
96
|
if (verify) {
|
|
52
97
|
await this.verifyPreDeployment(environment);
|
|
98
|
+
const keys = await this.migrationKeysService.getMigrationKeysForAppEnvironment(environment);
|
|
99
|
+
const { proceed, connectKeyChanged, connectKeyDeleted } = await this.validateConnectKeyChange(environment, keys);
|
|
100
|
+
if (!proceed) {
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
hasConnectKeyChanged = connectKeyChanged;
|
|
104
|
+
hasConnectKeyDeleted = connectKeyDeleted;
|
|
53
105
|
}
|
|
54
|
-
const {
|
|
106
|
+
const { id } = await this.appConfigProvider();
|
|
55
107
|
const handlers = await this.configFile.getAppHandlers();
|
|
56
108
|
const resources = await this.configFile.getResources();
|
|
57
109
|
const archives = await this.resourcePackagingService.zipResources(resources);
|
|
58
|
-
|
|
110
|
+
let hasProdInstallations = false;
|
|
111
|
+
try {
|
|
112
|
+
const prodInstallations = await this.installationsService.listAppInstallations({
|
|
113
|
+
environment: 'production'
|
|
114
|
+
});
|
|
115
|
+
hasProdInstallations = !prodInstallations.installations.length;
|
|
116
|
+
}
|
|
117
|
+
catch (err) {
|
|
118
|
+
if (verify) {
|
|
119
|
+
throw err;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
const analytics = await this.deployView.reportDeploymentProgress(id, environment, hasProdInstallations, () => this.packageUploadDeployCommand.execute({ handlers, environmentKey: environment, archives }));
|
|
59
123
|
if (verify) {
|
|
60
124
|
await this.verifyPostDeployment(environment);
|
|
61
125
|
}
|
|
126
|
+
try {
|
|
127
|
+
analytics.analytics.egressPermissionList = await this.configFile.getEgressPermissions();
|
|
128
|
+
analytics.analytics.connectKey = hasConnectKeyChanged
|
|
129
|
+
? { action: 'changed', value: await this.configFile.getConnectKey() }
|
|
130
|
+
: hasConnectKeyDeleted
|
|
131
|
+
? { action: 'deleted' }
|
|
132
|
+
: {};
|
|
133
|
+
}
|
|
134
|
+
catch (e) {
|
|
135
|
+
}
|
|
62
136
|
return analytics;
|
|
63
137
|
}
|
|
64
138
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getNodeVersion.d.ts","sourceRoot":"","sources":["../../../src/command-line/controller/getNodeVersion.ts"],"names":[],"mappings":"AAAA,wBAAgB,cAAc,IAAI,MAAM,CAEvC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
import { AppConfigProvider, UI } from '@forge/cli-shared';
|
|
2
|
+
import { AppConfigProvider, ConfigFile, UI } from '@forge/cli-shared';
|
|
3
3
|
import { URL } from 'url';
|
|
4
4
|
import { InstallAppSiteCommand } from '../../installations/install-app-site';
|
|
5
5
|
import { InstallationService } from '../../service/installation-service';
|
|
@@ -9,6 +9,7 @@ interface InstallViewProps {
|
|
|
9
9
|
site?: URL;
|
|
10
10
|
product?: string;
|
|
11
11
|
upgrade: boolean;
|
|
12
|
+
nonInteractive?: boolean;
|
|
12
13
|
confirmScopes: boolean;
|
|
13
14
|
}
|
|
14
15
|
export declare class NoDeploymentError extends Error {
|
|
@@ -16,19 +17,19 @@ export declare class NoDeploymentError extends Error {
|
|
|
16
17
|
}
|
|
17
18
|
export declare class InstallController {
|
|
18
19
|
private readonly appConfigProvider;
|
|
20
|
+
private readonly configFile;
|
|
19
21
|
private readonly ui;
|
|
20
22
|
private readonly installAppSiteCommand;
|
|
21
23
|
private readonly installationService;
|
|
22
24
|
private readonly installView;
|
|
23
|
-
constructor(appConfigProvider: AppConfigProvider, ui: UI, installAppSiteCommand: InstallAppSiteCommand, installationService: InstallationService, installView: InstallView);
|
|
25
|
+
constructor(appConfigProvider: AppConfigProvider, configFile: ConfigFile, ui: UI, installAppSiteCommand: InstallAppSiteCommand, installationService: InstallationService, installView: InstallView);
|
|
24
26
|
private securityPrompt;
|
|
25
27
|
private installOrUpgrade;
|
|
26
|
-
private authorizationPrompt;
|
|
27
28
|
private promptForProduct;
|
|
28
29
|
private promptForSite;
|
|
29
30
|
private promptForUpgrade;
|
|
30
31
|
private getUniqueInstallationProductsFromScopes;
|
|
31
|
-
run({ environment, site, product, upgrade, confirmScopes }: InstallViewProps): Promise<void>;
|
|
32
|
+
run({ environment, site, product, upgrade, confirmScopes, nonInteractive }: InstallViewProps): Promise<void>;
|
|
32
33
|
}
|
|
33
34
|
export {};
|
|
34
35
|
//# sourceMappingURL=install-controller.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"install-controller.d.ts","sourceRoot":"","sources":["../../../src/command-line/controller/install-controller.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,iBAAiB,
|
|
1
|
+
{"version":3,"file":"install-controller.d.ts","sourceRoot":"","sources":["../../../src/command-line/controller/install-controller.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,iBAAiB,EACjB,UAAU,EAEV,EAAE,EASH,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAC1B,OAAO,EAAE,qBAAqB,EAAE,MAAM,sCAAsC,CAAC;AAC7E,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEnD,UAAU,gBAAgB;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,GAAG,CAAC;IACX,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;IACjB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,aAAa,EAAE,OAAO,CAAC;CACxB;AAiBD,qBAAa,iBAAkB,SAAQ,KAAK;gBAC9B,WAAW,EAAE,MAAM;CAGhC;AAQD,qBAAa,iBAAiB;IAE1B,OAAO,CAAC,QAAQ,CAAC,iBAAiB;IAClC,OAAO,CAAC,QAAQ,CAAC,UAAU;IAC3B,OAAO,CAAC,QAAQ,CAAC,EAAE;IACnB,OAAO,CAAC,QAAQ,CAAC,qBAAqB;IACtC,OAAO,CAAC,QAAQ,CAAC,mBAAmB;IACpC,OAAO,CAAC,QAAQ,CAAC,WAAW;gBALX,iBAAiB,EAAE,iBAAiB,EACpC,UAAU,EAAE,UAAU,EACtB,EAAE,EAAE,EAAE,EACN,qBAAqB,EAAE,qBAAqB,EAC5C,mBAAmB,EAAE,mBAAmB,EACxC,WAAW,EAAE,WAAW;YAG7B,cAAc;YAmBd,gBAAgB;YAsChB,gBAAgB;YAKhB,aAAa;YAWb,gBAAgB;IAoB9B,OAAO,CAAC,uCAAuC;IAalC,GAAG,CAAC,EACf,WAAW,EACX,IAAI,EACJ,OAAO,EACP,OAAO,EACP,aAAa,EACb,cAAc,EACf,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC;CAuFpC"}
|
|
@@ -1,27 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.InstallController = exports.NoDeploymentError = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
4
|
const cli_shared_1 = require("@forge/cli-shared");
|
|
6
|
-
const open_1 = tslib_1.__importDefault(require("open"));
|
|
7
5
|
class NoDeploymentError extends Error {
|
|
8
6
|
constructor(environment) {
|
|
9
7
|
super(cli_shared_1.Text.install.error.noDeploymentFound(cli_shared_1.environmentToOption(environment)));
|
|
10
8
|
}
|
|
11
9
|
}
|
|
12
10
|
exports.NoDeploymentError = NoDeploymentError;
|
|
13
|
-
const isInstallationResult = (result) => {
|
|
14
|
-
return !!result.installationId;
|
|
15
|
-
};
|
|
16
|
-
const isInstallationResultWithAuthorizationUrl = (result) => {
|
|
17
|
-
return !!(result.installationId && result.authorizationUrl);
|
|
18
|
-
};
|
|
19
|
-
const isAlreadyUpgradedResult = (result) => {
|
|
20
|
-
return result.alreadyUpdated === true;
|
|
21
|
-
};
|
|
22
11
|
class InstallController {
|
|
23
|
-
constructor(appConfigProvider, ui, installAppSiteCommand, installationService, installView) {
|
|
12
|
+
constructor(appConfigProvider, configFile, ui, installAppSiteCommand, installationService, installView) {
|
|
24
13
|
this.appConfigProvider = appConfigProvider;
|
|
14
|
+
this.configFile = configFile;
|
|
25
15
|
this.ui = ui;
|
|
26
16
|
this.installAppSiteCommand = installAppSiteCommand;
|
|
27
17
|
this.installationService = installationService;
|
|
@@ -43,49 +33,29 @@ class InstallController {
|
|
|
43
33
|
}
|
|
44
34
|
}
|
|
45
35
|
}
|
|
46
|
-
async installOrUpgrade(upgrade, environment, site, product,
|
|
36
|
+
async installOrUpgrade(upgrade, environment, site, product, appId, text) {
|
|
47
37
|
return this.ui.displayProgress(async () => {
|
|
48
38
|
if (upgrade) {
|
|
49
|
-
|
|
39
|
+
const isAlreadyUpdated = await this.installationService.upgradeInstallation(site, product, environment, appId);
|
|
40
|
+
return isAlreadyUpdated;
|
|
50
41
|
}
|
|
51
42
|
else {
|
|
52
|
-
|
|
43
|
+
await this.installAppSiteCommand.execute({
|
|
53
44
|
environmentKey: environment,
|
|
54
45
|
site,
|
|
55
46
|
product
|
|
56
47
|
});
|
|
48
|
+
return false;
|
|
57
49
|
}
|
|
58
|
-
}, text.cmd.start(
|
|
59
|
-
if (
|
|
50
|
+
}, text.cmd.start(cli_shared_1.environmentToOption(environment)), (alreadyUpdated) => {
|
|
51
|
+
if (alreadyUpdated) {
|
|
60
52
|
return cli_shared_1.Text.upgrade.alreadyUpdated.spinner;
|
|
61
53
|
}
|
|
62
|
-
else if (isInstallationResultWithAuthorizationUrl(result)) {
|
|
63
|
-
return text.cmd.start(name, cli_shared_1.environmentToOption(environment));
|
|
64
|
-
}
|
|
65
|
-
else if (isInstallationResult(result)) {
|
|
66
|
-
return text.cmd.end(false);
|
|
67
|
-
}
|
|
68
54
|
else {
|
|
69
|
-
return
|
|
70
|
-
successful: false,
|
|
71
|
-
message: cli_shared_1.Text.upgrade.cmd.error
|
|
72
|
-
};
|
|
55
|
+
return text.cmd.end(false);
|
|
73
56
|
}
|
|
74
57
|
});
|
|
75
58
|
}
|
|
76
|
-
async authorizationPrompt(authorizationUrl, name, environment, product, site, text) {
|
|
77
|
-
this.ui.info(cli_shared_1.Text.install.authorization.banner);
|
|
78
|
-
this.ui.info(cli_shared_1.Text.install.authorization.link(authorizationUrl));
|
|
79
|
-
if (cli_shared_1.ContainerTokenAuthenticator.isAvailable()) {
|
|
80
|
-
return;
|
|
81
|
-
}
|
|
82
|
-
await cli_shared_1.pressAnyKey(cli_shared_1.Text.install.authorization.openBrowser);
|
|
83
|
-
await open_1.default(authorizationUrl);
|
|
84
|
-
this.ui.emptyLine();
|
|
85
|
-
this.ui.info(text.cmd.end(true));
|
|
86
|
-
this.ui.emptyLine();
|
|
87
|
-
this.ui.info(text.success.banner(name, environment, cli_shared_1.environmentToOption, product, site.host));
|
|
88
|
-
}
|
|
89
59
|
async promptForProduct() {
|
|
90
60
|
this.ui.info(cli_shared_1.Text.installationContext.overviewProduct);
|
|
91
61
|
return await this.ui.promptForList(cli_shared_1.Text.installationContext.promptProduct, cli_shared_1.SUPPORTED_PRODUCTS);
|
|
@@ -99,7 +69,7 @@ class InstallController {
|
|
|
99
69
|
return cli_shared_1.validateSite(trySite);
|
|
100
70
|
}
|
|
101
71
|
async promptForUpgrade(siteOption, productOption, environmentOption) {
|
|
102
|
-
const { installations } = await this.installationService.
|
|
72
|
+
const { installations } = await this.installationService.listNonTechnicalAppInstallations({
|
|
103
73
|
site: siteOption === null || siteOption === void 0 ? void 0 : siteOption.host,
|
|
104
74
|
product: productOption,
|
|
105
75
|
environment: environmentOption
|
|
@@ -125,10 +95,11 @@ class InstallController {
|
|
|
125
95
|
});
|
|
126
96
|
return products.size > 0 ? Array.from(products) : undefined;
|
|
127
97
|
}
|
|
128
|
-
async run({ environment, site, product, upgrade, confirmScopes }) {
|
|
129
|
-
|
|
98
|
+
async run({ environment, site, product, upgrade, confirmScopes, nonInteractive }) {
|
|
99
|
+
var _a;
|
|
100
|
+
const { id } = await this.appConfigProvider();
|
|
130
101
|
const text = upgrade ? cli_shared_1.Text.upgrade : cli_shared_1.Text.install;
|
|
131
|
-
if (upgrade) {
|
|
102
|
+
if (upgrade && (!site || !product)) {
|
|
132
103
|
const upgradeResult = await this.promptForUpgrade(site, product, environment);
|
|
133
104
|
environment = upgradeResult.environment;
|
|
134
105
|
site = upgradeResult.site;
|
|
@@ -140,28 +111,32 @@ class InstallController {
|
|
|
140
111
|
if (cli_shared_1.isSecureSite(site)) {
|
|
141
112
|
await this.securityPrompt(site);
|
|
142
113
|
}
|
|
143
|
-
const
|
|
144
|
-
if (!scopes) {
|
|
114
|
+
const environmentPermissions = await this.installationService.getAppEnvironmentPermissions(id, environment);
|
|
115
|
+
if (!(environmentPermissions === null || environmentPermissions === void 0 ? void 0 : environmentPermissions.scopes) || environmentPermissions.scopes.length === 0) {
|
|
145
116
|
this.ui.error(new NoDeploymentError(environment), { pad: false });
|
|
146
117
|
return;
|
|
147
118
|
}
|
|
148
|
-
const
|
|
119
|
+
const { scopes: environmentScopes } = environmentPermissions;
|
|
120
|
+
const [{ permissions }, manifestEgressEntries] = await Promise.all([
|
|
121
|
+
this.configFile.readConfig(),
|
|
122
|
+
this.configFile.getEgressPermissions()
|
|
123
|
+
]);
|
|
124
|
+
const manifestEgressAddresses = cli_shared_1.flatMap(manifestEgressEntries, ({ domains }) => domains !== null && domains !== void 0 ? domains : []);
|
|
125
|
+
const manifestScopes = (_a = permissions === null || permissions === void 0 ? void 0 : permissions.scopes) !== null && _a !== void 0 ? _a : [];
|
|
126
|
+
const scopesConfirmationResult = await this.installView.promptForPermissionsConfirmation(environmentPermissions, manifestScopes, manifestEgressAddresses, environment, confirmScopes, !!nonInteractive, text);
|
|
149
127
|
if (!scopesConfirmationResult)
|
|
150
128
|
return;
|
|
151
|
-
const
|
|
152
|
-
if (
|
|
153
|
-
this.ui.info(cli_shared_1.Text.upgrade.alreadyUpdated.banner(
|
|
154
|
-
}
|
|
155
|
-
else if (isInstallationResultWithAuthorizationUrl(installationInfo)) {
|
|
156
|
-
await this.authorizationPrompt(installationInfo.authorizationUrl, name, environment, product, site, text);
|
|
129
|
+
const isAlreadyUpdated = await this.installOrUpgrade(upgrade, environment, site, product, id, text);
|
|
130
|
+
if (isAlreadyUpdated) {
|
|
131
|
+
this.ui.info(cli_shared_1.Text.upgrade.alreadyUpdated.banner(environment, cli_shared_1.environmentToOption, product, site.host));
|
|
157
132
|
}
|
|
158
133
|
else {
|
|
159
134
|
this.ui.emptyLine();
|
|
160
|
-
this.ui.info(text.success.banner(
|
|
161
|
-
const uniqueProductsFromScopes = this.getUniqueInstallationProductsFromScopes(
|
|
135
|
+
this.ui.info(text.success.banner(environment, cli_shared_1.environmentToOption, product, site.host));
|
|
136
|
+
const uniqueProductsFromScopes = this.getUniqueInstallationProductsFromScopes(environmentScopes);
|
|
162
137
|
if (!uniqueProductsFromScopes || uniqueProductsFromScopes.length <= 1)
|
|
163
138
|
return;
|
|
164
|
-
const { installations } = await this.installationService.
|
|
139
|
+
const { installations } = await this.installationService.listNonTechnicalAppInstallations({
|
|
165
140
|
site: site.host,
|
|
166
141
|
environment
|
|
167
142
|
});
|
|
@@ -8,7 +8,7 @@ class LintController {
|
|
|
8
8
|
}
|
|
9
9
|
async run(environment, fix) {
|
|
10
10
|
!fix && this.lintView.showBlurb();
|
|
11
|
-
const runResult = await this.lintService.run(environment, { fix });
|
|
11
|
+
const runResult = await this.lintService.run(environment, { fix }, this.lintView.getLogger());
|
|
12
12
|
if (runResult === null || runResult === void 0 ? void 0 : runResult.fixResults) {
|
|
13
13
|
this.lintView.reportFixResult(runResult.fixResults);
|
|
14
14
|
}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { LiteLintService } from '../../service/lite-lint-service';
|
|
2
2
|
import { LiteLintView } from '../view/lite-lint-view';
|
|
3
3
|
import { ConfigReader } from '@forge/cli-shared';
|
|
4
|
+
import { CachedConfigService } from '../../service/cached-config-service';
|
|
5
|
+
import { AnalyticsSettingsView } from '../view/analytics-settings-view';
|
|
6
|
+
import { SettingsView } from '../view/settings-view';
|
|
4
7
|
export declare class PreCommandValidationError extends Error {
|
|
5
8
|
constructor();
|
|
6
9
|
}
|
|
@@ -8,11 +11,15 @@ export declare class PreCommandController {
|
|
|
8
11
|
private readonly service;
|
|
9
12
|
private readonly view;
|
|
10
13
|
private readonly configReader;
|
|
11
|
-
|
|
14
|
+
private readonly cachedConfigService;
|
|
15
|
+
private readonly analyticsSettingsView;
|
|
16
|
+
private readonly settingsView;
|
|
17
|
+
constructor(service: LiteLintService, view: LiteLintView, configReader: ConfigReader, cachedConfigService: CachedConfigService, analyticsSettingsView: AnalyticsSettingsView, settingsView: SettingsView);
|
|
12
18
|
private runChecks;
|
|
13
19
|
verifyManifestExists(): () => Promise<void>;
|
|
14
20
|
verifyManifestExistsWithAppConfig(): () => Promise<{
|
|
15
21
|
appId?: string;
|
|
16
22
|
}>;
|
|
23
|
+
verifyAnalyticsPreferences(nonInteractive?: boolean): () => Promise<boolean>;
|
|
17
24
|
}
|
|
18
25
|
//# sourceMappingURL=pre-command-controller.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pre-command-controller.d.ts","sourceRoot":"","sources":["../../../src/command-line/controller/pre-command-controller.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAQ,YAAY,
|
|
1
|
+
{"version":3,"file":"pre-command-controller.d.ts","sourceRoot":"","sources":["../../../src/command-line/controller/pre-command-controller.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAQ,YAAY,EAAmB,MAAM,mBAAmB,CAAC;AACxE,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAC1E,OAAO,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AACxE,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAErD,qBAAa,yBAA0B,SAAQ,KAAK;;CAInD;AAED,qBAAa,oBAAoB;IAE7B,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,IAAI;IACrB,OAAO,CAAC,QAAQ,CAAC,YAAY;IAC7B,OAAO,CAAC,QAAQ,CAAC,mBAAmB;IACpC,OAAO,CAAC,QAAQ,CAAC,qBAAqB;IACtC,OAAO,CAAC,QAAQ,CAAC,YAAY;gBALZ,OAAO,EAAE,eAAe,EACxB,IAAI,EAAE,YAAY,EAClB,YAAY,EAAE,YAAY,EAC1B,mBAAmB,EAAE,mBAAmB,EACxC,qBAAqB,EAAE,qBAAqB,EAC5C,YAAY,EAAE,YAAY;YAG/B,SAAS;IAQvB,oBAAoB,IAAI,MAAM,OAAO,CAAC,IAAI,CAAC;IAI3C,iCAAiC,IAAI,MAAM,OAAO,CAAC;QAAE,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAUtE,0BAA0B,CAAC,cAAc,UAAQ,GAAG,MAAM,OAAO,CAAC,OAAO,CAAC;CAgB3E"}
|
|
@@ -9,13 +9,16 @@ class PreCommandValidationError extends Error {
|
|
|
9
9
|
}
|
|
10
10
|
exports.PreCommandValidationError = PreCommandValidationError;
|
|
11
11
|
class PreCommandController {
|
|
12
|
-
constructor(service, view, configReader) {
|
|
12
|
+
constructor(service, view, configReader, cachedConfigService, analyticsSettingsView, settingsView) {
|
|
13
13
|
this.service = service;
|
|
14
14
|
this.view = view;
|
|
15
15
|
this.configReader = configReader;
|
|
16
|
+
this.cachedConfigService = cachedConfigService;
|
|
17
|
+
this.analyticsSettingsView = analyticsSettingsView;
|
|
18
|
+
this.settingsView = settingsView;
|
|
16
19
|
}
|
|
17
20
|
async runChecks(strict) {
|
|
18
|
-
const report = await this.service.run(strict);
|
|
21
|
+
const report = await this.service.run(strict, this.view.getLogger());
|
|
19
22
|
if (this.service.hasErrors(report)) {
|
|
20
23
|
this.view.reportErrors(report);
|
|
21
24
|
throw new PreCommandValidationError();
|
|
@@ -33,5 +36,22 @@ class PreCommandController {
|
|
|
33
36
|
};
|
|
34
37
|
};
|
|
35
38
|
}
|
|
39
|
+
verifyAnalyticsPreferences(nonInteractive = false) {
|
|
40
|
+
return async () => {
|
|
41
|
+
const preference = this.cachedConfigService.getAnalyticsPreferences();
|
|
42
|
+
if (preference === undefined) {
|
|
43
|
+
if (nonInteractive) {
|
|
44
|
+
throw new cli_shared_1.ValidationError(cli_shared_1.Text.nonInteractive.error.missingAnalyticsPreferences);
|
|
45
|
+
}
|
|
46
|
+
const selectedPreference = await this.analyticsSettingsView.promptForPreference();
|
|
47
|
+
this.cachedConfigService.setAnalyticsPreferences(selectedPreference);
|
|
48
|
+
this.settingsView.setSuccess('usage-analytics', selectedPreference.toString());
|
|
49
|
+
return selectedPreference;
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
return preference;
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
}
|
|
36
56
|
}
|
|
37
57
|
exports.PreCommandController = PreCommandController;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { CLIDetails, FeatureFlagReader, Logger } from '@forge/cli-shared';
|
|
2
|
+
export declare class PrerequisitesController {
|
|
3
|
+
private readonly logger;
|
|
4
|
+
private readonly featureFlags;
|
|
5
|
+
private readonly cliDetails;
|
|
6
|
+
constructor(logger: Logger, featureFlags: FeatureFlagReader, cliDetails: CLIDetails | undefined);
|
|
7
|
+
check(): Promise<void>;
|
|
8
|
+
private checkNodeVersion;
|
|
9
|
+
private checkCustomWarning;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=prerequisites-controller.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prerequisites-controller.d.ts","sourceRoot":"","sources":["../../../src/command-line/controller/prerequisites-controller.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAe,iBAAiB,EAAE,MAAM,EAAQ,MAAM,mBAAmB,CAAC;AAI7F,qBAAa,uBAAuB;IAEhC,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,YAAY;IAC7B,OAAO,CAAC,QAAQ,CAAC,UAAU;gBAFV,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,iBAAiB,EAC/B,UAAU,EAAE,UAAU,GAAG,SAAS;IAG/C,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAK5B,OAAO,CAAC,gBAAgB;YAcV,kBAAkB;CAMjC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PrerequisitesController = void 0;
|
|
4
|
+
const semver_1 = require("semver");
|
|
5
|
+
const cli_shared_1 = require("@forge/cli-shared");
|
|
6
|
+
const version_info_1 = require("../version-info");
|
|
7
|
+
const getNodeVersion_1 = require("./getNodeVersion");
|
|
8
|
+
class PrerequisitesController {
|
|
9
|
+
constructor(logger, featureFlags, cliDetails) {
|
|
10
|
+
this.logger = logger;
|
|
11
|
+
this.featureFlags = featureFlags;
|
|
12
|
+
this.cliDetails = cliDetails;
|
|
13
|
+
}
|
|
14
|
+
async check() {
|
|
15
|
+
this.checkNodeVersion();
|
|
16
|
+
await this.checkCustomWarning();
|
|
17
|
+
}
|
|
18
|
+
checkNodeVersion() {
|
|
19
|
+
const userNodeVersion = getNodeVersion_1.getNodeVersion();
|
|
20
|
+
if (this.cliDetails && !semver_1.satisfies(userNodeVersion, this.cliDetails.compatibleNodeVersion)) {
|
|
21
|
+
cli_shared_1.exitOnError(this.logger)(new Error(cli_shared_1.Text.error.outdatedNodeVersion(this.cliDetails.compatibleNodeVersion, userNodeVersion)));
|
|
22
|
+
}
|
|
23
|
+
if (!semver_1.satisfies(userNodeVersion, version_info_1.supportedNodeVersion)) {
|
|
24
|
+
this.logger.warn(cli_shared_1.Text.warning.unsupportedNodeVersion(userNodeVersion));
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
async checkCustomWarning() {
|
|
28
|
+
const featureFlagValue = await this.featureFlags.readFlag('forge-cli-startup-warning');
|
|
29
|
+
if (featureFlagValue) {
|
|
30
|
+
this.logger.warn(featureFlagValue);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
exports.PrerequisitesController = PrerequisitesController;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { CachedConfigService } from '../../service/cached-config-service';
|
|
2
|
+
import { SettingsView } from '../view/settings-view';
|
|
3
|
+
export declare const ALLOWED_SETTINGS: readonly ["usage-analytics"];
|
|
4
|
+
declare type AllowedSettingType = typeof ALLOWED_SETTINGS[number];
|
|
5
|
+
declare type SettingGetter = () => boolean | undefined;
|
|
6
|
+
declare type SettingSetter = (val: boolean) => void;
|
|
7
|
+
export declare class SettingsController {
|
|
8
|
+
private readonly settingsView;
|
|
9
|
+
private readonly cachedConfigService;
|
|
10
|
+
constructor(settingsView: SettingsView, cachedConfigService: CachedConfigService);
|
|
11
|
+
SETTINGS_MAP: {
|
|
12
|
+
[key in AllowedSettingType]: [string, SettingGetter, SettingSetter];
|
|
13
|
+
};
|
|
14
|
+
showSettings(): void;
|
|
15
|
+
private parseBoolean;
|
|
16
|
+
setSettings(preference: unknown, value: string): void;
|
|
17
|
+
}
|
|
18
|
+
export {};
|
|
19
|
+
//# sourceMappingURL=settings-controller.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"settings-controller.d.ts","sourceRoot":"","sources":["../../../src/command-line/controller/settings-controller.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAC1E,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAErD,eAAO,MAAM,gBAAgB,8BAA+B,CAAC;AAE7D,aAAK,kBAAkB,GAAG,OAAO,gBAAgB,CAAC,MAAM,CAAC,CAAC;AAM1D,aAAK,aAAa,GAAG,MAAM,OAAO,GAAG,SAAS,CAAC;AAC/C,aAAK,aAAa,GAAG,CAAC,GAAG,EAAE,OAAO,KAAK,IAAI,CAAC;AAE5C,qBAAa,kBAAkB;IACjB,OAAO,CAAC,QAAQ,CAAC,YAAY;IAAgB,OAAO,CAAC,QAAQ,CAAC,mBAAmB;gBAAhE,YAAY,EAAE,YAAY,EAAmB,mBAAmB,EAAE,mBAAmB;IAElH,YAAY,EAAE;SAAG,GAAG,IAAI,kBAAkB,GAAG,CAAC,MAAM,EAAE,aAAa,EAAE,aAAa,CAAC;KAAE,CAMnF;IAEK,YAAY;IAQnB,OAAO,CAAC,YAAY;IAWb,WAAW,CAAC,UAAU,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM;CAYtD"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SettingsController = exports.ALLOWED_SETTINGS = void 0;
|
|
4
|
+
const cli_shared_1 = require("@forge/cli-shared");
|
|
5
|
+
exports.ALLOWED_SETTINGS = ['usage-analytics'];
|
|
6
|
+
const isAllowedSetting = (arg) => {
|
|
7
|
+
return exports.ALLOWED_SETTINGS.includes(arg);
|
|
8
|
+
};
|
|
9
|
+
class SettingsController {
|
|
10
|
+
constructor(settingsView, cachedConfigService) {
|
|
11
|
+
this.settingsView = settingsView;
|
|
12
|
+
this.cachedConfigService = cachedConfigService;
|
|
13
|
+
this.SETTINGS_MAP = {
|
|
14
|
+
'usage-analytics': [
|
|
15
|
+
cli_shared_1.Text.settings.usageAnalytics.description,
|
|
16
|
+
() => this.cachedConfigService.getAnalyticsPreferences(),
|
|
17
|
+
(value) => this.cachedConfigService.setAnalyticsPreferences(value)
|
|
18
|
+
]
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
showSettings() {
|
|
22
|
+
const settings = exports.ALLOWED_SETTINGS.map((setting) => {
|
|
23
|
+
const [desc, getSetting] = this.SETTINGS_MAP[setting];
|
|
24
|
+
return [setting, desc, getSetting()];
|
|
25
|
+
});
|
|
26
|
+
this.settingsView.showSettings(settings);
|
|
27
|
+
}
|
|
28
|
+
parseBoolean(value) {
|
|
29
|
+
switch (value) {
|
|
30
|
+
case 'true':
|
|
31
|
+
return true;
|
|
32
|
+
case 'false':
|
|
33
|
+
return false;
|
|
34
|
+
default:
|
|
35
|
+
throw new cli_shared_1.ValidationError(cli_shared_1.Text.settings.set.invalidValue);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
setSettings(preference, value) {
|
|
39
|
+
if (!isAllowedSetting(preference)) {
|
|
40
|
+
throw new cli_shared_1.ValidationError(cli_shared_1.Text.settings.set.invalidSetting(exports.ALLOWED_SETTINGS));
|
|
41
|
+
}
|
|
42
|
+
const parsedValue = this.parseBoolean(value);
|
|
43
|
+
const [, , setSetting] = this.SETTINGS_MAP[preference];
|
|
44
|
+
setSetting(parsedValue);
|
|
45
|
+
this.settingsView.setSuccess(preference, value);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
exports.SettingsController = SettingsController;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stubController.d.ts","sourceRoot":"","sources":["../../../src/command-line/controller/stubController.ts"],"names":[],"mappings":"AAQA,UAAU,aAAa;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,qBAAa,cAAc;IACZ,GAAG,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,aAAa;CAGrD"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.StubController = void 0;
|
|
4
|
+
const cli_shared_1 = require("@forge/cli-shared");
|
|
5
|
+
class StubCommandError extends Error {
|
|
6
|
+
constructor(oldName, newName) {
|
|
7
|
+
super(cli_shared_1.Text.stub.error(newName, oldName));
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
class StubController {
|
|
11
|
+
async run({ oldName, newName }) {
|
|
12
|
+
throw new StubCommandError(oldName, newName);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
exports.StubController = StubController;
|