@ocap/indexdb-elasticsearch 1.19.1 → 1.19.3
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/db.js +2 -0
- package/lib/model/token-distribution.js +22 -0
- package/lib/table/token-distribution.js +17 -0
- package/package.json +5 -5
package/lib/db.js
CHANGED
@@ -18,6 +18,7 @@ const Stake = require('./table/stake');
|
|
18
18
|
const Rollup = require('./table/rollup');
|
19
19
|
const RollupBlock = require('./table/rollup-block');
|
20
20
|
const RollupValidator = require('./table/rollup-validator');
|
21
|
+
const TokenDistribution = require('./table/token-distribution');
|
21
22
|
|
22
23
|
const { name, version } = require('../package.json');
|
23
24
|
const { formatQueryResult, getAuthHeaders, getTimeCondition } = require('./util');
|
@@ -92,6 +93,7 @@ class ESIndexDB extends BaseIndexDB {
|
|
92
93
|
this.rollup = new Rollup(this);
|
93
94
|
this.rollupBlock = new RollupBlock(this);
|
94
95
|
this.rollupValidator = new RollupValidator(this);
|
96
|
+
this.tokenDistribution = new TokenDistribution(this);
|
95
97
|
|
96
98
|
this.attachReadyListeners();
|
97
99
|
}
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module.exports = () => ({
|
2
|
+
mappings: {
|
3
|
+
dynamic: false,
|
4
|
+
properties: {
|
5
|
+
tokenAddress: { type: 'keyword' },
|
6
|
+
stake: { type: 'keyword' },
|
7
|
+
gasStake: { type: 'keyword' },
|
8
|
+
revokedStake: { type: 'keyword' },
|
9
|
+
gas: { type: 'keyword' },
|
10
|
+
fee: { type: 'keyword' },
|
11
|
+
slashedVault: { type: 'keyword' },
|
12
|
+
account: { type: 'keyword' },
|
13
|
+
txTime: { type: 'date' },
|
14
|
+
},
|
15
|
+
},
|
16
|
+
settings: {
|
17
|
+
index: {
|
18
|
+
number_of_shards: +(process.env.ES_SHARD_COUNT || 1),
|
19
|
+
number_of_replicas: +(process.env.ES_REPLICA_COUNT || 0),
|
20
|
+
},
|
21
|
+
},
|
22
|
+
});
|
@@ -0,0 +1,17 @@
|
|
1
|
+
const ESIndex = require('./base');
|
2
|
+
const getParams = require('../model/token-distribution');
|
3
|
+
const { getTableName } = require('../util');
|
4
|
+
|
5
|
+
class TokenDistribution extends ESIndex {
|
6
|
+
constructor(db) {
|
7
|
+
super({
|
8
|
+
name: getTableName(db.config.prefix, 'token_distribution'),
|
9
|
+
docId: 'tokenAddress',
|
10
|
+
client: db.client,
|
11
|
+
http: db.http,
|
12
|
+
indexParams: getParams(),
|
13
|
+
});
|
14
|
+
}
|
15
|
+
}
|
16
|
+
|
17
|
+
module.exports = TokenDistribution;
|
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.19.
|
4
|
+
"version": "1.19.3",
|
5
5
|
"author": "wangshijun <shijun@arcblock.io> (https://www.arcblock.io)",
|
6
6
|
"bugs": {
|
7
7
|
"url": "https://github.com/ArcBlock/blockchain/issues",
|
@@ -37,12 +37,12 @@
|
|
37
37
|
"lint:fix": "eslint --fix tests lib",
|
38
38
|
"test": "jest --forceExit --detectOpenHandles"
|
39
39
|
},
|
40
|
-
"gitHead": "
|
40
|
+
"gitHead": "756076dad0df7468beecc95c8effd55f8c4c4f49",
|
41
41
|
"dependencies": {
|
42
|
-
"@arcblock/did": "1.19.
|
42
|
+
"@arcblock/did": "1.19.3",
|
43
43
|
"@elastic/elasticsearch": "7.13.0",
|
44
|
-
"@ocap/indexdb": "1.19.
|
45
|
-
"@ocap/util": "1.19.
|
44
|
+
"@ocap/indexdb": "1.19.3",
|
45
|
+
"@ocap/util": "1.19.3",
|
46
46
|
"axios": "^1.7.5",
|
47
47
|
"bn.js": "^5.2.1",
|
48
48
|
"debug": "^4.3.6",
|