@finos/legend-extension-dsl-data-quality 1.0.61 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (178) hide show
  1. package/lib/components/{DSL_DataQuality_ClassElementDriver.d.ts → DSL_DataQuality_ElementDriver.d.ts} +17 -7
  2. package/lib/components/DSL_DataQuality_ElementDriver.d.ts.map +1 -0
  3. package/lib/components/{DSL_DataQuality_ClassElementDriver.js → DSL_DataQuality_ElementDriver.js} +70 -23
  4. package/lib/components/DSL_DataQuality_ElementDriver.js.map +1 -0
  5. package/lib/components/DSL_DataQuality_LegendStudioApplicationPlugin.d.ts.map +1 -1
  6. package/lib/components/DSL_DataQuality_LegendStudioApplicationPlugin.js +20 -39
  7. package/lib/components/DSL_DataQuality_LegendStudioApplicationPlugin.js.map +1 -1
  8. package/lib/components/{DSL_NewDataQualityClassValidationElement.d.ts → DSL_NewDataQualityValidationElement.d.ts} +2 -2
  9. package/lib/components/DSL_NewDataQualityValidationElement.d.ts.map +1 -0
  10. package/lib/components/DSL_NewDataQualityValidationElement.js +80 -0
  11. package/lib/components/DSL_NewDataQualityValidationElement.js.map +1 -0
  12. package/lib/components/DataQualityRelationTrialRuns.d.ts +22 -0
  13. package/lib/components/DataQualityRelationTrialRuns.d.ts.map +1 -0
  14. package/lib/components/DataQualityRelationTrialRuns.js +87 -0
  15. package/lib/components/DataQualityRelationTrialRuns.js.map +1 -0
  16. package/lib/components/{DSL_NewDataQualityServiceValidationElement.d.ts → DataQualityRelationValidationConfigurationEditor.d.ts} +2 -2
  17. package/lib/components/DataQualityRelationValidationConfigurationEditor.d.ts.map +1 -0
  18. package/lib/components/DataQualityRelationValidationConfigurationEditor.js +99 -0
  19. package/lib/components/DataQualityRelationValidationConfigurationEditor.js.map +1 -0
  20. package/lib/components/DataQualityRelationValidationEditor.d.ts +30 -0
  21. package/lib/components/DataQualityRelationValidationEditor.d.ts.map +1 -0
  22. package/lib/components/DataQualityRelationValidationEditor.js +89 -0
  23. package/lib/components/DataQualityRelationValidationEditor.js.map +1 -0
  24. package/lib/components/DataQualityResultPanel.d.ts.map +1 -1
  25. package/lib/components/DataQualityResultPanel.js +1 -1
  26. package/lib/components/DataQualityResultPanel.js.map +1 -1
  27. package/lib/components/DataQualityResultValues.d.ts +0 -2
  28. package/lib/components/DataQualityResultValues.d.ts.map +1 -1
  29. package/lib/components/DataQualityResultValues.js.map +1 -1
  30. package/lib/components/DataQualitySideBar.js +2 -2
  31. package/lib/components/DataQualitySideBar.js.map +1 -1
  32. package/lib/components/DataQualityValidationDetailPanel.d.ts +36 -0
  33. package/lib/components/DataQualityValidationDetailPanel.d.ts.map +1 -0
  34. package/lib/components/DataQualityValidationDetailPanel.js +39 -0
  35. package/lib/components/DataQualityValidationDetailPanel.js.map +1 -0
  36. package/lib/components/DataQualityValidationParametersEditor.d.ts +15 -0
  37. package/lib/components/DataQualityValidationParametersEditor.d.ts.map +1 -0
  38. package/lib/components/DataQualityValidationParametersEditor.js +129 -0
  39. package/lib/components/DataQualityValidationParametersEditor.js.map +1 -0
  40. package/lib/components/states/ConstraintState.d.ts +2 -0
  41. package/lib/components/states/ConstraintState.d.ts.map +1 -1
  42. package/lib/components/states/ConstraintState.js +2 -0
  43. package/lib/components/states/ConstraintState.js.map +1 -1
  44. package/lib/components/states/DataQualityClassValidationState.d.ts +2 -2
  45. package/lib/components/states/DataQualityClassValidationState.d.ts.map +1 -1
  46. package/lib/components/states/DataQualityClassValidationState.js +4 -4
  47. package/lib/components/states/DataQualityClassValidationState.js.map +1 -1
  48. package/lib/components/states/DataQualityRelationResultState.d.ts +46 -0
  49. package/lib/components/states/DataQualityRelationResultState.d.ts.map +1 -0
  50. package/lib/components/states/DataQualityRelationResultState.js +194 -0
  51. package/lib/components/states/DataQualityRelationResultState.js.map +1 -0
  52. package/lib/components/states/DataQualityRelationValidationConfigurationState.d.ts +73 -0
  53. package/lib/components/states/DataQualityRelationValidationConfigurationState.d.ts.map +1 -0
  54. package/lib/components/states/DataQualityRelationValidationConfigurationState.js +255 -0
  55. package/lib/components/states/DataQualityRelationValidationConfigurationState.js.map +1 -0
  56. package/lib/components/states/DataQualityRelationValidationLambdaEditorState.d.ts +32 -0
  57. package/lib/components/states/DataQualityRelationValidationLambdaEditorState.d.ts.map +1 -0
  58. package/lib/components/states/DataQualityRelationValidationLambdaEditorState.js +79 -0
  59. package/lib/components/states/DataQualityRelationValidationLambdaEditorState.js.map +1 -0
  60. package/lib/components/states/DataQualityRelationValidationState.d.ts +38 -0
  61. package/lib/components/states/DataQualityRelationValidationState.d.ts.map +1 -0
  62. package/lib/components/states/DataQualityRelationValidationState.js +119 -0
  63. package/lib/components/states/DataQualityRelationValidationState.js.map +1 -0
  64. package/lib/components/states/DataQualityResultState.d.ts.map +1 -1
  65. package/lib/components/states/DataQualityResultState.js +6 -3
  66. package/lib/components/states/DataQualityResultState.js.map +1 -1
  67. package/lib/components/states/DataQualityState.js +1 -1
  68. package/lib/components/states/DataQualityState.js.map +1 -1
  69. package/lib/graph/metamodel/DSL_DataQuality_HashUtils.d.ts +5 -1
  70. package/lib/graph/metamodel/DSL_DataQuality_HashUtils.d.ts.map +1 -1
  71. package/lib/graph/metamodel/DSL_DataQuality_HashUtils.js +4 -0
  72. package/lib/graph/metamodel/DSL_DataQuality_HashUtils.js.map +1 -1
  73. package/lib/graph/metamodel/DSL_DataQuality_PureGraphPlugin.d.ts.map +1 -1
  74. package/lib/graph/metamodel/DSL_DataQuality_PureGraphPlugin.js +2 -1
  75. package/lib/graph/metamodel/DSL_DataQuality_PureGraphPlugin.js.map +1 -1
  76. package/lib/graph/metamodel/pure/packageableElements/data-quality/DataQualityValidationConfiguration.d.ts +36 -3
  77. package/lib/graph/metamodel/pure/packageableElements/data-quality/DataQualityValidationConfiguration.d.ts.map +1 -1
  78. package/lib/graph/metamodel/pure/packageableElements/data-quality/DataQualityValidationConfiguration.js +58 -4
  79. package/lib/graph/metamodel/pure/packageableElements/data-quality/DataQualityValidationConfiguration.js.map +1 -1
  80. package/lib/graph-manager/DSL_DataQuality_GraphManagerHelper.d.ts +2 -1
  81. package/lib/graph-manager/DSL_DataQuality_GraphManagerHelper.d.ts.map +1 -1
  82. package/lib/graph-manager/DSL_DataQuality_GraphManagerHelper.js +2 -1
  83. package/lib/graph-manager/DSL_DataQuality_GraphManagerHelper.js.map +1 -1
  84. package/lib/graph-manager/DSL_DataQuality_GraphModifierHelper.d.ts +13 -2
  85. package/lib/graph-manager/DSL_DataQuality_GraphModifierHelper.d.ts.map +1 -1
  86. package/lib/graph-manager/DSL_DataQuality_GraphModifierHelper.js +36 -2
  87. package/lib/graph-manager/DSL_DataQuality_GraphModifierHelper.js.map +1 -1
  88. package/lib/graph-manager/DSL_DataQuality_PureGraphManagerPlugin.d.ts.map +1 -1
  89. package/lib/graph-manager/DSL_DataQuality_PureGraphManagerPlugin.js +5 -2
  90. package/lib/graph-manager/DSL_DataQuality_PureGraphManagerPlugin.js.map +1 -1
  91. package/lib/graph-manager/action/changeDetection/DSL_DataQuality_ObserverHelper.d.ts +5 -1
  92. package/lib/graph-manager/action/changeDetection/DSL_DataQuality_ObserverHelper.d.ts.map +1 -1
  93. package/lib/graph-manager/action/changeDetection/DSL_DataQuality_ObserverHelper.js +29 -2
  94. package/lib/graph-manager/action/changeDetection/DSL_DataQuality_ObserverHelper.js.map +1 -1
  95. package/lib/graph-manager/protocol/pure/DSL_DataQuality_PureGraphManagerExtension.d.ts +6 -5
  96. package/lib/graph-manager/protocol/pure/DSL_DataQuality_PureGraphManagerExtension.d.ts.map +1 -1
  97. package/lib/graph-manager/protocol/pure/DSL_DataQuality_PureGraphManagerExtension.js.map +1 -1
  98. package/lib/graph-manager/protocol/pure/DSL_DataQuality_PureProtocolProcessorPlugin.d.ts +1 -1
  99. package/lib/graph-manager/protocol/pure/DSL_DataQuality_PureProtocolProcessorPlugin.d.ts.map +1 -1
  100. package/lib/graph-manager/protocol/pure/DSL_DataQuality_PureProtocolProcessorPlugin.js +34 -40
  101. package/lib/graph-manager/protocol/pure/DSL_DataQuality_PureProtocolProcessorPlugin.js.map +1 -1
  102. package/lib/graph-manager/protocol/pure/v1/V1_DSL_Data_Quality_PureGraphManagerExtension.d.ts +8 -6
  103. package/lib/graph-manager/protocol/pure/v1/V1_DSL_Data_Quality_PureGraphManagerExtension.d.ts.map +1 -1
  104. package/lib/graph-manager/protocol/pure/v1/V1_DSL_Data_Quality_PureGraphManagerExtension.js +19 -12
  105. package/lib/graph-manager/protocol/pure/v1/V1_DSL_Data_Quality_PureGraphManagerExtension.js.map +1 -1
  106. package/lib/graph-manager/protocol/pure/v1/{V1_DataQualityConstraintsConfiguration.d.ts → V1_DataQualityValidationConfiguration.d.ts} +26 -4
  107. package/lib/graph-manager/protocol/pure/v1/V1_DataQualityValidationConfiguration.d.ts.map +1 -0
  108. package/lib/graph-manager/protocol/pure/v1/{V1_DataQualityConstraintsConfiguration.js → V1_DataQualityValidationConfiguration.js} +49 -4
  109. package/lib/graph-manager/protocol/pure/v1/V1_DataQualityValidationConfiguration.js.map +1 -0
  110. package/lib/graph-manager/protocol/pure/v1/transformation/V1_DSL_DataQuality_ValueSpecificationBuilderHelper.d.ts +7 -3
  111. package/lib/graph-manager/protocol/pure/v1/transformation/V1_DSL_DataQuality_ValueSpecificationBuilderHelper.d.ts.map +1 -1
  112. package/lib/graph-manager/protocol/pure/v1/transformation/V1_DSL_DataQuality_ValueSpecificationBuilderHelper.js +43 -3
  113. package/lib/graph-manager/protocol/pure/v1/transformation/V1_DSL_DataQuality_ValueSpecificationBuilderHelper.js.map +1 -1
  114. package/lib/graph-manager/protocol/pure/v1/transformation/V1_DSL_DataQuality_ValueSpecificationTransformer.d.ts +6 -3
  115. package/lib/graph-manager/protocol/pure/v1/transformation/V1_DSL_DataQuality_ValueSpecificationTransformer.d.ts.map +1 -1
  116. package/lib/graph-manager/protocol/pure/v1/transformation/V1_DSL_DataQuality_ValueSpecificationTransformer.js +39 -2
  117. package/lib/graph-manager/protocol/pure/v1/transformation/V1_DSL_DataQuality_ValueSpecificationTransformer.js.map +1 -1
  118. package/lib/graph-manager/protocol/pure/v1/transformation/pureProtocol/V1_DSL_DataQuality_ProtocolHelper.d.ts +5 -2
  119. package/lib/graph-manager/protocol/pure/v1/transformation/pureProtocol/V1_DSL_DataQuality_ProtocolHelper.d.ts.map +1 -1
  120. package/lib/graph-manager/protocol/pure/v1/transformation/pureProtocol/V1_DSL_DataQuality_ProtocolHelper.js +27 -9
  121. package/lib/graph-manager/protocol/pure/v1/transformation/pureProtocol/V1_DSL_DataQuality_ProtocolHelper.js.map +1 -1
  122. package/lib/index.css +2 -2
  123. package/lib/index.css.map +1 -1
  124. package/lib/package.json +1 -1
  125. package/package.json +7 -7
  126. package/src/components/{DSL_DataQuality_ClassElementDriver.tsx → DSL_DataQuality_ElementDriver.tsx} +87 -18
  127. package/src/components/DSL_DataQuality_LegendStudioApplicationPlugin.tsx +33 -48
  128. package/src/components/DSL_NewDataQualityValidationElement.tsx +208 -0
  129. package/src/components/DataQualityRelationTrialRuns.tsx +288 -0
  130. package/src/components/DataQualityRelationValidationConfigurationEditor.tsx +364 -0
  131. package/src/components/DataQualityRelationValidationEditor.tsx +290 -0
  132. package/src/components/DataQualityResultPanel.tsx +1 -4
  133. package/src/components/DataQualityResultValues.tsx +1 -5
  134. package/src/components/DataQualitySideBar.tsx +2 -2
  135. package/src/components/DataQualityValidationDetailPanel.tsx +182 -0
  136. package/src/components/DataQualityValidationParametersEditor.tsx +355 -0
  137. package/src/components/states/ConstraintState.ts +2 -0
  138. package/src/components/states/DataQualityClassValidationState.ts +5 -5
  139. package/src/components/states/DataQualityRelationResultState.ts +274 -0
  140. package/src/components/states/DataQualityRelationValidationConfigurationState.ts +429 -0
  141. package/src/components/states/DataQualityRelationValidationLambdaEditorState.ts +138 -0
  142. package/src/components/states/DataQualityRelationValidationState.ts +180 -0
  143. package/src/components/states/DataQualityResultState.ts +6 -8
  144. package/src/components/states/DataQualityState.ts +1 -1
  145. package/src/graph/metamodel/DSL_DataQuality_HashUtils.ts +4 -0
  146. package/src/graph/metamodel/DSL_DataQuality_PureGraphPlugin.ts +2 -0
  147. package/src/graph/metamodel/pure/packageableElements/data-quality/DataQualityValidationConfiguration.ts +79 -3
  148. package/src/graph-manager/DSL_DataQuality_GraphManagerHelper.ts +13 -0
  149. package/src/graph-manager/DSL_DataQuality_GraphModifierHelper.ts +107 -0
  150. package/src/graph-manager/DSL_DataQuality_PureGraphManagerPlugin.ts +8 -0
  151. package/src/graph-manager/action/changeDetection/DSL_DataQuality_ObserverHelper.ts +54 -1
  152. package/src/graph-manager/protocol/pure/DSL_DataQuality_PureGraphManagerExtension.ts +5 -3
  153. package/src/graph-manager/protocol/pure/DSL_DataQuality_PureProtocolProcessorPlugin.ts +72 -81
  154. package/src/graph-manager/protocol/pure/v1/V1_DSL_Data_Quality_PureGraphManagerExtension.ts +20 -23
  155. package/src/graph-manager/protocol/pure/v1/{V1_DataQualityConstraintsConfiguration.ts → V1_DataQualityValidationConfiguration.ts} +63 -4
  156. package/src/graph-manager/protocol/pure/v1/transformation/V1_DSL_DataQuality_ValueSpecificationBuilderHelper.ts +116 -2
  157. package/src/graph-manager/protocol/pure/v1/transformation/V1_DSL_DataQuality_ValueSpecificationTransformer.ts +78 -1
  158. package/src/graph-manager/protocol/pure/v1/transformation/pureProtocol/V1_DSL_DataQuality_ProtocolHelper.ts +55 -8
  159. package/style/_data-quality-relation-validation-builder.scss +454 -0
  160. package/style/index.scss +6 -0
  161. package/tsconfig.json +13 -6
  162. package/lib/components/DSL_DataQuality_ClassElementDriver.d.ts.map +0 -1
  163. package/lib/components/DSL_DataQuality_ClassElementDriver.js.map +0 -1
  164. package/lib/components/DSL_DataQuality_ServiceElementDriver.d.ts +0 -27
  165. package/lib/components/DSL_DataQuality_ServiceElementDriver.d.ts.map +0 -1
  166. package/lib/components/DSL_DataQuality_ServiceElementDriver.js +0 -41
  167. package/lib/components/DSL_DataQuality_ServiceElementDriver.js.map +0 -1
  168. package/lib/components/DSL_NewDataQualityClassValidationElement.d.ts.map +0 -1
  169. package/lib/components/DSL_NewDataQualityClassValidationElement.js +0 -64
  170. package/lib/components/DSL_NewDataQualityClassValidationElement.js.map +0 -1
  171. package/lib/components/DSL_NewDataQualityServiceValidationElement.d.ts.map +0 -1
  172. package/lib/components/DSL_NewDataQualityServiceValidationElement.js +0 -41
  173. package/lib/components/DSL_NewDataQualityServiceValidationElement.js.map +0 -1
  174. package/lib/graph-manager/protocol/pure/v1/V1_DataQualityConstraintsConfiguration.d.ts.map +0 -1
  175. package/lib/graph-manager/protocol/pure/v1/V1_DataQualityConstraintsConfiguration.js.map +0 -1
  176. package/src/components/DSL_DataQuality_ServiceElementDriver.tsx +0 -57
  177. package/src/components/DSL_NewDataQualityClassValidationElement.tsx +0 -156
  178. package/src/components/DSL_NewDataQualityServiceValidationElement.tsx +0 -74
