nestjs-ddd-cli 2.2.1 → 3.2.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.
Files changed (254) hide show
  1. package/README.md +247 -408
  2. package/ddd.schema.json +111 -0
  3. package/dist/commands/aggregate-validator.d.ts +9 -0
  4. package/dist/commands/aggregate-validator.js +953 -0
  5. package/dist/commands/aggregate-validator.js.map +1 -0
  6. package/dist/commands/ai-assist.d.ts +8 -0
  7. package/dist/commands/ai-assist.js +337 -0
  8. package/dist/commands/ai-assist.js.map +1 -0
  9. package/dist/commands/api-contracts.d.ts +9 -0
  10. package/dist/commands/api-contracts.js +1368 -0
  11. package/dist/commands/api-contracts.js.map +1 -0
  12. package/dist/commands/api-docs.d.ts +8 -0
  13. package/dist/commands/api-docs.js +408 -0
  14. package/dist/commands/api-docs.js.map +1 -0
  15. package/dist/commands/api-versioning.d.ts +11 -0
  16. package/dist/commands/api-versioning.js +643 -0
  17. package/dist/commands/api-versioning.js.map +1 -0
  18. package/dist/commands/audit-logging.d.ts +9 -0
  19. package/dist/commands/audit-logging.js +1129 -0
  20. package/dist/commands/audit-logging.js.map +1 -0
  21. package/dist/commands/batch-generate.d.ts +10 -0
  22. package/dist/commands/batch-generate.js +405 -0
  23. package/dist/commands/batch-generate.js.map +1 -0
  24. package/dist/commands/caching-strategies.d.ts +9 -0
  25. package/dist/commands/caching-strategies.js +874 -0
  26. package/dist/commands/caching-strategies.js.map +1 -0
  27. package/dist/commands/code-analyzer.d.ts +42 -0
  28. package/dist/commands/code-analyzer.js +474 -0
  29. package/dist/commands/code-analyzer.js.map +1 -0
  30. package/dist/commands/database-seeding.d.ts +6 -0
  31. package/dist/commands/database-seeding.js +621 -0
  32. package/dist/commands/database-seeding.js.map +1 -0
  33. package/dist/commands/db-optimization.d.ts +7 -0
  34. package/dist/commands/db-optimization.js +687 -0
  35. package/dist/commands/db-optimization.js.map +1 -0
  36. package/dist/commands/dependency-graph.d.ts +6 -0
  37. package/dist/commands/dependency-graph.js +329 -0
  38. package/dist/commands/dependency-graph.js.map +1 -0
  39. package/dist/commands/doctor-enhanced.d.ts +22 -0
  40. package/dist/commands/doctor-enhanced.js +543 -0
  41. package/dist/commands/doctor-enhanced.js.map +1 -0
  42. package/dist/commands/doctor.d.ts +4 -0
  43. package/dist/commands/doctor.js +151 -0
  44. package/dist/commands/doctor.js.map +1 -0
  45. package/dist/commands/env-manager.d.ts +6 -0
  46. package/dist/commands/env-manager.js +419 -0
  47. package/dist/commands/env-manager.js.map +1 -0
  48. package/dist/commands/event-sourcing-full.d.ts +10 -0
  49. package/dist/commands/event-sourcing-full.js +1107 -0
  50. package/dist/commands/event-sourcing-full.js.map +1 -0
  51. package/dist/commands/feature-flags.d.ts +9 -0
  52. package/dist/commands/feature-flags.js +824 -0
  53. package/dist/commands/feature-flags.js.map +1 -0
  54. package/dist/commands/filter-dsl.d.ts +10 -0
  55. package/dist/commands/filter-dsl.js +1407 -0
  56. package/dist/commands/filter-dsl.js.map +1 -0
  57. package/dist/commands/generate-all.js +485 -32
  58. package/dist/commands/generate-all.js.map +1 -1
  59. package/dist/commands/generate-deployment.d.ts +8 -0
  60. package/dist/commands/generate-deployment.js +746 -0
  61. package/dist/commands/generate-deployment.js.map +1 -0
  62. package/dist/commands/generate-domain-service.d.ts +14 -0
  63. package/dist/commands/generate-domain-service.js +796 -0
  64. package/dist/commands/generate-domain-service.js.map +1 -0
  65. package/dist/commands/generate-entity.js +82 -24
  66. package/dist/commands/generate-entity.js.map +1 -1
  67. package/dist/commands/generate-from-schema.d.ts +56 -0
  68. package/dist/commands/generate-from-schema.js +222 -0
  69. package/dist/commands/generate-from-schema.js.map +1 -0
  70. package/dist/commands/generate-orchestrator.d.ts +14 -0
  71. package/dist/commands/generate-orchestrator.js +887 -0
  72. package/dist/commands/generate-orchestrator.js.map +1 -0
  73. package/dist/commands/generate-repository.d.ts +14 -0
  74. package/dist/commands/generate-repository.js +1019 -0
  75. package/dist/commands/generate-repository.js.map +1 -0
  76. package/dist/commands/generate-shared.d.ts +4 -0
  77. package/dist/commands/generate-shared.js +388 -0
  78. package/dist/commands/generate-shared.js.map +1 -0
  79. package/dist/commands/generate-value-object.d.ts +32 -0
  80. package/dist/commands/generate-value-object.js +700 -0
  81. package/dist/commands/generate-value-object.js.map +1 -0
  82. package/dist/commands/graphql-subscriptions.d.ts +6 -0
  83. package/dist/commands/graphql-subscriptions.js +607 -0
  84. package/dist/commands/graphql-subscriptions.js.map +1 -0
  85. package/dist/commands/graphql-types.d.ts +5 -0
  86. package/dist/commands/graphql-types.js +423 -0
  87. package/dist/commands/graphql-types.js.map +1 -0
  88. package/dist/commands/health-probes-advanced.d.ts +6 -0
  89. package/dist/commands/health-probes-advanced.js +655 -0
  90. package/dist/commands/health-probes-advanced.js.map +1 -0
  91. package/dist/commands/i18n-setup.d.ts +10 -0
  92. package/dist/commands/i18n-setup.js +677 -0
  93. package/dist/commands/i18n-setup.js.map +1 -0
  94. package/dist/commands/init-config.d.ts +6 -0
  95. package/dist/commands/init-config.js +370 -0
  96. package/dist/commands/init-config.js.map +1 -0
  97. package/dist/commands/init-project.js +56 -6
  98. package/dist/commands/init-project.js.map +1 -1
  99. package/dist/commands/interactive-scaffold.d.ts +5 -0
  100. package/dist/commands/interactive-scaffold.js +271 -0
  101. package/dist/commands/interactive-scaffold.js.map +1 -0
  102. package/dist/commands/metrics-prometheus.d.ts +6 -0
  103. package/dist/commands/metrics-prometheus.js +681 -0
  104. package/dist/commands/metrics-prometheus.js.map +1 -0
  105. package/dist/commands/migration-engine.d.ts +6 -0
  106. package/dist/commands/migration-engine.js +446 -0
  107. package/dist/commands/migration-engine.js.map +1 -0
  108. package/dist/commands/migration.d.ts +12 -0
  109. package/dist/commands/migration.js +484 -0
  110. package/dist/commands/migration.js.map +1 -0
  111. package/dist/commands/monorepo.d.ts +8 -0
  112. package/dist/commands/monorepo.js +483 -0
  113. package/dist/commands/monorepo.js.map +1 -0
  114. package/dist/commands/multi-database.d.ts +5 -0
  115. package/dist/commands/multi-database.js +439 -0
  116. package/dist/commands/multi-database.js.map +1 -0
  117. package/dist/commands/observability-tracing.d.ts +10 -0
  118. package/dist/commands/observability-tracing.js +740 -0
  119. package/dist/commands/observability-tracing.js.map +1 -0
  120. package/dist/commands/openapi-export.d.ts +8 -0
  121. package/dist/commands/openapi-export.js +359 -0
  122. package/dist/commands/openapi-export.js.map +1 -0
  123. package/dist/commands/perf-analyzer.d.ts +8 -0
  124. package/dist/commands/perf-analyzer.js +423 -0
  125. package/dist/commands/perf-analyzer.js.map +1 -0
  126. package/dist/commands/rate-limiting.d.ts +10 -0
  127. package/dist/commands/rate-limiting.js +953 -0
  128. package/dist/commands/rate-limiting.js.map +1 -0
  129. package/dist/commands/recipe-plugin.d.ts +56 -0
  130. package/dist/commands/recipe-plugin.js +315 -0
  131. package/dist/commands/recipe-plugin.js.map +1 -0
  132. package/dist/commands/recipe.d.ts +6 -0
  133. package/dist/commands/recipe.js +3941 -0
  134. package/dist/commands/recipe.js.map +1 -0
  135. package/dist/commands/recipes/elasticsearch.recipe.d.ts +1 -0
  136. package/dist/commands/recipes/elasticsearch.recipe.js +761 -0
  137. package/dist/commands/recipes/elasticsearch.recipe.js.map +1 -0
  138. package/dist/commands/recipes/event-sourcing.recipe.d.ts +1 -0
  139. package/dist/commands/recipes/event-sourcing.recipe.js +889 -0
  140. package/dist/commands/recipes/event-sourcing.recipe.js.map +1 -0
  141. package/dist/commands/recipes/index.d.ts +7 -0
  142. package/dist/commands/recipes/index.js +24 -0
  143. package/dist/commands/recipes/index.js.map +1 -0
  144. package/dist/commands/recipes/message-queue.recipe.d.ts +1 -0
  145. package/dist/commands/recipes/message-queue.recipe.js +706 -0
  146. package/dist/commands/recipes/message-queue.recipe.js.map +1 -0
  147. package/dist/commands/recipes/middleware.recipe.d.ts +1 -0
  148. package/dist/commands/recipes/middleware.recipe.js +383 -0
  149. package/dist/commands/recipes/middleware.recipe.js.map +1 -0
  150. package/dist/commands/recipes/multi-tenancy.recipe.d.ts +1 -0
  151. package/dist/commands/recipes/multi-tenancy.recipe.js +520 -0
  152. package/dist/commands/recipes/multi-tenancy.recipe.js.map +1 -0
  153. package/dist/commands/recipes/oauth2.recipe.d.ts +1 -0
  154. package/dist/commands/recipes/oauth2.recipe.js +472 -0
  155. package/dist/commands/recipes/oauth2.recipe.js.map +1 -0
  156. package/dist/commands/recipes/websocket.recipe.d.ts +1 -0
  157. package/dist/commands/recipes/websocket.recipe.js +453 -0
  158. package/dist/commands/recipes/websocket.recipe.js.map +1 -0
  159. package/dist/commands/resilience-patterns.d.ts +13 -0
  160. package/dist/commands/resilience-patterns.js +1029 -0
  161. package/dist/commands/resilience-patterns.js.map +1 -0
  162. package/dist/commands/security-patterns.d.ts +11 -0
  163. package/dist/commands/security-patterns.js +2233 -0
  164. package/dist/commands/security-patterns.js.map +1 -0
  165. package/dist/commands/template-debug.d.ts +27 -0
  166. package/dist/commands/template-debug.js +388 -0
  167. package/dist/commands/template-debug.js.map +1 -0
  168. package/dist/commands/test-factory-full.d.ts +9 -0
  169. package/dist/commands/test-factory-full.js +1570 -0
  170. package/dist/commands/test-factory-full.js.map +1 -0
  171. package/dist/commands/test-scaffold.d.ts +7 -0
  172. package/dist/commands/test-scaffold.js +621 -0
  173. package/dist/commands/test-scaffold.js.map +1 -0
  174. package/dist/index.js +1088 -0
  175. package/dist/index.js.map +1 -1
  176. package/dist/templates/ai-context/CLAUDE.md.hbs +158 -0
  177. package/dist/templates/ai-context/conventions.md.hbs +154 -0
  178. package/dist/templates/command/create-command.hbs +6 -14
  179. package/dist/templates/command/delete-command.hbs +19 -0
  180. package/dist/templates/command/update-command.hbs +24 -0
  181. package/dist/templates/controller/controller.hbs +64 -17
  182. package/dist/templates/dto/create-dto.hbs +29 -5
  183. package/dist/templates/dto/filter-dto.hbs +52 -0
  184. package/dist/templates/dto/filter-query.dto.hbs +148 -0
  185. package/dist/templates/dto/paginated-response.dto.hbs +29 -0
  186. package/dist/templates/dto/pagination-query.dto.hbs +30 -0
  187. package/dist/templates/dto/response-dto.hbs +38 -0
  188. package/dist/templates/dto/update-dto.hbs +11 -0
  189. package/dist/templates/entity/entity.hbs +32 -1
  190. package/dist/templates/event/domain-event.hbs +33 -7
  191. package/dist/templates/event/event-handler.hbs +40 -0
  192. package/dist/templates/exception/base-exceptions.hbs +69 -0
  193. package/dist/templates/exception/entity-not-found.exception.hbs +7 -0
  194. package/dist/templates/mapper/mapper.hbs +49 -24
  195. package/dist/templates/module/module.hbs +34 -10
  196. package/dist/templates/orm-entity/orm-entity.hbs +63 -12
  197. package/dist/templates/prisma/prisma-mapper.hbs +71 -0
  198. package/dist/templates/prisma/prisma-repository.hbs +114 -0
  199. package/dist/templates/prisma/prisma-schema.hbs +20 -0
  200. package/dist/templates/prisma/prisma-service.hbs +51 -0
  201. package/dist/templates/query/get-all.query.hbs +50 -0
  202. package/dist/templates/query/get-by-id.query.hbs +31 -0
  203. package/dist/templates/repository/repository.hbs +55 -13
  204. package/dist/templates/resolver/graphql-input.hbs +54 -0
  205. package/dist/templates/resolver/graphql-type.hbs +58 -0
  206. package/dist/templates/resolver/pagination-args.hbs +33 -0
  207. package/dist/templates/resolver/resolver.hbs +62 -0
  208. package/dist/templates/shared/prisma-query-builder.util.hbs +189 -0
  209. package/dist/templates/shared/query-builder.util.hbs +218 -0
  210. package/dist/templates/test/controller.spec.hbs +124 -0
  211. package/dist/templates/test/repository.spec.hbs +158 -0
  212. package/dist/templates/test/usecase.spec.hbs +116 -0
  213. package/dist/templates/usecase/create-usecase.hbs +19 -7
  214. package/dist/templates/usecase/delete-usecase.hbs +17 -0
  215. package/dist/templates/usecase/update-usecase.hbs +31 -0
  216. package/dist/utils/config.utils.d.ts +45 -0
  217. package/dist/utils/config.utils.js +211 -0
  218. package/dist/utils/config.utils.js.map +1 -0
  219. package/dist/utils/error.utils.d.ts +145 -0
  220. package/dist/utils/error.utils.js +422 -0
  221. package/dist/utils/error.utils.js.map +1 -0
  222. package/dist/utils/field.utils.d.ts +54 -0
  223. package/dist/utils/field.utils.js +389 -0
  224. package/dist/utils/field.utils.js.map +1 -0
  225. package/dist/utils/file.utils.d.ts +19 -8
  226. package/dist/utils/file.utils.js +135 -4
  227. package/dist/utils/file.utils.js.map +1 -1
  228. package/dist/utils/idempotency.utils.d.ts +123 -0
  229. package/dist/utils/idempotency.utils.js +444 -0
  230. package/dist/utils/idempotency.utils.js.map +1 -0
  231. package/dist/utils/naming.utils.js +24 -5
  232. package/dist/utils/naming.utils.js.map +1 -1
  233. package/dist/utils/performance.utils.d.ts +37 -0
  234. package/dist/utils/performance.utils.js +158 -0
  235. package/dist/utils/performance.utils.js.map +1 -0
  236. package/dist/utils/relation.utils.d.ts +92 -0
  237. package/dist/utils/relation.utils.js +388 -0
  238. package/dist/utils/relation.utils.js.map +1 -0
  239. package/dist/utils/rollback.utils.d.ts +49 -0
  240. package/dist/utils/rollback.utils.js +306 -0
  241. package/dist/utils/rollback.utils.js.map +1 -0
  242. package/dist/utils/schema.utils.d.ts +123 -0
  243. package/dist/utils/schema.utils.js +419 -0
  244. package/dist/utils/schema.utils.js.map +1 -0
  245. package/dist/utils/security.utils.d.ts +57 -0
  246. package/dist/utils/security.utils.js +315 -0
  247. package/dist/utils/security.utils.js.map +1 -0
  248. package/dist/utils/template-engine.utils.d.ts +80 -0
  249. package/dist/utils/template-engine.utils.js +463 -0
  250. package/dist/utils/template-engine.utils.js.map +1 -0
  251. package/dist/utils/validation-registry.utils.d.ts +160 -0
  252. package/dist/utils/validation-registry.utils.js +526 -0
  253. package/dist/utils/validation-registry.utils.js.map +1 -0
  254. package/package.json +3 -1
