@finos/legend-graph 1.1.2 → 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 (98) hide show
  1. package/CHANGELOG.md +14 -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 +4 -4
  19. package/lib/graphManager/AbstractPureGraphManager.d.ts.map +1 -1
  20. package/lib/graphManager/action/{TEMP__AbstractEngineConfig.d.ts → TEMPORARY__AbstractEngineConfig.d.ts} +2 -2
  21. package/lib/graphManager/action/TEMPORARY__AbstractEngineConfig.d.ts.map +1 -0
  22. package/lib/graphManager/action/{TEMP__AbstractEngineConfig.js → TEMPORARY__AbstractEngineConfig.js} +2 -2
  23. package/lib/graphManager/action/TEMPORARY__AbstractEngineConfig.js.map +1 -0
  24. package/lib/helpers/MappingHelper.d.ts.map +1 -1
  25. package/lib/helpers/MappingHelper.js +1 -4
  26. package/lib/helpers/MappingHelper.js.map +1 -1
  27. package/lib/helpers/PureLanguageHelper.d.ts +21 -0
  28. package/lib/helpers/PureLanguageHelper.d.ts.map +1 -0
  29. package/lib/helpers/PureLanguageHelper.js +73 -0
  30. package/lib/helpers/PureLanguageHelper.js.map +1 -0
  31. package/lib/index.d.ts +1 -0
  32. package/lib/index.d.ts.map +1 -1
  33. package/lib/index.js +1 -0
  34. package/lib/index.js.map +1 -1
  35. package/lib/models/metamodels/pure/packageableElements/store/relational/connection/AuthenticationStrategy.d.ts +4 -10
  36. package/lib/models/metamodels/pure/packageableElements/store/relational/connection/AuthenticationStrategy.d.ts.map +1 -1
  37. package/lib/models/metamodels/pure/packageableElements/store/relational/connection/AuthenticationStrategy.js +11 -32
  38. package/lib/models/metamodels/pure/packageableElements/store/relational/connection/AuthenticationStrategy.js.map +1 -1
  39. package/lib/models/metamodels/pure/packageableElements/store/relational/connection/DatasourceSpecification.d.ts +12 -0
  40. package/lib/models/metamodels/pure/packageableElements/store/relational/connection/DatasourceSpecification.d.ts.map +1 -1
  41. package/lib/models/metamodels/pure/packageableElements/store/relational/connection/DatasourceSpecification.js +41 -0
  42. package/lib/models/metamodels/pure/packageableElements/store/relational/connection/DatasourceSpecification.js.map +1 -1
  43. package/lib/models/metamodels/pure/packageableElements/store/relational/connection/RelationalDatabaseConnection.d.ts +1 -0
  44. package/lib/models/metamodels/pure/packageableElements/store/relational/connection/RelationalDatabaseConnection.d.ts.map +1 -1
  45. package/lib/models/metamodels/pure/packageableElements/store/relational/connection/RelationalDatabaseConnection.js +1 -0
  46. package/lib/models/metamodels/pure/packageableElements/store/relational/connection/RelationalDatabaseConnection.js.map +1 -1
  47. package/lib/models/protocols/pure/v1/V1_PureGraphManager.d.ts +4 -4
  48. package/lib/models/protocols/pure/v1/V1_PureGraphManager.d.ts.map +1 -1
  49. package/lib/models/protocols/pure/v1/V1_PureGraphManager.js +2 -2
  50. package/lib/models/protocols/pure/v1/V1_PureGraphManager.js.map +1 -1
  51. package/lib/models/protocols/pure/v1/engine/V1_Engine.d.ts +2 -2
  52. package/lib/models/protocols/pure/v1/engine/V1_Engine.d.ts.map +1 -1
  53. package/lib/models/protocols/pure/v1/engine/V1_Engine.js +2 -2
  54. package/lib/models/protocols/pure/v1/engine/V1_Engine.js.map +1 -1
  55. package/lib/models/protocols/pure/v1/model/packageableElements/store/relational/connection/V1_AuthenticationStrategy.d.ts +4 -8
  56. package/lib/models/protocols/pure/v1/model/packageableElements/store/relational/connection/V1_AuthenticationStrategy.d.ts.map +1 -1
  57. package/lib/models/protocols/pure/v1/model/packageableElements/store/relational/connection/V1_AuthenticationStrategy.js +9 -18
  58. package/lib/models/protocols/pure/v1/model/packageableElements/store/relational/connection/V1_AuthenticationStrategy.js.map +1 -1
  59. package/lib/models/protocols/pure/v1/model/packageableElements/store/relational/connection/V1_DatasourceSpecification.d.ts +9 -1
  60. package/lib/models/protocols/pure/v1/model/packageableElements/store/relational/connection/V1_DatasourceSpecification.d.ts.map +1 -1
  61. package/lib/models/protocols/pure/v1/model/packageableElements/store/relational/connection/V1_DatasourceSpecification.js +16 -0
  62. package/lib/models/protocols/pure/v1/model/packageableElements/store/relational/connection/V1_DatasourceSpecification.js.map +1 -1
  63. package/lib/models/protocols/pure/v1/model/packageableElements/store/relational/connection/V1_RelationalDatabaseConnection.d.ts +1 -0
  64. package/lib/models/protocols/pure/v1/model/packageableElements/store/relational/connection/V1_RelationalDatabaseConnection.d.ts.map +1 -1
  65. package/lib/models/protocols/pure/v1/model/packageableElements/store/relational/connection/V1_RelationalDatabaseConnection.js +1 -0
  66. package/lib/models/protocols/pure/v1/model/packageableElements/store/relational/connection/V1_RelationalDatabaseConnection.js.map +1 -1
  67. package/lib/models/protocols/pure/v1/transformation/pureGraph/from/V1_ConnectionTransformer.d.ts.map +1 -1
  68. package/lib/models/protocols/pure/v1/transformation/pureGraph/from/V1_ConnectionTransformer.js +20 -13
  69. package/lib/models/protocols/pure/v1/transformation/pureGraph/from/V1_ConnectionTransformer.js.map +1 -1
  70. package/lib/models/protocols/pure/v1/transformation/pureGraph/to/helpers/V1_RelationalConnectionBuilderHelper.d.ts.map +1 -1
  71. package/lib/models/protocols/pure/v1/transformation/pureGraph/to/helpers/V1_RelationalConnectionBuilderHelper.js +16 -12
  72. package/lib/models/protocols/pure/v1/transformation/pureGraph/to/helpers/V1_RelationalConnectionBuilderHelper.js.map +1 -1
  73. package/lib/models/protocols/pure/v1/transformation/pureProtocol/serializationHelpers/V1_ConnectionSerializationHelper.d.ts.map +1 -1
  74. package/lib/models/protocols/pure/v1/transformation/pureProtocol/serializationHelpers/V1_ConnectionSerializationHelper.js +24 -19
  75. package/lib/models/protocols/pure/v1/transformation/pureProtocol/serializationHelpers/V1_ConnectionSerializationHelper.js.map +1 -1
  76. package/package.json +8 -7
  77. package/src/MetaModelConst.ts +2 -2
  78. package/src/graph/BasicModel.ts +2 -2
  79. package/src/graph/DependencyManager.ts +5 -0
  80. package/src/graphManager/AbstractPureGraphManager.ts +4 -4
  81. package/src/graphManager/action/{TEMP__AbstractEngineConfig.ts → TEMPORARY__AbstractEngineConfig.ts} +1 -1
  82. package/src/helpers/MappingHelper.ts +1 -3
  83. package/src/helpers/PureLanguageHelper.ts +86 -0
  84. package/src/index.ts +1 -0
  85. package/src/models/metamodels/pure/packageableElements/store/relational/connection/AuthenticationStrategy.ts +16 -44
  86. package/src/models/metamodels/pure/packageableElements/store/relational/connection/DatasourceSpecification.ts +57 -0
  87. package/src/models/metamodels/pure/packageableElements/store/relational/connection/RelationalDatabaseConnection.ts +1 -0
  88. package/src/models/protocols/pure/v1/V1_PureGraphManager.ts +5 -5
  89. package/src/models/protocols/pure/v1/engine/V1_Engine.ts +2 -2
  90. package/src/models/protocols/pure/v1/model/packageableElements/store/relational/connection/V1_AuthenticationStrategy.ts +12 -25
  91. package/src/models/protocols/pure/v1/model/packageableElements/store/relational/connection/V1_DatasourceSpecification.ts +21 -0
  92. package/src/models/protocols/pure/v1/model/packageableElements/store/relational/connection/V1_RelationalDatabaseConnection.ts +1 -0
  93. package/src/models/protocols/pure/v1/transformation/pureGraph/from/V1_ConnectionTransformer.ts +21 -11
  94. package/src/models/protocols/pure/v1/transformation/pureGraph/to/helpers/V1_RelationalConnectionBuilderHelper.ts +31 -19
  95. package/src/models/protocols/pure/v1/transformation/pureProtocol/serializationHelpers/V1_ConnectionSerializationHelper.ts +29 -38
  96. package/tsconfig.json +3 -1
  97. package/lib/graphManager/action/TEMP__AbstractEngineConfig.d.ts.map +0 -1
  98. 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
 
