itlab-internal-services 2.15.7 → 2.16.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 (371) hide show
  1. package/README.md +1 -187
  2. package/dist/classes/document-merger.class.js +2 -3
  3. package/dist/classes/index.d.ts +4 -1
  4. package/dist/classes/index.js +7 -3
  5. package/dist/classes/report-category.class.d.ts +55 -0
  6. package/dist/classes/report-category.class.js +120 -0
  7. package/dist/classes/schema-builder.class.d.ts +75 -0
  8. package/dist/classes/schema-builder.class.js +109 -0
  9. package/dist/classes/task-manager.class.d.ts +71 -0
  10. package/dist/classes/task-manager.class.js +99 -0
  11. package/dist/decorators/{account.decorator.d.ts → authenticated-account.decorator.d.ts} +4 -4
  12. package/dist/decorators/{account.decorator.js → authenticated-account.decorator.js} +8 -10
  13. package/dist/decorators/index.d.ts +1 -1
  14. package/dist/decorators/index.js +1 -1
  15. package/dist/exceptions/authenticated-user-required.exception.d.ts +34 -0
  16. package/dist/exceptions/authenticated-user-required.exception.js +51 -0
  17. package/dist/exceptions/bad-body.exception.d.ts +19 -8
  18. package/dist/exceptions/bad-body.exception.js +26 -10
  19. package/dist/exceptions/bad-parameter.exception.d.ts +23 -8
  20. package/dist/exceptions/bad-parameter.exception.js +41 -18
  21. package/dist/exceptions/duplicate.exception.d.ts +20 -8
  22. package/dist/exceptions/duplicate.exception.js +27 -10
  23. package/dist/exceptions/index.d.ts +1 -0
  24. package/dist/exceptions/index.js +1 -0
  25. package/dist/functions/add-views-likes-virtuals.function.d.ts +15 -0
  26. package/dist/functions/add-views-likes-virtuals.function.js +43 -0
  27. package/dist/functions/create-internal-axios-client.function.js +2 -2
  28. package/dist/functions/index.d.ts +1 -0
  29. package/dist/functions/index.js +3 -1
  30. package/dist/index.d.ts +5 -5
  31. package/dist/index.js +5 -5
  32. package/dist/interceptors/attribute-sanitizer.interceptor.d.ts +68 -0
  33. package/dist/interceptors/attribute-sanitizer.interceptor.js +154 -0
  34. package/dist/interceptors/index.d.ts +1 -0
  35. package/dist/interceptors/index.js +17 -0
  36. package/dist/middleware/http-logging.middleware.d.ts +19 -0
  37. package/dist/middleware/http-logging.middleware.js +50 -0
  38. package/dist/middleware/index.d.ts +1 -0
  39. package/dist/middleware/index.js +17 -0
  40. package/dist/models/account.model.d.ts +23 -0
  41. package/dist/models/account.model.js +59 -0
  42. package/dist/models/index.d.ts +3 -1
  43. package/dist/models/index.js +7 -3
  44. package/dist/{modules/search/models → models}/search-document.model.d.ts +1 -1
  45. package/dist/{modules/search/models → models}/search-document.model.js +1 -1
  46. package/dist/models/{account-entity.model.d.ts → user.model.d.ts} +8 -21
  47. package/dist/models/{account-entity.model.js → user.model.js} +11 -25
  48. package/dist/modules/authentication/authentication-module-options.interface.d.ts +2 -8
  49. package/dist/modules/authentication/authentication-options.parameter.d.ts +4 -0
  50. package/dist/modules/authentication/{inject-auth-options.decorator.js → authentication-options.parameter.js} +5 -2
  51. package/dist/modules/authentication/authentication.module.d.ts +23 -0
  52. package/dist/modules/authentication/authentication.module.js +24 -1
  53. package/dist/modules/authentication/guards/index.d.ts +2 -2
  54. package/dist/modules/authentication/guards/index.js +7 -7
  55. package/dist/modules/authentication/guards/jwt-auth.guard.d.ts +17 -0
  56. package/dist/modules/authentication/guards/jwt-auth.guard.js +67 -0
  57. package/dist/modules/authentication/guards/permissions.guard.d.ts +5 -27
  58. package/dist/modules/authentication/guards/permissions.guard.js +27 -59
  59. package/dist/modules/authentication/guards/public.guard.d.ts +7 -13
  60. package/dist/modules/authentication/guards/public.guard.js +10 -24
  61. package/dist/modules/authentication/guards/service-auth.guard.d.ts +22 -0
  62. package/dist/modules/authentication/guards/service-auth.guard.js +65 -0
  63. package/dist/modules/authentication/index.d.ts +3 -3
  64. package/dist/modules/authentication/index.js +3 -5
  65. package/dist/modules/cache/cache-response.interceptor.d.ts +2 -2
  66. package/dist/modules/cache/cache-response.interceptor.js +2 -2
  67. package/dist/modules/cache/index.d.ts +1 -0
  68. package/dist/modules/cache/index.js +1 -0
  69. package/dist/modules/comment/comment-module-options.interface.d.ts +38 -0
  70. package/dist/modules/comment/comment.controller.d.ts +24 -30
  71. package/dist/modules/comment/comment.controller.js +59 -61
  72. package/dist/modules/comment/comment.module-definition.d.ts +1 -42
  73. package/dist/modules/comment/comment.module-definition.js +1 -2
  74. package/dist/modules/comment/comment.module.d.ts +13 -13
  75. package/dist/modules/comment/comment.module.js +15 -42
  76. package/dist/modules/comment/comment.service.d.ts +27 -37
  77. package/dist/modules/comment/comment.service.js +50 -84
  78. package/dist/modules/comment/index.d.ts +2 -3
  79. package/dist/modules/comment/index.js +16 -7
  80. package/dist/modules/database/database.module.js +2 -5
  81. package/dist/modules/database/index.d.ts +2 -5
  82. package/dist/modules/database/index.js +17 -9
  83. package/dist/modules/index.d.ts +2 -6
  84. package/dist/modules/index.js +2 -6
  85. package/dist/modules/like/index.d.ts +2 -1
  86. package/dist/modules/like/index.js +16 -3
  87. package/dist/modules/like/like-module-options.interface.d.ts +21 -0
  88. package/dist/modules/like/like.controller.d.ts +45 -37
  89. package/dist/modules/like/like.controller.js +117 -102
  90. package/dist/modules/like/like.module-definition.d.ts +1 -17
  91. package/dist/modules/like/like.module-definition.js +1 -2
  92. package/dist/modules/like/like.module.d.ts +12 -12
  93. package/dist/modules/like/like.module.js +14 -37
  94. package/dist/modules/like/like.service.d.ts +31 -27
  95. package/dist/modules/like/like.service.js +42 -35
  96. package/dist/modules/merge/index.d.ts +3 -0
  97. package/dist/modules/merge/index.js +19 -0
  98. package/dist/modules/merge/merge-module-options.interface.d.ts +21 -0
  99. package/dist/modules/merge/merge.controller.d.ts +30 -0
  100. package/dist/modules/merge/merge.controller.js +76 -0
  101. package/dist/modules/merge/merge.module.d.ts +18 -0
  102. package/dist/modules/merge/merge.module.js +41 -0
  103. package/dist/modules/merge/merge.service.interface.d.ts +17 -0
  104. package/dist/modules/services/base-http.service.d.ts +83 -0
  105. package/dist/modules/services/base-http.service.js +124 -0
  106. package/dist/modules/services/base-urls.d.ts +22 -0
  107. package/dist/modules/services/base-urls.js +121 -0
  108. package/dist/modules/services/index.d.ts +4 -0
  109. package/dist/modules/services/index.js +20 -0
  110. package/dist/modules/services/providers/accounts.service.d.ts +52 -0
  111. package/dist/modules/services/providers/accounts.service.js +84 -0
  112. package/dist/modules/services/providers/books.service.d.ts +29 -0
  113. package/dist/modules/services/providers/books.service.js +55 -0
  114. package/dist/modules/services/providers/changelog.service.d.ts +18 -0
  115. package/dist/modules/services/providers/changelog.service.js +43 -0
  116. package/dist/modules/services/providers/comments/comments.service-definition.d.ts +1 -0
  117. package/dist/modules/services/providers/comments/comments.service-definition.js +4 -0
  118. package/dist/modules/services/providers/comments/comments.service.d.ts +60 -0
  119. package/dist/modules/services/providers/comments/comments.service.js +139 -0
  120. package/dist/modules/services/providers/comments/index.d.ts +1 -0
  121. package/dist/{factories → modules/services/providers/comments}/index.js +1 -1
  122. package/dist/modules/services/providers/content/content-return-types.d.ts +19 -0
  123. package/dist/modules/services/providers/content/content-return-types.js +7 -0
  124. package/dist/modules/services/providers/content/content.service-definition.d.ts +1 -0
  125. package/dist/modules/services/providers/content/content.service-definition.js +4 -0
  126. package/dist/modules/services/providers/content/content.service.d.ts +96 -0
  127. package/dist/modules/services/providers/content/content.service.js +231 -0
  128. package/dist/modules/services/providers/content/index.d.ts +2 -0
  129. package/dist/modules/{search/models → services/providers/content}/index.js +1 -1
  130. package/dist/modules/services/providers/demo-hive.service.d.ts +29 -0
  131. package/dist/modules/services/providers/demo-hive.service.js +55 -0
  132. package/dist/modules/services/providers/events.service.d.ts +29 -0
  133. package/dist/modules/services/providers/events.service.js +55 -0
  134. package/dist/modules/services/providers/hackschool.service.d.ts +49 -0
  135. package/dist/modules/services/providers/hackschool.service.js +79 -0
  136. package/dist/modules/services/providers/ideas.service.d.ts +18 -0
  137. package/dist/modules/services/providers/ideas.service.js +43 -0
  138. package/dist/modules/services/providers/index.d.ts +19 -0
  139. package/dist/modules/services/providers/index.js +35 -0
  140. package/dist/modules/services/providers/lunch-roulette.service.d.ts +18 -0
  141. package/dist/modules/services/providers/lunch-roulette.service.js +43 -0
  142. package/dist/modules/services/providers/mail/index.d.ts +3 -0
  143. package/dist/modules/services/providers/mail/index.js +19 -0
  144. package/dist/modules/services/providers/mail/mail-types.d.ts +30 -0
  145. package/dist/modules/services/providers/mail/mail-types.js +22 -0
  146. package/dist/modules/services/providers/mail/mail.service.d.ts +99 -0
  147. package/dist/modules/{mail → services/providers/mail}/mail.service.js +55 -92
  148. package/dist/modules/services/providers/newletter.service.d.ts +29 -0
  149. package/dist/modules/services/providers/newletter.service.js +55 -0
  150. package/dist/modules/services/providers/newsroom.service.d.ts +47 -0
  151. package/dist/modules/services/providers/newsroom.service.js +73 -0
  152. package/dist/modules/services/providers/notification/dtos/schedule-notification.dto.js +2 -0
  153. package/dist/modules/services/providers/notification/index.d.ts +2 -0
  154. package/dist/modules/services/providers/notification/index.js +18 -0
  155. package/dist/modules/services/providers/notification/notification.service-definition.d.ts +1 -0
  156. package/dist/modules/services/providers/notification/notification.service-definition.js +4 -0
  157. package/dist/modules/services/providers/notification/notification.service.d.ts +50 -0
  158. package/dist/modules/services/providers/notification/notification.service.js +130 -0
  159. package/dist/modules/services/providers/pass/dtos/create-guild-member-pass.dto.js +2 -0
  160. package/dist/modules/services/providers/pass/dtos/create-team-member-pass.dto.js +2 -0
  161. package/dist/modules/services/providers/pass/index.d.ts +2 -0
  162. package/dist/modules/services/providers/pass/index.js +18 -0
  163. package/dist/modules/services/providers/pass/pass-types.d.ts +18 -0
  164. package/dist/modules/services/providers/pass/pass-types.js +7 -0
  165. package/dist/modules/{pass → services/providers/pass}/pass.service.d.ts +15 -39
  166. package/dist/modules/{pass → services/providers/pass}/pass.service.js +46 -61
  167. package/dist/modules/services/providers/podcasts.service.d.ts +29 -0
  168. package/dist/modules/services/providers/podcasts.service.js +55 -0
  169. package/dist/modules/services/providers/search/dtos/index-search-document.dto.js +2 -0
  170. package/dist/modules/services/providers/search/index.d.ts +2 -0
  171. package/dist/modules/services/providers/search/index.js +18 -0
  172. package/dist/modules/services/providers/search/search.service-definition.d.ts +1 -0
  173. package/dist/modules/services/providers/search/search.service-definition.js +4 -0
  174. package/dist/modules/services/providers/search/search.service.d.ts +66 -0
  175. package/dist/modules/services/providers/search/search.service.js +171 -0
  176. package/dist/modules/services/providers/team.service.d.ts +29 -0
  177. package/dist/modules/services/providers/team.service.js +55 -0
  178. package/dist/modules/services/providers/tech-radar.service.d.ts +39 -0
  179. package/dist/modules/services/providers/tech-radar.service.js +67 -0
  180. package/dist/modules/services/services-module-options.interface.d.ts +4 -0
  181. package/dist/modules/services/services-module-options.interface.js +2 -0
  182. package/dist/modules/services/services-options.parameter.d.ts +1 -0
  183. package/dist/modules/services/services-options.parameter.js +8 -0
  184. package/dist/modules/services/services.module-definition.d.ts +16 -0
  185. package/dist/modules/services/services.module-definition.js +21 -0
  186. package/dist/modules/services/services.module.d.ts +17 -0
  187. package/dist/modules/services/services.module.js +63 -0
  188. package/dist/pipes/index.d.ts +2 -3
  189. package/dist/pipes/index.js +2 -3
  190. package/dist/pipes/params/hub-id.pipe.d.ts +22 -0
  191. package/dist/pipes/{hub-id.pipe.js → params/hub-id.pipe.js} +14 -17
  192. package/dist/pipes/params/hub-resource.pipe.d.ts +22 -0
  193. package/dist/pipes/{hub-resource.pipe.js → params/hub-resource.pipe.js} +19 -20
  194. package/dist/pipes/params/index.d.ts +3 -0
  195. package/dist/pipes/params/index.js +19 -0
  196. package/dist/pipes/params/mongo-id.pipe.d.ts +15 -0
  197. package/dist/pipes/params/mongo-id.pipe.js +52 -0
  198. package/dist/pipes/queries/index.d.ts +3 -0
  199. package/dist/pipes/queries/index.js +19 -0
  200. package/dist/pipes/queries/mongo-ids.pipe.d.ts +22 -0
  201. package/dist/pipes/queries/mongo-ids.pipe.js +60 -0
  202. package/dist/pipes/queries/optional-boolean.pipe.d.ts +29 -0
  203. package/dist/pipes/queries/optional-boolean.pipe.js +72 -0
  204. package/dist/pipes/queries/optional-include-drafts.pipe.d.ts +28 -0
  205. package/dist/pipes/queries/optional-include-drafts.pipe.js +38 -0
  206. package/dist/properties/content-return-type.property.d.ts +7 -0
  207. package/dist/properties/content-return-type.property.js +22 -0
  208. package/dist/properties/index.d.ts +4 -0
  209. package/dist/properties/index.js +11 -0
  210. package/dist/properties/likeable.properties.d.ts +1 -0
  211. package/dist/properties/likeable.properties.js +66 -0
  212. package/dist/properties/viewable.properties.d.ts +1 -0
  213. package/dist/properties/viewable.properties.js +66 -0
  214. package/dist/swagger/index.d.ts +1 -0
  215. package/dist/swagger/index.js +5 -0
  216. package/dist/swagger/remove-public-route-auth.plugin.d.ts +9 -0
  217. package/dist/swagger/remove-public-route-auth.plugin.js +25 -0
  218. package/dist/swagger/swagger-options.interface.d.ts +14 -0
  219. package/dist/swagger/swagger-options.interface.js +2 -0
  220. package/dist/swagger/swagger.function.d.ts +11 -0
  221. package/dist/swagger/swagger.function.js +47 -0
  222. package/dist/transform/boolean.transform.js +3 -3
  223. package/dist/types/index.d.ts +2 -0
  224. package/dist/types/index.js +18 -0
  225. package/dist/types/likeable.type.d.ts +15 -0
  226. package/dist/types/likeable.type.js +2 -0
  227. package/dist/types/viewable.type.d.ts +15 -0
  228. package/dist/types/viewable.type.js +2 -0
  229. package/package.json +2 -2
  230. package/dist/classes/document-updater.class.d.ts +0 -39
  231. package/dist/classes/document-updater.class.js +0 -57
  232. package/dist/factories/index.d.ts +0 -1
  233. package/dist/factories/virtuals.factory.d.ts +0 -79
  234. package/dist/factories/virtuals.factory.js +0 -171
  235. package/dist/http-logger.middleware.d.ts +0 -12
  236. package/dist/http-logger.middleware.js +0 -43
  237. package/dist/likeable.interface.d.ts +0 -41
  238. package/dist/likeable.interface.js +0 -48
  239. package/dist/modules/authentication/guards/auth.guard.d.ts +0 -36
  240. package/dist/modules/authentication/guards/auth.guard.js +0 -107
  241. package/dist/modules/authentication/guards/internal.guard.d.ts +0 -33
  242. package/dist/modules/authentication/guards/internal.guard.js +0 -72
  243. package/dist/modules/authentication/inject-auth-options.decorator.d.ts +0 -1
  244. package/dist/modules/comment/comment.model.d.ts +0 -29
  245. package/dist/modules/comment/comment.model.js +0 -43
  246. package/dist/modules/content/content.module-definition.d.ts +0 -5
  247. package/dist/modules/content/content.module-definition.js +0 -8
  248. package/dist/modules/content/content.module.d.ts +0 -31
  249. package/dist/modules/content/content.module.js +0 -60
  250. package/dist/modules/content/content.service.d.ts +0 -50
  251. package/dist/modules/content/content.service.js +0 -145
  252. package/dist/modules/content/index.d.ts +0 -3
  253. package/dist/modules/content/index.js +0 -9
  254. package/dist/modules/database/model-service/dbs/hub-account.db.d.ts +0 -28
  255. package/dist/modules/database/model-service/dbs/hub-account.db.js +0 -44
  256. package/dist/modules/database/model-service/dbs/hub-books.db.d.ts +0 -23
  257. package/dist/modules/database/model-service/dbs/hub-books.db.js +0 -45
  258. package/dist/modules/database/model-service/dbs/hub-comments.db.d.ts +0 -29
  259. package/dist/modules/database/model-service/dbs/hub-comments.db.js +0 -68
  260. package/dist/modules/database/model-service/dbs/hub-content.db.d.ts +0 -24
  261. package/dist/modules/database/model-service/dbs/hub-content.db.js +0 -49
  262. package/dist/modules/database/model-service/dbs/hub-demo-hive.db.d.ts +0 -23
  263. package/dist/modules/database/model-service/dbs/hub-demo-hive.db.js +0 -45
  264. package/dist/modules/database/model-service/dbs/hub-events.db.d.ts +0 -24
  265. package/dist/modules/database/model-service/dbs/hub-events.db.js +0 -49
  266. package/dist/modules/database/model-service/dbs/hub-hackschool.db.d.ts +0 -60
  267. package/dist/modules/database/model-service/dbs/hub-hackschool.db.js +0 -106
  268. package/dist/modules/database/model-service/dbs/hub-newsroom.db.d.ts +0 -25
  269. package/dist/modules/database/model-service/dbs/hub-newsroom.db.js +0 -53
  270. package/dist/modules/database/model-service/dbs/hub-podcasts.db.d.ts +0 -23
  271. package/dist/modules/database/model-service/dbs/hub-podcasts.db.js +0 -45
  272. package/dist/modules/database/model-service/dbs/hub-team.db.d.ts +0 -22
  273. package/dist/modules/database/model-service/dbs/hub-team.db.js +0 -41
  274. package/dist/modules/database/model-service/dbs/hub-tech-radar.db.d.ts +0 -42
  275. package/dist/modules/database/model-service/dbs/hub-tech-radar.db.js +0 -81
  276. package/dist/modules/database/model-service/model.service.d.ts +0 -6407
  277. package/dist/modules/database/model-service/model.service.js +0 -136
  278. package/dist/modules/database/populate-service/populate.service.d.ts +0 -73
  279. package/dist/modules/database/populate-service/populate.service.js +0 -163
  280. package/dist/modules/database/service-mapper-service/service-mapper.service.d.ts +0 -32
  281. package/dist/modules/database/service-mapper-service/service-mapper.service.js +0 -73
  282. package/dist/modules/fetch/fetch.module.d.ts +0 -31
  283. package/dist/modules/fetch/fetch.module.js +0 -60
  284. package/dist/modules/fetch/fetch.service.d.ts +0 -153
  285. package/dist/modules/fetch/fetch.service.js +0 -274
  286. package/dist/modules/fetch/index.d.ts +0 -2
  287. package/dist/modules/fetch/index.js +0 -7
  288. package/dist/modules/mail/index.d.ts +0 -4
  289. package/dist/modules/mail/index.js +0 -23
  290. package/dist/modules/mail/mail.module.d.ts +0 -31
  291. package/dist/modules/mail/mail.module.js +0 -60
  292. package/dist/modules/mail/mail.service.d.ts +0 -136
  293. package/dist/modules/notification/index.d.ts +0 -3
  294. package/dist/modules/notification/index.js +0 -22
  295. package/dist/modules/notification/notification.module-definition.d.ts +0 -5
  296. package/dist/modules/notification/notification.module-definition.js +0 -8
  297. package/dist/modules/notification/notification.module.d.ts +0 -34
  298. package/dist/modules/notification/notification.module.js +0 -63
  299. package/dist/modules/notification/notification.service.d.ts +0 -42
  300. package/dist/modules/notification/notification.service.js +0 -100
  301. package/dist/modules/pass/index.d.ts +0 -3
  302. package/dist/modules/pass/index.js +0 -22
  303. package/dist/modules/pass/pass.module.d.ts +0 -32
  304. package/dist/modules/pass/pass.module.js +0 -61
  305. package/dist/modules/search/index.d.ts +0 -4
  306. package/dist/modules/search/index.js +0 -23
  307. package/dist/modules/search/models/index.d.ts +0 -1
  308. package/dist/modules/search/search.module-definition.d.ts +0 -5
  309. package/dist/modules/search/search.module-definition.js +0 -8
  310. package/dist/modules/search/search.module.d.ts +0 -33
  311. package/dist/modules/search/search.module.js +0 -62
  312. package/dist/modules/search/search.service.d.ts +0 -49
  313. package/dist/modules/search/search.service.js +0 -120
  314. package/dist/pipes/hub-id.pipe.d.ts +0 -22
  315. package/dist/pipes/hub-resource.pipe.d.ts +0 -22
  316. package/dist/pipes/mongo-id.pipe.d.ts +0 -14
  317. package/dist/pipes/mongo-id.pipe.js +0 -52
  318. package/dist/swagger.config.d.ts +0 -36
  319. package/dist/swagger.config.js +0 -76
  320. package/dist/viewable.interface.d.ts +0 -41
  321. package/dist/viewable.interface.js +0 -48
  322. /package/dist/modules/{mail/dtos/auth-login-token-mail.dto.js → comment/comment-module-options.interface.js} +0 -0
  323. /package/dist/modules/{mail/dtos/auth-password-reset-mail.dto.js → like/like-module-options.interface.js} +0 -0
  324. /package/dist/modules/{mail/dtos/event-cancel-mail.dto.js → merge/merge-module-options.interface.js} +0 -0
  325. /package/dist/modules/{mail/dtos/event-invite-mail.dto.js → merge/merge.service.interface.js} +0 -0
  326. /package/dist/modules/{mail → services/providers/mail}/dtos/auth-login-token-mail.dto.d.ts +0 -0
  327. /package/dist/modules/{mail/dtos/idea-status-updated-mail.dto.js → services/providers/mail/dtos/auth-login-token-mail.dto.js} +0 -0
  328. /package/dist/modules/{mail → services/providers/mail}/dtos/auth-password-reset-mail.dto.d.ts +0 -0
  329. /package/dist/modules/{mail/dtos/idea-submitted-mail.dto.js → services/providers/mail/dtos/auth-password-reset-mail.dto.js} +0 -0
  330. /package/dist/modules/{mail → services/providers/mail}/dtos/event-cancel-mail.dto.d.ts +0 -0
  331. /package/dist/modules/{mail/dtos/lunch-roulette-cancel-mail.dto.js → services/providers/mail/dtos/event-cancel-mail.dto.js} +0 -0
  332. /package/dist/modules/{mail → services/providers/mail}/dtos/event-invite-mail.dto.d.ts +0 -0
  333. /package/dist/modules/{mail/dtos/lunch-roulette-matched-mail.dto.js → services/providers/mail/dtos/event-invite-mail.dto.js} +0 -0
  334. /package/dist/modules/{mail → services/providers/mail}/dtos/idea-status-updated-mail.dto.d.ts +0 -0
  335. /package/dist/modules/{mail/dtos/lunch-roulette-submitted-mail.dto.js → services/providers/mail/dtos/idea-status-updated-mail.dto.js} +0 -0
  336. /package/dist/modules/{mail → services/providers/mail}/dtos/idea-submitted-mail.dto.d.ts +0 -0
  337. /package/dist/modules/{mail/dtos/lunch-roulette-unmatched-mail.dto.js → services/providers/mail/dtos/idea-submitted-mail.dto.js} +0 -0
  338. /package/dist/modules/{mail → services/providers/mail}/dtos/index.d.ts +0 -0
  339. /package/dist/modules/{mail → services/providers/mail}/dtos/index.js +0 -0
  340. /package/dist/modules/{mail → services/providers/mail}/dtos/lunch-roulette-cancel-mail.dto.d.ts +0 -0
  341. /package/dist/modules/{mail/dtos/newsletter-issue-mail.dto.js → services/providers/mail/dtos/lunch-roulette-cancel-mail.dto.js} +0 -0
  342. /package/dist/modules/{mail → services/providers/mail}/dtos/lunch-roulette-matched-mail.dto.d.ts +0 -0
  343. /package/dist/modules/{mail/dtos/newsletter-subscribed-mail.dto.js → services/providers/mail/dtos/lunch-roulette-matched-mail.dto.js} +0 -0
  344. /package/dist/modules/{mail → services/providers/mail}/dtos/lunch-roulette-submitted-mail.dto.d.ts +0 -0
  345. /package/dist/modules/{mail/dtos/newsletter-unsubscribed-mail.dto.js → services/providers/mail/dtos/lunch-roulette-submitted-mail.dto.js} +0 -0
  346. /package/dist/modules/{mail → services/providers/mail}/dtos/lunch-roulette-unmatched-mail.dto.d.ts +0 -0
  347. /package/dist/modules/{mail/dtos/notification-mail.dto.js → services/providers/mail/dtos/lunch-roulette-unmatched-mail.dto.js} +0 -0
  348. /package/dist/modules/{mail → services/providers/mail}/dtos/newsletter-issue-mail.dto.d.ts +0 -0
  349. /package/dist/modules/{notification/dtos/schedule-notification.dto.js → services/providers/mail/dtos/newsletter-issue-mail.dto.js} +0 -0
  350. /package/dist/modules/{mail → services/providers/mail}/dtos/newsletter-subscribed-mail.dto.d.ts +0 -0
  351. /package/dist/modules/{pass/dtos/create-guild-member-pass.dto.js → services/providers/mail/dtos/newsletter-subscribed-mail.dto.js} +0 -0
  352. /package/dist/modules/{mail → services/providers/mail}/dtos/newsletter-unsubscribed-mail.dto.d.ts +0 -0
  353. /package/dist/modules/{pass/dtos/create-team-member-pass.dto.js → services/providers/mail/dtos/newsletter-unsubscribed-mail.dto.js} +0 -0
  354. /package/dist/modules/{mail → services/providers/mail}/dtos/notification-mail.dto.d.ts +0 -0
  355. /package/dist/modules/{search/dtos/index-search-document.dto.js → services/providers/mail/dtos/notification-mail.dto.js} +0 -0
  356. /package/dist/modules/{mail → services/providers/mail}/models/index.d.ts +0 -0
  357. /package/dist/modules/{mail → services/providers/mail}/models/index.js +0 -0
  358. /package/dist/modules/{mail → services/providers/mail}/models/mail-recipient.model.d.ts +0 -0
  359. /package/dist/modules/{mail → services/providers/mail}/models/mail-recipient.model.js +0 -0
  360. /package/dist/modules/{notification → services/providers/notification}/dtos/index.d.ts +0 -0
  361. /package/dist/modules/{notification → services/providers/notification}/dtos/index.js +0 -0
  362. /package/dist/modules/{notification → services/providers/notification}/dtos/schedule-notification.dto.d.ts +0 -0
  363. /package/dist/modules/{pass → services/providers/pass}/dtos/create-guild-member-pass.dto.d.ts +0 -0
  364. /package/dist/modules/{pass → services/providers/pass}/dtos/create-team-member-pass.dto.d.ts +0 -0
  365. /package/dist/modules/{pass → services/providers/pass}/dtos/index.d.ts +0 -0
  366. /package/dist/modules/{pass → services/providers/pass}/dtos/index.js +0 -0
  367. /package/dist/modules/{search → services/providers/search}/dtos/index-search-document.dto.d.ts +0 -0
  368. /package/dist/modules/{search → services/providers/search}/dtos/index.d.ts +0 -0
  369. /package/dist/modules/{search → services/providers/search}/dtos/index.js +0 -0
  370. /package/dist/{modules/content → properties}/content.property.d.ts +0 -0
  371. /package/dist/{modules/content → properties}/content.property.js +0 -0
