@carlonicora/nestjs-neo4jsonapi 1.31.2 → 1.32.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 (238) hide show
  1. package/dist/common/helpers/define-entity.d.ts +29 -0
  2. package/dist/common/helpers/define-entity.d.ts.map +1 -1
  3. package/dist/common/helpers/define-entity.js +42 -1
  4. package/dist/common/helpers/define-entity.js.map +1 -1
  5. package/dist/common/interfaces/entity.descriptor.interface.d.ts +2 -2
  6. package/dist/common/interfaces/entity.descriptor.interface.d.ts.map +1 -1
  7. package/dist/common/interfaces/entity.descriptor.interface.js +2 -1
  8. package/dist/common/interfaces/entity.descriptor.interface.js.map +1 -1
  9. package/dist/common/interfaces/entity.schema.interface.d.ts +19 -1
  10. package/dist/common/interfaces/entity.schema.interface.d.ts.map +1 -1
  11. package/dist/core/email/templates/en/paymentFailure.hbs +56 -0
  12. package/dist/core/email/templates/en/paymentSuccessAdmin.hbs +31 -0
  13. package/dist/core/email/templates/en/paymentSuccessCustomer.hbs +51 -0
  14. package/dist/core/email/templates/en/subscriptionStatusChange.hbs +48 -0
  15. package/dist/core/jsonapi/serialisers/descriptor.based.serialiser.d.ts.map +1 -1
  16. package/dist/core/jsonapi/serialisers/descriptor.based.serialiser.js +13 -0
  17. package/dist/core/jsonapi/serialisers/descriptor.based.serialiser.js.map +1 -1
  18. package/dist/core/jsonapi/serialisers/jsonapi.paginator.d.ts +3 -0
  19. package/dist/core/jsonapi/serialisers/jsonapi.paginator.d.ts.map +1 -1
  20. package/dist/core/jsonapi/serialisers/jsonapi.paginator.js +6 -0
  21. package/dist/core/jsonapi/serialisers/jsonapi.paginator.js.map +1 -1
  22. package/dist/core/jsonapi/services/jsonapi.service.d.ts.map +1 -1
  23. package/dist/core/jsonapi/services/jsonapi.service.js +6 -0
  24. package/dist/core/jsonapi/services/jsonapi.service.js.map +1 -1
  25. package/dist/core/neo4j/abstracts/abstract.service.d.ts +2 -0
  26. package/dist/core/neo4j/abstracts/abstract.service.d.ts.map +1 -1
  27. package/dist/core/neo4j/abstracts/abstract.service.js +8 -4
  28. package/dist/core/neo4j/abstracts/abstract.service.js.map +1 -1
  29. package/dist/core/neo4j/services/neo4j.service.d.ts +9 -0
  30. package/dist/core/neo4j/services/neo4j.service.d.ts.map +1 -1
  31. package/dist/core/neo4j/services/neo4j.service.js +95 -1
  32. package/dist/core/neo4j/services/neo4j.service.js.map +1 -1
  33. package/dist/foundations/audit/entities/audit.entity.d.ts +1 -1
  34. package/dist/foundations/audit/entities/audit.entity.d.ts.map +1 -1
  35. package/dist/foundations/audit/serialisers/audit.serialiser.js +2 -2
  36. package/dist/foundations/audit/serialisers/audit.serialiser.js.map +1 -1
  37. package/dist/foundations/auth/entities/auth.entity.d.ts +1 -1
  38. package/dist/foundations/auth/entities/auth.entity.d.ts.map +1 -1
  39. package/dist/foundations/auth/repositories/auth.repository.d.ts +1 -1
  40. package/dist/foundations/auth/repositories/auth.repository.d.ts.map +1 -1
  41. package/dist/foundations/auth/repositories/auth.repository.js +31 -13
  42. package/dist/foundations/auth/repositories/auth.repository.js.map +1 -1
  43. package/dist/foundations/auth/serialisers/auth.serialiser.js +2 -2
  44. package/dist/foundations/auth/serialisers/auth.serialiser.js.map +1 -1
  45. package/dist/foundations/auth/services/auth.service.d.ts +1 -1
  46. package/dist/foundations/auth/services/auth.service.d.ts.map +1 -1
  47. package/dist/foundations/company/company.module.d.ts.map +1 -1
  48. package/dist/foundations/company/company.module.js +9 -5
  49. package/dist/foundations/company/company.module.js.map +1 -1
  50. package/dist/foundations/company/entities/company.d.ts +44 -0
  51. package/dist/foundations/company/entities/company.d.ts.map +1 -0
  52. package/dist/foundations/company/entities/company.js +47 -0
  53. package/dist/foundations/company/entities/company.js.map +1 -0
  54. package/dist/foundations/company/entities/company.meta.d.ts +1 -1
  55. package/dist/foundations/company/entities/company.meta.d.ts.map +1 -1
  56. package/dist/foundations/company/index.d.ts +1 -2
  57. package/dist/foundations/company/index.d.ts.map +1 -1
  58. package/dist/foundations/company/index.js +3 -3
  59. package/dist/foundations/company/index.js.map +1 -1
  60. package/dist/foundations/company/repositories/company.repository.d.ts +26 -1
  61. package/dist/foundations/company/repositories/company.repository.d.ts.map +1 -1
  62. package/dist/foundations/company/repositories/company.repository.js +67 -11
  63. package/dist/foundations/company/repositories/company.repository.js.map +1 -1
  64. package/dist/foundations/company/services/company.service.d.ts +4 -1
  65. package/dist/foundations/company/services/company.service.d.ts.map +1 -1
  66. package/dist/foundations/company/services/company.service.js +11 -6
  67. package/dist/foundations/company/services/company.service.js.map +1 -1
  68. package/dist/foundations/content/entities/content.entity.d.ts +1 -1
  69. package/dist/foundations/content/entities/content.entity.d.ts.map +1 -1
  70. package/dist/foundations/content/serialisers/content.serialiser.js +3 -3
  71. package/dist/foundations/content/serialisers/content.serialiser.js.map +1 -1
  72. package/dist/foundations/module/queries/feature.module.query.d.ts +3 -1
  73. package/dist/foundations/module/queries/feature.module.query.d.ts.map +1 -1
  74. package/dist/foundations/module/queries/feature.module.query.js +27 -15
  75. package/dist/foundations/module/queries/feature.module.query.js.map +1 -1
  76. package/dist/foundations/notification/entities/notification.entity.d.ts +1 -1
  77. package/dist/foundations/notification/entities/notification.entity.d.ts.map +1 -1
  78. package/dist/foundations/notification/serialisers/notifications.serialiser.js +2 -2
  79. package/dist/foundations/notification/serialisers/notifications.serialiser.js.map +1 -1
  80. package/dist/foundations/oauth/entities/oauth.client.entity.d.ts +2 -2
  81. package/dist/foundations/oauth/entities/oauth.client.entity.d.ts.map +1 -1
  82. package/dist/foundations/relevancy/repositories/relevancy.repository.d.ts.map +1 -1
  83. package/dist/foundations/relevancy/repositories/relevancy.repository.js +1 -1
  84. package/dist/foundations/relevancy/repositories/relevancy.repository.js.map +1 -1
  85. package/dist/foundations/relevancy/services/relevancy.service.js +1 -1
  86. package/dist/foundations/relevancy/services/relevancy.service.js.map +1 -1
  87. package/dist/foundations/role/entities/role.d.ts +28 -0
  88. package/dist/foundations/role/entities/role.d.ts.map +1 -0
  89. package/dist/foundations/role/entities/role.js +33 -0
  90. package/dist/foundations/role/entities/role.js.map +1 -0
  91. package/dist/foundations/role/entities/role.meta.d.ts +1 -1
  92. package/dist/foundations/role/entities/role.meta.d.ts.map +1 -1
  93. package/dist/foundations/role/repositories/role.repository.d.ts +1 -1
  94. package/dist/foundations/role/repositories/role.repository.d.ts.map +1 -1
  95. package/dist/foundations/role/repositories/role.repository.js +7 -7
  96. package/dist/foundations/role/repositories/role.repository.js.map +1 -1
  97. package/dist/foundations/role/role.module.d.ts.map +1 -1
  98. package/dist/foundations/role/role.module.js +3 -4
  99. package/dist/foundations/role/role.module.js.map +1 -1
  100. package/dist/foundations/role/services/role.service.js +5 -5
  101. package/dist/foundations/role/services/role.service.js.map +1 -1
  102. package/dist/foundations/stripe-customer/entities/stripe-customer.entity.d.ts +1 -1
  103. package/dist/foundations/stripe-customer/entities/stripe-customer.entity.d.ts.map +1 -1
  104. package/dist/foundations/stripe-price/dtos/stripe-price.dto.d.ts +12 -0
  105. package/dist/foundations/stripe-price/dtos/stripe-price.dto.d.ts.map +1 -1
  106. package/dist/foundations/stripe-price/dtos/stripe-price.dto.js +47 -1
  107. package/dist/foundations/stripe-price/dtos/stripe-price.dto.js.map +1 -1
  108. package/dist/foundations/stripe-price/entities/stripe-price.entity.d.ts +2 -0
  109. package/dist/foundations/stripe-price/entities/stripe-price.entity.d.ts.map +1 -1
  110. package/dist/foundations/stripe-price/entities/stripe-price.map.d.ts.map +1 -1
  111. package/dist/foundations/stripe-price/entities/stripe-price.map.js +1 -0
  112. package/dist/foundations/stripe-price/entities/stripe-price.map.js.map +1 -1
  113. package/dist/foundations/stripe-price/entities/stripe-price.model.d.ts.map +1 -1
  114. package/dist/foundations/stripe-price/entities/stripe-price.model.js +2 -1
  115. package/dist/foundations/stripe-price/entities/stripe-price.model.js.map +1 -1
  116. package/dist/foundations/stripe-price/repositories/stripe-price.repository.d.ts +3 -0
  117. package/dist/foundations/stripe-price/repositories/stripe-price.repository.d.ts.map +1 -1
  118. package/dist/foundations/stripe-price/repositories/stripe-price.repository.js +64 -4
  119. package/dist/foundations/stripe-price/repositories/stripe-price.repository.js.map +1 -1
  120. package/dist/foundations/stripe-price/serialisers/stripe-price.serialiser.d.ts.map +1 -1
  121. package/dist/foundations/stripe-price/serialisers/stripe-price.serialiser.js +5 -0
  122. package/dist/foundations/stripe-price/serialisers/stripe-price.serialiser.js.map +1 -1
  123. package/dist/foundations/stripe-price/services/stripe-price-admin.service.d.ts.map +1 -1
  124. package/dist/foundations/stripe-price/services/stripe-price-admin.service.js +10 -0
  125. package/dist/foundations/stripe-price/services/stripe-price-admin.service.js.map +1 -1
  126. package/dist/foundations/stripe-subscription/repositories/stripe-subscription.repository.d.ts +11 -0
  127. package/dist/foundations/stripe-subscription/repositories/stripe-subscription.repository.d.ts.map +1 -1
  128. package/dist/foundations/stripe-subscription/repositories/stripe-subscription.repository.js +22 -0
  129. package/dist/foundations/stripe-subscription/repositories/stripe-subscription.repository.js.map +1 -1
  130. package/dist/foundations/stripe-subscription/services/feature-sync.service.d.ts +33 -0
  131. package/dist/foundations/stripe-subscription/services/feature-sync.service.d.ts.map +1 -0
  132. package/dist/foundations/stripe-subscription/services/feature-sync.service.js +155 -0
  133. package/dist/foundations/stripe-subscription/services/feature-sync.service.js.map +1 -0
  134. package/dist/foundations/stripe-subscription/services/stripe-subscription-admin.service.d.ts.map +1 -1
  135. package/dist/foundations/stripe-subscription/services/stripe-subscription-admin.service.js +11 -0
  136. package/dist/foundations/stripe-subscription/services/stripe-subscription-admin.service.js.map +1 -1
  137. package/dist/foundations/stripe-subscription/stripe-subscription.module.d.ts.map +1 -1
  138. package/dist/foundations/stripe-subscription/stripe-subscription.module.js +3 -0
  139. package/dist/foundations/stripe-subscription/stripe-subscription.module.js.map +1 -1
  140. package/dist/foundations/stripe-webhook/processors/stripe-webhook.processor.d.ts +3 -1
  141. package/dist/foundations/stripe-webhook/processors/stripe-webhook.processor.d.ts.map +1 -1
  142. package/dist/foundations/stripe-webhook/processors/stripe-webhook.processor.js +79 -9
  143. package/dist/foundations/stripe-webhook/processors/stripe-webhook.processor.js.map +1 -1
  144. package/dist/foundations/stripe-webhook/services/stripe-webhook-notification.service.d.ts +26 -1
  145. package/dist/foundations/stripe-webhook/services/stripe-webhook-notification.service.d.ts.map +1 -1
  146. package/dist/foundations/stripe-webhook/services/stripe-webhook-notification.service.js +124 -2
  147. package/dist/foundations/stripe-webhook/services/stripe-webhook-notification.service.js.map +1 -1
  148. package/dist/foundations/stripe-webhook/stripe-webhook.module.d.ts.map +1 -1
  149. package/dist/foundations/stripe-webhook/stripe-webhook.module.js +2 -0
  150. package/dist/foundations/stripe-webhook/stripe-webhook.module.js.map +1 -1
  151. package/dist/foundations/tokenusage/entities/tokenusage.entity.d.ts +1 -1
  152. package/dist/foundations/tokenusage/entities/tokenusage.entity.d.ts.map +1 -1
  153. package/dist/foundations/user/controllers/user.controller.d.ts +1 -1
  154. package/dist/foundations/user/controllers/user.controller.d.ts.map +1 -1
  155. package/dist/foundations/user/entities/user.d.ts +124 -0
  156. package/dist/foundations/user/entities/user.d.ts.map +1 -0
  157. package/dist/foundations/user/entities/user.js +81 -0
  158. package/dist/foundations/user/entities/user.js.map +1 -0
  159. package/dist/foundations/user/entities/user.meta.d.ts +1 -1
  160. package/dist/foundations/user/entities/user.meta.d.ts.map +1 -1
  161. package/dist/foundations/user/index.d.ts +1 -4
  162. package/dist/foundations/user/index.d.ts.map +1 -1
  163. package/dist/foundations/user/index.js +6 -23
  164. package/dist/foundations/user/index.js.map +1 -1
  165. package/dist/foundations/user/repositories/user.repository.d.ts +13 -1
  166. package/dist/foundations/user/repositories/user.repository.d.ts.map +1 -1
  167. package/dist/foundations/user/repositories/user.repository.js +85 -21
  168. package/dist/foundations/user/repositories/user.repository.js.map +1 -1
  169. package/dist/foundations/user/services/user.service.d.ts.map +1 -1
  170. package/dist/foundations/user/services/user.service.js +12 -12
  171. package/dist/foundations/user/services/user.service.js.map +1 -1
  172. package/dist/foundations/user/user.module.d.ts.map +1 -1
  173. package/dist/foundations/user/user.module.js +7 -8
  174. package/dist/foundations/user/user.module.js.map +1 -1
  175. package/dist/openapi/factories/entity-schema.factory.js +12 -0
  176. package/dist/openapi/factories/entity-schema.factory.js.map +1 -1
  177. package/dist/openapi/schemas/jsonapi-base.schemas.d.ts +1 -0
  178. package/dist/openapi/schemas/jsonapi-base.schemas.d.ts.map +1 -1
  179. package/dist/openapi/schemas/jsonapi-base.schemas.js.map +1 -1
  180. package/dist/tools/migrate-entity/__tests__/ast-parser.spec.js +331 -0
  181. package/dist/tools/migrate-entity/__tests__/descriptor-generator.spec.js +482 -0
  182. package/dist/tools/migrate-entity/__tests__/file-discovery.spec.js +190 -0
  183. package/dist/tools/migrate-entity/__tests__/integration.spec.js +261 -0
  184. package/dist/tools/migrate-entity/index.js +2 -2
  185. package/dist/tools/migrate-entity/lib/ast-parser.js +255 -10
  186. package/dist/tools/migrate-entity/lib/descriptor-generator.js +384 -55
  187. package/dist/tools/migrate-entity/lib/entity-migrator.js +112 -9
  188. package/dist/tools/migrate-entity/lib/module-updater.js +25 -9
  189. package/dist/tools/migrate-entity/lib/reference-updater.js +110 -24
  190. package/package.json +2 -2
  191. package/dist/foundations/company/entities/company.entity.d.ts +0 -18
  192. package/dist/foundations/company/entities/company.entity.d.ts.map +0 -1
  193. package/dist/foundations/company/entities/company.entity.js +0 -3
  194. package/dist/foundations/company/entities/company.entity.js.map +0 -1
  195. package/dist/foundations/company/entities/company.map.d.ts +0 -8
  196. package/dist/foundations/company/entities/company.map.d.ts.map +0 -1
  197. package/dist/foundations/company/entities/company.map.js +0 -23
  198. package/dist/foundations/company/entities/company.map.js.map +0 -1
  199. package/dist/foundations/company/entities/company.model.d.ts +0 -4
  200. package/dist/foundations/company/entities/company.model.d.ts.map +0 -1
  201. package/dist/foundations/company/entities/company.model.js +0 -17
  202. package/dist/foundations/company/entities/company.model.js.map +0 -1
  203. package/dist/foundations/company/serialisers/company.serialiser.d.ts +0 -14
  204. package/dist/foundations/company/serialisers/company.serialiser.d.ts.map +0 -1
  205. package/dist/foundations/company/serialisers/company.serialiser.js +0 -76
  206. package/dist/foundations/company/serialisers/company.serialiser.js.map +0 -1
  207. package/dist/foundations/role/entities/role.entity.d.ts +0 -9
  208. package/dist/foundations/role/entities/role.entity.d.ts.map +0 -1
  209. package/dist/foundations/role/entities/role.entity.js +0 -3
  210. package/dist/foundations/role/entities/role.entity.js.map +0 -1
  211. package/dist/foundations/role/entities/role.map.d.ts +0 -8
  212. package/dist/foundations/role/entities/role.map.d.ts.map +0 -1
  213. package/dist/foundations/role/entities/role.map.js +0 -15
  214. package/dist/foundations/role/entities/role.map.js.map +0 -1
  215. package/dist/foundations/role/entities/role.model.d.ts +0 -4
  216. package/dist/foundations/role/entities/role.model.d.ts.map +0 -1
  217. package/dist/foundations/role/entities/role.model.js +0 -15
  218. package/dist/foundations/role/entities/role.model.js.map +0 -1
  219. package/dist/foundations/role/serialisers/role.serialiser.d.ts +0 -12
  220. package/dist/foundations/role/serialisers/role.serialiser.d.ts.map +0 -1
  221. package/dist/foundations/role/serialisers/role.serialiser.js +0 -46
  222. package/dist/foundations/role/serialisers/role.serialiser.js.map +0 -1
  223. package/dist/foundations/user/entities/user.entity.d.ts +0 -26
  224. package/dist/foundations/user/entities/user.entity.d.ts.map +0 -1
  225. package/dist/foundations/user/entities/user.entity.js +0 -3
  226. package/dist/foundations/user/entities/user.entity.js.map +0 -1
  227. package/dist/foundations/user/entities/user.map.d.ts +0 -8
  228. package/dist/foundations/user/entities/user.map.d.ts.map +0 -1
  229. package/dist/foundations/user/entities/user.map.js +0 -27
  230. package/dist/foundations/user/entities/user.map.js.map +0 -1
  231. package/dist/foundations/user/entities/user.model.d.ts +0 -7
  232. package/dist/foundations/user/entities/user.model.d.ts.map +0 -1
  233. package/dist/foundations/user/entities/user.model.js +0 -30
  234. package/dist/foundations/user/entities/user.model.js.map +0 -1
  235. package/dist/foundations/user/serialisers/user.serialiser.d.ts +0 -14
  236. package/dist/foundations/user/serialisers/user.serialiser.d.ts.map +0 -1
  237. package/dist/foundations/user/serialisers/user.serialiser.js +0 -80
  238. package/dist/foundations/user/serialisers/user.serialiser.js.map +0 -1
