@deepnote/database-integrations 1.3.0 → 1.3.2
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 +11 -4
- package/dist/index.d.cts +131 -90
- package/dist/index.d.ts +131 -90
- package/dist/index.js +11 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -121,9 +121,15 @@ const commonRedshiftMetadataSchema = z.object({
|
|
|
121
121
|
caCertificateName: z.string().optional(),
|
|
122
122
|
caCertificateText: z.string().optional()
|
|
123
123
|
});
|
|
124
|
-
const redshiftMetadataSchema = z.
|
|
124
|
+
const redshiftMetadataSchema = z.preprocess((data) => {
|
|
125
|
+
if (typeof data === "object" && data !== null && (!("authMethod" in data) || !data.authMethod)) return {
|
|
126
|
+
...data,
|
|
127
|
+
authMethod: DatabaseAuthMethods.UsernameAndPassword
|
|
128
|
+
};
|
|
129
|
+
return data;
|
|
130
|
+
}, z.union([
|
|
125
131
|
commonRedshiftMetadataSchema.extend({
|
|
126
|
-
authMethod: z.literal(DatabaseAuthMethods.UsernameAndPassword),
|
|
132
|
+
authMethod: z.literal(DatabaseAuthMethods.UsernameAndPassword).optional(),
|
|
127
133
|
user: z.string(),
|
|
128
134
|
password: z.string()
|
|
129
135
|
}),
|
|
@@ -134,7 +140,7 @@ const redshiftMetadataSchema = z.discriminatedUnion("authMethod", [
|
|
|
134
140
|
roleNonce: z.string()
|
|
135
141
|
}),
|
|
136
142
|
commonRedshiftMetadataSchema.extend({ authMethod: z.literal(DatabaseAuthMethods.IndividualCredentials) })
|
|
137
|
-
]);
|
|
143
|
+
]));
|
|
138
144
|
const commonSnowflakeMetadataSchema = z.object({
|
|
139
145
|
accountName: z.string(),
|
|
140
146
|
warehouse: z.string().optional(),
|
|
@@ -504,7 +510,7 @@ function getEnvVarForSqlCells(integration, params) {
|
|
|
504
510
|
* https://github.com/deepnote/deepnote-toolkit/blob/main/deepnote_toolkit/sql/sql_execution.py#L321
|
|
505
511
|
*/
|
|
506
512
|
function getSqlAlchemyInput(integration, params) {
|
|
507
|
-
if (integration.federated_auth_method) return null;
|
|
513
|
+
if (integration.federated_auth_method != null && isFederatedAuthMethod(integration.federated_auth_method)) return null;
|
|
508
514
|
switch (integration.type) {
|
|
509
515
|
case "alloydb":
|
|
510
516
|
case "pgsql": return getPostgresSqlAlchemyInput(integration.id, params.projectRootDirectory, integration.metadata);
|
|
@@ -604,6 +610,7 @@ const getPostgresSqlAlchemyInput = (integrationId, projectRootDirectory, { user,
|
|
|
604
610
|
};
|
|
605
611
|
};
|
|
606
612
|
const getRedshiftSqlAlchemyInput = (integrationId, projectRootDirectory, metadata) => {
|
|
613
|
+
if (!metadata.authMethod) metadata.authMethod = DatabaseAuthMethods.UsernameAndPassword;
|
|
607
614
|
if (isFederatedAuthMethod(metadata.authMethod)) return null;
|
|
608
615
|
const portSuffix = metadata.port ? `:${metadata.port}` : "";
|
|
609
616
|
const mode = getPostgresStyleMode(metadata.caCertificateName, metadata.sslEnabled);
|