From 248a663eff0e4fb28ac9df4dcee9880cd953c6e7 Mon Sep 17 00:00:00 2001 From: Jonathan-Casey <109082377+Jonathan-Casey@users.noreply.github.com> Date: Mon, 22 May 2023 10:52:52 +0100 Subject: [PATCH] feat(map): Add Introspection for Map Type (#646) * feat(map): add Type classes Signed-off-by: jonathan.casey * feat(map): add test coverage Signed-off-by: jonathan.casey * feat(map): update ModelFile with MapDeclaration Signed-off-by: jonathan.casey * feat(map): update BaseModelManager - add getMapDeclarations() Signed-off-by: jonathan.casey * feat(map): add type definitions Signed-off-by: jonathan.casey * chore(changelog): updates change log Signed-off-by: jonathan.casey * test(map): add more test cov for introspection Signed-off-by: jonathan.casey * test(map): add test cov for modelmanager Signed-off-by: jonathan.casey * chore(build): update package-lock Signed-off-by: jonathan.casey * feat(map): use descriptive names for key, value, property Signed-off-by: jonathan.casey * feat(map): extend from declaration Signed-off-by: jonathan.casey * feat(map): remove fqn reference from MapKey and MapValue Signed-off-by: jonathan.casey * feat(map): cleanup nested if Signed-off-by: jonathan.casey * feat(map): add isMapDeclaration method Signed-off-by: jonathan.casey * feat(map): cleanup Signed-off-by: jonathan.casey * feat(map): remove unused test file Signed-off-by: jonathan.casey * feat(map): add feature flag Signed-off-by: jonathan.casey * feat(map): MapKey & MapValue extend decorated Signed-off-by: jonathan.casey * feat(map): remove this.name references from MapKey & MapValue Signed-off-by: jonathan.casey * feat(map): support Asset, Participant, Transaction for MapValue Signed-off-by: jonathan.casey * feat(map): add more test coverage Signed-off-by: jonathan.casey * feat(map): add test case for derived concept as MapValue Signed-off-by: jonathan.casey * feat(map): add getFQN method to MapDeclaration Signed-off-by: jonathan.casey * feat(map): update type definitions Signed-off-by: jonathan.casey * feat(map): update changelog.txt, api.txt Signed-off-by: jonathan.casey * feat(map): add test cov for feature flag Signed-off-by: jonathan.casey * feat(map): enable flag during test run Signed-off-by: jonathan.casey * feat(map): update test coverage, fix toString Signed-off-by: jonathan.casey * feat(map): update type definitions Signed-off-by: jonathan.casey * feat(map): update changelog.txt, api.txt Signed-off-by: jonathan.casey * feat(map): bump test coverage Signed-off-by: jonathan.casey * feat(map): add getParent to api for MapKey and MapValue Signed-off-by: jonathan.casey * feat(map): improve comment, fix typo Signed-off-by: jonathan.casey * feat(map): update type definitions Signed-off-by: jonathan.casey * feat(map): update changelog.txt, api.txt Signed-off-by: jonathan.casey * feat(map): remove hardcode metamodel version Signed-off-by: jonathan.casey * feat(map): fix comments Signed-off-by: jonathan.casey * feat(map): type assignment moved to constructor Signed-off-by: jonathan.casey * feat(map): add explicit validation for MapValue Signed-off-by: jonathan.casey * feat(map): update changelog.txt, api.txt Signed-off-by: jonathan.casey * feat(map): remove boolean as a valid MapKey Signed-off-by: jonathan.casey * feat(map): bump test cov Signed-off-by: jonathan.casey * feat(map): add test case bad value type Signed-off-by: jonathan.casey --------- Signed-off-by: jonathan.casey --- package-lock.json | 336 ++++++------ packages/concerto-core/api.txt | 32 ++ packages/concerto-core/changelog.txt | 3 + .../concerto-core/lib/basemodelmanager.js | 10 + .../lib/introspect/classdeclaration.js | 9 + .../lib/introspect/mapdeclaration.js | 185 +++++++ .../lib/introspect/mapkeytype.js | 133 +++++ .../lib/introspect/mapvaluetype.js | 125 +++++ .../concerto-core/lib/introspect/modelfile.js | 12 + .../test/data/model/model-base.cto | 5 + ...declaration.badkey.declaration.concept.cto | 21 + ...mapdeclaration.badkey.declaration.enum.cto | 19 + ...apdeclaration.badkey.declaration.event.cto | 21 + .../mapdeclaration.badkey.declaration.map.cto | 24 + ...mapdeclaration.badkey.primitive.double.cto | 19 + ...apdeclaration.badkey.primitive.integer.cto | 19 + .../mapdeclaration.badkey.primitive.long.cto | 19 + .../mapdeclaration.badkey.scalar.boolean.cto | 22 + .../mapdeclaration.badkey.scalar.double.cto | 21 + .../mapdeclaration.badkey.scalar.integer.cto | 21 + .../mapdeclaration.badkey.scalar.long.cto | 21 + .../mapdeclaration.badvalue.nontype.cto | 24 + ...eclaration.goodkey.declaration.concept.cto | 22 + ...apdeclaration.goodkey.declaration.enum.cto | 24 + ...pdeclaration.goodkey.primitive.boolean.cto | 20 + ...declaration.goodkey.primitive.datetime.cto | 20 + ...apdeclaration.goodkey.primitive.string.cto | 20 + ...mapdeclaration.goodkey.scalar.datetime.cto | 22 + .../mapdeclaration.goodkey.scalar.string.cto | 22 + ...eclaration.goodvalue.declaration.asset.cto | 23 + ...laration.goodvalue.declaration.concept.cto | 21 + ....goodvalue.declaration.derived.concept.cto | 23 + ...eclaration.goodvalue.declaration.event.cto | 21 + ...pdeclaration.goodvalue.declaration.map.cto | 24 + ...tion.goodvalue.declaration.participant.cto | 23 + ...ion.goodvalue.declaration.relationship.cto | 21 + ...tion.goodvalue.declaration.transaction.cto | 22 + ...claration.goodvalue.primitive.datetime.cto | 19 + ...declaration.goodvalue.primitive.double.cto | 19 + ...eclaration.goodvalue.primitive.integer.cto | 19 + ...apdeclaration.goodvalue.primitive.long.cto | 19 + ...declaration.goodvalue.primitive.string.cto | 19 + .../test/introspect/classdeclaration.js | 10 + .../test/introspect/introspector.js | 4 +- .../test/introspect/mapdeclaration.js | 491 ++++++++++++++++++ packages/concerto-core/test/modelmanager.js | 14 +- .../types/lib/basemodelmanager.d.ts | 5 + .../lib/introspect/classdeclaration.d.ts | 6 + .../types/lib/introspect/mapdeclaration.d.ts | 97 ++++ .../types/lib/introspect/mapkeytype.d.ts | 42 ++ .../types/lib/introspect/mapvaluetype.d.ts | 41 ++ .../types/lib/introspect/modelfile.d.ts | 6 + 52 files changed, 2080 insertions(+), 160 deletions(-) create mode 100644 packages/concerto-core/lib/introspect/mapdeclaration.js create mode 100644 packages/concerto-core/lib/introspect/mapkeytype.js create mode 100644 packages/concerto-core/lib/introspect/mapvaluetype.js create mode 100644 packages/concerto-core/test/data/parser/mapdeclaration/mapdeclaration.badkey.declaration.concept.cto create mode 100644 packages/concerto-core/test/data/parser/mapdeclaration/mapdeclaration.badkey.declaration.enum.cto create mode 100644 packages/concerto-core/test/data/parser/mapdeclaration/mapdeclaration.badkey.declaration.event.cto create mode 100644 packages/concerto-core/test/data/parser/mapdeclaration/mapdeclaration.badkey.declaration.map.cto create mode 100644 packages/concerto-core/test/data/parser/mapdeclaration/mapdeclaration.badkey.primitive.double.cto create mode 100644 packages/concerto-core/test/data/parser/mapdeclaration/mapdeclaration.badkey.primitive.integer.cto create mode 100644 packages/concerto-core/test/data/parser/mapdeclaration/mapdeclaration.badkey.primitive.long.cto create mode 100644 packages/concerto-core/test/data/parser/mapdeclaration/mapdeclaration.badkey.scalar.boolean.cto create mode 100644 packages/concerto-core/test/data/parser/mapdeclaration/mapdeclaration.badkey.scalar.double.cto create mode 100644 packages/concerto-core/test/data/parser/mapdeclaration/mapdeclaration.badkey.scalar.integer.cto create mode 100644 packages/concerto-core/test/data/parser/mapdeclaration/mapdeclaration.badkey.scalar.long.cto create mode 100644 packages/concerto-core/test/data/parser/mapdeclaration/mapdeclaration.badvalue.nontype.cto create mode 100644 packages/concerto-core/test/data/parser/mapdeclaration/mapdeclaration.goodkey.declaration.concept.cto create mode 100644 packages/concerto-core/test/data/parser/mapdeclaration/mapdeclaration.goodkey.declaration.enum.cto create mode 100644 packages/concerto-core/test/data/parser/mapdeclaration/mapdeclaration.goodkey.primitive.boolean.cto create mode 100644 packages/concerto-core/test/data/parser/mapdeclaration/mapdeclaration.goodkey.primitive.datetime.cto create mode 100644 packages/concerto-core/test/data/parser/mapdeclaration/mapdeclaration.goodkey.primitive.string.cto create mode 100644 packages/concerto-core/test/data/parser/mapdeclaration/mapdeclaration.goodkey.scalar.datetime.cto create mode 100644 packages/concerto-core/test/data/parser/mapdeclaration/mapdeclaration.goodkey.scalar.string.cto create mode 100644 packages/concerto-core/test/data/parser/mapdeclaration/mapdeclaration.goodvalue.declaration.asset.cto create mode 100644 packages/concerto-core/test/data/parser/mapdeclaration/mapdeclaration.goodvalue.declaration.concept.cto create mode 100644 packages/concerto-core/test/data/parser/mapdeclaration/mapdeclaration.goodvalue.declaration.derived.concept.cto create mode 100644 packages/concerto-core/test/data/parser/mapdeclaration/mapdeclaration.goodvalue.declaration.event.cto create mode 100644 packages/concerto-core/test/data/parser/mapdeclaration/mapdeclaration.goodvalue.declaration.map.cto create mode 100644 packages/concerto-core/test/data/parser/mapdeclaration/mapdeclaration.goodvalue.declaration.participant.cto create mode 100644 packages/concerto-core/test/data/parser/mapdeclaration/mapdeclaration.goodvalue.declaration.relationship.cto create mode 100644 packages/concerto-core/test/data/parser/mapdeclaration/mapdeclaration.goodvalue.declaration.transaction.cto create mode 100644 packages/concerto-core/test/data/parser/mapdeclaration/mapdeclaration.goodvalue.primitive.datetime.cto create mode 100644 packages/concerto-core/test/data/parser/mapdeclaration/mapdeclaration.goodvalue.primitive.double.cto create mode 100644 packages/concerto-core/test/data/parser/mapdeclaration/mapdeclaration.goodvalue.primitive.integer.cto create mode 100644 packages/concerto-core/test/data/parser/mapdeclaration/mapdeclaration.goodvalue.primitive.long.cto create mode 100644 packages/concerto-core/test/data/parser/mapdeclaration/mapdeclaration.goodvalue.primitive.string.cto create mode 100644 packages/concerto-core/test/introspect/mapdeclaration.js create mode 100644 packages/concerto-core/types/lib/introspect/mapdeclaration.d.ts create mode 100644 packages/concerto-core/types/lib/introspect/mapkeytype.d.ts create mode 100644 packages/concerto-core/types/lib/introspect/mapvaluetype.d.ts diff --git a/package-lock.json b/package-lock.json index f92ccedf07..5b6a1173c5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -53,7 +53,7 @@ "webpack": "5.76.0", "webpack-cli": "4.9.1", "xregexp": "5.1.1", - "yaml": "2.0.0-9", + "yaml": "2.2.2", "yargs": "17.3.1" }, "devDependencies": { @@ -160,8 +160,9 @@ } }, "node_modules/@babel/code-frame": { - "version": "7.18.6", - "license": "MIT", + "version": "7.21.4", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.21.4.tgz", + "integrity": "sha512-LYvhNKfwWSPpocw8GI7gpK2nq3HSDuEPC/uSYaALSJu9xjsalaaYFOq0Pwt5KmVqwEbZlDu81aLXwBOmD/Fv9g==", "dependencies": { "@babel/highlight": "^7.18.6" }, @@ -220,11 +221,11 @@ } }, "node_modules/@babel/generator": { - "version": "7.21.1", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.21.1.tgz", - "integrity": "sha512-1lT45bAYlQhFn/BHivJs43AiW2rg3/UbLyShGfF3C0KmHvO5fSghWd5kBJy30kpRRucGzXStvnnCFniCR2kXAA==", + "version": "7.21.5", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.21.5.tgz", + "integrity": "sha512-SrKK/sRv8GesIW1bDagf9cCG38IOMYZusoe1dfg0D8aiUe3Amvoj1QtjTPAWcfrZFvIwlleLb0gxzQidL9w14w==", "dependencies": { - "@babel/types": "^7.21.0", + "@babel/types": "^7.21.5", "@jridgewell/gen-mapping": "^0.3.2", "@jridgewell/trace-mapping": "^0.3.17", "jsesc": "^2.5.1" @@ -255,12 +256,11 @@ } }, "node_modules/@babel/helper-builder-binary-assignment-operator-visitor": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/helper-builder-binary-assignment-operator-visitor/-/helper-builder-binary-assignment-operator-visitor-7.18.9.tgz", - "integrity": "sha512-yFQ0YCHoIqarl8BCRwBL8ulYUaZpz3bNsA7oFepAzee+8/+ImtADXNOmO5vJvsPff3qi+hvpkY/NYBTrBQgdNw==", + "version": "7.21.5", + "resolved": "https://registry.npmjs.org/@babel/helper-builder-binary-assignment-operator-visitor/-/helper-builder-binary-assignment-operator-visitor-7.21.5.tgz", + "integrity": "sha512-uNrjKztPLkUk7bpCNC0jEKDJzzkvel/W+HguzbN8krA+LPfC1CEobJEvAvGka2A/M+ViOqXdcRL0GqPUJSjx9g==", "dependencies": { - "@babel/helper-explode-assignable-expression": "^7.18.6", - "@babel/types": "^7.18.9" + "@babel/types": "^7.21.5" }, "engines": { "node": ">=6.9.0" @@ -305,18 +305,19 @@ "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==" }, "node_modules/@babel/helper-create-class-features-plugin": { - "version": "7.21.4", - "resolved": "https://registry.npmjs.org/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.21.4.tgz", - "integrity": "sha512-46QrX2CQlaFRF4TkwfTt6nJD7IHq8539cCL7SDpqWSDeJKY1xylKKY5F/33mJhLZ3mFvKv2gGrVS6NkyF6qs+Q==", + "version": "7.21.8", + "resolved": "https://registry.npmjs.org/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.21.8.tgz", + "integrity": "sha512-+THiN8MqiH2AczyuZrnrKL6cAxFRRQDKW9h1YkBvbgKmAm6mwiacig1qT73DHIWMGo40GRnsEfN3LA+E6NtmSw==", "dependencies": { "@babel/helper-annotate-as-pure": "^7.18.6", - "@babel/helper-environment-visitor": "^7.18.9", + "@babel/helper-environment-visitor": "^7.21.5", "@babel/helper-function-name": "^7.21.0", - "@babel/helper-member-expression-to-functions": "^7.21.0", + "@babel/helper-member-expression-to-functions": "^7.21.5", "@babel/helper-optimise-call-expression": "^7.18.6", - "@babel/helper-replace-supers": "^7.20.7", + "@babel/helper-replace-supers": "^7.21.5", "@babel/helper-skip-transparent-expression-wrappers": "^7.20.0", - "@babel/helper-split-export-declaration": "^7.18.6" + "@babel/helper-split-export-declaration": "^7.18.6", + "semver": "^6.3.0" }, "engines": { "node": ">=6.9.0" @@ -325,13 +326,22 @@ "@babel/core": "^7.0.0" } }, + "node_modules/@babel/helper-create-class-features-plugin/node_modules/semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "bin": { + "semver": "bin/semver.js" + } + }, "node_modules/@babel/helper-create-regexp-features-plugin": { - "version": "7.21.4", - "resolved": "https://registry.npmjs.org/@babel/helper-create-regexp-features-plugin/-/helper-create-regexp-features-plugin-7.21.4.tgz", - "integrity": "sha512-M00OuhU+0GyZ5iBBN9czjugzWrEq2vDpf/zCYHxxf93ul/Q5rv+a5h+/+0WnI1AebHNVtl5bFV0qsJoH23DbfA==", + "version": "7.21.8", + "resolved": "https://registry.npmjs.org/@babel/helper-create-regexp-features-plugin/-/helper-create-regexp-features-plugin-7.21.8.tgz", + "integrity": "sha512-zGuSdedkFtsFHGbexAvNuipg1hbtitDLo2XE8/uf6Y9sOQV1xsYX/2pNbtedp/X0eU1pIt+kGvaqHCowkRbS5g==", "dependencies": { "@babel/helper-annotate-as-pure": "^7.18.6", - "regexpu-core": "^5.3.1" + "regexpu-core": "^5.3.1", + "semver": "^6.3.0" }, "engines": { "node": ">=6.9.0" @@ -340,6 +350,14 @@ "@babel/core": "^7.0.0" } }, + "node_modules/@babel/helper-create-regexp-features-plugin/node_modules/semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "bin": { + "semver": "bin/semver.js" + } + }, "node_modules/@babel/helper-define-polyfill-provider": { "version": "0.3.3", "resolved": "https://registry.npmjs.org/@babel/helper-define-polyfill-provider/-/helper-define-polyfill-provider-0.3.3.tgz", @@ -365,19 +383,9 @@ } }, "node_modules/@babel/helper-environment-visitor": { - "version": "7.18.9", - "license": "MIT", - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-explode-assignable-expression": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/helper-explode-assignable-expression/-/helper-explode-assignable-expression-7.18.6.tgz", - "integrity": "sha512-eyAYAsQmB80jNfg4baAtLeWAQHfHFiR483rzFK+BhETlGZaQC9bsfrugfXDCbRHLQbIA7U5NxhhOxN7p/dWIcg==", - "dependencies": { - "@babel/types": "^7.18.6" - }, + "version": "7.21.5", + "resolved": "https://registry.npmjs.org/@babel/helper-environment-visitor/-/helper-environment-visitor-7.21.5.tgz", + "integrity": "sha512-IYl4gZ3ETsWocUWgsFZLM5i1BYx9SoemminVEXadgLBa9TdeorzgLKm8wWLA6J1N/kT3Kch8XIk1laNzYoHKvQ==", "engines": { "node": ">=6.9.0" } @@ -405,39 +413,40 @@ } }, "node_modules/@babel/helper-member-expression-to-functions": { - "version": "7.21.0", - "resolved": "https://registry.npmjs.org/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.21.0.tgz", - "integrity": "sha512-Muu8cdZwNN6mRRNG6lAYErJ5X3bRevgYR2O8wN0yn7jJSnGDu6eG59RfT29JHxGUovyfrh6Pj0XzmR7drNVL3Q==", + "version": "7.21.5", + "resolved": "https://registry.npmjs.org/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.21.5.tgz", + "integrity": "sha512-nIcGfgwpH2u4n9GG1HpStW5Ogx7x7ekiFHbjjFRKXbn5zUvqO9ZgotCO4x1aNbKn/x/xOUaXEhyNHCwtFCpxWg==", "dependencies": { - "@babel/types": "^7.21.0" + "@babel/types": "^7.21.5" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-module-imports": { - "version": "7.18.6", - "license": "MIT", + "version": "7.21.4", + "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.21.4.tgz", + "integrity": "sha512-orajc5T2PsRYUN3ZryCEFeMDYwyw09c/pZeaQEZPH0MpKzSvn3e0uXsDBu3k03VI+9DBiRo+l22BfKTpKwa/Wg==", "dependencies": { - "@babel/types": "^7.18.6" + "@babel/types": "^7.21.4" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-module-transforms": { - "version": "7.21.2", - "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.21.2.tgz", - "integrity": "sha512-79yj2AR4U/Oqq/WOV7Lx6hUjau1Zfo4cI+JLAVYeMV5XIlbOhmjEk5ulbTc9fMpmlojzZHkUUxAiK+UKn+hNQQ==", + "version": "7.21.5", + "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.21.5.tgz", + "integrity": "sha512-bI2Z9zBGY2q5yMHoBvJ2a9iX3ZOAzJPm7Q8Yz6YeoUjU/Cvhmi2G4QyTNyPBqqXSgTjUxRg3L0xV45HvkNWWBw==", "dependencies": { - "@babel/helper-environment-visitor": "^7.18.9", - "@babel/helper-module-imports": "^7.18.6", - "@babel/helper-simple-access": "^7.20.2", + "@babel/helper-environment-visitor": "^7.21.5", + "@babel/helper-module-imports": "^7.21.4", + "@babel/helper-simple-access": "^7.21.5", "@babel/helper-split-export-declaration": "^7.18.6", "@babel/helper-validator-identifier": "^7.19.1", "@babel/template": "^7.20.7", - "@babel/traverse": "^7.21.2", - "@babel/types": "^7.21.2" + "@babel/traverse": "^7.21.5", + "@babel/types": "^7.21.5" }, "engines": { "node": ">=6.9.0" @@ -455,9 +464,9 @@ } }, "node_modules/@babel/helper-plugin-utils": { - "version": "7.20.2", - "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.20.2.tgz", - "integrity": "sha512-8RvlJG2mj4huQ4pZ+rU9lqKi9ZKiRmuvGuM2HlWmkmgOhbs6zEAw6IEiJ5cQqGbDzGZOhwuOQNtZMi/ENLjZoQ==", + "version": "7.21.5", + "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.21.5.tgz", + "integrity": "sha512-0WDaIlXKOX/3KfBK/dwP1oQGiPh6rjMkT7HIRv7i5RR2VUMwrx5ZL0dwBkKx7+SW1zwNdgjHd34IMk5ZjTeHVg==", "engines": { "node": ">=6.9.0" } @@ -480,26 +489,27 @@ } }, "node_modules/@babel/helper-replace-supers": { - "version": "7.20.7", - "resolved": "https://registry.npmjs.org/@babel/helper-replace-supers/-/helper-replace-supers-7.20.7.tgz", - "integrity": "sha512-vujDMtB6LVfNW13jhlCrp48QNslK6JXi7lQG736HVbHz/mbf4Dc7tIRh1Xf5C0rF7BP8iiSxGMCmY6Ci1ven3A==", + "version": "7.21.5", + "resolved": "https://registry.npmjs.org/@babel/helper-replace-supers/-/helper-replace-supers-7.21.5.tgz", + "integrity": "sha512-/y7vBgsr9Idu4M6MprbOVUfH3vs7tsIfnVWv/Ml2xgwvyH6LTngdfbf5AdsKwkJy4zgy1X/kuNrEKvhhK28Yrg==", "dependencies": { - "@babel/helper-environment-visitor": "^7.18.9", - "@babel/helper-member-expression-to-functions": "^7.20.7", + "@babel/helper-environment-visitor": "^7.21.5", + "@babel/helper-member-expression-to-functions": "^7.21.5", "@babel/helper-optimise-call-expression": "^7.18.6", "@babel/template": "^7.20.7", - "@babel/traverse": "^7.20.7", - "@babel/types": "^7.20.7" + "@babel/traverse": "^7.21.5", + "@babel/types": "^7.21.5" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-simple-access": { - "version": "7.20.2", - "license": "MIT", + "version": "7.21.5", + "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.21.5.tgz", + "integrity": "sha512-ENPDAMC1wAjR0uaCUwliBdiSl1KBJAVnMTzXqi64c2MG8MPR6ii4qf7bSXDqSFbr4W6W028/rf5ivoHop5/mkg==", "dependencies": { - "@babel/types": "^7.20.2" + "@babel/types": "^7.21.5" }, "engines": { "node": ">=6.9.0" @@ -527,8 +537,9 @@ } }, "node_modules/@babel/helper-string-parser": { - "version": "7.19.4", - "license": "MIT", + "version": "7.21.5", + "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.21.5.tgz", + "integrity": "sha512-5pTUx3hAJaZIdW99sJ6ZUUgWq/Y+Hja7TowEnLNMm1VivRgZQL3vpBY3qUACVsvw+yQU6+YgfBVmcbLaZtrA1w==", "engines": { "node": ">=6.9.0" } @@ -586,9 +597,9 @@ } }, "node_modules/@babel/parser": { - "version": "7.21.2", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.21.2.tgz", - "integrity": "sha512-URpaIJQwEkEC2T9Kn+Ai6Xe/02iNaVCuT/PtoRz3GPVJVDpPd7mLo+VddTbhCRU9TXqW5mSrQfXZyi8kDKOVpQ==", + "version": "7.21.8", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.21.8.tgz", + "integrity": "sha512-6zavDGdzG3gUqAdWvlLFfk+36RilI+Pwyuuh7HItyeScCWP3k6i8vKclAQ0bM/0y/Kz/xiwvxhMv9MgTJP5gmA==", "bin": { "parser": "bin/babel-parser.js" }, @@ -1060,11 +1071,11 @@ } }, "node_modules/@babel/plugin-transform-arrow-functions": { - "version": "7.20.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-arrow-functions/-/plugin-transform-arrow-functions-7.20.7.tgz", - "integrity": "sha512-3poA5E7dzDomxj9WXWwuD6A5F3kc7VXwIJO+E+J8qtDtS+pXPAhrgEyh+9GBwBgPq1Z+bB+/JD60lp5jsN7JPQ==", + "version": "7.21.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-arrow-functions/-/plugin-transform-arrow-functions-7.21.5.tgz", + "integrity": "sha512-wb1mhwGOCaXHDTcsRYMKF9e5bbMgqwxtqa2Y1ifH96dXJPwbuLX9qHy3clhrxVqgMz7nyNXs8VkxdH8UBcjKqA==", "dependencies": { - "@babel/helper-plugin-utils": "^7.20.2" + "@babel/helper-plugin-utils": "^7.21.5" }, "engines": { "node": ">=6.9.0" @@ -1140,11 +1151,11 @@ } }, "node_modules/@babel/plugin-transform-computed-properties": { - "version": "7.20.7", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-computed-properties/-/plugin-transform-computed-properties-7.20.7.tgz", - "integrity": "sha512-Lz7MvBK6DTjElHAmfu6bfANzKcxpyNPeYBGEafyA6E5HtRpjpZwU+u7Qrgz/2OR0z+5TvKYbPdphfSaAcZBrYQ==", + "version": "7.21.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-computed-properties/-/plugin-transform-computed-properties-7.21.5.tgz", + "integrity": "sha512-TR653Ki3pAwxBxUe8srfF3e4Pe3FTA46uaNHYyQwIoM4oWKSoOZiDNyHJ0oIoDIUPSRQbQG7jzgVBX3FPVne1Q==", "dependencies": { - "@babel/helper-plugin-utils": "^7.20.2", + "@babel/helper-plugin-utils": "^7.21.5", "@babel/template": "^7.20.7" }, "engines": { @@ -1213,11 +1224,11 @@ } }, "node_modules/@babel/plugin-transform-for-of": { - "version": "7.21.0", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-for-of/-/plugin-transform-for-of-7.21.0.tgz", - "integrity": "sha512-LlUYlydgDkKpIY7mcBWvyPPmMcOphEyYA27Ef4xpbh1IiDNLr0kZsos2nf92vz3IccvJI25QUwp86Eo5s6HmBQ==", + "version": "7.21.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-for-of/-/plugin-transform-for-of-7.21.5.tgz", + "integrity": "sha512-nYWpjKW/7j/I/mZkGVgHJXh4bA1sfdFnJoOXwJuj4m3Q2EraO/8ZyrkCau9P5tbHQk01RMSt6KYLCsW7730SXQ==", "dependencies": { - "@babel/helper-plugin-utils": "^7.20.2" + "@babel/helper-plugin-utils": "^7.21.5" }, "engines": { "node": ">=6.9.0" @@ -1286,13 +1297,13 @@ } }, "node_modules/@babel/plugin-transform-modules-commonjs": { - "version": "7.21.2", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.21.2.tgz", - "integrity": "sha512-Cln+Yy04Gxua7iPdj6nOV96smLGjpElir5YwzF0LBPKoPlLDNJePNlrGGaybAJkd0zKRnOVXOgizSqPYMNYkzA==", + "version": "7.21.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.21.5.tgz", + "integrity": "sha512-OVryBEgKUbtqMoB7eG2rs6UFexJi6Zj6FDXx+esBLPTCxCNxAY9o+8Di7IsUGJ+AVhp5ncK0fxWUBd0/1gPhrQ==", "dependencies": { - "@babel/helper-module-transforms": "^7.21.2", - "@babel/helper-plugin-utils": "^7.20.2", - "@babel/helper-simple-access": "^7.20.2" + "@babel/helper-module-transforms": "^7.21.5", + "@babel/helper-plugin-utils": "^7.21.5", + "@babel/helper-simple-access": "^7.21.5" }, "engines": { "node": ">=6.9.0" @@ -1406,11 +1417,11 @@ } }, "node_modules/@babel/plugin-transform-regenerator": { - "version": "7.20.5", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-regenerator/-/plugin-transform-regenerator-7.20.5.tgz", - "integrity": "sha512-kW/oO7HPBtntbsahzQ0qSE3tFvkFwnbozz3NWFhLGqH75vLEg+sCGngLlhVkePlCs3Jv0dBBHDzCHxNiFAQKCQ==", + "version": "7.21.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-regenerator/-/plugin-transform-regenerator-7.21.5.tgz", + "integrity": "sha512-ZoYBKDb6LyMi5yCsByQ5jmXsHAQDDYeexT1Szvlmui+lADvfSecr5Dxd/PkrTC3pAD182Fcju1VQkB4oCp9M+w==", "dependencies": { - "@babel/helper-plugin-utils": "^7.20.2", + "@babel/helper-plugin-utils": "^7.21.5", "regenerator-transform": "^0.15.1" }, "engines": { @@ -1506,11 +1517,11 @@ } }, "node_modules/@babel/plugin-transform-unicode-escapes": { - "version": "7.18.10", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-unicode-escapes/-/plugin-transform-unicode-escapes-7.18.10.tgz", - "integrity": "sha512-kKAdAI+YzPgGY/ftStBFXTI1LZFju38rYThnfMykS+IXy8BVx+res7s2fxf1l8I35DV2T97ezo6+SGrXz6B3iQ==", + "version": "7.21.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-unicode-escapes/-/plugin-transform-unicode-escapes-7.21.5.tgz", + "integrity": "sha512-LYm/gTOwZqsYohlvFUe/8Tujz75LqqVC2w+2qPHLR+WyWHGCZPN1KBpJCJn+4Bk4gOkQy/IXKIge6az5MqwlOg==", "dependencies": { - "@babel/helper-plugin-utils": "^7.18.9" + "@babel/helper-plugin-utils": "^7.21.5" }, "engines": { "node": ">=6.9.0" @@ -1650,9 +1661,9 @@ "integrity": "sha512-x/rqGMdzj+fWZvCOYForTghzbtqPDZ5gPwaoNGHdgDfF2QA/XZbCBp4Moo5scrkAMPhB7z26XM/AaHuIJdgauA==" }, "node_modules/@babel/runtime": { - "version": "7.21.0", - "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.21.0.tgz", - "integrity": "sha512-xwII0//EObnq89Ji5AKYQaRYiW/nZ3llSv29d49IuxPhKbtJoLP+9QUUZ4nVragQVtaVGeZrpB+ZtG/Pdy/POw==", + "version": "7.21.5", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.21.5.tgz", + "integrity": "sha512-8jI69toZqqcsnqGGqwGS4Qb1VwLOEp4hz+CXPywcvjs60u3B4Pom/U/7rm4W8tMOYEB+E9wgD0mW1l3r8qlI9Q==", "dependencies": { "regenerator-runtime": "^0.13.11" }, @@ -1661,9 +1672,9 @@ } }, "node_modules/@babel/runtime-corejs3": { - "version": "7.21.0", - "resolved": "https://registry.npmjs.org/@babel/runtime-corejs3/-/runtime-corejs3-7.21.0.tgz", - "integrity": "sha512-TDD4UJzos3JJtM+tHX+w2Uc+KWj7GV+VKKFdMVd2Rx8sdA19hcc3P3AHFYd5LVOw+pYuSd5lICC3gm52B6Rwxw==", + "version": "7.21.5", + "resolved": "https://registry.npmjs.org/@babel/runtime-corejs3/-/runtime-corejs3-7.21.5.tgz", + "integrity": "sha512-FRqFlFKNazWYykft5zvzuEl1YyTDGsIRrjV9rvxvYkUC7W/ueBng1X68Xd6uRMzAaJ0xMKn08/wem5YS1lpX8w==", "dependencies": { "core-js-pure": "^3.25.1", "regenerator-runtime": "^0.13.11" @@ -1686,18 +1697,18 @@ } }, "node_modules/@babel/traverse": { - "version": "7.21.2", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.21.2.tgz", - "integrity": "sha512-ts5FFU/dSUPS13tv8XiEObDu9K+iagEKME9kAbaP7r0Y9KtZJZ+NGndDvWoRAYNpeWafbpFeki3q9QoMD6gxyw==", + "version": "7.21.5", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.21.5.tgz", + "integrity": "sha512-AhQoI3YjWi6u/y/ntv7k48mcrCXmus0t79J9qPNlk/lAsFlCiJ047RmbfMOawySTHtywXhbXgpx/8nXMYd+oFw==", "dependencies": { - "@babel/code-frame": "^7.18.6", - "@babel/generator": "^7.21.1", - "@babel/helper-environment-visitor": "^7.18.9", + "@babel/code-frame": "^7.21.4", + "@babel/generator": "^7.21.5", + "@babel/helper-environment-visitor": "^7.21.5", "@babel/helper-function-name": "^7.21.0", "@babel/helper-hoist-variables": "^7.18.6", "@babel/helper-split-export-declaration": "^7.18.6", - "@babel/parser": "^7.21.2", - "@babel/types": "^7.21.2", + "@babel/parser": "^7.21.5", + "@babel/types": "^7.21.5", "debug": "^4.1.0", "globals": "^11.1.0" }, @@ -1706,11 +1717,11 @@ } }, "node_modules/@babel/types": { - "version": "7.21.2", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.21.2.tgz", - "integrity": "sha512-3wRZSs7jiFaB8AjxiiD+VqN5DTG2iRvJGQ+qYFrs/654lg6kGTQWIOFjlBo5RaXuAZjBmP3+OQH4dmhqiiyYxw==", + "version": "7.21.5", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.21.5.tgz", + "integrity": "sha512-m4AfNvVF2mVC/F7fDEdH2El3HzUg9It/XsCxZiOTTA3m3qYfcSVSbTfM6Q9xG+hYDniZssYhlXKKUMD5m8tF4Q==", "dependencies": { - "@babel/helper-string-parser": "^7.19.4", + "@babel/helper-string-parser": "^7.21.5", "@babel/helper-validator-identifier": "^7.19.1", "to-fast-properties": "^2.0.0" }, @@ -4420,9 +4431,9 @@ } }, "node_modules/@types/babel__traverse": { - "version": "7.18.3", - "resolved": "https://registry.npmjs.org/@types/babel__traverse/-/babel__traverse-7.18.3.tgz", - "integrity": "sha512-1kbcJ40lLB7MHsj39U4Sh1uTd2E7rLEa79kmDpI6cy+XiXsteB3POdQomoq4FxszMrO3ZYchkhYJw7A2862b3w==", + "version": "7.18.5", + "resolved": "https://registry.npmjs.org/@types/babel__traverse/-/babel__traverse-7.18.5.tgz", + "integrity": "sha512-enCvTL8m/EHS/zIvJno9nE+ndYPh1/oNFzRYRmtUqJICG2VnCSBzMLW5VN2KCQU91f23tsNKR8v7VJJQMatl7Q==", "dependencies": { "@babel/types": "^7.3.0" } @@ -4528,9 +4539,9 @@ "license": "MIT" }, "node_modules/@types/node": { - "version": "18.16.0", - "resolved": "https://registry.npmjs.org/@types/node/-/node-18.16.0.tgz", - "integrity": "sha512-BsAaKhB+7X+H4GnSjGhJG9Qi8Tw+inU9nJDwmD5CgOmBLEI6ArdhikpLX7DjbjDRDTbqZzU2LSQNZg8WGPiSZQ==" + "version": "20.1.5", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.1.5.tgz", + "integrity": "sha512-IvGD1CD/nego63ySR7vrAKEX3AJTcmrAN2kn+/sDNLi1Ff5kBzDeEdqWDplK+0HAEoLYej137Sk0cUU8OLOlMg==" }, "node_modules/@types/normalize-package-data": { "version": "2.4.1", @@ -4632,9 +4643,9 @@ "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" }, "node_modules/@typescript-eslint/eslint-plugin/node_modules/semver": { - "version": "7.5.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.0.tgz", - "integrity": "sha512-+XC0AD/R7Q2mPSRuy2Id0+CGTZ98+8f+KvwirxOKIEyid+XSx6HbC63p+O4IndTHuX5Z+JxQ0TghCkO5Cg/2HA==", + "version": "7.5.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.1.tgz", + "integrity": "sha512-Wvss5ivl8TMRZXXESstBA4uR5iXgEN/VC5/sOcuXdVLzcdkz4HWetIoRfG5gb5X+ij/G9rw9YoGn3QoQ8OCSpw==", "dependencies": { "lru-cache": "^6.0.0" }, @@ -4814,9 +4825,9 @@ "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" }, "node_modules/@typescript-eslint/typescript-estree/node_modules/semver": { - "version": "7.5.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.0.tgz", - "integrity": "sha512-+XC0AD/R7Q2mPSRuy2Id0+CGTZ98+8f+KvwirxOKIEyid+XSx6HbC63p+O4IndTHuX5Z+JxQ0TghCkO5Cg/2HA==", + "version": "7.5.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.1.tgz", + "integrity": "sha512-Wvss5ivl8TMRZXXESstBA4uR5iXgEN/VC5/sOcuXdVLzcdkz4HWetIoRfG5gb5X+ij/G9rw9YoGn3QoQ8OCSpw==", "dependencies": { "lru-cache": "^6.0.0" }, @@ -5125,9 +5136,9 @@ } }, "node_modules/acorn-import-assertions": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/acorn-import-assertions/-/acorn-import-assertions-1.8.0.tgz", - "integrity": "sha512-m7VZ3jwz4eK6A4Vtt8Ew1/mNbP24u0FhdyfA7fSvnJR6LMdfOYnmuIrrJAgrYfYJ10F/otaHTtrtrtmHdMNzEw==", + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/acorn-import-assertions/-/acorn-import-assertions-1.9.0.tgz", + "integrity": "sha512-cmMwop9x+8KFhxvKrKfPYmN6/pKTYYHBqLa0DfvVZcKMJWNyWLnaqND7dx/qn66R7ewM1UX5XMaDVP5wlVTaVA==", "peerDependencies": { "acorn": "^8" } @@ -6683,9 +6694,9 @@ "license": "MIT" }, "node_modules/core-js-compat": { - "version": "3.30.1", - "resolved": "https://registry.npmjs.org/core-js-compat/-/core-js-compat-3.30.1.tgz", - "integrity": "sha512-d690npR7MC6P0gq4npTl5n2VQeNAmUrJ90n+MHiKS7W2+xno4o3F5GDEuylSdi6EJ3VssibSGXOa1r3YXD3Mhw==", + "version": "3.30.2", + "resolved": "https://registry.npmjs.org/core-js-compat/-/core-js-compat-3.30.2.tgz", + "integrity": "sha512-nriW1nuJjUgvkEjIot1Spwakz52V9YkYHZAQG6A1eCgC8AA1p0zngrQEP9R0+V6hji5XilWKG1Bd0YRppmGimA==", "dependencies": { "browserslist": "^4.21.5" }, @@ -6695,9 +6706,9 @@ } }, "node_modules/core-js-pure": { - "version": "3.30.1", - "resolved": "https://registry.npmjs.org/core-js-pure/-/core-js-pure-3.30.1.tgz", - "integrity": "sha512-nXBEVpmUnNRhz83cHd9JRQC52cTMcuXAmR56+9dSMpRdpeA4I1PX6yjmhd71Eyc/wXNsdBdUDIj1QTIeZpU5Tg==", + "version": "3.30.2", + "resolved": "https://registry.npmjs.org/core-js-pure/-/core-js-pure-3.30.2.tgz", + "integrity": "sha512-p/npFUJXXBkCCTIlEGBdghofn00jWG6ZOtdoIXSJmAu2QBvN0IqpZXWweOytcwE6cfx8ZvVUy1vw8zxhe4Y2vg==", "hasInstallScript": true, "funding": { "type": "opencollective", @@ -7268,9 +7279,9 @@ } }, "node_modules/enhanced-resolve": { - "version": "5.13.0", - "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.13.0.tgz", - "integrity": "sha512-eyV8f0y1+bzyfh8xAwW/WTSZpLbjhqc4ne9eGSH4Zo2ejdyiNG9pU6mf9DG8a7+Auk6MFTlNOT4Y2y/9k8GKVg==", + "version": "5.14.0", + "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.14.0.tgz", + "integrity": "sha512-+DCows0XNwLDcUhbFJPdlQEVnT2zXlCv7hPxemTz86/O+B/hCQ+mb7ydkPKiflpVraqLPCAfu7lDy+hBXueojw==", "dependencies": { "graceful-fs": "^4.2.4", "tapable": "^2.2.0" @@ -8336,12 +8347,13 @@ } }, "node_modules/get-intrinsic": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.0.tgz", - "integrity": "sha512-L049y6nFOuom5wGyRc3/gdTLO94dySVKRACj1RmJZBQXlbTMhtNIgkWkUHq+jYmZvKf14EW1EoJnnjbmoHij0Q==", + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.1.tgz", + "integrity": "sha512-2DcsyfABl+gVHEfCOaTrWgyt+tb6MSEGmKq+kI5HwLbIYgjgmMcV8KQ41uaKz1xxUcn9tJtgFbQUEVcEbd0FYw==", "dependencies": { "function-bind": "^1.1.1", "has": "^1.0.3", + "has-proto": "^1.0.1", "has-symbols": "^1.0.3" }, "funding": { @@ -12987,11 +12999,19 @@ } }, "node_modules/nise/node_modules/@sinonjs/fake-timers": { - "version": "10.0.2", - "resolved": "https://registry.npmjs.org/@sinonjs/fake-timers/-/fake-timers-10.0.2.tgz", - "integrity": "sha512-SwUDyjWnah1AaNl7kxsa7cfLhlTYoiyhDAIgyh+El30YvXs/o7OLXpYH88Zdhyx9JExKrmHDJ+10bwIcY80Jmw==", + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/@sinonjs/fake-timers/-/fake-timers-10.1.0.tgz", + "integrity": "sha512-w1qd368vtrwttm1PRJWPW1QHlbmHrVDGs1eBH/jZvRPUFS4MNXV9Q33EQdjOdeAxZ7O8+3wM7zxztm2nfUSyKw==", "dependencies": { - "@sinonjs/commons": "^2.0.0" + "@sinonjs/commons": "^3.0.0" + } + }, + "node_modules/nise/node_modules/@sinonjs/fake-timers/node_modules/@sinonjs/commons": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-3.0.0.tgz", + "integrity": "sha512-jXBtWAF4vmdNmZgD5FoKsVLv3rPgDnLgPbU84LIJ3otV44vJlDRokVng5v8NFJdCf/da9legHcKaRuZs4L7faA==", + "dependencies": { + "type-detect": "4.0.8" } }, "node_modules/node-addon-api": { @@ -13095,9 +13115,9 @@ } }, "node_modules/node-polyfill-webpack-plugin/node_modules/readable-stream": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-4.3.0.tgz", - "integrity": "sha512-MuEnA0lbSi7JS8XM+WNJlWZkHAAdm7gETHdFK//Q/mChGyj2akEFtdLZh32jSdkWGbRwCW9pn6g3LWDdDeZnBQ==", + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-4.4.0.tgz", + "integrity": "sha512-kDMOq0qLtxV9f/SQv522h8cxZBqNZXuXNyjyezmfAAuribMyVXziljpQ/uQhfE1XLg2/TLTW2DsnoE4VAi/krg==", "dependencies": { "abort-controller": "^3.0.0", "buffer": "^6.0.3", @@ -16364,9 +16384,9 @@ } }, "node_modules/terser": { - "version": "5.17.1", - "resolved": "https://registry.npmjs.org/terser/-/terser-5.17.1.tgz", - "integrity": "sha512-hVl35zClmpisy6oaoKALOpS0rDYLxRFLHhRuDlEGTKey9qHjS1w9GMORjuwIMt70Wan4lwsLYyWDVnWgF+KUEw==", + "version": "5.17.4", + "resolved": "https://registry.npmjs.org/terser/-/terser-5.17.4.tgz", + "integrity": "sha512-jcEKZw6UPrgugz/0Tuk/PVyLAPfMBJf5clnGueo45wTweoV8yh7Q7PEkhkJ5uuUbC7zAxEcG3tqNr1bstkQ8nw==", "dependencies": { "@jridgewell/source-map": "^0.3.2", "acorn": "^8.5.0", @@ -16381,15 +16401,15 @@ } }, "node_modules/terser-webpack-plugin": { - "version": "5.3.7", - "resolved": "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-5.3.7.tgz", - "integrity": "sha512-AfKwIktyP7Cu50xNjXF/6Qb5lBNzYaWpU6YfoX3uZicTx0zTy0stDDCsvjDapKsSDvOeWo5MEq4TmdBy2cNoHw==", + "version": "5.3.8", + "resolved": "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-5.3.8.tgz", + "integrity": "sha512-WiHL3ElchZMsK27P8uIUh4604IgJyAW47LVXGbEoB21DbQcZ+OuMpGjVYnEUaqcWM6dO8uS2qUbA7LSCWqvsbg==", "dependencies": { "@jridgewell/trace-mapping": "^0.3.17", "jest-worker": "^27.4.5", "schema-utils": "^3.1.1", "serialize-javascript": "^6.0.1", - "terser": "^5.16.5" + "terser": "^5.16.8" }, "engines": { "node": ">= 10.13.0" @@ -17562,11 +17582,11 @@ "license": "ISC" }, "node_modules/yaml": { - "version": "2.0.0-9", - "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.0.0-9.tgz", - "integrity": "sha512-Bf2KowHjyVkIIiGMt7+fbhmlvKOaE8DWuD07bnL4+FQ9sPmEl/5IzGpBpoxPqOaHuyasBjJhyXDcISpJWfhCGw==", + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.2.2.tgz", + "integrity": "sha512-CBKFWExMn46Foo4cldiChEzn7S7SRV+wqiluAb6xmueD/fGyRHIhX8m14vVGgeFWjN540nKCNVj6P21eQjgTuA==", "engines": { - "node": ">= 12" + "node": ">= 14" } }, "node_modules/yargs": { diff --git a/packages/concerto-core/api.txt b/packages/concerto-core/api.txt index 76572833e3..b4f35ef91e 100644 --- a/packages/concerto-core/api.txt +++ b/packages/concerto-core/api.txt @@ -24,6 +24,7 @@ class BaseModelManager { + TransactionDeclaration[] getTransactionDeclarations() + EventDeclaration[] getEventDeclarations() + ParticipantDeclaration[] getParticipantDeclarations() + + MapDeclaration[] getMapDeclarations() + EnumDeclaration[] getEnumDeclarations() + ConceptDeclaration[] getConceptDeclarations() + Factory getFactory() @@ -97,6 +98,7 @@ class ClassDeclaration extends Declaration { + boolean isEvent() + boolean isConcept() + boolean isEnum() + + boolean isMapDeclaration() + boolean isClassDeclaration() } class ConceptDeclaration extends ClassDeclaration { @@ -151,6 +153,35 @@ class Introspector { + void constructor(ModelManager) + ClassDeclaration[] getClassDeclarations() + ClassDeclaration getClassDeclaration(String) throws Error +} +class MapDeclaration extends Declaration { + + void constructor(ModelFile,Object) throws IllegalModelException + ~ void validate() throws IllegalModelException + + string getFullyQualifiedName() + + ModelFile getModelFile() + + string getName() + + string getKey() + + string getValue() + + array getProperties() + + String toString() + + string declarationKind() + + boolean isMapDeclaration() +} +class MapKeyType extends Decorated { + + void constructor(MapDeclaration,Object,ModelFile) throws IllegalModelException + ~ void validate() throws IllegalModelException + + ModelFile getModelFile() + + MapDeclaration getParent() + + string getType() + + String toString() +} +class MapValueType extends Decorated { + + void constructor(MapDeclaration,Object) throws IllegalModelException + ~ void validate() throws IllegalModelException + + ModelFile getModelFile() + + MapDeclaration getParent() + + string getType() + + String toString() } + ModelManager newMetaModelManager() + object validateMetaModel() @@ -179,6 +210,7 @@ class ModelFile extends Decorated { + ParticipantDeclaration[] getParticipantDeclarations() + ConceptDeclaration[] getConceptDeclarations() + EnumDeclaration[] getEnumDeclarations() + + MapDeclaration[] getMapDeclarations() + ScalarDeclaration[] getScalarDeclarations() + Object[] getDeclarations(Function) + ClassDeclaration[] getAllDeclarations() diff --git a/packages/concerto-core/changelog.txt b/packages/concerto-core/changelog.txt index 7113379924..e2fb3352cd 100644 --- a/packages/concerto-core/changelog.txt +++ b/packages/concerto-core/changelog.txt @@ -24,6 +24,9 @@ # Note that the latest public API is documented using JSDocs and is available in api.txt. # +Version 3.7.0 {a97cb6ebd45679354ba4da1940d2bb8d} 2023-05-19 +- Add MapDeclaration, MapKeyType, AggregateValueType + Version 3.5.0 {b419dc1b3db9662d8c941a044cd8db5a} 2023-03-07 - Introduce Declaration type. ClassDeclaration and Scalar Declaration both extend Declaration. diff --git a/packages/concerto-core/lib/basemodelmanager.js b/packages/concerto-core/lib/basemodelmanager.js index 02cd6cf3fa..744b71d73e 100644 --- a/packages/concerto-core/lib/basemodelmanager.js +++ b/packages/concerto-core/lib/basemodelmanager.js @@ -596,6 +596,16 @@ class BaseModelManager { }, []); } + /** + * Get the MapDeclarations defined in this model manager + * @return {MapDeclaration[]} the MapDeclaration defined in the model manager + */ + getMapDeclarations() { + return this.getModelFiles().reduce((prev, cur) => { + return prev.concat(cur.getMapDeclarations()); + }, []); + } + /** * Get the EnumDeclarations defined in this model manager * @return {EnumDeclaration[]} the EnumDeclaration defined in the model manager diff --git a/packages/concerto-core/lib/introspect/classdeclaration.js b/packages/concerto-core/lib/introspect/classdeclaration.js index dcb58c788d..18017a2a60 100644 --- a/packages/concerto-core/lib/introspect/classdeclaration.js +++ b/packages/concerto-core/lib/introspect/classdeclaration.js @@ -645,6 +645,15 @@ class ClassDeclaration extends Declaration { return this.type === `${MetaModelNamespace}.EnumDeclaration`; } + /** + * Returns true if this class is the definition of a map. + * + * @return {boolean} true if the class is an asset + */ + isMapDeclaration() { + return this.type === `${MetaModelNamespace}.MapDeclaration`; + } + /** * Returns true if this class is the definition of a enum. * diff --git a/packages/concerto-core/lib/introspect/mapdeclaration.js b/packages/concerto-core/lib/introspect/mapdeclaration.js new file mode 100644 index 0000000000..28823c877c --- /dev/null +++ b/packages/concerto-core/lib/introspect/mapdeclaration.js @@ -0,0 +1,185 @@ +/* + * 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. + */ + +'use strict'; + +const { MetaModelNamespace } = require('@accordproject/concerto-metamodel'); + +const Declaration = require('./declaration'); +const IllegalModelException = require('./illegalmodelexception'); +const MapValueType = require('./mapvaluetype'); +const MapKeyType = require('./mapkeytype'); +const ModelUtil = require('../modelutil'); + +// Types needed for TypeScript generation. +/* eslint-disable no-unused-vars */ +/* istanbul ignore next */ +if (global === undefined) { + const ModelFile = require('./modelfile'); +} + +/** + * MapDeclaration defines a Map data structure, which allows storage of a collection + * of values, where each value is associated and indexed with a unique key. + * + * @extends Decorated + * @see See {@link Decorated} + * @class + * @memberof module:concerto-core + */ +class MapDeclaration extends Declaration { + /** + * Create an MapDeclaration. + * @param {ModelFile} modelFile - the ModelFile for this class + * @param {Object} ast - The AST created by the parser + * @throws {IllegalModelException} + */ + constructor(modelFile, ast) { + // TODO remove on full release. + if(process.env.ENABLE_MAP_TYPE !== 'true') { + throw new Error('MapType feature is not enabled. Please set the environment variable "ENABLE_MAP_TYPE=true" to access this functionality.'); + } + + super(modelFile, ast); + this.modelFile = modelFile; + this.process(); + } + + /** + * Process the AST and build the model + * + * @throws {IllegalModelException} + * @private + */ + process() { + super.process(); + + if (this.ast.properties.length !== 2) { + throw new IllegalModelException(`MapDeclaration must contain exactly two properties - MapKeyType & MapyValueType ${this.ast.name}`, this.modelFile, this.ast.location); + } + + const key = this.ast.properties.find(property => property.$class === `${MetaModelNamespace}.MapKeyType`); + const value = this.ast.properties.find(property => property.$class === `${MetaModelNamespace}.AggregateValueType` || property.$class === `${MetaModelNamespace}.AggregateRelationshipValueType`); + + if (!key) { + throw new IllegalModelException(`MapDeclaration must contain MapKeyType ${this.ast.name}`, this.modelFile, this.ast.location); + } + + if (!value) { + throw new IllegalModelException(`MapDeclaration must contain AggregateValueType ${this.ast.name}`, this.modelFile, this.ast.location); + } + + this.name = this.ast.name; + this.key = new MapKeyType(this, key); + this.value = new MapValueType(this, value); + this.fqn = ModelUtil.getFullyQualifiedName(this.modelFile.getNamespace(), this.ast.name); + } + + /** + * Semantic validation of the structure of this class. + * + * @throws {IllegalModelException} + * @protected + */ + validate() { + super.validate(); + this.key.validate(); + this.value.validate(); + } + + /** + * Returns the fully qualified name of this class. + * The name will include the namespace if present. + * + * @return {string} the fully-qualified name of this class + */ + getFullyQualifiedName() { + return this.fqn; + } + + /** + * Returns the ModelFile that defines this class. + * + * @public + * @return {ModelFile} the owning ModelFile + */ + getModelFile() { + return this.modelFile; + } + + /** + * Returns the short name of a class. This name does not include the + * namespace from the owning ModelFile. + * + * @return {string} the short name of this class + */ + getName() { + return this.name; + } + + /** + * Returns the type of the Map key property. + * + * @return {string} the Map key property + */ + getKey() { + return this.key; + } + + /** + * Returns the type of the Map Value property. + * + * @return {string} the Map Value property + */ + getValue() { + return this.value; + } + + /** + * Returns the MapDeclaration properties + * + * @return {array} the MapDeclaration properties + */ + getProperties() { + return this.ast.properties; + } + + /** + * Returns the string representation of this class + * @return {String} the string representation of the class + */ + toString() { + return 'MapDeclaration {id=' + this.getFullyQualifiedName() + '}'; + } + + /** + * Returns the kind of declaration + * + * @return {string} what kind of declaration this is + */ + declarationKind() { + return 'MapDeclaration'; + } + + /** + * Returns true if this class is the definition of a class declaration. + * + * @return {boolean} true if the class is a class + */ + isMapDeclaration() { + return true; + } +} + +module.exports = MapDeclaration; diff --git a/packages/concerto-core/lib/introspect/mapkeytype.js b/packages/concerto-core/lib/introspect/mapkeytype.js new file mode 100644 index 0000000000..8638474d23 --- /dev/null +++ b/packages/concerto-core/lib/introspect/mapkeytype.js @@ -0,0 +1,133 @@ +/* + * 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. + */ + +'use strict'; + +const { MetaModelNamespace } = require('@accordproject/concerto-metamodel'); + +const Decorated = require('./decorated'); +const IllegalModelException = require('./illegalmodelexception'); + +// Types needed for TypeScript generation. +/* eslint-disable no-unused-vars */ +/* istanbul ignore next */ +if (global === undefined) { + const ModelFile = require('./modelfile'); +} + +/** + * MapKeyType defines a Key type of an MapDeclaration. + * + * @extends Decorated + * @see See {@link Decorated} + * @class + * @memberof module:concerto-core + */ +class MapKeyType extends Decorated { + /** + * Create an MapKeyType. + * @param {MapDeclaration} parent - The owner of this property + * @param {Object} ast - The AST created by the parser + * @param {ModelFile} modelFile - the ModelFile for the Map class + * @throws {IllegalModelException} + */ + constructor(parent, ast) { + super(ast); + this.parent = parent; + this.type = this.ast.name; + this.process(); + } + + /** + * Process the AST and build the model + * + * @throws {IllegalModelException} + * @private + */ + process() { + super.process(); + } + + /** + * Semantic validation of the structure of this class. + * + * @throws {IllegalModelException} + * @protected + */ + validate() { + const declaration = this.getModelFile().getAllDeclarations(); + const key = declaration.find(decl => decl.name === this.type); + + if (!key?.isConcept?.() && + !key?.isEnum?.() && + !key?.isScalarDeclaration?.() && + !['String', 'DateTime'].includes(this.type)) { + throw new IllegalModelException(`MapKeyType has invalid Type: ${this.type}`); + } + + if (key?.isConcept?.() && !key.isIdentified()) { + throw new IllegalModelException( + `ConceptDeclaration must be identified in context of MapKeyType: ${this.type}` + ); + } + + if (key?.isScalarDeclaration?.() && + !(key?.ast.$class === `${MetaModelNamespace}.StringScalar`) && + !(key?.ast.$class === `${MetaModelNamespace}.DateTimeScalar` )) { + throw new IllegalModelException( + `Scalar must be one of StringScalar, DateTimeScalar in context of MapKeyType. Invalid Scalar: ${this.type}` + ); + } + + } + + /** + * Returns the ModelFile that defines this class. + * + * @public + * @return {ModelFile} the owning ModelFile + */ + getModelFile() { + return this.parent.getModelFile(); + } + + /** + * Returns the owner of this property + * @public + * @return {MapDeclaration} the parent map declaration + */ + getParent() { + return this.parent; + } + + /** + * Returns the Type of the MapKey. This name does not include the + * namespace from the owning ModelFile. + * + * @return {string} the short name of this class + */ + getType() { + return this.type; + } + + /** + * Returns the string representation of this class + * @return {String} the string representation of the class + */ + toString() { + return 'MapKeyType {id=' + this.getType() + '}'; + } +} + +module.exports = MapKeyType; diff --git a/packages/concerto-core/lib/introspect/mapvaluetype.js b/packages/concerto-core/lib/introspect/mapvaluetype.js new file mode 100644 index 0000000000..483080d6de --- /dev/null +++ b/packages/concerto-core/lib/introspect/mapvaluetype.js @@ -0,0 +1,125 @@ +/* + * 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. + */ + +'use strict'; + +const Decorated = require('./decorated'); +const IllegalModelException = require('../../lib/introspect/illegalmodelexception'); + +// Types needed for TypeScript generation. +/* eslint-disable no-unused-vars */ +/* istanbul ignore next */ +if (global === undefined) { + const ModelFile = require('./modelfile'); +} + +/** + * MapValueType defines a Value type of MapDeclaration. + * + * @extends Decorated + * @see See {@link Decorated} + * @class + * @memberof module:concerto-core + */ +class MapValueType extends Decorated { + /** + * Create an MapValueType. + * @param {MapDeclaration} parent - The owner of this property + * @param {Object} ast - The AST created by the parser + * @throws {IllegalModelException} + */ + constructor(parent, ast) { + super(ast); + this.parent = parent; + this.type = this.ast.name; + this.process(); + } + + /** + * Process the AST and build the model + * + * @throws {IllegalModelException} + * @private + */ + process() { + super.process(); + } + + /** + * Semantic validation of the structure of this class. + * + * @throws {IllegalModelException} + * @protected + */ + validate() { + const declarations = this.getModelFile().getAllDeclarations(); + + const value = declarations.find(decl => decl.name === this.type); + + if (!value?.isConcept?.() && + !value?.isEnum?.() && + !value?.isAsset?.() && + !value?.isEvent?.() && + !value?.isParticipant?.() && + !value?.isTransaction?.() && + !value?.isMapDeclaration?.() && + !value?.isScalarDeclaration?.() && + !['String', 'Long', 'Integer', 'Double', 'Boolean', 'DateTime'].includes(this.type)) { + + throw new IllegalModelException( + `MapPropertyType has invalid Type: ${this.type}` + ); + } + } + + /** + * Returns the ModelFile that defines this class. + * + * @public + * @return {ModelFile} the owning ModelFile + */ + getModelFile() { + return this.parent.getModelFile(); + } + + /** + * Returns the owner of this property + * @public + * @return {MapDeclaration} the parent map declaration + */ + getParent() { + return this.parent; + } + + /** + * Returns the Type of the MapValue. This name does not include the + * namespace from the owning ModelFile. + * + * @return {string} the short name of this class + */ + getType() { + return this.type; + } + + /** + * Returns the string representation of this class + * @return {String} the string representation of the class + */ + toString() { + return 'MapValueType {id=' + this.getType() + '}'; + } + +} + +module.exports = MapValueType; diff --git a/packages/concerto-core/lib/introspect/modelfile.js b/packages/concerto-core/lib/introspect/modelfile.js index f776e99b56..85f51ba256 100644 --- a/packages/concerto-core/lib/introspect/modelfile.js +++ b/packages/concerto-core/lib/introspect/modelfile.js @@ -26,6 +26,7 @@ const ParticipantDeclaration = require('./participantdeclaration'); const TransactionDeclaration = require('./transactiondeclaration'); const EventDeclaration = require('./eventdeclaration'); const IllegalModelException = require('./illegalmodelexception'); +const MapDeclaration = require('./mapdeclaration'); const ModelUtil = require('../modelutil'); const Globalize = require('../globalize'); const Decorated = require('./decorated'); @@ -589,6 +590,14 @@ class ModelFile extends Decorated { return this.getDeclarations(EnumDeclaration); } + /** + * Get the MapDeclarations defined in this ModelFile + * @return {MapDeclaration[]} the MapDeclarations defined in the model file + */ + getMapDeclarations() { + return this.getDeclarations(MapDeclaration); + } + /** * Get the ScalarDeclaration defined in this ModelFile * @return {ScalarDeclaration[]} the ScalarDeclaration defined in the model file @@ -780,6 +789,9 @@ class ModelFile extends Decorated { else if(thing.$class === `${MetaModelNamespace}.EnumDeclaration`) { this.declarations.push( new EnumDeclaration(this, thing) ); } + else if(thing.$class === `${MetaModelNamespace}.MapDeclaration`) { + this.declarations.push( new MapDeclaration(this, thing) ); + } else if(thing.$class === `${MetaModelNamespace}.ConceptDeclaration`) { this.declarations.push( new ConceptDeclaration(this, thing) ); } diff --git a/packages/concerto-core/test/data/model/model-base.cto b/packages/concerto-core/test/data/model/model-base.cto index 97d1ca050b..ec768269a3 100644 --- a/packages/concerto-core/test/data/model/model-base.cto +++ b/packages/concerto-core/test/data/model/model-base.cto @@ -53,6 +53,11 @@ concept UnitedStatesAddress extends Address { o String zipcode } +map Dictionary { + o String + o String +} + /** * Define an asset base class */ diff --git a/packages/concerto-core/test/data/parser/mapdeclaration/mapdeclaration.badkey.declaration.concept.cto b/packages/concerto-core/test/data/parser/mapdeclaration/mapdeclaration.badkey.declaration.concept.cto new file mode 100644 index 0000000000..bc6ad40f4f --- /dev/null +++ b/packages/concerto-core/test/data/parser/mapdeclaration/mapdeclaration.badkey.declaration.concept.cto @@ -0,0 +1,21 @@ +/* + * 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. + */ +namespace com.testing@1.0.0 + +concept NotIdentified {} + +map Dictionary { + o NotIdentified + o String +} diff --git a/packages/concerto-core/test/data/parser/mapdeclaration/mapdeclaration.badkey.declaration.enum.cto b/packages/concerto-core/test/data/parser/mapdeclaration/mapdeclaration.badkey.declaration.enum.cto new file mode 100644 index 0000000000..3989eb351d --- /dev/null +++ b/packages/concerto-core/test/data/parser/mapdeclaration/mapdeclaration.badkey.declaration.enum.cto @@ -0,0 +1,19 @@ +/* + * 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. + */ +namespace com.testing@1.0.0 + +map Dictionary { + o NotDeclared + o String +} diff --git a/packages/concerto-core/test/data/parser/mapdeclaration/mapdeclaration.badkey.declaration.event.cto b/packages/concerto-core/test/data/parser/mapdeclaration/mapdeclaration.badkey.declaration.event.cto new file mode 100644 index 0000000000..069120c62e --- /dev/null +++ b/packages/concerto-core/test/data/parser/mapdeclaration/mapdeclaration.badkey.declaration.event.cto @@ -0,0 +1,21 @@ +/* + * 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. + */ +namespace com.testing@1.0.0 + +event Activity {} + +map Dictionary { + o Activity + o String +} diff --git a/packages/concerto-core/test/data/parser/mapdeclaration/mapdeclaration.badkey.declaration.map.cto b/packages/concerto-core/test/data/parser/mapdeclaration/mapdeclaration.badkey.declaration.map.cto new file mode 100644 index 0000000000..363a0da5c9 --- /dev/null +++ b/packages/concerto-core/test/data/parser/mapdeclaration/mapdeclaration.badkey.declaration.map.cto @@ -0,0 +1,24 @@ +/* + * 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. + */ +namespace com.testing@1.0.0 + +map IllegalMapKey { + o String + o String +} + +map Dictionary { + o IllegalMapKey + o String +} diff --git a/packages/concerto-core/test/data/parser/mapdeclaration/mapdeclaration.badkey.primitive.double.cto b/packages/concerto-core/test/data/parser/mapdeclaration/mapdeclaration.badkey.primitive.double.cto new file mode 100644 index 0000000000..c291befa2b --- /dev/null +++ b/packages/concerto-core/test/data/parser/mapdeclaration/mapdeclaration.badkey.primitive.double.cto @@ -0,0 +1,19 @@ +/* + * 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. + */ +namespace com.testing@1.0.0 + +map Dictionary { + o Double + o String +} diff --git a/packages/concerto-core/test/data/parser/mapdeclaration/mapdeclaration.badkey.primitive.integer.cto b/packages/concerto-core/test/data/parser/mapdeclaration/mapdeclaration.badkey.primitive.integer.cto new file mode 100644 index 0000000000..bc9cbaa473 --- /dev/null +++ b/packages/concerto-core/test/data/parser/mapdeclaration/mapdeclaration.badkey.primitive.integer.cto @@ -0,0 +1,19 @@ +/* + * 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. + */ +namespace com.testing@1.0.0 + +map Dictionary { + o Integer + o String +} diff --git a/packages/concerto-core/test/data/parser/mapdeclaration/mapdeclaration.badkey.primitive.long.cto b/packages/concerto-core/test/data/parser/mapdeclaration/mapdeclaration.badkey.primitive.long.cto new file mode 100644 index 0000000000..e9daab89a5 --- /dev/null +++ b/packages/concerto-core/test/data/parser/mapdeclaration/mapdeclaration.badkey.primitive.long.cto @@ -0,0 +1,19 @@ +/* + * 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. + */ +namespace com.testing@1.0.0 + +map Dictionary { + o Long + o String +} diff --git a/packages/concerto-core/test/data/parser/mapdeclaration/mapdeclaration.badkey.scalar.boolean.cto b/packages/concerto-core/test/data/parser/mapdeclaration/mapdeclaration.badkey.scalar.boolean.cto new file mode 100644 index 0000000000..ad0e06e266 --- /dev/null +++ b/packages/concerto-core/test/data/parser/mapdeclaration/mapdeclaration.badkey.scalar.boolean.cto @@ -0,0 +1,22 @@ +/* + * 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. + */ + +namespace com.acme@1.0.0 + +scalar BOOL extends Boolean + +map Dictionary { + o BOOL + o String +} diff --git a/packages/concerto-core/test/data/parser/mapdeclaration/mapdeclaration.badkey.scalar.double.cto b/packages/concerto-core/test/data/parser/mapdeclaration/mapdeclaration.badkey.scalar.double.cto new file mode 100644 index 0000000000..7ce298cc06 --- /dev/null +++ b/packages/concerto-core/test/data/parser/mapdeclaration/mapdeclaration.badkey.scalar.double.cto @@ -0,0 +1,21 @@ +/* + * 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. + */ +namespace com.testing@1.0.0 + +scalar BAD extends Double + +map Dictionary { + o BAD + o String +} diff --git a/packages/concerto-core/test/data/parser/mapdeclaration/mapdeclaration.badkey.scalar.integer.cto b/packages/concerto-core/test/data/parser/mapdeclaration/mapdeclaration.badkey.scalar.integer.cto new file mode 100644 index 0000000000..2cfb9f6137 --- /dev/null +++ b/packages/concerto-core/test/data/parser/mapdeclaration/mapdeclaration.badkey.scalar.integer.cto @@ -0,0 +1,21 @@ +/* + * 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. + */ +namespace com.testing@1.0.0 + +scalar BAD extends Integer + +map Dictionary { + o BAD + o String +} diff --git a/packages/concerto-core/test/data/parser/mapdeclaration/mapdeclaration.badkey.scalar.long.cto b/packages/concerto-core/test/data/parser/mapdeclaration/mapdeclaration.badkey.scalar.long.cto new file mode 100644 index 0000000000..98c2ba8a97 --- /dev/null +++ b/packages/concerto-core/test/data/parser/mapdeclaration/mapdeclaration.badkey.scalar.long.cto @@ -0,0 +1,21 @@ +/* + * 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. + */ +namespace com.testing@1.0.0 + +scalar BAD extends Long + +map Dictionary { + o BAD + o String +} diff --git a/packages/concerto-core/test/data/parser/mapdeclaration/mapdeclaration.badvalue.nontype.cto b/packages/concerto-core/test/data/parser/mapdeclaration/mapdeclaration.badvalue.nontype.cto new file mode 100644 index 0000000000..3b7c952302 --- /dev/null +++ b/packages/concerto-core/test/data/parser/mapdeclaration/mapdeclaration.badvalue.nontype.cto @@ -0,0 +1,24 @@ +/* + * 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. + */ + +namespace com.acme@1.0.0 + +enum Phase { + o ONE + o TWO +} +map Dictionary { + o Phase + o NONTYPE +} diff --git a/packages/concerto-core/test/data/parser/mapdeclaration/mapdeclaration.goodkey.declaration.concept.cto b/packages/concerto-core/test/data/parser/mapdeclaration/mapdeclaration.goodkey.declaration.concept.cto new file mode 100644 index 0000000000..7ad76e688c --- /dev/null +++ b/packages/concerto-core/test/data/parser/mapdeclaration/mapdeclaration.goodkey.declaration.concept.cto @@ -0,0 +1,22 @@ +/* + * 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. + */ + +namespace com.testing@1.0.0 //todo makek sure namesapce is same for all test concepts + +concept Person identified {} + +map Dictionary { + o Person + o String +} diff --git a/packages/concerto-core/test/data/parser/mapdeclaration/mapdeclaration.goodkey.declaration.enum.cto b/packages/concerto-core/test/data/parser/mapdeclaration/mapdeclaration.goodkey.declaration.enum.cto new file mode 100644 index 0000000000..b46f62cef1 --- /dev/null +++ b/packages/concerto-core/test/data/parser/mapdeclaration/mapdeclaration.goodkey.declaration.enum.cto @@ -0,0 +1,24 @@ +/* + * 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. + */ + +namespace com.acme@1.0.0 + +enum Phase { + o ONE + o TWO +} +map Dictionary { + o Phase + o String +} diff --git a/packages/concerto-core/test/data/parser/mapdeclaration/mapdeclaration.goodkey.primitive.boolean.cto b/packages/concerto-core/test/data/parser/mapdeclaration/mapdeclaration.goodkey.primitive.boolean.cto new file mode 100644 index 0000000000..248a09f9de --- /dev/null +++ b/packages/concerto-core/test/data/parser/mapdeclaration/mapdeclaration.goodkey.primitive.boolean.cto @@ -0,0 +1,20 @@ +/* + * 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. + */ + +namespace com.acme@1.0.0 + +map Dictionary { + o Boolean + o String +} diff --git a/packages/concerto-core/test/data/parser/mapdeclaration/mapdeclaration.goodkey.primitive.datetime.cto b/packages/concerto-core/test/data/parser/mapdeclaration/mapdeclaration.goodkey.primitive.datetime.cto new file mode 100644 index 0000000000..bbddd46c90 --- /dev/null +++ b/packages/concerto-core/test/data/parser/mapdeclaration/mapdeclaration.goodkey.primitive.datetime.cto @@ -0,0 +1,20 @@ +/* + * 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. + */ + +namespace com.acme@1.0.0 + +map Dictionary { + o DateTime + o String +} diff --git a/packages/concerto-core/test/data/parser/mapdeclaration/mapdeclaration.goodkey.primitive.string.cto b/packages/concerto-core/test/data/parser/mapdeclaration/mapdeclaration.goodkey.primitive.string.cto new file mode 100644 index 0000000000..9c6b668dce --- /dev/null +++ b/packages/concerto-core/test/data/parser/mapdeclaration/mapdeclaration.goodkey.primitive.string.cto @@ -0,0 +1,20 @@ +/* + * 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. + */ + +namespace com.acme@1.0.0 + +map Dictionary { + o String + o String +} diff --git a/packages/concerto-core/test/data/parser/mapdeclaration/mapdeclaration.goodkey.scalar.datetime.cto b/packages/concerto-core/test/data/parser/mapdeclaration/mapdeclaration.goodkey.scalar.datetime.cto new file mode 100644 index 0000000000..905c590164 --- /dev/null +++ b/packages/concerto-core/test/data/parser/mapdeclaration/mapdeclaration.goodkey.scalar.datetime.cto @@ -0,0 +1,22 @@ +/* + * 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. + */ + +namespace com.acme@1.0.0 + +scalar DATE extends DateTime + +map Dictionary { + o DATE + o String +} diff --git a/packages/concerto-core/test/data/parser/mapdeclaration/mapdeclaration.goodkey.scalar.string.cto b/packages/concerto-core/test/data/parser/mapdeclaration/mapdeclaration.goodkey.scalar.string.cto new file mode 100644 index 0000000000..a57d33cf0c --- /dev/null +++ b/packages/concerto-core/test/data/parser/mapdeclaration/mapdeclaration.goodkey.scalar.string.cto @@ -0,0 +1,22 @@ +/* + * 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. + */ + +namespace com.acme@1.0.0 + +scalar GUID extends String + +map Dictionary { + o GUID + o String +} diff --git a/packages/concerto-core/test/data/parser/mapdeclaration/mapdeclaration.goodvalue.declaration.asset.cto b/packages/concerto-core/test/data/parser/mapdeclaration/mapdeclaration.goodvalue.declaration.asset.cto new file mode 100644 index 0000000000..eea3c33279 --- /dev/null +++ b/packages/concerto-core/test/data/parser/mapdeclaration/mapdeclaration.goodvalue.declaration.asset.cto @@ -0,0 +1,23 @@ +/* + * 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. + */ +namespace com.testing@1.0.0 + +asset Vehicle identified by vin { + o String vin +} + +map Dictionary { + o String + o Vehicle +} diff --git a/packages/concerto-core/test/data/parser/mapdeclaration/mapdeclaration.goodvalue.declaration.concept.cto b/packages/concerto-core/test/data/parser/mapdeclaration/mapdeclaration.goodvalue.declaration.concept.cto new file mode 100644 index 0000000000..2e040606c3 --- /dev/null +++ b/packages/concerto-core/test/data/parser/mapdeclaration/mapdeclaration.goodvalue.declaration.concept.cto @@ -0,0 +1,21 @@ +/* + * 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. + */ +namespace com.testing@1.0.0 + +concept Person identified {} + +map Dictionary { + o String + o Person +} diff --git a/packages/concerto-core/test/data/parser/mapdeclaration/mapdeclaration.goodvalue.declaration.derived.concept.cto b/packages/concerto-core/test/data/parser/mapdeclaration/mapdeclaration.goodvalue.declaration.derived.concept.cto new file mode 100644 index 0000000000..36f4f363ff --- /dev/null +++ b/packages/concerto-core/test/data/parser/mapdeclaration/mapdeclaration.goodvalue.declaration.derived.concept.cto @@ -0,0 +1,23 @@ +/* + * 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. + */ +namespace com.testing@1.0.0 + +concept Human identified {} + +concept Person extends Human {} + +map Dictionary { + o String + o Person +} diff --git a/packages/concerto-core/test/data/parser/mapdeclaration/mapdeclaration.goodvalue.declaration.event.cto b/packages/concerto-core/test/data/parser/mapdeclaration/mapdeclaration.goodvalue.declaration.event.cto new file mode 100644 index 0000000000..67f879b437 --- /dev/null +++ b/packages/concerto-core/test/data/parser/mapdeclaration/mapdeclaration.goodvalue.declaration.event.cto @@ -0,0 +1,21 @@ +/* + * 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. + */ +namespace com.testing@1.0.0 + +event Activity {} + +map Dictionary { + o String + o Activity +} diff --git a/packages/concerto-core/test/data/parser/mapdeclaration/mapdeclaration.goodvalue.declaration.map.cto b/packages/concerto-core/test/data/parser/mapdeclaration/mapdeclaration.goodvalue.declaration.map.cto new file mode 100644 index 0000000000..d18f6453ef --- /dev/null +++ b/packages/concerto-core/test/data/parser/mapdeclaration/mapdeclaration.goodvalue.declaration.map.cto @@ -0,0 +1,24 @@ +/* + * 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. + */ +namespace com.testing@1.0.0 + +map Dictionary { + o String + o String +} + +map Dictionary { + o String + o Dictionary +} diff --git a/packages/concerto-core/test/data/parser/mapdeclaration/mapdeclaration.goodvalue.declaration.participant.cto b/packages/concerto-core/test/data/parser/mapdeclaration/mapdeclaration.goodvalue.declaration.participant.cto new file mode 100644 index 0000000000..c3d08c9cc3 --- /dev/null +++ b/packages/concerto-core/test/data/parser/mapdeclaration/mapdeclaration.goodvalue.declaration.participant.cto @@ -0,0 +1,23 @@ +/* + * 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. + */ +namespace com.testing@1.0.0 + +participant Customer identified by email { + o String email +} + +map Customer { + o String + o Customer +} diff --git a/packages/concerto-core/test/data/parser/mapdeclaration/mapdeclaration.goodvalue.declaration.relationship.cto b/packages/concerto-core/test/data/parser/mapdeclaration/mapdeclaration.goodvalue.declaration.relationship.cto new file mode 100644 index 0000000000..2fd1e84350 --- /dev/null +++ b/packages/concerto-core/test/data/parser/mapdeclaration/mapdeclaration.goodvalue.declaration.relationship.cto @@ -0,0 +1,21 @@ +/* + * 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. + */ +namespace com.testing@1.0.0 + +concept Person identified {} + +map Dictionary { + o String + --> Person +} diff --git a/packages/concerto-core/test/data/parser/mapdeclaration/mapdeclaration.goodvalue.declaration.transaction.cto b/packages/concerto-core/test/data/parser/mapdeclaration/mapdeclaration.goodvalue.declaration.transaction.cto new file mode 100644 index 0000000000..9c3d8dc4b3 --- /dev/null +++ b/packages/concerto-core/test/data/parser/mapdeclaration/mapdeclaration.goodvalue.declaration.transaction.cto @@ -0,0 +1,22 @@ +/* + * 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. + */ +namespace com.testing@1.0.0 + +transaction Order { +} + +map Customer { + o String + o Order +} diff --git a/packages/concerto-core/test/data/parser/mapdeclaration/mapdeclaration.goodvalue.primitive.datetime.cto b/packages/concerto-core/test/data/parser/mapdeclaration/mapdeclaration.goodvalue.primitive.datetime.cto new file mode 100644 index 0000000000..c3045aca97 --- /dev/null +++ b/packages/concerto-core/test/data/parser/mapdeclaration/mapdeclaration.goodvalue.primitive.datetime.cto @@ -0,0 +1,19 @@ +/* + * 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. + */ +namespace com.testing@1.0.0 + +map Dictionary { + o String + o DateTime +} diff --git a/packages/concerto-core/test/data/parser/mapdeclaration/mapdeclaration.goodvalue.primitive.double.cto b/packages/concerto-core/test/data/parser/mapdeclaration/mapdeclaration.goodvalue.primitive.double.cto new file mode 100644 index 0000000000..30c4285638 --- /dev/null +++ b/packages/concerto-core/test/data/parser/mapdeclaration/mapdeclaration.goodvalue.primitive.double.cto @@ -0,0 +1,19 @@ +/* + * 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. + */ +namespace com.testing@1.0.0 + +map Dictionary { + o String + o Double +} diff --git a/packages/concerto-core/test/data/parser/mapdeclaration/mapdeclaration.goodvalue.primitive.integer.cto b/packages/concerto-core/test/data/parser/mapdeclaration/mapdeclaration.goodvalue.primitive.integer.cto new file mode 100644 index 0000000000..a98faf1ea6 --- /dev/null +++ b/packages/concerto-core/test/data/parser/mapdeclaration/mapdeclaration.goodvalue.primitive.integer.cto @@ -0,0 +1,19 @@ +/* + * 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. + */ +namespace com.testing@1.0.0 + +map Dictionary { + o String + o Integer +} diff --git a/packages/concerto-core/test/data/parser/mapdeclaration/mapdeclaration.goodvalue.primitive.long.cto b/packages/concerto-core/test/data/parser/mapdeclaration/mapdeclaration.goodvalue.primitive.long.cto new file mode 100644 index 0000000000..b57623be94 --- /dev/null +++ b/packages/concerto-core/test/data/parser/mapdeclaration/mapdeclaration.goodvalue.primitive.long.cto @@ -0,0 +1,19 @@ +/* + * 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. + */ +namespace com.testing@1.0.0 + +map Dictionary { + o String + o Long +} diff --git a/packages/concerto-core/test/data/parser/mapdeclaration/mapdeclaration.goodvalue.primitive.string.cto b/packages/concerto-core/test/data/parser/mapdeclaration/mapdeclaration.goodvalue.primitive.string.cto new file mode 100644 index 0000000000..5aa6cf0d93 --- /dev/null +++ b/packages/concerto-core/test/data/parser/mapdeclaration/mapdeclaration.goodvalue.primitive.string.cto @@ -0,0 +1,19 @@ +/* + * 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. + */ +namespace com.testing@1.0.0 + +map Dictionary { + o String + o String +} diff --git a/packages/concerto-core/test/introspect/classdeclaration.js b/packages/concerto-core/test/introspect/classdeclaration.js index f427cdc90e..60a365ed49 100644 --- a/packages/concerto-core/test/introspect/classdeclaration.js +++ b/packages/concerto-core/test/introspect/classdeclaration.js @@ -222,6 +222,16 @@ describe('ClassDeclaration', () => { clz.isEnum().should.equal(true); }); + it('should return true for maps', () => { + let clz = new ClassDeclaration(modelFile, { + name: 'suchName', + $class: `${MetaModelNamespace}.MapDeclaration`, + properties: [ + ] + }); + clz.isMapDeclaration().should.equal(true); + }); + it('should return true for transactions', () => { let clz = new ClassDeclaration(modelFile, { name: 'suchName', diff --git a/packages/concerto-core/test/introspect/introspector.js b/packages/concerto-core/test/introspect/introspector.js index 5f5c9c93b9..f4b5961a83 100644 --- a/packages/concerto-core/test/introspect/introspector.js +++ b/packages/concerto-core/test/introspect/introspector.js @@ -44,6 +44,7 @@ describe('Introspector', () => { describe('#getClassDeclarations', () => { it('should return all class declarations', () => { + process.env.ENABLE_MAP_TYPE = 'true'; // TODO Remove on release of MapType. // create and populate the ModelManager with a model file const modelManager = new ModelManager(); Util.addComposerModel(modelManager); @@ -55,13 +56,14 @@ describe('Introspector', () => { modelManager.addCTOModel(modelBase, 'model-base.cto'); const introspector = new Introspector(modelManager); let classDecl = introspector.getClassDeclarations(); - classDecl.length.should.equal(44); + classDecl.length.should.equal(45); }); }); describe('#getClassDeclaration', () => { it('should be able to get a single class declaration', () => { + process.env.ENABLE_MAP_TYPE = 'true'; // TODO Remove on release of MapType. // create and populate the ModelManager with a model file const modelManager = new ModelManager(); Util.addComposerModel(modelManager); diff --git a/packages/concerto-core/test/introspect/mapdeclaration.js b/packages/concerto-core/test/introspect/mapdeclaration.js new file mode 100644 index 0000000000..e473d08249 --- /dev/null +++ b/packages/concerto-core/test/introspect/mapdeclaration.js @@ -0,0 +1,491 @@ +/* + * 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. + */ + +'use strict'; + +const IllegalModelException = require('../../lib/introspect/illegalmodelexception'); + +const MapDeclaration = require('../../lib/introspect/mapdeclaration'); +const MapKeyType = require('../../lib/introspect/mapkeytype'); +const MapValueType = require('../../lib/introspect/mapvaluetype'); + +const IntrospectUtils = require('./introspectutils'); +const ParserUtil = require('./parserutility'); + +const ModelManager = require('../../lib/modelmanager'); +const Util = require('../composer/composermodelutility'); + +const sinon = require('sinon'); + + +describe('MapDeclaration', () => { + + let modelManager; + let modelFile; + let introspectUtils; + + beforeEach(() => { + modelManager = new ModelManager(); + Util.addComposerModel(modelManager); + introspectUtils = new IntrospectUtils(modelManager); + modelFile = ParserUtil.newModelFile(modelManager, 'namespace com.test', 'mapdeclaration.cto'); + process.env.ENABLE_MAP_TYPE = 'true'; // TODO Remove on release of MapType. + }); + + describe('#constructor', () => { + + it('should throw if ast contains no MapKeyType', () => { + (() => { + new MapDeclaration(modelFile, { + name: 'MapTest', + properties: [ + { + '$class': 'concerto.metamodel@1.0.0.MapKeyType', + name: 'String' + } + ] + }); + }).should.throw(IllegalModelException); + }); + + it('should throw if ast contains no MapValueType', () => { + (() => { + new MapDeclaration(modelFile, { + name: 'MapTest', + properties: [ + { + '$class': 'concerto.metamodel@1.0.0.MapKeyType', + name: 'Integer' + }, + { + '$class': 'concerto.metamodel@1.0.0.SomeRandomInvalidType', + name: 'String' + },] + }); + }).should.throw(IllegalModelException); + }); + + it('should throw if ast does not contain exactly two properties', () => { + (() => { + new MapDeclaration(modelFile, { + name: 'MapTest', + properties: [ + { + '$class': 'concerto.metamodel@1.0.0.MapKeyType', + name: 'String' + }, + { + '$class': 'concerto.metamodel@1.0.0.AggregateValueType', + name: 'String' + }, + { + '$class': 'concerto.metamodel@1.0.0.StringProperty', + name: 'String' + } + ] + }); + }).should.throw(IllegalModelException); + }); + + it('should throw if no feature flag', () => { + process.env.ENABLE_MAP_TYPE = 'false'; + (() => + { + new MapDeclaration(modelFile, { + name: 'MapTest', + properties: [ + { + '$class': 'concerto.metamodel@1.0.0.MapKeyType', + name: 'String' + }, + { + '$class': 'concerto.metamodel@1.0.0.AggregateValueType', + name: 'String' + } + ] + }); + }).should.throw(/MapType feature is not enabled. Please set the environment variable "ENABLE_MAP_TYPE=true" to access this functionality./); + process.env.ENABLE_MAP_TYPE = 'true'; // enable after the test run. This is necessary to ensure functioning of other tests. + }); + + it('should throw if ast contains properties other than MapKeyType, AggregateValueType & AggregateRelationshipValueType', () => { + (() => { + new MapDeclaration(modelFile, { + name: 'MapTest', + properties: [ + { + '$class': 'concerto.metamodel@1.0.0.StringProperty', + name: 'String' + }, + { + '$class': 'concerto.metamodel@1.0.0.StringProperty', + name: 'String' + } + ] + }); + }).should.throw(IllegalModelException); + }); + }); + + describe('#validate success scenarios', () => { + + it('should not throw when map key is an identified concept declaration', () => { + let decl = introspectUtils.loadLastDeclaration('test/data/parser/mapdeclaration/mapdeclaration.goodkey.declaration.concept.cto', MapDeclaration); + decl.validate(); + }); + + it('should not throw when map key is an enum declaration', () => { + let decl = introspectUtils.loadLastDeclaration('test/data/parser/mapdeclaration/mapdeclaration.goodkey.declaration.enum.cto', MapDeclaration); + decl.validate(); + }); + + it('should not throw when map key is primitive type datetime', () => { + let decl = introspectUtils.loadLastDeclaration('test/data/parser/mapdeclaration/mapdeclaration.goodkey.primitive.datetime.cto', MapDeclaration); + decl.validate(); + }); + + it('should not throw when map key is primitive type string', () => { + let decl = introspectUtils.loadLastDeclaration('test/data/parser/mapdeclaration/mapdeclaration.goodkey.primitive.string.cto', MapDeclaration); + decl.validate(); + }); + + it('should not throw when map key is primitive type string datetime', () => { + let decl = introspectUtils.loadLastDeclaration('test/data/parser/mapdeclaration/mapdeclaration.goodkey.scalar.datetime.cto', MapDeclaration); + decl.validate(); + }); + + it('should not throw when map key is primitive type scalar string', () => { + let decl = introspectUtils.loadLastDeclaration('test/data/parser/mapdeclaration/mapdeclaration.goodkey.scalar.string.cto', MapDeclaration); + decl.validate(); + }); + + it('should not throw when map value is an identified concept declaration', () => { + let decl = introspectUtils.loadLastDeclaration('test/data/parser/mapdeclaration/mapdeclaration.goodvalue.declaration.concept.cto', MapDeclaration); + decl.validate(); + }); + + it('should not throw when map value is a concept derived from another concept declaration', () => { + let decl = introspectUtils.loadLastDeclaration('test/data/parser/mapdeclaration/mapdeclaration.goodvalue.declaration.derived.concept.cto', MapDeclaration); + decl.validate(); + }); + + it('should not throw when map value is an event declaration', () => { + let decl = introspectUtils.loadLastDeclaration('test/data/parser/mapdeclaration/mapdeclaration.goodvalue.declaration.event.cto', MapDeclaration); + decl.validate(); + }); + + it('should not throw when map value is an asset declaration', () => { + let decl = introspectUtils.loadLastDeclaration('test/data/parser/mapdeclaration/mapdeclaration.goodvalue.declaration.asset.cto', MapDeclaration); + decl.validate(); + }); + + it('should not throw when map value is an transaction declaration', () => { + let decl = introspectUtils.loadLastDeclaration('test/data/parser/mapdeclaration/mapdeclaration.goodvalue.declaration.transaction.cto', MapDeclaration); + decl.validate(); + }); + + it('should not throw when map value is an participant declaration', () => { + let decl = introspectUtils.loadLastDeclaration('test/data/parser/mapdeclaration/mapdeclaration.goodvalue.declaration.participant.cto', MapDeclaration); + decl.validate(); + }); + + it('should not throw when map value is a map declaration', () => { + let decl = introspectUtils.loadLastDeclaration('test/data/parser/mapdeclaration/mapdeclaration.goodvalue.declaration.map.cto', MapDeclaration); + decl.validate(); + }); + + it('should not throw when map value is a relationship', () => { + let decl = introspectUtils.loadLastDeclaration('test/data/parser/mapdeclaration/mapdeclaration.goodvalue.declaration.relationship.cto', MapDeclaration); + decl.validate(); + }); + + it('should not throw when map value is a primitive string', () => { + let decl = introspectUtils.loadLastDeclaration('test/data/parser/mapdeclaration/mapdeclaration.goodvalue.primitive.string.cto', MapDeclaration); + decl.validate(); + }); + + it('should not throw when map value is a primitive datetime', () => { + let decl = introspectUtils.loadLastDeclaration('test/data/parser/mapdeclaration/mapdeclaration.goodvalue.primitive.datetime.cto', MapDeclaration); + decl.validate(); + }); + + it('should not throw when map value is a primitive double', () => { + let decl = introspectUtils.loadLastDeclaration('test/data/parser/mapdeclaration/mapdeclaration.goodvalue.primitive.double.cto', MapDeclaration); + decl.validate(); + }); + + it('should not throw when map value is a primitive integer', () => { + let decl = introspectUtils.loadLastDeclaration('test/data/parser/mapdeclaration/mapdeclaration.goodvalue.primitive.integer.cto', MapDeclaration); + decl.validate(); + }); + + it('should not throw when map value is a primitive long', () => { + let decl = introspectUtils.loadLastDeclaration('test/data/parser/mapdeclaration/mapdeclaration.goodvalue.primitive.long.cto', MapDeclaration); + decl.validate(); + }); + + }); + + describe('#validate failure scenarios', () => { + it('should throw validating with a non-identified concept declaration as key', function() { + (() => { + let decl = introspectUtils.loadLastDeclaration('test/data/parser/mapdeclaration/mapdeclaration.badkey.declaration.concept.cto', MapDeclaration); + decl.validate(); + }).should.throw(/ConceptDeclaration must be identified in context of MapKeyType: NotIdentified/); + }); + + it('should throw when an enum key declaration missing', function() { + (() => { + let decl = introspectUtils.loadLastDeclaration('test/data/parser/mapdeclaration/mapdeclaration.badkey.declaration.enum.cto', MapDeclaration); + decl.validate(); + }).should.throw(/MapKeyType has invalid Type: NotDeclared/); + }); + + it('should throw when map value is an illegal type', function() { + (() => { + let decl = introspectUtils.loadLastDeclaration('test/data/parser/mapdeclaration/mapdeclaration.badvalue.nontype.cto', MapDeclaration); + decl.validate(); + }).should.throw(/MapPropertyType has invalid Type: NONTYPE/); + }); + + it('should throw when map key is a boolean', function() { + (() => { + let decl = introspectUtils.loadLastDeclaration('test/data/parser/mapdeclaration/mapdeclaration.badkey.scalar.boolean.cto', MapDeclaration); + decl.validate(); + }).should.throw(/Scalar must be one of StringScalar, DateTimeScalar in context of MapKeyType. Invalid Scalar: BOOL/); + }); + + it('should throw when map key is an event declaration', function() { + (() => { + let decl = introspectUtils.loadLastDeclaration('test/data/parser/mapdeclaration/mapdeclaration.badkey.declaration.event.cto', MapDeclaration); + decl.validate(); + }).should.throw(/MapKeyType has invalid Type: Activity/); + }); + + it('should throw when map key is of type MapDeclaration', function() { + (() => { + let decl = introspectUtils.loadLastDeclaration('test/data/parser/mapdeclaration/mapdeclaration.badkey.declaration.map.cto', MapDeclaration); + decl.validate(); + }).should.throw(/MapKeyType has invalid Type: IllegalMapKey/); + }); + + it('should throw when map key is of primitive type Double', function() { + (() => { + let decl = introspectUtils.loadLastDeclaration('test/data/parser/mapdeclaration/mapdeclaration.badkey.primitive.double.cto', MapDeclaration); + decl.validate(); + }).should.throw(/MapKeyType has invalid Type: Double/); + }); + + it('should throw when map key is of primitive type Integer', function() { + (() => { + let decl = introspectUtils.loadLastDeclaration('test/data/parser/mapdeclaration/mapdeclaration.badkey.primitive.integer.cto', MapDeclaration); + decl.validate(); + }).should.throw(/MapKeyType has invalid Type: Integer/); + }); + + it('should throw when map key is of primitive type Long', function() { + (() => { + let decl = introspectUtils.loadLastDeclaration('test/data/parser/mapdeclaration/mapdeclaration.badkey.primitive.long.cto', MapDeclaration); + decl.validate(); + }).should.throw(/MapKeyType has invalid Type: Long/); + }); + + it('should throw when map key is of scalar type Double', function() { + (() => { + let decl = introspectUtils.loadLastDeclaration('test/data/parser/mapdeclaration/mapdeclaration.badkey.scalar.double.cto', MapDeclaration); + decl.validate(); + }).should.throw(/Scalar must be one of StringScalar, DateTimeScalar in context of MapKeyType. Invalid Scalar: BAD/); + }); + + it('should throw when map key is of scalar type Integer', function() { + (() => { + let decl = introspectUtils.loadLastDeclaration('test/data/parser/mapdeclaration/mapdeclaration.badkey.scalar.integer.cto', MapDeclaration); + decl.validate(); + }).should.throw(/Scalar must be one of StringScalar, DateTimeScalar in context of MapKeyType. Invalid Scalar: BAD/); + }); + + it('should throw when map key is of scalar type Long', function() { + (() => { + let decl = introspectUtils.loadLastDeclaration('test/data/parser/mapdeclaration/mapdeclaration.badkey.scalar.long.cto', MapDeclaration); + decl.validate(); + }).should.throw(/Scalar must be one of StringScalar, DateTimeScalar in context of MapKeyType. Invalid Scalar: BAD/); + }); + }); + + describe('#accept', () => { + it('should call the visitor', () => { + let clz = new MapDeclaration(modelFile, { + name: 'MapTest', + properties: [ + { + '$class': 'concerto.metamodel@1.0.0.MapKeyType', + name: 'String' + }, + { + '$class': 'concerto.metamodel@1.0.0.AggregateValueType', + name: 'String' + } + ] + }); + let visitor = { + visit: sinon.stub() + }; + clz.accept(visitor, ['some', 'args']); + sinon.assert.calledOnce(visitor.visit); + sinon.assert.calledWith(visitor.visit, clz, ['some', 'args']); + }); + + }); + + describe('#getKey', () => { + it('should return the map key property', () => { + let clz = new MapDeclaration(modelFile, { + name: 'MapTest', + properties: [ + { + '$class': 'concerto.metamodel@1.0.0.MapKeyType', + name: 'DateTime' + }, + { + '$class': 'concerto.metamodel@1.0.0.AggregateValueType', + name: 'String' + } + ] + }); + (clz.getKey() instanceof MapKeyType).should.be.equal(true); + clz.getKey().ast.$class.should.equal('concerto.metamodel@1.0.0.MapKeyType'); + clz.getKey().ast.name.should.equal('DateTime'); + }); + + it('should return the correct values when called', () => { + let clz = new MapDeclaration(modelFile, { + name: 'MapTest', + properties: [ + { + '$class': 'concerto.metamodel@1.0.0.MapKeyType', + name: 'DateTime' + }, + { + '$class': 'concerto.metamodel@1.0.0.AggregateValueType', + name: 'String' + } + ] + }); + clz.getKey().getType().should.equal('DateTime'); + }); + }); + + describe('#getValue', () => { + it('should return the map value property', () => { + let clz = new MapDeclaration(modelFile, { + name: 'MapTest', + properties: [ + { + '$class': 'concerto.metamodel@1.0.0.MapKeyType', + name: 'DateTime' + }, + { + '$class': 'concerto.metamodel@1.0.0.AggregateValueType', + name: 'String' + } + ] + }); + (clz.getValue() instanceof MapValueType).should.be.equal(true); + clz.getValue().ast.$class.should.equal('concerto.metamodel@1.0.0.AggregateValueType'); + clz.getValue().ast.name.should.equal('String'); + }); + + it('should return the correct values when called', () => { + let clz = new MapDeclaration(modelFile, { + name: 'MapTest', + properties: [ + { + '$class': 'concerto.metamodel@1.0.0.MapKeyType', + name: 'DateTime' + }, + { + '$class': 'concerto.metamodel@1.0.0.AggregateValueType', + name: 'String' + } + ] + }); + clz.getValue().getType().should.equal('String'); + }); + }); + + describe('#getProperties', () => { + it('should return the map properties', () => { + let clz = new MapDeclaration(modelFile, { + name: 'MapTest', + properties: [ + { + '$class': 'concerto.metamodel@1.0.0.MapKeyType', + 'name': 'String' + }, + { + '$class': 'concerto.metamodel@1.0.0.AggregateValueType', + 'name': 'String' + } + ] + }); + clz.getProperties().length.should.be.equal(2); + }); + }); + + + describe('#Introspect', () => { + it('should return the correct model file', () => { + let clz = new MapDeclaration(modelFile, { + name: 'MapTest', + properties: [ + { + '$class': 'concerto.metamodel@1.0.0.MapKeyType', + 'name': 'String' + }, + { + '$class': 'concerto.metamodel@1.0.0.AggregateValueType', + 'name': 'String' + } + ] + }); + clz.getModelFile().should.equal(modelFile); + clz.getKey().getModelFile().should.equal(modelFile); + clz.getValue().getModelFile().should.equal(modelFile); + }); + + it('should return the correct value on introspection', () => { + let declaration = introspectUtils.loadLastDeclaration('test/data/parser/mapdeclaration/mapdeclaration.goodkey.declaration.concept.cto', MapDeclaration); + declaration.declarationKind().should.equal('MapDeclaration'); + declaration.getFullyQualifiedName().should.equal('com.testing@1.0.0.Dictionary'); + declaration.isMapDeclaration().should.equal(true); + }); + }); + + describe('#toString', () => { + it('should give the correct value for Map Declaration', () => { + let declaration = introspectUtils.loadLastDeclaration('test/data/parser/mapdeclaration/mapdeclaration.goodkey.declaration.concept.cto', MapDeclaration); + declaration.toString().should.equal('MapDeclaration {id=com.testing@1.0.0.Dictionary}'); + declaration.getKey().toString().should.equal('MapKeyType {id=Person}'); + declaration.getValue().toString().should.equal('MapValueType {id=String}'); + }); + }); + + describe('#getParent', () => { + it('should return the correct parent MapDeclaration value ', () => { + let declaration = introspectUtils.loadLastDeclaration('test/data/parser/mapdeclaration/mapdeclaration.goodkey.declaration.concept.cto', MapDeclaration); + declaration.getKey().getParent().should.equal(declaration); + declaration.getValue().getParent().should.equal(declaration); + }); + }); +}); diff --git a/packages/concerto-core/test/modelmanager.js b/packages/concerto-core/test/modelmanager.js index ef6e115dfc..d3b2878438 100644 --- a/packages/concerto-core/test/modelmanager.js +++ b/packages/concerto-core/test/modelmanager.js @@ -22,6 +22,7 @@ const AssetDeclaration = require('../lib/introspect/assetdeclaration'); const ConceptDeclaration = require('../lib/introspect/conceptdeclaration'); const DecoratorFactory = require('../lib/introspect/decoratorfactory'); const EnumDeclaration = require('../lib/introspect/enumdeclaration'); +const MapDeclaration = require('../lib/introspect/mapdeclaration'); const EventDeclaration = require('../lib/introspect/eventdeclaration'); const Factory = require('../lib/factory'); const ModelFile = require('../lib/introspect/modelfile'); @@ -873,6 +874,17 @@ concept Bar { }); + describe('#getMapDeclarations', () => { + + it('should return all of the map declarations', () => { + modelManager.addCTOModel(modelBase); + let decls = modelManager.getMapDeclarations(); + decls.should.all.be.an.instanceOf(MapDeclaration); + decls.length.should.equal(1); + }); + + }); + describe('#getTransactionDeclarations', () => { it('should return all of the transaction declarations', () => { @@ -1051,7 +1063,7 @@ concept Bar { modelManager.addModelFiles([composerModel, modelBase, farm2fork, concertoModel]); modelManager.getModelFiles().length.should.equal(5); - modelManager.getModelFiles().map(mf => mf.getAllDeclarations()).flat().length.should.equal(68); + modelManager.getModelFiles().map(mf => mf.getAllDeclarations()).flat().length.should.equal(69); const filtered = modelManager.filter(declaration => declaration.getFullyQualifiedName() === 'org.accordproject.test.Product'); diff --git a/packages/concerto-core/types/lib/basemodelmanager.d.ts b/packages/concerto-core/types/lib/basemodelmanager.d.ts index 94c3802071..cb541d8107 100644 --- a/packages/concerto-core/types/lib/basemodelmanager.d.ts +++ b/packages/concerto-core/types/lib/basemodelmanager.d.ts @@ -240,6 +240,11 @@ declare class BaseModelManager { * @return {ParticipantDeclaration[]} the ParticipantDeclaration defined in the model manager */ getParticipantDeclarations(): ParticipantDeclaration[]; + /** + * Get the MapDeclarations defined in this model manager + * @return {MapDeclaration[]} the MapDeclaration defined in the model manager + */ + getMapDeclarations(): MapDeclaration[]; /** * Get the EnumDeclarations defined in this model manager * @return {EnumDeclaration[]} the EnumDeclaration defined in the model manager diff --git a/packages/concerto-core/types/lib/introspect/classdeclaration.d.ts b/packages/concerto-core/types/lib/introspect/classdeclaration.d.ts index d94496be1a..93ace461b0 100644 --- a/packages/concerto-core/types/lib/introspect/classdeclaration.d.ts +++ b/packages/concerto-core/types/lib/introspect/classdeclaration.d.ts @@ -149,6 +149,12 @@ declare class ClassDeclaration extends Declaration { * @return {boolean} true if the class is an asset */ isConcept(): boolean; + /** + * Returns true if this class is the definition of a map. + * + * @return {boolean} true if the class is an asset + */ + isMapDeclaration(): boolean; } import Declaration = require("./declaration"); import Property = require("./property"); diff --git a/packages/concerto-core/types/lib/introspect/mapdeclaration.d.ts b/packages/concerto-core/types/lib/introspect/mapdeclaration.d.ts new file mode 100644 index 0000000000..0ee7814082 --- /dev/null +++ b/packages/concerto-core/types/lib/introspect/mapdeclaration.d.ts @@ -0,0 +1,97 @@ +export = MapDeclaration; +/** + * MapDeclaration defines a Map data structure, which allows storage of a collection + * of values, where each value is associated and indexed with a unique key, + * + * @extends Decorated + * @see See {@link Decorated} + * @class + * @memberof module:concerto-core + */ +declare class MapDeclaration { + /** + * Create an MapDeclaration. + * @param {ModelFile} modelFile - the ModelFile for this class + * @param {Object} ast - The AST created by the parser + * @throws {IllegalModelException} + */ + constructor(modelFile: ModelFile, ast: any); + modelFile: ModelFile; + /** + * Process the AST and build the model + * + * @throws {IllegalModelException} + * @private + */ + private process; + name: any; + key: MapKeyType; + value: MapValueType; + fqn: string; + /** + * Semantic validation of the structure of this class. + * + * @throws {IllegalModelException} + * @protected + */ + protected validate(): void; + /** + * Returns the fully qualified name of this class. + * The name will include the namespace if present. + * + * @return {string} the fully-qualified name of this class + */ + getFullyQualifiedName(): string; + /** + * Returns the ModelFile that defines this class. + * + * @public + * @return {ModelFile} the owning ModelFile + */ + public getModelFile(): ModelFile; + /** + * Returns the short name of a class. This name does not include the + * namespace from the owning ModelFile. + * + * @return {string} the short name of this class + */ + getName(): string; + /** + * Returns the type of the Map key property. + * + * @return {string} the short name of this class + */ + getKey(): string; + /** + * Returns the type of the Map Value property. + * + * @return {string} the short name of this class + */ + getValue(): string; + /** + * Returns the MapDeclaration properties + * + * @return {array} the short name of this class + */ + getProperties(): any[]; + /** + * Returns the string representation of this class + * @return {String} the string representation of the class + */ + toString(): string; + /** + * Returns the kind of declaration + * + * @return {string} what kind of declaration this is + */ + declarationKind(): string; + /** + * Returns true if this class is the definition of a class declaration. + * + * @return {boolean} true if the class is a class + */ + isMapDeclaration(): boolean; +} +import ModelFile = require("./modelfile"); +import MapKeyType = require("./mapkeytype"); +import MapValueType = require("./mapvaluetype"); diff --git a/packages/concerto-core/types/lib/introspect/mapkeytype.d.ts b/packages/concerto-core/types/lib/introspect/mapkeytype.d.ts new file mode 100644 index 0000000000..7ada0469e8 --- /dev/null +++ b/packages/concerto-core/types/lib/introspect/mapkeytype.d.ts @@ -0,0 +1,42 @@ +export = MapKeyType; +/** + * MapKeyType defines a Key type of an MapDeclaration. + * + * @extends Decorated + * @see See {@link Decorated} + * @class + * @memberof module:concerto-core + */ +declare class MapKeyType extends Decorated { + /** + * Create an MapKeyType. + * @param {MapDeclaration} parent - The owner of this property + * @param {Object} ast - The AST created by the parser + * @param {ModelFile} modelFile - the ModelFile for the Map class + * @throws {IllegalModelException} + */ + constructor(parent: MapDeclaration, ast: any); + parent: MapDeclaration; + type: any; + /** + * Semantic validation of the structure of this class. + * + * @throws {IllegalModelException} + * @protected + */ + protected validate(): void; + /** + * Returns the owner of this property + * @public + * @return {MapDeclaration} the parent map declaration + */ + public getParent(): MapDeclaration; + /** + * Returns the Type of the MapKey. This name does not include the + * namespace from the owning ModelFile. + * + * @return {string} the short name of this class + */ + getType(): string; +} +import Decorated = require("./decorated"); diff --git a/packages/concerto-core/types/lib/introspect/mapvaluetype.d.ts b/packages/concerto-core/types/lib/introspect/mapvaluetype.d.ts new file mode 100644 index 0000000000..99e7011a0e --- /dev/null +++ b/packages/concerto-core/types/lib/introspect/mapvaluetype.d.ts @@ -0,0 +1,41 @@ +export = MapValueType; +/** + * MapValueType defines a Value type of MapDeclaration. + * + * @extends Decorated + * @see See {@link Decorated} + * @class + * @memberof module:concerto-core + */ +declare class MapValueType extends Decorated { + /** + * Create an MapValueType. + * @param {MapDeclaration} parent - The owner of this property + * @param {Object} ast - The AST created by the parser + * @param {ModelFile} modelFile - the ModelFile for the Map class + * @throws {IllegalModelException} + */ + constructor(parent: MapDeclaration, ast: any); + parent: MapDeclaration; + type: any; + /** + * Semantic validation of the structure of this class. + * + * @returns {boolean} - returns true, all concerto concepts and primitives are legal MapValueTypes. + */ + validate(): boolean; + /** + * Returns the owner of this property + * @public + * @return {MapDeclaration} the parent map declaration + */ + public getParent(): MapDeclaration; + /** + * Returns the Type of the MapValue. This name does not include the + * namespace from the owning ModelFile. + * + * @return {string} the short name of this class + */ + getType(): string; +} +import Decorated = require("./decorated"); diff --git a/packages/concerto-core/types/lib/introspect/modelfile.d.ts b/packages/concerto-core/types/lib/introspect/modelfile.d.ts index 9a57c3a10c..c343c2179d 100644 --- a/packages/concerto-core/types/lib/introspect/modelfile.d.ts +++ b/packages/concerto-core/types/lib/introspect/modelfile.d.ts @@ -211,6 +211,11 @@ declare class ModelFile extends Decorated { * @return {EnumDeclaration[]} the EnumDeclaration defined in the model file */ getEnumDeclarations(): EnumDeclaration[]; + /** + * Get the MapDeclarations defined in this ModelFile + * @return {MapDeclaration[]} the MapDeclarations defined in the model file + */ + getMapDeclarations(): MapDeclaration[]; /** * Get the ScalarDeclaration defined in this ModelFile * @return {ScalarDeclaration[]} the ScalarDeclaration defined in the model file @@ -287,4 +292,5 @@ import EventDeclaration = require("./eventdeclaration"); import ParticipantDeclaration = require("./participantdeclaration"); import ConceptDeclaration = require("./conceptdeclaration"); import EnumDeclaration = require("./enumdeclaration"); +import MapDeclaration = require("./mapdeclaration"); import ScalarDeclaration = require("./scalardeclaration");