@erdoai/cli 0.78.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.
- package/dist/index.js +69 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -689,6 +689,16 @@ var ErdoClient = class {
|
|
|
689
689
|
input
|
|
690
690
|
);
|
|
691
691
|
}
|
|
692
|
+
// The reverse of attachWorkstreamResource. The API reads a DELETE's fields
|
|
693
|
+
// from the query string, so these ride there rather than in a body. Omitting
|
|
694
|
+
// relationship_type removes every link the workstream holds to the resource.
|
|
695
|
+
detachWorkstreamResource(slug, input) {
|
|
696
|
+
const q = new URLSearchParams();
|
|
697
|
+
q.set("resource_type", input.resource_type);
|
|
698
|
+
q.set("resource_id", input.resource_id);
|
|
699
|
+
if (input.relationship_type) q.set("relationship_type", input.relationship_type);
|
|
700
|
+
return this.request("DELETE", `/v1/workstreams/${encodeURIComponent(slug)}/resources?${q.toString()}`);
|
|
701
|
+
}
|
|
692
702
|
// --- experiments ---
|
|
693
703
|
listExperiments(params) {
|
|
694
704
|
const q = new URLSearchParams();
|
|
@@ -1083,9 +1093,21 @@ var ErdoClient = class {
|
|
|
1083
1093
|
const qs = schemaName ? `?schema_name=${encodeURIComponent(schemaName)}` : "";
|
|
1084
1094
|
return this.request("GET", `/v1/integrations/${encodeURIComponent(integration)}/tables${qs}`);
|
|
1085
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.
|
|
1086
1100
|
listIntegrations() {
|
|
1087
1101
|
return this.request("GET", "/v1/integrations");
|
|
1088
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
|
+
}
|
|
1089
1111
|
// For a Pipedream-backed integration this is the full disconnect: the
|
|
1090
1112
|
// credential is released at the provider and the connection removed, not just
|
|
1091
1113
|
// the integration row deleted.
|
|
@@ -2440,6 +2462,22 @@ wsCmd.command("attach <slug>").description("Link a resource (page, dataset, hear
|
|
|
2440
2462
|
}
|
|
2441
2463
|
}
|
|
2442
2464
|
);
|
|
2465
|
+
wsCmd.command("detach <slug>").description("Unlink a resource from a workstream (the reverse of attach)").requiredOption("--type <resourceType>", "resource type (page, dataset, heartbeat, experiment_run, \u2026)").requiredOption("--id <resourceId>", "the resource's UUID").option(
|
|
2466
|
+
"--rel <relationshipType>",
|
|
2467
|
+
"which link to remove: output | input | evidence | monitoring | subject | parent | child | running. Omit to remove every link to this resource"
|
|
2468
|
+
).action(async (slug, opts) => {
|
|
2469
|
+
try {
|
|
2470
|
+
print(
|
|
2471
|
+
await new ErdoClient().detachWorkstreamResource(slug, {
|
|
2472
|
+
resource_type: opts.type,
|
|
2473
|
+
resource_id: opts.id,
|
|
2474
|
+
relationship_type: opts.rel
|
|
2475
|
+
})
|
|
2476
|
+
);
|
|
2477
|
+
} catch (e) {
|
|
2478
|
+
fail(e);
|
|
2479
|
+
}
|
|
2480
|
+
});
|
|
2443
2481
|
var VARIANT_SPEC_KEYS = /* @__PURE__ */ new Set([
|
|
2444
2482
|
"key",
|
|
2445
2483
|
"label",
|
|
@@ -5270,7 +5308,10 @@ var integrationsCmd = program.command("integrations").description("Connect and i
|
|
|
5270
5308
|
integrationsCmd.command("list").description("List connected integrations").action(async () => {
|
|
5271
5309
|
try {
|
|
5272
5310
|
const { integrations } = await new ErdoClient().listIntegrations();
|
|
5273
|
-
for (const i of integrations)
|
|
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
|
+
}
|
|
5274
5315
|
} catch (e) {
|
|
5275
5316
|
fail(e);
|
|
5276
5317
|
}
|
|
@@ -5283,7 +5324,10 @@ integrationsCmd.command("apps [query]").description("Search connectable apps (na
|
|
|
5283
5324
|
fail(e);
|
|
5284
5325
|
}
|
|
5285
5326
|
});
|
|
5286
|
-
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").
|
|
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) => {
|
|
5287
5331
|
try {
|
|
5288
5332
|
let credentials;
|
|
5289
5333
|
if (opts.credential.length) {
|
|
@@ -5299,7 +5343,8 @@ integrationsCmd.command("connect <app>").description("Connect an app \u2014 pass
|
|
|
5299
5343
|
name: opts.name,
|
|
5300
5344
|
credentials,
|
|
5301
5345
|
rotate_credentials: opts.rotate || void 0,
|
|
5302
|
-
share_with_org: opts.share || void 0
|
|
5346
|
+
share_with_org: opts.share || void 0,
|
|
5347
|
+
managed_access: opts.provideToManaged ? "managed_organizations" : void 0
|
|
5303
5348
|
});
|
|
5304
5349
|
print(res);
|
|
5305
5350
|
const notes = [];
|
|
@@ -5314,6 +5359,27 @@ ${notes.join("\n")}`);
|
|
|
5314
5359
|
fail(e);
|
|
5315
5360
|
}
|
|
5316
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
|
+
});
|
|
5317
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) => {
|
|
5318
5384
|
try {
|
|
5319
5385
|
const client = new ErdoClient();
|