@carlonicora/nestjs-neo4jsonapi 1.115.0 → 1.116.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 (395) hide show
  1. package/dist/bootstrap/app.module.factory.d.ts.map +1 -1
  2. package/dist/bootstrap/app.module.factory.js +1 -0
  3. package/dist/bootstrap/app.module.factory.js.map +1 -1
  4. package/dist/bootstrap/bootstrap.options.d.ts +17 -0
  5. package/dist/bootstrap/bootstrap.options.d.ts.map +1 -1
  6. package/dist/common/guards/jwt.auth.guard.d.ts +3 -2
  7. package/dist/common/guards/jwt.auth.guard.d.ts.map +1 -1
  8. package/dist/common/guards/jwt.auth.guard.js +7 -2
  9. package/dist/common/guards/jwt.auth.guard.js.map +1 -1
  10. package/dist/common/interfaces/entity.schema.interface.d.ts +2 -0
  11. package/dist/common/interfaces/entity.schema.interface.d.ts.map +1 -1
  12. package/dist/common/tokens.d.ts +64 -0
  13. package/dist/common/tokens.d.ts.map +1 -1
  14. package/dist/common/tokens.js +37 -2
  15. package/dist/common/tokens.js.map +1 -1
  16. package/dist/config/base.config.d.ts.map +1 -1
  17. package/dist/config/base.config.js +1 -0
  18. package/dist/config/base.config.js.map +1 -1
  19. package/dist/config/enums/queue.id.d.ts +2 -1
  20. package/dist/config/enums/queue.id.d.ts.map +1 -1
  21. package/dist/config/enums/queue.id.js +1 -0
  22. package/dist/config/enums/queue.id.js.map +1 -1
  23. package/dist/config/interfaces/config.auth.interface.d.ts +7 -0
  24. package/dist/config/interfaces/config.auth.interface.d.ts.map +1 -1
  25. package/dist/config/interfaces/config.email.interface.d.ts +6 -0
  26. package/dist/config/interfaces/config.email.interface.d.ts.map +1 -1
  27. package/dist/core/email/services/email.service.d.ts +1 -0
  28. package/dist/core/email/services/email.service.d.ts.map +1 -1
  29. package/dist/core/email/services/email.service.js +22 -18
  30. package/dist/core/email/services/email.service.js.map +1 -1
  31. package/dist/core/llm/services/llm.service.d.ts +9 -1
  32. package/dist/core/llm/services/llm.service.d.ts.map +1 -1
  33. package/dist/core/llm/services/llm.service.js +13 -3
  34. package/dist/core/llm/services/llm.service.js.map +1 -1
  35. package/dist/core/neo4j/abstracts/abstract.repository.d.ts.map +1 -1
  36. package/dist/core/neo4j/abstracts/abstract.repository.js +33 -2
  37. package/dist/core/neo4j/abstracts/abstract.repository.js.map +1 -1
  38. package/dist/foundations/auth/auth.module.d.ts.map +1 -1
  39. package/dist/foundations/auth/auth.module.js +9 -10
  40. package/dist/foundations/auth/auth.module.js.map +1 -1
  41. package/dist/foundations/auth/controllers/auth.controller.d.ts.map +1 -1
  42. package/dist/foundations/auth/controllers/auth.controller.js +5 -0
  43. package/dist/foundations/auth/controllers/auth.controller.js.map +1 -1
  44. package/dist/foundations/auth/controllers/auth.discord.controller.d.ts.map +1 -1
  45. package/dist/foundations/auth/controllers/auth.discord.controller.js +6 -3
  46. package/dist/foundations/auth/controllers/auth.discord.controller.js.map +1 -1
  47. package/dist/foundations/auth/controllers/auth.google.controller.d.ts.map +1 -1
  48. package/dist/foundations/auth/controllers/auth.google.controller.js +7 -3
  49. package/dist/foundations/auth/controllers/auth.google.controller.js.map +1 -1
  50. package/dist/foundations/auth/entities/auth.code.d.ts +34 -0
  51. package/dist/foundations/auth/entities/auth.code.d.ts.map +1 -0
  52. package/dist/foundations/auth/entities/auth.code.js +53 -0
  53. package/dist/foundations/auth/entities/auth.code.js.map +1 -0
  54. package/dist/foundations/auth/entities/auth.d.ts +41 -0
  55. package/dist/foundations/auth/entities/auth.d.ts.map +1 -0
  56. package/dist/foundations/auth/entities/auth.js +68 -0
  57. package/dist/foundations/auth/entities/auth.js.map +1 -0
  58. package/dist/foundations/auth/entities/pending-auth.d.ts +39 -0
  59. package/dist/foundations/auth/entities/pending-auth.d.ts.map +1 -0
  60. package/dist/foundations/auth/entities/pending-auth.js +41 -0
  61. package/dist/foundations/auth/entities/pending-auth.js.map +1 -0
  62. package/dist/foundations/auth/index.d.ts +13 -0
  63. package/dist/foundations/auth/index.d.ts.map +1 -1
  64. package/dist/foundations/auth/index.js +31 -1
  65. package/dist/foundations/auth/index.js.map +1 -1
  66. package/dist/foundations/auth/repositories/auth.repository.d.ts +49 -9
  67. package/dist/foundations/auth/repositories/auth.repository.d.ts.map +1 -1
  68. package/dist/foundations/auth/repositories/auth.repository.js +115 -63
  69. package/dist/foundations/auth/repositories/auth.repository.js.map +1 -1
  70. package/dist/foundations/auth/services/auth.discord.service.d.ts +1 -1
  71. package/dist/foundations/auth/services/auth.discord.service.d.ts.map +1 -1
  72. package/dist/foundations/auth/services/auth.discord.service.js +5 -2
  73. package/dist/foundations/auth/services/auth.discord.service.js.map +1 -1
  74. package/dist/foundations/auth/services/auth.google.service.d.ts +1 -1
  75. package/dist/foundations/auth/services/auth.google.service.d.ts.map +1 -1
  76. package/dist/foundations/auth/services/auth.google.service.js +6 -2
  77. package/dist/foundations/auth/services/auth.google.service.js.map +1 -1
  78. package/dist/foundations/auth/services/auth.service.d.ts +42 -7
  79. package/dist/foundations/auth/services/auth.service.d.ts.map +1 -1
  80. package/dist/foundations/auth/services/auth.service.js +140 -77
  81. package/dist/foundations/auth/services/auth.service.js.map +1 -1
  82. package/dist/foundations/company/entities/company.d.ts +1 -1
  83. package/dist/foundations/company/entities/company.d.ts.map +1 -1
  84. package/dist/foundations/company/entities/company.js +15 -1
  85. package/dist/foundations/company/entities/company.js.map +1 -1
  86. package/dist/foundations/company/index.d.ts +5 -0
  87. package/dist/foundations/company/index.d.ts.map +1 -1
  88. package/dist/foundations/company/index.js +16 -1
  89. package/dist/foundations/company/index.js.map +1 -1
  90. package/dist/foundations/company/processors/company.processor.js +1 -1
  91. package/dist/foundations/company/processors/company.processor.js.map +1 -1
  92. package/dist/foundations/company/repositories/company.repository.d.ts +65 -9
  93. package/dist/foundations/company/repositories/company.repository.d.ts.map +1 -1
  94. package/dist/foundations/company/repositories/company.repository.js +59 -18
  95. package/dist/foundations/company/repositories/company.repository.js.map +1 -1
  96. package/dist/foundations/company/services/company.service.d.ts +44 -4
  97. package/dist/foundations/company/services/company.service.d.ts.map +1 -1
  98. package/dist/foundations/company/services/company.service.js +33 -7
  99. package/dist/foundations/company/services/company.service.js.map +1 -1
  100. package/dist/foundations/content/content.module.d.ts +20 -8
  101. package/dist/foundations/content/content.module.d.ts.map +1 -1
  102. package/dist/foundations/content/content.module.js +40 -24
  103. package/dist/foundations/content/content.module.js.map +1 -1
  104. package/dist/foundations/content/controllers/content.controller.d.ts +1 -1
  105. package/dist/foundations/content/controllers/content.controller.d.ts.map +1 -1
  106. package/dist/foundations/content/controllers/content.controller.js +2 -2
  107. package/dist/foundations/content/controllers/content.controller.js.map +1 -1
  108. package/dist/foundations/content/entities/content.d.ts +74 -0
  109. package/dist/foundations/content/entities/content.d.ts.map +1 -0
  110. package/dist/foundations/content/entities/content.js +141 -0
  111. package/dist/foundations/content/entities/content.js.map +1 -0
  112. package/dist/foundations/content/index.d.ts +2 -4
  113. package/dist/foundations/content/index.d.ts.map +1 -1
  114. package/dist/foundations/content/index.js +6 -5
  115. package/dist/foundations/content/index.js.map +1 -1
  116. package/dist/foundations/content/interfaces/content.extension.interface.d.ts +126 -0
  117. package/dist/foundations/content/interfaces/content.extension.interface.d.ts.map +1 -1
  118. package/dist/foundations/content/interfaces/content.extension.interface.js +7 -1
  119. package/dist/foundations/content/interfaces/content.extension.interface.js.map +1 -1
  120. package/dist/foundations/content/repositories/content.repository.d.ts +14 -7
  121. package/dist/foundations/content/repositories/content.repository.d.ts.map +1 -1
  122. package/dist/foundations/content/repositories/content.repository.js +18 -16
  123. package/dist/foundations/content/repositories/content.repository.js.map +1 -1
  124. package/dist/foundations/content/services/content.cypher.service.d.ts +19 -0
  125. package/dist/foundations/content/services/content.cypher.service.d.ts.map +1 -1
  126. package/dist/foundations/content/services/content.cypher.service.js +65 -4
  127. package/dist/foundations/content/services/content.cypher.service.js.map +1 -1
  128. package/dist/foundations/content/services/content.service.js +4 -4
  129. package/dist/foundations/content/services/content.service.js.map +1 -1
  130. package/dist/foundations/discord-user/services/discord-user.service.js +2 -2
  131. package/dist/foundations/discord-user/services/discord-user.service.js.map +1 -1
  132. package/dist/foundations/feature/entities/feature.d.ts +32 -0
  133. package/dist/foundations/feature/entities/feature.d.ts.map +1 -0
  134. package/dist/foundations/feature/entities/feature.js +64 -0
  135. package/dist/foundations/feature/entities/feature.js.map +1 -0
  136. package/dist/foundations/feature/entities/feature.model.d.ts +1 -3
  137. package/dist/foundations/feature/entities/feature.model.d.ts.map +1 -1
  138. package/dist/foundations/feature/entities/feature.model.js +3 -11
  139. package/dist/foundations/feature/entities/feature.model.js.map +1 -1
  140. package/dist/foundations/feature/feature.module.d.ts.map +1 -1
  141. package/dist/foundations/feature/feature.module.js +4 -5
  142. package/dist/foundations/feature/feature.module.js.map +1 -1
  143. package/dist/foundations/feature/index.d.ts +12 -0
  144. package/dist/foundations/feature/index.d.ts.map +1 -1
  145. package/dist/foundations/feature/index.js +22 -1
  146. package/dist/foundations/feature/index.js.map +1 -1
  147. package/dist/foundations/feature/repositories/feature.repository.d.ts +37 -13
  148. package/dist/foundations/feature/repositories/feature.repository.d.ts.map +1 -1
  149. package/dist/foundations/feature/repositories/feature.repository.js +41 -35
  150. package/dist/foundations/feature/repositories/feature.repository.js.map +1 -1
  151. package/dist/foundations/feature/services/feature.service.d.ts +31 -4
  152. package/dist/foundations/feature/services/feature.service.d.ts.map +1 -1
  153. package/dist/foundations/feature/services/feature.service.js +20 -12
  154. package/dist/foundations/feature/services/feature.service.js.map +1 -1
  155. package/dist/foundations/foundations.modules.d.ts +6 -0
  156. package/dist/foundations/foundations.modules.d.ts.map +1 -1
  157. package/dist/foundations/foundations.modules.js +14 -3
  158. package/dist/foundations/foundations.modules.js.map +1 -1
  159. package/dist/foundations/google-user/services/google-user.service.js +2 -2
  160. package/dist/foundations/google-user/services/google-user.service.js.map +1 -1
  161. package/dist/foundations/index.d.ts +3 -0
  162. package/dist/foundations/index.d.ts.map +1 -1
  163. package/dist/foundations/index.js +3 -0
  164. package/dist/foundations/index.js.map +1 -1
  165. package/dist/foundations/membership/entities/membership.d.ts.map +1 -1
  166. package/dist/foundations/membership/entities/membership.js +4 -0
  167. package/dist/foundations/membership/entities/membership.js.map +1 -1
  168. package/dist/foundations/notification/controllers/notification.controller.js +2 -2
  169. package/dist/foundations/notification/controllers/notification.controller.js.map +1 -1
  170. package/dist/foundations/notification/entities/notification.d.ts +75 -0
  171. package/dist/foundations/notification/entities/notification.d.ts.map +1 -0
  172. package/dist/foundations/notification/entities/notification.js +73 -0
  173. package/dist/foundations/notification/entities/notification.js.map +1 -0
  174. package/dist/foundations/notification/index.d.ts +6 -2
  175. package/dist/foundations/notification/index.d.ts.map +1 -1
  176. package/dist/foundations/notification/index.js +17 -3
  177. package/dist/foundations/notification/index.js.map +1 -1
  178. package/dist/foundations/notification/notification.module.d.ts.map +1 -1
  179. package/dist/foundations/notification/notification.module.js +3 -4
  180. package/dist/foundations/notification/notification.module.js.map +1 -1
  181. package/dist/foundations/notification/repositories/notification.repository.d.ts +125 -8
  182. package/dist/foundations/notification/repositories/notification.repository.d.ts.map +1 -1
  183. package/dist/foundations/notification/repositories/notification.repository.js +219 -20
  184. package/dist/foundations/notification/repositories/notification.repository.js.map +1 -1
  185. package/dist/foundations/notification/services/notification.service.d.ts +31 -5
  186. package/dist/foundations/notification/services/notification.service.d.ts.map +1 -1
  187. package/dist/foundations/notification/services/notification.service.js +26 -9
  188. package/dist/foundations/notification/services/notification.service.js.map +1 -1
  189. package/dist/foundations/rbac/dump.d.ts +48 -4
  190. package/dist/foundations/rbac/dump.d.ts.map +1 -1
  191. package/dist/foundations/rbac/dump.js +28 -4
  192. package/dist/foundations/rbac/dump.js.map +1 -1
  193. package/dist/foundations/rbac/serializer/matrix-to-ts.d.ts +14 -0
  194. package/dist/foundations/rbac/serializer/matrix-to-ts.d.ts.map +1 -1
  195. package/dist/foundations/rbac/serializer/matrix-to-ts.js +13 -3
  196. package/dist/foundations/rbac/serializer/matrix-to-ts.js.map +1 -1
  197. package/dist/foundations/relevancy/repositories/relevancy.repository.d.ts.map +1 -1
  198. package/dist/foundations/relevancy/repositories/relevancy.repository.js +13 -1
  199. package/dist/foundations/relevancy/repositories/relevancy.repository.js.map +1 -1
  200. package/dist/foundations/role/entities/role.d.ts +1 -1
  201. package/dist/foundations/role/entities/role.d.ts.map +1 -1
  202. package/dist/foundations/stripe/index.d.ts +3 -0
  203. package/dist/foundations/stripe/index.d.ts.map +1 -1
  204. package/dist/foundations/stripe/index.js +6 -0
  205. package/dist/foundations/stripe/index.js.map +1 -1
  206. package/dist/foundations/stripe-price/entities/stripe-price.entity.d.ts +1 -1
  207. package/dist/foundations/stripe-price/entities/stripe-price.entity.d.ts.map +1 -1
  208. package/dist/foundations/tokenusage/entities/tokenusage.d.ts +49 -0
  209. package/dist/foundations/tokenusage/entities/tokenusage.d.ts.map +1 -0
  210. package/dist/foundations/tokenusage/entities/tokenusage.js +64 -0
  211. package/dist/foundations/tokenusage/entities/tokenusage.js.map +1 -0
  212. package/dist/foundations/tokenusage/index.d.ts +2 -2
  213. package/dist/foundations/tokenusage/index.d.ts.map +1 -1
  214. package/dist/foundations/tokenusage/index.js +5 -3
  215. package/dist/foundations/tokenusage/index.js.map +1 -1
  216. package/dist/foundations/tokenusage/repositories/tokenusage.repository.d.ts +33 -5
  217. package/dist/foundations/tokenusage/repositories/tokenusage.repository.d.ts.map +1 -1
  218. package/dist/foundations/tokenusage/repositories/tokenusage.repository.js +40 -14
  219. package/dist/foundations/tokenusage/repositories/tokenusage.repository.js.map +1 -1
  220. package/dist/foundations/tokenusage/services/tokenusage.service.d.ts +36 -9
  221. package/dist/foundations/tokenusage/services/tokenusage.service.d.ts.map +1 -1
  222. package/dist/foundations/tokenusage/services/tokenusage.service.js +32 -3
  223. package/dist/foundations/tokenusage/services/tokenusage.service.js.map +1 -1
  224. package/dist/foundations/tokenusage/tokenusage.module.js +3 -3
  225. package/dist/foundations/tokenusage/tokenusage.module.js.map +1 -1
  226. package/dist/foundations/user/controllers/user.controller.js +4 -4
  227. package/dist/foundations/user/controllers/user.controller.js.map +1 -1
  228. package/dist/foundations/user/dtos/user.put.dto.d.ts +1 -1
  229. package/dist/foundations/user/dtos/user.put.dto.d.ts.map +1 -1
  230. package/dist/foundations/user/dtos/user.put.dto.js +1 -1
  231. package/dist/foundations/user/dtos/user.put.dto.js.map +1 -1
  232. package/dist/foundations/user/entities/user.d.ts +4 -0
  233. package/dist/foundations/user/entities/user.d.ts.map +1 -1
  234. package/dist/foundations/user/entities/user.js +18 -4
  235. package/dist/foundations/user/entities/user.js.map +1 -1
  236. package/dist/foundations/user/index.d.ts +6 -1
  237. package/dist/foundations/user/index.d.ts.map +1 -1
  238. package/dist/foundations/user/index.js +13 -1
  239. package/dist/foundations/user/index.js.map +1 -1
  240. package/dist/foundations/user/repositories/user.repository.d.ts +56 -11
  241. package/dist/foundations/user/repositories/user.repository.d.ts.map +1 -1
  242. package/dist/foundations/user/repositories/user.repository.js +55 -35
  243. package/dist/foundations/user/repositories/user.repository.js.map +1 -1
  244. package/dist/foundations/user/services/user.service.d.ts +48 -9
  245. package/dist/foundations/user/services/user.service.d.ts.map +1 -1
  246. package/dist/foundations/user/services/user.service.js +50 -32
  247. package/dist/foundations/user/services/user.service.js.map +1 -1
  248. package/dist/foundations/user-activity/entities/user-activity.d.ts +36 -0
  249. package/dist/foundations/user-activity/entities/user-activity.d.ts.map +1 -0
  250. package/dist/foundations/user-activity/entities/user-activity.js +86 -0
  251. package/dist/foundations/user-activity/entities/user-activity.js.map +1 -0
  252. package/dist/foundations/user-activity/entities/user-activity.meta.d.ts +3 -0
  253. package/dist/foundations/user-activity/entities/user-activity.meta.d.ts.map +1 -0
  254. package/dist/foundations/user-activity/entities/user-activity.meta.js +10 -0
  255. package/dist/foundations/user-activity/entities/user-activity.meta.js.map +1 -0
  256. package/dist/foundations/user-activity/index.d.ts +10 -0
  257. package/dist/foundations/user-activity/index.d.ts.map +1 -0
  258. package/dist/foundations/user-activity/index.js +22 -0
  259. package/dist/foundations/user-activity/index.js.map +1 -0
  260. package/dist/foundations/user-activity/interceptors/user-activity.interceptor.d.ts +29 -0
  261. package/dist/foundations/user-activity/interceptors/user-activity.interceptor.d.ts.map +1 -0
  262. package/dist/foundations/user-activity/interceptors/user-activity.interceptor.js +98 -0
  263. package/dist/foundations/user-activity/interceptors/user-activity.interceptor.js.map +1 -0
  264. package/dist/foundations/user-activity/interfaces/user-activity.config.interface.d.ts +67 -0
  265. package/dist/foundations/user-activity/interfaces/user-activity.config.interface.d.ts.map +1 -0
  266. package/dist/foundations/user-activity/interfaces/user-activity.config.interface.js +26 -0
  267. package/dist/foundations/user-activity/interfaces/user-activity.config.interface.js.map +1 -0
  268. package/dist/foundations/user-activity/interfaces/user-activity.record.input.d.ts +18 -0
  269. package/dist/foundations/user-activity/interfaces/user-activity.record.input.d.ts.map +1 -0
  270. package/dist/foundations/{auth/entities/auth.entity.js → user-activity/interfaces/user-activity.record.input.js} +1 -1
  271. package/dist/foundations/user-activity/interfaces/user-activity.record.input.js.map +1 -0
  272. package/dist/foundations/user-activity/processors/user-activity.processor.d.ts +25 -0
  273. package/dist/foundations/user-activity/processors/user-activity.processor.d.ts.map +1 -0
  274. package/dist/foundations/user-activity/processors/user-activity.processor.js +74 -0
  275. package/dist/foundations/user-activity/processors/user-activity.processor.js.map +1 -0
  276. package/dist/foundations/user-activity/repositories/user-activity.repository.d.ts +47 -0
  277. package/dist/foundations/user-activity/repositories/user-activity.repository.d.ts.map +1 -0
  278. package/dist/foundations/user-activity/repositories/user-activity.repository.js +124 -0
  279. package/dist/foundations/user-activity/repositories/user-activity.repository.js.map +1 -0
  280. package/dist/foundations/user-activity/services/user-activity.service.d.ts +29 -0
  281. package/dist/foundations/user-activity/services/user-activity.service.d.ts.map +1 -0
  282. package/dist/foundations/user-activity/services/user-activity.service.js +61 -0
  283. package/dist/foundations/user-activity/services/user-activity.service.js.map +1 -0
  284. package/dist/foundations/user-activity/user-activity.module.d.ts +40 -0
  285. package/dist/foundations/user-activity/user-activity.module.d.ts.map +1 -0
  286. package/dist/foundations/user-activity/user-activity.module.js +99 -0
  287. package/dist/foundations/user-activity/user-activity.module.js.map +1 -0
  288. package/package.json +1 -1
  289. package/dist/foundations/auth/entities/auth.code.entity.d.ts +0 -7
  290. package/dist/foundations/auth/entities/auth.code.entity.d.ts.map +0 -1
  291. package/dist/foundations/auth/entities/auth.code.entity.js +0 -3
  292. package/dist/foundations/auth/entities/auth.code.entity.js.map +0 -1
  293. package/dist/foundations/auth/entities/auth.code.map.d.ts +0 -8
  294. package/dist/foundations/auth/entities/auth.code.map.d.ts.map +0 -1
  295. package/dist/foundations/auth/entities/auth.code.map.js +0 -13
  296. package/dist/foundations/auth/entities/auth.code.map.js.map +0 -1
  297. package/dist/foundations/auth/entities/auth.code.model.d.ts +0 -4
  298. package/dist/foundations/auth/entities/auth.code.model.d.ts.map +0 -1
  299. package/dist/foundations/auth/entities/auth.code.model.js +0 -13
  300. package/dist/foundations/auth/entities/auth.code.model.js.map +0 -1
  301. package/dist/foundations/auth/entities/auth.entity.d.ts +0 -18
  302. package/dist/foundations/auth/entities/auth.entity.d.ts.map +0 -1
  303. package/dist/foundations/auth/entities/auth.entity.js.map +0 -1
  304. package/dist/foundations/auth/entities/auth.map.d.ts +0 -8
  305. package/dist/foundations/auth/entities/auth.map.d.ts.map +0 -1
  306. package/dist/foundations/auth/entities/auth.map.js +0 -14
  307. package/dist/foundations/auth/entities/auth.map.js.map +0 -1
  308. package/dist/foundations/auth/entities/auth.model.d.ts +0 -4
  309. package/dist/foundations/auth/entities/auth.model.d.ts.map +0 -1
  310. package/dist/foundations/auth/entities/auth.model.js +0 -15
  311. package/dist/foundations/auth/entities/auth.model.js.map +0 -1
  312. package/dist/foundations/auth/entities/pending-auth.entity.d.ts +0 -16
  313. package/dist/foundations/auth/entities/pending-auth.entity.d.ts.map +0 -1
  314. package/dist/foundations/auth/entities/pending-auth.entity.js +0 -3
  315. package/dist/foundations/auth/entities/pending-auth.entity.js.map +0 -1
  316. package/dist/foundations/auth/entities/pending-auth.map.d.ts +0 -6
  317. package/dist/foundations/auth/entities/pending-auth.map.d.ts.map +0 -1
  318. package/dist/foundations/auth/entities/pending-auth.map.js +0 -20
  319. package/dist/foundations/auth/entities/pending-auth.map.js.map +0 -1
  320. package/dist/foundations/auth/entities/pending-auth.model.d.ts +0 -9
  321. package/dist/foundations/auth/entities/pending-auth.model.d.ts.map +0 -1
  322. package/dist/foundations/auth/entities/pending-auth.model.js +0 -19
  323. package/dist/foundations/auth/entities/pending-auth.model.js.map +0 -1
  324. package/dist/foundations/auth/serialisers/auth.serialiser.d.ts +0 -13
  325. package/dist/foundations/auth/serialisers/auth.serialiser.d.ts.map +0 -1
  326. package/dist/foundations/auth/serialisers/auth.serialiser.js +0 -52
  327. package/dist/foundations/auth/serialisers/auth.serialiser.js.map +0 -1
  328. package/dist/foundations/auth/serialisers/pending-auth.serialiser.d.ts +0 -18
  329. package/dist/foundations/auth/serialisers/pending-auth.serialiser.d.ts.map +0 -1
  330. package/dist/foundations/auth/serialisers/pending-auth.serialiser.js +0 -49
  331. package/dist/foundations/auth/serialisers/pending-auth.serialiser.js.map +0 -1
  332. package/dist/foundations/content/entities/content.entity.d.ts +0 -31
  333. package/dist/foundations/content/entities/content.entity.d.ts.map +0 -1
  334. package/dist/foundations/content/entities/content.entity.js +0 -3
  335. package/dist/foundations/content/entities/content.entity.js.map +0 -1
  336. package/dist/foundations/content/entities/content.map.d.ts +0 -8
  337. package/dist/foundations/content/entities/content.map.d.ts.map +0 -1
  338. package/dist/foundations/content/entities/content.map.js +0 -19
  339. package/dist/foundations/content/entities/content.map.js.map +0 -1
  340. package/dist/foundations/content/entities/content.model.d.ts +0 -4
  341. package/dist/foundations/content/entities/content.model.d.ts.map +0 -1
  342. package/dist/foundations/content/entities/content.model.js +0 -16
  343. package/dist/foundations/content/entities/content.model.js.map +0 -1
  344. package/dist/foundations/content/factories/content.model.factory.d.ts +0 -17
  345. package/dist/foundations/content/factories/content.model.factory.d.ts.map +0 -1
  346. package/dist/foundations/content/factories/content.model.factory.js +0 -65
  347. package/dist/foundations/content/factories/content.model.factory.js.map +0 -1
  348. package/dist/foundations/content/serialisers/content.serialiser.d.ts +0 -14
  349. package/dist/foundations/content/serialisers/content.serialiser.d.ts.map +0 -1
  350. package/dist/foundations/content/serialisers/content.serialiser.js +0 -78
  351. package/dist/foundations/content/serialisers/content.serialiser.js.map +0 -1
  352. package/dist/foundations/feature/entities/feature.entity.d.ts +0 -8
  353. package/dist/foundations/feature/entities/feature.entity.d.ts.map +0 -1
  354. package/dist/foundations/feature/entities/feature.entity.js +0 -3
  355. package/dist/foundations/feature/entities/feature.entity.js.map +0 -1
  356. package/dist/foundations/feature/entities/feature.map.d.ts +0 -8
  357. package/dist/foundations/feature/entities/feature.map.d.ts.map +0 -1
  358. package/dist/foundations/feature/entities/feature.map.js +0 -14
  359. package/dist/foundations/feature/entities/feature.map.js.map +0 -1
  360. package/dist/foundations/feature/serialisers/feature.serialiser.d.ts +0 -12
  361. package/dist/foundations/feature/serialisers/feature.serialiser.d.ts.map +0 -1
  362. package/dist/foundations/feature/serialisers/feature.serialiser.js +0 -45
  363. package/dist/foundations/feature/serialisers/feature.serialiser.js.map +0 -1
  364. package/dist/foundations/notification/entities/notification.entity.d.ts +0 -10
  365. package/dist/foundations/notification/entities/notification.entity.d.ts.map +0 -1
  366. package/dist/foundations/notification/entities/notification.entity.js +0 -3
  367. package/dist/foundations/notification/entities/notification.entity.js.map +0 -1
  368. package/dist/foundations/notification/entities/notification.map.d.ts +0 -8
  369. package/dist/foundations/notification/entities/notification.map.d.ts.map +0 -1
  370. package/dist/foundations/notification/entities/notification.map.js +0 -16
  371. package/dist/foundations/notification/entities/notification.map.js.map +0 -1
  372. package/dist/foundations/notification/entities/notification.model.d.ts +0 -4
  373. package/dist/foundations/notification/entities/notification.model.d.ts.map +0 -1
  374. package/dist/foundations/notification/entities/notification.model.js +0 -15
  375. package/dist/foundations/notification/entities/notification.model.js.map +0 -1
  376. package/dist/foundations/notification/interfaces/notification.service.interface.d.ts +0 -4
  377. package/dist/foundations/notification/interfaces/notification.service.interface.d.ts.map +0 -1
  378. package/dist/foundations/notification/interfaces/notification.service.interface.js +0 -3
  379. package/dist/foundations/notification/interfaces/notification.service.interface.js.map +0 -1
  380. package/dist/foundations/notification/serialisers/notifications.serialiser.d.ts +0 -12
  381. package/dist/foundations/notification/serialisers/notifications.serialiser.d.ts.map +0 -1
  382. package/dist/foundations/notification/serialisers/notifications.serialiser.js +0 -47
  383. package/dist/foundations/notification/serialisers/notifications.serialiser.js.map +0 -1
  384. package/dist/foundations/tokenusage/entities/tokenusage.entity.d.ts +0 -11
  385. package/dist/foundations/tokenusage/entities/tokenusage.entity.d.ts.map +0 -1
  386. package/dist/foundations/tokenusage/entities/tokenusage.entity.js +0 -3
  387. package/dist/foundations/tokenusage/entities/tokenusage.entity.js.map +0 -1
  388. package/dist/foundations/tokenusage/entities/tokenusage.map.d.ts +0 -8
  389. package/dist/foundations/tokenusage/entities/tokenusage.map.d.ts.map +0 -1
  390. package/dist/foundations/tokenusage/entities/tokenusage.map.js +0 -17
  391. package/dist/foundations/tokenusage/entities/tokenusage.map.js.map +0 -1
  392. package/dist/foundations/tokenusage/entities/tokenusage.model.d.ts +0 -4
  393. package/dist/foundations/tokenusage/entities/tokenusage.model.d.ts.map +0 -1
  394. package/dist/foundations/tokenusage/entities/tokenusage.model.js +0 -15
  395. package/dist/foundations/tokenusage/entities/tokenusage.model.js.map +0 -1
