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.
Files changed (73) hide show
  1. package/AGENTS.md +441 -14
  2. package/DOMAIN_YAML_GUIDE.md +425 -21
  3. package/FUTURE_FEATURES.md +315 -115
  4. package/QUICK_REFERENCE.md +101 -153
  5. package/README.md +77 -70
  6. package/bin/eva4j.js +57 -1
  7. package/config/defaults.json +3 -0
  8. package/docs/commands/GENERATE_ENTITIES.md +662 -1968
  9. package/docs/commands/GENERATE_HTTP_EXCHANGE.md +274 -450
  10. package/docs/commands/GENERATE_KAFKA_EVENT.md +219 -498
  11. package/docs/commands/GENERATE_KAFKA_LISTENER.md +18 -18
  12. package/docs/commands/GENERATE_RECORD.md +335 -311
  13. package/docs/commands/GENERATE_TEMPORAL_ACTIVITY.md +174 -0
  14. package/docs/commands/GENERATE_TEMPORAL_FLOW.md +237 -0
  15. package/docs/commands/GENERATE_USECASE.md +216 -282
  16. package/docs/commands/INDEX.md +36 -7
  17. package/examples/doctor-evaluation.yaml +3 -3
  18. package/examples/domain-audit-complete.yaml +2 -2
  19. package/examples/domain-collections.yaml +2 -2
  20. package/examples/domain-ecommerce.yaml +2 -2
  21. package/examples/domain-events.yaml +201 -0
  22. package/examples/domain-field-visibility.yaml +11 -5
  23. package/examples/domain-multi-aggregate.yaml +12 -6
  24. package/examples/domain-one-to-many.yaml +1 -1
  25. package/examples/domain-one-to-one.yaml +1 -1
  26. package/examples/domain-secondary-onetomany.yaml +1 -1
  27. package/examples/domain-secondary-onetoone.yaml +1 -1
  28. package/examples/domain-simple.yaml +1 -1
  29. package/examples/domain-soft-delete.yaml +3 -3
  30. package/examples/domain-transitions.yaml +1 -1
  31. package/examples/domain-value-objects.yaml +1 -1
  32. package/package.json +2 -2
  33. package/src/commands/add-kafka-client.js +3 -1
  34. package/src/commands/add-temporal-client.js +286 -0
  35. package/src/commands/generate-entities.js +75 -4
  36. package/src/commands/generate-kafka-event.js +273 -89
  37. package/src/commands/generate-temporal-activity.js +228 -0
  38. package/src/commands/generate-temporal-flow.js +216 -0
  39. package/src/generators/module-generator.js +1 -0
  40. package/src/generators/shared-generator.js +26 -0
  41. package/src/utils/yaml-to-entity.js +93 -4
  42. package/templates/aggregate/AggregateRepository.java.ejs +3 -2
  43. package/templates/aggregate/AggregateRepositoryImpl.java.ejs +15 -7
  44. package/templates/aggregate/AggregateRoot.java.ejs +38 -2
  45. package/templates/aggregate/DomainEntity.java.ejs +6 -2
  46. package/templates/aggregate/DomainEventHandler.java.ejs +62 -0
  47. package/templates/aggregate/DomainEventRecord.java.ejs +50 -0
  48. package/templates/aggregate/JpaAggregateRoot.java.ejs +3 -1
  49. package/templates/aggregate/JpaEntity.java.ejs +3 -1
  50. package/templates/base/docker/kafka-services.yaml.ejs +2 -2
  51. package/templates/base/docker/temporal-services.yaml.ejs +29 -0
  52. package/templates/base/resources/parameters/develop/temporal.yaml.ejs +9 -0
  53. package/templates/base/resources/parameters/local/temporal.yaml.ejs +9 -0
  54. package/templates/base/resources/parameters/production/temporal.yaml.ejs +9 -0
  55. package/templates/base/resources/parameters/test/temporal.yaml.ejs +9 -0
  56. package/templates/base/root/AGENTS.md.ejs +916 -51
  57. package/templates/crud/Controller.java.ejs +36 -6
  58. package/templates/crud/ListQuery.java.ejs +6 -2
  59. package/templates/crud/ListQueryHandler.java.ejs +24 -10
  60. package/templates/crud/UpdateCommand.java.ejs +52 -0
  61. package/templates/crud/UpdateCommandHandler.java.ejs +105 -0
  62. package/templates/kafka-event/DomainEventHandlerMethod.ejs +1 -0
  63. package/templates/kafka-event/Event.java.ejs +23 -0
  64. package/templates/shared/application/dtos/PagedResponse.java.ejs +30 -0
  65. package/templates/shared/configurations/temporalConfig/TemporalConfig.java.ejs +104 -0
  66. package/templates/shared/domain/DomainEvent.java.ejs +40 -0
  67. package/templates/shared/interfaces/HeavyActivity.java.ejs +4 -0
  68. package/templates/shared/interfaces/LightActivity.java.ejs +4 -0
  69. package/templates/temporal-activity/ActivityImpl.java.ejs +14 -0
  70. package/templates/temporal-activity/ActivityInterface.java.ejs +11 -0
  71. package/templates/temporal-flow/WorkFlowImpl.java.ejs +64 -0
  72. package/templates/temporal-flow/WorkFlowInterface.java.ejs +19 -0
  73. 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
- <% } %>private <%- field.isValueObject ? field.javaTypeJpa : field.javaType %> <%= field.name %>;
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
- private <%- field.javaType %> <%= field.name %>;
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:7.6.0
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:7.6.0
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
@@ -0,0 +1,9 @@
1
+ temporal:
2
+ service-url: localhost:7233
3
+ namespace: default
4
+ flow-queue: WORKFLOW_QUEUE
5
+ number-flow-worker: 10
6
+ heavy-queue: HEAVY_TASK_QUEUE
7
+ number-heavy-worker: 10
8
+ light-queue: LIGHT_TASK_QUEUE
9
+ number-light-worker: 10
@@ -0,0 +1,9 @@
1
+ temporal:
2
+ service-url: localhost:7233
3
+ namespace: default
4
+ flow-queue: WORKFLOW_QUEUE
5
+ number-flow-worker: 10
6
+ heavy-queue: HEAVY_TASK_QUEUE
7
+ number-heavy-worker: 10
8
+ light-queue: LIGHT_TASK_QUEUE
9
+ number-light-worker: 10
@@ -0,0 +1,9 @@
1
+ temporal:
2
+ service-url: localhost:7233
3
+ namespace: default
4
+ flow-queue: WORKFLOW_QUEUE
5
+ number-flow-worker: 10
6
+ heavy-queue: HEAVY_TASK_QUEUE
7
+ number-heavy-worker: 10
8
+ light-queue: LIGHT_TASK_QUEUE
9
+ number-light-worker: 10
@@ -0,0 +1,9 @@
1
+ temporal:
2
+ service-url: localhost:7233
3
+ namespace: default
4
+ flow-queue: WORKFLOW_QUEUE
5
+ number-flow-worker: 10
6
+ heavy-queue: HEAVY_TASK_QUEUE
7
+ number-heavy-worker: 10
8
+ light-queue: LIGHT_TASK_QUEUE
9
+ number-light-worker: 10