@@ -9,50 +9,36 @@ var __metadata = (this && this.__metadata) || function (k, v) {
9
9
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.AccountEntity = void 0;
12
+ exports.User = void 0;
13
13
  const swagger_1 = require("@nestjs/swagger");
14
- /**
15
- * Represents the identity and authorization details of a user account.
16
- *
17
- * This class is used in API responses to expose user metadata, including core profile
18
- * information (email, username, avatar) and permission scopes granted to the user.
19
- */
20
- class AccountEntity {
14
+ class User {
21
15
  }
22
- exports.AccountEntity = AccountEntity;
16
+ exports.User = User;
23
17
  __decorate([
24
18
  (0, swagger_1.ApiProperty)({
25
19
  description: 'Unique identifier for the account (MongoDB ObjectId)',
26
20
  example: '000000000000000000000000',
27
21
  }),
28
22
  __metadata("design:type", String)
29
- ], AccountEntity.prototype, "id", void 0);
23
+ ], User.prototype, "id", void 0);
30
24
  __decorate([
31
25
  (0, swagger_1.ApiProperty)({
32
- description: 'Email address registered to the account',
33
- example: 'timo@example.com',
26
+ description: 'Display name of the account user',
27
+ example: 'Timo Scheuermann',
34
28
  }),
35
29
  __metadata("design:type", String)
36
- ], AccountEntity.prototype, "email", void 0);
30
+ ], User.prototype, "username", void 0);
37
31
  __decorate([
38
32
  (0, swagger_1.ApiProperty)({
39
- description: 'Display name of the account user',
40
- example: 'Timo Scheuermann',
33
+ description: 'Email address registered to the account',
34
+ example: 'timo@example.com',
41
35
  }),
42
36
  __metadata("design:type", String)
43
- ], AccountEntity.prototype, "username", void 0);
37
+ ], User.prototype, "email", void 0);
44
38
  __decorate([
45
39
  (0, swagger_1.ApiPropertyOptional)({
46
40
  description: "URL of the user's avatar image",
47
41
  example: 'https://file.svi-itlab.com/avatar/000000000000000000000000.webp',
48
42
  }),
49
43
  __metadata("design:type", String)
50
- ], AccountEntity.prototype, "avatar", void 0);
51
- __decorate([
52
- (0, swagger_1.ApiProperty)({
53
- description: 'Permission strings assigned to the user account',
54
- example: ['news.publish', 'dashboard.view'],
55
- type: [String],
56
- }),
57
- __metadata("design:type", Array)
58
- ], AccountEntity.prototype, "perms", void 0);
44
+ ], User.prototype, "avatar", void 0);
@@ -4,15 +4,9 @@
4
4
  * JWT verification and internal Kubernetes token validation.
