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.
Files changed (51) hide show
  1. package/distTs/package.json +1 -1
  2. package/distTs/src/api/client.js +129 -60
  3. package/distTs/src/command/agent/debug.js +22 -1
  4. package/distTs/src/command/agent/disable.js +21 -2
  5. package/distTs/src/command/agent/enable.js +21 -2
  6. package/distTs/src/command/agent/proxy/disable.js +16 -2
  7. package/distTs/src/command/agent/proxy/enable.js +16 -2
  8. package/distTs/src/command/agent/proxy/status.js +32 -13
  9. package/distTs/src/command/agent/remote.js +219 -0
  10. package/distTs/src/command/agent/status.js +78 -48
  11. package/distTs/src/command/agent/tags/get.js +37 -13
  12. package/distTs/src/command/agent/tags/set.js +30 -9
  13. package/distTs/src/command/agent/target/disable.js +16 -2
  14. package/distTs/src/command/agent/target/enable.js +16 -2
  15. package/distTs/src/command/agent/target/status.js +32 -13
  16. package/distTs/src/command/agent/tunnel/disable.js +16 -2
  17. package/distTs/src/command/agent/tunnel/enable.js +16 -2
  18. package/distTs/src/command/agent/tunnel/http.js +21 -0
  19. package/distTs/src/command/agent/tunnel/list.js +28 -6
  20. package/distTs/src/command/agent/tunnel/remove.js +29 -1
  21. package/distTs/src/command/agent/tunnel/start.js +23 -0
  22. package/distTs/src/command/agent/tunnel/status.js +50 -13
  23. package/distTs/src/command/agent/tunnel/tcp.js +21 -0
  24. package/distTs/src/command/agent/tunnel/tls.js +21 -0
  25. package/distTs/src/command/agent/update.js +17 -1
  26. package/distTs/src/command/agent/version.js +28 -5
  27. package/distTs/src/command/distro/create.js +11 -6
  28. package/distTs/src/command/distro/delete.js +6 -13
  29. package/distTs/src/command/distro/get.js +6 -13
  30. package/distTs/src/command/distro/list.js +6 -6
  31. package/distTs/src/command/distro/open.js +5 -10
  32. package/distTs/src/command/distro/route/create.js +6 -14
  33. package/distTs/src/command/distro/route/delete.js +6 -13
  34. package/distTs/src/command/distro/route/get.js +9 -14
  35. package/distTs/src/command/distro/route/list.js +6 -13
  36. package/distTs/src/command/distro/route/open.js +5 -10
  37. package/distTs/src/command/distro/route/purge.js +42 -0
  38. package/distTs/src/command/distro/route/update.js +8 -15
  39. package/distTs/src/command/distro/route.js +3 -0
  40. package/distTs/src/command/distro/scope.js +77 -0
  41. package/distTs/src/command/distro/update.js +5 -13
  42. package/distTs/src/command/distro.js +1 -0
  43. package/distTs/src/command/pre.js +2 -1
  44. package/distTs/src/format.js +6 -0
  45. package/distTs/src/input.js +33 -10
  46. package/distTs/src/output.js +16 -0
  47. package/distTs/src/texts.js +273 -31
  48. package/distTs/src/tunnel/output/interactive/tunnel.js +67 -8
  49. package/distTs/src/tunnel/output/noninteractive/tunnel.js +8 -0
  50. package/distTs/src/types/serverAgent.js +2 -0
  51. package/package.json +1 -1
@@ -833,14 +833,7 @@ class OutputInteractiveTunnel {
833
833
  });
834
834
  return this.sprites.latency.height;
835
835
  }
