@accordproject/concerto-util
Advanced tools
Comparing version 3.20.0 to 3.20.1
/*! For license information please see concerto-util.js.LICENSE.txt */ | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["concerto-util"]=t():e["concerto-util"]=t()}(self,(()=>{return e={573:(e,t,r)=>{"use strict";const s=r(187);e.exports=s.PromisePool},160:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PromisePoolError=void 0;class r extends Error{constructor(e,t){super(),this.item=t,this.name=this.constructor.name,this.message=this.messageFrom(e),Error.captureStackTrace(this,this.constructor)}static createFrom(e,t){return new this(e,t)}messageFrom(e){return e instanceof Error||"object"==typeof e?e.message:"string"==typeof e||"number"==typeof e?e.toString():""}}t.PromisePoolError=r},241:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PromisePoolExecutor=void 0;const s=r(160);t.PromisePoolExecutor=class{constructor(){this.tasks=[],this.items=[],this.errors=[],this.results=[],this.concurrency=10,this.handler=()=>{},this.errorHandler=void 0}withConcurrency(e){return this.concurrency=e,this}for(e){return this.items=e,this}withHandler(e){return this.handler=e,this}handleError(e){return this.errorHandler=e,this}hasReachedConcurrencyLimit(){return this.activeCount()>=this.concurrency}activeCount(){return this.tasks.length}async start(){return this.validateInputs(),await this.process()}validateInputs(){if("function"!=typeof this.handler)throw new Error("The first parameter for the .process(fn) method must be a function");if(!("number"==typeof this.concurrency&&this.concurrency>=1))throw new TypeError(`"concurrency" must be a number, 1 or up. Received "${this.concurrency}" (${typeof this.concurrency})`);if(!Array.isArray(this.items))throw new TypeError('"items" must be an array. Received '+typeof this.items);if(this.errorHandler&&"function"!=typeof this.errorHandler)throw new Error("The error handler must be a function. Received "+typeof this.errorHandler)}async process(){for(const e of this.items)this.hasReachedConcurrencyLimit()&&await this.processingSlot(),this.startProcessing(e);return this.drained()}async processingSlot(){return this.waitForTaskToFinish()}async waitForTaskToFinish(){await Promise.race(this.tasks)}startProcessing(e){const t=this.createTaskFor(e).then((e=>{this.results.push(e),this.tasks.splice(this.tasks.indexOf(t),1)})).catch((r=>{if(this.tasks.splice(this.tasks.indexOf(t),1),this.errorHandler)return this.errorHandler(r,e);this.errors.push(s.PromisePoolError.createFrom(r,e))}));this.tasks.push(t)}async createTaskFor(e){return this.handler(e)}async drained(){return await this.drainActiveTasks(),{results:this.results,errors:this.errors}}async drainActiveTasks(){await Promise.all(this.tasks)}}},187:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PromisePool=void 0;const s=r(241);class n{constructor(e){this.concurrency=10,this.items=null!=e?e:[],this.errorHandler=void 0}withConcurrency(e){return this.concurrency=e,this}static withConcurrency(e){return(new this).withConcurrency(e)}for(e){return new n(e).withConcurrency(this.concurrency)}static for(e){return(new this).for(e)}handleError(e){return this.errorHandler=e,this}async process(e){return(new s.PromisePoolExecutor).withConcurrency(this.concurrency).withHandler(e).handleError(this.errorHandler).for(this.items).start()}}t.PromisePool=n},599:(e,t,r)=>{"use strict";const s=r(330),n=r(673);class o extends Error{constructor(e,t,r){super(e),this.component=t||s.name,this.name=this.constructor.name,this.message=e,this.errorType=r||n.DEFAULT_BASE_EXCEPTION,"function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}}e.exports=o},133:(e,t,r)=>{"use strict";const s=r(599);e.exports=class extends s{constructor(e,t,r,s,n){super(r||e,n),this.fileLocation=t,this.shortMessage=e,this.fileName=s}getFileLocation(){return this.fileLocation}getShortMessage(){return this.shortMessage}getFileName(){return this.fileName}}},673:e=>{"use strict";e.exports={DEFAULT_BASE_EXCEPTION:"DefaultBaseException",DEFAULT_VALIDATOR_EXCEPTION:"DefaultValidatorException",REGEX_VALIDATOR_EXCEPTION:"RegexValidatorException",TYPE_NOT_FOUND_EXCEPTION:"TypeNotFoundException",DEPRECATION_WARNING:"DeprecationWarning",CONCERTO_DEPRECATION_001:"concerto-dep:001",CONCERTO_DEPRECATION_002:"concerto-dep:002"}},168:(e,t,r)=>{"use strict";const s=r(124)("concerto:FileDownloader"),n=r(573),o=e=>[].concat(...e),i=e=>e.filter(Boolean),c=async(e,t)=>{const r=e.response&&e.response.status&&200!==e.response.status,s=e.code&&"ENOTFOUND"===e.code;if(r||s){const e=new Error(`Unable to download external model dependency '${t.url}'`);throw e.code="MISSING_DEPENDENCY",e}throw new Error("Failed to load model file. Job: "+t.url+" Details: "+e)};e.exports=class{constructor(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:10;this.fileLoader=e,this.concurrency=r,this.getExternalImports=t}downloadExternalDependencies(e,t){s("downloadExternalDependencies");const r=new Set;t||(t={});const a=o(e.map((e=>{const s=this.getExternalImports(e);return Object.keys(s).map((e=>({downloadedUris:r,url:s[e],options:t})))})));return n.withConcurrency(this.concurrency).for(a).handleError(c).process((e=>this.runJob(e,this.fileLoader))).then((e=>{let{results:t}=e;return i(o(t))}))}runJob(e,t){const r=e.downloadedUris,a=e.options,u=e.url;return r.add(u),s("runJob","Loading",u),t.load(u,a).then((async e=>{s("runJob","Loaded",u);const l=this.getExternalImports(e),h=Array.from(new Set(Object.keys(l).map((e=>l[e]))));return s("runJob","importedUris",h),(await n.withConcurrency(this.concurrency).for(h).handleError(c).process((e=>{if(!r.has(e))return this.runJob({options:a,url:e,downloadedUris:r},t)})).then((e=>{let{results:t}=e;return i(o(t))}))).concat([e])}))}}},64:(e,t,r)=>{"use strict";const s=r(686),n=r(558),o=r(926);e.exports=class extends o{constructor(e){super(),this.outputDirectory=e,this.relativeDir=null,this.fileName=null,s.mkdirSync(e,{recursive:!0})}openFile(e){this.fileName=e,this.relativeDir=null}openRelativeFile(e,t){this.relativeDir=e,this.fileName=t}writeLine(e,t){if(!this.fileName)throw Error("File has not been opened!");super.writeLine(e,t)}writeBeforeLine(e,t){if(!this.fileName)throw Error("File has not been opened!");super.writeBeforeLine(e,t)}closeFile(){if(!this.fileName)throw new Error("No file open");let e=this.outputDirectory;this.relativeDir&&(e=n.resolve(e,this.relativeDir)),e=n.resolve(e,this.fileName),s.mkdirSync(n.dirname(e),{recursive:!0}),s.writeFileSync(e,this.getBuffer()),this.fileName=null,this.relativeDir=null,this.clearBuffer()}}},721:e=>{"use strict";const t=/^(\p{Lu}|\p{Ll}|\p{Lt}|\p{Lm}|\p{Lo}|\p{Nl}|\$|_|\\u[0-9A-Fa-f]{4})(?:\p{Lu}|\p{Ll}|\p{Lt}|\p{Lm}|\p{Lo}|\p{Nl}|\$|_|\\u[0-9A-Fa-f]{4}|\p{Mn}|\p{Mc}|\p{Nd}|\p{Pc}|\u200C|\u200D)*$/u;e.exports={normalizeIdentifier:function(e){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1;const s=(e,t)=>{let r="";for(const e of t)r+=`_${e.codePointAt(0).toString(16)}`;return r};let n=e??String(e);if("string"!=typeof n)throw new Error(`Unsupported identifier type, '${typeof n}'.`);if(n=n.replace(/^\p{Nd}/u,"_$&").replace(/[-‐−@#:;><|/\\\u200c\u200d]/g,"_").replace(/\s/g,"_").replace(/(?!\p{Lu}|\p{Ll}|\p{Lt}|\p{Lm}|\p{Lo}|\p{Nl}|\$|_|\p{Mn}|\p{Mc}|\p{Nd}|\p{Pc}|\u200C|\u200D|\\u[0-9A-Fa-f]{4})(.)/gu,s).replace(/([\uD800-\uDFFF])/g,s),r>0&&(n=n.substring(0,r)),!t.test(n))throw new Error(`Unexpected error. Not able to escape identifier '${n}'.`);return n},ID_REGEX:t}},530:(e,t,r)=>{"use strict";const s=r(926);e.exports=class extends s{constructor(){super(),this.fileName="",this.data=new Map}openFile(e){this.fileName=e}closeFile(){this.data.set(this.fileName,this.getBuffer()),this.clearBuffer()}getFilesInMemory(){return this.data}}},911:e=>{"use strict";e.exports={labelToSentence:function(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"").replace(/([a-z])([A-Z])/g,"$1 $2").replace(/([A-Z])([a-z])/g," $1$2").replace(/ +/g," ").replace(/^./,(e=>e.toUpperCase())).trim()},sentenceToLabel:function(){const e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"").split(/[^A-Za-z0-9_-]+/);return e.forEach(((t,r)=>{e[r]=e[r].replace(/^./,(e=>e.toUpperCase()))})),e.join("").replace(/^./,(e=>e.toLowerCase()))}}},996:e=>{"use strict";e.exports=class{constructor(){this.fileLoaders=[]}addFileLoader(e){this.fileLoaders.push(e)}getFileLoaders(){return this.fileLoaders}clearFileLoaders(){this.fileLoaders=[]}accepts(e){for(let t=0;t<this.fileLoaders.length;t++)if(this.fileLoaders[t].accepts(e))return!0;return!1}load(e,t){for(let r=0;r<this.fileLoaders.length;r++){const s=this.fileLoaders[r];if(s.accepts(e))return s.load(e,t)}throw new Error("Failed to find a model file loader that can handle: "+e)}}},546:(e,t,r)=>{"use strict";const s=r(996),n=r(25),o=r(990);e.exports=class extends s{constructor(e){super();const t=new n(e),r=new o(e);this.addFileLoader(r),this.addFileLoader(t)}}},990:(e,t,r)=>{"use strict";const s=r(25);e.exports=class extends s{constructor(e){super(e)}accepts(e){return e.startsWith("github://")}load(e,t){const r="https://raw.githubusercontent.com/"+e.substring(9);return super.load(r,t)}}},25:e=>{"use strict";e.exports=class{constructor(e){this.processFile=e}accepts(e){return e.startsWith("http://")||e.startsWith("https://")}async load(e,t){t||(t={method:"GET",headers:{"Content-Type":"text/plain"}}),console.log(e);const r=await fetch(e,t);if(!r.ok)throw new Error(`HTTP request failed with status: ${r.status}`);const s=await r.text(),n=new URL(e),o="@"+(n.host+n.pathname).replace(/\//g,".");return this.processFile(o,s)}}},545:e=>{"use strict";const t={error:0,warn:1,info:2,http:3,verbose:4,debug:5,silly:6},r=e=>e,s={};Object.keys(t).forEach((e=>{s[e]=function(){for(var s=arguments.length,n=new Array(s),o=0;o<s;o++)n[o]=arguments[o];return function(e){let s=e;for(var n=arguments.length,o=new Array(n>1?n-1:0),i=1;i<n;i++)o[i-1]=arguments[i];let c=o,a=c.shift();if(a&&"object"==typeof a&&a.level&&a.message){const e=a.padding&&a.padding[a.level];"error"===a.level&&a.stack?(s="error",a=`${a.message}\n${a.stack}`):Object.keys(t).includes(a.level)&&(s=a.level,a=a.message),a=e?`${e} ${a}`:a}c.unshift(a),(["error","warn"].includes(s)?console.error:console.log)(`${(new Date).toLocaleTimeString()} - ${s}:`,...c.map((e=>e instanceof Error?`${e.message}\n${e.stack}`:e)).map(r))}(e,...n)}}));class n{static dispatch(e){for(var r=arguments.length,s=new Array(r>1?r-1:0),n=1;n<r;n++)s[n-1]=arguments[n];t[e]>t[this.level]||this.transports.forEach((t=>{t[e]&&t[e](...s)}))}static add(e){this.transports.push(e)}static error(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return this.dispatch("error",...t)}static warn(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return this.dispatch("warn",...t)}static info(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return this.dispatch("info",...t)}static log(){return this.info(...arguments)}static http(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return this.dispatch("http",...t)}static verbose(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return this.dispatch("verbose",...t)}static debug(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return this.dispatch("debug",...t)}static silly(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return this.dispatch("silly",...t)}}n.level="info",n.transports=[s],e.exports=n},95:(e,t,r)=>{"use strict";const s=r(686),n=r(558),o=r(431);e.exports={writeModelsToFileSystem:function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!t)throw new Error("`path` is a required parameter of writeModelsToFileSystem");const i=Object.assign({includeExternalModels:!0},r);e.forEach((function(e){if(e.external&&!i.includeExternalModels)return;const r=o(e.fileName).split("/").pop();s.writeFileSync(t+n.sep+r,e.definitions)}))}}},328:e=>{"use strict";e.exports=class{static isNull(e){return null==e}}},717:e=>{"use strict";e.exports=class{constructor(e){this.stack=[],this.push(e)}push(e,t){if(t&&!(e instanceof t))throw new Error("Did not find expected type "+t.constructor.name+" as argument to push. Found: "+e.toString());this.stack.push(e)}pop(e){return this.peek(e),this.stack.pop()}peek(e){if(this.stack.length<1)throw new Error("Stack is empty!");const t=this.stack[this.stack.length-1];if(e&&!(t instanceof e))throw new Error("Did not find expected type "+e+" on head of stack. Found: "+t);return t}clear(){this.stack=[]}}},361:e=>{"use strict";let t=!1;e.exports={printDeprecationWarning:function(e,r,s,n){t||(t=!0,function(e,t){console.warn({message:`DEPRECATED: ${e}`,type:t?.type,code:t?.code,detail:t?.detail})}(`DEPRECATED: ${e}`,{type:r,code:s,detail:n}))}}},926:e=>{"use strict";e.exports=class{constructor(){this.beforeBuffer="",this.buffer="",this.linesWritten=0}writeBeforeLine(e,t){for(let t=0;t<e;t++)this.beforeBuffer+=" ";this.beforeBuffer+=t,this.beforeBuffer+="\n",this.linesWritten++}writeLine(e,t){for(let t=0;t<e;t++)this.write(" ");this.write(t),this.write("\n"),this.linesWritten++}getLineCount(){return this.linesWritten}writeIndented(e,t){for(let t=0;t<e;t++)this.write(" ");this.write(t)}write(e){if("string"!=typeof e)throw new Error("Can only append strings. Argument "+e+" has type "+typeof e);this.buffer+=e,this.linesWritten+=e.split(/\r\n|\r|\n/).length}getBuffer(){return this.beforeBuffer+this.buffer}clearBuffer(){this.beforeBuffer="",this.buffer="",this.linesWritten=0}}},124:(e,t,r)=>{var s=r(907);t.formatArgs=function(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const r="color: "+this.color;t.splice(1,0,r,"color: inherit");let s=0,n=0;t[0].replace(/%[a-zA-Z%]/g,(e=>{"%%"!==e&&(s++,"%c"===e&&(n=s))})),t.splice(n,0,r)},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(e){}},t.load=function(){let e;try{e=t.storage.getItem("debug")}catch(e){}return!e&&void 0!==s&&"env"in s&&(e={NODE_ENV:"production"}.DEBUG),e},t.useColors=function(){if("undefined"!=typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let e;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&(e=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(e[1],10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},t.storage=function(){try{return localStorage}catch(e){}}(),t.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.log=console.debug||console.log||(()=>{}),e.exports=r(891)(t);const{formatters:n}=e.exports;n.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}},891:(e,t,r)=>{e.exports=function(e){function t(e){let r,n,o,i=null;function c(...e){if(!c.enabled)return;const s=c,n=Number(new Date),o=n-(r||n);s.diff=o,s.prev=r,s.curr=n,r=n,e[0]=t.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let i=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,((r,n)=>{if("%%"===r)return"%";i++;const o=t.formatters[n];if("function"==typeof o){const t=e[i];r=o.call(s,t),e.splice(i,1),i--}return r})),t.formatArgs.call(s,e),(s.log||t.log).apply(s,e)}return c.namespace=e,c.useColors=t.useColors(),c.color=t.selectColor(e),c.extend=s,c.destroy=t.destroy,Object.defineProperty(c,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==i?i:(n!==t.namespaces&&(n=t.namespaces,o=t.enabled(e)),o),set:e=>{i=e}}),"function"==typeof t.init&&t.init(c),c}function s(e,r){const s=t(this.namespace+(void 0===r?":":r)+e);return s.log=this.log,s}function n(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return t.debug=t,t.default=t,t.coerce=function(e){return e instanceof Error?e.stack||e.message:e},t.disable=function(){const e=[...t.names.map(n),...t.skips.map(n).map((e=>"-"+e))].join(",");return t.enable(""),e},t.enable=function(e){let r;t.save(e),t.namespaces=e,t.names=[],t.skips=[];const s=("string"==typeof e?e:"").split(/[\s,]+/),n=s.length;for(r=0;r<n;r++)s[r]&&("-"===(e=s[r].replace(/\*/g,".*?"))[0]?t.skips.push(new RegExp("^"+e.slice(1)+"$")):t.names.push(new RegExp("^"+e+"$")))},t.enabled=function(e){if("*"===e[e.length-1])return!0;let r,s;for(r=0,s=t.skips.length;r<s;r++)if(t.skips[r].test(e))return!1;for(r=0,s=t.names.length;r<s;r++)if(t.names[r].test(e))return!0;return!1},t.humanize=r(250),t.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(e).forEach((r=>{t[r]=e[r]})),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){let r=0;for(let t=0;t<e.length;t++)r=(r<<5)-r+e.charCodeAt(t),r|=0;return t.colors[Math.abs(r)%t.colors.length]},t.enable(t.load()),t}},250:e=>{var t=1e3,r=60*t,s=60*r,n=24*s,o=7*n;function i(e,t,r,s){var n=t>=1.5*r;return Math.round(e/r)+" "+s+(n?"s":"")}e.exports=function(e,c){c=c||{};var a,u,l=typeof e;if("string"===l&&e.length>0)return function(e){if(!((e=String(e)).length>100)){var i=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(i){var c=parseFloat(i[1]);switch((i[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*c;case"weeks":case"week":case"w":return c*o;case"days":case"day":case"d":return c*n;case"hours":case"hour":case"hrs":case"hr":case"h":return c*s;case"minutes":case"minute":case"mins":case"min":case"m":return c*r;case"seconds":case"second":case"secs":case"sec":case"s":return c*t;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return c;default:return}}}}(e);if("number"===l&&isFinite(e))return c.long?(a=e,(u=Math.abs(a))>=n?i(a,u,n,"day"):u>=s?i(a,u,s,"hour"):u>=r?i(a,u,r,"minute"):u>=t?i(a,u,t,"second"):a+" ms"):function(e){var o=Math.abs(e);return o>=n?Math.round(e/n)+"d":o>=s?Math.round(e/s)+"h":o>=r?Math.round(e/r)+"m":o>=t?Math.round(e/t)+"s":e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},907:e=>{var t,r,s=e.exports={};function n(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function i(e){if(t===setTimeout)return setTimeout(e,0);if((t===n||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(r){try{return t.call(null,e,0)}catch(r){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:n}catch(e){t=n}try{r="function"==typeof clearTimeout?clearTimeout:o}catch(e){r=o}}();var c,a=[],u=!1,l=-1;function h(){u&&c&&(u=!1,c.length?a=c.concat(a):l=-1,a.length&&p())}function p(){if(!u){var e=i(h);u=!0;for(var t=a.length;t;){for(c=a,a=[];++l<t;)c&&c[l].run();l=-1,t=a.length}c=null,u=!1,function(e){if(r===clearTimeout)return clearTimeout(e);if((r===o||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(e);try{return r(e)}catch(t){try{return r.call(null,e)}catch(t){return r.call(this,e)}}}(e)}}function d(e,t){this.fun=e,this.array=t}function f(){}s.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];a.push(new d(e,t)),1!==a.length||u||i(p)},d.prototype.run=function(){this.fun.apply(null,this.array)},s.title="browser",s.browser=!0,s.env={},s.argv=[],s.version="",s.versions={},s.on=f,s.addListener=f,s.once=f,s.off=f,s.removeListener=f,s.removeAllListeners=f,s.emit=f,s.prependListener=f,s.prependOnceListener=f,s.listeners=function(e){return[]},s.binding=function(e){throw new Error("process.binding is not supported")},s.cwd=function(){return"/"},s.chdir=function(e){throw new Error("process.chdir is not supported")},s.umask=function(){return 0}},431:e=>{"use strict";e.exports=e=>{const t=/^\\\\\?\\/.test(e),r=/[^\u0000-\u0080]+/.test(e);return t||r?e:e.replace(/\\/g,"/")}},237:(e,t,r)=>{"use strict";const s=r(599),n=r(133),o=r(168),i=r(996),c=r(546),a=r(990),u=r(25),l=r(926),h=r(64),p=r(95),d=r(530),f=r(545),m=r(717),g=r(911),y=r(721),w=r(673),C=r(328),F=r(361);e.exports={BaseException:s,BaseFileException:n,FileDownloader:o,CompositeFileLoader:i,DefaultFileLoader:c,GitHubFileLoader:a,HTTPFileLoader:u,Writer:l,FileWriter:h,InMemoryWriter:d,ModelWriter:p,Logger:f,TypedStack:m,Label:g,Identifiers:y,ErrorCodes:w,NullUtil:C,Warning:F}},686:()=>{},558:()=>{},330:e=>{"use strict";e.exports=JSON.parse('{"name":"@accordproject/concerto-util","version":"3.20.0","description":"Utilities for Concerto Modeling Language","homepage":"https://github.com/accordproject/concerto","engines":{"node":">=18","npm":">=10"},"main":"index.js","browser":"dist/concerto-util.js","typings":"types/index.d.ts","scripts":{"prepublishOnly":"npm run webpack","pretest":"npm run lint && npm run doc","lint":"eslint .","doc":"jsdoc --pedantic --recurse -c jsdoc.json","test":"nyc mocha --recursive -t 10000","test:watch":"nyc mocha --watch --recursive -t 10000","mocha":"mocha --recursive -t 10000","nyc":"nyc mocha --recursive -t 10000","build":"npm run build:types","postbuild":"npm run webpack","webpack":"webpack --config webpack.config.js --mode production","build:types":"tsc index.js --declaration --allowJs --emitDeclarationOnly --outDir types"},"repository":{"type":"git","url":"https://github.com/accordproject/concerto.git","directory":"packages/concerto-util"},"keywords":["blockchain","hyperledger","solutions"],"author":"accordproject.org","license":"Apache-2.0","devDependencies":{"chai":"4.3.6","chai-as-promised":"7.1.1","chai-things":"0.2.0","eslint":"8.57.1","jsdoc":"^4.0.4","mocha":"10.8.2","node-polyfill-webpack-plugin":"4.0.0","nyc":"17.1.0","tmp-promise":"3.0.3","typescript":"5.7.2","undici":"^7.0.0","webpack":"5.96.1","sinon":"19.0.2"},"dependencies":{"@supercharge/promise-pool":"1.7.0","debug":"4.3.7","slash":"3.0.0"},"browserslist":"> 0.25%, not dead","nyc":{"produce-source-map":"true","sourceMap":"inline","reporter":["lcov","text-summary","html","json"],"include":["lib/**/*.js"],"all":true,"check-coverage":true,"statements":99,"branches":93,"functions":98,"lines":99}}')}},t={},function r(s){var n=t[s];if(void 0!==n)return n.exports;var o=t[s]={exports:{}};return e[s](o,o.exports,r),o.exports}(237);var e,t})); | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["concerto-util"]=t():e["concerto-util"]=t()}(self,(()=>{return e={573:(e,t,r)=>{"use strict";const s=r(187);e.exports=s.PromisePool},160:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PromisePoolError=void 0;class r extends Error{constructor(e,t){super(),this.item=t,this.name=this.constructor.name,this.message=this.messageFrom(e),Error.captureStackTrace(this,this.constructor)}static createFrom(e,t){return new this(e,t)}messageFrom(e){return e instanceof Error||"object"==typeof e?e.message:"string"==typeof e||"number"==typeof e?e.toString():""}}t.PromisePoolError=r},241:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PromisePoolExecutor=void 0;const s=r(160);t.PromisePoolExecutor=class{constructor(){this.tasks=[],this.items=[],this.errors=[],this.results=[],this.concurrency=10,this.handler=()=>{},this.errorHandler=void 0}withConcurrency(e){return this.concurrency=e,this}for(e){return this.items=e,this}withHandler(e){return this.handler=e,this}handleError(e){return this.errorHandler=e,this}hasReachedConcurrencyLimit(){return this.activeCount()>=this.concurrency}activeCount(){return this.tasks.length}async start(){return this.validateInputs(),await this.process()}validateInputs(){if("function"!=typeof this.handler)throw new Error("The first parameter for the .process(fn) method must be a function");if(!("number"==typeof this.concurrency&&this.concurrency>=1))throw new TypeError(`"concurrency" must be a number, 1 or up. Received "${this.concurrency}" (${typeof this.concurrency})`);if(!Array.isArray(this.items))throw new TypeError('"items" must be an array. Received '+typeof this.items);if(this.errorHandler&&"function"!=typeof this.errorHandler)throw new Error("The error handler must be a function. Received "+typeof this.errorHandler)}async process(){for(const e of this.items)this.hasReachedConcurrencyLimit()&&await this.processingSlot(),this.startProcessing(e);return this.drained()}async processingSlot(){return this.waitForTaskToFinish()}async waitForTaskToFinish(){await Promise.race(this.tasks)}startProcessing(e){const t=this.createTaskFor(e).then((e=>{this.results.push(e),this.tasks.splice(this.tasks.indexOf(t),1)})).catch((r=>{if(this.tasks.splice(this.tasks.indexOf(t),1),this.errorHandler)return this.errorHandler(r,e);this.errors.push(s.PromisePoolError.createFrom(r,e))}));this.tasks.push(t)}async createTaskFor(e){return this.handler(e)}async drained(){return await this.drainActiveTasks(),{results:this.results,errors:this.errors}}async drainActiveTasks(){await Promise.all(this.tasks)}}},187:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PromisePool=void 0;const s=r(241);class n{constructor(e){this.concurrency=10,this.items=null!=e?e:[],this.errorHandler=void 0}withConcurrency(e){return this.concurrency=e,this}static withConcurrency(e){return(new this).withConcurrency(e)}for(e){return new n(e).withConcurrency(this.concurrency)}static for(e){return(new this).for(e)}handleError(e){return this.errorHandler=e,this}async process(e){return(new s.PromisePoolExecutor).withConcurrency(this.concurrency).withHandler(e).handleError(this.errorHandler).for(this.items).start()}}t.PromisePool=n},599:(e,t,r)=>{"use strict";const s=r(330),n=r(673);class o extends Error{constructor(e,t,r){super(e),this.component=t||s.name,this.name=this.constructor.name,this.message=e,this.errorType=r||n.DEFAULT_BASE_EXCEPTION,"function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}}e.exports=o},133:(e,t,r)=>{"use strict";const s=r(599);e.exports=class extends s{constructor(e,t,r,s,n){super(r||e,n),this.fileLocation=t,this.shortMessage=e,this.fileName=s}getFileLocation(){return this.fileLocation}getShortMessage(){return this.shortMessage}getFileName(){return this.fileName}}},673:e=>{"use strict";e.exports={DEFAULT_BASE_EXCEPTION:"DefaultBaseException",DEFAULT_VALIDATOR_EXCEPTION:"DefaultValidatorException",REGEX_VALIDATOR_EXCEPTION:"RegexValidatorException",TYPE_NOT_FOUND_EXCEPTION:"TypeNotFoundException",DEPRECATION_WARNING:"DeprecationWarning",CONCERTO_DEPRECATION_001:"concerto-dep:001",CONCERTO_DEPRECATION_002:"concerto-dep:002"}},168:(e,t,r)=>{"use strict";const s=r(124)("concerto:FileDownloader"),n=r(573),o=e=>[].concat(...e),i=e=>e.filter(Boolean),c=async(e,t)=>{const r=e.response&&e.response.status&&200!==e.response.status,s=e.code&&"ENOTFOUND"===e.code;if(r||s){const e=new Error(`Unable to download external model dependency '${t.url}'`);throw e.code="MISSING_DEPENDENCY",e}throw new Error("Failed to load model file. Job: "+t.url+" Details: "+e)};e.exports=class{constructor(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:10;this.fileLoader=e,this.concurrency=r,this.getExternalImports=t}downloadExternalDependencies(e,t){s("downloadExternalDependencies");const r=new Set;t||(t={});const a=o(e.map((e=>{const s=this.getExternalImports(e);return Object.keys(s).map((e=>({downloadedUris:r,url:s[e],options:t})))})));return n.withConcurrency(this.concurrency).for(a).handleError(c).process((e=>this.runJob(e,this.fileLoader))).then((e=>{let{results:t}=e;return i(o(t))}))}runJob(e,t){const r=e.downloadedUris,a=e.options,u=e.url;return r.add(u),s("runJob","Loading",u),t.load(u,a).then((async e=>{s("runJob","Loaded",u);const l=this.getExternalImports(e),h=Array.from(new Set(Object.keys(l).map((e=>l[e]))));return s("runJob","importedUris",h),(await n.withConcurrency(this.concurrency).for(h).handleError(c).process((e=>{if(!r.has(e))return this.runJob({options:a,url:e,downloadedUris:r},t)})).then((e=>{let{results:t}=e;return i(o(t))}))).concat([e])}))}}},64:(e,t,r)=>{"use strict";const s=r(686),n=r(558),o=r(926);e.exports=class extends o{constructor(e){super(),this.outputDirectory=e,this.relativeDir=null,this.fileName=null,s.mkdirSync(e,{recursive:!0})}openFile(e){this.fileName=e,this.relativeDir=null}openRelativeFile(e,t){this.relativeDir=e,this.fileName=t}writeLine(e,t){if(!this.fileName)throw Error("File has not been opened!");super.writeLine(e,t)}writeBeforeLine(e,t){if(!this.fileName)throw Error("File has not been opened!");super.writeBeforeLine(e,t)}closeFile(){if(!this.fileName)throw new Error("No file open");let e=this.outputDirectory;this.relativeDir&&(e=n.resolve(e,this.relativeDir)),e=n.resolve(e,this.fileName),s.mkdirSync(n.dirname(e),{recursive:!0}),s.writeFileSync(e,this.getBuffer()),this.fileName=null,this.relativeDir=null,this.clearBuffer()}}},721:e=>{"use strict";const t=/^(\p{Lu}|\p{Ll}|\p{Lt}|\p{Lm}|\p{Lo}|\p{Nl}|\$|_|\\u[0-9A-Fa-f]{4})(?:\p{Lu}|\p{Ll}|\p{Lt}|\p{Lm}|\p{Lo}|\p{Nl}|\$|_|\\u[0-9A-Fa-f]{4}|\p{Mn}|\p{Mc}|\p{Nd}|\p{Pc}|\u200C|\u200D)*$/u;e.exports={normalizeIdentifier:function(e){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1;const s=(e,t)=>{let r="";for(const e of t)r+=`_${e.codePointAt(0).toString(16)}`;return r};let n=e??String(e);if("string"!=typeof n)throw new Error(`Unsupported identifier type, '${typeof n}'.`);if(n=n.replace(/^\p{Nd}/u,"_$&").replace(/[-‐−@#:;><|/\\\u200c\u200d]/g,"_").replace(/\s/g,"_").replace(/(?!\p{Lu}|\p{Ll}|\p{Lt}|\p{Lm}|\p{Lo}|\p{Nl}|\$|_|\p{Mn}|\p{Mc}|\p{Nd}|\p{Pc}|\u200C|\u200D|\\u[0-9A-Fa-f]{4})(.)/gu,s).replace(/([\uD800-\uDFFF])/g,s),r>0&&(n=n.substring(0,r)),!t.test(n))throw new Error(`Unexpected error. Not able to escape identifier '${n}'.`);return n},ID_REGEX:t}},530:(e,t,r)=>{"use strict";const s=r(926);e.exports=class extends s{constructor(){super(),this.fileName="",this.data=new Map}openFile(e){this.fileName=e}closeFile(){this.data.set(this.fileName,this.getBuffer()),this.clearBuffer()}getFilesInMemory(){return this.data}}},911:e=>{"use strict";e.exports={labelToSentence:function(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"").replace(/([a-z])([A-Z])/g,"$1 $2").replace(/([A-Z])([a-z])/g," $1$2").replace(/ +/g," ").replace(/^./,(e=>e.toUpperCase())).trim()},sentenceToLabel:function(){const e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"").split(/[^A-Za-z0-9_-]+/);return e.forEach(((t,r)=>{e[r]=e[r].replace(/^./,(e=>e.toUpperCase()))})),e.join("").replace(/^./,(e=>e.toLowerCase()))}}},996:e=>{"use strict";e.exports=class{constructor(){this.fileLoaders=[]}addFileLoader(e){this.fileLoaders.push(e)}getFileLoaders(){return this.fileLoaders}clearFileLoaders(){this.fileLoaders=[]}accepts(e){for(let t=0;t<this.fileLoaders.length;t++)if(this.fileLoaders[t].accepts(e))return!0;return!1}load(e,t){for(let r=0;r<this.fileLoaders.length;r++){const s=this.fileLoaders[r];if(s.accepts(e))return s.load(e,t)}throw new Error("Failed to find a model file loader that can handle: "+e)}}},546:(e,t,r)=>{"use strict";const s=r(996),n=r(25),o=r(990);e.exports=class extends s{constructor(e){super();const t=new n(e),r=new o(e);this.addFileLoader(r),this.addFileLoader(t)}}},990:(e,t,r)=>{"use strict";const s=r(25);e.exports=class extends s{constructor(e){super(e)}accepts(e){return e.startsWith("github://")}load(e,t){const r="https://raw.githubusercontent.com/"+e.substring(9);return super.load(r,t)}}},25:e=>{"use strict";e.exports=class{constructor(e){this.processFile=e}accepts(e){return e.startsWith("http://")||e.startsWith("https://")}async load(e,t){t||(t={method:"GET",headers:{"Content-Type":"text/plain"}}),console.log(e);const r=await fetch(e,t);if(!r.ok)throw new Error(`HTTP request failed with status: ${r.status}`);const s=await r.text(),n=new URL(e),o="@"+(n.host+n.pathname).replace(/\//g,".");return this.processFile(o,s)}}},545:e=>{"use strict";const t={error:0,warn:1,info:2,http:3,verbose:4,debug:5,silly:6},r=e=>e,s={};Object.keys(t).forEach((e=>{s[e]=function(){for(var s=arguments.length,n=new Array(s),o=0;o<s;o++)n[o]=arguments[o];return function(e){let s=e;for(var n=arguments.length,o=new Array(n>1?n-1:0),i=1;i<n;i++)o[i-1]=arguments[i];let c=o,a=c.shift();if(a&&"object"==typeof a&&a.level&&a.message){const e=a.padding&&a.padding[a.level];"error"===a.level&&a.stack?(s="error",a=`${a.message}\n${a.stack}`):Object.keys(t).includes(a.level)&&(s=a.level,a=a.message),a=e?`${e} ${a}`:a}c.unshift(a),(["error","warn"].includes(s)?console.error:console.log)(`${(new Date).toLocaleTimeString()} - ${s}:`,...c.map((e=>e instanceof Error?`${e.message}\n${e.stack}`:e)).map(r))}(e,...n)}}));class n{static dispatch(e){for(var r=arguments.length,s=new Array(r>1?r-1:0),n=1;n<r;n++)s[n-1]=arguments[n];t[e]>t[this.level]||this.transports.forEach((t=>{t[e]&&t[e](...s)}))}static add(e){this.transports.push(e)}static error(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return this.dispatch("error",...t)}static warn(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return this.dispatch("warn",...t)}static info(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return this.dispatch("info",...t)}static log(){return this.info(...arguments)}static http(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return this.dispatch("http",...t)}static verbose(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return this.dispatch("verbose",...t)}static debug(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return this.dispatch("debug",...t)}static silly(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return this.dispatch("silly",...t)}}n.level="info",n.transports=[s],e.exports=n},95:(e,t,r)=>{"use strict";const s=r(686),n=r(558),o=r(431);e.exports={writeModelsToFileSystem:function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!t)throw new Error("`path` is a required parameter of writeModelsToFileSystem");const i=Object.assign({includeExternalModels:!0},r);e.forEach((function(e){if(e.external&&!i.includeExternalModels)return;const r=o(e.fileName).split("/").pop();s.writeFileSync(t+n.sep+r,e.definitions)}))}}},328:e=>{"use strict";e.exports=class{static isNull(e){return null==e}}},717:e=>{"use strict";e.exports=class{constructor(e){this.stack=[],this.push(e)}push(e,t){if(t&&!(e instanceof t))throw new Error("Did not find expected type "+t.constructor.name+" as argument to push. Found: "+e.toString());this.stack.push(e)}pop(e){return this.peek(e),this.stack.pop()}peek(e){if(this.stack.length<1)throw new Error("Stack is empty!");const t=this.stack[this.stack.length-1];if(e&&!(t instanceof e))throw new Error("Did not find expected type "+e+" on head of stack. Found: "+t);return t}clear(){this.stack=[]}}},361:e=>{"use strict";let t=!1;e.exports={printDeprecationWarning:function(e,r,s,n){t||(t=!0,function(e,t){console.warn({message:`DEPRECATED: ${e}`,type:t?.type,code:t?.code,detail:t?.detail})}(`DEPRECATED: ${e}`,{type:r,code:s,detail:n}))}}},926:e=>{"use strict";e.exports=class{constructor(){this.beforeBuffer="",this.buffer="",this.linesWritten=0}writeBeforeLine(e,t){for(let t=0;t<e;t++)this.beforeBuffer+=" ";this.beforeBuffer+=t,this.beforeBuffer+="\n",this.linesWritten++}writeLine(e,t){for(let t=0;t<e;t++)this.write(" ");this.write(t),this.write("\n"),this.linesWritten++}getLineCount(){return this.linesWritten}writeIndented(e,t){for(let t=0;t<e;t++)this.write(" ");this.write(t)}write(e){if("string"!=typeof e)throw new Error("Can only append strings. Argument "+e+" has type "+typeof e);this.buffer+=e,this.linesWritten+=e.split(/\r\n|\r|\n/).length}getBuffer(){return this.beforeBuffer+this.buffer}clearBuffer(){this.beforeBuffer="",this.buffer="",this.linesWritten=0}}},124:(e,t,r)=>{var s=r(907);t.formatArgs=function(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const r="color: "+this.color;t.splice(1,0,r,"color: inherit");let s=0,n=0;t[0].replace(/%[a-zA-Z%]/g,(e=>{"%%"!==e&&(s++,"%c"===e&&(n=s))})),t.splice(n,0,r)},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(e){}},t.load=function(){let e;try{e=t.storage.getItem("debug")}catch(e){}return!e&&void 0!==s&&"env"in s&&(e={NODE_ENV:"production"}.DEBUG),e},t.useColors=function(){if("undefined"!=typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let e;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&(e=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(e[1],10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},t.storage=function(){try{return localStorage}catch(e){}}(),t.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.log=console.debug||console.log||(()=>{}),e.exports=r(891)(t);const{formatters:n}=e.exports;n.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}},891:(e,t,r)=>{e.exports=function(e){function t(e){let r,n,o,i=null;function c(...e){if(!c.enabled)return;const s=c,n=Number(new Date),o=n-(r||n);s.diff=o,s.prev=r,s.curr=n,r=n,e[0]=t.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let i=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,((r,n)=>{if("%%"===r)return"%";i++;const o=t.formatters[n];if("function"==typeof o){const t=e[i];r=o.call(s,t),e.splice(i,1),i--}return r})),t.formatArgs.call(s,e),(s.log||t.log).apply(s,e)}return c.namespace=e,c.useColors=t.useColors(),c.color=t.selectColor(e),c.extend=s,c.destroy=t.destroy,Object.defineProperty(c,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==i?i:(n!==t.namespaces&&(n=t.namespaces,o=t.enabled(e)),o),set:e=>{i=e}}),"function"==typeof t.init&&t.init(c),c}function s(e,r){const s=t(this.namespace+(void 0===r?":":r)+e);return s.log=this.log,s}function n(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return t.debug=t,t.default=t,t.coerce=function(e){return e instanceof Error?e.stack||e.message:e},t.disable=function(){const e=[...t.names.map(n),...t.skips.map(n).map((e=>"-"+e))].join(",");return t.enable(""),e},t.enable=function(e){let r;t.save(e),t.namespaces=e,t.names=[],t.skips=[];const s=("string"==typeof e?e:"").split(/[\s,]+/),n=s.length;for(r=0;r<n;r++)s[r]&&("-"===(e=s[r].replace(/\*/g,".*?"))[0]?t.skips.push(new RegExp("^"+e.slice(1)+"$")):t.names.push(new RegExp("^"+e+"$")))},t.enabled=function(e){if("*"===e[e.length-1])return!0;let r,s;for(r=0,s=t.skips.length;r<s;r++)if(t.skips[r].test(e))return!1;for(r=0,s=t.names.length;r<s;r++)if(t.names[r].test(e))return!0;return!1},t.humanize=r(250),t.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(e).forEach((r=>{t[r]=e[r]})),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){let r=0;for(let t=0;t<e.length;t++)r=(r<<5)-r+e.charCodeAt(t),r|=0;return t.colors[Math.abs(r)%t.colors.length]},t.enable(t.load()),t}},250:e=>{var t=1e3,r=60*t,s=60*r,n=24*s,o=7*n;function i(e,t,r,s){var n=t>=1.5*r;return Math.round(e/r)+" "+s+(n?"s":"")}e.exports=function(e,c){c=c||{};var a,u,l=typeof e;if("string"===l&&e.length>0)return function(e){if(!((e=String(e)).length>100)){var i=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(i){var c=parseFloat(i[1]);switch((i[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*c;case"weeks":case"week":case"w":return c*o;case"days":case"day":case"d":return c*n;case"hours":case"hour":case"hrs":case"hr":case"h":return c*s;case"minutes":case"minute":case"mins":case"min":case"m":return c*r;case"seconds":case"second":case"secs":case"sec":case"s":return c*t;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return c;default:return}}}}(e);if("number"===l&&isFinite(e))return c.long?(a=e,(u=Math.abs(a))>=n?i(a,u,n,"day"):u>=s?i(a,u,s,"hour"):u>=r?i(a,u,r,"minute"):u>=t?i(a,u,t,"second"):a+" ms"):function(e){var o=Math.abs(e);return o>=n?Math.round(e/n)+"d":o>=s?Math.round(e/s)+"h":o>=r?Math.round(e/r)+"m":o>=t?Math.round(e/t)+"s":e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},907:e=>{var t,r,s=e.exports={};function n(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function i(e){if(t===setTimeout)return setTimeout(e,0);if((t===n||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(r){try{return t.call(null,e,0)}catch(r){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:n}catch(e){t=n}try{r="function"==typeof clearTimeout?clearTimeout:o}catch(e){r=o}}();var c,a=[],u=!1,l=-1;function h(){u&&c&&(u=!1,c.length?a=c.concat(a):l=-1,a.length&&p())}function p(){if(!u){var e=i(h);u=!0;for(var t=a.length;t;){for(c=a,a=[];++l<t;)c&&c[l].run();l=-1,t=a.length}c=null,u=!1,function(e){if(r===clearTimeout)return clearTimeout(e);if((r===o||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(e);try{return r(e)}catch(t){try{return r.call(null,e)}catch(t){return r.call(this,e)}}}(e)}}function d(e,t){this.fun=e,this.array=t}function f(){}s.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];a.push(new d(e,t)),1!==a.length||u||i(p)},d.prototype.run=function(){this.fun.apply(null,this.array)},s.title="browser",s.browser=!0,s.env={},s.argv=[],s.version="",s.versions={},s.on=f,s.addListener=f,s.once=f,s.off=f,s.removeListener=f,s.removeAllListeners=f,s.emit=f,s.prependListener=f,s.prependOnceListener=f,s.listeners=function(e){return[]},s.binding=function(e){throw new Error("process.binding is not supported")},s.cwd=function(){return"/"},s.chdir=function(e){throw new Error("process.chdir is not supported")},s.umask=function(){return 0}},431:e=>{"use strict";e.exports=e=>{const t=/^\\\\\?\\/.test(e),r=/[^\u0000-\u0080]+/.test(e);return t||r?e:e.replace(/\\/g,"/")}},237:(e,t,r)=>{"use strict";const s=r(599),n=r(133),o=r(168),i=r(996),c=r(546),a=r(990),u=r(25),l=r(926),h=r(64),p=r(95),d=r(530),f=r(545),m=r(717),g=r(911),y=r(721),w=r(673),C=r(328),F=r(361);e.exports={BaseException:s,BaseFileException:n,FileDownloader:o,CompositeFileLoader:i,DefaultFileLoader:c,GitHubFileLoader:a,HTTPFileLoader:u,Writer:l,FileWriter:h,InMemoryWriter:d,ModelWriter:p,Logger:f,TypedStack:m,Label:g,Identifiers:y,ErrorCodes:w,NullUtil:C,Warning:F}},686:()=>{},558:()=>{},330:e=>{"use strict";e.exports=JSON.parse('{"name":"@accordproject/concerto-util","version":"3.20.1","description":"Utilities for Concerto Modeling Language","homepage":"https://github.com/accordproject/concerto","engines":{"node":">=18","npm":">=10"},"main":"index.js","browser":"dist/concerto-util.js","typings":"types/index.d.ts","scripts":{"prepublishOnly":"npm run webpack","pretest":"npm run lint && npm run doc","lint":"eslint .","doc":"jsdoc --pedantic --recurse -c jsdoc.json","test":"nyc mocha --recursive -t 10000","test:watch":"nyc mocha --watch --recursive -t 10000","mocha":"mocha --recursive -t 10000","nyc":"nyc mocha --recursive -t 10000","build":"npm run build:types","postbuild":"npm run webpack","webpack":"webpack --config webpack.config.js --mode production","build:types":"tsc index.js --declaration --allowJs --emitDeclarationOnly --outDir types"},"repository":{"type":"git","url":"https://github.com/accordproject/concerto.git","directory":"packages/concerto-util"},"keywords":["blockchain","hyperledger","solutions"],"author":"accordproject.org","license":"Apache-2.0","devDependencies":{"chai":"4.3.6","chai-as-promised":"7.1.1","chai-things":"0.2.0","eslint":"8.57.1","jsdoc":"^4.0.4","mocha":"10.8.2","node-polyfill-webpack-plugin":"4.0.0","nyc":"17.1.0","tmp-promise":"3.0.3","typescript":"5.7.2","undici":"^7.0.0","webpack":"5.96.1","sinon":"19.0.2"},"dependencies":{"@supercharge/promise-pool":"1.7.0","debug":"4.3.7","slash":"3.0.0"},"browserslist":"> 0.25%, not dead","nyc":{"produce-source-map":"true","sourceMap":"inline","reporter":["lcov","text-summary","html","json"],"include":["lib/**/*.js"],"all":true,"check-coverage":true,"statements":99,"branches":93,"functions":98,"lines":99}}')}},t={},function r(s){var n=t[s];if(void 0!==n)return n.exports;var o=t[s]={exports:{}};return e[s](o,o.exports,r),o.exports}(237);var e,t})); |
/*! | ||
* Concerto Util v3.20.0 | ||
* Concerto Util v3.20.1 | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
@@ -4,0 +4,0 @@ * you may not use this file except in compliance with the License. |
{ | ||
"name": "@accordproject/concerto-util", | ||
"version": "3.20.0", | ||
"version": "3.20.1", | ||
"description": "Utilities for Concerto Modeling Language", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/accordproject/concerto", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package