diff --git a/lib/metamodelutil.js b/lib/metamodelutil.js index 6bcdfe7..7512ed2 100644 --- a/lib/metamodelutil.js +++ b/lib/metamodelutil.js @@ -63,7 +63,7 @@ function createNameTable(priorModels, metaModel) { 'Asset': concertoNs, 'Participant': concertoNs, 'Transaction ': concertoNs, - 'Event': concertoNs, + 'Event': concertoNs }; // First list the imported names in order (overriding as we go along) @@ -147,6 +147,11 @@ function resolveTypeNames(metaModel, table) { }); } break; + case `${MetaModelNamespace}.MapDeclaration`: { + resolveTypeNames(metaModel.key, table); + resolveTypeNames(metaModel.value, table); + } + break; case `${MetaModelNamespace}.EnumProperty`: case `${MetaModelNamespace}.ObjectProperty`: case `${MetaModelNamespace}.RelationshipProperty`: { @@ -168,6 +173,26 @@ function resolveTypeNames(metaModel, table) { metaModel.type.namespace = resolveName(name, table); } break; + case `${MetaModelNamespace}.ObjectMapKeyType`: + case `${MetaModelNamespace}.ObjectMapValueType`: { + metaModel.type.namespace = resolveName(metaModel.type.name, table); + (metaModel.decorators || []).forEach((decorator) => { + resolveTypeNames(decorator, table); + }); + } + break; + case `${MetaModelNamespace}.StringScalar`: + case `${MetaModelNamespace}.BooleanScalar`: + case `${MetaModelNamespace}.DateTimeScalar`: + case `${MetaModelNamespace}.DoubleScalar`: + case `${MetaModelNamespace}.LongScalar`: + case `${MetaModelNamespace}.IntegerScalar`: { + metaModel.namespace = resolveName(metaModel.name, table); + (metaModel.decorators || []).forEach((decorator) => { + resolveTypeNames(decorator, table); + }); + } + break; } return metaModel; } diff --git a/package-lock.json b/package-lock.json index 6d4b4eb..34f575d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,7 +9,9 @@ "version": "3.8.1", "license": "Apache-2.0", "dependencies": { - "@accordproject/concerto-util": "3.9.1" + "@accordproject/concerto-core": "3.14.0", + "@accordproject/concerto-util": "3.9.1", + "@types/node": "20.7.0" }, "devDependencies": { "chai": "4.3.6", @@ -31,6 +33,137 @@ "npm": ">=6" } }, + "node_modules/@accordproject/concerto-core": { + "version": "3.14.0", + "resolved": "https://registry.npmjs.org/@accordproject/concerto-core/-/concerto-core-3.14.0.tgz", + "integrity": "sha512-JOLG9ISzlowDUsrD0Lbks0ft08JiQZV6oPbBai0tBOy5x+CPd4JLoGmjfy/x6+6HsFWdk1aXV2tQJww6Gw+3Tw==", + "dependencies": { + "@accordproject/concerto-cto": "3.14.0", + "@accordproject/concerto-metamodel": "3.8.1", + "@accordproject/concerto-util": "3.14.0", + "dayjs": "1.11.10", + "debug": "4.3.4", + "lorem-ipsum": "2.0.8", + "randexp": "0.5.3", + "semver": "7.5.4", + "slash": "3.0.0", + "urijs": "1.19.11", + "uuid": "9.0.1" + }, + "engines": { + "node": ">=16", + "npm": ">=8" + } + }, + "node_modules/@accordproject/concerto-core/node_modules/@accordproject/concerto-util": { + "version": "3.14.0", + "resolved": "https://registry.npmjs.org/@accordproject/concerto-util/-/concerto-util-3.14.0.tgz", + "integrity": "sha512-M32oVsJ9n4l/o10pz0e+AmGEpUmUQ4nwS2ixB4Jz2/kzRgVjeyHoolGKJCgDn6K8LjsGclSkMcmQ6IeF/7mC0g==", + "dependencies": { + "@supercharge/promise-pool": "1.7.0", + "axios": "0.23.0", + "colors": "1.4.0", + "debug": "4.3.4", + "json-colorizer": "2.2.2", + "slash": "3.0.0" + }, + "engines": { + "node": ">=16", + "npm": ">=8" + } + }, + "node_modules/@accordproject/concerto-core/node_modules/dayjs": { + "version": "1.11.10", + "resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.10.tgz", + "integrity": "sha512-vjAczensTgRcqDERK0SR2XMwsF/tSvnvlv6VcF2GIhg6Sx4yOIt/irsr1RDJsKiIyBzJDpCoXiWWq28MqH2cnQ==" + }, + "node_modules/@accordproject/concerto-core/node_modules/debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/@accordproject/concerto-core/node_modules/uuid": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.1.tgz", + "integrity": "sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==", + "funding": [ + "https://github.com/sponsors/broofa", + "https://github.com/sponsors/ctavan" + ], + "bin": { + "uuid": "dist/bin/uuid" + } + }, + "node_modules/@accordproject/concerto-cto": { + "version": "3.14.0", + "resolved": "https://registry.npmjs.org/@accordproject/concerto-cto/-/concerto-cto-3.14.0.tgz", + "integrity": "sha512-6Uf0fe5BZpgiBUONNAGxOrDdXvDK+6qMuWdcqN+aPddtFPLZ/2ldFarQaSkXHq71+yrM7B/Dh7Y/0KSvs1Tteg==", + "dependencies": { + "@accordproject/concerto-metamodel": "3.8.1", + "@accordproject/concerto-util": "3.14.0", + "path-browserify": "1.0.1" + }, + "engines": { + "node": ">=16", + "npm": ">=8" + } + }, + "node_modules/@accordproject/concerto-cto/node_modules/@accordproject/concerto-util": { + "version": "3.14.0", + "resolved": "https://registry.npmjs.org/@accordproject/concerto-util/-/concerto-util-3.14.0.tgz", + "integrity": "sha512-M32oVsJ9n4l/o10pz0e+AmGEpUmUQ4nwS2ixB4Jz2/kzRgVjeyHoolGKJCgDn6K8LjsGclSkMcmQ6IeF/7mC0g==", + "dependencies": { + "@supercharge/promise-pool": "1.7.0", + "axios": "0.23.0", + "colors": "1.4.0", + "debug": "4.3.4", + "json-colorizer": "2.2.2", + "slash": "3.0.0" + }, + "engines": { + "node": ">=16", + "npm": ">=8" + } + }, + "node_modules/@accordproject/concerto-cto/node_modules/debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/@accordproject/concerto-metamodel": { + "version": "3.8.1", + "resolved": "https://registry.npmjs.org/@accordproject/concerto-metamodel/-/concerto-metamodel-3.8.1.tgz", + "integrity": "sha512-R0CAtzW/IciPz2BxlEyMgKZtya7sqgZ/YSk5iLD6g16NXsJtj6jytDuSZmNMz0B0FpjtEjSoSXPexCR/aPL1qA==", + "dependencies": { + "@accordproject/concerto-util": "3.9.1" + }, + "engines": { + "node": ">=14", + "npm": ">=6" + } + }, "node_modules/@accordproject/concerto-util": { "version": "3.9.1", "resolved": "https://registry.npmjs.org/@accordproject/concerto-util/-/concerto-util-3.9.1.tgz", @@ -763,6 +896,11 @@ "integrity": "sha512-eC4U9MlIcu2q0KQmXszyn5Akca/0jrQmwDRgpAMJai7qBWq4amIQhZyNau4VYGtCeALvW1/NtjzJJ567aZxfKA==", "dev": true }, + "node_modules/@types/node": { + "version": "20.7.0", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.7.0.tgz", + "integrity": "sha512-zI22/pJW2wUZOVyguFaUL1HABdmSVxpXrzIqkjsHmyUjNhPoWM1CKfvVuXfetHhIok4RY573cqS0mZ1SJEnoTg==" + }, "node_modules/@ungap/promise-all-settled": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/@ungap/promise-all-settled/-/promise-all-settled-1.1.2.tgz", @@ -1194,6 +1332,14 @@ "node": ">=0.1.90" } }, + "node_modules/commander": { + "version": "9.5.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-9.5.0.tgz", + "integrity": "sha512-KRs7WVDKg86PWiuAqhDrAQnTXZKraVcCc6vFdL14qrZ/DcWwuRo7VoiYXalXO7S5GKpqYiVEwCbgFDfxNHKJBQ==", + "engines": { + "node": "^12.20.0 || >=14" + } + }, "node_modules/commondir": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz", @@ -1311,6 +1457,14 @@ "node": ">=6.0.0" } }, + "node_modules/drange": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/drange/-/drange-1.1.1.tgz", + "integrity": "sha512-pYxfDYpued//QpnLIm4Avk7rsNtAtQkUES2cwAYSvD/wd2pKD71gN2Ebj3e7klzXwjocvE8c5vx/1fxwpqmSxA==", + "engines": { + "node": ">=4" + } + }, "node_modules/electron-to-chromium": { "version": "1.4.286", "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.286.tgz", @@ -2482,6 +2636,21 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/lorem-ipsum": { + "version": "2.0.8", + "resolved": "https://registry.npmjs.org/lorem-ipsum/-/lorem-ipsum-2.0.8.tgz", + "integrity": "sha512-5RIwHuCb979RASgCJH0VKERn9cQo/+NcAi2BMe9ddj+gp7hujl6BI+qdOG4nVsLDpwWEJwTVYXNKP6BGgbcoGA==", + "dependencies": { + "commander": "^9.3.0" + }, + "bin": { + "lorem-ipsum": "dist/bin/lorem-ipsum.bin.js" + }, + "engines": { + "node": ">= 8.x", + "npm": ">= 5.x" + } + }, "node_modules/loupe": { "version": "2.3.6", "resolved": "https://registry.npmjs.org/loupe/-/loupe-2.3.6.tgz", @@ -3081,6 +3250,11 @@ "node": ">=0.10.0" } }, + "node_modules/path-browserify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-browserify/-/path-browserify-1.0.1.tgz", + "integrity": "sha512-b7uo2UCUOYZcnF/3ID0lulOJi/bafxa1xPe7ZPsammBSpjSWQkjNxlt635YGS2MiR9GjvuXCtz2emr3jbsz98g==" + }, "node_modules/path-exists": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", @@ -3317,6 +3491,18 @@ "node": ">=6" } }, + "node_modules/randexp": { + "version": "0.5.3", + "resolved": "https://registry.npmjs.org/randexp/-/randexp-0.5.3.tgz", + "integrity": "sha512-U+5l2KrcMNOUPYvazA3h5ekF80FHTUG+87SEAmHZmolh1M+i/WyTCxVzmi+tidIa1tM4BSe8g2Y/D3loWDjj+w==", + "dependencies": { + "drange": "^1.0.2", + "ret": "^0.2.0" + }, + "engines": { + "node": ">=4" + } + }, "node_modules/randombytes": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", @@ -3395,6 +3581,14 @@ "node": ">=4" } }, + "node_modules/ret": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/ret/-/ret-0.2.2.tgz", + "integrity": "sha512-M0b3YWQs7R3Z917WRQy1HHA7Ba7D8hvZg6UE5mLykJxQVE2ju0IXbGlaHPPlkY+WN7wFP+wUMXmBFA0aV6vYGQ==", + "engines": { + "node": ">=4" + } + }, "node_modules/rimraf": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", @@ -3434,7 +3628,6 @@ "version": "7.5.4", "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", - "dev": true, "dependencies": { "lru-cache": "^6.0.0" }, @@ -3449,7 +3642,6 @@ "version": "6.0.0", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", - "dev": true, "dependencies": { "yallist": "^4.0.0" }, @@ -3460,8 +3652,7 @@ "node_modules/semver/node_modules/yallist": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", - "dev": true + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" }, "node_modules/serialize-javascript": { "version": "6.0.0", @@ -3781,6 +3972,11 @@ "punycode": "^2.1.0" } }, + "node_modules/urijs": { + "version": "1.19.11", + "resolved": "https://registry.npmjs.org/urijs/-/urijs-1.19.11.tgz", + "integrity": "sha512-HXgFDgDommxn5/bIv0cnQZsPhHDA90NPHD6+c/v21U5+Sx5hoP8+dP9IZXBU1gIfvdRfhG8cel9QNPeionfcCQ==" + }, "node_modules/uuid": { "version": "8.3.2", "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", @@ -3968,6 +4164,98 @@ } }, "dependencies": { + "@accordproject/concerto-core": { + "version": "3.14.0", + "resolved": "https://registry.npmjs.org/@accordproject/concerto-core/-/concerto-core-3.14.0.tgz", + "integrity": "sha512-JOLG9ISzlowDUsrD0Lbks0ft08JiQZV6oPbBai0tBOy5x+CPd4JLoGmjfy/x6+6HsFWdk1aXV2tQJww6Gw+3Tw==", + "requires": { + "@accordproject/concerto-cto": "3.14.0", + "@accordproject/concerto-metamodel": "3.8.1", + "@accordproject/concerto-util": "3.14.0", + "dayjs": "1.11.10", + "debug": "4.3.4", + "lorem-ipsum": "2.0.8", + "randexp": "0.5.3", + "semver": "7.5.4", + "slash": "3.0.0", + "urijs": "1.19.11", + "uuid": "9.0.1" + }, + "dependencies": { + "@accordproject/concerto-util": { + "version": "3.14.0", + "resolved": "https://registry.npmjs.org/@accordproject/concerto-util/-/concerto-util-3.14.0.tgz", + "integrity": "sha512-M32oVsJ9n4l/o10pz0e+AmGEpUmUQ4nwS2ixB4Jz2/kzRgVjeyHoolGKJCgDn6K8LjsGclSkMcmQ6IeF/7mC0g==", + "requires": { + "@supercharge/promise-pool": "1.7.0", + "axios": "0.23.0", + "colors": "1.4.0", + "debug": "4.3.4", + "json-colorizer": "2.2.2", + "slash": "3.0.0" + } + }, + "dayjs": { + "version": "1.11.10", + "resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.10.tgz", + "integrity": "sha512-vjAczensTgRcqDERK0SR2XMwsF/tSvnvlv6VcF2GIhg6Sx4yOIt/irsr1RDJsKiIyBzJDpCoXiWWq28MqH2cnQ==" + }, + "debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "requires": { + "ms": "2.1.2" + } + }, + "uuid": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.1.tgz", + "integrity": "sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==" + } + } + }, + "@accordproject/concerto-cto": { + "version": "3.14.0", + "resolved": "https://registry.npmjs.org/@accordproject/concerto-cto/-/concerto-cto-3.14.0.tgz", + "integrity": "sha512-6Uf0fe5BZpgiBUONNAGxOrDdXvDK+6qMuWdcqN+aPddtFPLZ/2ldFarQaSkXHq71+yrM7B/Dh7Y/0KSvs1Tteg==", + "requires": { + "@accordproject/concerto-metamodel": "3.8.1", + "@accordproject/concerto-util": "3.14.0", + "path-browserify": "1.0.1" + }, + "dependencies": { + "@accordproject/concerto-util": { + "version": "3.14.0", + "resolved": "https://registry.npmjs.org/@accordproject/concerto-util/-/concerto-util-3.14.0.tgz", + "integrity": "sha512-M32oVsJ9n4l/o10pz0e+AmGEpUmUQ4nwS2ixB4Jz2/kzRgVjeyHoolGKJCgDn6K8LjsGclSkMcmQ6IeF/7mC0g==", + "requires": { + "@supercharge/promise-pool": "1.7.0", + "axios": "0.23.0", + "colors": "1.4.0", + "debug": "4.3.4", + "json-colorizer": "2.2.2", + "slash": "3.0.0" + } + }, + "debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "requires": { + "ms": "2.1.2" + } + } + } + }, + "@accordproject/concerto-metamodel": { + "version": "3.8.1", + "resolved": "https://registry.npmjs.org/@accordproject/concerto-metamodel/-/concerto-metamodel-3.8.1.tgz", + "integrity": "sha512-R0CAtzW/IciPz2BxlEyMgKZtya7sqgZ/YSk5iLD6g16NXsJtj6jytDuSZmNMz0B0FpjtEjSoSXPexCR/aPL1qA==", + "requires": { + "@accordproject/concerto-util": "3.9.1" + } + }, "@accordproject/concerto-util": { "version": "3.9.1", "resolved": "https://registry.npmjs.org/@accordproject/concerto-util/-/concerto-util-3.9.1.tgz", @@ -4545,6 +4833,11 @@ "integrity": "sha512-eC4U9MlIcu2q0KQmXszyn5Akca/0jrQmwDRgpAMJai7qBWq4amIQhZyNau4VYGtCeALvW1/NtjzJJ567aZxfKA==", "dev": true }, + "@types/node": { + "version": "20.7.0", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.7.0.tgz", + "integrity": "sha512-zI22/pJW2wUZOVyguFaUL1HABdmSVxpXrzIqkjsHmyUjNhPoWM1CKfvVuXfetHhIok4RY573cqS0mZ1SJEnoTg==" + }, "@ungap/promise-all-settled": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/@ungap/promise-all-settled/-/promise-all-settled-1.1.2.tgz", @@ -4856,6 +5149,11 @@ "resolved": "https://registry.npmjs.org/colors/-/colors-1.4.0.tgz", "integrity": "sha512-a+UqTh4kgZg/SlGvfbzDHpgRu7AAQOmmqRHJnxhRZICKFUT91brVhNNt58CMWU9PsBbv3PDCZUHbVxuDiH2mtA==" }, + "commander": { + "version": "9.5.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-9.5.0.tgz", + "integrity": "sha512-KRs7WVDKg86PWiuAqhDrAQnTXZKraVcCc6vFdL14qrZ/DcWwuRo7VoiYXalXO7S5GKpqYiVEwCbgFDfxNHKJBQ==" + }, "commondir": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz", @@ -4944,6 +5242,11 @@ "esutils": "^2.0.2" } }, + "drange": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/drange/-/drange-1.1.1.tgz", + "integrity": "sha512-pYxfDYpued//QpnLIm4Avk7rsNtAtQkUES2cwAYSvD/wd2pKD71gN2Ebj3e7klzXwjocvE8c5vx/1fxwpqmSxA==" + }, "electron-to-chromium": { "version": "1.4.286", "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.286.tgz", @@ -5815,6 +6118,14 @@ "is-unicode-supported": "^0.1.0" } }, + "lorem-ipsum": { + "version": "2.0.8", + "resolved": "https://registry.npmjs.org/lorem-ipsum/-/lorem-ipsum-2.0.8.tgz", + "integrity": "sha512-5RIwHuCb979RASgCJH0VKERn9cQo/+NcAi2BMe9ddj+gp7hujl6BI+qdOG4nVsLDpwWEJwTVYXNKP6BGgbcoGA==", + "requires": { + "commander": "^9.3.0" + } + }, "loupe": { "version": "2.3.6", "resolved": "https://registry.npmjs.org/loupe/-/loupe-2.3.6.tgz", @@ -6285,6 +6596,11 @@ "error-ex": "^1.2.0" } }, + "path-browserify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-browserify/-/path-browserify-1.0.1.tgz", + "integrity": "sha512-b7uo2UCUOYZcnF/3ID0lulOJi/bafxa1xPe7ZPsammBSpjSWQkjNxlt635YGS2MiR9GjvuXCtz2emr3jbsz98g==" + }, "path-exists": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", @@ -6459,6 +6775,15 @@ "integrity": "sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA==", "dev": true }, + "randexp": { + "version": "0.5.3", + "resolved": "https://registry.npmjs.org/randexp/-/randexp-0.5.3.tgz", + "integrity": "sha512-U+5l2KrcMNOUPYvazA3h5ekF80FHTUG+87SEAmHZmolh1M+i/WyTCxVzmi+tidIa1tM4BSe8g2Y/D3loWDjj+w==", + "requires": { + "drange": "^1.0.2", + "ret": "^0.2.0" + } + }, "randombytes": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", @@ -6519,6 +6844,11 @@ "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", "dev": true }, + "ret": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/ret/-/ret-0.2.2.tgz", + "integrity": "sha512-M0b3YWQs7R3Z917WRQy1HHA7Ba7D8hvZg6UE5mLykJxQVE2ju0IXbGlaHPPlkY+WN7wFP+wUMXmBFA0aV6vYGQ==" + }, "rimraf": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", @@ -6538,7 +6868,6 @@ "version": "7.5.4", "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", - "dev": true, "requires": { "lru-cache": "^6.0.0" }, @@ -6547,7 +6876,6 @@ "version": "6.0.0", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", - "dev": true, "requires": { "yallist": "^4.0.0" } @@ -6555,8 +6883,7 @@ "yallist": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", - "dev": true + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" } } }, @@ -6794,6 +7121,11 @@ "punycode": "^2.1.0" } }, + "urijs": { + "version": "1.19.11", + "resolved": "https://registry.npmjs.org/urijs/-/urijs-1.19.11.tgz", + "integrity": "sha512-HXgFDgDommxn5/bIv0cnQZsPhHDA90NPHD6+c/v21U5+Sx5hoP8+dP9IZXBU1gIfvdRfhG8cel9QNPeionfcCQ==" + }, "uuid": { "version": "8.3.2", "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", diff --git a/package.json b/package.json index 265061c..b471bc4 100644 --- a/package.json +++ b/package.json @@ -53,7 +53,8 @@ "typescript": "4.6.3" }, "dependencies": { - "@accordproject/concerto-util": "3.9.1" + "@accordproject/concerto-util": "3.9.1", + "@types/node": "20.7.0" }, "browserslist": "> 0.25%, not dead", "license-check-and-add-config": { diff --git a/test/cto/car.json b/test/cto/car.json index c5c4a85..84f17be 100644 --- a/test/cto/car.json +++ b/test/cto/car.json @@ -1 +1,185 @@ -{"$class":"concerto.metamodel@1.0.0.Models","models":[{"$class":"concerto.metamodel@1.0.0.Model","decorators":[],"namespace":"org.vehicle","imports":[],"declarations":[{"$class":"concerto.metamodel@1.0.0.ConceptDeclaration","name":"Manufactured","isAbstract":true,"properties":[],"location":{"$class":"concerto.metamodel@1.0.0.Range","start":{"offset":23,"line":3,"column":1,"$class":"concerto.metamodel@1.0.0.Position"},"end":{"offset":56,"line":4,"column":2,"$class":"concerto.metamodel@1.0.0.Position"}}},{"$class":"concerto.metamodel@1.0.0.ConceptDeclaration","name":"Vehicle","isAbstract":true,"properties":[{"$class":"concerto.metamodel@1.0.0.StringProperty","name":"name","isArray":false,"isOptional":false,"location":{"$class":"concerto.metamodel@1.0.0.Range","start":{"offset":108,"line":7,"column":3,"$class":"concerto.metamodel@1.0.0.Position"},"end":{"offset":124,"line":8,"column":3,"$class":"concerto.metamodel@1.0.0.Position"}}},{"$class":"concerto.metamodel@1.0.0.DoubleProperty","name":"range","isArray":false,"isOptional":false,"location":{"$class":"concerto.metamodel@1.0.0.Range","start":{"offset":124,"line":8,"column":3,"$class":"concerto.metamodel@1.0.0.Position"},"end":{"offset":139,"line":9,"column":1,"$class":"concerto.metamodel@1.0.0.Position"}}}],"location":{"$class":"concerto.metamodel@1.0.0.Range","start":{"offset":58,"line":6,"column":1,"$class":"concerto.metamodel@1.0.0.Position"},"end":{"offset":140,"line":9,"column":2,"$class":"concerto.metamodel@1.0.0.Position"}},"superType":{"$class":"concerto.metamodel@1.0.0.TypeIdentifier","name":"Manufactured"}}]},{"$class":"concerto.metamodel@1.0.0.Model","decorators":[],"namespace":"org.car","imports":[{"$class":"concerto.metamodel@1.0.0.ImportAll","namespace":"org.vehicle"}],"declarations":[{"$class":"concerto.metamodel@1.0.0.ConceptDeclaration","name":"Car","isAbstract":false,"properties":[{"$class":"concerto.metamodel@1.0.0.DoubleProperty","name":"mileage","isArray":false,"isOptional":false,"location":{"$class":"concerto.metamodel@1.0.0.Range","start":{"offset":73,"line":6,"column":3,"$class":"concerto.metamodel@1.0.0.Position"},"end":{"offset":90,"line":7,"column":1,"$class":"concerto.metamodel@1.0.0.Position"}}}],"location":{"$class":"concerto.metamodel@1.0.0.Range","start":{"offset":41,"line":5,"column":1,"$class":"concerto.metamodel@1.0.0.Position"},"end":{"offset":91,"line":7,"column":2,"$class":"concerto.metamodel@1.0.0.Position"}},"superType":{"$class":"concerto.metamodel@1.0.0.TypeIdentifier","name":"Vehicle"}}]}]} +{ + "$class": "concerto.metamodel@1.0.0.Models", + "models": [ + { + "$class": "concerto.metamodel@1.0.0.Model", + "decorators": [], + "namespace": "org.vehicle", + "imports": [], + "declarations": [ + { + "$class": "concerto.metamodel@1.0.0.ConceptDeclaration", + "name": "Manufactured", + "isAbstract": true, + "properties": [], + "location": { + "$class": "concerto.metamodel@1.0.0.Range", + "start": { + "offset": 23, + "line": 3, + "column": 1, + "$class": "concerto.metamodel@1.0.0.Position" + }, + "end": { + "offset": 56, + "line": 4, + "column": 2, + "$class": "concerto.metamodel@1.0.0.Position" + } + } + }, + { + "$class": "concerto.metamodel@1.0.0.ConceptDeclaration", + "name": "Vehicle", + "isAbstract": true, + "properties": [ + { + "$class": "concerto.metamodel@1.0.0.StringProperty", + "name": "name", + "isArray": false, + "isOptional": false, + "location": { + "$class": "concerto.metamodel@1.0.0.Range", + "start": { + "offset": 108, + "line": 7, + "column": 3, + "$class": "concerto.metamodel@1.0.0.Position" + }, + "end": { + "offset": 124, + "line": 8, + "column": 3, + "$class": "concerto.metamodel@1.0.0.Position" + } + } + }, + { + "$class": "concerto.metamodel@1.0.0.DoubleProperty", + "name": "range", + "isArray": false, + "isOptional": false, + "location": { + "$class": "concerto.metamodel@1.0.0.Range", + "start": { + "offset": 124, + "line": 8, + "column": 3, + "$class": "concerto.metamodel@1.0.0.Position" + }, + "end": { + "offset": 139, + "line": 9, + "column": 1, + "$class": "concerto.metamodel@1.0.0.Position" + } + } + } + ], + "location": { + "$class": "concerto.metamodel@1.0.0.Range", + "start": { + "offset": 58, + "line": 6, + "column": 1, + "$class": "concerto.metamodel@1.0.0.Position" + }, + "end": { + "offset": 140, + "line": 9, + "column": 2, + "$class": "concerto.metamodel@1.0.0.Position" + } + }, + "superType": { + "$class": "concerto.metamodel@1.0.0.TypeIdentifier", + "name": "Manufactured" + } + } + ] + }, + { + "$class": "concerto.metamodel@1.0.0.Model", + "decorators": [], + "namespace": "org.car", + "imports": [ + { + "$class": "concerto.metamodel@1.0.0.ImportAll", + "namespace": "org.vehicle" + } + ], + "declarations": [ + { + "$class": "concerto.metamodel@1.0.0.DateTimeScalar", + "defaultValue": null, + "name": "DateServiced" + }, + { + "$class": "concerto.metamodel@1.0.0.MapDeclaration", + "name": "ServicedPart", + "key": { + "$class": "concerto.metamodel@1.0.0.ObjectMapKeyType", + "type": { + "$class": "concerto.metamodel@1.0.0.TypeIdentifier", + "name": "DateServiced" + } + }, + "value": { + "$class": "concerto.metamodel@1.0.0.ObjectMapValueType", + "type": { + "$class": "concerto.metamodel@1.0.0.TypeIdentifier", + "name": "Concept" + } + } + }, + { + "$class": "concerto.metamodel@1.0.0.ConceptDeclaration", + "name": "Car", + "isAbstract": false, + "properties": [ + { + "$class": "concerto.metamodel@1.0.0.DoubleProperty", + "name": "mileage", + "isArray": false, + "isOptional": false, + "location": { + "$class": "concerto.metamodel@1.0.0.Range", + "start": { + "offset": 73, + "line": 6, + "column": 3, + "$class": "concerto.metamodel@1.0.0.Position" + }, + "end": { + "offset": 90, + "line": 7, + "column": 1, + "$class": "concerto.metamodel@1.0.0.Position" + } + } + } + ], + "location": { + "$class": "concerto.metamodel@1.0.0.Range", + "start": { + "offset": 41, + "line": 5, + "column": 1, + "$class": "concerto.metamodel@1.0.0.Position" + }, + "end": { + "offset": 91, + "line": 7, + "column": 2, + "$class": "concerto.metamodel@1.0.0.Position" + } + }, + "superType": { + "$class": "concerto.metamodel@1.0.0.TypeIdentifier", + "name": "Vehicle" + } + } + ] + } + ] +} \ No newline at end of file diff --git a/test/cto/carResolved.json b/test/cto/carResolved.json index 6679735..f63458e 100644 --- a/test/cto/carResolved.json +++ b/test/cto/carResolved.json @@ -1 +1,190 @@ -{"$class":"concerto.metamodel@1.0.0.Models","models":[{"$class":"concerto.metamodel@1.0.0.Model","decorators":[],"namespace":"org.vehicle","imports":[],"declarations":[{"$class":"concerto.metamodel@1.0.0.ConceptDeclaration","name":"Manufactured","isAbstract":true,"properties":[],"location":{"$class":"concerto.metamodel@1.0.0.Range","start":{"offset":23,"line":3,"column":1,"$class":"concerto.metamodel@1.0.0.Position"},"end":{"offset":56,"line":4,"column":2,"$class":"concerto.metamodel@1.0.0.Position"}}},{"$class":"concerto.metamodel@1.0.0.ConceptDeclaration","name":"Vehicle","isAbstract":true,"properties":[{"$class":"concerto.metamodel@1.0.0.StringProperty","name":"name","isArray":false,"isOptional":false,"location":{"$class":"concerto.metamodel@1.0.0.Range","start":{"offset":108,"line":7,"column":3,"$class":"concerto.metamodel@1.0.0.Position"},"end":{"offset":124,"line":8,"column":3,"$class":"concerto.metamodel@1.0.0.Position"}}},{"$class":"concerto.metamodel@1.0.0.DoubleProperty","name":"range","isArray":false,"isOptional":false,"location":{"$class":"concerto.metamodel@1.0.0.Range","start":{"offset":124,"line":8,"column":3,"$class":"concerto.metamodel@1.0.0.Position"},"end":{"offset":139,"line":9,"column":1,"$class":"concerto.metamodel@1.0.0.Position"}}}],"location":{"$class":"concerto.metamodel@1.0.0.Range","start":{"offset":58,"line":6,"column":1,"$class":"concerto.metamodel@1.0.0.Position"},"end":{"offset":140,"line":9,"column":2,"$class":"concerto.metamodel@1.0.0.Position"}},"superType":{"$class":"concerto.metamodel@1.0.0.TypeIdentifier","name":"Manufactured","namespace":"org.vehicle"}}]},{"$class":"concerto.metamodel@1.0.0.Model","decorators":[],"namespace":"org.car","imports":[{"$class":"concerto.metamodel@1.0.0.ImportAll","namespace":"org.vehicle"}],"declarations":[{"$class":"concerto.metamodel@1.0.0.ConceptDeclaration","name":"Car","isAbstract":false,"properties":[{"$class":"concerto.metamodel@1.0.0.DoubleProperty","name":"mileage","isArray":false,"isOptional":false,"location":{"$class":"concerto.metamodel@1.0.0.Range","start":{"offset":73,"line":6,"column":3,"$class":"concerto.metamodel@1.0.0.Position"},"end":{"offset":90,"line":7,"column":1,"$class":"concerto.metamodel@1.0.0.Position"}}}],"location":{"$class":"concerto.metamodel@1.0.0.Range","start":{"offset":41,"line":5,"column":1,"$class":"concerto.metamodel@1.0.0.Position"},"end":{"offset":91,"line":7,"column":2,"$class":"concerto.metamodel@1.0.0.Position"}},"superType":{"$class":"concerto.metamodel@1.0.0.TypeIdentifier","name":"Vehicle","namespace":"org.vehicle"}}]}]} +{ + "$class": "concerto.metamodel@1.0.0.Models", + "models": [ + { + "$class": "concerto.metamodel@1.0.0.Model", + "decorators": [], + "namespace": "org.vehicle", + "imports": [], + "declarations": [ + { + "$class": "concerto.metamodel@1.0.0.ConceptDeclaration", + "name": "Manufactured", + "isAbstract": true, + "properties": [], + "location": { + "$class": "concerto.metamodel@1.0.0.Range", + "start": { + "offset": 23, + "line": 3, + "column": 1, + "$class": "concerto.metamodel@1.0.0.Position" + }, + "end": { + "offset": 56, + "line": 4, + "column": 2, + "$class": "concerto.metamodel@1.0.0.Position" + } + } + }, + { + "$class": "concerto.metamodel@1.0.0.ConceptDeclaration", + "name": "Vehicle", + "isAbstract": true, + "properties": [ + { + "$class": "concerto.metamodel@1.0.0.StringProperty", + "name": "name", + "isArray": false, + "isOptional": false, + "location": { + "$class": "concerto.metamodel@1.0.0.Range", + "start": { + "offset": 108, + "line": 7, + "column": 3, + "$class": "concerto.metamodel@1.0.0.Position" + }, + "end": { + "offset": 124, + "line": 8, + "column": 3, + "$class": "concerto.metamodel@1.0.0.Position" + } + } + }, + { + "$class": "concerto.metamodel@1.0.0.DoubleProperty", + "name": "range", + "isArray": false, + "isOptional": false, + "location": { + "$class": "concerto.metamodel@1.0.0.Range", + "start": { + "offset": 124, + "line": 8, + "column": 3, + "$class": "concerto.metamodel@1.0.0.Position" + }, + "end": { + "offset": 139, + "line": 9, + "column": 1, + "$class": "concerto.metamodel@1.0.0.Position" + } + } + } + ], + "location": { + "$class": "concerto.metamodel@1.0.0.Range", + "start": { + "offset": 58, + "line": 6, + "column": 1, + "$class": "concerto.metamodel@1.0.0.Position" + }, + "end": { + "offset": 140, + "line": 9, + "column": 2, + "$class": "concerto.metamodel@1.0.0.Position" + } + }, + "superType": { + "$class": "concerto.metamodel@1.0.0.TypeIdentifier", + "name": "Manufactured", + "namespace": "org.vehicle" + } + } + ] + }, + { + "$class": "concerto.metamodel@1.0.0.Model", + "decorators": [], + "namespace": "org.car", + "imports": [ + { + "$class": "concerto.metamodel@1.0.0.ImportAll", + "namespace": "org.vehicle" + } + ], + "declarations": [ + { + "$class": "concerto.metamodel@1.0.0.DateTimeScalar", + "defaultValue": null, + "name": "DateServiced", + "namespace": "org.car" + }, + { + "$class": "concerto.metamodel@1.0.0.MapDeclaration", + "name": "ServicedPart", + "key": { + "$class": "concerto.metamodel@1.0.0.ObjectMapKeyType", + "type": { + "$class": "concerto.metamodel@1.0.0.TypeIdentifier", + "name": "DateServiced", + "namespace": "org.car" + } + }, + "value": { + "$class": "concerto.metamodel@1.0.0.ObjectMapValueType", + "type": { + "$class": "concerto.metamodel@1.0.0.TypeIdentifier", + "name": "Concept", + "namespace": "concerto@1.0.0" + } + } + }, + { + "$class": "concerto.metamodel@1.0.0.ConceptDeclaration", + "name": "Car", + "isAbstract": false, + "properties": [ + { + "$class": "concerto.metamodel@1.0.0.DoubleProperty", + "name": "mileage", + "isArray": false, + "isOptional": false, + "location": { + "$class": "concerto.metamodel@1.0.0.Range", + "start": { + "offset": 73, + "line": 6, + "column": 3, + "$class": "concerto.metamodel@1.0.0.Position" + }, + "end": { + "offset": 90, + "line": 7, + "column": 1, + "$class": "concerto.metamodel@1.0.0.Position" + } + } + } + ], + "location": { + "$class": "concerto.metamodel@1.0.0.Range", + "start": { + "offset": 41, + "line": 5, + "column": 1, + "$class": "concerto.metamodel@1.0.0.Position" + }, + "end": { + "offset": 91, + "line": 7, + "column": 2, + "$class": "concerto.metamodel@1.0.0.Position" + } + }, + "superType": { + "$class": "concerto.metamodel@1.0.0.TypeIdentifier", + "name": "Vehicle", + "namespace": "org.vehicle" + } + } + ] + } + ] +} \ No newline at end of file diff --git a/test/cto/mapImportsResolved.json b/test/cto/mapImportsResolved.json new file mode 100644 index 0000000..4d3d024 --- /dev/null +++ b/test/cto/mapImportsResolved.json @@ -0,0 +1,575 @@ +{ + "$class": "concerto.metamodel@1.0.0.Models", + "models": [ + { + "$class": "concerto.metamodel@1.0.0.Model", + "decorators": [], + "namespace": "com.testing.base@1.0.0", + "imports": [], + "declarations": [ + { + "$class": "concerto.metamodel@1.0.0.StringScalar", + "name": "Foo", + "location": { + "$class": "concerto.metamodel@1.0.0.Range", + "start": { + "offset": 592, + "line": 16, + "column": 1, + "$class": "concerto.metamodel@1.0.0.Position" + }, + "end": { + "offset": 618, + "line": 17, + "column": 1, + "$class": "concerto.metamodel@1.0.0.Position" + } + }, + "namespace": "com.testing.base@1.0.0" + }, + { + "$class": "concerto.metamodel@1.0.0.BooleanScalar", + "name": "Bar", + "location": { + "$class": "concerto.metamodel@1.0.0.Range", + "start": { + "offset": 618, + "line": 17, + "column": 1, + "$class": "concerto.metamodel@1.0.0.Position" + }, + "end": { + "offset": 645, + "line": 18, + "column": 1, + "$class": "concerto.metamodel@1.0.0.Position" + } + }, + "namespace": "com.testing.base@1.0.0" + }, + { + "$class": "concerto.metamodel@1.0.0.DateTimeScalar", + "defaultValue": null, + "name": "Baz", + "location": { + "$class": "concerto.metamodel@1.0.0.Range", + "start": { + "offset": 645, + "line": 18, + "column": 1, + "$class": "concerto.metamodel@1.0.0.Position" + }, + "end": { + "offset": 673, + "line": 19, + "column": 1, + "$class": "concerto.metamodel@1.0.0.Position" + } + }, + "namespace": "com.testing.base@1.0.0" + }, + { + "$class": "concerto.metamodel@1.0.0.LongScalar", + "name": "Bazola", + "location": { + "$class": "concerto.metamodel@1.0.0.Range", + "start": { + "offset": 673, + "line": 19, + "column": 1, + "$class": "concerto.metamodel@1.0.0.Position" + }, + "end": { + "offset": 700, + "line": 20, + "column": 1, + "$class": "concerto.metamodel@1.0.0.Position" + } + }, + "namespace": "com.testing.base@1.0.0" + }, + { + "$class": "concerto.metamodel@1.0.0.DoubleScalar", + "name": "Bongo", + "location": { + "$class": "concerto.metamodel@1.0.0.Range", + "start": { + "offset": 700, + "line": 20, + "column": 1, + "$class": "concerto.metamodel@1.0.0.Position" + }, + "end": { + "offset": 728, + "line": 21, + "column": 1, + "$class": "concerto.metamodel@1.0.0.Position" + } + }, + "namespace": "com.testing.base@1.0.0" + }, + { + "$class": "concerto.metamodel@1.0.0.IntegerScalar", + "name": "Qux", + "location": { + "$class": "concerto.metamodel@1.0.0.Range", + "start": { + "offset": 728, + "line": 21, + "column": 1, + "$class": "concerto.metamodel@1.0.0.Position" + }, + "end": { + "offset": 754, + "line": 21, + "column": 27, + "$class": "concerto.metamodel@1.0.0.Position" + } + }, + "namespace": "com.testing.base@1.0.0" + } + ] + }, + { + "$class": "concerto.metamodel@1.0.0.Model", + "decorators": [], + "namespace": "com.testing@1.0.0", + "imports": [ + { + "$class": "concerto.metamodel@1.0.0.ImportTypes", + "namespace": "com.testing.base@1.0.0", + "types": [ + "Foo", + "Bar", + "Baz", + "Bazola", + "Bongo", + "Qux" + ] + } + ], + "declarations": [ + { + "$class": "concerto.metamodel@1.0.0.MapDeclaration", + "name": "MapPermutation1", + "key": { + "$class": "concerto.metamodel@1.0.0.StringMapKeyType", + "location": { + "$class": "concerto.metamodel@1.0.0.Range", + "start": { + "offset": 678, + "line": 19, + "column": 3, + "$class": "concerto.metamodel@1.0.0.Position" + }, + "end": { + "offset": 689, + "line": 20, + "column": 3, + "$class": "concerto.metamodel@1.0.0.Position" + } + } + }, + "value": { + "$class": "concerto.metamodel@1.0.0.ObjectMapValueType", + "type": { + "$class": "concerto.metamodel@1.0.0.TypeIdentifier", + "name": "Foo", + "namespace": "com.testing.base@1.0.0" + }, + "location": { + "$class": "concerto.metamodel@1.0.0.Range", + "start": { + "offset": 689, + "line": 20, + "column": 3, + "$class": "concerto.metamodel@1.0.0.Position" + }, + "end": { + "offset": 695, + "line": 21, + "column": 1, + "$class": "concerto.metamodel@1.0.0.Position" + } + } + }, + "location": { + "$class": "concerto.metamodel@1.0.0.Range", + "start": { + "offset": 654, + "line": 18, + "column": 1, + "$class": "concerto.metamodel@1.0.0.Position" + }, + "end": { + "offset": 696, + "line": 21, + "column": 2, + "$class": "concerto.metamodel@1.0.0.Position" + } + } + }, + { + "$class": "concerto.metamodel@1.0.0.MapDeclaration", + "name": "MapPermutation2", + "key": { + "$class": "concerto.metamodel@1.0.0.StringMapKeyType", + "location": { + "$class": "concerto.metamodel@1.0.0.Range", + "start": { + "offset": 722, + "line": 24, + "column": 3, + "$class": "concerto.metamodel@1.0.0.Position" + }, + "end": { + "offset": 733, + "line": 25, + "column": 3, + "$class": "concerto.metamodel@1.0.0.Position" + } + } + }, + "value": { + "$class": "concerto.metamodel@1.0.0.ObjectMapValueType", + "type": { + "$class": "concerto.metamodel@1.0.0.TypeIdentifier", + "name": "Bar", + "namespace": "com.testing.base@1.0.0" + }, + "location": { + "$class": "concerto.metamodel@1.0.0.Range", + "start": { + "offset": 733, + "line": 25, + "column": 3, + "$class": "concerto.metamodel@1.0.0.Position" + }, + "end": { + "offset": 739, + "line": 26, + "column": 1, + "$class": "concerto.metamodel@1.0.0.Position" + } + } + }, + "location": { + "$class": "concerto.metamodel@1.0.0.Range", + "start": { + "offset": 698, + "line": 23, + "column": 1, + "$class": "concerto.metamodel@1.0.0.Position" + }, + "end": { + "offset": 740, + "line": 26, + "column": 2, + "$class": "concerto.metamodel@1.0.0.Position" + } + } + }, + { + "$class": "concerto.metamodel@1.0.0.MapDeclaration", + "name": "MapPermutation3", + "key": { + "$class": "concerto.metamodel@1.0.0.StringMapKeyType", + "location": { + "$class": "concerto.metamodel@1.0.0.Range", + "start": { + "offset": 766, + "line": 29, + "column": 3, + "$class": "concerto.metamodel@1.0.0.Position" + }, + "end": { + "offset": 777, + "line": 30, + "column": 3, + "$class": "concerto.metamodel@1.0.0.Position" + } + } + }, + "value": { + "$class": "concerto.metamodel@1.0.0.ObjectMapValueType", + "type": { + "$class": "concerto.metamodel@1.0.0.TypeIdentifier", + "name": "Baz", + "namespace": "com.testing.base@1.0.0" + }, + "location": { + "$class": "concerto.metamodel@1.0.0.Range", + "start": { + "offset": 777, + "line": 30, + "column": 3, + "$class": "concerto.metamodel@1.0.0.Position" + }, + "end": { + "offset": 783, + "line": 31, + "column": 1, + "$class": "concerto.metamodel@1.0.0.Position" + } + } + }, + "location": { + "$class": "concerto.metamodel@1.0.0.Range", + "start": { + "offset": 742, + "line": 28, + "column": 1, + "$class": "concerto.metamodel@1.0.0.Position" + }, + "end": { + "offset": 784, + "line": 31, + "column": 2, + "$class": "concerto.metamodel@1.0.0.Position" + } + } + }, + { + "$class": "concerto.metamodel@1.0.0.MapDeclaration", + "name": "MapPermutation4", + "key": { + "$class": "concerto.metamodel@1.0.0.StringMapKeyType", + "location": { + "$class": "concerto.metamodel@1.0.0.Range", + "start": { + "offset": 810, + "line": 34, + "column": 3, + "$class": "concerto.metamodel@1.0.0.Position" + }, + "end": { + "offset": 821, + "line": 35, + "column": 3, + "$class": "concerto.metamodel@1.0.0.Position" + } + } + }, + "value": { + "$class": "concerto.metamodel@1.0.0.ObjectMapValueType", + "type": { + "$class": "concerto.metamodel@1.0.0.TypeIdentifier", + "name": "Bazola", + "namespace": "com.testing.base@1.0.0" + }, + "location": { + "$class": "concerto.metamodel@1.0.0.Range", + "start": { + "offset": 821, + "line": 35, + "column": 3, + "$class": "concerto.metamodel@1.0.0.Position" + }, + "end": { + "offset": 830, + "line": 36, + "column": 1, + "$class": "concerto.metamodel@1.0.0.Position" + } + } + }, + "location": { + "$class": "concerto.metamodel@1.0.0.Range", + "start": { + "offset": 786, + "line": 33, + "column": 1, + "$class": "concerto.metamodel@1.0.0.Position" + }, + "end": { + "offset": 831, + "line": 36, + "column": 2, + "$class": "concerto.metamodel@1.0.0.Position" + } + } + }, + { + "$class": "concerto.metamodel@1.0.0.MapDeclaration", + "name": "MapPermutation5", + "key": { + "$class": "concerto.metamodel@1.0.0.StringMapKeyType", + "location": { + "$class": "concerto.metamodel@1.0.0.Range", + "start": { + "offset": 857, + "line": 39, + "column": 3, + "$class": "concerto.metamodel@1.0.0.Position" + }, + "end": { + "offset": 868, + "line": 40, + "column": 3, + "$class": "concerto.metamodel@1.0.0.Position" + } + } + }, + "value": { + "$class": "concerto.metamodel@1.0.0.ObjectMapValueType", + "type": { + "$class": "concerto.metamodel@1.0.0.TypeIdentifier", + "name": "Bongo", + "namespace": "com.testing.base@1.0.0" + }, + "location": { + "$class": "concerto.metamodel@1.0.0.Range", + "start": { + "offset": 868, + "line": 40, + "column": 3, + "$class": "concerto.metamodel@1.0.0.Position" + }, + "end": { + "offset": 876, + "line": 41, + "column": 1, + "$class": "concerto.metamodel@1.0.0.Position" + } + } + }, + "location": { + "$class": "concerto.metamodel@1.0.0.Range", + "start": { + "offset": 833, + "line": 38, + "column": 1, + "$class": "concerto.metamodel@1.0.0.Position" + }, + "end": { + "offset": 877, + "line": 41, + "column": 2, + "$class": "concerto.metamodel@1.0.0.Position" + } + } + }, + { + "$class": "concerto.metamodel@1.0.0.MapDeclaration", + "name": "MapPermutation6", + "key": { + "$class": "concerto.metamodel@1.0.0.StringMapKeyType", + "location": { + "$class": "concerto.metamodel@1.0.0.Range", + "start": { + "offset": 903, + "line": 44, + "column": 3, + "$class": "concerto.metamodel@1.0.0.Position" + }, + "end": { + "offset": 914, + "line": 45, + "column": 3, + "$class": "concerto.metamodel@1.0.0.Position" + } + } + }, + "value": { + "$class": "concerto.metamodel@1.0.0.ObjectMapValueType", + "type": { + "$class": "concerto.metamodel@1.0.0.TypeIdentifier", + "name": "Qux", + "namespace": "com.testing.base@1.0.0" + }, + "location": { + "$class": "concerto.metamodel@1.0.0.Range", + "start": { + "offset": 914, + "line": 45, + "column": 3, + "$class": "concerto.metamodel@1.0.0.Position" + }, + "end": { + "offset": 920, + "line": 46, + "column": 1, + "$class": "concerto.metamodel@1.0.0.Position" + } + } + }, + "location": { + "$class": "concerto.metamodel@1.0.0.Range", + "start": { + "offset": 879, + "line": 43, + "column": 1, + "$class": "concerto.metamodel@1.0.0.Position" + }, + "end": { + "offset": 921, + "line": 46, + "column": 2, + "$class": "concerto.metamodel@1.0.0.Position" + } + } + }, + { + "$class": "concerto.metamodel@1.0.0.MapDeclaration", + "name": "MapPermutation7", + "key": { + "$class": "concerto.metamodel@1.0.0.ObjectMapKeyType", + "type": { + "$class": "concerto.metamodel@1.0.0.TypeIdentifier", + "name": "Qux", + "namespace": "com.testing.base@1.0.0" + }, + "location": { + "$class": "concerto.metamodel@1.0.0.Range", + "start": { + "offset": 947, + "line": 49, + "column": 3, + "$class": "concerto.metamodel@1.0.0.Position" + }, + "end": { + "offset": 955, + "line": 50, + "column": 3, + "$class": "concerto.metamodel@1.0.0.Position" + } + } + }, + "value": { + "$class": "concerto.metamodel@1.0.0.StringMapValueType", + "location": { + "$class": "concerto.metamodel@1.0.0.Range", + "start": { + "offset": 955, + "line": 50, + "column": 3, + "$class": "concerto.metamodel@1.0.0.Position" + }, + "end": { + "offset": 964, + "line": 51, + "column": 1, + "$class": "concerto.metamodel@1.0.0.Position" + } + } + }, + "location": { + "$class": "concerto.metamodel@1.0.0.Range", + "start": { + "offset": 923, + "line": 48, + "column": 1, + "$class": "concerto.metamodel@1.0.0.Position" + }, + "end": { + "offset": 965, + "line": 51, + "column": 2, + "$class": "concerto.metamodel@1.0.0.Position" + } + } + } + ] + } + ] +} \ No newline at end of file diff --git a/test/cto/mapsImported.json b/test/cto/mapsImported.json new file mode 100644 index 0000000..340295f --- /dev/null +++ b/test/cto/mapsImported.json @@ -0,0 +1,562 @@ +{ + "$class": "concerto.metamodel@1.0.0.Models", + "models": [ + { + "$class": "concerto.metamodel@1.0.0.Model", + "decorators": [], + "namespace": "com.testing.base@1.0.0", + "imports": [], + "declarations": [ + { + "$class": "concerto.metamodel@1.0.0.StringScalar", + "name": "Foo", + "location": { + "$class": "concerto.metamodel@1.0.0.Range", + "start": { + "offset": 592, + "line": 16, + "column": 1, + "$class": "concerto.metamodel@1.0.0.Position" + }, + "end": { + "offset": 618, + "line": 17, + "column": 1, + "$class": "concerto.metamodel@1.0.0.Position" + } + } + }, + { + "$class": "concerto.metamodel@1.0.0.BooleanScalar", + "name": "Bar", + "location": { + "$class": "concerto.metamodel@1.0.0.Range", + "start": { + "offset": 618, + "line": 17, + "column": 1, + "$class": "concerto.metamodel@1.0.0.Position" + }, + "end": { + "offset": 645, + "line": 18, + "column": 1, + "$class": "concerto.metamodel@1.0.0.Position" + } + } + }, + { + "$class": "concerto.metamodel@1.0.0.DateTimeScalar", + "defaultValue": null, + "name": "Baz", + "location": { + "$class": "concerto.metamodel@1.0.0.Range", + "start": { + "offset": 645, + "line": 18, + "column": 1, + "$class": "concerto.metamodel@1.0.0.Position" + }, + "end": { + "offset": 673, + "line": 19, + "column": 1, + "$class": "concerto.metamodel@1.0.0.Position" + } + } + }, + { + "$class": "concerto.metamodel@1.0.0.LongScalar", + "name": "Bazola", + "location": { + "$class": "concerto.metamodel@1.0.0.Range", + "start": { + "offset": 673, + "line": 19, + "column": 1, + "$class": "concerto.metamodel@1.0.0.Position" + }, + "end": { + "offset": 700, + "line": 20, + "column": 1, + "$class": "concerto.metamodel@1.0.0.Position" + } + } + }, + { + "$class": "concerto.metamodel@1.0.0.DoubleScalar", + "name": "Bongo", + "location": { + "$class": "concerto.metamodel@1.0.0.Range", + "start": { + "offset": 700, + "line": 20, + "column": 1, + "$class": "concerto.metamodel@1.0.0.Position" + }, + "end": { + "offset": 728, + "line": 21, + "column": 1, + "$class": "concerto.metamodel@1.0.0.Position" + } + } + }, + { + "$class": "concerto.metamodel@1.0.0.IntegerScalar", + "name": "Qux", + "location": { + "$class": "concerto.metamodel@1.0.0.Range", + "start": { + "offset": 728, + "line": 21, + "column": 1, + "$class": "concerto.metamodel@1.0.0.Position" + }, + "end": { + "offset": 754, + "line": 21, + "column": 27, + "$class": "concerto.metamodel@1.0.0.Position" + } + } + } + ] + }, + { + "$class": "concerto.metamodel@1.0.0.Model", + "decorators": [], + "namespace": "com.testing@1.0.0", + "imports": [ + { + "$class": "concerto.metamodel@1.0.0.ImportTypes", + "namespace": "com.testing.base@1.0.0", + "types": [ + "Foo", + "Bar", + "Baz", + "Bazola", + "Bongo", + "Qux" + ] + } + ], + "declarations": [ + { + "$class": "concerto.metamodel@1.0.0.MapDeclaration", + "name": "MapPermutation1", + "key": { + "$class": "concerto.metamodel@1.0.0.StringMapKeyType", + "location": { + "$class": "concerto.metamodel@1.0.0.Range", + "start": { + "offset": 678, + "line": 19, + "column": 3, + "$class": "concerto.metamodel@1.0.0.Position" + }, + "end": { + "offset": 689, + "line": 20, + "column": 3, + "$class": "concerto.metamodel@1.0.0.Position" + } + } + }, + "value": { + "$class": "concerto.metamodel@1.0.0.ObjectMapValueType", + "type": { + "$class": "concerto.metamodel@1.0.0.TypeIdentifier", + "name": "Foo" + }, + "location": { + "$class": "concerto.metamodel@1.0.0.Range", + "start": { + "offset": 689, + "line": 20, + "column": 3, + "$class": "concerto.metamodel@1.0.0.Position" + }, + "end": { + "offset": 695, + "line": 21, + "column": 1, + "$class": "concerto.metamodel@1.0.0.Position" + } + } + }, + "location": { + "$class": "concerto.metamodel@1.0.0.Range", + "start": { + "offset": 654, + "line": 18, + "column": 1, + "$class": "concerto.metamodel@1.0.0.Position" + }, + "end": { + "offset": 696, + "line": 21, + "column": 2, + "$class": "concerto.metamodel@1.0.0.Position" + } + } + }, + { + "$class": "concerto.metamodel@1.0.0.MapDeclaration", + "name": "MapPermutation2", + "key": { + "$class": "concerto.metamodel@1.0.0.StringMapKeyType", + "location": { + "$class": "concerto.metamodel@1.0.0.Range", + "start": { + "offset": 722, + "line": 24, + "column": 3, + "$class": "concerto.metamodel@1.0.0.Position" + }, + "end": { + "offset": 733, + "line": 25, + "column": 3, + "$class": "concerto.metamodel@1.0.0.Position" + } + } + }, + "value": { + "$class": "concerto.metamodel@1.0.0.ObjectMapValueType", + "type": { + "$class": "concerto.metamodel@1.0.0.TypeIdentifier", + "name": "Bar" + }, + "location": { + "$class": "concerto.metamodel@1.0.0.Range", + "start": { + "offset": 733, + "line": 25, + "column": 3, + "$class": "concerto.metamodel@1.0.0.Position" + }, + "end": { + "offset": 739, + "line": 26, + "column": 1, + "$class": "concerto.metamodel@1.0.0.Position" + } + } + }, + "location": { + "$class": "concerto.metamodel@1.0.0.Range", + "start": { + "offset": 698, + "line": 23, + "column": 1, + "$class": "concerto.metamodel@1.0.0.Position" + }, + "end": { + "offset": 740, + "line": 26, + "column": 2, + "$class": "concerto.metamodel@1.0.0.Position" + } + } + }, + { + "$class": "concerto.metamodel@1.0.0.MapDeclaration", + "name": "MapPermutation3", + "key": { + "$class": "concerto.metamodel@1.0.0.StringMapKeyType", + "location": { + "$class": "concerto.metamodel@1.0.0.Range", + "start": { + "offset": 766, + "line": 29, + "column": 3, + "$class": "concerto.metamodel@1.0.0.Position" + }, + "end": { + "offset": 777, + "line": 30, + "column": 3, + "$class": "concerto.metamodel@1.0.0.Position" + } + } + }, + "value": { + "$class": "concerto.metamodel@1.0.0.ObjectMapValueType", + "type": { + "$class": "concerto.metamodel@1.0.0.TypeIdentifier", + "name": "Baz" + }, + "location": { + "$class": "concerto.metamodel@1.0.0.Range", + "start": { + "offset": 777, + "line": 30, + "column": 3, + "$class": "concerto.metamodel@1.0.0.Position" + }, + "end": { + "offset": 783, + "line": 31, + "column": 1, + "$class": "concerto.metamodel@1.0.0.Position" + } + } + }, + "location": { + "$class": "concerto.metamodel@1.0.0.Range", + "start": { + "offset": 742, + "line": 28, + "column": 1, + "$class": "concerto.metamodel@1.0.0.Position" + }, + "end": { + "offset": 784, + "line": 31, + "column": 2, + "$class": "concerto.metamodel@1.0.0.Position" + } + } + }, + { + "$class": "concerto.metamodel@1.0.0.MapDeclaration", + "name": "MapPermutation4", + "key": { + "$class": "concerto.metamodel@1.0.0.StringMapKeyType", + "location": { + "$class": "concerto.metamodel@1.0.0.Range", + "start": { + "offset": 810, + "line": 34, + "column": 3, + "$class": "concerto.metamodel@1.0.0.Position" + }, + "end": { + "offset": 821, + "line": 35, + "column": 3, + "$class": "concerto.metamodel@1.0.0.Position" + } + } + }, + "value": { + "$class": "concerto.metamodel@1.0.0.ObjectMapValueType", + "type": { + "$class": "concerto.metamodel@1.0.0.TypeIdentifier", + "name": "Bazola" + }, + "location": { + "$class": "concerto.metamodel@1.0.0.Range", + "start": { + "offset": 821, + "line": 35, + "column": 3, + "$class": "concerto.metamodel@1.0.0.Position" + }, + "end": { + "offset": 830, + "line": 36, + "column": 1, + "$class": "concerto.metamodel@1.0.0.Position" + } + } + }, + "location": { + "$class": "concerto.metamodel@1.0.0.Range", + "start": { + "offset": 786, + "line": 33, + "column": 1, + "$class": "concerto.metamodel@1.0.0.Position" + }, + "end": { + "offset": 831, + "line": 36, + "column": 2, + "$class": "concerto.metamodel@1.0.0.Position" + } + } + }, + { + "$class": "concerto.metamodel@1.0.0.MapDeclaration", + "name": "MapPermutation5", + "key": { + "$class": "concerto.metamodel@1.0.0.StringMapKeyType", + "location": { + "$class": "concerto.metamodel@1.0.0.Range", + "start": { + "offset": 857, + "line": 39, + "column": 3, + "$class": "concerto.metamodel@1.0.0.Position" + }, + "end": { + "offset": 868, + "line": 40, + "column": 3, + "$class": "concerto.metamodel@1.0.0.Position" + } + } + }, + "value": { + "$class": "concerto.metamodel@1.0.0.ObjectMapValueType", + "type": { + "$class": "concerto.metamodel@1.0.0.TypeIdentifier", + "name": "Bongo" + }, + "location": { + "$class": "concerto.metamodel@1.0.0.Range", + "start": { + "offset": 868, + "line": 40, + "column": 3, + "$class": "concerto.metamodel@1.0.0.Position" + }, + "end": { + "offset": 876, + "line": 41, + "column": 1, + "$class": "concerto.metamodel@1.0.0.Position" + } + } + }, + "location": { + "$class": "concerto.metamodel@1.0.0.Range", + "start": { + "offset": 833, + "line": 38, + "column": 1, + "$class": "concerto.metamodel@1.0.0.Position" + }, + "end": { + "offset": 877, + "line": 41, + "column": 2, + "$class": "concerto.metamodel@1.0.0.Position" + } + } + }, + { + "$class": "concerto.metamodel@1.0.0.MapDeclaration", + "name": "MapPermutation6", + "key": { + "$class": "concerto.metamodel@1.0.0.StringMapKeyType", + "location": { + "$class": "concerto.metamodel@1.0.0.Range", + "start": { + "offset": 903, + "line": 44, + "column": 3, + "$class": "concerto.metamodel@1.0.0.Position" + }, + "end": { + "offset": 914, + "line": 45, + "column": 3, + "$class": "concerto.metamodel@1.0.0.Position" + } + } + }, + "value": { + "$class": "concerto.metamodel@1.0.0.ObjectMapValueType", + "type": { + "$class": "concerto.metamodel@1.0.0.TypeIdentifier", + "name": "Qux" + }, + "location": { + "$class": "concerto.metamodel@1.0.0.Range", + "start": { + "offset": 914, + "line": 45, + "column": 3, + "$class": "concerto.metamodel@1.0.0.Position" + }, + "end": { + "offset": 920, + "line": 46, + "column": 1, + "$class": "concerto.metamodel@1.0.0.Position" + } + } + }, + "location": { + "$class": "concerto.metamodel@1.0.0.Range", + "start": { + "offset": 879, + "line": 43, + "column": 1, + "$class": "concerto.metamodel@1.0.0.Position" + }, + "end": { + "offset": 921, + "line": 46, + "column": 2, + "$class": "concerto.metamodel@1.0.0.Position" + } + } + }, + { + "$class": "concerto.metamodel@1.0.0.MapDeclaration", + "name": "MapPermutation7", + "key": { + "$class": "concerto.metamodel@1.0.0.ObjectMapKeyType", + "type": { + "$class": "concerto.metamodel@1.0.0.TypeIdentifier", + "name": "Qux" + }, + "location": { + "$class": "concerto.metamodel@1.0.0.Range", + "start": { + "offset": 947, + "line": 49, + "column": 3, + "$class": "concerto.metamodel@1.0.0.Position" + }, + "end": { + "offset": 955, + "line": 50, + "column": 3, + "$class": "concerto.metamodel@1.0.0.Position" + } + } + }, + "value": { + "$class": "concerto.metamodel@1.0.0.StringMapValueType", + "location": { + "$class": "concerto.metamodel@1.0.0.Range", + "start": { + "offset": 955, + "line": 50, + "column": 3, + "$class": "concerto.metamodel@1.0.0.Position" + }, + "end": { + "offset": 964, + "line": 51, + "column": 1, + "$class": "concerto.metamodel@1.0.0.Position" + } + } + }, + "location": { + "$class": "concerto.metamodel@1.0.0.Range", + "start": { + "offset": 923, + "line": 48, + "column": 1, + "$class": "concerto.metamodel@1.0.0.Position" + }, + "end": { + "offset": 965, + "line": 51, + "column": 2, + "$class": "concerto.metamodel@1.0.0.Position" + } + } + } + ] + } + ] +} \ No newline at end of file diff --git a/test/metamodelutil.js b/test/metamodelutil.js index 3125bc4..98e7b07 100644 --- a/test/metamodelutil.js +++ b/test/metamodelutil.js @@ -100,6 +100,22 @@ describe('MetaModel (Car)', () => { }); }); +describe('MetaModel (with Maps & Scalars)', () => { + process.env.ENABLE_MAP_TYPE = 'true'; // TODO Remove on release of MapType + const modelPath = path.resolve(__dirname, './cto/mapsImported.json'); + let modelFile = JSON.parse(fs.readFileSync(modelPath, 'utf8')); + + // The ModelFile resolved + const mapImportsResolved = JSON.parse(fs.readFileSync(path.resolve(__dirname, './cto/mapImportsResolved.json'), 'utf8')); + + describe('#toMetaModel', () => { + it('should resolve all namespaces on a Model containing Map Types, where the Map Types are imported', async () => { + const mm1r = MetaModelUtil.resolveLocalNamesForAll(modelFile); + mm1r.should.deep.equal(mapImportsResolved); + }); + }); +}); + describe('MetaModel (Car - with import types)', () => { const carModelPath = path.resolve(__dirname, './cto/carImportTypes.json'); const carModel = JSON.parse(fs.readFileSync(carModelPath, 'utf8'));