@subql/node-stellar 3.1.1-2 → 3.3.1-1

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.
@@ -3,5 +3,6 @@ import EventEmitter2 from 'eventemitter2';
3
3
  import { SubqueryProject } from '../configure/SubqueryProject';
4
4
  export declare class DictionaryService extends CoreDictionaryService {
5
5
  protected project: SubqueryProject;
6
- constructor(project: SubqueryProject, eventEmitter: EventEmitter2, nodeConfig: NodeConfig);
6
+ private constructor();
7
+ static create(project: SubqueryProject, nodeConfig: NodeConfig, eventEmitter: EventEmitter2): Promise<DictionaryService>;
7
8
  }
@@ -16,24 +16,31 @@ 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");
23
+ const common_2 = require("@subql/common");
22
24
  const node_core_1 = require("@subql/node-core");
23
25
  const eventemitter2_1 = __importDefault(require("eventemitter2"));
24
26
  const SubqueryProject_1 = require("../configure/SubqueryProject");
25
- let DictionaryService = class DictionaryService extends node_core_1.DictionaryService {
26
- constructor(project, eventEmitter, nodeConfig) {
27
- super(project.network.dictionary, project.network.chainId, nodeConfig, eventEmitter);
27
+ let DictionaryService = DictionaryService_1 = class DictionaryService extends node_core_1.DictionaryService {
28
+ constructor(project, eventEmitter, nodeConfig, dictionaryUrl) {
29
+ super(dictionaryUrl !== null && dictionaryUrl !== void 0 ? dictionaryUrl : project.network.dictionary, project.network.chainId, nodeConfig, eventEmitter);
28
30
  this.project = project;
29
31
  }
32
+ static async create(project, nodeConfig, eventEmitter) {
33
+ var _a;
34
+ const url = (_a = project.network.dictionary) !== null && _a !== void 0 ? _a : (await node_core_1.DictionaryService.resolveDictionary(common_2.NETWORK_FAMILY.stellar, project.network.chainId, nodeConfig.dictionaryRegistry));
35
+ return new DictionaryService_1(project, eventEmitter, nodeConfig, url);
36
+ }
30
37
  };
31
- DictionaryService = __decorate([
38
+ DictionaryService = DictionaryService_1 = __decorate([
32
39
  (0, common_1.Injectable)(),
33
40
  __param(0, (0, common_1.Inject)('ISubqueryProject')),
34
41
  __metadata("design:paramtypes", [SubqueryProject_1.SubqueryProject,
35
42
  eventemitter2_1.default,
36
- node_core_1.NodeConfig])
43
+ node_core_1.NodeConfig, String])
37
44
  ], DictionaryService);
38
45
  exports.DictionaryService = DictionaryService;
39
46
  //# sourceMappingURL=dictionary.service.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"dictionary.service.js","sourceRoot":"","sources":["../../src/indexer/dictionary.service.ts"],"names":[],"mappings":";AAAA,8DAA8D;AAC9D,mCAAmC;;;;;;;;;;;;;;;;;;AAEnC,2CAA2E;AAC3E,gDAG0B;AAC1B,kEAA0C;AAC1C,kEAA+D;AAGxD,IAAM,iBAAiB,GAAvB,MAAM,iBAAkB,SAAQ,6BAAqB;IAC1D,YACwC,OAAwB,EAC9D,YAA2B,EAC3B,UAAsB;QAEtB,KAAK,CACH,OAAO,CAAC,OAAO,CAAC,UAAU,EAC1B,OAAO,CAAC,OAAO,CAAC,OAAO,EACvB,UAAU,EACV,YAAY,CACb,CAAC;QAToC,YAAO,GAAP,OAAO,CAAiB;IAUhE,CAAC;CACF,CAAA;AAbY,iBAAiB;IAD7B,IAAA,mBAAU,GAAE;IAGR,WAAA,IAAA,eAAM,EAAC,kBAAkB,CAAC,CAAA;qCAAoB,iCAAe;QAChD,uBAAa;QACf,sBAAU;GAJb,iBAAiB,CAa7B;AAbY,8CAAiB","sourcesContent":["// Copyright 2020-2023 SubQuery Pte Ltd authors & contributors\n// SPDX-License-Identifier: GPL-3.0\n\nimport { Inject, Injectable, OnApplicationShutdown } from '@nestjs/common';\nimport {\n NodeConfig,\n DictionaryService as CoreDictionaryService,\n} from '@subql/node-core';\nimport EventEmitter2 from 'eventemitter2';\nimport { SubqueryProject } from '../configure/SubqueryProject';\n\n@Injectable()\nexport class DictionaryService extends CoreDictionaryService {\n constructor(\n @Inject('ISubqueryProject') protected project: SubqueryProject,\n eventEmitter: EventEmitter2,\n nodeConfig: NodeConfig,\n ) {\n super(\n project.network.dictionary,\n project.network.chainId,\n nodeConfig,\n eventEmitter,\n );\n }\n}\n"]}
1
+ {"version":3,"file":"dictionary.service.js","sourceRoot":"","sources":["../../src/indexer/dictionary.service.ts"],"names":[],"mappings":";AAAA,8DAA8D;AAC9D,mCAAmC;;;;;;;;;;;;;;;;;;;AAEnC,2CAAoD;AACpD,0CAA+C;AAC/C,gDAG0B;AAC1B,kEAA0C;AAC1C,kEAA+D;AAGxD,IAAM,iBAAiB,yBAAvB,MAAM,iBAAkB,SAAQ,6BAAqB;IAC1D,YACwC,OAAwB,EAC9D,YAA2B,EAC3B,UAAsB,EACtB,aAAsB;QAEtB,KAAK,CACH,aAAa,aAAb,aAAa,cAAb,aAAa,GAAI,OAAO,CAAC,OAAO,CAAC,UAAU,EAC3C,OAAO,CAAC,OAAO,CAAC,OAAO,EACvB,UAAU,EACV,YAAY,CACb,CAAC;QAVoC,YAAO,GAAP,OAAO,CAAiB;IAWhE,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,MAAM,CACjB,OAAwB,EACxB,UAAsB,EACtB,YAA2B;;QAE3B,MAAM,GAAG,GACP,MAAA,OAAO,CAAC,OAAO,CAAC,UAAU,mCAC1B,CAAC,MAAM,6BAAqB,CAAC,iBAAiB,CAC5C,uBAAc,CAAC,OAAO,EACtB,OAAO,CAAC,OAAO,CAAC,OAAO,EACvB,UAAU,CAAC,kBAAkB,CAC9B,CAAC,CAAC;QACL,OAAO,IAAI,mBAAiB,CAAC,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,GAAG,CAAC,CAAC;IACvE,CAAC;CACF,CAAA;AA7BY,iBAAiB;IAD7B,IAAA,mBAAU,GAAE;IAGR,WAAA,IAAA,eAAM,EAAC,kBAAkB,CAAC,CAAA;qCAAoB,iCAAe;QAChD,uBAAa;QACf,sBAAU;GAJb,iBAAiB,CA6B7B;AA7BY,8CAAiB","sourcesContent":["// Copyright 2020-2023 SubQuery Pte Ltd authors & contributors\n// SPDX-License-Identifier: GPL-3.0\n\nimport { Inject, Injectable } from '@nestjs/common';\nimport { NETWORK_FAMILY } from '@subql/common';\nimport {\n NodeConfig,\n DictionaryService as CoreDictionaryService,\n} from '@subql/node-core';\nimport EventEmitter2 from 'eventemitter2';\nimport { SubqueryProject } from '../configure/SubqueryProject';\n\n@Injectable()\nexport class DictionaryService extends CoreDictionaryService {\n private constructor(\n @Inject('ISubqueryProject') protected project: SubqueryProject,\n eventEmitter: EventEmitter2,\n nodeConfig: NodeConfig,\n dictionaryUrl?: string,\n ) {\n super(\n dictionaryUrl ?? project.network.dictionary,\n project.network.chainId,\n nodeConfig,\n eventEmitter,\n );\n }\n\n static async create(\n project: SubqueryProject,\n nodeConfig: NodeConfig,\n eventEmitter: EventEmitter2,\n ): Promise<DictionaryService> {\n const url =\n project.network.dictionary ??\n (await CoreDictionaryService.resolveDictionary(\n NETWORK_FAMILY.stellar,\n project.network.chainId,\n nodeConfig.dictionaryRegistry,\n ));\n return new DictionaryService(project, eventEmitter, nodeConfig, url);\n }\n}\n"]}
@@ -81,7 +81,14 @@ FetchModule = __decorate([
81
81
  fetch_service_1.FetchService,
82
82
  node_core_1.IndexingBenchmarkService,
83
83
  node_core_1.PoiBenchmarkService,
84
- dictionary_service_1.DictionaryService,
84
+ {
85
+ provide: dictionary_service_1.DictionaryService,
86
+ useFactory: async (project, nodeConfig, eventEmitter) => {
87
+ const dictionaryService = await dictionary_service_1.DictionaryService.create(project, nodeConfig, eventEmitter);
88
+ return dictionaryService;
89
+ },
90
+ inject: ['ISubqueryProject', node_core_1.NodeConfig, event_emitter_1.EventEmitter2],
91
+ },
85
92
  sandbox_service_1.SandboxService,
86
93
  ds_processor_service_1.DsProcessorService,
87
94
  dynamic_ds_service_1.DynamicDsService,
@@ -1 +1 @@
1
- {"version":3,"file":"fetch.module.js","sourceRoot":"","sources":["../../src/indexer/fetch.module.ts"],"names":[],"mappings":";AAAA,8DAA8D;AAC9D,mCAAmC;;;;;;;;;AAEnC,2CAAwC;AACxC,yDAAsD;AACtD,gDAe0B;AAG1B,wEAAmE;AACnE,uDAG2B;AAC3B,6DAAyD;AACzD,iEAA4D;AAC5D,6DAAwD;AACxD,mDAA+C;AAC/C,uDAAmD;AACnD,uDAAmD;AACnD,uDAAmD;AACnD,2EAAuE;AAiIhE,IAAM,WAAW,GAAjB,MAAM,WAAW;CAAG,CAAA;AAAd,WAAW;IA/HvB,IAAA,eAAM,EAAC;QACN,SAAS,EAAE;YACT,gCAAoB;YACpB,wBAAY;YACZ,6BAAiB;YACjB;gBACE,OAAO,EAAE,sBAAU;gBACnB,UAAU,EAAE,KAAK,EACf,OAAwB,EACxB,qBAA2C,EAC3C,qBAAkE,EAClE,YAA2B,EAC3B,EAAE;oBACF,MAAM,UAAU,GAAG,IAAI,uCAAiB,CACtC,OAAO,EACP,qBAAqB,EACrB,qBAAqB,EACrB,YAAY,CACb,CAAC;oBACF,MAAM,UAAU,CAAC,IAAI,EAAE,CAAC;oBACxB,OAAO,UAAU,CAAC;gBACpB,CAAC;gBACD,MAAM,EAAE;oBACN,kBAAkB;oBAClB,wBAAwB;oBACxB,iCAAqB;oBACrB,6BAAa;iBACd;aACF;YACD,gCAAc;YACd,iCAAqB;YACrB,sCAA0B;YAC1B;gBACE,OAAO,EAAE,6BAAiB;gBAC1B,UAAU,EAAE,CAAC,UAAsB,EAAE,EAAE;oBACrC,OAAO,IAAI,6BAAiB,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;gBACrD,CAAC;gBACD,MAAM,EAAE,CAAC,sBAAU,CAAC;aACrB;YACD;gBACE,OAAO,EAAE,kBAAkB;gBAC3B,UAAU,EAAE,CACV,UAAsB,EACtB,YAA2B,EAC3B,cAA8B,EAC9B,qB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uery Pte Ltd authors & contributors\n// SPDX-License-Identifier: GPL-3.0\n\nimport { Module } from '@nestjs/common';\nimport { EventEmitter2 } from '@nestjs/event-emitter';\nimport {\n PoiBenchmarkService,\n IndexingBenchmarkService,\n StoreService,\n PoiService,\n PoiSyncService,\n ApiService,\n ConnectionPoolService,\n SmartBatchService,\n StoreCacheService,\n ConnectionPoolStateManager,\n NodeConfig,\n IProjectUpgradeService,\n ProjectUpgradeSevice,\n InMemoryCacheService,\n} from '@subql/node-core';\nimport { SubqueryProject } from '../configure/SubqueryProject';\nimport { StellarApiConnection } from '../stellar/api.connection';\nimport { StellarApiService } from '../stellar/api.service.stellar';\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 InMemoryCacheService,\n StoreService,\n StoreCacheService,\n {\n provide: ApiService,\n useFactory: async (\n project: SubqueryProject,\n projectUpgradeService: ProjectUpgradeSevice,\n connectionPoolService: ConnectionPoolService<StellarApiConnection>,\n eventEmitter: EventEmitter2,\n ) => {\n const apiService = new StellarApiService(\n project,\n projectUpgradeService,\n connectionPoolService,\n eventEmitter,\n );\n await apiService.init();\n return apiService;\n },\n inject: [\n 'ISubqueryProject',\n 'IProjectUpgradeService',\n ConnectionPoolService,\n EventEmitter2,\n ],\n },\n IndexerManager,\n ConnectionPoolService,\n ConnectionPoolStateManager,\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 projectUpgradeService: IProjectUpgradeService,\n apiService: ApiService,\n indexerManager: IndexerManager,\n smartBatchService: SmartBatchService,\n cacheService: InMemoryCacheService,\n storeService: StoreService,\n storeCacheService: StoreCacheService,\n poiService: PoiService,\n poiSyncService: PoiSyncService,\n project: SubqueryProject,\n dynamicDsService: DynamicDsService,\n unfinalizedBlocks: UnfinalizedBlocksService,\n connectionPoolState: ConnectionPoolStateManager<StellarApiConnection>,\n ) =>\n nodeConfig.workers !== undefined\n ? new WorkerBlockDispatcherService(\n nodeConfig,\n eventEmitter,\n projectService,\n projectUpgradeService,\n smartBatchService,\n cacheService,\n storeService,\n storeCacheService,\n poiService,\n poiSyncService,\n project,\n dynamicDsService,\n unfinalizedBlocks,\n connectionPoolState,\n )\n : new BlockDispatcherService(\n apiService,\n nodeConfig,\n indexerManager,\n eventEmitter,\n projectService,\n projectUpgradeService,\n smartBatchService,\n storeService,\n storeCacheService,\n poiService,\n poiSyncService,\n project,\n dynamicDsService,\n ),\n inject: [\n NodeConfig,\n EventEmitter2,\n 'IProjectService',\n 'IProjectUpgradeService',\n ApiService,\n IndexerManager,\n SmartBatchService,\n InMemoryCacheService,\n StoreService,\n StoreCacheService,\n PoiService,\n PoiSyncService,\n 'ISubqueryProject',\n DynamicDsService,\n UnfinalizedBlocksService,\n ConnectionPoolStateManager,\n ],\n },\n FetchService,\n IndexingBenchmarkService,\n PoiBenchmarkService,\n DictionaryService,\n SandboxService,\n DsProcessorService,\n DynamicDsService,\n PoiService,\n PoiSyncService,\n {\n useClass: ProjectService,\n provide: 'IProjectService',\n },\n UnfinalizedBlocksService,\n ],\n exports: [StoreService, StoreCacheService],\n})\nexport class FetchModule {}\n"]}
1
+ {"version":3,"file":"fetch.module.js","sourceRoot":"","sources":["../../src/indexer/fetch.module.ts"],"names":[],"mappings":";AAAA,8DAA8D;AAC9D,mCAAmC;;;;;;;;;AAEnC,2CAAwC;AACxC,yDAAsD;AACtD,gDAe0B;AAG1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C,wBAAY,EAAE,6BAAiB,CAAC;KAC3C,CAAC;GACW,WAAW,CAAG;AAAd,kCAAW","sourcesContent":["// Copyright 2020-2023 SubQuery Pte Ltd authors & contributors\n// SPDX-License-Identifier: GPL-3.0\n\nimport { Module } from '@nestjs/common';\nimport { EventEmitter2 } from '@nestjs/event-emitter';\nimport {\n PoiBenchmarkService,\n IndexingBenchmarkService,\n StoreService,\n PoiService,\n PoiSyncService,\n ApiService,\n ConnectionPoolService,\n SmartBatchService,\n StoreCacheService,\n ConnectionPoolStateManager,\n NodeConfig,\n IProjectUpgradeService,\n ProjectUpgradeSevice,\n InMemoryCacheService,\n} from '@subql/node-core';\nimport { SubqueryProject } from '../configure/SubqueryProject';\nimport { StellarApiConnection } from '../stellar/api.connection';\nimport { StellarApiService } from '../stellar/api.service.stellar';\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 InMemoryCacheService,\n StoreService,\n StoreCacheService,\n {\n provide: ApiService,\n useFactory: async (\n project: SubqueryProject,\n projectUpgradeService: ProjectUpgradeSevice,\n connectionPoolService: ConnectionPoolService<StellarApiConnection>,\n eventEmitter: EventEmitter2,\n ) => {\n const apiService = new StellarApiService(\n project,\n projectUpgradeService,\n connectionPoolService,\n eventEmitter,\n );\n await apiService.init();\n return apiService;\n },\n inject: [\n 'ISubqueryProject',\n 'IProjectUpgradeService',\n ConnectionPoolService,\n EventEmitter2,\n ],\n },\n IndexerManager,\n ConnectionPoolService,\n ConnectionPoolStateManager,\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 projectUpgradeService: IProjectUpgradeService,\n apiService: ApiService,\n indexerManager: IndexerManager,\n smartBatchService: SmartBatchService,\n cacheService: InMemoryCacheService,\n storeService: StoreService,\n storeCacheService: StoreCacheService,\n poiService: PoiService,\n poiSyncService: PoiSyncService,\n project: SubqueryProject,\n dynamicDsService: DynamicDsService,\n unfinalizedBlocks: UnfinalizedBlocksService,\n connectionPoolState: ConnectionPoolStateManager<StellarApiConnection>,\n ) =>\n nodeConfig.workers !== undefined\n ? new WorkerBlockDispatcherService(\n nodeConfig,\n eventEmitter,\n projectService,\n projectUpgradeService,\n smartBatchService,\n cacheService,\n storeService,\n storeCacheService,\n poiService,\n poiSyncService,\n project,\n dynamicDsService,\n unfinalizedBlocks,\n connectionPoolState,\n )\n : new BlockDispatcherService(\n apiService,\n nodeConfig,\n indexerManager,\n eventEmitter,\n projectService,\n projectUpgradeService,\n smartBatchService,\n storeService,\n storeCacheService,\n poiService,\n poiSyncService,\n project,\n dynamicDsService,\n ),\n inject: [\n NodeConfig,\n EventEmitter2,\n 'IProjectService',\n 'IProjectUpgradeService',\n ApiService,\n IndexerManager,\n SmartBatchService,\n InMemoryCacheService,\n StoreService,\n StoreCacheService,\n PoiService,\n PoiSyncService,\n 'ISubqueryProject',\n DynamicDsService,\n UnfinalizedBlocksService,\n ConnectionPoolStateManager,\n ],\n },\n FetchService,\n IndexingBenchmarkService,\n PoiBenchmarkService,\n {\n provide: DictionaryService,\n useFactory: async (\n project: SubqueryProject,\n nodeConfig: NodeConfig,\n eventEmitter: EventEmitter2,\n ) => {\n const dictionaryService = await DictionaryService.create(\n project,\n nodeConfig,\n eventEmitter,\n );\n return dictionaryService;\n },\n inject: ['ISubqueryProject', NodeConfig, EventEmitter2],\n },\n SandboxService,\n DsProcessorService,\n DynamicDsService,\n PoiService,\n PoiSyncService,\n {\n useClass: ProjectService,\n provide: 'IProjectService',\n },\n UnfinalizedBlocksService,\n ],\n exports: [StoreService, StoreCacheService],\n})\nexport class FetchModule {}\n"]}
package/dist/yargs.d.ts CHANGED
@@ -1,232 +1 @@
1
- export declare const yargsOptions: import("yargs").Argv<import("yargs").Omit<{
2
- targetHeight: number;
3
- }, "batch-size" | "block-confirmations" | "config" | "db-schema" | "debug" | "dictionary-resolver" | "dictionary-timeout" | "disable-historical" | "ipfs" | "local" | "log-level" | "mmr-path" | "multi-chain" | "network-dictionary" | "network-endpoint" | "soroban-network-endpoint" | "output-fmt" | "port" | "profiler" | "proof-of-index" | "mmr-store-type" | "query-limit" | "scale-batch-size" | "pg-ca" | "pg-key" | "pg-cert" | "store-cache-threshold" | "store-cache-upper-limit" | "store-get-cache-size" | "store-cache-async" | "store-flush-interval" | "subquery" | "subquery-name" | "subscription" | "timeout" | "timestamp-field" | "unfinalized-blocks" | "unsafe" | "workers" | "root" | "query-address-limit"> & import("yargs").InferredOptionTypes<{
4
- 'batch-size': {
5
- demandOption: false;
6
- describe: string;
7
- type: "number";
8
- };
9
- 'block-confirmations': {
10
- demandOption: false;
11
- default: number;
12
- describe: string;
13
- type: "number";
14
- };
15
- config: {
16
- alias: string;
17
- demandOption: false;
18
- describe: string;
19
- type: "string";
20
- };
21
- 'db-schema': {
22
- demandOption: false;
23
- describe: string;
24
- type: "string";
25
- };
26
- debug: {
27
- demandOption: false;
28
- describe: string;
29
- type: "string";
30
- };
31
- 'dictionary-resolver': {
32
- demandOption: false;
33
- describe: string;
34
- type: "string";
35
- };
36
- 'dictionary-timeout': {
37
- demandOption: false;
38
- describe: string;
39
- type: "number";
40
- };
41
- 'disable-historical': {
42
- demandOption: false;
43
- default: boolean;
44
- describe: string;
45
- type: "boolean";
46
- };
47
- ipfs: {
48
- demandOption: false;
49
- describe: string;
50
- type: "string";
51
- };
52
- local: {
53
- deprecated: true;
54
- type: "boolean";
55
- demandOption: false;
56
- describe: string;
57
- };
58
- 'log-level': {
59
- demandOption: false;
60
- describe: string;
61
- type: "string";
62
- choices: string[];
63
- };
64
- 'mmr-path': {
65
- alias: string;
66
- demandOption: false;
67
- describe: string;
68
- type: "string";
69
- };
70
- 'multi-chain': {
71
- demandOption: false;
72
- default: boolean;
73
- describe: string;
74
- type: "boolean";
75
- };
76
- 'network-dictionary': {
77
- alias: string;
78
- demandOption: false;
79
- describe: string;
80
- type: "string";
81
- };
82
- 'network-endpoint': {
83
- demandOption: false;
84
- type: "string";
85
- describe: string;
86
- };
87
- 'soroban-network-endpoint': {
88
- demandOption: false;
89
- type: "string";
90
- describe: string;
91
- };
92
- 'output-fmt': {
93
- demandOption: false;
94
- describe: string;
95
- type: "string";
96
- choices: string[];
97
- };
98
- port: {
99
- alias: string;
100
- demandOption: false;
101
- describe: string;
102
- type: "number";
103
- };
104
- profiler: {
105
- demandOption: false;
106
- describe: string;
107
- type: "boolean";
108
- default: boolean;
109
- };
110
- 'proof-of-index': {
111
- demandOption: false;
112
- describe: string;
113
- type: "boolean";
114
- default: boolean;
115
- };
116
- 'mmr-store-type': {
117
- demandOption: false;
118
- describe: string;
119
- type: "string";
120
- choices: string[];
121
- default: string;
122
- };
123
- 'query-limit': {
124
- demandOption: false;
125
- describe: string;
126
- type: "number";
127
- default: number;
128
- };
129
- 'scale-batch-size': {
130
- type: "boolean";
131
- demandOption: false;
132
- describe: string;
133
- default: boolean;
134
- };
135
- 'pg-ca': {
136
- demandOption: false;
137
- describe: string;
138
- type: "string";
139
- };
140
- 'pg-key': {
141
- demandOption: false;
142
- describe: string;
143
- type: "string";
144
- };
145
- 'pg-cert': {
146
- demandOption: false;
147
- describe: string;
148
- type: "string";
149
- };
150
- 'store-cache-threshold': {
151
- demandOption: false;
152
- describe: string;
153
- type: "number";
154
- };
155
- 'store-cache-upper-limit': {
156
- demandOption: false;
157
- describe: string;
158
- type: "number";
159
- };
160
- 'store-get-cache-size': {
161
- demandOption: false;
162
- describe: string;
163
- type: "number";
164
- };
165
- 'store-cache-async': {
166
- demandOption: false;
167
- describe: string;
168
- type: "boolean";
169
- };
170
- 'store-flush-interval': {
171
- demandOption: false;
172
- describe: string;
173
- type: "number";
174
- default: number;
175
- };
176
- subquery: {
177
- alias: string;
178
- demandOption: true;
179
- default: string;
180
- describe: string;
181
- type: "string";
182
- };
183
- 'subquery-name': {
184
- deprecated: true;
185
- demandOption: false;
186
- describe: string;
187
- type: "string";
188
- };
189
- subscription: {
190
- demandOption: false;
191
- describe: string;
192
- type: "boolean";
193
- default: boolean;
194
- };
195
- timeout: {
196
- demandOption: false;
197
- describe: string;
198
- type: "number";
199
- };
200
- 'timestamp-field': {
201
- demandOption: false;
202
- describe: string;
203
- type: "boolean";
204
- default: boolean;
205
- };
206
- 'unfinalized-blocks': {
207
- demandOption: false;
208
- default: boolean;
209
- describe: string;
210
- type: "boolean";
211
- };
212
- unsafe: {
213
- type: "boolean";
214
- demandOption: false;
215
- describe: string;
216
- };
217
- workers: {
218
- alias: string;
219
- demandOption: false;
220
- describe: string;
221
- type: "number";
222
- };
223
- root: {
224
- describe: string;
225
- type: "string";
226
- };
227
- 'query-address-limit': {
228
- describe: string;
229
- type: "number";
230
- default: number;
231
- };
232
- }>>;
1
+ export declare const yargsOptions: any;
package/dist/yargs.js CHANGED
@@ -1,286 +1,34 @@
1
1
  "use strict";
2
2
  // Copyright 2020-2023 SubQuery Pte Ltd authors & contributors
3
3
  // SPDX-License-Identifier: GPL-3.0
4
- var __importDefault = (this && this.__importDefault) || function (mod) {
5
- return (mod && mod.__esModule) ? mod : { "default": mod };
6
- };
7
4
  Object.defineProperty(exports, "__esModule", { value: true });
8
5
  exports.yargsOptions = void 0;
9
- const logger_1 = require("@subql/node-core/logger");
10
- const helpers_1 = require("yargs/helpers");
11
- const yargs_1 = __importDefault(require("yargs/yargs"));
12
- exports.yargsOptions = (0, yargs_1.default)((0, helpers_1.hideBin)(process.argv))
13
- .env('SUBQL_NODE')
14
- .command({
15
- command: 'test',
16
- describe: 'Run tests for a SubQuery application',
17
- builder: {},
18
- handler: (argv) => {
19
- (0, logger_1.initLogger)(argv.debug, argv.outputFmt, argv.logLevel);
6
+ const yargs_1 = require("@subql/node-core/yargs");
7
+ exports.yargsOptions = (0, yargs_1.yargsBuilder)({
8
+ initTesting: () => {
20
9
  // lazy import to make sure logger is instantiated before all other services
21
10
  // eslint-disable-next-line @typescript-eslint/no-var-requires
22
11
  const { testingInit } = require('./subcommands/testing.init');
23
12
  return testingInit();
24
13
  },
25
- })
26
- .command({
27
- command: 'force-clean',
28
- describe: 'Clean the database dropping project schemas and tables. Once the command is executed, the application would exit upon completion.',
29
- builder: {},
30
- handler: (argv) => {
31
- (0, logger_1.initLogger)(argv.debug, argv.outputFmt, argv.logLevel);
14
+ initForceClean: () => {
32
15
  // lazy import to make sure logger is instantiated before all other services
33
16
  // eslint-disable-next-line @typescript-eslint/no-var-requires
34
17
  const { forceCleanInit } = require('./subcommands/forceClean.init');
35
18
  return forceCleanInit();
36
19
  },
37
- })
38
- .command({
39
- command: 'reindex',
40
- describe: '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.',
41
- builder: (yargs) => yargs.options('targetHeight', {
42
- type: 'number',
43
- description: 'set targetHeight',
44
- require: true,
45
- }),
46
- handler: (argv) => {
47
- (0, logger_1.initLogger)(argv.debug, argv.outputFmt, argv.logLevel);
20
+ initReindex: (targetHeight) => {
48
21
  // lazy import to make sure logger is instantiated before all other services
49
22
  // eslint-disable-next-line @typescript-eslint/no-var-requires
50
23
  const { reindexInit } = require('./subcommands/reindex.init');
51
- return reindexInit(argv.targetHeight);
24
+ return reindexInit(targetHeight);
52
25
  },
53
- })
54
- .options({
55
- 'batch-size': {
56
- demandOption: false,
57
- describe: 'Batch size of blocks to fetch in one round',
58
- type: 'number',
26
+ rootOptions: {
27
+ 'soroban-network-endpoint': {
28
+ demandOption: false,
29
+ type: 'string',
30
+ describe: 'Blockchain network endpoint to connect',
31
+ },
59
32
  },
60
- 'block-confirmations': {
61
- demandOption: false,
62
- default: 20,
63
- describe: 'The number of blocks behind the head to be considered finalized, this has no effect with Ethereum',
64
- type: 'number',
65
- },
66
- config: {
67
- alias: 'c',
68
- demandOption: false,
69
- describe: 'Specify configuration file',
70
- type: 'string',
71
- },
72
- 'db-schema': {
73
- demandOption: false,
74
- describe: 'Db schema name of the project',
75
- type: 'string',
76
- },
77
- debug: {
78
- demandOption: false,
79
- describe: `Enable debug logging for specific scopes, this will override log-level. "*" will enable debug everywhere, or comma separated strings for specific scopes. e.g. "SQL,dictionary". To disable specific scopes you can prefix them with '-'. e.g. "*,-SQL"`,
80
- type: 'string',
81
- },
82
- 'dictionary-resolver': {
83
- demandOption: false,
84
- describe: 'Use SubQuery Network dictionary resolver',
85
- type: 'string',
86
- },
87
- 'dictionary-timeout': {
88
- demandOption: false,
89
- describe: 'Max timeout for dictionary query',
90
- type: 'number',
91
- },
92
- 'disable-historical': {
93
- demandOption: false,
94
- default: false,
95
- describe: 'Disable storing historical state entities',
96
- type: 'boolean',
97
- },
98
- ipfs: {
99
- demandOption: false,
100
- describe: 'IPFS gateway endpoint',
101
- type: 'string',
102
- },
103
- local: {
104
- deprecated: true,
105
- type: 'boolean',
106
- demandOption: false,
107
- describe: 'Use local mode',
108
- },
109
- 'log-level': {
110
- demandOption: false,
111
- describe: 'Specify log level to print. Ignored when --debug is used',
112
- type: 'string',
113
- choices: ['fatal', 'error', 'warn', 'info', 'debug', 'trace', 'silent'],
114
- },
115
- 'mmr-path': {
116
- alias: 'm',
117
- demandOption: false,
118
- describe: 'Local path of the merkle mountain range (.mmr) file',
119
- type: 'string',
120
- },
121
- 'multi-chain': {
122
- demandOption: false,
123
- default: false,
124
- describe: 'Enables indexing multiple subquery projects into the same database schema',
125
- type: 'boolean',
126
- },
127
- 'network-dictionary': {
128
- alias: 'd',
129
- demandOption: false,
130
- describe: 'Specify the dictionary api for this network',
131
- type: 'string',
132
- },
133
- 'network-endpoint': {
134
- demandOption: false,
135
- type: 'string',
136
- describe: 'Blockchain network endpoint to connect',
137
- },
138
- 'soroban-network-endpoint': {
139
- demandOption: false,
140
- type: 'string',
141
- describe: 'Blockchain network endpoint to connect',
142
- },
143
- 'output-fmt': {
144
- demandOption: false,
145
- describe: 'Print log as json or plain text',
146
- type: 'string',
147
- choices: ['json', 'colored'],
148
- },
149
- port: {
150
- alias: 'p',
151
- demandOption: false,
152
- describe: 'The port the service will bind to',
153
- type: 'number',
154
- },
155
- profiler: {
156
- demandOption: false,
157
- describe: 'Show profiler information to console output',
158
- type: 'boolean',
159
- default: false,
160
- },
161
- 'proof-of-index': {
162
- demandOption: false,
163
- describe: 'Enable/disable proof of index',
164
- type: 'boolean',
165
- default: false,
166
- },
167
- 'mmr-store-type': {
168
- demandOption: false,
169
- describe: 'Store MMR in either a file or a postgres DB',
170
- type: 'string',
171
- choices: ['file', 'postgres'],
172
- default: 'postgres',
173
- },
174
- 'query-limit': {
175
- demandOption: false,
176
- describe: 'The limit of items a project can query with store.getByField at once',
177
- type: 'number',
178
- default: 100,
179
- },
180
- 'scale-batch-size': {
181
- type: 'boolean',
182
- demandOption: false,
183
- describe: 'scale batch size based on memory usage',
184
- default: false,
185
- },
186
- 'pg-ca': {
187
- demandOption: false,
188
- describe: 'Postgres ca certificate - to enable TLS/SSL connections to your PostgreSQL, path to the server certificate file are required, e.g /path/to/server-certificates/root.crt',
189
- type: 'string',
190
- },
191
- 'pg-key': {
192
- demandOption: false,
193
- describe: 'Postgres client key - Path to key file e.g /path/to/client-key/postgresql.key',
194
- type: 'string',
195
- },
196
- 'pg-cert': {
197
- demandOption: false,
198
- describe: 'Postgres client certificate - Path to client certificate e.g /path/to/client-certificates/postgresql.crt',
199
- type: 'string',
200
- },
201
- 'store-cache-threshold': {
202
- demandOption: false,
203
- describe: 'Store cache will flush data to the database when number of records excess this threshold',
204
- type: 'number',
205
- },
206
- 'store-cache-upper-limit': {
207
- demandOption: false,
208
- describe: 'Defines the upper limit to the store cache size. When this limit is reached indexing will wait for the cache to be flushed before continuing.',
209
- type: 'number',
210
- },
211
- 'store-get-cache-size': {
212
- demandOption: false,
213
- describe: 'Store get cache size for each model',
214
- type: 'number',
215
- },
216
- 'store-cache-async': {
217
- demandOption: false,
218
- describe: 'If enabled the store cache will flush data asyncronously relative to indexing data',
219
- type: 'boolean',
220
- },
221
- 'store-flush-interval': {
222
- demandOption: false,
223
- describe: 'The interval, in seconds, at which data is flushed from the cache. ' +
224
- 'This ensures that data is persisted regularly when there is either not much data or the project is up to date.',
225
- type: 'number',
226
- default: 5,
227
- },
228
- subquery: {
229
- alias: 'f',
230
- demandOption: true,
231
- default: process.cwd(),
232
- describe: 'Local path or IPFS cid of the subquery project',
233
- type: 'string',
234
- },
235
- 'subquery-name': {
236
- deprecated: true,
237
- demandOption: false,
238
- describe: 'Name of the subquery project',
239
- type: 'string',
240
- },
241
- subscription: {
242
- demandOption: false,
243
- describe: 'Enable subscription by create notification triggers',
244
- type: 'boolean',
245
- default: false,
246
- },
247
- timeout: {
248
- demandOption: false,
249
- describe: 'Timeout for indexer sandbox to execute the mapping functions',
250
- type: 'number',
251
- },
252
- 'timestamp-field': {
253
- demandOption: false,
254
- describe: 'Enable/disable created_at and updated_at in schema',
255
- type: 'boolean',
256
- default: false,
257
- },
258
- 'unfinalized-blocks': {
259
- demandOption: false,
260
- default: false,
261
- describe: 'Enable to fetch and index unfinalized blocks',
262
- type: 'boolean',
263
- },
264
- unsafe: {
265
- type: 'boolean',
266
- demandOption: false,
267
- describe: 'Allows usage of any built-in module within the sandbox',
268
- },
269
- workers: {
270
- alias: 'w',
271
- demandOption: false,
272
- describe: 'Number of worker threads to use for fetching and processing blocks. Disabled by default.',
273
- type: 'number',
274
- },
275
- root: {
276
- describe: 'This is a hidden flag only used from the main thread to workers. It provides a root directory for the project. This is a temp directory with IPFS and GitHub projects.',
277
- type: 'string',
278
- },
279
- 'query-address-limit': {
280
- describe: 'Set the limit for address on dictionary queries for dynamic datasources',
281
- type: 'number',
282
- default: 100,
283
- },
284
- })
285
- .hide('root'); // root is hidden because its for internal use
33
+ });
286
34
  //# sourceMappingURL=yargs.js.map