@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.
- package/dist/js/admin/index.d.ts +4 -0
- package/dist/js/admin/index.d.ts.map +1 -0
- package/dist/js/admin/index.js +5 -0
- package/dist/js/admin/index.js.map +1 -0
- package/dist/js/app.d.ts +3 -0
- package/dist/js/app.d.ts.map +1 -0
- package/dist/js/app.js +55 -0
- package/dist/js/app.js.map +1 -0
- package/dist/js/auth/bunch.auth.d.ts +8 -0
- package/dist/js/auth/bunch.auth.d.ts.map +1 -0
- package/dist/js/auth/bunch.auth.js +8 -0
- package/dist/js/auth/bunch.auth.js.map +1 -0
- package/dist/js/auth/createOTPModel.d.ts +2 -0
- package/dist/js/auth/createOTPModel.d.ts.map +1 -0
- package/dist/js/auth/createOTPModel.js +2 -0
- package/dist/js/auth/createOTPModel.js.map +1 -0
- package/dist/js/auth/forgotPassword.d.ts +10 -0
- package/dist/js/auth/forgotPassword.d.ts.map +1 -0
- package/dist/js/auth/forgotPassword.js +39 -0
- package/dist/js/auth/forgotPassword.js.map +1 -0
- package/dist/js/auth/index.d.ts +5 -0
- package/dist/js/auth/index.d.ts.map +1 -0
- package/dist/js/auth/index.js +26 -0
- package/dist/js/auth/index.js.map +1 -0
- package/dist/js/auth/login.d.ts +10 -0
- package/dist/js/auth/login.d.ts.map +1 -0
- package/dist/js/auth/login.js +32 -0
- package/dist/js/auth/login.js.map +1 -0
- package/dist/js/auth/logout.d.ts +5 -0
- package/dist/js/auth/logout.d.ts.map +1 -0
- package/dist/js/auth/logout.js +10 -0
- package/dist/js/auth/logout.js.map +1 -0
- package/dist/js/auth/resendOTP.d.ts +10 -0
- package/dist/js/auth/resendOTP.d.ts.map +1 -0
- package/dist/js/auth/resendOTP.js +62 -0
- package/dist/js/auth/resendOTP.js.map +1 -0
- package/dist/js/auth/resetPassword.d.ts +10 -0
- package/dist/js/auth/resetPassword.d.ts.map +1 -0
- package/dist/js/auth/resetPassword.js +60 -0
- package/dist/js/auth/resetPassword.js.map +1 -0
- package/dist/js/auth/sendOTP.d.ts +6 -0
- package/dist/js/auth/sendOTP.d.ts.map +1 -0
- package/dist/js/auth/sendOTP.js +28 -0
- package/dist/js/auth/sendOTP.js.map +1 -0
- package/dist/js/auth/signup.d.ts +10 -0
- package/dist/js/auth/signup.d.ts.map +1 -0
- package/dist/js/auth/signup.js +47 -0
- package/dist/js/auth/signup.js.map +1 -0
- package/dist/js/auth/twoFactorAuth.d.ts +2 -0
- package/dist/js/auth/twoFactorAuth.d.ts.map +1 -0
- package/dist/js/auth/twoFactorAuth.js +3 -0
- package/dist/js/auth/twoFactorAuth.js.map +1 -0
- package/dist/js/auth/utils/authenticateUser.d.ts +11 -0
- package/dist/js/auth/utils/authenticateUser.d.ts.map +1 -0
- package/dist/js/auth/utils/authenticateUser.js +60 -0
- package/dist/js/auth/utils/authenticateUser.js.map +1 -0
- package/dist/js/auth/utils/createOTPModel.d.ts +4 -0
- package/dist/js/auth/utils/createOTPModel.d.ts.map +1 -0
- package/dist/js/auth/utils/createOTPModel.js +28 -0
- package/dist/js/auth/utils/createOTPModel.js.map +1 -0
- package/dist/js/auth/utils/createOTPUser.d.ts +12 -0
- package/dist/js/auth/utils/createOTPUser.d.ts.map +1 -0
- package/dist/js/auth/utils/createOTPUser.js +63 -0
- package/dist/js/auth/utils/createOTPUser.js.map +1 -0
- package/dist/js/auth/utils/createUser.d.ts +11 -0
- package/dist/js/auth/utils/createUser.d.ts.map +1 -0
- package/dist/js/auth/utils/createUser.js +42 -0
- package/dist/js/auth/utils/createUser.js.map +1 -0
- package/dist/js/auth/utils/deleteOTPUser.d.ts +3 -0
- package/dist/js/auth/utils/deleteOTPUser.d.ts.map +1 -0
- package/dist/js/auth/utils/deleteOTPUser.js +3 -0
- package/dist/js/auth/utils/deleteOTPUser.js.map +1 -0
- package/dist/js/auth/utils/findUser.d.ts +2 -0
- package/dist/js/auth/utils/findUser.d.ts.map +1 -0
- package/dist/js/auth/utils/findUser.js +2 -0
- package/dist/js/auth/utils/findUser.js.map +1 -0
- package/dist/js/auth/utils/getModel.d.ts +6 -0
- package/dist/js/auth/utils/getModel.d.ts.map +1 -0
- package/dist/js/auth/utils/getModel.js +18 -0
- package/dist/js/auth/utils/getModel.js.map +1 -0
- package/dist/js/auth/utils/getOTPData.d.ts +9 -0
- package/dist/js/auth/utils/getOTPData.d.ts.map +1 -0
- package/dist/js/auth/utils/getOTPData.js +26 -0
- package/dist/js/auth/utils/getOTPData.js.map +1 -0
- package/dist/js/auth/utils/getOTPModel.d.ts +4 -0
- package/dist/js/auth/utils/getOTPModel.d.ts.map +1 -0
- package/dist/js/auth/utils/getOTPModel.js +20 -0
- package/dist/js/auth/utils/getOTPModel.js.map +1 -0
- package/dist/js/auth/utils/getOTPUser.d.ts +8 -0
- package/dist/js/auth/utils/getOTPUser.d.ts.map +1 -0
- package/dist/js/auth/utils/getOTPUser.js +21 -0
- package/dist/js/auth/utils/getOTPUser.js.map +1 -0
- package/dist/js/auth/utils/getUser.d.ts +10 -0
- package/dist/js/auth/utils/getUser.d.ts.map +1 -0
- package/dist/js/auth/utils/getUser.js +27 -0
- package/dist/js/auth/utils/getUser.js.map +1 -0
- package/dist/js/auth/utils/handleIsVerfieid.d.ts +9 -0
- package/dist/js/auth/utils/handleIsVerfieid.d.ts.map +1 -0
- package/dist/js/auth/utils/handleIsVerfieid.js +20 -0
- package/dist/js/auth/utils/handleIsVerfieid.js.map +1 -0
- package/dist/js/auth/utils/handleIsVerified.d.ts +11 -0
- package/dist/js/auth/utils/handleIsVerified.d.ts.map +1 -0
- package/dist/js/auth/utils/handleIsVerified.js +31 -0
- package/dist/js/auth/utils/handleIsVerified.js.map +1 -0
- package/dist/js/auth/utils/modeMap.d.ts +38 -0
- package/dist/js/auth/utils/modeMap.d.ts.map +1 -0
- package/dist/js/auth/utils/modeMap.js +15 -0
- package/dist/js/auth/utils/modeMap.js.map +1 -0
- package/dist/js/auth/utils/otpHTML.d.ts +2 -0
- package/dist/js/auth/utils/otpHTML.d.ts.map +1 -0
- package/dist/js/auth/utils/otpHTML.js +2 -0
- package/dist/js/auth/utils/otpHTML.js.map +1 -0
- package/dist/js/auth/utils/otpVerifiedResponse.d.ts +9 -0
- package/dist/js/auth/utils/otpVerifiedResponse.d.ts.map +1 -0
- package/dist/js/auth/utils/otpVerifiedResponse.js +22 -0
- package/dist/js/auth/utils/otpVerifiedResponse.js.map +1 -0
- package/dist/js/auth/utils/sendCookie.d.ts +14 -0
- package/dist/js/auth/utils/sendCookie.d.ts.map +1 -0
- package/dist/js/auth/utils/sendCookie.js +73 -0
- package/dist/js/auth/utils/sendCookie.js.map +1 -0
- package/dist/js/auth/utils/sendOTP.d.ts +7 -0
- package/dist/js/auth/utils/sendOTP.d.ts.map +1 -0
- package/dist/js/auth/utils/sendOTP.js +48 -0
- package/dist/js/auth/utils/sendOTP.js.map +1 -0
- package/dist/js/auth/utils/verifyCredentials.d.ts +9 -0
- package/dist/js/auth/utils/verifyCredentials.d.ts.map +1 -0
- package/dist/js/auth/utils/verifyCredentials.js +39 -0
- package/dist/js/auth/utils/verifyCredentials.js.map +1 -0
- package/dist/js/auth/verifyOTP.d.ts +10 -0
- package/dist/js/auth/verifyOTP.d.ts.map +1 -0
- package/dist/js/auth/verifyOTP.js +110 -0
- package/dist/js/auth/verifyOTP.js.map +1 -0
- package/dist/js/config/cloudinary.d.ts +5 -0
- package/dist/js/config/cloudinary.d.ts.map +1 -0
- package/dist/js/config/cloudinary.js +25 -0
- package/dist/js/config/cloudinary.js.map +1 -0
- package/dist/js/config/defaultConfig.d.ts +3 -0
- package/dist/js/config/defaultConfig.d.ts.map +1 -0
- package/dist/js/config/defaultConfig.js +12 -0
- package/dist/js/config/defaultConfig.js.map +1 -0
- package/dist/js/config/duration.d.ts +22 -0
- package/dist/js/config/duration.d.ts.map +1 -0
- package/dist/js/config/duration.js +35 -0
- package/dist/js/config/duration.js.map +1 -0
- package/dist/js/config/envs.d.ts +32 -0
- package/dist/js/config/envs.d.ts.map +1 -0
- package/dist/js/config/envs.js +10 -0
- package/dist/js/config/envs.js.map +1 -0
- package/dist/js/config/handleReqType.d.ts +7 -0
- package/dist/js/config/handleReqType.d.ts.map +1 -0
- package/dist/js/config/handleReqType.js +13 -0
- package/dist/js/config/handleReqType.js.map +1 -0
- package/dist/js/config/handlerMap.d.ts +3 -0
- package/dist/js/config/handlerMap.d.ts.map +1 -0
- package/dist/js/config/handlerMap.js +29 -0
- package/dist/js/config/handlerMap.js.map +1 -0
- package/dist/js/config/reqTypes.d.ts +2 -0
- package/dist/js/config/reqTypes.d.ts.map +1 -0
- package/dist/js/config/reqTypes.js +2 -0
- package/dist/js/config/reqTypes.js.map +1 -0
- package/dist/js/config/sendEmail.d.ts +11 -0
- package/dist/js/config/sendEmail.d.ts.map +1 -0
- package/dist/js/config/sendEmail.js +95 -0
- package/dist/js/config/sendEmail.js.map +1 -0
- package/dist/js/core/app.d.ts +3 -0
- package/dist/js/core/app.d.ts.map +1 -0
- package/dist/js/core/app.js +19 -0
- package/dist/js/core/app.js.map +1 -0
- package/dist/js/crud/bunch.crud.d.ts +11 -0
- package/dist/js/crud/bunch.crud.d.ts.map +1 -0
- package/dist/js/crud/bunch.crud.js +11 -0
- package/dist/js/crud/bunch.crud.js.map +1 -0
- package/dist/js/crud/create.d.ts +10 -0
- package/dist/js/crud/create.d.ts.map +1 -0
- package/dist/js/crud/create.js +72 -0
- package/dist/js/crud/create.js.map +1 -0
- package/dist/js/crud/createBulk.d.ts +10 -0
- package/dist/js/crud/createBulk.d.ts.map +1 -0
- package/dist/js/crud/createBulk.js +20 -0
- package/dist/js/crud/createBulk.js.map +1 -0
- package/dist/js/crud/files/file.update.d.ts +10 -0
- package/dist/js/crud/files/file.update.d.ts.map +1 -0
- package/dist/js/crud/files/file.update.js +28 -0
- package/dist/js/crud/files/file.update.js.map +1 -0
- package/dist/js/crud/handleUploads/file.add.d.ts +10 -0
- package/dist/js/crud/handleUploads/file.add.d.ts.map +1 -0
- package/dist/js/crud/handleUploads/file.add.js +61 -0
- package/dist/js/crud/handleUploads/file.add.js.map +1 -0
- package/dist/js/crud/handleUploads/file.create.d.ts +10 -0
- package/dist/js/crud/handleUploads/file.create.d.ts.map +1 -0
- package/dist/js/crud/handleUploads/file.create.js +33 -0
- package/dist/js/crud/handleUploads/file.create.js.map +1 -0
- package/dist/js/crud/handleUploads/file.delete.d.ts +10 -0
- package/dist/js/crud/handleUploads/file.delete.d.ts.map +1 -0
- package/dist/js/crud/handleUploads/file.delete.js +35 -0
- package/dist/js/crud/handleUploads/file.delete.js.map +1 -0
- package/dist/js/crud/handleUploads/file.update.d.ts +10 -0
- package/dist/js/crud/handleUploads/file.update.d.ts.map +1 -0
- package/dist/js/crud/handleUploads/file.update.js +30 -0
- package/dist/js/crud/handleUploads/file.update.js.map +1 -0
- package/dist/js/crud/index.d.ts +5 -0
- package/dist/js/crud/index.d.ts.map +1 -0
- package/dist/js/crud/index.js +36 -0
- package/dist/js/crud/index.js.map +1 -0
- package/dist/js/crud/read.d.ts +10 -0
- package/dist/js/crud/read.d.ts.map +1 -0
- package/dist/js/crud/read.js +27 -0
- package/dist/js/crud/read.js.map +1 -0
- package/dist/js/crud/readAll.d.ts +10 -0
- package/dist/js/crud/readAll.d.ts.map +1 -0
- package/dist/js/crud/readAll.js +24 -0
- package/dist/js/crud/readAll.js.map +1 -0
- package/dist/js/crud/remove.d.ts +10 -0
- package/dist/js/crud/remove.d.ts.map +1 -0
- package/dist/js/crud/remove.js +28 -0
- package/dist/js/crud/remove.js.map +1 -0
- package/dist/js/crud/removeAll.d.ts +10 -0
- package/dist/js/crud/removeAll.d.ts.map +1 -0
- package/dist/js/crud/removeAll.js +37 -0
- package/dist/js/crud/removeAll.js.map +1 -0
- package/dist/js/crud/update.d.ts +10 -0
- package/dist/js/crud/update.d.ts.map +1 -0
- package/dist/js/crud/update.js +33 -0
- package/dist/js/crud/update.js.map +1 -0
- package/dist/js/crud/utils/authroizeAccess.d.ts +10 -0
- package/dist/js/crud/utils/authroizeAccess.d.ts.map +1 -0
- package/dist/js/crud/utils/authroizeAccess.js +48 -0
- package/dist/js/crud/utils/authroizeAccess.js.map +1 -0
- package/dist/js/crud/utils/getItem.d.ts +11 -0
- package/dist/js/crud/utils/getItem.d.ts.map +1 -0
- package/dist/js/crud/utils/getItem.js +68 -0
- package/dist/js/crud/utils/getItem.js.map +1 -0
- package/dist/js/crud/utils/getParam.d.ts +8 -0
- package/dist/js/crud/utils/getParam.d.ts.map +1 -0
- package/dist/js/crud/utils/getParam.js +19 -0
- package/dist/js/crud/utils/getParam.js.map +1 -0
- package/dist/js/crud/utils/validateOwner.d.ts +7 -0
- package/dist/js/crud/utils/validateOwner.d.ts.map +1 -0
- package/dist/js/crud/utils/validateOwner.js +5 -0
- package/dist/js/crud/utils/validateOwner.js.map +1 -0
- package/dist/js/health/bunch.health.d.ts +6 -0
- package/dist/js/health/bunch.health.d.ts.map +1 -0
- package/dist/js/health/bunch.health.js +6 -0
- package/dist/js/health/bunch.health.js.map +1 -0
- package/dist/js/health/delete.health.d.ts +4 -0
- package/dist/js/health/delete.health.d.ts.map +1 -0
- package/dist/js/health/delete.health.js +5 -0
- package/dist/js/health/delete.health.js.map +1 -0
- package/dist/js/health/get.health.d.ts +4 -0
- package/dist/js/health/get.health.d.ts.map +1 -0
- package/dist/js/health/get.health.js +5 -0
- package/dist/js/health/get.health.js.map +1 -0
- package/dist/js/health/health.collection.d.ts +4 -0
- package/dist/js/health/health.collection.d.ts.map +1 -0
- package/dist/js/health/health.collection.js +39 -0
- package/dist/js/health/health.collection.js.map +1 -0
- package/dist/js/health/health.controller.d.ts +4 -0
- package/dist/js/health/health.controller.d.ts.map +1 -0
- package/dist/js/health/health.controller.js +5 -0
- package/dist/js/health/health.controller.js.map +1 -0
- package/dist/js/health/index.d.ts +5 -0
- package/dist/js/health/index.d.ts.map +1 -0
- package/dist/js/health/index.js +10 -0
- package/dist/js/health/index.js.map +1 -0
- package/dist/js/health/patch.health.d.ts +4 -0
- package/dist/js/health/patch.health.d.ts.map +1 -0
- package/dist/js/health/patch.health.js +5 -0
- package/dist/js/health/patch.health.js.map +1 -0
- package/dist/js/health/post.health.d.ts +4 -0
- package/dist/js/health/post.health.d.ts.map +1 -0
- package/dist/js/health/post.health.js +5 -0
- package/dist/js/health/post.health.js.map +1 -0
- package/dist/js/health/put.health.d.ts +4 -0
- package/dist/js/health/put.health.d.ts.map +1 -0
- package/dist/js/health/put.health.js +5 -0
- package/dist/js/health/put.health.js.map +1 -0
- package/dist/js/index.d.ts +13 -0
- package/dist/js/index.d.ts.map +1 -0
- package/dist/js/index.js +21 -0
- package/dist/js/index.js.map +1 -0
- package/dist/js/lib/Mongoose.d.ts +53 -0
- package/dist/js/lib/Mongoose.d.ts.map +1 -0
- package/dist/js/lib/Mongoose.js +2 -0
- package/dist/js/lib/Mongoose.js.map +1 -0
- package/dist/js/lib/OA.d.ts +2 -0
- package/dist/js/lib/OA.d.ts.map +1 -0
- package/dist/js/lib/OA.js +2 -0
- package/dist/js/lib/OA.js.map +1 -0
- package/dist/js/lib/OAuthProviders.d.ts +3 -0
- package/dist/js/lib/OAuthProviders.d.ts.map +1 -0
- package/dist/js/lib/OAuthProviders.js +18 -0
- package/dist/js/lib/OAuthProviders.js.map +1 -0
- package/dist/js/lib/PROVIDERS.d.ts +2 -0
- package/dist/js/lib/PROVIDERS.d.ts.map +1 -0
- package/dist/js/lib/PROVIDERS.js +2 -0
- package/dist/js/lib/PROVIDERS.js.map +1 -0
- package/dist/js/lib/db.d.ts +8 -0
- package/dist/js/lib/db.d.ts.map +1 -0
- package/dist/js/lib/db.js +28 -0
- package/dist/js/lib/db.js.map +1 -0
- package/dist/js/lib/handler.d.ts +9 -0
- package/dist/js/lib/handler.d.ts.map +1 -0
- package/dist/js/lib/handler.js +11 -0
- package/dist/js/lib/handler.js.map +1 -0
- package/dist/js/lib/handlerMap.d.ts +3 -0
- package/dist/js/lib/handlerMap.d.ts.map +1 -0
- package/dist/js/lib/handlerMap.js +18 -0
- package/dist/js/lib/handlerMap.js.map +1 -0
- package/dist/js/lib/model.factory.d.ts +8 -0
- package/dist/js/lib/model.factory.d.ts.map +1 -0
- package/dist/js/lib/model.factory.js +49 -0
- package/dist/js/lib/model.factory.js.map +1 -0
- package/dist/js/lib/model.registry.d.ts +4 -0
- package/dist/js/lib/model.registry.d.ts.map +1 -0
- package/dist/js/lib/model.registry.js +4 -0
- package/dist/js/lib/model.registry.js.map +1 -0
- package/dist/js/lib/mongoose.fields.d.ts +40 -0
- package/dist/js/lib/mongoose.fields.d.ts.map +1 -0
- package/dist/js/lib/mongoose.fields.js +187 -0
- package/dist/js/lib/mongoose.fields.js.map +1 -0
- package/dist/js/lib/roles.d.ts +3 -0
- package/dist/js/lib/roles.d.ts.map +1 -0
- package/dist/js/lib/roles.js +13 -0
- package/dist/js/lib/roles.js.map +1 -0
- package/dist/js/lib/schema.builder.d.ts +6 -0
- package/dist/js/lib/schema.builder.d.ts.map +1 -0
- package/dist/js/lib/schema.builder.js +28 -0
- package/dist/js/lib/schema.builder.js.map +1 -0
- package/dist/js/lib/zod.fields.d.ts +119 -0
- package/dist/js/lib/zod.fields.d.ts.map +1 -0
- package/dist/js/lib/zod.fields.js +133 -0
- package/dist/js/lib/zod.fields.js.map +1 -0
- package/dist/js/middleware/auth.middleware.d.ts +5 -0
- package/dist/js/middleware/auth.middleware.d.ts.map +1 -0
- package/dist/js/middleware/auth.middleware.js +86 -0
- package/dist/js/middleware/auth.middleware.js.map +1 -0
- package/dist/js/middleware/error.middleware.d.ts +5 -0
- package/dist/js/middleware/error.middleware.d.ts.map +1 -0
- package/dist/js/middleware/error.middleware.js +25 -0
- package/dist/js/middleware/error.middleware.js.map +1 -0
- package/dist/js/middleware/multer.middleware.d.ts +5 -0
- package/dist/js/middleware/multer.middleware.d.ts.map +1 -0
- package/dist/js/middleware/multer.middleware.js +97 -0
- package/dist/js/middleware/multer.middleware.js.map +1 -0
- package/dist/js/middleware/rateLimit.middleware.d.ts +2 -0
- package/dist/js/middleware/rateLimit.middleware.d.ts.map +1 -0
- package/dist/js/middleware/rateLimit.middleware.js +19 -0
- package/dist/js/middleware/rateLimit.middleware.js.map +1 -0
- package/dist/js/realtime/index.d.ts +4 -0
- package/dist/js/realtime/index.d.ts.map +1 -0
- package/dist/js/realtime/index.js +5 -0
- package/dist/js/realtime/index.js.map +1 -0
- package/dist/js/types/Collection.d.ts +41 -0
- package/dist/js/types/Collection.d.ts.map +1 -0
- package/dist/js/types/Collection.js +2 -0
- package/dist/js/types/Collection.js.map +1 -0
- package/dist/js/types/Constructor.d.ts +30 -0
- package/dist/js/types/Constructor.d.ts.map +1 -0
- package/dist/js/types/Constructor.js +2 -0
- package/dist/js/types/Constructor.js.map +1 -0
- package/dist/js/types/MongooseOTPSchemaObj.d.ts +10 -0
- package/dist/js/types/MongooseOTPSchemaObj.d.ts.map +1 -0
- package/dist/js/types/MongooseOTPSchemaObj.js +2 -0
- package/dist/js/types/MongooseOTPSchemaObj.js.map +1 -0
- package/dist/js/types/Routepath.d.ts +2 -0
- package/dist/js/types/Routepath.d.ts.map +1 -0
- package/dist/js/types/Routepath.js +2 -0
- package/dist/js/types/Routepath.js.map +1 -0
- package/dist/js/types/StoreFile.d.ts +10 -0
- package/dist/js/types/StoreFile.d.ts.map +1 -0
- package/dist/js/types/StoreFile.js +2 -0
- package/dist/js/types/StoreFile.js.map +1 -0
- package/dist/js/types/ValidationsObj.d.ts +7 -0
- package/dist/js/types/ValidationsObj.d.ts.map +1 -0
- package/dist/js/types/ValidationsObj.js +2 -0
- package/dist/js/types/ValidationsObj.js.map +1 -0
- package/dist/js/types/authHandlers.d.ts +2 -0
- package/dist/js/types/authHandlers.d.ts.map +1 -0
- package/dist/js/types/authHandlers.js +2 -0
- package/dist/js/types/authHandlers.js.map +1 -0
- package/dist/js/types/crudHandlers.d.ts +2 -0
- package/dist/js/types/crudHandlers.d.ts.map +1 -0
- package/dist/js/types/crudHandlers.js +2 -0
- package/dist/js/types/crudHandlers.js.map +1 -0
- package/dist/js/types/email.d.ts +12 -0
- package/dist/js/types/email.d.ts.map +1 -0
- package/dist/js/types/email.js +2 -0
- package/dist/js/types/email.js.map +1 -0
- package/dist/js/types/healthHandlers.d.ts +2 -0
- package/dist/js/types/healthHandlers.d.ts.map +1 -0
- package/dist/js/types/healthHandlers.js +2 -0
- package/dist/js/types/healthHandlers.js.map +1 -0
- package/dist/js/types/upload.d.ts +9 -0
- package/dist/js/types/upload.d.ts.map +1 -0
- package/dist/js/types/upload.js +2 -0
- package/dist/js/types/upload.js.map +1 -0
- package/dist/js/types/uploadFile.d.ts +10 -0
- package/dist/js/types/uploadFile.d.ts.map +1 -0
- package/dist/js/types/uploadFile.js +2 -0
- package/dist/js/types/uploadFile.js.map +1 -0
- package/dist/js/types/uploadHandlers.d.ts +2 -0
- package/dist/js/types/uploadHandlers.d.ts.map +1 -0
- package/dist/js/types/uploadHandlers.js +2 -0
- package/dist/js/types/uploadHandlers.js.map +1 -0
- package/dist/js/upload/create.d.ts +8 -0
- package/dist/js/upload/create.d.ts.map +1 -0
- package/dist/js/upload/create.js +71 -0
- package/dist/js/upload/create.js.map +1 -0
- package/dist/js/upload/delete.d.ts +8 -0
- package/dist/js/upload/delete.d.ts.map +1 -0
- package/dist/js/upload/delete.js +107 -0
- package/dist/js/upload/delete.js.map +1 -0
- package/dist/js/upload/index.d.ts +3 -0
- package/dist/js/upload/index.d.ts.map +1 -0
- package/dist/js/upload/index.js +3 -0
- package/dist/js/upload/index.js.map +1 -0
- package/dist/js/upload/providers/cloudinary.provider.d.ts +2 -0
- package/dist/js/upload/providers/cloudinary.provider.d.ts.map +1 -0
- package/dist/js/upload/providers/cloudinary.provider.js +2 -0
- package/dist/js/upload/providers/cloudinary.provider.js.map +1 -0
- package/dist/js/upload/update.d.ts +10 -0
- package/dist/js/upload/update.d.ts.map +1 -0
- package/dist/js/upload/update.js +144 -0
- package/dist/js/upload/update.js.map +1 -0
- package/dist/js/utils/AppError.d.ts +26 -0
- package/dist/js/utils/AppError.d.ts.map +1 -0
- package/dist/js/utils/AppError.js +18 -0
- package/dist/js/utils/AppError.js.map +1 -0
- package/dist/js/utils/AppLog.d.ts +10 -0
- package/dist/js/utils/AppLog.d.ts.map +1 -0
- package/dist/js/utils/AppLog.js +12 -0
- package/dist/js/utils/AppLog.js.map +1 -0
- package/dist/js/utils/Applog.d.ts +2 -0
- package/dist/js/utils/Applog.d.ts.map +1 -0
- package/dist/js/utils/Applog.js +2 -0
- package/dist/js/utils/Applog.js.map +1 -0
- package/dist/js/utils/AsyncHandler.d.ts +4 -0
- package/dist/js/utils/AsyncHandler.d.ts.map +1 -0
- package/dist/js/utils/AsyncHandler.js +5 -0
- package/dist/js/utils/AsyncHandler.js.map +1 -0
- package/dist/js/utils/extractParamsNames.d.ts +2 -0
- package/dist/js/utils/extractParamsNames.d.ts.map +1 -0
- package/dist/js/utils/extractParamsNames.js +13 -0
- package/dist/js/utils/extractParamsNames.js.map +1 -0
- package/dist/js/utils/getErrorDetail.d.ts +8 -0
- package/dist/js/utils/getErrorDetail.d.ts.map +1 -0
- package/dist/js/utils/getErrorDetail.js +9 -0
- package/dist/js/utils/getErrorDetail.js.map +1 -0
- package/dist/js/utils/getModel.d.ts +8 -0
- package/dist/js/utils/getModel.d.ts.map +1 -0
- package/dist/js/utils/getModel.js +27 -0
- package/dist/js/utils/getModel.js.map +1 -0
- package/dist/js/utils/handleJWT.d.ts +11 -0
- package/dist/js/utils/handleJWT.d.ts.map +1 -0
- package/dist/js/utils/handleJWT.js +89 -0
- package/dist/js/utils/handleJWT.js.map +1 -0
- package/dist/js/utils/libsodium.d.ts +15 -0
- package/dist/js/utils/libsodium.d.ts.map +1 -0
- package/dist/js/utils/libsodium.js +185 -0
- package/dist/js/utils/libsodium.js.map +1 -0
- package/dist/js/utils/otpPurposes.d.ts +3 -0
- package/dist/js/utils/otpPurposes.d.ts.map +1 -0
- package/dist/js/utils/otpPurposes.js +38 -0
- package/dist/js/utils/otpPurposes.js.map +1 -0
- package/dist/js/utils/response.d.ts +10 -0
- package/dist/js/utils/response.d.ts.map +1 -0
- package/dist/js/utils/response.js +9 -0
- package/dist/js/utils/response.js.map +1 -0
- package/dist/js/utils/sanitize.d.ts +3 -0
- package/dist/js/utils/sanitize.d.ts.map +1 -0
- package/dist/js/utils/sanitize.js +13 -0
- package/dist/js/utils/sanitize.js.map +1 -0
- package/dist/js/utils/validate.d.ts +4 -0
- package/dist/js/utils/validate.d.ts.map +1 -0
- package/dist/js/utils/validate.js +59 -0
- package/dist/js/utils/validate.js.map +1 -0
- package/dist/js/utils/validationKeyError.d.ts +4 -0
- package/dist/js/utils/validationKeyError.d.ts.map +1 -0
- package/dist/js/utils/validationKeyError.js +38 -0
- package/dist/js/utils/validationKeyError.js.map +1 -0
- package/dist/js/validations.d.ts +3 -0
- package/dist/js/validations.d.ts.map +1 -0
- package/dist/js/validations.js +6 -0
- package/dist/js/validations.js.map +1 -0
- package/package.json +88 -0
|
@@ -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 @@
|
|
|
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,EAA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E,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
|
+
{"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|
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 @@
|
|
|
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 @@
|
|
|
1
|
+
{"version":3,"file":"cloudinary.provider.d.ts","sourceRoot":"","sources":["../../../../src/js/upload/providers/cloudinary.provider.ts"],"names":[],"mappings":""}
|
|
@@ -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,MAAM,EAAE,WAAW;SACpB,EACD,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE;YACtB,IAAI,KAAK,IAAI,CAAC,MAAM,EAAE,CAAC;gBACrB,OAAO,MAAM,CACX,IAAI,QAAQ,CAAC;oBACX,OAAO,EAAE,2BAA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C,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 @@
|
|
|
1
|
+
{"version":3,"file":"Applog.d.ts","sourceRoot":"","sources":["../../../src/js/utils/Applog.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Applog.js","sourceRoot":"","sources":["../../../src/js/utils/Applog.ts"],"names":[],"mappings":""}
|
|
@@ -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 @@
|
|
|
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 @@
|
|
|
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 @@
|
|
|
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
|