@ddd-tool/domain-designer-generator 0.1.0-beta.9 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,145 @@
1
+ import {
2
+ DomainDesignInfo,
3
+ DomainDesignInfoType,
4
+ DomainDesignReadModel,
5
+ type DomainDesignAgg,
6
+ type DomainDesignCommand,
7
+ type DomainDesignEvent,
8
+ type DomainDesignFacadeCommand,
9
+ type DomainDesignInfoRecord,
10
+ } from '@ddd-tool/domain-designer-core'
11
+ export type DomainNode =
12
+ | DomainDesignCommand<DomainDesignInfoRecord>
13
+ | DomainDesignFacadeCommand<DomainDesignInfoRecord>
14
+ | DomainDesignAgg<DomainDesignInfoRecord>
15
+ | DomainDesignEvent<DomainDesignInfoRecord>
16
+ | DomainDesignReadModel<DomainDesignInfoRecord>
17
+ export declare function isStruct(o: object): o is DomainNode
18
+ export declare const Language: Readonly<{
19
+ readonly Java: 'java'
20
+ readonly Kotlin: 'kotlin'
21
+ readonly CSharp: 'csharp'
22
+ readonly Go: 'go'
23
+ }>
24
+ export type Language = Enum<typeof Language>
25
+ export declare class CodeFile {
26
+ private readonly imports
27
+ private parentDir
28
+ private name
29
+ private content
30
+ constructor(parentDir: string[], name: string)
31
+ addImport(imp: string): void
32
+ addImports(imports: string[] | Set<string>): void
33
+ getImports(): string[]
34
+ appendContent(content: string): void
35
+ appendContentln(content: string): void
36
+ getContent(): string
37
+ getName(): string
38
+ setName(name: string): void
39
+ getParentDir(): string[]
40
+ setParentDir(parentDir: string[]): void
41
+ }
42
+ export interface CodeSnippets<
43
+ TYPE extends
44
+ | 'Info'
45
+ | 'Agg'
46
+ | 'AggImpl'
47
+ | 'Command'
48
+ | 'CommandHandler'
49
+ | 'Event'
50
+ | 'FacadeCommand'
51
+ | 'FacadeCommandHandler'
52
+ | 'ReadMode',
53
+ > {
54
+ type: TYPE
55
+ imports: Set<string>
56
+ content: string
57
+ }
58
+ export declare namespace java {
59
+ const JavaGeneratorAddition: Readonly<{
60
+ readonly Lombok: 'Lombok'
61
+ readonly LombokBuilder: 'LombokBuilder'
62
+ readonly RecordValueObject: 'RecordValueObject'
63
+ readonly CommandHandler: 'CommandHandler'
64
+ readonly Jpa: 'Jpa'
65
+ readonly Timezone: 'Timezone'
66
+ readonly SpringFramework: 'SpringFramework'
67
+ }>
68
+ type JavaGeneratorAddition = Enum<typeof JavaGeneratorAddition>
69
+ const IdGenStrategy: Readonly<{
70
+ readonly TABLE: 'TABLE'
71
+ readonly SEQUENCE: 'SEQUENCE'
72
+ readonly IDENTITY: 'IDENTITY'
73
+ readonly UUID: 'UUID'
74
+ readonly AUTO: 'AUTO'
75
+ }>
76
+ type IdGenStrategy = Enum<typeof IdGenStrategy>
77
+ interface JavaContext extends GeneratorContext<'java'> {
78
+ nonNullAnnotation: string
79
+ nullableAnnotation: string
80
+ jdkVersion: '8' | '17' | '21'
81
+ idGenStrategy: IdGenStrategy
82
+ }
83
+ }
84
+ export declare namespace kotlin {
85
+ const KotlinGeneratorAddition: Readonly<{
86
+ readonly ValueClass: 'ValueClass'
87
+ readonly CommandHandler: 'CommandHandler'
88
+ readonly Timezone: 'Timezone'
89
+ }>
90
+ type KotlinGeneratorAddition = Enum<typeof KotlinGeneratorAddition>
91
+ interface KotlinContext extends GeneratorContext<'kotlin'> {}
92
+ }
93
+ export declare namespace csharp {
94
+ const CSharpGeneratorAddition: Readonly<{
95
+ readonly Timezone: 'Timezone'
96
+ readonly RecordStruct: 'RecordStruct'
97
+ readonly PrimaryConstructor: 'PrimaryConstructor'
98
+ readonly CommandHandlerInterface: 'CommandHandlerInterface'
99
+ readonly AggInterface: 'AggInterface'
100
+ }>
101
+ type CSharpGeneratorAddition = Enum<typeof CSharpGeneratorAddition>
102
+ interface CSharpContext extends GeneratorContext<'csharp'> {
103
+ commandHandlerInterface?: string
104
+ aggInterface?: string
105
+ }
106
+ }
107
+ export declare namespace go {
108
+ const GoGeneratorAddition: Readonly<{
109
+ readonly SinglePackageEachDesigner: 'SinglePackageEachDesigner'
110
+ }>
111
+ type GoGeneratorAddition = Enum<typeof GoGeneratorAddition>
112
+ interface GoContext extends GeneratorContext<'go'> {}
113
+ }
114
+ export type GeneratorAddition<LANG extends Language> = LANG extends 'java'
115
+ ? java.JavaGeneratorAddition
116
+ : LANG extends 'kotlin'
117
+ ? kotlin.KotlinGeneratorAddition
118
+ : LANG extends 'csharp'
119
+ ? csharp.CSharpGeneratorAddition
120
+ : LANG extends 'go'
121
+ ? go.GoGeneratorAddition
122
+ : never
123
+ export interface GeneratorContext<LANG extends Language> {
124
+ namespace: string
125
+ moduleName: string
126
+ additions: Set<GeneratorAddition<LANG>>
127
+ }
128
+ export type InfoCodeProvider = (
129
+ info: DomainDesignInfo<DomainDesignInfoType, string>,
130
+ ) => CodeSnippets<'Info'>[]
131
+ export type CommandCodeProvider = (
132
+ cmd: DomainDesignCommand<DomainDesignInfoRecord>,
133
+ ) => CodeSnippets<'Command' | 'CommandHandler'>[]
134
+ export type FacadeCommandCodeProvider = (
135
+ cmd: DomainDesignFacadeCommand<DomainDesignInfoRecord>,
136
+ ) => CodeSnippets<'FacadeCommand' | 'FacadeCommandHandler'>[]
137
+ export type AggCodeProvider = (
138
+ agg: DomainDesignAgg<DomainDesignInfoRecord>,
139
+ ) => CodeSnippets<'Agg' | 'AggImpl'>[]
140
+ export type EventCodeProvider = (
141
+ event: DomainDesignEvent<DomainDesignInfoRecord>,
142
+ ) => CodeSnippets<'Event'>[]
143
+ export type ReadModelCodeProvider = (
144
+ readModel: DomainDesignReadModel<DomainDesignInfoRecord>,
145
+ ) => CodeSnippets<'ReadMode'>[]