From b18114e2b47a302925aeff65d8be8eef1463b7a3 Mon Sep 17 00:00:00 2001 From: DibyamAgrawal Date: Thu, 8 Aug 2024 12:31:27 +0530 Subject: [PATCH 1/3] chore(packages): update concerto packages (#116) * chore(packages): update concerto packages Signed-off-by: Dibyam Agrawal * chore(packages): update concerto package integrity checksum Signed-off-by: Dibyam Agrawal --------- Signed-off-by: Dibyam Agrawal --- package-lock.json | 38 +++++++++++++++++++------------------- package.json | 8 ++++---- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/package-lock.json b/package-lock.json index 8766e930..110d80e5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,9 +9,9 @@ "version": "3.23.1", "license": "Apache-2.0", "dependencies": { - "@accordproject/concerto-core": "3.18.0", - "@accordproject/concerto-util": "3.18.0", - "@accordproject/concerto-vocabulary": "3.18.0", + "@accordproject/concerto-core": "3.18.1", + "@accordproject/concerto-util": "3.18.1", + "@accordproject/concerto-vocabulary": "3.18.1", "@openapi-contrib/openapi-schema-to-json-schema": "5.1.0", "ajv": "8.13.0", "ajv-formats": "3.0.1", @@ -22,7 +22,7 @@ "pluralize": "8.0.0" }, "devDependencies": { - "@accordproject/concerto-cto": "3.18.0", + "@accordproject/concerto-cto": "3.18.1", "@babel/preset-env": "7.16.11", "babel-loader": "8.2.3", "chai": "4.3.6", @@ -61,13 +61,13 @@ } }, "node_modules/@accordproject/concerto-core": { - "version": "3.18.0", - "resolved": "https://registry.npmjs.org/@accordproject/concerto-core/-/concerto-core-3.18.0.tgz", - "integrity": "sha512-a1f1Z79oJEBrW+eYa65+R14TLv6Mdom/5tny7sBWV/RT2S3iCUCop6jGSpycADgvIkrDySnW4F3hSct4+0ZHLg==", + "version": "3.18.1", + "resolved": "https://registry.npmjs.org/@accordproject/concerto-core/-/concerto-core-3.18.1.tgz", + "integrity": "sha512-XtTiQCPj+Bdkcei8EXzi8Zp+Himlim4mkfdMs+AxfIltaH2jhzwVyu6VfMCwTcCggmHU04QC+JBjnJ5ImusUrg==", "dependencies": { - "@accordproject/concerto-cto": "3.18.0", + "@accordproject/concerto-cto": "3.18.1", "@accordproject/concerto-metamodel": "3.10.0", - "@accordproject/concerto-util": "3.18.0", + "@accordproject/concerto-util": "3.18.1", "dayjs": "1.11.10", "debug": "4.3.4", "lorem-ipsum": "2.0.8", @@ -83,12 +83,12 @@ } }, "node_modules/@accordproject/concerto-cto": { - "version": "3.18.0", - "resolved": "https://registry.npmjs.org/@accordproject/concerto-cto/-/concerto-cto-3.18.0.tgz", - "integrity": "sha512-zrE42ip6Tfavyr/Hox2AIc785McobYjK756KR1bOX4aUWZQtQTpzBZKIwM4wsfsb7HZ+sLxEkzFYidk2TCguBw==", + "version": "3.18.1", + "resolved": "https://registry.npmjs.org/@accordproject/concerto-cto/-/concerto-cto-3.18.1.tgz", + "integrity": "sha512-TqX5C5ZeOjlr3b9ErGVwO3TzkPtKxi+rho5KxcWNVxyWwucUSM5sRLY1+lJOgvX12L1sNlnmsMu/549V//NoSw==", "dependencies": { "@accordproject/concerto-metamodel": "3.10.0", - "@accordproject/concerto-util": "3.18.0", + "@accordproject/concerto-util": "3.18.1", "path-browserify": "1.0.1" }, "engines": { @@ -127,9 +127,9 @@ } }, "node_modules/@accordproject/concerto-util": { - "version": "3.18.0", - "resolved": "https://registry.npmjs.org/@accordproject/concerto-util/-/concerto-util-3.18.0.tgz", - "integrity": "sha512-jY79qjR01RYxC0XWkcX1jtaftcKyX6sToemFwNnznZTsmOR0zOqtrs+zq2cqIwi7hYlLymBGMpqzCDdAYjwybQ==", + "version": "3.18.1", + "resolved": "https://registry.npmjs.org/@accordproject/concerto-util/-/concerto-util-3.18.1.tgz", + "integrity": "sha512-xGXdHTzF7jxvXOfGLtRgxfKAkmhl68uxrs7gYJa58+QuZNT43q+cqvzyF2H619rMHbfqgPzzB/cAb1e3J9IgIA==", "dependencies": { "@supercharge/promise-pool": "1.7.0", "axios": "1.6.8", @@ -144,9 +144,9 @@ } }, "node_modules/@accordproject/concerto-vocabulary": { - "version": "3.18.0", - "resolved": "https://registry.npmjs.org/@accordproject/concerto-vocabulary/-/concerto-vocabulary-3.18.0.tgz", - "integrity": "sha512-J43wcwWWDa5zHVc3pDu4ZVjzw4w5fnVrywunFNKRv/Bq1eJuZOPqpUU/QzdbSkoqTjmFFNOOWPUbFMbjyHUB/Q==", + "version": "3.18.1", + "resolved": "https://registry.npmjs.org/@accordproject/concerto-vocabulary/-/concerto-vocabulary-3.18.1.tgz", + "integrity": "sha512-BWfnPErg5wU3QR7RU5cnJxA23V74BeXUWr3xavi9/YFgIZHZrqSjcHelrJObhwGW6QWek/eLjPiHYhlM+x9xMQ==", "dependencies": { "@accordproject/concerto-metamodel": "3.10.0", "yaml": "2.2.2" diff --git a/package.json b/package.json index ef6bcdff..185d14b3 100644 --- a/package.json +++ b/package.json @@ -45,7 +45,7 @@ "author": "accordproject.org", "license": "Apache-2.0", "devDependencies": { - "@accordproject/concerto-cto": "3.18.0", + "@accordproject/concerto-cto": "3.18.1", "@babel/preset-env": "7.16.11", "babel-loader": "8.2.3", "chai": "4.3.6", @@ -70,9 +70,9 @@ "webpack-cli": "4.9.1" }, "dependencies": { - "@accordproject/concerto-core": "3.18.0", - "@accordproject/concerto-util": "3.18.0", - "@accordproject/concerto-vocabulary": "3.18.0", + "@accordproject/concerto-core": "3.18.1", + "@accordproject/concerto-util": "3.18.1", + "@accordproject/concerto-vocabulary": "3.18.1", "@openapi-contrib/openapi-schema-to-json-schema": "5.1.0", "ajv": "8.13.0", "ajv-formats": "3.0.1", From a139d77a140692b8684b7fe83618ee547f6446ae Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 8 Aug 2024 12:27:06 +0000 Subject: [PATCH 2/3] chore(actions): publish v3.23.3 to npm (#117) Signed-off-by: GitHub Co-authored-by: mttrbrts --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 110d80e5..b9cfbeac 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@accordproject/concerto-codegen", - "version": "3.23.1", + "version": "3.23.3", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@accordproject/concerto-codegen", - "version": "3.23.1", + "version": "3.23.3", "license": "Apache-2.0", "dependencies": { "@accordproject/concerto-core": "3.18.1", diff --git a/package.json b/package.json index 185d14b3..a850791d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@accordproject/concerto-codegen", - "version": "3.23.1", + "version": "3.23.3", "description": "Code Generation for the Concerto Modeling Language", "homepage": "https://github.com/accordproject/concerto", "engines": { From e7d9c7c04fb8aa5b2289efeaeeb9324b98dbc273 Mon Sep 17 00:00:00 2001 From: Jamie Shorten Date: Fri, 23 Aug 2024 09:51:54 +0100 Subject: [PATCH 3/3] feat(dependency graph): add option to create a dependency graph (#119) * feat(dependency graph): optionally generate a dependency graph Signed-off-by: Jamie Shorten * chore: add tests Signed-off-by: Jamie Shorten --------- Signed-off-by: Jamie Shorten --- lib/common/graph.js | 2 +- test/common/graph.js | 137 ++++++++++++++++++++++++++++++++++++++----- 2 files changed, 124 insertions(+), 15 deletions(-) diff --git a/lib/common/graph.js b/lib/common/graph.js index 7d6370e7..9f91d686 100644 --- a/lib/common/graph.js +++ b/lib/common/graph.js @@ -185,7 +185,7 @@ class ConcertoGraphVisitor extends DiagramVisitor { if (classDeclaration.getSuperType()){ parameters.graph.addEdge(classDeclaration.getFullyQualifiedName(), classDeclaration.getSuperType()); // this "if" block adds the types that extend the Super type - if(classDeclaration.getSuperType() !== 'concerto@1.0.0.Concept') { + if(!parameters.createDependencyGraph && classDeclaration.getSuperType() !== 'concerto@1.0.0.Concept') { parameters.graph.addVertex(classDeclaration.getSuperType()); parameters.graph.addEdge(classDeclaration.getSuperType(), classDeclaration.getFullyQualifiedName()); } diff --git a/test/common/graph.js b/test/common/graph.js index fb87eb74..41e0c514 100644 --- a/test/common/graph.js +++ b/test/common/graph.js @@ -15,7 +15,10 @@ 'use strict'; -const { DirectedGraph, ConcertoGraphVisitor } = require('../../lib/common/common.js'); +const { + DirectedGraph, + ConcertoGraphVisitor, +} = require('../../lib/common/common.js'); const { ModelManager } = require('@accordproject/concerto-core'); const fs = require('fs'); const { expect } = require('expect'); @@ -26,7 +29,7 @@ chai.should(); chai.use(require('chai-as-promised')); chai.use(require('chai-things')); -describe('graph', function () { +describe('graph', function() { let modelManager = null; before(function() { @@ -35,15 +38,20 @@ describe('graph', function () { beforeEach(function() { modelManager = new ModelManager(); - const hrBase = fs.readFileSync('./test/codegen/fromcto/data/model/hr_base.cto', 'utf-8'); + const hrBase = fs.readFileSync( + './test/codegen/fromcto/data/model/hr_base.cto', + 'utf-8' + ); modelManager.addCTOModel(hrBase, 'hr_base.cto'); - const hr = fs.readFileSync('./test/codegen/fromcto/data/model/hr.cto', 'utf-8'); + const hr = fs.readFileSync( + './test/codegen/fromcto/data/model/hr.cto', + 'utf-8' + ); modelManager.addCTOModel(hr, 'hr.cto'); }); - - describe('#visitor', function () { - it('should visit a model manager', function () { + describe('#visitor', function() { + it('should visit a model manager', function() { const visitor = new ConcertoGraphVisitor(); visitor.should.not.be.null; const writer = new InMemoryWriter(); @@ -136,8 +144,7 @@ describe('graph', function () { `); }); - - it('should visit find a connected subgraph', function () { + it('should visit find a connected subgraph', function() { const visitor = new ConcertoGraphVisitor(); visitor.should.not.be.null; const writer = new InMemoryWriter(); @@ -145,14 +152,24 @@ describe('graph', function () { const graph = new DirectedGraph(); modelManager.accept(visitor, { graph }); - const connectedGraph = graph.findConnectedGraph('org.acme.hr@1.0.0.ChangeOfAddress'); - expect(connectedGraph.hasEdge('org.acme.hr@1.0.0.ChangeOfAddress', 'org.acme.hr@1.0.0.Person')); + const connectedGraph = graph.findConnectedGraph( + 'org.acme.hr@1.0.0.ChangeOfAddress' + ); + expect( + connectedGraph.hasEdge( + 'org.acme.hr@1.0.0.ChangeOfAddress', + 'org.acme.hr@1.0.0.Person' + ) + ); - const filteredModelManager = modelManager - .filter(declaration => connectedGraph.hasVertex(declaration.getFullyQualifiedName())); + const filteredModelManager = modelManager.filter((declaration) => + connectedGraph.hasVertex(declaration.getFullyQualifiedName()) + ); expect(filteredModelManager.getModelFiles()).toHaveLength(2); - expect(filteredModelManager.getModelFiles()[0].getAllDeclarations()).toHaveLength(5); + expect( + filteredModelManager.getModelFiles()[0].getAllDeclarations() + ).toHaveLength(5); writer.openFile('graph.mmd'); connectedGraph.print(writer); @@ -226,6 +243,98 @@ describe('graph', function () { \`concerto@1.0.0.Transaction\` <--> \`org.acme.hr@1.0.0.ChangeOfAddress\` \`org.acme.hr@1.0.0.KinName\` \`org.acme.hr@1.0.0.KinTelephone\` +`); + }); + + it('should visit a model manager and create a dependency graph', function() { + const visitor = new ConcertoGraphVisitor(); + visitor.should.not.be.null; + const writer = new InMemoryWriter(); + + const graph = new DirectedGraph(); + modelManager.accept(visitor, { + graph, + createDependencyGraph: true, + }); + + writer.openFile('graph.mmd'); + graph.print(writer); + writer.closeFile(); + expect(writer.data.get('graph.mmd')).toEqual(`flowchart LR + \`org.acme.hr.base@1.0.0.State\` + \`org.acme.hr.base@1.0.0.State\` --> \`concerto@1.0.0.Concept\` + \`org.acme.hr.base@1.0.0.TShirtSizeType\` + \`org.acme.hr.base@1.0.0.TShirtSizeType\` --> \`concerto@1.0.0.Concept\` + \`org.acme.hr.base@1.0.0.EmployeeTShirtSizes\` + \`org.acme.hr.base@1.0.0.EmployeeTShirtSizes\` --> \`org.acme.hr.base@1.0.0.SSN\` + \`org.acme.hr.base@1.0.0.EmployeeTShirtSizes\` --> \`org.acme.hr.base@1.0.0.TShirtSizeType\` + \`org.acme.hr.base@1.0.0.Address\` + \`org.acme.hr.base@1.0.0.Address\` --> \`concerto@1.0.0.Concept\` + \`org.acme.hr.base@1.0.0.Address\` --> \`org.acme.hr.base@1.0.0.State\` + \`org.acme.hr.base@1.0.0.Time\` + \`org.acme.hr.base@1.0.0.SSN\` + \`org.acme.hr@1.0.0.CompanyProperties\` + \`org.acme.hr@1.0.0.CompanyProperties\` --> \`String\` + \`org.acme.hr@1.0.0.EmployeeLoginTimes\` + \`org.acme.hr@1.0.0.EmployeeLoginTimes\` --> \`String\` + \`org.acme.hr@1.0.0.EmployeeLoginTimes\` --> \`org.acme.hr.base@1.0.0.Time\` + \`org.acme.hr@1.0.0.EmployeeSocialSecurityNumbers\` + \`org.acme.hr@1.0.0.EmployeeSocialSecurityNumbers\` --> \`String\` + \`org.acme.hr@1.0.0.EmployeeSocialSecurityNumbers\` --> \`org.acme.hr.base@1.0.0.SSN\` + \`org.acme.hr@1.0.0.NextOfKin\` + \`org.acme.hr@1.0.0.NextOfKin\` --> \`org.acme.hr@1.0.0.KinName\` + \`org.acme.hr@1.0.0.NextOfKin\` --> \`org.acme.hr@1.0.0.KinTelephone\` + \`org.acme.hr@1.0.0.EmployeeProfiles\` + \`org.acme.hr@1.0.0.EmployeeProfiles\` --> \`String\` + \`org.acme.hr@1.0.0.EmployeeProfiles\` --> \`concerto@1.0.0.Concept\` + \`org.acme.hr@1.0.0.EmployeeDirectory\` + \`org.acme.hr@1.0.0.EmployeeDirectory\` --> \`org.acme.hr.base@1.0.0.SSN\` + \`org.acme.hr@1.0.0.EmployeeDirectory\` --> \`org.acme.hr@1.0.0.Employee\` + \`org.acme.hr@1.0.0.Company\` + \`org.acme.hr@1.0.0.Company\` --> \`concerto@1.0.0.Concept\` + \`org.acme.hr@1.0.0.Company\` --> \`org.acme.hr.base@1.0.0.Address\` + \`org.acme.hr@1.0.0.Company\` --> \`org.acme.hr@1.0.0.CompanyProperties\` + \`org.acme.hr@1.0.0.Company\` --> \`org.acme.hr@1.0.0.EmployeeDirectory\` + \`org.acme.hr@1.0.0.Company\` --> \`org.acme.hr.base@1.0.0.EmployeeTShirtSizes\` + \`org.acme.hr@1.0.0.Company\` --> \`org.acme.hr@1.0.0.EmployeeProfiles\` + \`org.acme.hr@1.0.0.Company\` --> \`org.acme.hr@1.0.0.EmployeeSocialSecurityNumbers\` + \`org.acme.hr@1.0.0.Department\` + \`org.acme.hr@1.0.0.Department\` --> \`concerto@1.0.0.Concept\` + \`org.acme.hr@1.0.0.Equipment\` + \`org.acme.hr@1.0.0.Equipment\` --> \`concerto@1.0.0.Asset\` + \`org.acme.hr@1.0.0.LaptopMake\` + \`org.acme.hr@1.0.0.LaptopMake\` --> \`concerto@1.0.0.Concept\` + \`org.acme.hr@1.0.0.Laptop\` + \`org.acme.hr@1.0.0.Laptop\` --> \`org.acme.hr@1.0.0.Equipment\` + \`org.acme.hr@1.0.0.Laptop\` --> \`org.acme.hr@1.0.0.LaptopMake\` + \`org.acme.hr@1.0.0.Person\` + \`org.acme.hr@1.0.0.Person\` --> \`concerto@1.0.0.Participant\` + \`org.acme.hr@1.0.0.Person\` --> \`org.acme.hr.base@1.0.0.Address\` + \`org.acme.hr@1.0.0.Person\` --> \`org.acme.hr.base@1.0.0.SSN\` + \`org.acme.hr@1.0.0.Person\` --> \`org.acme.hr@1.0.0.NextOfKin\` + \`org.acme.hr@1.0.0.Employee\` + \`org.acme.hr@1.0.0.Employee\` --> \`org.acme.hr@1.0.0.Person\` + \`org.acme.hr@1.0.0.Employee\` --> \`org.acme.hr@1.0.0.Department\` + \`org.acme.hr@1.0.0.Employee\` --> \`org.acme.hr.base@1.0.0.Address\` + \`org.acme.hr@1.0.0.Employee\` --> \`org.acme.hr@1.0.0.Equipment\` + \`org.acme.hr@1.0.0.Contractor\` + \`org.acme.hr@1.0.0.Contractor\` --> \`org.acme.hr@1.0.0.Person\` + \`org.acme.hr@1.0.0.Contractor\` --> \`org.acme.hr@1.0.0.Company\` + \`org.acme.hr@1.0.0.Contractor\` --> \`org.acme.hr@1.0.0.Manager\` + \`org.acme.hr@1.0.0.Manager\` + \`org.acme.hr@1.0.0.Manager\` <--> \`org.acme.hr@1.0.0.Employee\` + \`org.acme.hr@1.0.0.Manager\` --> \`org.acme.hr@1.0.0.Person\` + \`org.acme.hr@1.0.0.CompanyEvent\` + \`org.acme.hr@1.0.0.CompanyEvent\` --> \`concerto@1.0.0.Event\` + \`org.acme.hr@1.0.0.Onboarded\` + \`org.acme.hr@1.0.0.Onboarded\` --> \`org.acme.hr@1.0.0.CompanyEvent\` + \`org.acme.hr@1.0.0.Onboarded\` --> \`org.acme.hr@1.0.0.Employee\` + \`org.acme.hr@1.0.0.ChangeOfAddress\` + \`org.acme.hr@1.0.0.ChangeOfAddress\` --> \`concerto@1.0.0.Transaction\` + \`org.acme.hr@1.0.0.ChangeOfAddress\` --> \`org.acme.hr@1.0.0.Person\` + \`org.acme.hr@1.0.0.ChangeOfAddress\` --> \`org.acme.hr.base@1.0.0.Address\` + \`org.acme.hr@1.0.0.KinName\` + \`org.acme.hr@1.0.0.KinTelephone\` `); }); });