@deepnote/database-integrations 1.3.2 → 1.3.4

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
@@ -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,13 +55,14 @@ 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);
58
63
  }
59
64
  function isFederatedAuthMetadata(metadata) {
60
- return isFederatedAuthMethod(metadata.authMethod);
65
+ return metadata.authMethod !== void 0 && isFederatedAuthMethod(metadata.authMethod);
61
66
  }
62
67
 
63
68
  //#endregion
@@ -70,7 +75,7 @@ const athenaMetadataSchema = zod.z.object({
70
75
  workgroup: zod.z.string().optional()
71
76
  });
72
77
  const bigqueryMetadataSchema = zod.z.discriminatedUnion("authMethod", [zod.z.object({
73
- authMethod: zod.z.literal(BigQueryAuthMethods.ServiceAccount),
78
+ authMethod: zod.z.literal(BigQueryAuthMethods.ServiceAccount).optional(),
74
79
  service_account: zod.z.string()
75
80
  }), zod.z.object({
76
81
  authMethod: zod.z.literal(BigQueryAuthMethods.GoogleOauth),
@@ -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 trinoMetadataSchema = zod.z.object({
219
+ const trinoBaseMetadataSchema = zod.z.object({
215
220
  host: zod.z.string(),
216
- user: zod.z.string(),
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;
package/dist/index.d.cts CHANGED
@@ -152,14 +152,14 @@ declare const databaseIntegrationConfigSchema: z$1.ZodDiscriminatedUnion<"type",
152
152
  } & {
153
153
  type: z$1.ZodLiteral<"big-query">;
154
154
  metadata: z$1.ZodDiscriminatedUnion<"authMethod", [z$1.ZodObject<{
155
- authMethod: z$1.ZodLiteral<"service-account">;
155
+ authMethod: z$1.ZodOptional<z$1.ZodLiteral<"service-account">>;
156
156
  service_account: z$1.ZodString;
157
157
  }, "strip", z$1.ZodTypeAny, {
158
- authMethod: "service-account";
159
158
  service_account: string;
159
+ authMethod?: "service-account" | undefined;
160
160
  }, {
161
- authMethod: "service-account";
162
161
  service_account: string;
162
+ authMethod?: "service-account" | undefined;
163
163
  }>, z$1.ZodObject<{
164
164
  authMethod: z$1.ZodLiteral<"google-oauth">;
165
165
  project: z$1.ZodString;
@@ -182,8 +182,8 @@ declare const databaseIntegrationConfigSchema: z$1.ZodDiscriminatedUnion<"type",
182
182
  id: string;
183
183
  name: string;
184
184
  metadata: {
185
- authMethod: "service-account";
186
185
  service_account: string;
186
+ authMethod?: "service-account" | undefined;
187
187
  } | {
188
188
  authMethod: "google-oauth";
189
189
  project: string;
@@ -196,8 +196,8 @@ declare const databaseIntegrationConfigSchema: z$1.ZodDiscriminatedUnion<"type",
196
196
  id: string;
197
197
  name: string;
198
198
  metadata: {
199
- authMethod: "service-account";
200
199
  service_account: string;
200
+ authMethod?: "service-account" | undefined;
201
201
  } | {
202
202
  authMethod: "google-oauth";
203
203
  project: string;
@@ -1612,12 +1612,54 @@ declare const databaseIntegrationConfigSchema: z$1.ZodDiscriminatedUnion<"type",
1612
1612
  name: z$1.ZodString;
1613
1613
  } & {
1614
1614
  type: z$1.ZodLiteral<"trino">;
1615
- metadata: z$1.ZodObject<{
1615
+ metadata: z$1.ZodDiscriminatedUnion<"authMethod", [z$1.ZodObject<{
1616
1616
  host: z$1.ZodString;
1617
+ port: z$1.ZodOptional<z$1.ZodString>;
1618
+ database: z$1.ZodString;
1619
+ sshEnabled: z$1.ZodOptional<z$1.ZodBoolean>;
1620
+ sshHost: z$1.ZodOptional<z$1.ZodString>;
1621
+ sshPort: z$1.ZodOptional<z$1.ZodString>;
1622
+ sshUser: z$1.ZodOptional<z$1.ZodString>;
1623
+ sslEnabled: z$1.ZodOptional<z$1.ZodBoolean>;
1624
+ caCertificateName: z$1.ZodOptional<z$1.ZodString>;
1625
+ caCertificateText: z$1.ZodOptional<z$1.ZodString>;
1626
+ } & {
1617
1627
  user: z$1.ZodString;
1618
1628
  password: z$1.ZodString;
1629
+ } & {
1630
+ authMethod: z$1.ZodLiteral<null>;
1631
+ }, "strip", z$1.ZodTypeAny, {
1632
+ password: string;
1633
+ host: string;
1634
+ user: string;
1635
+ database: string;
1636
+ authMethod: null;
1637
+ sshEnabled?: boolean | undefined;
1638
+ sshHost?: string | undefined;
1639
+ sshPort?: string | undefined;
1640
+ sshUser?: string | undefined;
1641
+ port?: string | undefined;
1642
+ sslEnabled?: boolean | undefined;
1643
+ caCertificateName?: string | undefined;
1644
+ caCertificateText?: string | undefined;
1645
+ }, {
1646
+ password: string;
1647
+ host: string;
1648
+ user: string;
1649
+ database: string;
1650
+ authMethod: null;
1651
+ sshEnabled?: boolean | undefined;
1652
+ sshHost?: string | undefined;
1653
+ sshPort?: string | undefined;
1654
+ sshUser?: string | undefined;
1655
+ port?: string | undefined;
1656
+ sslEnabled?: boolean | undefined;
1657
+ caCertificateName?: string | undefined;
1658
+ caCertificateText?: string | undefined;
1659
+ }>, z$1.ZodObject<{
1660
+ host: z$1.ZodString;
1661
+ port: z$1.ZodOptional<z$1.ZodString>;
1619
1662
  database: z$1.ZodString;
1620
- port: z$1.ZodString;
1621
1663
  sshEnabled: z$1.ZodOptional<z$1.ZodBoolean>;
1622
1664
  sshHost: z$1.ZodOptional<z$1.ZodString>;
1623
1665
  sshPort: z$1.ZodOptional<z$1.ZodString>;
@@ -1625,16 +1667,22 @@ declare const databaseIntegrationConfigSchema: z$1.ZodDiscriminatedUnion<"type",
1625
1667
  sslEnabled: z$1.ZodOptional<z$1.ZodBoolean>;
1626
1668
  caCertificateName: z$1.ZodOptional<z$1.ZodString>;
1627
1669
  caCertificateText: z$1.ZodOptional<z$1.ZodString>;
1670
+ } & {
1671
+ user: z$1.ZodString;
1672
+ password: z$1.ZodString;
1673
+ } & {
1674
+ authMethod: z$1.ZodLiteral<"password">;
1628
1675
  }, "strip", z$1.ZodTypeAny, {
1629
1676
  password: string;
1630
1677
  host: string;
1631
1678
  user: string;
1632
1679
  database: string;
1633
- port: string;
1680
+ authMethod: "password";
1634
1681
  sshEnabled?: boolean | undefined;
1635
1682
  sshHost?: string | undefined;
1636
1683
  sshPort?: string | undefined;
1637
1684
  sshUser?: string | undefined;
1685
+ port?: string | undefined;
1638
1686
  sslEnabled?: boolean | undefined;
1639
1687
  caCertificateName?: string | undefined;
1640
1688
  caCertificateText?: string | undefined;
@@ -1643,15 +1691,65 @@ declare const databaseIntegrationConfigSchema: z$1.ZodDiscriminatedUnion<"type",
1643
1691
  host: string;
1644
1692
  user: string;
1645
1693
  database: string;
1646
- port: string;
1694
+ authMethod: "password";
1647
1695
  sshEnabled?: boolean | undefined;
1648
1696
  sshHost?: string | undefined;
1649
1697
  sshPort?: string | undefined;
1650
1698
  sshUser?: string | undefined;
1699
+ port?: string | undefined;
1651
1700
  sslEnabled?: boolean | undefined;
1652
1701
  caCertificateName?: string | undefined;
1653
1702
  caCertificateText?: string | undefined;
1654
- }>;
1703
+ }>, z$1.ZodObject<{
1704
+ host: z$1.ZodString;
1705
+ port: z$1.ZodOptional<z$1.ZodString>;
1706
+ database: z$1.ZodString;
1707
+ sshEnabled: z$1.ZodOptional<z$1.ZodBoolean>;
1708
+ sshHost: z$1.ZodOptional<z$1.ZodString>;
1709
+ sshPort: z$1.ZodOptional<z$1.ZodString>;
1710
+ sshUser: z$1.ZodOptional<z$1.ZodString>;
1711
+ sslEnabled: z$1.ZodOptional<z$1.ZodBoolean>;
1712
+ caCertificateName: z$1.ZodOptional<z$1.ZodString>;
1713
+ caCertificateText: z$1.ZodOptional<z$1.ZodString>;
1714
+ } & {
1715
+ authMethod: z$1.ZodLiteral<"oauth">;
1716
+ clientId: z$1.ZodString;
1717
+ clientSecret: z$1.ZodString;
1718
+ authUrl: z$1.ZodString;
1719
+ tokenUrl: z$1.ZodString;
1720
+ }, "strip", z$1.ZodTypeAny, {
1721
+ host: string;
1722
+ database: string;
1723
+ authMethod: "oauth";
1724
+ clientId: string;
1725
+ clientSecret: string;
1726
+ authUrl: string;
1727
+ tokenUrl: string;
1728
+ sshEnabled?: boolean | undefined;
1729
+ sshHost?: string | undefined;
1730
+ sshPort?: string | undefined;
1731
+ sshUser?: string | undefined;
1732
+ port?: string | undefined;
1733
+ sslEnabled?: boolean | undefined;
1734
+ caCertificateName?: string | undefined;
1735
+ caCertificateText?: string | undefined;
1736
+ }, {
1737
+ host: string;
1738
+ database: string;
1739
+ authMethod: "oauth";
1740
+ clientId: string;
1741
+ clientSecret: string;
1742
+ authUrl: string;
1743
+ tokenUrl: string;
1744
+ sshEnabled?: boolean | undefined;
1745
+ sshHost?: string | undefined;
1746
+ sshPort?: string | undefined;
1747
+ sshUser?: string | undefined;
1748
+ port?: string | undefined;
1749
+ sslEnabled?: boolean | undefined;
1750
+ caCertificateName?: string | undefined;
1751
+ caCertificateText?: string | undefined;
1752
+ }>]>;
1655
1753
  federated_auth_method: z$1.ZodOptional<z$1.ZodNull>;
1656
1754
  }, "strip", z$1.ZodTypeAny, {
1657
1755
  type: "trino";
@@ -1662,11 +1760,42 @@ declare const databaseIntegrationConfigSchema: z$1.ZodDiscriminatedUnion<"type",
1662
1760
  host: string;
1663
1761
  user: string;
1664
1762
  database: string;
1665
- port: string;
1763
+ authMethod: null;
1666
1764
  sshEnabled?: boolean | undefined;
1667
1765
  sshHost?: string | undefined;
1668
1766
  sshPort?: string | undefined;
1669
1767
  sshUser?: string | undefined;
1768
+ port?: string | undefined;
1769
+ sslEnabled?: boolean | undefined;
1770
+ caCertificateName?: string | undefined;
1771
+ caCertificateText?: string | undefined;
1772
+ } | {
1773
+ password: string;
1774
+ host: string;
1775
+ user: string;
1776
+ database: string;
1777
+ authMethod: "password";
1778
+ sshEnabled?: boolean | undefined;
1779
+ sshHost?: string | undefined;
1780
+ sshPort?: string | undefined;
1781
+ sshUser?: string | undefined;
1782
+ port?: string | undefined;
1783
+ sslEnabled?: boolean | undefined;
1784
+ caCertificateName?: string | undefined;
1785
+ caCertificateText?: string | undefined;
1786
+ } | {
1787
+ host: string;
1788
+ database: string;
1789
+ authMethod: "oauth";
1790
+ clientId: string;
1791
+ clientSecret: string;
1792
+ authUrl: string;
1793
+ tokenUrl: string;
1794
+ sshEnabled?: boolean | undefined;
1795
+ sshHost?: string | undefined;
1796
+ sshPort?: string | undefined;
1797
+ sshUser?: string | undefined;
1798
+ port?: string | undefined;
1670
1799
  sslEnabled?: boolean | undefined;
1671
1800
  caCertificateName?: string | undefined;
1672
1801
  caCertificateText?: string | undefined;
@@ -1681,11 +1810,42 @@ declare const databaseIntegrationConfigSchema: z$1.ZodDiscriminatedUnion<"type",
1681
1810
  host: string;
1682
1811
  user: string;
1683
1812
  database: string;
1684
- port: string;
1813
+ authMethod: null;
1814
+ sshEnabled?: boolean | undefined;
1815
+ sshHost?: string | undefined;
1816
+ sshPort?: string | undefined;
1817
+ sshUser?: string | undefined;
1818
+ port?: string | undefined;
1819
+ sslEnabled?: boolean | undefined;
1820
+ caCertificateName?: string | undefined;
1821
+ caCertificateText?: string | undefined;
1822
+ } | {
1823
+ password: string;
1824
+ host: string;
1825
+ user: string;
1826
+ database: string;
1827
+ authMethod: "password";
1828
+ sshEnabled?: boolean | undefined;
1829
+ sshHost?: string | undefined;
1830
+ sshPort?: string | undefined;
1831
+ sshUser?: string | undefined;
1832
+ port?: string | undefined;
1833
+ sslEnabled?: boolean | undefined;
1834
+ caCertificateName?: string | undefined;
1835
+ caCertificateText?: string | undefined;
1836
+ } | {
1837
+ host: string;
1838
+ database: string;
1839
+ authMethod: "oauth";
1840
+ clientId: string;
1841
+ clientSecret: string;
1842
+ authUrl: string;
1843
+ tokenUrl: string;
1685
1844
  sshEnabled?: boolean | undefined;
1686
1845
  sshHost?: string | undefined;
1687
1846
  sshPort?: string | undefined;
1688
1847
  sshUser?: string | undefined;
1848
+ port?: string | undefined;
1689
1849
  sslEnabled?: boolean | undefined;
1690
1850
  caCertificateName?: string | undefined;
1691
1851
  caCertificateText?: string | undefined;
@@ -1760,14 +1920,14 @@ declare const databaseMetadataSchemasByType: {
1760
1920
  workgroup?: string | undefined;
1761
1921
  }>;
1762
1922
  readonly 'big-query': z.ZodDiscriminatedUnion<"authMethod", [z.ZodObject<{
1763
- authMethod: z.ZodLiteral<"service-account">;
1923
+ authMethod: z.ZodOptional<z.ZodLiteral<"service-account">>;
1764
1924
  service_account: z.ZodString;
1765
1925
  }, "strip", z.ZodTypeAny, {
1766
- authMethod: "service-account";
1767
1926
  service_account: string;
1927
+ authMethod?: "service-account" | undefined;
1768
1928
  }, {
1769
- authMethod: "service-account";
1770
1929
  service_account: string;
1930
+ authMethod?: "service-account" | undefined;
1771
1931
  }>, z.ZodObject<{
1772
1932
  authMethod: z.ZodLiteral<"google-oauth">;
1773
1933
  project: z.ZodString;
@@ -2527,12 +2687,54 @@ declare const databaseMetadataSchemasByType: {
2527
2687
  sshPort?: string | undefined;
2528
2688
  sshUser?: string | undefined;
2529
2689
  }>;
2530
- readonly trino: z.ZodObject<{
2690
+ readonly trino: z.ZodDiscriminatedUnion<"authMethod", [z.ZodObject<{
2531
2691
  host: z.ZodString;
2692
+ port: z.ZodOptional<z.ZodString>;
2693
+ database: z.ZodString;
2694
+ sshEnabled: z.ZodOptional<z.ZodBoolean>;
2695
+ sshHost: z.ZodOptional<z.ZodString>;
2696
+ sshPort: z.ZodOptional<z.ZodString>;
2697
+ sshUser: z.ZodOptional<z.ZodString>;
2698
+ sslEnabled: z.ZodOptional<z.ZodBoolean>;
2699
+ caCertificateName: z.ZodOptional<z.ZodString>;
2700
+ caCertificateText: z.ZodOptional<z.ZodString>;
2701
+ } & {
2532
2702
  user: z.ZodString;
2533
2703
  password: z.ZodString;
2704
+ } & {
2705
+ authMethod: z.ZodLiteral<null>;
2706
+ }, "strip", z.ZodTypeAny, {
2707
+ password: string;
2708
+ host: string;
2709
+ user: string;
2710
+ database: string;
2711
+ authMethod: null;
2712
+ sshEnabled?: boolean | undefined;
2713
+ sshHost?: string | undefined;
2714
+ sshPort?: string | undefined;
2715
+ sshUser?: string | undefined;
2716
+ port?: string | undefined;
2717
+ sslEnabled?: boolean | undefined;
2718
+ caCertificateName?: string | undefined;
2719
+ caCertificateText?: string | undefined;
2720
+ }, {
2721
+ password: string;
2722
+ host: string;
2723
+ user: string;
2724
+ database: string;
2725
+ authMethod: null;
2726
+ sshEnabled?: boolean | undefined;
2727
+ sshHost?: string | undefined;
2728
+ sshPort?: string | undefined;
2729
+ sshUser?: string | undefined;
2730
+ port?: string | undefined;
2731
+ sslEnabled?: boolean | undefined;
2732
+ caCertificateName?: string | undefined;
2733
+ caCertificateText?: string | undefined;
2734
+ }>, z.ZodObject<{
2735
+ host: z.ZodString;
2736
+ port: z.ZodOptional<z.ZodString>;
2534
2737
  database: z.ZodString;
2535
- port: z.ZodString;
2536
2738
  sshEnabled: z.ZodOptional<z.ZodBoolean>;
2537
2739
  sshHost: z.ZodOptional<z.ZodString>;
2538
2740
  sshPort: z.ZodOptional<z.ZodString>;
@@ -2540,16 +2742,22 @@ declare const databaseMetadataSchemasByType: {
2540
2742
  sslEnabled: z.ZodOptional<z.ZodBoolean>;
2541
2743
  caCertificateName: z.ZodOptional<z.ZodString>;
2542
2744
  caCertificateText: z.ZodOptional<z.ZodString>;
2745
+ } & {
2746
+ user: z.ZodString;
2747
+ password: z.ZodString;
2748
+ } & {
2749
+ authMethod: z.ZodLiteral<"password">;
2543
2750
  }, "strip", z.ZodTypeAny, {
2544
2751
  password: string;
2545
2752
  host: string;
2546
2753
  user: string;
2547
2754
  database: string;
2548
- port: string;
2755
+ authMethod: "password";
2549
2756
  sshEnabled?: boolean | undefined;
2550
2757
  sshHost?: string | undefined;
2551
2758
  sshPort?: string | undefined;
2552
2759
  sshUser?: string | undefined;
2760
+ port?: string | undefined;
2553
2761
  sslEnabled?: boolean | undefined;
2554
2762
  caCertificateName?: string | undefined;
2555
2763
  caCertificateText?: string | undefined;
@@ -2558,15 +2766,65 @@ declare const databaseMetadataSchemasByType: {
2558
2766
  host: string;
2559
2767
  user: string;
2560
2768
  database: string;
2561
- port: string;
2769
+ authMethod: "password";
2562
2770
  sshEnabled?: boolean | undefined;
2563
2771
  sshHost?: string | undefined;
2564
2772
  sshPort?: string | undefined;
2565
2773
  sshUser?: string | undefined;
2774
+ port?: string | undefined;
2566
2775
  sslEnabled?: boolean | undefined;
2567
2776
  caCertificateName?: string | undefined;
2568
2777
  caCertificateText?: string | undefined;
2569
- }>;
2778
+ }>, z.ZodObject<{
2779
+ host: z.ZodString;
2780
+ port: z.ZodOptional<z.ZodString>;
2781
+ database: z.ZodString;
2782
+ sshEnabled: z.ZodOptional<z.ZodBoolean>;
2783
+ sshHost: z.ZodOptional<z.ZodString>;
2784
+ sshPort: z.ZodOptional<z.ZodString>;
2785
+ sshUser: z.ZodOptional<z.ZodString>;
2786
+ sslEnabled: z.ZodOptional<z.ZodBoolean>;
2787
+ caCertificateName: z.ZodOptional<z.ZodString>;
2788
+ caCertificateText: z.ZodOptional<z.ZodString>;
2789
+ } & {
2790
+ authMethod: z.ZodLiteral<"oauth">;
2791
+ clientId: z.ZodString;
2792
+ clientSecret: z.ZodString;
2793
+ authUrl: z.ZodString;
2794
+ tokenUrl: z.ZodString;
2795
+ }, "strip", z.ZodTypeAny, {
2796
+ host: string;
2797
+ database: string;
2798
+ authMethod: "oauth";
2799
+ clientId: string;
2800
+ clientSecret: string;
2801
+ authUrl: string;
2802
+ tokenUrl: string;
2803
+ sshEnabled?: boolean | undefined;
2804
+ sshHost?: string | undefined;
2805
+ sshPort?: string | undefined;
2806
+ sshUser?: string | undefined;
2807
+ port?: string | undefined;
2808
+ sslEnabled?: boolean | undefined;
2809
+ caCertificateName?: string | undefined;
2810
+ caCertificateText?: string | undefined;
2811
+ }, {
2812
+ host: string;
2813
+ database: string;
2814
+ authMethod: "oauth";
2815
+ clientId: string;
2816
+ clientSecret: string;
2817
+ authUrl: string;
2818
+ tokenUrl: string;
2819
+ sshEnabled?: boolean | undefined;
2820
+ sshHost?: string | undefined;
2821
+ sshPort?: string | undefined;
2822
+ sshUser?: string | undefined;
2823
+ port?: string | undefined;
2824
+ sslEnabled?: boolean | undefined;
2825
+ caCertificateName?: string | undefined;
2826
+ caCertificateText?: string | undefined;
2827
+ }>]>;
2570
2828
  };
2571
2829
  type DatabaseIntegrationMetadataByType = { [integrationType in DatabaseIntegrationType]: z.infer<(typeof databaseMetadataSchemasByType)[integrationType]> };
2572
2830
  //#endregion
@@ -2652,16 +2910,21 @@ declare const BigQueryAuthMethods: {
2652
2910
  readonly GoogleOauth: "google-oauth";
2653
2911
  };
2654
2912
  type BigQueryAuthMethod = (typeof BigQueryAuthMethods)[keyof typeof BigQueryAuthMethods];
2913
+ declare const TrinoAuthMethods: {
2914
+ readonly Password: "password";
2915
+ readonly Oauth: "oauth";
2916
+ };
2917
+ type TrinoAuthMethod = (typeof TrinoAuthMethods)[keyof typeof TrinoAuthMethods];
2655
2918
  declare const DatabaseAuthMethods: {
2656
2919
  readonly UsernameAndPassword: "username-and-password";
2657
2920
  readonly IndividualCredentials: "individual-credentials";
2658
2921
  };
2659
2922
  type DatabaseAuthMethod = (typeof DatabaseAuthMethods)[keyof typeof DatabaseAuthMethods];
2660
- declare const federatedAuthMethods: readonly ["okta", "snowflake", "azure", "key-pair", "google-oauth", "individual-credentials"];
2923
+ declare const federatedAuthMethods: readonly ["okta", "snowflake", "azure", "key-pair", "google-oauth", "individual-credentials", "oauth"];
2661
2924
  type FederatedAuthMethod = (typeof federatedAuthMethods)[number];
2662
2925
  declare function isFederatedAuthMethod(authMethod: string): authMethod is FederatedAuthMethod;
2663
2926
  declare function isFederatedAuthMetadata<M extends {
2664
- authMethod: string;
2927
+ authMethod?: string;
2665
2928
  }>(metadata: M): metadata is Extract<M, {
2666
2929
  authMethod: FederatedAuthMethod;
2667
2930
  }>;
@@ -2683,4 +2946,4 @@ interface SnowflakeKeyPair {
2683
2946
  username: string;
2684
2947
  }
2685
2948
  //#endregion
2686
- export { type AwsAuthMethod, AwsAuthMethods, type BigQueryAuthMethod, BigQueryAuthMethods, BigQueryServiceAccountParseError, type DatabaseAuthMethod, DatabaseAuthMethods, type DatabaseIntegrationConfig, type DatabaseIntegrationMetadataByType, type DatabaseIntegrationType, type DatabaseIntegrationTypeWithSslSupport, type EnvVar, type FederatedAuthMethod, type SnowflakeAuthMethod, SnowflakeAuthMethods, SpannerServiceAccountParseError, type SqlAlchemyInput, type SqlIntegrationConfig, type SqlIntegrationType, databaseIntegrationConfigSchema, databaseIntegrationTypes, databaseIntegrationTypesWithSslSupport, databaseMetadataSchemasByType, federatedAuthMethods, getEnvironmentVariablesForIntegrations, getSnowflakeFederatedAuthSqlAlchemyInput, getSqlAlchemyInput, isDatabaseIntegrationType, isDatabaseIntegrationTypeWithSslSupport, isFederatedAuthMetadata, isFederatedAuthMethod, isSqlIntegrationType, sqlIntegrationTypes };
2949
+ export { type AwsAuthMethod, AwsAuthMethods, type BigQueryAuthMethod, BigQueryAuthMethods, BigQueryServiceAccountParseError, type DatabaseAuthMethod, DatabaseAuthMethods, type DatabaseIntegrationConfig, type DatabaseIntegrationMetadataByType, type DatabaseIntegrationType, type DatabaseIntegrationTypeWithSslSupport, type EnvVar, type FederatedAuthMethod, type SnowflakeAuthMethod, SnowflakeAuthMethods, SpannerServiceAccountParseError, type SqlAlchemyInput, type SqlIntegrationConfig, type SqlIntegrationType, type TrinoAuthMethod, TrinoAuthMethods, databaseIntegrationConfigSchema, databaseIntegrationTypes, databaseIntegrationTypesWithSslSupport, databaseMetadataSchemasByType, federatedAuthMethods, getEnvironmentVariablesForIntegrations, getSnowflakeFederatedAuthSqlAlchemyInput, getSqlAlchemyInput, isDatabaseIntegrationType, isDatabaseIntegrationTypeWithSslSupport, isFederatedAuthMetadata, isFederatedAuthMethod, isSqlIntegrationType, sqlIntegrationTypes };
package/dist/index.d.ts CHANGED
@@ -152,14 +152,14 @@ declare const databaseIntegrationConfigSchema: z$1.ZodDiscriminatedUnion<"type",
152
152
  } & {
153
153
  type: z$1.ZodLiteral<"big-query">;
154
154
  metadata: z$1.ZodDiscriminatedUnion<"authMethod", [z$1.ZodObject<{
155
- authMethod: z$1.ZodLiteral<"service-account">;
155
+ authMethod: z$1.ZodOptional<z$1.ZodLiteral<"service-account">>;
156
156
  service_account: z$1.ZodString;
157
157
  }, "strip", z$1.ZodTypeAny, {
158
- authMethod: "service-account";
159
158
  service_account: string;
159
+ authMethod?: "service-account" | undefined;
160
160
  }, {
161
- authMethod: "service-account";
162
161
  service_account: string;
162
+ authMethod?: "service-account" | undefined;
163
163
  }>, z$1.ZodObject<{
164
164
  authMethod: z$1.ZodLiteral<"google-oauth">;
165
165
  project: z$1.ZodString;
@@ -182,8 +182,8 @@ declare const databaseIntegrationConfigSchema: z$1.ZodDiscriminatedUnion<"type",
182
182
  id: string;
183
183
  name: string;
184
184
  metadata: {
185
- authMethod: "service-account";
186
185
  service_account: string;
186
+ authMethod?: "service-account" | undefined;
187
187
  } | {
188
188
  authMethod: "google-oauth";
189
189
  project: string;
@@ -196,8 +196,8 @@ declare const databaseIntegrationConfigSchema: z$1.ZodDiscriminatedUnion<"type",
196
196
  id: string;
197
197
  name: string;
198
198
  metadata: {
199
- authMethod: "service-account";
200
199
  service_account: string;
200
+ authMethod?: "service-account" | undefined;
201
201
  } | {
202
202
  authMethod: "google-oauth";
203
203
  project: string;
@@ -1612,12 +1612,54 @@ declare const databaseIntegrationConfigSchema: z$1.ZodDiscriminatedUnion<"type",
1612
1612
  name: z$1.ZodString;
1613
1613
  } & {
1614
1614
  type: z$1.ZodLiteral<"trino">;
1615
- metadata: z$1.ZodObject<{
1615
+ metadata: z$1.ZodDiscriminatedUnion<"authMethod", [z$1.ZodObject<{
1616
1616
  host: z$1.ZodString;
1617
+ port: z$1.ZodOptional<z$1.ZodString>;
1618
+ database: z$1.ZodString;
1619
+ sshEnabled: z$1.ZodOptional<z$1.ZodBoolean>;
1620
+ sshHost: z$1.ZodOptional<z$1.ZodString>;
1621
+ sshPort: z$1.ZodOptional<z$1.ZodString>;
1622
+ sshUser: z$1.ZodOptional<z$1.ZodString>;
1623
+ sslEnabled: z$1.ZodOptional<z$1.ZodBoolean>;
1624
+ caCertificateName: z$1.ZodOptional<z$1.ZodString>;
1625
+ caCertificateText: z$1.ZodOptional<z$1.ZodString>;
1626
+ } & {
1617
1627
  user: z$1.ZodString;
1618
1628
  password: z$1.ZodString;
1629
+ } & {
1630
+ authMethod: z$1.ZodLiteral<null>;
1631
+ }, "strip", z$1.ZodTypeAny, {
1632
+ password: string;
1633
+ host: string;
1634
+ user: string;
1635
+ database: string;
1636
+ authMethod: null;
1637
+ sshEnabled?: boolean | undefined;
1638
+ sshHost?: string | undefined;
1639
+ sshPort?: string | undefined;
1640
+ sshUser?: string | undefined;
1641
+ port?: string | undefined;
1642
+ sslEnabled?: boolean | undefined;
1643
+ caCertificateName?: string | undefined;
1644
+ caCertificateText?: string | undefined;
1645
+ }, {
1646
+ password: string;
1647
+ host: string;
1648
+ user: string;
1649
+ database: string;
1650
+ authMethod: null;
1651
+ sshEnabled?: boolean | undefined;
1652
+ sshHost?: string | undefined;
1653
+ sshPort?: string | undefined;
1654
+ sshUser?: string | undefined;
1655
+ port?: string | undefined;
1656
+ sslEnabled?: boolean | undefined;
1657
+ caCertificateName?: string | undefined;
1658
+ caCertificateText?: string | undefined;
1659
+ }>, z$1.ZodObject<{
1660
+ host: z$1.ZodString;
1661
+ port: z$1.ZodOptional<z$1.ZodString>;
1619
1662
  database: z$1.ZodString;
1620
- port: z$1.ZodString;
1621
1663
  sshEnabled: z$1.ZodOptional<z$1.ZodBoolean>;
1622
1664
  sshHost: z$1.ZodOptional<z$1.ZodString>;
1623
1665
  sshPort: z$1.ZodOptional<z$1.ZodString>;
@@ -1625,16 +1667,22 @@ declare const databaseIntegrationConfigSchema: z$1.ZodDiscriminatedUnion<"type",
1625
1667
  sslEnabled: z$1.ZodOptional<z$1.ZodBoolean>;
1626
1668
  caCertificateName: z$1.ZodOptional<z$1.ZodString>;
1627
1669
  caCertificateText: z$1.ZodOptional<z$1.ZodString>;
1670
+ } & {
1671
+ user: z$1.ZodString;
1672
+ password: z$1.ZodString;
1673
+ } & {
1674
+ authMethod: z$1.ZodLiteral<"password">;
1628
1675
  }, "strip", z$1.ZodTypeAny, {
1629
1676
  password: string;
1630
1677
  host: string;
1631
1678
  user: string;
1632
1679
  database: string;
1633
- port: string;
1680
+ authMethod: "password";
1634
1681
  sshEnabled?: boolean | undefined;
1635
1682
  sshHost?: string | undefined;
1636
1683
  sshPort?: string | undefined;
1637
1684
  sshUser?: string | undefined;
1685
+ port?: string | undefined;
1638
1686
  sslEnabled?: boolean | undefined;
1639
1687
  caCertificateName?: string | undefined;
1640
1688
  caCertificateText?: string | undefined;
@@ -1643,15 +1691,65 @@ declare const databaseIntegrationConfigSchema: z$1.ZodDiscriminatedUnion<"type",
1643
1691
  host: string;
1644
1692
  user: string;
1645
1693
  database: string;
1646
- port: string;
1694
+ authMethod: "password";
1647
1695
  sshEnabled?: boolean | undefined;
1648
1696
  sshHost?: string | undefined;
1649
1697
  sshPort?: string | undefined;
1650
1698
  sshUser?: string | undefined;
1699
+ port?: string | undefined;
1651
1700
  sslEnabled?: boolean | undefined;
1652
1701
  caCertificateName?: string | undefined;
1653
1702
  caCertificateText?: string | undefined;
1654
- }>;
1703
+ }>, z$1.ZodObject<{
1704
+ host: z$1.ZodString;
1705
+ port: z$1.ZodOptional<z$1.ZodString>;
1706
+ database: z$1.ZodString;
1707
+ sshEnabled: z$1.ZodOptional<z$1.ZodBoolean>;
1708
+ sshHost: z$1.ZodOptional<z$1.ZodString>;
1709
+ sshPort: z$1.ZodOptional<z$1.ZodString>;
1710
+ sshUser: z$1.ZodOptional<z$1.ZodString>;
1711
+ sslEnabled: z$1.ZodOptional<z$1.ZodBoolean>;
1712
+ caCertificateName: z$1.ZodOptional<z$1.ZodString>;
1713
+ caCertificateText: z$1.ZodOptional<z$1.ZodString>;
1714
+ } & {
1715
+ authMethod: z$1.ZodLiteral<"oauth">;
1716
+ clientId: z$1.ZodString;
1717
+ clientSecret: z$1.ZodString;
1718
+ authUrl: z$1.ZodString;
1719
+ tokenUrl: z$1.ZodString;
1720
+ }, "strip", z$1.ZodTypeAny, {
1721
+ host: string;
1722
+ database: string;
1723
+ authMethod: "oauth";
1724
+ clientId: string;
1725
+ clientSecret: string;
1726
+ authUrl: string;
1727
+ tokenUrl: string;
1728
+ sshEnabled?: boolean | undefined;
1729
+ sshHost?: string | undefined;
1730
+ sshPort?: string | undefined;
1731
+ sshUser?: string | undefined;
1732
+ port?: string | undefined;
1733
+ sslEnabled?: boolean | undefined;
1734
+ caCertificateName?: string | undefined;
1735
+ caCertificateText?: string | undefined;
1736
+ }, {
1737
+ host: string;
1738
+ database: string;
1739
+ authMethod: "oauth";
1740
+ clientId: string;
1741
+ clientSecret: string;
1742
+ authUrl: string;
1743
+ tokenUrl: string;
1744
+ sshEnabled?: boolean | undefined;
1745
+ sshHost?: string | undefined;
1746
+ sshPort?: string | undefined;
1747
+ sshUser?: string | undefined;
1748
+ port?: string | undefined;
1749
+ sslEnabled?: boolean | undefined;
1750
+ caCertificateName?: string | undefined;
1751
+ caCertificateText?: string | undefined;
1752
+ }>]>;
1655
1753
  federated_auth_method: z$1.ZodOptional<z$1.ZodNull>;
1656
1754
  }, "strip", z$1.ZodTypeAny, {
1657
1755
  type: "trino";
@@ -1662,11 +1760,42 @@ declare const databaseIntegrationConfigSchema: z$1.ZodDiscriminatedUnion<"type",
1662
1760
  host: string;
1663
1761
  user: string;
1664
1762
  database: string;
1665
- port: string;
1763
+ authMethod: null;
1666
1764
  sshEnabled?: boolean | undefined;
1667
1765
  sshHost?: string | undefined;
1668
1766
  sshPort?: string | undefined;
1669
1767
  sshUser?: string | undefined;
1768
+ port?: string | undefined;
1769
+ sslEnabled?: boolean | undefined;
1770
+ caCertificateName?: string | undefined;
1771
+ caCertificateText?: string | undefined;
1772
+ } | {
1773
+ password: string;
1774
+ host: string;
1775
+ user: string;
1776
+ database: string;
1777
+ authMethod: "password";
1778
+ sshEnabled?: boolean | undefined;
1779
+ sshHost?: string | undefined;
1780
+ sshPort?: string | undefined;
1781
+ sshUser?: string | undefined;
1782
+ port?: string | undefined;
1783
+ sslEnabled?: boolean | undefined;
1784
+ caCertificateName?: string | undefined;
1785
+ caCertificateText?: string | undefined;
1786
+ } | {
1787
+ host: string;
1788
+ database: string;
1789
+ authMethod: "oauth";
1790
+ clientId: string;
1791
+ clientSecret: string;
1792
+ authUrl: string;
1793
+ tokenUrl: string;
1794
+ sshEnabled?: boolean | undefined;
1795
+ sshHost?: string | undefined;
1796
+ sshPort?: string | undefined;
1797
+ sshUser?: string | undefined;
1798
+ port?: string | undefined;
1670
1799
  sslEnabled?: boolean | undefined;
1671
1800
  caCertificateName?: string | undefined;
1672
1801
  caCertificateText?: string | undefined;
@@ -1681,11 +1810,42 @@ declare const databaseIntegrationConfigSchema: z$1.ZodDiscriminatedUnion<"type",
1681
1810
  host: string;
1682
1811
  user: string;
1683
1812
  database: string;
1684
- port: string;
1813
+ authMethod: null;
1814
+ sshEnabled?: boolean | undefined;
1815
+ sshHost?: string | undefined;
1816
+ sshPort?: string | undefined;
1817
+ sshUser?: string | undefined;
1818
+ port?: string | undefined;
1819
+ sslEnabled?: boolean | undefined;
1820
+ caCertificateName?: string | undefined;
1821
+ caCertificateText?: string | undefined;
1822
+ } | {
1823
+ password: string;
1824
+ host: string;
1825
+ user: string;
1826
+ database: string;
1827
+ authMethod: "password";
1828
+ sshEnabled?: boolean | undefined;
1829
+ sshHost?: string | undefined;
1830
+ sshPort?: string | undefined;
1831
+ sshUser?: string | undefined;
1832
+ port?: string | undefined;
1833
+ sslEnabled?: boolean | undefined;
1834
+ caCertificateName?: string | undefined;
1835
+ caCertificateText?: string | undefined;
1836
+ } | {
1837
+ host: string;
1838
+ database: string;
1839
+ authMethod: "oauth";
1840
+ clientId: string;
1841
+ clientSecret: string;
1842
+ authUrl: string;
1843
+ tokenUrl: string;
1685
1844
  sshEnabled?: boolean | undefined;
1686
1845
  sshHost?: string | undefined;
1687
1846
  sshPort?: string | undefined;
1688
1847
  sshUser?: string | undefined;
1848
+ port?: string | undefined;
1689
1849
  sslEnabled?: boolean | undefined;
1690
1850
  caCertificateName?: string | undefined;
1691
1851
  caCertificateText?: string | undefined;
@@ -1760,14 +1920,14 @@ declare const databaseMetadataSchemasByType: {
1760
1920
  workgroup?: string | undefined;
1761
1921
  }>;
1762
1922
  readonly 'big-query': z.ZodDiscriminatedUnion<"authMethod", [z.ZodObject<{
1763
- authMethod: z.ZodLiteral<"service-account">;
1923
+ authMethod: z.ZodOptional<z.ZodLiteral<"service-account">>;
1764
1924
  service_account: z.ZodString;
1765
1925
  }, "strip", z.ZodTypeAny, {
1766
- authMethod: "service-account";
1767
1926
  service_account: string;
1927
+ authMethod?: "service-account" | undefined;
1768
1928
  }, {
1769
- authMethod: "service-account";
1770
1929
  service_account: string;
1930
+ authMethod?: "service-account" | undefined;
1771
1931
  }>, z.ZodObject<{
1772
1932
  authMethod: z.ZodLiteral<"google-oauth">;
1773
1933
  project: z.ZodString;
@@ -2527,12 +2687,54 @@ declare const databaseMetadataSchemasByType: {
2527
2687
  sshPort?: string | undefined;
2528
2688
  sshUser?: string | undefined;
2529
2689
  }>;
2530
- readonly trino: z.ZodObject<{
2690
+ readonly trino: z.ZodDiscriminatedUnion<"authMethod", [z.ZodObject<{
2531
2691
  host: z.ZodString;
2692
+ port: z.ZodOptional<z.ZodString>;
2693
+ database: z.ZodString;
2694
+ sshEnabled: z.ZodOptional<z.ZodBoolean>;
2695
+ sshHost: z.ZodOptional<z.ZodString>;
2696
+ sshPort: z.ZodOptional<z.ZodString>;
2697
+ sshUser: z.ZodOptional<z.ZodString>;
2698
+ sslEnabled: z.ZodOptional<z.ZodBoolean>;
2699
+ caCertificateName: z.ZodOptional<z.ZodString>;
2700
+ caCertificateText: z.ZodOptional<z.ZodString>;
2701
+ } & {
2532
2702
  user: z.ZodString;
2533
2703
  password: z.ZodString;
2704
+ } & {
2705
+ authMethod: z.ZodLiteral<null>;
2706
+ }, "strip", z.ZodTypeAny, {
2707
+ password: string;
2708
+ host: string;
2709
+ user: string;
2710
+ database: string;
2711
+ authMethod: null;
2712
+ sshEnabled?: boolean | undefined;
2713
+ sshHost?: string | undefined;
2714
+ sshPort?: string | undefined;
2715
+ sshUser?: string | undefined;
2716
+ port?: string | undefined;
2717
+ sslEnabled?: boolean | undefined;
2718
+ caCertificateName?: string | undefined;
2719
+ caCertificateText?: string | undefined;
2720
+ }, {
2721
+ password: string;
2722
+ host: string;
2723
+ user: string;
2724
+ database: string;
2725
+ authMethod: null;
2726
+ sshEnabled?: boolean | undefined;
2727
+ sshHost?: string | undefined;
2728
+ sshPort?: string | undefined;
2729
+ sshUser?: string | undefined;
2730
+ port?: string | undefined;
2731
+ sslEnabled?: boolean | undefined;
2732
+ caCertificateName?: string | undefined;
2733
+ caCertificateText?: string | undefined;
2734
+ }>, z.ZodObject<{
2735
+ host: z.ZodString;
2736
+ port: z.ZodOptional<z.ZodString>;
2534
2737
  database: z.ZodString;
2535
- port: z.ZodString;
2536
2738
  sshEnabled: z.ZodOptional<z.ZodBoolean>;
2537
2739
  sshHost: z.ZodOptional<z.ZodString>;
2538
2740
  sshPort: z.ZodOptional<z.ZodString>;
@@ -2540,16 +2742,22 @@ declare const databaseMetadataSchemasByType: {
2540
2742
  sslEnabled: z.ZodOptional<z.ZodBoolean>;
2541
2743
  caCertificateName: z.ZodOptional<z.ZodString>;
2542
2744
  caCertificateText: z.ZodOptional<z.ZodString>;
2745
+ } & {
2746
+ user: z.ZodString;
2747
+ password: z.ZodString;
2748
+ } & {
2749
+ authMethod: z.ZodLiteral<"password">;
2543
2750
  }, "strip", z.ZodTypeAny, {
2544
2751
  password: string;
2545
2752
  host: string;
2546
2753
  user: string;
2547
2754
  database: string;
2548
- port: string;
2755
+ authMethod: "password";
2549
2756
  sshEnabled?: boolean | undefined;
2550
2757
  sshHost?: string | undefined;
2551
2758
  sshPort?: string | undefined;
2552
2759
  sshUser?: string | undefined;
2760
+ port?: string | undefined;
2553
2761
  sslEnabled?: boolean | undefined;
2554
2762
  caCertificateName?: string | undefined;
2555
2763
  caCertificateText?: string | undefined;
@@ -2558,15 +2766,65 @@ declare const databaseMetadataSchemasByType: {
2558
2766
  host: string;
2559
2767
  user: string;
2560
2768
  database: string;
2561
- port: string;
2769
+ authMethod: "password";
2562
2770
  sshEnabled?: boolean | undefined;
2563
2771
  sshHost?: string | undefined;
2564
2772
  sshPort?: string | undefined;
2565
2773
  sshUser?: string | undefined;
2774
+ port?: string | undefined;
2566
2775
  sslEnabled?: boolean | undefined;
2567
2776
  caCertificateName?: string | undefined;
2568
2777
  caCertificateText?: string | undefined;
2569
- }>;
2778
+ }>, z.ZodObject<{
2779
+ host: z.ZodString;
2780
+ port: z.ZodOptional<z.ZodString>;
2781
+ database: z.ZodString;
2782
+ sshEnabled: z.ZodOptional<z.ZodBoolean>;
2783
+ sshHost: z.ZodOptional<z.ZodString>;
2784
+ sshPort: z.ZodOptional<z.ZodString>;
2785
+ sshUser: z.ZodOptional<z.ZodString>;
2786
+ sslEnabled: z.ZodOptional<z.ZodBoolean>;
2787
+ caCertificateName: z.ZodOptional<z.ZodString>;
2788
+ caCertificateText: z.ZodOptional<z.ZodString>;
2789
+ } & {
2790
+ authMethod: z.ZodLiteral<"oauth">;
2791
+ clientId: z.ZodString;
2792
+ clientSecret: z.ZodString;
2793
+ authUrl: z.ZodString;
2794
+ tokenUrl: z.ZodString;
2795
+ }, "strip", z.ZodTypeAny, {
2796
+ host: string;
2797
+ database: string;
2798
+ authMethod: "oauth";
2799
+ clientId: string;
2800
+ clientSecret: string;
2801
+ authUrl: string;
2802
+ tokenUrl: string;
2803
+ sshEnabled?: boolean | undefined;
2804
+ sshHost?: string | undefined;
2805
+ sshPort?: string | undefined;
2806
+ sshUser?: string | undefined;
2807
+ port?: string | undefined;
2808
+ sslEnabled?: boolean | undefined;
2809
+ caCertificateName?: string | undefined;
2810
+ caCertificateText?: string | undefined;
2811
+ }, {
2812
+ host: string;
2813
+ database: string;
2814
+ authMethod: "oauth";
2815
+ clientId: string;
2816
+ clientSecret: string;
2817
+ authUrl: string;
2818
+ tokenUrl: string;
2819
+ sshEnabled?: boolean | undefined;
2820
+ sshHost?: string | undefined;
2821
+ sshPort?: string | undefined;
2822
+ sshUser?: string | undefined;
2823
+ port?: string | undefined;
2824
+ sslEnabled?: boolean | undefined;
2825
+ caCertificateName?: string | undefined;
2826
+ caCertificateText?: string | undefined;
2827
+ }>]>;
2570
2828
  };
2571
2829
  type DatabaseIntegrationMetadataByType = { [integrationType in DatabaseIntegrationType]: z.infer<(typeof databaseMetadataSchemasByType)[integrationType]> };
2572
2830
  //#endregion
@@ -2652,16 +2910,21 @@ declare const BigQueryAuthMethods: {
2652
2910
  readonly GoogleOauth: "google-oauth";
2653
2911
  };
2654
2912
  type BigQueryAuthMethod = (typeof BigQueryAuthMethods)[keyof typeof BigQueryAuthMethods];
2913
+ declare const TrinoAuthMethods: {
2914
+ readonly Password: "password";
2915
+ readonly Oauth: "oauth";
2916
+ };
2917
+ type TrinoAuthMethod = (typeof TrinoAuthMethods)[keyof typeof TrinoAuthMethods];
2655
2918
  declare const DatabaseAuthMethods: {
2656
2919
  readonly UsernameAndPassword: "username-and-password";
2657
2920
  readonly IndividualCredentials: "individual-credentials";
2658
2921
  };
2659
2922
  type DatabaseAuthMethod = (typeof DatabaseAuthMethods)[keyof typeof DatabaseAuthMethods];
2660
- declare const federatedAuthMethods: readonly ["okta", "snowflake", "azure", "key-pair", "google-oauth", "individual-credentials"];
2923
+ declare const federatedAuthMethods: readonly ["okta", "snowflake", "azure", "key-pair", "google-oauth", "individual-credentials", "oauth"];
2661
2924
  type FederatedAuthMethod = (typeof federatedAuthMethods)[number];
2662
2925
  declare function isFederatedAuthMethod(authMethod: string): authMethod is FederatedAuthMethod;
2663
2926
  declare function isFederatedAuthMetadata<M extends {
2664
- authMethod: string;
2927
+ authMethod?: string;
2665
2928
  }>(metadata: M): metadata is Extract<M, {
2666
2929
  authMethod: FederatedAuthMethod;
2667
2930
  }>;
@@ -2683,4 +2946,4 @@ interface SnowflakeKeyPair {
2683
2946
  username: string;
2684
2947
  }
2685
2948
  //#endregion
2686
- export { type AwsAuthMethod, AwsAuthMethods, type BigQueryAuthMethod, BigQueryAuthMethods, BigQueryServiceAccountParseError, type DatabaseAuthMethod, DatabaseAuthMethods, type DatabaseIntegrationConfig, type DatabaseIntegrationMetadataByType, type DatabaseIntegrationType, type DatabaseIntegrationTypeWithSslSupport, type EnvVar, type FederatedAuthMethod, type SnowflakeAuthMethod, SnowflakeAuthMethods, SpannerServiceAccountParseError, type SqlAlchemyInput, type SqlIntegrationConfig, type SqlIntegrationType, databaseIntegrationConfigSchema, databaseIntegrationTypes, databaseIntegrationTypesWithSslSupport, databaseMetadataSchemasByType, federatedAuthMethods, getEnvironmentVariablesForIntegrations, getSnowflakeFederatedAuthSqlAlchemyInput, getSqlAlchemyInput, isDatabaseIntegrationType, isDatabaseIntegrationTypeWithSslSupport, isFederatedAuthMetadata, isFederatedAuthMethod, isSqlIntegrationType, sqlIntegrationTypes };
2949
+ export { type AwsAuthMethod, AwsAuthMethods, type BigQueryAuthMethod, BigQueryAuthMethods, BigQueryServiceAccountParseError, type DatabaseAuthMethod, DatabaseAuthMethods, type DatabaseIntegrationConfig, type DatabaseIntegrationMetadataByType, type DatabaseIntegrationType, type DatabaseIntegrationTypeWithSslSupport, type EnvVar, type FederatedAuthMethod, type SnowflakeAuthMethod, SnowflakeAuthMethods, SpannerServiceAccountParseError, type SqlAlchemyInput, type SqlIntegrationConfig, type SqlIntegrationType, type TrinoAuthMethod, TrinoAuthMethods, databaseIntegrationConfigSchema, databaseIntegrationTypes, databaseIntegrationTypesWithSslSupport, databaseMetadataSchemasByType, federatedAuthMethods, getEnvironmentVariablesForIntegrations, getSnowflakeFederatedAuthSqlAlchemyInput, getSqlAlchemyInput, isDatabaseIntegrationType, isDatabaseIntegrationTypeWithSslSupport, isFederatedAuthMetadata, isFederatedAuthMethod, isSqlIntegrationType, sqlIntegrationTypes };
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,13 +31,14 @@ 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);
34
39
  }
35
40
  function isFederatedAuthMetadata(metadata) {
36
- return isFederatedAuthMethod(metadata.authMethod);
41
+ return metadata.authMethod !== void 0 && isFederatedAuthMethod(metadata.authMethod);
37
42
  }
38
43
 
39
44
  //#endregion
@@ -46,7 +51,7 @@ const athenaMetadataSchema = z.object({
46
51
  workgroup: z.string().optional()
47
52
  });
48
53
  const bigqueryMetadataSchema = z.discriminatedUnion("authMethod", [z.object({
49
- authMethod: z.literal(BigQueryAuthMethods.ServiceAccount),
54
+ authMethod: z.literal(BigQueryAuthMethods.ServiceAccount).optional(),
50
55
  service_account: z.string()
51
56
  }), z.object({
52
57
  authMethod: z.literal(BigQueryAuthMethods.GoogleOauth),
@@ -187,12 +192,10 @@ const spannerMetadataSchema = z.object({
187
192
  instance: z.string(),
188
193
  database: z.string()
189
194
  });
190
- const trinoMetadataSchema = z.object({
195
+ const trinoBaseMetadataSchema = z.object({
191
196
  host: z.string(),
192
- user: z.string(),
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 };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deepnote/database-integrations",
3
- "version": "1.3.2",
3
+ "version": "1.3.4",
4
4
  "description": "Deepnote database integration definitions",
5
5
  "keywords": [],
6
6
  "repository": {