bdy 1.18.4-dev → 1.18.6-dev
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/distTs/package.json +1 -1
- package/distTs/src/agent/manager.js +20 -18
- package/distTs/src/api/client.js +48 -0
- package/distTs/src/autocomplete.js +10 -5
- package/distTs/src/command/agent/debug.js +6 -6
- package/distTs/src/command/agent/disable.js +2 -2
- package/distTs/src/command/agent/enable.js +2 -2
- package/distTs/src/command/agent/install.js +31 -26
- package/distTs/src/command/agent/proxy/disable.js +2 -2
- package/distTs/src/command/agent/proxy/enable.js +2 -2
- package/distTs/src/command/agent/proxy/status.js +2 -2
- package/distTs/src/command/agent/restart.js +6 -6
- package/distTs/src/command/agent/run.js +3 -3
- package/distTs/src/command/agent/start.js +7 -7
- package/distTs/src/command/agent/stop.js +6 -6
- package/distTs/src/command/agent/tags/get.js +2 -2
- package/distTs/src/command/agent/tags/set.js +2 -2
- package/distTs/src/command/agent/target/disable.js +2 -2
- package/distTs/src/command/agent/target/enable.js +2 -2
- package/distTs/src/command/agent/target/status.js +2 -2
- package/distTs/src/command/agent/tunnel/disable.js +2 -2
- package/distTs/src/command/agent/tunnel/enable.js +2 -2
- package/distTs/src/command/agent/tunnel/http.js +7 -7
- package/distTs/src/command/agent/tunnel/list.js +2 -2
- package/distTs/src/command/agent/tunnel/remove.js +2 -2
- package/distTs/src/command/agent/tunnel/start.js +5 -5
- package/distTs/src/command/agent/tunnel/status.js +4 -4
- package/distTs/src/command/agent/tunnel/tcp.js +7 -7
- package/distTs/src/command/agent/tunnel/tls.js +7 -7
- package/distTs/src/command/agent/uninstall.js +12 -12
- package/distTs/src/command/agent/update.js +9 -9
- package/distTs/src/command/api/info.js +2 -1
- package/distTs/src/command/api/list.js +2 -1
- package/distTs/src/command/api/request.js +2 -2
- package/distTs/src/command/login.js +8 -6
- package/distTs/src/command/package/create.js +2 -2
- package/distTs/src/command/package/download.js +5 -37
- package/distTs/src/command/package/publish.js +7 -6
- package/distTs/src/command/pre.js +5 -5
- package/distTs/src/command/project/link.js +4 -3
- package/distTs/src/command/sandbox/app/list.js +35 -0
- package/distTs/src/command/sandbox/app/logs.js +43 -0
- package/distTs/src/command/sandbox/app/start.js +27 -0
- package/distTs/src/command/sandbox/app/status.js +35 -0
- package/distTs/src/command/sandbox/app/stop.js +27 -0
- package/distTs/src/command/sandbox/app.js +25 -0
- package/distTs/src/command/sandbox/cp.js +7 -39
- package/distTs/src/command/sandbox/create.js +22 -12
- package/distTs/src/command/sandbox/logs.js +26 -0
- package/distTs/src/command/sandbox/snapshot/create.js +2 -2
- package/distTs/src/command/sandbox/update.js +14 -0
- package/distTs/src/command/sandbox.js +4 -0
- package/distTs/src/command/scrape.js +15 -14
- package/distTs/src/command/tunnel/http.js +8 -8
- package/distTs/src/command/tunnel/start.js +9 -9
- package/distTs/src/command/tunnel/tcp.js +8 -8
- package/distTs/src/command/tunnel/tls.js +8 -8
- package/distTs/src/command/ut/upload.js +16 -48
- package/distTs/src/command/vt/close.js +5 -5
- package/distTs/src/command/vt/compare.js +18 -16
- package/distTs/src/command/vt/exec.js +28 -28
- package/distTs/src/command/vt/installBrowser.js +2 -2
- package/distTs/src/command/vt/storybook.js +14 -14
- package/distTs/src/input.js +8 -7
- package/distTs/src/logger.js +3 -3
- package/distTs/src/openapi.js +24 -0
- package/distTs/src/output.js +21 -16
- package/distTs/src/sshKeygen.js +9 -0
- package/distTs/src/texts.js +42 -8
- package/distTs/src/tunnel/cfg.js +17 -20
- package/distTs/src/tunnel/tunnel.js +2 -1
- package/distTs/src/utils.js +9 -28
- package/package.json +1 -1
|
@@ -5,12 +5,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const output_1 = __importDefault(require("../../output"));
|
|
7
7
|
const texts_1 = require("../../texts");
|
|
8
|
-
const manager_1 = __importDefault(require("../../agent/manager"));
|
|
9
8
|
const utils_1 = require("../../utils");
|
|
10
|
-
const logger_1 = __importDefault(require("../../logger"));
|
|
11
9
|
const commandAgentStart = (0, utils_1.newCommand)('start', texts_1.DESC_COMMAND_AGENT_START);
|
|
12
10
|
commandAgentStart.action(async () => {
|
|
13
|
-
const
|
|
11
|
+
const AgentManager = require('../../agent/manager').default;
|
|
12
|
+
const logger = require('../../logger').default;
|
|
13
|
+
const hasAdminRights = await AgentManager.system.hasAdminRights();
|
|
14
14
|
if (!hasAdminRights) {
|
|
15
15
|
output_1.default.exitError(texts_1.ERR_AGENT_ADMIN_RIGHTS);
|
|
16
16
|
}
|
|
@@ -18,16 +18,16 @@ commandAgentStart.action(async () => {
|
|
|
18
18
|
output_1.default.exitError(texts_1.ERR_AGENT_NOT_INSTALLED);
|
|
19
19
|
}
|
|
20
20
|
if (commandAgentStart.agentStandalone) {
|
|
21
|
-
await
|
|
22
|
-
|
|
21
|
+
await AgentManager.system.killStandaloneProc();
|
|
22
|
+
AgentManager.system.startStandaloneProc();
|
|
23
23
|
}
|
|
24
24
|
else {
|
|
25
25
|
try {
|
|
26
|
-
await
|
|
26
|
+
await AgentManager.system.start();
|
|
27
27
|
output_1.default.exitSuccess(texts_1.TXT_AGENT_STARTED);
|
|
28
28
|
}
|
|
29
29
|
catch (err) {
|
|
30
|
-
|
|
30
|
+
logger.error(err);
|
|
31
31
|
output_1.default.exitError(err);
|
|
32
32
|
}
|
|
33
33
|
}
|
|
@@ -5,13 +5,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const utils_1 = require("../../utils");
|
|
7
7
|
const texts_1 = require("../../texts");
|
|
8
|
-
const manager_1 = __importDefault(require("../../agent/manager"));
|
|
9
8
|
const output_1 = __importDefault(require("../../output"));
|
|
10
9
|
const logger_1 = __importDefault(require("../../logger"));
|
|
11
|
-
const agent_1 = __importDefault(require("../../tunnel/api/agent"));
|
|
12
10
|
const commandAgentStop = (0, utils_1.newCommand)('stop', texts_1.DESC_COMMAND_AGENT_STOP);
|
|
13
11
|
commandAgentStop.action(async () => {
|
|
14
|
-
const
|
|
12
|
+
const AgentManager = require('../../agent/manager').default;
|
|
13
|
+
const ApiAgent = require('../../tunnel/api/agent').default;
|
|
14
|
+
const hasAdminRights = await AgentManager.system.hasAdminRights();
|
|
15
15
|
if (!hasAdminRights) {
|
|
16
16
|
output_1.default.exitError(texts_1.ERR_AGENT_ADMIN_RIGHTS);
|
|
17
17
|
}
|
|
@@ -19,19 +19,19 @@ commandAgentStop.action(async () => {
|
|
|
19
19
|
output_1.default.exitError(texts_1.ERR_AGENT_NOT_INSTALLED);
|
|
20
20
|
}
|
|
21
21
|
try {
|
|
22
|
-
const api = new
|
|
22
|
+
const api = new ApiAgent(commandAgentStop.agentPort || 0);
|
|
23
23
|
await api.markInactive();
|
|
24
24
|
}
|
|
25
25
|
catch {
|
|
26
26
|
// do nothing
|
|
27
27
|
}
|
|
28
28
|
if (commandAgentStop.agentStandalone) {
|
|
29
|
-
await
|
|
29
|
+
await AgentManager.system.killStandaloneProc();
|
|
30
30
|
output_1.default.exitSuccess(texts_1.TXT_AGENT_STOPPED);
|
|
31
31
|
}
|
|
32
32
|
else {
|
|
33
33
|
try {
|
|
34
|
-
await
|
|
34
|
+
await AgentManager.system.stop();
|
|
35
35
|
output_1.default.exitSuccess(texts_1.TXT_AGENT_STOPPED);
|
|
36
36
|
}
|
|
37
37
|
catch (err) {
|
|
@@ -6,9 +6,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const utils_1 = require("../../../utils");
|
|
7
7
|
const texts_1 = require("../../../texts");
|
|
8
8
|
const output_1 = __importDefault(require("../../../output"));
|
|
9
|
-
const agent_1 = __importDefault(require("../../../tunnel/api/agent"));
|
|
10
9
|
const commandAgentTagsGet = (0, utils_1.newCommand)('get', texts_1.DESC_COMMAND_AGENT_TAGS_GET);
|
|
11
10
|
commandAgentTagsGet.action(async () => {
|
|
11
|
+
const ApiAgent = require('../../../tunnel/api/agent').default;
|
|
12
12
|
if (!commandAgentTagsGet.agentInstalled) {
|
|
13
13
|
output_1.default.exitError(texts_1.ERR_AGENT_NOT_INSTALLED);
|
|
14
14
|
}
|
|
@@ -16,7 +16,7 @@ commandAgentTagsGet.action(async () => {
|
|
|
16
16
|
output_1.default.exitError(texts_1.ERR_AGENT_NOT_RUNNING);
|
|
17
17
|
}
|
|
18
18
|
try {
|
|
19
|
-
const api = new
|
|
19
|
+
const api = new ApiAgent(commandAgentTagsGet.agentPort || 0);
|
|
20
20
|
const data = await api.fetchAgentTags();
|
|
21
21
|
if (data.tags && data.tags.length > 0) {
|
|
22
22
|
output_1.default.exitNormal(data.tags.join(' '));
|
|
@@ -6,10 +6,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const utils_1 = require("../../../utils");
|
|
7
7
|
const texts_1 = require("../../../texts");
|
|
8
8
|
const output_1 = __importDefault(require("../../../output"));
|
|
9
|
-
const agent_1 = __importDefault(require("../../../tunnel/api/agent"));
|
|
10
9
|
const commandAgentTagsSet = (0, utils_1.newCommand)('set', texts_1.DESC_COMMAND_AGENT_TAGS_SET);
|
|
11
10
|
commandAgentTagsSet.argument('[tags...]', texts_1.OPT_COMMAND_AGENT_TAGS_SET);
|
|
12
11
|
commandAgentTagsSet.action(async (tags) => {
|
|
12
|
+
const ApiAgent = require('../../../tunnel/api/agent').default;
|
|
13
13
|
if (!commandAgentTagsSet.agentInstalled) {
|
|
14
14
|
output_1.default.exitError(texts_1.ERR_AGENT_NOT_INSTALLED);
|
|
15
15
|
}
|
|
@@ -27,7 +27,7 @@ commandAgentTagsSet.action(async (tags) => {
|
|
|
27
27
|
});
|
|
28
28
|
}
|
|
29
29
|
try {
|
|
30
|
-
const api = new
|
|
30
|
+
const api = new ApiAgent(commandAgentTagsSet.agentPort || 0);
|
|
31
31
|
await api.setAgentTags(validTags);
|
|
32
32
|
output_1.default.exitSuccess(texts_1.TXT_AGENT_TAGS_SET);
|
|
33
33
|
}
|
|
@@ -6,9 +6,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const utils_1 = require("../../../utils");
|
|
7
7
|
const texts_1 = require("../../../texts");
|
|
8
8
|
const output_1 = __importDefault(require("../../../output"));
|
|
9
|
-
const agent_1 = __importDefault(require("../../../tunnel/api/agent"));
|
|
10
9
|
const commandAgentTargetDisable = (0, utils_1.newCommand)('disable', texts_1.DESC_COMMAND_AGENT_TARGET_DISABLE);
|
|
11
10
|
commandAgentTargetDisable.action(async () => {
|
|
11
|
+
const ApiAgent = require('../../../tunnel/api/agent').default;
|
|
12
12
|
if (!commandAgentTargetDisable.agentInstalled) {
|
|
13
13
|
output_1.default.exitError(texts_1.ERR_AGENT_NOT_INSTALLED);
|
|
14
14
|
}
|
|
@@ -16,7 +16,7 @@ commandAgentTargetDisable.action(async () => {
|
|
|
16
16
|
output_1.default.exitError(texts_1.ERR_AGENT_NOT_RUNNING);
|
|
17
17
|
}
|
|
18
18
|
try {
|
|
19
|
-
const api = new
|
|
19
|
+
const api = new ApiAgent(commandAgentTargetDisable.agentPort || 0);
|
|
20
20
|
await api.disableAgentTarget();
|
|
21
21
|
output_1.default.exitSuccess(texts_1.TXT_AGENT_TARGET_DISABLED);
|
|
22
22
|
}
|
|
@@ -6,9 +6,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const utils_1 = require("../../../utils");
|
|
7
7
|
const texts_1 = require("../../../texts");
|
|
8
8
|
const output_1 = __importDefault(require("../../../output"));
|
|
9
|
-
const agent_1 = __importDefault(require("../../../tunnel/api/agent"));
|
|
10
9
|
const commandAgentTargetEnable = (0, utils_1.newCommand)('enable', texts_1.DESC_COMMAND_AGENT_TARGET_ENABLE);
|
|
11
10
|
commandAgentTargetEnable.action(async () => {
|
|
11
|
+
const ApiAgent = require('../../../tunnel/api/agent').default;
|
|
12
12
|
if (!commandAgentTargetEnable.agentInstalled) {
|
|
13
13
|
output_1.default.exitError(texts_1.ERR_AGENT_NOT_INSTALLED);
|
|
14
14
|
}
|
|
@@ -16,7 +16,7 @@ commandAgentTargetEnable.action(async () => {
|
|
|
16
16
|
output_1.default.exitError(texts_1.ERR_AGENT_NOT_RUNNING);
|
|
17
17
|
}
|
|
18
18
|
try {
|
|
19
|
-
const api = new
|
|
19
|
+
const api = new ApiAgent(commandAgentTargetEnable.agentPort || 0);
|
|
20
20
|
await api.enableAgentTarget();
|
|
21
21
|
output_1.default.exitSuccess(texts_1.TXT_AGENT_TARGET_ENABLED);
|
|
22
22
|
}
|
|
@@ -6,9 +6,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const utils_1 = require("../../../utils");
|
|
7
7
|
const texts_1 = require("../../../texts");
|
|
8
8
|
const output_1 = __importDefault(require("../../../output"));
|
|
9
|
-
const agent_1 = __importDefault(require("../../../tunnel/api/agent"));
|
|
10
9
|
const commandAgentTargetStatus = (0, utils_1.newCommand)('status', texts_1.DESC_COMMAND_AGENT_TARGET_STATUS);
|
|
11
10
|
commandAgentTargetStatus.action(async () => {
|
|
11
|
+
const ApiAgent = require('../../../tunnel/api/agent').default;
|
|
12
12
|
if (!commandAgentTargetStatus.agentInstalled) {
|
|
13
13
|
output_1.default.exitError(texts_1.ERR_AGENT_NOT_INSTALLED);
|
|
14
14
|
}
|
|
@@ -16,7 +16,7 @@ commandAgentTargetStatus.action(async () => {
|
|
|
16
16
|
output_1.default.exitError(texts_1.ERR_AGENT_NOT_RUNNING);
|
|
17
17
|
}
|
|
18
18
|
try {
|
|
19
|
-
const api = new
|
|
19
|
+
const api = new ApiAgent(commandAgentTargetStatus.agentPort || 0);
|
|
20
20
|
const data = await api.fetchAgentTarget();
|
|
21
21
|
if (data.target) {
|
|
22
22
|
output_1.default.exitSuccess(texts_1.TXT_AGENT_TARGET_ENABLED);
|
|
@@ -6,9 +6,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const utils_1 = require("../../../utils");
|
|
7
7
|
const texts_1 = require("../../../texts");
|
|
8
8
|
const output_1 = __importDefault(require("../../../output"));
|
|
9
|
-
const agent_1 = __importDefault(require("../../../tunnel/api/agent"));
|
|
10
9
|
const commandAgentTunnelDisable = (0, utils_1.newCommand)('disable', texts_1.DESC_COMMAND_AGENT_TUNNELING_DISABLE);
|
|
11
10
|
commandAgentTunnelDisable.action(async () => {
|
|
11
|
+
const ApiAgent = require('../../../tunnel/api/agent').default;
|
|
12
12
|
if (!commandAgentTunnelDisable.agentInstalled) {
|
|
13
13
|
output_1.default.exitError(texts_1.ERR_AGENT_NOT_INSTALLED);
|
|
14
14
|
}
|
|
@@ -16,7 +16,7 @@ commandAgentTunnelDisable.action(async () => {
|
|
|
16
16
|
output_1.default.exitError(texts_1.ERR_AGENT_NOT_RUNNING);
|
|
17
17
|
}
|
|
18
18
|
try {
|
|
19
|
-
const api = new
|
|
19
|
+
const api = new ApiAgent(commandAgentTunnelDisable.agentPort || 0);
|
|
20
20
|
await api.disableAgentTunneling();
|
|
21
21
|
output_1.default.exitSuccess(texts_1.TXT_AGENT_TUNNELING_DISABLED);
|
|
22
22
|
}
|
|
@@ -6,9 +6,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const utils_1 = require("../../../utils");
|
|
7
7
|
const texts_1 = require("../../../texts");
|
|
8
8
|
const output_1 = __importDefault(require("../../../output"));
|
|
9
|
-
const agent_1 = __importDefault(require("../../../tunnel/api/agent"));
|
|
10
9
|
const commandAgentTunnelEnable = (0, utils_1.newCommand)('enable', texts_1.DESC_COMMAND_AGENT_TUNNELING_ENABLE);
|
|
11
10
|
commandAgentTunnelEnable.action(async () => {
|
|
11
|
+
const ApiAgent = require('../../../tunnel/api/agent').default;
|
|
12
12
|
if (!commandAgentTunnelEnable.agentInstalled) {
|
|
13
13
|
output_1.default.exitError(texts_1.ERR_AGENT_NOT_INSTALLED);
|
|
14
14
|
}
|
|
@@ -16,7 +16,7 @@ commandAgentTunnelEnable.action(async () => {
|
|
|
16
16
|
output_1.default.exitError(texts_1.ERR_AGENT_NOT_RUNNING);
|
|
17
17
|
}
|
|
18
18
|
try {
|
|
19
|
-
const api = new
|
|
19
|
+
const api = new ApiAgent(commandAgentTunnelEnable.agentPort || 0);
|
|
20
20
|
await api.enableAgentTunneling();
|
|
21
21
|
output_1.default.exitSuccess(texts_1.TXT_AGENT_TUNNELING_ENABLED);
|
|
22
22
|
}
|
|
@@ -5,31 +5,31 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const utils_1 = require("../../../utils");
|
|
7
7
|
const output_1 = __importDefault(require("../../../output"));
|
|
8
|
-
const cfg_1 = __importDefault(require("../../../tunnel/cfg"));
|
|
9
8
|
const texts_1 = require("../../../texts");
|
|
10
|
-
const tunnel_1 =
|
|
11
|
-
const agent_1 = __importDefault(require("../../../tunnel/api/agent"));
|
|
12
|
-
const tunnel_2 = require("../../../types/tunnel");
|
|
9
|
+
const tunnel_1 = require("../../../types/tunnel");
|
|
13
10
|
const commandAgentTunnelHttp = (0, utils_1.getBasicCommandHttp)();
|
|
14
11
|
commandAgentTunnelHttp.description(texts_1.DESC_COMMAND_HTTP);
|
|
15
12
|
commandAgentTunnelHttp.option('-f, --follow', texts_1.OPTION_FOLLOW);
|
|
16
13
|
commandAgentTunnelHttp.argument('[protocol://host:port]', texts_1.OPTION_TARGET);
|
|
17
14
|
commandAgentTunnelHttp.addHelpText('after', `\nEXAMPLES:${(0, texts_1.EXAMPLE_TUNNEL_HTTP)(true)}`);
|
|
18
15
|
commandAgentTunnelHttp.action(async (target, options) => {
|
|
16
|
+
const ApiAgent = require('../../../tunnel/api/agent').default;
|
|
17
|
+
const AgentSocketTunnel = require('../../../agent/socket/tunnel').default;
|
|
18
|
+
const Cfg = require('../../../tunnel/cfg').default;
|
|
19
19
|
if (!commandAgentTunnelHttp.agentInstalled) {
|
|
20
20
|
output_1.default.exitError(texts_1.ERR_AGENT_NOT_INSTALLED);
|
|
21
21
|
}
|
|
22
22
|
if (!commandAgentTunnelHttp.agentStatus) {
|
|
23
23
|
output_1.default.exitError(texts_1.ERR_AGENT_NOT_RUNNING);
|
|
24
24
|
}
|
|
25
|
-
const prepared = await
|
|
25
|
+
const prepared = await Cfg.prepareTunnel(tunnel_1.TUNNEL_TYPE.HTTP, target, options, true);
|
|
26
26
|
try {
|
|
27
27
|
await output_1.default.spinner(texts_1.TXT_OPENING_TUNNEL);
|
|
28
|
-
const api = new
|
|
28
|
+
const api = new ApiAgent(commandAgentTunnelHttp.agentPort || 0);
|
|
29
29
|
const data = await api.addTunnel(prepared);
|
|
30
30
|
if (options.follow) {
|
|
31
31
|
const ws = await api.socketTunnel(data.id);
|
|
32
|
-
const tunnel = new
|
|
32
|
+
const tunnel = new AgentSocketTunnel(ws, data.id);
|
|
33
33
|
await tunnel.waitForReady();
|
|
34
34
|
output_1.default.tunnel(tunnel);
|
|
35
35
|
}
|
|
@@ -5,12 +5,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const output_1 = __importDefault(require("../../../output"));
|
|
7
7
|
const texts_1 = require("../../../texts");
|
|
8
|
-
const agent_1 = __importDefault(require("../../../tunnel/api/agent"));
|
|
9
8
|
const utils_1 = require("../../../utils");
|
|
10
9
|
const commandAgentTunnelList = (0, utils_1.newCommand)('list', texts_1.DESC_COMMAND_AGENT_TUNNEL_LIST);
|
|
11
10
|
commandAgentTunnelList.alias('ls');
|
|
12
11
|
commandAgentTunnelList.addHelpText('after', `\nEXAMPLES:${texts_1.EXAMPLE_AGENT_TUNNEL_LIST}`);
|
|
13
12
|
commandAgentTunnelList.action(async () => {
|
|
13
|
+
const ApiAgent = require('../../../tunnel/api/agent').default;
|
|
14
14
|
if (!commandAgentTunnelList.agentInstalled) {
|
|
15
15
|
output_1.default.exitError(texts_1.ERR_AGENT_NOT_INSTALLED);
|
|
16
16
|
}
|
|
@@ -18,7 +18,7 @@ commandAgentTunnelList.action(async () => {
|
|
|
18
18
|
output_1.default.exitError(texts_1.ERR_AGENT_NOT_RUNNING);
|
|
19
19
|
}
|
|
20
20
|
try {
|
|
21
|
-
const api = new
|
|
21
|
+
const api = new ApiAgent(commandAgentTunnelList.agentPort || 0);
|
|
22
22
|
const data = await api.fetchTunnels();
|
|
23
23
|
output_1.default.agentTunnels(data.tunnels);
|
|
24
24
|
}
|
|
@@ -5,12 +5,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const output_1 = __importDefault(require("../../../output"));
|
|
7
7
|
const texts_1 = require("../../../texts");
|
|
8
|
-
const agent_1 = __importDefault(require("../../../tunnel/api/agent"));
|
|
9
8
|
const utils_1 = require("../../../utils");
|
|
10
9
|
const commandAgentTunnelRemove = (0, utils_1.newCommand)('rm', texts_1.DESC_COMMAND_AGENT_TUNNEL_REMOVE);
|
|
11
10
|
commandAgentTunnelRemove.addHelpText('after', `\nEXAMPLES:${texts_1.EXAMPLE_AGENT_TUNNEL_REMOVE}`);
|
|
12
11
|
commandAgentTunnelRemove.argument('<id>', texts_1.OPTION_ID);
|
|
13
12
|
commandAgentTunnelRemove.action(async (id) => {
|
|
13
|
+
const ApiAgent = require('../../../tunnel/api/agent').default;
|
|
14
14
|
if (!commandAgentTunnelRemove.agentInstalled) {
|
|
15
15
|
output_1.default.exitError(texts_1.ERR_AGENT_NOT_INSTALLED);
|
|
16
16
|
}
|
|
@@ -18,7 +18,7 @@ commandAgentTunnelRemove.action(async (id) => {
|
|
|
18
18
|
output_1.default.exitError(texts_1.ERR_AGENT_NOT_RUNNING);
|
|
19
19
|
}
|
|
20
20
|
try {
|
|
21
|
-
const api = new
|
|
21
|
+
const api = new ApiAgent(commandAgentTunnelRemove.agentPort || 0);
|
|
22
22
|
await api.stopTunnel(id);
|
|
23
23
|
output_1.default.exitSuccess(texts_1.TXT_TUNNEL_STOPPED);
|
|
24
24
|
}
|
|
@@ -3,28 +3,28 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const cfg_1 = __importDefault(require("../../../tunnel/cfg"));
|
|
7
6
|
const output_1 = __importDefault(require("../../../output"));
|
|
8
7
|
const texts_1 = require("../../../texts");
|
|
9
|
-
const agent_1 = __importDefault(require("../../../tunnel/api/agent"));
|
|
10
8
|
const utils_1 = require("../../../utils");
|
|
11
9
|
const commandAgentTunnelStart = (0, utils_1.newCommand)('start', texts_1.DESC_COMMAND_START);
|
|
12
10
|
commandAgentTunnelStart.addHelpText('after', `\nEXAMPLES:${texts_1.EXAMPLE_AGENT_TUNNEL_START}`);
|
|
13
11
|
commandAgentTunnelStart.argument('<name>', texts_1.OPTION_NAME);
|
|
14
12
|
commandAgentTunnelStart.action(async (name) => {
|
|
13
|
+
const ApiAgent = require('../../../tunnel/api/agent').default;
|
|
14
|
+
const Cfg = require('../../../tunnel/cfg').default;
|
|
15
15
|
if (!commandAgentTunnelStart.agentInstalled) {
|
|
16
16
|
output_1.default.exitError(texts_1.ERR_AGENT_NOT_INSTALLED);
|
|
17
17
|
}
|
|
18
18
|
if (!commandAgentTunnelStart.agentStatus) {
|
|
19
19
|
output_1.default.exitError(texts_1.ERR_AGENT_NOT_RUNNING);
|
|
20
20
|
}
|
|
21
|
-
if (!
|
|
21
|
+
if (!Cfg.hasTunnel(name)) {
|
|
22
22
|
output_1.default.exitError((0, texts_1.ERR_TUNNEL_NOT_FOUND)(name));
|
|
23
23
|
}
|
|
24
|
-
const prepared =
|
|
24
|
+
const prepared = Cfg.getTunnel(name);
|
|
25
25
|
try {
|
|
26
26
|
await output_1.default.spinner(texts_1.TXT_OPENING_TUNNEL);
|
|
27
|
-
const api = new
|
|
27
|
+
const api = new ApiAgent(commandAgentTunnelStart.agentPort || 0);
|
|
28
28
|
const data = await api.addTunnel(prepared);
|
|
29
29
|
output_1.default.exitSuccess((0, texts_1.TXT_TUNNEL_STARTED)(data.type));
|
|
30
30
|
}
|
|
@@ -5,13 +5,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const texts_1 = require("../../../texts");
|
|
7
7
|
const output_1 = __importDefault(require("../../../output"));
|
|
8
|
-
const agent_1 = __importDefault(require("../../../tunnel/api/agent"));
|
|
9
|
-
const tunnel_1 = __importDefault(require("../../../agent/socket/tunnel"));
|
|
10
8
|
const utils_1 = require("../../../utils");
|
|
11
9
|
const commandAgentTunnelStatus = (0, utils_1.newCommand)('status', texts_1.DESC_COMMAND_AGENT_TUNNEL_STATUS);
|
|
12
10
|
commandAgentTunnelStatus.addHelpText('after', `\nEXAMPLES:${texts_1.EXAMPLE_AGENT_TUNNEL_STATUS}`);
|
|
13
11
|
commandAgentTunnelStatus.argument('[id]', texts_1.OPTION_ID);
|
|
14
12
|
commandAgentTunnelStatus.action(async (id) => {
|
|
13
|
+
const ApiAgent = require('../../../tunnel/api/agent').default;
|
|
14
|
+
const AgentSocketTunnel = require('../../../agent/socket/tunnel').default;
|
|
15
15
|
if (!commandAgentTunnelStatus.agentInstalled) {
|
|
16
16
|
output_1.default.exitError(texts_1.ERR_AGENT_NOT_INSTALLED);
|
|
17
17
|
}
|
|
@@ -19,7 +19,7 @@ commandAgentTunnelStatus.action(async (id) => {
|
|
|
19
19
|
output_1.default.exitError(texts_1.ERR_AGENT_NOT_RUNNING);
|
|
20
20
|
}
|
|
21
21
|
try {
|
|
22
|
-
const api = new
|
|
22
|
+
const api = new ApiAgent(commandAgentTunnelStatus.agentPort || 0);
|
|
23
23
|
if (!id) {
|
|
24
24
|
const data = await api.fetchAgentTunneling();
|
|
25
25
|
if (data.tunneling) {
|
|
@@ -31,7 +31,7 @@ commandAgentTunnelStatus.action(async (id) => {
|
|
|
31
31
|
return;
|
|
32
32
|
}
|
|
33
33
|
const ws = await api.socketTunnel(id);
|
|
34
|
-
const tunnel = new
|
|
34
|
+
const tunnel = new AgentSocketTunnel(ws, id);
|
|
35
35
|
await tunnel.waitForReady();
|
|
36
36
|
output_1.default.tunnel(tunnel);
|
|
37
37
|
}
|
|
@@ -5,31 +5,31 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const utils_1 = require("../../../utils");
|
|
7
7
|
const output_1 = __importDefault(require("../../../output"));
|
|
8
|
-
const cfg_1 = __importDefault(require("../../../tunnel/cfg"));
|
|
9
8
|
const texts_1 = require("../../../texts");
|
|
10
|
-
const tunnel_1 =
|
|
11
|
-
const agent_1 = __importDefault(require("../../../tunnel/api/agent"));
|
|
12
|
-
const tunnel_2 = require("../../../types/tunnel");
|
|
9
|
+
const tunnel_1 = require("../../../types/tunnel");
|
|
13
10
|
const commandAgentTunnelTcp = (0, utils_1.getBasicCommandTcp)();
|
|
14
11
|
commandAgentTunnelTcp.description(texts_1.DESC_COMMAND_TCP);
|
|
15
12
|
commandAgentTunnelTcp.option('-f, --follow', texts_1.OPTION_FOLLOW);
|
|
16
13
|
commandAgentTunnelTcp.argument('[host:port]', texts_1.OPTION_TARGET);
|
|
17
14
|
commandAgentTunnelTcp.addHelpText('after', `\nEXAMPLES:${(0, texts_1.EXAMPLE_TUNNEL_TCP)(true)}`);
|
|
18
15
|
commandAgentTunnelTcp.action(async (target, options) => {
|
|
16
|
+
const ApiAgent = require('../../../tunnel/api/agent').default;
|
|
17
|
+
const AgentSocketTunnel = require('../../../agent/socket/tunnel').default;
|
|
18
|
+
const Cfg = require('../../../tunnel/cfg').default;
|
|
19
19
|
if (!commandAgentTunnelTcp.agentInstalled) {
|
|
20
20
|
output_1.default.exitError(texts_1.ERR_AGENT_NOT_INSTALLED);
|
|
21
21
|
}
|
|
22
22
|
if (!commandAgentTunnelTcp.agentStatus) {
|
|
23
23
|
output_1.default.exitError(texts_1.ERR_AGENT_NOT_RUNNING);
|
|
24
24
|
}
|
|
25
|
-
const prepared = await
|
|
25
|
+
const prepared = await Cfg.prepareTunnel(tunnel_1.TUNNEL_TYPE.TCP, target, options, true);
|
|
26
26
|
try {
|
|
27
27
|
await output_1.default.spinner(texts_1.TXT_OPENING_TUNNEL);
|
|
28
|
-
const api = new
|
|
28
|
+
const api = new ApiAgent(commandAgentTunnelTcp.agentPort || 0);
|
|
29
29
|
const data = await api.addTunnel(prepared);
|
|
30
30
|
if (options.follow) {
|
|
31
31
|
const ws = await api.socketTunnel(data.id);
|
|
32
|
-
const tunnel = new
|
|
32
|
+
const tunnel = new AgentSocketTunnel(ws, data.id);
|
|
33
33
|
await tunnel.waitForReady();
|
|
34
34
|
output_1.default.tunnel(tunnel);
|
|
35
35
|
}
|
|
@@ -5,31 +5,31 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const utils_1 = require("../../../utils");
|
|
7
7
|
const output_1 = __importDefault(require("../../../output"));
|
|
8
|
-
const cfg_1 = __importDefault(require("../../../tunnel/cfg"));
|
|
9
8
|
const texts_1 = require("../../../texts");
|
|
10
|
-
const tunnel_1 =
|
|
11
|
-
const agent_1 = __importDefault(require("../../../tunnel/api/agent"));
|
|
12
|
-
const tunnel_2 = require("../../../types/tunnel");
|
|
9
|
+
const tunnel_1 = require("../../../types/tunnel");
|
|
13
10
|
const commandAgentTunnelTls = (0, utils_1.getBasicCommandTls)();
|
|
14
11
|
commandAgentTunnelTls.description(texts_1.DESC_COMMAND_TLS);
|
|
15
12
|
commandAgentTunnelTls.option('-f, --follow', texts_1.OPTION_FOLLOW);
|
|
16
13
|
commandAgentTunnelTls.argument('[host:port]', texts_1.OPTION_TARGET);
|
|
17
14
|
commandAgentTunnelTls.addHelpText('after', `\nEXAMPLES:${(0, texts_1.EXAMPLE_TUNNEL_TLS)(true)}`);
|
|
18
15
|
commandAgentTunnelTls.action(async (target, options) => {
|
|
16
|
+
const ApiAgent = require('../../../tunnel/api/agent').default;
|
|
17
|
+
const AgentSocketTunnel = require('../../../agent/socket/tunnel').default;
|
|
18
|
+
const Cfg = require('../../../tunnel/cfg').default;
|
|
19
19
|
if (!commandAgentTunnelTls.agentInstalled) {
|
|
20
20
|
output_1.default.exitError(texts_1.ERR_AGENT_NOT_INSTALLED);
|
|
21
21
|
}
|
|
22
22
|
if (!commandAgentTunnelTls.agentStatus) {
|
|
23
23
|
output_1.default.exitError(texts_1.ERR_AGENT_NOT_RUNNING);
|
|
24
24
|
}
|
|
25
|
-
const prepared = await
|
|
25
|
+
const prepared = await Cfg.prepareTunnel(tunnel_1.TUNNEL_TYPE.TLS, target, options, true);
|
|
26
26
|
try {
|
|
27
27
|
await output_1.default.spinner(texts_1.TXT_OPENING_TUNNEL);
|
|
28
|
-
const api = new
|
|
28
|
+
const api = new ApiAgent(commandAgentTunnelTls.agentPort || 0);
|
|
29
29
|
const data = await api.addTunnel(prepared);
|
|
30
30
|
if (options.follow) {
|
|
31
31
|
const ws = await api.socketTunnel(data.id);
|
|
32
|
-
const tunnel = new
|
|
32
|
+
const tunnel = new AgentSocketTunnel(ws, data.id);
|
|
33
33
|
await tunnel.waitForReady();
|
|
34
34
|
output_1.default.tunnel(tunnel);
|
|
35
35
|
}
|
|
@@ -5,14 +5,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const output_1 = __importDefault(require("../../output"));
|
|
7
7
|
const texts_1 = require("../../texts");
|
|
8
|
-
const manager_1 = __importDefault(require("../../agent/manager"));
|
|
9
|
-
const buddy_1 = __importDefault(require("../../tunnel/api/buddy"));
|
|
10
8
|
const utils_1 = require("../../utils");
|
|
11
|
-
const agent_1 = __importDefault(require("../../tunnel/api/agent"));
|
|
12
9
|
const commandAgentUninstall = (0, utils_1.newCommand)('uninstall', texts_1.DESC_COMMAND_AGENT_UNINSTALL);
|
|
13
10
|
commandAgentUninstall.option('-f, --force', texts_1.OPTION_CONFIRM_FORCE);
|
|
14
11
|
commandAgentUninstall.action(async (options) => {
|
|
15
|
-
const
|
|
12
|
+
const AgentManager = require('../../agent/manager').default;
|
|
13
|
+
const ApiBuddy = require('../../tunnel/api/buddy').default;
|
|
14
|
+
const ApiAgent = require('../../tunnel/api/agent').default;
|
|
15
|
+
const hasAdminRights = await AgentManager.system.hasAdminRights();
|
|
16
16
|
if (!hasAdminRights) {
|
|
17
17
|
output_1.default.exitError(texts_1.ERR_AGENT_ADMIN_RIGHTS);
|
|
18
18
|
}
|
|
@@ -20,45 +20,45 @@ commandAgentUninstall.action(async (options) => {
|
|
|
20
20
|
if (!confirmed)
|
|
21
21
|
output_1.default.exitNormal();
|
|
22
22
|
try {
|
|
23
|
-
const api = new
|
|
23
|
+
const api = new ApiAgent(commandAgentUninstall.agentPort || 0);
|
|
24
24
|
await api.markInactive();
|
|
25
25
|
}
|
|
26
26
|
catch {
|
|
27
27
|
// do nothing
|
|
28
28
|
}
|
|
29
29
|
try {
|
|
30
|
-
await
|
|
30
|
+
await AgentManager.system.uninstall();
|
|
31
31
|
}
|
|
32
32
|
catch {
|
|
33
33
|
// do nothing
|
|
34
34
|
}
|
|
35
35
|
try {
|
|
36
|
-
await
|
|
36
|
+
await AgentManager.system.killStandaloneProc();
|
|
37
37
|
}
|
|
38
38
|
catch {
|
|
39
39
|
// do nothing
|
|
40
40
|
}
|
|
41
41
|
try {
|
|
42
|
-
const json =
|
|
43
|
-
await
|
|
42
|
+
const json = AgentManager.system.loadSystemConfig();
|
|
43
|
+
await ApiBuddy.unregister(json.id, json.host, json.token);
|
|
44
44
|
}
|
|
45
45
|
catch {
|
|
46
46
|
// do nothing
|
|
47
47
|
}
|
|
48
48
|
try {
|
|
49
|
-
|
|
49
|
+
AgentManager.system.clearSystemFiles();
|
|
50
50
|
}
|
|
51
51
|
catch {
|
|
52
52
|
// do nothing
|
|
53
53
|
}
|
|
54
54
|
try {
|
|
55
|
-
|
|
55
|
+
AgentManager.system.clearAgentFiles();
|
|
56
56
|
}
|
|
57
57
|
catch {
|
|
58
58
|
// do nothing
|
|
59
59
|
}
|
|
60
60
|
try {
|
|
61
|
-
|
|
61
|
+
AgentManager.system.clearNewAgentFiles();
|
|
62
62
|
}
|
|
63
63
|
catch {
|
|
64
64
|
// do nothing
|
|
@@ -5,14 +5,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const texts_1 = require("../../texts");
|
|
7
7
|
const output_1 = __importDefault(require("../../output"));
|
|
8
|
-
const wait_1 = __importDefault(require("../../agent/wait"));
|
|
9
|
-
const manager_1 = __importDefault(require("../../agent/manager"));
|
|
10
8
|
const utils_1 = require("../../utils");
|
|
11
|
-
const agent_1 = __importDefault(require("../../tunnel/api/agent"));
|
|
12
9
|
const commandAgentUpdate = (0, utils_1.newCommand)('update', texts_1.DESC_COMMAND_AGENT_UPDATE);
|
|
13
10
|
commandAgentUpdate.hideVersionUpdate = true;
|
|
14
11
|
commandAgentUpdate.action(async () => {
|
|
15
|
-
const
|
|
12
|
+
const AgentManager = require('../../agent/manager').default;
|
|
13
|
+
const ApiAgent = require('../../tunnel/api/agent').default;
|
|
14
|
+
const waitUntilAgentEnabled = require('../../agent/wait').default;
|
|
15
|
+
const hasAdminRights = await AgentManager.system.hasAdminRights();
|
|
16
16
|
if (!hasAdminRights) {
|
|
17
17
|
output_1.default.exitError(texts_1.ERR_AGENT_ADMIN_RIGHTS);
|
|
18
18
|
}
|
|
@@ -22,14 +22,14 @@ commandAgentUpdate.action(async () => {
|
|
|
22
22
|
output_1.default.normal(texts_1.TXT_UPDATING_AGENT);
|
|
23
23
|
if (commandAgentUpdate.agentStandalone) {
|
|
24
24
|
// app
|
|
25
|
-
await
|
|
26
|
-
|
|
25
|
+
await AgentManager.system.killStandaloneProc();
|
|
26
|
+
AgentManager.system.startStandaloneProc();
|
|
27
27
|
}
|
|
28
28
|
else {
|
|
29
29
|
try {
|
|
30
|
-
await
|
|
31
|
-
const api = new
|
|
32
|
-
await (
|
|
30
|
+
await AgentManager.system.update();
|
|
31
|
+
const api = new ApiAgent(commandAgentUpdate.agentPort || 0);
|
|
32
|
+
await waitUntilAgentEnabled(api, 15000, () => {
|
|
33
33
|
output_1.default.exitError(texts_1.ERR_SWW_AGENT_UPDATING);
|
|
34
34
|
}, () => {
|
|
35
35
|
output_1.default.exitSuccess(texts_1.TXT_AGENT_UPDATED);
|
|
@@ -295,11 +295,12 @@ commandApiInfo.option('--response-schema <schema>', texts_1.OPT_COMMAND_API_INFO
|
|
|
295
295
|
commandApiInfo.argument('<method>', texts_1.OPT_COMMAND_API_INFO_METHOD);
|
|
296
296
|
commandApiInfo.argument('<url>', texts_1.OPT_COMMAND_API_INFO_URL);
|
|
297
297
|
commandApiInfo.action(async (fm, filterUrl, options) => {
|
|
298
|
+
const { fetchOpenApiSchema } = require('../../openapi');
|
|
298
299
|
const workspace = input_1.default.restApiWorkspace(options.workspace);
|
|
299
300
|
const project = input_1.default.restApiProject(options.project, true);
|
|
300
301
|
const filterMethod = input_1.default.restApiMethod(fm, false);
|
|
301
302
|
const client = input_1.default.restApiTokenClient(true);
|
|
302
|
-
const schema = await
|
|
303
|
+
const schema = await fetchOpenApiSchema(client.baseUrl);
|
|
303
304
|
const paths = schema.paths || {};
|
|
304
305
|
Object.keys(paths).forEach((url) => {
|
|
305
306
|
const preparedUrl = (0, utils_1.openApiPrepareUrl)(url, workspace, project);
|
|
@@ -32,12 +32,13 @@ commandApiList.option('-p, --project <name>', texts_1.OPTION_REST_API_PROJECT);
|
|
|
32
32
|
commandApiList.option('-m, --method <method>', texts_1.OPT_COMMAND_API_LIST_METHOD);
|
|
33
33
|
commandApiList.option('-s, --search <phrase>', texts_1.OPT_COMMAND_API_LIST_SEARCH);
|
|
34
34
|
commandApiList.action(async (options) => {
|
|
35
|
+
const { fetchOpenApiSchema } = require('../../openapi');
|
|
35
36
|
const workspace = input_1.default.restApiWorkspace(options.workspace);
|
|
36
37
|
const project = input_1.default.restApiProject(options.project, true);
|
|
37
38
|
const filterMethod = input_1.default.restApiMethod(options.method);
|
|
38
39
|
const filter = options.search;
|
|
39
40
|
const client = input_1.default.restApiTokenClient(true);
|
|
40
|
-
const schema = await
|
|
41
|
+
const schema = await fetchOpenApiSchema(client.baseUrl);
|
|
41
42
|
const paths = schema.paths || {};
|
|
42
43
|
Object.keys(paths).forEach((url) => {
|
|
43
44
|
if (!filter || url.includes(filter)) {
|
|
@@ -10,7 +10,6 @@ const input_1 = __importDefault(require("../../input"));
|
|
|
10
10
|
const node_fs_1 = __importDefault(require("node:fs"));
|
|
11
11
|
const promises_1 = require("node:stream/promises");
|
|
12
12
|
const path_1 = require("path");
|
|
13
|
-
const undici_1 = require("undici");
|
|
14
13
|
const tryReadFile = async (filePath) => {
|
|
15
14
|
try {
|
|
16
15
|
return await node_fs_1.default.promises.readFile(filePath, 'utf8');
|
|
@@ -60,7 +59,8 @@ const prepareEncodedBody = async (params) => {
|
|
|
60
59
|
return obj;
|
|
61
60
|
};
|
|
62
61
|
const prepareMultipartBody = async (params) => {
|
|
63
|
-
const
|
|
62
|
+
const { FormData } = require('undici');
|
|
63
|
+
const form = new FormData();
|
|
64
64
|
for (let i = 0; i < params.length; i += 1) {
|
|
65
65
|
const s = params[i].split(':');
|
|
66
66
|
if (s.length !== 2) {
|