@elsikora/nestjs-crud-automator 1.10.0-dev.1 → 1.10.1-dev.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 (370) hide show
  1. package/README.md +193 -0
  2. package/dist/cjs/class/api/subscriber/discovery-service.class.js +4 -0
  3. package/dist/cjs/class/api/subscriber/discovery-service.class.js.map +1 -1
  4. package/dist/cjs/class/api/subscriber/executor.class.d.ts +8 -8
  5. package/dist/cjs/class/api/subscriber/executor.class.js +3 -3
  6. package/dist/cjs/class/api/subscriber/executor.class.js.map +1 -1
  7. package/dist/cjs/class/api/subscriber/registry.class.d.ts +3 -3
  8. package/dist/cjs/class/api/subscriber/registry.class.js +11 -11
  9. package/dist/cjs/class/api/subscriber/registry.class.js.map +1 -1
  10. package/dist/cjs/constant/date.constant.js.map +1 -1
  11. package/dist/cjs/constant/decorator/api/controller.constant.js.map +1 -1
  12. package/dist/cjs/constant/decorator/api/function.constant.js.map +1 -1
  13. package/dist/cjs/constant/decorator/api/property-describe.constant.js.map +1 -1
  14. package/dist/cjs/constant/decorator/api/service.constant.js.map +1 -1
  15. package/dist/cjs/constant/decorator/api/subscriber.constant.js.map +1 -1
  16. package/dist/cjs/constant/dto/exception.constant.js.map +1 -1
  17. package/dist/cjs/constant/dto/list.constant.js.map +1 -1
  18. package/dist/cjs/constant/dto/transformer-value.constant.js.map +1 -1
  19. package/dist/cjs/constant/factory/dto/get-list-query.constant.js.map +1 -1
  20. package/dist/cjs/constant/interface/api/filter.constant.js.map +1 -1
  21. package/dist/cjs/constant/interface/api/property/string.constant.js.map +1 -1
  22. package/dist/cjs/constant/interface/api/property/wallet.constant.js.map +1 -1
  23. package/dist/cjs/constant/number.constant.js.map +1 -1
  24. package/dist/cjs/constant/utility/dto/constant.d.ts +1 -1
  25. package/dist/cjs/constant/utility/dto/constant.js.map +1 -1
  26. package/dist/cjs/constant/utility/dto/generate.constant.js.map +1 -1
  27. package/dist/cjs/constant/validator/has-paired-custom-suffixes-fields.constant.js +2 -1
  28. package/dist/cjs/constant/validator/has-paired-custom-suffixes-fields.constant.js.map +1 -1
  29. package/dist/cjs/decorator/api/controller/observable.decorator.d.ts +3 -1
  30. package/dist/cjs/decorator/api/controller/observable.decorator.js +3 -1
  31. package/dist/cjs/decorator/api/controller/observable.decorator.js.map +1 -1
  32. package/dist/cjs/decorator/api/controller.decorator.d.ts +2 -1
  33. package/dist/cjs/decorator/api/controller.decorator.js +2 -1
  34. package/dist/cjs/decorator/api/controller.decorator.js.map +1 -1
  35. package/dist/cjs/decorator/api/function/create.decorator.d.ts +1 -0
  36. package/dist/cjs/decorator/api/function/create.decorator.js +12 -10
  37. package/dist/cjs/decorator/api/function/create.decorator.js.map +1 -1
  38. package/dist/cjs/decorator/api/function/decorator.js +1 -0
  39. package/dist/cjs/decorator/api/function/decorator.js.map +1 -1
  40. package/dist/cjs/decorator/api/function/delete.decorator.d.ts +2 -5
  41. package/dist/cjs/decorator/api/function/delete.decorator.js +13 -15
  42. package/dist/cjs/decorator/api/function/delete.decorator.js.map +1 -1
  43. package/dist/cjs/decorator/api/function/get-list.decorator.d.ts +2 -5
  44. package/dist/cjs/decorator/api/function/get-list.decorator.js +30 -16
  45. package/dist/cjs/decorator/api/function/get-list.decorator.js.map +1 -1
  46. package/dist/cjs/decorator/api/function/get-many.decorator.d.ts +2 -5
  47. package/dist/cjs/decorator/api/function/get-many.decorator.js +13 -15
  48. package/dist/cjs/decorator/api/function/get-many.decorator.js.map +1 -1
  49. package/dist/cjs/decorator/api/function/get.decorator.d.ts +2 -5
  50. package/dist/cjs/decorator/api/function/get.decorator.js +13 -15
  51. package/dist/cjs/decorator/api/function/get.decorator.js.map +1 -1
  52. package/dist/cjs/decorator/api/function/update.decorator.d.ts +2 -5
  53. package/dist/cjs/decorator/api/function/update.decorator.js +13 -15
  54. package/dist/cjs/decorator/api/function/update.decorator.js.map +1 -1
  55. package/dist/cjs/decorator/api/method.decorator.js.map +1 -1
  56. package/dist/cjs/decorator/api/property/boolean.decorator.js +2 -0
  57. package/dist/cjs/decorator/api/property/boolean.decorator.js.map +1 -1
  58. package/dist/cjs/decorator/api/property/copy.decorator.js.map +1 -1
  59. package/dist/cjs/decorator/api/property/date.decorator.js +2 -0
  60. package/dist/cjs/decorator/api/property/date.decorator.js.map +1 -1
  61. package/dist/cjs/decorator/api/property/describe.decorator.d.ts +1 -1
  62. package/dist/cjs/decorator/api/property/describe.decorator.js.map +1 -1
  63. package/dist/cjs/decorator/api/property/enum.decorator.js +2 -0
  64. package/dist/cjs/decorator/api/property/enum.decorator.js.map +1 -1
  65. package/dist/cjs/decorator/api/property/number.decorator.js +4 -0
  66. package/dist/cjs/decorator/api/property/number.decorator.js.map +1 -1
  67. package/dist/cjs/decorator/api/property/object.decorator.js +4 -2
  68. package/dist/cjs/decorator/api/property/object.decorator.js.map +1 -1
  69. package/dist/cjs/decorator/api/property/string.decorator.js +21 -3
  70. package/dist/cjs/decorator/api/property/string.decorator.js.map +1 -1
  71. package/dist/cjs/decorator/api/property/uuid.decorator.js +2 -0
  72. package/dist/cjs/decorator/api/property/uuid.decorator.js.map +1 -1
  73. package/dist/cjs/decorator/api/service/observable.decorator.d.ts +3 -1
  74. package/dist/cjs/decorator/api/service/observable.decorator.js +3 -1
  75. package/dist/cjs/decorator/api/service/observable.decorator.js.map +1 -1
  76. package/dist/cjs/decorator/api/service.decorator.js +39 -0
  77. package/dist/cjs/decorator/api/service.decorator.js.map +1 -1
  78. package/dist/cjs/decorator/api/subscriber/function.decorator.d.ts +23 -5
  79. package/dist/cjs/decorator/api/subscriber/function.decorator.js +21 -3
  80. package/dist/cjs/decorator/api/subscriber/function.decorator.js.map +1 -1
  81. package/dist/cjs/decorator/api/subscriber/route.decorator.d.ts +23 -5
  82. package/dist/cjs/decorator/api/subscriber/route.decorator.js +21 -3
  83. package/dist/cjs/decorator/api/subscriber/route.decorator.js.map +1 -1
  84. package/dist/cjs/enum/decorator/api/action.enum.js.map +1 -1
  85. package/dist/cjs/enum/decorator/api/authentication-type.enum.js.map +1 -1
  86. package/dist/cjs/enum/decorator/api/controller/load-relations-strategy.enum.js.map +1 -1
  87. package/dist/cjs/enum/decorator/api/controller/request-transformer-type.enum.js.map +1 -1
  88. package/dist/cjs/enum/decorator/api/dto-type.enum.js.map +1 -1
  89. package/dist/cjs/enum/decorator/api/function/type.enum.js.map +1 -1
  90. package/dist/cjs/enum/decorator/api/on-type.enum.js.map +1 -1
  91. package/dist/cjs/enum/decorator/api/property/data-type.enum.js.map +1 -1
  92. package/dist/cjs/enum/decorator/api/property/date/identifier.enum.js.map +1 -1
  93. package/dist/cjs/enum/decorator/api/property/date/type.enum.js.map +1 -1
  94. package/dist/cjs/enum/decorator/api/property/desribe-type.enum.js.map +1 -1
  95. package/dist/cjs/enum/decorator/api/property/number-type.enum.js.map +1 -1
  96. package/dist/cjs/enum/decorator/api/property/string-type.enum.js.map +1 -1
  97. package/dist/cjs/enum/decorator/api/route-type.enum.js.map +1 -1
  98. package/dist/cjs/enum/exception.enum.js.map +1 -1
  99. package/dist/cjs/enum/filter-operation.enum.js.map +1 -1
  100. package/dist/cjs/enum/filter-order-direction.enum.js.map +1 -1
  101. package/dist/cjs/enum/utility/error-string/action.enum.js.map +1 -1
  102. package/dist/cjs/enum/utility/error-string/composite-action.enum.js.map +1 -1
  103. package/dist/cjs/enum/validator/has-paired-custom-suffixes-fields-argument-type.enum.js.map +1 -1
  104. package/dist/cjs/enum/validator/must-match-one-of-schemas-error-type.enum.js.map +1 -1
  105. package/dist/cjs/factory/api/controller.factory.js +23 -18
  106. package/dist/cjs/factory/api/controller.factory.js.map +1 -1
  107. package/dist/cjs/interceptor/correlation-id-response-body.interceptor.d.ts +1 -1
  108. package/dist/cjs/interceptor/correlation-id-response-body.interceptor.js.map +1 -1
  109. package/dist/cjs/interface/api-dto-validator.interface.d.ts +1 -1
  110. package/dist/cjs/interface/class/api/subscriber/execution-context.interface.d.ts +2 -2
  111. package/dist/cjs/interface/class/api/subscriber/function-execution-context.interface.d.ts +1 -1
  112. package/dist/cjs/interface/class/api/subscriber/function.interface.d.ts +1 -1
  113. package/dist/cjs/interface/class/api/subscriber/index.d.ts +6 -0
  114. package/dist/cjs/interface/class/api/subscriber/route-execution-context.interface.d.ts +1 -1
  115. package/dist/cjs/interface/class/api/subscriber/route.interface.d.ts +0 -1
  116. package/dist/cjs/interface/decorator/api/function/create-executor-properties.interface.d.ts +2 -2
  117. package/dist/cjs/interface/decorator/api/function/delete-executor-properties.interface.d.ts +2 -2
  118. package/dist/cjs/interface/decorator/api/function/get-executor-properties.interface.d.ts +2 -2
  119. package/dist/cjs/interface/decorator/api/function/get-list-executor-properties.interface.d.ts +2 -2
  120. package/dist/cjs/interface/decorator/api/function/get-many-executor-properties.interface.d.ts +2 -2
  121. package/dist/cjs/interface/decorator/api/function/properties.interface.d.ts +1 -1
  122. package/dist/cjs/interface/decorator/api/function/update-executor-properties.interface.d.ts +2 -2
  123. package/dist/cjs/interface/decorator/api/index.d.ts +6 -6
  124. package/dist/cjs/interface/decorator/api/subscriber/function-properties.interface.d.ts +1 -1
  125. package/dist/cjs/interface/decorator/api/subscriber/index.d.ts +2 -2
  126. package/dist/cjs/interface/decorator/api/subscriber/route-properties.interface.d.ts +1 -1
  127. package/dist/cjs/interface/entity/column.interface.d.ts +1 -1
  128. package/dist/cjs/type/decorator/api/controller/constructor.type.d.ts +2 -2
  129. package/dist/cjs/type/decorator/api/property/describe/enum-properties.type.d.ts +1 -1
  130. package/dist/cjs/type/decorator/api/property/object/with-discriminator-properties.type.d.ts +1 -1
  131. package/dist/cjs/type/decorator/api/service/keys.type.d.ts +1 -1
  132. package/dist/cjs/type/factory/api/controller/target-methods.type.d.ts +1 -1
  133. package/dist/cjs/type/utility/dto/generate-get-list-response-resource-class.type.d.ts +1 -0
  134. package/dist/cjs/type/utility/dto/index.d.ts +1 -0
  135. package/dist/cjs/utility/api/controller/apply-decorators.utility.d.ts +2 -1
  136. package/dist/cjs/utility/api/controller/apply-decorators.utility.js.map +1 -1
  137. package/dist/cjs/utility/api/controller/apply-metadata.utility.js.map +1 -1
  138. package/dist/cjs/utility/api/controller/get-list/transform-filter.utility.d.ts +1 -1
  139. package/dist/cjs/utility/api/controller/get-list/transform-filter.utility.js +0 -1
  140. package/dist/cjs/utility/api/controller/get-list/transform-filter.utility.js.map +1 -1
  141. package/dist/cjs/utility/api/controller/get-list/transform-operation.utility.d.ts +1 -6
  142. package/dist/cjs/utility/api/controller/get-list/transform-operation.utility.js +0 -5
  143. package/dist/cjs/utility/api/controller/get-list/transform-operation.utility.js.map +1 -1
  144. package/dist/cjs/utility/api/controller/get-method-name.utility.js.map +1 -1
  145. package/dist/cjs/utility/api/controller/get-primary-column.utility.js.map +1 -1
  146. package/dist/cjs/utility/api/controller/handle-request-relations.utility.js.map +1 -1
  147. package/dist/cjs/utility/api/controller/write-dto-swagger.utility.js +3 -0
  148. package/dist/cjs/utility/api/controller/write-dto-swagger.utility.js.map +1 -1
  149. package/dist/cjs/utility/api/filter-order-by-from-entity.utility.js +0 -1
  150. package/dist/cjs/utility/api/filter-order-by-from-entity.utility.js.map +1 -1
  151. package/dist/cjs/utility/dto/build-decorator.utility.js.map +1 -1
  152. package/dist/cjs/utility/dto/generate-decorator.utility.js.map +1 -1
  153. package/dist/cjs/utility/dto/generate-dynamic.utility.js +3 -0
  154. package/dist/cjs/utility/dto/generate-dynamic.utility.js.map +1 -1
  155. package/dist/cjs/utility/dto/generate-exception.utility.js.map +1 -1
  156. package/dist/cjs/utility/dto/generate-filter-decorator.utility.js.map +1 -1
  157. package/dist/cjs/utility/dto/generate-get-list-response.utility.d.ts +4 -5
  158. package/dist/cjs/utility/dto/generate-get-list-response.utility.js +2 -2
  159. package/dist/cjs/utility/dto/generate-get-list-response.utility.js.map +1 -1
  160. package/dist/cjs/utility/dto/generate-relation-response.utility.js.map +1 -1
  161. package/dist/cjs/utility/dto/generate.utility.js +15 -0
  162. package/dist/cjs/utility/dto/generate.utility.js.map +1 -1
  163. package/dist/cjs/utility/dto/get-get-list-query-base-class.utility.js.map +1 -1
  164. package/dist/cjs/utility/dto/handle-date-property.utility.js.map +1 -1
  165. package/dist/cjs/utility/dto/is-property-should-be-marked.utility.js.map +1 -1
  166. package/dist/cjs/utility/dto/validate-property-config.utility.js.map +1 -1
  167. package/dist/cjs/utility/generate-entity-information.utility.js.map +1 -1
  168. package/dist/cjs/utility/is-error-of-type.utility.js.map +1 -1
  169. package/dist/cjs/utility/logger.utility.js +3 -5
  170. package/dist/cjs/utility/logger.utility.js.map +1 -1
  171. package/dist/cjs/validator/all-or-none-of-listed-properties.validator.js +1 -0
  172. package/dist/cjs/validator/all-or-none-of-listed-properties.validator.js.map +1 -1
  173. package/dist/cjs/validator/has-at-least-one-and-only-one-of-listed-properties.validator.js +1 -0
  174. package/dist/cjs/validator/has-at-least-one-and-only-one-of-listed-properties.validator.js.map +1 -1
  175. package/dist/cjs/validator/has-at-least-one-of-listed-properties.validator.js +1 -0
  176. package/dist/cjs/validator/has-at-least-one-of-listed-properties.validator.js.map +1 -1
  177. package/dist/cjs/validator/has-at-least-one-property.validator.js +1 -0
  178. package/dist/cjs/validator/has-at-least-one-property.validator.js.map +1 -1
  179. package/dist/cjs/validator/has-paired-custom-suffixes-fields.validator.js +1 -0
  180. package/dist/cjs/validator/has-paired-custom-suffixes-fields.validator.js.map +1 -1
  181. package/dist/cjs/validator/must-match-one-of-schemas.validator.js +1 -0
  182. package/dist/cjs/validator/must-match-one-of-schemas.validator.js.map +1 -1
  183. package/dist/cjs/validator/only-one-of-listed-properties.validator.js +1 -0
  184. package/dist/cjs/validator/only-one-of-listed-properties.validator.js.map +1 -1
  185. package/dist/esm/class/api/subscriber/discovery-service.class.js +4 -0
  186. package/dist/esm/class/api/subscriber/discovery-service.class.js.map +1 -1
  187. package/dist/esm/class/api/subscriber/executor.class.d.ts +8 -8
  188. package/dist/esm/class/api/subscriber/executor.class.js +3 -3
  189. package/dist/esm/class/api/subscriber/executor.class.js.map +1 -1
  190. package/dist/esm/class/api/subscriber/registry.class.d.ts +3 -3
  191. package/dist/esm/class/api/subscriber/registry.class.js +11 -11
  192. package/dist/esm/class/api/subscriber/registry.class.js.map +1 -1
  193. package/dist/esm/constant/date.constant.js.map +1 -1
  194. package/dist/esm/constant/decorator/api/controller.constant.js.map +1 -1
  195. package/dist/esm/constant/decorator/api/function.constant.js.map +1 -1
  196. package/dist/esm/constant/decorator/api/property-describe.constant.js.map +1 -1
  197. package/dist/esm/constant/decorator/api/service.constant.js.map +1 -1
  198. package/dist/esm/constant/decorator/api/subscriber.constant.js.map +1 -1
  199. package/dist/esm/constant/dto/exception.constant.js.map +1 -1
  200. package/dist/esm/constant/dto/list.constant.js.map +1 -1
  201. package/dist/esm/constant/dto/transformer-value.constant.js.map +1 -1
  202. package/dist/esm/constant/factory/dto/get-list-query.constant.js.map +1 -1
  203. package/dist/esm/constant/interface/api/filter.constant.js.map +1 -1
  204. package/dist/esm/constant/interface/api/property/string.constant.js.map +1 -1
  205. package/dist/esm/constant/interface/api/property/wallet.constant.js.map +1 -1
  206. package/dist/esm/constant/number.constant.js.map +1 -1
  207. package/dist/esm/constant/utility/dto/constant.d.ts +1 -1
  208. package/dist/esm/constant/utility/dto/constant.js.map +1 -1
  209. package/dist/esm/constant/utility/dto/generate.constant.js.map +1 -1
  210. package/dist/esm/constant/validator/has-paired-custom-suffixes-fields.constant.js +2 -1
  211. package/dist/esm/constant/validator/has-paired-custom-suffixes-fields.constant.js.map +1 -1
  212. package/dist/esm/decorator/api/controller/observable.decorator.d.ts +3 -1
  213. package/dist/esm/decorator/api/controller/observable.decorator.js +3 -1
  214. package/dist/esm/decorator/api/controller/observable.decorator.js.map +1 -1
  215. package/dist/esm/decorator/api/controller.decorator.d.ts +2 -1
  216. package/dist/esm/decorator/api/controller.decorator.js +2 -1
  217. package/dist/esm/decorator/api/controller.decorator.js.map +1 -1
  218. package/dist/esm/decorator/api/function/create.decorator.d.ts +1 -0
  219. package/dist/esm/decorator/api/function/create.decorator.js +12 -10
  220. package/dist/esm/decorator/api/function/create.decorator.js.map +1 -1
  221. package/dist/esm/decorator/api/function/decorator.js +1 -0
  222. package/dist/esm/decorator/api/function/decorator.js.map +1 -1
  223. package/dist/esm/decorator/api/function/delete.decorator.d.ts +2 -5
  224. package/dist/esm/decorator/api/function/delete.decorator.js +13 -15
  225. package/dist/esm/decorator/api/function/delete.decorator.js.map +1 -1
  226. package/dist/esm/decorator/api/function/get-list.decorator.d.ts +2 -5
  227. package/dist/esm/decorator/api/function/get-list.decorator.js +30 -16
  228. package/dist/esm/decorator/api/function/get-list.decorator.js.map +1 -1
  229. package/dist/esm/decorator/api/function/get-many.decorator.d.ts +2 -5
  230. package/dist/esm/decorator/api/function/get-many.decorator.js +13 -15
  231. package/dist/esm/decorator/api/function/get-many.decorator.js.map +1 -1
  232. package/dist/esm/decorator/api/function/get.decorator.d.ts +2 -5
  233. package/dist/esm/decorator/api/function/get.decorator.js +13 -15
  234. package/dist/esm/decorator/api/function/get.decorator.js.map +1 -1
  235. package/dist/esm/decorator/api/function/update.decorator.d.ts +2 -5
  236. package/dist/esm/decorator/api/function/update.decorator.js +13 -15
  237. package/dist/esm/decorator/api/function/update.decorator.js.map +1 -1
  238. package/dist/esm/decorator/api/method.decorator.js.map +1 -1
  239. package/dist/esm/decorator/api/property/boolean.decorator.js +2 -0
  240. package/dist/esm/decorator/api/property/boolean.decorator.js.map +1 -1
  241. package/dist/esm/decorator/api/property/copy.decorator.js.map +1 -1
  242. package/dist/esm/decorator/api/property/date.decorator.js +2 -0
  243. package/dist/esm/decorator/api/property/date.decorator.js.map +1 -1
  244. package/dist/esm/decorator/api/property/describe.decorator.d.ts +1 -1
  245. package/dist/esm/decorator/api/property/describe.decorator.js.map +1 -1
  246. package/dist/esm/decorator/api/property/enum.decorator.js +2 -0
  247. package/dist/esm/decorator/api/property/enum.decorator.js.map +1 -1
  248. package/dist/esm/decorator/api/property/number.decorator.js +4 -0
  249. package/dist/esm/decorator/api/property/number.decorator.js.map +1 -1
  250. package/dist/esm/decorator/api/property/object.decorator.js +4 -2
  251. package/dist/esm/decorator/api/property/object.decorator.js.map +1 -1
  252. package/dist/esm/decorator/api/property/string.decorator.js +21 -3
  253. package/dist/esm/decorator/api/property/string.decorator.js.map +1 -1
  254. package/dist/esm/decorator/api/property/uuid.decorator.js +2 -0
  255. package/dist/esm/decorator/api/property/uuid.decorator.js.map +1 -1
  256. package/dist/esm/decorator/api/service/observable.decorator.d.ts +3 -1
  257. package/dist/esm/decorator/api/service/observable.decorator.js +3 -1
  258. package/dist/esm/decorator/api/service/observable.decorator.js.map +1 -1
  259. package/dist/esm/decorator/api/service.decorator.js +39 -0
  260. package/dist/esm/decorator/api/service.decorator.js.map +1 -1
  261. package/dist/esm/decorator/api/subscriber/function.decorator.d.ts +23 -5
  262. package/dist/esm/decorator/api/subscriber/function.decorator.js +21 -3
  263. package/dist/esm/decorator/api/subscriber/function.decorator.js.map +1 -1
  264. package/dist/esm/decorator/api/subscriber/route.decorator.d.ts +23 -5
  265. package/dist/esm/decorator/api/subscriber/route.decorator.js +21 -3
  266. package/dist/esm/decorator/api/subscriber/route.decorator.js.map +1 -1
  267. package/dist/esm/enum/decorator/api/action.enum.js.map +1 -1
  268. package/dist/esm/enum/decorator/api/authentication-type.enum.js.map +1 -1
  269. package/dist/esm/enum/decorator/api/controller/load-relations-strategy.enum.js.map +1 -1
  270. package/dist/esm/enum/decorator/api/controller/request-transformer-type.enum.js.map +1 -1
  271. package/dist/esm/enum/decorator/api/dto-type.enum.js.map +1 -1
  272. package/dist/esm/enum/decorator/api/function/type.enum.js.map +1 -1
  273. package/dist/esm/enum/decorator/api/on-type.enum.js.map +1 -1
  274. package/dist/esm/enum/decorator/api/property/data-type.enum.js.map +1 -1
  275. package/dist/esm/enum/decorator/api/property/date/identifier.enum.js.map +1 -1
  276. package/dist/esm/enum/decorator/api/property/date/type.enum.js.map +1 -1
  277. package/dist/esm/enum/decorator/api/property/desribe-type.enum.js.map +1 -1
  278. package/dist/esm/enum/decorator/api/property/number-type.enum.js.map +1 -1
  279. package/dist/esm/enum/decorator/api/property/string-type.enum.js.map +1 -1
  280. package/dist/esm/enum/decorator/api/route-type.enum.js.map +1 -1
  281. package/dist/esm/enum/exception.enum.js.map +1 -1
  282. package/dist/esm/enum/filter-operation.enum.js.map +1 -1
  283. package/dist/esm/enum/filter-order-direction.enum.js.map +1 -1
  284. package/dist/esm/enum/utility/error-string/action.enum.js.map +1 -1
  285. package/dist/esm/enum/utility/error-string/composite-action.enum.js.map +1 -1
  286. package/dist/esm/enum/validator/has-paired-custom-suffixes-fields-argument-type.enum.js.map +1 -1
  287. package/dist/esm/enum/validator/must-match-one-of-schemas-error-type.enum.js.map +1 -1
  288. package/dist/esm/factory/api/controller.factory.js +23 -18
  289. package/dist/esm/factory/api/controller.factory.js.map +1 -1
  290. package/dist/esm/interceptor/correlation-id-response-body.interceptor.d.ts +1 -1
  291. package/dist/esm/interceptor/correlation-id-response-body.interceptor.js.map +1 -1
  292. package/dist/esm/interface/api-dto-validator.interface.d.ts +1 -1
  293. package/dist/esm/interface/class/api/subscriber/execution-context.interface.d.ts +2 -2
  294. package/dist/esm/interface/class/api/subscriber/function-execution-context.interface.d.ts +1 -1
  295. package/dist/esm/interface/class/api/subscriber/function.interface.d.ts +1 -1
  296. package/dist/esm/interface/class/api/subscriber/index.d.ts +6 -0
  297. package/dist/esm/interface/class/api/subscriber/route-execution-context.interface.d.ts +1 -1
  298. package/dist/esm/interface/class/api/subscriber/route.interface.d.ts +0 -1
  299. package/dist/esm/interface/decorator/api/function/create-executor-properties.interface.d.ts +2 -2
  300. package/dist/esm/interface/decorator/api/function/delete-executor-properties.interface.d.ts +2 -2
  301. package/dist/esm/interface/decorator/api/function/get-executor-properties.interface.d.ts +2 -2
  302. package/dist/esm/interface/decorator/api/function/get-list-executor-properties.interface.d.ts +2 -2
  303. package/dist/esm/interface/decorator/api/function/get-many-executor-properties.interface.d.ts +2 -2
  304. package/dist/esm/interface/decorator/api/function/properties.interface.d.ts +1 -1
  305. package/dist/esm/interface/decorator/api/function/update-executor-properties.interface.d.ts +2 -2
  306. package/dist/esm/interface/decorator/api/index.d.ts +6 -6
  307. package/dist/esm/interface/decorator/api/subscriber/function-properties.interface.d.ts +1 -1
  308. package/dist/esm/interface/decorator/api/subscriber/index.d.ts +2 -2
  309. package/dist/esm/interface/decorator/api/subscriber/route-properties.interface.d.ts +1 -1
  310. package/dist/esm/interface/entity/column.interface.d.ts +1 -1
  311. package/dist/esm/module/api-subscriber.module.js.map +1 -1
  312. package/dist/esm/type/decorator/api/controller/constructor.type.d.ts +2 -2
  313. package/dist/esm/type/decorator/api/property/describe/enum-properties.type.d.ts +1 -1
  314. package/dist/esm/type/decorator/api/property/object/with-discriminator-properties.type.d.ts +1 -1
  315. package/dist/esm/type/decorator/api/service/keys.type.d.ts +1 -1
  316. package/dist/esm/type/factory/api/controller/target-methods.type.d.ts +1 -1
  317. package/dist/esm/type/utility/dto/generate-get-list-response-resource-class.type.d.ts +1 -0
  318. package/dist/esm/type/utility/dto/index.d.ts +1 -0
  319. package/dist/esm/utility/api/controller/apply-decorators.utility.d.ts +2 -1
  320. package/dist/esm/utility/api/controller/apply-decorators.utility.js.map +1 -1
  321. package/dist/esm/utility/api/controller/apply-metadata.utility.js.map +1 -1
  322. package/dist/esm/utility/api/controller/get-list/transform-filter.utility.d.ts +1 -1
  323. package/dist/esm/utility/api/controller/get-list/transform-filter.utility.js +0 -1
  324. package/dist/esm/utility/api/controller/get-list/transform-filter.utility.js.map +1 -1
  325. package/dist/esm/utility/api/controller/get-list/transform-operation.utility.d.ts +1 -6
  326. package/dist/esm/utility/api/controller/get-list/transform-operation.utility.js +0 -5
  327. package/dist/esm/utility/api/controller/get-list/transform-operation.utility.js.map +1 -1
  328. package/dist/esm/utility/api/controller/get-method-name.utility.js.map +1 -1
  329. package/dist/esm/utility/api/controller/get-primary-column.utility.js.map +1 -1
  330. package/dist/esm/utility/api/controller/handle-request-relations.utility.js.map +1 -1
  331. package/dist/esm/utility/api/controller/write-dto-swagger.utility.js +3 -0
  332. package/dist/esm/utility/api/controller/write-dto-swagger.utility.js.map +1 -1
  333. package/dist/esm/utility/api/filter-order-by-from-entity.utility.js +0 -1
  334. package/dist/esm/utility/api/filter-order-by-from-entity.utility.js.map +1 -1
  335. package/dist/esm/utility/dto/build-decorator.utility.js.map +1 -1
  336. package/dist/esm/utility/dto/generate-decorator.utility.js.map +1 -1
  337. package/dist/esm/utility/dto/generate-dynamic.utility.js +3 -0
  338. package/dist/esm/utility/dto/generate-dynamic.utility.js.map +1 -1
  339. package/dist/esm/utility/dto/generate-exception.utility.js.map +1 -1
  340. package/dist/esm/utility/dto/generate-filter-decorator.utility.js.map +1 -1
  341. package/dist/esm/utility/dto/generate-get-list-response.utility.d.ts +4 -5
  342. package/dist/esm/utility/dto/generate-get-list-response.utility.js +2 -2
  343. package/dist/esm/utility/dto/generate-get-list-response.utility.js.map +1 -1
  344. package/dist/esm/utility/dto/generate-relation-response.utility.js.map +1 -1
  345. package/dist/esm/utility/dto/generate.utility.js +15 -0
  346. package/dist/esm/utility/dto/generate.utility.js.map +1 -1
  347. package/dist/esm/utility/dto/get-get-list-query-base-class.utility.js.map +1 -1
  348. package/dist/esm/utility/dto/handle-date-property.utility.js.map +1 -1
  349. package/dist/esm/utility/dto/is-property-should-be-marked.utility.js.map +1 -1
  350. package/dist/esm/utility/dto/validate-property-config.utility.js.map +1 -1
  351. package/dist/esm/utility/generate-entity-information.utility.js.map +1 -1
  352. package/dist/esm/utility/is-error-of-type.utility.js.map +1 -1
  353. package/dist/esm/utility/logger.utility.js +3 -5
  354. package/dist/esm/utility/logger.utility.js.map +1 -1
  355. package/dist/esm/validator/all-or-none-of-listed-properties.validator.js +1 -0
  356. package/dist/esm/validator/all-or-none-of-listed-properties.validator.js.map +1 -1
  357. package/dist/esm/validator/has-at-least-one-and-only-one-of-listed-properties.validator.js +1 -0
  358. package/dist/esm/validator/has-at-least-one-and-only-one-of-listed-properties.validator.js.map +1 -1
  359. package/dist/esm/validator/has-at-least-one-of-listed-properties.validator.js +1 -0
  360. package/dist/esm/validator/has-at-least-one-of-listed-properties.validator.js.map +1 -1
  361. package/dist/esm/validator/has-at-least-one-property.validator.js +1 -0
  362. package/dist/esm/validator/has-at-least-one-property.validator.js.map +1 -1
  363. package/dist/esm/validator/has-paired-custom-suffixes-fields.validator.js +1 -0
  364. package/dist/esm/validator/has-paired-custom-suffixes-fields.validator.js.map +1 -1
  365. package/dist/esm/validator/is-regular-expression.validator.js.map +1 -1
  366. package/dist/esm/validator/must-match-one-of-schemas.validator.js +1 -0
  367. package/dist/esm/validator/must-match-one-of-schemas.validator.js.map +1 -1
  368. package/dist/esm/validator/only-one-of-listed-properties.validator.js +1 -0
  369. package/dist/esm/validator/only-one-of-listed-properties.validator.js.map +1 -1
  370. package/package.json +2 -2
