@fornari-lanza/domain-design-language-language 0.0.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/README.md +24 -0
- package/out/domain-design-language-formatter.d.ts +5 -0
- package/out/domain-design-language-formatter.js +197 -0
- package/out/domain-design-language-formatter.js.map +1 -0
- package/out/domain-design-language-module.d.ts +41 -0
- package/out/domain-design-language-module.js +50 -0
- package/out/domain-design-language-module.js.map +1 -0
- package/out/domain-design-language-scope.d.ts +8 -0
- package/out/domain-design-language-scope.js +79 -0
- package/out/domain-design-language-scope.js.map +1 -0
- package/out/domain-design-language-validator.d.ts +39 -0
- package/out/domain-design-language-validator.js +468 -0
- package/out/domain-design-language-validator.js.map +1 -0
- package/out/generated/ast.d.ts +1393 -0
- package/out/generated/ast.js +1147 -0
- package/out/generated/ast.js.map +1 -0
- package/out/generated/grammar.d.ts +6 -0
- package/out/generated/grammar.js +3430 -0
- package/out/generated/grammar.js.map +1 -0
- package/out/generated/module.d.ts +13 -0
- package/out/generated/module.js +21 -0
- package/out/generated/module.js.map +1 -0
- package/out/index.d.ts +5 -0
- package/out/index.js +6 -0
- package/out/index.js.map +1 -0
- package/package.json +49 -0
- package/src/domain-design-language-formatter.ts +186 -0
- package/src/domain-design-language-module.ts +96 -0
- package/src/domain-design-language-scope.ts +132 -0
- package/src/domain-design-language-validator.ts +699 -0
- package/src/domain-design-language.langium +299 -0
- package/src/generated/ast.ts +1737 -0
- package/src/generated/grammar.ts +3432 -0
- package/src/generated/module.ts +25 -0
- package/src/index.ts +5 -0
|
@@ -0,0 +1,299 @@
|
|
|
1
|
+
grammar DomainDesignLanguage
|
|
2
|
+
|
|
3
|
+
entry DomainModel:
|
|
4
|
+
(boundedContext=BoundedContext)?
|
|
5
|
+
(contextMap=ContextMap)?;
|
|
6
|
+
|
|
7
|
+
//BOUNDED CONTEXTS
|
|
8
|
+
BoundedContext:
|
|
9
|
+
'BoundedContext' name=ID '{'
|
|
10
|
+
description=STRING
|
|
11
|
+
ubiquitousLanguage=UbiquitousLanguageDeclaration
|
|
12
|
+
(aggregates+=AggregateRoot)*
|
|
13
|
+
(domainServices+=DomainService)*
|
|
14
|
+
(ports+=Port)*
|
|
15
|
+
(commands+=Command)*
|
|
16
|
+
(eventStorming=EventStormingDeclaration)?
|
|
17
|
+
'}';
|
|
18
|
+
|
|
19
|
+
//UBIQUITOUS LANGUAGE
|
|
20
|
+
UbiquitousLanguageDeclaration:
|
|
21
|
+
'UbiquitousLanguage' '{'
|
|
22
|
+
(terms+=Term)*
|
|
23
|
+
'}';
|
|
24
|
+
|
|
25
|
+
Term:
|
|
26
|
+
name=ID '{'
|
|
27
|
+
'definition:' definition=STRING
|
|
28
|
+
('aliases:' '['
|
|
29
|
+
(aliases+=STRING (',' aliases+=STRING)*)?
|
|
30
|
+
']')?
|
|
31
|
+
'}';
|
|
32
|
+
|
|
33
|
+
//CONTEXT MAP
|
|
34
|
+
ContextMap:
|
|
35
|
+
'ContextMap' '{'
|
|
36
|
+
(relationships+=Relationship)*
|
|
37
|
+
'}';
|
|
38
|
+
|
|
39
|
+
Relationship:
|
|
40
|
+
AsymmetricRelationship | SymmetricRelationship;
|
|
41
|
+
|
|
42
|
+
AsymmetricRelationship:
|
|
43
|
+
'Relationship' '{'
|
|
44
|
+
'upstream:' upstream=[BoundedContext:ID] ('[' (upstreamRoles+=UpstreamRole) (',' upstreamRoles+=UpstreamRole)? ']')?
|
|
45
|
+
'downstream:' downstream=[BoundedContext:ID] ('[' (downstreamRole=DownstreamRole) ']')?
|
|
46
|
+
(customerSupplier?='Customer/Supplier')?
|
|
47
|
+
(description=STRING)?
|
|
48
|
+
'}';
|
|
49
|
+
|
|
50
|
+
UpstreamRole returns string:
|
|
51
|
+
('OpenHostService' | 'PublishedLanguage');
|
|
52
|
+
|
|
53
|
+
DownstreamRole returns string:
|
|
54
|
+
('AntiCorruptionLayer' | 'Conformist');
|
|
55
|
+
|
|
56
|
+
SymmetricRelationship:
|
|
57
|
+
'Relationship' '{'
|
|
58
|
+
type=('Partnership' | 'SharedKernel')
|
|
59
|
+
'between' participant1=[BoundedContext:ID]
|
|
60
|
+
'and' participant2=[BoundedContext:ID]
|
|
61
|
+
(description=STRING)?
|
|
62
|
+
'}';
|
|
63
|
+
|
|
64
|
+
//AGGREGATES
|
|
65
|
+
AggregateRoot:
|
|
66
|
+
'AggregateRoot' name=ID '{'
|
|
67
|
+
description=STRING
|
|
68
|
+
('enforcedInvariants:' '['
|
|
69
|
+
(enforcedInvariants+=STRING (',' enforcedInvariants+=STRING)*)?
|
|
70
|
+
']')?
|
|
71
|
+
('correctivePolicies:' '['
|
|
72
|
+
(correctivePolicies+=STRING (',' correctivePolicies+=STRING)*)?
|
|
73
|
+
']')?
|
|
74
|
+
id=UID
|
|
75
|
+
(attributes+=AggregateAttribute)*
|
|
76
|
+
(methods=MethodsDeclaration)?
|
|
77
|
+
(events=DomainEventsDeclaration)?
|
|
78
|
+
(exceptions=ExceptionsDeclaration)?
|
|
79
|
+
'}';
|
|
80
|
+
|
|
81
|
+
AggregateAttribute:
|
|
82
|
+
(many?='many')? (optional?='optional')? type=(ValueObject | Entity | Reference);
|
|
83
|
+
|
|
84
|
+
//AGGREGATE METHODS
|
|
85
|
+
MethodsDeclaration:
|
|
86
|
+
'Methods' '{'
|
|
87
|
+
(methods+=Method)*
|
|
88
|
+
'}';
|
|
89
|
+
|
|
90
|
+
Method:
|
|
91
|
+
name=ID '(' (input=MethodInput)? ')' '{'
|
|
92
|
+
(description=STRING)?
|
|
93
|
+
'}';
|
|
94
|
+
|
|
95
|
+
MethodInput:
|
|
96
|
+
(attributes+=DomainAttribute) (',' attributes+=DomainAttribute)*;
|
|
97
|
+
|
|
98
|
+
//DOMAIN EXCEPTIONS
|
|
99
|
+
ExceptionsDeclaration:
|
|
100
|
+
'DomainExceptions' '{'
|
|
101
|
+
(exceptions+=DomainException)*
|
|
102
|
+
'}';
|
|
103
|
+
|
|
104
|
+
DomainException:
|
|
105
|
+
name=ID (description=STRING)?;
|
|
106
|
+
|
|
107
|
+
//ENTITIES
|
|
108
|
+
Entity:
|
|
109
|
+
'Entity' name=ID '{'
|
|
110
|
+
description=STRING
|
|
111
|
+
id=UID
|
|
112
|
+
(attributes+=EntityAttribute)*
|
|
113
|
+
'}';
|
|
114
|
+
|
|
115
|
+
EntityAttribute:
|
|
116
|
+
(many?='many')? (optional?='optional')? type=(ValueObject | Reference);
|
|
117
|
+
|
|
118
|
+
//VALUE OBJECTS
|
|
119
|
+
ValueObject:
|
|
120
|
+
'ValueObject' name=ID '{'
|
|
121
|
+
(description=STRING)?
|
|
122
|
+
('enforcedInvariants:' '['
|
|
123
|
+
(enforcedInvariants+=STRING (',' enforcedInvariants+=STRING)*)?
|
|
124
|
+
']')?
|
|
125
|
+
(attributes+=PrimitiveAttribute)+
|
|
126
|
+
'}';
|
|
127
|
+
|
|
128
|
+
//DOMAIN EVENTS
|
|
129
|
+
DomainEventsDeclaration:
|
|
130
|
+
'DomainEvents' '{'
|
|
131
|
+
(events+=DomainEvent)*
|
|
132
|
+
'}';
|
|
133
|
+
|
|
134
|
+
DomainEvent:
|
|
135
|
+
name=ID '{'
|
|
136
|
+
(description=STRING)?
|
|
137
|
+
(payload=Payload)?
|
|
138
|
+
'}';
|
|
139
|
+
|
|
140
|
+
Payload:
|
|
141
|
+
'payload:' '{'
|
|
142
|
+
(attributes+=PrimitiveAttribute)+
|
|
143
|
+
'}';
|
|
144
|
+
|
|
145
|
+
//DOMAIN SERVICES
|
|
146
|
+
DomainService:
|
|
147
|
+
'DomainService' name=ID '{'
|
|
148
|
+
description=STRING
|
|
149
|
+
'type:' type=('contract' | 'coordination' | 'calculation')
|
|
150
|
+
(input=DomainServiceInput)?
|
|
151
|
+
(response=DomainServiceResponse)?
|
|
152
|
+
'}';
|
|
153
|
+
|
|
154
|
+
DomainServiceInput:
|
|
155
|
+
'input:' '{'
|
|
156
|
+
(attributes+=DomainAttribute)+
|
|
157
|
+
'}';
|
|
158
|
+
|
|
159
|
+
DomainServiceResponse:
|
|
160
|
+
'response:' '{'
|
|
161
|
+
(attributes+=(DomainAttribute | PrimitiveAttribute))+
|
|
162
|
+
'}';
|
|
163
|
+
|
|
164
|
+
//REPOSITORIES
|
|
165
|
+
/* Repository:
|
|
166
|
+
'Repository' aggregate=[AggregateRoot:QualifiedName]; */
|
|
167
|
+
|
|
168
|
+
//APPLICATION LAYER
|
|
169
|
+
Port:
|
|
170
|
+
'Port' name=ID '{'
|
|
171
|
+
(description=STRING)?
|
|
172
|
+
'}';
|
|
173
|
+
|
|
174
|
+
Command:
|
|
175
|
+
'Command' name=ID '{'
|
|
176
|
+
(description=STRING)?
|
|
177
|
+
(input=InputDTO)?
|
|
178
|
+
(response=ResponseDTO)?
|
|
179
|
+
'uses' aggregate=[AggregateRoot:QualifiedName]
|
|
180
|
+
'emits' events+=[DomainEvent:QualifiedName] (',' events+=[DomainEvent:QualifiedName])*
|
|
181
|
+
('uses' domainServices+=[DomainService:QualifiedName] (',' domainServices+=[DomainService:QualifiedName])*)?
|
|
182
|
+
('dependencies:' '[' (dependencies+=Dependency) (',' dependencies+=Dependency)* ']')?
|
|
183
|
+
'}';
|
|
184
|
+
|
|
185
|
+
InputDTO:
|
|
186
|
+
'input:' '{'
|
|
187
|
+
(attributes+=PrimitiveAttribute)+
|
|
188
|
+
'}';
|
|
189
|
+
|
|
190
|
+
ResponseDTO:
|
|
191
|
+
'response:' '{'
|
|
192
|
+
(attributes+=PrimitiveAttribute)+
|
|
193
|
+
'}';
|
|
194
|
+
|
|
195
|
+
Dependency:
|
|
196
|
+
port=[Port:QualifiedName];
|
|
197
|
+
|
|
198
|
+
//EVENT STORMING
|
|
199
|
+
EventStormingDeclaration:
|
|
200
|
+
'EventStorming' '{'
|
|
201
|
+
(elements+=EventStormingElement)*
|
|
202
|
+
(flows+=ProcessFlow)*
|
|
203
|
+
'}';
|
|
204
|
+
|
|
205
|
+
EventStormingElement:
|
|
206
|
+
Actor | ExternalSystem | ReadModel;
|
|
207
|
+
|
|
208
|
+
Actor:
|
|
209
|
+
'Actor' name=ID '{'
|
|
210
|
+
(description=STRING)?
|
|
211
|
+
'}';
|
|
212
|
+
|
|
213
|
+
Policy:
|
|
214
|
+
'Policy' name=ID '{'
|
|
215
|
+
(description=STRING)?
|
|
216
|
+
'invokes' command=[Command:ID]
|
|
217
|
+
'}';
|
|
218
|
+
|
|
219
|
+
ReadModel:
|
|
220
|
+
'ReadModel' name=ID '{'
|
|
221
|
+
(description=STRING)?
|
|
222
|
+
'}';
|
|
223
|
+
|
|
224
|
+
ExternalSystem:
|
|
225
|
+
'ExternalSystem' name=ID '{'
|
|
226
|
+
(description=STRING)?
|
|
227
|
+
'}';
|
|
228
|
+
|
|
229
|
+
ProcessFlow:
|
|
230
|
+
'ProcessFlow' name=ID '{'
|
|
231
|
+
(description=STRING)?
|
|
232
|
+
(given=GivenStep)?
|
|
233
|
+
(command=ActorCommandStep)
|
|
234
|
+
(reactions+=ReactionStep)*
|
|
235
|
+
'}';
|
|
236
|
+
|
|
237
|
+
GivenStep:
|
|
238
|
+
'given' actor=[Actor:ID] 'views' readModel=[ReadModel:QualifiedName];
|
|
239
|
+
|
|
240
|
+
ActorCommandStep:
|
|
241
|
+
issuer=[Actor:ID] 'issues' command=[Command:ID];
|
|
242
|
+
|
|
243
|
+
ReactionStep:
|
|
244
|
+
'on' trigger=[DomainEvent:QualifiedName] 'then' '{'
|
|
245
|
+
(outcomes+=ReactionOutcome)+
|
|
246
|
+
'}';
|
|
247
|
+
|
|
248
|
+
ReactionOutcome:
|
|
249
|
+
Projection | PolicyTrigger;
|
|
250
|
+
|
|
251
|
+
Projection:
|
|
252
|
+
'projects' 'to' readModel=[ReadModel:QualifiedName] ('hotspot' hotspot=STRING)?;
|
|
253
|
+
|
|
254
|
+
PolicyTrigger:
|
|
255
|
+
'triggers' policy=Policy ('hotspot' hotspot=STRING)?;
|
|
256
|
+
|
|
257
|
+
//ID
|
|
258
|
+
UID:
|
|
259
|
+
'UID' '{'
|
|
260
|
+
'type:' type=IDType
|
|
261
|
+
('enforcedInvariants:' '['
|
|
262
|
+
(enforcedInvariants+=STRING (',' enforcedInvariants+=STRING)*)?
|
|
263
|
+
']')?
|
|
264
|
+
'}';
|
|
265
|
+
|
|
266
|
+
IDType returns string:
|
|
267
|
+
'string' | 'number';
|
|
268
|
+
|
|
269
|
+
//TYPES
|
|
270
|
+
Reference:
|
|
271
|
+
name=ID ':' to=[AggregateRoot:ID];
|
|
272
|
+
|
|
273
|
+
DomainAttribute:
|
|
274
|
+
(many?='many')? (optional?='optional')? name=ID ':' type=[DomainObject:QualifiedName];
|
|
275
|
+
|
|
276
|
+
type DomainObject =
|
|
277
|
+
ValueObject | AggregateRoot | Entity;
|
|
278
|
+
|
|
279
|
+
PrimitiveAttribute:
|
|
280
|
+
(many?='many')? (optional?='optional')? name=ID ':' type=(Primitive | Enum);
|
|
281
|
+
|
|
282
|
+
Primitive returns string:
|
|
283
|
+
'string' | 'number' | 'boolean' | 'date';
|
|
284
|
+
|
|
285
|
+
Enum:
|
|
286
|
+
'Enum' '('
|
|
287
|
+
(values+=ID) (',' values+=ID)*
|
|
288
|
+
')';
|
|
289
|
+
|
|
290
|
+
QualifiedName returns string:
|
|
291
|
+
ID ('.' ID)*;
|
|
292
|
+
|
|
293
|
+
hidden terminal WS: /\s+/;
|
|
294
|
+
terminal ID: /[_a-zA-Z][\w_]*/;
|
|
295
|
+
terminal INT returns number: /[0-9]+/;
|
|
296
|
+
terminal STRING: /"(\\.|[^"\\])*"|'(\\.|[^'\\])*'/;
|
|
297
|
+
|
|
298
|
+
hidden terminal ML_COMMENT: /\/\*[\s\S]*?\*\//;
|
|
299
|
+
hidden terminal SL_COMMENT: /\/\/[^\n\r]*/;
|