@@ -154,14 +154,25 @@ class EntityMigrator {
154
154
  });
155
155
  }
156
156
  }
157
- // 6. Write meta file first
157
+ // 6. Write meta file first (preserve additional exports if they exist)
158
+ let finalMetaContent = metaContent;
159
+ if (fs.existsSync(metaTargetPath)) {
160
+ const existingMeta = fs.readFileSync(metaTargetPath, "utf-8");
161
+ // Check if existing file has additional exports beyond the primary meta
162
+ const primaryMetaName = `${parsed.meta.nodeName}Meta`;
163
+ const additionalExports = this.extractAdditionalMetaExports(existingMeta, primaryMetaName);
164
+ if (additionalExports) {
165
+ // Append additional exports to the new meta content
166
+ finalMetaContent = metaContent.trimEnd() + "\n" + additionalExports;
167
+ }
168
+ }
158
169
  changes.push({
159
170
  type: fs.existsSync(metaTargetPath) ? "update" : "create",
160
171
  path: metaTargetPath,
161
- content: metaContent,
172
+ content: finalMetaContent,
162
173
  });
163
174
  if (!this.options.dryRun) {
164
- fs.writeFileSync(metaTargetPath, metaContent);
175
+ fs.writeFileSync(metaTargetPath, finalMetaContent);
165
176
  this.log(` Created: ${path.relative(process.cwd(), metaTargetPath)}`);
166
177
  }
