@ocap/indexdb-sqlite 1.31.9 → 1.32.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.
@@ -50,8 +50,9 @@ var TransactionTable = class extends base_default {
50
50
  * Override _update to also keep tx_ref junction table synchronized atomically
51
51
  */
52
52
  async _update(key, updates, context) {
53
+ const normalized = updates?.tx?.itxJson ? formatTxBeforeInsert(updates) : updates;
53
54
  const run = async (txnCtx) => {
54
- const result = await super._update(key, updates, txnCtx);
55
+ const result = await super._update(key, normalized, txnCtx);
55
56
  await this.syncTxRefs(result, txnCtx, true);
56
57
  return result;
57
58
  };
@@ -187,6 +187,9 @@ async function migrateTxRefTxType(db, options = {}) {
187
187
  const backfill = await backfillTxRefTxType(db, options);
188
188
  const t0 = now();
189
189
  await sql`CREATE INDEX IF NOT EXISTS idx_tx_ref_type_value_txtype_time ON tx_ref(type, value, tx_type, time)`.execute(db);
190
+ const postIndexSweep = await sweepTxRefTxTypeNulls(db);
191
+ backfill.sweepUpdated += postIndexSweep.updated;
192
+ backfill.sweepMs += postIndexSweep.ms;
190
193
  await sql`DROP TABLE IF EXISTS tx_ref_tx_type_backfill`.execute(db);
191
194
  return {
192
195
  columnAdded,
@@ -52,8 +52,9 @@ var TransactionTable = class extends require_table_base.default {
52
52
  * Override _update to also keep tx_ref junction table synchronized atomically
53
53
  */
54
54
  async _update(key, updates, context) {
55
+ const normalized = updates?.tx?.itxJson ? (0, _ocap_indexdb.formatTxBeforeInsert)(updates) : updates;
55
56
  const run = async (txnCtx) => {
56
- const result = await super._update(key, updates, txnCtx);
57
+ const result = await super._update(key, normalized, txnCtx);
57
58
  await this.syncTxRefs(result, txnCtx, true);
58
59
  return result;
59
60
  };
@@ -188,6 +188,9 @@ async function migrateTxRefTxType(db, options = {}) {
188
188
  const backfill = await backfillTxRefTxType(db, options);
189
189
  const t0 = now();
190
190
  await kysely.sql`CREATE INDEX IF NOT EXISTS idx_tx_ref_type_value_txtype_time ON tx_ref(type, value, tx_type, time)`.execute(db);
191
+ const postIndexSweep = await sweepTxRefTxTypeNulls(db);
192
+ backfill.sweepUpdated += postIndexSweep.updated;
193
+ backfill.sweepMs += postIndexSweep.ms;
191
194
  await kysely.sql`DROP TABLE IF EXISTS tx_ref_tx_type_backfill`.execute(db);
192
195
  return {
193
196
  columnAdded,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ocap/indexdb-sqlite",
3
3
  "description": "OCAP indexdb adapter that uses SQLite as backend",
4
- "version": "1.31.9",
4
+ "version": "1.32.0",
5
5
  "author": "wangshijun <shijun@arcblock.io> (https://www.arcblock.io)",
6
6
  "bugs": {
7
7
  "url": "https://github.com/ArcBlock/blockchain/issues",
@@ -14,7 +14,7 @@
14
14
  "wangshijun <shijun@arcblock.io> (https://www.arcblock.io)"
15
15
  ],
16
16
  "devDependencies": {
17
- "@ocap/indexdb-test": "1.31.9"
17
+ "@ocap/indexdb-test": "1.32.0"
18
18
  },
19
19
  "homepage": "https://github.com/ArcBlock/blockchain/tree/master/indexdb/sqlite",
20
20
  "keywords": [
@@ -63,10 +63,10 @@
63
63
  "clean": "rm -rf lib esm"
64
64
  },
65
65
  "dependencies": {
66
- "@arcblock/did": "1.31.9",
67
- "@ocap/indexdb": "1.31.9",
68
- "@ocap/types": "1.31.9",
69
- "@ocap/util": "1.31.9",
66
+ "@arcblock/did": "1.32.0",
67
+ "@ocap/indexdb": "1.32.0",
68
+ "@ocap/types": "1.32.0",
69
+ "@ocap/util": "1.32.0",
70
70
  "debug": "^4.4.3",
71
71
  "better-sqlite3": "^11.8.1",
72
72
  "kysely": "^0.28.14",