@ocap/indexdb-elasticsearch 1.13.38 → 1.13.42
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.js +6 -24
- package/package.json +4 -4
package/lib/db.js
CHANGED
|
@@ -99,6 +99,7 @@ class ESIndexDB extends BaseIndexDB {
|
|
|
99
99
|
accountFilter = {},
|
|
100
100
|
validityFilter = {},
|
|
101
101
|
txFilter = {},
|
|
102
|
+
rollupFilter = {},
|
|
102
103
|
} = {}) {
|
|
103
104
|
const pagination = formatPagination({ paging, defaultSortField: 'time' });
|
|
104
105
|
|
|
@@ -109,6 +110,7 @@ class ESIndexDB extends BaseIndexDB {
|
|
|
109
110
|
const { tokens = [] } = tokenFilter;
|
|
110
111
|
const { accounts = [] } = accountFilter;
|
|
111
112
|
const { txs = [] } = txFilter;
|
|
113
|
+
const { rollups = [] } = rollupFilter;
|
|
112
114
|
let { startDateTime, endDateTime } = timeFilter;
|
|
113
115
|
startDateTime = parseDateTime(startDateTime);
|
|
114
116
|
endDateTime = parseDateTime(endDateTime);
|
|
@@ -172,6 +174,10 @@ class ESIndexDB extends BaseIndexDB {
|
|
|
172
174
|
conditions.push({ terms: { hash: txs } });
|
|
173
175
|
}
|
|
174
176
|
|
|
177
|
+
if (rollups.length) {
|
|
178
|
+
conditions.push({ terms: { rollups } });
|
|
179
|
+
}
|
|
180
|
+
|
|
175
181
|
if (startDateTime && endDateTime) {
|
|
176
182
|
conditions.push({ range: { time: { gt: startDateTime, lte: endDateTime } } });
|
|
177
183
|
} else if (startDateTime) {
|
|
@@ -249,30 +255,6 @@ class ESIndexDB extends BaseIndexDB {
|
|
|
249
255
|
return { assets: items, account, paging: nextPaging };
|
|
250
256
|
}
|
|
251
257
|
|
|
252
|
-
async listAssetTransactions({ address, paging } = {}) {
|
|
253
|
-
if (!address) {
|
|
254
|
-
return { transactions: [] };
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
const pagination = formatPagination({ paging, defaultSortField: 'time' });
|
|
258
|
-
if (pagination.order.field !== 'time') {
|
|
259
|
-
pagination.order.field = 'time';
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
const result = await this.tx.search({
|
|
263
|
-
from: pagination.cursor,
|
|
264
|
-
size: pagination.size,
|
|
265
|
-
body: {
|
|
266
|
-
query: { bool: { must: [{ term: { assets: address } }] } },
|
|
267
|
-
sort: [{ [pagination.order.field]: { order: pagination.order.type } }],
|
|
268
|
-
_source: { exclude: ['tx.itxJson.data', 'tx.itxJson.encoded_value'] }, // required to make api fast
|
|
269
|
-
},
|
|
270
|
-
});
|
|
271
|
-
|
|
272
|
-
const { items, paging: nextPaging } = formatQueryResult(result, pagination);
|
|
273
|
-
return { transactions: items.map((item) => formatTxAfterRead(item)), paging: nextPaging };
|
|
274
|
-
}
|
|
275
|
-
|
|
276
258
|
async listTopAccounts({ tokenAddress, paging } = {}) {
|
|
277
259
|
const filter = { term: { 'tokens.address': tokenAddress } };
|
|
278
260
|
const pagination = formatPagination({
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ocap/indexdb-elasticsearch",
|
|
3
3
|
"description": "OCAP indexdb adapter that uses elasticsearch as backend",
|
|
4
|
-
"version": "1.13.
|
|
4
|
+
"version": "1.13.42",
|
|
5
5
|
"author": "wangshijun <shijun@arcblock.io> (https://www.arcblock.io)",
|
|
6
6
|
"bugs": {
|
|
7
7
|
"url": "https://github.com/ArcBlock/asset-chain/issues",
|
|
@@ -38,11 +38,11 @@
|
|
|
38
38
|
"test": "node tools/jest.js",
|
|
39
39
|
"coverage": "npm run test -- --coverage"
|
|
40
40
|
},
|
|
41
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "a35134ea41dd3283233bf27f9b618da0d142db4f",
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"@elastic/elasticsearch": "7.13.0",
|
|
44
|
-
"@ocap/indexdb": "1.13.
|
|
45
|
-
"@ocap/util": "1.13.
|
|
44
|
+
"@ocap/indexdb": "1.13.42",
|
|
45
|
+
"@ocap/util": "1.13.42",
|
|
46
46
|
"axios": "^0.21.4",
|
|
47
47
|
"bn.js": "^5.2.0",
|
|
48
48
|
"debug": "^4.3.2",
|