zaions-express-tool-kit
Advanced tools
Comparing version 0.0.2 to 0.0.3
@@ -14,3 +14,3 @@ 'use strict'; | ||
var S=Object.defineProperty;var x=Object.getOwnPropertySymbols;var A=Object.prototype.hasOwnProperty,M=Object.prototype.propertyIsEnumerable;var E=(e,s,o)=>s in e?S(e,s,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[s]=o,w=(e,s)=>{for(var o in s||(s={}))A.call(s,o)&&E(e,o,s[o]);if(x)for(var o of x(s))M.call(s,o)&&E(e,o,s[o]);return e};var p=(e,s)=>{let{success:o=!0,message:t=zaionsToolKit.ztkMessages.general.success,data:r=null,dataList:n=null,authToken:c=null,errors:R=null,code:g=zaionsToolKit.ResponseCodeEnum.success,status:l=zaionsToolKit.ResponseStatusEnum.success}=s||{};return e.json({success:o,message:t,data:r,dataList:n,authToken:c,errors:R,code:g,status:l})},P=(e,s)=>{let{message:o=zaionsToolKit.ztkMessages.general.success,data:t=null,dataList:r=null,authToken:n=null,code:c=zaionsToolKit.ResponseCodeEnum.success,status:R=zaionsToolKit.ResponseStatusEnum.success}=s||{};return p(e,{success:!0,message:o,data:t,dataList:r,authToken:n,errors:null,code:c,status:R})},f=(e,s)=>{let{message:o=zaionsToolKit.ztkMessages.general.failed,errors:t=null,code:r=zaionsToolKit.ResponseCodeEnum.failed,status:n=zaionsToolKit.ResponseStatusEnum.failed}=s||{};return p(e,{success:!1,message:o,data:null,errors:t,code:r,status:n})},Q=(e,s)=>{let{message:o=zaionsToolKit.ztkMessages.general.badRequest,errors:t=null,code:r=zaionsToolKit.ResponseCodeEnum.badRequest,status:n=zaionsToolKit.ResponseStatusEnum.badRequest}=s||{};return p(e,{success:!1,message:o,data:null,errors:t,code:r,status:n})},U=(e,s)=>{let{message:o=zaionsToolKit.ztkMessages.general.unAuthenticated,errors:t=null,code:r=zaionsToolKit.ResponseCodeEnum.unAuthenticated,status:n=zaionsToolKit.ResponseStatusEnum.unAuthenticated}=s||{};return p(e,{success:!1,message:o,data:null,errors:t,code:r,status:n})},W=(e,s)=>{let{message:o=zaionsToolKit.ztkMessages.general.unAuthorized,errors:t=null,code:r=zaionsToolKit.ResponseCodeEnum.unAuthorized,status:n=zaionsToolKit.ResponseStatusEnum.unAuthorized}=s||{};return p(e,{success:!1,message:o,data:null,errors:t,code:r,status:n})},Z=(e,s)=>{let{message:o=zaionsToolKit.ztkMessages.general.notFound,errors:t=null,code:r=zaionsToolKit.ResponseCodeEnum.notFound,status:n=zaionsToolKit.ResponseStatusEnum.notFound}=s||{};return p(e,{success:!1,message:o,data:null,errors:t,code:r,status:n})},G=(e,s)=>{let{message:o=zaionsToolKit.ztkMessages.general.tooManyRequests,errors:t=null,code:r=zaionsToolKit.ResponseCodeEnum.tooManyRequests,status:n=zaionsToolKit.ResponseStatusEnum.tooManyRequests}=s||{};return p(e,{success:!1,message:o,data:null,errors:t,code:r,status:n})},J=(e,s)=>{let{message:o=zaionsToolKit.ztkMessages.general.itemExists,errors:t=null,code:r=zaionsToolKit.ResponseCodeEnum.itemExists,status:n=zaionsToolKit.ResponseStatusEnum.itemExists}=s||{};return p(e,{success:!1,message:o,data:null,errors:t,code:r,status:n})};var h=null,k=()=>h,X=e=>{h=w({},e);};var a=k(),y,q,C,b,O=expressRateLimit.rateLimit({windowMs:(y=a==null?void 0:a.windowMs)!=null?y:15*60*1e3,limit:(q=a==null?void 0:a.limit)!=null?q:10,standardHeaders:(C=a==null?void 0:a.standardHeaders)!=null?C:"draft-7",legacyHeaders:(b=a==null?void 0:a.legacyHeaders)!=null?b:!1}),re=(e,{applyCors:s,expressJson:o,expressUrlEncoded:t,applyRateLimiter:r=!0,expressRateLimiter:n})=>{r&&(n?e.use(n):e.use(O)),s&&e.use(F__default.default({origin:!0})),t&&e.use(express.urlencoded()),o&&e.use(express.json());},ae=e=>{e.use("*",(s,o)=>{f(o,{code:zaionsToolKit.ResponseCodeEnum.invalidRequest,status:zaionsToolKit.ResponseStatusEnum.invalidRequest});});};var j=e=>e.formatWith(s=>[s.msg]).mapped(),v=(e,s)=>{let{includeBody:o=!0,includeCookies:t=!1,includeHeaders:r=!1,includeParams:n=!0,includeQuery:c=!0,includeOptionals:R=!0,onlyValidData:g=!0}=s||{},l=[];return o&&l.push("body"),t&&l.push("cookies"),r&&l.push("headers"),n&&l.push("params"),c&&l.push("query"),expressValidator.matchedData(e,{includeOptionals:R,onlyValidData:g,locations:l})},pe=(e,s)=>{let o=expressValidator.validationResult(e);if(o.isEmpty())return v(e);{let t=j(o);return f(s,{errors:t})}};var he=zod.z.object({name:zod.z.string().trim().min(1,{message:"Name is Required."}).max(255),email:zod.z.string().email().max(255),password:zod.z.string().min(6).max(30),passwordConfirmation:zod.z.string().min(6).max(30)}).superRefine((e,s)=>{e.passwordConfirmation!==e.password&&s.addIssue({code:"custom",message:"The passwords did not match",path:["passwordConfirmation"]});}),ke=zod.z.object({email:zod.z.string().email().max(255),password:zod.z.string().min(6).max(30)}); | ||
var S=Object.defineProperty;var x=Object.getOwnPropertySymbols;var A=Object.prototype.hasOwnProperty,M=Object.prototype.propertyIsEnumerable;var E=(e,s,o)=>s in e?S(e,s,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[s]=o,w=(e,s)=>{for(var o in s||(s={}))A.call(s,o)&&E(e,o,s[o]);if(x)for(var o of x(s))M.call(s,o)&&E(e,o,s[o]);return e};var p=(e,s)=>{let{success:o=!0,message:t=zaionsToolKit.ztkMessages.general.success,data:r=null,dataList:n=null,authToken:c=null,errors:R=null,code:g=zaionsToolKit.ResponseCodeEnum.success,status:l=zaionsToolKit.ResponseStatusEnum.success}=s||{};return e.json({success:o,message:t,result:{data:r,dataList:n,authToken:c},errors:R,code:g,status:l})},P=(e,s)=>{let{message:o=zaionsToolKit.ztkMessages.general.success,data:t=null,dataList:r=null,authToken:n=null,code:c=zaionsToolKit.ResponseCodeEnum.success,status:R=zaionsToolKit.ResponseStatusEnum.success}=s||{};return p(e,{success:!0,message:o,data:t,dataList:r,authToken:n,errors:null,code:c,status:R})},f=(e,s)=>{let{message:o=zaionsToolKit.ztkMessages.general.failed,errors:t=null,code:r=zaionsToolKit.ResponseCodeEnum.failed,status:n=zaionsToolKit.ResponseStatusEnum.failed}=s||{};return p(e,{success:!1,message:o,data:null,errors:t,code:r,status:n})},Q=(e,s)=>{let{message:o=zaionsToolKit.ztkMessages.general.badRequest,errors:t=null,code:r=zaionsToolKit.ResponseCodeEnum.badRequest,status:n=zaionsToolKit.ResponseStatusEnum.badRequest}=s||{};return p(e,{success:!1,message:o,data:null,errors:t,code:r,status:n})},U=(e,s)=>{let{message:o=zaionsToolKit.ztkMessages.general.unAuthenticated,errors:t=null,code:r=zaionsToolKit.ResponseCodeEnum.unAuthenticated,status:n=zaionsToolKit.ResponseStatusEnum.unAuthenticated}=s||{};return p(e,{success:!1,message:o,data:null,errors:t,code:r,status:n})},W=(e,s)=>{let{message:o=zaionsToolKit.ztkMessages.general.unAuthorized,errors:t=null,code:r=zaionsToolKit.ResponseCodeEnum.unAuthorized,status:n=zaionsToolKit.ResponseStatusEnum.unAuthorized}=s||{};return p(e,{success:!1,message:o,data:null,errors:t,code:r,status:n})},Z=(e,s)=>{let{message:o=zaionsToolKit.ztkMessages.general.notFound,errors:t=null,code:r=zaionsToolKit.ResponseCodeEnum.notFound,status:n=zaionsToolKit.ResponseStatusEnum.notFound}=s||{};return p(e,{success:!1,message:o,data:null,errors:t,code:r,status:n})},G=(e,s)=>{let{message:o=zaionsToolKit.ztkMessages.general.tooManyRequests,errors:t=null,code:r=zaionsToolKit.ResponseCodeEnum.tooManyRequests,status:n=zaionsToolKit.ResponseStatusEnum.tooManyRequests}=s||{};return p(e,{success:!1,message:o,data:null,errors:t,code:r,status:n})},J=(e,s)=>{let{message:o=zaionsToolKit.ztkMessages.general.itemExists,errors:t=null,code:r=zaionsToolKit.ResponseCodeEnum.itemExists,status:n=zaionsToolKit.ResponseStatusEnum.itemExists}=s||{};return p(e,{success:!1,message:o,data:null,errors:t,code:r,status:n})};var h=null,k=()=>h,X=e=>{h=w({},e);};var a=k(),y,q,C,b,O=expressRateLimit.rateLimit({windowMs:(y=a==null?void 0:a.windowMs)!=null?y:15*60*1e3,limit:(q=a==null?void 0:a.limit)!=null?q:10,standardHeaders:(C=a==null?void 0:a.standardHeaders)!=null?C:"draft-7",legacyHeaders:(b=a==null?void 0:a.legacyHeaders)!=null?b:!1}),re=(e,{applyCors:s,expressJson:o,expressUrlEncoded:t,applyRateLimiter:r=!0,expressRateLimiter:n})=>{r&&(n?e.use(n):e.use(O)),s&&e.use(F__default.default({origin:!0})),t&&e.use(express.urlencoded()),o&&e.use(express.json());},ae=e=>{e.use("*",(s,o)=>{f(o,{code:zaionsToolKit.ResponseCodeEnum.invalidRequest,status:zaionsToolKit.ResponseStatusEnum.invalidRequest});});};var j=e=>e.formatWith(s=>[s.msg]).mapped(),v=(e,s)=>{let{includeBody:o=!0,includeCookies:t=!1,includeHeaders:r=!1,includeParams:n=!0,includeQuery:c=!0,includeOptionals:R=!0,onlyValidData:g=!0}=s||{},l=[];return o&&l.push("body"),t&&l.push("cookies"),r&&l.push("headers"),n&&l.push("params"),c&&l.push("query"),expressValidator.matchedData(e,{includeOptionals:R,onlyValidData:g,locations:l})},pe=(e,s)=>{let o=expressValidator.validationResult(e);if(o.isEmpty())return v(e);{let t=j(o);return f(s,{errors:t})}};var he=zod.z.object({name:zod.z.string().trim().min(1,{message:"Name is Required."}).max(255),email:zod.z.string().email().max(255),password:zod.z.string().min(6).max(30),passwordConfirmation:zod.z.string().min(6).max(30)}).superRefine((e,s)=>{e.passwordConfirmation!==e.password&&s.addIssue({code:"custom",message:"The passwords did not match",path:["passwordConfirmation"]});}),ke=zod.z.object({email:zod.z.string().email().max(255),password:zod.z.string().min(6).max(30)}); | ||
@@ -17,0 +17,0 @@ exports.applyMiddlewaresOnApp = re; |
{ | ||
"name": "zaions-express-tool-kit", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"description": "Zaions Express Tool Kit, this is for expressJs/Typescript projects created by Zaions Dev Team (https://zaions.com), We hope you will love this and all other packages we have developed for you, please do react out if you face any issue in packages we deliver. Once again have fun while working with these packages and let us know your feedback, it keeps us motivated. Have a great day :)", | ||
@@ -5,0 +5,0 @@ "main": "./dist/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
58399