@zq-silk/yui 0.6.11 → 0.6.12
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.
|
@@ -529,7 +529,6 @@ function hashPayloadTable(db, sql) {
|
|
|
529
529
|
const rows = db.prepare(sql).all();
|
|
530
530
|
return hashRecords(rows.map((row) => JSON.parse(row.payload)));
|
|
531
531
|
}
|
|
532
|
-
/** Reconstruct a WorkMailbox from the normalised mailboxes table columns. */
|
|
533
532
|
export function rowToMailbox(row) {
|
|
534
533
|
let target;
|
|
535
534
|
switch (row.target_kind) {
|
|
@@ -551,13 +550,25 @@ export function rowToMailbox(row) {
|
|
|
551
550
|
default:
|
|
552
551
|
target = { kind: row.target_kind };
|
|
553
552
|
}
|
|
554
|
-
|
|
555
|
-
schemaVersion: 1,
|
|
553
|
+
const common = {
|
|
556
554
|
target,
|
|
557
555
|
nextSequence: row.next_sequence,
|
|
558
556
|
processing: row.processing === null ? null : JSON.parse(row.processing),
|
|
559
557
|
pending: row.pending === null ? null : JSON.parse(row.pending)
|
|
560
558
|
};
|
|
559
|
+
return Object.hasOwn(row, "input_delivery")
|
|
560
|
+
? {
|
|
561
|
+
schemaVersion: 2,
|
|
562
|
+
...common,
|
|
563
|
+
inputDelivery: row.input_delivery === null
|
|
564
|
+
? null
|
|
565
|
+
: JSON.parse(row.input_delivery)
|
|
566
|
+
}
|
|
567
|
+
: { schemaVersion: 1, ...common };
|
|
568
|
+
}
|
|
569
|
+
function readWorkMailboxRows(db) {
|
|
570
|
+
const hasInputDelivery = db.prepare("PRAGMA table_info(mailboxes)").all().some(({ name }) => name === "input_delivery");
|
|
571
|
+
return db.prepare(`SELECT target_kind, task_id, role_name, next_sequence, processing, pending${hasInputDelivery ? ", input_delivery" : ""} FROM mailboxes ORDER BY target_key`).all();
|
|
561
572
|
}
|
|
562
573
|
/**
|
|
563
574
|
* Compute per-family checksums from the SQLite database. The database is
|
|
@@ -603,7 +614,7 @@ export function computeDbFamilyChecksums(home, databaseFilename) {
|
|
|
603
614
|
checksums.capabilityGrant = hashPayloadTable(db, "SELECT payload FROM capability_grants");
|
|
604
615
|
checksums.releaseWorkflow = hashPayloadTable(db, "SELECT payload FROM release_workflows");
|
|
605
616
|
// Mailboxes are reconstructed from typed columns (no payload column).
|
|
606
|
-
const mailboxRows = db
|
|
617
|
+
const mailboxRows = readWorkMailboxRows(db);
|
|
607
618
|
checksums.workMailbox = hashRecords(mailboxRows.map(rowToMailbox));
|
|
608
619
|
return checksums;
|
|
609
620
|
}
|
|
@@ -774,7 +785,7 @@ export function readStateFromSqlite(home) {
|
|
|
774
785
|
stored.idHighWaterMarks[row.kind] = row.high_water;
|
|
775
786
|
}
|
|
776
787
|
// Work mailboxes: reconstructed from typed columns (no payload column).
|
|
777
|
-
const mailboxRows = db
|
|
788
|
+
const mailboxRows = readWorkMailboxRows(db);
|
|
778
789
|
const mailboxes = state.mailboxes;
|
|
779
790
|
for (const row of mailboxRows) {
|
|
780
791
|
const mailbox = rowToMailbox(row);
|