@databricks/sql 1.14.0 → 1.16.0-rc.1

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.
Files changed (150) hide show
  1. package/README.md +12 -0
  2. package/dist/DBSQLClient.d.ts +102 -0
  3. package/dist/DBSQLClient.js +541 -55
  4. package/dist/DBSQLClient.js.map +1 -1
  5. package/dist/DBSQLLogger.d.ts +3 -0
  6. package/dist/DBSQLLogger.js +25 -0
  7. package/dist/DBSQLLogger.js.map +1 -1
  8. package/dist/DBSQLOperation.d.ts +67 -17
  9. package/dist/DBSQLOperation.js +245 -217
  10. package/dist/DBSQLOperation.js.map +1 -1
  11. package/dist/DBSQLParameter.d.ts +2 -0
  12. package/dist/DBSQLParameter.js +63 -7
  13. package/dist/DBSQLParameter.js.map +1 -1
  14. package/dist/DBSQLSession.d.ts +24 -16
  15. package/dist/DBSQLSession.js +77 -268
  16. package/dist/DBSQLSession.js.map +1 -1
  17. package/dist/connection/auth/DatabricksOAuth/OAuthManager.js +10 -6
  18. package/dist/connection/auth/DatabricksOAuth/OAuthManager.js.map +1 -1
  19. package/dist/connection/connections/HttpRetryPolicy.d.ts +3 -0
  20. package/dist/connection/connections/HttpRetryPolicy.js +116 -21
  21. package/dist/connection/connections/HttpRetryPolicy.js.map +1 -1
  22. package/dist/connection/connections/ThriftHttpConnection.js +18 -3
  23. package/dist/connection/connections/ThriftHttpConnection.js.map +1 -1
  24. package/dist/contracts/IBackend.d.ts +31 -0
  25. package/dist/contracts/IBackend.js +3 -0
  26. package/dist/contracts/IBackend.js.map +1 -0
  27. package/dist/contracts/IClientContext.d.ts +30 -0
  28. package/dist/contracts/IDBSQLClient.d.ts +115 -0
  29. package/dist/contracts/IDBSQLLogger.d.ts +17 -0
  30. package/dist/contracts/IDBSQLLogger.js.map +1 -1
  31. package/dist/contracts/IDBSQLSession.d.ts +24 -1
  32. package/dist/contracts/IOperation.d.ts +10 -1
  33. package/dist/contracts/IOperationBackend.d.ts +98 -0
  34. package/dist/contracts/IOperationBackend.js +3 -0
  35. package/dist/contracts/IOperationBackend.js.map +1 -0
  36. package/dist/contracts/ISessionBackend.d.ts +36 -0
  37. package/dist/contracts/ISessionBackend.js +3 -0
  38. package/dist/contracts/ISessionBackend.js.map +1 -0
  39. package/dist/contracts/InternalConnectionOptions.d.ts +72 -0
  40. package/dist/contracts/InternalConnectionOptions.js +3 -0
  41. package/dist/contracts/InternalConnectionOptions.js.map +1 -0
  42. package/dist/contracts/OperationStatus.d.ts +76 -0
  43. package/dist/contracts/OperationStatus.js +28 -0
  44. package/dist/contracts/OperationStatus.js.map +1 -0
  45. package/dist/contracts/ResultMetadata.d.ts +34 -0
  46. package/dist/contracts/ResultMetadata.js +16 -0
  47. package/dist/contracts/ResultMetadata.js.map +1 -0
  48. package/dist/errors/AuthenticationError.d.ts +1 -0
  49. package/dist/errors/AuthenticationError.js +4 -0
  50. package/dist/errors/AuthenticationError.js.map +1 -1
  51. package/dist/index.d.ts +2 -0
  52. package/dist/index.js +7 -3
  53. package/dist/index.js.map +1 -1
  54. package/dist/kernel/KernelArrowIpc.d.ts +54 -0
  55. package/dist/kernel/KernelArrowIpc.js +292 -0
  56. package/dist/kernel/KernelArrowIpc.js.map +1 -0
  57. package/dist/kernel/KernelArrowIpcDurationFix.d.ts +29 -0
  58. package/dist/kernel/KernelArrowIpcDurationFix.js +605 -0
  59. package/dist/kernel/KernelArrowIpcDurationFix.js.map +1 -0
  60. package/dist/kernel/KernelAuth.d.ts +300 -0
  61. package/dist/kernel/KernelAuth.js +463 -0
  62. package/dist/kernel/KernelAuth.js.map +1 -0
  63. package/dist/kernel/KernelBackend.d.ts +53 -0
  64. package/dist/kernel/KernelBackend.js +164 -0
  65. package/dist/kernel/KernelBackend.js.map +1 -0
  66. package/dist/kernel/KernelErrorMapping.d.ts +109 -0
  67. package/dist/kernel/KernelErrorMapping.js +249 -0
  68. package/dist/kernel/KernelErrorMapping.js.map +1 -0
  69. package/dist/kernel/KernelInputValidation.d.ts +16 -0
  70. package/dist/kernel/KernelInputValidation.js +49 -0
  71. package/dist/kernel/KernelInputValidation.js.map +1 -0
  72. package/dist/kernel/KernelLogging.d.ts +63 -0
  73. package/dist/kernel/KernelLogging.js +128 -0
  74. package/dist/kernel/KernelLogging.js.map +1 -0
  75. package/dist/kernel/KernelNativeLoader.d.ts +77 -0
  76. package/dist/kernel/KernelNativeLoader.js +178 -0
  77. package/dist/kernel/KernelNativeLoader.js.map +1 -0
  78. package/dist/kernel/KernelOperationBackend.d.ts +154 -0
  79. package/dist/kernel/KernelOperationBackend.js +640 -0
  80. package/dist/kernel/KernelOperationBackend.js.map +1 -0
  81. package/dist/kernel/KernelOperationLifecycle.d.ts +130 -0
  82. package/dist/kernel/KernelOperationLifecycle.js +245 -0
  83. package/dist/kernel/KernelOperationLifecycle.js.map +1 -0
  84. package/dist/kernel/KernelPositionalParams.d.ts +16 -0
  85. package/dist/kernel/KernelPositionalParams.js +120 -0
  86. package/dist/kernel/KernelPositionalParams.js.map +1 -0
  87. package/dist/kernel/KernelResultsProvider.d.ts +44 -0
  88. package/dist/kernel/KernelResultsProvider.js +102 -0
  89. package/dist/kernel/KernelResultsProvider.js.map +1 -0
  90. package/dist/kernel/KernelServerInfo.d.ts +44 -0
  91. package/dist/kernel/KernelServerInfo.js +73 -0
  92. package/dist/kernel/KernelServerInfo.js.map +1 -0
  93. package/dist/kernel/KernelSessionBackend.d.ts +100 -0
  94. package/dist/kernel/KernelSessionBackend.js +384 -0
  95. package/dist/kernel/KernelSessionBackend.js.map +1 -0
  96. package/dist/result/ArrowResultConverter.d.ts +31 -2
  97. package/dist/result/ArrowResultConverter.js +226 -14
  98. package/dist/result/ArrowResultConverter.js.map +1 -1
  99. package/dist/result/CloudFetchResultHandler.d.ts +8 -1
  100. package/dist/result/CloudFetchResultHandler.js +64 -10
  101. package/dist/result/CloudFetchResultHandler.js.map +1 -1
  102. package/dist/result/RowSetProvider.d.ts +8 -1
  103. package/dist/result/RowSetProvider.js +110 -1
  104. package/dist/result/RowSetProvider.js.map +1 -1
  105. package/dist/telemetry/DatabricksTelemetryExporter.js +101 -34
  106. package/dist/telemetry/DatabricksTelemetryExporter.js.map +1 -1
  107. package/dist/telemetry/FeatureFlagCache.js +10 -4
  108. package/dist/telemetry/FeatureFlagCache.js.map +1 -1
  109. package/dist/telemetry/MetricsAggregator.d.ts +38 -0
  110. package/dist/telemetry/MetricsAggregator.js +249 -14
  111. package/dist/telemetry/MetricsAggregator.js.map +1 -1
  112. package/dist/telemetry/TelemetryClient.d.ts +94 -14
  113. package/dist/telemetry/TelemetryClient.js +252 -20
  114. package/dist/telemetry/TelemetryClient.js.map +1 -1
  115. package/dist/telemetry/TelemetryClientProvider.d.ts +28 -33
  116. package/dist/telemetry/TelemetryClientProvider.js +58 -52
  117. package/dist/telemetry/TelemetryClientProvider.js.map +1 -1
  118. package/dist/telemetry/TelemetryEventEmitter.d.ts +52 -26
  119. package/dist/telemetry/TelemetryEventEmitter.js +88 -109
  120. package/dist/telemetry/TelemetryEventEmitter.js.map +1 -1
  121. package/dist/telemetry/{urlUtils.d.ts → telemetryTypeMappers.d.ts} +8 -5
  122. package/dist/telemetry/telemetryTypeMappers.js +72 -0
  123. package/dist/telemetry/telemetryTypeMappers.js.map +1 -0
  124. package/dist/telemetry/telemetryUtils.d.ts +14 -0
  125. package/dist/telemetry/telemetryUtils.js +52 -1
  126. package/dist/telemetry/telemetryUtils.js.map +1 -1
  127. package/dist/telemetry/types.d.ts +48 -1
  128. package/dist/telemetry/types.js +5 -2
  129. package/dist/telemetry/types.js.map +1 -1
  130. package/dist/thrift-backend/ThriftBackend.d.ts +17 -0
  131. package/dist/thrift-backend/ThriftBackend.js +80 -0
  132. package/dist/thrift-backend/ThriftBackend.js.map +1 -0
  133. package/dist/thrift-backend/ThriftOperationBackend.d.ts +70 -0
  134. package/dist/thrift-backend/ThriftOperationBackend.js +330 -0
  135. package/dist/thrift-backend/ThriftOperationBackend.js.map +1 -0
  136. package/dist/thrift-backend/ThriftSessionBackend.d.ts +36 -0
  137. package/dist/thrift-backend/ThriftSessionBackend.js +266 -0
  138. package/dist/thrift-backend/ThriftSessionBackend.js.map +1 -0
  139. package/dist/thrift-backend/wireSynthesis.d.ts +30 -0
  140. package/dist/thrift-backend/wireSynthesis.js +128 -0
  141. package/dist/thrift-backend/wireSynthesis.js.map +1 -0
  142. package/dist/version.d.ts +1 -1
  143. package/dist/version.js +1 -1
  144. package/dist/version.js.map +1 -1
  145. package/native/kernel/README.md +97 -0
  146. package/native/kernel/index.d.ts +1069 -0
  147. package/native/kernel/index.js +325 -0
  148. package/package.json +14 -3
  149. package/dist/telemetry/urlUtils.js +0 -35
  150. package/dist/telemetry/urlUtils.js.map +0 -1
