Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up deps, remove deprecated types #110

Merged
merged 2 commits into from
May 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions packages/node/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed
- Update dependencies and apply changes to match (#109)

### Removed
- Unused deps and deprecated type (#110)

## [3.10.0] - 2024-04-10
### Changed
- Updated with node-core. Now dictionary supports multiple endpoints, indexer will fetch and switch dictionaries based on available blocks
Expand Down
6 changes: 0 additions & 6 deletions packages/node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
"subql-node-near": "./bin/run"
},
"dependencies": {
"@apollo/client": "3.5.8",
"@nestjs/common": "^9.4.0",
"@nestjs/core": "^9.4.0",
"@nestjs/event-emitter": "^2.0.0",
Expand All @@ -30,15 +29,10 @@
"@subql/node-core": "^10.0.0",
"@subql/types-near": "workspace:*",
"cron-converter": "^1.0.2",
"eventemitter2": "^6.4.5",
"lodash": "^4.17.21",
"near-api-js": "^2.1.4",
"pg": "^8.7.1",
"reflect-metadata": "^0.1.13",
"rimraf": "^3.0.2",
"rxjs": "^7.5.2",
"tar": "^6.2.1",
"vm2": "^3.9.9",
"yargs": "^16.2.0"
},
"peerDependencies": {
Expand Down
15 changes: 6 additions & 9 deletions packages/node/src/configure/SubqueryProject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { validateSemver } from '@subql/common';
import {
NearProjectNetworkConfig,
parseNearProjectManifest,
NearDataSource,
ProjectManifestV1_0_0Impl,
NearBlockFilter,
isRuntimeDs,
Expand All @@ -17,11 +16,11 @@ import {
import {
insertBlockFiltersCronSchedules,
loadProjectTemplates,
SubqlProjectDs,
updateDataSourcesV1_0_0,
} from '@subql/node-core';
import { ParentProject, Reader, RunnerSpecs } from '@subql/types-core';
import {
NearDatasource,
CustomDatasourceTemplate,
RuntimeDatasourceTemplate,
} from '@subql/types-near';
Expand All @@ -31,8 +30,6 @@ import { GraphQLSchema } from 'graphql';

const { version: packageVersion } = require('../../package.json');

export type NearProjectDs = SubqlProjectDs<NearDataSource>;

export type SubqlProjectBlockFilter = NearBlockFilter & {
cronSchedule?: {
schedule: Cron.Seeker;
Expand All @@ -41,8 +38,8 @@ export type SubqlProjectBlockFilter = NearBlockFilter & {
};

export type NearProjectDsTemplate =
| SubqlProjectDs<RuntimeDatasourceTemplate>
| SubqlProjectDs<CustomDatasourceTemplate>;
| RuntimeDatasourceTemplate
| CustomDatasourceTemplate;

const NOT_SUPPORT = (name: string) => {
throw new Error(`Manifest specVersion ${name} is not supported`);
Expand All @@ -53,13 +50,13 @@ type NetworkConfig = NearProjectNetworkConfig & { chainId: string };

@Injectable()
export class SubqueryProject {
#dataSources: NearProjectDs[];
#dataSources: NearDatasource[];

constructor(
readonly id: string,
readonly root: string,
readonly network: NetworkConfig,
dataSources: NearProjectDs[],
dataSources: NearDatasource[],
readonly schema: GraphQLSchema,
readonly templates: NearProjectDsTemplate[],
readonly runner?: RunnerSpecs,
Expand All @@ -68,7 +65,7 @@ export class SubqueryProject {
this.#dataSources = dataSources;
}

get dataSources(): NearProjectDs[] {
get dataSources(): NearDatasource[] {
return this.#dataSources;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,8 @@ import {
PoiSyncService,
IBlock,
} from '@subql/node-core';
import {
NearProjectDs,
SubqueryProject,
} from '../../configure/SubqueryProject';
import { NearDatasource } from '@subql/types-near';
import { SubqueryProject } from '../../configure/SubqueryProject';
import { ApiService } from '../api.service';
import { IndexerManager } from '../indexer.manager';
import { BlockContent } from '../types';
Expand All @@ -27,15 +25,15 @@ import { BlockContent } from '../types';
*/
@Injectable()
export class BlockDispatcherService
extends BlockDispatcher<BlockContent, NearProjectDs>
extends BlockDispatcher<BlockContent, NearDatasource>
implements OnApplicationShutdown
{
constructor(
private apiService: ApiService,
nodeConfig: NodeConfig,
private indexerManager: IndexerManager,
eventEmitter: EventEmitter2,
@Inject('IProjectService') projectService: IProjectService<NearProjectDs>,
@Inject('IProjectService') projectService: IProjectService<NearDatasource>,
@Inject('IProjectUpgradeService')
projectUpgradeService: IProjectUpgradeService,
storeService: StoreService,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,7 @@ import {
createIndexerWorker,
} from '@subql/node-core';
import { NearBlock, NearDatasource } from '@subql/types-near';
import {
NearProjectDs,
SubqueryProject,
} from '../../configure/SubqueryProject';
import { SubqueryProject } from '../../configure/SubqueryProject';
import { DynamicDsService } from '../dynamic-ds.service';
import { NearApiConnection } from '../nearApi.connection';
import { BlockContent } from '../types';
Expand All @@ -39,7 +36,7 @@ export class WorkerBlockDispatcherService
constructor(
nodeConfig: NodeConfig,
eventEmitter: EventEmitter2,
@Inject('IProjectService') projectService: IProjectService<NearProjectDs>,
@Inject('IProjectService') projectService: IProjectService<NearDatasource>,
@Inject('IProjectUpgradeService')
projectUpgradeService: IProjectUpgradeService,
cacheService: InMemoryCacheService,
Expand Down
9 changes: 5 additions & 4 deletions packages/node/src/indexer/dynamic-ds.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@ import {
DatasourceParams,
DynamicDsService as BaseDynamicDsService,
} from '@subql/node-core';
import { NearProjectDs, SubqueryProject } from '../configure/SubqueryProject';
import { NearDatasource } from '@subql/types-near';
import { SubqueryProject } from '../configure/SubqueryProject';
import { DsProcessorService } from './ds-processor.service';

@Injectable()
export class DynamicDsService extends BaseDynamicDsService<
NearProjectDs,
NearDatasource,
SubqueryProject
> {
constructor(
Expand All @@ -24,8 +25,8 @@ export class DynamicDsService extends BaseDynamicDsService<

protected async getDatasource(
params: DatasourceParams,
): Promise<NearProjectDs> {
const dsObj = this.getTemplate<NearProjectDs>(
): Promise<NearDatasource> {
const dsObj = this.getTemplate<NearDatasource>(
params.templateName,
params.startBlock,
);
Expand Down
21 changes: 10 additions & 11 deletions packages/node/src/indexer/indexer.manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ import {
NearBlockFilter,
} from '@subql/types-near';
import { JsonRpcProvider } from 'near-api-js/lib/providers';
import { NearProjectDs } from '../configure/SubqueryProject';
import * as NearUtil from '../utils/near';
import { ApiService, SafeJsonRpcProvider } from './api.service';
import { DsProcessorService } from './ds-processor.service';
Expand Down Expand Up @@ -91,8 +90,8 @@ export class IndexerManager extends BaseIndexerManager<

protected async indexBlockData(
{ actions, block, receipts, transactions }: BlockContent,
dataSources: NearProjectDs[],
getVM: (d: NearProjectDs) => Promise<IndexerSandbox>,
dataSources: NearDatasource[],
getVM: (d: NearDatasource) => Promise<IndexerSandbox>,
): Promise<void> {
await this.indexBlockContent(block, dataSources, getVM);

Expand Down Expand Up @@ -122,8 +121,8 @@ export class IndexerManager extends BaseIndexerManager<

private async indexBlockContent(
block: NearBlock,
dataSources: NearProjectDs[],
getVM: (d: NearProjectDs) => Promise<IndexerSandbox>,
dataSources: NearDatasource[],
getVM: (d: NearDatasource) => Promise<IndexerSandbox>,
): Promise<void> {
for (const ds of dataSources) {
await this.indexData(NearHandlerKind.Block, block, ds, getVM);
Expand All @@ -132,8 +131,8 @@ export class IndexerManager extends BaseIndexerManager<

private async indexTransaction(
transaction: NearTransaction,
dataSources: NearProjectDs[],
getVM: (d: NearProjectDs) => Promise<IndexerSandbox>,
dataSources: NearDatasource[],
getVM: (d: NearDatasource) => Promise<IndexerSandbox>,
): Promise<void> {
for (const ds of dataSources) {
await this.indexData(NearHandlerKind.Transaction, transaction, ds, getVM);
Expand All @@ -142,8 +141,8 @@ export class IndexerManager extends BaseIndexerManager<

private async indexAction(
action: NearAction,
dataSources: NearProjectDs[],
getVM: (d: NearProjectDs) => Promise<IndexerSandbox>,
dataSources: NearDatasource[],
getVM: (d: NearDatasource) => Promise<IndexerSandbox>,
): Promise<void> {
for (const ds of dataSources) {
await this.indexData(NearHandlerKind.Action, action, ds, getVM);
Expand All @@ -152,8 +151,8 @@ export class IndexerManager extends BaseIndexerManager<

private async indexReceipt(
receipt: NearTransactionReceipt,
dataSources: NearProjectDs[],
getVM: (d: NearProjectDs) => Promise<IndexerSandbox>,
dataSources: NearDatasource[],
getVM: (d: NearDatasource) => Promise<IndexerSandbox>,
): Promise<void> {
for (const ds of dataSources) {
await this.indexData(NearHandlerKind.Receipt, receipt, ds, getVM);
Expand Down
5 changes: 3 additions & 2 deletions packages/node/src/indexer/project.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ import {
PoiSyncService,
profiler,
} from '@subql/node-core';
import { NearDatasource } from '@subql/types-near';
import { Sequelize } from '@subql/x-sequelize';
import { NearProjectDs, SubqueryProject } from '../configure/SubqueryProject';
import { SubqueryProject } from '../configure/SubqueryProject';
import { getBlockByHeight } from '../utils/near';
import { ApiService } from './api.service';
import { DsProcessorService } from './ds-processor.service';
Expand All @@ -27,7 +28,7 @@ const { version: packageVersion } = require('../../package.json');
@Injectable()
export class ProjectService extends BaseProjectService<
ApiService,
NearProjectDs
NearDatasource
> {
protected packageVersion = packageVersion;

Expand Down
7 changes: 4 additions & 3 deletions packages/node/src/subcommands/testing.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ import {
NestLogger,
TestRunner,
} from '@subql/node-core';
import { NearDatasource } from '@subql/types-near';
import { JsonRpcProvider } from 'near-api-js/lib/providers';
import { NearProjectDs, SubqueryProject } from '../configure/SubqueryProject';
import { SubqueryProject } from '../configure/SubqueryProject';
import { ApiService, SafeJsonRpcProvider } from '../indexer/api.service';
import { ProjectService } from '../indexer/project.service';
import { BlockContent } from '../indexer/types';
Expand All @@ -21,7 +22,7 @@ export class TestingService extends BaseTestingService<
JsonRpcProvider,
SafeJsonRpcProvider,
BlockContent,
NearProjectDs
NearDatasource
> {
constructor(
nodeConfig: NodeConfig,
Expand All @@ -37,7 +38,7 @@ export class TestingService extends BaseTestingService<
JsonRpcProvider,
SafeJsonRpcProvider,
BlockContent,
NearProjectDs
NearDatasource
>,
]
> {
Expand Down
Loading
Loading