@finos/legend-graph 1.0.6 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (151) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/lib/GraphManagerStateProvider.js +1 -1
  3. package/lib/GraphManagerStateProvider.js.map +1 -1
  4. package/lib/GraphManagerTestUtils.js +1 -1
  5. package/lib/GraphManagerTestUtils.js.map +1 -1
  6. package/lib/MetaModelConst.d.ts +2 -2
  7. package/lib/MetaModelConst.d.ts.map +1 -1
  8. package/lib/MetaModelConst.js +2 -2
  9. package/lib/MetaModelConst.js.map +1 -1
  10. package/lib/graph/BasicModel.d.ts +1 -1
  11. package/lib/graph/BasicModel.d.ts.map +1 -1
  12. package/lib/graph/BasicModel.js +2 -2
  13. package/lib/graph/BasicModel.js.map +1 -1
  14. package/lib/graph/DependencyManager.d.ts +2 -0
  15. package/lib/graph/DependencyManager.d.ts.map +1 -1
  16. package/lib/graph/DependencyManager.js +4 -0
  17. package/lib/graph/DependencyManager.js.map +1 -1
  18. package/lib/graphManager/AbstractPureGraphManager.d.ts +14 -11
  19. package/lib/graphManager/AbstractPureGraphManager.d.ts.map +1 -1
  20. package/lib/graphManager/AbstractPureGraphManager.js.map +1 -1
  21. package/lib/graphManager/action/{TEMP__AbstractEngineConfig.d.ts → TEMPORARY__AbstractEngineConfig.d.ts} +2 -2
  22. package/lib/graphManager/action/TEMPORARY__AbstractEngineConfig.d.ts.map +1 -0
  23. package/lib/graphManager/action/{TEMP__AbstractEngineConfig.js → TEMPORARY__AbstractEngineConfig.js} +2 -2
  24. package/lib/graphManager/action/TEMPORARY__AbstractEngineConfig.js.map +1 -0
  25. package/lib/graphManager/action/execution/ExecutionResult.d.ts +7 -0
  26. package/lib/graphManager/action/execution/ExecutionResult.d.ts.map +1 -1
  27. package/lib/graphManager/action/execution/ExecutionResult.js +12 -0
  28. package/lib/graphManager/action/execution/ExecutionResult.js.map +1 -1
  29. package/lib/helpers/MappingHelper.d.ts.map +1 -1
  30. package/lib/helpers/MappingHelper.js +1 -4
  31. package/lib/helpers/MappingHelper.js.map +1 -1
  32. package/lib/helpers/PureLanguageHelper.d.ts +21 -0
  33. package/lib/helpers/PureLanguageHelper.d.ts.map +1 -0
  34. package/lib/helpers/PureLanguageHelper.js +73 -0
  35. package/lib/helpers/PureLanguageHelper.js.map +1 -0
  36. package/lib/index.d.ts +2 -1
  37. package/lib/index.d.ts.map +1 -1
  38. package/lib/index.js +2 -1
  39. package/lib/index.js.map +1 -1
  40. package/lib/models/metamodels/pure/packageableElements/mapping/PropertyMapping.d.ts.map +1 -1
  41. package/lib/models/metamodels/pure/packageableElements/mapping/PropertyMapping.js +2 -0
  42. package/lib/models/metamodels/pure/packageableElements/mapping/PropertyMapping.js.map +1 -1
  43. package/lib/models/metamodels/pure/packageableElements/mapping/SetImplementation.d.ts +18 -4
  44. package/lib/models/metamodels/pure/packageableElements/mapping/SetImplementation.d.ts.map +1 -1
  45. package/lib/models/metamodels/pure/packageableElements/mapping/SetImplementation.js +22 -0
  46. package/lib/models/metamodels/pure/packageableElements/mapping/SetImplementation.js.map +1 -1
  47. package/lib/models/metamodels/pure/packageableElements/store/relational/connection/AuthenticationStrategy.d.ts +4 -10
  48. package/lib/models/metamodels/pure/packageableElements/store/relational/connection/AuthenticationStrategy.d.ts.map +1 -1
  49. package/lib/models/metamodels/pure/packageableElements/store/relational/connection/AuthenticationStrategy.js +11 -32
  50. package/lib/models/metamodels/pure/packageableElements/store/relational/connection/AuthenticationStrategy.js.map +1 -1
  51. package/lib/models/metamodels/pure/packageableElements/store/relational/connection/DatasourceSpecification.d.ts +12 -0
  52. package/lib/models/metamodels/pure/packageableElements/store/relational/connection/DatasourceSpecification.d.ts.map +1 -1
  53. package/lib/models/metamodels/pure/packageableElements/store/relational/connection/DatasourceSpecification.js +41 -0
  54. package/lib/models/metamodels/pure/packageableElements/store/relational/connection/DatasourceSpecification.js.map +1 -1
  55. package/lib/models/metamodels/pure/packageableElements/store/relational/connection/RelationalDatabaseConnection.d.ts +1 -0
  56. package/lib/models/metamodels/pure/packageableElements/store/relational/connection/RelationalDatabaseConnection.d.ts.map +1 -1
  57. package/lib/models/metamodels/pure/packageableElements/store/relational/connection/RelationalDatabaseConnection.js +1 -0
  58. package/lib/models/metamodels/pure/packageableElements/store/relational/connection/RelationalDatabaseConnection.js.map +1 -1
  59. package/lib/models/protocols/pure/v1/V1_PureGraphManager.d.ts +5 -5
  60. package/lib/models/protocols/pure/v1/V1_PureGraphManager.d.ts.map +1 -1
  61. package/lib/models/protocols/pure/v1/V1_PureGraphManager.js +4 -4
  62. package/lib/models/protocols/pure/v1/V1_PureGraphManager.js.map +1 -1
  63. package/lib/models/protocols/pure/v1/engine/V1_Engine.d.ts +4 -3
  64. package/lib/models/protocols/pure/v1/engine/V1_Engine.d.ts.map +1 -1
  65. package/lib/models/protocols/pure/v1/engine/V1_Engine.js +11 -7
  66. package/lib/models/protocols/pure/v1/engine/V1_Engine.js.map +1 -1
  67. package/lib/models/protocols/pure/v1/engine/V1_EngineServerClient.d.ts +5 -1
  68. package/lib/models/protocols/pure/v1/engine/V1_EngineServerClient.d.ts.map +1 -1
  69. package/lib/models/protocols/pure/v1/engine/V1_EngineServerClient.js +3 -1
  70. package/lib/models/protocols/pure/v1/engine/V1_EngineServerClient.js.map +1 -1
  71. package/lib/models/protocols/pure/v1/engine/V1_ExecutionHelper.d.ts.map +1 -1
  72. package/lib/models/protocols/pure/v1/engine/V1_ExecutionHelper.js +5 -2
  73. package/lib/models/protocols/pure/v1/engine/V1_ExecutionHelper.js.map +1 -1
  74. package/lib/models/protocols/pure/v1/engine/execution/V1_ExecutionResult.d.ts +5 -1
  75. package/lib/models/protocols/pure/v1/engine/execution/V1_ExecutionResult.d.ts.map +1 -1
  76. package/lib/models/protocols/pure/v1/engine/execution/V1_ExecutionResult.js +11 -1
  77. package/lib/models/protocols/pure/v1/engine/execution/V1_ExecutionResult.js.map +1 -1
  78. package/lib/models/protocols/pure/v1/model/packageableElements/store/relational/connection/V1_AuthenticationStrategy.d.ts +4 -8
  79. package/lib/models/protocols/pure/v1/model/packageableElements/store/relational/connection/V1_AuthenticationStrategy.d.ts.map +1 -1
  80. package/lib/models/protocols/pure/v1/model/packageableElements/store/relational/connection/V1_AuthenticationStrategy.js +9 -18
  81. package/lib/models/protocols/pure/v1/model/packageableElements/store/relational/connection/V1_AuthenticationStrategy.js.map +1 -1
  82. package/lib/models/protocols/pure/v1/model/packageableElements/store/relational/connection/V1_DatasourceSpecification.d.ts +9 -1
  83. package/lib/models/protocols/pure/v1/model/packageableElements/store/relational/connection/V1_DatasourceSpecification.d.ts.map +1 -1
  84. package/lib/models/protocols/pure/v1/model/packageableElements/store/relational/connection/V1_DatasourceSpecification.js +16 -0
  85. package/lib/models/protocols/pure/v1/model/packageableElements/store/relational/connection/V1_DatasourceSpecification.js.map +1 -1
  86. package/lib/models/protocols/pure/v1/model/packageableElements/store/relational/connection/V1_RelationalDatabaseConnection.d.ts +1 -0
  87. package/lib/models/protocols/pure/v1/model/packageableElements/store/relational/connection/V1_RelationalDatabaseConnection.d.ts.map +1 -1
  88. package/lib/models/protocols/pure/v1/model/packageableElements/store/relational/connection/V1_RelationalDatabaseConnection.js +1 -0
  89. package/lib/models/protocols/pure/v1/model/packageableElements/store/relational/connection/V1_RelationalDatabaseConnection.js.map +1 -1
  90. package/lib/models/protocols/pure/v1/transformation/pureGraph/from/V1_ConnectionTransformer.d.ts.map +1 -1
  91. package/lib/models/protocols/pure/v1/transformation/pureGraph/from/V1_ConnectionTransformer.js +20 -13
  92. package/lib/models/protocols/pure/v1/transformation/pureGraph/from/V1_ConnectionTransformer.js.map +1 -1
  93. package/lib/models/protocols/pure/v1/transformation/pureGraph/from/V1_MappingTransformer.d.ts +2 -1
  94. package/lib/models/protocols/pure/v1/transformation/pureGraph/from/V1_MappingTransformer.d.ts.map +1 -1
  95. package/lib/models/protocols/pure/v1/transformation/pureGraph/from/V1_MappingTransformer.js +7 -2
  96. package/lib/models/protocols/pure/v1/transformation/pureGraph/from/V1_MappingTransformer.js.map +1 -1
  97. package/lib/models/protocols/pure/v1/transformation/pureGraph/to/V1_ProtocolToMetaModelGraphSecondPassBuilder.js +3 -3
  98. package/lib/models/protocols/pure/v1/transformation/pureGraph/to/V1_ProtocolToMetaModelGraphSecondPassBuilder.js.map +1 -1
  99. package/lib/models/protocols/pure/v1/transformation/pureGraph/to/V1_ProtocolToMetaModelGraphThirdPassBuilder.js +2 -2
  100. package/lib/models/protocols/pure/v1/transformation/pureGraph/to/V1_ProtocolToMetaModelGraphThirdPassBuilder.js.map +1 -1
  101. package/lib/models/protocols/pure/v1/transformation/pureGraph/to/V1_ProtocolToMetaModelPropertyMappingBuilder.d.ts +1 -1
  102. package/lib/models/protocols/pure/v1/transformation/pureGraph/to/V1_ProtocolToMetaModelPropertyMappingBuilder.d.ts.map +1 -1
  103. package/lib/models/protocols/pure/v1/transformation/pureGraph/to/V1_ProtocolToMetaModelPropertyMappingBuilder.js +14 -8
  104. package/lib/models/protocols/pure/v1/transformation/pureGraph/to/V1_ProtocolToMetaModelPropertyMappingBuilder.js.map +1 -1
  105. package/lib/models/protocols/pure/v1/transformation/pureGraph/to/helpers/V1_RelationalClassMappingBuilderHelper.d.ts +1 -1
  106. package/lib/models/protocols/pure/v1/transformation/pureGraph/to/helpers/V1_RelationalClassMappingBuilderHelper.d.ts.map +1 -1
  107. package/lib/models/protocols/pure/v1/transformation/pureGraph/to/helpers/V1_RelationalClassMappingBuilderHelper.js +7 -6
  108. package/lib/models/protocols/pure/v1/transformation/pureGraph/to/helpers/V1_RelationalClassMappingBuilderHelper.js.map +1 -1
  109. package/lib/models/protocols/pure/v1/transformation/pureGraph/to/helpers/V1_RelationalConnectionBuilderHelper.d.ts.map +1 -1
  110. package/lib/models/protocols/pure/v1/transformation/pureGraph/to/helpers/V1_RelationalConnectionBuilderHelper.js +16 -12
  111. package/lib/models/protocols/pure/v1/transformation/pureGraph/to/helpers/V1_RelationalConnectionBuilderHelper.js.map +1 -1
  112. package/lib/models/protocols/pure/v1/transformation/pureGraph/to/helpers/V1_ValueSpecificationPathResolver.js +1 -1
  113. package/lib/models/protocols/pure/v1/transformation/pureGraph/to/helpers/V1_ValueSpecificationPathResolver.js.map +1 -1
  114. package/lib/models/protocols/pure/v1/transformation/pureProtocol/serializationHelpers/V1_ConnectionSerializationHelper.d.ts.map +1 -1
  115. package/lib/models/protocols/pure/v1/transformation/pureProtocol/serializationHelpers/V1_ConnectionSerializationHelper.js +24 -19
  116. package/lib/models/protocols/pure/v1/transformation/pureProtocol/serializationHelpers/V1_ConnectionSerializationHelper.js.map +1 -1
  117. package/package.json +10 -9
  118. package/src/MetaModelConst.ts +2 -2
  119. package/src/graph/BasicModel.ts +2 -2
  120. package/src/graph/DependencyManager.ts +5 -0
  121. package/src/graphManager/AbstractPureGraphManager.ts +18 -10
  122. package/src/graphManager/action/{TEMP__AbstractEngineConfig.ts → TEMPORARY__AbstractEngineConfig.ts} +1 -1
  123. package/src/graphManager/action/execution/ExecutionResult.ts +14 -0
  124. package/src/helpers/MappingHelper.ts +1 -3
  125. package/src/helpers/PureLanguageHelper.ts +86 -0
  126. package/src/index.ts +3 -0
  127. package/src/models/metamodels/pure/packageableElements/mapping/PropertyMapping.ts +2 -0
  128. package/src/models/metamodels/pure/packageableElements/mapping/SetImplementation.ts +41 -4
  129. package/src/models/metamodels/pure/packageableElements/store/relational/connection/AuthenticationStrategy.ts +16 -44
  130. package/src/models/metamodels/pure/packageableElements/store/relational/connection/DatasourceSpecification.ts +57 -0
  131. package/src/models/metamodels/pure/packageableElements/store/relational/connection/RelationalDatabaseConnection.ts +1 -0
  132. package/src/models/protocols/pure/v1/V1_PureGraphManager.ts +8 -7
  133. package/src/models/protocols/pure/v1/engine/V1_Engine.ts +13 -7
  134. package/src/models/protocols/pure/v1/engine/V1_EngineServerClient.ts +9 -3
  135. package/src/models/protocols/pure/v1/engine/V1_ExecutionHelper.ts +4 -0
  136. package/src/models/protocols/pure/v1/engine/execution/V1_ExecutionResult.ts +14 -1
  137. package/src/models/protocols/pure/v1/model/packageableElements/store/relational/connection/V1_AuthenticationStrategy.ts +12 -25
  138. package/src/models/protocols/pure/v1/model/packageableElements/store/relational/connection/V1_DatasourceSpecification.ts +21 -0
  139. package/src/models/protocols/pure/v1/model/packageableElements/store/relational/connection/V1_RelationalDatabaseConnection.ts +1 -0
  140. package/src/models/protocols/pure/v1/transformation/pureGraph/from/V1_ConnectionTransformer.ts +21 -11
  141. package/src/models/protocols/pure/v1/transformation/pureGraph/from/V1_MappingTransformer.ts +13 -1
  142. package/src/models/protocols/pure/v1/transformation/pureGraph/to/V1_ProtocolToMetaModelGraphSecondPassBuilder.ts +3 -3
  143. package/src/models/protocols/pure/v1/transformation/pureGraph/to/V1_ProtocolToMetaModelGraphThirdPassBuilder.ts +2 -2
  144. package/src/models/protocols/pure/v1/transformation/pureGraph/to/V1_ProtocolToMetaModelPropertyMappingBuilder.ts +41 -17
  145. package/src/models/protocols/pure/v1/transformation/pureGraph/to/helpers/V1_RelationalClassMappingBuilderHelper.ts +9 -9
  146. package/src/models/protocols/pure/v1/transformation/pureGraph/to/helpers/V1_RelationalConnectionBuilderHelper.ts +31 -19
  147. package/src/models/protocols/pure/v1/transformation/pureGraph/to/helpers/V1_ValueSpecificationPathResolver.ts +1 -1
  148. package/src/models/protocols/pure/v1/transformation/pureProtocol/serializationHelpers/V1_ConnectionSerializationHelper.ts +29 -38
  149. package/tsconfig.json +3 -1
  150. package/lib/graphManager/action/TEMP__AbstractEngineConfig.d.ts.map +0 -1
  151. package/lib/graphManager/action/TEMP__AbstractEngineConfig.js.map +0 -1
