@pattern-stack/codegen 0.2.0 → 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.
Files changed (52) hide show
  1. package/README.md +9 -4
  2. package/dist/src/cli/index.js +136 -128
  3. package/dist/src/cli/index.js.map +1 -1
  4. package/dist/src/index.d.ts +16 -0
  5. package/dist/src/index.js +25 -0
  6. package/dist/src/index.js.map +1 -1
  7. package/package.json +10 -1
  8. package/templates/entity/new/backend/application/commands/create.ejs.t +38 -1
  9. package/templates/entity/new/backend/application/commands/delete.ejs.t +41 -1
  10. package/templates/entity/new/backend/application/commands/update.ejs.t +42 -1
  11. package/templates/entity/new/backend/database/repository.ejs.t +33 -3
  12. package/templates/entity/new/backend/domain/repository-interface.ejs.t +6 -3
  13. package/templates/entity/new/backend/modules/core/module.ejs.t +6 -0
  14. package/templates/entity/new/backend/presentation/controller.ejs.t +32 -10
  15. package/templates/entity/new/clean-lite-ps/controller.ejs.t +72 -11
  16. package/templates/entity/new/clean-lite-ps/entity.ejs.t +16 -2
  17. package/templates/entity/new/clean-lite-ps/index.ejs.t +1 -1
  18. package/templates/entity/new/clean-lite-ps/module.ejs.t +45 -2
  19. package/templates/entity/new/clean-lite-ps/prompt-extension.js +459 -98
  20. package/templates/entity/new/clean-lite-ps/repository.ejs.t +57 -4
  21. package/templates/entity/new/clean-lite-ps/search-controller.ejs.t +50 -0
  22. package/templates/entity/new/clean-lite-ps/service.ejs.t +98 -1
  23. package/templates/entity/new/clean-lite-ps/use-cases/create.ejs.t +150 -0
  24. package/templates/entity/new/clean-lite-ps/use-cases/delete.ejs.t +70 -0
  25. package/templates/entity/new/clean-lite-ps/use-cases/find-by-id-with-fields.ejs.t +19 -0
  26. package/templates/entity/new/clean-lite-ps/use-cases/find-by-id.ejs.t +7 -3
  27. package/templates/entity/new/clean-lite-ps/use-cases/list-with-fields.ejs.t +17 -0
  28. package/templates/entity/new/clean-lite-ps/use-cases/search.ejs.t +63 -0
  29. package/templates/entity/new/clean-lite-ps/use-cases/update.ejs.t +153 -0
  30. package/templates/entity/new/prompt.js +284 -41
  31. package/templates/relationship/new/entity.ejs.t +2 -2
  32. package/templates/relationship/new/prompt.js +3 -7
  33. package/templates/relationship/new/service.ejs.t +1 -1
  34. package/templates/subsystem/bridge/generated-keep.ejs.t +4 -0
  35. package/templates/subsystem/bridge/prompt.js +36 -0
  36. package/templates/subsystem/bridge-config/codegen-config-bridge-block.ejs.t +20 -0
  37. package/templates/subsystem/bridge-config/prompt.js +20 -0
  38. package/templates/subsystem/events/domain-events.schema.ejs.t +81 -0
  39. package/templates/subsystem/events/generated-keep.ejs.t +4 -0
  40. package/templates/subsystem/events/prompt.js +39 -0
  41. package/templates/subsystem/events-config/codegen-config-events-block.ejs.t +26 -0
  42. package/templates/subsystem/events-config/prompt.js +20 -0
  43. package/templates/subsystem/jobs/job-orchestration.schema.ejs.t +221 -0
  44. package/templates/subsystem/jobs/main-hook.ejs.t +11 -0
  45. package/templates/subsystem/jobs/prompt.js +40 -0
  46. package/templates/subsystem/jobs/worker.ejs.t +82 -0
  47. package/templates/subsystem/jobs-config/codegen-config-jobs-block.ejs.t +55 -0
  48. package/templates/subsystem/jobs-config/prompt.js +20 -0
  49. package/templates/subsystem/sync/prompt.js +43 -0
  50. package/templates/subsystem/sync/sync-audit.schema.ejs.t +195 -0
  51. package/templates/subsystem/sync-config/codegen-config-sync-block.ejs.t +29 -0
  52. package/templates/subsystem/sync-config/prompt.js +22 -0
@@ -3,40 +3,83 @@ to: "<%= typeof clpOutputPaths !== 'undefined' ? clpOutputPaths.module : null %>
3
3
  skip_if: "<%= typeof clpOutputPaths === 'undefined' %>"
4
4
  force: true
5
5
  ---
6
+ <% if (hasEmits) { -%>
7
+ /**
8
+ * EVT-7: This entity emits typed domain events. Use-cases depend on
9
+ * TYPED_EVENT_BUS + DRIZZLE. Ensure EventsModule is registered in the
10
+ * root AppModule (global) so these tokens resolve at runtime.
11
+ */
12
+ <% } -%>
6
13
  import { Module } from '@nestjs/common';
