@erdoai/cli 0.182.0 → 0.184.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 +29 -1
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -506,6 +506,14 @@ var ErdoClient = class {
506
506
  `/v1/managed-organizations/${encodeURIComponent(slug)}`
507
507
  );
508
508
  }
509
+ // Turn an allow-listed feature flag on (or back to its normal resolution) for
510
+ // a managed org. Only flags Erdo declares manager-settable are accepted.
511
+ setManagedOrganizationFeatureFlag(slug, key, enabled) {
512
+ return this.request(
513
+ enabled ? "PUT" : "DELETE",
514
+ `/v1/managed-organizations/${encodeURIComponent(slug)}/feature-flags/${encodeURIComponent(key)}`
515
+ );
516
+ }
509
517
  createManagerKey() {
510
518
  return this.request("POST", "/v1/manager-key");
511
519
  }
@@ -3644,6 +3652,18 @@ managed.command("revoke <slug>").description("Stop managing a client org (remove
3644
3652
  fail(e);
3645
3653
  }
3646
3654
  });
3655
+ managed.command("flag <slug> <key> <state>").description("Turn a manager-settable feature flag on or off for a client org (state: on|off)").action(async (slug, key, state) => {
3656
+ if (state !== "on" && state !== "off") {
3657
+ fail(new Error("state must be on or off"));
3658
+ }
3659
+ try {
3660
+ const res = await new ErdoClient().setManagedOrganizationFeatureFlag(slug, key, state === "on");
3661
+ const source = res.set_by === "staff" ? "set by Erdo staff" : res.set_by ? "set by your manager org" : "normal resolution";
3662
+ console.log(`${res.flag_key} for ${res.org_slug}: ${res.enabled ? "on" : "off"} (${source})`);
3663
+ } catch (e) {
3664
+ fail(e);
3665
+ }
3666
+ });
3647
3667
  managed.command("key").description("Mint (or rotate) your manager key \u2014 one credential for every managed org; shown ONCE").action(async () => {
3648
3668
  try {
3649
3669
  const res = await new ErdoClient().createManagerKey();
@@ -3663,7 +3683,7 @@ This key operates every org you manage; target one with X-Organization-ID (or \`
3663
3683
  }
3664
3684
  });
3665
3685
  managed.command("performance").description(
3666
- "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."
3686
+ "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."
3667
3687
  ).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(
3668
3688
  async (opts) => {
3669
3689
  try {
@@ -3734,6 +3754,14 @@ managed.command("performance").description(
3734
3754
  ${res.from} to ${res.to} (${res.timezone} days)
3735
3755
  `);
3736
3756
  for (const org2 of res.organizations) {
3757
+ for (const channel of org2.channels ?? []) {
3758
+ const partial = channel.partial ? ", in progress" : "";
3759
+ const note = channel.note ? ` \u2014 ${channel.note}` : "";
3760
+ process.stderr.write(
3761
+ `${org2.organization_slug}: ${channel.provider} from ${channel.from} through ${channel.through}, as of ${channel.as_of}${partial}${note}
3762
+ `
3763
+ );
3764
+ }
3737
3765
  for (const gap of org2.coverage) {
3738
3766
  process.stderr.write(
3739
3767
  `${org2.organization_slug}: ${gap.metrics.join(", ")} unavailable \u2014 ${gap.reason}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@erdoai/cli",
3
- "version": "0.182.0",
3
+ "version": "0.184.0",
4
4
  "description": "Erdo CLI \u2014 drive datasets, pages, and evals from the terminal or CI",
5
5
  "type": "module",
6
6
  "bin": {