@@ -0,0 +1,86 @@
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 { PRIMITIVE_TYPE } from '../MetaModelConst';
18
+ import type { ConcreteFunctionDefinition } from '../models/metamodels/pure/packageableElements/domain/ConcreteFunctionDefinition';
19
+ import type { Type } from '../models/metamodels/pure/packageableElements/domain/Type';
20
+ import { PrimitiveType } from '../models/metamodels/pure/packageableElements/domain/PrimitiveType';
21
+ import { Enumeration } from '../models/metamodels/pure/packageableElements/domain/Enumeration';
22
+ import format from 'date-fns/format';
23
+
24
+ export const generateDefaultParameterValueForType = (
25
+ type: Type | undefined,
26
+ index: number,
27
+ ): string | number | boolean => {
28
+ if (!type) {
29
+ return `param${index}`;
30
+ }
31
+ if (type instanceof Enumeration) {
32
+ return type.values.length !== 0
33
+ ? `${type.path}.${type.values[0]?.name}`
34
+ : `param${index}`;
35
+ } else if (type instanceof PrimitiveType) {
36
+ switch (type.name) {
37
+ case PRIMITIVE_TYPE.BOOLEAN:
38
+ return true;
39
+ case PRIMITIVE_TYPE.FLOAT:
40
+ case PRIMITIVE_TYPE.DECIMAL:
41
+ return 0.0;
42
+ case PRIMITIVE_TYPE.NUMBER:
43
+ case PRIMITIVE_TYPE.INTEGER:
44
+ return 0;
45
+ case PRIMITIVE_TYPE.DATE:
46
+ case PRIMITIVE_TYPE.STRICTDATE:
47
+ return `%${format(new Date(), 'yyyy-MM-dd')}`;
48
+ case PRIMITIVE_TYPE.DATETIME:
49
+ return `%${format(new Date(), 'yyyy-MM-dd')}T00:00:00`;
50
+ case PRIMITIVE_TYPE.STRICTTIME:
51
+ return `%00:00:00`;
52
+ case PRIMITIVE_TYPE.STRING:
53
+ return "''";
54
+ default:
55
+ return `param${index}`;
56
+ }
57
+ }
58
+ // Other non-primitive types, e.g. Class
59
+ return `param${index}`;
60
+ };
61
+
62
+ export const generateFunctionCallString = (
63
+ element: ConcreteFunctionDefinition,
64
+ ): string => {
65
+ let lambdaString = '';
66
+ if (element.parameters.length > 0) {
67
+ for (let i = 0; i < element.parameters.length; i++) {
68
+ const paramType = element.parameters[i]?.type.value;
69
+ const separator = i !== element.parameters.length - 1 ? ', ' : '';
70
+ lambdaString =
71
+ lambdaString +
72
+ generateDefaultParameterValueForType(paramType, i) +
73
+ separator;
74
+ }
75
+ }
76
+ return `${element.path}(${lambdaString})`;
77
+ };
78
+
79
+ export const generateFunctionSignature = (
80
+ element: ConcreteFunctionDefinition,
81
+ fullPath: boolean,
82
+ ): string =>
83
+ `${fullPath ? element.path : element.name}(${element.parameters
84
+ .map((p) => `${p.name}: ${p.type.value.name}[${p.multiplicity.str}]`)
85
+ .join(', ')})` +
86
+ `: ${element.returnType.value.name}[${element.returnMultiplicity.str}]`;
package/src/index.ts CHANGED
@@ -149,6 +149,7 @@ export * from './helpers/MappingResolutionHelper';
149
149
  export * from './helpers/ValidationHelper';
