@stacksjs/validation 0.74.34 → 0.74.35
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/index.js +1 -1
- package/package.json +7 -7
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{v as x}from"@stacksjs/ts-validation";var E=new Set(["image/jpeg","image/png","image/webp","image/gif","image/avif"]);function T(e){return e.mimetype??e.mimeType}function M(e){return e.originalName??e.name}function N(e){let t=M(e);if(!t)return null;let n=t.lastIndexOf(".");if(n<=0||n===t.length-1)return null;let r=t.slice(n+1).toLowerCase();return/^[a-z0-9]+$/.test(r)?r:null}class R{_required=!1;_rules=[];required(){return this._required=!0,this}image(){return this._rules.push((e)=>{let t=T(e);if(!t||!E.has(t.toLowerCase()))return`must be an image (got ${t||"no mimetype"})`;return null}),this}mimeTypes(e){let t=new Set(e.map((n)=>n.toLowerCase()));return this._rules.push((n)=>{let r=T(n);if(!r||!t.has(r.toLowerCase()))return`must be one of: ${e.join(", ")} (got ${r||"no mimetype"})`;return null}),this}maxBytes(e){return this._rules.push((t)=>{if(typeof t.size!=="number")return"has no size - cannot enforce maxBytes";if(t.size>e)return`is too large: ${t.size} bytes exceeds the ${e}-byte cap`;return null}),this}minBytes(e){return this._rules.push((t)=>{if(typeof t.size!=="number")return"has no size - cannot enforce minBytes";if(t.size<e)return`is too small: ${t.size} bytes is below the ${e}-byte minimum`;return null}),this}extensions(e){let t=new Set(e.map((n)=>n.toLowerCase().replace(/^\./,"")));return this._rules.push((n)=>{let r=N(n);if(!r||!t.has(r))return`must have one of these extensions: ${e.join(", ")} (got ${r?`.${r}`:"no extension"})`;return null}),this}custom(e){return this._rules.push(e),this}validate(e){if(e===null||e===void 0){if(this._required)return{valid:!1,errors:[{message:"is required"}]};return{valid:!0}}if(typeof e!=="object"||typeof e.size!=="number")return{valid:!1,errors:[{message:"must be an uploaded file"}]};let t=e,n=[];for(let r of this._rules){let a=r(t);if(a)n.push({message:a})}return n.length===0?{valid:!0}:{valid:!1,errors:n}}}function O(){return new R}function m(e){let t=e;return t.when=function(r,a,i){if(!this.__conditionals)this.__conditionals=[];return this.__conditionals.push({field:r,match:a,refine:i}),this},t.sometimes=function(){return this.optional(),this},t}function w(e,t){if(t===null||t===void 0)return!1;let n=t[e.field];if(typeof e.match==="function")return e.match(n);return n===e.match}function h(e,t){let n=e.__conditionals;if(!n||n.length===0)return e;let r=null;for(let a of n){if(!w(a,t))continue;if(r===null)r=W(e);r=a.refine(r)}return r??e}function W(e){let t=Object.create(Object.getPrototypeOf(e));Object.assign(t,e);let n=e.rules;if(Array.isArray(n))t.rules=n.slice();return t}function V(e){let t=e??{},n=!0,r={name:"object",get isRequired(){return n},getRules:()=>[],test(i){return this.validate(i).valid},isPartOfShape:!1,shape(i){return t=i,r},getShape(){return t},required(){return n=!0,a},optional(){return n=!1,a},validate(i){let o=i===void 0||i===null;if(!n&&o)return{valid:!0,errors:this.isPartOfShape?{}:[]};if(n&&o)return this.isPartOfShape?{valid:!1,errors:{object:[{message:"value is required"}]}}:{valid:!1,errors:[{message:"value is required"}]};if(typeof i!=="object"||Array.isArray(i))return this.isPartOfShape?{valid:!1,errors:{object:[{message:"Must be an object"}]}}:{valid:!1,errors:[{message:"Must be an object"}]};let s=i,l={},u=!1;for(let d of Object.keys(t)){let c=t[d];if(!c)continue;let g=h(c,s),b=s[d],y=g.validate(b);if(y.valid)continue;if(u=!0,!Array.isArray(y.errors))for(let[P,q]of Object.entries(y.errors))l[`${d}.${P}`]=q;else l[d]=y.errors}if(u)return{valid:!1,errors:l};return{valid:!0,errors:{}}}},a=m(r);return a}var _=new Set(["array","bigint","binary","blob","boolean","custom","date","datetime","decimal","double","enum","float","integer","json","number","password","smallint","string","text","time","timestamp","timestampTz","unix"]);function L(e){if(e instanceof Date)return!Number.isNaN(e.getTime());if(typeof e!=="string"||!/^\d{4}-\d{2}-\d{2}$/.test(e))return!1;let t=new Date(`${e}T00:00:00.000Z`);return!Number.isNaN(t.getTime())&&t.toISOString().slice(0,10)===e}function z(){let e=x.custom(L,"Must be a valid date");return e.name="date",m(e)}var B=/^\d{4}-\d{2}-\d{2}[ T]\d{2}:\d{2}:\d{2}(?:\.\d+)?$/;function D(e){if(e instanceof Date)return!Number.isNaN(e.getTime());if(typeof e==="number")return Number.isFinite(e)&&e>=0;if(typeof e!=="string")return!1;let t=e.trim();if(!t)return!1;if(/^\d+$/.test(t))return!0;if(B.test(t))return!Number.isNaN(new Date(t.replace(" ","T")).getTime());return!Number.isNaN(new Date(t).getTime())}function K(){let e=x.custom(D,"Must be a valid timestamp");return e.name="timestamp",m(e)}function U(e){return(...t)=>{let n=e(...t);return m(n)}}var p=new Proxy(x,{get(e,t,n){if(t==="file")return O;if(t==="object")return V;if(t==="date")return z;if(t==="timestamp")return K;if(typeof t==="string"&&_.has(t)){let r=Reflect.get(e,t,n);if(typeof r==="function")return U(r)}return Reflect.get(e,t,n)}});export*from"@stacksjs/ts-validation";var C=[];function v(e){C=e}function fe(){return C}import{HttpError as f}from"@stacksjs/error-handling";import{path as A}from"@stacksjs/path";import{snakeCase as Y}from"@stacksjs/strings";import{getErrorMessage as k}from"@stacksjs/utils";import{MessageProvider as S,setCustomMessages as I}from"@stacksjs/ts-validation";function G(e,t={}){let n=[];for(let r of e){let i=r.startsWith("/")?r.lastIndexOf("/"):-1,o=r.indexOf("*"),s=o===-1?i:r.lastIndexOf("/",o),l=s>0?r.slice(0,s):".",u=s>0?r.slice(s+1):r,d=new Bun.Glob(u);for(let c of d.scanSync({cwd:l,onlyFiles:!0}))n.push(t.absolute?`${l}/${c}`:c)}return n}function xe(e){if(e===void 0)return!1;return Object.keys(e).length>0}function H(e,t){let n=(r)=>{let a=t[r];return a===void 0||a===null?"":String(a)};if(Array.isArray(e))return e.map((r)=>({message:r.message,value:"",field:""}));return Object.entries(e).flatMap(([r,a])=>a.map((i)=>({message:i.message,value:n(r),field:r})))}async function Q(e,t){let r=G([A.userModelsPath("*.ts"),A.storagePath("framework/defaults/app/Models/**/*.ts")],{absolute:!0}).find((l)=>l.endsWith(`${e}.ts`));if(!r)throw new f(404,`Model ${e} not found`);let i=(await import(r)).default.attributes,o={},s={};for(let l in i)if(Object.prototype.hasOwnProperty.call(i,l)){let u=i[l];if(!u)continue;let d="isRequired"in(u.validation?.rule??{})?(u.validation?.rule).isRequired:!1;if(u.default!==void 0&&d===!1)continue;o[Y(l)]=u.validation?.rule;let c=u.validation?.message;if(c)for(let g in c){let b=`${l}.${g}`;s[b]=c[g]||""}}try{I(new S(s));let u=await p.object(o).validate(t);if(!u.valid)throw v(H(u.errors,t)),new f(422,"Validation failed",{errors:u.errors});return u}catch(l){if(j(l))throw l;throw new f(500,k(l)||"An unexpected validation error occurred")}}var F=new Map;function ke(e,t){F.set(e,t)}function je(e){return F.get(e)}function Te(e,t,n){return async(r)=>{try{let{db:a}=await import("@stacksjs/database"),i=a.selectFrom(e).where(t,"=",r);if(n)i=i.where("id","!=",n);return await i.selectAll().executeTakeFirst()?`The ${t} has already been taken`:!0}catch{return!0}}}function Re(e,t){return async(n)=>{try{let{db:r}=await import("@stacksjs/database");return await r.selectFrom(e).where(t,"=",n).selectAll().executeTakeFirst()?!0:`The selected ${t} does not exist`}catch{return!0}}}async function Oe(e,t,n){let r=await Q(e,t);if(n&&Object.keys(n).length>0){let a={};if(await Promise.all(Object.entries(n).map(async([i,o])=>{let s=await o(t[i],t);if(s!==!0)a[i]=typeof s==="string"?s:`${i} validation failed`})),Object.keys(a).length>0)throw new f(422,"Validation failed",{errors:a})}return r}async function Z(e){if(!e||typeof e!=="object")return{};if(typeof e.all==="function"){let r=e.all();return r instanceof Promise?await r:r}let t=e,n={};if(t.url)try{new URL(t.url).searchParams.forEach((a,i)=>{n[i]=a})}catch{}if(t.query&&typeof t.query==="object")Object.assign(n,t.query);if(t.jsonBody&&typeof t.jsonBody==="object")Object.assign(n,t.jsonBody);if(t.formBody&&typeof t.formBody==="object")Object.assign(n,t.formBody);if(t.params&&typeof t.params==="object")Object.assign(n,t.params);if(Object.keys(n).length===0&&!("all"in e)&&!("jsonBody"in e))return e;return n}async function Ce(e,t){let n=await Z(e),r={},a={};for(let[i,o]of Object.entries(t)){if(!o)continue;if(typeof o.rule==="object"||typeof o.rule==="function"){r[i]=o.rule;let s=o.message;if(typeof s==="string")a[`${i}.default`]=s;else if(s&&typeof s==="object")for(let[l,u]of Object.entries(s))a[`${i}.${l}`]=u}else r[i]=o}try{if(Object.keys(a).length>0)I(new S(a));let o=await p.object(r).validate(n);if(!o.valid){let l=J(o.errors);throw new f(422,"Validation failed",{errors:l})}return o.value??n}catch(i){if(j(i))throw i;throw new f(500,k(i)||"An unexpected validation error occurred")}}async function ve(e,t){let n={},r={};for(let a in e)if(Object.prototype.hasOwnProperty.call(e,a)){let i=e[a]?.rule;if(i)n[a]=i;let o=e[a]?.message;for(let s in o){let l=`${a}.${s}`;r[l]=e[a]?.message[s]||""}}try{let i=await p.object().shape(n).validate(t);if(!i.valid)throw new f(422,"Validation failed",{errors:i.errors});return i}catch(a){if(j(a))throw a;throw new f(500,k(a)||"An unexpected validation error occurred")}}function j(e){return e instanceof f||e instanceof Error&&typeof e.status==="number"}function J(e){let t={};if(Array.isArray(e)){for(let n of e){if(!n||typeof n!=="object")continue;let r=typeof n.field==="string"?n.field:"_",a=typeof n.message==="string"?n.message:"Validation failed";(t[r]??=[]).push(a)}return t}if(!e||typeof e!=="object")return t;for(let[n,r]of Object.entries(e)){let a=Array.isArray(r)?r:[r];for(let i of a){let o=typeof i==="string"?i:i&&typeof i==="object"&&typeof i.message==="string"?i.message:"Validation failed";(t[n]??=[]).push(o)}}return t}function Se(e){return typeof e==="string"}function Ie(e){return typeof e==="number"&&!Number.isNaN(e)}function Fe(e){return typeof e==="boolean"}function Pe(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function qe(e){return Array.isArray(e)}function Ee(e){return typeof e==="function"}function Me(e){return e===void 0}function Ne(e){return e===null}function $e(e){return e===null||e===void 0}export{h as applyConditionals,ve as customValidate,Re as exists,je as getCustomRule,fe as getErrors,qe as isArray,Fe as isBoolean,Ee as isFunction,Ne as isNull,$e as isNullOrUndefined,Ie as isNumber,Pe as isObject,xe as isObjectNotEmpty,Se as isString,Me as isUndefined,V as objectWithContext,ke as registerRule,v as reportError,p as schema,w as shouldApplyConditional,Te as unique,Ce as validate,Q as validateField,Oe as validateFieldAsync,m as withConditionals};
|
|
2
|
+
var T=import.meta.require;import{v as x}from"@stacksjs/ts-validation";var M=new Set(["image/jpeg","image/png","image/webp","image/gif","image/avif"]);function R(e){return e.mimetype??e.mimeType}function N(e){return e.originalName??e.name}function W(e){let t=N(e);if(!t)return null;let n=t.lastIndexOf(".");if(n<=0||n===t.length-1)return null;let r=t.slice(n+1).toLowerCase();return/^[a-z0-9]+$/.test(r)?r:null}class O{_required=!1;_rules=[];required(){return this._required=!0,this}image(){return this._rules.push((e)=>{let t=R(e);if(!t||!M.has(t.toLowerCase()))return`must be an image (got ${t||"no mimetype"})`;return null}),this}mimeTypes(e){let t=new Set(e.map((n)=>n.toLowerCase()));return this._rules.push((n)=>{let r=R(n);if(!r||!t.has(r.toLowerCase()))return`must be one of: ${e.join(", ")} (got ${r||"no mimetype"})`;return null}),this}maxBytes(e){return this._rules.push((t)=>{if(typeof t.size!=="number")return"has no size - cannot enforce maxBytes";if(t.size>e)return`is too large: ${t.size} bytes exceeds the ${e}-byte cap`;return null}),this}minBytes(e){return this._rules.push((t)=>{if(typeof t.size!=="number")return"has no size - cannot enforce minBytes";if(t.size<e)return`is too small: ${t.size} bytes is below the ${e}-byte minimum`;return null}),this}extensions(e){let t=new Set(e.map((n)=>n.toLowerCase().replace(/^\./,"")));return this._rules.push((n)=>{let r=W(n);if(!r||!t.has(r))return`must have one of these extensions: ${e.join(", ")} (got ${r?`.${r}`:"no extension"})`;return null}),this}custom(e){return this._rules.push(e),this}validate(e){if(e===null||e===void 0){if(this._required)return{valid:!1,errors:[{message:"is required"}]};return{valid:!0}}if(typeof e!=="object"||typeof e.size!=="number")return{valid:!1,errors:[{message:"must be an uploaded file"}]};let t=e,n=[];for(let r of this._rules){let a=r(t);if(a)n.push({message:a})}return n.length===0?{valid:!0}:{valid:!1,errors:n}}}function C(){return new O}function m(e){let t=e;return t.when=function(r,a,i){if(!this.__conditionals)this.__conditionals=[];return this.__conditionals.push({field:r,match:a,refine:i}),this},t.sometimes=function(){return this.optional(),this},t}function w(e,t){if(t===null||t===void 0)return!1;let n=t[e.field];if(typeof e.match==="function")return e.match(n);return n===e.match}function h(e,t){let n=e.__conditionals;if(!n||n.length===0)return e;let r=null;for(let a of n){if(!w(a,t))continue;if(r===null)r=_(e);r=a.refine(r)}return r??e}function _(e){let t=Object.create(Object.getPrototypeOf(e));Object.assign(t,e);let n=e.rules;if(Array.isArray(n))t.rules=n.slice();return t}function V(e){let t=e??{},n=!0,r={name:"object",get isRequired(){return n},getRules:()=>[],test(i){return this.validate(i).valid},isPartOfShape:!1,shape(i){return t=i,r},getShape(){return t},required(){return n=!0,a},optional(){return n=!1,a},validate(i){let o=i===void 0||i===null;if(!n&&o)return{valid:!0,errors:this.isPartOfShape?{}:[]};if(n&&o)return this.isPartOfShape?{valid:!1,errors:{object:[{message:"value is required"}]}}:{valid:!1,errors:[{message:"value is required"}]};if(typeof i!=="object"||Array.isArray(i))return this.isPartOfShape?{valid:!1,errors:{object:[{message:"Must be an object"}]}}:{valid:!1,errors:[{message:"Must be an object"}]};let s=i,l={},u=!1;for(let d of Object.keys(t)){let c=t[d];if(!c)continue;let g=h(c,s),b=s[d],y=g.validate(b);if(y.valid)continue;if(u=!0,!Array.isArray(y.errors))for(let[q,E]of Object.entries(y.errors))l[`${d}.${q}`]=E;else l[d]=y.errors}if(u)return{valid:!1,errors:l};return{valid:!0,errors:{}}}},a=m(r);return a}var L=new Set(["array","bigint","binary","blob","boolean","custom","date","datetime","decimal","double","enum","float","integer","json","number","password","smallint","string","text","time","timestamp","timestampTz","unix"]);function z(e){if(e instanceof Date)return!Number.isNaN(e.getTime());if(typeof e!=="string"||!/^\d{4}-\d{2}-\d{2}$/.test(e))return!1;let t=new Date(`${e}T00:00:00.000Z`);return!Number.isNaN(t.getTime())&&t.toISOString().slice(0,10)===e}function B(){let e=x.custom(z,"Must be a valid date");return e.name="date",m(e)}var D=/^\d{4}-\d{2}-\d{2}[ T]\d{2}:\d{2}:\d{2}(?:\.\d+)?$/;function K(e){if(e instanceof Date)return!Number.isNaN(e.getTime());if(typeof e==="number")return Number.isFinite(e)&&e>=0;if(typeof e!=="string")return!1;let t=e.trim();if(!t)return!1;if(/^\d+$/.test(t))return!0;if(D.test(t))return!Number.isNaN(new Date(t.replace(" ","T")).getTime());return!Number.isNaN(new Date(t).getTime())}function U(){let e=x.custom(K,"Must be a valid timestamp");return e.name="timestamp",m(e)}function Y(e){return(...t)=>{let n=e(...t);return m(n)}}var p=new Proxy(x,{get(e,t,n){if(t==="file")return C;if(t==="object")return V;if(t==="date")return B;if(t==="timestamp")return U;if(typeof t==="string"&&L.has(t)){let r=Reflect.get(e,t,n);if(typeof r==="function")return Y(r)}return Reflect.get(e,t,n)}});export*from"@stacksjs/ts-validation";var v=[];function A(e){v=e}function pe(){return v}import{HttpError as f}from"@stacksjs/error-handling";import{path as S}from"@stacksjs/path";import{snakeCase as G}from"@stacksjs/strings";import{getErrorMessage as k}from"@stacksjs/utils";import{MessageProvider as I,setCustomMessages as F}from"@stacksjs/ts-validation";function H(e,t={}){let n=[];for(let r of e){let i=r.startsWith("/")?r.lastIndexOf("/"):-1,o=r.indexOf("*"),s=o===-1?i:r.lastIndexOf("/",o),l=s>0?r.slice(0,s):".",u=s>0?r.slice(s+1):r,d=new Bun.Glob(u);for(let c of d.scanSync({cwd:l,onlyFiles:!0}))n.push(t.absolute?`${l}/${c}`:c)}return n}function je(e){if(e===void 0)return!1;return Object.keys(e).length>0}function Q(e,t){let n=(r)=>{let a=t[r];return a===void 0||a===null?"":String(a)};if(Array.isArray(e))return e.map((r)=>({message:r.message,value:"",field:""}));return Object.entries(e).flatMap(([r,a])=>a.map((i)=>({message:i.message,value:n(r),field:r})))}async function Z(e,t){let r=H([S.userModelsPath("*.ts"),S.storagePath("framework/defaults/app/Models/**/*.ts")],{absolute:!0}).find((l)=>l.endsWith(`${e}.ts`));if(!r)throw new f(404,`Model ${e} not found`);let i=(await import(r)).default.attributes,o={},s={};for(let l in i)if(Object.prototype.hasOwnProperty.call(i,l)){let u=i[l];if(!u)continue;let d="isRequired"in(u.validation?.rule??{})?(u.validation?.rule).isRequired:!1;if(u.default!==void 0&&d===!1)continue;o[G(l)]=u.validation?.rule;let c=u.validation?.message;if(c)for(let g in c){let b=`${l}.${g}`;s[b]=c[g]||""}}try{F(new I(s));let u=await p.object(o).validate(t);if(!u.valid)throw A(Q(u.errors,t)),new f(422,"Validation failed",{errors:u.errors});return u}catch(l){if(j(l))throw l;throw new f(500,k(l)||"An unexpected validation error occurred")}}var P=new Map;function Te(e,t){P.set(e,t)}function Re(e){return P.get(e)}function Oe(e,t,n){return async(r)=>{try{let{db:a}=await import("@stacksjs/database"),i=a.selectFrom(e).where(t,"=",r);if(n)i=i.where("id","!=",n);return await i.selectAll().executeTakeFirst()?`The ${t} has already been taken`:!0}catch{return!0}}}function Ce(e,t){return async(n)=>{try{let{db:r}=await import("@stacksjs/database");return await r.selectFrom(e).where(t,"=",n).selectAll().executeTakeFirst()?!0:`The selected ${t} does not exist`}catch{return!0}}}async function ve(e,t,n){let r=await Z(e,t);if(n&&Object.keys(n).length>0){let a={};if(await Promise.all(Object.entries(n).map(async([i,o])=>{let s=await o(t[i],t);if(s!==!0)a[i]=typeof s==="string"?s:`${i} validation failed`})),Object.keys(a).length>0)throw new f(422,"Validation failed",{errors:a})}return r}async function J(e){if(!e||typeof e!=="object")return{};if(typeof e.all==="function"){let r=e.all();return r instanceof Promise?await r:r}let t=e,n={};if(t.url)try{new URL(t.url).searchParams.forEach((a,i)=>{n[i]=a})}catch{}if(t.query&&typeof t.query==="object")Object.assign(n,t.query);if(t.jsonBody&&typeof t.jsonBody==="object")Object.assign(n,t.jsonBody);if(t.formBody&&typeof t.formBody==="object")Object.assign(n,t.formBody);if(t.params&&typeof t.params==="object")Object.assign(n,t.params);if(Object.keys(n).length===0&&!("all"in e)&&!("jsonBody"in e))return e;return n}async function Ae(e,t){let n=await J(e),r={},a={};for(let[i,o]of Object.entries(t)){if(!o)continue;if(typeof o.rule==="object"||typeof o.rule==="function"){r[i]=o.rule;let s=o.message;if(typeof s==="string")a[`${i}.default`]=s;else if(s&&typeof s==="object")for(let[l,u]of Object.entries(s))a[`${i}.${l}`]=u}else r[i]=o}try{if(Object.keys(a).length>0)F(new I(a));let o=await p.object(r).validate(n);if(!o.valid){let l=X(o.errors);throw new f(422,"Validation failed",{errors:l})}return o.value??n}catch(i){if(j(i))throw i;throw new f(500,k(i)||"An unexpected validation error occurred")}}async function Se(e,t){let n={},r={};for(let a in e)if(Object.prototype.hasOwnProperty.call(e,a)){let i=e[a]?.rule;if(i)n[a]=i;let o=e[a]?.message;for(let s in o){let l=`${a}.${s}`;r[l]=e[a]?.message[s]||""}}try{let i=await p.object().shape(n).validate(t);if(!i.valid)throw new f(422,"Validation failed",{errors:i.errors});return i}catch(a){if(j(a))throw a;throw new f(500,k(a)||"An unexpected validation error occurred")}}function j(e){return e instanceof f||e instanceof Error&&typeof e.status==="number"}function X(e){let t={};if(Array.isArray(e)){for(let n of e){if(!n||typeof n!=="object")continue;let r=typeof n.field==="string"?n.field:"_",a=typeof n.message==="string"?n.message:"Validation failed";(t[r]??=[]).push(a)}return t}if(!e||typeof e!=="object")return t;for(let[n,r]of Object.entries(e)){let a=Array.isArray(r)?r:[r];for(let i of a){let o=typeof i==="string"?i:i&&typeof i==="object"&&typeof i.message==="string"?i.message:"Validation failed";(t[n]??=[]).push(o)}}return t}function Fe(e){return typeof e==="string"}function Pe(e){return typeof e==="number"&&!Number.isNaN(e)}function qe(e){return typeof e==="boolean"}function Ee(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function Me(e){return Array.isArray(e)}function Ne(e){return typeof e==="function"}function $e(e){return e===void 0}function We(e){return e===null}function _e(e){return e===null||e===void 0}export{h as applyConditionals,Se as customValidate,Ce as exists,Re as getCustomRule,pe as getErrors,Me as isArray,qe as isBoolean,Ne as isFunction,We as isNull,_e as isNullOrUndefined,Pe as isNumber,Ee as isObject,je as isObjectNotEmpty,Fe as isString,$e as isUndefined,V as objectWithContext,Te as registerRule,A as reportError,p as schema,w as shouldApplyConditional,Oe as unique,Ae as validate,Z as validateField,ve as validateFieldAsync,m as withConditionals};
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@stacksjs/validation",
|
|
3
3
|
"type": "module",
|
|
4
4
|
"sideEffects": false,
|
|
5
|
-
"version": "0.74.
|
|
5
|
+
"version": "0.74.35",
|
|
6
6
|
"description": "The Stacks Validation ways.",
|
|
7
7
|
"author": "Chris Breuer",
|
|
8
8
|
"contributors": [
|
|
@@ -58,18 +58,18 @@
|
|
|
58
58
|
"prepublishOnly": "bun run build"
|
|
59
59
|
},
|
|
60
60
|
"dependencies": {
|
|
61
|
-
"@stacksjs/error-handling": "0.74.
|
|
62
|
-
"@stacksjs/path": "0.74.
|
|
63
|
-
"@stacksjs/strings": "0.74.
|
|
61
|
+
"@stacksjs/error-handling": "0.74.35",
|
|
62
|
+
"@stacksjs/path": "0.74.35",
|
|
63
|
+
"@stacksjs/strings": "0.74.35",
|
|
64
64
|
"@stacksjs/ts-validation": "^0.5.6",
|
|
65
|
-
"@stacksjs/types": "0.74.
|
|
66
|
-
"@stacksjs/utils": "0.74.
|
|
65
|
+
"@stacksjs/types": "0.74.35",
|
|
66
|
+
"@stacksjs/utils": "0.74.35"
|
|
67
67
|
},
|
|
68
68
|
"devDependencies": {
|
|
69
69
|
"better-dx": "^0.2.24"
|
|
70
70
|
},
|
|
71
71
|
"peerDependencies": {
|
|
72
|
-
"@stacksjs/database": "0.74.
|
|
72
|
+
"@stacksjs/database": "0.74.35"
|
|
73
73
|
},
|
|
74
74
|
"peerDependenciesMeta": {
|
|
75
75
|
"@stacksjs/database": {
|