@@ -0,0 +1,180 @@
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
+ import {
17
+ type DataQualityRelationValidation,
18
+ RelationValidationType,
19
+ } from '../../graph/metamodel/pure/packageableElements/data-quality/DataQualityValidationConfiguration.js';
20
+ import { type EditorStore } from '@finos/legend-application-studio';
21
+ import { action, makeObservable, observable } from 'mobx';
22
+ import {
23
+ type GeneratorFn,
24
+ assertErrorThrown,
25
+ hashArray,
26
+ LogEvent,
27
+ } from '@finos/legend-shared';
28
+ import {
29
+ type RawLambda,
30
+ buildSourceInformationSourceId,
31
+ GRAPH_MANAGER_EVENT,
32
+ isStubbed_RawLambda,
33
+ ParserError,
34
+ stub_RawLambda,
35
+ } from '@finos/legend-graph';
36
+ import { LambdaEditorState } from '@finos/legend-query-builder';
37
+ import { VALIDATION_SOURCE_ID_LABEL } from './ConstraintState.js';
38
+ import {
39
+ dataQualityRelationValidation_setAssertion,
40
+ dataQualityRelationValidation_setType,
41
+ } from '../../graph-manager/DSL_DataQuality_GraphModifierHelper.js';
42
+ import { DATA_QUALITY_HASH_STRUCTURE } from '../../graph/metamodel/DSL_DataQuality_HashUtils.js';
43
+ import { DataQualityRelationValidationLambdaEditorState } from './DataQualityRelationValidationLambdaEditorState.js';
44
+ import type { SelectOption } from '@finos/legend-art';
45
+
46
+ export class DataQualityRelationValidationState extends LambdaEditorState {
47
+ relationValidation: DataQualityRelationValidation;
48
+ editorStore: EditorStore;
49
+ isValidationDialogOpen = false;
50
+ rowMapFunctionLambdaEditorState:
51
+ | DataQualityRelationValidationLambdaEditorState
52
+ | undefined;
53
+ constructor(
54
+ relationValidation: DataQualityRelationValidation,
55
+ editorStore: EditorStore,
56
+ ) {
57
+ super('true', '');
58
+
59
+ makeObservable(this, {
60
+ relationValidation: observable,
61
+ editorStore: observable,
62
+ isValidationDialogOpen: observable,
63
+ setIsValidationDialogOpen: action,
64
+ onValidationTypeChange: action,
65
+ });
66
+
67
+ this.relationValidation = relationValidation;
68
+ this.editorStore = editorStore;
69
+ this.rowMapFunctionLambdaEditorState =
70
+ relationValidation.type === RelationValidationType.AGGREGATE
71
+ ? new DataQualityRelationValidationLambdaEditorState(
72
+ relationValidation,
73
+ editorStore,
74
+ )
75
+ : undefined;
76
+ }
77
+
78
+ get lambdaId(): string {
79
+ return buildSourceInformationSourceId([
80
+ VALIDATION_SOURCE_ID_LABEL,
81
+ this.relationValidation.name,
82
+ this.uuid, // in case of duplications
83
+ ]);
84
+ }
85
+
86
+ setIsValidationDialogOpen(isValidationDialogOpen: boolean): void {
87
+ this.isValidationDialogOpen = isValidationDialogOpen;
88
+ }
89
+
90
+ onValidationTypeChange(val: SelectOption): void {
91
+ dataQualityRelationValidation_setType(
92
+ this.relationValidation,
93
+ val.value as RelationValidationType,
94
+ );
95
+ if (val.value === RelationValidationType.AGGREGATE) {
96
+ this.rowMapFunctionLambdaEditorState =
97
+ new DataQualityRelationValidationLambdaEditorState(
98
+ this.relationValidation,
99
+ this.editorStore,
100
+ );
101
+ } else {
102
+ this.rowMapFunctionLambdaEditorState = undefined;
103
+ }
104
+ }
105
+
106
+ *convertLambdaGrammarStringToObject(): GeneratorFn<void> {
107
+ const emptyFunctionDefinition = stub_RawLambda();
108
+ if (this.lambdaString) {
109
+ try {
110
+ const lambda =
111
+ (yield this.editorStore.graphManagerState.graphManager.pureCodeToLambda(
112
+ this.fullLambdaString,
113
+ this.lambdaId,
114
+ )) as RawLambda;
115
+ this.setParserError(undefined);
116
+ dataQualityRelationValidation_setAssertion(
117
+ this.relationValidation,
118
+ lambda,
119
+ );
120
+ } catch (error) {
121
+ assertErrorThrown(error);
122
+ if (error instanceof ParserError) {
123
+ this.setParserError(error);
124
+ }
125
+ this.editorStore.applicationStore.logService.error(
126
+ LogEvent.create(GRAPH_MANAGER_EVENT.PARSING_FAILURE),
127
+ error,
128
+ );
129
+ }
130
+ } else {
131
+ this.clearErrors();
132
+ dataQualityRelationValidation_setAssertion(
133
+ this.relationValidation,
134
+ emptyFunctionDefinition,
135
+ );
136
+ }
137
+ }
138
+
139
+ *convertLambdaObjectToGrammarString(options?: {
140
+ pretty?: boolean | undefined;
141
+ preserveCompilationError?: boolean | undefined;
142
+ }): GeneratorFn<void> {
143
+ if (!isStubbed_RawLambda(this.relationValidation.assertion)) {
144
+ try {
145
+ const lambdas = new Map<string, RawLambda>();
146
+ lambdas.set(this.lambdaId, this.relationValidation.assertion);
147
+ const isolatedLambdas =
148
+ (yield this.editorStore.graphManagerState.graphManager.lambdasToPureCode(
149
+ lambdas,
150
+ options?.pretty,
151
+ )) as Map<string, string>;
152
+ const grammarText = isolatedLambdas.get(this.lambdaId);
153
+ this.setLambdaString(
154
+ grammarText !== undefined
155
+ ? this.extractLambdaString(grammarText)
156
+ : '',
157
+ );
158
+ this.clearErrors({
159
+ preserveCompilationError: options?.preserveCompilationError,
160
+ });
161
+ } catch (error) {
162
+ assertErrorThrown(error);
163
+ this.editorStore.applicationStore.logService.error(
164
+ LogEvent.create(GRAPH_MANAGER_EVENT.PARSING_FAILURE),
165
+ error,
166
+ );
167
+ }
168
+ } else {
169
+ this.clearErrors();
170
+ this.setLambdaString('');
171
+ }
172
+ }
173
+
174
+ get hashCode(): string {
175
+ return hashArray([
176
+ DATA_QUALITY_HASH_STRUCTURE.DATA_QUALITY_RELATION_VALIDATION,
177
+ this.lambdaString,
178
+ ]);
179
+ }
180
+ }
@@ -116,12 +116,10 @@ export class DataQualityResultState {
116
116
 
117
117
  promise = getDataQualityPureGraphManagerExtension(
118
118
  this.dataQualityState.graphManagerState.graphManager,
119
- ).execute(
120
- model,
121
- this.dataQualityState.lambdaParameterValues,
122
- packagePath,
123
- this.previewLimit,
124
- );
119
+ ).execute(model, packagePath, {
120
+ lambdaParameterValues: this.dataQualityState.lambdaParameterValues,
121
+ previewLimit: this.previewLimit,
122
+ });
125
123
 