150
150
  export * from './helpers/Stubable'; // TODO: to be removed
151
151
  export * from './helpers/DomainHelper';
152
+ export * from './helpers/PureLanguageHelper';
152
153
 
153
154
  // --------------------------------------------- GRAPH --------------------------------------------------
154
155
 
@@ -181,6 +182,8 @@ export * from './graphManager/DSLGenerationSpecification_PureGraphManagerPlugin_
181
182
  export {
182
183
  ExecutionResult,
183
184
  TdsExecutionResult,
185
+ RawExecutionResult,
186
+ EXECUTION_SERIALIZATION_FORMAT,
184
187
  } from './graphManager/action/execution/ExecutionResult';
185
188
  export * from './graphManager/action/execution/ExecutionResultHelper';
186
189
  export * from './graphManager/PureGraphManagerPlugin';
@@ -67,9 +67,11 @@ export abstract class PropertyMapping implements Hashable, Stubable {
67
67
  owner: PropertyMappingsImplementation; // the immediate parent instance set implementation that holds the property mappings
68
68
  // NOTE: in case the holder of this property mapping is an embedded property mapping, that embedded property mapping is considered the source
69
69
  // otherwise, it is always the top/root `InstanceSetImplementation` that is considered the source implementation
70
+ // TODO: change this to use `SetImplemenetationReference`
70
71
  sourceSetImplementation: SetImplementation;
71
72
  // NOTE: in Pure, we actually only store `targetId` and `sourceId` instead of the reference
72
73
  // but for convenience and graph completeness validation purpose we will resolve to the actual set implementations here
74
+ // TODO: change this to use `OptionalSetImplemenetationReference`
73
75
  targetSetImplementation?: SetImplementation | undefined;
74
76
  localMappingProperty?: LocalMappingPropertyInfo | undefined;
75
77
  // store?: Store | undefined;
@@ -18,9 +18,12 @@ import { observable, action, computed, makeObservable } from 'mobx';
18
18
  import { hashArray, type Hashable } from '@finos/legend-shared';
19
19
  import { fromElementPathToMappingElementId } from '../../../../../MetaModelUtils';
20
20
  import { CORE_HASH_STRUCTURE } from '../../../../../MetaModelConst';
21
- import type { PackageableElementReference } from '../PackageableElementReference';
21
+ import {
22
+ PackageableElementExplicitReference,
23
+ type PackageableElementReference,
24
+ } from '../PackageableElementReference';
22
25
  import type { PropertyOwnerImplementation } from './PropertyOwnerImplementation';
23
- import type { Class } from '../domain/Class';
26
+ import { Class } from '../domain/Class';
24
27
  import type { Mapping, MappingElementLabel } from './Mapping';
25
28
  import type { Stubable } from '../../../../../helpers/Stubable';
26
29
  import type { OperationSetImplementation } from './OperationSetImplementation';
@@ -29,8 +32,14 @@ import type { FlatDataInstanceSetImplementation } from '../store/flatData/mappin
29
32
  import type { EmbeddedFlatDataPropertyMapping } from '../store/flatData/mapping/EmbeddedFlatDataPropertyMapping';
30
33
  import type { RelationalInstanceSetImplementation } from '../store/relational/mapping/RelationalInstanceSetImplementation';
31
34
  import type { RootRelationalInstanceSetImplementation } from '../store/relational/mapping/RootRelationalInstanceSetImplementation';
32
- import type { InferableMappingElementIdValue } from './InferableMappingElementId';
33
- import type { InferableMappingElementRoot } from './InferableMappingElementRoot';
35
+ import {
36
+ InferableMappingElementIdExplicitValue,
37
+ type InferableMappingElementIdValue,
38
+ } from './InferableMappingElementId';
39
+ import {
40
+ InferableMappingElementRootExplicitValue,
41
+ type InferableMappingElementRoot,
42
+ } from './InferableMappingElementRoot';
34
43
  import type { AggregationAwareSetImplementation } from './aggregationAware/AggregationAwareSetImplementation';
35
44
  import type { InstanceSetImplementation } from './InstanceSetImplementation';
36
45
 
@@ -58,6 +67,9 @@ export interface SetImplementationVisitor<T> {
58
67
  visit_AggregationAwareSetImplementation(
59
68
  setImplementation: AggregationAwareSetImplementation,
60
69
  ): T;
70
+ visit_TEMPORARY__UnresolvedSetImplementation(
71
+ setImplementation: TEMPORARY__UnresolvedSetImplementation,
72
+ ): T;
61
73
  }
62
74
 
63
75
  export abstract class SetImplementation
@@ -143,3 +155,28 @@ export enum SET_IMPLEMENTATION_TYPE {
143
155
  EMBEDDED_RELATIONAL = 'embeddedRelational',
144
156
  AGGREGATION_AWARE = 'aggregationAware',
145
157
  }
158
+
159
+ /* @MARKER: RELAXED GRAPH CHECK - See https://github.com/finos/legend-studio/issues/880 */
160
+ /**
161
+ * When set implementation cannot be resolved by ID,
162
+ * we try to avoid failing graph building for now
163
+ * instead, we will leave this loose end unresolved.
164
+ *
165
+ * NOTE: this is just a temporary solutions until we make this a hard-fail post migration.
166
+ *
167
+ * See https://github.com/finos/legend-studio/issues/880
168
+ */
169
+ export class TEMPORARY__UnresolvedSetImplementation extends SetImplementation {
170
+ constructor(id: string, parent: Mapping) {
171
+ super(
172
+ InferableMappingElementIdExplicitValue.create(id, ''),
173
+ parent,
174
+ PackageableElementExplicitReference.create(new Class('')),
175
+ InferableMappingElementRootExplicitValue.create(false),
176
+ );
177
+ }
178
+
179
+ accept_SetImplementationVisitor<T>(visitor: SetImplementationVisitor<T>): T {
180
+ return visitor.visit_TEMPORARY__UnresolvedSetImplementation(this);
181
+ }
182
+ }
@@ -67,21 +67,32 @@ export class DefaultH2AuthenticationStrategy
67
67
  }
