@flusys/nestjs-shared 7.0.2 → 8.0.0-beta.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 (339) hide show
  1. package/classes/api-controller.class.d.ts +4 -4
  2. package/classes/api-service.class.d.ts +7 -7
  3. package/classes/disabled-event-bus.class.d.ts +1 -1
  4. package/classes/domain-event.publisher.d.ts +1 -1
  5. package/classes/event-bus.registry.d.ts +1 -1
  6. package/classes/event-transports/event-transport.registry.d.ts +1 -1
  7. package/classes/event-transports/index.d.ts +2 -2
  8. package/classes/event-transports/kafka-transport.optional.d.ts +1 -1
  9. package/classes/event-transports/memory-transport.d.ts +1 -1
  10. package/classes/event-transports/rabbitmq-transport.optional.d.ts +1 -1
  11. package/classes/hybrid-event-bus.class.d.ts +1 -1
  12. package/classes/index.d.ts +11 -11
  13. package/constants/index.d.ts +2 -2
  14. package/constants/permissions.d.ts +12 -0
  15. package/decorators/api-response.decorator.d.ts +1 -1
  16. package/decorators/current-user.decorator.d.ts +1 -1
  17. package/decorators/index.d.ts +6 -6
  18. package/decorators/require-permission.decorator.d.ts +1 -1
  19. package/dtos/filter-and-pagination.dto.d.ts +1 -1
  20. package/dtos/index.d.ts +6 -6
  21. package/entities/index.d.ts +3 -3
  22. package/enums/index.d.ts +3 -3
  23. package/exceptions/index.d.ts +2 -2
  24. package/fesm/470.js +2713 -0
  25. package/fesm/509.js +793 -0
  26. package/fesm/667.js +606 -0
  27. package/fesm/67.js +808 -0
  28. package/fesm/720.js +914 -0
  29. package/{cjs/classes/event-transports/rabbitmq-transport.optional.js → fesm/chunks/123.js} +78 -55
  30. package/fesm/{classes/event-transports/kafka-transport.optional.js → chunks/37.js} +74 -41
  31. package/fesm/classes/index.js +62 -12
  32. package/fesm/constants/index.js +445 -17
  33. package/fesm/decorators/index.js +341 -6
  34. package/fesm/dtos/index.js +23 -6
  35. package/fesm/entities/index.js +336 -3
  36. package/fesm/enums/index.js +57 -3
  37. package/fesm/exceptions/index.js +280 -2
  38. package/fesm/guards/index.js +1003 -3
  39. package/fesm/index.js +1524 -14
  40. package/fesm/interceptors/index.js +924 -5
  41. package/fesm/interfaces/index.js +57 -11
  42. package/fesm/middlewares/index.js +33 -1
  43. package/fesm/modules/index.js +432 -9
  44. package/fesm/runtime.js +134 -0
  45. package/fesm/utils/index.js +1045 -8
  46. package/filters/global-exception.filter.d.ts +1 -1
  47. package/filters/index.d.ts +1 -1
  48. package/guards/index.d.ts +3 -3
  49. package/guards/jwt-auth.guard.d.ts +1 -1
  50. package/guards/optional-jwt-auth.guard.d.ts +1 -1
  51. package/guards/permission.guard.d.ts +2 -2
  52. package/index.d.ts +14 -14
  53. package/interceptors/delete-empty-id-from-body.interceptor.d.ts +1 -1
  54. package/interceptors/idempotency.interceptor.d.ts +2 -2
  55. package/interceptors/index.d.ts +5 -5
  56. package/interceptors/response-meta.interceptor.d.ts +1 -1
  57. package/interceptors/set-user-field-on-body.interceptor.d.ts +1 -1
  58. package/interceptors/slug.interceptor.d.ts +2 -2
  59. package/interfaces/ai-assistant-adapter.interface.d.ts +1 -1
  60. package/interfaces/api.interface.d.ts +2 -2
  61. package/interfaces/datasource.interface.d.ts +1 -1
  62. package/interfaces/event-manager-adapter.interface.d.ts +2 -2
  63. package/interfaces/index.d.ts +11 -11
  64. package/interfaces/module-config.interface.d.ts +1 -1
  65. package/interfaces/notification-adapter.interface.d.ts +1 -1
  66. package/middlewares/index.d.ts +1 -1
  67. package/middlewares/logger.middleware.d.ts +2 -2
  68. package/modules/cache/cache.module.d.ts +1 -1
  69. package/modules/datasource/index.d.ts +1 -1
  70. package/modules/datasource/multi-tenant-datasource.service.d.ts +4 -4
  71. package/modules/event-bus/event-bus.explorer.d.ts +2 -2
  72. package/modules/event-bus/event-bus.module.d.ts +2 -2
  73. package/modules/event-bus/module-events.provider.d.ts +1 -1
  74. package/modules/index.d.ts +9 -9
  75. package/modules/shared-permission-cache/shared-permission-cache.service.d.ts +3 -3
  76. package/modules/utils/utils.service.d.ts +1 -1
  77. package/package.json +30 -44
  78. package/utils/index.d.ts +8 -8
  79. package/utils/permission-cache-key.util.d.ts +1 -1
  80. package/utils/query-helpers.util.d.ts +2 -2
  81. package/utils/request.util.d.ts +1 -1
  82. package/cjs/classes/api-controller.class.js +0 -728
  83. package/cjs/classes/api-controller.class.spec.js +0 -684
  84. package/cjs/classes/api-service.class.js +0 -631
  85. package/cjs/classes/api-service.class.spec.js +0 -1137
  86. package/cjs/classes/disabled-event-bus.class.js +0 -15
  87. package/cjs/classes/disabled-event-bus.class.spec.js +0 -40
  88. package/cjs/classes/domain-event.publisher.js +0 -76
  89. package/cjs/classes/domain-event.publisher.spec.js +0 -234
  90. package/cjs/classes/event-bus.registry.js +0 -68
  91. package/cjs/classes/event-bus.registry.spec.js +0 -141
  92. package/cjs/classes/event-transports/event-transport.registry.js +0 -41
  93. package/cjs/classes/event-transports/event-transport.registry.spec.js +0 -31
  94. package/cjs/classes/event-transports/index.js +0 -23
  95. package/cjs/classes/event-transports/kafka-transport.optional.js +0 -151
  96. package/cjs/classes/event-transports/kafka-transport.optional.spec.js +0 -198
  97. package/cjs/classes/event-transports/memory-transport.js +0 -53
  98. package/cjs/classes/event-transports/memory-transport.spec.js +0 -57
  99. package/cjs/classes/event-transports/rabbitmq-transport.optional.spec.js +0 -255
  100. package/cjs/classes/handle-custome-db.js +0 -37
  101. package/cjs/classes/handle-custome-db.spec.js +0 -82
  102. package/cjs/classes/hybrid-cache.class.js +0 -96
  103. package/cjs/classes/hybrid-cache.class.spec.js +0 -168
  104. package/cjs/classes/hybrid-event-bus.class.js +0 -281
  105. package/cjs/classes/hybrid-event-bus.class.spec.js +0 -218
  106. package/cjs/classes/index.js +0 -28
  107. package/cjs/classes/winston.logger.class.js +0 -274
  108. package/cjs/classes/winston.logger.class.spec.js +0 -330
  109. package/cjs/constants/index.js +0 -88
  110. package/cjs/constants/message-keys.js +0 -68
  111. package/cjs/constants/permissions.js +0 -297
  112. package/cjs/decorators/api-response.decorator.js +0 -52
  113. package/cjs/decorators/api-response.decorator.spec.js +0 -126
  114. package/cjs/decorators/current-user.decorator.js +0 -16
  115. package/cjs/decorators/current-user.decorator.spec.js +0 -74
  116. package/cjs/decorators/index.js +0 -23
  117. package/cjs/decorators/log-action.decorator.js +0 -149
  118. package/cjs/decorators/log-action.decorator.spec.js +0 -353
  119. package/cjs/decorators/on-domain-event.decorator.js +0 -13
  120. package/cjs/decorators/on-domain-event.decorator.spec.js +0 -50
  121. package/cjs/decorators/public.decorator.js +0 -13
  122. package/cjs/decorators/public.decorator.spec.js +0 -50
  123. package/cjs/decorators/require-permission.decorator.js +0 -32
  124. package/cjs/decorators/require-permission.decorator.spec.js +0 -147
  125. package/cjs/dtos/delete.dto.js +0 -92
  126. package/cjs/dtos/filter-and-pagination.dto.js +0 -164
  127. package/cjs/dtos/get-by-ids.dto.js +0 -65
  128. package/cjs/dtos/identity-response.dto.js +0 -108
  129. package/cjs/dtos/index.js +0 -23
  130. package/cjs/dtos/pagination.dto.js +0 -67
  131. package/cjs/dtos/response-payload.dto.js +0 -369
  132. package/cjs/entities/identity.js +0 -100
  133. package/cjs/entities/index.js +0 -20
  134. package/cjs/entities/raw-type.js +0 -4
  135. package/cjs/entities/user-root.js +0 -189
  136. package/cjs/enums/index.js +0 -20
  137. package/cjs/enums/notification-type.enum.js +0 -17
  138. package/cjs/enums/participant-status.enum.js +0 -17
  139. package/cjs/enums/recurrence-type.enum.js +0 -18
  140. package/cjs/exceptions/base-app.exception.js +0 -151
  141. package/cjs/exceptions/base-app.exception.spec.js +0 -157
  142. package/cjs/exceptions/index.js +0 -19
  143. package/cjs/exceptions/permission.exception.js +0 -56
  144. package/cjs/exceptions/permission.exception.spec.js +0 -82
  145. package/cjs/filters/global-exception.filter.js +0 -279
  146. package/cjs/filters/global-exception.filter.spec.js +0 -440
  147. package/cjs/filters/index.js +0 -18
  148. package/cjs/guards/index.js +0 -20
  149. package/cjs/guards/jwt-auth.guard.js +0 -75
  150. package/cjs/guards/jwt-auth.guard.spec.js +0 -75
  151. package/cjs/guards/optional-jwt-auth.guard.js +0 -67
  152. package/cjs/guards/optional-jwt-auth.guard.spec.js +0 -55
  153. package/cjs/guards/permission.guard.js +0 -179
  154. package/cjs/guards/permission.guard.spec.js +0 -373
  155. package/cjs/index.js +0 -31
  156. package/cjs/interceptors/delete-empty-id-from-body.interceptor.js +0 -40
  157. package/cjs/interceptors/delete-empty-id-from-body.interceptor.spec.js +0 -107
  158. package/cjs/interceptors/idempotency.interceptor.js +0 -96
  159. package/cjs/interceptors/idempotency.interceptor.spec.js +0 -116
  160. package/cjs/interceptors/index.js +0 -22
  161. package/cjs/interceptors/response-meta.interceptor.js +0 -47
  162. package/cjs/interceptors/response-meta.interceptor.spec.js +0 -89
  163. package/cjs/interceptors/set-user-field-on-body.interceptor.js +0 -60
  164. package/cjs/interceptors/set-user-field-on-body.interceptor.spec.js +0 -128
  165. package/cjs/interceptors/slug.interceptor.js +0 -75
  166. package/cjs/interceptors/slug.interceptor.spec.js +0 -110
  167. package/cjs/interfaces/ai-assistant-adapter.interface.js +0 -24
  168. package/cjs/interfaces/api.interface.js +0 -4
  169. package/cjs/interfaces/datasource.interface.js +0 -4
  170. package/cjs/interfaces/event-bus.interface.js +0 -4
  171. package/cjs/interfaces/event-manager-adapter.interface.js +0 -11
  172. package/cjs/interfaces/identity.interface.js +0 -4
  173. package/cjs/interfaces/index.js +0 -28
  174. package/cjs/interfaces/logged-user-info.interface.js +0 -6
  175. package/cjs/interfaces/module-config.interface.js +0 -4
  176. package/cjs/interfaces/notification-adapter.interface.js +0 -11
  177. package/cjs/interfaces/permission-sync-adapter.interface.js +0 -11
  178. package/cjs/interfaces/permission.interface.js +0 -4
  179. package/cjs/middlewares/index.js +0 -18
  180. package/cjs/middlewares/logger.middleware.js +0 -264
  181. package/cjs/middlewares/logger.middleware.spec.js +0 -462
  182. package/cjs/modules/cache/cache.module.js +0 -39
  183. package/cjs/modules/cache/cache.module.spec.js +0 -48
  184. package/cjs/modules/datasource/index.js +0 -18
  185. package/cjs/modules/datasource/multi-tenant-datasource.service.js +0 -222
  186. package/cjs/modules/datasource/multi-tenant-datasource.service.spec.js +0 -381
  187. package/cjs/modules/event-bus/event-bus.explorer.js +0 -124
  188. package/cjs/modules/event-bus/event-bus.explorer.spec.js +0 -189
  189. package/cjs/modules/event-bus/event-bus.integration.spec.js +0 -253
  190. package/cjs/modules/event-bus/event-bus.module.js +0 -94
  191. package/cjs/modules/event-bus/event-bus.module.spec.js +0 -149
  192. package/cjs/modules/event-bus/module-events.provider.js +0 -39
  193. package/cjs/modules/event-bus/module-events.provider.spec.js +0 -56
  194. package/cjs/modules/index.js +0 -26
  195. package/cjs/modules/shared-permission-cache/shared-permission-cache.module.js +0 -32
  196. package/cjs/modules/shared-permission-cache/shared-permission-cache.service.js +0 -101
  197. package/cjs/modules/shared-permission-cache/shared-permission-cache.service.spec.js +0 -165
  198. package/cjs/modules/utils/utils.module.js +0 -32
  199. package/cjs/modules/utils/utils.service.js +0 -76
  200. package/cjs/modules/utils/utils.service.spec.js +0 -169
  201. package/cjs/utils/date-time.util.js +0 -94
  202. package/cjs/utils/date-time.util.spec.js +0 -84
  203. package/cjs/utils/event-pattern.util.js +0 -103
  204. package/cjs/utils/event-pattern.util.spec.js +0 -251
  205. package/cjs/utils/html-sanitizer.util.js +0 -64
  206. package/cjs/utils/html-sanitizer.util.spec.js +0 -76
  207. package/cjs/utils/index.js +0 -25
  208. package/cjs/utils/optional-module.util.js +0 -35
  209. package/cjs/utils/optional-module.util.spec.js +0 -14
  210. package/cjs/utils/permission-cache-key.util.js +0 -31
  211. package/cjs/utils/permission-cache-key.util.spec.js +0 -88
  212. package/cjs/utils/query-helpers.util.js +0 -60
  213. package/cjs/utils/query-helpers.util.spec.js +0 -209
  214. package/cjs/utils/request.util.js +0 -96
  215. package/cjs/utils/request.util.spec.js +0 -249
  216. package/cjs/utils/string.util.js +0 -63
  217. package/cjs/utils/string.util.spec.js +0 -63
  218. package/fesm/classes/api-controller.class.js +0 -718
  219. package/fesm/classes/api-controller.class.spec.js +0 -680
  220. package/fesm/classes/api-service.class.js +0 -621
  221. package/fesm/classes/api-service.class.spec.js +0 -1133
  222. package/fesm/classes/disabled-event-bus.class.js +0 -11
  223. package/fesm/classes/disabled-event-bus.class.spec.js +0 -36
  224. package/fesm/classes/domain-event.publisher.js +0 -63
  225. package/fesm/classes/domain-event.publisher.spec.js +0 -230
  226. package/fesm/classes/event-bus.registry.js +0 -64
  227. package/fesm/classes/event-bus.registry.spec.js +0 -137
  228. package/fesm/classes/event-transports/event-transport.registry.js +0 -35
  229. package/fesm/classes/event-transports/event-transport.registry.spec.js +0 -27
  230. package/fesm/classes/event-transports/index.js +0 -6
  231. package/fesm/classes/event-transports/kafka-transport.optional.spec.js +0 -194
  232. package/fesm/classes/event-transports/memory-transport.js +0 -49
  233. package/fesm/classes/event-transports/memory-transport.spec.js +0 -53
  234. package/fesm/classes/event-transports/rabbitmq-transport.optional.js +0 -174
  235. package/fesm/classes/event-transports/rabbitmq-transport.optional.spec.js +0 -251
  236. package/fesm/classes/handle-custome-db.js +0 -19
  237. package/fesm/classes/handle-custome-db.spec.js +0 -78
  238. package/fesm/classes/hybrid-cache.class.js +0 -81
  239. package/fesm/classes/hybrid-cache.class.spec.js +0 -164
  240. package/fesm/classes/hybrid-event-bus.class.js +0 -237
  241. package/fesm/classes/hybrid-event-bus.class.spec.js +0 -214
  242. package/fesm/classes/winston.logger.class.js +0 -228
  243. package/fesm/classes/winston.logger.class.spec.js +0 -327
  244. package/fesm/constants/message-keys.js +0 -49
  245. package/fesm/constants/permissions.js +0 -208
  246. package/fesm/decorators/api-response.decorator.js +0 -42
  247. package/fesm/decorators/api-response.decorator.spec.js +0 -122
  248. package/fesm/decorators/current-user.decorator.js +0 -18
  249. package/fesm/decorators/current-user.decorator.spec.js +0 -73
  250. package/fesm/decorators/log-action.decorator.js +0 -139
  251. package/fesm/decorators/log-action.decorator.spec.js +0 -349
  252. package/fesm/decorators/on-domain-event.decorator.js +0 -10
  253. package/fesm/decorators/on-domain-event.decorator.spec.js +0 -46
  254. package/fesm/decorators/public.decorator.js +0 -20
  255. package/fesm/decorators/public.decorator.spec.js +0 -46
  256. package/fesm/decorators/require-permission.decorator.js +0 -27
  257. package/fesm/decorators/require-permission.decorator.spec.js +0 -143
  258. package/fesm/dtos/delete.dto.js +0 -82
  259. package/fesm/dtos/filter-and-pagination.dto.js +0 -148
  260. package/fesm/dtos/get-by-ids.dto.js +0 -55
  261. package/fesm/dtos/identity-response.dto.js +0 -98
  262. package/fesm/dtos/pagination.dto.js +0 -57
  263. package/fesm/dtos/response-payload.dto.js +0 -336
  264. package/fesm/entities/identity.js +0 -90
  265. package/fesm/entities/raw-type.js +0 -1
  266. package/fesm/entities/user-root.js +0 -179
  267. package/fesm/enums/notification-type.enum.js +0 -7
  268. package/fesm/enums/participant-status.enum.js +0 -7
  269. package/fesm/enums/recurrence-type.enum.js +0 -8
  270. package/fesm/exceptions/base-app.exception.js +0 -115
  271. package/fesm/exceptions/base-app.exception.spec.js +0 -153
  272. package/fesm/exceptions/permission.exception.js +0 -35
  273. package/fesm/exceptions/permission.exception.spec.js +0 -78
  274. package/fesm/filters/global-exception.filter.js +0 -269
  275. package/fesm/filters/global-exception.filter.spec.js +0 -436
  276. package/fesm/filters/index.js +0 -1
  277. package/fesm/guards/jwt-auth.guard.js +0 -65
  278. package/fesm/guards/jwt-auth.guard.spec.js +0 -71
  279. package/fesm/guards/optional-jwt-auth.guard.js +0 -57
  280. package/fesm/guards/optional-jwt-auth.guard.spec.js +0 -51
  281. package/fesm/guards/permission.guard.js +0 -169
  282. package/fesm/guards/permission.guard.spec.js +0 -369
  283. package/fesm/interceptors/delete-empty-id-from-body.interceptor.js +0 -30
  284. package/fesm/interceptors/delete-empty-id-from-body.interceptor.spec.js +0 -103
  285. package/fesm/interceptors/idempotency.interceptor.js +0 -86
  286. package/fesm/interceptors/idempotency.interceptor.spec.js +0 -112
  287. package/fesm/interceptors/response-meta.interceptor.js +0 -37
  288. package/fesm/interceptors/response-meta.interceptor.spec.js +0 -85
  289. package/fesm/interceptors/set-user-field-on-body.interceptor.js +0 -39
  290. package/fesm/interceptors/set-user-field-on-body.interceptor.spec.js +0 -124
  291. package/fesm/interceptors/slug.interceptor.js +0 -65
  292. package/fesm/interceptors/slug.interceptor.spec.js +0 -106
  293. package/fesm/interfaces/ai-assistant-adapter.interface.js +0 -3
  294. package/fesm/interfaces/api.interface.js +0 -1
  295. package/fesm/interfaces/datasource.interface.js +0 -1
  296. package/fesm/interfaces/event-bus.interface.js +0 -1
  297. package/fesm/interfaces/event-manager-adapter.interface.js +0 -1
  298. package/fesm/interfaces/identity.interface.js +0 -1
  299. package/fesm/interfaces/logged-user-info.interface.js +0 -3
  300. package/fesm/interfaces/module-config.interface.js +0 -5
  301. package/fesm/interfaces/notification-adapter.interface.js +0 -1
  302. package/fesm/interfaces/permission-sync-adapter.interface.js +0 -1
  303. package/fesm/interfaces/permission.interface.js +0 -1
  304. package/fesm/middlewares/logger.middleware.js +0 -235
  305. package/fesm/middlewares/logger.middleware.spec.js +0 -459
  306. package/fesm/modules/cache/cache.module.js +0 -29
  307. package/fesm/modules/cache/cache.module.spec.js +0 -44
  308. package/fesm/modules/datasource/index.js +0 -1
  309. package/fesm/modules/datasource/multi-tenant-datasource.service.js +0 -212
  310. package/fesm/modules/datasource/multi-tenant-datasource.service.spec.js +0 -377
  311. package/fesm/modules/event-bus/event-bus.explorer.js +0 -114
  312. package/fesm/modules/event-bus/event-bus.explorer.spec.js +0 -185
  313. package/fesm/modules/event-bus/event-bus.integration.spec.js +0 -249
  314. package/fesm/modules/event-bus/event-bus.module.js +0 -84
  315. package/fesm/modules/event-bus/event-bus.module.spec.js +0 -145
  316. package/fesm/modules/event-bus/module-events.provider.js +0 -26
  317. package/fesm/modules/event-bus/module-events.provider.spec.js +0 -52
  318. package/fesm/modules/shared-permission-cache/shared-permission-cache.module.js +0 -22
  319. package/fesm/modules/shared-permission-cache/shared-permission-cache.service.js +0 -91
  320. package/fesm/modules/shared-permission-cache/shared-permission-cache.service.spec.js +0 -161
  321. package/fesm/modules/utils/utils.module.js +0 -22
  322. package/fesm/modules/utils/utils.service.js +0 -66
  323. package/fesm/modules/utils/utils.service.spec.js +0 -165
  324. package/fesm/utils/date-time.util.js +0 -70
  325. package/fesm/utils/date-time.util.spec.js +0 -80
  326. package/fesm/utils/event-pattern.util.js +0 -91
  327. package/fesm/utils/event-pattern.util.spec.js +0 -247
  328. package/fesm/utils/html-sanitizer.util.js +0 -69
  329. package/fesm/utils/html-sanitizer.util.spec.js +0 -72
  330. package/fesm/utils/optional-module.util.js +0 -25
  331. package/fesm/utils/optional-module.util.spec.js +0 -10
  332. package/fesm/utils/permission-cache-key.util.js +0 -10
  333. package/fesm/utils/permission-cache-key.util.spec.js +0 -84
  334. package/fesm/utils/query-helpers.util.js +0 -85
  335. package/fesm/utils/query-helpers.util.spec.js +0 -205
  336. package/fesm/utils/request.util.js +0 -81
  337. package/fesm/utils/request.util.spec.js +0 -245
  338. package/fesm/utils/string.util.js +0 -71
  339. package/fesm/utils/string.util.spec.js +0 -59