126
124
  this.setQueryRunPromise(promise);
127
125
  const result = (yield promise) as ExecutionResult;
@@ -179,7 +177,7 @@ export class DataQualityResultState {
179
177
  if (debug) {
180
178
  const debugResult = (yield getDataQualityPureGraphManagerExtension(
181
179
  this.dataQualityState.graphManagerState.graphManager,
182
- ).debugExecutionPlanGeneration(model, packagePath)) as {
180
+ ).debugExecutionPlanGeneration(model, packagePath, {})) as {
183
181
  plan: RawExecutionPlan;
184
182
  debug: string;
185
183
  };
@@ -191,7 +189,7 @@ export class DataQualityResultState {
191
189
  );
192
190
  rawPlan = (yield getDataQualityPureGraphManagerExtension(
193
191
  this.dataQualityState.graphManagerState.graphManager,
194
- ).generatePlan(model, packagePath)) as RawExecutionPlan;
192
+ ).generatePlan(model, packagePath, {})) as RawExecutionPlan;
195
193
  }
196
194
 
197
195
  stopWatch.record();
@@ -271,7 +271,7 @@ export abstract class DataQualityState extends ElementEditorState {
271
271
  const model = this.graphManagerState.graph;
272
272
  const rootGraphFetchTree = (yield getDataQualityPureGraphManagerExtension(
273
273
  this.graphManagerState.graphManager,
274
- ).fetchStructuralValidations(model, packagePath)) as RootGraphFetchTree;
274
+ ).fetchStructuralValidations(model, packagePath, {})) as RootGraphFetchTree;
275
275
  this.initializeStructuralValidationsGraphFetchTreeState(
276
276
  rootGraphFetchTree as DataQualityRootGraphFetchTree,
277
277
  );
