@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,9 +1,10 @@
|
|
|
1
|
-
import commander, { CommanderError } from 'commander';
|
|
1
|
+
import commander, { CommanderError, OutputConfiguration } from 'commander';
|
|
2
2
|
import { AnalyticsClientReporter } from '../analytics-client/analytics-client';
|
|
3
3
|
import { PersonalApiCredentialsValidated } from '@forge/cli-shared';
|
|
4
4
|
import { UI } from '@forge/cli-shared';
|
|
5
5
|
import { CLIDetails } from '@forge/cli-shared';
|
|
6
6
|
import { PreCommandController } from './controller/pre-command-controller';
|
|
7
|
+
import { StubController } from './controller/stubController';
|
|
7
8
|
declare type PreconditionCallback = (...args: any[]) => any;
|
|
8
9
|
declare type ActionResult = Promise<{
|
|
9
10
|
creds?: PersonalApiCredentialsValidated;
|
|
@@ -23,17 +24,28 @@ export declare class Command {
|
|
|
23
24
|
private readonly preCommandController;
|
|
24
25
|
private readonly cliDetails;
|
|
25
26
|
private readonly expectsArguments;
|
|
27
|
+
private readonly analyticsName?;
|
|
26
28
|
get verbose(): boolean;
|
|
27
|
-
static reportHelp: (
|
|
29
|
+
static reportHelp: (cmd: Command, cmdError: WrapperError) => Promise<undefined>;
|
|
28
30
|
private static isError;
|
|
29
31
|
private static isHelpTriggered;
|
|
32
|
+
private static isVersionTriggered;
|
|
33
|
+
private static isUnknownCommand;
|
|
34
|
+
private static isExcessCommands;
|
|
35
|
+
private static concatenateNames;
|
|
30
36
|
private readonly cmd;
|
|
31
37
|
private newCommand;
|
|
32
38
|
private requiresAuthentication;
|
|
39
|
+
private requiresAnalyticsConsent;
|
|
40
|
+
private requiredOptionFlags;
|
|
33
41
|
private preconditionFn;
|
|
34
|
-
|
|
42
|
+
private options;
|
|
43
|
+
private commands;
|
|
44
|
+
constructor(ui: UI, analyticsClient: AnalyticsClientReporter, preCommandController: PreCommandController, cliDetails: CLIDetails | undefined, cmd?: commander.Command, expectsArguments?: boolean, analyticsName?: string | undefined);
|
|
35
45
|
version(str: string, flags?: string): this;
|
|
36
|
-
command(name: string): Command;
|
|
46
|
+
command(name: string, opts?: commander.CommandOptions): Command;
|
|
47
|
+
deprecatedCommand(oldName: string, newName: string, stubController: StubController): void;
|
|
48
|
+
getAnalyticsName(): string | undefined;
|
|
37
49
|
deprecate(newCommand: string): this;
|
|
38
50
|
description(desc: string): this;
|
|
39
51
|
option(flags: string, description: string, defaultValue?: any): this;
|
|
@@ -41,21 +53,29 @@ export declare class Command {
|
|
|
41
53
|
precondition(fn: PreconditionCallback): this;
|
|
42
54
|
requireManifestFile(): this;
|
|
43
55
|
requireAppId(): this;
|
|
56
|
+
nonInteractiveOption(...args: string[]): this;
|
|
44
57
|
action(fn: (...args: any[]) => ActionResult): this;
|
|
45
|
-
parse(argv: string[]):
|
|
46
|
-
onUnknownCommand(listener: ([command]: string[]) => void): this;
|
|
58
|
+
parse(argv: string[]): Promise<undefined>;
|
|
47
59
|
exitOverride: (listener: (err: any) => void) => this;
|
|
48
|
-
help(): void;
|
|
49
60
|
getDefinedCommands(): commander.Command[];
|
|
61
|
+
getDefinedOptions(): commander.Option[];
|
|
62
|
+
getCmdName(): string;
|
|
63
|
+
getCommands(): Command[];
|
|
50
64
|
environmentOption(): this;
|
|
51
65
|
siteAndProductOption(): this;
|
|
52
66
|
requireNoAuthentication(): this;
|
|
67
|
+
requireNoAnalyticsConsent(): this;
|
|
68
|
+
private satisfiesNonInteractiveOptions;
|
|
53
69
|
actionProcessor: (cb: (...cbArgs: any[]) => ActionResult, ...args: any[]) => Promise<void>;
|
|
54
|
-
|
|
70
|
+
configureOutput(obj: OutputConfiguration): this;
|
|
55
71
|
private checkPreconditions;
|
|
56
72
|
private checkAuthentication;
|
|
57
73
|
private checkVersion;
|
|
58
74
|
private validateContext;
|
|
75
|
+
private findLastValidCommand;
|
|
76
|
+
private outputRelevantHelp;
|
|
77
|
+
private unknownCommand;
|
|
78
|
+
private assertValidArgs;
|
|
59
79
|
}
|
|
60
80
|
export {};
|
|
61
81
|
//# sourceMappingURL=command.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../src/command-line/command.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,EAAE,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../src/command-line/command.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,EAAE,EAAE,cAAc,EAAU,mBAAmB,EAAE,MAAM,WAAW,CA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
12
|
const version_info_1 = require("./version-info");
|
|
13
13
|
const anon_user_id_1 = require("./anon-user-id");
|
|
14
14
|
const errors_1 = require("./errors");
|
|
15
|
+
const command_suggestion_service_1 = tslib_1.__importDefault(require("../service/command-suggestion-service"));
|
|
15
16
|
class WrapperError extends commander_1.CommanderError {
|
|
16
17
|
constructor(error, commandName) {
|
|
17
18
|
super(error.exitCode, error.code, error.message);
|
|
@@ -24,19 +25,25 @@ const isErrorWithAnalytics = (e) => {
|
|
|
24
25
|
return e.getAttributes !== undefined;
|
|
25
26
|
};
|
|
26
27
|
class Command {
|
|
27
|
-
constructor(ui, analyticsClient, preCommandController, cliDetails, cmd, expectsArguments = false) {
|
|
28
|
+
constructor(ui, analyticsClient, preCommandController, cliDetails, cmd, expectsArguments = false, analyticsName) {
|
|
28
29
|
this.ui = ui;
|
|
29
30
|
this.analyticsClient = analyticsClient;
|
|
30
31
|
this.preCommandController = preCommandController;
|
|
31
32
|
this.cliDetails = cliDetails;
|
|
32
33
|
this.expectsArguments = expectsArguments;
|
|
34
|
+
this.analyticsName = analyticsName;
|
|
33
35
|
this.requiresAuthentication = true;
|
|
36
|
+
this.requiresAnalyticsConsent = true;
|
|
37
|
+
this.requiredOptionFlags = [];
|
|
34
38
|
this.preconditionFn = [];
|
|
39
|
+
this.options = [];
|
|
40
|
+
this.commands = [];
|
|
35
41
|
this.exitOverride = (listener) => {
|
|
36
42
|
this.cmd.exitOverride((err) => listener(err));
|
|
37
43
|
return this;
|
|
38
44
|
};
|
|
39
45
|
this.actionProcessor = async (cb, ...args) => {
|
|
46
|
+
var _a, _b, _c;
|
|
40
47
|
if (this.newCommand) {
|
|
41
48
|
this.ui.error(new Error(cli_shared_3.Text.deprecate(this.newCommand)));
|
|
42
49
|
}
|
|
@@ -44,9 +51,18 @@ class Command {
|
|
|
44
51
|
let cred = anon_user_id_1.getAnonId(true);
|
|
45
52
|
let attributes = {};
|
|
46
53
|
try {
|
|
47
|
-
if (!this.expectsArguments && args.length >
|
|
54
|
+
if (!this.expectsArguments && args.length > 2) {
|
|
48
55
|
throw new cli_shared_3.ValidationError(cli_shared_3.Text.extraArguments(cmdName));
|
|
49
56
|
}
|
|
57
|
+
const [options] = args;
|
|
58
|
+
if (options === null || options === void 0 ? void 0 : options.nonInteractive) {
|
|
59
|
+
if (!this.satisfiesNonInteractiveOptions(options)) {
|
|
60
|
+
throw new cli_shared_3.ValidationError(cli_shared_3.Text.nonInteractive.error.missingRequiredOption(cmdName, this.requiredOptionFlags));
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
if (this.requiresAnalyticsConsent) {
|
|
64
|
+
await this.preCommandController.verifyAnalyticsPreferences((_a = options === null || options === void 0 ? void 0 : options.nonInteractive) !== null && _a !== void 0 ? _a : false)();
|
|
65
|
+
}
|
|
50
66
|
this.checkVersion();
|
|
51
67
|
if (this.cliDetails) {
|
|
52
68
|
attributes = { version: this.cliDetails.version, latest: this.cliDetails.latest };
|
|
@@ -64,47 +80,61 @@ class Command {
|
|
|
64
80
|
cred = result.creds;
|
|
65
81
|
}
|
|
66
82
|
}
|
|
67
|
-
this.analyticsClient.reportSuccess(cmdName, cred, attributes);
|
|
83
|
+
this.analyticsClient.reportSuccess((_b = this.analyticsName) !== null && _b !== void 0 ? _b : cmdName, cred, attributes);
|
|
68
84
|
}
|
|
69
85
|
catch (e) {
|
|
70
86
|
if (isErrorWithAnalytics(e)) {
|
|
71
87
|
attributes = Object.assign(Object.assign({}, e.getAttributes()), attributes);
|
|
72
88
|
}
|
|
73
89
|
if (e instanceof errors_1.DeferredErrors) {
|
|
74
|
-
e.getErrors().forEach((error) => this.analyticsClient.reportFailure(cmdName, cred, attributes, error));
|
|
90
|
+
e.getErrors().forEach((error) => { var _a; return this.analyticsClient.reportFailure((_a = this.analyticsName) !== null && _a !== void 0 ? _a : cmdName, cred, attributes, error); });
|
|
75
91
|
process.exit(1);
|
|
76
92
|
}
|
|
77
93
|
else {
|
|
78
|
-
this.analyticsClient.reportFailure(cmdName, cred, attributes, e);
|
|
94
|
+
this.analyticsClient.reportFailure((_c = this.analyticsName) !== null && _c !== void 0 ? _c : cmdName, cred, attributes, e);
|
|
79
95
|
cli_shared_4.exitOnError(this.ui)(e);
|
|
80
96
|
}
|
|
81
97
|
}
|
|
82
98
|
};
|
|
83
|
-
this.
|
|
84
|
-
|
|
99
|
+
this.outputRelevantHelp = (argv) => {
|
|
100
|
+
this.findLastValidCommand(argv).command.outputHelp();
|
|
85
101
|
};
|
|
86
102
|
this.cmd = cmd || new commander_1.default.Command();
|
|
87
103
|
}
|
|
88
104
|
get verbose() {
|
|
89
|
-
return this.cmd.verbose;
|
|
105
|
+
return this.cmd.opts().verbose;
|
|
90
106
|
}
|
|
91
107
|
version(str, flags) {
|
|
92
108
|
this.cmd.version(str, flags);
|
|
109
|
+
flags = flags || '-V, --version';
|
|
110
|
+
const versionOption = new commander_1.Option(flags, 'output the version number');
|
|
111
|
+
this.options.push(versionOption);
|
|
93
112
|
return this;
|
|
94
113
|
}
|
|
95
|
-
command(name) {
|
|
114
|
+
command(name, opts) {
|
|
96
115
|
const cmd = this.cmd
|
|
97
|
-
.command(name)
|
|
116
|
+
.command(name, opts)
|
|
98
117
|
.allowUnknownOption(false)
|
|
99
|
-
.
|
|
118
|
+
.allowExcessArguments(false);
|
|
100
119
|
const trimmedName = name.trim();
|
|
101
120
|
const expectsArguments = trimmedName.endsWith(']') || trimmedName.endsWith('>');
|
|
102
|
-
const subCommand = new Command(this.ui, this.analyticsClient, this.preCommandController, this.cliDetails, cmd, expectsArguments);
|
|
121
|
+
const subCommand = new Command(this.ui, this.analyticsClient, this.preCommandController, this.cliDetails, cmd, expectsArguments, Command.concatenateNames(this.analyticsName, cmd.name()));
|
|
122
|
+
subCommand.option('--verbose', cli_shared_3.Text.optionVerbose);
|
|
103
123
|
subCommand.exitOverride((err) => {
|
|
104
124
|
throw new WrapperError(err, subCommand.cmd.name());
|
|
105
125
|
});
|
|
126
|
+
this.commands.push(subCommand);
|
|
106
127
|
return subCommand;
|
|
107
128
|
}
|
|
129
|
+
deprecatedCommand(oldName, newName, stubController) {
|
|
130
|
+
this.command(oldName, { hidden: true })
|
|
131
|
+
.requireNoAuthentication()
|
|
132
|
+
.requireNoAnalyticsConsent()
|
|
133
|
+
.action(() => stubController.run({ oldName, newName }));
|
|
134
|
+
}
|
|
135
|
+
getAnalyticsName() {
|
|
136
|
+
return this.analyticsName;
|
|
137
|
+
}
|
|
108
138
|
deprecate(newCommand) {
|
|
109
139
|
this.newCommand = newCommand;
|
|
110
140
|
return this;
|
|
@@ -115,6 +145,14 @@ class Command {
|
|
|
115
145
|
}
|
|
116
146
|
option(flags, description, fn, defaultValue) {
|
|
117
147
|
this.cmd.option(flags, description, fn, defaultValue);
|
|
148
|
+
const option = new commander_1.Option(flags, description);
|
|
149
|
+
if (typeof fn === 'function') {
|
|
150
|
+
option.default(defaultValue).argParser(fn);
|
|
151
|
+
}
|
|
152
|
+
else {
|
|
153
|
+
option.default(fn);
|
|
154
|
+
}
|
|
155
|
+
this.options.push(option);
|
|
118
156
|
return this;
|
|
119
157
|
}
|
|
120
158
|
precondition(fn) {
|
|
@@ -129,35 +167,60 @@ class Command {
|
|
|
129
167
|
this.precondition(this.preCommandController.verifyManifestExistsWithAppConfig());
|
|
130
168
|
return this;
|
|
131
169
|
}
|
|
132
|
-
|
|
133
|
-
this.
|
|
170
|
+
nonInteractiveOption(...args) {
|
|
171
|
+
this.requiredOptionFlags = args;
|
|
172
|
+
this.cmd.option('--non-interactive', cli_shared_3.Text.nonInteractive.description);
|
|
134
173
|
return this;
|
|
135
174
|
}
|
|
136
|
-
|
|
137
|
-
this.cmd.
|
|
138
|
-
return this.hasArguments();
|
|
139
|
-
}
|
|
140
|
-
onUnknownCommand(listener) {
|
|
141
|
-
this.cmd.on('command:*', listener);
|
|
175
|
+
action(fn) {
|
|
176
|
+
this.cmd.action((...args) => this.actionProcessor(fn, ...args));
|
|
142
177
|
return this;
|
|
143
178
|
}
|
|
144
|
-
|
|
145
|
-
|
|
179
|
+
async parse(argv) {
|
|
180
|
+
try {
|
|
181
|
+
this.assertValidArgs(argv);
|
|
182
|
+
this.cmd.parse(argv);
|
|
183
|
+
}
|
|
184
|
+
catch (err) {
|
|
185
|
+
if (Command.isHelpTriggered(err)) {
|
|
186
|
+
if (Command.isError(err)) {
|
|
187
|
+
this.outputRelevantHelp(argv);
|
|
188
|
+
}
|
|
189
|
+
return Command.reportHelp(this, err);
|
|
190
|
+
}
|
|
191
|
+
if (Command.isVersionTriggered(err)) {
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
194
|
+
if (Command.isUnknownCommand(err) || Command.isExcessCommands(err)) {
|
|
195
|
+
this.unknownCommand(argv);
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
198
|
+
return cli_shared_4.exitOnError(this.ui)(err);
|
|
199
|
+
}
|
|
146
200
|
}
|
|
147
201
|
getDefinedCommands() {
|
|
148
202
|
return this.cmd.commands;
|
|
149
203
|
}
|
|
204
|
+
getDefinedOptions() {
|
|
205
|
+
return this.options;
|
|
206
|
+
}
|
|
207
|
+
getCmdName() {
|
|
208
|
+
return this.cmd.name();
|
|
209
|
+
}
|
|
210
|
+
getCommands() {
|
|
211
|
+
return this.commands;
|
|
212
|
+
}
|
|
150
213
|
environmentOption() {
|
|
151
|
-
this.
|
|
214
|
+
this.option('-e, --environment [environment]', cli_shared_3.Text.env.option(cli_shared_2.DEFAULT_ENVIRONMENT_OPTION, cli_shared_2.VALID_ENVIRONMENT_OPTIONS));
|
|
152
215
|
this.precondition(() => {
|
|
153
|
-
this.cmd.environment = environment_1.checkEnvironmentOption(this.cmd.environment || cli_shared_2.DEFAULT_ENVIRONMENT_OPTION);
|
|
154
|
-
return { appEnv: this.cmd.environment };
|
|
216
|
+
this.cmd.opts().environment = environment_1.checkEnvironmentOption(this.cmd.opts().environment || cli_shared_2.DEFAULT_ENVIRONMENT_OPTION);
|
|
217
|
+
return { appEnv: this.cmd.opts().environment };
|
|
155
218
|
});
|
|
156
219
|
return this;
|
|
157
220
|
}
|
|
158
221
|
siteAndProductOption() {
|
|
159
|
-
this.
|
|
160
|
-
this.
|
|
222
|
+
this.option('-s, --site [site]', cli_shared_3.Text.optionSite);
|
|
223
|
+
this.option('-p, --product [product]', cli_shared_3.Text.optionProduct(cli_shared_2.SUPPORTED_PRODUCTS));
|
|
161
224
|
this.precondition(() => {
|
|
162
225
|
return this.validateContext();
|
|
163
226
|
});
|
|
@@ -167,6 +230,19 @@ class Command {
|
|
|
167
230
|
this.requiresAuthentication = false;
|
|
168
231
|
return this;
|
|
169
232
|
}
|
|
233
|
+
requireNoAnalyticsConsent() {
|
|
234
|
+
this.requiresAnalyticsConsent = false;
|
|
235
|
+
return this;
|
|
236
|
+
}
|
|
237
|
+
satisfiesNonInteractiveOptions(options) {
|
|
238
|
+
const optionKeys = Object.keys(options);
|
|
239
|
+
const requiredOptionKeys = [...this.requiredOptionFlags.map((arg) => new commander_1.Option(arg).attributeName())];
|
|
240
|
+
return requiredOptionKeys.every((requiredOption) => optionKeys.includes(requiredOption));
|
|
241
|
+
}
|
|
242
|
+
configureOutput(obj) {
|
|
243
|
+
this.cmd.configureOutput(obj);
|
|
244
|
+
return this;
|
|
245
|
+
}
|
|
170
246
|
async checkPreconditions(...args) {
|
|
171
247
|
let attributes = {};
|
|
172
248
|
for (const precondition of this.preconditionFn) {
|
|
@@ -197,41 +273,94 @@ class Command {
|
|
|
197
273
|
}
|
|
198
274
|
}
|
|
199
275
|
async validateContext() {
|
|
200
|
-
if (this.cmd.product) {
|
|
201
|
-
const capitalizedProduct = cli_shared_2.capitalizeProduct(this.cmd.product);
|
|
276
|
+
if (this.cmd.opts().product) {
|
|
277
|
+
const capitalizedProduct = cli_shared_2.capitalizeProduct(this.cmd.opts().product);
|
|
202
278
|
if (!cli_shared_2.isSuppportedProduct(capitalizedProduct)) {
|
|
203
279
|
throw new cli_shared_3.ValidationError(cli_shared_3.Text.error.invalidProduct);
|
|
204
280
|
}
|
|
205
|
-
this.cmd.product = capitalizedProduct;
|
|
281
|
+
this.cmd.opts().product = capitalizedProduct;
|
|
206
282
|
}
|
|
207
283
|
let trySite;
|
|
208
|
-
if (this.cmd.site) {
|
|
209
|
-
trySite = this.cmd.site;
|
|
284
|
+
if (this.cmd.opts().site) {
|
|
285
|
+
trySite = this.cmd.opts().site;
|
|
210
286
|
}
|
|
211
|
-
this.cmd.site = trySite ? cli_shared_2.validateSite(trySite) : undefined;
|
|
212
|
-
return { product: this.cmd.product };
|
|
287
|
+
this.cmd.opts().site = trySite ? cli_shared_2.validateSite(trySite) : undefined;
|
|
288
|
+
return { product: this.cmd.opts().product };
|
|
213
289
|
}
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
290
|
+
findLastValidCommand(argv) {
|
|
291
|
+
let command = this.cmd;
|
|
292
|
+
for (const [index, arg] of argv.slice(2).entries()) {
|
|
293
|
+
const commandMatch = command.commands.find((cmd) => cmd.name() === arg);
|
|
294
|
+
if (!commandMatch) {
|
|
295
|
+
return {
|
|
296
|
+
command,
|
|
297
|
+
index: index + 1
|
|
298
|
+
};
|
|
299
|
+
}
|
|
300
|
+
command = commandMatch;
|
|
301
|
+
}
|
|
302
|
+
return {
|
|
303
|
+
command,
|
|
304
|
+
index: 1
|
|
305
|
+
};
|
|
219
306
|
}
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
307
|
+
unknownCommand(argv) {
|
|
308
|
+
const errorMessage = [];
|
|
309
|
+
const { command: lastCommand, index: lastCommandIndex } = this.findLastValidCommand(argv);
|
|
310
|
+
const badLastArg = argv[lastCommandIndex + 1];
|
|
311
|
+
const suggestionService = new command_suggestion_service_1.default();
|
|
312
|
+
const suggestions = suggestionService.getSuggestions(badLastArg, lastCommand.commands
|
|
313
|
+
.filter((cmd) => {
|
|
314
|
+
return cmd._hidden !== true;
|
|
315
|
+
})
|
|
316
|
+
.map((cmd) => cmd.name()));
|
|
317
|
+
errorMessage.push(cli_shared_3.Text.invalidCmd(argv.slice(2, lastCommandIndex + 2).join(' ')));
|
|
318
|
+
if (suggestions.length) {
|
|
319
|
+
errorMessage.push(`Did you mean:`);
|
|
320
|
+
const suggestionsPrefixed = suggestions.map((suggestion) => [...argv.slice(2, lastCommandIndex + 1), suggestion].join(' '));
|
|
321
|
+
errorMessage.push(suggestionsPrefixed.join('\n'));
|
|
322
|
+
errorMessage.push(cli_shared_3.Text.invalidCmdHelp);
|
|
323
|
+
this.ui.info(errorMessage.join('\n\n'));
|
|
324
|
+
}
|
|
325
|
+
else {
|
|
326
|
+
errorMessage.push(cli_shared_3.Text.invalidCmdHelp);
|
|
327
|
+
this.ui.error(new Error(errorMessage.join(' ')));
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
assertValidArgs(argv) {
|
|
331
|
+
const args = argv.slice(2);
|
|
332
|
+
let commands = this.cmd.commands;
|
|
333
|
+
while (args[0] && !args[0].startsWith('-')) {
|
|
334
|
+
if (args[0] === 'help') {
|
|
335
|
+
return;
|
|
226
336
|
}
|
|
227
|
-
|
|
337
|
+
const commandMatch = commands.find((cmd) => cmd.name() === args[0]);
|
|
338
|
+
if (!commandMatch) {
|
|
339
|
+
throw new commander_1.default.CommanderError(1, 'commander.unknownCommand', `error: unknown command '${args[0]}'.`);
|
|
340
|
+
}
|
|
341
|
+
commands = commandMatch.commands;
|
|
342
|
+
args.shift();
|
|
343
|
+
if (commands.length === 0) {
|
|
344
|
+
break;
|
|
228
345
|
}
|
|
229
|
-
program.analyticsClient.reportSuccess('help', cred, { command: cmdError.getCommandName() });
|
|
230
346
|
}
|
|
231
|
-
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
exports.Command = Command;
|
|
350
|
+
Command.reportHelp = async (cmd, cmdError) => {
|
|
351
|
+
try {
|
|
352
|
+
let cred = anon_user_id_1.getAnonId(true);
|
|
353
|
+
try {
|
|
354
|
+
const credentialsGetter = cli_shared_1.getCredentialsStoreProvider(cmd.ui);
|
|
355
|
+
cred = await credentialsGetter.getCredentials();
|
|
232
356
|
}
|
|
357
|
+
catch (noTokenError) {
|
|
358
|
+
}
|
|
359
|
+
cmd.analyticsClient.reportSuccess('help', cred, { command: cmdError.getCommandName() });
|
|
360
|
+
}
|
|
361
|
+
catch (err) {
|
|
233
362
|
}
|
|
234
|
-
return
|
|
363
|
+
return;
|
|
235
364
|
};
|
|
236
365
|
Command.isError = (cmdError) => {
|
|
237
366
|
return cmdError.exitCode === 1;
|
|
@@ -239,3 +368,15 @@ Command.isError = (cmdError) => {
|
|
|
239
368
|
Command.isHelpTriggered = (cmdError) => {
|
|
240
369
|
return ['commander.helpDisplayed', 'commander.help'].includes(cmdError.code);
|
|
241
370
|
};
|
|
371
|
+
Command.isVersionTriggered = (cmdError) => {
|
|
372
|
+
return 'commander.version' === cmdError.code;
|
|
373
|
+
};
|
|
374
|
+
Command.isUnknownCommand = (cmdError) => {
|
|
375
|
+
return cmdError.code === 'commander.unknownCommand';
|
|
376
|
+
};
|
|
377
|
+
Command.isExcessCommands = (cmdError) => {
|
|
378
|
+
return cmdError.code === 'commander.excessArguments';
|
|
379
|
+
};
|
|
380
|
+
Command.concatenateNames = (parent, subcommand) => {
|
|
381
|
+
return parent ? `${parent}:${subcommand}` : subcommand;
|
|
382
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assertUnreachable.d.ts","sourceRoot":"","sources":["../../../src/command-line/controller/assertUnreachable.ts"],"names":[],"mappings":"AAAA,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,KAAK,GAAG,KAAK,CAEjD"}
|
|
@@ -3,9 +3,10 @@ export declare enum Argument {
|
|
|
3
3
|
install = "install",
|
|
4
4
|
uninstall = "uninstall"
|
|
5
5
|
}
|
|
6
|
+
export declare function assertNodeVersionSupported(version?: string): void;
|
|
6
7
|
export declare class AutocompleteController {
|
|
7
8
|
private readonly ui;
|
|
8
9
|
constructor(ui: UI);
|
|
9
|
-
run(arg:
|
|
10
|
+
run(arg: string): Promise<void>;
|
|
10
11
|
}
|
|
11
12
|
//# sourceMappingURL=autocomplete-controller.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"autocomplete-controller.d.ts","sourceRoot":"","sources":["../../../src/command-line/controller/autocomplete-controller.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"autocomplete-controller.d.ts","sourceRoot":"","sources":["../../../src/command-line/controller/autocomplete-controller.ts"],"names":[],"mappings":"AACA,OAAO,EAAQ,EAAE,EAAmB,MAAM,mBAAmB,CAAC;AAK9D,oBAAY,QAAQ;IAClB,OAAO,YAAY;IACnB,SAAS,cAAc;CACxB;AAQD,wBAAgB,0BAA0B,CAAC,OAAO,GAAE,MAAyB,GAAG,IAAI,CAInF;AAED,qBAAa,sBAAsB;IACrB,OAAO,CAAC,QAAQ,CAAC,EAAE;gBAAF,EAAE,EAAE,EAAE;IAEtB,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAwB7C"}
|
|
@@ -1,28 +1,54 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AutocompleteController = exports.Argument = void 0;
|
|
3
|
+
exports.AutocompleteController = exports.assertNodeVersionSupported = exports.Argument = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const semver_1 = tslib_1.__importDefault(require("semver"));
|
|
4
6
|
const cli_shared_1 = require("@forge/cli-shared");
|
|
5
7
|
const autocomplete_1 = require("../../autocomplete");
|
|
8
|
+
const assertUnreachable_1 = require("./assertUnreachable");
|
|
9
|
+
const getNodeVersion_1 = require("./getNodeVersion");
|
|
6
10
|
var Argument;
|
|
7
11
|
(function (Argument) {
|
|
8
12
|
Argument["install"] = "install";
|
|
9
13
|
Argument["uninstall"] = "uninstall";
|
|
10
14
|
})(Argument = exports.Argument || (exports.Argument = {}));
|
|
15
|
+
function assertIsValidArgument(arg) {
|
|
16
|
+
if (!(arg in Argument)) {
|
|
17
|
+
throw new cli_shared_1.ValidationError(cli_shared_1.Text.autocomplete.error.badArg(arg));
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
function assertNodeVersionSupported(version = getNodeVersion_1.getNodeVersion()) {
|
|
21
|
+
if (semver_1.default.eq(version, '12.5.0') || semver_1.default.eq(version, '12.6.0')) {
|
|
22
|
+
throw new Error(cli_shared_1.Text.autocomplete.error.unsupportedNodeVersion);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
exports.assertNodeVersionSupported = assertNodeVersionSupported;
|
|
11
26
|
class AutocompleteController {
|
|
12
27
|
constructor(ui) {
|
|
13
28
|
this.ui = ui;
|
|
14
29
|
}
|
|
15
30
|
async run(arg) {
|
|
31
|
+
assertIsValidArgument(arg);
|
|
16
32
|
if (arg === Argument.install) {
|
|
17
|
-
|
|
18
|
-
|
|
33
|
+
assertNodeVersionSupported();
|
|
34
|
+
if (!(await this.ui.confirm(cli_shared_1.Text.autocomplete.confirmInstalling))) {
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
this.ui.info(cli_shared_1.Text.autocomplete.installing);
|
|
38
|
+
try {
|
|
19
39
|
autocomplete_1.autocomplete.setupShellInitFile();
|
|
20
40
|
}
|
|
41
|
+
catch (e) {
|
|
42
|
+
throw new Error(cli_shared_1.Text.autocomplete.error.unsupportedShell);
|
|
43
|
+
}
|
|
21
44
|
}
|
|
22
45
|
else if (arg === Argument.uninstall) {
|
|
23
46
|
this.ui.info(cli_shared_1.Text.autocomplete.uninstalling);
|
|
24
47
|
autocomplete_1.autocomplete.cleanupShellInitFile();
|
|
25
48
|
}
|
|
49
|
+
else {
|
|
50
|
+
assertUnreachable_1.assertUnreachable(arg);
|
|
51
|
+
}
|
|
26
52
|
}
|
|
27
53
|
}
|
|
28
54
|
exports.AutocompleteController = AutocompleteController;
|
|
@@ -2,6 +2,7 @@ import { AppConfigProvider, ConfigFile, HiddenError } from '@forge/cli-shared';
|
|
|
2
2
|
import { LintService } from '../../service/lint-service';
|
|
3
3
|
import { DeployView } from '../view/deploy-view';
|
|
4
4
|
import { InstallationService } from '../../service/installation-service';
|
|
5
|
+
import { MigrationKeysService } from '../../service/migration-keys-service';
|
|
5
6
|
import { ResourcePackagingService } from '../../service/resource-packaging-service';
|
|
6
7
|
import { ErrorWithAnalytics } from '../command';
|
|
7
8
|
import { PackageUploadDeployCommand } from '../../deploy';
|
|
@@ -15,18 +16,28 @@ export declare class DeployLintFailureError extends HiddenError implements Error
|
|
|
15
16
|
constructor(scopes: string[]);
|
|
16
17
|
getAttributes(): Record<string, string[]>;
|
|
17
18
|
}
|
|
19
|
+
export declare class InvalidConnectKeyError extends HiddenError implements ErrorWithAnalytics {
|
|
20
|
+
private readonly reason;
|
|
21
|
+
constructor(reason: string);
|
|
22
|
+
getAttributes(): Record<string, string>;
|
|
23
|
+
}
|
|
18
24
|
export declare class DeployController {
|
|
19
25
|
private readonly appConfigProvider;
|
|
20
26
|
private readonly configFile;
|
|
21
27
|
private readonly lintService;
|
|
22
28
|
private readonly installationsService;
|
|
29
|
+
private readonly migrationKeysService;
|
|
23
30
|
private readonly deployView;
|
|
24
31
|
private readonly packageUploadDeployCommand;
|
|
25
32
|
private readonly resourcePackagingService;
|
|
26
|
-
constructor(appConfigProvider: AppConfigProvider, configFile: ConfigFile, lintService: LintService, installationsService: InstallationService, deployView: DeployView, packageUploadDeployCommand: PackageUploadDeployCommand, resourcePackagingService: ResourcePackagingService);
|
|
33
|
+
constructor(appConfigProvider: AppConfigProvider, configFile: ConfigFile, lintService: LintService, installationsService: InstallationService, migrationKeysService: MigrationKeysService, deployView: DeployView, packageUploadDeployCommand: PackageUploadDeployCommand, resourcePackagingService: ResourcePackagingService);
|
|
34
|
+
private isMpacProductionApp;
|
|
35
|
+
private connectKeyDeleted;
|
|
36
|
+
private connectKeyChanged;
|
|
37
|
+
private validateConnectKeyChange;
|
|
27
38
|
private verifyPreDeployment;
|
|
28
39
|
private verifyPostDeployment;
|
|
29
|
-
run({ environment, verify }: DeployOptions): Promise<DeploymentResult>;
|
|
40
|
+
run({ environment, verify }: DeployOptions): Promise<DeploymentResult | void>;
|
|
30
41
|
}
|
|
31
42
|
export {};
|
|
32
43
|
//# sourceMappingURL=deploy-controller.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deploy-controller.d.ts","sourceRoot":"","sources":["../../../src/command-line/controller/deploy-controller.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,WAAW,
|
|
1
|
+
{"version":3,"file":"deploy-controller.d.ts","sourceRoot":"","sources":["../../../src/command-line/controller/deploy-controller.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,WAAW,EAAQ,MAAM,mBAAmB,CAAC;AACrF,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,EAA+B,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AACzG,OAAO,EAAE,wBAAwB,EAAE,MAAM,0CAA0C,CAAC;AACpF,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,EAAE,0BAA0B,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAEnE,UAAU,aAAa;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,OAAO,CAAC;CACjB;AAED,qBAAa,sBAAuB,SAAQ,WAAY,YAAW,kBAAkB;IACvE,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAAN,MAAM,EAAE,MAAM,EAAE;IAItC,aAAa,IAAI,MAAM,CAAC,MA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