@routr/ctl 2.15.4 → 2.17.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 +1171 -772
  71. package/package.json +15 -14
@@ -22,8 +22,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
22
22
  * limitations under the License.
23
23
  */
24
24
  /* eslint-disable require-jsdoc */
25
+ const core_1 = require("@oclif/core");
25
26
  const base_1 = require("../../base");
26
- const errors_1 = require("@oclif/core/lib/errors");
27
27
  const prettyjson_1 = require("prettyjson");
28
28
  const sdk_1 = __importDefault(require("@routr/sdk"));
29
29
  const moment_1 = __importDefault(require("moment"));
@@ -46,16 +46,15 @@ class DescribeCommand extends base_1.BaseCommand {
46
46
  this.log((0, prettyjson_1.render)(jsonObj, { noColor: true }));
47
47
  }
48
48
  catch (e) {
49
- throw new errors_1.CLIError(e.message);
49
+ throw new core_1.Errors.CLIError(e.message);
50
50
  }
51
51
  }
52
52
  }
53
53
  DescribeCommand.description = "shows details for a set of Credentials";
54
- DescribeCommand.args = [
55
- {
56
- name: "ref",
54
+ DescribeCommand.args = {
55
+ ref: core_1.Args.string({
57
56
  required: false,
58
57
  description: "reference to the set of Credentials"
59
- }
60
- ];
58
+ })
59
+ };
61
60
  exports.default = DescribeCommand;
@@ -1,20 +1,18 @@
1
+ import { Interfaces } from "@oclif/core";
1
2
  import { BaseCommand } from "../../base";
2
- import { CommandError } from "@oclif/core/lib/interfaces";
3
3
  export default class GetCommand extends BaseCommand {
4
4
  static readonly description = "Shows a list of paginated Credentials or a single set if ref is provided";
5
5
  static readonly examples: string[];
6
6
  static flags: {
7
- size: import("@oclif/core/lib/interfaces").OptionFlag<number>;
8
- extended: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
7
+ size: Interfaces.OptionFlag<number, Interfaces.CustomOptions>;
8
+ extended: Interfaces.BooleanFlag<boolean>;
9
9
  };
10
10
  static args: {
11
- name: string;
12
- required: boolean;
13
- description: string;
14
- }[];
11
+ ref: Interfaces.Arg<string, Record<string, unknown>>;
12
+ };
15
13
  run(): Promise<void>;
16
14
  catch(error: {
17
15
  code: number;
18
16
  message: string;
19
- } | CommandError): Promise<void>;
17
+ } | Interfaces.CommandError): Promise<void>;
20
18
  }
@@ -52,18 +52,18 @@ Object.defineProperty(exports, "__esModule", { value: true });
52
52
  * limitations under the License.
53
53
  */
54
54
  /* eslint-disable require-jsdoc */
55
- const grpc = __importStar(require("@grpc/grpc-js"));
56
55
  const core_1 = require("@oclif/core");
56
+ const table_1 = require("../../lib/table");
57
+ const grpc = __importStar(require("@grpc/grpc-js"));
57
58
  const base_1 = require("../../base");
58
59
  const utils_1 = require("../../utils");
59
60
  const common_1 = require("@routr/common");