@@ -17,6 +17,7 @@
17
17
  export enum DATA_QUALITY_HASH_STRUCTURE {
18
18
  DATA_QUALITY_CONSTRAINTS_CONFIGURATION = 'DATA_QUALITY_CONSTRAINTS_CONFIGURATION',
19
19
  DATA_QUALITY_SERVICE_VALIDATION_CONFIGURATION = 'DATA_QUALITY_SERVICE_VALIDATION_CONFIGURATION',
20
+ DATA_QUALITY_RELATION_VALIDATION_CONFIGURATION = 'DATA_QUALITY_RELATION_VALIDATION_CONFIGURATION',
20
21
  DATA_QUALTIY_DATASPACE_EXECUTION_CONTEXT = 'DATA_QUALITY_DATASPACE_EXECUTION_CONTEXT',
21
22
  DATA_QUALITY_MAPPING_AND_RUNTIME_EXECUTION_CONTEXT = 'DATA_QUALITY_MAPPING_AND_RUNTIME_EXECUTION_CONTEXT',
22
23
  DATA_QUALITY_GRAPH_FETCH_STATE = 'DATA_QUALITY_GRAPH_FETCH_STATE',
@@ -26,4 +27,7 @@ export enum DATA_QUALITY_HASH_STRUCTURE {
26
27
  DATA_QUALITY_SUBTYPE_GRAPH_FETCH_TREE = 'DATA_QUALITY_SUBTYPE_GRAPH_FETCH_TREE',
27
28
  DATA_QUALITY_GRAPH_FETCH_TREE_NODE_DATA = 'DATA_QUALITY_GRAPH_FETCH_TREE_NODE_DATA',
28
29
  DATA_QUALITY_STATE = 'DATA_QUALITY_STATE',
30
+ DATA_QUALITY_RELATION_VALIDATION = 'DATA_QUALITY_RELATION_VALIDATION',
31
+ DATA_QUALITY_RELATION_FUNCTION_DEFINITION = 'DATA_QUALITY_RELATION_FUNCTION_DEFINITION',
32
+ DATA_QUALITY_RELATION_VALIDATION_QUERY = 'DATA_QUALITY_RELATION_VALIDATION_QUERY',
29
33
  }
@@ -20,6 +20,7 @@ import packageJson from '../../../package.json';
20
20
  import {
21
21
  DataQualityClassValidationsConfiguration,
22
22
  DataQualityServiceValidationConfiguration,
23
+ DataQualityRelationValidationConfiguration,
23
24
  } from './pure/packageableElements/data-quality/DataQualityValidationConfiguration.js';
24
25
 
25
26
  export class DSL_DataQuality_PureGraphPlugin extends PureGraphPlugin {
@@ -31,6 +32,7 @@ export class DSL_DataQuality_PureGraphPlugin extends PureGraphPlugin {
31
32
  return [
32
33
  DataQualityClassValidationsConfiguration,
33
34
  DataQualityServiceValidationConfiguration,
35
+ DataQualityRelationValidationConfiguration,
34
36
  ];
35
37
  }
36
38
  }
@@ -21,13 +21,27 @@ import {
21
21
  type PackageableElementReference,
22
22
  type PackageableRuntime,
23
23
  type RawLambda,
24
+ type ParameterValue,
25
+ type RawVariableExpression,
24
26
  PackageableElement,
27
+ hashRawLambda,
25
28
  } from '@finos/legend-graph';
26
- import { type Hashable, hashArray } from '@finos/legend-shared';
29
+ import { type Hashable, hashArray, uuid } from '@finos/legend-shared';
27
30
  import { DATA_QUALITY_HASH_STRUCTURE } from '../../../DSL_DataQuality_HashUtils.js';
28
31
  import type { DataSpace } from '@finos/legend-extension-dsl-data-space/graph';
29
32
  import type { DataQualityRootGraphFetchTree } from './DataQualityGraphFetchTree.js';
30
33
 
34
+ export enum RelationValidationType {
35
+ ROW_LEVEL = 'ROW_LEVEL',
36
+ AGGREGATE = 'AGGREGATE',
37
+ }
38
+ export interface DQExecuteInputOptions {
39
+ lambdaParameterValues?: ParameterValue[];
40
+ clientVersion?: string | undefined;
41
+ validationName?: string | undefined;
42
+ previewLimit?: number | undefined;
43
+ }
44
+
31
45
  export abstract class DataQualityExecutionContext implements Hashable {
32
46
  abstract get hashCode(): string;
33
47
  }
@@ -58,8 +72,10 @@ export class MappingAndRuntimeDataQualityExecutionContext extends DataQualityExe
58
72
  }
