@erdoai/cli 0.50.0 → 0.51.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 +59 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -745,6 +745,19 @@ var ErdoClient = class {
|
|
|
745
745
|
listIntegrations() {
|
|
746
746
|
return this.request("GET", "/v1/integrations");
|
|
747
747
|
}
|
|
748
|
+
getConnectionScope(integrationId) {
|
|
749
|
+
return this.request(
|
|
750
|
+
"GET",
|
|
751
|
+
`/v1/integrations/${encodeURIComponent(integrationId)}/connection-scope`
|
|
752
|
+
);
|
|
753
|
+
}
|
|
754
|
+
setConnectionScope(integrationId, accountId) {
|
|
755
|
+
return this.request(
|
|
756
|
+
"POST",
|
|
757
|
+
`/v1/integrations/${encodeURIComponent(integrationId)}/connection-scope`,
|
|
758
|
+
{ account_id: accountId }
|
|
759
|
+
);
|
|
760
|
+
}
|
|
748
761
|
searchIntegrationApps(query) {
|
|
749
762
|
const qs = query ? `?query=${encodeURIComponent(query)}` : "";
|
|
750
763
|
return this.request("GET", `/v1/integration-apps${qs}`);
|
|
@@ -929,6 +942,7 @@ var ErdoClient = class {
|
|
|
929
942
|
if (opts.status) params.set("status", opts.status);
|
|
930
943
|
if (opts.applicability) params.set("applicability", opts.applicability);
|
|
931
944
|
if (opts.outcome) params.set("outcome", opts.outcome);
|
|
945
|
+
if (opts.approval_id) params.set("approval_id", opts.approval_id);
|
|
932
946
|
if (opts.limit) params.set("limit", String(opts.limit));
|
|
933
947
|
if (opts.offset) params.set("offset", String(opts.offset));
|
|
934
948
|
const qs = params.toString();
|
|
@@ -2498,7 +2512,10 @@ decisionsCmd.command("list").description("List decisions, newest first").option(
|
|
|
2498
2512
|
).option("--class <class>", "decision class, e.g. paid_media.ad_group.pause").option("--subject-kind <kind>", "only decisions about this kind of subject").option("--subject-ref <id>", "only decisions about this exact subject").option(
|
|
2499
2513
|
"--status <status>",
|
|
2500
2514
|
"proposed | authorized | executing | effective | measuring | settled | rejected | failed | censored"
|
|
2501
|
-
).option("--applicability <kind>", "standing | one_shot").option("--outcome <outcome>", "only decisions with a settled effect that came back met | not_met | inconclusive").option(
|
|
2515
|
+
).option("--applicability <kind>", "standing | one_shot").option("--outcome <outcome>", "only decisions with a settled effect that came back met | not_met | inconclusive").option(
|
|
2516
|
+
"--approval <id>",
|
|
2517
|
+
"only the decisions produced by answering this approval (approvals are referenced by id, not slug)"
|
|
2518
|
+
).option("-l, --limit <n>", "max rows (default 50, max 200)", (v) => parseInt(v, 10)).option("--offset <n>", "pagination offset", (v) => parseInt(v, 10)).option("--json", "output raw JSON").action(
|
|
2502
2519
|
async (opts) => {
|
|
2503
2520
|
try {
|
|
2504
2521
|
const res = await new ErdoClient().listDecisions({
|
|
@@ -2510,6 +2527,7 @@ decisionsCmd.command("list").description("List decisions, newest first").option(
|
|
|
2510
2527
|
status: opts.status,
|
|
2511
2528
|
applicability: opts.applicability,
|
|
2512
2529
|
outcome: opts.outcome,
|
|
2530
|
+
approval_id: opts.approval,
|
|
2513
2531
|
limit: opts.limit,
|
|
2514
2532
|
offset: opts.offset
|
|
2515
2533
|
});
|
|
@@ -3619,6 +3637,46 @@ integrationsCmd.command("status <app>").description("Check whether an app is con
|
|
|
3619
3637
|
fail(e);
|
|
3620
3638
|
}
|
|
3621
3639
|
});
|
|
3640
|
+
var accountCmd = integrationsCmd.command("account").description("Read or set which provider account a connection operates");
|
|
3641
|
+
accountCmd.command("show <integration-id>").description("Show which account a connection operates, and which it could (see: erdo integrations list)").action(async (integrationId) => {
|
|
3642
|
+
try {
|
|
3643
|
+
const scope = await new ErdoClient().getConnectionScope(integrationId);
|
|
3644
|
+
if (!scope.has_connection_scope) {
|
|
3645
|
+
console.log("This integration does not choose a provider account per connection.");
|
|
3646
|
+
return;
|
|
3647
|
+
}
|
|
3648
|
+
console.log(scope.description);
|
|
3649
|
+
const selected = new Set(scope.selected.map((a) => a.id));
|
|
3650
|
+
for (const account of scope.options) {
|
|
3651
|
+
const marker = selected.has(account.id) ? "*" : " ";
|
|
3652
|
+
const owner = account.parent ? ` ${account.parent}` : "";
|
|
3653
|
+
console.log(`${marker} ${account.id} ${account.name} ${account.type}${owner}`);
|
|
3654
|
+
}
|
|
3655
|
+
if (scope.options.length === 0) {
|
|
3656
|
+
console.error(
|
|
3657
|
+
`
|
|
3658
|
+
This login reaches no account yet. Set one here once it exists:
|
|
3659
|
+
erdo integrations account set ${integrationId} <account-id>`
|
|
3660
|
+
);
|
|
3661
|
+
} else if (selected.size === 0) {
|
|
3662
|
+
console.error(
|
|
3663
|
+
`
|
|
3664
|
+
No account chosen yet${scope.required ? " \u2014 this connection cannot resolve one until you set it" : ""}.
|
|
3665
|
+
Set it with: erdo integrations account set ${integrationId} <account-id>`
|
|
3666
|
+
);
|
|
3667
|
+
}
|
|
3668
|
+
} catch (e) {
|
|
3669
|
+
fail(e);
|
|
3670
|
+
}
|
|
3671
|
+
});
|
|
3672
|
+
accountCmd.command("set <integration-id> <account-id>").description("Record which account this connection operates \u2014 every dataset, sync, and agent action it serves runs against this account").action(async (integrationId, accountId) => {
|
|
3673
|
+
try {
|
|
3674
|
+
const scope = await new ErdoClient().setConnectionScope(integrationId, accountId);
|
|
3675
|
+
print(scope);
|
|
3676
|
+
} catch (e) {
|
|
3677
|
+
fail(e);
|
|
3678
|
+
}
|
|
3679
|
+
});
|
|
3622
3680
|
integrationsCmd.command("tables <app> [schema]").description("List a connected database integration's schemas, or a schema's tables with columns").action(async (app, schema) => {
|
|
3623
3681
|
try {
|
|
3624
3682
|
const res = await new ErdoClient().discoverIntegrationTables(app, schema);
|