@routr/ctl 2.0.8-alpha.23 → 2.0.8-alpha.24
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.
- package/README.md +1 -1
- package/dist/commands/acl/create.js +43 -43
- package/dist/commands/acl/get.js +1 -1
- package/dist/commands/acl/update.js +43 -43
- package/dist/commands/agents/create.js +97 -97
- package/dist/commands/agents/update.js +88 -88
- package/dist/commands/credentials/update.js +39 -39
- package/dist/commands/domains/create.js +105 -105
- package/dist/commands/domains/update.js +99 -99
- package/dist/commands/numbers/create.js +88 -88
- package/dist/commands/numbers/update.js +69 -69
- package/dist/commands/peers/create.js +100 -97
- package/dist/commands/peers/update.js +97 -94
- package/dist/commands/trunks/create.js +148 -148
- package/dist/commands/trunks/update.js +151 -151
- package/dist/delete.js +8 -3
- package/oclif.manifest.json +1 -1
- package/package.json +4 -4
|
@@ -36,155 +36,155 @@ class UpdateCommand extends base_1.BaseCommand {
|
|
|
36
36
|
const { args, flags } = await this.parse(UpdateCommand);
|
|
37
37
|
const { endpoint, insecure } = flags;
|
|
38
38
|
const api = new sdk_1.default.Trunks({ endpoint, insecure });
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
39
|
+
try {
|
|
40
|
+
const trunkFromDB = await api.getTrunk(args.ref);
|
|
41
|
+
// TODO: Add support for pagination
|
|
42
|
+
const acls = await new sdk_1.default.ACL({ endpoint, insecure }).listACLs({
|
|
43
|
+
pageSize: 25,
|
|
44
|
+
pageToken: ""
|
|
45
|
+
});
|
|
46
|
+
const aclChoices = acls.items.map((acl) => {
|
|
47
|
+
return {
|
|
48
|
+
name: acl.name,
|
|
49
|
+
value: acl.ref
|
|
50
|
+
};
|
|
51
|
+
});
|
|
52
|
+
const credentials = await new sdk_1.default.Credentials({
|
|
53
|
+
endpoint,
|
|
54
|
+
insecure
|
|
55
|
+
}).listCredentials({
|
|
56
|
+
pageSize: 25,
|
|
57
|
+
pageToken: ""
|
|
58
|
+
});
|
|
59
|
+
const credentialsChoice = credentials.items.map((acl) => {
|
|
60
|
+
return {
|
|
61
|
+
name: acl.name,
|
|
62
|
+
value: acl.ref
|
|
63
|
+
};
|
|
64
|
+
});
|
|
65
|
+
this.log("This utility will help you update an existing Trunk.");
|
|
66
|
+
this.log("Press ^C at any time to quit.");
|
|
67
|
+
this.warn("Adding Outbound SIP URIs will delete existing ones.");
|
|
68
|
+
const group1 = await inquirer_1.default.prompt([
|
|
69
|
+
{
|
|
70
|
+
name: "name",
|
|
71
|
+
message: "Friendly Name",
|
|
72
|
+
type: "input",
|
|
73
|
+
default: trunkFromDB.name,
|
|
74
|
+
validate: validators_1.nameValidator
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
name: "inboundUri",
|
|
78
|
+
message: "Inbound SIP URI",
|
|
79
|
+
type: "input",
|
|
80
|
+
validate: validators_1.inboundUriValidator,
|
|
81
|
+
default: trunkFromDB.inboundUri
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
name: "accessControlListRef",
|
|
85
|
+
message: "IP Access Control List",
|
|
86
|
+
type: "list",
|
|
87
|
+
default: trunkFromDB.accessControlListRef,
|
|
88
|
+
choices: [{ name: "None", value: undefined }, ...aclChoices]
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
name: "inboundCredentialsRef",
|
|
92
|
+
message: "Inbound Credentials",
|
|
93
|
+
type: "list",
|
|
94
|
+
default: trunkFromDB.inboundCredentialsRef,
|
|
95
|
+
choices: [{ name: "None", value: undefined }, ...credentialsChoice]
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
name: "outboundCredentialsRef",
|
|
99
|
+
message: "Outbound Credentials",
|
|
100
|
+
type: "list",
|
|
101
|
+
default: trunkFromDB.outboundCredentialsRef,
|
|
102
|
+
choices: [{ name: "None", value: undefined }, ...credentialsChoice]
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
name: "addOutboundUri",
|
|
106
|
+
message: "Add an Outbound SIP URI?",
|
|
107
|
+
type: "confirm",
|
|
108
|
+
default: false
|
|
109
|
+
}
|
|
110
|
+
]);
|
|
111
|
+
const group2Questions = [
|
|
112
|
+
{
|
|
113
|
+
name: "host",
|
|
114
|
+
message: "Host",
|
|
115
|
+
type: "input",
|
|
116
|
+
validate: validators_1.hostValidator
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
name: "port",
|
|
120
|
+
message: "Post",
|
|
121
|
+
type: "input",
|
|
122
|
+
default: "5060",
|
|
123
|
+
validate: validators_1.portValidator
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
name: "transport",
|
|
127
|
+
message: "Transport",
|
|
128
|
+
type: "list",
|
|
129
|
+
choices: [common_1.CommonTypes.Transport.UDP, common_1.CommonTypes.Transport.TCP, common_1.CommonTypes.Transport.TLS],
|
|
130
|
+
default: common_1.CommonTypes.Transport.UDP
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
name: "user",
|
|
134
|
+
message: "User Part",
|
|
135
|
+
type: "input",
|
|
136
|
+
validate: validators_1.optionalUsernameValidator
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
name: "priority",
|
|
140
|
+
message: "Priority",
|
|
141
|
+
type: "input",
|
|
142
|
+
default: "10",
|
|
143
|
+
validate: validators_1.priorityValidator
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
name: "weight",
|
|
147
|
+
message: "Weight",
|
|
148
|
+
type: "input",
|
|
149
|
+
default: "10",
|
|
150
|
+
validate: validators_1.weightValidator
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
name: "addOutboundUri",
|
|
154
|
+
message: "Add another Outbound SIP URI?",
|
|
155
|
+
type: "confirm",
|
|
156
|
+
default: false
|
|
157
|
+
}
|
|
158
|
+
];
|
|
159
|
+
let addOutboundUri = group1.addOutboundUri;
|
|
160
|
+
const uris = [];
|
|
161
|
+
// eslint-disable-next-line no-loops/no-loops
|
|
162
|
+
while (addOutboundUri) {
|
|
163
|
+
const group2 = await inquirer_1.default.prompt(group2Questions);
|
|
164
|
+
if (group2.numberRef) {
|
|
165
|
+
uris.push({
|
|
166
|
+
host: group2.host,
|
|
167
|
+
port: group2.port,
|
|
168
|
+
transport: group2.transport,
|
|
169
|
+
user: group2.user,
|
|
170
|
+
priority: group2.priority,
|
|
171
|
+
weight: group2.weight,
|
|
172
|
+
enabled: true
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
addOutboundUri = group2.addOutboundUri;
|
|
108
176
|
}
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
name: "port",
|
|
119
|
-
message: "Post",
|
|
120
|
-
type: "input",
|
|
121
|
-
default: "5060",
|
|
122
|
-
validate: validators_1.portValidator
|
|
123
|
-
},
|
|
124
|
-
{
|
|
125
|
-
name: "transport",
|
|
126
|
-
message: "Transport",
|
|
127
|
-
type: "list",
|
|
128
|
-
choices: [common_1.CommonTypes.Transport.UDP, common_1.CommonTypes.Transport.TCP, common_1.CommonTypes.Transport.TLS],
|
|
129
|
-
default: common_1.CommonTypes.Transport.UDP
|
|
130
|
-
},
|
|
131
|
-
{
|
|
132
|
-
name: "user",
|
|
133
|
-
message: "User Part",
|
|
134
|
-
type: "input",
|
|
135
|
-
validate: validators_1.optionalUsernameValidator
|
|
136
|
-
},
|
|
137
|
-
{
|
|
138
|
-
name: "priority",
|
|
139
|
-
message: "Priority",
|
|
140
|
-
type: "input",
|
|
141
|
-
default: "10",
|
|
142
|
-
validate: validators_1.priorityValidator
|
|
143
|
-
},
|
|
144
|
-
{
|
|
145
|
-
name: "weight",
|
|
146
|
-
message: "Weight",
|
|
147
|
-
type: "input",
|
|
148
|
-
default: "10",
|
|
149
|
-
validate: validators_1.weightValidator
|
|
150
|
-
},
|
|
151
|
-
{
|
|
152
|
-
name: "addOutboundUri",
|
|
153
|
-
message: "Add another Outbound SIP URI?",
|
|
154
|
-
type: "confirm",
|
|
155
|
-
default: false
|
|
177
|
+
const group3 = await inquirer_1.default.prompt([
|
|
178
|
+
{
|
|
179
|
+
name: "confirm",
|
|
180
|
+
message: "Ready?",
|
|
181
|
+
type: "confirm"
|
|
182
|
+
}
|
|
183
|
+
]);
|
|
184
|
+
if (!group3.confirm) {
|
|
185
|
+
this.warn("Aborted");
|
|
156
186
|
}
|
|
157
|
-
|
|
158
|
-
let addOutboundUri = group1.addOutboundUri;
|
|
159
|
-
const uris = [];
|
|
160
|
-
// eslint-disable-next-line no-loops/no-loops
|
|
161
|
-
while (addOutboundUri) {
|
|
162
|
-
const group2 = await inquirer_1.default.prompt(group2Questions);
|
|
163
|
-
if (group2.numberRef) {
|
|
164
|
-
uris.push({
|
|
165
|
-
host: group2.host,
|
|
166
|
-
port: group2.port,
|
|
167
|
-
transport: group2.transport,
|
|
168
|
-
user: group2.user,
|
|
169
|
-
priority: group2.priority,
|
|
170
|
-
weight: group2.weight,
|
|
171
|
-
enabled: true
|
|
172
|
-
});
|
|
173
|
-
}
|
|
174
|
-
addOutboundUri = group2.addOutboundUri;
|
|
175
|
-
}
|
|
176
|
-
const group3 = await inquirer_1.default.prompt([
|
|
177
|
-
{
|
|
178
|
-
name: "confirm",
|
|
179
|
-
message: "Ready?",
|
|
180
|
-
type: "confirm"
|
|
181
|
-
}
|
|
182
|
-
]);
|
|
183
|
-
if (!group3.confirm) {
|
|
184
|
-
this.warn("Aborted");
|
|
185
|
-
}
|
|
186
|
-
else {
|
|
187
|
-
try {
|
|
187
|
+
else {
|
|
188
188
|
core_1.CliUx.ux.action.start(`Updating Trunk ${group1.name}`);
|
|
189
189
|
const trunk = await api.updateTrunk({
|
|
190
190
|
ref: trunkFromDB.ref,
|
|
@@ -194,10 +194,10 @@ class UpdateCommand extends base_1.BaseCommand {
|
|
|
194
194
|
await core_1.CliUx.ux.wait(1000);
|
|
195
195
|
core_1.CliUx.ux.action.stop(trunk.ref);
|
|
196
196
|
}
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
197
|
+
}
|
|
198
|
+
catch (e) {
|
|
199
|
+
core_1.CliUx.ux.action.stop();
|
|
200
|
+
throw new errors_1.CLIError(e.message);
|
|
201
201
|
}
|
|
202
202
|
}
|
|
203
203
|
}
|
package/dist/delete.js
CHANGED
|
@@ -31,9 +31,14 @@ class DeleteCommand extends base_1.BaseCommand {
|
|
|
31
31
|
throw new errors_1.CLIError("You must provide a resource ref before continuing");
|
|
32
32
|
}
|
|
33
33
|
core_1.CliUx.ux.action.start(`Deleting item ${args.ref}`);
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
34
|
+
try {
|
|
35
|
+
await API[funcName](args.ref);
|
|
36
|
+
await core_1.CliUx.ux.wait(1000);
|
|
37
|
+
core_1.CliUx.ux.action.stop("Done");
|
|
38
|
+
}
|
|
39
|
+
catch (e) {
|
|
40
|
+
throw new errors_1.CLIError(e.message);
|
|
41
|
+
}
|
|
37
42
|
}
|
|
38
43
|
async catch(err) {
|
|
39
44
|
return super.catch(err);
|
package/oclif.manifest.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@routr/ctl",
|
|
3
|
-
"version": "2.0.8-alpha.
|
|
3
|
+
"version": "2.0.8-alpha.24",
|
|
4
4
|
"description": "Routr Command-Line Tool",
|
|
5
5
|
"author": "Pedro Sanders <psanders@fonoster.com>",
|
|
6
6
|
"bin": {
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
"@oclif/plugin-help": "^5",
|
|
26
26
|
"@oclif/plugin-plugins": "^2.1.12",
|
|
27
27
|
"@oclif/plugin-warn-if-update-available": "^2.0.19",
|
|
28
|
-
"@routr/common": "^2.0.8-alpha.
|
|
29
|
-
"@routr/sdk": "^2.0.8-alpha.
|
|
28
|
+
"@routr/common": "^2.0.8-alpha.24",
|
|
29
|
+
"@routr/sdk": "^2.0.8-alpha.24",
|
|
30
30
|
"figlet": "^1.5.2",
|
|
31
31
|
"fuzzy-search": "^3.2.1",
|
|
32
32
|
"inquirer": "^8.2.5",
|
|
@@ -85,5 +85,5 @@
|
|
|
85
85
|
"oclif"
|
|
86
86
|
],
|
|
87
87
|
"types": "dist/index.d.ts",
|
|
88
|
-
"gitHead": "
|
|
88
|
+
"gitHead": "ee7b11cd563083ef64e796a3bae343b4f40fac1c"
|
|
89
89
|
}
|