@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.js
CHANGED
|
@@ -17,6 +17,10 @@ const BigQueryAuthMethods = {
|
|
|
17
17
|
ServiceAccount: "service-account",
|
|
18
18
|
GoogleOauth: "google-oauth"
|
|
19
19
|
};
|
|
20
|
+
const TrinoAuthMethods = {
|
|
21
|
+
Password: "password",
|
|
22
|
+
Oauth: "oauth"
|
|
23
|
+
};
|
|
20
24
|
const DatabaseAuthMethods = {
|
|
21
25
|
UsernameAndPassword: "username-and-password",
|
|
22
26
|
IndividualCredentials: "individual-credentials"
|
|
@@ -27,7 +31,8 @@ const federatedAuthMethods = [
|
|
|
27
31
|
SnowflakeAuthMethods.AzureAd,
|
|
28
32
|
SnowflakeAuthMethods.KeyPair,
|
|
29
33
|
BigQueryAuthMethods.GoogleOauth,
|
|
30
|
-
DatabaseAuthMethods.IndividualCredentials
|
|
34
|
+
DatabaseAuthMethods.IndividualCredentials,
|
|
35
|
+
TrinoAuthMethods.Oauth
|
|
31
36
|
];
|
|
32
37
|
function isFederatedAuthMethod(authMethod) {
|
|
33
38
|
return federatedAuthMethods.includes(authMethod);
|
|
@@ -187,12 +192,10 @@ const spannerMetadataSchema = z.object({
|
|
|
187
192
|
instance: z.string(),
|
|
188
193
|
database: z.string()
|
|
189
194
|
});
|
|
190
|
-
const
|
|
195
|
+
const trinoBaseMetadataSchema = z.object({
|
|
191
196
|
host: z.string(),
|
|
192
|
-
|
|
193
|
-
password: z.string(),
|
|
197
|
+
port: z.string().optional(),
|
|
194
198
|
database: z.string(),
|
|
195
|
-
port: z.string(),
|
|
196
199
|
sshEnabled: z.boolean().optional(),
|
|
197
200
|
sshHost: z.string().optional(),
|
|
198
201
|
sshPort: z.string().optional(),
|
|
@@ -201,6 +204,22 @@ const trinoMetadataSchema = z.object({
|
|
|
201
204
|
caCertificateName: z.string().optional(),
|
|
202
205
|
caCertificateText: z.string().optional()
|
|
203
206
|
});
|
|
207
|
+
const trinoUsernamePasswordMetadataSchema = trinoBaseMetadataSchema.extend({
|
|
208
|
+
user: z.string(),
|
|
209
|
+
password: z.string()
|
|
210
|
+
});
|
|
211
|
+
const trinoOAuthMetadataSchema = trinoBaseMetadataSchema.extend({
|
|
212
|
+
authMethod: z.literal(TrinoAuthMethods.Oauth),
|
|
213
|
+
clientId: z.string(),
|
|
214
|
+
clientSecret: z.string(),
|
|
215
|
+
authUrl: z.string().url(),
|
|
216
|
+
tokenUrl: z.string().url()
|
|
217
|
+
});
|
|
218
|
+
const trinoMetadataSchema = z.discriminatedUnion("authMethod", [
|
|
219
|
+
trinoUsernamePasswordMetadataSchema.extend({ authMethod: z.literal(null) }),
|
|
220
|
+
trinoUsernamePasswordMetadataSchema.extend({ authMethod: z.literal(TrinoAuthMethods.Password) }),
|
|
221
|
+
trinoOAuthMetadataSchema
|
|
222
|
+
]);
|
|
204
223
|
const commonDatabaseSchema = z.object({
|
|
205
224
|
host: z.string(),
|
|
206
225
|
user: z.string(),
|
|
@@ -671,6 +690,7 @@ const getMaterializePostgresSqlAlchemyInput = (integrationId, projectRootDirecto
|
|
|
671
690
|
};
|
|
672
691
|
};
|
|
673
692
|
const getTrinoEnvVars = (integrationId, metadata, projectRootDirectory) => {
|
|
693
|
+
if (metadata.authMethod === TrinoAuthMethods.Oauth) return null;
|
|
674
694
|
return {
|
|
675
695
|
url: `trino://${encodeURIComponent(metadata.user)}:${encodeURIComponent(metadata.password)}@${metadata.host}:${metadata.port}/${encodeURIComponent(metadata.database)}`,
|
|
676
696
|
params: { connect_args: {
|
|
@@ -847,4 +867,4 @@ function isDatabaseIntegrationTypeWithSslSupport(type) {
|
|
|
847
867
|
}
|
|
848
868
|
|
|
849
869
|
//#endregion
|
|
850
|
-
export { AwsAuthMethods, BigQueryAuthMethods, BigQueryServiceAccountParseError, DatabaseAuthMethods, SnowflakeAuthMethods, SpannerServiceAccountParseError, databaseIntegrationConfigSchema, databaseIntegrationTypes, databaseIntegrationTypesWithSslSupport, databaseMetadataSchemasByType, federatedAuthMethods, getEnvironmentVariablesForIntegrations, getSnowflakeFederatedAuthSqlAlchemyInput, getSqlAlchemyInput, isDatabaseIntegrationType, isDatabaseIntegrationTypeWithSslSupport, isFederatedAuthMetadata, isFederatedAuthMethod, isSqlIntegrationType, sqlIntegrationTypes };
|
|
870
|
+
export { AwsAuthMethods, BigQueryAuthMethods, BigQueryServiceAccountParseError, DatabaseAuthMethods, SnowflakeAuthMethods, SpannerServiceAccountParseError, TrinoAuthMethods, databaseIntegrationConfigSchema, databaseIntegrationTypes, databaseIntegrationTypesWithSslSupport, databaseMetadataSchemasByType, federatedAuthMethods, getEnvironmentVariablesForIntegrations, getSnowflakeFederatedAuthSqlAlchemyInput, getSqlAlchemyInput, isDatabaseIntegrationType, isDatabaseIntegrationTypeWithSslSupport, isFederatedAuthMetadata, isFederatedAuthMethod, isSqlIntegrationType, sqlIntegrationTypes };
|