5
5
  */
6
6
  export type AuthenticationModuleOptions = {
7
- /**
8
- * Secret key used to sign and verify JSON Web Tokens (JWT).
9
- * This should be a strong, securely stored string.
10
- */
7
+ /** Secret key for signing and verifying JWTs */
11
8
  jwtSecret: string;
12
- /**
13
- * Token used for internal authentication, typically
14
- * shared between services within a Kubernetes cluster.
15
- */
9
+ /** Shared service token for internal service requests */
16
10
  k8sToken: string;
17
11
  };
18
12
  /**
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Parameter decorator to inject AuthenticationModule options into services or guards.
3
+ */
4
+ export declare function InjectAuthenticationOptions(): ParameterDecorator;
@@ -1,8 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.InjectAuthOptions = InjectAuthOptions;
3
+ exports.InjectAuthenticationOptions = InjectAuthenticationOptions;
4
4
  const common_1 = require("@nestjs/common");
5
5
  const authentication_module_definition_1 = require("./authentication.module-definition");
6
- function InjectAuthOptions() {
6
+ /**
7
+ * Parameter decorator to inject AuthenticationModule options into services or guards.
8
+ */
9
+ function InjectAuthenticationOptions() {
7
10
  return (0, common_1.Inject)(authentication_module_definition_1.AUTHENTICATION_MODULE_OPTIONS_TOKEN);
8
11
  }
@@ -1,7 +1,30 @@
1
1
  import { DynamicModule } from '@nestjs/common';
2
2
  import { AuthenticationModuleAsyncOptions, AuthenticationModuleOptions } from './authentication-module-options.interface';
3
3
  import { AuthenticationModuleClass } from './authentication.module-definition';
4
+ /**
5
+ * AuthenticationModule
6
+ *
7
+ * Globally available NestJS module providing:
8
+ * - JWT authentication
9
+ * - Internal service authentication
10
+ * - Permissions-based access control
11
+ *
12
+ * Supports both synchronous (`forRoot`) and asynchronous (`forRootAsync`) configuration.
13
+ */
4
14
  export declare class AuthenticationModule extends AuthenticationModuleClass {
15
+ /**
16
+ * Configure the module asynchronously.
17
+ * Useful when options must be loaded from environment or external services.
18
+ *
19
+ * @param asyncOptions - Factory function and providers for async configuration.
20
+ * @returns {DynamicModule} Fully configured module definition with async options exported.
21
+ */
5
22
  static forRoot(options: AuthenticationModuleOptions): DynamicModule;
23
+ /**
24
+ * Asynchronously configure the authentication module.
25
+ * Useful for dynamic config values loaded from environment or external services.
26
+ *
27
+ * @param asyncOptions - Factory function and injected providers for async configuration
28
+ */
6
29
  static forRootAsync(asyncOptions: AuthenticationModuleAsyncOptions): DynamicModule;
7
30
  }
@@ -11,7 +11,24 @@ const common_1 = require("@nestjs/common");
11
11
  const jwt_1 = require("@nestjs/jwt");
12
12
  const authentication_module_definition_1 = require("./authentication.module-definition");
13
13
  const guards_1 = require("./guards");
14
+ /**
15
+ * AuthenticationModule
16
+ *
17
+ * Globally available NestJS module providing:
18
+ * - JWT authentication
19
+ * - Internal service authentication
20
+ * - Permissions-based access control
21
+ *
22
+ * Supports both synchronous (`forRoot`) and asynchronous (`forRootAsync`) configuration.
23
+ */
14
24
  let AuthenticationModule = class AuthenticationModule extends authentication_module_definition_1.AuthenticationModuleClass {
25
+ /**
26
+ * Configure the module asynchronously.
27
+ * Useful when options must be loaded from environment or external services.
28
+ *
29
+ * @param asyncOptions - Factory function and providers for async configuration.
30
+ * @returns {DynamicModule} Fully configured module definition with async options exported.
31
+ */
15
32
  static forRoot(options) {
16
33
  const moduleDefinition = super.forRoot(options);
17
34
  return Object.assign(Object.assign({}, moduleDefinition), { exports: [
@@ -22,6 +39,12 @@ let AuthenticationModule = class AuthenticationModule extends authentication_mod
22
39
  },
23
40
  ] });
24
41
  }
42
+ /**
43
+ * Asynchronously configure the authentication module.
44
+ * Useful for dynamic config values loaded from environment or external services.
45
+ *
46
+ * @param asyncOptions - Factory function and injected providers for async configuration
47
+ */
25
48
  static forRootAsync(asyncOptions) {
26
49
  const moduleDefinition = super.forRootAsync(asyncOptions);
27
50
  return Object.assign(Object.assign({}, moduleDefinition), { exports: [
@@ -38,6 +61,6 @@ exports.AuthenticationModule = AuthenticationModule;
38
61
  exports.AuthenticationModule = AuthenticationModule = __decorate([
39
62
  (0, common_1.Module)({
40
63
  imports: [jwt_1.JwtModule.register({ global: true })],
41
- providers: [guards_1.AuthGuard, guards_1.InternalGuard, guards_1.PermissionsGuard],
64
+ providers: [guards_1.JwtAuthGuard, guards_1.ServiceAuthGuard, guards_1.PermissionsGuard],
42
65
  })
43
66
  ], AuthenticationModule);
@@ -1,4 +1,4 @@
1
- export { AuthGuard, RequireJwtAuth } from './auth.guard';
2
- export { InternalGuard, InternalOnly } from './internal.guard';
1
+ export { JwtAuthGuard, RequireJwtAuth } from './jwt-auth.guard';
3
2
  export { PermissionsGuard, RequirePermissions } from './permissions.guard';
4
3
  export { Public } from './public.guard';
4
+ export { RequireServiceAuth, ServiceAuthGuard } from './service-auth.guard';
@@ -1,14 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Public = exports.RequirePermissions = exports.PermissionsGuard = exports.InternalOnly = exports.InternalGuard = exports.RequireJwtAuth = exports.AuthGuard = void 0;
4
- var auth_guard_1 = require("./auth.guard");
5
- Object.defineProperty(exports, "AuthGuard", { enumerable: true, get: function () { return auth_guard_1.AuthGuard; } });
6
- Object.defineProperty(exports, "RequireJwtAuth", { enumerable: true, get: function () { return auth_guard_1.RequireJwtAuth; } });
7
- var internal_guard_1 = require("./internal.guard");
8
- Object.defineProperty(exports, "InternalGuard", { enumerable: true, get: function () { return internal_guard_1.InternalGuard; } });
9
- Object.defineProperty(exports, "InternalOnly", { enumerable: true, get: function () { return internal_guard_1.InternalOnly; } });
3
+ exports.ServiceAuthGuard = exports.RequireServiceAuth = exports.Public = exports.RequirePermissions = exports.PermissionsGuard = exports.RequireJwtAuth = exports.JwtAuthGuard = void 0;
4
+ var jwt_auth_guard_1 = require("./jwt-auth.guard");
5
+ Object.defineProperty(exports, "JwtAuthGuard", { enumerable: true, get: function () { return jwt_auth_guard_1.JwtAuthGuard; } });
6
+ Object.defineProperty(exports, "RequireJwtAuth", { enumerable: true, get: function () { return jwt_auth_guard_1.RequireJwtAuth; } });
10
7
  var permissions_guard_1 = require("./permissions.guard");
11
8
  Object.defineProperty(exports, "PermissionsGuard", { enumerable: true, get: function () { return permissions_guard_1.PermissionsGuard; } });
12
9
  Object.defineProperty(exports, "RequirePermissions", { enumerable: true, get: function () { return permissions_guard_1.RequirePermissions; } });
13
10
  var public_guard_1 = require("./public.guard");
14
11
  Object.defineProperty(exports, "Public", { enumerable: true, get: function () { return public_guard_1.Public; } });
12
+ var service_auth_guard_1 = require("./service-auth.guard");
13
+ Object.defineProperty(exports, "RequireServiceAuth", { enumerable: true, get: function () { return service_auth_guard_1.RequireServiceAuth; } });
14
+ Object.defineProperty(exports, "ServiceAuthGuard", { enumerable: true, get: function () { return service_auth_guard_1.ServiceAuthGuard; } });
@@ -0,0 +1,17 @@
1
+ import { CanActivate, ExecutionContext } from '@nestjs/common';
2
+ import { Reflector } from '@nestjs/core';
3
+ import { JwtService } from '@nestjs/jwt';
4
+ import { AuthenticationModuleOptions } from '../authentication-module-options.interface';
5
+ /**
6
+ * Guard implementing JWT authentication for routes.
7
+ * Skips authentication for public routes and service requests.
8
+ */
9
+ export declare class JwtAuthGuard implements CanActivate {
10
+ private readonly authenticationOptions;
11
+ private readonly reflector;
12
+ private readonly jwtService;
13
+ constructor(authenticationOptions: AuthenticationModuleOptions, reflector: Reflector, jwtService: JwtService);
14
+ canActivate(context: ExecutionContext): boolean;
15
+ }
16
+ /** Decorator enforcing JWT authentication on routes/controllers */
17
+ export declare function RequireJwtAuth(): MethodDecorator & ClassDecorator;
@@ -0,0 +1,67 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.JwtAuthGuard = void 0;
16
+ exports.RequireJwtAuth = RequireJwtAuth;
17
+ const common_1 = require("@nestjs/common");
18
+ const core_1 = require("@nestjs/core");
19
+ const jwt_1 = require("@nestjs/jwt");
20
+ const swagger_1 = require("@nestjs/swagger");
21
+ const authentication_options_parameter_1 = require("../authentication-options.parameter");
22
+ const public_guard_1 = require("./public.guard");
23
+ /**
24
+ * Guard implementing JWT authentication for routes.
25
+ * Skips authentication for public routes and service requests.
26
+ */
27
+ let JwtAuthGuard = class JwtAuthGuard {
28
+ constructor(authenticationOptions, reflector, jwtService) {
29
+ this.authenticationOptions = authenticationOptions;
30
+ this.reflector = reflector;
31
+ this.jwtService = jwtService;
32
+ }
33
+ canActivate(context) {
34
+ if ((0, public_guard_1.isPublicRoute)(context, this.reflector))
35
+ return true;
36
+ const request = context.switchToHttp().getRequest();
37
+ const token = extractBearerToken(request);
38
+ if (!token)
39
+ throw new common_1.UnauthorizedException('Authorization token not found.');
40
+ try {
41
+ request.account = this.jwtService.verify(token, { secret: this.authenticationOptions.jwtSecret });
42
+ }
43
+ catch (_a) {
44
+ throw new common_1.UnauthorizedException('Invalid or expired token.');
45
+ }
46
+ return true;
47
+ }
48
+ };
49
+ exports.JwtAuthGuard = JwtAuthGuard;
50
+ exports.JwtAuthGuard = JwtAuthGuard = __decorate([
51
+ (0, common_1.Injectable)(),
52
+ __param(0, (0, authentication_options_parameter_1.InjectAuthenticationOptions)()),
53
+ __metadata("design:paramtypes", [Object, core_1.Reflector,
54
+ jwt_1.JwtService])
55
+ ], JwtAuthGuard);
56
+ /** Extracts Bearer token from Authorization header */
57
+ function extractBearerToken(request) {
58
+ const header = request.headers.authorization;
59
+ if (!header)
60
+ return undefined;
61
+ const [scheme, token] = header.split(' ');
62
+ return scheme === 'Bearer' && (token === null || token === void 0 ? void 0 : token.trim()) ? token : undefined;
63
+ }
64
+ /** Decorator enforcing JWT authentication on routes/controllers */
65
+ function RequireJwtAuth() {
66
+ return (0, common_1.applyDecorators)((0, common_1.UseGuards)(JwtAuthGuard), (0, swagger_1.ApiBearerAuth)('Auth Token'), (0, swagger_1.ApiUnauthorizedResponse)({ description: 'Unauthorized: Invalid or missing JWT' }));
67
+ }
@@ -1,36 +1,14 @@
1
1
  import { CanActivate, ExecutionContext } from '@nestjs/common';
2
2
  import { Reflector } from '@nestjs/core';
3
+ import { AuthenticationModuleOptions } from '../authentication-module-options.interface';
3
4
  /**
4
- * Guard responsible for enforcing permissions-based access control.
5
- * It checks whether the authenticated user possesses all required permissions
6
- * defined via metadata on route handlers.
5
+ * Guard enforcing that authenticated users have the necessary permissions.
7
6
  */
8
7
  export declare class PermissionsGuard implements CanActivate {
8
+ private readonly authenticationOptions;
9
9
  private readonly reflector;
10
- constructor(reflector: Reflector);
11
- /**
12
- * Determines if the current user has sufficient permissions to access the resource.
13
- *
14
- * - Retrieves required permissions metadata for the current handler.
15
- * - Allows access immediately if no permissions are specified (no restriction).
16
- * - Validates presence of user permissions and checks if they satisfy requirements.
17
- * - Throws ForbiddenException with detailed message if authorization fails.
18
- *
19
- * @param {ExecutionContext} context - The execution context of the current request.
20
- * @returns {boolean} True if user has required permissions; otherwise throws.
21
- * @throws {ForbiddenException} When user lacks required permissions.
22
- */
10
+ constructor(authenticationOptions: AuthenticationModuleOptions, reflector: Reflector);
23
11
  canActivate(context: ExecutionContext): boolean;
24
12
  }
25
- /**
26
- * RequirePermissions
27
- *
28
- * Decorator factory that:
29
- * - Attaches required permissions metadata to the route handler.
30
- * - Applies the AuthGuard and PermissionsGuard to secure the route.
31
- * - Adds Swagger documentation for bearer authentication and forbidden responses.
32
- *
33
- * @param {...string[]} permissions - List of permissions required to access the route.
34
- * @returns {MethodDecorator & ClassDecorator} A composite decorator securing the route.
35
- */
13
+ /** Decorator enforcing permissions on routes/controllers */
36
14
  export declare function RequirePermissions(...permissions: string[]): MethodDecorator & ClassDecorator;
@@ -8,6 +8,9 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
8
8
  var __metadata = (this && this.__metadata) || function (k, v) {
9
9
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
10
  };
11
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
12
+ return function (target, key) { decorator(target, key, paramIndex); }
13
+ };
11
14
  Object.defineProperty(exports, "__esModule", { value: true });
12
15
  exports.PermissionsGuard = void 0;
13
16
  exports.RequirePermissions = RequirePermissions;
@@ -16,78 +19,43 @@ const core_1 = require("@nestjs/core");
16
19
  const swagger_1 = require("@nestjs/swagger");
17
20
  const class_validator_1 = require("class-validator");
18
21
  const itlab_functions_1 = require("itlab-functions");
19
- const auth_guard_1 = require("./auth.guard");
20
- /**
21
- * PERMISSIONS_METADATA_KEY
22
- *
23
- * Metadata key used to store the list of required permissions for a route handler.
24
- * This key is used by the PermissionsGuard to retrieve permissions metadata.
25
- */
26
- const PERMISSIONS_METADATA_KEY = 'itlab-internal-perms-guard';
22
+ const authentication_options_parameter_1 = require("../authentication-options.parameter");
23
+ const jwt_auth_guard_1 = require("./jwt-auth.guard");
24
+ const public_guard_1 = require("./public.guard");
25
+ /** Metadata key storing required permissions for routes */
26
+ const PERMISSIONS_METADATA_KEY = Symbol('itlab-permissions-guard');
27
27
  /**
28
- * Guard responsible for enforcing permissions-based access control.
29
- * It checks whether the authenticated user possesses all required permissions
30
- * defined via metadata on route handlers.
28
+ * Guard enforcing that authenticated users have the necessary permissions.
31
29
  */
32
30
  let PermissionsGuard = class PermissionsGuard {
33
- constructor(reflector) {
31
+ constructor(authenticationOptions, reflector) {
32
+ this.authenticationOptions = authenticationOptions;
34
33
  this.reflector = reflector;
35
34
  }
36
- /**
37
- * Determines if the current user has sufficient permissions to access the resource.
38
- *
39
- * - Retrieves required permissions metadata for the current handler.
40
- * - Allows access immediately if no permissions are specified (no restriction).
41
- * - Validates presence of user permissions and checks if they satisfy requirements.
42
- * - Throws ForbiddenException with detailed message if authorization fails.
43
- *
44
- * @param {ExecutionContext} context - The execution context of the current request.
45
- * @returns {boolean} True if user has required permissions; otherwise throws.
46
- * @throws {ForbiddenException} When user lacks required permissions.
47
- */
48
35
  canActivate(context) {
49
- // Retrieve the array of permissions required by this route handler.
50
- const requiredPermissions = this.reflector.get(PERMISSIONS_METADATA_KEY, context.getHandler());
51
- // If no permissions are specified, allow unrestricted access.
52
- if (!requiredPermissions || requiredPermissions.length === 0) {
36
+ if ((0, public_guard_1.isPublicRoute)(context, this.reflector))
53
37
  return true;
54
- }
55
- // Extract the authenticated user from the request object.
56
- const { user } = context.switchToHttp().getRequest();
57
- // Check user existence, ensure user has at least one permission,
58
- // and verify user permissions satisfy required permissions.
59
- const userHasPermissions = user && (0, class_validator_1.arrayMinSize)(user.perms, 1) && (0, itlab_functions_1.hasSomePermission)(requiredPermissions, user.perms);
60
- if (userHasPermissions) {
38
+ const requiredPermissions = this.reflector.get(PERMISSIONS_METADATA_KEY, context.getHandler());
39
+ if (hasRequiredPermissions(context, requiredPermissions))
61
40
  return true;
62
- }
63
- // Compose a user-friendly permission list string for error message.
64
- const permissionList = (0, itlab_functions_1.formatList)(requiredPermissions, 'or');
65
- // Deny access with a clear explanation of missing permissions.
66
- throw new common_1.ForbiddenException(`Insufficient permissions: ${permissionList}`);
41
+ throw new common_1.ForbiddenException(`Insufficient permissions: ${(0, itlab_functions_1.formatList)(requiredPermissions, 'or')}`);
67
42
  }
68
43
  };
69
44
  exports.PermissionsGuard = PermissionsGuard;
70
45
  exports.PermissionsGuard = PermissionsGuard = __decorate([
71
46
  (0, common_1.Injectable)(),
72
- __metadata("design:paramtypes", [core_1.Reflector])
47
+ __param(0, (0, authentication_options_parameter_1.InjectAuthenticationOptions)()),
48
+ __metadata("design:paramtypes", [Object, core_1.Reflector])
73
49
  ], PermissionsGuard);
74
- /**
75
- * RequirePermissions
76
- *
77
- * Decorator factory that:
78
- * - Attaches required permissions metadata to the route handler.
79
- * - Applies the AuthGuard and PermissionsGuard to secure the route.
80
- * - Adds Swagger documentation for bearer authentication and forbidden responses.
81
- *
82
- * @param {...string[]} permissions - List of permissions required to access the route.
83
- * @returns {MethodDecorator & ClassDecorator} A composite decorator securing the route.
84
- */
50
+ /** Check if account has required permissions */
51
+ function hasRequiredPermissions(context, requiredPermissions) {
52
+ // If no permissions are specified, allow unrestricted access.
53
+ if (!requiredPermissions || requiredPermissions.length === 0)
54
+ return true;
55
+ const { account } = context.switchToHttp().getRequest();
56
+ return (0, class_validator_1.arrayMinSize)(account === null || account === void 0 ? void 0 : account.perms, 1) && (0, itlab_functions_1.hasSomePermission)(requiredPermissions, account.perms);
57
+ }
58
+ /** Decorator enforcing permissions on routes/controllers */
85
59
  function RequirePermissions(...permissions) {
86
- return (0, common_1.applyDecorators)((0, common_1.SetMetadata)(PERMISSIONS_METADATA_KEY, permissions),
87
- // Ensure the request is authenticated before checking permissions.
88
- (0, common_1.UseGuards)(auth_guard_1.AuthGuard, PermissionsGuard),
89
- // Swagger decorator indicating Bearer token authentication is required.
90
- (0, swagger_1.ApiBearerAuth)(),
91
- // Swagger decorator documenting the 403 Forbidden response with permission details.
92
- (0, swagger_1.ApiForbiddenResponse)({ description: `Insufficient permissions: ${(0, itlab_functions_1.formatList)(permissions, 'or')}` }));
60
+ return (0, common_1.applyDecorators)((0, common_1.SetMetadata)(PERMISSIONS_METADATA_KEY, permissions), (0, common_1.UseGuards)(jwt_auth_guard_1.JwtAuthGuard, PermissionsGuard), (0, swagger_1.ApiBearerAuth)('Auth Token'), (0, swagger_1.ApiForbiddenResponse)({ description: `Insufficient permissions: ${(0, itlab_functions_1.formatList)(permissions, 'or')}` }));
93
61
  }
@@ -1,14 +1,8 @@
1
- /**
2
- * Metadata key used to mark route handlers as public,
3
- * indicating that they do not require authentication.
4
- */
5
- export declare const IS_PUBLIC_METADATA_KEY = "itlab-public-guard";
6
- /**
7
- * Decorator to designate a route or controller as publicly accessible.
8
- * This bypasses authentication guards that check for authorization tokens.
9
- * It also updates Swagger documentation to clarify that authentication
10
- * is not required for this endpoint.
11
- *
12
- * @returns {MethodDecorator & ClassDecorator} A composite decorator marking routes as public.
13
- */
1
+ import { ExecutionContext } from '@nestjs/common';
2
+ import { Reflector } from '@nestjs/core';
3
+ /** Metadata key marking a route as public (no auth required) */
4
+ export declare const PUBLIC_METADATA_KEY: unique symbol;
5
+ /** Check if a route or controller is marked as public */
6
+ export declare function isPublicRoute(context: ExecutionContext, reflector: Reflector): boolean;
7
+ /** Decorator marking a route/controller as public */
14
8
  export declare function Public(): MethodDecorator & ClassDecorator;
@@ -1,30 +1,16 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.IS_PUBLIC_METADATA_KEY = void 0;
3
+ exports.PUBLIC_METADATA_KEY = void 0;
4
+ exports.isPublicRoute = isPublicRoute;
4
5
  exports.Public = Public;
5
6
  const common_1 = require("@nestjs/common");
6
- const swagger_1 = require("@nestjs/swagger");
7
- /**
8
- * Metadata key used to mark route handlers as public,
9
- * indicating that they do not require authentication.
10
- */
11
- exports.IS_PUBLIC_METADATA_KEY = 'itlab-public-guard';
12
- /**
13
- * Decorator to designate a route or controller as publicly accessible.
14
- * This bypasses authentication guards that check for authorization tokens.
15
- * It also updates Swagger documentation to clarify that authentication
16
- * is not required for this endpoint.
17
- *
18
- * @returns {MethodDecorator & ClassDecorator} A composite decorator marking routes as public.
19
- */
7
+ /** Metadata key marking a route as public (no auth required) */
8
+ exports.PUBLIC_METADATA_KEY = Symbol('itlab-public-guard');
9
+ /** Check if a route or controller is marked as public */
10
+ function isPublicRoute(context, reflector) {
11
+ return reflector.getAllAndOverride(exports.PUBLIC_METADATA_KEY, [context.getHandler(), context.getClass()]);
12
+ }
13
+ /** Decorator marking a route/controller as public */
20
14
  function Public() {
21
- return (0, common_1.applyDecorators)(
22
- // Attach metadata signaling that this route is public (auth not required).
23
- (0, common_1.SetMetadata)(exports.IS_PUBLIC_METADATA_KEY, true),
24
- // Explicitly clear security requirements for this route to override global auth
25
- (0, swagger_1.ApiSecurity)(''), // Empty string disables security for this route
26
- // Document the 401 Unauthorized response with an explanatory message.
27
- (0, swagger_1.ApiUnauthorizedResponse)({
28
- description: 'This is a public endpoint and does not require authentication',
29
- }));
15
+ return (0, common_1.applyDecorators)((0, common_1.SetMetadata)(exports.PUBLIC_METADATA_KEY, true), (0, common_1.SetMetadata)('swagger/apiSecurity', ['public']));
30
16
  }
@@ -0,0 +1,22 @@
1
+ import { CanActivate, ExecutionContext } from '@nestjs/common';
2
+ import { Reflector } from '@nestjs/core';
3
+ import { AuthenticationModuleOptions } from '../authentication-module-options.interface';
4
+ /** Header key used for internal Kubernetes service authentication */
5
+ export declare const SERVICE_AUTH_HEADER_KEY = "X-itlab-k8s-auth";
6
+ /**
7
+ * Guard validating service-to-service requests using a shared token.
8
+ */
9
+ export declare class ServiceAuthGuard implements CanActivate {
10
+ private readonly authenticationOptions;
11
+ private readonly reflector;
12
+ constructor(authenticationOptions: AuthenticationModuleOptions, reflector: Reflector);
13
+ canActivate(context: ExecutionContext): boolean;
14
+ }
15
+ /**
16
+ * Check if request contains the required internal service token.
17
+ */
18
+ export declare function isServiceRequest(context: ExecutionContext, requiredk8sToken: string): boolean;
19
+ /**
20
+ * Decorator for routes/controllers accessible only by internal services.
21
+ */
22
+ export declare function RequireServiceAuth(): MethodDecorator & ClassDecorator;
@@ -0,0 +1,65 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.ServiceAuthGuard = exports.SERVICE_AUTH_HEADER_KEY = void 0;
16
+ exports.isServiceRequest = isServiceRequest;
17
+ exports.RequireServiceAuth = RequireServiceAuth;
18
+ const common_1 = require("@nestjs/common");
19
+ const core_1 = require("@nestjs/core");
20
+ const swagger_1 = require("@nestjs/swagger");
21
+ const authentication_options_parameter_1 = require("../authentication-options.parameter");
22
+ const public_guard_1 = require("./public.guard");
23
+ /** Header key used for internal Kubernetes service authentication */
24
+ exports.SERVICE_AUTH_HEADER_KEY = 'X-itlab-k8s-auth';
25
+ /**
26
+ * Guard validating service-to-service requests using a shared token.
27
+ */
28
+ let ServiceAuthGuard = class ServiceAuthGuard {
29
+ constructor(authenticationOptions, reflector) {
30
+ this.authenticationOptions = authenticationOptions;
31
+ this.reflector = reflector;
32
+ }
33
+ canActivate(context) {
34
+ if ((0, public_guard_1.isPublicRoute)(context, this.reflector))
35
+ return true;
36
+ if (isServiceRequest(context, this.authenticationOptions.k8sToken))
37
+ return true;
38
+ throw new common_1.UnauthorizedException('Application unauthorized');
39
+ }
40
+ };
41
+ exports.ServiceAuthGuard = ServiceAuthGuard;
42
+ exports.ServiceAuthGuard = ServiceAuthGuard = __decorate([
43
+ (0, common_1.Injectable)(),
44
+ __param(0, (0, authentication_options_parameter_1.InjectAuthenticationOptions)()),
45
+ __metadata("design:paramtypes", [Object, core_1.Reflector])
46
+ ], ServiceAuthGuard);
47
+ /**
48
+ * Check if request contains the required internal service token.
49
+ */
50
+ function isServiceRequest(context, requiredk8sToken) {
51
+ const request = context.switchToHttp().getRequest();
52
+ const token = request.header(exports.SERVICE_AUTH_HEADER_KEY);
53
+ return token && token === requiredk8sToken;
54
+ }
55
+ /**
56
+ * Decorator for routes/controllers accessible only by internal services.
57
+ */
58
+ function RequireServiceAuth() {
59
+ return (0, common_1.applyDecorators)((0, common_1.UseGuards)(ServiceAuthGuard), (0, swagger_1.ApiSecurity)('Service Token'), (0, swagger_1.ApiHeader)({
60
+ name: exports.SERVICE_AUTH_HEADER_KEY,
61
+ description: 'Token for service authentication',
62
+ allowEmptyValue: true,
63
+ required: true,
64
+ }), (0, swagger_1.ApiUnauthorizedResponse)({ description: 'Application unauthorized' }));
65
+ }
@@ -1,4 +1,4 @@
1
+ export * from './authentication-module-options.interface';
2
+ export * from './authentication-options.parameter';
3
+ export * from './authentication.module';
1
4
  export * from './guards';
2
- export { AuthenticationModuleOptions } from './authentication-module-options.interface';
3
- export { AuthenticationModule } from './authentication.module';
4
- export { InjectAuthOptions } from './inject-auth-options.decorator';
@@ -14,9 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.InjectAuthOptions = exports.AuthenticationModule = void 0;
17
+ __exportStar(require("./authentication-module-options.interface"), exports);
18
+ __exportStar(require("./authentication-options.parameter"), exports);
19
+ __exportStar(require("./authentication.module"), exports);
18
20
  __exportStar(require("./guards"), exports);
19
- var authentication_module_1 = require("./authentication.module");
20
- Object.defineProperty(exports, "AuthenticationModule", { enumerable: true, get: function () { return authentication_module_1.AuthenticationModule; } });
21
- var inject_auth_options_decorator_1 = require("./inject-auth-options.decorator");
22
- Object.defineProperty(exports, "InjectAuthOptions", { enumerable: true, get: function () { return inject_auth_options_decorator_1.InjectAuthOptions; } });