@@ -2,6 +2,7 @@ import type { IApiBaseEntity } from '../../../interface/api-base-entity.interfac
2
2
  import type { IApiFunctionProperties } from '../../../interface/decorator/api/index';
3
3
  /**
4
4
  * Creates a decorator that adds entity creation functionality to a service method
5
+ * @template E The entity type
5
6
  * @param {IApiFunctionProperties<E>} properties - Configuration properties for the create function
6
7
  * @returns {(target: unknown, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor} A decorator function that modifies the target method to handle entity creation
7
8
  */
@@ -12,6 +12,7 @@ var logger_utility = require('../../../utility/logger.utility.js');
12
12
 
13
13
  /**
14
14
  * Creates a decorator that adds entity creation functionality to a service method
15
+ * @template E The entity type
15
16
  * @param {IApiFunctionProperties<E>} properties - Configuration properties for the create function
16
17
  * @returns {(target: unknown, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor} A decorator function that modifies the target method to handle entity creation
17
18
  */
@@ -21,9 +22,9 @@ function ApiFunctionCreate(properties) {
21
22
  descriptor.value = async function (createProperties, eventManager) {
22
23
  const entityInstance = new entity();
23
24
  const executionContext = {
24
- data: { eventManager, repository: this.repository },
25
- entity: entityInstance,
26
- functionType: type_enum.EApiFunctionType.CREATE,
25
+ DATA: { eventManager, repository: this.repository },
26
+ ENTITY: entityInstance,
27
+ FUNCTION_TYPE: type_enum.EApiFunctionType.CREATE,
27
28
  result: createProperties,
28
29
  };
29
30
  const result = await executor_class.ApiSubscriberExecutor.executeFunctionSubscribers(this.constructor, entityInstance, type_enum.EApiFunctionType.CREATE, onType_enum.EApiSubscriberOnType.BEFORE, executionContext);
@@ -35,13 +36,14 @@ function ApiFunctionCreate(properties) {
35
36
  await executor_class.ApiSubscriberExecutor.executeFunctionSubscribers(this.constructor, entityInstance, type_enum.EApiFunctionType.CREATE, onType_enum.EApiSubscriberOnType.BEFORE_ERROR, executionContext, new Error("Repository is not available in this context"));
36
37
  throw errorException_utility.ErrorException("Repository is not available in this context");
37
38
  }
38
- return executor({ constructor: this.constructor, entity, eventManager, properties: executionContext.result, repository });
39
+ return executor({ constructor: this.constructor, entity, eventManager, properties: executionContext.result ?? {}, repository });
39
40
  };
40
41
  return descriptor;
41
42
  };