@@ -0,0 +1,300 @@
1
+ /// <reference types="node" />
2
+ import { ConnectionOptions } from '../contracts/IDBSQLClient';
3
+ /**
4
+ * Shape consumed by the napi-binding's `openSession()` (see
5
+ * `native/kernel/index.d.ts`). Mirrors `ConnectionOptions` in the binding's
6
+ * `.d.ts`; declared locally to avoid coupling the JS-side adapter to the
7
+ * auto-generated TS file.
8
+ *
9
+ * Discriminated by `authMode`:
10
+ * - `'Pat'` → `token` is the PAT.
11
+ * - `'OAuthM2m'` → `oauthClientId` + `oauthClientSecret` drive a
12
+ * kernel-side client_credentials exchange.
13
+ * - `'OAuthU2m'` → `oauthRedirectPort` overrides the kernel default;
14
+ * everything else (client_id, scopes, callback timeout,
15
+ * token_url_override) uses kernel defaults.
16
+ *
17
+ * The `authMode` string literals MUST match the napi-emitted `AuthMode`
18
+ * variant names verbatim (`'Pat'`, `'OAuthM2m'`, `'OAuthU2m'` — napi-rs's
19
+ * `#[napi(string_enum)]` without an explicit case option emits the
20
+ * Rust variant identifier as-is). We duplicate the values here instead
21
+ * of importing `AuthMode` from `native/kernel/index.d.ts` because that
22
+ * file declares `AuthMode` as `export const enum`, which is
23
+ * incompatible with `isolatedModules` and a runtime-coupling hazard.
24
+ * The Rust source of truth lives at `native/kernel/src/database.rs`.
25
+ */
26
+ /**
27
+ * Session-level defaults shared across all auth-mode variants.
28
+ *
29
+ * Mirrors `ConnectionOptions.catalog` / `.schema` / `.sessionConf` on
30
+ * the napi binding (kernel `Session::builder().defaults(DefaultOpts)`
31
+ * and `.session_conf(HashMap)` — the routes that actually populate kernel
32
+ * `CreateSession.catalog` / `.schema` / `.session_confs`).
33
+ *
34
+ * Per-statement overrides do not exist on the kernel surface; both
35
+ * pyo3 and napi expose catalog / schema / sessionConf only at session
36
+ * creation. Mirror that here so the adapter doesn't promise a
37
+ * capability the binding can't honour.
38
+ */
39
+ export interface KernelSessionDefaults {
40
+ catalog?: string;
41
+ schema?: string;
42
+ sessionConf?: Record<string, string>;
43
+ /**
44
+ * Render `INTERVAL` / `DURATION` result columns as strings
45
+ * (kernel `ResultConfig.intervals_as_string`). The kernel default is
46
+ * native Arrow `month_interval` / `duration[us]`, but the NodeJS
47
+ * Thrift driver surfaces intervals as strings — so the kernel path sets
48
+ * this `true` so its result shape is a byte-compatible drop-in for the
49
+ * Thrift backend. Omitting it falls back to the kernel's native types.
50
+ */
51
+ intervalsAsString?: boolean;
52
+ /**
53
+ * Render complex (`ARRAY` / `MAP` / `STRUCT` / `VARIANT`) result
54
+ * columns as JSON strings (kernel `ResultConfig.complex_types_as_json`).
55
+ * Left unset on the kernel path: native Arrow nested types already decode
56
+ * identically to the Thrift backend through the shared Arrow converter,
57
+ * so forcing JSON here would *introduce* a divergence rather than
58
+ * remove one.
59
+ */
60
+ complexTypesAsJson?: boolean;
61
+ /**
62
+ * Per-session kernel connection-pool size
63
+ * (kernel `ConnectionOptions.max_connections`). Validated as a positive
64
+ * integer within the napi `u32` range by `buildKernelConnectionOptions`.
65
+ */
66
+ maxConnections?: number;
67
+ /**
68
+ * Retry/backoff tuning forwarded to the kernel (which owns the retry loop
69
+ * on the kernel path). These mirror the driver's `ClientConfig` retry knobs —
70
+ * the same ones the Thrift `HttpRetryPolicy` uses — converted from the
71
+ * connector's milliseconds to the kernel's whole seconds, so a single
72
+ * retry config governs both backends. Unset ⇒ kernel default policy.
73
+ * Map onto the napi `ConnectionOptions.retry{Min,Max}WaitSecs` /
74
+ * `retryMaxAttempts` / `retryOverallTimeoutSecs` (see `buildKernelRetryOptions`).
75
+ */
76
+ retryMinWaitSecs?: number;
77
+ retryMaxWaitSecs?: number;
78
+ /** **Total** attempts (kernel converts to retries-after-first internally). */
79
+ retryMaxAttempts?: number;
80
+ retryOverallTimeoutSecs?: number;
81
+ }
82
+ /**
83
+ * TLS options shared across all auth-mode variants. Mirror the napi
84
+ * binding's `ConnectionOptions.checkServerCertificate` / `.customCaCert`
85
+ * (kernel `Session::builder().tls(TlsConfig)`).
86
+ *
87
+ * The napi shape takes `customCaCert` as a `Buffer` only; the public
88
+ * `ConnectionOptions` additionally accepts a PEM string, which
89
+ * `buildKernelConnectionOptions` normalises to a `Buffer` before crossing
90
+ * the FFI boundary.
91
+ */
92
+ export interface KernelTlsOptions {
93
+ /**
94
+ * Verify the server's TLS certificate. The kernel backend is
95
+ * **secure-by-default**: omitting this leaves the kernel default of
96
+ * `true` (full chain + hostname verification). Set `false` only to opt
97
+ * into the insecure, accept-anything mode (analogous to Thrift's
98
+ * `rejectUnauthorized: false`); prefer pairing strict checking with
99
+ * `customCaCert` over disabling verification entirely.
100
+ */
101
+ checkServerCertificate?: boolean;
102
+ /**
103
+ * Verify the server certificate's hostname (hostname-vs-SNI), independently
104
+ * of chain validation. Omit ⇒ kernel default (on). `false` skips only the
105
+ * hostname check. No-op when `checkServerCertificate` is `false`. Mirrors
106
+ * the kernel napi `checkServerCertificateHostname` / Python
107
+ * `tls_verify_hostname`.
108
+ */
109
+ checkServerCertificateHostname?: boolean;
110
+ /** PEM-encoded CA bytes to add to the trust store. */
111
+ customCaCert?: Buffer;
112
+ /**
113
+ * PEM-encoded client certificate for mutual TLS (kernel
114
+ * `TlsConfig::client_cert_pem`). Paired with {@link clientKeyPem} —
115
+ * `buildKernelTlsOptions` rejects supplying only one before the FFI hop.
116
+ * The napi shape takes a `Buffer`; the public surface also accepts a
117
+ * PEM string, normalised here.
118
+ */
119
+ clientCertPem?: Buffer;
120
+ /**
121
+ * PEM-encoded private key for the mTLS client certificate (kernel
122
+ * `TlsConfig::client_key_pem`). Paired with {@link clientCertPem}.
123
+ */
124
+ clientKeyPem?: Buffer;
125
+ }
126
+ /**
127
+ * HTTP options shared across all auth-mode variants. Mirrors the napi
128
+ * binding's `ConnectionOptions.customHeaders` (kernel
129
+ * `HttpConfig::custom_headers`).
130
+ *
131
+ * Carries the extra request headers the kernel path sends on every request:
132
+ * the caller's `customHeaders` plus the composed `User-Agent` (the kernel
133
+ * appends a `User-Agent` entry to its base UA rather than replacing it).
134
+ *
135
+ * An **ordered list** of `{ name, value }` pairs — the napi shape
136
+ * (`Array<HeaderEntry>`), which mirrors the kernel core's
137
+ * `Vec<(String, String)>` and the Python connector's `http_headers`
138
+ * `List[Tuple[str, str]]`. Order is preserved and duplicate names are
139
+ * allowed (e.g. a caller `User-Agent` followed by the connector's, which
140
+ * the kernel folds last-wins).
141
+ */
142
+ export interface KernelHttpOptions {
143
+ customHeaders?: Array<{
144
+ name: string;
145
+ value: string;
146
+ }>;
147
+ socketTimeoutMs?: number;
148
+ }
149
+ /**
150
+ * HTTP(S) proxy forwarded to the napi binding's `ConnectionOptions.proxy`
151
+ * (kernel `ProxyConfig`). The public `ConnectionOptions.proxy` is the
152
+ * Thrift-shaped `{protocol, host, port, auth}`; `buildKernelProxyOptions`
153
+ * maps it onto the kernel's structured proxy input — `url` composed from
154
+ * `protocol://host:port`, with `auth.{username,password}` forwarded as
155
+ * separate basic-auth fields (NOT embedded in the URL, so no percent-encoding
156
+ * footgun) and the `noProxy` host list forwarded as `bypassHosts`. The same
157
+ * connection option therefore works identically on both backends.
158
+ */
159
+ export interface KernelProxyOptions {
160
+ proxy?: {
161
+ url: string;
162
+ username?: string;
163
+ password?: string;
164
+ bypassHosts?: string;
165
+ };
166
+ }
167
+ export type KernelNativeConnectionOptions = KernelSessionDefaults & KernelTlsOptions & KernelHttpOptions & KernelProxyOptions & ({
168
+ hostName: string;
169
+ httpPath: string;
170
+ authMode: 'Pat';
171
+ token: string;
172
+ } | {
173
+ hostName: string;
174
+ httpPath: string;
175
+ authMode: 'OAuthM2m';
176
+ oauthClientId: string;
177
+ oauthClientSecret: string;
178
+ oauthScopes?: Array<string>;
179
+ } | {
180
+ hostName: string;
181
+ httpPath: string;
182
+ authMode: 'OAuthU2m';
183
+ oauthRedirectPort: number;
184
+ oauthScopes?: Array<string>;
185
+ oauthClientId?: string;
186
+ });
187
+ /**
188
+ * Reject inputs that pass `typeof === 'string' && length > 0` but are
189
+ * structurally useless as credentials: whitespace-only strings, and the
190
+ * literal strings `'undefined'` / `'null'` (case-insensitive) that buggy
191
+ * shell exports (e.g. `export FOO="$UNSET_VAR"`) produce. Surfacing
192
+ * these here means an OAuth flow's `invalid_client` from the workspace
193
+ * is always a real credential mismatch, never a malformed-input passthrough.
194
+ *
195
+ * Exported so the integration-test env-gate can reuse the same predicate
196
+ * and stay in lockstep with production (B-3 fix).
197
+ */
198
+ export declare function isBlankOrReserved(s: string): boolean;
199
+ /**
200
+ * Normalise the public TLS options into the napi shape.
201
+ *
202
+ * - `checkServerCertificate` passes through verbatim (only when set; an
203
+ * absent value leaves the kernel default, which is secure — verify on).
204
+ * - `checkServerCertificateHostname` passes through verbatim — the
205
+ * independent hostname-vs-SNI toggle (kernel applies it only when the
206
+ * master verify toggle is on). Mirrors Python's `tls_verify_hostname`.
207
+ * - `customCaCert` accepts a PEM string or `Buffer`; normalised to a
208
+ * `Buffer` via {@link normalizePemBytes}.
209
+ * - `clientCertPem` / `clientKeyPem` carry the mutual-TLS client identity.
210
+ * They must be supplied **together** — supplying only one is rejected
211
+ * here with an actionable error (rather than waiting for the kernel's
212
+ * `InvalidArgument` at `openSession`). Each accepts a PEM string or
213
+ * `Buffer`, normalised the same way.
214
+ *
215
+ * Throws `HiveDriverError` when a cert/key is empty, mis-typed, lacks the
216
+ * expected PEM header, or when only one half of the mTLS pair is set.
217
+ */
218
+ export declare function buildKernelTlsOptions(options: ConnectionOptions): KernelTlsOptions;
219
+ export declare function buildKernelHttpOptions(options: ConnectionOptions): KernelHttpOptions;
220
+ /**
221
+ * Validate the user-supplied `ConnectionOptions` and build the
222
+ * napi-binding's connection-options shape.
223
+ *
224
+ * Supported auth modes:
225
+ * - PAT: `authType: 'access-token'` (or undefined, which already means
226
+ * PAT throughout the existing driver — see
227
+ * `DBSQLClient.createAuthProvider`).
228
+ * - OAuth M2M: `authType: 'databricks-oauth'` + `oauthClientId` +
229
+ * `oauthClientSecret`. Kernel handles OIDC discovery, client_credentials
230
+ * exchange, and re-auth on expiry internally.
231
+ * - OAuth U2M: `authType: 'databricks-oauth'` + NO `oauthClientId` and
232
+ * NO `oauthClientSecret`. Kernel runs the PKCE auth-code dance (opens
233
+ * a browser, listens on localhost:8030, exchanges the code, persists
234
+ * to `~/.config/databricks-sql-kernel/oauth/{sha256}.json`).
235
+ *
236
+ * **Flow selection — DELIBERATE DIVERGENCE FROM THRIFT.** Thrift's
237
+ * `DBSQLClient.createAuthProvider` (`DBSQLClient.ts:216`) keys off the
238
+ * *secret* (`oauthClientSecret === undefined ? U2M : M2M`), so a custom
239
+ * `oauthClientId` with no secret runs U2M with that id. kernel instead keys
240
+ * off `oauthClientId` *presence* (id present → M2M, absent → U2M). The
241
+ * trade-off: keying off the id means a caller who set an id but
242
+ * typoed/forgot the secret gets the actionable M2M "secret is required"
243
+ * error instead of being silently routed to U2M (which would hide their
244
+ * intent). The cost is two real behavioural gaps vs Thrift:
245
+ * 1. `oauthClientId` + no secret → Thrift runs U2M; kernel throws
246
+ * `AuthenticationError` (M2M secret required).
247
+ * 2. kernel U2M has NO custom-client-id support — the kernel hardcodes
248
+ * `client_id = "databricks-cli"`, and kernel rejects any `oauthClientId`
249
+ * on the U2M arm. Thrift U2M honours a custom `clientId`.
250
+ * Both are documented limitations of the M0 kernel OAuth surface, not bugs.
251
+ *
252
+ * Out of scope on the OAuth paths (rejected with a clear error):
253
+ * - `azureTenantId` / `useDatabricksOAuthInAzure` → Microsoft Entra
254
+ * direct flow. The kernel uses workspace-OIDC discovery (which works
255
+ * against Azure workspaces too — they serve `/oidc/.well-known/...`)
256
+ * and does not implement the Entra-direct scope-rewrite path.
257
+ * - `persistence` on M2M → M2M tokens are not cached (re-issuing is
258
+ * cheap; no refresh token).
259
+ * - `persistence` on U2M → custom token store is a parity gap;
260
+ * requires kernel-side `AuthConfig::External` plumbing. The kernel's
261
+ * auto-disk-cache works for the standard flow today.
262
+ *
263
+ * Ambiguity:
264
+ * - PAT path: rejects when OAuth fields (`oauthClientId` /
265
+ * `oauthClientSecret`) are simultaneously set.
266
+ * - OAuth path: rejects when `token` is set alongside OAuth fields.
267
+ *
268
+ * Throws:
269
+ * - `AuthenticationError` for missing/blank required credentials.
270
+ * - `HiveDriverError` for unsupported auth modes / Azure-direct /
271
+ * custom persistence / ambiguous combinations.
272
+ */
273
+ /**
274
+ * Convert the driver's `ClientConfig` retry knobs (milliseconds, total-attempt
275
+ * count) into the kernel's `ConnectionOptions` retry kwargs (whole seconds).
276
+ * The kernel owns the retry loop on the kernel path, so forwarding these keeps kernel
277
+ * and Thrift governed by one retry config. `retryMaxAttempts` is a TOTAL attempt
278
+ * count on both sides (the kernel converts to retries-after-first internally),
279
+ * so it passes through directly. Sub-second delays round to the nearest second
280
+ * (the kernel's granularity); all values are clamped into the napi `u32` range.
281
+ */
282
+ export declare function buildKernelRetryOptions(config: {
283
+ retryMaxAttempts?: number;
284
+ retriesTimeout?: number;
285
+ retryDelayMin?: number;
286
+ retryDelayMax?: number;
287
+ }): Pick<KernelSessionDefaults, 'retryMinWaitSecs' | 'retryMaxWaitSecs' | 'retryMaxAttempts' | 'retryOverallTimeoutSecs'>;
288
+ /**
289
+ * Map the public `ConnectionOptions.proxy` (`{protocol, host, port, auth}` —
290
+ * the same shape the Thrift backend accepts) onto the kernel's structured napi
291
+ * proxy input. The `url` is composed from `protocol://host:port` (no embedded
292
+ * credentials); `auth.{username,password}` are forwarded as separate
293
+ * basic-auth fields (the kernel applies them via reqwest `Proxy::basic_auth`),
294
+ * avoiding any URL percent-encoding footgun. The `noProxy` host list (a driver
295
+ * option, not on the published `.d.ts`) is forwarded as `bypassHosts`. The
296
+ * kernel accepts only `http://` / `https://`; a SOCKS protocol surfaces a clear
297
+ * kernel error at connect (reqwest SOCKS support is not compiled in).
298
+ */
299
+ export declare function buildKernelProxyOptions(options: ConnectionOptions): KernelProxyOptions;
300
+ export declare function buildKernelConnectionOptions(options: ConnectionOptions): KernelNativeConnectionOptions;