@@ -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,10 +38,10 @@ 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
46
  type ExecutionOptions,
47
47
  } from '../../../../graphManager/AbstractPureGraphManager';
@@ -407,12 +407,12 @@ export class V1_PureGraphManager extends AbstractPureGraphManager {
407
407
  );
408
408
  }
409
409
 
410
- TEMP__getEngineConfig(): TEMP__AbstractEngineConfig {
410
+ TEMPORARY__getEngineConfig(): TEMPORARY__AbstractEngineConfig {
411
411
  return this.engine.config;
412
412
  }
413
413
 
414
414
  *initialize(
415
- config: TEMP__EngineSetupConfig,
415
+ config: TEMPORARY__EngineSetupConfig,
416
416
  options?: {
417
417
  tracerService?: TracerService | undefined;
418
418
  },
@@ -1034,7 +1034,7 @@ export class V1_PureGraphManager extends AbstractPureGraphManager {
1034
1034
  * perserve the element path both resolved and unresolved
1035
1035
  */
1036
1036
  if (!options?.TEMPORARY__keepSectionIndex) {
1037
- graph.TEMP__deleteOwnSectionIndex();
1037
+ graph.TEMPORARY__deleteOwnSectionIndex();
1038
1038
  }
1039
1039
  }
1040
1040
 
@@ -37,7 +37,7 @@ import {
37
37
  GenerationMode,
38
38
  type GenerationConfigurationDescription,
39
39
  } from '../../../../../graphManager/action/generation/GenerationConfigurationDescription';
40
- import { TEMP__AbstractEngineConfig } from '../../../../../graphManager/action/TEMP__AbstractEngineConfig';
40
+ import { TEMPORARY__AbstractEngineConfig } from '../../../../../graphManager/action/TEMPORARY__AbstractEngineConfig';
41
41
  import { V1_EngineServerClient } from './V1_EngineServerClient';
42
42
  import type { V1_PureModelContextData } from '../model/context/V1_PureModelContextData';
43
43
  import type { V1_LambdaReturnTypeResult } from '../engine/compilation/V1_LambdaReturnTypeResult';
@@ -93,7 +93,7 @@ import { V1_PureModelContextText } from '../model/context/V1_PureModelContextTex
93
93
  import { V1_QuerySearchSpecification } from './query/V1_QuerySearchSpecification';
94
94
  import type { ExecutionOptions } from '../../../../../graphManager/AbstractPureGraphManager';
95
95
 
96
- class V1_EngineConfig extends TEMP__AbstractEngineConfig {
96
+ class V1_EngineConfig extends TEMPORARY__AbstractEngineConfig {
97
97
  private engine: V1_Engine;
98
98
 
99
99
  override setEnv(val: string | undefined): void {
@@ -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
  }
@@ -33,9 +33,8 @@ import {
33
33
  DefaultH2AuthenticationStrategy,
34
34
  SnowflakePublicAuthenticationStrategy,
35
35
  GCPApplicationDefaultCredentialsAuthenticationStrategy,
36
+ ApiTokenAuthenticationStrategy,
36
37
  DelegatedKerberosAuthenticationStrategy,
37
- TestDatabaseAuthenticationStrategy,
38
- UserPasswordAuthenticationStrategy,
39
38
  OAuthAuthenticationStrategy,
40
39
  UsernamePasswordAuthenticationStrategy,
41
40
  } from '../../../../../../metamodels/pure/packageableElements/store/relational/connection/AuthenticationStrategy';
@@ -44,6 +43,7 @@ import {
44
43
  LocalH2DatasourceSpecification,
45
44
  StaticDatasourceSpecification,
46
45
  EmbeddedH2DatasourceSpecification,
46
+ DatabricksDatasourceSpecification,
47
47
  SnowflakeDatasourceSpecification,
48
48
  RedshiftDatasourceSpecification,
49
49
  BigQueryDatasourceSpecification,
@@ -60,6 +60,7 @@ import {
60
60
  V1_EmbeddedH2DatasourceSpecification,
61
61
  V1_SnowflakeDatasourceSpecification,
62
62
  V1_BigQueryDatasourceSpecification,
63
+ V1_DatabricksDatasourceSpecification,
63
64
  V1_StaticDatasourceSpecification,
64
65
  V1_RedshiftDatasourceSpecification,
65
66
  } from '../../../model/packageableElements/store/relational/connection/V1_DatasourceSpecification';
@@ -67,11 +68,10 @@ import {
67
68
  type V1_AuthenticationStrategy,
68
69
  V1_DefaultH2AuthenticationStrategy,
69
70
  V1_SnowflakePublicAuthenticationStrategy,
70
- V1_UserPasswordAuthenticationStrategy,
71
71
  V1_GCPApplicationDefaultCredentialsAuthenticationStrategy,
72
72
  V1_UsernamePasswordAuthenticationStrategy,
73
+ V1_ApiTokenAuthenticationStrategy,
73
74
  V1_DelegatedKerberosAuthenticationStrategy,
74
- V1_TestDatabaseAuthenticationStrategy,
75
75
  V1_OAuthAuthenticationStrategy,
76
76
  } from '../../../model/packageableElements/store/relational/connection/V1_AuthenticationStrategy';
77
77
  import type { V1_Connection } from '../../../model/packageableElements/connection/V1_Connection';
@@ -109,6 +109,17 @@ const transformEmbeddedH2DatasourceSpecification = (
109
109
  return source;
110
110
  };
111
111
 
112
+ const transformDatabricksDatasourceSpecification = (
113
+ metamodel: DatabricksDatasourceSpecification,
114
+ ): V1_DatabricksDatasourceSpecification => {
115
+ const source = new V1_DatabricksDatasourceSpecification();
116
+ source.hostname = metamodel.hostname;
117
+ source.port = metamodel.port;
118
+ source.protocol = metamodel.protocol;
119
+ source.httpPath = metamodel.httpPath;
120
+ return source;
121
+ };
122
+
112
123
  const transformSnowflakeDatasourceSpecification = (
113
124
  metamodel: SnowflakeDatasourceSpecification,
114
125
  ): V1_SnowflakeDatasourceSpecification => {
@@ -155,6 +166,8 @@ const transformDatasourceSpecification = (
155
166
  return transformStaticDatasourceSpecification(metamodel);
156
167
  } else if (metamodel instanceof EmbeddedH2DatasourceSpecification) {
157
168
  return transformEmbeddedH2DatasourceSpecification(metamodel);
169
+ } else if (metamodel instanceof DatabricksDatasourceSpecification) {
170
+ return transformDatabricksDatasourceSpecification(metamodel);
158
171
  } else if (metamodel instanceof SnowflakeDatasourceSpecification) {
159
172
  return transformSnowflakeDatasourceSpecification(metamodel);
160
173
  } else if (metamodel instanceof BigQueryDatasourceSpecification) {
@@ -205,21 +218,18 @@ const transformAuthenticationStrategy = (
205
218
  const auth = new V1_DelegatedKerberosAuthenticationStrategy();
206
219
  auth.serverPrincipal = metamodel.serverPrincipal;
207
220
  return auth;
208
- } else if (metamodel instanceof TestDatabaseAuthenticationStrategy) {
209
- return new V1_TestDatabaseAuthenticationStrategy();
210
221
  } else if (metamodel instanceof OAuthAuthenticationStrategy) {
211
222
  return transformOAuthtAuthenticationStrategy(metamodel);
223
+ } else if (metamodel instanceof ApiTokenAuthenticationStrategy) {
224
+ const auth = new V1_ApiTokenAuthenticationStrategy();
225
+ auth.apiToken = metamodel.apiToken;
226
+ return auth;
212
227
  } else if (metamodel instanceof SnowflakePublicAuthenticationStrategy) {
213
228
  const auth = new V1_SnowflakePublicAuthenticationStrategy();
214
229
  auth.privateKeyVaultReference = metamodel.privateKeyVaultReference;
215
230
  auth.passPhraseVaultReference = metamodel.passPhraseVaultReference;
216
231
  auth.publicUserName = metamodel.publicUserName;
217
232
  return auth;
218
- } else if (metamodel instanceof UserPasswordAuthenticationStrategy) {
219
- const auth = new V1_UserPasswordAuthenticationStrategy();
220
- auth.userName = metamodel.userName;
221
- auth.passwordVaultReference = metamodel.passwordVaultReference;
222
- return auth;
223
233
  } else if (
224
234
  metamodel instanceof GCPApplicationDefaultCredentialsAuthenticationStrategy
225
235
  ) {
@@ -25,6 +25,7 @@ import {
25
25
  LocalH2DatasourceSpecification,
26
26
  StaticDatasourceSpecification,
27
27
  EmbeddedH2DatasourceSpecification,
28
+ DatabricksDatasourceSpecification,
28
29
  SnowflakeDatasourceSpecification,
29
30
  RedshiftDatasourceSpecification,
30
31
  BigQueryDatasourceSpecification,
@@ -34,11 +35,10 @@ import {
34
35
  SnowflakePublicAuthenticationStrategy,
35
36
  GCPApplicationDefaultCredentialsAuthenticationStrategy,
36
37
  UsernamePasswordAuthenticationStrategy,
38
+ ApiTokenAuthenticationStrategy,
37
39
  OAuthAuthenticationStrategy,
38
40
  DefaultH2AuthenticationStrategy,
39
41
  DelegatedKerberosAuthenticationStrategy,
40
- TestDatabaseAuthenticationStrategy,
41
- UserPasswordAuthenticationStrategy,
42
42
  } from '../../../../../../../metamodels/pure/packageableElements/store/relational/connection/AuthenticationStrategy';
43
43
  import type { V1_GraphBuilderContext } from '../../../../transformation/pureGraph/to/V1_GraphBuilderContext';
44
44
  import {
@@ -46,6 +46,7 @@ import {
46
46
  V1_LocalH2DataSourceSpecification,
47
47
  V1_StaticDatasourceSpecification,
48
48
  V1_EmbeddedH2DatasourceSpecification,
49
+ V1_DatabricksDatasourceSpecification,
49
50
  V1_SnowflakeDatasourceSpecification,
50
51
  V1_RedshiftDatasourceSpecification,
51
52
  V1_BigQueryDatasourceSpecification,
@@ -56,9 +57,8 @@ import {
56
57
  V1_GCPApplicationDefaultCredentialsAuthenticationStrategy,
57
58
  V1_OAuthAuthenticationStrategy,
58
59
  V1_DefaultH2AuthenticationStrategy,
60
+ V1_ApiTokenAuthenticationStrategy,
59
61
  V1_DelegatedKerberosAuthenticationStrategy,
60
- V1_TestDatabaseAuthenticationStrategy,
61
- V1_UserPasswordAuthenticationStrategy,
62
62
  V1_UsernamePasswordAuthenticationStrategy,
63
63
  } from '../../../../model/packageableElements/store/relational/connection/V1_AuthenticationStrategy';
64
64
  import type { StoreRelational_PureProtocolProcessorPlugin_Extension } from '../../../../../StoreRelational_PureProtocolProcessorPlugin_Extension';
@@ -105,6 +105,30 @@ export const V1_buildDatasourceSpecification = (
105
105
  protocol.autoServerMode,
106
106
  );
107
107
  return embeddedSpec;
108
+ } else if (protocol instanceof V1_DatabricksDatasourceSpecification) {
109
+ assertNonEmptyString(
110
+ protocol.hostname,
111
+ 'Databricks hostname specification is missing',
112
+ );
113
+ assertNonEmptyString(
114
+ protocol.port,
115
+ 'Databricks port specification is missing',
116
+ );
117
+ assertNonEmptyString(
118
+ protocol.protocol,
119
+ 'Databricks protocol specification is missing',
120
+ );
121
+ assertNonEmptyString(
122
+ protocol.httpPath,
123
+ 'Databricks httpPath specification is missing',
124
+ );
125
+ const databricksSpec = new DatabricksDatasourceSpecification(
126
+ protocol.hostname,
127
+ protocol.port,
128
+ protocol.protocol,
129
+ protocol.httpPath,
130
+ );
131
+ return databricksSpec;
108
132
  } else if (protocol instanceof V1_SnowflakeDatasourceSpecification) {
109
133
  assertNonEmptyString(
110
134
  protocol.accountName,
@@ -202,6 +226,9 @@ export const V1_buildAuthenticationStrategy = (
202
226
  const metamodel = new DelegatedKerberosAuthenticationStrategy();
203
227
  metamodel.serverPrincipal = protocol.serverPrincipal;
204
228
  return metamodel;
229
+ } else if (protocol instanceof V1_ApiTokenAuthenticationStrategy) {
230
+ assertNonEmptyString(protocol.apiToken, 'API token is missing or empty');
231
+ return new ApiTokenAuthenticationStrategy(protocol.apiToken);
205
232
  } else if (protocol instanceof V1_SnowflakePublicAuthenticationStrategy) {
206
233
  assertNonEmptyString(
207
234
  protocol.privateKeyVaultReference,
@@ -225,8 +252,6 @@ export const V1_buildAuthenticationStrategy = (
225
252
  V1_GCPApplicationDefaultCredentialsAuthenticationStrategy
226
253
  ) {
227
254
  return new GCPApplicationDefaultCredentialsAuthenticationStrategy();
228
- } else if (protocol instanceof V1_TestDatabaseAuthenticationStrategy) {
229
- return new TestDatabaseAuthenticationStrategy();
230
255
  } else if (protocol instanceof V1_OAuthAuthenticationStrategy) {
231
256
  return new OAuthAuthenticationStrategy(
232
257
  guaranteeNonEmptyString(
@@ -238,19 +263,6 @@ export const V1_buildAuthenticationStrategy = (
238
263
  `OAuth authentication specification 'scopeName' field is missing or empty`,
239
264
  ),
240
265
  );
241
- } else if (protocol instanceof V1_UserPasswordAuthenticationStrategy) {
242
- assertNonEmptyString(
243
- protocol.userName,
244
- `User password authentication strategy 'userName' field is missing or empty`,
245
- );
246
- assertNonEmptyString(
247
- protocol.passwordVaultReference,
248
- `User password authentication strategy 'passwordVaultReference' field is missing or empty`,
249
- );
250
- return new UserPasswordAuthenticationStrategy(
251
- protocol.userName,
252
- protocol.passwordVaultReference,
253
- );
254
266
  } else if (protocol instanceof V1_UsernamePasswordAuthenticationStrategy) {
255
267
  assertNonEmptyString(
256
268
  protocol.userNameVaultReference,