@colveor/core 1.1.0 → 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (740) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/README.md +6 -0
  3. package/dist/bootstrap/bootstrap-colveor-app.d.ts.map +1 -1
  4. package/dist/bootstrap/bootstrap-colveor-app.js +22 -3
  5. package/dist/bootstrap/bootstrap-colveor-app.js.map +1 -1
  6. package/dist/common/decorators/index.d.ts +6 -0
  7. package/dist/common/decorators/index.d.ts.map +1 -1
  8. package/dist/common/decorators/index.js +8 -1
  9. package/dist/common/decorators/index.js.map +1 -1
  10. package/dist/common/decorators/ip-rate-limit-bucket.decorator.d.ts +9 -0
  11. package/dist/common/decorators/ip-rate-limit-bucket.decorator.d.ts.map +1 -0
  12. package/dist/common/decorators/ip-rate-limit-bucket.decorator.js +12 -0
  13. package/dist/common/decorators/ip-rate-limit-bucket.decorator.js.map +1 -0
  14. package/dist/common/guards/login-ip-rate-limit.guard.d.ts +12 -6
  15. package/dist/common/guards/login-ip-rate-limit.guard.d.ts.map +1 -1
  16. package/dist/common/guards/login-ip-rate-limit.guard.js +65 -21
  17. package/dist/common/guards/login-ip-rate-limit.guard.js.map +1 -1
  18. package/dist/common/guards/otp-ip-rate-limit.guard.d.ts +3 -2
  19. package/dist/common/guards/otp-ip-rate-limit.guard.d.ts.map +1 -1
  20. package/dist/common/guards/otp-ip-rate-limit.guard.js +17 -15
  21. package/dist/common/guards/otp-ip-rate-limit.guard.js.map +1 -1
  22. package/dist/common/guards/permissions.guard.d.ts.map +1 -1
  23. package/dist/common/guards/permissions.guard.js +12 -2
  24. package/dist/common/guards/permissions.guard.js.map +1 -1
  25. package/dist/common/interceptors/timeout.interceptor.d.ts +1 -1
  26. package/dist/common/interceptors/timeout.interceptor.d.ts.map +1 -1
  27. package/dist/common/interceptors/timeout.interceptor.js +5 -1
  28. package/dist/common/interceptors/timeout.interceptor.js.map +1 -1
  29. package/dist/common/interfaces/request-user.d.ts +4 -3
  30. package/dist/common/interfaces/request-user.d.ts.map +1 -1
  31. package/dist/common/utils/cache-version.util.d.ts +12 -0
  32. package/dist/common/utils/cache-version.util.d.ts.map +1 -0
  33. package/dist/common/utils/cache-version.util.js +34 -0
  34. package/dist/common/utils/cache-version.util.js.map +1 -0
  35. package/dist/common/utils/postgres-error.util.d.ts +5 -0
  36. package/dist/common/utils/postgres-error.util.d.ts.map +1 -0
  37. package/dist/common/utils/postgres-error.util.js +13 -0
  38. package/dist/common/utils/postgres-error.util.js.map +1 -0
  39. package/dist/common/utils/singleflight.util.d.ts +6 -0
  40. package/dist/common/utils/singleflight.util.d.ts.map +1 -0
  41. package/dist/common/utils/singleflight.util.js +21 -0
  42. package/dist/common/utils/singleflight.util.js.map +1 -0
  43. package/dist/common/validators/is-exclusive-auth-params.validator.js +1 -1
  44. package/dist/common/validators/is-exclusive-auth-params.validator.js.map +1 -1
  45. package/dist/common/validators/is-exclusive-delete-confirm-params.validator.js +1 -1
  46. package/dist/common/validators/is-exclusive-delete-confirm-params.validator.js.map +1 -1
  47. package/dist/config/app.config.d.ts +38 -0
  48. package/dist/config/app.config.d.ts.map +1 -1
  49. package/dist/config/app.config.js +24 -0
  50. package/dist/config/app.config.js.map +1 -1
  51. package/dist/config/database.config.d.ts +6 -0
  52. package/dist/config/database.config.d.ts.map +1 -1
  53. package/dist/config/database.config.js +3 -0
  54. package/dist/config/database.config.js.map +1 -1
  55. package/dist/config/env-flags.util.d.ts +4 -0
  56. package/dist/config/env-flags.util.d.ts.map +1 -1
  57. package/dist/config/env-flags.util.js +7 -0
  58. package/dist/config/env-flags.util.js.map +1 -1
  59. package/dist/config/env.validation.d.ts +24 -1
  60. package/dist/config/env.validation.d.ts.map +1 -1
  61. package/dist/config/env.validation.js +92 -2
  62. package/dist/config/env.validation.js.map +1 -1
  63. package/dist/config/in-memory-redis.client.d.ts +23 -4
  64. package/dist/config/in-memory-redis.client.d.ts.map +1 -1
  65. package/dist/config/in-memory-redis.client.js +148 -4
  66. package/dist/config/in-memory-redis.client.js.map +1 -1
  67. package/dist/config/redis.module.d.ts.map +1 -1
  68. package/dist/config/redis.module.js +5 -0
  69. package/dist/config/redis.module.js.map +1 -1
  70. package/dist/core.module.d.ts +5 -0
  71. package/dist/core.module.d.ts.map +1 -1
  72. package/dist/core.module.js +5 -0
  73. package/dist/core.module.js.map +1 -1
  74. package/dist/database/migrations/1784284557959-full-schema.d.ts.map +1 -1
  75. package/dist/database/migrations/1784284557959-full-schema.js +48 -14
  76. package/dist/database/migrations/1784284557959-full-schema.js.map +1 -1
  77. package/dist/database/migrations/1784284557960-audit-partitioning.d.ts +17 -0
  78. package/dist/database/migrations/1784284557960-audit-partitioning.d.ts.map +1 -0
  79. package/dist/database/migrations/1784284557960-audit-partitioning.js +384 -0
  80. package/dist/database/migrations/1784284557960-audit-partitioning.js.map +1 -0
  81. package/dist/database/seeds/roles.seed.d.ts +6 -0
  82. package/dist/database/seeds/roles.seed.d.ts.map +1 -1
  83. package/dist/database/seeds/roles.seed.js +22 -5
  84. package/dist/database/seeds/roles.seed.js.map +1 -1
  85. package/dist/database/seeds/settings.seed.d.ts +5 -0
  86. package/dist/database/seeds/settings.seed.d.ts.map +1 -1
  87. package/dist/database/seeds/settings.seed.js +500 -25
  88. package/dist/database/seeds/settings.seed.js.map +1 -1
  89. package/dist/database/seeds/templates/html-template.reader.d.ts +1 -0
  90. package/dist/database/seeds/templates/html-template.reader.d.ts.map +1 -1
  91. package/dist/database/seeds/templates/html-template.reader.js +3 -1
  92. package/dist/database/seeds/templates/html-template.reader.js.map +1 -1
  93. package/dist/database/seeds/templates/html-template.reader.ts +5 -1
  94. package/dist/database/typeorm.util.d.ts.map +1 -1
  95. package/dist/database/typeorm.util.js +6 -0
  96. package/dist/database/typeorm.util.js.map +1 -1
  97. package/dist/index.d.ts +8 -1
  98. package/dist/index.d.ts.map +1 -1
  99. package/dist/index.js +39 -4
  100. package/dist/index.js.map +1 -1
  101. package/dist/modules/admin/controllers/admin.controller.d.ts +15 -7
  102. package/dist/modules/admin/controllers/admin.controller.d.ts.map +1 -1
  103. package/dist/modules/admin/controllers/admin.controller.js +74 -17
  104. package/dist/modules/admin/controllers/admin.controller.js.map +1 -1
  105. package/dist/modules/admin/services/admin-log.service.d.ts +14 -7
  106. package/dist/modules/admin/services/admin-log.service.d.ts.map +1 -1
  107. package/dist/modules/admin/services/admin-log.service.js +41 -38
  108. package/dist/modules/admin/services/admin-log.service.js.map +1 -1
  109. package/dist/modules/audit/audit.manifest.d.ts +8 -0
  110. package/dist/modules/audit/audit.manifest.d.ts.map +1 -0
  111. package/dist/modules/audit/audit.manifest.js +31 -0
  112. package/dist/modules/audit/audit.manifest.js.map +1 -0
  113. package/dist/modules/audit/audit.module.d.ts +8 -0
  114. package/dist/modules/audit/audit.module.d.ts.map +1 -0
  115. package/dist/modules/audit/audit.module.js +57 -0
  116. package/dist/modules/audit/audit.module.js.map +1 -0
  117. package/dist/modules/audit/constants/audit-actions.d.ts +79 -0
  118. package/dist/modules/audit/constants/audit-actions.d.ts.map +1 -0
  119. package/dist/modules/audit/constants/audit-actions.js +89 -0
  120. package/dist/modules/audit/constants/audit-actions.js.map +1 -0
  121. package/dist/modules/audit/constants/audit-mutation.d.ts +10 -0
  122. package/dist/modules/audit/constants/audit-mutation.d.ts.map +1 -0
  123. package/dist/modules/audit/constants/audit-mutation.js +13 -0
  124. package/dist/modules/audit/constants/audit-mutation.js.map +1 -0
  125. package/dist/modules/audit/controllers/audit.controller.d.ts +13 -0
  126. package/dist/modules/audit/controllers/audit.controller.d.ts.map +1 -0
  127. package/dist/modules/audit/controllers/audit.controller.js +149 -0
  128. package/dist/modules/audit/controllers/audit.controller.js.map +1 -0
  129. package/dist/modules/audit/decorators/audit.decorator.d.ts +27 -0
  130. package/dist/modules/audit/decorators/audit.decorator.d.ts.map +1 -0
  131. package/dist/modules/audit/decorators/audit.decorator.js +18 -0
  132. package/dist/modules/audit/decorators/audit.decorator.js.map +1 -0
  133. package/dist/modules/audit/dto/audit.dto.d.ts +54 -0
  134. package/dist/modules/audit/dto/audit.dto.d.ts.map +1 -0
  135. package/dist/modules/audit/dto/audit.dto.js +129 -0
  136. package/dist/modules/audit/dto/audit.dto.js.map +1 -0
  137. package/dist/modules/audit/entities/audit-event.entity.d.ts +33 -0
  138. package/dist/modules/audit/entities/audit-event.entity.d.ts.map +1 -0
  139. package/dist/modules/audit/entities/audit-event.entity.js +125 -0
  140. package/dist/modules/audit/entities/audit-event.entity.js.map +1 -0
  141. package/dist/modules/audit/entities/audit-outbox.entity.d.ts +16 -0
  142. package/dist/modules/audit/entities/audit-outbox.entity.d.ts.map +1 -0
  143. package/dist/modules/audit/entities/audit-outbox.entity.js +65 -0
  144. package/dist/modules/audit/entities/audit-outbox.entity.js.map +1 -0
  145. package/dist/modules/audit/index.d.ts +13 -0
  146. package/dist/modules/audit/index.d.ts.map +1 -0
  147. package/dist/modules/audit/index.js +23 -0
  148. package/dist/modules/audit/index.js.map +1 -0
  149. package/dist/modules/audit/interceptors/audit.interceptor.d.ts +11 -0
  150. package/dist/modules/audit/interceptors/audit.interceptor.d.ts.map +1 -0
  151. package/dist/modules/audit/interceptors/audit.interceptor.js +75 -0
  152. package/dist/modules/audit/interceptors/audit.interceptor.js.map +1 -0
  153. package/dist/modules/audit/listeners/auth-audit.listener.d.ts +31 -0
  154. package/dist/modules/audit/listeners/auth-audit.listener.d.ts.map +1 -0
  155. package/dist/modules/audit/listeners/auth-audit.listener.js +338 -0
  156. package/dist/modules/audit/listeners/auth-audit.listener.js.map +1 -0
  157. package/dist/modules/audit/services/audit-archive.service.d.ts +28 -0
  158. package/dist/modules/audit/services/audit-archive.service.d.ts.map +1 -0
  159. package/dist/modules/audit/services/audit-archive.service.js +132 -0
  160. package/dist/modules/audit/services/audit-archive.service.js.map +1 -0
  161. package/dist/modules/audit/services/audit-hash-backfill.service.d.ts +22 -0
  162. package/dist/modules/audit/services/audit-hash-backfill.service.d.ts.map +1 -0
  163. package/dist/modules/audit/services/audit-hash-backfill.service.js +79 -0
  164. package/dist/modules/audit/services/audit-hash-backfill.service.js.map +1 -0
  165. package/dist/modules/audit/services/audit-leader.service.d.ts +28 -0
  166. package/dist/modules/audit/services/audit-leader.service.d.ts.map +1 -0
  167. package/dist/modules/audit/services/audit-leader.service.js +99 -0
  168. package/dist/modules/audit/services/audit-leader.service.js.map +1 -0
  169. package/dist/modules/audit/services/audit-outbox.worker.d.ts +29 -0
  170. package/dist/modules/audit/services/audit-outbox.worker.d.ts.map +1 -0
  171. package/dist/modules/audit/services/audit-outbox.worker.js +144 -0
  172. package/dist/modules/audit/services/audit-outbox.worker.js.map +1 -0
  173. package/dist/modules/audit/services/audit-partition.service.d.ts +18 -0
  174. package/dist/modules/audit/services/audit-partition.service.d.ts.map +1 -0
  175. package/dist/modules/audit/services/audit-partition.service.js +70 -0
  176. package/dist/modules/audit/services/audit-partition.service.js.map +1 -0
  177. package/dist/modules/audit/services/audit-write.service.d.ts +60 -0
  178. package/dist/modules/audit/services/audit-write.service.d.ts.map +1 -0
  179. package/dist/modules/audit/services/audit-write.service.js +463 -0
  180. package/dist/modules/audit/services/audit-write.service.js.map +1 -0
  181. package/dist/modules/audit/services/audit.service.d.ts +60 -0
  182. package/dist/modules/audit/services/audit.service.d.ts.map +1 -0
  183. package/dist/modules/audit/services/audit.service.js +373 -0
  184. package/dist/modules/audit/services/audit.service.js.map +1 -0
  185. package/dist/modules/audit/utils/audit-hash.util.d.ts +20 -0
  186. package/dist/modules/audit/utils/audit-hash.util.d.ts.map +1 -0
  187. package/dist/modules/audit/utils/audit-hash.util.js +44 -0
  188. package/dist/modules/audit/utils/audit-hash.util.js.map +1 -0
  189. package/dist/modules/auth/auth-core/auth-core.module.d.ts.map +1 -1
  190. package/dist/modules/auth/auth-core/auth-core.module.js +16 -4
  191. package/dist/modules/auth/auth-core/auth-core.module.js.map +1 -1
  192. package/dist/modules/auth/auth-core/constants/jwt-redis.keys.d.ts +22 -0
  193. package/dist/modules/auth/auth-core/constants/jwt-redis.keys.d.ts.map +1 -0
  194. package/dist/modules/auth/auth-core/constants/jwt-redis.keys.js +25 -0
  195. package/dist/modules/auth/auth-core/constants/jwt-redis.keys.js.map +1 -0
  196. package/dist/modules/auth/auth-core/services/access-token.validator.d.ts +19 -0
  197. package/dist/modules/auth/auth-core/services/access-token.validator.d.ts.map +1 -0
  198. package/dist/modules/auth/auth-core/services/access-token.validator.js +110 -0
  199. package/dist/modules/auth/auth-core/services/access-token.validator.js.map +1 -0
  200. package/dist/modules/auth/auth-core/services/family-denylist.reader.d.ts +10 -0
  201. package/dist/modules/auth/auth-core/services/family-denylist.reader.d.ts.map +1 -0
  202. package/dist/modules/auth/auth-core/services/family-denylist.reader.js +44 -0
  203. package/dist/modules/auth/auth-core/services/family-denylist.reader.js.map +1 -0
  204. package/dist/modules/auth/auth-core/services/session-epoch.reader.d.ts +10 -0
  205. package/dist/modules/auth/auth-core/services/session-epoch.reader.d.ts.map +1 -0
  206. package/dist/modules/auth/auth-core/services/session-epoch.reader.js +44 -0
  207. package/dist/modules/auth/auth-core/services/session-epoch.reader.js.map +1 -0
  208. package/dist/modules/auth/auth-core/strategies/jwt.strategy.d.ts +7 -8
  209. package/dist/modules/auth/auth-core/strategies/jwt.strategy.d.ts.map +1 -1
  210. package/dist/modules/auth/auth-core/strategies/jwt.strategy.js +34 -34
  211. package/dist/modules/auth/auth-core/strategies/jwt.strategy.js.map +1 -1
  212. package/dist/modules/auth/auth.manifest.d.ts +6 -0
  213. package/dist/modules/auth/auth.manifest.d.ts.map +1 -1
  214. package/dist/modules/auth/auth.manifest.js +38 -2
  215. package/dist/modules/auth/auth.manifest.js.map +1 -1
  216. package/dist/modules/auth/auth.module.d.ts.map +1 -1
  217. package/dist/modules/auth/auth.module.js +39 -4
  218. package/dist/modules/auth/auth.module.js.map +1 -1
  219. package/dist/modules/auth/controllers/account.controller.d.ts +15 -1
  220. package/dist/modules/auth/controllers/account.controller.d.ts.map +1 -1
  221. package/dist/modules/auth/controllers/account.controller.js +65 -7
  222. package/dist/modules/auth/controllers/account.controller.js.map +1 -1
  223. package/dist/modules/auth/controllers/auth.controller.d.ts +7 -3
  224. package/dist/modules/auth/controllers/auth.controller.d.ts.map +1 -1
  225. package/dist/modules/auth/controllers/auth.controller.js +76 -16
  226. package/dist/modules/auth/controllers/auth.controller.js.map +1 -1
  227. package/dist/modules/auth/controllers/forgot-password.controller.d.ts +4 -2
  228. package/dist/modules/auth/controllers/forgot-password.controller.d.ts.map +1 -1
  229. package/dist/modules/auth/controllers/forgot-password.controller.js +32 -11
  230. package/dist/modules/auth/controllers/forgot-password.controller.js.map +1 -1
  231. package/dist/modules/auth/controllers/mfa.controller.d.ts +18 -0
  232. package/dist/modules/auth/controllers/mfa.controller.d.ts.map +1 -0
  233. package/dist/modules/auth/controllers/mfa.controller.js +192 -0
  234. package/dist/modules/auth/controllers/mfa.controller.js.map +1 -0
  235. package/dist/modules/auth/controllers/oauth.controller.d.ts +22 -0
  236. package/dist/modules/auth/controllers/oauth.controller.d.ts.map +1 -0
  237. package/dist/modules/auth/controllers/oauth.controller.js +192 -0
  238. package/dist/modules/auth/controllers/oauth.controller.js.map +1 -0
  239. package/dist/modules/auth/controllers/otp.controller.d.ts +6 -3
  240. package/dist/modules/auth/controllers/otp.controller.d.ts.map +1 -1
  241. package/dist/modules/auth/controllers/otp.controller.js +32 -33
  242. package/dist/modules/auth/controllers/otp.controller.js.map +1 -1
  243. package/dist/modules/auth/controllers/pin.controller.d.ts.map +1 -1
  244. package/dist/modules/auth/controllers/pin.controller.js +10 -2
  245. package/dist/modules/auth/controllers/pin.controller.js.map +1 -1
  246. package/dist/modules/auth/controllers/session.controller.d.ts +12 -4
  247. package/dist/modules/auth/controllers/session.controller.d.ts.map +1 -1
  248. package/dist/modules/auth/controllers/session.controller.js +130 -31
  249. package/dist/modules/auth/controllers/session.controller.js.map +1 -1
  250. package/dist/modules/auth/dto/auth-config.dto.d.ts +11 -2
  251. package/dist/modules/auth/dto/auth-config.dto.d.ts.map +1 -1
  252. package/dist/modules/auth/dto/auth-config.dto.js +78 -3
  253. package/dist/modules/auth/dto/auth-config.dto.js.map +1 -1
  254. package/dist/modules/auth/dto/index.d.ts +2 -0
  255. package/dist/modules/auth/dto/index.d.ts.map +1 -1
  256. package/dist/modules/auth/dto/index.js +2 -0
  257. package/dist/modules/auth/dto/index.js.map +1 -1
  258. package/dist/modules/auth/dto/login.dto.d.ts +8 -1
  259. package/dist/modules/auth/dto/login.dto.d.ts.map +1 -1
  260. package/dist/modules/auth/dto/login.dto.js +48 -3
  261. package/dist/modules/auth/dto/login.dto.js.map +1 -1
  262. package/dist/modules/auth/dto/mfa.dto.d.ts +61 -0
  263. package/dist/modules/auth/dto/mfa.dto.d.ts.map +1 -0
  264. package/dist/modules/auth/dto/mfa.dto.js +326 -0
  265. package/dist/modules/auth/dto/mfa.dto.js.map +1 -0
  266. package/dist/modules/auth/dto/oauth.dto.d.ts +45 -0
  267. package/dist/modules/auth/dto/oauth.dto.d.ts.map +1 -0
  268. package/dist/modules/auth/dto/oauth.dto.js +249 -0
  269. package/dist/modules/auth/dto/oauth.dto.js.map +1 -0
  270. package/dist/modules/auth/dto/otp.dto.d.ts +3 -1
  271. package/dist/modules/auth/dto/otp.dto.d.ts.map +1 -1
  272. package/dist/modules/auth/dto/otp.dto.js +19 -0
  273. package/dist/modules/auth/dto/otp.dto.js.map +1 -1
  274. package/dist/modules/auth/dto/password.dto.d.ts +28 -0
  275. package/dist/modules/auth/dto/password.dto.d.ts.map +1 -1
  276. package/dist/modules/auth/dto/password.dto.js +191 -5
  277. package/dist/modules/auth/dto/password.dto.js.map +1 -1
  278. package/dist/modules/auth/dto/register.dto.d.ts +1 -0
  279. package/dist/modules/auth/dto/register.dto.d.ts.map +1 -1
  280. package/dist/modules/auth/dto/register.dto.js +1 -0
  281. package/dist/modules/auth/dto/register.dto.js.map +1 -1
  282. package/dist/modules/auth/dto/session.dto.d.ts +20 -0
  283. package/dist/modules/auth/dto/session.dto.d.ts.map +1 -0
  284. package/dist/modules/auth/dto/session.dto.js +98 -0
  285. package/dist/modules/auth/dto/session.dto.js.map +1 -0
  286. package/dist/modules/auth/dto/token.dto.d.ts +38 -1
  287. package/dist/modules/auth/dto/token.dto.d.ts.map +1 -1
  288. package/dist/modules/auth/dto/token.dto.js +21 -1
  289. package/dist/modules/auth/dto/token.dto.js.map +1 -1
  290. package/dist/modules/auth/entities/index.d.ts +2 -0
  291. package/dist/modules/auth/entities/index.d.ts.map +1 -1
  292. package/dist/modules/auth/entities/index.js +2 -0
  293. package/dist/modules/auth/entities/index.js.map +1 -1
  294. package/dist/modules/auth/entities/password-reset-token.entity.d.ts +2 -0
  295. package/dist/modules/auth/entities/password-reset-token.entity.d.ts.map +1 -1
  296. package/dist/modules/auth/entities/password-reset-token.entity.js +6 -0
  297. package/dist/modules/auth/entities/password-reset-token.entity.js.map +1 -1
  298. package/dist/modules/auth/entities/user-mfa.entity.d.ts +19 -0
  299. package/dist/modules/auth/entities/user-mfa.entity.d.ts.map +1 -0
  300. package/dist/modules/auth/entities/user-mfa.entity.js +73 -0
  301. package/dist/modules/auth/entities/user-mfa.entity.js.map +1 -0
  302. package/dist/modules/auth/entities/user-oauth-identity.entity.d.ts +24 -0
  303. package/dist/modules/auth/entities/user-oauth-identity.entity.d.ts.map +1 -0
  304. package/dist/modules/auth/entities/user-oauth-identity.entity.js +84 -0
  305. package/dist/modules/auth/entities/user-oauth-identity.entity.js.map +1 -0
  306. package/dist/modules/auth/events/auth.events.d.ts +84 -19
  307. package/dist/modules/auth/events/auth.events.d.ts.map +1 -1
  308. package/dist/modules/auth/events/auth.events.js +17 -9
  309. package/dist/modules/auth/events/auth.events.js.map +1 -1
  310. package/dist/modules/auth/services/account.service.d.ts +74 -14
  311. package/dist/modules/auth/services/account.service.d.ts.map +1 -1
  312. package/dist/modules/auth/services/account.service.js +247 -31
  313. package/dist/modules/auth/services/account.service.js.map +1 -1
  314. package/dist/modules/auth/services/dpop.service.d.ts +41 -0
  315. package/dist/modules/auth/services/dpop.service.d.ts.map +1 -0
  316. package/dist/modules/auth/services/dpop.service.js +159 -0
  317. package/dist/modules/auth/services/dpop.service.js.map +1 -0
  318. package/dist/modules/auth/services/index.d.ts +2 -0
  319. package/dist/modules/auth/services/index.d.ts.map +1 -1
  320. package/dist/modules/auth/services/index.js +2 -0
  321. package/dist/modules/auth/services/index.js.map +1 -1
  322. package/dist/modules/auth/services/legacy-hash-cleanup.service.d.ts +28 -0
  323. package/dist/modules/auth/services/legacy-hash-cleanup.service.d.ts.map +1 -0
  324. package/dist/modules/auth/services/legacy-hash-cleanup.service.js +163 -0
  325. package/dist/modules/auth/services/legacy-hash-cleanup.service.js.map +1 -0
  326. package/dist/modules/auth/services/login.service.d.ts +29 -34
  327. package/dist/modules/auth/services/login.service.d.ts.map +1 -1
  328. package/dist/modules/auth/services/login.service.js +173 -61
  329. package/dist/modules/auth/services/login.service.js.map +1 -1
  330. package/dist/modules/auth/services/mfa.service.d.ts +111 -0
  331. package/dist/modules/auth/services/mfa.service.d.ts.map +1 -0
  332. package/dist/modules/auth/services/mfa.service.js +662 -0
  333. package/dist/modules/auth/services/mfa.service.js.map +1 -0
  334. package/dist/modules/auth/services/oauth/apple-id-token.verifier.d.ts +11 -0
  335. package/dist/modules/auth/services/oauth/apple-id-token.verifier.d.ts.map +1 -0
  336. package/dist/modules/auth/services/oauth/apple-id-token.verifier.js +56 -0
  337. package/dist/modules/auth/services/oauth/apple-id-token.verifier.js.map +1 -0
  338. package/dist/modules/auth/services/oauth/google-id-token.verifier.d.ts +12 -0
  339. package/dist/modules/auth/services/oauth/google-id-token.verifier.d.ts.map +1 -0
  340. package/dist/modules/auth/services/oauth/google-id-token.verifier.js +64 -0
  341. package/dist/modules/auth/services/oauth/google-id-token.verifier.js.map +1 -0
  342. package/dist/modules/auth/services/oauth/microsoft-id-token.verifier.d.ts +11 -0
  343. package/dist/modules/auth/services/oauth/microsoft-id-token.verifier.d.ts.map +1 -0
  344. package/dist/modules/auth/services/oauth/microsoft-id-token.verifier.js +76 -0
  345. package/dist/modules/auth/services/oauth/microsoft-id-token.verifier.js.map +1 -0
  346. package/dist/modules/auth/services/oauth/oidc-id-token.verifier.d.ts +16 -0
  347. package/dist/modules/auth/services/oauth/oidc-id-token.verifier.d.ts.map +1 -0
  348. package/dist/modules/auth/services/oauth/oidc-id-token.verifier.js +92 -0
  349. package/dist/modules/auth/services/oauth/oidc-id-token.verifier.js.map +1 -0
  350. package/dist/modules/auth/services/oauth/verified-oauth-identity.d.ts +9 -0
  351. package/dist/modules/auth/services/oauth/verified-oauth-identity.d.ts.map +1 -0
  352. package/dist/modules/auth/services/oauth/verified-oauth-identity.js +3 -0
  353. package/dist/modules/auth/services/oauth/verified-oauth-identity.js.map +1 -0
  354. package/dist/modules/auth/services/oauth.service.d.ts +83 -0
  355. package/dist/modules/auth/services/oauth.service.d.ts.map +1 -0
  356. package/dist/modules/auth/services/oauth.service.js +471 -0
  357. package/dist/modules/auth/services/oauth.service.js.map +1 -0
  358. package/dist/modules/auth/services/otp-auth.service.d.ts +13 -3
  359. package/dist/modules/auth/services/otp-auth.service.d.ts.map +1 -1
  360. package/dist/modules/auth/services/otp-auth.service.js +41 -7
  361. package/dist/modules/auth/services/otp-auth.service.js.map +1 -1
  362. package/dist/modules/auth/services/password-reset-audit-retention.service.d.ts +22 -0
  363. package/dist/modules/auth/services/password-reset-audit-retention.service.d.ts.map +1 -0
  364. package/dist/modules/auth/services/password-reset-audit-retention.service.js +117 -0
  365. package/dist/modules/auth/services/password-reset-audit-retention.service.js.map +1 -0
  366. package/dist/modules/auth/services/password.service.d.ts +25 -5
  367. package/dist/modules/auth/services/password.service.d.ts.map +1 -1
  368. package/dist/modules/auth/services/password.service.js +154 -20
  369. package/dist/modules/auth/services/password.service.js.map +1 -1
  370. package/dist/modules/auth/services/pin-auth.service.d.ts +10 -3
  371. package/dist/modules/auth/services/pin-auth.service.d.ts.map +1 -1
  372. package/dist/modules/auth/services/pin-auth.service.js +110 -13
  373. package/dist/modules/auth/services/pin-auth.service.js.map +1 -1
  374. package/dist/modules/auth/services/registration.service.d.ts +10 -2
  375. package/dist/modules/auth/services/registration.service.d.ts.map +1 -1
  376. package/dist/modules/auth/services/registration.service.js +113 -25
  377. package/dist/modules/auth/services/registration.service.js.map +1 -1
  378. package/dist/modules/auth/services/turnstile.service.d.ts +17 -0
  379. package/dist/modules/auth/services/turnstile.service.d.ts.map +1 -0
  380. package/dist/modules/auth/services/turnstile.service.js +94 -0
  381. package/dist/modules/auth/services/turnstile.service.js.map +1 -0
  382. package/dist/modules/auth/utils/auth-params.util.d.ts +13 -6
  383. package/dist/modules/auth/utils/auth-params.util.d.ts.map +1 -1
  384. package/dist/modules/auth/utils/auth-params.util.js +27 -4
  385. package/dist/modules/auth/utils/auth-params.util.js.map +1 -1
  386. package/dist/modules/auth/utils/auth-supported.util.d.ts +12 -1
  387. package/dist/modules/auth/utils/auth-supported.util.d.ts.map +1 -1
  388. package/dist/modules/auth/utils/auth-supported.util.js +36 -4
  389. package/dist/modules/auth/utils/auth-supported.util.js.map +1 -1
  390. package/dist/modules/auth/utils/backup-code-hash.util.d.ts +10 -0
  391. package/dist/modules/auth/utils/backup-code-hash.util.d.ts.map +1 -0
  392. package/dist/modules/auth/utils/backup-code-hash.util.js +31 -0
  393. package/dist/modules/auth/utils/backup-code-hash.util.js.map +1 -0
  394. package/dist/modules/auth/utils/backup-codes.util.d.ts +5 -0
  395. package/dist/modules/auth/utils/backup-codes.util.d.ts.map +1 -0
  396. package/dist/modules/auth/utils/backup-codes.util.js +22 -0
  397. package/dist/modules/auth/utils/backup-codes.util.js.map +1 -0
  398. package/dist/modules/auth/utils/dpop.util.d.ts +22 -0
  399. package/dist/modules/auth/utils/dpop.util.d.ts.map +1 -0
  400. package/dist/modules/auth/utils/dpop.util.js +73 -0
  401. package/dist/modules/auth/utils/dpop.util.js.map +1 -0
  402. package/dist/modules/auth/utils/mfa-secret.util.d.ts +22 -0
  403. package/dist/modules/auth/utils/mfa-secret.util.d.ts.map +1 -0
  404. package/dist/modules/auth/utils/mfa-secret.util.js +59 -0
  405. package/dist/modules/auth/utils/mfa-secret.util.js.map +1 -0
  406. package/dist/modules/auth/utils/mfa-verify-params.util.d.ts +26 -0
  407. package/dist/modules/auth/utils/mfa-verify-params.util.d.ts.map +1 -0
  408. package/dist/modules/auth/utils/mfa-verify-params.util.js +49 -0
  409. package/dist/modules/auth/utils/mfa-verify-params.util.js.map +1 -0
  410. package/dist/modules/auth/utils/step-up-purpose.util.d.ts +5 -0
  411. package/dist/modules/auth/utils/step-up-purpose.util.d.ts.map +1 -0
  412. package/dist/modules/auth/utils/step-up-purpose.util.js +18 -0
  413. package/dist/modules/auth/utils/step-up-purpose.util.js.map +1 -0
  414. package/dist/modules/auth/utils/totp.util.d.ts +16 -0
  415. package/dist/modules/auth/utils/totp.util.d.ts.map +1 -0
  416. package/dist/modules/auth/utils/totp.util.js +88 -0
  417. package/dist/modules/auth/utils/totp.util.js.map +1 -0
  418. package/dist/modules/delivery/composers/otp-delivery.composer.d.ts +28 -1
  419. package/dist/modules/delivery/composers/otp-delivery.composer.d.ts.map +1 -1
  420. package/dist/modules/delivery/composers/otp-delivery.composer.js +48 -2
  421. package/dist/modules/delivery/composers/otp-delivery.composer.js.map +1 -1
  422. package/dist/modules/delivery/constants/delivery-worker.constants.d.ts +29 -0
  423. package/dist/modules/delivery/constants/delivery-worker.constants.d.ts.map +1 -0
  424. package/dist/modules/delivery/constants/delivery-worker.constants.js +51 -0
  425. package/dist/modules/delivery/constants/delivery-worker.constants.js.map +1 -0
  426. package/dist/modules/delivery/delivery.module.d.ts.map +1 -1
  427. package/dist/modules/delivery/delivery.module.js +1 -15
  428. package/dist/modules/delivery/delivery.module.js.map +1 -1
  429. package/dist/modules/delivery/entities/notification-delivery-log.entity.d.ts.map +1 -1
  430. package/dist/modules/delivery/entities/notification-delivery-log.entity.js +3 -1
  431. package/dist/modules/delivery/entities/notification-delivery-log.entity.js.map +1 -1
  432. package/dist/modules/delivery/notification-delivery.service.d.ts +12 -1
  433. package/dist/modules/delivery/notification-delivery.service.d.ts.map +1 -1
  434. package/dist/modules/delivery/notification-delivery.service.js +121 -40
  435. package/dist/modules/delivery/notification-delivery.service.js.map +1 -1
  436. package/dist/modules/delivery/processors/delivery-job.runner.d.ts +22 -1
  437. package/dist/modules/delivery/processors/delivery-job.runner.d.ts.map +1 -1
  438. package/dist/modules/delivery/processors/delivery-job.runner.js +144 -42
  439. package/dist/modules/delivery/processors/delivery-job.runner.js.map +1 -1
  440. package/dist/modules/delivery/processors/delivery.processor.d.ts.map +1 -1
  441. package/dist/modules/delivery/processors/delivery.processor.js +6 -1
  442. package/dist/modules/delivery/processors/delivery.processor.js.map +1 -1
  443. package/dist/modules/delivery/processors/otp-delivery-job.runner.d.ts +11 -0
  444. package/dist/modules/delivery/processors/otp-delivery-job.runner.d.ts.map +1 -1
  445. package/dist/modules/delivery/processors/otp-delivery-job.runner.js +90 -16
  446. package/dist/modules/delivery/processors/otp-delivery-job.runner.js.map +1 -1
  447. package/dist/modules/delivery/processors/otp-delivery.processor.d.ts.map +1 -1
  448. package/dist/modules/delivery/processors/otp-delivery.processor.js +6 -1
  449. package/dist/modules/delivery/processors/otp-delivery.processor.js.map +1 -1
  450. package/dist/modules/delivery/queues/sync-jobs.queue.d.ts +7 -1
  451. package/dist/modules/delivery/queues/sync-jobs.queue.d.ts.map +1 -1
  452. package/dist/modules/delivery/queues/sync-jobs.queue.js +11 -2
  453. package/dist/modules/delivery/queues/sync-jobs.queue.js.map +1 -1
  454. package/dist/modules/delivery/services/delivery-audit-retention.service.d.ts +7 -3
  455. package/dist/modules/delivery/services/delivery-audit-retention.service.d.ts.map +1 -1
  456. package/dist/modules/delivery/services/delivery-audit-retention.service.js +33 -10
  457. package/dist/modules/delivery/services/delivery-audit-retention.service.js.map +1 -1
  458. package/dist/modules/delivery/services/notification-audit.service.d.ts +7 -4
  459. package/dist/modules/delivery/services/notification-audit.service.d.ts.map +1 -1
  460. package/dist/modules/delivery/services/notification-audit.service.js +83 -26
  461. package/dist/modules/delivery/services/notification-audit.service.js.map +1 -1
  462. package/dist/modules/delivery/utils/payload-snapshot.util.d.ts +2 -0
  463. package/dist/modules/delivery/utils/payload-snapshot.util.d.ts.map +1 -1
  464. package/dist/modules/delivery/utils/payload-snapshot.util.js +22 -3
  465. package/dist/modules/delivery/utils/payload-snapshot.util.js.map +1 -1
  466. package/dist/modules/file-upload/controllers/file-upload.controller.d.ts +7 -1
  467. package/dist/modules/file-upload/controllers/file-upload.controller.d.ts.map +1 -1
  468. package/dist/modules/file-upload/controllers/file-upload.controller.js +5 -7
  469. package/dist/modules/file-upload/controllers/file-upload.controller.js.map +1 -1
  470. package/dist/modules/file-upload/dto/file-upload.dto.d.ts +2 -0
  471. package/dist/modules/file-upload/dto/file-upload.dto.d.ts.map +1 -1
  472. package/dist/modules/file-upload/dto/file-upload.dto.js +20 -0
  473. package/dist/modules/file-upload/dto/file-upload.dto.js.map +1 -1
  474. package/dist/modules/file-upload/file-upload.module.d.ts.map +1 -1
  475. package/dist/modules/file-upload/file-upload.module.js +12 -2
  476. package/dist/modules/file-upload/file-upload.module.js.map +1 -1
  477. package/dist/modules/file-upload/services/file-upload.service.d.ts +24 -6
  478. package/dist/modules/file-upload/services/file-upload.service.d.ts.map +1 -1
  479. package/dist/modules/file-upload/services/file-upload.service.js +164 -36
  480. package/dist/modules/file-upload/services/file-upload.service.js.map +1 -1
  481. package/dist/modules/file-upload/services/upload-orphan-cleanup.service.d.ts +4 -2
  482. package/dist/modules/file-upload/services/upload-orphan-cleanup.service.d.ts.map +1 -1
  483. package/dist/modules/file-upload/services/upload-orphan-cleanup.service.js +30 -5
  484. package/dist/modules/file-upload/services/upload-orphan-cleanup.service.js.map +1 -1
  485. package/dist/modules/file-upload/utils/image-optimize.util.d.ts.map +1 -1
  486. package/dist/modules/file-upload/utils/image-optimize.util.js +7 -1
  487. package/dist/modules/file-upload/utils/image-optimize.util.js.map +1 -1
  488. package/dist/modules/health/health.controller.d.ts +5 -1
  489. package/dist/modules/health/health.controller.d.ts.map +1 -1
  490. package/dist/modules/health/health.controller.js +57 -3
  491. package/dist/modules/health/health.controller.js.map +1 -1
  492. package/dist/modules/invitations/controllers/invitations.controller.d.ts +19 -4
  493. package/dist/modules/invitations/controllers/invitations.controller.d.ts.map +1 -1
  494. package/dist/modules/invitations/controllers/invitations.controller.js +19 -10
  495. package/dist/modules/invitations/controllers/invitations.controller.js.map +1 -1
  496. package/dist/modules/invitations/dto/invitation.dto.d.ts +13 -0
  497. package/dist/modules/invitations/dto/invitation.dto.d.ts.map +1 -1
  498. package/dist/modules/invitations/dto/invitation.dto.js +69 -2
  499. package/dist/modules/invitations/dto/invitation.dto.js.map +1 -1
  500. package/dist/modules/invitations/services/invitations.service.d.ts +24 -6
  501. package/dist/modules/invitations/services/invitations.service.d.ts.map +1 -1
  502. package/dist/modules/invitations/services/invitations.service.js +96 -20
  503. package/dist/modules/invitations/services/invitations.service.js.map +1 -1
  504. package/dist/modules/jobs/queues/jobs.queue.d.ts +7 -2
  505. package/dist/modules/jobs/queues/jobs.queue.d.ts.map +1 -1
  506. package/dist/modules/jobs/queues/jobs.queue.js +25 -10
  507. package/dist/modules/jobs/queues/jobs.queue.js.map +1 -1
  508. package/dist/modules/notifications/controllers/notifications.controller.d.ts +3 -1
  509. package/dist/modules/notifications/controllers/notifications.controller.d.ts.map +1 -1
  510. package/dist/modules/notifications/controllers/notifications.controller.js +25 -2
  511. package/dist/modules/notifications/controllers/notifications.controller.js.map +1 -1
  512. package/dist/modules/notifications/dto/notification-query.dto.d.ts.map +1 -1
  513. package/dist/modules/notifications/dto/notification-query.dto.js +1 -0
  514. package/dist/modules/notifications/dto/notification-query.dto.js.map +1 -1
  515. package/dist/modules/notifications/entities/device-token.entity.d.ts.map +1 -1
  516. package/dist/modules/notifications/entities/device-token.entity.js +3 -1
  517. package/dist/modules/notifications/entities/device-token.entity.js.map +1 -1
  518. package/dist/modules/notifications/services/fcm.service.d.ts +2 -0
  519. package/dist/modules/notifications/services/fcm.service.d.ts.map +1 -1
  520. package/dist/modules/notifications/services/fcm.service.js +28 -7
  521. package/dist/modules/notifications/services/fcm.service.js.map +1 -1
  522. package/dist/modules/notifications/services/notifications.service.d.ts +16 -3
  523. package/dist/modules/notifications/services/notifications.service.d.ts.map +1 -1
  524. package/dist/modules/notifications/services/notifications.service.js +95 -24
  525. package/dist/modules/notifications/services/notifications.service.js.map +1 -1
  526. package/dist/modules/observability/metrics/metrics.service.d.ts +2 -0
  527. package/dist/modules/observability/metrics/metrics.service.d.ts.map +1 -1
  528. package/dist/modules/observability/metrics/metrics.service.js +11 -0
  529. package/dist/modules/observability/metrics/metrics.service.js.map +1 -1
  530. package/dist/modules/otp/constants/otp.constants.d.ts +7 -5
  531. package/dist/modules/otp/constants/otp.constants.d.ts.map +1 -1
  532. package/dist/modules/otp/constants/otp.constants.js +11 -8
  533. package/dist/modules/otp/constants/otp.constants.js.map +1 -1
  534. package/dist/modules/otp/interfaces/otp.service.interface.d.ts +1 -1
  535. package/dist/modules/otp/interfaces/otp.service.interface.d.ts.map +1 -1
  536. package/dist/modules/otp/otp.service.d.ts +10 -2
  537. package/dist/modules/otp/otp.service.d.ts.map +1 -1
  538. package/dist/modules/otp/otp.service.js +48 -4
  539. package/dist/modules/otp/otp.service.js.map +1 -1
  540. package/dist/modules/otp/services/otp.rate-limiter.d.ts +2 -0
  541. package/dist/modules/otp/services/otp.rate-limiter.d.ts.map +1 -1
  542. package/dist/modules/otp/services/otp.rate-limiter.js +19 -0
  543. package/dist/modules/otp/services/otp.rate-limiter.js.map +1 -1
  544. package/dist/modules/otp/services/otp.session.store.d.ts +9 -3
  545. package/dist/modules/otp/services/otp.session.store.d.ts.map +1 -1
  546. package/dist/modules/otp/services/otp.session.store.js +34 -42
  547. package/dist/modules/otp/services/otp.session.store.js.map +1 -1
  548. package/dist/modules/otp/utils/otp-code-hash.util.d.ts +11 -0
  549. package/dist/modules/otp/utils/otp-code-hash.util.d.ts.map +1 -0
  550. package/dist/modules/otp/utils/otp-code-hash.util.js +68 -0
  551. package/dist/modules/otp/utils/otp-code-hash.util.js.map +1 -0
  552. package/dist/modules/profile/controllers/profile.controller.d.ts +9 -3
  553. package/dist/modules/profile/controllers/profile.controller.d.ts.map +1 -1
  554. package/dist/modules/profile/controllers/profile.controller.js +140 -8
  555. package/dist/modules/profile/controllers/profile.controller.js.map +1 -1
  556. package/dist/modules/profile/dto/create-user-profile.dto.d.ts +10 -0
  557. package/dist/modules/profile/dto/create-user-profile.dto.d.ts.map +1 -1
  558. package/dist/modules/profile/dto/create-user-profile.dto.js +43 -1
  559. package/dist/modules/profile/dto/create-user-profile.dto.js.map +1 -1
  560. package/dist/modules/profile/dto/public-user-profile.dto.d.ts +24 -0
  561. package/dist/modules/profile/dto/public-user-profile.dto.d.ts.map +1 -0
  562. package/dist/modules/profile/dto/public-user-profile.dto.js +115 -0
  563. package/dist/modules/profile/dto/public-user-profile.dto.js.map +1 -0
  564. package/dist/modules/profile/dto/user-profile-response.dto.d.ts +4 -0
  565. package/dist/modules/profile/dto/user-profile-response.dto.d.ts.map +1 -1
  566. package/dist/modules/profile/dto/user-profile-response.dto.js +4 -0
  567. package/dist/modules/profile/dto/user-profile-response.dto.js.map +1 -1
  568. package/dist/modules/profile/dto/username-available.dto.d.ts +6 -0
  569. package/dist/modules/profile/dto/username-available.dto.d.ts.map +1 -0
  570. package/dist/modules/profile/dto/username-available.dto.js +31 -0
  571. package/dist/modules/profile/dto/username-available.dto.js.map +1 -0
  572. package/dist/modules/profile/entities/user-profiles.entity.d.ts +10 -0
  573. package/dist/modules/profile/entities/user-profiles.entity.d.ts.map +1 -1
  574. package/dist/modules/profile/entities/user-profiles.entity.js +29 -1
  575. package/dist/modules/profile/entities/user-profiles.entity.js.map +1 -1
  576. package/dist/modules/profile/index.d.ts +1 -0
  577. package/dist/modules/profile/index.d.ts.map +1 -1
  578. package/dist/modules/profile/index.js +1 -0
  579. package/dist/modules/profile/index.js.map +1 -1
  580. package/dist/modules/profile/profile.manifest.d.ts +2 -2
  581. package/dist/modules/profile/profile.manifest.js +2 -2
  582. package/dist/modules/profile/profile.manifest.js.map +1 -1
  583. package/dist/modules/profile/profile.module.d.ts.map +1 -1
  584. package/dist/modules/profile/profile.module.js +7 -2
  585. package/dist/modules/profile/profile.module.js.map +1 -1
  586. package/dist/modules/profile/services/profile.service.d.ts +56 -4
  587. package/dist/modules/profile/services/profile.service.d.ts.map +1 -1
  588. package/dist/modules/profile/services/profile.service.js +247 -20
  589. package/dist/modules/profile/services/profile.service.js.map +1 -1
  590. package/dist/modules/realtime/adapters/redis-io.adapter.d.ts +26 -0
  591. package/dist/modules/realtime/adapters/redis-io.adapter.d.ts.map +1 -0
  592. package/dist/modules/realtime/adapters/redis-io.adapter.js +124 -0
  593. package/dist/modules/realtime/adapters/redis-io.adapter.js.map +1 -0
  594. package/dist/modules/realtime/constants/realtime.constants.d.ts +36 -0
  595. package/dist/modules/realtime/constants/realtime.constants.d.ts.map +1 -0
  596. package/dist/modules/realtime/constants/realtime.constants.js +42 -0
  597. package/dist/modules/realtime/constants/realtime.constants.js.map +1 -0
  598. package/dist/modules/realtime/controllers/realtime.controller.d.ts +21 -0
  599. package/dist/modules/realtime/controllers/realtime.controller.d.ts.map +1 -0
  600. package/dist/modules/realtime/controllers/realtime.controller.js +113 -0
  601. package/dist/modules/realtime/controllers/realtime.controller.js.map +1 -0
  602. package/dist/modules/realtime/gateway/realtime.gateway.d.ts +42 -0
  603. package/dist/modules/realtime/gateway/realtime.gateway.d.ts.map +1 -0
  604. package/dist/modules/realtime/gateway/realtime.gateway.js +289 -0
  605. package/dist/modules/realtime/gateway/realtime.gateway.js.map +1 -0
  606. package/dist/modules/realtime/index.d.ts +12 -0
  607. package/dist/modules/realtime/index.d.ts.map +1 -0
  608. package/dist/modules/realtime/index.js +35 -0
  609. package/dist/modules/realtime/index.js.map +1 -0
  610. package/dist/modules/realtime/realtime.manifest.d.ts +8 -0
  611. package/dist/modules/realtime/realtime.manifest.d.ts.map +1 -0
  612. package/dist/modules/realtime/realtime.manifest.js +31 -0
  613. package/dist/modules/realtime/realtime.manifest.js.map +1 -0
  614. package/dist/modules/realtime/realtime.module.d.ts +14 -0
  615. package/dist/modules/realtime/realtime.module.d.ts.map +1 -0
  616. package/dist/modules/realtime/realtime.module.js +126 -0
  617. package/dist/modules/realtime/realtime.module.js.map +1 -0
  618. package/dist/modules/realtime/services/realtime-handler.registry.d.ts +16 -0
  619. package/dist/modules/realtime/services/realtime-handler.registry.d.ts.map +1 -0
  620. package/dist/modules/realtime/services/realtime-handler.registry.js +55 -0
  621. package/dist/modules/realtime/services/realtime-handler.registry.js.map +1 -0
  622. package/dist/modules/realtime/services/realtime-presence.service.d.ts +15 -0
  623. package/dist/modules/realtime/services/realtime-presence.service.d.ts.map +1 -0
  624. package/dist/modules/realtime/services/realtime-presence.service.js +86 -0
  625. package/dist/modules/realtime/services/realtime-presence.service.js.map +1 -0
  626. package/dist/modules/realtime/services/realtime-rate-limiter.service.d.ts +12 -0
  627. package/dist/modules/realtime/services/realtime-rate-limiter.service.d.ts.map +1 -0
  628. package/dist/modules/realtime/services/realtime-rate-limiter.service.js +63 -0
  629. package/dist/modules/realtime/services/realtime-rate-limiter.service.js.map +1 -0
  630. package/dist/modules/realtime/services/realtime.service.d.ts +88 -0
  631. package/dist/modules/realtime/services/realtime.service.d.ts.map +1 -0
  632. package/dist/modules/realtime/services/realtime.service.js +343 -0
  633. package/dist/modules/realtime/services/realtime.service.js.map +1 -0
  634. package/dist/modules/realtime/types/realtime.types.d.ts +50 -0
  635. package/dist/modules/realtime/types/realtime.types.d.ts.map +1 -0
  636. package/dist/modules/realtime/types/realtime.types.js +14 -0
  637. package/dist/modules/realtime/types/realtime.types.js.map +1 -0
  638. package/dist/modules/realtime/utils/handshake-error.util.d.ts +5 -0
  639. package/dist/modules/realtime/utils/handshake-error.util.d.ts.map +1 -0
  640. package/dist/modules/realtime/utils/handshake-error.util.js +45 -0
  641. package/dist/modules/realtime/utils/handshake-error.util.js.map +1 -0
  642. package/dist/modules/roles/controllers/modules.controller.d.ts +4 -3
  643. package/dist/modules/roles/controllers/modules.controller.d.ts.map +1 -1
  644. package/dist/modules/roles/controllers/modules.controller.js +21 -10
  645. package/dist/modules/roles/controllers/modules.controller.js.map +1 -1
  646. package/dist/modules/roles/controllers/permissions.controller.d.ts +4 -3
  647. package/dist/modules/roles/controllers/permissions.controller.d.ts.map +1 -1
  648. package/dist/modules/roles/controllers/permissions.controller.js +21 -10
  649. package/dist/modules/roles/controllers/permissions.controller.js.map +1 -1
  650. package/dist/modules/roles/controllers/roles.controller.d.ts +5 -4
  651. package/dist/modules/roles/controllers/roles.controller.d.ts.map +1 -1
  652. package/dist/modules/roles/controllers/roles.controller.js +26 -13
  653. package/dist/modules/roles/controllers/roles.controller.js.map +1 -1
  654. package/dist/modules/roles/controllers/user-roles.controller.d.ts +3 -2
  655. package/dist/modules/roles/controllers/user-roles.controller.d.ts.map +1 -1
  656. package/dist/modules/roles/controllers/user-roles.controller.js +14 -6
  657. package/dist/modules/roles/controllers/user-roles.controller.js.map +1 -1
  658. package/dist/modules/roles/services/modules.service.d.ts +8 -5
  659. package/dist/modules/roles/services/modules.service.d.ts.map +1 -1
  660. package/dist/modules/roles/services/modules.service.js +58 -12
  661. package/dist/modules/roles/services/modules.service.js.map +1 -1
  662. package/dist/modules/roles/services/permissions.service.d.ts +8 -5
  663. package/dist/modules/roles/services/permissions.service.d.ts.map +1 -1
  664. package/dist/modules/roles/services/permissions.service.js +61 -12
  665. package/dist/modules/roles/services/permissions.service.js.map +1 -1
  666. package/dist/modules/roles/services/roles.service.d.ts +19 -9
  667. package/dist/modules/roles/services/roles.service.d.ts.map +1 -1
  668. package/dist/modules/roles/services/roles.service.js +137 -47
  669. package/dist/modules/roles/services/roles.service.js.map +1 -1
  670. package/dist/modules/roles/services/user-roles.service.d.ts +12 -4
  671. package/dist/modules/roles/services/user-roles.service.d.ts.map +1 -1
  672. package/dist/modules/roles/services/user-roles.service.js +58 -26
  673. package/dist/modules/roles/services/user-roles.service.js.map +1 -1
  674. package/dist/modules/sessions/entities/refresh-token.entity.d.ts +7 -1
  675. package/dist/modules/sessions/entities/refresh-token.entity.d.ts.map +1 -1
  676. package/dist/modules/sessions/entities/refresh-token.entity.js +10 -0
  677. package/dist/modules/sessions/entities/refresh-token.entity.js.map +1 -1
  678. package/dist/modules/sessions/entities/revoked-refresh-family.entity.d.ts +12 -0
  679. package/dist/modules/sessions/entities/revoked-refresh-family.entity.d.ts.map +1 -0
  680. package/dist/modules/sessions/entities/revoked-refresh-family.entity.js +46 -0
  681. package/dist/modules/sessions/entities/revoked-refresh-family.entity.js.map +1 -0
  682. package/dist/modules/sessions/services/refresh-token-retention.service.d.ts +20 -0
  683. package/dist/modules/sessions/services/refresh-token-retention.service.d.ts.map +1 -0
  684. package/dist/modules/sessions/services/refresh-token-retention.service.js +97 -0
  685. package/dist/modules/sessions/services/refresh-token-retention.service.js.map +1 -0
  686. package/dist/modules/sessions/services/token.service.d.ts +150 -16
  687. package/dist/modules/sessions/services/token.service.d.ts.map +1 -1
  688. package/dist/modules/sessions/services/token.service.js +505 -74
  689. package/dist/modules/sessions/services/token.service.js.map +1 -1
  690. package/dist/modules/sessions/sessions.module.d.ts.map +1 -1
  691. package/dist/modules/sessions/sessions.module.js +4 -2
  692. package/dist/modules/sessions/sessions.module.js.map +1 -1
  693. package/dist/modules/sessions/utils/refresh-token-hash.util.d.ts +13 -0
  694. package/dist/modules/sessions/utils/refresh-token-hash.util.d.ts.map +1 -0
  695. package/dist/modules/sessions/utils/refresh-token-hash.util.js +37 -0
  696. package/dist/modules/sessions/utils/refresh-token-hash.util.js.map +1 -0
  697. package/dist/modules/settings/constants/settings.defaults.d.ts +57 -3
  698. package/dist/modules/settings/constants/settings.defaults.d.ts.map +1 -1
  699. package/dist/modules/settings/constants/settings.defaults.js +58 -3
  700. package/dist/modules/settings/constants/settings.defaults.js.map +1 -1
  701. package/dist/modules/settings/constants/settings.keys.d.ts +138 -2
  702. package/dist/modules/settings/constants/settings.keys.d.ts.map +1 -1
  703. package/dist/modules/settings/constants/settings.keys.js +140 -2
  704. package/dist/modules/settings/constants/settings.keys.js.map +1 -1
  705. package/dist/modules/settings/controllers/settings.controller.d.ts +5 -1
  706. package/dist/modules/settings/controllers/settings.controller.d.ts.map +1 -1
  707. package/dist/modules/settings/controllers/settings.controller.js +134 -5
  708. package/dist/modules/settings/controllers/settings.controller.js.map +1 -1
  709. package/dist/modules/settings/services/settings.service.d.ts +17 -7
  710. package/dist/modules/settings/services/settings.service.d.ts.map +1 -1
  711. package/dist/modules/settings/services/settings.service.js +80 -14
  712. package/dist/modules/settings/services/settings.service.js.map +1 -1
  713. package/dist/modules/settings/utils/settings-secret.util.d.ts +13 -0
  714. package/dist/modules/settings/utils/settings-secret.util.d.ts.map +1 -0
  715. package/dist/modules/settings/utils/settings-secret.util.js +80 -0
  716. package/dist/modules/settings/utils/settings-secret.util.js.map +1 -0
  717. package/dist/modules/users/controllers/users.controller.d.ts +4 -2
  718. package/dist/modules/users/controllers/users.controller.d.ts.map +1 -1
  719. package/dist/modules/users/controllers/users.controller.js +89 -10
  720. package/dist/modules/users/controllers/users.controller.js.map +1 -1
  721. package/dist/modules/users/dto/user.dto.d.ts +3 -0
  722. package/dist/modules/users/dto/user.dto.d.ts.map +1 -1
  723. package/dist/modules/users/dto/user.dto.js +27 -4
  724. package/dist/modules/users/dto/user.dto.js.map +1 -1
  725. package/dist/modules/users/entities/user.entity.d.ts +7 -1
  726. package/dist/modules/users/entities/user.entity.d.ts.map +1 -1
  727. package/dist/modules/users/entities/user.entity.js +10 -0
  728. package/dist/modules/users/entities/user.entity.js.map +1 -1
  729. package/dist/modules/users/services/users.service.d.ts +15 -2
  730. package/dist/modules/users/services/users.service.d.ts.map +1 -1
  731. package/dist/modules/users/services/users.service.js +152 -37
  732. package/dist/modules/users/services/users.service.js.map +1 -1
  733. package/dist/modules/users/users.module.d.ts.map +1 -1
  734. package/dist/modules/users/users.module.js +1 -2
  735. package/dist/modules/users/users.module.js.map +1 -1
  736. package/package.json +19 -7
  737. package/dist/modules/admin/entities/admin-log.entity.d.ts +0 -20
  738. package/dist/modules/admin/entities/admin-log.entity.d.ts.map +0 -1
  739. package/dist/modules/admin/entities/admin-log.entity.js +0 -65
  740. package/dist/modules/admin/entities/admin-log.entity.js.map +0 -1
