@erdoai/cli 0.61.0 → 0.62.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 +30 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -844,6 +844,15 @@ var ErdoClient = class {
|
|
|
844
844
|
listIntegrations() {
|
|
845
845
|
return this.request("GET", "/v1/integrations");
|
|
846
846
|
}
|
|
847
|
+
// For a Pipedream-backed integration this is the full disconnect: the
|
|
848
|
+
// credential is released at the provider and the connection removed, not just
|
|
849
|
+
// the integration row deleted.
|
|
850
|
+
deleteIntegration(integrationId) {
|
|
851
|
+
return this.request(
|
|
852
|
+
"DELETE",
|
|
853
|
+
`/v1/integrations/${encodeURIComponent(integrationId)}`
|
|
854
|
+
);
|
|
855
|
+
}
|
|
847
856
|
getConnectionScope(integrationId) {
|
|
848
857
|
return this.request(
|
|
849
858
|
"GET",
|
|
@@ -4180,7 +4189,7 @@ integrationsCmd.command("apps [query]").description("Search connectable apps (na
|
|
|
4180
4189
|
fail(e);
|
|
4181
4190
|
}
|
|
4182
4191
|
});
|
|
4183
|
-
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").action(async (app, opts) => {
|
|
4192
|
+
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) => {
|
|
4184
4193
|
try {
|
|
4185
4194
|
let credentials;
|
|
4186
4195
|
if (opts.credential.length) {
|
|
@@ -4195,7 +4204,8 @@ integrationsCmd.command("connect <app>").description("Connect an app \u2014 pass
|
|
|
4195
4204
|
app,
|
|
4196
4205
|
name: opts.name,
|
|
4197
4206
|
credentials,
|
|
4198
|
-
rotate_credentials: opts.rotate || void 0
|
|
4207
|
+
rotate_credentials: opts.rotate || void 0,
|
|
4208
|
+
share_with_org: opts.share || void 0
|
|
4199
4209
|
});
|
|
4200
4210
|
print(res);
|
|
4201
4211
|
const notes = [];
|
|
@@ -4210,6 +4220,24 @@ ${notes.join("\n")}`);
|
|
|
4210
4220
|
fail(e);
|
|
4211
4221
|
}
|
|
4212
4222
|
});
|
|
4223
|
+
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) => {
|
|
4224
|
+
try {
|
|
4225
|
+
const client = new ErdoClient();
|
|
4226
|
+
const { integrations } = await client.listIntegrations();
|
|
4227
|
+
const matches = integrations.filter((i) => i.app === app);
|
|
4228
|
+
if (!matches.length) fail(new Error(`no ${app} connection found \u2014 see: erdo integrations list`));
|
|
4229
|
+
if (matches.length > 1) {
|
|
4230
|
+
fail(
|
|
4231
|
+
new Error(
|
|
4232
|
+
`there are ${matches.length} ${app} connections (${matches.map((i) => i.name || i.id).join(", ")}) \u2014 disconnect the right one from Data \u2192 Connectors in the Erdo web app`
|
|
4233
|
+
)
|
|
4234
|
+
);
|
|
4235
|
+
}
|
|
4236
|
+
print(await client.deleteIntegration(matches[0].id));
|
|
4237
|
+
} catch (e) {
|
|
4238
|
+
fail(e);
|
|
4239
|
+
}
|
|
4240
|
+
});
|
|
4213
4241
|
integrationsCmd.command("status <app>").description("Check whether an app is connected (completes browser-authorized connections)").action(async (app) => {
|
|
4214
4242
|
try {
|
|
4215
4243
|
print(await new ErdoClient().checkIntegrationConnection(app));
|