836
- init() {
837
- this.viewPort = new termkit_no_lazy_require_1.default.ScreenBuffer({
838
- dst: this.terminal,
839
- width: this.terminal.width,
840
- height: this.terminal.height,
841
- x: 1,
842
- y: 1,
843
- });
836
+ createSprites() {
844
837
  this.createSpriteHeader();
845
838
  this.createSpriteStatus();
846
839
  this.createSpriteType();
@@ -855,6 +848,16 @@ class OutputInteractiveTunnel {
855
848
  this.createSpriteConnections();
856
849
  this.createSpriteRequests();
857
850
  this.createSpriteRequestInfo();
851
+ }
852
+ init() {
853
+ this.viewPort = new termkit_no_lazy_require_1.default.ScreenBuffer({
854
+ dst: this.terminal,
855
+ width: this.terminal.width,
856
+ height: this.terminal.height,
857
+ x: 1,
858
+ y: 1,
859
+ });
860
+ this.createSprites();
858
861
  this.terminal.grabInput();
859
862
  this.terminal.hideCursor();
860
863
  this.terminal.fullscreen(true);
@@ -906,5 +909,61 @@ class OutputInteractiveTunnel {
906
909
  this.init();
907
910
  this.animate();
908
911
  }
912
+ // The dashboard drawn once into the normal output, with its colours, for a
913
+ // tunnel read from the REST API (`agent tunnel status <id> --agent`): a
914
+ // snapshot with nothing to follow, so no full screen and no keys. Left out:
915
+ // the DNS row, a check this machine runs on a tunnel it serves, and the
916
+ // request log, which only the agent has.
917
+ snapshot() {
918
+ // only the rows drawn below (the request log sprites take the terminal's height)
919
+ this.createSpriteHeader();
920
+ this.createSpriteStatus();
921
+ this.createSpriteType();
922
+ this.createSpriteRegion();
923
+ this.createSpriteNote();
924
+ this.createSpriteTarget();
925
+ this.createSpriteIdentify();
926
+ this.createSpriteTerminate();
927
+ this.createSpriteEntry();
928
+ this.createSpriteLatency();
929
+ this.createSpriteConnections();
930
+ const viewPort = new termkit_no_lazy_require_1.default.ScreenBuffer({ width: ROW_LENGTH, height: 64 });
931
+ this.viewPort = viewPort;
932
+ let y = 0;
933
+ y += this.updateSpriteHeader(y);
934
+ y += this.updateSpriteStatus(y);
935
+ y += this.updateSpriteType(y);
936
+ y += this.updateSpriteRegion(y);
937
+ y += this.updateSpriteNote(y);
938
+ y += this.updateSpriteTarget(y);
939
+ y += this.updateSpriteIdentify(y);
940
+ y += this.updateSpriteTerminate(y);
941
+ y += this.updateSpriteEntry(y);
942
+ y += this.updateSpriteLatency(y);
943
+ y += this.updateSpriteConnections(y);
944
+ const lines = [];
945
+ for (let row = 0; row < y; row += 1) {
946
+ const offset = (x) => (row * viewPort.width + x) * viewPort.ITEM_SIZE;
947
+ let last = -1;
948
+ for (let x = 0; x < viewPort.width; x += 1) {
949
+ if (viewPort.readChar(viewPort.buffer, offset(x)) !== ' ')
950
+ last = x;
951
+ }
952
+ let line = '';
953
+ let attr = null;
954
+ for (let x = 0; x <= last; x += 1) {
955
+ const cellAttr = viewPort.readAttr(viewPort.buffer, offset(x));
956
+ if (cellAttr !== attr) {
957
+ line += viewPort.generateEscapeSequence(this.terminal, cellAttr);
958
+ attr = cellAttr;
959
+ }
960
+ line += viewPort.readChar(viewPort.buffer, offset(x));
961
+ }
962
+ if (last >= 0)
963
+ line += this.terminal.str.styleReset();
964
+ lines.push(line);
965
+ }
966
+ return lines.join('\n');
967
+ }
909
968
  }
910
969
  exports.default = OutputInteractiveTunnel;
@@ -64,6 +64,14 @@ class OutputNoninteractiveTunnel {
64
64
  tunnelRemoved() {
65
65
  this.onStopped();
66
66
  }
67
+ // The state line printed once, for a tunnel read from the REST API
68
+ // (`agent tunnel status <id> --agent`): there are no events to follow.
69
+ snapshot() {
70
+ if (this.tunnel.status === tunnel_1.TUNNEL_STATUS.OPEN)
71
+ this.onOpen(this.tunnel);
72
+ else
73
+ this.onClosed(this.tunnel);
74
+ }
67
75
  start() {
68
76
  this.tunnel.on(tunnel_1.TUNNEL_EVENT.OPEN, (t) => this.onOpen(t));
69
77
  this.tunnel.on(tunnel_1.TUNNEL_EVENT.CLOSED, (t) => this.onClosed(t));
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bdy",
3
3
  "preferGlobal": false,
4
- "version": "1.25.40-dev",
4
+ "version": "1.25.42-dev",
5
5
  "type": "commonjs",
6
6
  "license": "MIT",
7
7
  "homepage": "https://buddy.works/docs/cli",