42
43
  }
43
44
  /**
44
45
  * Executes the entity creation operation with error handling
46
+ * @template E The entity type
45
47
  * @param {IApiFunctionCreateExecutorProperties<E>} options - Properties required for entity creation
46
48
  * @returns {Promise<E>} The created entity instance
47
49
  * @throws {InternalServerErrorException} If the creation operation fails
@@ -59,9 +61,9 @@ async function executor(options) {
59
61
  }
60
62
  const entityInstance = new entity();
61
63
  const executionContext = {
62
- data: { eventManager, repository },
63
- entity: entityInstance,
64
- functionType: type_enum.EApiFunctionType.CREATE,
64
+ DATA: { eventManager, repository },
65
+ ENTITY: entityInstance,
66
+ FUNCTION_TYPE: type_enum.EApiFunctionType.CREATE,
65
67
  result: result,
66
68
  };
67
69
  const afterResult = await executor_class.ApiSubscriberExecutor.executeFunctionSubscribers(constructor, entityInstance, type_enum.EApiFunctionType.CREATE, onType_enum.EApiSubscriberOnType.AFTER, executionContext);
@@ -73,9 +75,9 @@ async function executor(options) {
73
75
  catch (error) {
74
76
  const entityInstance = new entity();
75
77
  const executionContext = {
76
- data: { eventManager, properties, repository },
77
- entity: entityInstance,
78
- functionType: type_enum.EApiFunctionType.CREATE,
78
+ DATA: { eventManager, properties, repository },
79
+ ENTITY: entityInstance,
80
+ FUNCTION_TYPE: type_enum.EApiFunctionType.CREATE,
79
81
  };
80
82
  if (error instanceof common.HttpException) {
81
83
  await executor_class.ApiSubscriberExecutor.executeFunctionSubscribers(constructor, entityInstance, type_enum.EApiFunctionType.CREATE, onType_enum.EApiSubscriberOnType.AFTER_ERROR, executionContext, error);
@@ -1 +1 @@
1
- {"version":3,"file":"create.decorator.js","sources":["../../../../../../src/decorator/api/function/create.decorator.ts"],"sourcesContent":[null],"names":["EApiFunctionType","ApiSubscriberExecutor","EApiSubscriberOnType","ErrorException","HttpException","LoggerUtility","InternalServerErrorException","ErrorString","EErrorStringAction"],"mappings":";;;;;;;;;;;;AAeA;;;;AAIG;AACG,SAAU,iBAAiB,CAA2B,UAAqC,EAAA;AAChG,IAAA,MAAM,EAAE,MAAM,EAAE,GAA8B,UAAU;AAExD,IAAA,OAAO,UAAU,OAAgB,EAAE,YAAoB,EAAE,UAA8B,EAAA;AACtF,QAAA,UAAU,CAAC,KAAK,GAAG,gBAAqD,gBAAiD,EAAE,YAA4B,EAAA;AACtJ,YAAA,MAAM,cAAc,GAAG,IAAI,MAAM,EAAE;AAEnC,YAAA,MAAM,gBAAgB,GAAoG;gBACzH,IAAI,EAAE,EAAE,YAAY,EAAE,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE;AACnD,gBAAA,MAAM,EAAE,cAAc;gBACtB,YAAY,EAAEA,0BAAgB,CAAC,MAAM;AACrC,gBAAA,MAAM,EAAE,gBAAgB;aACxB;YAED,MAAM,MAAM,GAAG,MAAMC,oCAAqB,CAAC,0BAA0B,CAAC,IAAI,CAAC,WAAqD,EAAE,cAAc,EAAED,0BAAgB,CAAC,MAAM,EAAEE,gCAAoB,CAAC,MAAM,EAAE,gBAAgB,CAAC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ts"],"sourcesContent":[null],"names":["EApiFunctionType","ApiSubscriberExecutor","EApiSubscriberOnType","ErrorException","HttpException","LoggerUtility","InternalServerErrorException","ErrorString","EErrorStringAction"],"mappings":";;;;;;;;;;;;AAeA;;;;;AAKG;AACG,SAAU,iBAAiB,CAA2B,UAAqC,EAAA;AAChG,IAAA,MAAM,EAAE,MAAM,EAAE,GAA8B,UAAU;AAExD,IAAA,OAAO,UAAU,OAAgB,EAAE,YAAoB,EAAE,UAA8B,EAAA;AACtF,QAAA,UAAU,CAAC,KAAK,GAAG,gBAAqD,gBAAiD,EAAE,YAA4B,EAAA;AACtJ,YAAA,MAAM,cAAc,GAAM,IAAI,MAAM,EAAE;AAEtC,YAAA,MAAM,gBAAgB,GAAwG;gBAC7H,IAAI,EAAE,EAAE,YAAY,EAAE,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE;AACnD,gBAAA,MAAM,EAAE,cAAc;gBACtB,aAAa,EAAEA,0BAAgB,CAAC,MAAM;AACtC,gBAAA,MAAM,EAAE,gBAAgB;aACxB;YAED,MAAM,MAAM,GAAgD,MAAMC,oCAAqB,CAAC,0BAA0B,CAAC,IAAI,CAAC,WAA6D,EAAE,cAAc,EAAED,0BAAgB,CAAC,MAAM,EAAEE,gCAAoB,CAAC,MAAM,EAAE,gBAAgB,CAAC;YAE9Q,IAAI,MAAM,EAAE;AACX,gBAAA,gBAAgB,CAAC,MAAM,GAAG,MAAM;;AAGjC,YAAA,MAAM,UAAU,GAAkB,IAAI,CAAC,UAAU;YAEjD,IAAI,CAAC,UAAU,EAAE;gBAChB,MAAMD,oCAAqB,CAAC,0BAA0B,CAAC,IAAI,CAAC,WAA6D,EAAE,cAAc,EAAED,0BAAgB,CAAC,MAAM,EAAEE,gCAAoB,CAAC,YAAY,EAAE,gBAAgB,EAAE,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAC;AAElR,gBAAA,MAAMC,qCAAc,CAAC,6CAA6C,CAAC;;YAGpE,OAAO,QAAQ,CAAI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AE,UAAU,EAAE;AAC9C,YAAA,MAAM,EAAE,cAAc;YACtB,aAAa,EAAEF,0BAAgB,CAAC,MAAM;SACtC;AAED,QAAA,IAAI,KAAK,YAAYI,oBAAa,EAAE;YACnC,MAAMH,oCAAqB,CAAC,0BAA0B,CAAC,WAAW,EAAE,cAAc,EAAED,0BAAgB,CAAC,MAAM,EAAEE,gCAAoB,CAAC,WAAW,EAAE,gBAAgB,EAAE,KAAK,CAAC;AAEvK,YAAA,MAAM,KAAK;;AAGZ,QAAAG,4BAAa,CAAC,SAAS,CAAC,mBAAmB,CAAC,CAAC,OAAO,CAAC,CAAA,sBAAA,EAAyB,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,KAAK,CAAC;QAC5G,MAAMJ,oCAAqB,CAAC,0BAA0B,CAAC,WAAW,EAAE,cAAc,EAAED,0BAAgB,CAAC,MAAM,EAAEE,gCAAoB,CAAC,WAAW,EAAE,gBAAgB,EAAE,KAAc,CAAC;AAEhL,QAAA,MAAM,IAAII,mCAA4B,CACrCC,+BAAW,CAAC;AACX,YAAA,MAAM,EAAE,MAAM;YACd,IAAI,EAAEC,8BAAkB,CAAC,cAAc;AACvC,SAAA,CAAC,CACF;;AAEH;;;;"}
@@ -34,6 +34,7 @@ function ApiFunction(properties) {
34
34
  const { entity, type } = properties;
35
35
  return function (_target, propertyKey, descriptor) {
36
36
  const originalMethod = descriptor.value;
37
+ // eslint-disable-next-line @elsikora/typescript/naming-convention
37
38
  descriptor.value = function (...arguments_) {
38
39
  let decoratorFunction;
39
40
  switch (type) {
@@ -1 +1 @@
1
- {"version":3,"file":"decorator.js","sources":["../../../../../../src/decorator/api/function/decorator.ts"],"sourcesContent":[null],"names":["EApiFunctionType","ApiFunctionCreate","ApiFunctionDelete","ApiFunctionGet","ApiFunctionGetList","ApiFunctionGetMany","ApiFunctionUpdate","ErrorException"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAgBA;;;;;;AAMG;AACH;AACM,SAAU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AAC;AAC9G,YAAA,MAAM,cAAc,GAAsC,kBAAkB,CAAC,KAA0C;YAEvH,OAAO,cAAc,CAAC,KAAK,CAAC,IAAI,EAAE,UAAU,CAAC;AAC9C,SAAC;AAED,QAAA,OAAO,UAAU;AAClB,KAAC;AACF;;;;"}
1
+ {"version":3,"file":"decorator.js","sources":["../../../../../../src/decorator/api/function/decorator.ts"],"sourcesContent":[null],"names":["EApiFunctionType","ApiFunctionCreate","ApiFunctionDelete","ApiFunctionGet","ApiFunctionGetList","ApiFunctionGetMany","ApiFunctionUpdate","ErrorException"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAcA;;;;;;AAMG;AACH;AACM,SAAU,WAAW,CAA8B,UAAqC,EAAA;AAC7F,IAAA,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,GAA8B,UAAU;AAE9D,IAAA,OAAO,UAAU,OAAgB,EAAE,WAAmB,EAAE,UAA8B,EAAA;AACrF,QAAA,MAAM,cAAc,GAAY,UAAU,CAAC,KAAK;;AAGhD,QAAA,UAAU,CAAC,KAAK,GAAG,UAA+C,GAAG,UAA0B,EAAA;AAC9F,YAAA,IAAI,iBAA+G;YAEnH,QAAQ,IAAI;AACX,gBAAA,KAAKA,0BAAgB,CAAC,MAAM,EAAE;AAC7B,oBAAA,iBAAiB,GAAGC,kCAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;oBAEjD;;AAGD,gBAAA,KAAKD,0BAAgB,CAAC,MAAM,EAAE;AAC7B,oBAAA,iBAAiB,GAAGE,kCAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;oBAEjD;;AAGD,gBAAA,KAAKF,0BAAgB,CAAC,GAAG,EAAE;AAC1B,oBAAA,iBAAiB,GAAGG,4BAAc,CAAC,EAAE,MAAM,EAAE,CAAC;oBAE9C;;AAGD,gBAAA,KAAKH,0BAAgB,CAAC,QAAQ,EAAE;AAC/B,oBAAA,iBAAiB,GAAGI,oCAAkB,CAAC,EAAE,MAAM,EAAE,CAAC;oBAElD;;AAGD,gBAAA,KAAKJ,0BAAgB,CAAC,QAAQ,EAAE;AAC/B,oBAAA,iBAAiB,GAAGK,oCAAkB,CAAC,EAAE,MAAM,EAAE,CAAC;oBAElD;;AAGD,gBAAA,KAAKL,0BAAgB,CAAC,MAAM,EAAE;AAC7B,oBAAA,iBAAiB,GAAGM,kCAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;oBAEjD;;gBAGD,SAAS;AACR,oBAAA,MAAMC,qCAAc,CAAC,sBAAsB,CAAC;;;AAI9C,YAAA,MAAM,kBAAkB,GAAuB,iBAAiB,CAAC,IAAI,EAAE,WAAW,EAAE,EAAE,KAAK,EAAE,cAAc,EAAE,CAAC;AAC9G,YAAA,MAAM,cAAc,GAA0C,kBAAkB,CAAC,KAA8C;YAE/H,OAAO,cAAc,CAAC,KAAK,CAAC,IAAI,EAAE,UAAU,CAAC;AAC9C,SAAC;AAED,QAAA,OAAO,UAAU;AAClB,KAAC;AACF;;;;"}
@@ -2,11 +2,8 @@ import type { IApiBaseEntity } from '../../../interface/api-base-entity.interfac
2
2
  import type { IApiFunctionProperties } from '../../../interface/decorator/api/index';
3
3
  /**
4
4
  * Creates a decorator that adds entity deletion functionality to a service method
5
- * @param {IApiFunctionProperties} properties - Configuration properties for the delete function
5
+ * @template E The entity type
6
+ * @param {IApiFunctionProperties<E>} properties - Configuration properties for the delete function
6
7
  * @returns {(target: unknown, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor} A decorator function that modifies the target method to handle entity deletion
7
8
  */
