Skip to content

Creating a Designer

Basic Usage

ts
import { createDomainDesigner } from '@ddd-tool/domain-designer-core'
const d = createDomainDesigner()

Optional Initialization Parameters

ts
import { createDomainDesigner } from '@ddd-tool/domain-designer-core'
const d = createDomainDesigner({
  moduleName: 'order',
  ignoreValueObjects: ['time', 'name'],
})
ParameterTypeDescriptionDefault
moduleNamestringModule name, used as the basis for code packaging during code generationts filename
ignoreValueObjectsstring[]Ignored value object names. If names match during code generation, value objects won't be generated[
'time',
'id',
'pid',
'name',
'state',
'status',
'version',
'code',
'message',
'type',
'result',
'data',
'payload',
'meta',
'context',
'sorting'
]
Why is there an ignoreValueObjects property?

Answer: In normal design, we should use names with business meaning to define values.

For example: it should be userName, not just name.

But there are exceptions: in UserCreatedEvent, having a time attribute is normal because this time has weak business attributes - we just need a time value. Such vague attribute names shouldn't be treated as value objects during code generation.