Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions knip.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"@databricks/sdk-core",
"@databricks/sdk-experimental",
"@databricks/sdk-options",
"@databricks/sdk-scim",
"@databricks/sdk-statementexecution",
"@databricks/sdk-warehouses",
"@mlflow/core",
Expand Down
1 change: 1 addition & 0 deletions packages/appkit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
"@databricks/sdk-core": "0.51.0",
"@databricks/sdk-experimental": "0.17.0",
"@databricks/sdk-options": "0.51.0",
"@databricks/sdk-scim": "0.51.0",
"@databricks/sdk-statementexecution": "0.52.0",
"@databricks/sdk-warehouses": "0.53.0",
"@opentelemetry/api": "1.9.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/appkit/src/context/service-context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ export class ServiceContext {
const [resolvedWorkspaceId, currentUser, resolvedResources] =
await Promise.all([
ServiceContext.getWorkspaceId(wsClient),
wsClient.currentUser.me(),
wsClient.currentUser.me({}),

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[SDK improvement] would be nice if .me({}) already had the object as a default and could be called empty without the empty object like currentUser.me()

WarehouseResource.resolve(wsClient, options?.warehouseId),
]);

Expand Down
1 change: 1 addition & 0 deletions packages/shared/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
"@databricks/sdk-core": "0.51.0",
"@databricks/sdk-experimental": "0.17.0",
"@databricks/sdk-options": "0.51.0",
"@databricks/sdk-scim": "0.51.0",
"@databricks/sdk-statementexecution": "0.52.0",
"@databricks/sdk-warehouses": "0.53.0",
"@standard-schema/spec": "1.1.0",
Expand Down
11 changes: 9 additions & 2 deletions packages/shared/src/workspace-client/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@ import {
type WorkspaceClientOptions,
} from "./legacy";
import {
buildScimClient,
buildStatementExecutionClient,
buildWarehousesClient,
buildWorkspaceAuth,
type ScimClient,
type StatementExecutionClient,
type WarehousesClient,
type WorkspaceAuth,
Expand All @@ -29,6 +31,7 @@ export class AppKitWorkspaceClient implements WorkspaceClient {
#warehouses?: WarehousesClient;
#statementExecution?: StatementExecutionClient;
#auth?: WorkspaceAuth;
#currentUser?: ScimClient;

constructor(opts: WorkspaceClientOptions) {
this.#opts = opts;
Expand Down Expand Up @@ -66,8 +69,12 @@ export class AppKitWorkspaceClient implements WorkspaceClient {
return this.#getLegacy().servingEndpoints;
}

get currentUser() {
return this.#getLegacy().currentUser;
// Migrated to the modular SDK (SCIM) — built lazily, independent of the legacy client.
get currentUser(): ScimClient {
if (!this.#currentUser) {
this.#currentUser = buildScimClient(this.#opts);
}
return this.#currentUser;
}

// Modular auth + raw-request seam — built lazily, independent of the legacy client.
Expand Down
10 changes: 10 additions & 0 deletions packages/shared/src/workspace-client/modular.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import {
} from "@databricks/sdk-core/http";
import { resolve } from "@databricks/sdk-core/profiles";
import type { ClientOptions } from "@databricks/sdk-options/client";
import { ScimClient } from "@databricks/sdk-scim/v1";
import { StatementExecutionClient } from "@databricks/sdk-statementexecution/v1";
import { WarehousesClient } from "@databricks/sdk-warehouses/v1";

Expand Down Expand Up @@ -312,7 +313,16 @@ export function buildStatementExecutionClient(
return new StatementExecutionClient(mapToClientOptions(opts));
}

/**
* Build a modular SCIM client from wrapper options. Backs the facade's
* `currentUser` accessor: legacy `currentUser.me()` is `ScimClient.me({})`.
*/
export function buildScimClient(opts: WorkspaceClientOptions): ScimClient {
return new ScimClient(mapToClientOptions(opts));
}

// ── Client type re-exports (for the facade accessor types) ───────────────
export type { ScimClient } from "@databricks/sdk-scim/v1";
export type { StatementExecutionClient } from "@databricks/sdk-statementexecution/v1";
export type { WarehousesClient } from "@databricks/sdk-warehouses/v1";

Expand Down
5 changes: 3 additions & 2 deletions packages/shared/src/workspace-client/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import type {
StatementExecutionClient,
WarehousesClient,
WorkspaceAuth,
ScimClient,
} from "./modular";

// Legacy SDK type namespaces for un-migrated services, re-exported so AppKit
Expand Down Expand Up @@ -59,8 +60,8 @@ export interface WorkspaceClient extends WorkspaceAuth {
/** Serving Endpoints. */
readonly servingEndpoints: LegacyWorkspaceClient["servingEndpoints"];

/** Current user. */
readonly currentUser: LegacyWorkspaceClient["currentUser"];
/** Current user (modular SDK SCIM client; `me({})` returns the caller). */
readonly currentUser: ScimClient;

/**
* Legacy SDK `Config`. Prefer `getHost()` / `authenticate(headers)` (modular,
Expand Down
19 changes: 19 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading