eva4j 1.0.11 → 1.0.13
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/AGENTS.md +441 -14
- package/DOMAIN_YAML_GUIDE.md +425 -21
- package/FUTURE_FEATURES.md +315 -115
- package/QUICK_REFERENCE.md +101 -153
- package/README.md +77 -70
- package/bin/eva4j.js +57 -1
- package/config/defaults.json +3 -0
- package/docs/commands/GENERATE_ENTITIES.md +662 -1968
- package/docs/commands/GENERATE_HTTP_EXCHANGE.md +274 -450
- package/docs/commands/GENERATE_KAFKA_EVENT.md +219 -498
- package/docs/commands/GENERATE_KAFKA_LISTENER.md +18 -18
- package/docs/commands/GENERATE_RECORD.md +335 -311
- package/docs/commands/GENERATE_TEMPORAL_ACTIVITY.md +174 -0
- package/docs/commands/GENERATE_TEMPORAL_FLOW.md +237 -0
- package/docs/commands/GENERATE_USECASE.md +216 -282
- package/docs/commands/INDEX.md +36 -7
- package/examples/doctor-evaluation.yaml +3 -3
- package/examples/domain-audit-complete.yaml +2 -2
- package/examples/domain-collections.yaml +2 -2
- package/examples/domain-ecommerce.yaml +2 -2
- package/examples/domain-events.yaml +201 -0
- package/examples/domain-field-visibility.yaml +11 -5
- package/examples/domain-multi-aggregate.yaml +12 -6
- package/examples/domain-one-to-many.yaml +1 -1
- package/examples/domain-one-to-one.yaml +1 -1
- package/examples/domain-secondary-onetomany.yaml +1 -1
- package/examples/domain-secondary-onetoone.yaml +1 -1
- package/examples/domain-simple.yaml +1 -1
- package/examples/domain-soft-delete.yaml +3 -3
- package/examples/domain-transitions.yaml +1 -1
- package/examples/domain-value-objects.yaml +1 -1
- package/package.json +2 -2
- package/src/commands/add-kafka-client.js +3 -1
- package/src/commands/add-temporal-client.js +286 -0
- package/src/commands/generate-entities.js +75 -4
- package/src/commands/generate-kafka-event.js +273 -89
- package/src/commands/generate-temporal-activity.js +228 -0
- package/src/commands/generate-temporal-flow.js +216 -0
- package/src/generators/module-generator.js +1 -0
- package/src/generators/shared-generator.js +26 -0
- package/src/utils/yaml-to-entity.js +93 -4
- package/templates/aggregate/AggregateRepository.java.ejs +3 -2
- package/templates/aggregate/AggregateRepositoryImpl.java.ejs +15 -7
- package/templates/aggregate/AggregateRoot.java.ejs +38 -2
- package/templates/aggregate/DomainEntity.java.ejs +6 -2
- package/templates/aggregate/DomainEventHandler.java.ejs +62 -0
- package/templates/aggregate/DomainEventRecord.java.ejs +50 -0
- package/templates/aggregate/JpaAggregateRoot.java.ejs +3 -1
- package/templates/aggregate/JpaEntity.java.ejs +3 -1
- package/templates/base/docker/kafka-services.yaml.ejs +2 -2
- package/templates/base/docker/temporal-services.yaml.ejs +29 -0
- package/templates/base/resources/parameters/develop/temporal.yaml.ejs +9 -0
- package/templates/base/resources/parameters/local/temporal.yaml.ejs +9 -0
- package/templates/base/resources/parameters/production/temporal.yaml.ejs +9 -0
- package/templates/base/resources/parameters/test/temporal.yaml.ejs +9 -0
- package/templates/base/root/AGENTS.md.ejs +916 -51
- package/templates/crud/Controller.java.ejs +36 -6
- package/templates/crud/ListQuery.java.ejs +6 -2
- package/templates/crud/ListQueryHandler.java.ejs +24 -10
- package/templates/crud/UpdateCommand.java.ejs +52 -0
- package/templates/crud/UpdateCommandHandler.java.ejs +105 -0
- package/templates/kafka-event/DomainEventHandlerMethod.ejs +1 -0
- package/templates/kafka-event/Event.java.ejs +23 -0
- package/templates/shared/application/dtos/PagedResponse.java.ejs +30 -0
- package/templates/shared/configurations/temporalConfig/TemporalConfig.java.ejs +104 -0
- package/templates/shared/domain/DomainEvent.java.ejs +40 -0
- package/templates/shared/interfaces/HeavyActivity.java.ejs +4 -0
- package/templates/shared/interfaces/LightActivity.java.ejs +4 -0
- package/templates/temporal-activity/ActivityImpl.java.ejs +14 -0
- package/templates/temporal-activity/ActivityInterface.java.ejs +11 -0
- package/templates/temporal-flow/WorkFlowImpl.java.ejs +64 -0
- package/templates/temporal-flow/WorkFlowInterface.java.ejs +19 -0
- package/templates/temporal-flow/WorkFlowService.java.ejs +49 -0
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
package <%= packageName %>.<%= moduleName %>.domain.models.events;
|
|
2
|
+
|
|
3
|
+
import <%= packageName %>.shared.domain.DomainEvent;
|
|
4
|
+
<% const needsBigDecimal = fields.some(f => f.javaType === 'BigDecimal'); %>
|
|
5
|
+
<% const needsLocalDate = fields.some(f => f.javaType === 'LocalDate' || f.javaType === 'LocalDateTime' || f.javaType === 'LocalTime'); %>
|
|
6
|
+
<% const needsUUID = fields.some(f => f.javaType === 'UUID'); %>
|
|
7
|
+
<% const needsList = fields.some(f => f.isCollection); %>
|
|
8
|
+
<% if (needsBigDecimal) { %>
|
|
9
|
+
import java.math.BigDecimal;
|
|
10
|
+
<% } %>
|
|
11
|
+
<% if (needsLocalDate) { %>
|
|
12
|
+
import java.time.LocalDate;
|
|
13
|
+
import java.time.LocalDateTime;
|
|
14
|
+
<% } %>
|
|
15
|
+
<% if (needsUUID) { %>
|
|
16
|
+
import java.util.UUID;
|
|
17
|
+
<% } %>
|
|
18
|
+
<% if (needsList) { %>
|
|
19
|
+
import java.util.List;
|
|
20
|
+
<% } %>
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* <%= name %> - Domain Event
|
|
24
|
+
*
|
|
25
|
+
* Raised when: TODO — describe the business fact this event represents.
|
|
26
|
+
* Aggregate: <%= aggregateName %>
|
|
27
|
+
*
|
|
28
|
+
* This is a pure domain class. It carries no Spring or infrastructure dependencies.
|
|
29
|
+
* Publish it externally via <%= aggregateName %>DomainEventHandler (application layer).
|
|
30
|
+
*/
|
|
31
|
+
public final class <%= name %> extends DomainEvent {
|
|
32
|
+
|
|
33
|
+
<% fields.forEach(field => { %>
|
|
34
|
+
private final <%- field.javaType %> <%= field.name %>;
|
|
35
|
+
<% }); %>
|
|
36
|
+
|
|
37
|
+
public <%= name %>(String aggregateId<% fields.forEach(field => { %>, <%- field.javaType %> <%= field.name %><% }); %>) {
|
|
38
|
+
super(aggregateId);
|
|
39
|
+
<% fields.forEach(field => { %>
|
|
40
|
+
this.<%= field.name %> = <%= field.name %>;
|
|
41
|
+
<% }); %>
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
<% fields.forEach(field => { %>
|
|
45
|
+
public <%- field.javaType %> get<%= field.name.charAt(0).toUpperCase() + field.name.slice(1) %>() {
|
|
46
|
+
return <%= field.name %>;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
<% }); %>
|
|
50
|
+
}
|
|
@@ -74,7 +74,9 @@ if (audit && audit.trackUser) {
|
|
|
74
74
|
<% }); %> })
|
|
75
75
|
<% } %>@Embedded
|
|
76
76
|
<% } %><% if (field.isEnum) { %>@Enumerated(EnumType.STRING)
|
|
77
|
-
<% }
|
|
77
|
+
<% } %><% if (field.reference) { %>/** Cross-aggregate reference → <%= field.reference.aggregate %><% if (field.reference.module) { %> (module: <%= field.reference.module %>)<% } %> */
|
|
78
|
+
<% } %><% if (field.javaDefaultValue) { %>@Builder.Default
|
|
79
|
+
<% } %>private <%- field.isValueObject ? field.javaTypeJpa : field.javaType %> <%= field.name %><% if (field.javaDefaultValue) { %> = <%- field.javaDefaultValue %><% } %>;
|
|
78
80
|
<% } %>
|
|
79
81
|
<% }); %>
|
|
80
82
|
<% relationships.forEach(rel => { %>
|
|
@@ -84,7 +84,9 @@ if (audit && audit.trackUser) {
|
|
|
84
84
|
<% if (field.javaType === 'String') { %>@GeneratedValue(strategy = GenerationType.UUID)
|
|
85
85
|
<% } else if (field.javaType === 'Long' || field.javaType === 'Integer') { %>@GeneratedValue(strategy = GenerationType.IDENTITY)
|
|
86
86
|
<% } %><% } %>@Column(name = "<%= field.name.replace(/([A-Z])/g, '_$1').toLowerCase() %>")
|
|
87
|
-
|
|
87
|
+
<% if (field.reference) { %>/** Cross-aggregate reference → <%= field.reference.aggregate %><% if (field.reference.module) { %> (module: <%= field.reference.module %>)<% } %> */
|
|
88
|
+
<% } %><% if (field.javaDefaultValue) { %>@Builder.Default
|
|
89
|
+
<% } %>private <%- field.javaType %> <%= field.name %><% if (field.javaDefaultValue) { %> = <%- field.javaDefaultValue %><% } %>;
|
|
88
90
|
<% } %>
|
|
89
91
|
<% }); %>
|
|
90
92
|
<% relationships.forEach(rel => { %>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
zookeeper:
|
|
2
|
-
image: confluentinc/cp-zookeeper
|
|
2
|
+
image: confluentinc/cp-zookeeper:<%= kafkaConfluentVersion %>
|
|
3
3
|
container_name: <%= artifactId %>-zookeeper
|
|
4
4
|
ports:
|
|
5
5
|
- "2181:2181"
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
- <%= artifactId %>-network
|
|
11
11
|
|
|
12
12
|
kafka:
|
|
13
|
-
image: confluentinc/cp-kafka
|
|
13
|
+
image: confluentinc/cp-kafka:<%= kafkaConfluentVersion %>
|
|
14
14
|
container_name: <%= artifactId %>-kafka
|
|
15
15
|
ports:
|
|
16
16
|
- "9092:9092" # Para conectarte desde fuera del contenedor
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
temporal:
|
|
2
|
+
image: temporalio/auto-setup:<%= temporalDockerVersion %>
|
|
3
|
+
ports:
|
|
4
|
+
- '7233:7233'
|
|
5
|
+
environment:
|
|
6
|
+
- DB=postgresql
|
|
7
|
+
- DB_PORT=5432
|
|
8
|
+
- POSTGRES_USER=temporal
|
|
9
|
+
- POSTGRES_PWD=temporal
|
|
10
|
+
- POSTGRES_SEEDS=postgres_temporal
|
|
11
|
+
depends_on:
|
|
12
|
+
- postgres_temporal
|
|
13
|
+
|
|
14
|
+
postgres_temporal:
|
|
15
|
+
image: postgres:16-alpine
|
|
16
|
+
environment:
|
|
17
|
+
- POSTGRES_USER=temporal
|
|
18
|
+
- POSTGRES_PASSWORD=temporal
|
|
19
|
+
ports:
|
|
20
|
+
- '5434:5432'
|
|
21
|
+
|
|
22
|
+
temporal-ui:
|
|
23
|
+
image: temporalio/ui:latest
|
|
24
|
+
ports:
|
|
25
|
+
- '8088:8080'
|
|
26
|
+
environment:
|
|
27
|
+
- TEMPORAL_ADDRESS=temporal:7233
|
|
28
|
+
depends_on:
|
|
29
|
+
- temporal
|