@@ -0,0 +1,343 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
12
+ return function (target, key) { decorator(target, key, paramIndex); }
13
+ };
14
+ var __importDefault = (this && this.__importDefault) || function (mod) {
15
+ return (mod && mod.__esModule) ? mod : { "default": mod };
16
+ };
17
+ var RealtimeService_1;
18
+ Object.defineProperty(exports, "__esModule", { value: true });
19
+ exports.RealtimeService = void 0;
20
+ const common_1 = require("@nestjs/common");
21
+ const config_1 = require("@nestjs/config");
22
+ const jwt_1 = require("@nestjs/jwt");
23
+ const crypto_1 = require("crypto");
24
+ const ioredis_1 = __importDefault(require("ioredis"));
25
+ const node_env_util_1 = require("../../../config/node-env.util");
26
+ const redis_module_1 = require("../../../config/redis.module");
27
+ const access_token_validator_1 = require("../../auth/auth-core/services/access-token.validator");
28
+ const metrics_service_1 = require("../../observability/metrics/metrics.service");
29
+ const settings_keys_1 = require("../../settings/constants/settings.keys");
30
+ const settings_service_1 = require("../../settings/services/settings.service");
31
+ const realtime_constants_1 = require("../constants/realtime.constants");
32
+ const realtime_types_1 = require("../types/realtime.types");
33
+ const realtime_presence_service_1 = require("./realtime-presence.service");
34
+ const realtime_rate_limiter_service_1 = require("./realtime-rate-limiter.service");
35
+ let RealtimeService = RealtimeService_1 = class RealtimeService {
36
+ jwtService;
37
+ accessTokenValidator;
38
+ presence;
39
+ rateLimiter;
40
+ settings;
41
+ configService;
42
+ redis;
43
+ metrics;
44
+ logger = new common_1.Logger(RealtimeService_1.name);
45
+ /** Used to ignore control-channel echoes from this process. */
46
+ instanceId = (0, crypto_1.randomUUID)();
47
+ server = null;
48
+ controlSub = null;
49
+ localConnections = 0;
50
+ /** Disconnects requested before the Socket.IO server was attached. */
51
+ pendingDisconnects = [];
52
+ constructor(jwtService, accessTokenValidator, presence, rateLimiter, settings, configService, redis, metrics) {
53
+ this.jwtService = jwtService;
54
+ this.accessTokenValidator = accessTokenValidator;
55
+ this.presence = presence;
56
+ this.rateLimiter = rateLimiter;
57
+ this.settings = settings;
58
+ this.configService = configService;
59
+ this.redis = redis;
60
+ this.metrics = metrics;
61
+ }
62
+ onModuleInit() {
63
+ if ((0, node_env_util_1.isProductionNodeEnv)(this.configService.get('app.nodeEnv')) &&
64
+ process.env.REDIS_ENABLED !== 'true') {
65
+ throw new Error('Realtime requires REDIS_ENABLED=true in production for the Socket.IO Redis adapter and presence.');
66
+ }
67
+ }
68
+ async onModuleDestroy() {
69
+ await this.controlSub?.unsubscribe();
70
+ this.controlSub = null;
71
+ }
72
+ /** Called by the gateway when the Socket.IO server is ready. */
73
+ attachServer(server) {
74
+ this.server = server;
75
+ this.metrics?.setRealtimeConnections(this.localConnections);
76
+ const pending = this.pendingDisconnects.splice(0, this.pendingDisconnects.length);
77
+ for (const item of pending) {
78
+ if (item.kind === 'user') {
79
+ this.applyDisconnectUser(item.id, item.reason, { emitEvent: item.emitEvent });
80
+ }
81
+ else {
82
+ this.applyDisconnectFamily(item.id, item.reason, { emitEvent: item.emitEvent });
83
+ }
84
+ }
85
+ }
86
+ getServer() {
87
+ return this.server;
88
+ }
89
+ isReady() {
90
+ return this.server != null;
91
+ }
92
+ trackConnect() {
93
+ this.localConnections += 1;
94
+ this.metrics?.setRealtimeConnections(this.localConnections);
95
+ this.metrics?.recordBusinessEvent('realtime', 'connect', 'success');
96
+ }
97
+ trackDisconnect() {
98
+ this.localConnections = Math.max(0, this.localConnections - 1);
99
+ this.metrics?.setRealtimeConnections(this.localConnections);
100
+ this.metrics?.recordBusinessEvent('realtime', 'disconnect', 'success');
101
+ }
102
+ getLocalConnectionCount() {
103
+ return this.localConnections;
104
+ }
105
+ buildHandshakeDpopUri(host, proto = 'https') {
106
+ const safeProto = (proto.split(',')[0] ?? 'https').trim() || 'https';
107
+ const safeHost = host.trim() || 'localhost';
108
+ return `${safeProto}://${safeHost}${realtime_constants_1.REALTIME_PATH}`;
109
+ }
110
+ async authenticateToken(token, dpopCtx) {
111
+ let payload;
112
+ try {
113
+ payload = this.jwtService.verify(token);
114
+ }
115
+ catch (err) {
116
+ this.metrics?.recordBusinessEvent('realtime', 'handshake', 'token_invalid');
117
+ const expired = err instanceof Error &&
118
+ (err.name === 'TokenExpiredError' ||
119
+ /jwt expired|token expired/i.test(err.message));
120
+ throw new Error(expired ? realtime_constants_1.REALTIME_CLOSE_CODES.TOKEN_EXPIRED : realtime_constants_1.REALTIME_CLOSE_CODES.UNAUTHORIZED);
121
+ }
122
+ const user = await this.accessTokenValidator.validate(payload, {
123
+ method: dpopCtx.method,
124
+ uri: dpopCtx.uri,
125
+ authorization: `Bearer ${token}`,
126
+ dpop: dpopCtx.dpop,
127
+ });
128
+ return {
129
+ user,
130
+ connectedAt: Date.now(),
131
+ tokenExp: payload.exp,
132
+ };
133
+ }
134
+ async emitToUser(userId, event, payload, opts) {
135
+ return this.emitToRoom((0, realtime_constants_1.userRoom)(userId), event, payload, opts, userId);
136
+ }
137
+ async emitToUsers(userIds, event, payload, opts) {
138
+ let sent = 0;
139
+ for (const id of [...new Set(userIds.filter(Boolean))]) {
140
+ if (await this.emitToUser(id, event, payload, opts))
141
+ sent += 1;
142
+ }
143
+ return sent;
144
+ }
145
+ async emitToRoom(room, event, payload, opts, rateLimitUserId) {
146
+ this.assertRoomAllowed(room);
147
+ this.assertEventName(event);
148
+ const maxBytes = this.settings.get(settings_keys_1.SETTING_KEYS.REALTIME_MAX_PAYLOAD_BYTES);
149
+ const envelope = (0, realtime_types_1.buildEnvelope)(event, payload, opts?.eventId);
150
+ const size = Buffer.byteLength(JSON.stringify(envelope), 'utf8');
151
+ if (size > maxBytes) {
152
+ this.metrics?.recordBusinessEvent('realtime', 'emit', 'payload_too_large');
153
+ if (opts?.dropOnLimit === false) {
154
+ throw new common_1.BadRequestException(realtime_constants_1.REALTIME_CLOSE_CODES.PAYLOAD_TOO_LARGE);
155
+ }
156
+ return false;
157
+ }
158
+ if (opts?.rateLimit && rateLimitUserId) {
159
+ const ok = await this.rateLimiter.allowEmit(rateLimitUserId);
160
+ if (!ok) {
161
+ this.metrics?.recordBusinessEvent('realtime', 'emit', 'rate_limited');
162
+ if (opts?.dropOnLimit === false) {
163
+ throw new common_1.BadRequestException(realtime_constants_1.REALTIME_CLOSE_CODES.RATE_LIMITED);
164
+ }
165
+ return false;
166
+ }
167
+ }
168
+ if (!this.server) {
169
+ this.metrics?.recordBusinessEvent('realtime', 'emit', 'not_ready');
170
+ return false;
171
+ }
172
+ this.server.to(room).emit(event, envelope);
173
+ this.metrics?.recordBusinessEvent('realtime', 'emit', 'success');
174
+ return true;
175
+ }
176
+ async emitToAll(event, payload, opts) {
177
+ this.assertEventName(event);
178
+ if (!this.server)
179
+ return false;
180
+ const envelope = (0, realtime_types_1.buildEnvelope)(event, payload, opts?.eventId);
181
+ const maxBytes = this.settings.get(settings_keys_1.SETTING_KEYS.REALTIME_MAX_PAYLOAD_BYTES);
182
+ if (Buffer.byteLength(JSON.stringify(envelope), 'utf8') > maxBytes) {
183
+ this.metrics?.recordBusinessEvent('realtime', 'emit', 'payload_too_large');
184
+ return false;
185
+ }
186
+ this.server.emit(event, envelope);
187
+ this.metrics?.recordBusinessEvent('realtime', 'emit_all', 'success');
188
+ return true;
189
+ }
190
+ async joinRoom(socket, room) {
191
+ this.assertRoomAllowed(room);
192
+ await socket.join(room);
193
+ }
194
+ /**
195
+ * Add all of a user's connected sockets to an allowlisted room
196
+ * (e.g. `tenant:{id}`, `role:{slug}`) without holding a Socket reference.
197
+ */
198
+ async addUserToRoom(userId, room) {
199
+ this.assertRoomAllowed(room);
200
+ if (!this.server) {
201
+ throw new common_1.BadRequestException('Realtime server is not ready');
202
+ }
203
+ this.server.in((0, realtime_constants_1.userRoom)(userId)).socketsJoin(room);
204
+ }
205
+ /** Remove a user's sockets from an allowlisted room. */
206
+ async removeUserFromRoom(userId, room) {
207
+ this.assertRoomAllowed(room);
208
+ if (!this.server) {
209
+ throw new common_1.BadRequestException('Realtime server is not ready');
210
+ }
211
+ this.server.in((0, realtime_constants_1.userRoom)(userId)).socketsLeave(room);
212
+ }
213
+ /**
214
+ * Admin / explicit disconnect. Applies locally; Socket.IO Redis adapter fans out
215
+ * room emit/disconnect to other instances. Control publish is an origin-tagged
216
+ * backup signal — peers apply disconnect-only (no second session.revoked emit).
217
+ */
218
+ disconnectUser(userId, reason = realtime_constants_1.REALTIME_CLOSE_CODES.SESSION_REVOKED) {
219
+ this.applyDisconnectUser(userId, reason, { emitEvent: true });
220
+ void this.publishControl({
221
+ op: 'disconnect_user',
222
+ userId,
223
+ reason,
224
+ origin: this.instanceId,
225
+ });
226
+ }
227
+ disconnectFamily(familyId, reason = realtime_constants_1.REALTIME_CLOSE_CODES.SESSION_REVOKED) {
228
+ this.applyDisconnectFamily(familyId, reason, { emitEvent: true });
229
+ void this.publishControl({
230
+ op: 'disconnect_family',
231
+ familyId,
232
+ reason,
233
+ origin: this.instanceId,
234
+ });
235
+ }
236
+ /**
237
+ * Session layer entry point — always applies locally (works with REDIS_ENABLED=false).
238
+ * Cross-instance: Socket.IO Redis adapter fans out room disconnect/emit.
239
+ */
240
+ notifySessionRevokedUser(userId) {
241
+ this.disconnectUser(userId, realtime_constants_1.REALTIME_CLOSE_CODES.SESSION_REVOKED);
242
+ }
243
+ notifySessionRevokedFamily(familyId) {
244
+ this.disconnectFamily(familyId, realtime_constants_1.REALTIME_CLOSE_CODES.SESSION_REVOKED);
245
+ }
246
+ /** Local apply — used by gateway ops and control-channel subscriber. */
247
+ applyDisconnectUser(userId, reason = realtime_constants_1.REALTIME_CLOSE_CODES.SESSION_REVOKED, opts = {}) {
248
+ const emitEvent = opts.emitEvent !== false;
249
+ if (!this.server) {
250
+ this.pendingDisconnects.push({ kind: 'user', id: userId, reason, emitEvent });
251
+ return;
252
+ }
253
+ if (emitEvent && this.settings.get(settings_keys_1.SETTING_KEYS.REALTIME_EMIT_SESSION_REVOKED)) {
254
+ this.server
255
+ .to((0, realtime_constants_1.userRoom)(userId))
256
+ .emit(realtime_constants_1.REALTIME_SERVER_EVENTS.SESSION_REVOKED, (0, realtime_types_1.buildEnvelope)(realtime_constants_1.REALTIME_SERVER_EVENTS.SESSION_REVOKED, { reason }));
257
+ }
258
+ this.server.in((0, realtime_constants_1.userRoom)(userId)).disconnectSockets(true);
259
+ this.metrics?.recordBusinessEvent('realtime', 'force_disconnect', 'user');
260
+ }
261
+ applyDisconnectFamily(familyId, reason = realtime_constants_1.REALTIME_CLOSE_CODES.SESSION_REVOKED, opts = {}) {
262
+ const emitEvent = opts.emitEvent !== false;
263
+ if (!this.server) {
264
+ this.pendingDisconnects.push({ kind: 'family', id: familyId, reason, emitEvent });
265
+ return;
266
+ }
267
+ if (emitEvent && this.settings.get(settings_keys_1.SETTING_KEYS.REALTIME_EMIT_SESSION_REVOKED)) {
268
+ this.server
269
+ .to((0, realtime_constants_1.familyRoom)(familyId))
270
+ .emit(realtime_constants_1.REALTIME_SERVER_EVENTS.SESSION_REVOKED, (0, realtime_types_1.buildEnvelope)(realtime_constants_1.REALTIME_SERVER_EVENTS.SESSION_REVOKED, { reason }));
271
+ }
272
+ this.server.in((0, realtime_constants_1.familyRoom)(familyId)).disconnectSockets(true);
273
+ this.metrics?.recordBusinessEvent('realtime', 'force_disconnect', 'family');
274
+ }
275
+ async isOnline(userId) {
276
+ return this.presence.isOnline(userId);
277
+ }
278
+ async getPresence(userId) {
279
+ return this.presence.getPresence(userId);
280
+ }
281
+ /** Bind Redis control subscriber (called from adapter lifecycle when Redis on). */
282
+ bindControlSubscriber(sub) {
283
+ void sub
284
+ .subscribe(realtime_constants_1.REALTIME_CONTROL_CHANNEL, (raw) => {
285
+ try {
286
+ const msg = JSON.parse(raw);
287
+ if (msg.origin && msg.origin === this.instanceId) {
288
+ return;
289
+ }
290
+ if (msg.op === 'disconnect_user') {
291
+ // Emit already fanned out via Socket.IO Redis adapter from origin.
292
+ this.applyDisconnectUser(msg.userId, msg.reason ?? realtime_constants_1.REALTIME_CLOSE_CODES.SESSION_REVOKED, { emitEvent: false });
293
+ }
294
+ else if (msg.op === 'disconnect_family') {
295
+ this.applyDisconnectFamily(msg.familyId, msg.reason ?? realtime_constants_1.REALTIME_CLOSE_CODES.SESSION_REVOKED, { emitEvent: false });
296
+ }
297
+ }
298
+ catch (err) {
299
+ this.logger.warn(`Invalid realtime control message: ${err instanceof Error ? err.message : String(err)}`);
300
+ }
301
+ })
302
+ .then(() => {
303
+ this.controlSub = sub;
304
+ })
305
+ .catch((err) => {
306
+ this.logger.error(`Failed to subscribe realtime control channel: ${err instanceof Error ? err.message : String(err)}`);
307
+ });
308
+ }
309
+ async publishControl(msg) {
310
+ try {
311
+ await this.redis.publish(realtime_constants_1.REALTIME_CONTROL_CHANNEL, JSON.stringify(msg));
312
+ }
313
+ catch (err) {
314
+ this.logger.debug(`Realtime control publish skipped: ${err instanceof Error ? err.message : String(err)}`);
315
+ }
316
+ }
317
+ assertRoomAllowed(room) {
318
+ const ok = realtime_constants_1.REALTIME_ROOM_PREFIX_ALLOWLIST.some((p) => room.startsWith(p));
319
+ if (!ok || room.includes('*') || room.includes(',')) {
320
+ throw new common_1.BadRequestException(`Realtime room "${room}" is not allowlisted`);
321
+ }
322
+ }
323
+ assertEventName(event) {
324
+ if (!event || event.length > 128 || !/^[a-zA-Z][a-zA-Z0-9_.:-]*$/.test(event)) {
325
+ throw new common_1.BadRequestException('Invalid realtime event name');
326
+ }
327
+ }
328
+ };
329
+ exports.RealtimeService = RealtimeService;
330
+ exports.RealtimeService = RealtimeService = RealtimeService_1 = __decorate([
331
+ (0, common_1.Injectable)(),
332
+ __param(6, (0, common_1.Inject)(redis_module_1.REDIS_CLIENT)),
333
+ __param(7, (0, common_1.Optional)()),
334
+ __metadata("design:paramtypes", [jwt_1.JwtService,
335
+ access_token_validator_1.AccessTokenValidator,
336
+ realtime_presence_service_1.RealtimePresenceService,
337
+ realtime_rate_limiter_service_1.RealtimeRateLimiterService,
338
+ settings_service_1.SettingsService,
339
+ config_1.ConfigService,
340
+ ioredis_1.default,
341
+ metrics_service_1.MetricsService])
342
+ ], RealtimeService);
343
+ //# sourceMappingURL=realtime.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"realtime.service.js","sourceRoot":"","sources":["../../../../src/modules/realtime/services/realtime.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAAA,2CAQwB;AACxB,2CAA+C;AAC/C,qCAAyC;AACzC,mCAAoC;AACpC,sDAA8B;AAG9B,iEAAoE;AACpE,+DAA4D;AAC5D,iGAA4F;AAE5F,iFAA6E;AAC7E,0EAAsE;AACtE,+EAA2E;AAC3E,wEAQyC;AAOzC,4DAAwD;AACxD,2EAAsE;AACtE,mFAA6E;AAGtE,IAAM,eAAe,uBAArB,MAAM,eAAe;IAcT;IACA;IACA;IACA;IACA;IACA;IACsB;IACV;IApBb,MAAM,GAAG,IAAI,eAAM,C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B,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;QAC1E,IAAI,CAAC,EAAE,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;YACrD,MAAM,IAAI,4BAAmB,CAAC,kBAAkB,IAAI,sBAAsB,CAAC,CAAC;QAC7E,CAAC;IACF,CAAC;IAEO,eAAe,CAAC,KAAa;QACpC,IAAI,CAAC,KAAK,IAAI,KAAK,CAAC,MAAM,GAAG,GAAG,IAAI,CAAC,4BAA4B,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;YAC/E,MAAM,IAAI,4BAAmB,CAAC,6BAA6B,CAAC,CAAC;QAC9D,CAAC;IACF,CAAC;CACD,CAAA;AAxXY,0CAAe;0BAAf,eAAe;IAD3B,IAAA,mBAAU,GAAE;IAqBV,WAAA,IAAA,eAAM,EAAC,2BAAY,CAAC,CAAA;IACpB,WAAA,IAAA,iBAAQ,GAAE,CAAA;qCAPkB,gBAAU;QACA,6CAAoB;QAChC,mDAAuB;QACpB,0DAA0B;QAC7B,kCAAe;QACV,sBAAa;QACC,iBAAO;QACd,gCAAc;GArB1C,eAAe,CAwX3B"}
@@ -0,0 +1,50 @@
1
+ import type { RequestUser } from '../../../common/interfaces/request-user';
2
+ import { REALTIME_ENVELOPE_VERSION } from '../constants/realtime.constants';
3
+ export interface RealtimeEnvelope<T = unknown> {
4
+ v: typeof REALTIME_ENVELOPE_VERSION;
5
+ event: string;
6
+ payload: T;
7
+ eventId?: string;
8
+ at: string;
9
+ }
10
+ export interface RealtimeEmitOptions {
11
+ eventId?: string;
12
+ /** Skip emit when over size/rate limits (default true → drop + metric). */
13
+ dropOnLimit?: boolean;
14
+ /**
15
+ * Apply per-user server-emit rate limit. Default false — server pushes
16
+ * (notifications, domain events) should not be silently dropped.
17
+ */
18
+ rateLimit?: boolean;
19
+ }
20
+ /** Public presence view — never includes raw socket IDs. */
21
+ export interface RealtimePresence {
22
+ userId: string;
23
+ online: boolean;
24
+ connectionCount: number;
25
+ lastSeenAt: string | null;
26
+ }
27
+ export interface RealtimeSocketData {
28
+ user: RequestUser;
29
+ connectedAt: number;
30
+ /** Exp (unix seconds) from access token for reauth/expiry checks. */
31
+ tokenExp?: number;
32
+ }
33
+ export type RealtimeControlMessage = {
34
+ op: 'disconnect_user';
35
+ userId: string;
36
+ reason?: string;
37
+ origin?: string;
38
+ } | {
39
+ op: 'disconnect_family';
40
+ familyId: string;
41
+ reason?: string;
42
+ origin?: string;
43
+ };
44
+ export type RealtimeDisconnectReason = string;
45
+ export type RealtimeInboundHandler = (user: RequestUser, payload: unknown, meta: {
46
+ socketId: string;
47
+ event: string;
48
+ }) => void | Promise<void>;
49
+ export declare function buildEnvelope<T>(event: string, payload: T, eventId?: string): RealtimeEnvelope<T>;
50
+ //# sourceMappingURL=realtime.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"realtime.types.d.ts","sourceRoot":"","sources":["../../../../src/modules/realtime/types/realtime.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yCAAyC,CAAC;AAC3E,OAAO,EAAE,yBAAyB,EAAE,MAAM,iCAAiC,CAAC;AAE5E,MAAM,WAAW,gBAAgB,CAAC,CAAC,GAAG,OAAO;IAC5C,CAAC,EAAE,OAAO,yBAAyB,CAAC;IACpC,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,CAAC,CAAC;IACX,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,EAAE,EAAE,MAAM,CAAC;CACX;AAED,MAAM,WAAW,mBAAmB;IACnC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,2EAA2E;IAC3E,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,4DAA4D;AAC5D,MAAM,WAAW,gBAAgB;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,OAAO,CAAC;IAChB,eAAe,EAAE,MAAM,CAAC;IACxB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B;AAED,MAAM,WAAW,kBAAkB;IAClC,IAAI,EAAE,WAAW,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,qEAAqE;IACrE,QAAQ,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,MAAM,sBAAsB,GAC/B;IAAE,EAAE,EAAE,iBAAiB,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,GAC3E;IAAE,EAAE,EAAE,mBAAmB,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAEnF,MAAM,MAAM,wBAAwB,GAAG,MAAM,CAAC;AAE9C,MAAM,MAAM,sBAAsB,GAAG,CACpC,IAAI,EAAE,WAAW,EACjB,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,KACrC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AAE1B,wBAAgB,aAAa,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,gBAAgB,CAAC,CAAC,CAAC,CAQjG"}
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.buildEnvelope = buildEnvelope;
4
+ const realtime_constants_1 = require("../constants/realtime.constants");
5
+ function buildEnvelope(event, payload, eventId) {
6
+ return {
7
+ v: realtime_constants_1.REALTIME_ENVELOPE_VERSION,
8
+ event,
9
+ payload,
10
+ ...(eventId ? { eventId } : {}),
11
+ at: new Date().toISOString(),
12
+ };
13
+ }
14
+ //# sourceMappingURL=realtime.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"realtime.types.js","sourceRoot":"","sources":["../../../../src/modules/realtime/types/realtime.types.ts"],"names":[],"mappings":";;AAiDA,sCAQC;AAxDD,wEAA4E;AAgD5E,SAAgB,aAAa,CAAI,KAAa,EAAE,OAAU,EAAE,OAAgB;IAC3E,OAAO;QACN,CAAC,EAAE,8CAAyB;QAC5B,KAAK;QACL,OAAO;QACP,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC/B,EAAE,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;KAC5B,CAAC;AACH,CAAC"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Map auth failures from {@link AccessTokenValidator} / JWT verify onto client close codes.
3
+ */
4
+ export declare function mapRealtimeHandshakeError(err: unknown): string;
5
+ //# sourceMappingURL=handshake-error.util.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handshake-error.util.d.ts","sourceRoot":"","sources":["../../../../src/modules/realtime/utils/handshake-error.util.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,wBAAgB,yBAAyB,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,CAyB9D"}
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.mapRealtimeHandshakeError = mapRealtimeHandshakeError;
4
+ const common_1 = require("@nestjs/common");
5
+ const realtime_constants_1 = require("../constants/realtime.constants");
6
+ /**
7
+ * Map auth failures from {@link AccessTokenValidator} / JWT verify onto client close codes.
8
+ */
9
+ function mapRealtimeHandshakeError(err) {
10
+ if (err instanceof Error && err.message === realtime_constants_1.REALTIME_CLOSE_CODES.UNAUTHORIZED) {
11
+ return realtime_constants_1.REALTIME_CLOSE_CODES.UNAUTHORIZED;
12
+ }
13
+ if (err instanceof Error && err.message === realtime_constants_1.REALTIME_CLOSE_CODES.TOKEN_EXPIRED) {
14
+ return realtime_constants_1.REALTIME_CLOSE_CODES.TOKEN_EXPIRED;
15
+ }
16
+ if (err instanceof Error && err.message === realtime_constants_1.REALTIME_CLOSE_CODES.SESSION_REVOKED) {
17
+ return realtime_constants_1.REALTIME_CLOSE_CODES.SESSION_REVOKED;
18
+ }
19
+ const msg = err instanceof common_1.UnauthorizedException
20
+ ? extractUnauthorizedMessage(err)
21
+ : err instanceof Error
22
+ ? err.message
23
+ : String(err);
24
+ if (/session has been revoked|token has been revoked|outdated/i.test(msg)) {
25
+ return realtime_constants_1.REALTIME_CLOSE_CODES.SESSION_REVOKED;
26
+ }
27
+ if (/expired/i.test(msg)) {
28
+ return realtime_constants_1.REALTIME_CLOSE_CODES.TOKEN_EXPIRED;
29
+ }
30
+ return realtime_constants_1.REALTIME_CLOSE_CODES.UNAUTHORIZED;
31
+ }
32
+ function extractUnauthorizedMessage(err) {
33
+ const response = err.getResponse();
34
+ if (typeof response === 'string')
35
+ return response;
36
+ if (response && typeof response === 'object' && 'message' in response) {
37
+ const message = response.message;
38
+ if (typeof message === 'string')
39
+ return message;
40
+ if (Array.isArray(message))
41
+ return message.map(String).join(' ');
42
+ }
43
+ return err.message;
44
+ }
45
+ //# sourceMappingURL=handshake-error.util.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handshake-error.util.js","sourceRoot":"","sources":["../../../../src/modules/realtime/utils/handshake-error.util.ts"],"names":[],"mappings":";;AAOA,8DAyBC;AAhCD,2CAAuD;AAEvD,wEAAuE;AAEvE;;GAEG;AACH,SAAgB,yBAAyB,CAAC,GAAY;IACrD,IAAI,GAAG,YAAY,KAAK,IAAI,GAAG,CAAC,OAAO,KAAK,yCAAoB,CAAC,YAAY,EAAE,CAAC;QAC/E,OAAO,yCAAoB,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G,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAClE,CAAC;IACD,OAAO,GAAG,CAAC,OAAO,CAAC;AACpB,CAAC"}
@@ -1,13 +1,14 @@
1
+ import { RequestUser } from '../../../common/interfaces/request-user';
1
2
  import { CreateModuleDto, UpdateModuleDto } from '../dto';
