@simplepush/cli 0.2.0 → 0.2.1
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/main.mjs +11 -11
- package/dist/main.mjs.map +1 -1
- package/package.json +1 -1
package/dist/main.mjs
CHANGED
|
@@ -1164,7 +1164,7 @@ function formatSent(groupId, createdAt, members) {
|
|
|
1164
1164
|
type: "sent",
|
|
1165
1165
|
groupId: groupId ?? null,
|
|
1166
1166
|
createdAt: createdAt ?? null,
|
|
1167
|
-
|
|
1167
|
+
instances: members.map((m) => ({
|
|
1168
1168
|
...m.kind === "notification" ? { notificationId: m.id } : { taskId: m.id },
|
|
1169
1169
|
...m.subtaskId !== void 0 ? { subtaskId: m.subtaskId } : {},
|
|
1170
1170
|
recipient: m.recipient
|
|
@@ -1303,14 +1303,14 @@ function fileViewsOf(item) {
|
|
|
1303
1303
|
]).filter(isFileView);
|
|
1304
1304
|
}
|
|
1305
1305
|
/** The terminal line: reason the stream stopped, per-type counts, and (for
|
|
1306
|
-
* group modes) per-
|
|
1306
|
+
* group modes) per-instance status. Always the last line on a clean run. */
|
|
1307
1307
|
function formatEnd(reason, counts, members, errorMsg) {
|
|
1308
1308
|
const obj = {
|
|
1309
1309
|
type: "end",
|
|
1310
1310
|
reason,
|
|
1311
1311
|
counts
|
|
1312
1312
|
};
|
|
1313
|
-
if (members) obj.
|
|
1313
|
+
if (members) obj.instances = members;
|
|
1314
1314
|
if (errorMsg !== void 0) obj.error = errorMsg;
|
|
1315
1315
|
return line(obj);
|
|
1316
1316
|
}
|
|
@@ -1463,7 +1463,7 @@ const SentLine = Schema.Struct({
|
|
|
1463
1463
|
type: Schema.Literal("sent"),
|
|
1464
1464
|
groupId: Schema.optional(Schema.NullOr(Schema.String)),
|
|
1465
1465
|
createdAt: Schema.optional(Schema.NullOr(Schema.String)),
|
|
1466
|
-
|
|
1466
|
+
instances: Schema.optional(Schema.Array(Schema.Struct({
|
|
1467
1467
|
taskId: Schema.optional(Schema.String),
|
|
1468
1468
|
notificationId: Schema.optional(Schema.String),
|
|
1469
1469
|
subtaskId: Schema.optional(Schema.String),
|
|
@@ -1525,9 +1525,9 @@ const loadOrgMasterKeys = Effect.gen(function* () {
|
|
|
1525
1525
|
});
|
|
1526
1526
|
const collectCommand = Command.make("collect", {
|
|
1527
1527
|
group: Options.text("group").pipe(Options.withDescription("Group id (grptsk_…) to collect over. Usually supplied via the piped `sent` line instead."), Options.optional),
|
|
1528
|
-
instance: Options.text("instance").pipe(Options.withDescription("
|
|
1528
|
+
instance: Options.text("instance").pipe(Options.withDescription("Instance id to collect: a task (tsk_…), a notification (ntf_…), or a subtask-scoped pair (tsk_…/sub_…). Repeatable. Augments/overrides the piped `sent` line's instances."), Options.repeated),
|
|
1529
1529
|
replies: Options.boolean("replies").pipe(Options.withDescription("Collect only replies. Default (no mode flag) is the full activity stream: inputs, replies, and completions.")),
|
|
1530
|
-
inputs: Options.boolean("inputs").pipe(Options.withDescription("Collect only input events (waits for every
|
|
1530
|
+
inputs: Options.boolean("inputs").pipe(Options.withDescription("Collect only input events (waits for every instance to complete by default).")),
|
|
1531
1531
|
submissions: Options.boolean("submissions").pipe(Options.withDescription("Collect submissions (your inbox) instead of a group's events.")),
|
|
1532
1532
|
since: mappedText("since", resolveSince).pipe(Options.withDescription("Resume point (`24h`, `7d`, or ISO 8601). Backfills group events or submissions from that point; defaults to the send's createdAt from the piped `sent` line. Implies --direct (the broker can't serve a deep backfill)."), Options.optional),
|
|
1533
1533
|
until: Options.text("until").pipe(Options.withDescription("Stop condition. Repeatable: complete | idle:<dur> | count:<n> | timeout:<dur> | forever (never stop; Ctrl-C to end). Default: complete for group collects; --replies / --submissions watch forever."), Options.repeated),
|
|
@@ -1600,7 +1600,7 @@ const collectCommand = Command.make("collect", {
|
|
|
1600
1600
|
});
|
|
1601
1601
|
}
|
|
1602
1602
|
};
|
|
1603
|
-
for (const m of sent?.
|
|
1603
|
+
for (const m of sent?.instances ?? []) addMember(m.taskId ?? m.notificationId, m.recipient ? {
|
|
1604
1604
|
publicId: m.recipient.publicId,
|
|
1605
1605
|
name: m.recipient.name ?? null
|
|
1606
1606
|
} : null, m.subtaskId);
|
|
@@ -1609,11 +1609,11 @@ const collectCommand = Command.make("collect", {
|
|
|
1609
1609
|
if (id.startsWith("sub_")) return yield* Effect.fail(new UserError({ message: `a subtask cannot be collected by its id alone (events route under the parent task) — pass --instance <parent tsk_…>/${id}` }));
|
|
1610
1610
|
addMember(id, null, subtaskId);
|
|
1611
1611
|
}
|
|
1612
|
-
if (members.length === 0) return yield* Effect.fail(new UserError({ message: "no
|
|
1612
|
+
if (members.length === 0) return yield* Effect.fail(new UserError({ message: "no instances to collect: pipe a send's `sent` line (`sp task --format json | sp collect`) or pass --instance <tsk_…|ntf_…|tsk_…/sub_…> (repeatable)" }));
|
|
1613
1613
|
const notifRoster = members[0].kind === "notification";
|
|
1614
|
-
if (members.some((m) => m.kind === "notification" !== notifRoster)) return yield* Effect.fail(new UserError({ message: "cannot mix task (tsk_…) and notification (ntf_…)
|
|
1614
|
+
if (members.some((m) => m.kind === "notification" !== notifRoster)) return yield* Effect.fail(new UserError({ message: "cannot mix task (tsk_…) and notification (ntf_…) instances in one collect — run one per kind" }));
|
|
1615
1615
|
const subRoster = members[0].subtaskId !== void 0;
|
|
1616
|
-
if (members.some((m) => m.subtaskId !== void 0 !== subRoster)) return yield* Effect.fail(new UserError({ message: "cannot mix subtask-scoped
|
|
1616
|
+
if (members.some((m) => m.subtaskId !== void 0 !== subRoster)) return yield* Effect.fail(new UserError({ message: "cannot mix subtask-scoped instances (a piped `sp subtask --format json` line or --instance tsk_…/sub_…) with plain task/notification instances in one collect" }));
|
|
1617
1617
|
const streamOpts = {
|
|
1618
1618
|
replay: true,
|
|
1619
1619
|
...until.idleMs !== void 0 ? { idleMs: until.idleMs } : {}
|
|
@@ -1675,7 +1675,7 @@ const collectCommand = Command.make("collect", {
|
|
|
1675
1675
|
});
|
|
1676
1676
|
}
|
|
1677
1677
|
if (args.format === "json") yield* out.print(formatSent(groupId, createdAt, members));
|
|
1678
|
-
else yield* out.info(`collecting ${mode} over ${members.length}
|
|
1678
|
+
else yield* out.info(`collecting ${mode} over ${members.length} instance(s)${groupId ? ` of ${groupId}` : ""}`);
|
|
1679
1679
|
yield* collectGroup(watchGroupId, source, members, args.format, until, saveDir);
|
|
1680
1680
|
}));
|
|
1681
1681
|
}));
|