From 25d41328aeb78b861b06d8a7ff9b0fe4722472ef Mon Sep 17 00:00:00 2001 From: Jerome Simeon Date: Fri, 23 Apr 2021 14:02:25 -0400 Subject: [PATCH 1/2] chore(doc) Add missing JSDoc for utcOffset option Signed-off-by: Jerome Simeon --- packages/concerto-core/api.txt | 4 ++-- packages/concerto-core/changelog.txt | 4 ++-- packages/concerto-core/lib/modelloader.js | 2 ++ 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/concerto-core/api.txt b/packages/concerto-core/api.txt index c841f3f7fa..a45325e90f 100644 --- a/packages/concerto-core/api.txt +++ b/packages/concerto-core/api.txt @@ -191,8 +191,8 @@ class ValidatedResource extends Resource { + void validate() throws Error } class ModelLoader { - + object loadModelManager(string[],object,boolean) - + object loadModelManagerFromModelFiles(object[],undefined,object,boolean) + + object loadModelManager(string[],object,boolean,number) + + object loadModelManagerFromModelFiles(object[],undefined,object,boolean,number) } class ModelManager { + void constructor(object) diff --git a/packages/concerto-core/changelog.txt b/packages/concerto-core/changelog.txt index 1620c082a4..06d8757898 100644 --- a/packages/concerto-core/changelog.txt +++ b/packages/concerto-core/changelog.txt @@ -24,8 +24,8 @@ # Note that the latest public API is documented using JSDocs and is available in api.txt. # -Version 1.0.0-alpha.8 {63957095b410cd581a8b1896659ad170} 2021-04-22 -- Add datetimeutil +Version 1.0.0-alpha.8 {e282ac1f06ae25ddd4f644bba3d133b4} 2021-04-22 +- Add datetimeutil & Consolidate UTC offset support Version 1.0.0-alpha.7 {e791f955bbe9bdac6bcd8944d6111e1a} 2021-04-17 - Remove unused systemtime options in modelfile API diff --git a/packages/concerto-core/lib/modelloader.js b/packages/concerto-core/lib/modelloader.js index 58794632f3..8df4399410 100644 --- a/packages/concerto-core/lib/modelloader.js +++ b/packages/concerto-core/lib/modelloader.js @@ -58,6 +58,7 @@ class ModelLoader { * @param {string[]} ctoFiles - the CTO files (can be local file paths or URLs) * @param {object} options - optional parameters * @param {boolean} [options.offline] - do not resolve external models + * @param {number} [options.utcOffset] - UTC Offset for this execution * @return {object} the model manager */ static async loadModelManager(ctoFiles, options = { offline: false }) { @@ -86,6 +87,7 @@ class ModelLoader { * @param {string[]} [fileNames] - An optional array of file names to associate with the model files * @param {object} options - optional parameters * @param {boolean} [options.offline] - do not resolve external models + * @param {number} [options.utcOffset] - UTC Offset for this execution * @return {object} the model manager */ static async loadModelManagerFromModelFiles(modelFiles, fileNames, options = { offline: false }) { From 55267262c5414efeda5badbb6ed17fd16c68af62 Mon Sep 17 00:00:00 2001 From: Jerome Simeon Date: Fri, 23 Apr 2021 14:44:39 -0400 Subject: [PATCH 2/2] fix(core) Replace Concerto.instanceOf by ModelManager.derivesFrom Signed-off-by: Jerome Simeon --- packages/concerto-core/api.txt | 2 +- packages/concerto-core/changelog.txt | 5 +- packages/concerto-core/lib/concerto.js | 25 --------- packages/concerto-core/lib/modelmanager.js | 19 +++++++ packages/concerto-core/test/concerto.js | 60 --------------------- packages/concerto-core/test/modelmanager.js | 40 ++++++++++++++ packages/concerto-core/umd/concerto.js | 51 ++++++++++++++++++ 7 files changed, 114 insertions(+), 88 deletions(-) create mode 100644 packages/concerto-core/umd/concerto.js diff --git a/packages/concerto-core/api.txt b/packages/concerto-core/api.txt index a45325e90f..f59eb0d476 100644 --- a/packages/concerto-core/api.txt +++ b/packages/concerto-core/api.txt @@ -22,7 +22,6 @@ class Concerto { + void fromURI(string) throws Error + string getType() + string getNamespace() - + boolean instanceOf(String) } + object setCurrentTime() class Factory { @@ -217,6 +216,7 @@ class ModelManager { + Serializer getSerializer() + DecoratorFactory[] getDecoratorFactories() + void addDecoratorFactory(DecoratorFactory) + + boolean derivesFrom(String,String) + boolean hasInstance(object) } class SecurityException extends BaseException { diff --git a/packages/concerto-core/changelog.txt b/packages/concerto-core/changelog.txt index 06d8757898..94822fcb79 100644 --- a/packages/concerto-core/changelog.txt +++ b/packages/concerto-core/changelog.txt @@ -24,10 +24,11 @@ # Note that the latest public API is documented using JSDocs and is available in api.txt. # -Version 1.0.0-alpha.8 {e282ac1f06ae25ddd4f644bba3d133b4} 2021-04-22 +Version 1.0.0-alpha.8 {08b0c809336354e7d1b17a2e44fca8b0} 2021-04-22 - Add datetimeutil & Consolidate UTC offset support +- Delete Concerto.instanceOf replace by ModelManager.derivesFrom -Version 1.0.0-alpha.7 {e791f955bbe9bdac6bcd8944d6111e1a} 2021-04-17 +Version 1.0.0-alpha.7 {aec0f0d4e25be4dab03d6b94be60767b} 2021-04-17 - Remove unused systemtime options in modelfile API - Fixes to the validation option targeting the ergo ES6 runtime diff --git a/packages/concerto-core/lib/concerto.js b/packages/concerto-core/lib/concerto.js index e6d3a274ba..50d6311e70 100644 --- a/packages/concerto-core/lib/concerto.js +++ b/packages/concerto-core/lib/concerto.js @@ -205,31 +205,6 @@ class Concerto { getNamespace(obj) { return this.getTypeDeclaration(obj).getNamespace(); } - - /** - * Check to see if this instance is an instance of the specified fully qualified - * type name. - * @param {*} obj the input object - * @param {String} fqt The fully qualified type name. - * @returns {boolean} True if this instance is an instance of the specified fully - * qualified type name, false otherwise. - */ - instanceOf(obj, fqt) { - // Check to see if this is an exact instance of the specified type. - const classDeclaration = this.getTypeDeclaration(obj); - if (classDeclaration.getFullyQualifiedName() === fqt) { - return true; - } - // Now walk the class hierachy looking to see if it's an instance of the specified type. - let superTypeDeclaration = classDeclaration.getSuperTypeDeclaration(); - while (superTypeDeclaration) { - if (superTypeDeclaration.getFullyQualifiedName() === fqt) { - return true; - } - superTypeDeclaration = superTypeDeclaration.getSuperTypeDeclaration(); - } - return false; - } } module.exports = Concerto; diff --git a/packages/concerto-core/lib/modelmanager.js b/packages/concerto-core/lib/modelmanager.js index 6116886e5b..c89adbfab0 100644 --- a/packages/concerto-core/lib/modelmanager.js +++ b/packages/concerto-core/lib/modelmanager.js @@ -603,6 +603,25 @@ abstract concept Event {} this.decoratorFactories.push(factory); } + /** + * Checks if this fully qualified type name is derived from another. + * @param {String} fqt1 The fully qualified type name to check. + * @param {String} fqt2 The fully qualified type name it is may be derived from. + * @returns {boolean} True if this instance is an instance of the specified fully + * qualified type name, false otherwise. + */ + derivesFrom(fqt1, fqt2) { + // Check to see if this is an exact instance of the specified type. + let typeDeclaration = this.getType(fqt1); + while (typeDeclaration) { + if (typeDeclaration.getFullyQualifiedName() === fqt2) { + return true; + } + typeDeclaration = typeDeclaration.getSuperTypeDeclaration(); + } + return false; + } + /** * Alternative instanceof that is reliable across different module instances * @see https://github.com/hyperledger/composer-concerto/issues/47 diff --git a/packages/concerto-core/test/concerto.js b/packages/concerto-core/test/concerto.js index bd6d474b2d..f7cb14a7ad 100644 --- a/packages/concerto-core/test/concerto.js +++ b/packages/concerto-core/test/concerto.js @@ -17,7 +17,6 @@ const fs = require('fs'); const chai = require('chai'); -const expect = chai.expect; // eslint-disable-next-line no-unused-vars const should = chai.should(); chai.use(require('chai-things')); @@ -229,65 +228,6 @@ describe('concerto', () => { }); }); - describe('#instanceOf', () => { - - it('should get instanceOf for sub type', () => { - const obj = { - $class : 'org.accordproject.test.Customer', - ssn: '123456789', - customerId: '001', - name: 'Dan Selman' - }; - - const result = concerto.instanceOf(obj, 'org.accordproject.test.Person'); - result.should.be.true; - }); - - it('should get instanceOf for sub-sub type', () => { - const obj = { - $class : 'org.accordproject.test.Manager', - ssn: '123456789', - customerId: '001', - name: 'Dan Selman' - }; - - const result = concerto.instanceOf(obj, 'org.accordproject.test.Person'); - result.should.be.true; - }); - - it('should get instanceOf for type', () => { - const obj = { - $class : 'org.accordproject.test.Customer', - ssn: '123456789', - customerId: '001', - name: 'Dan Selman' - }; - - const result = concerto.instanceOf(obj, 'org.accordproject.test.Customer'); - result.should.be.true; - }); - - it('should not get instanceOf for derived type', () => { - const obj = { - $class : 'org.accordproject.test.Person', - ssn: '123456789' - }; - - const result = concerto.instanceOf(obj, 'org.accordproject.test.Customer'); - expect(result).to.be.false; - }); - - it('all types should be an instance of concerto.Concept', () => { - const obj = { - $class : 'org.accordproject.test.Person', - ssn: '123456789' - }; - - const result = concerto.instanceOf(obj, 'concerto.Concept'); - expect(result).to.be.true; - }); - }); - describe('#validate', () => { it('should validate data that conforms to model', () => { diff --git a/packages/concerto-core/test/modelmanager.js b/packages/concerto-core/test/modelmanager.js index 3f6f0d36d4..b461a0a26a 100644 --- a/packages/concerto-core/test/modelmanager.js +++ b/packages/concerto-core/test/modelmanager.js @@ -45,6 +45,7 @@ describe('ModelManager', () => { let composerModel = fs.readFileSync('./test/data/model/composer.cto', 'utf8'); let invalidModel = fs.readFileSync('./test/data/model/invalid.cto', 'utf8'); let invalidModel2 = fs.readFileSync('./test/data/model/invalid2.cto', 'utf8'); + let concertoModel = fs.readFileSync('./test/data/model/concerto.cto', 'utf8'); let modelManager; let sandbox; @@ -958,4 +959,43 @@ concept Bar { }); }); + describe('#derivesFrom', () => { + + it('should get derivesFrom for sub type', () => { + modelManager.addModelFile(concertoModel); + const result = modelManager.derivesFrom('org.accordproject.test.Customer', 'org.accordproject.test.Person'); + result.should.be.true; + }); + + it('should get derivesFrom for sub-sub type', () => { + modelManager.addModelFile(concertoModel); + const result = modelManager.derivesFrom('org.accordproject.test.Manager', 'org.accordproject.test.Person'); + result.should.be.true; + }); + + it('should get derivesFrom for type', () => { + modelManager.addModelFile(concertoModel); + const result = modelManager.derivesFrom('org.accordproject.test.Customer', 'org.accordproject.test.Customer'); + result.should.be.true; + }); + + it('should not get derivesFrom for derived type', () => { + modelManager.addModelFile(concertoModel); + const result = modelManager.derivesFrom('org.accordproject.test.Person', 'org.accordproject.test.Customer'); + result.should.be.false; + }); + + it('should be an instance of concerto.Participant', () => { + modelManager.addModelFile(concertoModel); + const result = modelManager.derivesFrom('org.accordproject.test.Person', 'concerto.Participant'); + result.should.be.true; + }); + + it('all types should be an instance of concerto.Concept', () => { + modelManager.addModelFile(concertoModel); + const result = modelManager.derivesFrom('org.accordproject.test.Person', 'concerto.Concept'); + result.should.be.true; + }); + }); + }); diff --git a/packages/concerto-core/umd/concerto.js b/packages/concerto-core/umd/concerto.js new file mode 100644 index 0000000000..90a43378dd --- /dev/null +++ b/packages/concerto-core/umd/concerto.js @@ -0,0 +1,51 @@ +/*! + * Concerto v0.82.12-20210119205342 + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("concerto",[],t):"object"==typeof exports?exports.concerto=t():e.concerto=t()}(window,(function(){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)r.d(n,i,function(t){return e[t]}.bind(null,i));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=62)}([function(e,t,r){"use strict";const n=r(2);class i{static getShortName(e){let t=e,r=e.lastIndexOf(".");return r>-1&&(t=e.substr(r+1)),t}static isWildcardName(e){return"*"===i.getShortName(e)}static isRecursiveWildcardName(e){return"**"===i.getShortName(e)}static isMatchingType(e,t){if(e.instanceOf(t))return!0;let r=i.getNamespace(t),n=e.getNamespace();if(i.isWildcardName(t)&&n===r);else if(i.isRecursiveWildcardName(t)&&(n+".").startsWith(r+"."));else if(!i.isRecursiveWildcardName(t)||r)return!1;return!0}static getNamespace(e){if(!e)throw new Error(n.formatMessage("modelutil-getnamespace-nofnq"));let t="",r=e.lastIndexOf(".");return r>-1&&(t=e.substr(0,r)),t}static isPrimitiveType(e){return["Boolean","String","DateTime","Double","Integer","Long"].indexOf(e)>=0}static isAssignableTo(e,t,r){const n=r.getFullyQualifiedTypeName(),o=t===n;if(o||i.isPrimitiveType(t)||i.isPrimitiveType(n))return o;const s=e.getType(t);if(!s)throw new Error("Cannot find type "+t);return s.getAllSuperTypeDeclarations().some(e=>e.getFullyQualifiedName()===n)}static capitalizeFirstLetter(e){return e.charAt(0).toUpperCase()+e.slice(1)}static isEnum(e){const t=e.getParent().getModelFile().getType(e.getType());return null!==t&&t.isEnum()}static getFullyQualifiedName(e,t){return e?`${e}.${t}`:t}}e.exports=i},function(e,t,r){"use strict";var n=r(52),i=Object.prototype.toString;function o(e){return"[object Array]"===i.call(e)}function s(e){return void 0===e}function a(e){return null!==e&&"object"==typeof e}function u(e){if("[object Object]"!==i.call(e))return!1;var t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}function c(e){return"[object Function]"===i.call(e)}function l(e,t){if(null!=e)if("object"!=typeof e&&(e=[e]),o(e))for(var r=0,n=e.length;r{const t=e.getSuperType();if(t){const r=n.get(t)||new Set;r.add(e),n.set(t,r)}});const i=t=>{t.forEach(t=>{e.add(t);const r=t.getFullyQualifiedName(),o=n.get(r);o&&i(o)})};return i([this]),Array.from(e)}getAllSuperTypeDeclarations(){const e=[];for(let t=this;t=t.getSuperTypeDeclaration();)e.push(t);return e}getProperty(e){let t=this.getOwnProperty(e),r=null;if(null===t&&null!==this.superType){if(this.getModelFile().isImportedType(this.superType)){let e=this.getModelFile().resolveImport(this.superType);r=this.modelFile.getModelManager().getType(e)}else r=this.getModelFile().getType(this.superType);t=r.getProperty(e)}return t}getProperties(){let e=this.getOwnProperties(),t=null;if(null!==this.superType){if(this.getModelFile().isImportedType(this.superType)){let e=this.getModelFile().resolveImport(this.superType);t=this.modelFile.getModelManager().getType(e)}else t=this.getModelFile().getType(this.superType);if(!t)throw new a("Could not find super type "+this.superType,this.modelFile,this.ast.location);e=e.concat(t.getProperties())}return e}getNestedProperty(e){const t=e.split(".");let r=this,n=null;for(let i=0;i1)for(var r=1;r=t?e:""+Array(t+1-n.length).join(r)+e},d={s:f,z:function(e){var t=-e.utcOffset(),r=Math.abs(t),n=Math.floor(r/60),i=r%60;return(t<=0?"+":"-")+f(n,2,"0")+":"+f(i,2,"0")},m:function e(t,r){if(t.date(){if(this.imports.push(e.namespace),this.importShortNames.set(p.getShortName(e.namespace),e.namespace),p.isWildcardName(e.namespace)){const t=p.getNamespace(e.namespace);this.importWildcardNamespaces.push(t)}e.uri&&(this.importUriMap[e.namespace]=e.uri)});for(let e=0;e{const t=p.getNamespace(e),r=this.getModelManager().getModelFile(t);if(!r){let t=f.messageFormatter("modelmanager-gettype-noregisteredns");throw new l(t({type:e}),this)}if(p.isWildcardName(e))return;const n=p.getShortName(e);if(!r.isLocalType(n)){let e=f.messageFormatter("modelmanager-gettype-notypeinns");throw new l(e({type:n,namespace:t}),this)}});for(let e=0;e{"%%"!==e&&(n++,"%c"===e&&(i=n))}),t.splice(i,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){}!e&&void 0!==n&&"env"in n&&(e=Object({NODE_ENV:"production"}).DEBUG);return 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;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&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},t.storage=function(){try{return localStorage}catch(e){}}(),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"],e.exports=r(69)(t);const{formatters:i}=e.exports;i.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}).call(this,r(5))},function(e,t,r){"use strict";const n=r(39),i=r(20);e.exports=class extends i{constructor(e,t,r,n,i){super(e,t,r,n),this.$identifier=i}getIdentifier(){return this.$identifier}setIdentifier(e){this.$identifier=e;this[this.$modelManager.getModelFile(this.getNamespace()).getType(this.getFullyQualifiedType()).getIdentifierFieldName()]=e}getFullyQualifiedIdentifier(){return this.getFullyQualifiedType()+"#"+this.$identifier}toString(){return"Identifiable {id="+this.getFullyQualifiedIdentifier()+"}"}isRelationship(){return!1}isResource(){return!1}toURI(){return new n(this.getNamespace(),this.getType(),this.getIdentifier()).toURI()}}},function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(e,t,r){"use strict";const n=r(10);e.exports=class extends n{constructor(e,t){super(e,t)}}},function(e,t,r){"use strict";const n=r(114),i=r(51),o=r(139);e.exports=class extends n{constructor(e){super();const t=new i(e),r=new o(e);this.addModelFileLoader(r),this.addModelFileLoader(t)}}},function(e,t,r){"use strict";const n=r(15);class i extends n{constructor(e,t){super(e,t),this._isAssetDeclaration=!0}static[Symbol.hasInstance](e){return null!=e&&Boolean(e._isAssetDeclaration)}}e.exports=i},function(e,t,r){"use strict";const n=r(64),i=r(9);e.exports=class{constructor(e,t){if(!e)throw new Error("modelFile not specified");if(!t)throw new Error("ast not specified");this.modelFile=e,this.ast=t}getModelFile(){return this.modelFile}accept(e,t){return e.visit(this,t)}process(){if(this.decorators=[],this.ast.decorators)for(let e=0;e=8",npm:">=5"},main:"index.js",typings:"types/index.d.ts",scripts:{prepublishOnly:"webpack --config webpack.config.js --mode production",prepare:"pegjs ./lib/introspect/parser.pegjs",pretest:"npm run lint",lint:"eslint .",postlint:"npm run licchk",licchk:"license-check-and-add",postlicchk:"npm run doc",doc:"jsdoc --pedantic --recurse -c jsdoc.json",test:"node ./scripts/api-changelog.js && nyc mocha --recursive -t 10000","test:watch":"nyc mocha --watch --recursive -t 10000",mocha:"mocha --recursive -t 10000",nyc:"nyc mocha --recursive -t 10000"},repository:{type:"git",url:"https://github.com/accordproject/concerto.git"},keywords:["blockchain","hyperledger","solutions"],author:"accordproject.org",license:"Apache-2.0",devDependencies:{acorn:"5.1.2","babel-preset-env":"1.7.0","babel-preset-latest":"6.24.1",chai:"4.2.0","chai-as-promised":"7.1.1","chai-things":"0.2.0",commander:"2.20.0",doctrine:"3.0.0",eslint:"6.0.1","fs-extra":"8.1.0",jsdoc:"3.6.3",klaw:"3.0.0","license-check-and-add":"2.3.6",mocha:"6.1.4",mockery:"2.1.0",moxios:"0.4.0",nyc:"14.1.1",pegjs:"0.10.0",semver:"6.3.0",sinon:"7.3.2","sinon-chai":"3.3.0","tmp-promise":"2.0.2",webpack:"4.35.2","webpack-cli":"3.3.5",yargs:"13.2.4"},dependencies:{axios:"0.21.1",colors:"1.4.0",dayjs:"1.10.2",debug:"4.1.1",jsome:"2.5.0","lorem-ipsum":"1.0.6",randexp:"0.5.3",slash:"3.0.0",urijs:"1.19.1",uuid:"3.3.2"},"license-check-and-add-config":{folder:"./lib",license:"HEADER",exact_paths_method:"EXCLUDE",exact_paths:["api.txt","composer-logs","coverage","index.d.ts","./system","./introspect/parser.js","LICENSE","node_modules",".nyc-output","out",".tern-project"],file_type_method:"EXCLUDE",file_types:[".yml",".yaml",".zip",".tgz"],insert_license:!1,license_formats:{"js|njk|pegjs|cto|acl|qry":{prepend:"/*",append:" */",eachLine:{prepend:" * "}},"npmrc|editorconfig|txt":{eachLine:{prepend:"# "}},md:{file:"HEADER.md"}}},nyc:{"produce-source-map":"true",sourceMap:"inline",reporter:["lcov","text-summary","html","json"],include:["lib/**/*.js"],exclude:["lib/codegen/parsejs.js","lib/codegen/javascriptparser.js","lib/introspect/parser.js"],all:!0,"check-coverage":!0,statements:99,branches:98,functions:99,lines:98}}},function(e,t,r){"use strict";const n=r(16);class i extends n{constructor(e,t){super(e,t),this._isEnumValueDeclaration=!0}validate(e){super.validate(e)}static[Symbol.hasInstance](e){return null!=e&&Boolean(e._isEnumValueDeclaration)}}e.exports=i},function(e,t,r){"use strict";e.exports=class{constructor(e,t){this.validator=t,this.field=e}reportError(e,t){throw new Error("Validator error for field "+e+" "+this.getField().getFullyQualifiedName()+": "+t)}accept(e,t){return e.visit(this,t)}getField(){return this.field}validate(e,t){}}},function(e,t,r){"use strict";e.exports=class{constructor(e){this.modelManager=e}accept(e,t){return e.visit(this,t)}getClassDeclarations(){let e=[];const t=this.modelManager.getModelFiles();for(let r=0;r[{type:n.RANGE,from:48,to:57}],o=()=>[{type:n.CHAR,value:95},{type:n.RANGE,from:97,to:122},{type:n.RANGE,from:65,to:90}].concat(i()),s=()=>[{type:n.CHAR,value:9},{type:n.CHAR,value:10},{type:n.CHAR,value:11},{type:n.CHAR,value:12},{type:n.CHAR,value:13},{type:n.CHAR,value:32},{type:n.CHAR,value:160},{type:n.CHAR,value:5760},{type:n.RANGE,from:8192,to:8202},{type:n.CHAR,value:8232},{type:n.CHAR,value:8233},{type:n.CHAR,value:8239},{type:n.CHAR,value:8287},{type:n.CHAR,value:12288},{type:n.CHAR,value:65279}];t.words=()=>({type:n.SET,set:o(),not:!1}),t.notWords=()=>({type:n.SET,set:o(),not:!0}),t.ints=()=>({type:n.SET,set:i(),not:!1}),t.notInts=()=>({type:n.SET,set:i(),not:!0}),t.whitespace=()=>({type:n.SET,set:s(),not:!1}),t.notWhitespace=()=>({type:n.SET,set:s(),not:!0}),t.anyChar=()=>({type:n.SET,set:[{type:n.CHAR,value:10},{type:n.CHAR,value:13},{type:n.CHAR,value:8232},{type:n.CHAR,value:8233}],not:!0})},function(e,t,r){"use strict";const n=r(3),i=r(4),o=r(6),s=r(7),a=r(19),u=r(13),c=r(26),l=r(11),h=r(0),p=r(28),f=r(2),d=r(8);class g{constructor(e){this.options=e||{}}visit(e,t){return e instanceof s?this.visitEnumDeclaration(e,t):e instanceof n?this.visitClassDeclaration(e,t):e instanceof o?this.visitRelationshipDeclaration(e,t):e instanceof i?this.visitField(e,t):void 0}visitEnumDeclaration(e,t){const r=t.stack.pop(),n=e.getProperties();let i=!1;for(let e=0;e=1,n=arguments.length>=2;if(!(this instanceof o))return r?n?new o(e,t):new o(e):new o;if(void 0===e){if(r)throw new TypeError("undefined is not a valid argument for URI");e="undefined"!=typeof location?location.href+"":""}if(null===e&&r)throw new TypeError("null is not a valid argument for URI");return this.href(e),void 0!==t?this.absoluteTo(t):this}o.version="1.19.1";var s=o.prototype,a=Object.prototype.hasOwnProperty;function u(e){return e.replace(/([.*+?^=!:${}()|[\]\/\\])/g,"\\$1")}function c(e){return void 0===e?"Undefined":String(Object.prototype.toString.call(e)).slice(8,-1)}function l(e){return"Array"===c(e)}function h(e,t){var r,n,i={};if("RegExp"===c(t))i=null;else if(l(t))for(r=0,n=t.length;r]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?«»“”‘’]))/gi,o.findUri={start:/\b(?:([a-z][a-z0-9.+-]*:\/\/)|www\.)/gi,end:/[\s\r\n]|$/,trim:/[`!()\[\]{};:'".,<>?«»“”„‘’]+$/,parens:/(\([^\)]*\)|\[[^\]]*\]|\{[^}]*\}|<[^>]*>)/g},o.defaultPorts={http:"80",https:"443",ftp:"21",gopher:"70",ws:"80",wss:"443"},o.hostProtocols=["http","https"],o.invalid_hostname_characters=/[^a-zA-Z0-9\.\-:_]/,o.domAttributes={a:"href",blockquote:"cite",link:"href",base:"href",script:"src",form:"action",img:"src",area:"href",iframe:"src",embed:"src",source:"src",track:"src",input:"src",audio:"src",video:"src"},o.getDomAttribute=function(e){if(e&&e.nodeName){var t=e.nodeName.toLowerCase();if("input"!==t||"image"===e.type)return o.domAttributes[t]}},o.encode=m,o.decode=decodeURIComponent,o.iso8859=function(){o.encode=escape,o.decode=unescape},o.unicode=function(){o.encode=m,o.decode=decodeURIComponent},o.characters={pathname:{encode:{expression:/%(24|26|2B|2C|3B|3D|3A|40)/gi,map:{"%24":"$","%26":"&","%2B":"+","%2C":",","%3B":";","%3D":"=","%3A":":","%40":"@"}},decode:{expression:/[\/\?#]/g,map:{"/":"%2F","?":"%3F","#":"%23"}}},reserved:{encode:{expression:/%(21|23|24|26|27|28|29|2A|2B|2C|2F|3A|3B|3D|3F|40|5B|5D)/gi,map:{"%3A":":","%2F":"/","%3F":"?","%23":"#","%5B":"[","%5D":"]","%40":"@","%21":"!","%24":"$","%26":"&","%27":"'","%28":"(","%29":")","%2A":"*","%2B":"+","%2C":",","%3B":";","%3D":"="}}},urnpath:{encode:{expression:/%(21|24|27|28|29|2A|2B|2C|3B|3D|40)/gi,map:{"%21":"!","%24":"$","%27":"'","%28":"(","%29":")","%2A":"*","%2B":"+","%2C":",","%3B":";","%3D":"=","%40":"@"}},decode:{expression:/[\/\?#:]/g,map:{"/":"%2F","?":"%3F","#":"%23",":":"%3A"}}}},o.encodeQuery=function(e,t){var r=o.encode(e+"");return void 0===t&&(t=o.escapeQuerySpace),t?r.replace(/%20/g,"+"):r},o.decodeQuery=function(e,t){e+="",void 0===t&&(t=o.escapeQuerySpace);try{return o.decode(t?e.replace(/\+/g,"%20"):e)}catch(t){return e}};var y,v={encode:"encode",decode:"decode"},A=function(e,t){return function(r){try{return o[t](r+"").replace(o.characters[e][t].expression,(function(r){return o.characters[e][t].map[r]}))}catch(e){return r}}};for(y in v)o[y+"PathSegment"]=A("pathname",v[y]),o[y+"UrnPathSegment"]=A("urnpath",v[y]);var b=function(e,t,r){return function(n){var i;i=r?function(e){return o[t](o[r](e))}:o[t];for(var s=(n+"").split(e),a=0,u=s.length;a-1&&(t.fragment=e.substring(r+1)||null,e=e.substring(0,r)),(r=e.indexOf("?"))>-1&&(t.query=e.substring(r+1)||null,e=e.substring(0,r)),"//"===e.substring(0,2)?(t.protocol=null,e=e.substring(2),e=o.parseAuthority(e,t)):(r=e.indexOf(":"))>-1&&(t.protocol=e.substring(0,r)||null,t.protocol&&!t.protocol.match(o.protocol_expression)?t.protocol=void 0:"//"===e.substring(r+1,r+3)?(e=e.substring(r+3),e=o.parseAuthority(e,t)):(e=e.substring(r+1),t.urn=!0)),t.path=e,t},o.parseHost=function(e,t){e||(e="");var r,n,i=(e=e.replace(/\\/g,"/")).indexOf("/");if(-1===i&&(i=e.length),"["===e.charAt(0))r=e.indexOf("]"),t.hostname=e.substring(1,r)||null,t.port=e.substring(r+2,i)||null,"/"===t.port&&(t.port=null);else{var s=e.indexOf(":"),a=e.indexOf("/"),u=e.indexOf(":",s+1);-1!==u&&(-1===a||u-1?n:e.length-1);return i>-1&&(-1===n||i-1?f.slice(0,d)+f.slice(d).replace(s,""):f.replace(s,"")).length<=c[0].length||r.ignore&&r.ignore.test(f))){var y=t(f,l,p=l+f.length,e);void 0!==y?(y=String(y),e=e.slice(0,l)+y+e.slice(p),n.lastIndex=l+y.length):n.lastIndex=p}}return n.lastIndex=0,e},o.ensureValidHostname=function(t,r){var n=!!t,i=!1;if(!!r&&(i=p(o.hostProtocols,r)),i&&!n)throw new TypeError("Hostname cannot be empty, if protocol is "+r);if(t&&t.match(o.invalid_hostname_characters)){if(!e)throw new TypeError('Hostname "'+t+'" contains characters other than [A-Z0-9.-:_] and Punycode.js is not available');if(e.toASCII(t).match(o.invalid_hostname_characters))throw new TypeError('Hostname "'+t+'" contains characters other than [A-Z0-9.-:_]')}},o.ensureValidPort=function(e){if(e){var t=Number(e);if(!(/^[0-9]+$/.test(t)&&t>0&&t<65536))throw new TypeError('Port "'+e+'" is not a valid port')}},o.noConflict=function(e){if(e){var t={URI:this.noConflict()};return n.URITemplate&&"function"==typeof n.URITemplate.noConflict&&(t.URITemplate=n.URITemplate.noConflict()),n.IPv6&&"function"==typeof n.IPv6.noConflict&&(t.IPv6=n.IPv6.noConflict()),n.SecondLevelDomains&&"function"==typeof n.SecondLevelDomains.noConflict&&(t.SecondLevelDomains=n.SecondLevelDomains.noConflict()),t}return n.URI===this&&(n.URI=i),this},s.build=function(e){return!0===e?this._deferred_build=!0:(void 0===e||this._deferred_build)&&(this._string=o.build(this._parts),this._deferred_build=!1),this},s.clone=function(){return new o(this)},s.valueOf=s.toString=function(){return this.build(!1)._string},s.protocol=C("protocol"),s.username=C("username"),s.password=C("password"),s.hostname=C("hostname"),s.port=C("port"),s.query=F("query","?"),s.fragment=F("fragment","#"),s.search=function(e,t){var r=this.query(e,t);return"string"==typeof r&&r.length?"?"+r:r},s.hash=function(e,t){var r=this.fragment(e,t);return"string"==typeof r&&r.length?"#"+r:r},s.pathname=function(e,t){if(void 0===e||!0===e){var r=this._parts.path||(this._parts.hostname?"/":"");return e?(this._parts.urn?o.decodeUrnPath:o.decodePath)(r):r}return this._parts.urn?this._parts.path=e?o.recodeUrnPath(e):"":this._parts.path=e?o.recodePath(e):"/",this.build(!t),this},s.path=s.pathname,s.href=function(e,t){var r;if(void 0===e)return this.toString();this._string="",this._parts=o._parts();var n=e instanceof o,i="object"==typeof e&&(e.hostname||e.path||e.pathname);e.nodeName&&(e=e[o.getDomAttribute(e)]||"",i=!1);if(!n&&i&&void 0!==e.pathname&&(e=e.toString()),"string"==typeof e||e instanceof String)this._parts=o.parse(String(e),this._parts);else{if(!n&&!i)throw new TypeError("invalid input");var s=n?e._parts:e;for(r in s)"query"!==r&&a.call(this._parts,r)&&(this._parts[r]=s[r]);s.query&&this.query(s.query,!1)}return this.build(!t),this},s.is=function(e){var t=!1,n=!1,i=!1,s=!1,a=!1,u=!1,c=!1,l=!this._parts.urn;switch(this._parts.hostname&&(l=!1,n=o.ip4_expression.test(this._parts.hostname),i=o.ip6_expression.test(this._parts.hostname),a=(s=!(t=n||i))&&r&&r.has(this._parts.hostname),u=s&&o.idn_expression.test(this._parts.hostname),c=s&&o.punycode_expression.test(this._parts.hostname)),e.toLowerCase()){case"relative":return l;case"absolute":return!l;case"domain":case"name":return s;case"sld":return a;case"ip":return t;case"ip4":case"ipv4":case"inet4":return n;case"ip6":case"ipv6":case"inet6":return i;case"idn":return u;case"url":return!this._parts.urn;case"urn":return!!this._parts.urn;case"punycode":return c}return null};var E=s.protocol,w=s.port,D=s.hostname;s.protocol=function(e,t){if(e&&!(e=e.replace(/:(\/\/)?$/,"")).match(o.protocol_expression))throw new TypeError('Protocol "'+e+"\" contains characters other than [A-Z0-9.+-] or doesn't start with [A-Z]");return E.call(this,e,t)},s.scheme=s.protocol,s.port=function(e,t){return this._parts.urn?void 0===e?"":this:(void 0!==e&&(0===e&&(e=null),e&&(":"===(e+="").charAt(0)&&(e=e.substring(1)),o.ensureValidPort(e))),w.call(this,e,t))},s.hostname=function(e,t){if(this._parts.urn)return void 0===e?"":this;if(void 0!==e){var r={preventInvalidHostname:this._parts.preventInvalidHostname};if("/"!==o.parseHost(e,r))throw new TypeError('Hostname "'+e+'" contains characters other than [A-Z0-9.-]');e=r.hostname,this._parts.preventInvalidHostname&&o.ensureValidHostname(e,this._parts.protocol)}return D.call(this,e,t)},s.origin=function(e,t){if(this._parts.urn)return void 0===e?"":this;if(void 0===e){var r=this.protocol();return this.authority()?(r?r+"://":"")+this.authority():""}var n=o(e);return this.protocol(n.protocol()).authority(n.authority()).build(!t),this},s.host=function(e,t){if(this._parts.urn)return void 0===e?"":this;if(void 0===e)return this._parts.hostname?o.buildHost(this._parts):"";if("/"!==o.parseHost(e,this._parts))throw new TypeError('Hostname "'+e+'" contains characters other than [A-Z0-9.-]');return this.build(!t),this},s.authority=function(e,t){if(this._parts.urn)return void 0===e?"":this;if(void 0===e)return this._parts.hostname?o.buildAuthority(this._parts):"";if("/"!==o.parseAuthority(e,this._parts))throw new TypeError('Hostname "'+e+'" contains characters other than [A-Z0-9.-]');return this.build(!t),this},s.userinfo=function(e,t){if(this._parts.urn)return void 0===e?"":this;if(void 0===e){var r=o.buildUserinfo(this._parts);return r?r.substring(0,r.length-1):r}return"@"!==e[e.length-1]&&(e+="@"),o.parseUserinfo(e,this._parts),this.build(!t),this},s.resource=function(e,t){var r;return void 0===e?this.path()+this.search()+this.hash():(r=o.parse(e),this._parts.path=r.path,this._parts.query=r.query,this._parts.fragment=r.fragment,this.build(!t),this)},s.subdomain=function(e,t){if(this._parts.urn)return void 0===e?"":this;if(void 0===e){if(!this._parts.hostname||this.is("IP"))return"";var r=this._parts.hostname.length-this.domain().length-1;return this._parts.hostname.substring(0,r)||""}var n=this._parts.hostname.length-this.domain().length,i=this._parts.hostname.substring(0,n),s=new RegExp("^"+u(i));if(e&&"."!==e.charAt(e.length-1)&&(e+="."),-1!==e.indexOf(":"))throw new TypeError("Domains cannot contain colons");return e&&o.ensureValidHostname(e,this._parts.protocol),this._parts.hostname=this._parts.hostname.replace(s,e),this.build(!t),this},s.domain=function(e,t){if(this._parts.urn)return void 0===e?"":this;if("boolean"==typeof e&&(t=e,e=void 0),void 0===e){if(!this._parts.hostname||this.is("IP"))return"";var r=this._parts.hostname.match(/\./g);if(r&&r.length<2)return this._parts.hostname;var n=this._parts.hostname.length-this.tld(t).length-1;return n=this._parts.hostname.lastIndexOf(".",n-1)+1,this._parts.hostname.substring(n)||""}if(!e)throw new TypeError("cannot set domain empty");if(-1!==e.indexOf(":"))throw new TypeError("Domains cannot contain colons");if(o.ensureValidHostname(e,this._parts.protocol),!this._parts.hostname||this.is("IP"))this._parts.hostname=e;else{var i=new RegExp(u(this.domain())+"$");this._parts.hostname=this._parts.hostname.replace(i,e)}return this.build(!t),this},s.tld=function(e,t){if(this._parts.urn)return void 0===e?"":this;if("boolean"==typeof e&&(t=e,e=void 0),void 0===e){if(!this._parts.hostname||this.is("IP"))return"";var n=this._parts.hostname.lastIndexOf("."),i=this._parts.hostname.substring(n+1);return!0!==t&&r&&r.list[i.toLowerCase()]&&r.get(this._parts.hostname)||i}var o;if(!e)throw new TypeError("cannot set TLD empty");if(e.match(/[^a-zA-Z0-9-]/)){if(!r||!r.is(e))throw new TypeError('TLD "'+e+'" contains characters other than [A-Z0-9]');o=new RegExp(u(this.tld())+"$"),this._parts.hostname=this._parts.hostname.replace(o,e)}else{if(!this._parts.hostname||this.is("IP"))throw new ReferenceError("cannot set TLD on non-domain host");o=new RegExp(u(this.tld())+"$"),this._parts.hostname=this._parts.hostname.replace(o,e)}return this.build(!t),this},s.directory=function(e,t){if(this._parts.urn)return void 0===e?"":this;if(void 0===e||!0===e){if(!this._parts.path&&!this._parts.hostname)return"";if("/"===this._parts.path)return"/";var r=this._parts.path.length-this.filename().length-1,n=this._parts.path.substring(0,r)||(this._parts.hostname?"/":"");return e?o.decodePath(n):n}var i=this._parts.path.length-this.filename().length,s=this._parts.path.substring(0,i),a=new RegExp("^"+u(s));return this.is("relative")||(e||(e="/"),"/"!==e.charAt(0)&&(e="/"+e)),e&&"/"!==e.charAt(e.length-1)&&(e+="/"),e=o.recodePath(e),this._parts.path=this._parts.path.replace(a,e),this.build(!t),this},s.filename=function(e,t){if(this._parts.urn)return void 0===e?"":this;if("string"!=typeof e){if(!this._parts.path||"/"===this._parts.path)return"";var r=this._parts.path.lastIndexOf("/"),n=this._parts.path.substring(r+1);return e?o.decodePathSegment(n):n}var i=!1;"/"===e.charAt(0)&&(e=e.substring(1)),e.match(/\.?\//)&&(i=!0);var s=new RegExp(u(this.filename())+"$");return e=o.recodePath(e),this._parts.path=this._parts.path.replace(s,e),i?this.normalizePath(t):this.build(!t),this},s.suffix=function(e,t){if(this._parts.urn)return void 0===e?"":this;if(void 0===e||!0===e){if(!this._parts.path||"/"===this._parts.path)return"";var r,n,i=this.filename(),s=i.lastIndexOf(".");return-1===s?"":(r=i.substring(s+1),n=/^[a-z0-9%]+$/i.test(r)?r:"",e?o.decodePathSegment(n):n)}"."===e.charAt(0)&&(e=e.substring(1));var a,c=this.suffix();if(c)a=e?new RegExp(u(c)+"$"):new RegExp(u("."+c)+"$");else{if(!e)return this;this._parts.path+="."+o.recodePath(e)}return a&&(e=o.recodePath(e),this._parts.path=this._parts.path.replace(a,e)),this.build(!t),this},s.segment=function(e,t,r){var n=this._parts.urn?":":"/",i=this.path(),o="/"===i.substring(0,1),s=i.split(n);if(void 0!==e&&"number"!=typeof e&&(r=t,t=e,e=void 0),void 0!==e&&"number"!=typeof e)throw new Error('Bad segment "'+e+'", must be 0-based integer');if(o&&s.shift(),e<0&&(e=Math.max(s.length+e,0)),void 0===t)return void 0===e?s:s[e];if(null===e||void 0===s[e])if(l(t)){s=[];for(var a=0,u=t.length;a= 0x80 (not a basic code point)","invalid-input":"Invalid input"},f=Math.floor,d=String.fromCharCode;function g(e){throw new RangeError(p[e])}function m(e,t){for(var r=e.length,n=[];r--;)n[r]=t(e[r]);return n}function y(e,t){var r=e.split("@"),n="";return r.length>1&&(n=r[0]+"@",e=r[1]),n+m((e=e.replace(h,".")).split("."),t).join(".")}function v(e){for(var t,r,n=[],i=0,o=e.length;i=55296&&t<=56319&&i65535&&(t+=d((e-=65536)>>>10&1023|55296),e=56320|1023&e),t+=d(e)})).join("")}function b(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function C(e,t,r){var n=0;for(e=r?f(e/700):e>>1,e+=f(e/t);e>455;n+=36)e=f(e/35);return f(n+36*e/(e+38))}function F(e){var t,r,n,i,o,s,a,c,l,h,p,d=[],m=e.length,y=0,v=128,b=72;for((r=e.lastIndexOf("-"))<0&&(r=0),n=0;n=128&&g("not-basic"),d.push(e.charCodeAt(n));for(i=r>0?r+1:0;i=m&&g("invalid-input"),((c=(p=e.charCodeAt(i++))-48<10?p-22:p-65<26?p-65:p-97<26?p-97:36)>=36||c>f((u-y)/s))&&g("overflow"),y+=c*s,!(c<(l=a<=b?1:a>=b+26?26:a-b));a+=36)s>f(u/(h=36-l))&&g("overflow"),s*=h;b=C(y-o,t=d.length+1,0==o),f(y/t)>u-v&&g("overflow"),v+=f(y/t),y%=t,d.splice(y++,0,v)}return A(d)}function E(e){var t,r,n,i,o,s,a,c,l,h,p,m,y,A,F,E=[];for(m=(e=v(e)).length,t=128,r=0,o=72,s=0;s=t&&pf((u-r)/(y=n+1))&&g("overflow"),r+=(a-t)*y,t=a,s=0;su&&g("overflow"),p==t){for(c=r,l=36;!(c<(h=l<=o?1:l>=o+26?26:l-o));l+=36)F=c-h,A=36-h,E.push(d(b(h+F%A,0))),c=f(F/A);E.push(d(b(c,0))),o=C(r,y,n==i),r=0,++n}++r,++t}return E.join("")}a={version:"1.3.2",ucs2:{decode:v,encode:A},decode:F,encode:E,toASCII:function(e){return y(e,(function(e){return l.test(e)?"xn--"+E(e):e}))},toUnicode:function(e){return y(e,(function(e){return c.test(e)?F(e.slice(4).toLowerCase()):e}))}},void 0===(i=function(){return a}.call(t,r,t,e))||(e.exports=i)}()}).call(this,r(27)(e),r(42))},function(e,t){var r;r=function(){return this}();try{r=r||new Function("return this")()}catch(e){"object"==typeof window&&(r=window)}e.exports=r},function(e,t,r){var n,i; +/*! + * URI.js - Mutating URLs + * IPv6 Support + * + * Version: 1.19.1 + * + * Author: Rodney Rehm + * Web: http://medialize.github.io/URI.js/ + * + * Licensed under + * MIT License http://www.opensource.org/licenses/mit-license + * + */!function(o,s){"use strict";e.exports?e.exports=s():void 0===(i="function"==typeof(n=s)?n.call(t,r,t,e):n)||(e.exports=i)}(0,(function(e){"use strict";var t=e&&e.IPv6;return{best:function(e){var t,r,n=e.toLowerCase().split(":"),i=n.length,o=8;for(""===n[0]&&""===n[1]&&""===n[2]?(n.shift(),n.shift()):""===n[0]&&""===n[1]?n.shift():""===n[i-1]&&""===n[i-2]&&n.pop(),-1!==n[(i=n.length)-1].indexOf(".")&&(o=7),t=0;t1);a++)r.splice(0,1);n[s]=r.join("")}var u=-1,c=0,l=0,h=-1,p=!1;for(s=0;sc&&(u=h,c=l)):"0"===n[s]&&(p=!0,h=s,l=1);l>c&&(u=h,c=l),c>1&&n.splice(u,c,""),i=n.length;var f="";for(""===n[0]&&(f=":"),s=0;s=e.length-1)return!1;var n=e.lastIndexOf(".",t-1);if(n<=0||n>=t-1)return!1;var i=r.list[e.slice(t+1)];return!!i&&i.indexOf(" "+e.slice(n+1,t)+" ")>=0},is:function(e){var t=e.lastIndexOf(".");if(t<=0||t>=e.length-1)return!1;if(e.lastIndexOf(".",t-1)>=0)return!1;var n=r.list[e.slice(t+1)];return!!n&&n.indexOf(" "+e.slice(0,t)+" ")>=0},get:function(e){var t=e.lastIndexOf(".");if(t<=0||t>=e.length-1)return null;var n=e.lastIndexOf(".",t-1);if(n<=0||n>=t-1)return null;var i=r.list[e.slice(t+1)];return i?i.indexOf(" "+e.slice(n+1,t)+" ")<0?null:e.slice(n+1):null},noConflict:function(){return e.SecondLevelDomains===this&&(e.SecondLevelDomains=t),this}};return r}))},function(e,t){var r="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof window.msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto);if(r){var n=new Uint8Array(16);e.exports=function(){return r(n),n}}else{var i=new Array(16);e.exports=function(){for(var e,t=0;t<16;t++)0==(3&t)&&(e=4294967296*Math.random()),i[t]=e>>>((3&t)<<3)&255;return i}}},function(e,t){for(var r=[],n=0;n<256;++n)r[n]=(n+256).toString(16).substr(1);e.exports=function(e,t){var n=t||0,i=r;return[i[e[n++]],i[e[n++]],i[e[n++]],i[e[n++]],"-",i[e[n++]],i[e[n++]],"-",i[e[n++]],i[e[n++]],"-",i[e[n++]],i[e[n++]],"-",i[e[n++]],i[e[n++]],i[e[n++]],i[e[n++]],i[e[n++]],i[e[n++]]].join("")}},function(e,t,r){var n=r(107),i={};for(var o in n)n.hasOwnProperty(o)&&(i[n[o]]=o);var s=e.exports={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};for(var a in s)if(s.hasOwnProperty(a)){if(!("channels"in s[a]))throw new Error("missing channels property: "+a);if(!("labels"in s[a]))throw new Error("missing channel labels property: "+a);if(s[a].labels.length!==s[a].channels)throw new Error("channel and label counts mismatch: "+a);var u=s[a].channels,c=s[a].labels;delete s[a].channels,delete s[a].labels,Object.defineProperty(s[a],"channels",{value:u}),Object.defineProperty(s[a],"labels",{value:c})}s.rgb.hsl=function(e){var t,r,n=e[0]/255,i=e[1]/255,o=e[2]/255,s=Math.min(n,i,o),a=Math.max(n,i,o),u=a-s;return a===s?t=0:n===a?t=(i-o)/u:i===a?t=2+(o-n)/u:o===a&&(t=4+(n-i)/u),(t=Math.min(60*t,360))<0&&(t+=360),r=(s+a)/2,[t,100*(a===s?0:r<=.5?u/(a+s):u/(2-a-s)),100*r]},s.rgb.hsv=function(e){var t,r,n,i,o,s=e[0]/255,a=e[1]/255,u=e[2]/255,c=Math.max(s,a,u),l=c-Math.min(s,a,u),h=function(e){return(c-e)/6/l+.5};return 0===l?i=o=0:(o=l/c,t=h(s),r=h(a),n=h(u),s===c?i=n-r:a===c?i=1/3+t-n:u===c&&(i=2/3+r-t),i<0?i+=1:i>1&&(i-=1)),[360*i,100*o,100*c]},s.rgb.hwb=function(e){var t=e[0],r=e[1],n=e[2];return[s.rgb.hsl(e)[0],100*(1/255*Math.min(t,Math.min(r,n))),100*(n=1-1/255*Math.max(t,Math.max(r,n)))]},s.rgb.cmyk=function(e){var t,r=e[0]/255,n=e[1]/255,i=e[2]/255;return[100*((1-r-(t=Math.min(1-r,1-n,1-i)))/(1-t)||0),100*((1-n-t)/(1-t)||0),100*((1-i-t)/(1-t)||0),100*t]},s.rgb.keyword=function(e){var t=i[e];if(t)return t;var r,o,s,a=1/0;for(var u in n)if(n.hasOwnProperty(u)){var c=n[u],l=(o=e,s=c,Math.pow(o[0]-s[0],2)+Math.pow(o[1]-s[1],2)+Math.pow(o[2]-s[2],2));l.04045?Math.pow((t+.055)/1.055,2.4):t/12.92)+.3576*(r=r>.04045?Math.pow((r+.055)/1.055,2.4):r/12.92)+.1805*(n=n>.04045?Math.pow((n+.055)/1.055,2.4):n/12.92)),100*(.2126*t+.7152*r+.0722*n),100*(.0193*t+.1192*r+.9505*n)]},s.rgb.lab=function(e){var t=s.rgb.xyz(e),r=t[0],n=t[1],i=t[2];return n/=100,i/=108.883,r=(r/=95.047)>.008856?Math.pow(r,1/3):7.787*r+16/116,[116*(n=n>.008856?Math.pow(n,1/3):7.787*n+16/116)-16,500*(r-n),200*(n-(i=i>.008856?Math.pow(i,1/3):7.787*i+16/116))]},s.hsl.rgb=function(e){var t,r,n,i,o,s=e[0]/360,a=e[1]/100,u=e[2]/100;if(0===a)return[o=255*u,o,o];t=2*u-(r=u<.5?u*(1+a):u+a-u*a),i=[0,0,0];for(var c=0;c<3;c++)(n=s+1/3*-(c-1))<0&&n++,n>1&&n--,o=6*n<1?t+6*(r-t)*n:2*n<1?r:3*n<2?t+(r-t)*(2/3-n)*6:t,i[c]=255*o;return i},s.hsl.hsv=function(e){var t=e[0],r=e[1]/100,n=e[2]/100,i=r,o=Math.max(n,.01);return r*=(n*=2)<=1?n:2-n,i*=o<=1?o:2-o,[t,100*(0===n?2*i/(o+i):2*r/(n+r)),100*((n+r)/2)]},s.hsv.rgb=function(e){var t=e[0]/60,r=e[1]/100,n=e[2]/100,i=Math.floor(t)%6,o=t-Math.floor(t),s=255*n*(1-r),a=255*n*(1-r*o),u=255*n*(1-r*(1-o));switch(n*=255,i){case 0:return[n,u,s];case 1:return[a,n,s];case 2:return[s,n,u];case 3:return[s,a,n];case 4:return[u,s,n];case 5:return[n,s,a]}},s.hsv.hsl=function(e){var t,r,n,i=e[0],o=e[1]/100,s=e[2]/100,a=Math.max(s,.01);return n=(2-o)*s,r=o*a,[i,100*(r=(r/=(t=(2-o)*a)<=1?t:2-t)||0),100*(n/=2)]},s.hwb.rgb=function(e){var t,r,n,i,o,s,a,u=e[0]/360,c=e[1]/100,l=e[2]/100,h=c+l;switch(h>1&&(c/=h,l/=h),n=6*u-(t=Math.floor(6*u)),0!=(1&t)&&(n=1-n),i=c+n*((r=1-l)-c),t){default:case 6:case 0:o=r,s=i,a=c;break;case 1:o=i,s=r,a=c;break;case 2:o=c,s=r,a=i;break;case 3:o=c,s=i,a=r;break;case 4:o=i,s=c,a=r;break;case 5:o=r,s=c,a=i}return[255*o,255*s,255*a]},s.cmyk.rgb=function(e){var t=e[0]/100,r=e[1]/100,n=e[2]/100,i=e[3]/100;return[255*(1-Math.min(1,t*(1-i)+i)),255*(1-Math.min(1,r*(1-i)+i)),255*(1-Math.min(1,n*(1-i)+i))]},s.xyz.rgb=function(e){var t,r,n,i=e[0]/100,o=e[1]/100,s=e[2]/100;return r=-.9689*i+1.8758*o+.0415*s,n=.0557*i+-.204*o+1.057*s,t=(t=3.2406*i+-1.5372*o+-.4986*s)>.0031308?1.055*Math.pow(t,1/2.4)-.055:12.92*t,r=r>.0031308?1.055*Math.pow(r,1/2.4)-.055:12.92*r,n=n>.0031308?1.055*Math.pow(n,1/2.4)-.055:12.92*n,[255*(t=Math.min(Math.max(0,t),1)),255*(r=Math.min(Math.max(0,r),1)),255*(n=Math.min(Math.max(0,n),1))]},s.xyz.lab=function(e){var t=e[0],r=e[1],n=e[2];return r/=100,n/=108.883,t=(t/=95.047)>.008856?Math.pow(t,1/3):7.787*t+16/116,[116*(r=r>.008856?Math.pow(r,1/3):7.787*r+16/116)-16,500*(t-r),200*(r-(n=n>.008856?Math.pow(n,1/3):7.787*n+16/116))]},s.lab.xyz=function(e){var t,r,n,i=e[0];t=e[1]/500+(r=(i+16)/116),n=r-e[2]/200;var o=Math.pow(r,3),s=Math.pow(t,3),a=Math.pow(n,3);return r=o>.008856?o:(r-16/116)/7.787,t=s>.008856?s:(t-16/116)/7.787,n=a>.008856?a:(n-16/116)/7.787,[t*=95.047,r*=100,n*=108.883]},s.lab.lch=function(e){var t,r=e[0],n=e[1],i=e[2];return(t=360*Math.atan2(i,n)/2/Math.PI)<0&&(t+=360),[r,Math.sqrt(n*n+i*i),t]},s.lch.lab=function(e){var t,r=e[0],n=e[1];return t=e[2]/360*2*Math.PI,[r,n*Math.cos(t),n*Math.sin(t)]},s.rgb.ansi16=function(e){var t=e[0],r=e[1],n=e[2],i=1 in arguments?arguments[1]:s.rgb.hsv(e)[2];if(0===(i=Math.round(i/50)))return 30;var o=30+(Math.round(n/255)<<2|Math.round(r/255)<<1|Math.round(t/255));return 2===i&&(o+=60),o},s.hsv.ansi16=function(e){return s.rgb.ansi16(s.hsv.rgb(e),e[2])},s.rgb.ansi256=function(e){var t=e[0],r=e[1],n=e[2];return t===r&&r===n?t<8?16:t>248?231:Math.round((t-8)/247*24)+232:16+36*Math.round(t/255*5)+6*Math.round(r/255*5)+Math.round(n/255*5)},s.ansi16.rgb=function(e){var t=e%10;if(0===t||7===t)return e>50&&(t+=3.5),[t=t/10.5*255,t,t];var r=.5*(1+~~(e>50));return[(1&t)*r*255,(t>>1&1)*r*255,(t>>2&1)*r*255]},s.ansi256.rgb=function(e){if(e>=232){var t=10*(e-232)+8;return[t,t,t]}var r;return e-=16,[Math.floor(e/36)/5*255,Math.floor((r=e%36)/6)/5*255,r%6/5*255]},s.rgb.hex=function(e){var t=(((255&Math.round(e[0]))<<16)+((255&Math.round(e[1]))<<8)+(255&Math.round(e[2]))).toString(16).toUpperCase();return"000000".substring(t.length)+t},s.hex.rgb=function(e){var t=e.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!t)return[0,0,0];var r=t[0];3===t[0].length&&(r=r.split("").map((function(e){return e+e})).join(""));var n=parseInt(r,16);return[n>>16&255,n>>8&255,255&n]},s.rgb.hcg=function(e){var t,r=e[0]/255,n=e[1]/255,i=e[2]/255,o=Math.max(Math.max(r,n),i),s=Math.min(Math.min(r,n),i),a=o-s;return t=a<=0?0:o===r?(n-i)/a%6:o===n?2+(i-r)/a:4+(r-n)/a+4,t/=6,[360*(t%=1),100*a,100*(a<1?s/(1-a):0)]},s.hsl.hcg=function(e){var t=e[1]/100,r=e[2]/100,n=1,i=0;return(n=r<.5?2*t*r:2*t*(1-r))<1&&(i=(r-.5*n)/(1-n)),[e[0],100*n,100*i]},s.hsv.hcg=function(e){var t=e[1]/100,r=e[2]/100,n=t*r,i=0;return n<1&&(i=(r-n)/(1-n)),[e[0],100*n,100*i]},s.hcg.rgb=function(e){var t=e[0]/360,r=e[1]/100,n=e[2]/100;if(0===r)return[255*n,255*n,255*n];var i,o=[0,0,0],s=t%1*6,a=s%1,u=1-a;switch(Math.floor(s)){case 0:o[0]=1,o[1]=a,o[2]=0;break;case 1:o[0]=u,o[1]=1,o[2]=0;break;case 2:o[0]=0,o[1]=1,o[2]=a;break;case 3:o[0]=0,o[1]=u,o[2]=1;break;case 4:o[0]=a,o[1]=0,o[2]=1;break;default:o[0]=1,o[1]=0,o[2]=u}return i=(1-r)*n,[255*(r*o[0]+i),255*(r*o[1]+i),255*(r*o[2]+i)]},s.hcg.hsv=function(e){var t=e[1]/100,r=t+e[2]/100*(1-t),n=0;return r>0&&(n=t/r),[e[0],100*n,100*r]},s.hcg.hsl=function(e){var t=e[1]/100,r=e[2]/100*(1-t)+.5*t,n=0;return r>0&&r<.5?n=t/(2*r):r>=.5&&r<1&&(n=t/(2*(1-r))),[e[0],100*n,100*r]},s.hcg.hwb=function(e){var t=e[1]/100,r=t+e[2]/100*(1-t);return[e[0],100*(r-t),100*(1-r)]},s.hwb.hcg=function(e){var t=e[1]/100,r=1-e[2]/100,n=r-t,i=0;return n<1&&(i=(r-n)/(1-n)),[e[0],100*n,100*i]},s.apple.rgb=function(e){return[e[0]/65535*255,e[1]/65535*255,e[2]/65535*255]},s.rgb.apple=function(e){return[e[0]/255*65535,e[1]/255*65535,e[2]/255*65535]},s.gray.rgb=function(e){return[e[0]/100*255,e[0]/100*255,e[0]/100*255]},s.gray.hsl=s.gray.hsv=function(e){return[0,0,e[0]]},s.gray.hwb=function(e){return[0,100,e[0]]},s.gray.cmyk=function(e){return[0,0,0,e[0]]},s.gray.lab=function(e){return[e[0],0,0]},s.gray.hex=function(e){var t=255&Math.round(e[0]/100*255),r=((t<<16)+(t<<8)+t).toString(16).toUpperCase();return"000000".substring(r.length)+r},s.rgb.gray=function(e){return[(e[0]+e[1]+e[2])/3/255*100]}},function(e,t,r){"use strict";const n=r(15);class i extends n{constructor(e,t){super(e,t),this._isParticipantDeclaration=!0}static[Symbol.hasInstance](e){return null!=e&&Boolean(e._isParticipantDeclaration)}}e.exports=i},function(e,t,r){"use strict";const n=r(23);e.exports=class extends n{constructor(e,t,r,n,i){let o=e,s="";r&&(s+=" File "+r),t&&(t.end&&t.start&&t.end.offset&&t.start.offset&&t.end.offset-t.start.offset==1&&(t.end.column=t.start.column,t.end.offset=t.start.offset),s+=s?" line "+t.start.line+" column "+t.start.column:" Line "+t.start.line+" column "+t.start.column),o+=s,super(e,t,n||o,r,i)}}},function(e,t){},function(e,t,r){"use strict";const n=r(115),i=r(22),o=r(133);e.exports=class{constructor(e){this.modelManager=e}accepts(e){return e.startsWith("http://")||e.startsWith("https://")}load(e,t){t||(t={});const r=JSON.parse(JSON.stringify(t));return r.url=e,r.method="get",r.responseType="text",n(r).then(t=>{let r=o.parse(e);const n=(r.host+r.pathname).replace(/\//g,".");return new i(this.modelManager,t.data,"@"+n)})}}},function(e,t,r){"use strict";e.exports=function(e,t){return function(){for(var r=new Array(arguments.length),n=0;n=200&&e<300}};u.headers={common:{Accept:"application/json, text/plain, */*"}},n.forEach(["delete","get","head"],(function(e){u.headers[e]={}})),n.forEach(["post","put","patch"],(function(e){u.headers[e]=n.merge(o)})),e.exports=u}).call(this,r(5))},function(e,t,r){"use strict";var n=r(1),i=r(122),o=r(124),s=r(53),a=r(125),u=r(128),c=r(129),l=r(57);e.exports=function(e){return new Promise((function(t,r){var h=e.data,p=e.headers;n.isFormData(h)&&delete p["Content-Type"];var f=new XMLHttpRequest;if(e.auth){var d=e.auth.username||"",g=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";p.Authorization="Basic "+btoa(d+":"+g)}var m=a(e.baseURL,e.url);if(f.open(e.method.toUpperCase(),s(m,e.params,e.paramsSerializer),!0),f.timeout=e.timeout,f.onreadystatechange=function(){if(f&&4===f.readyState&&(0!==f.status||f.responseURL&&0===f.responseURL.indexOf("file:"))){var n="getAllResponseHeaders"in f?u(f.getAllResponseHeaders()):null,o={data:e.responseType&&"text"!==e.responseType?f.response:f.responseText,status:f.status,statusText:f.statusText,headers:n,config:e,request:f};i(t,r,o),f=null}},f.onabort=function(){f&&(r(l("Request aborted",e,"ECONNABORTED",f)),f=null)},f.onerror=function(){r(l("Network Error",e,null,f)),f=null},f.ontimeout=function(){var t="timeout of "+e.timeout+"ms exceeded";e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),r(l(t,e,"ECONNABORTED",f)),f=null},n.isStandardBrowserEnv()){var y=(e.withCredentials||c(m))&&e.xsrfCookieName?o.read(e.xsrfCookieName):void 0;y&&(p[e.xsrfHeaderName]=y)}if("setRequestHeader"in f&&n.forEach(p,(function(e,t){void 0===h&&"content-type"===t.toLowerCase()?delete p[t]:f.setRequestHeader(t,e)})),n.isUndefined(e.withCredentials)||(f.withCredentials=!!e.withCredentials),e.responseType)try{f.responseType=e.responseType}catch(t){if("json"!==e.responseType)throw t}"function"==typeof e.onDownloadProgress&&f.addEventListener("progress",e.onDownloadProgress),"function"==typeof e.onUploadProgress&&f.upload&&f.upload.addEventListener("progress",e.onUploadProgress),e.cancelToken&&e.cancelToken.promise.then((function(e){f&&(f.abort(),r(e),f=null)})),h||(h=null),f.send(h)}))}},function(e,t,r){"use strict";var n=r(123);e.exports=function(e,t,r,i,o){var s=new Error(e);return n(s,t,r,i,o)}},function(e,t,r){"use strict";var n=r(1);e.exports=function(e,t){t=t||{};var r={},i=["url","method","data"],o=["headers","auth","proxy","params"],s=["baseURL","transformRequest","transformResponse","paramsSerializer","timeout","timeoutMessage","withCredentials","adapter","responseType","xsrfCookieName","xsrfHeaderName","onUploadProgress","onDownloadProgress","decompress","maxContentLength","maxBodyLength","maxRedirects","transport","httpAgent","httpsAgent","cancelToken","socketPath","responseEncoding"],a=["validateStatus"];function u(e,t){return n.isPlainObject(e)&&n.isPlainObject(t)?n.merge(e,t):n.isPlainObject(t)?n.merge({},t):n.isArray(t)?t.slice():t}function c(i){n.isUndefined(t[i])?n.isUndefined(e[i])||(r[i]=u(void 0,e[i])):r[i]=u(e[i],t[i])}n.forEach(i,(function(e){n.isUndefined(t[e])||(r[e]=u(void 0,t[e]))})),n.forEach(o,c),n.forEach(s,(function(i){n.isUndefined(t[i])?n.isUndefined(e[i])||(r[i]=u(void 0,e[i])):r[i]=u(void 0,t[i])})),n.forEach(a,(function(n){n in t?r[n]=u(e[n],t[n]):n in e&&(r[n]=u(void 0,e[n]))}));var l=i.concat(o).concat(s).concat(a),h=Object.keys(e).concat(Object.keys(t)).filter((function(e){return-1===l.indexOf(e)}));return n.forEach(h,c),r}},function(e,t,r){"use strict";function n(e){this.message=e}n.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},n.prototype.__CANCEL__=!0,e.exports=n},function(e,t,r){"use strict";const n=r(50),i=r(140),o=r(141),s=r(29),a=r(36),u=r(2),c=r(9),l=r(22),h=r(142),p=r(0),f=r(61),d=r(147),g=r(25)("concerto:ModelManager");class m{constructor(){this.modelFiles={},this.factory=new a(this),this.serializer=new f(this.factory,this),this.decoratorFactories=[],this._isModelManager=!0,this.addRootModel()}addRootModel(){this.addModelFile("namespace concerto\n concept Concept {\n }","concerto.cto")}accept(e,t){return e.visit(this,t)}validateModelFile(e,t){if("string"==typeof e){new l(this,e,t).validate()}else e.validate()}_throwAlreadyExists(e){const t=this.modelFiles[e.getNamespace()].getName(),r=t?" in file "+t:"",n=e.getName()?" specified in file "+e.getName():"";let i=`Namespace ${e.getNamespace()}${n} is already declared${r}`;throw new Error(i)}addModelFile(e,t,r){g("addModelFile","addModelFile",e,t);let n=null;return n="string"==typeof e?new l(this,e,t):e,this.modelFiles[n.getNamespace()]?this._throwAlreadyExists(n):(r||n.validate(),this.modelFiles[n.getNamespace()]=n),n}updateModelFile(e,t,r){if(g("updateModelFile","updateModelFile",e,t),"string"==typeof e){let n=new l(this,e,t);return this.updateModelFile(n,t,r)}if(!this.modelFiles[e.getNamespace()])throw new Error(`Model file for namespace ${e.getNamespace()} not found`);r||e.validate();return this.modelFiles[e.getNamespace()]=e,e}deleteModelFile(e){if(!this.modelFiles[e])throw new Error("Model file does not exist");delete this.modelFiles[e]}addModelFiles(e,t,r){const n="addModelFiles";g(n,"addModelFiles",e,t);const i={};Object.assign(i,this.modelFiles);let o=[];try{for(let r=0;r{if("MISSING_DEPENDENCY"!==e.code)throw e;try{return this.validateModelFiles(),[]}catch(e){const t=this.getModelFileByFileName(e.fileName),r=t.getExternalImports(),n=Object.keys(r).find(t=>e.shortMessage.includes(t)),i=t.getImportURI(n),o=new Error(`Unable to download external model dependency '${i}'`);throw o.code="MISSING_DEPENDENCY",o}}),n={};Object.assign(n,this.modelFiles);try{return r.forEach(e=>{this.modelFiles[e.getNamespace()]?this.updateModelFile(e,e.getName(),!0):this.addModelFile(e,e.getName(),!0)}),this.validateModelFiles(),r}catch(e){throw this.modelFiles={},Object.assign(this.modelFiles,n),e}}writeModelsToFileSystem(e,t={}){if(!e)throw new Error("`path` is a required parameter of writeModelsToFileSystem");const r=Object.assign({includeExternalModels:!0},t);this.getModelFiles().forEach((function(t){if(t.isExternal()&&!r.includeExternalModels)return;const s=o(t.fileName).split("/").pop();n.writeFileSync(e+i.sep+s,t.definitions)}))}getModelFiles(e){let t=Object.keys(this.modelFiles),r=[];for(let n=0;nt.getName()===e)[0]}getNamespaces(){return Object.keys(this.modelFiles)}getType(e){const t=p.getNamespace(e),r=this.getModelFile(t);if(!r){const t=u.messageFormatter("modelmanager-gettype-noregisteredns");throw new d(e,t({type:e}))}const n=r.getType(e);if(!n){const r=u.messageFormatter("modelmanager-gettype-notypeinns");throw new d(e,r({type:p.getShortName(e),namespace:t}))}return n}getAssetDeclarations(e=!0){return this.getModelFiles().reduce((t,r)=>t.concat(r.getAssetDeclarations(e)),[])}getTransactionDeclarations(e=!0){return this.getModelFiles().reduce((t,r)=>t.concat(r.getTransactionDeclarations(e)),[])}getEventDeclarations(e=!0){return this.getModelFiles().reduce((t,r)=>t.concat(r.getEventDeclarations(e)),[])}getParticipantDeclarations(e=!0){return this.getModelFiles().reduce((t,r)=>t.concat(r.getParticipantDeclarations(e)),[])}getEnumDeclarations(e=!0){return this.getModelFiles().reduce((t,r)=>t.concat(r.getEnumDeclarations(e)),[])}getConceptDeclarations(e=!0){return this.getModelFiles().reduce((t,r)=>t.concat(r.getConceptDeclarations(e)),[])}getFactory(){return this.factory}getSerializer(){return this.serializer}getDecoratorFactories(){return this.decoratorFactories}addDecoratorFactory(e){this.decoratorFactories.push(e)}static[Symbol.hasInstance](e){return null!=e&&Boolean(e._isModelManager)}}e.exports=m},function(e,t,r){"use strict";const n=r(17),i=r(24),o=r(7),s=r(2),a=r(145),u=r(146),c=r(20),l=r(38),h=r(21),p=r(14),f={validate:!0,ergo:!1};class d{constructor(e,t){if(!e)throw new Error(s.formatMessage("serializer-constructor-factorynull"));if(!t)throw new Error(s.formatMessage("serializer-constructor-modelmanagernull"));this.factory=e,this.modelManager=t,this.defaultOptions=Object.assign({},f),this._isSerializer=!0}setDefaultOptions(e){this.defaultOptions=Object.assign({},f,e)}toJSON(e,t){if(!(e instanceof c))throw new Error(s.formatMessage("serializer-tojson-notcobject"));const r={};r.stack=new p(e),r.modelManager=this.modelManager,r.seenResources=new Set,r.dedupeResources=new Set;const n=this.modelManager.getType(e.getFullyQualifiedType());if((t=t?Object.assign({},this.defaultOptions,t):this.defaultOptions).validate){const e=new l(t);n.accept(e,r)}const i=new a(!0===t.convertResourcesToRelationships,!0===t.permitResourcesForRelationships,!0===t.deduplicateResources,!0===t.convertResourcesToId,!0===t.ergo);return r.stack.clear(),r.stack.push(e),n.accept(i,r)}fromJSON(e,t){if(!e.$class)throw new Error("Invalid JSON data. Does not contain a $class type identifier.");const r=this.modelManager.getType(e.$class);let s;if(t=t?Object.assign({},this.defaultOptions,t):this.defaultOptions,r instanceof h)s=this.factory.newTransaction(r.getNamespace(),r.getName(),e[r.getIdentifierFieldName()]);else if(r instanceof n)s=this.factory.newEvent(r.getNamespace(),r.getName(),e[r.getIdentifierFieldName()]);else if(r instanceof i)s=this.factory.newConcept(r.getNamespace(),r.getName());else{if(r instanceof o)throw new Error("Attempting to create an ENUM declaration is not supported.");s=this.factory.newResource(r.getNamespace(),r.getName(),e[r.getIdentifierFieldName()])}const a={};a.jsonStack=new p(e),a.resourceStack=new p(s),a.modelManager=this.modelManager,a.factory=this.factory;const c=new u(!0===t.acceptResourcesForRelationships,!0===t.ergo);return r.accept(c,a),t.validate&&s.validate(),s}static[Symbol.hasInstance](e){return null!=e&&Boolean(e._isSerializer)}}e.exports=d},function(e,t,r){e.exports=r(63)},function(e,t,r){"use strict";e.exports.AssetDeclaration=r(30),e.exports.BaseException=r(10),e.exports.BaseFileException=r(23),e.exports.ClassDeclaration=r(3),e.exports.ConceptDeclaration=r(24),e.exports.EnumDeclaration=r(7),e.exports.EnumValueDeclaration=r(33),e.exports.EventDeclaration=r(17),e.exports.Field=r(4),e.exports.Writer=r(68),e.exports.Factory=r(36),e.exports.Globalize=r(2),e.exports.Introspector=r(35),e.exports.Logger=r(84),e.exports.ModelFile=r(22),e.exports.ModelLoader=r(113),e.exports.ModelManager=r(60),e.exports.DefaultModelFileLoader=r(29),e.exports.ParseException=r(49),e.exports.ParticipantDeclaration=r(48),e.exports.Property=r(16),e.exports.Relationship=r(19),e.exports.RelationshipDeclaration=r(6),e.exports.Resource=r(13),e.exports.SecurityException=r(148),e.exports.Serializer=r(61),e.exports.TransactionDeclaration=r(21),e.exports.Typed=r(20),e.exports.TypedStack=r(14),e.exports.ModelUtil=r(0),e.exports.version=r(32),e.exports.Concerto=r(149)},function(e,t,r){"use strict";e.exports=class{constructor(e,t){this.ast=t,this.parent=e,this.arguments=null,this.process()}accept(e,t){return e.visit(this,t)}getParent(){return this.parent}process(){if(this.name=this.ast.name,this.arguments=[],this.ast.arguments)for(let e=0;ethis.upperBound&&this.reportError(null,"Lower bound must be less than or equal to upper bound.")}getLowerBound(){return this.lowerBound}getUpperBound(){return this.upperBound}validate(e,t){null!==t&&(null!==this.lowerBound&&tthis.upperBound&&this.reportError(e,"Value is outside upper bound "+t))}toString(){return"NumberValidator lower: "+this.lowerBound+" upper: "+this.upperBound}}},function(e,t,r){"use strict";const n=r(34);e.exports=class extends n{constructor(e,t){super(e,t);try{this.regex=new RegExp(t.substring(1,t.length-1))}catch(e){this.reportError(e.message)}}validate(e,t){null!==t&&(this.regex.test(t)||this.reportError(e,"Value + '"+t+"' failed to match validation regex: "+this.regex))}getRegex(){return this.regex}}},function(e,t,r){"use strict";e.exports=class{constructor(){this.beforeBuffer="",this.buffer="",this.linesWritten=0}writeBeforeLine(e,t){for(let t=0;t{if("%%"===r)return r;a++;const o=n.formatters[i];if("function"==typeof o){const n=e[a];r=o.call(t,n),e.splice(a,1),a--}return r}),n.formatArgs.call(t,e);(t.log||n.log).apply(t,e)}return s.namespace=e,s.enabled=n.enabled(e),s.useColors=n.useColors(),s.color=t(e),s.destroy=i,s.extend=o,"function"==typeof n.init&&n.init(s),n.instances.push(s),s}function i(){const e=n.instances.indexOf(this);return-1!==e&&(n.instances.splice(e,1),!0)}function o(e,t){const r=n(this.namespace+(void 0===t?":":t)+e);return r.log=this.log,r}function s(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return n.debug=n,n.default=n,n.coerce=function(e){if(e instanceof Error)return e.stack||e.message;return e},n.disable=function(){const e=[...n.names.map(s),...n.skips.map(s).map(e=>"-"+e)].join(",");return n.enable(""),e},n.enable=function(e){let t;n.save(e),n.names=[],n.skips=[];const r=("string"==typeof e?e:"").split(/[\s,]+/),i=r.length;for(t=0;t{n[t]=e[t]}),n.instances=[],n.names=[],n.skips=[],n.formatters={},n.selectColor=t,n.enable(n.load()),n}},function(e,t){var r=1e3,n=6e4,i=60*n,o=24*i;function s(e,t,r,n){var i=t>=1.5*r;return Math.round(e/r)+" "+n+(i?"s":"")}e.exports=function(e,t){t=t||{};var a=typeof e;if("string"===a&&e.length>0)return function(e){if((e=String(e)).length>100)return;var t=/^(-?(?:\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(!t)return;var s=parseFloat(t[1]);switch((t[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*s;case"weeks":case"week":case"w":return 6048e5*s;case"days":case"day":case"d":return s*o;case"hours":case"hour":case"hrs":case"hr":case"h":return s*i;case"minutes":case"minute":case"mins":case"min":case"m":return s*n;case"seconds":case"second":case"secs":case"sec":case"s":return s*r;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return s;default:return}}(e);if("number"===a&&isFinite(e))return t.long?function(e){var t=Math.abs(e);if(t>=o)return s(e,t,o,"day");if(t>=i)return s(e,t,i,"hour");if(t>=n)return s(e,t,n,"minute");if(t>=r)return s(e,t,r,"second");return e+" ms"}(e):function(e){var t=Math.abs(e);if(t>=o)return Math.round(e/o)+"d";if(t>=i)return Math.round(e/i)+"h";if(t>=n)return Math.round(e/n)+"m";if(t>=r)return Math.round(e/r)+"s";return e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},function(e,t,r){"use strict";const n=r(3),i=r(7),o=r(4),s=r(0),a=r(6),u=r(11),c=r(2);e.exports=class{visit(e,t){if(e instanceof n)return this.visitClassDeclaration(e,t);if(e instanceof a)return this.visitRelationshipDeclaration(e,t);if(e instanceof o)return this.visitField(e,t);throw new Error("Unrecognised "+JSON.stringify(e))}visitClassDeclaration(e,t){const r=t.stack.pop(),n=e.getProperties();for(const e of n){if(!t.includeOptionalFields&&e.isOptional())continue;const n=r[e.getName()];u.isNull(n)&&(r[e.getName()]=e.accept(this,t))}return r}visitField(e,t){if(e.isPrimitive())t.seen.push("Primitve");else{let r=e.getFullyQualifiedTypeName(),n=t.modelManager.getType(r);n=this.findConcreteSubclass(n);let i=n.getFullyQualifiedName();if(t.seen.includes(i)){if(e.isArray())return[];if(e.isOptional())return null;throw new Error("Model is recursive.")}t.seen.push(i)}let r;if(e.isArray()){const n=()=>this.getFieldValue(e,t);r=t.valueGenerator.getArray(n)}else r=this.getFieldValue(e,t);return t.seen.pop(),r}getFieldValue(e,t){let r=e.getFullyQualifiedTypeName();if(s.isPrimitiveType(r))switch(r){case"DateTime":return t.valueGenerator.getDateTime();case"Integer":return e.validator?t.valueGenerator.getRange(e.validator.lowerBound,e.validator.upperBound,r):t.valueGenerator.getInteger();case"Long":return e.validator?t.valueGenerator.getRange(e.validator.lowerBound,e.validator.upperBound,r):t.valueGenerator.getLong();case"Double":return e.validator?t.valueGenerator.getRange(e.validator.lowerBound,e.validator.upperBound,r):t.valueGenerator.getDouble();case"Boolean":return t.valueGenerator.getBoolean();default:return e.validator?t.valueGenerator.getRegex(e.validator.regex):t.valueGenerator.getString()}let n=t.modelManager.getType(r);if(n instanceof i){let e=n.getOwnProperties();return t.valueGenerator.getEnum(e).getName()}if(n=this.findConcreteSubclass(n),n.isConcept()){let e=t.factory.newConcept(n.getNamespace(),n.getName());return t.stack.push(e),n.accept(this,t)}{const e=this.generateRandomId(n);let r=t.factory.newResource(n.getNamespace(),n.getName(),e);return t.stack.push(r),n.accept(this,t)}}findConcreteSubclass(e){if(!e.isAbstract())return e;const t=e.getAssignableClassDeclarations().filter(e=>!e.isAbstract());if(0===t.length){const t=c.messageFormatter("instancegenerator-newinstance-noconcreteclass");throw new Error(t({type:e.getFullyQualifiedName()}))}return t[0]}visitRelationshipDeclaration(e,t){let r=t.modelManager.getType(e.getFullyQualifiedTypeName());r=this.findConcreteSubclass(r);const n=t.factory,i=()=>{const e=this.generateRandomId(r);return n.newRelationship(r.getNamespace(),r.getName(),e)};return e.isArray()?t.valueGenerator.getArray(i):i()}generateRandomId(e){let t=Math.round(9999*Math.random()).toString();return t=t.padStart(4,"0"),t}}},function(e,t,r){"use strict";const n=r(73),i=r(75),o=r(8),s=r(12);o.extend(s);const a=function(e,t,r,n,i){return null===e&&(e=n),e=Math.min(Math.max(e,n),i),(null===t||t>i)&&(t=i),t=Math.max(Math.min(t,i),n),t+=r,t/=r,e/=r,(Math.random()*(t-e)+e)/(1/r)},u=(e,t,r)=>{let n=e,i=t;switch(null!==i&&null!==n&&i",E="