@deepnote/database-integrations 1.3.1 → 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 CHANGED
@@ -145,9 +145,15 @@ const commonRedshiftMetadataSchema = zod.z.object({
145
145
  caCertificateName: zod.z.string().optional(),
146
146
  caCertificateText: zod.z.string().optional()
147
147
  });
148
- const redshiftMetadataSchema = zod.z.discriminatedUnion("authMethod", [
148
+ const redshiftMetadataSchema = zod.z.preprocess((data) => {
149
+ if (typeof data === "object" && data !== null && (!("authMethod" in data) || !data.authMethod)) return {
150
+ ...data,
151
+ authMethod: DatabaseAuthMethods.UsernameAndPassword
152
+ };
153
+ return data;
154
+ }, zod.z.union([
149
155
  commonRedshiftMetadataSchema.extend({
150
- authMethod: zod.z.literal(DatabaseAuthMethods.UsernameAndPassword),
156
+ authMethod: zod.z.literal(DatabaseAuthMethods.UsernameAndPassword).optional(),
151
157
  user: zod.z.string(),
152
158
  password: zod.z.string()
153
159
  }),
@@ -158,7 +164,7 @@ const redshiftMetadataSchema = zod.z.discriminatedUnion("authMethod", [
158
164
  roleNonce: zod.z.string()
159
165
  }),
160
166
  commonRedshiftMetadataSchema.extend({ authMethod: zod.z.literal(DatabaseAuthMethods.IndividualCredentials) })
161
- ]);
167
+ ]));
162
168
  const commonSnowflakeMetadataSchema = zod.z.object({
163
169
  accountName: zod.z.string(),
164
170
  warehouse: zod.z.string().optional(),
@@ -628,6 +634,7 @@ const getPostgresSqlAlchemyInput = (integrationId, projectRootDirectory, { user,
628
634
  };
629
635
  };
630
636
  const getRedshiftSqlAlchemyInput = (integrationId, projectRootDirectory, metadata) => {
637
+ if (!metadata.authMethod) metadata.authMethod = DatabaseAuthMethods.UsernameAndPassword;
631
638
  if (isFederatedAuthMethod(metadata.authMethod)) return null;
632
639
  const portSuffix = metadata.port ? `:${metadata.port}` : "";
633
640
  const mode = getPostgresStyleMode(metadata.caCertificateName, metadata.sslEnabled);
package/dist/index.d.cts CHANGED
@@ -986,7 +986,7 @@ declare const databaseIntegrationConfigSchema: z$1.ZodDiscriminatedUnion<"type",
986
986
  name: z$1.ZodString;
987
987
  } & {
988
988
  type: z$1.ZodLiteral<"redshift">;
989
- metadata: z$1.ZodDiscriminatedUnion<"authMethod", [z$1.ZodObject<{
989
+ metadata: z$1.ZodEffects<z$1.ZodUnion<[z$1.ZodObject<{
990
990
  database: z$1.ZodString;
991
991
  host: z$1.ZodString;
992
992
  port: z$1.ZodOptional<z$1.ZodString>;
@@ -998,7 +998,7 @@ declare const databaseIntegrationConfigSchema: z$1.ZodDiscriminatedUnion<"type",
998
998
  caCertificateName: z$1.ZodOptional<z$1.ZodString>;
999
999
  caCertificateText: z$1.ZodOptional<z$1.ZodString>;
1000
1000
  } & {
1001
- authMethod: z$1.ZodLiteral<"username-and-password">;
1001
+ authMethod: z$1.ZodOptional<z$1.ZodLiteral<"username-and-password">>;
1002
1002
  user: z$1.ZodString;
1003
1003
  password: z$1.ZodString;
1004
1004
  }, "strip", z$1.ZodTypeAny, {
@@ -1006,7 +1006,6 @@ declare const databaseIntegrationConfigSchema: z$1.ZodDiscriminatedUnion<"type",
1006
1006
  host: string;
1007
1007
  user: string;
1008
1008
  database: string;
1009
- authMethod: "username-and-password";
1010
1009
  sshEnabled?: boolean | undefined;
1011
1010
  sshHost?: string | undefined;
1012
1011
  sshPort?: string | undefined;
@@ -1015,12 +1014,12 @@ declare const databaseIntegrationConfigSchema: z$1.ZodDiscriminatedUnion<"type",
1015
1014
  sslEnabled?: boolean | undefined;
1016
1015
  caCertificateName?: string | undefined;
1017
1016
  caCertificateText?: string | undefined;
1017
+ authMethod?: "username-and-password" | undefined;
1018
1018
  }, {
1019
1019
  password: string;
1020
1020
  host: string;
1021
1021
  user: string;
1022
1022
  database: string;
1023
- authMethod: "username-and-password";
1024
1023
  sshEnabled?: boolean | undefined;
1025
1024
  sshHost?: string | undefined;
1026
1025
  sshPort?: string | undefined;
@@ -1029,6 +1028,7 @@ declare const databaseIntegrationConfigSchema: z$1.ZodDiscriminatedUnion<"type",
1029
1028
  sslEnabled?: boolean | undefined;
1030
1029
  caCertificateName?: string | undefined;
1031
1030
  caCertificateText?: string | undefined;
1031
+ authMethod?: "username-and-password" | undefined;
1032
1032
  }>, z$1.ZodObject<{
1033
1033
  database: z$1.ZodString;
1034
1034
  host: z$1.ZodString;
@@ -1112,18 +1112,11 @@ declare const databaseIntegrationConfigSchema: z$1.ZodDiscriminatedUnion<"type",
1112
1112
  sslEnabled?: boolean | undefined;
1113
1113
  caCertificateName?: string | undefined;
1114
1114
  caCertificateText?: string | undefined;
1115
- }>]>;
1116
- federated_auth_method: z$1.ZodNullable<z$1.ZodOptional<z$1.ZodEnum<["username-and-password", "iam-role", "individual-credentials"]>>>;
1117
- }, "strip", z$1.ZodTypeAny, {
1118
- type: "redshift";
1119
- id: string;
1120
- name: string;
1121
- metadata: {
1115
+ }>]>, {
1122
1116
  password: string;
1123
1117
  host: string;
1124
1118
  user: string;
1125
1119
  database: string;
1126
- authMethod: "username-and-password";
1127
1120
  sshEnabled?: boolean | undefined;
1128
1121
  sshHost?: string | undefined;
1129
1122
  sshPort?: string | undefined;
@@ -1132,6 +1125,7 @@ declare const databaseIntegrationConfigSchema: z$1.ZodDiscriminatedUnion<"type",
1132
1125
  sslEnabled?: boolean | undefined;
1133
1126
  caCertificateName?: string | undefined;
1134
1127
  caCertificateText?: string | undefined;
1128
+ authMethod?: "username-and-password" | undefined;
1135
1129
  } | {
1136
1130
  host: string;
1137
1131
  database: string;
@@ -1159,9 +1153,9 @@ declare const databaseIntegrationConfigSchema: z$1.ZodDiscriminatedUnion<"type",
1159
1153
  sslEnabled?: boolean | undefined;
1160
1154
  caCertificateName?: string | undefined;
1161
1155
  caCertificateText?: string | undefined;
1162
- };
1163
- federated_auth_method?: "iam-role" | "username-and-password" | "individual-credentials" | null | undefined;
1164
- }, {
1156
+ }, unknown>;
1157
+ federated_auth_method: z$1.ZodNullable<z$1.ZodOptional<z$1.ZodEnum<["username-and-password", "iam-role", "individual-credentials"]>>>;
1158
+ }, "strip", z$1.ZodTypeAny, {
1165
1159
  type: "redshift";
1166
1160
  id: string;
1167
1161
  name: string;
@@ -1170,7 +1164,6 @@ declare const databaseIntegrationConfigSchema: z$1.ZodDiscriminatedUnion<"type",
1170
1164
  host: string;
1171
1165
  user: string;
1172
1166
  database: string;
1173
- authMethod: "username-and-password";
1174
1167
  sshEnabled?: boolean | undefined;
1175
1168
  sshHost?: string | undefined;
1176
1169
  sshPort?: string | undefined;
@@ -1179,6 +1172,7 @@ declare const databaseIntegrationConfigSchema: z$1.ZodDiscriminatedUnion<"type",
1179
1172
  sslEnabled?: boolean | undefined;
1180
1173
  caCertificateName?: string | undefined;
1181
1174
  caCertificateText?: string | undefined;
1175
+ authMethod?: "username-and-password" | undefined;
1182
1176
  } | {
1183
1177
  host: string;
1184
1178
  database: string;
@@ -1208,6 +1202,12 @@ declare const databaseIntegrationConfigSchema: z$1.ZodDiscriminatedUnion<"type",
1208
1202
  caCertificateText?: string | undefined;
1209
1203
  };
1210
1204
  federated_auth_method?: "iam-role" | "username-and-password" | "individual-credentials" | null | undefined;
1205
+ }, {
1206
+ type: "redshift";
1207
+ id: string;
1208
+ name: string;
1209
+ metadata?: unknown;
1210
+ federated_auth_method?: "iam-role" | "username-and-password" | "individual-credentials" | null | undefined;
1211
1211
  }>, z$1.ZodObject<{
1212
1212
  id: z$1.ZodString;
1213
1213
  name: z$1.ZodString;
@@ -2148,7 +2148,7 @@ declare const databaseMetadataSchemasByType: {
2148
2148
  caCertificateName?: string | undefined;
2149
2149
  caCertificateText?: string | undefined;
2150
2150
  }>;
2151
- readonly redshift: z.ZodDiscriminatedUnion<"authMethod", [z.ZodObject<{
2151
+ readonly redshift: z.ZodEffects<z.ZodUnion<[z.ZodObject<{
2152
2152
  database: z.ZodString;
2153
2153
  host: z.ZodString;
2154
2154
  port: z.ZodOptional<z.ZodString>;
@@ -2160,7 +2160,7 @@ declare const databaseMetadataSchemasByType: {
2160
2160
  caCertificateName: z.ZodOptional<z.ZodString>;
2161
2161
  caCertificateText: z.ZodOptional<z.ZodString>;
2162
2162
  } & {
2163
- authMethod: z.ZodLiteral<"username-and-password">;
2163
+ authMethod: z.ZodOptional<z.ZodLiteral<"username-and-password">>;
2164
2164
  user: z.ZodString;
2165
2165
  password: z.ZodString;
2166
2166
  }, "strip", z.ZodTypeAny, {
@@ -2168,7 +2168,6 @@ declare const databaseMetadataSchemasByType: {
2168
2168
  host: string;
2169
2169
  user: string;
2170
2170
  database: string;
2171
- authMethod: "username-and-password";
2172
2171
  sshEnabled?: boolean | undefined;
2173
2172
  sshHost?: string | undefined;
2174
2173
  sshPort?: string | undefined;
@@ -2177,12 +2176,12 @@ declare const databaseMetadataSchemasByType: {
2177
2176
  sslEnabled?: boolean | undefined;
2178
2177
  caCertificateName?: string | undefined;
2179
2178
  caCertificateText?: string | undefined;
2179
+ authMethod?: "username-and-password" | undefined;
2180
2180
  }, {
2181
2181
  password: string;
2182
2182
  host: string;
2183
2183
  user: string;
2184
2184
  database: string;
2185
- authMethod: "username-and-password";
2186
2185
  sshEnabled?: boolean | undefined;
2187
2186
  sshHost?: string | undefined;
2188
2187
  sshPort?: string | undefined;
@@ -2191,6 +2190,7 @@ declare const databaseMetadataSchemasByType: {
2191
2190
  sslEnabled?: boolean | undefined;
2192
2191
  caCertificateName?: string | undefined;
2193
2192
  caCertificateText?: string | undefined;
2193
+ authMethod?: "username-and-password" | undefined;
2194
2194
  }>, z.ZodObject<{
2195
2195
  database: z.ZodString;
2196
2196
  host: z.ZodString;
@@ -2274,7 +2274,48 @@ declare const databaseMetadataSchemasByType: {
2274
2274
  sslEnabled?: boolean | undefined;
2275
2275
  caCertificateName?: string | undefined;
2276
2276
  caCertificateText?: string | undefined;
2277
- }>]>;
2277
+ }>]>, {
2278
+ password: string;
2279
+ host: string;
2280
+ user: string;
2281
+ database: string;
2282
+ sshEnabled?: boolean | undefined;
2283
+ sshHost?: string | undefined;
2284
+ sshPort?: string | undefined;
2285
+ sshUser?: string | undefined;
2286
+ port?: string | undefined;
2287
+ sslEnabled?: boolean | undefined;
2288
+ caCertificateName?: string | undefined;
2289
+ caCertificateText?: string | undefined;
2290
+ authMethod?: "username-and-password" | undefined;
2291
+ } | {
2292
+ host: string;
2293
+ database: string;
2294
+ authMethod: "iam-role";
2295
+ roleArn: string;
2296
+ roleExternalId: string;
2297
+ roleNonce: string;
2298
+ sshEnabled?: boolean | undefined;
2299
+ sshHost?: string | undefined;
2300
+ sshPort?: string | undefined;
2301
+ sshUser?: string | undefined;
2302
+ port?: string | undefined;
2303
+ sslEnabled?: boolean | undefined;
2304
+ caCertificateName?: string | undefined;
2305
+ caCertificateText?: string | undefined;
2306
+ } | {
2307
+ host: string;
2308
+ database: string;
2309
+ authMethod: "individual-credentials";
2310
+ sshEnabled?: boolean | undefined;
2311
+ sshHost?: string | undefined;
2312
+ sshPort?: string | undefined;
2313
+ sshUser?: string | undefined;
2314
+ port?: string | undefined;
2315
+ sslEnabled?: boolean | undefined;
2316
+ caCertificateName?: string | undefined;
2317
+ caCertificateText?: string | undefined;
2318
+ }, unknown>;
2278
2319
  readonly snowflake: z.ZodDiscriminatedUnion<"authMethod", [z.ZodObject<{
2279
2320
  accountName: z.ZodString;
2280
2321
  warehouse: z.ZodOptional<z.ZodString>;
package/dist/index.d.ts CHANGED
@@ -986,7 +986,7 @@ declare const databaseIntegrationConfigSchema: z$1.ZodDiscriminatedUnion<"type",
986
986
  name: z$1.ZodString;
987
987
  } & {
988
988
  type: z$1.ZodLiteral<"redshift">;
989
- metadata: z$1.ZodDiscriminatedUnion<"authMethod", [z$1.ZodObject<{
989
+ metadata: z$1.ZodEffects<z$1.ZodUnion<[z$1.ZodObject<{
990
990
  database: z$1.ZodString;
991
991
  host: z$1.ZodString;
992
992
  port: z$1.ZodOptional<z$1.ZodString>;
@@ -998,7 +998,7 @@ declare const databaseIntegrationConfigSchema: z$1.ZodDiscriminatedUnion<"type",
998
998
  caCertificateName: z$1.ZodOptional<z$1.ZodString>;
999
999
  caCertificateText: z$1.ZodOptional<z$1.ZodString>;
1000
1000
  } & {
1001
- authMethod: z$1.ZodLiteral<"username-and-password">;
1001
+ authMethod: z$1.ZodOptional<z$1.ZodLiteral<"username-and-password">>;
1002
1002
  user: z$1.ZodString;
1003
1003
  password: z$1.ZodString;
1004
1004
  }, "strip", z$1.ZodTypeAny, {
@@ -1006,7 +1006,6 @@ declare const databaseIntegrationConfigSchema: z$1.ZodDiscriminatedUnion<"type",
1006
1006
  host: string;
1007
1007
  user: string;
1008
1008
  database: string;
1009
- authMethod: "username-and-password";
1010
1009
  sshEnabled?: boolean | undefined;
1011
1010
  sshHost?: string | undefined;
1012
1011
  sshPort?: string | undefined;
@@ -1015,12 +1014,12 @@ declare const databaseIntegrationConfigSchema: z$1.ZodDiscriminatedUnion<"type",
1015
1014
  sslEnabled?: boolean | undefined;
1016
1015
  caCertificateName?: string | undefined;
1017
1016
  caCertificateText?: string | undefined;
1017
+ authMethod?: "username-and-password" | undefined;
1018
1018
  }, {
1019
1019
  password: string;
1020
1020
  host: string;
1021
1021
  user: string;
1022
1022
  database: string;
1023
- authMethod: "username-and-password";
1024
1023
  sshEnabled?: boolean | undefined;
1025
1024
  sshHost?: string | undefined;
1026
1025
  sshPort?: string | undefined;
@@ -1029,6 +1028,7 @@ declare const databaseIntegrationConfigSchema: z$1.ZodDiscriminatedUnion<"type",
1029
1028
  sslEnabled?: boolean | undefined;
1030
1029
  caCertificateName?: string | undefined;
1031
1030
  caCertificateText?: string | undefined;
1031
+ authMethod?: "username-and-password" | undefined;
1032
1032
  }>, z$1.ZodObject<{
1033
1033
  database: z$1.ZodString;
1034
1034
  host: z$1.ZodString;
@@ -1112,18 +1112,11 @@ declare const databaseIntegrationConfigSchema: z$1.ZodDiscriminatedUnion<"type",
1112
1112
  sslEnabled?: boolean | undefined;
1113
1113
  caCertificateName?: string | undefined;
1114
1114
  caCertificateText?: string | undefined;
1115
- }>]>;
1116
- federated_auth_method: z$1.ZodNullable<z$1.ZodOptional<z$1.ZodEnum<["username-and-password", "iam-role", "individual-credentials"]>>>;
1117
- }, "strip", z$1.ZodTypeAny, {
1118
- type: "redshift";
1119
- id: string;
1120
- name: string;
1121
- metadata: {
1115
+ }>]>, {
1122
1116
  password: string;
1123
1117
  host: string;
1124
1118
  user: string;
1125
1119
  database: string;
1126
- authMethod: "username-and-password";
1127
1120
  sshEnabled?: boolean | undefined;
1128
1121
  sshHost?: string | undefined;
1129
1122
  sshPort?: string | undefined;
@@ -1132,6 +1125,7 @@ declare const databaseIntegrationConfigSchema: z$1.ZodDiscriminatedUnion<"type",
1132
1125
  sslEnabled?: boolean | undefined;
1133
1126
  caCertificateName?: string | undefined;
1134
1127
  caCertificateText?: string | undefined;
1128
+ authMethod?: "username-and-password" | undefined;
1135
1129
  } | {
1136
1130
  host: string;
1137
1131
  database: string;
@@ -1159,9 +1153,9 @@ declare const databaseIntegrationConfigSchema: z$1.ZodDiscriminatedUnion<"type",
1159
1153
  sslEnabled?: boolean | undefined;
1160
1154
  caCertificateName?: string | undefined;
1161
1155
  caCertificateText?: string | undefined;
1162
- };
1163
- federated_auth_method?: "iam-role" | "username-and-password" | "individual-credentials" | null | undefined;
1164
- }, {
1156
+ }, unknown>;
1157
+ federated_auth_method: z$1.ZodNullable<z$1.ZodOptional<z$1.ZodEnum<["username-and-password", "iam-role", "individual-credentials"]>>>;
1158
+ }, "strip", z$1.ZodTypeAny, {
1165
1159
  type: "redshift";
1166
1160
  id: string;
1167
1161
  name: string;
@@ -1170,7 +1164,6 @@ declare const databaseIntegrationConfigSchema: z$1.ZodDiscriminatedUnion<"type",
1170
1164
  host: string;
1171
1165
  user: string;
1172
1166
  database: string;
1173
- authMethod: "username-and-password";
1174
1167
  sshEnabled?: boolean | undefined;
1175
1168
  sshHost?: string | undefined;
1176
1169
  sshPort?: string | undefined;
@@ -1179,6 +1172,7 @@ declare const databaseIntegrationConfigSchema: z$1.ZodDiscriminatedUnion<"type",
1179
1172
  sslEnabled?: boolean | undefined;
1180
1173
  caCertificateName?: string | undefined;
1181
1174
  caCertificateText?: string | undefined;
1175
+ authMethod?: "username-and-password" | undefined;
1182
1176
  } | {
1183
1177
  host: string;
1184
1178
  database: string;
@@ -1208,6 +1202,12 @@ declare const databaseIntegrationConfigSchema: z$1.ZodDiscriminatedUnion<"type",
1208
1202
  caCertificateText?: string | undefined;
1209
1203
  };
1210
1204
  federated_auth_method?: "iam-role" | "username-and-password" | "individual-credentials" | null | undefined;
1205
+ }, {
1206
+ type: "redshift";
1207
+ id: string;
1208
+ name: string;
1209
+ metadata?: unknown;
1210
+ federated_auth_method?: "iam-role" | "username-and-password" | "individual-credentials" | null | undefined;
1211
1211
  }>, z$1.ZodObject<{
1212
1212
  id: z$1.ZodString;
1213
1213
  name: z$1.ZodString;
@@ -2148,7 +2148,7 @@ declare const databaseMetadataSchemasByType: {
2148
2148
  caCertificateName?: string | undefined;
2149
2149
  caCertificateText?: string | undefined;
2150
2150
  }>;
2151
- readonly redshift: z.ZodDiscriminatedUnion<"authMethod", [z.ZodObject<{
2151
+ readonly redshift: z.ZodEffects<z.ZodUnion<[z.ZodObject<{
2152
2152
  database: z.ZodString;
2153
2153
  host: z.ZodString;
2154
2154
  port: z.ZodOptional<z.ZodString>;
@@ -2160,7 +2160,7 @@ declare const databaseMetadataSchemasByType: {
2160
2160
  caCertificateName: z.ZodOptional<z.ZodString>;
2161
2161
  caCertificateText: z.ZodOptional<z.ZodString>;
2162
2162
  } & {
2163
- authMethod: z.ZodLiteral<"username-and-password">;
2163
+ authMethod: z.ZodOptional<z.ZodLiteral<"username-and-password">>;
2164
2164
  user: z.ZodString;
2165
2165
  password: z.ZodString;
2166
2166
  }, "strip", z.ZodTypeAny, {
@@ -2168,7 +2168,6 @@ declare const databaseMetadataSchemasByType: {
2168
2168
  host: string;
2169
2169
  user: string;
2170
2170
  database: string;
2171
- authMethod: "username-and-password";
2172
2171
  sshEnabled?: boolean | undefined;
2173
2172
  sshHost?: string | undefined;
2174
2173
  sshPort?: string | undefined;
@@ -2177,12 +2176,12 @@ declare const databaseMetadataSchemasByType: {
2177
2176
  sslEnabled?: boolean | undefined;
2178
2177
  caCertificateName?: string | undefined;
2179
2178
  caCertificateText?: string | undefined;
2179
+ authMethod?: "username-and-password" | undefined;
2180
2180
  }, {
2181
2181
  password: string;
2182
2182
  host: string;
2183
2183
  user: string;
2184
2184
  database: string;
2185
- authMethod: "username-and-password";
2186
2185
  sshEnabled?: boolean | undefined;
2187
2186
  sshHost?: string | undefined;
2188
2187
  sshPort?: string | undefined;
@@ -2191,6 +2190,7 @@ declare const databaseMetadataSchemasByType: {
2191
2190
  sslEnabled?: boolean | undefined;
2192
2191
  caCertificateName?: string | undefined;
2193
2192
  caCertificateText?: string | undefined;
2193
+ authMethod?: "username-and-password" | undefined;
2194
2194
  }>, z.ZodObject<{
2195
2195
  database: z.ZodString;
2196
2196
  host: z.ZodString;
@@ -2274,7 +2274,48 @@ declare const databaseMetadataSchemasByType: {
2274
2274
  sslEnabled?: boolean | undefined;
2275
2275
  caCertificateName?: string | undefined;
2276
2276
  caCertificateText?: string | undefined;
2277
- }>]>;
2277
+ }>]>, {
2278
+ password: string;
2279
+ host: string;
2280
+ user: string;
2281
+ database: string;
2282
+ sshEnabled?: boolean | undefined;
2283
+ sshHost?: string | undefined;
2284
+ sshPort?: string | undefined;
2285
+ sshUser?: string | undefined;
2286
+ port?: string | undefined;
2287
+ sslEnabled?: boolean | undefined;
2288
+ caCertificateName?: string | undefined;
2289
+ caCertificateText?: string | undefined;
2290
+ authMethod?: "username-and-password" | undefined;
2291
+ } | {
2292
+ host: string;
2293
+ database: string;
2294
+ authMethod: "iam-role";
2295
+ roleArn: string;
2296
+ roleExternalId: string;
2297
+ roleNonce: string;
2298
+ sshEnabled?: boolean | undefined;
2299
+ sshHost?: string | undefined;
2300
+ sshPort?: string | undefined;
2301
+ sshUser?: string | undefined;
2302
+ port?: string | undefined;
2303
+ sslEnabled?: boolean | undefined;
2304
+ caCertificateName?: string | undefined;
2305
+ caCertificateText?: string | undefined;
2306
+ } | {
2307
+ host: string;
2308
+ database: string;
2309
+ authMethod: "individual-credentials";
2310
+ sshEnabled?: boolean | undefined;
2311
+ sshHost?: string | undefined;
2312
+ sshPort?: string | undefined;
2313
+ sshUser?: string | undefined;
2314
+ port?: string | undefined;
2315
+ sslEnabled?: boolean | undefined;
2316
+ caCertificateName?: string | undefined;
2317
+ caCertificateText?: string | undefined;
2318
+ }, unknown>;
2278
2319
  readonly snowflake: z.ZodDiscriminatedUnion<"authMethod", [z.ZodObject<{
2279
2320
  accountName: z.ZodString;
2280
2321
  warehouse: z.ZodOptional<z.ZodString>;
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.discriminatedUnion("authMethod", [
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(),
@@ -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);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deepnote/database-integrations",
3
- "version": "1.3.1",
3
+ "version": "1.3.2",
4
4
  "description": "Deepnote database integration definitions",
5
5
  "keywords": [],
6
6
  "repository": {