@forge/cli 9.3.0 → 10.0.0-next.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +149 -0
- package/npm-shrinkwrap.json +50 -43
- package/out/analytics-client/analytics-client.js +39 -12
- package/out/analytics-client/analytics-message-handler.js +28 -27
- package/out/autocomplete/index.js +1 -2
- package/out/autocomplete/util.js +1 -1
- package/out/bin/postinstall.js +1 -1
- package/out/command-line/command.js +132 -116
- package/out/command-line/controller/autocomplete-controller.js +1 -0
- package/out/command-line/controller/default-environment-controller.js +8 -0
- package/out/command-line/controller/deploy-controller.js +25 -9
- package/out/command-line/controller/feedback-controller.js +2 -0
- package/out/command-line/controller/install-controller.js +11 -5
- package/out/command-line/controller/lint-controller.js +3 -1
- package/out/command-line/controller/pre-command-controller.js +6 -0
- package/out/command-line/controller/prerequisites-controller.js +3 -0
- package/out/command-line/controller/settings-controller.js +60 -57
- package/out/command-line/controller/tunnel-controller.js +8 -3
- package/out/command-line/dependency-injection.js +2 -2
- package/out/command-line/errors.js +1 -0
- package/out/command-line/register-authentication-command.js +1 -1
- package/out/command-line/register-environment-variables-commands.js +6 -8
- package/out/command-line/register-installation-commands.js +5 -7
- package/out/command-line/register-log-commands.js +1 -1
- package/out/command-line/register-settings-commands.js +3 -5
- package/out/command-line/register-storage-commands.js +1 -2
- package/out/command-line/sentry.js +4 -1
- package/out/command-line/version-info.js +1 -1
- package/out/command-line/view/analytics-settings-view.js +1 -0
- package/out/command-line/view/deploy-view.js +1 -0
- package/out/command-line/view/install-view.js +1 -0
- package/out/command-line/view/lint-view.js +2 -0
- package/out/command-line/view/lite-lint-view.js +2 -0
- package/out/command-line/view/settings-view.js +1 -0
- package/out/command-line/view/tunnel-view.js +4 -4
- package/out/deploy/deployer/deploy-monitor-graphql-client.js +2 -1
- package/out/deploy/deployer/deployer.js +11 -4
- package/out/deploy/deployer/trigger-deploy-graphql-client.js +1 -0
- package/out/deploy/package-upload-deploy.js +4 -0
- package/out/deploy/packager/archiver.js +19 -15
- package/out/deploy/packager/nativeui-bundler.js +6 -1
- package/out/deploy/packager/packager.js +7 -1
- package/out/deploy/packager/runtime-bundler.d.ts +3 -2
- package/out/deploy/packager/runtime-bundler.d.ts.map +1 -1
- package/out/deploy/packager/runtime-bundler.js +14 -5
- package/out/deploy/uploader/artifact-graphql-client.js +1 -0
- package/out/deploy/uploader/uploader.js +5 -0
- package/out/entities/graphql-client.js +2 -2
- package/out/entities/list-indexes.js +1 -0
- package/out/environment/create-environment.js +6 -1
- package/out/environment/delete-environment.js +6 -1
- package/out/environment/graphql-client.js +6 -3
- package/out/environment/list-environment.js +2 -0
- package/out/environment-variables/delete-environment-variable.js +6 -1
- package/out/environment-variables/graphql-client.js +1 -0
- package/out/environment-variables/list-environment-variables.js +6 -1
- package/out/environment-variables/set-environment-variable.js +6 -1
- package/out/installations/graphql-client.d.ts +1 -0
- package/out/installations/graphql-client.d.ts.map +1 -1
- package/out/installations/graphql-client.js +43 -25
- package/out/installations/install-app-site.js +2 -0
- package/out/installations/site-translation/cloudid-products.js +1 -0
- package/out/installations/uninstall-app.js +2 -0
- package/out/migration-keys/graphql-client.js +4 -4
- package/out/providers/configure-provider.js +6 -1
- package/out/providers/graphql-client.js +1 -0
- package/out/service/cached-config-service.js +1 -0
- package/out/service/custom-entities-service.js +4 -2
- package/out/service/docker-service.js +5 -1
- package/out/service/installation-service.js +7 -4
- package/out/service/lint-service.js +2 -0
- package/out/service/lite-lint-service.js +2 -0
- package/out/service/migration-keys-service.js +2 -0
- package/out/service/port-finding-service.js +1 -0
- package/out/service/resource-packaging-service.js +5 -0
- package/out/service/resources-uploader-service.js +2 -0
- package/out/service/tunnel-analytics-service.js +10 -3
- package/out/service/tunnel-service.js +19 -10
- package/out/storage/local-file-storage.js +2 -2
- package/out/webtrigger/get-webtrigger-url.js +4 -0
- package/out/webtrigger/graphql-client.js +2 -1
- package/out/workers/analytics-message-worker.js +3 -0
- package/out/workers/version-check-worker.js +1 -0
- package/package.json +7 -6
|
@@ -12,11 +12,12 @@ const errors_1 = require("./errors");
|
|
|
12
12
|
const command_suggestion_service_1 = tslib_1.__importDefault(require("../service/command-suggestion-service"));
|
|
13
13
|
const sentry_1 = require("./sentry");
|
|
14
14
|
class WrapperError extends commander_1.CommanderError {
|
|
15
|
+
commandName;
|
|
15
16
|
constructor(error, commandName) {
|
|
16
17
|
super(error.exitCode, error.code, error.message);
|
|
17
|
-
this.getCommandName = () => this.commandName;
|
|
18
18
|
this.commandName = commandName;
|
|
19
19
|
}
|
|
20
|
+
getCommandName = () => this.commandName;
|
|
20
21
|
getAttributes() {
|
|
21
22
|
return {
|
|
22
23
|
isUserError: true
|
|
@@ -28,6 +29,43 @@ function last(arg) {
|
|
|
28
29
|
return arg[arg.length - 1];
|
|
29
30
|
}
|
|
30
31
|
class Command {
|
|
32
|
+
ui;
|
|
33
|
+
analyticsClient;
|
|
34
|
+
preCommandController;
|
|
35
|
+
cliDetails;
|
|
36
|
+
credentialStore;
|
|
37
|
+
defaultEnvironmentController;
|
|
38
|
+
get verbose() {
|
|
39
|
+
return this.cmd.opts().verbose;
|
|
40
|
+
}
|
|
41
|
+
static isError = (cmdError) => {
|
|
42
|
+
return cmdError.exitCode === 1;
|
|
43
|
+
};
|
|
44
|
+
static isHelpTriggered = (cmdError) => {
|
|
45
|
+
return ['commander.helpDisplayed', 'commander.help'].includes(cmdError.code);
|
|
46
|
+
};
|
|
47
|
+
static isVersionTriggered = (cmdError) => {
|
|
48
|
+
return 'commander.version' === cmdError.code;
|
|
49
|
+
};
|
|
50
|
+
static isUnknownCommand = (cmdError) => {
|
|
51
|
+
return cmdError.code === 'commander.unknownCommand';
|
|
52
|
+
};
|
|
53
|
+
static isExcessCommands = (cmdError) => {
|
|
54
|
+
return cmdError.code === 'commander.excessArguments';
|
|
55
|
+
};
|
|
56
|
+
static concatenateNames = (parent, subcommand) => {
|
|
57
|
+
return parent ? `${parent}:${subcommand}` : subcommand;
|
|
58
|
+
};
|
|
59
|
+
cmd;
|
|
60
|
+
analyticsName;
|
|
61
|
+
requiresAuthentication;
|
|
62
|
+
requiresAnalyticsConsent;
|
|
63
|
+
requiredOptionFlags = [];
|
|
64
|
+
preconditionFn = [];
|
|
65
|
+
static program(ui, analyticsClient, preCommandController, cliDetails, credentialStore, defaultEnvironmentController) {
|
|
66
|
+
const cmd = new Command(ui, analyticsClient, preCommandController, cliDetails, credentialStore, defaultEnvironmentController, {});
|
|
67
|
+
return cmd.version(cliDetails?.version ?? 'unknown', '--version').option('--verbose', cli_shared_1.Text.optionVerbose);
|
|
68
|
+
}
|
|
31
69
|
constructor(ui, analyticsClient, preCommandController, cliDetails, credentialStore, defaultEnvironmentController, { cmd, analyticsName, requiresAuthentication, requiresAnalyticsConsent, requiredOptionFlags, preconditionFn }) {
|
|
32
70
|
this.ui = ui;
|
|
33
71
|
this.analyticsClient = analyticsClient;
|
|
@@ -35,92 +73,12 @@ class Command {
|
|
|
35
73
|
this.cliDetails = cliDetails;
|
|
36
74
|
this.credentialStore = credentialStore;
|
|
37
75
|
this.defaultEnvironmentController = defaultEnvironmentController;
|
|
38
|
-
this.requiredOptionFlags = [];
|
|
39
|
-
this.preconditionFn = [];
|
|
40
|
-
this.actionProcessor = async (cb, ...args) => {
|
|
41
|
-
var _a, _b, _c;
|
|
42
|
-
const cmdName = this.cmd.name();
|
|
43
|
-
const analyticsName = (_a = this.analyticsName) !== null && _a !== void 0 ? _a : cmdName;
|
|
44
|
-
let cred = (0, anon_user_id_1.getAnonId)(true);
|
|
45
|
-
let attributes = {};
|
|
46
|
-
try {
|
|
47
|
-
if (this.cliDetails) {
|
|
48
|
-
attributes = {
|
|
49
|
-
version: this.cliDetails.version,
|
|
50
|
-
latest: this.cliDetails.latest,
|
|
51
|
-
isLatest: this.isLatestVersion()
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
this.analyticsClient.reportCommandInvoke(analyticsName, cred, attributes);
|
|
55
|
-
const options = last(args);
|
|
56
|
-
await (0, sentry_1.setSentryCmdOptFlags)(analyticsName, options);
|
|
57
|
-
const nonInteractive = (_b = options.nonInteractive) !== null && _b !== void 0 ? _b : false;
|
|
58
|
-
const json = (_c = options.json) !== null && _c !== void 0 ? _c : false;
|
|
59
|
-
if (nonInteractive) {
|
|
60
|
-
if (!this.satisfiesNonInteractiveOptions(options)) {
|
|
61
|
-
throw new cli_shared_1.ValidationError(cli_shared_1.Text.nonInteractive.error.missingRequiredOption(cmdName, this.requiredOptionFlags));
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
if (this.requiresAnalyticsConsent) {
|
|
65
|
-
await this.preCommandController.verifyAnalyticsPreferences(nonInteractive)();
|
|
66
|
-
}
|
|
67
|
-
if (!json) {
|
|
68
|
-
this.checkVersion();
|
|
69
|
-
}
|
|
70
|
-
const preconditionCheckAttributes = await this.checkPreconditions(...args);
|
|
71
|
-
Object.assign(options, preconditionCheckAttributes);
|
|
72
|
-
const preconditionAnalyticsAttributes = [
|
|
73
|
-
['appId'],
|
|
74
|
-
['environment', 'appEnv'],
|
|
75
|
-
['siteURL', 'site'],
|
|
76
|
-
['product']
|
|
77
|
-
];
|
|
78
|
-
for (const [preconditionAttribute, analyticsAttribute] of preconditionAnalyticsAttributes) {
|
|
79
|
-
const value = preconditionCheckAttributes[preconditionAttribute];
|
|
80
|
-
if (value) {
|
|
81
|
-
attributes[analyticsAttribute !== null && analyticsAttribute !== void 0 ? analyticsAttribute : preconditionAttribute] = value;
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
const actualCred = await this.checkAuthentication();
|
|
85
|
-
if (actualCred) {
|
|
86
|
-
cred = actualCred;
|
|
87
|
-
}
|
|
88
|
-
let accountId;
|
|
89
|
-
try {
|
|
90
|
-
accountId = (await this.credentialStore.getCredentials()).accountId;
|
|
91
|
-
}
|
|
92
|
-
catch (_d) {
|
|
93
|
-
accountId = 'anonymous';
|
|
94
|
-
}
|
|
95
|
-
await (0, sentry_1.setSentryEnvFlags)(accountId, attributes['appId']);
|
|
96
|
-
const result = await cb(...args);
|
|
97
|
-
if (result) {
|
|
98
|
-
attributes = Object.assign(Object.assign({}, attributes), result.analytics);
|
|
99
|
-
if (result.creds) {
|
|
100
|
-
cred = result.creds;
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
this.analyticsClient.reportSuccess(analyticsName, cred, attributes);
|
|
104
|
-
}
|
|
105
|
-
catch (e) {
|
|
106
|
-
attributes = Object.assign(Object.assign({}, (0, cli_shared_1.getErrorAttributes)(e)), attributes);
|
|
107
|
-
this.analyticsClient.reportInvokeFailure(analyticsName, cred, attributes, e);
|
|
108
|
-
if (e instanceof errors_1.DeferredErrors) {
|
|
109
|
-
e.getErrors().forEach((error) => this.analyticsClient.reportFailure(analyticsName, cred, attributes, error));
|
|
110
|
-
process.exit(1);
|
|
111
|
-
}
|
|
112
|
-
else {
|
|
113
|
-
this.analyticsClient.reportFailure(analyticsName, cred, attributes, e);
|
|
114
|
-
await (0, cli_shared_1.exitOnError)(this.ui, e);
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
};
|
|
118
76
|
this.cmd = cmd || new commander_1.default.Command();
|
|
119
77
|
this.analyticsName = analyticsName;
|
|
120
|
-
this.requiresAuthentication = requiresAuthentication
|
|
121
|
-
this.requiresAnalyticsConsent = requiresAnalyticsConsent
|
|
122
|
-
this.requiredOptionFlags = requiredOptionFlags
|
|
123
|
-
this.preconditionFn = preconditionFn
|
|
78
|
+
this.requiresAuthentication = requiresAuthentication ?? true;
|
|
79
|
+
this.requiresAnalyticsConsent = requiresAnalyticsConsent ?? true;
|
|
80
|
+
this.requiredOptionFlags = requiredOptionFlags ?? [];
|
|
81
|
+
this.preconditionFn = preconditionFn ?? [];
|
|
124
82
|
this.cmd.exitOverride((err) => {
|
|
125
83
|
throw new WrapperError(err, this.cmd.name());
|
|
126
84
|
});
|
|
@@ -129,16 +87,16 @@ class Command {
|
|
|
129
87
|
});
|
|
130
88
|
this.cmd.configureHelp({ sortSubcommands: true });
|
|
131
89
|
}
|
|
132
|
-
get verbose() {
|
|
133
|
-
return this.cmd.opts().verbose;
|
|
134
|
-
}
|
|
135
|
-
static program(ui, analyticsClient, preCommandController, cliDetails, credentialStore, defaultEnvironmentController) {
|
|
136
|
-
var _a;
|
|
137
|
-
const cmd = new Command(ui, analyticsClient, preCommandController, cliDetails, credentialStore, defaultEnvironmentController, {});
|
|
138
|
-
return cmd.version((_a = cliDetails === null || cliDetails === void 0 ? void 0 : cliDetails.version) !== null && _a !== void 0 ? _a : 'unknown', '--version').option('--verbose', cli_shared_1.Text.optionVerbose);
|
|
139
|
-
}
|
|
140
90
|
clone(overrides) {
|
|
141
|
-
return new Command(this.ui, this.analyticsClient, this.preCommandController, this.cliDetails, this.credentialStore, this.defaultEnvironmentController,
|
|
91
|
+
return new Command(this.ui, this.analyticsClient, this.preCommandController, this.cliDetails, this.credentialStore, this.defaultEnvironmentController, {
|
|
92
|
+
cmd: this.cmd,
|
|
93
|
+
analyticsName: this.analyticsName,
|
|
94
|
+
requiresAuthentication: this.requiresAuthentication,
|
|
95
|
+
requiresAnalyticsConsent: this.requiresAnalyticsConsent,
|
|
96
|
+
requiredOptionFlags: this.requiredOptionFlags,
|
|
97
|
+
preconditionFn: this.preconditionFn,
|
|
98
|
+
...overrides
|
|
99
|
+
});
|
|
142
100
|
}
|
|
143
101
|
version(str, flags) {
|
|
144
102
|
this.cmd.version(str, flags);
|
|
@@ -230,11 +188,88 @@ class Command {
|
|
|
230
188
|
const requiredOptionKeys = [...this.requiredOptionFlags.map((arg) => new commander_1.Option(arg).attributeName())];
|
|
231
189
|
return requiredOptionKeys.every((requiredOption) => optionKeys.includes(requiredOption));
|
|
232
190
|
}
|
|
191
|
+
actionProcessor = async (cb, ...args) => {
|
|
192
|
+
const cmdName = this.cmd.name();
|
|
193
|
+
const analyticsName = this.analyticsName ?? cmdName;
|
|
194
|
+
let cred = (0, anon_user_id_1.getAnonId)(true);
|
|
195
|
+
let attributes = {};
|
|
196
|
+
try {
|
|
197
|
+
if (this.cliDetails) {
|
|
198
|
+
attributes = {
|
|
199
|
+
version: this.cliDetails.version,
|
|
200
|
+
latest: this.cliDetails.latest,
|
|
201
|
+
isLatest: this.isLatestVersion()
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
this.analyticsClient.reportCommandInvoke(analyticsName, cred, attributes);
|
|
205
|
+
const options = last(args);
|
|
206
|
+
await (0, sentry_1.setSentryCmdOptFlags)(analyticsName, options);
|
|
207
|
+
const nonInteractive = options.nonInteractive ?? false;
|
|
208
|
+
const json = options.json ?? false;
|
|
209
|
+
if (nonInteractive) {
|
|
210
|
+
if (!this.satisfiesNonInteractiveOptions(options)) {
|
|
211
|
+
throw new cli_shared_1.ValidationError(cli_shared_1.Text.nonInteractive.error.missingRequiredOption(cmdName, this.requiredOptionFlags));
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
if (this.requiresAnalyticsConsent) {
|
|
215
|
+
await this.preCommandController.verifyAnalyticsPreferences(nonInteractive)();
|
|
216
|
+
}
|
|
217
|
+
if (!json) {
|
|
218
|
+
this.checkVersion();
|
|
219
|
+
}
|
|
220
|
+
const preconditionCheckAttributes = await this.checkPreconditions(...args);
|
|
221
|
+
Object.assign(options, preconditionCheckAttributes);
|
|
222
|
+
const preconditionAnalyticsAttributes = [
|
|
223
|
+
['appId'],
|
|
224
|
+
['environment', 'appEnv'],
|
|
225
|
+
['siteURL', 'site'],
|
|
226
|
+
['product']
|
|
227
|
+
];
|
|
228
|
+
for (const [preconditionAttribute, analyticsAttribute] of preconditionAnalyticsAttributes) {
|
|
229
|
+
const value = preconditionCheckAttributes[preconditionAttribute];
|
|
230
|
+
if (value) {
|
|
231
|
+
attributes[analyticsAttribute ?? preconditionAttribute] = value;
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
const actualCred = await this.checkAuthentication();
|
|
235
|
+
if (actualCred) {
|
|
236
|
+
cred = actualCred;
|
|
237
|
+
}
|
|
238
|
+
let accountId;
|
|
239
|
+
try {
|
|
240
|
+
accountId = (await this.credentialStore.getCredentials()).accountId;
|
|
241
|
+
}
|
|
242
|
+
catch {
|
|
243
|
+
accountId = 'anonymous';
|
|
244
|
+
}
|
|
245
|
+
await (0, sentry_1.setSentryEnvFlags)(accountId, attributes['appId']);
|
|
246
|
+
const result = await cb(...args);
|
|
247
|
+
if (result) {
|
|
248
|
+
attributes = { ...attributes, ...result.analytics };
|
|
249
|
+
if (result.creds) {
|
|
250
|
+
cred = result.creds;
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
this.analyticsClient.reportSuccess(analyticsName, cred, attributes);
|
|
254
|
+
}
|
|
255
|
+
catch (e) {
|
|
256
|
+
attributes = { ...(0, cli_shared_1.getErrorAttributes)(e), ...attributes };
|
|
257
|
+
this.analyticsClient.reportInvokeFailure(analyticsName, cred, attributes, e);
|
|
258
|
+
if (e instanceof errors_1.DeferredErrors) {
|
|
259
|
+
e.getErrors().forEach((error) => this.analyticsClient.reportFailure(analyticsName, cred, attributes, error));
|
|
260
|
+
process.exit(1);
|
|
261
|
+
}
|
|
262
|
+
else {
|
|
263
|
+
this.analyticsClient.reportFailure(analyticsName, cred, attributes, e);
|
|
264
|
+
await (0, cli_shared_1.exitOnError)(this.ui, e);
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
};
|
|
233
268
|
async checkPreconditions(...args) {
|
|
234
269
|
let attributes = {};
|
|
235
270
|
for (const precondition of this.preconditionFn) {
|
|
236
271
|
const extra = await precondition(...args);
|
|
237
|
-
attributes =
|
|
272
|
+
attributes = { ...attributes, ...extra };
|
|
238
273
|
}
|
|
239
274
|
return attributes;
|
|
240
275
|
}
|
|
@@ -259,9 +294,8 @@ class Command {
|
|
|
259
294
|
}
|
|
260
295
|
}
|
|
261
296
|
isLatestVersion() {
|
|
262
|
-
|
|
263
|
-
const
|
|
264
|
-
const latest = semver_1.default.valid((_b = this.cliDetails) === null || _b === void 0 ? void 0 : _b.latest);
|
|
297
|
+
const version = semver_1.default.valid(this.cliDetails?.version);
|
|
298
|
+
const latest = semver_1.default.valid(this.cliDetails?.latest);
|
|
265
299
|
if (!version || !latest) {
|
|
266
300
|
return false;
|
|
267
301
|
}
|
|
@@ -342,24 +376,6 @@ class Command {
|
|
|
342
376
|
}
|
|
343
377
|
}
|
|
344
378
|
exports.Command = Command;
|
|
345
|
-
Command.isError = (cmdError) => {
|
|
346
|
-
return cmdError.exitCode === 1;
|
|
347
|
-
};
|
|
348
|
-
Command.isHelpTriggered = (cmdError) => {
|
|
349
|
-
return ['commander.helpDisplayed', 'commander.help'].includes(cmdError.code);
|
|
350
|
-
};
|
|
351
|
-
Command.isVersionTriggered = (cmdError) => {
|
|
352
|
-
return 'commander.version' === cmdError.code;
|
|
353
|
-
};
|
|
354
|
-
Command.isUnknownCommand = (cmdError) => {
|
|
355
|
-
return cmdError.code === 'commander.unknownCommand';
|
|
356
|
-
};
|
|
357
|
-
Command.isExcessCommands = (cmdError) => {
|
|
358
|
-
return cmdError.code === 'commander.excessArguments';
|
|
359
|
-
};
|
|
360
|
-
Command.concatenateNames = (parent, subcommand) => {
|
|
361
|
-
return parent ? `${parent}:${subcommand}` : subcommand;
|
|
362
|
-
};
|
|
363
379
|
const help = new commander_1.default.Help();
|
|
364
380
|
function getOptionData(option) {
|
|
365
381
|
let requireUserArg = false;
|
|
@@ -11,6 +11,14 @@ class DefaultEnvironmentNotSetError extends Error {
|
|
|
11
11
|
}
|
|
12
12
|
exports.DefaultEnvironmentNotSetError = DefaultEnvironmentNotSetError;
|
|
13
13
|
class DefaultEnvironmentController {
|
|
14
|
+
ui;
|
|
15
|
+
credentialStore;
|
|
16
|
+
cachedConfigService;
|
|
17
|
+
getAppConfig;
|
|
18
|
+
loginCommand;
|
|
19
|
+
createEnvironmentCommand;
|
|
20
|
+
listEnvironmentCommand;
|
|
21
|
+
getAppOwnerQuery;
|
|
14
22
|
constructor(ui, credentialStore, cachedConfigService, getAppConfig, loginCommand, createEnvironmentCommand, listEnvironmentCommand, getAppOwnerQuery) {
|
|
15
23
|
this.ui = ui;
|
|
16
24
|
this.credentialStore = credentialStore;
|
|
@@ -4,12 +4,16 @@ exports.DeployController = exports.InvalidConnectKeyError = exports.DeployLintFa
|
|
|
4
4
|
const cli_shared_1 = require("@forge/cli-shared");
|
|
5
5
|
const errors_1 = require("../errors");
|
|
6
6
|
class DeployLintFailureError extends cli_shared_1.HiddenError {
|
|
7
|
+
scopes;
|
|
7
8
|
constructor(scopes) {
|
|
8
9
|
super();
|
|
9
10
|
this.scopes = scopes;
|
|
10
11
|
}
|
|
11
12
|
getAttributes() {
|
|
12
|
-
return
|
|
13
|
+
return {
|
|
14
|
+
...super.getAttributes(),
|
|
15
|
+
scopes: this.scopes
|
|
16
|
+
};
|
|
13
17
|
}
|
|
14
18
|
isUserError() {
|
|
15
19
|
return true;
|
|
@@ -17,12 +21,16 @@ class DeployLintFailureError extends cli_shared_1.HiddenError {
|
|
|
17
21
|
}
|
|
18
22
|
exports.DeployLintFailureError = DeployLintFailureError;
|
|
19
23
|
class InvalidConnectKeyError extends cli_shared_1.HiddenError {
|
|
24
|
+
reason;
|
|
20
25
|
constructor(reason) {
|
|
21
26
|
super();
|
|
22
27
|
this.reason = reason;
|
|
23
28
|
}
|
|
24
29
|
getAttributes() {
|
|
25
|
-
return
|
|
30
|
+
return {
|
|
31
|
+
...super.getAttributes(),
|
|
32
|
+
reason: this.reason
|
|
33
|
+
};
|
|
26
34
|
}
|
|
27
35
|
isUserError() {
|
|
28
36
|
return true;
|
|
@@ -30,6 +38,17 @@ class InvalidConnectKeyError extends cli_shared_1.HiddenError {
|
|
|
30
38
|
}
|
|
31
39
|
exports.InvalidConnectKeyError = InvalidConnectKeyError;
|
|
32
40
|
class DeployController {
|
|
41
|
+
appConfigProvider;
|
|
42
|
+
configFile;
|
|
43
|
+
lintService;
|
|
44
|
+
installationsService;
|
|
45
|
+
migrationKeysService;
|
|
46
|
+
customEntitiesService;
|
|
47
|
+
appEnvironmentClient;
|
|
48
|
+
deployView;
|
|
49
|
+
sandboxPackageUploadDeployCommand;
|
|
50
|
+
nodePackageUploadDeployCommand;
|
|
51
|
+
createEnvironmentCommand;
|
|
33
52
|
constructor(appConfigProvider, configFile, lintService, installationsService, migrationKeysService, customEntitiesService, appEnvironmentClient, deployView, sandboxPackageUploadDeployCommand, nodePackageUploadDeployCommand, createEnvironmentCommand) {
|
|
34
53
|
this.appConfigProvider = appConfigProvider;
|
|
35
54
|
this.configFile = configFile;
|
|
@@ -55,7 +74,7 @@ class DeployController {
|
|
|
55
74
|
async validateConnectKeyChange(environment, keys) {
|
|
56
75
|
const { migrationKeys, mpacAppKey } = keys;
|
|
57
76
|
const connectKey = await this.configFile.getConnectKey();
|
|
58
|
-
const migrationKey =
|
|
77
|
+
const migrationKey = migrationKeys?.confluence || migrationKeys?.jira;
|
|
59
78
|
const isMpacApp = this.isMpacProductionApp(mpacAppKey, environment);
|
|
60
79
|
if (this.connectKeyDeleted(connectKey, migrationKey)) {
|
|
61
80
|
this.deployView.displayConnectKeyDeleteWarning(environment);
|
|
@@ -74,7 +93,6 @@ class DeployController {
|
|
|
74
93
|
return { proceed: true, connectKeyChanged: false, connectKeyDeleted: false };
|
|
75
94
|
}
|
|
76
95
|
async verifyPreDeployment(environment) {
|
|
77
|
-
var _a, _b;
|
|
78
96
|
this.deployView.displayLintRunning();
|
|
79
97
|
const { lintResults } = await this.lintService.run(environment, { fix: false }, this.deployView.getLogger());
|
|
80
98
|
const problemCount = this.lintService.problemCount(lintResults);
|
|
@@ -90,7 +108,7 @@ class DeployController {
|
|
|
90
108
|
this.deployView.displayNoLintProblems();
|
|
91
109
|
}
|
|
92
110
|
const manifest = await this.configFile.readConfig();
|
|
93
|
-
if (
|
|
111
|
+
if (manifest?.app?.storage?.entities) {
|
|
94
112
|
if (await this.customEntitiesService.isReindexingInProgress(environment)) {
|
|
95
113
|
if (!(await this.deployView.promptToContinueDeploymentWhileReindexing())) {
|
|
96
114
|
throw new errors_1.UserAbortError();
|
|
@@ -99,13 +117,12 @@ class DeployController {
|
|
|
99
117
|
}
|
|
100
118
|
}
|
|
101
119
|
async verifyPostDeployment(environment) {
|
|
102
|
-
var _a, _b;
|
|
103
120
|
const needsVersionUpdate = await this.installationsService.hasOutdatedProductInstallation(environment);
|
|
104
121
|
if (needsVersionUpdate) {
|
|
105
122
|
this.deployView.displayOutdatedInstallationsMessage();
|
|
106
123
|
}
|
|
107
124
|
const manifest = await this.configFile.readConfig();
|
|
108
|
-
if (
|
|
125
|
+
if (manifest?.app?.storage?.entities) {
|
|
109
126
|
if (await this.customEntitiesService.isReindexingInProgress(environment)) {
|
|
110
127
|
this.deployView.displaySuccessfulDeploymentWhileReindexing();
|
|
111
128
|
}
|
|
@@ -136,7 +153,6 @@ class DeployController {
|
|
|
136
153
|
}
|
|
137
154
|
}
|
|
138
155
|
async run({ environment, verify, nonInteractive }) {
|
|
139
|
-
var _a;
|
|
140
156
|
const { id } = await this.appConfigProvider();
|
|
141
157
|
const appDetails = await this.getAppEnvironmentDetails(id, environment, nonInteractive);
|
|
142
158
|
this.deployView.displayStart(environment, appDetails.environmentType);
|
|
@@ -170,7 +186,7 @@ class DeployController {
|
|
|
170
186
|
const deployCommand = (await this.configFile.runtimeType()) === cli_shared_1.RuntimeType.nodejs
|
|
171
187
|
? this.nodePackageUploadDeployCommand
|
|
172
188
|
: this.sandboxPackageUploadDeployCommand;
|
|
173
|
-
const packageConfig = (
|
|
189
|
+
const packageConfig = (await this.configFile.readConfig()).app?.package;
|
|
174
190
|
const analytics = await this.deployView.reportDeploymentProgress(appDetails, hasProdInstallations, () => deployCommand.execute({ handlers, resources, environmentKey: environment, packageConfig }));
|
|
175
191
|
if (verify) {
|
|
176
192
|
await this.verifyPostDeployment(environment);
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.FeedbackController = void 0;
|
|
4
4
|
class FeedbackController {
|
|
5
|
+
credentialStore;
|
|
6
|
+
feedbackPostClient;
|
|
5
7
|
constructor(credentialStore, feedbackPostClient) {
|
|
6
8
|
this.credentialStore = credentialStore;
|
|
7
9
|
this.feedbackPostClient = feedbackPostClient;
|
|
@@ -10,6 +10,13 @@ class NoDeploymentError extends Error {
|
|
|
10
10
|
}
|
|
11
11
|
exports.NoDeploymentError = NoDeploymentError;
|
|
12
12
|
class InstallController {
|
|
13
|
+
appConfigProvider;
|
|
14
|
+
configFile;
|
|
15
|
+
ui;
|
|
16
|
+
installAppSiteCommand;
|
|
17
|
+
installationService;
|
|
18
|
+
installView;
|
|
19
|
+
featureFlags;
|
|
13
20
|
constructor(appConfigProvider, configFile, ui, installAppSiteCommand, installationService, installView, featureFlags) {
|
|
14
21
|
this.appConfigProvider = appConfigProvider;
|
|
15
22
|
this.configFile = configFile;
|
|
@@ -83,7 +90,7 @@ class InstallController {
|
|
|
83
90
|
}
|
|
84
91
|
async promptForUpgrade(siteOption, productOption, environmentOption) {
|
|
85
92
|
const { installations } = await this.installationService.listNonTechnicalAppInstallations({
|
|
86
|
-
site: siteOption
|
|
93
|
+
site: siteOption?.host,
|
|
87
94
|
product: productOption,
|
|
88
95
|
environment: environmentOption
|
|
89
96
|
});
|
|
@@ -110,7 +117,6 @@ class InstallController {
|
|
|
110
117
|
return products.size > 0 ? Array.from(products) : undefined;
|
|
111
118
|
}
|
|
112
119
|
async run({ environment, site, product, upgrade, confirmScopes, nonInteractive }) {
|
|
113
|
-
var _a;
|
|
114
120
|
const { id } = await this.appConfigProvider();
|
|
115
121
|
const text = upgrade ? cli_shared_1.Text.upgrade : cli_shared_1.Text.install;
|
|
116
122
|
if (upgrade && (!site || !product)) {
|
|
@@ -127,7 +133,7 @@ class InstallController {
|
|
|
127
133
|
await this.securityPrompt(site);
|
|
128
134
|
}
|
|
129
135
|
const environmentPermissions = await this.installationService.getAppEnvironmentPermissions(id, environment);
|
|
130
|
-
if (!
|
|
136
|
+
if (!environmentPermissions?.hasDeployments) {
|
|
131
137
|
this.ui.error(new NoDeploymentError(environment), { pad: false });
|
|
132
138
|
return;
|
|
133
139
|
}
|
|
@@ -139,8 +145,8 @@ class InstallController {
|
|
|
139
145
|
this.configFile.readConfig(),
|
|
140
146
|
this.configFile.getEgressPermissions()
|
|
141
147
|
]);
|
|
142
|
-
const manifestEgressAddresses = (0, cli_shared_1.flatMap)(manifestEgressEntries, ({ domains }) => domains
|
|
143
|
-
const manifestScopes = new Set(
|
|
148
|
+
const manifestEgressAddresses = (0, cli_shared_1.flatMap)(manifestEgressEntries, ({ domains }) => domains ?? []);
|
|
149
|
+
const manifestScopes = new Set(permissions?.scopes ?? []);
|
|
144
150
|
const addedScopes = await this.extractAddedScopes(environmentPermissions);
|
|
145
151
|
const scopesConfirmationResult = await this.installView.promptForPermissionsConfirmation(environmentPermissions, addedScopes, [...manifestScopes], manifestEgressAddresses, environment, confirmScopes, !!nonInteractive, text);
|
|
146
152
|
if (!scopesConfirmationResult)
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.LintController = void 0;
|
|
4
4
|
class LintController {
|
|
5
|
+
lintService;
|
|
6
|
+
lintView;
|
|
5
7
|
constructor(lintService, lintView) {
|
|
6
8
|
this.lintService = lintService;
|
|
7
9
|
this.lintView = lintView;
|
|
@@ -9,7 +11,7 @@ class LintController {
|
|
|
9
11
|
async run(environment, fix) {
|
|
10
12
|
!fix && this.lintView.showBlurb();
|
|
11
13
|
const runResult = await this.lintService.run(environment, { fix }, this.lintView.getLogger());
|
|
12
|
-
if (runResult
|
|
14
|
+
if (runResult?.fixResults) {
|
|
13
15
|
this.lintView.reportFixResult(runResult.fixResults);
|
|
14
16
|
}
|
|
15
17
|
else {
|
|
@@ -9,6 +9,12 @@ class PreCommandValidationError extends cli_shared_1.UserError {
|
|
|
9
9
|
}
|
|
10
10
|
exports.PreCommandValidationError = PreCommandValidationError;
|
|
11
11
|
class PreCommandController {
|
|
12
|
+
service;
|
|
13
|
+
view;
|
|
14
|
+
configReader;
|
|
15
|
+
cachedConfigService;
|
|
16
|
+
analyticsSettingsView;
|
|
17
|
+
settingsView;
|
|
12
18
|
constructor(service, view, configReader, cachedConfigService, analyticsSettingsView, settingsView) {
|
|
13
19
|
this.service = service;
|
|
14
20
|
this.view = view;
|
|
@@ -6,6 +6,9 @@ const cli_shared_1 = require("@forge/cli-shared");
|
|
|
6
6
|
const version_info_1 = require("../version-info");
|
|
7
7
|
const getNodeVersion_1 = require("./getNodeVersion");
|
|
8
8
|
class PrerequisitesController {
|
|
9
|
+
logger;
|
|
10
|
+
featureFlags;
|
|
11
|
+
cliDetails;
|
|
9
12
|
constructor(logger, featureFlags, cliDetails) {
|
|
10
13
|
this.logger = logger;
|
|
11
14
|
this.featureFlags = featureFlags;
|