@deepnote/database-integrations 1.3.2 → 1.3.3
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 +26 -5
- package/dist/index.d.cts +346 -83
- package/dist/index.d.ts +346 -83
- package/dist/index.js +26 -6
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -41,6 +41,10 @@ const BigQueryAuthMethods = {
|
|
|
41
41
|
ServiceAccount: "service-account",
|
|
42
42
|
GoogleOauth: "google-oauth"
|
|
43
43
|
};
|
|
44
|
+
const TrinoAuthMethods = {
|
|
45
|
+
Password: "password",
|
|
46
|
+
Oauth: "oauth"
|
|
47
|
+
};
|
|
44
48
|
const DatabaseAuthMethods = {
|
|
45
49
|
UsernameAndPassword: "username-and-password",
|
|
46
50
|
IndividualCredentials: "individual-credentials"
|
|
@@ -51,7 +55,8 @@ const federatedAuthMethods = [
|
|
|
51
55
|
SnowflakeAuthMethods.AzureAd,
|
|
52
56
|
SnowflakeAuthMethods.KeyPair,
|
|
53
57
|
BigQueryAuthMethods.GoogleOauth,
|
|
54
|
-
DatabaseAuthMethods.IndividualCredentials
|
|
58
|
+
DatabaseAuthMethods.IndividualCredentials,
|
|
59
|
+
TrinoAuthMethods.Oauth
|
|
55
60
|
];
|
|
56
61
|
function isFederatedAuthMethod(authMethod) {
|
|
57
62
|
return federatedAuthMethods.includes(authMethod);
|
|
@@ -211,12 +216,10 @@ const spannerMetadataSchema = zod.z.object({
|
|
|
211
216
|
instance: zod.z.string(),
|
|
212
217
|
database: zod.z.string()
|
|
213
218
|
});
|
|
214
|
-
const
|
|
219
|
+
const trinoBaseMetadataSchema = zod.z.object({
|
|
215
220
|
host: zod.z.string(),
|
|
216
|
-
|
|
217
|
-
password: zod.z.string(),
|
|
221
|
+
port: zod.z.string().optional(),
|
|
218
222
|
database: zod.z.string(),
|
|
219
|
-
port: zod.z.string(),
|
|
220
223
|
sshEnabled: zod.z.boolean().optional(),
|
|
221
224
|
sshHost: zod.z.string().optional(),
|
|
222
225
|
sshPort: zod.z.string().optional(),
|
|
@@ -225,6 +228,22 @@ const trinoMetadataSchema = zod.z.object({
|
|
|
225
228
|
caCertificateName: zod.z.string().optional(),
|
|
226
229
|
caCertificateText: zod.z.string().optional()
|
|
227
230
|
});
|
|
231
|
+
const trinoUsernamePasswordMetadataSchema = trinoBaseMetadataSchema.extend({
|
|
232
|
+
user: zod.z.string(),
|
|
233
|
+
password: zod.z.string()
|
|
234
|
+
});
|
|
235
|
+
const trinoOAuthMetadataSchema = trinoBaseMetadataSchema.extend({
|
|
236
|
+
authMethod: zod.z.literal(TrinoAuthMethods.Oauth),
|
|
237
|
+
clientId: zod.z.string(),
|
|
238
|
+
clientSecret: zod.z.string(),
|
|
239
|
+
authUrl: zod.z.string().url(),
|
|
240
|
+
tokenUrl: zod.z.string().url()
|
|
241
|
+
});
|
|
242
|
+
const trinoMetadataSchema = zod.z.discriminatedUnion("authMethod", [
|
|
243
|
+
trinoUsernamePasswordMetadataSchema.extend({ authMethod: zod.z.literal(null) }),
|
|
244
|
+
trinoUsernamePasswordMetadataSchema.extend({ authMethod: zod.z.literal(TrinoAuthMethods.Password) }),
|
|
245
|
+
trinoOAuthMetadataSchema
|
|
246
|
+
]);
|
|
228
247
|
const commonDatabaseSchema = zod.z.object({
|
|
229
248
|
host: zod.z.string(),
|
|
230
249
|
user: zod.z.string(),
|
|
@@ -695,6 +714,7 @@ const getMaterializePostgresSqlAlchemyInput = (integrationId, projectRootDirecto
|
|
|
695
714
|
};
|
|
696
715
|
};
|
|
697
716
|
const getTrinoEnvVars = (integrationId, metadata, projectRootDirectory) => {
|
|
717
|
+
if (metadata.authMethod === TrinoAuthMethods.Oauth) return null;
|
|
698
718
|
return {
|
|
699
719
|
url: `trino://${encodeURIComponent(metadata.user)}:${encodeURIComponent(metadata.password)}@${metadata.host}:${metadata.port}/${encodeURIComponent(metadata.database)}`,
|
|
700
720
|
params: { connect_args: {
|
|
@@ -877,6 +897,7 @@ exports.BigQueryServiceAccountParseError = BigQueryServiceAccountParseError;
|
|
|
877
897
|
exports.DatabaseAuthMethods = DatabaseAuthMethods;
|
|
878
898
|
exports.SnowflakeAuthMethods = SnowflakeAuthMethods;
|
|
879
899
|
exports.SpannerServiceAccountParseError = SpannerServiceAccountParseError;
|
|
900
|
+
exports.TrinoAuthMethods = TrinoAuthMethods;
|
|
880
901
|
exports.databaseIntegrationConfigSchema = databaseIntegrationConfigSchema;
|
|
881
902
|
exports.databaseIntegrationTypes = databaseIntegrationTypes;
|
|
882
903
|
exports.databaseIntegrationTypesWithSslSupport = databaseIntegrationTypesWithSslSupport;
|