diff --git a/packages/common-substrate/CHANGELOG.md b/packages/common-substrate/CHANGELOG.md index 99d48af5af..09250813a7 100644 --- a/packages/common-substrate/CHANGELOG.md +++ b/packages/common-substrate/CHANGELOG.md @@ -6,6 +6,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Added +- Add alias `parseProjectManifest`, also follow type of `INetworkCommonModule` (#2462) + ## [3.8.1] - 2024-06-21 ### Fixed - Fix `EventFilter` incorrectly extend `BlockFilter`, lead dictionary error (#2463) diff --git a/packages/common-substrate/src/index.ts b/packages/common-substrate/src/index.ts index aa8374efd1..d6d46aa7fd 100644 --- a/packages/common-substrate/src/index.ts +++ b/packages/common-substrate/src/index.ts @@ -2,3 +2,13 @@ // SPDX-License-Identifier: GPL-3.0 export * from './project'; + +import {SubstrateCustomDatasource, SubstrateDatasource, SubstrateRuntimeDatasource} from '@subql/types'; +import {INetworkCommonModule} from '@subql/types-core'; +import * as p from './project'; + +// This provides a compiled time check to ensure that the correct exports are provided +// eslint-disable-next-line @typescript-eslint/no-unused-vars +const _ = { + ...p, +} satisfies INetworkCommonModule; diff --git a/packages/common-substrate/src/project/index.ts b/packages/common-substrate/src/project/index.ts index 2eaa386f12..1a03280990 100644 --- a/packages/common-substrate/src/project/index.ts +++ b/packages/common-substrate/src/project/index.ts @@ -6,3 +6,6 @@ export * from './models'; export * from './types'; export * from './utils'; export * from './versioned'; + +import {parseSubstrateProjectManifest} from './load'; +export {parseSubstrateProjectManifest as parseProjectManifest}; diff --git a/packages/types-core/CHANGELOG.md b/packages/types-core/CHANGELOG.md index 307d314e54..4348a4fb16 100644 --- a/packages/types-core/CHANGELOG.md +++ b/packages/types-core/CHANGELOG.md @@ -6,6 +6,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Added +- Add generic network module types (#2462) + ## [0.8.0] - 2024-06-21 ### Changed - Reader interface not returning undefined diff --git a/packages/types-core/src/project/index.ts b/packages/types-core/src/project/index.ts index e4881cafd2..d7a4d868e1 100644 --- a/packages/types-core/src/project/index.ts +++ b/packages/types-core/src/project/index.ts @@ -5,3 +5,4 @@ export * from './types'; export * from './versioned'; export * from './readers'; export * from './datasourceProcessors'; +export * from './modulars'; diff --git a/packages/types-core/src/project/modulars/index.ts b/packages/types-core/src/project/modulars/index.ts new file mode 100644 index 0000000000..0626e01a8a --- /dev/null +++ b/packages/types-core/src/project/modulars/index.ts @@ -0,0 +1,4 @@ +// Copyright 2020-2024 SubQuery Pte Ltd authors & contributors +// SPDX-License-Identifier: GPL-3.0 + +export * from './types'; diff --git a/packages/types-core/src/project/modulars/types.ts b/packages/types-core/src/project/modulars/types.ts new file mode 100644 index 0000000000..ac8ab4055f --- /dev/null +++ b/packages/types-core/src/project/modulars/types.ts @@ -0,0 +1,14 @@ +// Copyright 2020-2024 SubQuery Pte Ltd authors & contributors +// SPDX-License-Identifier: GPL-3.0 + +import {BaseCustomDataSource, BaseDataSource, IProjectManifest} from '../index'; + +export interface INetworkCommonModule< + D extends BaseCustomDataSource | BaseDataSource = BaseDataSource, + RDS extends D = D, + CDS extends D = D, +> { + parseProjectManifest(raw: unknown): IProjectManifest; + isRuntimeDs(ds: D): ds is RDS; + isCustomDs(ds: D): ds is CDS; +}