@@ -0,0 +1,700 @@
1
+ "use strict";
2
+ /**
3
+ * Value Object & Domain Primitives Generator
4
+ * Generates strongly-typed value objects with validation, comparison, and serialization
5
+ */
6
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
7
+ if (k2 === undefined) k2 = k;
8
+ var desc = Object.getOwnPropertyDescriptor(m, k);
9
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
10
+ desc = { enumerable: true, get: function() { return m[k]; } };
11
+ }
12
+ Object.defineProperty(o, k2, desc);
13
+ }) : (function(o, m, k, k2) {
14
+ if (k2 === undefined) k2 = k;
15
+ o[k2] = m[k];
16
+ }));
17
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
18
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
19
+ }) : function(o, v) {
20
+ o["default"] = v;
21
+ });
22
+ var __importStar = (this && this.__importStar) || (function () {
23
+ var ownKeys = function(o) {
24
+ ownKeys = Object.getOwnPropertyNames || function (o) {
25
+ var ar = [];
26
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
27
+ return ar;
28
+ };
29
+ return ownKeys(o);
30
+ };
31
+ return function (mod) {
32
+ if (mod && mod.__esModule) return mod;
33
+ var result = {};
34
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
35
+ __setModuleDefault(result, mod);
36
+ return result;
37
+ };
38
+ })();
39
+ var __importDefault = (this && this.__importDefault) || function (mod) {
40
+ return (mod && mod.__esModule) ? mod : { "default": mod };
41
+ };
42
+ Object.defineProperty(exports, "__esModule", { value: true });
43
+ exports.generateValueObject = generateValueObject;
44
+ exports.setupValueObjects = setupValueObjects;
45
+ const fs = __importStar(require("fs"));
46
+ const path = __importStar(require("path"));
47
+ const chalk_1 = __importDefault(require("chalk"));
48
+ async function generateValueObject(name, basePath, options = {}) {
49
+ console.log(chalk_1.default.bold.blue('\nšŸ’Ž Generating Value Object\n'));
50
+ const moduleName = options.module || 'shared';
51
+ const voPath = path.join(basePath, 'src', moduleName, 'domain', 'value-objects');
52
+ if (!fs.existsSync(voPath)) {
53
+ fs.mkdirSync(voPath, { recursive: true });
54
+ }
55
+ // Generate the value object file
56
+ const voContent = generateValueObjectClass(name, options.type || 'simple');
57
+ const voFile = path.join(voPath, `${toKebabCase(name)}.value-object.ts`);
58
+ fs.writeFileSync(voFile, voContent);
59
+ console.log(chalk_1.default.green(` āœ“ Created ${voFile}`));
60
+ // Generate base value object if not exists
61
+ const baseVoPath = path.join(basePath, 'src/shared/domain');
62
+ if (!fs.existsSync(baseVoPath)) {
63
+ fs.mkdirSync(baseVoPath, { recursive: true });
64
+ }
65
+ const baseVoFile = path.join(baseVoPath, 'value-object.base.ts');
66
+ if (!fs.existsSync(baseVoFile)) {
67
+ fs.writeFileSync(baseVoFile, generateBaseValueObject());
68
+ console.log(chalk_1.default.green(` āœ“ Created ${baseVoFile}`));
69
+ }
70
+ // Generate common primitives
71
+ const primitivesFile = path.join(baseVoPath, 'primitives.ts');
72
+ if (!fs.existsSync(primitivesFile)) {
73
+ fs.writeFileSync(primitivesFile, generatePrimitives());
74
+ console.log(chalk_1.default.green(` āœ“ Created ${primitivesFile}`));
75
+ }
76
+ console.log(chalk_1.default.bold.green('\nāœ… Value object generated successfully!\n'));
77
+ }
78
+ function generateValueObjectClass(name, type) {
79
+ const className = toPascalCase(name);
80
+ return `import { ValueObject } from '@shared/domain/value-object.base';
81
+
82
+ /**
83
+ * ${className} Value Object
84
+ * Immutable value representing ${name}
85
+ */
86
+ export interface ${className}Props {
87
+ value: string;
88
+ }
89
+
90
+ export class ${className} extends ValueObject<${className}Props> {
91
+ private constructor(props: ${className}Props) {
92
+ super(props);
93
+ }
94
+
95
+ /**
96
+ * Get the raw value
97
+ */
98
+ get value(): string {
99
+ return this.props.value;
100
+ }
101
+
102
+ /**
103
+ * Factory method with validation
104
+ */
105
+ public static create(value: string): ${className} {
106
+ // Validation rules
107
+ if (!value || value.trim().length === 0) {
108
+ throw new Error('${className} cannot be empty');
109
+ }
110
+
111
+ return new ${className}({ value: value.trim() });
112
+ }
113
+
114
+ /**
115
+ * Create from an existing value (bypasses validation for trusted sources)
116
+ */
117
+ public static fromPersistence(value: string): ${className} {
118
+ return new ${className}({ value });
119
+ }
120
+
121
+ /**
122
+ * Convert to primitive for persistence
123
+ */
124
+ public toPrimitive(): string {
125
+ return this.props.value;
126
+ }
127
+
128
+ /**
129
+ * String representation
130
+ */
131
+ public toString(): string {
132
+ return this.props.value;
133
+ }
134
+
135
+ /**
136
+ * Check if empty
137
+ */
138
+ public isEmpty(): boolean {
139
+ return !this.props.value || this.props.value.length === 0;
140
+ }
141
+ }
142
+ `;
143
+ }
144
+ function generateBaseValueObject() {
145
+ return `/**
146
+ * Base Value Object
147
+ * Foundation for all value objects in the domain
148
+ */
149
+
150
+ export interface ValueObjectProps {
151
+ [key: string]: any;
152
+ }
153
+
154
+ /**
155
+ * Abstract Value Object base class
156
+ * Implements structural equality and immutability
157
+ */
158
+ export abstract class ValueObject<T extends ValueObjectProps> {
159
+ protected readonly props: T;
160
+
161
+ protected constructor(props: T) {
162
+ this.props = Object.freeze(props);
163
+ }
164
+
165
+ /**
166
+ * Check equality based on all properties
167
+ */
168
+ public equals(vo?: ValueObject<T>): boolean {
169
+ if (vo === null || vo === undefined) {
170
+ return false;
171
+ }
172
+ if (vo.props === undefined) {
173
+ return false;
174
+ }
175
+ return JSON.stringify(this.props) === JSON.stringify(vo.props);
176
+ }
177
+
178
+ /**
179
+ * Create a copy with updated properties
180
+ */
181
+ protected clone(props: Partial<T>): this {
182
+ const Constructor = this.constructor as new (props: T) => this;
183
+ return new Constructor({ ...this.props, ...props } as T);
184
+ }
185
+
186
+ /**
187
+ * Get hash code for the value object
188
+ */
189
+ public hashCode(): number {
190
+ const str = JSON.stringify(this.props);
191
+ let hash = 0;
192
+ for (let i = 0; i < str.length; i++) {
193
+ const char = str.charCodeAt(i);
194
+ hash = ((hash << 5) - hash) + char;
195
+ hash = hash & hash;
196
+ }
197
+ return hash;
198
+ }
199
+
200
+ /**
201
+ * Convert to primitive for serialization
202
+ */
203
+ public abstract toPrimitive(): unknown;
204
+ }
205
+
206
+ /**
207
+ * Identifier Value Object
208
+ * Base for entity identifiers with type safety
209
+ */
210
+ export abstract class Identifier<T> extends ValueObject<{ value: T }> {
211
+ constructor(value: T) {
212
+ super({ value });
213
+ }
214
+
215
+ get value(): T {
216
+ return this.props.value;
217
+ }
218
+
219
+ toString(): string {
220
+ return String(this.props.value);
221
+ }
222
+
223
+ toPrimitive(): T {
224
+ return this.props.value;
225
+ }
226
+ }
227
+
228
+ /**
229
+ * UUID Identifier
230
+ */
231
+ export class UniqueEntityID extends Identifier<string> {
232
+ constructor(id?: string) {
233
+ super(id || generateUUID());
234
+ }
235
+
236
+ public static create(id?: string): UniqueEntityID {
237
+ return new UniqueEntityID(id);
238
+ }
239
+ }
240
+
241
+ function generateUUID(): string {
242
+ return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {
243
+ const r = Math.random() * 16 | 0;
244
+ const v = c === 'x' ? r : (r & 0x3 | 0x8);
245
+ return v.toString(16);
246
+ });
247
+ }
248
+
249
+ /**
250
+ * Result type for value object creation
251
+ */
252
+ export type Result<T, E = Error> =
253
+ | { success: true; value: T }
254
+ | { success: false; error: E };
255
+
256
+ export function ok<T>(value: T): Result<T> {
257
+ return { success: true, value };
258
+ }
259
+
260
+ export function err<E = Error>(error: E): Result<never, E> {
261
+ return { success: false, error };
262
+ }
263
+
264
+ /**
265
+ * Guard utilities for value object validation
266
+ */
267
+ export class Guard {
268
+ public static againstNullOrUndefined(value: any, name: string): Result<void> {
269
+ if (value === null || value === undefined) {
270
+ return err(new Error(\`\${name} is null or undefined\`));
271
+ }
272
+ return ok(undefined);
273
+ }
274
+
275
+ public static againstEmpty(value: string, name: string): Result<void> {
276
+ if (value.trim().length === 0) {
277
+ return err(new Error(\`\${name} is empty\`));
278
+ }
279
+ return ok(undefined);
280
+ }
281
+
282
+ public static againstNullOrUndefinedBulk(args: { value: any; name: string }[]): Result<void> {
283
+ for (const arg of args) {
284
+ const result = this.againstNullOrUndefined(arg.value, arg.name);
285
+ if (!result.success) return result;
286
+ }
287
+ return ok(undefined);
288
+ }
289
+
290
+ public static isOneOf(value: any, validValues: any[], name: string): Result<void> {
291
+ if (!validValues.includes(value)) {
292
+ return err(new Error(\`\${name} must be one of \${validValues.join(', ')}\`));
293
+ }
294
+ return ok(undefined);
295
+ }
296
+
297
+ public static inRange(num: number, min: number, max: number, name: string): Result<void> {
298
+ if (num < min || num > max) {
299
+ return err(new Error(\`\${name} must be between \${min} and \${max}\`));
300
+ }
301
+ return ok(undefined);
302
+ }
303
+
304
+ public static combine(results: Result<void>[]): Result<void> {
305
+ for (const result of results) {
306
+ if (!result.success) return result;
307
+ }
308
+ return ok(undefined);
309
+ }
310
+ }
311
+ `;
312
+ }
313
+ function generatePrimitives() {
314
+ return `/**
315
+ * Domain Primitives
316
+ * Common value objects for typical domain properties
317
+ */
318
+
319
+ import { ValueObject, Guard, ok, err, Result } from './value-object.base';
320
+
321
+ /**
322
+ * Email Value Object
323
+ */
324
+ export interface EmailProps {
325
+ value: string;
326
+ }
327
+
328
+ export class Email extends ValueObject<EmailProps> {
329
+ private static readonly EMAIL_REGEX = /^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/;
330
+
331
+ private constructor(props: EmailProps) {
332
+ super(props);
333
+ }
334
+
335
+ get value(): string {
336
+ return this.props.value;
337
+ }
338
+
339
+ public static create(email: string): Result<Email> {
340
+ const guardResult = Guard.againstNullOrUndefined(email, 'email');
341
+ if (!guardResult.success) return guardResult as Result<Email>;
342
+
343
+ if (!this.isValidEmail(email)) {
344
+ return err(new Error('Invalid email format'));
345
+ }
346
+
347
+ return ok(new Email({ value: email.toLowerCase() }));
348
+ }
349
+
350
+ private static isValidEmail(email: string): boolean {
351
+ return this.EMAIL_REGEX.test(email);
352
+ }
353
+
354
+ public toPrimitive(): string {
355
+ return this.props.value;
356
+ }
357
+
358
+ public get domain(): string {
359
+ return this.props.value.split('@')[1];
360
+ }
361
+
362
+ public get local(): string {
363
+ return this.props.value.split('@')[0];
364
+ }
365
+ }
366
+
367
+ /**
368
+ * Money Value Object
369
+ */
370
+ export interface MoneyProps {
371
+ amount: number;
372
+ currency: string;
373
+ }
374
+
375
+ export class Money extends ValueObject<MoneyProps> {
376
+ private static readonly VALID_CURRENCIES = ['USD', 'EUR', 'GBP', 'XOF', 'XAF', 'NGN'];
377
+
378
+ private constructor(props: MoneyProps) {
379
+ super(props);
380
+ }
381
+
382
+ get amount(): number {
383
+ return this.props.amount;
384
+ }
385
+
386
+ get currency(): string {
387
+ return this.props.currency;
388
+ }
389
+
390
+ public static create(amount: number, currency: string): Result<Money> {
391
+ const guardResult = Guard.combine([
392
+ Guard.againstNullOrUndefined(amount, 'amount'),
393
+ Guard.againstNullOrUndefined(currency, 'currency'),
394
+ ]);
395
+ if (!guardResult.success) return guardResult as Result<Money>;
396
+
397
+ if (!this.VALID_CURRENCIES.includes(currency.toUpperCase())) {
398
+ return err(new Error(\`Invalid currency: \${currency}\`));
399
+ }
400
+
401
+ return ok(new Money({
402
+ amount: Math.round(amount * 100) / 100,
403
+ currency: currency.toUpperCase(),
404
+ }));
405
+ }
406
+
407
+ public add(money: Money): Result<Money> {
408
+ if (this.currency !== money.currency) {
409
+ return err(new Error('Cannot add money with different currencies'));
410
+ }
411
+ return Money.create(this.amount + money.amount, this.currency);
412
+ }
413
+
414
+ public subtract(money: Money): Result<Money> {
415
+ if (this.currency !== money.currency) {
416
+ return err(new Error('Cannot subtract money with different currencies'));
417
+ }
418
+ return Money.create(this.amount - money.amount, this.currency);
419
+ }
420
+
421
+ public multiply(factor: number): Result<Money> {
422
+ return Money.create(this.amount * factor, this.currency);
423
+ }
424
+
425
+ public isZero(): boolean {
426
+ return this.amount === 0;
427
+ }
428
+
429
+ public isNegative(): boolean {
430
+ return this.amount < 0;
431
+ }
432
+
433
+ public isPositive(): boolean {
434
+ return this.amount > 0;
435
+ }
436
+
437
+ public toPrimitive(): MoneyProps {
438
+ return { ...this.props };
439
+ }
440
+
441
+ public format(locale = 'en-US'): string {
442
+ return new Intl.NumberFormat(locale, {
443
+ style: 'currency',
444
+ currency: this.currency,
445
+ }).format(this.amount);
446
+ }
447
+ }
448
+
449
+ /**
450
+ * Phone Number Value Object
451
+ */
452
+ export interface PhoneNumberProps {
453
+ number: string;
454
+ countryCode: string;
455
+ }
456
+
457
+ export class PhoneNumber extends ValueObject<PhoneNumberProps> {
458
+ private constructor(props: PhoneNumberProps) {
459
+ super(props);
460
+ }
461
+
462
+ get number(): string {
463
+ return this.props.number;
464
+ }
465
+
466
+ get countryCode(): string {
467
+ return this.props.countryCode;
468
+ }
469
+
470
+ get full(): string {
471
+ return \`+\${this.props.countryCode}\${this.props.number}\`;
472
+ }
473
+
474
+ public static create(number: string, countryCode: string): Result<PhoneNumber> {
475
+ const cleanNumber = number.replace(/\\D/g, '');
476
+
477
+ if (cleanNumber.length < 7 || cleanNumber.length > 15) {
478
+ return err(new Error('Invalid phone number length'));
479
+ }
480
+
481
+ return ok(new PhoneNumber({
482
+ number: cleanNumber,
483
+ countryCode: countryCode.replace('+', ''),
484
+ }));
485
+ }
486
+
487
+ public toPrimitive(): PhoneNumberProps {
488
+ return { ...this.props };
489
+ }
490
+ }
491
+
492
+ /**
493
+ * Address Value Object
494
+ */
495
+ export interface AddressProps {
496
+ street: string;
497
+ city: string;
498
+ state?: string;
499
+ postalCode?: string;
500
+ country: string;
501
+ }
502
+
503
+ export class Address extends ValueObject<AddressProps> {
504
+ private constructor(props: AddressProps) {
505
+ super(props);
506
+ }
507
+
508
+ get street(): string { return this.props.street; }
509
+ get city(): string { return this.props.city; }
510
+ get state(): string | undefined { return this.props.state; }
511
+ get postalCode(): string | undefined { return this.props.postalCode; }
512
+ get country(): string { return this.props.country; }
513
+
514
+ public static create(props: AddressProps): Result<Address> {
515
+ const guardResult = Guard.combine([
516
+ Guard.againstNullOrUndefined(props.street, 'street'),
517
+ Guard.againstNullOrUndefined(props.city, 'city'),
518
+ Guard.againstNullOrUndefined(props.country, 'country'),
519
+ ]);
520
+ if (!guardResult.success) return guardResult as Result<Address>;
521
+
522
+ return ok(new Address(props));
523
+ }
524
+
525
+ public toPrimitive(): AddressProps {
526
+ return { ...this.props };
527
+ }
528
+
529
+ public format(): string {
530
+ const parts = [this.street, this.city];
531
+ if (this.state) parts.push(this.state);
532
+ if (this.postalCode) parts.push(this.postalCode);
533
+ parts.push(this.country);
534
+ return parts.join(', ');
535
+ }
536
+ }
537
+
538
+ /**
539
+ * Date Range Value Object
540
+ */
541
+ export interface DateRangeProps {
542
+ start: Date;
543
+ end: Date;
544
+ }
545
+
546
+ export class DateRange extends ValueObject<DateRangeProps> {
547
+ private constructor(props: DateRangeProps) {
548
+ super(props);
549
+ }
550
+
551
+ get start(): Date { return this.props.start; }
552
+ get end(): Date { return this.props.end; }
553
+
554
+ public static create(start: Date, end: Date): Result<DateRange> {
555
+ if (start > end) {
556
+ return err(new Error('Start date must be before end date'));
557
+ }
558
+ return ok(new DateRange({ start, end }));
559
+ }
560
+
561
+ public contains(date: Date): boolean {
562
+ return date >= this.start && date <= this.end;
563
+ }
564
+
565
+ public overlaps(other: DateRange): boolean {
566
+ return this.start <= other.end && this.end >= other.start;
567
+ }
568
+
569
+ public duration(): number {
570
+ return this.end.getTime() - this.start.getTime();
571
+ }
572
+
573
+ public durationInDays(): number {
574
+ return Math.ceil(this.duration() / (1000 * 60 * 60 * 24));
575
+ }
576
+
577
+ public toPrimitive(): { start: string; end: string } {
578
+ return {
579
+ start: this.props.start.toISOString(),
580
+ end: this.props.end.toISOString(),
581
+ };
582
+ }
583
+ }
584
+
585
+ /**
586
+ * Percentage Value Object
587
+ */
588
+ export interface PercentageProps {
589
+ value: number;
590
+ }
591
+
592
+ export class Percentage extends ValueObject<PercentageProps> {
593
+ private constructor(props: PercentageProps) {
594
+ super(props);
595
+ }
596
+
597
+ get value(): number {
598
+ return this.props.value;
599
+ }
600
+
601
+ public static create(value: number): Result<Percentage> {
602
+ if (value < 0 || value > 100) {
603
+ return err(new Error('Percentage must be between 0 and 100'));
604
+ }
605
+ return ok(new Percentage({ value }));
606
+ }
607
+
608
+ public static fromDecimal(decimal: number): Result<Percentage> {
609
+ return this.create(decimal * 100);
610
+ }
611
+
612
+ public toDecimal(): number {
613
+ return this.value / 100;
614
+ }
615
+
616
+ public apply(amount: number): number {
617
+ return amount * this.toDecimal();
618
+ }
619
+
620
+ public toPrimitive(): number {
621
+ return this.value;
622
+ }
623
+ }
624
+
625
+ /**
626
+ * Slug Value Object
627
+ */
628
+ export interface SlugProps {
629
+ value: string;
630
+ }
631
+
632
+ export class Slug extends ValueObject<SlugProps> {
633
+ private constructor(props: SlugProps) {
634
+ super(props);
635
+ }
636
+
637
+ get value(): string {
638
+ return this.props.value;
639
+ }
640
+
641
+ public static create(text: string): Result<Slug> {
642
+ const slugified = text
643
+ .toLowerCase()
644
+ .trim()
645
+ .replace(/[^\\w\\s-]/g, '')
646
+ .replace(/[\\s_-]+/g, '-')
647
+ .replace(/^-+|-+$/g, '');
648
+
649
+ if (slugified.length === 0) {
650
+ return err(new Error('Cannot create slug from empty text'));
651
+ }
652
+
653
+ return ok(new Slug({ value: slugified }));
654
+ }
655
+
656
+ public toPrimitive(): string {
657
+ return this.value;
658
+ }
659
+ }
660
+ `;
661
+ }
662
+ // Helper functions
663
+ function toKebabCase(str) {
664
+ return str
665
+ .replace(/([a-z])([A-Z])/g, '$1-$2')
666
+ .replace(/[\\s_]+/g, '-')
667
+ .toLowerCase();
668
+ }
669
+ function toPascalCase(str) {
670
+ return str
671
+ .replace(/[-_\\s]+(.)?/g, (_, c) => c ? c.toUpperCase() : '')
672
+ .replace(/^(.)/, c => c.toUpperCase());
673
+ }
674
+ /**
675
+ * Generate common value objects for a module
676
+ */
677
+ async function setupValueObjects(basePath, options = {}) {
678
+ console.log(chalk_1.default.bold.blue('\nšŸ’Ž Setting up Value Objects Infrastructure\n'));
679
+ const sharedPath = path.join(basePath, 'src/shared/domain');
680
+ if (!fs.existsSync(sharedPath)) {
681
+ fs.mkdirSync(sharedPath, { recursive: true });
682
+ }
683
+ // Generate base value object
684
+ const baseVoFile = path.join(sharedPath, 'value-object.base.ts');
685
+ fs.writeFileSync(baseVoFile, generateBaseValueObject());
686
+ console.log(chalk_1.default.green(` āœ“ Created ${baseVoFile}`));
687
+ // Generate primitives
688
+ const primitivesFile = path.join(sharedPath, 'primitives.ts');
689
+ fs.writeFileSync(primitivesFile, generatePrimitives());
690
+ console.log(chalk_1.default.green(` āœ“ Created ${primitivesFile}`));
691
+ // Generate index
692
+ const indexContent = `export * from './value-object.base';
693
+ export * from './primitives';
694
+ `;
695
+ const indexFile = path.join(sharedPath, 'index.ts');
696
+ fs.writeFileSync(indexFile, indexContent);
697
+ console.log(chalk_1.default.green(` āœ“ Created ${indexFile}`));
698
+ console.log(chalk_1.default.bold.green('\nāœ… Value objects infrastructure ready!\n'));
699
+ }
700
+ //# sourceMappingURL=generate-value-object.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generate-value-object.js","sourceRoot":"","sources":["../../src/commands/generate-value-object.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiCH,kDAwCC;AA+lBD,8CA4BC;AAlsBD,uCAAyB;AACzB,2CAA6B;AAC7B,kDAA0B;AA6BnB,KAAK,UAAU,mBAAmB,CACvC,IAAY,EACZ,QAAgB,EAChB,UAA8B,EAAE;IAEhC,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,IAAI,CAAC,IAAI,CAAC,gCAAgC,CAAC,CAAC,CAAC;IAE/D,MAAM,UAAU,GAAG,OAAO,CAAC,MAAM,IAAI,QAAQ,CAAC;IAC9C,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,eAAe,CAAC,CAAC;IAEjF,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC;QAC3B,EAAE,CAAC,SAAS,CAAC,MAAM,EAAE,EAAE,SAAS,EAAE,IAAI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IAAI,CAAC,UAAU,EAAE,eAAe,CAAC,CAAC;IAC9D,EAAE,CAAC,aAAa,CAAC,cAAc,EAAE,kBAAkB,EAAE,CAAC,CAAC;IACvD,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,KAAK,CAAC,eAAe,cAAc,EAAE,CAAC,CAAC,CAAC;IAE1D,iBAAiB;IACjB,MAAM,YAAY,GAAG;;CAEtB,CAAC;IACA,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;IACpD,EAAE,CAAC,aAAa,CAAC,SAAS,EAAE,YAAY,CAAC,CAAC;IAC1C,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,KAAK,CAAC,eAAe,SAAS,EAAE,CAAC,CAAC,CAAC;IAErD,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,IAAI,CAAC,KAAK,CAAC,2CAA2C,CAAC,CAAC,CAAC;AAC7E,CAAC"}
@@ -0,0 +1,6 @@
1
+ export interface GraphQLSubscriptionsOptions {
2
+ module?: string;
3
+ events?: string[];
4
+ useRedis?: boolean;
5
+ }
6
+ export declare function setupGraphQLSubscriptions(basePath: string, options?: GraphQLSubscriptionsOptions): Promise<void>;