@subql/node-ethereum 2.6.2-5 → 2.6.2-6

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 (31) hide show
  1. package/dist/.tsbuildinfo +1 -1
  2. package/dist/indexer/dictionary.service.d.ts +3 -3
  3. package/dist/indexer/dictionary.service.js +10 -13
  4. package/dist/indexer/dictionary.service.js.map +1 -1
  5. package/dist/indexer/fetch.module.js +2 -2
  6. package/dist/indexer/fetch.module.js.map +1 -1
  7. package/dist/indexer/indexer.module.js +1 -0
  8. package/dist/indexer/indexer.module.js.map +1 -1
  9. package/dist/indexer/worker/worker.unfinalizedBlocks.service.d.ts +1 -0
  10. package/dist/indexer/worker/worker.unfinalizedBlocks.service.js +4 -0
  11. package/dist/indexer/worker/worker.unfinalizedBlocks.service.js.map +1 -1
  12. package/dist/meta/meta.module.js +2 -8
  13. package/dist/meta/meta.module.js.map +1 -1
  14. package/dist/subcommands/forceClean.module.d.ts +0 -2
  15. package/dist/subcommands/forceClean.module.js +2 -12
  16. package/dist/subcommands/forceClean.module.js.map +1 -1
  17. package/dist/subcommands/mmrMigrate.module.d.ts +0 -2
  18. package/dist/subcommands/mmrMigrate.module.js +2 -22
  19. package/dist/subcommands/mmrMigrate.module.js.map +1 -1
  20. package/dist/subcommands/mmrRegenerate.module.d.ts +0 -2
  21. package/dist/subcommands/mmrRegenerate.module.js +2 -18
  22. package/dist/subcommands/mmrRegenerate.module.js.map +1 -1
  23. package/dist/subcommands/reindex.module.js +1 -0
  24. package/dist/subcommands/reindex.module.js.map +1 -1
  25. package/dist/subcommands/reindex.service.d.ts +5 -21
  26. package/dist/subcommands/reindex.service.js +5 -62
  27. package/dist/subcommands/reindex.service.js.map +1 -1
  28. package/dist/yargs.d.ts +0 -1
  29. package/dist/yargs.js +2 -3
  30. package/dist/yargs.js.map +1 -1
  31. package/package.json +13 -14
@@ -3,7 +3,7 @@ import { NodeConfig, DictionaryService as CoreDictionaryService } from '@subql/n
3
3
  import { SubqueryProject } from '../configure/SubqueryProject';
4
4
  export declare class DictionaryService extends CoreDictionaryService implements OnApplicationShutdown {
5
5
  protected project: SubqueryProject;
6
- constructor(project: SubqueryProject, nodeConfig: NodeConfig);
7
- init(): Promise<void>;
8
- private getEvmChainId;
6
+ private constructor();
7
+ static create(project: SubqueryProject, nodeConfig: NodeConfig): Promise<DictionaryService>;
8
+ private static getEvmChainId;
9
9
  }
@@ -16,6 +16,7 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
16
16
  var __importDefault = (this && this.__importDefault) || function (mod) {
17
17
  return (mod && mod.__esModule) ? mod : { "default": mod };
18
18
  };
19
+ var DictionaryService_1;
19
20
  Object.defineProperty(exports, "__esModule", { value: true });
20
21
  exports.DictionaryService = void 0;
21
22
  const common_1 = require("@nestjs/common");
@@ -24,36 +25,32 @@ const json5_1 = __importDefault(require("json5"));
24
25
  const node_fetch_1 = __importDefault(require("node-fetch"));
25
26
  const SubqueryProject_1 = require("../configure/SubqueryProject");
26
27
  const CHAIN_ALIASES_URL = 'https://raw.githubusercontent.com/subquery/templates/main/chainAliases.json5';
