@peerbit/server 8.0.34 → 8.0.37

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 (50) hide show
  1. package/dist/src/cli.d.ts.map +1 -1
  2. package/dist/src/cli.js +26 -5
  3. package/dist/src/cli.js.map +1 -1
  4. package/dist/tsconfig.tsbuildinfo +1 -1
  5. package/package.json +9 -7
  6. package/src/cli.ts +28 -8
  7. package/dist/test/api.spec.d.ts +0 -2
  8. package/dist/test/api.spec.d.ts.map +0 -1
  9. package/dist/test/api.spec.js +0 -667
  10. package/dist/test/api.spec.js.map +0 -1
  11. package/dist/test/cli.spec.d.ts +0 -2
  12. package/dist/test/cli.spec.d.ts.map +0 -1
  13. package/dist/test/cli.spec.js +0 -406
  14. package/dist/test/cli.spec.js.map +0 -1
  15. package/dist/test/client.spec.d.ts +0 -2
  16. package/dist/test/client.spec.d.ts.map +0 -1
  17. package/dist/test/client.spec.js +0 -23
  18. package/dist/test/client.spec.js.map +0 -1
  19. package/dist/test/config.spec.d.ts +0 -2
  20. package/dist/test/config.spec.d.ts.map +0 -1
  21. package/dist/test/config.spec.js +0 -10
  22. package/dist/test/config.spec.js.map +0 -1
  23. package/dist/test/docker.spec.d.ts +0 -2
  24. package/dist/test/docker.spec.d.ts.map +0 -1
  25. package/dist/test/docker.spec.js +0 -822
  26. package/dist/test/docker.spec.js.map +0 -1
  27. package/dist/test/domain-lease.spec.d.ts +0 -2
  28. package/dist/test/domain-lease.spec.d.ts.map +0 -1
  29. package/dist/test/domain-lease.spec.js +0 -530
  30. package/dist/test/domain-lease.spec.js.map +0 -1
  31. package/dist/test/domain.integration.spec.d.ts +0 -2
  32. package/dist/test/domain.integration.spec.d.ts.map +0 -1
  33. package/dist/test/domain.integration.spec.js +0 -386
  34. package/dist/test/domain.integration.spec.js.map +0 -1
  35. package/dist/test/remotes.spec.d.ts +0 -2
  36. package/dist/test/remotes.spec.d.ts.map +0 -1
  37. package/dist/test/remotes.spec.js +0 -79
  38. package/dist/test/remotes.spec.js.map +0 -1
  39. package/dist/test/signed-request.spec.d.ts +0 -2
  40. package/dist/test/signed-request.spec.d.ts.map +0 -1
  41. package/dist/test/signed-request.spec.js +0 -216
  42. package/dist/test/signed-request.spec.js.map +0 -1
  43. package/dist/test/trust.spec.d.ts +0 -2
  44. package/dist/test/trust.spec.d.ts.map +0 -1
  45. package/dist/test/trust.spec.js +0 -29
  46. package/dist/test/trust.spec.js.map +0 -1
  47. package/dist/test/utils.d.ts +0 -3
  48. package/dist/test/utils.d.ts.map +0 -1
  49. package/dist/test/utils.js +0 -6
  50. package/dist/test/utils.js.map +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@peerbit/server",
3
- "version": "8.0.34",
3
+ "version": "8.0.37",
4
4
  "author": "Peerbit contributors",
5
5
  "repository": {
6
6
  "type": "git",
@@ -31,6 +31,7 @@
31
31
  },
32
32
  "files": [
33
33
  "dist",
34
+ "!dist/test",
34
35
  "src",
35
36
  "src/nginx-template.conf",
36
37
  "!src/test",
@@ -66,7 +67,7 @@
66
67
  "shx": "^0.3.4",
67
68
  "uuid": "^11.1.1",
68
69
  "@peerbit/test-lib": "0.0.1",
69
- "@peerbit/test-utils": "3.1.44"
70
+ "@peerbit/test-utils": "3.1.47"
70
71
  },
