@finos/legend-extension-dsl-persistence 2.0.9 → 2.0.10
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/DSLPersistence_CodeSnippets.d.ts +1 -0
- package/lib/components/studio/DSLPersistence_CodeSnippets.d.ts.map +1 -1
- package/lib/components/studio/DSLPersistence_CodeSnippets.js +5 -1
- package/lib/components/studio/DSLPersistence_CodeSnippets.js.map +1 -1
- package/lib/components/studio/DSLPersistence_LegendStudioDocumentation.d.ts +2 -1
- package/lib/components/studio/DSLPersistence_LegendStudioDocumentation.d.ts.map +1 -1
- package/lib/components/studio/DSLPersistence_LegendStudioDocumentation.js +1 -0
- package/lib/components/studio/DSLPersistence_LegendStudioDocumentation.js.map +1 -1
- package/lib/components/studio/DSLPersistence_LegendStudioPlugin.d.ts.map +1 -1
- package/lib/components/studio/DSLPersistence_LegendStudioPlugin.js +36 -5
- package/lib/components/studio/DSLPersistence_LegendStudioPlugin.js.map +1 -1
- package/lib/graph/DSLPersistence_PureGraphPlugin.d.ts.map +1 -1
- package/lib/graph/DSLPersistence_PureGraphPlugin.js +2 -1
- package/lib/graph/DSLPersistence_PureGraphPlugin.js.map +1 -1
- package/lib/graphManager/DSLPersistence_GraphManagerHelper.d.ts +3 -0
- package/lib/graphManager/DSLPersistence_GraphManagerHelper.d.ts.map +1 -1
- package/lib/graphManager/DSLPersistence_GraphManagerHelper.js +3 -0
- package/lib/graphManager/DSLPersistence_GraphManagerHelper.js.map +1 -1
- package/lib/graphManager/DSLPersistence_PureGraphManagerPlugin.d.ts +1 -0
- package/lib/graphManager/DSLPersistence_PureGraphManagerPlugin.d.ts.map +1 -1
- package/lib/graphManager/DSLPersistence_PureGraphManagerPlugin.js +13 -1
- package/lib/graphManager/DSLPersistence_PureGraphManagerPlugin.js.map +1 -1
- package/lib/graphManager/action/changeDetection/DSLPersistenceContext_ObserverHelper.d.ts +18 -0
- package/lib/graphManager/action/changeDetection/DSLPersistenceContext_ObserverHelper.d.ts.map +1 -0
- package/lib/graphManager/action/changeDetection/DSLPersistenceContext_ObserverHelper.js +29 -0
- package/lib/graphManager/action/changeDetection/DSLPersistenceContext_ObserverHelper.js.map +1 -0
- package/lib/index.css +2 -2
- package/lib/index.css.map +1 -1
- package/lib/index.d.ts +8 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +11 -1
- package/lib/index.js.map +1 -1
- package/lib/models/DSLPersistence_ModelUtils.d.ts +5 -0
- package/lib/models/DSLPersistence_ModelUtils.d.ts.map +1 -1
- package/lib/models/DSLPersistence_ModelUtils.js +9 -0
- package/lib/models/DSLPersistence_ModelUtils.js.map +1 -1
- package/lib/models/metamodels/pure/model/packageableElements/persistence/DSLPersistence_PersistenceContext.d.ts +29 -0
- package/lib/models/metamodels/pure/model/packageableElements/persistence/DSLPersistence_PersistenceContext.d.ts.map +1 -0
- package/lib/models/metamodels/pure/model/packageableElements/persistence/DSLPersistence_PersistenceContext.js +37 -0
- package/lib/models/metamodels/pure/model/packageableElements/persistence/DSLPersistence_PersistenceContext.js.map +1 -0
- package/lib/models/metamodels/pure/model/packageableElements/persistence/DSLPersistence_PersistencePlatform.d.ts +23 -0
- package/lib/models/metamodels/pure/model/packageableElements/persistence/DSLPersistence_PersistencePlatform.d.ts.map +1 -0
- package/lib/models/metamodels/pure/model/packageableElements/persistence/DSLPersistence_PersistencePlatform.js +25 -0
- package/lib/models/metamodels/pure/model/packageableElements/persistence/DSLPersistence_PersistencePlatform.js.map +1 -0
- package/lib/models/metamodels/pure/model/packageableElements/persistence/DSLPersistence_ServiceParameter.d.ts +34 -0
- package/lib/models/metamodels/pure/model/packageableElements/persistence/DSLPersistence_ServiceParameter.d.ts.map +1 -0
- package/lib/models/metamodels/pure/model/packageableElements/persistence/DSLPersistence_ServiceParameter.js +49 -0
- package/lib/models/metamodels/pure/model/packageableElements/persistence/DSLPersistence_ServiceParameter.js.map +1 -0
- package/lib/models/metamodels/pure/model/packageableElements/persistence/DSLPersistence_Sink.d.ts +3 -2
- package/lib/models/metamodels/pure/model/packageableElements/persistence/DSLPersistence_Sink.d.ts.map +1 -1
- package/lib/models/metamodels/pure/model/packageableElements/persistence/DSLPersistence_Sink.js +6 -1
- package/lib/models/metamodels/pure/model/packageableElements/persistence/DSLPersistence_Sink.js.map +1 -1
- package/lib/models/protocols/pure/DSLPersistence_PureProtocolProcessorPlugin.d.ts +1 -0
- package/lib/models/protocols/pure/DSLPersistence_PureProtocolProcessorPlugin.d.ts.map +1 -1
- package/lib/models/protocols/pure/DSLPersistence_PureProtocolProcessorPlugin.js +33 -0
- package/lib/models/protocols/pure/DSLPersistence_PureProtocolProcessorPlugin.js.map +1 -1
- package/lib/models/protocols/pure/DSLPersistence_PureProtocolProcessorPlugin_Extension.d.ts +30 -0
- package/lib/models/protocols/pure/DSLPersistence_PureProtocolProcessorPlugin_Extension.d.ts.map +1 -0
- package/lib/models/protocols/pure/DSLPersistence_PureProtocolProcessorPlugin_Extension.js +17 -0
- package/lib/models/protocols/pure/DSLPersistence_PureProtocolProcessorPlugin_Extension.js.map +1 -0
- package/lib/models/protocols/pure/v1/model/packageableElements/persistence/V1_DSLPersistence_PersistenceContext.d.ts +28 -0
- package/lib/models/protocols/pure/v1/model/packageableElements/persistence/V1_DSLPersistence_PersistenceContext.d.ts.map +1 -0
- package/lib/models/protocols/pure/v1/model/packageableElements/persistence/V1_DSLPersistence_PersistenceContext.js +37 -0
- package/lib/models/protocols/pure/v1/model/packageableElements/persistence/V1_DSLPersistence_PersistenceContext.js.map +1 -0
- package/lib/models/protocols/pure/v1/model/packageableElements/persistence/V1_DSLPersistence_PersistencePlatform.d.ts +23 -0
- package/lib/models/protocols/pure/v1/model/packageableElements/persistence/V1_DSLPersistence_PersistencePlatform.d.ts.map +1 -0
- package/lib/models/protocols/pure/v1/model/packageableElements/persistence/V1_DSLPersistence_PersistencePlatform.js +25 -0
- package/lib/models/protocols/pure/v1/model/packageableElements/persistence/V1_DSLPersistence_PersistencePlatform.js.map +1 -0
- package/lib/models/protocols/pure/v1/model/packageableElements/persistence/V1_DSLPersistence_ServiceParameter.d.ts +34 -0
- package/lib/models/protocols/pure/v1/model/packageableElements/persistence/V1_DSLPersistence_ServiceParameter.d.ts.map +1 -0
- package/lib/models/protocols/pure/v1/model/packageableElements/persistence/V1_DSLPersistence_ServiceParameter.js +49 -0
- package/lib/models/protocols/pure/v1/model/packageableElements/persistence/V1_DSLPersistence_ServiceParameter.js.map +1 -0
- package/lib/models/protocols/pure/v1/model/packageableElements/persistence/V1_DSLPersistence_Sink.d.ts +2 -1
- package/lib/models/protocols/pure/v1/model/packageableElements/persistence/V1_DSLPersistence_Sink.d.ts.map +1 -1
- package/lib/models/protocols/pure/v1/model/packageableElements/persistence/V1_DSLPersistence_Sink.js +6 -1
- package/lib/models/protocols/pure/v1/model/packageableElements/persistence/V1_DSLPersistence_Sink.js.map +1 -1
- package/lib/models/protocols/pure/v1/transformation/pureGraph/V1_DSLPersistence_GraphBuilderHelper.d.ts +2 -0
- package/lib/models/protocols/pure/v1/transformation/pureGraph/V1_DSLPersistence_GraphBuilderHelper.d.ts.map +1 -1
- package/lib/models/protocols/pure/v1/transformation/pureGraph/V1_DSLPersistence_GraphBuilderHelper.js +2 -1
- package/lib/models/protocols/pure/v1/transformation/pureGraph/V1_DSLPersistence_GraphBuilderHelper.js.map +1 -1
- package/lib/models/protocols/pure/v1/transformation/pureGraph/from/V1_PersistenceContextTransformer.d.ts +36 -0
- package/lib/models/protocols/pure/v1/transformation/pureGraph/from/V1_PersistenceContextTransformer.d.ts.map +1 -0
- package/lib/models/protocols/pure/v1/transformation/pureGraph/from/V1_PersistenceContextTransformer.js +75 -0
- package/lib/models/protocols/pure/v1/transformation/pureGraph/from/V1_PersistenceContextTransformer.js.map +1 -0
- package/lib/models/protocols/pure/v1/transformation/pureGraph/from/V1_PersistenceTransformer.d.ts.map +1 -1
- package/lib/models/protocols/pure/v1/transformation/pureGraph/from/V1_PersistenceTransformer.js +6 -1
- package/lib/models/protocols/pure/v1/transformation/pureGraph/from/V1_PersistenceTransformer.js.map +1 -1
- package/lib/models/protocols/pure/v1/transformation/pureGraph/to/V1_PersistenceBuilder.d.ts.map +1 -1
- package/lib/models/protocols/pure/v1/transformation/pureGraph/to/V1_PersistenceBuilder.js +6 -1
- package/lib/models/protocols/pure/v1/transformation/pureGraph/to/V1_PersistenceBuilder.js.map +1 -1
- package/lib/models/protocols/pure/v1/transformation/pureGraph/to/V1_PersistenceContextBuilder.d.ts +35 -0
- package/lib/models/protocols/pure/v1/transformation/pureGraph/to/V1_PersistenceContextBuilder.d.ts.map +1 -0
- package/lib/models/protocols/pure/v1/transformation/pureGraph/to/V1_PersistenceContextBuilder.js +76 -0
- package/lib/models/protocols/pure/v1/transformation/pureGraph/to/V1_PersistenceContextBuilder.js.map +1 -0
- package/lib/models/protocols/pure/v1/transformation/pureProtocol/V1_DSLPersistenceContext_ProtocolHelper.d.ts +31 -0
- package/lib/models/protocols/pure/v1/transformation/pureProtocol/V1_DSLPersistenceContext_ProtocolHelper.d.ts.map +1 -0
- package/lib/models/protocols/pure/v1/transformation/pureProtocol/V1_DSLPersistenceContext_ProtocolHelper.js +118 -0
- package/lib/models/protocols/pure/v1/transformation/pureProtocol/V1_DSLPersistenceContext_ProtocolHelper.js.map +1 -0
- package/lib/models/protocols/pure/v1/transformation/pureProtocol/V1_DSLPersistence_ProtocolHelper.d.ts +3 -3
- package/lib/models/protocols/pure/v1/transformation/pureProtocol/V1_DSLPersistence_ProtocolHelper.d.ts.map +1 -1
- package/lib/models/protocols/pure/v1/transformation/pureProtocol/V1_DSLPersistence_ProtocolHelper.js +3 -5
- package/lib/models/protocols/pure/v1/transformation/pureProtocol/V1_DSLPersistence_ProtocolHelper.js.map +1 -1
- package/lib/package.json +1 -1
- package/package.json +5 -5
- package/src/components/studio/DSLPersistence_CodeSnippets.ts +6 -1
- package/src/components/studio/DSLPersistence_LegendStudioDocumentation.ts +1 -0
- package/src/components/studio/DSLPersistence_LegendStudioPlugin.tsx +44 -5
- package/src/graph/DSLPersistence_PureGraphPlugin.ts +2 -1
- package/src/graphManager/DSLPersistence_GraphManagerHelper.ts +20 -0
- package/src/graphManager/DSLPersistence_PureGraphManagerPlugin.ts +12 -1
- package/src/graphManager/action/changeDetection/DSLPersistenceContext_ObserverHelper.ts +38 -0
- package/src/index.ts +13 -1
- package/src/models/DSLPersistence_ModelUtils.ts +14 -0
- package/src/models/metamodels/pure/model/packageableElements/persistence/DSLPersistence_PersistenceContext.ts +50 -0
- package/src/models/metamodels/pure/model/packageableElements/persistence/DSLPersistence_PersistencePlatform.ts +30 -0
- package/src/models/metamodels/pure/model/packageableElements/persistence/DSLPersistence_ServiceParameter.ts +61 -0
- package/src/models/metamodels/pure/model/packageableElements/persistence/DSLPersistence_Sink.ts +8 -2
- package/src/models/protocols/pure/DSLPersistence_PureProtocolProcessorPlugin.ts +52 -0
- package/src/models/protocols/pure/DSLPersistence_PureProtocolProcessorPlugin_Extension.ts +57 -0
- package/src/models/protocols/pure/v1/model/packageableElements/persistence/V1_DSLPersistence_PersistenceContext.ts +51 -0
- package/src/models/protocols/pure/v1/model/packageableElements/persistence/V1_DSLPersistence_PersistencePlatform.ts +31 -0
- package/src/models/protocols/pure/v1/model/packageableElements/persistence/V1_DSLPersistence_ServiceParameter.ts +64 -0
- package/src/models/protocols/pure/v1/model/packageableElements/persistence/V1_DSLPersistence_Sink.ts +7 -2
- package/src/models/protocols/pure/v1/transformation/pureGraph/V1_DSLPersistence_GraphBuilderHelper.ts +13 -1
- package/src/models/protocols/pure/v1/transformation/pureGraph/from/V1_PersistenceContextTransformer.ts +141 -0
- package/src/models/protocols/pure/v1/transformation/pureGraph/from/V1_PersistenceTransformer.ts +10 -5
- package/src/models/protocols/pure/v1/transformation/pureGraph/to/V1_PersistenceBuilder.ts +12 -3
- package/src/models/protocols/pure/v1/transformation/pureGraph/to/V1_PersistenceContextBuilder.ts +151 -0
- package/src/models/protocols/pure/v1/transformation/pureProtocol/V1_DSLPersistenceContext_ProtocolHelper.ts +242 -0
- package/src/models/protocols/pure/v1/transformation/pureProtocol/V1_DSLPersistence_ProtocolHelper.ts +20 -31
- package/tsconfig.json +11 -0
|
@@ -0,0 +1,141 @@
|
|
|
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 { PersistenceContext } from '../../../../../../metamodels/pure/model/packageableElements/persistence/DSLPersistence_PersistenceContext.js';
|
|
18
|
+
import {
|
|
19
|
+
type PersistencePlatform,
|
|
20
|
+
DefaultPersistencePlatform,
|
|
21
|
+
} from '../../../../../../metamodels/pure/model/packageableElements/persistence/DSLPersistence_PersistencePlatform.js';
|
|
22
|
+
import {
|
|
23
|
+
ConnectionValue,
|
|
24
|
+
PrimitiveTypeValue,
|
|
25
|
+
type ServiceParameter,
|
|
26
|
+
type ServiceParameterValue,
|
|
27
|
+
} from '../../../../../../metamodels/pure/model/packageableElements/persistence/DSLPersistence_ServiceParameter.js';
|
|
28
|
+
import { V1_PersistenceContext } from '../../../model/packageableElements/persistence/V1_DSLPersistence_PersistenceContext.js';
|
|
29
|
+
import {
|
|
30
|
+
V1_DefaultPersistencePlatform,
|
|
31
|
+
type V1_PersistencePlatform,
|
|
32
|
+
} from '../../../model/packageableElements/persistence/V1_DSLPersistence_PersistencePlatform.js';
|
|
33
|
+
import {
|
|
34
|
+
V1_ConnectionValue,
|
|
35
|
+
V1_PrimitiveTypeValue,
|
|
36
|
+
V1_ServiceParameter,
|
|
37
|
+
type V1_ServiceParameterValue,
|
|
38
|
+
} from '../../../model/packageableElements/persistence/V1_DSLPersistence_ServiceParameter.js';
|
|
39
|
+
import type { DSLPersistence_PureProtocolProcessorPlugin_Extension } from '../../../../DSLPersistence_PureProtocolProcessorPlugin_Extension.js';
|
|
40
|
+
import {
|
|
41
|
+
type V1_GraphTransformerContext,
|
|
42
|
+
V1_initPackageableElement,
|
|
43
|
+
V1_transformConnection,
|
|
44
|
+
V1_transformRootValueSpecification,
|
|
45
|
+
} from '@finos/legend-graph';
|
|
46
|
+
import { UnsupportedOperationError } from '@finos/legend-shared';
|
|
47
|
+
|
|
48
|
+
/**********
|
|
49
|
+
* persistence platform
|
|
50
|
+
**********/
|
|
51
|
+
|
|
52
|
+
export const V1_transformPersistencePlatform = (
|
|
53
|
+
element: PersistencePlatform,
|
|
54
|
+
context: V1_GraphTransformerContext,
|
|
55
|
+
): V1_PersistencePlatform => {
|
|
56
|
+
if (element instanceof DefaultPersistencePlatform) {
|
|
57
|
+
return new V1_DefaultPersistencePlatform();
|
|
58
|
+
}
|
|
59
|
+
const extraPersistencePlatformTransformers = context.plugins.flatMap(
|
|
60
|
+
(plugin) =>
|
|
61
|
+
(
|
|
62
|
+
plugin as DSLPersistence_PureProtocolProcessorPlugin_Extension
|
|
63
|
+
).V1_getExtraPersistencePlatformTransformers?.() ?? [],
|
|
64
|
+
);
|
|
65
|
+
for (const transformer of extraPersistencePlatformTransformers) {
|
|
66
|
+
const protocol = transformer(element, context);
|
|
67
|
+
if (protocol) {
|
|
68
|
+
return protocol;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
throw new UnsupportedOperationError(
|
|
72
|
+
`Can't transform persistence platform: no compatible transformer available from plugins`,
|
|
73
|
+
element,
|
|
74
|
+
);
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
/**********
|
|
78
|
+
* service parameter
|
|
79
|
+
**********/
|
|
80
|
+
|
|
81
|
+
export const V1_transformServiceParameterValue = (
|
|
82
|
+
element: ServiceParameterValue,
|
|
83
|
+
context: V1_GraphTransformerContext,
|
|
84
|
+
): V1_ServiceParameterValue => {
|
|
85
|
+
if (element instanceof PrimitiveTypeValue) {
|
|
86
|
+
const protocol = new V1_PrimitiveTypeValue();
|
|
87
|
+
protocol.primitiveType = V1_transformRootValueSpecification(
|
|
88
|
+
element.primitiveType,
|
|
89
|
+
);
|
|
90
|
+
return protocol;
|
|
91
|
+
} else if (element instanceof ConnectionValue) {
|
|
92
|
+
const protocol = new V1_ConnectionValue();
|
|
93
|
+
protocol.connection = V1_transformConnection(
|
|
94
|
+
element.connection,
|
|
95
|
+
true,
|
|
96
|
+
context,
|
|
97
|
+
);
|
|
98
|
+
return protocol;
|
|
99
|
+
}
|
|
100
|
+
throw new UnsupportedOperationError(
|
|
101
|
+
`Can't transform service parameter value '${element}'`,
|
|
102
|
+
);
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
export const V1_transformServiceParameter = (
|
|
106
|
+
element: ServiceParameter,
|
|
107
|
+
context: V1_GraphTransformerContext,
|
|
108
|
+
): V1_ServiceParameter => {
|
|
109
|
+
const protocol = new V1_ServiceParameter();
|
|
110
|
+
protocol.name = element.name;
|
|
111
|
+
protocol.value = V1_transformServiceParameterValue(element.value, context);
|
|
112
|
+
return protocol;
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
/**********
|
|
116
|
+
* persistence context
|
|
117
|
+
**********/
|
|
118
|
+
|
|
119
|
+
export const V1_transformPersistenceContext = (
|
|
120
|
+
element: PersistenceContext,
|
|
121
|
+
context: V1_GraphTransformerContext,
|
|
122
|
+
): V1_PersistenceContext => {
|
|
123
|
+
const protocol = new V1_PersistenceContext();
|
|
124
|
+
V1_initPackageableElement(protocol, element);
|
|
125
|
+
protocol.persistence = element.persistence.valueForSerialization ?? '';
|
|
126
|
+
protocol.platform = V1_transformPersistencePlatform(
|
|
127
|
+
element.platform,
|
|
128
|
+
context,
|
|
129
|
+
);
|
|
130
|
+
protocol.serviceParameters = element.serviceParameters.map((sp) =>
|
|
131
|
+
V1_transformServiceParameter(sp, context),
|
|
132
|
+
);
|
|
133
|
+
if (element.sinkConnection) {
|
|
134
|
+
protocol.sinkConnection = V1_transformConnection(
|
|
135
|
+
element.sinkConnection,
|
|
136
|
+
true,
|
|
137
|
+
context,
|
|
138
|
+
);
|
|
139
|
+
}
|
|
140
|
+
return protocol;
|
|
141
|
+
};
|
package/src/models/protocols/pure/v1/transformation/pureGraph/from/V1_PersistenceTransformer.ts
CHANGED
|
@@ -192,6 +192,9 @@ export const V1_transformRelationalSink = (
|
|
|
192
192
|
context: V1_GraphTransformerContext,
|
|
193
193
|
): V1_RelationalSink => {
|
|
194
194
|
const protocol = new V1_RelationalSink();
|
|
195
|
+
if (element.database) {
|
|
196
|
+
protocol.database = element.database.value.path;
|
|
197
|
+
}
|
|
195
198
|
if (element.connection) {
|
|
196
199
|
protocol.connection = V1_transformConnection(
|
|
197
200
|
element.connection,
|
|
@@ -207,12 +210,14 @@ export const V1_transformObjectStorageSink = (
|
|
|
207
210
|
context: V1_GraphTransformerContext,
|
|
208
211
|
): V1_ObjectStorageSink => {
|
|
209
212
|
const protocol = new V1_ObjectStorageSink();
|
|
210
|
-
protocol.connection = V1_transformConnection(
|
|
211
|
-
element.connection,
|
|
212
|
-
true,
|
|
213
|
-
context,
|
|
214
|
-
);
|
|
215
213
|
protocol.binding = element.binding.value.path;
|
|
214
|
+
if (element.connection) {
|
|
215
|
+
protocol.connection = V1_transformConnection(
|
|
216
|
+
element.connection,
|
|
217
|
+
true,
|
|
218
|
+
context,
|
|
219
|
+
);
|
|
220
|
+
}
|
|
216
221
|
return protocol;
|
|
217
222
|
};
|
|
218
223
|
|
|
@@ -156,6 +156,7 @@ import {
|
|
|
156
156
|
import { getOwnPersistence } from '../../../../../../../graphManager/DSLPersistence_GraphManagerHelper.js';
|
|
157
157
|
import {
|
|
158
158
|
type Binding,
|
|
159
|
+
type Database,
|
|
159
160
|
type PackageableElementImplicitReference,
|
|
160
161
|
type V1_GraphBuilderContext,
|
|
161
162
|
V1_ProtocolToMetaModelConnectionBuilder,
|
|
@@ -198,6 +199,12 @@ export const V1_buildRelationalSink = (
|
|
|
198
199
|
context: V1_GraphBuilderContext,
|
|
199
200
|
): RelationalSink => {
|
|
200
201
|
const sink = new RelationalSink();
|
|
202
|
+
if (protocol.database) {
|
|
203
|
+
sink.database = context.resolveElement(
|
|
204
|
+
protocol.database,
|
|
205
|
+
false,
|
|
206
|
+
) as PackageableElementImplicitReference<Database>;
|
|
207
|
+
}
|
|
201
208
|
if (protocol.connection) {
|
|
202
209
|
sink.connection = protocol.connection.accept_ConnectionVisitor(
|
|
203
210
|
new V1_ProtocolToMetaModelConnectionBuilder(context),
|
|
@@ -211,13 +218,15 @@ export const V1_buildObjectStorageSink = (
|
|
|
211
218
|
context: V1_GraphBuilderContext,
|
|
212
219
|
): ObjectStorageSink => {
|
|
213
220
|
const sink = new ObjectStorageSink();
|
|
214
|
-
sink.connection = protocol.connection.accept_ConnectionVisitor(
|
|
215
|
-
new V1_ProtocolToMetaModelConnectionBuilder(context),
|
|
216
|
-
);
|
|
217
221
|
sink.binding = context.resolveElement(
|
|
218
222
|
protocol.binding,
|
|
219
223
|
false,
|
|
220
224
|
) as PackageableElementImplicitReference<Binding>;
|
|
225
|
+
if (protocol.connection) {
|
|
226
|
+
sink.connection = protocol.connection.accept_ConnectionVisitor(
|
|
227
|
+
new V1_ProtocolToMetaModelConnectionBuilder(context),
|
|
228
|
+
);
|
|
229
|
+
}
|
|
221
230
|
return sink;
|
|
222
231
|
};
|
|
223
232
|
|
package/src/models/protocols/pure/v1/transformation/pureGraph/to/V1_PersistenceContextBuilder.ts
ADDED
|
@@ -0,0 +1,151 @@
|
|
|
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_PersistenceContext } from '../../../model/packageableElements/persistence/V1_DSLPersistence_PersistenceContext.js';
|
|
18
|
+
import {
|
|
19
|
+
type V1_PersistencePlatform,
|
|
20
|
+
V1_DefaultPersistencePlatform,
|
|
21
|
+
} from '../../../model/packageableElements/persistence/V1_DSLPersistence_PersistencePlatform.js';
|
|
22
|
+
import {
|
|
23
|
+
V1_ConnectionValue,
|
|
24
|
+
V1_PrimitiveTypeValue,
|
|
25
|
+
type V1_ServiceParameter,
|
|
26
|
+
type V1_ServiceParameterValue,
|
|
27
|
+
} from '../../../model/packageableElements/persistence/V1_DSLPersistence_ServiceParameter.js';
|
|
28
|
+
import type { Persistence } from '../../../../../../metamodels/pure/model/packageableElements/persistence/DSLPersistence_Persistence.js';
|
|
29
|
+
import {
|
|
30
|
+
DefaultPersistencePlatform,
|
|
31
|
+
type PersistencePlatform,
|
|
32
|
+
} from '../../../../../../metamodels/pure/model/packageableElements/persistence/DSLPersistence_PersistencePlatform.js';
|
|
33
|
+
import {
|
|
34
|
+
ConnectionValue,
|
|
35
|
+
PrimitiveTypeValue,
|
|
36
|
+
ServiceParameter,
|
|
37
|
+
type ServiceParameterValue,
|
|
38
|
+
} from '../../../../../../metamodels/pure/model/packageableElements/persistence/DSLPersistence_ServiceParameter.js';
|
|
39
|
+
import { getOwnPersistenceContext } from '../../../../../../../graphManager/DSLPersistence_GraphManagerHelper.js';
|
|
40
|
+
import type { DSLPersistence_PureProtocolProcessorPlugin_Extension } from '../../../../DSLPersistence_PureProtocolProcessorPlugin_Extension.js';
|
|
41
|
+
import {
|
|
42
|
+
type PackageableElementImplicitReference,
|
|
43
|
+
V1_buildFullPath,
|
|
44
|
+
V1_buildValueSpecification,
|
|
45
|
+
type V1_GraphBuilderContext,
|
|
46
|
+
V1_ProtocolToMetaModelConnectionBuilder,
|
|
47
|
+
} from '@finos/legend-graph';
|
|
48
|
+
import { UnsupportedOperationError } from '@finos/legend-shared';
|
|
49
|
+
|
|
50
|
+
/**********
|
|
51
|
+
* persistence platform
|
|
52
|
+
**********/
|
|
53
|
+
|
|
54
|
+
export const V1_buildPersistencePlatform = (
|
|
55
|
+
protocol: V1_PersistencePlatform,
|
|
56
|
+
context: V1_GraphBuilderContext,
|
|
57
|
+
): PersistencePlatform => {
|
|
58
|
+
if (protocol instanceof V1_DefaultPersistencePlatform) {
|
|
59
|
+
return new DefaultPersistencePlatform();
|
|
60
|
+
}
|
|
61
|
+
const extraPersistencePlatformBuilders = context.extensions.plugins.flatMap(
|
|
62
|
+
(plugin) =>
|
|
63
|
+
(
|
|
64
|
+
plugin as DSLPersistence_PureProtocolProcessorPlugin_Extension
|
|
65
|
+
).V1_getExtraPersistencePlatformBuilders?.() ?? [],
|
|
66
|
+
);
|
|
67
|
+
for (const builder of extraPersistencePlatformBuilders) {
|
|
68
|
+
const metamodel = builder(protocol, context);
|
|
69
|
+
if (metamodel) {
|
|
70
|
+
return metamodel;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
throw new UnsupportedOperationError(
|
|
74
|
+
`Can't build persistence platform: no compatible builder available from plugins`,
|
|
75
|
+
protocol,
|
|
76
|
+
);
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
/**********
|
|
80
|
+
* service parameter
|
|
81
|
+
**********/
|
|
82
|
+
|
|
83
|
+
export const V1_buildServiceParameterValue = (
|
|
84
|
+
protocol: V1_ServiceParameterValue,
|
|
85
|
+
context: V1_GraphBuilderContext,
|
|
86
|
+
): ServiceParameterValue => {
|
|
87
|
+
if (protocol instanceof V1_PrimitiveTypeValue) {
|
|
88
|
+
const serviceParameterValue = new PrimitiveTypeValue();
|
|
89
|
+
serviceParameterValue.primitiveType = V1_buildValueSpecification(
|
|
90
|
+
protocol.primitiveType,
|
|
91
|
+
context,
|
|
92
|
+
);
|
|
93
|
+
return serviceParameterValue;
|
|
94
|
+
} else if (protocol instanceof V1_ConnectionValue) {
|
|
95
|
+
const serviceParameterValue = new ConnectionValue();
|
|
96
|
+
serviceParameterValue.connection =
|
|
97
|
+
protocol.connection.accept_ConnectionVisitor(
|
|
98
|
+
new V1_ProtocolToMetaModelConnectionBuilder(context),
|
|
99
|
+
);
|
|
100
|
+
return serviceParameterValue;
|
|
101
|
+
}
|
|
102
|
+
throw new UnsupportedOperationError(
|
|
103
|
+
`Can't build service parameter value`,
|
|
104
|
+
protocol,
|
|
105
|
+
);
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
export const V1_buildServiceParameter = (
|
|
109
|
+
protocol: V1_ServiceParameter,
|
|
110
|
+
context: V1_GraphBuilderContext,
|
|
111
|
+
): ServiceParameter => {
|
|
112
|
+
const serviceParameter = new ServiceParameter();
|
|
113
|
+
serviceParameter.name = protocol.name;
|
|
114
|
+
serviceParameter.value = V1_buildServiceParameterValue(
|
|
115
|
+
protocol.value,
|
|
116
|
+
context,
|
|
117
|
+
);
|
|
118
|
+
return serviceParameter;
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
/**********
|
|
122
|
+
* persistence context
|
|
123
|
+
**********/
|
|
124
|
+
|
|
125
|
+
export const V1_buildPersistenceContext = (
|
|
126
|
+
protocol: V1_PersistenceContext,
|
|
127
|
+
context: V1_GraphBuilderContext,
|
|
128
|
+
): void => {
|
|
129
|
+
const path = V1_buildFullPath(protocol.package, protocol.name);
|
|
130
|
+
const persistenceContext = getOwnPersistenceContext(
|
|
131
|
+
path,
|
|
132
|
+
context.currentSubGraph,
|
|
133
|
+
);
|
|
134
|
+
persistenceContext.persistence = context.resolveElement(
|
|
135
|
+
protocol.persistence,
|
|
136
|
+
false,
|
|
137
|
+
) as PackageableElementImplicitReference<Persistence>;
|
|
138
|
+
persistenceContext.platform = V1_buildPersistencePlatform(
|
|
139
|
+
protocol.platform,
|
|
140
|
+
context,
|
|
141
|
+
);
|
|
142
|
+
persistenceContext.serviceParameters = protocol.serviceParameters.map((sp) =>
|
|
143
|
+
V1_buildServiceParameter(sp, context),
|
|
144
|
+
);
|
|
145
|
+
if (protocol.sinkConnection) {
|
|
146
|
+
persistenceContext.sinkConnection =
|
|
147
|
+
protocol.sinkConnection.accept_ConnectionVisitor(
|
|
148
|
+
new V1_ProtocolToMetaModelConnectionBuilder(context),
|
|
149
|
+
);
|
|
150
|
+
}
|
|
151
|
+
};
|
|
@@ -0,0 +1,242 @@
|
|
|
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 { V1_PersistenceContext } from '../../model/packageableElements/persistence/V1_DSLPersistence_PersistenceContext.js';
|
|
18
|
+
import {
|
|
19
|
+
V1_DefaultPersistencePlatform,
|
|
20
|
+
type V1_PersistencePlatform,
|
|
21
|
+
} from '../../model/packageableElements/persistence/V1_DSLPersistence_PersistencePlatform.js';
|
|
22
|
+
import {
|
|
23
|
+
V1_ConnectionValue,
|
|
24
|
+
V1_PrimitiveTypeValue,
|
|
25
|
+
V1_ServiceParameter,
|
|
26
|
+
type V1_ServiceParameterValue,
|
|
27
|
+
} from '../../model/packageableElements/persistence/V1_DSLPersistence_ServiceParameter.js';
|
|
28
|
+
import type { DSLPersistence_PureProtocolProcessorPlugin_Extension } from '../../../DSLPersistence_PureProtocolProcessorPlugin_Extension.js';
|
|
29
|
+
import {
|
|
30
|
+
type PureProtocolProcessorPlugin,
|
|
31
|
+
V1_deserializeConnectionValue,
|
|
32
|
+
V1_deserializeValueSpecification,
|
|
33
|
+
V1_serializeConnectionValue,
|
|
34
|
+
V1_serializeValueSpecification,
|
|
35
|
+
} from '@finos/legend-graph';
|
|
36
|
+
import {
|
|
37
|
+
deserializeArray,
|
|
38
|
+
type PlainObject,
|
|
39
|
+
serializeArray,
|
|
40
|
+
UnsupportedOperationError,
|
|
41
|
+
usingConstantValueSchema,
|
|
42
|
+
} from '@finos/legend-shared';
|
|
43
|
+
import {
|
|
44
|
+
createModelSchema,
|
|
45
|
+
custom,
|
|
46
|
+
deserialize,
|
|
47
|
+
type ModelSchema,
|
|
48
|
+
primitive,
|
|
49
|
+
serialize,
|
|
50
|
+
SKIP,
|
|
51
|
+
} from 'serializr';
|
|
52
|
+
|
|
53
|
+
/**********
|
|
54
|
+
* persistence platfrom
|
|
55
|
+
**********/
|
|
56
|
+
|
|
57
|
+
enum V1_PersistencePlatformType {
|
|
58
|
+
DEFAULT = 'default',
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const V1_defaultPersistencePlatformModelSchema = createModelSchema(
|
|
62
|
+
V1_DefaultPersistencePlatform,
|
|
63
|
+
{
|
|
64
|
+
_type: usingConstantValueSchema(V1_PersistencePlatformType.DEFAULT),
|
|
65
|
+
},
|
|
66
|
+
);
|
|
67
|
+
|
|
68
|
+
export const V1_serializePersistencePlatform = (
|
|
69
|
+
protocol: V1_PersistencePlatform,
|
|
70
|
+
plugins: PureProtocolProcessorPlugin[],
|
|
71
|
+
): PlainObject<V1_PersistencePlatform> => {
|
|
72
|
+
if (protocol instanceof V1_DefaultPersistencePlatform) {
|
|
73
|
+
return serialize(V1_defaultPersistencePlatformModelSchema, protocol);
|
|
74
|
+
}
|
|
75
|
+
const extraPersistencePlatformProtocolSerializers = plugins.flatMap(
|
|
76
|
+
(plugin) =>
|
|
77
|
+
(
|
|
78
|
+
plugin as DSLPersistence_PureProtocolProcessorPlugin_Extension
|
|
79
|
+
).V1_getExtraPersistencePlatformProtocolSerializers?.() ?? [],
|
|
80
|
+
);
|
|
81
|
+
for (const serializer of extraPersistencePlatformProtocolSerializers) {
|
|
82
|
+
const persistencePlatformProtocolJson = serializer(protocol);
|
|
83
|
+
if (persistencePlatformProtocolJson) {
|
|
84
|
+
return persistencePlatformProtocolJson;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
throw new UnsupportedOperationError(
|
|
88
|
+
`Can't serialize persistence platform: no compatible serializer available from plugins`,
|
|
89
|
+
protocol,
|
|
90
|
+
);
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
export const V1_deserializePersistencePlatform = (
|
|
94
|
+
json: PlainObject<V1_PersistencePlatform>,
|
|
95
|
+
plugins: PureProtocolProcessorPlugin[],
|
|
96
|
+
): V1_PersistencePlatform => {
|
|
97
|
+
switch (json._type) {
|
|
98
|
+
case V1_PersistencePlatformType.DEFAULT:
|
|
99
|
+
return deserialize(V1_defaultPersistencePlatformModelSchema, json);
|
|
100
|
+
default: {
|
|
101
|
+
const extraPersistencePlatformProtocolDeserializers = plugins.flatMap(
|
|
102
|
+
(plugin) =>
|
|
103
|
+
(
|
|
104
|
+
plugin as DSLPersistence_PureProtocolProcessorPlugin_Extension
|
|
105
|
+
).V1_getExtraPersistencePlatformProtocolDeserializers?.() ?? [],
|
|
106
|
+
);
|
|
107
|
+
for (const deserializer of extraPersistencePlatformProtocolDeserializers) {
|
|
108
|
+
const persistencePlatformProtocol = deserializer(json);
|
|
109
|
+
if (persistencePlatformProtocol) {
|
|
110
|
+
return persistencePlatformProtocol;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
throw new UnsupportedOperationError(
|
|
114
|
+
`Can't deserialize persistence platform of type '${json._type}': no compatible deserializer available from plugins`,
|
|
115
|
+
);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
/**********
|
|
121
|
+
* service parameters
|
|
122
|
+
**********/
|
|
123
|
+
|
|
124
|
+
enum V1_ServiceParameterValueType {
|
|
125
|
+
PRIMITIVE_TYPE_VALUE = 'primitiveTypeValue',
|
|
126
|
+
CONNECTION_VALUE = 'connectionValue',
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
const V1_primitiveTypeValueModelSchema = createModelSchema(
|
|
130
|
+
V1_PrimitiveTypeValue,
|
|
131
|
+
{
|
|
132
|
+
_type: usingConstantValueSchema(
|
|
133
|
+
V1_ServiceParameterValueType.PRIMITIVE_TYPE_VALUE,
|
|
134
|
+
),
|
|
135
|
+
primitiveType: custom(
|
|
136
|
+
(val) => V1_serializeValueSpecification(val),
|
|
137
|
+
(val) => V1_deserializeValueSpecification(val),
|
|
138
|
+
),
|
|
139
|
+
},
|
|
140
|
+
);
|
|
141
|
+
|
|
142
|
+
const V1_connectionValueModelSchema = (
|
|
143
|
+
plugins: PureProtocolProcessorPlugin[],
|
|
144
|
+
): ModelSchema<V1_ConnectionValue> =>
|
|
145
|
+
createModelSchema(V1_ConnectionValue, {
|
|
146
|
+
_type: usingConstantValueSchema(
|
|
147
|
+
V1_ServiceParameterValueType.CONNECTION_VALUE,
|
|
148
|
+
),
|
|
149
|
+
connection: custom(
|
|
150
|
+
(val) => (val ? V1_serializeConnectionValue(val, true, plugins) : SKIP),
|
|
151
|
+
(val) => V1_deserializeConnectionValue(val, true, plugins),
|
|
152
|
+
),
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
export const V1_serializeServiceParameterValue = (
|
|
156
|
+
protocol: V1_ServiceParameterValue,
|
|
157
|
+
plugins: PureProtocolProcessorPlugin[],
|
|
158
|
+
): PlainObject<V1_ServiceParameterValue> => {
|
|
159
|
+
if (protocol instanceof V1_PrimitiveTypeValue) {
|
|
160
|
+
return serialize(V1_primitiveTypeValueModelSchema, protocol);
|
|
161
|
+
} else if (protocol instanceof V1_ConnectionValue) {
|
|
162
|
+
return serialize(V1_connectionValueModelSchema(plugins), protocol);
|
|
163
|
+
}
|
|
164
|
+
throw new UnsupportedOperationError(
|
|
165
|
+
`Can't serialize service parameter value`,
|
|
166
|
+
protocol,
|
|
167
|
+
);
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
export const V1_deserializeServiceParameterValue = (
|
|
171
|
+
json: PlainObject<V1_ServiceParameterValue>,
|
|
172
|
+
plugins: PureProtocolProcessorPlugin[],
|
|
173
|
+
): V1_ServiceParameterValue => {
|
|
174
|
+
switch (json._type) {
|
|
175
|
+
case V1_ServiceParameterValueType.PRIMITIVE_TYPE_VALUE:
|
|
176
|
+
return deserialize(V1_primitiveTypeValueModelSchema, json);
|
|
177
|
+
case V1_ServiceParameterValueType.CONNECTION_VALUE:
|
|
178
|
+
return deserialize(V1_connectionValueModelSchema(plugins), json);
|
|
179
|
+
default:
|
|
180
|
+
throw new UnsupportedOperationError(
|
|
181
|
+
`Can't deserialize service parameter value '${json._type}'`,
|
|
182
|
+
);
|
|
183
|
+
}
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
const V1_serviceParameterModelSchema = (
|
|
187
|
+
plugins: PureProtocolProcessorPlugin[],
|
|
188
|
+
): ModelSchema<V1_ServiceParameter> =>
|
|
189
|
+
createModelSchema(V1_ServiceParameter, {
|
|
190
|
+
name: primitive(),
|
|
191
|
+
value: custom(
|
|
192
|
+
(val) => V1_serializeServiceParameterValue(val, plugins),
|
|
193
|
+
(val) => V1_deserializeServiceParameterValue(val, plugins),
|
|
194
|
+
),
|
|
195
|
+
});
|
|
196
|
+
|
|
197
|
+
/**********
|
|
198
|
+
* persistence context
|
|
199
|
+
**********/
|
|
200
|
+
|
|
201
|
+
export const V1_PERSISTENCE_CONTEXT_ELEMENT_PROTOCOL_TYPE =
|
|
202
|
+
'persistenceContext';
|
|
203
|
+
|
|
204
|
+
export const V1_persistenceContextModelSchema = (
|
|
205
|
+
plugins: PureProtocolProcessorPlugin[],
|
|
206
|
+
): ModelSchema<V1_PersistenceContext> =>
|
|
207
|
+
createModelSchema(V1_PersistenceContext, {
|
|
208
|
+
_type: usingConstantValueSchema(
|
|
209
|
+
V1_PERSISTENCE_CONTEXT_ELEMENT_PROTOCOL_TYPE,
|
|
210
|
+
),
|
|
211
|
+
name: primitive(),
|
|
212
|
+
package: primitive(),
|
|
213
|
+
persistence: primitive(),
|
|
214
|
+
platform: custom(
|
|
215
|
+
(val) => V1_serializePersistencePlatform(val, plugins),
|
|
216
|
+
(val) => V1_deserializePersistencePlatform(val, plugins),
|
|
217
|
+
),
|
|
218
|
+
serviceParameters: custom(
|
|
219
|
+
(val) =>
|
|
220
|
+
serializeArray(
|
|
221
|
+
val,
|
|
222
|
+
(v: V1_ServiceParameter) =>
|
|
223
|
+
serialize(V1_serviceParameterModelSchema(plugins), v),
|
|
224
|
+
{
|
|
225
|
+
skipIfEmpty: true,
|
|
226
|
+
INTERNAL__forceReturnEmptyInTest: true,
|
|
227
|
+
},
|
|
228
|
+
),
|
|
229
|
+
(val) =>
|
|
230
|
+
deserializeArray(
|
|
231
|
+
val,
|
|
232
|
+
(v) => deserialize(V1_serviceParameterModelSchema(plugins), v),
|
|
233
|
+
{
|
|
234
|
+
skipIfEmpty: false,
|
|
235
|
+
},
|
|
236
|
+
),
|
|
237
|
+
),
|
|
238
|
+
sinkConnection: custom(
|
|
239
|
+
(val) => (val ? V1_serializeConnectionValue(val, true, plugins) : SKIP),
|
|
240
|
+
(val) => V1_deserializeConnectionValue(val, true, plugins),
|
|
241
|
+
),
|
|
242
|
+
});
|
package/src/models/protocols/pure/v1/transformation/pureProtocol/V1_DSLPersistence_ProtocolHelper.ts
CHANGED
|
@@ -15,29 +15,6 @@
|
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
import { V1_Persistence } from '../../model/packageableElements/persistence/V1_DSLPersistence_Persistence.js';
|
|
18
|
-
import {
|
|
19
|
-
type PureProtocolProcessorPlugin,
|
|
20
|
-
V1_deserializeConnectionValue,
|
|
21
|
-
V1_serializeConnectionValue,
|
|
22
|
-
} from '@finos/legend-graph';
|
|
23
|
-
import {
|
|
24
|
-
deserializeArray,
|
|
25
|
-
type PlainObject,
|
|
26
|
-
serializeArray,
|
|
27
|
-
UnsupportedOperationError,
|
|
28
|
-
usingConstantValueSchema,
|
|
29
|
-
} from '@finos/legend-shared';
|
|
30
|
-
import {
|
|
31
|
-
createModelSchema,
|
|
32
|
-
custom,
|
|
33
|
-
deserialize,
|
|
34
|
-
list,
|
|
35
|
-
type ModelSchema,
|
|
36
|
-
optional,
|
|
37
|
-
primitive,
|
|
38
|
-
serialize,
|
|
39
|
-
SKIP,
|
|
40
|
-
} from 'serializr';
|
|
41
18
|
import {
|
|
42
19
|
V1_CronTrigger,
|
|
43
20
|
V1_ManualTrigger,
|
|
@@ -106,6 +83,25 @@ import {
|
|
|
106
83
|
type V1_Persister,
|
|
107
84
|
V1_StreamingPersister,
|
|
108
85
|
} from '../../model/packageableElements/persistence/V1_DSLPersistence_Persister.js';
|
|
86
|
+
import type { PureProtocolProcessorPlugin } from '@finos/legend-graph';
|
|
87
|
+
import {
|
|
88
|
+
deserializeArray,
|
|
89
|
+
type PlainObject,
|
|
90
|
+
serializeArray,
|
|
91
|
+
UnsupportedOperationError,
|
|
92
|
+
usingConstantValueSchema,
|
|
93
|
+
} from '@finos/legend-shared';
|
|
94
|
+
import {
|
|
95
|
+
createModelSchema,
|
|
96
|
+
custom,
|
|
97
|
+
deserialize,
|
|
98
|
+
list,
|
|
99
|
+
type ModelSchema,
|
|
100
|
+
optional,
|
|
101
|
+
primitive,
|
|
102
|
+
serialize,
|
|
103
|
+
SKIP,
|
|
104
|
+
} from 'serializr';
|
|
109
105
|
|
|
110
106
|
/**********
|
|
111
107
|
* notifier
|
|
@@ -695,10 +691,7 @@ const V1_relationalSinkModelSchema = (
|
|
|
695
691
|
): ModelSchema<V1_RelationalSink> =>
|
|
696
692
|
createModelSchema(V1_RelationalSink, {
|
|
697
693
|
_type: usingConstantValueSchema(V1_SinkType.RELATIONAL_SINK),
|
|
698
|
-
|
|
699
|
-
(val) => (val ? V1_serializeConnectionValue(val, true, plugins) : SKIP),
|
|
700
|
-
(val) => V1_deserializeConnectionValue(val, true, plugins),
|
|
701
|
-
),
|
|
694
|
+
database: optional(primitive()),
|
|
702
695
|
});
|
|
703
696
|
|
|
704
697
|
const V1_objectStorageSinkModelSchema = (
|
|
@@ -707,10 +700,6 @@ const V1_objectStorageSinkModelSchema = (
|
|
|
707
700
|
createModelSchema(V1_ObjectStorageSink, {
|
|
708
701
|
_type: usingConstantValueSchema(V1_SinkType.OBJECT_STORAGE_SINK),
|
|
709
702
|
binding: optional(primitive()),
|
|
710
|
-
connection: custom(
|
|
711
|
-
(val) => V1_serializeConnectionValue(val, true, plugins),
|
|
712
|
-
(val) => V1_deserializeConnectionValue(val, true, plugins),
|
|
713
|
-
),
|
|
714
703
|
});
|
|
715
704
|
|
|
716
705
|
export const V1_serializeSink = (
|