60
- const errors_1 = require("@oclif/core/lib/errors");
61
61
  class GetCommand extends base_1.BaseCommand {
62
62
  async run() {
63
63
  const { args, flags } = await this.parse(GetCommand);
64
64
  const showTable = (request) => {
65
65
  const { showHeader, data, self, flags } = request;
66
- core_1.CliUx.ux.table(data, {
66
+ (0, table_1.printTable)(data, {
67
67
  ref: {
68
68
  minWidth: 7,
69
69
  extended: true
@@ -92,9 +92,9 @@ class GetCommand extends base_1.BaseCommand {
92
92
  // To be handled globally
93
93
  if ("code" in error && error.code === grpc.status.NOT_FOUND) {
94
94
  const { args } = await this.parse(GetCommand);
95
- throw new errors_1.CLIError("the resource you are looking for does not exist: " + args.ref);
95
+ throw new core_1.Errors.CLIError("the resource you are looking for does not exist: " + args.ref);
96
96
  }
97
- throw new errors_1.CLIError(error.message);
97
+ throw new core_1.Errors.CLIError(error.message);
98
98
  }
99
99
  }
100
100
  GetCommand.description = "Shows a list of paginated Credentials or a single set if ref is provided";
@@ -115,11 +115,10 @@ GetCommand.flags = {
115
115
  description: "extended output format"
116
116
  })
117
117
  };
118
- GetCommand.args = [
119
- {
120
- name: "ref",
118
+ GetCommand.args = {
119
+ ref: core_1.Args.string({
121
120
  required: false,
122
121
  description: "optional reference to a set of Credentials"
123
- }
124
- ];
122
+ })
123
+ };
125
124
  exports.default = GetCommand;
@@ -3,9 +3,7 @@ export default class UpdateCommand extends BaseCommand {
3
3
  static readonly description = "Updates an existing set of Credentials";
4
4
  static readonly examples: string[];
5
5
  static readonly args: {
6
- name: string;
7
- required: boolean;
8
- description: string;
9
- }[];
6
+ ref: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
7
+ };
10
8
  run(): Promise<void>;
11
9
  }
@@ -23,8 +23,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
23
23
  */
24
24
  /* eslint-disable require-jsdoc */
25
25
  const core_1 = require("@oclif/core");
26
+ const wait_1 = require("../../lib/wait");
26
27
  const base_1 = require("../../base");
27
- const errors_1 = require("@oclif/core/lib/errors");
28
28
  const sdk_1 = __importDefault(require("@routr/sdk"));
29
29
  // NOTE: Newer versions of inquirer have a bug that causes the following error:
30
30
  // (node:75345) [ERR_REQUIRE_ESM] Error Plugin: @routr/ctl [ERR_REQUIRE_ESM]: require() of ES Module
@@ -70,14 +70,14 @@ class UpdateCommand extends base_1.BaseCommand {
70
70
  this.warn("Aborted");
71
71
  }
72
72
  else {
73
- core_1.CliUx.ux.action.start(`Updating Credentials for ${answers.name}`);
73
+ core_1.ux.action.start(`Updating Credentials for ${answers.name}`);
74
74
  const acl = await api.updateCredentials(answers);
75
- await core_1.CliUx.ux.wait(1000);
76
- core_1.CliUx.ux.action.stop(acl.ref);
75
+ await (0, wait_1.wait)(1000);
76
+ core_1.ux.action.stop(acl.ref);
77
77
  }
78
78
  }
79
79
  catch (e) {
80
- throw new errors_1.CLIError(e.message);
80
+ throw new core_1.Errors.CLIError(e.message);
81
81
  }
82
82
  }
83
83
  }
@@ -87,11 +87,10 @@ UpdateCommand.examples = [
87
87
  Updating Credentials JDoe Credentials... 80181ca6-d4aa-4575-9375-8f72b07d5555
88
88
  `
89
89
  ];
90
- UpdateCommand.args = [
91
- {
92
- name: "ref",
90
+ UpdateCommand.args = {
91
+ ref: core_1.Args.string({
93
92
  required: true,
94
93
  description: "reference to an existing set of Credentials"
95
- }
96
- ];
94
+ })
95
+ };
97
96
  exports.default = UpdateCommand;
@@ -55,10 +55,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
55
55
  * limitations under the License.
56
56
  */
57
57
  /* eslint-disable require-jsdoc */
58
- const grpc = __importStar(require("@grpc/grpc-js"));
59
58
  const core_1 = require("@oclif/core");
59
+ const wait_1 = require("../../lib/wait");
60
+ const grpc = __importStar(require("@grpc/grpc-js"));
60
61
  const base_1 = require("../../base");
61
- const errors_1 = require("@oclif/core/lib/errors");
62
62
  const validators_1 = require("../../validators");
63
63
  const sdk_1 = __importDefault(require("@routr/sdk"));
64
64
  // NOTE: Newer versions of inquirer have a bug that causes the following error:
@@ -174,22 +174,22 @@ class CreateCommand extends base_1.BaseCommand {
174
174
  this.warn("Aborted");
175
175
  }
176
176
  else {
177
- core_1.CliUx.ux.action.start(`Creating Domain ${group1.name}`);
177
+ core_1.ux.action.start(`Creating Domain ${group1.name}`);
178
178
  const api = new sdk_1.default.Domains({ endpoint, insecure, cacert });
179
179
  const domains = await api.createDomain({
180
180
  ...group1,
181
181
  egressPolicies
182
182
  });
183
- await core_1.CliUx.ux.wait(1000);
184
- core_1.CliUx.ux.action.stop(domains.ref);
183
+ await (0, wait_1.wait)(1000);
184
+ core_1.ux.action.stop(domains.ref);
185
185
  }
186
186
  }
187
187
  catch (e) {
188
188
  if (e.code === grpc.status.ALREADY_EXISTS) {
189
- throw new errors_1.CLIError("This Domain already exist");
189
+ throw new core_1.Errors.CLIError("This Domain already exist");
190
190
  }
191
191
  else {
192
- throw new errors_1.CLIError(e.message);
192
+ throw new core_1.Errors.CLIError(e.message);
193
193
  }
194
194
  }
195
195
  }
@@ -26,7 +26,7 @@ const delete_1 = __importDefault(require("../../delete"));
26
26
  const sdk_1 = __importDefault(require("@routr/sdk"));
27
27
  class DeleteDomainCommand extends delete_1.default {
28
28
  async run() {
29
- const { flags } = await this.parse(DeleteDomainCommand);
29
+ const { flags } = await this.parse(delete_1.default);
30
30
  const { endpoint, insecure, cacert } = flags;
31
31
  await super.deleteResource(new sdk_1.default.Domains({ endpoint, insecure, cacert }), "deleteDomain");
32
32
  }
@@ -2,9 +2,7 @@ import { BaseCommand } from "../../base";
2
2
  export default class DescribeCommand extends BaseCommand {
3
3
  static readonly description = "show details of a Domain";
4
4
  static readonly args: {
5
- name: string;
6
- required: boolean;
7
- description: string;
8
- }[];
5
+ ref: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
6
+ };
9
7
  run(): Promise<void>;
10
8
  }
@@ -22,8 +22,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
22
22
  * limitations under the License.
23
23
  */
24
24
  /* eslint-disable require-jsdoc */
25
+ const core_1 = require("@oclif/core");
25
26
  const base_1 = require("../../base");
26
- const errors_1 = require("@oclif/core/lib/errors");
27
27
  const prettyjson_1 = require("prettyjson");
28
28
  const sdk_1 = __importDefault(require("@routr/sdk"));
29
29
  const moment_1 = __importDefault(require("moment"));
@@ -64,16 +64,15 @@ class DescribeCommand extends base_1.BaseCommand {
64
64
  this.log((0, prettyjson_1.render)(jsonObj, { noColor: true }));
65
65
  }
66
66
  catch (e) {
67
- throw new errors_1.CLIError(e.message);
67
+ throw new core_1.Errors.CLIError(e.message);
68
68
  }
69
69
  }
70
70
  }
71
71
  DescribeCommand.description = "show details of a Domain";
72
- DescribeCommand.args = [
73
- {
74
- name: "ref",
72
+ DescribeCommand.args = {
73
+ ref: core_1.Args.string({
75
74
  required: false,
76
75
  description: "reference to the Domain"
77
- }
78
- ];
76
+ })
77
+ };
79
78
  exports.default = DescribeCommand;
@@ -1,20 +1,18 @@
1
+ import { Interfaces } from "@oclif/core";
1
2
  import { BaseCommand } from "../../base";
2
- import { CommandError } from "@oclif/core/lib/interfaces";
3
3
  export default class GetDomainsCommand extends BaseCommand {
4
4
  static readonly description = "Shows a list of paginated Domains or a single Domain if ref is provided";
5
5
  static readonly examples: string[];
6
6
  static readonly flags: {
7
- size: import("@oclif/core/lib/interfaces").OptionFlag<number>;
8
- extended: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
7
+ size: Interfaces.OptionFlag<number, Interfaces.CustomOptions>;
8
+ extended: Interfaces.BooleanFlag<boolean>;
9
9
  };
10
10
  static args: {
11
- name: string;
12
- required: boolean;
13
- description: string;
14
- }[];
11
+ ref: Interfaces.Arg<string, Record<string, unknown>>;
12
+ };
15
13
  run(): Promise<void>;
16
14
  catch(error: {
17
15
  code: number;
18
16
  message: string;
19
- } | CommandError): Promise<void>;
17
+ } | Interfaces.CommandError): Promise<void>;
20
18
  }
@@ -52,18 +52,18 @@ Object.defineProperty(exports, "__esModule", { value: true });
52
52
  * limitations under the License.
53
53
  */
54
54
  /* eslint-disable require-jsdoc */
55
- const grpc = __importStar(require("@grpc/grpc-js"));
56
55
  const core_1 = require("@oclif/core");
56
+ const table_1 = require("../../lib/table");
57
+ const grpc = __importStar(require("@grpc/grpc-js"));
57
58
  const base_1 = require("../../base");
58
59
  const utils_1 = require("../../utils");
59
60
  const common_1 = require("@routr/common");
60
- const errors_1 = require("@oclif/core/lib/errors");
61
61
  class GetDomainsCommand extends base_1.BaseCommand {
62
62
  async run() {
63
63
  const { args, flags } = await this.parse(GetDomainsCommand);
64
64
  const showTable = (request) => {
65
65
  const { showHeader, data, self, flags } = request;
66
- core_1.CliUx.ux.table(data, {
66
+ (0, table_1.printTable)(data, {
67
67
  ref: {
68
68
  minWidth: 7,
69
69
  extended: true
@@ -99,9 +99,9 @@ class GetDomainsCommand extends base_1.BaseCommand {
99
99
  // To be handled globally
100
100
  if ("code" in error && error.code === grpc.status.NOT_FOUND) {
101
101
  const { args } = await this.parse(GetDomainsCommand);
102
- throw new errors_1.CLIError("the Domain you are looking for does not exist: " + args.ref);
102
+ throw new core_1.Errors.CLIError("the Domain you are looking for does not exist: " + args.ref);
103
103
  }
104
- throw new errors_1.CLIError(error.message);
104
+ throw new core_1.Errors.CLIError(error.message);
105
105
  }
106
106
  }
107
107
  GetDomainsCommand.description = "Shows a list of paginated Domains or a single Domain if ref is provided";
@@ -122,11 +122,10 @@ GetDomainsCommand.flags = {
122
122
  description: "extended output format"
123
123
  })
124
124
  };
125
- GetDomainsCommand.args = [
126
- {
127
- name: "ref",
125
+ GetDomainsCommand.args = {
126
+ ref: core_1.Args.string({
128
127
  required: false,
129
128
  description: "optional reference to a Domain"
130
- }
131
- ];
129
+ })
130
+ };
132
131
  exports.default = GetDomainsCommand;
@@ -3,9 +3,7 @@ export default class UpdateCommand extends BaseCommand {
3
3
  static readonly description = "Updates an existing Domain";
4
4
  static readonly examples: string[];
5
5
  static readonly args: {
6
- name: string;
7
- required: boolean;
8
- description: string;
9
- }[];
6
+ ref: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
7
+ };
10
8
  run(): Promise<void>;
11
9
  }
@@ -23,8 +23,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
23
23
  */
24
24
  /* eslint-disable require-jsdoc */
25
25
  const core_1 = require("@oclif/core");
26
+ const wait_1 = require("../../lib/wait");
26
27
  const base_1 = require("../../base");
27
- const errors_1 = require("@oclif/core/lib/errors");
28
28
  const validators_1 = require("../../validators");
29
29
  const sdk_1 = __importDefault(require("@routr/sdk"));
30
30
  // NOTE: Newer versions of inquirer have a bug that causes the following error:
@@ -81,7 +81,7 @@ class UpdateCommand extends base_1.BaseCommand {
81
81
  name: "accessControlListRef",
82
82
  message: "IP Access Control List",
83
83
  type: "list",
84
- choices: [{ name: "None", value: undefined }, ...aclChoices],
84
+ choices: [{ name: "None", value: "" }, ...aclChoices],
85
85
  default: domainFromDB.accessControlListRef
86
86
  },
87
87
  {
@@ -138,18 +138,18 @@ class UpdateCommand extends base_1.BaseCommand {
138
138
  this.warn("Aborted");
139
139
  }
140
140
  else {
141
- core_1.CliUx.ux.action.start(`Updating Domain ${group1.name}`);
141
+ core_1.ux.action.start(`Updating Domain ${group1.name}`);
142
142
  const domain = await api.updateDomain({
143
143
  ref: domainFromDB.ref,
144
144
  ...group1,
145
145
  egressPolicies
146
146
  });
147
- await core_1.CliUx.ux.wait(1000);
148
- core_1.CliUx.ux.action.stop(domain.ref);
147
+ await (0, wait_1.wait)(1000);
148
+ core_1.ux.action.stop(domain.ref);
149
149
  }
150
150
  }
151
151
  catch (e) {
152
- throw new errors_1.CLIError(e.message);
152
+ throw new core_1.Errors.CLIError(e.message);
153
153
  }
154
154
  }
155
155
  }
@@ -159,11 +159,10 @@ UpdateCommand.examples = [
159
159
  Updating Domain Local... 80181ca6-d4aa-4575-9375-8f72b07d5555
160
160
  `
161
161
  ];
162
- UpdateCommand.args = [
163
- {
164
- name: "ref",
162
+ UpdateCommand.args = {
163
+ ref: core_1.Args.string({
165
164
  required: true,
166
165
  description: "reference to an existing Domain"
167
- }
168
- ];
166
+ })
167
+ };
169
168
  exports.default = UpdateCommand;
@@ -55,10 +55,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
55
55
  * limitations under the License.
56
56
  */
57
57
  /* eslint-disable require-jsdoc */
58
- const grpc = __importStar(require("@grpc/grpc-js"));
59
58
  const core_1 = require("@oclif/core");
59
+ const wait_1 = require("../../lib/wait");
60
+ const grpc = __importStar(require("@grpc/grpc-js"));
60
61
  const base_1 = require("../../base");
61
- const errors_1 = require("@oclif/core/lib/errors");
62
62
  const countries_1 = require("../../countries");
63
63
  const validators_1 = require("../../validators");
64
64
  const utils_1 = require("../../utils");
@@ -160,19 +160,19 @@ class CreateNumberCommand extends base_1.BaseCommand {
160
160
  this.warn("Aborted");
161
161
  }
162
162
  else {
163
- core_1.CliUx.ux.action.start(`Creating Number ${answers.name}`);
163
+ core_1.ux.action.start(`Creating Number ${answers.name}`);
164
164
  const api = new sdk_1.default.Numbers({ endpoint, insecure, cacert });
165
165
  const number = await api.createNumber(answers);
166
- await core_1.CliUx.ux.wait(1000);
167
- core_1.CliUx.ux.action.stop(number.ref);
166
+ await (0, wait_1.wait)(1000);
167
+ core_1.ux.action.stop(number.ref);
168
168
  }
169
169
  }
