@subql/node-ethereum 0.4.1-storeCache-0.0.5 → 1.0.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.
Files changed (56) hide show
  1. package/CHANGELOG.md +3 -1
  2. package/dist/.tsbuildinfo +1 -1
  3. package/dist/app.module.js.map +1 -1
  4. package/dist/configure/SubqueryProject.d.ts +1 -1
  5. package/dist/configure/SubqueryProject.js +3 -0
  6. package/dist/configure/SubqueryProject.js.map +1 -1
  7. package/dist/configure/configure.module.js +2 -2
  8. package/dist/configure/configure.module.js.map +1 -1
  9. package/dist/ethereum/api.connection.d.ts +11 -0
  10. package/dist/ethereum/api.connection.js +27 -0
  11. package/dist/ethereum/api.connection.js.map +1 -0
  12. package/dist/ethereum/api.ethereum.d.ts +2 -0
  13. package/dist/ethereum/api.ethereum.js +36 -18
  14. package/dist/ethereum/api.ethereum.js.map +1 -1
  15. package/dist/ethereum/api.service.ethereum.d.ts +5 -4
  16. package/dist/ethereum/api.service.ethereum.js +49 -18
  17. package/dist/ethereum/api.service.ethereum.js.map +1 -1
  18. package/dist/ethereum/ethers/json-rpc-batch-provider.js +7 -2
  19. package/dist/ethereum/ethers/json-rpc-batch-provider.js.map +1 -1
  20. package/dist/ethereum/ethers/web/index.d.ts +0 -1
  21. package/dist/ethereum/ethers/web/types.d.ts +0 -1
  22. package/dist/indexer/blockDispatcher/block-dispatcher.service.js.map +1 -1
  23. package/dist/indexer/blockDispatcher/worker-block-dispatcher.service.js.map +1 -1
  24. package/dist/indexer/dictionary.service.js.map +1 -1
  25. package/dist/indexer/ds-processor.service.js.map +1 -1
  26. package/dist/indexer/dynamic-ds.service.js.map +1 -1
  27. package/dist/indexer/fetch.module.js +11 -3
  28. package/dist/indexer/fetch.module.js.map +1 -1
  29. package/dist/indexer/fetch.service.d.ts +1 -1
  30. package/dist/indexer/fetch.service.js +30 -32
  31. package/dist/indexer/fetch.service.js.map +1 -1
  32. package/dist/indexer/indexer.manager.js.map +1 -1
  33. package/dist/indexer/indexer.module.js +4 -3
  34. package/dist/indexer/indexer.module.js.map +1 -1
  35. package/dist/indexer/project.service.js +0 -5
  36. package/dist/indexer/project.service.js.map +1 -1
  37. package/dist/indexer/sandbox.service.js.map +1 -1
  38. package/dist/indexer/unfinalizedBlocks.service.js +0 -1
  39. package/dist/indexer/unfinalizedBlocks.service.js.map +1 -1
  40. package/dist/indexer/worker/worker.module.js.map +1 -1
  41. package/dist/indexer/worker/worker.service.js +1 -1
  42. package/dist/indexer/worker/worker.service.js.map +1 -1
  43. package/dist/indexer/worker/worker.unfinalizedBlocks.service.js.map +1 -1
  44. package/dist/meta/meta.controller.js.map +1 -1
  45. package/dist/meta/meta.module.js.map +1 -1
  46. package/dist/meta/meta.service.js.map +1 -1
  47. package/dist/subcommands/forceClean.module.js.map +1 -1
  48. package/dist/subcommands/forceClean.service.js.map +1 -1
  49. package/dist/subcommands/reindex.module.js +2 -0
  50. package/dist/subcommands/reindex.module.js.map +1 -1
  51. package/dist/subcommands/reindex.service.js +1 -2
  52. package/dist/subcommands/reindex.service.js.map +1 -1
  53. package/dist/yargs.d.ts +31 -23
  54. package/dist/yargs.js +30 -20
  55. package/dist/yargs.js.map +1 -1
  56. package/package.json +7 -8
