@ddd-tool/domain-designer-generator 0.3.0 → 0.3.1

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.
package/domain/types.d.ts CHANGED
@@ -1,145 +1,102 @@
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
1
+ import { DomainDesignInfo, DomainDesignInfoType, DomainDesignReadModel, type DomainDesignAgg, type DomainDesignCommand, type DomainDesignEvent, type DomainDesignFacadeCommand, type DomainDesignInfoRecord } from '@ddd-tool/domain-designer-core';
2
+ export type DomainNode = DomainDesignCommand<DomainDesignInfoRecord> | DomainDesignFacadeCommand<DomainDesignInfoRecord> | DomainDesignAgg<DomainDesignInfoRecord> | DomainDesignEvent<DomainDesignInfoRecord> | DomainDesignReadModel<DomainDesignInfoRecord>;
3
+ export declare function isStruct(o: object): o is DomainNode;
18
4
  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>
5
+ readonly Java: "java";
6
+ readonly Kotlin: "kotlin";
7
+ readonly CSharp: "csharp";
8
+ readonly Go: "go";
9
+ }>;
10
+ export type Language = Enum<typeof Language>;
25
11
  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
12
+ private readonly imports;
13
+ private parentDir;
14
+ private name;
15
+ private content;
16
+ constructor(parentDir: string[], name: string);
17
+ addImport(imp: string): void;
18
+ addImports(imports: string[] | Set<string>): void;
19
+ getImports(): string[];
20
+ appendContent(content: string): void;
21
+ appendContentln(content: string): void;
22
+ getContent(): string;
23
+ getName(): string;
24
+ setName(name: string): void;
25
+ getParentDir(): string[];
26
+ setParentDir(parentDir: string[]): void;
41
27
  }
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
28
+ export interface CodeSnippets<TYPE extends 'Info' | 'Agg' | 'AggImpl' | 'Command' | 'CommandHandler' | 'Event' | 'FacadeCommand' | 'FacadeCommandHandler' | 'ReadMode'> {
29
+ type: TYPE;
30
+ imports: Set<string>;
31
+ content: string;
57
32
  }
58
33
  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
- }
34
+ const JavaGeneratorAddition: Readonly<{
35
+ readonly Lombok: "Lombok";
36
+ readonly LombokBuilder: "LombokBuilder";
37
+ readonly RecordValueObject: "RecordValueObject";
38
+ readonly CommandHandler: "CommandHandler";
39
+ readonly Jpa: "Jpa";
40
+ readonly Timezone: "Timezone";
41
+ readonly SpringFramework: "SpringFramework";
42
+ }>;
43
+ type JavaGeneratorAddition = Enum<typeof JavaGeneratorAddition>;
44
+ const IdGenStrategy: Readonly<{
45
+ readonly TABLE: "TABLE";
46
+ readonly SEQUENCE: "SEQUENCE";
47
+ readonly IDENTITY: "IDENTITY";
48
+ readonly UUID: "UUID";
49
+ readonly AUTO: "AUTO";
50
+ }>;
51
+ type IdGenStrategy = Enum<typeof IdGenStrategy>;
52
+ interface JavaContext extends GeneratorContext<'java'> {
53
+ nonNullAnnotation: string;
54
+ nullableAnnotation: string;
55
+ jdkVersion: '8' | '17' | '21';
56
+ idGenStrategy: IdGenStrategy;
57
+ }
83
58
  }
84
59
  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'> {}
60
+ const KotlinGeneratorAddition: Readonly<{
61
+ readonly ValueClass: "ValueClass";
62
+ readonly CommandHandler: "CommandHandler";
63
+ readonly Timezone: "Timezone";
64
+ }>;
65
+ type KotlinGeneratorAddition = Enum<typeof KotlinGeneratorAddition>;
66
+ interface KotlinContext extends GeneratorContext<'kotlin'> {
67
+ }
92
68
  }
93
69
  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
- }
70
+ const CSharpGeneratorAddition: Readonly<{
71
+ readonly Timezone: "Timezone";
72
+ readonly RecordStruct: "RecordStruct";
73
+ readonly PrimaryConstructor: "PrimaryConstructor";
74
+ readonly CommandHandlerInterface: "CommandHandlerInterface";
75
+ readonly AggInterface: "AggInterface";
76
+ }>;
77
+ type CSharpGeneratorAddition = Enum<typeof CSharpGeneratorAddition>;
78
+ interface CSharpContext extends GeneratorContext<'csharp'> {
79
+ commandHandlerInterface?: string;
80
+ aggInterface?: string;
81
+ }
106
82
  }
107
83
  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'> {}
84
+ const GoGeneratorAddition: Readonly<{
85
+ readonly SinglePackageEachDesigner: "SinglePackageEachDesigner";
86
+ }>;
87
+ type GoGeneratorAddition = Enum<typeof GoGeneratorAddition>;
88
+ interface GoContext extends GeneratorContext<'go'> {
89
+ }
113
90
  }
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
91
+ export type GeneratorAddition<LANG extends Language> = LANG extends 'java' ? java.JavaGeneratorAddition : LANG extends 'kotlin' ? kotlin.KotlinGeneratorAddition : LANG extends 'csharp' ? csharp.CSharpGeneratorAddition : LANG extends 'go' ? go.GoGeneratorAddition : never;
123
92
  export interface GeneratorContext<LANG extends Language> {
124
- namespace: string
125
- moduleName: string
126
- additions: Set<GeneratorAddition<LANG>>
93
+ namespace: string;
94
+ moduleName: string;
95
+ additions: Set<GeneratorAddition<LANG>>;
127
96
  }
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'>[]
97
+ export type InfoCodeProvider = (info: DomainDesignInfo<DomainDesignInfoType, string>) => CodeSnippets<'Info'>[];
98
+ export type CommandCodeProvider = (cmd: DomainDesignCommand<DomainDesignInfoRecord>) => CodeSnippets<'Command' | 'CommandHandler'>[];
99
+ export type FacadeCommandCodeProvider = (cmd: DomainDesignFacadeCommand<DomainDesignInfoRecord>) => CodeSnippets<'FacadeCommand' | 'FacadeCommandHandler'>[];
100
+ export type AggCodeProvider = (agg: DomainDesignAgg<DomainDesignInfoRecord>) => CodeSnippets<'Agg' | 'AggImpl'>[];
101
+ export type EventCodeProvider = (event: DomainDesignEvent<DomainDesignInfoRecord>) => CodeSnippets<'Event'>[];
102
+ export type ReadModelCodeProvider = (readModel: DomainDesignReadModel<DomainDesignInfoRecord>) => CodeSnippets<'ReadMode'>[];