@wrenautomation/aerie 0.8.4 → 0.8.5
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/bin.js +38 -7
- package/dist/bin.js.map +3 -3
- package/dist/cli.js +15 -5
- package/dist/cli.js.map +1 -1
- package/dist/peers-coord.js +24 -1
- package/dist/peers-coord.js.map +2 -2
- package/dist/schema.js +2 -0
- package/dist/schema.js.map +1 -1
- package/dist/shim.js +11 -1
- package/dist/shim.js.map +2 -2
- package/dist/store.js +35 -2
- package/dist/store.js.map +1 -1
- package/drizzle/0012_task_event_at.sql +1 -0
- package/drizzle/meta/0012_snapshot.json +1926 -0
- package/drizzle/meta/_journal.json +7 -0
- package/package.json +3 -3
package/dist/bin.js
CHANGED
|
@@ -30496,6 +30496,8 @@ var init_schema2 = __esm({
|
|
|
30496
30496
|
(t) => [
|
|
30497
30497
|
primaryKey({ columns: [t.seq], name: "pk_task_event" }),
|
|
30498
30498
|
index("task_event_task_idx").on(t.taskId, t.seq),
|
|
30499
|
+
// list updatedAfter: tasks with an event since the cursor (archive keeps updatedAt)
|
|
30500
|
+
index("task_event_at_idx").on(t.at),
|
|
30499
30501
|
index("task_event_words_idx").using("gin", t.words)
|
|
30500
30502
|
]
|
|
30501
30503
|
);
|
|
@@ -30864,7 +30866,15 @@ function aerieStore(o) {
|
|
|
30864
30866
|
)
|
|
30865
30867
|
);
|
|
30866
30868
|
const ctx = f.role ? { grants: await grants() } : {};
|
|
30867
|
-
|
|
30869
|
+
const since = f.updatedAfter;
|
|
30870
|
+
if (!since) return all.filter((t) => matches(t, f, ctx)).sort(compare(sorts));
|
|
30871
|
+
const { updatedAfter: _, ...rest } = f;
|
|
30872
|
+
const moved = new Set(
|
|
30873
|
+
(await db.selectDistinct({ id: taskEvent.taskId }).from(taskEvent).where(gte(taskEvent.at, since))).map((r) => r.id)
|
|
30874
|
+
);
|
|
30875
|
+
return all.filter(
|
|
30876
|
+
(t) => matches(t, rest, ctx) && ((t.updatedAt ?? t.createdAt) >= since || moved.has(t.id))
|
|
30877
|
+
).sort(compare(sorts));
|
|
30868
30878
|
}
|
|
30869
30879
|
async function views(owner) {
|
|
30870
30880
|
const rows3 = await db.select().from(view).where(eq(view.owner, owner)).orderBy(asc(view.name));
|
|
@@ -31145,6 +31155,11 @@ function aerieStore(o) {
|
|
|
31145
31155
|
await tx.insert(setting).values({ key, value }).onConflictDoUpdate({ target: setting.key, set: { value } });
|
|
31146
31156
|
return `${base}${max + 1}`;
|
|
31147
31157
|
}
|
|
31158
|
+
async function tailOrdinal(tx) {
|
|
31159
|
+
const [r] = await tx.select({ top: sql`max(${task.ordinal})`, n: sql`count(*)::int` }).from(task).where(eq(task.place, "tasks"));
|
|
31160
|
+
if (r && r.top !== null) return Number(r.top) + 1e3;
|
|
31161
|
+
return r?.n ? void 0 : 1e3;
|
|
31162
|
+
}
|
|
31148
31163
|
async function create(input2, by, opts = {}) {
|
|
31149
31164
|
const id = await write3(by, async (tx) => {
|
|
31150
31165
|
const parent = input2.parentId ? await must(input2.parentId, tx) : null;
|
|
@@ -31168,6 +31183,10 @@ function aerieStore(o) {
|
|
|
31168
31183
|
};
|
|
31169
31184
|
const t = applyEdit(blank, { ...input2, ...parent ? { parentId: parent.id } : {} }, at4);
|
|
31170
31185
|
delete t.updatedAt;
|
|
31186
|
+
if (t.ordinal === void 0 && (input2.place ?? "tasks") === "tasks") {
|
|
31187
|
+
const tail2 = await tailOrdinal(tx);
|
|
31188
|
+
if (tail2 !== void 0) t.ordinal = tail2;
|
|
31189
|
+
}
|
|
31171
31190
|
const area2 = input2.area ?? parent?.area ?? areaFor(t, rules);
|
|
31172
31191
|
await put(tx, t, await ensureArea(tx, area2), input2.place ?? "tasks");
|
|
31173
31192
|
await setAliases(tx, id2, input2);
|
|
@@ -31185,6 +31204,10 @@ function aerieStore(o) {
|
|
|
31185
31204
|
if (e.parentId) e = { ...e, parentId: (await must(e.parentId, tx)).id };
|
|
31186
31205
|
if (e.milestone) e = { ...e, milestone: await milestoneOf(tx, e.milestone) };
|
|
31187
31206
|
const t = applyEdit(was, e, now());
|
|
31207
|
+
if (Object.keys(e).every((k) => k === "place")) {
|
|
31208
|
+
if (was.updatedAt) t.updatedAt = was.updatedAt;
|
|
31209
|
+
else delete t.updatedAt;
|
|
31210
|
+
}
|
|
31188
31211
|
const areaId = e.area ? await ensureArea(tx, e.area) : await areaIdOf(tx, was.area);
|
|
31189
31212
|
await put(tx, t, areaId, e.place ?? was.place);
|
|
31190
31213
|
await setAliases(tx, row.id, e);
|
|
@@ -42392,11 +42415,7 @@ function editFlags(c, create) {
|
|
|
42392
42415
|
function registerCommands(program3, ctx) {
|
|
42393
42416
|
program3.version(ctx.version, "-v, --version");
|
|
42394
42417
|
async function show(a, t, o, kind) {
|
|
42395
|
-
const [rows3,
|
|
42396
|
-
a.dependencyRows(),
|
|
42397
|
-
ctx.mirrorDir ? a.mirrorFiles([t.id]) : Promise.resolve([])
|
|
42398
|
-
]);
|
|
42399
|
-
const file2 = files[0] && ctx.mirrorDir ? join6(ctx.mirrorDir, files[0].path) : void 0;
|
|
42418
|
+
const [rows3, file2] = await Promise.all([a.dependencyRows(), fileOf(a, t.id)]);
|
|
42400
42419
|
const v = {
|
|
42401
42420
|
rows: rows3,
|
|
42402
42421
|
statuses: STATUSES,
|
|
@@ -42404,8 +42423,15 @@ function registerCommands(program3, ctx) {
|
|
|
42404
42423
|
...ctx.exact ? { exact: true } : {}
|
|
42405
42424
|
};
|
|
42406
42425
|
if (o.json) print3({ schemaVersion: 1, kind, task: viewItem(t, v) });
|
|
42426
|
+
else if (ctx.exact && kind !== "task-view")
|
|
42427
|
+
print3(viewPlain(t, v).replace(/^Parent: (\S+) - .*$/m, "Parent: $1"));
|
|
42407
42428
|
else print3(viewPlain(t, v));
|
|
42408
42429
|
}
|
|
42430
|
+
async function fileOf(a, id) {
|
|
42431
|
+
if (!ctx.mirrorDir) return void 0;
|
|
42432
|
+
const [f] = await a.mirrorFiles([id]);
|
|
42433
|
+
return f ? join6(ctx.mirrorDir, f.path) : void 0;
|
|
42434
|
+
}
|
|
42409
42435
|
const withBoardOrStore = (fn) => ctx.withBoard ? ctx.withBoard(fn) : ctx.withStore((a) => fn(a, null));
|
|
42410
42436
|
async function after(a, id) {
|
|
42411
42437
|
if (!ctx.mirrorDir) return;
|
|
@@ -42432,7 +42458,12 @@ function registerCommands(program3, ctx) {
|
|
|
42432
42458
|
);
|
|
42433
42459
|
await after(a, t.id);
|
|
42434
42460
|
if (o.json || o.plain) await show(a, t, o, "task-create");
|
|
42435
|
-
else
|
|
42461
|
+
else if (ctx.exact) {
|
|
42462
|
+
const file2 = await fileOf(a, t.id);
|
|
42463
|
+
print3(`Created task ${t.id}
|
|
42464
|
+
${file2 ? `File: ${file2}
|
|
42465
|
+
` : ""}`);
|
|
42466
|
+
} else print3(`Created task ${t.id} (area ${t.area})
|
|
42436
42467
|
`);
|
|
42437
42468
|
})
|
|
42438
42469
|
);
|