@erdoai/cli 0.40.2 → 0.41.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 +60 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -694,6 +694,24 @@ var ErdoClient = class {
|
|
|
694
694
|
checkIntegrationConnection(app) {
|
|
695
695
|
return this.request("GET", `/v1/integrations-connect/${encodeURIComponent(app)}`);
|
|
696
696
|
}
|
|
697
|
+
// --- integration connect links ---
|
|
698
|
+
// A connect link is an unauthenticated, shareable URL that lets a third party
|
|
699
|
+
// (e.g. a client's IT admin) complete a native integration's OAuth / API-key
|
|
700
|
+
// setup without an Erdo account. It expires in 14 days and completes once — the
|
|
701
|
+
// returned link_url is a secret.
|
|
702
|
+
createConnectLink(body) {
|
|
703
|
+
return this.request("POST", "/v1/integration-connect-links", body);
|
|
704
|
+
}
|
|
705
|
+
listConnectLinks(app) {
|
|
706
|
+
const qs = app ? `?app=${encodeURIComponent(app)}` : "";
|
|
707
|
+
return this.request("GET", `/v1/integration-connect-links${qs}`);
|
|
708
|
+
}
|
|
709
|
+
revokeConnectLink(id) {
|
|
710
|
+
return this.request(
|
|
711
|
+
"POST",
|
|
712
|
+
`/v1/integration-connect-links/${encodeURIComponent(id)}/revoke`
|
|
713
|
+
);
|
|
714
|
+
}
|
|
697
715
|
// --- dataset filters ---
|
|
698
716
|
listDatasetFilters(datasetSlug) {
|
|
699
717
|
return this.request(
|
|
@@ -3000,6 +3018,48 @@ List tables with: erdo integrations tables ${app} <schema>`);
|
|
|
3000
3018
|
fail(e);
|
|
3001
3019
|
}
|
|
3002
3020
|
});
|
|
3021
|
+
var connectLinksCmd = integrationsCmd.command("connect-links").description("Generate shareable links so a third party can connect an app for you");
|
|
3022
|
+
connectLinksCmd.command("create <app>").description("Mint a shareable connect link for an app by slug \u2014 native (e.g. github, hubspot) or Pipedream (e.g. slack, notion); link_url is a secret").option("-n, --name <name>", "display name for the connection the recipient creates").option("--integration-id <id>", "re-authorize an existing, non-active native integration instead of creating a new one (native only)").action(async (app, opts) => {
|
|
3023
|
+
try {
|
|
3024
|
+
const res = await new ErdoClient().createConnectLink({
|
|
3025
|
+
app,
|
|
3026
|
+
name: opts.name,
|
|
3027
|
+
integration_id: opts.integrationId
|
|
3028
|
+
});
|
|
3029
|
+
print(res);
|
|
3030
|
+
process.stderr.write(
|
|
3031
|
+
`
|
|
3032
|
+
Share link_url with the person who holds the credentials. It expires ${res.expires_at} and completes once. Treat it as a secret \u2014 anyone with it can finish the connection.
|
|
3033
|
+
`
|
|
3034
|
+
);
|
|
3035
|
+
} catch (e) {
|
|
3036
|
+
fail(e);
|
|
3037
|
+
}
|
|
3038
|
+
});
|
|
3039
|
+
connectLinksCmd.command("list").description("List your connect links (id app status for_reauth expires_at link_url)").option("--app <app>", "filter by app slug \u2014 native (e.g. github) or Pipedream (e.g. slack)").action(async (opts) => {
|
|
3040
|
+
try {
|
|
3041
|
+
const { links } = await new ErdoClient().listConnectLinks(opts.app);
|
|
3042
|
+
if (links.length === 0) {
|
|
3043
|
+
console.log("No connect links. Create one with: erdo integrations connect-links create <app>");
|
|
3044
|
+
return;
|
|
3045
|
+
}
|
|
3046
|
+
for (const l of links) {
|
|
3047
|
+
console.log(
|
|
3048
|
+
`${l.id} ${l.app || "-"} ${l.status} ${l.for_reauth ? "reauth" : "new"} ${l.expires_at} ${l.link_url}`
|
|
3049
|
+
);
|
|
3050
|
+
}
|
|
3051
|
+
} catch (e) {
|
|
3052
|
+
fail(e);
|
|
3053
|
+
}
|
|
3054
|
+
});
|
|
3055
|
+
connectLinksCmd.command("revoke <id>").description("Revoke a pending connect link so its URL stops working").action(async (id) => {
|
|
3056
|
+
try {
|
|
3057
|
+
await new ErdoClient().revokeConnectLink(id);
|
|
3058
|
+
console.log(`revoked: ${id}`);
|
|
3059
|
+
} catch (e) {
|
|
3060
|
+
fail(e);
|
|
3061
|
+
}
|
|
3062
|
+
});
|
|
3003
3063
|
var pipelinesCmd = program.command("event-pipelines").description("Inspect event pipelines (lead-capture / webhook flows)");
|
|
3004
3064
|
pipelinesCmd.command("list").description("List event pipelines in the active org").option("-n, --limit <n>", "max rows", (v) => parseInt(v, 10)).action(async (opts) => {
|
|
3005
3065
|
try {
|