@erdoai/cli 0.278.0 → 0.279.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 +42 -7
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1712,6 +1712,13 @@ var ErdoClient = class {
1712
1712
  const qs = q.toString();
1713
1713
  return this.request("GET", `/v1/datasets${qs ? `?${qs}` : ""}`);
1714
1714
  }
1715
+ searchDatasets(params) {
1716
+ const q = new URLSearchParams({ query: params.query });
1717
+ if (params.class) q.set("class", params.class);
1718
+ if (params.limit !== void 0) q.set("limit", String(params.limit));
1719
+ if (params.offset !== void 0) q.set("offset", String(params.offset));
1720
+ return this.request("GET", `/v1/datasets-search?${q.toString()}`);
1721
+ }
1715
1722
  listDatasetAssertions(slug) {
1716
1723
  return this.request("GET", `/v1/datasets/${encodeURIComponent(slug)}/assertions`);
1717
1724
  }
@@ -2738,10 +2745,11 @@ var ErdoClient = class {
2738
2745
  validatePage(input) {
2739
2746
  return this.request("POST", "/v1/pages/validate", input);
2740
2747
  }
2741
- listArtifacts(type, limit) {
2748
+ listArtifacts(type, limit, offset) {
2742
2749
  const params = new URLSearchParams();
2743
2750
  if (type) params.set("type", type);
2744
2751
  if (limit) params.set("limit", String(limit));
2752
+ if (offset !== void 0) params.set("offset", String(offset));
2745
2753
  const qs = params.toString();
2746
2754
  return this.request("GET", `/v1/artifacts${qs ? `?${qs}` : ""}`);
2747
2755
  }
@@ -3010,7 +3018,8 @@ function formatIntegrationListRow(i) {
3010
3018
  const unchecked = i.identity_unchecked ? " identity not checked" : "";
3011
3019
  const connectorAccount = i.connector_account_id ? ` connector_account_id=${i.connector_account_id}` : "";
3012
3020
  const memberAccess = i.member_access ? ` members: ${i.member_access}` : "";
3013
- return `${i.app} ${i.status} ${i.auth_type} ${i.name} ${i.id}${connectorAccount}${provided}${memberAccess}${unreadable}${unchecked}`;
3021
+ const reason = i.status_reason ? ` ${i.status_reason}` : "";
3022
+ return `${i.app} ${i.status} ${i.auth_type} ${i.name} ${i.id}${connectorAccount}${provided}${memberAccess}${unreadable}${unchecked}${reason}`;
3014
3023
  }
3015
3024
  function identityNotes(rows) {
3016
3025
  const notes = [];
@@ -9119,18 +9128,17 @@ datasetsCmd.command("list").description("List datasets").option(
9119
9128
  "-l, --limit <n>",
9120
9129
  "max datasets to return (default 20, max 100)",
9121
9130
  (v) => parseInt(v, 10)
9122
- ).option("--offset <n>", "skip the first n datasets (newest first)", (v) => parseInt(v, 10)).action(async (opts) => {
9131
+ ).option("--offset <n>", "continue from the previous response's next_offset", (v) => parseInt(v, 10)).action(async (opts) => {
9123
9132
  try {
9124
- const { datasets, total } = await new ErdoClient().listDatasets({
9133
+ const { datasets, total, has_more, next_offset } = await new ErdoClient().listDatasets({
9125
9134
  class: opts.class,
9126
9135
  limit: opts.limit,
9127
9136
  offset: opts.offset
9128
9137
  });
9129
9138
  for (const d of datasets)
9130
9139
  console.log(`${d.slug} ${d.type} ${d.status} ${d.class ?? "-"} ${d.name}`);
9131
- const shown = (opts.offset ?? 0) + datasets.length;
9132
- if (total > shown) {
9133
- console.error(`(showing ${datasets.length} of ${total} \u2014 use --limit/--offset for more)`);
9140
+ if (has_more) {
9141
+ console.error(`(showing ${datasets.length} of ${total} \u2014 continue with --offset ${next_offset})`);
9134
9142
  } else {
9135
9143
  console.error(`(${total} dataset${total === 1 ? "" : "s"})`);
9136
9144
  }
@@ -9138,6 +9146,31 @@ datasetsCmd.command("list").description("List datasets").option(
9138
9146
  fail(e);
9139
9147
  }
9140
9148
  });
9149
+ datasetsCmd.command("search <query>").description("Search datasets by name or description").option("--class <class>", "filter by structural class: 'table', 'scratch', or 'all'").option("-l, --limit <n>", "max datasets to return (default 20, max 100)", (v) => parseInt(v, 10)).option("--offset <n>", "continue from the previous response's next_offset", (v) => parseInt(v, 10)).option("--json", "print the raw JSON response").action(async (query, opts) => {
9150
+ try {
9151
+ const result = await new ErdoClient().searchDatasets({
9152
+ query,
9153
+ class: opts.class,
9154
+ limit: opts.limit,
9155
+ offset: opts.offset
9156
+ });
9157
+ if (opts.json) {
9158
+ print(result);
9159
+ return;
9160
+ }
9161
+ for (const d of result.datasets)
9162
+ console.log(`${d.slug} ${d.type} ${d.status} ${d.class ?? "-"} ${d.name}`);
9163
+ if (result.has_more) {
9164
+ console.error(`(showing ${result.datasets.length} of ${result.total} \u2014 continue with --offset ${result.next_offset})`);
9165
+ } else if (result.window_exhausted) {
9166
+ console.error("(ranked search window exhausted \u2014 narrow the search to find more matches)");
9167
+ } else {
9168
+ console.error(`(${result.datasets.length} result${result.datasets.length === 1 ? "" : "s"})`);
9169
+ }
9170
+ } catch (e) {
9171
+ fail(e);
9172
+ }
9173
+ });
9141
9174
  datasetsCmd.command("purposes").description(
9142
9175
  "List the org's dataset purposes \u2014 the vocabulary of dataset roles in use (e.g. leads, page events). Each purpose resolves to the current dataset and its declared schema: write there rather than creating a sibling (one purpose = one dataset per org)."
9143
9176
  ).option(
@@ -11391,6 +11424,8 @@ accountCmd.command("show <integration-id>").description("Show which account a co
11391
11424
  return;
11392
11425
  }
11393
11426
  console.log(scope.description);
11427
+ console.log(`Status: ${scope.status}`);
11428
+ if (scope.status_reason) console.log(scope.status_reason);
11394
11429
  const selected = new Set(scope.selected.map((a) => a.id));
11395
11430
  for (const account of opts.options ? scope.options : scope.selected) {
11396
11431
  console.log(formatConnectionAccountOption(account, selected.has(account.id)));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@erdoai/cli",
3
- "version": "0.278.0",
3
+ "version": "0.279.0",
4
4
  "description": "Erdo CLI \u2014 drive datasets, pages, and evals from the terminal or CI",
5
5
  "type": "module",
6
6
  "bin": {