@skyapp-labs/blueprint-backend-core 1.0.9

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 (737) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/README.md +954 -0
  3. package/dist/common/base/base.entity.d.ts +12 -0
  4. package/dist/common/base/base.entity.d.ts.map +1 -0
  5. package/dist/common/base/base.entity.js +48 -0
  6. package/dist/common/base/base.entity.js.map +1 -0
  7. package/dist/common/base/base.repository.d.ts +26 -0
  8. package/dist/common/base/base.repository.d.ts.map +1 -0
  9. package/dist/common/base/base.repository.js +61 -0
  10. package/dist/common/base/base.repository.js.map +1 -0
  11. package/dist/common/constants/index.d.ts +9 -0
  12. package/dist/common/constants/index.d.ts.map +1 -0
  13. package/dist/common/constants/index.js +13 -0
  14. package/dist/common/constants/index.js.map +1 -0
  15. package/dist/common/decorators/auth-method-aware.decorator.d.ts +3 -0
  16. package/dist/common/decorators/auth-method-aware.decorator.d.ts.map +1 -0
  17. package/dist/common/decorators/auth-method-aware.decorator.js +8 -0
  18. package/dist/common/decorators/auth-method-aware.decorator.js.map +1 -0
  19. package/dist/common/decorators/index.d.ts +8 -0
  20. package/dist/common/decorators/index.d.ts.map +1 -0
  21. package/dist/common/decorators/index.js +24 -0
  22. package/dist/common/decorators/index.js.map +1 -0
  23. package/dist/common/dto/index.d.ts +2 -0
  24. package/dist/common/dto/index.d.ts.map +1 -0
  25. package/dist/common/dto/index.js +18 -0
  26. package/dist/common/dto/index.js.map +1 -0
  27. package/dist/common/dto/pagination.dto.d.ts +6 -0
  28. package/dist/common/dto/pagination.dto.d.ts.map +1 -0
  29. package/dist/common/dto/pagination.dto.js +45 -0
  30. package/dist/common/dto/pagination.dto.js.map +1 -0
  31. package/dist/common/filters/http-exception.filter.d.ts +9 -0
  32. package/dist/common/filters/http-exception.filter.d.ts.map +1 -0
  33. package/dist/common/filters/http-exception.filter.js +71 -0
  34. package/dist/common/filters/http-exception.filter.js.map +1 -0
  35. package/dist/common/filters/index.d.ts +2 -0
  36. package/dist/common/filters/index.d.ts.map +1 -0
  37. package/dist/common/filters/index.js +18 -0
  38. package/dist/common/filters/index.js.map +1 -0
  39. package/dist/common/guards/auth.guard.d.ts +11 -0
  40. package/dist/common/guards/auth.guard.d.ts.map +1 -0
  41. package/dist/common/guards/auth.guard.js +42 -0
  42. package/dist/common/guards/auth.guard.js.map +1 -0
  43. package/dist/common/guards/index.d.ts +5 -0
  44. package/dist/common/guards/index.d.ts.map +1 -0
  45. package/dist/common/guards/index.js +21 -0
  46. package/dist/common/guards/index.js.map +1 -0
  47. package/dist/common/guards/login-ip-rate-limit.guard.d.ts +12 -0
  48. package/dist/common/guards/login-ip-rate-limit.guard.d.ts.map +1 -0
  49. package/dist/common/guards/login-ip-rate-limit.guard.js +70 -0
  50. package/dist/common/guards/login-ip-rate-limit.guard.js.map +1 -0
  51. package/dist/common/guards/otp-ip-rate-limit.guard.d.ts +12 -0
  52. package/dist/common/guards/otp-ip-rate-limit.guard.d.ts.map +1 -0
  53. package/dist/common/guards/otp-ip-rate-limit.guard.js +70 -0
  54. package/dist/common/guards/otp-ip-rate-limit.guard.js.map +1 -0
  55. package/dist/common/guards/permissions.guard.d.ts +8 -0
  56. package/dist/common/guards/permissions.guard.d.ts.map +1 -0
  57. package/dist/common/guards/permissions.guard.js +41 -0
  58. package/dist/common/guards/permissions.guard.js.map +1 -0
  59. package/dist/common/index.d.ts +13 -0
  60. package/dist/common/index.d.ts.map +1 -0
  61. package/dist/common/index.js +33 -0
  62. package/dist/common/index.js.map +1 -0
  63. package/dist/common/interceptors/index.d.ts +2 -0
  64. package/dist/common/interceptors/index.d.ts.map +1 -0
  65. package/dist/common/interceptors/index.js +18 -0
  66. package/dist/common/interceptors/index.js.map +1 -0
  67. package/dist/common/interceptors/logging.interceptor.d.ts +10 -0
  68. package/dist/common/interceptors/logging.interceptor.d.ts.map +1 -0
  69. package/dist/common/interceptors/logging.interceptor.js +50 -0
  70. package/dist/common/interceptors/logging.interceptor.js.map +1 -0
  71. package/dist/common/interfaces/index.d.ts +2 -0
  72. package/dist/common/interfaces/index.d.ts.map +1 -0
  73. package/dist/common/interfaces/index.js +18 -0
  74. package/dist/common/interfaces/index.js.map +1 -0
  75. package/dist/common/interfaces/request-user.interface.d.ts +5 -0
  76. package/dist/common/interfaces/request-user.interface.d.ts.map +1 -0
  77. package/dist/common/interfaces/request-user.interface.js +3 -0
  78. package/dist/common/interfaces/request-user.interface.js.map +1 -0
  79. package/dist/common/middlewares/index.d.ts +6 -0
  80. package/dist/common/middlewares/index.d.ts.map +1 -0
  81. package/dist/common/middlewares/index.js +23 -0
  82. package/dist/common/middlewares/index.js.map +1 -0
  83. package/dist/common/pipes/config-aware-validation.pipe.d.ts +9 -0
  84. package/dist/common/pipes/config-aware-validation.pipe.d.ts.map +1 -0
  85. package/dist/common/pipes/config-aware-validation.pipe.js +38 -0
  86. package/dist/common/pipes/config-aware-validation.pipe.js.map +1 -0
  87. package/dist/common/pipes/index.d.ts +14 -0
  88. package/dist/common/pipes/index.d.ts.map +1 -0
  89. package/dist/common/pipes/index.js +62 -0
  90. package/dist/common/pipes/index.js.map +1 -0
  91. package/dist/common/utils/index.d.ts +8 -0
  92. package/dist/common/utils/index.d.ts.map +1 -0
  93. package/dist/common/utils/index.js +33 -0
  94. package/dist/common/utils/index.js.map +1 -0
  95. package/dist/common/utils/request.utils.d.ts +7 -0
  96. package/dist/common/utils/request.utils.d.ts.map +1 -0
  97. package/dist/common/utils/request.utils.js +12 -0
  98. package/dist/common/utils/request.utils.js.map +1 -0
  99. package/dist/config/app.config.d.ts +66 -0
  100. package/dist/config/app.config.d.ts.map +1 -0
  101. package/dist/config/app.config.js +43 -0
  102. package/dist/config/app.config.js.map +1 -0
  103. package/dist/config/database.config.d.ts +16 -0
  104. package/dist/config/database.config.d.ts.map +1 -0
  105. package/dist/config/database.config.js +13 -0
  106. package/dist/config/database.config.js.map +1 -0
  107. package/dist/config/env.validation.d.ts +34 -0
  108. package/dist/config/env.validation.d.ts.map +1 -0
  109. package/dist/config/env.validation.js +172 -0
  110. package/dist/config/env.validation.js.map +1 -0
  111. package/dist/config/firebase.module.d.ts +5 -0
  112. package/dist/config/firebase.module.d.ts.map +1 -0
  113. package/dist/config/firebase.module.js +21 -0
  114. package/dist/config/firebase.module.js.map +1 -0
  115. package/dist/config/index.d.ts +7 -0
  116. package/dist/config/index.d.ts.map +1 -0
  117. package/dist/config/index.js +17 -0
  118. package/dist/config/index.js.map +1 -0
  119. package/dist/config/keycloak.module.d.ts +6 -0
  120. package/dist/config/keycloak.module.d.ts.map +1 -0
  121. package/dist/config/keycloak.module.js +92 -0
  122. package/dist/config/keycloak.module.js.map +1 -0
  123. package/dist/config/redis.module.d.ts +10 -0
  124. package/dist/config/redis.module.d.ts.map +1 -0
  125. package/dist/config/redis.module.js +111 -0
  126. package/dist/config/redis.module.js.map +1 -0
  127. package/dist/core.module.d.ts +12 -0
  128. package/dist/core.module.d.ts.map +1 -0
  129. package/dist/core.module.js +53 -0
  130. package/dist/core.module.js.map +1 -0
  131. package/dist/database/data-source.d.ts +5 -0
  132. package/dist/database/data-source.d.ts.map +1 -0
  133. package/dist/database/data-source.js +56 -0
  134. package/dist/database/data-source.js.map +1 -0
  135. package/dist/database/migrations/1775258543167-full-schema.d.ts +7 -0
  136. package/dist/database/migrations/1775258543167-full-schema.d.ts.map +1 -0
  137. package/dist/database/migrations/1775258543167-full-schema.js +100 -0
  138. package/dist/database/migrations/1775258543167-full-schema.js.map +1 -0
  139. package/dist/database/seeds/roles.seed.d.ts +11 -0
  140. package/dist/database/seeds/roles.seed.d.ts.map +1 -0
  141. package/dist/database/seeds/roles.seed.js +66 -0
  142. package/dist/database/seeds/roles.seed.js.map +1 -0
  143. package/dist/database/seeds/run-seed.d.ts +2 -0
  144. package/dist/database/seeds/run-seed.d.ts.map +1 -0
  145. package/dist/database/seeds/run-seed.js +32 -0
  146. package/dist/database/seeds/run-seed.js.map +1 -0
  147. package/dist/database/seeds/settings.seed.d.ts +9 -0
  148. package/dist/database/seeds/settings.seed.d.ts.map +1 -0
  149. package/dist/database/seeds/settings.seed.js +450 -0
  150. package/dist/database/seeds/settings.seed.js.map +1 -0
  151. package/dist/database/seeds/user.seed.d.ts +9 -0
  152. package/dist/database/seeds/user.seed.d.ts.map +1 -0
  153. package/dist/database/seeds/user.seed.js +90 -0
  154. package/dist/database/seeds/user.seed.js.map +1 -0
  155. package/dist/database/typeorm.service.d.ts +13 -0
  156. package/dist/database/typeorm.service.d.ts.map +1 -0
  157. package/dist/database/typeorm.service.js +52 -0
  158. package/dist/database/typeorm.service.js.map +1 -0
  159. package/dist/health/health.controller.d.ts +29 -0
  160. package/dist/health/health.controller.d.ts.map +1 -0
  161. package/dist/health/health.controller.js +182 -0
  162. package/dist/health/health.controller.js.map +1 -0
  163. package/dist/health/health.module.d.ts +3 -0
  164. package/dist/health/health.module.d.ts.map +1 -0
  165. package/dist/health/health.module.js +50 -0
  166. package/dist/health/health.module.js.map +1 -0
  167. package/dist/index.d.ts +40 -0
  168. package/dist/index.d.ts.map +1 -0
  169. package/dist/index.js +79 -0
  170. package/dist/index.js.map +1 -0
  171. package/dist/jobs/index.d.ts +6 -0
  172. package/dist/jobs/index.d.ts.map +1 -0
  173. package/dist/jobs/index.js +10 -0
  174. package/dist/jobs/index.js.map +1 -0
  175. package/dist/jobs/jobs.module.d.ts +6 -0
  176. package/dist/jobs/jobs.module.d.ts.map +1 -0
  177. package/dist/jobs/jobs.module.js +63 -0
  178. package/dist/jobs/jobs.module.js.map +1 -0
  179. package/dist/jobs/processors/jobs.processor.d.ts +24 -0
  180. package/dist/jobs/processors/jobs.processor.d.ts.map +1 -0
  181. package/dist/jobs/processors/jobs.processor.js +164 -0
  182. package/dist/jobs/processors/jobs.processor.js.map +1 -0
  183. package/dist/jobs/queues/jobs.queue.d.ts +25 -0
  184. package/dist/jobs/queues/jobs.queue.d.ts.map +1 -0
  185. package/dist/jobs/queues/jobs.queue.js +55 -0
  186. package/dist/jobs/queues/jobs.queue.js.map +1 -0
  187. package/dist/jobs/queues/queue-names.d.ts +5 -0
  188. package/dist/jobs/queues/queue-names.d.ts.map +1 -0
  189. package/dist/jobs/queues/queue-names.js +7 -0
  190. package/dist/jobs/queues/queue-names.js.map +1 -0
  191. package/dist/modules/admin/admin.module.d.ts +3 -0
  192. package/dist/modules/admin/admin.module.d.ts.map +1 -0
  193. package/dist/modules/admin/admin.module.js +24 -0
  194. package/dist/modules/admin/admin.module.js.map +1 -0
  195. package/dist/modules/admin/controllers/admin.controller.d.ts +27 -0
  196. package/dist/modules/admin/controllers/admin.controller.d.ts.map +1 -0
  197. package/dist/modules/admin/controllers/admin.controller.js +110 -0
  198. package/dist/modules/admin/controllers/admin.controller.js.map +1 -0
  199. package/dist/modules/admin/dto/admin-log.dto.d.ts +17 -0
  200. package/dist/modules/admin/dto/admin-log.dto.d.ts.map +1 -0
  201. package/dist/modules/admin/dto/admin-log.dto.js +57 -0
  202. package/dist/modules/admin/dto/admin-log.dto.js.map +1 -0
  203. package/dist/modules/admin/entities/admin-log.entity.d.ts +12 -0
  204. package/dist/modules/admin/entities/admin-log.entity.d.ts.map +1 -0
  205. package/dist/modules/admin/entities/admin-log.entity.js +53 -0
  206. package/dist/modules/admin/entities/admin-log.entity.js.map +1 -0
  207. package/dist/modules/admin/services/admin-log.service.d.ts +11 -0
  208. package/dist/modules/admin/services/admin-log.service.d.ts.map +1 -0
  209. package/dist/modules/admin/services/admin-log.service.js +60 -0
  210. package/dist/modules/admin/services/admin-log.service.js.map +1 -0
  211. package/dist/modules/auth/auth-core/auth-core.module.d.ts +3 -0
  212. package/dist/modules/auth/auth-core/auth-core.module.d.ts.map +1 -0
  213. package/dist/modules/auth/auth-core/auth-core.module.js +40 -0
  214. package/dist/modules/auth/auth-core/auth-core.module.js.map +1 -0
  215. package/dist/modules/auth/auth-core/strategies/jwt.strategy.d.ts +18 -0
  216. package/dist/modules/auth/auth-core/strategies/jwt.strategy.d.ts.map +1 -0
  217. package/dist/modules/auth/auth-core/strategies/jwt.strategy.js +45 -0
  218. package/dist/modules/auth/auth-core/strategies/jwt.strategy.js.map +1 -0
  219. package/dist/modules/auth/auth.manifest.d.ts +9 -0
  220. package/dist/modules/auth/auth.manifest.d.ts.map +1 -0
  221. package/dist/modules/auth/auth.manifest.js +29 -0
  222. package/dist/modules/auth/auth.manifest.js.map +1 -0
  223. package/dist/modules/auth/auth.module.d.ts +3 -0
  224. package/dist/modules/auth/auth.module.d.ts.map +1 -0
  225. package/dist/modules/auth/auth.module.js +67 -0
  226. package/dist/modules/auth/auth.module.js.map +1 -0
  227. package/dist/modules/auth/controllers/account.controller.d.ts +42 -0
  228. package/dist/modules/auth/controllers/account.controller.d.ts.map +1 -0
  229. package/dist/modules/auth/controllers/account.controller.js +206 -0
  230. package/dist/modules/auth/controllers/account.controller.js.map +1 -0
  231. package/dist/modules/auth/controllers/auth.controller.d.ts +32 -0
  232. package/dist/modules/auth/controllers/auth.controller.d.ts.map +1 -0
  233. package/dist/modules/auth/controllers/auth.controller.js +206 -0
  234. package/dist/modules/auth/controllers/auth.controller.js.map +1 -0
  235. package/dist/modules/auth/controllers/otp.controller.d.ts +10 -0
  236. package/dist/modules/auth/controllers/otp.controller.d.ts.map +1 -0
  237. package/dist/modules/auth/controllers/otp.controller.js +156 -0
  238. package/dist/modules/auth/controllers/otp.controller.js.map +1 -0
  239. package/dist/modules/auth/dto/index.d.ts +7 -0
  240. package/dist/modules/auth/dto/index.d.ts.map +1 -0
  241. package/dist/modules/auth/dto/index.js +23 -0
  242. package/dist/modules/auth/dto/index.js.map +1 -0
  243. package/dist/modules/auth/dto/invite.dto.d.ts +7 -0
  244. package/dist/modules/auth/dto/invite.dto.d.ts.map +1 -0
  245. package/dist/modules/auth/dto/invite.dto.js +39 -0
  246. package/dist/modules/auth/dto/invite.dto.js.map +1 -0
  247. package/dist/modules/auth/dto/login.dto.d.ts +7 -0
  248. package/dist/modules/auth/dto/login.dto.d.ts.map +1 -0
  249. package/dist/modules/auth/dto/login.dto.js +48 -0
  250. package/dist/modules/auth/dto/login.dto.js.map +1 -0
  251. package/dist/modules/auth/dto/otp.dto.d.ts +15 -0
  252. package/dist/modules/auth/dto/otp.dto.d.ts.map +1 -0
  253. package/dist/modules/auth/dto/otp.dto.js +83 -0
  254. package/dist/modules/auth/dto/otp.dto.js.map +1 -0
  255. package/dist/modules/auth/dto/password.dto.d.ts +25 -0
  256. package/dist/modules/auth/dto/password.dto.d.ts.map +1 -0
  257. package/dist/modules/auth/dto/password.dto.js +122 -0
  258. package/dist/modules/auth/dto/password.dto.js.map +1 -0
  259. package/dist/modules/auth/dto/register.dto.d.ts +19 -0
  260. package/dist/modules/auth/dto/register.dto.d.ts.map +1 -0
  261. package/dist/modules/auth/dto/register.dto.js +132 -0
  262. package/dist/modules/auth/dto/register.dto.js.map +1 -0
  263. package/dist/modules/auth/dto/token.dto.d.ts +15 -0
  264. package/dist/modules/auth/dto/token.dto.d.ts.map +1 -0
  265. package/dist/modules/auth/dto/token.dto.js +24 -0
  266. package/dist/modules/auth/dto/token.dto.js.map +1 -0
  267. package/dist/modules/auth/entities/index.d.ts +2 -0
  268. package/dist/modules/auth/entities/index.d.ts.map +1 -0
  269. package/dist/modules/auth/entities/index.js +18 -0
  270. package/dist/modules/auth/entities/index.js.map +1 -0
  271. package/dist/modules/auth/entities/password-reset-token.entity.d.ts +9 -0
  272. package/dist/modules/auth/entities/password-reset-token.entity.d.ts.map +1 -0
  273. package/dist/modules/auth/entities/password-reset-token.entity.js +40 -0
  274. package/dist/modules/auth/entities/password-reset-token.entity.js.map +1 -0
  275. package/dist/modules/auth/index.d.ts +5 -0
  276. package/dist/modules/auth/index.d.ts.map +1 -0
  277. package/dist/modules/auth/index.js +21 -0
  278. package/dist/modules/auth/index.js.map +1 -0
  279. package/dist/modules/auth/providers/index.d.ts +5 -0
  280. package/dist/modules/auth/providers/index.d.ts.map +1 -0
  281. package/dist/modules/auth/providers/index.js +21 -0
  282. package/dist/modules/auth/providers/index.js.map +1 -0
  283. package/dist/modules/auth/providers/interfaces/auth-provider.interface.d.ts +37 -0
  284. package/dist/modules/auth/providers/interfaces/auth-provider.interface.d.ts.map +1 -0
  285. package/dist/modules/auth/providers/interfaces/auth-provider.interface.js +3 -0
  286. package/dist/modules/auth/providers/interfaces/auth-provider.interface.js.map +1 -0
  287. package/dist/modules/auth/providers/interfaces/index.d.ts +2 -0
  288. package/dist/modules/auth/providers/interfaces/index.d.ts.map +1 -0
  289. package/dist/modules/auth/providers/interfaces/index.js +18 -0
  290. package/dist/modules/auth/providers/interfaces/index.js.map +1 -0
  291. package/dist/modules/auth/providers/keycloak/index.d.ts +3 -0
  292. package/dist/modules/auth/providers/keycloak/index.d.ts.map +1 -0
  293. package/dist/modules/auth/providers/keycloak/index.js +19 -0
  294. package/dist/modules/auth/providers/keycloak/index.js.map +1 -0
  295. package/dist/modules/auth/providers/keycloak/keycloak-auth-provider.module.d.ts +3 -0
  296. package/dist/modules/auth/providers/keycloak/keycloak-auth-provider.module.d.ts.map +1 -0
  297. package/dist/modules/auth/providers/keycloak/keycloak-auth-provider.module.js +80 -0
  298. package/dist/modules/auth/providers/keycloak/keycloak-auth-provider.module.js.map +1 -0
  299. package/dist/modules/auth/providers/keycloak/keycloak-verify-email.strategy.d.ts +7 -0
  300. package/dist/modules/auth/providers/keycloak/keycloak-verify-email.strategy.d.ts.map +1 -0
  301. package/dist/modules/auth/providers/keycloak/keycloak-verify-email.strategy.js +54 -0
  302. package/dist/modules/auth/providers/keycloak/keycloak-verify-email.strategy.js.map +1 -0
  303. package/dist/modules/auth/providers/keycloak/keycloak.auth-provider.d.ts +36 -0
  304. package/dist/modules/auth/providers/keycloak/keycloak.auth-provider.d.ts.map +1 -0
  305. package/dist/modules/auth/providers/keycloak/keycloak.auth-provider.js +188 -0
  306. package/dist/modules/auth/providers/keycloak/keycloak.auth-provider.js.map +1 -0
  307. package/dist/modules/auth/providers/native/index.d.ts +3 -0
  308. package/dist/modules/auth/providers/native/index.d.ts.map +1 -0
  309. package/dist/modules/auth/providers/native/index.js +19 -0
  310. package/dist/modules/auth/providers/native/index.js.map +1 -0
  311. package/dist/modules/auth/providers/native/native.auth-provider.d.ts +19 -0
  312. package/dist/modules/auth/providers/native/native.auth-provider.d.ts.map +1 -0
  313. package/dist/modules/auth/providers/native/native.auth-provider.js +159 -0
  314. package/dist/modules/auth/providers/native/native.auth-provider.js.map +1 -0
  315. package/dist/modules/auth/providers/native/native.auth-provider.module.d.ts +3 -0
  316. package/dist/modules/auth/providers/native/native.auth-provider.module.d.ts.map +1 -0
  317. package/dist/modules/auth/providers/native/native.auth-provider.module.js +24 -0
  318. package/dist/modules/auth/providers/native/native.auth-provider.module.js.map +1 -0
  319. package/dist/modules/auth/providers/provider.registry.d.ts +14 -0
  320. package/dist/modules/auth/providers/provider.registry.d.ts.map +1 -0
  321. package/dist/modules/auth/providers/provider.registry.js +49 -0
  322. package/dist/modules/auth/providers/provider.registry.js.map +1 -0
  323. package/dist/modules/auth/services/account.service.d.ts +40 -0
  324. package/dist/modules/auth/services/account.service.d.ts.map +1 -0
  325. package/dist/modules/auth/services/account.service.js +165 -0
  326. package/dist/modules/auth/services/account.service.js.map +1 -0
  327. package/dist/modules/auth/services/index.d.ts +6 -0
  328. package/dist/modules/auth/services/index.d.ts.map +1 -0
  329. package/dist/modules/auth/services/index.js +22 -0
  330. package/dist/modules/auth/services/index.js.map +1 -0
  331. package/dist/modules/auth/services/login.service.d.ts +28 -0
  332. package/dist/modules/auth/services/login.service.d.ts.map +1 -0
  333. package/dist/modules/auth/services/login.service.js +210 -0
  334. package/dist/modules/auth/services/login.service.js.map +1 -0
  335. package/dist/modules/auth/services/otp-auth.service.d.ts +16 -0
  336. package/dist/modules/auth/services/otp-auth.service.d.ts.map +1 -0
  337. package/dist/modules/auth/services/otp-auth.service.js +75 -0
  338. package/dist/modules/auth/services/otp-auth.service.js.map +1 -0
  339. package/dist/modules/auth/services/password.service.d.ts +39 -0
  340. package/dist/modules/auth/services/password.service.d.ts.map +1 -0
  341. package/dist/modules/auth/services/password.service.js +213 -0
  342. package/dist/modules/auth/services/password.service.js.map +1 -0
  343. package/dist/modules/auth/services/registration.service.d.ts +30 -0
  344. package/dist/modules/auth/services/registration.service.d.ts.map +1 -0
  345. package/dist/modules/auth/services/registration.service.js +217 -0
  346. package/dist/modules/auth/services/registration.service.js.map +1 -0
  347. package/dist/modules/notifications/controllers/index.d.ts +2 -0
  348. package/dist/modules/notifications/controllers/index.d.ts.map +1 -0
  349. package/dist/modules/notifications/controllers/index.js +18 -0
  350. package/dist/modules/notifications/controllers/index.js.map +1 -0
  351. package/dist/modules/notifications/controllers/notifications.controller.d.ts +38 -0
  352. package/dist/modules/notifications/controllers/notifications.controller.d.ts.map +1 -0
  353. package/dist/modules/notifications/controllers/notifications.controller.js +140 -0
  354. package/dist/modules/notifications/controllers/notifications.controller.js.map +1 -0
  355. package/dist/modules/notifications/dto/device.dto.d.ts +10 -0
  356. package/dist/modules/notifications/dto/device.dto.d.ts.map +1 -0
  357. package/dist/modules/notifications/dto/device.dto.js +38 -0
  358. package/dist/modules/notifications/dto/device.dto.js.map +1 -0
  359. package/dist/modules/notifications/dto/event-types.dto.d.ts +6 -0
  360. package/dist/modules/notifications/dto/event-types.dto.d.ts.map +1 -0
  361. package/dist/modules/notifications/dto/event-types.dto.js +10 -0
  362. package/dist/modules/notifications/dto/event-types.dto.js.map +1 -0
  363. package/dist/modules/notifications/dto/fcm.dto.d.ts +14 -0
  364. package/dist/modules/notifications/dto/fcm.dto.d.ts.map +1 -0
  365. package/dist/modules/notifications/dto/fcm.dto.js +3 -0
  366. package/dist/modules/notifications/dto/fcm.dto.js.map +1 -0
  367. package/dist/modules/notifications/dto/index.d.ts +6 -0
  368. package/dist/modules/notifications/dto/index.d.ts.map +1 -0
  369. package/dist/modules/notifications/dto/index.js +22 -0
  370. package/dist/modules/notifications/dto/index.js.map +1 -0
  371. package/dist/modules/notifications/dto/notification-query.dto.d.ts +8 -0
  372. package/dist/modules/notifications/dto/notification-query.dto.d.ts.map +1 -0
  373. package/dist/modules/notifications/dto/notification-query.dto.js +44 -0
  374. package/dist/modules/notifications/dto/notification-query.dto.js.map +1 -0
  375. package/dist/modules/notifications/dto/user-device-token.dto.d.ts +9 -0
  376. package/dist/modules/notifications/dto/user-device-token.dto.d.ts.map +1 -0
  377. package/dist/modules/notifications/dto/user-device-token.dto.js +3 -0
  378. package/dist/modules/notifications/dto/user-device-token.dto.js.map +1 -0
  379. package/dist/modules/notifications/entities/device-token.entity.d.ts +17 -0
  380. package/dist/modules/notifications/entities/device-token.entity.d.ts.map +1 -0
  381. package/dist/modules/notifications/entities/device-token.entity.js +62 -0
  382. package/dist/modules/notifications/entities/device-token.entity.js.map +1 -0
  383. package/dist/modules/notifications/entities/index.d.ts +3 -0
  384. package/dist/modules/notifications/entities/index.d.ts.map +1 -0
  385. package/dist/modules/notifications/entities/index.js +19 -0
  386. package/dist/modules/notifications/entities/index.js.map +1 -0
  387. package/dist/modules/notifications/entities/notification.entity.d.ts +21 -0
  388. package/dist/modules/notifications/entities/notification.entity.d.ts.map +1 -0
  389. package/dist/modules/notifications/entities/notification.entity.js +70 -0
  390. package/dist/modules/notifications/entities/notification.entity.js.map +1 -0
  391. package/dist/modules/notifications/firebase.module.d.ts +3 -0
  392. package/dist/modules/notifications/firebase.module.d.ts.map +1 -0
  393. package/dist/modules/notifications/firebase.module.js +25 -0
  394. package/dist/modules/notifications/firebase.module.js.map +1 -0
  395. package/dist/modules/notifications/notifications.manifest.d.ts +9 -0
  396. package/dist/modules/notifications/notifications.manifest.d.ts.map +1 -0
  397. package/dist/modules/notifications/notifications.manifest.js +37 -0
  398. package/dist/modules/notifications/notifications.manifest.js.map +1 -0
  399. package/dist/modules/notifications/notifications.module.d.ts +3 -0
  400. package/dist/modules/notifications/notifications.module.d.ts.map +1 -0
  401. package/dist/modules/notifications/notifications.module.js +32 -0
  402. package/dist/modules/notifications/notifications.module.js.map +1 -0
  403. package/dist/modules/notifications/services/fcm.service.d.ts +17 -0
  404. package/dist/modules/notifications/services/fcm.service.d.ts.map +1 -0
  405. package/dist/modules/notifications/services/fcm.service.js +150 -0
  406. package/dist/modules/notifications/services/fcm.service.js.map +1 -0
  407. package/dist/modules/notifications/services/firebase.service.d.ts +19 -0
  408. package/dist/modules/notifications/services/firebase.service.d.ts.map +1 -0
  409. package/dist/modules/notifications/services/firebase.service.js +73 -0
  410. package/dist/modules/notifications/services/firebase.service.js.map +1 -0
  411. package/dist/modules/notifications/services/index.d.ts +4 -0
  412. package/dist/modules/notifications/services/index.d.ts.map +1 -0
  413. package/dist/modules/notifications/services/index.js +20 -0
  414. package/dist/modules/notifications/services/index.js.map +1 -0
  415. package/dist/modules/notifications/services/notifications.service.d.ts +19 -0
  416. package/dist/modules/notifications/services/notifications.service.d.ts.map +1 -0
  417. package/dist/modules/notifications/services/notifications.service.js +97 -0
  418. package/dist/modules/notifications/services/notifications.service.js.map +1 -0
  419. package/dist/modules/otp/constants/otp.constants.d.ts +4 -0
  420. package/dist/modules/otp/constants/otp.constants.d.ts.map +1 -0
  421. package/dist/modules/otp/constants/otp.constants.js +10 -0
  422. package/dist/modules/otp/constants/otp.constants.js.map +1 -0
  423. package/dist/modules/otp/email/email-provider.interface.d.ts +14 -0
  424. package/dist/modules/otp/email/email-provider.interface.d.ts.map +1 -0
  425. package/dist/modules/otp/email/email-provider.interface.js +15 -0
  426. package/dist/modules/otp/email/email-provider.interface.js.map +1 -0
  427. package/dist/modules/otp/email/email-proxy.service.d.ts +21 -0
  428. package/dist/modules/otp/email/email-proxy.service.d.ts.map +1 -0
  429. package/dist/modules/otp/email/email-proxy.service.js +67 -0
  430. package/dist/modules/otp/email/email-proxy.service.js.map +1 -0
  431. package/dist/modules/otp/email/email.module.d.ts +3 -0
  432. package/dist/modules/otp/email/email.module.d.ts.map +1 -0
  433. package/dist/modules/otp/email/email.module.js +33 -0
  434. package/dist/modules/otp/email/email.module.js.map +1 -0
  435. package/dist/modules/otp/email/index.d.ts +4 -0
  436. package/dist/modules/otp/email/index.d.ts.map +1 -0
  437. package/dist/modules/otp/email/index.js +20 -0
  438. package/dist/modules/otp/email/index.js.map +1 -0
  439. package/dist/modules/otp/email/providers/index.d.ts +5 -0
  440. package/dist/modules/otp/email/providers/index.d.ts.map +1 -0
  441. package/dist/modules/otp/email/providers/index.js +21 -0
  442. package/dist/modules/otp/email/providers/index.js.map +1 -0
  443. package/dist/modules/otp/email/providers/mailgun.provider.d.ts +10 -0
  444. package/dist/modules/otp/email/providers/mailgun.provider.d.ts.map +1 -0
  445. package/dist/modules/otp/email/providers/mailgun.provider.js +59 -0
  446. package/dist/modules/otp/email/providers/mailgun.provider.js.map +1 -0
  447. package/dist/modules/otp/email/providers/resend.provider.d.ts +10 -0
  448. package/dist/modules/otp/email/providers/resend.provider.d.ts.map +1 -0
  449. package/dist/modules/otp/email/providers/resend.provider.js +57 -0
  450. package/dist/modules/otp/email/providers/resend.provider.js.map +1 -0
  451. package/dist/modules/otp/email/providers/sendgrid.provider.d.ts +10 -0
  452. package/dist/modules/otp/email/providers/sendgrid.provider.d.ts.map +1 -0
  453. package/dist/modules/otp/email/providers/sendgrid.provider.js +58 -0
  454. package/dist/modules/otp/email/providers/sendgrid.provider.js.map +1 -0
  455. package/dist/modules/otp/email/providers/smtp.provider.d.ts +15 -0
  456. package/dist/modules/otp/email/providers/smtp.provider.d.ts.map +1 -0
  457. package/dist/modules/otp/email/providers/smtp.provider.js +115 -0
  458. package/dist/modules/otp/email/providers/smtp.provider.js.map +1 -0
  459. package/dist/modules/otp/index.d.ts +5 -0
  460. package/dist/modules/otp/index.d.ts.map +1 -0
  461. package/dist/modules/otp/index.js +21 -0
  462. package/dist/modules/otp/index.js.map +1 -0
  463. package/dist/modules/otp/interfaces/otp.service.interface.d.ts +26 -0
  464. package/dist/modules/otp/interfaces/otp.service.interface.d.ts.map +1 -0
  465. package/dist/modules/otp/interfaces/otp.service.interface.js +7 -0
  466. package/dist/modules/otp/interfaces/otp.service.interface.js.map +1 -0
  467. package/dist/modules/otp/otp.module.d.ts +3 -0
  468. package/dist/modules/otp/otp.module.d.ts.map +1 -0
  469. package/dist/modules/otp/otp.module.js +36 -0
  470. package/dist/modules/otp/otp.module.js.map +1 -0
  471. package/dist/modules/otp/otp.service.d.ts +25 -0
  472. package/dist/modules/otp/otp.service.d.ts.map +1 -0
  473. package/dist/modules/otp/otp.service.js +146 -0
  474. package/dist/modules/otp/otp.service.js.map +1 -0
  475. package/dist/modules/otp/services/otp.rate-limiter.d.ts +13 -0
  476. package/dist/modules/otp/services/otp.rate-limiter.d.ts.map +1 -0
  477. package/dist/modules/otp/services/otp.rate-limiter.js +70 -0
  478. package/dist/modules/otp/services/otp.rate-limiter.js.map +1 -0
  479. package/dist/modules/otp/services/otp.session.store.d.ts +28 -0
  480. package/dist/modules/otp/services/otp.session.store.d.ts.map +1 -0
  481. package/dist/modules/otp/services/otp.session.store.js +226 -0
  482. package/dist/modules/otp/services/otp.session.store.js.map +1 -0
  483. package/dist/modules/otp/sms/index.d.ts +4 -0
  484. package/dist/modules/otp/sms/index.d.ts.map +1 -0
  485. package/dist/modules/otp/sms/index.js +20 -0
  486. package/dist/modules/otp/sms/index.js.map +1 -0
  487. package/dist/modules/otp/sms/providers/index.d.ts +5 -0
  488. package/dist/modules/otp/sms/providers/index.d.ts.map +1 -0
  489. package/dist/modules/otp/sms/providers/index.js +21 -0
  490. package/dist/modules/otp/sms/providers/index.js.map +1 -0
  491. package/dist/modules/otp/sms/providers/infobip.provider.d.ts +10 -0
  492. package/dist/modules/otp/sms/providers/infobip.provider.d.ts.map +1 -0
  493. package/dist/modules/otp/sms/providers/infobip.provider.js +61 -0
  494. package/dist/modules/otp/sms/providers/infobip.provider.js.map +1 -0
  495. package/dist/modules/otp/sms/providers/smart-sms.provider.d.ts +11 -0
  496. package/dist/modules/otp/sms/providers/smart-sms.provider.d.ts.map +1 -0
  497. package/dist/modules/otp/sms/providers/smart-sms.provider.js +56 -0
  498. package/dist/modules/otp/sms/providers/smart-sms.provider.js.map +1 -0
  499. package/dist/modules/otp/sms/providers/termii.provider.d.ts +11 -0
  500. package/dist/modules/otp/sms/providers/termii.provider.d.ts.map +1 -0
  501. package/dist/modules/otp/sms/providers/termii.provider.js +56 -0
  502. package/dist/modules/otp/sms/providers/termii.provider.js.map +1 -0
  503. package/dist/modules/otp/sms/providers/twilio.provider.d.ts +10 -0
  504. package/dist/modules/otp/sms/providers/twilio.provider.d.ts.map +1 -0
  505. package/dist/modules/otp/sms/providers/twilio.provider.js +59 -0
  506. package/dist/modules/otp/sms/providers/twilio.provider.js.map +1 -0
  507. package/dist/modules/otp/sms/sms-provider.interface.d.ts +12 -0
  508. package/dist/modules/otp/sms/sms-provider.interface.d.ts.map +1 -0
  509. package/dist/modules/otp/sms/sms-provider.interface.js +15 -0
  510. package/dist/modules/otp/sms/sms-provider.interface.js.map +1 -0
  511. package/dist/modules/otp/sms/sms-proxy.service.d.ts +21 -0
  512. package/dist/modules/otp/sms/sms-proxy.service.d.ts.map +1 -0
  513. package/dist/modules/otp/sms/sms-proxy.service.js +67 -0
  514. package/dist/modules/otp/sms/sms-proxy.service.js.map +1 -0
  515. package/dist/modules/otp/sms/sms.module.d.ts +3 -0
  516. package/dist/modules/otp/sms/sms.module.d.ts.map +1 -0
  517. package/dist/modules/otp/sms/sms.module.js +33 -0
  518. package/dist/modules/otp/sms/sms.module.js.map +1 -0
  519. package/dist/modules/otp/utils/otp.utils.d.ts +13 -0
  520. package/dist/modules/otp/utils/otp.utils.d.ts.map +1 -0
  521. package/dist/modules/otp/utils/otp.utils.js +57 -0
  522. package/dist/modules/otp/utils/otp.utils.js.map +1 -0
  523. package/dist/modules/profile/controllers/profile.controller.d.ts +14 -0
  524. package/dist/modules/profile/controllers/profile.controller.d.ts.map +1 -0
  525. package/dist/modules/profile/controllers/profile.controller.js +81 -0
  526. package/dist/modules/profile/controllers/profile.controller.js.map +1 -0
  527. package/dist/modules/profile/dto/profile.dto.d.ts +11 -0
  528. package/dist/modules/profile/dto/profile.dto.d.ts.map +1 -0
  529. package/dist/modules/profile/dto/profile.dto.js +50 -0
  530. package/dist/modules/profile/dto/profile.dto.js.map +1 -0
  531. package/dist/modules/profile/index.d.ts +3 -0
  532. package/dist/modules/profile/index.d.ts.map +1 -0
  533. package/dist/modules/profile/index.js +19 -0
  534. package/dist/modules/profile/index.js.map +1 -0
  535. package/dist/modules/profile/profile.module.d.ts +3 -0
  536. package/dist/modules/profile/profile.module.d.ts.map +1 -0
  537. package/dist/modules/profile/profile.module.js +26 -0
  538. package/dist/modules/profile/profile.module.js.map +1 -0
  539. package/dist/modules/profile/services/profile.service.d.ts +16 -0
  540. package/dist/modules/profile/services/profile.service.d.ts.map +1 -0
  541. package/dist/modules/profile/services/profile.service.js +64 -0
  542. package/dist/modules/profile/services/profile.service.js.map +1 -0
  543. package/dist/modules/roles/controllers/index.d.ts +5 -0
  544. package/dist/modules/roles/controllers/index.d.ts.map +1 -0
  545. package/dist/modules/roles/controllers/index.js +12 -0
  546. package/dist/modules/roles/controllers/index.js.map +1 -0
  547. package/dist/modules/roles/controllers/modules.controller.d.ts +14 -0
  548. package/dist/modules/roles/controllers/modules.controller.d.ts.map +1 -0
  549. package/dist/modules/roles/controllers/modules.controller.js +82 -0
  550. package/dist/modules/roles/controllers/modules.controller.js.map +1 -0
  551. package/dist/modules/roles/controllers/permissions.controller.d.ts +14 -0
  552. package/dist/modules/roles/controllers/permissions.controller.d.ts.map +1 -0
  553. package/dist/modules/roles/controllers/permissions.controller.js +83 -0
  554. package/dist/modules/roles/controllers/permissions.controller.js.map +1 -0
  555. package/dist/modules/roles/controllers/roles.controller.d.ts +17 -0
  556. package/dist/modules/roles/controllers/roles.controller.d.ts.map +1 -0
  557. package/dist/modules/roles/controllers/roles.controller.js +93 -0
  558. package/dist/modules/roles/controllers/roles.controller.js.map +1 -0
  559. package/dist/modules/roles/controllers/user-roles.controller.d.ts +11 -0
  560. package/dist/modules/roles/controllers/user-roles.controller.d.ts.map +1 -0
  561. package/dist/modules/roles/controllers/user-roles.controller.js +94 -0
  562. package/dist/modules/roles/controllers/user-roles.controller.js.map +1 -0
  563. package/dist/modules/roles/dto/index.d.ts +4 -0
  564. package/dist/modules/roles/dto/index.d.ts.map +1 -0
  565. package/dist/modules/roles/dto/index.js +20 -0
  566. package/dist/modules/roles/dto/index.js.map +1 -0
  567. package/dist/modules/roles/dto/module.dto.d.ts +10 -0
  568. package/dist/modules/roles/dto/module.dto.d.ts.map +1 -0
  569. package/dist/modules/roles/dto/module.dto.js +48 -0
  570. package/dist/modules/roles/dto/module.dto.js.map +1 -0
  571. package/dist/modules/roles/dto/permission.dto.d.ts +14 -0
  572. package/dist/modules/roles/dto/permission.dto.d.ts.map +1 -0
  573. package/dist/modules/roles/dto/permission.dto.js +60 -0
  574. package/dist/modules/roles/dto/permission.dto.js.map +1 -0
  575. package/dist/modules/roles/dto/role.dto.d.ts +15 -0
  576. package/dist/modules/roles/dto/role.dto.d.ts.map +1 -0
  577. package/dist/modules/roles/dto/role.dto.js +65 -0
  578. package/dist/modules/roles/dto/role.dto.js.map +1 -0
  579. package/dist/modules/roles/entities/index.d.ts +4 -0
  580. package/dist/modules/roles/entities/index.d.ts.map +1 -0
  581. package/dist/modules/roles/entities/index.js +10 -0
  582. package/dist/modules/roles/entities/index.js.map +1 -0
  583. package/dist/modules/roles/entities/module.entity.d.ts +9 -0
  584. package/dist/modules/roles/entities/module.entity.d.ts.map +1 -0
  585. package/dist/modules/roles/entities/module.entity.js +39 -0
  586. package/dist/modules/roles/entities/module.entity.js.map +1 -0
  587. package/dist/modules/roles/entities/permission.entity.d.ts +12 -0
  588. package/dist/modules/roles/entities/permission.entity.d.ts.map +1 -0
  589. package/dist/modules/roles/entities/permission.entity.js +49 -0
  590. package/dist/modules/roles/entities/permission.entity.js.map +1 -0
  591. package/dist/modules/roles/entities/role.entity.d.ts +11 -0
  592. package/dist/modules/roles/entities/role.entity.d.ts.map +1 -0
  593. package/dist/modules/roles/entities/role.entity.js +49 -0
  594. package/dist/modules/roles/entities/role.entity.js.map +1 -0
  595. package/dist/modules/roles/index.d.ts +7 -0
  596. package/dist/modules/roles/index.d.ts.map +1 -0
  597. package/dist/modules/roles/index.js +25 -0
  598. package/dist/modules/roles/index.js.map +1 -0
  599. package/dist/modules/roles/registry/discover-manifests.d.ts +3 -0
  600. package/dist/modules/roles/registry/discover-manifests.d.ts.map +1 -0
  601. package/dist/modules/roles/registry/discover-manifests.js +83 -0
  602. package/dist/modules/roles/registry/discover-manifests.js.map +1 -0
  603. package/dist/modules/roles/registry/index.d.ts +3 -0
  604. package/dist/modules/roles/registry/index.d.ts.map +1 -0
  605. package/dist/modules/roles/registry/index.js +8 -0
  606. package/dist/modules/roles/registry/index.js.map +1 -0
  607. package/dist/modules/roles/registry/sync-manifests-to-db.d.ts +7 -0
  608. package/dist/modules/roles/registry/sync-manifests-to-db.d.ts.map +1 -0
  609. package/dist/modules/roles/registry/sync-manifests-to-db.js +52 -0
  610. package/dist/modules/roles/registry/sync-manifests-to-db.js.map +1 -0
  611. package/dist/modules/roles/roles.manifest.d.ts +12 -0
  612. package/dist/modules/roles/roles.manifest.d.ts.map +1 -0
  613. package/dist/modules/roles/roles.manifest.js +51 -0
  614. package/dist/modules/roles/roles.manifest.js.map +1 -0
  615. package/dist/modules/roles/roles.module.d.ts +8 -0
  616. package/dist/modules/roles/roles.module.d.ts.map +1 -0
  617. package/dist/modules/roles/roles.module.js +43 -0
  618. package/dist/modules/roles/roles.module.js.map +1 -0
  619. package/dist/modules/roles/services/index.d.ts +6 -0
  620. package/dist/modules/roles/services/index.d.ts.map +1 -0
  621. package/dist/modules/roles/services/index.js +14 -0
  622. package/dist/modules/roles/services/index.js.map +1 -0
  623. package/dist/modules/roles/services/manifest-sync.service.d.ts +11 -0
  624. package/dist/modules/roles/services/manifest-sync.service.d.ts.map +1 -0
  625. package/dist/modules/roles/services/manifest-sync.service.js +38 -0
  626. package/dist/modules/roles/services/manifest-sync.service.js.map +1 -0
  627. package/dist/modules/roles/services/modules.service.d.ts +14 -0
  628. package/dist/modules/roles/services/modules.service.d.ts.map +1 -0
  629. package/dist/modules/roles/services/modules.service.js +69 -0
  630. package/dist/modules/roles/services/modules.service.js.map +1 -0
  631. package/dist/modules/roles/services/permissions.service.d.ts +14 -0
  632. package/dist/modules/roles/services/permissions.service.d.ts.map +1 -0
  633. package/dist/modules/roles/services/permissions.service.js +72 -0
  634. package/dist/modules/roles/services/permissions.service.js.map +1 -0
  635. package/dist/modules/roles/services/roles.service.d.ts +17 -0
  636. package/dist/modules/roles/services/roles.service.d.ts.map +1 -0
  637. package/dist/modules/roles/services/roles.service.js +100 -0
  638. package/dist/modules/roles/services/roles.service.js.map +1 -0
  639. package/dist/modules/roles/services/user-roles.service.d.ts +15 -0
  640. package/dist/modules/roles/services/user-roles.service.d.ts.map +1 -0
  641. package/dist/modules/roles/services/user-roles.service.js +88 -0
  642. package/dist/modules/roles/services/user-roles.service.js.map +1 -0
  643. package/dist/modules/roles/types/manifest.types.d.ts +12 -0
  644. package/dist/modules/roles/types/manifest.types.d.ts.map +1 -0
  645. package/dist/modules/roles/types/manifest.types.js +3 -0
  646. package/dist/modules/roles/types/manifest.types.js.map +1 -0
  647. package/dist/modules/sessions/controllers/session.controller.d.ts +17 -0
  648. package/dist/modules/sessions/controllers/session.controller.d.ts.map +1 -0
  649. package/dist/modules/sessions/controllers/session.controller.js +95 -0
  650. package/dist/modules/sessions/controllers/session.controller.js.map +1 -0
  651. package/dist/modules/sessions/entities/refresh-token.entity.d.ts +21 -0
  652. package/dist/modules/sessions/entities/refresh-token.entity.d.ts.map +1 -0
  653. package/dist/modules/sessions/entities/refresh-token.entity.js +77 -0
  654. package/dist/modules/sessions/entities/refresh-token.entity.js.map +1 -0
  655. package/dist/modules/sessions/index.d.ts +4 -0
  656. package/dist/modules/sessions/index.d.ts.map +1 -0
  657. package/dist/modules/sessions/index.js +20 -0
  658. package/dist/modules/sessions/index.js.map +1 -0
  659. package/dist/modules/sessions/services/token.service.d.ts +42 -0
  660. package/dist/modules/sessions/services/token.service.d.ts.map +1 -0
  661. package/dist/modules/sessions/services/token.service.js +253 -0
  662. package/dist/modules/sessions/services/token.service.js.map +1 -0
  663. package/dist/modules/sessions/sessions.module.d.ts +3 -0
  664. package/dist/modules/sessions/sessions.module.d.ts.map +1 -0
  665. package/dist/modules/sessions/sessions.module.js +28 -0
  666. package/dist/modules/sessions/sessions.module.js.map +1 -0
  667. package/dist/modules/settings/constants/settings.defaults.d.ts +60 -0
  668. package/dist/modules/settings/constants/settings.defaults.d.ts.map +1 -0
  669. package/dist/modules/settings/constants/settings.defaults.js +78 -0
  670. package/dist/modules/settings/constants/settings.defaults.js.map +1 -0
  671. package/dist/modules/settings/constants/settings.keys.d.ts +56 -0
  672. package/dist/modules/settings/constants/settings.keys.d.ts.map +1 -0
  673. package/dist/modules/settings/constants/settings.keys.js +58 -0
  674. package/dist/modules/settings/constants/settings.keys.js.map +1 -0
  675. package/dist/modules/settings/controllers/settings.controller.d.ts +13 -0
  676. package/dist/modules/settings/controllers/settings.controller.d.ts.map +1 -0
  677. package/dist/modules/settings/controllers/settings.controller.js +91 -0
  678. package/dist/modules/settings/controllers/settings.controller.js.map +1 -0
  679. package/dist/modules/settings/dto/settings.dto.d.ts +4 -0
  680. package/dist/modules/settings/dto/settings.dto.d.ts.map +1 -0
  681. package/dist/modules/settings/dto/settings.dto.js +24 -0
  682. package/dist/modules/settings/dto/settings.dto.js.map +1 -0
  683. package/dist/modules/settings/entities/app-setting.entity.d.ts +13 -0
  684. package/dist/modules/settings/entities/app-setting.entity.d.ts.map +1 -0
  685. package/dist/modules/settings/entities/app-setting.entity.js +56 -0
  686. package/dist/modules/settings/entities/app-setting.entity.js.map +1 -0
  687. package/dist/modules/settings/index.d.ts +8 -0
  688. package/dist/modules/settings/index.d.ts.map +1 -0
  689. package/dist/modules/settings/index.js +24 -0
  690. package/dist/modules/settings/index.js.map +1 -0
  691. package/dist/modules/settings/services/settings.service.d.ts +23 -0
  692. package/dist/modules/settings/services/settings.service.d.ts.map +1 -0
  693. package/dist/modules/settings/services/settings.service.js +116 -0
  694. package/dist/modules/settings/services/settings.service.js.map +1 -0
  695. package/dist/modules/settings/settings.manifest.d.ts +7 -0
  696. package/dist/modules/settings/settings.manifest.d.ts.map +1 -0
  697. package/dist/modules/settings/settings.manifest.js +25 -0
  698. package/dist/modules/settings/settings.manifest.js.map +1 -0
  699. package/dist/modules/settings/settings.module.d.ts +3 -0
  700. package/dist/modules/settings/settings.module.d.ts.map +1 -0
  701. package/dist/modules/settings/settings.module.js +27 -0
  702. package/dist/modules/settings/settings.module.js.map +1 -0
  703. package/dist/modules/users/controllers/users.controller.d.ts +41 -0
  704. package/dist/modules/users/controllers/users.controller.d.ts.map +1 -0
  705. package/dist/modules/users/controllers/users.controller.js +273 -0
  706. package/dist/modules/users/controllers/users.controller.js.map +1 -0
  707. package/dist/modules/users/dto/user.dto.d.ts +52 -0
  708. package/dist/modules/users/dto/user.dto.d.ts.map +1 -0
  709. package/dist/modules/users/dto/user.dto.js +139 -0
  710. package/dist/modules/users/dto/user.dto.js.map +1 -0
  711. package/dist/modules/users/entities/user.entity.d.ts +33 -0
  712. package/dist/modules/users/entities/user.entity.d.ts.map +1 -0
  713. package/dist/modules/users/entities/user.entity.js +130 -0
  714. package/dist/modules/users/entities/user.entity.js.map +1 -0
  715. package/dist/modules/users/index.d.ts +7 -0
  716. package/dist/modules/users/index.d.ts.map +1 -0
  717. package/dist/modules/users/index.js +23 -0
  718. package/dist/modules/users/index.js.map +1 -0
  719. package/dist/modules/users/services/invite.service.d.ts +35 -0
  720. package/dist/modules/users/services/invite.service.d.ts.map +1 -0
  721. package/dist/modules/users/services/invite.service.js +236 -0
  722. package/dist/modules/users/services/invite.service.js.map +1 -0
  723. package/dist/modules/users/services/users.service.d.ts +40 -0
  724. package/dist/modules/users/services/users.service.d.ts.map +1 -0
  725. package/dist/modules/users/services/users.service.js +239 -0
  726. package/dist/modules/users/services/users.service.js.map +1 -0
  727. package/dist/modules/users/users.manifest.d.ts +12 -0
  728. package/dist/modules/users/users.manifest.d.ts.map +1 -0
  729. package/dist/modules/users/users.manifest.js +43 -0
  730. package/dist/modules/users/users.manifest.js.map +1 -0
  731. package/dist/modules/users/users.module.d.ts +3 -0
  732. package/dist/modules/users/users.module.d.ts.map +1 -0
  733. package/dist/modules/users/users.module.js +36 -0
  734. package/dist/modules/users/users.module.js.map +1 -0
  735. package/dist/tsconfig.build.tsbuildinfo +1 -0
  736. package/dist/tsconfig.tsbuildinfo +1 -0
  737. package/package.json +140 -0
