diff --git a/package.json b/package.json index 84d0df9..dd51034 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@cosmicmind/domainjs", - "version": "0.0.1-rc-010124-4-b", + "version": "0.0.1-rc-010124-4-c", "description": "A domain-driven design framework for scalable systems.", "keywords": [], "author": { diff --git a/src/Aggregate.ts b/src/Aggregate.ts index 26a0578..99cf54a 100644 --- a/src/Aggregate.ts +++ b/src/Aggregate.ts @@ -48,7 +48,7 @@ import { export abstract class Aggregate extends EventObservable { protected root: E - protected constructor(root: E) { + constructor(root: E) { super() this.root = root } @@ -56,9 +56,9 @@ export abstract class Aggregate = A extends Aggregate ? E : A -export type AggregateConstructor> = new (root: AggregateTypeFor) => A +export type AggregateConstructor> = new (root: AggregateTypeFor, ...args: unknown[]) => A -export function defineAggregate>(_class: AggregateConstructor, handler: EntityLifecycle> = {}): (root: AggregateTypeFor) => A { +export function defineAggregate>(_class: AggregateConstructor, handler: EntityLifecycle> = {}): (root: AggregateTypeFor, ...args: unknown[]) => A { const createEntity = defineEntity>(handler) - return (root: AggregateTypeFor): A => new _class(createEntity(root)) + return (root: AggregateTypeFor, ...args: unknown[]): A => new _class(createEntity(root), ...args) } \ No newline at end of file