7
14
  import { DatabaseModule } from '@shared/database/database.module';
8
15
  <%_ clpBelongsTo.forEach(rel => { _%>
9
16
  // import { <%= rel.relatedEntityPascal %>sModule } from '../<%= rel.relatedPlural %>/<%= rel.relatedPlural %>.module';
10
17
  <%_ }) _%>
18
+ <% if (eavEnabled) { -%>
19
+ import { FieldValuesModule } from '../field_values/field_values.module';
20
+ <% } -%>
21
+ <% if (eavValueTable) { -%>
22
+ import { <%= eavDefinitionPluralPascal %>Module } from '../<%= eavDefinitionEntityPlural %>/<%= eavDefinitionEntityPlural %>.module';
23
+ <% } -%>
11
24
 
12
25
  import { <%= classNames.repository %> } from './<%= entityName %>.repository';
13
26
  import { <%= classNames.service %> } from './<%= entityName %>.service';
14
27
  import { <%= classNames.controller %> } from './<%= entityName %>.controller';
15
28
  import { <%= classNames.findByIdUseCase %> } from './use-cases/find-<%= entityName %>-by-id.use-case';
16
29
  import { <%= classNames.listUseCase %> } from './use-cases/list-<%= entityNamePlural %>.use-case';
30
+ <% if (eavEnabled) { -%>
31
+ import { <%= classNames.findByIdWithFieldsUseCase %> } from './use-cases/find-<%= entityName %>-by-id-with-fields.use-case';
32
+ import { <%= classNames.listWithFieldsUseCase %> } from './use-cases/list-<%= entityNamePlural %>-with-fields.use-case';
33
+ <% } -%>
34
+ <% if (generateWrites) { -%>
35
+ import { <%= classNames.createUseCase %> } from './use-cases/create-<%= entityName %>.use-case';
36
+ import { <%= classNames.updateUseCase %> } from './use-cases/update-<%= entityName %>.use-case';
37
+ import { <%= classNames.deleteUseCase %> } from './use-cases/delete-<%= entityName %>.use-case';
38
+ <% } -%>
17
39
  <% if (hasDeclarativeQueries) { -%>
18
40
  import { declarativeQueryClasses } from './use-cases/declarative-queries';
19
41
  <% } -%>
42
+ <% if (hasSearchQuery) { -%>
43
+ import { <%= searchQuery.useCaseClassName %> } from './use-cases/search-<%= entityNamePlural %>.use-case';
44
+ import { <%= classNames.searchController %> } from './<%= entityName %>-search.controller';
45
+ <% } -%>
20
46
 
21
47
  @Module({
22
48
  imports: [
23
49
  DatabaseModule,
50
+ <% if (eavEnabled) { -%>
51
+ FieldValuesModule,
52
+ <% } -%>
53
+ <% if (eavValueTable) { -%>
54
+ <%= eavDefinitionPluralPascal %>Module,
55
+ <% } -%>
24
56
  // TODO: Add subsystem modules as needed (EventsSubsystemModule, IntegrationsSubsystemModule, etc.)
25
57
  // Cross-domain modules from relationships:
26
58
  <%_ clpBelongsTo.forEach(rel => { _%>
27
59
  // <%= rel.relatedEntityPascal %>sModule,
28
60
  <%_ }) _%>
29
61
  ],
30
- controllers: [<%= classNames.controller %>],
62
+ controllers: [<%= classNames.controller %><% if (hasSearchQuery) { %>, <%= classNames.searchController %><% } %>],
31
63
  providers: [
32
64
  <%= classNames.repository %>,
33
65
  <%= classNames.service %>,
34
66
  <%= classNames.findByIdUseCase %>,
35
67
  <%= classNames.listUseCase %>,
68
+ <% if (eavEnabled) { -%>
69
+ <%= classNames.findByIdWithFieldsUseCase %>,
70
+ <%= classNames.listWithFieldsUseCase %>,
71
+ <% } -%>
72
+ <% if (generateWrites) { -%>
73
+ <%= classNames.createUseCase %>,
74
+ <%= classNames.updateUseCase %>,
75
+ <%= classNames.deleteUseCase %>,
76
+ <% } -%>
36
77
  <% if (hasDeclarativeQueries) { -%>
37
78
  ...declarativeQueryClasses,
38
79
  <% } -%>
39
- // TODO: Register hand-written use cases here
80
+ <% if (hasSearchQuery) { -%>
81
+ <%= searchQuery.useCaseClassName %>,
82
+ <% } -%>
40
83
  ],
41
84
  exports: [<%= classNames.service %>], // Only service is exported (ADR-002)
42
85
  })