@databricks/appkit-ui 0.88.0 → 0.89.0

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 (142) hide show
  1. package/CLAUDE.md +7 -2
  2. package/dist/cli/commands/doctor/checks-existence.js +16 -16
  3. package/dist/cli/commands/doctor/checks-existence.js.map +1 -1
  4. package/dist/cli/commands/doctor/checks.js +15 -18
  5. package/dist/cli/commands/doctor/checks.js.map +1 -1
  6. package/dist/cli/commands/doctor/databricks-client.js +8 -6
  7. package/dist/cli/commands/doctor/databricks-client.js.map +1 -1
  8. package/dist/cli/commands/registry/workspace-picker.js +34 -24
  9. package/dist/cli/commands/registry/workspace-picker.js.map +1 -1
  10. package/dist/react/genie/genie-chart-inference.js.map +1 -1
  11. package/dist/react/genie/genie-query-transform.d.ts +5 -2
  12. package/dist/react/genie/genie-query-transform.d.ts.map +1 -1
  13. package/dist/react/genie/genie-query-transform.js +14 -8
  14. package/dist/react/genie/genie-query-transform.js.map +1 -1
  15. package/dist/react/table/table-wrapper.js +6 -1
  16. package/dist/react/table/table-wrapper.js.map +1 -1
  17. package/dist/react/table/types.d.ts +5 -1
  18. package/dist/react/table/types.d.ts.map +1 -1
  19. package/dist/react/ui/button.d.ts +1 -1
  20. package/dist/shared/src/genie.d.ts +9 -3
  21. package/dist/shared/src/genie.d.ts.map +1 -1
  22. package/dist/shared/src/workspace-client/factory.d.ts +0 -1
  23. package/dist/shared/src/workspace-client/index.d.ts +1 -2
  24. package/dist/shared/src/workspace-client/modular.d.ts +19 -0
  25. package/dist/shared/src/workspace-client/types.d.ts +1 -2
  26. package/dist/workspace-client/client.js +81 -23
  27. package/dist/workspace-client/client.js.map +1 -1
  28. package/dist/workspace-client/errors.d.ts +14 -2
  29. package/dist/workspace-client/errors.d.ts.map +1 -0
  30. package/dist/workspace-client/errors.js +45 -2
  31. package/dist/workspace-client/errors.js.map +1 -0
  32. package/dist/workspace-client/factory.d.ts +1 -1
  33. package/dist/workspace-client/factory.js.map +1 -1
  34. package/dist/workspace-client/index.d.ts +4 -3
  35. package/dist/workspace-client/index.js +2 -2
  36. package/dist/workspace-client/modular.d.ts +109 -0
  37. package/dist/workspace-client/modular.d.ts.map +1 -0
  38. package/dist/workspace-client/modular.js +447 -0
  39. package/dist/workspace-client/modular.js.map +1 -0
  40. package/dist/workspace-client/options.d.ts +29 -0
  41. package/dist/workspace-client/options.d.ts.map +1 -0
  42. package/dist/workspace-client/types.d.ts +35 -38
  43. package/dist/workspace-client/types.d.ts.map +1 -1
  44. package/docs/api/appkit/Class.ApiError.md +110 -0
  45. package/docs/api/appkit/Class.DatabricksAdapter.md +2 -2
  46. package/docs/api/appkit/Class.SupervisorApiAdapter.md +1 -1
  47. package/docs/api/appkit/Function.generateDatabaseCredential.md +2 -2
  48. package/docs/api/appkit/Function.getWorkspaceClient.md +2 -2
  49. package/docs/api/appkit/Interface.DirectoryEntry.md +62 -0
  50. package/docs/api/appkit/Interface.DownloadResponse.md +45 -0
  51. package/docs/api/appkit/Interface.JobAPI.md +20 -12
  52. package/docs/api/appkit/Interface.LakebasePoolConfig.md +1 -1
  53. package/docs/api/appkit/Interface.WorkspaceClient.md +168 -26
  54. package/docs/api/appkit/Interface.WorkspaceClientOptions.md +1 -14
  55. package/docs/api/appkit/TypeAlias.FilesDirectoryEntry.md +8 -0
  56. package/docs/api/appkit/TypeAlias.FilesDownloadResponse.md +8 -0
  57. package/docs/api/appkit/TypeAlias.JobsExport.md +1 -1
  58. package/docs/api/appkit/TypeAlias.WorkspaceClientLike.md +16 -0
  59. package/docs/api/appkit-ui/data/DataTable.md +16 -16
  60. package/docs/api/appkit.md +7 -2
  61. package/docs/plugins/files.md +20 -3
  62. package/docs/plugins/jobs.md +9 -9
  63. package/docs/plugins/testing.md +10 -8
  64. package/llms.txt +7 -2
  65. package/node_modules/@databricks/sdk-genie/LICENSE +203 -0
  66. package/node_modules/@databricks/sdk-genie/README.md +23 -0
  67. package/node_modules/@databricks/sdk-genie/dist/package.js +7 -0
  68. package/node_modules/@databricks/sdk-genie/dist/package.js.map +1 -0
  69. package/node_modules/@databricks/sdk-genie/dist/v1/client.d.ts +175 -0
  70. package/node_modules/@databricks/sdk-genie/dist/v1/client.d.ts.map +1 -0
  71. package/node_modules/@databricks/sdk-genie/dist/v1/client.js +829 -0
  72. package/node_modules/@databricks/sdk-genie/dist/v1/client.js.map +1 -0
  73. package/node_modules/@databricks/sdk-genie/dist/v1/index.d.ts +3 -0
  74. package/node_modules/@databricks/sdk-genie/dist/v1/index.js +4 -0
  75. package/node_modules/@databricks/sdk-genie/dist/v1/model.d.ts +1799 -0
  76. package/node_modules/@databricks/sdk-genie/dist/v1/model.d.ts.map +1 -0
  77. package/node_modules/@databricks/sdk-genie/dist/v1/model.js +1097 -0
  78. package/node_modules/@databricks/sdk-genie/dist/v1/model.js.map +1 -0
  79. package/node_modules/@databricks/sdk-genie/dist/v1/transport.d.ts +37 -0
  80. package/node_modules/@databricks/sdk-genie/dist/v1/transport.d.ts.map +1 -0
  81. package/node_modules/@databricks/sdk-genie/dist/v1/transport.js +73 -0
  82. package/node_modules/@databricks/sdk-genie/dist/v1/transport.js.map +1 -0
  83. package/node_modules/@databricks/sdk-genie/dist/v1/utils.d.ts +43 -0
  84. package/node_modules/@databricks/sdk-genie/dist/v1/utils.d.ts.map +1 -0
  85. package/node_modules/@databricks/sdk-genie/dist/v1/utils.js +130 -0
  86. package/node_modules/@databricks/sdk-genie/dist/v1/utils.js.map +1 -0
  87. package/node_modules/@databricks/sdk-genie/package.json +46 -0
  88. package/node_modules/@databricks/sdk-statementexecution/LICENSE +203 -0
  89. package/node_modules/@databricks/sdk-statementexecution/README.md +23 -0
  90. package/node_modules/@databricks/sdk-statementexecution/dist/package.js +7 -0
  91. package/node_modules/@databricks/sdk-statementexecution/dist/package.js.map +1 -0
  92. package/node_modules/@databricks/sdk-statementexecution/dist/v1/client.d.ts +91 -0
  93. package/node_modules/@databricks/sdk-statementexecution/dist/v1/client.d.ts.map +1 -0
  94. package/node_modules/@databricks/sdk-statementexecution/dist/v1/client.js +183 -0
  95. package/node_modules/@databricks/sdk-statementexecution/dist/v1/client.js.map +1 -0
  96. package/node_modules/@databricks/sdk-statementexecution/dist/v1/index.d.ts +3 -0
  97. package/node_modules/@databricks/sdk-statementexecution/dist/v1/index.js +4 -0
  98. package/node_modules/@databricks/sdk-statementexecution/dist/v1/model.d.ts +506 -0
  99. package/node_modules/@databricks/sdk-statementexecution/dist/v1/model.d.ts.map +1 -0
  100. package/node_modules/@databricks/sdk-statementexecution/dist/v1/model.js +302 -0
  101. package/node_modules/@databricks/sdk-statementexecution/dist/v1/model.js.map +1 -0
  102. package/node_modules/@databricks/sdk-statementexecution/dist/v1/transport.d.ts +37 -0
  103. package/node_modules/@databricks/sdk-statementexecution/dist/v1/transport.d.ts.map +1 -0
  104. package/node_modules/@databricks/sdk-statementexecution/dist/v1/transport.js +73 -0
  105. package/node_modules/@databricks/sdk-statementexecution/dist/v1/transport.js.map +1 -0
  106. package/node_modules/@databricks/sdk-statementexecution/dist/v1/utils.d.ts +25 -0
  107. package/node_modules/@databricks/sdk-statementexecution/dist/v1/utils.d.ts.map +1 -0
  108. package/node_modules/@databricks/sdk-statementexecution/dist/v1/utils.js +87 -0
  109. package/node_modules/@databricks/sdk-statementexecution/dist/v1/utils.js.map +1 -0
  110. package/node_modules/@databricks/sdk-statementexecution/package.json +46 -0
  111. package/node_modules/@databricks/sdk-vectorsearch/LICENSE +203 -0
  112. package/node_modules/@databricks/sdk-vectorsearch/README.md +23 -0
  113. package/node_modules/@databricks/sdk-vectorsearch/dist/package.js +7 -0
  114. package/node_modules/@databricks/sdk-vectorsearch/dist/package.js.map +1 -0
  115. package/node_modules/@databricks/sdk-vectorsearch/dist/v1/client.d.ts +70 -0
  116. package/node_modules/@databricks/sdk-vectorsearch/dist/v1/client.d.ts.map +1 -0
  117. package/node_modules/@databricks/sdk-vectorsearch/dist/v1/client.js +474 -0
  118. package/node_modules/@databricks/sdk-vectorsearch/dist/v1/client.js.map +1 -0
  119. package/node_modules/@databricks/sdk-vectorsearch/dist/v1/index.d.ts +3 -0
  120. package/node_modules/@databricks/sdk-vectorsearch/dist/v1/index.js +4 -0
  121. package/node_modules/@databricks/sdk-vectorsearch/dist/v1/model.d.ts +704 -0
  122. package/node_modules/@databricks/sdk-vectorsearch/dist/v1/model.d.ts.map +1 -0
  123. package/node_modules/@databricks/sdk-vectorsearch/dist/v1/model.js +635 -0
  124. package/node_modules/@databricks/sdk-vectorsearch/dist/v1/model.js.map +1 -0
  125. package/node_modules/@databricks/sdk-vectorsearch/dist/v1/transport.d.ts +37 -0
  126. package/node_modules/@databricks/sdk-vectorsearch/dist/v1/transport.d.ts.map +1 -0
  127. package/node_modules/@databricks/sdk-vectorsearch/dist/v1/transport.js +73 -0
  128. package/node_modules/@databricks/sdk-vectorsearch/dist/v1/transport.js.map +1 -0
  129. package/node_modules/@databricks/sdk-vectorsearch/dist/v1/utils.d.ts +37 -0
  130. package/node_modules/@databricks/sdk-vectorsearch/dist/v1/utils.d.ts.map +1 -0
  131. package/node_modules/@databricks/sdk-vectorsearch/dist/v1/utils.js +104 -0
  132. package/node_modules/@databricks/sdk-vectorsearch/dist/v1/utils.js.map +1 -0
  133. package/node_modules/@databricks/sdk-vectorsearch/package.json +46 -0
  134. package/package.json +29 -4
  135. package/sbom.cdx.json +1 -1
  136. package/dist/shared/src/workspace-client/errors.d.ts +0 -1
  137. package/dist/shared/src/workspace-client/legacy.d.ts +0 -3
  138. package/dist/workspace-client/legacy.d.ts +0 -34
  139. package/dist/workspace-client/legacy.d.ts.map +0 -1
  140. package/dist/workspace-client/legacy.js +0 -23
  141. package/dist/workspace-client/legacy.js.map +0 -1
  142. package/docs/api/appkit/Interface.WorkspaceClientLike.md +0 -67
@@ -0,0 +1,447 @@
1
+ import { ApiError as ApiError$1 } from "./errors.js";
2
+ import { execFile } from "node:child_process";
3
+ import { promisify } from "node:util";
4
+ import { ApiError as ModularApiError } from "@databricks/sdk-core/apierror";
5
+ import { STATUS_CODES } from "node:http";
6
+ import { newTokenCredentials, tokenProviderFn } from "@databricks/sdk-auth";
7
+ import { DefaultCredentialsError, M2mCredentialsError, PatCredentialsError, U2mCredentialsError, defaultCredentials, newM2mCredentials, newPatCredentials, newU2mCredentials } from "@databricks/sdk-auth/credentials";
8
+ import { newFetchHttpClient } from "@databricks/sdk-core/http";
9
+ import { resolve, resolve as resolveProfile } from "@databricks/sdk-core/profiles";
10
+ import { ScimClient } from "@databricks/sdk-scim/v1";
11
+ import { StatementExecutionClient } from "@databricks/sdk-statementexecution/v1";
12
+ import { WarehousesClient } from "@databricks/sdk-warehouses/v1";
13
+
14
+ //#region src/workspace-client/modular.ts
15
+ /**
16
+ * The single module allowed to import the modular `@databricks/sdk-*` SDK
17
+ * directly — the new-SDK sibling of {@link ./legacy.ts}. Every other AppKit
18
+ * module reaches these clients through the {@link WorkspaceClient} facade and
19
+ * the type re-exports below, so the modular SDK stays isolated exactly like the
20
+ * legacy one (the oxlint `no-restricted-imports` boundary walls `@databricks/sdk-*`
21
+ * off everywhere outside `packages/shared/src/workspace-client/`).
22
+ *
23
+ * Migrated services are built here as per-service clients; the facade delegates
24
+ * their accessors to these instead of the legacy monolithic client. Currently
25
+ * `warehouses`, `statementExecution`, `currentUser` (SCIM), `genie`, `jobs`,
26
+ * `files`, `vectorSearch`, `tables`, `modelServing`, `volumes`, `functions`,
27
+ * `connections`, `database`, `postgres`, `experiments` and `apps` are
28
+ * migrated, plus the auth + raw-request seam ({@link buildWorkspaceAuth}).
29
+ * Only `servingEndpoints`, `config` and `apiClient` still route through
30
+ * `legacy.ts`.
31
+ *
32
+ * NOTE: statementExecution relies on a pinned pnpm patch
33
+ * (`patches/@databricks__sdk-statementexecution@0.52.0.patch`) that restores the
34
+ * undocumented Reyden `attachment` response field, which the SDK's generated
35
+ * unmarshal transform would otherwise strip.
36
+ *
37
+ * NOTE: vectorSearch relies on a pinned pnpm patch
38
+ * (`patches/@databricks__sdk-vectorsearch@0.51.0.patch`): it adds the
39
+ * undocumented query `debug_level` request / `debug_info` response fields (the
40
+ * source of ai-search `queryTimeMs`), and lets row values be `bigint`, since the
41
+ * SDK parses with json-bigint and the unpatched schema rejects ints over 2^53.
42
+ *
43
+ * NOTE: genie relies on a pinned pnpm patch
44
+ * (`patches/@databricks__sdk-genie@0.54.0.patch`): the generated model types the
45
+ * query result's `data_array` as protobuf `ListValue[]` (`{ values: [...] }`), but
46
+ * the API returns plain `JSON_ARRAY` rows (`[["a", null], ...]`), so the unmarshal
47
+ * schema rejected every real query result. The patch restores `(string | null)[][]`.
48
+ */
49
+ /**
50
+ * Prepend `https://` to a scheme-less host. The legacy SDK normalized the host
51
+ * this way; the modular SDK does NOT — it passes the host straight into `fetch`,
52
+ * so a bare `DATABRICKS_HOST=my-workspace.cloud.databricks.com` (the common form,
53
+ * and what the Databricks Apps runtime sets) yields `TypeError: Invalid URL`.
54
+ */
55
+ function normalizeHost(host) {
56
+ const trimmed = host?.trim();
57
+ if (!trimmed) return void 0;
58
+ return /^https?:\/\//i.test(trimmed) ? trimmed : `https://${trimmed}`;
59
+ }
60
+ const TOKEN_REFRESH_MARGIN_MS = 4e4;
61
+ /**
62
+ * Cache a token until shortly before it expires. The modular `newM2mCredentials`
63
+ * caches only the token endpoint and mints a fresh OAuth token on EVERY request;
64
+ * the legacy SDK reused it until expiry. Concurrent callers share one in-flight
65
+ * fetch. Like the legacy SDK, a token without an expiry is reused indefinitely.
66
+ */
67
+ function withTokenCache(credentials) {
68
+ let current;
69
+ let inflight;
70
+ const isFresh = (t) => t.expiry === void 0 || t.expiry.getTime() - TOKEN_REFRESH_MARGIN_MS > Date.now();
71
+ return newTokenCredentials(credentials.name(), tokenProviderFn(async () => {
72
+ if (current && isFresh(current)) return current;
73
+ inflight ??= credentials.token().then((t) => current = t).finally(() => {
74
+ inflight = void 0;
75
+ });
76
+ return inflight;
77
+ }));
78
+ }
79
+ /**
80
+ * The SDK default chain (profile / `~/.databrickscfg`), with the token cache the
81
+ * chain lacks: its CLI strategy shells out to `databricks auth token` and its
82
+ * M2M strategy mints a new OAuth token on EVERY request. `DefaultCredentials`
83
+ * hides the token behind `authHeaders()`, so mirror its strategy order (PAT →
84
+ * M2M → CLI) to get a cacheable `TokenCredentials`. A profile `authType` naming
85
+ * one of these (`databricks auth login` writes `databricks-cli`) pins that
86
+ * strategy; other auth types and `groupId` keep the SDK's own (uncached) logic.
87
+ * TODO: drop once sdk-auth caches tokens in its M2M and CLI credentials.
88
+ */
89
+ function cachedDefaultCredentials(profileOptions) {
90
+ const select = async () => {
91
+ const profile = await resolve(profileOptions);
92
+ const host = normalizeHost(profile.host)?.replace(/\/+$/, "");
93
+ const { name, token, clientId, clientSecret, authType } = profile;
94
+ const allows = (strategy) => !authType || authType === strategy;
95
+ if (host && !profile.groupId) {
96
+ if (token && allows("pat")) return newPatCredentials(token.value);
97
+ if (clientId && clientSecret && allows("oauth-m2m")) return withTokenCache(newM2mCredentials({
98
+ host,
99
+ clientId,
100
+ clientSecret: clientSecret.value,
101
+ ...profile.accountId !== void 0 && { accountId: profile.accountId }
102
+ }));
103
+ if (name && allows("databricks-cli")) return withTokenCache(newU2mCredentials({
104
+ profile: name,
105
+ ...profile.databricksCliPath !== void 0 && { cliPath: profile.databricksCliPath }
106
+ }));
107
+ }
108
+ return defaultCredentials({ profile: {
109
+ ...profile,
110
+ ...host && { host }
111
+ } });
112
+ };
113
+ let selected;
114
+ return {
115
+ name: () => "default",
116
+ async authHeaders() {
117
+ selected ??= select().catch((e) => {
118
+ selected = void 0;
119
+ throw e;
120
+ });
121
+ return (await selected).authHeaders();
122
+ }
123
+ };
124
+ }
125
+ const execFileAsync = promisify(execFile);
126
+ /** Auth could not be configured (missing or unsupported credentials). */
127
+ var AuthConfigError = class extends Error {
128
+ name = "AuthConfigError";
129
+ };
130
+ /** Whether `e` means auth isn't set up, from AppKit or the modular SDK. */
131
+ function isAuthConfigError(e) {
132
+ return e instanceof AuthConfigError || e instanceof DefaultCredentialsError || e instanceof M2mCredentialsError || e instanceof PatCredentialsError || e instanceof U2mCredentialsError;
133
+ }
134
+ /**
135
+ * Databricks CLI auth for a host, not a profile: what the legacy SDK used when
136
+ * only a host was configured. The modular CLI strategy needs a profile name.
137
+ */
138
+ function cliHostCredentials(host) {
139
+ return withTokenCache(newTokenCredentials("databricks-cli", tokenProviderFn(async () => {
140
+ let stdout;
141
+ try {
142
+ ({stdout} = await execFileAsync("databricks", [
143
+ "auth",
144
+ "token",
145
+ "--host",
146
+ host
147
+ ]));
148
+ } catch (e) {
149
+ const err = e;
150
+ throw new AuthConfigError(`cannot get an access token for ${host} from the Databricks CLI: ${String(err.stderr ?? err.message ?? e).trim()}`);
151
+ }
152
+ const parsed = JSON.parse(stdout);
153
+ return {
154
+ value: parsed.access_token,
155
+ ...parsed.expiry && { expiry: new Date(parsed.expiry) }
156
+ };
157
+ })));
158
+ }
159
+ /** Credentials that fail on use with `message`, so boot surfaces it clearly. */
160
+ function unsupportedCredentials(message) {
161
+ return {
162
+ name: () => "unsupported",
163
+ authHeaders: async () => {
164
+ throw new AuthConfigError(message);
165
+ }
166
+ };
167
+ }
168
+ /**
169
+ * Map wrapper options onto the modular SDK's `ClientOptions`, reproducing the
170
+ * legacy SDK's auth resolution: explicit token → PAT (the OBO path); profile →
171
+ * profile file; otherwise the service principal from the environment. It carries
172
+ * the privilege-escalation guard — check `token !== undefined` (NOT truthiness)
173
+ * so an explicitly-passed token, even an empty string, pins the PAT path and
174
+ * fails loudly at request time rather than silently falling through to the
175
+ * service-principal env credentials (which would be an OBO privilege escalation).
176
+ */
177
+ function mapToClientOptions(opts) {
178
+ const clientOptions = {};
179
+ const host = normalizeHost(opts.host ?? (opts.profile ? void 0 : process.env.DATABRICKS_HOST));
180
+ if (host) clientOptions.host = host;
181
+ if (opts.token !== void 0) clientOptions.credentials = newPatCredentials(opts.token);
182
+ else if (opts.profile) {
183
+ clientOptions.profileOptions = { profile: opts.profile };
184
+ clientOptions.credentials = cachedDefaultCredentials({ profile: opts.profile });
185
+ } else {
186
+ const clientId = process.env.DATABRICKS_CLIENT_ID;
187
+ const clientSecret = process.env.DATABRICKS_CLIENT_SECRET;
188
+ const envToken = process.env.DATABRICKS_TOKEN;
189
+ const authType = process.env.DATABRICKS_AUTH_TYPE?.trim() || void 0;
190
+ const allows = (strategy) => !authType || authType === strategy;
191
+ if (host && clientId && clientSecret && allows("oauth-m2m")) clientOptions.credentials = withTokenCache(newM2mCredentials({
192
+ host,
193
+ clientId,
194
+ clientSecret
195
+ }));
196
+ else if (envToken && allows("pat")) clientOptions.credentials = newPatCredentials(envToken);
197
+ else if (host && allows("databricks-cli")) clientOptions.credentials = cliHostCredentials(host);
198
+ else if (!host && !authType) clientOptions.credentials = cachedDefaultCredentials();
199
+ else clientOptions.credentials = unsupportedCredentials(`DATABRICKS_AUTH_TYPE=${authType ?? ""} cannot be satisfied: supported types are pat (DATABRICKS_TOKEN), oauth-m2m (DATABRICKS_CLIENT_ID/SECRET) and databricks-cli (\`databricks auth login\`).`);
200
+ }
201
+ clientOptions.httpClient = buildHttpClient(opts);
202
+ return clientOptions;
203
+ }
204
+ /**
205
+ * Wrap the SDK's default fetch transport to prepend AppKit's product segment
206
+ * (e.g. `databricks-appkit/0.88.1`) to the outgoing `User-Agent`, which
207
+ * Databricks-side dashboards match on.
208
+ *
209
+ * Why the transport and not the SDK's `setProduct`: that is process-global,
210
+ * while the header on the `httpClient` is per-client, and the wrapper ships
211
+ * inside appkit's bundled `dist`, so it also reaches deployed apps. The SDK's
212
+ * own client-info (`sdk-js-core/…`, runtime) is already on `request.headers`,
213
+ * so prepending keeps it intact after AppKit's segment.
214
+ *
215
+ * The wrapper also retries (see `sendWithRetry`). With no product configured
216
+ * (build-time callers) it adds no AppKit segment, like the legacy behavior.
217
+ */
218
+ function buildHttpClient(opts) {
219
+ const co = opts.clientOptions;
220
+ let appkitUserAgent;
221
+ if (co?.product && co?.productVersion) {
222
+ const segments = [`${co.product}/${co.productVersion}`];
223
+ if (co.userAgentExtra) for (const [key, value] of Object.entries(co.userAgentExtra)) segments.push(`${key}/${String(value)}`);
224
+ appkitUserAgent = segments.join(" ");
225
+ }
226
+ const base = newFetchHttpClient();
227
+ return { send(request) {
228
+ if (appkitUserAgent) {
229
+ const existing = request.headers.get("User-Agent");
230
+ request.headers.set("User-Agent", existing ? `${appkitUserAgent} ${existing}` : appkitUserAgent);
231
+ }
232
+ return sendWithRetry(base, request);
233
+ } };
234
+ }
235
+ const RETRY_TIMEOUT_MS = 3e5;
236
+ const TRANSIENT_ERROR_MESSAGES = [
237
+ "com.databricks.backend.manager.util.UnknownWorkerEnvironmentException",
238
+ "does not have any associated worker environments",
239
+ "There is no worker environment with id",
240
+ "Unknown worker environment",
241
+ "ClusterNotReadyException",
242
+ "connection reset by peer",
243
+ "TLS handshake timeout",
244
+ "connection refused",
245
+ "Unexpected error",
246
+ "i/o timeout"
247
+ ];
248
+ async function sendWithRetry(base, request) {
249
+ if (request.body instanceof ReadableStream) return base.send(request);
250
+ const deadline = Date.now() + RETRY_TIMEOUT_MS;
251
+ for (let attempt = 1;; attempt++) {
252
+ const response = await base.send(request);
253
+ if (response.statusCode < 400) return response;
254
+ const body = new Uint8Array(await new Response(response.body).arrayBuffer());
255
+ const text = new TextDecoder().decode(body);
256
+ const retryable = response.statusCode === 429 || TRANSIENT_ERROR_MESSAGES.some((m) => text.includes(m));
257
+ const waitMs = Math.min(attempt * 1e3 + 50 + Math.random() * 700, 1e4);
258
+ if (!retryable || request.signal?.aborted || Date.now() + waitMs > deadline) return {
259
+ ...response,
260
+ body: new Response(body).body
261
+ };
262
+ await new Promise((resolve) => setTimeout(resolve, waitMs));
263
+ }
264
+ }
265
+ /**
266
+ * Build host/credential resolution from {@link mapToClientOptions}, mirroring
267
+ * the modular SDK's `resolveClientConfig` (sdk-warehouses `dist/v1/transport.js`):
268
+ * resolve the profile from config file + env, explicit options win, and fall
269
+ * back to `defaultCredentials` over the resolved profile. Resolved once, lazily;
270
+ * a failed resolution is retried on the next call.
271
+ */
272
+ function buildWorkspaceAuth(opts) {
273
+ const options = mapToClientOptions(opts);
274
+ const transport = options.httpClient ?? newFetchHttpClient();
275
+ let resolved;
276
+ const resolveOnce = () => {
277
+ resolved ??= (async () => {
278
+ const profile = await resolve(options.profileOptions);
279
+ const host = normalizeHost(options.host ?? profile.host)?.replace(/\/+$/, "");
280
+ if (!host) throw new Error("Host is required.");
281
+ return {
282
+ host,
283
+ credentials: options.credentials ?? defaultCredentials({ profile: {
284
+ ...profile,
285
+ host
286
+ } })
287
+ };
288
+ })().catch((e) => {
289
+ resolved = void 0;
290
+ throw e;
291
+ });
292
+ return resolved;
293
+ };
294
+ const authenticate = async (headers) => {
295
+ const { credentials } = await resolveOnce();
296
+ for (const h of await credentials.authHeaders()) headers.set(h.key, h.value);
297
+ };
298
+ return {
299
+ getHost: async () => (await resolveOnce()).host,
300
+ authenticate,
301
+ async request(req) {
302
+ const url = new URL(req.path, (await resolveOnce()).host);
303
+ for (const [k, v] of Object.entries(req.query ?? {})) url.searchParams.set(k, v);
304
+ const headers = new Headers(req.headers);
305
+ await authenticate(headers);
306
+ const res = await transport.send({
307
+ url: url.toString(),
308
+ method: req.method,
309
+ headers,
310
+ body: req.body,
311
+ signal: req.signal
312
+ });
313
+ const nullBody = [
314
+ 204,
315
+ 205,
316
+ 304
317
+ ].includes(res.statusCode);
318
+ const response = new Response(nullBody ? null : res.body, {
319
+ status: res.statusCode,
320
+ statusText: STATUS_CODES[res.statusCode],
321
+ headers: res.headers
322
+ });
323
+ if (!response.ok) throw await toApiError(response);
324
+ return response;
325
+ }
326
+ };
327
+ }
328
+ /**
329
+ * Same error class the legacy `apiClient.request` threw, so existing catch
330
+ * sites (`instanceof ApiError`, `.statusCode`, `.errorCode`) keep working.
331
+ * Message + code follow the legacy `parseErrorFromResponse` so callers that
332
+ * surface `err.message` (e.g. the serving plugin's 502 body) are unchanged:
333
+ * a body without both `error_code` and `message` (plain text, HTML, or a
334
+ * model-specific error JSON) becomes `Response from server (<status text>) <body>`.
335
+ */
336
+ async function toApiError(response) {
337
+ const text = await response.text();
338
+ let json;
339
+ try {
340
+ json = JSON.parse(text);
341
+ } catch {}
342
+ if (json?.message && json.error_code) return new ApiError$1(json.error || json.message, json.error_code, response.status, json, json.details ?? []);
343
+ const html = text.match(/<pre>(.*)<\/pre>/) ?? text.match(/<title>(Error \d+.*?)<\/title>/);
344
+ return new ApiError$1(html ? html[1].trim().replace(/([\s.])*$/, "") : `Response from server (${response.statusText}) ${text}`, response.statusText || "UNKNOWN", response.status, json ?? text, []);
345
+ }
346
+ /** Build a modular Warehouses client from wrapper options. */
347
+ function buildWarehousesClient(opts) {
348
+ return new WarehousesClient(mapToClientOptions(opts));
349
+ }
350
+ /** Build a modular Statement Execution client from wrapper options. */
351
+ function buildStatementExecutionClient(opts) {
352
+ return new StatementExecutionClient(mapToClientOptions(opts));
353
+ }
354
+ /**
355
+ * Build a modular SCIM client from wrapper options. Backs the facade's
356
+ * `currentUser` accessor: legacy `currentUser.me()` is `ScimClient.me({})`.
357
+ */
358
+ function buildScimClient(opts) {
359
+ return new ScimClient(mapToClientOptions(opts));
360
+ }
361
+ /** Build a modular Apps client from wrapper options. */
362
+ function buildAppsClient(opts) {
363
+ return lazyClient(() => import("@databricks/sdk-apps/v1").then((m) => m.AppsClient), mapToClientOptions(opts));
364
+ }
365
+ /**
366
+ * Defer loading an SDK client's module until its first method call, so app
367
+ * boot doesn't pay for clients it never uses. Generated methods return either
368
+ * a Promise or (`*Iter`) an AsyncGenerator, so each proxied call returns the
369
+ * pending result as a Promise that is also async-iterable.
370
+ */
371
+ function lazyClient(load, options) {
372
+ let client;
373
+ return new Proxy({}, { get(_target, prop) {
374
+ if (typeof prop === "symbol" || prop === "then") return void 0;
375
+ return (...args) => {
376
+ client ??= load().then((Client) => new Client(options));
377
+ const result = client.then((c) => c[prop](...args));
378
+ return Object.assign(result, { async *[Symbol.asyncIterator]() {
379
+ yield* await result;
380
+ } });
381
+ };
382
+ } });
383
+ }
384
+ /** Build a modular Genie client from wrapper options. */
385
+ function buildGenieClient(opts) {
386
+ return lazyClient(() => import("@databricks/sdk-genie/v1").then((m) => m.GenieClient), mapToClientOptions(opts));
387
+ }
388
+ /** Build a modular Jobs (API 2.2) client from wrapper options. */
389
+ function buildJobsClient(opts) {
390
+ return lazyClient(() => import("@databricks/sdk-jobs/v2").then((m) => m.JobsClient), mapToClientOptions(opts));
391
+ }
392
+ /**
393
+ * Build a modular Files client from wrapper options. `getFileMetadata` is not
394
+ * used: its generated HEAD call parses the (empty) body and drops the response
395
+ * headers that carry the metadata, so the connector issues that HEAD through
396
+ * {@link WorkspaceAuth.request} instead.
397
+ */
398
+ function buildFilesClient(opts) {
399
+ return lazyClient(() => import("@databricks/sdk-files/v2").then((m) => m.FilesClient), mapToClientOptions(opts));
400
+ }
401
+ /**
402
+ * Build a modular Vector Search client from wrapper options. Query calls rely
403
+ * on the sdk-vectorsearch pnpm patch (`debugLevel` / `debugInfo`, `bigint` rows).
404
+ */
405
+ function buildVectorSearchClient(opts) {
406
+ return lazyClient(() => import("@databricks/sdk-vectorsearch/v1").then((m) => m.VectorSearchClient), mapToClientOptions(opts));
407
+ }
408
+ /** Build a modular Model Serving (serving endpoints) client from wrapper options. */
409
+ function buildModelServingClient(opts) {
410
+ return lazyClient(() => import("@databricks/sdk-modelserving/v1").then((m) => m.ModelServingClient), mapToClientOptions(opts));
411
+ }
412
+ /** Build a modular MLflow Experiments client from wrapper options. */
413
+ function buildExperimentsClient(opts) {
414
+ return lazyClient(() => import("@databricks/sdk-experiments/v1").then((m) => m.ExperimentsClient), mapToClientOptions(opts));
415
+ }
416
+ /** Build a modular Unity Catalog Tables client from wrapper options. */
417
+ function buildTablesClient(opts) {
418
+ return lazyClient(() => import("@databricks/sdk-uc-tables/v1").then((m) => m.TablesClient), mapToClientOptions(opts));
419
+ }
420
+ /** Build a modular Unity Catalog Volumes client from wrapper options. */
421
+ function buildVolumesClient(opts) {
422
+ return lazyClient(() => import("@databricks/sdk-uc-volumes/v1").then((m) => m.VolumesClient), mapToClientOptions(opts));
423
+ }
424
+ /** Build a modular Unity Catalog Functions client from wrapper options. */
425
+ function buildFunctionsClient(opts) {
426
+ return lazyClient(() => import("@databricks/sdk-uc-functions/v1").then((m) => m.FunctionsClient), mapToClientOptions(opts));
427
+ }
428
+ /** Build a modular Unity Catalog Connections client from wrapper options. */
429
+ function buildConnectionsClient(opts) {
430
+ return lazyClient(() => import("@databricks/sdk-uc-connections/v1").then((m) => m.ConnectionsClient), mapToClientOptions(opts));
431
+ }
432
+ /** Build a modular Lakebase (provisioned) Database client from wrapper options. */
433
+ function buildDatabaseClient(opts) {
434
+ return lazyClient(() => import("@databricks/sdk-database/v1").then((m) => m.DatabaseClient), mapToClientOptions(opts));
435
+ }
436
+ /**
437
+ * Build a modular Lakebase Postgres (autoscaling: projects, branches,
438
+ * endpoints) client from wrapper options. Distinct from the provisioned
439
+ * `/api/2.0/database` instance API.
440
+ */
441
+ function buildPostgresClient(opts) {
442
+ return lazyClient(() => import("@databricks/sdk-postgres/v1").then((m) => m.PostgresClient), mapToClientOptions(opts));
443
+ }
444
+
445
+ //#endregion
446
+ export { ModularApiError, buildAppsClient, buildConnectionsClient, buildDatabaseClient, buildExperimentsClient, buildFilesClient, buildFunctionsClient, buildGenieClient, buildJobsClient, buildModelServingClient, buildPostgresClient, buildScimClient, buildStatementExecutionClient, buildTablesClient, buildVectorSearchClient, buildVolumesClient, buildWarehousesClient, buildWorkspaceAuth, isAuthConfigError, resolveProfile };
447
+ //# sourceMappingURL=modular.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"modular.js","names":["ApiError"],"sources":["../../src/workspace-client/modular.ts"],"sourcesContent":["/**\n * The single module allowed to import the modular `@databricks/sdk-*` SDK\n * directly — the new-SDK sibling of {@link ./legacy.ts}. Every other AppKit\n * module reaches these clients through the {@link WorkspaceClient} facade and\n * the type re-exports below, so the modular SDK stays isolated exactly like the\n * legacy one (the oxlint `no-restricted-imports` boundary walls `@databricks/sdk-*`\n * off everywhere outside `packages/shared/src/workspace-client/`).\n *\n * Migrated services are built here as per-service clients; the facade delegates\n * their accessors to these instead of the legacy monolithic client. Currently\n * `warehouses`, `statementExecution`, `currentUser` (SCIM), `genie`, `jobs`,\n * `files`, `vectorSearch`, `tables`, `modelServing`, `volumes`, `functions`,\n * `connections`, `database`, `postgres`, `experiments` and `apps` are\n * migrated, plus the auth + raw-request seam ({@link buildWorkspaceAuth}).\n * Only `servingEndpoints`, `config` and `apiClient` still route through\n * `legacy.ts`.\n *\n * NOTE: statementExecution relies on a pinned pnpm patch\n * (`patches/@databricks__sdk-statementexecution@0.52.0.patch`) that restores the\n * undocumented Reyden `attachment` response field, which the SDK's generated\n * unmarshal transform would otherwise strip.\n *\n * NOTE: vectorSearch relies on a pinned pnpm patch\n * (`patches/@databricks__sdk-vectorsearch@0.51.0.patch`): it adds the\n * undocumented query `debug_level` request / `debug_info` response fields (the\n * source of ai-search `queryTimeMs`), and lets row values be `bigint`, since the\n * SDK parses with json-bigint and the unpatched schema rejects ints over 2^53.\n *\n * NOTE: genie relies on a pinned pnpm patch\n * (`patches/@databricks__sdk-genie@0.54.0.patch`): the generated model types the\n * query result's `data_array` as protobuf `ListValue[]` (`{ values: [...] }`), but\n * the API returns plain `JSON_ARRAY` rows (`[[\"a\", null], ...]`), so the unmarshal\n * schema rejected every real query result. The patch restores `(string | null)[][]`.\n */\nimport { execFile } from \"node:child_process\";\nimport { STATUS_CODES } from \"node:http\";\nimport { promisify } from \"node:util\";\n\nimport type { AppsClient } from \"@databricks/sdk-apps/v1\";\nimport {\n type Credentials,\n newTokenCredentials,\n type Token,\n type TokenCredentials,\n tokenProviderFn,\n} from \"@databricks/sdk-auth\";\nimport {\n DefaultCredentialsError,\n defaultCredentials,\n M2mCredentialsError,\n newM2mCredentials,\n newPatCredentials,\n newU2mCredentials,\n PatCredentialsError,\n U2mCredentialsError,\n} from \"@databricks/sdk-auth/credentials\";\nimport {\n type HttpClient,\n type HttpRequest,\n newFetchHttpClient,\n} from \"@databricks/sdk-core/http\";\nimport { type ProfileOptions, resolve } from \"@databricks/sdk-core/profiles\";\nimport type { DatabaseClient } from \"@databricks/sdk-database/v1\";\nimport type { ExperimentsClient } from \"@databricks/sdk-experiments/v1\";\nimport type { FilesClient } from \"@databricks/sdk-files/v2\";\nimport type { GenieClient } from \"@databricks/sdk-genie/v1\";\nimport type { JobsClient } from \"@databricks/sdk-jobs/v2\";\nimport type { ModelServingClient } from \"@databricks/sdk-modelserving/v1\";\nimport type { ClientOptions } from \"@databricks/sdk-options/client\";\nimport type { PostgresClient } from \"@databricks/sdk-postgres/v1\";\nimport { ScimClient } from \"@databricks/sdk-scim/v1\";\nimport { StatementExecutionClient } from \"@databricks/sdk-statementexecution/v1\";\nimport type { ConnectionsClient } from \"@databricks/sdk-uc-connections/v1\";\nimport type { FunctionsClient } from \"@databricks/sdk-uc-functions/v1\";\nimport type { TablesClient } from \"@databricks/sdk-uc-tables/v1\";\nimport type { VolumesClient } from \"@databricks/sdk-uc-volumes/v1\";\nimport type { VectorSearchClient } from \"@databricks/sdk-vectorsearch/v1\";\nimport { WarehousesClient } from \"@databricks/sdk-warehouses/v1\";\n\nimport { ApiError } from \"./errors\";\nimport type { WorkspaceClientOptions } from \"./options\";\n\n/**\n * Prepend `https://` to a scheme-less host. The legacy SDK normalized the host\n * this way; the modular SDK does NOT — it passes the host straight into `fetch`,\n * so a bare `DATABRICKS_HOST=my-workspace.cloud.databricks.com` (the common form,\n * and what the Databricks Apps runtime sets) yields `TypeError: Invalid URL`.\n */\nfunction normalizeHost(host: string | undefined): string | undefined {\n const trimmed = host?.trim();\n if (!trimmed) return undefined;\n return /^https?:\\/\\//i.test(trimmed) ? trimmed : `https://${trimmed}`;\n}\n\n// Same margin as the legacy SDK: refresh 40s early, since Azure Databricks\n// rejects tokens that expire in 30s or less.\nconst TOKEN_REFRESH_MARGIN_MS = 40_000;\n\n/**\n * Cache a token until shortly before it expires. The modular `newM2mCredentials`\n * caches only the token endpoint and mints a fresh OAuth token on EVERY request;\n * the legacy SDK reused it until expiry. Concurrent callers share one in-flight\n * fetch. Like the legacy SDK, a token without an expiry is reused indefinitely.\n */\nfunction withTokenCache(credentials: TokenCredentials): TokenCredentials {\n let current: Token | undefined;\n let inflight: Promise<Token> | undefined;\n const isFresh = (t: Token) =>\n t.expiry === undefined ||\n t.expiry.getTime() - TOKEN_REFRESH_MARGIN_MS > Date.now();\n return newTokenCredentials(\n credentials.name(),\n tokenProviderFn(async () => {\n if (current && isFresh(current)) return current;\n inflight ??= credentials\n .token()\n .then((t) => (current = t))\n .finally(() => {\n inflight = undefined;\n });\n return inflight;\n }),\n );\n}\n\n/**\n * The SDK default chain (profile / `~/.databrickscfg`), with the token cache the\n * chain lacks: its CLI strategy shells out to `databricks auth token` and its\n * M2M strategy mints a new OAuth token on EVERY request. `DefaultCredentials`\n * hides the token behind `authHeaders()`, so mirror its strategy order (PAT →\n * M2M → CLI) to get a cacheable `TokenCredentials`. A profile `authType` naming\n * one of these (`databricks auth login` writes `databricks-cli`) pins that\n * strategy; other auth types and `groupId` keep the SDK's own (uncached) logic.\n * TODO: drop once sdk-auth caches tokens in its M2M and CLI credentials.\n */\nfunction cachedDefaultCredentials(\n profileOptions?: ProfileOptions,\n): Credentials {\n const select = async (): Promise<Credentials> => {\n const profile = await resolve(profileOptions);\n // Same as env M2M: OAuth discovery needs a scheme, which a profile may omit.\n const host = normalizeHost(profile.host)?.replace(/\\/+$/, \"\");\n const { name, token, clientId, clientSecret, authType } = profile;\n const allows = (strategy: string) => !authType || authType === strategy;\n if (host && !profile.groupId) {\n if (token && allows(\"pat\")) return newPatCredentials(token.value);\n if (clientId && clientSecret && allows(\"oauth-m2m\")) {\n return withTokenCache(\n newM2mCredentials({\n host,\n clientId,\n clientSecret: clientSecret.value,\n ...(profile.accountId !== undefined && {\n accountId: profile.accountId,\n }),\n }),\n );\n }\n if (name && allows(\"databricks-cli\")) {\n return withTokenCache(\n newU2mCredentials({\n profile: name,\n ...(profile.databricksCliPath !== undefined && {\n cliPath: profile.databricksCliPath,\n }),\n }),\n );\n }\n }\n return defaultCredentials({\n profile: { ...profile, ...(host && { host }) },\n });\n };\n let selected: Promise<Credentials> | undefined;\n return {\n name: () => \"default\",\n async authHeaders() {\n selected ??= select().catch((e) => {\n selected = undefined;\n throw e;\n });\n return (await selected).authHeaders();\n },\n };\n}\n\nconst execFileAsync = promisify(execFile);\n\n/** Auth could not be configured (missing or unsupported credentials). */\nexport class AuthConfigError extends Error {\n override name = \"AuthConfigError\";\n}\n\n/** Whether `e` means auth isn't set up, from AppKit or the modular SDK. */\nexport function isAuthConfigError(e: unknown): e is Error {\n return (\n e instanceof AuthConfigError ||\n e instanceof DefaultCredentialsError ||\n e instanceof M2mCredentialsError ||\n e instanceof PatCredentialsError ||\n e instanceof U2mCredentialsError\n );\n}\n\n/**\n * Databricks CLI auth for a host, not a profile: what the legacy SDK used when\n * only a host was configured. The modular CLI strategy needs a profile name.\n */\nfunction cliHostCredentials(host: string): TokenCredentials {\n return withTokenCache(\n newTokenCredentials(\n \"databricks-cli\",\n tokenProviderFn(async () => {\n let stdout: string;\n try {\n ({ stdout } = await execFileAsync(\"databricks\", [\n \"auth\",\n \"token\",\n \"--host\",\n host,\n ]));\n } catch (e) {\n const err = e as { stderr?: unknown; message?: string };\n const detail = String(err.stderr ?? err.message ?? e).trim();\n throw new AuthConfigError(\n `cannot get an access token for ${host} from the Databricks CLI: ${detail}`,\n );\n }\n const parsed = JSON.parse(stdout) as {\n access_token: string;\n expiry?: string;\n };\n return {\n value: parsed.access_token,\n ...(parsed.expiry && { expiry: new Date(parsed.expiry) }),\n };\n }),\n ),\n );\n}\n\n/** Credentials that fail on use with `message`, so boot surfaces it clearly. */\nfunction unsupportedCredentials(message: string): Credentials {\n return {\n name: () => \"unsupported\",\n authHeaders: async () => {\n throw new AuthConfigError(message);\n },\n };\n}\n\n/**\n * Map wrapper options onto the modular SDK's `ClientOptions`, reproducing the\n * legacy SDK's auth resolution: explicit token → PAT (the OBO path); profile →\n * profile file; otherwise the service principal from the environment. It carries\n * the privilege-escalation guard — check `token !== undefined` (NOT truthiness)\n * so an explicitly-passed token, even an empty string, pins the PAT path and\n * fails loudly at request time rather than silently falling through to the\n * service-principal env credentials (which would be an OBO privilege escalation).\n */\nfunction mapToClientOptions(opts: WorkspaceClientOptions): ClientOptions {\n const clientOptions: ClientOptions = {};\n // Resolve + scheme-normalize the host the way the legacy SDK did. Explicit\n // `opts.host` wins; otherwise fall back to `DATABRICKS_HOST` (env is where the\n // Apps runtime and dev set it). When a profile is selected without an explicit\n // host, defer to the SDK's profile-file resolution instead of the env.\n const host = normalizeHost(\n opts.host ?? (opts.profile ? undefined : process.env.DATABRICKS_HOST),\n );\n if (host) {\n clientOptions.host = host;\n }\n if (opts.token !== undefined) {\n // Explicit token (this is the OBO path: `asUser` passes the user's token).\n clientOptions.credentials = newPatCredentials(opts.token);\n } else if (opts.profile) {\n clientOptions.profileOptions = { profile: opts.profile };\n clientOptions.credentials = cachedDefaultCredentials({\n profile: opts.profile,\n });\n } else {\n // No token, no profile: authenticate as the service principal from the\n // environment. The SDK's own default chain DOES read the DATABRICKS_* env\n // vars (host, client id/secret, token) — but its M2M strategy feeds the RAW\n // `DATABRICKS_HOST` straight into OAuth token-endpoint discovery, and the\n // Databricks Apps runtime sets that host scheme-less (e.g.\n // `x.cloud.databricks.com`), so discovery fails with `Invalid URL` and every\n // request dies as \"Warehouse readiness check failed\". Resolve the SP here\n // with the scheme-normalized `host` instead: M2M from client id + secret\n // (what Apps injects), else PAT from `DATABRICKS_TOKEN`, else fall through to\n // the SDK default chain (local dev, where a `~/.databrickscfg` host already\n // carries a scheme).\n // `DATABRICKS_AUTH_TYPE`, like in the legacy SDK, pins the strategy.\n const clientId = process.env.DATABRICKS_CLIENT_ID;\n const clientSecret = process.env.DATABRICKS_CLIENT_SECRET;\n const envToken = process.env.DATABRICKS_TOKEN;\n const authType = process.env.DATABRICKS_AUTH_TYPE?.trim() || undefined;\n const allows = (strategy: string) => !authType || authType === strategy;\n if (host && clientId && clientSecret && allows(\"oauth-m2m\")) {\n clientOptions.credentials = withTokenCache(\n newM2mCredentials({ host, clientId, clientSecret }),\n );\n } else if (envToken && allows(\"pat\")) {\n clientOptions.credentials = newPatCredentials(envToken);\n } else if (host && allows(\"databricks-cli\")) {\n // A configured host means ~/.databrickscfg is NOT consulted (legacy\n // rule): a profile's credentials must never be sent to another host.\n clientOptions.credentials = cliHostCredentials(host);\n } else if (!host && !authType) {\n // Local dev with no host anywhere: the profile-based default chain.\n clientOptions.credentials = cachedDefaultCredentials();\n } else {\n clientOptions.credentials = unsupportedCredentials(\n `DATABRICKS_AUTH_TYPE=${authType ?? \"\"} cannot be satisfied: supported types are pat (DATABRICKS_TOKEN), oauth-m2m (DATABRICKS_CLIENT_ID/SECRET) and databricks-cli (\\`databricks auth login\\`).`,\n );\n }\n }\n clientOptions.httpClient = buildHttpClient(opts);\n return clientOptions;\n}\n\n/**\n * Wrap the SDK's default fetch transport to prepend AppKit's product segment\n * (e.g. `databricks-appkit/0.88.1`) to the outgoing `User-Agent`, which\n * Databricks-side dashboards match on.\n *\n * Why the transport and not the SDK's `setProduct`: that is process-global,\n * while the header on the `httpClient` is per-client, and the wrapper ships\n * inside appkit's bundled `dist`, so it also reaches deployed apps. The SDK's\n * own client-info (`sdk-js-core/…`, runtime) is already on `request.headers`,\n * so prepending keeps it intact after AppKit's segment.\n *\n * The wrapper also retries (see `sendWithRetry`). With no product configured\n * (build-time callers) it adds no AppKit segment, like the legacy behavior.\n */\nfunction buildHttpClient(opts: WorkspaceClientOptions): HttpClient {\n const co = opts.clientOptions;\n let appkitUserAgent: string | undefined;\n if (co?.product && co?.productVersion) {\n const segments = [`${co.product}/${co.productVersion}`];\n if (co.userAgentExtra) {\n for (const [key, value] of Object.entries(co.userAgentExtra)) {\n segments.push(`${key}/${String(value)}`);\n }\n }\n appkitUserAgent = segments.join(\" \");\n }\n const base = newFetchHttpClient();\n return {\n send(request) {\n if (appkitUserAgent) {\n const existing = request.headers.get(\"User-Agent\");\n request.headers.set(\n \"User-Agent\",\n existing ? `${appkitUserAgent} ${existing}` : appkitUserAgent,\n );\n }\n return sendWithRetry(base, request);\n },\n };\n}\n\n// The legacy SDK's retry policy: 429, or an error body naming a transient\n// failure; backoff of `attempt` seconds plus jitter, capped at 10s, for up to\n// 300s in total. The modular SDK retries nothing outside long-running waits.\nconst RETRY_TIMEOUT_MS = 300_000;\nconst TRANSIENT_ERROR_MESSAGES = [\n \"com.databricks.backend.manager.util.UnknownWorkerEnvironmentException\",\n \"does not have any associated worker environments\",\n \"There is no worker environment with id\",\n \"Unknown worker environment\",\n \"ClusterNotReadyException\",\n \"connection reset by peer\",\n \"TLS handshake timeout\",\n \"connection refused\",\n \"Unexpected error\",\n \"i/o timeout\",\n];\n\nasync function sendWithRetry(\n base: HttpClient,\n request: Parameters<HttpClient[\"send\"]>[0],\n): ReturnType<HttpClient[\"send\"]> {\n // A streamed body (e.g. a file upload) can only be sent once.\n if (request.body instanceof ReadableStream) return base.send(request);\n const deadline = Date.now() + RETRY_TIMEOUT_MS;\n for (let attempt = 1; ; attempt++) {\n const response = await base.send(request);\n if (response.statusCode < 400) return response;\n const body = new Uint8Array(\n await new Response(response.body).arrayBuffer(),\n );\n const text = new TextDecoder().decode(body);\n const retryable =\n response.statusCode === 429 ||\n TRANSIENT_ERROR_MESSAGES.some((m) => text.includes(m));\n const waitMs = Math.min(attempt * 1000 + 50 + Math.random() * 700, 10_000);\n if (\n !retryable ||\n request.signal?.aborted ||\n Date.now() + waitMs > deadline\n ) {\n return { ...response, body: new Response(body).body };\n }\n await new Promise((resolve) => setTimeout(resolve, waitMs));\n }\n}\n\n/** A raw REST call against the workspace host. */\nexport interface WorkspaceRequest {\n method: string;\n /** Path on the workspace host, e.g. `/api/2.0/preview/scim/v2/Me`. */\n path: string;\n query?: Record<string, string>;\n headers?: Headers;\n body?: HttpRequest[\"body\"];\n signal?: AbortSignal;\n}\n\n/** Host, auth headers, and raw requests resolved exactly like the modular clients. */\nexport interface WorkspaceAuth {\n /** Scheme-normalized workspace host, without a trailing slash. */\n getHost(): Promise<string>;\n /** Set the auth header(s) (e.g. `Authorization`) on `headers`. */\n authenticate(headers: Headers): Promise<void>;\n /**\n * Send a request through the modular transport (AppKit User-Agent + auth).\n * Returns the raw `Response` (body unread, so it can stream); throws\n * {@link ApiError} on a non-2xx status.\n */\n request(req: WorkspaceRequest): Promise<Response>;\n}\n\n/**\n * Build host/credential resolution from {@link mapToClientOptions}, mirroring\n * the modular SDK's `resolveClientConfig` (sdk-warehouses `dist/v1/transport.js`):\n * resolve the profile from config file + env, explicit options win, and fall\n * back to `defaultCredentials` over the resolved profile. Resolved once, lazily;\n * a failed resolution is retried on the next call.\n */\nexport function buildWorkspaceAuth(\n opts: WorkspaceClientOptions,\n): WorkspaceAuth {\n const options = mapToClientOptions(opts);\n const transport = options.httpClient ?? newFetchHttpClient();\n let resolved: Promise<{ host: string; credentials: Credentials }> | undefined;\n const resolveOnce = () => {\n resolved ??= (async () => {\n const profile = await resolve(options.profileOptions);\n const host = normalizeHost(options.host ?? profile.host)?.replace(\n /\\/+$/,\n \"\",\n );\n if (!host) throw new Error(\"Host is required.\");\n const credentials =\n options.credentials ??\n defaultCredentials({ profile: { ...profile, host } });\n return { host, credentials };\n })().catch((e) => {\n resolved = undefined;\n throw e;\n });\n return resolved;\n };\n const authenticate = async (headers: Headers) => {\n const { credentials } = await resolveOnce();\n for (const h of await credentials.authHeaders()) {\n headers.set(h.key, h.value);\n }\n };\n return {\n getHost: async () => (await resolveOnce()).host,\n authenticate,\n async request(req) {\n const url = new URL(req.path, (await resolveOnce()).host);\n for (const [k, v] of Object.entries(req.query ?? {})) {\n url.searchParams.set(k, v);\n }\n const headers = new Headers(req.headers);\n await authenticate(headers);\n const res = await transport.send({\n url: url.toString(),\n method: req.method,\n headers,\n body: req.body,\n signal: req.signal,\n });\n // `Response` rejects any body (even empty) on null-body statuses.\n const nullBody = [204, 205, 304].includes(res.statusCode);\n const response = new Response(nullBody ? null : res.body, {\n status: res.statusCode,\n // The modular transport drops the reason phrase; legacy error messages\n // include it (see toApiError).\n statusText: STATUS_CODES[res.statusCode],\n headers: res.headers,\n });\n if (!response.ok) throw await toApiError(response);\n return response;\n },\n };\n}\n\n/**\n * Same error class the legacy `apiClient.request` threw, so existing catch\n * sites (`instanceof ApiError`, `.statusCode`, `.errorCode`) keep working.\n * Message + code follow the legacy `parseErrorFromResponse` so callers that\n * surface `err.message` (e.g. the serving plugin's 502 body) are unchanged:\n * a body without both `error_code` and `message` (plain text, HTML, or a\n * model-specific error JSON) becomes `Response from server (<status text>) <body>`.\n */\nasync function toApiError(response: Response): Promise<ApiError> {\n const text = await response.text();\n let json:\n | { error_code?: string; message?: string; error?: string; details?: [] }\n | undefined;\n try {\n json = JSON.parse(text);\n } catch {\n // Non-JSON error body (HTML or plain text).\n }\n if (json?.message && json.error_code) {\n return new ApiError(\n json.error || json.message,\n json.error_code,\n response.status,\n json,\n json.details ?? [],\n );\n }\n const html =\n text.match(/<pre>(.*)<\\/pre>/) ??\n text.match(/<title>(Error \\d+.*?)<\\/title>/);\n return new ApiError(\n html\n ? html[1].trim().replace(/([\\s.])*$/, \"\")\n : `Response from server (${response.statusText}) ${text}`,\n response.statusText || \"UNKNOWN\",\n response.status,\n json ?? text,\n [],\n );\n}\n\n/** Build a modular Warehouses client from wrapper options. */\nexport function buildWarehousesClient(\n opts: WorkspaceClientOptions,\n): WarehousesClient {\n return new WarehousesClient(mapToClientOptions(opts));\n}\n\n/** Build a modular Statement Execution client from wrapper options. */\nexport function buildStatementExecutionClient(\n opts: WorkspaceClientOptions,\n): StatementExecutionClient {\n return new StatementExecutionClient(mapToClientOptions(opts));\n}\n\n// The modular SDK's error class, for tests that must throw what typed calls\n// really throw (status in `httpStatusCode`, not the wrapper's `statusCode`).\nexport { ApiError as ModularApiError } from \"@databricks/sdk-core/apierror\";\n\n/**\n * Build a modular SCIM client from wrapper options. Backs the facade's\n * `currentUser` accessor: legacy `currentUser.me()` is `ScimClient.me({})`.\n */\nexport function buildScimClient(opts: WorkspaceClientOptions): ScimClient {\n return new ScimClient(mapToClientOptions(opts));\n}\n\n/** Build a modular Apps client from wrapper options. */\nexport function buildAppsClient(opts: WorkspaceClientOptions): AppsClient {\n return lazyClient(\n () => import(\"@databricks/sdk-apps/v1\").then((m) => m.AppsClient),\n mapToClientOptions(opts),\n );\n}\n\n/**\n * Defer loading an SDK client's module until its first method call, so app\n * boot doesn't pay for clients it never uses. Generated methods return either\n * a Promise or (`*Iter`) an AsyncGenerator, so each proxied call returns the\n * pending result as a Promise that is also async-iterable.\n */\nfunction lazyClient<T extends object>(\n load: () => Promise<new (options: ClientOptions) => T>,\n options: ClientOptions,\n): T {\n let client: Promise<T> | undefined;\n return new Proxy({} as T, {\n get(_target, prop) {\n // Not thenable, or `await facade.someClient` would hang.\n if (typeof prop === \"symbol\" || prop === \"then\") return undefined;\n return (...args: unknown[]) => {\n client ??= load().then((Client) => new Client(options));\n const result = client.then((c) =>\n (c as Record<string, (...a: unknown[]) => unknown>)[prop](...args),\n );\n return Object.assign(result, {\n async *[Symbol.asyncIterator]() {\n yield* (await result) as AsyncIterable<unknown>;\n },\n });\n };\n },\n });\n}\n\n/** Build a modular Genie client from wrapper options. */\nexport function buildGenieClient(opts: WorkspaceClientOptions): GenieClient {\n return lazyClient(\n () => import(\"@databricks/sdk-genie/v1\").then((m) => m.GenieClient),\n mapToClientOptions(opts),\n );\n}\n\n/** Build a modular Jobs (API 2.2) client from wrapper options. */\nexport function buildJobsClient(opts: WorkspaceClientOptions): JobsClient {\n return lazyClient(\n () => import(\"@databricks/sdk-jobs/v2\").then((m) => m.JobsClient),\n mapToClientOptions(opts),\n );\n}\n\n/**\n * Build a modular Files client from wrapper options. `getFileMetadata` is not\n * used: its generated HEAD call parses the (empty) body and drops the response\n * headers that carry the metadata, so the connector issues that HEAD through\n * {@link WorkspaceAuth.request} instead.\n */\nexport function buildFilesClient(opts: WorkspaceClientOptions): FilesClient {\n return lazyClient(\n () => import(\"@databricks/sdk-files/v2\").then((m) => m.FilesClient),\n mapToClientOptions(opts),\n );\n}\n\n/**\n * Build a modular Vector Search client from wrapper options. Query calls rely\n * on the sdk-vectorsearch pnpm patch (`debugLevel` / `debugInfo`, `bigint` rows).\n */\nexport function buildVectorSearchClient(\n opts: WorkspaceClientOptions,\n): VectorSearchClient {\n return lazyClient(\n () =>\n import(\"@databricks/sdk-vectorsearch/v1\").then(\n (m) => m.VectorSearchClient,\n ),\n mapToClientOptions(opts),\n );\n}\n\n/** Build a modular Model Serving (serving endpoints) client from wrapper options. */\nexport function buildModelServingClient(\n opts: WorkspaceClientOptions,\n): ModelServingClient {\n return lazyClient(\n () =>\n import(\"@databricks/sdk-modelserving/v1\").then(\n (m) => m.ModelServingClient,\n ),\n mapToClientOptions(opts),\n );\n}\n\n/** Build a modular MLflow Experiments client from wrapper options. */\nexport function buildExperimentsClient(\n opts: WorkspaceClientOptions,\n): ExperimentsClient {\n return lazyClient(\n () =>\n import(\"@databricks/sdk-experiments/v1\").then((m) => m.ExperimentsClient),\n mapToClientOptions(opts),\n );\n}\n\n/** Build a modular Unity Catalog Tables client from wrapper options. */\nexport function buildTablesClient(opts: WorkspaceClientOptions): TablesClient {\n return lazyClient(\n () => import(\"@databricks/sdk-uc-tables/v1\").then((m) => m.TablesClient),\n mapToClientOptions(opts),\n );\n}\n\n/** Build a modular Unity Catalog Volumes client from wrapper options. */\nexport function buildVolumesClient(\n opts: WorkspaceClientOptions,\n): VolumesClient {\n return lazyClient(\n () => import(\"@databricks/sdk-uc-volumes/v1\").then((m) => m.VolumesClient),\n mapToClientOptions(opts),\n );\n}\n\n/** Build a modular Unity Catalog Functions client from wrapper options. */\nexport function buildFunctionsClient(\n opts: WorkspaceClientOptions,\n): FunctionsClient {\n return lazyClient(\n () =>\n import(\"@databricks/sdk-uc-functions/v1\").then((m) => m.FunctionsClient),\n mapToClientOptions(opts),\n );\n}\n\n/** Build a modular Unity Catalog Connections client from wrapper options. */\nexport function buildConnectionsClient(\n opts: WorkspaceClientOptions,\n): ConnectionsClient {\n return lazyClient(\n () =>\n import(\"@databricks/sdk-uc-connections/v1\").then(\n (m) => m.ConnectionsClient,\n ),\n mapToClientOptions(opts),\n );\n}\n\n/** Build a modular Lakebase (provisioned) Database client from wrapper options. */\nexport function buildDatabaseClient(\n opts: WorkspaceClientOptions,\n): DatabaseClient {\n return lazyClient(\n () => import(\"@databricks/sdk-database/v1\").then((m) => m.DatabaseClient),\n mapToClientOptions(opts),\n );\n}\n\n/**\n * Resolve a `~/.databrickscfg` profile (+ env overlay, unless disabled). Exposed\n * so the CLI can read a profile offline without importing the SDK directly.\n */\nexport { resolve as resolveProfile } from \"@databricks/sdk-core/profiles\";\n\n/**\n * Build a modular Lakebase Postgres (autoscaling: projects, branches,\n * endpoints) client from wrapper options. Distinct from the provisioned\n * `/api/2.0/database` instance API.\n */\nexport function buildPostgresClient(\n opts: WorkspaceClientOptions,\n): PostgresClient {\n return lazyClient(\n () => import(\"@databricks/sdk-postgres/v1\").then((m) => m.PostgresClient),\n mapToClientOptions(opts),\n );\n}\n\n// ── Client type re-exports (for the facade accessor types) ───────────────\nexport type { DatabaseClient } from \"@databricks/sdk-database/v1\";\nexport type { ExperimentsClient } from \"@databricks/sdk-experiments/v1\";\nexport type { AppsClient } from \"@databricks/sdk-apps/v1\";\nexport type { FilesClient } from \"@databricks/sdk-files/v2\";\nexport type {\n DirectoryEntry as FilesDirectoryEntry,\n DownloadFileResponse as FilesDownloadResponse,\n} from \"@databricks/sdk-files/v2\";\nexport type { GenieClient } from \"@databricks/sdk-genie/v1\";\nexport type { JobsClient } from \"@databricks/sdk-jobs/v2\";\nexport type { ModelServingClient } from \"@databricks/sdk-modelserving/v1\";\nexport type { PostgresClient } from \"@databricks/sdk-postgres/v1\";\nexport type { ScimClient } from \"@databricks/sdk-scim/v1\";\nexport type { StatementExecutionClient } from \"@databricks/sdk-statementexecution/v1\";\nexport type { FunctionsClient } from \"@databricks/sdk-uc-functions/v1\";\nexport type { ConnectionsClient } from \"@databricks/sdk-uc-connections/v1\";\nexport type { TablesClient } from \"@databricks/sdk-uc-tables/v1\";\nexport type { VolumesClient } from \"@databricks/sdk-uc-volumes/v1\";\nexport type { VectorSearchClient } from \"@databricks/sdk-vectorsearch/v1\";\nexport type { WarehousesClient } from \"@databricks/sdk-warehouses/v1\";\n\n// ── Model type re-exports ────────────────────────────────────────────────\n// AppKit modules import request/response/enum types from the wrapper rather\n// than the SDK, so the import boundary holds. Type-only: the connector compares\n// state against string literals, which satisfy the SDK's `Enum | (string & {})`\n// field unions — no runtime enum values needed.\nexport type {\n ConnectionInfo,\n GetConnectionRequest,\n ListConnectionsRequest,\n ListConnectionsResponse,\n} from \"@databricks/sdk-uc-connections/v1\";\nexport type {\n ColumnInfo,\n Disposition,\n ExecuteStatementRequest,\n ExternalLink,\n Format,\n ResultData,\n ResultManifest,\n Schema,\n ServiceError,\n StatementParameter,\n StatementResponse,\n StatementStatus,\n StatementStatus_State,\n} from \"@databricks/sdk-statementexecution/v1\";\nexport type {\n DatabaseCredential,\n DatabaseInstance,\n GenerateDatabaseCredentialRequest,\n ListDatabaseInstancesRequest,\n ListDatabaseInstancesResponse,\n} from \"@databricks/sdk-database/v1\";\nexport type {\n App,\n ListAppsRequest,\n ListAppsResponse,\n} from \"@databricks/sdk-apps/v1\";\nexport type {\n GenieGetMessageQueryResultResponse,\n GenieMessage,\n} from \"@databricks/sdk-genie/v1\";\nexport type {\n FunctionInfo,\n GetFunctionRequest,\n} from \"@databricks/sdk-uc-functions/v1\";\nexport type {\n Experiment,\n ListExperimentsRequest,\n ListExperimentsResponse,\n} from \"@databricks/sdk-experiments/v1\";\nexport type {\n BaseRun,\n CancelRunRequest,\n GetJobRequest,\n GetJobResponse,\n GetRunOutputRequest,\n GetRunOutputResponse,\n GetRunRequest,\n GetRunResponse,\n ListRunsRequest,\n RunNowRequest,\n RunNowResponse,\n SubmitRunRequest,\n SubmitRunResponse,\n} from \"@databricks/sdk-jobs/v2\";\nexport type {\n GetInferenceEndpointRequest,\n InferenceEndpoint,\n InferenceEndpointDetailed,\n ListInferenceEndpointsRequest,\n ListInferenceEndpointsResponse,\n} from \"@databricks/sdk-modelserving/v1\";\nexport type {\n EndpointHealth,\n EndpointInfo,\n EndpointState,\n GetWarehouseResponse,\n} from \"@databricks/sdk-warehouses/v1\";\nexport type {\n QueryVectorIndexRequest,\n QueryVectorIndexResponse,\n} from \"@databricks/sdk-vectorsearch/v1\";\nexport type {\n GetVolumeRequest,\n VolumeInfo,\n} from \"@databricks/sdk-uc-volumes/v1\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwFA,SAAS,cAAc,MAA8C;CACnE,MAAM,UAAU,MAAM,MAAM;AAC5B,KAAI,CAAC,QAAS,QAAO;AACrB,QAAO,gBAAgB,KAAK,QAAQ,GAAG,UAAU,WAAW;;AAK9D,MAAM,0BAA0B;;;;;;;AAQhC,SAAS,eAAe,aAAiD;CACvE,IAAI;CACJ,IAAI;CACJ,MAAM,WAAW,MACf,EAAE,WAAW,UACb,EAAE,OAAO,SAAS,GAAG,0BAA0B,KAAK,KAAK;AAC3D,QAAO,oBACL,YAAY,MAAM,EAClB,gBAAgB,YAAY;AAC1B,MAAI,WAAW,QAAQ,QAAQ,CAAE,QAAO;AACxC,eAAa,YACV,OAAO,CACP,MAAM,MAAO,UAAU,EAAG,CAC1B,cAAc;AACb,cAAW;IACX;AACJ,SAAO;GACP,CACH;;;;;;;;;;;;AAaH,SAAS,yBACP,gBACa;CACb,MAAM,SAAS,YAAkC;EAC/C,MAAM,UAAU,MAAM,QAAQ,eAAe;EAE7C,MAAM,OAAO,cAAc,QAAQ,KAAK,EAAE,QAAQ,QAAQ,GAAG;EAC7D,MAAM,EAAE,MAAM,OAAO,UAAU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;AAIH,SAAgB,qBACd,MACiB;AACjB,QAAO,iBAEH,OAAO,mCAAmC,MAAM,MAAM,EAAE,gBAAgB,EAC1E,mBAAmB,KAAK,CACzB;;;AAIH,SAAgB,uBACd,MACmB;AACnB,QAAO,iBAEH,OAAO,qCAAqC,MACzC,MAAM,EAAE,kBACV,EACH,mBAAmB,KAAK,CACzB;;;AAIH,SAAgB,oBACd,MACgB;AAChB,QAAO,iBACC,OAAO,+BAA+B,MAAM,MAAM,EAAE,eAAe,EACzE,mBAAmB,KAAK,CACzB;;;;;;;AAcH,SAAgB,oBACd,MACgB;AAChB,QAAO,iBACC,OAAO,+BAA+B,MAAM,MAAM,EAAE,eAAe,EACzE,mBAAmB,KAAK,CACzB"}
@@ -0,0 +1,29 @@
1
+ //#region src/workspace-client/options.d.ts
2
+ /**
3
+ * Options used to construct the workspace client facade. AppKit's own shape,
4
+ * independent of any SDK: the modular clients are built from these in
5
+ * `modular.ts`.
6
+ */
7
+ /** User-Agent stamping: `<product>/<productVersion>` plus extra segments. */
8
+ interface ClientOptions {
9
+ product?: string;
10
+ productVersion?: string;
11
+ userAgentExtra?: Record<string, string>;
12
+ }
13
+ interface WorkspaceClientOptions {
14
+ /** Databricks host, e.g. https://my-workspace.cloud.databricks.com. Defaults to DATABRICKS_HOST / profile resolution. */
15
+ host?: string;
16
+ /** `~/.databrickscfg` profile name. Used when no host/token is provided. */
17
+ profile?: string;
18
+ /** Bearer token (PAT, or the user's OBO token). */
19
+ token?: string;
20
+ /**
21
+ * SDK client options (product / productVersion / userAgentExtra) used to
22
+ * stamp the outbound User-Agent. Produced by `getClientOptions()`; omitted
23
+ * by build-time callers that don't stamp a User-Agent.
24
+ */
25
+ clientOptions?: ClientOptions;
26
+ }
27
+ //#endregion
28
+ export { ClientOptions, WorkspaceClientOptions };
29
+ //# sourceMappingURL=options.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"options.d.ts","names":[],"sources":["../../src/workspace-client/options.ts"],"mappings":";;AAOA;;;;;UAAiB,aAAA;EACf,OAAA;EACA,cAAA;EACA,cAAA,GAAiB,MAAA;AAAA;AAAA,UAGF,sBAAA;EAAsB;EAErC,IAAA;EAU6B;EAR7B,OAAA;EAAA;EAEA,KAAA;EAMA;;;;;EAAA,aAAA,GAAgB,aAAA;AAAA"}