@erdoai/cli 0.103.2 → 0.104.1
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 +55 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1397,6 +1397,15 @@ var ErdoClient = class {
|
|
|
1397
1397
|
// organization lends to you rather than one this org connected. It is usable
|
|
1398
1398
|
// exactly like your own for as long as the management link lives, and is not
|
|
1399
1399
|
// yours to rotate or disconnect.
|
|
1400
|
+
//
|
|
1401
|
+
// `identity_unreadable` says why `account_id` is absent: the connection's
|
|
1402
|
+
// stored credential could not be read back, so the account could not be
|
|
1403
|
+
// resolved. An absent `account_id` WITHOUT it is the other fact — the
|
|
1404
|
+
// connection genuinely has no account recorded. Do not treat the two the
|
|
1405
|
+
// same; only the second one is a connection you can fix by setting an
|
|
1406
|
+
// account. `identity_unchecked` is a third fact: the lookup itself failed this
|
|
1407
|
+
// time (a transient failure), so nothing is known about the credential — list
|
|
1408
|
+
// again rather than reconnecting.
|
|
1400
1409
|
listIntegrations() {
|
|
1401
1410
|
return this.request("GET", "/v1/integrations");
|
|
1402
1411
|
}
|
|
@@ -1946,7 +1955,40 @@ async function promptLine(question) {
|
|
|
1946
1955
|
// src/integrations.ts
|
|
1947
1956
|
function formatIntegrationListRow(i) {
|
|
1948
1957
|
const provided = i.provided_by_organization_slug ? ` provided by ${i.provided_by_organization_slug}` : "";
|
|
1949
|
-
|
|
1958
|
+
const unreadable = i.identity_unreadable ? " identity unreadable" : "";
|
|
1959
|
+
const unchecked = i.identity_unchecked ? " identity not checked" : "";
|
|
1960
|
+
return `${i.app} ${i.status} ${i.auth_type} ${i.name} ${i.id}${provided}${unreadable}${unchecked}`;
|
|
1961
|
+
}
|
|
1962
|
+
function identityNotes(rows) {
|
|
1963
|
+
const notes = [];
|
|
1964
|
+
const unreadable = rows.filter((i) => i.identity_unreadable);
|
|
1965
|
+
const owned = unreadable.filter((i) => !i.provided_by_organization_slug);
|
|
1966
|
+
if (owned.length) {
|
|
1967
|
+
notes.push(
|
|
1968
|
+
`The stored credential could not be read for ${owned.length} connection(s): ${owned.map((i) => i.id).join(", ")} \u2014 their account is unknown rather than unset. Reconnect them to restore it.`
|
|
1969
|
+
);
|
|
1970
|
+
}
|
|
1971
|
+
const byManager = /* @__PURE__ */ new Map();
|
|
1972
|
+
for (const i of unreadable) {
|
|
1973
|
+
if (!i.provided_by_organization_slug) continue;
|
|
1974
|
+
const ids = byManager.get(i.provided_by_organization_slug) ?? [];
|
|
1975
|
+
ids.push(i.id);
|
|
1976
|
+
byManager.set(i.provided_by_organization_slug, ids);
|
|
1977
|
+
}
|
|
1978
|
+
for (const [manager, ids] of byManager) {
|
|
1979
|
+
notes.push(
|
|
1980
|
+
`The stored credential could not be read for ${ids.length} connection(s) provided by ${manager}: ${ids.join(
|
|
1981
|
+
", "
|
|
1982
|
+
)} \u2014 their account is unknown rather than unset. Only ${manager} can reconnect them; ask an admin there.`
|
|
1983
|
+
);
|
|
1984
|
+
}
|
|
1985
|
+
const unchecked = rows.filter((i) => i.identity_unchecked);
|
|
1986
|
+
if (unchecked.length) {
|
|
1987
|
+
notes.push(
|
|
1988
|
+
`The account could not be checked for ${unchecked.length} connection(s) this time: ${unchecked.map((i) => i.id).join(", ")}. Nothing is known to be wrong with them; run the list again.`
|
|
1989
|
+
);
|
|
1990
|
+
}
|
|
1991
|
+
return notes;
|
|
1950
1992
|
}
|
|
1951
1993
|
|
|
1952
1994
|
// src/scope.ts
|
|
@@ -6528,6 +6570,9 @@ datasetsCmd.command("configure-integration <dataset-id>").description(
|
|
|
6528
6570
|
).option(
|
|
6529
6571
|
"--disable-sync",
|
|
6530
6572
|
"tear down the canonical data-platform sync \u2014 retire a superseded or stale synced dataset; ignores --segments"
|
|
6573
|
+
).option(
|
|
6574
|
+
"--replaced-by <slug>",
|
|
6575
|
+
"with --disable-sync: the dataset that takes over (same organization); automations reading the retired dataset are moved onto it"
|
|
6531
6576
|
).action(
|
|
6532
6577
|
async (datasetID, opts) => {
|
|
6533
6578
|
try {
|
|
@@ -6535,6 +6580,10 @@ datasetsCmd.command("configure-integration <dataset-id>").description(
|
|
|
6535
6580
|
fail("Pass either --enable-sync or --disable-sync, not both");
|
|
6536
6581
|
return;
|
|
6537
6582
|
}
|
|
6583
|
+
if (opts.replacedBy && !opts.disableSync) {
|
|
6584
|
+
fail("--replaced-by only applies together with --disable-sync");
|
|
6585
|
+
return;
|
|
6586
|
+
}
|
|
6538
6587
|
if (!opts.disableSync && !opts.enableSync && !opts.segments) {
|
|
6539
6588
|
fail("--segments is required unless you pass --enable-sync or --disable-sync");
|
|
6540
6589
|
return;
|
|
@@ -6543,10 +6592,11 @@ datasetsCmd.command("configure-integration <dataset-id>").description(
|
|
|
6543
6592
|
const result = await new ErdoClient().configureIntegrationDataset(datasetID, {
|
|
6544
6593
|
segments,
|
|
6545
6594
|
enable_sync: opts.enableSync,
|
|
6546
|
-
disable_sync: opts.disableSync
|
|
6595
|
+
disable_sync: opts.disableSync,
|
|
6596
|
+
replaced_by: opts.replacedBy
|
|
6547
6597
|
});
|
|
6548
6598
|
console.log(
|
|
6549
|
-
opts.disableSync ? `Retired sync for dataset ${result.dataset_id} (status: ${result.status}). Re-enable with --enable-sync
|
|
6599
|
+
opts.disableSync ? `Retired sync for dataset ${result.dataset_id} (status: ${result.status}).` + (opts.replacedBy ? ` Automations that read it are moving to ${opts.replacedBy}.` : "") + " Re-enable with --enable-sync." : `Configured dataset ${result.dataset_id}, status: ${result.status}, sync: ${result.sync_enabled ? "enabled" : "unchanged"}`
|
|
6550
6600
|
);
|
|
6551
6601
|
} catch (e) {
|
|
6552
6602
|
fail(e);
|
|
@@ -7409,6 +7459,8 @@ integrationsCmd.command("list").description("List connected integrations \u2014
|
|
|
7409
7459
|
try {
|
|
7410
7460
|
const { integrations } = await new ErdoClient().listIntegrations();
|
|
7411
7461
|
for (const i of integrations) console.log(formatIntegrationListRow(i));
|
|
7462
|
+
for (const note of identityNotes(integrations)) process.stderr.write(`${note}
|
|
7463
|
+
`);
|
|
7412
7464
|
} catch (e) {
|
|
7413
7465
|
fail(e);
|
|
7414
7466
|
}
|