@ocap/indexdb-sqlite 1.29.12 → 1.29.13
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/esm/db/base.mjs +4 -1
- package/lib/db/base.cjs +4 -1
- package/package.json +6 -6
package/esm/db/base.mjs
CHANGED
|
@@ -121,7 +121,10 @@ var SqliteBaseIndexDB = class extends BaseIndexDB {
|
|
|
121
121
|
]);
|
|
122
122
|
total = (senderCount?.count ?? 0) + (receiverCount?.count ?? 0) - (overlapCount?.count ?? 0);
|
|
123
123
|
} else if (isMultiTypeOnly) total = (await Promise.all(types.map((t) => this.db.selectFrom("tx").select(this.db.fn.countAll().as("count")).where("type", "=", t).executeTakeFirst()))).reduce((sum, c) => sum + (c?.count ?? 0), 0);
|
|
124
|
-
else if (!
|
|
124
|
+
else if (validity === "VALID" && !sender && !receiver && !types.length && !txs.length && !parsedStart && !parsedEnd && activeJsonFilters.length === 0) {
|
|
125
|
+
const [approx, invalidCount] = await Promise.all([sql`SELECT max(rowid) as c FROM tx`.execute(this.db), this.db.selectFrom("tx").select(this.db.fn.countAll().as("count")).where("valid", "=", 0).executeTakeFirst()]);
|
|
126
|
+
total = (approx.rows[0]?.c ?? 0) - (invalidCount?.count ?? 0);
|
|
127
|
+
} else if (!hasNonJsonFilters && activeJsonFilters.length === 0) total = (await sql`SELECT max(rowid) as c FROM tx`.execute(this.db)).rows[0]?.c ?? 0;
|
|
125
128
|
else total = (await qb.clearSelect().select(this.db.fn.countAll().as("count")).executeTakeFirst())?.count ?? 0;
|
|
126
129
|
const orderDir = pagination.order.type === "desc" ? "desc" : "asc";
|
|
127
130
|
let rawResults;
|
package/lib/db/base.cjs
CHANGED
|
@@ -125,7 +125,10 @@ var SqliteBaseIndexDB = class extends _ocap_indexdb.BaseIndexDB {
|
|
|
125
125
|
]);
|
|
126
126
|
total = (senderCount?.count ?? 0) + (receiverCount?.count ?? 0) - (overlapCount?.count ?? 0);
|
|
127
127
|
} else if (isMultiTypeOnly) total = (await Promise.all(types.map((t) => this.db.selectFrom("tx").select(this.db.fn.countAll().as("count")).where("type", "=", t).executeTakeFirst()))).reduce((sum, c) => sum + (c?.count ?? 0), 0);
|
|
128
|
-
else if (
|
|
128
|
+
else if (validity === "VALID" && !sender && !receiver && !types.length && !txs.length && !parsedStart && !parsedEnd && activeJsonFilters.length === 0) {
|
|
129
|
+
const [approx, invalidCount] = await Promise.all([kysely.sql`SELECT max(rowid) as c FROM tx`.execute(this.db), this.db.selectFrom("tx").select(this.db.fn.countAll().as("count")).where("valid", "=", 0).executeTakeFirst()]);
|
|
130
|
+
total = (approx.rows[0]?.c ?? 0) - (invalidCount?.count ?? 0);
|
|
131
|
+
} else if (!hasNonJsonFilters && activeJsonFilters.length === 0) total = (await kysely.sql`SELECT max(rowid) as c FROM tx`.execute(this.db)).rows[0]?.c ?? 0;
|
|
129
132
|
else total = (await qb.clearSelect().select(this.db.fn.countAll().as("count")).executeTakeFirst())?.count ?? 0;
|
|
130
133
|
const orderDir = pagination.order.type === "desc" ? "desc" : "asc";
|
|
131
134
|
let rawResults;
|
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.29.
|
|
4
|
+
"version": "1.29.13",
|
|
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.29.
|
|
17
|
+
"@ocap/indexdb-test": "1.29.13"
|
|
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.29.
|
|
67
|
-
"@ocap/indexdb": "1.29.
|
|
68
|
-
"@ocap/types": "1.29.
|
|
69
|
-
"@ocap/util": "1.29.
|
|
66
|
+
"@arcblock/did": "1.29.13",
|
|
67
|
+
"@ocap/indexdb": "1.29.13",
|
|
68
|
+
"@ocap/types": "1.29.13",
|
|
69
|
+
"@ocap/util": "1.29.13",
|
|
70
70
|
"debug": "^4.4.3",
|
|
71
71
|
"better-sqlite3": "^11.8.1",
|
|
72
72
|
"kysely": "^0.27.0",
|