@finos/legend-extension-dsl-data-space 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/LICENSE +201 -0
  3. package/README.md +3 -0
  4. package/lib/DSLDataSpace_Extension.d.ts +27 -0
  5. package/lib/DSLDataSpace_Extension.d.ts.map +1 -0
  6. package/lib/DSLDataSpace_Extension.js +43 -0
  7. package/lib/DSLDataSpace_Extension.js.map +1 -0
  8. package/lib/components/studio/DSLDataSpace_StudioPlugin.d.ts +30 -0
  9. package/lib/components/studio/DSLDataSpace_StudioPlugin.d.ts.map +1 -0
  10. package/lib/components/studio/DSLDataSpace_StudioPlugin.js +107 -0
  11. package/lib/components/studio/DSLDataSpace_StudioPlugin.js.map +1 -0
  12. package/lib/components/studio/DataSpaceEditor.d.ts +19 -0
  13. package/lib/components/studio/DataSpaceEditor.d.ts.map +1 -0
  14. package/lib/components/studio/DataSpaceEditor.js +100 -0
  15. package/lib/components/studio/DataSpaceEditor.js.map +1 -0
  16. package/lib/graph/DSLDataSpace_PureGraphPlugin.d.ts +24 -0
  17. package/lib/graph/DSLDataSpace_PureGraphPlugin.d.ts.map +1 -0
  18. package/lib/graph/DSLDataSpace_PureGraphPlugin.js +30 -0
  19. package/lib/graph/DSLDataSpace_PureGraphPlugin.js.map +1 -0
  20. package/lib/graphManager/DSLDataSpace_GraphManagerHelper.d.ts +19 -0
  21. package/lib/graphManager/DSLDataSpace_GraphManagerHelper.d.ts.map +1 -0
  22. package/lib/graphManager/DSLDataSpace_GraphManagerHelper.js +18 -0
  23. package/lib/graphManager/DSLDataSpace_GraphManagerHelper.js.map +1 -0
  24. package/lib/graphManager/DSLDataSpace_PureGraphManagerPlugin.d.ts +25 -0
  25. package/lib/graphManager/DSLDataSpace_PureGraphManagerPlugin.d.ts.map +1 -0
  26. package/lib/graphManager/DSLDataSpace_PureGraphManagerPlugin.js +45 -0
  27. package/lib/graphManager/DSLDataSpace_PureGraphManagerPlugin.js.map +1 -0
  28. package/lib/index.css +17 -0
  29. package/lib/index.css.map +1 -0
  30. package/lib/index.d.ts +17 -0
  31. package/lib/index.d.ts.map +1 -0
  32. package/lib/index.js +17 -0
  33. package/lib/index.js.map +1 -0
  34. package/lib/models/DSLDataSpace_ModelUtils.d.ts +19 -0
  35. package/lib/models/DSLDataSpace_ModelUtils.d.ts.map +1 -0
  36. package/lib/models/DSLDataSpace_ModelUtils.js +20 -0
  37. package/lib/models/DSLDataSpace_ModelUtils.js.map +1 -0
  38. package/lib/models/metamodels/pure/model/packageableElements/dataSpace/DataSpace.d.ts +34 -0
  39. package/lib/models/metamodels/pure/model/packageableElements/dataSpace/DataSpace.d.ts.map +1 -0
  40. package/lib/models/metamodels/pure/model/packageableElements/dataSpace/DataSpace.js +58 -0
  41. package/lib/models/metamodels/pure/model/packageableElements/dataSpace/DataSpace.js.map +1 -0
  42. package/lib/models/protocols/pure/DSLDataSpace_PureProtocolProcessorPlugin.d.ts +27 -0
  43. package/lib/models/protocols/pure/DSLDataSpace_PureProtocolProcessorPlugin.d.ts.map +1 -0
  44. package/lib/models/protocols/pure/DSLDataSpace_PureProtocolProcessorPlugin.js +119 -0
  45. package/lib/models/protocols/pure/DSLDataSpace_PureProtocolProcessorPlugin.js.map +1 -0
  46. package/lib/models/protocols/pure/v1/model/packageableElements/dataSpace/V1_DataSpace.d.ts +33 -0
  47. package/lib/models/protocols/pure/v1/model/packageableElements/dataSpace/V1_DataSpace.d.ts.map +1 -0
  48. package/lib/models/protocols/pure/v1/model/packageableElements/dataSpace/V1_DataSpace.js +49 -0
  49. package/lib/models/protocols/pure/v1/model/packageableElements/dataSpace/V1_DataSpace.js.map +1 -0
  50. package/lib/models/protocols/pure/v1/transformation/pureGraph/V1_DSLDataSpace_GraphBuilderHelper.d.ts +19 -0
  51. package/lib/models/protocols/pure/v1/transformation/pureGraph/V1_DSLDataSpace_GraphBuilderHelper.d.ts.map +1 -0
  52. package/lib/models/protocols/pure/v1/transformation/pureGraph/V1_DSLDataSpace_GraphBuilderHelper.js +18 -0
  53. package/lib/models/protocols/pure/v1/transformation/pureGraph/V1_DSLDataSpace_GraphBuilderHelper.js.map +1 -0
  54. package/lib/models/protocols/pure/v1/transformation/pureProtocol/V1_DSLDataSpace_ProtocolHelper.d.ts +19 -0
  55. package/lib/models/protocols/pure/v1/transformation/pureProtocol/V1_DSLDataSpace_ProtocolHelper.d.ts.map +1 -0
  56. package/lib/models/protocols/pure/v1/transformation/pureProtocol/V1_DSLDataSpace_ProtocolHelper.js +36 -0
  57. package/lib/models/protocols/pure/v1/transformation/pureProtocol/V1_DSLDataSpace_ProtocolHelper.js.map +1 -0
  58. package/lib/stores/studio/DataSpaceEditorState.d.ts +42 -0
  59. package/lib/stores/studio/DataSpaceEditorState.d.ts.map +1 -0
  60. package/lib/stores/studio/DataSpaceEditorState.js +76 -0
  61. package/lib/stores/studio/DataSpaceEditorState.js.map +1 -0
  62. package/package.json +80 -0
  63. package/src/DSLDataSpace_Extension.ts +49 -0
  64. package/src/components/studio/DSLDataSpace_StudioPlugin.tsx +146 -0
  65. package/src/components/studio/DataSpaceEditor.tsx +275 -0
  66. package/src/graph/DSLDataSpace_PureGraphPlugin.ts +38 -0
  67. package/src/graphManager/DSLDataSpace_GraphManagerHelper.ts +21 -0
  68. package/src/graphManager/DSLDataSpace_PureGraphManagerPlugin.ts +56 -0
  69. package/src/index.ts +17 -0
  70. package/src/models/DSLDataSpace_ModelUtils.ts +19 -0
  71. package/src/models/metamodels/pure/model/packageableElements/dataSpace/DataSpace.ts +73 -0
  72. package/src/models/protocols/pure/DSLDataSpace_PureProtocolProcessorPlugin.ts +180 -0
  73. package/src/models/protocols/pure/v1/model/packageableElements/dataSpace/V1_DataSpace.ts +60 -0
  74. package/src/models/protocols/pure/v1/transformation/pureGraph/V1_DSLDataSpace_GraphBuilderHelper.ts +30 -0
  75. package/src/models/protocols/pure/v1/transformation/pureProtocol/V1_DSLDataSpace_ProtocolHelper.ts +82 -0
  76. package/src/stores/studio/DataSpaceEditorState.ts +108 -0
  77. package/tsconfig.json +64 -0
  78. package/tsconfig.package.json +40 -0
