@regle/schemas 0.8.1 → 0.8.3

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.
@@ -1 +1 @@
1
- 'use strict';var core=require('@regle/core'),vue=require('vue');function A(e){if(typeof e.source.flags=="string")return e.source.flags;{let t=[];return e.global&&t.push("g"),e.ignoreCase&&t.push("i"),e.multiline&&t.push("m"),e.sticky&&t.push("y"),e.unicode&&t.push("u"),t.join("")}}function l(e){let t=e,r={}.toString.call(e).slice(8,-1);if(r=="Set"&&(t=new Set([...e].map(a=>l(a)))),r=="Map"&&(t=new Map([...e].map(a=>[l(a[0]),l(a[1])]))),r=="Date"&&(t=new Date(e.getTime())),r=="RegExp"&&(t=RegExp(e.source,A(e))),r=="Array"||r=="Object"){t=Array.isArray(e)?[]:{};for(let a in e)t[a]=l(e[a]);}return t}function w(e,t,r,a){var n,o;if(Array.isArray(t)&&(n=t.slice(0)),typeof t=="string"&&(n=t.split(".")),typeof t=="symbol"&&(n=[t]),!Array.isArray(n))throw new Error("props arg must be an array, a string or a symbol");if(o=n.pop(),!o)return false;x(o);for(var i;i=n.shift();)if(x(i),isNaN(parseInt(i))?(typeof e[i]>"u"&&(e[i]={}),e=e[i]):((e.$each??=[])[i]={},e=e.$each[i]),!e||typeof e!="object")return false;return a?e[o]?e[o].$self=(e[o].$self??=[]).concat(r):e[o]={...e[o],$self:r}:Array.isArray(e[o])?e[o]=e[o].concat(r):e[o]=r,true}function I(e,t,r){if(!e)return r;var a,n;if(Array.isArray(t)&&(a=t.slice(0)),typeof t=="string"&&(a=t.split(".")),typeof t=="symbol"&&(a=[t]),!Array.isArray(a))throw new Error("props arg must be an array, a string or a symbol");for(;a.length;)if(n=a.shift(),!e||!n||(e=e[n],e===undefined))return r;return e}function x(e){if(e=="__proto__"||e=="constructor"||e=="prototype")throw new Error("setting of prototype values not supported")}function h(e,t){let r={autoDirty:e?.autoDirty,lazy:e?.lazy,rewardEarly:e?.rewardEarly,clearExternalErrorsOnChange:e?.clearExternalErrorsOnChange};function a(n,o,i){let O=vue.ref({}),m=vue.computed(()=>vue.unref(o)),M={...r,...i},f=vue.isRef(n)?n:vue.ref(n),E=vue.ref({...l(f.value)}),d=vue.ref({}),R;if(!m.value?.["~standard"])throw new Error('Only "standard-schema" compatible libraries are supported');function N(s){let T={};return s.issues&&s.issues.map(c=>{let D=c.path?.map(y=>typeof y=="object"?y.key:y.toString()).join(".")??"",u=c.path?.[c.path.length-1],F=(typeof u=="object"&&"value"in u?Array.isArray(u.value):false)||("type"in c?c.type==="array":false)||Array.isArray(I(f.value,D));return {path:D,message:c.message,isArray:F}}).forEach(c=>{w(T,c.path,[c.message],c.isArray);}),T}async function g(){let s=m.value["~standard"].validate(f.value);return s instanceof Promise&&(s=await s),d.value=N(s),s}return vue.watch([f,m],g,{deep:true,immediate:true}),R=async()=>{try{return {result:!(await g()).issues?.length,data:f.value}}catch(s){return Promise.reject(s)}},{r$:core.useRootStorage({scopeRules:O,state:f,options:M,schemaErrors:d,initialState:E,shortcuts:t,schemaMode:true,onValidate:R}).regle}}return a}var P=h();function v(e,t){return e}function S(){function e(t,r){return r}return e}var V=S();function b({modifiers:e,shortcuts:t}){let r=h(e,t),a=S();return {useRegleSchema:r,inferSchema:a}}exports.defineRegleSchemaConfig=b;exports.inferSchema=V;exports.useRegleSchema=P;exports.withDeps=v;
1
+ 'use strict';var core=require('@regle/core'),vue=require('vue');function A(e){if(typeof e.source.flags=="string")return e.source.flags;{let t=[];return e.global&&t.push("g"),e.ignoreCase&&t.push("i"),e.multiline&&t.push("m"),e.sticky&&t.push("y"),e.unicode&&t.push("u"),t.join("")}}function l(e){let t=e,r={}.toString.call(e).slice(8,-1);if(r=="Set"&&(t=new Set([...e].map(a=>l(a)))),r=="Map"&&(t=new Map([...e].map(a=>[l(a[0]),l(a[1])]))),r=="Date"&&(t=new Date(e.getTime())),r=="RegExp"&&(t=RegExp(e.source,A(e))),r=="Array"||r=="Object"){t=Array.isArray(e)?[]:{};for(let a in e)t[a]=l(e[a]);}return t}function w(e,t,r,a){var n,o;if(Array.isArray(t)&&(n=t.slice(0)),typeof t=="string"&&(n=t.split(".")),typeof t=="symbol"&&(n=[t]),!Array.isArray(n))throw new Error("props arg must be an array, a string or a symbol");if(o=n.pop(),!o)return false;x(o);for(var i;i=n.shift();)if(x(i),isNaN(parseInt(i))?(typeof e[i]>"u"&&(e[i]={}),e=e[i]):((e.$each??=[])[i]={},e=e.$each[i]),!e||typeof e!="object")return false;return a?e[o]?e[o].$self=(e[o].$self??=[]).concat(r):e[o]={...e[o],$self:r}:Array.isArray(e[o])?e[o]=e[o].concat(r):e[o]=r,true}function I(e,t,r){if(!e)return r;var a,n;if(Array.isArray(t)&&(a=t.slice(0)),typeof t=="string"&&(a=t.split(".")),typeof t=="symbol"&&(a=[t]),!Array.isArray(a))throw new Error("props arg must be an array, a string or a symbol");for(;a.length;)if(n=a.shift(),!e||!n||(e=e[n],e===undefined))return r;return e}function x(e){if(e=="__proto__"||e=="constructor"||e=="prototype")throw new Error("setting of prototype values not supported")}function h(e,t){let r={autoDirty:e?.autoDirty,lazy:e?.lazy,rewardEarly:e?.rewardEarly,clearExternalErrorsOnChange:e?.clearExternalErrorsOnChange};function a(n,o,i){let O=vue.ref({}),p=vue.computed(()=>vue.unref(o)),M={...r,...i},f=vue.isRef(n)?n:vue.ref(n),E=vue.ref({...l(f.value)}),d=vue.ref({}),R;if(!p.value?.["~standard"])throw new Error('Only "standard-schema" compatible libraries are supported');function F(s){let T={};return s.issues&&s.issues.map(c=>{let D=c.path?.map(y=>typeof y=="object"?y.key:y.toString()).join(".")??"",u=c.path?.[c.path.length-1],N=(typeof u=="object"&&"value"in u?Array.isArray(u.value):false)||("type"in c?c.type==="array":false)||Array.isArray(I(f.value,D));return {path:D,message:c.message,isArray:N}}).forEach(c=>{w(T,c.path,[c.message],c.isArray);}),T}async function g(){let s=p.value["~standard"].validate(f.value);return s instanceof Promise&&(s=await s),d.value=F(s),s}return vue.watch([f,p],g,{deep:true,immediate:true}),R=async()=>{try{return {result:!(await g()).issues?.length,data:f.value}}catch(s){return Promise.reject(s)}},{r$:core.useRootStorage({scopeRules:O,state:f,options:M,schemaErrors:d,initialState:E,shortcuts:t,schemaMode:true,onValidate:R}).regle}}return a}var P=h();function V(e,t){return e}function S(){function e(t,r){return r}return e}var b=S();function v({modifiers:e,shortcuts:t}){let r=h(e,t),a=S();return {useRegleSchema:r,inferSchema:a}}exports.defineRegleSchemaConfig=v;exports.inferSchema=b;exports.useRegleSchema=P;exports.withDeps=V;
@@ -1 +1 @@
1
- import {useRootStorage}from'@regle/core';import {ref,computed,unref,isRef,watch}from'vue';function A(e){if(typeof e.source.flags=="string")return e.source.flags;{let t=[];return e.global&&t.push("g"),e.ignoreCase&&t.push("i"),e.multiline&&t.push("m"),e.sticky&&t.push("y"),e.unicode&&t.push("u"),t.join("")}}function l(e){let t=e,r={}.toString.call(e).slice(8,-1);if(r=="Set"&&(t=new Set([...e].map(a=>l(a)))),r=="Map"&&(t=new Map([...e].map(a=>[l(a[0]),l(a[1])]))),r=="Date"&&(t=new Date(e.getTime())),r=="RegExp"&&(t=RegExp(e.source,A(e))),r=="Array"||r=="Object"){t=Array.isArray(e)?[]:{};for(let a in e)t[a]=l(e[a]);}return t}function w(e,t,r,a){var n,o;if(Array.isArray(t)&&(n=t.slice(0)),typeof t=="string"&&(n=t.split(".")),typeof t=="symbol"&&(n=[t]),!Array.isArray(n))throw new Error("props arg must be an array, a string or a symbol");if(o=n.pop(),!o)return false;x(o);for(var i;i=n.shift();)if(x(i),isNaN(parseInt(i))?(typeof e[i]>"u"&&(e[i]={}),e=e[i]):((e.$each??=[])[i]={},e=e.$each[i]),!e||typeof e!="object")return false;return a?e[o]?e[o].$self=(e[o].$self??=[]).concat(r):e[o]={...e[o],$self:r}:Array.isArray(e[o])?e[o]=e[o].concat(r):e[o]=r,true}function I(e,t,r){if(!e)return r;var a,n;if(Array.isArray(t)&&(a=t.slice(0)),typeof t=="string"&&(a=t.split(".")),typeof t=="symbol"&&(a=[t]),!Array.isArray(a))throw new Error("props arg must be an array, a string or a symbol");for(;a.length;)if(n=a.shift(),!e||!n||(e=e[n],e===undefined))return r;return e}function x(e){if(e=="__proto__"||e=="constructor"||e=="prototype")throw new Error("setting of prototype values not supported")}function h(e,t){let r={autoDirty:e?.autoDirty,lazy:e?.lazy,rewardEarly:e?.rewardEarly,clearExternalErrorsOnChange:e?.clearExternalErrorsOnChange};function a(n,o,i){let O=ref({}),m=computed(()=>unref(o)),M={...r,...i},f=isRef(n)?n:ref(n),E=ref({...l(f.value)}),d=ref({}),R;if(!m.value?.["~standard"])throw new Error('Only "standard-schema" compatible libraries are supported');function N(s){let T={};return s.issues&&s.issues.map(c=>{let D=c.path?.map(y=>typeof y=="object"?y.key:y.toString()).join(".")??"",u=c.path?.[c.path.length-1],F=(typeof u=="object"&&"value"in u?Array.isArray(u.value):false)||("type"in c?c.type==="array":false)||Array.isArray(I(f.value,D));return {path:D,message:c.message,isArray:F}}).forEach(c=>{w(T,c.path,[c.message],c.isArray);}),T}async function g(){let s=m.value["~standard"].validate(f.value);return s instanceof Promise&&(s=await s),d.value=N(s),s}return watch([f,m],g,{deep:true,immediate:true}),R=async()=>{try{return {result:!(await g()).issues?.length,data:f.value}}catch(s){return Promise.reject(s)}},{r$:useRootStorage({scopeRules:O,state:f,options:M,schemaErrors:d,initialState:E,shortcuts:t,schemaMode:true,onValidate:R}).regle}}return a}var P=h();function v(e,t){return e}function S(){function e(t,r){return r}return e}var V=S();function b({modifiers:e,shortcuts:t}){let r=h(e,t),a=S();return {useRegleSchema:r,inferSchema:a}}export{b as defineRegleSchemaConfig,V as inferSchema,P as useRegleSchema,v as withDeps};
1
+ import {useRootStorage}from'@regle/core';import {ref,computed,unref,isRef,watch}from'vue';function A(e){if(typeof e.source.flags=="string")return e.source.flags;{let t=[];return e.global&&t.push("g"),e.ignoreCase&&t.push("i"),e.multiline&&t.push("m"),e.sticky&&t.push("y"),e.unicode&&t.push("u"),t.join("")}}function l(e){let t=e,r={}.toString.call(e).slice(8,-1);if(r=="Set"&&(t=new Set([...e].map(a=>l(a)))),r=="Map"&&(t=new Map([...e].map(a=>[l(a[0]),l(a[1])]))),r=="Date"&&(t=new Date(e.getTime())),r=="RegExp"&&(t=RegExp(e.source,A(e))),r=="Array"||r=="Object"){t=Array.isArray(e)?[]:{};for(let a in e)t[a]=l(e[a]);}return t}function w(e,t,r,a){var n,o;if(Array.isArray(t)&&(n=t.slice(0)),typeof t=="string"&&(n=t.split(".")),typeof t=="symbol"&&(n=[t]),!Array.isArray(n))throw new Error("props arg must be an array, a string or a symbol");if(o=n.pop(),!o)return false;x(o);for(var i;i=n.shift();)if(x(i),isNaN(parseInt(i))?(typeof e[i]>"u"&&(e[i]={}),e=e[i]):((e.$each??=[])[i]={},e=e.$each[i]),!e||typeof e!="object")return false;return a?e[o]?e[o].$self=(e[o].$self??=[]).concat(r):e[o]={...e[o],$self:r}:Array.isArray(e[o])?e[o]=e[o].concat(r):e[o]=r,true}function I(e,t,r){if(!e)return r;var a,n;if(Array.isArray(t)&&(a=t.slice(0)),typeof t=="string"&&(a=t.split(".")),typeof t=="symbol"&&(a=[t]),!Array.isArray(a))throw new Error("props arg must be an array, a string or a symbol");for(;a.length;)if(n=a.shift(),!e||!n||(e=e[n],e===undefined))return r;return e}function x(e){if(e=="__proto__"||e=="constructor"||e=="prototype")throw new Error("setting of prototype values not supported")}function h(e,t){let r={autoDirty:e?.autoDirty,lazy:e?.lazy,rewardEarly:e?.rewardEarly,clearExternalErrorsOnChange:e?.clearExternalErrorsOnChange};function a(n,o,i){let O=ref({}),p=computed(()=>unref(o)),M={...r,...i},f=isRef(n)?n:ref(n),E=ref({...l(f.value)}),d=ref({}),R;if(!p.value?.["~standard"])throw new Error('Only "standard-schema" compatible libraries are supported');function F(s){let T={};return s.issues&&s.issues.map(c=>{let D=c.path?.map(y=>typeof y=="object"?y.key:y.toString()).join(".")??"",u=c.path?.[c.path.length-1],N=(typeof u=="object"&&"value"in u?Array.isArray(u.value):false)||("type"in c?c.type==="array":false)||Array.isArray(I(f.value,D));return {path:D,message:c.message,isArray:N}}).forEach(c=>{w(T,c.path,[c.message],c.isArray);}),T}async function g(){let s=p.value["~standard"].validate(f.value);return s instanceof Promise&&(s=await s),d.value=F(s),s}return watch([f,p],g,{deep:true,immediate:true}),R=async()=>{try{return {result:!(await g()).issues?.length,data:f.value}}catch(s){return Promise.reject(s)}},{r$:useRootStorage({scopeRules:O,state:f,options:M,schemaErrors:d,initialState:E,shortcuts:t,schemaMode:true,onValidate:R}).regle}}return a}var P=h();function V(e,t){return e}function S(){function e(t,r){return r}return e}var b=S();function v({modifiers:e,shortcuts:t}){let r=h(e,t),a=S();return {useRegleSchema:r,inferSchema:a}}export{v as defineRegleSchemaConfig,b as inferSchema,P as useRegleSchema,V as withDeps};
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@regle/schemas",
3
- "version": "0.8.1",
3
+ "version": "0.8.3",
4
4
  "description": "Schemas adapter for Regle",
5
5
  "dependencies": {
6
6
  "@standard-schema/spec": "1.0.0",
7
- "@regle/core": "0.8.1",
8
- "@regle/rules": "0.8.1"
7
+ "@regle/rules": "0.8.3",
8
+ "@regle/core": "0.8.3"
9
9
  },
10
10
  "peerDependencies": {
11
11
  "valibot": "^1.0.0-beta.11",