@starklabs/forge 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (485) hide show
  1. package/dist/js/admin/index.d.ts +4 -0
  2. package/dist/js/admin/index.d.ts.map +1 -0
  3. package/dist/js/admin/index.js +5 -0
  4. package/dist/js/admin/index.js.map +1 -0
  5. package/dist/js/app.d.ts +3 -0
  6. package/dist/js/app.d.ts.map +1 -0
  7. package/dist/js/app.js +55 -0
  8. package/dist/js/app.js.map +1 -0
  9. package/dist/js/auth/bunch.auth.d.ts +8 -0
  10. package/dist/js/auth/bunch.auth.d.ts.map +1 -0
  11. package/dist/js/auth/bunch.auth.js +8 -0
  12. package/dist/js/auth/bunch.auth.js.map +1 -0
  13. package/dist/js/auth/createOTPModel.d.ts +2 -0
  14. package/dist/js/auth/createOTPModel.d.ts.map +1 -0
  15. package/dist/js/auth/createOTPModel.js +2 -0
  16. package/dist/js/auth/createOTPModel.js.map +1 -0
  17. package/dist/js/auth/forgotPassword.d.ts +10 -0
  18. package/dist/js/auth/forgotPassword.d.ts.map +1 -0
  19. package/dist/js/auth/forgotPassword.js +39 -0
  20. package/dist/js/auth/forgotPassword.js.map +1 -0
  21. package/dist/js/auth/index.d.ts +5 -0
  22. package/dist/js/auth/index.d.ts.map +1 -0
  23. package/dist/js/auth/index.js +26 -0
  24. package/dist/js/auth/index.js.map +1 -0
  25. package/dist/js/auth/login.d.ts +10 -0
  26. package/dist/js/auth/login.d.ts.map +1 -0
  27. package/dist/js/auth/login.js +32 -0
  28. package/dist/js/auth/login.js.map +1 -0
  29. package/dist/js/auth/logout.d.ts +5 -0
  30. package/dist/js/auth/logout.d.ts.map +1 -0
  31. package/dist/js/auth/logout.js +10 -0
  32. package/dist/js/auth/logout.js.map +1 -0
  33. package/dist/js/auth/resendOTP.d.ts +10 -0
  34. package/dist/js/auth/resendOTP.d.ts.map +1 -0
  35. package/dist/js/auth/resendOTP.js +62 -0
  36. package/dist/js/auth/resendOTP.js.map +1 -0
  37. package/dist/js/auth/resetPassword.d.ts +10 -0
  38. package/dist/js/auth/resetPassword.d.ts.map +1 -0
  39. package/dist/js/auth/resetPassword.js +60 -0
  40. package/dist/js/auth/resetPassword.js.map +1 -0
  41. package/dist/js/auth/sendOTP.d.ts +6 -0
  42. package/dist/js/auth/sendOTP.d.ts.map +1 -0
  43. package/dist/js/auth/sendOTP.js +28 -0
  44. package/dist/js/auth/sendOTP.js.map +1 -0
  45. package/dist/js/auth/signup.d.ts +10 -0
  46. package/dist/js/auth/signup.d.ts.map +1 -0
  47. package/dist/js/auth/signup.js +47 -0
  48. package/dist/js/auth/signup.js.map +1 -0
  49. package/dist/js/auth/twoFactorAuth.d.ts +2 -0
  50. package/dist/js/auth/twoFactorAuth.d.ts.map +1 -0
  51. package/dist/js/auth/twoFactorAuth.js +3 -0
  52. package/dist/js/auth/twoFactorAuth.js.map +1 -0
  53. package/dist/js/auth/utils/authenticateUser.d.ts +11 -0
  54. package/dist/js/auth/utils/authenticateUser.d.ts.map +1 -0
  55. package/dist/js/auth/utils/authenticateUser.js +60 -0
  56. package/dist/js/auth/utils/authenticateUser.js.map +1 -0
  57. package/dist/js/auth/utils/createOTPModel.d.ts +4 -0
  58. package/dist/js/auth/utils/createOTPModel.d.ts.map +1 -0
  59. package/dist/js/auth/utils/createOTPModel.js +28 -0
  60. package/dist/js/auth/utils/createOTPModel.js.map +1 -0
  61. package/dist/js/auth/utils/createOTPUser.d.ts +12 -0
  62. package/dist/js/auth/utils/createOTPUser.d.ts.map +1 -0
  63. package/dist/js/auth/utils/createOTPUser.js +63 -0
  64. package/dist/js/auth/utils/createOTPUser.js.map +1 -0
  65. package/dist/js/auth/utils/createUser.d.ts +11 -0
  66. package/dist/js/auth/utils/createUser.d.ts.map +1 -0
  67. package/dist/js/auth/utils/createUser.js +42 -0
  68. package/dist/js/auth/utils/createUser.js.map +1 -0
  69. package/dist/js/auth/utils/deleteOTPUser.d.ts +3 -0
  70. package/dist/js/auth/utils/deleteOTPUser.d.ts.map +1 -0
  71. package/dist/js/auth/utils/deleteOTPUser.js +3 -0
  72. package/dist/js/auth/utils/deleteOTPUser.js.map +1 -0
  73. package/dist/js/auth/utils/findUser.d.ts +2 -0
  74. package/dist/js/auth/utils/findUser.d.ts.map +1 -0
  75. package/dist/js/auth/utils/findUser.js +2 -0
  76. package/dist/js/auth/utils/findUser.js.map +1 -0
  77. package/dist/js/auth/utils/getModel.d.ts +6 -0
  78. package/dist/js/auth/utils/getModel.d.ts.map +1 -0
  79. package/dist/js/auth/utils/getModel.js +18 -0
  80. package/dist/js/auth/utils/getModel.js.map +1 -0
  81. package/dist/js/auth/utils/getOTPData.d.ts +9 -0
  82. package/dist/js/auth/utils/getOTPData.d.ts.map +1 -0
  83. package/dist/js/auth/utils/getOTPData.js +26 -0
  84. package/dist/js/auth/utils/getOTPData.js.map +1 -0
  85. package/dist/js/auth/utils/getOTPModel.d.ts +4 -0
  86. package/dist/js/auth/utils/getOTPModel.d.ts.map +1 -0
  87. package/dist/js/auth/utils/getOTPModel.js +20 -0
  88. package/dist/js/auth/utils/getOTPModel.js.map +1 -0
  89. package/dist/js/auth/utils/getOTPUser.d.ts +8 -0
  90. package/dist/js/auth/utils/getOTPUser.d.ts.map +1 -0
  91. package/dist/js/auth/utils/getOTPUser.js +21 -0
  92. package/dist/js/auth/utils/getOTPUser.js.map +1 -0
  93. package/dist/js/auth/utils/getUser.d.ts +10 -0
  94. package/dist/js/auth/utils/getUser.d.ts.map +1 -0
  95. package/dist/js/auth/utils/getUser.js +27 -0
  96. package/dist/js/auth/utils/getUser.js.map +1 -0
  97. package/dist/js/auth/utils/handleIsVerfieid.d.ts +9 -0
  98. package/dist/js/auth/utils/handleIsVerfieid.d.ts.map +1 -0
  99. package/dist/js/auth/utils/handleIsVerfieid.js +20 -0
  100. package/dist/js/auth/utils/handleIsVerfieid.js.map +1 -0
  101. package/dist/js/auth/utils/handleIsVerified.d.ts +11 -0
  102. package/dist/js/auth/utils/handleIsVerified.d.ts.map +1 -0
  103. package/dist/js/auth/utils/handleIsVerified.js +31 -0
  104. package/dist/js/auth/utils/handleIsVerified.js.map +1 -0
  105. package/dist/js/auth/utils/modeMap.d.ts +38 -0
  106. package/dist/js/auth/utils/modeMap.d.ts.map +1 -0
  107. package/dist/js/auth/utils/modeMap.js +15 -0
  108. package/dist/js/auth/utils/modeMap.js.map +1 -0
  109. package/dist/js/auth/utils/otpHTML.d.ts +2 -0
  110. package/dist/js/auth/utils/otpHTML.d.ts.map +1 -0
  111. package/dist/js/auth/utils/otpHTML.js +2 -0
  112. package/dist/js/auth/utils/otpHTML.js.map +1 -0
  113. package/dist/js/auth/utils/otpVerifiedResponse.d.ts +9 -0
  114. package/dist/js/auth/utils/otpVerifiedResponse.d.ts.map +1 -0
  115. package/dist/js/auth/utils/otpVerifiedResponse.js +22 -0
  116. package/dist/js/auth/utils/otpVerifiedResponse.js.map +1 -0
  117. package/dist/js/auth/utils/sendCookie.d.ts +14 -0
  118. package/dist/js/auth/utils/sendCookie.d.ts.map +1 -0
  119. package/dist/js/auth/utils/sendCookie.js +73 -0
  120. package/dist/js/auth/utils/sendCookie.js.map +1 -0
  121. package/dist/js/auth/utils/sendOTP.d.ts +7 -0
  122. package/dist/js/auth/utils/sendOTP.d.ts.map +1 -0
  123. package/dist/js/auth/utils/sendOTP.js +48 -0
  124. package/dist/js/auth/utils/sendOTP.js.map +1 -0
  125. package/dist/js/auth/utils/verifyCredentials.d.ts +9 -0
  126. package/dist/js/auth/utils/verifyCredentials.d.ts.map +1 -0
  127. package/dist/js/auth/utils/verifyCredentials.js +39 -0
  128. package/dist/js/auth/utils/verifyCredentials.js.map +1 -0
  129. package/dist/js/auth/verifyOTP.d.ts +10 -0
  130. package/dist/js/auth/verifyOTP.d.ts.map +1 -0
  131. package/dist/js/auth/verifyOTP.js +110 -0
  132. package/dist/js/auth/verifyOTP.js.map +1 -0
  133. package/dist/js/config/cloudinary.d.ts +5 -0
  134. package/dist/js/config/cloudinary.d.ts.map +1 -0
  135. package/dist/js/config/cloudinary.js +25 -0
  136. package/dist/js/config/cloudinary.js.map +1 -0
  137. package/dist/js/config/defaultConfig.d.ts +3 -0
  138. package/dist/js/config/defaultConfig.d.ts.map +1 -0
  139. package/dist/js/config/defaultConfig.js +12 -0
  140. package/dist/js/config/defaultConfig.js.map +1 -0
  141. package/dist/js/config/duration.d.ts +22 -0
  142. package/dist/js/config/duration.d.ts.map +1 -0
  143. package/dist/js/config/duration.js +35 -0
  144. package/dist/js/config/duration.js.map +1 -0
  145. package/dist/js/config/envs.d.ts +32 -0
  146. package/dist/js/config/envs.d.ts.map +1 -0
  147. package/dist/js/config/envs.js +10 -0
  148. package/dist/js/config/envs.js.map +1 -0
  149. package/dist/js/config/handleReqType.d.ts +7 -0
  150. package/dist/js/config/handleReqType.d.ts.map +1 -0
  151. package/dist/js/config/handleReqType.js +13 -0
  152. package/dist/js/config/handleReqType.js.map +1 -0
  153. package/dist/js/config/handlerMap.d.ts +3 -0
  154. package/dist/js/config/handlerMap.d.ts.map +1 -0
  155. package/dist/js/config/handlerMap.js +29 -0
  156. package/dist/js/config/handlerMap.js.map +1 -0
  157. package/dist/js/config/reqTypes.d.ts +2 -0
  158. package/dist/js/config/reqTypes.d.ts.map +1 -0
  159. package/dist/js/config/reqTypes.js +2 -0
  160. package/dist/js/config/reqTypes.js.map +1 -0
  161. package/dist/js/config/sendEmail.d.ts +11 -0
  162. package/dist/js/config/sendEmail.d.ts.map +1 -0
  163. package/dist/js/config/sendEmail.js +95 -0
  164. package/dist/js/config/sendEmail.js.map +1 -0
  165. package/dist/js/core/app.d.ts +3 -0
  166. package/dist/js/core/app.d.ts.map +1 -0
  167. package/dist/js/core/app.js +19 -0
  168. package/dist/js/core/app.js.map +1 -0
  169. package/dist/js/crud/bunch.crud.d.ts +11 -0
  170. package/dist/js/crud/bunch.crud.d.ts.map +1 -0
  171. package/dist/js/crud/bunch.crud.js +11 -0
  172. package/dist/js/crud/bunch.crud.js.map +1 -0
  173. package/dist/js/crud/create.d.ts +10 -0
  174. package/dist/js/crud/create.d.ts.map +1 -0
  175. package/dist/js/crud/create.js +72 -0
  176. package/dist/js/crud/create.js.map +1 -0
  177. package/dist/js/crud/createBulk.d.ts +10 -0
  178. package/dist/js/crud/createBulk.d.ts.map +1 -0
  179. package/dist/js/crud/createBulk.js +20 -0
  180. package/dist/js/crud/createBulk.js.map +1 -0
  181. package/dist/js/crud/files/file.update.d.ts +10 -0
  182. package/dist/js/crud/files/file.update.d.ts.map +1 -0
  183. package/dist/js/crud/files/file.update.js +28 -0
  184. package/dist/js/crud/files/file.update.js.map +1 -0
  185. package/dist/js/crud/handleUploads/file.add.d.ts +10 -0
  186. package/dist/js/crud/handleUploads/file.add.d.ts.map +1 -0
  187. package/dist/js/crud/handleUploads/file.add.js +61 -0
  188. package/dist/js/crud/handleUploads/file.add.js.map +1 -0
  189. package/dist/js/crud/handleUploads/file.create.d.ts +10 -0
  190. package/dist/js/crud/handleUploads/file.create.d.ts.map +1 -0
  191. package/dist/js/crud/handleUploads/file.create.js +33 -0
  192. package/dist/js/crud/handleUploads/file.create.js.map +1 -0
  193. package/dist/js/crud/handleUploads/file.delete.d.ts +10 -0
  194. package/dist/js/crud/handleUploads/file.delete.d.ts.map +1 -0
  195. package/dist/js/crud/handleUploads/file.delete.js +35 -0
  196. package/dist/js/crud/handleUploads/file.delete.js.map +1 -0
  197. package/dist/js/crud/handleUploads/file.update.d.ts +10 -0
  198. package/dist/js/crud/handleUploads/file.update.d.ts.map +1 -0
  199. package/dist/js/crud/handleUploads/file.update.js +30 -0
  200. package/dist/js/crud/handleUploads/file.update.js.map +1 -0
  201. package/dist/js/crud/index.d.ts +5 -0
  202. package/dist/js/crud/index.d.ts.map +1 -0
  203. package/dist/js/crud/index.js +36 -0
  204. package/dist/js/crud/index.js.map +1 -0
  205. package/dist/js/crud/read.d.ts +10 -0
  206. package/dist/js/crud/read.d.ts.map +1 -0
  207. package/dist/js/crud/read.js +27 -0
  208. package/dist/js/crud/read.js.map +1 -0
  209. package/dist/js/crud/readAll.d.ts +10 -0
  210. package/dist/js/crud/readAll.d.ts.map +1 -0
  211. package/dist/js/crud/readAll.js +24 -0
  212. package/dist/js/crud/readAll.js.map +1 -0
  213. package/dist/js/crud/remove.d.ts +10 -0
  214. package/dist/js/crud/remove.d.ts.map +1 -0
  215. package/dist/js/crud/remove.js +28 -0
  216. package/dist/js/crud/remove.js.map +1 -0
  217. package/dist/js/crud/removeAll.d.ts +10 -0
  218. package/dist/js/crud/removeAll.d.ts.map +1 -0
  219. package/dist/js/crud/removeAll.js +37 -0
  220. package/dist/js/crud/removeAll.js.map +1 -0
  221. package/dist/js/crud/update.d.ts +10 -0
  222. package/dist/js/crud/update.d.ts.map +1 -0
  223. package/dist/js/crud/update.js +33 -0
  224. package/dist/js/crud/update.js.map +1 -0
  225. package/dist/js/crud/utils/authroizeAccess.d.ts +10 -0
  226. package/dist/js/crud/utils/authroizeAccess.d.ts.map +1 -0
  227. package/dist/js/crud/utils/authroizeAccess.js +48 -0
  228. package/dist/js/crud/utils/authroizeAccess.js.map +1 -0
  229. package/dist/js/crud/utils/getItem.d.ts +11 -0
  230. package/dist/js/crud/utils/getItem.d.ts.map +1 -0
  231. package/dist/js/crud/utils/getItem.js +68 -0
  232. package/dist/js/crud/utils/getItem.js.map +1 -0
  233. package/dist/js/crud/utils/getParam.d.ts +8 -0
  234. package/dist/js/crud/utils/getParam.d.ts.map +1 -0
  235. package/dist/js/crud/utils/getParam.js +19 -0
  236. package/dist/js/crud/utils/getParam.js.map +1 -0
  237. package/dist/js/crud/utils/validateOwner.d.ts +7 -0
  238. package/dist/js/crud/utils/validateOwner.d.ts.map +1 -0
  239. package/dist/js/crud/utils/validateOwner.js +5 -0
  240. package/dist/js/crud/utils/validateOwner.js.map +1 -0
  241. package/dist/js/health/bunch.health.d.ts +6 -0
  242. package/dist/js/health/bunch.health.d.ts.map +1 -0
  243. package/dist/js/health/bunch.health.js +6 -0
  244. package/dist/js/health/bunch.health.js.map +1 -0
  245. package/dist/js/health/delete.health.d.ts +4 -0
  246. package/dist/js/health/delete.health.d.ts.map +1 -0
  247. package/dist/js/health/delete.health.js +5 -0
  248. package/dist/js/health/delete.health.js.map +1 -0
  249. package/dist/js/health/get.health.d.ts +4 -0
  250. package/dist/js/health/get.health.d.ts.map +1 -0
  251. package/dist/js/health/get.health.js +5 -0
  252. package/dist/js/health/get.health.js.map +1 -0
  253. package/dist/js/health/health.collection.d.ts +4 -0
  254. package/dist/js/health/health.collection.d.ts.map +1 -0
  255. package/dist/js/health/health.collection.js +39 -0
  256. package/dist/js/health/health.collection.js.map +1 -0
  257. package/dist/js/health/health.controller.d.ts +4 -0
  258. package/dist/js/health/health.controller.d.ts.map +1 -0
  259. package/dist/js/health/health.controller.js +5 -0
  260. package/dist/js/health/health.controller.js.map +1 -0
  261. package/dist/js/health/index.d.ts +5 -0
  262. package/dist/js/health/index.d.ts.map +1 -0
  263. package/dist/js/health/index.js +10 -0
  264. package/dist/js/health/index.js.map +1 -0
  265. package/dist/js/health/patch.health.d.ts +4 -0
  266. package/dist/js/health/patch.health.d.ts.map +1 -0
  267. package/dist/js/health/patch.health.js +5 -0
  268. package/dist/js/health/patch.health.js.map +1 -0
  269. package/dist/js/health/post.health.d.ts +4 -0
  270. package/dist/js/health/post.health.d.ts.map +1 -0
  271. package/dist/js/health/post.health.js +5 -0
  272. package/dist/js/health/post.health.js.map +1 -0
  273. package/dist/js/health/put.health.d.ts +4 -0
  274. package/dist/js/health/put.health.d.ts.map +1 -0
  275. package/dist/js/health/put.health.js +5 -0
  276. package/dist/js/health/put.health.js.map +1 -0
  277. package/dist/js/index.d.ts +13 -0
  278. package/dist/js/index.d.ts.map +1 -0
  279. package/dist/js/index.js +21 -0
  280. package/dist/js/index.js.map +1 -0
  281. package/dist/js/lib/Mongoose.d.ts +53 -0
  282. package/dist/js/lib/Mongoose.d.ts.map +1 -0
  283. package/dist/js/lib/Mongoose.js +2 -0
  284. package/dist/js/lib/Mongoose.js.map +1 -0
  285. package/dist/js/lib/OA.d.ts +2 -0
  286. package/dist/js/lib/OA.d.ts.map +1 -0
  287. package/dist/js/lib/OA.js +2 -0
  288. package/dist/js/lib/OA.js.map +1 -0
  289. package/dist/js/lib/OAuthProviders.d.ts +3 -0
  290. package/dist/js/lib/OAuthProviders.d.ts.map +1 -0
  291. package/dist/js/lib/OAuthProviders.js +18 -0
  292. package/dist/js/lib/OAuthProviders.js.map +1 -0
  293. package/dist/js/lib/PROVIDERS.d.ts +2 -0
  294. package/dist/js/lib/PROVIDERS.d.ts.map +1 -0
  295. package/dist/js/lib/PROVIDERS.js +2 -0
  296. package/dist/js/lib/PROVIDERS.js.map +1 -0
  297. package/dist/js/lib/db.d.ts +8 -0
  298. package/dist/js/lib/db.d.ts.map +1 -0
  299. package/dist/js/lib/db.js +28 -0
  300. package/dist/js/lib/db.js.map +1 -0
  301. package/dist/js/lib/handler.d.ts +9 -0
  302. package/dist/js/lib/handler.d.ts.map +1 -0
  303. package/dist/js/lib/handler.js +11 -0
  304. package/dist/js/lib/handler.js.map +1 -0
  305. package/dist/js/lib/handlerMap.d.ts +3 -0
  306. package/dist/js/lib/handlerMap.d.ts.map +1 -0
  307. package/dist/js/lib/handlerMap.js +18 -0
  308. package/dist/js/lib/handlerMap.js.map +1 -0
  309. package/dist/js/lib/model.factory.d.ts +8 -0
  310. package/dist/js/lib/model.factory.d.ts.map +1 -0
  311. package/dist/js/lib/model.factory.js +49 -0
  312. package/dist/js/lib/model.factory.js.map +1 -0
  313. package/dist/js/lib/model.registry.d.ts +4 -0
  314. package/dist/js/lib/model.registry.d.ts.map +1 -0
  315. package/dist/js/lib/model.registry.js +4 -0
  316. package/dist/js/lib/model.registry.js.map +1 -0
  317. package/dist/js/lib/mongoose.fields.d.ts +40 -0
  318. package/dist/js/lib/mongoose.fields.d.ts.map +1 -0
  319. package/dist/js/lib/mongoose.fields.js +187 -0
  320. package/dist/js/lib/mongoose.fields.js.map +1 -0
  321. package/dist/js/lib/roles.d.ts +3 -0
  322. package/dist/js/lib/roles.d.ts.map +1 -0
  323. package/dist/js/lib/roles.js +13 -0
  324. package/dist/js/lib/roles.js.map +1 -0
  325. package/dist/js/lib/schema.builder.d.ts +6 -0
  326. package/dist/js/lib/schema.builder.d.ts.map +1 -0
  327. package/dist/js/lib/schema.builder.js +28 -0
  328. package/dist/js/lib/schema.builder.js.map +1 -0
  329. package/dist/js/lib/zod.fields.d.ts +119 -0
  330. package/dist/js/lib/zod.fields.d.ts.map +1 -0
  331. package/dist/js/lib/zod.fields.js +133 -0
  332. package/dist/js/lib/zod.fields.js.map +1 -0
  333. package/dist/js/middleware/auth.middleware.d.ts +5 -0
  334. package/dist/js/middleware/auth.middleware.d.ts.map +1 -0
  335. package/dist/js/middleware/auth.middleware.js +86 -0
  336. package/dist/js/middleware/auth.middleware.js.map +1 -0
  337. package/dist/js/middleware/error.middleware.d.ts +5 -0
  338. package/dist/js/middleware/error.middleware.d.ts.map +1 -0
  339. package/dist/js/middleware/error.middleware.js +25 -0
  340. package/dist/js/middleware/error.middleware.js.map +1 -0
  341. package/dist/js/middleware/multer.middleware.d.ts +5 -0
  342. package/dist/js/middleware/multer.middleware.d.ts.map +1 -0
  343. package/dist/js/middleware/multer.middleware.js +97 -0
  344. package/dist/js/middleware/multer.middleware.js.map +1 -0
  345. package/dist/js/middleware/rateLimit.middleware.d.ts +2 -0
  346. package/dist/js/middleware/rateLimit.middleware.d.ts.map +1 -0
  347. package/dist/js/middleware/rateLimit.middleware.js +19 -0
  348. package/dist/js/middleware/rateLimit.middleware.js.map +1 -0
  349. package/dist/js/realtime/index.d.ts +4 -0
  350. package/dist/js/realtime/index.d.ts.map +1 -0
  351. package/dist/js/realtime/index.js +5 -0
  352. package/dist/js/realtime/index.js.map +1 -0
  353. package/dist/js/types/Collection.d.ts +41 -0
  354. package/dist/js/types/Collection.d.ts.map +1 -0
  355. package/dist/js/types/Collection.js +2 -0
  356. package/dist/js/types/Collection.js.map +1 -0
  357. package/dist/js/types/Constructor.d.ts +30 -0
  358. package/dist/js/types/Constructor.d.ts.map +1 -0
  359. package/dist/js/types/Constructor.js +2 -0
  360. package/dist/js/types/Constructor.js.map +1 -0
  361. package/dist/js/types/MongooseOTPSchemaObj.d.ts +10 -0
  362. package/dist/js/types/MongooseOTPSchemaObj.d.ts.map +1 -0
  363. package/dist/js/types/MongooseOTPSchemaObj.js +2 -0
  364. package/dist/js/types/MongooseOTPSchemaObj.js.map +1 -0
  365. package/dist/js/types/Routepath.d.ts +2 -0
  366. package/dist/js/types/Routepath.d.ts.map +1 -0
  367. package/dist/js/types/Routepath.js +2 -0
  368. package/dist/js/types/Routepath.js.map +1 -0
  369. package/dist/js/types/StoreFile.d.ts +10 -0
  370. package/dist/js/types/StoreFile.d.ts.map +1 -0
  371. package/dist/js/types/StoreFile.js +2 -0
  372. package/dist/js/types/StoreFile.js.map +1 -0
  373. package/dist/js/types/ValidationsObj.d.ts +7 -0
  374. package/dist/js/types/ValidationsObj.d.ts.map +1 -0
  375. package/dist/js/types/ValidationsObj.js +2 -0
  376. package/dist/js/types/ValidationsObj.js.map +1 -0
  377. package/dist/js/types/authHandlers.d.ts +2 -0
  378. package/dist/js/types/authHandlers.d.ts.map +1 -0
  379. package/dist/js/types/authHandlers.js +2 -0
  380. package/dist/js/types/authHandlers.js.map +1 -0
  381. package/dist/js/types/crudHandlers.d.ts +2 -0
  382. package/dist/js/types/crudHandlers.d.ts.map +1 -0
  383. package/dist/js/types/crudHandlers.js +2 -0
  384. package/dist/js/types/crudHandlers.js.map +1 -0
  385. package/dist/js/types/email.d.ts +12 -0
  386. package/dist/js/types/email.d.ts.map +1 -0
  387. package/dist/js/types/email.js +2 -0
  388. package/dist/js/types/email.js.map +1 -0
  389. package/dist/js/types/healthHandlers.d.ts +2 -0
  390. package/dist/js/types/healthHandlers.d.ts.map +1 -0
  391. package/dist/js/types/healthHandlers.js +2 -0
  392. package/dist/js/types/healthHandlers.js.map +1 -0
  393. package/dist/js/types/upload.d.ts +9 -0
  394. package/dist/js/types/upload.d.ts.map +1 -0
  395. package/dist/js/types/upload.js +2 -0
  396. package/dist/js/types/upload.js.map +1 -0
  397. package/dist/js/types/uploadFile.d.ts +10 -0
  398. package/dist/js/types/uploadFile.d.ts.map +1 -0
  399. package/dist/js/types/uploadFile.js +2 -0
  400. package/dist/js/types/uploadFile.js.map +1 -0
  401. package/dist/js/types/uploadHandlers.d.ts +2 -0
  402. package/dist/js/types/uploadHandlers.d.ts.map +1 -0
  403. package/dist/js/types/uploadHandlers.js +2 -0
  404. package/dist/js/types/uploadHandlers.js.map +1 -0
  405. package/dist/js/upload/create.d.ts +8 -0
  406. package/dist/js/upload/create.d.ts.map +1 -0
  407. package/dist/js/upload/create.js +71 -0
  408. package/dist/js/upload/create.js.map +1 -0
  409. package/dist/js/upload/delete.d.ts +8 -0
  410. package/dist/js/upload/delete.d.ts.map +1 -0
  411. package/dist/js/upload/delete.js +107 -0
  412. package/dist/js/upload/delete.js.map +1 -0
  413. package/dist/js/upload/index.d.ts +3 -0
  414. package/dist/js/upload/index.d.ts.map +1 -0
  415. package/dist/js/upload/index.js +3 -0
  416. package/dist/js/upload/index.js.map +1 -0
  417. package/dist/js/upload/providers/cloudinary.provider.d.ts +2 -0
  418. package/dist/js/upload/providers/cloudinary.provider.d.ts.map +1 -0
  419. package/dist/js/upload/providers/cloudinary.provider.js +2 -0
  420. package/dist/js/upload/providers/cloudinary.provider.js.map +1 -0
  421. package/dist/js/upload/update.d.ts +10 -0
  422. package/dist/js/upload/update.d.ts.map +1 -0
  423. package/dist/js/upload/update.js +144 -0
  424. package/dist/js/upload/update.js.map +1 -0
  425. package/dist/js/utils/AppError.d.ts +26 -0
  426. package/dist/js/utils/AppError.d.ts.map +1 -0
  427. package/dist/js/utils/AppError.js +18 -0
  428. package/dist/js/utils/AppError.js.map +1 -0
  429. package/dist/js/utils/AppLog.d.ts +10 -0
  430. package/dist/js/utils/AppLog.d.ts.map +1 -0
  431. package/dist/js/utils/AppLog.js +12 -0
  432. package/dist/js/utils/AppLog.js.map +1 -0
  433. package/dist/js/utils/Applog.d.ts +2 -0
  434. package/dist/js/utils/Applog.d.ts.map +1 -0
  435. package/dist/js/utils/Applog.js +2 -0
  436. package/dist/js/utils/Applog.js.map +1 -0
  437. package/dist/js/utils/AsyncHandler.d.ts +4 -0
  438. package/dist/js/utils/AsyncHandler.d.ts.map +1 -0
  439. package/dist/js/utils/AsyncHandler.js +5 -0
  440. package/dist/js/utils/AsyncHandler.js.map +1 -0
  441. package/dist/js/utils/extractParamsNames.d.ts +2 -0
  442. package/dist/js/utils/extractParamsNames.d.ts.map +1 -0
  443. package/dist/js/utils/extractParamsNames.js +13 -0
  444. package/dist/js/utils/extractParamsNames.js.map +1 -0
  445. package/dist/js/utils/getErrorDetail.d.ts +8 -0
  446. package/dist/js/utils/getErrorDetail.d.ts.map +1 -0
  447. package/dist/js/utils/getErrorDetail.js +9 -0
  448. package/dist/js/utils/getErrorDetail.js.map +1 -0
  449. package/dist/js/utils/getModel.d.ts +8 -0
  450. package/dist/js/utils/getModel.d.ts.map +1 -0
  451. package/dist/js/utils/getModel.js +27 -0
  452. package/dist/js/utils/getModel.js.map +1 -0
  453. package/dist/js/utils/handleJWT.d.ts +11 -0
  454. package/dist/js/utils/handleJWT.d.ts.map +1 -0
  455. package/dist/js/utils/handleJWT.js +89 -0
  456. package/dist/js/utils/handleJWT.js.map +1 -0
  457. package/dist/js/utils/libsodium.d.ts +15 -0
  458. package/dist/js/utils/libsodium.d.ts.map +1 -0
  459. package/dist/js/utils/libsodium.js +185 -0
  460. package/dist/js/utils/libsodium.js.map +1 -0
  461. package/dist/js/utils/otpPurposes.d.ts +3 -0
  462. package/dist/js/utils/otpPurposes.d.ts.map +1 -0
  463. package/dist/js/utils/otpPurposes.js +38 -0
  464. package/dist/js/utils/otpPurposes.js.map +1 -0
  465. package/dist/js/utils/response.d.ts +10 -0
  466. package/dist/js/utils/response.d.ts.map +1 -0
  467. package/dist/js/utils/response.js +9 -0
  468. package/dist/js/utils/response.js.map +1 -0
  469. package/dist/js/utils/sanitize.d.ts +3 -0
  470. package/dist/js/utils/sanitize.d.ts.map +1 -0
  471. package/dist/js/utils/sanitize.js +13 -0
  472. package/dist/js/utils/sanitize.js.map +1 -0
  473. package/dist/js/utils/validate.d.ts +4 -0
  474. package/dist/js/utils/validate.d.ts.map +1 -0
  475. package/dist/js/utils/validate.js +59 -0
  476. package/dist/js/utils/validate.js.map +1 -0
  477. package/dist/js/utils/validationKeyError.d.ts +4 -0
  478. package/dist/js/utils/validationKeyError.d.ts.map +1 -0
  479. package/dist/js/utils/validationKeyError.js +38 -0
  480. package/dist/js/utils/validationKeyError.js.map +1 -0
  481. package/dist/js/validations.d.ts +3 -0
  482. package/dist/js/validations.d.ts.map +1 -0
  483. package/dist/js/validations.js +6 -0
  484. package/dist/js/validations.js.map +1 -0
  485. package/package.json +88 -0
