@elsikora/nestjs-crud-automator 1.1.2 → 1.2.0

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 (286) hide show
  1. package/dist/class/api/base-controller.class.d.ts +4 -0
  2. package/dist/class/api/base-controller.class.js +10 -0
  3. package/dist/class/api/base-controller.class.js.map +1 -0
  4. package/dist/class/api/base-service.class.d.ts +7 -8
  5. package/dist/class/api/base-service.class.js +5 -5
  6. package/dist/class/api/base-service.class.js.map +1 -1
  7. package/dist/class/api/index.d.ts +1 -0
  8. package/dist/class/api/index.js +1 -0
  9. package/dist/class/api/index.js.map +1 -1
  10. package/dist/class/index.d.ts +1 -0
  11. package/dist/class/index.js +1 -0
  12. package/dist/class/index.js.map +1 -1
  13. package/dist/class/metadata-storage.class.d.ts +8 -0
  14. package/dist/class/metadata-storage.class.js +45 -0
  15. package/dist/class/metadata-storage.class.js.map +1 -0
  16. package/dist/constant/decorator/api/controller.constant.d.ts +3 -0
  17. package/dist/constant/decorator/api/controller.constant.js +8 -0
  18. package/dist/constant/decorator/api/controller.constant.js.map +1 -0
  19. package/dist/constant/decorator/api/index.d.ts +2 -0
  20. package/dist/constant/decorator/api/index.js +2 -0
  21. package/dist/constant/decorator/api/index.js.map +1 -1
  22. package/dist/constant/decorator/api/property-describe.constant.d.ts +3 -0
  23. package/dist/constant/decorator/api/property-describe.constant.js +8 -0
  24. package/dist/constant/decorator/api/property-describe.constant.js.map +1 -0
  25. package/dist/constant/factory/dto/get-list-query.constant.d.ts +7 -0
  26. package/dist/constant/factory/dto/get-list-query.constant.js +14 -0
  27. package/dist/constant/factory/dto/get-list-query.constant.js.map +1 -0
  28. package/dist/constant/factory/dto/index.d.ts +1 -0
  29. package/dist/constant/factory/dto/index.js +18 -0
  30. package/dist/constant/factory/dto/index.js.map +1 -0
  31. package/dist/constant/factory/index.d.ts +1 -0
  32. package/dist/constant/factory/index.js +18 -0
  33. package/dist/constant/factory/index.js.map +1 -0
  34. package/dist/constant/index.d.ts +1 -0
  35. package/dist/constant/index.js +1 -0
  36. package/dist/constant/index.js.map +1 -1
  37. package/dist/constant/interface/api/filter.constant.d.ts +1 -1
  38. package/dist/constant/interface/api/filter.constant.js +1 -5
  39. package/dist/constant/interface/api/filter.constant.js.map +1 -1
  40. package/dist/decorator/api/controller.decorator.d.ts +7 -9
  41. package/dist/decorator/api/controller.decorator.js +13 -26
  42. package/dist/decorator/api/controller.decorator.js.map +1 -1
  43. package/dist/decorator/api/function/create.decorator.d.ts +1 -1
  44. package/dist/decorator/api/function/create.decorator.js +4 -5
  45. package/dist/decorator/api/function/create.decorator.js.map +1 -1
  46. package/dist/decorator/api/function/decorator.d.ts +2 -2
  47. package/dist/decorator/api/function/decorator.js +10 -10
  48. package/dist/decorator/api/function/decorator.js.map +1 -1
  49. package/dist/decorator/api/function/delete.decorator.d.ts +1 -1
  50. package/dist/decorator/api/function/delete.decorator.js +6 -4
  51. package/dist/decorator/api/function/delete.decorator.js.map +1 -1
  52. package/dist/decorator/api/function/get-list.decorator.js +5 -5
  53. package/dist/decorator/api/function/get-list.decorator.js.map +1 -1
  54. package/dist/decorator/api/function/get.decorator.js +3 -3
  55. package/dist/decorator/api/function/get.decorator.js.map +1 -1
  56. package/dist/decorator/api/function/update.decorator.d.ts +1 -1
  57. package/dist/decorator/api/function/update.decorator.js +10 -9
  58. package/dist/decorator/api/function/update.decorator.js.map +1 -1
  59. package/dist/decorator/api/method.decorator.js.map +1 -1
  60. package/dist/decorator/api/property/boolean.decorator.js.map +1 -1
  61. package/dist/decorator/api/property/date.decorator.js +1 -1
  62. package/dist/decorator/api/property/date.decorator.js.map +1 -1
  63. package/dist/decorator/api/property/describe.decorator.d.ts +2 -0
  64. package/dist/decorator/api/property/describe.decorator.js +12 -0
  65. package/dist/decorator/api/property/describe.decorator.js.map +1 -0
  66. package/dist/decorator/api/property/index.d.ts +1 -0
  67. package/dist/decorator/api/property/index.js +1 -0
  68. package/dist/decorator/api/property/index.js.map +1 -1
  69. package/dist/decorator/api/property/number.decorator.js +1 -1
  70. package/dist/decorator/api/property/number.decorator.js.map +1 -1
  71. package/dist/decorator/api/property/object.decorator.js.map +1 -1
  72. package/dist/decorator/api/property/string.decorator.js.map +1 -1
  73. package/dist/decorator/api/property/uuid.decorator.js.map +1 -1
  74. package/dist/decorator/api/property/wallet.decorator.js.map +1 -1
  75. package/dist/decorator/api/route/decorator.d.ts +5 -5
  76. package/dist/decorator/api/route/decorator.js +3 -4
  77. package/dist/decorator/api/route/decorator.js.map +1 -1
  78. package/dist/decorator/api/route/get.decorator.d.ts +5 -5
  79. package/dist/decorator/api/route/get.decorator.js +9 -8
  80. package/dist/decorator/api/route/get.decorator.js.map +1 -1
  81. package/dist/decorator/api/service.decorator.d.ts +3 -5
  82. package/dist/decorator/api/service.decorator.js +40 -40
  83. package/dist/decorator/api/service.decorator.js.map +1 -1
  84. package/dist/dto/exception/bad-request.dto.js +1 -1
  85. package/dist/dto/exception/bad-request.dto.js.map +1 -1
  86. package/dist/dto/exception/conflict.dto.js +1 -1
  87. package/dist/dto/exception/conflict.dto.js.map +1 -1
  88. package/dist/dto/exception/forbidden.dto.js +1 -1
  89. package/dist/dto/exception/forbidden.dto.js.map +1 -1
  90. package/dist/dto/exception/internal-server-error.dto.js +1 -1
  91. package/dist/dto/exception/internal-server-error.dto.js.map +1 -1
  92. package/dist/dto/exception/not-found.dto.js +1 -1
  93. package/dist/dto/exception/not-found.dto.js.map +1 -1
  94. package/dist/dto/exception/too-many-requests.dto.js +1 -1
  95. package/dist/dto/exception/too-many-requests.dto.js.map +1 -1
  96. package/dist/dto/exception/unauthorized.dto.js +1 -1
  97. package/dist/dto/exception/unauthorized.dto.js.map +1 -1
  98. package/dist/enum/decorator/api/dto-type.enum.d.ts +6 -0
  99. package/dist/enum/decorator/api/dto-type.enum.js +11 -0
  100. package/dist/enum/decorator/api/dto-type.enum.js.map +1 -0
  101. package/dist/enum/decorator/api/function/type.enum.d.ts +5 -5
  102. package/dist/enum/decorator/api/function/type.enum.js +4 -4
  103. package/dist/enum/decorator/api/function/type.enum.js.map +1 -1
  104. package/dist/enum/decorator/api/index.d.ts +2 -0
  105. package/dist/enum/decorator/api/index.js +2 -0
  106. package/dist/enum/decorator/api/index.js.map +1 -1
  107. package/dist/enum/decorator/api/property/desribe-type.enum.d.ts +8 -0
  108. package/dist/enum/decorator/api/property/desribe-type.enum.js +13 -0
  109. package/dist/enum/decorator/api/property/desribe-type.enum.js.map +1 -0
  110. package/dist/enum/decorator/api/property/index.d.ts +1 -0
  111. package/dist/enum/decorator/api/property/index.js +1 -0
  112. package/dist/enum/decorator/api/property/index.js.map +1 -1
  113. package/dist/enum/decorator/api/{controller/type.enum.d.ts → route-type.enum.d.ts} +4 -6
  114. package/dist/enum/decorator/api/{controller/type.enum.js → route-type.enum.js} +5 -7
  115. package/dist/enum/decorator/api/route-type.enum.js.map +1 -0
  116. package/dist/factory/api/controller.factory.d.ts +28 -1
  117. package/dist/factory/api/controller.factory.js +200 -0
  118. package/dist/factory/api/controller.factory.js.map +1 -1
  119. package/dist/helper/index.d.ts +1 -1
  120. package/dist/helper/index.js +0 -15
  121. package/dist/helper/index.js.map +1 -1
  122. package/dist/interceptor/correlation-id-response-body.interceptor.js.map +1 -1
  123. package/dist/interface/api-base-entity.interface.d.ts +2 -1
  124. package/dist/interface/api-base-entity.interface.js.map +1 -1
  125. package/dist/interface/decorator/api/base-controller.interface.d.ts +2 -5
  126. package/dist/interface/decorator/api/base-controller.interface.js.map +1 -1
  127. package/dist/interface/decorator/api/controller-properties.interface.d.ts +16 -20
  128. package/dist/interface/decorator/api/controller-properties.interface.js +0 -1
  129. package/dist/interface/decorator/api/controller-properties.interface.js.map +1 -1
  130. package/dist/interface/decorator/api/method/properties.interface.d.ts +3 -3
  131. package/dist/interface/decorator/api/method/properties.interface.js.map +1 -1
  132. package/dist/interface/decorator/api/property/date-properties.interface.d.ts +1 -1
  133. package/dist/interface/decorator/api/property/date-properties.interface.js.map +1 -1
  134. package/dist/interface/decorator/api/property/object-properties.interface.d.ts +1 -1
  135. package/dist/interface/decorator/api/property/object-properties.interface.js.map +1 -1
  136. package/dist/interface/decorator/api/property/string-properties.interface.d.ts +1 -1
  137. package/dist/interface/decorator/api/property/string-properties.interface.js.map +1 -1
  138. package/dist/interface/entity/column.interface.d.ts +7 -0
  139. package/dist/interface/entity/column.interface.js +3 -0
  140. package/dist/interface/entity/column.interface.js.map +1 -0
  141. package/dist/interface/entity/index.d.ts +2 -0
  142. package/dist/interface/entity/index.js +19 -0
  143. package/dist/interface/entity/index.js.map +1 -0
  144. package/dist/interface/entity/interface.d.ts +7 -0
  145. package/dist/interface/entity/interface.js +3 -0
  146. package/dist/interface/entity/interface.js.map +1 -0
  147. package/dist/interface/index.d.ts +1 -0
  148. package/dist/interface/index.js +1 -0
  149. package/dist/interface/index.js.map +1 -1
  150. package/dist/tsconfig.build.tsbuildinfo +1 -1
  151. package/dist/type/decorator/api/filter/allowed-types.type.d.ts +1 -0
  152. package/dist/type/decorator/api/filter/allowed-types.type.js.map +1 -0
  153. package/dist/type/{api → decorator/api}/filter/extracted-allowed-types.type.d.ts +1 -1
  154. package/dist/type/decorator/api/filter/extracted-allowed-types.type.js.map +1 -0
  155. package/dist/type/decorator/api/filter/field-selector.type.js.map +1 -0
  156. package/dist/type/decorator/api/filter/index.js.map +1 -0
  157. package/dist/type/decorator/api/filter/order-by.type.d.ts +4 -0
  158. package/dist/type/decorator/api/filter/order-by.type.js.map +1 -0
  159. package/dist/type/decorator/api/function/create-properties.type.d.ts +1 -0
  160. package/dist/type/decorator/api/function/create-properties.type.js.map +1 -0
  161. package/dist/type/decorator/api/function/get-list-properties.type.d.ts +23 -0
  162. package/dist/type/decorator/api/function/get-list-properties.type.js.map +1 -0
  163. package/dist/type/decorator/api/function/get-properties.type.d.ts +6 -0
  164. package/dist/type/decorator/api/function/get-properties.type.js.map +1 -0
  165. package/dist/type/decorator/api/function/index.js.map +1 -0
  166. package/dist/type/decorator/api/function/update-properties.type.d.ts +1 -0
  167. package/dist/type/decorator/api/function/update-properties.type.js.map +1 -0
  168. package/dist/type/{api → decorator/api}/index.d.ts +1 -0
  169. package/dist/type/{api → decorator/api}/index.js +1 -0
  170. package/dist/type/decorator/api/index.js.map +1 -0
  171. package/dist/type/decorator/api/property/describe-properties.type.d.ts +64 -0
  172. package/dist/type/decorator/api/property/describe-properties.type.js +3 -0
  173. package/dist/type/decorator/api/property/describe-properties.type.js.map +1 -0
  174. package/dist/type/decorator/api/property/index.d.ts +1 -0
  175. package/dist/type/decorator/api/property/index.js +18 -0
  176. package/dist/type/decorator/api/property/index.js.map +1 -0
  177. package/dist/type/decorator/index.d.ts +1 -0
  178. package/dist/type/decorator/index.js +18 -0
  179. package/dist/type/decorator/index.js.map +1 -0
  180. package/dist/type/factory/api/controller/index.d.ts +1 -0
  181. package/dist/type/factory/api/controller/index.js +18 -0
  182. package/dist/type/factory/api/controller/index.js.map +1 -0
  183. package/dist/type/factory/api/controller/target-methods.type.d.ts +1 -0
  184. package/dist/type/factory/api/controller/target-methods.type.js +3 -0
  185. package/dist/type/factory/api/controller/target-methods.type.js.map +1 -0
  186. package/dist/type/factory/api/index.d.ts +1 -0
  187. package/dist/type/factory/api/index.js +18 -0
  188. package/dist/type/factory/api/index.js.map +1 -0
  189. package/dist/type/factory/index.d.ts +1 -0
  190. package/dist/type/factory/index.js +18 -0
  191. package/dist/type/factory/index.js.map +1 -0
  192. package/dist/type/index.d.ts +2 -1
  193. package/dist/type/index.js +2 -1
  194. package/dist/type/index.js.map +1 -1
  195. package/dist/utility/api/controller/get-method-name.utility.d.ts +2 -0
  196. package/dist/utility/api/controller/get-method-name.utility.js +9 -0
  197. package/dist/utility/api/controller/get-method-name.utility.js.map +1 -0
  198. package/dist/utility/api/controller/index.d.ts +2 -0
  199. package/dist/utility/api/controller/index.js +19 -0
  200. package/dist/utility/api/controller/index.js.map +1 -0
  201. package/dist/utility/api/controller/write-method.utility.d.ts +3 -0
  202. package/dist/utility/api/controller/write-method.utility.js +13 -0
  203. package/dist/utility/api/controller/write-method.utility.js.map +1 -0
  204. package/dist/utility/api/filter-order-by-from-entity.utility.d.ts +3 -3
  205. package/dist/utility/api/filter-order-by-from-entity.utility.js +15 -12
  206. package/dist/utility/api/filter-order-by-from-entity.utility.js.map +1 -1
  207. package/dist/utility/api/index.d.ts +1 -0
  208. package/dist/utility/api/index.js +1 -0
  209. package/dist/utility/api/index.js.map +1 -1
  210. package/dist/utility/capitalize-string.utility.d.ts +1 -0
  211. package/dist/utility/capitalize-string.utility.js +7 -0
  212. package/dist/utility/capitalize-string.utility.js.map +1 -0
  213. package/dist/utility/dto/analize.utility.d.ts +1 -0
  214. package/dist/utility/dto/analize.utility.js +10 -0
  215. package/dist/utility/dto/analize.utility.js.map +1 -0
  216. package/dist/utility/dto/generate.utility.d.ts +5 -0
  217. package/dist/utility/dto/generate.utility.js +365 -0
  218. package/dist/utility/dto/generate.utility.js.map +1 -0
  219. package/dist/utility/dto/index.d.ts +1 -0
  220. package/dist/utility/dto/index.js +18 -0
  221. package/dist/utility/dto/index.js.map +1 -0
  222. package/dist/utility/error-exception.utility.d.ts +1 -0
  223. package/dist/utility/error-exception.utility.js +7 -0
  224. package/dist/utility/error-exception.utility.js.map +1 -0
  225. package/dist/utility/generate-entity-information.utility.d.ts +2 -0
  226. package/dist/utility/generate-entity-information.utility.js +51 -0
  227. package/dist/utility/generate-entity-information.utility.js.map +1 -0
  228. package/dist/utility/get-entity-columns.utility.d.ts +1 -1
  229. package/dist/utility/get-entity-columns.utility.js +2 -4
  230. package/dist/utility/get-entity-columns.utility.js.map +1 -1
  231. package/dist/utility/index.d.ts +4 -0
  232. package/dist/utility/index.js +4 -0
  233. package/dist/utility/index.js.map +1 -1
  234. package/dist/validator/all-or-none-of-listed-properties.validator.d.ts +5 -0
  235. package/dist/validator/all-or-none-of-listed-properties.validator.js +29 -0
  236. package/dist/validator/all-or-none-of-listed-properties.validator.js.map +1 -0
  237. package/dist/validator/has-at-least-one-and-only-one-of-listed-properties.validator.d.ts +5 -0
  238. package/dist/validator/has-at-least-one-and-only-one-of-listed-properties.validator.js +39 -0
  239. package/dist/validator/has-at-least-one-and-only-one-of-listed-properties.validator.js.map +1 -0
  240. package/dist/validator/has-at-least-one-of-listed-properties.validator.d.ts +5 -0
  241. package/dist/validator/has-at-least-one-of-listed-properties.validator.js +35 -0
  242. package/dist/validator/has-at-least-one-of-listed-properties.validator.js.map +1 -0
  243. package/dist/validator/has-at-least-one-property.validator.d.ts +5 -0
  244. package/dist/validator/has-at-least-one-property.validator.js +23 -0
  245. package/dist/validator/has-at-least-one-property.validator.js.map +1 -0
  246. package/dist/validator/index.d.ts +5 -0
  247. package/dist/validator/index.js +5 -0
  248. package/dist/validator/index.js.map +1 -1
  249. package/dist/validator/only-one-of-listed-properties.validator.d.ts +5 -0
  250. package/dist/validator/only-one-of-listed-properties.validator.js +37 -0
  251. package/dist/validator/only-one-of-listed-properties.validator.js.map +1 -0
  252. package/package.json +5 -3
  253. package/dist/enum/decorator/api/controller/type.enum.js.map +0 -1
  254. package/dist/helper/reflector.helper.d.ts +0 -20
  255. package/dist/helper/reflector.helper.js +0 -77
  256. package/dist/helper/reflector.helper.js.map +0 -1
  257. package/dist/type/api/filter/allowed-types.type.d.ts +0 -1
  258. package/dist/type/api/filter/allowed-types.type.js.map +0 -1
  259. package/dist/type/api/filter/extracted-allowed-types.type.js.map +0 -1
  260. package/dist/type/api/filter/field-selector.type.js.map +0 -1
  261. package/dist/type/api/filter/index.js.map +0 -1
  262. package/dist/type/api/filter/order-by.type.d.ts +0 -5
  263. package/dist/type/api/filter/order-by.type.js.map +0 -1
  264. package/dist/type/api/function/create-properties.type.d.ts +0 -2
  265. package/dist/type/api/function/create-properties.type.js.map +0 -1
  266. package/dist/type/api/function/get-list-properties.type.d.ts +0 -23
  267. package/dist/type/api/function/get-list-properties.type.js.map +0 -1
  268. package/dist/type/api/function/get-properties.type.d.ts +0 -6
  269. package/dist/type/api/function/get-properties.type.js.map +0 -1
  270. package/dist/type/api/function/index.js.map +0 -1
  271. package/dist/type/api/function/update-properties.type.d.ts +0 -2
  272. package/dist/type/api/function/update-properties.type.js.map +0 -1
  273. package/dist/type/api/index.js.map +0 -1
  274. /package/dist/type/{api → decorator/api}/filter/allowed-types.type.js +0 -0
  275. /package/dist/type/{api → decorator/api}/filter/extracted-allowed-types.type.js +0 -0
  276. /package/dist/type/{api → decorator/api}/filter/field-selector.type.d.ts +0 -0
  277. /package/dist/type/{api → decorator/api}/filter/field-selector.type.js +0 -0
  278. /package/dist/type/{api → decorator/api}/filter/index.d.ts +0 -0
  279. /package/dist/type/{api → decorator/api}/filter/index.js +0 -0
  280. /package/dist/type/{api → decorator/api}/filter/order-by.type.js +0 -0
  281. /package/dist/type/{api → decorator/api}/function/create-properties.type.js +0 -0
  282. /package/dist/type/{api → decorator/api}/function/get-list-properties.type.js +0 -0
  283. /package/dist/type/{api → decorator/api}/function/get-properties.type.js +0 -0
  284. /package/dist/type/{api → decorator/api}/function/index.d.ts +0 -0
  285. /package/dist/type/{api → decorator/api}/function/index.js +0 -0
  286. /package/dist/type/{api → decorator/api}/function/update-properties.type.js +0 -0
