@routr/ctl 2.0.8-alpha.24 → 2.0.8-alpha.27

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 (39) hide show
  1. package/README.md +170 -51
  2. package/dist/base.d.ts +0 -1
  3. package/dist/base.js +0 -4
  4. package/dist/commands/acl/describe.d.ts +10 -0
  5. package/dist/commands/acl/describe.js +62 -0
  6. package/dist/commands/acl/get.d.ts +1 -0
  7. package/dist/commands/acl/get.js +4 -19
  8. package/dist/commands/agents/create.js +3 -8
  9. package/dist/commands/agents/describe.d.ts +10 -0
  10. package/dist/commands/agents/describe.js +72 -0
  11. package/dist/commands/agents/get.d.ts +1 -0
  12. package/dist/commands/agents/get.js +4 -26
  13. package/dist/commands/agents/update.js +4 -9
  14. package/dist/commands/credentials/describe.d.ts +10 -0
  15. package/dist/commands/credentials/describe.js +61 -0
  16. package/dist/commands/credentials/get.d.ts +1 -0
  17. package/dist/commands/credentials/get.js +5 -20
  18. package/dist/commands/domains/describe.d.ts +10 -0
  19. package/dist/commands/domains/describe.js +78 -0
  20. package/dist/commands/domains/get.d.ts +1 -0
  21. package/dist/commands/domains/get.js +4 -24
  22. package/dist/commands/numbers/describe.d.ts +10 -0
  23. package/dist/commands/numbers/describe.js +72 -0
  24. package/dist/commands/numbers/get.d.ts +1 -0
  25. package/dist/commands/numbers/get.js +4 -24
  26. package/dist/commands/peers/create.js +6 -0
  27. package/dist/commands/peers/describe.d.ts +10 -0
  28. package/dist/commands/peers/describe.js +80 -0
  29. package/dist/commands/peers/get.d.ts +1 -0
  30. package/dist/commands/peers/get.js +6 -43
  31. package/dist/commands/peers/update.js +6 -0
  32. package/dist/commands/trunks/create.js +15 -11
  33. package/dist/commands/trunks/describe.d.ts +10 -0
  34. package/dist/commands/trunks/describe.js +85 -0
  35. package/dist/commands/trunks/get.d.ts +1 -0
  36. package/dist/commands/trunks/get.js +6 -33
  37. package/dist/commands/trunks/update.js +15 -11
  38. package/oclif.manifest.json +267 -183
  39. package/package.json +8 -5
@@ -68,25 +68,6 @@ class GetCommand extends base_1.BaseCommand {
68
68
  allow: {
69
69
  header: "Allow CIDR Networks",
70
70
  get: (row) => row.allow.join(", ")
71
- },
72
- createdAt: {
73
- header: "Created",
74
- get: (row) => new Date(row.createdAt * 1000),
75
- extended: true
76
- },
77
- updatedAt: {
78
- header: "Updated",
79
- get: (row) => new Date(row.updatedAt * 1000),
80
- extended: true
81
- },
82
- extended: {
83
- header: "Extended",
84
- get: (row) => row.extended || {},
85
- extended: true
86
- },
87
- apiVersion: {
88
- header: "API",
89
- extended: true
90
71
  }
91
72
  }, {
92
73
  "no-header": !showHeader,
@@ -124,6 +105,10 @@ GetCommand.flags = {
124
105
  char: "s",
125
106
  description: "the number of items to return",
126
107
  default: 50
108
+ }),
109
+ extended: core_1.Flags.boolean({
110
+ char: "x",
111
+ description: "extended output format"
127
112
  })
128
113
  };