package/README.md ADDED
@@ -0,0 +1,954 @@
1
+ # @skyapp-labs/blueprint-backend-core
2
+
3
+ Pluggable NestJS library that provides a complete authentication, user management, RBAC, notifications, and infrastructure foundation for Blueprint projects. Import once and get production-ready endpoints, services, guards, and background jobs out of the box.
4
+
5
+ ---
6
+
7
+ ## Table of Contents
8
+
9
+ - [What's Included](#whats-included)
10
+ - [Requirements](#requirements)
11
+ - [Installation](#installation)
12
+ - [Quick Start](#quick-start)
13
+ - [Environment Variables](#environment-variables)
14
+ - [Database Setup](#database-setup)
15
+ - [Modules Reference](#modules-reference)
16
+ - [Using Core Services](#using-core-services)
17
+ - [Common Utilities](#common-utilities)
18
+ - [App Settings Reference](#app-settings-reference)
19
+ - [RBAC — Roles & Permissions](#rbac--roles--permissions)
20
+ - [Extending the Core](#extending-the-core)
21
+ - [Overriding a Core Module](#overriding-a-core-module)
22
+ - [Development Scripts](#development-scripts)
23
+ - [Versioning](#versioning)
24
+
25
+ ---
26
+
27
+ ## What's Included
28
+
29
+ | Module | Endpoints | What it provides |
30
+ |--------|-----------|-----------------|
31
+ | **Auth** | `/auth/*` | Login, register, OTP, password reset, JWT, Keycloak, invite flow |
32
+ | **Sessions** | `/auth/refresh`, `/auth/logout`, `/auth/sessions` | Refresh token rotation, session list, revoke |
33
+ | **Users** | `/users/*` | User CRUD, search, pagination, deactivate, soft delete |
34
+ | **Profile** | `/profile/*` | Get/update profile, change phone (OTP-verified), delete account |
35
+ | **Roles** | `/roles/*`, `/permissions/*`, `/modules/*` | RBAC — roles, permissions, manifest-based auto-sync |
36
+ | **Notifications** | `/notifications/*` | In-app notifications, FCM push, device token management |
37
+ | **Settings** | `/settings/*` | DB-backed runtime configuration with in-memory cache |
38
+ | **Admin** | `/admin/*` | Dashboard stats, immutable audit log |
39
+ | **Health** | `/health/*` | Liveness, readiness, DB/Redis/memory checks |
40
+ | **Jobs** | — | BullMQ background queues for email, SMS, push |
41
+ | **OTP** | — | OTP engine — SMTP / SendGrid / Mailgun / Resend / Twilio / Termii / Infobip / SmartSMS |
42
+
43
+ ---
44
+
45
+ ## Requirements
46
+
47
+ - **Node.js** >= 20
48
+ - **PostgreSQL** >= 14
49
+ - **Redis** (required for OTP, rate limiting, and background jobs)
50
+
51
+ **Peer dependencies** — these must be installed in your consuming app:
52
+
53
+ ```bash
54
+ npm install \
55
+ @nestjs/bullmq@>=11 \
56
+ @nestjs/common@>=11 \
57
+ @nestjs/config@>=4 \
58
+ @nestjs/core@>=11 \
59
+ @nestjs/jwt@>=11 \
60
+ @nestjs/passport@>=11 \
61
+ @nestjs/swagger@>=11 \
62
+ @nestjs/terminus@>=11 \
63
+ @nestjs/throttler@>=6 \
64
+ @nestjs/typeorm@>=11 \
65
+ bullmq@>=5 \
66
+ class-transformer@>=0.5 \
67
+ class-validator@>=0.14 \
68
+ ioredis@>=5 \
69
+ passport@>=0.7 \
70
+ passport-jwt@>=4 \
71
+ reflect-metadata@>=0.2 \
72
+ rxjs@>=7 \
73
+ typeorm@>=0.3
74
+ ```
75
+
76
+ ---
77
+
78
+ ## Installation
79
+
80
+ This package is published to the **GitHub Package Registry**, not the public npm registry. You must authenticate before you can install it.
81
+
82
+ ### Step 1 — Create a GitHub Personal Access Token
83
+
84
+ 1. Go to [GitHub → Settings → Developer settings → Personal access tokens → Tokens (classic)](https://github.com/settings/tokens)
85
+ 2. Click **Generate new token (classic)**
86
+ 3. Give it a note (e.g. `npm-packages-read`) and select the **`read:packages`** scope
87
+ 4. Click **Generate token** and copy the value — you will only see it once
88
+
89
+ ### Step 2 — Configure your project's `.npmrc`
90
+
91
+ Create (or edit) an `.npmrc` file at the **root of your project**. Use an environment variable for the token so it is never hardcoded or committed:
92
+
93
+ ```
94
+ @skyapp-labs:registry=https://npm.pkg.github.com
95
+ //npm.pkg.github.com/:_authToken=${GITHUB_TOKEN}
96
+ ```
97
+
98
+ Then set the token in your shell before running any npm command:
99
+
100
+ ```bash
101
+ # Add to your shell profile (~/.zshrc or ~/.bashrc) for permanent access
102
+ export GITHUB_TOKEN=ghp_your_token_here
103
+
104
+ # Or set it inline for a one-off install
105
+ GITHUB_TOKEN=ghp_your_token_here npm install
106
+ ```
107
+
108
+ > Add `.npmrc` to `.gitignore` only if you include a raw token in it. The version above using `${GITHUB_TOKEN}` is safe to commit — the value is read from the environment at install time.
109
+
110
+ ### Step 3 — Install the package
111
+
112
+ ```bash
113
+ npm install @skyapp-labs/blueprint-backend-core
114
+ ```
115
+
116
+ ### CI / CD (GitHub Actions)
117
+
118
+ The `GITHUB_TOKEN` secret is injected automatically in all GitHub Actions workflows — no extra secrets configuration needed. Just expose it as an environment variable:
119
+
120
+ ```yaml
121
+ - name: Install dependencies
122
+ run: npm ci
123
+ env:
124
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
125
+ ```
126
+
127
+ With the `.npmrc` shown in Step 2 already committed to your repo, `npm ci` will authenticate correctly.
128
+
129
+ ---
130
+
131
+ ## Quick Start
132
+
133
+ ### 1. Configure your `AppModule`
134
+
135
+ ```typescript
136
+ // app.module.ts
137
+ import { Module } from '@nestjs/common';
138
+ import { ConfigModule } from '@nestjs/config';
139
+ import { TypeOrmModule } from '@nestjs/typeorm';
140
+ import {
141
+ CoreModule,
142
+ appConfig,
143
+ databaseConfig,
144
+ envValidation,
145
+ TypeOrmService,
146
+ } from '@skyapp-labs/blueprint-backend-core';
147
+
148
+ @Module({
149
+ imports: [
150
+ // 1. Load configuration — must come before CoreModule
151
+ ConfigModule.forRoot({
152
+ isGlobal: true,
153
+ load: [appConfig, databaseConfig],
154
+ validate: envValidation,
155
+ }),
156
+
157
+ // 2. Wire up TypeORM using the built-in service (reads DATABASE_* env vars)
158
+ TypeOrmModule.forRootAsync({
159
+ useClass: TypeOrmService,
160
+ }),
161
+
162
+ // 3. Import CoreModule — all feature modules are registered automatically
163
+ CoreModule.forRoot(),
164
+ ],
165
+ })
166
+ export class AppModule {}
167
+ ```
168
+
169
+ ### 2. Selectively disable optional modules
170
+
171
+ ```typescript
172
+ CoreModule.forRoot({
173
+ modules: {
174
+ notifications: false, // disable FCM push notifications
175
+ admin: false, // disable admin dashboard & audit logs
176
+ health: false, // disable /health endpoints
177
+ },
178
+ })
179
+ ```
180
+
181
+ ### 3. Apply global middleware in `main.ts`
182
+
183
+ ```typescript
184
+ // main.ts
185
+ import { NestFactory } from '@nestjs/core';
186
+ import { ValidationPipe } from '@nestjs/common';
187
+ import {
188
+ HttpExceptionFilter,
189
+ LoggingInterceptor,
190
+ } from '@skyapp-labs/blueprint-backend-core';
191
+ import { AppModule } from './app.module';
192
+
193
+ async function bootstrap() {
194
+ const app = await NestFactory.create(AppModule);
195
+
196
+ app.useGlobalPipes(new ValidationPipe({ whitelist: true, transform: true }));
197
+ app.useGlobalFilters(new HttpExceptionFilter());
198
+
199
+ await app.listen(process.env.PORT ?? 3000);
200
+ }
201
+ bootstrap();
202
+ ```
203
+
204
+ ---
205
+
206
+ ## Environment Variables
207
+
208
+ Copy `.env.example` from this package as a starting point.
209
+
210
+ ### Application
211
+
212
+ | Variable | Default | Required | Description |
213
+ |----------|---------|----------|-------------|
214
+ | `NODE_ENV` | `development` | | `development` \| `production` \| `test` |
215
+ | `PORT` | `3000` | | HTTP server port |
216
+ | `APP_URL` | — | | Full base URL (used in invite/reset emails) |
217
+ | `APP_DEBUG` | `false` | | Enable verbose logging |
218
+ | `SWAGGER_ENABLED` | auto | | Force-enable Swagger in production (`true`/`false`) |
219
+
220
+ ### Database
221
+
222
+ | Variable | Default | Required | Description |
223
+ |----------|---------|----------|-------------|
224
+ | `DATABASE_HOST` | `localhost` | | PostgreSQL host |
225
+ | `DATABASE_PORT` | `5432` | | PostgreSQL port |
226
+ | `DATABASE_USERNAME` | — | **yes** | DB username |
227
+ | `DATABASE_PASSWORD` | — | **yes** | DB password |
228
+ | `DATABASE_NAME` | — | **yes** | DB name |
229
+ | `DATABASE_SSL` | `false` | | Enable SSL (`true`/`false`) |
230
+
231
+ ### JWT
232
+
233
+ | Variable | Default | Required | Description |
234
+ |----------|---------|----------|-------------|
235
+ | `JWT_SECRET` | — | **yes** | Use a strong random string in production |
236
+ | `JWT_EXPIRATION` | `1d` | | Access token lifetime (e.g. `15m`, `1h`, `1d`) |
237
+
238
+ ### Redis
239
+
240
+ | Variable | Default | Required | Description |
241
+ |----------|---------|----------|-------------|
242
+ | `REDIS_ENABLED` | `false` | | Set to `true` to enable OTP, rate limiting, and background jobs |
243
+ | `REDIS_HOST` | `localhost` | | Redis host |
244
+ | `REDIS_PORT` | `6379` | | Redis port |
245
+ | `REDIS_PASSWORD` | — | | Redis password (leave empty for local dev) |
246
+ | `REDIS_TLS` | `false` | | Enable TLS (for managed Redis — Upstash, ElastiCache, etc.) |
247
+
248
+ > When `REDIS_ENABLED=false`, OTP flows and background jobs are gracefully disabled. JWT-based auth still works, but OTP sending/verification, per-IP rate limiting, and job queues are inactive.
249
+
250
+ ### Keycloak (optional)
251
+
252
+ Only required when using the Keycloak auth provider:
253
+
254
+ | Variable | Description |
255
+ |----------|-------------|
256
+ | `KEYCLOAK_ISSUER_URL` | e.g. `https://auth.example.com/realms/myrealm` |
257
+ | `KEYCLOAK_REALM` | Realm name |
258
+ | `KEYCLOAK_CLIENT_ID` | API client ID |
259
+ | `KEYCLOAK_CLIENT_SECRET` | Client secret (confidential clients only) |
260
+ | `KEYCLOAK_ADMIN_URL` | Admin API base URL |
261
+ | `KEYCLOAK_ADMIN_USERNAME` | Admin console username |
262
+ | `KEYCLOAK_ADMIN_PASSWORD` | Admin console password |
263
+
264
+ ### Seed (optional)
265
+
266
+ Used only by `npm run seed` to create the initial super admin:
267
+
268
+ | Variable | Description |
269
+ |----------|-------------|
270
+ | `SUPER_ADMIN_EMAIL` | Super admin email |
271
+ | `SUPER_ADMIN_PHONE` | Phone in E.164 format (e.g. `+2348012345678`) |
272
+ | `SUPER_ADMIN_FIRST_NAME` | First name |
273
+ | `SUPER_ADMIN_LAST_NAME` | Last name |
274
+ | `SUPER_ADMIN_PASSWORD` | Password (native auth only) |
275
+ | `SUPER_ADMIN_COUNTRY_CODE` | ISO 3166-1 alpha-2 (e.g. `NG`) |
276
+
277
+ ---
278
+
279
+ ## Database Setup
280
+
281
+ `TypeOrmService` (exported from this package) automatically resolves entity and migration paths. Pass it to `TypeOrmModule.forRootAsync` as shown in the Quick Start and entities + migrations are wired up for you.
282
+
283
+ If you need to add your own entities or migrations alongside core ones, extend the service:
284
+
285
+ ```typescript
286
+ // typeorm.service.ts (in your app)
287
+ import { TypeOrmService as CoreTypeOrmService } from '@skyapp-labs/blueprint-backend-core';
288
+ import { Injectable } from '@nestjs/common';
289
+ import { TypeOrmModuleOptions } from '@nestjs/typeorm';
290
+ import { join } from 'path';
291
+
292
+ @Injectable()
293
+ export class TypeOrmService extends CoreTypeOrmService {
294
+ createTypeOrmOptions(): TypeOrmModuleOptions {
295
+ const base = super.createTypeOrmOptions() as Record<string, unknown>;
296
+ return {
297
+ ...base,
298
+ entities: [
299
+ ...(base.entities as string[]),
300
+ join(__dirname, '**/*.entity{.ts,.js}'),
301
+ ],
302
+ migrations: [
303
+ ...(base.migrations as string[]),
304
+ join(__dirname, 'database/migrations/*{.ts,.js}'),
305
+ ],
306
+ };
307
+ }
308
+ }
309
+ ```
310
+
311
+ ### Run migrations
312
+
313
+ ```bash
314
+ npm run migration:run
315
+ ```
316
+
317
+ ### Run seeds
318
+
319
+ Creates default roles, permissions, app settings, and optionally a super admin. Seeds are idempotent — safe to run multiple times.
320
+
321
+ ```bash
322
+ npm run seed
323
+ ```
324
+
325
+ You can also run seeds programmatically from your own project:
326
+
327
+ ```typescript
328
+ import { runCoreSeeds } from '@skyapp-labs/blueprint-backend-core';
329
+
330
+ await runCoreSeeds();
331
+ ```
332
+
333
+ ---
334
+
335
+ ## Modules Reference
336
+
337
+ ### Auth
338
+
339
+ Handles the full authentication lifecycle with a pluggable provider system.
340
+
341
+ **Auth providers** (set via the `auth.provider` app setting):
342
+
343
+ | Provider | Description |
344
+ |----------|-------------|
345
+ | `native` | Email + password, or phone + OTP |
346
+ | `keycloak` | Delegates auth to a Keycloak instance |
347
+
348
+ **Endpoints:**
349
+
350
+ | Method | Path | Auth | Description |
351
+ |--------|------|------|-------------|
352
+ | `GET` | `/auth/config` | Public | Returns active auth method (`phone`/`email`) and whether password reset is enabled |
353
+ | `POST` | `/auth/register` | Public | Self-registration |
354
+ | `POST` | `/auth/login` | Public | Login — email+password or phone+OTP |
355
+ | `POST` | `/auth/send-otp` | Public | Send OTP to phone or email |
356
+ | `POST` | `/auth/verify-otp` | Public | Verify OTP code, returns bridge token |
357
+ | `POST` | `/auth/forgot-password` | Public | Request password reset link |
358
+ | `POST` | `/auth/reset-password` | Public | Submit new password with reset token |
359
+ | `POST` | `/auth/accept-invite` | Public | Accept an email/phone invitation |
360
+ | `DELETE` | `/auth/account` | JWT | Delete own account |
361
+
362
+ ### Sessions
363
+
364
+ | Method | Path | Auth | Description |
365
+ |--------|------|------|-------------|
366
+ | `POST` | `/auth/refresh` | Public | Rotate refresh token, returns new token pair |
367
+ | `POST` | `/auth/logout` | JWT | Revoke all active sessions for the current user |
368
+ | `GET` | `/auth/sessions` | JWT | List all active sessions for the current user |
369
+ | `POST` | `/auth/sessions/:sessionId/revoke` | JWT | Revoke a specific session by ID |
370
+
371
+ ### Users
372
+
373
+ | Method | Path | Permission | Description |
374
+ |--------|------|-----------|-------------|
375
+ | `GET` | `/users` | `users:read` | Paginated user list with search/filter |
376
+ | `GET` | `/users/stats` | `users:read` | User count breakdown (total/active/invited/suspended) |
377
+ | `GET` | `/users/:id` | `users:read` | Get user by ID |
378
+ | `PATCH` | `/users/:id` | `users:update` | Update user fields |
379
+ | `DELETE` | `/users/:id` | `users:delete` | Soft-delete user |
380
+ | `POST` | `/users/:id/deactivate` | `users:deactivate` | Suspend a user |
381
+ | `POST` | `/users/:id/activate` | `users:activate` | Reactivate a suspended user |
382
+ | `POST` | `/users/invite` | `users:invite` | Send an email/phone invite |
383
+ | `POST` | `/users/:id/resend-invite` | `users:invite` | Resend an invite |
384
+ | `DELETE` | `/users/:id/invite` | `users:invite` | Cancel a pending invite |
385
+
386
+ ### Profile
387
+
388
+ | Method | Path | Auth | Description |
389
+ |--------|------|------|-------------|
390
+ | `GET` | `/profile` | JWT | Get own profile |
391
+ | `PATCH` | `/profile` | JWT | Update profile fields |
392
+ | `POST` | `/profile/change-phone` | JWT | Request phone number change (triggers OTP) |
393
+ | `POST` | `/profile/change-phone/verify` | JWT | Confirm phone change with OTP code |
394
+ | `DELETE` | `/profile` | JWT | Delete own account |
395
+
396
+ ### Roles & Permissions
397
+
398
+ Manifest-based RBAC. Modules declare their permissions in manifest files; the core syncs them to the database on startup automatically.
399
+
400
+ | Method | Path | Permission | Description |
401
+ |--------|------|-----------|-------------|
402
+ | `GET` | `/roles` | `roles:read` | List roles |
403
+ | `POST` | `/roles` | `roles:create` | Create a role |
404
+ | `PATCH` | `/roles/:id` | `roles:update` | Update role / assign permissions |
405
+ | `DELETE` | `/roles/:id` | `roles:delete` | Delete a role |
406
+ | `POST` | `/roles/users/:userId/roles` | `roles:assign` | Assign a role to a user |
407
+ | `DELETE` | `/roles/users/:userId/roles/:roleId` | `roles:assign` | Remove a role from a user |
408
+ | `GET` | `/modules` | `roles:read` | List all registered modules |
409
+ | `GET` | `/permissions` | `roles:read` | List all permissions |
410
+
411
+ **Defining permissions for your own module:**
412
+
413
+ ```typescript
414
+ // billing/billing.manifest.ts
415
+ import type { ModuleManifest } from '@skyapp-labs/blueprint-backend-core';
416
+
417
+ export const BILLING_PERMISSIONS = {
418
+ READ: 'billing:read',
419
+ CHARGE: 'billing:charge',
420
+ } as const;
421
+
422
+ export const manifest: ModuleManifest = {
423
+ slug: 'billing',
424
+ name: 'Billing',
425
+ permissions: [
426
+ { slug: BILLING_PERMISSIONS.READ, name: 'View billing' },
427
+ { slug: BILLING_PERMISSIONS.CHARGE, name: 'Charge customer' },
428
+ ],
429
+ };
430
+ ```
431
+
432
+ The manifest is auto-discovered at startup — no registration needed. Permissions appear in the database and can be assigned to roles via the API.
433
+
434
+ **Protecting routes:**
435
+
436
+ ```typescript
437
+ import { RequirePermission } from '@skyapp-labs/blueprint-backend-core';
438
+ import { BILLING_PERMISSIONS } from './billing.manifest';
439
+
440
+ @Get('invoices')
441
+ @RequirePermission(BILLING_PERMISSIONS.READ)
442
+ findAll() { ... }
443
+ ```
444
+
445
+ ### Notifications
446
+
447
+ | Method | Path | Auth | Description |
448
+ |--------|------|------|-------------|
449
+ | `POST` | `/notifications/devices` | JWT | Register an FCM device token |
450
+ | `DELETE` | `/notifications/devices` | JWT | Remove a device token |
451
+ | `GET` | `/notifications/devices` | JWT | List registered devices for the current user |
452
+ | `GET` | `/notifications` | JWT | Paginated in-app notification list |
453
+ | `PATCH` | `/notifications/:id/read` | JWT | Mark a notification as read |
454
+ | `PATCH` | `/notifications/read-all` | JWT | Mark all notifications as read |
455
+
456
+ ### Settings
457
+
458
+ DB-backed runtime configuration. All OTP templates, rate limits, token TTLs, and provider credentials are stored here and editable via the API — no app restart required.
459
+
460
+ | Method | Path | Permission | Description |
461
+ |--------|------|-----------|-------------|
462
+ | `GET` | `/settings` | Authenticated | List all settings |
463
+ | `PATCH` | `/settings/:key` | Admin | Update a setting value |
464
+
465
+ **Reading a setting in your service:**
466
+
467
+ ```typescript
468
+ import { SettingsService, SETTING_KEYS } from '@skyapp-labs/blueprint-backend-core';
469
+
470
+ @Injectable()
471
+ export class YourService {
472
+ constructor(private readonly settings: SettingsService) {}
473
+
474
+ doSomething() {
475
+ const ttl = this.settings.get<number>(SETTING_KEYS.TOKENS_REFRESH_TTL_DAYS);
476
+ const provider = this.settings.get<string>(SETTING_KEYS.SMS_ACTIVE_PROVIDER);
477
+ }
478
+ }
479
+ ```
480
+
481
+ `SettingsModule` is `@Global` — inject `SettingsService` anywhere without importing the module.
482
+
483
+ ### Health
484
+
485
+ | Endpoint | Description |
486
+ |----------|-------------|
487
+ | `GET /health/liveness` | Always returns 200 — use as Kubernetes liveness probe |
488
+ | `GET /health/readiness` | Checks PostgreSQL connectivity — use as readiness probe |
489
+ | `GET /health/full` | Checks DB + Redis + heap memory + RSS memory + disk + BullMQ queue depth |
490
+
491
+ ### Admin
492
+
493
+ | Method | Path | Permission | Description |
494
+ |--------|------|-----------|-------------|
495
+ | `GET` | `/admin/dashboard` | `users:read` | System stats: user counts, active sessions, uptime |
496
+ | `GET` | `/admin/logs` | `users:read` | Paginated admin audit log with filters (actor, action, date range) |
497
+
498
+ ### Jobs (BullMQ)
499
+
500
+ Three queues for fire-and-forget delivery. Use `JobsQueue` to enqueue jobs from any service:
501
+
502
+ ```typescript
503
+ import { JobsQueue } from '@skyapp-labs/blueprint-backend-core';
504
+
505
+ @Injectable()
506
+ export class YourService {
507
+ constructor(
508
+ @Optional() @Inject(JobsQueue) private readonly jobs: JobsQueue | null,
509
+ ) {}
510
+
511
+ async notify() {
512
+ // Email
513
+ await this.jobs?.addSendEmail({
514
+ to: 'user@example.com',
515
+ subject: 'Welcome',
516
+ template: 'welcome',
517
+ data: { name: 'Alice' },
518
+ });
519
+
520
+ // SMS
521
+ await this.jobs?.addSendSms({
522
+ to: '+2348012345678',
523
+ correlationId: 'some-id',
524
+ });
525
+
526
+ // Push notification
527
+ await this.jobs?.addSendPushNotification({
528
+ token: 'fcm-device-token',
529
+ title: 'New message',
530
+ body: 'You have a new message',
531
+ });
532
+ }
533
+ }
534
+ ```
535
+
536
+ Use `@Optional()` so your service degrades gracefully when `REDIS_ENABLED=false`.
537
+
538
+ ---
539
+
540
+ ## Using Core Services
541
+
542
+ Import the module that owns a service, then inject the service normally in your provider.
543
+
544
+ ```typescript
545
+ // your-feature.module.ts
546
+ import { Module } from '@nestjs/common';
547
+ import { UsersModule } from '@skyapp-labs/blueprint-backend-core';
548
+ import { YourFeatureService } from './your-feature.service';
549
+
550
+ @Module({
551
+ imports: [UsersModule],
552
+ providers: [YourFeatureService],
553
+ })
554
+ export class YourFeatureModule {}
555
+ ```
556
+
557
+ ```typescript
558
+ // your-feature.service.ts
559
+ import { Injectable } from '@nestjs/common';
560
+ import { UsersService } from '@skyapp-labs/blueprint-backend-core';
561
+
562
+ @Injectable()
563
+ export class YourFeatureService {
564
+ constructor(private readonly usersService: UsersService) {}
565
+
566
+ async getUserName(userId: string) {
567
+ const user = await this.usersService.findByIdOrFail(userId);
568
+ return user.fullName;
569
+ }
570
+ }
571
+ ```
572
+
573
+ **Available services and their owning modules:**
574
+
575
+ | Service | Import module | Purpose |
576
+ |---------|--------------|---------|
577
+ | `UsersService` | `UsersModule` | User CRUD — find, create, update, delete, ban, activate |
578
+ | `InviteService` | `UsersModule` | Generate and redeem invite tokens |
579
+ | `AdminLogService` | `UsersModule` | Write immutable audit log entries |
580
+ | `SettingsService` | `SettingsModule` (global) | Read/write DB-backed runtime config |
581
+ | `RolesService` | `RolesModule` | Role management |
582
+ | `PermissionsService` | `RolesModule` | Permission management |
583
+ | `UserRolesService` | `RolesModule` | Assign and revoke roles on users |
584
+ | `TokenService` | `SessionsModule` | Issue, rotate, and revoke JWT tokens |
585
+ | `ProfileService` | `ProfileModule` | Profile read/update logic |
586
+ | `JobsQueue` | `JobsModule.register()` | Enqueue email/SMS/push notification jobs |
587
+
588
+ ---
589
+
590
+ ## Common Utilities
591
+
592
+ ### Base entities
593
+
594
+ ```typescript
595
+ import {
596
+ BaseEntity, // id, createdAt, updatedAt, deletedAt, version
597
+ ImmutableEntity // id, createdAt only — for ledger/audit records
598
+ } from '@skyapp-labs/blueprint-backend-core';
599
+
600
+ @Entity('orders')
601
+ export class Order extends BaseEntity {
602
+ @Column() amount!: number;
603
+ }
604
+ ```
605
+
606
+ ### Guards
607
+
608
+ ```typescript
609
+ import {
610
+ JwtAuthGuard, // validates Bearer JWT token
611
+ PermissionsGuard, // enforces @RequirePermission() on routes
612
+ LoginIpRateLimitGuard, // rate-limits login attempts by IP
613
+ OtpIpRateLimitGuard, // rate-limits OTP send requests by IP
614
+ } from '@skyapp-labs/blueprint-backend-core';
615
+ ```
616
+
617
+ ### Decorators
618
+
619
+ ```typescript
620
+ import {
621
+ CurrentUser, // injects the authenticated User from the JWT payload
622
+ Public, // marks a route as publicly accessible (no JWT required)
623
+ RequirePermission, // guards a route behind a permission slug
624
+ IpAddress, // injects the client IP address as a method parameter
625
+ UserAgent, // injects the User-Agent header as a method parameter
626
+ } from '@skyapp-labs/blueprint-backend-core';
627
+
628
+ @Get('me')
629
+ @UseGuards(JwtAuthGuard)
630
+ getProfile(@CurrentUser() user: User) { ... }
631
+
632
+ @Get('ping')
633
+ @Public()
634
+ ping() { return 'pong'; }
635
+
636
+ @Delete(':id')
637
+ @RequirePermission('users:delete')
638
+ remove(@Param('id') id: string, @IpAddress() ip: string) { ... }
639
+ ```
640
+
641
+ ### Pagination DTO
642
+
643
+ ```typescript
644
+ import { PaginationDto } from '@skyapp-labs/blueprint-backend-core';
645
+
646
+ @Get()
647
+ findAll(@Query() pagination: PaginationDto) {
648
+ // pagination.page, pagination.limit
649
+ }
650
+ ```
651
+
652
+ ### Filters & interceptors
653
+
654
+ ```typescript
655
+ import {
656
+ HttpExceptionFilter, // standardises all error response shapes
657
+ LoggingInterceptor, // logs method, path, status code, and response time
658
+ } from '@skyapp-labs/blueprint-backend-core';
659
+
660
+ // Apply globally in main.ts
661
+ app.useGlobalFilters(new HttpExceptionFilter());
662
+ app.useGlobalInterceptors(new LoggingInterceptor(configService));
663
+ ```
664
+
665
+ ### Infrastructure modules
666
+
667
+ ```typescript
668
+ import {
669
+ RedisModule, // REDIS_ENABLED-aware ioredis module
670
+ REDIS_CLIENT, // injection token for the raw ioredis client
671
+ FirebaseModule, // Firebase Admin SDK (credentials from Settings)
672
+ KeycloakModule, // Keycloak JWKS + token verification
673
+ } from '@skyapp-labs/blueprint-backend-core';
674
+ ```
675
+
676
+ ---
677
+
678
+ ## App Settings Reference
679
+
680
+ All settings are stored in the `app_settings` table and editable at runtime via `PATCH /settings/:key`. Use `SETTING_KEYS` constants to reference them in code.
681
+
682
+ ### OTP
683
+
684
+ | Key | Description |
685
+ |-----|-------------|
686
+ | `otp.ttl_seconds` | OTP session lifetime before it expires |
687
+ | `otp.max_attempts` | Wrong-code attempts before session lockout |
688
+ | `otp.resend_cooldown_seconds` | Minimum wait between resend requests |
689
+ | `otp.rate_limit_max` | Max OTP sends per identifier within the window |
690
+ | `otp.rate_limit_window_seconds` | Rolling window for per-identifier rate limit |
691
+ | `otp.ip_rate_limit_max` | Max OTP requests per IP within the window |
692
+ | `otp.ip_rate_limit_window_seconds` | Rolling window for per-IP rate limit |
693
+ | `otp.sms_template` | SMS body — use `{code}` as placeholder |
694
+ | `otp.email_subject` | Email subject line |
695
+ | `otp.email_html_template` | HTML email body — use `{code}` as placeholder |
696
+ | `otp.email_text_template` | Plain-text email fallback |
697
+
698
+ ### Tokens
699
+
700
+ | Key | Description |
701
+ |-----|-------------|
702
+ | `tokens.refresh_ttl_days` | Refresh token lifetime in days |
703
+ | `tokens.temporary_ttl_seconds` | Bridge token lifetime after OTP verification |
704
+ | `tokens.access_expires_in` | Access token expiry (e.g. `15m`, `1h`) |
705
+ | `tokens.invite_ttl_days` | Invite link lifetime in days |
706
+ | `tokens.password_reset_ttl_seconds` | Password reset token lifetime |
707
+
708
+ ### Auth
709
+
710
+ | Key | Description |
711
+ |-----|-------------|
712
+ | `auth.provider` | Active auth provider: `native` \| `keycloak` |
713
+ | `auth.method` | Primary identity method: `phone` \| `email` |
714
+ | `auth.default_role_slug` | Role auto-assigned to every self-registered user (empty = no role) |
715
+
716
+ ### Login rate limiting
717
+
718
+ | Key | Description |
719
+ |-----|-------------|
720
+ | `login.ip_rate_limit_max` | Max login attempts per IP within the window |
721
+ | `login.ip_rate_limit_window_seconds` | Rolling window for per-IP login limit |
722
+ | `login.lockout_max_attempts` | Failed attempts before account is temporarily locked |
723
+ | `login.lockout_duration_seconds` | How long the lockout lasts |
724
+
725
+ ### Health thresholds
726
+
727
+ | Key | Description |
728
+ |-----|-------------|
729
+ | `health.max_heap_mb` | Heap memory threshold (MB) — triggers health warning |
730
+ | `health.max_rss_mb` | RSS memory threshold (MB) — triggers health warning |
731
+ | `health.queue_depth_threshold` | BullMQ queue depth above which health check warns |
732
+
733
+ ### SMS providers
734
+
735
+ | Key | Description |
736
+ |-----|-------------|
737
+ | `sms.active_provider` | `twilio` \| `termii` \| `infobip` \| `smartsms` |
738
+ | `sms.twilio_from_number` | Twilio sender number (E.164) |
739
+ | `sms.twilio_account_sid` | Twilio account SID |
740
+ | `sms.twilio_auth_token` | Twilio auth token |
741
+ | `sms.termii_api_key` | Termii API key |
742
+ | `sms.termii_sender_id` | Termii sender ID |
743
+ | `sms.infobip_api_key` | Infobip API key |
744
+ | `sms.infobip_sender_id` | Infobip sender ID |
745
+ | `sms.infobip_base_url` | Infobip base URL (e.g. `https://XXXXX.api.infobip.com`) |
746
+ | `sms.smartsms_token` | SmartSMS auth token |
747
+ | `sms.smartsms_sender_id` | SmartSMS sender ID |
748
+
749
+ ### Email providers
750
+
751
+ | Key | Description |
752
+ |-----|-------------|
753
+ | `email.active_provider` | `resend` \| `sendgrid` \| `mailgun` \| `smtp` |
754
+ | `email.from_address` | From address for all outbound emails |
755
+ | `email.resend_api_key` | Resend API key |
756
+ | `email.sendgrid_api_key` | SendGrid API key |
757
+ | `email.mailgun_api_key` | Mailgun API key |
758
+ | `email.mailgun_domain` | Mailgun sending domain |
759
+ | `email.smtp_host` | SMTP host |
760
+ | `email.smtp_port` | SMTP port (587 = STARTTLS, 465 = SSL) |
761
+ | `email.smtp_user` | SMTP username |
762
+ | `email.smtp_pass` | SMTP password |
763
+
764
+ ### Firebase (push notifications)
765
+
766
+ | Key | Description |
767
+ |-----|-------------|
768
+ | `firebase.project_id` | Firebase project ID |
769
+ | `firebase.client_email` | Service account client email |
770
+ | `firebase.private_key` | Service account private key (PEM) |
771
+ | `firebase.api_key` | Firebase web API key |
772
+
773
+ ### Testing
774
+
775
+ | Key | Description |
776
+ |-----|-------------|
777
+ | `test.otp_identifiers` | JSON array of test identifiers with fixed OTP codes. Schema: `[{ "identifier": string, "channel": "sms"\|"email", "code": string }]`. **Hard-disabled in production regardless of this value.** |
778
+
779
+ ---
780
+
781
+ ## RBAC — Roles & Permissions
782
+
783
+ The RBAC system is manifest-driven. Here is the full flow from declaration to enforcement:
784
+
785
+ 1. **Define a manifest** in each feature module (see [Roles & Permissions](#roles--permissions) above)
786
+ 2. **On startup**, the core scans all manifests and upserts modules + permissions into the `modules` and `permissions` tables — new records are inserted, existing ones are updated, nothing is ever deleted
787
+ 3. **Assign permissions to roles** via the `/roles` API or a seed script
788
+ 4. **Assign roles to users** via `POST /roles/users/:userId/roles`
789
+ 5. **Protect routes** with `@RequirePermission('module:action')`
790
+
791
+ The JWT access token includes the user's permission slugs as a claim — there is no database query per request to check permissions.
792
+
793
+ ---
794
+
795
+ ## Extending the Core
796
+
797
+ ### Add a linked entity to User
798
+
799
+ Never modify the `User` entity directly. Create a linked entity in your own module:
800
+
801
+ ```typescript
802
+ // modules/extended-profile/extended-profile.entity.ts
803
+ import { Entity, Column, OneToOne, JoinColumn } from 'typeorm';
804
+ import { BaseEntity, User } from '@skyapp-labs/blueprint-backend-core';
805
+
806
+ @Entity('extended_profiles')
807
+ export class ExtendedProfile extends BaseEntity {
808
+ @OneToOne(() => User, { onDelete: 'CASCADE' })
809
+ @JoinColumn({ name: 'user_id' })
810
+ user!: User;
811
+
812
+ @Column({ nullable: true })
813
+ bio?: string;
814
+
815
+ @Column({ nullable: true })
816
+ avatarUrl?: string;
817
+ }
818
+ ```
819
+
820
+ ### Write audit log entries
821
+
822
+ ```typescript
823
+ import { AdminLogService } from '@skyapp-labs/blueprint-backend-core';
824
+
825
+ this.adminLog.log({
826
+ actorId: adminUser.id,
827
+ action: 'billing.refund',
828
+ targetType: 'order',
829
+ targetId: orderId,
830
+ metadata: { amount: 5000 },
831
+ ipAddress: ip,
832
+ });
833
+ ```
834
+
835
+ `AdminLog` entries are stored in an `ImmutableEntity` table — they have no `updatedAt` or `deletedAt` and cannot be soft-deleted.
836
+
837
+ ---
838
+
839
+ ## Overriding a Core Module
840
+
841
+ If a core module's default behavior does not fit your project, override it rather than forking or editing the package.
842
+
843
+ **Step 1 — Disable the core module:**
844
+
845
+ ```typescript
846
+ CoreModule.forRoot({
847
+ modules: { notifications: false },
848
+ })
849
+ ```
850
+
851
+ Or for modules without a disable flag, simply do not register them individually and instead import your replacement.
852
+
853
+ **Step 2 — Create a replacement in `src/modules/`:**
854
+
855
+ ```typescript
856
+ // src/modules/notifications/notifications.module.ts
857
+ import { Module } from '@nestjs/common';
858
+ import { UsersModule } from '@skyapp-labs/blueprint-backend-core';
859
+ import { NotificationsController } from './notifications.controller';
860
+ import { NotificationsService } from './notifications.service';
861
+
862
+ @Module({
863
+ imports: [UsersModule],
864
+ controllers: [NotificationsController],
865
+ providers: [NotificationsService],
866
+ })
867
+ export class NotificationsModule {}
868
+ ```
869
+
870
+ **Step 3 — Add it to your `AppModule`.**
871
+
872
+ Your controller is now the only handler — the core version is not registered at runtime.
873
+
874
+ > When upgrading the package, review the changelog for API changes in any core service your override depends on (e.g. `UsersService`, `SettingsService`) and update accordingly.
875
+
876
+ ---
877
+
878
+ ## Development Scripts
879
+
880
+ Run these from within this repository when developing the package itself.
881
+
882
+ ```bash
883
+ # Install dependencies
884
+ npm install
885
+
886
+ # Build
887
+ npm run build
888
+
889
+ # Run unit tests
890
+ npm test
891
+
892
+ # Run tests with coverage report
893
+ npm run test:cov
894
+
895
+ # Run tests in CI mode (parallel, with coverage)
896
+ npm run test:ci
897
+
898
+ # Type-check without emitting files
899
+ npm run typecheck
900
+
901
+ # Lint
902
+ npm run lint
903
+ npm run lint:fix
904
+
905
+ # Format
906
+ npm run format
907
+ npm run format:check
908
+
909
+ # ── Database (requires a valid .env with DB credentials) ──────────────────
910
+
911
+ # Apply all pending migrations
912
+ npm run migration:run
913
+
914
+ # Generate a migration from entity changes (diff against current DB schema)
915
+ npm run migration:update
916
+
917
+ # Revert the last migration
918
+ npm run migration:revert
919
+
920
+ # Drop all tables
921
+ npm run schema:drop
922
+
923
+ # Drop and regenerate a full schema migration from scratch
924
+ npm run schema:create
925
+
926
+ # Seed the database (roles, permissions, settings, optional super admin)
927
+ npm run seed
928
+ ```
929
+
930
+ ---
931
+
932
+ ## Versioning
933
+
934
+ This package uses [semantic-release](https://semantic-release.gitbook.io/) with [Conventional Commits](https://www.conventionalcommits.org/). Releases are published automatically when commits are merged to `main`.
935
+
936
+ | Commit prefix | Release type | Example |
937
+ |---------------|-------------|---------|
938
+ | `fix:` | Patch `1.0.x` | `fix: handle null phone on login` |
939
+ | `feat:` | Minor `1.x.0` | `feat: add bulk user deactivation` |
940
+ | `feat!:` or `BREAKING CHANGE:` footer | Major `x.0.0` | `feat!: remove deprecated login endpoint` |
941
+
942
+ The changelog is updated automatically in `CHANGELOG.md` on each release.
943
+
944
+ **Install a specific version:**
945
+
946
+ ```bash
947
+ npm install @skyapp-labs/blueprint-backend-core@1.2.3
948
+ ```
949
+
950
+ **Always install the latest:**
951
+
952
+ ```bash
953
+ npm install @skyapp-labs/blueprint-backend-core@latest
954
+ ```