8
- /**
9
- *
10
- * @param properties
11
- */
12
9
  export declare function ApiFunctionDelete<E extends IApiBaseEntity>(properties: IApiFunctionProperties<E>): (target: unknown, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
@@ -25,13 +25,10 @@ var get_decorator = require('./get.decorator.js');
25
25
 
26
26
  /**
27
27
  * Creates a decorator that adds entity deletion functionality to a service method
28
- * @param {IApiFunctionProperties} properties - Configuration properties for the delete function
28
+ * @template E The entity type
29
+ * @param {IApiFunctionProperties<E>} properties - Configuration properties for the delete function
29
30
  * @returns {(target: unknown, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor} A decorator function that modifies the target method to handle entity deletion
30
31
  */
31
- /**
32
- *
33
- * @param properties
34
- */
35
32
  function ApiFunctionDelete(properties) {
36
33
  const { entity } = properties;
37
34
  const getDecorator = get_decorator.ApiFunctionGet({ entity });
@@ -40,9 +37,9 @@ function ApiFunctionDelete(properties) {
40
37
  descriptor.value = async function (criteria, eventManager) {
41
38
  const entityInstance = new entity();
42
39
  const executionContext = {
43
- data: { criteria, eventManager, repository: this.repository },
44
- entity: entityInstance,
45
- functionType: type_enum.EApiFunctionType.DELETE,
40
+ DATA: { criteria, eventManager, repository: this.repository },
41
+ ENTITY: entityInstance,
42
+ FUNCTION_TYPE: type_enum.EApiFunctionType.DELETE,
46
43
  result: criteria,
47
44
  };
48
45
  const result = await executor_class.ApiSubscriberExecutor.executeFunctionSubscribers(this.constructor, entityInstance, type_enum.EApiFunctionType.DELETE, onType_enum.EApiSubscriberOnType.BEFORE, executionContext);
@@ -68,13 +65,14 @@ function ApiFunctionDelete(properties) {
68
65
  throw errorException_utility.ErrorException("Get function is not properly decorated");
69
66
  }
70
67
  }
71
- return executor({ constructor: this.constructor, criteria: executionContext.result, entity, eventManager, getFunction, repository });
68
+ return executor({ constructor: this.constructor, criteria: executionContext.result ?? {}, entity, eventManager, getFunction, repository });
72
69
  };
73
70
  return descriptor;
74
71
  };
75
72
  }
