@dbx-tools/databricks 0.6.182 → 0.6.185

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/README.md CHANGED
@@ -1,6 +1,7 @@
1
1
  # @dbx-tools/databricks
2
2
 
3
- Databricks runtime, workspace, filesystem, cloud, and network utilities.
3
+ Databricks authentication, runtime, workspace, filesystem, cloud, and network
4
+ utilities.
4
5
 
5
6
  Import this package when backend code needs workspace URL/id discovery, cloud
6
7
  provider/region lookup, App runtime detection, DNS resolution, or public-IP
@@ -10,8 +11,10 @@ Key features:
10
11
 
11
12
  - Workspace URL and numeric workspace id resolution from AppKit context,
12
13
  Databricks SDK config, env, and config files.
13
- - Rust-backed Databricks App detection shared with authentication providers.
14
- - Cached detection of whether the Databricks CLI auth surface is available.
14
+ - U2M browser OAuth, M2M client credentials, PAT, `app_obo`, and `app_sp`
15
+ authentication.
16
+ - Rust-backed App detection, CLI token access, file locks, and file-backed
17
+ caches.
15
18
  - `DatabricksFileSystem` (`FileSystem` over workspace files, UC volumes, and DBFS)
16
19
  with intelligent roots: `/Workspace/...`, `/Volumes/...` (also `/Volume/...` and
17
20
  `catalog.schema.volume`), `~` → `/Workspace/Users/<userName>`, and `/dbfs/...`.
@@ -23,27 +26,39 @@ Key features:
23
26
  - DNS A/AAAA lookup helpers for Databricks and adjacent service hosts.
24
27
  - Memoized outbound public-IP discovery for setup and diagnostics.
25
28
 
26
- ## Detect The Runtime
29
+ ## Authenticate
27
30
 
28
31
  ```ts
29
- import { databricksCliAvailable, isDatabricksApp } from "@dbx-tools/databricks";
32
+ import {
33
+ createPersistentAuth,
34
+ createPersistentAuthForRequest,
35
+ DatabricksAuthOptions,
36
+ } from "@dbx-tools/databricks";
37
+
38
+ const auth = await createPersistentAuth(DatabricksAuthOptions.create({}));
39
+ const token = await auth.token();
40
+ ```
41
+
42
+ Inside a Databricks App, request-scoped auth prefers OBO, then falls back to the
43
+ ambient service principal:
30
44
 
31
- const inApp = isDatabricksApp();
32
- const hasDatabricksAuth = databricksCliAvailable();
45
+ ```ts
46
+ const requestHeaders = new Map<string, string>();
47
+ const forwardedToken = req.header("x-forwarded-access-token");
48
+ if (forwardedToken) requestHeaders.set("x-forwarded-access-token", forwardedToken);
49
+ const auth = await createPersistentAuthForRequest(DatabricksAuthOptions.create({}), requestHeaders);
33
50
  ```
34
51
 
35
- `isDatabricksApp()` honors `DBX_TOOLS_DATABRICKS_APP_ENV`, then requires a
36
- valid `DATABRICKS_APP_NAME`, HTTP(S) `DATABRICKS_HOST`, and
37
- `DATABRICKS_APP_PORT`. `databricksCliAvailable()` caches whether
38
- `databricks auth --help` succeeds for the process. The generated bindings and
39
- the package's direct TypeScript modules share this package root.
52
+ OBO tokens are forwarded directly without caching. `app_sp` shares the complete
53
+ M2M client-credentials implementation. Set `authType` or `profile` explicitly
54
+ to override automatic App resolution.
40
55
 
41
56
  ## Relationship To Native AppKit
42
57
 
43
58
  Use native AppKit for its standard workspace client and plugin integrations.
44
- Use this package when code also needs App detection shared with Rust,
45
- Databricks filesystem root normalization, cloud region discovery, network
46
- helpers, or workspace identity fallbacks outside an AppKit request.
59
+ Use this package when code needs Databricks filesystem root normalization,
60
+ cloud region discovery, network helpers, or workspace identity fallbacks
61
+ outside an AppKit request, or when direct Rust-backed authentication is needed.
47
62
 
48
63
  ## Databricks filesystem
49
64
 
@@ -127,8 +142,6 @@ short-lived reuse.
127
142
  - `workspace` - workspace URL/id, `tryGetWorkspaceClient` / `getWorkspaceClient`, and current username.
128
143
  - `cloud` - provider/region detection from public cloud IP ranges.
129
144
  - `net` - DNS A/AAAA resolution and outbound public-IP discovery.
130
- - package root - Rust-backed `isDatabricksApp` and
131
- `databricksCliAvailable`.
132
145
 
133
146
  Zerobus endpoint construction builds on these helpers in
134
147
  [`@dbx-tools/databricks-zerobus`](../databricks-zerobus).
package/index.ts CHANGED
@@ -3,7 +3,7 @@
3
3
  // Hand edits are overwritten on the next watch; this file is read-only.
4
4
 
5
5
  export const PACKAGE_IDENTIFIER = "@dbx-tools/databricks";
6
- export const PACKAGE_VERSION = "0.6.182";
6
+ export const PACKAGE_VERSION = "0.6.185";
7
7
  export * from "./src/bindings.ts";
8
8
  export * as cloud from "./src/cloud.ts";
9
9
  export * as databricksFS from "./src/databricks-fs.ts";