@routr/ctl 2.15.4 → 2.16.0

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 (71) hide show
  1. package/README.md +170 -120
  2. package/bin/dev +12 -12
  3. package/bin/run +5 -3
  4. package/dist/base.d.ts +3 -3
  5. package/dist/base.js +1 -1
  6. package/dist/commands/acl/create.js +7 -7
  7. package/dist/commands/acl/delete.d.ts +1 -1
  8. package/dist/commands/acl/delete.js +6 -6
  9. package/dist/commands/acl/describe.d.ts +2 -4
  10. package/dist/commands/acl/describe.js +5 -9
  11. package/dist/commands/acl/get.d.ts +6 -8
  12. package/dist/commands/acl/get.js +9 -10
  13. package/dist/commands/acl/update.d.ts +2 -4
  14. package/dist/commands/acl/update.js +8 -8
  15. package/dist/commands/agents/create.js +7 -7
  16. package/dist/commands/agents/delete.js +1 -1
  17. package/dist/commands/agents/describe.d.ts +2 -4
  18. package/dist/commands/agents/describe.js +5 -9
  19. package/dist/commands/agents/get.d.ts +6 -8
  20. package/dist/commands/agents/get.js +9 -10
  21. package/dist/commands/agents/update.d.ts +2 -4
  22. package/dist/commands/agents/update.js +11 -12
  23. package/dist/commands/credentials/create.js +7 -7
  24. package/dist/commands/credentials/delete.js +1 -1
  25. package/dist/commands/credentials/describe.d.ts +2 -4
  26. package/dist/commands/credentials/describe.js +6 -7
  27. package/dist/commands/credentials/get.d.ts +6 -8
  28. package/dist/commands/credentials/get.js +9 -10
  29. package/dist/commands/credentials/update.d.ts +2 -4
  30. package/dist/commands/credentials/update.js +9 -10
  31. package/dist/commands/domains/create.js +7 -7
  32. package/dist/commands/domains/delete.js +1 -1
  33. package/dist/commands/domains/describe.d.ts +2 -4
  34. package/dist/commands/domains/describe.js +6 -7
  35. package/dist/commands/domains/get.d.ts +6 -8
  36. package/dist/commands/domains/get.js +9 -10
  37. package/dist/commands/domains/update.d.ts +2 -4
  38. package/dist/commands/domains/update.js +10 -11
  39. package/dist/commands/numbers/create.js +7 -7
  40. package/dist/commands/numbers/delete.js +1 -1
  41. package/dist/commands/numbers/describe.d.ts +2 -4
  42. package/dist/commands/numbers/describe.js +6 -7
  43. package/dist/commands/numbers/get.d.ts +6 -8
  44. package/dist/commands/numbers/get.js +9 -10
  45. package/dist/commands/numbers/update.d.ts +2 -4
  46. package/dist/commands/numbers/update.js +10 -11
  47. package/dist/commands/peers/create.js +7 -7
  48. package/dist/commands/peers/delete.js +1 -1
  49. package/dist/commands/peers/describe.d.ts +2 -4
  50. package/dist/commands/peers/describe.js +5 -9
  51. package/dist/commands/peers/get.d.ts +6 -8
  52. package/dist/commands/peers/get.js +9 -10
  53. package/dist/commands/peers/update.d.ts +2 -4
  54. package/dist/commands/peers/update.js +11 -12
  55. package/dist/commands/trunks/create.js +7 -7
  56. package/dist/commands/trunks/delete.js +1 -1
  57. package/dist/commands/trunks/describe.d.ts +2 -4
  58. package/dist/commands/trunks/describe.js +5 -9
  59. package/dist/commands/trunks/get.d.ts +6 -8
  60. package/dist/commands/trunks/get.js +9 -10
  61. package/dist/commands/trunks/update.d.ts +2 -4
  62. package/dist/commands/trunks/update.js +12 -13
  63. package/dist/delete.d.ts +2 -2
  64. package/dist/delete.js +10 -8
  65. package/dist/help.js +2 -1
  66. package/dist/lib/table.d.ts +15 -0
  67. package/dist/lib/table.js +75 -0
  68. package/dist/lib/wait.d.ts +1 -0
  69. package/dist/lib/wait.js +25 -0
  70. package/oclif.manifest.json +1164 -765
  71. package/package.json +15 -14
@@ -0,0 +1,75 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.printTable = printTable;
7
+ /*
8
+ * Copyright (C) 2024 by Fonoster Inc (https://fonoster.com)
9
+ * http://github.com/fonoster
10
+ *
11
+ * This file is part of Routr.
12
+ *
13
+ * Licensed under the MIT License (the "License");
14
+ * you may not use this file except in compliance with
15
+ * the License. You may obtain a copy of the License at
16
+ *
17
+ * https://opensource.org/licenses/MIT
18
+ *
19
+ * Unless required by applicable law or agreed to in writing, software
20
+ * distributed under the License is distributed on an "AS IS" BASIS,
21
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22
+ * See the License for the specific language governing permissions and
23
+ * limitations under the License.
24
+ */
25
+ /* eslint-disable require-jsdoc */
26
+ const cliui_1 = __importDefault(require("cliui"));
27
+ // Number of spaces rendered between adjacent columns.
28
+ const COLUMN_GUTTER = 1;
29
+ // Title-cases a camelCase column key: "telUrl" -> "Tel Url", "ref" -> "Ref".
30
+ function defaultHeader(key) {
31
+ return key
32
+ .replace(/([a-z0-9])([A-Z])/g, "$1 $2")
33
+ .replace(/[_-]+/g, " ")
34
+ .replace(/\b\w/g, (c) => c.toUpperCase());
35
+ }
36
+ function cellToString(value) {
37
+ if (value === null || value === undefined)
38
+ return "";
39
+ return String(value);
40
+ }
41
+ // Minimal, dependency-light reimplementation of the subset of the old
42
+ // `CliUx.ux.table` API used across the CLI. Renders left-aligned, space-padded
43
+ // columns so the output remains grep-friendly (no wrapping, no borders).
44
+ function printTable(data, columns, options = {}) {
45
+ var _a;
46
+ const printLine = (_a = options.printLine) !== null && _a !== void 0 ? _a : ((line) => console.log(line));
47
+ const showHeader = !options["no-header"];
48
+ // Resolve the visible columns honoring the `extended` flag.
49
+ const visible = Object.entries(columns).filter(([, col]) => !col.extended || options.extended === true);
50
+ if (visible.length === 0)
51
+ return;
52
+ const headers = visible.map(([key, col]) => { var _a; return (_a = col.header) !== null && _a !== void 0 ? _a : defaultHeader(key); });
53
+ const rows = data.map((row) => visible.map(([key, col]) => cellToString(col.get ? col.get(row) : row[key])));
54
+ // Natural width per column, clamped by the optional minWidth.
55
+ const widths = visible.map(([, col], i) => {
56
+ var _a;
57
+ return rows.reduce((width, row) => Math.max(width, row[i].length), Math.max(headers[i].length, (_a = col.minWidth) !== null && _a !== void 0 ? _a : 0));
58
+ });
59
+ const ui = (0, cliui_1.default)({ width: widths.reduce((a, b) => a + b + COLUMN_GUTTER, 0) });
60
+ const toCells = (texts) => texts.map((text, i) => ({
61
+ text,
62
+ width: widths[i] + COLUMN_GUTTER,
63
+ padding: [0, 0, 0, 0]
64
+ }));
65
+ if (showHeader) {
66
+ ui.div(...toCells(headers));
67
+ }
68
+ rows.forEach((row) => ui.div(...toCells(row)));
69
+ // cliui pads trailing whitespace; trim each line to keep output tidy.
70
+ printLine(ui
71
+ .toString()
72
+ .split("\n")
73
+ .map((line) => line.replace(/\s+$/, ""))
74
+ .join("\n"));
75
+ }
@@ -0,0 +1 @@
1
+ export declare const wait: (ms?: number) => Promise<void>;
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ /*
3
+ * Copyright (C) 2024 by Fonoster Inc (https://fonoster.com)
4
+ * http://github.com/fonoster
5
+ *
6
+ * This file is part of Routr.
7
+ *
8
+ * Licensed under the MIT License (the "License");
9
+ * you may not use this file except in compliance with
10
+ * the License. You may obtain a copy of the License at
11
+ *
12
+ * https://opensource.org/licenses/MIT
13
+ *
14
+ * Unless required by applicable law or agreed to in writing, software
15
+ * distributed under the License is distributed on an "AS IS" BASIS,
16
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
+ * See the License for the specific language governing permissions and
18
+ * limitations under the License.
19
+ */
20
+ /* eslint-disable require-jsdoc */
21
+ Object.defineProperty(exports, "__esModule", { value: true });
22
+ exports.wait = void 0;
23
+ // Replacement for the removed `CliUx.ux.wait`; used to let spinners settle.
24
+ const wait = (ms = 1000) => new Promise((resolve) => setTimeout(resolve, ms));
25
+ exports.wait = wait;