76
73
  /**
77
74
  * Executes the entity deletion operation with error handling
75
+ * @template E The entity type
78
76
  * @param {IApiFunctionDeleteExecutorProperties<E>} options - Properties required for entity deletion
79
77
  * @returns {Promise<E>} The deleted entity instance
80
78
  * @throws {InternalServerErrorException} If the deletion operation fails
@@ -92,9 +90,9 @@ async function executor(options) {
92
90
  result = await repository.remove(existingEntity);
93
91
  }
94
92
  const executionContext = {
95
- data: { criteria, eventManager, repository },
96
- entity: existingEntity,
97
- functionType: type_enum.EApiFunctionType.DELETE,
93
+ DATA: { criteria, eventManager, repository },
94
+ ENTITY: existingEntity,
95
+ FUNCTION_TYPE: type_enum.EApiFunctionType.DELETE,
98
96
  result: result,
99
97
  };
100
98
  const afterResult = await executor_class.ApiSubscriberExecutor.executeFunctionSubscribers(constructor, existingEntity, type_enum.EApiFunctionType.DELETE, onType_enum.EApiSubscriberOnType.AFTER, executionContext);
@@ -106,9 +104,9 @@ async function executor(options) {
106
104
  catch (error) {
107
105
  const entityInstance = new entity();
108
106
  const executionContext = {
109
- data: { criteria, eventManager, repository },
110
- entity: entityInstance,
111
- functionType: type_enum.EApiFunctionType.DELETE,
107
+ DATA: { criteria, eventManager, repository },
108
+ ENTITY: entityInstance,
109
+ FUNCTION_TYPE: type_enum.EApiFunctionType.DELETE,
112
110
  };
113
111
  if (error instanceof common.HttpException) {
114
112
  await executor_class.ApiSubscriberExecutor.executeFunctionSubscribers(constructor, entityInstance, type_enum.EApiFunctionType.DELETE, onType_enum.EApiSubscriberOnType.AFTER_ERROR, executionContext, error);
@@ -1 +1 @@
1
- {"version":3,"file":"delete.decorator.js","sources":["../../../../../../src/decorator/api/function/delete.decorator.ts"],"sourcesContent":[null],"names":["ApiFunctionGet","EApiFunctionType","ApiSubscriberExecutor","EApiSubscriberOnType","ErrorException","HttpException","LoggerUtility","InternalServerErrorException","ErrorString","EErrorStringAction"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAgBA;;;;AAIG;AAEH;;;AAGG;AACG,SAAU,iBAAiB,CAA2B,UAAqC,EAAA;AAChG,IAAA,MAAM,EAAE,MAAM,EAAE,GAA8B,UAAU;IACxD,MAAM,YAAY,GAA6FA,4BAAc,CAAI,EAAE,MAAM,EAAE,CAAC;AAC5I,IAAA,IAAI,WAAmG;AAEvG,IAAA,OAAO,UAAU,OAAgB,EAAE,YAAoB,EAAE,UAA8B,EAAA;AACtF,QAAA,UAAU,CAAC,KAAK,GAAG,gBAAqD,QAAuC,EAAE,YAA4B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AAI,MAAM,EAAE;AACnC,QAAA,MAAM,gBAAgB,GAA0D;AAC/E,YAAA,IAAI,EAAE,EAAE,QAAQ,EAAE,YAAY,EAAE,UAAU,EAAE;AAC5C,YAAA,MAAM,EAAE,cAAc;YACtB,YAAY,EAAEF,0BAAgB,CAAC,MAAM;SACrC;AAED,QAAA,IAAI,KAAK,YAAYI,oBAAa,EAAE;YACnC,MAAMH,oCAAqB,CAAC,0BAA0B,CAAC,WAAW,EAAE,cAAc,EAAED,0BAAgB,CAAC,MAAM,EAAEE,gCAAoB,CAAC,WAAkB,EAAE,gBAAgB,EAAE,KAAK,CAAC;AAC9K,YAAA,MAAM,KAAK;;AAGZ,QAAAG,4BAAa,CAAC,SAAS,CAAC,mBAAmB,CAAC,CAAC,OAAO,CAAC,CAAA,sBAAA,EAAyB,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,KAAK,CAAC;QAC5G,MAAMJ,oCAAqB,CAAC,0BAA0B,CAAC,WAAW,EAAE,cAAc,EAAED,0BAAgB,CAAC,MAAM,EAAEE,gCAAoB,CAAC,WAAkB,EAAE,gBAAgB,EAAE,KAAc,CAAC;AAEvL,QAAA,MAAM,IAAII,mCAA4B,CACrCC,+BAAW,CAAC;AACX,YAAA,MAAM,EAAE,MAAM;YACd,IAAI,EAAEC,8BAAkB,CAAC,cAAc;AACvC,SAAA,CAAC,CACF;;AAEH;;;;"}
1
+ {"version":3,"file":"delete.decorator.js","sources":["../../../../../../src/decorator/api/function/delete.decorator.ts"],"sourcesContent":[null],"names":["ApiFunctionGet","EApiFunctionType","ApiSubscriberExecutor","EApiSubscriberOnType","ErrorException","HttpException","LoggerUtility","InternalServerErrorException","ErrorString","EErrorStringAction"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAiBA;;;;;AAKG;AACG,SAAU,iBAAiB,CAA2B,UAAqC,EAAA;AAChG,IAAA,MAAM,EAAE,MAAM,EAAE,GAA8B,UAAU;IACxD,MAAM,YAAY,GAAi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AAc,EAAED,0BAAgB,CAAC,MAAM,EAAEE,gCAAoB,CAAC,KAAK,EAAE,gBAAgB,CAAC;QAE7L,IAAI,WAAW,EAAE;AAChB,YAAA,OAAO,WAAW;;AAGnB,QAAA,OAAO,MAAM;;IACZ,OAAO,KAAK,EAAE;AACf,QAAA,MAAM,cAAc,GAAM,IAAI,MAAM,EAAE;AAEtC,QAAA,MAAM,gBAAgB,GAAqD;AAC1E,YAAA,IAAI,EAAE,EAAE,QAAQ,EAAE,YAAY,EAAE,UAAU,EAAE;AAC5C,YAAA,MAAM,EAAE,cAAc;YACtB,aAAa,EAAEF,0BAAgB,CAAC,MAAM;SACtC;AAED,QAAA,IAAI,KAAK,YAAYI,oBAAa,EAAE;YACnC,MAAMH,oCAAqB,CAAC,0BAA0B,CAAC,WAAW,EAAE,cAAc,EAAED,0BAAgB,CAAC,MAAM,EAAEE,gCAAoB,CAAC,WAAW,EAAE,gBAAgB,EAAE,KAAK,CAAC;AAEvK,YAAA,MAAM,KAAK;;AAGZ,QAAAG,4BAAa,CAAC,SAAS,CAAC,mBAAmB,CAAC,CAAC,OAAO,CAAC,CAAA,sBAAA,EAAyB,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,KAAK,CAAC;QAC5G,MAAMJ,oCAAqB,CAAC,0BAA0B,CAAC,WAAW,EAAE,cAAc,EAAED,0BAAgB,CAAC,MAAM,EAAEE,gCAAoB,CAAC,WAAW,EAAE,gBAAgB,EAAE,KAAc,CAAC;AAEhL,QAAA,MAAM,IAAII,mCAA4B,CACrCC,+BAAW,CAAC;AACX,YAAA,MAAM,EAAE,MAAM;YACd,IAAI,EAAEC,8BAAkB,CAAC,cAAc;AACvC,SAAA,CAAC,CACF;;AAEH;;;;"}
@@ -2,11 +2,8 @@ import type { IApiBaseEntity } from '../../../interface/api-base-entity.interfac
2
2
  import type { IApiFunctionProperties } from '../../../interface/decorator/api/index';
3
3
  /**
4
4
  * Creates a decorator that adds entity list retrieval functionality to a service method
5
- * @param {IApiFunctionProperties} properties - Configuration properties for the get-list function
5
+ * @template E The entity type
6
+ * @param {IApiFunctionProperties<E>} properties - Configuration properties for the get-list function
6
7
  * @returns {(target: unknown, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor} A decorator function that modifies the target method to handle entity list retrieval
7
8
  */
