@erdoai/cli 0.79.0 → 0.80.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 +43 -3
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1093,9 +1093,21 @@ var ErdoClient = class {
1093
1093
  const qs = schemaName ? `?schema_name=${encodeURIComponent(schemaName)}` : "";
1094
1094
  return this.request("GET", `/v1/integrations/${encodeURIComponent(integration)}/tables${qs}`);
1095
1095
  }
1096
+ // `provided_by_organization_slug` marks a connection your manager
1097
+ // organization lends to you rather than one this org connected. It is usable
1098
+ // exactly like your own for as long as the management link lives, and is not
1099
+ // yours to rotate or disconnect.
1096
1100
  listIntegrations() {
1097
1101
  return this.request("GET", "/v1/integrations");
1098
1102
  }
1103
+ // Start or stop lending a connection to the organizations this one manages.
1104
+ // `managed_organizations` names the orgs it now serves — empty when this org
1105
+ // manages nobody yet, which is a truthful answer rather than a failure.
1106
+ setIntegrationManagedAccess(integrationId, managedAccess) {
1107
+ return this.request("POST", `/v1/integrations/${encodeURIComponent(integrationId)}/managed-access`, {
1108
+ managed_access: managedAccess
1109
+ });
1110
+ }
1099
1111
  // For a Pipedream-backed integration this is the full disconnect: the
1100
1112
  // credential is released at the provider and the connection removed, not just
1101
1113
  // the integration row deleted.
@@ -5296,7 +5308,10 @@ var integrationsCmd = program.command("integrations").description("Connect and i
5296
5308
  integrationsCmd.command("list").description("List connected integrations").action(async () => {
5297
5309
  try {
5298
5310
  const { integrations } = await new ErdoClient().listIntegrations();
5299
- for (const i of integrations) console.log(`${i.app} ${i.status} ${i.auth_type} ${i.name}`);
5311
+ for (const i of integrations) {
5312
+ const provided = i.provided_by_organization_slug ? ` provided by ${i.provided_by_organization_slug}` : "";
5313
+ console.log(`${i.app} ${i.status} ${i.auth_type} ${i.name}${provided}`);
5314
+ }
5300
5315
  } catch (e) {
5301
5316
  fail(e);
5302
5317
  }
@@ -5309,7 +5324,10 @@ integrationsCmd.command("apps [query]").description("Search connectable apps (na
5309
5324
  fail(e);
5310
5325
  }
5311
5326
  });
5312
- integrationsCmd.command("connect <app>").description("Connect an app \u2014 pass its API key or other credentials with -c, or omit them to get a browser connect URL for OAuth apps").option("-c, --credential <key=value...>", "credential field, e.g. -c api_key=\u2026 (repeatable); rejected by OAuth apps, which have no credential to pass", (v, acc) => acc.concat(v), []).option("-n, --name <name>", "display name for the connection").option("--rotate", "replace the credentials of the app's existing connection instead of adding a second one \u2014 for a key that was rotated at the provider; requires -c").option("--share", "share the connection with the whole organization instead of keeping it private to you \u2014 for org-level credentials teammates and agents should see").action(async (app, opts) => {
5327
+ integrationsCmd.command("connect <app>").description("Connect an app \u2014 pass its API key or other credentials with -c, or omit them to get a browser connect URL for OAuth apps").option("-c, --credential <key=value...>", "credential field, e.g. -c api_key=\u2026 (repeatable); rejected by OAuth apps, which have no credential to pass", (v, acc) => acc.concat(v), []).option("-n, --name <name>", "display name for the connection").option("--rotate", "replace the credentials of the app's existing connection instead of adding a second one \u2014 for a key that was rotated at the provider; requires -c").option("--share", "share the connection with the whole organization instead of keeping it private to you \u2014 for org-level credentials teammates and agents should see").option(
5328
+ "--provide-to-managed",
5329
+ "let the organizations you manage use this connection as if it were their own \u2014 for a vendor key your agency pays for. Key-authenticated native integrations only, connected in a manager organization"
5330
+ ).action(async (app, opts) => {
5313
5331
  try {
5314
5332
  let credentials;
5315
5333
  if (opts.credential.length) {
@@ -5325,7 +5343,8 @@ integrationsCmd.command("connect <app>").description("Connect an app \u2014 pass
5325
5343
  name: opts.name,
5326
5344
  credentials,
5327
5345
  rotate_credentials: opts.rotate || void 0,
5328
- share_with_org: opts.share || void 0
5346
+ share_with_org: opts.share || void 0,
5347
+ managed_access: opts.provideToManaged ? "managed_organizations" : void 0
5329
5348
  });
5330
5349
  print(res);
5331
5350
  const notes = [];
@@ -5340,6 +5359,27 @@ ${notes.join("\n")}`);
5340
5359
  fail(e);
5341
5360
  }
5342
5361
  });
5362
+ integrationsCmd.command("managed-access <integration-id> <owner_only|managed_organizations>").description(
5363
+ "Start or stop providing a connection to the organizations you manage \u2014 a vendor key your agency pays for, spendable by every client for as long as you manage it. Key-authenticated connections only"
5364
+ ).action(async (integrationId, managedAccess) => {
5365
+ try {
5366
+ const res = await new ErdoClient().setIntegrationManagedAccess(integrationId, managedAccess);
5367
+ print(res);
5368
+ if (res.managed_access !== "managed_organizations") return;
5369
+ const orgs = res.managed_organizations ?? [];
5370
+ if (!orgs.length) {
5371
+ console.error(
5372
+ "\nNo organizations are managed by this one yet, so nothing uses it today \u2014 a client you link later picks it up with nothing further to do here."
5373
+ );
5374
+ return;
5375
+ }
5376
+ console.error(`
5377
+ Provided to ${orgs.length} organization${orgs.length === 1 ? "" : "s"}:`);
5378
+ for (const o of orgs) console.error(` ${o.slug} ${o.name}`);
5379
+ } catch (e) {
5380
+ fail(e);
5381
+ }
5382
+ });
5343
5383
  integrationsCmd.command("disconnect <app>").description("Disconnect an app \u2014 releases the stored credential and removes the connection; org admins can disconnect any of the org's connections").action(async (app) => {
5344
5384
  try {
5345
5385
  const client = new ErdoClient();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@erdoai/cli",
3
- "version": "0.79.0",
3
+ "version": "0.80.0",
4
4
  "description": "Erdo CLI \u2014 drive datasets, pages, and evals from the terminal or CI",
5
5
  "type": "module",
6
6
  "bin": {