@remoteoss/json-schema-form 1.0.0-dev.20250327102721 → 1.0.0-dev.20250411160101
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.d.ts +1 -0
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -1
package/dist/index.d.ts
CHANGED
|
@@ -66,6 +66,7 @@ type JsfSchema = JSONSchema & {
|
|
|
66
66
|
validations: Record<string, object>;
|
|
67
67
|
computedValues: Record<string, object>;
|
|
68
68
|
};
|
|
69
|
+
'required'?: string[];
|
|
69
70
|
'x-jsf-order'?: string[];
|
|
70
71
|
'x-jsf-presentation'?: JsfPresentation;
|
|
71
72
|
'x-jsf-errorMessage'?: Record<string, string>;
|
package/dist/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var Ie=Object.create;var z=Object.defineProperty;var Te=Object.getOwnPropertyDescriptor;var Ae=Object.getOwnPropertyNames;var we=Object.getPrototypeOf,Ne=Object.prototype.hasOwnProperty;var V=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var Pe=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of Ae(e))!Ne.call(t,a)&&a!==n&&z(t,a,{get:()=>e[a],enumerable:!(r=Te(e,a))||r.enumerable});return t};var Je=(t,e,n)=>(n=t!=null?Ie(we(t)):{},Pe(e||!t||!t.__esModule?z(n,"default",{value:t,enumerable:!0}):n,t));var w=V((Qe,K)=>{"use strict";K.exports={ROOT:0,GROUP:1,POSITION:2,SET:3,RANGE:4,REPETITION:5,REFERENCE:6,CHAR:7}});var q=V(O=>{"use strict";var f=w(),U=()=>[{type:f.RANGE,from:48,to:57}],Z=()=>[{type:f.CHAR,value:95},{type:f.RANGE,from:97,to:122},{type:f.RANGE,from:65,to:90}].concat(U()),Y=()=>[{type:f.CHAR,value:9},{type:f.CHAR,value:10},{type:f.CHAR,value:11},{type:f.CHAR,value:12},{type:f.CHAR,value:13},{type:f.CHAR,value:32},{type:f.CHAR,value:160},{type:f.CHAR,value:5760},{type:f.RANGE,from:8192,to:8202},{type:f.CHAR,value:8232},{type:f.CHAR,value:8233},{type:f.CHAR,value:8239},{type:f.CHAR,value:8287},{type:f.CHAR,value:12288},{type:f.CHAR,value:65279}],je=()=>[{type:f.CHAR,value:10},{type:f.CHAR,value:13},{type:f.CHAR,value:8232},{type:f.CHAR,value:8233}];O.words=()=>({type:f.SET,set:Z(),not:!1});O.notWords=()=>({type:f.SET,set:Z(),not:!0});O.ints=()=>({type:f.SET,set:U(),not:!1});O.notInts=()=>({type:f.SET,set:U(),not:!0});O.whitespace=()=>({type:f.SET,set:Y(),not:!1});O.notWhitespace=()=>({type:f.SET,set:Y(),not:!0});O.anyChar=()=>({type:f.SET,set:je(),not:!0})});var X=V(N=>{"use strict";var Q=w(),x=q(),Ce="@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^ ?",Me={0:0,t:9,n:10,v:11,f:12,r:13};N.strToChars=function(t){var e=/(\[\\b\])|(\\)?\\(?:u([A-F0-9]{4})|x([A-F0-9]{2})|(0?[0-7]{2})|c([@A-Z[\\\]^?])|([0tnvfr]))/g;return t=t.replace(e,function(n,r,a,o,i,l,s,u){if(a)return n;var g=r?8:o?parseInt(o,16):i?parseInt(i,16):l?parseInt(l,8):s?Ce.indexOf(s):Me[u],y=String.fromCharCode(g);return/[[\]{}^$.|?*+()]/.test(y)&&(y="\\"+y),y}),t};N.tokenizeClass=(t,e)=>{for(var n=[],r=/\\(?:(w)|(d)|(s)|(W)|(D)|(S))|((?:(?:\\)(.)|([^\]\\]))-(?:\\)?([^\]]))|(\])|(?:\\)?([^])/g,a,o;(a=r.exec(t))!=null;)if(a[1])n.push(x.words());else if(a[2])n.push(x.ints());else if(a[3])n.push(x.whitespace());else if(a[4])n.push(x.notWords());else if(a[5])n.push(x.notInts());else if(a[6])n.push(x.notWhitespace());else if(a[7])n.push({type:Q.RANGE,from:(a[8]||a[9]).charCodeAt(0),to:a[10].charCodeAt(0)});else if(o=a[12])n.push({type:Q.CHAR,value:o.charCodeAt(0)});else return[n,r.lastIndex];N.error(e,"Unterminated character class")};N.error=(t,e)=>{throw new SyntaxError("Invalid regular expression: /"+t+"/: "+e)}});var ee=V(P=>{"use strict";var _=w();P.wordBoundary=()=>({type:_.POSITION,value:"b"});P.nonWordBoundary=()=>({type:_.POSITION,value:"B"});P.begin=()=>({type:_.POSITION,value:"^"});P.end=()=>({type:_.POSITION,value:"$"})});var te=V((rt,D)=>{"use strict";var I=X(),h=w(),v=q(),F=ee();D.exports=t=>{var e=0,n,r,a={type:h.ROOT,stack:[]},o=a,i=a.stack,l=[],s=xe=>{I.error(t,`Nothing to repeat at column ${xe-1}`)},u=I.strToChars(t);for(n=u.length;e<n;)switch(r=u[e++],r){case"\\":switch(r=u[e++],r){case"b":i.push(F.wordBoundary());break;case"B":i.push(F.nonWordBoundary());break;case"w":i.push(v.words());break;case"W":i.push(v.notWords());break;case"d":i.push(v.ints());break;case"D":i.push(v.notInts());break;case"s":i.push(v.whitespace());break;case"S":i.push(v.notWhitespace());break;default:/\d/.test(r)?i.push({type:h.REFERENCE,value:parseInt(r,10)}):i.push({type:h.CHAR,value:r.charCodeAt(0)})}break;case"^":i.push(F.begin());break;case"$":i.push(F.end());break;case"[":var g;u[e]==="^"?(g=!0,e++):g=!1;var y=I.tokenizeClass(u.slice(e),t);e+=y[1],i.push({type:h.SET,set:y[0],not:g});break;case".":i.push(v.anyChar());break;case"(":var E={type:h.GROUP,stack:[],remember:!0};r=u[e],r==="?"&&(r=u[e+1],e+=2,r==="="?E.followedBy=!0:r==="!"?E.notFollowedBy=!0:r!==":"&&I.error(t,`Invalid group, character '${r}' after '?' at column ${e-1}`),E.remember=!1),i.push(E),l.push(o),o=E,i=E.stack;break;case")":l.length===0&&I.error(t,`Unmatched ) at column ${e-1}`),o=l.pop(),i=o.options?o.options[o.options.length-1]:o.stack;break;case"|":o.options||(o.options=[o.stack],delete o.stack);var M=[];o.options.push(M),i=M;break;case"{":var S=/^(\d+)(,(\d+)?)?\}/.exec(u.slice(e)),A,G;S!==null?(i.length===0&&s(e),A=parseInt(S[1],10),G=S[2]?S[3]?parseInt(S[3],10):1/0:A,e+=S[0].length,i.push({type:h.REPETITION,min:A,max:G,value:i.pop()})):i.push({type:h.CHAR,value:123});break;case"?":i.length===0&&s(e),i.push({type:h.REPETITION,min:0,max:1,value:i.pop()});break;case"+":i.length===0&&s(e),i.push({type:h.REPETITION,min:1,max:1/0,value:i.pop()});break;case"*":i.length===0&&s(e),i.push({type:h.REPETITION,min:0,max:1/0,value:i.pop()});break;default:i.push({type:h.CHAR,value:r.charCodeAt(0)})}return l.length!==0&&I.error(t,"Unterminated group"),a};D.exports.types=h});var ne=V((nt,re)=>{"use strict";var T=class t{constructor(e,n){this.low=e,this.high=n,this.length=1+n-e}overlaps(e){return!(this.high<e.low||this.low>e.high)}touches(e){return!(this.high+1<e.low||this.low-1>e.high)}add(e){return new t(Math.min(this.low,e.low),Math.max(this.high,e.high))}subtract(e){return e.low<=this.low&&e.high>=this.high?[]:e.low>this.low&&e.high<this.high?[new t(this.low,e.low-1),new t(e.high+1,this.high)]:e.low<=this.low?[new t(e.high+1,this.high)]:[new t(this.low,e.low-1)]}toString(){return this.low==this.high?this.low.toString():this.low+"-"+this.high}},L=class t{constructor(e,n){this.ranges=[],this.length=0,e!=null&&this.add(e,n)}_update_length(){this.length=this.ranges.reduce((e,n)=>e+n.length,0)}add(e,n){var r=a=>{for(var o=0;o<this.ranges.length&&!a.touches(this.ranges[o]);)o++;for(var i=this.ranges.slice(0,o);o<this.ranges.length&&a.touches(this.ranges[o]);)a=a.add(this.ranges[o]),o++;i.push(a),this.ranges=i.concat(this.ranges.slice(o)),this._update_length()};return e instanceof t?e.ranges.forEach(r):(n==null&&(n=e),r(new T(e,n))),this}subtract(e,n){var r=a=>{for(var o=0;o<this.ranges.length&&!a.overlaps(this.ranges[o]);)o++;for(var i=this.ranges.slice(0,o);o<this.ranges.length&&a.overlaps(this.ranges[o]);)i=i.concat(this.ranges[o].subtract(a)),o++;this.ranges=i.concat(this.ranges.slice(o)),this._update_length()};return e instanceof t?e.ranges.forEach(r):(n==null&&(n=e),r(new T(e,n))),this}intersect(e,n){var r=[],a=o=>{for(var i=0;i<this.ranges.length&&!o.overlaps(this.ranges[i]);)i++;for(;i<this.ranges.length&&o.overlaps(this.ranges[i]);){var l=Math.max(this.ranges[i].low,o.low),s=Math.min(this.ranges[i].high,o.high);r.push(new T(l,s)),i++}};return e instanceof t?e.ranges.forEach(a):(n==null&&(n=e),a(new T(e,n))),this.ranges=r,this._update_length(),this}index(e){for(var n=0;n<this.ranges.length&&this.ranges[n].length<=e;)e-=this.ranges[n].length,n++;return this.ranges[n].low+e}toString(){return"[ "+this.ranges.join(", ")+" ]"}clone(){return new t(this)}numbers(){return this.ranges.reduce((e,n)=>{for(var r=n.low;r<=n.high;)e.push(r),r++;return e},[])}subranges(){return this.ranges.map(e=>({low:e.low,high:e.high,length:1+e.high-e.low}))}};re.exports=L});var oe=V((it,ie)=>{"use strict";var $=te(),J=ne(),b=$.types;ie.exports=class j{constructor(e,n){if(this._setDefaults(e),e instanceof RegExp)this.ignoreCase=e.ignoreCase,this.multiline=e.multiline,e=e.source;else if(typeof e=="string")this.ignoreCase=n&&n.indexOf("i")!==-1,this.multiline=n&&n.indexOf("m")!==-1;else throw new Error("Expected a regexp or string");this.tokens=$(e)}_setDefaults(e){this.max=e.max!=null?e.max:j.prototype.max!=null?j.prototype.max:100,this.defaultRange=e.defaultRange?e.defaultRange:this.defaultRange.clone(),e.randInt&&(this.randInt=e.randInt)}gen(){return this._gen(this.tokens,[])}_gen(e,n){var r,a,o,i,l;switch(e.type){case b.ROOT:case b.GROUP:if(e.followedBy||e.notFollowedBy)return"";for(e.remember&&e.groupNumber===void 0&&(e.groupNumber=n.push(null)-1),r=e.options?this._randSelect(e.options):e.stack,a="",i=0,l=r.length;i<l;i++)a+=this._gen(r[i],n);return e.remember&&(n[e.groupNumber]=a),a;case b.POSITION:return"";case b.SET:var s=this._expand(e);return s.length?String.fromCharCode(this._randSelect(s)):"";case b.REPETITION:for(o=this.randInt(e.min,e.max===1/0?e.min+this.max:e.max),a="",i=0;i<o;i++)a+=this._gen(e.value,n);return a;case b.REFERENCE:return n[e.value-1]||"";case b.CHAR:var u=this.ignoreCase&&this._randBool()?this._toOtherCase(e.value):e.value;return String.fromCharCode(u)}}_toOtherCase(e){return e+(97<=e&&e<=122?-32:65<=e&&e<=90?32:0)}_randBool(){return!this.randInt(0,1)}_randSelect(e){return e instanceof J?e.index(this.randInt(0,e.length-1)):e[this.randInt(0,e.length-1)]}_expand(e){if(e.type===$.types.CHAR)return new J(e.value);if(e.type===$.types.RANGE)return new J(e.from,e.to);{let n=new J;for(let r=0;r<e.set.length;r++){let a=this._expand(e.set[r]);if(n.add(a),this.ignoreCase)for(let o=0;o<a.length;o++){let i=a.index(o),l=this._toOtherCase(i);i!==l&&n.add(l)}}return e.not?this.defaultRange.clone().subtract(n):this.defaultRange.clone().intersect(n)}}randInt(e,n){return e+Math.floor(Math.random()*(1+n-e))}get defaultRange(){return this._range=this._range||new J(32,126)}set defaultRange(e){this._range=e}static randexp(e,n){var r;return typeof e=="string"&&(e=new RegExp(e,n)),e._randexp===void 0?(r=new j(e,n),e._randexp=r):(r=e._randexp,r._setDefaults(e)),r.gen()}static sugar(){RegExp.prototype.gen=function(){return j.randexp(this)}}}});var ae=Je(oe(),1);function se(t,e,n){switch(n){case"type":return _e(t.type);case"required":return"Required field";case"valid":return"Always fails";case"const":return`The only accepted value is ${JSON.stringify(t.const)}`;case"enum":return`The option "${k(e)}" is not valid.`;case"anyOf":return`The option "${k(e)}" is not valid.`;case"oneOf":return`The option "${k(e)}" is not valid.`;case"not":return"The value must not satisfy the provided schema";case"minLength":return`Please insert at least ${t.minLength} characters`;case"maxLength":return`Please insert up to ${t.maxLength} characters`;case"pattern":return`Must have a valid format. E.g. ${(0,ae.randexp)(t.pattern||"")}`;case"format":return t.format==="email"?"Please enter a valid email address":`Must be a valid ${t.format} format`;case"multipleOf":return`Must be a multiple of ${t.multipleOf}`;case"maximum":return`Must be smaller or equal to ${t.maximum}`;case"exclusiveMaximum":return`Must be smaller than ${t.exclusiveMaximum}`;case"minimum":return`Must be greater or equal to ${t.minimum}`;case"exclusiveMinimum":return`Must be greater than ${t.exclusiveMinimum}`}}function _e(t){if(Array.isArray(t))return`The value must be a ${t.map(n=>n==="integer"?"number":n).join(" or ")}`;switch(t){case"number":case"integer":return"The value must be a number";case"boolean":return"The value must be a boolean";case"null":return"The value must be null";case"string":return"The value must be a string";case"object":return"The value must be an object";case"array":return"The value must be an array";default:return t?`The value must be ${t}`:"Invalid value"}}function k(t){return typeof t=="string"?t:JSON.stringify(t)}function Fe(t){let{fields:e,order:n}=t,r={};return n.forEach((o,i)=>{r[o]=i}),e.sort((o,i)=>{let l=r[o.name]??1/0,s=r[i.name]??1/0;return l!==s?l-s:e.indexOf(o)-e.indexOf(i)})}function le(t){let{schema:e,fields:n}=t;if(typeof e=="boolean")throw new Error("Schema must be an object");return e["x-jsf-order"]!==void 0?Fe({fields:n,order:e["x-jsf-order"]}):n}function $e(t){return Array.isArray(t.type)?"select":t.type!==void 0?t.type:"text"}function W(t){return t.filter(e=>e!==null&&typeof e=="object").map(e=>{let n=e.title,r=e.const,o=e["x-jsf-presentation"]?.meta,i={label:n||"",value:r};o&&(i.meta=o);let{title:l,const:s,"x-jsf-presentation":u,...g}=e;return{...i,...g}})}function He(t){return t.oneOf?W(t.oneOf||[]):t.items?.anyOf?W(t.items.anyOf):t.anyOf?W(t.anyOf):null}var Be=["title","type","x-jsf-errorMessage","x-jsf-presentation","oneOf","anyOf","items"];function fe(t,e,n=!1){if(typeof t=="boolean")return null;if(t.type==="object"){let s={...t,type:"object"};return H(s,e,n)}if(t.type==="array")throw new TypeError("Array type is not yet supported");let r=t["x-jsf-presentation"]||{},a=t["x-jsf-errorMessage"],o=r.inputType||"text",i={...Object.entries(t).filter(([s])=>!Be.includes(s)).reduce((s,[u,g])=>({...s,[u]:g}),{}),type:o,name:e,inputType:o,jsonType:$e(t),required:n,isVisible:!0,...a&&{errorMessage:a}};t.const&&(i.const=t.const,o==="checkbox"&&(i.checkboxValue=t.const)),t.title&&(i.label=t.title),Object.keys(r).length>0&&Object.entries(r).forEach(([s,u])=>{s!=="inputType"&&(i[s]=u)});let l=He(t);return l&&(i.options=l),i}function H(t,e,n){let r=[];for(let i in t.properties){let l=t.required?.includes(i)||!1,s=fe(t.properties[i],i,l);s&&r.push(s)}let a=le({fields:r,schema:t}),o={...t["x-jsf-presentation"],type:t["x-jsf-presentation"]?.inputType||"fieldset",inputType:t["x-jsf-presentation"]?.inputType||"fieldset",jsonType:"object",name:e,required:n,fields:a,isVisible:!0};return t.title!==void 0&&(o.label=t.title),t["x-jsf-presentation"]?.accept&&(o.accept=t["x-jsf-presentation"]?.accept),o}function ue(t,e,n,r=[]){if(!e.allOf||!Array.isArray(e.allOf))return[];for(let a=0;a<e.allOf.length;a++){let o=e.allOf[a],i=c(t,o,n,[...r,"allOf",a]);if(i.length>0)return i}return[]}function de(t,e,n,r=[]){if(!e.anyOf||!Array.isArray(e.anyOf))return[];for(let a of e.anyOf)if(c(t,a,n,r).length===0)return[];return[{path:r,validation:"anyOf"}]}function pe(t,e,n,r=[]){if(!e.oneOf||!Array.isArray(e.oneOf))return[];let a=0;for(let o=0;o<e.oneOf.length&&!(c(t,e.oneOf[o],n,r).length===0&&(a++,a>1));o++);return a===0?[{path:r,validation:"oneOf"}]:a>1?[{path:r,validation:"oneOf"}]:[]}function ce(t,e,n,r=[]){return e.not===void 0?[]:typeof e.not=="boolean"?e.not?[{path:r,validation:"not"}]:[]:c(t,e.not,n,r).length===0?[{path:r,validation:"not"}]:[]}function me(t,e,n,r=[]){if(e.if===void 0)return[];let a=c(t,e.if,n,r).length===0;return a&&e.then!==void 0?c(t,e.then,n,[...r,"then"]):!a&&e.else!==void 0?c(t,e.else,n,[...r,"else"]):[]}function m(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function R(t,e){if(typeof t!=typeof e)return!1;if(t===e)return!0;if(t===null||e===null)return!1;if(Array.isArray(t)&&Array.isArray(e))return t.length!==e.length?!1:t.every((n,r)=>R(n,e[r]));if(m(t)&&m(e)){let n=Object.keys(t).sort(),r=Object.keys(e).sort();return n.length!==r.length||!R(n,r)?!1:n.every(a=>R(t[a],e[a]))}return!1}function he(t,e,n=[]){return e.const===void 0?[]:R(e.const,t)?[]:[{path:n,validation:"const"}]}function ye(t,e,n=[]){return e.enum===void 0?[]:e.enum.some(r=>R(r,t))?[]:[{path:n,validation:"enum"}]}function ge(t,e,n=[]){let r=[],a=C(e);return typeof t!="number"?[]:a!==void 0&&!["number","integer"].includes(a)?[]:(e.multipleOf!==void 0&&t%e.multipleOf!==0&&r.push({path:n,validation:"multipleOf"}),e.maximum!==void 0&&t>e.maximum&&r.push({path:n,validation:"maximum"}),e.exclusiveMaximum!==void 0&&t>=e.exclusiveMaximum&&r.push({path:n,validation:"exclusiveMaximum"}),e.minimum!==void 0&&t<e.minimum&&r.push({path:n,validation:"minimum"}),e.exclusiveMinimum!==void 0&&t<=e.exclusiveMinimum&&r.push({path:n,validation:"exclusiveMinimum"}),r)}function Ee(t,e,n,r=[]){if(typeof e=="object"&&e.properties&&m(t)){let a=[];for(let[o,i]of Object.entries(e.properties))a.push(...c(t[o],i,n,[...r,o]));return a}return[]}var Oe;(function(t){t["7bit"]="7bit",t["8bit"]="8bit",t.Base64="base64",t.Binary="binary",t.IETFToken="ietf-token",t.QuotedPrintable="quoted-printable",t.XToken="x-token"})(Oe||(Oe={}));var d;(function(t){t.Date="date",t.DateTime="date-time",t.Duration="duration",t.Email="email",t.Hostname="hostname",t.IDNEmail="idn-email",t.IDNHostname="idn-hostname",t.IPv4="ipv4",t.IPv6="ipv6",t.IRI="iri",t.IRIReference="iri-reference",t.JSONPointer="json-pointer",t.JSONPointerURIFragment="json-pointer-uri-fragment",t.RegEx="regex",t.RelativeJSONPointer="relative-json-pointer",t.Time="time",t.URI="uri",t.URIReference="uri-reference",t.URITemplate="uri-template",t.UUID="uuid"})(d||(d={}));var Se;(function(t){t.Array="array",t.Boolean="boolean",t.Integer="integer",t.Null="null",t.Number="number",t.Object="object",t.String="string"})(Se||(Se={}));var p={DATE_TIME:/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:\d{2})$/,DATE:/^\d{4}-\d{2}-\d{2}$/,TIME:/^(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|[+-](?:[01]\d|2[0-3]):[0-5]\d)$/,DURATION:/^P(?!$)(?:\d+Y)?(?:\d+M)?(?:\d+D)?(?:T(?=\d)(?:\d+H)?(?:\d+M)?(?:\d+S)?)?$/,EMAIL:/^[\w.!#$%&'*+/=?^`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i,IDN_EMAIL:/^[^\s@]+@[^\s@][^\s.@]*\.[^\s@]+$/,HOSTNAME:/^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/i,IDN_HOSTNAME:/^[^\s._-].*[^\s._-]$/,IPV6_PART:/^[0-9a-f]{1,4}$/i,PROTOCOL:/^[a-z]+:/,URI_REFERENCE:/^\S*$/,UUID:/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,JSON_POINTER:/^(?:\/(?:[^~/]|~0|~1)*)*$/,JSON_POINTER_URI_FRAGMENT:/^#(?:\/(?:[\w\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,RELATIVE_JSON_POINTER:/^(?:0|[1-9]\d*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,URI_TEMPLATE:/^(?:[!#$&'()*+,/:;=?@\w\-.~]|%[0-9a-f]{2}|\{[+#./;?&=,!@|]?(?:\w|%[0-9a-f]{2})+(?::[1-9]\d{0,3}|\*)?(?:,(?:\w|%[0-9a-f]{2})+(?::[1-9]\d{0,3}|\*)?)*\})*$/i},Ue={[d.DateTime]:t=>p.DATE_TIME.test(t),[d.Date]:t=>p.DATE.test(t),[d.Time]:t=>p.TIME.test(t),[d.Duration]:t=>p.DURATION.test(t),[d.Email]:t=>t.length<=254&&p.EMAIL.test(t),[d.IDNEmail]:t=>t.length<=254&&p.IDN_EMAIL.test(t),[d.Hostname]:t=>t.length>255?!1:t.split(".").every(n=>p.HOSTNAME.test(n)),[d.IDNHostname]:t=>t.length>255?!1:t.split(".").every(n=>n.length<=63&&p.IDN_HOSTNAME.test(n)),[d.IPv4]:t=>{let e=t.split(".");return e.length!==4?!1:e.every(n=>{let r=Number.parseInt(n,10);return r>=0&&r<=255&&n===r.toString()})},[d.IPv6]:t=>{let e=t.split(":");if(e.length>8)return!1;let n=!1;return e.every(r=>r===""?n?!1:(n=!0,!0):p.IPV6_PART.test(r))},[d.URI]:t=>{try{let e=new URL(t);return e.protocol!==""&&p.PROTOCOL.test(e.protocol)}catch{return!1}},[d.URIReference]:t=>{try{return t.startsWith("//")?p.URI_REFERENCE.test(t.slice(2)):(new URL(t,"http://example.com"),!0)}catch{return!1}},[d.IRI]:t=>{try{let e=new URL(t);return e.protocol!==""&&p.PROTOCOL.test(e.protocol)}catch{return!1}},[d.IRIReference]:t=>{try{return t.startsWith("//")?p.URI_REFERENCE.test(t.slice(2)):(new URL(t,"http://example.com"),!0)}catch{return!1}},[d.RegEx]:t=>{try{return new RegExp(t,"u"),!0}catch{return!1}},[d.UUID]:t=>p.UUID.test(t),[d.JSONPointer]:t=>p.JSON_POINTER.test(t),[d.JSONPointerURIFragment]:t=>p.JSON_POINTER_URI_FRAGMENT.test(t),[d.RelativeJSONPointer]:t=>p.RELATIVE_JSON_POINTER.test(t),[d.URITemplate]:t=>p.URI_TEMPLATE.test(t)};function Ve(t,e,n=[]){let r=[];if(typeof t!="string")return r;let a=Ue[e];return a&&!a(t)&&r.push({path:n,validation:"format"}),r}function ve(t,e,n=[]){let r=[],a=C(e);if(typeof t!="string")return[];if(a!==void 0&&a!=="string")return[];let o=[...new Intl.Segmenter().segment(t)].length;if(e.minLength!==void 0&&o<e.minLength&&r.push({path:n,validation:"minLength"}),e.maxLength!==void 0&&o>e.maxLength&&r.push({path:n,validation:"maxLength"}),e.pattern!==void 0&&(new RegExp(e.pattern).test(t)||r.push({path:n,validation:"pattern"})),e.format!==void 0){let i=Ve(t,e.format,n);r.push(...i)}return r}function C(t){if(typeof t=="boolean")return"boolean";if(t.type!==void 0)return t.type}function qe(t,e,n=[]){let r=C(e);if(r===void 0)return[];if(r==="null"&&t===null)return[];let a=t===null?"null":typeof t;if(Array.isArray(r)){if(t===null&&r.includes("null"))return[];for(let o of r){if(a==="number"&&o==="integer"&&Number.isInteger(t))return[];if(a===o||o==="null"&&t===null)return[]}}return a==="number"&&r==="integer"&&Number.isInteger(t)?[]:a===r?[]:[{path:n,validation:"type"}]}function c(t,e,n={},r=[]){let a=t===void 0||t===null&&n.treatNullAsUndefined,o=[];if(a)return[];if(typeof e=="boolean")return e?[]:[{path:r,validation:"valid"}];let i=qe(t,e,r);if(i.length>0)return i;if(e.required&&Array.isArray(e.required)&&m(t)){let l=e.required.filter(s=>{let u=t[s];return u===void 0||u===null&&n.treatNullAsUndefined});for(let s of l)o.push({path:[...r,s],validation:"required"})}return[...o,...he(t,e,r),...ye(t,e,r),...Ee(t,e,n,r),...ve(t,e,r),...ge(t,e,r),...ce(t,e,n,r),...ue(t,e,n,r),...de(t,e,n,r),...pe(t,e,n,r),...me(t,e,n,r)]}function B(t,e,n,r={}){if(m(e)){be(t,e,n,r);for(let a in n.properties){let o=n.properties[a];if(typeof o!="object"||o===null||Array.isArray(o)||!o.allOf)continue;let i=t.find(s=>s.name===o.title||s.name===a);if(!i||!i.fields||i.fields.length===0)continue;let l=m(e[a])?e[a]:m(e[i.name])?e[i.name]:{};be(i.fields,l,o,r),i.isVisible&&B(i.fields,l,o,r)}}}function be(t,e,n,r={}){if(!n.allOf||!Array.isArray(n.allOf)||!m(e))return;let a=n.allOf.filter(o=>typeof o=="object"&&o!==null&&"if"in o).map(o=>{let i=o,s=c(e,i.if,r).length===0,u=!1;return s&&typeof i.if=="object"&&i.if!==null&&Array.isArray(i.if.required)&&(u=i.if.required.some(y=>{if(!n.properties||!n.properties[y])return!1;let E=n.properties[y],M=e[y];return c(M,E,r).some(A=>A.validation==="type")})),{rule:i,matches:s&&!u}});for(let o of t){let i=o.required;for(let{rule:l,matches:s}of a)s&&l.then?i=Re(o.name,l.then,i):!s&&l.else&&(i=Re(o.name,l.else,i));o.isVisible=i}}function Re(t,e,n){let r=n;return typeof e=="object"&&e!==null&&(Array.isArray(e.required)&&e.required.includes(t)&&(r=!0),e.properties!==void 0&&t in e.properties&&e.properties[t]===!1&&(r=!1)),r}function De(t){let e=[];for(let n=0;n<t.length;n++){let r=t[n];if(["allOf","anyOf","oneOf"].includes(r)){n+1<t.length&&typeof t[n+1]=="number"&&n++;continue}r==="then"||r==="else"||e.push(r)}return e}function Le(t){return t.length===0?null:t.reduce((e,n)=>{let{path:r}=n;if(r.length===0)return e[""]=n.message,e;let a=De(r),o=e;if(a.slice(0,-1).forEach(i=>{(!(i in o)||typeof o[i]=="string")&&(o[i]={}),o=o[i]}),a.length>0){let i=a[a.length-1];o[i]=n.message}else e[""]=n.message;return e},{})}function ke(t,e,n){let r=t,a=e;for(let o of n)if(typeof r=="object"&&r!==null)if(r.properties&&r.properties[o])r=r.properties[o],m(a)&&(a=a[o]);else if(r.items&&typeof r.items!="boolean")r=r.items,Array.isArray(a)&&(a=a[Number(o)]);else{if(o==="allOf"&&r.allOf)continue;if(o==="anyOf"&&r.anyOf)continue;if(o==="oneOf"&&r.oneOf)continue;if((o==="then"||o==="else")&&r[o]){r=r[o];continue}else if(r.allOf||r.anyOf||r.oneOf){let i=Number(o);r.allOf&&i>=0&&i<r.allOf.length?r=r.allOf[i]:r.anyOf&&i>=0&&i<r.anyOf.length?r=r.anyOf[i]:r.oneOf&&i>=0&&i<r.oneOf.length&&(r=r.oneOf[i])}}return{schema:r,value:a}}function We(t,e,n){return n.map(r=>{let{schema:a,value:o}=ke(e,t,r.path);return{...r,message:se(a,o,r.validation)}})}function Ge(t,e){return typeof e!="object"||!e||!t.length?t:t.map(n=>{if(!n.path.length)return n;let r=typeof e=="object"?e:null,a=null;for(let o of n.path){if(!r||typeof r!="object")break;if(r.properties&&r.properties[o]){let i=r.properties[o];if(typeof i!="boolean")r=i,a=r;else break}else if(r.items&&typeof r.items!="boolean")r=r.items,a=r;else break}return a&&a["x-jsf-errorMessage"]&&a["x-jsf-errorMessage"][n.validation]?{...n,message:a["x-jsf-errorMessage"][n.validation]}:n})}function ze(t,e,n={}){let r={},a=c(t,e,n),o=We(t,e,a),i=Ge(o,e),l=Le(i);return l&&(r.formErrors=l),r}function Ke(t){let{schema:e}=t;return H(e,"root",!0).fields||[]}function Ze(t,e={}){let n=e.initialValues||{},r=Ke({schema:t});return B(r,n,t),{fields:r,isError:!1,error:null,handleValidation:i=>{let l=ze(i,t,e.validationOptions);return B(r,i,t,e.validationOptions),l}}}export{Ze as createHeadlessForm};
|
|
1
|
+
var Ne=Object.create;var Y=Object.defineProperty;var we=Object.getOwnPropertyDescriptor;var Ae=Object.getOwnPropertyNames;var Je=Object.getPrototypeOf,Pe=Object.prototype.hasOwnProperty;var S=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var je=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Ae(e))!Pe.call(t,o)&&o!==n&&Y(t,o,{get:()=>e[o],enumerable:!(r=we(e,o))||r.enumerable});return t};var Ce=(t,e,n)=>(n=t!=null?Ne(Je(t)):{},je(e||!t||!t.__esModule?Y(n,"default",{value:t,enumerable:!0}):n,t));var N=S((et,Q)=>{"use strict";Q.exports={ROOT:0,GROUP:1,POSITION:2,SET:3,RANGE:4,REPETITION:5,REFERENCE:6,CHAR:7}});var U=S(O=>{"use strict";var f=N(),B=()=>[{type:f.RANGE,from:48,to:57}],X=()=>[{type:f.CHAR,value:95},{type:f.RANGE,from:97,to:122},{type:f.RANGE,from:65,to:90}].concat(B()),ee=()=>[{type:f.CHAR,value:9},{type:f.CHAR,value:10},{type:f.CHAR,value:11},{type:f.CHAR,value:12},{type:f.CHAR,value:13},{type:f.CHAR,value:32},{type:f.CHAR,value:160},{type:f.CHAR,value:5760},{type:f.RANGE,from:8192,to:8202},{type:f.CHAR,value:8232},{type:f.CHAR,value:8233},{type:f.CHAR,value:8239},{type:f.CHAR,value:8287},{type:f.CHAR,value:12288},{type:f.CHAR,value:65279}],Me=()=>[{type:f.CHAR,value:10},{type:f.CHAR,value:13},{type:f.CHAR,value:8232},{type:f.CHAR,value:8233}];O.words=()=>({type:f.SET,set:X(),not:!1});O.notWords=()=>({type:f.SET,set:X(),not:!0});O.ints=()=>({type:f.SET,set:B(),not:!1});O.notInts=()=>({type:f.SET,set:B(),not:!0});O.whitespace=()=>({type:f.SET,set:ee(),not:!1});O.notWhitespace=()=>({type:f.SET,set:ee(),not:!0});O.anyChar=()=>({type:f.SET,set:Me(),not:!0})});var re=S(w=>{"use strict";var te=N(),x=U(),Fe="@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^ ?",_e={0:0,t:9,n:10,v:11,f:12,r:13};w.strToChars=function(t){var e=/(\[\\b\])|(\\)?\\(?:u([A-F0-9]{4})|x([A-F0-9]{2})|(0?[0-7]{2})|c([@A-Z[\\\]^?])|([0tnvfr]))/g;return t=t.replace(e,function(n,r,o,a,i,l,s,d){if(o)return n;var h=r?8:a?parseInt(a,16):i?parseInt(i,16):l?parseInt(l,8):s?Fe.indexOf(s):_e[d],g=String.fromCharCode(h);return/[[\]{}^$.|?*+()]/.test(g)&&(g="\\"+g),g}),t};w.tokenizeClass=(t,e)=>{for(var n=[],r=/\\(?:(w)|(d)|(s)|(W)|(D)|(S))|((?:(?:\\)(.)|([^\]\\]))-(?:\\)?([^\]]))|(\])|(?:\\)?([^])/g,o,a;(o=r.exec(t))!=null;)if(o[1])n.push(x.words());else if(o[2])n.push(x.ints());else if(o[3])n.push(x.whitespace());else if(o[4])n.push(x.notWords());else if(o[5])n.push(x.notInts());else if(o[6])n.push(x.notWhitespace());else if(o[7])n.push({type:te.RANGE,from:(o[8]||o[9]).charCodeAt(0),to:o[10].charCodeAt(0)});else if(a=o[12])n.push({type:te.CHAR,value:a.charCodeAt(0)});else return[n,r.lastIndex];w.error(e,"Unterminated character class")};w.error=(t,e)=>{throw new SyntaxError("Invalid regular expression: /"+t+"/: "+e)}});var ne=S(A=>{"use strict";var M=N();A.wordBoundary=()=>({type:M.POSITION,value:"b"});A.nonWordBoundary=()=>({type:M.POSITION,value:"B"});A.begin=()=>({type:M.POSITION,value:"^"});A.end=()=>({type:M.POSITION,value:"$"})});var ie=S((it,D)=>{"use strict";var I=re(),m=N(),V=U(),F=ne();D.exports=t=>{var e=0,n,r,o={type:m.ROOT,stack:[]},a=o,i=o.stack,l=[],s=Te=>{I.error(t,`Nothing to repeat at column ${Te-1}`)},d=I.strToChars(t);for(n=d.length;e<n;)switch(r=d[e++],r){case"\\":switch(r=d[e++],r){case"b":i.push(F.wordBoundary());break;case"B":i.push(F.nonWordBoundary());break;case"w":i.push(V.words());break;case"W":i.push(V.notWords());break;case"d":i.push(V.ints());break;case"D":i.push(V.notInts());break;case"s":i.push(V.whitespace());break;case"S":i.push(V.notWhitespace());break;default:/\d/.test(r)?i.push({type:m.REFERENCE,value:parseInt(r,10)}):i.push({type:m.CHAR,value:r.charCodeAt(0)})}break;case"^":i.push(F.begin());break;case"$":i.push(F.end());break;case"[":var h;d[e]==="^"?(h=!0,e++):h=!1;var g=I.tokenizeClass(d.slice(e),t);e+=g[1],i.push({type:m.SET,set:g[0],not:h});break;case".":i.push(V.anyChar());break;case"(":var E={type:m.GROUP,stack:[],remember:!0};r=d[e],r==="?"&&(r=d[e+1],e+=2,r==="="?E.followedBy=!0:r==="!"?E.notFollowedBy=!0:r!==":"&&I.error(t,`Invalid group, character '${r}' after '?' at column ${e-1}`),E.remember=!1),i.push(E),l.push(a),a=E,i=E.stack;break;case")":l.length===0&&I.error(t,`Unmatched ) at column ${e-1}`),a=l.pop(),i=a.options?a.options[a.options.length-1]:a.stack;break;case"|":a.options||(a.options=[a.stack],delete a.stack);var K=[];a.options.push(K),i=K;break;case"{":var R=/^(\d+)(,(\d+)?)?\}/.exec(d.slice(e)),H,Z;R!==null?(i.length===0&&s(e),H=parseInt(R[1],10),Z=R[2]?R[3]?parseInt(R[3],10):1/0:H,e+=R[0].length,i.push({type:m.REPETITION,min:H,max:Z,value:i.pop()})):i.push({type:m.CHAR,value:123});break;case"?":i.length===0&&s(e),i.push({type:m.REPETITION,min:0,max:1,value:i.pop()});break;case"+":i.length===0&&s(e),i.push({type:m.REPETITION,min:1,max:1/0,value:i.pop()});break;case"*":i.length===0&&s(e),i.push({type:m.REPETITION,min:0,max:1/0,value:i.pop()});break;default:i.push({type:m.CHAR,value:r.charCodeAt(0)})}return l.length!==0&&I.error(t,"Unterminated group"),o};D.exports.types=m});var ae=S((ot,oe)=>{"use strict";var T=class t{constructor(e,n){this.low=e,this.high=n,this.length=1+n-e}overlaps(e){return!(this.high<e.low||this.low>e.high)}touches(e){return!(this.high+1<e.low||this.low-1>e.high)}add(e){return new t(Math.min(this.low,e.low),Math.max(this.high,e.high))}subtract(e){return e.low<=this.low&&e.high>=this.high?[]:e.low>this.low&&e.high<this.high?[new t(this.low,e.low-1),new t(e.high+1,this.high)]:e.low<=this.low?[new t(e.high+1,this.high)]:[new t(this.low,e.low-1)]}toString(){return this.low==this.high?this.low.toString():this.low+"-"+this.high}},k=class t{constructor(e,n){this.ranges=[],this.length=0,e!=null&&this.add(e,n)}_update_length(){this.length=this.ranges.reduce((e,n)=>e+n.length,0)}add(e,n){var r=o=>{for(var a=0;a<this.ranges.length&&!o.touches(this.ranges[a]);)a++;for(var i=this.ranges.slice(0,a);a<this.ranges.length&&o.touches(this.ranges[a]);)o=o.add(this.ranges[a]),a++;i.push(o),this.ranges=i.concat(this.ranges.slice(a)),this._update_length()};return e instanceof t?e.ranges.forEach(r):(n==null&&(n=e),r(new T(e,n))),this}subtract(e,n){var r=o=>{for(var a=0;a<this.ranges.length&&!o.overlaps(this.ranges[a]);)a++;for(var i=this.ranges.slice(0,a);a<this.ranges.length&&o.overlaps(this.ranges[a]);)i=i.concat(this.ranges[a].subtract(o)),a++;this.ranges=i.concat(this.ranges.slice(a)),this._update_length()};return e instanceof t?e.ranges.forEach(r):(n==null&&(n=e),r(new T(e,n))),this}intersect(e,n){var r=[],o=a=>{for(var i=0;i<this.ranges.length&&!a.overlaps(this.ranges[i]);)i++;for(;i<this.ranges.length&&a.overlaps(this.ranges[i]);){var l=Math.max(this.ranges[i].low,a.low),s=Math.min(this.ranges[i].high,a.high);r.push(new T(l,s)),i++}};return e instanceof t?e.ranges.forEach(o):(n==null&&(n=e),o(new T(e,n))),this.ranges=r,this._update_length(),this}index(e){for(var n=0;n<this.ranges.length&&this.ranges[n].length<=e;)e-=this.ranges[n].length,n++;return this.ranges[n].low+e}toString(){return"[ "+this.ranges.join(", ")+" ]"}clone(){return new t(this)}numbers(){return this.ranges.reduce((e,n)=>{for(var r=n.low;r<=n.high;)e.push(r),r++;return e},[])}subranges(){return this.ranges.map(e=>({low:e.low,high:e.high,length:1+e.high-e.low}))}};oe.exports=k});var le=S((at,se)=>{"use strict";var _=ie(),J=ae(),v=_.types;se.exports=class P{constructor(e,n){if(this._setDefaults(e),e instanceof RegExp)this.ignoreCase=e.ignoreCase,this.multiline=e.multiline,e=e.source;else if(typeof e=="string")this.ignoreCase=n&&n.indexOf("i")!==-1,this.multiline=n&&n.indexOf("m")!==-1;else throw new Error("Expected a regexp or string");this.tokens=_(e)}_setDefaults(e){this.max=e.max!=null?e.max:P.prototype.max!=null?P.prototype.max:100,this.defaultRange=e.defaultRange?e.defaultRange:this.defaultRange.clone(),e.randInt&&(this.randInt=e.randInt)}gen(){return this._gen(this.tokens,[])}_gen(e,n){var r,o,a,i,l;switch(e.type){case v.ROOT:case v.GROUP:if(e.followedBy||e.notFollowedBy)return"";for(e.remember&&e.groupNumber===void 0&&(e.groupNumber=n.push(null)-1),r=e.options?this._randSelect(e.options):e.stack,o="",i=0,l=r.length;i<l;i++)o+=this._gen(r[i],n);return e.remember&&(n[e.groupNumber]=o),o;case v.POSITION:return"";case v.SET:var s=this._expand(e);return s.length?String.fromCharCode(this._randSelect(s)):"";case v.REPETITION:for(a=this.randInt(e.min,e.max===1/0?e.min+this.max:e.max),o="",i=0;i<a;i++)o+=this._gen(e.value,n);return o;case v.REFERENCE:return n[e.value-1]||"";case v.CHAR:var d=this.ignoreCase&&this._randBool()?this._toOtherCase(e.value):e.value;return String.fromCharCode(d)}}_toOtherCase(e){return e+(97<=e&&e<=122?-32:65<=e&&e<=90?32:0)}_randBool(){return!this.randInt(0,1)}_randSelect(e){return e instanceof J?e.index(this.randInt(0,e.length-1)):e[this.randInt(0,e.length-1)]}_expand(e){if(e.type===_.types.CHAR)return new J(e.value);if(e.type===_.types.RANGE)return new J(e.from,e.to);{let n=new J;for(let r=0;r<e.set.length;r++){let o=this._expand(e.set[r]);if(n.add(o),this.ignoreCase)for(let a=0;a<o.length;a++){let i=o.index(a),l=this._toOtherCase(i);i!==l&&n.add(l)}}return e.not?this.defaultRange.clone().subtract(n):this.defaultRange.clone().intersect(n)}}randInt(e,n){return e+Math.floor(Math.random()*(1+n-e))}get defaultRange(){return this._range=this._range||new J(32,126)}set defaultRange(e){this._range=e}static randexp(e,n){var r;return typeof e=="string"&&(e=new RegExp(e,n)),e._randexp===void 0?(r=new P(e,n),e._randexp=r):(r=e._randexp,r._setDefaults(e)),r.gen()}static sugar(){RegExp.prototype.gen=function(){return P.randexp(this)}}}});var fe=Ce(le(),1);function ue(t,e,n){switch(n){case"type":return $e(t.type);case"required":return"Required field";case"valid":return"Always fails";case"const":return`The only accepted value is ${JSON.stringify(t.const)}`;case"enum":return`The option "${L(e)}" is not valid.`;case"anyOf":return`The option "${L(e)}" is not valid.`;case"oneOf":return`The option "${L(e)}" is not valid.`;case"not":return"The value must not satisfy the provided schema";case"minLength":return`Please insert at least ${t.minLength} characters`;case"maxLength":return`Please insert up to ${t.maxLength} characters`;case"pattern":return`Must have a valid format. E.g. ${(0,fe.randexp)(t.pattern||"")}`;case"format":return t.format==="email"?"Please enter a valid email address":`Must be a valid ${t.format} format`;case"multipleOf":return`Must be a multiple of ${t.multipleOf}`;case"maximum":return`Must be smaller or equal to ${t.maximum}`;case"exclusiveMaximum":return`Must be smaller than ${t.exclusiveMaximum}`;case"minimum":return`Must be greater or equal to ${t.minimum}`;case"exclusiveMinimum":return`Must be greater than ${t.exclusiveMinimum}`}}function $e(t){if(Array.isArray(t))return`The value must be a ${t.map(n=>n==="integer"?"number":n).join(" or ")}`;switch(t){case"number":case"integer":return"The value must be a number";case"boolean":return"The value must be a boolean";case"null":return"The value must be null";case"string":return"The value must be a string";case"object":return"The value must be an object";case"array":return"The value must be an array";default:return t?`The value must be ${t}`:"Invalid value"}}function L(t){return typeof t=="string"?t:JSON.stringify(t)}function He(t){let{fields:e,order:n}=t,r={};return n.forEach((a,i)=>{r[a]=i}),e.sort((a,i)=>{let l=r[a.name]??1/0,s=r[i.name]??1/0;return l!==s?l-s:e.indexOf(a)-e.indexOf(i)})}function de(t){let{schema:e,fields:n}=t;if(typeof e=="boolean")throw new Error("Schema must be an object");return e["x-jsf-order"]!==void 0?He({fields:n,order:e["x-jsf-order"]}):n}function Be(t){return Array.isArray(t.type)?"select":t.type!==void 0?t.type:"text"}function q(t){return t.filter(e=>e!==null&&typeof e=="object").map(e=>{let n=e.title,r=e.const,a=e["x-jsf-presentation"]?.meta,i={label:n||"",value:r};a&&(i.meta=a);let{title:l,const:s,"x-jsf-presentation":d,...h}=e;return{...i,...h}})}function Ue(t){return t.oneOf?q(t.oneOf||[]):t.items?.anyOf?q(t.items.anyOf):t.anyOf?q(t.anyOf):null}var De=["title","type","x-jsf-errorMessage","x-jsf-presentation","oneOf","anyOf","items"];function $(t,e,n=!1){if(typeof t=="boolean")return null;if(t.type==="object"){let s={...t,type:"object"};return j(s,e,n)}if(t.type==="array")throw new TypeError("Array type is not yet supported");let r=t["x-jsf-presentation"]||{},o=t["x-jsf-errorMessage"],a=r.inputType||"text",i={...Object.entries(t).filter(([s])=>!De.includes(s)).reduce((s,[d,h])=>({...s,[d]:h}),{}),type:a,name:e,inputType:a,jsonType:Be(t),required:n,isVisible:!0,...o&&{errorMessage:o}};t.const&&(i.const=t.const,a==="checkbox"&&(i.checkboxValue=t.const)),t.title&&(i.label=t.title),Object.keys(r).length>0&&Object.entries(r).forEach(([s,d])=>{s!=="inputType"&&(i[s]=d)});let l=Ue(t);return l&&(i.options=l),i}function j(t,e,n){let r=[];for(let i in t.properties){let l=t.required?.includes(i)||!1,s=$(t.properties[i],i,l);s&&r.push(s)}let o=de({fields:r,schema:t}),a={...t["x-jsf-presentation"],type:t["x-jsf-presentation"]?.inputType||"fieldset",inputType:t["x-jsf-presentation"]?.inputType||"fieldset",jsonType:"object",name:e,required:n,fields:o,isVisible:!0};return t.title!==void 0&&(a.label=t.title),t["x-jsf-presentation"]?.accept&&(a.accept=t["x-jsf-presentation"]?.accept),a}function ce(t,e,n,r=[]){if(!e.allOf)return[];for(let o=0;o<e.allOf.length;o++){let a=e.allOf[o],i=p(t,a,n,[...r,"allOf",o]);if(i.length>0)return i}return[]}function pe(t,e,n,r=[]){if(!e.anyOf)return[];for(let o of e.anyOf)if(p(t,o,n,r).length===0)return[];return[{path:r,validation:"anyOf"}]}function me(t,e,n,r=[]){if(!e.oneOf)return[];let o=0;for(let a=0;a<e.oneOf.length&&!(p(t,e.oneOf[a],n,r).length===0&&(o++,o>1));a++);return o===0?[{path:r,validation:"oneOf"}]:o>1?[{path:r,validation:"oneOf"}]:[]}function he(t,e,n,r=[]){return e.not===void 0?[]:typeof e.not=="boolean"?e.not?[{path:r,validation:"not"}]:[]:p(t,e.not,n,r).length===0?[{path:r,validation:"not"}]:[]}function ye(t,e,n,r=[]){if(e.if===void 0)return[];let o=p(t,e.if,n,r).length===0;return o&&e.then!==void 0?p(t,e.then,n,[...r,"then"]):!o&&e.else!==void 0?p(t,e.else,n,[...r,"else"]):[]}function y(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function b(t,e){if(typeof t!=typeof e)return!1;if(t===e)return!0;if(t===null||e===null)return!1;if(Array.isArray(t)&&Array.isArray(e))return t.length!==e.length?!1:t.every((n,r)=>b(n,e[r]));if(y(t)&&y(e)){let n=Object.keys(t).sort(),r=Object.keys(e).sort();return n.length!==r.length||!b(n,r)?!1:n.every(o=>b(t[o],e[o]))}return!1}function ge(t,e,n=[]){return e.const===void 0?[]:b(e.const,t)?[]:[{path:n,validation:"const"}]}function Ee(t,e,n=[]){return e.enum===void 0?[]:e.enum.some(r=>b(r,t))?[]:[{path:n,validation:"enum"}]}function Oe(t,e,n=[]){let r=[],o=C(e);return typeof t!="number"?[]:o!==void 0&&!["number","integer"].includes(o)?[]:(e.multipleOf!==void 0&&t%e.multipleOf!==0&&r.push({path:n,validation:"multipleOf"}),e.maximum!==void 0&&t>e.maximum&&r.push({path:n,validation:"maximum"}),e.exclusiveMaximum!==void 0&&t>=e.exclusiveMaximum&&r.push({path:n,validation:"exclusiveMaximum"}),e.minimum!==void 0&&t<e.minimum&&r.push({path:n,validation:"minimum"}),e.exclusiveMinimum!==void 0&&t<=e.exclusiveMinimum&&r.push({path:n,validation:"exclusiveMinimum"}),r)}function Se(t,e,n,r=[]){if(typeof e=="object"&&e.properties&&y(t)){let o=[];for(let[a,i]of Object.entries(e.properties))o.push(...p(t[a],i,n,[...r,a]));return o}return[]}var Ve;(function(t){t["7bit"]="7bit",t["8bit"]="8bit",t.Base64="base64",t.Binary="binary",t.IETFToken="ietf-token",t.QuotedPrintable="quoted-printable",t.XToken="x-token"})(Ve||(Ve={}));var u;(function(t){t.Date="date",t.DateTime="date-time",t.Duration="duration",t.Email="email",t.Hostname="hostname",t.IDNEmail="idn-email",t.IDNHostname="idn-hostname",t.IPv4="ipv4",t.IPv6="ipv6",t.IRI="iri",t.IRIReference="iri-reference",t.JSONPointer="json-pointer",t.JSONPointerURIFragment="json-pointer-uri-fragment",t.RegEx="regex",t.RelativeJSONPointer="relative-json-pointer",t.Time="time",t.URI="uri",t.URIReference="uri-reference",t.URITemplate="uri-template",t.UUID="uuid"})(u||(u={}));var ve;(function(t){t.Array="array",t.Boolean="boolean",t.Integer="integer",t.Null="null",t.Number="number",t.Object="object",t.String="string"})(ve||(ve={}));var c={DATE_TIME:/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:\d{2})$/,DATE:/^\d{4}-\d{2}-\d{2}$/,TIME:/^(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|[+-](?:[01]\d|2[0-3]):[0-5]\d)$/,DURATION:/^P(?!$)(?:\d+Y)?(?:\d+M)?(?:\d+D)?(?:T(?=\d)(?:\d+H)?(?:\d+M)?(?:\d+S)?)?$/,EMAIL:/^[\w.!#$%&'*+/=?^`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i,IDN_EMAIL:/^[^\s@]+@[^\s@][^\s.@]*\.[^\s@]+$/,HOSTNAME:/^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/i,IDN_HOSTNAME:/^[^\s._-].*[^\s._-]$/,IPV6_PART:/^[0-9a-f]{1,4}$/i,PROTOCOL:/^[a-z]+:/,URI_REFERENCE:/^\S*$/,UUID:/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,JSON_POINTER:/^(?:\/(?:[^~/]|~0|~1)*)*$/,JSON_POINTER_URI_FRAGMENT:/^#(?:\/(?:[\w\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,RELATIVE_JSON_POINTER:/^(?:0|[1-9]\d*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,URI_TEMPLATE:/^(?:[!#$&'()*+,/:;=?@\w\-.~]|%[0-9a-f]{2}|\{[+#./;?&=,!@|]?(?:\w|%[0-9a-f]{2})+(?::[1-9]\d{0,3}|\*)?(?:,(?:\w|%[0-9a-f]{2})+(?::[1-9]\d{0,3}|\*)?)*\})*$/i},ke={[u.DateTime]:t=>c.DATE_TIME.test(t),[u.Date]:t=>c.DATE.test(t),[u.Time]:t=>c.TIME.test(t),[u.Duration]:t=>c.DURATION.test(t),[u.Email]:t=>t.length<=254&&c.EMAIL.test(t),[u.IDNEmail]:t=>t.length<=254&&c.IDN_EMAIL.test(t),[u.Hostname]:t=>t.length>255?!1:t.split(".").every(n=>c.HOSTNAME.test(n)),[u.IDNHostname]:t=>t.length>255?!1:t.split(".").every(n=>n.length<=63&&c.IDN_HOSTNAME.test(n)),[u.IPv4]:t=>{let e=t.split(".");return e.length!==4?!1:e.every(n=>{let r=Number.parseInt(n,10);return r>=0&&r<=255&&n===r.toString()})},[u.IPv6]:t=>{let e=t.split(":");if(e.length>8)return!1;let n=!1;return e.every(r=>r===""?n?!1:(n=!0,!0):c.IPV6_PART.test(r))},[u.URI]:t=>{try{let e=new URL(t);return e.protocol!==""&&c.PROTOCOL.test(e.protocol)}catch{return!1}},[u.URIReference]:t=>{try{return t.startsWith("//")?c.URI_REFERENCE.test(t.slice(2)):(new URL(t,"http://example.com"),!0)}catch{return!1}},[u.IRI]:t=>{try{let e=new URL(t);return e.protocol!==""&&c.PROTOCOL.test(e.protocol)}catch{return!1}},[u.IRIReference]:t=>{try{return t.startsWith("//")?c.URI_REFERENCE.test(t.slice(2)):(new URL(t,"http://example.com"),!0)}catch{return!1}},[u.RegEx]:t=>{try{return new RegExp(t,"u"),!0}catch{return!1}},[u.UUID]:t=>c.UUID.test(t),[u.JSONPointer]:t=>c.JSON_POINTER.test(t),[u.JSONPointerURIFragment]:t=>c.JSON_POINTER_URI_FRAGMENT.test(t),[u.RelativeJSONPointer]:t=>c.RELATIVE_JSON_POINTER.test(t),[u.URITemplate]:t=>c.URI_TEMPLATE.test(t)};function be(t,e,n=[]){let r=[];if(typeof t!="string")return r;let o=ke[e];return o&&!o(t)&&r.push({path:n,validation:"format"}),r}function Re(t,e,n=[]){let r=[],o=C(e);if(typeof t!="string")return[];if(o!==void 0&&o!=="string")return[];let a=[...new Intl.Segmenter().segment(t)].length;if(e.minLength!==void 0&&a<e.minLength&&r.push({path:n,validation:"minLength"}),e.maxLength!==void 0&&a>e.maxLength&&r.push({path:n,validation:"maxLength"}),e.pattern!==void 0&&(new RegExp(e.pattern).test(t)||r.push({path:n,validation:"pattern"})),e.format!==void 0){let i=be(t,e.format,n);r.push(...i)}return r}function C(t){if(typeof t=="boolean")return"boolean";if(t.type!==void 0)return t.type}function Le(t,e,n=[]){let r=C(e);if(r===void 0)return[];if(r==="null"&&t===null)return[];let o=t===null?"null":typeof t;if(Array.isArray(r)){if(t===null&&r.includes("null"))return[];for(let a of r){if(o==="number"&&a==="integer"&&Number.isInteger(t))return[];if(o===a||a==="null"&&t===null)return[]}}return o==="number"&&r==="integer"&&Number.isInteger(t)?[]:o===r?[]:[{path:n,validation:"type"}]}function p(t,e,n={},r=[]){let o=t===void 0||t===null&&n.treatNullAsUndefined,a=[];if(o)return[];if(typeof e=="boolean")return!e&&typeof t<"u"?[{path:r,validation:"valid"}]:[];let i=Le(t,e,r);if(i.length>0)return i;if(e.required&&y(t)){let l=e.required.filter(s=>{let d=t[s];return d===void 0||d===null&&n.treatNullAsUndefined});for(let s of l)a.push({path:[...r,s],validation:"required"})}return[...a,...ge(t,e,r),...Ee(t,e,r),...Se(t,e,n,r),...Re(t,e,r),...Oe(t,e,r),...he(t,e,n,r),...ce(t,e,n,r),...pe(t,e,n,r),...me(t,e,n,r),...ye(t,e,n,r)]}function z(t,e,n,r={}){if(y(e)){W(t,e,n,r);for(let o in n.properties){let a=n.properties[o],i=t.find(l=>l.name===o);i?.fields&&W(i.fields,e[o],a,r)}}}function xe(t,e,n,r={}){let a=p(t,n.if,r).length===0,i=!1;return a&&n.if?.required&&(i=n.if.required.some(s=>{if(!e.properties||!e.properties[s])return!1;let d=e.properties[s],h=t[s];return p(h,d,r).some(E=>E.validation==="type")})),{rule:n,matches:a&&!i}}function W(t,e,n,r={}){if(!y(e))return;let o=[];n.if&&o.push(xe(e,n,n,r)),(n.allOf??[]).filter(a=>a.if).forEach(a=>{let i=xe(e,n,a,r);o.push(i)});for(let{rule:a,matches:i}of o)i&&a.then?G(t,e,a.then,r):!i&&a.else&&G(t,e,a.else,r)}function G(t,e,n,r={}){if(n.properties)for(let o in n.properties){let a=n.properties[o],i=t.find(l=>l.name===o);if(i)if(i?.fields)G(i.fields,e,a);else if(a===!1)i.isVisible=!1;else{let l=$(a,o,!0);for(let s in l)["type"].includes(s)||(i[s]=l[s])}}W(t,e,n,r)}function qe(t){let e=[];for(let n=0;n<t.length;n++){let r=t[n];if(["allOf","anyOf","oneOf"].includes(r)){n+1<t.length&&typeof t[n+1]=="number"&&n++;continue}r==="then"||r==="else"||e.push(r)}return e}function We(t){return t.length===0?null:t.reduce((e,n)=>{let{path:r}=n;if(r.length===0)return e[""]=n.message,e;let o=qe(r),a=e;if(o.slice(0,-1).forEach(i=>{(!(i in a)||typeof a[i]=="string")&&(a[i]={}),a=a[i]}),o.length>0){let i=o[o.length-1];a[i]=n.message}else e[""]=n.message;return e},{})}function Ge(t,e,n){let r=t,o=e;for(let a of n)if(typeof r=="object"&&r!==null)if(r.properties&&r.properties[a])r=r.properties[a],y(o)&&(o=o[a]);else if(r.items&&typeof r.items!="boolean")r=r.items,Array.isArray(o)&&(o=o[Number(a)]);else{if(a==="allOf"&&r.allOf)continue;if(a==="anyOf"&&r.anyOf)continue;if(a==="oneOf"&&r.oneOf)continue;if((a==="then"||a==="else")&&r[a]){r=r[a];continue}else if(r.allOf||r.anyOf||r.oneOf){let i=Number(a);r.allOf&&i>=0&&i<r.allOf.length?r=r.allOf[i]:r.anyOf&&i>=0&&i<r.anyOf.length?r=r.anyOf[i]:r.oneOf&&i>=0&&i<r.oneOf.length&&(r=r.oneOf[i])}}return{schema:r,value:o}}function ze(t,e,n){return n.map(r=>{let{schema:o,value:a}=Ge(e,t,r.path);return{...r,message:ue(o,a,r.validation)}})}function Ke(t,e){return typeof e!="object"||!e||!t.length?t:t.map(n=>{if(!n.path.length)return n;let r=typeof e=="object"?e:null,o=null;for(let a of n.path){if(!r||typeof r!="object")break;if(r.properties&&r.properties[a]){let i=r.properties[a];if(typeof i!="boolean")r=i,o=r;else break}else if(r.items&&typeof r.items!="boolean")r=r.items,o=r;else break}return o&&o["x-jsf-errorMessage"]&&o["x-jsf-errorMessage"][n.validation]?{...n,message:o["x-jsf-errorMessage"][n.validation]}:n})}function Ze(t,e,n={}){let r={},o=p(t,e,n),a=ze(t,e,o),i=Ke(a,e),l=We(i);return l&&(r.formErrors=l),r}function Ye(t){let{schema:e}=t;return j(e,"root",!0).fields||[]}function Qe(t,e={}){let n=e.initialValues||{},r=Ye({schema:t});return z(r,n,t),{fields:r,isError:!1,error:null,handleValidation:i=>{let l=Ze(i,t,e.validationOptions);return Ie(r,t),z(r,i,t,e.validationOptions),l}}}function Ie(t,e){t.length=0;let n=j(e,"root",!0).fields||[];t.push(...n);for(let r of t)r.fields&&e.properties?.[r.name]?.type==="object"&&Ie(r.fields,e.properties[r.name])}export{Qe as createHeadlessForm};
|
|
2
2
|
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../node_modules/.pnpm/ret@0.2.2/node_modules/ret/lib/types.js","../node_modules/.pnpm/ret@0.2.2/node_modules/ret/lib/sets.js","../node_modules/.pnpm/ret@0.2.2/node_modules/ret/lib/util.js","../node_modules/.pnpm/ret@0.2.2/node_modules/ret/lib/positions.js","../node_modules/.pnpm/ret@0.2.2/node_modules/ret/lib/index.js","../node_modules/.pnpm/drange@1.1.1/node_modules/drange/lib/index.js","../node_modules/.pnpm/randexp@0.5.3/node_modules/randexp/lib/randexp.js","../src/errors/messages.ts","../src/custom/order.ts","../src/field/schema.ts","../src/field/object.ts","../src/validation/composition.ts","../src/validation/conditions.ts","../src/validation/util.ts","../src/validation/const.ts","../src/validation/enum.ts","../src/validation/number.ts","../src/validation/object.ts","../node_modules/.pnpm/json-schema-typed@8.0.1/node_modules/json-schema-typed/draft-2020-12.ts","../src/validation/format.ts","../src/validation/string.ts","../src/validation/schema.ts","../src/visibility.ts","../src/form.ts"],"sourcesContent":["module.exports = {\n ROOT : 0,\n GROUP : 1,\n POSITION : 2,\n SET : 3,\n RANGE : 4,\n REPETITION : 5,\n REFERENCE : 6,\n CHAR : 7,\n};\n","const types = require('./types');\n\nconst INTS = () => [{ type: types.RANGE , from: 48, to: 57 }];\n\nconst WORDS = () => {\n return [\n { type: types.CHAR, value: 95 },\n { type: types.RANGE, from: 97, to: 122 },\n { type: types.RANGE, from: 65, to: 90 }\n ].concat(INTS());\n};\n\nconst WHITESPACE = () => {\n return [\n { type: types.CHAR, value: 9 },\n { type: types.CHAR, value: 10 },\n { type: types.CHAR, value: 11 },\n { type: types.CHAR, value: 12 },\n { type: types.CHAR, value: 13 },\n { type: types.CHAR, value: 32 },\n { type: types.CHAR, value: 160 },\n { type: types.CHAR, value: 5760 },\n { type: types.RANGE, from: 8192, to: 8202 },\n { type: types.CHAR, value: 8232 },\n { type: types.CHAR, value: 8233 },\n { type: types.CHAR, value: 8239 },\n { type: types.CHAR, value: 8287 },\n { type: types.CHAR, value: 12288 },\n { type: types.CHAR, value: 65279 }\n ];\n};\n\nconst NOTANYCHAR = () => {\n return [\n { type: types.CHAR, value: 10 },\n { type: types.CHAR, value: 13 },\n { type: types.CHAR, value: 8232 },\n { type: types.CHAR, value: 8233 },\n ];\n};\n\n// Predefined class objects.\nexports.words = () => ({ type: types.SET, set: WORDS(), not: false });\nexports.notWords = () => ({ type: types.SET, set: WORDS(), not: true });\nexports.ints = () => ({ type: types.SET, set: INTS(), not: false });\nexports.notInts = () => ({ type: types.SET, set: INTS(), not: true });\nexports.whitespace = () => ({ type: types.SET, set: WHITESPACE(), not: false });\nexports.notWhitespace = () => ({ type: types.SET, set: WHITESPACE(), not: true });\nexports.anyChar = () => ({ type: types.SET, set: NOTANYCHAR(), not: true });\n","const types = require('./types');\nconst sets = require('./sets');\n\n\nconst CTRL = '@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\\\]^ ?';\nconst SLSH = { '0': 0, 't': 9, 'n': 10, 'v': 11, 'f': 12, 'r': 13 };\n\n/**\n * Finds character representations in str and convert all to\n * their respective characters\n *\n * @param {String} str\n * @return {String}\n */\nexports.strToChars = function(str) {\n /* jshint maxlen: false */\n var chars_regex = /(\\[\\\\b\\])|(\\\\)?\\\\(?:u([A-F0-9]{4})|x([A-F0-9]{2})|(0?[0-7]{2})|c([@A-Z[\\\\\\]^?])|([0tnvfr]))/g;\n str = str.replace(chars_regex, function(s, b, lbs, a16, b16, c8, dctrl, eslsh) {\n if (lbs) {\n return s;\n }\n\n var code = b ? 8 :\n a16 ? parseInt(a16, 16) :\n b16 ? parseInt(b16, 16) :\n c8 ? parseInt(c8, 8) :\n dctrl ? CTRL.indexOf(dctrl) :\n SLSH[eslsh];\n\n var c = String.fromCharCode(code);\n\n // Escape special regex characters.\n if (/[[\\]{}^$.|?*+()]/.test(c)) {\n c = '\\\\' + c;\n }\n\n return c;\n });\n\n return str;\n};\n\n\n/**\n * turns class into tokens\n * reads str until it encounters a ] not preceeded by a \\\n *\n * @param {String} str\n * @param {String} regexpStr\n * @return {Array.<Array.<Object>, Number>}\n */\nexports.tokenizeClass = (str, regexpStr) => {\n /* jshint maxlen: false */\n var tokens = [];\n var regexp = /\\\\(?:(w)|(d)|(s)|(W)|(D)|(S))|((?:(?:\\\\)(.)|([^\\]\\\\]))-(?:\\\\)?([^\\]]))|(\\])|(?:\\\\)?([^])/g;\n var rs, c;\n\n\n while ((rs = regexp.exec(str)) != null) {\n if (rs[1]) {\n tokens.push(sets.words());\n\n } else if (rs[2]) {\n tokens.push(sets.ints());\n\n } else if (rs[3]) {\n tokens.push(sets.whitespace());\n\n } else if (rs[4]) {\n tokens.push(sets.notWords());\n\n } else if (rs[5]) {\n tokens.push(sets.notInts());\n\n } else if (rs[6]) {\n tokens.push(sets.notWhitespace());\n\n } else if (rs[7]) {\n tokens.push({\n type: types.RANGE,\n from: (rs[8] || rs[9]).charCodeAt(0),\n to: rs[10].charCodeAt(0),\n });\n\n } else if ((c = rs[12])) {\n tokens.push({\n type: types.CHAR,\n value: c.charCodeAt(0),\n });\n\n } else {\n return [tokens, regexp.lastIndex];\n }\n }\n\n exports.error(regexpStr, 'Unterminated character class');\n};\n\n\n/**\n * Shortcut to throw errors.\n *\n * @param {String} regexp\n * @param {String} msg\n */\nexports.error = (regexp, msg) => {\n throw new SyntaxError('Invalid regular expression: /' + regexp + '/: ' + msg);\n};\n","const types = require('./types');\nexports.wordBoundary = () => ({ type: types.POSITION, value: 'b' });\nexports.nonWordBoundary = () => ({ type: types.POSITION, value: 'B' });\nexports.begin = () => ({ type: types.POSITION, value: '^' });\nexports.end = () => ({ type: types.POSITION, value: '$' });\n","const util = require('./util');\nconst types = require('./types');\nconst sets = require('./sets');\nconst positions = require('./positions');\n\n\nmodule.exports = (regexpStr) => {\n var i = 0, l, c,\n start = { type: types.ROOT, stack: []},\n\n // Keep track of last clause/group and stack.\n lastGroup = start,\n last = start.stack,\n groupStack = [];\n\n\n var repeatErr = (i) => {\n util.error(regexpStr, `Nothing to repeat at column ${i - 1}`);\n };\n\n // Decode a few escaped characters.\n var str = util.strToChars(regexpStr);\n l = str.length;\n\n // Iterate through each character in string.\n while (i < l) {\n c = str[i++];\n\n switch (c) {\n // Handle escaped characters, inclues a few sets.\n case '\\\\':\n c = str[i++];\n\n switch (c) {\n case 'b':\n last.push(positions.wordBoundary());\n break;\n\n case 'B':\n last.push(positions.nonWordBoundary());\n break;\n\n case 'w':\n last.push(sets.words());\n break;\n\n case 'W':\n last.push(sets.notWords());\n break;\n\n case 'd':\n last.push(sets.ints());\n break;\n\n case 'D':\n last.push(sets.notInts());\n break;\n\n case 's':\n last.push(sets.whitespace());\n break;\n\n case 'S':\n last.push(sets.notWhitespace());\n break;\n\n default:\n // Check if c is integer.\n // In which case it's a reference.\n if (/\\d/.test(c)) {\n last.push({ type: types.REFERENCE, value: parseInt(c, 10) });\n\n // Escaped character.\n } else {\n last.push({ type: types.CHAR, value: c.charCodeAt(0) });\n }\n }\n\n break;\n\n\n // Positionals.\n case '^':\n last.push(positions.begin());\n break;\n\n case '$':\n last.push(positions.end());\n break;\n\n\n // Handle custom sets.\n case '[':\n // Check if this class is 'anti' i.e. [^abc].\n var not;\n if (str[i] === '^') {\n not = true;\n i++;\n } else {\n not = false;\n }\n\n // Get all the characters in class.\n var classTokens = util.tokenizeClass(str.slice(i), regexpStr);\n\n // Increase index by length of class.\n i += classTokens[1];\n last.push({\n type: types.SET,\n set: classTokens[0],\n not,\n });\n\n break;\n\n\n // Class of any character except \\n.\n case '.':\n last.push(sets.anyChar());\n break;\n\n\n // Push group onto stack.\n case '(':\n // Create group.\n var group = {\n type: types.GROUP,\n stack: [],\n remember: true,\n };\n\n c = str[i];\n\n // If if this is a special kind of group.\n if (c === '?') {\n c = str[i + 1];\n i += 2;\n\n // Match if followed by.\n if (c === '=') {\n group.followedBy = true;\n\n // Match if not followed by.\n } else if (c === '!') {\n group.notFollowedBy = true;\n\n } else if (c !== ':') {\n util.error(regexpStr,\n `Invalid group, character '${c}'` +\n ` after '?' at column ${i - 1}`);\n }\n\n group.remember = false;\n }\n\n // Insert subgroup into current group stack.\n last.push(group);\n\n // Remember the current group for when the group closes.\n groupStack.push(lastGroup);\n\n // Make this new group the current group.\n lastGroup = group;\n last = group.stack;\n break;\n\n\n // Pop group out of stack.\n case ')':\n if (groupStack.length === 0) {\n util.error(regexpStr, `Unmatched ) at column ${i - 1}`);\n }\n lastGroup = groupStack.pop();\n\n // Check if this group has a PIPE.\n // To get back the correct last stack.\n last = lastGroup.options ?\n lastGroup.options[lastGroup.options.length - 1] : lastGroup.stack;\n break;\n\n\n // Use pipe character to give more choices.\n case '|':\n // Create array where options are if this is the first PIPE\n // in this clause.\n if (!lastGroup.options) {\n lastGroup.options = [lastGroup.stack];\n delete lastGroup.stack;\n }\n\n // Create a new stack and add to options for rest of clause.\n var stack = [];\n lastGroup.options.push(stack);\n last = stack;\n break;\n\n\n // Repetition.\n // For every repetition, remove last element from last stack\n // then insert back a RANGE object.\n // This design is chosen because there could be more than\n // one repetition symbols in a regex i.e. `a?+{2,3}`.\n case '{':\n var rs = /^(\\d+)(,(\\d+)?)?\\}/.exec(str.slice(i)), min, max;\n if (rs !== null) {\n if (last.length === 0) {\n repeatErr(i);\n }\n min = parseInt(rs[1], 10);\n max = rs[2] ? rs[3] ? parseInt(rs[3], 10) : Infinity : min;\n i += rs[0].length;\n\n last.push({\n type: types.REPETITION,\n min,\n max,\n value: last.pop(),\n });\n } else {\n last.push({\n type: types.CHAR,\n value: 123,\n });\n }\n break;\n\n case '?':\n if (last.length === 0) {\n repeatErr(i);\n }\n last.push({\n type: types.REPETITION,\n min: 0,\n max: 1,\n value: last.pop(),\n });\n break;\n\n case '+':\n if (last.length === 0) {\n repeatErr(i);\n }\n last.push({\n type: types.REPETITION,\n min: 1,\n max: Infinity,\n value: last.pop(),\n });\n break;\n\n case '*':\n if (last.length === 0) {\n repeatErr(i);\n }\n last.push({\n type: types.REPETITION,\n min: 0,\n max: Infinity,\n value: last.pop(),\n });\n break;\n\n\n // Default is a character that is not `\\[](){}?+*^$`.\n default:\n last.push({\n type: types.CHAR,\n value: c.charCodeAt(0),\n });\n }\n\n }\n\n // Check if any groups have not been closed.\n if (groupStack.length !== 0) {\n util.error(regexpStr, 'Unterminated group');\n }\n\n return start;\n};\n\nmodule.exports.types = types;\n","'use strict';\n/* eslint indent: 4 */\n\n\n// Private helper class\nclass SubRange {\n constructor(low, high) {\n this.low = low;\n this.high = high;\n this.length = 1 + high - low;\n }\n\n overlaps(range) {\n return !(this.high < range.low || this.low > range.high);\n }\n\n touches(range) {\n return !(this.high + 1 < range.low || this.low - 1 > range.high);\n }\n\n // Returns inclusive combination of SubRanges as a SubRange.\n add(range) {\n return new SubRange(\n Math.min(this.low, range.low),\n Math.max(this.high, range.high)\n );\n }\n\n // Returns subtraction of SubRanges as an array of SubRanges.\n // (There's a case where subtraction divides it in 2)\n subtract(range) {\n if (range.low <= this.low && range.high >= this.high) {\n return [];\n } else if (range.low > this.low && range.high < this.high) {\n return [\n new SubRange(this.low, range.low - 1),\n new SubRange(range.high + 1, this.high)\n ];\n } else if (range.low <= this.low) {\n return [new SubRange(range.high + 1, this.high)];\n } else {\n return [new SubRange(this.low, range.low - 1)];\n }\n }\n\n toString() {\n return this.low == this.high ?\n this.low.toString() : this.low + '-' + this.high;\n }\n}\n\n\nclass DRange {\n constructor(a, b) {\n this.ranges = [];\n this.length = 0;\n if (a != null) this.add(a, b);\n }\n\n _update_length() {\n this.length = this.ranges.reduce((previous, range) => {\n return previous + range.length;\n }, 0);\n }\n\n add(a, b) {\n var _add = (subrange) => {\n var i = 0;\n while (i < this.ranges.length && !subrange.touches(this.ranges[i])) {\n i++;\n }\n var newRanges = this.ranges.slice(0, i);\n while (i < this.ranges.length && subrange.touches(this.ranges[i])) {\n subrange = subrange.add(this.ranges[i]);\n i++;\n }\n newRanges.push(subrange);\n this.ranges = newRanges.concat(this.ranges.slice(i));\n this._update_length();\n }\n\n if (a instanceof DRange) {\n a.ranges.forEach(_add);\n } else {\n if (b == null) b = a;\n _add(new SubRange(a, b));\n }\n return this;\n }\n\n subtract(a, b) {\n var _subtract = (subrange) => {\n var i = 0;\n while (i < this.ranges.length && !subrange.overlaps(this.ranges[i])) {\n i++;\n }\n var newRanges = this.ranges.slice(0, i);\n while (i < this.ranges.length && subrange.overlaps(this.ranges[i])) {\n newRanges = newRanges.concat(this.ranges[i].subtract(subrange));\n i++;\n }\n this.ranges = newRanges.concat(this.ranges.slice(i));\n this._update_length();\n };\n\n if (a instanceof DRange) {\n a.ranges.forEach(_subtract);\n } else {\n if (b == null) b = a;\n _subtract(new SubRange(a, b));\n }\n return this;\n }\n\n intersect(a, b) {\n var newRanges = [];\n var _intersect = (subrange) => {\n var i = 0;\n while (i < this.ranges.length && !subrange.overlaps(this.ranges[i])) {\n i++;\n }\n while (i < this.ranges.length && subrange.overlaps(this.ranges[i])) {\n var low = Math.max(this.ranges[i].low, subrange.low);\n var high = Math.min(this.ranges[i].high, subrange.high);\n newRanges.push(new SubRange(low, high));\n i++;\n }\n };\n\n if (a instanceof DRange) {\n a.ranges.forEach(_intersect);\n } else {\n if (b == null) b = a;\n _intersect(new SubRange(a, b));\n }\n this.ranges = newRanges;\n this._update_length();\n return this;\n }\n\n index(index) {\n var i = 0;\n while (i < this.ranges.length && this.ranges[i].length <= index) {\n index -= this.ranges[i].length;\n i++;\n }\n return this.ranges[i].low + index;\n }\n\n toString() {\n return '[ ' + this.ranges.join(', ') + ' ]';\n }\n\n clone() {\n return new DRange(this);\n }\n\n numbers() {\n return this.ranges.reduce((result, subrange) => {\n var i = subrange.low;\n while (i <= subrange.high) {\n result.push(i);\n i++;\n }\n return result;\n }, []);\n }\n\n subranges() {\n return this.ranges.map((subrange) => ({\n low: subrange.low,\n high: subrange.high,\n length: 1 + subrange.high - subrange.low\n }));\n }\n}\n\nmodule.exports = DRange;\n","const ret = require('ret');\nconst DRange = require('drange');\nconst types = ret.types;\n\n\nmodule.exports = class RandExp {\n /**\n * @constructor\n * @param {RegExp|String} regexp\n * @param {String} m\n */\n constructor(regexp, m) {\n this._setDefaults(regexp);\n if (regexp instanceof RegExp) {\n this.ignoreCase = regexp.ignoreCase;\n this.multiline = regexp.multiline;\n regexp = regexp.source;\n\n } else if (typeof regexp === 'string') {\n this.ignoreCase = m && m.indexOf('i') !== -1;\n this.multiline = m && m.indexOf('m') !== -1;\n } else {\n throw new Error('Expected a regexp or string');\n }\n\n this.tokens = ret(regexp);\n }\n\n\n /**\n * Checks if some custom properties have been set for this regexp.\n *\n * @param {RandExp} randexp\n * @param {RegExp} regexp\n */\n _setDefaults(regexp) {\n // When a repetitional token has its max set to Infinite,\n // randexp won't actually generate a random amount between min and Infinite\n // instead it will see Infinite as min + 100.\n this.max = regexp.max != null ? regexp.max :\n RandExp.prototype.max != null ? RandExp.prototype.max : 100;\n\n // This allows expanding to include additional characters\n // for instance: RandExp.defaultRange.add(0, 65535);\n this.defaultRange = regexp.defaultRange ?\n regexp.defaultRange : this.defaultRange.clone();\n\n if (regexp.randInt) {\n this.randInt = regexp.randInt;\n }\n }\n\n\n /**\n * Generates the random string.\n *\n * @return {String}\n */\n gen() {\n return this._gen(this.tokens, []);\n }\n\n\n /**\n * Generate random string modeled after given tokens.\n *\n * @param {Object} token\n * @param {Array.<String>} groups\n * @return {String}\n */\n _gen(token, groups) {\n var stack, str, n, i, l;\n\n switch (token.type) {\n case types.ROOT:\n case types.GROUP:\n // Ignore lookaheads for now.\n if (token.followedBy || token.notFollowedBy) { return ''; }\n\n // Insert placeholder until group string is generated.\n if (token.remember && token.groupNumber === undefined) {\n token.groupNumber = groups.push(null) - 1;\n }\n\n stack = token.options ?\n this._randSelect(token.options) : token.stack;\n\n str = '';\n for (i = 0, l = stack.length; i < l; i++) {\n str += this._gen(stack[i], groups);\n }\n\n if (token.remember) {\n groups[token.groupNumber] = str;\n }\n return str;\n\n case types.POSITION:\n // Do nothing for now.\n return '';\n\n case types.SET:\n var expandedSet = this._expand(token);\n if (!expandedSet.length) { return ''; }\n return String.fromCharCode(this._randSelect(expandedSet));\n\n case types.REPETITION:\n // Randomly generate number between min and max.\n n = this.randInt(token.min,\n token.max === Infinity ? token.min + this.max : token.max);\n\n str = '';\n for (i = 0; i < n; i++) {\n str += this._gen(token.value, groups);\n }\n\n return str;\n\n case types.REFERENCE:\n return groups[token.value - 1] || '';\n\n case types.CHAR:\n var code = this.ignoreCase && this._randBool() ?\n this._toOtherCase(token.value) : token.value;\n return String.fromCharCode(code);\n }\n }\n\n\n /**\n * If code is alphabetic, converts to other case.\n * If not alphabetic, returns back code.\n *\n * @param {Number} code\n * @return {Number}\n */\n _toOtherCase(code) {\n return code + (97 <= code && code <= 122 ? -32 :\n 65 <= code && code <= 90 ? 32 : 0);\n }\n\n\n /**\n * Randomly returns a true or false value.\n *\n * @return {Boolean}\n */\n _randBool() {\n return !this.randInt(0, 1);\n }\n\n\n /**\n * Randomly selects and returns a value from the array.\n *\n * @param {Array.<Object>} arr\n * @return {Object}\n */\n _randSelect(arr) {\n if (arr instanceof DRange) {\n return arr.index(this.randInt(0, arr.length - 1));\n }\n return arr[this.randInt(0, arr.length - 1)];\n }\n\n\n /**\n * expands a token to a DiscontinuousRange of characters which has a\n * length and an index function (for random selecting)\n *\n * @param {Object} token\n * @return {DiscontinuousRange}\n */\n _expand(token) {\n if (token.type === ret.types.CHAR) {\n return new DRange(token.value);\n } else if (token.type === ret.types.RANGE) {\n return new DRange(token.from, token.to);\n } else {\n let drange = new DRange();\n for (let i = 0; i < token.set.length; i++) {\n let subrange = this._expand(token.set[i]);\n drange.add(subrange);\n if (this.ignoreCase) {\n for (let j = 0; j < subrange.length; j++) {\n let code = subrange.index(j);\n let otherCaseCode = this._toOtherCase(code);\n if (code !== otherCaseCode) {\n drange.add(otherCaseCode);\n }\n }\n }\n }\n if (token.not) {\n return this.defaultRange.clone().subtract(drange);\n } else {\n return this.defaultRange.clone().intersect(drange);\n }\n }\n }\n\n\n /**\n * Randomly generates and returns a number between a and b (inclusive).\n *\n * @param {Number} a\n * @param {Number} b\n * @return {Number}\n */\n randInt(a, b) {\n return a + Math.floor(Math.random() * (1 + b - a));\n }\n\n\n /**\n * Default range of characters to generate from.\n */\n get defaultRange() {\n return this._range = this._range || new DRange(32, 126);\n }\n\n set defaultRange(range) {\n this._range = range;\n }\n\n\n /**\n *\n * Enables use of randexp with a shorter call.\n *\n * @param {RegExp|String| regexp}\n * @param {String} m\n * @return {String}\n */\n static randexp(regexp, m) {\n var randexp;\n if(typeof regexp === 'string') {\n regexp = new RegExp(regexp, m);\n }\n\n if (regexp._randexp === undefined) {\n randexp = new RandExp(regexp, m);\n regexp._randexp = randexp;\n } else {\n randexp = regexp._randexp;\n randexp._setDefaults(regexp);\n }\n return randexp.gen();\n }\n\n\n /**\n * Enables sugary /regexp/.gen syntax.\n */\n static sugar() {\n /* eshint freeze:false */\n RegExp.prototype.gen = function() {\n return RandExp.randexp(this);\n };\n }\n};\n","import type { SchemaValidationErrorType } from '.'\nimport type { JsfSchemaType, NonBooleanJsfSchema, SchemaValue } from '../types'\nimport { randexp } from 'randexp'\n\nexport function getErrorMessage(\n schema: NonBooleanJsfSchema,\n value: SchemaValue,\n validation: SchemaValidationErrorType,\n): string {\n switch (validation) {\n // Core validation\n case 'type':\n return getTypeErrorMessage(schema.type)\n case 'required':\n return 'Required field'\n case 'valid':\n return 'Always fails'\n case 'const':\n return `The only accepted value is ${JSON.stringify(schema.const)}`\n case 'enum':\n return `The option \"${valueToString(value)}\" is not valid.`\n // Schema composition\n case 'anyOf':\n return `The option \"${valueToString(value)}\" is not valid.`\n case 'oneOf':\n return `The option \"${valueToString(value)}\" is not valid.`\n case 'not':\n return 'The value must not satisfy the provided schema'\n // String validation\n case 'minLength':\n return `Please insert at least ${schema.minLength} characters`\n case 'maxLength':\n return `Please insert up to ${schema.maxLength} characters`\n case 'pattern':\n return `Must have a valid format. E.g. ${randexp(schema.pattern || '')}`\n case 'format':\n if (schema.format === 'email') {\n return 'Please enter a valid email address'\n }\n return `Must be a valid ${schema.format} format`\n // Number validation\n case 'multipleOf':\n return `Must be a multiple of ${schema.multipleOf}`\n case 'maximum':\n return `Must be smaller or equal to ${schema.maximum}`\n case 'exclusiveMaximum':\n return `Must be smaller than ${schema.exclusiveMaximum}`\n case 'minimum':\n return `Must be greater or equal to ${schema.minimum}`\n case 'exclusiveMinimum':\n return `Must be greater than ${schema.exclusiveMinimum}`\n }\n}\n\n/**\n * Get the appropriate type error message based on the schema type\n */\nfunction getTypeErrorMessage(schemaType: JsfSchemaType | JsfSchemaType[] | undefined): string {\n if (Array.isArray(schemaType)) {\n // Map 'integer' to 'number' in error messages\n const formattedTypes = schemaType.map((type) => {\n if (type === 'integer')\n return 'number'\n return type\n })\n\n return `The value must be a ${formattedTypes.join(' or ')}`\n }\n\n switch (schemaType) {\n case 'number':\n case 'integer':\n return 'The value must be a number'\n case 'boolean':\n return 'The value must be a boolean'\n case 'null':\n return 'The value must be null'\n case 'string':\n return 'The value must be a string'\n case 'object':\n return 'The value must be an object'\n case 'array':\n return 'The value must be an array'\n default:\n return schemaType ? `The value must be ${schemaType}` : 'Invalid value'\n }\n}\n\nfunction valueToString(value: SchemaValue): string {\n if (typeof value === 'string') {\n return value\n }\n return JSON.stringify(value)\n}\n","import type { Field } from '../field/type'\nimport type { JsfSchema } from '../types'\n\nfunction sort(params: {\n fields: Field[]\n order: string[]\n}): Field[] {\n const { fields: prevFields, order } = params\n\n // Map from field name to expected index\n const indexMap: Record<string, number | undefined> = {}\n order.forEach((key, index) => {\n indexMap[key] = index\n })\n\n const nextFields = prevFields.sort((a, b) => {\n // Compare by index\n const indexA = indexMap[a.name] ?? Infinity\n const indexB = indexMap[b.name] ?? Infinity\n\n // The else actually only happens when both are Infinity,\n // i.e., not specified in the order array\n if (indexA !== indexB)\n return indexA - indexB\n\n // If not specified, maintain original relative order\n return prevFields.indexOf(a) - prevFields.indexOf(b)\n })\n\n return nextFields\n}\n\n/**\n * Sort fields by schema's `x-jsf-order`\n */\nexport function setCustomOrder(params: {\n schema: JsfSchema\n fields: Field[]\n}): Field[] {\n const { schema, fields } = params\n\n // TypeScript does not yield if we remove this check,\n // but it's only because our typing is likely not right.\n // See internal discussion:\n // - https://remote-com.slack.com/archives/C02HTN0LY02/p1738745237733389?thread_ts=1738741631.346809&cid=C02HTN0LY02\n if (typeof schema === 'boolean')\n throw new Error('Schema must be an object')\n\n if (schema['x-jsf-order'] !== undefined)\n return sort({ fields, order: schema['x-jsf-order'] })\n\n return fields\n}\n","import type { JsfObjectSchema, JsfSchema, NonBooleanJsfSchema } from '../types'\nimport type { Field } from './type'\nimport { buildFieldObject } from './object'\n\n/**\n * Get the JSON type for a field\n * @param schema - The non boolean schema of the field\n * @returns The JSON type for the field, based schema type. Default to 'text'\n */\nfunction getJsonType(schema: NonBooleanJsfSchema): string {\n if (Array.isArray(schema.type)) {\n return 'select'\n }\n\n if (schema.type !== undefined) {\n return schema.type as string\n }\n\n return 'text'\n}\n\n/**\n * Convert options to the required format\n * This is used when we have a oneOf or anyOf schema property\n */\nfunction convertToOptions(nodeOptions: JsfSchema[]): Array<{\n label: string\n value: unknown\n [key: string]: unknown\n}> {\n return nodeOptions\n .filter((option): option is NonBooleanJsfSchema =>\n option !== null && typeof option === 'object')\n .map((schemaOption) => {\n const title = schemaOption.title\n const value = schemaOption.const\n const presentation = schemaOption['x-jsf-presentation']\n const meta = presentation?.meta\n\n const result: {\n label: string\n value: unknown\n [key: string]: unknown\n } = {\n label: title || '',\n value,\n }\n\n // Add meta if it exists\n if (meta) {\n result.meta = meta\n }\n\n // Add other properties, without known ones we already handled above\n const { title: _, const: __, 'x-jsf-presentation': ___, ...rest } = schemaOption\n\n return { ...result, ...rest }\n })\n}\n\n/**\n * Get field options from schema\n */\nfunction getFieldOptions(schema: NonBooleanJsfSchema) {\n // Handle oneOf or radio input type\n if (schema.oneOf) {\n return convertToOptions(schema.oneOf || [])\n }\n\n // Handle items.anyOf (for multiple select)\n if (schema.items?.anyOf) {\n return convertToOptions(schema.items.anyOf)\n }\n\n // Handle anyOf\n if (schema.anyOf) {\n return convertToOptions(schema.anyOf)\n }\n\n return null\n}\n\n/**\n * List of schema properties that should be excluded from the final field or handled specially\n */\nconst excludedSchemaProps = [\n 'title', // Transformed to 'label'\n 'type', // Handled separately\n 'x-jsf-errorMessage', // Handled separately\n 'x-jsf-presentation', // Handled separately\n 'oneOf', // Transformed to 'options'\n 'anyOf', // Transformed to 'options'\n 'items', // Handled specially for arrays\n]\n\n/**\n * Build a field from any schema\n */\nexport function buildFieldSchema(\n schema: JsfSchema,\n name: string,\n required: boolean = false,\n): Field | null {\n if (typeof schema === 'boolean') {\n return null\n }\n\n if (schema.type === 'object') {\n const objectSchema: JsfObjectSchema = { ...schema, type: 'object' }\n return buildFieldObject(objectSchema, name, required)\n }\n\n if (schema.type === 'array') {\n throw new TypeError('Array type is not yet supported')\n }\n\n const presentation = schema['x-jsf-presentation'] || {}\n const errorMessage = schema['x-jsf-errorMessage']\n\n // Get input type from presentation or fallback to schema type\n const inputType = presentation.inputType || 'text'\n\n // Build field with all schema properties by default, excluding ones that need special handling\n const field: Field = {\n // Spread all schema properties except excluded ones\n ...Object.entries(schema)\n .filter(([key]) => !excludedSchemaProps.includes(key))\n .reduce((acc, [key, value]) => ({ ...acc, [key]: value }), {}),\n\n // Add required field properties\n type: inputType,\n name,\n inputType,\n jsonType: getJsonType(schema),\n required,\n isVisible: true,\n ...(errorMessage && { errorMessage }),\n }\n\n if (schema.const) {\n field.const = schema.const\n\n if (inputType === 'checkbox') {\n field.checkboxValue = schema.const\n }\n }\n\n if (schema.title) {\n field.label = schema.title\n }\n\n // Spread presentation properties to the root level\n if (Object.keys(presentation).length > 0) {\n Object.entries(presentation).forEach(([key, value]) => {\n // inputType is already handled above\n if (key !== 'inputType') {\n field[key] = value\n }\n })\n }\n\n // Handle options\n const options = getFieldOptions(schema)\n if (options) {\n field.options = options\n }\n\n return field\n}\n","import type { JsfObjectSchema } from '../types'\nimport type { Field } from './type'\nimport { setCustomOrder } from '../custom/order'\nimport { buildFieldSchema } from './schema'\n\n/**\n * Build a field from an object schema\n * @param schema - The schema of the field\n * @param name - The name of the field, used if the schema has no title\n * @param required - Whether the field is required\n * @returns The field\n */\nexport function buildFieldObject(schema: JsfObjectSchema, name: string, required: boolean) {\n const fields: Field[] = []\n\n for (const key in schema.properties) {\n const isRequired = schema.required?.includes(key) || false\n const field = buildFieldSchema(schema.properties[key], key, isRequired)\n if (field) {\n fields.push(field)\n }\n }\n\n const orderedFields = setCustomOrder({ fields, schema })\n\n const field: Field = {\n ...schema['x-jsf-presentation'],\n type: schema['x-jsf-presentation']?.inputType || 'fieldset',\n inputType: schema['x-jsf-presentation']?.inputType || 'fieldset',\n jsonType: 'object',\n name,\n required,\n fields: orderedFields,\n isVisible: true,\n }\n\n if (schema.title !== undefined) {\n field.label = schema.title\n }\n\n if (schema['x-jsf-presentation']?.accept) {\n field.accept = schema['x-jsf-presentation']?.accept\n }\n\n return field\n}\n","/**\n * This module implements JSON Schema composition keywords (allOf, anyOf, oneOf, not).\n * These keywords apply subschemas to the same location in the instance as the parent schema.\n * Each subschema is evaluated independently, and results are combined according to the keyword's logic.\n * @see {@link https://json-schema.org/understanding-json-schema/reference/combining.html Schema Composition}\n */\n\nimport type { ValidationError, ValidationErrorPath } from '../errors'\nimport type { ValidationOptions } from '../form'\nimport type { JsfSchema, SchemaValue } from '../types'\nimport { validateSchema } from './schema'\n\n/**\n * Validate a value against the `allOf` keyword in a schema.\n * The value must validate successfully against ALL schemas in the allOf array.\n * Validation stops at the first schema that fails, returning its errors.\n *\n * @example\n * ```json\n * {\n * \"allOf\": [\n * { \"type\": \"string\" },\n * { \"maxLength\": 5 }\n * ]\n * }\n * ```\n * This schema validates strings with maximum length of 5.\n */\nexport function validateAllOf(\n value: SchemaValue,\n schema: JsfSchema,\n options: ValidationOptions,\n path: ValidationErrorPath = [],\n): ValidationError[] {\n if (!schema.allOf || !Array.isArray(schema.allOf)) {\n return []\n }\n\n for (let i = 0; i < schema.allOf.length; i++) {\n const subSchema = schema.allOf[i]\n const errors = validateSchema(value, subSchema, options, [...path, 'allOf', i])\n if (errors.length > 0) {\n return errors\n }\n }\n\n return []\n}\n\n/**\n * Validate a value against the `anyOf` keyword in a schema.\n * The value must validate successfully against AT LEAST ONE schema in the anyOf array.\n * Returns no errors if any schema validates, otherwise returns a generic anyOf error.\n *\n * @example\n * ```json\n * {\n * \"anyOf\": [\n * { \"type\": \"string\", \"maxLength\": 5 },\n * { \"type\": \"number\", \"minimum\": 0 }\n * ]\n * }\n * ```\n * This schema validates either short strings or positive numbers.\n */\nexport function validateAnyOf(\n value: SchemaValue,\n schema: JsfSchema,\n options: ValidationOptions,\n path: ValidationErrorPath = [],\n): ValidationError[] {\n if (!schema.anyOf || !Array.isArray(schema.anyOf)) {\n return []\n }\n\n for (const subSchema of schema.anyOf) {\n const errors = validateSchema(value, subSchema, options, path)\n if (errors.length === 0) {\n return []\n }\n }\n\n return [\n {\n path,\n validation: 'anyOf',\n },\n ]\n}\n\n/**\n * Validate a value against the `oneOf` keyword in a schema.\n * The value must validate successfully against EXACTLY ONE schema in the oneOf array.\n * Returns an error if no schemas validate or if multiple schemas validate.\n *\n * @example\n * ```json\n * {\n * \"oneOf\": [\n * { \"type\": \"number\", \"multipleOf\": 5 },\n * { \"type\": \"number\", \"multipleOf\": 3 }\n * ]\n * }\n * ```\n * This schema validates numbers that are multiples of either 5 or 3, but not both.\n */\nexport function validateOneOf(\n value: SchemaValue,\n schema: JsfSchema,\n options: ValidationOptions,\n path: ValidationErrorPath = [],\n): ValidationError[] {\n if (!schema.oneOf || !Array.isArray(schema.oneOf)) {\n return []\n }\n\n let validCount = 0\n\n for (let i = 0; i < schema.oneOf.length; i++) {\n const errors = validateSchema(value, schema.oneOf[i], options, path)\n if (errors.length === 0) {\n validCount++\n if (validCount > 1) {\n break\n }\n }\n }\n\n if (validCount === 0) {\n return [\n {\n path,\n validation: 'oneOf',\n },\n ]\n }\n\n if (validCount > 1) {\n return [\n {\n path,\n validation: 'oneOf',\n },\n ]\n }\n\n return []\n}\n\n/**\n * Validate a value against the `not` keyword in a schema.\n * The value must NOT validate successfully against the schema defined by the not keyword.\n * Returns an error if the value validates against the not schema.\n *\n * @example\n * ```json\n * {\n * \"not\": { \"type\": \"string\" }\n * }\n * ```\n * This schema validates any value that is not a string.\n *\n * Note: When the not schema is a boolean:\n * - true: Always returns an error (nothing should validate)\n * - false: Always returns no errors (everything validates)\n */\nexport function validateNot(\n value: SchemaValue,\n schema: JsfSchema,\n options: ValidationOptions,\n path: ValidationErrorPath = [],\n): ValidationError[] {\n if (schema.not === undefined) {\n return []\n }\n\n if (typeof schema.not === 'boolean') {\n return schema.not\n ? [{ path, validation: 'not' }]\n : []\n }\n\n const notErrors = validateSchema(value, schema.not, options, path)\n return notErrors.length === 0\n ? [{ path, validation: 'not' }]\n : []\n}\n","import type { ValidationError, ValidationErrorPath } from '../errors'\nimport type { ValidationOptions } from '../form'\nimport type { NonBooleanJsfSchema, SchemaValue } from '../types'\nimport { validateSchema } from './schema'\n\nexport function validateCondition(\n value: SchemaValue,\n schema: NonBooleanJsfSchema,\n options: ValidationOptions,\n path: ValidationErrorPath = [],\n): ValidationError[] {\n if (schema.if === undefined) {\n return []\n }\n\n const conditionIsTrue = validateSchema(value, schema.if, options, path).length === 0\n\n if (conditionIsTrue && schema.then !== undefined) {\n return validateSchema(value, schema.then, options, [...path, 'then'])\n }\n\n if (!conditionIsTrue && schema.else !== undefined) {\n return validateSchema(value, schema.else, options, [...path, 'else'])\n }\n\n return []\n}\n","import type { ObjectValue, SchemaValue } from '../types'\n\n/**\n * Type guard to check if a given SchemaValue is an ObjectValue\n * @param v - The value to check\n * @returns `true` if the value is an object, `false` otherwise\n */\nexport function isObjectValue(v: SchemaValue): v is ObjectValue {\n return typeof v === 'object' && v !== null && !Array.isArray(v)\n}\n\n/**\n * Compare two values for deep equality\n * @param a - The first value to compare\n * @param b - The second value to compare\n * @returns `true` if the values are equal, `false` otherwise\n * @description This function is compares two values for deep equality.\n * Primitives are compared using strict equality.\n * Arrays are compared element by element using recursion.\n * Objects are compared key by key using recursion.\n */\nexport function deepEqual(a: SchemaValue, b: SchemaValue): boolean {\n if (typeof a !== typeof b) {\n return false\n }\n\n if (a === b) {\n return true\n }\n\n // If both are null, the check above has returned true.\n // If one is null, we return false because we know they are not equal\n // and since `typeof null === 'object'`, we must not let the null value\n // pass through as an object.\n if (a === null || b === null) {\n return false\n }\n\n // Handle arrays\n if (Array.isArray(a) && Array.isArray(b)) {\n // If the array lengths are different, the arrays are not equal\n if (a.length !== b.length) {\n return false\n }\n\n // If all values are equal, the arrays are equal\n return a.every((item, index) => deepEqual(item, b[index]))\n }\n\n // Handle objects\n if (isObjectValue(a) && isObjectValue(b)) {\n const aKeys = Object.keys(a).sort()\n const bKeys = Object.keys(b).sort()\n\n // If the key lengths are different, the objects are not equal\n if (aKeys.length !== bKeys.length) {\n return false\n }\n\n // If the keys are different, the objects are not equal\n if (!deepEqual(aKeys, bKeys)) {\n return false\n }\n\n // Check all values\n return aKeys.every(key => deepEqual(a[key], b[key]))\n }\n\n return false\n}\n","import type { ValidationError, ValidationErrorPath } from '../errors'\nimport type { NonBooleanJsfSchema, SchemaValue } from '../types'\nimport { deepEqual } from './util'\n\n/**\n * Validate that a value is equal to a constant\n * @param value - The value to validate\n * @param schema - The schema to validate against\n * @param path - The path to the value\n * @returns An array of validation errors\n * @description This function validates that a value is equal to a constant.\n * The constant is defined in the `const` property of the schema.\n * The value is validated against the constant using deep equality.\n * @see https://json-schema.org/understanding-json-schema/reference/const\n * @see https://json-schema.org/draft/2020-12/json-schema-validation#name-enum\n */\nexport function validateConst(\n value: SchemaValue,\n schema: NonBooleanJsfSchema,\n path: ValidationErrorPath = [],\n): ValidationError[] {\n if (schema.const === undefined) {\n return []\n }\n\n if (!deepEqual(schema.const, value)) {\n return [\n { path, validation: 'const' },\n ]\n }\n\n return []\n}\n","import type { ValidationError, ValidationErrorPath } from '../errors'\nimport type { NonBooleanJsfSchema, SchemaValue } from '../types'\nimport { deepEqual } from './util'\n\n/**\n * Validate that the value is one of the allowed enum values\n * @param value - The value to validate\n * @param schema - The schema to validate against\n * @param path - The path to the value\n * @returns An array of validation errors\n *\n * @example\n * ```ts\n * validateEnum('foo', { enum: ['foo', 'bar'] }) // []\n * validateEnum('baz', { enum: ['foo', 'bar'] }) // [{ path: [], validation: 'enum', message: 'The option \"baz\" is not valid.' }]\n * ```\n * @see https://json-schema.org/understanding-json-schema/reference/enum\n * @see https://json-schema.org/draft/2020-12/json-schema-validation#name-enum\n */\nexport function validateEnum(\n value: SchemaValue,\n schema: NonBooleanJsfSchema,\n path: ValidationErrorPath = [],\n): ValidationError[] {\n if (schema.enum === undefined) {\n return []\n }\n\n if (!schema.enum.some(enumValue => deepEqual(enumValue, value))) {\n return [\n { path, validation: 'enum' },\n ]\n }\n\n return []\n}\n","import type { ValidationError, ValidationErrorPath } from '../errors'\nimport type { NonBooleanJsfSchema, SchemaValue } from '../types'\nimport { getSchemaType } from './schema'\n\n/**\n * Validate a number against a schema\n * @param value - The value to validate\n * @param schema - The schema to validate against\n * @param path - The path to the current field being validated\n * @returns An array of validation errors\n * @description\n * Implements number validation according to JSON Schema 2020-12:\n * - MultipleOf validation\n * - Maximum validation\n * - ExclusiveMaximum validation\n * - Minimum validation\n * - ExclusiveMinimum validation\n */\nexport function validateNumber(\n value: SchemaValue,\n schema: NonBooleanJsfSchema,\n path: ValidationErrorPath = [],\n): ValidationError[] {\n const errors: ValidationError[] = []\n const schemaType = getSchemaType(schema)\n\n if (typeof value !== 'number') {\n return []\n }\n\n if (schemaType !== undefined && !['number', 'integer'].includes(schemaType as string)) {\n return []\n }\n\n // MultipleOf validation - dividing value by multipleOf must have no remainder\n if (schema.multipleOf !== undefined && value % schema.multipleOf !== 0) {\n errors.push({ path, validation: 'multipleOf' })\n }\n\n // Maximum validation - value must be less than or equal to maximum\n if (schema.maximum !== undefined && value > schema.maximum) {\n errors.push({ path, validation: 'maximum' })\n }\n\n // ExclusiveMaximum validation - value must be less than exclusiveMaximum\n if (schema.exclusiveMaximum !== undefined && value >= schema.exclusiveMaximum) {\n errors.push({ path, validation: 'exclusiveMaximum' })\n }\n\n // Minimum validation - value must be greater than or equal to minimum\n if (schema.minimum !== undefined && value < schema.minimum) {\n errors.push({ path, validation: 'minimum' })\n }\n\n // ExclusiveMinimum validation - value must be greater than exclusiveMinimum\n if (schema.exclusiveMinimum !== undefined && value <= schema.exclusiveMinimum) {\n errors.push({ path, validation: 'exclusiveMinimum' })\n }\n\n return errors\n}\n","import type { ValidationError, ValidationErrorPath } from '../errors'\nimport type { ValidationOptions } from '../form'\nimport type { NonBooleanJsfSchema, SchemaValue } from '../types'\nimport { validateSchema } from './schema'\nimport { isObjectValue } from './util'\n\n/**\n * Validate an object against a schema\n * @param value - The value to validate\n * @param schema - The schema to validate against\n * @param options - The validation options\n * @param path - The path to the current field being validated\n * @returns An array of validation errors\n * @description\n * Validates each property of object against the schema while keeping track of the path to the property.\n * Each property is validated with `validateSchema`.\n */\nexport function validateObject(\n value: SchemaValue,\n schema: NonBooleanJsfSchema,\n options: ValidationOptions,\n path: ValidationErrorPath = [],\n): ValidationError[] {\n if (typeof schema === 'object' && schema.properties && isObjectValue(value)) {\n const errors = []\n for (const [key, propertySchema] of Object.entries(schema.properties)) {\n errors.push(...validateSchema(value[key], propertySchema, options, [...path, key]))\n }\n return errors\n }\n\n return []\n}\n","// @generated\n// This code is automatically generated. Manual editing is not recommended.\n\n/*\n * BSD-2-Clause License\n *\n * Original source code is copyright (c) 2022 Jeremy Rylan\n * <https://github.com/jrylan>\n *\n * Documentation and keyword descriptions are copyright (c) 2020 IETF Trust\n * <https://www.ietf.org/>, Austin Wright <aaa@bzfx.net>, Henry Andrews\n * <andrews_henry@yahoo.com>, Ben Hutton <ben@jsonschema.dev>, and Greg Dennis\n * <gregsdennis@yahoo.com>. All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions are met:\n *\n * 1. Redistributions of source code must retain the above copyright notice,\n * this list of conditions and the following disclaimer.\n *\n * 2. Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation\n * and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\nexport const draft = \"2020-12\" as const;\nexport const $schema = \"https://json-schema.org/draft/2020-12/schema\" as const;\n\ntype MaybeReadonlyArray<T> = Array<T> | ReadonlyArray<T>;\ntype ValueOf<T> = T[keyof T];\n\n/**\n * JSON Schema [Draft 2020-12](https://json-schema.org/draft/2020-12/json-schema-validation.html)\n */\nexport type JSONSchema<\n Value = any,\n SchemaType = Value extends boolean ? \"boolean\"\n : Value extends null ? \"null\"\n : Value extends number ? \"number\" | \"integer\"\n : Value extends string ? \"string\"\n : Value extends unknown[] ? \"array\"\n : Value extends Record<string | number, unknown> ? \"object\"\n : JSONSchema.TypeValue,\n> = boolean | {\n /**\n * Using JSON Pointer fragments requires knowledge of the structure of the\n * schema. When writing schema documents with the intention to provide\n * re-usable schemas, it may be preferable to use a plain name fragment\n * that is not tied to any particular structural location. This allows a\n * subschema to be relocated without requiring JSON Pointer references to\n * be updated.\n *\n * The `$anchor` keyword is used to specify such a fragment. It is an\n * identifier keyword that can only be used to create plain name fragments.\n *\n * If present, the value of this keyword MUST be a string, which MUST start\n * with a letter `[A-Za-z]`, followed by any number of letters, digits\n * `[0-9]`, hyphens `-`, underscores `_`, colons `:`,\n * or periods `.`.\n *\n * Note that the anchor string does not include the `#` character,\n * as it is not a URI-reference. An `{\"$anchor\": \"foo\"}` becomes the\n * fragment `#foo` when used in a URI.\n *\n * The base URI to which the resulting fragment is appended is determined\n * by the `$id` keyword as explained in the previous section.\n * Two `$anchor` keywords in the same schema document MAY have the same\n * value if they apply to different base URIs, as the resulting full URIs\n * will be distinct. However, the effect of two `$anchor` keywords\n * with the same value and the same base URI is undefined. Implementations\n * MAY raise an error if such usage is detected.\n */\n $anchor?: string;\n\n /**\n * This keyword reserves a location for comments from schema authors to\n * readers or maintainers of the schema.\n *\n * The value of this keyword MUST be a string. Implementations MUST NOT\n * present this string to end users. Tools for editing schemas SHOULD\n * support displaying and editing this keyword. The value of this keyword\n * MAY be used in debug or error output which is intended for developers\n * making use of schemas.\n *\n * Schema vocabularies SHOULD allow `$comment` within any object\n * containing vocabulary keywords. Implementations MAY assume `$comment`\n * is allowed unless the vocabulary specifically forbids it. Vocabularies\n * MUST NOT specify any effect of `$comment` beyond what is described in\n * this specification.\n *\n * Tools that translate other media types or programming languages\n * to and from `application/schema+json` MAY choose to convert that media\n * type or programming language's native comments to or from `$comment`\n * values. The behavior of such translation when both native comments and\n * `$comment` properties are present is implementation-dependent.\n *\n * Implementations MAY strip `$comment` values at any point during\n * processing. In particular, this allows for shortening schemas when the\n * size of deployed schemas is a concern.\n *\n * Implementations MUST NOT take any other action based on the presence,\n * absence, or contents of `$comment` properties. In particular, the\n * value of `$comment` MUST NOT be collected as an annotation result.\n */\n $comment?: string;\n\n /**\n * The `$defs` keyword reserves a location for schema authors to inline\n * re-usable JSON Schemas into a more general schema. The keyword does not\n * directly affect the validation result.\n *\n * This keyword's value MUST be an object. Each member value of this object\n * MUST be a valid JSON Schema.\n */\n $defs?: Record<string, JSONSchema>;\n\n /**\n * \"The `$dynamicAnchor` indicates that the fragment is an extension\n * point when used with the `$dynamicRef` keyword. This low-level,\n * advanced feature makes it easier to extend recursive schemas such as the\n * meta-schemas, without imposing any particular semantics on that\n * extension. See `$dynamicRef` for more details.\n */\n $dynamicAnchor?: string;\n\n /**\n * The `$dynamicRef` keyword is an applicator that allows for deferring\n * the full resolution until runtime, at which point it is resolved each\n * time it is encountered while evaluating an instance.\n *\n * Together with `$dynamicAnchor`, `$dynamicRef` implements a\n * cooperative extension mechanism that is primarily useful with recursive\n * schemas (schemas that reference themselves). Both the extension point\n * and the runtime-determined extension target are defined with\n * `$dynamicAnchor`, and only exhibit runtime dynamic behavior when\n * referenced with `$dynamicRef`.\n *\n * The value of the `$dynamicRef` property MUST be a string which is\n * a URI-Reference. Resolved against the current URI base, it produces\n * the URI used as the starting point for runtime resolution. This initial\n * resolution is safe to perform on schema load.\n *\n * If the initially resolved starting point URI includes a fragment that\n * was created by the `$dynamicAnchor` keyword, the initial URI MUST be\n * replaced by the URI (including the fragment) for the outermost schema\n * resource in the [dynamic scope][scopes] that defines\n * an identically named fragment with `$dynamicAnchor`.\n *\n * Otherwise, its behavior is identical to `$ref`, and no runtime\n * resolution is needed.\n *\n * [scopes]: https://json-schema.org/draft/2020-12/json-schema-core.html#scopes\n *\n * @format \"uri-reference\"\n */\n $dynamicRef?: string;\n\n /**\n * The `$id` keyword identifies a schema resource with its\n * [canonical][[RFC6596]] URI.\n *\n * Note that this URI is an identifier and not necessarily a network\n * locator. In the case of a network-addressable URL, a schema need not be\n * downloadable from its canonical URI.\n *\n * If present, the value for this keyword MUST be a string, and MUST\n * represent a valid [URI-reference][RFC3986]. This URI-reference SHOULD\n * be normalized, and MUST resolve to an [absolute-URI][RFC3986] (without a\n * fragment). Therefore, `$id` MUST NOT contain a non-empty fragment,\n * and SHOULD NOT contain an empty fragment.\n *\n * Since an empty fragment in the context of the\n * `application/schema+json` media type refers to the same resource as\n * the base URI without a fragment, an implementation MAY normalize a URI\n * ending with an empty fragment by removing the fragment. However, schema\n * authors SHOULD NOT rely on this behavior across implementations.\n *\n * This URI also serves as the base URI for relative URI-references in\n * keywords within the schema resource, in accordance with\n * [RFC 3986][RFC3986] section 5.1.1 regarding base URIs embedded in\n * content.\n *\n * The presence of `$id` in a subschema indicates that the subschema\n * constitutes a distinct schema resource within a single schema document.\n * Furthermore, in accordance with [RFC 3986][RFC3986] section 5.1.2\n * regarding encapsulating entities, if an `$id` in a subschema is a\n * relative URI-reference, the base URI for resolving that reference is the\n * URI of the parent schema resource.\n *\n * If no parent schema object explicitly identifies itself as a resource\n * with `$id`, the base URI is that of the entire document.\n *\n * The root schema of a JSON Schema document SHOULD contain an `$id`\n * keyword with an [absolute-URI][RFC3986] (containing a scheme, but no\n * fragment).\n *\n * [RFC6596]: https://datatracker.ietf.org/doc/html/rfc6596\n * [RFC3986]: https://datatracker.ietf.org/doc/html/rfc3986\n *\n * @format \"uri-reference\"\n */\n $id?: string;\n\n /**\n * The `$ref` keyword is an applicator that is used to reference a\n * statically identified schema. Its results are the results of the\n * referenced schema. Other keywords can appear alongside of `$ref` in\n * the same schema object.\n *\n * The value of the `$ref` property MUST be a string which is a\n * URI-Reference. Resolved against the current URI base, it produces the\n * URI of the schema to apply.\n *\n * @format \"uri-reference\"\n */\n $ref?: string;\n\n /**\n * The `$schema` keyword is both used as a JSON Schema dialect identifier\n * and as the identifier of a resource which is itself a JSON Schema, which\n * describes the set of valid schemas written for this particular dialect.\n *\n * The value of this keyword MUST be a [URI][RFC3986] (containing a scheme)\n * and this URI MUST be normalized. The current schema MUST be valid\n * against the meta-schema identified by this URI.\n *\n * If this URI identifies a retrievable resource, that resource SHOULD be\n * of media type `application/schema+json`.\n *\n * The `$schema` keyword SHOULD be used in the document root schema\n * object, and MAY be used in the root schema objects of embedded schema\n * resources. It MUST NOT appear in non-resource root schema objects. If\n * absent from the document root schema, the resulting behavior is\n * implementation-defined.\n *\n * Values for this property are defined elsewhere in this and other\n * documents, and by other parties.\n *\n * [RFC3986]: https://datatracker.ietf.org/doc/html/rfc3986\n *\n * @format \"uri\"\n */\n $schema?: string;\n\n /**\n * The `$vocabulary` keyword is used in meta-schemas to identify the\n * vocabularies available for use in schemas described by that meta-schema.\n * It is also used to indicate whether each vocabulary is required or\n * optional, in the sense that an implementation MUST understand the\n * required vocabularies in order to successfully process the schema.\n * Together, this information forms a dialect. Any vocabulary that is\n * understood by the implementation MUST be processed in a manner\n * consistent with the semantic definitions contained within the\n * vocabulary.\n *\n * The value of this keyword MUST be an object. The property names in the\n * object MUST be URIs (containing a scheme) and this URI MUST be\n * normalized. Each URI that appears as a property name identifies a\n * specific set of keywords and their semantics.\n *\n * The URI MAY be a URL, but the nature of the retrievable resource is\n * currently undefined, and reserved for future use. Vocabulary authors\n * MAY use the URL of the vocabulary specification, in a human-readable\n * media type such as `text/html` or `text/plain`, as the vocabulary\n * URI.\n *\n * The values of the object properties MUST be booleans. If the value is\n * `true`, then implementations that do not recognize the vocabulary MUST\n * refuse to process any schemas that declare this meta-schema with\n * `$schema`. If the value is `false`, implementations that do not\n * recognize the vocabulary SHOULD proceed with processing such schemas.\n * The value has no impact if the implementation understands the\n * vocabulary.\n *\n * Unrecognized keywords SHOULD be ignored. This remains the case for\n * keywords defined by unrecognized vocabularies. It is not currently\n * possible to distinguish between unrecognized keywords that are defined\n * in vocabularies from those that are not part of any vocabulary.\n *\n * The `$vocabulary` keyword SHOULD be used in the root schema of any\n * schema document intended for use as a meta-schema. It MUST NOT appear\n * in subschemas.\n *\n * The `$vocabulary` keyword MUST be ignored in schema documents that are\n * not being processed as a meta-schema.\n */\n $vocabulary?: Record<string, string>;\n\n /**\n * @deprecated `additionalItems` has been deprecated in favor of `prefixItems`\n * paired with `items`.\n */\n additionalItems?: JSONSchema;\n\n /**\n * The value of `additionalProperties` MUST be a valid JSON Schema.\n *\n * The behavior of this keyword depends on the presence and annotation\n * results of `properties` and `patternProperties` within the same\n * schema object. Validation with `additionalProperties` applies only to\n * the child values of instance names that do not appear in the annotation\n * results of either `properties` or `patternProperties`.\n *\n * For all such properties, validation succeeds if the child instance\n * validates against the `additionalProperties` schema.\n *\n * The annotation result of this keyword is the set of instance property\n * names validated by this keyword's subschema. Annotation results for\n * `additionalProperties` keywords from multiple schemas applied to the\n * same instance location are combined by taking the union of the sets.\n *\n * Omitting this keyword has the same assertion behavior as an empty\n * schema.\n *\n * Implementations MAY choose to implement or optimize this keyword in\n * another way that produces the same effect, such as by directly checking\n * the names in `properties` and the patterns in `patternProperties`\n * against the instance property set.\n */\n additionalProperties?: JSONSchema;\n\n /**\n * This keyword's value MUST be a non-empty array. Each item of the array\n * MUST be a valid JSON Schema.\n *\n * An instance validates successfully against this keyword if it validates\n * successfully against all schemas defined by this keyword's value.\n */\n allOf?: MaybeReadonlyArray<JSONSchema<Value, SchemaType>>;\n\n /**\n * This keyword's value MUST be a non-empty array. Each item of the array\n * MUST be a valid JSON Schema.\n *\n * An instance validates successfully against this keyword if it validates\n * successfully against at least one schema defined by this keyword's\n * value.\n */\n anyOf?: MaybeReadonlyArray<JSONSchema<Value, SchemaType>>;\n\n /**\n * An instance validates successfully against this keyword if its value is\n * equal to the value of the keyword.\n *\n * Use of this keyword is functionally equivalent to the `enum` keyword\n * with a single value.\n */\n const?: Value;\n\n /**\n * The value of this keyword MUST be a valid JSON Schema.\n *\n * An array instance is valid against `contains` if at least one of its\n * elements is valid against the given schema. The subschema MUST be\n * applied to every array element even after the first match has been\n * found, in order to collect annotations for use by other keywords.\n * This is to ensure that all possible annotations are collected.\n *\n * Logically, the validation result of applying the value subschema to each\n * item in the array MUST be OR'ed with `false`, resulting in an overall\n * validation result.\n *\n * This keyword produces an annotation value which is an array of the\n * indexes to which this keyword validates successfully when applying its\n * subschema, in ascending order. The value MAY be a boolean `true` if\n * the subschema validates successfully when applied to every index of the\n * instance. The annotation MUST be present if the instance array to which\n * this keyword's schema applies is empty.\n */\n contains?: JSONSchema<Value, SchemaType>;\n\n /**\n * If the instance value is a string, this property defines that the\n * string SHOULD be interpreted as binary data and decoded using the\n * encoding named by this property. [RFC 2045, Sec 6.1][RFC2045] lists the\n * possible values for this property.\n *\n * The value of this property SHOULD be ignored if the instance described\n * is not a string.\n *\n * If this keyword is absent, but `contentMediaType` is present, this\n * indicates that the media type could be encoded into `UTF-8` like any\n * other JSON string value, and does not require additional decoding.\n *\n * The value of this property MUST be a string.\n *\n * [RFC2045]: https://datatracker.ietf.org/doc/html/rfc2045#section-6.1\n */\n contentEncoding?:\n | \"7bit\"\n | \"8bit\"\n | \"base64\"\n | \"binary\"\n | \"ietf-token\"\n | \"quoted-printable\"\n | \"x-token\";\n\n /**\n * If the instance is a string, this property indicates the media type\n * of the contents of the string. If `contentEncoding` is present,\n * this property describes the decoded string.\n *\n * The value of this property must be a media type, as defined by\n * [RFC 2046][RFC2046]. This property defines the media type of instances\n * which this schema defines.\n *\n * The value of this property SHOULD be ignored if the instance described\n * is not a string.\n *\n * If the `contentEncoding` property is not present, but the instance\n * value is a string, then the value of this property SHOULD specify a text\n * document type, and the character set SHOULD be the character set into\n * which the JSON string value was decoded (for which the default is\n * Unicode).\n *\n * [RFC2046]: https://datatracker.ietf.org/doc/html/rfc2046\n */\n contentMediaType?: string;\n\n /**\n * If the instance is a string, and if `contentMediaType` is present,\n * this property contains a schema which describes the structure of the\n * string.\n *\n * This keyword MAY be used with any media type that can be mapped into\n * JSON Schema's data model.\n *\n * The value of this property MUST be a valid JSON schema. It SHOULD be\n * ignored if `contentMediaType` is not present.\n */\n contentSchema?: JSONSchema<Value, SchemaType>;\n\n /**\n * This keyword can be used to supply a default JSON value associated with\n * a particular schema. It is RECOMMENDED that a `default` value be valid\n * against the associated schema.\n */\n default?: Value;\n\n /**\n * @deprecated `definitions` has been renamed to `$defs`.\n */\n definitions?: Record<string, JSONSchema>;\n\n /**\n * @deprecated `dependencies` has been split into two keywords:\n * `dependentSchemas` and `dependentRequired`.\n */\n dependencies?: Record<string, MaybeReadonlyArray<string> | JSONSchema>;\n\n /**\n * The value of this keyword MUST be an object. Properties in\n * this object, if any, MUST be arrays. Elements in each array,\n * if any, MUST be strings, and MUST be unique.\n *\n * This keyword specifies properties that are required if a specific\n * other property is present. Their requirement is dependent on the\n * presence of the other property.\n *\n * Validation succeeds if, for each name that appears in both\n * the instance and as a name within this keyword's value, every\n * item in the corresponding array is also the name of a property\n * in the instance.\n *\n * Omitting this keyword has the same behavior as an empty object.\n */\n dependentRequired?: Record<string, MaybeReadonlyArray<string>>;\n\n /**\n * This keyword specifies subschemas that are evaluated if the instance is\n * an object and contains a certain property.\n *\n * This keyword's value MUST be an object. Each value in the object MUST be\n * a valid JSON Schema.\n *\n * If the object key is a property in the instance, the entire instance\n * must validate against the subschema. Its use is dependent on the\n * presence of the property.\n *\n * Omitting this keyword has the same behavior as an empty object.\n */\n dependentSchemas?: Record<string, JSONSchema>;\n\n /**\n * The value of this keyword MUST be a boolean. When multiple occurrences\n * of this keyword are applicable to a single sub-instance, applications\n * SHOULD consider the instance location to be deprecated if any occurrence\n * specifies a `true` value.\n *\n * If `deprecated` has a value of boolean `true`, it indicates that\n * applications SHOULD refrain from usage of the declared property. It MAY\n * mean the property is going to be removed in the future.\n *\n * A root schema containing `deprecated` with a value of `true`\n * indicates that the entire resource being described MAY be removed in the\n * future.\n *\n * The `deprecated` keyword applies to each instance location to which\n * the schema object containing the keyword successfully applies. This can\n * result in scenarios where every array item or object property is\n * deprecated even though the containing array or object is not.\n *\n * Omitting this keyword has the same behavior as a value of `false`.\n */\n deprecated?: boolean;\n\n /**\n * Can be used to decorate a user interface with explanation or information\n * about the data produced.\n */\n description?: string;\n\n /**\n * This keyword's value MUST be a valid JSON Schema.\n *\n * When `if` is present, and the instance fails to validate against its\n * subschema, then validation succeeds against this keyword if the instance\n * successfully validates against this keyword's subschema.\n *\n * This keyword has no effect when `if` is absent, or when the instance\n * successfully validates against its subschema. Implementations MUST NOT\n * evaluate the instance against this keyword, for either validation or\n * annotation collection purposes, in such cases.\n */\n else?: JSONSchema<Value, SchemaType>;\n\n /**\n * The value of this keyword MUST be an array. This array SHOULD have at\n * least one element. Elements in the array SHOULD be unique.\n *\n * An instance validates successfully against this keyword if its value is\n * equal to one of the elements in this keyword's array value.\n *\n * Elements in the array might be of any type, including `null`.\n */\n enum?: MaybeReadonlyArray<Value>;\n\n /**\n * The value of this keyword MUST be an array. When multiple occurrences of\n * this keyword are applicable to a single sub-instance, implementations\n * MUST provide a flat array of all values rather than an array of arrays.\n *\n * This keyword can be used to provide sample JSON values associated with a\n * particular schema, for the purpose of illustrating usage. It is\n * RECOMMENDED that these values be valid against the associated schema.\n *\n * Implementations MAY use the value(s) of `default`, if present, as an\n * additional example. If `examples` is absent, `default` MAY still be\n * used in this manner.\n */\n examples?: MaybeReadonlyArray<Value>;\n\n /**\n * The value of `exclusiveMaximum` MUST be a number, representing an\n * exclusive upper limit for a numeric instance.\n *\n * If the instance is a number, then the instance is valid only if it has a\n * value strictly less than (not equal to) `exclusiveMaximum`.\n */\n exclusiveMaximum?: number;\n\n /**\n * The value of `exclusiveMinimum` MUST be a number, representing an\n * exclusive lower limit for a numeric instance.\n *\n * If the instance is a number, then the instance is valid only if it has a\n * value strictly greater than (not equal to) `exclusiveMinimum`.\n */\n exclusiveMinimum?: number;\n\n /**\n * Implementations MAY treat `format` as an assertion in addition to an\n * annotation, and attempt to validate the value's conformance to the\n * specified semantics.\n *\n * The value of this keyword is called a format attribute. It MUST be a\n * string. A format attribute can generally only validate a given set\n * of instance types. If the type of the instance to validate is not in\n * this set, validation for this format attribute and instance SHOULD\n * succeed. Format attributes are most often applied to strings, but can\n * be specified to apply to any type.\n *\n * Implementations MAY support custom format attributes. Save for agreement\n * between parties, schema authors SHALL NOT expect a peer implementation\n * to support such custom format attributes. An implementation MUST NOT\n * fail validation or cease processing due to an unknown format attribute.\n * When treating `format` as an annotation, implementations SHOULD\n * collect both known and unknown format attribute values.\n */\n format?: string;\n\n /**\n * This keyword's value MUST be a valid JSON Schema.\n *\n * This validation outcome of this keyword's subschema has no direct effect\n * on the overall validation result. Rather, it controls which of the\n * `then` or `else` keywords are evaluated.\n *\n * Instances that successfully validate against this keyword's subschema\n * MUST also be valid against the subschema value of the `then` keyword,\n * if present.\n *\n * Instances that fail to validate against this keyword's subschema MUST\n * also be valid against the subschema value of the `else` keyword, if\n * present.\n *\n * If annotations are being collected, they are collected\n * from this keyword's subschema in the usual way, including when the\n * keyword is present without either `then` or `else`.\n */\n if?: JSONSchema<Value, SchemaType>;\n\n /**\n * The value of `items` MUST be a valid JSON Schema.\n *\n * This keyword applies its subschema to all instance elements at indexes\n * greater than the length of the `prefixItems` array in the same schema\n * object, as reported by the annotation result of that `prefixItems`\n * keyword. If no such annotation result exists, `items` applies its\n * subschema to all instance array elements.\n *\n * Note that the behavior of `items` without `prefixItems` is identical\n * to that of the schema form of `items` in prior drafts.\n *\n * When `prefixItems` is present, the behavior of `items` is identical\n * to the former `additionalItems` keyword.\n *\n * If the `items` subschema is applied to any positions within the\n * instance array, it produces an annotation result of boolean `true`,\n * indicating that all remaining array elements have been evaluated against\n * this keyword's subschema.\n *\n * Omitting this keyword has the same assertion behavior as an empty\n * schema.\n *\n * Implementations MAY choose to implement or optimize this keyword\n * in another way that produces the same effect, such as by directly\n * checking for the presence and size of a `prefixItems` array.\n */\n items?: JSONSchema;\n\n /**\n * The value of this keyword MUST be a non-negative integer.\n *\n * If `contains` is not present within the same schema object, then this\n * keyword has no effect.\n *\n * An instance array is valid against `maxContains` in two ways,\n * depending on the form of the annotation result of an adjacent\n * `contains` keyword. The first way is if the annotation result is an\n * array and the length of that array is less than or equal to the\n * `maxContains` value. The second way is if the annotation result is a\n * boolean `true` and the instance array length is less than or equal to\n * the `maxContains` value.\n */\n maxContains?: number;\n\n /**\n * The value of `maximum` MUST be a number, representing an inclusive\n * upper limit for a numeric instance.\n *\n * If the instance is a number, then this keyword validates only if the\n * instance is less than or exactly equal to `maximum`.\n */\n maximum?: number;\n\n /**\n * The value of this keyword MUST be a non-negative integer.\n *\n * An array instance is valid against `maxItems` if its size is less\n * than, or equal to, the value of this keyword.\n *\n * @minimum 0\n */\n maxItems?: number;\n\n /**\n * The value of this keyword MUST be a non-negative integer.\n *\n * A string instance is valid against this keyword if its length is less\n * than, or equal to, the value of this keyword.\n *\n * The length of a string instance is defined as the number of its\n * characters as defined by [RFC 8259][RFC8259].\n *\n * [RFC8259]: https://datatracker.ietf.org/doc/html/rfc8259\n *\n * @minimum 0\n */\n maxLength?: number;\n\n /**\n * The value of this keyword MUST be a non-negative integer.\n *\n * An object instance is valid against `maxProperties` if its number of\n * `properties` is less than, or equal to, the value of this keyword.\n *\n * @minimum 0\n */\n maxProperties?: number;\n\n /**\n * The value of this keyword MUST be a non-negative integer.\n *\n * If `contains` is not present within the same schema object, then this\n * keyword has no effect.\n *\n * An instance array is valid against `minContains` in two ways,\n * depending on the form of the annotation result of an adjacent\n * `contains` keyword. The first way is if the annotation result is an\n * array and the length of that array is greater than or equal to the\n * `minContains` value. The second way is if the annotation result is a\n * boolean `true` and the instance array length is greater than or equal\n * to the `minContains` value.\n *\n * A value of `0` is allowed, but is only useful for setting a range\n * of occurrences from `0` to the value of `maxContains`. A value of\n * `0` with no `maxContains` causes `contains` to always pass\n * validation.\n *\n * Omitting this keyword has the same behavior as a value of `1`.\n *\n * @default 1\n */\n minContains?: number;\n\n /**\n * The value of `minimum` MUST be a number, representing an inclusive\n * lower limit for a numeric instance.\n *\n * If the instance is a number, then this keyword validates only if the\n * instance is greater than or exactly equal to `minimum`.\n */\n minimum?: number;\n\n /**\n * The value of this keyword MUST be a non-negative integer.\n *\n * An array instance is valid against `minItems` if its size is greater\n * than, or equal to, the value of this keyword.\n *\n * Omitting this keyword has the same behavior as a value of `0`.\n *\n * @default 0\n * @minimum 0\n */\n minItems?: number;\n\n /**\n * The value of this keyword MUST be a non-negative integer.\n *\n * A string instance is valid against this keyword if its length is greater\n * than, or equal to, the value of this keyword.\n *\n * The length of a string instance is defined as the number of its\n * characters as defined by [RFC 8259][RFC8259].\n *\n * Omitting this keyword has the same behavior as a value of `0`.\n *\n * [RFC8259]: https://datatracker.ietf.org/doc/html/rfc8259\n *\n * @default 0\n * @minimum 0\n */\n minLength?: number;\n\n /**\n * The value of this keyword MUST be a non-negative integer.\n *\n * An object instance is valid against `minProperties` if its number of\n * `properties` is greater than, or equal to, the value of this keyword.\n *\n * Omitting this keyword has the same behavior as a value of `0`.\n *\n * @default 0\n * @minimum 0\n */\n minProperties?: number;\n\n /**\n * The value of `multipleOf` MUST be a number, strictly greater than\n * `0`.\n *\n * A numeric instance is valid only if division by this keyword's value\n * results in an integer.\n *\n * @exclusiveMinimum 0\n */\n multipleOf?: number;\n\n /**\n * This keyword's value MUST be a valid JSON Schema.\n *\n * An instance is valid against this keyword if it fails to validate\n * successfully against the schema defined by this keyword.\n */\n not?: JSONSchema<Value, SchemaType>;\n\n /**\n * This keyword's value MUST be a non-empty array. Each item of the array\n * MUST be a valid JSON Schema.\n *\n * An instance validates successfully against this keyword if it validates\n * successfully against exactly one schema defined by this keyword's value.\n */\n oneOf?: MaybeReadonlyArray<JSONSchema<Value, SchemaType>>;\n\n /**\n * The value of this keyword MUST be a string. This string SHOULD be a\n * valid regular expression, according to the [ECMA-262][ecma262] regular\n * expression dialect.\n *\n * A string instance is considered valid if the regular expression matches\n * the instance successfully. Recall: regular expressions are not\n * implicitly anchored.\n *\n * [ecma262]: https://www.ecma-international.org/publications-and-standards/standards/ecma-262/\n *\n * @format \"regex\"\n */\n pattern?: string;\n\n /**\n * The value of `patternProperties` MUST be an object. Each property name\n * of this object SHOULD be a valid regular expression, according to the\n * [ECMA-262][ecma262] regular expression dialect. Each property value of\n * this object MUST be a valid JSON Schema.\n *\n * Validation succeeds if, for each instance name that matches any regular\n * expressions that appear as a property name in this keyword's value,\n * the child instance for that name successfully validates against each\n * schema that corresponds to a matching regular expression.\n *\n * The annotation result of this keyword is the set of instance property\n * names matched by this keyword. Omitting this keyword has the same\n * assertion behavior as an empty object.\n *\n * [ecma262]: https://www.ecma-international.org/publications-and-standards/standards/ecma-262/\n */\n patternProperties?: Record<string, JSONSchema>;\n\n /**\n * The value of `prefixItems` MUST be a non-empty array of valid JSON\n * Schemas.\n *\n * Validation succeeds if each element of the instance validates against\n * the schema at the same position, if any. This keyword does not\n * constrain the length of the array. If the array is longer than this\n * keyword's value, this keyword validates only the prefix of matching\n * length.\n *\n * This keyword produces an annotation value which is the largest index to\n * which this keyword applied a subschema. The value MAY be a boolean\n * `true` if a subschema was applied to every index of the instance, such\n * as is produced by the `items` keyword.\n * This annotation affects the behavior of `items` and\n * `unevaluatedItems`.\n *\n * Omitting this keyword has the same assertion behavior as an empty array.\n */\n prefixItems?: MaybeReadonlyArray<JSONSchema> | JSONSchema;\n\n /**\n * The value of `properties` MUST be an object. Each value of this object\n * MUST be a valid JSON Schema.\n *\n * Validation succeeds if, for each name that appears in both the instance\n * and as a name within this keyword's value, the child instance for that\n * name successfully validates against the corresponding schema.\n *\n * The annotation result of this keyword is the set of instance property\n * names matched by this keyword.\n *\n * Omitting this keyword has the same assertion behavior as an empty\n * object.\n */\n properties?: Record<string, JSONSchema>;\n\n /**\n * The value of `propertyNames` MUST be a valid JSON Schema.\n *\n * If the instance is an object, this keyword validates if every property\n * name in the instance validates against the provided schema.\n * Note the property name that the schema is testing will always be a\n * string.\n *\n * Omitting this keyword has the same behavior as an empty schema.\n */\n propertyNames?: JSONSchema;\n\n /**\n * The value of this keyword MUST be a boolean. When multiple occurrences\n * of this keyword are applicable to a single sub-instance, the resulting\n * value MUST be `true` if any occurrence specifies a `true` value, and\n * MUST be `false` otherwise.\n *\n * If `readOnly` has a value of boolean `true`, it indicates that the\n * value of the instance is managed exclusively by the owning authority,\n * and attempts by an application to modify the value of this property are\n * expected to be ignored or rejected by that owning authority.\n *\n * An instance document that is marked as `readOnly` for the entire\n * document MAY be ignored if sent to the owning authority, or MAY result\n * in an error, at the authority's discretion.\n *\n * For example, `readOnly` would be used to mark a database-generated\n * serial number as read-only.\n *\n * This keyword can be used to assist in user interface instance\n * generation.\n *\n * @default false\n */\n readOnly?: boolean;\n\n /**\n * The value of this keyword MUST be an array. Elements of this array, if\n * any, MUST be strings, and MUST be unique.\n *\n * An object instance is valid against this keyword if every item in the\n * array is the name of a property in the instance.\n *\n * Omitting this keyword has the same behavior as an empty array.\n */\n required?: MaybeReadonlyArray<string>;\n\n /**\n * This keyword's value MUST be a valid JSON Schema.\n *\n * When `if` is present, and the instance successfully validates against\n * its subschema, then validation succeeds against this keyword if the\n * instance also successfully validates against this keyword's subschema.\n *\n * This keyword has no effect when `if` is absent, or when the instance\n * fails to validate against its subschema. Implementations MUST NOT\n * evaluate the instance against this keyword, for either validation or\n * annotation collection purposes, in such cases.\n */\n then?: JSONSchema<Value, SchemaType>;\n\n /**\n * Can be used to decorate a user interface with a short label about the\n * data produced.\n */\n title?: string;\n\n /**\n * The value of this keyword MUST be either a string or an array. If it is\n * an array, elements of the array MUST be strings and MUST be unique.\n *\n * String values MUST be one of the six primitive types (`\"null\"`,\n * `\"boolean\"`, `\"object\"`, `\"array\"`, `\"number\"`, or\n * `\"string\"`), or `\"integer\"` which matches any number with a zero\n * fractional part.\n *\n * An instance validates if and only if the instance is in any of the sets\n * listed for this keyword.\n */\n type?: SchemaType;\n\n /**\n * The value of `unevaluatedItems` MUST be a valid JSON Schema.\n *\n * The behavior of this keyword depends on the annotation results of\n * adjacent keywords that apply to the instance location being validated.\n * Specifically, the annotations from `prefixItems`, `items`, and\n * `contains`, which can come from those keywords when they are adjacent\n * to the `unevaluatedItems` keyword. Those three annotations, as well as\n * `unevaluatedItems`, can also result from any and all adjacent\n * [in-place applicator][in-place-applicator] keywords.\n *\n * If no relevant annotations are present, the `unevaluatedItems`\n * subschema MUST be applied to all locations in the array.\n * If a boolean `true` value is present from any of the relevant\n * annotations, `unevaluatedItems` MUST be ignored. Otherwise, the\n * subschema MUST be applied to any index greater than the largest\n * annotation value for `prefixItems`, which does not appear in any\n * annotation value for `contains`.\n *\n * This means that `prefixItems`, `items`, `contains`, and all\n * in-place applicators MUST be evaluated before this keyword can be\n * evaluated. Authors of extension keywords MUST NOT define an in-place\n * applicator that would need to be evaluated after this keyword.\n *\n * If the `unevaluatedItems` subschema is applied to any positions within\n * the instance array, it produces an annotation result of boolean\n * `true`, analogous to the behavior of `items`.\n *\n * Omitting this keyword has the same assertion behavior as an empty\n * schema.\n *\n * [in-place-applicator]: https://json-schema.org/draft/2020-12/json-schema-core.html#in-place\n */\n unevaluatedItems?: JSONSchema;\n\n /**\n * The value of `unevaluatedProperties` MUST be a valid JSON Schema.\n *\n * The behavior of this keyword depends on the annotation results of\n * adjacent keywords that apply to the instance location being validated.\n * Specifically, the annotations from `properties`,\n * `patternProperties`, and `additionalProperties`, which can come from\n * those keywords when they are adjacent to the `unevaluatedProperties`\n * keyword. Those three annotations, as well as `unevaluatedProperties`,\n * can also result from any and all adjacent\n * [in-place applicator][in-place-applicator] keywords.\n *\n * Validation with `unevaluatedProperties` applies only to the child\n * values of instance names that do not appear in the `properties`,\n * `patternProperties`, `additionalProperties`, or\n * `unevaluatedProperties` annotation results that apply to the\n * instance location being validated.\n *\n * For all such properties, validation succeeds if the child instance\n * validates against the \"unevaluatedProperties\" schema.\n *\n * This means that `properties`, `patternProperties`,\n * `additionalProperties`, and all in-place applicators MUST be evaluated\n * before this keyword can be evaluated. Authors of extension keywords\n * MUST NOT define an in-place applicator that would need to be evaluated\n * after this keyword.\n *\n * The annotation result of this keyword is the set of instance property\n * names validated by this keyword's subschema.\n *\n * Omitting this keyword has the same assertion behavior as an empty\n * schema.\n *\n * [in-place-applicator]: https://json-schema.org/draft/2020-12/json-schema-core.html#in-place\n */\n unevaluatedProperties?: JSONSchema;\n\n /**\n * The value of this keyword MUST be a boolean.\n *\n * If this keyword has boolean value `false`, the instance validates\n * successfully. If it has boolean value `true`, the instance validates\n * successfully if all of its elements are unique.\n *\n * Omitting this keyword has the same behavior as a value of `false`.\n *\n * @default false\n */\n uniqueItems?: boolean;\n\n /**\n * The value of this keyword MUST be a boolean. When multiple occurrences\n * of this keyword is applicable to a single sub-instance, the resulting\n * value MUST be `true` if any occurrence specifies a `true` value, and\n * MUST be `false` otherwise.\n *\n * If `writeOnly` has a value of boolean `true`, it indicates that the\n * value is never present when the instance is retrieved from the owning\n * authority. It can be present when sent to the owning authority to update\n * or create the document (or the resource it represents), but it will not\n * be included in any updated or newly created version of the instance.\n *\n * An instance document that is marked as `writeOnly` for the entire\n * document MAY be returned as a blank document of some sort, or MAY\n * produce an error upon retrieval, or have the retrieval request ignored,\n * at the authority's discretion.\n *\n * For example, `writeOnly` would be used to mark a password input field.\n *\n * These keywords can be used to assist in user interface instance\n * generation. In particular, an application MAY choose to use a widget\n * that hides input values as they are typed for write-only fields.\n *\n * @default false\n */\n writeOnly?: boolean;\n};\n\n// -----------------------------------------------------------------------------\n\nexport namespace JSONSchema {\n export type TypeValue = (\n | ValueOf<TypeName>\n | TypeName\n | Array<ValueOf<TypeName> | TypeName>\n | ReadonlyArray<ValueOf<TypeName> | TypeName>\n );\n\n /**\n * JSON Schema interface\n */\n export type Interface<\n Value = any,\n SchemaType extends TypeValue = TypeValue,\n > = Exclude<\n JSONSchema<Value, SchemaType>,\n boolean\n >;\n\n export type Array<T = any> = Pick<\n Interface<T, \"array\">,\n KeywordByType.Any | KeywordByType.Array\n >;\n\n export type Boolean = Pick<\n Interface<boolean, \"boolean\">,\n KeywordByType.Any\n >;\n\n export type Integer = Pick<\n Interface<number, \"integer\">,\n KeywordByType.Any | KeywordByType.Number\n >;\n\n export type Number = Pick<\n Interface<number, \"number\">,\n KeywordByType.Any | KeywordByType.Number\n >;\n\n export type Null = Pick<\n Interface<null, \"null\">,\n KeywordByType.Any\n >;\n\n export type Object<T = any> = Pick<\n Interface<T, \"object\">,\n KeywordByType.Any | KeywordByType.Object\n >;\n\n export type String = Pick<\n Interface<string, \"string\">,\n KeywordByType.Any | KeywordByType.String\n >;\n}\n\nnamespace KeywordByType {\n export type Any =\n | \"$anchor\"\n | \"$comment\"\n | \"$defs\"\n | \"$dynamicAnchor\"\n | \"$dynamicRef\"\n | \"$id\"\n | \"$ref\"\n | \"$schema\"\n | \"$vocabulary\"\n | \"allOf\"\n | \"anyOf\"\n | \"const\"\n | \"default\"\n | \"definitions\"\n | \"deprecated\"\n | \"description\"\n | \"else\"\n | \"enum\"\n | \"examples\"\n | \"format\"\n | \"if\"\n | \"not\"\n | \"oneOf\"\n | \"readOnly\"\n | \"then\"\n | \"title\"\n | \"type\"\n | \"writeOnly\";\n\n export type Array =\n | \"additionalItems\"\n | \"contains\"\n | \"items\"\n | \"maxContains\"\n | \"maxItems\"\n | \"minContains\"\n | \"minItems\"\n | \"prefixItems\"\n | \"unevaluatedItems\"\n | \"uniqueItems\";\n\n export type Number =\n | \"exclusiveMaximum\"\n | \"exclusiveMinimum\"\n | \"maximum\"\n | \"minimum\"\n | \"multipleOf\";\n\n export type Object =\n | \"additionalProperties\"\n | \"dependencies\"\n | \"dependentRequired\"\n | \"dependentSchemas\"\n | \"maxProperties\"\n | \"minProperties\"\n | \"patternProperties\"\n | \"properties\"\n | \"propertyNames\"\n | \"required\"\n | \"unevaluatedProperties\";\n\n export type String =\n | \"contentEncoding\"\n | \"contentMediaType\"\n | \"contentSchema\"\n | \"maxLength\"\n | \"minLength\"\n | \"pattern\";\n}\n\n// -----------------------------------------------------------------------------\n\n/**\n * Content encoding strategy enum.\n *\n * - [Content-Transfer-Encoding Syntax](https://datatracker.ietf.org/doc/html/rfc2045#section-6.1)\n * - [7bit vs 8bit encoding](https://stackoverflow.com/questions/25710599/content-transfer-encoding-7bit-or-8-bit/28531705#28531705)\n */\nexport enum ContentEncoding {\n /**\n * Only US-ASCII characters, which use the lower 7 bits for each character.\n *\n * Each line must be less than 1,000 characters.\n */\n \"7bit\" = \"7bit\",\n\n /**\n * Allow extended ASCII characters which can use the 8th (highest) bit to\n * indicate special characters not available in 7bit.\n *\n * Each line must be less than 1,000 characters.\n */\n \"8bit\" = \"8bit\",\n\n /**\n * Useful for data that is mostly non-text.\n */\n Base64 = \"base64\",\n\n /**\n * Same character set as 8bit, with no line length restriction.\n */\n Binary = \"binary\",\n\n /**\n * An extension token defined by a standards-track RFC and registered with\n * IANA.\n */\n IETFToken = \"ietf-token\",\n\n /**\n * Lines are limited to 76 characters, and line breaks are represented using\n * special characters that are escaped.\n */\n QuotedPrintable = \"quoted-printable\",\n\n /**\n * The two characters \"X-\" or \"x-\" followed, with no intervening white space,\n * by any token.\n */\n XToken = \"x-token\",\n}\n\n/**\n * This enum provides well-known formats that apply to strings.\n */\nexport enum Format {\n /**\n * A string instance is valid against this attribute if it is a valid\n * representation according to the \"full-date\" production in\n * [RFC 3339][RFC3339].\n *\n * [RFC3339]: https://datatracker.ietf.org/doc/html/rfc3339\n */\n Date = \"date\",\n\n /**\n * A string instance is valid against this attribute if it is a valid\n * representation according to the \"date-time\" production in\n * [RFC 3339][RFC3339].\n *\n * [RFC3339]: https://datatracker.ietf.org/doc/html/rfc3339\n */\n DateTime = \"date-time\",\n\n /**\n * A string instance is valid against this attribute if it is a valid\n * representation according to the \"duration\" production.\n */\n Duration = \"duration\",\n\n /**\n * A string instance is valid against this attribute if it is a valid Internet\n * email address as defined by by the \"Mailbox\" ABNF rule in [RFC\n * 5321][RFC5322], section 4.1.2.\n *\n * [RFC5321]: https://datatracker.ietf.org/doc/html/rfc5321\n */\n Email = \"email\",\n\n /**\n * As defined by [RFC 1123, section 2.1][RFC1123], including host names\n * produced using the Punycode algorithm specified in\n * [RFC 5891, section 4.4][RFC5891].\n *\n * [RFC1123]: https://datatracker.ietf.org/doc/html/rfc1123\n * [RFC5891]: https://datatracker.ietf.org/doc/html/rfc5891\n */\n Hostname = \"hostname\",\n\n /**\n * A string instance is valid against this attribute if it is a valid Internet\n * email address as defined by the extended \"Mailbox\" ABNF rule in\n * [RFC 6531][RFC6531], section 3.3.\n *\n * [RFC6531]: https://datatracker.ietf.org/doc/html/rfc6531\n */\n IDNEmail = \"idn-email\",\n\n /**\n * As defined by either [RFC 1123, section 2.1][RFC1123] as for hostname, or\n * an internationalized hostname as defined by\n * [RFC 5890, section 2.3.2.3][RFC5890].\n *\n * [RFC1123]: https://datatracker.ietf.org/doc/html/rfc1123\n * [RFC5890]: https://datatracker.ietf.org/doc/html/rfc5890\n */\n IDNHostname = \"idn-hostname\",\n\n /**\n * An IPv4 address according to the \"dotted-quad\" ABNF syntax as defined in\n * [RFC 2673, section 3.2][RFC2673].\n *\n * [RFC2673]: https://datatracker.ietf.org/doc/html/rfc2673\n */\n IPv4 = \"ipv4\",\n\n /**\n * An IPv6 address as defined in [RFC 4291, section 2.2][RFC4291].\n *\n * [RFC4291]: https://datatracker.ietf.org/doc/html/rfc4291\n */\n IPv6 = \"ipv6\",\n\n /**\n * A string instance is valid against this attribute if it is a valid IRI,\n * according to [RFC 3987][RFC3987].\n *\n * [RFC3987]: https://datatracker.ietf.org/doc/html/rfc3987\n */\n IRI = \"iri\",\n\n /**\n * A string instance is valid against this attribute if it is a valid IRI\n * Reference (either an IRI or a relative-reference), according to\n * [RFC 3987][RFC3987].\n *\n * [RFC3987]: https://datatracker.ietf.org/doc/html/rfc3987\n */\n IRIReference = \"iri-reference\",\n\n /**\n * A string instance is valid against this attribute if it is a valid JSON\n * string representation of a JSON Pointer, according to\n * [RFC 6901, section 5][RFC6901].\n *\n * [RFC6901]: https://datatracker.ietf.org/doc/html/rfc6901\n */\n JSONPointer = \"json-pointer\",\n\n /**\n * A string instance is valid against this attribute if it is a valid JSON\n * string representation of a JSON Pointer fragment, according to\n * [RFC 6901, section 5][RFC6901].\n *\n * [RFC6901]: https://datatracker.ietf.org/doc/html/rfc6901\n */\n JSONPointerURIFragment = \"json-pointer-uri-fragment\",\n\n /**\n * This attribute applies to string instances.\n *\n * A regular expression, which SHOULD be valid according to the\n * [ECMA-262][ecma262] regular expression dialect.\n *\n * Implementations that validate formats MUST accept at least the subset of\n * [ECMA-262][ecma262] defined in the [Regular Expressions][regexInterop]\n * section of this specification, and SHOULD accept all valid\n * [ECMA-262][ecma262] expressions.\n *\n * [ecma262]: https://www.ecma-international.org/publications-and-standards/standards/ecma-262/\n * [regexInterop]: https://json-schema.org/draft/2020-12/json-schema-validation.html#regexInterop\n */\n RegEx = \"regex\",\n\n /**\n * A string instance is valid against this attribute if it is a valid\n * [Relative JSON Pointer][relative-json-pointer].\n *\n * [relative-json-pointer]: https://datatracker.ietf.org/doc/html/draft-handrews-relative-json-pointer-01\n */\n RelativeJSONPointer = \"relative-json-pointer\",\n\n /**\n * A string instance is valid against this attribute if it is a valid\n * representation according to the \"time\" production in [RFC 3339][RFC3339].\n *\n * [RFC3339]: https://datatracker.ietf.org/doc/html/rfc3339\n */\n Time = \"time\",\n\n /**\n * A string instance is valid against this attribute if it is a valid URI,\n * according to [RFC3986][RFC3986].\n *\n * [RFC3986]: https://datatracker.ietf.org/doc/html/rfc3986\n */\n URI = \"uri\",\n\n /**\n * A string instance is valid against this attribute if it is a valid URI\n * Reference (either a URI or a relative-reference), according to\n * [RFC3986][RFC3986].\n *\n * [RFC3986]: https://datatracker.ietf.org/doc/html/rfc3986\n */\n URIReference = \"uri-reference\",\n\n /**\n * A string instance is valid against this attribute if it is a valid URI\n * Template (of any level), according to [RFC 6570][RFC6570].\n *\n * Note that URI Templates may be used for IRIs; there is no separate IRI\n * Template specification.\n *\n * [RFC6570]: https://datatracker.ietf.org/doc/html/rfc6570\n */\n URITemplate = \"uri-template\",\n\n /**\n * A string instance is valid against this attribute if it is a valid string\n * representation of a UUID, according to [RFC 4122][RFC4122].\n *\n * [RFC4122]: https://datatracker.ietf.org/doc/html/rfc4122\n */\n UUID = \"uuid\",\n}\n\n/**\n * Enum consisting of simple type names for the `type` keyword\n */\nexport enum TypeName {\n /**\n * Value MUST be an array.\n */\n Array = \"array\",\n\n /**\n * Value MUST be a boolean.\n */\n Boolean = \"boolean\",\n\n /**\n * Value MUST be an integer, no floating point numbers are allowed. This is a\n * subset of the number type.\n */\n Integer = \"integer\",\n\n /**\n * Value MUST be null. Note this is mainly for purpose of being able use union\n * types to define nullability. If this type is not included in a union, null\n * values are not allowed (the primitives listed above do not allow nulls on\n * their own).\n */\n Null = \"null\",\n\n /**\n * Value MUST be a number, floating point numbers are allowed.\n */\n Number = \"number\",\n\n /**\n * Value MUST be an object.\n */\n Object = \"object\",\n\n /**\n * Value MUST be a string.\n */\n String = \"string\",\n}\n\n// -----------------------------------------------------------------------------\n// Keywords\n// -----------------------------------------------------------------------------\n\nexport const keywords = [\n \"$anchor\",\n \"$comment\",\n \"$defs\",\n \"$dynamicAnchor\",\n \"$dynamicRef\",\n \"$id\",\n \"$ref\",\n \"$schema\",\n \"$vocabulary\",\n \"additionalItems\",\n \"additionalProperties\",\n \"allOf\",\n \"anyOf\",\n \"const\",\n \"contains\",\n \"contentEncoding\",\n \"contentMediaType\",\n \"contentSchema\",\n \"default\",\n \"definitions\",\n \"dependencies\",\n \"dependentRequired\",\n \"dependentSchemas\",\n \"deprecated\",\n \"description\",\n \"else\",\n \"enum\",\n \"examples\",\n \"exclusiveMaximum\",\n \"exclusiveMinimum\",\n \"format\",\n \"if\",\n \"items\",\n \"maxContains\",\n \"maximum\",\n \"maxItems\",\n \"maxLength\",\n \"maxProperties\",\n \"minContains\",\n \"minimum\",\n \"minItems\",\n \"minLength\",\n \"minProperties\",\n \"multipleOf\",\n \"not\",\n \"oneOf\",\n \"pattern\",\n \"patternProperties\",\n \"prefixItems\",\n \"properties\",\n \"propertyNames\",\n \"readOnly\",\n \"required\",\n \"then\",\n \"title\",\n \"type\",\n \"unevaluatedItems\",\n \"unevaluatedProperties\",\n \"uniqueItems\",\n \"writeOnly\",\n] as const;\n","import type { ValidationError, ValidationErrorPath } from '../errors'\nimport { Format } from 'json-schema-typed/draft-2020-12'\n\n/**\n * Format validation error type\n * @description\n * According to JSON Schema 2020-12:\n * - Format validation is an annotation by default\n * - Format validation only applies to strings\n * - Unknown formats should be ignored\n * - Implementations SHOULD implement validation for standard formats\n * - Implementations MAY treat format as a no-op\n */\nexport type FormatValidationErrorType = 'format'\n\n/**\n * Regular expression patterns for format validation\n * These patterns are based on JSON Schema 2020-12 specifications\n */\nconst PATTERNS = {\n // Date/Time patterns (RFC 3339)\n DATE_TIME: /^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(?:\\.\\d+)?(?:Z|[+-]\\d{2}:\\d{2})$/,\n DATE: /^\\d{4}-\\d{2}-\\d{2}$/,\n TIME: /^(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|[+-](?:[01]\\d|2[0-3]):[0-5]\\d)$/,\n\n // Duration (ISO 8601)\n DURATION: /^P(?!$)(?:\\d+Y)?(?:\\d+M)?(?:\\d+D)?(?:T(?=\\d)(?:\\d+H)?(?:\\d+M)?(?:\\d+S)?)?$/,\n\n // Email patterns\n EMAIL:\n /^[\\w.!#$%&'*+/=?^`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i,\n IDN_EMAIL: /^[^\\s@]+@[^\\s@][^\\s.@]*\\.[^\\s@]+$/,\n\n // Host patterns\n HOSTNAME: /^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/i,\n IDN_HOSTNAME: /^[^\\s._-].*[^\\s._-]$/,\n\n // IP address patterns\n IPV6_PART: /^[0-9a-f]{1,4}$/i,\n\n // URI/IRI patterns\n PROTOCOL: /^[a-z]+:/,\n URI_REFERENCE: /^\\S*$/,\n\n // UUID pattern (RFC 4122)\n UUID: /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,\n\n // JSON Pointer patterns\n JSON_POINTER: /^(?:\\/(?:[^~/]|~0|~1)*)*$/,\n JSON_POINTER_URI_FRAGMENT: /^#(?:\\/(?:[\\w\\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,\n RELATIVE_JSON_POINTER: /^(?:0|[1-9]\\d*)(?:#|(?:\\/(?:[^~/]|~0|~1)*)*)$/,\n\n // URI Template (RFC 6570)\n URI_TEMPLATE:\n /^(?:[!#$&'()*+,/:;=?@\\w\\-.~]|%[0-9a-f]{2}|\\{[+#./;?&=,!@|]?(?:\\w|%[0-9a-f]{2})+(?::[1-9]\\d{0,3}|\\*)?(?:,(?:\\w|%[0-9a-f]{2})+(?::[1-9]\\d{0,3}|\\*)?)*\\})*$/i,\n} as const\n\n/**\n * Built-in format validators according to JSON Schema 2020-12\n */\nconst formatValidationFunctions: Record<Format, (value: string) => boolean> = {\n [Format.DateTime]: value => PATTERNS.DATE_TIME.test(value),\n [Format.Date]: value => PATTERNS.DATE.test(value),\n [Format.Time]: value => PATTERNS.TIME.test(value),\n [Format.Duration]: value => PATTERNS.DURATION.test(value),\n [Format.Email]: (value) => {\n // Basic email validation with length limit (RFC 5321)\n return value.length <= 254 && PATTERNS.EMAIL.test(value)\n },\n [Format.IDNEmail]: (value) => {\n // More permissive email validation for IDN with length limit\n return value.length <= 254 && PATTERNS.IDN_EMAIL.test(value)\n },\n [Format.Hostname]: (value) => {\n if (value.length > 255)\n return false\n const labels = value.split('.')\n return labels.every(label => PATTERNS.HOSTNAME.test(label))\n },\n [Format.IDNHostname]: (value) => {\n if (value.length > 255)\n return false\n const labels = value.split('.')\n return labels.every(label => label.length <= 63 && PATTERNS.IDN_HOSTNAME.test(label))\n },\n [Format.IPv4]: (value) => {\n const parts = value.split('.')\n if (parts.length !== 4)\n return false\n return parts.every((part) => {\n const num = Number.parseInt(part, 10)\n return num >= 0 && num <= 255 && part === num.toString()\n })\n },\n [Format.IPv6]: (value) => {\n const parts = value.split(':')\n if (parts.length > 8)\n return false\n let hasDoubleColon = false\n return parts.every((part) => {\n if (part === '') {\n if (hasDoubleColon)\n return false\n hasDoubleColon = true\n return true\n }\n return PATTERNS.IPV6_PART.test(part)\n })\n },\n [Format.URI]: (value) => {\n try {\n const url = new URL(value)\n return url.protocol !== '' && PATTERNS.PROTOCOL.test(url.protocol)\n }\n catch {\n return false\n }\n },\n [Format.URIReference]: (value) => {\n try {\n if (value.startsWith('//')) {\n return PATTERNS.URI_REFERENCE.test(value.slice(2))\n }\n void new URL(value, 'http://example.com')\n return true\n }\n catch {\n return false\n }\n },\n [Format.IRI]: (value) => {\n try {\n const url = new URL(value)\n return url.protocol !== '' && PATTERNS.PROTOCOL.test(url.protocol)\n }\n catch {\n return false\n }\n },\n [Format.IRIReference]: (value) => {\n try {\n if (value.startsWith('//')) {\n return PATTERNS.URI_REFERENCE.test(value.slice(2))\n }\n void new URL(value, 'http://example.com')\n return true\n }\n catch {\n return false\n }\n },\n [Format.RegEx]: (value) => {\n try {\n void new RegExp(value, 'u')\n return true\n }\n catch {\n return false\n }\n },\n [Format.UUID]: value => PATTERNS.UUID.test(value),\n [Format.JSONPointer]: value => PATTERNS.JSON_POINTER.test(value),\n [Format.JSONPointerURIFragment]: value => PATTERNS.JSON_POINTER_URI_FRAGMENT.test(value),\n [Format.RelativeJSONPointer]: value => PATTERNS.RELATIVE_JSON_POINTER.test(value),\n [Format.URITemplate]: value => PATTERNS.URI_TEMPLATE.test(value),\n}\n\n/**\n * Validate a string value against a format\n * @param value - The string value to validate\n * @param format - The format to validate against\n * @param path - The path to the current field being validated\n * @returns An array of validation errors\n * @description\n * According to JSON Schema 2020-12:\n * - Format validation is an annotation by default\n * - Format validation only applies to strings\n * - Unknown formats should be ignored\n * - Implementations SHOULD implement validation for standard formats\n * - Implementations MAY treat format as a no-op\n */\nexport function validateFormat(\n value: string,\n format: string,\n path: ValidationErrorPath = [],\n): ValidationError[] {\n const errors: ValidationError[] = []\n\n // Format validation only applies to strings\n if (typeof value !== 'string') {\n return errors\n }\n\n const validateFn = formatValidationFunctions[format as Format]\n if (validateFn && !validateFn(value)) {\n errors.push({ path, validation: 'format' })\n }\n\n return errors\n}\n","import type { ValidationError, ValidationErrorPath } from '../errors'\nimport type { NonBooleanJsfSchema, SchemaValue } from '../types'\nimport { validateFormat } from './format'\nimport { getSchemaType } from './schema'\n\n/**\n * Validate a string against a schema\n * @param value - The value to validate\n * @param schema - The schema to validate against\n * @param path - The path to the current field being validated\n * @returns An array of validation errors\n * @description\n * Implements string validation according to JSON Schema 2020-12:\n * - Length validation (minLength, maxLength)\n * - Pattern validation (pattern)\n * - Format validation (as annotation by default)\n */\nexport function validateString(\n value: SchemaValue,\n schema: NonBooleanJsfSchema,\n path: ValidationErrorPath = [],\n): ValidationError[] {\n const errors: ValidationError[] = []\n const schemaType = getSchemaType(schema)\n\n if (typeof value !== 'string') {\n return []\n }\n\n if (schemaType !== undefined && schemaType !== 'string') {\n return []\n }\n\n const valueLength = [...new Intl.Segmenter().segment(value)].length\n\n // Length validation\n if (schema.minLength !== undefined && valueLength < schema.minLength) {\n errors.push({ path, validation: 'minLength' })\n }\n\n if (schema.maxLength !== undefined && valueLength > schema.maxLength) {\n errors.push({ path, validation: 'maxLength' })\n }\n\n // Pattern validation\n if (schema.pattern !== undefined) {\n const pattern = new RegExp(schema.pattern)\n if (!pattern.test(value)) {\n errors.push({ path, validation: 'pattern' })\n }\n }\n\n // Format validation (annotation by default in 2020-12)\n if (schema.format !== undefined) {\n const formatErrors = validateFormat(value, schema.format, path)\n errors.push(...formatErrors)\n }\n\n return errors\n}\n","import type { ValidationError, ValidationErrorPath } from '../errors'\nimport type { JsfSchema, JsfSchemaType, SchemaValue } from '../types'\nimport { validateAllOf, validateAnyOf, validateNot, validateOneOf } from './composition'\nimport { validateCondition } from './conditions'\nimport { validateConst } from './const'\nimport { validateEnum } from './enum'\nimport { validateNumber } from './number'\nimport { validateObject } from './object'\nimport { validateString } from './string'\nimport { isObjectValue } from './util'\n\nexport interface ValidationOptions {\n /**\n * A null value will be treated as undefined.\n * That means that when validating a null value, against a non-required field that is not of type 'null' or ['null']\n * the validation will succeed instead of returning a type error.\n * @default false\n */\n treatNullAsUndefined?: boolean\n}\n\n/**\n * Get the type of a schema\n * @param schema - The schema to get the type of\n * @returns The type of the schema, or an array of types if the schema is an array.\n * If no type is defined, returns undefined.\n *\n * IMPORTANT:\n * We intentionally return 'undefined' (instead of defaulting to 'object') when no type is defined.\n * In JSON Schema 2020-12, an absent \"type\" keyword means there is no type constraint.\n * This change prevents erroneously enforcing a default type of 'object', which was causing false negatives\n * (e.g. when validating an \"anyOf\" schema without a \"type\").\n */\nexport function getSchemaType(schema: JsfSchema): JsfSchemaType | JsfSchemaType[] | undefined {\n if (typeof schema === 'boolean') {\n return 'boolean'\n }\n\n if (schema.type !== undefined) {\n return schema.type\n }\n\n return undefined\n}\n\n/**\n * Validate the type of a value against a schema\n * @param value - The value to validate\n * @param schema - The schema to validate against\n * @param path - The path to the current field being validated\n * @returns An array of validation errors\n * @description\n * When getSchemaType returns undefined, this function skips type validation.\n * This aligns with JSON Schema 2020-12 semantics: if no type is provided, no type check is enforced.\n */\nfunction validateType(\n value: SchemaValue,\n schema: JsfSchema,\n path: ValidationErrorPath = [],\n): ValidationError[] {\n const schemaType = getSchemaType(schema)\n\n // Skip type-checking if no type is specified.\n if (schemaType === undefined) {\n return []\n }\n\n if (schemaType === 'null' && value === null) {\n return []\n }\n\n const valueType = value === null ? 'null' : typeof value\n\n if (Array.isArray(schemaType)) {\n if (value === null && schemaType.includes('null')) {\n return []\n }\n\n for (const type of schemaType) {\n if (valueType === 'number' && type === 'integer' && Number.isInteger(value)) {\n return []\n }\n\n if (valueType === type || (type === 'null' && value === null)) {\n return []\n }\n }\n }\n\n if (valueType === 'number' && schemaType === 'integer' && Number.isInteger(value)) {\n return []\n }\n\n if (valueType === schemaType) {\n return []\n }\n\n return [{ path, validation: 'type' },\n ]\n}\n\n/**\n * Validate a value against a schema\n * @param value - The value to validate\n * @param schema - The schema to validate against\n * @param options - The validation options\n * @param path - The path to the current field being validated\n * @returns An array of validation errors\n * @description\n * This function is the main validation function that implements JSON Schema validation.\n * The validation process follows this order:\n * 1. Handle undefined values and the required constraint\n * 2. Handle boolean schemas (true allows everything, false allows nothing)\n * 3. Validate against base schema constraints:\n * - Type validation (if type is specified)\n * - Required properties\n * - Boolean validation\n * - Enum validation\n * - Const validation\n * - Type-specific validations (string, number, object)\n * 4. Validate against composition keywords in this order:\n * - not (negates the validation of a subschema)\n * - allOf (all subschemas must be valid)\n * - anyOf (at least one subschema must be valid)\n * - oneOf (exactly one subschema must be valid)\n *\n * @see validateType - For type validation behavior\n * @see validateSchemaWithoutComposition - For base schema validation\n * @see https://json-schema.org/understanding-json-schema/reference/combining.html\n */\nexport function validateSchema(\n value: SchemaValue,\n schema: JsfSchema,\n options: ValidationOptions = {},\n path: ValidationErrorPath = [],\n): ValidationError[] {\n const valueIsUndefined = value === undefined || (value === null && options.treatNullAsUndefined)\n const errors: ValidationError[] = []\n\n // If value is undefined but not required, no further validation needed\n if (valueIsUndefined) {\n return []\n }\n\n if (typeof schema === 'boolean') {\n return schema ? [] : [{ path, validation: 'valid' }]\n }\n\n const typeValidationErrors = validateType(value, schema, path)\n if (typeValidationErrors.length > 0) {\n return typeValidationErrors\n }\n\n // If the schema defines \"required\", run required checks even when type is undefined.\n if (\n schema.required\n && Array.isArray(schema.required)\n && isObjectValue(value)\n ) {\n const missingKeys = schema.required.filter((key: string) => {\n const fieldValue = value[key]\n return fieldValue === undefined || (fieldValue === null && options.treatNullAsUndefined)\n })\n\n for (const key of missingKeys) {\n errors.push({\n path: [...path, key],\n validation: 'required',\n })\n }\n }\n\n return [\n ...errors,\n ...validateConst(value, schema, path),\n ...validateEnum(value, schema, path),\n ...validateObject(value, schema, options, path),\n ...validateString(value, schema, path),\n ...validateNumber(value, schema, path),\n ...validateNot(value, schema, options, path),\n ...validateAllOf(value, schema, options, path),\n ...validateAnyOf(value, schema, options, path),\n ...validateOneOf(value, schema, options, path),\n ...validateCondition(value, schema, options, path),\n ]\n}\n","import type { Field } from './field/type'\nimport type { JsfObjectSchema, JsfSchema, NonBooleanJsfSchema, SchemaValue } from './types'\nimport type { ValidationOptions } from './validation/schema'\nimport { validateSchema } from './validation/schema'\nimport { isObjectValue } from './validation/util'\n\n/**\n * Updates field visibility based on JSON schema conditional rules\n * @param fields - The fields to update\n * @param values - The current form values\n * @param schema - The JSON schema definition\n * @param options - Validation options\n */\nexport function updateFieldVisibility(\n fields: Field[],\n values: SchemaValue,\n schema: JsfObjectSchema,\n options: ValidationOptions = {},\n) {\n if (!isObjectValue(values)) {\n return\n }\n\n // Apply rules to current level of fields\n applySchemaRules(fields, values, schema, options)\n\n // Process nested object fields that have conditional logic\n for (const fieldName in schema.properties) {\n const fieldSchema = schema.properties[fieldName]\n\n // Only process object schemas with conditional logic (allOf)\n if (typeof fieldSchema !== 'object' || fieldSchema === null\n || Array.isArray(fieldSchema) || !fieldSchema.allOf) {\n continue\n }\n\n const objectField = fields.find(field => field.name === fieldSchema.title || field.name === fieldName)\n if (!objectField || !objectField.fields || objectField.fields.length === 0) {\n continue\n }\n\n const fieldValues = isObjectValue(values[fieldName])\n ? values[fieldName]\n : isObjectValue(values[objectField.name]) ? values[objectField.name] : {}\n\n // Apply rules to nested fields\n applySchemaRules(objectField.fields, fieldValues, fieldSchema as JsfObjectSchema, options)\n\n // Only process nested fields if parent is visible\n if (objectField.isVisible) {\n updateFieldVisibility(\n objectField.fields,\n fieldValues,\n fieldSchema as JsfObjectSchema,\n options,\n )\n }\n }\n}\n\n/**\n * Applies JSON Schema conditional rules to determine field visibility\n * @param fields - The fields to apply rules to\n * @param values - The current form values\n * @param schema - The JSON schema containing the rules\n * @param options - Validation options\n *\n * Fields start with visibility based on their required status.\n * Conditional rules in the schema's allOf property can then:\n * - Make fields visible by including them in a required array\n * - Make fields hidden by setting them to false in properties\n */\nfunction applySchemaRules(\n fields: Field[],\n values: SchemaValue,\n schema: JsfObjectSchema,\n options: ValidationOptions = {},\n) {\n if (!schema.allOf || !Array.isArray(schema.allOf) || !isObjectValue(values)) {\n return\n }\n\n const conditionalRules = schema.allOf\n .filter(rule => typeof rule === 'object' && rule !== null && 'if' in rule)\n .map((rule) => {\n const ruleObj = rule as NonBooleanJsfSchema\n\n const ifErrors = validateSchema(values, ruleObj.if!, options)\n const matches = ifErrors.length === 0\n\n // Prevent fields from being shown when required fields have type errors\n let hasTypeErrors = false\n if (matches\n && typeof ruleObj.if === 'object'\n && ruleObj.if !== null\n && Array.isArray(ruleObj.if.required)) {\n const requiredFields = ruleObj.if.required\n hasTypeErrors = requiredFields.some((fieldName) => {\n if (!schema.properties || !schema.properties[fieldName]) {\n return false\n }\n const fieldSchema = schema.properties[fieldName]\n const fieldValue = values[fieldName]\n const fieldErrors = validateSchema(fieldValue, fieldSchema, options)\n return fieldErrors.some(error => error.validation === 'type')\n })\n }\n\n return { rule: ruleObj, matches: matches && !hasTypeErrors }\n })\n\n for (const field of fields) {\n // Default visibility is based on required status\n let isVisible = field.required\n\n for (const { rule, matches } of conditionalRules) {\n if (matches && rule.then) {\n isVisible = isFieldVisible(field.name, rule.then, isVisible)\n }\n else if (!matches && rule.else) {\n isVisible = isFieldVisible(field.name, rule.else, isVisible)\n }\n }\n\n field.isVisible = isVisible\n }\n}\n\n/**\n * Determines whether a field should be visible based on a schema branch\n * @param fieldName - The name of the field\n * @param branch - The schema clause (either 'then' or 'else')\n * @param currentVisibility - The current visibility state\n * @returns The updated visibility state\n *\n * Visibility logic:\n * - If the field is in the required array → make visible\n * - If the field is explicitly false in properties → make hidden\n * - Otherwise, preserve current visibility\n */\nfunction isFieldVisible(\n fieldName: string,\n branch: JsfSchema,\n currentVisibility: boolean,\n): boolean {\n let isVisible = currentVisibility\n\n if (typeof branch === 'object' && branch !== null) {\n if (Array.isArray(branch.required)) {\n if (branch.required.includes(fieldName)) {\n isVisible = true\n }\n }\n\n if (branch.properties !== undefined) {\n if (fieldName in branch.properties && branch.properties[fieldName] === false) {\n isVisible = false\n }\n }\n }\n\n return isVisible\n}\n","import type { ValidationError, ValidationErrorPath } from './errors'\nimport type { Field } from './field/type'\nimport type { JsfObjectSchema, JsfSchema, NonBooleanJsfSchema, SchemaValue } from './types'\nimport type { ValidationOptions } from './validation/schema'\nimport { getErrorMessage } from './errors/messages'\nimport { buildFieldObject } from './field/object'\nimport { validateSchema } from './validation/schema'\nimport { isObjectValue } from './validation/util'\nimport { updateFieldVisibility } from './visibility'\n\nexport { ValidationOptions } from './validation/schema'\n\ninterface FormResult {\n fields: Field[]\n isError: boolean\n error: string | null\n handleValidation: (value: SchemaValue) => ValidationResult\n}\n\n/**\n * Recursive type for form error messages\n * - String for leaf error messages\n * - Nested object for nested fields\n */\nexport interface FormErrors {\n [key: string]: string | FormErrors\n}\n\nexport interface ValidationResult {\n formErrors?: FormErrors\n}\n\n/**\n * Remove composition keywords and their indices as well as conditional keywords from the path\n * @param path - The path to clean\n * @returns The cleaned path\n * @example\n * ```ts\n * cleanErrorPath(['some_object','allOf', 0, 'then', 'field'])\n * // ['some_object', 'field']\n * ```\n */\nfunction cleanErrorPath(path: ValidationErrorPath): ValidationErrorPath {\n const result: ValidationErrorPath = []\n\n for (let i = 0; i < path.length; i++) {\n const segment = path[i]\n\n if (['allOf', 'anyOf', 'oneOf'].includes(segment as string)) {\n if (i + 1 < path.length && typeof path[i + 1] === 'number') {\n i++\n }\n continue\n }\n\n if (segment === 'then' || segment === 'else') {\n continue\n }\n\n result.push(segment)\n }\n\n return result\n}\n\n/**\n * Transform validation errors into an object with the field names as keys and the error messages as values.\n * For nested fields, creates a nested object structure rather than using dot notation.\n * When multiple errors exist for the same field, the last error message is used.\n *\n * @example\n * Single field error\n * { username: 'Required field' }\n *\n * Nested field error (using nested objects)\n * { address: { street: 'The value must be a string' } }\n *\n * Schema-level error\n * { '': 'The value must match at least one schema' }\n */\nfunction validationErrorsToFormErrors(errors: ValidationErrorWithMessage[]): FormErrors | null {\n if (errors.length === 0) {\n return null\n }\n\n // Use a more functional approach with reduce\n return errors.reduce<FormErrors>((result, error) => {\n const { path } = error\n\n // Handle schema-level errors (empty path)\n if (path.length === 0) {\n result[''] = error.message\n return result\n }\n\n // Clean the path to remove intermediate composition structures\n const cleanedPath = cleanErrorPath(path)\n\n // For all paths, recursively build the nested structure\n let current = result\n\n // Process all segments except the last one (which will hold the message)\n cleanedPath.slice(0, -1).forEach((segment) => {\n // If this segment doesn't exist yet or is currently a string (from a previous error),\n // initialize it as an object\n if (!(segment in current) || typeof current[segment] === 'string') {\n current[segment] = {}\n }\n\n current = current[segment] as FormErrors\n })\n\n // Set the message at the final level\n if (cleanedPath.length > 0) {\n const lastSegment = cleanedPath[cleanedPath.length - 1]\n current[lastSegment] = error.message\n }\n else {\n // Fallback for unexpected path structures\n result[''] = error.message\n }\n\n return result\n }, {})\n}\n\ninterface ValidationErrorWithMessage extends ValidationError {\n message: string\n}\n\nfunction getSchemaAndValueAtPath(rootSchema: JsfSchema, rootValue: SchemaValue, path: (string | number)[]): { schema: JsfSchema, value: SchemaValue } {\n let currentSchema = rootSchema\n let currentValue = rootValue\n\n for (const segment of path) {\n if (typeof currentSchema === 'object' && currentSchema !== null) {\n if (currentSchema.properties && currentSchema.properties[segment]) {\n currentSchema = currentSchema.properties[segment]\n if (isObjectValue(currentValue)) {\n currentValue = currentValue[segment]\n }\n }\n else if (currentSchema.items && typeof currentSchema.items !== 'boolean') {\n currentSchema = currentSchema.items\n if (Array.isArray(currentValue)) {\n currentValue = currentValue[Number(segment)]\n }\n }\n // Skip the 'allOf', 'anyOf', and 'oneOf' segments, the next segment will be the index\n else if (segment === 'allOf' && currentSchema.allOf) {\n continue\n }\n else if (segment === 'anyOf' && currentSchema.anyOf) {\n continue\n }\n else if (segment === 'oneOf' && currentSchema.oneOf) {\n continue\n }\n // Skip the 'then' and 'else' segments, the next segment will be the field name\n else if ((segment === 'then' || segment === 'else') && currentSchema[segment]) {\n currentSchema = currentSchema[segment]\n continue\n }\n // If we have we are in a composition context, get the subschema\n else if (currentSchema.allOf || currentSchema.anyOf || currentSchema.oneOf) {\n const index = Number(segment)\n if (currentSchema.allOf && index >= 0 && index < currentSchema.allOf.length) {\n currentSchema = currentSchema.allOf[index]\n }\n else if (currentSchema.anyOf && index >= 0 && index < currentSchema.anyOf.length) {\n currentSchema = currentSchema.anyOf[index]\n }\n else if (currentSchema.oneOf && index >= 0 && index < currentSchema.oneOf.length) {\n currentSchema = currentSchema.oneOf[index]\n }\n }\n }\n }\n\n return { schema: currentSchema, value: currentValue }\n}\n\nfunction addErrorMessages(rootValue: SchemaValue, rootSchema: JsfSchema, errors: ValidationError[]): ValidationErrorWithMessage[] {\n return errors.map((error) => {\n const { schema: errorSchema, value: errorValue } = getSchemaAndValueAtPath(rootSchema, rootValue, error.path)\n\n return {\n ...error,\n message: getErrorMessage(errorSchema, errorValue, error.validation),\n }\n })\n}\n\n/**\n * Apply custom error messages from the schema to validation errors\n * @param errors - The validation errors\n * @param schema - The schema that contains custom error messages\n * @returns The validation errors with custom error messages applied\n */\nfunction applyCustomErrorMessages(errors: ValidationErrorWithMessage[], schema: JsfSchema): ValidationErrorWithMessage[] {\n if (typeof schema !== 'object' || !schema || !errors.length) {\n return errors\n }\n\n return errors.map((error) => {\n // Skip if no path or empty path\n if (!error.path.length) {\n return error\n }\n\n // Find the schema for this error path\n let currentSchema: NonBooleanJsfSchema | null = typeof schema === 'object' ? schema : null\n let fieldSchema: NonBooleanJsfSchema | null = null\n\n // Navigate through the schema to find the field schema\n for (const segment of error.path) {\n if (!currentSchema || typeof currentSchema !== 'object') {\n break\n }\n\n if (currentSchema.properties && currentSchema.properties[segment]) {\n const nextSchema = currentSchema.properties[segment]\n // Skip if the schema is a boolean\n if (typeof nextSchema !== 'boolean') {\n currentSchema = nextSchema\n fieldSchema = currentSchema\n }\n else {\n break\n }\n }\n else if (currentSchema.items && typeof currentSchema.items !== 'boolean') {\n // Handle array items\n currentSchema = currentSchema.items\n fieldSchema = currentSchema\n }\n else {\n break\n }\n }\n\n // If we found a schema with custom error messages, apply them\n if (\n fieldSchema\n && fieldSchema['x-jsf-errorMessage']\n && fieldSchema['x-jsf-errorMessage'][error.validation]\n ) {\n return {\n ...error,\n message: fieldSchema['x-jsf-errorMessage'][error.validation],\n }\n }\n\n return error\n })\n}\n\n/**\n * Validate a value against a schema\n * @param value - The value to validate\n * @param schema - The schema to validate against\n * @returns The validation result\n */\nfunction validate(value: SchemaValue, schema: JsfSchema, options: ValidationOptions = {}): ValidationResult {\n const result: ValidationResult = {}\n const errors = validateSchema(value, schema, options)\n\n const errorsWithMessages = addErrorMessages(value, schema, errors)\n const processedErrors = applyCustomErrorMessages(errorsWithMessages, schema)\n\n const formErrors = validationErrorsToFormErrors(processedErrors)\n\n if (formErrors) {\n result.formErrors = formErrors\n }\n\n return result\n}\n\nexport interface CreateHeadlessFormOptions {\n initialValues?: SchemaValue\n validationOptions?: ValidationOptions\n}\n\nfunction buildFields(params: { schema: JsfObjectSchema }): Field[] {\n const { schema } = params\n const fields = buildFieldObject(schema, 'root', true).fields || []\n return fields\n}\n\nexport function createHeadlessForm(\n schema: JsfObjectSchema,\n options: CreateHeadlessFormOptions = {},\n): FormResult {\n const initialValues = options.initialValues || {}\n const fields = buildFields({ schema })\n updateFieldVisibility(fields, initialValues, schema)\n const isError = false\n\n const handleValidation = (value: SchemaValue) => {\n const result = validate(value, schema, options.validationOptions)\n updateFieldVisibility(fields, value, schema, options.validationOptions)\n return result\n }\n\n return {\n fields,\n isError,\n error: null,\n handleValidation,\n }\n}\n"],"mappings":"shBAAA,IAAAA,EAAAC,EAAA,CAAAC,GAAAC,IAAA,cAAAA,EAAO,QAAU,CACf,KAAa,EACb,MAAa,EACb,SAAa,EACb,IAAa,EACb,MAAa,EACb,WAAa,EACb,UAAa,EACb,KAAa,CACf,ICTA,IAAAC,EAAAC,EAAAC,GAAA,kBAAMC,EAAQ,IAERC,EAAO,IAAM,CAAC,CAAE,KAAMD,EAAM,MAAQ,KAAM,GAAI,GAAI,EAAG,CAAC,EAEtDE,EAAQ,IACL,CACL,CAAE,KAAMF,EAAM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,CACL,GAAGA,EACH,QAASiB,EAAY,oBAAoB,EAAEjB,EAAM,UAAU,CAC7D,EAGKA,CACT,CAAC,CACH,CAQA,SAASmB,GAASC,EAAoBJ,EAAmBK,EAA6B,CAAC,EAAqB,CAC1G,IAAM1B,EAA2B,CAAC,EAC5BI,EAASuB,EAAeF,EAAOJ,EAAQK,CAAO,EAE9CE,EAAqBZ,GAAiBS,EAAOJ,EAAQjB,CAAM,EAC3DyB,EAAkBT,GAAyBQ,EAAoBP,CAAM,EAErES,EAAa3B,GAA6B0B,CAAe,EAE/D,OAAIC,IACF9B,EAAO,WAAa8B,GAGf9B,CACT,CAOA,SAAS+B,GAAYC,EAA8C,CACjE,GAAM,CAAE,OAAAX,CAAO,EAAIW,EAEnB,OADeC,EAAiBZ,EAAQ,OAAQ,EAAI,EAAE,QAAU,CAAC,CAEnE,CAEO,SAASa,GACdb,EACAK,EAAqC,CAAC,EAC1B,CACZ,IAAMS,EAAgBT,EAAQ,eAAiB,CAAC,EAC1CU,EAASL,GAAY,CAAE,OAAAV,CAAO,CAAC,EACrC,OAAAgB,EAAsBD,EAAQD,EAAed,CAAM,EAS5C,CACL,OAAAe,EACA,QAVc,GAWd,MAAO,KACP,iBAVwBX,GAAuB,CAC/C,IAAMzB,EAASwB,GAASC,EAAOJ,EAAQK,EAAQ,iBAAiB,EAChE,OAAAW,EAAsBD,EAAQX,EAAOJ,EAAQK,EAAQ,iBAAiB,EAC/D1B,CACT,CAOA,CACF","names":["require_types","__commonJSMin","exports","module","require_sets","__commonJSMin","exports","types","INTS","WORDS","WHITESPACE","NOTANYCHAR","require_util","__commonJSMin","exports","types","sets","CTRL","SLSH","str","chars_regex","s","b","lbs","a16","b16","c8","dctrl","eslsh","code","c","regexpStr","tokens","regexp","rs","msg","require_positions","__commonJSMin","exports","types","require_lib","__commonJSMin","exports","module","util","types","sets","positions","regexpStr","i","l","c","start","lastGroup","last","groupStack","repeatErr","str","not","classTokens","group","stack","rs","min","max","require_lib","__commonJSMin","exports","module","SubRange","_SubRange","low","high","range","DRange","_DRange","a","b","previous","_add","subrange","i","newRanges","_subtract","_intersect","index","result","require_randexp","__commonJSMin","exports","module","ret","DRange","types","RandExp","regexp","m","token","groups","stack","str","n","expandedSet","code","arr","drange","i","subrange","j","otherCaseCode","a","b","range","randexp","import_randexp","getErrorMessage","schema","value","validation","getTypeErrorMessage","valueToString","schemaType","type","sort","params","prevFields","order","indexMap","key","index","a","b","indexA","indexB","setCustomOrder","schema","fields","getJsonType","schema","convertToOptions","nodeOptions","option","schemaOption","title","value","meta","result","_","__","___","rest","getFieldOptions","excludedSchemaProps","buildFieldSchema","name","required","objectSchema","buildFieldObject","presentation","errorMessage","inputType","field","key","acc","options","buildFieldObject","schema","name","required","fields","key","isRequired","field","buildFieldSchema","orderedFields","setCustomOrder","validateAllOf","value","schema","options","path","i","subSchema","errors","validateSchema","validateAnyOf","validateOneOf","validCount","validateNot","validateCondition","value","schema","options","path","conditionIsTrue","validateSchema","isObjectValue","v","deepEqual","a","b","item","index","aKeys","bKeys","key","validateConst","value","schema","path","deepEqual","validateEnum","value","schema","path","enumValue","deepEqual","validateNumber","value","schema","path","errors","schemaType","getSchemaType","validateObject","value","schema","options","path","isObjectValue","errors","key","propertySchema","validateSchema","ContentEncoding","ContentEncoding1","Format","Format1","TypeName","TypeName1","PATTERNS","formatValidationFunctions","Format","value","label","parts","part","num","hasDoubleColon","url","validateFormat","format","path","errors","validateFn","validateString","value","schema","path","errors","schemaType","getSchemaType","valueLength","formatErrors","validateFormat","getSchemaType","schema","validateType","value","path","schemaType","valueType","type","validateSchema","options","valueIsUndefined","errors","typeValidationErrors","isObjectValue","missingKeys","key","fieldValue","validateConst","validateEnum","validateObject","validateString","validateNumber","validateNot","validateAllOf","validateAnyOf","validateOneOf","validateCondition","updateFieldVisibility","fields","values","schema","options","isObjectValue","applySchemaRules","fieldName","fieldSchema","objectField","field","fieldValues","conditionalRules","rule","ruleObj","matches","validateSchema","hasTypeErrors","fieldValue","error","isVisible","isFieldVisible","branch","currentVisibility","cleanErrorPath","path","result","i","segment","validationErrorsToFormErrors","errors","error","cleanedPath","current","lastSegment","getSchemaAndValueAtPath","rootSchema","rootValue","currentSchema","currentValue","isObjectValue","index","addErrorMessages","errorSchema","errorValue","getErrorMessage","applyCustomErrorMessages","schema","fieldSchema","nextSchema","validate","value","options","validateSchema","errorsWithMessages","processedErrors","formErrors","buildFields","params","buildFieldObject","createHeadlessForm","initialValues","fields","updateFieldVisibility"]}
|
|
1
|
+
{"version":3,"sources":["../../node_modules/ret/lib/types.js","../../node_modules/ret/lib/sets.js","../../node_modules/ret/lib/util.js","../../node_modules/ret/lib/positions.js","../../node_modules/ret/lib/index.js","../../node_modules/drange/lib/index.js","../../node_modules/randexp/lib/randexp.js","../src/errors/messages.ts","../src/custom/order.ts","../src/field/schema.ts","../src/field/object.ts","../src/validation/composition.ts","../src/validation/conditions.ts","../src/validation/util.ts","../src/validation/const.ts","../src/validation/enum.ts","../src/validation/number.ts","../src/validation/object.ts","../node_modules/.pnpm/json-schema-typed@8.0.1/node_modules/json-schema-typed/draft-2020-12.ts","../src/validation/format.ts","../src/validation/string.ts","../src/validation/schema.ts","../src/mutations.ts","../src/form.ts"],"sourcesContent":["module.exports = {\n ROOT : 0,\n GROUP : 1,\n POSITION : 2,\n SET : 3,\n RANGE : 4,\n REPETITION : 5,\n REFERENCE : 6,\n CHAR : 7,\n};\n","const types = require('./types');\n\nconst INTS = () => [{ type: types.RANGE , from: 48, to: 57 }];\n\nconst WORDS = () => {\n return [\n { type: types.CHAR, value: 95 },\n { type: types.RANGE, from: 97, to: 122 },\n { type: types.RANGE, from: 65, to: 90 }\n ].concat(INTS());\n};\n\nconst WHITESPACE = () => {\n return [\n { type: types.CHAR, value: 9 },\n { type: types.CHAR, value: 10 },\n { type: types.CHAR, value: 11 },\n { type: types.CHAR, value: 12 },\n { type: types.CHAR, value: 13 },\n { type: types.CHAR, value: 32 },\n { type: types.CHAR, value: 160 },\n { type: types.CHAR, value: 5760 },\n { type: types.RANGE, from: 8192, to: 8202 },\n { type: types.CHAR, value: 8232 },\n { type: types.CHAR, value: 8233 },\n { type: types.CHAR, value: 8239 },\n { type: types.CHAR, value: 8287 },\n { type: types.CHAR, value: 12288 },\n { type: types.CHAR, value: 65279 }\n ];\n};\n\nconst NOTANYCHAR = () => {\n return [\n { type: types.CHAR, value: 10 },\n { type: types.CHAR, value: 13 },\n { type: types.CHAR, value: 8232 },\n { type: types.CHAR, value: 8233 },\n ];\n};\n\n// Predefined class objects.\nexports.words = () => ({ type: types.SET, set: WORDS(), not: false });\nexports.notWords = () => ({ type: types.SET, set: WORDS(), not: true });\nexports.ints = () => ({ type: types.SET, set: INTS(), not: false });\nexports.notInts = () => ({ type: types.SET, set: INTS(), not: true });\nexports.whitespace = () => ({ type: types.SET, set: WHITESPACE(), not: false });\nexports.notWhitespace = () => ({ type: types.SET, set: WHITESPACE(), not: true });\nexports.anyChar = () => ({ type: types.SET, set: NOTANYCHAR(), not: true });\n","const types = require('./types');\nconst sets = require('./sets');\n\n\nconst CTRL = '@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\\\]^ ?';\nconst SLSH = { '0': 0, 't': 9, 'n': 10, 'v': 11, 'f': 12, 'r': 13 };\n\n/**\n * Finds character representations in str and convert all to\n * their respective characters\n *\n * @param {String} str\n * @return {String}\n */\nexports.strToChars = function(str) {\n /* jshint maxlen: false */\n var chars_regex = /(\\[\\\\b\\])|(\\\\)?\\\\(?:u([A-F0-9]{4})|x([A-F0-9]{2})|(0?[0-7]{2})|c([@A-Z[\\\\\\]^?])|([0tnvfr]))/g;\n str = str.replace(chars_regex, function(s, b, lbs, a16, b16, c8, dctrl, eslsh) {\n if (lbs) {\n return s;\n }\n\n var code = b ? 8 :\n a16 ? parseInt(a16, 16) :\n b16 ? parseInt(b16, 16) :\n c8 ? parseInt(c8, 8) :\n dctrl ? CTRL.indexOf(dctrl) :\n SLSH[eslsh];\n\n var c = String.fromCharCode(code);\n\n // Escape special regex characters.\n if (/[[\\]{}^$.|?*+()]/.test(c)) {\n c = '\\\\' + c;\n }\n\n return c;\n });\n\n return str;\n};\n\n\n/**\n * turns class into tokens\n * reads str until it encounters a ] not preceeded by a \\\n *\n * @param {String} str\n * @param {String} regexpStr\n * @return {Array.<Array.<Object>, Number>}\n */\nexports.tokenizeClass = (str, regexpStr) => {\n /* jshint maxlen: false */\n var tokens = [];\n var regexp = /\\\\(?:(w)|(d)|(s)|(W)|(D)|(S))|((?:(?:\\\\)(.)|([^\\]\\\\]))-(?:\\\\)?([^\\]]))|(\\])|(?:\\\\)?([^])/g;\n var rs, c;\n\n\n while ((rs = regexp.exec(str)) != null) {\n if (rs[1]) {\n tokens.push(sets.words());\n\n } else if (rs[2]) {\n tokens.push(sets.ints());\n\n } else if (rs[3]) {\n tokens.push(sets.whitespace());\n\n } else if (rs[4]) {\n tokens.push(sets.notWords());\n\n } else if (rs[5]) {\n tokens.push(sets.notInts());\n\n } else if (rs[6]) {\n tokens.push(sets.notWhitespace());\n\n } else if (rs[7]) {\n tokens.push({\n type: types.RANGE,\n from: (rs[8] || rs[9]).charCodeAt(0),\n to: rs[10].charCodeAt(0),\n });\n\n } else if ((c = rs[12])) {\n tokens.push({\n type: types.CHAR,\n value: c.charCodeAt(0),\n });\n\n } else {\n return [tokens, regexp.lastIndex];\n }\n }\n\n exports.error(regexpStr, 'Unterminated character class');\n};\n\n\n/**\n * Shortcut to throw errors.\n *\n * @param {String} regexp\n * @param {String} msg\n */\nexports.error = (regexp, msg) => {\n throw new SyntaxError('Invalid regular expression: /' + regexp + '/: ' + msg);\n};\n","const types = require('./types');\nexports.wordBoundary = () => ({ type: types.POSITION, value: 'b' });\nexports.nonWordBoundary = () => ({ type: types.POSITION, value: 'B' });\nexports.begin = () => ({ type: types.POSITION, value: '^' });\nexports.end = () => ({ type: types.POSITION, value: '$' });\n","const util = require('./util');\nconst types = require('./types');\nconst sets = require('./sets');\nconst positions = require('./positions');\n\n\nmodule.exports = (regexpStr) => {\n var i = 0, l, c,\n start = { type: types.ROOT, stack: []},\n\n // Keep track of last clause/group and stack.\n lastGroup = start,\n last = start.stack,\n groupStack = [];\n\n\n var repeatErr = (i) => {\n util.error(regexpStr, `Nothing to repeat at column ${i - 1}`);\n };\n\n // Decode a few escaped characters.\n var str = util.strToChars(regexpStr);\n l = str.length;\n\n // Iterate through each character in string.\n while (i < l) {\n c = str[i++];\n\n switch (c) {\n // Handle escaped characters, inclues a few sets.\n case '\\\\':\n c = str[i++];\n\n switch (c) {\n case 'b':\n last.push(positions.wordBoundary());\n break;\n\n case 'B':\n last.push(positions.nonWordBoundary());\n break;\n\n case 'w':\n last.push(sets.words());\n break;\n\n case 'W':\n last.push(sets.notWords());\n break;\n\n case 'd':\n last.push(sets.ints());\n break;\n\n case 'D':\n last.push(sets.notInts());\n break;\n\n case 's':\n last.push(sets.whitespace());\n break;\n\n case 'S':\n last.push(sets.notWhitespace());\n break;\n\n default:\n // Check if c is integer.\n // In which case it's a reference.\n if (/\\d/.test(c)) {\n last.push({ type: types.REFERENCE, value: parseInt(c, 10) });\n\n // Escaped character.\n } else {\n last.push({ type: types.CHAR, value: c.charCodeAt(0) });\n }\n }\n\n break;\n\n\n // Positionals.\n case '^':\n last.push(positions.begin());\n break;\n\n case '$':\n last.push(positions.end());\n break;\n\n\n // Handle custom sets.\n case '[':\n // Check if this class is 'anti' i.e. [^abc].\n var not;\n if (str[i] === '^') {\n not = true;\n i++;\n } else {\n not = false;\n }\n\n // Get all the characters in class.\n var classTokens = util.tokenizeClass(str.slice(i), regexpStr);\n\n // Increase index by length of class.\n i += classTokens[1];\n last.push({\n type: types.SET,\n set: classTokens[0],\n not,\n });\n\n break;\n\n\n // Class of any character except \\n.\n case '.':\n last.push(sets.anyChar());\n break;\n\n\n // Push group onto stack.\n case '(':\n // Create group.\n var group = {\n type: types.GROUP,\n stack: [],\n remember: true,\n };\n\n c = str[i];\n\n // If if this is a special kind of group.\n if (c === '?') {\n c = str[i + 1];\n i += 2;\n\n // Match if followed by.\n if (c === '=') {\n group.followedBy = true;\n\n // Match if not followed by.\n } else if (c === '!') {\n group.notFollowedBy = true;\n\n } else if (c !== ':') {\n util.error(regexpStr,\n `Invalid group, character '${c}'` +\n ` after '?' at column ${i - 1}`);\n }\n\n group.remember = false;\n }\n\n // Insert subgroup into current group stack.\n last.push(group);\n\n // Remember the current group for when the group closes.\n groupStack.push(lastGroup);\n\n // Make this new group the current group.\n lastGroup = group;\n last = group.stack;\n break;\n\n\n // Pop group out of stack.\n case ')':\n if (groupStack.length === 0) {\n util.error(regexpStr, `Unmatched ) at column ${i - 1}`);\n }\n lastGroup = groupStack.pop();\n\n // Check if this group has a PIPE.\n // To get back the correct last stack.\n last = lastGroup.options ?\n lastGroup.options[lastGroup.options.length - 1] : lastGroup.stack;\n break;\n\n\n // Use pipe character to give more choices.\n case '|':\n // Create array where options are if this is the first PIPE\n // in this clause.\n if (!lastGroup.options) {\n lastGroup.options = [lastGroup.stack];\n delete lastGroup.stack;\n }\n\n // Create a new stack and add to options for rest of clause.\n var stack = [];\n lastGroup.options.push(stack);\n last = stack;\n break;\n\n\n // Repetition.\n // For every repetition, remove last element from last stack\n // then insert back a RANGE object.\n // This design is chosen because there could be more than\n // one repetition symbols in a regex i.e. `a?+{2,3}`.\n case '{':\n var rs = /^(\\d+)(,(\\d+)?)?\\}/.exec(str.slice(i)), min, max;\n if (rs !== null) {\n if (last.length === 0) {\n repeatErr(i);\n }\n min = parseInt(rs[1], 10);\n max = rs[2] ? rs[3] ? parseInt(rs[3], 10) : Infinity : min;\n i += rs[0].length;\n\n last.push({\n type: types.REPETITION,\n min,\n max,\n value: last.pop(),\n });\n } else {\n last.push({\n type: types.CHAR,\n value: 123,\n });\n }\n break;\n\n case '?':\n if (last.length === 0) {\n repeatErr(i);\n }\n last.push({\n type: types.REPETITION,\n min: 0,\n max: 1,\n value: last.pop(),\n });\n break;\n\n case '+':\n if (last.length === 0) {\n repeatErr(i);\n }\n last.push({\n type: types.REPETITION,\n min: 1,\n max: Infinity,\n value: last.pop(),\n });\n break;\n\n case '*':\n if (last.length === 0) {\n repeatErr(i);\n }\n last.push({\n type: types.REPETITION,\n min: 0,\n max: Infinity,\n value: last.pop(),\n });\n break;\n\n\n // Default is a character that is not `\\[](){}?+*^$`.\n default:\n last.push({\n type: types.CHAR,\n value: c.charCodeAt(0),\n });\n }\n\n }\n\n // Check if any groups have not been closed.\n if (groupStack.length !== 0) {\n util.error(regexpStr, 'Unterminated group');\n }\n\n return start;\n};\n\nmodule.exports.types = types;\n","'use strict';\n/* eslint indent: 4 */\n\n\n// Private helper class\nclass SubRange {\n constructor(low, high) {\n this.low = low;\n this.high = high;\n this.length = 1 + high - low;\n }\n\n overlaps(range) {\n return !(this.high < range.low || this.low > range.high);\n }\n\n touches(range) {\n return !(this.high + 1 < range.low || this.low - 1 > range.high);\n }\n\n // Returns inclusive combination of SubRanges as a SubRange.\n add(range) {\n return new SubRange(\n Math.min(this.low, range.low),\n Math.max(this.high, range.high)\n );\n }\n\n // Returns subtraction of SubRanges as an array of SubRanges.\n // (There's a case where subtraction divides it in 2)\n subtract(range) {\n if (range.low <= this.low && range.high >= this.high) {\n return [];\n } else if (range.low > this.low && range.high < this.high) {\n return [\n new SubRange(this.low, range.low - 1),\n new SubRange(range.high + 1, this.high)\n ];\n } else if (range.low <= this.low) {\n return [new SubRange(range.high + 1, this.high)];\n } else {\n return [new SubRange(this.low, range.low - 1)];\n }\n }\n\n toString() {\n return this.low == this.high ?\n this.low.toString() : this.low + '-' + this.high;\n }\n}\n\n\nclass DRange {\n constructor(a, b) {\n this.ranges = [];\n this.length = 0;\n if (a != null) this.add(a, b);\n }\n\n _update_length() {\n this.length = this.ranges.reduce((previous, range) => {\n return previous + range.length;\n }, 0);\n }\n\n add(a, b) {\n var _add = (subrange) => {\n var i = 0;\n while (i < this.ranges.length && !subrange.touches(this.ranges[i])) {\n i++;\n }\n var newRanges = this.ranges.slice(0, i);\n while (i < this.ranges.length && subrange.touches(this.ranges[i])) {\n subrange = subrange.add(this.ranges[i]);\n i++;\n }\n newRanges.push(subrange);\n this.ranges = newRanges.concat(this.ranges.slice(i));\n this._update_length();\n }\n\n if (a instanceof DRange) {\n a.ranges.forEach(_add);\n } else {\n if (b == null) b = a;\n _add(new SubRange(a, b));\n }\n return this;\n }\n\n subtract(a, b) {\n var _subtract = (subrange) => {\n var i = 0;\n while (i < this.ranges.length && !subrange.overlaps(this.ranges[i])) {\n i++;\n }\n var newRanges = this.ranges.slice(0, i);\n while (i < this.ranges.length && subrange.overlaps(this.ranges[i])) {\n newRanges = newRanges.concat(this.ranges[i].subtract(subrange));\n i++;\n }\n this.ranges = newRanges.concat(this.ranges.slice(i));\n this._update_length();\n };\n\n if (a instanceof DRange) {\n a.ranges.forEach(_subtract);\n } else {\n if (b == null) b = a;\n _subtract(new SubRange(a, b));\n }\n return this;\n }\n\n intersect(a, b) {\n var newRanges = [];\n var _intersect = (subrange) => {\n var i = 0;\n while (i < this.ranges.length && !subrange.overlaps(this.ranges[i])) {\n i++;\n }\n while (i < this.ranges.length && subrange.overlaps(this.ranges[i])) {\n var low = Math.max(this.ranges[i].low, subrange.low);\n var high = Math.min(this.ranges[i].high, subrange.high);\n newRanges.push(new SubRange(low, high));\n i++;\n }\n };\n\n if (a instanceof DRange) {\n a.ranges.forEach(_intersect);\n } else {\n if (b == null) b = a;\n _intersect(new SubRange(a, b));\n }\n this.ranges = newRanges;\n this._update_length();\n return this;\n }\n\n index(index) {\n var i = 0;\n while (i < this.ranges.length && this.ranges[i].length <= index) {\n index -= this.ranges[i].length;\n i++;\n }\n return this.ranges[i].low + index;\n }\n\n toString() {\n return '[ ' + this.ranges.join(', ') + ' ]';\n }\n\n clone() {\n return new DRange(this);\n }\n\n numbers() {\n return this.ranges.reduce((result, subrange) => {\n var i = subrange.low;\n while (i <= subrange.high) {\n result.push(i);\n i++;\n }\n return result;\n }, []);\n }\n\n subranges() {\n return this.ranges.map((subrange) => ({\n low: subrange.low,\n high: subrange.high,\n length: 1 + subrange.high - subrange.low\n }));\n }\n}\n\nmodule.exports = DRange;\n","const ret = require('ret');\nconst DRange = require('drange');\nconst types = ret.types;\n\n\nmodule.exports = class RandExp {\n /**\n * @constructor\n * @param {RegExp|String} regexp\n * @param {String} m\n */\n constructor(regexp, m) {\n this._setDefaults(regexp);\n if (regexp instanceof RegExp) {\n this.ignoreCase = regexp.ignoreCase;\n this.multiline = regexp.multiline;\n regexp = regexp.source;\n\n } else if (typeof regexp === 'string') {\n this.ignoreCase = m && m.indexOf('i') !== -1;\n this.multiline = m && m.indexOf('m') !== -1;\n } else {\n throw new Error('Expected a regexp or string');\n }\n\n this.tokens = ret(regexp);\n }\n\n\n /**\n * Checks if some custom properties have been set for this regexp.\n *\n * @param {RandExp} randexp\n * @param {RegExp} regexp\n */\n _setDefaults(regexp) {\n // When a repetitional token has its max set to Infinite,\n // randexp won't actually generate a random amount between min and Infinite\n // instead it will see Infinite as min + 100.\n this.max = regexp.max != null ? regexp.max :\n RandExp.prototype.max != null ? RandExp.prototype.max : 100;\n\n // This allows expanding to include additional characters\n // for instance: RandExp.defaultRange.add(0, 65535);\n this.defaultRange = regexp.defaultRange ?\n regexp.defaultRange : this.defaultRange.clone();\n\n if (regexp.randInt) {\n this.randInt = regexp.randInt;\n }\n }\n\n\n /**\n * Generates the random string.\n *\n * @return {String}\n */\n gen() {\n return this._gen(this.tokens, []);\n }\n\n\n /**\n * Generate random string modeled after given tokens.\n *\n * @param {Object} token\n * @param {Array.<String>} groups\n * @return {String}\n */\n _gen(token, groups) {\n var stack, str, n, i, l;\n\n switch (token.type) {\n case types.ROOT:\n case types.GROUP:\n // Ignore lookaheads for now.\n if (token.followedBy || token.notFollowedBy) { return ''; }\n\n // Insert placeholder until group string is generated.\n if (token.remember && token.groupNumber === undefined) {\n token.groupNumber = groups.push(null) - 1;\n }\n\n stack = token.options ?\n this._randSelect(token.options) : token.stack;\n\n str = '';\n for (i = 0, l = stack.length; i < l; i++) {\n str += this._gen(stack[i], groups);\n }\n\n if (token.remember) {\n groups[token.groupNumber] = str;\n }\n return str;\n\n case types.POSITION:\n // Do nothing for now.\n return '';\n\n case types.SET:\n var expandedSet = this._expand(token);\n if (!expandedSet.length) { return ''; }\n return String.fromCharCode(this._randSelect(expandedSet));\n\n case types.REPETITION:\n // Randomly generate number between min and max.\n n = this.randInt(token.min,\n token.max === Infinity ? token.min + this.max : token.max);\n\n str = '';\n for (i = 0; i < n; i++) {\n str += this._gen(token.value, groups);\n }\n\n return str;\n\n case types.REFERENCE:\n return groups[token.value - 1] || '';\n\n case types.CHAR:\n var code = this.ignoreCase && this._randBool() ?\n this._toOtherCase(token.value) : token.value;\n return String.fromCharCode(code);\n }\n }\n\n\n /**\n * If code is alphabetic, converts to other case.\n * If not alphabetic, returns back code.\n *\n * @param {Number} code\n * @return {Number}\n */\n _toOtherCase(code) {\n return code + (97 <= code && code <= 122 ? -32 :\n 65 <= code && code <= 90 ? 32 : 0);\n }\n\n\n /**\n * Randomly returns a true or false value.\n *\n * @return {Boolean}\n */\n _randBool() {\n return !this.randInt(0, 1);\n }\n\n\n /**\n * Randomly selects and returns a value from the array.\n *\n * @param {Array.<Object>} arr\n * @return {Object}\n */\n _randSelect(arr) {\n if (arr instanceof DRange) {\n return arr.index(this.randInt(0, arr.length - 1));\n }\n return arr[this.randInt(0, arr.length - 1)];\n }\n\n\n /**\n * expands a token to a DiscontinuousRange of characters which has a\n * length and an index function (for random selecting)\n *\n * @param {Object} token\n * @return {DiscontinuousRange}\n */\n _expand(token) {\n if (token.type === ret.types.CHAR) {\n return new DRange(token.value);\n } else if (token.type === ret.types.RANGE) {\n return new DRange(token.from, token.to);\n } else {\n let drange = new DRange();\n for (let i = 0; i < token.set.length; i++) {\n let subrange = this._expand(token.set[i]);\n drange.add(subrange);\n if (this.ignoreCase) {\n for (let j = 0; j < subrange.length; j++) {\n let code = subrange.index(j);\n let otherCaseCode = this._toOtherCase(code);\n if (code !== otherCaseCode) {\n drange.add(otherCaseCode);\n }\n }\n }\n }\n if (token.not) {\n return this.defaultRange.clone().subtract(drange);\n } else {\n return this.defaultRange.clone().intersect(drange);\n }\n }\n }\n\n\n /**\n * Randomly generates and returns a number between a and b (inclusive).\n *\n * @param {Number} a\n * @param {Number} b\n * @return {Number}\n */\n randInt(a, b) {\n return a + Math.floor(Math.random() * (1 + b - a));\n }\n\n\n /**\n * Default range of characters to generate from.\n */\n get defaultRange() {\n return this._range = this._range || new DRange(32, 126);\n }\n\n set defaultRange(range) {\n this._range = range;\n }\n\n\n /**\n *\n * Enables use of randexp with a shorter call.\n *\n * @param {RegExp|String| regexp}\n * @param {String} m\n * @return {String}\n */\n static randexp(regexp, m) {\n var randexp;\n if(typeof regexp === 'string') {\n regexp = new RegExp(regexp, m);\n }\n\n if (regexp._randexp === undefined) {\n randexp = new RandExp(regexp, m);\n regexp._randexp = randexp;\n } else {\n randexp = regexp._randexp;\n randexp._setDefaults(regexp);\n }\n return randexp.gen();\n }\n\n\n /**\n * Enables sugary /regexp/.gen syntax.\n */\n static sugar() {\n /* eshint freeze:false */\n RegExp.prototype.gen = function() {\n return RandExp.randexp(this);\n };\n }\n};\n","import type { SchemaValidationErrorType } from '.'\nimport type { JsfSchemaType, NonBooleanJsfSchema, SchemaValue } from '../types'\nimport { randexp } from 'randexp'\n\nexport function getErrorMessage(\n schema: NonBooleanJsfSchema,\n value: SchemaValue,\n validation: SchemaValidationErrorType,\n): string {\n switch (validation) {\n // Core validation\n case 'type':\n return getTypeErrorMessage(schema.type)\n case 'required':\n return 'Required field'\n case 'valid':\n return 'Always fails'\n case 'const':\n return `The only accepted value is ${JSON.stringify(schema.const)}`\n case 'enum':\n return `The option \"${valueToString(value)}\" is not valid.`\n // Schema composition\n case 'anyOf':\n return `The option \"${valueToString(value)}\" is not valid.`\n case 'oneOf':\n return `The option \"${valueToString(value)}\" is not valid.`\n case 'not':\n return 'The value must not satisfy the provided schema'\n // String validation\n case 'minLength':\n return `Please insert at least ${schema.minLength} characters`\n case 'maxLength':\n return `Please insert up to ${schema.maxLength} characters`\n case 'pattern':\n return `Must have a valid format. E.g. ${randexp(schema.pattern || '')}`\n case 'format':\n if (schema.format === 'email') {\n return 'Please enter a valid email address'\n }\n return `Must be a valid ${schema.format} format`\n // Number validation\n case 'multipleOf':\n return `Must be a multiple of ${schema.multipleOf}`\n case 'maximum':\n return `Must be smaller or equal to ${schema.maximum}`\n case 'exclusiveMaximum':\n return `Must be smaller than ${schema.exclusiveMaximum}`\n case 'minimum':\n return `Must be greater or equal to ${schema.minimum}`\n case 'exclusiveMinimum':\n return `Must be greater than ${schema.exclusiveMinimum}`\n }\n}\n\n/**\n * Get the appropriate type error message based on the schema type\n */\nfunction getTypeErrorMessage(schemaType: JsfSchemaType | JsfSchemaType[] | undefined): string {\n if (Array.isArray(schemaType)) {\n // Map 'integer' to 'number' in error messages\n const formattedTypes = schemaType.map((type) => {\n if (type === 'integer')\n return 'number'\n return type\n })\n\n return `The value must be a ${formattedTypes.join(' or ')}`\n }\n\n switch (schemaType) {\n case 'number':\n case 'integer':\n return 'The value must be a number'\n case 'boolean':\n return 'The value must be a boolean'\n case 'null':\n return 'The value must be null'\n case 'string':\n return 'The value must be a string'\n case 'object':\n return 'The value must be an object'\n case 'array':\n return 'The value must be an array'\n default:\n return schemaType ? `The value must be ${schemaType}` : 'Invalid value'\n }\n}\n\nfunction valueToString(value: SchemaValue): string {\n if (typeof value === 'string') {\n return value\n }\n return JSON.stringify(value)\n}\n","import type { Field } from '../field/type'\nimport type { JsfSchema } from '../types'\n\nfunction sort(params: {\n fields: Field[]\n order: string[]\n}): Field[] {\n const { fields: prevFields, order } = params\n\n // Map from field name to expected index\n const indexMap: Record<string, number | undefined> = {}\n order.forEach((key, index) => {\n indexMap[key] = index\n })\n\n const nextFields = prevFields.sort((a, b) => {\n // Compare by index\n const indexA = indexMap[a.name] ?? Infinity\n const indexB = indexMap[b.name] ?? Infinity\n\n // The else actually only happens when both are Infinity,\n // i.e., not specified in the order array\n if (indexA !== indexB)\n return indexA - indexB\n\n // If not specified, maintain original relative order\n return prevFields.indexOf(a) - prevFields.indexOf(b)\n })\n\n return nextFields\n}\n\n/**\n * Sort fields by schema's `x-jsf-order`\n */\nexport function setCustomOrder(params: {\n schema: JsfSchema\n fields: Field[]\n}): Field[] {\n const { schema, fields } = params\n\n // TypeScript does not yield if we remove this check,\n // but it's only because our typing is likely not right.\n // See internal discussion:\n // - https://remote-com.slack.com/archives/C02HTN0LY02/p1738745237733389?thread_ts=1738741631.346809&cid=C02HTN0LY02\n if (typeof schema === 'boolean')\n throw new Error('Schema must be an object')\n\n if (schema['x-jsf-order'] !== undefined)\n return sort({ fields, order: schema['x-jsf-order'] })\n\n return fields\n}\n","import type { JsfObjectSchema, JsfSchema, NonBooleanJsfSchema } from '../types'\nimport type { Field } from './type'\nimport { buildFieldObject } from './object'\n\n/**\n * Get the JSON type for a field\n * @param schema - The non boolean schema of the field\n * @returns The JSON type for the field, based schema type. Default to 'text'\n */\nfunction getJsonType(schema: NonBooleanJsfSchema): string {\n if (Array.isArray(schema.type)) {\n return 'select'\n }\n\n if (schema.type !== undefined) {\n return schema.type as string\n }\n\n return 'text'\n}\n\n/**\n * Convert options to the required format\n * This is used when we have a oneOf or anyOf schema property\n */\nfunction convertToOptions(nodeOptions: JsfSchema[]): Array<{\n label: string\n value: unknown\n [key: string]: unknown\n}> {\n return nodeOptions\n .filter((option): option is NonBooleanJsfSchema =>\n option !== null && typeof option === 'object')\n .map((schemaOption) => {\n const title = schemaOption.title\n const value = schemaOption.const\n const presentation = schemaOption['x-jsf-presentation']\n const meta = presentation?.meta\n\n const result: {\n label: string\n value: unknown\n [key: string]: unknown\n } = {\n label: title || '',\n value,\n }\n\n // Add meta if it exists\n if (meta) {\n result.meta = meta\n }\n\n // Add other properties, without known ones we already handled above\n const { title: _, const: __, 'x-jsf-presentation': ___, ...rest } = schemaOption\n\n return { ...result, ...rest }\n })\n}\n\n/**\n * Get field options from schema\n */\nfunction getFieldOptions(schema: NonBooleanJsfSchema) {\n // Handle oneOf or radio input type\n if (schema.oneOf) {\n return convertToOptions(schema.oneOf || [])\n }\n\n // Handle items.anyOf (for multiple select)\n if (schema.items?.anyOf) {\n return convertToOptions(schema.items.anyOf)\n }\n\n // Handle anyOf\n if (schema.anyOf) {\n return convertToOptions(schema.anyOf)\n }\n\n return null\n}\n\n/**\n * List of schema properties that should be excluded from the final field or handled specially\n */\nconst excludedSchemaProps = [\n 'title', // Transformed to 'label'\n 'type', // Handled separately\n 'x-jsf-errorMessage', // Handled separately\n 'x-jsf-presentation', // Handled separately\n 'oneOf', // Transformed to 'options'\n 'anyOf', // Transformed to 'options'\n 'items', // Handled specially for arrays\n]\n\n/**\n * Build a field from any schema\n */\nexport function buildFieldSchema(\n schema: JsfSchema,\n name: string,\n required: boolean = false,\n): Field | null {\n if (typeof schema === 'boolean') {\n return null\n }\n\n if (schema.type === 'object') {\n const objectSchema: JsfObjectSchema = { ...schema, type: 'object' }\n return buildFieldObject(objectSchema, name, required)\n }\n\n if (schema.type === 'array') {\n throw new TypeError('Array type is not yet supported')\n }\n\n const presentation = schema['x-jsf-presentation'] || {}\n const errorMessage = schema['x-jsf-errorMessage']\n\n // Get input type from presentation or fallback to schema type\n const inputType = presentation.inputType || 'text'\n\n // Build field with all schema properties by default, excluding ones that need special handling\n const field: Field = {\n // Spread all schema properties except excluded ones\n ...Object.entries(schema)\n .filter(([key]) => !excludedSchemaProps.includes(key))\n .reduce((acc, [key, value]) => ({ ...acc, [key]: value }), {}),\n\n // Add required field properties\n type: inputType,\n name,\n inputType,\n jsonType: getJsonType(schema),\n required,\n isVisible: true,\n ...(errorMessage && { errorMessage }),\n }\n\n if (schema.const) {\n field.const = schema.const\n\n if (inputType === 'checkbox') {\n field.checkboxValue = schema.const\n }\n }\n\n if (schema.title) {\n field.label = schema.title\n }\n\n // Spread presentation properties to the root level\n if (Object.keys(presentation).length > 0) {\n Object.entries(presentation).forEach(([key, value]) => {\n // inputType is already handled above\n if (key !== 'inputType') {\n field[key] = value\n }\n })\n }\n\n // Handle options\n const options = getFieldOptions(schema)\n if (options) {\n field.options = options\n }\n\n return field\n}\n","import type { JsfObjectSchema } from '../types'\nimport type { Field } from './type'\nimport { setCustomOrder } from '../custom/order'\nimport { buildFieldSchema } from './schema'\n\n/**\n * Build a field from an object schema\n * @param schema - The schema of the field\n * @param name - The name of the field, used if the schema has no title\n * @param required - Whether the field is required\n * @returns The field\n */\nexport function buildFieldObject(schema: JsfObjectSchema, name: string, required: boolean) {\n const fields: Field[] = []\n\n for (const key in schema.properties) {\n const isRequired = schema.required?.includes(key) || false\n const field = buildFieldSchema(schema.properties[key], key, isRequired)\n if (field) {\n fields.push(field)\n }\n }\n\n const orderedFields = setCustomOrder({ fields, schema })\n\n const field: Field = {\n ...schema['x-jsf-presentation'],\n type: schema['x-jsf-presentation']?.inputType || 'fieldset',\n inputType: schema['x-jsf-presentation']?.inputType || 'fieldset',\n jsonType: 'object',\n name,\n required,\n fields: orderedFields,\n isVisible: true,\n }\n\n if (schema.title !== undefined) {\n field.label = schema.title\n }\n\n if (schema['x-jsf-presentation']?.accept) {\n field.accept = schema['x-jsf-presentation']?.accept\n }\n\n return field\n}\n","/**\n * This module implements JSON Schema composition keywords (allOf, anyOf, oneOf, not).\n * These keywords apply subschemas to the same location in the instance as the parent schema.\n * Each subschema is evaluated independently, and results are combined according to the keyword's logic.\n * @see {@link https://json-schema.org/understanding-json-schema/reference/combining.html Schema Composition}\n */\n\nimport type { ValidationError, ValidationErrorPath } from '../errors'\nimport type { ValidationOptions } from '../form'\nimport type { JsfSchema, SchemaValue } from '../types'\nimport { validateSchema } from './schema'\n\n/**\n * Validate a value against the `allOf` keyword in a schema.\n * The value must validate successfully against ALL schemas in the allOf array.\n * Validation stops at the first schema that fails, returning its errors.\n *\n * @example\n * ```json\n * {\n * \"allOf\": [\n * { \"type\": \"string\" },\n * { \"maxLength\": 5 }\n * ]\n * }\n * ```\n * This schema validates strings with maximum length of 5.\n */\nexport function validateAllOf(\n value: SchemaValue,\n schema: JsfSchema,\n options: ValidationOptions,\n path: ValidationErrorPath = [],\n): ValidationError[] {\n if (!schema.allOf) {\n return []\n }\n\n for (let i = 0; i < schema.allOf.length; i++) {\n const subSchema = schema.allOf[i]\n const errors = validateSchema(value, subSchema, options, [...path, 'allOf', i])\n if (errors.length > 0) {\n return errors\n }\n }\n\n return []\n}\n\n/**\n * Validate a value against the `anyOf` keyword in a schema.\n * The value must validate successfully against AT LEAST ONE schema in the anyOf array.\n * Returns no errors if any schema validates, otherwise returns a generic anyOf error.\n *\n * @example\n * ```json\n * {\n * \"anyOf\": [\n * { \"type\": \"string\", \"maxLength\": 5 },\n * { \"type\": \"number\", \"minimum\": 0 }\n * ]\n * }\n * ```\n * This schema validates either short strings or positive numbers.\n */\nexport function validateAnyOf(\n value: SchemaValue,\n schema: JsfSchema,\n options: ValidationOptions,\n path: ValidationErrorPath = [],\n): ValidationError[] {\n if (!schema.anyOf) {\n return []\n }\n\n for (const subSchema of schema.anyOf) {\n const errors = validateSchema(value, subSchema, options, path)\n if (errors.length === 0) {\n return []\n }\n }\n\n return [\n {\n path,\n validation: 'anyOf',\n },\n ]\n}\n\n/**\n * Validate a value against the `oneOf` keyword in a schema.\n * The value must validate successfully against EXACTLY ONE schema in the oneOf array.\n * Returns an error if no schemas validate or if multiple schemas validate.\n *\n * @example\n * ```json\n * {\n * \"oneOf\": [\n * { \"type\": \"number\", \"multipleOf\": 5 },\n * { \"type\": \"number\", \"multipleOf\": 3 }\n * ]\n * }\n * ```\n * This schema validates numbers that are multiples of either 5 or 3, but not both.\n */\nexport function validateOneOf(\n value: SchemaValue,\n schema: JsfSchema,\n options: ValidationOptions,\n path: ValidationErrorPath = [],\n): ValidationError[] {\n if (!schema.oneOf) {\n return []\n }\n\n let validCount = 0\n\n for (let i = 0; i < schema.oneOf.length; i++) {\n const errors = validateSchema(value, schema.oneOf[i], options, path)\n if (errors.length === 0) {\n validCount++\n if (validCount > 1) {\n break\n }\n }\n }\n\n if (validCount === 0) {\n return [\n {\n path,\n validation: 'oneOf',\n },\n ]\n }\n\n if (validCount > 1) {\n return [\n {\n path,\n validation: 'oneOf',\n },\n ]\n }\n\n return []\n}\n\n/**\n * Validate a value against the `not` keyword in a schema.\n * The value must NOT validate successfully against the schema defined by the not keyword.\n * Returns an error if the value validates against the not schema.\n *\n * @example\n * ```json\n * {\n * \"not\": { \"type\": \"string\" }\n * }\n * ```\n * This schema validates any value that is not a string.\n *\n * Note: When the not schema is a boolean:\n * - true: Always returns an error (nothing should validate)\n * - false: Always returns no errors (everything validates)\n */\nexport function validateNot(\n value: SchemaValue,\n schema: JsfSchema,\n options: ValidationOptions,\n path: ValidationErrorPath = [],\n): ValidationError[] {\n if (schema.not === undefined) {\n return []\n }\n\n if (typeof schema.not === 'boolean') {\n return schema.not\n ? [{ path, validation: 'not' }]\n : []\n }\n\n const notErrors = validateSchema(value, schema.not, options, path)\n return notErrors.length === 0\n ? [{ path, validation: 'not' }]\n : []\n}\n","import type { ValidationError, ValidationErrorPath } from '../errors'\nimport type { ValidationOptions } from '../form'\nimport type { NonBooleanJsfSchema, SchemaValue } from '../types'\nimport { validateSchema } from './schema'\n\nexport function validateCondition(\n value: SchemaValue,\n schema: NonBooleanJsfSchema,\n options: ValidationOptions,\n path: ValidationErrorPath = [],\n): ValidationError[] {\n if (schema.if === undefined) {\n return []\n }\n\n const conditionIsTrue = validateSchema(value, schema.if, options, path).length === 0\n\n if (conditionIsTrue && schema.then !== undefined) {\n return validateSchema(value, schema.then, options, [...path, 'then'])\n }\n\n if (!conditionIsTrue && schema.else !== undefined) {\n return validateSchema(value, schema.else, options, [...path, 'else'])\n }\n\n return []\n}\n","import type { ObjectValue, SchemaValue } from '../types'\n\n/**\n * Type guard to check if a given SchemaValue is an ObjectValue\n * @param v - The value to check\n * @returns `true` if the value is an object, `false` otherwise\n */\nexport function isObjectValue(v: SchemaValue): v is ObjectValue {\n return typeof v === 'object' && v !== null && !Array.isArray(v)\n}\n\n/**\n * Compare two values for deep equality\n * @param a - The first value to compare\n * @param b - The second value to compare\n * @returns `true` if the values are equal, `false` otherwise\n * @description This function is compares two values for deep equality.\n * Primitives are compared using strict equality.\n * Arrays are compared element by element using recursion.\n * Objects are compared key by key using recursion.\n */\nexport function deepEqual(a: SchemaValue, b: SchemaValue): boolean {\n if (typeof a !== typeof b) {\n return false\n }\n\n if (a === b) {\n return true\n }\n\n // If both are null, the check above has returned true.\n // If one is null, we return false because we know they are not equal\n // and since `typeof null === 'object'`, we must not let the null value\n // pass through as an object.\n if (a === null || b === null) {\n return false\n }\n\n // Handle arrays\n if (Array.isArray(a) && Array.isArray(b)) {\n // If the array lengths are different, the arrays are not equal\n if (a.length !== b.length) {\n return false\n }\n\n // If all values are equal, the arrays are equal\n return a.every((item, index) => deepEqual(item, b[index]))\n }\n\n // Handle objects\n if (isObjectValue(a) && isObjectValue(b)) {\n const aKeys = Object.keys(a).sort()\n const bKeys = Object.keys(b).sort()\n\n // If the key lengths are different, the objects are not equal\n if (aKeys.length !== bKeys.length) {\n return false\n }\n\n // If the keys are different, the objects are not equal\n if (!deepEqual(aKeys, bKeys)) {\n return false\n }\n\n // Check all values\n return aKeys.every(key => deepEqual(a[key], b[key]))\n }\n\n return false\n}\n","import type { ValidationError, ValidationErrorPath } from '../errors'\nimport type { NonBooleanJsfSchema, SchemaValue } from '../types'\nimport { deepEqual } from './util'\n\n/**\n * Validate that a value is equal to a constant\n * @param value - The value to validate\n * @param schema - The schema to validate against\n * @param path - The path to the value\n * @returns An array of validation errors\n * @description This function validates that a value is equal to a constant.\n * The constant is defined in the `const` property of the schema.\n * The value is validated against the constant using deep equality.\n * @see https://json-schema.org/understanding-json-schema/reference/const\n * @see https://json-schema.org/draft/2020-12/json-schema-validation#name-enum\n */\nexport function validateConst(\n value: SchemaValue,\n schema: NonBooleanJsfSchema,\n path: ValidationErrorPath = [],\n): ValidationError[] {\n if (schema.const === undefined) {\n return []\n }\n\n if (!deepEqual(schema.const, value)) {\n return [\n { path, validation: 'const' },\n ]\n }\n\n return []\n}\n","import type { ValidationError, ValidationErrorPath } from '../errors'\nimport type { NonBooleanJsfSchema, SchemaValue } from '../types'\nimport { deepEqual } from './util'\n\n/**\n * Validate that the value is one of the allowed enum values\n * @param value - The value to validate\n * @param schema - The schema to validate against\n * @param path - The path to the value\n * @returns An array of validation errors\n *\n * @example\n * ```ts\n * validateEnum('foo', { enum: ['foo', 'bar'] }) // []\n * validateEnum('baz', { enum: ['foo', 'bar'] }) // [{ path: [], validation: 'enum', message: 'The option \"baz\" is not valid.' }]\n * ```\n * @see https://json-schema.org/understanding-json-schema/reference/enum\n * @see https://json-schema.org/draft/2020-12/json-schema-validation#name-enum\n */\nexport function validateEnum(\n value: SchemaValue,\n schema: NonBooleanJsfSchema,\n path: ValidationErrorPath = [],\n): ValidationError[] {\n if (schema.enum === undefined) {\n return []\n }\n\n if (!schema.enum.some(enumValue => deepEqual(enumValue, value))) {\n return [\n { path, validation: 'enum' },\n ]\n }\n\n return []\n}\n","import type { ValidationError, ValidationErrorPath } from '../errors'\nimport type { NonBooleanJsfSchema, SchemaValue } from '../types'\nimport { getSchemaType } from './schema'\n\n/**\n * Validate a number against a schema\n * @param value - The value to validate\n * @param schema - The schema to validate against\n * @param path - The path to the current field being validated\n * @returns An array of validation errors\n * @description\n * Implements number validation according to JSON Schema 2020-12:\n * - MultipleOf validation\n * - Maximum validation\n * - ExclusiveMaximum validation\n * - Minimum validation\n * - ExclusiveMinimum validation\n */\nexport function validateNumber(\n value: SchemaValue,\n schema: NonBooleanJsfSchema,\n path: ValidationErrorPath = [],\n): ValidationError[] {\n const errors: ValidationError[] = []\n const schemaType = getSchemaType(schema)\n\n if (typeof value !== 'number') {\n return []\n }\n\n if (schemaType !== undefined && !['number', 'integer'].includes(schemaType as string)) {\n return []\n }\n\n // MultipleOf validation - dividing value by multipleOf must have no remainder\n if (schema.multipleOf !== undefined && value % schema.multipleOf !== 0) {\n errors.push({ path, validation: 'multipleOf' })\n }\n\n // Maximum validation - value must be less than or equal to maximum\n if (schema.maximum !== undefined && value > schema.maximum) {\n errors.push({ path, validation: 'maximum' })\n }\n\n // ExclusiveMaximum validation - value must be less than exclusiveMaximum\n if (schema.exclusiveMaximum !== undefined && value >= schema.exclusiveMaximum) {\n errors.push({ path, validation: 'exclusiveMaximum' })\n }\n\n // Minimum validation - value must be greater than or equal to minimum\n if (schema.minimum !== undefined && value < schema.minimum) {\n errors.push({ path, validation: 'minimum' })\n }\n\n // ExclusiveMinimum validation - value must be greater than exclusiveMinimum\n if (schema.exclusiveMinimum !== undefined && value <= schema.exclusiveMinimum) {\n errors.push({ path, validation: 'exclusiveMinimum' })\n }\n\n return errors\n}\n","import type { ValidationError, ValidationErrorPath } from '../errors'\nimport type { ValidationOptions } from '../form'\nimport type { NonBooleanJsfSchema, SchemaValue } from '../types'\nimport { validateSchema } from './schema'\nimport { isObjectValue } from './util'\n\n/**\n * Validate an object against a schema\n * @param value - The value to validate\n * @param schema - The schema to validate against\n * @param options - The validation options\n * @param path - The path to the current field being validated\n * @returns An array of validation errors\n * @description\n * Validates each property of object against the schema while keeping track of the path to the property.\n * Each property is validated with `validateSchema`.\n */\nexport function validateObject(\n value: SchemaValue,\n schema: NonBooleanJsfSchema,\n options: ValidationOptions,\n path: ValidationErrorPath = [],\n): ValidationError[] {\n if (typeof schema === 'object' && schema.properties && isObjectValue(value)) {\n const errors = []\n for (const [key, propertySchema] of Object.entries(schema.properties)) {\n errors.push(...validateSchema(value[key], propertySchema, options, [...path, key]))\n }\n return errors\n }\n\n return []\n}\n","// @generated\n// This code is automatically generated. Manual editing is not recommended.\n\n/*\n * BSD-2-Clause License\n *\n * Original source code is copyright (c) 2022 Jeremy Rylan\n * <https://github.com/jrylan>\n *\n * Documentation and keyword descriptions are copyright (c) 2020 IETF Trust\n * <https://www.ietf.org/>, Austin Wright <aaa@bzfx.net>, Henry Andrews\n * <andrews_henry@yahoo.com>, Ben Hutton <ben@jsonschema.dev>, and Greg Dennis\n * <gregsdennis@yahoo.com>. All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions are met:\n *\n * 1. Redistributions of source code must retain the above copyright notice,\n * this list of conditions and the following disclaimer.\n *\n * 2. Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation\n * and/or other materials provided with the distribution.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n */\n\nexport const draft = \"2020-12\" as const;\nexport const $schema = \"https://json-schema.org/draft/2020-12/schema\" as const;\n\ntype MaybeReadonlyArray<T> = Array<T> | ReadonlyArray<T>;\ntype ValueOf<T> = T[keyof T];\n\n/**\n * JSON Schema [Draft 2020-12](https://json-schema.org/draft/2020-12/json-schema-validation.html)\n */\nexport type JSONSchema<\n Value = any,\n SchemaType = Value extends boolean ? \"boolean\"\n : Value extends null ? \"null\"\n : Value extends number ? \"number\" | \"integer\"\n : Value extends string ? \"string\"\n : Value extends unknown[] ? \"array\"\n : Value extends Record<string | number, unknown> ? \"object\"\n : JSONSchema.TypeValue,\n> = boolean | {\n /**\n * Using JSON Pointer fragments requires knowledge of the structure of the\n * schema. When writing schema documents with the intention to provide\n * re-usable schemas, it may be preferable to use a plain name fragment\n * that is not tied to any particular structural location. This allows a\n * subschema to be relocated without requiring JSON Pointer references to\n * be updated.\n *\n * The `$anchor` keyword is used to specify such a fragment. It is an\n * identifier keyword that can only be used to create plain name fragments.\n *\n * If present, the value of this keyword MUST be a string, which MUST start\n * with a letter `[A-Za-z]`, followed by any number of letters, digits\n * `[0-9]`, hyphens `-`, underscores `_`, colons `:`,\n * or periods `.`.\n *\n * Note that the anchor string does not include the `#` character,\n * as it is not a URI-reference. An `{\"$anchor\": \"foo\"}` becomes the\n * fragment `#foo` when used in a URI.\n *\n * The base URI to which the resulting fragment is appended is determined\n * by the `$id` keyword as explained in the previous section.\n * Two `$anchor` keywords in the same schema document MAY have the same\n * value if they apply to different base URIs, as the resulting full URIs\n * will be distinct. However, the effect of two `$anchor` keywords\n * with the same value and the same base URI is undefined. Implementations\n * MAY raise an error if such usage is detected.\n */\n $anchor?: string;\n\n /**\n * This keyword reserves a location for comments from schema authors to\n * readers or maintainers of the schema.\n *\n * The value of this keyword MUST be a string. Implementations MUST NOT\n * present this string to end users. Tools for editing schemas SHOULD\n * support displaying and editing this keyword. The value of this keyword\n * MAY be used in debug or error output which is intended for developers\n * making use of schemas.\n *\n * Schema vocabularies SHOULD allow `$comment` within any object\n * containing vocabulary keywords. Implementations MAY assume `$comment`\n * is allowed unless the vocabulary specifically forbids it. Vocabularies\n * MUST NOT specify any effect of `$comment` beyond what is described in\n * this specification.\n *\n * Tools that translate other media types or programming languages\n * to and from `application/schema+json` MAY choose to convert that media\n * type or programming language's native comments to or from `$comment`\n * values. The behavior of such translation when both native comments and\n * `$comment` properties are present is implementation-dependent.\n *\n * Implementations MAY strip `$comment` values at any point during\n * processing. In particular, this allows for shortening schemas when the\n * size of deployed schemas is a concern.\n *\n * Implementations MUST NOT take any other action based on the presence,\n * absence, or contents of `$comment` properties. In particular, the\n * value of `$comment` MUST NOT be collected as an annotation result.\n */\n $comment?: string;\n\n /**\n * The `$defs` keyword reserves a location for schema authors to inline\n * re-usable JSON Schemas into a more general schema. The keyword does not\n * directly affect the validation result.\n *\n * This keyword's value MUST be an object. Each member value of this object\n * MUST be a valid JSON Schema.\n */\n $defs?: Record<string, JSONSchema>;\n\n /**\n * \"The `$dynamicAnchor` indicates that the fragment is an extension\n * point when used with the `$dynamicRef` keyword. This low-level,\n * advanced feature makes it easier to extend recursive schemas such as the\n * meta-schemas, without imposing any particular semantics on that\n * extension. See `$dynamicRef` for more details.\n */\n $dynamicAnchor?: string;\n\n /**\n * The `$dynamicRef` keyword is an applicator that allows for deferring\n * the full resolution until runtime, at which point it is resolved each\n * time it is encountered while evaluating an instance.\n *\n * Together with `$dynamicAnchor`, `$dynamicRef` implements a\n * cooperative extension mechanism that is primarily useful with recursive\n * schemas (schemas that reference themselves). Both the extension point\n * and the runtime-determined extension target are defined with\n * `$dynamicAnchor`, and only exhibit runtime dynamic behavior when\n * referenced with `$dynamicRef`.\n *\n * The value of the `$dynamicRef` property MUST be a string which is\n * a URI-Reference. Resolved against the current URI base, it produces\n * the URI used as the starting point for runtime resolution. This initial\n * resolution is safe to perform on schema load.\n *\n * If the initially resolved starting point URI includes a fragment that\n * was created by the `$dynamicAnchor` keyword, the initial URI MUST be\n * replaced by the URI (including the fragment) for the outermost schema\n * resource in the [dynamic scope][scopes] that defines\n * an identically named fragment with `$dynamicAnchor`.\n *\n * Otherwise, its behavior is identical to `$ref`, and no runtime\n * resolution is needed.\n *\n * [scopes]: https://json-schema.org/draft/2020-12/json-schema-core.html#scopes\n *\n * @format \"uri-reference\"\n */\n $dynamicRef?: string;\n\n /**\n * The `$id` keyword identifies a schema resource with its\n * [canonical][[RFC6596]] URI.\n *\n * Note that this URI is an identifier and not necessarily a network\n * locator. In the case of a network-addressable URL, a schema need not be\n * downloadable from its canonical URI.\n *\n * If present, the value for this keyword MUST be a string, and MUST\n * represent a valid [URI-reference][RFC3986]. This URI-reference SHOULD\n * be normalized, and MUST resolve to an [absolute-URI][RFC3986] (without a\n * fragment). Therefore, `$id` MUST NOT contain a non-empty fragment,\n * and SHOULD NOT contain an empty fragment.\n *\n * Since an empty fragment in the context of the\n * `application/schema+json` media type refers to the same resource as\n * the base URI without a fragment, an implementation MAY normalize a URI\n * ending with an empty fragment by removing the fragment. However, schema\n * authors SHOULD NOT rely on this behavior across implementations.\n *\n * This URI also serves as the base URI for relative URI-references in\n * keywords within the schema resource, in accordance with\n * [RFC 3986][RFC3986] section 5.1.1 regarding base URIs embedded in\n * content.\n *\n * The presence of `$id` in a subschema indicates that the subschema\n * constitutes a distinct schema resource within a single schema document.\n * Furthermore, in accordance with [RFC 3986][RFC3986] section 5.1.2\n * regarding encapsulating entities, if an `$id` in a subschema is a\n * relative URI-reference, the base URI for resolving that reference is the\n * URI of the parent schema resource.\n *\n * If no parent schema object explicitly identifies itself as a resource\n * with `$id`, the base URI is that of the entire document.\n *\n * The root schema of a JSON Schema document SHOULD contain an `$id`\n * keyword with an [absolute-URI][RFC3986] (containing a scheme, but no\n * fragment).\n *\n * [RFC6596]: https://datatracker.ietf.org/doc/html/rfc6596\n * [RFC3986]: https://datatracker.ietf.org/doc/html/rfc3986\n *\n * @format \"uri-reference\"\n */\n $id?: string;\n\n /**\n * The `$ref` keyword is an applicator that is used to reference a\n * statically identified schema. Its results are the results of the\n * referenced schema. Other keywords can appear alongside of `$ref` in\n * the same schema object.\n *\n * The value of the `$ref` property MUST be a string which is a\n * URI-Reference. Resolved against the current URI base, it produces the\n * URI of the schema to apply.\n *\n * @format \"uri-reference\"\n */\n $ref?: string;\n\n /**\n * The `$schema` keyword is both used as a JSON Schema dialect identifier\n * and as the identifier of a resource which is itself a JSON Schema, which\n * describes the set of valid schemas written for this particular dialect.\n *\n * The value of this keyword MUST be a [URI][RFC3986] (containing a scheme)\n * and this URI MUST be normalized. The current schema MUST be valid\n * against the meta-schema identified by this URI.\n *\n * If this URI identifies a retrievable resource, that resource SHOULD be\n * of media type `application/schema+json`.\n *\n * The `$schema` keyword SHOULD be used in the document root schema\n * object, and MAY be used in the root schema objects of embedded schema\n * resources. It MUST NOT appear in non-resource root schema objects. If\n * absent from the document root schema, the resulting behavior is\n * implementation-defined.\n *\n * Values for this property are defined elsewhere in this and other\n * documents, and by other parties.\n *\n * [RFC3986]: https://datatracker.ietf.org/doc/html/rfc3986\n *\n * @format \"uri\"\n */\n $schema?: string;\n\n /**\n * The `$vocabulary` keyword is used in meta-schemas to identify the\n * vocabularies available for use in schemas described by that meta-schema.\n * It is also used to indicate whether each vocabulary is required or\n * optional, in the sense that an implementation MUST understand the\n * required vocabularies in order to successfully process the schema.\n * Together, this information forms a dialect. Any vocabulary that is\n * understood by the implementation MUST be processed in a manner\n * consistent with the semantic definitions contained within the\n * vocabulary.\n *\n * The value of this keyword MUST be an object. The property names in the\n * object MUST be URIs (containing a scheme) and this URI MUST be\n * normalized. Each URI that appears as a property name identifies a\n * specific set of keywords and their semantics.\n *\n * The URI MAY be a URL, but the nature of the retrievable resource is\n * currently undefined, and reserved for future use. Vocabulary authors\n * MAY use the URL of the vocabulary specification, in a human-readable\n * media type such as `text/html` or `text/plain`, as the vocabulary\n * URI.\n *\n * The values of the object properties MUST be booleans. If the value is\n * `true`, then implementations that do not recognize the vocabulary MUST\n * refuse to process any schemas that declare this meta-schema with\n * `$schema`. If the value is `false`, implementations that do not\n * recognize the vocabulary SHOULD proceed with processing such schemas.\n * The value has no impact if the implementation understands the\n * vocabulary.\n *\n * Unrecognized keywords SHOULD be ignored. This remains the case for\n * keywords defined by unrecognized vocabularies. It is not currently\n * possible to distinguish between unrecognized keywords that are defined\n * in vocabularies from those that are not part of any vocabulary.\n *\n * The `$vocabulary` keyword SHOULD be used in the root schema of any\n * schema document intended for use as a meta-schema. It MUST NOT appear\n * in subschemas.\n *\n * The `$vocabulary` keyword MUST be ignored in schema documents that are\n * not being processed as a meta-schema.\n */\n $vocabulary?: Record<string, string>;\n\n /**\n * @deprecated `additionalItems` has been deprecated in favor of `prefixItems`\n * paired with `items`.\n */\n additionalItems?: JSONSchema;\n\n /**\n * The value of `additionalProperties` MUST be a valid JSON Schema.\n *\n * The behavior of this keyword depends on the presence and annotation\n * results of `properties` and `patternProperties` within the same\n * schema object. Validation with `additionalProperties` applies only to\n * the child values of instance names that do not appear in the annotation\n * results of either `properties` or `patternProperties`.\n *\n * For all such properties, validation succeeds if the child instance\n * validates against the `additionalProperties` schema.\n *\n * The annotation result of this keyword is the set of instance property\n * names validated by this keyword's subschema. Annotation results for\n * `additionalProperties` keywords from multiple schemas applied to the\n * same instance location are combined by taking the union of the sets.\n *\n * Omitting this keyword has the same assertion behavior as an empty\n * schema.\n *\n * Implementations MAY choose to implement or optimize this keyword in\n * another way that produces the same effect, such as by directly checking\n * the names in `properties` and the patterns in `patternProperties`\n * against the instance property set.\n */\n additionalProperties?: JSONSchema;\n\n /**\n * This keyword's value MUST be a non-empty array. Each item of the array\n * MUST be a valid JSON Schema.\n *\n * An instance validates successfully against this keyword if it validates\n * successfully against all schemas defined by this keyword's value.\n */\n allOf?: MaybeReadonlyArray<JSONSchema<Value, SchemaType>>;\n\n /**\n * This keyword's value MUST be a non-empty array. Each item of the array\n * MUST be a valid JSON Schema.\n *\n * An instance validates successfully against this keyword if it validates\n * successfully against at least one schema defined by this keyword's\n * value.\n */\n anyOf?: MaybeReadonlyArray<JSONSchema<Value, SchemaType>>;\n\n /**\n * An instance validates successfully against this keyword if its value is\n * equal to the value of the keyword.\n *\n * Use of this keyword is functionally equivalent to the `enum` keyword\n * with a single value.\n */\n const?: Value;\n\n /**\n * The value of this keyword MUST be a valid JSON Schema.\n *\n * An array instance is valid against `contains` if at least one of its\n * elements is valid against the given schema. The subschema MUST be\n * applied to every array element even after the first match has been\n * found, in order to collect annotations for use by other keywords.\n * This is to ensure that all possible annotations are collected.\n *\n * Logically, the validation result of applying the value subschema to each\n * item in the array MUST be OR'ed with `false`, resulting in an overall\n * validation result.\n *\n * This keyword produces an annotation value which is an array of the\n * indexes to which this keyword validates successfully when applying its\n * subschema, in ascending order. The value MAY be a boolean `true` if\n * the subschema validates successfully when applied to every index of the\n * instance. The annotation MUST be present if the instance array to which\n * this keyword's schema applies is empty.\n */\n contains?: JSONSchema<Value, SchemaType>;\n\n /**\n * If the instance value is a string, this property defines that the\n * string SHOULD be interpreted as binary data and decoded using the\n * encoding named by this property. [RFC 2045, Sec 6.1][RFC2045] lists the\n * possible values for this property.\n *\n * The value of this property SHOULD be ignored if the instance described\n * is not a string.\n *\n * If this keyword is absent, but `contentMediaType` is present, this\n * indicates that the media type could be encoded into `UTF-8` like any\n * other JSON string value, and does not require additional decoding.\n *\n * The value of this property MUST be a string.\n *\n * [RFC2045]: https://datatracker.ietf.org/doc/html/rfc2045#section-6.1\n */\n contentEncoding?:\n | \"7bit\"\n | \"8bit\"\n | \"base64\"\n | \"binary\"\n | \"ietf-token\"\n | \"quoted-printable\"\n | \"x-token\";\n\n /**\n * If the instance is a string, this property indicates the media type\n * of the contents of the string. If `contentEncoding` is present,\n * this property describes the decoded string.\n *\n * The value of this property must be a media type, as defined by\n * [RFC 2046][RFC2046]. This property defines the media type of instances\n * which this schema defines.\n *\n * The value of this property SHOULD be ignored if the instance described\n * is not a string.\n *\n * If the `contentEncoding` property is not present, but the instance\n * value is a string, then the value of this property SHOULD specify a text\n * document type, and the character set SHOULD be the character set into\n * which the JSON string value was decoded (for which the default is\n * Unicode).\n *\n * [RFC2046]: https://datatracker.ietf.org/doc/html/rfc2046\n */\n contentMediaType?: string;\n\n /**\n * If the instance is a string, and if `contentMediaType` is present,\n * this property contains a schema which describes the structure of the\n * string.\n *\n * This keyword MAY be used with any media type that can be mapped into\n * JSON Schema's data model.\n *\n * The value of this property MUST be a valid JSON schema. It SHOULD be\n * ignored if `contentMediaType` is not present.\n */\n contentSchema?: JSONSchema<Value, SchemaType>;\n\n /**\n * This keyword can be used to supply a default JSON value associated with\n * a particular schema. It is RECOMMENDED that a `default` value be valid\n * against the associated schema.\n */\n default?: Value;\n\n /**\n * @deprecated `definitions` has been renamed to `$defs`.\n */\n definitions?: Record<string, JSONSchema>;\n\n /**\n * @deprecated `dependencies` has been split into two keywords:\n * `dependentSchemas` and `dependentRequired`.\n */\n dependencies?: Record<string, MaybeReadonlyArray<string> | JSONSchema>;\n\n /**\n * The value of this keyword MUST be an object. Properties in\n * this object, if any, MUST be arrays. Elements in each array,\n * if any, MUST be strings, and MUST be unique.\n *\n * This keyword specifies properties that are required if a specific\n * other property is present. Their requirement is dependent on the\n * presence of the other property.\n *\n * Validation succeeds if, for each name that appears in both\n * the instance and as a name within this keyword's value, every\n * item in the corresponding array is also the name of a property\n * in the instance.\n *\n * Omitting this keyword has the same behavior as an empty object.\n */\n dependentRequired?: Record<string, MaybeReadonlyArray<string>>;\n\n /**\n * This keyword specifies subschemas that are evaluated if the instance is\n * an object and contains a certain property.\n *\n * This keyword's value MUST be an object. Each value in the object MUST be\n * a valid JSON Schema.\n *\n * If the object key is a property in the instance, the entire instance\n * must validate against the subschema. Its use is dependent on the\n * presence of the property.\n *\n * Omitting this keyword has the same behavior as an empty object.\n */\n dependentSchemas?: Record<string, JSONSchema>;\n\n /**\n * The value of this keyword MUST be a boolean. When multiple occurrences\n * of this keyword are applicable to a single sub-instance, applications\n * SHOULD consider the instance location to be deprecated if any occurrence\n * specifies a `true` value.\n *\n * If `deprecated` has a value of boolean `true`, it indicates that\n * applications SHOULD refrain from usage of the declared property. It MAY\n * mean the property is going to be removed in the future.\n *\n * A root schema containing `deprecated` with a value of `true`\n * indicates that the entire resource being described MAY be removed in the\n * future.\n *\n * The `deprecated` keyword applies to each instance location to which\n * the schema object containing the keyword successfully applies. This can\n * result in scenarios where every array item or object property is\n * deprecated even though the containing array or object is not.\n *\n * Omitting this keyword has the same behavior as a value of `false`.\n */\n deprecated?: boolean;\n\n /**\n * Can be used to decorate a user interface with explanation or information\n * about the data produced.\n */\n description?: string;\n\n /**\n * This keyword's value MUST be a valid JSON Schema.\n *\n * When `if` is present, and the instance fails to validate against its\n * subschema, then validation succeeds against this keyword if the instance\n * successfully validates against this keyword's subschema.\n *\n * This keyword has no effect when `if` is absent, or when the instance\n * successfully validates against its subschema. Implementations MUST NOT\n * evaluate the instance against this keyword, for either validation or\n * annotation collection purposes, in such cases.\n */\n else?: JSONSchema<Value, SchemaType>;\n\n /**\n * The value of this keyword MUST be an array. This array SHOULD have at\n * least one element. Elements in the array SHOULD be unique.\n *\n * An instance validates successfully against this keyword if its value is\n * equal to one of the elements in this keyword's array value.\n *\n * Elements in the array might be of any type, including `null`.\n */\n enum?: MaybeReadonlyArray<Value>;\n\n /**\n * The value of this keyword MUST be an array. When multiple occurrences of\n * this keyword are applicable to a single sub-instance, implementations\n * MUST provide a flat array of all values rather than an array of arrays.\n *\n * This keyword can be used to provide sample JSON values associated with a\n * particular schema, for the purpose of illustrating usage. It is\n * RECOMMENDED that these values be valid against the associated schema.\n *\n * Implementations MAY use the value(s) of `default`, if present, as an\n * additional example. If `examples` is absent, `default` MAY still be\n * used in this manner.\n */\n examples?: MaybeReadonlyArray<Value>;\n\n /**\n * The value of `exclusiveMaximum` MUST be a number, representing an\n * exclusive upper limit for a numeric instance.\n *\n * If the instance is a number, then the instance is valid only if it has a\n * value strictly less than (not equal to) `exclusiveMaximum`.\n */\n exclusiveMaximum?: number;\n\n /**\n * The value of `exclusiveMinimum` MUST be a number, representing an\n * exclusive lower limit for a numeric instance.\n *\n * If the instance is a number, then the instance is valid only if it has a\n * value strictly greater than (not equal to) `exclusiveMinimum`.\n */\n exclusiveMinimum?: number;\n\n /**\n * Implementations MAY treat `format` as an assertion in addition to an\n * annotation, and attempt to validate the value's conformance to the\n * specified semantics.\n *\n * The value of this keyword is called a format attribute. It MUST be a\n * string. A format attribute can generally only validate a given set\n * of instance types. If the type of the instance to validate is not in\n * this set, validation for this format attribute and instance SHOULD\n * succeed. Format attributes are most often applied to strings, but can\n * be specified to apply to any type.\n *\n * Implementations MAY support custom format attributes. Save for agreement\n * between parties, schema authors SHALL NOT expect a peer implementation\n * to support such custom format attributes. An implementation MUST NOT\n * fail validation or cease processing due to an unknown format attribute.\n * When treating `format` as an annotation, implementations SHOULD\n * collect both known and unknown format attribute values.\n */\n format?: string;\n\n /**\n * This keyword's value MUST be a valid JSON Schema.\n *\n * This validation outcome of this keyword's subschema has no direct effect\n * on the overall validation result. Rather, it controls which of the\n * `then` or `else` keywords are evaluated.\n *\n * Instances that successfully validate against this keyword's subschema\n * MUST also be valid against the subschema value of the `then` keyword,\n * if present.\n *\n * Instances that fail to validate against this keyword's subschema MUST\n * also be valid against the subschema value of the `else` keyword, if\n * present.\n *\n * If annotations are being collected, they are collected\n * from this keyword's subschema in the usual way, including when the\n * keyword is present without either `then` or `else`.\n */\n if?: JSONSchema<Value, SchemaType>;\n\n /**\n * The value of `items` MUST be a valid JSON Schema.\n *\n * This keyword applies its subschema to all instance elements at indexes\n * greater than the length of the `prefixItems` array in the same schema\n * object, as reported by the annotation result of that `prefixItems`\n * keyword. If no such annotation result exists, `items` applies its\n * subschema to all instance array elements.\n *\n * Note that the behavior of `items` without `prefixItems` is identical\n * to that of the schema form of `items` in prior drafts.\n *\n * When `prefixItems` is present, the behavior of `items` is identical\n * to the former `additionalItems` keyword.\n *\n * If the `items` subschema is applied to any positions within the\n * instance array, it produces an annotation result of boolean `true`,\n * indicating that all remaining array elements have been evaluated against\n * this keyword's subschema.\n *\n * Omitting this keyword has the same assertion behavior as an empty\n * schema.\n *\n * Implementations MAY choose to implement or optimize this keyword\n * in another way that produces the same effect, such as by directly\n * checking for the presence and size of a `prefixItems` array.\n */\n items?: JSONSchema;\n\n /**\n * The value of this keyword MUST be a non-negative integer.\n *\n * If `contains` is not present within the same schema object, then this\n * keyword has no effect.\n *\n * An instance array is valid against `maxContains` in two ways,\n * depending on the form of the annotation result of an adjacent\n * `contains` keyword. The first way is if the annotation result is an\n * array and the length of that array is less than or equal to the\n * `maxContains` value. The second way is if the annotation result is a\n * boolean `true` and the instance array length is less than or equal to\n * the `maxContains` value.\n */\n maxContains?: number;\n\n /**\n * The value of `maximum` MUST be a number, representing an inclusive\n * upper limit for a numeric instance.\n *\n * If the instance is a number, then this keyword validates only if the\n * instance is less than or exactly equal to `maximum`.\n */\n maximum?: number;\n\n /**\n * The value of this keyword MUST be a non-negative integer.\n *\n * An array instance is valid against `maxItems` if its size is less\n * than, or equal to, the value of this keyword.\n *\n * @minimum 0\n */\n maxItems?: number;\n\n /**\n * The value of this keyword MUST be a non-negative integer.\n *\n * A string instance is valid against this keyword if its length is less\n * than, or equal to, the value of this keyword.\n *\n * The length of a string instance is defined as the number of its\n * characters as defined by [RFC 8259][RFC8259].\n *\n * [RFC8259]: https://datatracker.ietf.org/doc/html/rfc8259\n *\n * @minimum 0\n */\n maxLength?: number;\n\n /**\n * The value of this keyword MUST be a non-negative integer.\n *\n * An object instance is valid against `maxProperties` if its number of\n * `properties` is less than, or equal to, the value of this keyword.\n *\n * @minimum 0\n */\n maxProperties?: number;\n\n /**\n * The value of this keyword MUST be a non-negative integer.\n *\n * If `contains` is not present within the same schema object, then this\n * keyword has no effect.\n *\n * An instance array is valid against `minContains` in two ways,\n * depending on the form of the annotation result of an adjacent\n * `contains` keyword. The first way is if the annotation result is an\n * array and the length of that array is greater than or equal to the\n * `minContains` value. The second way is if the annotation result is a\n * boolean `true` and the instance array length is greater than or equal\n * to the `minContains` value.\n *\n * A value of `0` is allowed, but is only useful for setting a range\n * of occurrences from `0` to the value of `maxContains`. A value of\n * `0` with no `maxContains` causes `contains` to always pass\n * validation.\n *\n * Omitting this keyword has the same behavior as a value of `1`.\n *\n * @default 1\n */\n minContains?: number;\n\n /**\n * The value of `minimum` MUST be a number, representing an inclusive\n * lower limit for a numeric instance.\n *\n * If the instance is a number, then this keyword validates only if the\n * instance is greater than or exactly equal to `minimum`.\n */\n minimum?: number;\n\n /**\n * The value of this keyword MUST be a non-negative integer.\n *\n * An array instance is valid against `minItems` if its size is greater\n * than, or equal to, the value of this keyword.\n *\n * Omitting this keyword has the same behavior as a value of `0`.\n *\n * @default 0\n * @minimum 0\n */\n minItems?: number;\n\n /**\n * The value of this keyword MUST be a non-negative integer.\n *\n * A string instance is valid against this keyword if its length is greater\n * than, or equal to, the value of this keyword.\n *\n * The length of a string instance is defined as the number of its\n * characters as defined by [RFC 8259][RFC8259].\n *\n * Omitting this keyword has the same behavior as a value of `0`.\n *\n * [RFC8259]: https://datatracker.ietf.org/doc/html/rfc8259\n *\n * @default 0\n * @minimum 0\n */\n minLength?: number;\n\n /**\n * The value of this keyword MUST be a non-negative integer.\n *\n * An object instance is valid against `minProperties` if its number of\n * `properties` is greater than, or equal to, the value of this keyword.\n *\n * Omitting this keyword has the same behavior as a value of `0`.\n *\n * @default 0\n * @minimum 0\n */\n minProperties?: number;\n\n /**\n * The value of `multipleOf` MUST be a number, strictly greater than\n * `0`.\n *\n * A numeric instance is valid only if division by this keyword's value\n * results in an integer.\n *\n * @exclusiveMinimum 0\n */\n multipleOf?: number;\n\n /**\n * This keyword's value MUST be a valid JSON Schema.\n *\n * An instance is valid against this keyword if it fails to validate\n * successfully against the schema defined by this keyword.\n */\n not?: JSONSchema<Value, SchemaType>;\n\n /**\n * This keyword's value MUST be a non-empty array. Each item of the array\n * MUST be a valid JSON Schema.\n *\n * An instance validates successfully against this keyword if it validates\n * successfully against exactly one schema defined by this keyword's value.\n */\n oneOf?: MaybeReadonlyArray<JSONSchema<Value, SchemaType>>;\n\n /**\n * The value of this keyword MUST be a string. This string SHOULD be a\n * valid regular expression, according to the [ECMA-262][ecma262] regular\n * expression dialect.\n *\n * A string instance is considered valid if the regular expression matches\n * the instance successfully. Recall: regular expressions are not\n * implicitly anchored.\n *\n * [ecma262]: https://www.ecma-international.org/publications-and-standards/standards/ecma-262/\n *\n * @format \"regex\"\n */\n pattern?: string;\n\n /**\n * The value of `patternProperties` MUST be an object. Each property name\n * of this object SHOULD be a valid regular expression, according to the\n * [ECMA-262][ecma262] regular expression dialect. Each property value of\n * this object MUST be a valid JSON Schema.\n *\n * Validation succeeds if, for each instance name that matches any regular\n * expressions that appear as a property name in this keyword's value,\n * the child instance for that name successfully validates against each\n * schema that corresponds to a matching regular expression.\n *\n * The annotation result of this keyword is the set of instance property\n * names matched by this keyword. Omitting this keyword has the same\n * assertion behavior as an empty object.\n *\n * [ecma262]: https://www.ecma-international.org/publications-and-standards/standards/ecma-262/\n */\n patternProperties?: Record<string, JSONSchema>;\n\n /**\n * The value of `prefixItems` MUST be a non-empty array of valid JSON\n * Schemas.\n *\n * Validation succeeds if each element of the instance validates against\n * the schema at the same position, if any. This keyword does not\n * constrain the length of the array. If the array is longer than this\n * keyword's value, this keyword validates only the prefix of matching\n * length.\n *\n * This keyword produces an annotation value which is the largest index to\n * which this keyword applied a subschema. The value MAY be a boolean\n * `true` if a subschema was applied to every index of the instance, such\n * as is produced by the `items` keyword.\n * This annotation affects the behavior of `items` and\n * `unevaluatedItems`.\n *\n * Omitting this keyword has the same assertion behavior as an empty array.\n */\n prefixItems?: MaybeReadonlyArray<JSONSchema> | JSONSchema;\n\n /**\n * The value of `properties` MUST be an object. Each value of this object\n * MUST be a valid JSON Schema.\n *\n * Validation succeeds if, for each name that appears in both the instance\n * and as a name within this keyword's value, the child instance for that\n * name successfully validates against the corresponding schema.\n *\n * The annotation result of this keyword is the set of instance property\n * names matched by this keyword.\n *\n * Omitting this keyword has the same assertion behavior as an empty\n * object.\n */\n properties?: Record<string, JSONSchema>;\n\n /**\n * The value of `propertyNames` MUST be a valid JSON Schema.\n *\n * If the instance is an object, this keyword validates if every property\n * name in the instance validates against the provided schema.\n * Note the property name that the schema is testing will always be a\n * string.\n *\n * Omitting this keyword has the same behavior as an empty schema.\n */\n propertyNames?: JSONSchema;\n\n /**\n * The value of this keyword MUST be a boolean. When multiple occurrences\n * of this keyword are applicable to a single sub-instance, the resulting\n * value MUST be `true` if any occurrence specifies a `true` value, and\n * MUST be `false` otherwise.\n *\n * If `readOnly` has a value of boolean `true`, it indicates that the\n * value of the instance is managed exclusively by the owning authority,\n * and attempts by an application to modify the value of this property are\n * expected to be ignored or rejected by that owning authority.\n *\n * An instance document that is marked as `readOnly` for the entire\n * document MAY be ignored if sent to the owning authority, or MAY result\n * in an error, at the authority's discretion.\n *\n * For example, `readOnly` would be used to mark a database-generated\n * serial number as read-only.\n *\n * This keyword can be used to assist in user interface instance\n * generation.\n *\n * @default false\n */\n readOnly?: boolean;\n\n /**\n * The value of this keyword MUST be an array. Elements of this array, if\n * any, MUST be strings, and MUST be unique.\n *\n * An object instance is valid against this keyword if every item in the\n * array is the name of a property in the instance.\n *\n * Omitting this keyword has the same behavior as an empty array.\n */\n required?: MaybeReadonlyArray<string>;\n\n /**\n * This keyword's value MUST be a valid JSON Schema.\n *\n * When `if` is present, and the instance successfully validates against\n * its subschema, then validation succeeds against this keyword if the\n * instance also successfully validates against this keyword's subschema.\n *\n * This keyword has no effect when `if` is absent, or when the instance\n * fails to validate against its subschema. Implementations MUST NOT\n * evaluate the instance against this keyword, for either validation or\n * annotation collection purposes, in such cases.\n */\n then?: JSONSchema<Value, SchemaType>;\n\n /**\n * Can be used to decorate a user interface with a short label about the\n * data produced.\n */\n title?: string;\n\n /**\n * The value of this keyword MUST be either a string or an array. If it is\n * an array, elements of the array MUST be strings and MUST be unique.\n *\n * String values MUST be one of the six primitive types (`\"null\"`,\n * `\"boolean\"`, `\"object\"`, `\"array\"`, `\"number\"`, or\n * `\"string\"`), or `\"integer\"` which matches any number with a zero\n * fractional part.\n *\n * An instance validates if and only if the instance is in any of the sets\n * listed for this keyword.\n */\n type?: SchemaType;\n\n /**\n * The value of `unevaluatedItems` MUST be a valid JSON Schema.\n *\n * The behavior of this keyword depends on the annotation results of\n * adjacent keywords that apply to the instance location being validated.\n * Specifically, the annotations from `prefixItems`, `items`, and\n * `contains`, which can come from those keywords when they are adjacent\n * to the `unevaluatedItems` keyword. Those three annotations, as well as\n * `unevaluatedItems`, can also result from any and all adjacent\n * [in-place applicator][in-place-applicator] keywords.\n *\n * If no relevant annotations are present, the `unevaluatedItems`\n * subschema MUST be applied to all locations in the array.\n * If a boolean `true` value is present from any of the relevant\n * annotations, `unevaluatedItems` MUST be ignored. Otherwise, the\n * subschema MUST be applied to any index greater than the largest\n * annotation value for `prefixItems`, which does not appear in any\n * annotation value for `contains`.\n *\n * This means that `prefixItems`, `items`, `contains`, and all\n * in-place applicators MUST be evaluated before this keyword can be\n * evaluated. Authors of extension keywords MUST NOT define an in-place\n * applicator that would need to be evaluated after this keyword.\n *\n * If the `unevaluatedItems` subschema is applied to any positions within\n * the instance array, it produces an annotation result of boolean\n * `true`, analogous to the behavior of `items`.\n *\n * Omitting this keyword has the same assertion behavior as an empty\n * schema.\n *\n * [in-place-applicator]: https://json-schema.org/draft/2020-12/json-schema-core.html#in-place\n */\n unevaluatedItems?: JSONSchema;\n\n /**\n * The value of `unevaluatedProperties` MUST be a valid JSON Schema.\n *\n * The behavior of this keyword depends on the annotation results of\n * adjacent keywords that apply to the instance location being validated.\n * Specifically, the annotations from `properties`,\n * `patternProperties`, and `additionalProperties`, which can come from\n * those keywords when they are adjacent to the `unevaluatedProperties`\n * keyword. Those three annotations, as well as `unevaluatedProperties`,\n * can also result from any and all adjacent\n * [in-place applicator][in-place-applicator] keywords.\n *\n * Validation with `unevaluatedProperties` applies only to the child\n * values of instance names that do not appear in the `properties`,\n * `patternProperties`, `additionalProperties`, or\n * `unevaluatedProperties` annotation results that apply to the\n * instance location being validated.\n *\n * For all such properties, validation succeeds if the child instance\n * validates against the \"unevaluatedProperties\" schema.\n *\n * This means that `properties`, `patternProperties`,\n * `additionalProperties`, and all in-place applicators MUST be evaluated\n * before this keyword can be evaluated. Authors of extension keywords\n * MUST NOT define an in-place applicator that would need to be evaluated\n * after this keyword.\n *\n * The annotation result of this keyword is the set of instance property\n * names validated by this keyword's subschema.\n *\n * Omitting this keyword has the same assertion behavior as an empty\n * schema.\n *\n * [in-place-applicator]: https://json-schema.org/draft/2020-12/json-schema-core.html#in-place\n */\n unevaluatedProperties?: JSONSchema;\n\n /**\n * The value of this keyword MUST be a boolean.\n *\n * If this keyword has boolean value `false`, the instance validates\n * successfully. If it has boolean value `true`, the instance validates\n * successfully if all of its elements are unique.\n *\n * Omitting this keyword has the same behavior as a value of `false`.\n *\n * @default false\n */\n uniqueItems?: boolean;\n\n /**\n * The value of this keyword MUST be a boolean. When multiple occurrences\n * of this keyword is applicable to a single sub-instance, the resulting\n * value MUST be `true` if any occurrence specifies a `true` value, and\n * MUST be `false` otherwise.\n *\n * If `writeOnly` has a value of boolean `true`, it indicates that the\n * value is never present when the instance is retrieved from the owning\n * authority. It can be present when sent to the owning authority to update\n * or create the document (or the resource it represents), but it will not\n * be included in any updated or newly created version of the instance.\n *\n * An instance document that is marked as `writeOnly` for the entire\n * document MAY be returned as a blank document of some sort, or MAY\n * produce an error upon retrieval, or have the retrieval request ignored,\n * at the authority's discretion.\n *\n * For example, `writeOnly` would be used to mark a password input field.\n *\n * These keywords can be used to assist in user interface instance\n * generation. In particular, an application MAY choose to use a widget\n * that hides input values as they are typed for write-only fields.\n *\n * @default false\n */\n writeOnly?: boolean;\n};\n\n// -----------------------------------------------------------------------------\n\nexport namespace JSONSchema {\n export type TypeValue = (\n | ValueOf<TypeName>\n | TypeName\n | Array<ValueOf<TypeName> | TypeName>\n | ReadonlyArray<ValueOf<TypeName> | TypeName>\n );\n\n /**\n * JSON Schema interface\n */\n export type Interface<\n Value = any,\n SchemaType extends TypeValue = TypeValue,\n > = Exclude<\n JSONSchema<Value, SchemaType>,\n boolean\n >;\n\n export type Array<T = any> = Pick<\n Interface<T, \"array\">,\n KeywordByType.Any | KeywordByType.Array\n >;\n\n export type Boolean = Pick<\n Interface<boolean, \"boolean\">,\n KeywordByType.Any\n >;\n\n export type Integer = Pick<\n Interface<number, \"integer\">,\n KeywordByType.Any | KeywordByType.Number\n >;\n\n export type Number = Pick<\n Interface<number, \"number\">,\n KeywordByType.Any | KeywordByType.Number\n >;\n\n export type Null = Pick<\n Interface<null, \"null\">,\n KeywordByType.Any\n >;\n\n export type Object<T = any> = Pick<\n Interface<T, \"object\">,\n KeywordByType.Any | KeywordByType.Object\n >;\n\n export type String = Pick<\n Interface<string, \"string\">,\n KeywordByType.Any | KeywordByType.String\n >;\n}\n\nnamespace KeywordByType {\n export type Any =\n | \"$anchor\"\n | \"$comment\"\n | \"$defs\"\n | \"$dynamicAnchor\"\n | \"$dynamicRef\"\n | \"$id\"\n | \"$ref\"\n | \"$schema\"\n | \"$vocabulary\"\n | \"allOf\"\n | \"anyOf\"\n | \"const\"\n | \"default\"\n | \"definitions\"\n | \"deprecated\"\n | \"description\"\n | \"else\"\n | \"enum\"\n | \"examples\"\n | \"format\"\n | \"if\"\n | \"not\"\n | \"oneOf\"\n | \"readOnly\"\n | \"then\"\n | \"title\"\n | \"type\"\n | \"writeOnly\";\n\n export type Array =\n | \"additionalItems\"\n | \"contains\"\n | \"items\"\n | \"maxContains\"\n | \"maxItems\"\n | \"minContains\"\n | \"minItems\"\n | \"prefixItems\"\n | \"unevaluatedItems\"\n | \"uniqueItems\";\n\n export type Number =\n | \"exclusiveMaximum\"\n | \"exclusiveMinimum\"\n | \"maximum\"\n | \"minimum\"\n | \"multipleOf\";\n\n export type Object =\n | \"additionalProperties\"\n | \"dependencies\"\n | \"dependentRequired\"\n | \"dependentSchemas\"\n | \"maxProperties\"\n | \"minProperties\"\n | \"patternProperties\"\n | \"properties\"\n | \"propertyNames\"\n | \"required\"\n | \"unevaluatedProperties\";\n\n export type String =\n | \"contentEncoding\"\n | \"contentMediaType\"\n | \"contentSchema\"\n | \"maxLength\"\n | \"minLength\"\n | \"pattern\";\n}\n\n// -----------------------------------------------------------------------------\n\n/**\n * Content encoding strategy enum.\n *\n * - [Content-Transfer-Encoding Syntax](https://datatracker.ietf.org/doc/html/rfc2045#section-6.1)\n * - [7bit vs 8bit encoding](https://stackoverflow.com/questions/25710599/content-transfer-encoding-7bit-or-8-bit/28531705#28531705)\n */\nexport enum ContentEncoding {\n /**\n * Only US-ASCII characters, which use the lower 7 bits for each character.\n *\n * Each line must be less than 1,000 characters.\n */\n \"7bit\" = \"7bit\",\n\n /**\n * Allow extended ASCII characters which can use the 8th (highest) bit to\n * indicate special characters not available in 7bit.\n *\n * Each line must be less than 1,000 characters.\n */\n \"8bit\" = \"8bit\",\n\n /**\n * Useful for data that is mostly non-text.\n */\n Base64 = \"base64\",\n\n /**\n * Same character set as 8bit, with no line length restriction.\n */\n Binary = \"binary\",\n\n /**\n * An extension token defined by a standards-track RFC and registered with\n * IANA.\n */\n IETFToken = \"ietf-token\",\n\n /**\n * Lines are limited to 76 characters, and line breaks are represented using\n * special characters that are escaped.\n */\n QuotedPrintable = \"quoted-printable\",\n\n /**\n * The two characters \"X-\" or \"x-\" followed, with no intervening white space,\n * by any token.\n */\n XToken = \"x-token\",\n}\n\n/**\n * This enum provides well-known formats that apply to strings.\n */\nexport enum Format {\n /**\n * A string instance is valid against this attribute if it is a valid\n * representation according to the \"full-date\" production in\n * [RFC 3339][RFC3339].\n *\n * [RFC3339]: https://datatracker.ietf.org/doc/html/rfc3339\n */\n Date = \"date\",\n\n /**\n * A string instance is valid against this attribute if it is a valid\n * representation according to the \"date-time\" production in\n * [RFC 3339][RFC3339].\n *\n * [RFC3339]: https://datatracker.ietf.org/doc/html/rfc3339\n */\n DateTime = \"date-time\",\n\n /**\n * A string instance is valid against this attribute if it is a valid\n * representation according to the \"duration\" production.\n */\n Duration = \"duration\",\n\n /**\n * A string instance is valid against this attribute if it is a valid Internet\n * email address as defined by by the \"Mailbox\" ABNF rule in [RFC\n * 5321][RFC5322], section 4.1.2.\n *\n * [RFC5321]: https://datatracker.ietf.org/doc/html/rfc5321\n */\n Email = \"email\",\n\n /**\n * As defined by [RFC 1123, section 2.1][RFC1123], including host names\n * produced using the Punycode algorithm specified in\n * [RFC 5891, section 4.4][RFC5891].\n *\n * [RFC1123]: https://datatracker.ietf.org/doc/html/rfc1123\n * [RFC5891]: https://datatracker.ietf.org/doc/html/rfc5891\n */\n Hostname = \"hostname\",\n\n /**\n * A string instance is valid against this attribute if it is a valid Internet\n * email address as defined by the extended \"Mailbox\" ABNF rule in\n * [RFC 6531][RFC6531], section 3.3.\n *\n * [RFC6531]: https://datatracker.ietf.org/doc/html/rfc6531\n */\n IDNEmail = \"idn-email\",\n\n /**\n * As defined by either [RFC 1123, section 2.1][RFC1123] as for hostname, or\n * an internationalized hostname as defined by\n * [RFC 5890, section 2.3.2.3][RFC5890].\n *\n * [RFC1123]: https://datatracker.ietf.org/doc/html/rfc1123\n * [RFC5890]: https://datatracker.ietf.org/doc/html/rfc5890\n */\n IDNHostname = \"idn-hostname\",\n\n /**\n * An IPv4 address according to the \"dotted-quad\" ABNF syntax as defined in\n * [RFC 2673, section 3.2][RFC2673].\n *\n * [RFC2673]: https://datatracker.ietf.org/doc/html/rfc2673\n */\n IPv4 = \"ipv4\",\n\n /**\n * An IPv6 address as defined in [RFC 4291, section 2.2][RFC4291].\n *\n * [RFC4291]: https://datatracker.ietf.org/doc/html/rfc4291\n */\n IPv6 = \"ipv6\",\n\n /**\n * A string instance is valid against this attribute if it is a valid IRI,\n * according to [RFC 3987][RFC3987].\n *\n * [RFC3987]: https://datatracker.ietf.org/doc/html/rfc3987\n */\n IRI = \"iri\",\n\n /**\n * A string instance is valid against this attribute if it is a valid IRI\n * Reference (either an IRI or a relative-reference), according to\n * [RFC 3987][RFC3987].\n *\n * [RFC3987]: https://datatracker.ietf.org/doc/html/rfc3987\n */\n IRIReference = \"iri-reference\",\n\n /**\n * A string instance is valid against this attribute if it is a valid JSON\n * string representation of a JSON Pointer, according to\n * [RFC 6901, section 5][RFC6901].\n *\n * [RFC6901]: https://datatracker.ietf.org/doc/html/rfc6901\n */\n JSONPointer = \"json-pointer\",\n\n /**\n * A string instance is valid against this attribute if it is a valid JSON\n * string representation of a JSON Pointer fragment, according to\n * [RFC 6901, section 5][RFC6901].\n *\n * [RFC6901]: https://datatracker.ietf.org/doc/html/rfc6901\n */\n JSONPointerURIFragment = \"json-pointer-uri-fragment\",\n\n /**\n * This attribute applies to string instances.\n *\n * A regular expression, which SHOULD be valid according to the\n * [ECMA-262][ecma262] regular expression dialect.\n *\n * Implementations that validate formats MUST accept at least the subset of\n * [ECMA-262][ecma262] defined in the [Regular Expressions][regexInterop]\n * section of this specification, and SHOULD accept all valid\n * [ECMA-262][ecma262] expressions.\n *\n * [ecma262]: https://www.ecma-international.org/publications-and-standards/standards/ecma-262/\n * [regexInterop]: https://json-schema.org/draft/2020-12/json-schema-validation.html#regexInterop\n */\n RegEx = \"regex\",\n\n /**\n * A string instance is valid against this attribute if it is a valid\n * [Relative JSON Pointer][relative-json-pointer].\n *\n * [relative-json-pointer]: https://datatracker.ietf.org/doc/html/draft-handrews-relative-json-pointer-01\n */\n RelativeJSONPointer = \"relative-json-pointer\",\n\n /**\n * A string instance is valid against this attribute if it is a valid\n * representation according to the \"time\" production in [RFC 3339][RFC3339].\n *\n * [RFC3339]: https://datatracker.ietf.org/doc/html/rfc3339\n */\n Time = \"time\",\n\n /**\n * A string instance is valid against this attribute if it is a valid URI,\n * according to [RFC3986][RFC3986].\n *\n * [RFC3986]: https://datatracker.ietf.org/doc/html/rfc3986\n */\n URI = \"uri\",\n\n /**\n * A string instance is valid against this attribute if it is a valid URI\n * Reference (either a URI or a relative-reference), according to\n * [RFC3986][RFC3986].\n *\n * [RFC3986]: https://datatracker.ietf.org/doc/html/rfc3986\n */\n URIReference = \"uri-reference\",\n\n /**\n * A string instance is valid against this attribute if it is a valid URI\n * Template (of any level), according to [RFC 6570][RFC6570].\n *\n * Note that URI Templates may be used for IRIs; there is no separate IRI\n * Template specification.\n *\n * [RFC6570]: https://datatracker.ietf.org/doc/html/rfc6570\n */\n URITemplate = \"uri-template\",\n\n /**\n * A string instance is valid against this attribute if it is a valid string\n * representation of a UUID, according to [RFC 4122][RFC4122].\n *\n * [RFC4122]: https://datatracker.ietf.org/doc/html/rfc4122\n */\n UUID = \"uuid\",\n}\n\n/**\n * Enum consisting of simple type names for the `type` keyword\n */\nexport enum TypeName {\n /**\n * Value MUST be an array.\n */\n Array = \"array\",\n\n /**\n * Value MUST be a boolean.\n */\n Boolean = \"boolean\",\n\n /**\n * Value MUST be an integer, no floating point numbers are allowed. This is a\n * subset of the number type.\n */\n Integer = \"integer\",\n\n /**\n * Value MUST be null. Note this is mainly for purpose of being able use union\n * types to define nullability. If this type is not included in a union, null\n * values are not allowed (the primitives listed above do not allow nulls on\n * their own).\n */\n Null = \"null\",\n\n /**\n * Value MUST be a number, floating point numbers are allowed.\n */\n Number = \"number\",\n\n /**\n * Value MUST be an object.\n */\n Object = \"object\",\n\n /**\n * Value MUST be a string.\n */\n String = \"string\",\n}\n\n// -----------------------------------------------------------------------------\n// Keywords\n// -----------------------------------------------------------------------------\n\nexport const keywords = [\n \"$anchor\",\n \"$comment\",\n \"$defs\",\n \"$dynamicAnchor\",\n \"$dynamicRef\",\n \"$id\",\n \"$ref\",\n \"$schema\",\n \"$vocabulary\",\n \"additionalItems\",\n \"additionalProperties\",\n \"allOf\",\n \"anyOf\",\n \"const\",\n \"contains\",\n \"contentEncoding\",\n \"contentMediaType\",\n \"contentSchema\",\n \"default\",\n \"definitions\",\n \"dependencies\",\n \"dependentRequired\",\n \"dependentSchemas\",\n \"deprecated\",\n \"description\",\n \"else\",\n \"enum\",\n \"examples\",\n \"exclusiveMaximum\",\n \"exclusiveMinimum\",\n \"format\",\n \"if\",\n \"items\",\n \"maxContains\",\n \"maximum\",\n \"maxItems\",\n \"maxLength\",\n \"maxProperties\",\n \"minContains\",\n \"minimum\",\n \"minItems\",\n \"minLength\",\n \"minProperties\",\n \"multipleOf\",\n \"not\",\n \"oneOf\",\n \"pattern\",\n \"patternProperties\",\n \"prefixItems\",\n \"properties\",\n \"propertyNames\",\n \"readOnly\",\n \"required\",\n \"then\",\n \"title\",\n \"type\",\n \"unevaluatedItems\",\n \"unevaluatedProperties\",\n \"uniqueItems\",\n \"writeOnly\",\n] as const;\n","import type { ValidationError, ValidationErrorPath } from '../errors'\nimport { Format } from 'json-schema-typed/draft-2020-12'\n\n/**\n * Format validation error type\n * @description\n * According to JSON Schema 2020-12:\n * - Format validation is an annotation by default\n * - Format validation only applies to strings\n * - Unknown formats should be ignored\n * - Implementations SHOULD implement validation for standard formats\n * - Implementations MAY treat format as a no-op\n */\nexport type FormatValidationErrorType = 'format'\n\n/**\n * Regular expression patterns for format validation\n * These patterns are based on JSON Schema 2020-12 specifications\n */\nconst PATTERNS = {\n // Date/Time patterns (RFC 3339)\n DATE_TIME: /^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(?:\\.\\d+)?(?:Z|[+-]\\d{2}:\\d{2})$/,\n DATE: /^\\d{4}-\\d{2}-\\d{2}$/,\n TIME: /^(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|[+-](?:[01]\\d|2[0-3]):[0-5]\\d)$/,\n\n // Duration (ISO 8601)\n DURATION: /^P(?!$)(?:\\d+Y)?(?:\\d+M)?(?:\\d+D)?(?:T(?=\\d)(?:\\d+H)?(?:\\d+M)?(?:\\d+S)?)?$/,\n\n // Email patterns\n EMAIL:\n /^[\\w.!#$%&'*+/=?^`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i,\n IDN_EMAIL: /^[^\\s@]+@[^\\s@][^\\s.@]*\\.[^\\s@]+$/,\n\n // Host patterns\n HOSTNAME: /^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/i,\n IDN_HOSTNAME: /^[^\\s._-].*[^\\s._-]$/,\n\n // IP address patterns\n IPV6_PART: /^[0-9a-f]{1,4}$/i,\n\n // URI/IRI patterns\n PROTOCOL: /^[a-z]+:/,\n URI_REFERENCE: /^\\S*$/,\n\n // UUID pattern (RFC 4122)\n UUID: /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,\n\n // JSON Pointer patterns\n JSON_POINTER: /^(?:\\/(?:[^~/]|~0|~1)*)*$/,\n JSON_POINTER_URI_FRAGMENT: /^#(?:\\/(?:[\\w\\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,\n RELATIVE_JSON_POINTER: /^(?:0|[1-9]\\d*)(?:#|(?:\\/(?:[^~/]|~0|~1)*)*)$/,\n\n // URI Template (RFC 6570)\n URI_TEMPLATE:\n /^(?:[!#$&'()*+,/:;=?@\\w\\-.~]|%[0-9a-f]{2}|\\{[+#./;?&=,!@|]?(?:\\w|%[0-9a-f]{2})+(?::[1-9]\\d{0,3}|\\*)?(?:,(?:\\w|%[0-9a-f]{2})+(?::[1-9]\\d{0,3}|\\*)?)*\\})*$/i,\n} as const\n\n/**\n * Built-in format validators according to JSON Schema 2020-12\n */\nconst formatValidationFunctions: Record<Format, (value: string) => boolean> = {\n [Format.DateTime]: value => PATTERNS.DATE_TIME.test(value),\n [Format.Date]: value => PATTERNS.DATE.test(value),\n [Format.Time]: value => PATTERNS.TIME.test(value),\n [Format.Duration]: value => PATTERNS.DURATION.test(value),\n [Format.Email]: (value) => {\n // Basic email validation with length limit (RFC 5321)\n return value.length <= 254 && PATTERNS.EMAIL.test(value)\n },\n [Format.IDNEmail]: (value) => {\n // More permissive email validation for IDN with length limit\n return value.length <= 254 && PATTERNS.IDN_EMAIL.test(value)\n },\n [Format.Hostname]: (value) => {\n if (value.length > 255)\n return false\n const labels = value.split('.')\n return labels.every(label => PATTERNS.HOSTNAME.test(label))\n },\n [Format.IDNHostname]: (value) => {\n if (value.length > 255)\n return false\n const labels = value.split('.')\n return labels.every(label => label.length <= 63 && PATTERNS.IDN_HOSTNAME.test(label))\n },\n [Format.IPv4]: (value) => {\n const parts = value.split('.')\n if (parts.length !== 4)\n return false\n return parts.every((part) => {\n const num = Number.parseInt(part, 10)\n return num >= 0 && num <= 255 && part === num.toString()\n })\n },\n [Format.IPv6]: (value) => {\n const parts = value.split(':')\n if (parts.length > 8)\n return false\n let hasDoubleColon = false\n return parts.every((part) => {\n if (part === '') {\n if (hasDoubleColon)\n return false\n hasDoubleColon = true\n return true\n }\n return PATTERNS.IPV6_PART.test(part)\n })\n },\n [Format.URI]: (value) => {\n try {\n const url = new URL(value)\n return url.protocol !== '' && PATTERNS.PROTOCOL.test(url.protocol)\n }\n catch {\n return false\n }\n },\n [Format.URIReference]: (value) => {\n try {\n if (value.startsWith('//')) {\n return PATTERNS.URI_REFERENCE.test(value.slice(2))\n }\n void new URL(value, 'http://example.com')\n return true\n }\n catch {\n return false\n }\n },\n [Format.IRI]: (value) => {\n try {\n const url = new URL(value)\n return url.protocol !== '' && PATTERNS.PROTOCOL.test(url.protocol)\n }\n catch {\n return false\n }\n },\n [Format.IRIReference]: (value) => {\n try {\n if (value.startsWith('//')) {\n return PATTERNS.URI_REFERENCE.test(value.slice(2))\n }\n void new URL(value, 'http://example.com')\n return true\n }\n catch {\n return false\n }\n },\n [Format.RegEx]: (value) => {\n try {\n void new RegExp(value, 'u')\n return true\n }\n catch {\n return false\n }\n },\n [Format.UUID]: value => PATTERNS.UUID.test(value),\n [Format.JSONPointer]: value => PATTERNS.JSON_POINTER.test(value),\n [Format.JSONPointerURIFragment]: value => PATTERNS.JSON_POINTER_URI_FRAGMENT.test(value),\n [Format.RelativeJSONPointer]: value => PATTERNS.RELATIVE_JSON_POINTER.test(value),\n [Format.URITemplate]: value => PATTERNS.URI_TEMPLATE.test(value),\n}\n\n/**\n * Validate a string value against a format\n * @param value - The string value to validate\n * @param format - The format to validate against\n * @param path - The path to the current field being validated\n * @returns An array of validation errors\n * @description\n * According to JSON Schema 2020-12:\n * - Format validation is an annotation by default\n * - Format validation only applies to strings\n * - Unknown formats should be ignored\n * - Implementations SHOULD implement validation for standard formats\n * - Implementations MAY treat format as a no-op\n */\nexport function validateFormat(\n value: string,\n format: string,\n path: ValidationErrorPath = [],\n): ValidationError[] {\n const errors: ValidationError[] = []\n\n // Format validation only applies to strings\n if (typeof value !== 'string') {\n return errors\n }\n\n const validateFn = formatValidationFunctions[format as Format]\n if (validateFn && !validateFn(value)) {\n errors.push({ path, validation: 'format' })\n }\n\n return errors\n}\n","import type { ValidationError, ValidationErrorPath } from '../errors'\nimport type { NonBooleanJsfSchema, SchemaValue } from '../types'\nimport { validateFormat } from './format'\nimport { getSchemaType } from './schema'\n\n/**\n * Validate a string against a schema\n * @param value - The value to validate\n * @param schema - The schema to validate against\n * @param path - The path to the current field being validated\n * @returns An array of validation errors\n * @description\n * Implements string validation according to JSON Schema 2020-12:\n * - Length validation (minLength, maxLength)\n * - Pattern validation (pattern)\n * - Format validation (as annotation by default)\n */\nexport function validateString(\n value: SchemaValue,\n schema: NonBooleanJsfSchema,\n path: ValidationErrorPath = [],\n): ValidationError[] {\n const errors: ValidationError[] = []\n const schemaType = getSchemaType(schema)\n\n if (typeof value !== 'string') {\n return []\n }\n\n if (schemaType !== undefined && schemaType !== 'string') {\n return []\n }\n\n const valueLength = [...new Intl.Segmenter().segment(value)].length\n\n // Length validation\n if (schema.minLength !== undefined && valueLength < schema.minLength) {\n errors.push({ path, validation: 'minLength' })\n }\n\n if (schema.maxLength !== undefined && valueLength > schema.maxLength) {\n errors.push({ path, validation: 'maxLength' })\n }\n\n // Pattern validation\n if (schema.pattern !== undefined) {\n const pattern = new RegExp(schema.pattern)\n if (!pattern.test(value)) {\n errors.push({ path, validation: 'pattern' })\n }\n }\n\n // Format validation (annotation by default in 2020-12)\n if (schema.format !== undefined) {\n const formatErrors = validateFormat(value, schema.format, path)\n errors.push(...formatErrors)\n }\n\n return errors\n}\n","import type { ValidationError, ValidationErrorPath } from '../errors'\nimport type { JsfSchema, JsfSchemaType, SchemaValue } from '../types'\nimport { validateAllOf, validateAnyOf, validateNot, validateOneOf } from './composition'\nimport { validateCondition } from './conditions'\nimport { validateConst } from './const'\nimport { validateEnum } from './enum'\nimport { validateNumber } from './number'\nimport { validateObject } from './object'\nimport { validateString } from './string'\nimport { isObjectValue } from './util'\n\nexport interface ValidationOptions {\n /**\n * A null value will be treated as undefined.\n * That means that when validating a null value, against a non-required field that is not of type 'null' or ['null']\n * the validation will succeed instead of returning a type error.\n * @default false\n */\n treatNullAsUndefined?: boolean\n}\n\n/**\n * Get the type of a schema\n * @param schema - The schema to get the type of\n * @returns The type of the schema, or an array of types if the schema is an array.\n * If no type is defined, returns undefined.\n *\n * IMPORTANT:\n * We intentionally return 'undefined' (instead of defaulting to 'object') when no type is defined.\n * In JSON Schema 2020-12, an absent \"type\" keyword means there is no type constraint.\n * This change prevents erroneously enforcing a default type of 'object', which was causing false negatives\n * (e.g. when validating an \"anyOf\" schema without a \"type\").\n */\nexport function getSchemaType(schema: JsfSchema): JsfSchemaType | JsfSchemaType[] | undefined {\n if (typeof schema === 'boolean') {\n return 'boolean'\n }\n\n if (schema.type !== undefined) {\n return schema.type\n }\n\n return undefined\n}\n\n/**\n * Validate the type of a value against a schema\n * @param value - The value to validate\n * @param schema - The schema to validate against\n * @param path - The path to the current field being validated\n * @returns An array of validation errors\n * @description\n * When getSchemaType returns undefined, this function skips type validation.\n * This aligns with JSON Schema 2020-12 semantics: if no type is provided, no type check is enforced.\n */\nfunction validateType(\n value: SchemaValue,\n schema: JsfSchema,\n path: ValidationErrorPath = [],\n): ValidationError[] {\n const schemaType = getSchemaType(schema)\n\n // Skip type-checking if no type is specified.\n if (schemaType === undefined) {\n return []\n }\n\n if (schemaType === 'null' && value === null) {\n return []\n }\n\n const valueType = value === null ? 'null' : typeof value\n\n if (Array.isArray(schemaType)) {\n if (value === null && schemaType.includes('null')) {\n return []\n }\n\n for (const type of schemaType) {\n if (valueType === 'number' && type === 'integer' && Number.isInteger(value)) {\n return []\n }\n\n if (valueType === type || (type === 'null' && value === null)) {\n return []\n }\n }\n }\n\n if (valueType === 'number' && schemaType === 'integer' && Number.isInteger(value)) {\n return []\n }\n\n if (valueType === schemaType) {\n return []\n }\n\n return [{ path, validation: 'type' },\n ]\n}\n\n/**\n * Validate a value against a schema\n * @param value - The value to validate\n * @param schema - The schema to validate against\n * @param options - The validation options\n * @param path - The path to the current field being validated\n * @returns An array of validation errors\n * @description\n * This function is the main validation function that implements JSON Schema validation.\n * The validation process follows this order:\n * 1. Handle undefined values and the required constraint\n * 2. Handle boolean schemas (true allows everything, false allows nothing)\n * 3. Validate against base schema constraints:\n * - Type validation (if type is specified)\n * - Required properties\n * - Boolean validation\n * - Enum validation\n * - Const validation\n * - Type-specific validations (string, number, object)\n * 4. Validate against composition keywords in this order:\n * - not (negates the validation of a subschema)\n * - allOf (all subschemas must be valid)\n * - anyOf (at least one subschema must be valid)\n * - oneOf (exactly one subschema must be valid)\n *\n * @see validateType - For type validation behavior\n * @see validateSchemaWithoutComposition - For base schema validation\n * @see https://json-schema.org/understanding-json-schema/reference/combining.html\n */\nexport function validateSchema(\n value: SchemaValue,\n schema: JsfSchema,\n options: ValidationOptions = {},\n path: ValidationErrorPath = [],\n): ValidationError[] {\n const valueIsUndefined = value === undefined || (value === null && options.treatNullAsUndefined)\n const errors: ValidationError[] = []\n\n // If value is undefined but not required, no further validation needed\n if (valueIsUndefined) {\n return []\n }\n\n if (typeof schema === 'boolean') {\n // It means the property does not exist in the payload\n if (!schema && typeof value !== 'undefined') {\n return [{ path, validation: 'valid' }]\n }\n else {\n return []\n }\n }\n\n const typeValidationErrors = validateType(value, schema, path)\n if (typeValidationErrors.length > 0) {\n return typeValidationErrors\n }\n\n // If the schema defines \"required\", run required checks even when type is undefined.\n if (\n schema.required && isObjectValue(value)\n ) {\n const missingKeys = schema.required.filter((key: string) => {\n const fieldValue = value[key]\n return fieldValue === undefined || (fieldValue === null && options.treatNullAsUndefined)\n })\n\n for (const key of missingKeys) {\n errors.push({\n path: [...path, key],\n validation: 'required',\n })\n }\n }\n\n return [\n ...errors,\n ...validateConst(value, schema, path),\n ...validateEnum(value, schema, path),\n ...validateObject(value, schema, options, path),\n ...validateString(value, schema, path),\n ...validateNumber(value, schema, path),\n ...validateNot(value, schema, options, path),\n ...validateAllOf(value, schema, options, path),\n ...validateAnyOf(value, schema, options, path),\n ...validateOneOf(value, schema, options, path),\n ...validateCondition(value, schema, options, path),\n ]\n}\n","import type { Field } from './field/type'\nimport type { JsfObjectSchema, JsfSchema, NonBooleanJsfSchema, ObjectValue, SchemaValue } from './types'\nimport type { ValidationOptions } from './validation/schema'\nimport { buildFieldSchema } from './field/schema'\nimport { validateSchema } from './validation/schema'\nimport { isObjectValue } from './validation/util'\n\n/**\n * Updates field visibility based on JSON schema conditional rules\n * @param fields - The fields to update\n * @param values - The current form values\n * @param schema - The JSON schema definition\n * @param options - Validation options\n */\nexport function mutateFields(\n fields: Field[],\n values: SchemaValue,\n schema: JsfObjectSchema,\n options: ValidationOptions = {},\n) {\n if (!isObjectValue(values)) {\n return\n }\n\n // Apply rules to current level of fields\n applySchemaRules(fields, values, schema, options)\n\n // Process nested object fields that have conditional logic\n for (const fieldName in schema.properties) {\n const fieldSchema = schema.properties[fieldName]\n const field = fields.find(field => field.name === fieldName)\n\n if (field?.fields) {\n applySchemaRules(field.fields, values[fieldName], fieldSchema as JsfObjectSchema, options)\n }\n }\n}\n\n/**\n * Evaluates the conditional rules for a field\n * @param values - The current field values\n * @param schema - The JSON schema definition\n * @param rule - Schema identifying the conditional rule\n * @param options - Validation options\n * @returns An object containing the rule and whether it matches\n */\nfunction evaluateConditional(\n values: ObjectValue,\n schema: JsfObjectSchema,\n rule: NonBooleanJsfSchema,\n options: ValidationOptions = {},\n) {\n const ifErrors = validateSchema(values, rule.if!, options)\n const matches = ifErrors.length === 0\n\n // Prevent fields from being shown when required fields have type errors\n let hasTypeErrors = false\n if (matches && rule.if?.required) {\n const requiredFields = rule.if.required\n hasTypeErrors = requiredFields.some((fieldName) => {\n if (!schema.properties || !schema.properties[fieldName]) {\n return false\n }\n const fieldSchema = schema.properties[fieldName]\n const fieldValue = values[fieldName]\n const fieldErrors = validateSchema(fieldValue, fieldSchema, options)\n return fieldErrors.some(error => error.validation === 'type')\n })\n }\n\n return { rule, matches: matches && !hasTypeErrors }\n}\n\n/**\n * Applies JSON Schema conditional rules to determine field visibility\n * @param fields - The fields to apply rules to\n * @param values - The current form values\n * @param schema - The JSON schema containing the rules\n * @param options - Validation options\n *\n * Fields start visible by default, and they're set to hidden if their schema is\n * set to false (a falsy schema means the schema fails whenever a value is sent for that field)\n *\n */\nfunction applySchemaRules(\n fields: Field[],\n values: SchemaValue,\n schema: JsfObjectSchema,\n options: ValidationOptions = {},\n) {\n if (!isObjectValue(values)) {\n return\n }\n\n const conditionalRules: { rule: NonBooleanJsfSchema, matches: boolean }[] = []\n\n // If the schema has an if property, evaluate it and add it to the conditional rules array\n if (schema.if) {\n conditionalRules.push(evaluateConditional(values, schema, schema, options))\n }\n\n // If the schema has an allOf property, evaluate each rule and add it to the conditional rules array\n (schema.allOf ?? [])\n .filter((rule: JsfSchema) => rule.if)\n .forEach((rule) => {\n const result = evaluateConditional(values, schema, rule as NonBooleanJsfSchema, options)\n conditionalRules.push(result)\n })\n\n // Process the conditional rules\n for (const { rule, matches } of conditionalRules) {\n // If the rule matches, process the then branch\n if (matches && rule.then) {\n processBranch(fields, values, rule.then, options)\n }\n // If the rule doesn't match, process the else branch\n else if (!matches && rule.else) {\n processBranch(fields, values, rule.else, options)\n }\n }\n}\n\n/**\n * Processes a branch of a conditional rule, updating the visibility of fields based on the branch's schema\n * @param fields - The fields to process\n * @param values - The current form values\n * @param branch - The branch (schema representing and then/else) to process\n * @param options - Validation options\n */\nfunction processBranch(fields: Field[], values: SchemaValue, branch: JsfSchema, options: ValidationOptions = {}) {\n if (branch.properties) {\n // Cycle through each property in the schema and search for any (possibly nested)\n // fields that have a false boolean schema. If found, set the field's visibility to false\n for (const fieldName in branch.properties) {\n const fieldSchema = branch.properties[fieldName]\n const field = fields.find(e => e.name === fieldName)\n if (field) {\n if (field?.fields) {\n processBranch(field.fields, values, fieldSchema)\n }\n else if (fieldSchema === false) {\n field.isVisible = false\n }\n else {\n // If the field has properties being declared on this branch, we need to update the field\n // with the new properties\n const newField = buildFieldSchema(fieldSchema as JsfObjectSchema, fieldName, true)\n for (const key in newField) {\n // We don't want to override the type property\n if (!['type'].includes(key)) {\n field[key] = newField[key]\n }\n }\n }\n }\n }\n }\n\n // Apply rules to the branch\n applySchemaRules(fields, values, branch as JsfObjectSchema, options)\n}\n","import type { ValidationError, ValidationErrorPath } from './errors'\nimport type { Field } from './field/type'\nimport type { JsfObjectSchema, JsfSchema, NonBooleanJsfSchema, SchemaValue } from './types'\nimport type { ValidationOptions } from './validation/schema'\nimport { getErrorMessage } from './errors/messages'\nimport { buildFieldObject } from './field/object'\nimport { mutateFields } from './mutations'\nimport { validateSchema } from './validation/schema'\nimport { isObjectValue } from './validation/util'\n\nexport { ValidationOptions } from './validation/schema'\n\ninterface FormResult {\n fields: Field[]\n isError: boolean\n error: string | null\n handleValidation: (value: SchemaValue) => ValidationResult\n}\n\n/**\n * Recursive type for form error messages\n * - String for leaf error messages\n * - Nested object for nested fields\n */\nexport interface FormErrors {\n [key: string]: string | FormErrors\n}\n\nexport interface ValidationResult {\n formErrors?: FormErrors\n}\n\n/**\n * Remove composition keywords and their indices as well as conditional keywords from the path\n * @param path - The path to clean\n * @returns The cleaned path\n * @example\n * ```ts\n * cleanErrorPath(['some_object','allOf', 0, 'then', 'field'])\n * // ['some_object', 'field']\n * ```\n */\nfunction cleanErrorPath(path: ValidationErrorPath): ValidationErrorPath {\n const result: ValidationErrorPath = []\n\n for (let i = 0; i < path.length; i++) {\n const segment = path[i]\n\n if (['allOf', 'anyOf', 'oneOf'].includes(segment as string)) {\n if (i + 1 < path.length && typeof path[i + 1] === 'number') {\n i++\n }\n continue\n }\n\n if (segment === 'then' || segment === 'else') {\n continue\n }\n\n result.push(segment)\n }\n\n return result\n}\n\n/**\n * Transform validation errors into an object with the field names as keys and the error messages as values.\n * For nested fields, creates a nested object structure rather than using dot notation.\n * When multiple errors exist for the same field, the last error message is used.\n *\n * @example\n * Single field error\n * { username: 'Required field' }\n *\n * Nested field error (using nested objects)\n * { address: { street: 'The value must be a string' } }\n *\n * Schema-level error\n * { '': 'The value must match at least one schema' }\n */\nfunction validationErrorsToFormErrors(errors: ValidationErrorWithMessage[]): FormErrors | null {\n if (errors.length === 0) {\n return null\n }\n\n // Use a more functional approach with reduce\n return errors.reduce<FormErrors>((result, error) => {\n const { path } = error\n\n // Handle schema-level errors (empty path)\n if (path.length === 0) {\n result[''] = error.message\n return result\n }\n\n // Clean the path to remove intermediate composition structures\n const cleanedPath = cleanErrorPath(path)\n\n // For all paths, recursively build the nested structure\n let current = result\n\n // Process all segments except the last one (which will hold the message)\n cleanedPath.slice(0, -1).forEach((segment) => {\n // If this segment doesn't exist yet or is currently a string (from a previous error),\n // initialize it as an object\n if (!(segment in current) || typeof current[segment] === 'string') {\n current[segment] = {}\n }\n\n current = current[segment] as FormErrors\n })\n\n // Set the message at the final level\n if (cleanedPath.length > 0) {\n const lastSegment = cleanedPath[cleanedPath.length - 1]\n current[lastSegment] = error.message\n }\n else {\n // Fallback for unexpected path structures\n result[''] = error.message\n }\n\n return result\n }, {})\n}\n\ninterface ValidationErrorWithMessage extends ValidationError {\n message: string\n}\n\nfunction getSchemaAndValueAtPath(rootSchema: JsfSchema, rootValue: SchemaValue, path: (string | number)[]): { schema: JsfSchema, value: SchemaValue } {\n let currentSchema = rootSchema\n let currentValue = rootValue\n\n for (const segment of path) {\n if (typeof currentSchema === 'object' && currentSchema !== null) {\n if (currentSchema.properties && currentSchema.properties[segment]) {\n currentSchema = currentSchema.properties[segment]\n if (isObjectValue(currentValue)) {\n currentValue = currentValue[segment]\n }\n }\n else if (currentSchema.items && typeof currentSchema.items !== 'boolean') {\n currentSchema = currentSchema.items\n if (Array.isArray(currentValue)) {\n currentValue = currentValue[Number(segment)]\n }\n }\n // Skip the 'allOf', 'anyOf', and 'oneOf' segments, the next segment will be the index\n else if (segment === 'allOf' && currentSchema.allOf) {\n continue\n }\n else if (segment === 'anyOf' && currentSchema.anyOf) {\n continue\n }\n else if (segment === 'oneOf' && currentSchema.oneOf) {\n continue\n }\n // Skip the 'then' and 'else' segments, the next segment will be the field name\n else if ((segment === 'then' || segment === 'else') && currentSchema[segment]) {\n currentSchema = currentSchema[segment]\n continue\n }\n // If we have we are in a composition context, get the subschema\n else if (currentSchema.allOf || currentSchema.anyOf || currentSchema.oneOf) {\n const index = Number(segment)\n if (currentSchema.allOf && index >= 0 && index < currentSchema.allOf.length) {\n currentSchema = currentSchema.allOf[index]\n }\n else if (currentSchema.anyOf && index >= 0 && index < currentSchema.anyOf.length) {\n currentSchema = currentSchema.anyOf[index]\n }\n else if (currentSchema.oneOf && index >= 0 && index < currentSchema.oneOf.length) {\n currentSchema = currentSchema.oneOf[index]\n }\n }\n }\n }\n\n return { schema: currentSchema, value: currentValue }\n}\n\nfunction addErrorMessages(rootValue: SchemaValue, rootSchema: JsfSchema, errors: ValidationError[]): ValidationErrorWithMessage[] {\n return errors.map((error) => {\n const { schema: errorSchema, value: errorValue } = getSchemaAndValueAtPath(rootSchema, rootValue, error.path)\n\n return {\n ...error,\n message: getErrorMessage(errorSchema, errorValue, error.validation),\n }\n })\n}\n\n/**\n * Apply custom error messages from the schema to validation errors\n * @param errors - The validation errors\n * @param schema - The schema that contains custom error messages\n * @returns The validation errors with custom error messages applied\n */\nfunction applyCustomErrorMessages(errors: ValidationErrorWithMessage[], schema: JsfSchema): ValidationErrorWithMessage[] {\n if (typeof schema !== 'object' || !schema || !errors.length) {\n return errors\n }\n\n return errors.map((error) => {\n // Skip if no path or empty path\n if (!error.path.length) {\n return error\n }\n\n // Find the schema for this error path\n let currentSchema: NonBooleanJsfSchema | null = typeof schema === 'object' ? schema : null\n let fieldSchema: NonBooleanJsfSchema | null = null\n\n // Navigate through the schema to find the field schema\n for (const segment of error.path) {\n if (!currentSchema || typeof currentSchema !== 'object') {\n break\n }\n\n if (currentSchema.properties && currentSchema.properties[segment]) {\n const nextSchema = currentSchema.properties[segment]\n // Skip if the schema is a boolean\n if (typeof nextSchema !== 'boolean') {\n currentSchema = nextSchema\n fieldSchema = currentSchema\n }\n else {\n break\n }\n }\n else if (currentSchema.items && typeof currentSchema.items !== 'boolean') {\n // Handle array items\n currentSchema = currentSchema.items\n fieldSchema = currentSchema\n }\n else {\n break\n }\n }\n\n // If we found a schema with custom error messages, apply them\n if (\n fieldSchema\n && fieldSchema['x-jsf-errorMessage']\n && fieldSchema['x-jsf-errorMessage'][error.validation]\n ) {\n return {\n ...error,\n message: fieldSchema['x-jsf-errorMessage'][error.validation],\n }\n }\n\n return error\n })\n}\n\n/**\n * Validate a value against a schema\n * @param value - The value to validate\n * @param schema - The schema to validate against\n * @returns The validation result\n */\nfunction validate(value: SchemaValue, schema: JsfSchema, options: ValidationOptions = {}): ValidationResult {\n const result: ValidationResult = {}\n const errors = validateSchema(value, schema, options)\n\n const errorsWithMessages = addErrorMessages(value, schema, errors)\n const processedErrors = applyCustomErrorMessages(errorsWithMessages, schema)\n\n const formErrors = validationErrorsToFormErrors(processedErrors)\n\n if (formErrors) {\n result.formErrors = formErrors\n }\n\n return result\n}\n\nexport interface CreateHeadlessFormOptions {\n initialValues?: SchemaValue\n validationOptions?: ValidationOptions\n}\n\nfunction buildFields(params: { schema: JsfObjectSchema }): Field[] {\n const { schema } = params\n const fields = buildFieldObject(schema, 'root', true).fields || []\n return fields\n}\n\nexport function createHeadlessForm(\n schema: JsfObjectSchema,\n options: CreateHeadlessFormOptions = {},\n): FormResult {\n const initialValues = options.initialValues || {}\n const fields = buildFields({ schema })\n\n // Making sure field properties are correct for the initial values\n mutateFields(fields, initialValues, schema)\n\n // TODO: check if we need this isError variable exposed\n const isError = false\n\n const handleValidation = (value: SchemaValue) => {\n const result = validate(value, schema, options.validationOptions)\n\n // Fields properties might have changed, so we need to reset the fields by updating them in place\n buildFieldsInPlace(fields, schema)\n\n // Updating field properties based on the new form value\n mutateFields(fields, value, schema, options.validationOptions)\n\n return result\n }\n\n return {\n fields,\n isError,\n error: null,\n handleValidation,\n }\n}\n\n/**\n * Updates fields in place based on a schema, recursively if needed\n * @param fields - The fields array to mutate\n * @param schema - The schema to use for updating fields\n */\nfunction buildFieldsInPlace(fields: Field[], schema: JsfObjectSchema): void {\n // Clear existing fields array\n fields.length = 0\n\n // Get new fields from schema\n const newFields = buildFieldObject(schema, 'root', true).fields || []\n\n // Push all new fields into existing array\n fields.push(...newFields)\n\n // Recursively update any nested fields\n for (const field of fields) {\n // eslint-disable-next-line ts/ban-ts-comment\n // @ts-expect-error\n if (field.fields && schema.properties?.[field.name]?.type === 'object') {\n buildFieldsInPlace(field.fields, schema.properties[field.name] as JsfObjectSchema)\n }\n }\n}\n"],"mappings":"shBAAA,IAAAA,EAAAC,EAAA,CAAAC,GAAAC,IAAA,cAAAA,EAAO,QAAU,CACf,KAAa,EACb,MAAa,EACb,SAAa,EACb,IAAa,EACb,MAAa,EACb,WAAa,EACb,UAAa,EACb,KAAa,CACf,ICTA,IAAAC,EAAAC,EAAAC,GAAA,kBAAMC,EAAQ,IAERC,EAAO,IAAM,CAAC,CAAE,KAAMD,EAAM,MAAQ,KAAM,GAAI,GAAI,EAAG,CAAC,EAEtDE,EAAQ,IACL,CACL,CAAE,KAAMF,EAAM,KAAM,MAAO,EAAG,EAC9B,CAAE,KAAMA,EAAM,MAAO,KAAM,GAAI,GAAI,GAAI,EACvC,CAAE,KAAMA,EAAM,MAAO,KAAM,GAAI,GAAI,EAAG,CACxC,EAAE,OAAOC,EAAK,CAAC,EAGXE,GAAa,IACV,CACL,CAAE,KAAMH,EAAM,KAAM,MAAO,CAAE,EAC7B,CAAE,KAAMA,EAAM,KAAM,MAAO,EAAG,EAC9B,CAAE,KAAMA,EAAM,KAAM,MAAO,EAAG,EAC9B,CAAE,KAAMA,EAAM,KAAM,MAAO,EAAG,EAC9B,CAAE,KAAMA,EAAM,KAAM,MAAO,EAAG,EAC9B,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AY,CAAE,OAAAV,CAAO,CAAC,EAGrC,OAAAgB,EAAaD,EAAQD,EAAed,CAAM,EAiBnC,CACL,OAAAe,EACA,QAhBc,GAiBd,MAAO,KACP,iBAhBwBX,GAAuB,CAC/C,IAAMzB,EAASwB,GAASC,EAAOJ,EAAQK,EAAQ,iBAAiB,EAGhE,OAAAY,GAAmBF,EAAQf,CAAM,EAGjCgB,EAAaD,EAAQX,EAAOJ,EAAQK,EAAQ,iBAAiB,EAEtD1B,CACT,CAOA,CACF,CAOA,SAASsC,GAAmBF,EAAiBf,EAA+B,CAE1Ee,EAAO,OAAS,EAGhB,IAAMG,EAAYN,EAAiBZ,EAAQ,OAAQ,EAAI,EAAE,QAAU,CAAC,EAGpEe,EAAO,KAAK,GAAGG,CAAS,EAGxB,QAAWC,KAASJ,EAGdI,EAAM,QAAUnB,EAAO,aAAamB,EAAM,IAAI,GAAG,OAAS,UAC5DF,GAAmBE,EAAM,OAAQnB,EAAO,WAAWmB,EAAM,IAAI,CAAoB,CAGvF","names":["require_types","__commonJSMin","exports","module","require_sets","__commonJSMin","exports","types","INTS","WORDS","WHITESPACE","NOTANYCHAR","require_util","__commonJSMin","exports","types","sets","CTRL","SLSH","str","chars_regex","s","b","lbs","a16","b16","c8","dctrl","eslsh","code","c","regexpStr","tokens","regexp","rs","msg","require_positions","__commonJSMin","exports","types","require_lib","__commonJSMin","exports","module","util","types","sets","positions","regexpStr","i","l","c","start","lastGroup","last","groupStack","repeatErr","str","not","classTokens","group","stack","rs","min","max","require_lib","__commonJSMin","exports","module","SubRange","_SubRange","low","high","range","DRange","_DRange","a","b","previous","_add","subrange","i","newRanges","_subtract","_intersect","index","result","require_randexp","__commonJSMin","exports","module","ret","DRange","types","RandExp","regexp","m","token","groups","stack","str","n","expandedSet","code","arr","drange","i","subrange","j","otherCaseCode","a","b","range","randexp","import_randexp","getErrorMessage","schema","value","validation","getTypeErrorMessage","valueToString","schemaType","type","sort","params","prevFields","order","indexMap","key","index","b","indexA","indexB","setCustomOrder","schema","fields","getJsonType","schema","convertToOptions","nodeOptions","option","schemaOption","title","value","meta","result","_","__","___","rest","getFieldOptions","excludedSchemaProps","buildFieldSchema","name","required","objectSchema","buildFieldObject","presentation","errorMessage","inputType","field","key","acc","options","buildFieldObject","schema","name","required","fields","key","isRequired","field","buildFieldSchema","orderedFields","setCustomOrder","validateAllOf","value","schema","options","path","i","subSchema","errors","validateSchema","validateAnyOf","validateOneOf","validCount","validateNot","validateCondition","value","schema","options","path","conditionIsTrue","validateSchema","isObjectValue","v","deepEqual","a","b","item","index","aKeys","bKeys","key","validateConst","value","schema","path","deepEqual","validateEnum","value","schema","path","enumValue","deepEqual","validateNumber","value","schema","path","errors","schemaType","getSchemaType","validateObject","value","schema","options","path","isObjectValue","errors","key","propertySchema","validateSchema","ContentEncoding","ContentEncoding1","Format","Format1","TypeName","TypeName1","PATTERNS","formatValidationFunctions","Format","value","label","parts","part","num","hasDoubleColon","url","validateFormat","format","path","errors","validateFn","validateString","value","schema","path","errors","schemaType","getSchemaType","valueLength","formatErrors","validateFormat","getSchemaType","schema","validateType","value","path","schemaType","valueType","type","validateSchema","options","valueIsUndefined","errors","typeValidationErrors","isObjectValue","missingKeys","key","fieldValue","validateConst","validateEnum","validateObject","validateString","validateNumber","validateNot","validateAllOf","validateAnyOf","validateOneOf","validateCondition","mutateFields","fields","values","schema","options","isObjectValue","applySchemaRules","fieldName","fieldSchema","field","evaluateConditional","rule","matches","validateSchema","hasTypeErrors","fieldValue","error","conditionalRules","result","processBranch","branch","e","newField","buildFieldSchema","key","cleanErrorPath","path","result","i","segment","validationErrorsToFormErrors","errors","error","cleanedPath","current","lastSegment","getSchemaAndValueAtPath","rootSchema","rootValue","currentSchema","currentValue","isObjectValue","index","addErrorMessages","errorSchema","errorValue","getErrorMessage","applyCustomErrorMessages","schema","fieldSchema","nextSchema","validate","value","options","validateSchema","errorsWithMessages","processedErrors","formErrors","buildFields","params","buildFieldObject","createHeadlessForm","initialValues","fields","mutateFields","buildFieldsInPlace","newFields","field"]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@remoteoss/json-schema-form",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.0.0-dev.
|
|
4
|
+
"version": "1.0.0-dev.20250411160101",
|
|
5
5
|
"packageManager": "pnpm@9.15.2",
|
|
6
6
|
"description": "WIP V2 – Headless UI form powered by JSON Schemas",
|
|
7
7
|
"author": "Remote.com <engineering@remote.com> (https://remote.com/)",
|
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
},
|
|
29
29
|
"scripts": {
|
|
30
30
|
"build": "tsup",
|
|
31
|
+
"dev": "NODE_ENV=development tsup --watch",
|
|
31
32
|
"test": "jest",
|
|
32
33
|
"test:watch": "jest --watchAll",
|
|
33
34
|
"test:file": "jest --runTestsByPath",
|