@wrenautomation/aerie 0.4.0 → 0.4.2
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 +134 -48
- package/dist/bin.js.map +2 -2
- package/dist/core/fields.d.ts +7 -7
- package/dist/core/fields.js.map +1 -1
- package/dist/core/filter.d.ts +4 -2
- package/dist/core/filter.js.map +1 -1
- package/dist/http.d.ts +45 -1
- package/dist/http.js +19 -9
- package/dist/http.js.map +1 -1
- package/dist/migrations.js +1 -1
- package/dist/migrations.js.map +1 -1
- package/dist/peers-coord.js +133 -47
- package/dist/peers-coord.js.map +2 -2
- package/dist/schema.d.ts +10 -10
- package/dist/schema.js +115 -59
- package/dist/schema.js.map +1 -1
- package/drizzle/0006_keys_named.sql +67 -0
- package/drizzle/meta/0006_snapshot.json +1520 -0
- package/drizzle/meta/_journal.json +7 -0
- package/package.json +1 -1
package/dist/bin.js
CHANGED
|
@@ -15237,7 +15237,7 @@ var at = (name) => timestamp2(name, { withTimezone: true, mode: "string" });
|
|
|
15237
15237
|
var area = aerie.table(
|
|
15238
15238
|
"area",
|
|
15239
15239
|
{
|
|
15240
|
-
id: serial().
|
|
15240
|
+
id: serial().notNull(),
|
|
15241
15241
|
parentId: integer("parent_id"),
|
|
15242
15242
|
slug: text2().notNull(),
|
|
15243
15243
|
name: text2().notNull(),
|
|
@@ -15247,7 +15247,12 @@ var area = aerie.table(
|
|
|
15247
15247
|
sort: doublePrecision().notNull().default(0)
|
|
15248
15248
|
},
|
|
15249
15249
|
(t) => [
|
|
15250
|
-
|
|
15250
|
+
primaryKey({ columns: [t.id], name: "pk_area" }),
|
|
15251
|
+
foreignKey({
|
|
15252
|
+
columns: [t.parentId],
|
|
15253
|
+
foreignColumns: [t.id],
|
|
15254
|
+
name: "fk_area_parent_id_area"
|
|
15255
|
+
}).onDelete("restrict"),
|
|
15251
15256
|
unique("area_parent_slug").on(t.parentId, t.slug).nullsNotDistinct(),
|
|
15252
15257
|
check("area_slug_shape", sql`${t.slug} ~ '^[a-z0-9][a-z0-9-]*$'`)
|
|
15253
15258
|
]
|
|
@@ -15255,23 +15260,36 @@ var area = aerie.table(
|
|
|
15255
15260
|
var actor = aerie.table(
|
|
15256
15261
|
"actor",
|
|
15257
15262
|
{
|
|
15258
|
-
id: text2().
|
|
15263
|
+
id: text2().notNull(),
|
|
15259
15264
|
kind: text2().notNull(),
|
|
15260
15265
|
name: text2().notNull(),
|
|
15261
15266
|
/** a host's sign-in (the portal's viewer email) → this actor */
|
|
15262
15267
|
email: text2().unique("actor_email")
|
|
15263
15268
|
},
|
|
15264
|
-
(t) => [
|
|
15269
|
+
(t) => [
|
|
15270
|
+
primaryKey({ columns: [t.id], name: "pk_actor" }),
|
|
15271
|
+
oneOf("actor_kind", t.kind, ACTOR_KINDS)
|
|
15272
|
+
]
|
|
15265
15273
|
);
|
|
15266
15274
|
var areaRole = aerie.table(
|
|
15267
15275
|
"area_role",
|
|
15268
15276
|
{
|
|
15269
|
-
areaId: integer("area_id").notNull()
|
|
15270
|
-
actorId: text2("actor_id").notNull()
|
|
15277
|
+
areaId: integer("area_id").notNull(),
|
|
15278
|
+
actorId: text2("actor_id").notNull(),
|
|
15271
15279
|
role: text2().notNull()
|
|
15272
15280
|
},
|
|
15273
15281
|
(t) => [
|
|
15274
|
-
primaryKey({ columns: [t.areaId, t.actorId, t.role] }),
|
|
15282
|
+
primaryKey({ columns: [t.areaId, t.actorId, t.role], name: "pk_area_role" }),
|
|
15283
|
+
foreignKey({
|
|
15284
|
+
columns: [t.areaId],
|
|
15285
|
+
foreignColumns: [area.id],
|
|
15286
|
+
name: "fk_area_role_area_id_area"
|
|
15287
|
+
}).onDelete("cascade"),
|
|
15288
|
+
foreignKey({
|
|
15289
|
+
columns: [t.actorId],
|
|
15290
|
+
foreignColumns: [actor.id],
|
|
15291
|
+
name: "fk_area_role_actor_id_actor"
|
|
15292
|
+
}).onDelete("cascade"),
|
|
15275
15293
|
index("area_role_actor_idx").on(t.actorId),
|
|
15276
15294
|
oneOf("area_role_role", t.role, AREA_ROLES)
|
|
15277
15295
|
]
|
|
@@ -15279,9 +15297,9 @@ var areaRole = aerie.table(
|
|
|
15279
15297
|
var task = aerie.table(
|
|
15280
15298
|
"task",
|
|
15281
15299
|
{
|
|
15282
|
-
id: text2().
|
|
15300
|
+
id: text2().notNull(),
|
|
15283
15301
|
/** home area */
|
|
15284
|
-
areaId: integer("area_id").notNull()
|
|
15302
|
+
areaId: integer("area_id").notNull(),
|
|
15285
15303
|
title: text2().notNull(),
|
|
15286
15304
|
status: text2().notNull(),
|
|
15287
15305
|
priority: text2(),
|
|
@@ -15313,6 +15331,12 @@ var task = aerie.table(
|
|
|
15313
15331
|
version: integer().notNull().default(1)
|
|
15314
15332
|
},
|
|
15315
15333
|
(t) => [
|
|
15334
|
+
primaryKey({ columns: [t.id], name: "pk_task" }),
|
|
15335
|
+
foreignKey({
|
|
15336
|
+
columns: [t.areaId],
|
|
15337
|
+
foreignColumns: [area.id],
|
|
15338
|
+
name: "fk_task_area_id_area"
|
|
15339
|
+
}).onDelete("restrict"),
|
|
15316
15340
|
// parent_id: text like dependencies, no key: imported boards hold parents no file has
|
|
15317
15341
|
index("task_area_id_idx").on(t.areaId),
|
|
15318
15342
|
index("task_status_idx").on(t.status),
|
|
@@ -15324,21 +15348,44 @@ var task = aerie.table(
|
|
|
15324
15348
|
var taskArea = aerie.table(
|
|
15325
15349
|
"task_area",
|
|
15326
15350
|
{
|
|
15327
|
-
taskId: text2("task_id").notNull()
|
|
15328
|
-
areaId: integer("area_id").notNull()
|
|
15351
|
+
taskId: text2("task_id").notNull(),
|
|
15352
|
+
areaId: integer("area_id").notNull()
|
|
15329
15353
|
},
|
|
15330
|
-
(t) => [
|
|
15354
|
+
(t) => [
|
|
15355
|
+
primaryKey({ columns: [t.taskId, t.areaId], name: "pk_task_area" }),
|
|
15356
|
+
foreignKey({
|
|
15357
|
+
columns: [t.taskId],
|
|
15358
|
+
foreignColumns: [task.id],
|
|
15359
|
+
name: "fk_task_area_task_id_task"
|
|
15360
|
+
}).onDelete("cascade"),
|
|
15361
|
+
foreignKey({
|
|
15362
|
+
columns: [t.areaId],
|
|
15363
|
+
foreignColumns: [area.id],
|
|
15364
|
+
name: "fk_task_area_area_id_area"
|
|
15365
|
+
}).onDelete("cascade"),
|
|
15366
|
+
index("task_area_area_idx").on(t.areaId)
|
|
15367
|
+
]
|
|
15331
15368
|
);
|
|
15332
15369
|
var taskActor = aerie.table(
|
|
15333
15370
|
"task_actor",
|
|
15334
15371
|
{
|
|
15335
|
-
taskId: text2("task_id").notNull()
|
|
15336
|
-
actorId: text2("actor_id").notNull()
|
|
15372
|
+
taskId: text2("task_id").notNull(),
|
|
15373
|
+
actorId: text2("actor_id").notNull(),
|
|
15337
15374
|
role: text2().notNull(),
|
|
15338
15375
|
sort: integer().notNull().default(0)
|
|
15339
15376
|
},
|
|
15340
15377
|
(t) => [
|
|
15341
|
-
primaryKey({ columns: [t.taskId, t.actorId, t.role] }),
|
|
15378
|
+
primaryKey({ columns: [t.taskId, t.actorId, t.role], name: "pk_task_actor" }),
|
|
15379
|
+
foreignKey({
|
|
15380
|
+
columns: [t.taskId],
|
|
15381
|
+
foreignColumns: [task.id],
|
|
15382
|
+
name: "fk_task_actor_task_id_task"
|
|
15383
|
+
}).onDelete("cascade"),
|
|
15384
|
+
foreignKey({
|
|
15385
|
+
columns: [t.actorId],
|
|
15386
|
+
foreignColumns: [actor.id],
|
|
15387
|
+
name: "fk_task_actor_actor_id_actor"
|
|
15388
|
+
}).onDelete("restrict"),
|
|
15342
15389
|
index("task_actor_actor_idx").on(t.actorId),
|
|
15343
15390
|
oneOf("task_actor_role", t.role, TASK_ROLES)
|
|
15344
15391
|
]
|
|
@@ -15346,19 +15393,26 @@ var taskActor = aerie.table(
|
|
|
15346
15393
|
var taskHolder = aerie.table(
|
|
15347
15394
|
"task_holder",
|
|
15348
15395
|
{
|
|
15349
|
-
taskId: text2("task_id").notNull()
|
|
15396
|
+
taskId: text2("task_id").notNull(),
|
|
15350
15397
|
holder: text2().notNull(),
|
|
15351
15398
|
since: at("since").notNull().defaultNow(),
|
|
15352
15399
|
/** order in Backlog.md's assignee list: peers compares the list as text */
|
|
15353
15400
|
sort: integer().notNull().default(0)
|
|
15354
15401
|
},
|
|
15355
|
-
(t) => [
|
|
15402
|
+
(t) => [
|
|
15403
|
+
primaryKey({ columns: [t.taskId, t.holder], name: "pk_task_holder" }),
|
|
15404
|
+
foreignKey({
|
|
15405
|
+
columns: [t.taskId],
|
|
15406
|
+
foreignColumns: [task.id],
|
|
15407
|
+
name: "fk_task_holder_task_id_task"
|
|
15408
|
+
}).onDelete("cascade")
|
|
15409
|
+
]
|
|
15356
15410
|
);
|
|
15357
15411
|
var view = aerie.table(
|
|
15358
15412
|
"view",
|
|
15359
15413
|
{
|
|
15360
|
-
id: serial().
|
|
15361
|
-
owner: text2().notNull()
|
|
15414
|
+
id: serial().notNull(),
|
|
15415
|
+
owner: text2().notNull(),
|
|
15362
15416
|
name: text2().notNull(),
|
|
15363
15417
|
filter: jsonb().notNull().default({}),
|
|
15364
15418
|
sort: jsonb().notNull().default([]),
|
|
@@ -15367,12 +15421,21 @@ var view = aerie.table(
|
|
|
15367
15421
|
/** List columns: field keys in order; null = the default set */
|
|
15368
15422
|
columns: jsonb()
|
|
15369
15423
|
},
|
|
15370
|
-
(t) => [
|
|
15424
|
+
(t) => [
|
|
15425
|
+
primaryKey({ columns: [t.id], name: "pk_view" }),
|
|
15426
|
+
foreignKey({
|
|
15427
|
+
columns: [t.owner],
|
|
15428
|
+
foreignColumns: [actor.id],
|
|
15429
|
+
name: "fk_view_owner_actor"
|
|
15430
|
+
}).onDelete("cascade"),
|
|
15431
|
+
unique("view_owner_name").on(t.owner, t.name),
|
|
15432
|
+
oneOf("view_layout", t.layout, LAYOUTS)
|
|
15433
|
+
]
|
|
15371
15434
|
);
|
|
15372
15435
|
var taskEvent = aerie.table(
|
|
15373
15436
|
"task_event",
|
|
15374
15437
|
{
|
|
15375
|
-
seq: bigserial({ mode: "number" }).
|
|
15438
|
+
seq: bigserial({ mode: "number" }).notNull(),
|
|
15376
15439
|
taskId: text2("task_id").notNull(),
|
|
15377
15440
|
at: at("at").notNull().defaultNow(),
|
|
15378
15441
|
by: text2().notNull(),
|
|
@@ -15380,25 +15443,33 @@ var taskEvent = aerie.table(
|
|
|
15380
15443
|
why: text2(),
|
|
15381
15444
|
body: jsonb().notNull().default({})
|
|
15382
15445
|
},
|
|
15383
|
-
(t) => [
|
|
15446
|
+
(t) => [
|
|
15447
|
+
primaryKey({ columns: [t.seq], name: "pk_task_event" }),
|
|
15448
|
+
index("task_event_task_idx").on(t.taskId, t.seq)
|
|
15449
|
+
]
|
|
15450
|
+
);
|
|
15451
|
+
var milestone = aerie.table(
|
|
15452
|
+
"milestone",
|
|
15453
|
+
{ id: text2().notNull(), title: text2().notNull(), description: text2() },
|
|
15454
|
+
(t) => [primaryKey({ columns: [t.id], name: "pk_milestone" })]
|
|
15455
|
+
);
|
|
15456
|
+
var mirrorFile = aerie.table(
|
|
15457
|
+
"mirror_file",
|
|
15458
|
+
{
|
|
15459
|
+
taskId: text2("task_id").notNull(),
|
|
15460
|
+
path: text2().notNull().unique(),
|
|
15461
|
+
hash: text2().notNull(),
|
|
15462
|
+
/** the task's version when the mirror wrote: a file edit wins while the row has not moved */
|
|
15463
|
+
version: integer().notNull().default(0),
|
|
15464
|
+
at: at("at").notNull().defaultNow()
|
|
15465
|
+
},
|
|
15466
|
+
(t) => [primaryKey({ columns: [t.taskId], name: "pk_mirror_file" })]
|
|
15467
|
+
);
|
|
15468
|
+
var setting = aerie.table(
|
|
15469
|
+
"setting",
|
|
15470
|
+
{ key: text2().notNull(), value: text2().notNull() },
|
|
15471
|
+
(t) => [primaryKey({ columns: [t.key], name: "pk_setting" })]
|
|
15384
15472
|
);
|
|
15385
|
-
var milestone = aerie.table("milestone", {
|
|
15386
|
-
id: text2().primaryKey(),
|
|
15387
|
-
title: text2().notNull(),
|
|
15388
|
-
description: text2()
|
|
15389
|
-
});
|
|
15390
|
-
var mirrorFile = aerie.table("mirror_file", {
|
|
15391
|
-
taskId: text2("task_id").primaryKey(),
|
|
15392
|
-
path: text2().notNull().unique(),
|
|
15393
|
-
hash: text2().notNull(),
|
|
15394
|
-
/** the task's version when the mirror wrote: a file edit wins while the row has not moved */
|
|
15395
|
-
version: integer().notNull().default(0),
|
|
15396
|
-
at: at("at").notNull().defaultNow()
|
|
15397
|
-
});
|
|
15398
|
-
var setting = aerie.table("setting", {
|
|
15399
|
-
key: text2().primaryKey(),
|
|
15400
|
-
value: text2().notNull()
|
|
15401
|
-
});
|
|
15402
15473
|
var coordGen = aerie.sequence("coord_gen");
|
|
15403
15474
|
var coordLease = aerie.table(
|
|
15404
15475
|
"coord_lease",
|
|
@@ -15413,19 +15484,22 @@ var coordLease = aerie.table(
|
|
|
15413
15484
|
lane: text2(),
|
|
15414
15485
|
pin: text2()
|
|
15415
15486
|
},
|
|
15416
|
-
(t) => [primaryKey({ columns: [t.ns, t.taskId, t.holder] })]
|
|
15487
|
+
(t) => [primaryKey({ columns: [t.ns, t.taskId, t.holder], name: "pk_coord_lease" })]
|
|
15417
15488
|
);
|
|
15418
15489
|
var coordClosing = aerie.table(
|
|
15419
15490
|
"coord_closing",
|
|
15420
15491
|
{
|
|
15421
|
-
id: bigserial({ mode: "number" }).
|
|
15492
|
+
id: bigserial({ mode: "number" }).notNull(),
|
|
15422
15493
|
ns: text2().notNull(),
|
|
15423
15494
|
taskId: text2("task_id").notNull(),
|
|
15424
15495
|
holder: text2().notNull(),
|
|
15425
15496
|
reason: text2().notNull(),
|
|
15426
15497
|
at: at("at").notNull().defaultNow()
|
|
15427
15498
|
},
|
|
15428
|
-
(t) => [
|
|
15499
|
+
(t) => [
|
|
15500
|
+
primaryKey({ columns: [t.id], name: "pk_coord_closing" }),
|
|
15501
|
+
index("coord_closing_task_idx").on(t.ns, t.taskId)
|
|
15502
|
+
]
|
|
15429
15503
|
);
|
|
15430
15504
|
var coordTask = aerie.table(
|
|
15431
15505
|
"coord_task",
|
|
@@ -15434,7 +15508,7 @@ var coordTask = aerie.table(
|
|
|
15434
15508
|
taskId: text2("task_id").notNull(),
|
|
15435
15509
|
updated: at("updated").notNull().defaultNow()
|
|
15436
15510
|
},
|
|
15437
|
-
(t) => [primaryKey({ columns: [t.ns, t.taskId] })]
|
|
15511
|
+
(t) => [primaryKey({ columns: [t.ns, t.taskId], name: "pk_coord_task" })]
|
|
15438
15512
|
);
|
|
15439
15513
|
var coordQueue = aerie.table(
|
|
15440
15514
|
"coord_queue",
|
|
@@ -15445,12 +15519,15 @@ var coordQueue = aerie.table(
|
|
|
15445
15519
|
pin: text2(),
|
|
15446
15520
|
pos: doublePrecision().notNull()
|
|
15447
15521
|
},
|
|
15448
|
-
(t) => [
|
|
15522
|
+
(t) => [
|
|
15523
|
+
primaryKey({ columns: [t.ns, t.taskId], name: "pk_coord_queue" }),
|
|
15524
|
+
index("coord_queue_pos_idx").on(t.ns, t.pos)
|
|
15525
|
+
]
|
|
15449
15526
|
);
|
|
15450
15527
|
var decision = aerie.table(
|
|
15451
15528
|
"decision",
|
|
15452
15529
|
{
|
|
15453
|
-
id: serial().
|
|
15530
|
+
id: serial().notNull(),
|
|
15454
15531
|
question: text2().notNull(),
|
|
15455
15532
|
/** [{ key, text, cost? }] */
|
|
15456
15533
|
options: jsonb().notNull().default([]),
|
|
@@ -15460,7 +15537,7 @@ var decision = aerie.table(
|
|
|
15460
15537
|
brief: text2(),
|
|
15461
15538
|
/** task ids this decision blocks */
|
|
15462
15539
|
blocks: text2().array().notNull().default(sql`'{}'::text[]`),
|
|
15463
|
-
areaId: integer("area_id")
|
|
15540
|
+
areaId: integer("area_id"),
|
|
15464
15541
|
askedBy: text2("asked_by").notNull(),
|
|
15465
15542
|
askedAt: at("asked_at").notNull().defaultNow(),
|
|
15466
15543
|
due: at("due"),
|
|
@@ -15470,7 +15547,16 @@ var decision = aerie.table(
|
|
|
15470
15547
|
answeredAt: at("answered_at"),
|
|
15471
15548
|
why: text2()
|
|
15472
15549
|
},
|
|
15473
|
-
(t) => [
|
|
15550
|
+
(t) => [
|
|
15551
|
+
primaryKey({ columns: [t.id], name: "pk_decision" }),
|
|
15552
|
+
foreignKey({
|
|
15553
|
+
columns: [t.areaId],
|
|
15554
|
+
foreignColumns: [area.id],
|
|
15555
|
+
name: "fk_decision_area_id_area"
|
|
15556
|
+
}),
|
|
15557
|
+
index("decision_area_idx").on(t.areaId),
|
|
15558
|
+
index("decision_open_idx").on(t.answeredAt)
|
|
15559
|
+
]
|
|
15474
15560
|
);
|
|
15475
15561
|
|
|
15476
15562
|
// src/store.ts
|
|
@@ -18103,7 +18189,7 @@ async function migrateAerie(db, o = {}) {
|
|
|
18103
18189
|
if (role) await tx.execute(sql.raw(`SET LOCAL ROLE ${quote(role)}`));
|
|
18104
18190
|
await tx.execute(
|
|
18105
18191
|
sql.raw(
|
|
18106
|
-
`CREATE TABLE IF NOT EXISTS "${s}"."${t}" (id SERIAL PRIMARY KEY, hash text NOT NULL, created_at bigint)`
|
|
18192
|
+
`CREATE TABLE IF NOT EXISTS "${s}"."${t}" (id SERIAL CONSTRAINT "pk_aerie_migrations" PRIMARY KEY, hash text NOT NULL, created_at bigint)`
|
|
18107
18193
|
)
|
|
18108
18194
|
);
|
|
18109
18195
|
const last = rows(
|