@@ -0,0 +1,39 @@
1
+ import { Entity } from "../../../common";
2
+ /**
3
+ * PendingAuth Entity Type
4
+ *
5
+ * The response returned when a user with 2FA enabled successfully
6
+ * authenticates with a password but still has to complete 2FA verification.
7
+ *
8
+ * PendingAuth is NEVER persisted: no `:PendingAuth` node exists in Neo4j. The
9
+ * login flow hands a plain object straight to `JsonApiService.buildSingle`,
10
+ * so the descriptor exists only to describe the JSON:API shape.
11
+ *
12
+ * NAMING: the property names below are the ON-THE-WIRE attribute names of the
13
+ * deleted `PendingAuthSerialiser` (`pendingToken`, `expiresAt`,
14
+ * `availableMethods`, `preferredMethod`). The descriptor-based serialiser maps
15
+ * every attribute 1:1 from the field name (see DescriptorBasedSerialiser.create),
16
+ * so it has no way to rename `token` -> `pendingToken` the way the hand-written
17
+ * serialiser did. Keeping the entity properties on the wire names is what
18
+ * preserves the response byte-for-byte — do not "tidy" them back to
19
+ * `token` / `expiration`.
20
+ */
21
+ export type PendingAuth = Entity & {
22
+ /** The pending JWT token (limited access until 2FA is completed) */
23
+ pendingToken: string;
24
+ /** When the pending session expires */
25
+ expiresAt: Date;
26
+ /** Available 2FA methods for this user */
27
+ availableMethods: string[];
28
+ /** The user's preferred 2FA method */
29
+ preferredMethod?: string;
30
+ };
31
+ /**
32
+ * PendingAuth Entity Descriptor
33
+ *
34
+ * SECURITY: like Auth, deliberately NOT registered with the
35
+ * GraphDescriptorRegistry — `pendingToken` is a live (if limited) credential.
36
+ */
37
+ export declare const PendingAuthDescriptor: import("../../../common").EntityDescriptor<PendingAuth, {}>;
38
+ export type PendingAuthDescriptorType = typeof PendingAuthDescriptor;
39
+ //# sourceMappingURL=pending-auth.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pending-auth.d.ts","sourceRoot":"","sources":["../../../../src/foundations/auth/entities/pending-auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAGvD;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG;IACjC,oEAAoE;IACpE,YAAY,EAAE,MAAM,CAAC;IAErB,uCAAuC;IACvC,SAAS,EAAE,IAAI,CAAC;IAEhB,0CAA0C;IAC1C,gBAAgB,EAAE,MAAM,EAAE,CAAC;IAE3B,sCAAsC;IACtC,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,6DAkChC,CAAC;AAGH,MAAM,MAAM,yBAAyB,GAAG,OAAO,qBAAqB,CAAC"}
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PendingAuthDescriptor = void 0;
4
+ const common_1 = require("../../../common");
5
+ const pending_auth_meta_1 = require("./pending-auth.meta");
6
+ /**
7
+ * PendingAuth Entity Descriptor
8
+ *
9
+ * SECURITY: like Auth, deliberately NOT registered with the
10
+ * GraphDescriptorRegistry — `pendingToken` is a live (if limited) credential.
11
+ */
12
+ exports.PendingAuthDescriptor = (0, common_1.defineEntity)()({
13
+ ...pending_auth_meta_1.pendingAuthMeta,
14
+ // Not persisted, never joined to a Company; the 2FA challenge is issued
15
+ // before any company scope exists in CLS.
16
+ isCompanyScoped: false,
17
+ description: "A pending two-factor authentication challenge (sfida a due fattori): issued when the password check succeeds but 2FA verification is still required.",
18
+ fields: {
19
+ pendingToken: {
20
+ type: "string",
21
+ required: true,
22
+ description: "Short-lived JWT with limited access, valid only for completing the 2FA verification of this challenge.",
23
+ },
24
+ expiresAt: {
25
+ type: "datetime",
26
+ required: true,
27
+ description: "The instant this pending 2FA challenge expires and can no longer be completed.",
28
+ },
29
+ availableMethods: {
30
+ type: "string[]",
31
+ description: "The 2FA methods this user can verify with (e.g. totp, passkey, backup code).",
32
+ },
33
+ preferredMethod: {
34
+ type: "string",
35
+ description: "The 2FA method the user selected as preferred, so the client can pre-select it.",
36
+ },
37
+ },
38
+ // No relationships: the challenge carries no resource linkage.
39
+ relationships: {},
40
+ });
41
+ //# sourceMappingURL=pending-auth.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pending-auth.js","sourceRoot":"","sources":["../../../../src/foundations/auth/entities/pending-auth.ts"],"names":[],"mappings":";;;AAAA,4CAAuD;AACvD,2DAAsD;AAmCtD;;;;;GAKG;AACU,QAAA,qBAAqB,GAAG,IAAA,qBAAY,GAAe,CAAC;IAC/D,GAAG,mCAAe;IAElB,wEAAwE;IACxE,0CAA0C;IAC1C,eAAe,EAAE,KAAK;IAEtB,WAAW,EACT,sJAAsJ;IAExJ,MAAM,EAAE;QACN,YAAY,EAAE;YACZ,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;YACd,WAAW,EACT,wGAAwG;SAC3G;QACD,SAAS,EAAE;YACT,IAAI,EAAE,UAAU;YAChB,QAAQ,EAAE,IAAI;YACd,WAAW,EAAE,gFAAgF;SAC9F;QACD,gBAAgB,EAAE;YAChB,IAAI,EAAE,UAAU;YAChB,WAAW,EAAE,8EAA8E;SAC5F;QACD,eAAe,EAAE;YACf,IAAI,EAAE,QAAQ;YACd,WAAW,EAAE,iFAAiF;SAC/F;KACF;IAED,+DAA+D;IAC/D,aAAa,EAAE,EAAE;CAClB,CAAC,CAAC"}
@@ -1,8 +1,21 @@
1
1
  export { AuthModule } from "./auth.module";
