From dd8b52fac280e2ff090ded2020adb6078b90ab2e Mon Sep 17 00:00:00 2001 From: Angel Castillo Date: Tue, 24 Sep 2024 12:11:27 +0800 Subject: [PATCH] refactor!: hoist bufferChainSyncEvent to projection package Co-authored-by: Martynas Kazlauskas BREAKING CHANGE: OgmiosObservableCardanoNode and bufferChainSyncEvent were moved from core package to projection package --- .../src/Projection/createTypeormProjection.ts | 10 +++- .../Projection/prepareTypeormProjection.ts | 4 +- .../src/TxSubmit/NodeTxSubmitProvider.ts | 2 +- .../createTypeormProjection.test.ts | 3 +- .../core/src/CardanoNode/types/CardanoNode.ts | 12 +++- packages/core/src/CardanoNode/types/index.ts | 1 - .../e2e/test/projection/offline-fork.test.ts | 14 ++--- .../projection/single-tenant-utxo.test.ts | 4 +- packages/golden-test-generator/package.json | 1 + .../src/ChainSyncEvents/chainSyncEvents.ts | 3 +- .../golden-test-generator/src/tsconfig.json | 3 + packages/ogmios/package.json | 1 + .../OgmiosObservableCardanoNode.ts | 3 +- .../createObservableChainSyncClient.ts | 10 +--- packages/ogmios/src/tsconfig.json | 3 + .../src/TypeormStabilityWindowBuffer.ts | 10 +++- .../src/createTypeormTipTracker.ts | 4 +- .../src/operators/storeAddresses.ts | 4 +- .../src/operators/storeAssets.ts | 4 +- .../src/operators/storeBlock.ts | 2 +- .../src/operators/storeGovernanceAction.ts | 4 +- .../src/operators/storeHandleMetadata.ts | 3 +- .../src/operators/storeHandles.ts | 4 +- .../src/operators/storeNftMetadata.ts | 4 +- .../operators/storePoolMetricsUpdateJob.ts | 3 +- .../operators/storeStakeKeyRegistrations.ts | 3 +- .../operators/storeStakePoolMetadataJob.ts | 3 +- .../src/operators/storeStakePoolRewardsJob.ts | 3 +- .../src/operators/storeStakePools.ts | 4 +- .../src/operators/storeUtxo.ts | 4 +- .../test/TypeormStabilityWindowBuffer.test.ts | 4 +- .../test/createTypeormTipTracker.test.ts | 4 +- .../test/operators/storeAssets.test.ts | 4 +- .../operators/storeGovernanceAction.test.ts | 4 +- .../operators/storeHandleMetadata.test.ts | 4 +- .../operators/storeHandles/general.test.ts | 3 +- .../operators/storeHandles/ownership.test.ts | 4 +- .../test/operators/storeHandles/util.ts | 11 +++- .../test/operators/storeNftMetadata.test.ts | 11 +++- .../storePoolMetricsUpdateJob.test.ts | 2 +- .../storeStakePoolMetadataJob.test.ts | 3 +- .../storeStakePoolRewardsJob.test.ts | 3 +- .../test/operators/storeStakePools.test.ts | 4 +- .../test/operators/storeUtxo.test.ts | 4 +- .../projection-typeorm/test/operators/util.ts | 3 +- packages/projection/package.json | 36 +++++------ .../src/Bootstrap/fromCardanoNode.ts | 10 +--- .../InMemory/InMemoryStabilityWindowBuffer.ts | 3 +- .../src/InMemory/operators/storeStakePools.ts | 3 +- .../src}/ObservableCardanoNode.ts | 28 ++++----- .../src}/bufferChainSyncEvent.ts | 2 +- packages/projection/src/index.ts | 2 + .../Mappers/certificates/withStakeKeys.ts | 3 +- .../src/operators/logProjectionProgress.ts | 3 +- .../projection/src/operators/requestNext.ts | 2 +- .../src/operators/utils/projectorOperator.ts | 2 +- .../src/operators/withNetworkInfo.ts | 2 +- .../src/operators/withRolledBackBlock.ts | 3 +- packages/projection/src/types.ts | 3 +- .../InMemoryStabilityWindowBuffer.test.ts | 4 +- .../test/InMemory/stakeKeys.test.ts | 3 +- .../test/InMemory/storeStakePools.test.ts | 4 +- .../test}/bufferChainSyncEvent.test.ts | 10 ++-- .../test/integration/InMemory.test.ts | 4 +- .../certificates/withCertificates.test.ts | 4 +- .../withStakeKeyRegistrations.test.ts | 4 +- .../certificates/withStakeKeys.test.ts | 4 +- .../operators/Mappers/withNftMetadata.test.ts | 4 +- .../test/operators/requestNext.test.ts | 3 +- .../operators/utils/projectorOperator.test.ts | 3 +- .../test/operators/withEpochBoundary.test.ts | 3 +- .../test/operators/withEpochNo.test.ts | 10 +++- .../test/operators/withEventContext.test.ts | 3 +- .../test/operators/withNetworkInfo.test.ts | 10 +++- .../operators/withRolledBackBlock.test.ts | 11 +++- .../test/operators/withStaticContext.test.ts | 3 +- packages/util-dev/package.json | 59 ++++++++++--------- packages/util-dev/src/chainSync/index.ts | 13 ++-- packages/util-dev/src/tsconfig.json | 3 + yarn.lock | 3 + 80 files changed, 265 insertions(+), 203 deletions(-) rename packages/{core/src/CardanoNode/types => projection/src}/ObservableCardanoNode.ts (81%) rename packages/{core/src/CardanoNode/util => projection/src}/bufferChainSyncEvent.ts (95%) rename packages/{core/test/CardanoNode/util => projection/test}/bufferChainSyncEvent.test.ts (96%) diff --git a/packages/cardano-services/src/Projection/createTypeormProjection.ts b/packages/cardano-services/src/Projection/createTypeormProjection.ts index 2ea17287b48..b8b8cf4ef31 100644 --- a/packages/cardano-services/src/Projection/createTypeormProjection.ts +++ b/packages/cardano-services/src/Projection/createTypeormProjection.ts @@ -1,7 +1,13 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ /* eslint-disable prefer-spread */ -import { Bootstrap, ProjectionEvent, logProjectionProgress, requestNext } from '@cardano-sdk/projection'; -import { Cardano, ObservableCardanoNode } from '@cardano-sdk/core'; +import { + Bootstrap, + ObservableCardanoNode, + ProjectionEvent, + logProjectionProgress, + requestNext +} from '@cardano-sdk/projection'; +import { Cardano } from '@cardano-sdk/core'; import { Logger } from 'ts-log'; import { Observable, concat, defer, groupBy, mergeMap, take, takeWhile } from 'rxjs'; import { diff --git a/packages/cardano-services/src/Projection/prepareTypeormProjection.ts b/packages/cardano-services/src/Projection/prepareTypeormProjection.ts index 09e79dc1704..8688025e645 100644 --- a/packages/cardano-services/src/Projection/prepareTypeormProjection.ts +++ b/packages/cardano-services/src/Projection/prepareTypeormProjection.ts @@ -44,8 +44,8 @@ import { willStoreStakePools, willStoreUtxo } from '@cardano-sdk/projection-typeorm'; -import { Cardano, ChainSyncEventType } from '@cardano-sdk/core'; -import { Mappers as Mapper, ProjectionEvent } from '@cardano-sdk/projection'; +import { Cardano } from '@cardano-sdk/core'; +import { ChainSyncEventType, Mappers as Mapper, ProjectionEvent } from '@cardano-sdk/projection'; import { ObservableType, passthrough } from '@cardano-sdk/util-rxjs'; import { POOLS_METRICS_INTERVAL_DEFAULT, POOLS_METRICS_OUTDATED_INTERVAL_DEFAULT } from '../Program/programs/types'; import { Sorter } from '@hapi/topo'; diff --git a/packages/cardano-services/src/TxSubmit/NodeTxSubmitProvider.ts b/packages/cardano-services/src/TxSubmit/NodeTxSubmitProvider.ts index e4fb239609d..8e0a2e9eecd 100644 --- a/packages/cardano-services/src/TxSubmit/NodeTxSubmitProvider.ts +++ b/packages/cardano-services/src/TxSubmit/NodeTxSubmitProvider.ts @@ -5,7 +5,6 @@ import { HandleOwnerChangeError, HandleProvider, HealthCheckResponse, - ObservableCardanoNode, ProviderError, ProviderFailure, SubmitTxArgs, @@ -14,6 +13,7 @@ import { } from '@cardano-sdk/core'; import { InMemoryCache } from '../InMemoryCache'; import { Logger } from 'ts-log'; +import { ObservableCardanoNode } from '@cardano-sdk/projection'; import { WithLogger } from '@cardano-sdk/util'; type ObservableTxSubmitter = Pick; diff --git a/packages/cardano-services/test/Projection/createTypeormProjection.test.ts b/packages/cardano-services/test/Projection/createTypeormProjection.test.ts index 77b2619e34e..b32820cd5df 100644 --- a/packages/cardano-services/test/Projection/createTypeormProjection.test.ts +++ b/packages/cardano-services/test/Projection/createTypeormProjection.test.ts @@ -6,8 +6,9 @@ import { TokensEntity, createDataSource } from '@cardano-sdk/projection-typeorm'; -import { Cardano, ChainSyncEventType } from '@cardano-sdk/core'; +import { Cardano } from '@cardano-sdk/core'; import { ChainSyncDataSet, chainSyncData, logger } from '@cardano-sdk/util-dev'; +import { ChainSyncEventType } from '@cardano-sdk/projection'; import { ProjectionName, createTypeormProjection, prepareTypeormProjection } from '../../src'; import { lastValueFrom } from 'rxjs'; import { projectorConnectionConfig, projectorConnectionConfig$ } from '../util'; diff --git a/packages/core/src/CardanoNode/types/CardanoNode.ts b/packages/core/src/CardanoNode/types/CardanoNode.ts index b6a8eed1796..be90ae458e0 100644 --- a/packages/core/src/CardanoNode/types/CardanoNode.ts +++ b/packages/core/src/CardanoNode/types/CardanoNode.ts @@ -1,5 +1,5 @@ import type { HealthCheckResponse } from '../../Provider'; -import type { Lovelace, PoolId, VrfVkHex } from '../../Cardano'; +import type { Lovelace, PoolId, Tip, VrfVkHex } from '../../Cardano'; import type { Milliseconds } from '../../util'; export interface EraSummary { @@ -48,3 +48,13 @@ export interface CardanoNode { */ healthCheck(): Promise; } + +// Similar to Ogmios.Point, but using Cardano.BlockId opaque string for hash +export type Point = Pick; +export type Origin = 'origin'; +export type TipOrOrigin = Tip | Origin; +export type PointOrOrigin = Point | Origin; +export type Intersection = { + point: PointOrOrigin; + tip: TipOrOrigin; +}; diff --git a/packages/core/src/CardanoNode/types/index.ts b/packages/core/src/CardanoNode/types/index.ts index e83f91bf80c..0fb037a204d 100644 --- a/packages/core/src/CardanoNode/types/index.ts +++ b/packages/core/src/CardanoNode/types/index.ts @@ -1,3 +1,2 @@ export * from './CardanoNode'; export * from './CardanoNodeErrors'; -export * from './ObservableCardanoNode'; diff --git a/packages/e2e/test/projection/offline-fork.test.ts b/packages/e2e/test/projection/offline-fork.test.ts index 606680016d3..105cb34e090 100644 --- a/packages/e2e/test/projection/offline-fork.test.ts +++ b/packages/e2e/test/projection/offline-fork.test.ts @@ -2,8 +2,12 @@ import * as Postgres from '@cardano-sdk/projection-typeorm'; import { BlockDataEntity, BlockEntity, StakeKeyEntity } from '@cardano-sdk/projection-typeorm'; import { Bootstrap, + ChainSyncEvent, + ChainSyncEventType, + ChainSyncRollForward, InMemory, Mappers, + ObservableCardanoNode, ProjectionEvent, ProjectionOperator, StabilityWindowBuffer, @@ -11,15 +15,7 @@ import { requestNext, withStaticContext } from '@cardano-sdk/projection'; -import { - Cardano, - ChainSyncEvent, - ChainSyncEventType, - ChainSyncRollForward, - ObservableCardanoNode, - Point, - TipOrOrigin -} from '@cardano-sdk/core'; +import { Cardano, Point, TipOrOrigin } from '@cardano-sdk/core'; import { ChainSyncDataSet, chainSyncData, logger } from '@cardano-sdk/util-dev'; import { ConnectionConfig } from '@cardano-ogmios/client'; import { Observable, filter, firstValueFrom, lastValueFrom, map, of, take, takeWhile, throwError, toArray } from 'rxjs'; diff --git a/packages/e2e/test/projection/single-tenant-utxo.test.ts b/packages/e2e/test/projection/single-tenant-utxo.test.ts index 822d6c2fea9..6c07c591c48 100644 --- a/packages/e2e/test/projection/single-tenant-utxo.test.ts +++ b/packages/e2e/test/projection/single-tenant-utxo.test.ts @@ -1,6 +1,6 @@ import * as Postgres from '@cardano-sdk/projection-typeorm'; -import { Bootstrap, Mappers, ProjectionEvent, requestNext } from '@cardano-sdk/projection'; -import { Cardano, ObservableCardanoNode } from '@cardano-sdk/core'; +import { Bootstrap, Mappers, ObservableCardanoNode, ProjectionEvent, requestNext } from '@cardano-sdk/projection'; +import { Cardano } from '@cardano-sdk/core'; import { ConnectionConfig } from '@cardano-ogmios/client'; import { DataSource, QueryRunner } from 'typeorm'; import { Observable, filter, firstValueFrom, lastValueFrom, of, scan, takeWhile } from 'rxjs'; diff --git a/packages/golden-test-generator/package.json b/packages/golden-test-generator/package.json index e9febf6b75a..9c59293caf1 100644 --- a/packages/golden-test-generator/package.json +++ b/packages/golden-test-generator/package.json @@ -45,6 +45,7 @@ "dependencies": { "@cardano-sdk/core": "workspace:~", "@cardano-sdk/ogmios": "workspace:~", + "@cardano-sdk/projection": "workspace:~", "@cardano-sdk/util": "workspace:~", "@cardano-sdk/util-dev": "workspace:~", "bunyan": "^1.8.15", diff --git a/packages/golden-test-generator/src/ChainSyncEvents/chainSyncEvents.ts b/packages/golden-test-generator/src/ChainSyncEvents/chainSyncEvents.ts index b8710deeeb0..8b608a2e8c2 100644 --- a/packages/golden-test-generator/src/ChainSyncEvents/chainSyncEvents.ts +++ b/packages/golden-test-generator/src/ChainSyncEvents/chainSyncEvents.ts @@ -1,4 +1,5 @@ -import { Cardano, ChainSyncEventType, Intersection } from '@cardano-sdk/core'; +import { Cardano, Intersection } from '@cardano-sdk/core'; +import { ChainSyncEventType } from '@cardano-sdk/projection'; import { GeneratorMetadata } from '../Content'; import { Logger } from 'ts-log'; import { Ogmios, ogmiosToCore } from '@cardano-sdk/ogmios'; diff --git a/packages/golden-test-generator/src/tsconfig.json b/packages/golden-test-generator/src/tsconfig.json index a02956ba05f..9995bb1370d 100644 --- a/packages/golden-test-generator/src/tsconfig.json +++ b/packages/golden-test-generator/src/tsconfig.json @@ -12,6 +12,9 @@ }, { "path": "../../util/src" + }, + { + "path": "../../projection/src" } ] } diff --git a/packages/ogmios/package.json b/packages/ogmios/package.json index 6dc01d1b9ac..9c47dc7738e 100644 --- a/packages/ogmios/package.json +++ b/packages/ogmios/package.json @@ -58,6 +58,7 @@ "@cardano-ogmios/schema": "6.5.0", "@cardano-sdk/core": "workspace:~", "@cardano-sdk/crypto": "workspace:~", + "@cardano-sdk/projection": "workspace:~", "@cardano-sdk/util": "workspace:~", "backoff-rxjs": "^7.0.0", "buffer": "5.7.1", diff --git a/packages/ogmios/src/CardanoNode/OgmiosObservableCardanoNode/OgmiosObservableCardanoNode.ts b/packages/ogmios/src/CardanoNode/OgmiosObservableCardanoNode/OgmiosObservableCardanoNode.ts index 3e27a5aefed..049d230364f 100644 --- a/packages/ogmios/src/CardanoNode/OgmiosObservableCardanoNode/OgmiosObservableCardanoNode.ts +++ b/packages/ogmios/src/CardanoNode/OgmiosObservableCardanoNode/OgmiosObservableCardanoNode.ts @@ -8,8 +8,6 @@ import { GeneralCardanoNodeErrorCode, HealthCheckResponse, Milliseconds, - ObservableCardanoNode, - ObservableChainSync, PointOrOrigin, StakeDistribution, StateQueryErrorCode @@ -49,6 +47,7 @@ import { withCoreCardanoNodeError } from '../queries'; import isEqual from 'lodash/isEqual.js'; +import type { ObservableCardanoNode, ObservableChainSync } from '@cardano-sdk/projection'; import type { Serialization } from '@cardano-sdk/core'; const ogmiosToCoreIntersection = (intersection: ChainSynchronization.Intersection) => ({ diff --git a/packages/ogmios/src/CardanoNode/OgmiosObservableCardanoNode/createObservableChainSyncClient.ts b/packages/ogmios/src/CardanoNode/OgmiosObservableCardanoNode/createObservableChainSyncClient.ts index 640aec61b87..3c107867663 100644 --- a/packages/ogmios/src/CardanoNode/OgmiosObservableCardanoNode/createObservableChainSyncClient.ts +++ b/packages/ogmios/src/CardanoNode/OgmiosObservableCardanoNode/createObservableChainSyncClient.ts @@ -1,12 +1,6 @@ -import { - ChainSyncEvent, - ChainSyncEventType, - GeneralCardanoNodeError, - GeneralCardanoNodeErrorCode, - PointOrOrigin, - RequestNext -} from '@cardano-sdk/core'; +import { ChainSyncEvent, ChainSyncEventType, RequestNext } from '@cardano-sdk/projection'; import { ChainSynchronization, InteractionContext, Schema, safeJSON } from '@cardano-ogmios/client'; +import { GeneralCardanoNodeError, GeneralCardanoNodeErrorCode, PointOrOrigin } from '@cardano-sdk/core'; import { Logger } from 'ts-log'; import { Observable, Subscriber, from, switchMap } from 'rxjs'; import { WithLogger, toSerializableObject } from '@cardano-sdk/util'; diff --git a/packages/ogmios/src/tsconfig.json b/packages/ogmios/src/tsconfig.json index fc2d46bd822..1b5215b3246 100644 --- a/packages/ogmios/src/tsconfig.json +++ b/packages/ogmios/src/tsconfig.json @@ -10,6 +10,9 @@ { "path": "../../util-rxjs/src" }, + { + "path": "../../projection/src" + }, { "path": "../../crypto/src" } diff --git a/packages/projection-typeorm/src/TypeormStabilityWindowBuffer.ts b/packages/projection-typeorm/src/TypeormStabilityWindowBuffer.ts index 57336e97d88..e2a9d12f762 100644 --- a/packages/projection-typeorm/src/TypeormStabilityWindowBuffer.ts +++ b/packages/projection-typeorm/src/TypeormStabilityWindowBuffer.ts @@ -1,10 +1,16 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ import { BlockDataEntity } from './entity'; -import { Cardano, ChainSyncEventType } from '@cardano-sdk/core'; +import { Cardano } from '@cardano-sdk/core'; +import { + ChainSyncEventType, + ProjectionEvent, + RollForwardEvent, + StabilityWindowBuffer, + WithNetworkInfo +} from '@cardano-sdk/projection'; import { LessThan, QueryRunner } from 'typeorm'; import { Logger } from 'ts-log'; import { Observable, catchError, concatMap, from, map, of, switchMap, take } from 'rxjs'; -import { ProjectionEvent, RollForwardEvent, StabilityWindowBuffer, WithNetworkInfo } from '@cardano-sdk/projection'; import { ReconnectionConfig } from '@cardano-sdk/util-rxjs'; import { RetryBackoffConfig, retryBackoff } from 'backoff-rxjs'; import { TypeormConnection } from './createDataSource'; diff --git a/packages/projection-typeorm/src/createTypeormTipTracker.ts b/packages/projection-typeorm/src/createTypeormTipTracker.ts index 76f59f5427c..b42f4cf985e 100644 --- a/packages/projection-typeorm/src/createTypeormTipTracker.ts +++ b/packages/projection-typeorm/src/createTypeormTipTracker.ts @@ -1,9 +1,9 @@ -import { BaseProjectionEvent } from '@cardano-sdk/projection'; +import { BaseProjectionEvent, ChainSyncEventType } from '@cardano-sdk/projection'; import { BlockEntity } from './entity'; -import { ChainSyncEventType, TipOrOrigin } from '@cardano-sdk/core'; import { Observable, ReplaySubject, from, map, of, switchMap, take, tap } from 'rxjs'; import { ReconnectionConfig } from '@cardano-sdk/util-rxjs'; import { RetryBackoffConfig, retryBackoff } from 'backoff-rxjs'; +import { TipOrOrigin } from '@cardano-sdk/core'; import { TypeormConnection } from './createDataSource'; import { isRecoverableTypeormError } from './isRecoverableTypeormError'; diff --git a/packages/projection-typeorm/src/operators/storeAddresses.ts b/packages/projection-typeorm/src/operators/storeAddresses.ts index 7afc9e3a74f..28f6f308ecc 100644 --- a/packages/projection-typeorm/src/operators/storeAddresses.ts +++ b/packages/projection-typeorm/src/operators/storeAddresses.ts @@ -1,7 +1,7 @@ import { AddressEntity } from '../entity/Address.entity'; -import { Cardano, ChainSyncEventType } from '@cardano-sdk/core'; +import { Cardano } from '@cardano-sdk/core'; +import { ChainSyncEventType, Mappers } from '@cardano-sdk/projection'; import { Hash28ByteBase16 } from '@cardano-sdk/crypto'; -import { Mappers } from '@cardano-sdk/projection'; import { QueryRunner } from 'typeorm'; import { StakeKeyRegistrationEntity } from '../entity'; import { certificatePointerToId, typeormOperator } from './util'; diff --git a/packages/projection-typeorm/src/operators/storeAssets.ts b/packages/projection-typeorm/src/operators/storeAssets.ts index 985ac3ff1b6..3534e9ac09b 100644 --- a/packages/projection-typeorm/src/operators/storeAssets.ts +++ b/packages/projection-typeorm/src/operators/storeAssets.ts @@ -1,6 +1,6 @@ import { AssetEntity } from '../entity'; -import { Cardano, ChainSyncEventType } from '@cardano-sdk/core'; -import { Mappers } from '@cardano-sdk/projection'; +import { Cardano } from '@cardano-sdk/core'; +import { ChainSyncEventType, Mappers } from '@cardano-sdk/projection'; import { QueryRunner } from 'typeorm'; import { typeormOperator } from './util'; diff --git a/packages/projection-typeorm/src/operators/storeBlock.ts b/packages/projection-typeorm/src/operators/storeBlock.ts index f48f0b0de53..5c896186e97 100644 --- a/packages/projection-typeorm/src/operators/storeBlock.ts +++ b/packages/projection-typeorm/src/operators/storeBlock.ts @@ -1,5 +1,5 @@ import { BlockEntity } from '../entity'; -import { ChainSyncEventType } from '@cardano-sdk/core'; +import { ChainSyncEventType } from '@cardano-sdk/projection'; import { typeormOperator } from './util'; export const storeBlock = typeormOperator(async (evt) => { diff --git a/packages/projection-typeorm/src/operators/storeGovernanceAction.ts b/packages/projection-typeorm/src/operators/storeGovernanceAction.ts index 69296199623..3b0481e0195 100644 --- a/packages/projection-typeorm/src/operators/storeGovernanceAction.ts +++ b/packages/projection-typeorm/src/operators/storeGovernanceAction.ts @@ -1,6 +1,6 @@ -import { Cardano, ChainSyncEventType } from '@cardano-sdk/core'; +import { Cardano } from '@cardano-sdk/core'; +import { ChainSyncEventType, Mappers, ProjectionEvent } from '@cardano-sdk/projection'; import { GovernanceActionEntity } from '../entity'; -import { Mappers, ProjectionEvent } from '@cardano-sdk/projection'; import { typeormOperator } from './util'; export const willStoreGovernanceAction = (evt: ProjectionEvent) => diff --git a/packages/projection-typeorm/src/operators/storeHandleMetadata.ts b/packages/projection-typeorm/src/operators/storeHandleMetadata.ts index e8dd674c495..ca32991a747 100644 --- a/packages/projection-typeorm/src/operators/storeHandleMetadata.ts +++ b/packages/projection-typeorm/src/operators/storeHandleMetadata.ts @@ -1,6 +1,5 @@ -import { ChainSyncEventType } from '@cardano-sdk/core'; +import { ChainSyncEventType, Mappers } from '@cardano-sdk/projection'; import { HandleMetadataEntity } from '../entity'; -import { Mappers } from '@cardano-sdk/projection'; import { WithStoredProducedUtxo } from './storeUtxo'; import { typeormOperator } from './util'; diff --git a/packages/projection-typeorm/src/operators/storeHandles.ts b/packages/projection-typeorm/src/operators/storeHandles.ts index 22ddaab36a0..2bdd53a2f04 100644 --- a/packages/projection-typeorm/src/operators/storeHandles.ts +++ b/packages/projection-typeorm/src/operators/storeHandles.ts @@ -1,7 +1,7 @@ import { AssetEntity, HandleEntity, HandleMetadataEntity } from '../entity'; -import { Cardano, ChainSyncEventType, Handle } from '@cardano-sdk/core'; +import { Cardano, Handle } from '@cardano-sdk/core'; +import { ChainSyncEventType, Mappers } from '@cardano-sdk/projection'; import { In, QueryRunner } from 'typeorm'; -import { Mappers } from '@cardano-sdk/projection'; import { WithMintedAssetSupplies } from './storeAssets'; import { typeormOperator } from './util'; import sortBy from 'lodash/sortBy.js'; diff --git a/packages/projection-typeorm/src/operators/storeNftMetadata.ts b/packages/projection-typeorm/src/operators/storeNftMetadata.ts index 0963aeb6aae..514736b6536 100644 --- a/packages/projection-typeorm/src/operators/storeNftMetadata.ts +++ b/packages/projection-typeorm/src/operators/storeNftMetadata.ts @@ -1,6 +1,6 @@ -import { Asset, Cardano, ChainSyncEventType } from '@cardano-sdk/core'; +import { Asset, Cardano } from '@cardano-sdk/core'; import { AssetEntity, NftMetadataEntity, NftMetadataType } from '../entity'; -import { Mappers, ProjectionEvent } from '@cardano-sdk/projection'; +import { ChainSyncEventType, Mappers, ProjectionEvent } from '@cardano-sdk/projection'; import { Repository } from 'typeorm'; import { typeormOperator } from './util'; diff --git a/packages/projection-typeorm/src/operators/storePoolMetricsUpdateJob.ts b/packages/projection-typeorm/src/operators/storePoolMetricsUpdateJob.ts index a6722363107..14816e67c5d 100644 --- a/packages/projection-typeorm/src/operators/storePoolMetricsUpdateJob.ts +++ b/packages/projection-typeorm/src/operators/storePoolMetricsUpdateJob.ts @@ -1,4 +1,5 @@ -import { Cardano, ChainSyncEventType } from '@cardano-sdk/core'; +import { Cardano } from '@cardano-sdk/core'; +import { ChainSyncEventType } from '@cardano-sdk/projection'; import { STAKE_POOL_METRICS_UPDATE } from '../pgBoss'; import { WithPgBoss } from './withTypeormTransaction'; import { typeormOperator } from './util'; diff --git a/packages/projection-typeorm/src/operators/storeStakeKeyRegistrations.ts b/packages/projection-typeorm/src/operators/storeStakeKeyRegistrations.ts index b662ff1848b..12b276c0f39 100644 --- a/packages/projection-typeorm/src/operators/storeStakeKeyRegistrations.ts +++ b/packages/projection-typeorm/src/operators/storeStakeKeyRegistrations.ts @@ -1,5 +1,4 @@ -import { ChainSyncEventType } from '@cardano-sdk/core'; -import { Mappers } from '@cardano-sdk/projection'; +import { ChainSyncEventType, Mappers } from '@cardano-sdk/projection'; import { StakeKeyRegistrationEntity } from '../entity'; import { certificatePointerToId, typeormOperator } from './util'; diff --git a/packages/projection-typeorm/src/operators/storeStakePoolMetadataJob.ts b/packages/projection-typeorm/src/operators/storeStakePoolMetadataJob.ts index cdbd9bb6050..dac4a42da49 100644 --- a/packages/projection-typeorm/src/operators/storeStakePoolMetadataJob.ts +++ b/packages/projection-typeorm/src/operators/storeStakePoolMetadataJob.ts @@ -1,5 +1,4 @@ -import { ChainSyncEventType } from '@cardano-sdk/core'; -import { Mappers } from '@cardano-sdk/projection'; +import { ChainSyncEventType, Mappers } from '@cardano-sdk/projection'; import { STAKE_POOL_METADATA_QUEUE, StakePoolMetadataJob, defaultJobOptions } from '../pgBoss'; import { WithPgBoss } from './withTypeormTransaction'; import { certificatePointerToId, typeormOperator } from './util'; diff --git a/packages/projection-typeorm/src/operators/storeStakePoolRewardsJob.ts b/packages/projection-typeorm/src/operators/storeStakePoolRewardsJob.ts index be51ba1e4cb..c7a6827275a 100644 --- a/packages/projection-typeorm/src/operators/storeStakePoolRewardsJob.ts +++ b/packages/projection-typeorm/src/operators/storeStakePoolRewardsJob.ts @@ -1,4 +1,5 @@ -import { Cardano, ChainSyncEventType } from '@cardano-sdk/core'; +import { Cardano } from '@cardano-sdk/core'; +import { ChainSyncEventType } from '@cardano-sdk/projection'; import { STAKE_POOL_REWARDS, defaultJobOptions } from '../pgBoss'; import { WithPgBoss } from './withTypeormTransaction'; import { typeormOperator } from './util'; diff --git a/packages/projection-typeorm/src/operators/storeStakePools.ts b/packages/projection-typeorm/src/operators/storeStakePools.ts index 3bce1e57104..9916752312c 100644 --- a/packages/projection-typeorm/src/operators/storeStakePools.ts +++ b/packages/projection-typeorm/src/operators/storeStakePools.ts @@ -1,6 +1,6 @@ -import { Cardano, ChainSyncEventType, EraSummary, epochSlotsCalc } from '@cardano-sdk/core'; +import { Cardano, EraSummary, epochSlotsCalc } from '@cardano-sdk/core'; +import { ChainSyncEventType, Mappers, ProjectionEvent } from '@cardano-sdk/projection'; import { In, Not, QueryRunner, Repository } from 'typeorm'; -import { Mappers, ProjectionEvent } from '@cardano-sdk/projection'; import { MaxCertificatePointerIdCertificateIndex as MaxCertificatePointerIdCertIndex, MaxCertificatePointerIdTxIndex, diff --git a/packages/projection-typeorm/src/operators/storeUtxo.ts b/packages/projection-typeorm/src/operators/storeUtxo.ts index 1a4f043d0d5..45ee7b5d795 100644 --- a/packages/projection-typeorm/src/operators/storeUtxo.ts +++ b/packages/projection-typeorm/src/operators/storeUtxo.ts @@ -1,5 +1,5 @@ -import { Cardano, ChainSyncEventType, Serialization } from '@cardano-sdk/core'; -import { Mappers } from '@cardano-sdk/projection'; +import { Cardano, Serialization } from '@cardano-sdk/core'; +import { ChainSyncEventType, Mappers } from '@cardano-sdk/projection'; import { ObjectLiteral } from 'typeorm'; import { OutputEntity, TokensEntity } from '../entity'; import { typeormOperator } from './util'; diff --git a/packages/projection-typeorm/test/TypeormStabilityWindowBuffer.test.ts b/packages/projection-typeorm/test/TypeormStabilityWindowBuffer.test.ts index a14d33a7b2f..65ffc926bb5 100644 --- a/packages/projection-typeorm/test/TypeormStabilityWindowBuffer.test.ts +++ b/packages/projection-typeorm/test/TypeormStabilityWindowBuffer.test.ts @@ -6,9 +6,9 @@ import { createObservableConnection, willStoreBlockData } from '../src'; -import { Cardano, ChainSyncEventType } from '@cardano-sdk/core'; +import { Cardano } from '@cardano-sdk/core'; +import { ChainSyncEventType, ProjectionEvent } from '@cardano-sdk/projection'; import { DataSource, NoConnectionForRepositoryError, QueryRunner, Repository } from 'typeorm'; -import { ProjectionEvent } from '@cardano-sdk/projection'; import { connectionConfig$, createBlockEntity, createBlockHeader, initializeDataSource } from './util'; import { createStubObservable, logger } from '@cardano-sdk/util-dev'; import { firstValueFrom, of, throwError } from 'rxjs'; diff --git a/packages/projection-typeorm/test/createTypeormTipTracker.test.ts b/packages/projection-typeorm/test/createTypeormTipTracker.test.ts index 8d2ecc48593..d1e7324f720 100644 --- a/packages/projection-typeorm/test/createTypeormTipTracker.test.ts +++ b/packages/projection-typeorm/test/createTypeormTipTracker.test.ts @@ -1,4 +1,4 @@ -import { BaseProjectionEvent } from '@cardano-sdk/projection'; +import { BaseProjectionEvent, ChainSyncEventType } from '@cardano-sdk/projection'; import { BlockEntity, TypeormConnection, @@ -6,7 +6,7 @@ import { createObservableConnection, createTypeormTipTracker } from '../src'; -import { Cardano, ChainSyncEventType } from '@cardano-sdk/core'; +import { Cardano } from '@cardano-sdk/core'; import { DataSource, NoConnectionForRepositoryError, QueryRunner, Repository } from 'typeorm'; import { Observable, firstValueFrom, of, throwError } from 'rxjs'; import { RetryBackoffConfig } from 'backoff-rxjs'; diff --git a/packages/projection-typeorm/test/operators/storeAssets.test.ts b/packages/projection-typeorm/test/operators/storeAssets.test.ts index b72bf82064c..98a43f34736 100644 --- a/packages/projection-typeorm/test/operators/storeAssets.test.ts +++ b/packages/projection-typeorm/test/operators/storeAssets.test.ts @@ -12,8 +12,8 @@ import { willStoreAssets, withTypeormTransaction } from '../../src'; -import { Bootstrap, Mappers, requestNext } from '@cardano-sdk/projection'; -import { Cardano, ChainSyncEventType } from '@cardano-sdk/core'; +import { Bootstrap, ChainSyncEventType, Mappers, requestNext } from '@cardano-sdk/projection'; +import { Cardano } from '@cardano-sdk/core'; import { ChainSyncDataSet, chainSyncData, logger } from '@cardano-sdk/util-dev'; import { Mint } from '@cardano-sdk/projection/dist/cjs/operators/Mappers'; import { QueryRunner } from 'typeorm'; diff --git a/packages/projection-typeorm/test/operators/storeGovernanceAction.test.ts b/packages/projection-typeorm/test/operators/storeGovernanceAction.test.ts index 1ae089e816c..b3d7ddbc5a9 100644 --- a/packages/projection-typeorm/test/operators/storeGovernanceAction.test.ts +++ b/packages/projection-typeorm/test/operators/storeGovernanceAction.test.ts @@ -1,7 +1,7 @@ import { BlockEntity, GovernanceActionEntity } from '../../src'; -import { Cardano, ChainSyncEventType } from '@cardano-sdk/core'; +import { Cardano } from '@cardano-sdk/core'; +import { ChainSyncEventType, Mappers, ProjectionEvent } from '@cardano-sdk/projection'; import { DataSource, QueryRunner } from 'typeorm'; -import { Mappers, ProjectionEvent } from '@cardano-sdk/projection'; import { WithTypeormContext, storeBlock, storeGovernanceAction } from '../../src/operators'; import { firstValueFrom, of } from 'rxjs'; import { initializeDataSource } from '../util'; diff --git a/packages/projection-typeorm/test/operators/storeHandleMetadata.test.ts b/packages/projection-typeorm/test/operators/storeHandleMetadata.test.ts index ae8c1e7033b..bce06014432 100644 --- a/packages/projection-typeorm/test/operators/storeHandleMetadata.test.ts +++ b/packages/projection-typeorm/test/operators/storeHandleMetadata.test.ts @@ -17,8 +17,8 @@ import { willStoreHandleMetadata, withTypeormTransaction } from '../../src'; -import { Bootstrap, Mappers, ProjectionEvent, requestNext } from '@cardano-sdk/projection'; -import { Cardano, ObservableCardanoNode } from '@cardano-sdk/core'; +import { Bootstrap, Mappers, ObservableCardanoNode, ProjectionEvent, requestNext } from '@cardano-sdk/projection'; +import { Cardano } from '@cardano-sdk/core'; import { ChainSyncDataSet, chainSyncData, logger } from '@cardano-sdk/util-dev'; import { HandleMetadata } from '@cardano-sdk/projection/dist/cjs/operators/Mappers'; import { Observable, firstValueFrom } from 'rxjs'; diff --git a/packages/projection-typeorm/test/operators/storeHandles/general.test.ts b/packages/projection-typeorm/test/operators/storeHandles/general.test.ts index bdbc5042444..2623808a579 100644 --- a/packages/projection-typeorm/test/operators/storeHandles/general.test.ts +++ b/packages/projection-typeorm/test/operators/storeHandles/general.test.ts @@ -1,5 +1,6 @@ -import { Asset, Cardano, ChainSyncEventType } from '@cardano-sdk/core'; +import { Asset, Cardano } from '@cardano-sdk/core'; import { AssetEntity, HandleEntity, OutputEntity, willStoreHandles } from '../../../src'; +import { ChainSyncEventType } from '@cardano-sdk/projection'; import { HandleOwnership } from '@cardano-sdk/projection/dist/cjs/operators/Mappers'; import { ProjectorContext, createProjectorContext } from '../util'; import { QueryRunner } from 'typeorm'; diff --git a/packages/projection-typeorm/test/operators/storeHandles/ownership.test.ts b/packages/projection-typeorm/test/operators/storeHandles/ownership.test.ts index 3ac4fda49bd..2c42af41d14 100644 --- a/packages/projection-typeorm/test/operators/storeHandles/ownership.test.ts +++ b/packages/projection-typeorm/test/operators/storeHandles/ownership.test.ts @@ -1,5 +1,5 @@ -import { BaseProjectionEvent } from '@cardano-sdk/projection'; -import { Cardano, ChainSyncEventType } from '@cardano-sdk/core'; +import { BaseProjectionEvent, ChainSyncEventType } from '@cardano-sdk/projection'; +import { Cardano } from '@cardano-sdk/core'; import { ChainSyncDataSet, chainSyncData } from '@cardano-sdk/util-dev'; import { HandleEntity } from '../../../src'; import { ProjectorContext, createProjectorContext, createStubProjectionSource, filterAssets } from '../util'; diff --git a/packages/projection-typeorm/test/operators/storeHandles/util.ts b/packages/projection-typeorm/test/operators/storeHandles/util.ts index 90a0b404c39..ef5039aaf0b 100644 --- a/packages/projection-typeorm/test/operators/storeHandles/util.ts +++ b/packages/projection-typeorm/test/operators/storeHandles/util.ts @@ -20,8 +20,15 @@ import { typeormTransactionCommit, withTypeormTransaction } from '../../../src'; -import { Bootstrap, Mappers, ProjectionEvent, requestNext } from '@cardano-sdk/projection'; -import { Cardano, ChainSyncEventType, ObservableCardanoNode } from '@cardano-sdk/core'; +import { + Bootstrap, + ChainSyncEventType, + Mappers, + ObservableCardanoNode, + ProjectionEvent, + requestNext +} from '@cardano-sdk/projection'; +import { Cardano } from '@cardano-sdk/core'; import { ChainSyncDataSet, chainSyncData, logger, mockProviders } from '@cardano-sdk/util-dev'; import { Observable } from 'rxjs'; import { ProjectorContext, createProjectorTilFirst, createStubProjectionSource } from '../util'; diff --git a/packages/projection-typeorm/test/operators/storeNftMetadata.test.ts b/packages/projection-typeorm/test/operators/storeNftMetadata.test.ts index 1ce708d6a1f..7362716049d 100644 --- a/packages/projection-typeorm/test/operators/storeNftMetadata.test.ts +++ b/packages/projection-typeorm/test/operators/storeNftMetadata.test.ts @@ -1,4 +1,4 @@ -import { Asset, Cardano, ChainSyncEventType, ChainSyncRollForward } from '@cardano-sdk/core'; +import { Asset, Cardano } from '@cardano-sdk/core'; import { AssetEntity, BlockDataEntity, @@ -18,7 +18,14 @@ import { willStoreNftMetadata, withTypeormTransaction } from '../../src'; -import { Bootstrap, Mappers, ProjectionEvent, requestNext } from '@cardano-sdk/projection'; +import { + Bootstrap, + ChainSyncEventType, + ChainSyncRollForward, + Mappers, + ProjectionEvent, + requestNext +} from '@cardano-sdk/projection'; import { CIP67Asset, ProjectedNftMetadata } from '@cardano-sdk/projection/dist/cjs/operators/Mappers'; import { ChainSyncDataSet, chainSyncData, generateRandomHexString, logger } from '@cardano-sdk/util-dev'; import { Observable, firstValueFrom, lastValueFrom, toArray } from 'rxjs'; diff --git a/packages/projection-typeorm/test/operators/storePoolMetricsUpdateJob.test.ts b/packages/projection-typeorm/test/operators/storePoolMetricsUpdateJob.test.ts index 900496b5dff..e8cea52d97d 100644 --- a/packages/projection-typeorm/test/operators/storePoolMetricsUpdateJob.test.ts +++ b/packages/projection-typeorm/test/operators/storePoolMetricsUpdateJob.test.ts @@ -1,4 +1,4 @@ -import { ChainSyncEventType } from '@cardano-sdk/core'; +import { ChainSyncEventType } from '@cardano-sdk/projection'; import { OperatorFunction, of } from 'rxjs'; import { STAKE_POOL_METRICS_UPDATE, createStorePoolMetricsUpdateJob } from '../../src'; diff --git a/packages/projection-typeorm/test/operators/storeStakePoolMetadataJob.test.ts b/packages/projection-typeorm/test/operators/storeStakePoolMetadataJob.test.ts index 6151ba4993d..7f73fbf1eb3 100644 --- a/packages/projection-typeorm/test/operators/storeStakePoolMetadataJob.test.ts +++ b/packages/projection-typeorm/test/operators/storeStakePoolMetadataJob.test.ts @@ -11,9 +11,8 @@ import { willStoreStakePoolMetadataJob, withTypeormTransaction } from '../../src'; -import { Bootstrap, Mappers, ProjectionEvent, requestNext } from '@cardano-sdk/projection'; +import { Bootstrap, ChainSyncEventType, Mappers, ProjectionEvent, requestNext } from '@cardano-sdk/projection'; import { ChainSyncDataSet, chainSyncData, logger } from '@cardano-sdk/util-dev'; -import { ChainSyncEventType } from '@cardano-sdk/core'; import { Observable, filter, of } from 'rxjs'; import { PoolUpdate } from '@cardano-sdk/projection/dist/cjs/operators/Mappers'; import { QueryRunner } from 'typeorm'; diff --git a/packages/projection-typeorm/test/operators/storeStakePoolRewardsJob.test.ts b/packages/projection-typeorm/test/operators/storeStakePoolRewardsJob.test.ts index b5354013fd4..1cddae7be69 100644 --- a/packages/projection-typeorm/test/operators/storeStakePoolRewardsJob.test.ts +++ b/packages/projection-typeorm/test/operators/storeStakePoolRewardsJob.test.ts @@ -1,4 +1,5 @@ -import { Cardano, ChainSyncEventType } from '@cardano-sdk/core'; +import { Cardano } from '@cardano-sdk/core'; +import { ChainSyncEventType } from '@cardano-sdk/projection'; import { OperatorFunction, of } from 'rxjs'; import { STAKE_POOL_REWARDS, storeStakePoolRewardsJob, willStoreStakePoolRewardsJob } from '../../src'; diff --git a/packages/projection-typeorm/test/operators/storeStakePools.test.ts b/packages/projection-typeorm/test/operators/storeStakePools.test.ts index e9ebbf50aa7..8e95a0bdc0f 100644 --- a/packages/projection-typeorm/test/operators/storeStakePools.test.ts +++ b/packages/projection-typeorm/test/operators/storeStakePools.test.ts @@ -15,8 +15,8 @@ import { willStoreStakePools, withTypeormTransaction } from '../../src'; -import { Bootstrap, Mappers, requestNext } from '@cardano-sdk/projection'; -import { Cardano, ChainSyncEventType, ObservableCardanoNode } from '@cardano-sdk/core'; +import { Bootstrap, ChainSyncEventType, Mappers, ObservableCardanoNode, requestNext } from '@cardano-sdk/projection'; +import { Cardano } from '@cardano-sdk/core'; import { ChainSyncDataSet, chainSyncData, logger } from '@cardano-sdk/util-dev'; import { DataSource, QueryRunner, Repository } from 'typeorm'; import { connectionConfig$, initializeDataSource } from '../util'; diff --git a/packages/projection-typeorm/test/operators/storeUtxo.test.ts b/packages/projection-typeorm/test/operators/storeUtxo.test.ts index d0d72e8d0b3..18cfb88fe5f 100644 --- a/packages/projection-typeorm/test/operators/storeUtxo.test.ts +++ b/packages/projection-typeorm/test/operators/storeUtxo.test.ts @@ -15,8 +15,8 @@ import { willStoreUtxo, withTypeormTransaction } from '../../src'; -import { Bootstrap, Mappers, ProjectionEvent, requestNext } from '@cardano-sdk/projection'; -import { Cardano, ChainSyncEventType } from '@cardano-sdk/core'; +import { Bootstrap, ChainSyncEventType, Mappers, ProjectionEvent, requestNext } from '@cardano-sdk/projection'; +import { Cardano } from '@cardano-sdk/core'; import { ChainSyncDataSet, chainSyncData, logger } from '@cardano-sdk/util-dev'; import { IsNull, Not, QueryRunner } from 'typeorm'; import { Observable } from 'rxjs'; diff --git a/packages/projection-typeorm/test/operators/util.ts b/packages/projection-typeorm/test/operators/util.ts index b4cf00cd170..bb3b7f3ab16 100644 --- a/packages/projection-typeorm/test/operators/util.ts +++ b/packages/projection-typeorm/test/operators/util.ts @@ -1,13 +1,14 @@ import { BaseProjectionEvent, BootstrapExtraProps, + ChainSyncEventType, ProjectionEvent, RollBackwardEvent, WithBlock, WithNetworkInfo } from '@cardano-sdk/projection'; import { BigIntMath } from '@cardano-sdk/util'; -import { Cardano, ChainSyncEventType, Point } from '@cardano-sdk/core'; +import { Cardano, Point } from '@cardano-sdk/core'; import { Observable, lastValueFrom, map, takeWhile } from 'rxjs'; import { RetryBackoffConfig } from 'backoff-rxjs'; import { diff --git a/packages/projection/package.json b/packages/projection/package.json index 2dc6ac1c9e4..d759d5f17ef 100644 --- a/packages/projection/package.json +++ b/packages/projection/package.json @@ -2,11 +2,9 @@ "name": "@cardano-sdk/projection", "version": "0.11.36", "description": "Chain Sync event projection", - "engines": { - "node": ">=16.20.2" - }, - "main": "dist/cjs/index.js", - "module": "dist/esm/index.js", + "repository": "https://github.com/input-output-hk/cardano-js-sdk", + "license": "Apache-2.0", + "sideEffects": false, "exports": { ".": { "development": "./src/index.ts", @@ -14,12 +12,14 @@ "require": "./dist/cjs/index.js" } }, - "repository": "https://github.com/input-output-hk/cardano-js-sdk", - "publishConfig": { - "access": "public" - }, - "sideEffects": false, - "license": "Apache-2.0", + "main": "dist/cjs/index.js", + "module": "dist/esm/index.js", + "files": [ + "dist/*", + "!dist/tsconfig.tsbuildinfo", + "LICENSE", + "NOTICE" + ], "scripts": { "build": "yarn build:cjs && tsc -p src/tsconfig.json --outDir ./dist/esm --module es2020 && tsc-alias -p src/tsconfig.json --outDir ./dist/esm && cp ../../build/esm-package.json ./dist/esm/package.json", "build:cjs": "tsc --build src && cp ../../build/cjs-package.json ./dist/cjs/package.json", @@ -40,6 +40,7 @@ "dependencies": { "@cardano-sdk/core": "workspace:~", "@cardano-sdk/crypto": "workspace:~", + "@cardano-sdk/ogmios": "workspace:~", "@cardano-sdk/util": "workspace:~", "@cardano-sdk/util-rxjs": "workspace:~", "lodash": "^4.17.21", @@ -49,7 +50,6 @@ "tsc-alias": "^1.8.10" }, "devDependencies": { - "@cardano-sdk/ogmios": "workspace:~", "@cardano-sdk/util-dev": "workspace:~", "eslint": "^7.32.0", "jest": "^28.1.3", @@ -58,10 +58,10 @@ "ts-jest": "^28.0.7", "typescript": "^4.7.4" }, - "files": [ - "dist/*", - "!dist/tsconfig.tsbuildinfo", - "LICENSE", - "NOTICE" - ] + "engines": { + "node": ">=16.20.2" + }, + "publishConfig": { + "access": "public" + } } diff --git a/packages/projection/src/Bootstrap/fromCardanoNode.ts b/packages/projection/src/Bootstrap/fromCardanoNode.ts index 1801a9adfda..55fe5d03ef8 100644 --- a/packages/projection/src/Bootstrap/fromCardanoNode.ts +++ b/packages/projection/src/Bootstrap/fromCardanoNode.ts @@ -1,14 +1,8 @@ /* eslint-disable max-len */ /* eslint-disable jsdoc/valid-types */ /* eslint-disable @typescript-eslint/no-explicit-any */ -import { - Cardano, - ChainSyncEventType, - Intersection, - ObservableCardanoNode, - ObservableChainSync, - TipOrOrigin -} from '@cardano-sdk/core'; +import { Cardano, Intersection, TipOrOrigin } from '@cardano-sdk/core'; +import { ChainSyncEventType, ObservableCardanoNode, ObservableChainSync } from '../ObservableCardanoNode'; import { Logger } from 'ts-log'; import { Observable, concat, defer, map, mergeMap, noop, of, switchMap, take, takeWhile, tap } from 'rxjs'; import { ProjectionEvent, StabilityWindowBuffer, UnifiedExtChainSyncEvent } from '../types'; diff --git a/packages/projection/src/InMemory/InMemoryStabilityWindowBuffer.ts b/packages/projection/src/InMemory/InMemoryStabilityWindowBuffer.ts index 8c8072a0c64..b334034fb65 100644 --- a/packages/projection/src/InMemory/InMemoryStabilityWindowBuffer.ts +++ b/packages/projection/src/InMemory/InMemoryStabilityWindowBuffer.ts @@ -1,5 +1,6 @@ import { BehaviorSubject, Observable, of, tap } from 'rxjs'; -import { Cardano, ChainSyncEventType, TipOrOrigin } from '@cardano-sdk/core'; +import { Cardano, TipOrOrigin } from '@cardano-sdk/core'; +import { ChainSyncEventType } from '../ObservableCardanoNode'; import { StabilityWindowBuffer, UnifiedExtChainSyncObservable, WithNetworkInfo } from '../types'; export class InMemoryStabilityWindowBuffer implements StabilityWindowBuffer { diff --git a/packages/projection/src/InMemory/operators/storeStakePools.ts b/packages/projection/src/InMemory/operators/storeStakePools.ts index 7b0aad131da..e57e1afe71e 100644 --- a/packages/projection/src/InMemory/operators/storeStakePools.ts +++ b/packages/projection/src/InMemory/operators/storeStakePools.ts @@ -1,4 +1,5 @@ -import { Cardano, ChainSyncEventType } from '@cardano-sdk/core'; +import { Cardano } from '@cardano-sdk/core'; +import { ChainSyncEventType } from '../../ObservableCardanoNode'; import { Mappers } from '../../operators'; import { WithInMemoryStore } from '../types'; import { inMemoryStoreOperator } from './utils'; diff --git a/packages/core/src/CardanoNode/types/ObservableCardanoNode.ts b/packages/projection/src/ObservableCardanoNode.ts similarity index 81% rename from packages/core/src/CardanoNode/types/ObservableCardanoNode.ts rename to packages/projection/src/ObservableCardanoNode.ts index ae789e5fcb7..e513ac33ffb 100644 --- a/packages/core/src/CardanoNode/types/ObservableCardanoNode.ts +++ b/packages/projection/src/ObservableCardanoNode.ts @@ -1,18 +1,16 @@ -import { bufferChainSyncEvent } from '../util/bufferChainSyncEvent'; -import type { Cardano, HealthCheckResponse, Serialization } from '../..'; -import type { EraSummary } from './CardanoNode'; +import { + Cardano, + EraSummary, + HealthCheckResponse, + Intersection, + PointOrOrigin, + Serialization, + TipOrOrigin +} from '@cardano-sdk/core'; +import { bufferChainSyncEvent } from './bufferChainSyncEvent'; +import type { Block, Tip } from '@cardano-sdk/core/dist/cjs/Cardano'; import type { Observable } from 'rxjs'; -// Similar to Ogmios.Point, but using Cardano.BlockId opaque string for hash -export type Point = Pick; -export type Origin = 'origin'; -export type TipOrOrigin = Cardano.Tip | Origin; -export type PointOrOrigin = Point | Origin; -export type Intersection = { - point: PointOrOrigin; - tip: TipOrOrigin; -}; - export enum ChainSyncEventType { RollForward, RollBackward @@ -25,9 +23,9 @@ export interface WithRequestNext { } export interface ChainSyncRollForward extends WithRequestNext { - tip: Cardano.Tip; + tip: Tip; eventType: ChainSyncEventType.RollForward; - block: Cardano.Block; + block: Block; } export interface ChainSyncRollBackward extends WithRequestNext { diff --git a/packages/core/src/CardanoNode/util/bufferChainSyncEvent.ts b/packages/projection/src/bufferChainSyncEvent.ts similarity index 95% rename from packages/core/src/CardanoNode/util/bufferChainSyncEvent.ts rename to packages/projection/src/bufferChainSyncEvent.ts index bd97a06c240..99af5951662 100644 --- a/packages/core/src/CardanoNode/util/bufferChainSyncEvent.ts +++ b/packages/projection/src/bufferChainSyncEvent.ts @@ -1,5 +1,5 @@ import { Observable } from 'rxjs'; -import { RequestNext, WithRequestNext } from '../types'; +import { RequestNext, WithRequestNext } from './ObservableCardanoNode'; export const bufferChainSyncEvent = (length: number) => diff --git a/packages/projection/src/index.ts b/packages/projection/src/index.ts index 23342488f36..a92891f1785 100644 --- a/packages/projection/src/index.ts +++ b/packages/projection/src/index.ts @@ -2,3 +2,5 @@ export * as InMemory from './InMemory'; export * as Bootstrap from './Bootstrap'; export * from './operators'; export * from './types'; +export * from './bufferChainSyncEvent'; +export * from './ObservableCardanoNode'; diff --git a/packages/projection/src/operators/Mappers/certificates/withStakeKeys.ts b/packages/projection/src/operators/Mappers/certificates/withStakeKeys.ts index ca3e16b8241..b38b1c97483 100644 --- a/packages/projection/src/operators/Mappers/certificates/withStakeKeys.ts +++ b/packages/projection/src/operators/Mappers/certificates/withStakeKeys.ts @@ -1,5 +1,6 @@ import * as Crypto from '@cardano-sdk/crypto'; -import { Cardano, ChainSyncEventType } from '@cardano-sdk/core'; +import { Cardano } from '@cardano-sdk/core'; +import { ChainSyncEventType } from '../../../ObservableCardanoNode'; import { WithCertificates } from './withCertificates'; import { unifiedProjectorOperator } from '../../utils'; diff --git a/packages/projection/src/operators/logProjectionProgress.ts b/packages/projection/src/operators/logProjectionProgress.ts index a8f99c37ea2..671eadb0270 100644 --- a/packages/projection/src/operators/logProjectionProgress.ts +++ b/packages/projection/src/operators/logProjectionProgress.ts @@ -1,4 +1,5 @@ -import { Cardano, ChainSyncEventType, TipOrOrigin } from '@cardano-sdk/core'; +import { Cardano, TipOrOrigin } from '@cardano-sdk/core'; +import { ChainSyncEventType } from '../ObservableCardanoNode'; import { Logger } from 'ts-log'; import { Observable, defer, finalize, tap } from 'rxjs'; import { UnifiedExtChainSyncEvent } from '../types'; diff --git a/packages/projection/src/operators/requestNext.ts b/packages/projection/src/operators/requestNext.ts index 3b9a6f4dbc9..a681727fa88 100644 --- a/packages/projection/src/operators/requestNext.ts +++ b/packages/projection/src/operators/requestNext.ts @@ -1,5 +1,5 @@ import { OperatorFunction, map, tap } from 'rxjs'; -import { WithRequestNext } from '@cardano-sdk/core'; +import { WithRequestNext } from '../ObservableCardanoNode'; import omit from 'lodash/omit.js'; /** Calls event.requestNext() and emits event object without this method */ diff --git a/packages/projection/src/operators/utils/projectorOperator.ts b/packages/projection/src/operators/utils/projectorOperator.ts index 7e79918cb15..c9a52878610 100644 --- a/packages/projection/src/operators/utils/projectorOperator.ts +++ b/packages/projection/src/operators/utils/projectorOperator.ts @@ -1,4 +1,4 @@ -import { ChainSyncEventType } from '@cardano-sdk/core'; +import { ChainSyncEventType } from '../../ObservableCardanoNode'; import { MaybeObservable } from './types'; import { RollBackwardEvent, RollForwardEvent } from '../../types'; import { concatMap, isObservable, of } from 'rxjs'; diff --git a/packages/projection/src/operators/withNetworkInfo.ts b/packages/projection/src/operators/withNetworkInfo.ts index 061e1b5f0b8..5ef1db0d316 100644 --- a/packages/projection/src/operators/withNetworkInfo.ts +++ b/packages/projection/src/operators/withNetworkInfo.ts @@ -1,4 +1,4 @@ -import { ObservableCardanoNode } from '@cardano-sdk/core'; +import { ObservableCardanoNode } from '../ObservableCardanoNode'; import { WithNetworkInfo } from '../types'; import { combineLatest, map, take } from 'rxjs'; import { withStaticContext } from './withStaticContext'; diff --git a/packages/projection/src/operators/withRolledBackBlock.ts b/packages/projection/src/operators/withRolledBackBlock.ts index 3bc2fead1a2..37278db8ec5 100644 --- a/packages/projection/src/operators/withRolledBackBlock.ts +++ b/packages/projection/src/operators/withRolledBackBlock.ts @@ -1,4 +1,5 @@ -import { Cardano, ChainSyncEvent, ChainSyncEventType, TipOrOrigin } from '@cardano-sdk/core'; +import { Cardano, TipOrOrigin } from '@cardano-sdk/core'; +import { ChainSyncEvent, ChainSyncEventType } from '../ObservableCardanoNode'; import { EMPTY, Observable, diff --git a/packages/projection/src/types.ts b/packages/projection/src/types.ts index fa7bf2db3c1..6062f8b755e 100644 --- a/packages/projection/src/types.ts +++ b/packages/projection/src/types.ts @@ -1,5 +1,6 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ -import { Cardano, ChainSyncRollBackward, ChainSyncRollForward, EraSummary } from '@cardano-sdk/core'; +import { Cardano, EraSummary } from '@cardano-sdk/core'; +import { ChainSyncRollBackward, ChainSyncRollForward } from './ObservableCardanoNode'; import { Observable } from 'rxjs'; import { ObservableType } from '@cardano-sdk/util-rxjs'; diff --git a/packages/projection/test/InMemory/InMemoryStabilityWindowBuffer.test.ts b/packages/projection/test/InMemory/InMemoryStabilityWindowBuffer.test.ts index 8c3e7410903..12b4aef50cf 100644 --- a/packages/projection/test/InMemory/InMemoryStabilityWindowBuffer.test.ts +++ b/packages/projection/test/InMemory/InMemoryStabilityWindowBuffer.test.ts @@ -1,5 +1,5 @@ -import { Cardano, ChainSyncEventType, Seconds } from '@cardano-sdk/core'; -import { InMemory, UnifiedExtChainSyncEvent, WithNetworkInfo } from '../../src'; +import { Cardano, Seconds } from '@cardano-sdk/core'; +import { ChainSyncEventType, InMemory, UnifiedExtChainSyncEvent, WithNetworkInfo } from '../../src'; import { firstValueFrom, from } from 'rxjs'; import { genesisToEraSummary } from '@cardano-sdk/util-dev'; import { stubBlockId } from '../util'; diff --git a/packages/projection/test/InMemory/stakeKeys.test.ts b/packages/projection/test/InMemory/stakeKeys.test.ts index 9b6486f3006..3ed4438d8cf 100644 --- a/packages/projection/test/InMemory/stakeKeys.test.ts +++ b/packages/projection/test/InMemory/stakeKeys.test.ts @@ -1,6 +1,5 @@ import * as Crypto from '@cardano-sdk/crypto'; -import { ChainSyncEventType } from '@cardano-sdk/core'; -import { InMemory, Mappers, ProjectionEvent } from '../../src'; +import { ChainSyncEventType, InMemory, Mappers, ProjectionEvent } from '../../src'; import { firstValueFrom, of } from 'rxjs'; describe('InMemory.storeStakeKeys', () => { diff --git a/packages/projection/test/InMemory/storeStakePools.test.ts b/packages/projection/test/InMemory/storeStakePools.test.ts index 81e0e07ace7..487530f63da 100644 --- a/packages/projection/test/InMemory/storeStakePools.test.ts +++ b/packages/projection/test/InMemory/storeStakePools.test.ts @@ -1,5 +1,5 @@ -import { Cardano, ChainSyncEventType } from '@cardano-sdk/core'; -import { InMemory, Mappers, ProjectionEvent } from '../../src'; +import { Cardano } from '@cardano-sdk/core'; +import { ChainSyncEventType, InMemory, Mappers, ProjectionEvent } from '../../src'; import { firstValueFrom, of } from 'rxjs'; describe('InMemory.storeStakePools', () => { diff --git a/packages/core/test/CardanoNode/util/bufferChainSyncEvent.test.ts b/packages/projection/test/bufferChainSyncEvent.test.ts similarity index 96% rename from packages/core/test/CardanoNode/util/bufferChainSyncEvent.test.ts rename to packages/projection/test/bufferChainSyncEvent.test.ts index 284d0c9e315..e6e78a68319 100644 --- a/packages/core/test/CardanoNode/util/bufferChainSyncEvent.test.ts +++ b/packages/projection/test/bufferChainSyncEvent.test.ts @@ -1,8 +1,8 @@ /* eslint-disable sonarjs/no-duplicate-string */ -import { BlockId, BlockNo, Slot, Tip } from '../../../src/Cardano'; -import { ChainSyncEvent, ChainSyncEventType, RequestNext } from '../../../src'; +import { Cardano } from '@cardano-sdk/core'; +import { ChainSyncEvent, ChainSyncEventType, RequestNext } from '../src'; import { Observable, Subject, Subscription } from 'rxjs'; -import { bufferChainSyncEvent } from '../../../src/CardanoNode/util/bufferChainSyncEvent'; +import { bufferChainSyncEvent } from '../src/bufferChainSyncEvent'; const sleep = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms)); @@ -20,7 +20,7 @@ class ChainSyncEventTestConsumer { complete: () => this.events.push('Consumer completed'), error: (error) => this.events.push(`Consumer error: ${error}`), next: (value) => { - this.current = (value.tip as Tip).blockNo; + this.current = (value.tip as Cardano.Tip).blockNo; this.events.push(`Got ${this.current}`); this.requestNext = value.requestNext; } @@ -106,7 +106,7 @@ class ChainSyncEventTestProducer { requestNext: () => { this.canProduce = true; }, - tip: { blockNo: BlockNo(count), hash: '' as BlockId, slot: Slot(count) } + tip: { blockNo: Cardano.BlockNo(count), hash: '' as Cardano.BlockId, slot: Cardano.Slot(count) } }); }, 1); } diff --git a/packages/projection/test/integration/InMemory.test.ts b/packages/projection/test/integration/InMemory.test.ts index 03f6a044ace..f1e94d2acac 100644 --- a/packages/projection/test/integration/InMemory.test.ts +++ b/packages/projection/test/integration/InMemory.test.ts @@ -2,6 +2,8 @@ import * as Crypto from '@cardano-sdk/crypto'; import { Bootstrap, BootstrapExtraProps, + ChainSyncEventType, + ChainSyncRollForward, InMemory, Mappers, ProjectionEvent, @@ -10,7 +12,7 @@ import { requestNext, withStaticContext } from '../../src'; -import { Cardano, ChainSyncEventType, ChainSyncRollForward } from '@cardano-sdk/core'; +import { Cardano } from '@cardano-sdk/core'; import { ChainSyncDataSet, StubChainSyncData, chainSyncData, logger } from '@cardano-sdk/util-dev'; import { from, lastValueFrom, of, take, toArray } from 'rxjs'; diff --git a/packages/projection/test/operators/Mappers/certificates/withCertificates.test.ts b/packages/projection/test/operators/Mappers/certificates/withCertificates.test.ts index dea75208440..d1c7bd0b5da 100644 --- a/packages/projection/test/operators/Mappers/certificates/withCertificates.test.ts +++ b/packages/projection/test/operators/Mappers/certificates/withCertificates.test.ts @@ -1,5 +1,5 @@ -import { Cardano, ChainSyncEventType } from '@cardano-sdk/core'; -import { Mappers, RollForwardEvent, UnifiedExtChainSyncEvent } from '../../../../src'; +import { Cardano } from '@cardano-sdk/core'; +import { ChainSyncEventType, Mappers, RollForwardEvent, UnifiedExtChainSyncEvent } from '../../../../src'; import { createTestScheduler } from '@cardano-sdk/util-dev'; const createEvent = ( diff --git a/packages/projection/test/operators/Mappers/certificates/withStakeKeyRegistrations.test.ts b/packages/projection/test/operators/Mappers/certificates/withStakeKeyRegistrations.test.ts index 9d3cd62641c..3d7ce3dcb21 100644 --- a/packages/projection/test/operators/Mappers/certificates/withStakeKeyRegistrations.test.ts +++ b/packages/projection/test/operators/Mappers/certificates/withStakeKeyRegistrations.test.ts @@ -1,6 +1,6 @@ import * as Crypto from '@cardano-sdk/crypto'; -import { Cardano, ChainSyncEventType } from '@cardano-sdk/core'; -import { Mappers, UnifiedExtChainSyncEvent, WithBlock } from '../../../../src'; +import { Cardano } from '@cardano-sdk/core'; +import { ChainSyncEventType, Mappers, UnifiedExtChainSyncEvent, WithBlock } from '../../../../src'; import { firstValueFrom, of } from 'rxjs'; type EventData = Mappers.WithCertificates & { eventType: ChainSyncEventType }; diff --git a/packages/projection/test/operators/Mappers/certificates/withStakeKeys.test.ts b/packages/projection/test/operators/Mappers/certificates/withStakeKeys.test.ts index 8e745bff866..c1d131b79a7 100644 --- a/packages/projection/test/operators/Mappers/certificates/withStakeKeys.test.ts +++ b/packages/projection/test/operators/Mappers/certificates/withStakeKeys.test.ts @@ -1,6 +1,6 @@ import * as Crypto from '@cardano-sdk/crypto'; -import { Cardano, ChainSyncEventType } from '@cardano-sdk/core'; -import { Mappers, UnifiedExtChainSyncEvent, WithBlock } from '../../../../src'; +import { Cardano } from '@cardano-sdk/core'; +import { ChainSyncEventType, Mappers, UnifiedExtChainSyncEvent, WithBlock } from '../../../../src'; import { firstValueFrom, of } from 'rxjs'; type EventData = Mappers.WithCertificates & { eventType: ChainSyncEventType }; diff --git a/packages/projection/test/operators/Mappers/withNftMetadata.test.ts b/packages/projection/test/operators/Mappers/withNftMetadata.test.ts index cf4bf576559..1a1efc34d55 100644 --- a/packages/projection/test/operators/Mappers/withNftMetadata.test.ts +++ b/packages/projection/test/operators/Mappers/withNftMetadata.test.ts @@ -1,13 +1,13 @@ /* eslint-disable sonarjs/no-duplicate-string */ -import { Asset, Cardano, ChainSyncEventType, ChainSyncRollForward, Serialization, util } from '@cardano-sdk/core'; +import { Asset, Cardano, Serialization, util } from '@cardano-sdk/core'; import { ChainSyncDataSet, SerializedChainSyncEvent, chainSyncData, generateRandomHexString } from '@cardano-sdk/util-dev'; +import { ChainSyncEventType, ChainSyncRollForward, Mappers, ProjectionEvent } from '../../../src'; import { HexBlob } from '@cardano-sdk/util'; -import { Mappers, ProjectionEvent } from '../../../src'; import { Observable, firstValueFrom, map, of } from 'rxjs'; import { dummyLogger } from 'ts-log'; diff --git a/packages/projection/test/operators/requestNext.test.ts b/packages/projection/test/operators/requestNext.test.ts index 9644fde3fe0..bd1c2e68ef0 100644 --- a/packages/projection/test/operators/requestNext.test.ts +++ b/packages/projection/test/operators/requestNext.test.ts @@ -1,6 +1,5 @@ -import { ChainSyncEventType, ChainSyncRollForward, RequestNext } from '@cardano-sdk/core'; +import { ChainSyncEventType, ChainSyncRollForward, RequestNext, requestNext } from '../../src'; import { firstValueFrom, of } from 'rxjs'; -import { requestNext } from '../../src'; describe('requestNext', () => { it('calls event.requestNext() and emits event object without this method', async () => { diff --git a/packages/projection/test/operators/utils/projectorOperator.test.ts b/packages/projection/test/operators/utils/projectorOperator.test.ts index 47149f0a453..70fb04f8e50 100644 --- a/packages/projection/test/operators/utils/projectorOperator.test.ts +++ b/packages/projection/test/operators/utils/projectorOperator.test.ts @@ -1,5 +1,4 @@ -import { ChainSyncEventType } from '@cardano-sdk/core'; -import { ExtChainSyncEvent, ProjectorEventHandlers, projectorOperator } from '../../../src'; +import { ChainSyncEventType, ExtChainSyncEvent, ProjectorEventHandlers, projectorOperator } from '../../../src'; import { createTestScheduler } from '@cardano-sdk/util-dev'; import { of } from 'rxjs'; diff --git a/packages/projection/test/operators/withEpochBoundary.test.ts b/packages/projection/test/operators/withEpochBoundary.test.ts index f84174834d0..7e98823d328 100644 --- a/packages/projection/test/operators/withEpochBoundary.test.ts +++ b/packages/projection/test/operators/withEpochBoundary.test.ts @@ -1,5 +1,6 @@ -import { Cardano, ChainSyncEventType } from '@cardano-sdk/core'; +import { Cardano } from '@cardano-sdk/core'; import { + ChainSyncEventType, UnifiedExtChainSyncEvent, WithEpochBoundary, WithEpochNo, diff --git a/packages/projection/test/operators/withEpochNo.test.ts b/packages/projection/test/operators/withEpochNo.test.ts index 4fe01ab0bd3..7530dad968c 100644 --- a/packages/projection/test/operators/withEpochNo.test.ts +++ b/packages/projection/test/operators/withEpochNo.test.ts @@ -1,5 +1,11 @@ -import { Cardano, ChainSyncEventType } from '@cardano-sdk/core'; -import { RollForwardEvent, UnifiedExtChainSyncEvent, WithNetworkInfo, withEpochNo } from '../../src'; +import { Cardano } from '@cardano-sdk/core'; +import { + ChainSyncEventType, + RollForwardEvent, + UnifiedExtChainSyncEvent, + WithNetworkInfo, + withEpochNo +} from '../../src'; import { createTestScheduler } from '@cardano-sdk/util-dev'; import { stubEraSummaries } from '../util'; diff --git a/packages/projection/test/operators/withEventContext.test.ts b/packages/projection/test/operators/withEventContext.test.ts index adb9ba5e985..3d0be862f62 100644 --- a/packages/projection/test/operators/withEventContext.test.ts +++ b/packages/projection/test/operators/withEventContext.test.ts @@ -1,5 +1,4 @@ -import { ChainSyncEventType } from '@cardano-sdk/core'; -import { ExtChainSyncEvent, withEventContext } from '../../src'; +import { ChainSyncEventType, ExtChainSyncEvent, withEventContext } from '../../src'; import { createTestScheduler } from '@cardano-sdk/util-dev'; describe('withEventContext', () => { diff --git a/packages/projection/test/operators/withNetworkInfo.test.ts b/packages/projection/test/operators/withNetworkInfo.test.ts index 39f1bcf1cd5..a47e3b98d50 100644 --- a/packages/projection/test/operators/withNetworkInfo.test.ts +++ b/packages/projection/test/operators/withNetworkInfo.test.ts @@ -1,6 +1,12 @@ -import { Cardano, ChainSyncEventType } from '@cardano-sdk/core'; +import { Cardano } from '@cardano-sdk/core'; import { ChainSyncDataSet, chainSyncData, createTestScheduler } from '@cardano-sdk/util-dev'; -import { RollForwardEvent, UnifiedExtChainSyncEvent, WithNetworkInfo, withNetworkInfo } from '../../src'; +import { + ChainSyncEventType, + RollForwardEvent, + UnifiedExtChainSyncEvent, + WithNetworkInfo, + withNetworkInfo +} from '../../src'; const { networkInfo, cardanoNode } = chainSyncData(ChainSyncDataSet.WithPoolRetirement); diff --git a/packages/projection/test/operators/withRolledBackBlock.test.ts b/packages/projection/test/operators/withRolledBackBlock.test.ts index 57cab7070ec..d0bb27c3cf6 100644 --- a/packages/projection/test/operators/withRolledBackBlock.test.ts +++ b/packages/projection/test/operators/withRolledBackBlock.test.ts @@ -1,6 +1,13 @@ -import { Cardano, ChainSyncEventType, ChainSyncRollBackward, TipOrOrigin } from '@cardano-sdk/core'; +import { Cardano, TipOrOrigin } from '@cardano-sdk/core'; import { ChainSyncDataSet, chainSyncData, createTestScheduler } from '@cardano-sdk/util-dev'; -import { InMemory, UnifiedExtChainSyncEvent, withNetworkInfo, withRolledBackBlock } from '../../src'; +import { + ChainSyncEventType, + ChainSyncRollBackward, + InMemory, + UnifiedExtChainSyncEvent, + withNetworkInfo, + withRolledBackBlock +} from '../../src'; import { stubBlockId } from '../util'; const dataWithStakeKeyDeregistration = chainSyncData(ChainSyncDataSet.WithPoolRetirement); diff --git a/packages/projection/test/operators/withStaticContext.test.ts b/packages/projection/test/operators/withStaticContext.test.ts index fdc65d1e0b3..4956181b8cc 100644 --- a/packages/projection/test/operators/withStaticContext.test.ts +++ b/packages/projection/test/operators/withStaticContext.test.ts @@ -1,5 +1,4 @@ -import { ChainSyncEventType } from '@cardano-sdk/core'; -import { ExtChainSyncEvent, withStaticContext } from '../../src'; +import { ChainSyncEventType, ExtChainSyncEvent, withStaticContext } from '../../src'; import { createTestScheduler } from '@cardano-sdk/util-dev'; describe('withStaticContext', () => { diff --git a/packages/util-dev/package.json b/packages/util-dev/package.json index 2cfe9e1a656..5d01f196262 100644 --- a/packages/util-dev/package.json +++ b/packages/util-dev/package.json @@ -2,27 +2,27 @@ "name": "@cardano-sdk/util-dev", "version": "0.22.10", "description": "Utilities for tests in other packages", - "engines": { - "node": ">=16.20.2" - }, - "main": "dist/cjs/index.js", - "module": "dist/esm/index.js", + "repository": "https://github.com/input-output-hk/cardano-js-sdk", + "license": "Apache-2.0", + "sideEffects": false, "exports": { ".": { "import": "./dist/esm/index.js", "require": "./dist/cjs/index.js" } }, + "main": "dist/cjs/index.js", + "module": "dist/esm/index.js", "browser": { "./dist/cjs/docker.js": false, "./dist/esm/docker.js": false }, - "repository": "https://github.com/input-output-hk/cardano-js-sdk", - "publishConfig": { - "access": "public" - }, - "sideEffects": false, - "license": "Apache-2.0", + "files": [ + "dist/*", + "!dist/tsconfig.tsbuildinfo", + "LICENSE", + "NOTICE" + ], "scripts": { "build": "yarn build:cjs && tsc -p src/tsconfig.json --outDir ./dist/esm --module es2020 && tsc-alias -p src/tsconfig.json --outDir ./dist/esm && cp ./esm-package.json ./dist/esm/package.json && cp -rf src/chainSync/data dist/esm/chainSync/", "build:cjs": "tsc --build src && cp ../../build/cjs-package.json ./dist/cjs/package.json && cp -rf src/chainSync/data dist/cjs/chainSync/", @@ -40,22 +40,11 @@ "test:debug": "DEBUG=true yarn test", "test:e2e": "echo 'test:e2e' command not implemented yet" }, - "devDependencies": { - "@types/dockerode": "^3.3.8", - "@types/jest": "^26.0.24", - "@types/k6": "^0.53.1", - "eslint": "^7.32.0", - "jest": "^28.1.3", - "madge": "^5.0.1", - "npm-run-all": "^4.1.5", - "ts-jest": "^28.0.7", - "tsc-alias": "^1.8.10", - "typescript": "^4.7.4" - }, "dependencies": { "@cardano-sdk/core": "workspace:~", "@cardano-sdk/crypto": "workspace:~", "@cardano-sdk/key-management": "workspace:~", + "@cardano-sdk/projection": "workspace:~", "@cardano-sdk/util": "workspace:~", "@types/dockerode": "^3.3.8", "axios": "^1.7.4", @@ -70,10 +59,22 @@ "rxjs": "^7.4.0", "ts-log": "^2.2.4" }, - "files": [ - "dist/*", - "!dist/tsconfig.tsbuildinfo", - "LICENSE", - "NOTICE" - ] + "devDependencies": { + "@types/dockerode": "^3.3.8", + "@types/jest": "^26.0.24", + "@types/k6": "^0.53.1", + "eslint": "^7.32.0", + "jest": "^28.1.3", + "madge": "^5.0.1", + "npm-run-all": "^4.1.5", + "ts-jest": "^28.0.7", + "tsc-alias": "^1.8.10", + "typescript": "^4.7.4" + }, + "engines": { + "node": ">=16.20.2" + }, + "publishConfig": { + "access": "public" + } } diff --git a/packages/util-dev/src/chainSync/index.ts b/packages/util-dev/src/chainSync/index.ts index 6e35f137e93..3c664932941 100644 --- a/packages/util-dev/src/chainSync/index.ts +++ b/packages/util-dev/src/chainSync/index.ts @@ -2,21 +2,24 @@ import { Cardano, ChainSyncError, ChainSyncErrorCode, - ChainSyncEvent, - ChainSyncEventType, - ChainSyncRollBackward, - ChainSyncRollForward, GeneralCardanoNodeError, GeneralCardanoNodeErrorCode, Intersection, - ObservableCardanoNode, Point, PointOrOrigin } from '@cardano-sdk/core'; + +import { + ChainSyncEvent, + ChainSyncEventType, + ChainSyncRollBackward, + ChainSyncRollForward +} from '@cardano-sdk/projection'; import { Observable, of, throwError } from 'rxjs'; import { fromSerializableObject } from '@cardano-sdk/util'; import { genesisToEraSummary } from './genesisToEraSummary'; import memoize from 'lodash/memoize.js'; +import type { ObservableCardanoNode } from '@cardano-sdk/projection'; export type SerializedChainSyncEvent = | Omit diff --git a/packages/util-dev/src/tsconfig.json b/packages/util-dev/src/tsconfig.json index 17ac0220e1b..a7672c866a3 100644 --- a/packages/util-dev/src/tsconfig.json +++ b/packages/util-dev/src/tsconfig.json @@ -6,6 +6,9 @@ "references": [ { "path": "../../core/src" + }, + { + "path": "../../projection/src" } ] } diff --git a/yarn.lock b/yarn.lock index f52990d2b53..201818e9756 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3697,6 +3697,7 @@ __metadata: dependencies: "@cardano-sdk/core": "workspace:~" "@cardano-sdk/ogmios": "workspace:~" + "@cardano-sdk/projection": "workspace:~" "@cardano-sdk/util": "workspace:~" "@cardano-sdk/util-dev": "workspace:~" "@types/clear": ^0.1.4 @@ -3863,6 +3864,7 @@ __metadata: "@cardano-sdk/cardano-services-client": "workspace:~" "@cardano-sdk/core": "workspace:~" "@cardano-sdk/crypto": "workspace:~" + "@cardano-sdk/projection": "workspace:~" "@cardano-sdk/util": "workspace:~" "@cardano-sdk/util-dev": "workspace:~" "@cardano-sdk/util-rxjs": "workspace:~" @@ -3975,6 +3977,7 @@ __metadata: "@cardano-sdk/core": "workspace:~" "@cardano-sdk/crypto": "workspace:~" "@cardano-sdk/key-management": "workspace:~" + "@cardano-sdk/projection": "workspace:~" "@cardano-sdk/util": "workspace:~" "@types/dockerode": ^3.3.8 "@types/jest": ^26.0.24