27
- let DictionaryService = class DictionaryService extends node_core_1.DictionaryService {
28
- constructor(project, nodeConfig) {
29
- super(project.network.dictionary, project.network.chainId, nodeConfig);
28
+ let DictionaryService = DictionaryService_1 = class DictionaryService extends node_core_1.DictionaryService {
29
+ constructor(project, nodeConfig, chainId) {
30
+ super(project.network.dictionary, chainId !== null && chainId !== void 0 ? chainId : project.network.chainId, nodeConfig);
30
31
  this.project = project;
31
32
  }
32
- async init() {
33
+ static async create(project, nodeConfig) {
33
34
  /*Some dictionarys for EVM are built with other SDKs as they are chains with an EVM runtime
34
35
  * we maintain a list of aliases so we can map the evmChainId to the genesis hash of the other SDKs
35
36
  * e.g moonbeam is built with Substrate SDK but can be used as an EVM dictionary
36
37
  */
37
38
  const chainAliases = await this.getEvmChainId();
38
- const chainAlias = chainAliases[this.chainId];
39
- if (chainAlias) {
40
- // Cast as any to work around read only
41
- this.chainId = chainAlias;
42
- }
43
- await super.init();
39
+ const chainAlias = chainAliases[project.network.chainId];
40
+ return new DictionaryService_1(project, nodeConfig, chainAlias);
44
41
  }
45
- async getEvmChainId() {
42
+ static async getEvmChainId() {
46
43
  const response = await (0, node_fetch_1.default)(CHAIN_ALIASES_URL);
47
44
  const raw = await response.text();
48
45
  // We use JSON5 here because the file has comments in it
49
46
  return json5_1.default.parse(raw);
50
47
  }
51
48
  };
52
- DictionaryService = __decorate([
49
+ DictionaryService = DictionaryService_1 = __decorate([
53
50
  (0, common_1.Injectable)(),
54
51
  __param(0, (0, common_1.Inject)('ISubqueryProject')),
55
52
  __metadata("design:paramtypes", [SubqueryProject_1.SubqueryProject,
56
- node_core_1.NodeConfig])
53
+ node_core_1.NodeConfig, String])
57
54
  ], DictionaryService);
58
55
  exports.DictionaryService = DictionaryService;
59
56
  //# sourceMappingURL=dictionary.service.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"dictionary.service.js","sourceRoot":"","sources":["../../src/indexer/dictionary.service.ts"],"names":[],"mappings":";AAAA,gEAAgE;AAChE,sCAAsC;;;;;;;;;;;;;;;;;;AAEtC,2CAA2E;AAC3E,gDAG0B;AAC1B,kDAA0B;AAC1B,4DAA+B;AAC/B,kEAA+D;AAE/D,MAAM,iBAAiB,GACrB,8EAA8E,CAAC;AAG1E,IAAM,iBAAiB,GAAvB,MAAM,iBACX,SAAQ,6BAAqB;IAG7B,YACwC,OAAwB,EAC9D,UAAsB;QAEtB,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,UAAU,EAAE,OAAO,CAAC,OAAO,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;QAHjC,YAAO,GAAP,OAAO,CAAiB;IAIhE,CAAC;IAED,KAAK,CAAC,IAAI;QACR;;;WAGG;QACH,MAAM,YAAY,GAAG,MAAM,IAAI,CAAC,aAAa,EAAE,CAAC;QAChD,MAAM,UAAU,GAAG,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAE9C,IAAI,UAAU,EAAE;YACd,uCAAuC;YACtC,IAAI,CAAC,OAAe,GAAG,UAAU,CAAC;SACpC;QAED,MAAM,KAAK,CAAC,IAAI,EAAE,CAAC;IACrB,CAAC;IAEO,KAAK,CAAC,aAAa;QACzB,MAAM,QAAQ,GAAG,MAAM,IAAA,oBAAK,EAAC,iBAAiB,CAAC,CAAC;QAEhD,MAAM,GAAG,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;QAClC,wDAAwD;QACxD,OAAO,eAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC1B,CAAC;CACF,CAAA;AAlCY,iBAAiB;IAD7B,IAAA,mBAAU,GAAE;IAMR,WAAA,IAAA,eAAM,EAAC,kBAAkB,CAAC,CAAA;qCAAoB,iCAAe;QAClD,sBAAU;GANb,iBAAiB,CAkC7B;AAlCY,8CAAiB","sourcesContent":["// Copyright 2020-2022 OnFinality Limited authors & contributors\n// SPDX-License-Identifier: Apache-2.0\n\nimport { Inject, Injectable, OnApplicationShutdown } from '@nestjs/common';\nimport {\n NodeConfig,\n DictionaryService as CoreDictionaryService,\n} from '@subql/node-core';\nimport JSON5 from 'json5';\nimport fetch from 'node-fetch';\nimport { SubqueryProject } from '../configure/SubqueryProject';\n\nconst CHAIN_ALIASES_URL =\n 'https://raw.githubusercontent.com/subquery/templates/main/chainAliases.json5';\n\n@Injectable()\nexport class DictionaryService\n extends CoreDictionaryService\n implements OnApplicationShutdown\n{\n constructor(\n @Inject('ISubqueryProject') protected project: SubqueryProject,\n nodeConfig: NodeConfig,\n ) {\n super(project.network.dictionary, project.network.chainId, nodeConfig);\n }\n\n async init(): Promise<void> {\n /*Some dictionarys for EVM are built with other SDKs as they are chains with an EVM runtime\n * we maintain a list of aliases so we can map the evmChainId to the genesis hash of the other SDKs\n * e.g moonbeam is built with Substrate SDK but can be used as an EVM dictionary\n */\n const chainAliases = await this.getEvmChainId();\n const chainAlias = chainAliases[this.chainId];\n\n if (chainAlias) {\n // Cast as any to work around read only\n (this.chainId as any) = chainAlias;\n }\n\n await super.init();\n }\n\n private async getEvmChainId(): Promise<Record<string, string>> {\n const response = await fetch(CHAIN_ALIASES_URL);\n\n const raw = await response.text();\n // We use JSON5 here because the file has comments in it\n return JSON5.parse(raw);\n }\n}\n"]}
1
+ {"version":3,"file":"dictionary.service.js","sourceRoot":"","sources":["../../src/indexer/dictionary.service.ts"],"names":[],"mappings":";AAAA,gEAAgE;AAChE,sCAAsC;;;;;;;;;;;;;;;;;;;AAEtC,2CAA2E;AAC3E,gDAG0B;AAC1B,kDAA0B;AAC1B,4DAA+B;AAC/B,kEAA+D;AAE/D,MAAM,iBAAiB,GACrB,8EAA8E,CAAC;AAG1E,IAAM,iBAAiB,yBAAvB,MAAM,iBACX,SAAQ,6BAAqB;IAG7B,YACwC,OAAwB,EAC9D,UAAsB,EACtB,OAAgB;QAEhB,KAAK,CACH,OAAO,CAAC,OAAO,CAAC,UAAU,EAC1B,OAAO,aAAP,OAAO,cAAP,OAAO,GAAI,OAAO,CAAC,OAAO,CAAC,OAAO,EAClC,UAAU,CACX,CAAC;QARoC,YAAO,GAAP,OAAO,CAAiB;IAShE,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,MAAM,CACjB,OAAwB,EACxB,UAAsB;QAEtB;;;WAGG;QACH,MAAM,YAAY,GAAG,MAAM,IAAI,CAAC,aAAa,EAAE,CAAC;QAChD,MAAM,UAAU,GAAG,YAAY,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QAEzD,OAAO,IAAI,mBAAiB,CAAC,OAAO,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC;IAChE,CAAC;IAEO,MAAM,CAAC,KAAK,CAAC,aAAa;QAChC,MAAM,QAAQ,GAAG,MAAM,IAAA,oBAAK,EAAC,iBAAiB,CAAC,CAAC;QAEhD,MAAM,GAAG,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;QAClC,wDAAwD;QACxD,OAAO,eAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC1B,CAAC;CACF,CAAA;AArCY,iBAAiB;IAD7B,IAAA,mBAAU,GAAE;IAMR,WAAA,IAAA,eAAM,EAAC,kBAAkB,CAAC,CAAA;qCAAoB,iCAAe;QAClD,sBAAU;GANb,iBAAiB,CAqC7B;AArCY,8CAAiB","sourcesContent":["// Copyright 2020-2022 OnFinality Limited authors & contributors\n// SPDX-License-Identifier: Apache-2.0\n\nimport { Inject, Injectable, OnApplicationShutdown } from '@nestjs/common';\nimport {\n NodeConfig,\n DictionaryService as CoreDictionaryService,\n} from '@subql/node-core';\nimport JSON5 from 'json5';\nimport fetch from 'node-fetch';\nimport { SubqueryProject } from '../configure/SubqueryProject';\n\nconst CHAIN_ALIASES_URL =\n 'https://raw.githubusercontent.com/subquery/templates/main/chainAliases.json5';\n\n@Injectable()\nexport class DictionaryService\n extends CoreDictionaryService\n implements OnApplicationShutdown\n{\n private constructor(\n @Inject('ISubqueryProject') protected project: SubqueryProject,\n nodeConfig: NodeConfig,\n chainId?: string,\n ) {\n super(\n project.network.dictionary,\n chainId ?? project.network.chainId,\n nodeConfig,\n );\n }\n\n static async create(\n project: SubqueryProject,\n nodeConfig: NodeConfig,\n ): Promise<DictionaryService> {\n /*Some dictionarys for EVM are built with other SDKs as they are chains with an EVM runtime\n * we maintain a list of aliases so we can map the evmChainId to the genesis hash of the other SDKs\n * e.g moonbeam is built with Substrate SDK but can be used as an EVM dictionary\n */\n const chainAliases = await this.getEvmChainId();\n const chainAlias = chainAliases[project.network.chainId];\n\n return new DictionaryService(project, nodeConfig, chainAlias);\n }\n\n private static async getEvmChainId(): Promise<Record<string, string>> {\n const response = await fetch(CHAIN_ALIASES_URL);\n\n const raw = await response.text();\n // We use JSON5 here because the file has comments in it\n return JSON5.parse(raw);\n }\n}\n"]}
@@ -79,8 +79,7 @@ FetchModule = __decorate([
79
79
  {
80
80
  provide: dictionary_service_1.DictionaryService,
81
81
  useFactory: async (project, nodeConfig) => {
82
- const dictionaryService = new dictionary_service_1.DictionaryService(project, nodeConfig);
83
- await dictionaryService.init();
82
+ const dictionaryService = await dictionary_service_1.DictionaryService.create(project, nodeConfig);
84
83
  return dictionaryService;
85
84
  },
86
85
  inject: ['ISubqueryProject', node_core_1.NodeConfig],
@@ -90,6 +89,7 @@ FetchModule = __decorate([
90
89
  dynamic_ds_service_1.DynamicDsService,
91
90
  node_core_1.PoiService,
92
91
  node_core_1.MmrService,
92
+ node_core_1.PgMmrCacheService,
93
93
  {
94
94
  useClass: project_service_1.ProjectService,
95
95
  provide: 'IProjectService',
@@ -1 +1 @@
1
- {"version":3,"file":"fetch.module.js","sourceRoot":"","sources":["../../src/indexer/fetch.module.ts"],"names":[],"mappings":"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","sourcesContent":["// Copyright 2020-2022 OnFinality Limited authors & contributors\n// SPDX-License-Identifier: Apache-2.0\n\nimport { Module } from '@nestjs/common';\nimport { EventEmitter2 } from '@nestjs/event-emitter';\nimport {\n BenchmarkService,\n MmrService,\n StoreService,\n PoiService,\n ApiService,\n NodeConfig,\n ConnectionPoolService,\n SmartBatchService,\n StoreCacheService,\n} from '@subql/node-core';\nimport { SubqueryProject } from '../configure/SubqueryProject';\nimport { EthereumApiConnection } from '../ethereum/api.connection';\nimport { EthereumApiService } from '../ethereum/api.service.ethereum';\nimport {\n BlockDispatcherService,\n WorkerBlockDispatcherService,\n} from './blockDispatcher';\nimport { DictionaryService } from './dictionary.service';\nimport { DsProcessorService } from './ds-processor.service';\nimport { DynamicDsService } from './dynamic-ds.service';\nimport { FetchService } from './fetch.service';\nimport { IndexerManager } from './indexer.manager';\nimport { ProjectService } from './project.service';\nimport { SandboxService } from './sandbox.service';\nimport { UnfinalizedBlocksService } from './unfinalizedBlocks.service';\n\n@Module({\n providers: [\n StoreService,\n StoreCacheService,\n {\n provide: ApiService,\n useFactory: async (\n project: SubqueryProject,\n connectionPoolService: ConnectionPoolService<EthereumApiConnection>,\n eventEmitter: EventEmitter2,\n ) => {\n const apiService = new EthereumApiService(\n project,\n connectionPoolService,\n eventEmitter,\n );\n await apiService.init();\n return apiService;\n },\n inject: ['ISubqueryProject', ConnectionPoolService, EventEmitter2],\n },\n IndexerManager,\n ConnectionPoolService,\n {\n provide: SmartBatchService,\n useFactory: (nodeConfig: NodeConfig) => {\n return new SmartBatchService(nodeConfig.batchSize);\n },\n inject: [NodeConfig],\n },\n {\n provide: SmartBatchService,\n useFactory: (nodeConfig: NodeConfig) => {\n return new SmartBatchService(nodeConfig.batchSize);\n },\n inject: [NodeConfig],\n },\n {\n provide: 'IBlockDispatcher',\n useFactory: (\n nodeConfig: NodeConfig,\n eventEmitter: EventEmitter2,\n projectService: ProjectService,\n apiService: EthereumApiService,\n indexerManager: IndexerManager,\n smartBatchService: SmartBatchService,\n storeService: StoreService,\n storeCacheService: StoreCacheService,\n poiService: PoiService,\n project: SubqueryProject,\n dynamicDsService: DynamicDsService,\n unfinalizedBlocks: UnfinalizedBlocksService,\n ) =>\n nodeConfig.workers !== undefined\n ? new WorkerBlockDispatcherService(\n nodeConfig,\n eventEmitter,\n projectService,\n smartBatchService,\n storeService,\n storeCacheService,\n poiService,\n project,\n dynamicDsService,\n unfinalizedBlocks,\n )\n : new BlockDispatcherService(\n apiService,\n nodeConfig,\n indexerManager,\n eventEmitter,\n projectService,\n smartBatchService,\n storeService,\n storeCacheService,\n poiService,\n project,\n dynamicDsService,\n ),\n inject: [\n NodeConfig,\n EventEmitter2,\n 'IProjectService',\n ApiService,\n IndexerManager,\n SmartBatchService,\n StoreService,\n StoreCacheService,\n PoiService,\n 'ISubqueryProject',\n DynamicDsService,\n UnfinalizedBlocksService,\n ],\n },\n FetchService,\n BenchmarkService,\n {\n provide: DictionaryService,\n useFactory: async (project: SubqueryProject, nodeConfig: NodeConfig) => {\n const dictionaryService = new DictionaryService(project, nodeConfig);\n await dictionaryService.init();\n return dictionaryService;\n },\n inject: ['ISubqueryProject', NodeConfig],\n },\n SandboxService,\n DsProcessorService,\n DynamicDsService,\n PoiService,\n MmrService,\n {\n useClass: ProjectService,\n provide: 'IProjectService',\n },\n UnfinalizedBlocksService,\n ],\n exports: [StoreService, MmrService, StoreCacheService],\n})\nexport class FetchModule {}\n"]}
1
+ {"version":3,"file":"fetch.module.js","sourceRoot":"","sources":["../../src/indexer/fetch.module.ts"],"names":[],"mappings":"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","sourcesContent":["// Copyright 2020-2022 OnFinality Limited authors & contributors\n// SPDX-License-Identifier: Apache-2.0\n\nimport { Module } from '@nestjs/common';\nimport { EventEmitter2 } from '@nestjs/event-emitter';\nimport {\n BenchmarkService,\n MmrService,\n StoreService,\n PoiService,\n ApiService,\n NodeConfig,\n ConnectionPoolService,\n SmartBatchService,\n StoreCacheService,\n PgMmrCacheService,\n} from '@subql/node-core';\nimport { SubqueryProject } from '../configure/SubqueryProject';\nimport { EthereumApiConnection } from '../ethereum/api.connection';\nimport { EthereumApiService } from '../ethereum/api.service.ethereum';\nimport {\n BlockDispatcherService,\n WorkerBlockDispatcherService,\n} from './blockDispatcher';\nimport { DictionaryService } from './dictionary.service';\nimport { DsProcessorService } from './ds-processor.service';\nimport { DynamicDsService } from './dynamic-ds.service';\nimport { FetchService } from './fetch.service';\nimport { IndexerManager } from './indexer.manager';\nimport { ProjectService } from './project.service';\nimport { SandboxService } from './sandbox.service';\nimport { UnfinalizedBlocksService } from './unfinalizedBlocks.service';\n\n@Module({\n providers: [\n StoreService,\n StoreCacheService,\n {\n provide: ApiService,\n useFactory: async (\n project: SubqueryProject,\n connectionPoolService: ConnectionPoolService<EthereumApiConnection>,\n eventEmitter: EventEmitter2,\n ) => {\n const apiService = new EthereumApiService(\n project,\n connectionPoolService,\n eventEmitter,\n );\n await apiService.init();\n return apiService;\n },\n inject: ['ISubqueryProject', ConnectionPoolService, EventEmitter2],\n },\n IndexerManager,\n ConnectionPoolService,\n {\n provide: SmartBatchService,\n useFactory: (nodeConfig: NodeConfig) => {\n return new SmartBatchService(nodeConfig.batchSize);\n },\n inject: [NodeConfig],\n },\n {\n provide: SmartBatchService,\n useFactory: (nodeConfig: NodeConfig) => {\n return new SmartBatchService(nodeConfig.batchSize);\n },\n inject: [NodeConfig],\n },\n {\n provide: 'IBlockDispatcher',\n useFactory: (\n nodeConfig: NodeConfig,\n eventEmitter: EventEmitter2,\n projectService: ProjectService,\n apiService: EthereumApiService,\n indexerManager: IndexerManager,\n smartBatchService: SmartBatchService,\n storeService: StoreService,\n storeCacheService: StoreCacheService,\n poiService: PoiService,\n project: SubqueryProject,\n dynamicDsService: DynamicDsService,\n unfinalizedBlocks: UnfinalizedBlocksService,\n ) =>\n nodeConfig.workers !== undefined\n ? new WorkerBlockDispatcherService(\n nodeConfig,\n eventEmitter,\n projectService,\n smartBatchService,\n storeService,\n storeCacheService,\n poiService,\n project,\n dynamicDsService,\n unfinalizedBlocks,\n )\n : new BlockDispatcherService(\n apiService,\n nodeConfig,\n indexerManager,\n eventEmitter,\n projectService,\n smartBatchService,\n storeService,\n storeCacheService,\n poiService,\n project,\n dynamicDsService,\n ),\n inject: [\n NodeConfig,\n EventEmitter2,\n 'IProjectService',\n ApiService,\n IndexerManager,\n SmartBatchService,\n StoreService,\n StoreCacheService,\n PoiService,\n 'ISubqueryProject',\n DynamicDsService,\n UnfinalizedBlocksService,\n ],\n },\n FetchService,\n BenchmarkService,\n {\n provide: DictionaryService,\n useFactory: async (project: SubqueryProject, nodeConfig: NodeConfig) => {\n const dictionaryService = await DictionaryService.create(\n project,\n nodeConfig,\n );\n return dictionaryService;\n },\n inject: ['ISubqueryProject', NodeConfig],\n },\n SandboxService,\n DsProcessorService,\n DynamicDsService,\n PoiService,\n MmrService,\n PgMmrCacheService,\n {\n useClass: ProjectService,\n provide: 'IProjectService',\n },\n UnfinalizedBlocksService,\n ],\n exports: [StoreService, MmrService, StoreCacheService],\n})\nexport class FetchModule {}\n"]}
@@ -53,6 +53,7 @@ IndexerModule = __decorate([
53
53
  },
54
54
  node_core_1.PoiService,
55
55
  node_core_1.MmrService,
56
+ node_core_1.PgMmrCacheService,
56
57
  {
57
58
  provide: 'IProjectService',
58
59
  useClass: project_service_1.ProjectService,
@@ -1 +1 @@
1
- {"version":3,"file":"indexer.module.js","sourceRoot":"","sources":["../../src/indexer/indexer.module.ts"],"names":[],"mappings":";AAAA,gEAAgE;AAChE,sCAAsC;;;;;;;;;AAEtC,mDAA8C;AAC9C,2CAAwC;AACxC,yDAAsD;AACtD,gDAQ0B;AAE1B,0CAAiD;AAEjD,iEAA4D;AAC5D,6DAAwD;AACxD,uDAAmD;AACnD,uDAAmD;AACnD,uDAAmD;AACnD,2EAAuE;AACvE,4DAAwD;AACxD,gGAA2F;AAuDpF,IAAM,aAAa,GAAnB,MAAM,aAAa;CAAG,CAAA;AAAhB,aAAa;IArDzB,IAAA,eAAM,EAAC;QACN,SAAS,EAAE;YACT,gCAAc;YACd,6BAAiB;YACjB,wBAAY;YACZ,iCAAqB;YACrB;gBACE,OAAO,EAAE,sBAAU;gBACnB,UAAU,EAAE,KAAK,EACf,OAAwB,EACxB,qBAAmE,EACnE,YAA2B,EAC3B,EAAE;oBACF,MAAM,UAAU,GAAG,IAAI,6BAAkB,CACvC,OAAO,EACP,qBAAqB,EACrB,YAAY,CACb,CAAC;oBACF,MAAM,UAAU,CAAC,IAAI,EAAE,CAAC;oBACxB,OAAO,UAAU,CAAC;gBACpB,CAAC;gBACD,MAAM,EAAE,CAAC,kBAAkB,EAAE,iCAAqB,EAAE,6BAAa,CAAC;aACnE;YACD,gCAAc;YACd,yCAAkB;YAClB;gBACE,OAAO,EAAE,qCAAgB;gBACzB,UAAU,EAAE,GAAG,EAAE;oBACf,IAAI,6BAAY,EAAE;wBAChB,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;qBACjD;oBACD,OAAO,IAAI,kCAAsB,CAAE,MAAc,CAAC,IAAI,CAAC,CAAC;gBAC1D,CAAC;aACF;YACD,sBAAU;YACV,sBAAU;YACV;gBACE,OAAO,EAAE,iBAAiB;gBAC1B,QAAQ,EAAE,gCAAc;aACzB;YACD,8BAAa;YACb;gBACE,OAAO,EAAE,oDAAwB;gBACjC,UAAU,EAAE,GAAG,EAAE;oBACf,IAAI,6BAAY,EAAE;wBAChB,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;qBACjD;oBACD,OAAO,IAAI,iEAA8B,CAAE,MAAc,CAAC,IAAI,CAAC,CAAC;gBAClE,CAAC;aACF;SACF;QACD,OAAO,EAAE,CAAC,wBAAY,CAAC;KACxB,CAAC;GACW,aAAa,CAAG;AAAhB,sCAAa","sourcesContent":["// Copyright 2020-2022 OnFinality Limited authors & contributors\n// SPDX-License-Identifier: Apache-2.0\n\nimport { isMainThread } from 'worker_threads';\nimport { Module } from '@nestjs/common';\nimport { EventEmitter2 } from '@nestjs/event-emitter';\nimport {\n ApiService,\n StoreService,\n PoiService,\n MmrService,\n ConnectionPoolService,\n StoreCacheService,\n WorkerDynamicDsService,\n} from '@subql/node-core';\nimport { SubqueryProject } from '../configure/SubqueryProject';\nimport { EthereumApiService } from '../ethereum';\nimport { EthereumApiConnection } from '../ethereum/api.connection';\nimport { DsProcessorService } from './ds-processor.service';\nimport { DynamicDsService } from './dynamic-ds.service';\nimport { IndexerManager } from './indexer.manager';\nimport { ProjectService } from './project.service';\nimport { SandboxService } from './sandbox.service';\nimport { UnfinalizedBlocksService } from './unfinalizedBlocks.service';\nimport { WorkerService } from './worker/worker.service';\nimport { WorkerUnfinalizedBlocksService } from './worker/worker.unfinalizedBlocks.service';\n\n@Module({\n providers: [\n IndexerManager,\n StoreCacheService,\n StoreService,\n ConnectionPoolService,\n {\n provide: ApiService,\n useFactory: async (\n project: SubqueryProject,\n connectionPoolService: ConnectionPoolService<EthereumApiConnection>,\n eventEmitter: EventEmitter2,\n ) => {\n const apiService = new EthereumApiService(\n project,\n connectionPoolService,\n eventEmitter,\n );\n await apiService.init();\n return apiService;\n },\n inject: ['ISubqueryProject', ConnectionPoolService, EventEmitter2],\n },\n SandboxService,\n DsProcessorService,\n {\n provide: DynamicDsService,\n useFactory: () => {\n if (isMainThread) {\n throw new Error('Expected to be worker thread');\n }\n return new WorkerDynamicDsService((global as any).host);\n },\n },\n PoiService,\n MmrService,\n {\n provide: 'IProjectService',\n useClass: ProjectService,\n },\n WorkerService,\n {\n provide: UnfinalizedBlocksService,\n useFactory: () => {\n if (isMainThread) {\n throw new Error('Expected to be worker thread');\n }\n return new WorkerUnfinalizedBlocksService((global as any).host);\n },\n },\n ],\n exports: [StoreService],\n})\nexport class IndexerModule {}\n"]}
1
+ {"version":3,"file":"indexer.module.js","sourceRoot":"","sources":["../../src/indexer/indexer.module.ts"],"names":[],"mappings":";AAAA,gEAAgE;AAChE,sCAAsC;;;;;;;;;AAEtC,mDAA8C;AAC9C,2CAAwC;AACxC,yDAAsD;AACtD,gDAS0B;AAE1B,0CAAiD;AAEjD,iEAA4D;AAC5D,6DAAwD;AACxD,uDAAmD;AACnD,uDAAmD;AACnD,uDAAmD;AACnD,2EAAuE;AACvE,4DAAwD;AACxD,gGAA2F;AAwDpF,IAAM,aAAa,GAAnB,MAAM,aAAa;CAAG,CAAA;AAAhB,aAAa;IAtDzB,IAAA,eAAM,EAAC;QACN,SAAS,EAAE;YACT,gCAAc;YACd,6BAAiB;YACjB,wBAAY;YACZ,iCAAqB;YACrB;gBACE,OAAO,EAAE,sBAAU;gBACnB,UAAU,EAAE,KAAK,EACf,OAAwB,EACxB,qBAAmE,EACnE,YAA2B,EAC3B,EAAE;oBACF,MAAM,UAAU,GAAG,IAAI,6BAAkB,CACvC,OAAO,EACP,qBAAqB,EACrB,YAAY,CACb,CAAC;oBACF,MAAM,UAAU,CAAC,IAAI,EAAE,CAAC;oBACxB,OAAO,UAAU,CAAC;gBACpB,CAAC;gBACD,MAAM,EAAE,CAAC,kBAAkB,EAAE,iCAAqB,EAAE,6BAAa,CAAC;aACnE;YACD,gCAAc;YACd,yCAAkB;YAClB;gBACE,OAAO,EAAE,qCAAgB;gBACzB,UAAU,EAAE,GAAG,EAAE;oBACf,IAAI,6BAAY,EAAE;wBAChB,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;qBACjD;oBACD,OAAO,IAAI,kCAAsB,CAAE,MAAc,CAAC,IAAI,CAAC,CAAC;gBAC1D,CAAC;aACF;YACD,sBAAU;YACV,sBAAU;YACV,6BAAiB;YACjB;gBACE,OAAO,EAAE,iBAAiB;gBAC1B,QAAQ,EAAE,gCAAc;aACzB;YACD,8BAAa;YACb;gBACE,OAAO,EAAE,oDAAwB;gBACjC,UAAU,EAAE,GAAG,EAAE;oBACf,IAAI,6BAAY,EAAE;wBAChB,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;qBACjD;oBACD,OAAO,IAAI,iEAA8B,CAAE,MAAc,CAAC,IAAI,CAAC,CAAC;gBAClE,CAAC;aACF;SACF;QACD,OAAO,EAAE,CAAC,wBAAY,CAAC;KACxB,CAAC;GACW,aAAa,CAAG;AAAhB,sCAAa","sourcesContent":["// Copyright 2020-2022 OnFinality Limited authors & contributors\n// SPDX-License-Identifier: Apache-2.0\n\nimport { isMainThread } from 'worker_threads';\nimport { Module } from '@nestjs/common';\nimport { EventEmitter2 } from '@nestjs/event-emitter';\nimport {\n ApiService,\n StoreService,\n PoiService,\n MmrService,\n ConnectionPoolService,\n StoreCacheService,\n WorkerDynamicDsService,\n PgMmrCacheService,\n} from '@subql/node-core';\nimport { SubqueryProject } from '../configure/SubqueryProject';\nimport { EthereumApiService } from '../ethereum';\nimport { EthereumApiConnection } from '../ethereum/api.connection';\nimport { DsProcessorService } from './ds-processor.service';\nimport { DynamicDsService } from './dynamic-ds.service';\nimport { IndexerManager } from './indexer.manager';\nimport { ProjectService } from './project.service';\nimport { SandboxService } from './sandbox.service';\nimport { UnfinalizedBlocksService } from './unfinalizedBlocks.service';\nimport { WorkerService } from './worker/worker.service';\nimport { WorkerUnfinalizedBlocksService } from './worker/worker.unfinalizedBlocks.service';\n\n@Module({\n providers: [\n IndexerManager,\n StoreCacheService,\n StoreService,\n ConnectionPoolService,\n {\n provide: ApiService,\n useFactory: async (\n project: SubqueryProject,\n connectionPoolService: ConnectionPoolService<EthereumApiConnection>,\n eventEmitter: EventEmitter2,\n ) => {\n const apiService = new EthereumApiService(\n project,\n connectionPoolService,\n eventEmitter,\n );\n await apiService.init();\n return apiService;\n },\n inject: ['ISubqueryProject', ConnectionPoolService, EventEmitter2],\n },\n SandboxService,\n DsProcessorService,\n {\n provide: DynamicDsService,\n useFactory: () => {\n if (isMainThread) {\n throw new Error('Expected to be worker thread');\n }\n return new WorkerDynamicDsService((global as any).host);\n },\n },\n PoiService,\n MmrService,\n PgMmrCacheService,\n {\n provide: 'IProjectService',\n useClass: ProjectService,\n },\n WorkerService,\n {\n provide: UnfinalizedBlocksService,\n useFactory: () => {\n if (isMainThread) {\n throw new Error('Expected to be worker thread');\n }\n return new WorkerUnfinalizedBlocksService((global as any).host);\n },\n },\n ],\n exports: [StoreService],\n})\nexport class IndexerModule {}\n"]}
@@ -12,4 +12,5 @@ export declare class WorkerUnfinalizedBlocksService implements IUnfinalizedBlock
12
12
  init(reindex: (targetHeight: number) => Promise<void>): Promise<number>;
13
13
  resetUnfinalizedBlocks(): void;
14
14
  resetLastFinalizedVerifiedHeight(): void;
15
+ getMetadataUnfinalizedBlocks(): Promise<Header[]>;
15
16
  }
@@ -40,6 +40,10 @@ let WorkerUnfinalizedBlocksService = class WorkerUnfinalizedBlocksService {
40
40
  resetLastFinalizedVerifiedHeight() {
41
41
  throw new Error('This method should not be called from a worker');
42
42
  }
43
+ // eslint-disable-next-line @typescript-eslint/promise-function-async
44
+ getMetadataUnfinalizedBlocks() {
45
+ throw new Error('This method should not be called from a worker');
46
+ }
43
47
  };
44
48
  WorkerUnfinalizedBlocksService = __decorate([
45
49
  (0, common_1.Injectable)(),
@@ -1 +1 @@
1
- {"version":3,"file":"worker.unfinalizedBlocks.service.js","sourceRoot":"","sources":["../../../src/indexer/worker/worker.unfinalizedBlocks.service.ts"],"names":[],"mappings":";AAAA,gEAAgE;AAChE,sCAAsC;;;;;;;;;;;;AAEtC,2CAA4C;AAQ/B,QAAA,yBAAyB,GAAoC;IACxE,0BAA0B;CAC3B,CAAC;AAGK,IAAM,8BAA8B,GAApC,MAAM,8BAA8B;IAGzC,YAAoB,IAA2B;QAA3B,SAAI,GAAJ,IAAI,CAAuB;IAAG,CAAC;IAEnD,KAAK,CAAC,6BAA6B,CAAC,MAAc;QAChD,OAAO,IAAI,CAAC,IAAI,CAAC,wBAAwB,CAAC,MAAM,CAAC,CAAC;IACpD,CAAC;IAED,KAAK,CAAC,wBAAwB,CAAC,EAC7B,KAAK,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,UAAU,EAAE,EACtC,WAAW,GACE;QACb,OAAO,IAAI,CAAC,IAAI,CAAC,wBAAwB,CAAC;YACxC,SAAS;YACT,WAAW;YACX,UAAU;SACX,CAAC,CAAC;IACL,CAAC;IAED,qEAAqE;IACrE,IAAI,CAAC,OAAgD;QACnD,MAAM,IAAI,KAAK,CAAC,gDAAgD,CAAC,CAAC;IACpE,CAAC;IACD,sBAAsB;QACpB,MAAM,IAAI,KAAK,CAAC,gDAAgD,CAAC,CAAC;IACpE,CAAC;IACD,gCAAgC;QAC9B,MAAM,IAAI,KAAK,CAAC,gDAAgD,CAAC,CAAC;IACpE,CAAC;CACF,CAAA;AA9BY,8BAA8B;IAD1C,IAAA,mBAAU,GAAE;;GACA,8BAA8B,CA8B1C;AA9BY,wEAA8B","sourcesContent":["// Copyright 2020-2022 OnFinality Limited authors & contributors\n// SPDX-License-Identifier: Apache-2.0\n\nimport { Injectable } from '@nestjs/common';\nimport { Header, IUnfinalizedBlocksService } from '@subql/node-core';\nimport { BlockWrapper, EthereumBlock } from '@subql/types-ethereum';\n\nexport type HostUnfinalizedBlocks = {\n unfinalizedBlocksProcess: (header: Header) => Promise<number | null>;\n};\n\nexport const hostUnfinalizedBlocksKeys: (keyof HostUnfinalizedBlocks)[] = [\n 'unfinalizedBlocksProcess',\n];\n\n@Injectable()\nexport class WorkerUnfinalizedBlocksService\n implements IUnfinalizedBlocksService<BlockWrapper>\n{\n constructor(private host: HostUnfinalizedBlocks) {}\n\n async processUnfinalizedBlockHeader(header: Header): Promise<number | null> {\n return this.host.unfinalizedBlocksProcess(header);\n }\n\n async processUnfinalizedBlocks({\n block: { hash: blockHash, parentHash },\n blockHeight,\n }: BlockWrapper): Promise<number | null> {\n return this.host.unfinalizedBlocksProcess({\n blockHash,\n blockHeight,\n parentHash,\n });\n }\n\n // eslint-disable-next-line @typescript-eslint/promise-function-async\n init(reindex: (targetHeight: number) => Promise<void>): Promise<number> {\n throw new Error('This method should not be called from a worker');\n }\n resetUnfinalizedBlocks(): void {\n throw new Error('This method should not be called from a worker');\n }\n resetLastFinalizedVerifiedHeight(): void {\n throw new Error('This method should not be called from a worker');\n }\n}\n"]}
1
+ {"version":3,"file":"worker.unfinalizedBlocks.service.js","sourceRoot":"","sources":["../../../src/indexer/worker/worker.unfinalizedBlocks.service.ts"],"names":[],"mappings":";AAAA,gEAAgE;AAChE,sCAAsC;;;;;;;;;;;;AAEtC,2CAA4C;AAQ/B,QAAA,yBAAyB,GAAoC;IACxE,0BAA0B;CAC3B,CAAC;AAGK,IAAM,8BAA8B,GAApC,MAAM,8BAA8B;IAGzC,YAAoB,IAA2B;QAA3B,SAAI,GAAJ,IAAI,CAAuB;IAAG,CAAC;IAEnD,KAAK,CAAC,6BAA6B,CAAC,MAAc;QAChD,OAAO,IAAI,CAAC,IAAI,CAAC,wBAAwB,CAAC,MAAM,CAAC,CAAC;IACpD,CAAC;IAED,KAAK,CAAC,wBAAwB,CAAC,EAC7B,KAAK,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,UAAU,EAAE,EACtC,WAAW,GACE;QACb,OAAO,IAAI,CAAC,IAAI,CAAC,wBAAwB,CAAC;YACxC,SAAS;YACT,WAAW;YACX,UAAU;SACX,CAAC,CAAC;IACL,CAAC;IAED,qEAAqE;IACrE,IAAI,CAAC,OAAgD;QACnD,MAAM,IAAI,KAAK,CAAC,gDAAgD,CAAC,CAAC;IACpE,CAAC;IACD,sBAAsB;QACpB,MAAM,IAAI,KAAK,CAAC,gDAAgD,CAAC,CAAC;IACpE,CAAC;IACD,gCAAgC;QAC9B,MAAM,IAAI,KAAK,CAAC,gDAAgD,CAAC,CAAC;IACpE,CAAC;IACD,qEAAqE;IACrE,4BAA4B;QAC1B,MAAM,IAAI,KAAK,CAAC,gDAAgD,CAAC,CAAC;IACpE,CAAC;CACF,CAAA;AAlCY,8BAA8B;IAD1C,IAAA,mBAAU,GAAE;;GACA,8BAA8B,CAkC1C;AAlCY,wEAA8B","sourcesContent":["// Copyright 2020-2022 OnFinality Limited authors & contributors\n// SPDX-License-Identifier: Apache-2.0\n\nimport { Injectable } from '@nestjs/common';\nimport { Header, IUnfinalizedBlocksService } from '@subql/node-core';\nimport { BlockWrapper, EthereumBlock } from '@subql/types-ethereum';\n\nexport type HostUnfinalizedBlocks = {\n unfinalizedBlocksProcess: (header: Header) => Promise<number | null>;\n};\n\nexport const hostUnfinalizedBlocksKeys: (keyof HostUnfinalizedBlocks)[] = [\n 'unfinalizedBlocksProcess',\n];\n\n@Injectable()\nexport class WorkerUnfinalizedBlocksService\n implements IUnfinalizedBlocksService<BlockWrapper>\n{\n constructor(private host: HostUnfinalizedBlocks) {}\n\n async processUnfinalizedBlockHeader(header: Header): Promise<number | null> {\n return this.host.unfinalizedBlocksProcess(header);\n }\n\n async processUnfinalizedBlocks({\n block: { hash: blockHash, parentHash },\n blockHeight,\n }: BlockWrapper): Promise<number | null> {\n return this.host.unfinalizedBlocksProcess({\n blockHash,\n blockHeight,\n parentHash,\n });\n }\n\n // eslint-disable-next-line @typescript-eslint/promise-function-async\n init(reindex: (targetHeight: number) => Promise<void>): Promise<number> {\n throw new Error('This method should not be called from a worker');\n }\n resetUnfinalizedBlocks(): void {\n throw new Error('This method should not be called from a worker');\n }\n resetLastFinalizedVerifiedHeight(): void {\n throw new Error('This method should not be called from a worker');\n }\n // eslint-disable-next-line @typescript-eslint/promise-function-async\n getMetadataUnfinalizedBlocks(): Promise<Header[]> {\n throw new Error('This method should not be called from a worker');\n }\n}\n"]}
@@ -20,14 +20,8 @@ let MetaModule = class MetaModule {
20
20
  MetaModule = __decorate([
21
21
  (0, common_1.Module)({
22
22
  imports: [nestjs_prometheus_1.PrometheusModule.register(), fetch_module_1.FetchModule],
23
- controllers: [meta_controller_1.MetaController, node_core_1.HealthController, node_core_1.ReadyController],
24
- providers: [
25
- node_core_1.MetricEventListener,
26
- ...node_core_1.gaugeProviders,
27
- meta_service_1.MetaService,
28
- node_core_1.HealthService,
29
- node_core_1.ReadyService,
30
- ],
23
+ controllers: [...node_core_1.metaControllers, meta_controller_1.MetaController],
24
+ providers: [...node_core_1.metaServices, meta_service_1.MetaService],
31
25
  })
32
26
  ], MetaModule);
33
27
  exports.MetaModule = MetaModule;
@@ -1 +1 @@
1
- {"version":3,"file":"meta.module.js","sourceRoot":"","sources":["../../src/meta/meta.module.ts"],"names":[],"mappings":";AAAA,gEAAgE;AAChE,sCAAsC;;;;;;;;;AAEtC,2CAAwC;AACxC,gDAO0B;AAC1B,mEAA+D;AAC/D,0DAAsD;AACtD,uDAAmD;AACnD,iDAA6C;AAatC,IAAM,UAAU,GAAhB,MAAM,UAAU;CAAG,CAAA;AAAb,UAAU;IAXtB,IAAA,eAAM,EAAC;QACN,OAAO,EAAE,CAAC,oCAAgB,CAAC,QAAQ,EAAE,EAAE,0BAAW,CAAC;QACnD,WAAW,EAAE,CAAC,gCAAc,EAAE,4BAAgB,EAAE,2BAAe,CAAC;QAChE,SAAS,EAAE;YACT,+BAAmB;YACnB,GAAG,0BAAc;YACjB,0BAAW;YACX,yBAAa;YACb,wBAAY;SACb;KACF,CAAC;GACW,UAAU,CAAG;AAAb,gCAAU","sourcesContent":["// Copyright 2020-2022 OnFinality Limited authors & contributors\n// SPDX-License-Identifier: Apache-2.0\n\nimport { Module } from '@nestjs/common';\nimport {\n MetricEventListener,\n ReadyController,\n ReadyService,\n HealthController,\n HealthService,\n gaugeProviders,\n} from '@subql/node-core';\nimport { PrometheusModule } from '@willsoto/nestjs-prometheus';\nimport { FetchModule } from '../indexer/fetch.module';\nimport { MetaController } from './meta.controller';\nimport { MetaService } from './meta.service';\n\n@Module({\n imports: [PrometheusModule.register(), FetchModule],\n controllers: [MetaController, HealthController, ReadyController],\n providers: [\n MetricEventListener,\n ...gaugeProviders,\n MetaService,\n HealthService,\n ReadyService,\n ],\n})\nexport class MetaModule {}\n"]}
1
+ {"version":3,"file":"meta.module.js","sourceRoot":"","sources":["../../src/meta/meta.module.ts"],"names":[],"mappings":";AAAA,gEAAgE;AAChE,sCAAsC;;;;;;;;;AAEtC,2CAAwC;AACxC,gDAAiE;AACjE,mEAA+D;AAC/D,0DAAsD;AACtD,uDAAmD;AACnD,iDAA6C;AAOtC,IAAM,UAAU,GAAhB,MAAM,UAAU;CAAG,CAAA;AAAb,UAAU;IALtB,IAAA,eAAM,EAAC;QACN,OAAO,EAAE,CAAC,oCAAgB,CAAC,QAAQ,EAAE,EAAE,0BAAW,CAAC;QACnD,WAAW,EAAE,CAAC,GAAG,2BAAe,EAAE,gCAAc,CAAC;QACjD,SAAS,EAAE,CAAC,GAAG,wBAAY,EAAE,0BAAW,CAAC;KAC1C,CAAC;GACW,UAAU,CAAG;AAAb,gCAAU","sourcesContent":["// Copyright 2020-2022 OnFinality Limited authors & contributors\n// SPDX-License-Identifier: Apache-2.0\n\nimport { Module } from '@nestjs/common';\nimport { metaControllers, metaServices } from '@subql/node-core';\nimport { PrometheusModule } from '@willsoto/nestjs-prometheus';\nimport { FetchModule } from '../indexer/fetch.module';\nimport { MetaController } from './meta.controller';\nimport { MetaService } from './meta.service';\n\n@Module({\n imports: [PrometheusModule.register(), FetchModule],\n controllers: [...metaControllers, MetaController],\n providers: [...metaServices, MetaService],\n})\nexport class MetaModule {}\n"]}
@@ -1,4 +1,2 @@
1
- export declare class ForceCleanFeatureModule {
2
- }
3
1
  export declare class ForceCleanModule {
4
2
  }
@@ -8,20 +8,10 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
8
8
  return c > 3 && r && Object.defineProperty(target, key, r), r;
9
9
  };
10
10
  Object.defineProperty(exports, "__esModule", { value: true });
11
- exports.ForceCleanModule = exports.ForceCleanFeatureModule = void 0;
11
+ exports.ForceCleanModule = void 0;
12
12
  const common_1 = require("@nestjs/common");
13
- const schedule_1 = require("@nestjs/schedule");
14
13
  const node_core_1 = require("@subql/node-core");
15
14
  const configure_module_1 = require("../configure/configure.module");
16
- let ForceCleanFeatureModule = class ForceCleanFeatureModule {
17
- };
18
- ForceCleanFeatureModule = __decorate([
19
- (0, common_1.Module)({
20
- providers: [node_core_1.ForceCleanService, schedule_1.SchedulerRegistry],
21
- controllers: [],
22
- })
23
- ], ForceCleanFeatureModule);
24
- exports.ForceCleanFeatureModule = ForceCleanFeatureModule;
25
15
  let ForceCleanModule = class ForceCleanModule {
26
16
  };
27
17
  ForceCleanModule = __decorate([
@@ -29,7 +19,7 @@ ForceCleanModule = __decorate([
29
19
  imports: [
30
20
  node_core_1.DbModule.forRoot(),
31
21
  configure_module_1.ConfigureModule.register(),
32
- ForceCleanFeatureModule,
22
+ node_core_1.ForceCleanFeatureModule,
33
23
  ],
34
24
  controllers: [],
35
25
  })
@@ -1 +1 @@
1
- {"version":3,"file":"forceClean.module.js","sourceRoot":"","sources":["../../src/subcommands/forceClean.module.ts"],"names":[],"mappings":";AAAA,gEAAgE;AAChE,sCAAsC;;;;;;;;;AAEtC,2CAAwC;AACxC,+CAAqD;AACrD,gDAA+D;AAC/D,oEAAgE;AAMzD,IAAM,uBAAuB,GAA7B,MAAM,uBAAuB;CAAG,CAAA;AAA1B,uBAAuB;IAJnC,IAAA,eAAM,EAAC;QACN,SAAS,EAAE,CAAC,6BAAiB,EAAE,4BAAiB,CAAC;QACjD,WAAW,EAAE,EAAE;KAChB,CAAC;GACW,uBAAuB,CAAG;AAA1B,0DAAuB;AAU7B,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;CAAG,CAAA;AAAnB,gBAAgB;IAR5B,IAAA,eAAM,EAAC;QACN,OAAO,EAAE;YACP,oBAAQ,CAAC,OAAO,EAAE;YAClB,kCAAe,CAAC,QAAQ,EAAE;YAC1B,uBAAuB;SACxB;QACD,WAAW,EAAE,EAAE;KAChB,CAAC;GACW,gBAAgB,CAAG;AAAnB,4CAAgB","sourcesContent":["// Copyright 2020-2022 OnFinality Limited authors & contributors\n// SPDX-License-Identifier: Apache-2.0\n\nimport { Module } from '@nestjs/common';\nimport { SchedulerRegistry } from '@nestjs/schedule';\nimport { DbModule, ForceCleanService } from '@subql/node-core';\nimport { ConfigureModule } from '../configure/configure.module';\n\n@Module({\n providers: [ForceCleanService, SchedulerRegistry],\n controllers: [],\n})\nexport class ForceCleanFeatureModule {}\n\n@Module({\n imports: [\n DbModule.forRoot(),\n ConfigureModule.register(),\n ForceCleanFeatureModule,\n ],\n controllers: [],\n})\nexport class ForceCleanModule {}\n"]}
1
+ {"version":3,"file":"forceClean.module.js","sourceRoot":"","sources":["../../src/subcommands/forceClean.module.ts"],"names":[],"mappings":";AAAA,gEAAgE;AAChE,sCAAsC;;;;;;;;;AAEtC,2CAAwC;AACxC,gDAAqE;AACrE,oEAAgE;AAUzD,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;CAAG,CAAA;AAAnB,gBAAgB;IAR5B,IAAA,eAAM,EAAC;QACN,OAAO,EAAE;YACP,oBAAQ,CAAC,OAAO,EAAE;YAClB,kCAAe,CAAC,QAAQ,EAAE;YAC1B,mCAAuB;SACxB;QACD,WAAW,EAAE,EAAE;KAChB,CAAC;GACW,gBAAgB,CAAG;AAAnB,4CAAgB","sourcesContent":["// Copyright 2020-2022 OnFinality Limited authors & contributors\n// SPDX-License-Identifier: Apache-2.0\n\nimport { Module } from '@nestjs/common';\nimport { DbModule, ForceCleanFeatureModule } from '@subql/node-core';\nimport { ConfigureModule } from '../configure/configure.module';\n\n@Module({\n imports: [\n DbModule.forRoot(),\n ConfigureModule.register(),\n ForceCleanFeatureModule,\n ],\n controllers: [],\n})\nexport class ForceCleanModule {}\n"]}
@@ -1,4 +1,2 @@
1
- export declare class MMRMigrateFeatureModule {
2
- }
3
1
  export declare class MMRMigrateModule {
4
2
  }
@@ -8,30 +8,10 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
8
8
  return c > 3 && r && Object.defineProperty(target, key, r), r;
9
9
  };
10
10
  Object.defineProperty(exports, "__esModule", { value: true });
11
- exports.MMRMigrateModule = exports.MMRMigrateFeatureModule = void 0;
11
+ exports.MMRMigrateModule = void 0;
12
12
  const common_1 = require("@nestjs/common");
13
- const schedule_1 = require("@nestjs/schedule");
14
13
  const node_core_1 = require("@subql/node-core");
15
- const x_sequelize_1 = require("@subql/x-sequelize");
16
14
  const configure_module_1 = require("../configure/configure.module");
17
- let MMRMigrateFeatureModule = class MMRMigrateFeatureModule {
18
- };
19
- MMRMigrateFeatureModule = __decorate([
20
- (0, common_1.Module)({
21
- providers: [
22
- schedule_1.SchedulerRegistry,
23
- {
24
- provide: node_core_1.MMRMigrateService,
25
- useFactory: (config, sequelize) => {
26
- return new node_core_1.MMRMigrateService(config, sequelize);
27
- },
28
- inject: [node_core_1.NodeConfig, x_sequelize_1.Sequelize],
29
- },
30
- ],
31
- controllers: [],
32
- })
33
- ], MMRMigrateFeatureModule);
34
- exports.MMRMigrateFeatureModule = MMRMigrateFeatureModule;
35
15
  let MMRMigrateModule = class MMRMigrateModule {
36
16
  };
37
17
  MMRMigrateModule = __decorate([
@@ -39,7 +19,7 @@ MMRMigrateModule = __decorate([
39
19
  imports: [
40
20
  node_core_1.DbModule.forRoot(),
41
21
  configure_module_1.ConfigureModule.register(),
42
- MMRMigrateFeatureModule,
22
+ node_core_1.MMRMigrateFeatureModule,
43
23
  ],
44
24
  controllers: [],
45
25
  })
@@ -1 +1 @@
1
- {"version":3,"file":"mmrMigrate.module.js","sourceRoot":"","sources":["../../src/subcommands/mmrMigrate.module.ts"],"names":[],"mappings":";AAAA,gEAAgE;AAChE,sCAAsC;;;;;;;;;AAEtC,2CAAwC;AACxC,+CAAqD;AACrD,gDAA2E;AAC3E,oDAA+C;AAC/C,oEAAgE;AAezD,IAAM,uBAAuB,GAA7B,MAAM,uBAAuB;CAAG,CAAA;AAA1B,uBAAuB;IAbnC,IAAA,eAAM,EAAC;QACN,SAAS,EAAE;YACT,4BAAiB;YACjB;gBACE,OAAO,EAAE,6BAAiB;gBAC1B,UAAU,EAAE,CAAC,MAAkB,EAAE,SAAoB,EAAE,EAAE;oBACvD,OAAO,IAAI,6BAAiB,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;gBAClD,CAAC;gBACD,MAAM,EAAE,CAAC,sBAAU,EAAE,uBAAS,CAAC;aAChC;SACF;QACD,WAAW,EAAE,EAAE;KAChB,CAAC;GACW,uBAAuB,CAAG;AAA1B,0DAAuB;AAU7B,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;CAAG,CAAA;AAAnB,gBAAgB;IAR5B,IAAA,eAAM,EAAC;QACN,OAAO,EAAE;YACP,oBAAQ,CAAC,OAAO,EAAE;YAClB,kCAAe,CAAC,QAAQ,EAAE;YAC1B,uBAAuB;SACxB;QACD,WAAW,EAAE,EAAE;KAChB,CAAC;GACW,gBAAgB,CAAG;AAAnB,4CAAgB","sourcesContent":["// Copyright 2020-2022 OnFinality Limited authors & contributors\n// SPDX-License-Identifier: Apache-2.0\n\nimport { Module } from '@nestjs/common';\nimport { SchedulerRegistry } from '@nestjs/schedule';\nimport { DbModule, NodeConfig, MMRMigrateService } from '@subql/node-core';\nimport { Sequelize } from '@subql/x-sequelize';\nimport { ConfigureModule } from '../configure/configure.module';\n\n@Module({\n providers: [\n SchedulerRegistry,\n {\n provide: MMRMigrateService,\n useFactory: (config: NodeConfig, sequelize: Sequelize) => {\n return new MMRMigrateService(config, sequelize);\n },\n inject: [NodeConfig, Sequelize],\n },\n ],\n controllers: [],\n})\nexport class MMRMigrateFeatureModule {}\n\n@Module({\n imports: [\n DbModule.forRoot(),\n ConfigureModule.register(),\n MMRMigrateFeatureModule,\n ],\n controllers: [],\n})\nexport class MMRMigrateModule {}\n"]}
1
+ {"version":3,"file":"mmrMigrate.module.js","sourceRoot":"","sources":["../../src/subcommands/mmrMigrate.module.ts"],"names":[],"mappings":";AAAA,gEAAgE;AAChE,sCAAsC;;;;;;;;;AAEtC,2CAAwC;AACxC,gDAAqE;AACrE,oEAAgE;AAUzD,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;CAAG,CAAA;AAAnB,gBAAgB;IAR5B,IAAA,eAAM,EAAC;QACN,OAAO,EAAE;YACP,oBAAQ,CAAC,OAAO,EAAE;YAClB,kCAAe,CAAC,QAAQ,EAAE;YAC1B,mCAAuB;SACxB;QACD,WAAW,EAAE,EAAE;KAChB,CAAC;GACW,gBAAgB,CAAG;AAAnB,4CAAgB","sourcesContent":["// Copyright 2020-2022 OnFinality Limited authors & contributors\n// SPDX-License-Identifier: Apache-2.0\n\nimport { Module } from '@nestjs/common';\nimport { DbModule, MMRMigrateFeatureModule } from '@subql/node-core';\nimport { ConfigureModule } from '../configure/configure.module';\n\n@Module({\n imports: [\n DbModule.forRoot(),\n ConfigureModule.register(),\n MMRMigrateFeatureModule,\n ],\n controllers: [],\n})\nexport class MMRMigrateModule {}\n"]}
@@ -1,4 +1,2 @@
1
- export declare class MmrRegenerateFeatureModule {
2
- }
3
1
  export declare class MmrRegenerateModule {
4
2
  }
@@ -8,27 +8,11 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
8
8
  return c > 3 && r && Object.defineProperty(target, key, r), r;
9
9
  };
10
10
  Object.defineProperty(exports, "__esModule", { value: true });
11
- exports.MmrRegenerateModule = exports.MmrRegenerateFeatureModule = void 0;
11
+ exports.MmrRegenerateModule = void 0;
12
12
  const common_1 = require("@nestjs/common");
13
13
  const event_emitter_1 = require("@nestjs/event-emitter");
14
- const schedule_1 = require("@nestjs/schedule");
15
14
  const node_core_1 = require("@subql/node-core");
16
15
  const configure_module_1 = require("../configure/configure.module");
17
- let MmrRegenerateFeatureModule = class MmrRegenerateFeatureModule {
18
- };
19
- MmrRegenerateFeatureModule = __decorate([
20
- (0, common_1.Module)({
21
- providers: [
22
- node_core_1.StoreCacheService,
23
- node_core_1.StoreService,
24
- node_core_1.MmrService,
25
- node_core_1.MmrRegenerateService,
26
- schedule_1.SchedulerRegistry,
27
- ],
28
- controllers: [],
29
- })
30
- ], MmrRegenerateFeatureModule);
31
- exports.MmrRegenerateFeatureModule = MmrRegenerateFeatureModule;
32
16
  let MmrRegenerateModule = class MmrRegenerateModule {
33
17
  };
34
18
  MmrRegenerateModule = __decorate([
@@ -36,7 +20,7 @@ MmrRegenerateModule = __decorate([
36
20
  imports: [
37
21
  node_core_1.DbModule.forRoot(),
38
22
  configure_module_1.ConfigureModule.register(),
39
- MmrRegenerateFeatureModule,
23
+ node_core_1.MmrRegenerateFeatureModule,
40
24
  event_emitter_1.EventEmitterModule.forRoot(),
41
25
  ],
42
26
  controllers: [],
@@ -1 +1 @@
1
- {"version":3,"file":"mmrRegenerate.module.js","sourceRoot":"","sources":["../../src/subcommands/mmrRegenerate.module.ts"],"names":[],"mappings":";AAAA,gEAAgE;AAChE,sCAAsC;;;;;;;;;AAEtC,2CAAwC;AACxC,yDAA2D;AAC3D,+CAAqD;AACrD,gDAM0B;AAC1B,oEAAgE;AAYzD,IAAM,0BAA0B,GAAhC,MAAM,0BAA0B;CAAG,CAAA;AAA7B,0BAA0B;IAVtC,IAAA,eAAM,EAAC;QACN,SAAS,EAAE;YACT,6BAAiB;YACjB,wBAAY;YACZ,sBAAU;YACV,gCAAoB;YACpB,4BAAiB;SAClB;QACD,WAAW,EAAE,EAAE;KAChB,CAAC;GACW,0BAA0B,CAAG;AAA7B,gEAA0B;AAWhC,IAAM,mBAAmB,GAAzB,MAAM,mBAAmB;CAAG,CAAA;AAAtB,mBAAmB;IAT/B,IAAA,eAAM,EAAC;QACN,OAAO,EAAE;YACP,oBAAQ,CAAC,OAAO,EAAE;YAClB,kCAAe,CAAC,QAAQ,EAAE;YAC1B,0BAA0B;YAC1B,kCAAkB,CAAC,OAAO,EAAE;SAC7B;QACD,WAAW,EAAE,EAAE;KAChB,CAAC;GACW,mBAAmB,CAAG;AAAtB,kDAAmB","sourcesContent":["// Copyright 2020-2022 OnFinality Limited authors & contributors\n// SPDX-License-Identifier: Apache-2.0\n\nimport { Module } from '@nestjs/common';\nimport { EventEmitterModule } from '@nestjs/event-emitter';\nimport { SchedulerRegistry } from '@nestjs/schedule';\nimport {\n DbModule,\n MmrService,\n StoreCacheService,\n StoreService,\n MmrRegenerateService,\n} from '@subql/node-core';\nimport { ConfigureModule } from '../configure/configure.module';\n\n@Module({\n providers: [\n StoreCacheService,\n StoreService,\n MmrService,\n MmrRegenerateService,\n SchedulerRegistry,\n ],\n controllers: [],\n})\nexport class MmrRegenerateFeatureModule {}\n\n@Module({\n imports: [\n DbModule.forRoot(),\n ConfigureModule.register(),\n MmrRegenerateFeatureModule,\n EventEmitterModule.forRoot(),\n ],\n controllers: [],\n})\nexport class MmrRegenerateModule {}\n"]}
1
+ {"version":3,"file":"mmrRegenerate.module.js","sourceRoot":"","sources":["../../src/subcommands/mmrRegenerate.module.ts"],"names":[],"mappings":";AAAA,gEAAgE;AAChE,sCAAsC;;;;;;;;;AAEtC,2CAAwC;AACxC,yDAA2D;AAC3D,gDAAwE;AACxE,oEAAgE;AAWzD,IAAM,mBAAmB,GAAzB,MAAM,mBAAmB;CAAG,CAAA;AAAtB,mBAAmB;IAT/B,IAAA,eAAM,EAAC;QACN,OAAO,EAAE;YACP,oBAAQ,CAAC,OAAO,EAAE;YAClB,kCAAe,CAAC,QAAQ,EAAE;YAC1B,sCAA0B;YAC1B,kCAAkB,CAAC,OAAO,EAAE;SAC7B;QACD,WAAW,EAAE,EAAE;KAChB,CAAC;GACW,mBAAmB,CAAG;AAAtB,kDAAmB","sourcesContent":["// Copyright 2020-2022 OnFinality Limited authors & contributors\n// SPDX-License-Identifier: Apache-2.0\n\nimport { Module } from '@nestjs/common';\nimport { EventEmitterModule } from '@nestjs/event-emitter';\nimport { DbModule, MmrRegenerateFeatureModule } from '@subql/node-core';\nimport { ConfigureModule } from '../configure/configure.module';\n\n@Module({\n imports: [\n DbModule.forRoot(),\n ConfigureModule.register(),\n MmrRegenerateFeatureModule,\n EventEmitterModule.forRoot(),\n ],\n controllers: [],\n})\nexport class MmrRegenerateModule {}\n"]}
@@ -27,6 +27,7 @@ ReindexFeatureModule = __decorate([
27
27
  node_core_1.StoreService,
28
28
  reindex_service_1.ReindexService,
29
29
  node_core_1.MmrService,
30
+ node_core_1.PgMmrCacheService,
30
31
  node_core_1.ForceCleanService,
31
32
  unfinalizedBlocks_service_1.UnfinalizedBlocksService,
32
33
  dynamic_ds_service_1.DynamicDsService,
@@ -1 +1 @@
1
- {"version":3,"file":"reindex.module.js","sourceRoot":"","sources":["../../src/subcommands/reindex.module.ts"],"names":[],"mappings":";AAAA,gEAAgE;AAChE,sCAAsC;;;;;;;;;AAEtC,2CAAwC;AACxC,yDAA2D;AAC3D,+CAAqD;AACrD,gDAO0B;AAC1B,oEAAgE;AAChE,0EAAqE;AACrE,sEAAiE;AACjE,oFAAgF;AAChF,uDAAmD;AAqB5C,IAAM,oBAAoB,GAA1B,MAAM,oBAAoB;CAAG,CAAA;AAAvB,oBAAoB;IAnBhC,IAAA,eAAM,EAAC;QACN,SAAS,EAAE;YACT,6BAAiB;YACjB,wBAAY;YACZ,gCAAc;YACd,sBAAU;YACV,6BAAiB;YACjB,oDAAwB;YACxB,qCAAgB;YAChB,yCAAkB;YAClB;gBACE,8EAA8E;gBAC9E,OAAO,EAAE,sBAAU;gBACnB,UAAU,EAAE,GAAG,EAAE,CAAC,SAAS;aAC5B;YACD,4BAAiB;SAClB;QACD,WAAW,EAAE,EAAE;KAChB,CAAC;GACW,oBAAoB,CAAG;AAAvB,oDAAoB;AAW1B,IAAM,aAAa,GAAnB,MAAM,aAAa;CAAG,CAAA;AAAhB,aAAa;IATzB,IAAA,eAAM,EAAC;QACN,OAAO,EAAE;YACP,oBAAQ,CAAC,OAAO,EAAE;YAClB,kCAAe,CAAC,QAAQ,EAAE;YAC1B,oBAAoB;YACpB,kCAAkB,CAAC,OAAO,EAAE;SAC7B;QACD,WAAW,EAAE,EAAE;KAChB,CAAC;GACW,aAAa,CAAG;AAAhB,sCAAa","sourcesContent":["// Copyright 2020-2022 OnFinality Limited authors & contributors\n// SPDX-License-Identifier: Apache-2.0\n\nimport { Module } from '@nestjs/common';\nimport { EventEmitterModule } from '@nestjs/event-emitter';\nimport { SchedulerRegistry } from '@nestjs/schedule';\nimport {\n ApiService,\n DbModule,\n ForceCleanService,\n MmrService,\n StoreCacheService,\n StoreService,\n} from '@subql/node-core';\nimport { ConfigureModule } from '../configure/configure.module';\nimport { DsProcessorService } from '../indexer/ds-processor.service';\nimport { DynamicDsService } from '../indexer/dynamic-ds.service';\nimport { UnfinalizedBlocksService } from '../indexer/unfinalizedBlocks.service';\nimport { ReindexService } from './reindex.service';\n\n@Module({\n providers: [\n StoreCacheService,\n StoreService,\n ReindexService,\n MmrService,\n ForceCleanService,\n UnfinalizedBlocksService,\n DynamicDsService,\n DsProcessorService,\n {\n // Used to work with DI for unfinalizedBlocksService but not used with reindex\n provide: ApiService,\n useFactory: () => undefined,\n },\n SchedulerRegistry,\n ],\n controllers: [],\n})\nexport class ReindexFeatureModule {}\n\n@Module({\n imports: [\n DbModule.forRoot(),\n ConfigureModule.register(),\n ReindexFeatureModule,\n EventEmitterModule.forRoot(),\n ],\n controllers: [],\n})\nexport class ReindexModule {}\n"]}
1
+ {"version":3,"file":"reindex.module.js","sourceRoot":"","sources":["../../src/subcommands/reindex.module.ts"],"names":[],"mappings":";AAAA,gEAAgE;AAChE,sCAAsC;;;;;;;;;AAEtC,2CAAwC;AACxC,yDAA2D;AAC3D,+CAAqD;AACrD,gDAQ0B;AAC1B,oEAAgE;AAChE,0EAAqE;AACrE,sEAAiE;AACjE,oFAAgF;AAChF,uDAAmD;AAsB5C,IAAM,oBAAoB,GAA1B,MAAM,oBAAoB;CAAG,CAAA;AAAvB,oBAAoB;IApBhC,IAAA,eAAM,EAAC;QACN,SAAS,EAAE;YACT,6BAAiB;YACjB,wBAAY;YACZ,gCAAc;YACd,sBAAU;YACV,6BAAiB;YACjB,6BAAiB;YACjB,oDAAwB;YACxB,qCAAgB;YAChB,yCAAkB;YAClB;gBACE,8EAA8E;gBAC9E,OAAO,EAAE,sBAAU;gBACnB,UAAU,EAAE,GAAG,EAAE,CAAC,SAAS;aAC5B;YACD,4BAAiB;SAClB;QACD,WAAW,EAAE,EAAE;KAChB,CAAC;GACW,oBAAoB,CAAG;AAAvB,oDAAoB;AAW1B,IAAM,aAAa,GAAnB,MAAM,aAAa;CAAG,CAAA;AAAhB,aAAa;IATzB,IAAA,eAAM,EAAC;QACN,OAAO,EAAE;YACP,oBAAQ,CAAC,OAAO,EAAE;YAClB,kCAAe,CAAC,QAAQ,EAAE;YAC1B,oBAAoB;YACpB,kCAAkB,CAAC,OAAO,EAAE;SAC7B;QACD,WAAW,EAAE,EAAE;KAChB,CAAC;GACW,aAAa,CAAG;AAAhB,sCAAa","sourcesContent":["// Copyright 2020-2022 OnFinality Limited authors & contributors\n// SPDX-License-Identifier: Apache-2.0\n\nimport { Module } from '@nestjs/common';\nimport { EventEmitterModule } from '@nestjs/event-emitter';\nimport { SchedulerRegistry } from '@nestjs/schedule';\nimport {\n ApiService,\n DbModule,\n ForceCleanService,\n MmrService,\n PgMmrCacheService,\n StoreCacheService,\n StoreService,\n} from '@subql/node-core';\nimport { ConfigureModule } from '../configure/configure.module';\nimport { DsProcessorService } from '../indexer/ds-processor.service';\nimport { DynamicDsService } from '../indexer/dynamic-ds.service';\nimport { UnfinalizedBlocksService } from '../indexer/unfinalizedBlocks.service';\nimport { ReindexService } from './reindex.service';\n\n@Module({\n providers: [\n StoreCacheService,\n StoreService,\n ReindexService,\n MmrService,\n PgMmrCacheService,\n ForceCleanService,\n UnfinalizedBlocksService,\n DynamicDsService,\n DsProcessorService,\n {\n // Used to work with DI for unfinalizedBlocksService but not used with reindex\n provide: ApiService,\n useFactory: () => undefined,\n },\n SchedulerRegistry,\n ],\n controllers: [],\n})\nexport class ReindexFeatureModule {}\n\n@Module({\n imports: [\n DbModule.forRoot(),\n ConfigureModule.register(),\n ReindexFeatureModule,\n EventEmitterModule.forRoot(),\n ],\n controllers: [],\n})\nexport class ReindexModule {}\n"]}
@@ -1,27 +1,11 @@
1
- import { MmrService, NodeConfig, StoreService, ForceCleanService } from '@subql/node-core';
1
+ import { SubqlEthereumDataSource } from '@subql/common-ethereum';
2
+ import { MmrService, NodeConfig, StoreService, ForceCleanService, BaseReindexService } from '@subql/node-core';
3
+ import { BlockWrapper } from '@subql/types-ethereum';
2
4
  import { Sequelize } from '@subql/x-sequelize';
3
5
  import { SubqueryProject } from '../configure/SubqueryProject';
4
6
  import { DynamicDsService } from '../indexer/dynamic-ds.service';
5
7
  import { UnfinalizedBlocksService } from '../indexer/unfinalizedBlocks.service';
6
- export declare class ReindexService {
7
- private readonly sequelize;
8
- private readonly nodeConfig;
9
- private readonly storeService;
10
- private readonly mmrService;
11
- private readonly project;
12
- private readonly forceCleanService;
13
- private readonly unfinalizedBlocksService;
14
- private readonly dynamicDsService;
15
- private schema;
16
- private metadataRepo;
8
+ export declare class ReindexService extends BaseReindexService<SubqueryProject, SubqlEthereumDataSource, BlockWrapper> {
17
9
  constructor(sequelize: Sequelize, nodeConfig: NodeConfig, storeService: StoreService, mmrService: MmrService, project: SubqueryProject, forceCleanService: ForceCleanService, unfinalizedBlocksService: UnfinalizedBlocksService, dynamicDsService: DynamicDsService);
18
- init(): Promise<void>;
19
- getTargetHeightWithUnfinalizedBlocks(inputHeight: number): Promise<number>;
20
- private getExistingProjectSchema;
21
- private getLastProcessedHeight;
22
- private getMetadataBlockOffset;
23
- private getMetadataSpecName;
24
- private initDbSchema;
25
- private getStartBlockFromDataSources;
26
- reindex(targetBlockHeight: number): Promise<void>;
10
+ protected getStartBlockDatasources(): Promise<SubqlEthereumDataSource[]>;
27
11
  }
@@ -21,70 +21,13 @@ const x_sequelize_1 = require("@subql/x-sequelize");
21
21
  const SubqueryProject_1 = require("../configure/SubqueryProject");
22
22
  const dynamic_ds_service_1 = require("../indexer/dynamic-ds.service");
23
23
  const unfinalizedBlocks_service_1 = require("../indexer/unfinalizedBlocks.service");
24
- const logger = (0, node_core_1.getLogger)('Reindex');
25
- let ReindexService = class ReindexService {
24
+ let ReindexService = class ReindexService extends node_core_1.BaseReindexService {
26
25
  constructor(sequelize, nodeConfig, storeService, mmrService, project, forceCleanService, unfinalizedBlocksService, dynamicDsService) {
27
- this.sequelize = sequelize;
28
- this.nodeConfig = nodeConfig;
29
- this.storeService = storeService;
30
- this.mmrService = mmrService;
31
- this.project = project;
32
- this.forceCleanService = forceCleanService;
33
- this.unfinalizedBlocksService = unfinalizedBlocksService;
34
- this.dynamicDsService = dynamicDsService;
26
+ super(sequelize, nodeConfig, storeService, mmrService, project, forceCleanService, unfinalizedBlocksService, dynamicDsService);
35
27
  }
36
- async init() {
37
- this.schema = await this.getExistingProjectSchema();
38
- if (!this.schema) {
39
- logger.error('Unable to locate schema');
40
- throw new Error('Schema does not exist.');
41
- }
42
- await this.initDbSchema();
43
- this.metadataRepo = this.storeService.storeCache.metadata;
44
- this.dynamicDsService.init(this.metadataRepo);
45
- }
46
- async getTargetHeightWithUnfinalizedBlocks(inputHeight) {
47
- const unfinalizedBlocks = await this.unfinalizedBlocksService.getMetadataUnfinalizedBlocks();
48
- const bestBlocks = unfinalizedBlocks.filter(({ blockHeight }) => blockHeight <= inputHeight);
49
- if (bestBlocks.length === 0) {
50
- return inputHeight;
51
- }
52
- const { blockHeight: firstBestBlock } = bestBlocks[0];
53
- return Math.min(inputHeight, firstBestBlock);
54
- }
55
- async getExistingProjectSchema() {
56
- return (0, node_core_1.getExistingProjectSchema)(this.nodeConfig, this.sequelize);
57
- }
58
- async getLastProcessedHeight() {
59
- return this.metadataRepo.find('lastProcessedHeight');
60
- }
61
- async getMetadataBlockOffset() {
62
- return this.metadataRepo.find('blockOffset');
63
- }
64
- async getMetadataSpecName() {
65
- return this.metadataRepo.find('specName');
66
- }
67
- async initDbSchema() {
68
- await (0, node_core_1.initDbSchema)(this.project, this.schema, this.storeService);
69
- }
70
- getStartBlockFromDataSources() {
71
- const datasources = this.project.dataSources;
72
- const startBlocksList = datasources.map((item) => { var _a; return (_a = item.startBlock) !== null && _a !== void 0 ? _a : 1; });
73
- if (startBlocksList.length === 0) {
74
- logger.error(`Failed to find a valid datasource, Please check your endpoint if specName filter is used.`);
75
- process.exit(1);
76
- }
77
- else {
78
- return Math.min(...startBlocksList);
79
- }
80
- }
81
- async reindex(targetBlockHeight) {
82
- const [startHeight, lastProcessedHeight] = await Promise.all([
83
- this.getStartBlockFromDataSources(),
84
- this.getLastProcessedHeight(),
85
- ]);
86
- await (0, node_core_1.reindex)(startHeight, await this.getMetadataBlockOffset(), targetBlockHeight, lastProcessedHeight, this.storeService, this.unfinalizedBlocksService, this.dynamicDsService, this.mmrService, this.sequelize, this.forceCleanService);
87
- await this.storeService.storeCache.flushCache(true, true);
28
+ // eslint-disable-next-line @typescript-eslint/require-await
29
+ async getStartBlockDatasources() {
30
+ return this.project.dataSources;
88
31
  }
89
32
  };
90
33
  ReindexService = __decorate([
@@ -1 +1 @@
1
- {"version":3,"file":"reindex.service.js","sourceRoot":"","sources":["../../src/subcommands/reindex.service.ts"],"names":[],"mappings":"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","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 initDbSchema,\n ForceCleanService,\n reindex,\n} from '@subql/node-core';\nimport { Sequelize } from '@subql/x-sequelize';\nimport { SubqueryProject } from '../configure/SubqueryProject';\nimport { DynamicDsService } from '../indexer/dynamic-ds.service';\nimport { UnfinalizedBlocksService } from '../indexer/unfinalizedBlocks.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 const unfinalizedBlocks =\n await this.unfinalizedBlocksService.getMetadataUnfinalizedBlocks();\n const bestBlocks = unfinalizedBlocks.filter(\n ({ blockHeight }) => blockHeight <= inputHeight,\n );\n if (bestBlocks.length === 0) {\n return inputHeight;\n }\n const { blockHeight: 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\n await this.storeService.storeCache.flushCache(true, true);\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;AAEpD,gDAM0B;AAE1B,oDAA+C;AAC/C,kEAA+D;AAC/D,sEAAiE;AACjE,oFAAgF;AAGzE,IAAM,cAAc,GAApB,MAAM,cAAe,SAAQ,8BAInC;IACC,YACE,SAAoB,EACpB,UAAsB,EACtB,YAA0B,EAC1B,UAAsB,EACM,OAAwB,EACpD,iBAAoC,EACpC,wBAAkD,EAClD,gBAAkC;QAElC,KAAK,CACH,SAAS,EACT,UAAU,EACV,YAAY,EACZ,UAAU,EACV,OAAO,EACP,iBAAiB,EACjB,wBAAwB,EACxB,gBAAgB,CACjB,CAAC;IACJ,CAAC;IAED,4DAA4D;IAClD,KAAK,CAAC,wBAAwB;QAGtC,OAAO,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC;IAClC,CAAC;CACF,CAAA;AAjCY,cAAc;IAD1B,IAAA,mBAAU,GAAE;IAWR,WAAA,IAAA,eAAM,EAAC,kBAAkB,CAAC,CAAA;qCAJhB,uBAAS;QACR,sBAAU;QACR,wBAAY;QACd,sBAAU;QACe,iCAAe;QACjC,6BAAiB;QACV,oDAAwB;QAChC,qCAAgB;GAbzB,cAAc,CAiC1B;AAjCY,wCAAc","sourcesContent":["// Copyright 2020-2022 OnFinality Limited authors & contributors\n// SPDX-License-Identifier: Apache-2.0\n\nimport { Inject, Injectable } from '@nestjs/common';\nimport { SubqlEthereumDataSource } from '@subql/common-ethereum';\nimport {\n MmrService,\n NodeConfig,\n StoreService,\n ForceCleanService,\n BaseReindexService,\n} from '@subql/node-core';\nimport { BlockWrapper } from '@subql/types-ethereum';\nimport { Sequelize } from '@subql/x-sequelize';\nimport { SubqueryProject } from '../configure/SubqueryProject';\nimport { DynamicDsService } from '../indexer/dynamic-ds.service';\nimport { UnfinalizedBlocksService } from '../indexer/unfinalizedBlocks.service';\n\n@Injectable()\nexport class ReindexService extends BaseReindexService<\n SubqueryProject,\n SubqlEthereumDataSource,\n BlockWrapper\n> {\n constructor(\n sequelize: Sequelize,\n nodeConfig: NodeConfig,\n storeService: StoreService,\n mmrService: MmrService,\n @Inject('ISubqueryProject') project: SubqueryProject,\n forceCleanService: ForceCleanService,\n unfinalizedBlocksService: UnfinalizedBlocksService,\n dynamicDsService: DynamicDsService,\n ) {\n super(\n sequelize,\n nodeConfig,\n storeService,\n mmrService,\n project,\n forceCleanService,\n unfinalizedBlocksService,\n dynamicDsService,\n );\n }\n\n // eslint-disable-next-line @typescript-eslint/require-await\n protected async getStartBlockDatasources(): Promise<\n SubqlEthereumDataSource[]\n > {\n return this.project.dataSources;\n }\n}\n"]}
package/dist/yargs.d.ts CHANGED
@@ -108,7 +108,6 @@ export declare const yargsOptions: import("yargs").Argv<import("yargs").Omit<imp
108
108
  demandOption: false;
109
109
  describe: string;
110
110
  type: "string";
111
- default: boolean;
112
111
  };
113
112
  'dictionary-timeout': {
114
113
  demandOption: false;
package/dist/yargs.js CHANGED
@@ -83,7 +83,7 @@ exports.yargsOptions = (0, yargs_1.default)((0, helpers_1.hideBin)(process.argv)
83
83
  describe: 'When regenerate MMR store in either a file or a postgres DB',
84
84
  type: 'string',
85
85
  choices: ['file', 'postgres'],
86
- default: 'file',
86
+ default: 'postgres',
87
87
  },
88
88
  'mmr-path': {
89
89
  alias: 'm',
@@ -183,7 +183,6 @@ exports.yargsOptions = (0, yargs_1.default)((0, helpers_1.hideBin)(process.argv)
183
183
  demandOption: false,
184
184
  describe: 'Use SubQuery Network dictionary resolver',
185
185
  type: 'string',
186
- default: false,
187
186
  },
188
187
  'dictionary-timeout': {
189
188
  demandOption: false,
@@ -265,7 +264,7 @@ exports.yargsOptions = (0, yargs_1.default)((0, helpers_1.hideBin)(process.argv)
265
264
  describe: 'Store MMR in either a file or a postgres DB',
266
265
  type: 'string',
267
266
  choices: ['file', 'postgres'],
268
- default: 'file',
267
+ default: 'postgres',
269
268
  },
270
269
  'query-limit': {
271
270
  demandOption: false,