@deepnote/database-integrations 1.1.1 → 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.
- package/dist/index.cjs +361 -217
- package/dist/index.d.cts +1781 -67
- package/dist/index.d.ts +1781 -67
- package/dist/index.js +357 -219
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
1
|
+
import z$1, { z } from "zod";
|
|
2
2
|
|
|
3
3
|
//#region src/sql-integration-auth-methods.ts
|
|
4
4
|
const AwsAuthMethods = {
|
|
@@ -36,6 +36,332 @@ function isFederatedAuthMetadata(metadata) {
|
|
|
36
36
|
return isFederatedAuthMethod(metadata.authMethod);
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
+
//#endregion
|
|
40
|
+
//#region src/database-integration-metadata-schemas.ts
|
|
41
|
+
const athenaMetadataSchema = z.object({
|
|
42
|
+
access_key_id: z.string(),
|
|
43
|
+
region: z.string(),
|
|
44
|
+
s3_output_path: z.string(),
|
|
45
|
+
secret_access_key: z.string(),
|
|
46
|
+
workgroup: z.string().optional()
|
|
47
|
+
});
|
|
48
|
+
const bigqueryMetadataSchema = z.discriminatedUnion("authMethod", [z.object({
|
|
49
|
+
authMethod: z.literal(BigQueryAuthMethods.ServiceAccount),
|
|
50
|
+
service_account: z.string()
|
|
51
|
+
}), z.object({
|
|
52
|
+
authMethod: z.literal(BigQueryAuthMethods.GoogleOauth),
|
|
53
|
+
project: z.string(),
|
|
54
|
+
clientId: z.string(),
|
|
55
|
+
clientSecret: z.string()
|
|
56
|
+
})]);
|
|
57
|
+
const clickhouseMetadataSchema = z.object({
|
|
58
|
+
host: z.string(),
|
|
59
|
+
user: z.string(),
|
|
60
|
+
password: z.string().optional(),
|
|
61
|
+
database: z.string(),
|
|
62
|
+
port: z.string().optional(),
|
|
63
|
+
sshEnabled: z.boolean().optional(),
|
|
64
|
+
sshHost: z.string().optional(),
|
|
65
|
+
sshPort: z.string().optional(),
|
|
66
|
+
sshUser: z.string().optional(),
|
|
67
|
+
sslEnabled: z.boolean().optional(),
|
|
68
|
+
caCertificateName: z.string().optional(),
|
|
69
|
+
caCertificateText: z.string().optional()
|
|
70
|
+
});
|
|
71
|
+
const databricksMetadataSchema = z.object({
|
|
72
|
+
host: z.string(),
|
|
73
|
+
httpPath: z.string(),
|
|
74
|
+
token: z.string(),
|
|
75
|
+
port: z.string(),
|
|
76
|
+
schema: z.string().optional(),
|
|
77
|
+
catalog: z.string().optional(),
|
|
78
|
+
sshEnabled: z.boolean().optional(),
|
|
79
|
+
sshHost: z.string().optional(),
|
|
80
|
+
sshPort: z.string().optional(),
|
|
81
|
+
sshUser: z.string().optional()
|
|
82
|
+
});
|
|
83
|
+
const dremioMetadataSchema = z.object({
|
|
84
|
+
schema: z.string(),
|
|
85
|
+
host: z.string(),
|
|
86
|
+
port: z.string(),
|
|
87
|
+
token: z.string(),
|
|
88
|
+
sshEnabled: z.boolean().optional(),
|
|
89
|
+
sshHost: z.string().optional(),
|
|
90
|
+
sshPort: z.string().optional(),
|
|
91
|
+
sshUser: z.string().optional()
|
|
92
|
+
});
|
|
93
|
+
const mongodbMetadataSchema = z.object({
|
|
94
|
+
connection_string: z.string(),
|
|
95
|
+
rawConnectionString: z.string().optional(),
|
|
96
|
+
prefix: z.string().optional(),
|
|
97
|
+
host: z.string().optional(),
|
|
98
|
+
port: z.string().optional(),
|
|
99
|
+
user: z.string().optional(),
|
|
100
|
+
password: z.string().optional(),
|
|
101
|
+
database: z.string().optional(),
|
|
102
|
+
options: z.string().optional(),
|
|
103
|
+
sshEnabled: z.boolean().optional(),
|
|
104
|
+
sshHost: z.string().optional(),
|
|
105
|
+
sshPort: z.string().optional(),
|
|
106
|
+
sshUser: z.string().optional(),
|
|
107
|
+
sslEnabled: z.boolean().optional(),
|
|
108
|
+
caCertificateName: z.string().optional(),
|
|
109
|
+
caCertificateText: z.string().optional()
|
|
110
|
+
});
|
|
111
|
+
const pandasDataframeMetadataSchema = z.object({});
|
|
112
|
+
const commonRedshiftMetadataSchema = z.object({
|
|
113
|
+
database: z.string(),
|
|
114
|
+
host: z.string(),
|
|
115
|
+
port: z.string().optional(),
|
|
116
|
+
sshEnabled: z.boolean().optional(),
|
|
117
|
+
sshHost: z.string().optional(),
|
|
118
|
+
sshPort: z.string().optional(),
|
|
119
|
+
sshUser: z.string().optional(),
|
|
120
|
+
sslEnabled: z.boolean().optional(),
|
|
121
|
+
caCertificateName: z.string().optional(),
|
|
122
|
+
caCertificateText: z.string().optional()
|
|
123
|
+
});
|
|
124
|
+
const redshiftMetadataSchema = z.discriminatedUnion("authMethod", [
|
|
125
|
+
commonRedshiftMetadataSchema.extend({
|
|
126
|
+
authMethod: z.literal(DatabaseAuthMethods.UsernameAndPassword),
|
|
127
|
+
user: z.string(),
|
|
128
|
+
password: z.string()
|
|
129
|
+
}),
|
|
130
|
+
commonRedshiftMetadataSchema.extend({
|
|
131
|
+
authMethod: z.literal(AwsAuthMethods.IamRole),
|
|
132
|
+
roleArn: z.string(),
|
|
133
|
+
roleExternalId: z.string(),
|
|
134
|
+
roleNonce: z.string()
|
|
135
|
+
}),
|
|
136
|
+
commonRedshiftMetadataSchema.extend({ authMethod: z.literal(DatabaseAuthMethods.IndividualCredentials) })
|
|
137
|
+
]);
|
|
138
|
+
const commonSnowflakeMetadataSchema = z.object({
|
|
139
|
+
accountName: z.string(),
|
|
140
|
+
warehouse: z.string().optional(),
|
|
141
|
+
database: z.string().optional(),
|
|
142
|
+
role: z.string().optional()
|
|
143
|
+
});
|
|
144
|
+
const snowflakeMetadataSchema = z.discriminatedUnion("authMethod", [
|
|
145
|
+
commonSnowflakeMetadataSchema.extend({
|
|
146
|
+
authMethod: z.literal(SnowflakeAuthMethods.Password),
|
|
147
|
+
username: z.string(),
|
|
148
|
+
password: z.string()
|
|
149
|
+
}),
|
|
150
|
+
commonSnowflakeMetadataSchema.extend({
|
|
151
|
+
authMethod: z.literal(SnowflakeAuthMethods.Okta),
|
|
152
|
+
clientId: z.string(),
|
|
153
|
+
clientSecret: z.string(),
|
|
154
|
+
oktaSubdomain: z.string(),
|
|
155
|
+
identityProvider: z.string(),
|
|
156
|
+
authorizationServer: z.string()
|
|
157
|
+
}),
|
|
158
|
+
commonSnowflakeMetadataSchema.extend({
|
|
159
|
+
authMethod: z.literal(SnowflakeAuthMethods.NativeSnowflake),
|
|
160
|
+
clientId: z.string(),
|
|
161
|
+
clientSecret: z.string()
|
|
162
|
+
}),
|
|
163
|
+
commonSnowflakeMetadataSchema.extend({
|
|
164
|
+
authMethod: z.literal(SnowflakeAuthMethods.AzureAd),
|
|
165
|
+
clientId: z.string(),
|
|
166
|
+
clientSecret: z.string(),
|
|
167
|
+
resource: z.string(),
|
|
168
|
+
tenant: z.string()
|
|
169
|
+
}),
|
|
170
|
+
commonSnowflakeMetadataSchema.extend({ authMethod: z.literal(SnowflakeAuthMethods.KeyPair) }),
|
|
171
|
+
commonSnowflakeMetadataSchema.extend({
|
|
172
|
+
authMethod: z.literal(SnowflakeAuthMethods.ServiceAccountKeyPair),
|
|
173
|
+
username: z.string(),
|
|
174
|
+
privateKey: z.string(),
|
|
175
|
+
privateKeyPassphrase: z.string().optional()
|
|
176
|
+
})
|
|
177
|
+
]);
|
|
178
|
+
const spannerMetadataSchema = z.object({
|
|
179
|
+
service_account: z.string(),
|
|
180
|
+
dataBoostEnabled: z.boolean(),
|
|
181
|
+
instance: z.string(),
|
|
182
|
+
database: z.string()
|
|
183
|
+
});
|
|
184
|
+
const trinoMetadataSchema = z.object({
|
|
185
|
+
host: z.string(),
|
|
186
|
+
user: z.string(),
|
|
187
|
+
password: z.string(),
|
|
188
|
+
database: z.string(),
|
|
189
|
+
port: z.string(),
|
|
190
|
+
sshEnabled: z.boolean().optional(),
|
|
191
|
+
sshHost: z.string().optional(),
|
|
192
|
+
sshPort: z.string().optional(),
|
|
193
|
+
sshUser: z.string().optional(),
|
|
194
|
+
sslEnabled: z.boolean().optional(),
|
|
195
|
+
caCertificateName: z.string().optional(),
|
|
196
|
+
caCertificateText: z.string().optional()
|
|
197
|
+
});
|
|
198
|
+
const commonDatabaseSchema = z.object({
|
|
199
|
+
host: z.string(),
|
|
200
|
+
user: z.string(),
|
|
201
|
+
password: z.string(),
|
|
202
|
+
database: z.string(),
|
|
203
|
+
sshEnabled: z.boolean().optional(),
|
|
204
|
+
sshHost: z.string().optional(),
|
|
205
|
+
sshPort: z.string().optional(),
|
|
206
|
+
sshUser: z.string().optional()
|
|
207
|
+
});
|
|
208
|
+
const alloydbMetadataSchema = commonDatabaseSchema.extend({
|
|
209
|
+
port: z.string().optional(),
|
|
210
|
+
sslEnabled: z.boolean().optional(),
|
|
211
|
+
caCertificateName: z.string().optional(),
|
|
212
|
+
caCertificateText: z.string().optional()
|
|
213
|
+
});
|
|
214
|
+
const mariadbMetadataSchema = commonDatabaseSchema.extend({
|
|
215
|
+
port: z.string().optional(),
|
|
216
|
+
sslEnabled: z.boolean().optional(),
|
|
217
|
+
caCertificateName: z.string().optional(),
|
|
218
|
+
caCertificateText: z.string().optional()
|
|
219
|
+
});
|
|
220
|
+
const mindsdbMetadataSchema = commonDatabaseSchema.extend({
|
|
221
|
+
port: z.string().optional(),
|
|
222
|
+
sslEnabled: z.boolean().optional(),
|
|
223
|
+
caCertificateName: z.string().optional(),
|
|
224
|
+
caCertificateText: z.string().optional()
|
|
225
|
+
});
|
|
226
|
+
const mysqlMetadataSchema = commonDatabaseSchema.extend({
|
|
227
|
+
port: z.string().optional(),
|
|
228
|
+
sslEnabled: z.boolean().optional(),
|
|
229
|
+
caCertificateName: z.string().optional(),
|
|
230
|
+
caCertificateText: z.string().optional()
|
|
231
|
+
});
|
|
232
|
+
const pgsqlMetadataSchema = commonDatabaseSchema.extend({
|
|
233
|
+
port: z.string().optional(),
|
|
234
|
+
sslEnabled: z.boolean().optional(),
|
|
235
|
+
caCertificateName: z.string().optional(),
|
|
236
|
+
caCertificateText: z.string().optional()
|
|
237
|
+
});
|
|
238
|
+
const materializeMetadataSchema = pgsqlMetadataSchema.extend({ cluster: z.string() });
|
|
239
|
+
const sqlServerMetadataSchema = commonDatabaseSchema.extend({ port: z.string() });
|
|
240
|
+
const databaseMetadataSchemasByType = {
|
|
241
|
+
"alloydb": alloydbMetadataSchema,
|
|
242
|
+
"athena": athenaMetadataSchema,
|
|
243
|
+
"big-query": bigqueryMetadataSchema,
|
|
244
|
+
"clickhouse": clickhouseMetadataSchema,
|
|
245
|
+
"databricks": databricksMetadataSchema,
|
|
246
|
+
"dremio": dremioMetadataSchema,
|
|
247
|
+
"mariadb": mariadbMetadataSchema,
|
|
248
|
+
"materialize": materializeMetadataSchema,
|
|
249
|
+
"mindsdb": mindsdbMetadataSchema,
|
|
250
|
+
"mongodb": mongodbMetadataSchema,
|
|
251
|
+
"mysql": mysqlMetadataSchema,
|
|
252
|
+
"pandas-dataframe": pandasDataframeMetadataSchema,
|
|
253
|
+
"pgsql": pgsqlMetadataSchema,
|
|
254
|
+
"redshift": redshiftMetadataSchema,
|
|
255
|
+
"snowflake": snowflakeMetadataSchema,
|
|
256
|
+
"spanner": spannerMetadataSchema,
|
|
257
|
+
"sql-server": sqlServerMetadataSchema,
|
|
258
|
+
"trino": trinoMetadataSchema
|
|
259
|
+
};
|
|
260
|
+
|
|
261
|
+
//#endregion
|
|
262
|
+
//#region src/database-integration-config.ts
|
|
263
|
+
const commonIntegrationConfig = z$1.object({
|
|
264
|
+
id: z$1.string(),
|
|
265
|
+
name: z$1.string()
|
|
266
|
+
});
|
|
267
|
+
const databaseIntegrationConfigSchema = z$1.discriminatedUnion("type", [
|
|
268
|
+
commonIntegrationConfig.extend({
|
|
269
|
+
type: z$1.literal("alloydb"),
|
|
270
|
+
metadata: databaseMetadataSchemasByType["alloydb"],
|
|
271
|
+
federated_auth_method: z$1.null().optional()
|
|
272
|
+
}),
|
|
273
|
+
commonIntegrationConfig.extend({
|
|
274
|
+
type: z$1.literal("athena"),
|
|
275
|
+
metadata: databaseMetadataSchemasByType["athena"],
|
|
276
|
+
federated_auth_method: z$1.null().optional()
|
|
277
|
+
}),
|
|
278
|
+
commonIntegrationConfig.extend({
|
|
279
|
+
type: z$1.literal("big-query"),
|
|
280
|
+
metadata: databaseMetadataSchemasByType["big-query"],
|
|
281
|
+
federated_auth_method: z$1.enum(["google-oauth"]).optional().nullable()
|
|
282
|
+
}),
|
|
283
|
+
commonIntegrationConfig.extend({
|
|
284
|
+
type: z$1.literal("clickhouse"),
|
|
285
|
+
metadata: databaseMetadataSchemasByType["clickhouse"],
|
|
286
|
+
federated_auth_method: z$1.null().optional()
|
|
287
|
+
}),
|
|
288
|
+
commonIntegrationConfig.extend({
|
|
289
|
+
type: z$1.literal("databricks"),
|
|
290
|
+
metadata: databaseMetadataSchemasByType["databricks"],
|
|
291
|
+
federated_auth_method: z$1.null().optional()
|
|
292
|
+
}),
|
|
293
|
+
commonIntegrationConfig.extend({
|
|
294
|
+
type: z$1.literal("dremio"),
|
|
295
|
+
metadata: databaseMetadataSchemasByType["dremio"],
|
|
296
|
+
federated_auth_method: z$1.null().optional()
|
|
297
|
+
}),
|
|
298
|
+
commonIntegrationConfig.extend({
|
|
299
|
+
type: z$1.literal("mariadb"),
|
|
300
|
+
metadata: databaseMetadataSchemasByType["mariadb"],
|
|
301
|
+
federated_auth_method: z$1.null().optional()
|
|
302
|
+
}),
|
|
303
|
+
commonIntegrationConfig.extend({
|
|
304
|
+
type: z$1.literal("materialize"),
|
|
305
|
+
metadata: databaseMetadataSchemasByType["materialize"],
|
|
306
|
+
federated_auth_method: z$1.null().optional()
|
|
307
|
+
}),
|
|
308
|
+
commonIntegrationConfig.extend({
|
|
309
|
+
type: z$1.literal("mindsdb"),
|
|
310
|
+
metadata: databaseMetadataSchemasByType["mindsdb"],
|
|
311
|
+
federated_auth_method: z$1.null().optional()
|
|
312
|
+
}),
|
|
313
|
+
commonIntegrationConfig.extend({
|
|
314
|
+
type: z$1.literal("mongodb"),
|
|
315
|
+
metadata: databaseMetadataSchemasByType["mongodb"],
|
|
316
|
+
federated_auth_method: z$1.null().optional()
|
|
317
|
+
}),
|
|
318
|
+
commonIntegrationConfig.extend({
|
|
319
|
+
type: z$1.literal("mysql"),
|
|
320
|
+
metadata: databaseMetadataSchemasByType["mysql"],
|
|
321
|
+
federated_auth_method: z$1.null().optional()
|
|
322
|
+
}),
|
|
323
|
+
commonIntegrationConfig.extend({
|
|
324
|
+
type: z$1.literal("pandas-dataframe"),
|
|
325
|
+
metadata: databaseMetadataSchemasByType["pandas-dataframe"],
|
|
326
|
+
federated_auth_method: z$1.null().optional()
|
|
327
|
+
}),
|
|
328
|
+
commonIntegrationConfig.extend({
|
|
329
|
+
type: z$1.literal("pgsql"),
|
|
330
|
+
metadata: databaseMetadataSchemasByType["pgsql"],
|
|
331
|
+
federated_auth_method: z$1.null().optional()
|
|
332
|
+
}),
|
|
333
|
+
commonIntegrationConfig.extend({
|
|
334
|
+
type: z$1.literal("redshift"),
|
|
335
|
+
metadata: databaseMetadataSchemasByType["redshift"],
|
|
336
|
+
federated_auth_method: z$1.enum(["individual-credentials"]).optional().nullable()
|
|
337
|
+
}),
|
|
338
|
+
commonIntegrationConfig.extend({
|
|
339
|
+
type: z$1.literal("snowflake"),
|
|
340
|
+
metadata: databaseMetadataSchemasByType["snowflake"],
|
|
341
|
+
federated_auth_method: z$1.enum([
|
|
342
|
+
"okta",
|
|
343
|
+
"snowflake",
|
|
344
|
+
"azure",
|
|
345
|
+
"key-pair"
|
|
346
|
+
]).optional().nullable()
|
|
347
|
+
}),
|
|
348
|
+
commonIntegrationConfig.extend({
|
|
349
|
+
type: z$1.literal("spanner"),
|
|
350
|
+
metadata: databaseMetadataSchemasByType["spanner"],
|
|
351
|
+
federated_auth_method: z$1.null().optional()
|
|
352
|
+
}),
|
|
353
|
+
commonIntegrationConfig.extend({
|
|
354
|
+
type: z$1.literal("sql-server"),
|
|
355
|
+
metadata: databaseMetadataSchemasByType["sql-server"],
|
|
356
|
+
federated_auth_method: z$1.null().optional()
|
|
357
|
+
}),
|
|
358
|
+
commonIntegrationConfig.extend({
|
|
359
|
+
type: z$1.literal("trino"),
|
|
360
|
+
metadata: databaseMetadataSchemasByType["trino"],
|
|
361
|
+
federated_auth_method: z$1.null().optional()
|
|
362
|
+
})
|
|
363
|
+
]);
|
|
364
|
+
|
|
39
365
|
//#endregion
|
|
40
366
|
//#region src/snowflake-integration-env-vars.ts
|
|
41
367
|
/**
|
|
@@ -68,6 +394,22 @@ function getSnowflakeSqlAlchemyInput(metadata, params) {
|
|
|
68
394
|
queryParams: { ...createBaseQueryParams(metadata, params.snowflakePartnerIdentifier) }
|
|
69
395
|
}));
|
|
70
396
|
}
|
|
397
|
+
function getSnowflakeFederatedAuthSqlAlchemyInput(metadata, options = {}) {
|
|
398
|
+
return createSqlAlchemyInputFromUrl(buildSnowflakeUrlForFederatedAuth(metadata, options), options.keyPair);
|
|
399
|
+
}
|
|
400
|
+
function buildSnowflakeUrlForFederatedAuth(metadata, options) {
|
|
401
|
+
const queryParams = { ...createBaseQueryParams(metadata, options.snowflakePartnerIdentifier) };
|
|
402
|
+
if (options.role) queryParams.role = options.role;
|
|
403
|
+
if (options.accessToken) {
|
|
404
|
+
queryParams.token = options.accessToken;
|
|
405
|
+
queryParams.authenticator = "oauth";
|
|
406
|
+
}
|
|
407
|
+
const accountIdentifier = metadata.accountName.replace(".privatelink", "");
|
|
408
|
+
return buildUrl(options.keyPair?.username ? `snowflake://${encodeURIComponent(options.keyPair.username)}@${encodeURIComponent(accountIdentifier)}` : `snowflake://:@${encodeURIComponent(accountIdentifier)}`, {
|
|
409
|
+
path: metadata.database,
|
|
410
|
+
queryParams
|
|
411
|
+
});
|
|
412
|
+
}
|
|
71
413
|
function createBaseQueryParams(metadata, snowflakePartnerIdentifier) {
|
|
72
414
|
return {
|
|
73
415
|
warehouse: metadata.warehouse,
|
|
@@ -93,7 +435,9 @@ function getEnvironmentVariablesForIntegrations(integrations, params) {
|
|
|
93
435
|
const errors = [];
|
|
94
436
|
integrations.forEach((integration) => {
|
|
95
437
|
const namePrefix = convertToEnvironmentVariableName(integration.name);
|
|
96
|
-
const envVarsForThisIntegration = Object.entries(integration.metadata).
|
|
438
|
+
const envVarsForThisIntegration = Object.entries(integration.metadata).filter(([key]) => {
|
|
439
|
+
return key !== "caCertificateText";
|
|
440
|
+
}).map(([key, rawValue]) => {
|
|
97
441
|
const name = `${namePrefix}_${key.toUpperCase()}`;
|
|
98
442
|
const value = String(rawValue);
|
|
99
443
|
if (integration.type === "mongodb" && integration.metadata.sslEnabled && key === "connection_string") return {
|
|
@@ -445,222 +789,6 @@ function assertNever(value) {
|
|
|
445
789
|
throw new Error(`Unexpected value: ${value}`);
|
|
446
790
|
}
|
|
447
791
|
|
|
448
|
-
//#endregion
|
|
449
|
-
//#region src/database-integration-metadata-schemas.ts
|
|
450
|
-
const athenaMetadataSchema = z.object({
|
|
451
|
-
access_key_id: z.string(),
|
|
452
|
-
region: z.string(),
|
|
453
|
-
s3_output_path: z.string(),
|
|
454
|
-
secret_access_key: z.string(),
|
|
455
|
-
workgroup: z.string().optional()
|
|
456
|
-
});
|
|
457
|
-
const bigqueryMetadataSchema = z.discriminatedUnion("authMethod", [z.object({
|
|
458
|
-
authMethod: z.literal(BigQueryAuthMethods.ServiceAccount),
|
|
459
|
-
service_account: z.string()
|
|
460
|
-
}), z.object({
|
|
461
|
-
authMethod: z.literal(BigQueryAuthMethods.GoogleOauth),
|
|
462
|
-
project: z.string(),
|
|
463
|
-
clientId: z.string(),
|
|
464
|
-
clientSecret: z.string()
|
|
465
|
-
})]);
|
|
466
|
-
const clickhouseMetadataSchema = z.object({
|
|
467
|
-
host: z.string(),
|
|
468
|
-
user: z.string(),
|
|
469
|
-
password: z.string().optional(),
|
|
470
|
-
database: z.string(),
|
|
471
|
-
port: z.string().optional(),
|
|
472
|
-
sshEnabled: z.boolean().optional(),
|
|
473
|
-
sshHost: z.string().optional(),
|
|
474
|
-
sshPort: z.string().optional(),
|
|
475
|
-
sshUser: z.string().optional(),
|
|
476
|
-
sslEnabled: z.boolean().optional(),
|
|
477
|
-
caCertificateName: z.string().optional(),
|
|
478
|
-
caCertificateText: z.string().optional()
|
|
479
|
-
});
|
|
480
|
-
const databricksMetadataSchema = z.object({
|
|
481
|
-
host: z.string(),
|
|
482
|
-
httpPath: z.string(),
|
|
483
|
-
token: z.string(),
|
|
484
|
-
port: z.string(),
|
|
485
|
-
schema: z.string().optional(),
|
|
486
|
-
catalog: z.string().optional(),
|
|
487
|
-
sshEnabled: z.boolean().optional(),
|
|
488
|
-
sshHost: z.string().optional(),
|
|
489
|
-
sshPort: z.string().optional(),
|
|
490
|
-
sshUser: z.string().optional()
|
|
491
|
-
});
|
|
492
|
-
const dremioMetadataSchema = z.object({
|
|
493
|
-
schema: z.string(),
|
|
494
|
-
host: z.string(),
|
|
495
|
-
port: z.string(),
|
|
496
|
-
token: z.string(),
|
|
497
|
-
sshEnabled: z.boolean().optional(),
|
|
498
|
-
sshHost: z.string().optional(),
|
|
499
|
-
sshPort: z.string().optional(),
|
|
500
|
-
sshUser: z.string().optional()
|
|
501
|
-
});
|
|
502
|
-
const mongodbMetadataSchema = z.object({
|
|
503
|
-
connection_string: z.string(),
|
|
504
|
-
rawConnectionString: z.string().optional(),
|
|
505
|
-
prefix: z.string().optional(),
|
|
506
|
-
host: z.string().optional(),
|
|
507
|
-
port: z.string().optional(),
|
|
508
|
-
user: z.string().optional(),
|
|
509
|
-
password: z.string().optional(),
|
|
510
|
-
database: z.string().optional(),
|
|
511
|
-
options: z.string().optional(),
|
|
512
|
-
sshEnabled: z.boolean().optional(),
|
|
513
|
-
sshHost: z.string().optional(),
|
|
514
|
-
sshPort: z.string().optional(),
|
|
515
|
-
sshUser: z.string().optional(),
|
|
516
|
-
sslEnabled: z.boolean().optional(),
|
|
517
|
-
caCertificateName: z.string().optional(),
|
|
518
|
-
caCertificateText: z.string().optional()
|
|
519
|
-
});
|
|
520
|
-
const pandasDataframeMetadataSchema = z.object({});
|
|
521
|
-
const commonRedshiftMetadataSchema = z.object({
|
|
522
|
-
database: z.string(),
|
|
523
|
-
host: z.string(),
|
|
524
|
-
port: z.string().optional(),
|
|
525
|
-
sshEnabled: z.boolean().optional(),
|
|
526
|
-
sshHost: z.string().optional(),
|
|
527
|
-
sshPort: z.string().optional(),
|
|
528
|
-
sshUser: z.string().optional(),
|
|
529
|
-
sslEnabled: z.boolean().optional(),
|
|
530
|
-
caCertificateName: z.string().optional(),
|
|
531
|
-
caCertificateText: z.string().optional()
|
|
532
|
-
});
|
|
533
|
-
const redshiftMetadataSchema = z.discriminatedUnion("authMethod", [
|
|
534
|
-
commonRedshiftMetadataSchema.extend({
|
|
535
|
-
authMethod: z.literal(DatabaseAuthMethods.UsernameAndPassword),
|
|
536
|
-
user: z.string(),
|
|
537
|
-
password: z.string()
|
|
538
|
-
}),
|
|
539
|
-
commonRedshiftMetadataSchema.extend({
|
|
540
|
-
authMethod: z.literal(AwsAuthMethods.IamRole),
|
|
541
|
-
roleArn: z.string(),
|
|
542
|
-
roleExternalId: z.string(),
|
|
543
|
-
roleNonce: z.string()
|
|
544
|
-
}),
|
|
545
|
-
commonRedshiftMetadataSchema.extend({ authMethod: z.literal(DatabaseAuthMethods.IndividualCredentials) })
|
|
546
|
-
]);
|
|
547
|
-
const commonSnowflakeMetadataSchema = z.object({
|
|
548
|
-
accountName: z.string(),
|
|
549
|
-
warehouse: z.string().optional(),
|
|
550
|
-
database: z.string().optional(),
|
|
551
|
-
role: z.string().optional()
|
|
552
|
-
});
|
|
553
|
-
const snowflakeMetadataSchema = z.discriminatedUnion("authMethod", [
|
|
554
|
-
commonSnowflakeMetadataSchema.extend({
|
|
555
|
-
authMethod: z.literal(SnowflakeAuthMethods.Password),
|
|
556
|
-
username: z.string(),
|
|
557
|
-
password: z.string()
|
|
558
|
-
}),
|
|
559
|
-
commonSnowflakeMetadataSchema.extend({
|
|
560
|
-
authMethod: z.literal(SnowflakeAuthMethods.Okta),
|
|
561
|
-
clientId: z.string(),
|
|
562
|
-
clientSecret: z.string(),
|
|
563
|
-
oktaSubdomain: z.string(),
|
|
564
|
-
identityProvider: z.string(),
|
|
565
|
-
authorizationServer: z.string()
|
|
566
|
-
}),
|
|
567
|
-
commonSnowflakeMetadataSchema.extend({
|
|
568
|
-
authMethod: z.literal(SnowflakeAuthMethods.NativeSnowflake),
|
|
569
|
-
clientId: z.string(),
|
|
570
|
-
clientSecret: z.string()
|
|
571
|
-
}),
|
|
572
|
-
commonSnowflakeMetadataSchema.extend({
|
|
573
|
-
authMethod: z.literal(SnowflakeAuthMethods.AzureAd),
|
|
574
|
-
clientId: z.string(),
|
|
575
|
-
clientSecret: z.string(),
|
|
576
|
-
resource: z.string(),
|
|
577
|
-
tenant: z.string()
|
|
578
|
-
}),
|
|
579
|
-
commonSnowflakeMetadataSchema.extend({ authMethod: z.literal(SnowflakeAuthMethods.KeyPair) }),
|
|
580
|
-
commonSnowflakeMetadataSchema.extend({
|
|
581
|
-
authMethod: z.literal(SnowflakeAuthMethods.ServiceAccountKeyPair),
|
|
582
|
-
username: z.string(),
|
|
583
|
-
privateKey: z.string(),
|
|
584
|
-
privateKeyPassphrase: z.string().optional()
|
|
585
|
-
})
|
|
586
|
-
]);
|
|
587
|
-
const spannerMetadataSchema = z.object({
|
|
588
|
-
service_account: z.string(),
|
|
589
|
-
dataBoostEnabled: z.boolean(),
|
|
590
|
-
instance: z.string(),
|
|
591
|
-
database: z.string()
|
|
592
|
-
});
|
|
593
|
-
const trinoMetadataSchema = z.object({
|
|
594
|
-
host: z.string(),
|
|
595
|
-
user: z.string(),
|
|
596
|
-
password: z.string(),
|
|
597
|
-
database: z.string(),
|
|
598
|
-
port: z.string(),
|
|
599
|
-
sshEnabled: z.boolean().optional(),
|
|
600
|
-
sshHost: z.string().optional(),
|
|
601
|
-
sshPort: z.string().optional(),
|
|
602
|
-
sshUser: z.string().optional(),
|
|
603
|
-
sslEnabled: z.boolean().optional(),
|
|
604
|
-
caCertificateName: z.string().optional(),
|
|
605
|
-
caCertificateText: z.string().optional()
|
|
606
|
-
});
|
|
607
|
-
const commonDatabaseSchema = z.object({
|
|
608
|
-
host: z.string(),
|
|
609
|
-
user: z.string(),
|
|
610
|
-
password: z.string(),
|
|
611
|
-
database: z.string(),
|
|
612
|
-
sshEnabled: z.boolean().optional(),
|
|
613
|
-
sshHost: z.string().optional(),
|
|
614
|
-
sshPort: z.string().optional(),
|
|
615
|
-
sshUser: z.string().optional()
|
|
616
|
-
});
|
|
617
|
-
const alloydbMetadataSchema = commonDatabaseSchema.extend({
|
|
618
|
-
port: z.string().optional(),
|
|
619
|
-
sslEnabled: z.boolean().optional(),
|
|
620
|
-
caCertificateName: z.string().optional(),
|
|
621
|
-
caCertificateText: z.string().optional()
|
|
622
|
-
});
|
|
623
|
-
const mariadbMetadataSchema = commonDatabaseSchema.extend({
|
|
624
|
-
port: z.string().optional(),
|
|
625
|
-
caCertificateName: z.string().optional()
|
|
626
|
-
});
|
|
627
|
-
const mindsdbMetadataSchema = commonDatabaseSchema.extend({
|
|
628
|
-
port: z.string().optional(),
|
|
629
|
-
caCertificateName: z.string().optional()
|
|
630
|
-
});
|
|
631
|
-
const mysqlMetadataSchema = commonDatabaseSchema.extend({
|
|
632
|
-
port: z.string().optional(),
|
|
633
|
-
caCertificateName: z.string().optional()
|
|
634
|
-
});
|
|
635
|
-
const pgsqlMetadataSchema = commonDatabaseSchema.extend({
|
|
636
|
-
port: z.string().optional(),
|
|
637
|
-
sslEnabled: z.boolean().optional(),
|
|
638
|
-
caCertificateName: z.string().optional(),
|
|
639
|
-
caCertificateText: z.string().optional()
|
|
640
|
-
});
|
|
641
|
-
const materializeMetadataSchema = pgsqlMetadataSchema.extend({ cluster: z.string() });
|
|
642
|
-
const sqlServerMetadataSchema = commonDatabaseSchema.extend({ port: z.string() });
|
|
643
|
-
const databaseMetadataSchemasByType = {
|
|
644
|
-
"alloydb": alloydbMetadataSchema,
|
|
645
|
-
"athena": athenaMetadataSchema,
|
|
646
|
-
"big-query": bigqueryMetadataSchema,
|
|
647
|
-
"clickhouse": clickhouseMetadataSchema,
|
|
648
|
-
"databricks": databricksMetadataSchema,
|
|
649
|
-
"dremio": dremioMetadataSchema,
|
|
650
|
-
"mariadb": mariadbMetadataSchema,
|
|
651
|
-
"materialize": materializeMetadataSchema,
|
|
652
|
-
"mindsdb": mindsdbMetadataSchema,
|
|
653
|
-
"mongodb": mongodbMetadataSchema,
|
|
654
|
-
"mysql": mysqlMetadataSchema,
|
|
655
|
-
"pandas-dataframe": pandasDataframeMetadataSchema,
|
|
656
|
-
"pgsql": pgsqlMetadataSchema,
|
|
657
|
-
"redshift": redshiftMetadataSchema,
|
|
658
|
-
"snowflake": snowflakeMetadataSchema,
|
|
659
|
-
"spanner": spannerMetadataSchema,
|
|
660
|
-
"sql-server": sqlServerMetadataSchema,
|
|
661
|
-
"trino": trinoMetadataSchema
|
|
662
|
-
};
|
|
663
|
-
|
|
664
792
|
//#endregion
|
|
665
793
|
//#region src/database-integration-types.ts
|
|
666
794
|
const sqlIntegrationTypes = [
|
|
@@ -684,6 +812,7 @@ const sqlIntegrationTypes = [
|
|
|
684
812
|
];
|
|
685
813
|
const databaseIntegrationTypes = [...sqlIntegrationTypes, "mongodb"];
|
|
686
814
|
const databaseIntegrationTypesWithSslSupport = [
|
|
815
|
+
"alloydb",
|
|
687
816
|
"clickhouse",
|
|
688
817
|
"dremio",
|
|
689
818
|
"mariadb",
|
|
@@ -694,6 +823,15 @@ const databaseIntegrationTypesWithSslSupport = [
|
|
|
694
823
|
"redshift",
|
|
695
824
|
"trino"
|
|
696
825
|
];
|
|
826
|
+
function isDatabaseIntegrationType(type) {
|
|
827
|
+
return databaseIntegrationTypes.includes(type);
|
|
828
|
+
}
|
|
829
|
+
function isSqlIntegrationType(type) {
|
|
830
|
+
return sqlIntegrationTypes.includes(type);
|
|
831
|
+
}
|
|
832
|
+
function isDatabaseIntegrationTypeWithSslSupport(type) {
|
|
833
|
+
return databaseIntegrationTypesWithSslSupport.includes(type);
|
|
834
|
+
}
|
|
697
835
|
|
|
698
836
|
//#endregion
|
|
699
|
-
export { AwsAuthMethods, BigQueryAuthMethods, BigQueryServiceAccountParseError, DatabaseAuthMethods, SnowflakeAuthMethods, SpannerServiceAccountParseError, databaseIntegrationTypes, databaseIntegrationTypesWithSslSupport, databaseMetadataSchemasByType, getEnvironmentVariablesForIntegrations, getSqlAlchemyInput, isFederatedAuthMetadata, isFederatedAuthMethod, sqlIntegrationTypes };
|
|
837
|
+
export { AwsAuthMethods, BigQueryAuthMethods, BigQueryServiceAccountParseError, DatabaseAuthMethods, SnowflakeAuthMethods, SpannerServiceAccountParseError, databaseIntegrationConfigSchema, databaseIntegrationTypes, databaseIntegrationTypesWithSslSupport, databaseMetadataSchemasByType, federatedAuthMethods, getEnvironmentVariablesForIntegrations, getSnowflakeFederatedAuthSqlAlchemyInput, getSqlAlchemyInput, isDatabaseIntegrationType, isDatabaseIntegrationTypeWithSslSupport, isFederatedAuthMetadata, isFederatedAuthMethod, isSqlIntegrationType, sqlIntegrationTypes };
|