@forge/cli 9.1.0 → 9.1.1-next.3
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 +42 -0
- package/npm-shrinkwrap.json +34 -35
- package/out/analytics-client/analytics-client.js +12 -39
- package/out/analytics-client/analytics-message-handler.js +27 -28
- package/out/autocomplete/index.js +2 -1
- package/out/autocomplete/util.js +1 -1
- package/out/bin/postinstall.js +1 -1
- package/out/command-line/command.js +116 -132
- package/out/command-line/controller/autocomplete-controller.js +0 -1
- package/out/command-line/controller/default-environment-controller.js +0 -8
- package/out/command-line/controller/deploy-controller.js +9 -25
- package/out/command-line/controller/feedback-controller.js +0 -2
- package/out/command-line/controller/install-controller.js +5 -11
- package/out/command-line/controller/lint-controller.js +1 -3
- package/out/command-line/controller/pre-command-controller.js +0 -6
- package/out/command-line/controller/prerequisites-controller.js +0 -3
- package/out/command-line/controller/settings-controller.js +57 -60
- package/out/command-line/controller/tunnel-controller.js +1 -7
- package/out/command-line/dependency-injection.js +2 -2
- package/out/command-line/errors.js +0 -1
- package/out/command-line/register-authentication-command.js +1 -1
- package/out/command-line/register-environment-variables-commands.js +8 -6
- package/out/command-line/register-installation-commands.js +7 -5
- package/out/command-line/register-log-commands.js +1 -1
- package/out/command-line/register-settings-commands.js +5 -3
- package/out/command-line/register-storage-commands.js +2 -1
- package/out/command-line/sentry.js +1 -4
- package/out/command-line/version-info.js +1 -1
- package/out/command-line/view/analytics-settings-view.js +0 -1
- package/out/command-line/view/deploy-view.js +0 -1
- package/out/command-line/view/install-view.js +0 -1
- package/out/command-line/view/lint-view.js +0 -2
- package/out/command-line/view/lite-lint-view.js +0 -2
- package/out/command-line/view/settings-view.js +0 -1
- package/out/command-line/view/tunnel-view.js +4 -4
- package/out/deploy/deployer/deploy-monitor-graphql-client.js +1 -2
- package/out/deploy/deployer/deployer.js +6 -13
- package/out/deploy/deployer/trigger-deploy-graphql-client.js +0 -1
- package/out/deploy/package-upload-deploy.js +0 -4
- package/out/deploy/packager/archiver.js +15 -19
- package/out/deploy/packager/nativeui-bundler.js +1 -6
- package/out/deploy/packager/packager.js +1 -7
- package/out/deploy/packager/runtime-bundler.d.ts +2 -3
- package/out/deploy/packager/runtime-bundler.d.ts.map +1 -1
- package/out/deploy/packager/runtime-bundler.js +5 -14
- package/out/deploy/uploader/artifact-graphql-client.js +0 -1
- package/out/deploy/uploader/uploader.js +0 -5
- package/out/entities/graphql-client.js +2 -2
- package/out/entities/list-indexes.js +0 -1
- package/out/environment/create-environment.js +1 -6
- package/out/environment/delete-environment.js +1 -6
- package/out/environment/graphql-client.js +3 -6
- package/out/environment/list-environment.js +0 -2
- package/out/environment-variables/delete-environment-variable.js +1 -6
- package/out/environment-variables/graphql-client.js +0 -1
- package/out/environment-variables/list-environment-variables.js +1 -6
- package/out/environment-variables/set-environment-variable.js +1 -6
- package/out/installations/graphql-client.js +22 -29
- package/out/installations/install-app-site.js +0 -2
- package/out/installations/site-translation/cloudid-products.js +0 -1
- package/out/installations/uninstall-app.js +0 -2
- package/out/migration-keys/graphql-client.js +4 -4
- package/out/providers/configure-provider.js +1 -6
- package/out/providers/graphql-client.js +0 -1
- package/out/service/cached-config-service.js +0 -1
- package/out/service/custom-entities-service.js +2 -4
- package/out/service/docker-service.js +1 -5
- package/out/service/installation-service.js +4 -7
- package/out/service/lint-service.js +0 -2
- package/out/service/lite-lint-service.js +0 -2
- package/out/service/migration-keys-service.js +0 -2
- package/out/service/port-finding-service.js +0 -1
- package/out/service/resource-packaging-service.js +0 -5
- package/out/service/resources-uploader-service.js +0 -2
- package/out/service/tunnel-analytics-service.js +3 -10
- package/out/service/tunnel-service.js +10 -19
- package/out/storage/local-file-storage.js +2 -2
- package/out/webtrigger/get-webtrigger-url.js +0 -4
- package/out/webtrigger/graphql-client.js +1 -2
- package/out/workers/analytics-message-worker.js +0 -3
- package/out/workers/version-check-worker.js +0 -1
- package/package.json +7 -7
|
@@ -12,12 +12,11 @@ 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;
|
|
16
15
|
constructor(error, commandName) {
|
|
17
16
|
super(error.exitCode, error.code, error.message);
|
|
17
|
+
this.getCommandName = () => this.commandName;
|
|
18
18
|
this.commandName = commandName;
|
|
19
19
|
}
|
|
20
|
-
getCommandName = () => this.commandName;
|
|
21
20
|
getAttributes() {
|
|
22
21
|
return {
|
|
23
22
|
isUserError: true
|
|
@@ -29,43 +28,6 @@ function last(arg) {
|
|
|
29
28
|
return arg[arg.length - 1];
|
|
30
29
|
}
|
|
31
30
|
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
|
-
}
|
|
69
31
|
constructor(ui, analyticsClient, preCommandController, cliDetails, credentialStore, defaultEnvironmentController, { cmd, analyticsName, requiresAuthentication, requiresAnalyticsConsent, requiredOptionFlags, preconditionFn }) {
|
|
70
32
|
this.ui = ui;
|
|
71
33
|
this.analyticsClient = analyticsClient;
|
|
@@ -73,12 +35,92 @@ class Command {
|
|
|
73
35
|
this.cliDetails = cliDetails;
|
|
74
36
|
this.credentialStore = credentialStore;
|
|
75
37
|
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
|
+
};
|
|
76
118
|
this.cmd = cmd || new commander_1.default.Command();
|
|
77
119
|
this.analyticsName = analyticsName;
|
|
78
|
-
this.requiresAuthentication = requiresAuthentication
|
|
79
|
-
this.requiresAnalyticsConsent = requiresAnalyticsConsent
|
|
80
|
-
this.requiredOptionFlags = requiredOptionFlags
|
|
81
|
-
this.preconditionFn = preconditionFn
|
|
120
|
+
this.requiresAuthentication = requiresAuthentication !== null && requiresAuthentication !== void 0 ? requiresAuthentication : true;
|
|
121
|
+
this.requiresAnalyticsConsent = requiresAnalyticsConsent !== null && requiresAnalyticsConsent !== void 0 ? requiresAnalyticsConsent : true;
|
|
122
|
+
this.requiredOptionFlags = requiredOptionFlags !== null && requiredOptionFlags !== void 0 ? requiredOptionFlags : [];
|
|
123
|
+
this.preconditionFn = preconditionFn !== null && preconditionFn !== void 0 ? preconditionFn : [];
|
|
82
124
|
this.cmd.exitOverride((err) => {
|
|
83
125
|
throw new WrapperError(err, this.cmd.name());
|
|
84
126
|
});
|
|
@@ -87,16 +129,16 @@ class Command {
|
|
|
87
129
|
});
|
|
88
130
|
this.cmd.configureHelp({ sortSubcommands: true });
|
|
89
131
|
}
|
|
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
|
+
}
|
|
90
140
|
clone(overrides) {
|
|
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
|
-
});
|
|
141
|
+
return new Command(this.ui, this.analyticsClient, this.preCommandController, this.cliDetails, this.credentialStore, this.defaultEnvironmentController, Object.assign({ cmd: this.cmd, analyticsName: this.analyticsName, requiresAuthentication: this.requiresAuthentication, requiresAnalyticsConsent: this.requiresAnalyticsConsent, requiredOptionFlags: this.requiredOptionFlags, preconditionFn: this.preconditionFn }, overrides));
|
|
100
142
|
}
|
|
101
143
|
version(str, flags) {
|
|
102
144
|
this.cmd.version(str, flags);
|
|
@@ -188,88 +230,11 @@ class Command {
|
|
|
188
230
|
const requiredOptionKeys = [...this.requiredOptionFlags.map((arg) => new commander_1.Option(arg).attributeName())];
|
|
189
231
|
return requiredOptionKeys.every((requiredOption) => optionKeys.includes(requiredOption));
|
|
190
232
|
}
|
|
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
|
-
};
|
|
268
233
|
async checkPreconditions(...args) {
|
|
269
234
|
let attributes = {};
|
|
270
235
|
for (const precondition of this.preconditionFn) {
|
|
271
236
|
const extra = await precondition(...args);
|
|
272
|
-
attributes = {
|
|
237
|
+
attributes = Object.assign(Object.assign({}, attributes), extra);
|
|
273
238
|
}
|
|
274
239
|
return attributes;
|
|
275
240
|
}
|
|
@@ -294,8 +259,9 @@ class Command {
|
|
|
294
259
|
}
|
|
295
260
|
}
|
|
296
261
|
isLatestVersion() {
|
|
297
|
-
|
|
298
|
-
const
|
|
262
|
+
var _a, _b;
|
|
263
|
+
const version = semver_1.default.valid((_a = this.cliDetails) === null || _a === void 0 ? void 0 : _a.version);
|
|
264
|
+
const latest = semver_1.default.valid((_b = this.cliDetails) === null || _b === void 0 ? void 0 : _b.latest);
|
|
299
265
|
if (!version || !latest) {
|
|
300
266
|
return false;
|
|
301
267
|
}
|
|
@@ -376,6 +342,24 @@ class Command {
|
|
|
376
342
|
}
|
|
377
343
|
}
|
|
378
344
|
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
|
+
};
|
|
379
363
|
const help = new commander_1.default.Help();
|
|
380
364
|
function getOptionData(option) {
|
|
381
365
|
let requireUserArg = false;
|
|
@@ -11,14 +11,6 @@ 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;
|
|
22
14
|
constructor(ui, credentialStore, cachedConfigService, getAppConfig, loginCommand, createEnvironmentCommand, listEnvironmentCommand, getAppOwnerQuery) {
|
|
23
15
|
this.ui = ui;
|
|
24
16
|
this.credentialStore = credentialStore;
|
|
@@ -4,16 +4,12 @@ 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;
|
|
8
7
|
constructor(scopes) {
|
|
9
8
|
super();
|
|
10
9
|
this.scopes = scopes;
|
|
11
10
|
}
|
|
12
11
|
getAttributes() {
|
|
13
|
-
return {
|
|
14
|
-
...super.getAttributes(),
|
|
15
|
-
scopes: this.scopes
|
|
16
|
-
};
|
|
12
|
+
return Object.assign(Object.assign({}, super.getAttributes()), { scopes: this.scopes });
|
|
17
13
|
}
|
|
18
14
|
isUserError() {
|
|
19
15
|
return true;
|
|
@@ -21,16 +17,12 @@ class DeployLintFailureError extends cli_shared_1.HiddenError {
|
|
|
21
17
|
}
|
|
22
18
|
exports.DeployLintFailureError = DeployLintFailureError;
|
|
23
19
|
class InvalidConnectKeyError extends cli_shared_1.HiddenError {
|
|
24
|
-
reason;
|
|
25
20
|
constructor(reason) {
|
|
26
21
|
super();
|
|
27
22
|
this.reason = reason;
|
|
28
23
|
}
|
|
29
24
|
getAttributes() {
|
|
30
|
-
return {
|
|
31
|
-
...super.getAttributes(),
|
|
32
|
-
reason: this.reason
|
|
33
|
-
};
|
|
25
|
+
return Object.assign(Object.assign({}, super.getAttributes()), { reason: this.reason });
|
|
34
26
|
}
|
|
35
27
|
isUserError() {
|
|
36
28
|
return true;
|
|
@@ -38,17 +30,6 @@ class InvalidConnectKeyError extends cli_shared_1.HiddenError {
|
|
|
38
30
|
}
|
|
39
31
|
exports.InvalidConnectKeyError = InvalidConnectKeyError;
|
|
40
32
|
class DeployController {
|
|
41
|
-
appConfigProvider;
|
|
42
|
-
configFile;
|
|
43
|
-
lintService;
|
|
44
|
-
installationsService;
|
|
45
|
-
migrationKeysService;
|
|
46
|
-
customEntitiesService;
|
|
47
|
-
appEnvironmentClient;
|
|
48
|
-
deployView;
|
|
49
|
-
sandboxPackageUploadDeployCommand;
|
|
50
|
-
nodePackageUploadDeployCommand;
|
|
51
|
-
createEnvironmentCommand;
|
|
52
33
|
constructor(appConfigProvider, configFile, lintService, installationsService, migrationKeysService, customEntitiesService, appEnvironmentClient, deployView, sandboxPackageUploadDeployCommand, nodePackageUploadDeployCommand, createEnvironmentCommand) {
|
|
53
34
|
this.appConfigProvider = appConfigProvider;
|
|
54
35
|
this.configFile = configFile;
|
|
@@ -74,7 +55,7 @@ class DeployController {
|
|
|
74
55
|
async validateConnectKeyChange(environment, keys) {
|
|
75
56
|
const { migrationKeys, mpacAppKey } = keys;
|
|
76
57
|
const connectKey = await this.configFile.getConnectKey();
|
|
77
|
-
const migrationKey = migrationKeys
|
|
58
|
+
const migrationKey = (migrationKeys === null || migrationKeys === void 0 ? void 0 : migrationKeys.confluence) || (migrationKeys === null || migrationKeys === void 0 ? void 0 : migrationKeys.jira);
|
|
78
59
|
const isMpacApp = this.isMpacProductionApp(mpacAppKey, environment);
|
|
79
60
|
if (this.connectKeyDeleted(connectKey, migrationKey)) {
|
|
80
61
|
this.deployView.displayConnectKeyDeleteWarning(environment);
|
|
@@ -93,6 +74,7 @@ class DeployController {
|
|
|
93
74
|
return { proceed: true, connectKeyChanged: false, connectKeyDeleted: false };
|
|
94
75
|
}
|
|
95
76
|
async verifyPreDeployment(environment) {
|
|
77
|
+
var _a, _b;
|
|
96
78
|
this.deployView.displayLintRunning();
|
|
97
79
|
const { lintResults } = await this.lintService.run(environment, { fix: false }, this.deployView.getLogger());
|
|
98
80
|
const problemCount = this.lintService.problemCount(lintResults);
|
|
@@ -108,7 +90,7 @@ class DeployController {
|
|
|
108
90
|
this.deployView.displayNoLintProblems();
|
|
109
91
|
}
|
|
110
92
|
const manifest = await this.configFile.readConfig();
|
|
111
|
-
if (manifest
|
|
93
|
+
if ((_b = (_a = manifest === null || manifest === void 0 ? void 0 : manifest.app) === null || _a === void 0 ? void 0 : _a.storage) === null || _b === void 0 ? void 0 : _b.entities) {
|
|
112
94
|
if (await this.customEntitiesService.isReindexingInProgress(environment)) {
|
|
113
95
|
if (!(await this.deployView.promptToContinueDeploymentWhileReindexing())) {
|
|
114
96
|
throw new errors_1.UserAbortError();
|
|
@@ -117,12 +99,13 @@ class DeployController {
|
|
|
117
99
|
}
|
|
118
100
|
}
|
|
119
101
|
async verifyPostDeployment(environment) {
|
|
102
|
+
var _a, _b;
|
|
120
103
|
const needsVersionUpdate = await this.installationsService.hasOutdatedProductInstallation(environment);
|
|
121
104
|
if (needsVersionUpdate) {
|
|
122
105
|
this.deployView.displayOutdatedInstallationsMessage();
|
|
123
106
|
}
|
|
124
107
|
const manifest = await this.configFile.readConfig();
|
|
125
|
-
if (manifest
|
|
108
|
+
if ((_b = (_a = manifest === null || manifest === void 0 ? void 0 : manifest.app) === null || _a === void 0 ? void 0 : _a.storage) === null || _b === void 0 ? void 0 : _b.entities) {
|
|
126
109
|
if (await this.customEntitiesService.isReindexingInProgress(environment)) {
|
|
127
110
|
this.deployView.displaySuccessfulDeploymentWhileReindexing();
|
|
128
111
|
}
|
|
@@ -153,6 +136,7 @@ class DeployController {
|
|
|
153
136
|
}
|
|
154
137
|
}
|
|
155
138
|
async run({ environment, verify, nonInteractive }) {
|
|
139
|
+
var _a;
|
|
156
140
|
const { id } = await this.appConfigProvider();
|
|
157
141
|
const appDetails = await this.getAppEnvironmentDetails(id, environment, nonInteractive);
|
|
158
142
|
this.deployView.displayStart(environment, appDetails.environmentType);
|
|
@@ -186,7 +170,7 @@ class DeployController {
|
|
|
186
170
|
const deployCommand = (await this.configFile.runtimeType()) === cli_shared_1.RuntimeType.nodejs
|
|
187
171
|
? this.nodePackageUploadDeployCommand
|
|
188
172
|
: this.sandboxPackageUploadDeployCommand;
|
|
189
|
-
const packageConfig = (await this.configFile.readConfig()).app
|
|
173
|
+
const packageConfig = (_a = (await this.configFile.readConfig()).app) === null || _a === void 0 ? void 0 : _a.package;
|
|
190
174
|
const analytics = await this.deployView.reportDeploymentProgress(appDetails, hasProdInstallations, () => deployCommand.execute({ handlers, resources, environmentKey: environment, packageConfig }));
|
|
191
175
|
if (verify) {
|
|
192
176
|
await this.verifyPostDeployment(environment);
|
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.FeedbackController = void 0;
|
|
4
4
|
class FeedbackController {
|
|
5
|
-
credentialStore;
|
|
6
|
-
feedbackPostClient;
|
|
7
5
|
constructor(credentialStore, feedbackPostClient) {
|
|
8
6
|
this.credentialStore = credentialStore;
|
|
9
7
|
this.feedbackPostClient = feedbackPostClient;
|
|
@@ -10,13 +10,6 @@ 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;
|
|
20
13
|
constructor(appConfigProvider, configFile, ui, installAppSiteCommand, installationService, installView, featureFlags) {
|
|
21
14
|
this.appConfigProvider = appConfigProvider;
|
|
22
15
|
this.configFile = configFile;
|
|
@@ -90,7 +83,7 @@ class InstallController {
|
|
|
90
83
|
}
|
|
91
84
|
async promptForUpgrade(siteOption, productOption, environmentOption) {
|
|
92
85
|
const { installations } = await this.installationService.listNonTechnicalAppInstallations({
|
|
93
|
-
site: siteOption
|
|
86
|
+
site: siteOption === null || siteOption === void 0 ? void 0 : siteOption.host,
|
|
94
87
|
product: productOption,
|
|
95
88
|
environment: environmentOption
|
|
96
89
|
});
|
|
@@ -117,6 +110,7 @@ class InstallController {
|
|
|
117
110
|
return products.size > 0 ? Array.from(products) : undefined;
|
|
118
111
|
}
|
|
119
112
|
async run({ environment, site, product, upgrade, confirmScopes, nonInteractive }) {
|
|
113
|
+
var _a;
|
|
120
114
|
const { id } = await this.appConfigProvider();
|
|
121
115
|
const text = upgrade ? cli_shared_1.Text.upgrade : cli_shared_1.Text.install;
|
|
122
116
|
if (upgrade && (!site || !product)) {
|
|
@@ -133,7 +127,7 @@ class InstallController {
|
|
|
133
127
|
await this.securityPrompt(site);
|
|
134
128
|
}
|
|
135
129
|
const environmentPermissions = await this.installationService.getAppEnvironmentPermissions(id, environment);
|
|
136
|
-
if (!environmentPermissions
|
|
130
|
+
if (!(environmentPermissions === null || environmentPermissions === void 0 ? void 0 : environmentPermissions.hasDeployments)) {
|
|
137
131
|
this.ui.error(new NoDeploymentError(environment), { pad: false });
|
|
138
132
|
return;
|
|
139
133
|
}
|
|
@@ -145,8 +139,8 @@ class InstallController {
|
|
|
145
139
|
this.configFile.readConfig(),
|
|
146
140
|
this.configFile.getEgressPermissions()
|
|
147
141
|
]);
|
|
148
|
-
const manifestEgressAddresses = (0, cli_shared_1.flatMap)(manifestEgressEntries, ({ domains }) => domains
|
|
149
|
-
const manifestScopes = new Set(permissions
|
|
142
|
+
const manifestEgressAddresses = (0, cli_shared_1.flatMap)(manifestEgressEntries, ({ domains }) => domains !== null && domains !== void 0 ? domains : []);
|
|
143
|
+
const manifestScopes = new Set((_a = permissions === null || permissions === void 0 ? void 0 : permissions.scopes) !== null && _a !== void 0 ? _a : []);
|
|
150
144
|
const addedScopes = await this.extractAddedScopes(environmentPermissions);
|
|
151
145
|
const scopesConfirmationResult = await this.installView.promptForPermissionsConfirmation(environmentPermissions, addedScopes, [...manifestScopes], manifestEgressAddresses, environment, confirmScopes, !!nonInteractive, text);
|
|
152
146
|
if (!scopesConfirmationResult)
|
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.LintController = void 0;
|
|
4
4
|
class LintController {
|
|
5
|
-
lintService;
|
|
6
|
-
lintView;
|
|
7
5
|
constructor(lintService, lintView) {
|
|
8
6
|
this.lintService = lintService;
|
|
9
7
|
this.lintView = lintView;
|
|
@@ -11,7 +9,7 @@ class LintController {
|
|
|
11
9
|
async run(environment, fix) {
|
|
12
10
|
!fix && this.lintView.showBlurb();
|
|
13
11
|
const runResult = await this.lintService.run(environment, { fix }, this.lintView.getLogger());
|
|
14
|
-
if (runResult
|
|
12
|
+
if (runResult === null || runResult === void 0 ? void 0 : runResult.fixResults) {
|
|
15
13
|
this.lintView.reportFixResult(runResult.fixResults);
|
|
16
14
|
}
|
|
17
15
|
else {
|
|
@@ -9,12 +9,6 @@ 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;
|
|
18
12
|
constructor(service, view, configReader, cachedConfigService, analyticsSettingsView, settingsView) {
|
|
19
13
|
this.service = service;
|
|
20
14
|
this.view = view;
|
|
@@ -6,9 +6,6 @@ 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;
|
|
12
9
|
constructor(logger, featureFlags, cliDetails) {
|
|
13
10
|
this.logger = logger;
|
|
14
11
|
this.featureFlags = featureFlags;
|