@erdoai/cli 0.32.0 → 0.33.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 +56 -3
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -310,6 +310,29 @@ var ErdoClient = class {
310
310
  createProject(input) {
311
311
  return this.request("POST", "/v1/projects", input);
312
312
  }
313
+ // --- pages ---
314
+ listPages(params) {
315
+ const q = new URLSearchParams();
316
+ if (params?.query) q.set("query", params.query);
317
+ if (params?.createdAfter) q.set("created_after", params.createdAfter);
318
+ if (params?.createdBefore) q.set("created_before", params.createdBefore);
319
+ if (params?.limit) q.set("limit", String(params.limit));
320
+ if (params?.offset) q.set("offset", String(params.offset));
321
+ const qs = q.toString();
322
+ return this.request("GET", `/v1/pages${qs ? `?${qs}` : ""}`);
323
+ }
324
+ deletePage(id) {
325
+ return this.request(
326
+ "DELETE",
327
+ `/v1/pages/${encodeURIComponent(id)}`
328
+ );
329
+ }
330
+ restorePage(id) {
331
+ return this.request(
332
+ "POST",
333
+ `/v1/pages/restore/${encodeURIComponent(id)}`
334
+ );
335
+ }
313
336
  // --- workstreams ---
314
337
  listWorkstreams(status) {
315
338
  const q = new URLSearchParams();
@@ -2329,10 +2352,40 @@ pagesCmd.command("validate").description("Validate page content without deployin
2329
2352
  fail(e);
2330
2353
  }
2331
2354
  });
2332
- pagesCmd.command("list").description("List artifacts (pages, charts, ...)").option("-t, --type <type>", "filter by type (e.g. html_page)").option("-l, --limit <n>", "max results", (v) => parseInt(v, 10)).action(async (opts) => {
2355
+ pagesCmd.command("list").description("List pages (newest first). With --type, lists any artifact type instead.").option("-t, --type <type>", "list all artifacts of this type (e.g. html) rather than just pages").option("--query <substr>", "case-insensitive title substring filter (pages only)").option("--created-after <iso>", "only pages created at/after this RFC3339 timestamp (pages only)").option("--created-before <iso>", "only pages created at/before this RFC3339 timestamp (pages only)").option("-l, --limit <n>", "max results", (v) => parseInt(v, 10)).option("--offset <n>", "pagination offset", (v) => parseInt(v, 10)).action(
2356
+ async (opts) => {
2357
+ try {
2358
+ if (opts.type) {
2359
+ const { artifacts } = await new ErdoClient().listArtifacts(opts.type, opts.limit);
2360
+ for (const a of artifacts) console.log(`${a.id} ${a.type} ${a.title}`);
2361
+ return;
2362
+ }
2363
+ const { pages } = await new ErdoClient().listPages({
2364
+ query: opts.query,
2365
+ createdAfter: opts.createdAfter,
2366
+ createdBefore: opts.createdBefore,
2367
+ limit: opts.limit,
2368
+ offset: opts.offset
2369
+ });
2370
+ for (const p of pages) {
2371
+ const vis = p.public ? p.public_url || "public" : "private";
2372
+ console.log(`${p.id} ${p.created_at} ${vis} ${p.title}`);
2373
+ }
2374
+ } catch (e) {
2375
+ fail(e);
2376
+ }
2377
+ }
2378
+ );
2379
+ pagesCmd.command("delete <id>").description("Delete a page (soft delete \u2014 unpublishes it and hides it from listings; restorable)").action(async (id) => {
2380
+ try {
2381
+ print(await new ErdoClient().deletePage(id));
2382
+ } catch (e) {
2383
+ fail(e);
2384
+ }
2385
+ });
2386
+ pagesCmd.command("restore <id>").description("Restore a previously deleted page (comes back private)").action(async (id) => {
2333
2387
  try {
2334
- const { artifacts } = await new ErdoClient().listArtifacts(opts.type, opts.limit);
2335
- for (const a of artifacts) console.log(`${a.id} ${a.type} ${a.title}`);
2388
+ print(await new ErdoClient().restorePage(id));
2336
2389
  } catch (e) {
2337
2390
  fail(e);
2338
2391
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@erdoai/cli",
3
- "version": "0.32.0",
3
+ "version": "0.33.0",
4
4
  "description": "Erdo CLI — drive datasets, pages, and evals from the terminal or CI",
5
5
  "type": "module",
6
6
  "bin": {