@@ -1 +1 @@
1
- {"version":3,"file":"reindex.service.js","sourceRoot":"","sources":["../../src/subcommands/reindex.service.ts"],"names":[],"mappings":";AAAA,gEAAgE;AAChE,sCAAsC;;;;;;;;;;;;;;;AAEtC,2CAAoD;AACpD,gDAO0B;AAC1B,yCAAsC;AACtC,kEAA+D;AAC/D,sEAAiE;AACjE,oFAAgF;AAChF,8CAAgD;AAChD,8CAA2C;AAE3C,6DAAyD;AAEzD,MAAM,MAAM,GAAG,IAAA,qBAAS,EAAC,SAAS,CAAC,CAAC;AAG7B,IAAM,cAAc,GAApB,MAAM,cAAc;IAIzB,YACmB,SAAoB,EACpB,UAAsB,EACtB,YAA0B,EAC1B,UAAsB,EACM,OAAwB,EACpD,iB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W,EAAE,mBAAmB,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;YAC3D,IAAI,CAAC,4BAA4B,EAAE;YACnC,IAAI,CAAC,sBAAsB,EAAE;SAC9B,CAAC,CAAC;QAEH,MAAM,IAAA,iBAAO,EACX,WAAW,EACX,MAAM,IAAI,CAAC,sBAAsB,EAAE,EACnC,iBAAiB,EACjB,mBAAmB,EACnB,IAAI,CAAC,YAAY,EACjB,IAAI,CAAC,wBAAwB,EAC7B,IAAI,CAAC,gBAAgB,EACrB,IAAI,CAAC,UAAU,EACf,IAAI,CAAC,SAAS,EACd,IAAI,CAAC,iBAAiB,CACvB,CAAC;QACF,MAAM,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC,UAAU,EAAE,CAAC;IAClD,CAAC;CACF,CAAA;AArGY,cAAc;IAD1B,IAAA,mBAAU,GAAE;IAUR,WAAA,IAAA,eAAM,EAAC,kBAAkB,CAAC,CAAA;qCAJC,qBAAS;QACR,sBAAU;QACR,wBAAY;QACd,sBAAU;QACe,iCAAe;QACjC,sCAAiB;QACV,oDAAwB;QAChC,qCAAgB;GAZ1C,cAAc,CAqG1B;AArGY,wCAAc","sourcesContent":["// Copyright 2020-2022 OnFinality Limited authors & contributors\n// SPDX-License-Identifier: Apache-2.0\n\nimport { Inject, Injectable } from '@nestjs/common';\nimport {\n getLogger,\n MmrService,\n NodeConfig,\n StoreService,\n getExistingProjectSchema,\n CacheMetadataModel,\n} from '@subql/node-core';\nimport { Sequelize } from 'sequelize';\nimport { SubqueryProject } from '../configure/SubqueryProject';\nimport { DynamicDsService } from '../indexer/dynamic-ds.service';\nimport { UnfinalizedBlocksService } from '../indexer/unfinalizedBlocks.service';\nimport { initDbSchema } from '../utils/project';\nimport { reindex } from '../utils/reindex';\n\nimport { ForceCleanService } from './forceClean.service';\n\nconst logger = getLogger('Reindex');\n\n@Injectable()\nexport class ReindexService {\n private schema: string;\n private metadataRepo: CacheMetadataModel;\n\n constructor(\n private readonly sequelize: Sequelize,\n private readonly nodeConfig: NodeConfig,\n private readonly storeService: StoreService,\n private readonly mmrService: MmrService,\n @Inject('ISubqueryProject') private readonly project: SubqueryProject,\n private readonly forceCleanService: ForceCleanService,\n private readonly unfinalizedBlocksService: UnfinalizedBlocksService,\n private readonly dynamicDsService: DynamicDsService,\n ) {}\n\n async init(): Promise<void> {\n this.schema = await this.getExistingProjectSchema();\n\n if (!this.schema) {\n logger.error('Unable to locate schema');\n throw new Error('Schema does not exist.');\n }\n await this.initDbSchema();\n\n this.metadataRepo = this.storeService.storeCache.metadata;\n\n this.dynamicDsService.init(this.metadataRepo);\n }\n\n async getTargetHeightWithUnfinalizedBlocks(\n inputHeight: number,\n ): Promise<number> {\n // Why does this happen?\n (this.unfinalizedBlocksService as any).metadataRepo = this.metadataRepo;\n const unfinalizedBlocks =\n await this.unfinalizedBlocksService.getMetadataUnfinalizedBlocks();\n const bestBlocks = unfinalizedBlocks.filter(\n ([bestBlockHeight]) => Number(bestBlockHeight) <= inputHeight,\n );\n if (bestBlocks.length === 0) {\n return inputHeight;\n }\n const [firstBestBlock] = bestBlocks[0];\n return Math.min(inputHeight, firstBestBlock);\n }\n\n private async getExistingProjectSchema(): Promise<string> {\n return getExistingProjectSchema(this.nodeConfig, this.sequelize);\n }\n\n private async getLastProcessedHeight(): Promise<number | undefined> {\n return this.metadataRepo.find('lastProcessedHeight');\n }\n\n private async getMetadataBlockOffset(): Promise<number | undefined> {\n return this.metadataRepo.find('blockOffset');\n }\n\n private async getMetadataSpecName(): Promise<string | undefined> {\n return this.metadataRepo.find('specName');\n }\n\n private async initDbSchema(): Promise<void> {\n await initDbSchema(this.project, this.schema, this.storeService);\n }\n\n // eslint-disable-next-line @typescript-eslint/require-await\n private async getStartBlockFromDataSources() {\n const datasources = this.project.dataSources;\n\n const startBlocksList = datasources.map((item) => item.startBlock ?? 1);\n if (startBlocksList.length === 0) {\n logger.error(\n `Failed to find a valid datasource, Please check your endpoint if specName filter is used.`,\n );\n process.exit(1);\n } else {\n return Math.min(...startBlocksList);\n }\n }\n\n async reindex(targetBlockHeight: number): Promise<void> {\n const [startHeight, lastProcessedHeight] = await Promise.all([\n this.getStartBlockFromDataSources(),\n this.getLastProcessedHeight(),\n ]);\n\n await reindex(\n startHeight,\n await this.getMetadataBlockOffset(),\n targetBlockHeight,\n lastProcessedHeight,\n this.storeService,\n this.unfinalizedBlocksService,\n this.dynamicDsService,\n this.mmrService,\n this.sequelize,\n this.forceCleanService,\n );\n await this.storeService.storeCache.flushCache();\n }\n}\n"]}
1
+ {"version":3,"file":"reindex.service.js","sourceRoot":"","sources":["../../src/subcommands/reindex.service.ts"],"names":[],"mappings":";AAAA,gEAAgE;AAChE,sCAAsC;;;;;;;;;;;;;;;AAEtC,2CAAoD;AACpD,gDAO0B;AAC1B,yCAAsC;AACtC,kEAA+D;AAC/D,sEAAiE;AACjE,oFAAgF;AAChF,8CAAgD;AAChD,8CAA2C;AAE3C,6DAAyD;AAEzD,MAAM,MAAM,GAAG,IAAA,qBAAS,EAAC,SAAS,CAAC,CAAC;AAGpC,IAAa,cAAc,GAA3B,MAAa,cAAc;IAIzB,YACmB,SAAoB,EACpB,UAAsB,EACtB,YAA0B,EAC1B,UAAsB,EACM,OAAwB,EACpD,iBAAoC,EACpC,wBAAkD,EAClD,gBAAkC;QAPlC,cAAS,GAAT,SAAS,CAAW;QACpB,eAAU,GAAV,UAAU,CAAY;QACtB,iBAAY,GAAZ,YAAY,CAAc;QAC1B,eAAU,GAAV,UAAU,CAAY;QACM,YAAO,GAAP,OAAO,CAAiB;QACpD,sBAAiB,GAAjB,iBAAiB,CAAmB;QACpC,6BAAwB,GAAxB,wBAAwB,CAA0B;QAClD,qBAAgB,GAAhB,gBAAgB,CAAkB;IAClD,CAAC;IAEJ,KAAK,CAAC,IAAI;QACR,IAAI,CAAC,MAAM,GAAG,MAAM,IAAI,CAAC,wBAAwB,EAAE,CAAC;QAEpD,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE;YAChB,MA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C;CACF,CAAA;AApGY,cAAc;IAD1B,IAAA,mBAAU,GAAE;IAUR,WAAA,IAAA,eAAM,EAAC,kBAAkB,CAAC,CAAA;qCAJC,qBAAS;QACR,sBAAU;QACR,wBAAY;QACd,sBAAU;QACe,iCAAe;QACjC,sCAAiB;QACV,oDAAwB;QAChC,qCAAgB;GAZ1C,cAAc,CAoG1B;AApGY,wCAAc","sourcesContent":["// Copyright 2020-2022 OnFinality Limited authors & contributors\n// SPDX-License-Identifier: Apache-2.0\n\nimport { Inject, Injectable } from '@nestjs/common';\nimport {\n getLogger,\n MmrService,\n NodeConfig,\n StoreService,\n getExistingProjectSchema,\n CacheMetadataModel,\n} from '@subql/node-core';\nimport { Sequelize } from 'sequelize';\nimport { SubqueryProject } from '../configure/SubqueryProject';\nimport { DynamicDsService } from '../indexer/dynamic-ds.service';\nimport { UnfinalizedBlocksService } from '../indexer/unfinalizedBlocks.service';\nimport { initDbSchema } from '../utils/project';\nimport { reindex } from '../utils/reindex';\n\nimport { ForceCleanService } from './forceClean.service';\n\nconst logger = getLogger('Reindex');\n\n@Injectable()\nexport class ReindexService {\n private schema: string;\n private metadataRepo: CacheMetadataModel;\n\n constructor(\n private readonly sequelize: Sequelize,\n private readonly nodeConfig: NodeConfig,\n private readonly storeService: StoreService,\n private readonly mmrService: MmrService,\n @Inject('ISubqueryProject') private readonly project: SubqueryProject,\n private readonly forceCleanService: ForceCleanService,\n private readonly unfinalizedBlocksService: UnfinalizedBlocksService,\n private readonly dynamicDsService: DynamicDsService,\n ) {}\n\n async init(): Promise<void> {\n this.schema = await this.getExistingProjectSchema();\n\n if (!this.schema) {\n logger.error('Unable to locate schema');\n throw new Error('Schema does not exist.');\n }\n await this.initDbSchema();\n\n this.metadataRepo = this.storeService.storeCache.metadata;\n\n this.dynamicDsService.init(this.metadataRepo);\n }\n\n async getTargetHeightWithUnfinalizedBlocks(\n inputHeight: number,\n ): Promise<number> {\n // Why does this happen?\n (this.unfinalizedBlocksService as any).metadataRepo = this.metadataRepo;\n const unfinalizedBlocks =\n await this.unfinalizedBlocksService.getMetadataUnfinalizedBlocks();\n const bestBlocks = unfinalizedBlocks.filter(\n ([bestBlockHeight]) => Number(bestBlockHeight) <= inputHeight,\n );\n if (bestBlocks.length === 0) {\n return inputHeight;\n }\n const [firstBestBlock] = bestBlocks[0];\n return Math.min(inputHeight, firstBestBlock);\n }\n\n private async getExistingProjectSchema(): Promise<string> {\n return getExistingProjectSchema(this.nodeConfig, this.sequelize);\n }\n\n private async getLastProcessedHeight(): Promise<number | undefined> {\n return this.metadataRepo.find('lastProcessedHeight');\n }\n\n private async getMetadataBlockOffset(): Promise<number | undefined> {\n return this.metadataRepo.find('blockOffset');\n }\n\n private async getMetadataSpecName(): Promise<string | undefined> {\n return this.metadataRepo.find('specName');\n }\n\n private async initDbSchema(): Promise<void> {\n await initDbSchema(this.project, this.schema, this.storeService);\n }\n\n private getStartBlockFromDataSources(): number {\n const datasources = this.project.dataSources;\n\n const startBlocksList = datasources.map((item) => item.startBlock ?? 1);\n if (startBlocksList.length === 0) {\n logger.error(\n `Failed to find a valid datasource, Please check your endpoint if specName filter is used.`,\n );\n process.exit(1);\n } else {\n return Math.min(...startBlocksList);\n }\n }\n\n async reindex(targetBlockHeight: number): Promise<void> {\n const [startHeight, lastProcessedHeight] = await Promise.all([\n this.getStartBlockFromDataSources(),\n this.getLastProcessedHeight(),\n ]);\n\n await reindex(\n startHeight,\n await this.getMetadataBlockOffset(),\n targetBlockHeight,\n lastProcessedHeight,\n this.storeService,\n this.unfinalizedBlocksService,\n this.dynamicDsService,\n this.mmrService,\n this.sequelize,\n this.forceCleanService,\n );\n await this.storeService.storeCache.flushCache();\n }\n}\n"]}
package/dist/yargs.d.ts CHANGED
@@ -1,6 +1,4 @@
1
- export declare const yargsOptions: import("yargs").Argv<import("yargs").Omit<{
2
- targetHeight: number;
3
- }, "batch-size" | "config" | "db-schema" | "debug" | "dictionary-timeout" | "disable-historical" | "ipfs" | "local" | "log-level" | "mmr-path" | "multi-chain" | "network-dictionary" | "network-endpoint" | "output-fmt" | "port" | "profiler" | "proof-of-index" | "query-limit" | "scale-batch-size" | "dictionary-resolver" | "subquery" | "subquery-name" | "subscription" | "timeout" | "timestamp-field" | "unfinalized-blocks" | "unsafe" | "workers" | "pg-ca" | "pg-key" | "pg-cert" | "store-cache-threshold"> & import("yargs").InferredOptionTypes<{
1
+ export declare const yargsOptions: import("yargs").Argv<import("yargs").Omit<unknown, "batch-size" | "config" | "db-schema" | "debug" | "dictionary-timeout" | "disable-historical" | "ipfs" | "local" | "log-level" | "mmr-path" | "multi-chain" | "network-dictionary" | "network-endpoint" | "output-fmt" | "port" | "profiler" | "proof-of-index" | "query-limit" | "scale-batch-size" | "dictionary-resolver" | "pg-ca" | "pg-key" | "pg-cert" | "store-cache-threshold" | "store-get-cache-size" | "store-cache-async" | "subquery" | "subquery-name" | "subscription" | "timeout" | "timestamp-field" | "unfinalized-blocks" | "unsafe" | "workers"> & import("yargs").InferredOptionTypes<{
4
2
  'batch-size': {
5
3
  demandOption: false;
6
4
  describe: string;
@@ -116,6 +114,36 @@ export declare const yargsOptions: import("yargs").Argv<import("yargs").Omit<{
116
114
  type: "boolean";
117
115
  default: boolean;
118
116
  };
117
+ 'pg-ca': {
118
+ demandOption: false;
119
+ describe: string;
120
+ type: "string";
121
+ };
122
+ 'pg-key': {
123
+ demandOption: false;
124
+ describe: string;
125
+ type: "string";
126
+ };
127
+ 'pg-cert': {
128
+ demandOption: false;
129
+ describe: string;
130
+ type: "string";
131
+ };
132
+ 'store-cache-threshold': {
133
+ demandOption: false;
134
+ describe: string;
135
+ type: "number";
136
+ };
137
+ 'store-get-cache-size': {
138
+ demandOption: false;
139
+ describe: string;
140
+ type: "number";
141
+ };
142
+ 'store-cache-async': {
143
+ demandOption: false;
144
+ describe: string;
145
+ type: "boolean";
146
+ };
119
147
  subquery: {
120
148
  alias: string;
121
149
  demandOption: true;
@@ -163,24 +191,4 @@ export declare const yargsOptions: import("yargs").Argv<import("yargs").Omit<{
163
191
  describe: string;
164
192
  type: "number";
165
193
  };
166
- 'pg-ca': {
167
- demandOption: false;
168
- describe: string;
169
- type: "string";
170
- };
171
- 'pg-key': {
172
- demandOption: false;
173
- describe: string;
174
- type: "string";
175
- };
176
- 'pg-cert': {
177
- demandOption: false;
178
- describe: string;
179
- type: "string";
180
- };
181
- 'store-cache-threshold': {
182
- demandOption: false;
183
- describe: string;
184
- type: "number";
185
- };
186
194
  }>>;
package/dist/yargs.js CHANGED
@@ -155,6 +155,36 @@ exports.yargsOptions = (0, yargs_1.default)((0, helpers_1.hideBin)(process.argv)
155
155
  type: 'boolean',
156
156
  default: false,
157
157
  },
158
+ 'pg-ca': {
159
+ demandOption: false,
160
+ describe: 'Postgres ca certificate - to enables TLS/SSL connections to your PostgreSQL, path to the server certificate file are required, e.g /path/to/server-certificates/root.crt',
161
+ type: 'string',
162
+ },
163
+ 'pg-key': {
164
+ demandOption: false,
165
+ describe: 'Postgres client key - Path to key file e.g /path/to/client-key/postgresql.key',
166
+ type: 'string',
167
+ },
168
+ 'pg-cert': {
169
+ demandOption: false,
170
+ describe: 'Postgres client certificate - Path to client certificate e.g /path/to/client-certificates/postgresql.crt',
171
+ type: 'string',
172
+ },
173
+ 'store-cache-threshold': {
174
+ demandOption: false,
175
+ describe: 'Store cache will flush when number of records excess this threshold',
176
+ type: 'number',
177
+ },
178
+ 'store-get-cache-size': {
179
+ demandOption: false,
180
+ describe: 'Store get cache size for each model',
181
+ type: 'number',
182
+ },
183
+ 'store-cache-async': {
184
+ demandOption: false,
185
+ describe: 'If enabled writing data to the store is asynchronous with regards to block processing',
186
+ type: 'boolean',
187
+ },
158
188
  subquery: {
159
189
  alias: 'f',
160
190
  demandOption: true,
@@ -202,25 +232,5 @@ exports.yargsOptions = (0, yargs_1.default)((0, helpers_1.hideBin)(process.argv)
202
232
  describe: 'Number of worker threads to use for fetching and processing blocks. Disabled by default.',
203
233
  type: 'number',
204
234
  },
205
- 'pg-ca': {
206
- demandOption: false,
207
- describe: 'Postgres ca certificate - to enables TLS/SSL connections to your PostgreSQL, path to the server certificate file are required, e.g /path/to/server-certificates/root.crt',
208
- type: 'string',
209
- },
210
- 'pg-key': {
211
- demandOption: false,
212
- describe: 'Postgres client key - Path to key file e.g /path/to/client-key/postgresql.key',
213
- type: 'string',
214
- },
215
- 'pg-cert': {
216
- demandOption: false,
217
- describe: 'Postgres client certificate - Path to client certificate e.g /path/to/client-certificates/postgresql.crt',
218
- type: 'string',
219
- },
220
- 'store-cache-threshold': {
221
- demandOption: false,
222
- describe: 'Store cache will flush when number of records excess this threshold',
223
- type: 'number',
224
- },
225
235
  });
226
236
  //# sourceMappingURL=yargs.js.map
package/dist/yargs.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"yargs.js","sourceRoot":"","sources":["../src/yargs.ts"],"names":[],"mappings":";AAAA,gEAAgE;AAChE,sCAAsC;;;;;;AAEtC,oDAAqD;AACrD,2CAAwC;AACxC,wDAAgC;AAEnB,QAAA,YAAY,GAAG,IAAA,eAAK,EAAC,IAAA,iBAAO,EAAC,OAAO,CAAC,IAAI,CAAC,CAAC;KACrD,GAAG,CAAC,YAAY,CAAC;KACjB,OAAO,CAAC;IACP,OAAO,EAAE,aAAa;IACtB,QAAQ,EACN,mIAAmI;IACrI,OAAO,EAAE,EAAE;IACX,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE;QAChB,IAAA,mBAAU,EACR,IAAI,CAAC,KAAgB,EACrB,IAAI,CAAC,SAA+B,EACpC,IAAI,CAAC,QAA8B,CACpC,CAAC;QAEF,4EAA4E;QAC5E,8DAA8D;QAC9D,MAAM,EAAE,cAAc,EAAE,GAAG,OAAO,CAAC,+BAA+B,CAAC,CAAC;QACpE,OAAO,cAAc,EAAE,CAAC;IAC1B,CAAC;CACF,CAAC;KACD,OAAO,CAAC;IACP,OAAO,EAAE,SAAS;IAClB,QAAQ,EACN,gMAAgM;IAClM,OAAO,EAAE,CAAC,KAAK,EAAE,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E,SAAS;QACf,YAAY,EAAE,KAAK;QACnB,QAAQ,EAAE,wDAAwD;KACnE;IACD,OAAO,EAAE;QACP,KAAK,EAAE,GAAG;QACV,YAAY,EAAE,KAAK;QACnB,QAAQ,EACN,0FAA0F;QAC5F,IAAI,EAAE,QAAQ;KACf;IACD,OAAO,EAAE;QACP,YAAY,EAAE,KAAK;QACnB,QAAQ,EACN,0KAA0K;QAC5K,IAAI,EAAE,QAAQ;KACf;IACD,QAAQ,EAAE;QACR,YAAY,EAAE,KAAK;QACnB,QAAQ,EACN,+EAA+E;QACjF,IAAI,EAAE,QAAQ;KACf;IACD,SAAS,EAAE;QACT,YAAY,EAAE,KAAK;QACnB,QAAQ,EACN,0GAA0G;QAC5G,IAAI,EAAE,QAAQ;KACf;IACD,uBAAuB,EAAE;QACvB,YAAY,EAAE,KAAK;QACnB,QAAQ,EACN,qEAAqE;QACvE,IAAI,EAAE,QAAQ;KACf;CACF,CAAC,CAAC","sourcesContent":["// Copyright 2020-2022 OnFinality Limited authors & contributors\n// SPDX-License-Identifier: Apache-2.0\n\nimport { initLogger } from '@subql/node-core/logger';\nimport { hideBin } from 'yargs/helpers';\nimport yargs from 'yargs/yargs';\n\nexport const yargsOptions = yargs(hideBin(process.argv))\n .env('SUBQL_NODE')\n .command({\n command: 'force-clean',\n describe:\n 'Clean the database dropping project schemas and tables. Once the command is executed, the application would exit upon completion.',\n builder: {},\n handler: (argv) => {\n initLogger(\n argv.debug as boolean,\n argv.outputFmt as 'json' | 'colored',\n argv.logLevel as string | undefined,\n );\n\n // lazy import to make sure logger is instantiated before all other services\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n const { forceCleanInit } = require('./subcommands/forceClean.init');\n return forceCleanInit();\n },\n })\n .command({\n command: 'reindex',\n describe:\n 'Reindex to specified block height. Historical must be enabled for the targeted project (--disable-historical=false). Once the command is executed, the application would exit upon completion.',\n builder: (yargs) =>\n yargs.options('targetHeight', {\n type: 'number',\n description: 'set targetHeight',\n require: true,\n }),\n handler: (argv) => {\n initLogger(\n argv.debug as boolean,\n argv.outputFmt as 'json' | 'colored',\n argv.logLevel as string | undefined,\n );\n // lazy import to make sure logger is instantiated before all other services\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n const { reindexInit } = require('./subcommands/reindex.init');\n return reindexInit(argv.targetHeight);\n },\n })\n .options({\n 'batch-size': {\n demandOption: false,\n describe: 'Batch size of blocks to fetch in one round',\n type: 'number',\n },\n config: {\n alias: 'c',\n demandOption: false,\n describe: 'Specify configuration file',\n type: 'string',\n },\n 'db-schema': {\n demandOption: false,\n describe: 'Db schema name of the project',\n type: 'string',\n },\n debug: {\n demandOption: false,\n describe:\n 'Show debug information to console output. will forcefully set log level to debug',\n type: 'boolean',\n default: false,\n },\n 'dictionary-timeout': {\n demandOption: false,\n describe: 'Max timeout for dictionary query',\n type: 'number',\n },\n 'disable-historical': {\n demandOption: false,\n default: false,\n describe: 'Disable storing historical state entities',\n type: 'boolean',\n },\n ipfs: {\n demandOption: false,\n describe: 'IPFS gateway endpoint',\n type: 'string',\n },\n local: {\n deprecated: true,\n type: 'boolean',\n demandOption: false,\n describe: 'Use local mode',\n },\n 'log-level': {\n demandOption: false,\n describe: 'Specify log level to print. Ignored when --debug is used',\n type: 'string',\n choices: ['fatal', 'error', 'warn', 'info', 'debug', 'trace', 'silent'],\n },\n 'mmr-path': {\n alias: 'm',\n demandOption: false,\n describe: 'Local path of the merkle mountain range (.mmr) file',\n type: 'string',\n },\n 'multi-chain': {\n demandOption: false,\n default: false,\n describe:\n 'Enables indexing multiple subquery projects into the same database schema',\n type: 'boolean',\n },\n 'network-dictionary': {\n alias: 'd',\n demandOption: false,\n describe: 'Specify the dictionary api for this network',\n type: 'string',\n },\n 'network-endpoint': {\n demandOption: false,\n type: 'string',\n describe: 'Blockchain network endpoint to connect',\n },\n 'output-fmt': {\n demandOption: false,\n describe: 'Print log as json or plain text',\n type: 'string',\n choices: ['json', 'colored'],\n },\n port: {\n alias: 'p',\n demandOption: false,\n describe: 'The port the service will bind to',\n type: 'number',\n },\n profiler: {\n demandOption: false,\n describe: 'Show profiler information to console output',\n type: 'boolean',\n default: false,\n },\n 'proof-of-index': {\n demandOption: false,\n describe: 'Enable/disable proof of index',\n type: 'boolean',\n default: false,\n },\n 'query-limit': {\n demandOption: false,\n describe:\n 'The limit of items a project can query with store.getByField at once',\n type: 'number',\n default: 100,\n },\n 'scale-batch-size': {\n type: 'boolean',\n demandOption: false,\n describe: 'scale batch size based on memory usage',\n default: false,\n },\n 'dictionary-resolver': {\n demandOption: false,\n describe: 'Use subquery network dictionary resolver',\n type: 'boolean',\n default: false,\n },\n subquery: {\n alias: 'f',\n demandOption: true,\n default: process.cwd(),\n describe: 'Local path or IPFS cid of the subquery project',\n type: 'string',\n },\n 'subquery-name': {\n deprecated: true,\n demandOption: false,\n describe: 'Name of the subquery project',\n type: 'string',\n },\n subscription: {\n demandOption: false,\n describe: 'Enable subscription by create notification triggers',\n type: 'boolean',\n default: false,\n },\n timeout: {\n demandOption: false,\n describe: 'Timeout for indexer sandbox to execute the mapping functions',\n type: 'number',\n },\n 'timestamp-field': {\n demandOption: false,\n describe: 'Enable/disable created_at and updated_at in schema',\n type: 'boolean',\n default: false,\n },\n 'unfinalized-blocks': {\n demandOption: false,\n default: false,\n describe: 'Enable to fetch and index unfinalized blocks',\n type: 'boolean',\n },\n unsafe: {\n type: 'boolean',\n demandOption: false,\n describe: 'Allows usage of any built-in module within the sandbox',\n },\n workers: {\n alias: 'w',\n demandOption: false,\n describe:\n 'Number of worker threads to use for fetching and processing blocks. Disabled by default.',\n type: 'number',\n },\n 'pg-ca': {\n demandOption: false,\n describe:\n 'Postgres ca certificate - to enables TLS/SSL connections to your PostgreSQL, path to the server certificate file are required, e.g /path/to/server-certificates/root.crt',\n type: 'string',\n },\n 'pg-key': {\n demandOption: false,\n describe:\n 'Postgres client key - Path to key file e.g /path/to/client-key/postgresql.key',\n type: 'string',\n },\n 'pg-cert': {\n demandOption: false,\n describe:\n 'Postgres client certificate - Path to client certificate e.g /path/to/client-certificates/postgresql.crt',\n type: 'string',\n },\n 'store-cache-threshold': {\n demandOption: false,\n describe:\n 'Store cache will flush when number of records excess this threshold',\n type: 'number',\n },\n });\n"]}
1
+ {"version":3,"file":"yargs.js","sourceRoot":"","sources":["../src/yargs.ts"],"names":[],"mappings":";AAAA,gEAAgE;AAChE,sCAAsC;;;;;;AAEtC,oDAAqD;AACrD,2CAAwC;AACxC,wDAAgC;AAEnB,QAAA,YAAY,GAAG,IAAA,eAAK,EAAC,IAAA,iBAAO,EAAC,OAAO,CAAC,IAAI,CAAC,CAAC;KACrD,GAAG,CAAC,YAAY,CAAC;KACjB,OAAO,CAAC;IACP,OAAO,EAAE,aAAa;IACtB,QAAQ,EACN,mIAAmI;IACrI,OAAO,EAAE,EAAE;IACX,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE;QAChB,IAAA,mBAAU,EACR,IAAI,CAAC,KAAgB,EACrB,IAAI,CAAC,SAA+B,EACpC,IAAI,CAAC,QAA8B,CACpC,CAAC;QAEF,4EAA4E;QAC5E,8DAA8D;QAC9D,MAAM,EAAE,cAAc,EAAE,GAAG,OAAO,CAAC,+BAA+B,CAAC,CAAC;QACpE,OAAO,cAAc,EAAE,CAAC;IAC1B,CAAC;CACF,CAAC;KACD,OAAO,CAAC;IACP,OAAO,EAAE,SAAS;IAClB,QAAQ,EACN,gMAAgM;IAClM,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE,CACjB,KAAK,CAAC,OAAO,CAAC,cAAc,EAAE;QAC5B,IAAI,EAAE,QAAQ;QACd,WAAW,EAAE,kBAAkB;QAC/B,OAAO,EAAE,IAAI;KACd,CAAC;IACJ,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE;QAChB,IAAA,mBAAU,EACR,IAAI,CAAC,KAAgB,EACrB,IAAI,CAAC,SAA+B,EACpC,IAAI,CAAC,QAA8B,CACpC,CAAC;QACF,4EAA4E;QAC5E,8DAA8D;QAC9D,MAAM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iB,EAAE;QACjB,YAAY,EAAE,KAAK;QACnB,QAAQ,EAAE,oDAAoD;QAC9D,IAAI,EAAE,SAAS;QACf,OAAO,EAAE,KAAK;KACf;IACD,oBAAoB,EAAE;QACpB,YAAY,EAAE,KAAK;QACnB,OAAO,EAAE,KAAK;QACd,QAAQ,EAAE,8CAA8C;QACxD,IAAI,EAAE,SAAS;KAChB;IACD,MAAM,EAAE;QACN,IAAI,EAAE,SAAS;QACf,YAAY,EAAE,KAAK;QACnB,QAAQ,EAAE,wDAAwD;KACnE;IACD,OAAO,EAAE;QACP,KAAK,EAAE,GAAG;QACV,YAAY,EAAE,KAAK;QACnB,QAAQ,EACN,0FAA0F;QAC5F,IAAI,EAAE,QAAQ;KACf;CACF,CAAC,CAAC","sourcesContent":["// Copyright 2020-2022 OnFinality Limited authors & contributors\n// SPDX-License-Identifier: Apache-2.0\n\nimport { initLogger } from '@subql/node-core/logger';\nimport { hideBin } from 'yargs/helpers';\nimport yargs from 'yargs/yargs';\n\nexport const yargsOptions = yargs(hideBin(process.argv))\n .env('SUBQL_NODE')\n .command({\n command: 'force-clean',\n describe:\n 'Clean the database dropping project schemas and tables. Once the command is executed, the application would exit upon completion.',\n builder: {},\n handler: (argv) => {\n initLogger(\n argv.debug as boolean,\n argv.outputFmt as 'json' | 'colored',\n argv.logLevel as string | undefined,\n );\n\n // lazy import to make sure logger is instantiated before all other services\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n const { forceCleanInit } = require('./subcommands/forceClean.init');\n return forceCleanInit();\n },\n })\n .command({\n command: 'reindex',\n describe:\n 'Reindex to specified block height. Historical must be enabled for the targeted project (--disable-historical=false). Once the command is executed, the application would exit upon completion.',\n builder: (yargs) =>\n yargs.options('targetHeight', {\n type: 'number',\n description: 'set targetHeight',\n require: true,\n }),\n handler: (argv) => {\n initLogger(\n argv.debug as boolean,\n argv.outputFmt as 'json' | 'colored',\n argv.logLevel as string | undefined,\n );\n // lazy import to make sure logger is instantiated before all other services\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n const { reindexInit } = require('./subcommands/reindex.init');\n return reindexInit(argv.targetHeight);\n },\n })\n .options({\n 'batch-size': {\n demandOption: false,\n describe: 'Batch size of blocks to fetch in one round',\n type: 'number',\n },\n config: {\n alias: 'c',\n demandOption: false,\n describe: 'Specify configuration file',\n type: 'string',\n },\n 'db-schema': {\n demandOption: false,\n describe: 'Db schema name of the project',\n type: 'string',\n },\n debug: {\n demandOption: false,\n describe:\n 'Show debug information to console output. will forcefully set log level to debug',\n type: 'boolean',\n default: false,\n },\n 'dictionary-timeout': {\n demandOption: false,\n describe: 'Max timeout for dictionary query',\n type: 'number',\n },\n 'disable-historical': {\n demandOption: false,\n default: false,\n describe: 'Disable storing historical state entities',\n type: 'boolean',\n },\n ipfs: {\n demandOption: false,\n describe: 'IPFS gateway endpoint',\n type: 'string',\n },\n local: {\n deprecated: true,\n type: 'boolean',\n demandOption: false,\n describe: 'Use local mode',\n },\n 'log-level': {\n demandOption: false,\n describe: 'Specify log level to print. Ignored when --debug is used',\n type: 'string',\n choices: ['fatal', 'error', 'warn', 'info', 'debug', 'trace', 'silent'],\n },\n 'mmr-path': {\n alias: 'm',\n demandOption: false,\n describe: 'Local path of the merkle mountain range (.mmr) file',\n type: 'string',\n },\n 'multi-chain': {\n demandOption: false,\n default: false,\n describe:\n 'Enables indexing multiple subquery projects into the same database schema',\n type: 'boolean',\n },\n 'network-dictionary': {\n alias: 'd',\n demandOption: false,\n describe: 'Specify the dictionary api for this network',\n type: 'string',\n },\n 'network-endpoint': {\n demandOption: false,\n type: 'string',\n describe: 'Blockchain network endpoint to connect',\n },\n 'output-fmt': {\n demandOption: false,\n describe: 'Print log as json or plain text',\n type: 'string',\n choices: ['json', 'colored'],\n },\n port: {\n alias: 'p',\n demandOption: false,\n describe: 'The port the service will bind to',\n type: 'number',\n },\n profiler: {\n demandOption: false,\n describe: 'Show profiler information to console output',\n type: 'boolean',\n default: false,\n },\n 'proof-of-index': {\n demandOption: false,\n describe: 'Enable/disable proof of index',\n type: 'boolean',\n default: false,\n },\n 'query-limit': {\n demandOption: false,\n describe:\n 'The limit of items a project can query with store.getByField at once',\n type: 'number',\n default: 100,\n },\n 'scale-batch-size': {\n type: 'boolean',\n demandOption: false,\n describe: 'scale batch size based on memory usage',\n default: false,\n },\n 'dictionary-resolver': {\n demandOption: false,\n describe: 'Use subquery network dictionary resolver',\n type: 'boolean',\n default: false,\n },\n 'pg-ca': {\n demandOption: false,\n describe:\n 'Postgres ca certificate - to enables TLS/SSL connections to your PostgreSQL, path to the server certificate file are required, e.g /path/to/server-certificates/root.crt',\n type: 'string',\n },\n 'pg-key': {\n demandOption: false,\n describe:\n 'Postgres client key - Path to key file e.g /path/to/client-key/postgresql.key',\n type: 'string',\n },\n 'pg-cert': {\n demandOption: false,\n describe:\n 'Postgres client certificate - Path to client certificate e.g /path/to/client-certificates/postgresql.crt',\n type: 'string',\n },\n 'store-cache-threshold': {\n demandOption: false,\n describe:\n 'Store cache will flush when number of records excess this threshold',\n type: 'number',\n },\n 'store-get-cache-size': {\n demandOption: false,\n describe: 'Store get cache size for each model',\n type: 'number',\n },\n 'store-cache-async': {\n demandOption: false,\n describe:\n 'If enabled writing data to the store is asynchronous with regards to block processing',\n type: 'boolean',\n },\n subquery: {\n alias: 'f',\n demandOption: true,\n default: process.cwd(),\n describe: 'Local path or IPFS cid of the subquery project',\n type: 'string',\n },\n 'subquery-name': {\n deprecated: true,\n demandOption: false,\n describe: 'Name of the subquery project',\n type: 'string',\n },\n subscription: {\n demandOption: false,\n describe: 'Enable subscription by create notification triggers',\n type: 'boolean',\n default: false,\n },\n timeout: {\n demandOption: false,\n describe: 'Timeout for indexer sandbox to execute the mapping functions',\n type: 'number',\n },\n 'timestamp-field': {\n demandOption: false,\n describe: 'Enable/disable created_at and updated_at in schema',\n type: 'boolean',\n default: false,\n },\n 'unfinalized-blocks': {\n demandOption: false,\n default: false,\n describe: 'Enable to fetch and index unfinalized blocks',\n type: 'boolean',\n },\n unsafe: {\n type: 'boolean',\n demandOption: false,\n describe: 'Allows usage of any built-in module within the sandbox',\n },\n workers: {\n alias: 'w',\n demandOption: false,\n describe:\n 'Number of worker threads to use for fetching and processing blocks. Disabled by default.',\n type: 'number',\n },\n });\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@subql/node-ethereum",
3
- "version": "0.4.1-storeCache-0.0.5",
3
+ "version": "1.0.0",
4
4
  "description": "",
5
5
  "author": "Ian He",
6
6
  "license": "Apache-2.0",
@@ -24,10 +24,10 @@
24
24
  "@nestjs/event-emitter": "^1.3.0",
25
25
  "@nestjs/platform-express": "^8.2.6",
26
26
  "@nestjs/schedule": "^1.0.2",
27
- "@subql/common": "^1.7.0",
28
- "@subql/common-ethereum": "0.2.2-4",
29
- "@subql/node-core": "1.10.1-storeCache-0.0.4",
30
- "@subql/types-ethereum": "0.2.2-6",
27
+ "@subql/common": "^1.8.1",
28
+ "@subql/common-ethereum": "1.0.0",
29
+ "@subql/node-core": "1.11.2-storeCache-0.0.2",
30
+ "@subql/types-ethereum": "1.0.0",
31
31
  "@subql/utils": "^1.4.1",
32
32
  "@subql/x-merkle-mountain-range": "2.0.0-0.1.2",
33
33
  "@willsoto/nestjs-prometheus": "^4.4.0",
@@ -74,6 +74,5 @@
74
74
  "files": [
75
75
  "/dist",
76
76
  "/bin"
77
- ],
78
- "stableVersion": "0.4.1-13"
79
- }
77
+ ]
78
+ }