2
2
  export { AuthCompanyController } from "./controllers/auth.company.controller";
3
3
  export { AuthController } from "./controllers/auth.controller";
4
+ export { AuthGoogleController } from "./controllers/auth.google.controller";
5
+ export { AuthPostForgotDTO } from "./dtos/auth.post.forgot.dto";
6
+ export { AuthPostLoginAttributesDTO, AuthPostLoginDataDTO, AuthPostLoginDTO } from "./dtos/auth.post.login.dto";
7
+ export { AuthPostRegisterAttributesDTO, AuthPostRegisterDataDTO, AuthPostRegisterDTO, } from "./dtos/auth.post.register.dto";
8
+ export { AuthPostResetPasswordDTO } from "./dtos/auth.post.resetpassword.dto";
9
+ export { Auth, AuthDescriptor } from "./entities/auth";
10
+ export { AuthCode, AuthCodeDescriptor } from "./entities/auth.code";
11
+ export { authCodeMeta } from "./entities/auth.code.meta";
4
12
  export { authMeta } from "./entities/auth.meta";
13
+ export { PendingAuth, PendingAuthDescriptor } from "./entities/pending-auth";
14
+ export { pendingAuthMeta } from "./entities/pending-auth.meta";
5
15
  export { REGISTRATION_HOOK, RegistrationHookInterface } from "./interfaces/registration-hook.interface";
