1.2.4 • Published 1 year ago

@jbpionnier/ddd v1.2.4

Weekly downloads
13
License
MIT
Repository
github
Last release
1 year ago

ts-ddd

npm version Build Status npm

Utilities types for Domain-Driven Design in TypeScript

!WARNING Work in progress.

Installation

npm install @jbpionnier/ddd

Usage

  • ICommandBus / Command / CommandHandler
  • IQueryBus / Query / QueryHandler
  • IEventBus / Event / EventHandler
  • AggregateRoot
  • DomainEvent / DomainEventStream
  • Entity / ValueObject
  • Repository
  • EventStream / Saga
  • EventStore

ICommandBus / Command / CommandHandler

import { ICommandBus, ICommandHandler, Command } from '@jbpionnier/ddd'

class MyCommand implements Command {
  constructor(public readonly id: string) {}
}

@CommandHandler(MyCommand)
class MyCommandHandler implements ICommandHandler<ImportMediaCommand> {
  handle(command: MyCommand): void {
    console.log('Handling command', command)
  }
}
// Create the command bus
const commandBus: ICommandBus = new CommandBus()
commandBus.register(new MyCommandHandler())

// Execute the command
commandBus.execute(new MyCommand('123'))
1.2.4

1 year ago

1.2.3

1 year ago

1.2.2

2 years ago

1.2.1

2 years ago

1.2.0

2 years ago

1.1.5

4 years ago

1.1.1

4 years ago

1.1.0

4 years ago

1.1.4

4 years ago

1.1.3

4 years ago

1.1.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago

0.0.3

5 years ago

0.0.2

6 years ago

0.0.1

6 years ago