@databricks/appkit 0.21.0 → 0.23.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.
- package/CLAUDE.md +11 -0
- package/NOTICE.md +1 -0
- package/README.md +3 -20
- package/dist/appkit/package.js +1 -1
- package/dist/cli/commands/generate-types.js +15 -13
- package/dist/cli/commands/generate-types.js.map +1 -1
- package/dist/cli/commands/setup.js +2 -2
- package/dist/cli/commands/setup.js.map +1 -1
- package/dist/connectors/genie/client.js +50 -0
- package/dist/connectors/genie/client.js.map +1 -1
- package/dist/connectors/serving/client.js +47 -0
- package/dist/connectors/serving/client.js.map +1 -0
- package/dist/index.d.ts +6 -1
- package/dist/index.js +4 -1
- package/dist/index.js.map +1 -1
- package/dist/plugin/execution-result.d.ts +26 -0
- package/dist/plugin/execution-result.d.ts.map +1 -0
- package/dist/plugin/index.d.ts +1 -0
- package/dist/plugin/interceptors/retry.js +1 -1
- package/dist/plugin/interceptors/retry.js.map +1 -1
- package/dist/plugin/plugin.d.ts +54 -5
- package/dist/plugin/plugin.d.ts.map +1 -1
- package/dist/plugin/plugin.js +87 -7
- package/dist/plugin/plugin.js.map +1 -1
- package/dist/plugins/analytics/analytics.d.ts.map +1 -1
- package/dist/plugins/analytics/analytics.js +2 -3
- package/dist/plugins/analytics/analytics.js.map +1 -1
- package/dist/plugins/files/plugin.d.ts +2 -0
- package/dist/plugins/files/plugin.d.ts.map +1 -1
- package/dist/plugins/files/plugin.js +39 -59
- package/dist/plugins/files/plugin.js.map +1 -1
- package/dist/plugins/genie/genie.d.ts +1 -0
- package/dist/plugins/genie/genie.d.ts.map +1 -1
- package/dist/plugins/genie/genie.js +42 -3
- package/dist/plugins/genie/genie.js.map +1 -1
- package/dist/plugins/index.d.ts +4 -1
- package/dist/plugins/index.js +2 -0
- package/dist/plugins/server/base-server.js +4 -2
- package/dist/plugins/server/base-server.js.map +1 -1
- package/dist/plugins/server/client-config-sanitizer.js +184 -0
- package/dist/plugins/server/client-config-sanitizer.js.map +1 -0
- package/dist/plugins/server/index.d.ts +3 -2
- package/dist/plugins/server/index.d.ts.map +1 -1
- package/dist/plugins/server/index.js +27 -9
- package/dist/plugins/server/index.js.map +1 -1
- package/dist/plugins/server/remote-tunnel/denied.html +68 -0
- package/dist/plugins/server/remote-tunnel/index.html +165 -0
- package/dist/plugins/server/remote-tunnel/remote-tunnel-manager.js +2 -1
- package/dist/plugins/server/remote-tunnel/remote-tunnel-manager.js.map +1 -1
- package/dist/plugins/server/remote-tunnel/wait.html +158 -0
- package/dist/plugins/server/static-server.js +2 -2
- package/dist/plugins/server/static-server.js.map +1 -1
- package/dist/plugins/server/utils.js +28 -5
- package/dist/plugins/server/utils.js.map +1 -1
- package/dist/plugins/server/vite-dev-server.js +8 -3
- package/dist/plugins/server/vite-dev-server.js.map +1 -1
- package/dist/plugins/serving/defaults.js +10 -0
- package/dist/plugins/serving/defaults.js.map +1 -0
- package/dist/plugins/serving/index.d.ts +2 -0
- package/dist/plugins/serving/index.js +3 -0
- package/dist/plugins/serving/manifest.js +53 -0
- package/dist/plugins/serving/manifest.js.map +1 -0
- package/dist/plugins/serving/schema-filter.js +52 -0
- package/dist/plugins/serving/schema-filter.js.map +1 -0
- package/dist/plugins/serving/serving.d.ts +38 -0
- package/dist/plugins/serving/serving.d.ts.map +1 -0
- package/dist/plugins/serving/serving.js +213 -0
- package/dist/plugins/serving/serving.js.map +1 -0
- package/dist/plugins/serving/types.d.ts +58 -0
- package/dist/plugins/serving/types.d.ts.map +1 -0
- package/dist/shared/src/execute.d.ts +1 -1
- package/dist/shared/src/plugin.d.ts +1 -0
- package/dist/shared/src/plugin.d.ts.map +1 -1
- package/dist/stream/stream-manager.js +1 -0
- package/dist/stream/stream-manager.js.map +1 -1
- package/dist/stream/types.js +2 -1
- package/dist/stream/types.js.map +1 -1
- package/dist/type-generator/cache.js +1 -1
- package/dist/type-generator/cache.js.map +1 -1
- package/dist/type-generator/index.js +13 -1
- package/dist/type-generator/index.js.map +1 -1
- package/dist/type-generator/query-registry.js +77 -4
- package/dist/type-generator/query-registry.js.map +1 -1
- package/dist/type-generator/serving/cache.js +38 -0
- package/dist/type-generator/serving/cache.js.map +1 -0
- package/dist/type-generator/serving/converter.js +108 -0
- package/dist/type-generator/serving/converter.js.map +1 -0
- package/dist/type-generator/serving/fetcher.js +54 -0
- package/dist/type-generator/serving/fetcher.js.map +1 -0
- package/dist/type-generator/serving/generator.js +185 -0
- package/dist/type-generator/serving/generator.js.map +1 -0
- package/dist/type-generator/serving/server-file-extractor.d.ts +22 -0
- package/dist/type-generator/serving/server-file-extractor.d.ts.map +1 -0
- package/dist/type-generator/serving/server-file-extractor.js +131 -0
- package/dist/type-generator/serving/server-file-extractor.js.map +1 -0
- package/dist/type-generator/serving/vite-plugin.d.ts +24 -0
- package/dist/type-generator/serving/vite-plugin.d.ts.map +1 -0
- package/dist/type-generator/serving/vite-plugin.js +60 -0
- package/dist/type-generator/serving/vite-plugin.js.map +1 -0
- package/docs/api/appkit/Class.Plugin.md +83 -20
- package/docs/api/appkit/Function.appKitServingTypesPlugin.md +24 -0
- package/docs/api/appkit/Function.extractServingEndpoints.md +22 -0
- package/docs/api/appkit/Function.findServerFile.md +20 -0
- package/docs/api/appkit/Interface.EndpointConfig.md +23 -0
- package/docs/api/appkit/Interface.ServingEndpointEntry.md +30 -0
- package/docs/api/appkit/Interface.ServingEndpointRegistry.md +3 -0
- package/docs/api/appkit/TypeAlias.ExecutionResult.md +36 -0
- package/docs/api/appkit/TypeAlias.ServingFactory.md +15 -0
- package/docs/api/appkit.md +39 -31
- package/docs/app-management.md +1 -1
- package/docs/architecture.md +1 -1
- package/docs/development/ai-assisted-development.md +2 -2
- package/docs/development/local-development.md +1 -1
- package/docs/development/remote-bridge.md +1 -1
- package/docs/development/templates.md +93 -0
- package/docs/development.md +1 -1
- package/docs/faq.md +66 -0
- package/docs/plugins/caching.md +3 -1
- package/docs/plugins/execution-context.md +1 -1
- package/docs/plugins/lakebase.md +1 -1
- package/docs/plugins/serving.md +223 -0
- package/docs.md +2 -2
- package/llms.txt +11 -0
- package/package.json +37 -36
- package/sbom.cdx.json +1 -0
|
@@ -251,7 +251,65 @@ A proxied plugin instance that executes as the user
|
|
|
251
251
|
|
|
252
252
|
#### Throws[](#throws "Direct link to Throws")
|
|
253
253
|
|
|
254
|
-
AuthenticationError if user token is not available in request headers (production only). In development mode (`NODE_ENV=development`),
|
|
254
|
+
AuthenticationError if user token is not available in request headers (production only). In development mode (`NODE_ENV=development`), skips user impersonation instead of throwing.
|
|
255
|
+
|
|
256
|
+
***
|
|
257
|
+
|
|
258
|
+
### clientConfig()[](#clientconfig "Direct link to clientConfig()")
|
|
259
|
+
|
|
260
|
+
```ts
|
|
261
|
+
clientConfig(): Record<string, unknown>;
|
|
262
|
+
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
Returns startup config to expose to the client. Override this to surface server-side values that are safe to publish to the frontend, such as feature flags, resource IDs, or other app boot settings.
|
|
266
|
+
|
|
267
|
+
This runs once when the server starts, so it should not depend on request-scoped or user-specific state.
|
|
268
|
+
|
|
269
|
+
String values that match non-public environment variables are redacted unless you intentionally expose them via a matching `PUBLIC_APPKIT_` env var.
|
|
270
|
+
|
|
271
|
+
Values must be JSON-serializable plain data (no functions, Dates, classes, Maps, Sets, BigInts, or circular references). By default returns an empty object (plugin contributes nothing to client config).
|
|
272
|
+
|
|
273
|
+
On the client, read the config with the `usePluginClientConfig` hook (React) or the `getPluginClientConfig` function (vanilla JS), both from `@databricks/appkit-ui`.
|
|
274
|
+
|
|
275
|
+
#### Returns[](#returns-3 "Direct link to Returns")
|
|
276
|
+
|
|
277
|
+
`Record`<`string`, `unknown`>
|
|
278
|
+
|
|
279
|
+
#### Example[](#example "Direct link to Example")
|
|
280
|
+
|
|
281
|
+
```ts
|
|
282
|
+
// Server — plugin definition
|
|
283
|
+
class MyPlugin extends Plugin<MyConfig> {
|
|
284
|
+
clientConfig() {
|
|
285
|
+
return {
|
|
286
|
+
warehouseId: this.config.warehouseId,
|
|
287
|
+
features: { darkMode: true },
|
|
288
|
+
};
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
// Client — React component
|
|
293
|
+
import { usePluginClientConfig } from "@databricks/appkit-ui/react";
|
|
294
|
+
|
|
295
|
+
interface MyPluginConfig { warehouseId: string; features: { darkMode: boolean } }
|
|
296
|
+
|
|
297
|
+
const config = usePluginClientConfig<MyPluginConfig>("myPlugin");
|
|
298
|
+
config.warehouseId; // "abc-123"
|
|
299
|
+
|
|
300
|
+
// Client — vanilla JS
|
|
301
|
+
import { getPluginClientConfig } from "@databricks/appkit-ui/js";
|
|
302
|
+
|
|
303
|
+
const config = getPluginClientConfig<MyPluginConfig>("myPlugin");
|
|
304
|
+
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
#### Implementation of[](#implementation-of-2 "Direct link to Implementation of")
|
|
308
|
+
|
|
309
|
+
```ts
|
|
310
|
+
BasePlugin.clientConfig
|
|
311
|
+
|
|
312
|
+
```
|
|
255
313
|
|
|
256
314
|
***
|
|
257
315
|
|
|
@@ -261,13 +319,18 @@ AuthenticationError if user token is not available in request headers (productio
|
|
|
261
319
|
protected execute<T>(
|
|
262
320
|
fn: (signal?: AbortSignal) => Promise<T>,
|
|
263
321
|
options: PluginExecutionSettings,
|
|
264
|
-
userKey?: string): Promise<T
|
|
322
|
+
userKey?: string): Promise<ExecutionResult<T>>;
|
|
265
323
|
|
|
266
324
|
```
|
|
267
325
|
|
|
268
326
|
Execute a function with the plugin's interceptor chain.
|
|
269
327
|
|
|
270
|
-
|
|
328
|
+
Returns an [ExecutionResult](./docs/api/appkit/TypeAlias.ExecutionResult.md) discriminated union:
|
|
329
|
+
|
|
330
|
+
* `{ ok: true, data: T }` on success
|
|
331
|
+
* `{ ok: false, status: number, message: string }` on failure
|
|
332
|
+
|
|
333
|
+
Errors are never thrown — the method is production-safe.
|
|
271
334
|
|
|
272
335
|
#### Type Parameters[](#type-parameters-1 "Direct link to Type Parameters")
|
|
273
336
|
|
|
@@ -283,9 +346,9 @@ All errors are caught and `undefined` is returned (production-safe). Route handl
|
|
|
283
346
|
| `options` | `PluginExecutionSettings` |
|
|
284
347
|
| `userKey?` | `string` |
|
|
285
348
|
|
|
286
|
-
#### Returns[](#returns-
|
|
349
|
+
#### Returns[](#returns-4 "Direct link to Returns")
|
|
287
350
|
|
|
288
|
-
`Promise
|
|
351
|
+
`Promise`<[`ExecutionResult`](./docs/api/appkit/TypeAlias.ExecutionResult.md)<`T`>>
|
|
289
352
|
|
|
290
353
|
***
|
|
291
354
|
|
|
@@ -315,7 +378,7 @@ userKey?: string): Promise<void>;
|
|
|
315
378
|
| `options` | [`StreamExecutionSettings`](./docs/api/appkit/Interface.StreamExecutionSettings.md) |
|
|
316
379
|
| `userKey?` | `string` |
|
|
317
380
|
|
|
318
|
-
#### Returns[](#returns-
|
|
381
|
+
#### Returns[](#returns-5 "Direct link to Returns")
|
|
319
382
|
|
|
320
383
|
`Promise`<`void`>
|
|
321
384
|
|
|
@@ -332,11 +395,11 @@ Returns the public exports for this plugin. Override this to define a custom pub
|
|
|
332
395
|
|
|
333
396
|
The returned object becomes the plugin's public API on the AppKit instance (e.g. `appkit.myPlugin.method()`). AppKit automatically binds method context and adds `asUser(req)` for user-scoped execution.
|
|
334
397
|
|
|
335
|
-
#### Returns[](#returns-
|
|
398
|
+
#### Returns[](#returns-6 "Direct link to Returns")
|
|
336
399
|
|
|
337
400
|
`unknown`
|
|
338
401
|
|
|
339
|
-
#### Example[](#example "Direct link to Example")
|
|
402
|
+
#### Example[](#example-1 "Direct link to Example")
|
|
340
403
|
|
|
341
404
|
```ts
|
|
342
405
|
class MyPlugin extends Plugin {
|
|
@@ -353,7 +416,7 @@ appkit.myPlugin.getData();
|
|
|
353
416
|
|
|
354
417
|
```
|
|
355
418
|
|
|
356
|
-
#### Implementation of[](#implementation-of-
|
|
419
|
+
#### Implementation of[](#implementation-of-3 "Direct link to Implementation of")
|
|
357
420
|
|
|
358
421
|
```ts
|
|
359
422
|
BasePlugin.exports
|
|
@@ -369,11 +432,11 @@ getEndpoints(): PluginEndpointMap;
|
|
|
369
432
|
|
|
370
433
|
```
|
|
371
434
|
|
|
372
|
-
#### Returns[](#returns-
|
|
435
|
+
#### Returns[](#returns-7 "Direct link to Returns")
|
|
373
436
|
|
|
374
437
|
`PluginEndpointMap`
|
|
375
438
|
|
|
376
|
-
#### Implementation of[](#implementation-of-
|
|
439
|
+
#### Implementation of[](#implementation-of-4 "Direct link to Implementation of")
|
|
377
440
|
|
|
378
441
|
```ts
|
|
379
442
|
BasePlugin.getEndpoints
|
|
@@ -389,11 +452,11 @@ getSkipBodyParsingPaths(): ReadonlySet<string>;
|
|
|
389
452
|
|
|
390
453
|
```
|
|
391
454
|
|
|
392
|
-
#### Returns[](#returns-
|
|
455
|
+
#### Returns[](#returns-8 "Direct link to Returns")
|
|
393
456
|
|
|
394
457
|
`ReadonlySet`<`string`>
|
|
395
458
|
|
|
396
|
-
#### Implementation of[](#implementation-of-
|
|
459
|
+
#### Implementation of[](#implementation-of-5 "Direct link to Implementation of")
|
|
397
460
|
|
|
398
461
|
```ts
|
|
399
462
|
BasePlugin.getSkipBodyParsingPaths
|
|
@@ -415,11 +478,11 @@ injectRoutes(_: Router): void;
|
|
|
415
478
|
| --------- | -------- |
|
|
416
479
|
| `_` | `Router` |
|
|
417
480
|
|
|
418
|
-
#### Returns[](#returns-
|
|
481
|
+
#### Returns[](#returns-9 "Direct link to Returns")
|
|
419
482
|
|
|
420
483
|
`void`
|
|
421
484
|
|
|
422
|
-
#### Implementation of[](#implementation-of-
|
|
485
|
+
#### Implementation of[](#implementation-of-6 "Direct link to Implementation of")
|
|
423
486
|
|
|
424
487
|
```ts
|
|
425
488
|
BasePlugin.injectRoutes
|
|
@@ -442,7 +505,7 @@ protected registerEndpoint(name: string, path: string): void;
|
|
|
442
505
|
| `name` | `string` |
|
|
443
506
|
| `path` | `string` |
|
|
444
507
|
|
|
445
|
-
#### Returns[](#returns-
|
|
508
|
+
#### Returns[](#returns-10 "Direct link to Returns")
|
|
446
509
|
|
|
447
510
|
`void`
|
|
448
511
|
|
|
@@ -465,7 +528,7 @@ Returns the `x-forwarded-user` header when present. In development mode (`NODE_E
|
|
|
465
528
|
| --------- | --------- |
|
|
466
529
|
| `req` | `Request` |
|
|
467
530
|
|
|
468
|
-
#### Returns[](#returns-
|
|
531
|
+
#### Returns[](#returns-11 "Direct link to Returns")
|
|
469
532
|
|
|
470
533
|
`string`
|
|
471
534
|
|
|
@@ -495,7 +558,7 @@ protected route<_TResponse>(router: Router, config: RouteConfig): void;
|
|
|
495
558
|
| `router` | `Router` |
|
|
496
559
|
| `config` | `RouteConfig` |
|
|
497
560
|
|
|
498
|
-
#### Returns[](#returns-
|
|
561
|
+
#### Returns[](#returns-12 "Direct link to Returns")
|
|
499
562
|
|
|
500
563
|
`void`
|
|
501
564
|
|
|
@@ -508,11 +571,11 @@ setup(): Promise<void>;
|
|
|
508
571
|
|
|
509
572
|
```
|
|
510
573
|
|
|
511
|
-
#### Returns[](#returns-
|
|
574
|
+
#### Returns[](#returns-13 "Direct link to Returns")
|
|
512
575
|
|
|
513
576
|
`Promise`<`void`>
|
|
514
577
|
|
|
515
|
-
#### Implementation of[](#implementation-of-
|
|
578
|
+
#### Implementation of[](#implementation-of-7 "Direct link to Implementation of")
|
|
516
579
|
|
|
517
580
|
```ts
|
|
518
581
|
BasePlugin.setup
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Function: appKitServingTypesPlugin()
|
|
2
|
+
|
|
3
|
+
```ts
|
|
4
|
+
function appKitServingTypesPlugin(options?: AppKitServingTypesPluginOptions): Plugin$1;
|
|
5
|
+
|
|
6
|
+
```
|
|
7
|
+
|
|
8
|
+
Vite plugin to generate TypeScript types for AppKit serving endpoints. Fetches OpenAPI schemas from Databricks and generates a .d.ts with ServingEndpointRegistry module augmentation.
|
|
9
|
+
|
|
10
|
+
Endpoint discovery order:
|
|
11
|
+
|
|
12
|
+
1. Explicit `endpoints` option (override)
|
|
13
|
+
2. AST extraction from server file (server/index.ts or server/server.ts)
|
|
14
|
+
3. DATABRICKS\_SERVING\_ENDPOINT\_NAME env var (single default endpoint)
|
|
15
|
+
|
|
16
|
+
## Parameters[](#parameters "Direct link to Parameters")
|
|
17
|
+
|
|
18
|
+
| Parameter | Type |
|
|
19
|
+
| ---------- | --------------------------------- |
|
|
20
|
+
| `options?` | `AppKitServingTypesPluginOptions` |
|
|
21
|
+
|
|
22
|
+
## Returns[](#returns "Direct link to Returns")
|
|
23
|
+
|
|
24
|
+
`Plugin$1`
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Function: extractServingEndpoints()
|
|
2
|
+
|
|
3
|
+
```ts
|
|
4
|
+
function extractServingEndpoints(serverFilePath: string):
|
|
5
|
+
| Record<string, EndpointConfig>
|
|
6
|
+
| null;
|
|
7
|
+
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
Extract serving endpoint config from a server file by AST-parsing it. Looks for `serving({ endpoints: { alias: { env: "..." }, ... } })` calls and extracts the endpoint alias names and their environment variable mappings.
|
|
11
|
+
|
|
12
|
+
## Parameters[](#parameters "Direct link to Parameters")
|
|
13
|
+
|
|
14
|
+
| Parameter | Type | Description |
|
|
15
|
+
| ---------------- | -------- | -------------------------------------- |
|
|
16
|
+
| `serverFilePath` | `string` | Absolute path to the server entry file |
|
|
17
|
+
|
|
18
|
+
## Returns[](#returns "Direct link to Returns")
|
|
19
|
+
|
|
20
|
+
\| `Record`<`string`, [`EndpointConfig`](./docs/api/appkit/Interface.EndpointConfig.md)> | `null`
|
|
21
|
+
|
|
22
|
+
Extracted endpoint config, or null if not found or not extractable
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Function: findServerFile()
|
|
2
|
+
|
|
3
|
+
```ts
|
|
4
|
+
function findServerFile(basePath: string): string | null;
|
|
5
|
+
|
|
6
|
+
```
|
|
7
|
+
|
|
8
|
+
Find the server entry file by checking candidate paths in order.
|
|
9
|
+
|
|
10
|
+
## Parameters[](#parameters "Direct link to Parameters")
|
|
11
|
+
|
|
12
|
+
| Parameter | Type | Description |
|
|
13
|
+
| ---------- | -------- | ------------------------------------- |
|
|
14
|
+
| `basePath` | `string` | Project root directory to search from |
|
|
15
|
+
|
|
16
|
+
## Returns[](#returns "Direct link to Returns")
|
|
17
|
+
|
|
18
|
+
`string` | `null`
|
|
19
|
+
|
|
20
|
+
Absolute path to the server file, or null if none found
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Interface: EndpointConfig
|
|
2
|
+
|
|
3
|
+
## Properties[](#properties "Direct link to Properties")
|
|
4
|
+
|
|
5
|
+
### env[](#env "Direct link to env")
|
|
6
|
+
|
|
7
|
+
```ts
|
|
8
|
+
env: string;
|
|
9
|
+
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
Environment variable holding the endpoint name.
|
|
13
|
+
|
|
14
|
+
***
|
|
15
|
+
|
|
16
|
+
### servedModel?[](#servedmodel "Direct link to servedModel?")
|
|
17
|
+
|
|
18
|
+
```ts
|
|
19
|
+
optional servedModel: string;
|
|
20
|
+
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Target a specific served model (bypasses traffic routing).
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# Interface: ServingEndpointEntry
|
|
2
|
+
|
|
3
|
+
Shape of a single registry entry.
|
|
4
|
+
|
|
5
|
+
## Properties[](#properties "Direct link to Properties")
|
|
6
|
+
|
|
7
|
+
### chunk[](#chunk "Direct link to chunk")
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
chunk: unknown;
|
|
11
|
+
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
***
|
|
15
|
+
|
|
16
|
+
### request[](#request "Direct link to request")
|
|
17
|
+
|
|
18
|
+
```ts
|
|
19
|
+
request: Record<string, unknown>;
|
|
20
|
+
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
***
|
|
24
|
+
|
|
25
|
+
### response[](#response "Direct link to response")
|
|
26
|
+
|
|
27
|
+
```ts
|
|
28
|
+
response: unknown;
|
|
29
|
+
|
|
30
|
+
```
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
# Interface: ServingEndpointRegistry
|
|
2
|
+
|
|
3
|
+
Registry interface for serving endpoint type generation. Empty by default — augmented by the Vite type generator's `.d.ts` output via module augmentation. When populated, provides autocomplete for alias names and typed request/response/chunk per endpoint.
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# Type Alias: ExecutionResult\<T>
|
|
2
|
+
|
|
3
|
+
```ts
|
|
4
|
+
type ExecutionResult<T> =
|
|
5
|
+
| {
|
|
6
|
+
data: T;
|
|
7
|
+
ok: true;
|
|
8
|
+
}
|
|
9
|
+
| {
|
|
10
|
+
message: string;
|
|
11
|
+
ok: false;
|
|
12
|
+
status: number;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Discriminated union for plugin execution results.
|
|
18
|
+
|
|
19
|
+
Replaces the previous `T | undefined` return type on `execute()`.
|
|
20
|
+
|
|
21
|
+
On failure, the HTTP status code is preserved from:
|
|
22
|
+
|
|
23
|
+
* `AppKitError` subclasses (via `statusCode`)
|
|
24
|
+
* Any `Error` with a numeric `statusCode` property (e.g. `ApiError`)
|
|
25
|
+
* All other errors default to status 500
|
|
26
|
+
|
|
27
|
+
In production, error messages from non-AppKitError sources are handled as:
|
|
28
|
+
|
|
29
|
+
* 4xx errors: original message is preserved (client-facing by design)
|
|
30
|
+
* 5xx errors: replaced with "Server error" to prevent information leakage
|
|
31
|
+
|
|
32
|
+
## Type Parameters[](#type-parameters "Direct link to Type Parameters")
|
|
33
|
+
|
|
34
|
+
| Type Parameter |
|
|
35
|
+
| -------------- |
|
|
36
|
+
| `T` |
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Type Alias: ServingFactory
|
|
2
|
+
|
|
3
|
+
```ts
|
|
4
|
+
type ServingFactory = keyof ServingEndpointRegistry extends never ? (alias?: string) => ServingEndpointHandle : <K>(alias: K) => ServingEndpointHandle<ServingEndpointRegistry[K]["request"], ServingEndpointRegistry[K]["response"]>;
|
|
5
|
+
|
|
6
|
+
```
|
|
7
|
+
|
|
8
|
+
Factory function returned by `AppKit.serving`.
|
|
9
|
+
|
|
10
|
+
This is a conditional type that adapts based on whether `ServingEndpointRegistry` has been populated via module augmentation (generated by `appKitServingTypesPlugin()`):
|
|
11
|
+
|
|
12
|
+
* **Registry empty (default):** `(alias?: string) => ServingEndpointHandle` — accepts any alias string with untyped request/response.
|
|
13
|
+
* **Registry populated:** `<K>(alias: K) => ServingEndpointHandle<...>` — restricts `alias` to known endpoint keys and infers typed request/response from the registry entry.
|
|
14
|
+
|
|
15
|
+
Run `appKitServingTypesPlugin()` in your Vite config to generate the registry augmentation and enable full type safety.
|
package/docs/api/appkit.md
CHANGED
|
@@ -27,32 +27,37 @@ Core library for building Databricks applications with type-safe SQL queries, pl
|
|
|
27
27
|
|
|
28
28
|
## Interfaces[](#interfaces "Direct link to Interfaces")
|
|
29
29
|
|
|
30
|
-
| Interface | Description
|
|
31
|
-
| ----------------------------------------------------------------------------------------------------------- |
|
|
32
|
-
| [BasePluginConfig](./docs/api/appkit/Interface.BasePluginConfig.md) | Base configuration interface for AppKit plugins
|
|
33
|
-
| [CacheConfig](./docs/api/appkit/Interface.CacheConfig.md) | Configuration for the CacheInterceptor. Controls TTL, size limits, storage backend, and probabilistic cleanup.
|
|
34
|
-
| [DatabaseCredential](./docs/api/appkit/Interface.DatabaseCredential.md) | Database credentials with OAuth token for Postgres connection
|
|
35
|
-
| [
|
|
36
|
-
| [
|
|
37
|
-
| [
|
|
38
|
-
| [
|
|
39
|
-
| [
|
|
40
|
-
| [
|
|
41
|
-
| [
|
|
42
|
-
| [
|
|
43
|
-
| [
|
|
44
|
-
| [
|
|
45
|
-
| [
|
|
46
|
-
| [
|
|
30
|
+
| Interface | Description |
|
|
31
|
+
| ----------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
32
|
+
| [BasePluginConfig](./docs/api/appkit/Interface.BasePluginConfig.md) | Base configuration interface for AppKit plugins |
|
|
33
|
+
| [CacheConfig](./docs/api/appkit/Interface.CacheConfig.md) | Configuration for the CacheInterceptor. Controls TTL, size limits, storage backend, and probabilistic cleanup. |
|
|
34
|
+
| [DatabaseCredential](./docs/api/appkit/Interface.DatabaseCredential.md) | Database credentials with OAuth token for Postgres connection |
|
|
35
|
+
| [EndpointConfig](./docs/api/appkit/Interface.EndpointConfig.md) | - |
|
|
36
|
+
| [GenerateDatabaseCredentialRequest](./docs/api/appkit/Interface.GenerateDatabaseCredentialRequest.md) | Request parameters for generating database OAuth credentials |
|
|
37
|
+
| [ITelemetry](./docs/api/appkit/Interface.ITelemetry.md) | Plugin-facing interface for OpenTelemetry instrumentation. Provides a thin abstraction over OpenTelemetry APIs for plugins. |
|
|
38
|
+
| [LakebasePoolConfig](./docs/api/appkit/Interface.LakebasePoolConfig.md) | Configuration for creating a Lakebase connection pool |
|
|
39
|
+
| [PluginManifest](./docs/api/appkit/Interface.PluginManifest.md) | Plugin manifest that declares metadata and resource requirements. Attached to plugin classes as a static property. Extends the shared PluginManifest with strict resource types. |
|
|
40
|
+
| [RequestedClaims](./docs/api/appkit/Interface.RequestedClaims.md) | Optional claims for fine-grained Unity Catalog table permissions When specified, the returned token will be scoped to only the requested tables |
|
|
41
|
+
| [RequestedResource](./docs/api/appkit/Interface.RequestedResource.md) | Resource to request permissions for in Unity Catalog |
|
|
42
|
+
| [ResourceEntry](./docs/api/appkit/Interface.ResourceEntry.md) | Internal representation of a resource in the registry. Extends ResourceRequirement with resolution state and plugin ownership. |
|
|
43
|
+
| [ResourceFieldEntry](./docs/api/appkit/Interface.ResourceFieldEntry.md) | Defines a single field for a resource. Each field has its own environment variable and optional description. Single-value types use one key (e.g. id); multi-value types (database, secret) use multiple (e.g. instance\_name, database\_name or scope, key). |
|
|
44
|
+
| [ResourceRequirement](./docs/api/appkit/Interface.ResourceRequirement.md) | Declares a resource requirement for a plugin. Can be defined statically in a manifest or dynamically via getResourceRequirements(). Narrows the generated base: type → ResourceType enum, permission → ResourcePermission union. |
|
|
45
|
+
| [ServingEndpointEntry](./docs/api/appkit/Interface.ServingEndpointEntry.md) | Shape of a single registry entry. |
|
|
46
|
+
| [ServingEndpointRegistry](./docs/api/appkit/Interface.ServingEndpointRegistry.md) | Registry interface for serving endpoint type generation. Empty by default — augmented by the Vite type generator's `.d.ts` output via module augmentation. When populated, provides autocomplete for alias names and typed request/response/chunk per endpoint. |
|
|
47
|
+
| [StreamExecutionSettings](./docs/api/appkit/Interface.StreamExecutionSettings.md) | Execution settings for streaming endpoints. Extends PluginExecutionSettings with SSE stream configuration. |
|
|
48
|
+
| [TelemetryConfig](./docs/api/appkit/Interface.TelemetryConfig.md) | OpenTelemetry configuration for AppKit applications |
|
|
49
|
+
| [ValidationResult](./docs/api/appkit/Interface.ValidationResult.md) | Result of validating all registered resources against the environment. |
|
|
47
50
|
|
|
48
51
|
## Type Aliases[](#type-aliases "Direct link to Type Aliases")
|
|
49
52
|
|
|
50
53
|
| Type Alias | Description |
|
|
51
54
|
| ----------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- |
|
|
52
55
|
| [ConfigSchema](./docs/api/appkit/TypeAlias.ConfigSchema.md) | Configuration schema definition for plugin config. Re-exported from the standard JSON Schema Draft 7 types. |
|
|
56
|
+
| [ExecutionResult](./docs/api/appkit/TypeAlias.ExecutionResult.md) | Discriminated union for plugin execution results. |
|
|
53
57
|
| [IAppRouter](./docs/api/appkit/TypeAlias.IAppRouter.md) | Express router type for plugin route registration |
|
|
54
58
|
| [PluginData](./docs/api/appkit/TypeAlias.PluginData.md) | Tuple of plugin class, config, and name. Created by `toPlugin()` and passed to `createApp()`. |
|
|
55
59
|
| [ResourcePermission](./docs/api/appkit/TypeAlias.ResourcePermission.md) | Union of all possible permission levels across all resource types. |
|
|
60
|
+
| [ServingFactory](./docs/api/appkit/TypeAlias.ServingFactory.md) | Factory function returned by `AppKit.serving`. |
|
|
56
61
|
| [ToPlugin](./docs/api/appkit/TypeAlias.ToPlugin.md) | Factory function type returned by `toPlugin()`. Accepts optional config and returns a PluginData tuple. |
|
|
57
62
|
|
|
58
63
|
## Variables[](#variables "Direct link to Variables")
|
|
@@ -63,17 +68,20 @@ Core library for building Databricks applications with type-safe SQL queries, pl
|
|
|
63
68
|
|
|
64
69
|
## Functions[](#functions "Direct link to Functions")
|
|
65
70
|
|
|
66
|
-
| Function | Description
|
|
67
|
-
| -------------------------------------------------------------------------------------------- |
|
|
68
|
-
| [
|
|
69
|
-
| [
|
|
70
|
-
| [
|
|
71
|
-
| [
|
|
72
|
-
| [
|
|
73
|
-
| [
|
|
74
|
-
| [
|
|
75
|
-
| [
|
|
76
|
-
| [
|
|
77
|
-
| [
|
|
78
|
-
| [
|
|
79
|
-
| [
|
|
71
|
+
| Function | Description |
|
|
72
|
+
| -------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
73
|
+
| [appKitServingTypesPlugin](./docs/api/appkit/Function.appKitServingTypesPlugin.md) | Vite plugin to generate TypeScript types for AppKit serving endpoints. Fetches OpenAPI schemas from Databricks and generates a .d.ts with ServingEndpointRegistry module augmentation. |
|
|
74
|
+
| [appKitTypesPlugin](./docs/api/appkit/Function.appKitTypesPlugin.md) | Vite plugin to generate types for AppKit queries. Calls generateFromEntryPoint under the hood. |
|
|
75
|
+
| [createApp](./docs/api/appkit/Function.createApp.md) | Bootstraps AppKit with the provided configuration. |
|
|
76
|
+
| [createLakebasePool](./docs/api/appkit/Function.createLakebasePool.md) | Create a Lakebase pool with appkit's logger integration. Telemetry automatically uses appkit's OpenTelemetry configuration via global registry. |
|
|
77
|
+
| [extractServingEndpoints](./docs/api/appkit/Function.extractServingEndpoints.md) | Extract serving endpoint config from a server file by AST-parsing it. Looks for `serving({ endpoints: { alias: { env: "..." }, ... } })` calls and extracts the endpoint alias names and their environment variable mappings. |
|
|
78
|
+
| [findServerFile](./docs/api/appkit/Function.findServerFile.md) | Find the server entry file by checking candidate paths in order. |
|
|
79
|
+
| [generateDatabaseCredential](./docs/api/appkit/Function.generateDatabaseCredential.md) | Generate OAuth credentials for Postgres database connection using the proper Postgres API. |
|
|
80
|
+
| [getExecutionContext](./docs/api/appkit/Function.getExecutionContext.md) | Get the current execution context. |
|
|
81
|
+
| [getLakebaseOrmConfig](./docs/api/appkit/Function.getLakebaseOrmConfig.md) | Get Lakebase connection configuration for ORMs that don't accept pg.Pool directly. |
|
|
82
|
+
| [getLakebasePgConfig](./docs/api/appkit/Function.getLakebasePgConfig.md) | Get Lakebase connection configuration for PostgreSQL clients. |
|
|
83
|
+
| [getPluginManifest](./docs/api/appkit/Function.getPluginManifest.md) | Loads and validates the manifest from a plugin constructor. Normalizes string type/permission to strict ResourceType/ResourcePermission. |
|
|
84
|
+
| [getResourceRequirements](./docs/api/appkit/Function.getResourceRequirements.md) | Gets the resource requirements from a plugin's manifest. |
|
|
85
|
+
| [getUsernameWithApiLookup](./docs/api/appkit/Function.getUsernameWithApiLookup.md) | Resolves the PostgreSQL username for a Lakebase connection. |
|
|
86
|
+
| [getWorkspaceClient](./docs/api/appkit/Function.getWorkspaceClient.md) | Get workspace client from config or SDK default auth chain |
|
|
87
|
+
| [isSQLTypeMarker](./docs/api/appkit/Function.isSQLTypeMarker.md) | Type guard to check if a value is a SQL type marker |
|
package/docs/app-management.md
CHANGED
|
@@ -5,7 +5,7 @@ Manage your AppKit application throughout its lifecycle using the Databricks CLI
|
|
|
5
5
|
## Prerequisites[](#prerequisites "Direct link to Prerequisites")
|
|
6
6
|
|
|
7
7
|
* [Node.js](https://nodejs.org) v22+ environment with `npm`
|
|
8
|
-
* Databricks CLI (v0.
|
|
8
|
+
* Databricks CLI (v0.295.0 or higher): install and configure it according to the [official tutorial](https://docs.databricks.com/aws/en/dev-tools/cli/tutorial).
|
|
9
9
|
|
|
10
10
|
## Create app[](#create-app "Direct link to Create app")
|
|
11
11
|
|
package/docs/architecture.md
CHANGED
|
@@ -59,7 +59,7 @@ The Node.js backend layer built with `@databricks/appkit`:
|
|
|
59
59
|
Integration with Databricks services:
|
|
60
60
|
|
|
61
61
|
* **SQL Warehouses**: Execute analytical queries with Arrow or JSON format
|
|
62
|
-
* **Lakebase
|
|
62
|
+
* **Lakebase Autoscaling**: OLTP database access with automatic OAuth token refresh
|
|
63
63
|
|
|
64
64
|
## See also[](#see-also "Direct link to See also")
|
|
65
65
|
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
## Prerequisites[](#prerequisites "Direct link to Prerequisites")
|
|
4
4
|
|
|
5
5
|
* [Node.js](https://nodejs.org) v22+ environment with `npm`
|
|
6
|
-
* Databricks CLI (v0.
|
|
6
|
+
* Databricks CLI (v0.295.0 or higher): install and configure it according to the [official tutorial](https://docs.databricks.com/aws/en/dev-tools/cli/tutorial).
|
|
7
7
|
* A new Databricks app with AppKit installed. See [Bootstrap a new Databricks app](./docs.md#quick-start-options) for more details.
|
|
8
8
|
|
|
9
9
|
AppKit integrates with AI coding assistants through the Agent Skills.
|
|
@@ -13,7 +13,7 @@ AppKit integrates with AI coding assistants through the Agent Skills.
|
|
|
13
13
|
To install the Databricks Agent Skills for your preferred AI assistant, run:
|
|
14
14
|
|
|
15
15
|
```bash
|
|
16
|
-
databricks experimental aitools
|
|
16
|
+
databricks experimental aitools install
|
|
17
17
|
|
|
18
18
|
```
|
|
19
19
|
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
## Prerequisites[](#prerequisites "Direct link to Prerequisites")
|
|
4
4
|
|
|
5
5
|
* [Node.js](https://nodejs.org) v22+ environment with `npm`
|
|
6
|
-
* Databricks CLI (v0.
|
|
6
|
+
* Databricks CLI (v0.295.0 or higher): install and configure it according to the [official tutorial](https://docs.databricks.com/aws/en/dev-tools/cli/tutorial).
|
|
7
7
|
* A new Databricks app with AppKit installed. See [Bootstrap a new Databricks app](./docs.md#quick-start-options) for more details.
|
|
8
8
|
|
|
9
9
|
Once your app is bootstrapped according to the [Manual quick start](./docs.md#manual-quick-start) guide, you can start the development server with hot reload for both UI and backend code.
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
## Prerequisites[](#prerequisites "Direct link to Prerequisites")
|
|
4
4
|
|
|
5
5
|
* [Node.js](https://nodejs.org) v22+ environment with `npm`
|
|
6
|
-
* Databricks CLI (v0.
|
|
6
|
+
* Databricks CLI (v0.295.0 or higher): install and configure it according to the [official tutorial](https://docs.databricks.com/aws/en/dev-tools/cli/tutorial).
|
|
7
7
|
* A new Databricks app with AppKit installed. See [Bootstrap a new Databricks app](./docs.md#quick-start-options) for more details.
|
|
8
8
|
|
|
9
9
|
Remote bridge allows you to develop against a deployed backend while keeping your UI and queries local. This is useful for testing against production data or debugging deployed backend code without redeploying your app.
|