16
+ export { AuthRepository } from "./repositories/auth.repository";
17
+ export { AuthGoogleService } from "./services/auth.google.service";
6
18
  export { AuthService } from "./services/auth.service";
19
+ export { PendingRegistrationService } from "./services/pending-registration.service";
7
20
  export { TrialQueueService } from "./services/trial-queue.service";
8
21
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/foundations/auth/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,qBAAqB,EAAE,MAAM,uCAAuC,CAAC;AAC9E,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,iBAAiB,EAAE,yBAAyB,EAAE,MAAM,0CAA0C,CAAC;AACxG,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/foundations/auth/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,qBAAqB,EAAE,MAAM,uCAAuC,CAAC;AAC9E,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AAC5E,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,0BAA0B,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAChH,OAAO,EACL,6BAA6B,EAC7B,uBAAuB,EACvB,mBAAmB,GACpB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,wBAAwB,EAAE,MAAM,oCAAoC,CAAC;AAC9E,OAAO,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AACpE,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAC7E,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,iBAAiB,EAAE,yBAAyB,EAAE,MAAM,0CAA0C,CAAC;AACxG,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAChE,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,0BAA0B,EAAE,MAAM,yCAAyC,CAAC;AACrF,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC"}
@@ -1,18 +1,48 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TrialQueueService = exports.AuthService = exports.REGISTRATION_HOOK = exports.authMeta = exports.AuthController = exports.AuthCompanyController = exports.AuthModule = void 0;
3
+ exports.TrialQueueService = exports.PendingRegistrationService = exports.AuthService = exports.AuthGoogleService = exports.AuthRepository = exports.REGISTRATION_HOOK = exports.pendingAuthMeta = exports.PendingAuthDescriptor = exports.authMeta = exports.authCodeMeta = exports.AuthCodeDescriptor = exports.AuthDescriptor = exports.AuthPostResetPasswordDTO = exports.AuthPostRegisterDTO = exports.AuthPostRegisterDataDTO = exports.AuthPostRegisterAttributesDTO = exports.AuthPostLoginDTO = exports.AuthPostLoginDataDTO = exports.AuthPostLoginAttributesDTO = exports.AuthPostForgotDTO = exports.AuthGoogleController = exports.AuthController = exports.AuthCompanyController = exports.AuthModule = void 0;
4
4
  var auth_module_1 = require("./auth.module");