59
73
  }
60
74
 
75
+ export abstract class DataQualityValidationConfiguration extends PackageableElement {}
76
+
61
77
  export class DataQualityClassValidationsConfiguration
62
- extends PackageableElement
78
+ extends DataQualityValidationConfiguration
63
79
  implements Hashable
64
80
  {
65
81
  context!: DataQualityExecutionContext;
@@ -83,7 +99,7 @@ export class DataQualityClassValidationsConfiguration
83
99
  }
84
100
 
85
101
  export class DataQualityServiceValidationConfiguration
86
- extends PackageableElement
102
+ extends DataQualityValidationConfiguration
87
103
  implements Hashable
88
104
  {
89
105
  serviceName: string | undefined;
@@ -105,3 +121,63 @@ export class DataQualityServiceValidationConfiguration
105
121
  return visitor.visit_PackageableElement(this);
106
122
  }
107
123
  }
124
+
125
+ export class DataQualityRelationQueryLambda implements Hashable {
126
+ body?: object | undefined;
127
+ parameters: RawVariableExpression[] = [];
128
+
129
+ get hashCode(): string {
130
+ return hashArray([
131
+ DATA_QUALITY_HASH_STRUCTURE.DATA_QUALITY_RELATION_VALIDATION_QUERY,
132
+ hashArray(this.parameters),
133
+ hashRawLambda(undefined, this.body),
134
+ ]);
135
+ }
136
+ }
137
+
138
+ export class DataQualityRelationValidation implements Hashable {
139
+ readonly _UUID = uuid();
140
+ name: string;
141
+ description: string | undefined;
142
+ assertion: RawLambda;
143
+ type: RelationValidationType = RelationValidationType.ROW_LEVEL;
144
+ rowMapFunction: RawLambda | undefined;
145
+
146
+ constructor(name: string, assertion: RawLambda) {
147
+ this.name = name;
148
+ this.assertion = assertion;
149
+ }
150
+
151
+ get hashCode(): string {
152
+ return hashArray([
153
+ DATA_QUALITY_HASH_STRUCTURE.DATA_QUALITY_RELATION_VALIDATION,
154
+ this.name,
155
+ this.type,
156
+ this.description ?? '',
157
+ this.assertion,
158
+ this.rowMapFunction ?? '',
159
+ ]);
160
+ }
161
+ }
162
+
163
+ export class DataQualityRelationValidationConfiguration
164
+ extends DataQualityValidationConfiguration
165
+ implements Hashable
166
+ {
167
+ query!: DataQualityRelationQueryLambda;
168
+ validations: DataQualityRelationValidation[] = [];
169
+
170
+ protected override get _elementHashCode(): string {
171
+ return hashArray([
172
+ DATA_QUALITY_HASH_STRUCTURE.DATA_QUALITY_RELATION_VALIDATION_CONFIGURATION,
173
+ this.query,
174
+ hashArray(this.validations),
175
+ ]);
176
+ }
177
+
178
+ accept_PackageableElementVisitor<T>(
179
+ visitor: PackageableElementVisitor<T>,
180
+ ): T {
181
+ return visitor.visit_PackageableElement(this);
182
+ }
183
+ }
@@ -19,6 +19,7 @@ import { guaranteeNonNullable } from '@finos/legend-shared';
19
19
  import {
20
20
  DataQualityClassValidationsConfiguration,
21
21
  DataQualityServiceValidationConfiguration,
22
+ DataQualityRelationValidationConfiguration,
22
23
  } from '../graph/metamodel/pure/packageableElements/data-quality/DataQualityValidationConfiguration.js';