@@ -1,728 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "createApiController", {
6
- enumerable: true,
7
- get: function() {
8
- return createApiController;
9
- }
10
- });
11
- const _common = require("@nestjs/common");
12
- const _swagger = require("@nestjs/swagger");
13
- const _classtransformer = require("class-transformer");
14
- const _messagekeys = require("../constants/message-keys");
15
- const _decorators = require("../decorators");
16
- const _apiresponsedecorator = require("../decorators/api-response.decorator");
17
- const _dtos = require("../dtos");
18
- const _exceptions = require("../exceptions");
19
- const _guards = require("../guards");
20
- const _interceptors = require("../interceptors");
21
- function _define_property(obj, key, value) {
22
- if (key in obj) {
23
- Object.defineProperty(obj, key, {
24
- value: value,
25
- enumerable: true,
26
- configurable: true,
27
- writable: true
28
- });
29
- } else {
30
- obj[key] = value;
31
- }
32
- return obj;
33
- }
34
- function _ts_decorate(decorators, target, key, desc) {
35
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
36
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
37
- 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;
38
- return c > 3 && r && Object.defineProperty(target, key, r), r;
39
- }
40
- function _ts_metadata(k, v) {
41
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
42
- }
43
- function _ts_param(paramIndex, decorator) {
44
- return function(target, key) {
45
- decorator(target, key, paramIndex);
46
- };
47
- }
48
- /**
49
- * Helper to normalize security config
50
- */ function normalizeSecurity(config) {
51
- if (!config) return {
52
- level: 'public'
53
- };
54
- if (typeof config === 'string') return {
55
- level: config
56
- };
57
- return config;
58
- }
59
- /**
60
- * Helper to check if endpoint is enabled
61
- */ function isEndpointEnabled(endpoint, enabledEndpoints) {
62
- if (!enabledEndpoints || enabledEndpoints === 'all') return true;
63
- return enabledEndpoints.includes(endpoint);
64
- }
65
- /**
66
- * Helper to conditionally exclude endpoint from Swagger if disabled
67
- */ function createEndpointDecorators(security, endpoint, enabledEndpoints) {
68
- const decorators = [];
69
- // Add security decorators
70
- decorators.push(createSecurityDecorators(security));
71
- // Exclude from Swagger if endpoint is disabled
72
- if (!isEndpointEnabled(endpoint, enabledEndpoints)) {
73
- decorators.push((0, _swagger.ApiExcludeEndpoint)());
74
- }
75
- return (0, _common.applyDecorators)(...decorators);
76
- }
77
- /**
78
- * Creates security decorators based on configuration
79
- */ function createSecurityDecorators(security) {
80
- const decorators = [];
81
- switch(security.level){
82
- case 'public':
83
- decorators.push((0, _decorators.Public)());
84
- break;
85
- case 'jwt':
86
- // Apply JWT authentication guard
87
- decorators.push((0, _common.UseGuards)(_guards.JwtAuthGuard));
88
- decorators.push((0, _swagger.ApiBearerAuth)());
89
- break;
90
- case 'permission':
91
- // Apply JWT authentication guard (required for permission checks)
92
- // Apply PermissionGuard to check permissions from cache
93
- decorators.push((0, _common.UseGuards)(_guards.JwtAuthGuard, _guards.PermissionGuard));
94
- decorators.push((0, _swagger.ApiBearerAuth)());
95
- // Check for complex logic first
96
- if (security.logic) {
97
- decorators.push((0, _decorators.RequirePermissionLogic)(security.logic));
98
- } else if (security.permissions && security.permissions.length > 0) {
99
- if (security.operator === 'OR') {
100
- decorators.push((0, _decorators.RequireAnyPermission)(...security.permissions));
101
- } else {
102
- // AND is default and most secure
103
- decorators.push((0, _decorators.RequirePermission)(...security.permissions));
104
- }
105
- }
106
- break;
107
- }
108
- return (0, _common.applyDecorators)(...decorators);
109
- }
110
- function createApiController(createDtoClass, updateDtoClass, responseDtoClass, options = {}) {
111
- const excludeExtraneousValues = options.excludeExtraneousValues ?? true;
112
- function toDto(cls, input) {
113
- return (0, _classtransformer.plainToInstance)(cls, input, {
114
- excludeExtraneousValues
115
- });
116
- }
117
- // Entity name for message keys (defaults to 'item')
118
- const entityName = options.entityName ?? 'item';
119
- // Determine if security is global (applies to all) or per-endpoint
120
- const securityConfig = options.security;
121
- const endpointKeys = [
122
- 'insert',
123
- 'insertMany',
124
- 'getById',
125
- 'getByIds',
126
- 'getAll',
127
- 'bulkUpsert',
128
- 'getByFilter',
129
- 'update',
130
- 'updateMany',
131
- 'delete'
132
- ];
133
- // Global security if:
134
- // 1. It's a string (SecurityLevel)
135
- // 2. It's an object with 'level' property but no endpoint keys
136
- const isGlobalSecurity = typeof securityConfig === 'string' || securityConfig && typeof securityConfig === 'object' && 'level' in securityConfig && !endpointKeys.some((key)=>key in securityConfig);
137
- // Normalize security config for each endpoint
138
- // IMPORTANT: When per-endpoint security is specified, default to 'jwt' for unconfigured endpoints
139
- // to prevent accidentally exposing endpoints without authentication
140
- const defaultSecurity = isGlobalSecurity ? normalizeSecurity(securityConfig) : {
141
- level: 'jwt'
142
- };
143
- const security = {
144
- insert: isGlobalSecurity ? defaultSecurity : normalizeSecurity(securityConfig?.insert),
145
- insertMany: isGlobalSecurity ? defaultSecurity : normalizeSecurity(securityConfig?.insertMany),
146
- getById: isGlobalSecurity ? defaultSecurity : normalizeSecurity(securityConfig?.getById),
147
- getByIds: isGlobalSecurity ? defaultSecurity : normalizeSecurity(securityConfig?.getByIds),
148
- getAll: isGlobalSecurity ? defaultSecurity : normalizeSecurity(securityConfig?.getAll),
149
- getByFilter: isGlobalSecurity ? defaultSecurity : normalizeSecurity(securityConfig?.getByFilter),
150
- bulkUpsert: isGlobalSecurity ? defaultSecurity : normalizeSecurity(securityConfig?.bulkUpsert),
151
- update: isGlobalSecurity ? defaultSecurity : normalizeSecurity(securityConfig?.update),
152
- updateMany: isGlobalSecurity ? defaultSecurity : normalizeSecurity(securityConfig?.updateMany),
153
- delete: isGlobalSecurity ? defaultSecurity : normalizeSecurity(securityConfig?.delete)
154
- };
155
- let ApiController = class ApiController {
156
- isEnabled(endpoint) {
157
- if (this.enabledEndpoints === 'all') return true;
158
- return Array.isArray(this.enabledEndpoints) && this.enabledEndpoints.includes(endpoint);
159
- }
160
- async insert(addDto, user) {
161
- if (!this.isEnabled('insert')) {
162
- throw new _exceptions.BaseAppException({
163
- message: `Endpoint 'insert' is disabled`,
164
- messageKey: _messagekeys.ERROR_MESSAGES.ENDPOINT_DISABLED,
165
- messageVariables: {
166
- endpoint: 'insert'
167
- },
168
- status: _common.HttpStatus.FORBIDDEN
169
- });
170
- }
171
- const entity = await this.service.insert(addDto, user);
172
- const data = toDto(responseDtoClass, entity);
173
- return {
174
- success: true,
175
- message: `${entityName.charAt(0).toUpperCase() + entityName.slice(1)} created successfully`,
176
- messageKey: `${entityName}.create.success`,
177
- data
178
- };
179
- }
180
- async insertMany(addDto, user) {
181
- if (!this.isEnabled('insertMany')) {
182
- throw new _exceptions.BaseAppException({
183
- message: `Endpoint 'insertMany' is disabled`,
184
- messageKey: _messagekeys.ERROR_MESSAGES.ENDPOINT_DISABLED,
185
- messageVariables: {
186
- endpoint: 'insertMany'
187
- },
188
- status: _common.HttpStatus.FORBIDDEN
189
- });
190
- }
191
- const entities = await this.service.insertMany(addDto, user);
192
- const data = entities.map((item)=>toDto(responseDtoClass, item));
193
- return {
194
- success: true,
195
- message: `${data.length} ${entityName}s created successfully`,
196
- messageKey: `${entityName}.create.many.success`,
197
- messageVariables: {
198
- count: data.length
199
- },
200
- data,
201
- meta: {
202
- count: data.length,
203
- total: addDto.length,
204
- failed: addDto.length - data.length
205
- }
206
- };
207
- }
208
- async getById(id, body, user) {
209
- if (!this.isEnabled('getById')) {
210
- throw new _exceptions.BaseAppException({
211
- message: `Endpoint 'getById' is disabled`,
212
- messageKey: _messagekeys.ERROR_MESSAGES.ENDPOINT_DISABLED,
213
- messageVariables: {
214
- endpoint: 'getById'
215
- },
216
- status: _common.HttpStatus.FORBIDDEN
217
- });
218
- }
219
- const entity = await this.service.findById(id, user, body?.select);
220
- const data = toDto(responseDtoClass, entity);
221
- return {
222
- success: true,
223
- message: `${entityName.charAt(0).toUpperCase() + entityName.slice(1)} retrieved successfully`,
224
- messageKey: `${entityName}.get.success`,
225
- data
226
- };
227
- }
228
- async getByIds(body, user) {
229
- if (!this.isEnabled('getByIds')) {
230
- throw new _exceptions.BaseAppException({
231
- message: `Endpoint 'getByIds' is disabled`,
232
- messageKey: _messagekeys.ERROR_MESSAGES.ENDPOINT_DISABLED,
233
- messageVariables: {
234
- endpoint: 'getByIds'
235
- },
236
- status: _common.HttpStatus.FORBIDDEN
237
- });
238
- }
239
- const entities = await this.service.findByIds(body.ids, user, body?.select);
240
- const data = entities.map((item)=>toDto(responseDtoClass, item));
241
- return {
242
- success: true,
243
- message: `${data.length} ${entityName}${data.length !== 1 ? 's' : ''} retrieved successfully`,
244
- messageKey: `${entityName}.get.by.ids.success`,
245
- data,
246
- meta: {
247
- total: data.length,
248
- page: 0,
249
- pageSize: data.length,
250
- count: data.length,
251
- totalPages: 1
252
- }
253
- };
254
- }
255
- async update(updateDto, user) {
256
- if (!this.isEnabled('update')) {
257
- throw new _exceptions.BaseAppException({
258
- message: `Endpoint 'update' is disabled`,
259
- messageKey: _messagekeys.ERROR_MESSAGES.ENDPOINT_DISABLED,
260
- messageVariables: {
261
- endpoint: 'update'
262
- },
263
- status: _common.HttpStatus.FORBIDDEN
264
- });
265
- }
266
- const entity = await this.service.update(updateDto, user);
267
- const data = toDto(responseDtoClass, entity);
268
- return {
269
- success: true,
270
- message: `${entityName.charAt(0).toUpperCase() + entityName.slice(1)} updated successfully`,
271
- messageKey: `${entityName}.update.success`,
272
- data
273
- };
274
- }
275
- async updateMany(updateDtos, user) {
276
- if (!this.isEnabled('updateMany')) {
277
- throw new _exceptions.BaseAppException({
278
- message: `Endpoint 'updateMany' is disabled`,
279
- messageKey: _messagekeys.ERROR_MESSAGES.ENDPOINT_DISABLED,
280
- messageVariables: {
281
- endpoint: 'updateMany'
282
- },
283
- status: _common.HttpStatus.FORBIDDEN
284
- });
285
- }
286
- const entities = await this.service.updateMany(updateDtos, user);
287
- const data = entities.map((item)=>toDto(responseDtoClass, item));
288
- return {
289
- success: true,
290
- message: `${data.length} ${entityName}s updated successfully`,
291
- messageKey: `${entityName}.update.many.success`,
292
- messageVariables: {
293
- count: data.length
294
- },
295
- data,
296
- meta: {
297
- count: data.length,
298
- total: updateDtos.length,
299
- failed: updateDtos.length - data.length
300
- }
301
- };
302
- }
303
- async bulkUpsert(dtos, user) {
304
- if (!this.isEnabled('bulkUpsert')) {
305
- throw new _exceptions.BaseAppException({
306
- message: `Endpoint 'bulkUpsert' is disabled`,
307
- messageKey: _messagekeys.ERROR_MESSAGES.ENDPOINT_DISABLED,
308
- messageVariables: {
309
- endpoint: 'bulkUpsert'
310
- },
311
- status: _common.HttpStatus.FORBIDDEN
312
- });
313
- }
314
- const toInsert = [];
315
- const toUpdate = [];
316
- for (const dto of dtos){
317
- if ('id' in dto && dto.id) {
318
- toUpdate.push(dto);
319
- } else {
320
- toInsert.push(dto);
321
- }
322
- }
323
- const allEntities = await this.service.bulkUpsert(toInsert, toUpdate, user);
324
- const data = allEntities.map((item)=>toDto(responseDtoClass, item));
325
- return {
326
- success: true,
327
- message: `${data.length} ${entityName}s upserted successfully`,
328
- messageKey: `${entityName}.upsert.many.success`,
329
- messageVariables: {
330
- count: data.length
331
- },
332
- data,
333
- meta: {
334
- count: data.length,
335
- total: dtos.length,
336
- failed: dtos.length - data.length
337
- }
338
- };
339
- }
340
- async getByFilter(filter, user) {
341
- if (!this.isEnabled('getByFilter')) {
342
- throw new _exceptions.BaseAppException({
343
- message: `Endpoint 'getByFilter' is disabled`,
344
- messageKey: _messagekeys.ERROR_MESSAGES.ENDPOINT_DISABLED,
345
- messageVariables: {
346
- endpoint: 'getByFilter'
347
- },
348
- status: _common.HttpStatus.FORBIDDEN
349
- });
350
- }
351
- const result = await this.service.getAll('', {
352
- filter,
353
- pagination: {
354
- currentPage: 0,
355
- pageSize: 1
356
- }
357
- }, user);
358
- if (!result.data || result.data.length === 0) {
359
- throw new _exceptions.NotFoundException(entityName);
360
- }
361
- const entity = result.data[0];
362
- const data = toDto(responseDtoClass, entity);
363
- return {
364
- success: true,
365
- message: `${entityName.charAt(0).toUpperCase() + entityName.slice(1)} retrieved successfully`,
366
- messageKey: `${entityName}.get.by.filter.success`,
367
- data
368
- };
369
- }
370
- async getAll(filterAndPaginationDto, user, search) {
371
- if (!this.isEnabled('getAll')) {
372
- throw new _exceptions.BaseAppException({
373
- message: `Endpoint 'getAll' is disabled`,
374
- messageKey: _messagekeys.ERROR_MESSAGES.ENDPOINT_DISABLED,
375
- messageVariables: {
376
- endpoint: 'getAll'
377
- },
378
- status: _common.HttpStatus.FORBIDDEN
379
- });
380
- }
381
- const result = await this.service.getAll(search ?? '', filterAndPaginationDto, user);
382
- const data = result.data.map((item)=>toDto(responseDtoClass, item));
383
- const page = filterAndPaginationDto.pagination?.currentPage ?? 0;
384
- const pageSize = filterAndPaginationDto.pagination?.pageSize ?? data.length;
385
- const totalPages = pageSize > 0 ? Math.ceil(result.total / pageSize) : 1;
386
- return {
387
- success: true,
388
- message: `${entityName.charAt(0).toUpperCase() + entityName.slice(1)}s retrieved successfully`,
389
- messageKey: `${entityName}.get.all.success`,
390
- data,
391
- meta: {
392
- total: result.total,
393
- page,
394
- pageSize,
395
- count: data.length,
396
- hasMore: page < totalPages - 1,
397
- totalPages
398
- }
399
- };
400
- }
401
- async delete(deleteDto, user) {
402
- if (!this.isEnabled('delete')) {
403
- throw new _exceptions.BaseAppException({
404
- message: `Endpoint 'delete' is disabled`,
405
- messageKey: _messagekeys.ERROR_MESSAGES.ENDPOINT_DISABLED,
406
- messageVariables: {
407
- endpoint: 'delete'
408
- },
409
- status: _common.HttpStatus.FORBIDDEN
410
- });
411
- }
412
- await this.service.delete(deleteDto, user);
413
- const count = Array.isArray(deleteDto.id) ? deleteDto.id.length : 1;
414
- const action = deleteDto.type === 'restore' ? 'restore' : 'delete';
415
- return {
416
- success: true,
417
- message: `${count} ${entityName}${count > 1 ? 's' : ''} ${action}d successfully`,
418
- messageKey: `${entityName}.${action}.success`,
419
- messageVariables: {
420
- count
421
- }
422
- };
423
- }
424
- constructor(service){
425
- _define_property(this, "service", void 0);
426
- _define_property(this, "enabledEndpoints", void 0);
427
- this.service = service;
428
- this.enabledEndpoints = options.enabledEndpoints ?? 'all';
429
- }
430
- };
431
- _ts_decorate([
432
- createEndpointDecorators(security.insert, 'insert', options.enabledEndpoints),
433
- (0, _common.Version)(_common.VERSION_NEUTRAL),
434
- (0, _common.Post)('insert'),
435
- (0, _common.HttpCode)(_common.HttpStatus.CREATED),
436
- (0, _swagger.ApiOperation)({
437
- summary: 'Insert one item',
438
- description: 'Creates a new item. Supports idempotency via X-Idempotency-Key header.'
439
- }),
440
- (0, _swagger.ApiHeader)({
441
- name: 'X-Idempotency-Key',
442
- required: false,
443
- description: 'Unique key to prevent duplicate submissions (recommended for production)'
444
- }),
445
- (0, _apiresponsedecorator.ApiResponseDto)(responseDtoClass),
446
- (0, _swagger.ApiBody)({
447
- type: createDtoClass
448
- }),
449
- (0, _common.UseInterceptors)(_interceptors.IdempotencyInterceptor, _interceptors.SetCreatedByOnBody, _interceptors.Slug),
450
- _ts_param(0, (0, _common.Body)()),
451
- _ts_param(1, (0, _decorators.CurrentUser)()),
452
- _ts_metadata("design:type", Function),
453
- _ts_metadata("design:paramtypes", [
454
- typeof CreateDtoT === "undefined" ? Object : CreateDtoT,
455
- Object
456
- ]),
457
- _ts_metadata("design:returntype", Promise)
458
- ], ApiController.prototype, "insert", null);
459
- _ts_decorate([
460
- createEndpointDecorators(security.insertMany, 'insertMany', options.enabledEndpoints),
461
- (0, _common.Version)(_common.VERSION_NEUTRAL),
462
- (0, _common.Post)('insert-many'),
463
- (0, _common.HttpCode)(_common.HttpStatus.CREATED),
464
- (0, _swagger.ApiOperation)({
465
- summary: 'Insert multiple items',
466
- description: 'Creates multiple items in a single request. Supports idempotency.'
467
- }),
468
- (0, _swagger.ApiHeader)({
469
- name: 'X-Idempotency-Key',
470
- required: false,
471
- description: 'Unique key to prevent duplicate submissions'
472
- }),
473
- (0, _apiresponsedecorator.ApiResponseDto)(responseDtoClass, true, 'bulk'),
474
- (0, _swagger.ApiBody)({
475
- type: createDtoClass,
476
- isArray: true
477
- }),
478
- (0, _common.UseInterceptors)(_interceptors.IdempotencyInterceptor, _interceptors.SetCreatedByOnBody, _interceptors.Slug),
479
- _ts_param(0, (0, _common.Body)()),
480
- _ts_param(1, (0, _decorators.CurrentUser)()),
481
- _ts_metadata("design:type", Function),
482
- _ts_metadata("design:paramtypes", [
483
- Array,
484
- Object
485
- ]),
486
- _ts_metadata("design:returntype", Promise)
487
- ], ApiController.prototype, "insertMany", null);
488
- _ts_decorate([
489
- createEndpointDecorators(security.getById, 'getById', options.enabledEndpoints),
490
- (0, _common.Version)(_common.VERSION_NEUTRAL),
491
- (0, _common.Post)('get/:id'),
492
- (0, _common.HttpCode)(_common.HttpStatus.OK),
493
- (0, _swagger.ApiOperation)({
494
- summary: 'Get item by ID',
495
- description: 'Retrieves a single item by ID. Optionally specify fields to select and relations to include.'
496
- }),
497
- (0, _swagger.ApiParam)({
498
- name: 'id',
499
- type: String,
500
- description: 'UUID of the item'
501
- }),
502
- (0, _swagger.ApiBody)({
503
- type: _dtos.GetByIdBodyDto,
504
- required: false
505
- }),
506
- (0, _apiresponsedecorator.ApiResponseDto)(responseDtoClass),
507
- _ts_param(0, (0, _common.Param)('id')),
508
- _ts_param(1, (0, _common.Body)()),
509
- _ts_param(2, (0, _decorators.CurrentUser)()),
510
- _ts_metadata("design:type", Function),
511
- _ts_metadata("design:paramtypes", [
512
- String,
513
- typeof _dtos.GetByIdBodyDto === "undefined" ? Object : _dtos.GetByIdBodyDto,
514
- Object
515
- ]),
516
- _ts_metadata("design:returntype", Promise)
517
- ], ApiController.prototype, "getById", null);
518
- _ts_decorate([
519
- createEndpointDecorators(security.getByIds, 'getByIds', options.enabledEndpoints),
520
- (0, _common.Version)(_common.VERSION_NEUTRAL),
521
- (0, _common.Post)('get-by-ids'),
522
- (0, _common.HttpCode)(_common.HttpStatus.OK),
523
- (0, _swagger.ApiOperation)({
524
- summary: 'Get items by IDs',
525
- description: 'Retrieves multiple items by their IDs. Optionally specify fields to select.'
526
- }),
527
- (0, _swagger.ApiBody)({
528
- type: _dtos.GetByIdsDto
529
- }),
530
- (0, _apiresponsedecorator.ApiResponseDto)(responseDtoClass, true, 'list'),
531
- _ts_param(0, (0, _common.Body)()),
532
- _ts_param(1, (0, _decorators.CurrentUser)()),
533
- _ts_metadata("design:type", Function),
534
- _ts_metadata("design:paramtypes", [
535
- typeof _dtos.GetByIdsDto === "undefined" ? Object : _dtos.GetByIdsDto,
536
- Object
537
- ]),
538
- _ts_metadata("design:returntype", Promise)
539
- ], ApiController.prototype, "getByIds", null);
540
- _ts_decorate([
541
- createEndpointDecorators(security.update, 'update', options.enabledEndpoints),
542
- (0, _common.Version)(_common.VERSION_NEUTRAL),
543
- (0, _common.Post)('update'),
544
- (0, _common.HttpCode)(_common.HttpStatus.OK),
545
- (0, _swagger.ApiOperation)({
546
- summary: 'Update one item',
547
- description: 'Updates an existing item. ID must be included in the body.'
548
- }),
549
- (0, _apiresponsedecorator.ApiResponseDto)(responseDtoClass),
550
- (0, _swagger.ApiBody)({
551
- type: updateDtoClass
552
- }),
553
- (0, _common.UseInterceptors)(_interceptors.SetUpdateByOnBody, _interceptors.Slug),
554
- _ts_param(0, (0, _common.Body)()),
555
- _ts_param(1, (0, _decorators.CurrentUser)()),
556
- _ts_metadata("design:type", Function),
557
- _ts_metadata("design:paramtypes", [
558
- typeof UpdateDtoT === "undefined" ? Object : UpdateDtoT,
559
- Object
560
- ]),
561
- _ts_metadata("design:returntype", Promise)
562
- ], ApiController.prototype, "update", null);
563
- _ts_decorate([
564
- createEndpointDecorators(security.updateMany, 'updateMany', options.enabledEndpoints),
565
- (0, _common.Version)(_common.VERSION_NEUTRAL),
566
- (0, _common.Post)('update-many'),
567
- (0, _common.HttpCode)(_common.HttpStatus.OK),
568
- (0, _swagger.ApiOperation)({
569
- summary: 'Update multiple items',
570
- description: 'Updates multiple items in a single request. Each item must include an ID.'
571
- }),
572
- (0, _apiresponsedecorator.ApiResponseDto)(responseDtoClass, true, 'bulk'),
573
- (0, _swagger.ApiBody)({
574
- type: updateDtoClass,
575
- isArray: true
576
- }),
577
- (0, _common.UseInterceptors)(_interceptors.SetUpdateByOnBody, _interceptors.Slug),
578
- _ts_param(0, (0, _common.Body)()),
579
- _ts_param(1, (0, _decorators.CurrentUser)()),
580
- _ts_metadata("design:type", Function),
581
- _ts_metadata("design:paramtypes", [
582
- Array,
583
- Object
584
- ]),
585
- _ts_metadata("design:returntype", Promise)
586
- ], ApiController.prototype, "updateMany", null);
587
- _ts_decorate([
588
- createEndpointDecorators(security.bulkUpsert, 'bulkUpsert', options.enabledEndpoints),
589
- (0, _common.Version)(_common.VERSION_NEUTRAL),
590
- (0, _common.Post)('bulk-upsert'),
591
- (0, _common.HttpCode)(_common.HttpStatus.OK),
592
- (0, _swagger.ApiOperation)({
593
- summary: 'Create or update multiple items',
594
- description: 'Bulk upsert: items without ID are created, items with ID are updated.'
595
- }),
596
- (0, _apiresponsedecorator.ApiResponseDto)(responseDtoClass, true, 'bulk'),
597
- (0, _swagger.ApiBody)({
598
- type: createDtoClass,
599
- isArray: true
600
- }),
601
- (0, _common.UseInterceptors)(_interceptors.SetCreatedByOnBody, _interceptors.SetUpdateByOnBody, _interceptors.Slug),
602
- _ts_param(0, (0, _common.Body)()),
603
- _ts_param(1, (0, _decorators.CurrentUser)()),
604
- _ts_metadata("design:type", Function),
605
- _ts_metadata("design:paramtypes", [
606
- Array,
607
- Object
608
- ]),
609
- _ts_metadata("design:returntype", Promise)
610
- ], ApiController.prototype, "bulkUpsert", null);
611
- _ts_decorate([
612
- createEndpointDecorators(security.getByFilter, 'getByFilter', options.enabledEndpoints),
613
- (0, _common.Version)(_common.VERSION_NEUTRAL),
614
- (0, _common.Post)('get-by-filter'),
615
- (0, _common.HttpCode)(_common.HttpStatus.OK),
616
- (0, _swagger.ApiOperation)({
617
- summary: 'Get single item by filter',
618
- description: 'Retrieves a single item matching the provided filter criteria. Returns first match if multiple exist.'
619
- }),
620
- (0, _swagger.ApiBody)({
621
- schema: {
622
- type: 'object',
623
- description: 'Filter criteria'
624
- }
625
- }),
626
- (0, _apiresponsedecorator.ApiResponseDto)(responseDtoClass),
627
- _ts_param(0, (0, _common.Body)()),
628
- _ts_param(1, (0, _decorators.CurrentUser)()),
629
- _ts_metadata("design:type", Function),
630
- _ts_metadata("design:paramtypes", [
631
- typeof Record === "undefined" ? Object : Record,
632
- Object
633
- ]),
634
- _ts_metadata("design:returntype", Promise)
635
- ], ApiController.prototype, "getByFilter", null);
636
- _ts_decorate([
637
- createEndpointDecorators(security.getAll, 'getAll', options.enabledEndpoints),
638
- (0, _common.Version)(_common.VERSION_NEUTRAL),
639
- (0, _common.Post)('get-all'),
640
- (0, _common.HttpCode)(_common.HttpStatus.OK),
641
- (0, _swagger.ApiOperation)({
642
- summary: 'Get all items with filters and pagination',
643
- description: 'Supports filter, pagination, sort, select, withDeleted, and q (search) params'
644
- }),
645
- (0, _swagger.ApiQuery)({
646
- name: 'q',
647
- required: false,
648
- description: 'Global text search across searchable fields'
649
- }),
650
- (0, _swagger.ApiBody)({
651
- type: _dtos.FilterAndPaginationDto
652
- }),
653
- (0, _apiresponsedecorator.ApiResponseDto)(responseDtoClass, true, 'list'),
654
- _ts_param(0, (0, _common.Body)()),
655
- _ts_param(1, (0, _decorators.CurrentUser)()),
656
- _ts_param(2, (0, _common.Query)('q')),
657
- _ts_metadata("design:type", Function),
658
- _ts_metadata("design:paramtypes", [
659
- typeof _dtos.FilterAndPaginationDto === "undefined" ? Object : _dtos.FilterAndPaginationDto,
660
- Object,
661
- String
662
- ]),
663
- _ts_metadata("design:returntype", Promise)
664
- ], ApiController.prototype, "getAll", null);
665
- _ts_decorate([
666
- createEndpointDecorators(security.delete, 'delete', options.enabledEndpoints),
667
- (0, _common.Version)(_common.VERSION_NEUTRAL),
668
- (0, _common.Post)('delete'),
669
- (0, _common.HttpCode)(_common.HttpStatus.OK),
670
- (0, _swagger.ApiOperation)({
671
- summary: 'Delete, restore, or permanently remove items',
672
- description: 'Types: delete (soft), restore, permanent. Supports batch IDs.'
673
- }),
674
- (0, _swagger.ApiResponse)({
675
- status: 200,
676
- description: 'Operation completed successfully',
677
- schema: {
678
- example: {
679
- success: true,
680
- message: '3 items deleted successfully'
681
- }
682
- }
683
- }),
684
- (0, _swagger.ApiBody)({
685
- type: _dtos.DeleteDto,
686
- examples: {
687
- softDelete: {
688
- summary: 'Soft delete',
689
- value: {
690
- id: [
691
- 'uuid-1',
692
- 'uuid-2'
693
- ],
694
- type: 'delete'
695
- }
696
- },
697
- restore: {
698
- summary: 'Restore deleted',
699
- value: {
700
- id: [
701
- 'uuid-1'
702
- ],
703
- type: 'restore'
704
- }
705
- },
706
- permanent: {
707
- summary: 'Permanent delete',
708
- value: {
709
- id: [
710
- 'uuid-1'
711
- ],
712
- type: 'permanent'
713
- }
714
- }
715
- }
716
- }),
717
- (0, _common.UseInterceptors)(_interceptors.SetDeletedByOnBody),
718
- _ts_param(0, (0, _common.Body)()),
719
- _ts_param(1, (0, _decorators.CurrentUser)()),
720
- _ts_metadata("design:type", Function),
721
- _ts_metadata("design:paramtypes", [
722
- typeof _dtos.DeleteDto === "undefined" ? Object : _dtos.DeleteDto,
723
- Object
724
- ]),
725
- _ts_metadata("design:returntype", Promise)
726
- ], ApiController.prototype, "delete", null);
727
- return ApiController;
728
- }