@@ -0,0 +1,2 @@
1
+ export type uploadHandlers = "updateFile" | "deleteFile" | "addFile";
2
+ //# sourceMappingURL=uploadHandlers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"uploadHandlers.d.ts","sourceRoot":"","sources":["../../../src/js/types/uploadHandlers.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,cAAc,GAAG,YAAY,GAAG,YAAY,GAAG,SAAS,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=uploadHandlers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"uploadHandlers.js","sourceRoot":"","sources":["../../../src/js/types/uploadHandlers.ts"],"names":[],"mappings":""}
@@ -0,0 +1,8 @@
1
+ import type { StoreFile } from "../types/StoreFile.js";
2
+ import type { Route } from "../types/Collection.js";
3
+ import type { Request } from "express";
4
+ export declare const handleUploadFiles: (req: Request, route: Route) => Promise<{
5
+ [x: string]: StoreFile[];
6
+ } | undefined>;
7
+ export default handleUploadFiles;
8
+ //# sourceMappingURL=create.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../../src/js/upload/create.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAEvD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AA+CvC,eAAO,MAAM,iBAAiB,GAAU,KAAK,OAAO,EAAE,OAAO,KAAK;;cAyCjE,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
@@ -0,0 +1,71 @@
1
+ import streamifier from "streamifier";
2
+ import AppError from "../utils/AppError.js";
3
+ import { cloudinary, setupCloudinary } from "../config/cloudinary.js";
4
+ const uploadFile = (file, route) => {
5
+ setupCloudinary(route);
6
+ return new Promise((resolve, reject) => {
7
+ const stream = cloudinary.uploader.upload_stream({
8
+ folder: "framework",
9
+ }, (error, result) => {
10
+ if (error || !result) {
11
+ return reject(new AppError({
12
+ message: "Cloudinary upload failed.",
13
+ statusCode: 500,
14
+ code: "UPLOAD_CLOUDINARY_FAILED",
15
+ hint: "Verify your Cloudinary configuration, credentials, and network connectivity.",
16
+ details: {
17
+ handler: route.handler,
18
+ method: route.method,
19
+ path: route.path,
20
+ },
21
+ }));
22
+ }
23
+ resolve({
24
+ url: result.secure_url,
25
+ storageKey: result.public_id,
26
+ width: result.width,
27
+ height: result.height,
28
+ bytes: result.bytes,
29
+ format: result.format,
30
+ resourceType: result.resource_type,
31
+ });
32
+ });
33
+ streamifier.createReadStream(file.buffer).pipe(stream);
34
+ });
35
+ };
36
+ export const handleUploadFiles = async (req, route) => {
37
+ if (!route?.fileArray?.length)
38
+ return;
39
+ for (const el of route.fileArray) {
40
+ if (!el.mongooseSchemaFieldName)
41
+ throw new AppError({
42
+ message: "mongooseSchemaFieldName is required.",
43
+ statusCode: 400,
44
+ code: "UPLOAD_MONGOOSE_FIELD_REQUIRED",
45
+ hint: "Provide mongooseSchemaFieldName in collection -> fileArray configuration.",
46
+ details: {
47
+ handler: route.handler,
48
+ method: route.method,
49
+ path: route.path,
50
+ },
51
+ });
52
+ }
53
+ if (!Object.keys(req.files ?? {}).length)
54
+ throw new AppError({
55
+ message: "File is required.",
56
+ statusCode: 400,
57
+ code: "UPLOAD_FILE_REQUIRED",
58
+ hint: "Upload at least one file using the configured upload field.",
59
+ details: {
60
+ handler: route.handler,
61
+ method: route.method,
62
+ path: route.path,
63
+ },
64
+ });
65
+ const files = Object.values(req.files).flat();
66
+ const metaData = await Promise.all(files.map((file) => uploadFile(file, route)));
67
+ const mongooseFieldName = route.fileArray[0].mongooseSchemaFieldName;
68
+ return { [mongooseFieldName]: metaData };
69
+ };
70
+ export default handleUploadFiles;
71
+ //# sourceMappingURL=create.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create.js","sourceRoot":"","sources":["../../../src/js/upload/create.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,MAAM,aAAa,CAAC;AACtC,OAAO,QAAQ,MAAM,sBAAsB,CAAC;AAE5C,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAItE,MAAM,UAAU,GAAG,CACjB,IAAyB,EACzB,KAAY,EACQ,EAAE;IACtB,eAAe,CAAC,KAAK,CAAC,CAAC;IAEvB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,MAAM,MAAM,GAAG,UAAU,CAAC,QAAQ,CAAC,aAAa,CAC9C;YACE,MAAM,EAAE,WAAW;SACpB,EACD,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE;YAChB,IAAI,KAAK,IAAI,CAAC,MAAM,EAAE,CAAC;gBACrB,OAAO,MAAM,CACX,IAAI,QAAQ,CAAC;oBACX,OAAO,EAAE,2BAA2B;oBACpC,UAAU,EAAE,GAAG;oBACf,IAAI,EAAE,0BAA0B;oBAChC,IAAI,EACF,8EAA8E;oBACh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EAAE,CAAC,CAAC,MAAM;QACtC,MAAM,IAAI,QAAQ,CAAC;YACjB,OAAO,EAAE,mBAAmB;YAC5B,UAAU,EAAE,GAAG;YACf,IAAI,EAAE,sBAAsB;YAC5B,IAAI,EAAE,6DAA6D;YACnE,OAAO,EAAE;gBACP,OAAO,EAAE,KAAK,CAAC,OAAO;gBACtB,MAAM,EAAE,KAAK,CAAC,MAAM;gBACpB,IAAI,EAAE,KAAK,CAAC,IAAI;aACjB;SACF,CAAC,CAAC;IAEL,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,KAAM,CAAC,CAAC,IAAI,EAAE,CAAC;IAE/C,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,UAAU,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;IACjF,MAAM,iBAAiB,GAAG,KAAK,CAAC,SAAS,CAAC,CAAC,CAAE,CAAC,uBAAuB,CAAC;IAEtE,OAAO,EAAE,CAAC,iBAA2B,CAAC,EAAE,QAAQ,EAAE,CAAC;AACrD,CAAC,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
@@ -0,0 +1,8 @@
1
+ import type { Route } from "../types/Collection.ts";
2
+ declare const handleDeleteFile: (route: Route, body: any, item: any) => Promise<{
3
+ deleted: boolean;
4
+ _id: any;
5
+ mongooseField: string;
6
+ }>;
7
+ export default handleDeleteFile;
8
+ //# sourceMappingURL=delete.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delete.d.ts","sourceRoot":"","sources":["../../../src/js/upload/delete.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAGpD,QAAA,MAAM,gBAAgB,GAAU,OAAO,KAAK,EAAE,MAAM,GAAG,EAAE,MAAM,GAAG;;;;EAoIjE,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
@@ -0,0 +1,107 @@
1
+ import AppError from "../utils/AppError.js";
2
+ import { cloudinary, setupCloudinary } from "../config/cloudinary.js";
3
+ import AppLog from "../utils/AppLog.js";
4
+ const handleDeleteFile = async (route, body, item) => {
5
+ setupCloudinary(route);
6
+ const fileArray = route.fileArray;
7
+ if (!Array.isArray(fileArray) || fileArray.length === 0)
8
+ throw new AppError({
9
+ message: "fileArray is required.",
10
+ statusCode: 400,
11
+ code: "UPLOAD_ARRAY_REQUIRED",
12
+ hint: "Provide fileArray in the collection route configuration for delete handlers.",
13
+ details: {
14
+ handler: route.handler,
15
+ method: route.method,
16
+ path: route.path,
17
+ },
18
+ });
19
+ if (fileArray.length > 1)
20
+ AppLog("warn", "deleteFile", `fileArray in collection has more than 1 items for handler: '${route.handler}', method: '${route.method}' and path: '${route.path}' to delete.`);
21
+ const mongooseField = fileArray[0]?.mongooseSchemaFieldName;
22
+ if (typeof mongooseField !== "string" || mongooseField.trim() === "")
23
+ throw new AppError({
24
+ message: "mongooseSchemaFieldName is required.",
25
+ statusCode: 400,
26
+ code: "UPLOAD_MONGOOSE_FIELD_REQUIRED",
27
+ hint: "Provide mongooseSchemaFieldName in collection -> fileArray configuration.",
28
+ details: {
29
+ handler: route.handler,
30
+ method: route.method,
31
+ path: route.path,
32
+ },
33
+ });
34
+ const mongooseFilesArray = item[mongooseField];
35
+ if (!mongooseFilesArray)
36
+ throw new AppError({
37
+ message: `'${mongooseField}' field not found.`,
38
+ statusCode: 400,
39
+ code: "SCHEMA_FIELD_REQUIRED",
40
+ hint: "Ensure mongooseSchemaFieldName matches an existing schema field.",
41
+ details: {
42
+ handler: route.handler,
43
+ method: route.method,
44
+ path: route.path,
45
+ },
46
+ });
47
+ const validationIdentifierKey = fileArray[0]?.validationIdentifierKey;
48
+ if (typeof validationIdentifierKey !== "string" ||
49
+ validationIdentifierKey.trim() === "")
50
+ throw new AppError({
51
+ message: "validationIdentifierKey is required.",
52
+ statusCode: 400,
53
+ code: "VALIDATION_KEY_REQUIRED",
54
+ hint: "Provide validationIdentifierKey in collection -> fileArray configuration.",
55
+ details: {
56
+ handler: route.handler,
57
+ method: route.method,
58
+ path: route.path,
59
+ },
60
+ });
61
+ if (!body[validationIdentifierKey])
62
+ throw new AppError({
63
+ message: `'${validationIdentifierKey}' is required.`,
64
+ statusCode: 400,
65
+ code: "VALIDATION_REQUIRED_FIELD_MISSING",
66
+ hint: `Provide '${validationIdentifierKey}' in the request body.`,
67
+ details: {
68
+ handler: route.handler,
69
+ method: route.method,
70
+ path: route.path,
71
+ },
72
+ });
73
+ const targetItem = mongooseFilesArray.find((el) => el._id.toString() === body[validationIdentifierKey]);
74
+ if (!targetItem)
75
+ throw new AppError({
76
+ message: `File with id '${body[validationIdentifierKey]}' not found.`,
77
+ statusCode: 404,
78
+ code: "CRUD_ITEM_NOT_FOUND",
79
+ hint: "Verify the provided file identifier exists in the stored file array.",
80
+ details: {
81
+ handler: route.handler,
82
+ method: route.method,
83
+ path: route.path,
84
+ },
85
+ });
86
+ if (typeof targetItem.storageKey !== "string" ||
87
+ targetItem.storageKey.trim() === "")
88
+ throw new AppError({
89
+ message: "storageKey is required.",
90
+ statusCode: 400,
91
+ code: "UPLOAD_STORAGE_KEY_REQUIRED",
92
+ hint: "Ensure the stored file contains a valid storageKey before deletion.",
93
+ details: {
94
+ handler: route.handler,
95
+ method: route.method,
96
+ path: route.path,
97
+ },
98
+ });
99
+ await cloudinary.uploader.destroy(targetItem.storageKey);
100
+ return {
101
+ deleted: true,
102
+ _id: body[validationIdentifierKey],
103
+ mongooseField,
104
+ };
105
+ };
106
+ export default handleDeleteFile;
107
+ //# sourceMappingURL=delete.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delete.js","sourceRoot":"","sources":["../../../src/js/upload/delete.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,sBAAsB,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAEtE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AAC,GAAG,CAAC,QAAQ,EAAE,KAAK,IAAI,CAAC,uBAAuB,CAAC,CACjE,CAAC;IAEF,IAAI,CAAC,UAAU;QACb,MAAM,IAAI,QAAQ,CAAC;YACjB,OAAO,EAAE,iBAAiB,IAAI,CAAC,uBAAuB,CAAC,cAAc;YACrE,UAAU,EAAE,GAAG;YACf,IAAI,EAAE,qBAAqB;YAC3B,IAAI,EACF,sEAAsE;YACxE,OAAO,EAAE;gBACP,OAAO,EAAE,KAAK,CAAC,OAAO;gBACtB,MAAM,EAAE,KAAK,CAAC,MAAM;gBACpB,IAAI,EAAE,KAAK,CAAC,IAAI;aACjB;SACF,CAAC,CAAC;IAEL,IACE,OAAO,UAAU,CAAC,UAAU,KAAK,QAAQ;QACzC,UAAU,CAAC,UAAU,CAAC,IAAI,EAAE,KAAK,EAAE;QAEnC,MAAM,IAAI,QAAQ,CAAC;YACjB,OAAO,EAAE,yBAAyB;YAClC,UAAU,EAAE,GAAG;YACf,IAAI,EAAE,6BAA6B;YACnC,IAAI,EACF,qEAAqE;YACvE,OAAO,EAAE;gBACP,OAAO,EAAE,KAAK,CAAC,OAAO;gBACtB,MAAM,EAAE,KAAK,CAAC,MAAM;gBACpB,IAAI,EAAE,KAAK,CAAC,IAAI;aACjB;SACF,CAAC,CAAC;IAEL,MAAM,UAAU,CAAC,QAAQ,CAAC,OAAO,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;IAEzD,OAAO;QACL,OAAO,EAAE,IAAI;QACb,GAAG,EAAE,IAAI,CAAC,uBAAuB,CAAC;QAClC,aAAa;KACd,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { default as handleUploadFiles } from "./create.js";
2
+ export { default as handleUpdateFile } from "./update.js";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/js/upload/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAC3D,OAAO,EAAC,OAAO,IAAI,gBAAgB,EAAC,MAAM,aAAa,CAAA"}
@@ -0,0 +1,3 @@
1
+ export { default as handleUploadFiles } from "./create.js";
2
+ export { default as handleUpdateFile } from "./update.js";
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/js/upload/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAC3D,OAAO,EAAC,OAAO,IAAI,gBAAgB,EAAC,MAAM,aAAa,CAAA"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=cloudinary.provider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cloudinary.provider.d.ts","sourceRoot":"","sources":["../../../../src/js/upload/providers/cloudinary.provider.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=cloudinary.provider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cloudinary.provider.js","sourceRoot":"","sources":["../../../../src/js/upload/providers/cloudinary.provider.ts"],"names":[],"mappings":""}
@@ -0,0 +1,10 @@
1
+ import type { StoreFile } from "../types/StoreFile.js";
2
+ import type { Route } from "../types/Collection.ts";
3
+ import type { Request } from "express";
4
+ declare const handleUpdateFile: (req: Request, route: Route, body: any, item: any) => Promise<{
5
+ updated: StoreFile;
6
+ mongooseField: string;
7
+ _id: any;
8
+ } | undefined>;
9
+ export default handleUpdateFile;
10
+ //# sourceMappingURL=update.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../../src/js/upload/update.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAgDvC,QAAA,MAAM,gBAAgB,GACpB,KAAK,OAAO,EACZ,OAAO,KAAK,EACZ,MAAM,GAAG,EACT,MAAM,GAAG;;;;cA+IV,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
@@ -0,0 +1,144 @@
1
+ import streamifier from "streamifier";
2
+ import AppError from "../utils/AppError.js";
3
+ import { cloudinary, setupCloudinary } from "../config/cloudinary.js";
4
+ import AppLog from "../utils/AppLog.js";
5
+ const uploadFile = (file, route) => {
6
+ setupCloudinary(route);
7
+ return new Promise((resolve, reject) => {
8
+ const stream = cloudinary.uploader.upload_stream({
9
+ folder: "framework",
10
+ }, async (error, result) => {
11
+ if (error || !result) {
12
+ return reject(new AppError({
13
+ message: "Cloudinary upload failed.",
14
+ statusCode: 500,
15
+ code: "UPLOAD_CLOUDINARY_FAILED",
16
+ hint: "Verify your Cloudinary configuration, credentials, and network connectivity.",
17
+ details: {
18
+ handler: route.handler,
19
+ method: route.method,
20
+ path: route.path,
21
+ },
22
+ }));
23
+ }
24
+ resolve({
25
+ url: result.secure_url,
26
+ storageKey: result.public_id,
27
+ width: result.width,
28
+ height: result.height,
29
+ bytes: result.bytes,
30
+ format: result.format,
31
+ resourceType: result.resource_type,
32
+ });
33
+ });
34
+ streamifier.createReadStream(file.buffer).pipe(stream);
35
+ });
36
+ };
37
+ const handleUpdateFile = async (req, route, body, item) => {
38
+ const reqFilesArray = Object.keys(req.files ?? {});
39
+ const fileArray = route.fileArray;
40
+ if (!Array.isArray(fileArray) || fileArray.length === 0)
41
+ throw new AppError({
42
+ message: "fileArray is required.",
43
+ statusCode: 400,
44
+ code: "UPLOAD_ARRAY_REQUIRED",
45
+ hint: "Provide fileArray in the collection route configuration for update handlers.",
46
+ details: {
47
+ handler: route.handler,
48
+ method: route.method,
49
+ path: route.path,
50
+ },
51
+ });
52
+ if (fileArray.length > 1)
53
+ AppLog("warn", "updateFile", `fileArray in collection has more than 1 items for handler: '${route.handler}', method: '${route.method}' and path: '${route.path}' to update.`);
54
+ const mongooseField = fileArray[0]?.mongooseSchemaFieldName;
55
+ if (typeof mongooseField !== "string" || mongooseField.trim() === "")
56
+ throw new AppError({
57
+ message: "mongooseSchemaFieldName is required.",
58
+ statusCode: 400,
59
+ code: "UPLOAD_MONGOOSE_FIELD_REQUIRED",
60
+ hint: "Provide mongooseSchemaFieldName in collection -> fileArray configuration.",
61
+ details: {
62
+ handler: route.handler,
63
+ method: route.method,
64
+ path: route.path,
65
+ },
66
+ });
67
+ if (!reqFilesArray.length)
68
+ throw new AppError({
69
+ message: "File is required.",
70
+ statusCode: 400,
71
+ code: "UPLOAD_FILE_REQUIRED",
72
+ hint: "Upload a file using the configured upload field.",
73
+ details: {
74
+ handler: route.handler,
75
+ method: route.method,
76
+ path: route.path,
77
+ },
78
+ });
79
+ if (reqFilesArray.length > 1)
80
+ AppLog("warn", "updateFile", `req.files has more than 1 fieldNames: '${reqFilesArray.join(", ")}' for handler: '${route.handler}', method: '${route.method}' and path: '${route.path}' to update.`);
81
+ const mongooseFilesArray = item[mongooseField];
82
+ if (!mongooseFilesArray)
83
+ throw new AppError({
84
+ message: `'${mongooseField}' field not found.`,
85
+ statusCode: 400,
86
+ code: "SCHEMA_FIELD_REQUIRED",
87
+ hint: "Ensure mongooseSchemaFieldName matches an existing schema field.",
88
+ details: {
89
+ handler: route.handler,
90
+ method: route.method,
91
+ path: route.path,
92
+ },
93
+ });
94
+ const validationIdentifierKey = fileArray[0].validationIdentifierKey;
95
+ if (typeof validationIdentifierKey !== "string" ||
96
+ validationIdentifierKey.trim() === "")
97
+ throw new AppError({
98
+ message: "validationIdentifierKey is required.",
99
+ statusCode: 400,
100
+ code: "VALIDATION_KEY_REQUIRED",
101
+ hint: "Provide validationIdentifierKey in collection -> fileArray configuration.",
102
+ details: {
103
+ handler: route.handler,
104
+ method: route.method,
105
+ path: route.path,
106
+ },
107
+ });
108
+ if (!body[validationIdentifierKey])
109
+ throw new AppError({
110
+ message: `'${validationIdentifierKey}' is required.`,
111
+ statusCode: 400,
112
+ code: "VALIDATION_REQUIRED_FIELD_MISSING",
113
+ hint: `Provide '${validationIdentifierKey}' in the request body.`,
114
+ details: {
115
+ handler: route.handler,
116
+ method: route.method,
117
+ path: route.path,
118
+ },
119
+ });
120
+ const oldItem = mongooseFilesArray.find((el) => el._id.toString() === body[validationIdentifierKey]);
121
+ if (!oldItem)
122
+ throw new AppError({
123
+ message: `File with id '${body[validationIdentifierKey]}' not found.`,
124
+ statusCode: 404,
125
+ code: "CRUD_ITEM_NOT_FOUND",
126
+ hint: "Verify the provided file identifier exists in the stored file array.",
127
+ details: {
128
+ handler: route.handler,
129
+ method: route.method,
130
+ path: route.path,
131
+ },
132
+ });
133
+ if (!Array.isArray(req.files)) {
134
+ const updated = await uploadFile(req.files[reqFilesArray[0]][0], route);
135
+ await cloudinary.uploader.destroy(oldItem.storageKey);
136
+ return {
137
+ updated,
138
+ mongooseField,
139
+ _id: body[validationIdentifierKey],
140
+ };
141
+ }
142
+ };
143
+ export default handleUpdateFile;
144
+ //# sourceMappingURL=update.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"update.js","sourceRoot":"","sources":["../../../src/js/upload/update.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,MAAM,aAAa,CAAC;AACtC,OAAO,QAAQ,MAAM,sBAAsB,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAItE,OAAO,MAAM,MAAM,oBAAoB,CAAC;AAExC,MAAM,UAAU,GAAG,CACjB,IAAyB,EACzB,KAAY,EACQ,EAAE;IACtB,eAAe,CAAC,KAAK,CAAC,CAAC;IAEvB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,MAAM,MAAM,GAAG,UAAU,CAAC,QAAQ,CAAC,aAAa,CAC9C;YACE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ACjE,OAAO,EAAE;gBACP,OAAO,EAAE,KAAK,CAAC,OAAO;gBACtB,MAAM,EAAE,KAAK,CAAC,MAAM;gBACpB,IAAI,EAAE,KAAK,CAAC,IAAI;aACjB;SACF,CAAC,CAAC;IAEL,MAAM,OAAO,GAAG,kBAAkB,CAAC,IAAI,CACrC,CAAC,EAAO,EAAE,EAAE,CAAC,EAAE,CAAC,GAAG,CAAC,QAAQ,EAAE,KAAK,IAAI,CAAC,uBAAuB,CAAC,CACjE,CAAC;IAEF,IAAI,CAAC,OAAO;QACV,MAAM,IAAI,QAAQ,CAAC;YACjB,OAAO,EAAE,iBAAiB,IAAI,CAAC,uBAAuB,CAAC,cAAc;YACrE,UAAU,EAAE,GAAG;YACf,IAAI,EAAE,qBAAqB;YAC3B,IAAI,EACF,sEAAsE;YACxE,OAAO,EAAE;gBACP,OAAO,EAAE,KAAK,CAAC,OAAO;gBACtB,MAAM,EAAE,KAAK,CAAC,MAAM;gBACpB,IAAI,EAAE,KAAK,CAAC,IAAI;aACjB;SACF,CAAC,CAAC;IAEL,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC;QAC9B,MAAM,OAAO,GAAG,MAAM,UAAU,CAC9B,GAAG,CAAC,KAAM,CAAC,aAAa,CAAC,CAAC,CAAE,CAAE,CAAC,CAAC,CAAE,EAClC,KAAK,CACN,CAAC;QAEF,MAAM,UAAU,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;QAEtD,OAAO;YACL,OAAO;YACP,aAAa;YACb,GAAG,EAAE,IAAI,CAAC,uBAAuB,CAAC;SACnC,CAAC;IACJ,CAAC;AACH,CAAC,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
@@ -0,0 +1,26 @@
1
+ export interface AppErrorConstructor {
2
+ message: string;
3
+ statusCode: number;
4
+ isOperational?: boolean;
5
+ code: string;
6
+ details: {
7
+ handler: string;
8
+ method: string;
9
+ path: string;
10
+ };
11
+ hint: string;
12
+ }
13
+ declare class AppError extends Error {
14
+ statusCode: number;
15
+ isOperational: boolean;
16
+ code: string;
17
+ details: {
18
+ handler: string;
19
+ method: string;
20
+ path: string;
21
+ };
22
+ hint: string;
23
+ constructor(values: AppErrorConstructor);
24
+ }
25
+ export default AppError;
26
+ //# sourceMappingURL=AppError.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AppError.d.ts","sourceRoot":"","sources":["../../../src/js/utils/AppError.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE;QACP,OAAO,EAAE,MAAM,CAAC;QAChB,MAAM,EAAE,MAAM,CAAC;QACf,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;IACF,IAAI,EAAE,MAAM,CAAC;CACd;AAED,cAAM,QAAS,SAAQ,KAAK;IAC1B,UAAU,SAAC;IACX,aAAa,UAAC;IACd,IAAI,SAAC;IACL,OAAO;iBAXI,MAAM;gBACP,MAAM;cACR,MAAM;MASN;IACR,IAAI,SAAC;gBACO,MAAM,EAAE,mBAAmB;CASxC;AAED,eAAe,QAAQ,CAAC"}
@@ -0,0 +1,18 @@
1
+ class AppError extends Error {
2
+ statusCode;
3
+ isOperational;
4
+ code;
5
+ details;
6
+ hint;
7
+ constructor(values) {
8
+ super(values.message);
9
+ this.message = values.message;
10
+ this.statusCode = values.statusCode;
11
+ this.isOperational = values.isOperational ?? true;
12
+ this.code = values.code;
13
+ this.details = values.details;
14
+ this.hint = values.hint;
15
+ }
16
+ }
17
+ export default AppError;
18
+ //# sourceMappingURL=AppError.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AppError.js","sourceRoot":"","sources":["../../../src/js/utils/AppError.ts"],"names":[],"mappings":"AAaA,MAAM,QAAS,SAAQ,KAAK;IAC1B,UAAU,CAAC;IACX,aAAa,CAAC;IACd,IAAI,CAAC;IACL,OAAO,CAAC;IACR,IAAI,CAAC;IACL,YAAY,MAA2B;QACrC,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QACtB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC;QAC9B,IAAI,CAAC,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC;QACpC,IAAI,CAAC,aAAa,GAAG,MAAM,CAAC,aAAa,IAAI,IAAI,CAAC;QAClD,IAAI,CAAC,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC;QACxB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC;QAC9B,IAAI,CAAC,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC;IAC1B,CAAC;CACF;AAED,eAAe,QAAQ,CAAC"}
@@ -0,0 +1,10 @@
1
+ export interface AppLogInterface {
2
+ check: string;
3
+ x: string;
4
+ db: string;
5
+ loading: string;
6
+ warn: string;
7
+ }
8
+ declare const AppLog: (emoji: keyof AppLogInterface, file: string, message: string) => void;
9
+ export default AppLog;
10
+ //# sourceMappingURL=AppLog.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AppLog.d.ts","sourceRoot":"","sources":["../../../src/js/utils/AppLog.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,CAAC,EAAE,MAAM,CAAC;IACV,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;CACd;AAUD,QAAA,MAAM,MAAM,GACV,OAAO,MAAM,eAAe,EAC5B,MAAM,MAAM,EACZ,SAAS,MAAM,KACd,IAEF,CAAC;AAEF,eAAe,MAAM,CAAC"}
@@ -0,0 +1,12 @@
1
+ const emojis = {
2
+ check: "✅",
3
+ x: "❌",
4
+ db: "📚",
5
+ loading: "⏳",
6
+ warn: "⚠️ ",
7
+ };
8
+ const AppLog = (emoji, file, message) => {
9
+ console.log(`${emojis[emoji]} [${file}] ${message}`);
10
+ };
11
+ export default AppLog;
12
+ //# sourceMappingURL=AppLog.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AppLog.js","sourceRoot":"","sources":["../../../src/js/utils/AppLog.ts"],"names":[],"mappings":"AAQA,MAAM,MAAM,GAAoB;IAC9B,KAAK,EAAE,GAAG;IACV,CAAC,EAAE,GAAG;IACN,EAAE,EAAE,IAAI;IACR,OAAO,EAAE,GAAG;IACZ,IAAI,EAAE,KAAK;CACZ,CAAC;AAEF,MAAM,MAAM,GAAG,CACb,KAA4B,EAC5B,IAAY,EACZ,OAAe,EACT,EAAE;IACR,OAAO,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,KAAK,IAAI,KAAK,OAAO,EAAE,CAAC,CAAC;AACvD,CAAC,CAAC;AAEF,eAAe,MAAM,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=Applog.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Applog.d.ts","sourceRoot":"","sources":["../../../src/js/utils/Applog.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=Applog.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Applog.js","sourceRoot":"","sources":["../../../src/js/utils/Applog.ts"],"names":[],"mappings":""}
@@ -0,0 +1,4 @@
1
+ import type { RequestHandler } from "express";
2
+ declare const asyncHandler: (fn: RequestHandler) => RequestHandler;
3
+ export default asyncHandler;
4
+ //# sourceMappingURL=AsyncHandler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AsyncHandler.d.ts","sourceRoot":"","sources":["../../../src/js/utils/AsyncHandler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE9C,QAAA,MAAM,YAAY,GACf,IAAI,cAAc,KAAG,cAGrB,CAAC;AACJ,eAAe,YAAY,CAAA"}
@@ -0,0 +1,5 @@
1
+ const asyncHandler = (fn) => (req, res, next) => {
2
+ Promise.resolve(fn(req, res, next)).catch(next);
3
+ };
4
+ export default asyncHandler;
5
+ //# sourceMappingURL=AsyncHandler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AsyncHandler.js","sourceRoot":"","sources":["../../../src/js/utils/AsyncHandler.ts"],"names":[],"mappings":"AAEA,MAAM,YAAY,GAChB,CAAC,EAAkB,EAAkB,EAAE,CACvC,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE;IACjB,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;AAClD,CAAC,CAAC;AACJ,eAAe,YAAY,CAAA"}
@@ -0,0 +1,2 @@
1
+ export declare function extractParamNames(params: string[]): (string | undefined)[];
2
+ //# sourceMappingURL=extractParamsNames.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extractParamsNames.d.ts","sourceRoot":"","sources":["../../../src/js/utils/extractParamsNames.ts"],"names":[],"mappings":"AAAA,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE,0BAkBjD"}
@@ -0,0 +1,13 @@
1
+ export function extractParamNames(params) {
2
+ const paramRegex = /:([a-zA-Z0-9]+)/g;
3
+ const uniqueNames = [];
4
+ for (const param of params) {
5
+ let match;
6
+ while ((match = paramRegex.exec(param)) !== null) {
7
+ const paramName = match[1];
8
+ uniqueNames.push(paramName);
9
+ }
10
+ }
11
+ return uniqueNames;
12
+ }
13
+ //# sourceMappingURL=extractParamsNames.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extractParamsNames.js","sourceRoot":"","sources":["../../../src/js/utils/extractParamsNames.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,iBAAiB,CAAC,MAAgB;IAKhD,MAAM,UAAU,GAAG,kBAAkB,CAAC;IACtC,MAAM,WAAW,GAAG,EAAE,CAAC;IAEvB,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QAC3B,IAAI,KAAK,CAAC;QAEV,OAAO,CAAC,KAAK,GAAG,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC;YAEjD,MAAM,SAAS,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;YAC3B,WAAW,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAC9B,CAAC;IACH,CAAC;IACD,OAAO,WAAW,CAAC;AACrB,CAAC"}
@@ -0,0 +1,8 @@
1
+ import type { Route } from "../types/Collection.js";
2
+ declare const getErrorDetail: (route: Route) => {
3
+ handler: import("../types/Collection.js").Handler;
4
+ method: import("../types/Collection.js").RouteMethod;
5
+ path: import("../types/Routepath.js").RoutePath;
6
+ };
7
+ export default getErrorDetail;
8
+ //# sourceMappingURL=getErrorDetail.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getErrorDetail.d.ts","sourceRoot":"","sources":["../../../src/js/utils/getErrorDetail.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAEpD,QAAA,MAAM,cAAc,GAAI,OAAO,KAAK;;;;CAMnC,CAAC;AAEF,eAAe,cAAc,CAAA"}
@@ -0,0 +1,9 @@
1
+ const getErrorDetail = (route) => {
2
+ return {
3
+ handler: route.handler,
4
+ method: route.method,
5
+ path: route.path,
6
+ };
7
+ };
8
+ export default getErrorDetail;
9
+ //# sourceMappingURL=getErrorDetail.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getErrorDetail.js","sourceRoot":"","sources":["../../../src/js/utils/getErrorDetail.ts"],"names":[],"mappings":"AAEA,MAAM,cAAc,GAAG,CAAC,KAAY,EAAE,EAAE;IACtC,OAAO;QACL,OAAO,EAAE,KAAK,CAAC,OAAO;QACtB,MAAM,EAAE,KAAK,CAAC,MAAM;QACpB,IAAI,EAAE,KAAK,CAAC,IAAI;KACjB,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,cAAc,CAAA"}
@@ -0,0 +1,8 @@
1
+ import type { Route } from "../types/Collection.js";
2
+ declare const getModel: ({ modelName, routeName, route, }: {
3
+ modelName: string;
4
+ routeName: string;
5
+ route: Route;
6
+ }) => import("mongoose").Model<any, unknown, unknown, unknown, any, any, unknown>;
7
+ export default getModel;
8
+ //# sourceMappingURL=getModel.d.ts.map