@deepnote/database-integrations 1.3.4 → 1.4.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.js CHANGED
@@ -19,7 +19,7 @@ const BigQueryAuthMethods = {
19
19
  };
20
20
  const TrinoAuthMethods = {
21
21
  Password: "password",
22
- Oauth: "oauth"
22
+ Oauth: "trino-oauth"
23
23
  };
24
24
  const DatabaseAuthMethods = {
25
25
  UsernameAndPassword: "username-and-password",
@@ -150,11 +150,21 @@ const commonSnowflakeMetadataSchema = z.object({
150
150
  accountName: z.string(),
151
151
  warehouse: z.string().optional(),
152
152
  database: z.string().optional(),
153
- role: z.string().optional()
153
+ role: z.string().optional(),
154
+ dbt: z.boolean().optional(),
155
+ dbtServiceToken: z.string().optional(),
156
+ dbtPrimaryJobId: z.string().optional(),
157
+ dbtProxyServerUrl: z.string().optional()
154
158
  });
155
- const snowflakeMetadataSchema = z.discriminatedUnion("authMethod", [
159
+ const snowflakeMetadataSchema = z.preprocess((data) => {
160
+ if (typeof data === "object" && data !== null && (!("authMethod" in data) || !data.authMethod)) return {
161
+ ...data,
162
+ authMethod: SnowflakeAuthMethods.Password
163
+ };
164
+ return data;
165
+ }, z.discriminatedUnion("authMethod", [
156
166
  commonSnowflakeMetadataSchema.extend({
157
- authMethod: z.literal(SnowflakeAuthMethods.Password),
167
+ authMethod: z.literal(SnowflakeAuthMethods.Password).optional(),
158
168
  username: z.string(),
159
169
  password: z.string()
160
170
  }),
@@ -185,7 +195,7 @@ const snowflakeMetadataSchema = z.discriminatedUnion("authMethod", [
185
195
  privateKey: z.string(),
186
196
  privateKeyPassphrase: z.string().optional()
187
197
  })
188
- ]);
198
+ ]));
189
199
  const spannerMetadataSchema = z.object({
190
200
  service_account: z.string(),
191
201
  dataBoostEnabled: z.boolean(),
@@ -205,6 +215,7 @@ const trinoBaseMetadataSchema = z.object({
205
215
  caCertificateText: z.string().optional()
206
216
  });
207
217
  const trinoUsernamePasswordMetadataSchema = trinoBaseMetadataSchema.extend({
218
+ authMethod: z.literal(TrinoAuthMethods.Password).nullish(),
208
219
  user: z.string(),
209
220
  password: z.string()
210
221
  });
@@ -215,11 +226,7 @@ const trinoOAuthMetadataSchema = trinoBaseMetadataSchema.extend({
215
226
  authUrl: z.string().url(),
216
227
  tokenUrl: z.string().url()
217
228
  });
218
- const trinoMetadataSchema = z.discriminatedUnion("authMethod", [
219
- trinoUsernamePasswordMetadataSchema.extend({ authMethod: z.literal(null) }),
220
- trinoUsernamePasswordMetadataSchema.extend({ authMethod: z.literal(TrinoAuthMethods.Password) }),
221
- trinoOAuthMetadataSchema
222
- ]);
229
+ const trinoMetadataSchema = z.discriminatedUnion("authMethod", [trinoUsernamePasswordMetadataSchema, trinoOAuthMetadataSchema]);
223
230
  const commonDatabaseSchema = z.object({
224
231
  host: z.string(),
225
232
  user: z.string(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deepnote/database-integrations",
3
- "version": "1.3.4",
3
+ "version": "1.4.0",
4
4
  "description": "Deepnote database integration definitions",
5
5
  "keywords": [],
6
6
  "repository": {