23
24
 
24
25
  export const getOwnDataQualityClassValidationsConfiguration = (
@@ -44,3 +45,15 @@ export const getOwnDataQualityServiceValidationsConfiguration = (
44
45
  ),
45
46
  `Can't find data quality service validation element on '${path}'`,
46
47
  );
48
+
49
+ export const getOwnDataQualityRelationValidationsConfiguration = (
50
+ path: string,
51
+ graph: BasicModel,
52
+ ): DataQualityRelationValidationConfiguration =>
53
+ guaranteeNonNullable(
54
+ graph.getOwnNullableExtensionElement(
55
+ path,
56
+ DataQualityRelationValidationConfiguration,
57
+ ),
58
+ `Can't find data quality tds validation element on '${path}'`,
59
+ );
@@ -18,6 +18,9 @@ import { action } from 'mobx';
18
18
  import {
19
19
  type DataQualityClassValidationsConfiguration,
20
20
  type DataQualityExecutionContext,
21
+ type DataQualityRelationValidation,
22
+ type DataQualityRelationValidationConfiguration,
23
+ type RelationValidationType,
21
24
  DataSpaceDataQualityExecutionContext,
22
25
  MappingAndRuntimeDataQualityExecutionContext,
23
26
  } from '../graph/metamodel/pure/packageableElements/data-quality/DataQualityValidationConfiguration.js';
