@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
|
@@ -9,72 +9,75 @@ const manifest_1 = require("@forge/manifest");
|
|
|
9
9
|
const environment_1 = require("../environment");
|
|
10
10
|
exports.ALLOWED_SETTINGS = ['usage-analytics', 'ngrok-config-path', 'default-environment'];
|
|
11
11
|
class SettingsController {
|
|
12
|
+
settingsView;
|
|
13
|
+
cachedConfigService;
|
|
14
|
+
getAppConfig;
|
|
12
15
|
constructor(settingsView, cachedConfigService, getAppConfig) {
|
|
13
16
|
this.settingsView = settingsView;
|
|
14
17
|
this.cachedConfigService = cachedConfigService;
|
|
15
18
|
this.getAppConfig = getAppConfig;
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
}
|
|
20
|
+
SETTINGS_MAP = {
|
|
21
|
+
'usage-analytics': {
|
|
22
|
+
description: cli_shared_1.Text.settings.usageAnalytics.description,
|
|
23
|
+
get: async () => this.cachedConfigService.getAnalyticsPreferences(),
|
|
24
|
+
set: async (value) => {
|
|
25
|
+
const parsedValue = this.parseBoolean(value);
|
|
26
|
+
this.cachedConfigService.setAnalyticsPreferences(parsedValue);
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
'ngrok-config-path': {
|
|
30
|
+
description: cli_shared_1.Text.settings.ngrokConfig.description,
|
|
31
|
+
get: async () => this.cachedConfigService.getNgrokConfigPath(),
|
|
32
|
+
set: async (value) => {
|
|
33
|
+
value = path_1.default.resolve(value);
|
|
34
|
+
let stat;
|
|
35
|
+
try {
|
|
36
|
+
stat = await promises_1.default.stat(value);
|
|
37
|
+
}
|
|
38
|
+
catch (e) {
|
|
39
|
+
throw new cli_shared_1.ValidationError(cli_shared_1.Text.settings.ngrokConfig.errors.inaccessible(value, e.code));
|
|
23
40
|
}
|
|
41
|
+
if (!stat.isFile()) {
|
|
42
|
+
throw new cli_shared_1.ValidationError(cli_shared_1.Text.settings.ngrokConfig.errors.notAFile(value));
|
|
43
|
+
}
|
|
44
|
+
this.cachedConfigService.setNgrokConfigPath(value);
|
|
24
45
|
},
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
throw new cli_shared_1.ValidationError(cli_shared_1.Text.settings.ngrokConfig.errors.notAFile(value));
|
|
46
|
+
getDisplayValue: (value) => path_1.default.resolve(value)
|
|
47
|
+
},
|
|
48
|
+
'default-environment': {
|
|
49
|
+
description: cli_shared_1.Text.settings.defaultEnvironment.description,
|
|
50
|
+
get: async () => {
|
|
51
|
+
try {
|
|
52
|
+
const { id: appId } = await this.getAppConfig();
|
|
53
|
+
const environment = this.cachedConfigService.getDefaultEnvironment(appId);
|
|
54
|
+
return environment ? (0, cli_shared_1.environmentToOption)(environment) : environment;
|
|
55
|
+
}
|
|
56
|
+
catch (e) {
|
|
57
|
+
if (e instanceof cli_shared_1.InvalidManifestError) {
|
|
58
|
+
return;
|
|
39
59
|
}
|
|
40
|
-
|
|
41
|
-
}
|
|
42
|
-
getDisplayValue: (value) => path_1.default.resolve(value)
|
|
60
|
+
throw e;
|
|
61
|
+
}
|
|
43
62
|
},
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
56
|
-
throw e;
|
|
57
|
-
}
|
|
58
|
-
},
|
|
59
|
-
set: async (value) => {
|
|
60
|
-
(0, environment_1.validateDevEnvironment)(value);
|
|
61
|
-
const environment = (0, environment_1.checkEnvironmentOption)(value);
|
|
62
|
-
try {
|
|
63
|
-
const { id: appId } = await this.getAppConfig();
|
|
64
|
-
this.cachedConfigService.setDefaultEnvironment(appId, environment);
|
|
65
|
-
}
|
|
66
|
-
catch (e) {
|
|
67
|
-
if (e instanceof cli_shared_1.InvalidManifestError) {
|
|
68
|
-
throw new cli_shared_1.ValidationError(manifest_1.errors.missingManifest());
|
|
69
|
-
}
|
|
70
|
-
throw e;
|
|
63
|
+
set: async (value) => {
|
|
64
|
+
(0, environment_1.validateDevEnvironment)(value);
|
|
65
|
+
const environment = (0, environment_1.checkEnvironmentOption)(value);
|
|
66
|
+
try {
|
|
67
|
+
const { id: appId } = await this.getAppConfig();
|
|
68
|
+
this.cachedConfigService.setDefaultEnvironment(appId, environment);
|
|
69
|
+
}
|
|
70
|
+
catch (e) {
|
|
71
|
+
if (e instanceof cli_shared_1.InvalidManifestError) {
|
|
72
|
+
throw new cli_shared_1.ValidationError(manifest_1.errors.missingManifest());
|
|
71
73
|
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
74
|
+
throw e;
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
getDisplayValue: (value) => cli_shared_1.Text.env.displayEnvironment(value, cli_shared_1.AppEnvironmentType.Development),
|
|
78
|
+
additionalInfo: cli_shared_1.Text.settings.defaultEnvironment.info
|
|
79
|
+
}
|
|
80
|
+
};
|
|
78
81
|
parseBoolean(value) {
|
|
79
82
|
switch (value) {
|
|
80
83
|
case 'true':
|
|
@@ -5,6 +5,12 @@ const cli_shared_1 = require("@forge/cli-shared");
|
|
|
5
5
|
const docker_service_1 = require("../../service/docker-service");
|
|
6
6
|
const tunnel_service_1 = require("../../service/tunnel-service");
|
|
7
7
|
class TunnelController {
|
|
8
|
+
analyticsService;
|
|
9
|
+
nodeTunnelService;
|
|
10
|
+
localTunnelService;
|
|
11
|
+
dockerTunnelService;
|
|
12
|
+
tunnelView;
|
|
13
|
+
configFile;
|
|
8
14
|
constructor(analyticsService, nodeTunnelService, localTunnelService, dockerTunnelService, tunnelView, configFile) {
|
|
9
15
|
this.analyticsService = analyticsService;
|
|
10
16
|
this.nodeTunnelService = nodeTunnelService;
|
|
@@ -28,10 +34,9 @@ class TunnelController {
|
|
|
28
34
|
await this.runDockerTunnel(options, creds, ui.debugEnabled);
|
|
29
35
|
}
|
|
30
36
|
validateTunnelCommandOptions(isNodeJsRuntime, tunnelOptions) {
|
|
31
|
-
|
|
32
|
-
const options = Object.assign(Object.assign({}, tunnelOptions), { debugStartingPort: cli_shared_1.defaultDebugStartingPort });
|
|
37
|
+
const options = { ...tunnelOptions, debugStartingPort: cli_shared_1.defaultDebugStartingPort };
|
|
33
38
|
if (isNodeJsRuntime && tunnelOptions.debug) {
|
|
34
|
-
if (!
|
|
39
|
+
if (!tunnelOptions.debugFunctionHandlers?.length) {
|
|
35
40
|
throw new tunnel_service_1.FunctionHandlersMustBeDefinedInDebugMode();
|
|
36
41
|
}
|
|
37
42
|
const port = parseInt(tunnelOptions.debugStartingPort);
|
|
@@ -147,8 +147,8 @@ const getDependencies = async (cliDetails) => {
|
|
|
147
147
|
const deployer = new deploy_1.ArtifactDeployer(assertiveAppConfigReader, triggerDeployClient, deployMonitorClient, cli_shared_1.pause, ui);
|
|
148
148
|
const sandboxBundle = (0, bundler_1.getSandboxBundler)();
|
|
149
149
|
const nodeBundle = (0, bundler_1.getNodeBundler)((0, bundler_1.getWrapperProvider)({ fileSystemReader: fileReader }));
|
|
150
|
-
const sandboxRuntimeBundler = new runtime_bundler_1.SandboxRuntimeBundler(archiverFactory, ui, sandboxBundle);
|
|
151
|
-
const nodeRuntimeBundler = new runtime_bundler_1.NodeRuntimeBundler(archiverFactory, ui, nodeBundle);
|
|
150
|
+
const sandboxRuntimeBundler = new runtime_bundler_1.SandboxRuntimeBundler(archiverFactory, ui, sandboxBundle, configFile);
|
|
151
|
+
const nodeRuntimeBundler = new runtime_bundler_1.NodeRuntimeBundler(archiverFactory, ui, nodeBundle, configFile);
|
|
152
152
|
const nativeUiBundler = new nativeui_bundler_1.NativeUIBundler(ui, bundler_1.nativeUiBundle);
|
|
153
153
|
const sandboxAppPackager = new deploy_1.AppPackager(sandboxRuntimeBundler, nativeUiBundler, ui);
|
|
154
154
|
const nodeAppPackager = new deploy_1.AppPackager(nodeRuntimeBundler, nativeUiBundler, ui);
|
|
@@ -35,7 +35,7 @@ async function loginCommandHandler(ui, instructionsUrl, loginCommand, { email, t
|
|
|
35
35
|
ui.info(cli_shared_2.Text.login.nextStep);
|
|
36
36
|
return {
|
|
37
37
|
creds,
|
|
38
|
-
analytics:
|
|
38
|
+
analytics: { ...analytics, anonymousId: (0, anon_user_id_1.getAnonId)(true) }
|
|
39
39
|
};
|
|
40
40
|
}
|
|
41
41
|
catch (error) {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.registerCommands = exports.listEnvironmentVariableCommandHandler = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
4
|
const cli_shared_1 = require("@forge/cli-shared");
|
|
6
5
|
const COMMAND_NAME = 'variables';
|
|
7
6
|
const SET_COMMAND_NAME = 'set';
|
|
@@ -61,7 +60,7 @@ async function listEnvironmentVariableCommandHandler(ui, listEnvironmentVariable
|
|
|
61
60
|
['encrypted', 'Encrypted?'],
|
|
62
61
|
['key', 'Key'],
|
|
63
62
|
['value', 'Value']
|
|
64
|
-
], variables
|
|
63
|
+
], variables?.map(({ encrypt: encrypted, key, value }) => ({
|
|
65
64
|
encrypted,
|
|
66
65
|
key,
|
|
67
66
|
value: encrypted ? cli_shared_1.Text.varsList.encryptedValue : value
|
|
@@ -95,12 +94,11 @@ const registerVariablesSubcommandStubs = ({ cmd, controllers: { stubController }
|
|
|
95
94
|
cmd.deprecatedCommand(DEPRECATED_UNSET_COMMAND, `${COMMAND_NAME} ${UNSET_COMMAND_NAME}`, stubController);
|
|
96
95
|
cmd.deprecatedCommand(DEPRECATED_LIST_COMMAND, `${COMMAND_NAME} ${LIST_COMMAND_NAME}`, stubController);
|
|
97
96
|
};
|
|
98
|
-
const registerCommands = (
|
|
99
|
-
var { cmd } = _a, deps = tslib_1.__rest(_a, ["cmd"]);
|
|
97
|
+
const registerCommands = ({ cmd, ...deps }) => {
|
|
100
98
|
const variables = cmd.command(COMMAND_NAME).description(cli_shared_1.Text.variables.description);
|
|
101
|
-
registerVariablesSubcommandStubs(
|
|
102
|
-
registerSetEnvironmentVariableCommand(
|
|
103
|
-
registerDeleteEnvironmentVariableCommand(
|
|
104
|
-
registerListEnvironmentVariableCommand(
|
|
99
|
+
registerVariablesSubcommandStubs({ cmd, ...deps });
|
|
100
|
+
registerSetEnvironmentVariableCommand({ cmd: variables, ...deps });
|
|
101
|
+
registerDeleteEnvironmentVariableCommand({ cmd: variables, ...deps });
|
|
102
|
+
registerListEnvironmentVariableCommand({ cmd: variables, ...deps });
|
|
105
103
|
};
|
|
106
104
|
exports.registerCommands = registerCommands;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.registerCommands = exports.performMultipleUninstalls = exports.performSingleUninstall = exports.validateContext = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
4
|
const cli_shared_1 = require("@forge/cli-shared");
|
|
6
5
|
const shared_1 = require("../installations/shared");
|
|
7
6
|
const errors_1 = require("./errors");
|
|
@@ -118,7 +117,7 @@ const registerUninstallCommand = (deps) => {
|
|
|
118
117
|
ui.info(cli_shared_1.Text.installList.noInstallations);
|
|
119
118
|
return;
|
|
120
119
|
}
|
|
121
|
-
const installId = installationId
|
|
120
|
+
const installId = installationId?.trim();
|
|
122
121
|
if (installId && installId.length > 0) {
|
|
123
122
|
ui.info(cli_shared_1.Text.uninstall.info);
|
|
124
123
|
ui.info(cli_shared_1.Text.ctrlC);
|
|
@@ -145,12 +144,11 @@ const registerUninstallCommand = (deps) => {
|
|
|
145
144
|
});
|
|
146
145
|
};
|
|
147
146
|
const DEPRECATED_LIST_COMMAND = 'install:list';
|
|
148
|
-
const registerCommands = (
|
|
149
|
-
var { cmd } = _a, deps = tslib_1.__rest(_a, ["cmd"]);
|
|
147
|
+
const registerCommands = ({ cmd, ...deps }) => {
|
|
150
148
|
const install = cmd.command(COMMAND_NAME).description(cli_shared_1.Text.variables.description);
|
|
151
|
-
registerUninstallCommand(
|
|
149
|
+
registerUninstallCommand({ cmd, ...deps });
|
|
152
150
|
cmd.deprecatedCommand(DEPRECATED_LIST_COMMAND, `${COMMAND_NAME} ${LIST_COMMAND_NAME}`, deps.controllers.stubController);
|
|
153
|
-
registerInstallAppCommand(
|
|
154
|
-
registerListInstallationsCommand(
|
|
151
|
+
registerInstallAppCommand({ cmd: install, ...deps });
|
|
152
|
+
registerListInstallationsCommand({ cmd: install, ...deps });
|
|
155
153
|
};
|
|
156
154
|
exports.registerCommands = registerCommands;
|
|
@@ -25,7 +25,7 @@ function parseSinceDateTime(dateTime) {
|
|
|
25
25
|
parsed = dayjs_1.default.utc(dateTime);
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
|
-
return
|
|
28
|
+
return parsed?.isValid() ? parsed.toISOString() : null;
|
|
29
29
|
}
|
|
30
30
|
exports.parseSinceDateTime = parseSinceDateTime;
|
|
31
31
|
function combineLogParts(message, other) {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.registerCommands = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
4
|
const cli_shared_1 = require("@forge/cli-shared");
|
|
6
5
|
const settings_controller_1 = require("./controller/settings-controller");
|
|
7
6
|
const COMMAND_NAME = 'settings';
|
|
@@ -30,10 +29,9 @@ const registerSettingsSet = ({ cmd, controllers: { settingsController } }) => {
|
|
|
30
29
|
return { analytics: {} };
|
|
31
30
|
});
|
|
32
31
|
};
|
|
33
|
-
const registerCommands = (
|
|
34
|
-
var { cmd } = _a, deps = tslib_1.__rest(_a, ["cmd"]);
|
|
32
|
+
const registerCommands = ({ cmd, ...deps }) => {
|
|
35
33
|
const preferences = cmd.command(COMMAND_NAME).requireNoAuthentication().description(cli_shared_1.Text.settings.description);
|
|
36
|
-
registerSettingsList(
|
|
37
|
-
registerSettingsSet(
|
|
34
|
+
registerSettingsList({ cmd: preferences, ...deps });
|
|
35
|
+
registerSettingsSet({ cmd: preferences, ...deps });
|
|
38
36
|
};
|
|
39
37
|
exports.registerCommands = registerCommands;
|
|
@@ -4,9 +4,8 @@ exports.registerCommands = exports.listIndexes = exports.getManifestEntities = v
|
|
|
4
4
|
const cli_shared_1 = require("@forge/cli-shared");
|
|
5
5
|
const COMMAND_NAME = 'storage';
|
|
6
6
|
async function getManifestEntities(configFile) {
|
|
7
|
-
var _a, _b;
|
|
8
7
|
const manifest = await configFile.readConfig();
|
|
9
|
-
return { entities:
|
|
8
|
+
return { entities: manifest.app.storage?.entities?.map((entity) => entity.name) || [] };
|
|
10
9
|
}
|
|
11
10
|
exports.getManifestEntities = getManifestEntities;
|
|
12
11
|
async function listIndexes(data, configFile, { ui, commands: { listEntitiesIndexesCommand } }) {
|
|
@@ -10,7 +10,10 @@ function initialiseSentry({ cliDetails, cachedConfigService, options = { dsn: SE
|
|
|
10
10
|
if (!cachedConfigService.getAnalyticsPreferences()) {
|
|
11
11
|
return;
|
|
12
12
|
}
|
|
13
|
-
Sentry.init(
|
|
13
|
+
Sentry.init({
|
|
14
|
+
...options,
|
|
15
|
+
release: cliDetails?.version
|
|
16
|
+
});
|
|
14
17
|
Sentry.setTag('latestVersion', (0, cli_shared_1.isLatestCLIVersion)(cliDetails) ? 'true' : 'false');
|
|
15
18
|
}
|
|
16
19
|
exports.initialiseSentry = initialiseSentry;
|
|
@@ -4,6 +4,8 @@ exports.LintView = void 0;
|
|
|
4
4
|
const cli_shared_1 = require("@forge/cli-shared");
|
|
5
5
|
const lint_1 = require("@forge/lint");
|
|
6
6
|
class LintView {
|
|
7
|
+
ui;
|
|
8
|
+
lintResultReporter;
|
|
7
9
|
constructor(ui, lintResultReporter = lint_1.reportLintResults) {
|
|
8
10
|
this.ui = ui;
|
|
9
11
|
this.lintResultReporter = lintResultReporter;
|
|
@@ -3,6 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.LiteLintView = void 0;
|
|
4
4
|
const lint_1 = require("@forge/lint");
|
|
5
5
|
class LiteLintView {
|
|
6
|
+
ui;
|
|
7
|
+
reporter;
|
|
6
8
|
constructor(ui, reporter = lint_1.reportLintResults) {
|
|
7
9
|
this.ui = ui;
|
|
8
10
|
this.reporter = reporter;
|
|
@@ -8,9 +8,10 @@ class TunnelViewError extends cli_shared_1.UserError {
|
|
|
8
8
|
}
|
|
9
9
|
exports.TunnelViewError = TunnelViewError;
|
|
10
10
|
class TunnelView {
|
|
11
|
+
ui;
|
|
12
|
+
FAILED_DOCKER_CONNECTION_MESSAGE = 'Cannot connect to the Docker daemon';
|
|
11
13
|
constructor(ui) {
|
|
12
14
|
this.ui = ui;
|
|
13
|
-
this.FAILED_DOCKER_CONNECTION_MESSAGE = 'Cannot connect to the Docker daemon';
|
|
14
15
|
}
|
|
15
16
|
dockerPreamble(environmentKey) {
|
|
16
17
|
this.ui.info(cli_shared_1.Text.tunnel.preamble);
|
|
@@ -63,7 +64,6 @@ class TunnelView {
|
|
|
63
64
|
}
|
|
64
65
|
reportDownloadProgress(imageDownloadChildProcess, { onStart, onFailure, onSuccess }) {
|
|
65
66
|
return new Promise((resolve, reject) => {
|
|
66
|
-
var _a, _b;
|
|
67
67
|
let dockerPullPercent = 0;
|
|
68
68
|
const spinner = (0, ora_1.default)({
|
|
69
69
|
spinner: {
|
|
@@ -72,12 +72,12 @@ class TunnelView {
|
|
|
72
72
|
prefixText: cli_shared_1.Text.tunnel.pullDockerProgress(dockerPullPercent)
|
|
73
73
|
}).start();
|
|
74
74
|
onStart();
|
|
75
|
-
|
|
75
|
+
imageDownloadChildProcess.stdout?.on('data', (data) => {
|
|
76
76
|
dockerPullPercent = this.updatePullPercent(data, dockerPullPercent);
|
|
77
77
|
spinner.prefixText = cli_shared_1.Text.tunnel.pullDockerProgress(dockerPullPercent);
|
|
78
78
|
});
|
|
79
79
|
let stderr = '';
|
|
80
|
-
|
|
80
|
+
imageDownloadChildProcess.stderr?.on('data', (data) => {
|
|
81
81
|
stderr += data.toString();
|
|
82
82
|
});
|
|
83
83
|
imageDownloadChildProcess.on('exit', (code) => {
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.DeployMonitorGraphqlClient = void 0;
|
|
4
4
|
const trigger_deploy_graphql_client_1 = require("./trigger-deploy-graphql-client");
|
|
5
5
|
class DeployMonitorGraphqlClient {
|
|
6
|
+
graphqlClient;
|
|
6
7
|
constructor(graphqlClient) {
|
|
7
8
|
this.graphqlClient = graphqlClient;
|
|
8
9
|
}
|
|
@@ -45,7 +46,7 @@ class DeployMonitorGraphqlClient {
|
|
|
45
46
|
if (!appDeployment) {
|
|
46
47
|
throw new trigger_deploy_graphql_client_1.NoDeploymentError();
|
|
47
48
|
}
|
|
48
|
-
return
|
|
49
|
+
return { ...appDeployment, requestId };
|
|
49
50
|
}
|
|
50
51
|
}
|
|
51
52
|
exports.DeployMonitorGraphqlClient = DeployMonitorGraphqlClient;
|
|
@@ -4,6 +4,7 @@ exports.ArtifactDeployer = exports.ManifestValidationFailedError = exports.Hoste
|
|
|
4
4
|
const cli_shared_1 = require("@forge/cli-shared");
|
|
5
5
|
const DEPLOYMENT_EVENT_POLL_INTERVAL = 500;
|
|
6
6
|
class AppDeploymentFailedError extends cli_shared_1.BaseError {
|
|
7
|
+
userError;
|
|
7
8
|
constructor(userError = false, requestId, message) {
|
|
8
9
|
super(requestId, `${message} (requestId: ${requestId || 'unknown'})`);
|
|
9
10
|
this.userError = userError;
|
|
@@ -14,6 +15,7 @@ class AppDeploymentFailedError extends cli_shared_1.BaseError {
|
|
|
14
15
|
}
|
|
15
16
|
exports.AppDeploymentFailedError = AppDeploymentFailedError;
|
|
16
17
|
class AppSnapshotFailedError extends cli_shared_1.BaseError {
|
|
18
|
+
userError;
|
|
17
19
|
constructor(userError = false, requestId, message) {
|
|
18
20
|
super(requestId, message);
|
|
19
21
|
this.userError = userError;
|
|
@@ -24,6 +26,7 @@ class AppSnapshotFailedError extends cli_shared_1.BaseError {
|
|
|
24
26
|
}
|
|
25
27
|
exports.AppSnapshotFailedError = AppSnapshotFailedError;
|
|
26
28
|
class HostedResourceDeploymentFailedError extends cli_shared_1.BaseError {
|
|
29
|
+
userError;
|
|
27
30
|
constructor(userError = false, requestId, message) {
|
|
28
31
|
super(requestId, message);
|
|
29
32
|
this.userError = userError;
|
|
@@ -49,6 +52,11 @@ function isValidSnapshotLogEvent(event) {
|
|
|
49
52
|
return !!(event.message && event.level);
|
|
50
53
|
}
|
|
51
54
|
class ArtifactDeployer {
|
|
55
|
+
getConfiguredApp;
|
|
56
|
+
deployClient;
|
|
57
|
+
deployMonitorClient;
|
|
58
|
+
pause;
|
|
59
|
+
ui;
|
|
52
60
|
constructor(getConfiguredApp, deployClient, deployMonitorClient, pause, ui) {
|
|
53
61
|
this.getConfiguredApp = getConfiguredApp;
|
|
54
62
|
this.deployClient = deployClient;
|
|
@@ -116,7 +124,7 @@ class ArtifactDeployer {
|
|
|
116
124
|
stageHasTransitionEvent = true;
|
|
117
125
|
return true;
|
|
118
126
|
})
|
|
119
|
-
.map((event) => (
|
|
127
|
+
.map((event) => ({ ...event, stepName: stage.description }));
|
|
120
128
|
});
|
|
121
129
|
}
|
|
122
130
|
getDeploymentEventsHandler() {
|
|
@@ -146,7 +154,6 @@ class ArtifactDeployer {
|
|
|
146
154
|
};
|
|
147
155
|
}
|
|
148
156
|
handleErrorEvent(errorDetails, requestId) {
|
|
149
|
-
var _a;
|
|
150
157
|
if (errorDetails) {
|
|
151
158
|
const { code, message } = errorDetails;
|
|
152
159
|
switch (code) {
|
|
@@ -157,8 +164,8 @@ class ArtifactDeployer {
|
|
|
157
164
|
throw new AppSnapshotFailedError(false, requestId, cli_shared_1.Text.snapshot.timeout);
|
|
158
165
|
}
|
|
159
166
|
case 'ENVIRONMENT_UPDATE_VALIDATION_FAILED': {
|
|
160
|
-
const causeMessage =
|
|
161
|
-
if (causeMessage
|
|
167
|
+
const causeMessage = errorDetails?.fields?.validationResult.message.replace(/Upsert.*Error message: /, '');
|
|
168
|
+
if (causeMessage?.toLowerCase().includes('egress')) {
|
|
162
169
|
throw new AppDeploymentFailedError(true, requestId, cli_shared_1.Text.deploy.egressURL.error(causeMessage));
|
|
163
170
|
}
|
|
164
171
|
break;
|
|
@@ -3,6 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.PackageUploadDeployCommand = void 0;
|
|
4
4
|
const lodash_1 = require("lodash");
|
|
5
5
|
class PackageUploadDeployCommand {
|
|
6
|
+
packager;
|
|
7
|
+
archiveUploader;
|
|
8
|
+
deployer;
|
|
9
|
+
resourcePackagingService;
|
|
6
10
|
constructor(packager, archiveUploader, deployer, resourcePackagingService) {
|
|
7
11
|
this.packager = packager;
|
|
8
12
|
this.archiveUploader = archiveUploader;
|
|
@@ -11,23 +11,13 @@ class ArchiverError extends cli_shared_1.UserError {
|
|
|
11
11
|
}
|
|
12
12
|
exports.ArchiverError = ArchiverError;
|
|
13
13
|
class ZipArchiver {
|
|
14
|
+
logger;
|
|
15
|
+
archive = (0, archiver_1.default)('zip');
|
|
16
|
+
tempFile = tmp_1.default.fileSync({ postfix: '.zip' });
|
|
17
|
+
resolves = [];
|
|
18
|
+
rejects = [];
|
|
14
19
|
constructor(logger) {
|
|
15
20
|
this.logger = logger;
|
|
16
|
-
this.archive = (0, archiver_1.default)('zip');
|
|
17
|
-
this.tempFile = tmp_1.default.fileSync({ postfix: '.zip' });
|
|
18
|
-
this.resolves = [];
|
|
19
|
-
this.rejects = [];
|
|
20
|
-
this.onArchiveError = (err) => {
|
|
21
|
-
const error = new ArchiverError(err.message);
|
|
22
|
-
for (const reject of this.rejects) {
|
|
23
|
-
reject(error);
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
|
-
this.onClose = () => {
|
|
27
|
-
for (const resolve of this.resolves) {
|
|
28
|
-
resolve(this.tempFile.name);
|
|
29
|
-
}
|
|
30
|
-
};
|
|
31
21
|
const output = (0, fs_1.createWriteStream)(this.tempFile.name);
|
|
32
22
|
this.archive.pipe(output);
|
|
33
23
|
output.on('close', this.onClose);
|
|
@@ -52,9 +42,22 @@ class ZipArchiver {
|
|
|
52
42
|
onWarning(cb) {
|
|
53
43
|
this.archive.on('warning', cb);
|
|
54
44
|
}
|
|
45
|
+
onArchiveError = (err) => {
|
|
46
|
+
const error = new ArchiverError(err.message);
|
|
47
|
+
for (const reject of this.rejects) {
|
|
48
|
+
reject(error);
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
onClose = () => {
|
|
52
|
+
for (const resolve of this.resolves) {
|
|
53
|
+
resolve(this.tempFile.name);
|
|
54
|
+
}
|
|
55
|
+
};
|
|
55
56
|
}
|
|
56
57
|
exports.ZipArchiver = ZipArchiver;
|
|
57
58
|
class DirectoryArchiver {
|
|
59
|
+
directory;
|
|
60
|
+
logger;
|
|
58
61
|
constructor(directory, logger) {
|
|
59
62
|
this.directory = directory;
|
|
60
63
|
this.logger = logger;
|
|
@@ -88,6 +91,7 @@ class DirectoryArchiver {
|
|
|
88
91
|
}
|
|
89
92
|
exports.DirectoryArchiver = DirectoryArchiver;
|
|
90
93
|
class MultiArchiver {
|
|
94
|
+
archivers;
|
|
91
95
|
constructor(archivers) {
|
|
92
96
|
this.archivers = archivers;
|
|
93
97
|
}
|
|
@@ -3,6 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.NativeUIBundler = void 0;
|
|
4
4
|
const packager_1 = require("./packager");
|
|
5
5
|
class NativeUIBundler {
|
|
6
|
+
logger;
|
|
7
|
+
bundler;
|
|
6
8
|
constructor(logger, bundler) {
|
|
7
9
|
this.logger = logger;
|
|
8
10
|
this.bundler = bundler;
|
|
@@ -23,7 +25,10 @@ class NativeUIBundler {
|
|
|
23
25
|
}
|
|
24
26
|
bundlerOutputs.forEach(({ outputDir }, index) => {
|
|
25
27
|
this.logger.debug(`NativeUI bundle created: ${outputDir}`);
|
|
26
|
-
nativeUiBundlesDetails.push(
|
|
28
|
+
nativeUiBundlesDetails.push({
|
|
29
|
+
...resources[index],
|
|
30
|
+
path: outputDir
|
|
31
|
+
});
|
|
27
32
|
});
|
|
28
33
|
}
|
|
29
34
|
return {
|
|
@@ -6,6 +6,9 @@ class BundlerError extends cli_shared_1.UserError {
|
|
|
6
6
|
}
|
|
7
7
|
exports.BundlerError = BundlerError;
|
|
8
8
|
class AppPackager {
|
|
9
|
+
runtimeBundler;
|
|
10
|
+
nativeUiBundler;
|
|
11
|
+
logger;
|
|
9
12
|
constructor(runtimeBundler, nativeUiBundler, logger) {
|
|
10
13
|
this.runtimeBundler = runtimeBundler;
|
|
11
14
|
this.nativeUiBundler = nativeUiBundler;
|
|
@@ -15,7 +18,10 @@ class AppPackager {
|
|
|
15
18
|
this.logger.info(cli_shared_1.Text.deploy.taskPackage.title);
|
|
16
19
|
const runtimeBundle = await this.runtimeBundler.bundle(handlers, packageConfig);
|
|
17
20
|
const nativeUiBundle = await this.nativeUiBundler.bundle(resources);
|
|
18
|
-
return
|
|
21
|
+
return {
|
|
22
|
+
...runtimeBundle,
|
|
23
|
+
...nativeUiBundle
|
|
24
|
+
};
|
|
19
25
|
}
|
|
20
26
|
}
|
|
21
27
|
exports.AppPackager = AppPackager;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Bundler, FunctionsEntryPoint } from '@forge/bundler';
|
|
2
|
-
import { Handler, Logger } from '@forge/cli-shared';
|
|
2
|
+
import { Handler, Logger, ConfigFile } from '@forge/cli-shared';
|
|
3
3
|
import { App } from '@forge/manifest';
|
|
4
4
|
import { Archiver } from './archiver';
|
|
5
5
|
export interface RuntimeBundleResult {
|
|
@@ -10,7 +10,8 @@ export declare class RuntimeBundler {
|
|
|
10
10
|
private readonly archiverFactory;
|
|
11
11
|
private readonly logger;
|
|
12
12
|
private readonly bundler;
|
|
13
|
-
|
|
13
|
+
private readonly configFile;
|
|
14
|
+
constructor(archiverFactory: () => Archiver, logger: Logger, bundler: Bundler<FunctionsEntryPoint>, configFile: ConfigFile);
|
|
14
15
|
protected packageCode(archiver: Archiver, entryPoints: FunctionsEntryPoint[]): Promise<string[]>;
|
|
15
16
|
protected packageDependencies(archiver: Archiver): Promise<void>;
|
|
16
17
|
protected packageAll(archiver: Archiver, handlers: Handler[], packageConfig: App['package']): Promise<string[]>;
|