5
5
  Object.defineProperty(exports, "AuthModule", { enumerable: true, get: function () { return auth_module_1.AuthModule; } });
6
6
  var auth_company_controller_1 = require("./controllers/auth.company.controller");
7
7
  Object.defineProperty(exports, "AuthCompanyController", { enumerable: true, get: function () { return auth_company_controller_1.AuthCompanyController; } });
8
8
  var auth_controller_1 = require("./controllers/auth.controller");
9
9
  Object.defineProperty(exports, "AuthController", { enumerable: true, get: function () { return auth_controller_1.AuthController; } });
10
+ var auth_google_controller_1 = require("./controllers/auth.google.controller");
11
+ Object.defineProperty(exports, "AuthGoogleController", { enumerable: true, get: function () { return auth_google_controller_1.AuthGoogleController; } });
12
+ var auth_post_forgot_dto_1 = require("./dtos/auth.post.forgot.dto");
13
+ Object.defineProperty(exports, "AuthPostForgotDTO", { enumerable: true, get: function () { return auth_post_forgot_dto_1.AuthPostForgotDTO; } });
14
+ var auth_post_login_dto_1 = require("./dtos/auth.post.login.dto");
15
+ Object.defineProperty(exports, "AuthPostLoginAttributesDTO", { enumerable: true, get: function () { return auth_post_login_dto_1.AuthPostLoginAttributesDTO; } });
16
+ Object.defineProperty(exports, "AuthPostLoginDataDTO", { enumerable: true, get: function () { return auth_post_login_dto_1.AuthPostLoginDataDTO; } });
17
+ Object.defineProperty(exports, "AuthPostLoginDTO", { enumerable: true, get: function () { return auth_post_login_dto_1.AuthPostLoginDTO; } });
18
+ var auth_post_register_dto_1 = require("./dtos/auth.post.register.dto");
19
+ Object.defineProperty(exports, "AuthPostRegisterAttributesDTO", { enumerable: true, get: function () { return auth_post_register_dto_1.AuthPostRegisterAttributesDTO; } });
20
+ Object.defineProperty(exports, "AuthPostRegisterDataDTO", { enumerable: true, get: function () { return auth_post_register_dto_1.AuthPostRegisterDataDTO; } });
21
+ Object.defineProperty(exports, "AuthPostRegisterDTO", { enumerable: true, get: function () { return auth_post_register_dto_1.AuthPostRegisterDTO; } });
22
+ var auth_post_resetpassword_dto_1 = require("./dtos/auth.post.resetpassword.dto");
23
+ Object.defineProperty(exports, "AuthPostResetPasswordDTO", { enumerable: true, get: function () { return auth_post_resetpassword_dto_1.AuthPostResetPasswordDTO; } });
24
+ var auth_1 = require("./entities/auth");
25
+ Object.defineProperty(exports, "AuthDescriptor", { enumerable: true, get: function () { return auth_1.AuthDescriptor; } });
26
+ var auth_code_1 = require("./entities/auth.code");
27
+ Object.defineProperty(exports, "AuthCodeDescriptor", { enumerable: true, get: function () { return auth_code_1.AuthCodeDescriptor; } });
28
+ var auth_code_meta_1 = require("./entities/auth.code.meta");
29
+ Object.defineProperty(exports, "authCodeMeta", { enumerable: true, get: function () { return auth_code_meta_1.authCodeMeta; } });
10
30
  var auth_meta_1 = require("./entities/auth.meta");
11
31
  Object.defineProperty(exports, "authMeta", { enumerable: true, get: function () { return auth_meta_1.authMeta; } });
32
+ var pending_auth_1 = require("./entities/pending-auth");
33
+ Object.defineProperty(exports, "PendingAuthDescriptor", { enumerable: true, get: function () { return pending_auth_1.PendingAuthDescriptor; } });
34
+ var pending_auth_meta_1 = require("./entities/pending-auth.meta");
35
+ Object.defineProperty(exports, "pendingAuthMeta", { enumerable: true, get: function () { return pending_auth_meta_1.pendingAuthMeta; } });
12
36
  var registration_hook_interface_1 = require("./interfaces/registration-hook.interface");
13
37
  Object.defineProperty(exports, "REGISTRATION_HOOK", { enumerable: true, get: function () { return registration_hook_interface_1.REGISTRATION_HOOK; } });
38
+ var auth_repository_1 = require("./repositories/auth.repository");
39
+ Object.defineProperty(exports, "AuthRepository", { enumerable: true, get: function () { return auth_repository_1.AuthRepository; } });
40
+ var auth_google_service_1 = require("./services/auth.google.service");
41
+ Object.defineProperty(exports, "AuthGoogleService", { enumerable: true, get: function () { return auth_google_service_1.AuthGoogleService; } });
14
42
  var auth_service_1 = require("./services/auth.service");
15
43
  Object.defineProperty(exports, "AuthService", { enumerable: true, get: function () { return auth_service_1.AuthService; } });
44
+ var pending_registration_service_1 = require("./services/pending-registration.service");
45
+ Object.defineProperty(exports, "PendingRegistrationService", { enumerable: true, get: function () { return pending_registration_service_1.PendingRegistrationService; } });
16
46
  var trial_queue_service_1 = require("./services/trial-queue.service");
17
47
  Object.defineProperty(exports, "TrialQueueService", { enumerable: true, get: function () { return trial_queue_service_1.TrialQueueService; } });