@@ -28,15 +31,19 @@ import {
28
31
  type PackageableRuntime,
29
32
  type RawLambda,
30
33
  type ObserverContext,
34
+ type RawVariableExpression,
31
35
  observe_PackageableRuntime,
32
36
  observe_RawLambda,
33
37
  PackageableElementExplicitReference,
38
+ observe_RawVariableExpression,
34
39
  } from '@finos/legend-graph';
35
40
  import {
36
41
  observe_DataQualityRootGraphFetchTree,
42
+ observe_DataQualityRelationValidation,
37
43
  observe_DataSpaceDataQualityExecutionContext,
38
44
  observe_MappingAndRuntimeDataQualityExecutionContext,
39
45
  } from './action/changeDetection/DSL_DataQuality_ObserverHelper.js';
46
+ import { addUniqueEntry, deleteEntry, swapEntry } from '@finos/legend-shared';
40
47
 
41
48
  export const dataQualityClassValidation_setDataQualityGraphFetchTree = action(
42
49
  (
@@ -111,3 +118,103 @@ export const dataQualityGraphFetchTree_removeConstraints = action(
111
118
  }
112
119
  },
113
120
  );
121
+
122
+ export const dataQualityRelationValidation_setAssertion = action(
123
+ (_constraint: DataQualityRelationValidation, assertion: RawLambda): void => {
124
+ _constraint.assertion = observe_RawLambda(assertion);
125
+ },
126
+ );
127
+
128
+ export const dataQualityRelationValidation_setName = action(
129
+ (_constraint: DataQualityRelationValidation, name: string): void => {
130
+ _constraint.name = name;
131
+ },
132
+ );
133
+
134
+ export const dataQualityRelationValidation_setDescription = action(
135
+ (_constraint: DataQualityRelationValidation, description: string): void => {
136
+ _constraint.description = description;
137
+ },
138
+ );
139
+
140
+ export const dataQualityRelationValidation_setType = action(
141
+ (
142
+ _constraint: DataQualityRelationValidation,
143
+ type: RelationValidationType,
144
+ ): void => {
145
+ _constraint.type = type;
146
+ },
147
+ );
148
+
149
+ export const dataQualityRelationValidation_setRowMapFunction = action(
150
+ (
151
+ _constraint: DataQualityRelationValidation,
152
+ rowMapFunction: RawLambda,
153
+ ): void => {
154
+ _constraint.rowMapFunction = observe_RawLambda(rowMapFunction);
155
+ },
156
+ );
157
+
158
+ export const dataQualityRelationValidation_addValidation = action(
159
+ (
160
+ _relationValidation: DataQualityRelationValidationConfiguration,
161
+ val: DataQualityRelationValidation,
162
+ ): void => {
163
+ addUniqueEntry(
164
+ _relationValidation.validations,
165
+ observe_DataQualityRelationValidation(val),
166
+ );
167
+ },
168
+ );
169
+
170
+ export const dataQualityRelationValidation_deleteValidation = action(
171
+ (
172
+ _relationValidation: DataQualityRelationValidationConfiguration,
173
+ val: DataQualityRelationValidation,
174
+ ): void => {
175
+ deleteEntry(
176
+ _relationValidation.validations,
177
+ observe_DataQualityRelationValidation(val),
178
+ );
179
+ },
180
+ );
181
+
182
+ export const dataQualityRelationValidation_swapValidations = action(
183
+ (
184
+ _relationValidation: DataQualityRelationValidationConfiguration,
185
+ sourceValidation: DataQualityRelationValidation,
186
+ targetValidation: DataQualityRelationValidation,
187
+ ): void => {
188
+ swapEntry(
189
+ _relationValidation.validations,
190
+ sourceValidation,
191
+ targetValidation,
192
+ );
193
+ },
194
+ );
195
+
196
+ export const dataQualityRelationValidation_addParameter = action(
197
+ (_parameters: RawVariableExpression[], val: RawVariableExpression): void => {
198
+ addUniqueEntry(_parameters, observe_RawVariableExpression(val));
199
+ },
200
+ );
201
+
202
+ export const dataQualityRelationValidation_deleteParameter = action(
203
+ (_parameters: RawVariableExpression[], val: RawVariableExpression): void => {
204
+ deleteEntry(_parameters, val);
205
+ },
206
+ );
207
+
208
+ export const dataQualityRelationValidation_swapParameters = action(
209
+ (
210
+ _parameters: RawVariableExpression[],
211
+ sourceParameter: RawVariableExpression,
212
+ targetParameter: RawVariableExpression,
213
+ ): void => {
214
+ swapEntry(
215
+ _parameters,
216
+ observe_RawVariableExpression(sourceParameter),
217
+ observe_RawVariableExpression(targetParameter),
218
+ );
219
+ },
220
+ );
@@ -24,10 +24,12 @@ import {
24
24
  import {
25
25
  DataQualityClassValidationsConfiguration,
26
26
  DataQualityServiceValidationConfiguration,
27
+ DataQualityRelationValidationConfiguration,
27
28
  } from '../graph/metamodel/pure/packageableElements/data-quality/DataQualityValidationConfiguration.js';
28
29
  import {
29
30
  observe_DataQualityConstraintsConfiguration,
30
31
  observe_DataQualityServiceValidationConfiguration,
32
+ observe_DataQualityRelationValidationConfiguration,
31
33
  } from './action/changeDetection/DSL_DataQuality_ObserverHelper.js';
32
34
  import { DSL_DataQuality_buildGraphManagerExtension } from './protocol/pure/DSL_DataQuality_buildGraphManagerExtension.js';
33
35
 
@@ -48,6 +50,12 @@ export class DSL_DataQuality_PureGraphManagerPlugin extends PureGraphManagerPlug
48
50
  if (element instanceof DataQualityServiceValidationConfiguration) {
49
51
  return observe_DataQualityServiceValidationConfiguration(element);
50
52
  }
53
+ if (element instanceof DataQualityRelationValidationConfiguration) {
54
+ return observe_DataQualityRelationValidationConfiguration(
55
+ element,
56
+ context,
57
+ );
58
+ }
51
59
  return undefined;
52
60
  },