71
72
  "dependencies": {
72
73
  "@dao-xyz/borsh": "^6.0.0",
@@ -79,6 +80,7 @@
79
80
  "abstract-level": "^3.1.0",
80
81
  "axios": "^1.18.1",
81
82
  "chalk": "^5.3.0",
83
+ "cli-table3": "^0.6.5",
82
84
  "level": "^10.0.0",
83
85
  "libsodium-wrappers": "0.7.15",
84
86
  "memory-level": "^3.1.0",
@@ -86,15 +88,15 @@
86
88
  "proper-lockfile": "^4.1.2",
87
89
  "tar-stream": "^3.1.7",
88
90
  "tmp": "^0.2.7",
89
- "tty-table": "^4.2.1",
90
91
  "uint8arrays": "^5.1.0",
92
+ "wrap-ansi": "^8.1.0",
91
93
  "yargs": "^17.7.2",
92
- "@peerbit/blocks": "4.3.2",
94
+ "@peerbit/blocks": "4.3.3",
93
95
  "@peerbit/crypto": "3.1.6",
94
- "@peerbit/pubsub": "5.4.8",
95
- "@peerbit/program": "6.0.63",
96
+ "@peerbit/pubsub": "5.4.11",
97
+ "@peerbit/program": "6.0.66",
96
98
  "@peerbit/time": "3.0.1",
97
- "peerbit": "5.4.5"
99
+ "peerbit": "5.4.8"
98
100
  },
99
101
  "bugs": {
100
102
  "url": "https://github.com/dao-xyz/peerbit/issues"
package/src/cli.ts CHANGED
@@ -4,11 +4,12 @@ import type { PeerId } from "@libp2p/interface";
4
4
  import { peerIdFromString } from "@libp2p/peer-id";
5
5
  import { toBase64 } from "@peerbit/crypto";
6
6
  import chalk from "chalk";
7
+ import Table from "cli-table3";
7
8
  import fs from "fs";
8
9
  import sodium from "libsodium-wrappers";
9
10
  import path from "path";
10
11
  import readline from "readline";
11
- import Table from "tty-table";
12
+ import wrapAnsi from "wrap-ansi";
12
13
  import type { Argv } from "yargs";
13
14
  import { createClient } from "./client.js";
14
15
  import {
@@ -540,13 +541,32 @@ export const cli = async (args?: string[]) => {
540
541
  ];
541
542
  rows.push(row);
542
543
  }
543
- const table = Table(
544
- ["Name", "Group", "Origin", "Status", "Address"].map((x) => {
545
- return { value: x, align: "left" };
546
- }),
547
- rows,
548
- );
549
- console.log(table.render());
544
+ const requestedColumns =
545
+ process.stdout.columns || Number(process.env.COLUMNS) || 80;
546
+ const columns =
547
+ Number.isFinite(requestedColumns) && requestedColumns > 0
548
+ ? Math.floor(requestedColumns)
549
+ : 80;
550
+ // Five padded columns and six borders; keep at least two display columns per cell.
551
+ const contentColumns = Math.max(10, columns - 16);
552
+ const width = Math.floor(contentColumns / 5);
553
+ const contentWidths = [
554
+ width,
555
+ width,
556
+ width,
557
+ width,
558
+ contentColumns - width * 4,
559
+ ];
560
+ const wrap = (value: string, index: number) =>
561
+ wrapAnsi(value, contentWidths[index], { hard: true, trim: false });
562
+ const table = new Table({
563
+ head: ["Name", "Group", "Origin", "Status", "Address"].map(wrap),
564
+ colWidths: contentWidths.map((width) => width + 2),
565
+ colAligns: ["left", "left", "left", "left", "left"],
566
+ style: { head: ["yellow"], border: [] },
567
+ });
568
+ for (const row of rows) table.push(row.map(wrap));
569
+ console.log(table.toString());
550
570
  } else {
551
571
  console.log("No remotes found!");
552
572
  }
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=api.spec.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"api.spec.d.ts","sourceRoot":"","sources":["../../test/api.spec.ts"],"names":[],"mappings":""}