68
68
  }
69
69
 
70
- export class TestDatabaseAuthenticationStrategy
71
- extends DefaultH2AuthenticationStrategy
70
+ export class ApiTokenAuthenticationStrategy
71
+ extends AuthenticationStrategy
72
72
  implements Hashable
73
73
  {
74
- constructor() {
74
+ apiToken: string;
75
+
76
+ constructor(apiToken: string) {
75
77
  super();
76
78
 
77
79
  makeObservable(this, {
80
+ apiToken: observable,
81
+ setApiToken: action,
78
82
  hashCode: computed,
79
83
  });
84
+
85
+ this.apiToken = apiToken;
80
86
  }
81
87
 
82
- override get hashCode(): string {
88
+ setApiToken(val: string): void {
89
+ this.apiToken = val;
90
+ }
91
+
92
+ get hashCode(): string {
83
93
  return hashArray([
84
- CORE_HASH_STRUCTURE.TEST_DATABASE_AUTHENTICATION_STRATEGY,
94
+ CORE_HASH_STRUCTURE.API_TOKEN_AUTHENTICATION_STRATEGY,
95
+ this.apiToken,
85
96
  ]);
86
97
  }
87
98
  }
@@ -176,45 +187,6 @@ export class SnowflakePublicAuthenticationStrategy
176
187
  }
177
188
  }
178
189
 
179
- export class UserPasswordAuthenticationStrategy
180
- extends AuthenticationStrategy
181
- implements Hashable
182
- {
183
- userName: string;
184
- passwordVaultReference: string;
185
-
186
- constructor(userName: string, passwordVaultReference: string) {
187
- super();
188
-
189
- makeObservable(this, {
190
- userName: observable,
191
- passwordVaultReference: observable,
192
- setUserName: action,
193
- setPasswordVaultReference: action,
194
- hashCode: computed,
195
- });
196
-
197
- this.userName = userName;
198
- this.passwordVaultReference = passwordVaultReference;
199
- }
200
-
201
- setUserName(val: string): void {
202
- this.userName = val;
203
- }
204
-
205
- setPasswordVaultReference(val: string): void {
206
- this.passwordVaultReference = val;
207
- }
208
-
209
- get hashCode(): string {
210
- return hashArray([
211
- CORE_HASH_STRUCTURE.USER_PASSWORD_AUTHENTICATION_STRATEGY,
212
- this.userName,
213
- this.passwordVaultReference,
214
- ]);
215
- }
216
- }
217
-
218
190
  export class GCPApplicationDefaultCredentialsAuthenticationStrategy
219
191
  extends AuthenticationStrategy
220
192
  implements Hashable
@@ -71,6 +71,63 @@ export class StaticDatasourceSpecification
71
71
  }
72
72
  }
73
73
 
74
+ export class DatabricksDatasourceSpecification
75
+ extends DatasourceSpecification
76
+ implements Hashable
77
+ {
78
+ hostname: string;
79
+ port: string;
80
+ protocol: string;
81
+ httpPath: string;
82
+
83
+ constructor(
84
+ hostname: string,
85
+ port: string,
86
+ protocol: string,
87
+ httpPath: string,
88
+ ) {
89
+ super();
90
+
91
+ makeObservable(this, {
92
+ hostname: observable,
93
+ port: observable,
94
+ protocol: observable,
95
+ httpPath: observable,
96
+ hashCode: computed,
97
+ });
98
+ this.hostname = hostname;
99
+ this.port = port;
100
+ this.protocol = protocol;
101
+ this.httpPath = httpPath;
102
+ }
103
+
104
+ get hashCode(): string {
105
+ return hashArray([
106
+ CORE_HASH_STRUCTURE.DATABRICKS_DATASOURCE_SPECIFICATION,
107
+ this.hostname,
108
+ this.port,
109
+ this.protocol,
110
+ this.httpPath,
111
+ ]);
112
+ }
113
+
114
+ setHostName(val: string): void {
115
+ this.hostname = val;
116
+ }
117
+
118
+ setPort(val: string): void {
119
+ this.port = val;
120
+ }
121
+
122
+ setProtocol(val: string): void {
123
+ this.protocol = val;
124
+ }
125
+
126
+ setHttpPath(val: string): void {
127
+ this.httpPath = val;
128
+ }
129
+ }
130
+
74
131
  export class EmbeddedH2DatasourceSpecification
75
132
  extends DatasourceSpecification
76
133
  implements Hashable
@@ -38,6 +38,7 @@ export enum DatabaseType {
38
38
  SqlServer = 'SqlServer',
39
39
  Hive = 'Hive',
40
40
  Snowflake = 'Snowflake',
41
+ Databricks = 'Databricks',
41
42
  Presto = 'Presto',
42
43
  Redshift = 'Redshift',
43
44
  BigQuery = 'BigQuery',
@@ -38,11 +38,12 @@ import {
38
38
  assertErrorThrown,
39
39
  promisify,
40
40
  } from '@finos/legend-shared';
41
- import type { TEMP__AbstractEngineConfig } from '../../../../graphManager/action/TEMP__AbstractEngineConfig';
41
+ import type { TEMPORARY__AbstractEngineConfig } from '../../../../graphManager/action/TEMPORARY__AbstractEngineConfig';
42
42
  import {
43
43
  AbstractPureGraphManager,
44
- type TEMP__EngineSetupConfig,
44
+ type TEMPORARY__EngineSetupConfig,
45
45
  type GraphBuilderOptions,
46
+ type ExecutionOptions,
46
47
  } from '../../../../graphManager/AbstractPureGraphManager';
47
48
  import type { Mapping } from '../../../metamodels/pure/packageableElements/mapping/Mapping';
48
49
  import type { Runtime } from '../../../metamodels/pure/packageableElements/runtime/Runtime';
@@ -406,12 +407,12 @@ export class V1_PureGraphManager extends AbstractPureGraphManager {
406
407
  );
407
408
  }
408
409
 
