@erdoai/cli 0.195.0 → 0.197.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 +29 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1324,6 +1324,7 @@ var ErdoClient = class {
|
|
|
1324
1324
|
if (params?.actor_kind) q.set("actor_kind", params.actor_kind);
|
|
1325
1325
|
if (params?.limit) q.set("limit", String(params.limit));
|
|
1326
1326
|
if (params?.offset) q.set("offset", String(params.offset));
|
|
1327
|
+
if (params?.after_seq !== void 0) q.set("after_seq", String(params.after_seq));
|
|
1327
1328
|
const qs = q.toString();
|
|
1328
1329
|
return this.request(
|
|
1329
1330
|
"GET",
|
|
@@ -1574,6 +1575,11 @@ var ErdoClient = class {
|
|
|
1574
1575
|
// `purpose_sibling: true` only to declare a deliberate parallel carrier (a
|
|
1575
1576
|
// separate program a human chose to run), which leaves the other carriers
|
|
1576
1577
|
// alone.
|
|
1578
|
+
// deleteDataset permanently deletes a dataset and its data (DELETE
|
|
1579
|
+
// /v1/datasets/:slug, the same path as the erdo_delete_dataset MCP tool).
|
|
1580
|
+
deleteDataset(slug) {
|
|
1581
|
+
return this.request("DELETE", `/v1/datasets/${encodeURIComponent(slug)}`);
|
|
1582
|
+
}
|
|
1577
1583
|
setDatasetPurpose(slug, input) {
|
|
1578
1584
|
return this.updateDatasetSchema(slug, input);
|
|
1579
1585
|
}
|
|
@@ -6310,16 +6316,20 @@ function renderHistory(events) {
|
|
|
6310
6316
|
}
|
|
6311
6317
|
}
|
|
6312
6318
|
}
|
|
6313
|
-
program.command("history").description("The org history \u2014 who did what, when, under whose authority").option("--since <when>", "start of the window: a duration (2h, 3d) or RFC3339 (default 24h)"
|
|
6319
|
+
program.command("history").description("The org history \u2014 who did what, when, under whose authority").option("--since <when>", "start of the window: a duration (2h, 3d) or RFC3339 (default 24h; none with --after-seq)").option("--until <when>", "end of the window: a duration or RFC3339 timestamp").option("--actor-kind <kind>", "user | agent | system | api_token | scoped_token").option("--actor <user-id>", "only actions by this user id").option("--resource <type:id>", "only actions on this resource, e.g. page:<id>").option("--verb <v>", "comma-separated verbs, e.g. approval.decided,page.published").option("-n, --limit <n>", "max events (default 50, max 200)", (v) => parseInt(v, 10)).option("--after-seq <n>", "forward cursor: entries after this seq, oldest first (0 = from the start); prints next_after_seq", (v) => parseInt(v, 10)).option("--json", "raw events JSON").action(
|
|
6314
6320
|
async (opts) => {
|
|
6315
6321
|
try {
|
|
6316
6322
|
const params = {};
|
|
6317
|
-
params.since = parseWhen(opts.since || "24h");
|
|
6323
|
+
if (opts.afterSeq === void 0 || opts.since) params.since = parseWhen(opts.since || "24h");
|
|
6318
6324
|
if (opts.until) params.until = parseWhen(opts.until);
|
|
6319
6325
|
if (opts.actorKind) params.actor_kind = opts.actorKind;
|
|
6320
6326
|
if (opts.actor) params.actor_user_id = opts.actor;
|
|
6321
6327
|
if (opts.verb) params.verbs = opts.verb;
|
|
6322
6328
|
if (opts.limit) params.limit = opts.limit;
|
|
6329
|
+
if (opts.afterSeq !== void 0) {
|
|
6330
|
+
if (!Number.isInteger(opts.afterSeq) || opts.afterSeq < 0) throw new Error("--after-seq must be 0 or a next_after_seq value");
|
|
6331
|
+
params.after_seq = opts.afterSeq;
|
|
6332
|
+
}
|
|
6323
6333
|
if (opts.resource) {
|
|
6324
6334
|
const idx = opts.resource.indexOf(":");
|
|
6325
6335
|
if (idx === -1) {
|
|
@@ -6334,6 +6344,11 @@ program.command("history").description("The org history \u2014 who did what, whe
|
|
|
6334
6344
|
return;
|
|
6335
6345
|
}
|
|
6336
6346
|
const events = res.events ?? [];
|
|
6347
|
+
const cursor = opts.afterSeq !== void 0 ? `next_after_seq ${res.next_after_seq ?? opts.afterSeq}` : "";
|
|
6348
|
+
if (events.length === 0 && cursor) {
|
|
6349
|
+
console.log(`No history after seq ${opts.afterSeq} yet; ${cursor}.`);
|
|
6350
|
+
return;
|
|
6351
|
+
}
|
|
6337
6352
|
if (events.length === 0) {
|
|
6338
6353
|
const filters = [
|
|
6339
6354
|
`since ${opts.since || "24h"}`,
|
|
@@ -6351,7 +6366,7 @@ program.command("history").description("The org history \u2014 who did what, whe
|
|
|
6351
6366
|
}
|
|
6352
6367
|
renderHistory(events);
|
|
6353
6368
|
console.log(`
|
|
6354
|
-
${events.length} event${events.length === 1 ? "" : "s"}.`);
|
|
6369
|
+
${events.length} event${events.length === 1 ? "" : "s"}${cursor ? `; ${cursor}` : ""}.`);
|
|
6355
6370
|
} catch (e) {
|
|
6356
6371
|
fail(e);
|
|
6357
6372
|
}
|
|
@@ -8492,6 +8507,17 @@ datasetsCmd.command("update-schema <slug>").description("Evolve an existing data
|
|
|
8492
8507
|
fail(e);
|
|
8493
8508
|
}
|
|
8494
8509
|
});
|
|
8510
|
+
datasetsCmd.command("delete <slug>").description("Permanently delete a dataset and all its data (the erdo_delete_dataset MCP tool). Nothing is deleted without --yes").option("--yes", "confirm the permanent deletion").action(async (slug, opts) => {
|
|
8511
|
+
try {
|
|
8512
|
+
if (!opts.yes) {
|
|
8513
|
+
fail(new Error(`deleting ${slug} is permanent and removes all its data; rerun with --yes to delete it`));
|
|
8514
|
+
}
|
|
8515
|
+
await new ErdoClient().deleteDataset(slug);
|
|
8516
|
+
console.log(`deleted ${slug}`);
|
|
8517
|
+
} catch (e) {
|
|
8518
|
+
fail(e);
|
|
8519
|
+
}
|
|
8520
|
+
});
|
|
8495
8521
|
datasetsCmd.command("set-purpose <slug> [purpose]").description(
|
|
8496
8522
|
"Set (or with --clear, remove) the dataset's purpose \u2014 the org-vocabulary role `datasets purposes` reports. Use it to CORRECT a purpose that names the wrong dataset: one purpose maps to one dataset per org, so a purpose left on the wrong one points everything that resolves through the vocabulary at the wrong rows. Setting a purpose another dataset carries is an atomic MOVE: the old carrier is cleared in the same transaction, so one call on the right dataset lands it (the response says which dataset it moved from). Use --sibling only when deliberately running a parallel table for the same purpose."
|
|
8497
8523
|
).option("--clear", "remove the dataset's purpose instead of setting one").option(
|