@erdoai/cli 0.40.1 → 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.
Files changed (2) hide show
  1. package/dist/index.js +64 -2
  2. 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(
@@ -2222,7 +2240,9 @@ agentCmd.command("thread").description("Create a thread; prints its id").option(
2222
2240
  agentCmd.command("threads").description("List your threads").action(async () => {
2223
2241
  try {
2224
2242
  const { threads } = await new ErdoClient().listThreads();
2225
- for (const t of threads) console.log(`${t.id} ${t.name}`);
2243
+ for (const t of threads) {
2244
+ console.log(`${t.id} ${t.name} ${t.created_by_user_name || t.created_by_user_id} ${t.source || "unrecorded"}`);
2245
+ }
2226
2246
  } catch (e) {
2227
2247
  fail(e);
2228
2248
  }
@@ -2231,7 +2251,7 @@ agentCmd.command("messages <threadId>").description("Show a thread's messages (r
2231
2251
  try {
2232
2252
  const { messages } = await new ErdoClient().getThreadMessages(threadId);
2233
2253
  for (const m of messages) {
2234
- const role = m.message.author_entity_type === "app" ? "agent" : m.message.author_entity_type;
2254
+ const role = m.message.author_entity_type === "app" ? "agent" : m.message.author_name || m.message.author_id || m.message.author_entity_type;
2235
2255
  console.log(`\u2014 ${role} \xB7 ${m.message.created_at} \u2014`);
2236
2256
  for (const c of m.contents) {
2237
2257
  if (c.content_type === "text") {
@@ -2998,6 +3018,48 @@ List tables with: erdo integrations tables ${app} <schema>`);
2998
3018
  fail(e);
2999
3019
  }
3000
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
+ });
3001
3063
  var pipelinesCmd = program.command("event-pipelines").description("Inspect event pipelines (lead-capture / webhook flows)");
3002
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) => {
3003
3065
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@erdoai/cli",
3
- "version": "0.40.1",
3
+ "version": "0.41.0",
4
4
  "description": "Erdo CLI \u2014 drive datasets, pages, and evals from the terminal or CI",
5
5
  "type": "module",
6
6
  "bin": {