bdy 1.25.40-dev → 1.25.42-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/api/client.js +129 -60
- package/distTs/src/command/agent/debug.js +22 -1
- package/distTs/src/command/agent/disable.js +21 -2
- package/distTs/src/command/agent/enable.js +21 -2
- package/distTs/src/command/agent/proxy/disable.js +16 -2
- package/distTs/src/command/agent/proxy/enable.js +16 -2
- package/distTs/src/command/agent/proxy/status.js +32 -13
- package/distTs/src/command/agent/remote.js +219 -0
- package/distTs/src/command/agent/status.js +78 -48
- package/distTs/src/command/agent/tags/get.js +37 -13
- package/distTs/src/command/agent/tags/set.js +30 -9
- package/distTs/src/command/agent/target/disable.js +16 -2
- package/distTs/src/command/agent/target/enable.js +16 -2
- package/distTs/src/command/agent/target/status.js +32 -13
- package/distTs/src/command/agent/tunnel/disable.js +16 -2
- package/distTs/src/command/agent/tunnel/enable.js +16 -2
- package/distTs/src/command/agent/tunnel/http.js +21 -0
- package/distTs/src/command/agent/tunnel/list.js +28 -6
- package/distTs/src/command/agent/tunnel/remove.js +29 -1
- package/distTs/src/command/agent/tunnel/start.js +23 -0
- package/distTs/src/command/agent/tunnel/status.js +50 -13
- package/distTs/src/command/agent/tunnel/tcp.js +21 -0
- package/distTs/src/command/agent/tunnel/tls.js +21 -0
- package/distTs/src/command/agent/update.js +17 -1
- package/distTs/src/command/agent/version.js +28 -5
- package/distTs/src/command/distro/create.js +11 -6
- package/distTs/src/command/distro/delete.js +6 -13
- package/distTs/src/command/distro/get.js +6 -13
- package/distTs/src/command/distro/list.js +6 -6
- package/distTs/src/command/distro/open.js +5 -10
- package/distTs/src/command/distro/route/create.js +6 -14
- package/distTs/src/command/distro/route/delete.js +6 -13
- package/distTs/src/command/distro/route/get.js +9 -14
- package/distTs/src/command/distro/route/list.js +6 -13
- package/distTs/src/command/distro/route/open.js +5 -10
- package/distTs/src/command/distro/route/purge.js +42 -0
- package/distTs/src/command/distro/route/update.js +8 -15
- package/distTs/src/command/distro/route.js +3 -0
- package/distTs/src/command/distro/scope.js +77 -0
- package/distTs/src/command/distro/update.js +5 -13
- package/distTs/src/command/distro.js +1 -0
- package/distTs/src/command/pre.js +2 -1
- package/distTs/src/format.js +6 -0
- package/distTs/src/input.js +33 -10
- package/distTs/src/output.js +16 -0
- package/distTs/src/texts.js +273 -31
- package/distTs/src/tunnel/output/interactive/tunnel.js +67 -8
- package/distTs/src/tunnel/output/noninteractive/tunnel.js +8 -0
- package/distTs/src/types/serverAgent.js +2 -0
- package/package.json +1 -1
package/distTs/src/input.js
CHANGED
|
@@ -750,7 +750,31 @@ class Input {
|
|
|
750
750
|
});
|
|
751
751
|
return list;
|
|
752
752
|
}
|
|
753
|
-
|
|
753
|
+
// `line` is where the route's distribution lives: an environment (its
|
|
754
|
+
// identifier, with the project of a project environment), a project, or the
|
|
755
|
+
// workspace (both empty). Artifacts and sandboxes are looked up along it,
|
|
756
|
+
// closest scope first - for an environment: the environment, its project,
|
|
757
|
+
// the workspace, as the backend accepts them.
|
|
758
|
+
static async routeTarget(client, workspace, line, targetList) {
|
|
759
|
+
const { project, environment } = line;
|
|
760
|
+
const lookupLines = [];
|
|
761
|
+
if (environment) {
|
|
762
|
+
lookupLines.push({ project: project || undefined, environment });
|
|
763
|
+
}
|
|
764
|
+
if (project)
|
|
765
|
+
lookupLines.push({ project });
|
|
766
|
+
const lookup = async (params, found) => {
|
|
767
|
+
let result = null;
|
|
768
|
+
for (const l of [...lookupLines, {}]) {
|
|
769
|
+
result = await client.getResourceByIdentifier(workspace, {
|
|
770
|
+
...l,
|
|
771
|
+
...params,
|
|
772
|
+
});
|
|
773
|
+
if (!result.domain || result[found])
|
|
774
|
+
break;
|
|
775
|
+
}
|
|
776
|
+
return result;
|
|
777
|
+
};
|
|
754
778
|
if (!targetList || !Array.isArray(targetList) || !targetList.length) {
|
|
755
779
|
output_1.default.exitError(texts_1.ERR_COMMAND_ROUTE_NO_TARGET);
|
|
756
780
|
}
|
|
@@ -840,11 +864,7 @@ class Input {
|
|
|
840
864
|
identifier = artifact;
|
|
841
865
|
version = utils_1.ARTIFACT_DEFAULT_VERSION;
|
|
842
866
|
}
|
|
843
|
-
|
|
844
|
-
if (!result.artifact_id && project) {
|
|
845
|
-
// try in workspace scope
|
|
846
|
-
result = await client.getArtifactVersionByIdentifier(workspace, null, identifier, version);
|
|
847
|
-
}
|
|
867
|
+
const result = await lookup({ artifact: identifier, artifact_version: version }, 'artifact_id');
|
|
848
868
|
if (!result.domain) {
|
|
849
869
|
output_1.default.exitError((0, texts_1.ERR_WRONG_ROUTE_TARGET)(str, texts_1.ERR_WORKSPACE_NOT_FOUND));
|
|
850
870
|
}
|
|
@@ -872,10 +892,13 @@ class Input {
|
|
|
872
892
|
if (!identifier || !endpoint) {
|
|
873
893
|
output_1.default.exitError((0, texts_1.ERR_WRONG_ROUTE_TARGET)(str, 'sandbox wrong format (identifier:endpoint)'));
|
|
874
894
|
}
|
|
875
|
-
if (!project) {
|
|
876
|
-
output_1.default.exitError((0, texts_1.ERR_WRONG_ROUTE_TARGET)(str, 'sandbox target can be used only in project'));
|
|
895
|
+
if (!project && !environment) {
|
|
896
|
+
output_1.default.exitError((0, texts_1.ERR_WRONG_ROUTE_TARGET)(str, 'sandbox target can be used only in project or environment'));
|
|
877
897
|
}
|
|
878
|
-
|
|
898
|
+
// a project distribution routes to its project's sandboxes only
|
|
899
|
+
const result = environment
|
|
900
|
+
? await lookup({ sandbox: identifier }, 'sandbox_id')
|
|
901
|
+
: await client.getSandboxByIdentifier(workspace, project, identifier);
|
|
879
902
|
if (!result.domain) {
|
|
880
903
|
output_1.default.exitError((0, texts_1.ERR_WRONG_ROUTE_TARGET)(str, texts_1.ERR_WORKSPACE_NOT_FOUND));
|
|
881
904
|
}
|
|
@@ -1356,7 +1379,7 @@ class Input {
|
|
|
1356
1379
|
output_1.default.exitError(texts_1.ERR_COMMAND_SCOPE_NO_ENVIRONMENT);
|
|
1357
1380
|
return scope;
|
|
1358
1381
|
}
|
|
1359
|
-
return output_1.default.exitError(texts_1.ERR_COMMAND_SCOPE);
|
|
1382
|
+
return output_1.default.exitError(allowEnv ? texts_1.ERR_COMMAND_SCOPE_WITH_ENVIRONMENT : texts_1.ERR_COMMAND_SCOPE);
|
|
1360
1383
|
}
|
|
1361
1384
|
if (allowEnv && environment)
|
|
1362
1385
|
return distro_1.SCOPE.ENVIRONMENT;
|
package/distTs/src/output.js
CHANGED
|
@@ -421,6 +421,22 @@ class Output {
|
|
|
421
421
|
static isTTY() {
|
|
422
422
|
return this.isStdInTTY() && this.isStdOutTTY();
|
|
423
423
|
}
|
|
424
|
+
// A tunnel read once (`agent tunnel status <id> --agent`): the same view as
|
|
425
|
+
// a followed one - the dashboard on a terminal, the state line otherwise -
|
|
426
|
+
// printed once, and the command ends.
|
|
427
|
+
static tunnelSnapshot(tunnel) {
|
|
428
|
+
this.killSpinner();
|
|
429
|
+
if (this.isTTY()) {
|
|
430
|
+
const OutputInteractiveTunnel = require('./tunnel/output/interactive/tunnel').default;
|
|
431
|
+
const oi = new OutputInteractiveTunnel(getTerminal(), tunnel);
|
|
432
|
+
getTerminal()(`${oi.snapshot()}\n`);
|
|
433
|
+
}
|
|
434
|
+
else {
|
|
435
|
+
const OutputNoninteractiveTunnel = require('./tunnel/output/noninteractive/tunnel').default;
|
|
436
|
+
new OutputNoninteractiveTunnel(getTerminal(), tunnel).snapshot();
|
|
437
|
+
}
|
|
438
|
+
this.exitNormal();
|
|
439
|
+
}
|
|
424
440
|
static tunnelJsonl(tunnel) {
|
|
425
441
|
this.killSpinner();
|
|
426
442
|
const OutputJsonlTunnel = require('./tunnel/output/noninteractive/tunnelJsonl').default;
|