@@ -0,0 +1,60 @@
1
+ /**
2
+ * Copyright (c) 2020-present, Goldman Sachs
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ import { hashArray } from '@finos/legend-shared';
18
+ import type { Hashable } from '@finos/legend-shared';
19
+ import { DATA_SPACE_HASH_STRUCTURE } from '../../../../../../DSLDataSpace_ModelUtils';
20
+ import type {
21
+ V1_PackageableElementVisitor,
22
+ V1_StereotypePtr,
23
+ V1_TaggedValue,
24
+ } from '@finos/legend-graph';
25
+ import { V1_PackageableElement } from '@finos/legend-graph';
26
+
27
+ export class V1_DataSpace extends V1_PackageableElement implements Hashable {
28
+ stereotypes: V1_StereotypePtr[] = [];
29
+ taggedValues: V1_TaggedValue[] = [];
30
+ groupId!: string;
31
+ artifactId!: string;
32
+ versionId!: string;
33
+ mapping!: string;
34
+ runtime!: string;
35
+ diagrams?: string[] | undefined;
36
+ description?: string | undefined;
37
+ supportEmail?: string | undefined;
38
+
39
+ override get hashCode(): string {
40
+ return hashArray([
41
+ DATA_SPACE_HASH_STRUCTURE.DATA_SPACE,
42
+ hashArray(this.stereotypes),
43
+ hashArray(this.taggedValues),
44
+ this.groupId,
45
+ this.artifactId,
46
+ this.versionId,
47
+ this.mapping,
48
+ this.runtime,
49
+ hashArray(this.diagrams ?? []),
50
+ this.description ?? '',
51
+ this.supportEmail ?? '',
52
+ ]);
53
+ }
54
+
55
+ accept_PackageableElementVisitor<T>(
56
+ visitor: V1_PackageableElementVisitor<T>,
57
+ ): T {
58
+ return visitor.visit_PackageableElement(this);
59
+ }
60
+ }
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Copyright (c) 2020-present, Goldman Sachs
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ import { getDataSpace } from '../../../../../../graphManager/DSLDataSpace_GraphManagerHelper';
18
+ import type { DataSpace } from '../../../../../metamodels/pure/model/packageableElements/dataSpace/DataSpace';
19
+ import type {
20
+ PackageableElementImplicitReference,
21
+ V1_GraphBuilderContext,
22
+ } from '@finos/legend-graph';
23
+
24
+ export const V1_resolveDataSpace = (
25
+ path: string,
26
+ context: V1_GraphBuilderContext,
27
+ ): PackageableElementImplicitReference<DataSpace> =>
28
+ context.createImplicitPackageableElementReference(path, (_path: string) =>
29
+ getDataSpace(_path, context.graph),
30
+ );
@@ -0,0 +1,82 @@
1
+ /**
2
+ * Copyright (c) 2020-present, Goldman Sachs
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ import type { V1_StereotypePtr } from '@finos/legend-graph';
18
+ import {
19
+ V1_stereotypePtrSchema,
20
+ V1_taggedValueSchema,
21
+ } from '@finos/legend-graph';
22
+ import {
23
+ deserializeArray,
24
+ serializeArray,
25
+ usingConstantValueSchema,
26
+ } from '@finos/legend-shared';
27
+ import {
28
+ createModelSchema,
29
+ custom,
30
+ deserialize,
31
+ optional,
32
+ primitive,
33
+ serialize,
34
+ } from 'serializr';
35
+ import { V1_DataSpace } from '../../model/packageableElements/dataSpace/V1_DataSpace';
36
+
37
+ export const V1_DATA_SPACE_ELEMENT_PROTOCOL_TYPE = 'dataSpace';
38
+
39
+ export const V1_dataSpaceModelSchema = createModelSchema(V1_DataSpace, {
40
+ _type: usingConstantValueSchema(V1_DATA_SPACE_ELEMENT_PROTOCOL_TYPE),
41
+ artifactId: primitive(),
42
+ description: optional(primitive()),
43
+ diagrams: custom(
44
+ (values) => serializeArray(values, (value) => value, true),
45
+ (values) => deserializeArray(values, (value) => value, false),
46
+ ),
47
+ groupId: primitive(),
48
+ mapping: primitive(),
49
+ name: primitive(),
50
+ package: primitive(),
51
+ runtime: primitive(),
52
+ stereotypes: custom(
53
+ (values) =>
54
+ serializeArray(
55
+ values,
56
+ (value) => serialize(V1_stereotypePtrSchema, value),
57
+ true,
58
+ ),
59
+ (values) =>
60
+ deserializeArray(
61
+ values,
62
+ (v: V1_StereotypePtr) => deserialize(V1_stereotypePtrSchema, v),
63
+ false,
64
+ ),
65
+ ),
66
+ supportEmail: optional(primitive()),
67
+ taggedValues: custom(
68
+ (values) =>
69
+ serializeArray(
70
+ values,
71
+ (value) => serialize(V1_taggedValueSchema, value),
72
+ true,
73
+ ),
74
+ (values) =>
75
+ deserializeArray(
76
+ values,
77
+ (v: V1_StereotypePtr) => deserialize(V1_taggedValueSchema, v),
78
+ false,
79
+ ),
80
+ ),
81
+ versionId: primitive(),
82
+ });
@@ -0,0 +1,108 @@
1
+ /**
2
+ * Copyright (c) 2020-present, Goldman Sachs
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ import { computed, action, makeObservable, observable } from 'mobx';
18
+ import type { EditorStore } from '@finos/legend-studio';
19
+ import { guaranteeNonNullable, guaranteeType } from '@finos/legend-shared';
20
+ import { ElementEditorState } from '@finos/legend-studio';
21
+ import type { PackageableElement } from '@finos/legend-graph';
22
+ import { DataSpace } from '../../models/metamodels/pure/model/packageableElements/dataSpace/DataSpace';
23
+ import type { DiagramRenderer } from '@finos/legend-extension-dsl-diagram';
24
+ import { Diagram } from '@finos/legend-extension-dsl-diagram';
25
+
26
+ export enum DATA_SPACE_VIEWER_ACTIVITY_MODE {
27
+ MODELS = 'MODELS',
28
+ EXECUTION = 'EXECUTION',
29
+ ENTITLEMENT = 'ENTITLEMENT',
30
+ SUPPORT = 'SUPPORT',
31
+ }
32
+
33
+ export class DataSpaceEditorState extends ElementEditorState {
34
+ _renderer?: DiagramRenderer | undefined;
35
+ currentDiagram?: Diagram | undefined;
36
+ currentActivity = DATA_SPACE_VIEWER_ACTIVITY_MODE.MODELS;
37
+ diagrams: Diagram[] = [];
38
+
39
+ constructor(editorStore: EditorStore, element: PackageableElement) {
40
+ super(editorStore, element);
41
+
42
+ makeObservable(this, {
43
+ _renderer: observable,
44
+ currentDiagram: observable,
45
+ currentActivity: observable,
46
+ renderer: computed,
47
+ dataSpace: computed,
48
+ setRenderer: action,
49
+ setCurrentDiagram: action,
50
+ setCurrentActivity: action,
51
+ reprocess: action,
52
+ });
53
+
54
+ this.dataSpace.diagrams.forEach((diagram) => {
55
+ this.diagrams.push(
56
+ this.editorStore.graphManagerState.graph.getExtensionElement(
57
+ diagram,
58
+ Diagram,
59
+ ),
60
+ );
61
+ });
62
+ if (this.diagrams.length !== 0) {
63
+ this.setCurrentDiagram(this.diagrams[0]);
64
+ }
65
+ }
66
+
67
+ get dataSpace(): DataSpace {
68
+ return guaranteeType(
69
+ this.element,
70
+ DataSpace,
71
+ 'Element inside data space editor state must be a data space element',
72
+ );
73
+ }
74
+
75
+ get renderer(): DiagramRenderer {
76
+ return guaranteeNonNullable(
77
+ this._renderer,
78
+ `Diagram renderer must be initialized (this is likely caused by calling this method at the wrong place)`,
79
+ );
80
+ }
81
+
82
+ get isDiagramRendererInitialized(): boolean {
83
+ return Boolean(this._renderer);
84
+ }
85
+
86
+ setRenderer(val: DiagramRenderer): void {
87
+ this._renderer = val;
88
+ }
89
+
90
+ setCurrentDiagram(val: Diagram): void {
91
+ this.currentDiagram = val;
92
+ }
93
+
94
+ setCurrentActivity(val: DATA_SPACE_VIEWER_ACTIVITY_MODE): void {
95
+ this.currentActivity = val;
96
+ }
97
+
98
+ reprocess(
99
+ newElement: PackageableElement,
100
+ editorStore: EditorStore,
101
+ ): ElementEditorState {
102
+ const newElementEditorState = new DataSpaceEditorState(
103
+ editorStore,
104
+ newElement,
105
+ );
106
+ return newElementEditorState;
107
+ }
108
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,64 @@
1
+ {
2
+ "compilerOptions": {
3
+ "lib": [
4
+ "dom",
5
+ "dom.iterable",
6
+ "esnext",
7
+ "webworker",
8
+ "scripthost"
9
+ ],
10
+ "composite": true,
11
+ "declaration": true,
12
+ "declarationMap": true,
13
+ "sourceMap": true,
14
+ "target": "esnext",
15
+ "module": "esnext",
16
+ "skipLibCheck": true,
17
+ "moduleResolution": "node",
18
+ "resolveJsonModule": true,
19
+ "isolatedModules": true,
20
+ "importsNotUsedAsValues": "error",
21
+ "esModuleInterop": true,
22
+ "allowSyntheticDefaultImports": true,
23
+ "strict": true,
24
+ "noImplicitOverride": true,
25
+ "exactOptionalPropertyTypes": true,
26
+ "forceConsistentCasingInFileNames": true,
27
+ "outDir": "./lib",
28
+ "tsBuildInfoFile": "./build/prod.tsbuildinfo",
29
+ "rootDir": "./src",
30
+ "jsx": "react-jsx"
31
+ },
32
+ "references": [
33
+ {
34
+ "path": "./tsconfig.package.json"
35
+ }
36
+ ],
37
+ "files": [
38
+ "./src/DSLDataSpace_Extension.ts",
39
+ "./src/index.ts",
40
+ "./src/graph/DSLDataSpace_PureGraphPlugin.ts",
41
+ "./src/graphManager/DSLDataSpace_GraphManagerHelper.ts",
42
+ "./src/graphManager/DSLDataSpace_PureGraphManagerPlugin.ts",
43
+ "./src/models/DSLDataSpace_ModelUtils.ts",
44
+ "./src/models/metamodels/pure/model/packageableElements/dataSpace/DataSpace.ts",
45
+ "./src/models/protocols/pure/DSLDataSpace_PureProtocolProcessorPlugin.ts",
46
+ "./src/models/protocols/pure/v1/model/packageableElements/dataSpace/V1_DataSpace.ts",
47
+ "./src/models/protocols/pure/v1/transformation/pureGraph/V1_DSLDataSpace_GraphBuilderHelper.ts",
48
+ "./src/models/protocols/pure/v1/transformation/pureProtocol/V1_DSLDataSpace_ProtocolHelper.ts",
49
+ "./src/stores/studio/DataSpaceEditorState.ts",
50
+ "./src/components/studio/DSLDataSpace_StudioPlugin.tsx",
51
+ "./src/components/studio/DataSpaceEditor.tsx"
52
+ ],
53
+ "include": [
54
+ "src/**/*.ts",
55
+ "src/**/*.tsx",
56
+ "src/**/*.json"
57
+ ],
58
+ "exclude": [
59
+ "src/**/__tests__/**/*.ts",
60
+ "src/**/__tests__/**/*.tsx",
61
+ "src/**/__mocks__/**/*.ts",
62
+ "src/**/__mocks__/**/*.tsx"
63
+ ]
64
+ }
@@ -0,0 +1,40 @@
1
+ {
2
+ "compilerOptions": {
3
+ "lib": [
4
+ "dom",
5
+ "dom.iterable",
6
+ "esnext",
7
+ "webworker",
8
+ "scripthost"
9
+ ],
10
+ "composite": true,
11
+ "declaration": true,
12
+ "declarationMap": true,
13
+ "sourceMap": true,
14
+ "target": "esnext",
15
+ "module": "esnext",
16
+ "skipLibCheck": true,
17
+ "moduleResolution": "node",
18
+ "resolveJsonModule": true,
19
+ "isolatedModules": true,
20
+ "importsNotUsedAsValues": "error",
21
+ "esModuleInterop": true,
22
+ "allowSyntheticDefaultImports": true,
23
+ "strict": true,
24
+ "noImplicitOverride": true,
25
+ "exactOptionalPropertyTypes": true,
26
+ "forceConsistentCasingInFileNames": true,
27
+ "outDir": "./lib",
28
+ "tsBuildInfoFile": "./build/package.tsbuildinfo",
29
+ "rootDir": "./"
30
+ },
31
+ "files": [
32
+ "./package.json"
33
+ ],
34
+ "include": [
35
+ "package.json"
36
+ ],
37
+ "exclude": [
38
+ "lib"
39
+ ]
40
+ }