@elf5/periscope 1.0.65 → 1.0.70
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/dist/cli.js +34 -40
- package/dist/cli.js.map +2 -2
- package/dist/commands/base-command.d.ts.map +1 -1
- package/dist/commands/config.d.ts.map +1 -1
- package/dist/index.js +34 -40
- package/dist/index.js.map +2 -2
- package/dist/lib/config-manager.d.ts +1 -0
- package/dist/lib/config-manager.d.ts.map +1 -1
- package/package.json +9 -11
package/dist/cli.js
CHANGED
|
@@ -175,7 +175,7 @@ var init_package = __esm({
|
|
|
175
175
|
"package.json"() {
|
|
176
176
|
package_default = {
|
|
177
177
|
name: "@elf5/periscope",
|
|
178
|
-
version: "1.0.
|
|
178
|
+
version: "1.0.70",
|
|
179
179
|
description: "CLI client for Periscope SSH tunnel server",
|
|
180
180
|
main: "dist/index.js",
|
|
181
181
|
types: "dist/index.d.ts",
|
|
@@ -230,7 +230,13 @@ var init_package = __esm({
|
|
|
230
230
|
glob: "^11.0.0",
|
|
231
231
|
uuid: "^10.0.0"
|
|
232
232
|
},
|
|
233
|
-
|
|
233
|
+
"lint-staged": {
|
|
234
|
+
"*.ts": [
|
|
235
|
+
"prettier --write",
|
|
236
|
+
"eslint --fix"
|
|
237
|
+
]
|
|
238
|
+
},
|
|
239
|
+
devDependencies: {
|
|
234
240
|
"@azure/msal-node": "^2.6.6",
|
|
235
241
|
"@microsoft/dev-tunnels-connections": "^1.2.1",
|
|
236
242
|
"@microsoft/dev-tunnels-contracts": "^1.2.1",
|
|
@@ -244,15 +250,7 @@ var init_package = __esm({
|
|
|
244
250
|
commander: "^12.0.0",
|
|
245
251
|
dotenv: "^16.4.5",
|
|
246
252
|
open: "^10.0.3",
|
|
247
|
-
"openid-client": "^6.8.2"
|
|
248
|
-
},
|
|
249
|
-
"lint-staged": {
|
|
250
|
-
"*.ts": [
|
|
251
|
-
"prettier --write",
|
|
252
|
-
"eslint --fix"
|
|
253
|
-
]
|
|
254
|
-
},
|
|
255
|
-
devDependencies: {
|
|
253
|
+
"openid-client": "^6.8.2",
|
|
256
254
|
"@elf-5/periscope-api-client": "^1.0.129",
|
|
257
255
|
"@types/node": "^20.14.0",
|
|
258
256
|
"@typescript-eslint/eslint-plugin": "^8.41.0",
|
|
@@ -1766,7 +1764,8 @@ import * as fs3 from "fs";
|
|
|
1766
1764
|
import * as path3 from "path";
|
|
1767
1765
|
import * as os3 from "os";
|
|
1768
1766
|
import * as dotenv from "dotenv";
|
|
1769
|
-
var ConfigManager = class {
|
|
1767
|
+
var ConfigManager = class _ConfigManager {
|
|
1768
|
+
static DEFAULT_SERVER_URL = "https://periscope.elf5.com";
|
|
1770
1769
|
static CONFIG_DIR = path3.join(os3.homedir(), ".periscope");
|
|
1771
1770
|
static CONFIG_FILE = "config.json";
|
|
1772
1771
|
static testConfig = null;
|
|
@@ -1804,6 +1803,9 @@ var ConfigManager = class {
|
|
|
1804
1803
|
}
|
|
1805
1804
|
}
|
|
1806
1805
|
config2 = this.mergeEnvironmentVariables(config2);
|
|
1806
|
+
if (!config2.serverUrl) {
|
|
1807
|
+
config2.serverUrl = _ConfigManager.DEFAULT_SERVER_URL;
|
|
1808
|
+
}
|
|
1807
1809
|
return config2;
|
|
1808
1810
|
}
|
|
1809
1811
|
/**
|
|
@@ -4011,25 +4013,21 @@ var BaseCommand = class {
|
|
|
4011
4013
|
*/
|
|
4012
4014
|
static async authenticateWithChoice(client3, prompt = "select_account") {
|
|
4013
4015
|
log.info("Authentication required...");
|
|
4014
|
-
const
|
|
4015
|
-
|
|
4016
|
-
|
|
4017
|
-
|
|
4018
|
-
|
|
4019
|
-
|
|
4020
|
-
|
|
4021
|
-
|
|
4022
|
-
|
|
4023
|
-
|
|
4024
|
-
|
|
4025
|
-
|
|
4026
|
-
|
|
4027
|
-
|
|
4028
|
-
|
|
4029
|
-
reject(error);
|
|
4030
|
-
}
|
|
4031
|
-
});
|
|
4032
|
-
}
|
|
4016
|
+
const rl = getReadlineInterface();
|
|
4017
|
+
const useBrowser = await new Promise((resolve, reject) => {
|
|
4018
|
+
log.blank();
|
|
4019
|
+
log.info("Choose authentication method:");
|
|
4020
|
+
log.info("1. Browser (recommended)");
|
|
4021
|
+
log.info("2. Device code (for WSL or headless environments)");
|
|
4022
|
+
try {
|
|
4023
|
+
rl.question(
|
|
4024
|
+
"Enter your choice (1 or 2) [default: 1]: ",
|
|
4025
|
+
(answer) => resolve((answer.trim() || "1") === "1")
|
|
4026
|
+
);
|
|
4027
|
+
} catch (error) {
|
|
4028
|
+
reject(error);
|
|
4029
|
+
}
|
|
4030
|
+
});
|
|
4033
4031
|
log.info(
|
|
4034
4032
|
useBrowser ? `Starting browser authentication (${prompt})...` : "Starting device code authentication..."
|
|
4035
4033
|
);
|
|
@@ -4060,12 +4058,6 @@ var BaseCommand = class {
|
|
|
4060
4058
|
*/
|
|
4061
4059
|
static async initClient(existingConfig) {
|
|
4062
4060
|
const config2 = existingConfig ?? ConfigManager.load();
|
|
4063
|
-
if (!config2.serverUrl) {
|
|
4064
|
-
log.error(
|
|
4065
|
-
"Server URL not configured. Run: periscope config set --server <url>"
|
|
4066
|
-
);
|
|
4067
|
-
exitOrThrow(1);
|
|
4068
|
-
}
|
|
4069
4061
|
return { client: new PeriscopeClient(config2), config: config2 };
|
|
4070
4062
|
}
|
|
4071
4063
|
/**
|
|
@@ -4487,7 +4479,8 @@ var ConfigCommand = class _ConfigCommand extends BaseCommand {
|
|
|
4487
4479
|
_ConfigCommand.showConfigValue(
|
|
4488
4480
|
"Server URL ",
|
|
4489
4481
|
config2.serverUrl,
|
|
4490
|
-
"PERISCOPE_SERVER_URL"
|
|
4482
|
+
"PERISCOPE_SERVER_URL",
|
|
4483
|
+
ConfigManager.DEFAULT_SERVER_URL
|
|
4491
4484
|
);
|
|
4492
4485
|
_ConfigCommand.showConfigValue(
|
|
4493
4486
|
"Request Log ",
|
|
@@ -4500,11 +4493,12 @@ var ConfigCommand = class _ConfigCommand extends BaseCommand {
|
|
|
4500
4493
|
this.handleError(_ConfigCommand.Action.SHOW, error);
|
|
4501
4494
|
}
|
|
4502
4495
|
}
|
|
4503
|
-
static showConfigValue(label, value, envVar) {
|
|
4496
|
+
static showConfigValue(label, value, envVar, defaultValue) {
|
|
4504
4497
|
const envValue = process.env[envVar];
|
|
4505
4498
|
const isFromEnv = envValue !== void 0 && envValue !== "";
|
|
4499
|
+
const isDefault = !isFromEnv && value === defaultValue;
|
|
4506
4500
|
const displayValue = value || "Not configured";
|
|
4507
|
-
const source = isFromEnv ? " (from env)" : "";
|
|
4501
|
+
const source = isFromEnv ? " (from env)" : isDefault ? " (default)" : "";
|
|
4508
4502
|
log.info(`${label}: ${displayValue}${source}`);
|
|
4509
4503
|
}
|
|
4510
4504
|
};
|