129
114
  GetCommand.args = [
@@ -51,7 +51,6 @@ const base_1 = require("../../base");
51
51
  const errors_1 = require("@oclif/core/lib/errors");
52
52
  const common_1 = require("@routr/common");
53
53
  const validators_1 = require("../../validators");
54
- const fuzzy_search_1 = __importDefault(require("fuzzy-search"));
55
54
  const sdk_1 = __importDefault(require("@routr/sdk"));
56
55
  // NOTE: Newer versions of inquirer have a bug that causes the following error:
57
56
  // (node:75345) [ERR_REQUIRE_ESM] Error Plugin: @routr/ctl [ERR_REQUIRE_ESM]: require() of ES Module
@@ -86,9 +85,6 @@ class CreateAgentCommand extends base_1.BaseCommand {
86
85
  const credentialsList = credentials.items.map((credential) => {
87
86
  return { name: credential.name, value: credential.ref };
88
87
  });
89
- const searcher = new fuzzy_search_1.default(domainsList, ["name", "value", "description"], {
90
- caseSensitive: false
91
- });
92
88
  this.log("This utility will help you create a new Agent.");
93
89
  this.log("Press ^C at any time to quit.");
94
90
  const answers = await inquirer_1.default.prompt([
@@ -99,11 +95,10 @@ class CreateAgentCommand extends base_1.BaseCommand {
99
95
  validate: validators_1.nameValidator
100
96
  },
101
97
  {
102
- type: "autocomplete",
103
98
  name: "domainRef",
104
99
  message: "Select a Domain",
105
- source: (_, input) => searcher.search(input),
106
- when: () => domains.items.length > 0
100
+ choices: [{ name: "None", value: undefined }, ...domainsList],
101
+ type: "list"
107
102
  },
108
103
  {
109
104
  name: "username",
@@ -135,7 +130,7 @@ class CreateAgentCommand extends base_1.BaseCommand {
135
130
  },
136
131
  {
137
132
  name: "enabled",
138
- message: "Enabled",
133
+ message: "Enabled?",
139
134
  type: "confirm",
140
135
  default: true
141
136
  },
@@ -0,0 +1,10 @@
1
+ import { BaseCommand } from "../../base";
2
+ export default class DescribeCommand extends BaseCommand {
3
+ static description: string;
4
+ static args: {
5
+ name: string;
6
+ required: boolean;
7
+ description: string;
8
+ }[];
9
+ run(): Promise<void>;
10
+ }
@@ -0,0 +1,72 @@
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
+ /*
7
+ * Copyright (C) 2023 by Fonoster Inc (https://fonoster.com)
8
+ * http://github.com/fonoster
9
+ *
10
+ * This file is part of Routr.
11
+ *
12
+ * Licensed under the MIT License (the "License");
13
+ * you may not use this file except in compliance with
14
+ * the License. You may obtain a copy of the License at
15
+ *
16
+ * https://opensource.org/licenses/MIT
17
+ *
18
+ * Unless required by applicable law or agreed to in writing, software
19
+ * distributed under the License is distributed on an "AS IS" BASIS,
20
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21
+ * See the License for the specific language governing permissions and
22
+ * limitations under the License.
23
+ */
24
+ /* eslint-disable require-jsdoc */
25
+ const base_1 = require("../../base");
26
+ const errors_1 = require("@oclif/core/lib/errors");
27
+ const prettyjson_1 = require("prettyjson");
28
+ const utils_1 = require("../../utils");
29
+ const sdk_1 = __importDefault(require("@routr/sdk"));
30
+ const moment_1 = __importDefault(require("moment"));
31
+ class DescribeCommand extends base_1.BaseCommand {
32
+ async run() {
33
+ var _a;
34
+ const { args, flags } = await this.parse(DescribeCommand);
35
+ const { endpoint, insecure } = flags;
36
+ const api = new sdk_1.default.Agents({ endpoint, insecure });
37
+ try {
38
+ const agent = await api.getAgent(args.ref);
39
+ const jsonObj = {
40
+ Ref: agent.ref,
41
+ APIVersion: agent.apiVersion,
42
+ Name: agent.name,
43
+ Username: agent.username,
44
+ Domain: ((_a = agent.domain) === null || _a === void 0 ? void 0 : _a.domainUri) || "None",
45
+ Privacy: (0, utils_1.capitalize)(agent.privacy),
46
+ Credentials: agent.credentials
47
+ ? {
48
+ Ref: agent.credentials.ref,
49
+ Username: agent.credentials.username
50
+ }
51
+ : "None",
52
+ Enabled: agent.enabled ? "Yes" : "No",
53
+ Extended: agent.extended,
54
+ Created: (0, moment_1.default)(new Date(agent.createdAt * 1000)).toISOString(),
55
+ Updated: (0, moment_1.default)(new Date(agent.updatedAt * 1000)).toISOString()
56
+ };
57
+ this.log((0, prettyjson_1.render)(jsonObj, { noColor: true }));
58
+ }
59
+ catch (e) {
60
+ throw new errors_1.CLIError(e.message);
61
+ }
62
+ }
63
+ }
64
+ exports.default = DescribeCommand;
65
+ DescribeCommand.description = "shows details of an Agent";
66
+ DescribeCommand.args = [
67
+ {
68
+ name: "ref",
69
+ required: false,
70
+ description: "reference to the Agent"
71
+ }
72
+ ];
@@ -5,6 +5,7 @@ export default class GetAgentsCommand extends BaseCommand {
5
5
  static examples: string[];
6
6
  static flags: {
7
7
  size: import("@oclif/core/lib/interfaces").OptionFlag<number>;
8
+ extended: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
8
9
  };
9
10
  static args: {
10
11
  name: string;
@@ -72,35 +72,9 @@ class GetAgentsCommand extends base_1.BaseCommand {
72
72
  header: "Privacy",
73
73
  get: (row) => (0, utils_1.capitalize)(row.privacy)
74
74
  },
75
- credentials: {
76
- header: "Credentials Name",
77
- get: (row) => row.credentials
78
- ? `${row.credentials.name} (${row.credentials.username})`
79
- : "None",
80
- extended: true
81
- },
82
75
  enabled: {
83
76
  header: "Enabled",
84
77
  get: (row) => (row.enabled ? "Yes" : "No")
85
- },
86
- createdAt: {
87
- header: "Created",
88
- get: (row) => new Date(row.createdAt * 1000),
89
- extended: true
90
- },
91
- updatedAt: {
92
- header: "Updated",
93
- get: (row) => new Date(row.updatedAt * 1000),
94
- extended: true
95
- },
96
- extended: {
97
- header: "Extended",
98
- get: (row) => row.extended || {},
99
- extended: true
100
- },
101
- apiVersion: {
102
- header: "API",
103
- extended: true
104
78
  }
105
79
  }, {
106
80
  "no-header": !showHeader,
@@ -138,6 +112,10 @@ GetAgentsCommand.flags = {
138
112
  char: "s",
139
113
  description: "The number of items to return",
140
114
  default: 50
115
+ }),
116
+ extended: core_1.Flags.boolean({
117
+ char: "x",
118
+ description: "extended output format"
141
119
  })
142
120
  };
143
121
  GetAgentsCommand.args = [
@@ -26,12 +26,11 @@ const core_1 = require("@oclif/core");
26
26
  const base_1 = require("../../base");
27
27
  const errors_1 = require("@oclif/core/lib/errors");
28
28
  const common_1 = require("@routr/common");
29
- const fuzzy_search_1 = __importDefault(require("fuzzy-search"));
29
+ const validators_1 = require("../../validators");
30
30
  const sdk_1 = __importDefault(require("@routr/sdk"));
31
31
  // NOTE: Newer versions of inquirer have a bug that causes the following error:
32
32
  // (node:75345) [ERR_REQUIRE_ESM] Error Plugin: @routr/ctl [ERR_REQUIRE_ESM]: require() of ES Module
33
33
  const inquirer_1 = __importDefault(require("inquirer"));
34
- const validators_1 = require("../../validators");
35
34
  class UpdateCommand extends base_1.BaseCommand {
36
35
  async run() {
37
36
  var _a, _b;
@@ -59,9 +58,6 @@ class UpdateCommand extends base_1.BaseCommand {
59
58
  const credentialsList = (_b = credentials.items) === null || _b === void 0 ? void 0 : _b.map((credential) => {
60
59
  return { name: credential.name, value: credential.ref };
61
60
  });
62
- const searcher = new fuzzy_search_1.default(domainsList, ["name", "value", "description"], {
63
- caseSensitive: false
64
- });
65
61
  this.log("This utility will help you update an existing Agent.");
66
62
  this.log("Press ^C at any time to quit.");
67
63
  const answers = await inquirer_1.default.prompt([
@@ -73,11 +69,10 @@ class UpdateCommand extends base_1.BaseCommand {
73
69
  validate: validators_1.nameValidator
74
70
  },
75
71
  {
76
- type: "autocomplete",
77
72
  name: "domainRef",
78
73
  message: "Select a Domain",
79
- source: (_, input) => searcher.search(input),
80
- when: () => domains.items.length > 0
74
+ choices: [{ name: "None", value: undefined }, ...domainsList],
75
+ type: "list"
81
76
  },
82
77
  {
83
78
  name: "credentialsRef",
@@ -104,7 +99,7 @@ class UpdateCommand extends base_1.BaseCommand {
104
99
  },
105
100
  {
106
101
  name: "enabled",
107
- message: "Enabled",
102
+ message: "Enabled?",
108
103
  type: "confirm",
109
104
  default: agentFromDB.enabled
110
105
  },
@@ -0,0 +1,10 @@
1
+ import { BaseCommand } from "../../base";
2
+ export default class DescribeCommand extends BaseCommand {
3
+ static description: string;
4
+ static args: {
5
+ name: string;
6
+ required: boolean;
7
+ description: string;
8
+ }[];
9
+ run(): Promise<void>;
10
+ }
@@ -0,0 +1,61 @@
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
+ /*
7
+ * Copyright (C) 2023 by Fonoster Inc (https://fonoster.com)
8
+ * http://github.com/fonoster
9
+ *
10
+ * This file is part of Routr.
11
+ *
12
+ * Licensed under the MIT License (the "License");
13
+ * you may not use this file except in compliance with
14
+ * the License. You may obtain a copy of the License at
15
+ *
16
+ * https://opensource.org/licenses/MIT
17
+ *
18
+ * Unless required by applicable law or agreed to in writing, software
19
+ * distributed under the License is distributed on an "AS IS" BASIS,
20
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21
+ * See the License for the specific language governing permissions and
22
+ * limitations under the License.
23
+ */
24
+ /* eslint-disable require-jsdoc */
25
+ const base_1 = require("../../base");
26
+ const errors_1 = require("@oclif/core/lib/errors");
27
+ const prettyjson_1 = require("prettyjson");
28
+ const sdk_1 = __importDefault(require("@routr/sdk"));
29
+ const moment_1 = __importDefault(require("moment"));
30
+ class DescribeCommand extends base_1.BaseCommand {
31
+ async run() {
32
+ const { args, flags } = await this.parse(DescribeCommand);
33
+ const { endpoint, insecure } = flags;
34
+ const api = new sdk_1.default.Credentials({ endpoint, insecure });
35
+ try {
36
+ const credentials = await api.getCredentials(args.ref);
37
+ const jsonObj = {
38
+ Ref: credentials.ref,
39
+ APIVersion: credentials.apiVersion,
40
+ Name: credentials.name,
41
+ Username: credentials.username,
42
+ Extended: credentials.extended,
43
+ Created: (0, moment_1.default)(new Date(credentials.createdAt * 1000)).toISOString(),
44
+ Updated: (0, moment_1.default)(new Date(credentials.updatedAt * 1000)).toISOString()
45
+ };
46
+ this.log((0, prettyjson_1.render)(jsonObj, { noColor: true }));
47
+ }
48
+ catch (e) {
49
+ throw new errors_1.CLIError(e.message);
50
+ }
51
+ }
52
+ }
53
+ exports.default = DescribeCommand;
54
+ DescribeCommand.description = "shows details for a set of Credentials";
55
+ DescribeCommand.args = [
56
+ {
57
+ name: "ref",
58
+ required: false,
59
+ description: "reference to the set of Credentials"
60
+ }
61
+ ];
@@ -5,6 +5,7 @@ export default class GetCommand extends BaseCommand {
5
5
  static examples: string[];
6
6
  static flags: {
7
7
  size: import("@oclif/core/lib/interfaces").OptionFlag<number>;
8
+ extended: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
8
9
  };
9
10
  static args: {
10
11
  name: string;
@@ -42,12 +42,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
42
42
  * limitations under the License.
43
43
  */
44
44
  /* eslint-disable require-jsdoc */
45
+ const grpc = __importStar(require("@grpc/grpc-js"));
45
46
  const core_1 = require("@oclif/core");
46
47
  const base_1 = require("../../base");
47
48
  const utils_1 = require("../../utils");
48
49
  const common_1 = require("@routr/common");
49
50
  const errors_1 = require("@oclif/core/lib/errors");
50
- const grpc = __importStar(require("@grpc/grpc-js"));
51
51
  class GetCommand extends base_1.BaseCommand {
52
52
  async run() {
53
53
  const { args, flags } = await this.parse(GetCommand);
@@ -63,25 +63,6 @@ class GetCommand extends base_1.BaseCommand {
63
63
  },
64
64
  username: {
65
65
  header: "Username"
66
- },
67
- createdAt: {
68
- header: "Created",
69
- get: (row) => new Date(row.createdAt * 1000),
70
- extended: true
71
- },
72
- updatedAt: {
73
- header: "Updated",
74
- get: (row) => new Date(row.updatedAt * 1000),
75
- extended: true
76
- },
77
- extended: {
78
- header: "Extended",
79
- get: (row) => row.extended || {},
80
- extended: true
81
- },
82
- apiVersion: {
83
- header: "API",
84
- extended: true
85
66
  }
86
67
  }, {
87
68
  "no-header": !showHeader,
@@ -119,6 +100,10 @@ GetCommand.flags = {
119
100
  char: "s",
120
101
  description: "the number of items to return",
121
102
  default: 50
103
+ }),
104
+ extended: core_1.Flags.boolean({
105
+ char: "x",
106
+ description: "extended output format"
122
107
  })
123
108
  };
124
109
  GetCommand.args = [
@@ -0,0 +1,10 @@
1
+ import { BaseCommand } from "../../base";
2
+ export default class DescribeCommand extends BaseCommand {
3
+ static description: string;
4
+ static args: {
5
+ name: string;
6
+ required: boolean;
7
+ description: string;
8
+ }[];
9
+ run(): Promise<void>;
10
+ }
@@ -0,0 +1,78 @@
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
+ /*
7
+ * Copyright (C) 2023 by Fonoster Inc (https://fonoster.com)
8
+ * http://github.com/fonoster
9
+ *
10
+ * This file is part of Routr.
11
+ *
12
+ * Licensed under the MIT License (the "License");
13
+ * you may not use this file except in compliance with
14
+ * the License. You may obtain a copy of the License at
15
+ *
16
+ * https://opensource.org/licenses/MIT
17
+ *
18
+ * Unless required by applicable law or agreed to in writing, software
19
+ * distributed under the License is distributed on an "AS IS" BASIS,
20
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21
+ * See the License for the specific language governing permissions and
22
+ * limitations under the License.
23
+ */
24
+ /* eslint-disable require-jsdoc */
25
+ const base_1 = require("../../base");
26
+ const errors_1 = require("@oclif/core/lib/errors");
27
+ const prettyjson_1 = require("prettyjson");
28
+ const sdk_1 = __importDefault(require("@routr/sdk"));
29
+ const moment_1 = __importDefault(require("moment"));
30
+ class DescribeCommand extends base_1.BaseCommand {
31
+ async run() {
32
+ const { args, flags } = await this.parse(DescribeCommand);
33
+ const { endpoint, insecure } = flags;
34
+ const api = new sdk_1.default.Domains({ endpoint, insecure });
35
+ try {
36
+ const domain = await api.getDomain(args.ref);
37
+ const jsonObj = {
38
+ Ref: domain.ref,
39
+ APIVersion: domain.apiVersion,
40
+ Name: domain.name,
41
+ URI: domain.domainUri,
42
+ "Access Control List": domain.accessControlList
43
+ ? {
44
+ Ref: domain.accessControlList.ref,
45
+ Name: domain.accessControlList.name,
46
+ Deny: domain.accessControlList.deny.join(","),
47
+ Allow: domain.accessControlList.allow.join(",")
48
+ }
49
+ : "None",
50
+ // TODO: Extend to show the Tel Url
51
+ "Egress Policies": domain.egressPolicies.length > 0
52
+ ? domain.egressPolicies.map((p) => {
53
+ return {
54
+ Rule: p.rule,
55
+ "Number Ref": p.numberRef
56
+ };
57
+ })
58
+ : "None",
59
+ Extended: domain.extended,
60
+ Created: (0, moment_1.default)(new Date(domain.createdAt * 1000)).toISOString(),
61
+ Updated: (0, moment_1.default)(new Date(domain.updatedAt * 1000)).toISOString()
62
+ };
63
+ this.log((0, prettyjson_1.render)(jsonObj, { noColor: true }));
64
+ }
65
+ catch (e) {
66
+ throw new errors_1.CLIError(e.message);
67
+ }
68
+ }
69
+ }
70
+ exports.default = DescribeCommand;
71
+ DescribeCommand.description = "show details of a Domain";
72
+ DescribeCommand.args = [
73
+ {
74
+ name: "ref",
75
+ required: false,
76
+ description: "reference to the Domain"
77
+ }
78
+ ];
@@ -5,6 +5,7 @@ export default class GetDomainsCommand extends BaseCommand {
5
5
  static examples: string[];
6
6
  static flags: {
7
7
  size: import("@oclif/core/lib/interfaces").OptionFlag<number>;
8
+ extended: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
8
9
  };
9
10
  static args: {
10
11
  name: string;
@@ -64,36 +64,12 @@ class GetDomainsCommand extends base_1.BaseCommand {
64
64
  domainUri: {
65
65
  header: "URI"
66
66
  },
67
- accessControlListRef: {
68
- header: "IP Access Control List",
69
- get: (row) => { var _a; return ((_a = row.accessControlList) === null || _a === void 0 ? void 0 : _a.name) || "None"; },
70
- extended: true
71
- },
72
67
  egressPolicies: {
73
68
  header: "Egress Policies",
74
69
  get: (row) => row.egressPolicies
75
70
  .map((p) => `${p.rule}/${p.number.telUrl.split("tel:")[1]}`)
76
71
  .join(", "),
77
72
  extended: true
78
- },
79
- createdAt: {
80
- header: "Created",
81
- get: (row) => new Date(row.createdAt * 1000),
82
- extended: true
83
- },
84
- updatedAt: {
85
- header: "Updated",
86
- get: (row) => new Date(row.updatedAt * 1000),
87
- extended: true
88
- },
89
- extended: {
90
- header: "Extended",
91
- get: (row) => row.extended || {},
92
- extended: true
93
- },
94
- apiVersion: {
95
- header: "API",
96
- extended: true
97
73
  }
98
74
  }, {
99
75
  "no-header": !showHeader,
@@ -131,6 +107,10 @@ GetDomainsCommand.flags = {
131
107
  char: "s",
132
108
  description: "the number of items to return",
133
109
  default: 50
110
+ }),
111
+ extended: core_1.Flags.boolean({
112
+ char: "x",
113
+ description: "extended output format"
134
114
  })
135
115
  };
136
116
  GetDomainsCommand.args = [
@@ -0,0 +1,10 @@
1
+ import { BaseCommand } from "../../base";
2
+ export default class DescribeCommand extends BaseCommand {
3
+ static description: string;
4
+ static args: {
5
+ name: string;
6
+ required: boolean;
7
+ description: string;
8
+ }[];
9
+ run(): Promise<void>;
10
+ }
@@ -0,0 +1,72 @@
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
+ /*
7
+ * Copyright (C) 2023 by Fonoster Inc (https://fonoster.com)
8
+ * http://github.com/fonoster
9
+ *
10
+ * This file is part of Routr.
11
+ *
12
+ * Licensed under the MIT License (the "License");
13
+ * you may not use this file except in compliance with
14
+ * the License. You may obtain a copy of the License at
15
+ *
16
+ * https://opensource.org/licenses/MIT
17
+ *
18
+ * Unless required by applicable law or agreed to in writing, software
19
+ * distributed under the License is distributed on an "AS IS" BASIS,
20
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21
+ * See the License for the specific language governing permissions and
22
+ * limitations under the License.
23
+ */
24
+ /* eslint-disable require-jsdoc */
25
+ const base_1 = require("../../base");
26
+ const errors_1 = require("@oclif/core/lib/errors");
27
+ const prettyjson_1 = require("prettyjson");
28
+ const sdk_1 = __importDefault(require("@routr/sdk"));
29
+ const moment_1 = __importDefault(require("moment"));
30
+ class DescribeCommand extends base_1.BaseCommand {
31
+ async run() {
32
+ const { args, flags } = await this.parse(DescribeCommand);
33
+ const { endpoint, insecure } = flags;
34
+ const api = new sdk_1.default.Numbers({ endpoint, insecure });
35
+ try {
36
+ const number = await api.getNumber(args.ref);
37
+ const jsonObj = {
38
+ Ref: number.ref,
39
+ APIVersion: number.apiVersion,
40
+ Name: number.name,
41
+ "Tel URL": number.telUrl,
42
+ "AOR Link": number.aorLink,
43
+ "Trunk Ref": number.trunkRef,
44
+ "Geo Info": {
45
+ City: number.city,
46
+ "Country Name": number.country,
47
+ "Country Code": number.countryIsoCode
48
+ },
49
+ "Session Affinity Header": number.sessionAffinityHeader,
50
+ "Extra Headers": number.extraHeaders
51
+ ? number.extraHeaders.join(",")
52
+ : "None",
53
+ Extended: number.extended,
54
+ Created: (0, moment_1.default)(new Date(number.createdAt * 1000)).toISOString(),
55
+ Updated: (0, moment_1.default)(new Date(number.updatedAt * 1000)).toISOString()
56
+ };
57
+ this.log((0, prettyjson_1.render)(jsonObj, { noColor: true }));
58
+ }
59
+ catch (e) {
60
+ throw new errors_1.CLIError(e.message);
61
+ }
62
+ }
63
+ }
64
+ exports.default = DescribeCommand;
65
+ DescribeCommand.description = "shows details for a Number";
66
+ DescribeCommand.args = [
67
+ {
68
+ name: "ref",
69
+ required: false,
70
+ description: "reference to the Number"
71
+ }
72
+ ];
@@ -5,6 +5,7 @@ export default class GetNumbersCommand extends BaseCommand {
5
5
  static examples: string[];
6
6
  static flags: {
7
7
  size: import("@oclif/core/lib/interfaces").OptionFlag<number>;
8
+ extended: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
8
9
  };
9
10
  static args: {
10
11
  name: string;