@hookform/resolvers
Advanced tools
Comparing version 2.7.1 to 2.8.0
@@ -1,2 +0,2 @@ | ||
var e=require("fp-ts/lib/Either"),t=require("fp-ts/function"),n=require("@hookform/resolvers"),r=require("io-ts"),i=require("fp-ts/ReadonlyArray"),o=require("fp-ts/Option"),u=require("fp-ts/Either"),a=require("fp-ts/Semigroup"),p=require("fp-ts/ReadonlyRecord");function f(){return(f=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}var s=function(e){return e.reduce(function(e,n,r){return t.pipe(n,u.fold(function(e){return(r>0?".":"")+e},function(e){return"["+e+"]"}),function(t){return""+e+t})},"")},c=function(e){var n,a=t.pipe(n=e.context,i.filterMapWithIndex(function(e,t){var i=e-1;return void 0===n[i]||n[i].type instanceof r.TaggedUnionType||n[i].type instanceof r.UnionType||n[i].type instanceof r.IntersectionType?o.none:o.some(t)}),i.map(function(e){return e.key}),i.map(function(e){return t.pipe(e,function(e){return parseInt(e,10)},u.fromPredicate(t.not(Number.isNaN),function(){return e}))}),i.toArray,s);return{message:t.pipe(e.message,u.fromNullable(e.context),u.mapLeft(t.flow(i.last,o.map(function(e){return"expected "+e.type.name+" but got "+JSON.stringify(e.actual)}),o.getOrElseW(function(){return t.absurd("Error context is missing name")}))),u.getOrElseW(t.identity)),type:t.pipe(e.context,i.last,o.map(function(e){return e.type.name}),o.getOrElse(function(){return"unknown"})),path:a}},l=function(e){return t.pipe(e,i.map(function(e){var t;return(t={})[e.path]={type:e.type,message:e.message},t}),function(e){return a.fold({concat:function(e,t){return Object.assign({},t,e)}})({},e)})},m={concat:function(e,t){var n;return f({},t,{types:f({},e.types,(n={},n[e.type]=e.message,n[t.type]=t.message,n))})}},y=function(e){return t.pipe(p.fromFoldableMap(m,i.Foldable)(e,function(e){return[e.path,e]}),p.map(function(e){return function(e,t){if(null==e)return{};var n,r,i={},o=Object.keys(e);for(r=0;r<o.length;r++)t.indexOf(n=o[r])>=0||(i[n]=e[n]);return i}(e,["path"])}))};exports.ioTsResolver=function(r){return function(o,u,a){return t.pipe(o,r.decode,e.mapLeft((p=!a.shouldUseNativeValidation&&"all"===a.criteriaMode,function(e){var n=p?y:l;return t.pipe(e,i.map(c),n)})),e.mapLeft(function(e){return n.toNestError(e,a)}),e.fold(function(e){return{values:{},errors:e}},function(e){return a.shouldUseNativeValidation&&n.validateFieldsNatively({},a),{values:e,errors:{}}}));var p}}; | ||
var e=require("fp-ts/lib/Either"),t=require("fp-ts/function"),r=require("@hookform/resolvers"),n=require("io-ts"),i=require("fp-ts/ReadonlyArray"),o=require("fp-ts/Option"),u=require("fp-ts/Either"),a=require("fp-ts/Semigroup"),f=require("fp-ts/ReadonlyRecord");function p(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach(function(r){if("default"!==r){var n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})}}),t.default=e,t}var c=p(e),s=p(i),l=p(o),d=p(u),y=p(a),m=p(f);function v(){return(v=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}var g=function(e){return e.reduce(function(e,r,n){return t.pipe(r,d.fold(function(e){return(n>0?".":"")+e},function(e){return"["+e+"]"}),function(t){return""+e+t})},"")},b=["path"],O=function(e){var r,i=t.pipe(r=e.context,s.filterMapWithIndex(function(e,t){var i=e-1;return void 0===r[i]||r[i].type instanceof n.TaggedUnionType||r[i].type instanceof n.UnionType||r[i].type instanceof n.IntersectionType?l.none:l.some(t)}),s.map(function(e){return e.key}),s.map(function(e){return t.pipe(e,function(e){return parseInt(e,10)},d.fromPredicate(t.not(Number.isNaN),function(){return e}))}),s.toArray,g);return{message:t.pipe(e.message,d.fromNullable(e.context),d.mapLeft(t.flow(s.last,l.map(function(e){return"expected "+e.type.name+" but got "+JSON.stringify(e.actual)}),l.getOrElseW(function(){return t.absurd("Error context is missing name")}))),d.getOrElseW(t.identity)),type:t.pipe(e.context,s.last,l.map(function(e){return e.type.name}),l.getOrElse(function(){return"unknown"})),path:i}},h=function(e){return t.pipe(e,s.map(function(e){var t;return(t={})[e.path]={type:e.type,message:e.message},t}),function(e){return y.fold({concat:function(e,t){return Object.assign({},t,e)}})({},e)})},q={concat:function(e,t){var r;return v({},t,{types:v({},e.types,(r={},r[e.type]=e.message,r[t.type]=t.message,r))})}},N=function(e){return t.pipe(m.fromFoldableMap(q,s.Foldable)(e,function(e){return[e.path,e]}),m.map(function(e){return function(e,t){if(null==e)return{};var r,n,i={},o=Object.keys(e);for(n=0;n<o.length;n++)t.indexOf(r=o[n])>=0||(i[r]=e[r]);return i}(e,b)}))};exports.ioTsResolver=function(e){return function(n,i,o){return t.pipe(n,e.decode,c.mapLeft((u=!o.shouldUseNativeValidation&&"all"===o.criteriaMode,function(e){var r=u?N:h;return t.pipe(e,s.map(O),r)})),c.mapLeft(function(e){return r.toNestError(e,o)}),c.fold(function(e){return{values:{},errors:e}},function(e){return o.shouldUseNativeValidation&&r.validateFieldsNatively({},o),{values:e,errors:{}}}));var u}}; | ||
//# sourceMappingURL=io-ts.js.map |
@@ -1,2 +0,2 @@ | ||
import{mapLeft as t,fold as e}from"fp-ts/lib/Either";import{pipe as r,not as o,flow as s,absurd as a,identity as n}from"fp-ts/function";import{toNestError as p,validateFieldsNatively as i}from"@hookform/resolvers";import{TaggedUnionType as m,UnionType as f,IntersectionType as c}from"io-ts";import{map as l,filterMapWithIndex as u,toArray as y,last as d,Foldable as g}from"fp-ts/ReadonlyArray";import{none as h,some as v,map as O,getOrElseW as b,getOrElse as x}from"fp-ts/Option";import{fold as $,fromPredicate as N,fromNullable as j,mapLeft as k,getOrElseW as E}from"fp-ts/Either";import{fold as R}from"fp-ts/Semigroup";import{fromFoldableMap as w,map as S}from"fp-ts/ReadonlyRecord";function U(){return(U=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(t[o]=r[o])}return t}).apply(this,arguments)}const V=t=>t.reduce((t,e,o)=>r(e,$(t=>`${o>0?".":""}${t}`,t=>`[${t}]`),e=>`${t}${e}`),""),A=t=>{const e=r(p=t.context,u((t,e)=>{const r=t-1;return void 0===p[r]||p[r].type instanceof m||p[r].type instanceof f||p[r].type instanceof c?h:v(e)}),l(({key:t})=>t),l(t=>r(t,t=>parseInt(t,10),N(o(Number.isNaN),()=>t))),y,V);var p;return{message:r(t.message,j(t.context),k(s(d,O(t=>`expected ${t.type.name} but got ${JSON.stringify(t.actual)}`),b(()=>a("Error context is missing name")))),E(n)),type:r(t.context,d,O(t=>t.type.name),x(()=>"unknown")),path:e}},I=t=>r(t,l(t=>({[t.path]:{type:t.type,message:t.message}})),t=>R({concat:(t,e)=>Object.assign({},e,t)})({},t)),J={concat:(t,e)=>U({},e,{types:U({},t.types,{[t.type]:t.message,[e.type]:e.message})})},L=t=>r(w(J,g)(t,t=>[t.path,t]),S(t=>function(t,e){if(null==t)return{};var r,o,s={},a=Object.keys(t);for(o=0;o<a.length;o++)e.indexOf(r=a[o])>=0||(s[r]=t[r]);return s}(t,["path"]))),M=o=>(s,a,n)=>{return r(s,o.decode,t((m=!n.shouldUseNativeValidation&&"all"===n.criteriaMode,t=>{const e=m?L:I;return r(t,l(A),e)})),t(t=>p(t,n)),e(t=>({values:{},errors:t}),t=>(n.shouldUseNativeValidation&&i({},n),{values:t,errors:{}})));var m};export{M as ioTsResolver}; | ||
import*as e from"fp-ts/lib/Either";import{pipe as t,not as r,flow as o,absurd as a,identity as s}from"fp-ts/function";import{toNestError as n,validateFieldsNatively as p}from"@hookform/resolvers";import{TaggedUnionType as i,UnionType as m,IntersectionType as f}from"io-ts";import*as l from"fp-ts/ReadonlyArray";import*as c from"fp-ts/Option";import*as u from"fp-ts/Either";import*as y from"fp-ts/Semigroup";import*as d from"fp-ts/ReadonlyRecord";function g(){return(g=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e}).apply(this,arguments)}const h=e=>e.reduce((e,r,o)=>t(r,u.fold(e=>`${o>0?".":""}${e}`,e=>`[${e}]`),t=>`${e}${t}`),""),v=["path"],O=e=>{const n=t(p=e.context,l.filterMapWithIndex((e,t)=>{const r=e-1;return void 0===p[r]||p[r].type instanceof i||p[r].type instanceof m||p[r].type instanceof f?c.none:c.some(t)}),l.map(({key:e})=>e),l.map(e=>t(e,e=>parseInt(e,10),u.fromPredicate(r(Number.isNaN),()=>e))),l.toArray,h);var p;return{message:t(e.message,u.fromNullable(e.context),u.mapLeft(o(l.last,c.map(e=>`expected ${e.type.name} but got ${JSON.stringify(e.actual)}`),c.getOrElseW(()=>a("Error context is missing name")))),u.getOrElseW(s)),type:t(e.context,l.last,c.map(e=>e.type.name),c.getOrElse(()=>"unknown")),path:n}},b=e=>t(e,l.map(e=>({[e.path]:{type:e.type,message:e.message}})),e=>y.fold({concat:(e,t)=>Object.assign({},t,e)})({},e)),x={concat:(e,t)=>g({},t,{types:g({},e.types,{[e.type]:e.message,[t.type]:t.message})})},N=e=>t(d.fromFoldableMap(x,l.Foldable)(e,e=>[e.path,e]),d.map(e=>function(e,t){if(null==e)return{};var r,o,a={},s=Object.keys(e);for(o=0;o<s.length;o++)t.indexOf(r=s[o])>=0||(a[r]=e[r]);return a}(e,v))),$=r=>(o,a,s)=>{return t(o,r.decode,e.mapLeft((i=!s.shouldUseNativeValidation&&"all"===s.criteriaMode,e=>{const r=i?N:b;return t(e,l.map(O),r)})),e.mapLeft(e=>n(e,s)),e.fold(e=>({values:{},errors:e}),e=>(s.shouldUseNativeValidation&&p({},s),{values:e,errors:{}})));var i};export{$ as ioTsResolver}; | ||
//# sourceMappingURL=io-ts.modern.js.map |
@@ -1,2 +0,2 @@ | ||
import{mapLeft as t,fold as n}from"fp-ts/lib/Either";import{pipe as r,not as e,flow as o,absurd as u,identity as i}from"fp-ts/function";import{toNestError as f,validateFieldsNatively as a}from"@hookform/resolvers";import{TaggedUnionType as c,UnionType as s,IntersectionType as p}from"io-ts";import{map as m,filterMapWithIndex as l,toArray as y,last as v,Foldable as d}from"fp-ts/ReadonlyArray";import{none as g,some as h,map as O,getOrElseW as b,getOrElse as x}from"fp-ts/Option";import{fold as N,fromPredicate as j,fromNullable as k,mapLeft as E,getOrElseW as R}from"fp-ts/Either";import{fold as w}from"fp-ts/Semigroup";import{fromFoldableMap as S,map as U}from"fp-ts/ReadonlyRecord";function V(){return(V=Object.assign||function(t){for(var n=1;n<arguments.length;n++){var r=arguments[n];for(var e in r)Object.prototype.hasOwnProperty.call(r,e)&&(t[e]=r[e])}return t}).apply(this,arguments)}var A=function(t){return t.reduce(function(t,n,e){return r(n,N(function(t){return(e>0?".":"")+t},function(t){return"["+t+"]"}),function(n){return""+t+n})},"")},I=function(t){var n,f=r(n=t.context,l(function(t,r){var e=t-1;return void 0===n[e]||n[e].type instanceof c||n[e].type instanceof s||n[e].type instanceof p?g:h(r)}),m(function(t){return t.key}),m(function(t){return r(t,function(t){return parseInt(t,10)},j(e(Number.isNaN),function(){return t}))}),y,A);return{message:r(t.message,k(t.context),E(o(v,O(function(t){return"expected "+t.type.name+" but got "+JSON.stringify(t.actual)}),b(function(){return u("Error context is missing name")}))),R(i)),type:r(t.context,v,O(function(t){return t.type.name}),x(function(){return"unknown"})),path:f}},J=function(t){return r(t,m(function(t){var n;return(n={})[t.path]={type:t.type,message:t.message},n}),function(t){return w({concat:function(t,n){return Object.assign({},n,t)}})({},t)})},L={concat:function(t,n){var r;return V({},n,{types:V({},t.types,(r={},r[t.type]=t.message,r[n.type]=n.message,r))})}},M=function(t){return r(S(L,d)(t,function(t){return[t.path,t]}),U(function(t){return function(t,n){if(null==t)return{};var r,e,o={},u=Object.keys(t);for(e=0;e<u.length;e++)n.indexOf(r=u[e])>=0||(o[r]=t[r]);return o}(t,["path"])}))},P=function(e){return function(o,u,i){return r(o,e.decode,t((c=!i.shouldUseNativeValidation&&"all"===i.criteriaMode,function(t){var n=c?M:J;return r(t,m(I),n)})),t(function(t){return f(t,i)}),n(function(t){return{values:{},errors:t}},function(t){return i.shouldUseNativeValidation&&a({},i),{values:t,errors:{}}}));var c}};export{P as ioTsResolver}; | ||
import*as t from"fp-ts/lib/Either";import{pipe as n,not as r,flow as e,absurd as o,identity as u}from"fp-ts/function";import{toNestError as a,validateFieldsNatively as i}from"@hookform/resolvers";import{TaggedUnionType as f,UnionType as s,IntersectionType as c}from"io-ts";import*as p from"fp-ts/ReadonlyArray";import*as m from"fp-ts/Option";import*as l from"fp-ts/Either";import*as y from"fp-ts/Semigroup";import*as d from"fp-ts/ReadonlyRecord";function g(){return(g=Object.assign||function(t){for(var n=1;n<arguments.length;n++){var r=arguments[n];for(var e in r)Object.prototype.hasOwnProperty.call(r,e)&&(t[e]=r[e])}return t}).apply(this,arguments)}var v=function(t){return t.reduce(function(t,r,e){return n(r,l.fold(function(t){return(e>0?".":"")+t},function(t){return"["+t+"]"}),function(n){return""+t+n})},"")},h=["path"],O=function(t){var a,i=n(a=t.context,p.filterMapWithIndex(function(t,n){var r=t-1;return void 0===a[r]||a[r].type instanceof f||a[r].type instanceof s||a[r].type instanceof c?m.none:m.some(n)}),p.map(function(t){return t.key}),p.map(function(t){return n(t,function(t){return parseInt(t,10)},l.fromPredicate(r(Number.isNaN),function(){return t}))}),p.toArray,v);return{message:n(t.message,l.fromNullable(t.context),l.mapLeft(e(p.last,m.map(function(t){return"expected "+t.type.name+" but got "+JSON.stringify(t.actual)}),m.getOrElseW(function(){return o("Error context is missing name")}))),l.getOrElseW(u)),type:n(t.context,p.last,m.map(function(t){return t.type.name}),m.getOrElse(function(){return"unknown"})),path:i}},b=function(t){return n(t,p.map(function(t){var n;return(n={})[t.path]={type:t.type,message:t.message},n}),function(t){return y.fold({concat:function(t,n){return Object.assign({},n,t)}})({},t)})},x={concat:function(t,n){var r;return g({},n,{types:g({},t.types,(r={},r[t.type]=t.message,r[n.type]=n.message,r))})}},N=function(t){return n(d.fromFoldableMap(x,p.Foldable)(t,function(t){return[t.path,t]}),d.map(function(t){return function(t,n){if(null==t)return{};var r,e,o={},u=Object.keys(t);for(e=0;e<u.length;e++)n.indexOf(r=u[e])>=0||(o[r]=t[r]);return o}(t,h)}))},E=function(r){return function(e,o,u){return n(e,r.decode,t.mapLeft((f=!u.shouldUseNativeValidation&&"all"===u.criteriaMode,function(t){var r=f?N:b;return n(t,p.map(O),r)})),t.mapLeft(function(t){return a(t,u)}),t.fold(function(t){return{values:{},errors:t}},function(t){return u.shouldUseNativeValidation&&i({},u),{values:t,errors:{}}}));var f}};export{E as ioTsResolver}; | ||
//# sourceMappingURL=io-ts.module.js.map |
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("fp-ts/lib/Either"),require("fp-ts/function"),require("@hookform/resolvers"),require("io-ts"),require("fp-ts/ReadonlyArray"),require("fp-ts/Option"),require("fp-ts/Either"),require("fp-ts/Semigroup"),require("fp-ts/ReadonlyRecord")):"function"==typeof define&&define.amd?define(["exports","fp-ts/lib/Either","fp-ts/function","@hookform/resolvers","io-ts","fp-ts/ReadonlyArray","fp-ts/Option","fp-ts/Either","fp-ts/Semigroup","fp-ts/ReadonlyRecord"],t):t((e||self).hookformResolversIoTs={},e.Either$1,e._function,e.hookformResolvers,e.ioTs,e.ReadonlyArray,e.Option,e.Either,e.SemiGroup,e.ReadonlyRecord)}(this,function(e,t,n,r,o,i,u,f,a,p){function s(){return(s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}var c=function(e){return e.reduce(function(e,t,r){return n.pipe(t,f.fold(function(e){return(r>0?".":"")+e},function(e){return"["+e+"]"}),function(t){return""+e+t})},"")},l=function(e){var t,r=n.pipe(t=e.context,i.filterMapWithIndex(function(e,n){var r=e-1;return void 0===t[r]||t[r].type instanceof o.TaggedUnionType||t[r].type instanceof o.UnionType||t[r].type instanceof o.IntersectionType?u.none:u.some(n)}),i.map(function(e){return e.key}),i.map(function(e){return n.pipe(e,function(e){return parseInt(e,10)},f.fromPredicate(n.not(Number.isNaN),function(){return e}))}),i.toArray,c);return{message:n.pipe(e.message,f.fromNullable(e.context),f.mapLeft(n.flow(i.last,u.map(function(e){return"expected "+e.type.name+" but got "+JSON.stringify(e.actual)}),u.getOrElseW(function(){return n.absurd("Error context is missing name")}))),f.getOrElseW(n.identity)),type:n.pipe(e.context,i.last,u.map(function(e){return e.type.name}),u.getOrElse(function(){return"unknown"})),path:r}},d=function(e){return n.pipe(e,i.map(function(e){var t;return(t={})[e.path]={type:e.type,message:e.message},t}),function(e){return a.fold({concat:function(e,t){return Object.assign({},t,e)}})({},e)})},y={concat:function(e,t){var n;return s({},t,{types:s({},e.types,(n={},n[e.type]=e.message,n[t.type]=t.message,n))})}},m=function(e){return n.pipe(p.fromFoldableMap(y,i.Foldable)(e,function(e){return[e.path,e]}),p.map(function(e){return function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)t.indexOf(n=i[r])>=0||(o[n]=e[n]);return o}(e,["path"])}))};e.ioTsResolver=function(e){return function(o,u,f){return n.pipe(o,e.decode,t.mapLeft((a=!f.shouldUseNativeValidation&&"all"===f.criteriaMode,function(e){var t=a?m:d;return n.pipe(e,i.map(l),t)})),t.mapLeft(function(e){return r.toNestError(e,f)}),t.fold(function(e){return{values:{},errors:e}},function(e){return f.shouldUseNativeValidation&&r.validateFieldsNatively({},f),{values:e,errors:{}}}));var a}}}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("fp-ts/lib/Either"),require("fp-ts/function"),require("@hookform/resolvers"),require("io-ts"),require("fp-ts/ReadonlyArray"),require("fp-ts/Option"),require("fp-ts/Either"),require("fp-ts/Semigroup"),require("fp-ts/ReadonlyRecord")):"function"==typeof define&&define.amd?define(["exports","fp-ts/lib/Either","fp-ts/function","@hookform/resolvers","io-ts","fp-ts/ReadonlyArray","fp-ts/Option","fp-ts/Either","fp-ts/Semigroup","fp-ts/ReadonlyRecord"],t):t((e||self).hookformResolversIoTs={},e.Either$1,e._function,e.hookformResolvers,e.ioTs,e.ReadonlyArray,e.Option,e.Either,e.SemiGroup,e.ReadonlyRecord)}(this,function(e,t,r,n,o,i,u,f,a,p){function s(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach(function(r){if("default"!==r){var n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})}}),t.default=e,t}var c=s(t),l=s(i),d=s(u),y=s(f),m=s(a),v=s(p);function g(){return(g=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}var h=function(e){return e.reduce(function(e,t,n){return r.pipe(t,y.fold(function(e){return(n>0?".":"")+e},function(e){return"["+e+"]"}),function(t){return""+e+t})},"")},b=["path"],O=function(e){var t,n=r.pipe(t=e.context,l.filterMapWithIndex(function(e,r){var n=e-1;return void 0===t[n]||t[n].type instanceof o.TaggedUnionType||t[n].type instanceof o.UnionType||t[n].type instanceof o.IntersectionType?d.none:d.some(r)}),l.map(function(e){return e.key}),l.map(function(e){return r.pipe(e,function(e){return parseInt(e,10)},y.fromPredicate(r.not(Number.isNaN),function(){return e}))}),l.toArray,h);return{message:r.pipe(e.message,y.fromNullable(e.context),y.mapLeft(r.flow(l.last,d.map(function(e){return"expected "+e.type.name+" but got "+JSON.stringify(e.actual)}),d.getOrElseW(function(){return r.absurd("Error context is missing name")}))),y.getOrElseW(r.identity)),type:r.pipe(e.context,l.last,d.map(function(e){return e.type.name}),d.getOrElse(function(){return"unknown"})),path:n}},E=function(e){return r.pipe(e,l.map(function(e){var t;return(t={})[e.path]={type:e.type,message:e.message},t}),function(e){return m.fold({concat:function(e,t){return Object.assign({},t,e)}})({},e)})},R={concat:function(e,t){var r;return g({},t,{types:g({},e.types,(r={},r[e.type]=e.message,r[t.type]=t.message,r))})}},x=function(e){return r.pipe(v.fromFoldableMap(R,l.Foldable)(e,function(e){return[e.path,e]}),v.map(function(e){return function(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)t.indexOf(r=i[n])>=0||(o[r]=e[r]);return o}(e,b)}))};e.ioTsResolver=function(e){return function(t,o,i){return r.pipe(t,e.decode,c.mapLeft((u=!i.shouldUseNativeValidation&&"all"===i.criteriaMode,function(e){var t=u?x:E;return r.pipe(e,l.map(O),t)})),c.mapLeft(function(e){return n.toNestError(e,i)}),c.fold(function(e){return{values:{},errors:e}},function(e){return i.shouldUseNativeValidation&&n.validateFieldsNatively({},i),{values:e,errors:{}}}));var u}}}); | ||
//# sourceMappingURL=io-ts.umd.js.map |
{ | ||
"name": "@hookform/resolvers", | ||
"amdName": "hookformResolvers", | ||
"version": "2.7.1", | ||
"version": "2.8.0", | ||
"description": "React Hook Form validation resolvers: Yup, Joi, Superstruct, Zod, Vest, Class Validator, io-ts, Nope, computed-types and Typanion", | ||
@@ -168,6 +168,6 @@ "main": "dist/resolvers.js", | ||
"@testing-library/jest-dom": "^5.12.0", | ||
"@testing-library/react": "^11.2.7", | ||
"@testing-library/user-event": "^13.1.9", | ||
"@types/jest": "^26.0.23", | ||
"@types/react": "^17.0.8", | ||
"@testing-library/react": "^12.0.0", | ||
"@testing-library/user-event": "^13.2.1", | ||
"@types/jest": "^27.0.0", | ||
"@types/react": "^17.0.17", | ||
"@typescript-eslint/eslint-plugin": "^4.25.0", | ||
@@ -181,10 +181,10 @@ "@typescript-eslint/parser": "^4.25.0", | ||
"eslint-config-prettier": "^8.3.0", | ||
"fp-ts": "^2.10.5", | ||
"husky": "^6.0.0", | ||
"fp-ts": "^2.11.1", | ||
"husky": "^7.0.1", | ||
"io-ts": "^2.0.0", | ||
"io-ts-types": "^0.5.16", | ||
"jest": "^27.0.3", | ||
"joi": "^17.4.0", | ||
"lint-staged": "^11.0.0", | ||
"microbundle": "^0.13.1", | ||
"jest": "^27.0.6", | ||
"joi": "^17.4.2", | ||
"lint-staged": "^11.1.2", | ||
"microbundle": "^0.13.3", | ||
"monocle-ts": "^2.3.10", | ||
@@ -194,14 +194,14 @@ "newtype-ts": "^0.3.4", | ||
"npm-run-all": "^4.1.5", | ||
"prettier": "^2.3.0", | ||
"prettier": "^2.3.2", | ||
"react": "^17.0.2", | ||
"react-dom": "^17.0.2", | ||
"react-hook-form": "7.8.4-beta.0", | ||
"react-hook-form": "7.12.2", | ||
"reflect-metadata": "^0.1.13", | ||
"superstruct": "^0.15.2", | ||
"ts-jest": "^27.0.1", | ||
"ts-jest": "^27.0.4", | ||
"typanion": "^3.3.2", | ||
"typescript": "^4.3.2", | ||
"vest": "^3.2.3", | ||
"vest": "^3.2.5", | ||
"yup": "^0.32.9", | ||
"zod": "^1.11.17" | ||
"zod": "^3.7.1" | ||
}, | ||
@@ -208,0 +208,0 @@ "peerDependencies": { |
@@ -25,3 +25,3 @@ <div align="center"> | ||
- [React-hook-form validation resolver documentation ](https://react-hook-form.com/api/useform/#validationResolver) | ||
- [React-hook-form validation resolver documentation ](https://react-hook-form.com/api/useform/#resolver) | ||
@@ -372,3 +372,6 @@ ## API | ||
username: t.applyCascade(t.isString(), [t.hasMinLength(1)]), | ||
age: t.applyCascade(t.isNumber(), [t.isInteger(), t.isInInclusiveRange(1, 100)]), | ||
age: t.applyCascade(t.isNumber(), [ | ||
t.isInteger(), | ||
t.isInInclusiveRange(1, 100), | ||
]), | ||
}); | ||
@@ -375,0 +378,0 @@ |
import { FieldValues, ResolverResult, UnpackNestedValue, ResolverOptions } from 'react-hook-form'; | ||
import * as z from 'zod'; | ||
import type { ParseParams } from 'zod/lib/src/parser'; | ||
export declare type Resolver = <T extends z.ZodSchema<any, any>>(schema: T, schemaOptions?: ParseParams, factoryOptions?: { | ||
import { z } from 'zod'; | ||
export declare type Resolver = <T extends z.Schema<any, any>>(schema: T, schemaOptions?: Partial<z.ParseParamsNoData>, factoryOptions?: { | ||
mode?: 'async' | 'sync'; | ||
}) => <TFieldValues extends FieldValues, TContext>(values: UnpackNestedValue<TFieldValues>, context: TContext | undefined, options: ResolverOptions<TFieldValues>) => Promise<ResolverResult<TFieldValues>>; |
import { Field, InternalFieldName } from 'react-hook-form'; | ||
import * as z from 'zod'; | ||
import { z } from 'zod'; | ||
@@ -33,5 +33,5 @@ export const schema = z | ||
}) | ||
.refine((data) => data.password === data.repeatPassword, { | ||
message: "Passwords don't match", | ||
path: ['confirm'], // set path of error | ||
.refine((obj) => obj.password === obj.repeatPassword, { | ||
message: 'Passwords do not match', | ||
path: ['confirm'], | ||
}); | ||
@@ -38,0 +38,0 @@ |
@@ -64,3 +64,3 @@ import { zodResolver } from '..'; | ||
it('should return all the errors from zodResolver when validation fails with `validateAllFieldCriteria` set to true and `mode: sync`', async () => { | ||
it.only('should return all the errors from zodResolver when validation fails with `validateAllFieldCriteria` set to true and `mode: sync`', async () => { | ||
const result = await zodResolver(schema, undefined, { mode: 'sync' })( | ||
@@ -67,0 +67,0 @@ invalidData, |
@@ -7,8 +7,7 @@ import { | ||
} from 'react-hook-form'; | ||
import * as z from 'zod'; | ||
import type { ParseParams } from 'zod/lib/src/parser'; | ||
import { z } from 'zod'; | ||
export type Resolver = <T extends z.ZodSchema<any, any>>( | ||
export type Resolver = <T extends z.Schema<any, any>>( | ||
schema: T, | ||
schemaOptions?: ParseParams, | ||
schemaOptions?: Partial<z.ParseParamsNoData>, | ||
factoryOptions?: { mode?: 'async' | 'sync' }, | ||
@@ -15,0 +14,0 @@ ) => <TFieldValues extends FieldValues, TContext>( |
import { appendErrors, FieldError } from 'react-hook-form'; | ||
import * as z from 'zod'; | ||
import { z } from 'zod'; | ||
import { toNestError, validateFieldsNatively } from '@hookform/resolvers'; | ||
@@ -7,3 +7,3 @@ import type { Resolver } from './types'; | ||
const parseErrorSchema = ( | ||
zodErrors: z.ZodSuberror[], | ||
zodErrors: z.ZodIssue[], | ||
validateAllFieldCriteria: boolean, | ||
@@ -10,0 +10,0 @@ ) => { |
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
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
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
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
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
421
372470
227
3633