@subql/node-ethereum 0.4.1-storeCache-0.0.6 → 1.0.1-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.
- package/CHANGELOG.md +3 -1
- package/dist/.tsbuildinfo +1 -1
- package/dist/app.module.js.map +1 -1
- package/dist/configure/SubqueryProject.d.ts +1 -1
- package/dist/configure/SubqueryProject.js +3 -0
- package/dist/configure/SubqueryProject.js.map +1 -1
- package/dist/configure/configure.module.js +2 -2
- package/dist/configure/configure.module.js.map +1 -1
- package/dist/ethereum/api.connection.d.ts +11 -0
- package/dist/ethereum/api.connection.js +27 -0
- package/dist/ethereum/api.connection.js.map +1 -0
- package/dist/ethereum/api.ethereum.d.ts +3 -0
- package/dist/ethereum/api.ethereum.js +25 -5
- package/dist/ethereum/api.ethereum.js.map +1 -1
- package/dist/ethereum/api.service.ethereum.d.ts +5 -4
- package/dist/ethereum/api.service.ethereum.js +49 -18
- package/dist/ethereum/api.service.ethereum.js.map +1 -1
- package/dist/ethereum/api.service.ethereum.test.js +32 -20
- package/dist/ethereum/api.service.ethereum.test.js.map +1 -1
- package/dist/ethereum/ethers/web/index.d.ts +0 -1
- package/dist/ethereum/ethers/web/types.d.ts +0 -1
- package/dist/indexer/blockDispatcher/block-dispatcher.service.js.map +1 -1
- package/dist/indexer/blockDispatcher/worker-block-dispatcher.service.js +0 -1
- package/dist/indexer/blockDispatcher/worker-block-dispatcher.service.js.map +1 -1
- package/dist/indexer/dictionary.service.js.map +1 -1
- package/dist/indexer/ds-processor.service.js.map +1 -1
- package/dist/indexer/dynamic-ds.service.js.map +1 -1
- package/dist/indexer/fetch.module.js +11 -3
- package/dist/indexer/fetch.module.js.map +1 -1
- package/dist/indexer/fetch.service.d.ts +1 -1
- package/dist/indexer/fetch.service.js +30 -32
- package/dist/indexer/fetch.service.js.map +1 -1
- package/dist/indexer/indexer.manager.js.map +1 -1
- package/dist/indexer/indexer.module.js +4 -4
- package/dist/indexer/indexer.module.js.map +1 -1
- package/dist/indexer/project.service.js +1 -3
- package/dist/indexer/project.service.js.map +1 -1
- package/dist/indexer/sandbox.service.js.map +1 -1
- package/dist/indexer/unfinalizedBlocks.service.js +0 -1
- package/dist/indexer/unfinalizedBlocks.service.js.map +1 -1
- package/dist/indexer/worker/worker.js +1 -8
- package/dist/indexer/worker/worker.js.map +1 -1
- package/dist/indexer/worker/worker.module.js.map +1 -1
- package/dist/indexer/worker/worker.service.js.map +1 -1
- package/dist/indexer/worker/worker.unfinalizedBlocks.service.js.map +1 -1
- package/dist/meta/meta.controller.js.map +1 -1
- package/dist/meta/meta.module.js.map +1 -1
- package/dist/meta/meta.service.js.map +1 -1
- package/dist/subcommands/forceClean.module.js.map +1 -1
- package/dist/subcommands/forceClean.service.js.map +1 -1
- package/dist/subcommands/reindex.module.js.map +1 -1
- package/dist/subcommands/reindex.service.js +1 -2
- package/dist/subcommands/reindex.service.js.map +1 -1
- package/dist/yargs.d.ts +31 -28
- package/dist/yargs.js +30 -25
- package/dist/yargs.js.map +1 -1
- package/package.json +7 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"worker.js","sourceRoot":"","sources":["../../../src/indexer/worker/worker.ts"],"names":[],"mappings":";AAAA,gEAAgE;AAChE,sCAAsC;;;;;AAEtC,iEAAiE;AACjE,kDAAkD;AAClD,wCAAwC;AACxC,oDAAqD;AACrD,wCAAwC;AACxC,uCAA2C;AAE3C,MAAM,EAAE,IAAI,EAAE,GAAG,oBAAY,CAAC;AAE9B,IAAA,mBAAU,EACR,IAAI,CAAC,KAAK,EACV,IAAI,CAAC,SAA+B,EACpC,IAAI,CAAC,QAA8B,CACpC,CAAC;AAEF,oDAA4B;AAC5B,6DAA+C;AAC/C,2BAAuC;AAEvC,uCAA2C;AAC3C,gDAS0B;
|
|
1
|
+
{"version":3,"file":"worker.js","sourceRoot":"","sources":["../../../src/indexer/worker/worker.ts"],"names":[],"mappings":";AAAA,gEAAgE;AAChE,sCAAsC;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IACT,aAAa;IACb,sBAAsB;CACvB,EACD,MAAM,CACP,CAAC;AA0BF,OAAO,CAAC,EAAE,CAAC,mBAAmB,EAAE,CAAC,CAAC,EAAE,EAAE;IACpC,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,oBAAoB,CAAC,CAAC;IACtC,MAAM,CAAC,CAAC;AACV,CAAC,CAAC,CAAC","sourcesContent":["// Copyright 2020-2021 OnFinality Limited authors & contributors\n// SPDX-License-Identifier: Apache-2.0\n\n// initlogger and yargs must be imported before all other imports\n// making sure logger is defined before its called\n// eslint-disable-next-line import/order\nimport { initLogger } from '@subql/node-core/logger';\n// eslint-disable-next-line import/order\nimport { yargsOptions } from '../../yargs';\n\nconst { argv } = yargsOptions;\n\ninitLogger(\n argv.debug,\n argv.outputFmt as 'json' | 'colored',\n argv.logLevel as string | undefined,\n);\n\nimport assert from 'assert';\nimport { threadId } from 'node:worker_threads';\nimport { getHeapStatistics } from 'v8';\nimport { INestApplication } from '@nestjs/common';\nimport { NestFactory } from '@nestjs/core';\nimport {\n waitForBatchSize,\n WorkerHost,\n getLogger,\n NestLogger,\n hostStoreKeys,\n HostStore,\n hostDynamicDsKeys,\n HostDynamicDS,\n} from '@subql/node-core';\nimport { SubqlProjectDs } from '../../configure/SubqueryProject';\nimport { DynamicDsService } from '../dynamic-ds.service';\nimport { IndexerManager } from '../indexer.manager';\nimport { WorkerModule } from './worker.module';\nimport {\n FetchBlockResponse,\n ProcessBlockResponse,\n WorkerService,\n WorkerStatusResponse,\n} from './worker.service';\nimport {\n HostUnfinalizedBlocks,\n hostUnfinalizedBlocksKeys,\n} from './worker.unfinalizedBlocks.service';\nlet app: INestApplication;\nlet workerService: WorkerService;\n\nconst logger = getLogger(`worker #${threadId}`);\n\nasync function initWorker(): Promise<void> {\n try {\n if (app) {\n logger.warn('Worker already initialised');\n return;\n }\n\n app = await NestFactory.create(WorkerModule, {\n logger: new NestLogger(), // TIP: If the worker is crashing comment out this line for better logging\n });\n\n await app.init();\n\n const indexerManager = app.get(IndexerManager);\n // Initialise async services, we do this here rather than in factories so we can capture one off events\n await indexerManager.start();\n\n workerService = app.get(WorkerService);\n } catch (e) {\n console.log('Failed to start worker', e);\n logger.error(e, 'Failed to start worker');\n throw e;\n }\n}\n\nasync function fetchBlock(height: number): Promise<FetchBlockResponse> {\n assert(workerService, 'Not initialised');\n return workerService.fetchBlock(height);\n}\n\nasync function processBlock(height: number): Promise<ProcessBlockResponse> {\n assert(workerService, 'Not initialised');\n\n return workerService.processBlock(height);\n}\n\n// eslint-disable-next-line @typescript-eslint/require-await\nasync function numFetchedBlocks(): Promise<number> {\n return workerService.numFetchedBlocks;\n}\n\n// eslint-disable-next-line @typescript-eslint/require-await\nasync function numFetchingBlocks(): Promise<number> {\n return workerService.numFetchingBlocks;\n}\n\n// eslint-disable-next-line @typescript-eslint/require-await\nasync function getStatus(): Promise<WorkerStatusResponse> {\n return {\n threadId,\n fetchedBlocks: workerService.numFetchedBlocks,\n toFetchBlocks: workerService.numFetchingBlocks,\n isIndexing: workerService.isIndexing,\n };\n}\n\n// eslint-disable-next-line @typescript-eslint/require-await\nasync function getMemoryLeft(): Promise<number> {\n const totalHeap = getHeapStatistics().heap_size_limit;\n const heapUsed = process.memoryUsage().heapUsed;\n\n return totalHeap - heapUsed;\n}\n\nasync function waitForWorkerBatchSize(heapSizeInBytes: number): Promise<void> {\n await waitForBatchSize(heapSizeInBytes);\n}\n\n// Register these functions to be exposed to worker host\n(global as any).host = WorkerHost.create<\n HostStore & HostDynamicDS<SubqlProjectDs> & HostUnfinalizedBlocks,\n IInitIndexerWorker\n>(\n [...hostStoreKeys, ...hostDynamicDsKeys, ...hostUnfinalizedBlocksKeys],\n {\n initWorker,\n fetchBlock,\n processBlock,\n numFetchedBlocks,\n numFetchingBlocks,\n getStatus,\n getMemoryLeft,\n waitForWorkerBatchSize,\n },\n logger,\n);\n\n// Export types to be used on the parent\ntype InitWorker = typeof initWorker;\ntype FetchBlock = typeof fetchBlock;\ntype ProcessBlock = typeof processBlock;\ntype NumFetchedBlocks = typeof numFetchedBlocks;\ntype NumFetchingBlocks = typeof numFetchingBlocks;\ntype GetWorkerStatus = typeof getStatus;\ntype GetMemoryLeft = typeof getMemoryLeft;\ntype WaitForWorkerBatchSize = typeof waitForWorkerBatchSize;\n\nexport type IIndexerWorker = {\n processBlock: ProcessBlock;\n fetchBlock: FetchBlock;\n numFetchedBlocks: NumFetchedBlocks;\n numFetchingBlocks: NumFetchingBlocks;\n getStatus: GetWorkerStatus;\n getMemoryLeft: GetMemoryLeft;\n waitForWorkerBatchSize: WaitForWorkerBatchSize;\n};\n\nexport type IInitIndexerWorker = IIndexerWorker & {\n initWorker: InitWorker;\n};\n\nprocess.on('uncaughtException', (e) => {\n logger.error(e, 'Uncaught Exception');\n throw e;\n});\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"worker.module.js","sourceRoot":"","sources":["../../../src/indexer/worker/worker.module.ts"],"names":[],"mappings":";AAAA,gEAAgE;AAChE,sCAAsC;;;;;;;;;AAEtC,2CAAwC;AACxC,yDAA2D;AAC3D,+CAAkD;AAClD,gDAA4C;AAC5C,uEAAmE;AACnE,sDAAkD;
|
|
1
|
+
{"version":3,"file":"worker.module.js","sourceRoot":"","sources":["../../../src/indexer/worker/worker.module.ts"],"names":[],"mappings":";AAAA,gEAAgE;AAChE,sCAAsC;;;;;;;;;AAEtC,2CAAwC;AACxC,yDAA2D;AAC3D,+CAAkD;AAClD,gDAA4C;AAC5C,uEAAmE;AACnE,sDAAkD;AAYlD,IAAa,YAAY,GAAzB,MAAa,YAAY;CAAG,CAAA;AAAf,YAAY;IAVxB,IAAA,eAAM,EAAC;QACN,OAAO,EAAE;YACP,oBAAQ,CAAC,OAAO,EAAE;YAClB,kCAAkB,CAAC,OAAO,EAAE;YAC5B,kCAAe,CAAC,QAAQ,EAAE;YAC1B,yBAAc,CAAC,OAAO,EAAE;YACxB,8BAAa;SACd;QACD,WAAW,EAAE,EAAE;KAChB,CAAC;GACW,YAAY,CAAG;AAAf,oCAAY","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 { ScheduleModule } from '@nestjs/schedule';\nimport { DbModule } from '@subql/node-core';\nimport { ConfigureModule } from '../../configure/configure.module';\nimport { IndexerModule } from '../indexer.module';\n\n@Module({\n imports: [\n DbModule.forRoot(),\n EventEmitterModule.forRoot(),\n ConfigureModule.register(),\n ScheduleModule.forRoot(),\n IndexerModule,\n ],\n controllers: [],\n})\nexport class WorkerModule {}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"worker.service.js","sourceRoot":"","sources":["../../../src/indexer/worker/worker.service.ts"],"names":[],"mappings":";AAAA,gEAAgE;AAChE,sCAAsC;;;;;;;;;;;;AAEtC,6DAA+C;AAC/C,2CAA4C;AAC5C,gDAM0B;AAE1B,wDAAoD;AAiBpD,MAAM,MAAM,GAAG,IAAA,qBAAS,EAAC,mBAAmB,8BAAQ,EAAE,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"worker.service.js","sourceRoot":"","sources":["../../../src/indexer/worker/worker.service.ts"],"names":[],"mappings":";AAAA,gEAAgE;AAChE,sCAAsC;;;;;;;;;;;;AAEtC,6DAA+C;AAC/C,2CAA4C;AAC5C,gDAM0B;AAE1B,wDAAoD;AAiBpD,MAAM,MAAM,GAAG,IAAA,qBAAS,EAAC,mBAAmB,8BAAQ,EAAE,CAAC,CAAC;AAGxD,IAAa,aAAa,GAA1B,MAAa,aAAa;IAMxB,YACU,UAAsB,EACtB,cAA8B,EACtC,UAAsB;QAFd,eAAU,GAAV,UAAU,CAAY;QACtB,mBAAc,GAAd,cAAc,CAAgB;QAPhC,kBAAa,GAAiC,EAAE,CAAC;QACjD,gBAAW,GAAG,KAAK,CAAC;QAS1B,IAAI,CAAC,KAAK,GAAG,IAAI,q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MAAM,CAAC,CAAC;YAElC,OAAO,MAAM,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;SACpD;QAAC,OAAO,CAAC,EAAE;YACV,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,yBAAyB,MAAM,KAAK,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC;YAC/D,MAAM,CAAC,CAAC;SACT;gBAAS;YACR,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC;SAC1B;IACH,CAAC;IAED,IAAI,gBAAgB;QAClB,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,MAAM,CAAC;IAChD,CAAC;IAED,IAAI,iBAAiB;QACnB,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC;IACzB,CAAC;IAED,IAAI,UAAU;QACZ,OAAO,IAAI,CAAC,WAAW,CAAC;IAC1B,CAAC;CACF,CAAA;AAvEY,aAAa;IADzB,IAAA,mBAAU,GAAE;qCAQW,sBAAU;QACN,gCAAc;QAC1B,sBAAU;GATb,aAAa,CAuEzB;AAvEY,sCAAa","sourcesContent":["// Copyright 2020-2022 OnFinality Limited authors & contributors\n// SPDX-License-Identifier: Apache-2.0\n\nimport { threadId } from 'node:worker_threads';\nimport { Injectable } from '@nestjs/common';\nimport {\n NodeConfig,\n getLogger,\n AutoQueue,\n memoryLock,\n ApiService,\n} from '@subql/node-core';\nimport { BlockWrapper, EthereumBlockWrapper } from '@subql/types-ethereum';\nimport { IndexerManager } from '../indexer.manager';\n\nexport type FetchBlockResponse = { parentHash: string } | undefined;\n\nexport type ProcessBlockResponse = {\n dynamicDsCreated: boolean;\n blockHash: string;\n reindexBlockHeight: number;\n};\n\nexport type WorkerStatusResponse = {\n threadId: number;\n isIndexing: boolean;\n fetchedBlocks: number;\n toFetchBlocks: number;\n};\n\nconst logger = getLogger(`Worker Service #${threadId}`);\n\n@Injectable()\nexport class WorkerService {\n private fetchedBlocks: Record<string, BlockWrapper> = {};\n private _isIndexing = false;\n\n private queue: AutoQueue<FetchBlockResponse>;\n\n constructor(\n private apiService: ApiService,\n private indexerManager: IndexerManager,\n nodeConfig: NodeConfig,\n ) {\n this.queue = new AutoQueue(undefined, nodeConfig.batchSize);\n }\n\n async fetchBlock(height: number): Promise<FetchBlockResponse> {\n try {\n return await this.queue.put(async () => {\n // If a dynamic ds is created we might be asked to fetch blocks again, use existing result\n if (!this.fetchedBlocks[height]) {\n if (memoryLock.isLocked()) {\n const start = Date.now();\n await memoryLock.waitForUnlock();\n const end = Date.now();\n logger.debug(`memory lock wait time: ${end - start}ms`);\n }\n\n const [block] = await this.apiService.api.fetchBlocks([height]);\n this.fetchedBlocks[height] = block;\n }\n\n // const block = this.fetchedBlocks[height];\n\n // Return info to get the runtime version, this lets the worker thread know\n return undefined;\n });\n } catch (e) {\n logger.error(/*e, */ `Failed to fetch block ${height}`);\n }\n }\n\n async processBlock(height: number): Promise<ProcessBlockResponse> {\n try {\n this._isIndexing = true;\n const block = this.fetchedBlocks[height] as EthereumBlockWrapper;\n\n if (!block) {\n throw new Error(`Block ${height} has not been fetched`);\n }\n\n delete this.fetchedBlocks[height];\n\n return await this.indexerManager.indexBlock(block);\n } catch (e) {\n logger.error(e, `Failed to index block ${height}: ${e.stack}`);\n throw e;\n } finally {\n this._isIndexing = false;\n }\n }\n\n get numFetchedBlocks(): number {\n return Object.keys(this.fetchedBlocks).length;\n }\n\n get numFetchingBlocks(): number {\n return this.queue.size;\n }\n\n get isIndexing(): boolean {\n return this._isIndexing;\n }\n}\n"]}
|
|
@@ -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;
|
|
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;AAGF,IAAa,8BAA8B,GAA3C,MAAa,8BAA8B;IAGzC,YAAoB,IAA2B;QAA3B,SAAI,GAAJ,IAAI,CAAuB;IAAG,CAAC;IAEnD,KAAK,CAAC,wBAAwB,CAAC,KAAoB;QACjD,OAAO,IAAI,CAAC,IAAI,CAAC,wBAAwB,CAAC,KAAK,CAAC,CAAC;IACnD,CAAC;CACF,CAAA;AARY,8BAA8B;IAD1C,IAAA,mBAAU,GAAE;;GACA,8BAA8B,CAQ1C;AARY,wEAA8B","sourcesContent":["// Copyright 2020-2022 OnFinality Limited authors & contributors\n// SPDX-License-Identifier: Apache-2.0\n\nimport { Injectable } from '@nestjs/common';\nimport { EthereumBlock } from '@subql/types-ethereum';\nimport { IUnfinalizedBlocksService } from '../unfinalizedBlocks.service';\n\nexport type HostUnfinalizedBlocks = {\n unfinalizedBlocksProcess: (block: EthereumBlock) => Promise<number | null>;\n};\n\nexport const hostUnfinalizedBlocksKeys: (keyof HostUnfinalizedBlocks)[] = [\n 'unfinalizedBlocksProcess',\n];\n\n@Injectable()\nexport class WorkerUnfinalizedBlocksService\n implements IUnfinalizedBlocksService\n{\n constructor(private host: HostUnfinalizedBlocks) {}\n\n async processUnfinalizedBlocks(block: EthereumBlock): Promise<number | null> {\n return this.host.unfinalizedBlocksProcess(block);\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"meta.controller.js","sourceRoot":"","sources":["../../src/meta/meta.controller.ts"],"names":[],"mappings":";AAAA,gEAAgE;AAChE,sCAAsC;;;;;;;;;;;;AAEtC,2CAAiD;AACjD,iDAA6C;
|
|
1
|
+
{"version":3,"file":"meta.controller.js","sourceRoot":"","sources":["../../src/meta/meta.controller.ts"],"names":[],"mappings":";AAAA,gEAAgE;AAChE,sCAAsC;;;;;;;;;;;;AAEtC,2CAAiD;AACjD,iDAA6C;AAG7C,IAAa,cAAc,GAA3B,MAAa,cAAc;IACzB,YAAoB,WAAwB;QAAxB,gBAAW,GAAX,WAAW,CAAa;IAAG,CAAC;IAGhD,OAAO;QACL,OAAO,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,CAAC;IACpC,CAAC;CACF,CAAA;AAHC;IADC,IAAA,YAAG,GAAE;;;;6CAGL;AANU,cAAc;IAD1B,IAAA,mBAAU,EAAC,MAAM,CAAC;qCAEgB,0BAAW;GADjC,cAAc,CAO1B;AAPY,wCAAc","sourcesContent":["// Copyright 2020-2022 OnFinality Limited authors & contributors\n// SPDX-License-Identifier: Apache-2.0\n\nimport { Controller, Get } from '@nestjs/common';\nimport { MetaService } from './meta.service';\n\n@Controller('meta')\nexport class MetaController {\n constructor(private metaService: MetaService) {}\n\n @Get()\n getMeta() {\n return this.metaService.getMeta();\n }\n}\n"]}
|
|
@@ -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,gDAM0B;AAC1B,mEAGqC;AACrC,0DAAsD;AACtD,uDAAmD;AACnD,iDAA6C;
|
|
1
|
+
{"version":3,"file":"meta.module.js","sourceRoot":"","sources":["../../src/meta/meta.module.ts"],"names":[],"mappings":";AAAA,gEAAgE;AAChE,sCAAsC;;;;;;;;;AAEtC,2CAAwC;AACxC,gDAM0B;AAC1B,mEAGqC;AACrC,0DAAsD;AACtD,uDAAmD;AACnD,iDAA6C;AAgE7C,IAAa,UAAU,GAAvB,MAAa,UAAU;CAAG,CAAA;AAAb,UAAU;IA9DtB,IAAA,eAAM,EAAC;QACN,OAAO,EAAE,CAAC,o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C3C,IAAI,EAAE,qEAAqE;aAC5E,CAAC;YACF,IAAA,qCAAiB,EAAC;gBAChB,IAAI,EAAE,wCAAwC;gBAC9C,IAAI,EAAE,mDAAmD;aAC1D,CAAC;YACF,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} from '@subql/node-core';\nimport {\n makeGaugeProvider,\n PrometheusModule,\n} 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 makeGaugeProvider({\n name: 'subql_indexer_api_connected',\n help: 'The indexer api connection status',\n }),\n makeGaugeProvider({\n name: 'subql_indexer_injected_api_connected',\n help: 'The indexer injected api connection status',\n }),\n makeGaugeProvider({\n name: 'subql_indexer_processing_block_height',\n help: 'The current processing block height',\n }),\n makeGaugeProvider({\n name: 'subql_indexer_processed_block_height',\n help: 'The last processed block height',\n }),\n makeGaugeProvider({\n name: 'subql_indexer_target_block_height',\n help: 'The latest finalized block height',\n }),\n makeGaugeProvider({\n name: 'subql_indexer_best_block_height',\n help: 'The latest best block height',\n }),\n makeGaugeProvider({\n name: 'subql_indexer_block_queue_size',\n help: 'The size of fetched block queue',\n }),\n makeGaugeProvider({\n name: 'subql_indexer_blocknumber_queue_size',\n help: 'The size of fetched block number queue',\n }),\n makeGaugeProvider({\n name: 'subql_indexer_using_dictionary',\n help: 'The status of indexer is using the dictionary',\n }),\n makeGaugeProvider({\n name: 'subql_indexer_skip_dictionary_count',\n help: 'The number of times indexer been skip use dictionary',\n }),\n makeGaugeProvider({\n name: 'subql_indexer_processed_block_count',\n help: 'The number of processed block',\n }),\n makeGaugeProvider({\n name: 'subql_indexer_store_cache_threshold',\n help: 'Store cache will flush once cache record size excess this threshold',\n }),\n makeGaugeProvider({\n name: 'subql_indexer_store_cache_records_size',\n help: 'Number of records waiting to flush in store cache',\n }),\n MetaService,\n HealthService,\n ReadyService,\n ],\n})\nexport class MetaModule {}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"meta.service.js","sourceRoot":"","sources":["../../src/meta/meta.service.ts"],"names":[],"mappings":";AAAA,gEAAgE;AAChE,sCAAsC;;;;;;;;;;;;AAEtC,2CAA4C;AAC5C,yDAAgD;AAChD,+CAA4C;AAC5C,gDAW0B;AAE1B,MAAM,sBAAsB,GAAG,KAAK,CAAC;AAErC,8DAA8D;AAC9D,MAAM,EAAE,OAAO,EAAE,kBAAkB,EAAE,GAAG,OAAO,CAAC,4BAA4B,CAAC,CAAC;AAC9E,MAAM,EAAE,OAAO,EAAE,cAAc,EAAE,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC;AAClE,MAAM,MAAM,GAAG,IAAA,qBAAS,EAAC,UAAU,CAAC,CAAC;AAG9B,IAAM,WAAW,GAAjB,MAAM,WAAW;IAsBtB,YACU,YAA0B,EAC1B,UAAsB;QADtB,iBAAY,GAAZ,YAAY,CAAc;QAC1B,eAAU,GAAV,UAAU,CAAY;QAZxB,qBAAgB,GAAG,CAAC,CAAC;QACrB,mBAAc,GAAG,CAAC,CAAC;QACnB,6BAAwB,GAAG,CAAC,CAAC;QAC7B,gBAAW,GAAG,CAAC,CAAC;QAChB,kCAA6B,GAAG,CAAC,CAAC;QAClC,8BAAyB,GAAG,CAAC,CAAC;QAC9B,4BAAuB,GAAG,CAAC,CAAC;QAC5B,yBAAoB,GAAG,CAAC,CAAC;IAM9B,CAAC;IAEJ,OAAO;QACL,uBACE,uBAAuB,EAAE,IAAI,CAAC,uBAAuB,EACrD,0BAA0B,EAAE,I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AAA,uBAAO,EAAC,wBAAY,CAAC,eAAe,CAAC;;;;wDAGrC;AAED;IAAC,IAAA,uBAAO,EAAC,wBAAY,CAAC,YAAY,CAAC;;;;qDAGlC;AAED;IAAC,IAAA,uBAAO,EAAC,wBAAY,CAAC,eAAe,CAAC;;;;wDAGrC;AAED;IAAC,IAAA,uBAAO,EAAC,eAAe,CAAC;;;;sDAMxB;AAED;IAAC,IAAA,uBAAO,EAAC,iBAAiB,CAAC;;;;wDAM1B;AAED;IAAC,IAAA,uBAAO,EAAC,YAAY,CAAC;;;;mDAMrB;AAED;IAAC,IAAA,uBAAO,EAAC,SAAS,CAAC;;;;gDAMlB;AAED;IAAC,IAAA,mBAAQ,EAAC,KAAK,CAAC;;;;sDAwBf;AAnJU,WAAW;IADvB,IAAA,mBAAU,GAAE;qCAwBa,wBAAY;QACd,sBAAU;GAxBrB,WAAW,CAoJvB;AApJY,kCAAW","sourcesContent":["// Copyright 2020-2022 OnFinality Limited authors & contributors\n// SPDX-License-Identifier: Apache-2.0\n\nimport { Injectable } from '@nestjs/common';\nimport { OnEvent } from '@nestjs/event-emitter';\nimport { Interval } from '@nestjs/schedule';\nimport {\n BestBlockPayload,\n EventPayload,\n IndexerEvent,\n NetworkMetadataPayload,\n ProcessBlockPayload,\n ProcessedBlockCountPayload,\n TargetBlockPayload,\n StoreService,\n getLogger,\n NodeConfig,\n} from '@subql/node-core';\n\nconst UPDATE_HEIGHT_INTERVAL = 60000;\n\n// eslint-disable-next-line @typescript-eslint/no-var-requires\nconst { version: polkadotSdkVersion } = require('@polkadot/api/package.json');\nconst { version: packageVersion } = require('../../package.json');\nconst logger = getLogger('profiler');\n\n@Injectable()\nexport class MetaService {\n private currentProcessingHeight: number;\n private currentProcessingTimestamp: number;\n private bestHeight: number;\n private targetHeight: number;\n private networkMeta: NetworkMetadataPayload;\n private apiConnected: boolean;\n private usingDictionary: boolean;\n private injectedApiConnected: boolean;\n private lastProcessedHeight: number;\n private lastProcessedTimestamp: number;\n private processedBlockCount: number;\n private accEnqueueBlocks = 0;\n private accFetchBlocks = 0;\n private currentFilteringBlockNum = 0;\n private accRpcCalls = 0;\n private lastReportedFilteringBlockNum = 0;\n private lastReportedEnqueueBlocks = 0;\n private lastReportedFetchBlocks = 0;\n private lastReportedRpcCalls = 0;\n private lastStatsReportedTs: Date;\n\n constructor(\n private storeService: StoreService,\n private nodeConfig: NodeConfig,\n ) {}\n\n getMeta() {\n return {\n currentProcessingHeight: this.currentProcessingHeight,\n currentProcessingTimestamp: this.currentProcessingTimestamp,\n targetHeight: this.targetHeight,\n bestHeight: this.bestHeight,\n indexerNodeVersion: packageVersion,\n lastProcessedHeight: this.lastProcessedHeight,\n lastProcessedTimestamp: this.lastProcessedTimestamp,\n uptime: process.uptime(),\n polkadotSdkVersion,\n processedBlockCount: this.processedBlockCount,\n apiConnected: this.apiConnected,\n injectedApiConnected: this.injectedApiConnected,\n usingDictionary: this.usingDictionary,\n ...this.networkMeta,\n };\n }\n\n @Interval(UPDATE_HEIGHT_INTERVAL)\n getTargetHeight(): void {\n this.storeService.storeCache.metadata.set(\n 'targetHeight',\n this.targetHeight,\n );\n }\n\n @OnEvent(IndexerEvent.BlockProcessing)\n handleProcessingBlock(blockPayload: ProcessBlockPayload): void {\n this.currentProcessingHeight = blockPayload.height;\n this.currentProcessingTimestamp = blockPayload.timestamp;\n }\n\n @OnEvent(IndexerEvent.BlockProcessedCount)\n handleProcessedBlock(blockPayload: ProcessedBlockCountPayload): void {\n this.processedBlockCount = blockPayload.processedBlockCount;\n this.currentProcessingTimestamp = blockPayload.timestamp;\n }\n\n @OnEvent(IndexerEvent.BlockTarget)\n handleTargetBlock(blockPayload: TargetBlockPayload): void {\n this.targetHeight = blockPayload.height;\n }\n\n @OnEvent(IndexerEvent.BlockBest)\n handleBestBlock(blockPayload: BestBlockPayload): void {\n this.bestHeight = blockPayload.height;\n }\n\n @OnEvent(IndexerEvent.NetworkMetadata)\n handleNetworkMetadata(networkMeta: NetworkMetadataPayload): void {\n this.networkMeta = networkMeta;\n }\n\n @OnEvent(IndexerEvent.ApiConnected)\n handleApiConnected({ value }: EventPayload<number>): void {\n this.apiConnected = !!value;\n }\n\n @OnEvent(IndexerEvent.UsingDictionary)\n handleUsingDictionary({ value }: EventPayload<number>): void {\n this.usingDictionary = !!value;\n }\n\n @OnEvent('enqueueBlocks')\n handleEnqueueBlocks(size: number): void {\n this.accEnqueueBlocks += size;\n if (!this.lastStatsReportedTs) {\n this.lastStatsReportedTs = new Date();\n }\n }\n\n @OnEvent('filteringBlocks')\n handleFilteringBlocks(height: number): void {\n this.currentFilteringBlockNum = height;\n if (!this.lastStatsReportedTs) {\n this.lastReportedFilteringBlockNum = height;\n }\n }\n\n @OnEvent('fetchBlock')\n handleFetchBlock(): void {\n this.accFetchBlocks++;\n if (!this.lastStatsReportedTs) {\n this.lastStatsReportedTs = new Date();\n }\n }\n\n @OnEvent('rpcCall')\n handleRpcCall(): void {\n this.accRpcCalls++;\n if (!this.lastStatsReportedTs) {\n this.lastStatsReportedTs = new Date();\n }\n }\n\n @Interval(10000)\n blockFilteringSpeed(): void {\n if (!this.nodeConfig.profiler) {\n return;\n }\n const count = this.accEnqueueBlocks - this.lastReportedEnqueueBlocks;\n this.lastReportedEnqueueBlocks = this.accEnqueueBlocks;\n const filteringCount =\n this.currentFilteringBlockNum - this.lastReportedFilteringBlockNum;\n const now = new Date();\n const timepass = now.getTime() - this.lastStatsReportedTs.getTime();\n this.lastStatsReportedTs = now;\n this.lastReportedFilteringBlockNum = this.currentFilteringBlockNum;\n const rpcCalls = this.accRpcCalls - this.lastReportedRpcCalls;\n this.lastReportedRpcCalls = this.accRpcCalls;\n const fetchCount = this.accFetchBlocks - this.lastReportedFetchBlocks;\n this.lastReportedFetchBlocks = this.accFetchBlocks;\n logger.info(`actual block filtering: ${(count / (timepass / 1000)).toFixed(\n 2,\n )}/sec, \\\nseeming speed: ${(filteringCount / (timepass / 1000)).toFixed(\n 2,\n )}/sec, rpcCalls: ${(rpcCalls / (timepass / 1000)).toFixed(2)}/sec \\\nfetch speed: ${(fetchCount / (timepass / 1000)).toFixed(2)}/sec`);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"meta.service.js","sourceRoot":"","sources":["../../src/meta/meta.service.ts"],"names":[],"mappings":";AAAA,gEAAgE;AAChE,sCAAsC;;;;;;;;;;;;AAEtC,2CAA4C;AAC5C,yDAAgD;AAChD,+CAA4C;AAC5C,gDAW0B;AAE1B,MAAM,sBAAsB,GAAG,KAAK,CAAC;AAErC,8DAA8D;AAC9D,MAAM,EAAE,OAAO,EAAE,kBAAkB,EAAE,GAAG,OAAO,CAAC,4BAA4B,CAAC,CAAC;AAC9E,MAAM,EAAE,OAAO,EAAE,cAAc,EAAE,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC;AAClE,MAAM,MAAM,GAAG,IAAA,qBAAS,EAAC,UAAU,CAAC,CAAC;AAGrC,IAAa,WAAW,GAAxB,MAAa,WAAW;IAsBtB,YACU,YAA0B,EAC1B,UAAsB;QADtB,iBAAY,GAAZ,YAAY,CAAc;QAC1B,eAAU,GAAV,UAAU,CAAY;QAZxB,qBAAgB,GAAG,CAAC,CAAC;QACrB,mBAAc,GAAG,CAAC,CAAC;QACnB,6BAAwB,GAAG,CAAC,CAAC;QAC7B,gBAAW,GAAG,CAAC,CAAC;QAChB,kCAA6B,GAAG,CAAC,CAAC;QAClC,8BAAyB,GAAG,CAAC,CAAC;QAC9B,4BAAuB,GAAG,CAAC,CAAC;QAC5B,yBAAoB,GAAG,CAAC,CAAC;IAM9B,CAAC;IAEJ,OAAO;QACL,uBACE,uBAAuB,EAAE,IAAI,CAAC,uBAAuB,EACrD,0BAA0B,EAAE,IAAI,CAAC,0BAA0B,EAC3D,YAAY,EAAE,IAAI,CAAC,YAAY,EAC/B,UAAU,EAAE,IAAI,CAAC,UAAU,EAC3B,kBAAkB,EAAE,cAAc,EAClC,mBAAmB,EAAE,IAAI,CAAC,mBAAmB,EAC7C,sBAAs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;;;wDAGrC;AAGD;IADC,IAAA,uBAAO,EAAC,eAAe,CAAC;;;;sDAMxB;AAGD;IADC,IAAA,uBAAO,EAAC,iBAAiB,CAAC;;;;wDAM1B;AAGD;IADC,IAAA,uBAAO,EAAC,YAAY,CAAC;;;;mDAMrB;AAGD;IADC,IAAA,uBAAO,EAAC,SAAS,CAAC;;;;gDAMlB;AAGD;IADC,IAAA,mBAAQ,EAAC,KAAK,CAAC;;;;sDAwBf;AAnJU,WAAW;IADvB,IAAA,mBAAU,GAAE;qCAwBa,wBAAY;QACd,sBAAU;GAxBrB,WAAW,CAoJvB;AApJY,kCAAW","sourcesContent":["// Copyright 2020-2022 OnFinality Limited authors & contributors\n// SPDX-License-Identifier: Apache-2.0\n\nimport { Injectable } from '@nestjs/common';\nimport { OnEvent } from '@nestjs/event-emitter';\nimport { Interval } from '@nestjs/schedule';\nimport {\n BestBlockPayload,\n EventPayload,\n IndexerEvent,\n NetworkMetadataPayload,\n ProcessBlockPayload,\n ProcessedBlockCountPayload,\n TargetBlockPayload,\n StoreService,\n getLogger,\n NodeConfig,\n} from '@subql/node-core';\n\nconst UPDATE_HEIGHT_INTERVAL = 60000;\n\n// eslint-disable-next-line @typescript-eslint/no-var-requires\nconst { version: polkadotSdkVersion } = require('@polkadot/api/package.json');\nconst { version: packageVersion } = require('../../package.json');\nconst logger = getLogger('profiler');\n\n@Injectable()\nexport class MetaService {\n private currentProcessingHeight: number;\n private currentProcessingTimestamp: number;\n private bestHeight: number;\n private targetHeight: number;\n private networkMeta: NetworkMetadataPayload;\n private apiConnected: boolean;\n private usingDictionary: boolean;\n private injectedApiConnected: boolean;\n private lastProcessedHeight: number;\n private lastProcessedTimestamp: number;\n private processedBlockCount: number;\n private accEnqueueBlocks = 0;\n private accFetchBlocks = 0;\n private currentFilteringBlockNum = 0;\n private accRpcCalls = 0;\n private lastReportedFilteringBlockNum = 0;\n private lastReportedEnqueueBlocks = 0;\n private lastReportedFetchBlocks = 0;\n private lastReportedRpcCalls = 0;\n private lastStatsReportedTs: Date;\n\n constructor(\n private storeService: StoreService,\n private nodeConfig: NodeConfig,\n ) {}\n\n getMeta() {\n return {\n currentProcessingHeight: this.currentProcessingHeight,\n currentProcessingTimestamp: this.currentProcessingTimestamp,\n targetHeight: this.targetHeight,\n bestHeight: this.bestHeight,\n indexerNodeVersion: packageVersion,\n lastProcessedHeight: this.lastProcessedHeight,\n lastProcessedTimestamp: this.lastProcessedTimestamp,\n uptime: process.uptime(),\n polkadotSdkVersion,\n processedBlockCount: this.processedBlockCount,\n apiConnected: this.apiConnected,\n injectedApiConnected: this.injectedApiConnected,\n usingDictionary: this.usingDictionary,\n ...this.networkMeta,\n };\n }\n\n @Interval(UPDATE_HEIGHT_INTERVAL)\n getTargetHeight(): void {\n this.storeService.storeCache.metadata.set(\n 'targetHeight',\n this.targetHeight,\n );\n }\n\n @OnEvent(IndexerEvent.BlockProcessing)\n handleProcessingBlock(blockPayload: ProcessBlockPayload): void {\n this.currentProcessingHeight = blockPayload.height;\n this.currentProcessingTimestamp = blockPayload.timestamp;\n }\n\n @OnEvent(IndexerEvent.BlockProcessedCount)\n handleProcessedBlock(blockPayload: ProcessedBlockCountPayload): void {\n this.processedBlockCount = blockPayload.processedBlockCount;\n this.currentProcessingTimestamp = blockPayload.timestamp;\n }\n\n @OnEvent(IndexerEvent.BlockTarget)\n handleTargetBlock(blockPayload: TargetBlockPayload): void {\n this.targetHeight = blockPayload.height;\n }\n\n @OnEvent(IndexerEvent.BlockBest)\n handleBestBlock(blockPayload: BestBlockPayload): void {\n this.bestHeight = blockPayload.height;\n }\n\n @OnEvent(IndexerEvent.NetworkMetadata)\n handleNetworkMetadata(networkMeta: NetworkMetadataPayload): void {\n this.networkMeta = networkMeta;\n }\n\n @OnEvent(IndexerEvent.ApiConnected)\n handleApiConnected({ value }: EventPayload<number>): void {\n this.apiConnected = !!value;\n }\n\n @OnEvent(IndexerEvent.UsingDictionary)\n handleUsingDictionary({ value }: EventPayload<number>): void {\n this.usingDictionary = !!value;\n }\n\n @OnEvent('enqueueBlocks')\n handleEnqueueBlocks(size: number): void {\n this.accEnqueueBlocks += size;\n if (!this.lastStatsReportedTs) {\n this.lastStatsReportedTs = new Date();\n }\n }\n\n @OnEvent('filteringBlocks')\n handleFilteringBlocks(height: number): void {\n this.currentFilteringBlockNum = height;\n if (!this.lastStatsReportedTs) {\n this.lastReportedFilteringBlockNum = height;\n }\n }\n\n @OnEvent('fetchBlock')\n handleFetchBlock(): void {\n this.accFetchBlocks++;\n if (!this.lastStatsReportedTs) {\n this.lastStatsReportedTs = new Date();\n }\n }\n\n @OnEvent('rpcCall')\n handleRpcCall(): void {\n this.accRpcCalls++;\n if (!this.lastStatsReportedTs) {\n this.lastStatsReportedTs = new Date();\n }\n }\n\n @Interval(10000)\n blockFilteringSpeed(): void {\n if (!this.nodeConfig.profiler) {\n return;\n }\n const count = this.accEnqueueBlocks - this.lastReportedEnqueueBlocks;\n this.lastReportedEnqueueBlocks = this.accEnqueueBlocks;\n const filteringCount =\n this.currentFilteringBlockNum - this.lastReportedFilteringBlockNum;\n const now = new Date();\n const timepass = now.getTime() - this.lastStatsReportedTs.getTime();\n this.lastStatsReportedTs = now;\n this.lastReportedFilteringBlockNum = this.currentFilteringBlockNum;\n const rpcCalls = this.accRpcCalls - this.lastReportedRpcCalls;\n this.lastReportedRpcCalls = this.accRpcCalls;\n const fetchCount = this.accFetchBlocks - this.lastReportedFetchBlocks;\n this.lastReportedFetchBlocks = this.accFetchBlocks;\n logger.info(`actual block filtering: ${(count / (timepass / 1000)).toFixed(\n 2,\n )}/sec, \\\nseeming speed: ${(filteringCount / (timepass / 1000)).toFixed(\n 2,\n )}/sec, rpcCalls: ${(rpcCalls / (timepass / 1000)).toFixed(2)}/sec \\\nfetch speed: ${(fetchCount / (timepass / 1000)).toFixed(2)}/sec`);\n }\n}\n"]}
|
|
@@ -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,gDAA4C;AAC5C,oEAAgE;AAChE,6DAAyD;
|
|
1
|
+
{"version":3,"file":"forceClean.module.js","sourceRoot":"","sources":["../../src/subcommands/forceClean.module.ts"],"names":[],"mappings":";AAAA,gEAAgE;AAChE,sCAAsC;;;;;;;;;AAEtC,2CAAwC;AACxC,gDAA4C;AAC5C,oEAAgE;AAChE,6DAAyD;AAMzD,IAAa,uBAAuB,GAApC,MAAa,uBAAuB;CAAG,CAAA;AAA1B,uBAAuB;IAJnC,IAAA,eAAM,EAAC;QACN,SAAS,EAAE,CAAC,sCAAiB,CAAC;QAC9B,WAAW,EAAE,EAAE;KAChB,CAAC;GACW,uBAAuB,CAAG;AAA1B,0DAAuB;AAUpC,IAAa,gBAAgB,GAA7B,MAAa,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 { DbModule } from '@subql/node-core';\nimport { ConfigureModule } from '../configure/configure.module';\nimport { ForceCleanService } from './forceClean.service';\n\n@Module({\n providers: [ForceCleanService],\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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"forceClean.service.js","sourceRoot":"","sources":["../../src/subcommands/forceClean.service.ts"],"names":[],"mappings":";AAAA,gEAAgE;AAChE,sCAAsC;;;;;;;;;;;;;;;;;;AAEtC,4CAAoB;AACpB,2CAAoD;AACpD,gDAM0B;AAC1B,wCAAuD;AACvD,yCAAkD;AAClD,kEAA+D;AAE/D,MAAM,MAAM,GAAG,IAAA,qBAAS,EAAC,aAAa,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"forceClean.service.js","sourceRoot":"","sources":["../../src/subcommands/forceClean.service.ts"],"names":[],"mappings":";AAAA,gEAAgE;AAChE,sCAAsC;;;;;;;;;;;;;;;;;;AAEtC,4CAAoB;AACpB,2CAAoD;AACpD,gDAM0B;AAC1B,wCAAuD;AACvD,yCAAkD;AAClD,kEAA+D;AAE/D,MAAM,MAAM,GAAG,IAAA,qBAAS,EAAC,aAAa,CAAC,CAAC;AAGxC,IAAa,iBAAiB,GAA9B,MAAa,iBAAiB;IAC5B,YACmB,SAAoB,EACpB,UAAsB,EACD,OAAwB;QAF7C,cAAS,GAAT,SAAS,CAAW;QACpB,eAAU,GAAV,UAAU,CAAY;QACD,YAAO,GAAP,OAAO,CAAiB;IAC7D,CAAC;IAEJ,KAAK,CAAC,UAAU;QACd,MAAM,MAAM,GAAG,MAAM,IAAA,oCAAwB,EAC3C,IAAI,CAAC,UAAU,EACf,IAAI,CAAC,SAAS,CACf,CAAC;QACF,IAAI,CAAC,MAAM,EAAE;YACX,MAAM,CAAC,KAAK,CAAC,yBAAyB,CAAC,CAAC;YACxC,MAAM,IAAI,KAAK,CAAC,wBAAwB,CAAC,CAAC;SAC3C;QACD,MAAM,cAAc,GAAG,IAAA,+BAAuB,EAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QAEpE,IAAI;YACF,kDAAkD;YAClD,MAAM,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,IAAI,MAAM,GAAG,EAAE;gBAC7C,OAAO,EAAE,KAAK;gBACd,SAAS,EAAE,KAAK;aACjB,CAAC,CAAC;YAEH,yDAAyD;YACzD,qF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G,CAAC;SACX;IACH,CAAC;CACF,CAAA;AAzEY,iBAAiB;IAD7B,IAAA,mBAAU,GAAE;IAKR,WAAA,IAAA,eAAM,EAAC,kBAAkB,CAAC,CAAA;qCAFC,qBAAS;QACR,sBAAU;QACQ,iCAAe;GAJrD,iBAAiB,CAyE7B;AAzEY,8CAAiB","sourcesContent":["// Copyright 2020-2022 OnFinality Limited authors & contributors\n// SPDX-License-Identifier: Apache-2.0\n\nimport fs from 'fs';\nimport { Inject, Injectable } from '@nestjs/common';\nimport {\n getLogger,\n NodeConfig,\n getExistingProjectSchema,\n enumNameToHash,\n getEnumDeprecated,\n} from '@subql/node-core';\nimport { getAllEntitiesRelations } from '@subql/utils';\nimport { QueryTypes, Sequelize } from 'sequelize';\nimport { SubqueryProject } from '../configure/SubqueryProject';\n\nconst logger = getLogger('Force-clean');\n\n@Injectable()\nexport class ForceCleanService {\n constructor(\n private readonly sequelize: Sequelize,\n private readonly nodeConfig: NodeConfig,\n @Inject('ISubqueryProject') protected project: SubqueryProject,\n ) {}\n\n async forceClean(): Promise<void> {\n const schema = await getExistingProjectSchema(\n this.nodeConfig,\n this.sequelize,\n );\n if (!schema) {\n logger.error('Unable to locate schema');\n throw new Error('Schema does not exist.');\n }\n const modelsRelation = getAllEntitiesRelations(this.project.schema);\n\n try {\n // drop existing project schema and metadata table\n await this.sequelize.dropSchema(`\"${schema}\"`, {\n logging: false,\n benchmark: false,\n });\n\n // TODO, remove this soon, once original enum are cleaned\n // Deprecate, now enums are moved under schema, drop schema will remove project enums\n await Promise.all(\n modelsRelation.enums.map(async (e) => {\n const enumTypeNameDeprecated = `${schema}_enum_${enumNameToHash(\n e.name,\n )}`;\n const resultsDeprecated = await getEnumDeprecated(\n this.sequelize,\n enumTypeNameDeprecated,\n );\n if (resultsDeprecated.length !== 0) {\n await this.sequelize.query(`\n DROP TYPE \"${enumTypeNameDeprecated}\";\n `);\n }\n }),\n );\n\n // remove schema from subquery table (might not exist)\n const checker = await this.sequelize.query(\n `\n SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'public' AND TABLE_NAME = 'subqueries'`,\n );\n\n if ((checker[1] as any).rowCount > 0) {\n await this.sequelize.query(\n ` DELETE\n FROM public.subqueries\n WHERE name = :name`,\n {\n replacements: { name: this.nodeConfig.subqueryName },\n type: QueryTypes.DELETE,\n },\n );\n }\n\n logger.info('force cleaned schema and tables');\n\n if (fs.existsSync(this.nodeConfig.mmrPath)) {\n await fs.promises.unlink(this.nodeConfig.mmrPath);\n logger.info('force cleaned file based mmr');\n }\n } catch (err) {\n logger.error(err, 'failed to force clean');\n throw err;\n }\n }\n}\n"]}
|
|
@@ -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,gDAM0B;AAC1B,oEAAgE;AAChE,0EAAqE;AACrE,sEAAiE;AACjE,oFAAgF;AAChF,6DAAyD;AACzD,uDAAmD;
|
|
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,gDAM0B;AAC1B,oEAAgE;AAChE,0EAAqE;AACrE,sEAAiE;AACjE,oFAAgF;AAChF,6DAAyD;AACzD,uDAAmD;AAoBnD,IAAa,oBAAoB,GAAjC,MAAa,oBAAoB;CAAG,CAAA;AAAvB,oBAAoB;IAlBhC,IAAA,eAAM,EAAC;QACN,SAAS,EAAE;YACT,6BAAiB;YACjB,wBAAY;YACZ,gCAAc;YACd,sBAAU;YACV,sCAAiB;YACjB,oDAAwB;YACxB,qCAAgB;YAChB,yCAAkB;YAClB;gBACE,8EAA8E;gBAC9E,OAAO,EAAE,sBAAU;gBACnB,UAAU,EAAE,GAAG,EAAE,CAAC,SAAS;aAC5B;SACF;QACD,WAAW,EAAE,EAAE;KAChB,CAAC;GACW,oBAAoB,CAAG;AAAvB,oDAAoB;AAWjC,IAAa,aAAa,GAA1B,MAAa,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 {\n ApiService,\n DbModule,\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 { ForceCleanService } from './forceClean.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 ],\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"]}
|
|
@@ -72,8 +72,7 @@ let ReindexService = class ReindexService {
|
|
|
72
72
|
async initDbSchema() {
|
|
73
73
|
await (0, project_1.initDbSchema)(this.project, this.schema, this.storeService);
|
|
74
74
|
}
|
|
75
|
-
|
|
76
|
-
async getStartBlockFromDataSources() {
|
|
75
|
+
getStartBlockFromDataSources() {
|
|
77
76
|
const datasources = this.project.dataSources;
|
|
78
77
|
const startBlocksList = datasources.map((item) => { var _a; return (_a = item.startBlock) !== null && _a !== void 0 ? _a : 1; });
|
|
79
78
|
if (startBlocksList.length === 0) {
|
|
@@ -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;
|
|
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,CA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,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;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" | "store-get-cache-size"> & 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,29 +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
|
-
'store-get-cache-size': {
|
|
187
|
-
demandOption: false;
|
|
188
|
-
describe: string;
|
|
189
|
-
type: "number";
|
|
190
|
-
};
|
|
191
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,30 +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
|
-
'store-get-cache-size': {
|
|
226
|
-
demandOption: false,
|
|
227
|
-
describe: 'Store get cache size for each model',
|
|
228
|
-
type: 'number',
|
|
229
|
-
},
|
|
230
235
|
});
|
|
231
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,4E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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;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;IACD,sBAAsB,EAAE;QACtB,YAAY,EAAE,KAAK;QACnB,QAAQ,EAAE,qCAAqC;QAC/C,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 'store-get-cache-size': {\n demandOption: false,\n describe: 'Store get cache size for each model',\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,OAA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AG,EAAE;QACtB,QAAQ,EAAE,gDAAgD;QAC1D,IAAI,EAAE,QAAQ;KACf;IACD,eAAe,EAAE;QACf,UAAU,EAAE,IAAI;QAChB,YAAY,EAAE,KAAK;QACnB,QAAQ,EAAE,8BAA8B;QACxC,IAAI,EAAE,QAAQ;KACf;IACD,YAAY,EAAE;QACZ,YAAY,EAAE,KAAK;QACnB,QAAQ,EAAE,qDAAqD;QAC/D,IAAI,EAAE,SAAS;QACf,OAAO,EAAE,KAAK;KACf;IACD,OAAO,EAAE;QACP,YAAY,EAAE,KAAK;QACnB,QAAQ,EAAE,8DAA8D;QACxE,IAAI,EAAE,QAAQ;KACf;IACD,iBAAiB,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.
|
|
3
|
+
"version": "1.0.1-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.
|
|
28
|
-
"@subql/common-ethereum": "0.
|
|
29
|
-
"@subql/node-core": "1.
|
|
30
|
-
"@subql/types-ethereum": "0.
|
|
27
|
+
"@subql/common": "^1.8.1",
|
|
28
|
+
"@subql/common-ethereum": "1.0.0",
|
|
29
|
+
"@subql/node-core": "1.11.2-storeCache-0.0.4",
|
|
30
|
+
"@subql/types-ethereum": "1.0.1-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",
|
|
@@ -75,5 +75,5 @@
|
|
|
75
75
|
"/dist",
|
|
76
76
|
"/bin"
|
|
77
77
|
],
|
|
78
|
-
"stableVersion": "0.
|
|
79
|
-
}
|
|
78
|
+
"stableVersion": "1.0.0"
|
|
79
|
+
}
|