@erdoai/cli 0.275.0 → 0.277.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 +14 -5
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3043,6 +3043,11 @@ function identityNotes(rows) {
|
|
|
3043
3043
|
}
|
|
3044
3044
|
return notes;
|
|
3045
3045
|
}
|
|
3046
|
+
function formatConnectionAccountOption(account, selected) {
|
|
3047
|
+
const owner = account.parent ? ` ${account.parent}` : "";
|
|
3048
|
+
const unavailable = account.unavailable_reason ? ` Unavailable: ${account.unavailable_reason}` : "";
|
|
3049
|
+
return `${selected ? "*" : " "} ${account.id} ${account.name} ${account.type}${owner}${unavailable}`;
|
|
3050
|
+
}
|
|
3046
3051
|
|
|
3047
3052
|
// src/scope.ts
|
|
3048
3053
|
import { Option } from "commander";
|
|
@@ -11311,11 +11316,17 @@ ${notes.join("\n")}`);
|
|
|
11311
11316
|
fail(e);
|
|
11312
11317
|
}
|
|
11313
11318
|
});
|
|
11314
|
-
integrationsCmd.command("managed-access <integration-id> <owner_only|managed_organizations>").option("--managed-organization <id>", "Limit this operation to one managed organization").option("--
|
|
11315
|
-
"Lend an API key to managed organizations, or
|
|
11319
|
+
integrationsCmd.command("managed-access <integration-id> <owner_only|managed_organizations>").option("--managed-organization <id>", "Limit this operation to one managed organization").option("--managed-organization-slug <slug>", "Delegate to this actively managed organization").option("--account <id>", "Existing provider account to delegate; requires --account-type").option("--account-type <type>", "Provider segment type, e.g. account for Google Ads or ad_account for LinkedIn").option("--replace-current-account", "Consent to leaving a different current account and its campaigns behind").option("--ad-account <id>", "Legacy LinkedIn account assignment; use --account and --account-type for new calls").option("--client-integration <id>", "Use the managed organization's existing integration").option("--preserve-client-grant", "Assert the existing client's OAuth grant is independent of the manager and retain it on revoke").description(
|
|
11320
|
+
"Lend an API key to managed organizations, or delegate one OAuth account with --managed-organization-slug, --account and --account-type"
|
|
11316
11321
|
).action(async (integrationId, managedAccess, opts) => {
|
|
11317
11322
|
try {
|
|
11323
|
+
if (Boolean(opts.account) !== Boolean(opts.accountType)) throw new Error("--account and --account-type are required together");
|
|
11324
|
+
if (opts.account && opts.adAccount) throw new Error("Use --account or --ad-account, not both");
|
|
11325
|
+
if (opts.managedOrganization && opts.managedOrganizationSlug) throw new Error("Use --managed-organization-slug or --managed-organization, not both");
|
|
11318
11326
|
const res = await new ErdoClient().setIntegrationManagedAccess(integrationId, managedAccess, {
|
|
11327
|
+
managed_organization_slug: opts.managedOrganizationSlug,
|
|
11328
|
+
selected_segments: opts.account ? [{ type: opts.accountType, id: opts.account }] : void 0,
|
|
11329
|
+
replace_current_account: opts.replaceCurrentAccount,
|
|
11319
11330
|
managed_organization_id: opts.managedOrganization,
|
|
11320
11331
|
ad_account_id: opts.adAccount,
|
|
11321
11332
|
client_integration_id: opts.clientIntegration,
|
|
@@ -11382,9 +11393,7 @@ accountCmd.command("show <integration-id>").description("Show which account a co
|
|
|
11382
11393
|
console.log(scope.description);
|
|
11383
11394
|
const selected = new Set(scope.selected.map((a) => a.id));
|
|
11384
11395
|
for (const account of opts.options ? scope.options : scope.selected) {
|
|
11385
|
-
|
|
11386
|
-
const owner = account.parent ? ` ${account.parent}` : "";
|
|
11387
|
-
console.log(`${marker} ${account.id} ${account.name} ${account.type}${owner}`);
|
|
11396
|
+
console.log(formatConnectionAccountOption(account, selected.has(account.id)));
|
|
11388
11397
|
}
|
|
11389
11398
|
if (!opts.options) {
|
|
11390
11399
|
if (scope.selected.length === 0) console.error("No account recorded on this connection.");
|