@ocap/indexdb-memory 1.13.36 → 1.13.40
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/lib/db/base.js +7 -21
- package/package.json +4 -4
package/lib/db/base.js
CHANGED
@@ -21,6 +21,7 @@ class LocalBaseIndexDB extends BaseIndexDB {
|
|
21
21
|
accountFilter = {},
|
22
22
|
validityFilter = {},
|
23
23
|
txFilter = {},
|
24
|
+
rollupFilter = {},
|
24
25
|
} = {}) {
|
25
26
|
const query = this.tx.collection.chain();
|
26
27
|
|
@@ -31,11 +32,13 @@ class LocalBaseIndexDB extends BaseIndexDB {
|
|
31
32
|
const { tokens = [] } = tokenFilter;
|
32
33
|
const { accounts = [] } = accountFilter;
|
33
34
|
const { txs = [] } = txFilter;
|
35
|
+
const { rollups = [] } = rollupFilter;
|
34
36
|
let { startDateTime, endDateTime } = timeFilter;
|
35
37
|
startDateTime = parseDateTime(startDateTime);
|
36
38
|
endDateTime = parseDateTime(endDateTime);
|
37
39
|
|
38
40
|
const pagination = formatPagination({ paging, defaultSortField: 'time' });
|
41
|
+
debug('listTransactions', { sender, receiver, pagination, types, factories, assets, tokens, accounts, rollups });
|
39
42
|
|
40
43
|
if (sender && receiver) {
|
41
44
|
if (direction === 'MUTUAL') {
|
@@ -104,6 +107,10 @@ class LocalBaseIndexDB extends BaseIndexDB {
|
|
104
107
|
query.where((x) => txs.includes(x.hash));
|
105
108
|
}
|
106
109
|
|
110
|
+
if (rollups.length) {
|
111
|
+
query.where((x) => x.rollups.some((f) => rollups.includes(f)));
|
112
|
+
}
|
113
|
+
|
107
114
|
const transactions = query
|
108
115
|
.simplesort(pagination.order.field, paging.order.type === 'desc')
|
109
116
|
.offset(pagination.cursor)
|
@@ -165,27 +172,6 @@ class LocalBaseIndexDB extends BaseIndexDB {
|
|
165
172
|
return { assets, account, paging: formatNextPagination(total, pagination) };
|
166
173
|
}
|
167
174
|
|
168
|
-
listAssetTransactions({ address, paging } = {}) {
|
169
|
-
if (!address) {
|
170
|
-
return { transactions: [] };
|
171
|
-
}
|
172
|
-
|
173
|
-
const pagination = formatPagination({ paging, defaultSortField: 'time' });
|
174
|
-
const conditions = { assets: { $contains: address } };
|
175
|
-
debug('listAssetTransactions', { address, paging, conditions, pagination });
|
176
|
-
|
177
|
-
const transactions = this.tx.collection
|
178
|
-
.chain()
|
179
|
-
.find(conditions)
|
180
|
-
.simplesort(pagination.order.field, pagination.order.type === 'desc')
|
181
|
-
.offset(pagination.cursor)
|
182
|
-
.limit(pagination.size)
|
183
|
-
.data();
|
184
|
-
|
185
|
-
const total = this.tx.count(Object.keys(conditions).length ? conditions : undefined);
|
186
|
-
return { transactions, paging: formatNextPagination(total, pagination) };
|
187
|
-
}
|
188
|
-
|
189
175
|
async listTopAccounts({ paging, tokenAddress } = {}) {
|
190
176
|
const query = this.account.collection.chain();
|
191
177
|
const pagination = formatPagination({
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@ocap/indexdb-memory",
|
3
3
|
"description": "OCAP indexdb adapter that uses memory as backend, just for test purpose",
|
4
|
-
"version": "1.13.
|
4
|
+
"version": "1.13.40",
|
5
5
|
"author": "wangshijun <shijun@arcblock.io> (https://www.arcblock.io)",
|
6
6
|
"bugs": {
|
7
7
|
"url": "https://github.com/ArcBlock/asset-chain/issues",
|
@@ -37,10 +37,10 @@
|
|
37
37
|
"test": "node tools/jest.js",
|
38
38
|
"coverage": "npm run test -- --coverage"
|
39
39
|
},
|
40
|
-
"gitHead": "
|
40
|
+
"gitHead": "b540a835813d114c47236f929c7cf0df84949be9",
|
41
41
|
"dependencies": {
|
42
|
-
"@ocap/indexdb": "1.13.
|
43
|
-
"@ocap/util": "1.13.
|
42
|
+
"@ocap/indexdb": "1.13.40",
|
43
|
+
"@ocap/util": "1.13.40",
|
44
44
|
"debug": "^4.3.2",
|
45
45
|
"empty-value": "^1.0.1",
|
46
46
|
"lodash": "^4.17.21",
|