@erdoai/cli 0.181.0 → 0.182.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.
- package/dist/index.js +33 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -824,6 +824,11 @@ var ErdoClient = class {
|
|
|
824
824
|
listVoicePhoneNumbers() {
|
|
825
825
|
return this.request("GET", "/v1/voice/phone-numbers");
|
|
826
826
|
}
|
|
827
|
+
// Where email, WhatsApp, SMS and voice each stand. Read from the database the
|
|
828
|
+
// registration crons maintain; nothing here reaches a provider.
|
|
829
|
+
getChannelStatus() {
|
|
830
|
+
return this.request("GET", "/v1/channels/status");
|
|
831
|
+
}
|
|
827
832
|
getVoicePhoneNumberSMS(number) {
|
|
828
833
|
return this.request(
|
|
829
834
|
"GET",
|
|
@@ -7361,6 +7366,34 @@ function printProfileDriftNote(numbers) {
|
|
|
7361
7366
|
"Re-send it with: erdo voice numbers provision-sms <number>. It re-opens carrier review, which takes days."
|
|
7362
7367
|
);
|
|
7363
7368
|
}
|
|
7369
|
+
var channelsCmd = program.command("channels").description("Where the organization's email, WhatsApp, SMS and voice channels stand");
|
|
7370
|
+
channelsCmd.command("status").description("Show each channel's state (active, registering, needs_dns, rejected, ...) and what it is waiting on").option("--json", "print the raw JSON result instead of a table").action(async (opts) => {
|
|
7371
|
+
try {
|
|
7372
|
+
const res = await new ErdoClient().getChannelStatus();
|
|
7373
|
+
if (opts.json) {
|
|
7374
|
+
print(res);
|
|
7375
|
+
return;
|
|
7376
|
+
}
|
|
7377
|
+
const rows = [];
|
|
7378
|
+
for (const [name, ch] of [
|
|
7379
|
+
["email", res.email],
|
|
7380
|
+
["whatsapp", res.whatsapp],
|
|
7381
|
+
["sms", res.sms],
|
|
7382
|
+
["voice", res.voice]
|
|
7383
|
+
]) {
|
|
7384
|
+
rows.push([name, ch.state, ch.remediation?.action ?? "", ch.reason ?? ""]);
|
|
7385
|
+
for (const item of ch.items ?? []) {
|
|
7386
|
+
rows.push([` ${item.kind}${item.address ? ` ${item.address}` : ""}`, item.state, item.remediation?.action ?? "", item.reason ?? ""]);
|
|
7387
|
+
}
|
|
7388
|
+
}
|
|
7389
|
+
printAlignedTable(["channel", "state", "next action", "reason"], rows);
|
|
7390
|
+
if (!res.business_profile_complete) {
|
|
7391
|
+
console.log(`Business profile is incomplete: ${(res.missing_profile_fields ?? []).join(", ")}`);
|
|
7392
|
+
}
|
|
7393
|
+
} catch (e) {
|
|
7394
|
+
fail(e);
|
|
7395
|
+
}
|
|
7396
|
+
});
|
|
7364
7397
|
voiceNumbersCmd.command("list").description("List the organization's numbers with what each one's SMS registration is waiting on").option("--json", "print the raw JSON result instead of a table").action(async (opts) => {
|
|
7365
7398
|
try {
|
|
7366
7399
|
const res = await new ErdoClient().listVoicePhoneNumbers();
|