@hyperjump/json-schema-core
Advanced tools
Comparing version 0.8.2 to 0.9.0
@@ -1215,3 +1215,3 @@ define(['exports'], function (exports) { 'use strict'; | ||
const entries$1 = (doc) => Object.keys(value$1(doc)) | ||
.map((key) => [key, step$1(key, doc)]); | ||
.map(async (key) => [key, await step$1(key, doc)]); | ||
@@ -1395,3 +1395,18 @@ const map$1 = justCurryIt((fn, doc) => value$1(doc) | ||
var reduce$1 = justCurryIt(async (fn, acc, doc) => { | ||
return (await doc).reduce(async (acc, item) => fn(await acc, item), acc); | ||
return (await doc).reduce(async (acc, item) => { | ||
let resolvedAcc; | ||
try { | ||
resolvedAcc = await acc; | ||
} catch (e) { | ||
try { | ||
await item; | ||
} catch (e) { | ||
// If we've already encountered an error, ignore subsequent errors. | ||
} | ||
return acc; | ||
} | ||
return fn(resolvedAcc, item); | ||
}, acc); | ||
}); | ||
@@ -1455,8 +1470,13 @@ | ||
schema.entries, | ||
lib.map(([keyword, keywordSchema]) => { | ||
lib.map(async (entry) => { | ||
const [keyword, keywordSchema] = await entry; | ||
const keywordId = `${schema$1.schemaVersion}#${keyword}`; | ||
return [keywordId, keywordSchema]; | ||
}), | ||
lib.filter(([keywordId]) => core.hasKeyword(keywordId) && keywordId !== `${schema$1.schemaVersion}#validate`), | ||
lib.map(async ([keywordId, keywordSchemaPromise]) => { | ||
lib.filter(async (entry) => { | ||
const [keywordId] = await entry; | ||
return core.hasKeyword(keywordId) && keywordId !== `${schema$1.schemaVersion}#validate`; | ||
}), | ||
lib.map(async (entry) => { | ||
const [keywordId, keywordSchemaPromise] = await entry; | ||
const keywordSchema = await keywordSchemaPromise; | ||
@@ -1463,0 +1483,0 @@ const keywordAst = await core.getKeyword(keywordId).compile(keywordSchema, ast, schema$1); |
@@ -1,2 +0,2 @@ | ||
define(["exports"],(function(e){"use strict";var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var r=function(e,t){return e(t={exports:{}},t.exports),t.exports}((function(e,r){!function(t,n){var o={};t.PubSub=o;var i=t.define;!function(e){var t={},r=-1;function n(e){var t;for(t in e)if(e.hasOwnProperty(t))return!0;return!1}function o(e,t,r){try{e(t,r)}catch(e){setTimeout(function(e){return function(){throw e}}(e),0)}}function i(e,t,r){e(t,r)}function a(e,r,n,a){var s,c=t[r],u=a?i:o;if(t.hasOwnProperty(r))for(s in c)c.hasOwnProperty(s)&&u(c[s],e,n)}function s(e,r,o,i){var s=function(e,t,r){return function(){var n=String(e),o=n.lastIndexOf(".");for(a(e,e,t,r);-1!==o;)o=(n=n.substr(0,o)).lastIndexOf("."),a(e,n,t,r)}}(e="symbol"==typeof e?e.toString():e,r,i);return!!function(e){for(var r=String(e),o=Boolean(t.hasOwnProperty(r)&&n(t[r])),i=r.lastIndexOf(".");!o&&-1!==i;)i=(r=r.substr(0,i)).lastIndexOf("."),o=Boolean(t.hasOwnProperty(r)&&n(t[r]));return o}(e)&&(!0===o?s():setTimeout(s,0),!0)}e.publish=function(t,r){return s(t,r,!1,e.immediateExceptions)},e.publishSync=function(t,r){return s(t,r,!0,e.immediateExceptions)},e.subscribe=function(e,n){if("function"!=typeof n)return!1;e="symbol"==typeof e?e.toString():e,t.hasOwnProperty(e)||(t[e]={});var o="uid_"+String(++r);return t[e][o]=n,o},e.subscribeOnce=function(t,r){var n=e.subscribe(t,(function(){e.unsubscribe(n),r.apply(this,arguments)}));return e},e.clearAllSubscriptions=function(){t={}},e.clearSubscriptions=function(e){var r;for(r in t)t.hasOwnProperty(r)&&0===r.indexOf(e)&&delete t[r]},e.countSubscriptions=function(e){var r,n=0;for(r in t)t.hasOwnProperty(r)&&0===r.indexOf(e)&&n++;return n},e.getSubscriptions=function(e){var r,n=[];for(r in t)t.hasOwnProperty(r)&&0===r.indexOf(e)&&n.push(r);return n},e.unsubscribe=function(r){var n,o,i,a="string"==typeof r&&(t.hasOwnProperty(r)||function(e){var r;for(r in t)if(t.hasOwnProperty(r)&&0===r.indexOf(e))return!0;return!1}(r)),s=!a&&"string"==typeof r,c="function"==typeof r,u=!1;if(!a){for(n in t)if(t.hasOwnProperty(n)){if(o=t[n],s&&o[r]){delete o[r],u=r;break}if(c)for(i in o)o.hasOwnProperty(i)&&o[i]===r&&(delete o[i],u=!0)}return u}e.clearSubscriptions(r)}}(o),"function"==typeof i&&i.amd?i((function(){return o})):(void 0!==e&&e.exports&&(r=e.exports=o),r.PubSub=o,e.exports=r=o)}("object"==typeof window&&window||t)})),n=(r.PubSub,function(e,t){return function r(){null==t&&(t=e.length);var n=[].slice.call(arguments);return n.length>=t?e.apply(this,n):function(){return r.apply(this,n.concat([].slice.call(arguments)))}}});const o=e=>{if(e.length>0&&"/"!==e[0])throw Error("Invalid JSON Pointer");return e.split("/").slice(1).map(f)},i=(e,t,r,n)=>{if(0===e.length)return r;if(e.length>1){const o=e.shift();return{...t,[o]:i(e,p(t,o,n),r,u(o,n))}}if(Array.isArray(t)){const n=[...t];return n[d(t,e[0])]=r,n}return"object"==typeof t&&null!==t?{...t,[e[0]]:r}:p(t,e[0],n)},a=(e,t,r,n)=>{if(0!==e.length)if(1!==e.length||h(t)){const o=e.shift();a(e,p(t,o,n),r,u(o,n))}else{t[d(t,e[0])]=r}},s=(e,t,r)=>{if(0!=e.length){if(e.length>1){const n=e.shift(),o=p(t,n,r);return{...t,[n]:s(e,o,u(n,r))}}if(Array.isArray(t))return t.filter((t,r)=>r!=e[0]);if("object"==typeof t&&null!==t){const{[e[0]]:r,...n}=t;return n}return p(t,e[0],r)}},c=(e,t,r)=>{if(0!==e.length)if(e.length>1){const n=e.shift(),o=p(t,n,r);c(e,o,u(n,r))}else Array.isArray(t)?t.splice(e[0],1):"object"==typeof t&&null!==t?delete t[e[0]]:p(t,e[0],r)},u=n((e,t)=>t+"/"+l(e)),l=e=>e.toString().replace(/~/g,"~0").replace(/\//g,"~1"),f=e=>e.toString().replace(/~1/g,"/").replace(/~0/g,"~"),d=(e,t)=>Array.isArray(e)&&"-"===t?e.length:t,p=(e,t,r="")=>{if(void 0===e)throw TypeError(`Value at '${r}' is undefined and does not have property '${t}'`);if(null===e)throw TypeError(`Value at '${r}' is null and does not have property '${t}'`);if(h(e))throw TypeError(`Value at '${r}' is a ${typeof e} and does not have property '${t}'`);return e[d(e,t)]},h=e=>null===e||"object"!=typeof e;var y={nil:"",append:u,get:(e,t)=>{const r=o(e),n=e=>r.reduce(([e,t],r)=>[p(e,r,t),u(r,t)],[e,""])[0];return void 0===t?n:n(t)},set:(e,t,r)=>{const a=o(e),s=n((e,t)=>i(a,e,t,""));return void 0===t?s:s(t,r)},assign:(e,t,r)=>{const i=o(e),s=n((e,t)=>a(i,e,t,""));return void 0===t?s:s(t,r)},unset:(e,t)=>{const r=o(e),n=e=>s(r,e,"");return void 0===t?n:n(t)},delete:(e,t)=>{const r=o(e),n=e=>c(r,e,"");return void 0===t?n:n(t)}};var v={isObject:e=>"object"==typeof e&&!Array.isArray(e)&&null!==e,splitUrl:e=>{const t=e.indexOf("#"),r=-1===t?e.length:t,n=e.slice(0,r),o=e.slice(r+1);return[decodeURI(n),decodeURI(o)]}};const{splitUrl:b}=v,m=Object.freeze({id:"",pointer:"",instance:void 0}),w=(e,t=m)=>Object.freeze({...t,pointer:b(e)[1]}),g=e=>y.get(e.pointer,e.instance),O=(e,t)=>{const r=y.append(e,t.pointer);return w("#"+encodeURI(r),t)},E=n((e,t)=>g(t).map((r,n)=>e(O(n,t),n))),$=n((e,t)=>g(t).map((e,r)=>O(r,t)).filter((t,r)=>e(t,r))),P=n((e,t,r)=>g(r).reduce((t,n,o)=>e(t,O(o,r),o),t)),j=n((e,t)=>Object.keys(g(t)).every((r,n)=>e(O(r,t),n))),x=n((e,t)=>Object.keys(g(t)).some((r,n)=>e(O(r,t),n)));var A={cons:(e,t="")=>Object.freeze({...m,id:t,instance:e}),get:w,uri:e=>`${e.id}#${encodeURI(e.pointer)}`,value:g,step:O,entries:e=>Object.keys(g(e)).map(t=>[t,O(t,e)]),map:E,filter:$,reduce:P,every:j,some:x},S=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,I=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,V=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,T=/\\([\u000b\u0020-\u00ff])/g,k=/([\\"])/g,R=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/; | ||
define(["exports"],(function(e){"use strict";var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var r=function(e,t){return e(t={exports:{}},t.exports),t.exports}((function(e,r){!function(t,n){var o={};t.PubSub=o;var i=t.define;!function(e){var t={},r=-1;function n(e){var t;for(t in e)if(e.hasOwnProperty(t))return!0;return!1}function o(e,t,r){try{e(t,r)}catch(e){setTimeout(function(e){return function(){throw e}}(e),0)}}function i(e,t,r){e(t,r)}function a(e,r,n,a){var s,c=t[r],u=a?i:o;if(t.hasOwnProperty(r))for(s in c)c.hasOwnProperty(s)&&u(c[s],e,n)}function s(e,r,o,i){var s=function(e,t,r){return function(){var n=String(e),o=n.lastIndexOf(".");for(a(e,e,t,r);-1!==o;)o=(n=n.substr(0,o)).lastIndexOf("."),a(e,n,t,r)}}(e="symbol"==typeof e?e.toString():e,r,i);return!!function(e){for(var r=String(e),o=Boolean(t.hasOwnProperty(r)&&n(t[r])),i=r.lastIndexOf(".");!o&&-1!==i;)i=(r=r.substr(0,i)).lastIndexOf("."),o=Boolean(t.hasOwnProperty(r)&&n(t[r]));return o}(e)&&(!0===o?s():setTimeout(s,0),!0)}e.publish=function(t,r){return s(t,r,!1,e.immediateExceptions)},e.publishSync=function(t,r){return s(t,r,!0,e.immediateExceptions)},e.subscribe=function(e,n){if("function"!=typeof n)return!1;e="symbol"==typeof e?e.toString():e,t.hasOwnProperty(e)||(t[e]={});var o="uid_"+String(++r);return t[e][o]=n,o},e.subscribeOnce=function(t,r){var n=e.subscribe(t,(function(){e.unsubscribe(n),r.apply(this,arguments)}));return e},e.clearAllSubscriptions=function(){t={}},e.clearSubscriptions=function(e){var r;for(r in t)t.hasOwnProperty(r)&&0===r.indexOf(e)&&delete t[r]},e.countSubscriptions=function(e){var r,n=0;for(r in t)t.hasOwnProperty(r)&&0===r.indexOf(e)&&n++;return n},e.getSubscriptions=function(e){var r,n=[];for(r in t)t.hasOwnProperty(r)&&0===r.indexOf(e)&&n.push(r);return n},e.unsubscribe=function(r){var n,o,i,a="string"==typeof r&&(t.hasOwnProperty(r)||function(e){var r;for(r in t)if(t.hasOwnProperty(r)&&0===r.indexOf(e))return!0;return!1}(r)),s=!a&&"string"==typeof r,c="function"==typeof r,u=!1;if(!a){for(n in t)if(t.hasOwnProperty(n)){if(o=t[n],s&&o[r]){delete o[r],u=r;break}if(c)for(i in o)o.hasOwnProperty(i)&&o[i]===r&&(delete o[i],u=!0)}return u}e.clearSubscriptions(r)}}(o),"function"==typeof i&&i.amd?i((function(){return o})):(void 0!==e&&e.exports&&(r=e.exports=o),r.PubSub=o,e.exports=r=o)}("object"==typeof window&&window||t)})),n=(r.PubSub,function(e,t){return function r(){null==t&&(t=e.length);var n=[].slice.call(arguments);return n.length>=t?e.apply(this,n):function(){return r.apply(this,n.concat([].slice.call(arguments)))}}});const o=e=>{if(e.length>0&&"/"!==e[0])throw Error("Invalid JSON Pointer");return e.split("/").slice(1).map(f)},i=(e,t,r,n)=>{if(0===e.length)return r;if(e.length>1){const o=e.shift();return{...t,[o]:i(e,p(t,o,n),r,u(o,n))}}if(Array.isArray(t)){const n=[...t];return n[d(t,e[0])]=r,n}return"object"==typeof t&&null!==t?{...t,[e[0]]:r}:p(t,e[0],n)},a=(e,t,r,n)=>{if(0!==e.length)if(1!==e.length||h(t)){const o=e.shift();a(e,p(t,o,n),r,u(o,n))}else{t[d(t,e[0])]=r}},s=(e,t,r)=>{if(0!=e.length){if(e.length>1){const n=e.shift(),o=p(t,n,r);return{...t,[n]:s(e,o,u(n,r))}}if(Array.isArray(t))return t.filter((t,r)=>r!=e[0]);if("object"==typeof t&&null!==t){const{[e[0]]:r,...n}=t;return n}return p(t,e[0],r)}},c=(e,t,r)=>{if(0!==e.length)if(e.length>1){const n=e.shift(),o=p(t,n,r);c(e,o,u(n,r))}else Array.isArray(t)?t.splice(e[0],1):"object"==typeof t&&null!==t?delete t[e[0]]:p(t,e[0],r)},u=n((e,t)=>t+"/"+l(e)),l=e=>e.toString().replace(/~/g,"~0").replace(/\//g,"~1"),f=e=>e.toString().replace(/~1/g,"/").replace(/~0/g,"~"),d=(e,t)=>Array.isArray(e)&&"-"===t?e.length:t,p=(e,t,r="")=>{if(void 0===e)throw TypeError(`Value at '${r}' is undefined and does not have property '${t}'`);if(null===e)throw TypeError(`Value at '${r}' is null and does not have property '${t}'`);if(h(e))throw TypeError(`Value at '${r}' is a ${typeof e} and does not have property '${t}'`);return e[d(e,t)]},h=e=>null===e||"object"!=typeof e;var y={nil:"",append:u,get:(e,t)=>{const r=o(e),n=e=>r.reduce(([e,t],r)=>[p(e,r,t),u(r,t)],[e,""])[0];return void 0===t?n:n(t)},set:(e,t,r)=>{const a=o(e),s=n((e,t)=>i(a,e,t,""));return void 0===t?s:s(t,r)},assign:(e,t,r)=>{const i=o(e),s=n((e,t)=>a(i,e,t,""));return void 0===t?s:s(t,r)},unset:(e,t)=>{const r=o(e),n=e=>s(r,e,"");return void 0===t?n:n(t)},delete:(e,t)=>{const r=o(e),n=e=>c(r,e,"");return void 0===t?n:n(t)}};var v={isObject:e=>"object"==typeof e&&!Array.isArray(e)&&null!==e,splitUrl:e=>{const t=e.indexOf("#"),r=-1===t?e.length:t,n=e.slice(0,r),o=e.slice(r+1);return[decodeURI(n),decodeURI(o)]}};const{splitUrl:b}=v,w=Object.freeze({id:"",pointer:"",instance:void 0}),m=(e,t=w)=>Object.freeze({...t,pointer:b(e)[1]}),g=e=>y.get(e.pointer,e.instance),O=(e,t)=>{const r=y.append(e,t.pointer);return m("#"+encodeURI(r),t)},E=n((e,t)=>g(t).map((r,n)=>e(O(n,t),n))),$=n((e,t)=>g(t).map((e,r)=>O(r,t)).filter((t,r)=>e(t,r))),P=n((e,t,r)=>g(r).reduce((t,n,o)=>e(t,O(o,r),o),t)),j=n((e,t)=>Object.keys(g(t)).every((r,n)=>e(O(r,t),n))),x=n((e,t)=>Object.keys(g(t)).some((r,n)=>e(O(r,t),n)));var A={cons:(e,t="")=>Object.freeze({...w,id:t,instance:e}),get:m,uri:e=>`${e.id}#${encodeURI(e.pointer)}`,value:g,step:O,entries:e=>Object.keys(g(e)).map(t=>[t,O(t,e)]),map:E,filter:$,reduce:P,every:j,some:x},S=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,I=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,V=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,T=/\\([\u000b\u0020-\u00ff])/g,k=/([\\"])/g,R=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/; | ||
/*! | ||
@@ -6,3 +6,3 @@ * content-type | ||
* MIT Licensed | ||
*/function K(e){var t=String(e);if(V.test(t))return t;if(t.length>0&&!I.test(t))throw new TypeError("invalid parameter value");return'"'+t.replace(k,"\\$1")+'"'}function L(e){this.parameters=Object.create(null),this.type=e}var C={format:function(e){if(!e||"object"!=typeof e)throw new TypeError("argument obj is required");var t=e.parameters,r=e.type;if(!r||!R.test(r))throw new TypeError("invalid type");var n=r;if(t&&"object"==typeof t)for(var o,i=Object.keys(t).sort(),a=0;a<i.length;a++){if(o=i[a],!V.test(o))throw new TypeError("invalid parameter name");n+="; "+o+"="+K(t[o])}return n},parse:function(e){if(!e)throw new TypeError("argument string is required");var t="object"==typeof e?function(e){var t;"function"==typeof e.getHeader?t=e.getHeader("content-type"):"object"==typeof e.headers&&(t=e.headers&&e.headers["content-type"]);if("string"!=typeof t)throw new TypeError("content-type header is missing from object");return t}(e):e;if("string"!=typeof t)throw new TypeError("argument string is required to be a string");var r=t.indexOf(";"),n=-1!==r?t.substr(0,r).trim():t.trim();if(!R.test(n))throw new TypeError("invalid media type");var o=new L(n.toLowerCase());if(-1!==r){var i,a,s;for(S.lastIndex=r;a=S.exec(t);){if(a.index!==r)throw new TypeError("invalid parameter format");r+=a[0].length,i=a[1].toLowerCase(),'"'===(s=a[2])[0]&&(s=s.substr(1,s.length-2).replace(T,"$1")),o.parameters[i]=s}if(r!==t.length)throw new TypeError("invalid parameter format")}return o}},U=function(e,t){if(e=e.trim(),(t=t.trim()).startsWith("about:"))return t;const r=function(e){const t={host:"",path:"",query:"",protocol:""};let r=e,n=e.indexOf("//");t.protocol=r.substring(0,n),n+=2;const o=e.indexOf("/",n),i=e.indexOf("?"),a=e.indexOf("#");-1!==a&&(r=r.substring(0,a));if(-1!==i){const e=r.substring(i);t.query=e,r=r.substring(0,i)}if(-1!==o){const e=r.substring(0,o);t.host=e,r=r.substring(o),t.path=r}else t.host=r;return t}(e),n=function(e){const t={href:e,hash:"",query:"",netPath:!1,absolutePath:!1,relativePath:!1};if(W.test(e))return t.netPath=!0,t;"/"===e[0]?t.absolutePath=!0:""!==e&&(t.relativePath=!0);let r=e;const n=e.indexOf("?"),o=e.indexOf("#");if(-1!==o){const e=r.substring(o);t.hash=e,r=r.substring(0,o)}if(-1!==n){const e=r.substring(n);t.query=e,r=r.substring(0,n)}return t.path=r,t}(t);if(!r.protocol&&!n.netPath)throw new Error("Error, protocol is not specified");if(n.netPath)return n.href.startsWith("//")&&(n.href=r.protocol+n.href),function(e){const t=e.indexOf("//")+2,r=!e.includes("/",t),n=!e.includes("?",t),o=!e.includes("#",t);return r&&n&&o}(n.href)?q(n.href):n.href;if(n.absolutePath){const{path:e,query:t,hash:o}=n;return r.host+z(e)+t+o}if(n.relativePath){const{path:e,query:t,hash:o}=n;let i,a=r.path,s=r.host;return 0===e.length?i=a:(a=a.substring(0,a.lastIndexOf("/")),i=z(a+"/"+e)),s+=""!==i||t||o?i+t+o:"/",s}{const{host:e,path:t,query:o}=r;return t||o?e+t+o+n.hash:q(e)}};function q(e){return e+("/"===e[e.length-1]?"":"/")}function z(e){let t=e.split("/");""===t[0]&&(t=t.slice(1));let r=[];return t.forEach((e,n)=>{"."!==e&&(".."===e?r.pop():""===e&&n!==t.length-1||r.push(e))}),"/"+r.join("/")}const W=new RegExp("^([a-z][a-z0-9+.-]*:)?//","i");var _=fetch;const{isObject:B,splitUrl:D}=v,F=Symbol("$__jref"),M={},Z={},N=(e,t)=>{const r=e in Z?Z[e]:e;if(r in M)return M[r][t]},J={},G={},H=(e,t="",r="")=>{e=JSON.parse(JSON.stringify(e));const n=D(e.$schema||r)[0];if(!n)throw Error("Couldn't determine schema version");delete e.$schema;const o=N(n,"idToken"),i=D(t)[0],a=ee(i,e[o]||""),s=D(a)[0];if(!s)throw Error("Couldn't determine an identifier for the schema");i&&(G[i]=s);const c=!!e.$recursiveAnchor;let u;delete e.$recursiveAnchor,N(n,"vocabulary")&&B(e)&&"$vocabulary"in e?(Z[s]=n,u=e.$vocabulary,delete e.$vocabulary):u=s===n?{[n]:!0}:{};const l={};J[s]={id:s,schemaVersion:n,schema:Q(e,s,n,y.nil,l),anchors:l,recursiveAnchor:c,vocabulary:u,validated:!1}},Q=(e,t,r,n,o)=>{if(B(e)){const i=N(r,"idToken"),a=N(r,"anchorToken");if("string"==typeof e[i]){const n=e[i],o=ee(t,n),[s,c]=D(o);if(delete e[i],c&&(e[a]=a!==i?encodeURI(c):"#"+encodeURI(c)),s!==t)return H(e,ee(t,s),r),{[F]:n}}if("string"==typeof e[a]){const t=a!==i?e[a]:e[a].slice(1);o[t]=n,delete e[a]}return Object.entries(e).reduce((e,[i,a])=>(e[i]=Q(a,t,r,y.append(i,n),o),e),{})}return Array.isArray(e)?e.map((e,i)=>Q(e,t,r,y.append(i,n),o)):e},X=Object.freeze({id:"",schemaVersion:void 0,pointer:"",schema:void 0,recursiveAnchor:!1}),Y=async(e,t=X,r=!1)=>{const n=r&&t.recursiveAnchor?t.recursiveAnchor:ne(t),o=ee(n,e),[i,a]=D(o);if(!(e=>e in J||e in G)(i)){const e=await _(i,{headers:{Accept:"application/schema+json"}});if(e.status>=400)throw await e.text(),Error("Failed to retrieve schema with id: "+i);if(e.headers.has("content-type")){const t=C.parse(e.headers.get("content-type")).type;if("application/schema+json"!==t)throw Error(`${i} is not a schema. Found a document with media type: ${t}`)}H(await e.json(),i)}const s=(e=>J[G[e]]||J[e])(i),c=Object.freeze({id:s.id,schemaVersion:s.schemaVersion,vocabulary:s.vocabulary,pointer:a&&"/"!==a[0]?re(s,a):a,schema:s.schema,recursiveAnchor:t.recursiveAnchor||!!s.recursiveAnchor&&i,validated:s.validated}),u=oe(c);return B(u)&&F in u?Y(u[F],c):N(c.schemaVersion,"jsonReference")&&B(u)&&"string"==typeof u.$ref?Y(u.$ref,c):N(c.schemaVersion,"keywordReference")&&"string"==typeof u&&c.pointer.endsWith("/$ref")?Y(u,c):N(c.schemaVersion,"keywordRecursiveReference")&&"string"==typeof u&&c.pointer.endsWith("/$recursiveRef")?Y(u,c,!0):c},ee=(e,t)=>{const r=U(e,t),n=D(e)[0];if(n&&"file"===te(r)&&"file"!==te(n))throw Error(`Can't access file '${r}' resource from network context '${e}'`);return r},te=e=>{const t=e.match(/^(.+):\/\//);return t?t[1]:""},re=(e,t)=>{if(!(t in e.anchors))throw Error(`No such anchor '${encodeURI(e.id)}#${encodeURI(t)}'`);return e.anchors[t]},ne=e=>`${e.id}#${encodeURI(e.pointer)}`,oe=e=>y.get(e.pointer,e.schema),ie=(e,t)=>{const r=y.append(e,t.pointer);return Y("#"+encodeURI(r),t)},ae=n((e,t)=>oe(t).map(async(r,n)=>e(await ie(n,t),n)));var se={setConfig:(e,t,r)=>{M[e]||(M[e]={}),M[e][t]=r},getConfig:N,add:H,get:Y,markValidated:e=>{J[e].validated=!0},uri:ne,value:oe,has:(e,t)=>e in oe(t),step:ie,entries:e=>Object.keys(oe(e)).map(t=>[t,ie(t,e)]),map:ae};const ce="FLAG",ue="BASIC",le="DETAILED",fe="VERBOSE";let de=le,pe=!0;const he=(e,t)=>(n,o=ce)=>{if(![ce,ue,le,fe].includes(o))throw Error(`The '${o}' error format is not supported`);let i=[];const a=r.subscribe("result",ye(o,i));return Pe(t,n,e),r.unsubscribe(a),i[0]},ye=(e,t)=>{const r=[];return(n,o)=>{const i={...o,errors:[]};for(;r.length>0&&ve(r[r.length-1],i);){const t=r.pop();let n=[];if(e===ue&&(n=t.errors,delete t.errors),i.errors.unshift(t,...n),be(i))break}(e===fe||e!==ce&&!i.valid)&&r.push(i),t[0]=i}},ve=(e,t)=>e.instanceLocation.startsWith(t.instanceLocation)&&(e.absoluteKeywordLocation.startsWith(t.absoluteKeywordLocation)||be(e)),be=e=>e.keyword.endsWith("#$ref")||e.keyword.endsWith("#$recursiveRef"),me={},we=e=>me[e],ge=e=>e in me,Oe={},Ee={},$e=async(e,t)=>{if(!ge(e.schemaVersion+"#validate")){const t=await se.get(e.schemaVersion);(se.getConfig(t.id,"mandatoryVocabularies")||[]).forEach(e=>{if(!t.vocabulary[e])throw Error(`Vocabulary '${e}' must be explicitly declared and required`)}),Object.entries(t.vocabulary).forEach(([e,r])=>{if(e in Oe)Object.entries(Oe[e]).forEach(([e,r])=>{((e,t)=>{me[e]={collectEvaluatedItems:(e,r,n)=>t.interpret(e,r,n)&&0,collectEvaluatedProperties:(e,r,n)=>t.interpret(e,r,n)&&[],...t}})(`${t.id}#${e}`,r)});else if(r)throw Error("Missing required vocabulary: "+e)})}if(pe&&!e.validated){if(se.markValidated(e.id),!(e.schemaVersion in Ee)){const t=await se.get(e.schemaVersion),r={},n=await $e(t,r);Ee[t.id]=he(r,n)}const t=A.cons(e.schema,e.id),r=Ee[e.schemaVersion](t,de);if(!r.valid)throw r}return await we(e.schemaVersion+"#validate").compile(e,t),se.uri(e)},Pe=(e,t,r)=>{const[n]=r[e];return we(n).interpret(e,t,r)};var je={validate:async(e,t,r)=>{const n={},o=await $e(e,n),i=(e,t=ce)=>he(n,o)(A.cons(e),t);return void 0===t?i:i(t,r)},setMetaOutputFormat:e=>{de=e},setShouldMetaValidate:e=>{pe=e},FLAG:ce,BASIC:ue,DETAILED:le,VERBOSE:fe,getKeyword:we,hasKeyword:ge,defineVocabulary:(e,t)=>{Oe[e]=t},compileSchema:$e,interpretSchema:Pe,collectEvaluatedProperties:(e,t,r,n)=>{const[o]=r[e];return we(o).collectEvaluatedProperties(e,t,r,n)},collectEvaluatedItems:(e,t,r,n)=>{const[o]=r[e];return we(o).collectEvaluatedItems(e,t,r,n)}};var xe={compile:()=>{},interpret:()=>!0},Ae=async e=>Object.entries(await e),Se=n(async(e,t)=>(await t).map(e)),Ie=n(async(e,t,r)=>(await r).reduce(async(t,r)=>e(await t,r),t)),Ve=n(async(e,t,r={})=>Ie(async(t,r)=>await e(r)?t.concat([r]):t,[],t,r)),Te=n(async(e,t)=>{const r=await Se(e,t);return(await Promise.all(r)).some(e=>e)}),ke=n(async(e,t)=>{const r=await Se(e,t);return(await Promise.all(r)).every(e=>e)}),Re=n((e,t)=>e.reduce(async(e,t)=>t(await e),t)),Ke={entries:Ae,map:Se,filter:Ve,reduce:Ie,some:Te,every:ke,pipeline:Re,all:e=>Promise.all(e),allValues:e=>Re([Ae,Ie(async(e,[t,r])=>(e[t]=await r,e),{})],e)};var Le={compile:async(e,t)=>{const r=se.uri(e);if(!(r in t)){t[r]=!1;const n=se.value(e);t[r]=[e.schemaVersion+"#validate",se.uri(e),"boolean"==typeof n?n:await Ke.pipeline([se.entries,Ke.map(([t,r])=>[`${e.schemaVersion}#${t}`,r]),Ke.filter(([t])=>je.hasKeyword(t)&&t!==e.schemaVersion+"#validate"),Ke.map(async([r,n])=>{const o=await n,i=await je.getKeyword(r).compile(o,t,e);return[r,se.uri(o),i]}),Ke.all],e)]}},interpret:(e,t,n)=>{const[o,i,a]=n[e],s="boolean"==typeof a?a:a.every(([e,o,i])=>{const a=je.getKeyword(e).interpret(i,t,n);return r.publishSync("result",{keyword:e,absoluteKeywordLocation:o,instanceLocation:A.uri(t),valid:a}),a});return r.publishSync("result",{keyword:o,absoluteKeywordLocation:i,instanceLocation:A.uri(t),valid:s}),s},collectEvaluatedProperties:(e,t,r,n=!1)=>{const o=r[e][2];return"boolean"==typeof o?!!o&&[]:o.filter(([e])=>!n||!e.endsWith("#unevaluatedProperties")).reduce((e,[n,,o])=>{const i=e&&je.getKeyword(n).collectEvaluatedProperties(o,t,r);return i&&e.concat(i)},[])},collectEvaluatedItems:(e,t,r,n=!1)=>{const o=r[e][2];return"boolean"==typeof o?!!o&&[]:o.filter(([e])=>!n||!e.endsWith("#unevaluatedItems")).reduce((e,[n,,o])=>{const i=!1!==e&&je.getKeyword(n).collectEvaluatedItems(o,t,r);return!1!==i&&Math.max(e,i)},0)}},Ce={Core:je,Schema:se,Instance:A,Keywords:{metaData:xe,validate:Le}},Ue=Ce.Core,qe=Ce.Schema,ze=Ce.Instance,We=Ce.Keywords;e.Core=Ue,e.Instance=ze,e.Keywords=We,e.Schema=qe,e.default=Ce,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
*/function K(e){var t=String(e);if(V.test(t))return t;if(t.length>0&&!I.test(t))throw new TypeError("invalid parameter value");return'"'+t.replace(k,"\\$1")+'"'}function L(e){this.parameters=Object.create(null),this.type=e}var C={format:function(e){if(!e||"object"!=typeof e)throw new TypeError("argument obj is required");var t=e.parameters,r=e.type;if(!r||!R.test(r))throw new TypeError("invalid type");var n=r;if(t&&"object"==typeof t)for(var o,i=Object.keys(t).sort(),a=0;a<i.length;a++){if(o=i[a],!V.test(o))throw new TypeError("invalid parameter name");n+="; "+o+"="+K(t[o])}return n},parse:function(e){if(!e)throw new TypeError("argument string is required");var t="object"==typeof e?function(e){var t;"function"==typeof e.getHeader?t=e.getHeader("content-type"):"object"==typeof e.headers&&(t=e.headers&&e.headers["content-type"]);if("string"!=typeof t)throw new TypeError("content-type header is missing from object");return t}(e):e;if("string"!=typeof t)throw new TypeError("argument string is required to be a string");var r=t.indexOf(";"),n=-1!==r?t.substr(0,r).trim():t.trim();if(!R.test(n))throw new TypeError("invalid media type");var o=new L(n.toLowerCase());if(-1!==r){var i,a,s;for(S.lastIndex=r;a=S.exec(t);){if(a.index!==r)throw new TypeError("invalid parameter format");r+=a[0].length,i=a[1].toLowerCase(),'"'===(s=a[2])[0]&&(s=s.substr(1,s.length-2).replace(T,"$1")),o.parameters[i]=s}if(r!==t.length)throw new TypeError("invalid parameter format")}return o}},U=function(e,t){if(e=e.trim(),(t=t.trim()).startsWith("about:"))return t;const r=function(e){const t={host:"",path:"",query:"",protocol:""};let r=e,n=e.indexOf("//");t.protocol=r.substring(0,n),n+=2;const o=e.indexOf("/",n),i=e.indexOf("?"),a=e.indexOf("#");-1!==a&&(r=r.substring(0,a));if(-1!==i){const e=r.substring(i);t.query=e,r=r.substring(0,i)}if(-1!==o){const e=r.substring(0,o);t.host=e,r=r.substring(o),t.path=r}else t.host=r;return t}(e),n=function(e){const t={href:e,hash:"",query:"",netPath:!1,absolutePath:!1,relativePath:!1};if(W.test(e))return t.netPath=!0,t;"/"===e[0]?t.absolutePath=!0:""!==e&&(t.relativePath=!0);let r=e;const n=e.indexOf("?"),o=e.indexOf("#");if(-1!==o){const e=r.substring(o);t.hash=e,r=r.substring(0,o)}if(-1!==n){const e=r.substring(n);t.query=e,r=r.substring(0,n)}return t.path=r,t}(t);if(!r.protocol&&!n.netPath)throw new Error("Error, protocol is not specified");if(n.netPath)return n.href.startsWith("//")&&(n.href=r.protocol+n.href),function(e){const t=e.indexOf("//")+2,r=!e.includes("/",t),n=!e.includes("?",t),o=!e.includes("#",t);return r&&n&&o}(n.href)?q(n.href):n.href;if(n.absolutePath){const{path:e,query:t,hash:o}=n;return r.host+z(e)+t+o}if(n.relativePath){const{path:e,query:t,hash:o}=n;let i,a=r.path,s=r.host;return 0===e.length?i=a:(a=a.substring(0,a.lastIndexOf("/")),i=z(a+"/"+e)),s+=""!==i||t||o?i+t+o:"/",s}{const{host:e,path:t,query:o}=r;return t||o?e+t+o+n.hash:q(e)}};function q(e){return e+("/"===e[e.length-1]?"":"/")}function z(e){let t=e.split("/");""===t[0]&&(t=t.slice(1));let r=[];return t.forEach((e,n)=>{"."!==e&&(".."===e?r.pop():""===e&&n!==t.length-1||r.push(e))}),"/"+r.join("/")}const W=new RegExp("^([a-z][a-z0-9+.-]*:)?//","i");var _=fetch;const{isObject:B,splitUrl:D}=v,F=Symbol("$__jref"),M={},Z={},N=(e,t)=>{const r=e in Z?Z[e]:e;if(r in M)return M[r][t]},J={},G={},H=(e,t="",r="")=>{e=JSON.parse(JSON.stringify(e));const n=D(e.$schema||r)[0];if(!n)throw Error("Couldn't determine schema version");delete e.$schema;const o=N(n,"idToken"),i=D(t)[0],a=ee(i,e[o]||""),s=D(a)[0];if(!s)throw Error("Couldn't determine an identifier for the schema");i&&(G[i]=s);const c=!!e.$recursiveAnchor;let u;delete e.$recursiveAnchor,N(n,"vocabulary")&&B(e)&&"$vocabulary"in e?(Z[s]=n,u=e.$vocabulary,delete e.$vocabulary):u=s===n?{[n]:!0}:{};const l={};J[s]={id:s,schemaVersion:n,schema:Q(e,s,n,y.nil,l),anchors:l,recursiveAnchor:c,vocabulary:u,validated:!1}},Q=(e,t,r,n,o)=>{if(B(e)){const i=N(r,"idToken"),a=N(r,"anchorToken");if("string"==typeof e[i]){const n=e[i],o=ee(t,n),[s,c]=D(o);if(delete e[i],c&&(e[a]=a!==i?encodeURI(c):"#"+encodeURI(c)),s!==t)return H(e,ee(t,s),r),{[F]:n}}if("string"==typeof e[a]){const t=a!==i?e[a]:e[a].slice(1);o[t]=n,delete e[a]}return Object.entries(e).reduce((e,[i,a])=>(e[i]=Q(a,t,r,y.append(i,n),o),e),{})}return Array.isArray(e)?e.map((e,i)=>Q(e,t,r,y.append(i,n),o)):e},X=Object.freeze({id:"",schemaVersion:void 0,pointer:"",schema:void 0,recursiveAnchor:!1}),Y=async(e,t=X,r=!1)=>{const n=r&&t.recursiveAnchor?t.recursiveAnchor:ne(t),o=ee(n,e),[i,a]=D(o);if(!(e=>e in J||e in G)(i)){const e=await _(i,{headers:{Accept:"application/schema+json"}});if(e.status>=400)throw await e.text(),Error("Failed to retrieve schema with id: "+i);if(e.headers.has("content-type")){const t=C.parse(e.headers.get("content-type")).type;if("application/schema+json"!==t)throw Error(`${i} is not a schema. Found a document with media type: ${t}`)}H(await e.json(),i)}const s=(e=>J[G[e]]||J[e])(i),c=Object.freeze({id:s.id,schemaVersion:s.schemaVersion,vocabulary:s.vocabulary,pointer:a&&"/"!==a[0]?re(s,a):a,schema:s.schema,recursiveAnchor:t.recursiveAnchor||!!s.recursiveAnchor&&i,validated:s.validated}),u=oe(c);return B(u)&&F in u?Y(u[F],c):N(c.schemaVersion,"jsonReference")&&B(u)&&"string"==typeof u.$ref?Y(u.$ref,c):N(c.schemaVersion,"keywordReference")&&"string"==typeof u&&c.pointer.endsWith("/$ref")?Y(u,c):N(c.schemaVersion,"keywordRecursiveReference")&&"string"==typeof u&&c.pointer.endsWith("/$recursiveRef")?Y(u,c,!0):c},ee=(e,t)=>{const r=U(e,t),n=D(e)[0];if(n&&"file"===te(r)&&"file"!==te(n))throw Error(`Can't access file '${r}' resource from network context '${e}'`);return r},te=e=>{const t=e.match(/^(.+):\/\//);return t?t[1]:""},re=(e,t)=>{if(!(t in e.anchors))throw Error(`No such anchor '${encodeURI(e.id)}#${encodeURI(t)}'`);return e.anchors[t]},ne=e=>`${e.id}#${encodeURI(e.pointer)}`,oe=e=>y.get(e.pointer,e.schema),ie=(e,t)=>{const r=y.append(e,t.pointer);return Y("#"+encodeURI(r),t)},ae=n((e,t)=>oe(t).map(async(r,n)=>e(await ie(n,t),n)));var se={setConfig:(e,t,r)=>{M[e]||(M[e]={}),M[e][t]=r},getConfig:N,add:H,get:Y,markValidated:e=>{J[e].validated=!0},uri:ne,value:oe,has:(e,t)=>e in oe(t),step:ie,entries:e=>Object.keys(oe(e)).map(async t=>[t,await ie(t,e)]),map:ae};const ce="FLAG",ue="BASIC",le="DETAILED",fe="VERBOSE";let de=le,pe=!0;const he=(e,t)=>(n,o=ce)=>{if(![ce,ue,le,fe].includes(o))throw Error(`The '${o}' error format is not supported`);let i=[];const a=r.subscribe("result",ye(o,i));return Pe(t,n,e),r.unsubscribe(a),i[0]},ye=(e,t)=>{const r=[];return(n,o)=>{const i={...o,errors:[]};for(;r.length>0&&ve(r[r.length-1],i);){const t=r.pop();let n=[];if(e===ue&&(n=t.errors,delete t.errors),i.errors.unshift(t,...n),be(i))break}(e===fe||e!==ce&&!i.valid)&&r.push(i),t[0]=i}},ve=(e,t)=>e.instanceLocation.startsWith(t.instanceLocation)&&(e.absoluteKeywordLocation.startsWith(t.absoluteKeywordLocation)||be(e)),be=e=>e.keyword.endsWith("#$ref")||e.keyword.endsWith("#$recursiveRef"),we={},me=e=>we[e],ge=e=>e in we,Oe={},Ee={},$e=async(e,t)=>{if(!ge(e.schemaVersion+"#validate")){const t=await se.get(e.schemaVersion);(se.getConfig(t.id,"mandatoryVocabularies")||[]).forEach(e=>{if(!t.vocabulary[e])throw Error(`Vocabulary '${e}' must be explicitly declared and required`)}),Object.entries(t.vocabulary).forEach(([e,r])=>{if(e in Oe)Object.entries(Oe[e]).forEach(([e,r])=>{((e,t)=>{we[e]={collectEvaluatedItems:(e,r,n)=>t.interpret(e,r,n)&&0,collectEvaluatedProperties:(e,r,n)=>t.interpret(e,r,n)&&[],...t}})(`${t.id}#${e}`,r)});else if(r)throw Error("Missing required vocabulary: "+e)})}if(pe&&!e.validated){if(se.markValidated(e.id),!(e.schemaVersion in Ee)){const t=await se.get(e.schemaVersion),r={},n=await $e(t,r);Ee[t.id]=he(r,n)}const t=A.cons(e.schema,e.id),r=Ee[e.schemaVersion](t,de);if(!r.valid)throw r}return await me(e.schemaVersion+"#validate").compile(e,t),se.uri(e)},Pe=(e,t,r)=>{const[n]=r[e];return me(n).interpret(e,t,r)};var je={validate:async(e,t,r)=>{const n={},o=await $e(e,n),i=(e,t=ce)=>he(n,o)(A.cons(e),t);return void 0===t?i:i(t,r)},setMetaOutputFormat:e=>{de=e},setShouldMetaValidate:e=>{pe=e},FLAG:ce,BASIC:ue,DETAILED:le,VERBOSE:fe,getKeyword:me,hasKeyword:ge,defineVocabulary:(e,t)=>{Oe[e]=t},compileSchema:$e,interpretSchema:Pe,collectEvaluatedProperties:(e,t,r,n)=>{const[o]=r[e];return me(o).collectEvaluatedProperties(e,t,r,n)},collectEvaluatedItems:(e,t,r,n)=>{const[o]=r[e];return me(o).collectEvaluatedItems(e,t,r,n)}};var xe={compile:()=>{},interpret:()=>!0},Ae=async e=>Object.entries(await e),Se=n(async(e,t)=>(await t).map(e)),Ie=n(async(e,t,r)=>(await r).reduce(async(t,r)=>{let n;try{n=await t}catch(e){try{await r}catch(e){}return t}return e(n,r)},t)),Ve=n(async(e,t,r={})=>Ie(async(t,r)=>await e(r)?t.concat([r]):t,[],t,r)),Te=n(async(e,t)=>{const r=await Se(e,t);return(await Promise.all(r)).some(e=>e)}),ke=n(async(e,t)=>{const r=await Se(e,t);return(await Promise.all(r)).every(e=>e)}),Re=n((e,t)=>e.reduce(async(e,t)=>t(await e),t)),Ke={entries:Ae,map:Se,filter:Ve,reduce:Ie,some:Te,every:ke,pipeline:Re,all:e=>Promise.all(e),allValues:e=>Re([Ae,Ie(async(e,[t,r])=>(e[t]=await r,e),{})],e)};var Le={compile:async(e,t)=>{const r=se.uri(e);if(!(r in t)){t[r]=!1;const n=se.value(e);t[r]=[e.schemaVersion+"#validate",se.uri(e),"boolean"==typeof n?n:await Ke.pipeline([se.entries,Ke.map(async t=>{const[r,n]=await t;return[`${e.schemaVersion}#${r}`,n]}),Ke.filter(async t=>{const[r]=await t;return je.hasKeyword(r)&&r!==e.schemaVersion+"#validate"}),Ke.map(async r=>{const[n,o]=await r,i=await o,a=await je.getKeyword(n).compile(i,t,e);return[n,se.uri(i),a]}),Ke.all],e)]}},interpret:(e,t,n)=>{const[o,i,a]=n[e],s="boolean"==typeof a?a:a.every(([e,o,i])=>{const a=je.getKeyword(e).interpret(i,t,n);return r.publishSync("result",{keyword:e,absoluteKeywordLocation:o,instanceLocation:A.uri(t),valid:a}),a});return r.publishSync("result",{keyword:o,absoluteKeywordLocation:i,instanceLocation:A.uri(t),valid:s}),s},collectEvaluatedProperties:(e,t,r,n=!1)=>{const o=r[e][2];return"boolean"==typeof o?!!o&&[]:o.filter(([e])=>!n||!e.endsWith("#unevaluatedProperties")).reduce((e,[n,,o])=>{const i=e&&je.getKeyword(n).collectEvaluatedProperties(o,t,r);return i&&e.concat(i)},[])},collectEvaluatedItems:(e,t,r,n=!1)=>{const o=r[e][2];return"boolean"==typeof o?!!o&&[]:o.filter(([e])=>!n||!e.endsWith("#unevaluatedItems")).reduce((e,[n,,o])=>{const i=!1!==e&&je.getKeyword(n).collectEvaluatedItems(o,t,r);return!1!==i&&Math.max(e,i)},0)}},Ce={Core:je,Schema:se,Instance:A,Keywords:{metaData:xe,validate:Le}},Ue=Ce.Core,qe=Ce.Schema,ze=Ce.Instance,We=Ce.Keywords;e.Core=Ue,e.Instance=ze,e.Keywords=We,e.Schema=qe,e.default=Ce,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
//# sourceMappingURL=json-schema-core-amd.min.js.map |
@@ -1217,3 +1217,3 @@ 'use strict'; | ||
const entries$1 = (doc) => Object.keys(value$1(doc)) | ||
.map((key) => [key, step$1(key, doc)]); | ||
.map(async (key) => [key, await step$1(key, doc)]); | ||
@@ -1397,3 +1397,18 @@ const map$1 = justCurryIt((fn, doc) => value$1(doc) | ||
var reduce$1 = justCurryIt(async (fn, acc, doc) => { | ||
return (await doc).reduce(async (acc, item) => fn(await acc, item), acc); | ||
return (await doc).reduce(async (acc, item) => { | ||
let resolvedAcc; | ||
try { | ||
resolvedAcc = await acc; | ||
} catch (e) { | ||
try { | ||
await item; | ||
} catch (e) { | ||
// If we've already encountered an error, ignore subsequent errors. | ||
} | ||
return acc; | ||
} | ||
return fn(resolvedAcc, item); | ||
}, acc); | ||
}); | ||
@@ -1457,8 +1472,13 @@ | ||
schema.entries, | ||
lib.map(([keyword, keywordSchema]) => { | ||
lib.map(async (entry) => { | ||
const [keyword, keywordSchema] = await entry; | ||
const keywordId = `${schema$1.schemaVersion}#${keyword}`; | ||
return [keywordId, keywordSchema]; | ||
}), | ||
lib.filter(([keywordId]) => core.hasKeyword(keywordId) && keywordId !== `${schema$1.schemaVersion}#validate`), | ||
lib.map(async ([keywordId, keywordSchemaPromise]) => { | ||
lib.filter(async (entry) => { | ||
const [keywordId] = await entry; | ||
return core.hasKeyword(keywordId) && keywordId !== `${schema$1.schemaVersion}#validate`; | ||
}), | ||
lib.map(async (entry) => { | ||
const [keywordId, keywordSchemaPromise] = await entry; | ||
const keywordSchema = await keywordSchemaPromise; | ||
@@ -1465,0 +1485,0 @@ const keywordAst = await core.getKeyword(keywordId).compile(keywordSchema, ast, schema$1); |
@@ -1,2 +0,2 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var t=function(e,t){return e(t={exports:{}},t.exports),t.exports}((function(t,r){!function(e,n){var o={};e.PubSub=o;var i=e.define;!function(e){var t={},r=-1;function n(e){var t;for(t in e)if(e.hasOwnProperty(t))return!0;return!1}function o(e,t,r){try{e(t,r)}catch(e){setTimeout(function(e){return function(){throw e}}(e),0)}}function i(e,t,r){e(t,r)}function a(e,r,n,a){var s,c=t[r],u=a?i:o;if(t.hasOwnProperty(r))for(s in c)c.hasOwnProperty(s)&&u(c[s],e,n)}function s(e,r,o,i){var s=function(e,t,r){return function(){var n=String(e),o=n.lastIndexOf(".");for(a(e,e,t,r);-1!==o;)o=(n=n.substr(0,o)).lastIndexOf("."),a(e,n,t,r)}}(e="symbol"==typeof e?e.toString():e,r,i);return!!function(e){for(var r=String(e),o=Boolean(t.hasOwnProperty(r)&&n(t[r])),i=r.lastIndexOf(".");!o&&-1!==i;)i=(r=r.substr(0,i)).lastIndexOf("."),o=Boolean(t.hasOwnProperty(r)&&n(t[r]));return o}(e)&&(!0===o?s():setTimeout(s,0),!0)}e.publish=function(t,r){return s(t,r,!1,e.immediateExceptions)},e.publishSync=function(t,r){return s(t,r,!0,e.immediateExceptions)},e.subscribe=function(e,n){if("function"!=typeof n)return!1;e="symbol"==typeof e?e.toString():e,t.hasOwnProperty(e)||(t[e]={});var o="uid_"+String(++r);return t[e][o]=n,o},e.subscribeOnce=function(t,r){var n=e.subscribe(t,(function(){e.unsubscribe(n),r.apply(this,arguments)}));return e},e.clearAllSubscriptions=function(){t={}},e.clearSubscriptions=function(e){var r;for(r in t)t.hasOwnProperty(r)&&0===r.indexOf(e)&&delete t[r]},e.countSubscriptions=function(e){var r,n=0;for(r in t)t.hasOwnProperty(r)&&0===r.indexOf(e)&&n++;return n},e.getSubscriptions=function(e){var r,n=[];for(r in t)t.hasOwnProperty(r)&&0===r.indexOf(e)&&n.push(r);return n},e.unsubscribe=function(r){var n,o,i,a="string"==typeof r&&(t.hasOwnProperty(r)||function(e){var r;for(r in t)if(t.hasOwnProperty(r)&&0===r.indexOf(e))return!0;return!1}(r)),s=!a&&"string"==typeof r,c="function"==typeof r,u=!1;if(!a){for(n in t)if(t.hasOwnProperty(n)){if(o=t[n],s&&o[r]){delete o[r],u=r;break}if(c)for(i in o)o.hasOwnProperty(i)&&o[i]===r&&(delete o[i],u=!0)}return u}e.clearSubscriptions(r)}}(o),"function"==typeof i&&i.amd?i((function(){return o})):(void 0!==t&&t.exports&&(r=t.exports=o),r.PubSub=o,t.exports=r=o)}("object"==typeof window&&window||e)})),r=(t.PubSub,function(e,t){return function r(){null==t&&(t=e.length);var n=[].slice.call(arguments);return n.length>=t?e.apply(this,n):function(){return r.apply(this,n.concat([].slice.call(arguments)))}}});const n=e=>{if(e.length>0&&"/"!==e[0])throw Error("Invalid JSON Pointer");return e.split("/").slice(1).map(l)},o=(e,t,r,n)=>{if(0===e.length)return r;if(e.length>1){const i=e.shift();return{...t,[i]:o(e,d(t,i,n),r,c(i,n))}}if(Array.isArray(t)){const n=[...t];return n[f(t,e[0])]=r,n}return"object"==typeof t&&null!==t?{...t,[e[0]]:r}:d(t,e[0],n)},i=(e,t,r,n)=>{if(0!==e.length)if(1!==e.length||p(t)){const o=e.shift();i(e,d(t,o,n),r,c(o,n))}else{t[f(t,e[0])]=r}},a=(e,t,r)=>{if(0!=e.length){if(e.length>1){const n=e.shift(),o=d(t,n,r);return{...t,[n]:a(e,o,c(n,r))}}if(Array.isArray(t))return t.filter((t,r)=>r!=e[0]);if("object"==typeof t&&null!==t){const{[e[0]]:r,...n}=t;return n}return d(t,e[0],r)}},s=(e,t,r)=>{if(0!==e.length)if(e.length>1){const n=e.shift(),o=d(t,n,r);s(e,o,c(n,r))}else Array.isArray(t)?t.splice(e[0],1):"object"==typeof t&&null!==t?delete t[e[0]]:d(t,e[0],r)},c=r((e,t)=>t+"/"+u(e)),u=e=>e.toString().replace(/~/g,"~0").replace(/\//g,"~1"),l=e=>e.toString().replace(/~1/g,"/").replace(/~0/g,"~"),f=(e,t)=>Array.isArray(e)&&"-"===t?e.length:t,d=(e,t,r="")=>{if(void 0===e)throw TypeError(`Value at '${r}' is undefined and does not have property '${t}'`);if(null===e)throw TypeError(`Value at '${r}' is null and does not have property '${t}'`);if(p(e))throw TypeError(`Value at '${r}' is a ${typeof e} and does not have property '${t}'`);return e[f(e,t)]},p=e=>null===e||"object"!=typeof e;var h={nil:"",append:c,get:(e,t)=>{const r=n(e),o=e=>r.reduce(([e,t],r)=>[d(e,r,t),c(r,t)],[e,""])[0];return void 0===t?o:o(t)},set:(e,t,i)=>{const a=n(e),s=r((e,t)=>o(a,e,t,""));return void 0===t?s:s(t,i)},assign:(e,t,o)=>{const a=n(e),s=r((e,t)=>i(a,e,t,""));return void 0===t?s:s(t,o)},unset:(e,t)=>{const r=n(e),o=e=>a(r,e,"");return void 0===t?o:o(t)},delete:(e,t)=>{const r=n(e),o=e=>s(r,e,"");return void 0===t?o:o(t)}};var y={isObject:e=>"object"==typeof e&&!Array.isArray(e)&&null!==e,splitUrl:e=>{const t=e.indexOf("#"),r=-1===t?e.length:t,n=e.slice(0,r),o=e.slice(r+1);return[decodeURI(n),decodeURI(o)]}};const{splitUrl:v}=y,b=Object.freeze({id:"",pointer:"",instance:void 0}),m=(e,t=b)=>Object.freeze({...t,pointer:v(e)[1]}),w=e=>h.get(e.pointer,e.instance),g=(e,t)=>{const r=h.append(e,t.pointer);return m("#"+encodeURI(r),t)},O=r((e,t)=>w(t).map((r,n)=>e(g(n,t),n))),E=r((e,t)=>w(t).map((e,r)=>g(r,t)).filter((t,r)=>e(t,r))),$=r((e,t,r)=>w(r).reduce((t,n,o)=>e(t,g(o,r),o),t)),x=r((e,t)=>Object.keys(w(t)).every((r,n)=>e(g(r,t),n))),P=r((e,t)=>Object.keys(w(t)).some((r,n)=>e(g(r,t),n)));var j={cons:(e,t="")=>Object.freeze({...b,id:t,instance:e}),get:m,uri:e=>`${e.id}#${encodeURI(e.pointer)}`,value:w,step:g,entries:e=>Object.keys(w(e)).map(t=>[t,g(t,e)]),map:O,filter:E,reduce:$,every:x,some:P},A=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,S=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,I=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,V=/\\([\u000b\u0020-\u00ff])/g,T=/([\\"])/g,k=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var t=function(e,t){return e(t={exports:{}},t.exports),t.exports}((function(t,r){!function(e,n){var o={};e.PubSub=o;var i=e.define;!function(e){var t={},r=-1;function n(e){var t;for(t in e)if(e.hasOwnProperty(t))return!0;return!1}function o(e,t,r){try{e(t,r)}catch(e){setTimeout(function(e){return function(){throw e}}(e),0)}}function i(e,t,r){e(t,r)}function a(e,r,n,a){var s,c=t[r],u=a?i:o;if(t.hasOwnProperty(r))for(s in c)c.hasOwnProperty(s)&&u(c[s],e,n)}function s(e,r,o,i){var s=function(e,t,r){return function(){var n=String(e),o=n.lastIndexOf(".");for(a(e,e,t,r);-1!==o;)o=(n=n.substr(0,o)).lastIndexOf("."),a(e,n,t,r)}}(e="symbol"==typeof e?e.toString():e,r,i);return!!function(e){for(var r=String(e),o=Boolean(t.hasOwnProperty(r)&&n(t[r])),i=r.lastIndexOf(".");!o&&-1!==i;)i=(r=r.substr(0,i)).lastIndexOf("."),o=Boolean(t.hasOwnProperty(r)&&n(t[r]));return o}(e)&&(!0===o?s():setTimeout(s,0),!0)}e.publish=function(t,r){return s(t,r,!1,e.immediateExceptions)},e.publishSync=function(t,r){return s(t,r,!0,e.immediateExceptions)},e.subscribe=function(e,n){if("function"!=typeof n)return!1;e="symbol"==typeof e?e.toString():e,t.hasOwnProperty(e)||(t[e]={});var o="uid_"+String(++r);return t[e][o]=n,o},e.subscribeOnce=function(t,r){var n=e.subscribe(t,(function(){e.unsubscribe(n),r.apply(this,arguments)}));return e},e.clearAllSubscriptions=function(){t={}},e.clearSubscriptions=function(e){var r;for(r in t)t.hasOwnProperty(r)&&0===r.indexOf(e)&&delete t[r]},e.countSubscriptions=function(e){var r,n=0;for(r in t)t.hasOwnProperty(r)&&0===r.indexOf(e)&&n++;return n},e.getSubscriptions=function(e){var r,n=[];for(r in t)t.hasOwnProperty(r)&&0===r.indexOf(e)&&n.push(r);return n},e.unsubscribe=function(r){var n,o,i,a="string"==typeof r&&(t.hasOwnProperty(r)||function(e){var r;for(r in t)if(t.hasOwnProperty(r)&&0===r.indexOf(e))return!0;return!1}(r)),s=!a&&"string"==typeof r,c="function"==typeof r,u=!1;if(!a){for(n in t)if(t.hasOwnProperty(n)){if(o=t[n],s&&o[r]){delete o[r],u=r;break}if(c)for(i in o)o.hasOwnProperty(i)&&o[i]===r&&(delete o[i],u=!0)}return u}e.clearSubscriptions(r)}}(o),"function"==typeof i&&i.amd?i((function(){return o})):(void 0!==t&&t.exports&&(r=t.exports=o),r.PubSub=o,t.exports=r=o)}("object"==typeof window&&window||e)})),r=(t.PubSub,function(e,t){return function r(){null==t&&(t=e.length);var n=[].slice.call(arguments);return n.length>=t?e.apply(this,n):function(){return r.apply(this,n.concat([].slice.call(arguments)))}}});const n=e=>{if(e.length>0&&"/"!==e[0])throw Error("Invalid JSON Pointer");return e.split("/").slice(1).map(l)},o=(e,t,r,n)=>{if(0===e.length)return r;if(e.length>1){const i=e.shift();return{...t,[i]:o(e,d(t,i,n),r,c(i,n))}}if(Array.isArray(t)){const n=[...t];return n[f(t,e[0])]=r,n}return"object"==typeof t&&null!==t?{...t,[e[0]]:r}:d(t,e[0],n)},i=(e,t,r,n)=>{if(0!==e.length)if(1!==e.length||p(t)){const o=e.shift();i(e,d(t,o,n),r,c(o,n))}else{t[f(t,e[0])]=r}},a=(e,t,r)=>{if(0!=e.length){if(e.length>1){const n=e.shift(),o=d(t,n,r);return{...t,[n]:a(e,o,c(n,r))}}if(Array.isArray(t))return t.filter((t,r)=>r!=e[0]);if("object"==typeof t&&null!==t){const{[e[0]]:r,...n}=t;return n}return d(t,e[0],r)}},s=(e,t,r)=>{if(0!==e.length)if(e.length>1){const n=e.shift(),o=d(t,n,r);s(e,o,c(n,r))}else Array.isArray(t)?t.splice(e[0],1):"object"==typeof t&&null!==t?delete t[e[0]]:d(t,e[0],r)},c=r((e,t)=>t+"/"+u(e)),u=e=>e.toString().replace(/~/g,"~0").replace(/\//g,"~1"),l=e=>e.toString().replace(/~1/g,"/").replace(/~0/g,"~"),f=(e,t)=>Array.isArray(e)&&"-"===t?e.length:t,d=(e,t,r="")=>{if(void 0===e)throw TypeError(`Value at '${r}' is undefined and does not have property '${t}'`);if(null===e)throw TypeError(`Value at '${r}' is null and does not have property '${t}'`);if(p(e))throw TypeError(`Value at '${r}' is a ${typeof e} and does not have property '${t}'`);return e[f(e,t)]},p=e=>null===e||"object"!=typeof e;var h={nil:"",append:c,get:(e,t)=>{const r=n(e),o=e=>r.reduce(([e,t],r)=>[d(e,r,t),c(r,t)],[e,""])[0];return void 0===t?o:o(t)},set:(e,t,i)=>{const a=n(e),s=r((e,t)=>o(a,e,t,""));return void 0===t?s:s(t,i)},assign:(e,t,o)=>{const a=n(e),s=r((e,t)=>i(a,e,t,""));return void 0===t?s:s(t,o)},unset:(e,t)=>{const r=n(e),o=e=>a(r,e,"");return void 0===t?o:o(t)},delete:(e,t)=>{const r=n(e),o=e=>s(r,e,"");return void 0===t?o:o(t)}};var y={isObject:e=>"object"==typeof e&&!Array.isArray(e)&&null!==e,splitUrl:e=>{const t=e.indexOf("#"),r=-1===t?e.length:t,n=e.slice(0,r),o=e.slice(r+1);return[decodeURI(n),decodeURI(o)]}};const{splitUrl:v}=y,b=Object.freeze({id:"",pointer:"",instance:void 0}),w=(e,t=b)=>Object.freeze({...t,pointer:v(e)[1]}),m=e=>h.get(e.pointer,e.instance),g=(e,t)=>{const r=h.append(e,t.pointer);return w("#"+encodeURI(r),t)},O=r((e,t)=>m(t).map((r,n)=>e(g(n,t),n))),E=r((e,t)=>m(t).map((e,r)=>g(r,t)).filter((t,r)=>e(t,r))),$=r((e,t,r)=>m(r).reduce((t,n,o)=>e(t,g(o,r),o),t)),x=r((e,t)=>Object.keys(m(t)).every((r,n)=>e(g(r,t),n))),P=r((e,t)=>Object.keys(m(t)).some((r,n)=>e(g(r,t),n)));var j={cons:(e,t="")=>Object.freeze({...b,id:t,instance:e}),get:w,uri:e=>`${e.id}#${encodeURI(e.pointer)}`,value:m,step:g,entries:e=>Object.keys(m(e)).map(t=>[t,g(t,e)]),map:O,filter:E,reduce:$,every:x,some:P},A=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,S=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,I=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,V=/\\([\u000b\u0020-\u00ff])/g,T=/([\\"])/g,k=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/; | ||
/*! | ||
@@ -6,3 +6,3 @@ * content-type | ||
* MIT Licensed | ||
*/function R(e){var t=String(e);if(I.test(t))return t;if(t.length>0&&!S.test(t))throw new TypeError("invalid parameter value");return'"'+t.replace(T,"\\$1")+'"'}function K(e){this.parameters=Object.create(null),this.type=e}var L={format:function(e){if(!e||"object"!=typeof e)throw new TypeError("argument obj is required");var t=e.parameters,r=e.type;if(!r||!k.test(r))throw new TypeError("invalid type");var n=r;if(t&&"object"==typeof t)for(var o,i=Object.keys(t).sort(),a=0;a<i.length;a++){if(o=i[a],!I.test(o))throw new TypeError("invalid parameter name");n+="; "+o+"="+R(t[o])}return n},parse:function(e){if(!e)throw new TypeError("argument string is required");var t="object"==typeof e?function(e){var t;"function"==typeof e.getHeader?t=e.getHeader("content-type"):"object"==typeof e.headers&&(t=e.headers&&e.headers["content-type"]);if("string"!=typeof t)throw new TypeError("content-type header is missing from object");return t}(e):e;if("string"!=typeof t)throw new TypeError("argument string is required to be a string");var r=t.indexOf(";"),n=-1!==r?t.substr(0,r).trim():t.trim();if(!k.test(n))throw new TypeError("invalid media type");var o=new K(n.toLowerCase());if(-1!==r){var i,a,s;for(A.lastIndex=r;a=A.exec(t);){if(a.index!==r)throw new TypeError("invalid parameter format");r+=a[0].length,i=a[1].toLowerCase(),'"'===(s=a[2])[0]&&(s=s.substr(1,s.length-2).replace(V,"$1")),o.parameters[i]=s}if(r!==t.length)throw new TypeError("invalid parameter format")}return o}},C=function(e,t){if(e=e.trim(),(t=t.trim()).startsWith("about:"))return t;const r=function(e){const t={host:"",path:"",query:"",protocol:""};let r=e,n=e.indexOf("//");t.protocol=r.substring(0,n),n+=2;const o=e.indexOf("/",n),i=e.indexOf("?"),a=e.indexOf("#");-1!==a&&(r=r.substring(0,a));if(-1!==i){const e=r.substring(i);t.query=e,r=r.substring(0,i)}if(-1!==o){const e=r.substring(0,o);t.host=e,r=r.substring(o),t.path=r}else t.host=r;return t}(e),n=function(e){const t={href:e,hash:"",query:"",netPath:!1,absolutePath:!1,relativePath:!1};if(z.test(e))return t.netPath=!0,t;"/"===e[0]?t.absolutePath=!0:""!==e&&(t.relativePath=!0);let r=e;const n=e.indexOf("?"),o=e.indexOf("#");if(-1!==o){const e=r.substring(o);t.hash=e,r=r.substring(0,o)}if(-1!==n){const e=r.substring(n);t.query=e,r=r.substring(0,n)}return t.path=r,t}(t);if(!r.protocol&&!n.netPath)throw new Error("Error, protocol is not specified");if(n.netPath)return n.href.startsWith("//")&&(n.href=r.protocol+n.href),function(e){const t=e.indexOf("//")+2,r=!e.includes("/",t),n=!e.includes("?",t),o=!e.includes("#",t);return r&&n&&o}(n.href)?U(n.href):n.href;if(n.absolutePath){const{path:e,query:t,hash:o}=n;return r.host+q(e)+t+o}if(n.relativePath){const{path:e,query:t,hash:o}=n;let i,a=r.path,s=r.host;return 0===e.length?i=a:(a=a.substring(0,a.lastIndexOf("/")),i=q(a+"/"+e)),s+=""!==i||t||o?i+t+o:"/",s}{const{host:e,path:t,query:o}=r;return t||o?e+t+o+n.hash:U(e)}};function U(e){return e+("/"===e[e.length-1]?"":"/")}function q(e){let t=e.split("/");""===t[0]&&(t=t.slice(1));let r=[];return t.forEach((e,n)=>{"."!==e&&(".."===e?r.pop():""===e&&n!==t.length-1||r.push(e))}),"/"+r.join("/")}const z=new RegExp("^([a-z][a-z0-9+.-]*:)?//","i");var W=fetch;const{isObject:_,splitUrl:B}=y,D=Symbol("$__jref"),F={},M={},Z=(e,t)=>{const r=e in M?M[e]:e;if(r in F)return F[r][t]},N={},J={},G=(e,t="",r="")=>{e=JSON.parse(JSON.stringify(e));const n=B(e.$schema||r)[0];if(!n)throw Error("Couldn't determine schema version");delete e.$schema;const o=Z(n,"idToken"),i=B(t)[0],a=Y(i,e[o]||""),s=B(a)[0];if(!s)throw Error("Couldn't determine an identifier for the schema");i&&(J[i]=s);const c=!!e.$recursiveAnchor;let u;delete e.$recursiveAnchor,Z(n,"vocabulary")&&_(e)&&"$vocabulary"in e?(M[s]=n,u=e.$vocabulary,delete e.$vocabulary):u=s===n?{[n]:!0}:{};const l={};N[s]={id:s,schemaVersion:n,schema:H(e,s,n,h.nil,l),anchors:l,recursiveAnchor:c,vocabulary:u,validated:!1}},H=(e,t,r,n,o)=>{if(_(e)){const i=Z(r,"idToken"),a=Z(r,"anchorToken");if("string"==typeof e[i]){const n=e[i],o=Y(t,n),[s,c]=B(o);if(delete e[i],c&&(e[a]=a!==i?encodeURI(c):"#"+encodeURI(c)),s!==t)return G(e,Y(t,s),r),{[D]:n}}if("string"==typeof e[a]){const t=a!==i?e[a]:e[a].slice(1);o[t]=n,delete e[a]}return Object.entries(e).reduce((e,[i,a])=>(e[i]=H(a,t,r,h.append(i,n),o),e),{})}return Array.isArray(e)?e.map((e,i)=>H(e,t,r,h.append(i,n),o)):e},Q=Object.freeze({id:"",schemaVersion:void 0,pointer:"",schema:void 0,recursiveAnchor:!1}),X=async(e,t=Q,r=!1)=>{const n=r&&t.recursiveAnchor?t.recursiveAnchor:re(t),o=Y(n,e),[i,a]=B(o);if(!(e=>e in N||e in J)(i)){const e=await W(i,{headers:{Accept:"application/schema+json"}});if(e.status>=400)throw await e.text(),Error("Failed to retrieve schema with id: "+i);if(e.headers.has("content-type")){const t=L.parse(e.headers.get("content-type")).type;if("application/schema+json"!==t)throw Error(`${i} is not a schema. Found a document with media type: ${t}`)}G(await e.json(),i)}const s=(e=>N[J[e]]||N[e])(i),c=Object.freeze({id:s.id,schemaVersion:s.schemaVersion,vocabulary:s.vocabulary,pointer:a&&"/"!==a[0]?te(s,a):a,schema:s.schema,recursiveAnchor:t.recursiveAnchor||!!s.recursiveAnchor&&i,validated:s.validated}),u=ne(c);return _(u)&&D in u?X(u[D],c):Z(c.schemaVersion,"jsonReference")&&_(u)&&"string"==typeof u.$ref?X(u.$ref,c):Z(c.schemaVersion,"keywordReference")&&"string"==typeof u&&c.pointer.endsWith("/$ref")?X(u,c):Z(c.schemaVersion,"keywordRecursiveReference")&&"string"==typeof u&&c.pointer.endsWith("/$recursiveRef")?X(u,c,!0):c},Y=(e,t)=>{const r=C(e,t),n=B(e)[0];if(n&&"file"===ee(r)&&"file"!==ee(n))throw Error(`Can't access file '${r}' resource from network context '${e}'`);return r},ee=e=>{const t=e.match(/^(.+):\/\//);return t?t[1]:""},te=(e,t)=>{if(!(t in e.anchors))throw Error(`No such anchor '${encodeURI(e.id)}#${encodeURI(t)}'`);return e.anchors[t]},re=e=>`${e.id}#${encodeURI(e.pointer)}`,ne=e=>h.get(e.pointer,e.schema),oe=(e,t)=>{const r=h.append(e,t.pointer);return X("#"+encodeURI(r),t)},ie=r((e,t)=>ne(t).map(async(r,n)=>e(await oe(n,t),n)));var ae={setConfig:(e,t,r)=>{F[e]||(F[e]={}),F[e][t]=r},getConfig:Z,add:G,get:X,markValidated:e=>{N[e].validated=!0},uri:re,value:ne,has:(e,t)=>e in ne(t),step:oe,entries:e=>Object.keys(ne(e)).map(t=>[t,oe(t,e)]),map:ie};const se="FLAG",ce="BASIC",ue="DETAILED",le="VERBOSE";let fe=ue,de=!0;const pe=(e,r)=>(n,o=se)=>{if(![se,ce,ue,le].includes(o))throw Error(`The '${o}' error format is not supported`);let i=[];const a=t.subscribe("result",he(o,i));return $e(r,n,e),t.unsubscribe(a),i[0]},he=(e,t)=>{const r=[];return(n,o)=>{const i={...o,errors:[]};for(;r.length>0&&ye(r[r.length-1],i);){const t=r.pop();let n=[];if(e===ce&&(n=t.errors,delete t.errors),i.errors.unshift(t,...n),ve(i))break}(e===le||e!==se&&!i.valid)&&r.push(i),t[0]=i}},ye=(e,t)=>e.instanceLocation.startsWith(t.instanceLocation)&&(e.absoluteKeywordLocation.startsWith(t.absoluteKeywordLocation)||ve(e)),ve=e=>e.keyword.endsWith("#$ref")||e.keyword.endsWith("#$recursiveRef"),be={},me=e=>be[e],we=e=>e in be,ge={},Oe={},Ee=async(e,t)=>{if(!we(e.schemaVersion+"#validate")){const t=await ae.get(e.schemaVersion);(ae.getConfig(t.id,"mandatoryVocabularies")||[]).forEach(e=>{if(!t.vocabulary[e])throw Error(`Vocabulary '${e}' must be explicitly declared and required`)}),Object.entries(t.vocabulary).forEach(([e,r])=>{if(e in ge)Object.entries(ge[e]).forEach(([e,r])=>{((e,t)=>{be[e]={collectEvaluatedItems:(e,r,n)=>t.interpret(e,r,n)&&0,collectEvaluatedProperties:(e,r,n)=>t.interpret(e,r,n)&&[],...t}})(`${t.id}#${e}`,r)});else if(r)throw Error("Missing required vocabulary: "+e)})}if(de&&!e.validated){if(ae.markValidated(e.id),!(e.schemaVersion in Oe)){const t=await ae.get(e.schemaVersion),r={},n=await Ee(t,r);Oe[t.id]=pe(r,n)}const t=j.cons(e.schema,e.id),r=Oe[e.schemaVersion](t,fe);if(!r.valid)throw r}return await me(e.schemaVersion+"#validate").compile(e,t),ae.uri(e)},$e=(e,t,r)=>{const[n]=r[e];return me(n).interpret(e,t,r)};var xe={validate:async(e,t,r)=>{const n={},o=await Ee(e,n),i=(e,t=se)=>pe(n,o)(j.cons(e),t);return void 0===t?i:i(t,r)},setMetaOutputFormat:e=>{fe=e},setShouldMetaValidate:e=>{de=e},FLAG:se,BASIC:ce,DETAILED:ue,VERBOSE:le,getKeyword:me,hasKeyword:we,defineVocabulary:(e,t)=>{ge[e]=t},compileSchema:Ee,interpretSchema:$e,collectEvaluatedProperties:(e,t,r,n)=>{const[o]=r[e];return me(o).collectEvaluatedProperties(e,t,r,n)},collectEvaluatedItems:(e,t,r,n)=>{const[o]=r[e];return me(o).collectEvaluatedItems(e,t,r,n)}};var Pe={compile:()=>{},interpret:()=>!0},je=async e=>Object.entries(await e),Ae=r(async(e,t)=>(await t).map(e)),Se=r(async(e,t,r)=>(await r).reduce(async(t,r)=>e(await t,r),t)),Ie=r(async(e,t,r={})=>Se(async(t,r)=>await e(r)?t.concat([r]):t,[],t,r)),Ve=r(async(e,t)=>{const r=await Ae(e,t);return(await Promise.all(r)).some(e=>e)}),Te=r(async(e,t)=>{const r=await Ae(e,t);return(await Promise.all(r)).every(e=>e)}),ke=r((e,t)=>e.reduce(async(e,t)=>t(await e),t)),Re={entries:je,map:Ae,filter:Ie,reduce:Se,some:Ve,every:Te,pipeline:ke,all:e=>Promise.all(e),allValues:e=>ke([je,Se(async(e,[t,r])=>(e[t]=await r,e),{})],e)};var Ke={compile:async(e,t)=>{const r=ae.uri(e);if(!(r in t)){t[r]=!1;const n=ae.value(e);t[r]=[e.schemaVersion+"#validate",ae.uri(e),"boolean"==typeof n?n:await Re.pipeline([ae.entries,Re.map(([t,r])=>[`${e.schemaVersion}#${t}`,r]),Re.filter(([t])=>xe.hasKeyword(t)&&t!==e.schemaVersion+"#validate"),Re.map(async([r,n])=>{const o=await n,i=await xe.getKeyword(r).compile(o,t,e);return[r,ae.uri(o),i]}),Re.all],e)]}},interpret:(e,r,n)=>{const[o,i,a]=n[e],s="boolean"==typeof a?a:a.every(([e,o,i])=>{const a=xe.getKeyword(e).interpret(i,r,n);return t.publishSync("result",{keyword:e,absoluteKeywordLocation:o,instanceLocation:j.uri(r),valid:a}),a});return t.publishSync("result",{keyword:o,absoluteKeywordLocation:i,instanceLocation:j.uri(r),valid:s}),s},collectEvaluatedProperties:(e,t,r,n=!1)=>{const o=r[e][2];return"boolean"==typeof o?!!o&&[]:o.filter(([e])=>!n||!e.endsWith("#unevaluatedProperties")).reduce((e,[n,,o])=>{const i=e&&xe.getKeyword(n).collectEvaluatedProperties(o,t,r);return i&&e.concat(i)},[])},collectEvaluatedItems:(e,t,r,n=!1)=>{const o=r[e][2];return"boolean"==typeof o?!!o&&[]:o.filter(([e])=>!n||!e.endsWith("#unevaluatedItems")).reduce((e,[n,,o])=>{const i=!1!==e&&xe.getKeyword(n).collectEvaluatedItems(o,t,r);return!1!==i&&Math.max(e,i)},0)}},Le={Core:xe,Schema:ae,Instance:j,Keywords:{metaData:Pe,validate:Ke}},Ce=Le.Core,Ue=Le.Schema,qe=Le.Instance,ze=Le.Keywords;exports.Core=Ce,exports.Instance=qe,exports.Keywords=ze,exports.Schema=Ue,exports.default=Le; | ||
*/function R(e){var t=String(e);if(I.test(t))return t;if(t.length>0&&!S.test(t))throw new TypeError("invalid parameter value");return'"'+t.replace(T,"\\$1")+'"'}function K(e){this.parameters=Object.create(null),this.type=e}var L={format:function(e){if(!e||"object"!=typeof e)throw new TypeError("argument obj is required");var t=e.parameters,r=e.type;if(!r||!k.test(r))throw new TypeError("invalid type");var n=r;if(t&&"object"==typeof t)for(var o,i=Object.keys(t).sort(),a=0;a<i.length;a++){if(o=i[a],!I.test(o))throw new TypeError("invalid parameter name");n+="; "+o+"="+R(t[o])}return n},parse:function(e){if(!e)throw new TypeError("argument string is required");var t="object"==typeof e?function(e){var t;"function"==typeof e.getHeader?t=e.getHeader("content-type"):"object"==typeof e.headers&&(t=e.headers&&e.headers["content-type"]);if("string"!=typeof t)throw new TypeError("content-type header is missing from object");return t}(e):e;if("string"!=typeof t)throw new TypeError("argument string is required to be a string");var r=t.indexOf(";"),n=-1!==r?t.substr(0,r).trim():t.trim();if(!k.test(n))throw new TypeError("invalid media type");var o=new K(n.toLowerCase());if(-1!==r){var i,a,s;for(A.lastIndex=r;a=A.exec(t);){if(a.index!==r)throw new TypeError("invalid parameter format");r+=a[0].length,i=a[1].toLowerCase(),'"'===(s=a[2])[0]&&(s=s.substr(1,s.length-2).replace(V,"$1")),o.parameters[i]=s}if(r!==t.length)throw new TypeError("invalid parameter format")}return o}},C=function(e,t){if(e=e.trim(),(t=t.trim()).startsWith("about:"))return t;const r=function(e){const t={host:"",path:"",query:"",protocol:""};let r=e,n=e.indexOf("//");t.protocol=r.substring(0,n),n+=2;const o=e.indexOf("/",n),i=e.indexOf("?"),a=e.indexOf("#");-1!==a&&(r=r.substring(0,a));if(-1!==i){const e=r.substring(i);t.query=e,r=r.substring(0,i)}if(-1!==o){const e=r.substring(0,o);t.host=e,r=r.substring(o),t.path=r}else t.host=r;return t}(e),n=function(e){const t={href:e,hash:"",query:"",netPath:!1,absolutePath:!1,relativePath:!1};if(z.test(e))return t.netPath=!0,t;"/"===e[0]?t.absolutePath=!0:""!==e&&(t.relativePath=!0);let r=e;const n=e.indexOf("?"),o=e.indexOf("#");if(-1!==o){const e=r.substring(o);t.hash=e,r=r.substring(0,o)}if(-1!==n){const e=r.substring(n);t.query=e,r=r.substring(0,n)}return t.path=r,t}(t);if(!r.protocol&&!n.netPath)throw new Error("Error, protocol is not specified");if(n.netPath)return n.href.startsWith("//")&&(n.href=r.protocol+n.href),function(e){const t=e.indexOf("//")+2,r=!e.includes("/",t),n=!e.includes("?",t),o=!e.includes("#",t);return r&&n&&o}(n.href)?U(n.href):n.href;if(n.absolutePath){const{path:e,query:t,hash:o}=n;return r.host+q(e)+t+o}if(n.relativePath){const{path:e,query:t,hash:o}=n;let i,a=r.path,s=r.host;return 0===e.length?i=a:(a=a.substring(0,a.lastIndexOf("/")),i=q(a+"/"+e)),s+=""!==i||t||o?i+t+o:"/",s}{const{host:e,path:t,query:o}=r;return t||o?e+t+o+n.hash:U(e)}};function U(e){return e+("/"===e[e.length-1]?"":"/")}function q(e){let t=e.split("/");""===t[0]&&(t=t.slice(1));let r=[];return t.forEach((e,n)=>{"."!==e&&(".."===e?r.pop():""===e&&n!==t.length-1||r.push(e))}),"/"+r.join("/")}const z=new RegExp("^([a-z][a-z0-9+.-]*:)?//","i");var W=fetch;const{isObject:_,splitUrl:B}=y,D=Symbol("$__jref"),F={},M={},Z=(e,t)=>{const r=e in M?M[e]:e;if(r in F)return F[r][t]},N={},J={},G=(e,t="",r="")=>{e=JSON.parse(JSON.stringify(e));const n=B(e.$schema||r)[0];if(!n)throw Error("Couldn't determine schema version");delete e.$schema;const o=Z(n,"idToken"),i=B(t)[0],a=Y(i,e[o]||""),s=B(a)[0];if(!s)throw Error("Couldn't determine an identifier for the schema");i&&(J[i]=s);const c=!!e.$recursiveAnchor;let u;delete e.$recursiveAnchor,Z(n,"vocabulary")&&_(e)&&"$vocabulary"in e?(M[s]=n,u=e.$vocabulary,delete e.$vocabulary):u=s===n?{[n]:!0}:{};const l={};N[s]={id:s,schemaVersion:n,schema:H(e,s,n,h.nil,l),anchors:l,recursiveAnchor:c,vocabulary:u,validated:!1}},H=(e,t,r,n,o)=>{if(_(e)){const i=Z(r,"idToken"),a=Z(r,"anchorToken");if("string"==typeof e[i]){const n=e[i],o=Y(t,n),[s,c]=B(o);if(delete e[i],c&&(e[a]=a!==i?encodeURI(c):"#"+encodeURI(c)),s!==t)return G(e,Y(t,s),r),{[D]:n}}if("string"==typeof e[a]){const t=a!==i?e[a]:e[a].slice(1);o[t]=n,delete e[a]}return Object.entries(e).reduce((e,[i,a])=>(e[i]=H(a,t,r,h.append(i,n),o),e),{})}return Array.isArray(e)?e.map((e,i)=>H(e,t,r,h.append(i,n),o)):e},Q=Object.freeze({id:"",schemaVersion:void 0,pointer:"",schema:void 0,recursiveAnchor:!1}),X=async(e,t=Q,r=!1)=>{const n=r&&t.recursiveAnchor?t.recursiveAnchor:re(t),o=Y(n,e),[i,a]=B(o);if(!(e=>e in N||e in J)(i)){const e=await W(i,{headers:{Accept:"application/schema+json"}});if(e.status>=400)throw await e.text(),Error("Failed to retrieve schema with id: "+i);if(e.headers.has("content-type")){const t=L.parse(e.headers.get("content-type")).type;if("application/schema+json"!==t)throw Error(`${i} is not a schema. Found a document with media type: ${t}`)}G(await e.json(),i)}const s=(e=>N[J[e]]||N[e])(i),c=Object.freeze({id:s.id,schemaVersion:s.schemaVersion,vocabulary:s.vocabulary,pointer:a&&"/"!==a[0]?te(s,a):a,schema:s.schema,recursiveAnchor:t.recursiveAnchor||!!s.recursiveAnchor&&i,validated:s.validated}),u=ne(c);return _(u)&&D in u?X(u[D],c):Z(c.schemaVersion,"jsonReference")&&_(u)&&"string"==typeof u.$ref?X(u.$ref,c):Z(c.schemaVersion,"keywordReference")&&"string"==typeof u&&c.pointer.endsWith("/$ref")?X(u,c):Z(c.schemaVersion,"keywordRecursiveReference")&&"string"==typeof u&&c.pointer.endsWith("/$recursiveRef")?X(u,c,!0):c},Y=(e,t)=>{const r=C(e,t),n=B(e)[0];if(n&&"file"===ee(r)&&"file"!==ee(n))throw Error(`Can't access file '${r}' resource from network context '${e}'`);return r},ee=e=>{const t=e.match(/^(.+):\/\//);return t?t[1]:""},te=(e,t)=>{if(!(t in e.anchors))throw Error(`No such anchor '${encodeURI(e.id)}#${encodeURI(t)}'`);return e.anchors[t]},re=e=>`${e.id}#${encodeURI(e.pointer)}`,ne=e=>h.get(e.pointer,e.schema),oe=(e,t)=>{const r=h.append(e,t.pointer);return X("#"+encodeURI(r),t)},ie=r((e,t)=>ne(t).map(async(r,n)=>e(await oe(n,t),n)));var ae={setConfig:(e,t,r)=>{F[e]||(F[e]={}),F[e][t]=r},getConfig:Z,add:G,get:X,markValidated:e=>{N[e].validated=!0},uri:re,value:ne,has:(e,t)=>e in ne(t),step:oe,entries:e=>Object.keys(ne(e)).map(async t=>[t,await oe(t,e)]),map:ie};const se="FLAG",ce="BASIC",ue="DETAILED",le="VERBOSE";let fe=ue,de=!0;const pe=(e,r)=>(n,o=se)=>{if(![se,ce,ue,le].includes(o))throw Error(`The '${o}' error format is not supported`);let i=[];const a=t.subscribe("result",he(o,i));return $e(r,n,e),t.unsubscribe(a),i[0]},he=(e,t)=>{const r=[];return(n,o)=>{const i={...o,errors:[]};for(;r.length>0&&ye(r[r.length-1],i);){const t=r.pop();let n=[];if(e===ce&&(n=t.errors,delete t.errors),i.errors.unshift(t,...n),ve(i))break}(e===le||e!==se&&!i.valid)&&r.push(i),t[0]=i}},ye=(e,t)=>e.instanceLocation.startsWith(t.instanceLocation)&&(e.absoluteKeywordLocation.startsWith(t.absoluteKeywordLocation)||ve(e)),ve=e=>e.keyword.endsWith("#$ref")||e.keyword.endsWith("#$recursiveRef"),be={},we=e=>be[e],me=e=>e in be,ge={},Oe={},Ee=async(e,t)=>{if(!me(e.schemaVersion+"#validate")){const t=await ae.get(e.schemaVersion);(ae.getConfig(t.id,"mandatoryVocabularies")||[]).forEach(e=>{if(!t.vocabulary[e])throw Error(`Vocabulary '${e}' must be explicitly declared and required`)}),Object.entries(t.vocabulary).forEach(([e,r])=>{if(e in ge)Object.entries(ge[e]).forEach(([e,r])=>{((e,t)=>{be[e]={collectEvaluatedItems:(e,r,n)=>t.interpret(e,r,n)&&0,collectEvaluatedProperties:(e,r,n)=>t.interpret(e,r,n)&&[],...t}})(`${t.id}#${e}`,r)});else if(r)throw Error("Missing required vocabulary: "+e)})}if(de&&!e.validated){if(ae.markValidated(e.id),!(e.schemaVersion in Oe)){const t=await ae.get(e.schemaVersion),r={},n=await Ee(t,r);Oe[t.id]=pe(r,n)}const t=j.cons(e.schema,e.id),r=Oe[e.schemaVersion](t,fe);if(!r.valid)throw r}return await we(e.schemaVersion+"#validate").compile(e,t),ae.uri(e)},$e=(e,t,r)=>{const[n]=r[e];return we(n).interpret(e,t,r)};var xe={validate:async(e,t,r)=>{const n={},o=await Ee(e,n),i=(e,t=se)=>pe(n,o)(j.cons(e),t);return void 0===t?i:i(t,r)},setMetaOutputFormat:e=>{fe=e},setShouldMetaValidate:e=>{de=e},FLAG:se,BASIC:ce,DETAILED:ue,VERBOSE:le,getKeyword:we,hasKeyword:me,defineVocabulary:(e,t)=>{ge[e]=t},compileSchema:Ee,interpretSchema:$e,collectEvaluatedProperties:(e,t,r,n)=>{const[o]=r[e];return we(o).collectEvaluatedProperties(e,t,r,n)},collectEvaluatedItems:(e,t,r,n)=>{const[o]=r[e];return we(o).collectEvaluatedItems(e,t,r,n)}};var Pe={compile:()=>{},interpret:()=>!0},je=async e=>Object.entries(await e),Ae=r(async(e,t)=>(await t).map(e)),Se=r(async(e,t,r)=>(await r).reduce(async(t,r)=>{let n;try{n=await t}catch(e){try{await r}catch(e){}return t}return e(n,r)},t)),Ie=r(async(e,t,r={})=>Se(async(t,r)=>await e(r)?t.concat([r]):t,[],t,r)),Ve=r(async(e,t)=>{const r=await Ae(e,t);return(await Promise.all(r)).some(e=>e)}),Te=r(async(e,t)=>{const r=await Ae(e,t);return(await Promise.all(r)).every(e=>e)}),ke=r((e,t)=>e.reduce(async(e,t)=>t(await e),t)),Re={entries:je,map:Ae,filter:Ie,reduce:Se,some:Ve,every:Te,pipeline:ke,all:e=>Promise.all(e),allValues:e=>ke([je,Se(async(e,[t,r])=>(e[t]=await r,e),{})],e)};var Ke={compile:async(e,t)=>{const r=ae.uri(e);if(!(r in t)){t[r]=!1;const n=ae.value(e);t[r]=[e.schemaVersion+"#validate",ae.uri(e),"boolean"==typeof n?n:await Re.pipeline([ae.entries,Re.map(async t=>{const[r,n]=await t;return[`${e.schemaVersion}#${r}`,n]}),Re.filter(async t=>{const[r]=await t;return xe.hasKeyword(r)&&r!==e.schemaVersion+"#validate"}),Re.map(async r=>{const[n,o]=await r,i=await o,a=await xe.getKeyword(n).compile(i,t,e);return[n,ae.uri(i),a]}),Re.all],e)]}},interpret:(e,r,n)=>{const[o,i,a]=n[e],s="boolean"==typeof a?a:a.every(([e,o,i])=>{const a=xe.getKeyword(e).interpret(i,r,n);return t.publishSync("result",{keyword:e,absoluteKeywordLocation:o,instanceLocation:j.uri(r),valid:a}),a});return t.publishSync("result",{keyword:o,absoluteKeywordLocation:i,instanceLocation:j.uri(r),valid:s}),s},collectEvaluatedProperties:(e,t,r,n=!1)=>{const o=r[e][2];return"boolean"==typeof o?!!o&&[]:o.filter(([e])=>!n||!e.endsWith("#unevaluatedProperties")).reduce((e,[n,,o])=>{const i=e&&xe.getKeyword(n).collectEvaluatedProperties(o,t,r);return i&&e.concat(i)},[])},collectEvaluatedItems:(e,t,r,n=!1)=>{const o=r[e][2];return"boolean"==typeof o?!!o&&[]:o.filter(([e])=>!n||!e.endsWith("#unevaluatedItems")).reduce((e,[n,,o])=>{const i=!1!==e&&xe.getKeyword(n).collectEvaluatedItems(o,t,r);return!1!==i&&Math.max(e,i)},0)}},Le={Core:xe,Schema:ae,Instance:j,Keywords:{metaData:Pe,validate:Ke}},Ce=Le.Core,Ue=Le.Schema,qe=Le.Instance,ze=Le.Keywords;exports.Core=Ce,exports.Instance=qe,exports.Keywords=ze,exports.Schema=Ue,exports.default=Le; | ||
//# sourceMappingURL=json-schema-core-cjs.min.js.map |
@@ -1213,3 +1213,3 @@ var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; | ||
const entries$1 = (doc) => Object.keys(value$1(doc)) | ||
.map((key) => [key, step$1(key, doc)]); | ||
.map(async (key) => [key, await step$1(key, doc)]); | ||
@@ -1393,3 +1393,18 @@ const map$1 = justCurryIt((fn, doc) => value$1(doc) | ||
var reduce$1 = justCurryIt(async (fn, acc, doc) => { | ||
return (await doc).reduce(async (acc, item) => fn(await acc, item), acc); | ||
return (await doc).reduce(async (acc, item) => { | ||
let resolvedAcc; | ||
try { | ||
resolvedAcc = await acc; | ||
} catch (e) { | ||
try { | ||
await item; | ||
} catch (e) { | ||
// If we've already encountered an error, ignore subsequent errors. | ||
} | ||
return acc; | ||
} | ||
return fn(resolvedAcc, item); | ||
}, acc); | ||
}); | ||
@@ -1453,8 +1468,13 @@ | ||
schema.entries, | ||
lib.map(([keyword, keywordSchema]) => { | ||
lib.map(async (entry) => { | ||
const [keyword, keywordSchema] = await entry; | ||
const keywordId = `${schema$1.schemaVersion}#${keyword}`; | ||
return [keywordId, keywordSchema]; | ||
}), | ||
lib.filter(([keywordId]) => core.hasKeyword(keywordId) && keywordId !== `${schema$1.schemaVersion}#validate`), | ||
lib.map(async ([keywordId, keywordSchemaPromise]) => { | ||
lib.filter(async (entry) => { | ||
const [keywordId] = await entry; | ||
return core.hasKeyword(keywordId) && keywordId !== `${schema$1.schemaVersion}#validate`; | ||
}), | ||
lib.map(async (entry) => { | ||
const [keywordId, keywordSchemaPromise] = await entry; | ||
const keywordSchema = await keywordSchemaPromise; | ||
@@ -1461,0 +1481,0 @@ const keywordAst = await core.getKeyword(keywordId).compile(keywordSchema, ast, schema$1); |
@@ -1,2 +0,2 @@ | ||
var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var t=function(e,t){return e(t={exports:{}},t.exports),t.exports}((function(t,r){!function(e,n){var o={};e.PubSub=o;var i=e.define;!function(e){var t={},r=-1;function n(e){var t;for(t in e)if(e.hasOwnProperty(t))return!0;return!1}function o(e,t,r){try{e(t,r)}catch(e){setTimeout(function(e){return function(){throw e}}(e),0)}}function i(e,t,r){e(t,r)}function a(e,r,n,a){var s,c=t[r],u=a?i:o;if(t.hasOwnProperty(r))for(s in c)c.hasOwnProperty(s)&&u(c[s],e,n)}function s(e,r,o,i){var s=function(e,t,r){return function(){var n=String(e),o=n.lastIndexOf(".");for(a(e,e,t,r);-1!==o;)o=(n=n.substr(0,o)).lastIndexOf("."),a(e,n,t,r)}}(e="symbol"==typeof e?e.toString():e,r,i);return!!function(e){for(var r=String(e),o=Boolean(t.hasOwnProperty(r)&&n(t[r])),i=r.lastIndexOf(".");!o&&-1!==i;)i=(r=r.substr(0,i)).lastIndexOf("."),o=Boolean(t.hasOwnProperty(r)&&n(t[r]));return o}(e)&&(!0===o?s():setTimeout(s,0),!0)}e.publish=function(t,r){return s(t,r,!1,e.immediateExceptions)},e.publishSync=function(t,r){return s(t,r,!0,e.immediateExceptions)},e.subscribe=function(e,n){if("function"!=typeof n)return!1;e="symbol"==typeof e?e.toString():e,t.hasOwnProperty(e)||(t[e]={});var o="uid_"+String(++r);return t[e][o]=n,o},e.subscribeOnce=function(t,r){var n=e.subscribe(t,(function(){e.unsubscribe(n),r.apply(this,arguments)}));return e},e.clearAllSubscriptions=function(){t={}},e.clearSubscriptions=function(e){var r;for(r in t)t.hasOwnProperty(r)&&0===r.indexOf(e)&&delete t[r]},e.countSubscriptions=function(e){var r,n=0;for(r in t)t.hasOwnProperty(r)&&0===r.indexOf(e)&&n++;return n},e.getSubscriptions=function(e){var r,n=[];for(r in t)t.hasOwnProperty(r)&&0===r.indexOf(e)&&n.push(r);return n},e.unsubscribe=function(r){var n,o,i,a="string"==typeof r&&(t.hasOwnProperty(r)||function(e){var r;for(r in t)if(t.hasOwnProperty(r)&&0===r.indexOf(e))return!0;return!1}(r)),s=!a&&"string"==typeof r,c="function"==typeof r,u=!1;if(!a){for(n in t)if(t.hasOwnProperty(n)){if(o=t[n],s&&o[r]){delete o[r],u=r;break}if(c)for(i in o)o.hasOwnProperty(i)&&o[i]===r&&(delete o[i],u=!0)}return u}e.clearSubscriptions(r)}}(o),"function"==typeof i&&i.amd?i((function(){return o})):(void 0!==t&&t.exports&&(r=t.exports=o),r.PubSub=o,t.exports=r=o)}("object"==typeof window&&window||e)})),r=(t.PubSub,function(e,t){return function r(){null==t&&(t=e.length);var n=[].slice.call(arguments);return n.length>=t?e.apply(this,n):function(){return r.apply(this,n.concat([].slice.call(arguments)))}}});const n=e=>{if(e.length>0&&"/"!==e[0])throw Error("Invalid JSON Pointer");return e.split("/").slice(1).map(l)},o=(e,t,r,n)=>{if(0===e.length)return r;if(e.length>1){const i=e.shift();return{...t,[i]:o(e,d(t,i,n),r,c(i,n))}}if(Array.isArray(t)){const n=[...t];return n[f(t,e[0])]=r,n}return"object"==typeof t&&null!==t?{...t,[e[0]]:r}:d(t,e[0],n)},i=(e,t,r,n)=>{if(0!==e.length)if(1!==e.length||p(t)){const o=e.shift();i(e,d(t,o,n),r,c(o,n))}else{t[f(t,e[0])]=r}},a=(e,t,r)=>{if(0!=e.length){if(e.length>1){const n=e.shift(),o=d(t,n,r);return{...t,[n]:a(e,o,c(n,r))}}if(Array.isArray(t))return t.filter((t,r)=>r!=e[0]);if("object"==typeof t&&null!==t){const{[e[0]]:r,...n}=t;return n}return d(t,e[0],r)}},s=(e,t,r)=>{if(0!==e.length)if(e.length>1){const n=e.shift(),o=d(t,n,r);s(e,o,c(n,r))}else Array.isArray(t)?t.splice(e[0],1):"object"==typeof t&&null!==t?delete t[e[0]]:d(t,e[0],r)},c=r((e,t)=>t+"/"+u(e)),u=e=>e.toString().replace(/~/g,"~0").replace(/\//g,"~1"),l=e=>e.toString().replace(/~1/g,"/").replace(/~0/g,"~"),f=(e,t)=>Array.isArray(e)&&"-"===t?e.length:t,d=(e,t,r="")=>{if(void 0===e)throw TypeError(`Value at '${r}' is undefined and does not have property '${t}'`);if(null===e)throw TypeError(`Value at '${r}' is null and does not have property '${t}'`);if(p(e))throw TypeError(`Value at '${r}' is a ${typeof e} and does not have property '${t}'`);return e[f(e,t)]},p=e=>null===e||"object"!=typeof e;var h={nil:"",append:c,get:(e,t)=>{const r=n(e),o=e=>r.reduce(([e,t],r)=>[d(e,r,t),c(r,t)],[e,""])[0];return void 0===t?o:o(t)},set:(e,t,i)=>{const a=n(e),s=r((e,t)=>o(a,e,t,""));return void 0===t?s:s(t,i)},assign:(e,t,o)=>{const a=n(e),s=r((e,t)=>i(a,e,t,""));return void 0===t?s:s(t,o)},unset:(e,t)=>{const r=n(e),o=e=>a(r,e,"");return void 0===t?o:o(t)},delete:(e,t)=>{const r=n(e),o=e=>s(r,e,"");return void 0===t?o:o(t)}};var y={isObject:e=>"object"==typeof e&&!Array.isArray(e)&&null!==e,splitUrl:e=>{const t=e.indexOf("#"),r=-1===t?e.length:t,n=e.slice(0,r),o=e.slice(r+1);return[decodeURI(n),decodeURI(o)]}};const{splitUrl:v}=y,b=Object.freeze({id:"",pointer:"",instance:void 0}),m=(e,t=b)=>Object.freeze({...t,pointer:v(e)[1]}),w=e=>h.get(e.pointer,e.instance),g=(e,t)=>{const r=h.append(e,t.pointer);return m("#"+encodeURI(r),t)},O=r((e,t)=>w(t).map((r,n)=>e(g(n,t),n))),E=r((e,t)=>w(t).map((e,r)=>g(r,t)).filter((t,r)=>e(t,r))),$=r((e,t,r)=>w(r).reduce((t,n,o)=>e(t,g(o,r),o),t)),x=r((e,t)=>Object.keys(w(t)).every((r,n)=>e(g(r,t),n))),P=r((e,t)=>Object.keys(w(t)).some((r,n)=>e(g(r,t),n)));var j={cons:(e,t="")=>Object.freeze({...b,id:t,instance:e}),get:m,uri:e=>`${e.id}#${encodeURI(e.pointer)}`,value:w,step:g,entries:e=>Object.keys(w(e)).map(t=>[t,g(t,e)]),map:O,filter:E,reduce:$,every:x,some:P},A=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,S=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,I=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,V=/\\([\u000b\u0020-\u00ff])/g,T=/([\\"])/g,k=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/; | ||
var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var t=function(e,t){return e(t={exports:{}},t.exports),t.exports}((function(t,r){!function(e,n){var o={};e.PubSub=o;var i=e.define;!function(e){var t={},r=-1;function n(e){var t;for(t in e)if(e.hasOwnProperty(t))return!0;return!1}function o(e,t,r){try{e(t,r)}catch(e){setTimeout(function(e){return function(){throw e}}(e),0)}}function i(e,t,r){e(t,r)}function a(e,r,n,a){var s,c=t[r],u=a?i:o;if(t.hasOwnProperty(r))for(s in c)c.hasOwnProperty(s)&&u(c[s],e,n)}function s(e,r,o,i){var s=function(e,t,r){return function(){var n=String(e),o=n.lastIndexOf(".");for(a(e,e,t,r);-1!==o;)o=(n=n.substr(0,o)).lastIndexOf("."),a(e,n,t,r)}}(e="symbol"==typeof e?e.toString():e,r,i);return!!function(e){for(var r=String(e),o=Boolean(t.hasOwnProperty(r)&&n(t[r])),i=r.lastIndexOf(".");!o&&-1!==i;)i=(r=r.substr(0,i)).lastIndexOf("."),o=Boolean(t.hasOwnProperty(r)&&n(t[r]));return o}(e)&&(!0===o?s():setTimeout(s,0),!0)}e.publish=function(t,r){return s(t,r,!1,e.immediateExceptions)},e.publishSync=function(t,r){return s(t,r,!0,e.immediateExceptions)},e.subscribe=function(e,n){if("function"!=typeof n)return!1;e="symbol"==typeof e?e.toString():e,t.hasOwnProperty(e)||(t[e]={});var o="uid_"+String(++r);return t[e][o]=n,o},e.subscribeOnce=function(t,r){var n=e.subscribe(t,(function(){e.unsubscribe(n),r.apply(this,arguments)}));return e},e.clearAllSubscriptions=function(){t={}},e.clearSubscriptions=function(e){var r;for(r in t)t.hasOwnProperty(r)&&0===r.indexOf(e)&&delete t[r]},e.countSubscriptions=function(e){var r,n=0;for(r in t)t.hasOwnProperty(r)&&0===r.indexOf(e)&&n++;return n},e.getSubscriptions=function(e){var r,n=[];for(r in t)t.hasOwnProperty(r)&&0===r.indexOf(e)&&n.push(r);return n},e.unsubscribe=function(r){var n,o,i,a="string"==typeof r&&(t.hasOwnProperty(r)||function(e){var r;for(r in t)if(t.hasOwnProperty(r)&&0===r.indexOf(e))return!0;return!1}(r)),s=!a&&"string"==typeof r,c="function"==typeof r,u=!1;if(!a){for(n in t)if(t.hasOwnProperty(n)){if(o=t[n],s&&o[r]){delete o[r],u=r;break}if(c)for(i in o)o.hasOwnProperty(i)&&o[i]===r&&(delete o[i],u=!0)}return u}e.clearSubscriptions(r)}}(o),"function"==typeof i&&i.amd?i((function(){return o})):(void 0!==t&&t.exports&&(r=t.exports=o),r.PubSub=o,t.exports=r=o)}("object"==typeof window&&window||e)})),r=(t.PubSub,function(e,t){return function r(){null==t&&(t=e.length);var n=[].slice.call(arguments);return n.length>=t?e.apply(this,n):function(){return r.apply(this,n.concat([].slice.call(arguments)))}}});const n=e=>{if(e.length>0&&"/"!==e[0])throw Error("Invalid JSON Pointer");return e.split("/").slice(1).map(l)},o=(e,t,r,n)=>{if(0===e.length)return r;if(e.length>1){const i=e.shift();return{...t,[i]:o(e,d(t,i,n),r,c(i,n))}}if(Array.isArray(t)){const n=[...t];return n[f(t,e[0])]=r,n}return"object"==typeof t&&null!==t?{...t,[e[0]]:r}:d(t,e[0],n)},i=(e,t,r,n)=>{if(0!==e.length)if(1!==e.length||p(t)){const o=e.shift();i(e,d(t,o,n),r,c(o,n))}else{t[f(t,e[0])]=r}},a=(e,t,r)=>{if(0!=e.length){if(e.length>1){const n=e.shift(),o=d(t,n,r);return{...t,[n]:a(e,o,c(n,r))}}if(Array.isArray(t))return t.filter((t,r)=>r!=e[0]);if("object"==typeof t&&null!==t){const{[e[0]]:r,...n}=t;return n}return d(t,e[0],r)}},s=(e,t,r)=>{if(0!==e.length)if(e.length>1){const n=e.shift(),o=d(t,n,r);s(e,o,c(n,r))}else Array.isArray(t)?t.splice(e[0],1):"object"==typeof t&&null!==t?delete t[e[0]]:d(t,e[0],r)},c=r((e,t)=>t+"/"+u(e)),u=e=>e.toString().replace(/~/g,"~0").replace(/\//g,"~1"),l=e=>e.toString().replace(/~1/g,"/").replace(/~0/g,"~"),f=(e,t)=>Array.isArray(e)&&"-"===t?e.length:t,d=(e,t,r="")=>{if(void 0===e)throw TypeError(`Value at '${r}' is undefined and does not have property '${t}'`);if(null===e)throw TypeError(`Value at '${r}' is null and does not have property '${t}'`);if(p(e))throw TypeError(`Value at '${r}' is a ${typeof e} and does not have property '${t}'`);return e[f(e,t)]},p=e=>null===e||"object"!=typeof e;var h={nil:"",append:c,get:(e,t)=>{const r=n(e),o=e=>r.reduce(([e,t],r)=>[d(e,r,t),c(r,t)],[e,""])[0];return void 0===t?o:o(t)},set:(e,t,i)=>{const a=n(e),s=r((e,t)=>o(a,e,t,""));return void 0===t?s:s(t,i)},assign:(e,t,o)=>{const a=n(e),s=r((e,t)=>i(a,e,t,""));return void 0===t?s:s(t,o)},unset:(e,t)=>{const r=n(e),o=e=>a(r,e,"");return void 0===t?o:o(t)},delete:(e,t)=>{const r=n(e),o=e=>s(r,e,"");return void 0===t?o:o(t)}};var y={isObject:e=>"object"==typeof e&&!Array.isArray(e)&&null!==e,splitUrl:e=>{const t=e.indexOf("#"),r=-1===t?e.length:t,n=e.slice(0,r),o=e.slice(r+1);return[decodeURI(n),decodeURI(o)]}};const{splitUrl:v}=y,b=Object.freeze({id:"",pointer:"",instance:void 0}),w=(e,t=b)=>Object.freeze({...t,pointer:v(e)[1]}),m=e=>h.get(e.pointer,e.instance),g=(e,t)=>{const r=h.append(e,t.pointer);return w("#"+encodeURI(r),t)},O=r((e,t)=>m(t).map((r,n)=>e(g(n,t),n))),E=r((e,t)=>m(t).map((e,r)=>g(r,t)).filter((t,r)=>e(t,r))),$=r((e,t,r)=>m(r).reduce((t,n,o)=>e(t,g(o,r),o),t)),x=r((e,t)=>Object.keys(m(t)).every((r,n)=>e(g(r,t),n))),P=r((e,t)=>Object.keys(m(t)).some((r,n)=>e(g(r,t),n)));var j={cons:(e,t="")=>Object.freeze({...b,id:t,instance:e}),get:w,uri:e=>`${e.id}#${encodeURI(e.pointer)}`,value:m,step:g,entries:e=>Object.keys(m(e)).map(t=>[t,g(t,e)]),map:O,filter:E,reduce:$,every:x,some:P},A=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,S=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,I=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,V=/\\([\u000b\u0020-\u00ff])/g,T=/([\\"])/g,k=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/; | ||
/*! | ||
@@ -6,3 +6,3 @@ * content-type | ||
* MIT Licensed | ||
*/function R(e){var t=String(e);if(I.test(t))return t;if(t.length>0&&!S.test(t))throw new TypeError("invalid parameter value");return'"'+t.replace(T,"\\$1")+'"'}function K(e){this.parameters=Object.create(null),this.type=e}var L={format:function(e){if(!e||"object"!=typeof e)throw new TypeError("argument obj is required");var t=e.parameters,r=e.type;if(!r||!k.test(r))throw new TypeError("invalid type");var n=r;if(t&&"object"==typeof t)for(var o,i=Object.keys(t).sort(),a=0;a<i.length;a++){if(o=i[a],!I.test(o))throw new TypeError("invalid parameter name");n+="; "+o+"="+R(t[o])}return n},parse:function(e){if(!e)throw new TypeError("argument string is required");var t="object"==typeof e?function(e){var t;"function"==typeof e.getHeader?t=e.getHeader("content-type"):"object"==typeof e.headers&&(t=e.headers&&e.headers["content-type"]);if("string"!=typeof t)throw new TypeError("content-type header is missing from object");return t}(e):e;if("string"!=typeof t)throw new TypeError("argument string is required to be a string");var r=t.indexOf(";"),n=-1!==r?t.substr(0,r).trim():t.trim();if(!k.test(n))throw new TypeError("invalid media type");var o=new K(n.toLowerCase());if(-1!==r){var i,a,s;for(A.lastIndex=r;a=A.exec(t);){if(a.index!==r)throw new TypeError("invalid parameter format");r+=a[0].length,i=a[1].toLowerCase(),'"'===(s=a[2])[0]&&(s=s.substr(1,s.length-2).replace(V,"$1")),o.parameters[i]=s}if(r!==t.length)throw new TypeError("invalid parameter format")}return o}},C=function(e,t){if(e=e.trim(),(t=t.trim()).startsWith("about:"))return t;const r=function(e){const t={host:"",path:"",query:"",protocol:""};let r=e,n=e.indexOf("//");t.protocol=r.substring(0,n),n+=2;const o=e.indexOf("/",n),i=e.indexOf("?"),a=e.indexOf("#");-1!==a&&(r=r.substring(0,a));if(-1!==i){const e=r.substring(i);t.query=e,r=r.substring(0,i)}if(-1!==o){const e=r.substring(0,o);t.host=e,r=r.substring(o),t.path=r}else t.host=r;return t}(e),n=function(e){const t={href:e,hash:"",query:"",netPath:!1,absolutePath:!1,relativePath:!1};if(z.test(e))return t.netPath=!0,t;"/"===e[0]?t.absolutePath=!0:""!==e&&(t.relativePath=!0);let r=e;const n=e.indexOf("?"),o=e.indexOf("#");if(-1!==o){const e=r.substring(o);t.hash=e,r=r.substring(0,o)}if(-1!==n){const e=r.substring(n);t.query=e,r=r.substring(0,n)}return t.path=r,t}(t);if(!r.protocol&&!n.netPath)throw new Error("Error, protocol is not specified");if(n.netPath)return n.href.startsWith("//")&&(n.href=r.protocol+n.href),function(e){const t=e.indexOf("//")+2,r=!e.includes("/",t),n=!e.includes("?",t),o=!e.includes("#",t);return r&&n&&o}(n.href)?U(n.href):n.href;if(n.absolutePath){const{path:e,query:t,hash:o}=n;return r.host+q(e)+t+o}if(n.relativePath){const{path:e,query:t,hash:o}=n;let i,a=r.path,s=r.host;return 0===e.length?i=a:(a=a.substring(0,a.lastIndexOf("/")),i=q(a+"/"+e)),s+=""!==i||t||o?i+t+o:"/",s}{const{host:e,path:t,query:o}=r;return t||o?e+t+o+n.hash:U(e)}};function U(e){return e+("/"===e[e.length-1]?"":"/")}function q(e){let t=e.split("/");""===t[0]&&(t=t.slice(1));let r=[];return t.forEach((e,n)=>{"."!==e&&(".."===e?r.pop():""===e&&n!==t.length-1||r.push(e))}),"/"+r.join("/")}const z=new RegExp("^([a-z][a-z0-9+.-]*:)?//","i");var W=fetch;const{isObject:_,splitUrl:B}=y,D=Symbol("$__jref"),F={},Z={},M=(e,t)=>{const r=e in Z?Z[e]:e;if(r in F)return F[r][t]},N={},J={},G=(e,t="",r="")=>{e=JSON.parse(JSON.stringify(e));const n=B(e.$schema||r)[0];if(!n)throw Error("Couldn't determine schema version");delete e.$schema;const o=M(n,"idToken"),i=B(t)[0],a=Y(i,e[o]||""),s=B(a)[0];if(!s)throw Error("Couldn't determine an identifier for the schema");i&&(J[i]=s);const c=!!e.$recursiveAnchor;let u;delete e.$recursiveAnchor,M(n,"vocabulary")&&_(e)&&"$vocabulary"in e?(Z[s]=n,u=e.$vocabulary,delete e.$vocabulary):u=s===n?{[n]:!0}:{};const l={};N[s]={id:s,schemaVersion:n,schema:H(e,s,n,h.nil,l),anchors:l,recursiveAnchor:c,vocabulary:u,validated:!1}},H=(e,t,r,n,o)=>{if(_(e)){const i=M(r,"idToken"),a=M(r,"anchorToken");if("string"==typeof e[i]){const n=e[i],o=Y(t,n),[s,c]=B(o);if(delete e[i],c&&(e[a]=a!==i?encodeURI(c):"#"+encodeURI(c)),s!==t)return G(e,Y(t,s),r),{[D]:n}}if("string"==typeof e[a]){const t=a!==i?e[a]:e[a].slice(1);o[t]=n,delete e[a]}return Object.entries(e).reduce((e,[i,a])=>(e[i]=H(a,t,r,h.append(i,n),o),e),{})}return Array.isArray(e)?e.map((e,i)=>H(e,t,r,h.append(i,n),o)):e},Q=Object.freeze({id:"",schemaVersion:void 0,pointer:"",schema:void 0,recursiveAnchor:!1}),X=async(e,t=Q,r=!1)=>{const n=r&&t.recursiveAnchor?t.recursiveAnchor:re(t),o=Y(n,e),[i,a]=B(o);if(!(e=>e in N||e in J)(i)){const e=await W(i,{headers:{Accept:"application/schema+json"}});if(e.status>=400)throw await e.text(),Error("Failed to retrieve schema with id: "+i);if(e.headers.has("content-type")){const t=L.parse(e.headers.get("content-type")).type;if("application/schema+json"!==t)throw Error(`${i} is not a schema. Found a document with media type: ${t}`)}G(await e.json(),i)}const s=(e=>N[J[e]]||N[e])(i),c=Object.freeze({id:s.id,schemaVersion:s.schemaVersion,vocabulary:s.vocabulary,pointer:a&&"/"!==a[0]?te(s,a):a,schema:s.schema,recursiveAnchor:t.recursiveAnchor||!!s.recursiveAnchor&&i,validated:s.validated}),u=ne(c);return _(u)&&D in u?X(u[D],c):M(c.schemaVersion,"jsonReference")&&_(u)&&"string"==typeof u.$ref?X(u.$ref,c):M(c.schemaVersion,"keywordReference")&&"string"==typeof u&&c.pointer.endsWith("/$ref")?X(u,c):M(c.schemaVersion,"keywordRecursiveReference")&&"string"==typeof u&&c.pointer.endsWith("/$recursiveRef")?X(u,c,!0):c},Y=(e,t)=>{const r=C(e,t),n=B(e)[0];if(n&&"file"===ee(r)&&"file"!==ee(n))throw Error(`Can't access file '${r}' resource from network context '${e}'`);return r},ee=e=>{const t=e.match(/^(.+):\/\//);return t?t[1]:""},te=(e,t)=>{if(!(t in e.anchors))throw Error(`No such anchor '${encodeURI(e.id)}#${encodeURI(t)}'`);return e.anchors[t]},re=e=>`${e.id}#${encodeURI(e.pointer)}`,ne=e=>h.get(e.pointer,e.schema),oe=(e,t)=>{const r=h.append(e,t.pointer);return X("#"+encodeURI(r),t)},ie=r((e,t)=>ne(t).map(async(r,n)=>e(await oe(n,t),n)));var ae={setConfig:(e,t,r)=>{F[e]||(F[e]={}),F[e][t]=r},getConfig:M,add:G,get:X,markValidated:e=>{N[e].validated=!0},uri:re,value:ne,has:(e,t)=>e in ne(t),step:oe,entries:e=>Object.keys(ne(e)).map(t=>[t,oe(t,e)]),map:ie};const se="FLAG",ce="BASIC",ue="DETAILED",le="VERBOSE";let fe=ue,de=!0;const pe=(e,r)=>(n,o=se)=>{if(![se,ce,ue,le].includes(o))throw Error(`The '${o}' error format is not supported`);let i=[];const a=t.subscribe("result",he(o,i));return $e(r,n,e),t.unsubscribe(a),i[0]},he=(e,t)=>{const r=[];return(n,o)=>{const i={...o,errors:[]};for(;r.length>0&&ye(r[r.length-1],i);){const t=r.pop();let n=[];if(e===ce&&(n=t.errors,delete t.errors),i.errors.unshift(t,...n),ve(i))break}(e===le||e!==se&&!i.valid)&&r.push(i),t[0]=i}},ye=(e,t)=>e.instanceLocation.startsWith(t.instanceLocation)&&(e.absoluteKeywordLocation.startsWith(t.absoluteKeywordLocation)||ve(e)),ve=e=>e.keyword.endsWith("#$ref")||e.keyword.endsWith("#$recursiveRef"),be={},me=e=>be[e],we=e=>e in be,ge={},Oe={},Ee=async(e,t)=>{if(!we(e.schemaVersion+"#validate")){const t=await ae.get(e.schemaVersion);(ae.getConfig(t.id,"mandatoryVocabularies")||[]).forEach(e=>{if(!t.vocabulary[e])throw Error(`Vocabulary '${e}' must be explicitly declared and required`)}),Object.entries(t.vocabulary).forEach(([e,r])=>{if(e in ge)Object.entries(ge[e]).forEach(([e,r])=>{((e,t)=>{be[e]={collectEvaluatedItems:(e,r,n)=>t.interpret(e,r,n)&&0,collectEvaluatedProperties:(e,r,n)=>t.interpret(e,r,n)&&[],...t}})(`${t.id}#${e}`,r)});else if(r)throw Error("Missing required vocabulary: "+e)})}if(de&&!e.validated){if(ae.markValidated(e.id),!(e.schemaVersion in Oe)){const t=await ae.get(e.schemaVersion),r={},n=await Ee(t,r);Oe[t.id]=pe(r,n)}const t=j.cons(e.schema,e.id),r=Oe[e.schemaVersion](t,fe);if(!r.valid)throw r}return await me(e.schemaVersion+"#validate").compile(e,t),ae.uri(e)},$e=(e,t,r)=>{const[n]=r[e];return me(n).interpret(e,t,r)};var xe={validate:async(e,t,r)=>{const n={},o=await Ee(e,n),i=(e,t=se)=>pe(n,o)(j.cons(e),t);return void 0===t?i:i(t,r)},setMetaOutputFormat:e=>{fe=e},setShouldMetaValidate:e=>{de=e},FLAG:se,BASIC:ce,DETAILED:ue,VERBOSE:le,getKeyword:me,hasKeyword:we,defineVocabulary:(e,t)=>{ge[e]=t},compileSchema:Ee,interpretSchema:$e,collectEvaluatedProperties:(e,t,r,n)=>{const[o]=r[e];return me(o).collectEvaluatedProperties(e,t,r,n)},collectEvaluatedItems:(e,t,r,n)=>{const[o]=r[e];return me(o).collectEvaluatedItems(e,t,r,n)}};var Pe={compile:()=>{},interpret:()=>!0},je=async e=>Object.entries(await e),Ae=r(async(e,t)=>(await t).map(e)),Se=r(async(e,t,r)=>(await r).reduce(async(t,r)=>e(await t,r),t)),Ie=r(async(e,t,r={})=>Se(async(t,r)=>await e(r)?t.concat([r]):t,[],t,r)),Ve=r(async(e,t)=>{const r=await Ae(e,t);return(await Promise.all(r)).some(e=>e)}),Te=r(async(e,t)=>{const r=await Ae(e,t);return(await Promise.all(r)).every(e=>e)}),ke=r((e,t)=>e.reduce(async(e,t)=>t(await e),t)),Re={entries:je,map:Ae,filter:Ie,reduce:Se,some:Ve,every:Te,pipeline:ke,all:e=>Promise.all(e),allValues:e=>ke([je,Se(async(e,[t,r])=>(e[t]=await r,e),{})],e)};var Ke={compile:async(e,t)=>{const r=ae.uri(e);if(!(r in t)){t[r]=!1;const n=ae.value(e);t[r]=[e.schemaVersion+"#validate",ae.uri(e),"boolean"==typeof n?n:await Re.pipeline([ae.entries,Re.map(([t,r])=>[`${e.schemaVersion}#${t}`,r]),Re.filter(([t])=>xe.hasKeyword(t)&&t!==e.schemaVersion+"#validate"),Re.map(async([r,n])=>{const o=await n,i=await xe.getKeyword(r).compile(o,t,e);return[r,ae.uri(o),i]}),Re.all],e)]}},interpret:(e,r,n)=>{const[o,i,a]=n[e],s="boolean"==typeof a?a:a.every(([e,o,i])=>{const a=xe.getKeyword(e).interpret(i,r,n);return t.publishSync("result",{keyword:e,absoluteKeywordLocation:o,instanceLocation:j.uri(r),valid:a}),a});return t.publishSync("result",{keyword:o,absoluteKeywordLocation:i,instanceLocation:j.uri(r),valid:s}),s},collectEvaluatedProperties:(e,t,r,n=!1)=>{const o=r[e][2];return"boolean"==typeof o?!!o&&[]:o.filter(([e])=>!n||!e.endsWith("#unevaluatedProperties")).reduce((e,[n,,o])=>{const i=e&&xe.getKeyword(n).collectEvaluatedProperties(o,t,r);return i&&e.concat(i)},[])},collectEvaluatedItems:(e,t,r,n=!1)=>{const o=r[e][2];return"boolean"==typeof o?!!o&&[]:o.filter(([e])=>!n||!e.endsWith("#unevaluatedItems")).reduce((e,[n,,o])=>{const i=!1!==e&&xe.getKeyword(n).collectEvaluatedItems(o,t,r);return!1!==i&&Math.max(e,i)},0)}},Le={Core:xe,Schema:ae,Instance:j,Keywords:{metaData:Pe,validate:Ke}},Ce=Le.Core,Ue=Le.Schema,qe=Le.Instance,ze=Le.Keywords;export default Le;export{Ce as Core,qe as Instance,ze as Keywords,Ue as Schema}; | ||
*/function R(e){var t=String(e);if(I.test(t))return t;if(t.length>0&&!S.test(t))throw new TypeError("invalid parameter value");return'"'+t.replace(T,"\\$1")+'"'}function K(e){this.parameters=Object.create(null),this.type=e}var L={format:function(e){if(!e||"object"!=typeof e)throw new TypeError("argument obj is required");var t=e.parameters,r=e.type;if(!r||!k.test(r))throw new TypeError("invalid type");var n=r;if(t&&"object"==typeof t)for(var o,i=Object.keys(t).sort(),a=0;a<i.length;a++){if(o=i[a],!I.test(o))throw new TypeError("invalid parameter name");n+="; "+o+"="+R(t[o])}return n},parse:function(e){if(!e)throw new TypeError("argument string is required");var t="object"==typeof e?function(e){var t;"function"==typeof e.getHeader?t=e.getHeader("content-type"):"object"==typeof e.headers&&(t=e.headers&&e.headers["content-type"]);if("string"!=typeof t)throw new TypeError("content-type header is missing from object");return t}(e):e;if("string"!=typeof t)throw new TypeError("argument string is required to be a string");var r=t.indexOf(";"),n=-1!==r?t.substr(0,r).trim():t.trim();if(!k.test(n))throw new TypeError("invalid media type");var o=new K(n.toLowerCase());if(-1!==r){var i,a,s;for(A.lastIndex=r;a=A.exec(t);){if(a.index!==r)throw new TypeError("invalid parameter format");r+=a[0].length,i=a[1].toLowerCase(),'"'===(s=a[2])[0]&&(s=s.substr(1,s.length-2).replace(V,"$1")),o.parameters[i]=s}if(r!==t.length)throw new TypeError("invalid parameter format")}return o}},C=function(e,t){if(e=e.trim(),(t=t.trim()).startsWith("about:"))return t;const r=function(e){const t={host:"",path:"",query:"",protocol:""};let r=e,n=e.indexOf("//");t.protocol=r.substring(0,n),n+=2;const o=e.indexOf("/",n),i=e.indexOf("?"),a=e.indexOf("#");-1!==a&&(r=r.substring(0,a));if(-1!==i){const e=r.substring(i);t.query=e,r=r.substring(0,i)}if(-1!==o){const e=r.substring(0,o);t.host=e,r=r.substring(o),t.path=r}else t.host=r;return t}(e),n=function(e){const t={href:e,hash:"",query:"",netPath:!1,absolutePath:!1,relativePath:!1};if(z.test(e))return t.netPath=!0,t;"/"===e[0]?t.absolutePath=!0:""!==e&&(t.relativePath=!0);let r=e;const n=e.indexOf("?"),o=e.indexOf("#");if(-1!==o){const e=r.substring(o);t.hash=e,r=r.substring(0,o)}if(-1!==n){const e=r.substring(n);t.query=e,r=r.substring(0,n)}return t.path=r,t}(t);if(!r.protocol&&!n.netPath)throw new Error("Error, protocol is not specified");if(n.netPath)return n.href.startsWith("//")&&(n.href=r.protocol+n.href),function(e){const t=e.indexOf("//")+2,r=!e.includes("/",t),n=!e.includes("?",t),o=!e.includes("#",t);return r&&n&&o}(n.href)?U(n.href):n.href;if(n.absolutePath){const{path:e,query:t,hash:o}=n;return r.host+q(e)+t+o}if(n.relativePath){const{path:e,query:t,hash:o}=n;let i,a=r.path,s=r.host;return 0===e.length?i=a:(a=a.substring(0,a.lastIndexOf("/")),i=q(a+"/"+e)),s+=""!==i||t||o?i+t+o:"/",s}{const{host:e,path:t,query:o}=r;return t||o?e+t+o+n.hash:U(e)}};function U(e){return e+("/"===e[e.length-1]?"":"/")}function q(e){let t=e.split("/");""===t[0]&&(t=t.slice(1));let r=[];return t.forEach((e,n)=>{"."!==e&&(".."===e?r.pop():""===e&&n!==t.length-1||r.push(e))}),"/"+r.join("/")}const z=new RegExp("^([a-z][a-z0-9+.-]*:)?//","i");var W=fetch;const{isObject:_,splitUrl:B}=y,D=Symbol("$__jref"),F={},Z={},M=(e,t)=>{const r=e in Z?Z[e]:e;if(r in F)return F[r][t]},N={},J={},G=(e,t="",r="")=>{e=JSON.parse(JSON.stringify(e));const n=B(e.$schema||r)[0];if(!n)throw Error("Couldn't determine schema version");delete e.$schema;const o=M(n,"idToken"),i=B(t)[0],a=Y(i,e[o]||""),s=B(a)[0];if(!s)throw Error("Couldn't determine an identifier for the schema");i&&(J[i]=s);const c=!!e.$recursiveAnchor;let u;delete e.$recursiveAnchor,M(n,"vocabulary")&&_(e)&&"$vocabulary"in e?(Z[s]=n,u=e.$vocabulary,delete e.$vocabulary):u=s===n?{[n]:!0}:{};const l={};N[s]={id:s,schemaVersion:n,schema:H(e,s,n,h.nil,l),anchors:l,recursiveAnchor:c,vocabulary:u,validated:!1}},H=(e,t,r,n,o)=>{if(_(e)){const i=M(r,"idToken"),a=M(r,"anchorToken");if("string"==typeof e[i]){const n=e[i],o=Y(t,n),[s,c]=B(o);if(delete e[i],c&&(e[a]=a!==i?encodeURI(c):"#"+encodeURI(c)),s!==t)return G(e,Y(t,s),r),{[D]:n}}if("string"==typeof e[a]){const t=a!==i?e[a]:e[a].slice(1);o[t]=n,delete e[a]}return Object.entries(e).reduce((e,[i,a])=>(e[i]=H(a,t,r,h.append(i,n),o),e),{})}return Array.isArray(e)?e.map((e,i)=>H(e,t,r,h.append(i,n),o)):e},Q=Object.freeze({id:"",schemaVersion:void 0,pointer:"",schema:void 0,recursiveAnchor:!1}),X=async(e,t=Q,r=!1)=>{const n=r&&t.recursiveAnchor?t.recursiveAnchor:re(t),o=Y(n,e),[i,a]=B(o);if(!(e=>e in N||e in J)(i)){const e=await W(i,{headers:{Accept:"application/schema+json"}});if(e.status>=400)throw await e.text(),Error("Failed to retrieve schema with id: "+i);if(e.headers.has("content-type")){const t=L.parse(e.headers.get("content-type")).type;if("application/schema+json"!==t)throw Error(`${i} is not a schema. Found a document with media type: ${t}`)}G(await e.json(),i)}const s=(e=>N[J[e]]||N[e])(i),c=Object.freeze({id:s.id,schemaVersion:s.schemaVersion,vocabulary:s.vocabulary,pointer:a&&"/"!==a[0]?te(s,a):a,schema:s.schema,recursiveAnchor:t.recursiveAnchor||!!s.recursiveAnchor&&i,validated:s.validated}),u=ne(c);return _(u)&&D in u?X(u[D],c):M(c.schemaVersion,"jsonReference")&&_(u)&&"string"==typeof u.$ref?X(u.$ref,c):M(c.schemaVersion,"keywordReference")&&"string"==typeof u&&c.pointer.endsWith("/$ref")?X(u,c):M(c.schemaVersion,"keywordRecursiveReference")&&"string"==typeof u&&c.pointer.endsWith("/$recursiveRef")?X(u,c,!0):c},Y=(e,t)=>{const r=C(e,t),n=B(e)[0];if(n&&"file"===ee(r)&&"file"!==ee(n))throw Error(`Can't access file '${r}' resource from network context '${e}'`);return r},ee=e=>{const t=e.match(/^(.+):\/\//);return t?t[1]:""},te=(e,t)=>{if(!(t in e.anchors))throw Error(`No such anchor '${encodeURI(e.id)}#${encodeURI(t)}'`);return e.anchors[t]},re=e=>`${e.id}#${encodeURI(e.pointer)}`,ne=e=>h.get(e.pointer,e.schema),oe=(e,t)=>{const r=h.append(e,t.pointer);return X("#"+encodeURI(r),t)},ie=r((e,t)=>ne(t).map(async(r,n)=>e(await oe(n,t),n)));var ae={setConfig:(e,t,r)=>{F[e]||(F[e]={}),F[e][t]=r},getConfig:M,add:G,get:X,markValidated:e=>{N[e].validated=!0},uri:re,value:ne,has:(e,t)=>e in ne(t),step:oe,entries:e=>Object.keys(ne(e)).map(async t=>[t,await oe(t,e)]),map:ie};const se="FLAG",ce="BASIC",ue="DETAILED",le="VERBOSE";let fe=ue,de=!0;const pe=(e,r)=>(n,o=se)=>{if(![se,ce,ue,le].includes(o))throw Error(`The '${o}' error format is not supported`);let i=[];const a=t.subscribe("result",he(o,i));return $e(r,n,e),t.unsubscribe(a),i[0]},he=(e,t)=>{const r=[];return(n,o)=>{const i={...o,errors:[]};for(;r.length>0&&ye(r[r.length-1],i);){const t=r.pop();let n=[];if(e===ce&&(n=t.errors,delete t.errors),i.errors.unshift(t,...n),ve(i))break}(e===le||e!==se&&!i.valid)&&r.push(i),t[0]=i}},ye=(e,t)=>e.instanceLocation.startsWith(t.instanceLocation)&&(e.absoluteKeywordLocation.startsWith(t.absoluteKeywordLocation)||ve(e)),ve=e=>e.keyword.endsWith("#$ref")||e.keyword.endsWith("#$recursiveRef"),be={},we=e=>be[e],me=e=>e in be,ge={},Oe={},Ee=async(e,t)=>{if(!me(e.schemaVersion+"#validate")){const t=await ae.get(e.schemaVersion);(ae.getConfig(t.id,"mandatoryVocabularies")||[]).forEach(e=>{if(!t.vocabulary[e])throw Error(`Vocabulary '${e}' must be explicitly declared and required`)}),Object.entries(t.vocabulary).forEach(([e,r])=>{if(e in ge)Object.entries(ge[e]).forEach(([e,r])=>{((e,t)=>{be[e]={collectEvaluatedItems:(e,r,n)=>t.interpret(e,r,n)&&0,collectEvaluatedProperties:(e,r,n)=>t.interpret(e,r,n)&&[],...t}})(`${t.id}#${e}`,r)});else if(r)throw Error("Missing required vocabulary: "+e)})}if(de&&!e.validated){if(ae.markValidated(e.id),!(e.schemaVersion in Oe)){const t=await ae.get(e.schemaVersion),r={},n=await Ee(t,r);Oe[t.id]=pe(r,n)}const t=j.cons(e.schema,e.id),r=Oe[e.schemaVersion](t,fe);if(!r.valid)throw r}return await we(e.schemaVersion+"#validate").compile(e,t),ae.uri(e)},$e=(e,t,r)=>{const[n]=r[e];return we(n).interpret(e,t,r)};var xe={validate:async(e,t,r)=>{const n={},o=await Ee(e,n),i=(e,t=se)=>pe(n,o)(j.cons(e),t);return void 0===t?i:i(t,r)},setMetaOutputFormat:e=>{fe=e},setShouldMetaValidate:e=>{de=e},FLAG:se,BASIC:ce,DETAILED:ue,VERBOSE:le,getKeyword:we,hasKeyword:me,defineVocabulary:(e,t)=>{ge[e]=t},compileSchema:Ee,interpretSchema:$e,collectEvaluatedProperties:(e,t,r,n)=>{const[o]=r[e];return we(o).collectEvaluatedProperties(e,t,r,n)},collectEvaluatedItems:(e,t,r,n)=>{const[o]=r[e];return we(o).collectEvaluatedItems(e,t,r,n)}};var Pe={compile:()=>{},interpret:()=>!0},je=async e=>Object.entries(await e),Ae=r(async(e,t)=>(await t).map(e)),Se=r(async(e,t,r)=>(await r).reduce(async(t,r)=>{let n;try{n=await t}catch(e){try{await r}catch(e){}return t}return e(n,r)},t)),Ie=r(async(e,t,r={})=>Se(async(t,r)=>await e(r)?t.concat([r]):t,[],t,r)),Ve=r(async(e,t)=>{const r=await Ae(e,t);return(await Promise.all(r)).some(e=>e)}),Te=r(async(e,t)=>{const r=await Ae(e,t);return(await Promise.all(r)).every(e=>e)}),ke=r((e,t)=>e.reduce(async(e,t)=>t(await e),t)),Re={entries:je,map:Ae,filter:Ie,reduce:Se,some:Ve,every:Te,pipeline:ke,all:e=>Promise.all(e),allValues:e=>ke([je,Se(async(e,[t,r])=>(e[t]=await r,e),{})],e)};var Ke={compile:async(e,t)=>{const r=ae.uri(e);if(!(r in t)){t[r]=!1;const n=ae.value(e);t[r]=[e.schemaVersion+"#validate",ae.uri(e),"boolean"==typeof n?n:await Re.pipeline([ae.entries,Re.map(async t=>{const[r,n]=await t;return[`${e.schemaVersion}#${r}`,n]}),Re.filter(async t=>{const[r]=await t;return xe.hasKeyword(r)&&r!==e.schemaVersion+"#validate"}),Re.map(async r=>{const[n,o]=await r,i=await o,a=await xe.getKeyword(n).compile(i,t,e);return[n,ae.uri(i),a]}),Re.all],e)]}},interpret:(e,r,n)=>{const[o,i,a]=n[e],s="boolean"==typeof a?a:a.every(([e,o,i])=>{const a=xe.getKeyword(e).interpret(i,r,n);return t.publishSync("result",{keyword:e,absoluteKeywordLocation:o,instanceLocation:j.uri(r),valid:a}),a});return t.publishSync("result",{keyword:o,absoluteKeywordLocation:i,instanceLocation:j.uri(r),valid:s}),s},collectEvaluatedProperties:(e,t,r,n=!1)=>{const o=r[e][2];return"boolean"==typeof o?!!o&&[]:o.filter(([e])=>!n||!e.endsWith("#unevaluatedProperties")).reduce((e,[n,,o])=>{const i=e&&xe.getKeyword(n).collectEvaluatedProperties(o,t,r);return i&&e.concat(i)},[])},collectEvaluatedItems:(e,t,r,n=!1)=>{const o=r[e][2];return"boolean"==typeof o?!!o&&[]:o.filter(([e])=>!n||!e.endsWith("#unevaluatedItems")).reduce((e,[n,,o])=>{const i=!1!==e&&xe.getKeyword(n).collectEvaluatedItems(o,t,r);return!1!==i&&Math.max(e,i)},0)}},Le={Core:xe,Schema:ae,Instance:j,Keywords:{metaData:Pe,validate:Ke}},Ce=Le.Core,Ue=Le.Schema,qe=Le.Instance,ze=Le.Keywords;export default Le;export{Ce as Core,qe as Instance,ze as Keywords,Ue as Schema}; | ||
//# sourceMappingURL=json-schema-core-esm.min.js.map |
@@ -1216,3 +1216,3 @@ var JSC = (function (exports) { | ||
const entries$1 = (doc) => Object.keys(value$1(doc)) | ||
.map((key) => [key, step$1(key, doc)]); | ||
.map(async (key) => [key, await step$1(key, doc)]); | ||
@@ -1396,3 +1396,18 @@ const map$1 = justCurryIt((fn, doc) => value$1(doc) | ||
var reduce$1 = justCurryIt(async (fn, acc, doc) => { | ||
return (await doc).reduce(async (acc, item) => fn(await acc, item), acc); | ||
return (await doc).reduce(async (acc, item) => { | ||
let resolvedAcc; | ||
try { | ||
resolvedAcc = await acc; | ||
} catch (e) { | ||
try { | ||
await item; | ||
} catch (e) { | ||
// If we've already encountered an error, ignore subsequent errors. | ||
} | ||
return acc; | ||
} | ||
return fn(resolvedAcc, item); | ||
}, acc); | ||
}); | ||
@@ -1456,8 +1471,13 @@ | ||
schema.entries, | ||
lib.map(([keyword, keywordSchema]) => { | ||
lib.map(async (entry) => { | ||
const [keyword, keywordSchema] = await entry; | ||
const keywordId = `${schema$1.schemaVersion}#${keyword}`; | ||
return [keywordId, keywordSchema]; | ||
}), | ||
lib.filter(([keywordId]) => core.hasKeyword(keywordId) && keywordId !== `${schema$1.schemaVersion}#validate`), | ||
lib.map(async ([keywordId, keywordSchemaPromise]) => { | ||
lib.filter(async (entry) => { | ||
const [keywordId] = await entry; | ||
return core.hasKeyword(keywordId) && keywordId !== `${schema$1.schemaVersion}#validate`; | ||
}), | ||
lib.map(async (entry) => { | ||
const [keywordId, keywordSchemaPromise] = await entry; | ||
const keywordSchema = await keywordSchemaPromise; | ||
@@ -1464,0 +1484,0 @@ const keywordAst = await core.getKeyword(keywordId).compile(keywordSchema, ast, schema$1); |
@@ -1,2 +0,2 @@ | ||
var JSC=function(e){"use strict";var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var r=function(e,t){return e(t={exports:{}},t.exports),t.exports}((function(e,r){!function(t,n){var o={};t.PubSub=o;var i=t.define;!function(e){var t={},r=-1;function n(e){var t;for(t in e)if(e.hasOwnProperty(t))return!0;return!1}function o(e,t,r){try{e(t,r)}catch(e){setTimeout(function(e){return function(){throw e}}(e),0)}}function i(e,t,r){e(t,r)}function a(e,r,n,a){var s,c=t[r],u=a?i:o;if(t.hasOwnProperty(r))for(s in c)c.hasOwnProperty(s)&&u(c[s],e,n)}function s(e,r,o,i){var s=function(e,t,r){return function(){var n=String(e),o=n.lastIndexOf(".");for(a(e,e,t,r);-1!==o;)o=(n=n.substr(0,o)).lastIndexOf("."),a(e,n,t,r)}}(e="symbol"==typeof e?e.toString():e,r,i);return!!function(e){for(var r=String(e),o=Boolean(t.hasOwnProperty(r)&&n(t[r])),i=r.lastIndexOf(".");!o&&-1!==i;)i=(r=r.substr(0,i)).lastIndexOf("."),o=Boolean(t.hasOwnProperty(r)&&n(t[r]));return o}(e)&&(!0===o?s():setTimeout(s,0),!0)}e.publish=function(t,r){return s(t,r,!1,e.immediateExceptions)},e.publishSync=function(t,r){return s(t,r,!0,e.immediateExceptions)},e.subscribe=function(e,n){if("function"!=typeof n)return!1;e="symbol"==typeof e?e.toString():e,t.hasOwnProperty(e)||(t[e]={});var o="uid_"+String(++r);return t[e][o]=n,o},e.subscribeOnce=function(t,r){var n=e.subscribe(t,(function(){e.unsubscribe(n),r.apply(this,arguments)}));return e},e.clearAllSubscriptions=function(){t={}},e.clearSubscriptions=function(e){var r;for(r in t)t.hasOwnProperty(r)&&0===r.indexOf(e)&&delete t[r]},e.countSubscriptions=function(e){var r,n=0;for(r in t)t.hasOwnProperty(r)&&0===r.indexOf(e)&&n++;return n},e.getSubscriptions=function(e){var r,n=[];for(r in t)t.hasOwnProperty(r)&&0===r.indexOf(e)&&n.push(r);return n},e.unsubscribe=function(r){var n,o,i,a="string"==typeof r&&(t.hasOwnProperty(r)||function(e){var r;for(r in t)if(t.hasOwnProperty(r)&&0===r.indexOf(e))return!0;return!1}(r)),s=!a&&"string"==typeof r,c="function"==typeof r,u=!1;if(!a){for(n in t)if(t.hasOwnProperty(n)){if(o=t[n],s&&o[r]){delete o[r],u=r;break}if(c)for(i in o)o.hasOwnProperty(i)&&o[i]===r&&(delete o[i],u=!0)}return u}e.clearSubscriptions(r)}}(o),"function"==typeof i&&i.amd?i((function(){return o})):(void 0!==e&&e.exports&&(r=e.exports=o),r.PubSub=o,e.exports=r=o)}("object"==typeof window&&window||t)})),n=(r.PubSub,function(e,t){return function r(){null==t&&(t=e.length);var n=[].slice.call(arguments);return n.length>=t?e.apply(this,n):function(){return r.apply(this,n.concat([].slice.call(arguments)))}}});const o=e=>{if(e.length>0&&"/"!==e[0])throw Error("Invalid JSON Pointer");return e.split("/").slice(1).map(f)},i=(e,t,r,n)=>{if(0===e.length)return r;if(e.length>1){const o=e.shift();return{...t,[o]:i(e,p(t,o,n),r,u(o,n))}}if(Array.isArray(t)){const n=[...t];return n[d(t,e[0])]=r,n}return"object"==typeof t&&null!==t?{...t,[e[0]]:r}:p(t,e[0],n)},a=(e,t,r,n)=>{if(0!==e.length)if(1!==e.length||h(t)){const o=e.shift();a(e,p(t,o,n),r,u(o,n))}else{t[d(t,e[0])]=r}},s=(e,t,r)=>{if(0!=e.length){if(e.length>1){const n=e.shift(),o=p(t,n,r);return{...t,[n]:s(e,o,u(n,r))}}if(Array.isArray(t))return t.filter((t,r)=>r!=e[0]);if("object"==typeof t&&null!==t){const{[e[0]]:r,...n}=t;return n}return p(t,e[0],r)}},c=(e,t,r)=>{if(0!==e.length)if(e.length>1){const n=e.shift(),o=p(t,n,r);c(e,o,u(n,r))}else Array.isArray(t)?t.splice(e[0],1):"object"==typeof t&&null!==t?delete t[e[0]]:p(t,e[0],r)},u=n((e,t)=>t+"/"+l(e)),l=e=>e.toString().replace(/~/g,"~0").replace(/\//g,"~1"),f=e=>e.toString().replace(/~1/g,"/").replace(/~0/g,"~"),d=(e,t)=>Array.isArray(e)&&"-"===t?e.length:t,p=(e,t,r="")=>{if(void 0===e)throw TypeError(`Value at '${r}' is undefined and does not have property '${t}'`);if(null===e)throw TypeError(`Value at '${r}' is null and does not have property '${t}'`);if(h(e))throw TypeError(`Value at '${r}' is a ${typeof e} and does not have property '${t}'`);return e[d(e,t)]},h=e=>null===e||"object"!=typeof e;var y={nil:"",append:u,get:(e,t)=>{const r=o(e),n=e=>r.reduce(([e,t],r)=>[p(e,r,t),u(r,t)],[e,""])[0];return void 0===t?n:n(t)},set:(e,t,r)=>{const a=o(e),s=n((e,t)=>i(a,e,t,""));return void 0===t?s:s(t,r)},assign:(e,t,r)=>{const i=o(e),s=n((e,t)=>a(i,e,t,""));return void 0===t?s:s(t,r)},unset:(e,t)=>{const r=o(e),n=e=>s(r,e,"");return void 0===t?n:n(t)},delete:(e,t)=>{const r=o(e),n=e=>c(r,e,"");return void 0===t?n:n(t)}};var v={isObject:e=>"object"==typeof e&&!Array.isArray(e)&&null!==e,splitUrl:e=>{const t=e.indexOf("#"),r=-1===t?e.length:t,n=e.slice(0,r),o=e.slice(r+1);return[decodeURI(n),decodeURI(o)]}};const{splitUrl:b}=v,m=Object.freeze({id:"",pointer:"",instance:void 0}),w=(e,t=m)=>Object.freeze({...t,pointer:b(e)[1]}),g=e=>y.get(e.pointer,e.instance),O=(e,t)=>{const r=y.append(e,t.pointer);return w("#"+encodeURI(r),t)},E=n((e,t)=>g(t).map((r,n)=>e(O(n,t),n))),$=n((e,t)=>g(t).map((e,r)=>O(r,t)).filter((t,r)=>e(t,r))),P=n((e,t,r)=>g(r).reduce((t,n,o)=>e(t,O(o,r),o),t)),j=n((e,t)=>Object.keys(g(t)).every((r,n)=>e(O(r,t),n))),x=n((e,t)=>Object.keys(g(t)).some((r,n)=>e(O(r,t),n)));var A={cons:(e,t="")=>Object.freeze({...m,id:t,instance:e}),get:w,uri:e=>`${e.id}#${encodeURI(e.pointer)}`,value:g,step:O,entries:e=>Object.keys(g(e)).map(t=>[t,O(t,e)]),map:E,filter:$,reduce:P,every:j,some:x},S=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,I=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,V=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,T=/\\([\u000b\u0020-\u00ff])/g,k=/([\\"])/g,R=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/; | ||
var JSC=function(e){"use strict";var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var r=function(e,t){return e(t={exports:{}},t.exports),t.exports}((function(e,r){!function(t,n){var o={};t.PubSub=o;var i=t.define;!function(e){var t={},r=-1;function n(e){var t;for(t in e)if(e.hasOwnProperty(t))return!0;return!1}function o(e,t,r){try{e(t,r)}catch(e){setTimeout(function(e){return function(){throw e}}(e),0)}}function i(e,t,r){e(t,r)}function a(e,r,n,a){var s,c=t[r],u=a?i:o;if(t.hasOwnProperty(r))for(s in c)c.hasOwnProperty(s)&&u(c[s],e,n)}function s(e,r,o,i){var s=function(e,t,r){return function(){var n=String(e),o=n.lastIndexOf(".");for(a(e,e,t,r);-1!==o;)o=(n=n.substr(0,o)).lastIndexOf("."),a(e,n,t,r)}}(e="symbol"==typeof e?e.toString():e,r,i);return!!function(e){for(var r=String(e),o=Boolean(t.hasOwnProperty(r)&&n(t[r])),i=r.lastIndexOf(".");!o&&-1!==i;)i=(r=r.substr(0,i)).lastIndexOf("."),o=Boolean(t.hasOwnProperty(r)&&n(t[r]));return o}(e)&&(!0===o?s():setTimeout(s,0),!0)}e.publish=function(t,r){return s(t,r,!1,e.immediateExceptions)},e.publishSync=function(t,r){return s(t,r,!0,e.immediateExceptions)},e.subscribe=function(e,n){if("function"!=typeof n)return!1;e="symbol"==typeof e?e.toString():e,t.hasOwnProperty(e)||(t[e]={});var o="uid_"+String(++r);return t[e][o]=n,o},e.subscribeOnce=function(t,r){var n=e.subscribe(t,(function(){e.unsubscribe(n),r.apply(this,arguments)}));return e},e.clearAllSubscriptions=function(){t={}},e.clearSubscriptions=function(e){var r;for(r in t)t.hasOwnProperty(r)&&0===r.indexOf(e)&&delete t[r]},e.countSubscriptions=function(e){var r,n=0;for(r in t)t.hasOwnProperty(r)&&0===r.indexOf(e)&&n++;return n},e.getSubscriptions=function(e){var r,n=[];for(r in t)t.hasOwnProperty(r)&&0===r.indexOf(e)&&n.push(r);return n},e.unsubscribe=function(r){var n,o,i,a="string"==typeof r&&(t.hasOwnProperty(r)||function(e){var r;for(r in t)if(t.hasOwnProperty(r)&&0===r.indexOf(e))return!0;return!1}(r)),s=!a&&"string"==typeof r,c="function"==typeof r,u=!1;if(!a){for(n in t)if(t.hasOwnProperty(n)){if(o=t[n],s&&o[r]){delete o[r],u=r;break}if(c)for(i in o)o.hasOwnProperty(i)&&o[i]===r&&(delete o[i],u=!0)}return u}e.clearSubscriptions(r)}}(o),"function"==typeof i&&i.amd?i((function(){return o})):(void 0!==e&&e.exports&&(r=e.exports=o),r.PubSub=o,e.exports=r=o)}("object"==typeof window&&window||t)})),n=(r.PubSub,function(e,t){return function r(){null==t&&(t=e.length);var n=[].slice.call(arguments);return n.length>=t?e.apply(this,n):function(){return r.apply(this,n.concat([].slice.call(arguments)))}}});const o=e=>{if(e.length>0&&"/"!==e[0])throw Error("Invalid JSON Pointer");return e.split("/").slice(1).map(f)},i=(e,t,r,n)=>{if(0===e.length)return r;if(e.length>1){const o=e.shift();return{...t,[o]:i(e,p(t,o,n),r,u(o,n))}}if(Array.isArray(t)){const n=[...t];return n[d(t,e[0])]=r,n}return"object"==typeof t&&null!==t?{...t,[e[0]]:r}:p(t,e[0],n)},a=(e,t,r,n)=>{if(0!==e.length)if(1!==e.length||h(t)){const o=e.shift();a(e,p(t,o,n),r,u(o,n))}else{t[d(t,e[0])]=r}},s=(e,t,r)=>{if(0!=e.length){if(e.length>1){const n=e.shift(),o=p(t,n,r);return{...t,[n]:s(e,o,u(n,r))}}if(Array.isArray(t))return t.filter((t,r)=>r!=e[0]);if("object"==typeof t&&null!==t){const{[e[0]]:r,...n}=t;return n}return p(t,e[0],r)}},c=(e,t,r)=>{if(0!==e.length)if(e.length>1){const n=e.shift(),o=p(t,n,r);c(e,o,u(n,r))}else Array.isArray(t)?t.splice(e[0],1):"object"==typeof t&&null!==t?delete t[e[0]]:p(t,e[0],r)},u=n((e,t)=>t+"/"+l(e)),l=e=>e.toString().replace(/~/g,"~0").replace(/\//g,"~1"),f=e=>e.toString().replace(/~1/g,"/").replace(/~0/g,"~"),d=(e,t)=>Array.isArray(e)&&"-"===t?e.length:t,p=(e,t,r="")=>{if(void 0===e)throw TypeError(`Value at '${r}' is undefined and does not have property '${t}'`);if(null===e)throw TypeError(`Value at '${r}' is null and does not have property '${t}'`);if(h(e))throw TypeError(`Value at '${r}' is a ${typeof e} and does not have property '${t}'`);return e[d(e,t)]},h=e=>null===e||"object"!=typeof e;var y={nil:"",append:u,get:(e,t)=>{const r=o(e),n=e=>r.reduce(([e,t],r)=>[p(e,r,t),u(r,t)],[e,""])[0];return void 0===t?n:n(t)},set:(e,t,r)=>{const a=o(e),s=n((e,t)=>i(a,e,t,""));return void 0===t?s:s(t,r)},assign:(e,t,r)=>{const i=o(e),s=n((e,t)=>a(i,e,t,""));return void 0===t?s:s(t,r)},unset:(e,t)=>{const r=o(e),n=e=>s(r,e,"");return void 0===t?n:n(t)},delete:(e,t)=>{const r=o(e),n=e=>c(r,e,"");return void 0===t?n:n(t)}};var v={isObject:e=>"object"==typeof e&&!Array.isArray(e)&&null!==e,splitUrl:e=>{const t=e.indexOf("#"),r=-1===t?e.length:t,n=e.slice(0,r),o=e.slice(r+1);return[decodeURI(n),decodeURI(o)]}};const{splitUrl:b}=v,w=Object.freeze({id:"",pointer:"",instance:void 0}),m=(e,t=w)=>Object.freeze({...t,pointer:b(e)[1]}),g=e=>y.get(e.pointer,e.instance),O=(e,t)=>{const r=y.append(e,t.pointer);return m("#"+encodeURI(r),t)},E=n((e,t)=>g(t).map((r,n)=>e(O(n,t),n))),$=n((e,t)=>g(t).map((e,r)=>O(r,t)).filter((t,r)=>e(t,r))),P=n((e,t,r)=>g(r).reduce((t,n,o)=>e(t,O(o,r),o),t)),j=n((e,t)=>Object.keys(g(t)).every((r,n)=>e(O(r,t),n))),x=n((e,t)=>Object.keys(g(t)).some((r,n)=>e(O(r,t),n)));var A={cons:(e,t="")=>Object.freeze({...w,id:t,instance:e}),get:m,uri:e=>`${e.id}#${encodeURI(e.pointer)}`,value:g,step:O,entries:e=>Object.keys(g(e)).map(t=>[t,O(t,e)]),map:E,filter:$,reduce:P,every:j,some:x},S=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,I=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,V=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,T=/\\([\u000b\u0020-\u00ff])/g,k=/([\\"])/g,R=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/; | ||
/*! | ||
@@ -6,3 +6,3 @@ * content-type | ||
* MIT Licensed | ||
*/function C(e){var t=String(e);if(V.test(t))return t;if(t.length>0&&!I.test(t))throw new TypeError("invalid parameter value");return'"'+t.replace(k,"\\$1")+'"'}function K(e){this.parameters=Object.create(null),this.type=e}var L={format:function(e){if(!e||"object"!=typeof e)throw new TypeError("argument obj is required");var t=e.parameters,r=e.type;if(!r||!R.test(r))throw new TypeError("invalid type");var n=r;if(t&&"object"==typeof t)for(var o,i=Object.keys(t).sort(),a=0;a<i.length;a++){if(o=i[a],!V.test(o))throw new TypeError("invalid parameter name");n+="; "+o+"="+C(t[o])}return n},parse:function(e){if(!e)throw new TypeError("argument string is required");var t="object"==typeof e?function(e){var t;"function"==typeof e.getHeader?t=e.getHeader("content-type"):"object"==typeof e.headers&&(t=e.headers&&e.headers["content-type"]);if("string"!=typeof t)throw new TypeError("content-type header is missing from object");return t}(e):e;if("string"!=typeof t)throw new TypeError("argument string is required to be a string");var r=t.indexOf(";"),n=-1!==r?t.substr(0,r).trim():t.trim();if(!R.test(n))throw new TypeError("invalid media type");var o=new K(n.toLowerCase());if(-1!==r){var i,a,s;for(S.lastIndex=r;a=S.exec(t);){if(a.index!==r)throw new TypeError("invalid parameter format");r+=a[0].length,i=a[1].toLowerCase(),'"'===(s=a[2])[0]&&(s=s.substr(1,s.length-2).replace(T,"$1")),o.parameters[i]=s}if(r!==t.length)throw new TypeError("invalid parameter format")}return o}},U=function(e,t){if(e=e.trim(),(t=t.trim()).startsWith("about:"))return t;const r=function(e){const t={host:"",path:"",query:"",protocol:""};let r=e,n=e.indexOf("//");t.protocol=r.substring(0,n),n+=2;const o=e.indexOf("/",n),i=e.indexOf("?"),a=e.indexOf("#");-1!==a&&(r=r.substring(0,a));if(-1!==i){const e=r.substring(i);t.query=e,r=r.substring(0,i)}if(-1!==o){const e=r.substring(0,o);t.host=e,r=r.substring(o),t.path=r}else t.host=r;return t}(e),n=function(e){const t={href:e,hash:"",query:"",netPath:!1,absolutePath:!1,relativePath:!1};if(W.test(e))return t.netPath=!0,t;"/"===e[0]?t.absolutePath=!0:""!==e&&(t.relativePath=!0);let r=e;const n=e.indexOf("?"),o=e.indexOf("#");if(-1!==o){const e=r.substring(o);t.hash=e,r=r.substring(0,o)}if(-1!==n){const e=r.substring(n);t.query=e,r=r.substring(0,n)}return t.path=r,t}(t);if(!r.protocol&&!n.netPath)throw new Error("Error, protocol is not specified");if(n.netPath)return n.href.startsWith("//")&&(n.href=r.protocol+n.href),function(e){const t=e.indexOf("//")+2,r=!e.includes("/",t),n=!e.includes("?",t),o=!e.includes("#",t);return r&&n&&o}(n.href)?q(n.href):n.href;if(n.absolutePath){const{path:e,query:t,hash:o}=n;return r.host+z(e)+t+o}if(n.relativePath){const{path:e,query:t,hash:o}=n;let i,a=r.path,s=r.host;return 0===e.length?i=a:(a=a.substring(0,a.lastIndexOf("/")),i=z(a+"/"+e)),s+=""!==i||t||o?i+t+o:"/",s}{const{host:e,path:t,query:o}=r;return t||o?e+t+o+n.hash:q(e)}};function q(e){return e+("/"===e[e.length-1]?"":"/")}function z(e){let t=e.split("/");""===t[0]&&(t=t.slice(1));let r=[];return t.forEach((e,n)=>{"."!==e&&(".."===e?r.pop():""===e&&n!==t.length-1||r.push(e))}),"/"+r.join("/")}const W=new RegExp("^([a-z][a-z0-9+.-]*:)?//","i");var _=fetch;const{isObject:B,splitUrl:D}=v,F=Symbol("$__jref"),Z={},J={},M=(e,t)=>{const r=e in J?J[e]:e;if(r in Z)return Z[r][t]},N={},G={},H=(e,t="",r="")=>{e=JSON.parse(JSON.stringify(e));const n=D(e.$schema||r)[0];if(!n)throw Error("Couldn't determine schema version");delete e.$schema;const o=M(n,"idToken"),i=D(t)[0],a=ee(i,e[o]||""),s=D(a)[0];if(!s)throw Error("Couldn't determine an identifier for the schema");i&&(G[i]=s);const c=!!e.$recursiveAnchor;let u;delete e.$recursiveAnchor,M(n,"vocabulary")&&B(e)&&"$vocabulary"in e?(J[s]=n,u=e.$vocabulary,delete e.$vocabulary):u=s===n?{[n]:!0}:{};const l={};N[s]={id:s,schemaVersion:n,schema:Q(e,s,n,y.nil,l),anchors:l,recursiveAnchor:c,vocabulary:u,validated:!1}},Q=(e,t,r,n,o)=>{if(B(e)){const i=M(r,"idToken"),a=M(r,"anchorToken");if("string"==typeof e[i]){const n=e[i],o=ee(t,n),[s,c]=D(o);if(delete e[i],c&&(e[a]=a!==i?encodeURI(c):"#"+encodeURI(c)),s!==t)return H(e,ee(t,s),r),{[F]:n}}if("string"==typeof e[a]){const t=a!==i?e[a]:e[a].slice(1);o[t]=n,delete e[a]}return Object.entries(e).reduce((e,[i,a])=>(e[i]=Q(a,t,r,y.append(i,n),o),e),{})}return Array.isArray(e)?e.map((e,i)=>Q(e,t,r,y.append(i,n),o)):e},X=Object.freeze({id:"",schemaVersion:void 0,pointer:"",schema:void 0,recursiveAnchor:!1}),Y=async(e,t=X,r=!1)=>{const n=r&&t.recursiveAnchor?t.recursiveAnchor:ne(t),o=ee(n,e),[i,a]=D(o);if(!(e=>e in N||e in G)(i)){const e=await _(i,{headers:{Accept:"application/schema+json"}});if(e.status>=400)throw await e.text(),Error("Failed to retrieve schema with id: "+i);if(e.headers.has("content-type")){const t=L.parse(e.headers.get("content-type")).type;if("application/schema+json"!==t)throw Error(`${i} is not a schema. Found a document with media type: ${t}`)}H(await e.json(),i)}const s=(e=>N[G[e]]||N[e])(i),c=Object.freeze({id:s.id,schemaVersion:s.schemaVersion,vocabulary:s.vocabulary,pointer:a&&"/"!==a[0]?re(s,a):a,schema:s.schema,recursiveAnchor:t.recursiveAnchor||!!s.recursiveAnchor&&i,validated:s.validated}),u=oe(c);return B(u)&&F in u?Y(u[F],c):M(c.schemaVersion,"jsonReference")&&B(u)&&"string"==typeof u.$ref?Y(u.$ref,c):M(c.schemaVersion,"keywordReference")&&"string"==typeof u&&c.pointer.endsWith("/$ref")?Y(u,c):M(c.schemaVersion,"keywordRecursiveReference")&&"string"==typeof u&&c.pointer.endsWith("/$recursiveRef")?Y(u,c,!0):c},ee=(e,t)=>{const r=U(e,t),n=D(e)[0];if(n&&"file"===te(r)&&"file"!==te(n))throw Error(`Can't access file '${r}' resource from network context '${e}'`);return r},te=e=>{const t=e.match(/^(.+):\/\//);return t?t[1]:""},re=(e,t)=>{if(!(t in e.anchors))throw Error(`No such anchor '${encodeURI(e.id)}#${encodeURI(t)}'`);return e.anchors[t]},ne=e=>`${e.id}#${encodeURI(e.pointer)}`,oe=e=>y.get(e.pointer,e.schema),ie=(e,t)=>{const r=y.append(e,t.pointer);return Y("#"+encodeURI(r),t)},ae=n((e,t)=>oe(t).map(async(r,n)=>e(await ie(n,t),n)));var se={setConfig:(e,t,r)=>{Z[e]||(Z[e]={}),Z[e][t]=r},getConfig:M,add:H,get:Y,markValidated:e=>{N[e].validated=!0},uri:ne,value:oe,has:(e,t)=>e in oe(t),step:ie,entries:e=>Object.keys(oe(e)).map(t=>[t,ie(t,e)]),map:ae};const ce="FLAG",ue="BASIC",le="DETAILED",fe="VERBOSE";let de=le,pe=!0;const he=(e,t)=>(n,o=ce)=>{if(![ce,ue,le,fe].includes(o))throw Error(`The '${o}' error format is not supported`);let i=[];const a=r.subscribe("result",ye(o,i));return Pe(t,n,e),r.unsubscribe(a),i[0]},ye=(e,t)=>{const r=[];return(n,o)=>{const i={...o,errors:[]};for(;r.length>0&&ve(r[r.length-1],i);){const t=r.pop();let n=[];if(e===ue&&(n=t.errors,delete t.errors),i.errors.unshift(t,...n),be(i))break}(e===fe||e!==ce&&!i.valid)&&r.push(i),t[0]=i}},ve=(e,t)=>e.instanceLocation.startsWith(t.instanceLocation)&&(e.absoluteKeywordLocation.startsWith(t.absoluteKeywordLocation)||be(e)),be=e=>e.keyword.endsWith("#$ref")||e.keyword.endsWith("#$recursiveRef"),me={},we=e=>me[e],ge=e=>e in me,Oe={},Ee={},$e=async(e,t)=>{if(!ge(e.schemaVersion+"#validate")){const t=await se.get(e.schemaVersion);(se.getConfig(t.id,"mandatoryVocabularies")||[]).forEach(e=>{if(!t.vocabulary[e])throw Error(`Vocabulary '${e}' must be explicitly declared and required`)}),Object.entries(t.vocabulary).forEach(([e,r])=>{if(e in Oe)Object.entries(Oe[e]).forEach(([e,r])=>{((e,t)=>{me[e]={collectEvaluatedItems:(e,r,n)=>t.interpret(e,r,n)&&0,collectEvaluatedProperties:(e,r,n)=>t.interpret(e,r,n)&&[],...t}})(`${t.id}#${e}`,r)});else if(r)throw Error("Missing required vocabulary: "+e)})}if(pe&&!e.validated){if(se.markValidated(e.id),!(e.schemaVersion in Ee)){const t=await se.get(e.schemaVersion),r={},n=await $e(t,r);Ee[t.id]=he(r,n)}const t=A.cons(e.schema,e.id),r=Ee[e.schemaVersion](t,de);if(!r.valid)throw r}return await we(e.schemaVersion+"#validate").compile(e,t),se.uri(e)},Pe=(e,t,r)=>{const[n]=r[e];return we(n).interpret(e,t,r)};var je={validate:async(e,t,r)=>{const n={},o=await $e(e,n),i=(e,t=ce)=>he(n,o)(A.cons(e),t);return void 0===t?i:i(t,r)},setMetaOutputFormat:e=>{de=e},setShouldMetaValidate:e=>{pe=e},FLAG:ce,BASIC:ue,DETAILED:le,VERBOSE:fe,getKeyword:we,hasKeyword:ge,defineVocabulary:(e,t)=>{Oe[e]=t},compileSchema:$e,interpretSchema:Pe,collectEvaluatedProperties:(e,t,r,n)=>{const[o]=r[e];return we(o).collectEvaluatedProperties(e,t,r,n)},collectEvaluatedItems:(e,t,r,n)=>{const[o]=r[e];return we(o).collectEvaluatedItems(e,t,r,n)}};var xe={compile:()=>{},interpret:()=>!0},Ae=async e=>Object.entries(await e),Se=n(async(e,t)=>(await t).map(e)),Ie=n(async(e,t,r)=>(await r).reduce(async(t,r)=>e(await t,r),t)),Ve=n(async(e,t,r={})=>Ie(async(t,r)=>await e(r)?t.concat([r]):t,[],t,r)),Te=n(async(e,t)=>{const r=await Se(e,t);return(await Promise.all(r)).some(e=>e)}),ke=n(async(e,t)=>{const r=await Se(e,t);return(await Promise.all(r)).every(e=>e)}),Re=n((e,t)=>e.reduce(async(e,t)=>t(await e),t)),Ce={entries:Ae,map:Se,filter:Ve,reduce:Ie,some:Te,every:ke,pipeline:Re,all:e=>Promise.all(e),allValues:e=>Re([Ae,Ie(async(e,[t,r])=>(e[t]=await r,e),{})],e)};var Ke={compile:async(e,t)=>{const r=se.uri(e);if(!(r in t)){t[r]=!1;const n=se.value(e);t[r]=[e.schemaVersion+"#validate",se.uri(e),"boolean"==typeof n?n:await Ce.pipeline([se.entries,Ce.map(([t,r])=>[`${e.schemaVersion}#${t}`,r]),Ce.filter(([t])=>je.hasKeyword(t)&&t!==e.schemaVersion+"#validate"),Ce.map(async([r,n])=>{const o=await n,i=await je.getKeyword(r).compile(o,t,e);return[r,se.uri(o),i]}),Ce.all],e)]}},interpret:(e,t,n)=>{const[o,i,a]=n[e],s="boolean"==typeof a?a:a.every(([e,o,i])=>{const a=je.getKeyword(e).interpret(i,t,n);return r.publishSync("result",{keyword:e,absoluteKeywordLocation:o,instanceLocation:A.uri(t),valid:a}),a});return r.publishSync("result",{keyword:o,absoluteKeywordLocation:i,instanceLocation:A.uri(t),valid:s}),s},collectEvaluatedProperties:(e,t,r,n=!1)=>{const o=r[e][2];return"boolean"==typeof o?!!o&&[]:o.filter(([e])=>!n||!e.endsWith("#unevaluatedProperties")).reduce((e,[n,,o])=>{const i=e&&je.getKeyword(n).collectEvaluatedProperties(o,t,r);return i&&e.concat(i)},[])},collectEvaluatedItems:(e,t,r,n=!1)=>{const o=r[e][2];return"boolean"==typeof o?!!o&&[]:o.filter(([e])=>!n||!e.endsWith("#unevaluatedItems")).reduce((e,[n,,o])=>{const i=!1!==e&&je.getKeyword(n).collectEvaluatedItems(o,t,r);return!1!==i&&Math.max(e,i)},0)}},Le={Core:je,Schema:se,Instance:A,Keywords:{metaData:xe,validate:Ke}},Ue=Le.Core,qe=Le.Schema,ze=Le.Instance,We=Le.Keywords;return e.Core=Ue,e.Instance=ze,e.Keywords=We,e.Schema=qe,e.default=Le,e}({}); | ||
*/function C(e){var t=String(e);if(V.test(t))return t;if(t.length>0&&!I.test(t))throw new TypeError("invalid parameter value");return'"'+t.replace(k,"\\$1")+'"'}function K(e){this.parameters=Object.create(null),this.type=e}var L={format:function(e){if(!e||"object"!=typeof e)throw new TypeError("argument obj is required");var t=e.parameters,r=e.type;if(!r||!R.test(r))throw new TypeError("invalid type");var n=r;if(t&&"object"==typeof t)for(var o,i=Object.keys(t).sort(),a=0;a<i.length;a++){if(o=i[a],!V.test(o))throw new TypeError("invalid parameter name");n+="; "+o+"="+C(t[o])}return n},parse:function(e){if(!e)throw new TypeError("argument string is required");var t="object"==typeof e?function(e){var t;"function"==typeof e.getHeader?t=e.getHeader("content-type"):"object"==typeof e.headers&&(t=e.headers&&e.headers["content-type"]);if("string"!=typeof t)throw new TypeError("content-type header is missing from object");return t}(e):e;if("string"!=typeof t)throw new TypeError("argument string is required to be a string");var r=t.indexOf(";"),n=-1!==r?t.substr(0,r).trim():t.trim();if(!R.test(n))throw new TypeError("invalid media type");var o=new K(n.toLowerCase());if(-1!==r){var i,a,s;for(S.lastIndex=r;a=S.exec(t);){if(a.index!==r)throw new TypeError("invalid parameter format");r+=a[0].length,i=a[1].toLowerCase(),'"'===(s=a[2])[0]&&(s=s.substr(1,s.length-2).replace(T,"$1")),o.parameters[i]=s}if(r!==t.length)throw new TypeError("invalid parameter format")}return o}},U=function(e,t){if(e=e.trim(),(t=t.trim()).startsWith("about:"))return t;const r=function(e){const t={host:"",path:"",query:"",protocol:""};let r=e,n=e.indexOf("//");t.protocol=r.substring(0,n),n+=2;const o=e.indexOf("/",n),i=e.indexOf("?"),a=e.indexOf("#");-1!==a&&(r=r.substring(0,a));if(-1!==i){const e=r.substring(i);t.query=e,r=r.substring(0,i)}if(-1!==o){const e=r.substring(0,o);t.host=e,r=r.substring(o),t.path=r}else t.host=r;return t}(e),n=function(e){const t={href:e,hash:"",query:"",netPath:!1,absolutePath:!1,relativePath:!1};if(W.test(e))return t.netPath=!0,t;"/"===e[0]?t.absolutePath=!0:""!==e&&(t.relativePath=!0);let r=e;const n=e.indexOf("?"),o=e.indexOf("#");if(-1!==o){const e=r.substring(o);t.hash=e,r=r.substring(0,o)}if(-1!==n){const e=r.substring(n);t.query=e,r=r.substring(0,n)}return t.path=r,t}(t);if(!r.protocol&&!n.netPath)throw new Error("Error, protocol is not specified");if(n.netPath)return n.href.startsWith("//")&&(n.href=r.protocol+n.href),function(e){const t=e.indexOf("//")+2,r=!e.includes("/",t),n=!e.includes("?",t),o=!e.includes("#",t);return r&&n&&o}(n.href)?q(n.href):n.href;if(n.absolutePath){const{path:e,query:t,hash:o}=n;return r.host+z(e)+t+o}if(n.relativePath){const{path:e,query:t,hash:o}=n;let i,a=r.path,s=r.host;return 0===e.length?i=a:(a=a.substring(0,a.lastIndexOf("/")),i=z(a+"/"+e)),s+=""!==i||t||o?i+t+o:"/",s}{const{host:e,path:t,query:o}=r;return t||o?e+t+o+n.hash:q(e)}};function q(e){return e+("/"===e[e.length-1]?"":"/")}function z(e){let t=e.split("/");""===t[0]&&(t=t.slice(1));let r=[];return t.forEach((e,n)=>{"."!==e&&(".."===e?r.pop():""===e&&n!==t.length-1||r.push(e))}),"/"+r.join("/")}const W=new RegExp("^([a-z][a-z0-9+.-]*:)?//","i");var _=fetch;const{isObject:B,splitUrl:D}=v,F=Symbol("$__jref"),Z={},J={},M=(e,t)=>{const r=e in J?J[e]:e;if(r in Z)return Z[r][t]},N={},G={},H=(e,t="",r="")=>{e=JSON.parse(JSON.stringify(e));const n=D(e.$schema||r)[0];if(!n)throw Error("Couldn't determine schema version");delete e.$schema;const o=M(n,"idToken"),i=D(t)[0],a=ee(i,e[o]||""),s=D(a)[0];if(!s)throw Error("Couldn't determine an identifier for the schema");i&&(G[i]=s);const c=!!e.$recursiveAnchor;let u;delete e.$recursiveAnchor,M(n,"vocabulary")&&B(e)&&"$vocabulary"in e?(J[s]=n,u=e.$vocabulary,delete e.$vocabulary):u=s===n?{[n]:!0}:{};const l={};N[s]={id:s,schemaVersion:n,schema:Q(e,s,n,y.nil,l),anchors:l,recursiveAnchor:c,vocabulary:u,validated:!1}},Q=(e,t,r,n,o)=>{if(B(e)){const i=M(r,"idToken"),a=M(r,"anchorToken");if("string"==typeof e[i]){const n=e[i],o=ee(t,n),[s,c]=D(o);if(delete e[i],c&&(e[a]=a!==i?encodeURI(c):"#"+encodeURI(c)),s!==t)return H(e,ee(t,s),r),{[F]:n}}if("string"==typeof e[a]){const t=a!==i?e[a]:e[a].slice(1);o[t]=n,delete e[a]}return Object.entries(e).reduce((e,[i,a])=>(e[i]=Q(a,t,r,y.append(i,n),o),e),{})}return Array.isArray(e)?e.map((e,i)=>Q(e,t,r,y.append(i,n),o)):e},X=Object.freeze({id:"",schemaVersion:void 0,pointer:"",schema:void 0,recursiveAnchor:!1}),Y=async(e,t=X,r=!1)=>{const n=r&&t.recursiveAnchor?t.recursiveAnchor:ne(t),o=ee(n,e),[i,a]=D(o);if(!(e=>e in N||e in G)(i)){const e=await _(i,{headers:{Accept:"application/schema+json"}});if(e.status>=400)throw await e.text(),Error("Failed to retrieve schema with id: "+i);if(e.headers.has("content-type")){const t=L.parse(e.headers.get("content-type")).type;if("application/schema+json"!==t)throw Error(`${i} is not a schema. Found a document with media type: ${t}`)}H(await e.json(),i)}const s=(e=>N[G[e]]||N[e])(i),c=Object.freeze({id:s.id,schemaVersion:s.schemaVersion,vocabulary:s.vocabulary,pointer:a&&"/"!==a[0]?re(s,a):a,schema:s.schema,recursiveAnchor:t.recursiveAnchor||!!s.recursiveAnchor&&i,validated:s.validated}),u=oe(c);return B(u)&&F in u?Y(u[F],c):M(c.schemaVersion,"jsonReference")&&B(u)&&"string"==typeof u.$ref?Y(u.$ref,c):M(c.schemaVersion,"keywordReference")&&"string"==typeof u&&c.pointer.endsWith("/$ref")?Y(u,c):M(c.schemaVersion,"keywordRecursiveReference")&&"string"==typeof u&&c.pointer.endsWith("/$recursiveRef")?Y(u,c,!0):c},ee=(e,t)=>{const r=U(e,t),n=D(e)[0];if(n&&"file"===te(r)&&"file"!==te(n))throw Error(`Can't access file '${r}' resource from network context '${e}'`);return r},te=e=>{const t=e.match(/^(.+):\/\//);return t?t[1]:""},re=(e,t)=>{if(!(t in e.anchors))throw Error(`No such anchor '${encodeURI(e.id)}#${encodeURI(t)}'`);return e.anchors[t]},ne=e=>`${e.id}#${encodeURI(e.pointer)}`,oe=e=>y.get(e.pointer,e.schema),ie=(e,t)=>{const r=y.append(e,t.pointer);return Y("#"+encodeURI(r),t)},ae=n((e,t)=>oe(t).map(async(r,n)=>e(await ie(n,t),n)));var se={setConfig:(e,t,r)=>{Z[e]||(Z[e]={}),Z[e][t]=r},getConfig:M,add:H,get:Y,markValidated:e=>{N[e].validated=!0},uri:ne,value:oe,has:(e,t)=>e in oe(t),step:ie,entries:e=>Object.keys(oe(e)).map(async t=>[t,await ie(t,e)]),map:ae};const ce="FLAG",ue="BASIC",le="DETAILED",fe="VERBOSE";let de=le,pe=!0;const he=(e,t)=>(n,o=ce)=>{if(![ce,ue,le,fe].includes(o))throw Error(`The '${o}' error format is not supported`);let i=[];const a=r.subscribe("result",ye(o,i));return Pe(t,n,e),r.unsubscribe(a),i[0]},ye=(e,t)=>{const r=[];return(n,o)=>{const i={...o,errors:[]};for(;r.length>0&&ve(r[r.length-1],i);){const t=r.pop();let n=[];if(e===ue&&(n=t.errors,delete t.errors),i.errors.unshift(t,...n),be(i))break}(e===fe||e!==ce&&!i.valid)&&r.push(i),t[0]=i}},ve=(e,t)=>e.instanceLocation.startsWith(t.instanceLocation)&&(e.absoluteKeywordLocation.startsWith(t.absoluteKeywordLocation)||be(e)),be=e=>e.keyword.endsWith("#$ref")||e.keyword.endsWith("#$recursiveRef"),we={},me=e=>we[e],ge=e=>e in we,Oe={},Ee={},$e=async(e,t)=>{if(!ge(e.schemaVersion+"#validate")){const t=await se.get(e.schemaVersion);(se.getConfig(t.id,"mandatoryVocabularies")||[]).forEach(e=>{if(!t.vocabulary[e])throw Error(`Vocabulary '${e}' must be explicitly declared and required`)}),Object.entries(t.vocabulary).forEach(([e,r])=>{if(e in Oe)Object.entries(Oe[e]).forEach(([e,r])=>{((e,t)=>{we[e]={collectEvaluatedItems:(e,r,n)=>t.interpret(e,r,n)&&0,collectEvaluatedProperties:(e,r,n)=>t.interpret(e,r,n)&&[],...t}})(`${t.id}#${e}`,r)});else if(r)throw Error("Missing required vocabulary: "+e)})}if(pe&&!e.validated){if(se.markValidated(e.id),!(e.schemaVersion in Ee)){const t=await se.get(e.schemaVersion),r={},n=await $e(t,r);Ee[t.id]=he(r,n)}const t=A.cons(e.schema,e.id),r=Ee[e.schemaVersion](t,de);if(!r.valid)throw r}return await me(e.schemaVersion+"#validate").compile(e,t),se.uri(e)},Pe=(e,t,r)=>{const[n]=r[e];return me(n).interpret(e,t,r)};var je={validate:async(e,t,r)=>{const n={},o=await $e(e,n),i=(e,t=ce)=>he(n,o)(A.cons(e),t);return void 0===t?i:i(t,r)},setMetaOutputFormat:e=>{de=e},setShouldMetaValidate:e=>{pe=e},FLAG:ce,BASIC:ue,DETAILED:le,VERBOSE:fe,getKeyword:me,hasKeyword:ge,defineVocabulary:(e,t)=>{Oe[e]=t},compileSchema:$e,interpretSchema:Pe,collectEvaluatedProperties:(e,t,r,n)=>{const[o]=r[e];return me(o).collectEvaluatedProperties(e,t,r,n)},collectEvaluatedItems:(e,t,r,n)=>{const[o]=r[e];return me(o).collectEvaluatedItems(e,t,r,n)}};var xe={compile:()=>{},interpret:()=>!0},Ae=async e=>Object.entries(await e),Se=n(async(e,t)=>(await t).map(e)),Ie=n(async(e,t,r)=>(await r).reduce(async(t,r)=>{let n;try{n=await t}catch(e){try{await r}catch(e){}return t}return e(n,r)},t)),Ve=n(async(e,t,r={})=>Ie(async(t,r)=>await e(r)?t.concat([r]):t,[],t,r)),Te=n(async(e,t)=>{const r=await Se(e,t);return(await Promise.all(r)).some(e=>e)}),ke=n(async(e,t)=>{const r=await Se(e,t);return(await Promise.all(r)).every(e=>e)}),Re=n((e,t)=>e.reduce(async(e,t)=>t(await e),t)),Ce={entries:Ae,map:Se,filter:Ve,reduce:Ie,some:Te,every:ke,pipeline:Re,all:e=>Promise.all(e),allValues:e=>Re([Ae,Ie(async(e,[t,r])=>(e[t]=await r,e),{})],e)};var Ke={compile:async(e,t)=>{const r=se.uri(e);if(!(r in t)){t[r]=!1;const n=se.value(e);t[r]=[e.schemaVersion+"#validate",se.uri(e),"boolean"==typeof n?n:await Ce.pipeline([se.entries,Ce.map(async t=>{const[r,n]=await t;return[`${e.schemaVersion}#${r}`,n]}),Ce.filter(async t=>{const[r]=await t;return je.hasKeyword(r)&&r!==e.schemaVersion+"#validate"}),Ce.map(async r=>{const[n,o]=await r,i=await o,a=await je.getKeyword(n).compile(i,t,e);return[n,se.uri(i),a]}),Ce.all],e)]}},interpret:(e,t,n)=>{const[o,i,a]=n[e],s="boolean"==typeof a?a:a.every(([e,o,i])=>{const a=je.getKeyword(e).interpret(i,t,n);return r.publishSync("result",{keyword:e,absoluteKeywordLocation:o,instanceLocation:A.uri(t),valid:a}),a});return r.publishSync("result",{keyword:o,absoluteKeywordLocation:i,instanceLocation:A.uri(t),valid:s}),s},collectEvaluatedProperties:(e,t,r,n=!1)=>{const o=r[e][2];return"boolean"==typeof o?!!o&&[]:o.filter(([e])=>!n||!e.endsWith("#unevaluatedProperties")).reduce((e,[n,,o])=>{const i=e&&je.getKeyword(n).collectEvaluatedProperties(o,t,r);return i&&e.concat(i)},[])},collectEvaluatedItems:(e,t,r,n=!1)=>{const o=r[e][2];return"boolean"==typeof o?!!o&&[]:o.filter(([e])=>!n||!e.endsWith("#unevaluatedItems")).reduce((e,[n,,o])=>{const i=!1!==e&&je.getKeyword(n).collectEvaluatedItems(o,t,r);return!1!==i&&Math.max(e,i)},0)}},Le={Core:je,Schema:se,Instance:A,Keywords:{metaData:xe,validate:Ke}},Ue=Le.Core,qe=Le.Schema,ze=Le.Instance,We=Le.Keywords;return e.Core=Ue,e.Instance=ze,e.Keywords=We,e.Schema=qe,e.default=Le,e}({}); | ||
//# sourceMappingURL=json-schema-core-iife.min.js.map |
@@ -1218,3 +1218,3 @@ System.register('JSC', [], function (exports) { | ||
const entries$1 = (doc) => Object.keys(value$1(doc)) | ||
.map((key) => [key, step$1(key, doc)]); | ||
.map(async (key) => [key, await step$1(key, doc)]); | ||
@@ -1398,3 +1398,18 @@ const map$1 = justCurryIt((fn, doc) => value$1(doc) | ||
var reduce$1 = justCurryIt(async (fn, acc, doc) => { | ||
return (await doc).reduce(async (acc, item) => fn(await acc, item), acc); | ||
return (await doc).reduce(async (acc, item) => { | ||
let resolvedAcc; | ||
try { | ||
resolvedAcc = await acc; | ||
} catch (e) { | ||
try { | ||
await item; | ||
} catch (e) { | ||
// If we've already encountered an error, ignore subsequent errors. | ||
} | ||
return acc; | ||
} | ||
return fn(resolvedAcc, item); | ||
}, acc); | ||
}); | ||
@@ -1458,8 +1473,13 @@ | ||
schema.entries, | ||
lib.map(([keyword, keywordSchema]) => { | ||
lib.map(async (entry) => { | ||
const [keyword, keywordSchema] = await entry; | ||
const keywordId = `${schema$1.schemaVersion}#${keyword}`; | ||
return [keywordId, keywordSchema]; | ||
}), | ||
lib.filter(([keywordId]) => core.hasKeyword(keywordId) && keywordId !== `${schema$1.schemaVersion}#validate`), | ||
lib.map(async ([keywordId, keywordSchemaPromise]) => { | ||
lib.filter(async (entry) => { | ||
const [keywordId] = await entry; | ||
return core.hasKeyword(keywordId) && keywordId !== `${schema$1.schemaVersion}#validate`; | ||
}), | ||
lib.map(async (entry) => { | ||
const [keywordId, keywordSchemaPromise] = await entry; | ||
const keywordSchema = await keywordSchemaPromise; | ||
@@ -1466,0 +1486,0 @@ const keywordAst = await core.getKeyword(keywordId).compile(keywordSchema, ast, schema$1); |
@@ -1,2 +0,2 @@ | ||
System.register("JSC",[],(function(e){"use strict";return{execute:function(){var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var r=function(e,t){return e(t={exports:{}},t.exports),t.exports}((function(e,r){!function(t,n){var o={};t.PubSub=o;var i=t.define;!function(e){var t={},r=-1;function n(e){var t;for(t in e)if(e.hasOwnProperty(t))return!0;return!1}function o(e,t,r){try{e(t,r)}catch(e){setTimeout(function(e){return function(){throw e}}(e),0)}}function i(e,t,r){e(t,r)}function a(e,r,n,a){var s,c=t[r],u=a?i:o;if(t.hasOwnProperty(r))for(s in c)c.hasOwnProperty(s)&&u(c[s],e,n)}function s(e,r,o,i){var s=function(e,t,r){return function(){var n=String(e),o=n.lastIndexOf(".");for(a(e,e,t,r);-1!==o;)o=(n=n.substr(0,o)).lastIndexOf("."),a(e,n,t,r)}}(e="symbol"==typeof e?e.toString():e,r,i);return!!function(e){for(var r=String(e),o=Boolean(t.hasOwnProperty(r)&&n(t[r])),i=r.lastIndexOf(".");!o&&-1!==i;)i=(r=r.substr(0,i)).lastIndexOf("."),o=Boolean(t.hasOwnProperty(r)&&n(t[r]));return o}(e)&&(!0===o?s():setTimeout(s,0),!0)}e.publish=function(t,r){return s(t,r,!1,e.immediateExceptions)},e.publishSync=function(t,r){return s(t,r,!0,e.immediateExceptions)},e.subscribe=function(e,n){if("function"!=typeof n)return!1;e="symbol"==typeof e?e.toString():e,t.hasOwnProperty(e)||(t[e]={});var o="uid_"+String(++r);return t[e][o]=n,o},e.subscribeOnce=function(t,r){var n=e.subscribe(t,(function(){e.unsubscribe(n),r.apply(this,arguments)}));return e},e.clearAllSubscriptions=function(){t={}},e.clearSubscriptions=function(e){var r;for(r in t)t.hasOwnProperty(r)&&0===r.indexOf(e)&&delete t[r]},e.countSubscriptions=function(e){var r,n=0;for(r in t)t.hasOwnProperty(r)&&0===r.indexOf(e)&&n++;return n},e.getSubscriptions=function(e){var r,n=[];for(r in t)t.hasOwnProperty(r)&&0===r.indexOf(e)&&n.push(r);return n},e.unsubscribe=function(r){var n,o,i,a="string"==typeof r&&(t.hasOwnProperty(r)||function(e){var r;for(r in t)if(t.hasOwnProperty(r)&&0===r.indexOf(e))return!0;return!1}(r)),s=!a&&"string"==typeof r,c="function"==typeof r,u=!1;if(!a){for(n in t)if(t.hasOwnProperty(n)){if(o=t[n],s&&o[r]){delete o[r],u=r;break}if(c)for(i in o)o.hasOwnProperty(i)&&o[i]===r&&(delete o[i],u=!0)}return u}e.clearSubscriptions(r)}}(o),"function"==typeof i&&i.amd?i((function(){return o})):(void 0!==e&&e.exports&&(r=e.exports=o),r.PubSub=o,e.exports=r=o)}("object"==typeof window&&window||t)})),n=(r.PubSub,function(e,t){return function r(){null==t&&(t=e.length);var n=[].slice.call(arguments);return n.length>=t?e.apply(this,n):function(){return r.apply(this,n.concat([].slice.call(arguments)))}}});const o=e=>{if(e.length>0&&"/"!==e[0])throw Error("Invalid JSON Pointer");return e.split("/").slice(1).map(f)},i=(e,t,r,n)=>{if(0===e.length)return r;if(e.length>1){const o=e.shift();return{...t,[o]:i(e,p(t,o,n),r,u(o,n))}}if(Array.isArray(t)){const n=[...t];return n[d(t,e[0])]=r,n}return"object"==typeof t&&null!==t?{...t,[e[0]]:r}:p(t,e[0],n)},a=(e,t,r,n)=>{if(0!==e.length)if(1!==e.length||h(t)){const o=e.shift();a(e,p(t,o,n),r,u(o,n))}else{t[d(t,e[0])]=r}},s=(e,t,r)=>{if(0!=e.length){if(e.length>1){const n=e.shift(),o=p(t,n,r);return{...t,[n]:s(e,o,u(n,r))}}if(Array.isArray(t))return t.filter((t,r)=>r!=e[0]);if("object"==typeof t&&null!==t){const{[e[0]]:r,...n}=t;return n}return p(t,e[0],r)}},c=(e,t,r)=>{if(0!==e.length)if(e.length>1){const n=e.shift(),o=p(t,n,r);c(e,o,u(n,r))}else Array.isArray(t)?t.splice(e[0],1):"object"==typeof t&&null!==t?delete t[e[0]]:p(t,e[0],r)},u=n((e,t)=>t+"/"+l(e)),l=e=>e.toString().replace(/~/g,"~0").replace(/\//g,"~1"),f=e=>e.toString().replace(/~1/g,"/").replace(/~0/g,"~"),d=(e,t)=>Array.isArray(e)&&"-"===t?e.length:t,p=(e,t,r="")=>{if(void 0===e)throw TypeError(`Value at '${r}' is undefined and does not have property '${t}'`);if(null===e)throw TypeError(`Value at '${r}' is null and does not have property '${t}'`);if(h(e))throw TypeError(`Value at '${r}' is a ${typeof e} and does not have property '${t}'`);return e[d(e,t)]},h=e=>null===e||"object"!=typeof e;var y={nil:"",append:u,get:(e,t)=>{const r=o(e),n=e=>r.reduce(([e,t],r)=>[p(e,r,t),u(r,t)],[e,""])[0];return void 0===t?n:n(t)},set:(e,t,r)=>{const a=o(e),s=n((e,t)=>i(a,e,t,""));return void 0===t?s:s(t,r)},assign:(e,t,r)=>{const i=o(e),s=n((e,t)=>a(i,e,t,""));return void 0===t?s:s(t,r)},unset:(e,t)=>{const r=o(e),n=e=>s(r,e,"");return void 0===t?n:n(t)},delete:(e,t)=>{const r=o(e),n=e=>c(r,e,"");return void 0===t?n:n(t)}};var v={isObject:e=>"object"==typeof e&&!Array.isArray(e)&&null!==e,splitUrl:e=>{const t=e.indexOf("#"),r=-1===t?e.length:t,n=e.slice(0,r),o=e.slice(r+1);return[decodeURI(n),decodeURI(o)]}};const{splitUrl:b}=v,m=Object.freeze({id:"",pointer:"",instance:void 0}),w=(e,t=m)=>Object.freeze({...t,pointer:b(e)[1]}),g=e=>y.get(e.pointer,e.instance),O=(e,t)=>{const r=y.append(e,t.pointer);return w("#"+encodeURI(r),t)},E=n((e,t)=>g(t).map((r,n)=>e(O(n,t),n))),$=n((e,t)=>g(t).map((e,r)=>O(r,t)).filter((t,r)=>e(t,r))),P=n((e,t,r)=>g(r).reduce((t,n,o)=>e(t,O(o,r),o),t)),j=n((e,t)=>Object.keys(g(t)).every((r,n)=>e(O(r,t),n))),x=n((e,t)=>Object.keys(g(t)).some((r,n)=>e(O(r,t),n)));var S={cons:(e,t="")=>Object.freeze({...m,id:t,instance:e}),get:w,uri:e=>`${e.id}#${encodeURI(e.pointer)}`,value:g,step:O,entries:e=>Object.keys(g(e)).map(t=>[t,O(t,e)]),map:E,filter:$,reduce:P,every:j,some:x},A=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,I=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,V=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,T=/\\([\u000b\u0020-\u00ff])/g,k=/([\\"])/g,R=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/; | ||
System.register("JSC",[],(function(e){"use strict";return{execute:function(){var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var r=function(e,t){return e(t={exports:{}},t.exports),t.exports}((function(e,r){!function(t,n){var o={};t.PubSub=o;var i=t.define;!function(e){var t={},r=-1;function n(e){var t;for(t in e)if(e.hasOwnProperty(t))return!0;return!1}function o(e,t,r){try{e(t,r)}catch(e){setTimeout(function(e){return function(){throw e}}(e),0)}}function i(e,t,r){e(t,r)}function a(e,r,n,a){var s,c=t[r],u=a?i:o;if(t.hasOwnProperty(r))for(s in c)c.hasOwnProperty(s)&&u(c[s],e,n)}function s(e,r,o,i){var s=function(e,t,r){return function(){var n=String(e),o=n.lastIndexOf(".");for(a(e,e,t,r);-1!==o;)o=(n=n.substr(0,o)).lastIndexOf("."),a(e,n,t,r)}}(e="symbol"==typeof e?e.toString():e,r,i);return!!function(e){for(var r=String(e),o=Boolean(t.hasOwnProperty(r)&&n(t[r])),i=r.lastIndexOf(".");!o&&-1!==i;)i=(r=r.substr(0,i)).lastIndexOf("."),o=Boolean(t.hasOwnProperty(r)&&n(t[r]));return o}(e)&&(!0===o?s():setTimeout(s,0),!0)}e.publish=function(t,r){return s(t,r,!1,e.immediateExceptions)},e.publishSync=function(t,r){return s(t,r,!0,e.immediateExceptions)},e.subscribe=function(e,n){if("function"!=typeof n)return!1;e="symbol"==typeof e?e.toString():e,t.hasOwnProperty(e)||(t[e]={});var o="uid_"+String(++r);return t[e][o]=n,o},e.subscribeOnce=function(t,r){var n=e.subscribe(t,(function(){e.unsubscribe(n),r.apply(this,arguments)}));return e},e.clearAllSubscriptions=function(){t={}},e.clearSubscriptions=function(e){var r;for(r in t)t.hasOwnProperty(r)&&0===r.indexOf(e)&&delete t[r]},e.countSubscriptions=function(e){var r,n=0;for(r in t)t.hasOwnProperty(r)&&0===r.indexOf(e)&&n++;return n},e.getSubscriptions=function(e){var r,n=[];for(r in t)t.hasOwnProperty(r)&&0===r.indexOf(e)&&n.push(r);return n},e.unsubscribe=function(r){var n,o,i,a="string"==typeof r&&(t.hasOwnProperty(r)||function(e){var r;for(r in t)if(t.hasOwnProperty(r)&&0===r.indexOf(e))return!0;return!1}(r)),s=!a&&"string"==typeof r,c="function"==typeof r,u=!1;if(!a){for(n in t)if(t.hasOwnProperty(n)){if(o=t[n],s&&o[r]){delete o[r],u=r;break}if(c)for(i in o)o.hasOwnProperty(i)&&o[i]===r&&(delete o[i],u=!0)}return u}e.clearSubscriptions(r)}}(o),"function"==typeof i&&i.amd?i((function(){return o})):(void 0!==e&&e.exports&&(r=e.exports=o),r.PubSub=o,e.exports=r=o)}("object"==typeof window&&window||t)})),n=(r.PubSub,function(e,t){return function r(){null==t&&(t=e.length);var n=[].slice.call(arguments);return n.length>=t?e.apply(this,n):function(){return r.apply(this,n.concat([].slice.call(arguments)))}}});const o=e=>{if(e.length>0&&"/"!==e[0])throw Error("Invalid JSON Pointer");return e.split("/").slice(1).map(f)},i=(e,t,r,n)=>{if(0===e.length)return r;if(e.length>1){const o=e.shift();return{...t,[o]:i(e,p(t,o,n),r,u(o,n))}}if(Array.isArray(t)){const n=[...t];return n[d(t,e[0])]=r,n}return"object"==typeof t&&null!==t?{...t,[e[0]]:r}:p(t,e[0],n)},a=(e,t,r,n)=>{if(0!==e.length)if(1!==e.length||h(t)){const o=e.shift();a(e,p(t,o,n),r,u(o,n))}else{t[d(t,e[0])]=r}},s=(e,t,r)=>{if(0!=e.length){if(e.length>1){const n=e.shift(),o=p(t,n,r);return{...t,[n]:s(e,o,u(n,r))}}if(Array.isArray(t))return t.filter((t,r)=>r!=e[0]);if("object"==typeof t&&null!==t){const{[e[0]]:r,...n}=t;return n}return p(t,e[0],r)}},c=(e,t,r)=>{if(0!==e.length)if(e.length>1){const n=e.shift(),o=p(t,n,r);c(e,o,u(n,r))}else Array.isArray(t)?t.splice(e[0],1):"object"==typeof t&&null!==t?delete t[e[0]]:p(t,e[0],r)},u=n((e,t)=>t+"/"+l(e)),l=e=>e.toString().replace(/~/g,"~0").replace(/\//g,"~1"),f=e=>e.toString().replace(/~1/g,"/").replace(/~0/g,"~"),d=(e,t)=>Array.isArray(e)&&"-"===t?e.length:t,p=(e,t,r="")=>{if(void 0===e)throw TypeError(`Value at '${r}' is undefined and does not have property '${t}'`);if(null===e)throw TypeError(`Value at '${r}' is null and does not have property '${t}'`);if(h(e))throw TypeError(`Value at '${r}' is a ${typeof e} and does not have property '${t}'`);return e[d(e,t)]},h=e=>null===e||"object"!=typeof e;var y={nil:"",append:u,get:(e,t)=>{const r=o(e),n=e=>r.reduce(([e,t],r)=>[p(e,r,t),u(r,t)],[e,""])[0];return void 0===t?n:n(t)},set:(e,t,r)=>{const a=o(e),s=n((e,t)=>i(a,e,t,""));return void 0===t?s:s(t,r)},assign:(e,t,r)=>{const i=o(e),s=n((e,t)=>a(i,e,t,""));return void 0===t?s:s(t,r)},unset:(e,t)=>{const r=o(e),n=e=>s(r,e,"");return void 0===t?n:n(t)},delete:(e,t)=>{const r=o(e),n=e=>c(r,e,"");return void 0===t?n:n(t)}};var v={isObject:e=>"object"==typeof e&&!Array.isArray(e)&&null!==e,splitUrl:e=>{const t=e.indexOf("#"),r=-1===t?e.length:t,n=e.slice(0,r),o=e.slice(r+1);return[decodeURI(n),decodeURI(o)]}};const{splitUrl:b}=v,w=Object.freeze({id:"",pointer:"",instance:void 0}),m=(e,t=w)=>Object.freeze({...t,pointer:b(e)[1]}),g=e=>y.get(e.pointer,e.instance),O=(e,t)=>{const r=y.append(e,t.pointer);return m("#"+encodeURI(r),t)},E=n((e,t)=>g(t).map((r,n)=>e(O(n,t),n))),$=n((e,t)=>g(t).map((e,r)=>O(r,t)).filter((t,r)=>e(t,r))),P=n((e,t,r)=>g(r).reduce((t,n,o)=>e(t,O(o,r),o),t)),j=n((e,t)=>Object.keys(g(t)).every((r,n)=>e(O(r,t),n))),x=n((e,t)=>Object.keys(g(t)).some((r,n)=>e(O(r,t),n)));var S={cons:(e,t="")=>Object.freeze({...w,id:t,instance:e}),get:m,uri:e=>`${e.id}#${encodeURI(e.pointer)}`,value:g,step:O,entries:e=>Object.keys(g(e)).map(t=>[t,O(t,e)]),map:E,filter:$,reduce:P,every:j,some:x},A=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,I=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,V=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,T=/\\([\u000b\u0020-\u00ff])/g,k=/([\\"])/g,R=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/; | ||
/*! | ||
@@ -6,3 +6,3 @@ * content-type | ||
* MIT Licensed | ||
*/function C(e){var t=String(e);if(V.test(t))return t;if(t.length>0&&!I.test(t))throw new TypeError("invalid parameter value");return'"'+t.replace(k,"\\$1")+'"'}function K(e){this.parameters=Object.create(null),this.type=e}var L={format:function(e){if(!e||"object"!=typeof e)throw new TypeError("argument obj is required");var t=e.parameters,r=e.type;if(!r||!R.test(r))throw new TypeError("invalid type");var n=r;if(t&&"object"==typeof t)for(var o,i=Object.keys(t).sort(),a=0;a<i.length;a++){if(o=i[a],!V.test(o))throw new TypeError("invalid parameter name");n+="; "+o+"="+C(t[o])}return n},parse:function(e){if(!e)throw new TypeError("argument string is required");var t="object"==typeof e?function(e){var t;"function"==typeof e.getHeader?t=e.getHeader("content-type"):"object"==typeof e.headers&&(t=e.headers&&e.headers["content-type"]);if("string"!=typeof t)throw new TypeError("content-type header is missing from object");return t}(e):e;if("string"!=typeof t)throw new TypeError("argument string is required to be a string");var r=t.indexOf(";"),n=-1!==r?t.substr(0,r).trim():t.trim();if(!R.test(n))throw new TypeError("invalid media type");var o=new K(n.toLowerCase());if(-1!==r){var i,a,s;for(A.lastIndex=r;a=A.exec(t);){if(a.index!==r)throw new TypeError("invalid parameter format");r+=a[0].length,i=a[1].toLowerCase(),'"'===(s=a[2])[0]&&(s=s.substr(1,s.length-2).replace(T,"$1")),o.parameters[i]=s}if(r!==t.length)throw new TypeError("invalid parameter format")}return o}},U=function(e,t){if(e=e.trim(),(t=t.trim()).startsWith("about:"))return t;const r=function(e){const t={host:"",path:"",query:"",protocol:""};let r=e,n=e.indexOf("//");t.protocol=r.substring(0,n),n+=2;const o=e.indexOf("/",n),i=e.indexOf("?"),a=e.indexOf("#");-1!==a&&(r=r.substring(0,a));if(-1!==i){const e=r.substring(i);t.query=e,r=r.substring(0,i)}if(-1!==o){const e=r.substring(0,o);t.host=e,r=r.substring(o),t.path=r}else t.host=r;return t}(e),n=function(e){const t={href:e,hash:"",query:"",netPath:!1,absolutePath:!1,relativePath:!1};if(W.test(e))return t.netPath=!0,t;"/"===e[0]?t.absolutePath=!0:""!==e&&(t.relativePath=!0);let r=e;const n=e.indexOf("?"),o=e.indexOf("#");if(-1!==o){const e=r.substring(o);t.hash=e,r=r.substring(0,o)}if(-1!==n){const e=r.substring(n);t.query=e,r=r.substring(0,n)}return t.path=r,t}(t);if(!r.protocol&&!n.netPath)throw new Error("Error, protocol is not specified");if(n.netPath)return n.href.startsWith("//")&&(n.href=r.protocol+n.href),function(e){const t=e.indexOf("//")+2,r=!e.includes("/",t),n=!e.includes("?",t),o=!e.includes("#",t);return r&&n&&o}(n.href)?q(n.href):n.href;if(n.absolutePath){const{path:e,query:t,hash:o}=n;return r.host+z(e)+t+o}if(n.relativePath){const{path:e,query:t,hash:o}=n;let i,a=r.path,s=r.host;return 0===e.length?i=a:(a=a.substring(0,a.lastIndexOf("/")),i=z(a+"/"+e)),s+=""!==i||t||o?i+t+o:"/",s}{const{host:e,path:t,query:o}=r;return t||o?e+t+o+n.hash:q(e)}};function q(e){return e+("/"===e[e.length-1]?"":"/")}function z(e){let t=e.split("/");""===t[0]&&(t=t.slice(1));let r=[];return t.forEach((e,n)=>{"."!==e&&(".."===e?r.pop():""===e&&n!==t.length-1||r.push(e))}),"/"+r.join("/")}const W=new RegExp("^([a-z][a-z0-9+.-]*:)?//","i");var _=fetch;const{isObject:B,splitUrl:D}=v,F=Symbol("$__jref"),Z={},J={},M=(e,t)=>{const r=e in J?J[e]:e;if(r in Z)return Z[r][t]},N={},G={},H=(e,t="",r="")=>{e=JSON.parse(JSON.stringify(e));const n=D(e.$schema||r)[0];if(!n)throw Error("Couldn't determine schema version");delete e.$schema;const o=M(n,"idToken"),i=D(t)[0],a=ee(i,e[o]||""),s=D(a)[0];if(!s)throw Error("Couldn't determine an identifier for the schema");i&&(G[i]=s);const c=!!e.$recursiveAnchor;let u;delete e.$recursiveAnchor,M(n,"vocabulary")&&B(e)&&"$vocabulary"in e?(J[s]=n,u=e.$vocabulary,delete e.$vocabulary):u=s===n?{[n]:!0}:{};const l={};N[s]={id:s,schemaVersion:n,schema:Q(e,s,n,y.nil,l),anchors:l,recursiveAnchor:c,vocabulary:u,validated:!1}},Q=(e,t,r,n,o)=>{if(B(e)){const i=M(r,"idToken"),a=M(r,"anchorToken");if("string"==typeof e[i]){const n=e[i],o=ee(t,n),[s,c]=D(o);if(delete e[i],c&&(e[a]=a!==i?encodeURI(c):"#"+encodeURI(c)),s!==t)return H(e,ee(t,s),r),{[F]:n}}if("string"==typeof e[a]){const t=a!==i?e[a]:e[a].slice(1);o[t]=n,delete e[a]}return Object.entries(e).reduce((e,[i,a])=>(e[i]=Q(a,t,r,y.append(i,n),o),e),{})}return Array.isArray(e)?e.map((e,i)=>Q(e,t,r,y.append(i,n),o)):e},X=Object.freeze({id:"",schemaVersion:void 0,pointer:"",schema:void 0,recursiveAnchor:!1}),Y=async(e,t=X,r=!1)=>{const n=r&&t.recursiveAnchor?t.recursiveAnchor:ne(t),o=ee(n,e),[i,a]=D(o);if(!(e=>e in N||e in G)(i)){const e=await _(i,{headers:{Accept:"application/schema+json"}});if(e.status>=400)throw await e.text(),Error("Failed to retrieve schema with id: "+i);if(e.headers.has("content-type")){const t=L.parse(e.headers.get("content-type")).type;if("application/schema+json"!==t)throw Error(`${i} is not a schema. Found a document with media type: ${t}`)}H(await e.json(),i)}const s=(e=>N[G[e]]||N[e])(i),c=Object.freeze({id:s.id,schemaVersion:s.schemaVersion,vocabulary:s.vocabulary,pointer:a&&"/"!==a[0]?re(s,a):a,schema:s.schema,recursiveAnchor:t.recursiveAnchor||!!s.recursiveAnchor&&i,validated:s.validated}),u=oe(c);return B(u)&&F in u?Y(u[F],c):M(c.schemaVersion,"jsonReference")&&B(u)&&"string"==typeof u.$ref?Y(u.$ref,c):M(c.schemaVersion,"keywordReference")&&"string"==typeof u&&c.pointer.endsWith("/$ref")?Y(u,c):M(c.schemaVersion,"keywordRecursiveReference")&&"string"==typeof u&&c.pointer.endsWith("/$recursiveRef")?Y(u,c,!0):c},ee=(e,t)=>{const r=U(e,t),n=D(e)[0];if(n&&"file"===te(r)&&"file"!==te(n))throw Error(`Can't access file '${r}' resource from network context '${e}'`);return r},te=e=>{const t=e.match(/^(.+):\/\//);return t?t[1]:""},re=(e,t)=>{if(!(t in e.anchors))throw Error(`No such anchor '${encodeURI(e.id)}#${encodeURI(t)}'`);return e.anchors[t]},ne=e=>`${e.id}#${encodeURI(e.pointer)}`,oe=e=>y.get(e.pointer,e.schema),ie=(e,t)=>{const r=y.append(e,t.pointer);return Y("#"+encodeURI(r),t)},ae=n((e,t)=>oe(t).map(async(r,n)=>e(await ie(n,t),n)));var se={setConfig:(e,t,r)=>{Z[e]||(Z[e]={}),Z[e][t]=r},getConfig:M,add:H,get:Y,markValidated:e=>{N[e].validated=!0},uri:ne,value:oe,has:(e,t)=>e in oe(t),step:ie,entries:e=>Object.keys(oe(e)).map(t=>[t,ie(t,e)]),map:ae};const ce="FLAG",ue="BASIC",le="DETAILED",fe="VERBOSE";let de=le,pe=!0;const he=(e,t)=>(n,o=ce)=>{if(![ce,ue,le,fe].includes(o))throw Error(`The '${o}' error format is not supported`);let i=[];const a=r.subscribe("result",ye(o,i));return Pe(t,n,e),r.unsubscribe(a),i[0]},ye=(e,t)=>{const r=[];return(n,o)=>{const i={...o,errors:[]};for(;r.length>0&&ve(r[r.length-1],i);){const t=r.pop();let n=[];if(e===ue&&(n=t.errors,delete t.errors),i.errors.unshift(t,...n),be(i))break}(e===fe||e!==ce&&!i.valid)&&r.push(i),t[0]=i}},ve=(e,t)=>e.instanceLocation.startsWith(t.instanceLocation)&&(e.absoluteKeywordLocation.startsWith(t.absoluteKeywordLocation)||be(e)),be=e=>e.keyword.endsWith("#$ref")||e.keyword.endsWith("#$recursiveRef"),me={},we=e=>me[e],ge=e=>e in me,Oe={},Ee={},$e=async(e,t)=>{if(!ge(e.schemaVersion+"#validate")){const t=await se.get(e.schemaVersion);(se.getConfig(t.id,"mandatoryVocabularies")||[]).forEach(e=>{if(!t.vocabulary[e])throw Error(`Vocabulary '${e}' must be explicitly declared and required`)}),Object.entries(t.vocabulary).forEach(([e,r])=>{if(e in Oe)Object.entries(Oe[e]).forEach(([e,r])=>{((e,t)=>{me[e]={collectEvaluatedItems:(e,r,n)=>t.interpret(e,r,n)&&0,collectEvaluatedProperties:(e,r,n)=>t.interpret(e,r,n)&&[],...t}})(`${t.id}#${e}`,r)});else if(r)throw Error("Missing required vocabulary: "+e)})}if(pe&&!e.validated){if(se.markValidated(e.id),!(e.schemaVersion in Ee)){const t=await se.get(e.schemaVersion),r={},n=await $e(t,r);Ee[t.id]=he(r,n)}const t=S.cons(e.schema,e.id),r=Ee[e.schemaVersion](t,de);if(!r.valid)throw r}return await we(e.schemaVersion+"#validate").compile(e,t),se.uri(e)},Pe=(e,t,r)=>{const[n]=r[e];return we(n).interpret(e,t,r)};var je={validate:async(e,t,r)=>{const n={},o=await $e(e,n),i=(e,t=ce)=>he(n,o)(S.cons(e),t);return void 0===t?i:i(t,r)},setMetaOutputFormat:e=>{de=e},setShouldMetaValidate:e=>{pe=e},FLAG:ce,BASIC:ue,DETAILED:le,VERBOSE:fe,getKeyword:we,hasKeyword:ge,defineVocabulary:(e,t)=>{Oe[e]=t},compileSchema:$e,interpretSchema:Pe,collectEvaluatedProperties:(e,t,r,n)=>{const[o]=r[e];return we(o).collectEvaluatedProperties(e,t,r,n)},collectEvaluatedItems:(e,t,r,n)=>{const[o]=r[e];return we(o).collectEvaluatedItems(e,t,r,n)}};var xe={compile:()=>{},interpret:()=>!0},Se=async e=>Object.entries(await e),Ae=n(async(e,t)=>(await t).map(e)),Ie=n(async(e,t,r)=>(await r).reduce(async(t,r)=>e(await t,r),t)),Ve=n(async(e,t,r={})=>Ie(async(t,r)=>await e(r)?t.concat([r]):t,[],t,r)),Te=n(async(e,t)=>{const r=await Ae(e,t);return(await Promise.all(r)).some(e=>e)}),ke=n(async(e,t)=>{const r=await Ae(e,t);return(await Promise.all(r)).every(e=>e)}),Re=n((e,t)=>e.reduce(async(e,t)=>t(await e),t)),Ce={entries:Se,map:Ae,filter:Ve,reduce:Ie,some:Te,every:ke,pipeline:Re,all:e=>Promise.all(e),allValues:e=>Re([Se,Ie(async(e,[t,r])=>(e[t]=await r,e),{})],e)};var Ke={compile:async(e,t)=>{const r=se.uri(e);if(!(r in t)){t[r]=!1;const n=se.value(e);t[r]=[e.schemaVersion+"#validate",se.uri(e),"boolean"==typeof n?n:await Ce.pipeline([se.entries,Ce.map(([t,r])=>[`${e.schemaVersion}#${t}`,r]),Ce.filter(([t])=>je.hasKeyword(t)&&t!==e.schemaVersion+"#validate"),Ce.map(async([r,n])=>{const o=await n,i=await je.getKeyword(r).compile(o,t,e);return[r,se.uri(o),i]}),Ce.all],e)]}},interpret:(e,t,n)=>{const[o,i,a]=n[e],s="boolean"==typeof a?a:a.every(([e,o,i])=>{const a=je.getKeyword(e).interpret(i,t,n);return r.publishSync("result",{keyword:e,absoluteKeywordLocation:o,instanceLocation:S.uri(t),valid:a}),a});return r.publishSync("result",{keyword:o,absoluteKeywordLocation:i,instanceLocation:S.uri(t),valid:s}),s},collectEvaluatedProperties:(e,t,r,n=!1)=>{const o=r[e][2];return"boolean"==typeof o?!!o&&[]:o.filter(([e])=>!n||!e.endsWith("#unevaluatedProperties")).reduce((e,[n,,o])=>{const i=e&&je.getKeyword(n).collectEvaluatedProperties(o,t,r);return i&&e.concat(i)},[])},collectEvaluatedItems:(e,t,r,n=!1)=>{const o=r[e][2];return"boolean"==typeof o?!!o&&[]:o.filter(([e])=>!n||!e.endsWith("#unevaluatedItems")).reduce((e,[n,,o])=>{const i=!1!==e&&je.getKeyword(n).collectEvaluatedItems(o,t,r);return!1!==i&&Math.max(e,i)},0)}},Le={Core:je,Schema:se,Instance:S,Keywords:{metaData:xe,validate:Ke}};e("default",Le);e("Core",Le.Core),e("Schema",Le.Schema),e("Instance",Le.Instance),e("Keywords",Le.Keywords)}}})); | ||
*/function C(e){var t=String(e);if(V.test(t))return t;if(t.length>0&&!I.test(t))throw new TypeError("invalid parameter value");return'"'+t.replace(k,"\\$1")+'"'}function K(e){this.parameters=Object.create(null),this.type=e}var L={format:function(e){if(!e||"object"!=typeof e)throw new TypeError("argument obj is required");var t=e.parameters,r=e.type;if(!r||!R.test(r))throw new TypeError("invalid type");var n=r;if(t&&"object"==typeof t)for(var o,i=Object.keys(t).sort(),a=0;a<i.length;a++){if(o=i[a],!V.test(o))throw new TypeError("invalid parameter name");n+="; "+o+"="+C(t[o])}return n},parse:function(e){if(!e)throw new TypeError("argument string is required");var t="object"==typeof e?function(e){var t;"function"==typeof e.getHeader?t=e.getHeader("content-type"):"object"==typeof e.headers&&(t=e.headers&&e.headers["content-type"]);if("string"!=typeof t)throw new TypeError("content-type header is missing from object");return t}(e):e;if("string"!=typeof t)throw new TypeError("argument string is required to be a string");var r=t.indexOf(";"),n=-1!==r?t.substr(0,r).trim():t.trim();if(!R.test(n))throw new TypeError("invalid media type");var o=new K(n.toLowerCase());if(-1!==r){var i,a,s;for(A.lastIndex=r;a=A.exec(t);){if(a.index!==r)throw new TypeError("invalid parameter format");r+=a[0].length,i=a[1].toLowerCase(),'"'===(s=a[2])[0]&&(s=s.substr(1,s.length-2).replace(T,"$1")),o.parameters[i]=s}if(r!==t.length)throw new TypeError("invalid parameter format")}return o}},U=function(e,t){if(e=e.trim(),(t=t.trim()).startsWith("about:"))return t;const r=function(e){const t={host:"",path:"",query:"",protocol:""};let r=e,n=e.indexOf("//");t.protocol=r.substring(0,n),n+=2;const o=e.indexOf("/",n),i=e.indexOf("?"),a=e.indexOf("#");-1!==a&&(r=r.substring(0,a));if(-1!==i){const e=r.substring(i);t.query=e,r=r.substring(0,i)}if(-1!==o){const e=r.substring(0,o);t.host=e,r=r.substring(o),t.path=r}else t.host=r;return t}(e),n=function(e){const t={href:e,hash:"",query:"",netPath:!1,absolutePath:!1,relativePath:!1};if(W.test(e))return t.netPath=!0,t;"/"===e[0]?t.absolutePath=!0:""!==e&&(t.relativePath=!0);let r=e;const n=e.indexOf("?"),o=e.indexOf("#");if(-1!==o){const e=r.substring(o);t.hash=e,r=r.substring(0,o)}if(-1!==n){const e=r.substring(n);t.query=e,r=r.substring(0,n)}return t.path=r,t}(t);if(!r.protocol&&!n.netPath)throw new Error("Error, protocol is not specified");if(n.netPath)return n.href.startsWith("//")&&(n.href=r.protocol+n.href),function(e){const t=e.indexOf("//")+2,r=!e.includes("/",t),n=!e.includes("?",t),o=!e.includes("#",t);return r&&n&&o}(n.href)?q(n.href):n.href;if(n.absolutePath){const{path:e,query:t,hash:o}=n;return r.host+z(e)+t+o}if(n.relativePath){const{path:e,query:t,hash:o}=n;let i,a=r.path,s=r.host;return 0===e.length?i=a:(a=a.substring(0,a.lastIndexOf("/")),i=z(a+"/"+e)),s+=""!==i||t||o?i+t+o:"/",s}{const{host:e,path:t,query:o}=r;return t||o?e+t+o+n.hash:q(e)}};function q(e){return e+("/"===e[e.length-1]?"":"/")}function z(e){let t=e.split("/");""===t[0]&&(t=t.slice(1));let r=[];return t.forEach((e,n)=>{"."!==e&&(".."===e?r.pop():""===e&&n!==t.length-1||r.push(e))}),"/"+r.join("/")}const W=new RegExp("^([a-z][a-z0-9+.-]*:)?//","i");var _=fetch;const{isObject:B,splitUrl:D}=v,F=Symbol("$__jref"),Z={},J={},M=(e,t)=>{const r=e in J?J[e]:e;if(r in Z)return Z[r][t]},N={},G={},H=(e,t="",r="")=>{e=JSON.parse(JSON.stringify(e));const n=D(e.$schema||r)[0];if(!n)throw Error("Couldn't determine schema version");delete e.$schema;const o=M(n,"idToken"),i=D(t)[0],a=ee(i,e[o]||""),s=D(a)[0];if(!s)throw Error("Couldn't determine an identifier for the schema");i&&(G[i]=s);const c=!!e.$recursiveAnchor;let u;delete e.$recursiveAnchor,M(n,"vocabulary")&&B(e)&&"$vocabulary"in e?(J[s]=n,u=e.$vocabulary,delete e.$vocabulary):u=s===n?{[n]:!0}:{};const l={};N[s]={id:s,schemaVersion:n,schema:Q(e,s,n,y.nil,l),anchors:l,recursiveAnchor:c,vocabulary:u,validated:!1}},Q=(e,t,r,n,o)=>{if(B(e)){const i=M(r,"idToken"),a=M(r,"anchorToken");if("string"==typeof e[i]){const n=e[i],o=ee(t,n),[s,c]=D(o);if(delete e[i],c&&(e[a]=a!==i?encodeURI(c):"#"+encodeURI(c)),s!==t)return H(e,ee(t,s),r),{[F]:n}}if("string"==typeof e[a]){const t=a!==i?e[a]:e[a].slice(1);o[t]=n,delete e[a]}return Object.entries(e).reduce((e,[i,a])=>(e[i]=Q(a,t,r,y.append(i,n),o),e),{})}return Array.isArray(e)?e.map((e,i)=>Q(e,t,r,y.append(i,n),o)):e},X=Object.freeze({id:"",schemaVersion:void 0,pointer:"",schema:void 0,recursiveAnchor:!1}),Y=async(e,t=X,r=!1)=>{const n=r&&t.recursiveAnchor?t.recursiveAnchor:ne(t),o=ee(n,e),[i,a]=D(o);if(!(e=>e in N||e in G)(i)){const e=await _(i,{headers:{Accept:"application/schema+json"}});if(e.status>=400)throw await e.text(),Error("Failed to retrieve schema with id: "+i);if(e.headers.has("content-type")){const t=L.parse(e.headers.get("content-type")).type;if("application/schema+json"!==t)throw Error(`${i} is not a schema. Found a document with media type: ${t}`)}H(await e.json(),i)}const s=(e=>N[G[e]]||N[e])(i),c=Object.freeze({id:s.id,schemaVersion:s.schemaVersion,vocabulary:s.vocabulary,pointer:a&&"/"!==a[0]?re(s,a):a,schema:s.schema,recursiveAnchor:t.recursiveAnchor||!!s.recursiveAnchor&&i,validated:s.validated}),u=oe(c);return B(u)&&F in u?Y(u[F],c):M(c.schemaVersion,"jsonReference")&&B(u)&&"string"==typeof u.$ref?Y(u.$ref,c):M(c.schemaVersion,"keywordReference")&&"string"==typeof u&&c.pointer.endsWith("/$ref")?Y(u,c):M(c.schemaVersion,"keywordRecursiveReference")&&"string"==typeof u&&c.pointer.endsWith("/$recursiveRef")?Y(u,c,!0):c},ee=(e,t)=>{const r=U(e,t),n=D(e)[0];if(n&&"file"===te(r)&&"file"!==te(n))throw Error(`Can't access file '${r}' resource from network context '${e}'`);return r},te=e=>{const t=e.match(/^(.+):\/\//);return t?t[1]:""},re=(e,t)=>{if(!(t in e.anchors))throw Error(`No such anchor '${encodeURI(e.id)}#${encodeURI(t)}'`);return e.anchors[t]},ne=e=>`${e.id}#${encodeURI(e.pointer)}`,oe=e=>y.get(e.pointer,e.schema),ie=(e,t)=>{const r=y.append(e,t.pointer);return Y("#"+encodeURI(r),t)},ae=n((e,t)=>oe(t).map(async(r,n)=>e(await ie(n,t),n)));var se={setConfig:(e,t,r)=>{Z[e]||(Z[e]={}),Z[e][t]=r},getConfig:M,add:H,get:Y,markValidated:e=>{N[e].validated=!0},uri:ne,value:oe,has:(e,t)=>e in oe(t),step:ie,entries:e=>Object.keys(oe(e)).map(async t=>[t,await ie(t,e)]),map:ae};const ce="FLAG",ue="BASIC",le="DETAILED",fe="VERBOSE";let de=le,pe=!0;const he=(e,t)=>(n,o=ce)=>{if(![ce,ue,le,fe].includes(o))throw Error(`The '${o}' error format is not supported`);let i=[];const a=r.subscribe("result",ye(o,i));return Pe(t,n,e),r.unsubscribe(a),i[0]},ye=(e,t)=>{const r=[];return(n,o)=>{const i={...o,errors:[]};for(;r.length>0&&ve(r[r.length-1],i);){const t=r.pop();let n=[];if(e===ue&&(n=t.errors,delete t.errors),i.errors.unshift(t,...n),be(i))break}(e===fe||e!==ce&&!i.valid)&&r.push(i),t[0]=i}},ve=(e,t)=>e.instanceLocation.startsWith(t.instanceLocation)&&(e.absoluteKeywordLocation.startsWith(t.absoluteKeywordLocation)||be(e)),be=e=>e.keyword.endsWith("#$ref")||e.keyword.endsWith("#$recursiveRef"),we={},me=e=>we[e],ge=e=>e in we,Oe={},Ee={},$e=async(e,t)=>{if(!ge(e.schemaVersion+"#validate")){const t=await se.get(e.schemaVersion);(se.getConfig(t.id,"mandatoryVocabularies")||[]).forEach(e=>{if(!t.vocabulary[e])throw Error(`Vocabulary '${e}' must be explicitly declared and required`)}),Object.entries(t.vocabulary).forEach(([e,r])=>{if(e in Oe)Object.entries(Oe[e]).forEach(([e,r])=>{((e,t)=>{we[e]={collectEvaluatedItems:(e,r,n)=>t.interpret(e,r,n)&&0,collectEvaluatedProperties:(e,r,n)=>t.interpret(e,r,n)&&[],...t}})(`${t.id}#${e}`,r)});else if(r)throw Error("Missing required vocabulary: "+e)})}if(pe&&!e.validated){if(se.markValidated(e.id),!(e.schemaVersion in Ee)){const t=await se.get(e.schemaVersion),r={},n=await $e(t,r);Ee[t.id]=he(r,n)}const t=S.cons(e.schema,e.id),r=Ee[e.schemaVersion](t,de);if(!r.valid)throw r}return await me(e.schemaVersion+"#validate").compile(e,t),se.uri(e)},Pe=(e,t,r)=>{const[n]=r[e];return me(n).interpret(e,t,r)};var je={validate:async(e,t,r)=>{const n={},o=await $e(e,n),i=(e,t=ce)=>he(n,o)(S.cons(e),t);return void 0===t?i:i(t,r)},setMetaOutputFormat:e=>{de=e},setShouldMetaValidate:e=>{pe=e},FLAG:ce,BASIC:ue,DETAILED:le,VERBOSE:fe,getKeyword:me,hasKeyword:ge,defineVocabulary:(e,t)=>{Oe[e]=t},compileSchema:$e,interpretSchema:Pe,collectEvaluatedProperties:(e,t,r,n)=>{const[o]=r[e];return me(o).collectEvaluatedProperties(e,t,r,n)},collectEvaluatedItems:(e,t,r,n)=>{const[o]=r[e];return me(o).collectEvaluatedItems(e,t,r,n)}};var xe={compile:()=>{},interpret:()=>!0},Se=async e=>Object.entries(await e),Ae=n(async(e,t)=>(await t).map(e)),Ie=n(async(e,t,r)=>(await r).reduce(async(t,r)=>{let n;try{n=await t}catch(e){try{await r}catch(e){}return t}return e(n,r)},t)),Ve=n(async(e,t,r={})=>Ie(async(t,r)=>await e(r)?t.concat([r]):t,[],t,r)),Te=n(async(e,t)=>{const r=await Ae(e,t);return(await Promise.all(r)).some(e=>e)}),ke=n(async(e,t)=>{const r=await Ae(e,t);return(await Promise.all(r)).every(e=>e)}),Re=n((e,t)=>e.reduce(async(e,t)=>t(await e),t)),Ce={entries:Se,map:Ae,filter:Ve,reduce:Ie,some:Te,every:ke,pipeline:Re,all:e=>Promise.all(e),allValues:e=>Re([Se,Ie(async(e,[t,r])=>(e[t]=await r,e),{})],e)};var Ke={compile:async(e,t)=>{const r=se.uri(e);if(!(r in t)){t[r]=!1;const n=se.value(e);t[r]=[e.schemaVersion+"#validate",se.uri(e),"boolean"==typeof n?n:await Ce.pipeline([se.entries,Ce.map(async t=>{const[r,n]=await t;return[`${e.schemaVersion}#${r}`,n]}),Ce.filter(async t=>{const[r]=await t;return je.hasKeyword(r)&&r!==e.schemaVersion+"#validate"}),Ce.map(async r=>{const[n,o]=await r,i=await o,a=await je.getKeyword(n).compile(i,t,e);return[n,se.uri(i),a]}),Ce.all],e)]}},interpret:(e,t,n)=>{const[o,i,a]=n[e],s="boolean"==typeof a?a:a.every(([e,o,i])=>{const a=je.getKeyword(e).interpret(i,t,n);return r.publishSync("result",{keyword:e,absoluteKeywordLocation:o,instanceLocation:S.uri(t),valid:a}),a});return r.publishSync("result",{keyword:o,absoluteKeywordLocation:i,instanceLocation:S.uri(t),valid:s}),s},collectEvaluatedProperties:(e,t,r,n=!1)=>{const o=r[e][2];return"boolean"==typeof o?!!o&&[]:o.filter(([e])=>!n||!e.endsWith("#unevaluatedProperties")).reduce((e,[n,,o])=>{const i=e&&je.getKeyword(n).collectEvaluatedProperties(o,t,r);return i&&e.concat(i)},[])},collectEvaluatedItems:(e,t,r,n=!1)=>{const o=r[e][2];return"boolean"==typeof o?!!o&&[]:o.filter(([e])=>!n||!e.endsWith("#unevaluatedItems")).reduce((e,[n,,o])=>{const i=!1!==e&&je.getKeyword(n).collectEvaluatedItems(o,t,r);return!1!==i&&Math.max(e,i)},0)}},Le={Core:je,Schema:se,Instance:S,Keywords:{metaData:xe,validate:Ke}};e("default",Le);e("Core",Le.Core),e("Schema",Le.Schema),e("Instance",Le.Instance),e("Keywords",Le.Keywords)}}})); | ||
//# sourceMappingURL=json-schema-core-system.min.js.map |
@@ -1219,3 +1219,3 @@ (function (global, factory) { | ||
const entries$1 = (doc) => Object.keys(value$1(doc)) | ||
.map((key) => [key, step$1(key, doc)]); | ||
.map(async (key) => [key, await step$1(key, doc)]); | ||
@@ -1399,3 +1399,18 @@ const map$1 = justCurryIt((fn, doc) => value$1(doc) | ||
var reduce$1 = justCurryIt(async (fn, acc, doc) => { | ||
return (await doc).reduce(async (acc, item) => fn(await acc, item), acc); | ||
return (await doc).reduce(async (acc, item) => { | ||
let resolvedAcc; | ||
try { | ||
resolvedAcc = await acc; | ||
} catch (e) { | ||
try { | ||
await item; | ||
} catch (e) { | ||
// If we've already encountered an error, ignore subsequent errors. | ||
} | ||
return acc; | ||
} | ||
return fn(resolvedAcc, item); | ||
}, acc); | ||
}); | ||
@@ -1459,8 +1474,13 @@ | ||
schema.entries, | ||
lib.map(([keyword, keywordSchema]) => { | ||
lib.map(async (entry) => { | ||
const [keyword, keywordSchema] = await entry; | ||
const keywordId = `${schema$1.schemaVersion}#${keyword}`; | ||
return [keywordId, keywordSchema]; | ||
}), | ||
lib.filter(([keywordId]) => core.hasKeyword(keywordId) && keywordId !== `${schema$1.schemaVersion}#validate`), | ||
lib.map(async ([keywordId, keywordSchemaPromise]) => { | ||
lib.filter(async (entry) => { | ||
const [keywordId] = await entry; | ||
return core.hasKeyword(keywordId) && keywordId !== `${schema$1.schemaVersion}#validate`; | ||
}), | ||
lib.map(async (entry) => { | ||
const [keywordId, keywordSchemaPromise] = await entry; | ||
const keywordSchema = await keywordSchemaPromise; | ||
@@ -1467,0 +1487,0 @@ const keywordAst = await core.getKeyword(keywordId).compile(keywordSchema, ast, schema$1); |
@@ -6,3 +6,3 @@ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e=e||self).JSC={})}(this,(function(e){"use strict";var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var r=function(e,t){return e(t={exports:{}},t.exports),t.exports}((function(e,r){!function(t,n){var o={};t.PubSub=o;var i=t.define;!function(e){var t={},r=-1;function n(e){var t;for(t in e)if(e.hasOwnProperty(t))return!0;return!1}function o(e,t,r){try{e(t,r)}catch(e){setTimeout(function(e){return function(){throw e}}(e),0)}}function i(e,t,r){e(t,r)}function a(e,r,n,a){var s,c=t[r],u=a?i:o;if(t.hasOwnProperty(r))for(s in c)c.hasOwnProperty(s)&&u(c[s],e,n)}function s(e,r,o,i){var s=function(e,t,r){return function(){var n=String(e),o=n.lastIndexOf(".");for(a(e,e,t,r);-1!==o;)o=(n=n.substr(0,o)).lastIndexOf("."),a(e,n,t,r)}}(e="symbol"==typeof e?e.toString():e,r,i);return!!function(e){for(var r=String(e),o=Boolean(t.hasOwnProperty(r)&&n(t[r])),i=r.lastIndexOf(".");!o&&-1!==i;)i=(r=r.substr(0,i)).lastIndexOf("."),o=Boolean(t.hasOwnProperty(r)&&n(t[r]));return o}(e)&&(!0===o?s():setTimeout(s,0),!0)}e.publish=function(t,r){return s(t,r,!1,e.immediateExceptions)},e.publishSync=function(t,r){return s(t,r,!0,e.immediateExceptions)},e.subscribe=function(e,n){if("function"!=typeof n)return!1;e="symbol"==typeof e?e.toString():e,t.hasOwnProperty(e)||(t[e]={});var o="uid_"+String(++r);return t[e][o]=n,o},e.subscribeOnce=function(t,r){var n=e.subscribe(t,(function(){e.unsubscribe(n),r.apply(this,arguments)}));return e},e.clearAllSubscriptions=function(){t={}},e.clearSubscriptions=function(e){var r;for(r in t)t.hasOwnProperty(r)&&0===r.indexOf(e)&&delete t[r]},e.countSubscriptions=function(e){var r,n=0;for(r in t)t.hasOwnProperty(r)&&0===r.indexOf(e)&&n++;return n},e.getSubscriptions=function(e){var r,n=[];for(r in t)t.hasOwnProperty(r)&&0===r.indexOf(e)&&n.push(r);return n},e.unsubscribe=function(r){var n,o,i,a="string"==typeof r&&(t.hasOwnProperty(r)||function(e){var r;for(r in t)if(t.hasOwnProperty(r)&&0===r.indexOf(e))return!0;return!1}(r)),s=!a&&"string"==typeof r,c="function"==typeof r,u=!1;if(!a){for(n in t)if(t.hasOwnProperty(n)){if(o=t[n],s&&o[r]){delete o[r],u=r;break}if(c)for(i in o)o.hasOwnProperty(i)&&o[i]===r&&(delete o[i],u=!0)}return u}e.clearSubscriptions(r)}}(o),"function"==typeof i&&i.amd?i((function(){return o})):(void 0!==e&&e.exports&&(r=e.exports=o),r.PubSub=o,e.exports=r=o)}("object"==typeof window&&window||t)})),n=(r.PubSub,function(e,t){return function r(){null==t&&(t=e.length);var n=[].slice.call(arguments);return n.length>=t?e.apply(this,n):function(){return r.apply(this,n.concat([].slice.call(arguments)))}}});const o=e=>{if(e.length>0&&"/"!==e[0])throw Error("Invalid JSON Pointer");return e.split("/").slice(1).map(f)},i=(e,t,r,n)=>{if(0===e.length)return r;if(e.length>1){const o=e.shift();return{...t,[o]:i(e,p(t,o,n),r,u(o,n))}}if(Array.isArray(t)){const n=[...t];return n[d(t,e[0])]=r,n}return"object"==typeof t&&null!==t?{...t,[e[0]]:r}:p(t,e[0],n)},a=(e,t,r,n)=>{if(0!==e.length)if(1!==e.length||h(t)){const o=e.shift();a(e,p(t,o,n),r,u(o,n))}else{t[d(t,e[0])]=r}},s=(e,t,r)=>{if(0!=e.length){if(e.length>1){const n=e.shift(),o=p(t,n,r);return{...t,[n]:s(e,o,u(n,r))}}if(Array.isArray(t))return t.filter((t,r)=>r!=e[0]);if("object"==typeof t&&null!==t){const{[e[0]]:r,...n}=t;return n}return p(t,e[0],r)}},c=(e,t,r)=>{if(0!==e.length)if(e.length>1){const n=e.shift(),o=p(t,n,r);c(e,o,u(n,r))}else Array.isArray(t)?t.splice(e[0],1):"object"==typeof t&&null!==t?delete t[e[0]]:p(t,e[0],r)},u=n((e,t)=>t+"/"+l(e)),l=e=>e.toString().replace(/~/g,"~0").replace(/\//g,"~1"),f=e=>e.toString().replace(/~1/g,"/").replace(/~0/g,"~"),d=(e,t)=>Array.isArray(e)&&"-"===t?e.length:t,p=(e,t,r="")=>{if(void 0===e)throw TypeError(`Value at '${r}' is undefined and does not have property '${t}'`);if(null===e)throw TypeError(`Value at '${r}' is null and does not have property '${t}'`);if(h(e))throw TypeError(`Value at '${r}' is a ${typeof e} and does not have property '${t}'`);return e[d(e,t)]},h=e=>null===e||"object"!=typeof e;var y={nil:"",append:u,get:(e,t)=>{const r=o(e),n=e=>r.reduce(([e,t],r)=>[p(e,r,t),u(r,t)],[e,""])[0];return void 0===t?n:n(t)},set:(e,t,r)=>{const a=o(e),s=n((e,t)=>i(a,e,t,""));return void 0===t?s:s(t,r)},assign:(e,t,r)=>{const i=o(e),s=n((e,t)=>a(i,e,t,""));return void 0===t?s:s(t,r)},unset:(e,t)=>{const r=o(e),n=e=>s(r,e,"");return void 0===t?n:n(t)},delete:(e,t)=>{const r=o(e),n=e=>c(r,e,"");return void 0===t?n:n(t)}};var v={isObject:e=>"object"==typeof e&&!Array.isArray(e)&&null!==e,splitUrl:e=>{const t=e.indexOf("#"),r=-1===t?e.length:t,n=e.slice(0,r),o=e.slice(r+1);return[decodeURI(n),decodeURI(o)]}};const{splitUrl:b}=v,m=Object.freeze({id:"",pointer:"",instance:void 0}),w=(e,t=m)=>Object.freeze({...t,pointer:b(e)[1]}),g=e=>y.get(e.pointer,e.instance),O=(e,t)=>{const r=y.append(e,t.pointer);return w("#"+encodeURI(r),t)},E=n((e,t)=>g(t).map((r,n)=>e(O(n,t),n))),$=n((e,t)=>g(t).map((e,r)=>O(r,t)).filter((t,r)=>e(t,r))),j=n((e,t,r)=>g(r).reduce((t,n,o)=>e(t,O(o,r),o),t)),x=n((e,t)=>Object.keys(g(t)).every((r,n)=>e(O(r,t),n))),P=n((e,t)=>Object.keys(g(t)).some((r,n)=>e(O(r,t),n)));var A={cons:(e,t="")=>Object.freeze({...m,id:t,instance:e}),get:w,uri:e=>`${e.id}#${encodeURI(e.pointer)}`,value:g,step:O,entries:e=>Object.keys(g(e)).map(t=>[t,O(t,e)]),map:E,filter:$,reduce:j,every:x,some:P},S=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,I=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,V=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,T=/\\([\u000b\u0020-\u00ff])/g,k=/([\\"])/g,R=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/; | ||
* MIT Licensed | ||
*/function C(e){var t=String(e);if(V.test(t))return t;if(t.length>0&&!I.test(t))throw new TypeError("invalid parameter value");return'"'+t.replace(k,"\\$1")+'"'}function K(e){this.parameters=Object.create(null),this.type=e}var L={format:function(e){if(!e||"object"!=typeof e)throw new TypeError("argument obj is required");var t=e.parameters,r=e.type;if(!r||!R.test(r))throw new TypeError("invalid type");var n=r;if(t&&"object"==typeof t)for(var o,i=Object.keys(t).sort(),a=0;a<i.length;a++){if(o=i[a],!V.test(o))throw new TypeError("invalid parameter name");n+="; "+o+"="+C(t[o])}return n},parse:function(e){if(!e)throw new TypeError("argument string is required");var t="object"==typeof e?function(e){var t;"function"==typeof e.getHeader?t=e.getHeader("content-type"):"object"==typeof e.headers&&(t=e.headers&&e.headers["content-type"]);if("string"!=typeof t)throw new TypeError("content-type header is missing from object");return t}(e):e;if("string"!=typeof t)throw new TypeError("argument string is required to be a string");var r=t.indexOf(";"),n=-1!==r?t.substr(0,r).trim():t.trim();if(!R.test(n))throw new TypeError("invalid media type");var o=new K(n.toLowerCase());if(-1!==r){var i,a,s;for(S.lastIndex=r;a=S.exec(t);){if(a.index!==r)throw new TypeError("invalid parameter format");r+=a[0].length,i=a[1].toLowerCase(),'"'===(s=a[2])[0]&&(s=s.substr(1,s.length-2).replace(T,"$1")),o.parameters[i]=s}if(r!==t.length)throw new TypeError("invalid parameter format")}return o}},U=function(e,t){if(e=e.trim(),(t=t.trim()).startsWith("about:"))return t;const r=function(e){const t={host:"",path:"",query:"",protocol:""};let r=e,n=e.indexOf("//");t.protocol=r.substring(0,n),n+=2;const o=e.indexOf("/",n),i=e.indexOf("?"),a=e.indexOf("#");-1!==a&&(r=r.substring(0,a));if(-1!==i){const e=r.substring(i);t.query=e,r=r.substring(0,i)}if(-1!==o){const e=r.substring(0,o);t.host=e,r=r.substring(o),t.path=r}else t.host=r;return t}(e),n=function(e){const t={href:e,hash:"",query:"",netPath:!1,absolutePath:!1,relativePath:!1};if(W.test(e))return t.netPath=!0,t;"/"===e[0]?t.absolutePath=!0:""!==e&&(t.relativePath=!0);let r=e;const n=e.indexOf("?"),o=e.indexOf("#");if(-1!==o){const e=r.substring(o);t.hash=e,r=r.substring(0,o)}if(-1!==n){const e=r.substring(n);t.query=e,r=r.substring(0,n)}return t.path=r,t}(t);if(!r.protocol&&!n.netPath)throw new Error("Error, protocol is not specified");if(n.netPath)return n.href.startsWith("//")&&(n.href=r.protocol+n.href),function(e){const t=e.indexOf("//")+2,r=!e.includes("/",t),n=!e.includes("?",t),o=!e.includes("#",t);return r&&n&&o}(n.href)?q(n.href):n.href;if(n.absolutePath){const{path:e,query:t,hash:o}=n;return r.host+z(e)+t+o}if(n.relativePath){const{path:e,query:t,hash:o}=n;let i,a=r.path,s=r.host;return 0===e.length?i=a:(a=a.substring(0,a.lastIndexOf("/")),i=z(a+"/"+e)),s+=""!==i||t||o?i+t+o:"/",s}{const{host:e,path:t,query:o}=r;return t||o?e+t+o+n.hash:q(e)}};function q(e){return e+("/"===e[e.length-1]?"":"/")}function z(e){let t=e.split("/");""===t[0]&&(t=t.slice(1));let r=[];return t.forEach((e,n)=>{"."!==e&&(".."===e?r.pop():""===e&&n!==t.length-1||r.push(e))}),"/"+r.join("/")}const W=new RegExp("^([a-z][a-z0-9+.-]*:)?//","i");var _=fetch;const{isObject:B,splitUrl:D}=v,F=Symbol("$__jref"),M={},Z={},J=(e,t)=>{const r=e in Z?Z[e]:e;if(r in M)return M[r][t]},N={},G={},H=(e,t="",r="")=>{e=JSON.parse(JSON.stringify(e));const n=D(e.$schema||r)[0];if(!n)throw Error("Couldn't determine schema version");delete e.$schema;const o=J(n,"idToken"),i=D(t)[0],a=ee(i,e[o]||""),s=D(a)[0];if(!s)throw Error("Couldn't determine an identifier for the schema");i&&(G[i]=s);const c=!!e.$recursiveAnchor;let u;delete e.$recursiveAnchor,J(n,"vocabulary")&&B(e)&&"$vocabulary"in e?(Z[s]=n,u=e.$vocabulary,delete e.$vocabulary):u=s===n?{[n]:!0}:{};const l={};N[s]={id:s,schemaVersion:n,schema:Q(e,s,n,y.nil,l),anchors:l,recursiveAnchor:c,vocabulary:u,validated:!1}},Q=(e,t,r,n,o)=>{if(B(e)){const i=J(r,"idToken"),a=J(r,"anchorToken");if("string"==typeof e[i]){const n=e[i],o=ee(t,n),[s,c]=D(o);if(delete e[i],c&&(e[a]=a!==i?encodeURI(c):"#"+encodeURI(c)),s!==t)return H(e,ee(t,s),r),{[F]:n}}if("string"==typeof e[a]){const t=a!==i?e[a]:e[a].slice(1);o[t]=n,delete e[a]}return Object.entries(e).reduce((e,[i,a])=>(e[i]=Q(a,t,r,y.append(i,n),o),e),{})}return Array.isArray(e)?e.map((e,i)=>Q(e,t,r,y.append(i,n),o)):e},X=Object.freeze({id:"",schemaVersion:void 0,pointer:"",schema:void 0,recursiveAnchor:!1}),Y=async(e,t=X,r=!1)=>{const n=r&&t.recursiveAnchor?t.recursiveAnchor:ne(t),o=ee(n,e),[i,a]=D(o);if(!(e=>e in N||e in G)(i)){const e=await _(i,{headers:{Accept:"application/schema+json"}});if(e.status>=400)throw await e.text(),Error("Failed to retrieve schema with id: "+i);if(e.headers.has("content-type")){const t=L.parse(e.headers.get("content-type")).type;if("application/schema+json"!==t)throw Error(`${i} is not a schema. Found a document with media type: ${t}`)}H(await e.json(),i)}const s=(e=>N[G[e]]||N[e])(i),c=Object.freeze({id:s.id,schemaVersion:s.schemaVersion,vocabulary:s.vocabulary,pointer:a&&"/"!==a[0]?re(s,a):a,schema:s.schema,recursiveAnchor:t.recursiveAnchor||!!s.recursiveAnchor&&i,validated:s.validated}),u=oe(c);return B(u)&&F in u?Y(u[F],c):J(c.schemaVersion,"jsonReference")&&B(u)&&"string"==typeof u.$ref?Y(u.$ref,c):J(c.schemaVersion,"keywordReference")&&"string"==typeof u&&c.pointer.endsWith("/$ref")?Y(u,c):J(c.schemaVersion,"keywordRecursiveReference")&&"string"==typeof u&&c.pointer.endsWith("/$recursiveRef")?Y(u,c,!0):c},ee=(e,t)=>{const r=U(e,t),n=D(e)[0];if(n&&"file"===te(r)&&"file"!==te(n))throw Error(`Can't access file '${r}' resource from network context '${e}'`);return r},te=e=>{const t=e.match(/^(.+):\/\//);return t?t[1]:""},re=(e,t)=>{if(!(t in e.anchors))throw Error(`No such anchor '${encodeURI(e.id)}#${encodeURI(t)}'`);return e.anchors[t]},ne=e=>`${e.id}#${encodeURI(e.pointer)}`,oe=e=>y.get(e.pointer,e.schema),ie=(e,t)=>{const r=y.append(e,t.pointer);return Y("#"+encodeURI(r),t)},ae=n((e,t)=>oe(t).map(async(r,n)=>e(await ie(n,t),n)));var se={setConfig:(e,t,r)=>{M[e]||(M[e]={}),M[e][t]=r},getConfig:J,add:H,get:Y,markValidated:e=>{N[e].validated=!0},uri:ne,value:oe,has:(e,t)=>e in oe(t),step:ie,entries:e=>Object.keys(oe(e)).map(t=>[t,ie(t,e)]),map:ae};const ce="FLAG",ue="BASIC",le="DETAILED",fe="VERBOSE";let de=le,pe=!0;const he=(e,t)=>(n,o=ce)=>{if(![ce,ue,le,fe].includes(o))throw Error(`The '${o}' error format is not supported`);let i=[];const a=r.subscribe("result",ye(o,i));return je(t,n,e),r.unsubscribe(a),i[0]},ye=(e,t)=>{const r=[];return(n,o)=>{const i={...o,errors:[]};for(;r.length>0&&ve(r[r.length-1],i);){const t=r.pop();let n=[];if(e===ue&&(n=t.errors,delete t.errors),i.errors.unshift(t,...n),be(i))break}(e===fe||e!==ce&&!i.valid)&&r.push(i),t[0]=i}},ve=(e,t)=>e.instanceLocation.startsWith(t.instanceLocation)&&(e.absoluteKeywordLocation.startsWith(t.absoluteKeywordLocation)||be(e)),be=e=>e.keyword.endsWith("#$ref")||e.keyword.endsWith("#$recursiveRef"),me={},we=e=>me[e],ge=e=>e in me,Oe={},Ee={},$e=async(e,t)=>{if(!ge(e.schemaVersion+"#validate")){const t=await se.get(e.schemaVersion);(se.getConfig(t.id,"mandatoryVocabularies")||[]).forEach(e=>{if(!t.vocabulary[e])throw Error(`Vocabulary '${e}' must be explicitly declared and required`)}),Object.entries(t.vocabulary).forEach(([e,r])=>{if(e in Oe)Object.entries(Oe[e]).forEach(([e,r])=>{((e,t)=>{me[e]={collectEvaluatedItems:(e,r,n)=>t.interpret(e,r,n)&&0,collectEvaluatedProperties:(e,r,n)=>t.interpret(e,r,n)&&[],...t}})(`${t.id}#${e}`,r)});else if(r)throw Error("Missing required vocabulary: "+e)})}if(pe&&!e.validated){if(se.markValidated(e.id),!(e.schemaVersion in Ee)){const t=await se.get(e.schemaVersion),r={},n=await $e(t,r);Ee[t.id]=he(r,n)}const t=A.cons(e.schema,e.id),r=Ee[e.schemaVersion](t,de);if(!r.valid)throw r}return await we(e.schemaVersion+"#validate").compile(e,t),se.uri(e)},je=(e,t,r)=>{const[n]=r[e];return we(n).interpret(e,t,r)};var xe={validate:async(e,t,r)=>{const n={},o=await $e(e,n),i=(e,t=ce)=>he(n,o)(A.cons(e),t);return void 0===t?i:i(t,r)},setMetaOutputFormat:e=>{de=e},setShouldMetaValidate:e=>{pe=e},FLAG:ce,BASIC:ue,DETAILED:le,VERBOSE:fe,getKeyword:we,hasKeyword:ge,defineVocabulary:(e,t)=>{Oe[e]=t},compileSchema:$e,interpretSchema:je,collectEvaluatedProperties:(e,t,r,n)=>{const[o]=r[e];return we(o).collectEvaluatedProperties(e,t,r,n)},collectEvaluatedItems:(e,t,r,n)=>{const[o]=r[e];return we(o).collectEvaluatedItems(e,t,r,n)}};var Pe={compile:()=>{},interpret:()=>!0},Ae=async e=>Object.entries(await e),Se=n(async(e,t)=>(await t).map(e)),Ie=n(async(e,t,r)=>(await r).reduce(async(t,r)=>e(await t,r),t)),Ve=n(async(e,t,r={})=>Ie(async(t,r)=>await e(r)?t.concat([r]):t,[],t,r)),Te=n(async(e,t)=>{const r=await Se(e,t);return(await Promise.all(r)).some(e=>e)}),ke=n(async(e,t)=>{const r=await Se(e,t);return(await Promise.all(r)).every(e=>e)}),Re=n((e,t)=>e.reduce(async(e,t)=>t(await e),t)),Ce={entries:Ae,map:Se,filter:Ve,reduce:Ie,some:Te,every:ke,pipeline:Re,all:e=>Promise.all(e),allValues:e=>Re([Ae,Ie(async(e,[t,r])=>(e[t]=await r,e),{})],e)};var Ke={compile:async(e,t)=>{const r=se.uri(e);if(!(r in t)){t[r]=!1;const n=se.value(e);t[r]=[e.schemaVersion+"#validate",se.uri(e),"boolean"==typeof n?n:await Ce.pipeline([se.entries,Ce.map(([t,r])=>[`${e.schemaVersion}#${t}`,r]),Ce.filter(([t])=>xe.hasKeyword(t)&&t!==e.schemaVersion+"#validate"),Ce.map(async([r,n])=>{const o=await n,i=await xe.getKeyword(r).compile(o,t,e);return[r,se.uri(o),i]}),Ce.all],e)]}},interpret:(e,t,n)=>{const[o,i,a]=n[e],s="boolean"==typeof a?a:a.every(([e,o,i])=>{const a=xe.getKeyword(e).interpret(i,t,n);return r.publishSync("result",{keyword:e,absoluteKeywordLocation:o,instanceLocation:A.uri(t),valid:a}),a});return r.publishSync("result",{keyword:o,absoluteKeywordLocation:i,instanceLocation:A.uri(t),valid:s}),s},collectEvaluatedProperties:(e,t,r,n=!1)=>{const o=r[e][2];return"boolean"==typeof o?!!o&&[]:o.filter(([e])=>!n||!e.endsWith("#unevaluatedProperties")).reduce((e,[n,,o])=>{const i=e&&xe.getKeyword(n).collectEvaluatedProperties(o,t,r);return i&&e.concat(i)},[])},collectEvaluatedItems:(e,t,r,n=!1)=>{const o=r[e][2];return"boolean"==typeof o?!!o&&[]:o.filter(([e])=>!n||!e.endsWith("#unevaluatedItems")).reduce((e,[n,,o])=>{const i=!1!==e&&xe.getKeyword(n).collectEvaluatedItems(o,t,r);return!1!==i&&Math.max(e,i)},0)}},Le={Core:xe,Schema:se,Instance:A,Keywords:{metaData:Pe,validate:Ke}},Ue=Le.Core,qe=Le.Schema,ze=Le.Instance,We=Le.Keywords;e.Core=Ue,e.Instance=ze,e.Keywords=We,e.Schema=qe,e.default=Le,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
*/function C(e){var t=String(e);if(V.test(t))return t;if(t.length>0&&!I.test(t))throw new TypeError("invalid parameter value");return'"'+t.replace(k,"\\$1")+'"'}function K(e){this.parameters=Object.create(null),this.type=e}var L={format:function(e){if(!e||"object"!=typeof e)throw new TypeError("argument obj is required");var t=e.parameters,r=e.type;if(!r||!R.test(r))throw new TypeError("invalid type");var n=r;if(t&&"object"==typeof t)for(var o,i=Object.keys(t).sort(),a=0;a<i.length;a++){if(o=i[a],!V.test(o))throw new TypeError("invalid parameter name");n+="; "+o+"="+C(t[o])}return n},parse:function(e){if(!e)throw new TypeError("argument string is required");var t="object"==typeof e?function(e){var t;"function"==typeof e.getHeader?t=e.getHeader("content-type"):"object"==typeof e.headers&&(t=e.headers&&e.headers["content-type"]);if("string"!=typeof t)throw new TypeError("content-type header is missing from object");return t}(e):e;if("string"!=typeof t)throw new TypeError("argument string is required to be a string");var r=t.indexOf(";"),n=-1!==r?t.substr(0,r).trim():t.trim();if(!R.test(n))throw new TypeError("invalid media type");var o=new K(n.toLowerCase());if(-1!==r){var i,a,s;for(S.lastIndex=r;a=S.exec(t);){if(a.index!==r)throw new TypeError("invalid parameter format");r+=a[0].length,i=a[1].toLowerCase(),'"'===(s=a[2])[0]&&(s=s.substr(1,s.length-2).replace(T,"$1")),o.parameters[i]=s}if(r!==t.length)throw new TypeError("invalid parameter format")}return o}},U=function(e,t){if(e=e.trim(),(t=t.trim()).startsWith("about:"))return t;const r=function(e){const t={host:"",path:"",query:"",protocol:""};let r=e,n=e.indexOf("//");t.protocol=r.substring(0,n),n+=2;const o=e.indexOf("/",n),i=e.indexOf("?"),a=e.indexOf("#");-1!==a&&(r=r.substring(0,a));if(-1!==i){const e=r.substring(i);t.query=e,r=r.substring(0,i)}if(-1!==o){const e=r.substring(0,o);t.host=e,r=r.substring(o),t.path=r}else t.host=r;return t}(e),n=function(e){const t={href:e,hash:"",query:"",netPath:!1,absolutePath:!1,relativePath:!1};if(W.test(e))return t.netPath=!0,t;"/"===e[0]?t.absolutePath=!0:""!==e&&(t.relativePath=!0);let r=e;const n=e.indexOf("?"),o=e.indexOf("#");if(-1!==o){const e=r.substring(o);t.hash=e,r=r.substring(0,o)}if(-1!==n){const e=r.substring(n);t.query=e,r=r.substring(0,n)}return t.path=r,t}(t);if(!r.protocol&&!n.netPath)throw new Error("Error, protocol is not specified");if(n.netPath)return n.href.startsWith("//")&&(n.href=r.protocol+n.href),function(e){const t=e.indexOf("//")+2,r=!e.includes("/",t),n=!e.includes("?",t),o=!e.includes("#",t);return r&&n&&o}(n.href)?q(n.href):n.href;if(n.absolutePath){const{path:e,query:t,hash:o}=n;return r.host+z(e)+t+o}if(n.relativePath){const{path:e,query:t,hash:o}=n;let i,a=r.path,s=r.host;return 0===e.length?i=a:(a=a.substring(0,a.lastIndexOf("/")),i=z(a+"/"+e)),s+=""!==i||t||o?i+t+o:"/",s}{const{host:e,path:t,query:o}=r;return t||o?e+t+o+n.hash:q(e)}};function q(e){return e+("/"===e[e.length-1]?"":"/")}function z(e){let t=e.split("/");""===t[0]&&(t=t.slice(1));let r=[];return t.forEach((e,n)=>{"."!==e&&(".."===e?r.pop():""===e&&n!==t.length-1||r.push(e))}),"/"+r.join("/")}const W=new RegExp("^([a-z][a-z0-9+.-]*:)?//","i");var _=fetch;const{isObject:B,splitUrl:D}=v,F=Symbol("$__jref"),M={},Z={},J=(e,t)=>{const r=e in Z?Z[e]:e;if(r in M)return M[r][t]},N={},G={},H=(e,t="",r="")=>{e=JSON.parse(JSON.stringify(e));const n=D(e.$schema||r)[0];if(!n)throw Error("Couldn't determine schema version");delete e.$schema;const o=J(n,"idToken"),i=D(t)[0],a=ee(i,e[o]||""),s=D(a)[0];if(!s)throw Error("Couldn't determine an identifier for the schema");i&&(G[i]=s);const c=!!e.$recursiveAnchor;let u;delete e.$recursiveAnchor,J(n,"vocabulary")&&B(e)&&"$vocabulary"in e?(Z[s]=n,u=e.$vocabulary,delete e.$vocabulary):u=s===n?{[n]:!0}:{};const l={};N[s]={id:s,schemaVersion:n,schema:Q(e,s,n,y.nil,l),anchors:l,recursiveAnchor:c,vocabulary:u,validated:!1}},Q=(e,t,r,n,o)=>{if(B(e)){const i=J(r,"idToken"),a=J(r,"anchorToken");if("string"==typeof e[i]){const n=e[i],o=ee(t,n),[s,c]=D(o);if(delete e[i],c&&(e[a]=a!==i?encodeURI(c):"#"+encodeURI(c)),s!==t)return H(e,ee(t,s),r),{[F]:n}}if("string"==typeof e[a]){const t=a!==i?e[a]:e[a].slice(1);o[t]=n,delete e[a]}return Object.entries(e).reduce((e,[i,a])=>(e[i]=Q(a,t,r,y.append(i,n),o),e),{})}return Array.isArray(e)?e.map((e,i)=>Q(e,t,r,y.append(i,n),o)):e},X=Object.freeze({id:"",schemaVersion:void 0,pointer:"",schema:void 0,recursiveAnchor:!1}),Y=async(e,t=X,r=!1)=>{const n=r&&t.recursiveAnchor?t.recursiveAnchor:ne(t),o=ee(n,e),[i,a]=D(o);if(!(e=>e in N||e in G)(i)){const e=await _(i,{headers:{Accept:"application/schema+json"}});if(e.status>=400)throw await e.text(),Error("Failed to retrieve schema with id: "+i);if(e.headers.has("content-type")){const t=L.parse(e.headers.get("content-type")).type;if("application/schema+json"!==t)throw Error(`${i} is not a schema. Found a document with media type: ${t}`)}H(await e.json(),i)}const s=(e=>N[G[e]]||N[e])(i),c=Object.freeze({id:s.id,schemaVersion:s.schemaVersion,vocabulary:s.vocabulary,pointer:a&&"/"!==a[0]?re(s,a):a,schema:s.schema,recursiveAnchor:t.recursiveAnchor||!!s.recursiveAnchor&&i,validated:s.validated}),u=oe(c);return B(u)&&F in u?Y(u[F],c):J(c.schemaVersion,"jsonReference")&&B(u)&&"string"==typeof u.$ref?Y(u.$ref,c):J(c.schemaVersion,"keywordReference")&&"string"==typeof u&&c.pointer.endsWith("/$ref")?Y(u,c):J(c.schemaVersion,"keywordRecursiveReference")&&"string"==typeof u&&c.pointer.endsWith("/$recursiveRef")?Y(u,c,!0):c},ee=(e,t)=>{const r=U(e,t),n=D(e)[0];if(n&&"file"===te(r)&&"file"!==te(n))throw Error(`Can't access file '${r}' resource from network context '${e}'`);return r},te=e=>{const t=e.match(/^(.+):\/\//);return t?t[1]:""},re=(e,t)=>{if(!(t in e.anchors))throw Error(`No such anchor '${encodeURI(e.id)}#${encodeURI(t)}'`);return e.anchors[t]},ne=e=>`${e.id}#${encodeURI(e.pointer)}`,oe=e=>y.get(e.pointer,e.schema),ie=(e,t)=>{const r=y.append(e,t.pointer);return Y("#"+encodeURI(r),t)},ae=n((e,t)=>oe(t).map(async(r,n)=>e(await ie(n,t),n)));var se={setConfig:(e,t,r)=>{M[e]||(M[e]={}),M[e][t]=r},getConfig:J,add:H,get:Y,markValidated:e=>{N[e].validated=!0},uri:ne,value:oe,has:(e,t)=>e in oe(t),step:ie,entries:e=>Object.keys(oe(e)).map(async t=>[t,await ie(t,e)]),map:ae};const ce="FLAG",ue="BASIC",le="DETAILED",fe="VERBOSE";let de=le,pe=!0;const he=(e,t)=>(n,o=ce)=>{if(![ce,ue,le,fe].includes(o))throw Error(`The '${o}' error format is not supported`);let i=[];const a=r.subscribe("result",ye(o,i));return je(t,n,e),r.unsubscribe(a),i[0]},ye=(e,t)=>{const r=[];return(n,o)=>{const i={...o,errors:[]};for(;r.length>0&&ve(r[r.length-1],i);){const t=r.pop();let n=[];if(e===ue&&(n=t.errors,delete t.errors),i.errors.unshift(t,...n),be(i))break}(e===fe||e!==ce&&!i.valid)&&r.push(i),t[0]=i}},ve=(e,t)=>e.instanceLocation.startsWith(t.instanceLocation)&&(e.absoluteKeywordLocation.startsWith(t.absoluteKeywordLocation)||be(e)),be=e=>e.keyword.endsWith("#$ref")||e.keyword.endsWith("#$recursiveRef"),me={},we=e=>me[e],ge=e=>e in me,Oe={},Ee={},$e=async(e,t)=>{if(!ge(e.schemaVersion+"#validate")){const t=await se.get(e.schemaVersion);(se.getConfig(t.id,"mandatoryVocabularies")||[]).forEach(e=>{if(!t.vocabulary[e])throw Error(`Vocabulary '${e}' must be explicitly declared and required`)}),Object.entries(t.vocabulary).forEach(([e,r])=>{if(e in Oe)Object.entries(Oe[e]).forEach(([e,r])=>{((e,t)=>{me[e]={collectEvaluatedItems:(e,r,n)=>t.interpret(e,r,n)&&0,collectEvaluatedProperties:(e,r,n)=>t.interpret(e,r,n)&&[],...t}})(`${t.id}#${e}`,r)});else if(r)throw Error("Missing required vocabulary: "+e)})}if(pe&&!e.validated){if(se.markValidated(e.id),!(e.schemaVersion in Ee)){const t=await se.get(e.schemaVersion),r={},n=await $e(t,r);Ee[t.id]=he(r,n)}const t=A.cons(e.schema,e.id),r=Ee[e.schemaVersion](t,de);if(!r.valid)throw r}return await we(e.schemaVersion+"#validate").compile(e,t),se.uri(e)},je=(e,t,r)=>{const[n]=r[e];return we(n).interpret(e,t,r)};var xe={validate:async(e,t,r)=>{const n={},o=await $e(e,n),i=(e,t=ce)=>he(n,o)(A.cons(e),t);return void 0===t?i:i(t,r)},setMetaOutputFormat:e=>{de=e},setShouldMetaValidate:e=>{pe=e},FLAG:ce,BASIC:ue,DETAILED:le,VERBOSE:fe,getKeyword:we,hasKeyword:ge,defineVocabulary:(e,t)=>{Oe[e]=t},compileSchema:$e,interpretSchema:je,collectEvaluatedProperties:(e,t,r,n)=>{const[o]=r[e];return we(o).collectEvaluatedProperties(e,t,r,n)},collectEvaluatedItems:(e,t,r,n)=>{const[o]=r[e];return we(o).collectEvaluatedItems(e,t,r,n)}};var Pe={compile:()=>{},interpret:()=>!0},Ae=async e=>Object.entries(await e),Se=n(async(e,t)=>(await t).map(e)),Ie=n(async(e,t,r)=>(await r).reduce(async(t,r)=>{let n;try{n=await t}catch(e){try{await r}catch(e){}return t}return e(n,r)},t)),Ve=n(async(e,t,r={})=>Ie(async(t,r)=>await e(r)?t.concat([r]):t,[],t,r)),Te=n(async(e,t)=>{const r=await Se(e,t);return(await Promise.all(r)).some(e=>e)}),ke=n(async(e,t)=>{const r=await Se(e,t);return(await Promise.all(r)).every(e=>e)}),Re=n((e,t)=>e.reduce(async(e,t)=>t(await e),t)),Ce={entries:Ae,map:Se,filter:Ve,reduce:Ie,some:Te,every:ke,pipeline:Re,all:e=>Promise.all(e),allValues:e=>Re([Ae,Ie(async(e,[t,r])=>(e[t]=await r,e),{})],e)};var Ke={compile:async(e,t)=>{const r=se.uri(e);if(!(r in t)){t[r]=!1;const n=se.value(e);t[r]=[e.schemaVersion+"#validate",se.uri(e),"boolean"==typeof n?n:await Ce.pipeline([se.entries,Ce.map(async t=>{const[r,n]=await t;return[`${e.schemaVersion}#${r}`,n]}),Ce.filter(async t=>{const[r]=await t;return xe.hasKeyword(r)&&r!==e.schemaVersion+"#validate"}),Ce.map(async r=>{const[n,o]=await r,i=await o,a=await xe.getKeyword(n).compile(i,t,e);return[n,se.uri(i),a]}),Ce.all],e)]}},interpret:(e,t,n)=>{const[o,i,a]=n[e],s="boolean"==typeof a?a:a.every(([e,o,i])=>{const a=xe.getKeyword(e).interpret(i,t,n);return r.publishSync("result",{keyword:e,absoluteKeywordLocation:o,instanceLocation:A.uri(t),valid:a}),a});return r.publishSync("result",{keyword:o,absoluteKeywordLocation:i,instanceLocation:A.uri(t),valid:s}),s},collectEvaluatedProperties:(e,t,r,n=!1)=>{const o=r[e][2];return"boolean"==typeof o?!!o&&[]:o.filter(([e])=>!n||!e.endsWith("#unevaluatedProperties")).reduce((e,[n,,o])=>{const i=e&&xe.getKeyword(n).collectEvaluatedProperties(o,t,r);return i&&e.concat(i)},[])},collectEvaluatedItems:(e,t,r,n=!1)=>{const o=r[e][2];return"boolean"==typeof o?!!o&&[]:o.filter(([e])=>!n||!e.endsWith("#unevaluatedItems")).reduce((e,[n,,o])=>{const i=!1!==e&&xe.getKeyword(n).collectEvaluatedItems(o,t,r);return!1!==i&&Math.max(e,i)},0)}},Le={Core:xe,Schema:se,Instance:A,Keywords:{metaData:Pe,validate:Ke}},Ue=Le.Core,qe=Le.Schema,ze=Le.Instance,We=Le.Keywords;e.Core=Ue,e.Instance=ze,e.Keywords=We,e.Schema=qe,e.default=Le,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
//# sourceMappingURL=json-schema-core-umd.min.js.map |
@@ -18,8 +18,13 @@ const Pact = require("@hyperjump/pact"); | ||
Schema.entries, | ||
Pact.map(([keyword, keywordSchema]) => { | ||
Pact.map(async (entry) => { | ||
const [keyword, keywordSchema] = await entry; | ||
const keywordId = `${schema.schemaVersion}#${keyword}`; | ||
return [keywordId, keywordSchema]; | ||
}), | ||
Pact.filter(([keywordId]) => Core.hasKeyword(keywordId) && keywordId !== `${schema.schemaVersion}#validate`), | ||
Pact.map(async ([keywordId, keywordSchemaPromise]) => { | ||
Pact.filter(async (entry) => { | ||
const [keywordId] = await entry; | ||
return Core.hasKeyword(keywordId) && keywordId !== `${schema.schemaVersion}#validate`; | ||
}), | ||
Pact.map(async (entry) => { | ||
const [keywordId, keywordSchemaPromise] = await entry; | ||
const keywordSchema = await keywordSchemaPromise; | ||
@@ -26,0 +31,0 @@ const keywordAst = await Core.getKeyword(keywordId).compile(keywordSchema, ast, schema); |
@@ -214,3 +214,3 @@ const contentTypeParser = require("content-type"); | ||
const entries = (doc) => Object.keys(value(doc)) | ||
.map((key) => [key, step(key, doc)]); | ||
.map(async (key) => [key, await step(key, doc)]); | ||
@@ -217,0 +217,0 @@ const map = curry((fn, doc) => value(doc) |
{ | ||
"name": "@hyperjump/json-schema-core", | ||
"version": "0.8.2", | ||
"version": "0.9.0", | ||
"description": "A framework for building JSON Schema tools", | ||
@@ -27,2 +27,6 @@ "main": "lib/index.js", | ||
"license": "MIT", | ||
"funding": { | ||
"type": "github", | ||
"url": "https://github.com/sponsors/jdesrosiers" | ||
}, | ||
"devDependencies": { | ||
@@ -37,3 +41,3 @@ "@rollup/plugin-commonjs": "^11.0.2", | ||
"nock": "^9.6.1", | ||
"rollup": "^2.3.4", | ||
"rollup": "^2.7.2", | ||
"rollup-plugin-terser": "^5.3.0" | ||
@@ -43,3 +47,3 @@ }, | ||
"@hyperjump/json-pointer": "^0.8.0", | ||
"@hyperjump/pact": "^0.1.0", | ||
"@hyperjump/pact": "^0.1.1", | ||
"content-type": "^1.0.4", | ||
@@ -46,0 +50,0 @@ "make-fetch-happen": "^8.0.4", |
@@ -71,3 +71,3 @@ # Hyperjump - JSON Schema Core | ||
Similar to `Schema.step`, but gets an adjacent key. | ||
* **Schema.entries**: (doc: SDoc) => [key, Promise<SDoc>] | ||
* **Schema.entries**: (doc: SDoc) => [Promise<[string, SDoc]>] | ||
@@ -74,0 +74,0 @@ Similar to `Object.entries`, but returns SDocs for values. |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
1494636
8818
Updated@hyperjump/pact@^0.1.1