@@ -0,0 +1,4 @@
1
+ import type { BaseEntity } from "typeorm";
2
+ export declare class BaseApiController<E extends BaseEntity> {
3
+ get(_properties?: any): Promise<E>;
4
+ }
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BaseApiController = void 0;
4
+ class BaseApiController {
5
+ get(_properties) {
6
+ return null;
7
+ }
8
+ }
9
+ exports.BaseApiController = BaseApiController;
10
+ //# sourceMappingURL=base-controller.class.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base-controller.class.js","sourceRoot":"/","sources":["class/api/base-controller.class.ts"],"names":[],"mappings":";;;AAEA,MAAa,iBAAiB;IAC7B,GAAG,CAAC,WAAiB;QACpB,OAAO,IAAW,CAAC;IACpB,CAAC;CACD;AAJD,8CAIC","sourcesContent":["import type { BaseEntity } from \"typeorm\";\n\nexport class BaseApiController<E extends BaseEntity> {\n\tget(_properties?: any): Promise<E> {\n\t\treturn null as any;\n\t}\n}\n"]}
@@ -1,11 +1,10 @@
1
- import { IApiGetListResponseResult } from "../../interface";
2
- import { BaseEntity, type FindOptionsRelations } from "typeorm";
3
- import { TApiFunctionCreateProperties, TApiFunctionGetListProperties, TApiFunctionUpdateProperties } from "../../type";
4
- import { TApiFunctionGetProperties } from "../../type/api/function/get-properties.type";
5
- export declare class BaseApiService<E extends BaseEntity> {
6
- getList(_properties: TApiFunctionGetListProperties<E>, _relations?: FindOptionsRelations<E>): Promise<IApiGetListResponseResult<E>>;
7
- get(_id: string, _properties?: TApiFunctionGetProperties<E>, _relations?: FindOptionsRelations<E>): Promise<E>;
1
+ import type { IApiGetListResponseResult } from "../../interface";
2
+ import type { TApiFunctionCreateProperties, TApiFunctionGetListProperties, TApiFunctionGetProperties, TApiFunctionUpdateProperties } from "../../type";
3
+ import type { FindOptionsRelations } from "typeorm";
4
+ export declare class BaseApiService<E> {
8
5
  create(_properties: TApiFunctionCreateProperties<E>): Promise<E>;
9
- update(_id: string, _properties: TApiFunctionUpdateProperties<E>): Promise<E>;
10
6
  delete(_id: string): Promise<void>;
7
+ get(_id: string, _properties?: TApiFunctionGetProperties<E>, _relations?: FindOptionsRelations<E>): Promise<E>;
8
+ getList(_properties: TApiFunctionGetListProperties<E>, _relations?: FindOptionsRelations<E>): Promise<IApiGetListResponseResult<E>>;
9
+ update(_id: string, _properties: TApiFunctionUpdateProperties<E>): Promise<E>;
11
10
  }
@@ -2,19 +2,19 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.BaseApiService = void 0;
4
4
  class BaseApiService {
5
- getList(_properties, _relations) {
5
+ create(_properties) {
6
6
  return null;
7
7
  }
8
- get(_id, _properties, _relations) {
8
+ delete(_id) {
9
9
  return null;
10
10
  }
11
- create(_properties) {
11
+ get(_id, _properties, _relations) {
12
12
  return null;
13
13
  }
14
- update(_id, _properties) {
14
+ getList(_properties, _relations) {
15
15
  return null;
16
16
  }
17
- delete(_id) {
17
+ update(_id, _properties) {
18
18
  return null;
19
19
  }
20
20
  }
@@ -1 +1 @@
1
- {"version":3,"file":"base-service.class.js","sourceRoot":"/","sources":["class/api/base-service.class.ts"],"names":[],"mappings":";;;AAKA,MAAa,cAAc;IACvB,OAAO,CAAC,WAA6C,EAAE,UAAoC;QACvF,OAAO,IAAW,CAAC;IACvB,CAAC;IAED,GAAG,CAAC,GAAW,EAAE,WAA0C,EAAE,UAAoC;QAC7F,OAAO,IAAW,CAAC;IACvB,CAAC;IAED,MAAM,CAAC,WAA4C;QAC/C,OAAO,IAAW,CAAC;IACvB,CAAC;IAED,MAAM,CAAC,GAAW,EAAE,WAA4C;QAC5D,OAAO,IAAW,CAAC;IACvB,CAAC;IAED,MAAM,CAAC,GAAW;QACd,OAAO,IAAW,CAAC;IACvB,CAAC;CACJ;AApBD,wCAoBC","sourcesContent":["import { IApiGetListResponseResult } from \"../../interface\";\nimport {BaseEntity, type FindOptionsRelations} from \"typeorm\";\nimport {TApiFunctionCreateProperties, TApiFunctionGetListProperties, TApiFunctionUpdateProperties} from \"../../type\";\nimport {TApiFunctionGetProperties} from \"../../type/api/function/get-properties.type\";\n\nexport class BaseApiService<E extends BaseEntity> {\n getList(_properties: TApiFunctionGetListProperties<E>, _relations?: FindOptionsRelations<E>): Promise<IApiGetListResponseResult<E>> {\n return null as any;\n }\n\n get(_id: string, _properties?: TApiFunctionGetProperties<E>, _relations?: FindOptionsRelations<E>): Promise<E> {\n return null as any;\n }\n\n create(_properties: TApiFunctionCreateProperties<E>): Promise<E> {\n return null as any;\n }\n\n update(_id: string, _properties: TApiFunctionUpdateProperties<E>): Promise<E> {\n return null as any;\n }\n\n delete(_id: string): Promise<void> {\n return null as any;\n }\n}\n"]}
1
+ {"version":3,"file":"base-service.class.js","sourceRoot":"/","sources":["class/api/base-service.class.ts"],"names":[],"mappings":";;;AAMA,MAAa,cAAc;IAC1B,MAAM,CAAC,WAA4C;QAClD,OAAO,IAAW,CAAC;IACpB,CAAC;IAED,MAAM,CAAC,GAAW;QACjB,OAAO,IAAW,CAAC;IACpB,CAAC;IAED,GAAG,CAAC,GAAW,EAAE,WAA0C,EAAE,UAAoC;QAChG,OAAO,IAAW,CAAC;IACpB,CAAC;IAED,OAAO,CAAC,WAA6C,EAAE,UAAoC;QAC1F,OAAO,IAAW,CAAC;IACpB,CAAC;IAED,MAAM,CAAC,GAAW,EAAE,WAA4C;QAC/D,OAAO,IAAW,CAAC;IACpB,CAAC;CACD;AApBD,wCAoBC","sourcesContent":["import type { IApiGetListResponseResult } from \"../../interface\";\n\nimport type { TApiFunctionCreateProperties, TApiFunctionGetListProperties, TApiFunctionGetProperties, TApiFunctionUpdateProperties } from \"../../type\";\n\nimport type { FindOptionsRelations } from \"typeorm\";\n\nexport class BaseApiService<E> {\n\tcreate(_properties: TApiFunctionCreateProperties<E>): Promise<E> {\n\t\treturn null as any;\n\t}\n\n\tdelete(_id: string): Promise<void> {\n\t\treturn null as any;\n\t}\n\n\tget(_id: string, _properties?: TApiFunctionGetProperties<E>, _relations?: FindOptionsRelations<E>): Promise<E> {\n\t\treturn null as any;\n\t}\n\n\tgetList(_properties: TApiFunctionGetListProperties<E>, _relations?: FindOptionsRelations<E>): Promise<IApiGetListResponseResult<E>> {\n\t\treturn null as any;\n\t}\n\n\tupdate(_id: string, _properties: TApiFunctionUpdateProperties<E>): Promise<E> {\n\t\treturn null as any;\n\t}\n}\n"]}
@@ -1 +1,2 @@
1
1
  export * from "./base-service.class";
2
+ export * from "./base-controller.class";
@@ -15,4 +15,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./base-service.class"), exports);
18
+ __exportStar(require("./base-controller.class"), exports);
18
19
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"/","sources":["class/api/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uDAAqC","sourcesContent":["export * from \"./base-service.class\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"/","sources":["class/api/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uDAAqC;AACrC,0DAAwC","sourcesContent":["export * from \"./base-service.class\";\nexport * from \"./base-controller.class\";\n"]}
@@ -1 +1,2 @@
1
1
  export * from "./api";
2
+ export * from "./metadata-storage.class";
@@ -15,4 +15,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./api"), exports);
18
+ __exportStar(require("./metadata-storage.class"), exports);
18
19
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"/","sources":["class/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wCAAsB","sourcesContent":["export * from \"./api\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"/","sources":["class/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wCAAsB;AACtB,2DAAyC","sourcesContent":["export * from \"./api\";\nexport * from \"./metadata-storage.class\";\n"]}
@@ -0,0 +1,8 @@
1
+ export declare class MetadataStorage {
2
+ private static instance;
3
+ private readonly STORAGE;
4
+ static getInstance(): MetadataStorage;
5
+ getAllEntitiesMetadata(): Record<string, Record<string, any>>;
6
+ getMetadata(entityName: string, propertyName?: string, key?: string): any;
7
+ setMetadata(entityName: string, propertyName: string, key: string, value: unknown): void;
8
+ }
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MetadataStorage = void 0;
4
+ class MetadataStorage {
5
+ static instance;
6
+ STORAGE = new Map();
7
+ static getInstance() {
8
+ if (!MetadataStorage.instance) {
9
+ MetadataStorage.instance = new MetadataStorage();
10
+ }
11
+ return MetadataStorage.instance;
12
+ }
13
+ getAllEntitiesMetadata() {
14
+ const result = {};
15
+ for (const [entityName, entityMetadata] of this.STORAGE.entries()) {
16
+ result[entityName] = Object.fromEntries(entityMetadata);
17
+ }
18
+ return result;
19
+ }
20
+ getMetadata(entityName, propertyName, key) {
21
+ const entityMetadata = this.STORAGE.get(entityName);
22
+ if (!entityMetadata)
23
+ return undefined;
24
+ if (!propertyName)
25
+ return Object.fromEntries(entityMetadata);
26
+ const propertyMetadata = entityMetadata.get(propertyName);
27
+ if (!propertyMetadata)
28
+ return undefined;
29
+ if (!key)
30
+ return propertyMetadata;
31
+ return propertyMetadata[key];
32
+ }
33
+ setMetadata(entityName, propertyName, key, value) {
34
+ if (!this.STORAGE.has(entityName)) {
35
+ this.STORAGE.set(entityName, new Map());
36
+ }
37
+ const entityMetadata = this.STORAGE.get(entityName);
38
+ if (!entityMetadata.has(propertyName)) {
39
+ entityMetadata.set(propertyName, {});
40
+ }
41
+ entityMetadata.get(propertyName)[key] = value;
42
+ }
43
+ }
44
+ exports.MetadataStorage = MetadataStorage;
45
+ //# sourceMappingURL=metadata-storage.class.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"metadata-storage.class.js","sourceRoot":"/","sources":["class/metadata-storage.class.ts"],"names":[],"mappings":";;;AAAA,MAAa,eAAe;IACnB,MAAM,CAAC,QAAQ,CAAkB;IAExB,OAAO,GAAkC,IAAI,GAAG,EAA4B,CAAC;IAEvF,MAAM,CAAC,WAAW;QACxB,IAAI,CAAC,eAAe,CAAC,QAAQ,EAAE,CAAC;YAC/B,eAAe,CAAC,QAAQ,GAAG,IAAI,eAAe,EAAE,CAAC;QAClD,CAAC;QAED,OAAO,eAAe,CAAC,QAAQ,CAAC;IACjC,CAAC;IAEM,sBAAsB;QAC5B,MAAM,MAAM,GAAwC,EAAE,CAAC;QAEvD,KAAK,MAAM,CAAC,UAAU,EAAE,cAAc,CAAC,IAAI,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC;YACnE,MAAM,CAAC,UAAU,CAAC,GAAG,MAAM,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC;QACzD,CAAC;QAED,OAAO,MAAM,CAAC;IACf,CAAC;IAEM,WAAW,CAAC,UAAkB,EAAE,YAAqB,EAAE,GAAY;QACzE,MAAM,cAAc,GAAiC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;QAElF,IAAI,CAAC,cAAc;YAAE,OAAO,SAAS,CAAC;QAEtC,IAAI,CAAC,YAAY;YAAE,OAAO,MAAM,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC;QAC7D,MAAM,gBAAgB,GAAY,cAAc,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;QAEnE,IAAI,CAAC,gBAAgB;YAAE,OAAO,SAAS,CAAC;QAExC,IAAI,CAAC,GAAG;YAAE,OAAO,gBAAgB,CAAC;QAIlC,OAAO,gBAAgB,CAAC,GAAG,CAAC,CAAC;IAC9B,CAAC;IAEM,WAAW,CAAC,UAAkB,EAAE,YAAoB,EAAE,GAAW,EAAE,KAAc;QACvF,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE,CAAC;YACnC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,IAAI,GAAG,EAAE,CAAC,CAAC;QACzC,CAAC;QACD,MAAM,cAAc,GAAqB,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,UAAU,CAAE,CAAC;QAEvE,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,YAAY,CAAC,EAAE,CAAC;YACvC,cAAc,CAAC,GAAG,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC;QACtC,CAAC;QAED,cAAc,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;IAC/C,CAAC;CACD;AApDD,0CAoDC","sourcesContent":["export class MetadataStorage {\n\tprivate static instance: MetadataStorage;\n\n\tprivate readonly STORAGE: Map<string, Map<string, any>> = new Map<string, Map<string, any>>();\n\n\tpublic static getInstance(): MetadataStorage {\n\t\tif (!MetadataStorage.instance) {\n\t\t\tMetadataStorage.instance = new MetadataStorage();\n\t\t}\n\n\t\treturn MetadataStorage.instance;\n\t}\n\n\tpublic getAllEntitiesMetadata(): Record<string, Record<string, any>> {\n\t\tconst result: Record<string, Record<string, any>> = {};\n\n\t\tfor (const [entityName, entityMetadata] of this.STORAGE.entries()) {\n\t\t\tresult[entityName] = Object.fromEntries(entityMetadata);\n\t\t}\n\n\t\treturn result;\n\t}\n\n\tpublic getMetadata(entityName: string, propertyName?: string, key?: string): any {\n\t\tconst entityMetadata: Map<string, any> | undefined = this.STORAGE.get(entityName);\n\n\t\tif (!entityMetadata) return undefined;\n\n\t\tif (!propertyName) return Object.fromEntries(entityMetadata);\n\t\tconst propertyMetadata: unknown = entityMetadata.get(propertyName);\n\n\t\tif (!propertyMetadata) return undefined;\n\n\t\tif (!key) return propertyMetadata;\n\n\t\t// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n\t\t// @ts-expect-error\n\t\treturn propertyMetadata[key];\n\t}\n\n\tpublic setMetadata(entityName: string, propertyName: string, key: string, value: unknown): void {\n\t\tif (!this.STORAGE.has(entityName)) {\n\t\t\tthis.STORAGE.set(entityName, new Map());\n\t\t}\n\t\tconst entityMetadata: Map<string, any> = this.STORAGE.get(entityName)!;\n\n\t\tif (!entityMetadata.has(propertyName)) {\n\t\t\tentityMetadata.set(propertyName, {});\n\t\t}\n\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n\t\tentityMetadata.get(propertyName)[key] = value;\n\t}\n}\n"]}
@@ -0,0 +1,3 @@
1
+ export declare const API_CONTROLLER_DECORATOR_CONSTANT: {
2
+ readonly RESERVED_METHOD_PREFIX: string;
3
+ };
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.API_CONTROLLER_DECORATOR_CONSTANT = void 0;
4
+ const RESERVED_METHOD_PREFIX = "apiController";
5
+ exports.API_CONTROLLER_DECORATOR_CONSTANT = {
6
+ RESERVED_METHOD_PREFIX,
7
+ };
8
+ //# sourceMappingURL=controller.constant.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"controller.constant.js","sourceRoot":"/","sources":["constant/decorator/api/controller.constant.ts"],"names":[],"mappings":";;;AAAA,MAAM,sBAAsB,GAAW,eAAe,CAAC;AAE1C,QAAA,iCAAiC,GAE1C;IACH,sBAAsB;CACb,CAAC","sourcesContent":["const RESERVED_METHOD_PREFIX: string = \"apiController\";\n\nexport const API_CONTROLLER_DECORATOR_CONSTANT: {\n\treadonly RESERVED_METHOD_PREFIX: string;\n} = {\n\tRESERVED_METHOD_PREFIX,\n} as const;\n"]}
@@ -1 +1,3 @@
1
1
  export * from "./function.constant";
2
+ export * from "./controller.constant";
3
+ export * from "./property-describe.constant";
@@ -15,4 +15,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./function.constant"), exports);
18
+ __exportStar(require("./controller.constant"), exports);
19
+ __exportStar(require("./property-describe.constant"), exports);
18
20
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"/","sources":["constant/decorator/api/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,sDAAoC","sourcesContent":["export * from \"./function.constant\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"/","sources":["constant/decorator/api/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,sDAAoC;AACpC,wDAAsC;AACtC,+DAA6C","sourcesContent":["export * from \"./function.constant\";\nexport * from \"./controller.constant\";\nexport * from \"./property-describe.constant\";\n"]}
@@ -0,0 +1,3 @@
1
+ export declare const API_PROPERTY_DESCRIBE_DECORATOR_CONSTANT: {
2
+ readonly METADATA_PROPERTY_NAME: string;
3
+ };
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.API_PROPERTY_DESCRIBE_DECORATOR_CONSTANT = void 0;
4
+ const METADATA_PROPERTY_NAME = "API_PROPERTY_DESCRIBE";
5
+ exports.API_PROPERTY_DESCRIBE_DECORATOR_CONSTANT = {
6
+ METADATA_PROPERTY_NAME,
7
+ };
8
+ //# sourceMappingURL=property-describe.constant.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"property-describe.constant.js","sourceRoot":"/","sources":["constant/decorator/api/property-describe.constant.ts"],"names":[],"mappings":";;;AAAA,MAAM,sBAAsB,GAAW,uBAAuB,CAAC;AAElD,QAAA,wCAAwC,GAEjD;IACH,sBAAsB;CACb,CAAC","sourcesContent":["const METADATA_PROPERTY_NAME: string = \"API_PROPERTY_DESCRIBE\";\n\nexport const API_PROPERTY_DESCRIBE_DECORATOR_CONSTANT: {\n\treadonly METADATA_PROPERTY_NAME: string;\n} = {\n\tMETADATA_PROPERTY_NAME,\n} as const;\n"]}
@@ -0,0 +1,7 @@
1
+ declare const GET_LIST_QUERY_DTO_FACTOR_CONSTANT: {
2
+ readonly MAXIMUM_LIST_LENGTH: number;
3
+ readonly MAXIMUM_LIST_PAGES_COUNT: number;
4
+ readonly MINIMUM_LIST_LENGTH: number;
5
+ readonly MINIMUM_LIST_PAGES_COUNT: number;
6
+ };
7
+ export default GET_LIST_QUERY_DTO_FACTOR_CONSTANT;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const MINIMUM_LIST_LENGTH = 1;
4
+ const MAXIMUM_LIST_LENGTH = 100;
5
+ const MINIMUM_LIST_PAGES_COUNT = 1;
6
+ const MAXIMUM_LIST_PAGES_COUNT = 100;
7
+ const GET_LIST_QUERY_DTO_FACTOR_CONSTANT = {
8
+ MAXIMUM_LIST_LENGTH,
9
+ MAXIMUM_LIST_PAGES_COUNT,
10
+ MINIMUM_LIST_LENGTH,
11
+ MINIMUM_LIST_PAGES_COUNT,
12
+ };
13
+ exports.default = GET_LIST_QUERY_DTO_FACTOR_CONSTANT;
14
+ //# sourceMappingURL=get-list-query.constant.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-list-query.constant.js","sourceRoot":"/","sources":["constant/factory/dto/get-list-query.constant.ts"],"names":[],"mappings":";;AAAA,MAAM,mBAAmB,GAAW,CAAC,CAAC;AACtC,MAAM,mBAAmB,GAAW,GAAG,CAAC;AACxC,MAAM,wBAAwB,GAAW,CAAC,CAAC;AAC3C,MAAM,wBAAwB,GAAW,GAAG,CAAC;AAE7C,MAAM,kCAAkC,GAKpC;IACA,mBAAmB;IACnB,wBAAwB;IACxB,mBAAmB;IACnB,wBAAwB;CAClB,CAAC;AAEX,kBAAe,kCAAkC,CAAC","sourcesContent":["const MINIMUM_LIST_LENGTH: number = 1;\nconst MAXIMUM_LIST_LENGTH: number = 100;\nconst MINIMUM_LIST_PAGES_COUNT: number = 1;\nconst MAXIMUM_LIST_PAGES_COUNT: number = 100;\n\nconst GET_LIST_QUERY_DTO_FACTOR_CONSTANT: {\n readonly MAXIMUM_LIST_LENGTH: number;\n readonly MAXIMUM_LIST_PAGES_COUNT: number;\n readonly MINIMUM_LIST_LENGTH: number;\n readonly MINIMUM_LIST_PAGES_COUNT: number;\n} = {\n MAXIMUM_LIST_LENGTH,\n MAXIMUM_LIST_PAGES_COUNT,\n MINIMUM_LIST_LENGTH,\n MINIMUM_LIST_PAGES_COUNT,\n} as const;\n\nexport default GET_LIST_QUERY_DTO_FACTOR_CONSTANT;\n"]}
@@ -0,0 +1 @@
1
+ export * from "./get-list-query.constant";
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./get-list-query.constant"), exports);
18
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"/","sources":["constant/factory/dto/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4DAA0C","sourcesContent":["export * from \"./get-list-query.constant\";\n"]}
@@ -0,0 +1 @@
1
+ export * from "./dto";
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./dto"), exports);
18
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"/","sources":["constant/factory/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wCAAsB","sourcesContent":["export * from \"./dto\";\n"]}
@@ -3,3 +3,4 @@ export * from "./dto";
3
3
  export * from "./interface";
4
4
  export * from "./date.constant";
5
5
  export * from "./number.constant";
6
+ export * from "./factory";
@@ -19,4 +19,5 @@ __exportStar(require("./dto"), exports);
19
19
  __exportStar(require("./interface"), exports);
20
20
  __exportStar(require("./date.constant"), exports);
21
21
  __exportStar(require("./number.constant"), exports);
22
+ __exportStar(require("./factory"), exports);
22
23
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"/","sources":["constant/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA4B;AAC5B,wCAAsB;AACtB,8CAA4B;AAC5B,kDAAgC;AAChC,oDAAkC","sourcesContent":["export * from \"./decorator\";\nexport * from \"./dto\";\nexport * from \"./interface\";\nexport * from \"./date.constant\";\nexport * from \"./number.constant\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"/","sources":["constant/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA4B;AAC5B,wCAAsB;AACtB,8CAA4B;AAC5B,kDAAgC;AAChC,oDAAkC;AAClC,4CAA0B","sourcesContent":["export * from \"./decorator\";\nexport * from \"./dto\";\nexport * from \"./interface\";\nexport * from \"./date.constant\";\nexport * from \"./number.constant\";\nexport * from \"./factory\";\n"]}
@@ -1,3 +1,3 @@
1
1
  export declare const API_FILTER_INTERFACE_CONSTANT: {
2
- readonly ALLOWED_ENTITY_TO_FILTER_COLUMNS: string[];
2
+ readonly ALLOWED_ENTITY_TO_FILTER_COLUMNS: Array<string>;
3
3
  };
@@ -1,11 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.API_FILTER_INTERFACE_CONSTANT = void 0;
4
- const ALLOWED_ENTITY_TO_FILTER_COLUMNS = [
5
- 'string', 'text', 'varchar', 'char',
6
- 'number', 'int', 'integer', 'tinyint', 'smallint', 'mediumint', 'bigint', 'float', 'double', 'decimal',
7
- 'date', 'datetime', 'timestamp'
8
- ];
4
+ const ALLOWED_ENTITY_TO_FILTER_COLUMNS = ["string", "text", "varchar", "char", "number", "int", "integer", "tinyint", "smallint", "mediumint", "bigint", "float", "double", "decimal", "date", "datetime", "timestamp"];
9
5
  exports.API_FILTER_INTERFACE_CONSTANT = {
10
6
  ALLOWED_ENTITY_TO_FILTER_COLUMNS,
11
7
  };
@@ -1 +1 @@
1
- {"version":3,"file":"filter.constant.js","sourceRoot":"/","sources":["constant/interface/api/filter.constant.ts"],"names":[],"mappings":";;;AACA,MAAM,gCAAgC,GAAa;IAC/C,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM;IACnC,QAAQ,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,UAAU,EAAE,WAAW,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS;IACtG,MAAM,EAAE,UAAU,EAAE,WAAW;CAClC,CAAC;AAEW,QAAA,6BAA6B,GAEtC;IACA,gCAAgC;CAC1B,CAAC","sourcesContent":["\nconst ALLOWED_ENTITY_TO_FILTER_COLUMNS: string[] = [\n 'string', 'text', 'varchar', 'char',\n 'number', 'int', 'integer', 'tinyint', 'smallint', 'mediumint', 'bigint', 'float', 'double', 'decimal',\n 'date', 'datetime', 'timestamp'\n];\n\nexport const API_FILTER_INTERFACE_CONSTANT: {\n readonly ALLOWED_ENTITY_TO_FILTER_COLUMNS: string[];\n} = {\n ALLOWED_ENTITY_TO_FILTER_COLUMNS,\n} as const;\n"]}
1
+ {"version":3,"file":"filter.constant.js","sourceRoot":"/","sources":["constant/interface/api/filter.constant.ts"],"names":[],"mappings":";;;AAAA,MAAM,gCAAgC,GAAkB,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,UAAU,EAAE,WAAW,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,WAAW,CAAC,CAAC;AAE1N,QAAA,6BAA6B,GAEtC;IACH,gCAAgC;CACvB,CAAC","sourcesContent":["const ALLOWED_ENTITY_TO_FILTER_COLUMNS: Array<string> = [\"string\", \"text\", \"varchar\", \"char\", \"number\", \"int\", \"integer\", \"tinyint\", \"smallint\", \"mediumint\", \"bigint\", \"float\", \"double\", \"decimal\", \"date\", \"datetime\", \"timestamp\"];\n\nexport const API_FILTER_INTERFACE_CONSTANT: {\n\treadonly ALLOWED_ENTITY_TO_FILTER_COLUMNS: Array<string>;\n} = {\n\tALLOWED_ENTITY_TO_FILTER_COLUMNS,\n} as const;\n"]}
@@ -1,10 +1,8 @@
1
- import { BaseEntity } from "typeorm";
2
- interface ApiControllerOptions<E extends BaseEntity> {
3
- entity: new () => E;
4
- dto: {
5
- request: any;
6
- response: any;
7
- };
8
- }
9
- export declare function ApiController<E extends BaseEntity>(options: ApiControllerOptions<E>): (target: any) => void;
1
+ import type { BaseApiService } from "../../class";
2
+ import type { IApiControllerProperties } from "../../interface/decorator/api/controller-properties.interface";
3
+ import type { BaseEntity } from "typeorm";
4
+ type TConstructor = new (...arguments_: Array<any>) => {
5
+ service: BaseApiService<any>;
6
+ };
7
+ export declare const ApiController: <E extends BaseEntity>(options: IApiControllerProperties<E>) => <T extends TConstructor>(target: T) => T;
10
8
  export {};
@@ -1,30 +1,17 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ApiController = ApiController;
4
- const common_1 = require("@nestjs/common");
5
- const swagger_1 = require("@nestjs/swagger");
6
- const method_decorator_1 = require("./method.decorator");
7
- const enum_1 = require("../../enum");
8
- const constants_1 = require("@nestjs/common/constants");
9
- function ApiController(options) {
10
- const { entity } = options;
11
- return (target) => {
12
- (0, common_1.applyDecorators)((0, swagger_1.ApiTags)(entity.name), (0, common_1.Controller)(entity.name.toLowerCase()))(target);
13
- target.prototype.get = function (parameters, body) {
14
- return this.service.get(parameters[entity.name.toLowerCase()], body);
15
- };
16
- (0, common_1.applyDecorators)((0, method_decorator_1.ApiMethod)({
17
- action: enum_1.EApiAction.FETCH,
18
- entity: options.entity,
19
- httpCode: common_1.HttpStatus.OK,
20
- method: common_1.RequestMethod.GET,
21
- path: `:bank`,
22
- responses: { internalServerError: true, notFound: true, unauthorized: true },
23
- responseType: options.dto.response
24
- }))(target.prototype, 'get', Object.getOwnPropertyDescriptor(target.prototype, 'get'));
25
- (0, common_1.Param)()(target.prototype, 'get', 0);
26
- Reflect.defineMetadata(constants_1.PARAMTYPES_METADATA, [options.dto.request], target.prototype, 'get');
27
- Reflect.defineMetadata(constants_1.PATH_METADATA, ":bank", target.prototype, 'get');
3
+ exports.ApiController = void 0;
4
+ const factory_1 = require("../../factory");
5
+ const ApiController = (options) => (target) => {
6
+ const factory = new factory_1.ApiControllerFactory(target, options);
7
+ factory.init();
8
+ const ValidatedController = class extends target {
9
+ constructor(...properties) {
10
+ super(...properties);
11
+ }
28
12
  };
29
- }
13
+ Object.defineProperty(ValidatedController, "name", { value: target.name });
14
+ return ValidatedController;
15
+ };
16
+ exports.ApiController = ApiController;
30
17
  //# sourceMappingURL=controller.decorator.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"controller.decorator.js","sourceRoot":"/","sources":["decorator/api/controller.decorator.ts"],"names":[],"mappings":";;AAeA,sCAiCC;AAhDD,2CAA6F;AAE7F,6CAAwC;AACxC,yDAA6C;AAC7C,qCAAsC;AACtC,wDAA4E;AAU5E,SAAgB,aAAa,CAAuB,OAAgC;IAChF,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;IAC3B,OAAO,CAAC,MAAW,EAAE,EAAE;QACnB,IAAA,wBAAe,EACX,IAAA,iBAAO,EAAC,MAAM,CAAC,IAAI,CAAC,EACpB,IAAA,mBAAU,EAAC,MAAM,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,CACxC,CAAC,MAAM,CAAC,CAAC;QAEV,MAAM,CAAC,SAAS,CAAC,GAAG,GAAG,UACnB,UAAsC,EACtC,IAAgC;YAEhC,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC;QACzE,CAAC,CAAC;QAEF,IAAA,wBAAe,EACX,IAAA,4BAAS,EAAC;YACN,MAAM,EAAE,iBAAU,CAAC,KAAK;YACxB,MAAM,EAAE,OAAO,CAAC,MAAM;YACtB,QAAQ,EAAE,mBAAU,CAAC,EAAE;YACvB,MAAM,EAAE,sBAAa,CAAC,GAAG;YACzB,IAAI,EAAE,OAAO;YACb,SAAS,EAAE,EAAE,mBAAmB,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE;YAC5E,YAAY,EAAE,OAAO,CAAC,GAAG,CAAC,QAAQ;SACrC,CAAC,CACL,CAAC,MAAM,CAAC,SAAS,EAAE,KAAK,EAAE,MAAM,CAAC,wBAAwB,CAAC,MAAM,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC,CAAC;QAIrF,IAAA,cAAK,GAAE,CAAC,MAAM,CAAC,SAAS,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC;QACpC,OAAO,CAAC,cAAc,CAAC,+BAAmB,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;QAC5F,OAAO,CAAC,cAAc,CAAC,yBAAa,EAAE,OAAO,EAAE,MAAM,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;IAC5E,CAAC,CAAC;AACN,CAAC","sourcesContent":["import {applyDecorators, Controller, HttpStatus, Param, RequestMethod} from \"@nestjs/common\";\nimport {BaseEntity} from \"typeorm\";\nimport {ApiTags} from \"@nestjs/swagger\";\nimport {ApiMethod} from \"./method.decorator\";\nimport {EApiAction} from \"../../enum\";\nimport {PARAMTYPES_METADATA, PATH_METADATA} from \"@nestjs/common/constants\";\n\ninterface ApiControllerOptions<E extends BaseEntity> {\n entity: new () => E;\n dto: {\n request: any;\n response: any;\n };\n}\n\nexport function ApiController<E extends BaseEntity>(options: ApiControllerOptions<E>) {\n const { entity } = options;\n return (target: any) => {\n applyDecorators(\n ApiTags(entity.name),\n Controller(entity.name.toLowerCase()),\n )(target);\n\n target.prototype.get = function (\n parameters: typeof options.dto.request,\n body: typeof options.dto.request\n ): Promise<E> {\n return this.service.get(parameters[entity.name.toLowerCase()], body);\n };\n\n applyDecorators(\n ApiMethod({\n action: EApiAction.FETCH,\n entity: options.entity,\n httpCode: HttpStatus.OK,\n method: RequestMethod.GET,\n path: `:bank`,\n responses: { internalServerError: true, notFound: true, unauthorized: true },\n responseType: options.dto.response\n }),\n )(target.prototype, 'get', Object.getOwnPropertyDescriptor(target.prototype, 'get'));\n\n\n\n Param()(target.prototype, 'get', 0);\n Reflect.defineMetadata(PARAMTYPES_METADATA, [options.dto.request], target.prototype, 'get');\n Reflect.defineMetadata(PATH_METADATA, \":bank\", target.prototype, 'get');\n };\n}\n"]}
1
+ {"version":3,"file":"controller.decorator.js","sourceRoot":"/","sources":["decorator/api/controller.decorator.ts"],"names":[],"mappings":";;;AAAA,2CAAqD;AAS9C,MAAM,aAAa,GACzB,CAAuB,OAAoC,EAAE,EAAE,CAC/D,CAAyB,MAAS,EAAK,EAAE;IACxC,MAAM,OAAO,GAA4B,IAAI,8BAAoB,CAAI,MAAM,EAAE,OAAO,CAAC,CAAC;IACtF,OAAO,CAAC,IAAI,EAAE,CAAC;IAEf,MAAM,mBAAmB,GAA2D,KAAM,SAAQ,MAAM;QACvG,YAAY,GAAG,UAAe;YAE7B,KAAK,CAAC,GAAG,UAAU,CAAC,CAAC;QACtB,CAAC;KACD,CAAC;IACF,MAAM,CAAC,cAAc,CAAC,mBAAmB,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC;IAE3E,OAAO,mBAAwB,CAAC;AACjC,CAAC,CAAC;AAfU,QAAA,aAAa,iBAevB","sourcesContent":["import { ApiControllerFactory } from \"../../factory\";\n\nimport type { BaseApiService } from \"../../class\";\nimport type { IApiControllerProperties } from \"../../interface/decorator/api/controller-properties.interface\";\n\nimport type { BaseEntity } from \"typeorm\";\n\ntype TConstructor = new (...arguments_: Array<any>) => { service: BaseApiService<any> };\n\nexport const ApiController =\n\t<E extends BaseEntity>(options: IApiControllerProperties<E>) =>\n\t<T extends TConstructor>(target: T): T => {\n\t\tconst factory: ApiControllerFactory<E> = new ApiControllerFactory<E>(target, options);\n\t\tfactory.init();\n\n\t\tconst ValidatedController: { new (...arguments_: Array<any>): {}; prototype: {} } = class extends target {\n\t\t\tconstructor(...properties: any) {\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-argument\n\t\t\t\tsuper(...properties);\n\t\t\t}\n\t\t};\n\t\tObject.defineProperty(ValidatedController, \"name\", { value: target.name });\n\n\t\treturn ValidatedController as T;\n\t};\n"]}
@@ -1,4 +1,4 @@
1
- import { BaseEntity } from "typeorm";
1
+ import type { BaseEntity } from "typeorm";
2
2
  export declare function ApiFunctionCreate<E extends BaseEntity>(options: {
3
3
  model: new () => E;
4
4
  }): (_target: any, _propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
@@ -9,15 +9,14 @@ async function executor(repository, entityType, properties) {
9
9
  try {
10
10
  const allColumns = (0, get_entity_columns_utility_1.GetEntityColumns)(entityType);
11
11
  const autoGeneratedColumns = (0, get_entity_columns_utility_1.GetEntityColumns)(entityType, true);
12
- const filteredProperties = Object.keys(properties).reduce((acc, key) => {
12
+ const filteredProperties = Object.keys(properties).reduce((accumulator, key) => {
13
13
  if (allColumns.includes(key) && !autoGeneratedColumns.includes(key)) {
14
- acc[key] = properties[key];
14
+ accumulator[key] = properties[key];
15
15
  }
16
- return acc;
16
+ return accumulator;
17
17
  }, {});
18
18
  const newEntity = repository.create(filteredProperties);
19
- const savedEntity = await repository.save(newEntity);
20
- return savedEntity;
19
+ return await repository.save(newEntity);
21
20
  }
22
21
  catch (error) {
23
22
  console.log(error);
@@ -1 +1 @@
1
- {"version":3,"file":"create.decorator.js","sourceRoot":"/","sources":["decorator/api/function/create.decorator.ts"],"names":[],"mappings":";;AAyCA,8CAkBC;AAzDD,2CAA2E;AAC3E,wCAAiD;AACjD,8CAA6C;AAC7C,4FAA6E;AAG7E,KAAK,UAAU,QAAQ,CACnB,UAAyB,EACzB,UAAuB,EACvB,UAA2C;IAE3C,IAAI,CAAC;QACD,MAAM,UAAU,GAAG,IAAA,6CAAgB,EAAC,UAAU,CAAC,CAAC;QAChD,MAAM,oBAAoB,GAAG,IAAA,6CAAgB,EAAC,UAAU,EAAE,IAAI,CAAC,CAAC;QAEhE,MAAM,kBAAkB,GAAG,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;YACnE,IAAI,UAAU,CAAC,QAAQ,CAAC,GAAc,CAAC,IAAI,CAAC,oBAAoB,CAAC,QAAQ,CAAC,GAAc,CAAC,EAAE,CAAC;gBACvF,GAAW,CAAC,GAAG,CAAC,GAAI,UAAkB,CAAC,GAAG,CAAC,CAAC;YACjD,CAAC;YACD,OAAO,GAAG,CAAC;QACf,CAAC,EAAE,EAAoB,CAAC,CAAC;QAEzB,MAAM,SAAS,GAAG,UAAU,CAAC,MAAM,CAAC,kBAAkB,CAAC,CAAC;QACxD,MAAM,WAAW,GAAG,MAAM,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACrD,OAAO,WAAW,CAAC;IACvB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACb,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QACnB,IAAI,KAAK,YAAY,sBAAa,EAAE,CAAC;YACjC,MAAM,KAAK,CAAC;QAChB,CAAC;QACD,MAAM,IAAI,qCAA4B,CAClC,IAAA,qBAAW,EAAC;YACR,MAAM,EAAE,UAAU;YAClB,IAAI,EAAE,yBAAkB,CAAC,cAAc;SAC1C,CAAC,CACL,CAAC;IACN,CAAC;AACL,CAAC;AAED,SAAgB,iBAAiB,CAAuB,OAA+B;IACnF,OAAO,UAAU,OAAY,EAAE,YAAoB,EAAE,UAA8B;QAC/E,UAAU,CAAC,KAAK,GAAG,KAAK,WAIpB,UAA4E;YAE5E,MAAM,UAAU,GAAkB,IAAI,CAAC,UAAU,CAAC;YAClD,IAAI,CAAC,UAAU,EAAE,CAAC;gBACd,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAC;YACnE,CAAC;YAED,OAAO,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;QAC3D,CAAC,CAAC;QAEF,OAAO,UAAU,CAAC;IACtB,CAAC,CAAC;AACN,CAAC","sourcesContent":["import {BaseEntity, DeepPartial, Repository} from \"typeorm\";\nimport {TApiFunctionCreateProperties} from \"../../../type\";\nimport {HttpException, InternalServerErrorException} from \"@nestjs/common\";\nimport {EErrorStringAction} from \"../../../enum\";\nimport {ErrorString} from \"../../../utility\";\nimport {GetEntityColumns} from \"../../../utility/get-entity-columns.utility\";\n\n\nasync function executor<E extends BaseEntity>(\n repository: Repository<E>,\n entityType: new () => E,\n properties: TApiFunctionCreateProperties<E>\n): Promise<E> {\n try {\n const allColumns = GetEntityColumns(entityType);\n const autoGeneratedColumns = GetEntityColumns(entityType, true);\n\n const filteredProperties = Object.keys(properties).reduce((acc, key) => {\n if (allColumns.includes(key as keyof E) && !autoGeneratedColumns.includes(key as keyof E)) {\n (acc as any)[key] = (properties as any)[key];\n }\n return acc;\n }, {} as DeepPartial<E>);\n\n const newEntity = repository.create(filteredProperties);\n const savedEntity = await repository.save(newEntity);\n return savedEntity;\n } catch (error) {\n console.log(error);\n if (error instanceof HttpException) {\n throw error;\n }\n throw new InternalServerErrorException(\n ErrorString({\n entity: entityType,\n type: EErrorStringAction.CREATING_ERROR,\n })\n );\n }\n}\n\nexport function ApiFunctionCreate<E extends BaseEntity>(options: { model: new () => E }) {\n return function (_target: any, _propertyKey: string, descriptor: PropertyDescriptor) {\n descriptor.value = async function (\n this: {\n repository: Repository<E>;\n },\n properties: TApiFunctionCreateProperties<InstanceType<typeof options.model>>\n ) {\n const repository: Repository<E> = this.repository;\n if (!repository) {\n throw new Error(\"Repository is not available in this context\");\n }\n\n return executor(repository, options.model, properties);\n };\n\n return descriptor;\n };\n}\n"]}
1
+ {"version":3,"file":"create.decorator.js","sourceRoot":"/","sources":["decorator/api/function/create.decorator.ts"],"names":[],"mappings":";;AA2CA,8CAmBC;AA9DD,2CAA6E;AAE7E,wCAAmD;AAEnD,8CAA+C;AAC/C,4FAA+E;AAM/E,KAAK,UAAU,QAAQ,CAAuB,UAAyB,EAAE,UAAuB,EAAE,UAA2C;IAC5I,IAAI,CAAC;QACJ,MAAM,UAAU,GAAG,IAAA,6CAAgB,EAAC,UAAU,CAAC,CAAC;QAChD,MAAM,oBAAoB,GAAG,IAAA,6CAAgB,EAAC,UAAU,EAAE,IAAI,CAAC,CAAC;QAEhE,MAAM,kBAAkB,GAAG,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC,WAAW,EAAE,GAAG,EAAE,EAAE;YAC9E,IAAI,UAAU,CAAC,QAAQ,CAAC,GAAc,CAAC,IAAI,CAAC,oBAAoB,CAAC,QAAQ,CAAC,GAAc,CAAC,EAAE,CAAC;gBAC1F,WAAmB,CAAC,GAAG,CAAC,GAAI,UAAkB,CAAC,GAAG,CAAC,CAAC;YACtD,CAAC;YAED,OAAO,WAAW,CAAC;QACpB,CAAC,EAAE,EAAoB,CAAC,CAAC;QAEzB,MAAM,SAAS,GAAG,UAAU,CAAC,MAAM,CAAC,kBAAkB,CAAC,CAAC;QAExD,OAAO,MAAM,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IACzC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QAChB,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QAEnB,IAAI,KAAK,YAAY,sBAAa,EAAE,CAAC;YACpC,MAAM,KAAK,CAAC;QACb,CAAC;QAED,MAAM,IAAI,qCAA4B,CACrC,IAAA,qBAAW,EAAC;YACX,MAAM,EAAE,UAAU;YAClB,IAAI,EAAE,yBAAkB,CAAC,cAAc;SACvC,CAAC,CACF,CAAC;IACH,CAAC;AACF,CAAC;AAED,SAAgB,iBAAiB,CAAuB,OAA+B;IACtF,OAAO,UAAU,OAAY,EAAE,YAAoB,EAAE,UAA8B;QAClF,UAAU,CAAC,KAAK,GAAG,KAAK,WAIvB,UAA4E;YAE5E,MAAM,UAAU,GAAkB,IAAI,CAAC,UAAU,CAAC;YAElD,IAAI,CAAC,UAAU,EAAE,CAAC;gBACjB,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAC;YAChE,CAAC;YAED,OAAO,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;QACxD,CAAC,CAAC;QAEF,OAAO,UAAU,CAAC;IACnB,CAAC,CAAC;AACH,CAAC","sourcesContent":["import { HttpException, InternalServerErrorException } from \"@nestjs/common\";\n\nimport { EErrorStringAction } from \"../../../enum\";\n\nimport { ErrorString } from \"../../../utility\";\nimport { GetEntityColumns } from \"../../../utility/get-entity-columns.utility\";\n\nimport type { TApiFunctionCreateProperties } from \"../../../type\";\n\nimport type { BaseEntity, DeepPartial, Repository } from \"typeorm\";\n\nasync function executor<E extends BaseEntity>(repository: Repository<E>, entityType: new () => E, properties: TApiFunctionCreateProperties<E>): Promise<E> {\n\ttry {\n\t\tconst allColumns = GetEntityColumns(entityType);\n\t\tconst autoGeneratedColumns = GetEntityColumns(entityType, true);\n\n\t\tconst filteredProperties = Object.keys(properties).reduce((accumulator, key) => {\n\t\t\tif (allColumns.includes(key as keyof E) && !autoGeneratedColumns.includes(key as keyof E)) {\n\t\t\t\t(accumulator as any)[key] = (properties as any)[key];\n\t\t\t}\n\n\t\t\treturn accumulator;\n\t\t}, {} as DeepPartial<E>);\n\n\t\tconst newEntity = repository.create(filteredProperties);\n\n\t\treturn await repository.save(newEntity);\n\t} catch (error) {\n\t\tconsole.log(error);\n\n\t\tif (error instanceof HttpException) {\n\t\t\tthrow error;\n\t\t}\n\n\t\tthrow new InternalServerErrorException(\n\t\t\tErrorString({\n\t\t\t\tentity: entityType,\n\t\t\t\ttype: EErrorStringAction.CREATING_ERROR,\n\t\t\t}),\n\t\t);\n\t}\n}\n\nexport function ApiFunctionCreate<E extends BaseEntity>(options: { model: new () => E }) {\n\treturn function (_target: any, _propertyKey: string, descriptor: PropertyDescriptor) {\n\t\tdescriptor.value = async function (\n\t\t\tthis: {\n\t\t\t\trepository: Repository<E>;\n\t\t\t},\n\t\t\tproperties: TApiFunctionCreateProperties<InstanceType<typeof options.model>>,\n\t\t) {\n\t\t\tconst repository: Repository<E> = this.repository;\n\n\t\t\tif (!repository) {\n\t\t\t\tthrow new Error(\"Repository is not available in this context\");\n\t\t\t}\n\n\t\t\treturn executor(repository, options.model, properties);\n\t\t};\n\n\t\treturn descriptor;\n\t};\n}\n"]}
@@ -1,7 +1,7 @@
1
- import type { BaseEntity, FindOptionsRelations } from "typeorm";
2
1
  import { EApiFunctionType } from "../../../enum";
2
+ import type { BaseEntity, FindOptionsRelations } from "typeorm";
3
3
  export declare function ApiFunction<E extends BaseEntity>(options: {
4
4
  model: new () => E;
5
- type: EApiFunctionType;
6
5
  relations?: FindOptionsRelations<E>;
6
+ type: EApiFunctionType;
7
7
  }): (_target: any, _propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
@@ -1,43 +1,43 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ApiFunction = ApiFunction;
4
- const get_list_decorator_1 = require("./get-list.decorator");
5
4
  const enum_1 = require("../../../enum");
6
- const get_decorator_1 = require("./get.decorator");
7
5
  const create_decorator_1 = require("./create.decorator");
8
- const update_decorator_1 = require("./update.decorator");
9
6
  const delete_decorator_1 = require("./delete.decorator");
7
+ const get_list_decorator_1 = require("./get-list.decorator");
8
+ const get_decorator_1 = require("./get.decorator");
9
+ const update_decorator_1 = require("./update.decorator");
10
10
  function ApiFunction(options) {
11
11
  return function (_target, _propertyKey, descriptor) {
12
12
  const originalMethod = descriptor.value;
13
- descriptor.value = function (...args) {
13
+ descriptor.value = function (...arguments_) {
14
14
  switch (options.type) {
15
15
  case enum_1.EApiFunctionType.GET_LIST: {
16
- return (0, get_list_decorator_1.ApiFunctionGetList)({ model: options.model })(this, _propertyKey, { value: originalMethod }).value.apply(this, args);
16
+ return (0, get_list_decorator_1.ApiFunctionGetList)({ model: options.model })(this, _propertyKey, { value: originalMethod }).value.apply(this, arguments_);
17
17
  }
18
18
  case enum_1.EApiFunctionType.GET: {
19
- return (0, get_decorator_1.ApiFunctionGet)({ model: options.model })(this, _propertyKey, { value: originalMethod }).value.apply(this, args);
19
+ return (0, get_decorator_1.ApiFunctionGet)({ model: options.model })(this, _propertyKey, { value: originalMethod }).value.apply(this, arguments_);
20
20
  }
21
21
  case enum_1.EApiFunctionType.CREATE: {
22
22
  return (0, create_decorator_1.ApiFunctionCreate)({ model: options.model })(this, _propertyKey, {
23
23
  value: originalMethod,
24
- }).value.apply(this, args);
24
+ }).value.apply(this, arguments_);
25
25
  }
26
26
  case enum_1.EApiFunctionType.UPDATE: {
27
27
  return (0, update_decorator_1.ApiFunctionUpdate)({ model: options.model })(this, _propertyKey, {
28
28
  value: originalMethod,
29
- }).value.apply(this, args);
29
+ }).value.apply(this, arguments_);
30
30
  }
31
31
  case enum_1.EApiFunctionType.DELETE: {
32
32
  return (0, delete_decorator_1.ApiFunctionDelete)({ model: options.model })(this, _propertyKey, {
33
33
  value: originalMethod,
34
- }).value.apply(this, args);
34
+ }).value.apply(this, arguments_);
35
35
  }
36
36
  default: {
37
37
  throw new Error("Unsupported function");
38
38
  }
39
39
  }
40
- return originalMethod.apply(this, args);
40
+ return originalMethod.apply(this, arguments_);
41
41
  };
42
42
  return descriptor;
43
43
  };
@@ -1 +1 @@
1
- {"version":3,"file":"decorator.js","sourceRoot":"/","sources":["decorator/api/function/decorator.ts"],"names":[],"mappings":";;AAQA,kCA2CC;AAlDD,6DAAwD;AACxD,wCAA+C;AAC/C,mDAA+C;AAC/C,yDAAqD;AACrD,yDAAqD;AACrD,yDAAqD;AAErD,SAAgB,WAAW,CAAuB,OAA4F;IAC7I,OAAO,UAAU,OAAY,EAAE,YAAoB,EAAE,UAA8B;QAClF,MAAM,cAAc,GAAG,UAAU,CAAC,KAAK,CAAC;QAExC,UAAU,CAAC,KAAK,GAAG,UAA+C,GAAG,IAAgB;YAEpF,QAAQ,OAAO,CAAC,IAAI,EAAE,CAAC;gBACtB,KAAK,uBAAgB,CAAC,QAAQ,CAAC,CAAC,CAAC;oBAChC,OAAO,IAAA,uCAAkB,EAAC,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC,IAAI,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,cAAc,EAAE,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;gBAC5H,CAAC;gBAED,KAAK,uBAAgB,CAAC,GAAG,CAAC,CAAC,CAAC;oBAC3B,OAAO,IAAA,8BAAc,EAAC,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC,IAAI,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,cAAc,EAAE,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;gBACxH,CAAC;gBAED,KAAK,uBAAgB,CAAC,MAAM,CAAC,CAAC,CAAC;oBAC9B,OAAO,IAAA,oCAAiB,EAAC,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC,IAAI,EAAE,YAAY,EAAE;wBACtE,KAAK,EAAE,cAAc;qBACrB,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;gBAC5B,CAAC;gBAED,KAAK,uBAAgB,CAAC,MAAM,CAAC,CAAC,CAAC;oBAC9B,OAAO,IAAA,oCAAiB,EAAC,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC,IAAI,EAAE,YAAY,EAAE;wBACtE,KAAK,EAAE,cAAc;qBACrB,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;gBAC5B,CAAC;gBAED,KAAK,uBAAgB,CAAC,MAAM,CAAC,CAAC,CAAC;oBAC9B,OAAO,IAAA,oCAAiB,EAAC,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC,IAAI,EAAE,YAAY,EAAE;wBACtE,KAAK,EAAE,cAAc;qBACrB,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;gBAC5B,CAAC;gBAED,OAAO,CAAC,CAAC,CAAC;oBACT,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC;gBACzC,CAAC;YACF,CAAC;YAED,OAAO,cAAc,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QACzC,CAAC,CAAC;QAEF,OAAO,UAAU,CAAC;IACnB,CAAC,CAAC;AACH,CAAC","sourcesContent":["import type {BaseEntity, FindOptionsRelations, Repository} from \"typeorm\";\nimport {ApiFunctionGetList} from \"./get-list.decorator\";\nimport {EApiFunctionType} from \"../../../enum\";\nimport {ApiFunctionGet} from \"./get.decorator\";\nimport {ApiFunctionCreate} from \"./create.decorator\";\nimport {ApiFunctionUpdate} from \"./update.decorator\";\nimport {ApiFunctionDelete} from \"./delete.decorator\";\n\nexport function ApiFunction<E extends BaseEntity>(options: { model: new () => E; type: EApiFunctionType; relations?: FindOptionsRelations<E> }) {\n\treturn function (_target: any, _propertyKey: string, descriptor: PropertyDescriptor) {\n\t\tconst originalMethod = descriptor.value;\n\n\t\tdescriptor.value = function (this: { repository: Repository<E> }, ...args: Array<any>) {\n\n\t\t\tswitch (options.type) {\n\t\t\t\tcase EApiFunctionType.GET_LIST: {\n\t\t\t\t\treturn ApiFunctionGetList({ model: options.model })(this, _propertyKey, { value: originalMethod }).value.apply(this, args);\n\t\t\t\t}\n\n\t\t\t\tcase EApiFunctionType.GET: {\n\t\t\t\t\treturn ApiFunctionGet({ model: options.model })(this, _propertyKey, { value: originalMethod }).value.apply(this, args);\n\t\t\t\t}\n\n\t\t\t\tcase EApiFunctionType.CREATE: {\n\t\t\t\t\treturn ApiFunctionCreate({ model: options.model })(this, _propertyKey, {\n\t\t\t\t\t\tvalue: originalMethod,\n\t\t\t\t\t}).value.apply(this, args);\n\t\t\t\t}\n\n\t\t\t\tcase EApiFunctionType.UPDATE: {\n\t\t\t\t\treturn ApiFunctionUpdate({ model: options.model })(this, _propertyKey, {\n\t\t\t\t\t\tvalue: originalMethod,\n\t\t\t\t\t}).value.apply(this, args);\n\t\t\t\t}\n\n\t\t\t\tcase EApiFunctionType.DELETE: {\n\t\t\t\t\treturn ApiFunctionDelete({ model: options.model })(this, _propertyKey, {\n\t\t\t\t\t\tvalue: originalMethod,\n\t\t\t\t\t}).value.apply(this, args);\n\t\t\t\t}\n\n\t\t\t\tdefault: {\n\t\t\t\t\tthrow new Error(\"Unsupported function\");\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn originalMethod.apply(this, args);\n\t\t};\n\n\t\treturn descriptor;\n\t};\n}\n"]}
1
+ {"version":3,"file":"decorator.js","sourceRoot":"/","sources":["decorator/api/function/decorator.ts"],"names":[],"mappings":";;AAUA,kCA0CC;AApDD,wCAAiD;AAEjD,yDAAuD;AACvD,yDAAuD;AACvD,6DAA0D;AAC1D,mDAAiD;AACjD,yDAAuD;AAIvD,SAAgB,WAAW,CAAuB,OAA4F;IAC7I,OAAO,UAAU,OAAY,EAAE,YAAoB,EAAE,UAA8B;QAClF,MAAM,cAAc,GAAG,UAAU,CAAC,KAAK,CAAC;QAExC,UAAU,CAAC,KAAK,GAAG,UAA+C,GAAG,UAAsB;YAC1F,QAAQ,OAAO,CAAC,IAAI,EAAE,CAAC;gBACtB,KAAK,uBAAgB,CAAC,QAAQ,CAAC,CAAC,CAAC;oBAChC,OAAO,IAAA,uCAAkB,EAAC,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC,IAAI,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,cAAc,EAAE,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;gBAClI,CAAC;gBAED,KAAK,uBAAgB,CAAC,GAAG,CAAC,CAAC,CAAC;oBAC3B,OAAO,IAAA,8BAAc,EAAC,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC,IAAI,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,cAAc,EAAE,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;gBAC9H,CAAC;gBAED,KAAK,uBAAgB,CAAC,MAAM,CAAC,CAAC,CAAC;oBAC9B,OAAO,IAAA,oCAAiB,EAAC,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC,IAAI,EAAE,YAAY,EAAE;wBACtE,KAAK,EAAE,cAAc;qBACrB,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;gBAClC,CAAC;gBAED,KAAK,uBAAgB,CAAC,MAAM,CAAC,CAAC,CAAC;oBAC9B,OAAO,IAAA,oCAAiB,EAAC,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC,IAAI,EAAE,YAAY,EAAE;wBACtE,KAAK,EAAE,cAAc;qBACrB,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;gBAClC,CAAC;gBAED,KAAK,uBAAgB,CAAC,MAAM,CAAC,CAAC,CAAC;oBAC9B,OAAO,IAAA,oCAAiB,EAAC,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC,IAAI,EAAE,YAAY,EAAE;wBACtE,KAAK,EAAE,cAAc;qBACrB,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;gBAClC,CAAC;gBAED,OAAO,CAAC,CAAC,CAAC;oBACT,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC;gBACzC,CAAC;YACF,CAAC;YAED,OAAO,cAAc,CAAC,KAAK,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;QAC/C,CAAC,CAAC;QAEF,OAAO,UAAU,CAAC;IACnB,CAAC,CAAC;AACH,CAAC","sourcesContent":["import { EApiFunctionType } from \"../../../enum\";\n\nimport { ApiFunctionCreate } from \"./create.decorator\";\nimport { ApiFunctionDelete } from \"./delete.decorator\";\nimport { ApiFunctionGetList } from \"./get-list.decorator\";\nimport { ApiFunctionGet } from \"./get.decorator\";\nimport { ApiFunctionUpdate } from \"./update.decorator\";\n\nimport type { BaseEntity, FindOptionsRelations, Repository } from \"typeorm\";\n\nexport function ApiFunction<E extends BaseEntity>(options: { model: new () => E; relations?: FindOptionsRelations<E>; type: EApiFunctionType }) {\n\treturn function (_target: any, _propertyKey: string, descriptor: PropertyDescriptor) {\n\t\tconst originalMethod = descriptor.value;\n\n\t\tdescriptor.value = function (this: { repository: Repository<E> }, ...arguments_: Array<any>) {\n\t\t\tswitch (options.type) {\n\t\t\t\tcase EApiFunctionType.GET_LIST: {\n\t\t\t\t\treturn ApiFunctionGetList({ model: options.model })(this, _propertyKey, { value: originalMethod }).value.apply(this, arguments_);\n\t\t\t\t}\n\n\t\t\t\tcase EApiFunctionType.GET: {\n\t\t\t\t\treturn ApiFunctionGet({ model: options.model })(this, _propertyKey, { value: originalMethod }).value.apply(this, arguments_);\n\t\t\t\t}\n\n\t\t\t\tcase EApiFunctionType.CREATE: {\n\t\t\t\t\treturn ApiFunctionCreate({ model: options.model })(this, _propertyKey, {\n\t\t\t\t\t\tvalue: originalMethod,\n\t\t\t\t\t}).value.apply(this, arguments_);\n\t\t\t\t}\n\n\t\t\t\tcase EApiFunctionType.UPDATE: {\n\t\t\t\t\treturn ApiFunctionUpdate({ model: options.model })(this, _propertyKey, {\n\t\t\t\t\t\tvalue: originalMethod,\n\t\t\t\t\t}).value.apply(this, arguments_);\n\t\t\t\t}\n\n\t\t\t\tcase EApiFunctionType.DELETE: {\n\t\t\t\t\treturn ApiFunctionDelete({ model: options.model })(this, _propertyKey, {\n\t\t\t\t\t\tvalue: originalMethod,\n\t\t\t\t\t}).value.apply(this, arguments_);\n\t\t\t\t}\n\n\t\t\t\tdefault: {\n\t\t\t\t\tthrow new Error(\"Unsupported function\");\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn originalMethod.apply(this, arguments_);\n\t\t};\n\n\t\treturn descriptor;\n\t};\n}\n"]}