@databricks/appkit-ui 0.22.0 → 0.24.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/dist/cli/commands/docs.js +7 -1
- package/dist/cli/commands/docs.js.map +1 -1
- package/dist/cli/commands/generate-types.js +27 -15
- package/dist/cli/commands/generate-types.js.map +1 -1
- package/dist/cli/commands/lint.js +3 -1
- package/dist/cli/commands/lint.js.map +1 -1
- package/dist/cli/commands/plugin/add-resource/add-resource.js +73 -8
- package/dist/cli/commands/plugin/add-resource/add-resource.js.map +1 -1
- package/dist/cli/commands/plugin/create/create.js +164 -20
- package/dist/cli/commands/plugin/create/create.js.map +1 -1
- package/dist/cli/commands/plugin/create/resource-defaults.js +5 -1
- package/dist/cli/commands/plugin/create/resource-defaults.js.map +1 -1
- package/dist/cli/commands/plugin/index.js +7 -1
- package/dist/cli/commands/plugin/index.js.map +1 -1
- package/dist/cli/commands/plugin/list/list.js +7 -1
- package/dist/cli/commands/plugin/list/list.js.map +1 -1
- package/dist/cli/commands/plugin/sync/sync.js +27 -14
- package/dist/cli/commands/plugin/sync/sync.js.map +1 -1
- package/dist/cli/commands/plugin/validate/validate.js +39 -9
- package/dist/cli/commands/plugin/validate/validate.js.map +1 -1
- package/dist/cli/commands/setup.js +6 -5
- package/dist/cli/commands/setup.js.map +1 -1
- package/dist/react/hooks/index.d.ts +4 -2
- package/dist/react/hooks/index.js +2 -0
- package/dist/react/hooks/types.d.ts +31 -2
- package/dist/react/hooks/types.d.ts.map +1 -1
- package/dist/react/hooks/use-serving-invoke.d.ts +30 -0
- package/dist/react/hooks/use-serving-invoke.d.ts.map +1 -0
- package/dist/react/hooks/use-serving-invoke.js +82 -0
- package/dist/react/hooks/use-serving-invoke.js.map +1 -0
- package/dist/react/hooks/use-serving-stream.d.ts +35 -0
- package/dist/react/hooks/use-serving-stream.d.ts.map +1 -0
- package/dist/react/hooks/use-serving-stream.js +101 -0
- package/dist/react/hooks/use-serving-stream.js.map +1 -0
- package/dist/react/index.d.ts +4 -2
- package/dist/react/index.js +3 -1
- package/docs/api/appkit/Class.Plugin.md +8 -3
- 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 +19 -0
- package/docs/api/appkit.md +39 -31
- package/docs/development/type-generation.md +6 -5
- package/docs/faq.md +66 -0
- package/docs/plugins/analytics.md +1 -1
- package/docs/plugins/custom-plugins.md +4 -0
- package/docs/plugins/plugin-management.md +22 -6
- package/docs/plugins/serving.md +223 -0
- package/docs/plugins/vector-search.md +247 -0
- package/llms.txt +11 -0
- package/package.json +1 -1
- package/sbom.cdx.json +1 -1
package/dist/react/index.js
CHANGED
|
@@ -47,6 +47,8 @@ import { useGenieChat } from "./genie/use-genie-chat.js";
|
|
|
47
47
|
import { GenieChat } from "./genie/genie-chat.js";
|
|
48
48
|
import "./genie/index.js";
|
|
49
49
|
import { usePluginClientConfig } from "./hooks/use-plugin-config.js";
|
|
50
|
+
import { useServingInvoke } from "./hooks/use-serving-invoke.js";
|
|
51
|
+
import { useServingStream } from "./hooks/use-serving-stream.js";
|
|
50
52
|
import "./hooks/index.js";
|
|
51
53
|
import { Input } from "./ui/input.js";
|
|
52
54
|
import { Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue } from "./ui/select.js";
|
|
@@ -95,4 +97,4 @@ import { Toggle, toggleVariants } from "./ui/toggle.js";
|
|
|
95
97
|
import { ToggleGroup, ToggleGroupItem } from "./ui/toggle-group.js";
|
|
96
98
|
import "./ui/index.js";
|
|
97
99
|
|
|
98
|
-
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, Alert, AlertDescription, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AlertTitle, AreaChart, AspectRatio, Avatar, AvatarFallback, AvatarImage, Badge, BarChart, BaseChart, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, ButtonGroup, ButtonGroupSeparator, ButtonGroupText, CHART_COLOR_VARS, CHART_COLOR_VARS_CATEGORICAL, CHART_COLOR_VARS_DIVERGING, CHART_COLOR_VARS_SEQUENTIAL, Calendar, CalendarDayButton, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Carousel, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious, ChartContainer, ChartLegend, ChartLegendContent, ChartStyle, ChartTooltip, ChartTooltipContent, ChartWrapper, Checkbox, Collapsible, CollapsibleContent, CollapsibleTrigger, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, ContextMenu, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuPortal, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSeparator, ContextMenuShortcut, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuTrigger, DATE_FIELD_PATTERNS, DataTable, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DirectoryList, DonutChart, Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerTitle, DrawerTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle, FALLBACK_COLORS_CATEGORICAL, FALLBACK_COLORS_DIVERGING, FALLBACK_COLORS_SEQUENTIAL, Field, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLegend, FieldSeparator, FieldSet, FieldTitle, FileBreadcrumb, FileEntry, FilePreviewPanel, Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, GenieChat, GenieChatInput, GenieChatMessage, GenieChatMessageList, GenieQueryVisualization, HeatmapChart, HoverCard, HoverCardContent, HoverCardTrigger, Input, InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputGroupTextarea, InputOTP, InputOTPGroup, InputOTPSeparator, InputOTPSlot, Item, ItemActions, ItemContent, ItemDescription, ItemFooter, ItemGroup, ItemHeader, ItemMedia, ItemSeparator, ItemTitle, Kbd, KbdGroup, Label, LineChart, METADATA_DATE_PATTERNS, Menubar, MenubarCheckboxItem, MenubarContent, MenubarGroup, MenubarItem, MenubarLabel, MenubarMenu, MenubarPortal, MenubarRadioGroup, MenubarRadioItem, MenubarSeparator, MenubarShortcut, MenubarSub, MenubarSubContent, MenubarSubTrigger, MenubarTrigger, NAME_FIELD_PATTERNS, NavigationMenu, NavigationMenuContent, NavigationMenuIndicator, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuTrigger, NavigationMenuViewport, NewFolderInput, Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, PieChart, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, PortalContainerContext, PortalContainerProvider, Progress, RadarChart, RadioGroup, RadioGroupItem, ResizableHandle, ResizablePanel, ResizablePanelGroup, ScatterChart, ScrollArea, ScrollBar, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger, Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, Skeleton, Slider, Spinner, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, Toaster, Toggle, ToggleGroup, ToggleGroupItem, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, badgeVariants, buildCartesianOption, buildHeatmapOption, buildHorizontalBarOption, buildPieOption, buildRadarOption, buttonGroupVariants, buttonVariants, cn, createChart, createTimeSeriesData, formatFileSize, formatLabel, getCompatibleChartTypes, inferChartType, isArrowTable, isDataProps, isQueryProps, navigationMenuTriggerStyle, normalizeChartData, normalizeHeatmapData, sortTimeSeriesAscending, toChartArray, toChartValue, toggleVariants, transformGenieData, truncateLabel, useAllThemeColors, useAnalyticsQuery, useChartData, useFormField, useGenieChat, usePluginClientConfig, usePortalContainer, useResolvedPortalContainer, useSidebar, useThemeColors };
|
|
100
|
+
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, Alert, AlertDescription, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, AlertTitle, AreaChart, AspectRatio, Avatar, AvatarFallback, AvatarImage, Badge, BarChart, BaseChart, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, ButtonGroup, ButtonGroupSeparator, ButtonGroupText, CHART_COLOR_VARS, CHART_COLOR_VARS_CATEGORICAL, CHART_COLOR_VARS_DIVERGING, CHART_COLOR_VARS_SEQUENTIAL, Calendar, CalendarDayButton, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Carousel, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious, ChartContainer, ChartLegend, ChartLegendContent, ChartStyle, ChartTooltip, ChartTooltipContent, ChartWrapper, Checkbox, Collapsible, CollapsibleContent, CollapsibleTrigger, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, ContextMenu, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuPortal, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSeparator, ContextMenuShortcut, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuTrigger, DATE_FIELD_PATTERNS, DataTable, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DirectoryList, DonutChart, Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerTitle, DrawerTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle, FALLBACK_COLORS_CATEGORICAL, FALLBACK_COLORS_DIVERGING, FALLBACK_COLORS_SEQUENTIAL, Field, FieldContent, FieldDescription, FieldError, FieldGroup, FieldLabel, FieldLegend, FieldSeparator, FieldSet, FieldTitle, FileBreadcrumb, FileEntry, FilePreviewPanel, Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, GenieChat, GenieChatInput, GenieChatMessage, GenieChatMessageList, GenieQueryVisualization, HeatmapChart, HoverCard, HoverCardContent, HoverCardTrigger, Input, InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputGroupTextarea, InputOTP, InputOTPGroup, InputOTPSeparator, InputOTPSlot, Item, ItemActions, ItemContent, ItemDescription, ItemFooter, ItemGroup, ItemHeader, ItemMedia, ItemSeparator, ItemTitle, Kbd, KbdGroup, Label, LineChart, METADATA_DATE_PATTERNS, Menubar, MenubarCheckboxItem, MenubarContent, MenubarGroup, MenubarItem, MenubarLabel, MenubarMenu, MenubarPortal, MenubarRadioGroup, MenubarRadioItem, MenubarSeparator, MenubarShortcut, MenubarSub, MenubarSubContent, MenubarSubTrigger, MenubarTrigger, NAME_FIELD_PATTERNS, NavigationMenu, NavigationMenuContent, NavigationMenuIndicator, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuTrigger, NavigationMenuViewport, NewFolderInput, Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, PieChart, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, PortalContainerContext, PortalContainerProvider, Progress, RadarChart, RadioGroup, RadioGroupItem, ResizableHandle, ResizablePanel, ResizablePanelGroup, ScatterChart, ScrollArea, ScrollBar, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger, Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, Skeleton, Slider, Spinner, Switch, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, Toaster, Toggle, ToggleGroup, ToggleGroupItem, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, badgeVariants, buildCartesianOption, buildHeatmapOption, buildHorizontalBarOption, buildPieOption, buildRadarOption, buttonGroupVariants, buttonVariants, cn, createChart, createTimeSeriesData, formatFileSize, formatLabel, getCompatibleChartTypes, inferChartType, isArrowTable, isDataProps, isQueryProps, navigationMenuTriggerStyle, normalizeChartData, normalizeHeatmapData, sortTimeSeriesAscending, toChartArray, toChartValue, toggleVariants, transformGenieData, truncateLabel, useAllThemeColors, useAnalyticsQuery, useChartData, useFormField, useGenieChat, usePluginClientConfig, usePortalContainer, useResolvedPortalContainer, useServingInvoke, useServingStream, useSidebar, useThemeColors };
|
|
@@ -319,13 +319,18 @@ BasePlugin.clientConfig
|
|
|
319
319
|
protected execute<T>(
|
|
320
320
|
fn: (signal?: AbortSignal) => Promise<T>,
|
|
321
321
|
options: PluginExecutionSettings,
|
|
322
|
-
userKey?: string): Promise<T
|
|
322
|
+
userKey?: string): Promise<ExecutionResult<T>>;
|
|
323
323
|
|
|
324
324
|
```
|
|
325
325
|
|
|
326
326
|
Execute a function with the plugin's interceptor chain.
|
|
327
327
|
|
|
328
|
-
|
|
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.
|
|
329
334
|
|
|
330
335
|
#### Type Parameters[](#type-parameters-1 "Direct link to Type Parameters")
|
|
331
336
|
|
|
@@ -343,7 +348,7 @@ All errors are caught and `undefined` is returned (production-safe). Route handl
|
|
|
343
348
|
|
|
344
349
|
#### Returns[](#returns-4 "Direct link to Returns")
|
|
345
350
|
|
|
346
|
-
`Promise
|
|
351
|
+
`Promise`<[`ExecutionResult`](./docs/api/appkit/TypeAlias.ExecutionResult.md)<`T`>>
|
|
347
352
|
|
|
348
353
|
***
|
|
349
354
|
|
|
@@ -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,19 @@
|
|
|
1
|
+
# Type Alias: ServingFactory
|
|
2
|
+
|
|
3
|
+
```ts
|
|
4
|
+
type ServingFactory = keyof ServingEndpointRegistry extends never ? (alias?: string) => ServingEndpointHandle : true extends IsUnion<keyof ServingEndpointRegistry> ? <K>(alias: K) => ServingEndpointHandle<ServingEndpointRegistry[K]["request"], ServingEndpointRegistry[K]["response"]> : {
|
|
5
|
+
<K> (alias: K): ServingEndpointHandle<ServingEndpointRegistry[K]["request"], ServingEndpointRegistry[K]["response"]>;
|
|
6
|
+
(): ServingEndpointHandle<never, never>;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Factory function returned by `AppKit.serving`.
|
|
12
|
+
|
|
13
|
+
Adapts based on the `ServingEndpointRegistry` state:
|
|
14
|
+
|
|
15
|
+
* **Empty (default):** `(alias?: string) => ServingEndpointHandle` — any string, untyped.
|
|
16
|
+
* **Single key:** alias optional — `serving()` returns the typed handle for the only endpoint.
|
|
17
|
+
* **Multiple keys:** alias required — must specify which endpoint.
|
|
18
|
+
|
|
19
|
+
Run `npx appkit generate-types` or start the dev server to generate the registry.
|
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 |
|
|
@@ -4,7 +4,9 @@ AppKit can automatically generate TypeScript types for your SQL queries, providi
|
|
|
4
4
|
|
|
5
5
|
## Goal[](#goal "Direct link to Goal")
|
|
6
6
|
|
|
7
|
-
Generate
|
|
7
|
+
Generate type-safe TypeScript declarations for query keys, parameters, and result rows.
|
|
8
|
+
|
|
9
|
+
All generated files live in `shared/appkit-types/`, one per plugin (e.g. `analytics.d.ts`). They use [`declare module`](https://www.typescriptlang.org/docs/handbook/declaration-merging.html#module-augmentation) to augment existing interfaces, so the types apply globally — you never need to import them. TypeScript auto-discovers them through `"include": ["shared/appkit-types"]` in your tsconfig.
|
|
8
10
|
|
|
9
11
|
## Vite plugin: `appKitTypesPlugin`[](#vite-plugin-appkittypesplugin "Direct link to vite-plugin-appkittypesplugin")
|
|
10
12
|
|
|
@@ -12,7 +14,7 @@ The recommended approach is to use the Vite plugin, which watches your SQL files
|
|
|
12
14
|
|
|
13
15
|
### Configuration[](#configuration "Direct link to Configuration")
|
|
14
16
|
|
|
15
|
-
* `outFile?: string` - Output file path (default: `
|
|
17
|
+
* `outFile?: string` - Output file path (default: `shared/appkit-types/analytics.d.ts`)
|
|
16
18
|
* `watchFolders?: string[]` - Folders to watch for SQL files (default: `["../config/queries"]`)
|
|
17
19
|
|
|
18
20
|
### Example[](#example "Direct link to Example")
|
|
@@ -27,7 +29,6 @@ export default defineConfig({
|
|
|
27
29
|
plugins: [
|
|
28
30
|
react(),
|
|
29
31
|
appKitTypesPlugin({
|
|
30
|
-
outFile: "src/appKitTypes.d.ts",
|
|
31
32
|
watchFolders: ["../config/queries"],
|
|
32
33
|
}),
|
|
33
34
|
],
|
|
@@ -54,14 +55,14 @@ npx @databricks/appkit generate-types [rootDir] [outFile] [warehouseId]
|
|
|
54
55
|
* Generate types using warehouse ID from environment
|
|
55
56
|
|
|
56
57
|
```bash
|
|
57
|
-
npx @databricks/appkit generate-types .
|
|
58
|
+
npx @databricks/appkit generate-types . shared/appkit-types/analytics.d.ts
|
|
58
59
|
|
|
59
60
|
```
|
|
60
61
|
|
|
61
62
|
* Generate types using warehouse ID explicitly
|
|
62
63
|
|
|
63
64
|
```bash
|
|
64
|
-
npx @databricks/appkit generate-types .
|
|
65
|
+
npx @databricks/appkit generate-types . shared/appkit-types/analytics.d.ts abc123...
|
|
65
66
|
|
|
66
67
|
```
|
|
67
68
|
|
package/docs/faq.md
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# FAQ
|
|
2
|
+
|
|
3
|
+
## Integrations[](#integrations "Direct link to Integrations")
|
|
4
|
+
|
|
5
|
+
### What Databricks services are available through AppKit?[](#what-databricks-services-are-available-through-appkit "Direct link to What Databricks services are available through AppKit?")
|
|
6
|
+
|
|
7
|
+
AppKit provides built-in integrations with the following Databricks services via its [plugin system](./docs/plugins.md):
|
|
8
|
+
|
|
9
|
+
| Plugin | Databricks Service | What It Does |
|
|
10
|
+
| ---------------------------------------------- | --------------------------------- | --------------------------------------------------------------------------------------- |
|
|
11
|
+
| [Analytics](./docs/plugins/analytics.md) | SQL Warehouses | Execute parameterized SQL queries with built-in caching, retry, and Arrow support |
|
|
12
|
+
| [Lakebase](./docs/plugins/lakebase.md) | Lakebase Autoscaling (PostgreSQL) | Relational database access via standard pg.Pool with automatic OAuth token refresh |
|
|
13
|
+
| [Genie](./docs/plugins/genie.md) | AI/BI Genie Spaces | Natural language data queries with conversation management and streaming |
|
|
14
|
+
| [Files](./docs/plugins/files.md) | Unity Catalog Volumes | Multi-volume file operations (list, read, upload, download, delete, preview) |
|
|
15
|
+
| [Serving](./docs/plugins/serving.md) | Model Serving | Authenticated proxy to Model Serving endpoints with invoke and streaming support |
|
|
16
|
+
| [Server](./docs/plugins/server.md) | N/A | Express HTTP server with static file serving, Vite dev mode, and plugin route injection |
|
|
17
|
+
|
|
18
|
+
Stay tuned for new plugins as we constantly expand integrations!
|
|
19
|
+
|
|
20
|
+
### Can I add custom integrations?[](#can-i-add-custom-integrations "Direct link to Can I add custom integrations?")
|
|
21
|
+
|
|
22
|
+
Yes. AppKit's plugin architecture is extensible - you can create custom plugins using the CLI (`npx appkit plugin create`) or manually. See the [creating custom plugins guide](./docs/plugins/custom-plugins.md).
|
|
23
|
+
|
|
24
|
+
## Authentication[](#authentication "Direct link to Authentication")
|
|
25
|
+
|
|
26
|
+
### How does authentication work in AppKit apps?[](#how-does-authentication-work-in-appkit-apps "Direct link to How does authentication work in AppKit apps?")
|
|
27
|
+
|
|
28
|
+
AppKit apps are designed to run on [Databricks Apps](https://docs.databricks.com/aws/en/dev-tools/databricks-apps/), which handles user authentication and authorization. Databricks Apps forwards user identity to the app via request headers, and AppKit integrates with this through the `.asUser(req)` pattern for on-behalf-of (OBO) execution — allowing plugins to act on behalf of the authenticated user.
|
|
29
|
+
|
|
30
|
+
For details on how authentication and authorization work in Databricks Apps, see the [official auth documentation](https://docs.databricks.com/aws/en/dev-tools/databricks-apps/auth).
|
|
31
|
+
|
|
32
|
+
## Databases[](#databases "Direct link to Databases")
|
|
33
|
+
|
|
34
|
+
*Also: Lakebase, PostgreSQL, OLTP*
|
|
35
|
+
|
|
36
|
+
### How does AppKit handle databases?[](#how-does-appkit-handle-databases "Direct link to How does AppKit handle databases?")
|
|
37
|
+
|
|
38
|
+
AppKit is a TypeScript SDK (Express + React) and does not manage databases directly.
|
|
39
|
+
|
|
40
|
+
To add database support, use the [Lakebase plugin](./docs/plugins/lakebase.md), which integrates with Lakebase Autoscaling.
|
|
41
|
+
|
|
42
|
+
AppKit also uses Lakebase for caching when it is available (see the [caching](#does-appkit-support-caching) section below).
|
|
43
|
+
|
|
44
|
+
You can manage Lakebase Autoscaling projects and branches using the dedicated agent skill from [Databricks Agent Skills](./docs/development/ai-assisted-development.md), installed with the Databricks CLI.
|
|
45
|
+
|
|
46
|
+
### How does database setup and permission management work in AppKit?[](#how-does-database-setup-and-permission-management-work-in-appkit "Direct link to How does database setup and permission management work in AppKit?")
|
|
47
|
+
|
|
48
|
+
AppKit apps can have an attached Lakebase Autoscaling instance. No database is bundled by default - you add one by configuring the [Lakebase plugin](./docs/plugins/lakebase.md). When running `databricks apps init` and selecting the Lakebase plugin, the selected database is automatically attached as an app resource after deployment.
|
|
49
|
+
|
|
50
|
+
With [AI-assisted development](./docs/development/ai-assisted-development.md), you can also ask the Agent to create a Lakebase project and branch for you.
|
|
51
|
+
|
|
52
|
+
When deployed, a Databricks app uses its Service Principal for schema and table creation. If you configure the Lakebase Autoscaling project as an [app resource](https://docs.databricks.com/aws/en/dev-tools/databricks-apps/resources), the necessary connect and create permissions are granted automatically to the app's Service Principal.
|
|
53
|
+
|
|
54
|
+
### Does AppKit support Lakebase Provisioned?[](#does-appkit-support-lakebase-provisioned "Direct link to Does AppKit support Lakebase Provisioned?")
|
|
55
|
+
|
|
56
|
+
No. AppKit only supports Lakebase Autoscaling. Lakebase Provisioned databases are not supported by the [Lakebase plugin](./docs/plugins/lakebase.md) or Lakebase agent skill from [Databricks Agent Skills](./docs/development/ai-assisted-development.md).
|
|
57
|
+
|
|
58
|
+
## Caching[](#caching "Direct link to Caching")
|
|
59
|
+
|
|
60
|
+
### Does AppKit support caching?[](#does-appkit-support-caching "Direct link to Does AppKit support caching?")
|
|
61
|
+
|
|
62
|
+
Yes. The [Analytics plugin](./docs/plugins/analytics.md) - used for executing SQL queries against Databricks SQL Warehouses - supports an optional cache layer.
|
|
63
|
+
|
|
64
|
+
Caching is configured per plugin and can use either [Lakebase Autoscaling](https://docs.databricks.com/aws/en/oltp/) or an in-memory store, depending on the configuration.
|
|
65
|
+
|
|
66
|
+
If the Lakebase Autoscaling connection is configured, the AppKit-based app creates an `appkit` schema in the configured database with internal tables required for caching.
|
|
@@ -139,7 +139,7 @@ function SpendTable() {
|
|
|
139
139
|
Augment the `QueryRegistry` interface to get full type inference on parameters and results:
|
|
140
140
|
|
|
141
141
|
```ts
|
|
142
|
-
//
|
|
142
|
+
// shared/appkit-types/analytics.d.ts
|
|
143
143
|
declare module "@databricks/appkit-ui/react" {
|
|
144
144
|
interface QueryRegistry {
|
|
145
145
|
spend_summary: {
|
|
@@ -3,8 +3,12 @@
|
|
|
3
3
|
If you need custom API routes or background logic, implement an AppKit plugin. The fastest way is to use the CLI:
|
|
4
4
|
|
|
5
5
|
```bash
|
|
6
|
+
# Interactive
|
|
6
7
|
npx @databricks/appkit plugin create
|
|
7
8
|
|
|
9
|
+
# Non-interactive
|
|
10
|
+
npx @databricks/appkit plugin create --placement in-repo --path plugins/my-plugin --name my-plugin --description "My plugin" --force
|
|
11
|
+
|
|
8
12
|
```
|
|
9
13
|
|
|
10
14
|
For a deeper understanding of the plugin structure, read on.
|
|
@@ -6,19 +6,30 @@ AppKit includes a CLI for managing plugins. All commands are available under `np
|
|
|
6
6
|
|
|
7
7
|
## Create a plugin[](#create-a-plugin "Direct link to Create a plugin")
|
|
8
8
|
|
|
9
|
-
Scaffold a new plugin interactively:
|
|
9
|
+
Scaffold a new plugin interactively or via flags:
|
|
10
10
|
|
|
11
11
|
```bash
|
|
12
|
+
# Interactive mode (prompts for all options)
|
|
12
13
|
npx @databricks/appkit plugin create
|
|
13
14
|
|
|
15
|
+
# Non-interactive mode (all required flags provided)
|
|
16
|
+
npx @databricks/appkit plugin create \
|
|
17
|
+
--placement in-repo \
|
|
18
|
+
--path plugins/my-plugin \
|
|
19
|
+
--name my-plugin \
|
|
20
|
+
--description "My custom plugin" \
|
|
21
|
+
--resources sql_warehouse \
|
|
22
|
+
--force
|
|
23
|
+
|
|
14
24
|
```
|
|
15
25
|
|
|
16
|
-
|
|
26
|
+
In interactive mode, the wizard walks you through:
|
|
17
27
|
|
|
18
28
|
* **Placement**: In your repository (e.g. `plugins/my-plugin`) or as a standalone package
|
|
19
29
|
* **Metadata**: Name, display name, description
|
|
20
30
|
* **Resources**: Which Databricks resources the plugin needs (SQL Warehouse, Secret, etc.) and whether each is required or optional
|
|
21
|
-
|
|
31
|
+
|
|
32
|
+
In non-interactive mode, `--placement`, `--path`, `--name`, and `--description` are required. Resources can be specified as a comma-separated list (`--resources sql_warehouse,volume`) or as JSON for full control (`--resources-json '[{"type":"sql_warehouse","permission":"CAN_MANAGE"}]'`). For all available options, run `npx @databricks/appkit plugin create --help`.
|
|
22
33
|
|
|
23
34
|
The command generates a complete plugin scaffold with `manifest.json` and a TypeScript plugin class that imports the manifest directly — ready to register in your app.
|
|
24
35
|
|
|
@@ -91,12 +102,17 @@ npx @databricks/appkit plugin list --json
|
|
|
91
102
|
|
|
92
103
|
## Add a resource to a plugin[](#add-a-resource-to-a-plugin "Direct link to Add a resource to a plugin")
|
|
93
104
|
|
|
94
|
-
|
|
105
|
+
Add a new resource requirement to an existing plugin manifest. **Requires `manifest.json`** in the plugin directory (the command edits it in place; it does not modify `manifest.js`):
|
|
95
106
|
|
|
96
107
|
```bash
|
|
108
|
+
# Interactive mode
|
|
97
109
|
npx @databricks/appkit plugin add-resource
|
|
98
|
-
|
|
99
|
-
# Or specify the plugin directory
|
|
100
110
|
npx @databricks/appkit plugin add-resource --path plugins/my-plugin
|
|
101
111
|
|
|
112
|
+
# Non-interactive mode (--type triggers flag-based mode)
|
|
113
|
+
npx @databricks/appkit plugin add-resource --path plugins/my-plugin --type sql_warehouse
|
|
114
|
+
npx @databricks/appkit plugin add-resource --path plugins/my-plugin --type volume --no-required --dry-run
|
|
115
|
+
|
|
102
116
|
```
|
|
117
|
+
|
|
118
|
+
In non-interactive mode, only `--type` is required — all other fields (permission, resource key, field env vars) default to sensible values from the schema. Use `--dry-run` to preview the updated manifest without writing. For all available options, run `npx @databricks/appkit plugin add-resource --help`.
|