167
178
  else {
@@ -180,9 +191,10 @@ class EntityMigrator {
180
191
  else {
181
192
  this.log(` Would create: ${path.relative(process.cwd(), targetPath)}`);
182
193
  }
183
- // 8. Find and update external references
194
+ // 8. Find and update external references (exclude the entity files we just created)
184
195
  this.log(` Finding external references...`);
185
- const references = await (0, reference_updater_1.findExternalReferences)(oldFiles.entityName, parsed.meta.labelName, "src");
196
+ const references = await (0, reference_updater_1.findExternalReferences)(oldFiles.entityName, parsed.meta.labelName, "src", [targetPath, metaTargetPath], // Exclude the entity files being migrated
197
+ parsed.aliasModels);
186
198
  if (this.options.verbose) {
187
199
  this.log((0, reference_updater_1.summarizeReferences)(references));
188
200
  }
@@ -204,7 +216,7 @@ class EntityMigrator {
204
216
  // 9. Update module file
205
217
  const moduleFile = await (0, module_updater_1.findModuleFile)(modulePath);
206
218
  if (moduleFile) {
207
- const moduleUpdate = (0, module_updater_1.updateModule)(moduleFile, oldFiles.entityName, parsed.meta.labelName);
219
+ const moduleUpdate = (0, module_updater_1.updateModule)(moduleFile, oldFiles.entityName, parsed.meta.labelName, parsed.aliasModels);
208
220
  if (moduleUpdate) {
209
221
  const formattedContent = (0, module_updater_1.formatModuleContent)(moduleUpdate.updatedContent);
210
222
  changes.push({
@@ -224,7 +236,27 @@ class EntityMigrator {
224
236
  }
225
237
  }
226
238
  }
227
- // 10. Delete old files (model, map, serialiser - not meta since we're using the same path)
239
+ // 10. Update module's index.ts to export new descriptor instead of old model
240
+ const indexPath = path.join(modulePath, "index.ts");
241
+ if (fs.existsSync(indexPath)) {
242
+ const indexContent = fs.readFileSync(indexPath, "utf-8");
243
+ const updatedIndexContent = this.updateIndexExports(indexContent, oldFiles.entityName, parsed.meta.labelName, parsed.aliasModels);
244
+ if (updatedIndexContent !== indexContent) {
245
+ changes.push({
246
+ type: "update",
247
+ path: indexPath,
248
+ content: updatedIndexContent,
249
+ });
250
+ if (!this.options.dryRun) {
251
+ fs.writeFileSync(indexPath, updatedIndexContent);
252
+ this.log(` Updated index: ${path.relative(process.cwd(), indexPath)}`);
253
+ }
254
+ else {
255
+ this.log(` Would update index: ${path.relative(process.cwd(), indexPath)}`);
256
+ }
257
+ }
258
+ }
259
+ // 12. Delete old files (model, map, serialiser - not meta since we're using the same path)
228
260
  const filesToDelete = [oldFiles.model, oldFiles.map, oldFiles.serialiser].filter((f) => f !== null);
229
261
  // Don't delete the old meta file if it's the same as our target meta file
230
262
  if (oldFiles.meta && oldFiles.meta !== metaTargetPath) {
@@ -250,9 +282,9 @@ class EntityMigrator {
250
282
  this.log(` Would delete: ${path.relative(process.cwd(), fileToDelete)}`);
251
283
  }
252
284
  }
253
- // 11. Clean up empty directories
285
+ // 13. Clean up empty directories
254
286
  await this.cleanupEmptyDirectories(modulePath);
255
- // 12. Detect and warn about custom cypher.service.ts logic
287
+ // 14. Detect and warn about custom cypher.service.ts logic
256
288
  const cypherWarnings = (0, ast_parser_1.detectCypherServiceWarnings)(modulePath);
257
289
  if (cypherWarnings.length > 0) {
258
290
  this.log(`\n ⚠️ PHASE 2 WARNING: Custom cypher.service.ts logic detected:`);
@@ -283,6 +315,77 @@ class EntityMigrator {
283
315
  const baseName = oldFiles.entityName;
284
316
  return path.join(oldFiles.entityDir, `${baseName}.meta.ts`);
285
317
  }
318
+ /**
319
+ * Updates the module's index.ts to export the new descriptor instead of old model.
320
+ * - Changes ./entities/entity.entity -> ./entities/entity
321
+ * - Replaces EntityModel export with EntityDescriptor (and alias descriptors)
322
+ * - Keeps Entity type export
323
+ * - Reorders exports so entity/descriptor comes BEFORE module (avoids circular dependency)
324
+ */
325
+ updateIndexExports(content, entityName, labelName, aliasModels = []) {
326
+ const modelName = `${labelName}Model`;
327
+ const descriptorName = `${labelName}Descriptor`;
328
+ const moduleName = `${labelName}Module`;
329
+ // Build the list of all descriptors to export (base + aliases)
330
+ const allDescriptors = [descriptorName, ...aliasModels.map(a => a.descriptorName)];
331
+ const descriptorsExport = allDescriptors.join(", ");
332
+ let updated = content;
333
+ // Pattern 1: export { Entity } from "./entities/entity.entity"
334
+ // -> export { Entity, EntityDescriptor, AliasDescriptors... } from "./entities/entity"
335
+ const entityExportPattern = new RegExp(`export\\s*\\{\\s*(${labelName})\\s*\\}\\s*from\\s*["']\\./entities/${entityName}\\.entity["']`, "g");
336
+ updated = updated.replace(entityExportPattern, `export { ${labelName}, ${descriptorsExport} } from "./entities/${entityName}"`);
337
+ // Pattern 2: export { EntityModel } from "./entities/entity.model"
338
+ // -> remove this line (descriptor is exported from entity file now)
339
+ // Also handles lines with multiple models like: export { AssigneeModel, AuthorModel, UserModel } from ...
340
+ const modelExportPattern = new RegExp(`export\\s*\\{[^}]*${modelName}[^}]*\\}\\s*from\\s*["']\\./entities/${entityName}\\.model["'];?\\n?`, "g");
341
+ updated = updated.replace(modelExportPattern, "");
342
+ // Pattern 2b: export * from "./entities/entity.map" -> remove (file deleted)
343
+ const mapStarExportPattern = new RegExp(`export\\s*\\*\\s*from\\s*["']\\./entities/${entityName}\\.map["'];?\\n?`, "g");
344
+ updated = updated.replace(mapStarExportPattern, "");
345
+ // Pattern 2c: export { EntitySerialiser } from "./serialisers/entity.serialiser" -> remove (file deleted)
346
+ const serialiserExportPattern = new RegExp(`export\\s*\\{[^}]*\\}\\s*from\\s*["']\\./serialisers/${entityName}\\.serialiser["'];?\\n?`, "g");
347
+ updated = updated.replace(serialiserExportPattern, "");
348
+ // Pattern 3: If Entity is exported separately and we haven't handled it yet
349
+ // Handle case where entity and model are on separate lines
350
+ const simpleEntityExport = new RegExp(`(export\\s*\\{\\s*${labelName}\\s*\\}\\s*from\\s*["']\\./entities/${entityName}["'])`, "g");
351
+ if (simpleEntityExport.test(updated) && !updated.includes(descriptorName)) {
352
+ updated = updated.replace(simpleEntityExport, `export { ${labelName}, ${descriptorsExport} } from "./entities/${entityName}"`);
353
+ }
354
+ // Reorder exports: entity/descriptor must come BEFORE module to avoid circular dependency
355
+ // Find the module export line and entity export line
356
+ const lines = updated.split("\n");
357
+ const moduleExportIndex = lines.findIndex(line => line.includes(moduleName) && line.includes("./") && line.includes("module"));
358
+ const entityExportIndex = lines.findIndex(line => line.includes(descriptorName) || (line.includes(labelName) && line.includes("./entities/")));
359
+ // If module export comes before entity export, swap them
360
+ if (moduleExportIndex !== -1 && entityExportIndex !== -1 && moduleExportIndex < entityExportIndex) {
361
+ const moduleExportLine = lines[moduleExportIndex];
362
+ const entityExportLine = lines[entityExportIndex];
363
+ lines[moduleExportIndex] = entityExportLine;
364
+ lines[entityExportIndex] = moduleExportLine;
365
+ updated = lines.join("\n");
366
+ }
367
+ return updated;
368
+ }
369
+ /**
370
+ * Extracts additional meta exports from an existing meta file.
371
+ * Returns the additional exports (everything after the primary meta) or null if none exist.
372
+ */
373
+ extractAdditionalMetaExports(existingContent, primaryMetaName) {
374
+ // Find where the primary meta export ends
375
+ const primaryMetaPattern = new RegExp(`export\\s+const\\s+${primaryMetaName}\\s*:\\s*DataMeta\\s*=\\s*\\{[^}]+\\};`, "s");
376
+ const match = existingContent.match(primaryMetaPattern);
377
+ if (!match)
378
+ return null;
379
+ // Get everything after the primary meta
380
+ const afterPrimary = existingContent.slice(match.index + match[0].length).trim();
381
+ if (!afterPrimary)
382
+ return null;
383
+ // Check if there are additional exports
384
+ if (afterPrimary.includes("export const")) {
385
+ return "\n" + afterPrimary;
386
+ }
387
+ return null;
388
+ }
286
389
  /**
287
390
  * Cleans up empty directories after file deletion.
288
391
  */
@@ -56,23 +56,23 @@ async function findModuleFile(modulePath) {
56
56
  /**
57
57
  * Updates the module file to use the new descriptor pattern.
58
58
  */
59
- function updateModule(modulePath, entityName, labelName) {
59
+ function updateModule(modulePath, entityName, labelName, aliasModels = []) {
60
60
  const content = fs.readFileSync(modulePath, "utf-8");
61
61
  const changes = [];
62
62
  const descriptorName = `${labelName}Descriptor`;
63
63
  const modelName = `${labelName}Model`;
64
64
  const serialiserName = `${labelName}Serialiser`;
65
+ // Build list of all descriptors (base + aliases)
66
+ const allDescriptors = [descriptorName, ...aliasModels.map(a => a.descriptorName)];
65
67
  let updatedContent = content;
66
- // 1. Update import: EntityModel -> EntityDescriptor
67
- const modelImportPattern = new RegExp(`import\\s*\\{\\s*${modelName}\\s*\\}\\s*from\\s*["'][^"']+\\.model["'];?`, "g");
68
+ // 1. Update import: EntityModel, AliasModel... -> EntityDescriptor, AliasDescriptor...
69
+ // Handle imports that may include multiple models on one line
70
+ const modelImportPattern = new RegExp(`import\\s*\\{[^}]*${modelName}[^}]*\\}\\s*from\\s*["'][^"']+\\.model["'];?`, "g");
68
71
  if (modelImportPattern.test(updatedContent)) {
69
- // Replace the import path
70
- const oldImport = updatedContent.match(modelImportPattern)?.[0] || "";
71
- const newImportPath = oldImport
72
- .replace(`{ ${modelName} }`, `{ ${descriptorName} }`)
73
- .replace(".model", "");
72
+ // Replace the entire import with the new descriptors
73
+ const newImportPath = `import { ${allDescriptors.join(", ")} } from "./entities/${entityName}";`;
74
74
  updatedContent = updatedContent.replace(modelImportPattern, newImportPath);
75
- changes.push(`Updated import: ${modelName} -> ${descriptorName}`);
75
+ changes.push(`Updated import: models -> ${allDescriptors.join(", ")}`);
76
76
  }
77
77
  // 2. Remove serialiser import (it's now auto-generated)
78
78
  const serialiserImportPattern = new RegExp(`import\\s*\\{\\s*${serialiserName}\\s*\\}\\s*from\\s*["'][^"']+["'];?\\n?`, "g");
@@ -92,12 +92,28 @@ function updateModule(modulePath, entityName, labelName) {
92
92
  updatedContent = updatedContent.replace(registryPattern, `modelRegistry.register(${descriptorName}.model)`);
93
93
  changes.push(`Updated registry: modelRegistry.register(${modelName}) -> modelRegistry.register(${descriptorName}.model)`);
94
94
  }
95
+ // 4b. Update alias model registry registrations
96
+ for (const alias of aliasModels) {
97
+ const aliasRegistryPattern = new RegExp(`modelRegistry\\.register\\(${alias.modelName}\\)`, "g");
98
+ if (aliasRegistryPattern.test(updatedContent)) {
99
+ updatedContent = updatedContent.replace(aliasRegistryPattern, `modelRegistry.register(${alias.descriptorName}.model)`);
100
+ changes.push(`Updated registry: modelRegistry.register(${alias.modelName}) -> modelRegistry.register(${alias.descriptorName}.model)`);
101
+ }
102
+ }
95
103
  // 5. Update any other standalone EntityModel usages
96
104
  const standaloneModelPattern = new RegExp(`\\b${modelName}\\b(?!\\.)`, "g");
97
105
  if (standaloneModelPattern.test(updatedContent)) {
98
106
  updatedContent = updatedContent.replace(standaloneModelPattern, `${descriptorName}.model`);
99
107
  changes.push(`Updated standalone ${modelName} usages`);
100
108
  }
109
+ // 5b. Update any other standalone alias model usages
110
+ for (const alias of aliasModels) {
111
+ const standaloneAliasPattern = new RegExp(`\\b${alias.modelName}\\b(?!\\.)`, "g");
112
+ if (standaloneAliasPattern.test(updatedContent)) {
113
+ updatedContent = updatedContent.replace(standaloneAliasPattern, `${alias.descriptorName}.model`);
114
+ changes.push(`Updated standalone ${alias.modelName} usages`);
115
+ }
116
+ }
101
117
  if (changes.length === 0) {
102
118
  return null;
103
119
  }
@@ -42,38 +42,51 @@ exports.findExternalReferences = findExternalReferences;
42
42
  exports.updateFileReferences = updateFileReferences;
43
43
  exports.summarizeReferences = summarizeReferences;
44
44
  const fs = __importStar(require("fs"));
45
- const path = __importStar(require("path"));
46
45
  const glob_1 = require("glob");
46
+ const path = __importStar(require("path"));
47
47
  /**
48
48
  * Finds all external files that reference the old entity exports.
49
49
  */
50
- async function findExternalReferences(entityName, labelName, srcDir = "src") {
50
+ async function findExternalReferences(entityName, labelName, srcDir = "src", excludePaths = [], aliasModels = []) {
51
51
  const references = [];
52
52
  // Patterns to search for
53
53
  const metaName = `${entityName}Meta`;
54
54
  const modelName = `${labelName}Model`;
55
55
  const entityTypeName = labelName; // e.g., "Article"
56
- // Find all TypeScript files
57
- const tsFiles = await (0, glob_1.glob)(`${srcDir}/**/*.ts`, { nodir: true, cwd: process.cwd() });
56
+ // Build list of all model names (base + aliases) for pattern matching
57
+ const allModelNames = [modelName, ...aliasModels.map((a) => a.modelName)];
58
+ // Normalize exclude paths for comparison
59
+ const normalizedExcludePaths = new Set(excludePaths.map((p) => path.normalize(path.resolve(process.cwd(), p))));
60
+ // Find all TypeScript files (including test files - they may import entities)
61
+ const tsFiles = await (0, glob_1.glob)(`${srcDir}/**/*.ts`, {
62
+ nodir: true,
63
+ cwd: process.cwd(),
64
+ });
58
65
  for (const filePath of tsFiles) {
59
- const absolutePath = path.resolve(process.cwd(), filePath);
66
+ const absolutePath = path.normalize(path.resolve(process.cwd(), filePath));
67
+ // Skip excluded paths (the entity files being migrated)
68
+ if (normalizedExcludePaths.has(absolutePath)) {
69
+ continue;
70
+ }
60
71
  const content = fs.readFileSync(absolutePath, "utf-8");
61
- // Check if file imports or uses the old exports
62
- const hasOldPatterns = content.includes(metaName) ||
63
- content.includes(modelName) ||
72
+ // Check if file imports or uses the old exports (model/entity files that will be deleted)
73
+ // Note: We DON'T include ${entityName}.meta because meta files are preserved
74
+ const hasOldPatterns = allModelNames.some((name) => content.includes(name)) ||
64
75
  content.includes(`${entityName}.entity`) ||
65
- content.includes(`${entityName}.meta`) ||
66
76
  content.includes(`${entityName}.model`);
67
77
  if (!hasOldPatterns) {
68
78
  continue;
69
79
  }
70
- const usages = findUsagesInFile(content, metaName, modelName, labelName);
71
- // Find all old imports that need updating
72
- const oldImports = extractAllOldImports(content, entityName, metaName, modelName, entityTypeName);
80
+ // Check if file imports from the meta file - if so, skip metaName replacements
81
+ // since companyMeta is still available from company.meta.ts
82
+ const importsFromMetaFile = content.includes(`${entityName}.meta"`);
83
+ const usages = findUsagesInFile(content, metaName, modelName, labelName, importsFromMetaFile, aliasModels);
84
+ // Find all old imports that need updating (excluding meta file imports)
85
+ const oldImports = extractAllOldImports(content, entityName, metaName, modelName, entityTypeName, aliasModels);
73
86
  if (usages.length === 0 && oldImports.length === 0)
74
87
  continue;
75
- // Calculate new import
76
- const newImport = calculateNewImport(oldImports, entityName, labelName);
88
+ // Calculate new import (pass content to detect entity type usage in return types etc.)
89
+ const newImport = calculateNewImport(oldImports, entityName, labelName, aliasModels, content);
77
90
  references.push({
78
91
  filePath: absolutePath,
79
92
  oldImport: oldImports.join("\n"), // Store all old imports
@@ -85,8 +98,9 @@ async function findExternalReferences(entityName, labelName, srcDir = "src") {
85
98
  }
86
99
  /**
87
100
  * Finds all usages of old exports within a file (excluding import lines).
101
+ * @param skipMetaReplacements - If true, don't replace metaName usages (file imports from .meta.ts)
88
102
  */
89
- function findUsagesInFile(content, metaName, modelName, labelName) {
103
+ function findUsagesInFile(content, metaName, modelName, labelName, skipMetaReplacements = false, aliasModels = []) {
90
104
  const usages = [];
91
105
  const lines = content.split("\n");
92
106
  const descriptorName = `${labelName}Descriptor`;
@@ -96,8 +110,11 @@ function findUsagesInFile(content, metaName, modelName, labelName) {
96
110
  // Skip import lines (handled separately)
97
111
  if (line.trim().startsWith("import "))
98
112
  continue;
99
- // Check for meta usage patterns
100
- if (line.includes(metaName)) {
113
+ // Skip export lines (these are definitions, not usages)
114
+ if (line.trim().startsWith("export "))
115
+ continue;
116
+ // Check for meta usage patterns (only if not importing from .meta.ts file)
117
+ if (!skipMetaReplacements && line.includes(metaName)) {
101
118
  // Pattern: entityMeta.property -> EntityDescriptor.model.property
102
119
  const metaPattern = new RegExp(`${metaName}\\.(\\w+)`, "g");
103
120
  let match;
@@ -159,24 +176,70 @@ function findUsagesInFile(content, metaName, modelName, labelName) {
159
176
  }
160
177
  }
161
178
  }
179
+ // Check for alias model usage patterns (OwnerModel, AuthorModel, etc.)
180
+ for (const alias of aliasModels) {
181
+ if (line.includes(alias.modelName)) {
182
+ // Pattern: serialiserFactory.create(AliasModel) -> serialiserFactory.create(AliasDescriptor.model)
183
+ if (line.includes(`serialiserFactory.create(${alias.modelName})`)) {
184
+ usages.push({
185
+ line: lineNumber,
186
+ oldText: `serialiserFactory.create(${alias.modelName})`,
187
+ newText: `serialiserFactory.create(${alias.descriptorName}.model)`,
188
+ });
189
+ }
190
+ // Pattern: modelRegistry.register(AliasModel) -> modelRegistry.register(AliasDescriptor.model)
191
+ if (line.includes(`modelRegistry.register(${alias.modelName})`)) {
192
+ usages.push({
193
+ line: lineNumber,
194
+ oldText: `modelRegistry.register(${alias.modelName})`,
195
+ newText: `modelRegistry.register(${alias.descriptorName}.model)`,
196
+ });
197
+ }
198
+ // Pattern: AliasModel.property -> AliasDescriptor.model.property
199
+ const aliasPropertyPattern = new RegExp(`${alias.modelName}\\.(\\w+)`, "g");
200
+ let match;
201
+ while ((match = aliasPropertyPattern.exec(line)) !== null) {
202
+ usages.push({
203
+ line: lineNumber,
204
+ oldText: `${alias.modelName}.${match[1]}`,
205
+ newText: `${alias.descriptorName}.model.${match[1]}`,
206
+ });
207
+ }
208
+ // Pattern: standalone AliasModel usage (not followed by .)
209
+ if (!line.includes(`${alias.modelName}.`)) {
210
+ const standaloneAliasPattern = new RegExp(`\\b${alias.modelName}\\b`, "g");
211
+ if (standaloneAliasPattern.test(line)) {
212
+ usages.push({
213
+ line: lineNumber,
214
+ oldText: alias.modelName,
215
+ newText: `${alias.descriptorName}.model`,
216
+ });
217
+ }
218
+ }
219
+ }
220
+ }
162
221
  }
163
222
  // Deduplicate usages for the same line and text
164
223
  return deduplicateUsages(usages);
165
224
  }
166
225
  /**
167
226
  * Extracts ALL old import statements related to the entity.
227
+ * Note: Excludes imports from .meta.ts files since those are preserved.
168
228
  */
169
- function extractAllOldImports(content, entityName, metaName, modelName, entityTypeName) {
229
+ function extractAllOldImports(content, entityName, metaName, modelName, entityTypeName, aliasModels = []) {
170
230
  const imports = [];
171
231
  const lines = content.split("\n");
232
+ // Build list of all model names (base + aliases) for pattern matching
233
+ const allModelNames = [modelName, ...aliasModels.map((a) => a.modelName)];
172
234
  for (const line of lines) {
173
235
  if (!line.trim().startsWith("import "))
174
236
  continue;
175
- // Check for various import patterns
176
- const isEntityImport = line.includes(metaName) ||
177
- line.includes(modelName) ||
237
+ // Skip imports from .meta.ts files - those are preserved and still valid
238
+ if (line.includes(`${entityName}.meta"`))
239
+ continue;
240
+ // Check for various import patterns (entity/model files that will be deleted)
241
+ const isEntityImport = allModelNames.some((name) => line.includes(name)) ||
178
242
  (line.includes(`${entityName}.entity`) && line.includes(entityTypeName)) ||
179
- line.includes(`${entityName}.meta`) ||
180
243
  line.includes(`${entityName}.model`);
181
244
  if (isEntityImport) {
182
245
  imports.push(line);
@@ -187,18 +250,25 @@ function extractAllOldImports(content, entityName, metaName, modelName, entityTy
187
250
  /**
188
251
  * Calculates the new import statement, consolidating all old imports.
189
252
  */
190
- function calculateNewImport(oldImports, entityName, labelName) {
253
+ function calculateNewImport(oldImports, entityName, labelName, aliasModels = [], fileContent = "") {
191
254
  const descriptorName = `${labelName}Descriptor`;
192
255
  const imports = [];
193
256
  let importPath = null;
194
257
  // Determine what to import
195
258
  let needsDescriptor = false;
196
259
  let needsEntityType = false;
260
+ const neededAliasDescriptors = new Set();
197
261
  for (const oldImport of oldImports) {
198
262
  // Check what's being imported
199
- if (oldImport.includes("Meta") || oldImport.includes("Model")) {
263
+ if (oldImport.includes("Meta") || oldImport.includes(`${labelName}Model`)) {
200
264
  needsDescriptor = true;
201
265
  }
266
+ // Check for alias models
267
+ for (const alias of aliasModels) {
268
+ if (oldImport.includes(alias.modelName)) {
269
+ neededAliasDescriptors.add(alias.descriptorName);
270
+ }
271
+ }
202
272
  // Check if the entity type itself is imported
203
273
  const entityTypePattern = new RegExp(`\\b${labelName}\\b`);
204
274
  if (entityTypePattern.test(oldImport) && !oldImport.includes("Model") && !oldImport.includes("Meta")) {
@@ -213,6 +283,18 @@ function calculateNewImport(oldImports, entityName, labelName) {
213
283
  importPath = extractedPath;
214
284
  }
215
285
  }
286
+ // Also check if the entity type is used in the file content (e.g., in return types like Promise<User[]>)
287
+ // This catches cases where the type is used but wasn't in the old imports
288
+ if (!needsEntityType && fileContent) {
289
+ // Look for entity type usage outside of import lines
290
+ const lines = fileContent.split("\n").filter((line) => !line.trim().startsWith("import "));
291
+ const contentWithoutImports = lines.join("\n");
292
+ // Match the entity type followed by common type patterns: [], >, ), :, |, &, etc.
293
+ const typeUsagePattern = new RegExp(`\\b${labelName}\\s*[\\[\\]>\\):\\|&,]`, "g");
294
+ if (typeUsagePattern.test(contentWithoutImports)) {
295
+ needsEntityType = true;
296
+ }
297
+ }
216
298
  if (!importPath) {
217
299
  // Fallback: construct path from entity name
218
300
  importPath = `src/features/${entityName}/entities/${entityName}`;
@@ -224,6 +306,10 @@ function calculateNewImport(oldImports, entityName, labelName) {
224
306
  if (needsEntityType) {
225
307
  imports.push(labelName);
226
308
  }
309
+ // Add alias descriptors
310
+ for (const aliasDescriptor of neededAliasDescriptors) {
311
+ imports.push(aliasDescriptor);
312
+ }
227
313
  if (imports.length === 0) {
228
314
  imports.push(descriptorName); // Default to descriptor
229
315
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@carlonicora/nestjs-neo4jsonapi",
3
- "version": "1.31.2",
3
+ "version": "1.32.0",
4
4
  "description": "NestJS foundation package with JSON:API, Neo4j, Redis, LangChain agents, and common utilities",
5
5
  "author": "Carlo Nicora",
6
6
  "license": "GPL-3.0-or-later",
@@ -49,7 +49,7 @@
49
49
  }
50
50
  },
51
51
  "scripts": {
52
- "build": "tsc && tsc -p tools/migrate-entity/tsconfig.json && tsc -p scripts/generate-module/tsconfig.json",
52
+ "build": "tsc && tsc -p tools/migrate-entity/tsconfig.json && tsc -p scripts/generate-module/tsconfig.json && cp -R src/core/email/templates dist/core/email/",
53
53
  "dev": "tsc --watch",
54
54
  "clean": "rm -rf dist",
55
55
  "lint": "eslint \"src/**/*.ts\" --fix",
@@ -1,18 +0,0 @@
1
- import { Entity } from "../../../common/abstracts/entity";
2
- import { Feature } from "../../feature/entities/feature.entity";
3
- import { Module } from "../../module/entities/module.entity";
4
- export type Company = Entity & {
5
- name: string;
6
- logo?: string;
7
- logoUrl?: string;
8
- isActiveSubscription: boolean;
9
- ownerEmail: string;
10
- monthlyTokens: number;
11
- availableMonthlyTokens: number;
12
- availableExtraTokens: number;
13
- configurations?: string;
14
- feature: Feature[];
15
- module: Module[];
16
- configuration?: any;
17
- };
18
- //# sourceMappingURL=company.entity.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"company.entity.d.ts","sourceRoot":"","sources":["../../../../src/foundations/company/entities/company.entity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,kCAAkC,CAAC;AAC1D,OAAO,EAAE,OAAO,EAAE,MAAM,uCAAuC,CAAC;AAChE,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAE7D,MAAM,MAAM,OAAO,GAAG,MAAM,GAAG;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,oBAAoB,EAAE,OAAO,CAAC;IAC9B,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;IACtB,sBAAsB,EAAE,MAAM,CAAC;IAC/B,oBAAoB,EAAE,MAAM,CAAC;IAC7B,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB,OAAO,EAAE,OAAO,EAAE,CAAC;IACnB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,aAAa,CAAC,EAAE,GAAG,CAAC;CACrB,CAAC"}
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=company.entity.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"company.entity.js","sourceRoot":"","sources":["../../../../src/foundations/company/entities/company.entity.ts"],"names":[],"mappings":""}
@@ -1,8 +0,0 @@
1
- import { EntityFactory } from "../../../core/neo4j/factories/entity.factory";
2
- import { Company } from "../../company/entities/company.entity";
3
- export declare const mapCompany: (params: {
4
- data: any;
5
- record: any;
6
- entityFactory: EntityFactory;
7
- }) => Company;
8
- //# sourceMappingURL=company.map.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"company.map.d.ts","sourceRoot":"","sources":["../../../../src/foundations/company/entities/company.map.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,8CAA8C,CAAC;AAC7E,OAAO,EAAE,OAAO,EAAE,MAAM,uCAAuC,CAAC;AAEhE,eAAO,MAAM,UAAU,GAAI,QAAQ;IAAE,IAAI,EAAE,GAAG,CAAC;IAAC,MAAM,EAAE,GAAG,CAAC;IAAC,aAAa,EAAE,aAAa,CAAA;CAAE,KAAG,OAiB7F,CAAC"}
@@ -1,23 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.mapCompany = void 0;
4
- const entity_1 = require("../../../common/abstracts/entity");
5
- const mapCompany = (params) => {
6
- return {
7
- ...(0, entity_1.mapEntity)({ record: params.data }),
8
- name: params.data.name,
9
- configurations: params.data.configurations,
10
- logo: params.data.logo,
11
- logoUrl: params.data.logoUrl,
12
- monthlyTokens: params.data.monthlyTokens ?? 0,
13
- availableMonthlyTokens: params.data.availableMonthlyTokens ?? 0,
14
- availableExtraTokens: params.data.availableExtraTokens ?? 0,
15
- ownerEmail: params.data.ownerEmail,
16
- isActiveSubscription: params.data.isActiveSubscription,
17
- feature: [],
18
- module: [],
19
- configuration: undefined,
20
- };
21
- };
22
- exports.mapCompany = mapCompany;
23
- //# sourceMappingURL=company.map.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"company.map.js","sourceRoot":"","sources":["../../../../src/foundations/company/entities/company.map.ts"],"names":[],"mappings":";;;AAAA,6DAA6D;AAItD,MAAM,UAAU,GAAG,CAAC,MAAgE,EAAW,EAAE;IACtG,OAAO;QACL,GAAG,IAAA,kBAAS,EAAC,EAAE,MAAM,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC;QACrC,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,IAAI;QACtB,cAAc,EAAE,MAAM,CAAC,IAAI,CAAC,cAAc;QAC1C,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,IAAI;QACtB,OAAO,EAAE,MAAM,CAAC,IAAI,CAAC,OAAO;QAC5B,aAAa,EAAE,MAAM,CAAC,IAAI,CAAC,aAAa,IAAI,CAAC;QAC7C,sBAAsB,EAAE,MAAM,CAAC,IAAI,CAAC,sBAAsB,IAAI,CAAC;QAC/D,oBAAoB,EAAE,MAAM,CAAC,IAAI,CAAC,oBAAoB,IAAI,CAAC;QAC3D,UAAU,EAAE,MAAM,CAAC,IAAI,CAAC,UAAU;QAClC,oBAAoB,EAAE,MAAM,CAAC,IAAI,CAAC,oBAAoB;QAEtD,OAAO,EAAE,EAAE;QACX,MAAM,EAAE,EAAE;QACV,aAAa,EAAE,SAAS;KACzB,CAAC;AACJ,CAAC,CAAC;AAjBW,QAAA,UAAU,cAiBrB"}
@@ -1,4 +0,0 @@
1
- import { DataModelInterface } from "../../../common/interfaces/datamodel.interface";
2
- import { Company } from "../../company/entities/company.entity";
3
- export declare const CompanyModel: DataModelInterface<Company>;
4
- //# sourceMappingURL=company.model.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"company.model.d.ts","sourceRoot":"","sources":["../../../../src/foundations/company/entities/company.model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,gDAAgD,CAAC;AACpF,OAAO,EAAE,OAAO,EAAE,MAAM,uCAAuC,CAAC;AAOhE,eAAO,MAAM,YAAY,EAAE,kBAAkB,CAAC,OAAO,CAOpD,CAAC"}
@@ -1,17 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CompanyModel = void 0;
4
- const company_map_1 = require("../../company/entities/company.map");
5
- const company_meta_1 = require("../../company/entities/company.meta");
6
- const company_serialiser_1 = require("../../company/serialisers/company.serialiser");
7
- const feature_meta_1 = require("../../feature/entities/feature.meta");
8
- const module_meta_1 = require("../../module/entities/module.meta");
9
- exports.CompanyModel = {
10
- ...company_meta_1.companyMeta,
11
- entity: undefined,
12
- mapper: company_map_1.mapCompany,
13
- serialiser: company_serialiser_1.CompanySerialiser,
14
- singleChildrenTokens: [`configuration`],
15
- childrenTokens: [feature_meta_1.featureMeta.nodeName, module_meta_1.moduleMeta.nodeName],
16
- };
17
- //# sourceMappingURL=company.model.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"company.model.js","sourceRoot":"","sources":["../../../../src/foundations/company/entities/company.model.ts"],"names":[],"mappings":";;;AAEA,oEAAgE;AAChE,sEAAkE;AAClE,qFAAiF;AACjF,sEAAkE;AAClE,mEAA+D;AAElD,QAAA,YAAY,GAAgC;IACvD,GAAG,0BAAW;IACd,MAAM,EAAE,SAA+B;IACvC,MAAM,EAAE,wBAAU;IAClB,UAAU,EAAE,sCAAiB;IAC7B,oBAAoB,EAAE,CAAC,eAAe,CAAC;IACvC,cAAc,EAAE,CAAC,0BAAW,CAAC,QAAQ,EAAE,wBAAU,CAAC,QAAQ,CAAC;CAC5D,CAAC"}
@@ -1,14 +0,0 @@
1
- import { ConfigService } from "@nestjs/config";
2
- import { BaseConfigInterface } from "../../../config/interfaces";
3
- import { AbstractJsonApiSerialiser } from "../../../core/jsonapi/abstracts/abstract.jsonapi.serialiser";
4
- import { JsonApiSerialiserFactory } from "../../../core/jsonapi/factories/jsonapi.serialiser.factory";
5
- import { JsonApiDataInterface } from "../../../core/jsonapi/interfaces/jsonapi.data.interface";
6
- import { JsonApiServiceInterface } from "../../../core/jsonapi/interfaces/jsonapi.service.interface";
7
- import { S3Service } from "../../s3/services/s3.service";
8
- export declare class CompanySerialiser extends AbstractJsonApiSerialiser implements JsonApiServiceInterface {
9
- protected readonly s3Service: S3Service;
10
- constructor(serialiserFactory: JsonApiSerialiserFactory, s3Service: S3Service, configService: ConfigService<BaseConfigInterface>);
11
- get type(): string;
12
- create(): JsonApiDataInterface;
13
- }
14
- //# sourceMappingURL=company.serialiser.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"company.serialiser.d.ts","sourceRoot":"","sources":["../../../../src/foundations/company/serialisers/company.serialiser.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAE,yBAAyB,EAAE,MAAM,6DAA6D,CAAC;AACxG,OAAO,EAAE,wBAAwB,EAAE,MAAM,4DAA4D,CAAC;AACtG,OAAO,EAAE,oBAAoB,EAAE,MAAM,yDAAyD,CAAC;AAC/F,OAAO,EAAE,uBAAuB,EAAE,MAAM,4DAA4D,CAAC;AAKrG,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAEzD,qBACa,iBAAkB,SAAQ,yBAA0B,YAAW,uBAAuB;IAG/F,SAAS,CAAC,QAAQ,CAAC,SAAS,EAAE,SAAS;gBADvC,iBAAiB,EAAE,wBAAwB,EACxB,SAAS,EAAE,SAAS,EACvC,aAAa,EAAE,aAAa,CAAC,mBAAmB,CAAC;IAKnD,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED,MAAM,IAAI,oBAAoB;CAsC/B"}