Skip to content

Commit

Permalink
tidy up (#178)
Browse files Browse the repository at this point in the history
* tidy up

* update

* update
  • Loading branch information
jiqiang90 authored Oct 3, 2023
1 parent 0deb71d commit db5772b
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 18 deletions.
4 changes: 2 additions & 2 deletions packages/common-cosmos/src/project/versioned/v1_0_0/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
RunnerQueryBaseModel,
validateObject,
} from '@subql/common';
import {BaseMapping, NodeSpec, ParentProject, QuerySpec, RunnerSpecs} from '@subql/types-core';
import {NodeSpec, ParentProject, QuerySpec, RunnerSpecs} from '@subql/types-core';
import {
CustomModule,
SubqlCosmosCustomDatasource,
Expand All @@ -23,7 +23,7 @@ import {
CustomDatasourceTemplate,
CosmosProjectManifestV1_0_0,
} from '@subql/types-cosmos';
import {plainToClass, Transform, TransformFnParams, Type} from 'class-transformer';
import {Transform, TransformFnParams, Type} from 'class-transformer';
import {
Equals,
IsObject,
Expand Down
8 changes: 0 additions & 8 deletions packages/node/src/configure/SubqueryProject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import {
SubqlCosmosDataSource,
ProjectManifestV1_0_0Impl,
isRuntimeCosmosDs,
CosmosBlockFilter,
isCustomCosmosDs,
} from '@subql/common-cosmos';
import {
Expand Down Expand Up @@ -39,13 +38,6 @@ export type CosmosProjectDsTemplate =
| SubqlProjectDs<RuntimeDatasourceTemplate>
| SubqlProjectDs<CustomDatasourceTemplate>;

export type SubqlProjectBlockFilter = CosmosBlockFilter & {
cronSchedule?: {
schedule: Cron.Seeker;
next: number;
};
};

const NOT_SUPPORT = (name: string) => {
throw new Error(`Manifest specVersion ${name} is not supported`);
};
Expand Down
4 changes: 3 additions & 1 deletion packages/node/src/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// SPDX-License-Identifier: GPL-3.0

import { NestFactory } from '@nestjs/core';
import { findAvailablePort } from '@subql/common';
import { findAvailablePort, notifyUpdates } from '@subql/common';
import { getLogger, NestLogger } from '@subql/node-core';
import { AppModule } from './app.module';
import { ApiService } from './indexer/api.service';
Expand All @@ -16,6 +16,8 @@ const { argv } = yargsOptions;
const DEFAULT_PORT = 3000;
const logger = getLogger('subql-node');

notifyUpdates(pjson, logger);

export async function bootstrap(): Promise<void> {
logger.info(`Current ${pjson.name} version is ${pjson.version}`);
const debug = argv.debug;
Expand Down
4 changes: 4 additions & 0 deletions packages/node/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ import { yargsOptions } from './yargs';

const { argv } = yargsOptions;

(BigInt.prototype as any).toJSON = function () {
return this.toString();
};

// initLogger is imported from true path, to make sure getLogger (or other logger values that relies on logger) isn't initialised
initLogger(
argv.debug,
Expand Down
13 changes: 6 additions & 7 deletions packages/types/src/project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -283,8 +283,8 @@ export interface SubqlCosmosRuntimeDatasource<
M extends SubqlCosmosMapping<SubqlCosmosRuntimeHandler> = SubqlCosmosMapping<SubqlCosmosRuntimeHandler>
> extends ISubqlCosmosDatasource<M> {
/**
* The kind of the datasource, which is `substrate/Runtime`.
* @type {SubstrateDatasourceKind.Runtime}
* The kind of the datasource, which is `cosmos/Runtime`.
* @type {SubqlCosmosDatasourceKind.Runtime}
*/
kind: SubqlCosmosDatasourceKind.Runtime;
/**
Expand All @@ -309,11 +309,10 @@ export type SubqlCosmosDatasource = SubqlCosmosRuntimeDatasource | SubqlCosmosCu
export type CustomCosmosDataSourceAsset = FileReference;

/**
* Represents a custom datasource for Substrate.
* Represents a custom datasource for Cosmos.
* @interface
* @template K - The kind of the datasource (default: string).
* @template T - The filter type for the datasource (default: SubstrateNetworkFilter).
* @template M - The mapping type for the datasource (default: SubstrateMapping<SubstrateCustomHandler>).
* @template M - The mapping type for the datasource (default: SubqlCosmosMapping<SubqlCosmosCustomHandler>).
* @template O - The processor options (default: any).
*/
export interface SubqlCosmosCustomDatasource<
Expand Down Expand Up @@ -348,7 +347,7 @@ export interface HandlerInputTransformer_0_0_0<
E,
DS extends SubqlCosmosCustomDatasource = SubqlCosmosCustomDatasource
> {
(input: CosmosRuntimeHandlerInputMap[T], ds: DS, api: CosmWasmClient, assets?: Record<string, string>): Promise<E>; // | SubstrateBuiltinDataSource
(input: CosmosRuntimeHandlerInputMap[T], ds: DS, api: CosmWasmClient, assets?: Record<string, string>): Promise<E>;
}

export interface HandlerInputTransformer_1_0_0<
Expand All @@ -363,7 +362,7 @@ export interface HandlerInputTransformer_1_0_0<
filter?: F;
api: CosmWasmClient;
assets?: Record<string, string>;
}): Promise<E[]>; // | SubstrateBuiltinDataSource
}): Promise<E[]>;
}

export type SecondLayerHandlerProcessorArray<
Expand Down

0 comments on commit db5772b

Please sign in to comment.