@finos/legend-extension-dsl-persistence 5.0.515 → 5.0.517
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.
- package/lib/components/studio/DSL_Persistence_LegendStudioApplicationPlugin.d.ts +3 -1
- package/lib/components/studio/DSL_Persistence_LegendStudioApplicationPlugin.d.ts.map +1 -1
- package/lib/components/studio/DSL_Persistence_LegendStudioApplicationPlugin.js +25 -1
- package/lib/components/studio/DSL_Persistence_LegendStudioApplicationPlugin.js.map +1 -1
- package/lib/components/studio/DSL_Persistence_NewPersistenceDriverEditor.d.ts +19 -0
- package/lib/components/studio/DSL_Persistence_NewPersistenceDriverEditor.d.ts.map +1 -0
- package/lib/components/studio/DSL_Persistence_NewPersistenceDriverEditor.js +32 -0
- package/lib/components/studio/DSL_Persistence_NewPersistenceDriverEditor.js.map +1 -0
- package/lib/index.css +1 -1
- package/lib/package.json +2 -1
- package/lib/stores/studio/DSL_Persistence_NewPersistenceDriver.d.ts +39 -0
- package/lib/stores/studio/DSL_Persistence_NewPersistenceDriver.d.ts.map +1 -0
- package/lib/stores/studio/DSL_Persistence_NewPersistenceDriver.js +70 -0
- package/lib/stores/studio/DSL_Persistence_NewPersistenceDriver.js.map +1 -0
- package/package.json +8 -7
- package/src/components/studio/DSL_Persistence_LegendStudioApplicationPlugin.tsx +33 -1
- package/src/components/studio/DSL_Persistence_NewPersistenceDriverEditor.tsx +74 -0
- package/src/stores/studio/DSL_Persistence_NewPersistenceDriver.ts +92 -0
- package/tsconfig.json +3 -1
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import { LegendStudioApplicationPlugin, type DSL_LegendStudioApplicationPlugin_Extension, type ElementEditorStateCreator, type ElementIconGetter, type DragElementClassifier, type ElementClassifier, type NewElementFromStateCreator, type PureGrammarParserElementSnippetSuggestionsGetter, type PureGrammarParserKeywordSuggestionGetter, type PureGrammarParserElementDocumentationGetter, type PureGrammarParserDocumentationGetter, type ElementTypeLabelGetter } from '@finos/legend-application-studio';
|
|
16
|
+
import { LegendStudioApplicationPlugin, type DSL_LegendStudioApplicationPlugin_Extension, type ElementEditorStateCreator, type ElementIconGetter, type DragElementClassifier, type ElementClassifier, type NewElementFromStateCreator, type PureGrammarParserElementSnippetSuggestionsGetter, type PureGrammarParserKeywordSuggestionGetter, type PureGrammarParserElementDocumentationGetter, type PureGrammarParserDocumentationGetter, type ElementTypeLabelGetter, type NewElementDriverCreator, type NewElementDriverEditorRenderer } from '@finos/legend-application-studio';
|
|
17
17
|
export declare class DSL_Persistence_LegendStudioApplicationPlugin extends LegendStudioApplicationPlugin implements DSL_LegendStudioApplicationPlugin_Extension {
|
|
18
18
|
constructor();
|
|
19
19
|
getExtraRequiredDocumentationKeys(): string[];
|
|
@@ -23,6 +23,8 @@ export declare class DSL_Persistence_LegendStudioApplicationPlugin extends Legen
|
|
|
23
23
|
getExtraElementClassifiers(): ElementClassifier[];
|
|
24
24
|
getExtraElementIconGetters(): ElementIconGetter[];
|
|
25
25
|
getExtraNewElementFromStateCreators(): NewElementFromStateCreator[];
|
|
26
|
+
getExtraNewElementDriverCreators(): NewElementDriverCreator[];
|
|
27
|
+
getExtraNewElementDriverEditorRenderers(): NewElementDriverEditorRenderer[];
|
|
26
28
|
getExtraElementEditorStateCreators(): ElementEditorStateCreator[];
|
|
27
29
|
getExtraDragElementClassifiers(): DragElementClassifier[];
|
|
28
30
|
getExtraPureGrammarTextEditorDragElementTypes(): string[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DSL_Persistence_LegendStudioApplicationPlugin.d.ts","sourceRoot":"","sources":["../../../src/components/studio/DSL_Persistence_LegendStudioApplicationPlugin.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAKH,OAAO,EACL,6BAA6B,EAE7B,KAAK,2CAA2C,EAGhD,KAAK,yBAAyB,EAC9B,KAAK,iBAAiB,EACtB,KAAK,qBAAqB,EAC1B,KAAK,iBAAiB,EACtB,KAAK,0BAA0B,EAE/B,KAAK,gDAAgD,EACrD,KAAK,wCAAwC,EAC7C,KAAK,2CAA2C,EAChD,KAAK,oCAAoC,EACzC,KAAK,sBAAsB,
|
|
1
|
+
{"version":3,"file":"DSL_Persistence_LegendStudioApplicationPlugin.d.ts","sourceRoot":"","sources":["../../../src/components/studio/DSL_Persistence_LegendStudioApplicationPlugin.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAKH,OAAO,EACL,6BAA6B,EAE7B,KAAK,2CAA2C,EAGhD,KAAK,yBAAyB,EAC9B,KAAK,iBAAiB,EACtB,KAAK,qBAAqB,EAC1B,KAAK,iBAAiB,EACtB,KAAK,0BAA0B,EAE/B,KAAK,gDAAgD,EACrD,KAAK,wCAAwC,EAC7C,KAAK,2CAA2C,EAChD,KAAK,oCAAoC,EACzC,KAAK,sBAAsB,EAE3B,KAAK,uBAAuB,EAC5B,KAAK,8BAA8B,EAEpC,MAAM,kCAAkC,CAAC;AA0B1C,qBAAa,6CACX,SAAQ,6BACR,YAAW,2CAA2C;;IAM7C,iCAAiC,IAAI,MAAM,EAAE;IAQtD,2BAA2B,IAAI,MAAM,EAAE;IAOvC,6BAA6B,IAAI,MAAM,EAAE;IAIzC,yCAAyC,CAAC,IAAI,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC;IASnE,0BAA0B,IAAI,iBAAiB,EAAE;IAajD,0BAA0B,IAAI,iBAAiB,EAAE;IAqBjD,mCAAmC,IAAI,0BAA0B,EAAE;IAmBnE,gCAAgC,IAAI,uBAAuB,EAAE;IAc7D,uCAAuC,IAAI,8BAA8B,EAAE;IAW3E,kCAAkC,IAAI,yBAAyB,EAAE;IAiBjE,8BAA8B,IAAI,qBAAqB,EAAE;IAazD,6CAA6C,IAAI,MAAM,EAAE;IAOzD,oDAAoD,IAAI,2CAA2C,EAAE;IA0BrG,6CAA6C,IAAI,oCAAoC,EAAE;IAgBvF,iDAAiD,IAAI,wCAAwC,EAAE;IAgB/F,yDAAyD,IAAI,gDAAgD,EAAE;IAuB/G,+BAA+B,IAAI,sBAAsB,EAAE;CAU5D"}
|
|
@@ -21,6 +21,8 @@ import { Persistence } from '../../graph/metamodel/pure/model/packageableElement
|
|
|
21
21
|
import { PersistenceContext } from '../../graph/metamodel/pure/model/packageableElements/persistence/DSL_Persistence_PersistenceContext.js';
|
|
22
22
|
import { BLANK_PERSISTENCE_CONTEXT_SNIPPET, BLANK_PERSISTENCE_SNIPPET, } from '../../__lib__/studio/DSL_Persistence_LegendStudioCodeSnippet.js';
|
|
23
23
|
import { DSL_PERSISTENCE_LEGEND_STUDIO_DOCUMENTATION_KEY } from '../../__lib__/studio/DSL_Persistence_LegendStudioDocumentation.js';
|
|
24
|
+
import { NewPersistenceDriver } from '../../stores/studio/DSL_Persistence_NewPersistenceDriver.js';
|
|
25
|
+
import { NewPersistenceDriverEditor } from './DSL_Persistence_NewPersistenceDriverEditor.js';
|
|
24
26
|
const PERSISTENCE_ELEMENT_TYPE = 'PERSISTENCE';
|
|
25
27
|
const PERSISTENCE_CONTEXT_ELEMENT_TYPE = 'PERSISTENCE_CONTEXT';
|
|
26
28
|
const PERSISTENCE_ELEMENT_PROJECT_EXPLORER_DND_TYPE = 'PROJECT_EXPLORER_PERSISTENCE';
|
|
@@ -83,7 +85,9 @@ export class DSL_Persistence_LegendStudioApplicationPlugin extends LegendStudioA
|
|
|
83
85
|
return [
|
|
84
86
|
(type, name, state) => {
|
|
85
87
|
if (type === PERSISTENCE_ELEMENT_TYPE) {
|
|
86
|
-
return
|
|
88
|
+
return state
|
|
89
|
+
.getNewElementDriver(NewPersistenceDriver)
|
|
90
|
+
.createElement(name);
|
|
87
91
|
}
|
|
88
92
|
else if (type === PERSISTENCE_CONTEXT_ELEMENT_TYPE) {
|
|
89
93
|
return new PersistenceContext(name);
|
|
@@ -92,6 +96,26 @@ export class DSL_Persistence_LegendStudioApplicationPlugin extends LegendStudioA
|
|
|
92
96
|
},
|
|
93
97
|
];
|
|
94
98
|
}
|
|
99
|
+
getExtraNewElementDriverCreators() {
|
|
100
|
+
return [
|
|
101
|
+
(editorStore, type) => {
|
|
102
|
+
if (type === PERSISTENCE_ELEMENT_TYPE) {
|
|
103
|
+
return new NewPersistenceDriver(editorStore);
|
|
104
|
+
}
|
|
105
|
+
return undefined;
|
|
106
|
+
},
|
|
107
|
+
];
|
|
108
|
+
}
|
|
109
|
+
getExtraNewElementDriverEditorRenderers() {
|
|
110
|
+
return [
|
|
111
|
+
(type) => {
|
|
112
|
+
if (type === PERSISTENCE_ELEMENT_TYPE) {
|
|
113
|
+
return _jsx(NewPersistenceDriverEditor, {});
|
|
114
|
+
}
|
|
115
|
+
return undefined;
|
|
116
|
+
},
|
|
117
|
+
];
|
|
118
|
+
}
|
|
95
119
|
getExtraElementEditorStateCreators() {
|
|
96
120
|
return [
|
|
97
121
|
(editorStore, element) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DSL_Persistence_LegendStudioApplicationPlugin.js","sourceRoot":"","sources":["../../../src/components/studio/DSL_Persistence_LegendStudioApplicationPlugin.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,WAAW,MAAM,uBAAuB,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AACtE,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEhE,OAAO,EACL,6BAA6B,EAC7B,6BAA6B,
|
|
1
|
+
{"version":3,"file":"DSL_Persistence_LegendStudioApplicationPlugin.js","sourceRoot":"","sources":["../../../src/components/studio/DSL_Persistence_LegendStudioApplicationPlugin.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,WAAW,MAAM,uBAAuB,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AACtE,OAAO,EAAE,UAA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S;wBACtB,UAAU,EAAE,iCAAiC;qBAC9C;iBACF;gBACH,CAAC,CAAC,SAAS;SAChB,CAAC;IACJ,CAAC;IAED,+BAA+B;QAC7B,OAAO;YACL,CAAC,IAAY,EAAsB,EAAE;gBACnC,IAAI,IAAI,KAAK,gCAAgC,EAAE,CAAC;oBAC9C,OAAO,qBAAqB,CAAC;gBAC/B,CAAC;gBACD,OAAO,SAAS,CAAC;YACnB,CAAC;SACF,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2026-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
|
+
export declare const NewPersistenceDriverEditor: (() => import("react/jsx-runtime").JSX.Element) & {
|
|
17
|
+
displayName: string;
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=DSL_Persistence_NewPersistenceDriverEditor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DSL_Persistence_NewPersistenceDriverEditor.d.ts","sourceRoot":"","sources":["../../../src/components/studio/DSL_Persistence_NewPersistenceDriverEditor.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAUH,eAAO,MAAM,0BAA0B;;CAiDrC,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright (c) 2026-present, Goldman Sachs
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
import { useEditorStore } from '@finos/legend-application-studio';
|
|
18
|
+
import { CustomSelectorInput } from '@finos/legend-art';
|
|
19
|
+
import { observer } from 'mobx-react-lite';
|
|
20
|
+
import { NewPersistenceDriver, } from '../../stores/studio/DSL_Persistence_NewPersistenceDriver.js';
|
|
21
|
+
export const NewPersistenceDriverEditor = observer(() => {
|
|
22
|
+
const editorStore = useEditorStore();
|
|
23
|
+
const applicationStore = editorStore.applicationStore;
|
|
24
|
+
const persistenceDriver = editorStore.newElementState.getNewElementDriver(NewPersistenceDriver);
|
|
25
|
+
const serviceOptions = persistenceDriver.serviceOptions;
|
|
26
|
+
const onServiceChange = (val) => persistenceDriver.setServiceOption(val ?? undefined);
|
|
27
|
+
const handleDocumentationChange = (event) => persistenceDriver.setDocumentation(event.target.value);
|
|
28
|
+
return (_jsxs(_Fragment, { children: [_jsx("div", { className: "panel__content__form__section__header__label", children: "Service" }), _jsx("div", { className: "explorer__new-element-modal__driver", children: _jsx(CustomSelectorInput, { className: "explorer__new-element-modal__driver__dropdown", options: serviceOptions, onChange: onServiceChange, value: persistenceDriver.serviceOption ?? null, placeholder: serviceOptions.length
|
|
29
|
+
? 'Choose the service to persist...'
|
|
30
|
+
: 'No services in this project: create a service first', disabled: !serviceOptions.length, darkMode: !applicationStore.layoutService.TEMPORARY__isLightColorThemeEnabled }) }), _jsx("div", { className: "panel__content__form__section__header__label", children: "Documentation" }), _jsx("div", { className: "explorer__new-element-modal__driver", children: _jsx("input", { className: "input--dark explorer__new-element-modal__name-input", spellCheck: false, value: persistenceDriver.documentation, onChange: handleDocumentationChange, placeholder: "Describe what this persistence does" }) })] }));
|
|
31
|
+
});
|
|
32
|
+
//# sourceMappingURL=DSL_Persistence_NewPersistenceDriverEditor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DSL_Persistence_NewPersistenceDriverEditor.js","sourceRoot":"","sources":["../../../src/components/studio/DSL_Persistence_NewPersistenceDriverEditor.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAClE,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAEL,oBAAoB,GACrB,MAAM,6DAA6D,CAAC;AAErE,MAAM,CAAC,MAAM,0BAA0B,GAAG,QAAQ,CAAC,GAAG,EAAE;IACtD,MAAM,WAAW,GAAG,cAAc,EAAE,CAAC;IACrC,MAAM,gBAAgB,GAAG,WAAW,CAAC,gBAAgB,CAAC;IACtD,MAAM,iBAAiB,GACrB,WAAW,CAAC,eAAe,CAAC,mBAAmB,CAAC,oBAAoB,CAAC,CAAC;IACxE,MAAM,cAAc,GAAG,iBAAiB,CAAC,cAAc,CAAC;IAExD,MAAM,eAAe,GAAG,CAAC,GAAoC,EAAQ,EAAE,CACrE,iBAAiB,CAAC,gBAAgB,CAAC,GAAG,IAAI,SAAS,CAAC,CAAC;IACvD,MAAM,yBAAyB,GAE3B,CAAC,KAAK,EAAE,EAAE,CAAC,iBAAiB,CAAC,gBAAgB,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAEtE,OAAO,CACL,8BACE,cAAK,SAAS,EAAC,8CAA8C,wBAEvD,EACN,cAAK,SAAS,EAAC,qCAAqC,YAClD,KAAC,mBAAmB,IAClB,SAAS,EAAC,+CAA+C,EACzD,OAAO,EAAE,cAAc,EACvB,QAAQ,EAAE,eAAe,EACzB,KAAK,EAAE,iBAAiB,CAAC,aAAa,IAAI,IAAI,EAC9C,WAAW,EACT,cAAc,CAAC,MAAM;wBACnB,CAAC,CAAC,kCAAkC;wBACpC,CAAC,CAAC,qDAAqD,EAE3D,QAAQ,EAAE,CAAC,cAAc,CAAC,MAAM,EAChC,QAAQ,EACN,CAAC,gBAAgB,CAAC,aAAa,CAAC,mCAAmC,GAErE,GACE,EACN,cAAK,SAAS,EAAC,8CAA8C,8BAEvD,EACN,cAAK,SAAS,EAAC,qCAAqC,YAClD,gBACE,SAAS,EAAC,qDAAqD,EAC/D,UAAU,EAAE,KAAK,EACjB,KAAK,EAAE,iBAAiB,CAAC,aAAa,EACtC,QAAQ,EAAE,yBAAyB,EACnC,WAAW,EAAC,qCAAqC,GACjD,GACE,IACL,CACJ,CAAC;AACJ,CAAC,CAAC,CAAC"}
|
package/lib/index.css
CHANGED
package/lib/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@finos/legend-extension-dsl-persistence",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.517",
|
|
4
4
|
"description": "Legend extension for Persistence DSL",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"legend",
|
|
@@ -53,6 +53,7 @@
|
|
|
53
53
|
"@finos/legend-storage": "workspace:*",
|
|
54
54
|
"@types/react": "19.0.10",
|
|
55
55
|
"mobx": "6.13.6",
|
|
56
|
+
"mobx-react-lite": "4.1.0",
|
|
56
57
|
"react": "19.0.1",
|
|
57
58
|
"serializr": "3.0.3"
|
|
58
59
|
},
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2026-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
|
+
import { type EditorStore, NewElementDriver } from '@finos/legend-application-studio';
|
|
17
|
+
import { type Service } from '@finos/legend-graph';
|
|
18
|
+
import { Persistence } from '../../graph/metamodel/pure/model/packageableElements/persistence/DSL_Persistence_Persistence.js';
|
|
19
|
+
export type PersistenceServiceOption = {
|
|
20
|
+
label: string;
|
|
21
|
+
value: Service;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* A persistence needs a documentation, a trigger and a service (the grammar
|
|
25
|
+
* requires all three, and the graph builder rejects an empty documentation),
|
|
26
|
+
* so the new element dialog asks for the service and the documentation and
|
|
27
|
+
* defaults the trigger to manual.
|
|
28
|
+
*/
|
|
29
|
+
export declare class NewPersistenceDriver extends NewElementDriver<Persistence> {
|
|
30
|
+
serviceOption?: PersistenceServiceOption | undefined;
|
|
31
|
+
documentation: string;
|
|
32
|
+
constructor(editorStore: EditorStore);
|
|
33
|
+
get serviceOptions(): PersistenceServiceOption[];
|
|
34
|
+
setServiceOption(val: PersistenceServiceOption | undefined): void;
|
|
35
|
+
setDocumentation(val: string): void;
|
|
36
|
+
get isValid(): boolean;
|
|
37
|
+
createElement(name: string): Persistence;
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=DSL_Persistence_NewPersistenceDriver.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DSL_Persistence_NewPersistenceDriver.d.ts","sourceRoot":"","sources":["../../../src/stores/studio/DSL_Persistence_NewPersistenceDriver.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EACL,KAAK,WAAW,EAChB,gBAAgB,EACjB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EACL,KAAK,OAAO,EAEb,MAAM,qBAAqB,CAAC;AAG7B,OAAO,EAAE,WAAW,EAAE,MAAM,iGAAiG,CAAC;AAI9H,MAAM,MAAM,wBAAwB,GAAG;IACrC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,OAAO,CAAC;CAChB,CAAC;AAEF;;;;;GAKG;AACH,qBAAa,oBAAqB,SAAQ,gBAAgB,CAAC,WAAW,CAAC;IACrE,aAAa,CAAC,EAAE,wBAAwB,GAAG,SAAS,CAAC;IACrD,aAAa,SAAM;gBAEP,WAAW,EAAE,WAAW;IAgBpC,IAAI,cAAc,IAAI,wBAAwB,EAAE,CAK/C;IAED,gBAAgB,CAAC,GAAG,EAAE,wBAAwB,GAAG,SAAS,GAAG,IAAI;IAIjE,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAInC,IAAI,OAAO,IAAI,OAAO,CAErB;IAED,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW;CAWzC"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2026-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
|
+
import { NewElementDriver, } from '@finos/legend-application-studio';
|
|
17
|
+
import { PackageableElementExplicitReference, } from '@finos/legend-graph';
|
|
18
|
+
import { guaranteeNonNullable } from '@finos/legend-shared';
|
|
19
|
+
import { action, computed, makeObservable, observable } from 'mobx';
|
|
20
|
+
import { Persistence } from '../../graph/metamodel/pure/model/packageableElements/persistence/DSL_Persistence_Persistence.js';
|
|
21
|
+
import { ManualTrigger } from '../../graph/metamodel/pure/model/packageableElements/persistence/DSL_Persistence_Trigger.js';
|
|
22
|
+
import { Notifier } from '../../graph/metamodel/pure/model/packageableElements/persistence/DSL_Persistence_Notifier.js';
|
|
23
|
+
/**
|
|
24
|
+
* A persistence needs a documentation, a trigger and a service (the grammar
|
|
25
|
+
* requires all three, and the graph builder rejects an empty documentation),
|
|
26
|
+
* so the new element dialog asks for the service and the documentation and
|
|
27
|
+
* defaults the trigger to manual.
|
|
28
|
+
*/
|
|
29
|
+
export class NewPersistenceDriver extends NewElementDriver {
|
|
30
|
+
serviceOption;
|
|
31
|
+
documentation = '';
|
|
32
|
+
constructor(editorStore) {
|
|
33
|
+
super(editorStore);
|
|
34
|
+
makeObservable(this, {
|
|
35
|
+
serviceOption: observable,
|
|
36
|
+
documentation: observable,
|
|
37
|
+
serviceOptions: computed,
|
|
38
|
+
isValid: computed,
|
|
39
|
+
setServiceOption: action,
|
|
40
|
+
setDocumentation: action,
|
|
41
|
+
createElement: action,
|
|
42
|
+
});
|
|
43
|
+
this.serviceOption = this.serviceOptions[0];
|
|
44
|
+
}
|
|
45
|
+
get serviceOptions() {
|
|
46
|
+
return this.editorStore.graphManagerState.usableServices.map((service) => ({
|
|
47
|
+
label: service.path,
|
|
48
|
+
value: service,
|
|
49
|
+
}));
|
|
50
|
+
}
|
|
51
|
+
setServiceOption(val) {
|
|
52
|
+
this.serviceOption = val;
|
|
53
|
+
}
|
|
54
|
+
setDocumentation(val) {
|
|
55
|
+
this.documentation = val;
|
|
56
|
+
}
|
|
57
|
+
get isValid() {
|
|
58
|
+
return Boolean(this.serviceOption && this.documentation.trim());
|
|
59
|
+
}
|
|
60
|
+
createElement(name) {
|
|
61
|
+
const persistence = new Persistence(name);
|
|
62
|
+
persistence.documentation = this.documentation.trim();
|
|
63
|
+
persistence.trigger = new ManualTrigger();
|
|
64
|
+
persistence.service = PackageableElementExplicitReference.create(guaranteeNonNullable(this.serviceOption).value);
|
|
65
|
+
persistence.serviceOutputTargets = [];
|
|
66
|
+
persistence.notifier = new Notifier();
|
|
67
|
+
return persistence;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=DSL_Persistence_NewPersistenceDriver.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DSL_Persistence_NewPersistenceDriver.js","sourceRoot":"","sources":["../../../src/stores/studio/DSL_Persistence_NewPersistenceDriver.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAEL,gBAAgB,GACjB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAEL,mCAAmC,GACpC,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AACpE,OAAO,EAAE,WAAW,EAAE,MAAM,iGAAiG,CAAC;AAC9H,OAAO,EAAE,aAAa,EAAE,MAAM,6FAA6F,CAAC;AAC5H,OAAO,EAAE,QAAQ,EAAE,MAAM,8FAA8F,CAAC;AAOxH;;;;;GAKG;AACH,MAAM,OAAO,oBAAqB,SAAQ,gBAA6B;IACrE,aAAa,CAAwC;IACrD,aAAa,GAA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W,CAAC,oBAAoB,GAAG,EAAE,CAAC;QACtC,WAAW,CAAC,QAAQ,GAAG,IAAI,QAAQ,EAAE,CAAC;QACtC,OAAO,WAAW,CAAC;IACrB,CAAC;CACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@finos/legend-extension-dsl-persistence",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.517",
|
|
4
4
|
"description": "Legend extension for Persistence DSL",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"legend",
|
|
@@ -44,20 +44,21 @@
|
|
|
44
44
|
"test:watch": "jest --watch"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@finos/legend-application": "16.1.
|
|
48
|
-
"@finos/legend-application-studio": "28.22.
|
|
49
|
-
"@finos/legend-art": "7.1.
|
|
50
|
-
"@finos/legend-code-editor": "2.0.
|
|
51
|
-
"@finos/legend-graph": "32.9.
|
|
47
|
+
"@finos/legend-application": "16.1.2",
|
|
48
|
+
"@finos/legend-application-studio": "28.22.2",
|
|
49
|
+
"@finos/legend-art": "7.1.173",
|
|
50
|
+
"@finos/legend-code-editor": "2.0.216",
|
|
51
|
+
"@finos/legend-graph": "32.9.3",
|
|
52
52
|
"@finos/legend-shared": "11.0.33",
|
|
53
53
|
"@finos/legend-storage": "3.0.155",
|
|
54
54
|
"@types/react": "19.0.10",
|
|
55
55
|
"mobx": "6.13.6",
|
|
56
|
+
"mobx-react-lite": "4.1.0",
|
|
56
57
|
"react": "19.0.1",
|
|
57
58
|
"serializr": "3.0.3"
|
|
58
59
|
},
|
|
59
60
|
"devDependencies": {
|
|
60
|
-
"@finos/legend-dev-utils": "2.2.
|
|
61
|
+
"@finos/legend-dev-utils": "2.2.13",
|
|
61
62
|
"@jest/globals": "29.7.0",
|
|
62
63
|
"cross-env": "7.0.3",
|
|
63
64
|
"eslint": "9.22.0",
|
|
@@ -34,6 +34,9 @@ import {
|
|
|
34
34
|
type PureGrammarParserElementDocumentationGetter,
|
|
35
35
|
type PureGrammarParserDocumentationGetter,
|
|
36
36
|
type ElementTypeLabelGetter,
|
|
37
|
+
type NewElementDriver,
|
|
38
|
+
type NewElementDriverCreator,
|
|
39
|
+
type NewElementDriverEditorRenderer,
|
|
37
40
|
PACKAGEABLE_ELEMENT_GROUP_BY_CATEGORY,
|
|
38
41
|
} from '@finos/legend-application-studio';
|
|
39
42
|
import { Persistence } from '../../graph/metamodel/pure/model/packageableElements/persistence/DSL_Persistence_Persistence.js';
|
|
@@ -43,6 +46,8 @@ import {
|
|
|
43
46
|
BLANK_PERSISTENCE_SNIPPET,
|
|
44
47
|
} from '../../__lib__/studio/DSL_Persistence_LegendStudioCodeSnippet.js';
|
|
45
48
|
import { DSL_PERSISTENCE_LEGEND_STUDIO_DOCUMENTATION_KEY } from '../../__lib__/studio/DSL_Persistence_LegendStudioDocumentation.js';
|
|
49
|
+
import { NewPersistenceDriver } from '../../stores/studio/DSL_Persistence_NewPersistenceDriver.js';
|
|
50
|
+
import { NewPersistenceDriverEditor } from './DSL_Persistence_NewPersistenceDriverEditor.js';
|
|
46
51
|
import type { PureGrammarTextSuggestion } from '@finos/legend-code-editor';
|
|
47
52
|
import type { DocumentationEntry } from '@finos/legend-shared';
|
|
48
53
|
|
|
@@ -137,7 +142,9 @@ export class DSL_Persistence_LegendStudioApplicationPlugin
|
|
|
137
142
|
state: NewElementState,
|
|
138
143
|
): PackageableElement | undefined => {
|
|
139
144
|
if (type === PERSISTENCE_ELEMENT_TYPE) {
|
|
140
|
-
return
|
|
145
|
+
return state
|
|
146
|
+
.getNewElementDriver(NewPersistenceDriver)
|
|
147
|
+
.createElement(name);
|
|
141
148
|
} else if (type === PERSISTENCE_CONTEXT_ELEMENT_TYPE) {
|
|
142
149
|
return new PersistenceContext(name);
|
|
143
150
|
}
|
|
@@ -146,6 +153,31 @@ export class DSL_Persistence_LegendStudioApplicationPlugin
|
|
|
146
153
|
];
|
|
147
154
|
}
|
|
148
155
|
|
|
156
|
+
getExtraNewElementDriverCreators(): NewElementDriverCreator[] {
|
|
157
|
+
return [
|
|
158
|
+
(
|
|
159
|
+
editorStore: EditorStore,
|
|
160
|
+
type: string,
|
|
161
|
+
): NewElementDriver<PackageableElement> | undefined => {
|
|
162
|
+
if (type === PERSISTENCE_ELEMENT_TYPE) {
|
|
163
|
+
return new NewPersistenceDriver(editorStore);
|
|
164
|
+
}
|
|
165
|
+
return undefined;
|
|
166
|
+
},
|
|
167
|
+
];
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
getExtraNewElementDriverEditorRenderers(): NewElementDriverEditorRenderer[] {
|
|
171
|
+
return [
|
|
172
|
+
(type: string): React.ReactNode | undefined => {
|
|
173
|
+
if (type === PERSISTENCE_ELEMENT_TYPE) {
|
|
174
|
+
return <NewPersistenceDriverEditor />;
|
|
175
|
+
}
|
|
176
|
+
return undefined;
|
|
177
|
+
},
|
|
178
|
+
];
|
|
179
|
+
}
|
|
180
|
+
|
|
149
181
|
getExtraElementEditorStateCreators(): ElementEditorStateCreator[] {
|
|
150
182
|
return [
|
|
151
183
|
(
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2026-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 { useEditorStore } from '@finos/legend-application-studio';
|
|
18
|
+
import { CustomSelectorInput } from '@finos/legend-art';
|
|
19
|
+
import { observer } from 'mobx-react-lite';
|
|
20
|
+
import {
|
|
21
|
+
type PersistenceServiceOption,
|
|
22
|
+
NewPersistenceDriver,
|
|
23
|
+
} from '../../stores/studio/DSL_Persistence_NewPersistenceDriver.js';
|
|
24
|
+
|
|
25
|
+
export const NewPersistenceDriverEditor = observer(() => {
|
|
26
|
+
const editorStore = useEditorStore();
|
|
27
|
+
const applicationStore = editorStore.applicationStore;
|
|
28
|
+
const persistenceDriver =
|
|
29
|
+
editorStore.newElementState.getNewElementDriver(NewPersistenceDriver);
|
|
30
|
+
const serviceOptions = persistenceDriver.serviceOptions;
|
|
31
|
+
|
|
32
|
+
const onServiceChange = (val: PersistenceServiceOption | null): void =>
|
|
33
|
+
persistenceDriver.setServiceOption(val ?? undefined);
|
|
34
|
+
const handleDocumentationChange: React.ChangeEventHandler<
|
|
35
|
+
HTMLInputElement
|
|
36
|
+
> = (event) => persistenceDriver.setDocumentation(event.target.value);
|
|
37
|
+
|
|
38
|
+
return (
|
|
39
|
+
<>
|
|
40
|
+
<div className="panel__content__form__section__header__label">
|
|
41
|
+
Service
|
|
42
|
+
</div>
|
|
43
|
+
<div className="explorer__new-element-modal__driver">
|
|
44
|
+
<CustomSelectorInput
|
|
45
|
+
className="explorer__new-element-modal__driver__dropdown"
|
|
46
|
+
options={serviceOptions}
|
|
47
|
+
onChange={onServiceChange}
|
|
48
|
+
value={persistenceDriver.serviceOption ?? null}
|
|
49
|
+
placeholder={
|
|
50
|
+
serviceOptions.length
|
|
51
|
+
? 'Choose the service to persist...'
|
|
52
|
+
: 'No services in this project: create a service first'
|
|
53
|
+
}
|
|
54
|
+
disabled={!serviceOptions.length}
|
|
55
|
+
darkMode={
|
|
56
|
+
!applicationStore.layoutService.TEMPORARY__isLightColorThemeEnabled
|
|
57
|
+
}
|
|
58
|
+
/>
|
|
59
|
+
</div>
|
|
60
|
+
<div className="panel__content__form__section__header__label">
|
|
61
|
+
Documentation
|
|
62
|
+
</div>
|
|
63
|
+
<div className="explorer__new-element-modal__driver">
|
|
64
|
+
<input
|
|
65
|
+
className="input--dark explorer__new-element-modal__name-input"
|
|
66
|
+
spellCheck={false}
|
|
67
|
+
value={persistenceDriver.documentation}
|
|
68
|
+
onChange={handleDocumentationChange}
|
|
69
|
+
placeholder="Describe what this persistence does"
|
|
70
|
+
/>
|
|
71
|
+
</div>
|
|
72
|
+
</>
|
|
73
|
+
);
|
|
74
|
+
});
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2026-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 {
|
|
18
|
+
type EditorStore,
|
|
19
|
+
NewElementDriver,
|
|
20
|
+
} from '@finos/legend-application-studio';
|
|
21
|
+
import {
|
|
22
|
+
type Service,
|
|
23
|
+
PackageableElementExplicitReference,
|
|
24
|
+
} from '@finos/legend-graph';
|
|
25
|
+
import { guaranteeNonNullable } from '@finos/legend-shared';
|
|
26
|
+
import { action, computed, makeObservable, observable } from 'mobx';
|
|
27
|
+
import { Persistence } from '../../graph/metamodel/pure/model/packageableElements/persistence/DSL_Persistence_Persistence.js';
|
|
28
|
+
import { ManualTrigger } from '../../graph/metamodel/pure/model/packageableElements/persistence/DSL_Persistence_Trigger.js';
|
|
29
|
+
import { Notifier } from '../../graph/metamodel/pure/model/packageableElements/persistence/DSL_Persistence_Notifier.js';
|
|
30
|
+
|
|
31
|
+
export type PersistenceServiceOption = {
|
|
32
|
+
label: string;
|
|
33
|
+
value: Service;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* A persistence needs a documentation, a trigger and a service (the grammar
|
|
38
|
+
* requires all three, and the graph builder rejects an empty documentation),
|
|
39
|
+
* so the new element dialog asks for the service and the documentation and
|
|
40
|
+
* defaults the trigger to manual.
|
|
41
|
+
*/
|
|
42
|
+
export class NewPersistenceDriver extends NewElementDriver<Persistence> {
|
|
43
|
+
serviceOption?: PersistenceServiceOption | undefined;
|
|
44
|
+
documentation = '';
|
|
45
|
+
|
|
46
|
+
constructor(editorStore: EditorStore) {
|
|
47
|
+
super(editorStore);
|
|
48
|
+
|
|
49
|
+
makeObservable(this, {
|
|
50
|
+
serviceOption: observable,
|
|
51
|
+
documentation: observable,
|
|
52
|
+
serviceOptions: computed,
|
|
53
|
+
isValid: computed,
|
|
54
|
+
setServiceOption: action,
|
|
55
|
+
setDocumentation: action,
|
|
56
|
+
createElement: action,
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
this.serviceOption = this.serviceOptions[0];
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
get serviceOptions(): PersistenceServiceOption[] {
|
|
63
|
+
return this.editorStore.graphManagerState.usableServices.map((service) => ({
|
|
64
|
+
label: service.path,
|
|
65
|
+
value: service,
|
|
66
|
+
}));
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
setServiceOption(val: PersistenceServiceOption | undefined): void {
|
|
70
|
+
this.serviceOption = val;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
setDocumentation(val: string): void {
|
|
74
|
+
this.documentation = val;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
get isValid(): boolean {
|
|
78
|
+
return Boolean(this.serviceOption && this.documentation.trim());
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
createElement(name: string): Persistence {
|
|
82
|
+
const persistence = new Persistence(name);
|
|
83
|
+
persistence.documentation = this.documentation.trim();
|
|
84
|
+
persistence.trigger = new ManualTrigger();
|
|
85
|
+
persistence.service = PackageableElementExplicitReference.create(
|
|
86
|
+
guaranteeNonNullable(this.serviceOption).value,
|
|
87
|
+
);
|
|
88
|
+
persistence.serviceOutputTargets = [];
|
|
89
|
+
persistence.notifier = new Notifier();
|
|
90
|
+
return persistence;
|
|
91
|
+
}
|
|
92
|
+
}
|
package/tsconfig.json
CHANGED
|
@@ -139,7 +139,9 @@
|
|
|
139
139
|
"./src/graph-manager/protocol/pure/v1/transformation/pureGraph/to/V1_DSL_Persistence_ContextBuilder.ts",
|
|
140
140
|
"./src/graph-manager/protocol/pure/v1/transformation/pureProtocol/V1_DSL_PersistenceContext_ProtocolHelper.ts",
|
|
141
141
|
"./src/graph-manager/protocol/pure/v1/transformation/pureProtocol/V1_DSL_Persistence_ProtocolHelper.ts",
|
|
142
|
-
"./src/
|
|
142
|
+
"./src/stores/studio/DSL_Persistence_NewPersistenceDriver.ts",
|
|
143
|
+
"./src/components/studio/DSL_Persistence_LegendStudioApplicationPlugin.tsx",
|
|
144
|
+
"./src/components/studio/DSL_Persistence_NewPersistenceDriverEditor.tsx"
|
|
143
145
|
],
|
|
144
146
|
"include": [
|
|
145
147
|
"src/**/*.ts",
|