18
48
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/foundations/auth/index.ts"],"names":[],"mappings":";;;AAAA,6CAA2C;AAAlC,yGAAA,UAAU,OAAA;AACnB,iFAA8E;AAArE,gIAAA,qBAAqB,OAAA;AAC9B,iEAA+D;AAAtD,iHAAA,cAAc,OAAA;AACvB,kDAAgD;AAAvC,qGAAA,QAAQ,OAAA;AACjB,wFAAwG;AAA/F,gIAAA,iBAAiB,OAAA;AAC1B,wDAAsD;AAA7C,2GAAA,WAAW,OAAA;AACpB,sEAAmE;AAA1D,wHAAA,iBAAiB,OAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/foundations/auth/index.ts"],"names":[],"mappings":";;;AAAA,6CAA2C;AAAlC,yGAAA,UAAU,OAAA;AACnB,iFAA8E;AAArE,gIAAA,qBAAqB,OAAA;AAC9B,iEAA+D;AAAtD,iHAAA,cAAc,OAAA;AACvB,+EAA4E;AAAnE,8HAAA,oBAAoB,OAAA;AAC7B,oEAAgE;AAAvD,yHAAA,iBAAiB,OAAA;AAC1B,kEAAgH;AAAvG,iIAAA,0BAA0B,OAAA;AAAE,2HAAA,oBAAoB,OAAA;AAAE,uHAAA,gBAAgB,OAAA;AAC3E,wEAIuC;AAHrC,uIAAA,6BAA6B,OAAA;AAC7B,iIAAA,uBAAuB,OAAA;AACvB,6HAAA,mBAAmB,OAAA;AAErB,kFAA8E;AAArE,uIAAA,wBAAwB,OAAA;AACjC,wCAAuD;AAAxC,sGAAA,cAAc,OAAA;AAC7B,kDAAoE;AAAjD,+GAAA,kBAAkB,OAAA;AACrC,4DAAyD;AAAhD,8GAAA,YAAY,OAAA;AACrB,kDAAgD;AAAvC,qGAAA,QAAQ,OAAA;AACjB,wDAA6E;AAAvD,qHAAA,qBAAqB,OAAA;AAC3C,kEAA+D;AAAtD,oHAAA,eAAe,OAAA;AACxB,wFAAwG;AAA/F,gIAAA,iBAAiB,OAAA;AAC1B,kEAAgE;AAAvD,iHAAA,cAAc,OAAA;AACvB,sEAAmE;AAA1D,wHAAA,iBAAiB,OAAA;AAC1B,wDAAsD;AAA7C,2GAAA,WAAW,OAAA;AACpB,wFAAqF;AAA5E,0IAAA,0BAA0B,OAAA;AACnC,sEAAmE;AAA1D,wHAAA,iBAAiB,OAAA"}
@@ -1,14 +1,54 @@
1
- import { OnModuleInit } from "@nestjs/common";
1
+ import { ClsService } from "nestjs-cls";
2
+ import { AbstractRepository } from "../../../core/neo4j/abstracts/abstract.repository";
2
3
  import { Neo4jService } from "../../../core/neo4j/services/neo4j.service";
3
4
  import { SecurityService } from "../../../core/security/services/security.service";
4
- import { AuthCode } from "../../auth/entities/auth.code.entity";
5
- import { Auth } from "../../auth/entities/auth.entity";
6
5
  import { Company } from "../../company";
7
6
  import { User } from "../../user/entities/user";