53
61
  ];
@@ -15,17 +15,22 @@
15
15
  */
16
16
 
17
17
  import {
18
+ type ObserverContext,
18
19
  observe_Abstract_PackageableElement,
19
20
  observe_Class,
20
21
  observe_PackageableElementReference,
21
22
  observe_PropertyReference,
22
23
  observe_RawLambda,
23
24
  skipObserved,
25
+ skipObservedWithContext,
24
26
  } from '@finos/legend-graph';
25
- import { makeObservable, observable, override } from 'mobx';
27
+ import { computed, makeObservable, observable, override } from 'mobx';
26
28
  import {
27
29
  type DataQualityClassValidationsConfiguration,
28
30
  type DataQualityServiceValidationConfiguration,
31
+ type DataQualityRelationValidation,
32
+ type DataQualityRelationValidationConfiguration,
33
+ type DataQualityRelationQueryLambda,
29
34
  DataSpaceDataQualityExecutionContext,
30
35
  MappingAndRuntimeDataQualityExecutionContext,
31
36
  } from '../../../graph/metamodel/pure/packageableElements/data-quality/DataQualityValidationConfiguration.js';
@@ -151,3 +156,51 @@ export const observe_DataQualityServiceValidationConfiguration = skipObserved(
151
156
  return metamodel;
152
157
  },
153
158
  );
159
+
160
+ export const observe_DataQualityRelationValidation = skipObserved(
161
+ (metamodel: DataQualityRelationValidation): DataQualityRelationValidation => {
162
+ makeObservable(metamodel, {
163
+ name: observable,
164
+ assertion: observable,
165
+ description: observable,
166
+ type: observable,
167
+ rowMapFunction: observable,
168
+ });
169
+
170
+ observe_RawLambda(metamodel.assertion);
171
+ return metamodel;
172
+ },
173
+ );
174
+
175
+ export const observe_DataQualityRelationQueryLambda = skipObserved(
176
+ (metamodel: DataQualityRelationQueryLambda): DataQualityRelationQueryLambda =>
177
+ makeObservable(metamodel, {
178
+ body: observable.ref, // only observe the reference, the object itself is not observed
179
+ parameters: observable,
180
+ hashCode: computed,
181
+ }),
182
+ );
183
+
184
+ export const observe_DataQualityRelationValidationConfiguration =
185
+ skipObservedWithContext(
186
+ (
187
+ metamodel: DataQualityRelationValidationConfiguration,
188
+ context: ObserverContext,
189
+ ): DataQualityRelationValidationConfiguration => {
190
+ observe_Abstract_PackageableElement(metamodel);
191
+
192
+ makeObservable<
193
+ DataQualityRelationValidationConfiguration,
194
+ '_elementHashCode'
195
+ >(metamodel, {
196
+ _elementHashCode: override,
197
+ query: observable,
198
+ validations: observable,
199
+ });
200
+ metamodel.validations.forEach((value) =>
201
+ observe_DataQualityRelationValidation(value),
202
+ );
203
+ observe_DataQualityRelationQueryLambda(metamodel.query);
204
+ return metamodel;
205
+ },
206
+ );
@@ -20,32 +20,34 @@ import {
20
20
  type ExecutionResult,
21
21
  type PureModel,
22
22
  type RootGraphFetchTree,
23
- type ParameterValue,
24
23
  AbstractPureGraphManagerExtension,
25
24
  } from '@finos/legend-graph';
26
25
  import { guaranteeNonNullable } from '@finos/legend-shared';
26
+ import type { DQExecuteInputOptions } from '../../../graph/metamodel/pure/packageableElements/data-quality/DataQualityValidationConfiguration.js';
27
27
 
28
28
  export abstract class DSL_DataQuality_PureGraphManagerExtension extends AbstractPureGraphManagerExtension {
29
29
  abstract generatePlan(
30
30
  graph: PureModel,
31
31
  packagePath: string,
32
+ options: DQExecuteInputOptions,
32
33
  ): Promise<RawExecutionPlan>;
33
34
 
34
35
  abstract execute(
35
36
  graph: PureModel,
36
- lambdaParameterValues: ParameterValue[],
37
37
  packagePath: string,
38
- previewLimit: number,
38
+ options: DQExecuteInputOptions,
39
39
  ): Promise<ExecutionResult>;
40
40
 
41
41
  abstract debugExecutionPlanGeneration(
42
42
  graph: PureModel,
43
43
  packagePath: string,
44
+ options: DQExecuteInputOptions,
44
45
  ): Promise<{ plan: RawExecutionPlan; debug: string }>;
45
46
 
46
47
  abstract fetchStructuralValidations(
47
48
  graph: PureModel,
48
49
  packagePath: string,
50
+ options: DQExecuteInputOptions,
49
51
  ): Promise<RootGraphFetchTree>;
50
52
  }
51
53