diff --git a/README.md b/README.md index e468476..14a2e83 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,7 @@ - [Command Handlers](https://seikho.github.io/evtstore/#/docs/commands) **Note: `createDomain` will be migrating to `createDomainV2` in version 11.x** +The `createDomainV2` API solves circular reference issues when importing aggregates. The original `createDomain` will be available as `createDomainV1` from 11.x onwards. ## Why diff --git a/index.ts b/index.ts index 73be8a4..bd5a742 100644 --- a/index.ts +++ b/index.ts @@ -1,7 +1,7 @@ -export { createDomain, createDomainV1 } from './src/domain' +export { createDomainV1 } from './src/domain' export { createHandler } from './src/create-handler' export { createBookmark } from './src/create-bookmark' -export { createDomainV2, createStore } from './src/domain-v2' +export { createDomainV2, createDomain } from './src/domain-v2' export { createAggregate, createProvidedAggregate } from './src/create-aggregate' export { createCommands } from './src/create-command' export { diff --git a/package.json b/package.json index eab245a..0d2eef6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "evtstore", - "version": "10.2.0", + "version": "11.0.0", "description": "Event Sourcing with Node.JS", "main": "index.js", "scripts": { diff --git a/src/domain-v2.ts b/src/domain-v2.ts index 40424db..7353006 100644 --- a/src/domain-v2.ts +++ b/src/domain-v2.ts @@ -36,7 +36,7 @@ type ExtStoreAggEvent = T extends StorableAggregate ? E : type ExtStreams = T[keyof T]['stream'] -export function createStore(opts: StoreOpts, aggregates: Tree) { +export function createDomain(opts: StoreOpts, aggregates: Tree) { return createDomainV2(opts, aggregates) } diff --git a/src/domain.ts b/src/domain.ts index 6a1d8e1..5f47cec 100644 --- a/src/domain.ts +++ b/src/domain.ts @@ -15,13 +15,6 @@ import { createProvidedAggregate } from './create-aggregate' export function createDomainV1( opts: DomainOptions, cmd: CommandHandler -) { - return createDomain(opts, cmd) -} - -export function createDomain( - opts: DomainOptions, - cmd: CommandHandler ): Domain { function handler(bookmark: string) { return new EventHandler({ diff --git a/src/test/memory.spec.ts b/src/test/memory.spec.ts index 2472a41..f0d5635 100644 --- a/src/test/memory.spec.ts +++ b/src/test/memory.spec.ts @@ -1,6 +1,6 @@ import { expect } from 'chai' import { createProvider } from '../../provider/memory' -import { createDomain } from '../domain' +import { createDomainV1 as createDomain } from '../domain' import { ExampleEv, ExampleAgg, ExampleCmd, exampleFold, exampleCmd } from './example' const { command, getAggregate, handler } = createDomain( diff --git a/src/test/tests.ts b/src/test/tests.ts index 6e39b98..dd33344 100644 --- a/src/test/tests.ts +++ b/src/test/tests.ts @@ -1,7 +1,7 @@ import { Handler, Provider, Domain } from '../types' import { ExampleEv, ExampleAgg, ExampleCmd, exampleFold, exampleCmd } from './example' import { BaseAggregate } from '../types' -import { createDomain } from '../domain' +import { createDomainV1 as createDomain } from '../domain' import { expect } from 'chai' import { MemoryBookmark } from '../common' import { createHandler } from '../create-handler'