@erdoai/cli 0.196.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 +13 -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",
|
|
@@ -6315,16 +6316,20 @@ function renderHistory(events) {
|
|
|
6315
6316
|
}
|
|
6316
6317
|
}
|
|
6317
6318
|
}
|
|
6318
|
-
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(
|
|
6319
6320
|
async (opts) => {
|
|
6320
6321
|
try {
|
|
6321
6322
|
const params = {};
|
|
6322
|
-
params.since = parseWhen(opts.since || "24h");
|
|
6323
|
+
if (opts.afterSeq === void 0 || opts.since) params.since = parseWhen(opts.since || "24h");
|
|
6323
6324
|
if (opts.until) params.until = parseWhen(opts.until);
|
|
6324
6325
|
if (opts.actorKind) params.actor_kind = opts.actorKind;
|
|
6325
6326
|
if (opts.actor) params.actor_user_id = opts.actor;
|
|
6326
6327
|
if (opts.verb) params.verbs = opts.verb;
|
|
6327
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
|
+
}
|
|
6328
6333
|
if (opts.resource) {
|
|
6329
6334
|
const idx = opts.resource.indexOf(":");
|
|
6330
6335
|
if (idx === -1) {
|
|
@@ -6339,6 +6344,11 @@ program.command("history").description("The org history \u2014 who did what, whe
|
|
|
6339
6344
|
return;
|
|
6340
6345
|
}
|
|
6341
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
|
+
}
|
|
6342
6352
|
if (events.length === 0) {
|
|
6343
6353
|
const filters = [
|
|
6344
6354
|
`since ${opts.since || "24h"}`,
|
|
@@ -6356,7 +6366,7 @@ program.command("history").description("The org history \u2014 who did what, whe
|
|
|
6356
6366
|
}
|
|
6357
6367
|
renderHistory(events);
|
|
6358
6368
|
console.log(`
|
|
6359
|
-
${events.length} event${events.length === 1 ? "" : "s"}.`);
|
|
6369
|
+
${events.length} event${events.length === 1 ? "" : "s"}${cursor ? `; ${cursor}` : ""}.`);
|
|
6360
6370
|
} catch (e) {
|
|
6361
6371
|
fail(e);
|
|
6362
6372
|
}
|