2
3
  import { ModulesService } from '../services';
3
4
  export declare class ModulesController {
4
5
  private readonly modulesService;
5
6
  constructor(modulesService: ModulesService);
6
- create(dto: CreateModuleDto): Promise<import("..").FeatureModule>;
7
+ create(dto: CreateModuleDto, actor: RequestUser): Promise<import("..").FeatureModule>;
7
8
  findAll(): Promise<import("..").FeatureModule[]>;
8
9
  findOne(id: string): Promise<import("..").FeatureModule>;
9
- update(id: string, dto: UpdateModuleDto): Promise<import("..").FeatureModule>;
10
- delete(id: string): Promise<{
10
+ update(id: string, dto: UpdateModuleDto, actor: RequestUser): Promise<import("..").FeatureModule>;
11
+ delete(id: string, actor: RequestUser): Promise<{
11
12
  message: string;
12
13
  }>;
13
14
  }
@@ -1 +1 @@
1
- {"version":3,"file":"modules.controller.d.ts","sourceRoot":"","sources":["../../../../src/modules/roles/controllers/modules.controller.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE7C,qBAEa,iBAAiB;IACjB,OAAO,CAAC,QAAQ,CAAC,cAAc;gBAAd,cAAc,EAAE,cAAc;IAG3D,MAAM,CAAS,GAAG,EAAE,eAAe;IAKnC,OAAO;IAKP,OAAO,CAA6B,EAAE,EAAE,MAAM;IAK9C,MAAM,CAA6B,EAAE,EAAE,MAAM,EAAU,GAAG,EAAE,eAAe;IAKrE,MAAM,CAA6B,EAAE,EAAE,MAAM;;;CAInD"}
1
+ {"version":3,"file":"modules.controller.d.ts","sourceRoot":"","sources":["../../../../src/modules/roles/controllers/modules.controller.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,WAAW,EAAE,MAAM,yCAAyC,CAAC;AACtE,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AAE1D,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE7C,qBAEa,iBAAiB;IACjB,OAAO,CAAC,QAAQ,CAAC,cAAc;gBAAd,cAAc,EAAE,cAAc;IAI3D,MAAM,CAAS,GAAG,EAAE,eAAe,EAAiB,KAAK,EAAE,WAAW;IAMtE,OAAO;IAMP,OAAO,CAA6B,EAAE,EAAE,MAAM;IAM9C,MAAM,CACuB,EAAE,EAAE,MAAM,EAC9B,GAAG,EAAE,eAAe,EACb,KAAK,EAAE,WAAW;IAO5B,MAAM,CAA6B,EAAE,EAAE,MAAM,EAAiB,KAAK,EAAE,WAAW;;;CAItF"}
@@ -14,16 +14,19 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.ModulesController = void 0;
16
16
  const common_1 = require("@nestjs/common");
17
+ const decorators_1 = require("../../../common/decorators");
17
18
  const auth_guard_1 = require("../../../common/guards/auth.guard");
19
+ const permissions_guard_1 = require("../../../common/guards/permissions.guard");
18
20
  const dto_1 = require("../dto");
21
+ const roles_manifest_1 = require("../roles.manifest");
19
22
  const services_1 = require("../services");
20
23
  let ModulesController = class ModulesController {
21
24
  modulesService;
22
25
  constructor(modulesService) {
23
26
  this.modulesService = modulesService;
24
27
  }
25
- create(dto) {
26
- return this.modulesService.create(dto);
28
+ create(dto, actor) {
29
+ return this.modulesService.create(dto, actor.id);
27
30
  }
28
31
  findAll() {
29
32
  return this.modulesService.findAll();
@@ -31,30 +34,34 @@ let ModulesController = class ModulesController {
31
34
  findOne(id) {
32
35
  return this.modulesService.findById(id);
33
36
  }
34
- update(id, dto) {
35
- return this.modulesService.update(id, dto);
37
+ update(id, dto, actor) {
38
+ return this.modulesService.update(id, dto, actor.id);
36
39
  }
37
- async delete(id) {
38
- await this.modulesService.delete(id);
40
+ async delete(id, actor) {
41
+ await this.modulesService.delete(id, actor.id);
39
42
  return { message: 'Module deleted' };
40
43
  }
41
44
  };
42
45
  exports.ModulesController = ModulesController;
43
46
  __decorate([
44
47
  (0, common_1.Post)(),
48
+ (0, decorators_1.RequirePermission)(roles_manifest_1.ROLES_PERMISSIONS.MODULES_MANAGE),
45
49
  __param(0, (0, common_1.Body)()),
50
+ __param(1, (0, decorators_1.CurrentUser)()),
46
51
  __metadata("design:type", Function),
47
- __metadata("design:paramtypes", [dto_1.CreateModuleDto]),
52
+ __metadata("design:paramtypes", [dto_1.CreateModuleDto, Object]),
48
53
  __metadata("design:returntype", void 0)
49
54
  ], ModulesController.prototype, "create", null);
50
55
  __decorate([
51
56
  (0, common_1.Get)(),
57
+ (0, decorators_1.RequirePermission)(roles_manifest_1.ROLES_PERMISSIONS.READ),
52
58
  __metadata("design:type", Function),
53
59
  __metadata("design:paramtypes", []),
54
60
  __metadata("design:returntype", void 0)
55
61
  ], ModulesController.prototype, "findAll", null);
56
62
  __decorate([
57
63
  (0, common_1.Get)(':id'),
64
+ (0, decorators_1.RequirePermission)(roles_manifest_1.ROLES_PERMISSIONS.READ),
58
65
  __param(0, (0, common_1.Param)('id', common_1.ParseUUIDPipe)),
59
66
  __metadata("design:type", Function),
60
67
  __metadata("design:paramtypes", [String]),
@@ -62,22 +69,26 @@ __decorate([
62
69
  ], ModulesController.prototype, "findOne", null);
63
70
  __decorate([
64
71
  (0, common_1.Patch)(':id'),
72
+ (0, decorators_1.RequirePermission)(roles_manifest_1.ROLES_PERMISSIONS.MODULES_MANAGE),
65
73
  __param(0, (0, common_1.Param)('id', common_1.ParseUUIDPipe)),
66
74
  __param(1, (0, common_1.Body)()),
75
+ __param(2, (0, decorators_1.CurrentUser)()),
67
76
  __metadata("design:type", Function),
68
- __metadata("design:paramtypes", [String, dto_1.UpdateModuleDto]),
77
+ __metadata("design:paramtypes", [String, dto_1.UpdateModuleDto, Object]),
69
78
  __metadata("design:returntype", void 0)
70
79
  ], ModulesController.prototype, "update", null);
71
80
  __decorate([
72
81
  (0, common_1.Delete)(':id'),
82
+ (0, decorators_1.RequirePermission)(roles_manifest_1.ROLES_PERMISSIONS.MODULES_MANAGE),
73
83
  __param(0, (0, common_1.Param)('id', common_1.ParseUUIDPipe)),
84
+ __param(1, (0, decorators_1.CurrentUser)()),
74
85
  __metadata("design:type", Function),
75
- __metadata("design:paramtypes", [String]),
86
+ __metadata("design:paramtypes", [String, Object]),
76
87
  __metadata("design:returntype", Promise)
77
88
  ], ModulesController.prototype, "delete", null);
78
89
  exports.ModulesController = ModulesController = __decorate([
79
90
  (0, common_1.Controller)('modules'),
80
- (0, common_1.UseGuards)(auth_guard_1.JwtAuthGuard),
91
+ (0, common_1.UseGuards)(auth_guard_1.JwtAuthGuard, permissions_guard_1.PermissionsGuard),
81
92
  __metadata("design:paramtypes", [services_1.ModulesService])
82
93
  ], ModulesController);
83
94
  //# sourceMappingURL=modules.controller.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"modules.controller.js","sourceRoot":"","sources":["../../../../src/modules/roles/controllers/modules.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAUwB;AAExB,kEAAiE;AACjE,gCAA0D;AAC1D,0CAA6C;AAItC,IAAM,iBAAiB,GAAvB,MAAM,iBAAiB;IACA;IAA7B,YAA6B,cAA8B;QAA9B,mBAAc,GAAd,cAAc,CAAgB;IAAG,CAAC;IAG/D,MAAM,CAAS,GAAoB;QAClC,OAAO,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IACxC,CAAC;IAGD,OAAO;QACN,OAAO,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,CAAC;IACtC,CAAC;IAGD,OAAO,CAA6B,EAAU;QAC7C,OAAO,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;IACzC,CAAC;IAGD,MAAM,CAA6B,EAAU,EAAU,GAAoB;QAC1E,OAAO,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,EAAE,EAAE,GAAG,CAAC,CAAC;IAC5C,CAAC;IAGK,AAAN,KAAK,CAAC,MAAM,CAA6B,EAAU;QAClD,MAAM,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QACrC,OAAO,EAAE,OAAO,EAAE,gBAAgB,EAAE,CAAC;IACtC,CAAC;CACD,CAAA;AA5BY,8CAAiB;AAI7B;IADC,IAAA,aAAI,GAAE;IACC,WAAA,IAAA,aAAI,GAAE,CAAA;;qCAAM,qBAAe;;+CAElC;AAGD;IADC,IAAA,YAAG,GAAE;;;;gDAGL;AAGD;IADC,IAAA,YAAG,EAAC,KAAK,CAAC;IACF,WAAA,IAAA,cAAK,EAAC,IAAI,EAAE,sBAAa,CAAC,CAAA;;;;gDAElC;AAGD;IADC,IAAA,cAAK,EAAC,KAAK,CAAC;IACL,WAAA,IAAA,cAAK,EAAC,IAAI,EAAE,sBAAa,CAAC,CAAA;IAAc,WAAA,IAAA,aAAI,GAAE,CAAA;;6CAAM,qBAAe;;+CAE1E;AAGK;IADL,IAAA,eAAM,EAAC,KAAK,CAAC;IACA,WAAA,IAAA,cAAK,EAAC,IAAI,EAAE,sBAAa,CAAC,CAAA;;;;+CAGvC;4BA3BW,iBAAiB;IAF7B,IAAA,mBAAU,EAAC,SAAS,CAAC;IACrB,IAAA,kBAAS,EAAC,yBAAY,CAAC;qCAEsB,yBAAc;GAD/C,iBAAiB,CA4B7B"}
1
+ {"version":3,"file":"modules.controller.js","sourceRoot":"","sources":["../../../../src/modules/roles/controllers/modules.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAUwB;AAExB,2DAA4E;AAC5E,kEAAiE;AACjE,gFAA4E;AAE5E,gCAA0D;AAC1D,sDAAsD;AACtD,0CAA6C;AAItC,IAAM,iBAAiB,GAAvB,MAAM,iBAAiB;IACA;IAA7B,YAA6B,cA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