170
170
  catch (e) {
171
171
  if (e.code === grpc.status.ALREADY_EXISTS) {
172
- throw new errors_1.CLIError("This Number already exist");
172
+ throw new core_1.Errors.CLIError("This Number already exist");
173
173
  }
174
174
  else {
175
- throw new errors_1.CLIError(e.message);
175
+ throw new core_1.Errors.CLIError(e.message);
176
176
  }
177
177
  }
178
178
  }
@@ -26,7 +26,7 @@ const delete_1 = __importDefault(require("../../delete"));
26
26
  const sdk_1 = __importDefault(require("@routr/sdk"));
27
27
  class DeleteNumberCommand extends delete_1.default {
28
28
  async run() {
29
- const { flags } = await this.parse(DeleteNumberCommand);
29
+ const { flags } = await this.parse(delete_1.default);
30
30
  const { endpoint, insecure, cacert } = flags;
31
31
  await super.deleteResource(new sdk_1.default.Numbers({ endpoint, insecure, cacert }), "deleteNumber");
32
32
  }
@@ -2,9 +2,7 @@ import { BaseCommand } from "../../base";
2
2
  export default class DescribeCommand extends BaseCommand {
3
3
  static readonly description = "shows details for a Number";
4
4
  static readonly args: {
5
- name: string;
6
- required: boolean;
7
- description: string;
8
- }[];
5
+ ref: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
6
+ };
9
7
  run(): Promise<void>;
10
8
  }