409
- TEMP__getEngineConfig(): TEMP__AbstractEngineConfig {
410
+ TEMPORARY__getEngineConfig(): TEMPORARY__AbstractEngineConfig {
410
411
  return this.engine.config;
411
412
  }
412
413
 
413
414
  *initialize(
414
- config: TEMP__EngineSetupConfig,
415
+ config: TEMPORARY__EngineSetupConfig,
415
416
  options?: {
416
417
  tracerService?: TracerService | undefined;
417
418
  },
@@ -1033,7 +1034,7 @@ export class V1_PureGraphManager extends AbstractPureGraphManager {
1033
1034
  * perserve the element path both resolved and unresolved
1034
1035
  */
1035
1036
  if (!options?.TEMPORARY__keepSectionIndex) {
1036
- graph.TEMP__deleteOwnSectionIndex();
1037
+ graph.TEMPORARY__deleteOwnSectionIndex();
1037
1038
  }
1038
1039
  }
1039
1040
 
@@ -1852,7 +1853,7 @@ export class V1_PureGraphManager extends AbstractPureGraphManager {
1852
1853
  lambda: RawLambda,
1853
1854
  runtime: Runtime,
1854
1855
  clientVersion: string,
1855
- useLosslessParse: boolean,
1856
+ options?: ExecutionOptions,
1856
1857
  ): Promise<ExecutionResult> {
1857
1858
  return V1_buildExecutionResult(
1858
1859
  await this.engine.executeMapping(
@@ -1863,7 +1864,7 @@ export class V1_PureGraphManager extends AbstractPureGraphManager {
1863
1864
  runtime,
1864
1865
  clientVersion,
1865
1866
  ),
1866
- useLosslessParse,
1867
+ options,
1867
1868
  ),
1868
1869
  );
1869
1870
  }
@@ -25,6 +25,7 @@ import {
25
25
  mergeObjects,
26
26
  HttpStatus,
27
27
  NetworkClientError,
28
+ returnUndefOnError,
28
29
  } from '@finos/legend-shared';
29
30
  import { GRAPH_MANAGER_LOG_EVENT } from '../../../../../graphManager/GraphManagerLogEvent';
30
31
  import {
@@ -36,7 +37,7 @@ import {
36
37
  GenerationMode,
37
38
  type GenerationConfigurationDescription,
38
39
  } from '../../../../../graphManager/action/generation/GenerationConfigurationDescription';
39
- import { TEMP__AbstractEngineConfig } from '../../../../../graphManager/action/TEMP__AbstractEngineConfig';
40
+ import { TEMPORARY__AbstractEngineConfig } from '../../../../../graphManager/action/TEMPORARY__AbstractEngineConfig';
40
41
  import { V1_EngineServerClient } from './V1_EngineServerClient';
41
42
  import type { V1_PureModelContextData } from '../model/context/V1_PureModelContextData';
42
43
  import type { V1_LambdaReturnTypeResult } from '../engine/compilation/V1_LambdaReturnTypeResult';
@@ -90,8 +91,9 @@ import { serialize } from 'serializr';
90
91
  import { V1_ExecutionError } from './execution/V1_ExecutionError';
91
92
  import { V1_PureModelContextText } from '../model/context/V1_PureModelContextText';
92
93
  import { V1_QuerySearchSpecification } from './query/V1_QuerySearchSpecification';
94
+ import type { ExecutionOptions } from '../../../../../graphManager/AbstractPureGraphManager';
93
95
 
94
- class V1_EngineConfig extends TEMP__AbstractEngineConfig {
96
+ class V1_EngineConfig extends TEMPORARY__AbstractEngineConfig {
95
97
  private engine: V1_Engine;
96
98
 
97
99
  override setEnv(val: string | undefined): void {
@@ -403,20 +405,24 @@ export class V1_Engine {
403
405
 
404
406
  async executeMapping(
405
407
  input: V1_ExecuteInput,
406
- useLosslessParse: boolean,
408
+ options?: ExecutionOptions,
407
409
  ): Promise<V1_ExecutionResult> {
408
410
  try {
409
411
  const executionResultInText = await (
410
412
  (await this.engineServerClient.execute(
411
413
  V1_ExecuteInput.serialization.toJson(input),
412
- true,
414
+ {
415
+ returnResultAsText: true,
416
+ serializationFormat: options?.serializationFormat,
417
+ },
413
418
  )) as Response
414
419
  ).text();
415
- return V1_serializeExecutionResult(
416
- useLosslessParse
420
+ const rawExecutionResult = (returnUndefOnError(() =>
421
+ options?.useLosslessParse
417
422
  ? losslessParse(executionResultInText)
418
423
  : JSON.parse(executionResultInText),
419
- );
424
+ ) ?? executionResultInText) as PlainObject<V1_ExecutionResult> | string;
425
+ return V1_serializeExecutionResult(rawExecutionResult);
420
426
  } catch (error) {
421
427
  assertErrorThrown(error);
422
428
  if (error instanceof NetworkClientError) {
@@ -47,6 +47,7 @@ import type { V1_LightQuery, V1_Query } from './query/V1_Query';
47
47
  import type { V1_ServiceStorage } from './service/V1_ServiceStorage';
48
48
  import type { GenerationMode } from '../../../../../graphManager/action/generation/GenerationConfigurationDescription';
49
49
  import type { V1_QuerySearchSpecification } from './query/V1_QuerySearchSpecification';
50
+ import type { EXECUTION_SERIALIZATION_FORMAT } from '../../../../../graphManager/action/execution/ExecutionResult';
50
51
 
51
52
  enum CORE_ENGINE_TRACER_SPAN {
52
53
  GRAMMAR_TO_JSON = 'transform Pure code to protocol',
@@ -269,7 +270,10 @@ export class V1_EngineServerClient extends AbstractServerClient {
269
270
  _execution = (): string => `${this._pure()}/execution`;
270
271
  execute = (
271
272
  input: PlainObject<V1_ExecuteInput>,
272
- returnResultAsText?: boolean,
273
+ options?: {
274
+ returnResultAsText?: boolean;
275
+ serializationFormat?: EXECUTION_SERIALIZATION_FORMAT | undefined;
276
+ },
273
277
  ): Promise<PlainObject<V1_ExecutionResult> | Response> =>
274
278
  this.postWithTracing(
275
279
  this.getTraceData(CORE_ENGINE_TRACER_SPAN.EXECUTE),
@@ -277,9 +281,11 @@ export class V1_EngineServerClient extends AbstractServerClient {
277
281
  input,
278
282
  {},
279
283
  undefined,
280
- undefined,
284
+ {
285
+ serializationFormat: options?.serializationFormat,
286
+ },
281
287
  { enableCompression: true },
282
- { skipProcessing: Boolean(returnResultAsText) },
288
+ { skipProcessing: Boolean(options?.returnResultAsText) },
283
289
  );
284
290
 
285
291
  generatePlan = (
@@ -27,6 +27,7 @@ import {
27
27
  TdsExecutionResult,
28
28
  TdsBuilder,
29
29
  TDSColumn,
30
+ RawExecutionResult,
30
31
  } from '../../../../../graphManager/action/execution/ExecutionResult';
31
32
  import {
32
33
  type V1_ExecutionResult,
@@ -35,6 +36,7 @@ import {
35
36
  V1_JsonExecutionResult,
36
37
  V1_INTERNAL__UnknownExecutionResult,
37
38
  V1_TdsExecutionResult,
39
+ V1_RawExecutionResult,
38
40
  } from './execution/V1_ExecutionResult';
39
41
 
40
42
  const buildJSONExecutionResult = (
@@ -113,6 +115,8 @@ export const V1_buildExecutionResult = (
113
115
  return buildTDSExecutionResult(protocol);
114
116
  } else if (protocol instanceof V1_JsonExecutionResult) {
115
117
  return buildJSONExecutionResult(protocol);
118
+ } else if (protocol instanceof V1_RawExecutionResult) {
119
+ return new RawExecutionResult(protocol.value);
116
120
  } else if (protocol instanceof V1_INTERNAL__UnknownExecutionResult) {
117
121
  return new INTERNAL__UnknownExecutionResult(protocol.content);
118
122
  }
@@ -19,6 +19,7 @@ import {
19
19
  type PlainObject,
20
20
  SerializationFactory,
21
21
  usingModelSchema,
22
+ isString,
22
23
  } from '@finos/legend-shared';
23
24
  import { BuilderType } from '../../../../../../graphManager/action/execution/ExecutionResult';
24
25
 
@@ -101,6 +102,15 @@ export class V1_ClassExecutionResult extends V1_ExecutionResult {
101
102
  );
102
103
  }
103
104
 
105
+ export class V1_RawExecutionResult extends V1_ExecutionResult {
106
+ value: string;
107
+
108
+ constructor(value: string) {
109
+ super();
110
+ this.value = value;
111
+ }
112
+ }
113
+
104
114
  export class V1_INTERNAL__UnknownExecutionResult extends V1_ExecutionResult {
105
115
  content: object;
106
116
 
@@ -111,8 +121,11 @@ export class V1_INTERNAL__UnknownExecutionResult extends V1_ExecutionResult {
111
121
  }
112
122
 
113
123
  export const V1_serializeExecutionResult = (
114
- value: PlainObject<V1_ExecutionResult>,
124
+ value: PlainObject<V1_ExecutionResult> | string,
115
125
  ): V1_ExecutionResult => {
126
+ if (isString(value)) {
127
+ return new V1_RawExecutionResult(value);
128
+ }
116
129
  switch ((value.builder as PlainObject<V1_ResultBuilder>)._type) {
117
130
  case BuilderType.CLASS_BUILDER:
118
131
  return V1_ClassExecutionResult.serialization.fromJson(value);
@@ -45,17 +45,6 @@ export class V1_DefaultH2AuthenticationStrategy
45
45
  }
46
46
  }
47
47
 
48
- export class V1_TestDatabaseAuthenticationStrategy
49
- extends V1_DefaultH2AuthenticationStrategy
50
- implements Hashable
51
- {
52
- override get hashCode(): string {
53
- return hashArray([
54
- CORE_HASH_STRUCTURE.TEST_DATABASE_AUTHENTICATION_STRATEGY,
55
- ]);
56
- }
57
- }
58
-
59
48
  export class V1_OAuthAuthenticationStrategy
60
49
  extends V1_AuthenticationStrategy
61
50
  implements Hashable
@@ -72,36 +61,34 @@ export class V1_OAuthAuthenticationStrategy
72
61
  }
73
62
  }
74
63
 
75
- export class V1_SnowflakePublicAuthenticationStrategy
64
+ export class V1_ApiTokenAuthenticationStrategy
76
65
  extends V1_AuthenticationStrategy
77
66
  implements Hashable
78
67
  {
79
- privateKeyVaultReference!: string;
80
- passPhraseVaultReference!: string;
81
- publicUserName!: string;
68
+ apiToken!: string;
82
69
 
83
70
  get hashCode(): string {
84
71
  return hashArray([
85
- CORE_HASH_STRUCTURE.SNOWFLAKE_PUBLIC_AUTHENTICATION_STRATEGY,
86
- this.privateKeyVaultReference,
87
- this.passPhraseVaultReference,
88
- this.publicUserName,
72
+ CORE_HASH_STRUCTURE.API_TOKEN_AUTHENTICATION_STRATEGY,
73
+ this.apiToken,
89
74
  ]);
90
75
  }
91
76
  }
92
77
 
93
- export class V1_UserPasswordAuthenticationStrategy
78
+ export class V1_SnowflakePublicAuthenticationStrategy
94
79
  extends V1_AuthenticationStrategy
95
80
  implements Hashable
96
81
  {
97
- userName!: string;
98
- passwordVaultReference!: string;
82
+ privateKeyVaultReference!: string;
83
+ passPhraseVaultReference!: string;
84
+ publicUserName!: string;
99
85
 
100
86
  get hashCode(): string {
101
87
  return hashArray([
102
- CORE_HASH_STRUCTURE.USER_PASSWORD_AUTHENTICATION_STRATEGY,
103
- this.userName,
104
- this.passwordVaultReference,
88
+ CORE_HASH_STRUCTURE.SNOWFLAKE_PUBLIC_AUTHENTICATION_STRATEGY,
89
+ this.privateKeyVaultReference,
90
+ this.passPhraseVaultReference,
91
+ this.publicUserName,
105
92
  ]);
106
93
  }
107
94
  }
@@ -24,6 +24,7 @@ export enum V1_DatasourceSpecificationType {
24
24
  BIGQUERY = 'bigQuery',
25
25
  H2_LOCAL = 'h2Local',
26
26
  REDSHIFT = 'redshift',
27
+ DATABRICKS = 'databricks',
27
28
  }
28
29
 
29
30
  export abstract class V1_DatasourceSpecification implements Hashable {
@@ -68,6 +69,26 @@ export class V1_EmbeddedH2DatasourceSpecification
68
69
  }
69
70
  }
70
71
 
72
+ export class V1_DatabricksDatasourceSpecification
73
+ extends V1_DatasourceSpecification
74
+ implements Hashable
75
+ {
76
+ hostname!: string;
77
+ port!: string;
78
+ protocol!: string;
79
+ httpPath!: string;
80
+
81
+ get hashCode(): string {
82
+ return hashArray([
83
+ CORE_HASH_STRUCTURE.DATABRICKS_DATASOURCE_SPECIFICATION,
84
+ this.hostname,
85
+ this.port,
86
+ this.protocol,
87
+ this.httpPath,
88
+ ]);
89
+ }
90
+ }
91
+
71
92
  export class V1_SnowflakeDatasourceSpecification
72
93
  extends V1_DatasourceSpecification
73
94
  implements Hashable
@@ -36,6 +36,7 @@ export enum V1_DatabaseType {
36
36
  Hive = 'Hive',
37
37
  Snowflake = 'Snowflake',
38
38
  BigQuery = 'BigQuery',
39
+ Databricks = 'Databricks',
39
40
  Presto = 'Presto',
40
41
  Redshift = 'Redshift',
41
42
  }