Skip to content

Commit

Permalink
Add graph support for ServiceStore (#580)
Browse files Browse the repository at this point in the history
* add graph support for service-store

* remove existing ServiceStore from legend-graph

* add extension mechanism for mapping in form mode

* add changesets

* refactor service store package

* minor fixes

* modify PureProtocolProcessorPlugin

* modify metamodels for service parameter mapping

* modify mappingElementDecorators/Cleaners
  • Loading branch information
gayathrir11 authored Oct 26, 2021
1 parent c1249af commit 7318c22
Show file tree
Hide file tree
Showing 116 changed files with 4,636 additions and 242 deletions.
5 changes: 5 additions & 0 deletions .changeset/big-pens-return.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@finos/legend-graph": patch
---

**BREAKING CHANGE:** Pass Plugins as a parameter for `V1_getExtraElementProtocolSerializers` and `V1_getExtraElementProtocolDeserializers`
5 changes: 5 additions & 0 deletions .changeset/heavy-carpets-pull.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@finos/legend-extension-external-store-service": minor
---

Add graph support for `Service Store`
5 changes: 5 additions & 0 deletions .changeset/light-nails-battle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@finos/legend-graph": minor
---

Add extension mechanism for `class mapping`
9 changes: 9 additions & 0 deletions .changeset/loud-foxes-deliver.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
'@finos/legend-extension-dsl-serializer': patch
'@finos/legend-extension-dsl-data-space': patch
'@finos/legend-extension-dsl-diagram': patch
'@finos/legend-extension-dsl-text': patch
'@finos/legend-studio-app': patch
'@finos/legend-query-app': patch
'@finos/legend-manual-tests': patch
---
5 changes: 5 additions & 0 deletions .changeset/poor-bananas-relate.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@finos/legend-studio": minor
---

Add extension mechanism for `class mapping` in form mode
5 changes: 5 additions & 0 deletions .changeset/rich-comics-enjoy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@finos/legend-graph": patch
---

**BREAKING CHANGE:** Removal of old `Service store` specification
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ export class DSLDataSpace_PureProtocolProcessorPlugin extends PureProtocolProces
return [
(
elementProtocol: V1_PackageableElement,
plugins: PureProtocolProcessorPlugin[],
): PlainObject<V1_PackageableElement> | undefined => {
if (elementProtocol instanceof V1_DataSpace) {
return serialize(V1_dataSpaceModelSchema, elementProtocol);
Expand All @@ -229,6 +230,7 @@ export class DSLDataSpace_PureProtocolProcessorPlugin extends PureProtocolProces
return [
(
json: PlainObject<V1_PackageableElement>,
plugins: PureProtocolProcessorPlugin[],
): V1_PackageableElement | undefined => {
if (json._type === V1_DATA_SPACE_ELEMENT_PROTOCOL_TYPE) {
return deserialize(V1_dataSpaceModelSchema, json);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ export class DSLDiagram_PureProtocolProcessorPlugin extends PureProtocolProcesso
return [
(
elementProtocol: V1_PackageableElement,
plugins: PureProtocolProcessorPlugin[],
): PlainObject<V1_PackageableElement> | undefined => {
if (elementProtocol instanceof V1_Diagram) {
return serialize(V1_diagramModelSchema, elementProtocol);
Expand All @@ -140,6 +141,7 @@ export class DSLDiagram_PureProtocolProcessorPlugin extends PureProtocolProcesso
return [
(
json: PlainObject<V1_PackageableElement>,
plugins: PureProtocolProcessorPlugin[],
): V1_PackageableElement | undefined => {
if (json._type === V1_DIAGRAM_ELEMENT_PROTOCOL_TYPE) {
return deserialize(V1_diagramModelSchema, json);
Expand Down
2 changes: 2 additions & 0 deletions packages/legend-extension-dsl-serializer/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@
*/

export * from './DSLSerializer_Extension';
export * from './models/metamodels/pure/model/packageableElements/store/Binding';
export { getBinding } from './graphManager/DSLSerializer_GraphManagerHelper';
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ export class DSLSerializer_PureProtocolProcessorPlugin
return [
(
elementProtocol: V1_PackageableElement,
plugins: PureProtocolProcessorPlugin[],
): PlainObject<V1_PackageableElement> | undefined => {
if (elementProtocol instanceof V1_Binding) {
return serialize(V1_bindingModelSchema, elementProtocol);
Expand All @@ -239,6 +240,7 @@ export class DSLSerializer_PureProtocolProcessorPlugin
return [
(
json: PlainObject<V1_PackageableElement>,
plugins: PureProtocolProcessorPlugin[],
): V1_PackageableElement | undefined => {
if (json._type === V1_BINDING_ELEMENT_PROTOCOL_TYPE) {
return deserialize(V1_bindingModelSchema, json);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ export class DSLText_PureProtocolProcessorPlugin extends PureProtocolProcessorPl
return [
(
elementProtocol: V1_PackageableElement,
plugins: PureProtocolProcessorPlugin[],
): PlainObject<V1_PackageableElement> | undefined => {
if (elementProtocol instanceof V1_Text) {
return serialize(V1_textModelSchema, elementProtocol);
Expand All @@ -128,6 +129,7 @@ export class DSLText_PureProtocolProcessorPlugin extends PureProtocolProcessorPl
return [
(
json: PlainObject<V1_PackageableElement>,
plugins: PureProtocolProcessorPlugin[],
): V1_PackageableElement | undefined => {
if (json._type === V1_TEXT_ELEMENT_PROTOCOL_TYPE) {
return deserialize(V1_textModelSchema, json);
Expand Down
7 changes: 7 additions & 0 deletions packages/legend-extension-external-store-service/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/build
/style
**/__mocks__/**
**/__tests__/**
/*.*
!tsconfig.json
!tsconfig.package.json
3 changes: 3 additions & 0 deletions packages/legend-extension-external-store-service/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# @finos/legend-extension-external-store-service

Legend Studio extension for `Service Store`
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,20 @@
* limitations under the License.
*/

import type { ServiceStore } from '../../../../../../metamodels/pure/packageableElements/store/relational/model/ServiceStore';
import { V1_ServiceStore } from '../../../model/packageableElements/store/relational/V1_ServiceStore';
import { V1_initPackageableElement } from './V1_CoreTransformerHelper';
import { generateBundleCopyrightText } from '../../scripts/copyright/PackageCopyrightHelper.js';
import { dirname } from 'path';
import { fileURLToPath } from 'url';

export const V1_transformServiceStore = (
element: ServiceStore,
): V1_ServiceStore => {
const serviceStore = new V1_ServiceStore();
V1_initPackageableElement(serviceStore, element);
serviceStore.docLink = element.docLink;
return serviceStore;
const __dirname = dirname(fileURLToPath(import.meta.url));

export default {
publish: {
typescript: {
main: './tsconfig.build.json',
others: ['./tsconfig.package.json'],
},
},
build: {
copyrightText: generateBundleCopyrightText(__dirname),
},
};
39 changes: 39 additions & 0 deletions packages/legend-extension-external-store-service/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/**
* Copyright (c) 2020-present, Goldman Sachs
*
* 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.
*/

import base from '../../scripts/jest/jest.config.base.js';
import { loadJSON } from '@finos/legend-dev-utils/DevUtils';

const packageJson = loadJSON('./package.json');

export default {
...base,
displayName: packageJson.name,
name: packageJson.name,
rootDir: '../..',
testEnvironment: 'jsdom',
setupFiles: [
...base.setupFiles,
'<rootDir>/scripts/jest/setupTests/setupPolyfills.js',
],
moduleNameMapper: {
...base.moduleNameMapper,
'^monaco-editor$': '@finos/legend-art/lib/testMocks/MockedMonacoEditor.js',
},
testMatch: [
'<rootDir>/packages/legend-extension-external-store-service/src/**/__tests__/**/*(*.)test.[jt]s?(x)',
],
};
77 changes: 77 additions & 0 deletions packages/legend-extension-external-store-service/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
{
"name": "@finos/legend-extension-external-store-service",
"version": "0.0.0",
"description": "Legend extension for Service Store",
"keywords": [
"legend",
"legend-extension",
"extension",
"store",
"external-store",
"service-store"
],
"homepage": "https://github.com/finos/legend-studio/tree/master/packages/legend-extension-external-store-service",
"bugs": {
"url": "https://github.com/finos/legend-studio/issues"
},
"repository": {
"type": "git",
"url": "https://github.com/finos/legend-studio.git",
"directory": "packages/legend-extension-external-store-service"
},
"license": "Apache-2.0",
"sideEffects": false,
"type": "module",
"main": "lib/index.js",
"module": "lib/index.js",
"types": "lib/index.d.ts",
"scripts": {
"build": "yarn clean && yarn build:tsc",
"build:tsc": "tsc --project ./tsconfig.build.json",
"clean": "rimraf \"lib\" \"build\"",
"dev": "yarn dev:tsc",
"dev:tsc": "tsc --watch --preserveWatchOutput",
"lint:js": "cross-env NODE_ENV=production eslint --cache --cache-location ./build/.eslintcache --report-unused-disable-directives --parser-options=project:\"./tsconfig.json\" \"./src/**/*.{js,ts,tsx}\"",
"publish:prepare": "node ../../scripts/release/preparePublishContent.js",
"test": "jest",
"test:watch": "jest --watch"
},
"dependencies": {
"@finos/legend-art": "workspace:*",
"@finos/legend-extension-dsl-serializer": "workspace:*",
"@finos/legend-graph": "workspace:*",
"@finos/legend-model-storage": "workspace:*",
"@finos/legend-shared": "workspace:*",
"@finos/legend-studio": "workspace:*",
"@types/react": "17.0.32",
"mobx": "6.3.5",
"mobx-react-lite": "3.2.1",
"monaco-editor": "0.29.1",
"react": "17.0.2",
"serializr": "2.0.5"
},
"devDependencies": {
"@finos/legend-dev-utils": "workspace:*",
"cross-env": "7.0.3",
"eslint": "8.1.0",
"jest": "27.3.1",
"npm-run-all": "4.1.5",
"rimraf": "3.0.2",
"sass": "1.43.3",
"typescript": "4.4.4"
},
"peerDependencies": {
"react": "^17.0.0"
},
"publishConfig": {
"directory": "build/publishContent"
},
"extensions": {
"graphPreset": "@finos/legend-graph-preset-external-store-service",
"pureProtocolProcessorPlugin": "@finos/legend-graph-plugin-external-store-service-pure-protocol-processor",
"pureGraphManagerPlugin": "@finos/legend-graph-plugin-external-store-service-pure-graph-manager",
"pureGraphPlugin": "@finos/legend-graph-plugin-external-store-service-pure-graph",
"studioPreset": "@finos/legend-studio-preset-external-store-service",
"studioPlugin": "@finos/legend-studio-plugin-external-store-service"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/**
* Copyright (c) 2020-present, Goldman Sachs
*
* 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.
*/

import packageJson from '../package.json';
import type { GraphPluginManager } from '@finos/legend-graph';
import { AbstractPreset } from '@finos/legend-shared';
import { ESService_PureGraphManagerPlugin } from './graphManager/ESService_PureGraphManagerPlugin';
import { ESService_PureProtocolProcessorPlugin } from './models/protocols/pure/ESService_PureProtocolProcessorPlugin';
import type { StudioPluginManager } from '@finos/legend-studio';
import { ESService_PureGraphPlugin } from './graph/ESService_PureGraphPlugin';
import { ESService_StudioPlugin } from './components/ESService_StudioPlugin';

export class ESService_GraphPreset extends AbstractPreset {
constructor() {
super(packageJson.extensions.graphPreset, packageJson.version);
}

install(pluginManager: GraphPluginManager): void {
new ESService_PureGraphPlugin().install(pluginManager);
new ESService_PureGraphManagerPlugin().install(pluginManager);
new ESService_PureProtocolProcessorPlugin().install(pluginManager);
}
}

export class ESService_StudioPreset extends AbstractPreset {
constructor() {
super(packageJson.extensions.studioPreset, packageJson.version);
}

install(pluginManager: StudioPluginManager): void {
new ESService_StudioPlugin().install(pluginManager);
new ESService_PureGraphPlugin().install(pluginManager);
new ESService_PureGraphManagerPlugin().install(pluginManager);
new ESService_PureProtocolProcessorPlugin().install(pluginManager);
}
}
Loading

0 comments on commit 7318c22

Please sign in to comment.