8
- /**
9
- *
10
- * @param properties
11
- */
12
9
  export declare function ApiFunctionGetList<E extends IApiBaseEntity>(properties: IApiFunctionProperties<E>): (target: unknown, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
@@ -24,22 +24,19 @@ var logger_utility = require('../../../utility/logger.utility.js');
24
24
 
25
25
  /**
26
26
  * Creates a decorator that adds entity list retrieval functionality to a service method
27
- * @param {IApiFunctionProperties} properties - Configuration properties for the get-list function
27
+ * @template E The entity type
28
+ * @param {IApiFunctionProperties<E>} properties - Configuration properties for the get-list function
28
29
  * @returns {(target: unknown, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor} A decorator function that modifies the target method to handle entity list retrieval
29
30
  */
30
- /**
31
- *
32
- * @param properties
33
- */
34
31
  function ApiFunctionGetList(properties) {
35
32
  const { entity } = properties;
36
33
  return function (_target, _propertyKey, descriptor) {
37
34
  descriptor.value = async function (getListProperties, eventManager) {
38
35
  const entityInstance = new entity();
39
36
  const executionContext = {
40
- data: { eventManager, getListProperties, repository: this.repository },
41
- entity: entityInstance,
42
- functionType: type_enum.EApiFunctionType.GET_LIST,
37
+ DATA: { eventManager, getListProperties, repository: this.repository },
38
+ ENTITY: entityInstance,
39
+ FUNCTION_TYPE: type_enum.EApiFunctionType.GET_LIST,
43
40
  result: getListProperties,
44
41
  };
45
42
  const result = await executor_class.ApiSubscriberExecutor.executeFunctionSubscribers(this.constructor, entityInstance, type_enum.EApiFunctionType.GET_LIST, onType_enum.EApiSubscriberOnType.BEFORE, executionContext);
@@ -51,13 +48,30 @@ function ApiFunctionGetList(properties) {
51
48
  await executor_class.ApiSubscriberExecutor.executeFunctionSubscribers(this.constructor, entityInstance, type_enum.EApiFunctionType.GET_LIST, onType_enum.EApiSubscriberOnType.BEFORE_ERROR, executionContext, new Error("Repository is not available in this context"));
52
49
  throw errorException_utility.ErrorException("Repository is not available in this context");
53
50
  }
54
- return executor({ constructor: this.constructor, entity, eventManager, properties: executionContext.result, repository });
51
+ return executor({ constructor: this.constructor, entity, eventManager, properties: executionContext.result ?? {}, repository });
55
52
  };
56
53
  return descriptor;
57
54
  };
58
55
  }
56
+ /**
57
+ * Calculates the current page number based on the provided properties.
58
+ * @template E The entity type
59
+ * @param {TApiFunctionGetListProperties<E>} properties - The properties for the get-list function.
60
+ * @param {number} itemsLength - The number of items on the current page.
61
+ * @returns {number} The current page number.
62
+ */
63
+ function calculateCurrentPage(properties, itemsLength) {
64
+ if (itemsLength === 0) {
65
+ return 0;
66
+ }
67
+ if (properties.skip) {
68
+ return Math.ceil(properties.skip / (properties.take ?? 1)) + 1;
69
+ }
70
+ return 1;
71
+ }
59
72
  /**
60
73
  * Executes the entity list retrieval operation with error handling
74
+ * @template E The entity type
61
75
  * @param {IApiFunctionGetListExecutorProperties<E>} options - Properties required for entity list retrieval
62
76
  * @returns {Promise<IApiGetListResponseResult<E>>} The paginated list of entities with count information
63
77
  * @throws {InternalServerErrorException} If the list retrieval operation fails
@@ -76,15 +90,15 @@ async function executor(options) {
76
90
  }
77
91
  const result = {
78
92
  count: items.length,
79
- currentPage: items.length === 0 ? 0 : (properties.skip ? Math.ceil(properties.skip / (properties.take ?? 1)) + 1 : 1),
93
+ currentPage: calculateCurrentPage(properties, items.length),
80
94
  items,
81
95
  totalCount,
82
96
  totalPages: Math.ceil(totalCount / (properties.take ?? 1)),
83
97
  };
84
98
  const executionContext = {
85
- data: { eventManager, properties, repository },
86
- entity: new entity(),
87
- functionType: type_enum.EApiFunctionType.GET_LIST,
99
+ DATA: { eventManager, properties, repository },
100
+ ENTITY: new entity(),
101
+ FUNCTION_TYPE: type_enum.EApiFunctionType.GET_LIST,
88
102
  result: result,
89
103
  };
90
104
  const afterResult = await executor_class.ApiSubscriberExecutor.executeFunctionSubscribers(constructor, new entity(), type_enum.EApiFunctionType.GET_LIST, onType_enum.EApiSubscriberOnType.AFTER, executionContext);
@@ -96,9 +110,9 @@ async function executor(options) {
96
110
  catch (error) {
97
111
  const entityInstance = new entity();
98
112
  const executionContext = {
99
- data: { properties, eventManager, repository },
100
- entity: entityInstance,
101
- functionType: type_enum.EApiFunctionType.GET_LIST,
113
+ DATA: { eventManager, properties, repository },
114
+ ENTITY: entityInstance,
115
+ FUNCTION_TYPE: type_enum.EApiFunctionType.GET_LIST,
102
116
  };
103
117
  if (error instanceof common.HttpException) {
104
118
  await executor_class.ApiSubscriberExecutor.executeFunctionSubscribers(constructor, entityInstance, type_enum.EApiFunctionType.GET_LIST, onType_enum.EApiSubscriberOnType.AFTER_ERROR, executionContext, error);
@@ -1 +1 @@
1
- {"version":3,"file":"get-list.decorator.js","sources":["../../../../../../src/decorator/api/function/get-list.decorator.ts"],"sourcesContent":[null],"names":["EApiFunctionType","ApiSubscriberExecutor","EApiSubscriberOnType","ErrorException","HttpException","LoggerUtility","InternalServerErrorException","ErrorString","EErrorStringAction"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAcA;;;;AAIG;AAEH;;;AAGG;AACG,SAAU,kBAAkB,CAA2B,UAAqC,EAAA;AACjG,IAAA,MAAM,EAAE,MAAM,EAAE,GAA8B,UAAU;AAExD,IAAA,OAAO,UAAU,OAAgB,EAAE,YAAoB,EAAE,UAA8B,EAAA;AACtF,QAAA,UAAU,CAAC,KAAK,GAAG,gBAAqD,iBAAmD,EAAE,YAA4B,EAAA;AACxJ,YAAA,MAAM,cAAc,GAAG,IAAI,MAAM,EAAE;AAEnC,YAAA,MAAM,gBAAgB,GAAqF;gBAC1G,IAAI,EAAE,EAAE,YAAY,EAAE,iBAAiB,EAAE,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE;AACtE,gBAAA,MAAM,EAAE,cAAc;gBACtB,YAA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AI,KAAK,YAAYI,oBAAa,EAAE;YACnC,MAAMH,oCAAqB,CAAC,0BAA0B,CAAC,WAAW,EAAE,cAAc,EAAED,0BAAgB,CAAC,QAAQ,EAAEE,gCAAoB,CAAC,WAAkB,EAAE,gBAAgB,EAAE,KAAK,CAAC;AAChL,YAAA,MAAM,KAAK;;AAGZ,QAAAG,4BAAa,CAAC,SAAS,CAAC,oBAAoB,CAAC,CAAC,OAAO,CAAC,CAAA,+BAAA,EAAkC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,KAAK,CAAC;QACtH,MAAMJ,oCAAqB,CAAC,0BAA0B,CAAC,WAAW,EAAE,cAAc,EAAED,0BAAgB,CAAC,QAAQ,EAAEE,gCAAoB,CAAC,WAAkB,EAAE,gBAAgB,EAAE,KAAc,CAAC;AAEzL,QAAA,MAAM,IAAII,mCAA4B,CACrCC,+BAAW,CAAC;AACX,YAAA,MAAM,EAAE,MAAM;YACd,IAAI,EAAEC,8BAAkB,CAAC,mBAAmB;AAC5C,SAAA,CAAC,CACF;;AAEH;;;;"}
1
+ {"version":3,"file":"get-list.decorator.js","sources":["../../../../../../src/decorator/api/function/get-list.decorator.ts"],"sourcesContent":[null],"names":["EApiFunctionType","ApiSubscriberExecutor","EApiSubscriberOnType","ErrorException","HttpException","LoggerUtility","InternalServerErrorException","ErrorString","EErrorStringAction"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAeA;;;;;AAKG;AACG,SAAU,kBAAkB,CAA2B,UAAqC,EAAA;AACjG,IAAA,MAAM,EAAE,MAAM,EAAE,GAA8B,UAAU;AAExD,IAAA,OAAO,UAAU,OAAgB,EAAE,YAAoB,EAAE,UAA8B,EAAA;AACtF,QAAA,UAAU,CAAC,KAAK,GAAG,gBAAqD,iBAAmD,EAAE,YAA4B,EAAA;AACxJ,YAAA,MAAM,cAAc,GAAM,IAAI,MAAM,EAAE;AAEtC,YAAA,MAAM,gBAAgB,GAAgF;gBACrG,IAAI,EAAE,E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YAAA,OAAO,WAAW;;AAGnB,QAAA,OAAO,MAAM;;IACZ,OAAO,KAAK,EAAE;AACf,QAAA,MAAM,cAAc,GAAM,IAAI,MAAM,EAAE;AAEtC,QAAA,MAAM,gBAAgB,GAAqD;AAC1E,YAAA,IAAI,EAAE,EAAE,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE;AAC9C,YAAA,MAAM,EAAE,cAAc;YACtB,aAAa,EAAEF,0BAAgB,CAAC,QAAQ;SACxC;AAED,QAAA,IAAI,KAAK,YAAYI,oBAAa,EAAE;YACnC,MAAMH,oCAAqB,CAAC,0BAA0B,CAAC,WAAW,EAAE,cAAc,EAAED,0BAAgB,CAAC,QAAQ,EAAEE,gCAAoB,CAAC,WAAW,EAAE,gBAAgB,EAAE,KAAK,CAAC;AAEzK,YAAA,MAAM,KAAK;;AAGZ,QAAAG,4BAAa,CAAC,SAAS,CAAC,oBAAoB,CAAC,CAAC,OAAO,CAAC,CAAA,+BAAA,EAAkC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,KAAK,CAAC;QACtH,MAAMJ,oCAAqB,CAAC,0BAA0B,CAAC,WAAW,EAAE,cAAc,EAAED,0BAAgB,CAAC,QAAQ,EAAEE,gCAAoB,CAAC,WAAW,EAAE,gBAAgB,EAAE,KAAc,CAAC;AAElL,QAAA,MAAM,IAAII,mCAA4B,CACrCC,+BAAW,CAAC;AACX,YAAA,MAAM,EAAE,MAAM;YACd,IAAI,EAAEC,8BAAkB,CAAC,mBAAmB;AAC5C,SAAA,CAAC,CACF;;AAEH;;;;"}
@@ -2,11 +2,8 @@ import type { IApiBaseEntity } from '../../../interface/api-base-entity.interfac
2
2
  import type { IApiFunctionProperties } from '../../../interface/decorator/api/index';
3
3
  /**
4
4
  * Creates a decorator that adds functionality to retrieve multiple entities to a service method
5
- * @param {IApiFunctionProperties} properties - Configuration properties for the get-many function
5
+ * @template E The entity type
6
+ * @param {IApiFunctionProperties<E>} properties - Configuration properties for the get-many function
6
7
  * @returns {(target: unknown, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor} A decorator function that modifies the target method to handle retrieving multiple entities
7
8
  */
8
- /**
9
- *
10
- * @param properties
11
- */
12
9
  export declare function ApiFunctionGetMany<E extends IApiBaseEntity>(properties: IApiFunctionProperties<E>): (target: unknown, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
@@ -24,22 +24,19 @@ var logger_utility = require('../../../utility/logger.utility.js');
24
24
 
25
25
  /**
26
26
  * Creates a decorator that adds functionality to retrieve multiple entities to a service method
27
- * @param {IApiFunctionProperties} properties - Configuration properties for the get-many function
27
+ * @template E The entity type
28
+ * @param {IApiFunctionProperties<E>} properties - Configuration properties for the get-many function
28
29
  * @returns {(target: unknown, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor} A decorator function that modifies the target method to handle retrieving multiple entities
29
30
  */
30
- /**
31
- *
32
- * @param properties
33
- */
34
31
  function ApiFunctionGetMany(properties) {
35
32
  const { entity } = properties;
36
33
  return function (_target, _propertyKey, descriptor) {
37
34
  descriptor.value = async function (getManyProperties, eventManager) {
38
35
  const entityInstance = new entity();
39
36
  const executionContext = {
40
- data: { eventManager, getManyProperties, repository: this.repository },
41
- entity: entityInstance,
42
- functionType: type_enum.EApiFunctionType.GET_MANY,
37
+ DATA: { eventManager, getManyProperties, repository: this.repository },
38
+ ENTITY: entityInstance,
39
+ FUNCTION_TYPE: type_enum.EApiFunctionType.GET_MANY,
43
40
  result: getManyProperties,
44
41
  };
45
42
  const result = await executor_class.ApiSubscriberExecutor.executeFunctionSubscribers(this.constructor, entityInstance, type_enum.EApiFunctionType.GET_MANY, onType_enum.EApiSubscriberOnType.BEFORE, executionContext);
@@ -51,13 +48,14 @@ function ApiFunctionGetMany(properties) {
51
48
  await executor_class.ApiSubscriberExecutor.executeFunctionSubscribers(this.constructor, entityInstance, type_enum.EApiFunctionType.GET_MANY, onType_enum.EApiSubscriberOnType.BEFORE_ERROR, executionContext, new Error("Repository is not available in this context"));
52
49
  throw errorException_utility.ErrorException("Repository is not available in this context");
53
50
  }
54
- return executor({ constructor: this.constructor, entity, eventManager, properties: executionContext.result, repository });
51
+ return executor({ constructor: this.constructor, entity, eventManager, properties: executionContext.result ?? {}, repository });
55
52
  };
56
53
  return descriptor;
57
54
  };
58
55
  }
59
56
  /**
60
57
  * Executes the retrieval of multiple entities with error handling
58
+ * @template E The entity type
61
59
  * @param {IApiFunctionGetManyExecutorProperties<E>} options - Properties required for retrieving multiple entities
62
60
  * @returns {Promise<Array<E>>} An array of retrieved entity instances
63
61
  * @throws {NotFoundException} If no entities are found
@@ -78,9 +76,9 @@ async function executor(options) {
78
76
  throw new common.NotFoundException(errorString_utility.ErrorString({ entity, type: action_enum.EErrorStringAction.NOT_FOUND }));
79
77
  }
80
78
  const executionContext = {
81
- data: { eventManager, properties, repository },
82
- entity: new entity(),
83
- functionType: type_enum.EApiFunctionType.GET_MANY,
79
+ DATA: { eventManager, properties, repository },
80
+ ENTITY: new entity(),
81
+ FUNCTION_TYPE: type_enum.EApiFunctionType.GET_MANY,
84
82
  result: items,
85
83
  };
86
84
  const afterResult = await executor_class.ApiSubscriberExecutor.executeFunctionSubscribers(constructor, new entity(), type_enum.EApiFunctionType.GET_MANY, onType_enum.EApiSubscriberOnType.AFTER, executionContext);
@@ -92,9 +90,9 @@ async function executor(options) {
92
90
  catch (error) {
93
91
  const entityInstance = new entity();
94
92
  const executionContext = {
95
- data: { properties, eventManager, repository },
96
- entity: entityInstance,
97
- functionType: type_enum.EApiFunctionType.GET_MANY,
93
+ DATA: { eventManager, properties, repository },
94
+ ENTITY: entityInstance,
95
+ FUNCTION_TYPE: type_enum.EApiFunctionType.GET_MANY,
98
96
  };
99
97
  if (error instanceof common.HttpException) {
100
98
  await executor_class.ApiSubscriberExecutor.executeFunctionSubscribers(constructor, entityInstance, type_enum.EApiFunctionType.GET_MANY, onType_enum.EApiSubscriberOnType.AFTER_ERROR, executionContext, error);
@@ -1 +1 @@
1
- {"version":3,"file":"get-many.decorator.js","sources":["../../../../../../src/decorator/api/function/get-many.decorator.ts"],"sourcesContent":[null],"names":["EApiFunctionType","ApiSubscriberExecutor","EApiSubscriberOnType","ErrorException","NotFoundException","ErrorString","EErrorStringAction","HttpException","LoggerUtility","InternalServerErrorException"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAcA;;;;AAIG;AAEH;;;AAGG;AACG,SAAU,kBAAkB,CAA2B,UAAqC,EAAA;AACjG,IAAA,MAAM,EAAE,MAAM,EAAE,GAA8B,UAAU;AAExD,IAAA,OAAO,UAAU,OAAgB,EAAE,YAAoB,EAAE,UAA8B,EAAA;AAMtF,QAAA,UAAU,CAAC,KAAK,GAAG,gBAAqD,iBAAmD,EAAE,YAA4B,EAAA;AACxJ,YAAA,MAAM,cAAc,GAAG,IAAI,MAAM,EAAE;AAEnC,YAAA,MAAM,gBAAgB,GAAqF;gBAC1G,IAAI,EAAE,EAAE,YAAY,EAAE,iBAAiB,EAAE,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE;AACtE,gBAAA,MAAM,EAAE,cAAc;gBACtB,YAAY,EAAEA,0BAAgB,CAAC,QAAQ;AACvC,gBAAA,MAAM,EAAE,iBAAiB;aACzB;YAED,MAAM,MAAM,GAAG,MAAMC,oCAAqB,CAAC,0BAA0B,CAAC,IAAI,CAAC,WAA4B,EAAE,cAAc,EAAED,0BAAgB,CAAC,QAAQ,EAAEE,gCAAoB,CAAC,MAAa,EAAE,gBAAgB,CAAC;YAEzM,IAAI,MAAM,EAAE;AACX,gBAAA,gBAAgB,CAAC,MAAM,GAAG,MAAM;;AAGjC,YAAA,MAAM,UAAU,GAAkB,IAAI,CAAC,UAAU;YAEjD,IAAI,CAAC,UAAU,EAAE;gBAChB,MAAMD,oCAAqB,CAAC,0BAA0B,CAAC,IAAI,CAAC,WAA4B,EAAE,cAAc,EAAED,0BAAgB,CAAC,QAAQ,EAAEE,gCAAoB,CAAC,YAAmB,EAAE,gBAAgB,EA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,CAAC,KAAY,EAAE,gBAAgB,CAAC;QAErL,IAAI,WAAW,EAAE;AAChB,YAAA,OAAO,WAAW;;AAGnB,QAAA,OAAO,KAAK;;IACX,OAAO,KAAK,EAAE;AACf,QAAA,MAAM,cAAc,GAAG,IAAI,MAAM,EAAE;AACnC,QAAA,MAAM,gBAAgB,GAA0D;AAC/E,YAAA,IAAI,EAAE,EAAE,UAAU,EAAE,YAAY,EAAE,UAAU,EAAE;AAC9C,YAAA,MAAM,EAAE,cAAc;YACtB,YAAY,EAAEF,0BAAgB,CAAC,QAAQ;SACvC;AAED,QAAA,IAAI,KAAK,YAAYO,oBAAa,EAAE;YACnC,MAAMN,oCAAqB,CAAC,0BAA0B,CAAC,WAAW,EAAE,cAAc,EAAED,0BAAgB,CAAC,QAAQ,EAAEE,gCAAoB,CAAC,WAAkB,EAAE,gBAAgB,EAAE,KAAK,CAAC;AAChL,YAAA,MAAM,KAAK;;AAGZ,QAAAM,4BAAa,CAAC,SAAS,CAAC,oBAAoB,CAAC,CAAC,OAAO,CAAC,CAAA,+BAAA,EAAkC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,KAAK,CAAC;QACtH,MAAMP,oCAAqB,CAAC,0BAA0B,CAAC,WAAW,EAAE,cAAc,EAAED,0BAAgB,CAAC,QAAQ,EAAEE,gCAAoB,CAAC,WAAkB,EAAE,gBAAgB,EAAE,KAAc,CAAC;AAEzL,QAAA,MAAM,IAAIO,mCAA4B,CACrCJ,+BAAW,CAAC;YACX,MAAM;YACN,IAAI,EAAEC,8BAAkB,CAAC,cAAc;AACvC,SAAA,CAAC,CACF;;AAEH;;;;"}
1
+ {"version":3,"file":"get-many.decorator.js","sources":["../../../../../../src/decorator/api/function/get-many.decorator.ts"],"sourcesContent":[null],"names":["EApiFunctionType","ApiSubscriberExecutor","EApiSubscriberOnType","ErrorException","NotFoundException","ErrorString","EErrorStringAction","HttpException","LoggerUtility","InternalServerErrorException"],"mappings":";;;;;;;;;;;;;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GAAqD;AAC1E,YAAA,IAAI,EAAE,EAAE,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE;AAC9C,YAAA,MAAM,EAAE,cAAc;YACtB,aAAa,EAAEF,0BAAgB,CAAC,QAAQ;SACxC;AAED,QAAA,IAAI,KAAK,YAAYO,oBAAa,EAAE;YACnC,MAAMN,oCAAqB,CAAC,0BAA0B,CAAC,WAAW,EAAE,cAAc,EAAED,0BAAgB,CAAC,QAAQ,EAAEE,gCAAoB,CAAC,WAAW,EAAE,gBAAgB,EAAE,KAAK,CAAC;AAEzK,YAAA,MAAM,KAAK;;AAGZ,QAAAM,4BAAa,CAAC,SAAS,CAAC,oBAAoB,CAAC,CAAC,OAAO,CAAC,CAAA,+BAAA,EAAkC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,KAAK,CAAC;QACtH,MAAMP,oCAAqB,CAAC,0BAA0B,CAAC,WAAW,EAAE,cAAc,EAAED,0BAAgB,CAAC,QAAQ,EAAEE,gCAAoB,CAAC,WAAW,EAAE,gBAAgB,EAAE,KAAc,CAAC;AAElL,QAAA,MAAM,IAAIO,mCAA4B,CACrCJ,+BAAW,CAAC;YACX,MAAM;YACN,IAAI,EAAEC,8BAAkB,CAAC,cAAc;AACvC,SAAA,CAAC,CACF;;AAEH;;;;"}
@@ -2,11 +2,8 @@ import type { IApiBaseEntity } from '../../../interface/api-base-entity.interfac
2
2
  import type { IApiFunctionProperties } from '../../../interface/decorator/api/index';
3
3
  /**
4
4
  * Creates a decorator that adds single entity retrieval functionality to a service method
5
- * @param {IApiFunctionProperties} properties - Configuration properties for the get function
5
+ * @template E The entity type
6
+ * @param {IApiFunctionProperties<E>} properties - Configuration properties for the get function
6
7
  * @returns {(target: unknown, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor} A decorator function that modifies the target method to handle single entity retrieval
7
8
  */
8
- /**
9
- *
10
- * @param properties
11
- */
12
9
  export declare function ApiFunctionGet<E extends IApiBaseEntity>(properties: IApiFunctionProperties<E>): (target: unknown, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
@@ -24,22 +24,19 @@ var logger_utility = require('../../../utility/logger.utility.js');
24
24
 
25
25
  /**
26
26
  * Creates a decorator that adds single entity retrieval functionality to a service method
27
- * @param {IApiFunctionProperties} properties - Configuration properties for the get function
27
+ * @template E The entity type
28
+ * @param {IApiFunctionProperties<E>} properties - Configuration properties for the get function
28
29
  * @returns {(target: unknown, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor} A decorator function that modifies the target method to handle single entity retrieval
29
30
  */
30
- /**
31
- *
32
- * @param properties
33
- */
34
31
  function ApiFunctionGet(properties) {
35
32
  const { entity } = properties;
36
33
  return function (_target, _propertyKey, descriptor) {
37
34
  descriptor.value = async function (getProperties, eventManager) {
38
35
  const entityInstance = new entity();
39
36
  const executionContext = {
40
- data: { eventManager, getProperties, repository: this.repository },
41
- entity: entityInstance,
42
- functionType: type_enum.EApiFunctionType.GET,
37
+ DATA: { eventManager, getProperties, repository: this.repository },
38
+ ENTITY: entityInstance,
39
+ FUNCTION_TYPE: type_enum.EApiFunctionType.GET,
43
40
  result: getProperties,
44
41
  };
45
42
  const result = await executor_class.ApiSubscriberExecutor.executeFunctionSubscribers(this.constructor, entityInstance, type_enum.EApiFunctionType.GET, onType_enum.EApiSubscriberOnType.BEFORE, executionContext);
@@ -51,13 +48,14 @@ function ApiFunctionGet(properties) {
51
48
  await executor_class.ApiSubscriberExecutor.executeFunctionSubscribers(this.constructor, entityInstance, type_enum.EApiFunctionType.GET, onType_enum.EApiSubscriberOnType.BEFORE_ERROR, executionContext, new Error("Repository is not available in this context"));
52
49
  throw errorException_utility.ErrorException("Repository is not available in this context");
53
50
  }
54
- return executor({ constructor: this.constructor, entity, eventManager, properties: executionContext.result, repository });
51
+ return executor({ constructor: this.constructor, entity, eventManager, properties: executionContext.result ?? {}, repository });
55
52
  };
56
53
  return descriptor;
57
54
  };
58
55
  }
59
56
  /**
60
57
  * Executes the single entity retrieval operation with error handling
58
+ * @template E The entity type
61
59
  * @param {IApiFunctionGetExecutorProperties<E>} options - Properties required for entity retrieval
62
60
  * @returns {Promise<E>} The retrieved entity instance
63
61
  * @throws {NotFoundException} If the entity is not found
@@ -78,9 +76,9 @@ async function executor(options) {
78
76
  throw new common.NotFoundException(errorString_utility.ErrorString({ entity, type: action_enum.EErrorStringAction.NOT_FOUND }));
79
77
  }
80
78
  const executionContext = {
81
- data: { eventManager, properties, repository },
82
- entity: item,
83
- functionType: type_enum.EApiFunctionType.GET,
79
+ DATA: { eventManager, properties, repository },
80
+ ENTITY: item,
81
+ FUNCTION_TYPE: type_enum.EApiFunctionType.GET,
84
82
  result: item,
85
83
  };
86
84
  const afterResult = await executor_class.ApiSubscriberExecutor.executeFunctionSubscribers(constructor, item, type_enum.EApiFunctionType.GET, onType_enum.EApiSubscriberOnType.AFTER, executionContext);
@@ -92,9 +90,9 @@ async function executor(options) {
92
90
  catch (error) {
93
91
  const entityInstance = new entity();
94
92
  const executionContext = {
95
- data: { properties, eventManager, repository },
96
- entity: entityInstance,
97
- functionType: type_enum.EApiFunctionType.GET,
93
+ DATA: { eventManager, properties, repository },
94
+ ENTITY: entityInstance,
95
+ FUNCTION_TYPE: type_enum.EApiFunctionType.GET,
98
96
  };
99
97
  if (error instanceof common.HttpException) {
100
98
  await executor_class.ApiSubscriberExecutor.executeFunctionSubscribers(constructor, entityInstance, type_enum.EApiFunctionType.GET, onType_enum.EApiSubscriberOnType.AFTER_ERROR, executionContext, error);
@@ -1 +1 @@
1
- {"version":3,"file":"get.decorator.js","sources":["../../../../../../src/decorator/api/function/get.decorator.ts"],"sourcesContent":[null],"names":["EApiFunctionType","ApiSubscriberExecutor","EApiSubscriberOnType","ErrorException","NotFoundException","ErrorString","EErrorStringAction","HttpException","LoggerUtility","InternalServerErrorException"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAcA;;;;AAIG;AAEH;;;AAGG;AACG,SAAU,cAAc,CAA2B,UAA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gB,CAAC,GAAG;SAClC;AAED,QAAA,IAAI,KAAK,YAAYO,oBAAa,EAAE;YACnC,MAAMN,oCAAqB,CAAC,0BAA0B,CAAC,WAAW,EAAE,cAAc,EAAED,0BAAgB,CAAC,GAAG,EAAEE,gCAAoB,CAAC,WAAkB,EAAE,gBAAgB,EAAE,KAAK,CAAC;AAC3K,YAAA,MAAM,KAAK;;AAGZ,QAAAM,4BAAa,CAAC,SAAS,CAAC,gBAAgB,CAAC,CAAC,OAAO,CAAC,CAAA,sBAAA,EAAyB,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,KAAK,CAAC;QACzG,MAAMP,oCAAqB,CAAC,0BAA0B,CAAC,WAAW,EAAE,cAAc,EAAED,0BAAgB,CAAC,GAAG,EAAEE,gCAAoB,CAAC,WAAkB,EAAE,gBAAgB,EAAE,KAAc,CAAC;AAEpL,QAAA,MAAM,IAAIO,mCAA4B,CACrCJ,+BAAW,CAAC;YACX,MAAM;YACN,IAAI,EAAEC,8BAAkB,CAAC,cAAc;AACvC,SAAA,CAAC,CACF;;AAEH;;;;"}
1
+ {"version":3,"file":"get.decorator.js","sources":["../../../../../../src/decorator/api/function/get.decorator.ts"],"sourcesContent":[null],"names":["EApiFunctionType","ApiSubscriberExecutor","EApiSubscriberOnType","ErrorException","NotFoundException","ErrorString","EErrorStringAction","HttpException","LoggerUtility","InternalServerErrorException"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAcA;;;;;AAKG;AACG,SAAU,cAAc,CAA2B,UAAqC,EAAA;AAC7F,IAAA,MAAM,EAAE,MAAM,EAAE,GAA8B,UAAU;AAExD,IAAA,OAAO,UAAU,OAAgB,EAAE,YAAoB,EAAE,UAA8B,EAAA;AAMtF,QAAA,UAAU,CAAC,KAAK,GAAG,gBAAqD,aAA2C,EAAE,YAA4B,EAAA;AAChJ,YAAA,MAAM,cAAc,GAAM,IAAI,MAAM,EAAE;AAEtC,YAAA,MAAM,gBAAgB,GAA4E;gBACj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S,CAAC,gBAAgB,CAAC,CAAC,OAAO,CAAC,CAAA,sBAAA,EAAyB,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,KAAK,CAAC;QACzG,MAAMP,oCAAqB,CAAC,0BAA0B,CAAC,WAAW,EAAE,cAAc,EAAED,0BAAgB,CAAC,GAAG,EAAEE,gCAAoB,CAAC,WAAW,EAAE,gBAAgB,EAAE,KAAc,CAAC;AAE7K,QAAA,MAAM,IAAIO,mCAA4B,CACrCJ,+BAAW,CAAC;YACX,MAAM;YACN,IAAI,EAAEC,8BAAkB,CAAC,cAAc;AACvC,SAAA,CAAC,CACF;;AAEH;;;;"}
@@ -2,11 +2,8 @@ import type { IApiBaseEntity } from '../../../interface/api-base-entity.interfac
2
2
  import type { IApiFunctionProperties } from '../../../interface/decorator/api/function/index';
3
3
  /**
4
4
  * Creates a decorator that adds entity update functionality to a service method
5
- * @param {IApiFunctionProperties} properties - Configuration properties for the update function
5
+ * @template E The entity type
6
+ * @param {IApiFunctionProperties<E>} properties - Configuration properties for the update function
6
7
  * @returns {(target: unknown, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor} A decorator function that modifies the target method to handle entity updates
7
8
  */
8
- /**
9
- *
10
- * @param properties
11
- */
12
9
  export declare function ApiFunctionUpdate<E extends IApiBaseEntity>(properties: IApiFunctionProperties<E>): (target: unknown, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor;