feat(appkit): introduce workspace-client wrapper over the Databricks SDK#475
Draft
MarioCadenas wants to merge 1 commit into
Draft
feat(appkit): introduce workspace-client wrapper over the Databricks SDK#475MarioCadenas wants to merge 1 commit into
MarioCadenas wants to merge 1 commit into
Conversation
Add packages/appkit/src/workspace-client/ — a facade over the legacy
@databricks/sdk-experimental client that mirrors the modular Databricks
SDK's multi-client shape. This prepares the library for an incremental,
per-service migration to the modular SDK without migrating anything yet.
- legacy.ts is the ONLY module importing @databricks/sdk-experimental;
it constructs the client and re-exports the SDK symbols AppKit uses.
- The WorkspaceClient facade exposes per-service accessors (files,
warehouses, genie, jobs, statementExecution, servingEndpoints,
currentUser, config, apiClient), each legacy-typed and delegating to
the underlying client. Migrating a service later is a localized swap:
one getter + its accessor type + one connector.
- createWorkspaceClient() replaces every `new WorkspaceClient(...)` site
(runtime + build-time type-generator); toLegacyWorkspaceClient() is the
escape hatch for @databricks/lakebase.
- createApp({ client }) and the public index now expose the wrapper type
instead of the raw SDK client.
- A Biome noRestrictedImports boundary rule forbids importing
@databricks/sdk-experimental outside workspace-client/, keeping the seam
enforceable. Tests mock the wrapper rather than the SDK.
Time is sourced off the SDK namespace (SDK.Time ?? SDK.default.Time)
because the SDK's CommonJS `Time` export is a getter that defeats Node's
static ESM named-export detection — a direct `export { Time }` throws at
link time.
Signed-off-by: MarioCadenas <MarioCadenas@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Introduces
packages/appkit/src/workspace-client/— a facade over the legacy@databricks/sdk-experimentalclient that mirrors the modular Databricks SDK's multi-client shape. This prepares the library for an incremental, per-service migration to the modular SDK. Nothing is migrated yet — every service still delegates to the legacy client.Supersedes the exploration in #414, which actually migrated services (files/warehouses/vectorSearch), added upstream patches, and introduced dual-error handling. This PR does only the seam.
Design
legacy.tsis the only module that imports@databricks/sdk-experimental. It constructs the client and re-exports the SDK symbols AppKit uses (Context,ConfigError,Time,TimeUnits, type namespacesfiles/jobs/serving/sql, etc.).WorkspaceClientfacade exposes per-service accessors (files,warehouses,genie,jobs,statementExecution,servingEndpoints,currentUser,config,apiClient), each legacy-typed and delegating to the underlying client. Migrating a service later is a localized swap: one getter + its accessor type + one connector — the rest of the codebase never touches the SDK.createWorkspaceClient()replaces everynew WorkspaceClient(...)site (runtime + build-time type-generator).toLegacyWorkspaceClient()is the escape hatch for@databricks/lakebase, which is still on the old SDK.createApp({ client })and the public package index now expose the wrapper type instead of the raw SDK client. (Breaking at the type level for anyone passing a raw SDK client tocreateApp— no known external users.)noRestrictedImportsboundary rule forbids importing@databricks/sdk-experimentaloutsideworkspace-client/, so the seam stays enforceable. Tests mock the wrapper rather than the SDK.Note on
TimeTimeis sourced off the SDK namespace (SDK.Time ?? SDK.default.Time) rather than a staticexport { Time }. The SDK's CommonJSTimeexport is emitted as a getter calling__importDefault(...), which defeats Node's static ESM named-export detection — a direct re-export throws "does not provide an export named 'Time'" at link time. This mirrors the guard the genie connector already used.Verification
pnpm build— clean, publint OKpnpm -r typecheck— 0 errors, all packages@databricks/sdk-experimentalimported only inworkspace-client/pnpm check— 0 errors, 63 warnings (identical tomainbaseline)Timefix end-to-end