@edgible-team/cli 1.2.15 → 1.2.17
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/README.md +5 -3
- package/dist/client/api-client.d.ts +13 -1
- package/dist/client/api-client.d.ts.map +1 -1
- package/dist/client/api-client.js +19 -0
- package/dist/commands/agent/install.d.ts +2 -1
- package/dist/commands/agent/install.d.ts.map +1 -1
- package/dist/commands/agent/install.js +24 -7
- package/dist/commands/agent/start.d.ts +5 -1
- package/dist/commands/agent/start.d.ts.map +1 -1
- package/dist/commands/agent/start.js +19 -280
- package/dist/commands/agent/uninstall.d.ts.map +1 -1
- package/dist/commands/agent/uninstall.js +14 -7
- package/dist/commands/agent.d.ts.map +1 -1
- package/dist/commands/agent.js +3 -2
- package/dist/commands/ai/setup.d.ts +1 -1
- package/dist/commands/ai/setup.d.ts.map +1 -1
- package/dist/commands/ai.js +1 -1
- package/dist/commands/application/create-docker-compose.d.ts +3 -1
- package/dist/commands/application/create-docker-compose.d.ts.map +1 -1
- package/dist/commands/application/create-docker-compose.js +25 -69
- package/dist/commands/application/create-existing.d.ts +2 -2
- package/dist/commands/application/create-existing.d.ts.map +1 -1
- package/dist/commands/application/create-existing.js +27 -132
- package/dist/commands/application/create-managed-process.d.ts +3 -1
- package/dist/commands/application/create-managed-process.d.ts.map +1 -1
- package/dist/commands/application/create-managed-process.js +31 -75
- package/dist/commands/application/delete.d.ts +2 -1
- package/dist/commands/application/delete.d.ts.map +1 -1
- package/dist/commands/application/delete.js +19 -5
- package/dist/commands/application/update.d.ts +3 -0
- package/dist/commands/application/update.d.ts.map +1 -1
- package/dist/commands/application/update.js +45 -1
- package/dist/commands/application.d.ts.map +1 -1
- package/dist/commands/application.js +33 -19
- package/dist/commands/auth.d.ts.map +1 -1
- package/dist/commands/auth.js +44 -0
- package/dist/commands/debug.js +1 -1
- package/dist/commands/device/application-health.d.ts +7 -0
- package/dist/commands/device/application-health.d.ts.map +1 -0
- package/dist/commands/device/application-health.js +103 -0
- package/dist/commands/device/delete.d.ts +7 -0
- package/dist/commands/device/delete.d.ts.map +1 -0
- package/dist/commands/device/delete.js +69 -0
- package/dist/commands/device/health.d.ts +7 -0
- package/dist/commands/device/health.d.ts.map +1 -0
- package/dist/commands/device/health.js +78 -0
- package/dist/commands/device/list.d.ts +5 -0
- package/dist/commands/device/list.d.ts.map +1 -0
- package/dist/commands/device/list.js +46 -0
- package/dist/commands/device/telemetry.d.ts +8 -0
- package/dist/commands/device/telemetry.d.ts.map +1 -0
- package/dist/commands/device/telemetry.js +59 -0
- package/dist/commands/device.d.ts +6 -0
- package/dist/commands/device.d.ts.map +1 -0
- package/dist/commands/device.js +86 -0
- package/dist/commands/stack/deploy.d.ts +3 -1
- package/dist/commands/stack/deploy.d.ts.map +1 -1
- package/dist/commands/stack/deploy.js +5 -2
- package/dist/commands/stack/diff.d.ts +1 -1
- package/dist/commands/stack/diff.d.ts.map +1 -1
- package/dist/commands/stack/diff.js +4 -2
- package/dist/commands/stack/status.d.ts +1 -1
- package/dist/commands/stack/status.d.ts.map +1 -1
- package/dist/commands/stack/status.js +4 -2
- package/dist/commands/stack/teardown.d.ts +3 -1
- package/dist/commands/stack/teardown.d.ts.map +1 -1
- package/dist/commands/stack/teardown.js +5 -2
- package/dist/commands/stack/validate.d.ts +1 -1
- package/dist/commands/stack/validate.d.ts.map +1 -1
- package/dist/commands/stack/validate.js +4 -2
- package/dist/commands/stack.d.ts.map +1 -1
- package/dist/commands/stack.js +10 -5
- package/dist/commands/utils/auth-prompt.d.ts +25 -0
- package/dist/commands/utils/auth-prompt.d.ts.map +1 -0
- package/dist/commands/utils/auth-prompt.js +115 -0
- package/dist/commands/utils/device-prompt.d.ts +18 -0
- package/dist/commands/utils/device-prompt.d.ts.map +1 -0
- package/dist/commands/utils/device-prompt.js +58 -0
- package/dist/commands/utils/output-formatter.d.ts +13 -0
- package/dist/commands/utils/output-formatter.d.ts.map +1 -1
- package/dist/commands/utils/output-formatter.js +21 -0
- package/dist/index.js +2 -0
- package/dist/services/LocalAgentManager.d.ts +2 -1
- package/dist/services/LocalAgentManager.d.ts.map +1 -1
- package/dist/services/LocalAgentManager.js +6 -4
- package/dist/services/application/ApplicationService.d.ts +19 -0
- package/dist/services/application/ApplicationService.d.ts.map +1 -1
- package/dist/services/application/ApplicationService.js +14 -1
- package/dist/services/device/DeviceService.d.ts +62 -0
- package/dist/services/device/DeviceService.d.ts.map +1 -0
- package/dist/services/device/DeviceService.js +235 -0
- package/dist/services/edgible.d.ts +3 -1
- package/dist/services/edgible.d.ts.map +1 -1
- package/dist/services/edgible.js +5 -4
- package/dist/services/instances.d.ts +4 -1
- package/dist/services/instances.d.ts.map +1 -1
- package/dist/services/instances.js +8 -4
- package/dist/types/AgentConfig.d.ts +26 -0
- package/dist/types/AgentConfig.d.ts.map +1 -1
- package/dist/types/ApiRequests.d.ts +5 -1
- package/dist/types/ApiRequests.d.ts.map +1 -1
- package/dist/types/ApiResponses.d.ts +5 -0
- package/dist/types/ApiResponses.d.ts.map +1 -1
- package/dist/types/JobTypes.d.ts +103 -0
- package/dist/types/JobTypes.d.ts.map +1 -0
- package/dist/types/JobTypes.js +80 -0
- package/dist/types/WebSocketMessages.d.ts +89 -0
- package/dist/types/WebSocketMessages.d.ts.map +1 -0
- package/dist/types/WebSocketMessages.js +5 -0
- package/dist/types/backendJobs.d.ts +102 -0
- package/dist/types/backendJobs.d.ts.map +1 -0
- package/dist/types/backendJobs.js +5 -0
- package/dist/types/models/ApplicationData.d.ts +1 -1
- package/dist/types/models/ApplicationData.d.ts.map +1 -1
- package/dist/types/models/DeviceData.d.ts +4 -0
- package/dist/types/models/DeviceData.d.ts.map +1 -1
- package/dist/types/validation/schemas.d.ts +3 -3
- package/dist/types/validation/schemas.js +1 -1
- package/dist/utils/stack-file.d.ts +11 -0
- package/dist/utils/stack-file.d.ts.map +1 -0
- package/dist/utils/stack-file.js +66 -0
- package/package.json +1 -1
- package/dist/commands/agent/agent-handlers.d.ts +0 -45
- package/dist/commands/agent/agent-handlers.d.ts.map +0 -1
- package/dist/commands/agent/agent-handlers.js +0 -1159
- package/dist/commands/application/api-keys.d.ts +0 -3
- package/dist/commands/application/api-keys.d.ts.map +0 -1
- package/dist/commands/application/api-keys.js +0 -227
- package/dist/commands/application/create-compose.d.ts +0 -3
- package/dist/commands/application/create-compose.d.ts.map +0 -1
- package/dist/commands/application/create-compose.js +0 -381
- package/dist/commands/application/create-interactive.d.ts +0 -3
- package/dist/commands/application/create-interactive.d.ts.map +0 -1
- package/dist/commands/application/create-interactive.js +0 -326
- package/dist/commands/application/create-workload.d.ts +0 -5
- package/dist/commands/application/create-workload.d.ts.map +0 -1
- package/dist/commands/application/create-workload.js +0 -48
- package/dist/commands/application/short-codes.d.ts +0 -3
- package/dist/commands/application/short-codes.d.ts.map +0 -1
- package/dist/commands/application/short-codes.js +0 -226
- package/dist/commands/application/toggle.d.ts +0 -2
- package/dist/commands/application/toggle.d.ts.map +0 -1
- package/dist/commands/application/toggle.js +0 -78
- package/dist/commands/examples/migrated-command-example.d.ts +0 -31
- package/dist/commands/examples/migrated-command-example.d.ts.map +0 -1
- package/dist/commands/examples/migrated-command-example.js +0 -180
- package/dist/commands/managedGateway/create.d.ts +0 -6
- package/dist/commands/managedGateway/create.d.ts.map +0 -1
- package/dist/commands/managedGateway/create.js +0 -50
- package/dist/commands/managedGateway/delete.d.ts +0 -5
- package/dist/commands/managedGateway/delete.d.ts.map +0 -1
- package/dist/commands/managedGateway/delete.js +0 -57
- package/dist/commands/managedGateway/get.d.ts +0 -4
- package/dist/commands/managedGateway/get.d.ts.map +0 -1
- package/dist/commands/managedGateway/get.js +0 -71
- package/dist/commands/managedGateway/haproxy-stats.d.ts +0 -6
- package/dist/commands/managedGateway/haproxy-stats.d.ts.map +0 -1
- package/dist/commands/managedGateway/haproxy-stats.js +0 -131
- package/dist/commands/managedGateway/list.d.ts +0 -4
- package/dist/commands/managedGateway/list.d.ts.map +0 -1
- package/dist/commands/managedGateway/list.js +0 -50
- package/dist/commands/managedGateway/logs.d.ts +0 -10
- package/dist/commands/managedGateway/logs.d.ts.map +0 -1
- package/dist/commands/managedGateway/logs.js +0 -100
- package/dist/commands/managedGateway/reboot.d.ts +0 -5
- package/dist/commands/managedGateway/reboot.d.ts.map +0 -1
- package/dist/commands/managedGateway/reboot.js +0 -95
- package/dist/commands/managedGateway/resync.d.ts +0 -10
- package/dist/commands/managedGateway/resync.d.ts.map +0 -1
- package/dist/commands/managedGateway/resync.js +0 -69
- package/dist/commands/managedGateway/ssh.d.ts +0 -4
- package/dist/commands/managedGateway/ssh.d.ts.map +0 -1
- package/dist/commands/managedGateway/ssh.js +0 -130
- package/dist/commands/managedGateway/wipe-logs.d.ts +0 -4
- package/dist/commands/managedGateway/wipe-logs.d.ts.map +0 -1
- package/dist/commands/managedGateway/wipe-logs.js +0 -67
- package/dist/commands/managedGateway/wireguard.d.ts +0 -4
- package/dist/commands/managedGateway/wireguard.d.ts.map +0 -1
- package/dist/commands/managedGateway/wireguard.js +0 -68
- package/dist/di/bindings.d.ts +0 -15
- package/dist/di/bindings.d.ts.map +0 -1
- package/dist/di/bindings.js +0 -99
- package/dist/di/container.d.ts +0 -44
- package/dist/di/container.d.ts.map +0 -1
- package/dist/di/container.js +0 -88
- package/dist/di/types.d.ts +0 -23
- package/dist/di/types.d.ts.map +0 -1
- package/dist/di/types.js +0 -32
- package/dist/repositories/config-repository.d.ts +0 -46
- package/dist/repositories/config-repository.d.ts.map +0 -1
- package/dist/repositories/config-repository.js +0 -62
- package/dist/repositories/gateway-repository.d.ts +0 -37
- package/dist/repositories/gateway-repository.d.ts.map +0 -1
- package/dist/repositories/gateway-repository.js +0 -35
|
@@ -9,14 +9,16 @@ const chalk_1 = __importDefault(require("chalk"));
|
|
|
9
9
|
const instances_1 = require("../../services/instances");
|
|
10
10
|
const config_validator_1 = require("../utils/config-validator");
|
|
11
11
|
const input_parser_1 = require("../utils/input-parser");
|
|
12
|
+
const auth_prompt_1 = require("../utils/auth-prompt");
|
|
12
13
|
async function handleApplicationCreateManagedProcess(options) {
|
|
13
14
|
(0, config_validator_1.validateConfig)(instances_1.configManager, {
|
|
14
15
|
requireAuth: true,
|
|
15
16
|
requireOrganization: true,
|
|
16
17
|
});
|
|
18
|
+
const isInteractive = options.nonInteractive !== true;
|
|
17
19
|
// Application name
|
|
18
20
|
let appName = options.name;
|
|
19
|
-
if (!appName &&
|
|
21
|
+
if (!appName && isInteractive) {
|
|
20
22
|
const { name } = await inquirer_1.default.prompt([
|
|
21
23
|
{
|
|
22
24
|
type: 'input',
|
|
@@ -32,7 +34,7 @@ async function handleApplicationCreateManagedProcess(options) {
|
|
|
32
34
|
}
|
|
33
35
|
// Command
|
|
34
36
|
let command = options.command;
|
|
35
|
-
if (!command &&
|
|
37
|
+
if (!command && isInteractive) {
|
|
36
38
|
const { cmd } = await inquirer_1.default.prompt([
|
|
37
39
|
{
|
|
38
40
|
type: 'input',
|
|
@@ -48,7 +50,7 @@ async function handleApplicationCreateManagedProcess(options) {
|
|
|
48
50
|
}
|
|
49
51
|
// Port
|
|
50
52
|
let port = options.port ? (0, input_parser_1.parsePort)(options.port) : undefined;
|
|
51
|
-
if (!port &&
|
|
53
|
+
if (!port && isInteractive) {
|
|
52
54
|
const { portInput } = await inquirer_1.default.prompt([
|
|
53
55
|
{
|
|
54
56
|
type: 'input',
|
|
@@ -68,7 +70,7 @@ async function handleApplicationCreateManagedProcess(options) {
|
|
|
68
70
|
}
|
|
69
71
|
// Working directory
|
|
70
72
|
let workingDirectory = options.workingDir;
|
|
71
|
-
if (!workingDirectory &&
|
|
73
|
+
if (!workingDirectory && isInteractive) {
|
|
72
74
|
const { dir } = await inquirer_1.default.prompt([
|
|
73
75
|
{
|
|
74
76
|
type: 'input',
|
|
@@ -91,7 +93,7 @@ async function handleApplicationCreateManagedProcess(options) {
|
|
|
91
93
|
}
|
|
92
94
|
}
|
|
93
95
|
}
|
|
94
|
-
else if (
|
|
96
|
+
else if (isInteractive) {
|
|
95
97
|
const { addEnv } = await inquirer_1.default.prompt([
|
|
96
98
|
{
|
|
97
99
|
type: 'confirm',
|
|
@@ -132,7 +134,7 @@ async function handleApplicationCreateManagedProcess(options) {
|
|
|
132
134
|
}
|
|
133
135
|
// Log file
|
|
134
136
|
let logFile = options.logFile;
|
|
135
|
-
if (!logFile &&
|
|
137
|
+
if (!logFile && isInteractive) {
|
|
136
138
|
const { addLog } = await inquirer_1.default.prompt([
|
|
137
139
|
{
|
|
138
140
|
type: 'confirm',
|
|
@@ -155,18 +157,28 @@ async function handleApplicationCreateManagedProcess(options) {
|
|
|
155
157
|
}
|
|
156
158
|
// Description
|
|
157
159
|
const description = options.description || `Managed process application for ${appName}`;
|
|
158
|
-
// Protocol
|
|
159
|
-
const protocol = (0, input_parser_1.parseProtocol)(options.protocol);
|
|
160
|
-
// Device IDs and Gateway IDs
|
|
160
|
+
// Protocol: default HTTPS for HTTP(S) apps
|
|
161
|
+
const protocol = options.protocol ? (0, input_parser_1.parseProtocol)(options.protocol) : 'https';
|
|
162
|
+
// Device IDs and Gateway IDs. If --gateway-ids provided, use own gateways; else Edgible managed (default).
|
|
161
163
|
let deviceId = options.deviceId;
|
|
162
164
|
let gatewayIds = (0, input_parser_1.parseGatewayIds)(options.gatewayIds);
|
|
165
|
+
const useManagedGateway = gatewayIds.length === 0;
|
|
163
166
|
let hostnames = Array.isArray(options.hostnames)
|
|
164
167
|
? options.hostnames
|
|
165
168
|
: (typeof options.hostnames === 'string' && options.hostnames.trim().length > 0
|
|
166
169
|
? options.hostnames.split(',').map(s => s.trim()).filter(Boolean)
|
|
167
170
|
: []);
|
|
168
|
-
|
|
169
|
-
|
|
171
|
+
// Auth: use authModes (none | org | api-key | org+api-key)
|
|
172
|
+
const authModesFromFlag = (0, auth_prompt_1.parseAuthModes)(options.authModes);
|
|
173
|
+
const allowedOrgsFromFlag = options.allowedOrgs
|
|
174
|
+
? options.allowedOrgs.split(',').map(s => s.trim()).filter(Boolean)
|
|
175
|
+
: [];
|
|
176
|
+
const { authModes, allowedOrganizations } = await (0, auth_prompt_1.promptAuthModes)({
|
|
177
|
+
authModesFromFlag: authModesFromFlag ?? undefined,
|
|
178
|
+
allowedOrgsFromFlag: allowedOrgsFromFlag.length > 0 ? allowedOrgsFromFlag : undefined,
|
|
179
|
+
nonInteractive: !isInteractive,
|
|
180
|
+
});
|
|
181
|
+
if (isInteractive) {
|
|
170
182
|
// Optional: prompt for additional hostnames
|
|
171
183
|
const { addHostnames } = await inquirer_1.default.prompt([
|
|
172
184
|
{
|
|
@@ -179,70 +191,6 @@ async function handleApplicationCreateManagedProcess(options) {
|
|
|
179
191
|
if (addHostnames && typeof addHostnames === 'string') {
|
|
180
192
|
hostnames = addHostnames.split(',').map((s) => s.trim()).filter((s) => s.length > 0);
|
|
181
193
|
}
|
|
182
|
-
// Prompt for managed gateway option
|
|
183
|
-
if (gatewayIds.length === 0) {
|
|
184
|
-
const { useManaged } = await inquirer_1.default.prompt([
|
|
185
|
-
{
|
|
186
|
-
type: 'confirm',
|
|
187
|
-
name: 'useManaged',
|
|
188
|
-
message: 'Use Edgible managed gateway?',
|
|
189
|
-
default: false,
|
|
190
|
-
},
|
|
191
|
-
]);
|
|
192
|
-
useManagedGateway = useManaged;
|
|
193
|
-
if (!useManagedGateway) {
|
|
194
|
-
// Ask if they want to assign a gateway at all
|
|
195
|
-
const { assignGateway } = await inquirer_1.default.prompt([
|
|
196
|
-
{
|
|
197
|
-
type: 'confirm',
|
|
198
|
-
name: 'assignGateway',
|
|
199
|
-
message: 'Assign a gateway to this application? (No = local/internal access only)',
|
|
200
|
-
default: true,
|
|
201
|
-
},
|
|
202
|
-
]);
|
|
203
|
-
if (assignGateway) {
|
|
204
|
-
// Try to offer a list of gateways (via service), else fallback to manual input
|
|
205
|
-
try {
|
|
206
|
-
const gatewaysResp = await instances_1.gatewayService.listGateways();
|
|
207
|
-
const gatewayChoices = gatewaysResp.gateways.map((g) => ({
|
|
208
|
-
name: `${g.device.name} (${g.device.id})`,
|
|
209
|
-
value: g.device.id,
|
|
210
|
-
}));
|
|
211
|
-
if (gatewayChoices.length > 0) {
|
|
212
|
-
const { selectedGateways } = await inquirer_1.default.prompt([
|
|
213
|
-
{
|
|
214
|
-
type: 'checkbox',
|
|
215
|
-
name: 'selectedGateways',
|
|
216
|
-
message: 'Select gateway device(s):',
|
|
217
|
-
choices: gatewayChoices,
|
|
218
|
-
validate: (vals) => vals.length > 0 ? true : 'Select at least one gateway',
|
|
219
|
-
},
|
|
220
|
-
]);
|
|
221
|
-
gatewayIds = selectedGateways;
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
catch (error) {
|
|
225
|
-
instances_1.logger.warn('Failed to list gateways', error);
|
|
226
|
-
}
|
|
227
|
-
if (gatewayIds.length === 0) {
|
|
228
|
-
const ans2 = await inquirer_1.default.prompt([
|
|
229
|
-
{
|
|
230
|
-
type: 'input',
|
|
231
|
-
name: 'gatewayIds',
|
|
232
|
-
message: 'Enter comma-separated gateway device IDs (or leave empty for no gateway):',
|
|
233
|
-
validate: (v) => true, // Allow empty input
|
|
234
|
-
},
|
|
235
|
-
]);
|
|
236
|
-
if (ans2.gatewayIds && ans2.gatewayIds.trim()) {
|
|
237
|
-
gatewayIds = (0, input_parser_1.parseGatewayIds)(ans2.gatewayIds);
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
else {
|
|
242
|
-
instances_1.logger.info('Application will be created without gateway assignment (local/internal access only)');
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
194
|
// Serving device selection
|
|
247
195
|
if (!deviceId) {
|
|
248
196
|
try {
|
|
@@ -344,6 +292,12 @@ async function handleApplicationCreateManagedProcess(options) {
|
|
|
344
292
|
if (hostnames.length > 0) {
|
|
345
293
|
console.log(chalk_1.default.gray(`Additional hostnames: ${hostnames.join(', ')}`));
|
|
346
294
|
}
|
|
295
|
+
if (authModes.length > 0 && !authModes.every((m) => m === 'none')) {
|
|
296
|
+
console.log(chalk_1.default.gray(`Auth modes: ${authModes.join(', ')}`));
|
|
297
|
+
if (allowedOrganizations && allowedOrganizations.length > 0) {
|
|
298
|
+
console.log(chalk_1.default.gray(`Allowed organizations: ${allowedOrganizations.join(', ')}`));
|
|
299
|
+
}
|
|
300
|
+
}
|
|
347
301
|
const result = await instances_1.applicationService.createApplicationProgrammatically({
|
|
348
302
|
name: appName,
|
|
349
303
|
description,
|
|
@@ -355,6 +309,8 @@ async function handleApplicationCreateManagedProcess(options) {
|
|
|
355
309
|
useManagedGateway,
|
|
356
310
|
subtype: 'managed-process',
|
|
357
311
|
configuration,
|
|
312
|
+
authModes,
|
|
313
|
+
allowedOrganizations: allowedOrganizations && allowedOrganizations.length > 0 ? allowedOrganizations : undefined,
|
|
358
314
|
});
|
|
359
315
|
console.log(chalk_1.default.green('\n✓ Managed process application created successfully!'));
|
|
360
316
|
console.log(chalk_1.default.blue('\n📋 Application Details:'));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"delete.d.ts","sourceRoot":"","sources":["../../../src/commands/application/delete.ts"],"names":[],"mappings":"AAOA,wBAAsB,uBAAuB,CAAC,OAAO,EAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,OAAO,CAAC;IAAC,
|
|
1
|
+
{"version":3,"file":"delete.d.ts","sourceRoot":"","sources":["../../../src/commands/application/delete.ts"],"names":[],"mappings":"AAOA,wBAAsB,uBAAuB,CAAC,OAAO,EAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,OAAO,CAAC;IAAC,cAAc,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAuElJ"}
|
|
@@ -14,15 +14,29 @@ async function handleApplicationDelete(options) {
|
|
|
14
14
|
requireAuth: true,
|
|
15
15
|
requireOrganization: true,
|
|
16
16
|
});
|
|
17
|
+
let appId = options.appId ?? null;
|
|
18
|
+
// Resolve --name to app ID if provided
|
|
19
|
+
if (!appId && options.name) {
|
|
20
|
+
const applications = await instances_1.applicationService.getApplications();
|
|
21
|
+
const matches = applications.filter((app) => app.name === options.name);
|
|
22
|
+
if (matches.length === 0) {
|
|
23
|
+
throw new Error(`No application found with name "${options.name}". Use "edgible application list" to see names.`);
|
|
24
|
+
}
|
|
25
|
+
if (matches.length > 1) {
|
|
26
|
+
throw new Error(`Multiple applications found with name "${options.name}". Use --app-id <id> to specify which to delete.`);
|
|
27
|
+
}
|
|
28
|
+
appId = matches[0].id;
|
|
29
|
+
instances_1.logger.debug('Resolved application name to ID', { name: options.name, appId });
|
|
30
|
+
}
|
|
17
31
|
// Interactive mode: prompt for application if not provided
|
|
18
|
-
|
|
19
|
-
|
|
32
|
+
if (!appId && options.nonInteractive !== true) {
|
|
33
|
+
appId = await (0, application_prompt_1.getApplicationId)(instances_1.applicationService, undefined, {
|
|
20
34
|
message: 'Select application to delete:',
|
|
21
35
|
required: true,
|
|
22
|
-
})
|
|
23
|
-
|
|
36
|
+
});
|
|
37
|
+
}
|
|
24
38
|
if (!appId) {
|
|
25
|
-
throw new Error('--app-id is required in non-interactive mode. Usage: edgible application delete --app-id <id>');
|
|
39
|
+
throw new Error('Either --app-id or --name is required in non-interactive mode. Usage: edgible application delete --app-id <id> or edgible application delete --name <name>');
|
|
26
40
|
}
|
|
27
41
|
instances_1.logger.debug('Deleting application', { appId });
|
|
28
42
|
// Get application details for confirmation
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../../src/commands/application/update.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../../src/commands/application/update.ts"],"names":[],"mappings":"AAMA,wBAAsB,uBAAuB,CAAC,OAAO,EAAE;IACrD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,GAAG,OAAO,CAAC,IAAI,CAAC,CAsDhB"}
|
|
@@ -5,7 +5,51 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.handleApplicationUpdate = handleApplicationUpdate;
|
|
7
7
|
const chalk_1 = __importDefault(require("chalk"));
|
|
8
|
+
const instances_1 = require("../../services/instances");
|
|
9
|
+
const config_validator_1 = require("../utils/config-validator");
|
|
10
|
+
const application_prompt_1 = require("../utils/application-prompt");
|
|
11
|
+
const auth_prompt_1 = require("../utils/auth-prompt");
|
|
8
12
|
async function handleApplicationUpdate(options) {
|
|
9
|
-
|
|
13
|
+
(0, config_validator_1.validateConfig)(instances_1.configManager, {
|
|
14
|
+
requireAuth: true,
|
|
15
|
+
requireOrganization: true,
|
|
16
|
+
});
|
|
17
|
+
const appId = await (0, application_prompt_1.getApplicationId)(instances_1.applicationService, options.appId, {
|
|
18
|
+
message: 'Select application to update:',
|
|
19
|
+
required: true,
|
|
20
|
+
});
|
|
21
|
+
if (!appId) {
|
|
22
|
+
throw new Error('Application ID is required');
|
|
23
|
+
}
|
|
24
|
+
const updates = {};
|
|
25
|
+
if (options.name !== undefined && options.name.trim().length > 0) {
|
|
26
|
+
updates.name = options.name.trim();
|
|
27
|
+
}
|
|
28
|
+
if (options.authModes !== undefined && options.authModes.trim().length > 0) {
|
|
29
|
+
const parsed = (0, auth_prompt_1.parseAuthModes)(options.authModes.trim());
|
|
30
|
+
if (parsed && parsed.length > 0) {
|
|
31
|
+
updates.authModes = parsed;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
if (options.allowedOrgs !== undefined && options.allowedOrgs.trim().length > 0) {
|
|
35
|
+
updates.allowedOrganizations = options.allowedOrgs
|
|
36
|
+
.split(',')
|
|
37
|
+
.map((s) => s.trim())
|
|
38
|
+
.filter(Boolean);
|
|
39
|
+
}
|
|
40
|
+
if (Object.keys(updates).length === 0) {
|
|
41
|
+
console.log(chalk_1.default.yellow('No updates specified. Use --name, --auth-modes, or --allowed-orgs.'));
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
instances_1.logger.debug('Updating application', { appId, updates });
|
|
45
|
+
await instances_1.applicationService.updateApplication(appId, updates);
|
|
46
|
+
console.log(chalk_1.default.green('✓ Application updated successfully.'));
|
|
47
|
+
if (updates.name)
|
|
48
|
+
console.log(chalk_1.default.gray(` Name: ${updates.name}`));
|
|
49
|
+
if (updates.authModes)
|
|
50
|
+
console.log(chalk_1.default.gray(` Auth modes: ${updates.authModes.join(', ')}`));
|
|
51
|
+
if (updates.allowedOrganizations && updates.allowedOrganizations.length > 0) {
|
|
52
|
+
console.log(chalk_1.default.gray(` Allowed organizations: ${updates.allowedOrganizations.join(', ')}`));
|
|
53
|
+
}
|
|
10
54
|
}
|
|
11
55
|
//# sourceMappingURL=update.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"application.d.ts","sourceRoot":"","sources":["../../src/commands/application.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAkBpC;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"application.d.ts","sourceRoot":"","sources":["../../src/commands/application.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAkBpC;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CA+Z/D"}
|
|
@@ -47,20 +47,22 @@ function setupApplicationCommands(program) {
|
|
|
47
47
|
.description('Create application for an existing port that is open on the computer')
|
|
48
48
|
.addHelpText('after', `
|
|
49
49
|
Examples:
|
|
50
|
-
$ edgible application create existing --name myapp --port 3000 --device-id <serving-device>
|
|
51
|
-
$ edgible application create existing --name myapp --port 8080 --
|
|
52
|
-
$ edgible application create existing --name myapp --port 3000 --
|
|
53
|
-
$ edgible application create existing --
|
|
50
|
+
$ edgible application create existing --name myapp --port 3000 --device-id <serving-device>
|
|
51
|
+
$ edgible application create existing --name myapp --port 8080 --device-id <serving-device> --gateway-ids <gw1,gw2>
|
|
52
|
+
$ edgible application create existing --name myapp --port 3000 --auth-modes org,api-key --device-id <serving-device>
|
|
53
|
+
$ edgible application create existing --non-interactive --name myapp --port 3000 --device-id <serving-device>
|
|
54
54
|
`)
|
|
55
55
|
.option('-n, --name <name>', 'Application name')
|
|
56
56
|
.option('-d, --description <description>', 'Application description')
|
|
57
57
|
.option('-p, --port <port>', 'Port number', '3000')
|
|
58
|
-
.option('--protocol <protocol>', 'Protocol (http, https, tcp, udp)', '
|
|
58
|
+
.option('--protocol <protocol>', 'Protocol (http, https, tcp, udp)', 'https')
|
|
59
59
|
.option('--https-upgrade', 'Upgrade HTTP protocol to HTTPS automatically')
|
|
60
60
|
.option('--device-id <id>', 'Serving device ID')
|
|
61
|
-
.option('--gateway-ids <ids>', 'Comma-separated gateway device IDs')
|
|
61
|
+
.option('--gateway-ids <ids>', 'Comma-separated gateway device IDs (omit to use Edgible managed gateway)')
|
|
62
62
|
.option('--hostnames <hostnames>', 'Comma-separated additional hostnames to route to this app')
|
|
63
|
-
.option('--
|
|
63
|
+
.option('--auth-modes <modes>', 'Auth modes: none, org, api-key (comma-separated for multiple)')
|
|
64
|
+
.option('--allowed-orgs <ids>', 'Comma-separated organization IDs allowed (when org auth is used)')
|
|
65
|
+
.option('--non-interactive', 'Run in non-interactive mode')
|
|
64
66
|
.action((0, command_wrapper_1.wrapCommand)(async (options) => {
|
|
65
67
|
await (0, create_existing_1.handleApplicationCreateExisting)(options);
|
|
66
68
|
}, {
|
|
@@ -73,16 +75,18 @@ Examples:
|
|
|
73
75
|
.addHelpText('after', `
|
|
74
76
|
Examples:
|
|
75
77
|
$ edgible application create docker-compose --name myapp --compose-file ./docker-compose.yml
|
|
76
|
-
$ edgible application create docker-compose --name myapp
|
|
77
|
-
$ edgible application create docker-compose --
|
|
78
|
+
$ edgible application create docker-compose --name myapp --auth-modes org --device-id <serving-device>
|
|
79
|
+
$ edgible application create docker-compose --non-interactive --name myapp --compose-file ./docker-compose.yml --device-id <serving-device>
|
|
78
80
|
`)
|
|
79
81
|
.option('-n, --name <name>', 'Application name')
|
|
80
82
|
.option('-d, --description <description>', 'Application description')
|
|
81
83
|
.option('--compose-file <file>', 'Path to docker-compose.yml file')
|
|
82
84
|
.option('--device-id <id>', 'Serving device ID')
|
|
83
|
-
.option('--gateway-ids <ids>', 'Comma-separated gateway device IDs')
|
|
85
|
+
.option('--gateway-ids <ids>', 'Comma-separated gateway device IDs (omit to use Edgible managed gateway)')
|
|
84
86
|
.option('--hostnames <hostnames>', 'Comma-separated additional hostnames to route to this app')
|
|
85
|
-
.option('--
|
|
87
|
+
.option('--auth-modes <modes>', 'Auth modes: none, org, api-key (comma-separated for multiple)')
|
|
88
|
+
.option('--allowed-orgs <ids>', 'Comma-separated organization IDs allowed (when org auth is used)')
|
|
89
|
+
.option('--non-interactive', 'Run in non-interactive mode')
|
|
86
90
|
.action((0, command_wrapper_1.wrapCommand)(async (options) => {
|
|
87
91
|
await (0, create_docker_compose_1.handleApplicationCreateDockerCompose)(options);
|
|
88
92
|
}, {
|
|
@@ -96,7 +100,8 @@ Examples:
|
|
|
96
100
|
Examples:
|
|
97
101
|
$ edgible application create managed-process --name myapp --command "node server.js" --port 3000
|
|
98
102
|
$ edgible application create managed-process --name myapp --command "python app.py" --port 8080 --working-dir /opt/myapp
|
|
99
|
-
$ edgible application create managed-process --
|
|
103
|
+
$ edgible application create managed-process --name myapp --command "npm start" --port 3000 --auth-modes api-key
|
|
104
|
+
$ edgible application create managed-process --non-interactive --name myapp --command "npm start" --port 3000 --device-id <serving-device>
|
|
100
105
|
`)
|
|
101
106
|
.option('-n, --name <name>', 'Application name')
|
|
102
107
|
.option('-d, --description <description>', 'Application description')
|
|
@@ -105,11 +110,13 @@ Examples:
|
|
|
105
110
|
.option('--working-dir <dir>', 'Working directory for the process')
|
|
106
111
|
.option('--env <vars>', 'Environment variables (format: KEY=VALUE,KEY2=VALUE2)')
|
|
107
112
|
.option('--log-file <path>', 'Path to log file for stdout/stderr')
|
|
108
|
-
.option('--protocol <protocol>', 'Protocol (http, https, tcp, udp)', '
|
|
113
|
+
.option('--protocol <protocol>', 'Protocol (http, https, tcp, udp)', 'https')
|
|
109
114
|
.option('--device-id <id>', 'Serving device ID')
|
|
110
|
-
.option('--gateway-ids <ids>', 'Comma-separated gateway device IDs')
|
|
115
|
+
.option('--gateway-ids <ids>', 'Comma-separated gateway device IDs (omit to use Edgible managed gateway)')
|
|
111
116
|
.option('--hostnames <hostnames>', 'Comma-separated additional hostnames')
|
|
112
|
-
.option('--
|
|
117
|
+
.option('--auth-modes <modes>', 'Auth modes: none, org, api-key (comma-separated for multiple)')
|
|
118
|
+
.option('--allowed-orgs <ids>', 'Comma-separated organization IDs allowed (when org auth is used)')
|
|
119
|
+
.option('--non-interactive', 'Run in non-interactive mode')
|
|
113
120
|
.action((0, command_wrapper_1.wrapCommand)(async (options) => {
|
|
114
121
|
await (0, create_managed_process_1.handleApplicationCreateManagedProcess)(options);
|
|
115
122
|
}, {
|
|
@@ -163,17 +170,24 @@ Examples:
|
|
|
163
170
|
}));
|
|
164
171
|
appCommand
|
|
165
172
|
.command('update')
|
|
166
|
-
.description('Update an existing application')
|
|
173
|
+
.description('Update an existing application (e.g. auth modes, name)')
|
|
167
174
|
.option('-i, --app-id <id>', 'Application ID')
|
|
168
|
-
.
|
|
175
|
+
.option('-n, --name <name>', 'Application name')
|
|
176
|
+
.option('--auth-modes <modes>', 'Auth modes: none, org, api-key (comma-separated for multiple)')
|
|
177
|
+
.option('--allowed-orgs <ids>', 'Comma-separated organization IDs allowed (when org auth is used)')
|
|
178
|
+
.action((0, command_wrapper_1.wrapCommand)(async (options) => {
|
|
169
179
|
await (0, update_1.handleApplicationUpdate)(options);
|
|
170
|
-
}
|
|
180
|
+
}, {
|
|
181
|
+
requireAuth: true,
|
|
182
|
+
requireOrganization: true,
|
|
183
|
+
}));
|
|
171
184
|
appCommand
|
|
172
185
|
.command('delete')
|
|
173
186
|
.description('Delete an application')
|
|
174
187
|
.option('-i, --app-id <id>', 'Application ID')
|
|
188
|
+
.option('-n, --name <name>', 'Application name (resolved to ID for deletion)')
|
|
175
189
|
.option('-f, --force', 'Skip confirmation prompt')
|
|
176
|
-
.option('--
|
|
190
|
+
.option('--non-interactive', 'Run in non-interactive mode')
|
|
177
191
|
.alias('rm')
|
|
178
192
|
.action((0, command_wrapper_1.wrapCommand)(async (options) => {
|
|
179
193
|
await (0, delete_1.handleApplicationDelete)(options);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/commands/auth.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAUpC,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/commands/auth.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAUpC,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAoNxD"}
|
package/dist/commands/auth.js
CHANGED
|
@@ -55,9 +55,12 @@ function setupAuthCommands(program) {
|
|
|
55
55
|
.addHelpText('after', `
|
|
56
56
|
Examples:
|
|
57
57
|
$ edgible auth login
|
|
58
|
+
$ edgible auth login --user-email user@example.com --user-password "YourPassword"
|
|
58
59
|
$ edgible auth login --device --device-name mydevice --email user@example.com
|
|
59
60
|
$ edgible auth login --device --device-name mydevice --email user@example.com --password "SecurePass123!"
|
|
60
61
|
`)
|
|
62
|
+
.option('--user-email <email>', 'User email for non-interactive user login')
|
|
63
|
+
.option('--user-password <password>', 'User password for non-interactive user login')
|
|
61
64
|
.option('--device', 'Login as a device')
|
|
62
65
|
.option('--device-name <name>', 'Device name (required for device login)')
|
|
63
66
|
.option('--device-type <type>', 'Device type: serving or gateway (default: serving)')
|
|
@@ -70,6 +73,11 @@ Examples:
|
|
|
70
73
|
await handleDeviceLogin(instances_1.configManager, instances_1.authService, savedEmail, isFirstRun, options, instances_1.logger);
|
|
71
74
|
return;
|
|
72
75
|
}
|
|
76
|
+
// Non-interactive user login when both email and password provided
|
|
77
|
+
if (options.userEmail && options.userPassword) {
|
|
78
|
+
await handleUserLoginNonInteractive(instances_1.configManager, instances_1.authService, options.userEmail.trim().toLowerCase(), options.userPassword, instances_1.logger);
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
73
81
|
// Interactive mode (existing logic)
|
|
74
82
|
if (isFirstRun) {
|
|
75
83
|
console.log(chalk_1.default.blue.bold('\n🎉 Welcome to Edgible CLI!'));
|
|
@@ -195,6 +203,42 @@ Examples:
|
|
|
195
203
|
}
|
|
196
204
|
}));
|
|
197
205
|
}
|
|
206
|
+
async function handleUserLoginNonInteractive(configManager, authService, email, password, logger) {
|
|
207
|
+
if (!email.trim()) {
|
|
208
|
+
throw new Error('User email is required');
|
|
209
|
+
}
|
|
210
|
+
if (!(0, validation_1.validateEmail)(email)) {
|
|
211
|
+
throw new Error('Please provide a valid email address');
|
|
212
|
+
}
|
|
213
|
+
if (!password || !password.trim()) {
|
|
214
|
+
throw new Error('User password is required');
|
|
215
|
+
}
|
|
216
|
+
configManager.setEmail(email);
|
|
217
|
+
logger.info('Attempting user login (non-interactive)', { email });
|
|
218
|
+
await authService.loginUser(email, password);
|
|
219
|
+
console.log(chalk_1.default.green('✓ Login successful!'));
|
|
220
|
+
console.log(chalk_1.default.gray(`Welcome back, ${email}`));
|
|
221
|
+
try {
|
|
222
|
+
const userOrgs = await authService.getUserOrganizations(email);
|
|
223
|
+
const standardOrgs = userOrgs.organizations.filter((org) => org.organizationType !== 'billing');
|
|
224
|
+
if (standardOrgs.length > 0) {
|
|
225
|
+
configManager.updateConfig({ organizationId: standardOrgs[0].organizationId });
|
|
226
|
+
logger.info('Organization selected', { organizationId: standardOrgs[0].organizationId });
|
|
227
|
+
console.log(chalk_1.default.gray(`Using organization: ${standardOrgs[0].name}`));
|
|
228
|
+
}
|
|
229
|
+
else {
|
|
230
|
+
logger.warn('No standard organizations found for user', { email });
|
|
231
|
+
console.log(chalk_1.default.yellow('⚠ No standard organizations found for this user'));
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
catch (orgError) {
|
|
235
|
+
logger.warn('Could not fetch organizations', orgError);
|
|
236
|
+
console.log(chalk_1.default.yellow('⚠ Could not fetch organizations, but login was successful'));
|
|
237
|
+
}
|
|
238
|
+
configManager.setAccountStatus(true);
|
|
239
|
+
configManager.setFirstRunComplete();
|
|
240
|
+
console.log(chalk_1.default.gray('Use "edgible --help" to see available commands.'));
|
|
241
|
+
}
|
|
198
242
|
async function handleUserLogin(configManager, authService, savedEmail, isFirstRun, logger) {
|
|
199
243
|
// Check if we have a saved email
|
|
200
244
|
let email;
|
package/dist/commands/debug.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"application-health.d.ts","sourceRoot":"","sources":["../../../src/commands/device/application-health.ts"],"names":[],"mappings":"AAyEA,wBAAsB,6BAA6B,CAAC,OAAO,EAAE;IAC3D,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B,GAAG,OAAO,CAAC,IAAI,CAAC,CAwChB"}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.handleDeviceApplicationHealth = handleDeviceApplicationHealth;
|
|
7
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
8
|
+
const instances_1 = require("../../services/instances");
|
|
9
|
+
const config_validator_1 = require("../utils/config-validator");
|
|
10
|
+
const device_prompt_1 = require("../utils/device-prompt");
|
|
11
|
+
function statusColor(status) {
|
|
12
|
+
switch (status) {
|
|
13
|
+
case 'healthy':
|
|
14
|
+
return chalk_1.default.green;
|
|
15
|
+
case 'unhealthy':
|
|
16
|
+
case 'timeout':
|
|
17
|
+
case 'error':
|
|
18
|
+
return chalk_1.default.red;
|
|
19
|
+
case 'pending':
|
|
20
|
+
return chalk_1.default.yellow;
|
|
21
|
+
default:
|
|
22
|
+
return chalk_1.default.white;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
function prettyPrintApplicationHealth(deviceName, deviceId, payload) {
|
|
26
|
+
const apps = payload.applications ?? [];
|
|
27
|
+
console.log(chalk_1.default.bold(`Application health on device: ${deviceName} (${deviceId})`));
|
|
28
|
+
console.log(chalk_1.default.gray('—'));
|
|
29
|
+
if (apps.length === 0) {
|
|
30
|
+
console.log(chalk_1.default.gray(' No applications reported (or only telemetry app on this device).'));
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
for (const app of apps) {
|
|
34
|
+
const health = app.health;
|
|
35
|
+
const statusStr = health?.status ?? 'unknown';
|
|
36
|
+
const color = statusColor(statusStr);
|
|
37
|
+
const name = app.name || app.appId;
|
|
38
|
+
const subtype = app.subtype ? chalk_1.default.gray(` [${app.subtype}]`) : '';
|
|
39
|
+
console.log(chalk_1.default.bold(` ${name}${subtype}`));
|
|
40
|
+
console.log(color(` Health: ${statusStr}`));
|
|
41
|
+
if (health?.responseTime != null) {
|
|
42
|
+
console.log(chalk_1.default.gray(` Response time: ${health.responseTime}ms`));
|
|
43
|
+
}
|
|
44
|
+
if (health?.error) {
|
|
45
|
+
console.log(chalk_1.default.red(` Error: ${health.error}`));
|
|
46
|
+
}
|
|
47
|
+
if (app.workload) {
|
|
48
|
+
const w = app.workload;
|
|
49
|
+
const runStr = w.running ? chalk_1.default.green('running') : chalk_1.default.red('not running');
|
|
50
|
+
const healthyStr = w.healthy ? chalk_1.default.green('healthy') : chalk_1.default.red('unhealthy');
|
|
51
|
+
console.log(chalk_1.default.gray(` Workload: ${runStr}, ${healthyStr}`));
|
|
52
|
+
if (w.port != null)
|
|
53
|
+
console.log(chalk_1.default.gray(` Port: ${w.port}`));
|
|
54
|
+
if (w.error)
|
|
55
|
+
console.log(chalk_1.default.red(` Workload error: ${w.error}`));
|
|
56
|
+
}
|
|
57
|
+
if (app.deploymentState) {
|
|
58
|
+
console.log(chalk_1.default.gray(` Deployment: ${app.deploymentState}`));
|
|
59
|
+
}
|
|
60
|
+
if (app.url) {
|
|
61
|
+
console.log(chalk_1.default.gray(` URL: ${app.url}`));
|
|
62
|
+
}
|
|
63
|
+
console.log();
|
|
64
|
+
}
|
|
65
|
+
const healthyCount = apps.filter((a) => a.health?.status === 'healthy').length;
|
|
66
|
+
const total = apps.length;
|
|
67
|
+
if (total > 0) {
|
|
68
|
+
console.log(chalk_1.default.gray(`— ${healthyCount}/${total} applications healthy`));
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
async function handleDeviceApplicationHealth(options) {
|
|
72
|
+
(0, config_validator_1.validateConfig)(instances_1.configManager, {
|
|
73
|
+
requireAuth: true,
|
|
74
|
+
requireOrganization: true,
|
|
75
|
+
});
|
|
76
|
+
const isInteractive = options.nonInteractive !== true;
|
|
77
|
+
let deviceId = await instances_1.deviceService.resolveDeviceId({
|
|
78
|
+
deviceId: options.deviceId,
|
|
79
|
+
name: options.name,
|
|
80
|
+
interactive: isInteractive,
|
|
81
|
+
message: 'Select device to check application health:',
|
|
82
|
+
});
|
|
83
|
+
if (!deviceId && isInteractive) {
|
|
84
|
+
deviceId = await (0, device_prompt_1.getDeviceId)(instances_1.deviceService, undefined, {
|
|
85
|
+
message: 'Select device to check application health:',
|
|
86
|
+
required: true,
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
if (!deviceId) {
|
|
90
|
+
throw new Error('Device is required. Use --device-id <id>, --name <name>, or run interactively. Example: edgible device application-health --name my-laptop');
|
|
91
|
+
}
|
|
92
|
+
const device = await instances_1.deviceService.getDevice(deviceId);
|
|
93
|
+
if (!device) {
|
|
94
|
+
throw new Error(`Device not found: ${deviceId}`);
|
|
95
|
+
}
|
|
96
|
+
const payload = await instances_1.deviceService.getDeviceApplicationHealth(deviceId);
|
|
97
|
+
if (options.json) {
|
|
98
|
+
console.log(JSON.stringify(payload, null, 2));
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
prettyPrintApplicationHealth(device.name ?? deviceId, deviceId, payload);
|
|
102
|
+
}
|
|
103
|
+
//# sourceMappingURL=application-health.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delete.d.ts","sourceRoot":"","sources":["../../../src/commands/device/delete.ts"],"names":[],"mappings":"AAMA,wBAAsB,kBAAkB,CAAC,OAAO,EAAE;IAChD,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B,GAAG,OAAO,CAAC,IAAI,CAAC,CAuEhB"}
|