@@ -22,8 +22,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
22
22
  * limitations under the License.
23
23
  */
24
24
  /* eslint-disable require-jsdoc */
25
+ const core_1 = require("@oclif/core");
25
26
  const base_1 = require("../../base");
26
- const errors_1 = require("@oclif/core/lib/errors");
27
27
  const prettyjson_1 = require("prettyjson");
28
28
  const sdk_1 = __importDefault(require("@routr/sdk"));
29
29
  const moment_1 = __importDefault(require("moment"));
@@ -57,16 +57,15 @@ class DescribeCommand extends base_1.BaseCommand {
57
57
  this.log((0, prettyjson_1.render)(jsonObj, { noColor: true }));
58
58
  }
59
59
  catch (e) {
60
- throw new errors_1.CLIError(e.message);
60
+ throw new core_1.Errors.CLIError(e.message);
61
61
  }
62
62
  }
63
63
  }
64
64
  DescribeCommand.description = "shows details for a Number";
65
- DescribeCommand.args = [
66
- {
67
- name: "ref",
65
+ DescribeCommand.args = {
66
+ ref: core_1.Args.string({
68
67
  required: false,
69
68
  description: "reference to the Number"
70
- }
71
- ];
69
+ })
70
+ };
72
71
  exports.default = DescribeCommand;
