aws-service-stack 0.18.419 → 0.18.420

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 (294) hide show
  1. package/dist/_examples/controller/profile/profile.config.js +1 -1
  2. package/dist/_examples/controller/profile/profile.config.js.map +1 -1
  3. package/dist/_examples/controller/profile/profile.controller.d.ts +1 -1
  4. package/dist/_examples/controller/profile/profile.controller.js +1 -0
  5. package/dist/_examples/controller/profile/profile.controller.js.map +1 -1
  6. package/dist/_examples/model-shared/example.model.d.ts +0 -12
  7. package/dist/_examples/model-shared/example.model.js.map +1 -1
  8. package/dist/controller/base-controller.js +5 -2
  9. package/dist/controller/base-controller.js.map +1 -1
  10. package/dist/controller/controller-api.d.ts +2 -2
  11. package/dist/controller/controller-api.js +10 -12
  12. package/dist/controller/controller-api.js.map +1 -1
  13. package/dist/controller/controller-request.d.ts +2 -2
  14. package/dist/controller/controller-request.js +7 -7
  15. package/dist/controller/controller-request.js.map +1 -1
  16. package/dist/exception/errors.d.ts +5 -5
  17. package/dist/exception/errors.js +9 -5
  18. package/dist/exception/errors.js.map +1 -1
  19. package/dist/exception/exception-handler.d.ts +62 -60
  20. package/dist/exception/exception-handler.js +87 -98
  21. package/dist/exception/exception-handler.js.map +1 -1
  22. package/dist/service/crud.service.d.ts +7 -0
  23. package/dist/service/crud.service.interface.d.ts +15 -0
  24. package/dist/service/crud.service.interface.js.map +1 -1
  25. package/dist/service/crud.service.js +32 -0
  26. package/dist/service/crud.service.js.map +1 -1
  27. package/package.json +6 -6
  28. package/dist/_examples/controller/branch/branch-config.d.ts +0 -6
  29. package/dist/_examples/controller/branch/branch-config.js +0 -47
  30. package/dist/_examples/controller/branch/branch-config.js.map +0 -1
  31. package/dist/_examples/controller/branch/branch-controller.d.ts +0 -16
  32. package/dist/_examples/controller/branch/branch-controller.js +0 -77
  33. package/dist/_examples/controller/branch/branch-controller.js.map +0 -1
  34. package/dist/_examples/controller/branch/branch-crud.d.ts +0 -4
  35. package/dist/_examples/controller/branch/branch-crud.js +0 -57
  36. package/dist/_examples/controller/branch/branch-crud.js.map +0 -1
  37. package/dist/_examples/controller/commission/commission-controller.d.ts +0 -9
  38. package/dist/_examples/controller/commission/commission-controller.js +0 -66
  39. package/dist/_examples/controller/commission/commission-controller.js.map +0 -1
  40. package/dist/_examples/controller/commission/commission-crud.d.ts +0 -4
  41. package/dist/_examples/controller/commission/commission-crud.js +0 -57
  42. package/dist/_examples/controller/commission/commission-crud.js.map +0 -1
  43. package/dist/_examples/controller/commission/commission.config.d.ts +0 -6
  44. package/dist/_examples/controller/commission/commission.config.js +0 -46
  45. package/dist/_examples/controller/commission/commission.config.js.map +0 -1
  46. package/dist/_examples/controller/e-order/e-order-crud-simple.d.ts +0 -2
  47. package/dist/_examples/controller/e-order/e-order-crud-simple.js +0 -294
  48. package/dist/_examples/controller/e-order/e-order-crud-simple.js.map +0 -1
  49. package/dist/_examples/controller/e-order/e-order-crud.d.ts +0 -4
  50. package/dist/_examples/controller/e-order/e-order-crud.js +0 -58
  51. package/dist/_examples/controller/e-order/e-order-crud.js.map +0 -1
  52. package/dist/_examples/controller/e-order/e-order.config.d.ts +0 -10
  53. package/dist/_examples/controller/e-order/e-order.config.js +0 -53
  54. package/dist/_examples/controller/e-order/e-order.config.js.map +0 -1
  55. package/dist/_examples/controller/e-order/e-order.controller.d.ts +0 -13
  56. package/dist/_examples/controller/e-order/e-order.controller.js +0 -68
  57. package/dist/_examples/controller/e-order/e-order.controller.js.map +0 -1
  58. package/dist/_examples/controller/entity/entity-config.d.ts +0 -10
  59. package/dist/_examples/controller/entity/entity-config.js +0 -49
  60. package/dist/_examples/controller/entity/entity-config.js.map +0 -1
  61. package/dist/_examples/controller/entity/entity-controller.d.ts +0 -13
  62. package/dist/_examples/controller/entity/entity-controller.js +0 -74
  63. package/dist/_examples/controller/entity/entity-controller.js.map +0 -1
  64. package/dist/_examples/controller/entity/entity-crud.d.ts +0 -4
  65. package/dist/_examples/controller/entity/entity-crud.js +0 -60
  66. package/dist/_examples/controller/entity/entity-crud.js.map +0 -1
  67. package/dist/_examples/controller/index.d.ts +0 -3
  68. package/dist/_examples/controller/index.js +0 -74
  69. package/dist/_examples/controller/index.js.map +0 -1
  70. package/dist/_examples/controller/local-task-controller.d.ts +0 -2
  71. package/dist/_examples/controller/local-task-controller.js +0 -23
  72. package/dist/_examples/controller/local-task-controller.js.map +0 -1
  73. package/dist/_examples/controller/product/product.config.d.ts +0 -12
  74. package/dist/_examples/controller/product/product.config.js +0 -33
  75. package/dist/_examples/controller/product/product.config.js.map +0 -1
  76. package/dist/_examples/controller/properties/properties-crud.d.ts +0 -4
  77. package/dist/_examples/controller/properties/properties-crud.js +0 -58
  78. package/dist/_examples/controller/properties/properties-crud.js.map +0 -1
  79. package/dist/_examples/controller/properties/property.config.d.ts +0 -10
  80. package/dist/_examples/controller/properties/property.config.js +0 -51
  81. package/dist/_examples/controller/properties/property.config.js.map +0 -1
  82. package/dist/_examples/controller/properties/property.controller.d.ts +0 -13
  83. package/dist/_examples/controller/properties/property.controller.js +0 -68
  84. package/dist/_examples/controller/properties/property.controller.js.map +0 -1
  85. package/dist/_examples/controller/raccount/raccount-config.d.ts +0 -6
  86. package/dist/_examples/controller/raccount/raccount-config.js +0 -60
  87. package/dist/_examples/controller/raccount/raccount-config.js.map +0 -1
  88. package/dist/_examples/controller/raccount/raccount-controller.d.ts +0 -14
  89. package/dist/_examples/controller/raccount/raccount-controller.js +0 -73
  90. package/dist/_examples/controller/raccount/raccount-controller.js.map +0 -1
  91. package/dist/_examples/controller/raccount/raccount-crud.d.ts +0 -4
  92. package/dist/_examples/controller/raccount/raccount-crud.js +0 -57
  93. package/dist/_examples/controller/raccount/raccount-crud.js.map +0 -1
  94. package/dist/_examples/controller/rorder/order-config.d.ts +0 -6
  95. package/dist/_examples/controller/rorder/order-config.js +0 -48
  96. package/dist/_examples/controller/rorder/order-config.js.map +0 -1
  97. package/dist/_examples/controller/rorder/order-controller.d.ts +0 -9
  98. package/dist/_examples/controller/rorder/order-controller.js +0 -66
  99. package/dist/_examples/controller/rorder/order-controller.js.map +0 -1
  100. package/dist/_examples/controller/rorder/order-crud.d.ts +0 -4
  101. package/dist/_examples/controller/rorder/order-crud.js +0 -57
  102. package/dist/_examples/controller/rorder/order-crud.js.map +0 -1
  103. package/dist/_examples/controller/supplier/supplier-config.d.ts +0 -10
  104. package/dist/_examples/controller/supplier/supplier-config.js +0 -70
  105. package/dist/_examples/controller/supplier/supplier-config.js.map +0 -1
  106. package/dist/_examples/controller/supplier/supplier-controller-api.d.ts +0 -9
  107. package/dist/_examples/controller/supplier/supplier-controller-api.js +0 -69
  108. package/dist/_examples/controller/supplier/supplier-controller-api.js.map +0 -1
  109. package/dist/_examples/controller/supplier/supplier-controller-stream.d.ts +0 -12
  110. package/dist/_examples/controller/supplier/supplier-controller-stream.js +0 -67
  111. package/dist/_examples/controller/supplier/supplier-controller-stream.js.map +0 -1
  112. package/dist/_examples/controller/supplier/supplier-crud.d.ts +0 -4
  113. package/dist/_examples/controller/supplier/supplier-crud.js +0 -60
  114. package/dist/_examples/controller/supplier/supplier-crud.js.map +0 -1
  115. package/dist/_examples/controller/supplier/supplier-streamer.d.ts +0 -4
  116. package/dist/_examples/controller/supplier/supplier-streamer.js +0 -58
  117. package/dist/_examples/controller/supplier/supplier-streamer.js.map +0 -1
  118. package/dist/_examples/controller/user/user.config.d.ts +0 -12
  119. package/dist/_examples/controller/user/user.config.js +0 -30
  120. package/dist/_examples/controller/user/user.config.js.map +0 -1
  121. package/dist/_examples/controller/user.controller.d.ts +0 -15
  122. package/dist/_examples/controller/user.controller.js +0 -30
  123. package/dist/_examples/controller/user.controller.js.map +0 -1
  124. package/dist/_examples/controller/users/users-crud.d.ts +0 -4
  125. package/dist/_examples/controller/users/users-crud.js +0 -58
  126. package/dist/_examples/controller/users/users-crud.js.map +0 -1
  127. package/dist/_examples/controller/users/users.config.d.ts +0 -10
  128. package/dist/_examples/controller/users/users.config.js +0 -51
  129. package/dist/_examples/controller/users/users.config.js.map +0 -1
  130. package/dist/_examples/controller/users/users.controller.d.ts +0 -13
  131. package/dist/_examples/controller/users/users.controller.js +0 -68
  132. package/dist/_examples/controller/users/users.controller.js.map +0 -1
  133. package/dist/_examples/model/user.model.d.ts +0 -1
  134. package/dist/_examples/model/user.model.js +0 -3
  135. package/dist/_examples/model/user.model.js.map +0 -1
  136. package/dist/_examples/model-shared/address.model.d.ts +0 -18
  137. package/dist/_examples/model-shared/address.model.js +0 -3
  138. package/dist/_examples/model-shared/address.model.js.map +0 -1
  139. package/dist/_examples/model-shared/branch.model.d.ts +0 -72
  140. package/dist/_examples/model-shared/branch.model.js +0 -64
  141. package/dist/_examples/model-shared/branch.model.js.map +0 -1
  142. package/dist/_examples/model-shared/commission.model.d.ts +0 -30
  143. package/dist/_examples/model-shared/commission.model.js +0 -38
  144. package/dist/_examples/model-shared/commission.model.js.map +0 -1
  145. package/dist/_examples/model-shared/raccount.model.d.ts +0 -134
  146. package/dist/_examples/model-shared/raccount.model.js +0 -187
  147. package/dist/_examples/model-shared/raccount.model.js.map +0 -1
  148. package/dist/_examples/model-shared/suppler.model-to-remove.d.ts +0 -119
  149. package/dist/_examples/model-shared/suppler.model-to-remove.js +0 -103
  150. package/dist/_examples/model-shared/suppler.model-to-remove.js.map +0 -1
  151. package/dist/_examples/model-shared/supplier-portal.model.d.ts +0 -22862
  152. package/dist/_examples/model-shared/supplier-portal.model.js +0 -1035
  153. package/dist/_examples/model-shared/supplier-portal.model.js.map +0 -1
  154. package/dist/_examples/model-shared/supplier.model.d.ts +0 -77
  155. package/dist/_examples/model-shared/supplier.model.js +0 -124
  156. package/dist/_examples/model-shared/supplier.model.js.map +0 -1
  157. package/dist/_examples/repositories/branch/branch-db.repo.d.ts +0 -6
  158. package/dist/_examples/repositories/branch/branch-db.repo.interface.d.ts +0 -4
  159. package/dist/_examples/repositories/branch/branch-db.repo.interface.js +0 -3
  160. package/dist/_examples/repositories/branch/branch-db.repo.interface.js.map +0 -1
  161. package/dist/_examples/repositories/branch/branch-db.repo.js +0 -19
  162. package/dist/_examples/repositories/branch/branch-db.repo.js.map +0 -1
  163. package/dist/_examples/repositories/commission/commission-repo-db.d.ts +0 -5
  164. package/dist/_examples/repositories/commission/commission-repo-db.interface.d.ts +0 -4
  165. package/dist/_examples/repositories/commission/commission-repo-db.interface.js +0 -3
  166. package/dist/_examples/repositories/commission/commission-repo-db.interface.js.map +0 -1
  167. package/dist/_examples/repositories/commission/commission-repo-db.js +0 -18
  168. package/dist/_examples/repositories/commission/commission-repo-db.js.map +0 -1
  169. package/dist/_examples/repositories/entity/entity-repo-db.d.ts +0 -6
  170. package/dist/_examples/repositories/entity/entity-repo-db.interface.d.ts +0 -4
  171. package/dist/_examples/repositories/entity/entity-repo-db.interface.js +0 -3
  172. package/dist/_examples/repositories/entity/entity-repo-db.interface.js.map +0 -1
  173. package/dist/_examples/repositories/entity/entity-repo-db.js +0 -19
  174. package/dist/_examples/repositories/entity/entity-repo-db.js.map +0 -1
  175. package/dist/_examples/repositories/entity/entity-repo-erp-acs.interface.d.ts +0 -3
  176. package/dist/_examples/repositories/entity/entity-repo-erp-acs.interface.js +0 -3
  177. package/dist/_examples/repositories/entity/entity-repo-erp-acs.interface.js.map +0 -1
  178. package/dist/_examples/repositories/entity/entity-repo-erp-coremind.d.ts +0 -0
  179. package/dist/_examples/repositories/entity/entity-repo-erp-coremind.js +0 -2
  180. package/dist/_examples/repositories/entity/entity-repo-erp-coremind.js.map +0 -1
  181. package/dist/_examples/repositories/entity/entity-repo-es.d.ts +0 -6
  182. package/dist/_examples/repositories/entity/entity-repo-es.interface.d.ts +0 -4
  183. package/dist/_examples/repositories/entity/entity-repo-es.interface.js +0 -3
  184. package/dist/_examples/repositories/entity/entity-repo-es.interface.js.map +0 -1
  185. package/dist/_examples/repositories/entity/entity-repo-es.js +0 -19
  186. package/dist/_examples/repositories/entity/entity-repo-es.js.map +0 -1
  187. package/dist/_examples/repositories/order/order-es.repo.d.ts +0 -12
  188. package/dist/_examples/repositories/order/order-es.repo.interface.d.ts +0 -7
  189. package/dist/_examples/repositories/order/order-es.repo.interface.js +0 -3
  190. package/dist/_examples/repositories/order/order-es.repo.interface.js.map +0 -1
  191. package/dist/_examples/repositories/order/order-es.repo.js +0 -64
  192. package/dist/_examples/repositories/order/order-es.repo.js.map +0 -1
  193. package/dist/_examples/repositories/order/order-repo-db.d.ts +0 -6
  194. package/dist/_examples/repositories/order/order-repo-db.interface.d.ts +0 -17
  195. package/dist/_examples/repositories/order/order-repo-db.interface.js +0 -22
  196. package/dist/_examples/repositories/order/order-repo-db.interface.js.map +0 -1
  197. package/dist/_examples/repositories/order/order-repo-db.js +0 -19
  198. package/dist/_examples/repositories/order/order-repo-db.js.map +0 -1
  199. package/dist/_examples/repositories/raccount/raccount-db.repo.d.ts +0 -5
  200. package/dist/_examples/repositories/raccount/raccount-db.repo.interface.d.ts +0 -4
  201. package/dist/_examples/repositories/raccount/raccount-db.repo.interface.js +0 -3
  202. package/dist/_examples/repositories/raccount/raccount-db.repo.interface.js.map +0 -1
  203. package/dist/_examples/repositories/raccount/raccount-db.repo.js +0 -18
  204. package/dist/_examples/repositories/raccount/raccount-db.repo.js.map +0 -1
  205. package/dist/_examples/repositories/raccount/raccount-es.repo.d.ts +0 -6
  206. package/dist/_examples/repositories/raccount/raccount-es.repo.interface.d.ts +0 -4
  207. package/dist/_examples/repositories/raccount/raccount-es.repo.interface.js +0 -3
  208. package/dist/_examples/repositories/raccount/raccount-es.repo.interface.js.map +0 -1
  209. package/dist/_examples/repositories/raccount/raccount-es.repo.js +0 -19
  210. package/dist/_examples/repositories/raccount/raccount-es.repo.js.map +0 -1
  211. package/dist/_examples/repositories/rorder/rorder-db.repo.d.ts +0 -5
  212. package/dist/_examples/repositories/rorder/rorder-db.repo.interface.d.ts +0 -4
  213. package/dist/_examples/repositories/rorder/rorder-db.repo.interface.js +0 -3
  214. package/dist/_examples/repositories/rorder/rorder-db.repo.interface.js.map +0 -1
  215. package/dist/_examples/repositories/rorder/rorder-db.repo.js +0 -18
  216. package/dist/_examples/repositories/rorder/rorder-db.repo.js.map +0 -1
  217. package/dist/_examples/repositories/rorder/rorder-es.repo.d.ts +0 -7
  218. package/dist/_examples/repositories/rorder/rorder-es.repo.interface.d.ts +0 -5
  219. package/dist/_examples/repositories/rorder/rorder-es.repo.interface.js +0 -3
  220. package/dist/_examples/repositories/rorder/rorder-es.repo.interface.js.map +0 -1
  221. package/dist/_examples/repositories/rorder/rorder-es.repo.js +0 -22
  222. package/dist/_examples/repositories/rorder/rorder-es.repo.js.map +0 -1
  223. package/dist/_examples/repositories/supplier/supplier-repo-db.d.ts +0 -6
  224. package/dist/_examples/repositories/supplier/supplier-repo-db.interface.d.ts +0 -4
  225. package/dist/_examples/repositories/supplier/supplier-repo-db.interface.js +0 -3
  226. package/dist/_examples/repositories/supplier/supplier-repo-db.interface.js.map +0 -1
  227. package/dist/_examples/repositories/supplier/supplier-repo-db.js +0 -19
  228. package/dist/_examples/repositories/supplier/supplier-repo-db.js.map +0 -1
  229. package/dist/_examples/repositories/supplier/supplier-repo-es.d.ts +0 -6
  230. package/dist/_examples/repositories/supplier/supplier-repo-es.interface.d.ts +0 -4
  231. package/dist/_examples/repositories/supplier/supplier-repo-es.interface.js +0 -3
  232. package/dist/_examples/repositories/supplier/supplier-repo-es.interface.js.map +0 -1
  233. package/dist/_examples/repositories/supplier/supplier-repo-es.js +0 -19
  234. package/dist/_examples/repositories/supplier/supplier-repo-es.js.map +0 -1
  235. package/dist/_examples/repositories/user-repo-db.d.ts +0 -7
  236. package/dist/_examples/repositories/user-repo-db.interface.d.ts +0 -5
  237. package/dist/_examples/repositories/user-repo-db.interface.js +0 -3
  238. package/dist/_examples/repositories/user-repo-db.interface.js.map +0 -1
  239. package/dist/_examples/repositories/user-repo-db.js +0 -24
  240. package/dist/_examples/repositories/user-repo-db.js.map +0 -1
  241. package/dist/_examples/service/branch/branch-service.d.ts +0 -13
  242. package/dist/_examples/service/branch/branch-service.interface.d.ts +0 -4
  243. package/dist/_examples/service/branch/branch-service.interface.js +0 -3
  244. package/dist/_examples/service/branch/branch-service.interface.js.map +0 -1
  245. package/dist/_examples/service/branch/branch-service.js +0 -70
  246. package/dist/_examples/service/branch/branch-service.js.map +0 -1
  247. package/dist/_examples/service/commission/commission-service.d.ts +0 -15
  248. package/dist/_examples/service/commission/commission-service.interface.d.ts +0 -6
  249. package/dist/_examples/service/commission/commission-service.interface.js +0 -3
  250. package/dist/_examples/service/commission/commission-service.interface.js.map +0 -1
  251. package/dist/_examples/service/commission/commission-service.js +0 -116
  252. package/dist/_examples/service/commission/commission-service.js.map +0 -1
  253. package/dist/_examples/service/entity/entity-service.d.ts +0 -13
  254. package/dist/_examples/service/entity/entity-service.interface.d.ts +0 -5
  255. package/dist/_examples/service/entity/entity-service.interface.js +0 -3
  256. package/dist/_examples/service/entity/entity-service.interface.js.map +0 -1
  257. package/dist/_examples/service/entity/entity-service.js +0 -92
  258. package/dist/_examples/service/entity/entity-service.js.map +0 -1
  259. package/dist/_examples/service/order-service.d.ts +0 -12
  260. package/dist/_examples/service/order-service.interface.d.ts +0 -5
  261. package/dist/_examples/service/order-service.interface.js +0 -4
  262. package/dist/_examples/service/order-service.interface.js.map +0 -1
  263. package/dist/_examples/service/order-service.js +0 -31
  264. package/dist/_examples/service/order-service.js.map +0 -1
  265. package/dist/_examples/service/raccount/raccount-service.d.ts +0 -10
  266. package/dist/_examples/service/raccount/raccount-service.interface.d.ts +0 -4
  267. package/dist/_examples/service/raccount/raccount-service.interface.js +0 -3
  268. package/dist/_examples/service/raccount/raccount-service.interface.js.map +0 -1
  269. package/dist/_examples/service/raccount/raccount-service.js +0 -64
  270. package/dist/_examples/service/raccount/raccount-service.js.map +0 -1
  271. package/dist/_examples/service/rorder/rorder-service.d.ts +0 -11
  272. package/dist/_examples/service/rorder/rorder-service.interface.d.ts +0 -10
  273. package/dist/_examples/service/rorder/rorder-service.interface.js +0 -3
  274. package/dist/_examples/service/rorder/rorder-service.interface.js.map +0 -1
  275. package/dist/_examples/service/rorder/rorder-service.js +0 -65
  276. package/dist/_examples/service/rorder/rorder-service.js.map +0 -1
  277. package/dist/_examples/service/supplier/supplier-service-crud.d.ts +0 -25
  278. package/dist/_examples/service/supplier/supplier-service-crud.interface.d.ts +0 -14
  279. package/dist/_examples/service/supplier/supplier-service-crud.interface.js +0 -3
  280. package/dist/_examples/service/supplier/supplier-service-crud.interface.js.map +0 -1
  281. package/dist/_examples/service/supplier/supplier-service-crud.js +0 -129
  282. package/dist/_examples/service/supplier/supplier-service-crud.js.map +0 -1
  283. package/dist/_examples/service/supplier/supplier-service-stream.d.ts +0 -13
  284. package/dist/_examples/service/supplier/supplier-service-stream.interface.d.ts +0 -5
  285. package/dist/_examples/service/supplier/supplier-service-stream.interface.js +0 -4
  286. package/dist/_examples/service/supplier/supplier-service-stream.interface.js.map +0 -1
  287. package/dist/_examples/service/supplier/supplier-service-stream.js +0 -72
  288. package/dist/_examples/service/supplier/supplier-service-stream.js.map +0 -1
  289. package/dist/_examples/service/user-service.d.ts +0 -11
  290. package/dist/_examples/service/user-service.interface.d.ts +0 -5
  291. package/dist/_examples/service/user-service.interface.js +0 -3
  292. package/dist/_examples/service/user-service.interface.js.map +0 -1
  293. package/dist/_examples/service/user-service.js +0 -41
  294. package/dist/_examples/service/user-service.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/exception/errors.ts"],"names":[],"mappings":";;;AAAA,MAAa,SAAU,SAAQ,KAAK;IAClC,IAAI,CAAS;IACb,OAAO,CAAS;IAChB,KAAK,CAAM;IACX,YAAY,IAAY,EAAE,OAAe,EAAE,YAAkB;QAC3D,KAAK,CAAC,YAAY,CAAC,CAAC;QACpB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;CACF;AATD,8BASC;AAED,MAAa,aA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uBAAuB,CAAC;IACtC,CAAC;CACF;AALD,sDAKC","sourcesContent":["export class ErrorBase extends Error {\n code: number;\n message: string;\n error: any;\n constructor(code: number, message: string, errorContent?: any) {\n super(errorContent);\n this.code = code;\n this.message = message;\n }\n}\n\nexport class ErrorDynamoDB extends Error {\n tableName: string;\n command: any;\n constructor(tableName: string, command: any, errorContent?: any) {\n super(errorContent);\n this.tableName = tableName;\n this.command = command;\n }\n}\n\nexport interface ErrorCodeMsg {\n code: number;\n error: string;\n}\n\nexport class ErrorHttp extends Error {\n statusCode: number;\n error: string;\n message: string;\n data: any;\n\n constructor(errorCodeMsg: ErrorCodeMsg, errorMessage?: any, errorData?: any) {\n super(errorData);\n this.statusCode = errorCodeMsg.code;\n this.error = errorCodeMsg.error;\n this.message = typeof errorMessage === \"object\" ? JSON.stringify(errorMessage) : errorMessage;\n this.data = errorData;\n }\n}\n\nexport class ErrorValidation extends Error {\n entityName: string;\n validation: Map<string, any>;\n error: any;\n content: any;\n\n constructor(entityName: string, validation: Map<string, any>, errorContent?: any) {\n super(errorContent);\n this.entityName = entityName;\n this.validation = validation;\n this.content = errorContent;\n }\n}\n\nexport class MissingParameterError extends Error {\n constructor(paramName: string) {\n super(`${paramName} is required.`);\n this.name = \"MissingParameterError\";\n }\n}\n"]}
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/exception/errors.ts"],"names":[],"mappings":";;;AAAA,MAAa,SAAU,SAAQ,KAAK;IAClB,IAAI,CAAS;IACb,KAAK,CAAW;IAEhC,YAAY,IAAY,EAAE,OAAe,EAAE,KAAe;QACxD,KAAK,CAAC,OAAO,CAAC,CAAC;QAEf,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QAEnB,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;QAElD,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,WAAW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C,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,OAAO,GAAG,YAAY,CAAC;IAC9B,CAAC;CACF;AAZD,0CAYC;AAED,MAAa,qBAAsB,SAAQ,KAAK;IAC9C,YAAY,SAAiB;QAC3B,KAAK,CAAC,GAAG,SAAS,eAAe,CAAC,CAAC;QACnC,IAAI,CAAC,IAAI,GAAG,uBAAuB,CAAC;IACtC,CAAC;CACF;AALD,sDAKC","sourcesContent":["export class ErrorBase extends Error {\n public readonly code: number;\n public readonly error?: unknown;\n\n constructor(code: number, message: string, error?: unknown) {\n super(message);\n\n this.code = code;\n this.error = error;\n\n Object.setPrototypeOf(this, new.target.prototype);\n\n this.name = this.constructor.name;\n\n if (Error.captureStackTrace) {\n Error.captureStackTrace(this, this.constructor);\n }\n }\n}\n\nexport class ErrorDynamoDB extends Error {\n tableName: string;\n command: any;\n constructor(tableName: string, command: any, errorContent?: any) {\n super(errorContent);\n this.tableName = tableName;\n this.command = command;\n }\n}\n\nexport interface ErrorCodeMsg {\n code: number;\n msg?: string;\n error?: string;\n}\n\nexport class ErrorHttp extends Error {\n statusCode: number;\n error: string;\n message: string;\n data: any;\n\n constructor(errorCodeMsg: ErrorCodeMsg, errorMessage?: any, errorData?: any) {\n super(errorData);\n this.statusCode = errorCodeMsg.code;\n this.error = errorCodeMsg.msg ?? errorCodeMsg.error ?? \"\";\n this.message = typeof errorMessage === \"object\" ? JSON.stringify(errorMessage) : errorMessage;\n this.data = errorData;\n }\n}\n\nexport class ErrorValidation extends Error {\n entityName: string;\n validation: Map<string, any>;\n error: any;\n content: any;\n\n constructor(entityName: string, validation: Map<string, any>, errorContent?: any) {\n super(errorContent);\n this.entityName = entityName;\n this.validation = validation;\n this.content = errorContent;\n }\n}\n\nexport class MissingParameterError extends Error {\n constructor(paramName: string) {\n super(`${paramName} is required.`);\n this.name = \"MissingParameterError\";\n }\n}\n"]}
@@ -1,238 +1,240 @@
1
- export declare const errorHandlerHttp: (error: any) => {
1
+ type HttpErrorResponse = {
2
2
  statusCode: number;
3
3
  content: {
4
4
  error: string;
5
- message: any;
6
- data: any;
5
+ message: unknown;
6
+ data: unknown;
7
7
  };
8
8
  };
9
+ export declare const refineHttpError: (err: any) => HttpErrorResponse;
9
10
  export declare const HTTP: {
10
11
  CONTINUE: {
11
- error: string;
12
+ msg: string;
12
13
  code: number;
13
14
  };
14
15
  SWITCHING_PROTOCOLS: {
15
- error: string;
16
+ msg: string;
16
17
  code: number;
17
18
  };
18
19
  PROCESSING: {
19
- error: string;
20
+ msg: string;
20
21
  code: number;
21
22
  };
22
23
  OK: {
23
- error: string;
24
+ msg: string;
24
25
  code: number;
25
26
  };
26
27
  CREATED: {
27
- error: string;
28
+ msg: string;
28
29
  code: number;
29
30
  };
30
31
  ACCEPTED: {
31
- error: string;
32
+ msg: string;
32
33
  code: number;
33
34
  };
34
35
  NON_AUTHORITATIVE_INFORMATION: {
35
- error: string;
36
+ msg: string;
36
37
  code: number;
37
38
  };
38
39
  NO_CONTENT: {
39
- error: string;
40
+ msg: string;
40
41
  code: number;
41
42
  };
42
43
  RESET_CONTENT: {
43
- error: string;
44
+ msg: string;
44
45
  code: number;
45
46
  };
46
47
  PARTIAL_CONTENT: {
47
- error: string;
48
+ msg: string;
48
49
  code: number;
49
50
  };
50
51
  MULTIPLE_CHOICES: {
51
- error: string;
52
+ msg: string;
52
53
  code: number;
53
54
  };
54
55
  MOVED_PERMANENTLY: {
55
- error: string;
56
+ msg: string;
56
57
  code: number;
57
58
  };
58
59
  FOUND: {
59
- error: string;
60
+ msg: string;
60
61
  code: number;
61
62
  };
62
63
  SEE_OTHER: {
63
- error: string;
64
+ msg: string;
64
65
  code: number;
65
66
  };
66
67
  NOT_MODIFIED: {
67
- error: string;
68
+ msg: string;
68
69
  code: number;
69
70
  };
70
71
  TEMPORARY_REDIRECT: {
71
- error: string;
72
+ msg: string;
72
73
  code: number;
73
74
  };
74
75
  PERMANENT_REDIRECT: {
75
- error: string;
76
+ msg: string;
76
77
  code: number;
77
78
  };
78
79
  BAD_REQUEST: {
79
- error: string;
80
+ msg: string;
80
81
  code: number;
81
82
  };
82
83
  UNAUTHORIZED: {
83
- error: string;
84
+ msg: string;
84
85
  code: number;
85
86
  };
86
87
  PAYMENT_REQUIRED: {
87
- error: string;
88
+ msg: string;
88
89
  code: number;
89
90
  };
90
91
  FORBIDDEN: {
91
- error: string;
92
+ msg: string;
92
93
  code: number;
93
94
  };
94
95
  NOT_FOUND: {
95
- error: string;
96
+ msg: string;
96
97
  code: number;
97
98
  };
98
99
  METHOD_NOT_ALLOWED: {
99
- error: string;
100
+ msg: string;
100
101
  code: number;
101
102
  };
102
103
  NOT_ACCEPTABLE: {
103
- error: string;
104
+ msg: string;
104
105
  code: number;
105
106
  };
106
107
  PROXY_AUTHENTICATION_REQUIRED: {
107
- error: string;
108
+ msg: string;
108
109
  code: number;
109
110
  };
110
111
  REQUEST_TIMEOUT: {
111
- error: string;
112
+ msg: string;
112
113
  code: number;
113
114
  };
114
115
  CONFLICT: {
115
- error: string;
116
+ msg: string;
116
117
  code: number;
117
118
  };
118
119
  GONE: {
119
- error: string;
120
+ msg: string;
120
121
  code: number;
121
122
  };
122
123
  LENGTH_REQUIRED: {
123
- error: string;
124
+ msg: string;
124
125
  code: number;
125
126
  };
126
127
  PRECONDITION_FAILED: {
127
- error: string;
128
+ msg: string;
128
129
  code: number;
129
130
  };
130
131
  PAYLOAD_TOO_LARGE: {
131
- error: string;
132
+ msg: string;
132
133
  code: number;
133
134
  };
134
135
  URI_TOO_LONG: {
135
- error: string;
136
+ msg: string;
136
137
  code: number;
137
138
  };
138
139
  UNSUPPORTED_MEDIA_TYPE: {
139
- error: string;
140
+ msg: string;
140
141
  code: number;
141
142
  };
142
143
  RANGE_NOT_SATISFIABLE: {
143
- error: string;
144
+ msg: string;
144
145
  code: number;
145
146
  };
146
147
  EXPECTATION_FAILED: {
147
- error: string;
148
+ msg: string;
148
149
  code: number;
149
150
  };
150
151
  IM_A_TEAPOT: {
151
- error: string;
152
+ msg: string;
152
153
  code: number;
153
154
  };
154
155
  MISDIRECTED_REQUEST: {
155
- error: string;
156
+ msg: string;
156
157
  code: number;
157
158
  };
158
159
  UNPROCESSABLE_ENTITY: {
159
- error: string;
160
+ msg: string;
160
161
  code: number;
161
162
  };
162
163
  LOCKED: {
163
- error: string;
164
+ msg: string;
164
165
  code: number;
165
166
  };
166
167
  FAILED_DEPENDENCY: {
167
- error: string;
168
+ msg: string;
168
169
  code: number;
169
170
  };
170
171
  TOO_EARLY: {
171
- error: string;
172
+ msg: string;
172
173
  code: number;
173
174
  };
174
175
  UPGRADE_REQUIRED: {
175
- error: string;
176
+ msg: string;
176
177
  code: number;
177
178
  };
178
179
  PRECONDITION_REQUIRED: {
179
- error: string;
180
+ msg: string;
180
181
  code: number;
181
182
  };
182
183
  TOO_MANY_REQUESTS: {
183
- error: string;
184
+ msg: string;
184
185
  code: number;
185
186
  };
186
187
  REQUEST_HEADER_FIELDS_TOO_LARGE: {
187
- error: string;
188
+ msg: string;
188
189
  code: number;
189
190
  };
190
191
  UNAVAILABLE_FOR_LEGAL_REASONS: {
191
- error: string;
192
+ msg: string;
192
193
  code: number;
193
194
  };
194
195
  INTERNAL_SERVER_ERROR: {
195
- error: string;
196
+ msg: string;
196
197
  code: number;
197
198
  };
198
199
  NOT_IMPLEMENTED: {
199
- error: string;
200
+ msg: string;
200
201
  code: number;
201
202
  };
202
203
  BAD_GATEWAY: {
203
- error: string;
204
+ msg: string;
204
205
  code: number;
205
206
  };
206
207
  SERVICE_UNAVAILABLE: {
207
- error: string;
208
+ msg: string;
208
209
  code: number;
209
210
  };
210
211
  GATEWAY_TIMEOUT: {
211
- error: string;
212
+ msg: string;
212
213
  code: number;
213
214
  };
214
215
  HTTP_VERSION_NOT_SUPPORTED: {
215
- error: string;
216
+ msg: string;
216
217
  code: number;
217
218
  };
218
219
  VARIANT_ALSO_NEGOTIATES: {
219
- error: string;
220
+ msg: string;
220
221
  code: number;
221
222
  };
222
223
  INSUFFICIENT_STORAGE: {
223
- error: string;
224
+ msg: string;
224
225
  code: number;
225
226
  };
226
227
  LOOP_DETECTED: {
227
- error: string;
228
+ msg: string;
228
229
  code: number;
229
230
  };
230
231
  NOT_EXTENDED: {
231
- error: string;
232
+ msg: string;
232
233
  code: number;
233
234
  };
234
235
  NETWORK_AUTHENTICATION_REQUIRED: {
235
- error: string;
236
+ msg: string;
236
237
  code: number;
237
238
  };
238
239
  };
240
+ export {};
@@ -1,120 +1,109 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.HTTP = exports.errorHandlerHttp = void 0;
3
+ exports.HTTP = exports.refineHttpError = void 0;
4
4
  const errors_1 = require("./errors");
5
- const errorHandlerHttp = (error) => {
6
- const httpStatus = exports.HTTP;
7
- const msg = error?.message;
8
- let response = httpStatus.INTERNAL_SERVER_ERROR;
9
- let responseMsg = msg;
10
- let data = error?.data;
11
- if (error instanceof errors_1.ErrorValidation) {
12
- response = httpStatus.BAD_REQUEST;
13
- response.error = response.error + " - Validation Error";
14
- // responseMsg = error.validation
15
- responseMsg = Object.fromEntries(error.validation.entries());
16
- data = error.content;
17
- }
18
- else if (error instanceof errors_1.ErrorHttp) {
19
- response.code = error.statusCode;
20
- response.error = error.error;
21
- responseMsg = error.message;
22
- data = error.data;
5
+ const refineHttpError = (err) => {
6
+ let http = {
7
+ code: err.statusCode ?? exports.HTTP.INTERNAL_SERVER_ERROR.code,
8
+ msg: err.error ?? exports.HTTP.INTERNAL_SERVER_ERROR.msg,
9
+ };
10
+ let message = err.message ?? "An unexpected error occurred.";
11
+ let data = err.content;
12
+ if (err instanceof errors_1.ErrorValidation) {
13
+ http = exports.HTTP.BAD_REQUEST;
14
+ http.msg += " - Validation failed.";
23
15
  }
24
- else if (error instanceof errors_1.ErrorDynamoDB) {
25
- const err = error;
26
- if (msg.includes("ConditionalCheckFailedException")) {
27
- response = httpStatus.CONFLICT;
28
- response.error = response.error + " - DynamoDB Error";
29
- responseMsg =
30
- `ConditionalCheckFailedException: by table: ${err.tableName}, command: ${err.command}, error: ` +
31
- JSON.stringify(err);
16
+ else if (err instanceof errors_1.ErrorDynamoDB) {
17
+ if (message.includes("requires indexName and indexValue")) {
18
+ http = exports.HTTP.BAD_REQUEST;
19
+ message = `Index name and value are required: ${err.tableName}`;
32
20
  }
33
- else if (msg.includes("ResourceNotFoundException")) {
34
- response = httpStatus.NOT_FOUND;
35
- responseMsg = `Resource not found: ${err.tableName}`;
21
+ if (message.includes("ResourceNotFoundException")) {
22
+ http = exports.HTTP.BAD_REQUEST;
23
+ message = `Resource not found: ${err.tableName}`;
36
24
  }
37
- else if (msg.includes("requires indexName and indexValue")) {
38
- response = httpStatus.BAD_REQUEST;
39
- responseMsg = `Index name and value are required: ${err.tableName}`;
25
+ else if (message.includes("ConditionalCheckFailedException")) {
26
+ http = exports.HTTP.BAD_REQUEST;
27
+ message = `ConditionalCheckFailedException: by table: ${err.tableName}, command: ${err.command}}`;
40
28
  }
29
+ message = `Database Error: ${err.tableName}`;
41
30
  }
42
- else if (msg?.includes("search_phase_execution_exception")) {
43
- response = httpStatus.BAD_REQUEST;
44
- responseMsg = "OpenSearch: Cannot sort by text field use '.keyword' instead.";
31
+ else if (message.includes("search_phase_execution_exception")) {
32
+ http = exports.HTTP.BAD_REQUEST;
33
+ message = "OpenSearch: Cannot sort by text field - use '.keyword' instead.";
45
34
  }
46
35
  return {
47
- statusCode: response.code,
36
+ statusCode: http.code,
48
37
  content: {
49
- error: response.error,
50
- message: responseMsg,
51
- data: data,
38
+ error: http.msg,
39
+ message,
40
+ data,
52
41
  },
53
42
  };
54
43
  };
55
- exports.errorHandlerHttp = errorHandlerHttp;
44
+ exports.refineHttpError = refineHttpError;
56
45
  exports.HTTP = {
57
46
  // 1xx Informational
58
- CONTINUE: { error: "Continue", code: 100 },
59
- SWITCHING_PROTOCOLS: { error: "Switching Protocols", code: 101 },
60
- PROCESSING: { error: "Processing", code: 102 },
47
+ CONTINUE: { msg: "Continue", code: 100 },
48
+ SWITCHING_PROTOCOLS: { msg: "Switching Protocols", code: 101 },
49
+ PROCESSING: { msg: "Processing", code: 102 },
61
50
  // 2xx Success
62
- OK: { error: "OK", code: 200 },
63
- CREATED: { error: "Created", code: 201 },
64
- ACCEPTED: { error: "Accepted", code: 202 },
65
- NON_AUTHORITATIVE_INFORMATION: { error: "Non-Authoritative Information", code: 203 },
66
- NO_CONTENT: { error: "No Content", code: 204 },
67
- RESET_CONTENT: { error: "Reset Content", code: 205 },
68
- PARTIAL_CONTENT: { error: "Partial Content", code: 206 },
51
+ OK: { msg: "OK", code: 200 },
52
+ CREATED: { msg: "Created", code: 201 },
53
+ ACCEPTED: { msg: "Accepted", code: 202 },
54
+ NON_AUTHORITATIVE_INFORMATION: { msg: "Non-Authoritative Information", code: 203 },
55
+ NO_CONTENT: { msg: "No Content", code: 204 },
56
+ RESET_CONTENT: { msg: "Reset Content", code: 205 },
57
+ PARTIAL_CONTENT: { msg: "Partial Content", code: 206 },
69
58
  // 3xx Redirection
70
- MULTIPLE_CHOICES: { error: "Multiple Choices", code: 300 },
71
- MOVED_PERMANENTLY: { error: "Moved Permanently", code: 301 },
72
- FOUND: { error: "Found", code: 302 },
73
- SEE_OTHER: { error: "See Other", code: 303 },
74
- NOT_MODIFIED: { error: "Not Modified", code: 304 },
75
- TEMPORARY_REDIRECT: { error: "Temporary Redirect", code: 307 },
76
- PERMANENT_REDIRECT: { error: "Permanent Redirect", code: 308 },
59
+ MULTIPLE_CHOICES: { msg: "Multiple Choices", code: 300 },
60
+ MOVED_PERMANENTLY: { msg: "Moved Permanently", code: 301 },
61
+ FOUND: { msg: "Found", code: 302 },
62
+ SEE_OTHER: { msg: "See Other", code: 303 },
63
+ NOT_MODIFIED: { msg: "Not Modified", code: 304 },
64
+ TEMPORARY_REDIRECT: { msg: "Temporary Redirect", code: 307 },
65
+ PERMANENT_REDIRECT: { msg: "Permanent Redirect", code: 308 },
77
66
  // 4xx Client Errors
78
- BAD_REQUEST: { error: "Bad Request", code: 400 },
79
- UNAUTHORIZED: { error: "Unauthorized", code: 401 },
80
- PAYMENT_REQUIRED: { error: "Payment Required", code: 402 },
81
- FORBIDDEN: { error: "Forbidden", code: 403 },
82
- NOT_FOUND: { error: "Not Found", code: 404 },
83
- METHOD_NOT_ALLOWED: { error: "Method Not Allowed", code: 405 },
84
- NOT_ACCEPTABLE: { error: "Not Acceptable", code: 406 },
85
- PROXY_AUTHENTICATION_REQUIRED: { error: "Proxy Authentication Required", code: 407 },
86
- REQUEST_TIMEOUT: { error: "Request Timeout", code: 408 },
87
- CONFLICT: { error: "Conflict", code: 409 },
88
- GONE: { error: "Gone", code: 410 },
89
- LENGTH_REQUIRED: { error: "Length Required", code: 411 },
90
- PRECONDITION_FAILED: { error: "Precondition Failed", code: 412 },
91
- PAYLOAD_TOO_LARGE: { error: "Payload Too Large", code: 413 },
92
- URI_TOO_LONG: { error: "URI Too Long", code: 414 },
93
- UNSUPPORTED_MEDIA_TYPE: { error: "Unsupported Media Type", code: 415 },
94
- RANGE_NOT_SATISFIABLE: { error: "Range Not Satisfiable", code: 416 },
95
- EXPECTATION_FAILED: { error: "Expectation Failed", code: 417 },
96
- IM_A_TEAPOT: { error: "I'm a teapot", code: 418 },
97
- MISDIRECTED_REQUEST: { error: "Misdirected Request", code: 421 },
98
- UNPROCESSABLE_ENTITY: { error: "Unprocessable Entity", code: 422 },
99
- LOCKED: { error: "Locked", code: 423 },
100
- FAILED_DEPENDENCY: { error: "Failed Dependency", code: 424 },
101
- TOO_EARLY: { error: "Too Early", code: 425 },
102
- UPGRADE_REQUIRED: { error: "Upgrade Required", code: 426 },
103
- PRECONDITION_REQUIRED: { error: "Precondition Required", code: 428 },
104
- TOO_MANY_REQUESTS: { error: "Too Many Requests", code: 429 },
105
- REQUEST_HEADER_FIELDS_TOO_LARGE: { error: "Request Header Fields Too Large", code: 431 },
106
- UNAVAILABLE_FOR_LEGAL_REASONS: { error: "Unavailable For Legal Reasons", code: 451 },
67
+ BAD_REQUEST: { msg: "Bad Request", code: 400 },
68
+ UNAUTHORIZED: { msg: "Unauthorized", code: 401 },
69
+ PAYMENT_REQUIRED: { msg: "Payment Required", code: 402 },
70
+ FORBIDDEN: { msg: "Forbidden", code: 403 },
71
+ NOT_FOUND: { msg: "Not Found", code: 404 },
72
+ METHOD_NOT_ALLOWED: { msg: "Method Not Allowed", code: 405 },
73
+ NOT_ACCEPTABLE: { msg: "Not Acceptable", code: 406 },
74
+ PROXY_AUTHENTICATION_REQUIRED: { msg: "Proxy Authentication Required", code: 407 },
75
+ REQUEST_TIMEOUT: { msg: "Request Timeout", code: 408 },
76
+ CONFLICT: { msg: "Conflict", code: 409 },
77
+ GONE: { msg: "Gone", code: 410 },
78
+ LENGTH_REQUIRED: { msg: "Length Required", code: 411 },
79
+ PRECONDITION_FAILED: { msg: "Precondition Failed", code: 412 },
80
+ PAYLOAD_TOO_LARGE: { msg: "Payload Too Large", code: 413 },
81
+ URI_TOO_LONG: { msg: "URI Too Long", code: 414 },
82
+ UNSUPPORTED_MEDIA_TYPE: { msg: "Unsupported Media Type", code: 415 },
83
+ RANGE_NOT_SATISFIABLE: { msg: "Range Not Satisfiable", code: 416 },
84
+ EXPECTATION_FAILED: { msg: "Expectation Failed", code: 417 },
85
+ IM_A_TEAPOT: { msg: "I'm a teapot", code: 418 },
86
+ MISDIRECTED_REQUEST: { msg: "Misdirected Request", code: 421 },
87
+ UNPROCESSABLE_ENTITY: { msg: "Unprocessable Entity", code: 422 },
88
+ LOCKED: { msg: "Locked", code: 423 },
89
+ FAILED_DEPENDENCY: { msg: "Failed Dependency", code: 424 },
90
+ TOO_EARLY: { msg: "Too Early", code: 425 },
91
+ UPGRADE_REQUIRED: { msg: "Upgrade Required", code: 426 },
92
+ PRECONDITION_REQUIRED: { msg: "Precondition Required", code: 428 },
93
+ TOO_MANY_REQUESTS: { msg: "Too Many Requests", code: 429 },
94
+ REQUEST_HEADER_FIELDS_TOO_LARGE: { msg: "Request Header Fields Too Large", code: 431 },
95
+ UNAVAILABLE_FOR_LEGAL_REASONS: { msg: "Unavailable For Legal Reasons", code: 451 },
107
96
  // 5xx Server Errors
108
- INTERNAL_SERVER_ERROR: { error: "Internal Server Error", code: 500 },
109
- NOT_IMPLEMENTED: { error: "Not Implemented", code: 501 },
110
- BAD_GATEWAY: { error: "Bad Gateway", code: 502 },
111
- SERVICE_UNAVAILABLE: { error: "Service Unavailable", code: 503 },
112
- GATEWAY_TIMEOUT: { error: "Gateway Timeout", code: 504 },
113
- HTTP_VERSION_NOT_SUPPORTED: { error: "HTTP Version Not Supported", code: 505 },
114
- VARIANT_ALSO_NEGOTIATES: { error: "Variant Also Negotiates", code: 506 },
115
- INSUFFICIENT_STORAGE: { error: "Insufficient Storage", code: 507 },
116
- LOOP_DETECTED: { error: "Loop Detected", code: 508 },
117
- NOT_EXTENDED: { error: "Not Extended", code: 510 },
118
- NETWORK_AUTHENTICATION_REQUIRED: { error: "Network Authentication Required", code: 511 },
97
+ INTERNAL_SERVER_ERROR: { msg: "Internal Server Error", code: 500 },
98
+ NOT_IMPLEMENTED: { msg: "Not Implemented", code: 501 },
99
+ BAD_GATEWAY: { msg: "Bad Gateway", code: 502 },
100
+ SERVICE_UNAVAILABLE: { msg: "Service Unavailable", code: 503 },
101
+ GATEWAY_TIMEOUT: { msg: "Gateway Timeout", code: 504 },
102
+ HTTP_VERSION_NOT_SUPPORTED: { msg: "HTTP Version Not Supported", code: 505 },
103
+ VARIANT_ALSO_NEGOTIATES: { msg: "Variant Also Negotiates", code: 506 },
104
+ INSUFFICIENT_STORAGE: { msg: "Insufficient Storage", code: 507 },
105
+ LOOP_DETECTED: { msg: "Loop Detected", code: 508 },
106
+ NOT_EXTENDED: { msg: "Not Extended", code: 510 },
107
+ NETWORK_AUTHENTICATION_REQUIRED: { msg: "Network Authentication Required", code: 511 },
119
108
  };
120
109
  //# sourceMappingURL=exception-handler.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"exception-handler.js","source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EAAE,sBAAsB,EAAE,IAAI,EAAE,GAAG,EAAE;IAClE,aAAa,EAAE,EAAE,KAAK,EAAE,eAAe,EAAE,IAAI,EAAE,GAAG,EAAE;IACpD,YAAY,EAAE,EAAE,KAAK,EAAE,cAAc,EAAE,IAAI,EAAE,GAAG,EAAE;IAClD,+BAA+B,EAAE,EAAE,KAAK,EAAE,iCAAiC,EAAE,IAAI,EAAE,GAAG,EAAE;CACzF,CAAC","sourcesContent":["import { ErrorDynamoDB, ErrorHttp, ErrorValidation } from \"./errors\";\n\nexport const errorHandlerHttp = (error: any) => {\n const httpStatus = HTTP;\n\n const msg = error?.message;\n\n let response = httpStatus.INTERNAL_SERVER_ERROR;\n let responseMsg = msg;\n let data = error?.data;\n\n if (error instanceof ErrorValidation) {\n response = httpStatus.BAD_REQUEST;\n response.error = response.error + \" - Validation Error\";\n // responseMsg = error.validation\n responseMsg = Object.fromEntries(error.validation.entries());\n data = error.content;\n } else if (error instanceof ErrorHttp) {\n response.code = error.statusCode;\n response.error = error.error;\n responseMsg = error.message;\n data = error.data;\n } else if (error instanceof ErrorDynamoDB) {\n const err = error;\n if (msg.includes(\"ConditionalCheckFailedException\")) {\n response = httpStatus.CONFLICT;\n response.error = response.error + \" - DynamoDB Error\";\n responseMsg =\n `ConditionalCheckFailedException: by table: ${err.tableName}, command: ${err.command}, error: ` +\n JSON.stringify(err);\n } else if (msg.includes(\"ResourceNotFoundException\")) {\n response = httpStatus.NOT_FOUND;\n responseMsg = `Resource not found: ${err.tableName}`;\n } else if (msg.includes(\"requires indexName and indexValue\")) {\n response = httpStatus.BAD_REQUEST;\n responseMsg = `Index name and value are required: ${err.tableName}`;\n }\n } else if (msg?.includes(\"search_phase_execution_exception\")) {\n response = httpStatus.BAD_REQUEST;\n responseMsg = \"OpenSearch: Cannot sort by text field — use '.keyword' instead.\";\n }\n\n return {\n statusCode: response.code,\n content: {\n error: response.error,\n message: responseMsg,\n data: data,\n },\n };\n};\n\nexport const HTTP = {\n // 1xx Informational\n CONTINUE: { error: \"Continue\", code: 100 },\n SWITCHING_PROTOCOLS: { error: \"Switching Protocols\", code: 101 },\n PROCESSING: { error: \"Processing\", code: 102 },\n\n // 2xx Success\n OK: { error: \"OK\", code: 200 },\n CREATED: { error: \"Created\", code: 201 },\n ACCEPTED: { error: \"Accepted\", code: 202 },\n NON_AUTHORITATIVE_INFORMATION: { error: \"Non-Authoritative Information\", code: 203 },\n NO_CONTENT: { error: \"No Content\", code: 204 },\n RESET_CONTENT: { error: \"Reset Content\", code: 205 },\n PARTIAL_CONTENT: { error: \"Partial Content\", code: 206 },\n\n // 3xx Redirection\n MULTIPLE_CHOICES: { error: \"Multiple Choices\", code: 300 },\n MOVED_PERMANENTLY: { error: \"Moved Permanently\", code: 301 },\n FOUND: { error: \"Found\", code: 302 },\n SEE_OTHER: { error: \"See Other\", code: 303 },\n NOT_MODIFIED: { error: \"Not Modified\", code: 304 },\n TEMPORARY_REDIRECT: { error: \"Temporary Redirect\", code: 307 },\n PERMANENT_REDIRECT: { error: \"Permanent Redirect\", code: 308 },\n\n // 4xx Client Errors\n BAD_REQUEST: { error: \"Bad Request\", code: 400 },\n UNAUTHORIZED: { error: \"Unauthorized\", code: 401 },\n PAYMENT_REQUIRED: { error: \"Payment Required\", code: 402 },\n FORBIDDEN: { error: \"Forbidden\", code: 403 },\n NOT_FOUND: { error: \"Not Found\", code: 404 },\n METHOD_NOT_ALLOWED: { error: \"Method Not Allowed\", code: 405 },\n NOT_ACCEPTABLE: { error: \"Not Acceptable\", code: 406 },\n PROXY_AUTHENTICATION_REQUIRED: { error: \"Proxy Authentication Required\", code: 407 },\n REQUEST_TIMEOUT: { error: \"Request Timeout\", code: 408 },\n CONFLICT: { error: \"Conflict\", code: 409 },\n GONE: { error: \"Gone\", code: 410 },\n LENGTH_REQUIRED: { error: \"Length Required\", code: 411 },\n PRECONDITION_FAILED: { error: \"Precondition Failed\", code: 412 },\n PAYLOAD_TOO_LARGE: { error: \"Payload Too Large\", code: 413 },\n URI_TOO_LONG: { error: \"URI Too Long\", code: 414 },\n UNSUPPORTED_MEDIA_TYPE: { error: \"Unsupported Media Type\", code: 415 },\n RANGE_NOT_SATISFIABLE: { error: \"Range Not Satisfiable\", code: 416 },\n EXPECTATION_FAILED: { error: \"Expectation Failed\", code: 417 },\n IM_A_TEAPOT: { error: \"I'm a teapot\", code: 418 },\n MISDIRECTED_REQUEST: { error: \"Misdirected Request\", code: 421 },\n UNPROCESSABLE_ENTITY: { error: \"Unprocessable Entity\", code: 422 },\n LOCKED: { error: \"Locked\", code: 423 },\n FAILED_DEPENDENCY: { error: \"Failed Dependency\", code: 424 },\n TOO_EARLY: { error: \"Too Early\", code: 425 },\n UPGRADE_REQUIRED: { error: \"Upgrade Required\", code: 426 },\n PRECONDITION_REQUIRED: { error: \"Precondition Required\", code: 428 },\n TOO_MANY_REQUESTS: { error: \"Too Many Requests\", code: 429 },\n REQUEST_HEADER_FIELDS_TOO_LARGE: { error: \"Request Header Fields Too Large\", code: 431 },\n UNAVAILABLE_FOR_LEGAL_REASONS: { error: \"Unavailable For Legal Reasons\", code: 451 },\n\n // 5xx Server Errors\n INTERNAL_SERVER_ERROR: { error: \"Internal Server Error\", code: 500 },\n NOT_IMPLEMENTED: { error: \"Not Implemented\", code: 501 },\n BAD_GATEWAY: { error: \"Bad Gateway\", code: 502 },\n SERVICE_UNAVAILABLE: { error: \"Service Unavailable\", code: 503 },\n GATEWAY_TIMEOUT: { error: \"Gateway Timeout\", code: 504 },\n HTTP_VERSION_NOT_SUPPORTED: { error: \"HTTP Version Not Supported\", code: 505 },\n VARIANT_ALSO_NEGOTIATES: { error: \"Variant Also Negotiates\", code: 506 },\n INSUFFICIENT_STORAGE: { error: \"Insufficient Storage\", code: 507 },\n LOOP_DETECTED: { error: \"Loop Detected\", code: 508 },\n NOT_EXTENDED: { error: \"Not Extended\", code: 510 },\n NETWORK_AUTHENTICATION_REQUIRED: { error: \"Network Authentication Required\", code: 511 },\n};\n"]}
1
+ {"version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B,EAAE,IAAI,EAAE,GAAG,EAAE;IAC1D,+BAA+B,EAAE,EAAE,GAAG,EAAE,iCAAiC,EAAE,IAAI,EAAE,GAAG,EAAE;IACtF,6BAA6B,EAAE,EAAE,GAAG,EAAE,+BAA+B,EAAE,IAAI,EAAE,GAAG,EAAE;IAElF,oBAAoB;IACpB,qBAAqB,EAAE,EAAE,GAAG,EAAE,uBAAuB,EAAE,IAAI,EAAE,GAAG,EAAE;IAClE,eAAe,EAAE,EAAE,GAAG,EAAE,iBAAiB,EAAE,IAAI,EAAE,GAAG,EAAE;IACtD,WAAW,EAAE,EAAE,GAAG,EAAE,aAAa,EAAE,IAAI,EAAE,GAAG,EAAE;IAC9C,mBAAmB,EAAE,EAAE,GAAG,EAAE,qBAAqB,EAAE,IAAI,EAAE,GAAG,EAAE;IAC9D,eAAe,EAAE,EAAE,GAAG,EAAE,iBAAiB,EAAE,IAAI,EAAE,GAAG,EAAE;IACtD,0BAA0B,EAAE,EAAE,GAAG,EAAE,4BAA4B,EAAE,IAAI,EAAE,GAAG,EAAE;IAC5E,uBAAuB,EAAE,EAAE,GAAG,EAAE,yBAAyB,EAAE,IAAI,EAAE,GAAG,EAAE;IACtE,oBAAoB,EAAE,EAAE,GAAG,EAAE,sBAAsB,EAAE,IAAI,EAAE,GAAG,EAAE;IAChE,aAAa,EAAE,EAAE,GAAG,EAAE,eAAe,EAAE,IAAI,EAAE,GAAG,EAAE;IAClD,YAAY,EAAE,EAAE,GAAG,EAAE,cAAc,EAAE,IAAI,EAAE,GAAG,EAAE;IAChD,+BAA+B,EAAE,EAAE,GAAG,EAAE,iCAAiC,EAAE,IAAI,EAAE,GAAG,EAAE;CACvF,CAAC","sourcesContent":["import { ErrorDynamoDB, ErrorValidation } from \"./errors\";\n\ntype HttpStatus = { code: number; msg: string };\n\ntype HttpErrorResponse = {\n statusCode: number;\n content: {\n error: string;\n message: unknown;\n data: unknown;\n };\n};\n\nexport const refineHttpError = (err: any): HttpErrorResponse => {\n let http: HttpStatus = {\n code: err.statusCode ?? HTTP.INTERNAL_SERVER_ERROR.code,\n msg: err.error ?? HTTP.INTERNAL_SERVER_ERROR.msg,\n };\n\n let message = err.message ?? \"An unexpected error occurred.\";\n let data = err.content;\n\n if (err instanceof ErrorValidation) {\n http = HTTP.BAD_REQUEST;\n http.msg += \" - Validation failed.\";\n } else if (err instanceof ErrorDynamoDB) {\n if (message.includes(\"requires indexName and indexValue\")) {\n http = HTTP.BAD_REQUEST;\n message = `Index name and value are required: ${err.tableName}`;\n }\n if (message.includes(\"ResourceNotFoundException\")) {\n http = HTTP.BAD_REQUEST;\n message = `Resource not found: ${err.tableName}`;\n } else if (message.includes(\"ConditionalCheckFailedException\")) {\n http = HTTP.BAD_REQUEST;\n message = `ConditionalCheckFailedException: by table: ${err.tableName}, command: ${err.command}}`;\n }\n message = `Database Error: ${err.tableName}`;\n } else if (message.includes(\"search_phase_execution_exception\")) {\n http = HTTP.BAD_REQUEST;\n message = \"OpenSearch: Cannot sort by text field - use '.keyword' instead.\";\n }\n\n return {\n statusCode: http.code,\n content: {\n error: http.msg,\n message,\n data,\n },\n };\n};\n\nexport const HTTP = {\n // 1xx Informational\n CONTINUE: { msg: \"Continue\", code: 100 },\n SWITCHING_PROTOCOLS: { msg: \"Switching Protocols\", code: 101 },\n PROCESSING: { msg: \"Processing\", code: 102 },\n\n // 2xx Success\n OK: { msg: \"OK\", code: 200 },\n CREATED: { msg: \"Created\", code: 201 },\n ACCEPTED: { msg: \"Accepted\", code: 202 },\n NON_AUTHORITATIVE_INFORMATION: { msg: \"Non-Authoritative Information\", code: 203 },\n NO_CONTENT: { msg: \"No Content\", code: 204 },\n RESET_CONTENT: { msg: \"Reset Content\", code: 205 },\n PARTIAL_CONTENT: { msg: \"Partial Content\", code: 206 },\n\n // 3xx Redirection\n MULTIPLE_CHOICES: { msg: \"Multiple Choices\", code: 300 },\n MOVED_PERMANENTLY: { msg: \"Moved Permanently\", code: 301 },\n FOUND: { msg: \"Found\", code: 302 },\n SEE_OTHER: { msg: \"See Other\", code: 303 },\n NOT_MODIFIED: { msg: \"Not Modified\", code: 304 },\n TEMPORARY_REDIRECT: { msg: \"Temporary Redirect\", code: 307 },\n PERMANENT_REDIRECT: { msg: \"Permanent Redirect\", code: 308 },\n\n // 4xx Client Errors\n BAD_REQUEST: { msg: \"Bad Request\", code: 400 },\n UNAUTHORIZED: { msg: \"Unauthorized\", code: 401 },\n PAYMENT_REQUIRED: { msg: \"Payment Required\", code: 402 },\n FORBIDDEN: { msg: \"Forbidden\", code: 403 },\n NOT_FOUND: { msg: \"Not Found\", code: 404 },\n METHOD_NOT_ALLOWED: { msg: \"Method Not Allowed\", code: 405 },\n NOT_ACCEPTABLE: { msg: \"Not Acceptable\", code: 406 },\n PROXY_AUTHENTICATION_REQUIRED: { msg: \"Proxy Authentication Required\", code: 407 },\n REQUEST_TIMEOUT: { msg: \"Request Timeout\", code: 408 },\n CONFLICT: { msg: \"Conflict\", code: 409 },\n GONE: { msg: \"Gone\", code: 410 },\n LENGTH_REQUIRED: { msg: \"Length Required\", code: 411 },\n PRECONDITION_FAILED: { msg: \"Precondition Failed\", code: 412 },\n PAYLOAD_TOO_LARGE: { msg: \"Payload Too Large\", code: 413 },\n URI_TOO_LONG: { msg: \"URI Too Long\", code: 414 },\n UNSUPPORTED_MEDIA_TYPE: { msg: \"Unsupported Media Type\", code: 415 },\n RANGE_NOT_SATISFIABLE: { msg: \"Range Not Satisfiable\", code: 416 },\n EXPECTATION_FAILED: { msg: \"Expectation Failed\", code: 417 },\n IM_A_TEAPOT: { msg: \"I'm a teapot\", code: 418 },\n MISDIRECTED_REQUEST: { msg: \"Misdirected Request\", code: 421 },\n UNPROCESSABLE_ENTITY: { msg: \"Unprocessable Entity\", code: 422 },\n LOCKED: { msg: \"Locked\", code: 423 },\n FAILED_DEPENDENCY: { msg: \"Failed Dependency\", code: 424 },\n TOO_EARLY: { msg: \"Too Early\", code: 425 },\n UPGRADE_REQUIRED: { msg: \"Upgrade Required\", code: 426 },\n PRECONDITION_REQUIRED: { msg: \"Precondition Required\", code: 428 },\n TOO_MANY_REQUESTS: { msg: \"Too Many Requests\", code: 429 },\n REQUEST_HEADER_FIELDS_TOO_LARGE: { msg: \"Request Header Fields Too Large\", code: 431 },\n UNAVAILABLE_FOR_LEGAL_REASONS: { msg: \"Unavailable For Legal Reasons\", code: 451 },\n\n // 5xx Server Errors\n INTERNAL_SERVER_ERROR: { msg: \"Internal Server Error\", code: 500 },\n NOT_IMPLEMENTED: { msg: \"Not Implemented\", code: 501 },\n BAD_GATEWAY: { msg: \"Bad Gateway\", code: 502 },\n SERVICE_UNAVAILABLE: { msg: \"Service Unavailable\", code: 503 },\n GATEWAY_TIMEOUT: { msg: \"Gateway Timeout\", code: 504 },\n HTTP_VERSION_NOT_SUPPORTED: { msg: \"HTTP Version Not Supported\", code: 505 },\n VARIANT_ALSO_NEGOTIATES: { msg: \"Variant Also Negotiates\", code: 506 },\n INSUFFICIENT_STORAGE: { msg: \"Insufficient Storage\", code: 507 },\n LOOP_DETECTED: { msg: \"Loop Detected\", code: 508 },\n NOT_EXTENDED: { msg: \"Not Extended\", code: 510 },\n NETWORK_AUTHENTICATION_REQUIRED: { msg: \"Network Authentication Required\", code: 511 },\n};\n"]}
@@ -39,6 +39,13 @@ export declare abstract class CrudServiceImpl<T extends BaseEntity, D extends Ba
39
39
  findByField(fieldName: string, fieldValue: any): Promise<List<T>>;
40
40
  findFirst(fieldName: string, fieldValue: string | boolean | number | Date): Promise<T>;
41
41
  find(filter: Filter | string): Promise<List<Partial<T>>>;
42
+ findStream(filter: string, size?: number): AsyncGenerator<T>;
43
+ searchStream(filter: string, size?: number): AsyncGenerator<T>;
44
+ searchStreamAggr(filter: string, size?: number): AsyncGenerator<{
45
+ items: Partial<T>[];
46
+ total: number;
47
+ aggs?: Record<string, any>;
48
+ }>;
42
49
  findById(entityId: string, requestUser?: CognitoUser): Promise<T>;
43
50
  findByIds(entityIds: string[], requestUser?: CognitoUser): Promise<T[]>;
44
51
  scan(filter: Filter): Promise<List<Partial<T>>>;
@@ -97,6 +97,21 @@ export interface CrudService<T extends BaseEntity> {
97
97
  total: number;
98
98
  aggs?: Record<string, any>;
99
99
  }>;
100
+ /**
101
+ * Returns a lazy async iterator over paginated DynamoDB query results.
102
+ * Each `next()` call loads the next page only when the current buffer is empty.
103
+ */
104
+ findStream(filter: string, size?: number): AsyncGenerator<T>;
105
+ /**
106
+ * Returns a lazy async iterator over paginated OpenSearch query results.
107
+ * Each `next()` call loads the next page only when the current buffer is empty.
108
+ */
109
+ searchStream(filter: string, size?: number): AsyncGenerator<T>;
110
+ searchStreamAggr(filter: string, size?: number): AsyncGenerator<{
111
+ items: Partial<T>[];
112
+ total: number;
113
+ aggs?: Record<string, any>;
114
+ }>;
100
115
  searchQueryTotalCount(queryParams: any): Promise<number>;
101
116
  findAll(): Promise<T[]>;
102
117
  findAllMatch(filter: Filter | string): Promise<T[]>;