8
- export declare class AuthRepository implements OnModuleInit {
9
- private readonly neo4j;
10
- private readonly security;
11
- constructor(neo4j: Neo4jService, security: SecurityService);
7
+ import { AuthCode } from "../entities/auth.code";
8
+ import { Auth, AuthDescriptor } from "../entities/auth";
9
+ /**
10
+ * Auth is deliberately NOT company-scoped (see entities/auth.ts) and every
11
+ * method here is bespoke — JWT signing lives in AuthService, and reads
12
+ * enrich the user with role/company/feature/module permissions via a
13
+ * hand-written Cypher CASE cascade that doesn't map onto the generic
14
+ * descriptor CRUD (create/put/patch/find/findById). None of
15
+ * AbstractRepository's inherited generic methods are used; extending it
16
+ * here is for descriptor typing consistency only.
17
+ *
18
+ * Two methods collide by name with AbstractRepository's generic surface but
19
+ * have incompatible signatures/return types (this repo's `findById` takes
20
+ * `{ authId }` and does permission-enrichment; its `create` takes
21
+ * `{ authId, userId, token, expiration }` and returns the created Auth) —
22
+ * both were renamed (`findAuthById`, `createSession`) to resolve the
23
+ * TS2416 override collision. AuthRepository has no external callers other
24
+ * than AuthService, so these are internal-only renames.
25
+ */
26
+ export declare class AuthRepository extends AbstractRepository<Auth, typeof AuthDescriptor.relationships> {
27
+ protected readonly descriptor: import("../../..").EntityDescriptor<Auth, {
28
+ user: {
29
+ model: import("../../../common/interfaces/datamodel.interface").DataMeta;
30
+ direction: "in";
31
+ relationship: string;
32
+ cardinality: "one";
33
+ description: string;
34
+ };
35
+ }>;
36
+ constructor(neo4j: Neo4jService, securityService: SecurityService, clsService: ClsService);
37
+ /**
38
+ * Models are resolved from the registry rather than referenced statically so
39
+ * that an application which registers an extended model (extra
40
+ * childrenTokens, extra relationships) is served ITS model here — mirrors
41
+ * ContentRepository.getContentModel().
42
+ */
43
+ private getAuthModel;
44
+ private getAuthCodeModel;
45
+ private getUserModel;
46
+ /**
47
+ * Bespoke constraint set: the inherited AbstractRepository.onModuleInit would
48
+ * also derive a FULLTEXT index over the descriptor's string fields — which
49
+ * here are the live session token and the company-selection token. Neither
50
+ * has any business being searchable text.
51
+ */
12
52
  onModuleInit(): Promise<void>;
13
53
  setLastLogin(params: {
14
54
  userId: string;
@@ -16,7 +56,7 @@ export declare class AuthRepository implements OnModuleInit {
16
56
  findByCode(params: {
17
57
  code: string;
18
58
  }): Promise<AuthCode>;
19
- findById(params: {
59
+ findAuthById(params: {
20
60
  authId: string;
21
61
  }): Promise<Auth>;
22
62
  deleteByCode(params: {
@@ -69,7 +109,7 @@ export declare class AuthRepository implements OnModuleInit {
69
109
  * user who belongs to more than one company would get a session whose company
70
110
  * and roles disagree.
71
111
  */
72
- create(params: {
112
+ createSession(params: {
73
113
  authId: string;
74
114
  userId: string;
75
115
  token: string;
@@ -1 +1 @@
1
- {"version":3,"file":"auth.repository.d.ts","sourceRoot":"","sources":["../../../../src/foundations/auth/repositories/auth.repository.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,YAAY,EAAE,MAAM,gBAA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@nestjs/common");
14
14
  const crypto_1 = require("crypto");
15
+ const nestjs_cls_1 = require("nestjs-cls");
15
16
  const system_roles_1 = require("../../../common/constants/system.roles");
17
+ const registry_1 = require("../../../common/registries/registry");
18
+ const abstract_repository_1 = require("../../../core/neo4j/abstracts/abstract.repository");
16
19
  const neo4j_service_1 = require("../../../core/neo4j/services/neo4j.service");
17
20
  const security_service_1 = require("../../../core/security/services/security.service");
18
- const auth_code_model_1 = require("../../auth/entities/auth.code.model");
19
- const auth_model_1 = require("../../auth/entities/auth.model");
20
21
  const company_1 = require("../../company");
21
22
  const feature_meta_1 = require("../../feature/entities/feature.meta");
22
23
  const membership_query_1 = require("../../membership/queries/membership.query");
23
24
  const module_model_1 = require("../../module/entities/module.model");
24
25
  const feature_module_query_1 = require("../../module/queries/feature.module.query");
25
26
  const user_1 = require("../../user");
26
- const user_2 = require("../../user/entities/user");
27
- let AuthRepository = class AuthRepository {
28
- constructor(neo4j, security) {
29
- this.neo4j = neo4j;
30
- this.security = security;
27
+ const auth_code_meta_1 = require("../entities/auth.code.meta");
28
+ const auth_1 = require("../entities/auth");
29
+ const auth_meta_1 = require("../entities/auth.meta");
30
+ /**
31
+ * Auth is deliberately NOT company-scoped (see entities/auth.ts) and every
32
+ * method here is bespoke — JWT signing lives in AuthService, and reads
33
+ * enrich the user with role/company/feature/module permissions via a
34
+ * hand-written Cypher CASE cascade that doesn't map onto the generic
35
+ * descriptor CRUD (create/put/patch/find/findById). None of
36
+ * AbstractRepository's inherited generic methods are used; extending it
37
+ * here is for descriptor typing consistency only.
38
+ *
39
+ * Two methods collide by name with AbstractRepository's generic surface but
40
+ * have incompatible signatures/return types (this repo's `findById` takes
41
+ * `{ authId }` and does permission-enrichment; its `create` takes
42
+ * `{ authId, userId, token, expiration }` and returns the created Auth) —
43
+ * both were renamed (`findAuthById`, `createSession`) to resolve the
44
+ * TS2416 override collision. AuthRepository has no external callers other
45
+ * than AuthService, so these are internal-only renames.
46
+ */
47
+ let AuthRepository = class AuthRepository extends abstract_repository_1.AbstractRepository {
48
+ constructor(neo4j, securityService, clsService) {
49
+ super(neo4j, securityService, clsService);
50
+ this.descriptor = auth_1.AuthDescriptor;
31
51
  }
52
+ /**
53
+ * Models are resolved from the registry rather than referenced statically so
54
+ * that an application which registers an extended model (extra
55
+ * childrenTokens, extra relationships) is served ITS model here — mirrors
56
+ * ContentRepository.getContentModel().
57
+ */
58
+ getAuthModel() {
59
+ const model = registry_1.modelRegistry.get(auth_meta_1.authMeta.nodeName);
60
+ if (!model) {
61
+ throw new Error(`AuthModel not found in registry for nodeName: ${auth_meta_1.authMeta.nodeName}`);
62
+ }
63
+ return model;
64
+ }
65
+ getAuthCodeModel() {
66
+ const model = registry_1.modelRegistry.get(auth_code_meta_1.authCodeMeta.nodeName);
67
+ if (!model) {
68
+ throw new Error(`AuthCodeModel not found in registry for nodeName: ${auth_code_meta_1.authCodeMeta.nodeName}`);
69
+ }
70
+ return model;
71
+ }
72
+ getUserModel() {
73
+ const model = registry_1.modelRegistry.get(user_1.userMeta.nodeName);
74
+ if (!model) {
75
+ throw new Error(`UserModel not found in registry for nodeName: ${user_1.userMeta.nodeName}`);
76
+ }
77
+ return model;
78
+ }
79
+ /**
80
+ * Bespoke constraint set: the inherited AbstractRepository.onModuleInit would
81
+ * also derive a FULLTEXT index over the descriptor's string fields — which
82
+ * here are the live session token and the company-selection token. Neither
83
+ * has any business being searchable text.
84
+ */
32
85
  async onModuleInit() {
33
86
  await this.neo4j.writeOne({
34
87
  query: `CREATE CONSTRAINT authcode_id IF NOT EXISTS FOR (authcode:AuthCode) REQUIRE authcode.id IS UNIQUE`,
@@ -48,7 +101,7 @@ let AuthRepository = class AuthRepository {
48
101
  await this.neo4j.writeOne(query);
49
102
  }
50
103
  async findByCode(params) {
51
- const query = this.neo4j.initQuery({ serialiser: auth_code_model_1.AuthCodeModel });
104
+ const query = this.neo4j.initQuery({ serialiser: this.getAuthCodeModel() });
52
105
  query.queryParams = {
53
106
  authCodeId: params.code,
54
107
  };
@@ -58,8 +111,8 @@ let AuthRepository = class AuthRepository {
58
111
  `;
59
112
  return this.neo4j.readOne(query);
60
113
  }
61
- async findById(params) {
62
- let query = this.neo4j.initQuery({ serialiser: auth_model_1.AuthModel });
114
+ async findAuthById(params) {
115
+ let query = this.neo4j.initQuery({ serialiser: this.getAuthModel() });
63
116
  query.queryParams = {
64
117
  ...query.queryParams,
65
118
  authId: params.authId,
@@ -134,9 +187,9 @@ let AuthRepository = class AuthRepository {
134
187
  query.query = `
135
188
  MATCH (auth:Auth {id: $authId})
136
189
  CREATE (authcode:AuthCode {
137
- id: $authCodeId,
138
- expiration: datetime($expiration),
139
- createdAt: datetime(),
190
+ id: $authCodeId,
191
+ expiration: datetime($expiration),
192
+ createdAt: datetime(),
140
193
  updatedAt: datetime()
141
194
  })
142
195
  WITH auth, authcode
@@ -145,22 +198,22 @@ let AuthRepository = class AuthRepository {
145
198
  await this.neo4j.writeOne(query);
146
199
  }
147
200
  async refreshToken(params) {
148
- const query = this.neo4j.initQuery({ serialiser: auth_model_1.AuthModel });
201
+ const query = this.neo4j.initQuery({ serialiser: this.getAuthModel() });
149
202
  query.queryParams = {
150
203
  authId: params.authId,
151
204
  token: params.token,
152
- expiration: this.security.refreshTokenExpiration.toISOString(),
205
+ expiration: this.securityService.refreshTokenExpiration.toISOString(),
153
206
  };
154
207
  query.query = `
155
- MATCH (auth:Auth {id: $authId})
156
- SET auth.token = $token,
208
+ MATCH (auth:Auth {id: $authId})
209
+ SET auth.token = $token,
157
210
  auth.expiration = datetime($expiration)
158
211
  RETURN auth
159
212
  `;
160
213
  return this.neo4j.writeOne(query);
161
214
  }
162
215
  async findByRefreshToken(params) {
163
- const query = this.neo4j.initQuery({ serialiser: auth_model_1.AuthModel });
216
+ const query = this.neo4j.initQuery({ serialiser: this.getAuthModel() });
164
217
  query.queryParams = {
165
218
  authId: params.authId,
166
219
  };
@@ -171,7 +224,7 @@ let AuthRepository = class AuthRepository {
171
224
  return this.neo4j.readOne(query);
172
225
  }
173
226
  async findValidToken(params) {
174
- const query = this.neo4j.initQuery({ serialiser: auth_model_1.AuthModel });
227
+ const query = this.neo4j.initQuery({ serialiser: this.getAuthModel() });
175
228
  query.queryParams = {
176
229
  userId: params.userId,
177
230
  expiration: {
@@ -179,7 +232,7 @@ let AuthRepository = class AuthRepository {
179
232
  },
180
233
  };
181
234
  query.query = `
182
- MATCH (auth:Auth {userId: $userId, expiration: $expiration})
235
+ MATCH (auth:Auth {userId: $userId, expiration: $expiration})
183
236
  RETURN auth
184
237
  `;
185
238
  return this.neo4j.readOne(query);
@@ -193,7 +246,7 @@ let AuthRepository = class AuthRepository {
193
246
  * the CLS value injected by `initQuery()` — identical to the previous behaviour.
194
247
  */
195
248
  async findUserById(params) {
196
- const query = this.neo4j.initQuery({ serialiser: user_2.UserDescriptor.model });
249
+ const query = this.neo4j.initQuery({ serialiser: this.getUserModel() });
197
250
  query.queryParams = {
198
251
  ...query.queryParams,
199
252
  userId: params.userId,
@@ -205,7 +258,7 @@ let AuthRepository = class AuthRepository {
205
258
  ${(0, membership_query_1.membershipRoleMatch)({ userAlias: "user", roleAlias: "user_role" })}
206
259
  OPTIONAL MATCH (user)-[:BELONGS_TO]->(user_company:Company${params.companyId ? ` {id: $companyId}` : ``})
207
260
  MATCH (${user_1.userMeta.nodeName}_${company_1.companyMeta.nodeName}_${feature_meta_1.featureMeta.nodeName}:${feature_meta_1.featureMeta.labelName})
208
- WHERE ${user_1.userMeta.nodeName}_${company_1.companyMeta.nodeName}_${feature_meta_1.featureMeta.nodeName}.isCore = true
261
+ WHERE ${user_1.userMeta.nodeName}_${company_1.companyMeta.nodeName}_${feature_meta_1.featureMeta.nodeName}.isCore = true
209
262
  OR EXISTS {((${user_1.userMeta.nodeName}_${company_1.companyMeta.nodeName})-[:HAS_FEATURE]->(${user_1.userMeta.nodeName}_${company_1.companyMeta.nodeName}_${feature_meta_1.featureMeta.nodeName}))}
210
263
 
211
264
  RETURN user, user_role, user_company, ${user_1.userMeta.nodeName}_${company_1.companyMeta.nodeName}_${feature_meta_1.featureMeta.nodeName}
@@ -254,9 +307,9 @@ let AuthRepository = class AuthRepository {
254
307
  * user who belongs to more than one company would get a session whose company
255
308
  * and roles disagree.
256
309
  */
257
- async create(params) {
310
+ async createSession(params) {
258
311
  const user = await this.findUserById({ userId: params.userId, companyId: params.companyId });
259
- let query = this.neo4j.initQuery({ serialiser: auth_model_1.AuthModel });
312
+ let query = this.neo4j.initQuery({ serialiser: this.getAuthModel() });
260
313
  query.queryParams = {
261
314
  ...query.queryParams,
262
315
  authId: params.authId,
@@ -276,7 +329,7 @@ let AuthRepository = class AuthRepository {
276
329
  if (user.role?.some((role) => role.id === system_roles_1.RoleId.Administrator) && !user.company) {
277
330
  query.query = `
278
331
  MATCH (auth_user:User {id: $userId})
279
- CREATE (auth:Auth {id: $authId, token: $token, expiration: $expiration, createdAt: datetime(), updatedAt: datetime()})
332
+ CREATE (auth:Auth {id: $authId, token: $token, expiration: datetime($expiration), createdAt: datetime(), updatedAt: datetime()})
280
333
  CREATE (auth_user)-[:HAS_AUTH]->(auth)
281
334
 
282
335
  WITH auth, auth_user
@@ -286,22 +339,22 @@ let AuthRepository = class AuthRepository {
286
339
 
287
340
  WITH auth, auth_user, auth_user_role, module, apoc.convert.fromJsonList(module.permissions) AS modPerms
288
341
 
289
- WITH auth, auth_user, auth_user_role, module,
290
- CASE
291
- WHEN head([p IN modPerms WHERE p.type = "create"]) IS NULL THEN false
292
- ELSE head([p IN modPerms WHERE p.type = "create"]).value
342
+ WITH auth, auth_user, auth_user_role, module,
343
+ CASE
344
+ WHEN head([p IN modPerms WHERE p.type = "create"]) IS NULL THEN false
345
+ ELSE head([p IN modPerms WHERE p.type = "create"]).value
293
346
  END AS defaultCreate,
294
- CASE
295
- WHEN head([p IN modPerms WHERE p.type = "read"]) IS NULL THEN false
296
- ELSE head([p IN modPerms WHERE p.type = "read"]).value
347
+ CASE
348
+ WHEN head([p IN modPerms WHERE p.type = "read"]) IS NULL THEN false
349
+ ELSE head([p IN modPerms WHERE p.type = "read"]).value
297
350
  END AS defaultRead,
298
- CASE
299
- WHEN head([p IN modPerms WHERE p.type = "update"]) IS NULL THEN false
300
- ELSE head([p IN modPerms WHERE p.type = "update"]).value
351
+ CASE
352
+ WHEN head([p IN modPerms WHERE p.type = "update"]) IS NULL THEN false
353
+ ELSE head([p IN modPerms WHERE p.type = "update"]).value
301
354
  END AS defaultUpdate,
302
- CASE
303
- WHEN head([p IN modPerms WHERE p.type = "delete"]) IS NULL THEN false
304
- ELSE head([p IN modPerms WHERE p.type = "delete"]).value
355
+ CASE
356
+ WHEN head([p IN modPerms WHERE p.type = "delete"]) IS NULL THEN false
357
+ ELSE head([p IN modPerms WHERE p.type = "delete"]).value
305
358
  END AS defaultDelete
306
359
 
307
360
  OPTIONAL MATCH (auth_user_role)-[perm:HAS_PERMISSIONS]->(module)
@@ -317,19 +370,19 @@ WITH auth, auth_user, auth_user_role, module,
317
370
  [defaultDelete] + [r IN rolePermsParsed WHERE r.type="delete" | r.value] AS deleteValues
318
371
 
319
372
  WITH auth, auth_user, auth_user_role, module,
320
- CASE
373
+ CASE
321
374
  WHEN any(x IN createValues WHERE x = true) THEN true
322
375
  WHEN any(x IN createValues WHERE x <> true AND x <> false) THEN head([x IN createValues WHERE x <> true AND x <> false])
323
376
  WHEN any(x IN createValues WHERE x = false) THEN false ELSE false END AS effectiveCreate,
324
- CASE
377
+ CASE
325
378
  WHEN any(x IN readValues WHERE x = true) THEN true
326
379
  WHEN any(x IN readValues WHERE x <> true AND x <> false) THEN head([x IN readValues WHERE x <> true AND x <> false])
327
380
  WHEN any(x IN readValues WHERE x = false) THEN false ELSE false END AS effectiveRead,
328
- CASE
381
+ CASE
329
382
  WHEN any(x IN updateValues WHERE x = true) THEN true
330
383
  WHEN any(x IN updateValues WHERE x <> true AND x <> false) THEN head([x IN updateValues WHERE x <> true AND x <> false])
331
384
  WHEN any(x IN updateValues WHERE x = false) THEN false ELSE false END AS effectiveUpdate,
332
- CASE
385
+ CASE
333
386
  WHEN any(x IN deleteValues WHERE x = true) THEN true
334
387
  WHEN any(x IN deleteValues WHERE x <> true AND x <> false) THEN head([x IN deleteValues WHERE x <> true AND x <> false])
335
388
  WHEN any(x IN deleteValues WHERE x = false) THEN false ELSE false END AS effectiveDelete
@@ -354,7 +407,7 @@ WITH auth, auth_user, auth_user_role, module,
354
407
  }
355
408
  query.query = `
356
409
  MATCH (auth_user:User {id: $userId})
357
- CREATE (auth:Auth {id: $authId, token: $token, expiration: $expiration, createdAt: datetime(), updatedAt: datetime()})
410
+ CREATE (auth:Auth {id: $authId, token: $token, expiration: datetime($expiration), createdAt: datetime(), updatedAt: datetime()})
358
411
  CREATE (auth_user)-[:HAS_AUTH]->(auth)
359
412
 
360
413
  WITH auth, auth_user
@@ -362,9 +415,9 @@ WITH auth, auth_user, auth_user_role, module,
362
415
  OPTIONAL MATCH (auth_user)-[:BELONGS_TO]->(auth_user_company:Company)
363
416
 
364
417
  MATCH (auth_${user_1.userMeta.nodeName}_${company_1.companyMeta.nodeName}_${feature_meta_1.featureMeta.nodeName}:${feature_meta_1.featureMeta.labelName})
365
- WHERE auth_${user_1.userMeta.nodeName}_${company_1.companyMeta.nodeName}_${feature_meta_1.featureMeta.nodeName}.isCore = true
418
+ WHERE auth_${user_1.userMeta.nodeName}_${company_1.companyMeta.nodeName}_${feature_meta_1.featureMeta.nodeName}.isCore = true
366
419
  OR EXISTS {((auth_${user_1.userMeta.nodeName}_${company_1.companyMeta.nodeName})-[:HAS_FEATURE]->(auth_${user_1.userMeta.nodeName}_${company_1.companyMeta.nodeName}_${feature_meta_1.featureMeta.nodeName}))}
367
-
420
+
368
421
  OPTIONAL MATCH (auth_user_company)-[:HAS_CONFIGURATION]->(auth_user_company_configuration:Configuration)
369
422
  RETURN auth, auth_user, auth_user_role, auth_user_company, auth_user_company_feature, auth_user_company_configuration
370
423
  `;
@@ -383,7 +436,7 @@ WITH auth, auth_user, auth_user_role, module,
383
436
  return auth;
384
437
  }
385
438
  async findByToken(params) {
386
- let query = this.neo4j.initQuery({ serialiser: auth_model_1.AuthModel });
439
+ let query = this.neo4j.initQuery({ serialiser: this.getAuthModel() });
387
440
  query.queryParams = {
388
441
  ...query.queryParams,
389
442
  token: params.token,
@@ -424,15 +477,15 @@ WITH auth, auth_user, auth_user_role, module,
424
477
  await this.neo4j.writeOne(query);
425
478
  }
426
479
  async startResetPassword(params) {
427
- const query = this.neo4j.initQuery({ serialiser: user_2.UserDescriptor.model });
480
+ const query = this.neo4j.initQuery({ serialiser: this.getUserModel() });
428
481
  query.queryParams = {
429
482
  userId: params.userId,
430
483
  code: (0, crypto_1.randomUUID)(),
431
484
  codeExpiration: new Date(Date.now() + 3600000).toISOString(),
432
485
  };
433
486
  query.query = `
434
- MATCH (user:User {id: $userId})
435
- SET user.code = $code,
487
+ MATCH (user:User {id: $userId})
488
+ SET user.code = $code,
436
489
  user.codeExpiration = datetime($codeExpiration)
437
490
  RETURN user
438
491
  `;
@@ -445,9 +498,9 @@ WITH auth, auth_user, auth_user_role, module,
445
498
  password: params.password,
446
499
  };
447
500
  query.query = `
448
- MATCH (user:User {id: $userId})
449
- SET user.password = $password,
450
- user.code = null,
501
+ MATCH (user:User {id: $userId})
502
+ SET user.password = $password,
503
+ user.code = null,
451
504
  user.codeExpiration = null
452
505
  RETURN user
453
506
  `;
@@ -460,12 +513,12 @@ WITH auth, auth_user, auth_user_role, module,
460
513
  password: params.password,
461
514
  };
462
515
  query.query = `
463
- MATCH (user:User {id: $userId})
464
- SET user.password = $password,
516
+ MATCH (user:User {id: $userId})
517
+ SET user.password = $password,
465
518
  user.isActive = true,
466
519
  user.isDeleted = false,
467
- user.code = null,
468
- user.codeExpiration = null
520
+ user.code = null,
521
+ user.codeExpiration = null
469
522
  `;
470
523
  await this.neo4j.writeOne(query);
471
524
  }
@@ -475,10 +528,10 @@ WITH auth, auth_user, auth_user_role, module,
475
528
  userId: params.userId,
476
529
  };
477
530
  query.query = `
478
- MATCH (user:User {id: $userId})
479
- SET user.isActive = true,
480
- user.code = null,
481
- user.codeExpiration = null
531
+ MATCH (user:User {id: $userId})
532
+ SET user.isActive = true,
533
+ user.code = null,
534
+ user.codeExpiration = null
482
535
  `;
483
536
  await this.neo4j.writeOne(query);
484
537
  }
@@ -490,7 +543,7 @@ WITH auth, auth_user, auth_user_role, module,
490
543
  query.query = `
491
544
  MATCH (user:User {id: $userId})
492
545
  MATCH (user)-[:HAS_AUTH]->(auth:Auth)
493
- WHERE auth.expiration < datetime()
546
+ WHERE auth.expiration < datetime()
494
547
  DETACH DELETE auth
495
548
  `;
496
549
  await this.neo4j.writeOne(query);
@@ -499,7 +552,6 @@ WITH auth, auth_user, auth_user_role, module,
499
552
  exports.AuthRepository = AuthRepository;
500
553
  exports.AuthRepository = AuthRepository = __decorate([
501
554
  (0, common_1.Injectable)(),
502
- __metadata("design:paramtypes", [neo4j_service_1.Neo4jService,
503
- security_service_1.SecurityService])
555
+ __metadata("design:paramtypes", [neo4j_service_1.Neo4jService, security_service_1.SecurityService, nestjs_cls_1.ClsService])
504
556
  ], AuthRepository);
505
557
  //# sourceMappingURL=auth.repository.js.map