@erdoai/cli 0.181.0 → 0.183.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 (2) hide show
  1. package/dist/index.js +42 -1
  2. 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",
@@ -3658,7 +3663,7 @@ This key operates every org you manage; target one with X-Organization-ID (or \`
3658
3663
  }
3659
3664
  });
3660
3665
  managed.command("performance").description(
3661
- "Daily spend, traffic and captured leads for the client orgs you manage \u2014 one organization with --organization, otherwise every client. A metric whose source dataset is missing or unreadable prints as '-' and is explained under coverage; it is never reported as zero."
3666
+ "Daily spend, traffic and captured leads for the client orgs you manage \u2014 one organization with --organization, otherwise every client. Each advertising source prints its as-of time and the provider day it runs through. A metric whose source dataset is missing or unreadable prints as '-' and is explained under coverage; it is never reported as zero."
3662
3667
  ).option("--organization <slug>", "read one organization instead of every client org").option("--from <YYYY-MM-DD>", "first day to include (inclusive); defaults to 89 days before --to").option("--to <YYYY-MM-DD>", "last day to include (inclusive); defaults to today (UTC)").option("--daily", "one row per organization per day instead of window totals").option("--json", "print the raw JSON result instead of a table").action(
3663
3668
  async (opts) => {
3664
3669
  try {
@@ -3729,6 +3734,14 @@ managed.command("performance").description(
3729
3734
  ${res.from} to ${res.to} (${res.timezone} days)
3730
3735
  `);
3731
3736
  for (const org2 of res.organizations) {
3737
+ for (const channel of org2.channels ?? []) {
3738
+ const partial = channel.partial ? ", in progress" : "";
3739
+ const note = channel.note ? ` \u2014 ${channel.note}` : "";
3740
+ process.stderr.write(
3741
+ `${org2.organization_slug}: ${channel.provider} from ${channel.from} through ${channel.through}, as of ${channel.as_of}${partial}${note}
3742
+ `
3743
+ );
3744
+ }
3732
3745
  for (const gap of org2.coverage) {
3733
3746
  process.stderr.write(
3734
3747
  `${org2.organization_slug}: ${gap.metrics.join(", ")} unavailable \u2014 ${gap.reason}
@@ -7361,6 +7374,34 @@ function printProfileDriftNote(numbers) {
7361
7374
  "Re-send it with: erdo voice numbers provision-sms <number>. It re-opens carrier review, which takes days."
7362
7375
  );
7363
7376
  }
7377
+ var channelsCmd = program.command("channels").description("Where the organization's email, WhatsApp, SMS and voice channels stand");
7378
+ 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) => {
7379
+ try {
7380
+ const res = await new ErdoClient().getChannelStatus();
7381
+ if (opts.json) {
7382
+ print(res);
7383
+ return;
7384
+ }
7385
+ const rows = [];
7386
+ for (const [name, ch] of [
7387
+ ["email", res.email],
7388
+ ["whatsapp", res.whatsapp],
7389
+ ["sms", res.sms],
7390
+ ["voice", res.voice]
7391
+ ]) {
7392
+ rows.push([name, ch.state, ch.remediation?.action ?? "", ch.reason ?? ""]);
7393
+ for (const item of ch.items ?? []) {
7394
+ rows.push([` ${item.kind}${item.address ? ` ${item.address}` : ""}`, item.state, item.remediation?.action ?? "", item.reason ?? ""]);
7395
+ }
7396
+ }
7397
+ printAlignedTable(["channel", "state", "next action", "reason"], rows);
7398
+ if (!res.business_profile_complete) {
7399
+ console.log(`Business profile is incomplete: ${(res.missing_profile_fields ?? []).join(", ")}`);
7400
+ }
7401
+ } catch (e) {
7402
+ fail(e);
7403
+ }
7404
+ });
7364
7405
  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
7406
  try {
7366
7407
  const res = await new ErdoClient().listVoicePhoneNumbers();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@erdoai/cli",
3
- "version": "0.181.0",
3
+ "version": "0.183.0",
4
4
  "description": "Erdo CLI \u2014 drive datasets, pages, and evals from the terminal or CI",
5
5
  "type": "module",
6
6
  "bin": {