@@ -1,20 +1,18 @@
1
+ import { Interfaces } from "@oclif/core";
1
2
  import { BaseCommand } from "../../base";
2
- import { CommandError } from "@oclif/core/lib/interfaces";
3
3
  export default class GetNumbersCommand extends BaseCommand {
4
4
  static readonly description = "Shows a list of paginated Numbers or a single Number if ref is provided";
5
5
  static readonly examples: string[];
6
6
  static readonly flags: {
7
- size: import("@oclif/core/lib/interfaces").OptionFlag<number>;
8
- extended: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
7
+ size: Interfaces.OptionFlag<number, Interfaces.CustomOptions>;
8
+ extended: Interfaces.BooleanFlag<boolean>;
9
9
  };
10
10
  static args: {
11
- name: string;
12
- required: boolean;
13
- description: string;
14
- }[];
11
+ ref: Interfaces.Arg<string, Record<string, unknown>>;
12
+ };
15
13
  run(): Promise<void>;
16
14
  catch(error: {
17
15
  code: number;
18
16
  message: string;
19
- } | CommandError): Promise<void>;
17
+ } | Interfaces.CommandError): Promise<void>;
20
18
  }
@@ -52,18 +52,18 @@ Object.defineProperty(exports, "__esModule", { value: true });
52
52
  * limitations under the License.
53
53
  */
54
54
  /* eslint-disable require-jsdoc */
55
- const grpc = __importStar(require("@grpc/grpc-js"));
56
55
  const core_1 = require("@oclif/core");
56
+ const table_1 = require("../../lib/table");
57
+ const grpc = __importStar(require("@grpc/grpc-js"));
57
58
  const base_1 = require("../../base");
58
59
  const utils_1 = require("../../utils");
59
60
  const common_1 = require("@routr/common");
60
- const errors_1 = require("@oclif/core/lib/errors");
61
61
  class GetNumbersCommand extends base_1.BaseCommand {
62
62
  async run() {
63
63
  const { args, flags } = await this.parse(GetNumbersCommand);
64
64
  const showTable = (request) => {
65
65
  const { showHeader, data, self, flags } = request;
66
- core_1.CliUx.ux.table(data, {
66
+ (0, table_1.printTable)(data, {
67
67
  ref: {
68
68
  minWidth: 7,
69
69
  extended: true
@@ -104,9 +104,9 @@ class GetNumbersCommand extends base_1.BaseCommand {
104
104
  // To be handled globally
105
105
  if ("code" in error && error.code === grpc.status.NOT_FOUND) {
106
106
  const { args } = await this.parse(GetNumbersCommand);
107
- throw new errors_1.CLIError("the Number you are looking for does not exist: " + args.ref);
107
+ throw new core_1.Errors.CLIError("the Number you are looking for does not exist: " + args.ref);
108
108
  }
109
- throw new errors_1.CLIError(error.message);
109
+ throw new core_1.Errors.CLIError(error.message);
110
110
  }
111
111
  }
112
112
  GetNumbersCommand.description = "Shows a list of paginated Numbers or a single Number if ref is provided";
@@ -127,11 +127,10 @@ GetNumbersCommand.flags = {
127
127
  description: "extended output format"
128
128
  })
129
129
  };
130
- GetNumbersCommand.args = [
131
- {
132
- name: "ref",
130
+ GetNumbersCommand.args = {
131
+ ref: core_1.Args.string({
133
132
  required: false,
134
133
  description: "optional reference to a Number"
135
- }
136
- ];
134
+ })
135
+ };
137
136
  exports.default = GetNumbersCommand;
@@ -3,9 +3,7 @@ export default class UpdateCommand extends BaseCommand {
3
3
  static readonly description = "Updates an existing set of Credentials";
4
4
  static readonly examples: string[];
5
5
  static readonly args: {
6
- name: string;
7
- required: boolean;
8
- description: string;
9
- }[];
6
+ ref: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
7
+ };
10
8
  run(): Promise<void>;
11
9
  }
@@ -23,8 +23,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
23
23
  */
24
24
  /* eslint-disable require-jsdoc */
25
25
  const core_1 = require("@oclif/core");
26
+ const wait_1 = require("../../lib/wait");
26
27
  const base_1 = require("../../base");
27
- const errors_1 = require("@oclif/core/lib/errors");
28
28
  const validators_1 = require("../../validators");
29
29
  const utils_1 = require("../../utils");
30
30
  const sdk_1 = __importDefault(require("@routr/sdk"));
@@ -74,7 +74,7 @@ class UpdateCommand extends base_1.BaseCommand {
74
74
  name: "trunkRef",
75
75
  message: "Trunk",
76
76
  type: "list",
77
- choices: [{ name: "None", value: undefined }, ...trunksChoices],
77
+ choices: [{ name: "None", value: "" }, ...trunksChoices],
78
78
  default: numberFromDB.trunkRef
79
79
  },
80
80
  {
@@ -106,14 +106,14 @@ class UpdateCommand extends base_1.BaseCommand {
106
106
  this.warn("Aborted");
107
107
  }
108
108
  else {
109
- core_1.CliUx.ux.action.start(`Updating Number ${answers.name}`);
109
+ core_1.ux.action.start(`Updating Number ${answers.name}`);
110
110
  const number = await api.updateNumber(answers);
111
- await core_1.CliUx.ux.wait(1000);
112
- core_1.CliUx.ux.action.stop(number.ref);
111
+ await (0, wait_1.wait)(1000);
112
+ core_1.ux.action.stop(number.ref);
113
113
  }
114
114
  }
115
115
  catch (e) {
116
- throw new errors_1.CLIError(e.message);
116
+ throw new core_1.Errors.CLIError(e.message);
117
117
  }
118
118
  }
119
119
  }
@@ -123,11 +123,10 @@ UpdateCommand.examples = [
123
123
  Updating Number (785) 317-8070... 80181ca6-d4aa-4575-9375-8f72b07d5555
124
124
  `
125
125
  ];
126
- UpdateCommand.args = [
127
- {
128
- name: "ref",
126
+ UpdateCommand.args = {
127
+ ref: core_1.Args.string({
129
128
  required: true,
130
129
  description: "reference to an existing Number"
131
- }
132
- ];
130
+ })
131
+ };
133
132
  exports.default = UpdateCommand;