@databricks/appkit-ui 0.10.1 → 0.11.1

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 (221) hide show
  1. package/CLAUDE.md +7 -0
  2. package/dist/cli/commands/plugin/sync/sync.js +17 -11
  3. package/dist/cli/commands/plugin/sync/sync.js.map +1 -1
  4. package/dist/react/charts/area/index.d.ts +2 -2
  5. package/dist/react/charts/bar/index.d.ts +2 -2
  6. package/dist/react/charts/base.d.ts +2 -2
  7. package/dist/react/charts/base.d.ts.map +1 -1
  8. package/dist/react/charts/create-chart.d.ts +2 -2
  9. package/dist/react/charts/create-chart.d.ts.map +1 -1
  10. package/dist/react/charts/heatmap/index.d.ts +2 -2
  11. package/dist/react/charts/line/index.d.ts +2 -2
  12. package/dist/react/charts/options.d.ts.map +1 -1
  13. package/dist/react/charts/pie/index.d.ts +3 -3
  14. package/dist/react/charts/radar/index.d.ts +2 -2
  15. package/dist/react/charts/scatter/index.d.ts +2 -2
  16. package/dist/react/charts/wrapper.d.ts +2 -2
  17. package/dist/react/charts/wrapper.d.ts.map +1 -1
  18. package/dist/react/table/data-table.d.ts +2 -2
  19. package/dist/react/table/data-table.d.ts.map +1 -1
  20. package/dist/react/ui/accordion.d.ts +5 -5
  21. package/dist/react/ui/accordion.d.ts.map +1 -1
  22. package/dist/react/ui/alert-dialog.d.ts +12 -12
  23. package/dist/react/ui/alert.d.ts +4 -4
  24. package/dist/react/ui/alert.d.ts.map +1 -1
  25. package/dist/react/ui/aspect-ratio.d.ts +2 -2
  26. package/dist/react/ui/avatar.d.ts +4 -4
  27. package/dist/react/ui/badge.d.ts +2 -2
  28. package/dist/react/ui/breadcrumb.d.ts +8 -8
  29. package/dist/react/ui/button-group.d.ts +4 -4
  30. package/dist/react/ui/button.d.ts +2 -2
  31. package/dist/react/ui/calendar.d.ts +3 -3
  32. package/dist/react/ui/card.d.ts +8 -8
  33. package/dist/react/ui/carousel.d.ts +6 -6
  34. package/dist/react/ui/chart.d.ts +5 -5
  35. package/dist/react/ui/checkbox.d.ts +2 -2
  36. package/dist/react/ui/collapsible.d.ts +4 -4
  37. package/dist/react/ui/command.d.ts +10 -10
  38. package/dist/react/ui/context-menu.d.ts +16 -16
  39. package/dist/react/ui/dialog.d.ts +11 -11
  40. package/dist/react/ui/drawer.d.ts +11 -11
  41. package/dist/react/ui/drawer.d.ts.map +1 -1
  42. package/dist/react/ui/dropdown-menu.d.ts +16 -16
  43. package/dist/react/ui/empty.d.ts +7 -7
  44. package/dist/react/ui/field.d.ts +11 -11
  45. package/dist/react/ui/form.d.ts +7 -7
  46. package/dist/react/ui/hover-card.d.ts +4 -4
  47. package/dist/react/ui/input-group.d.ts +7 -7
  48. package/dist/react/ui/input-otp.d.ts +5 -5
  49. package/dist/react/ui/input.d.ts +2 -2
  50. package/dist/react/ui/item.d.ts +11 -11
  51. package/dist/react/ui/kbd.d.ts +3 -3
  52. package/dist/react/ui/label.d.ts +2 -2
  53. package/dist/react/ui/menubar.d.ts +17 -17
  54. package/dist/react/ui/navigation-menu.d.ts +9 -9
  55. package/dist/react/ui/pagination.d.ts +8 -8
  56. package/dist/react/ui/popover.d.ts +5 -5
  57. package/dist/react/ui/progress.d.ts +2 -2
  58. package/dist/react/ui/radio-group.d.ts +3 -3
  59. package/dist/react/ui/resizable.d.ts +4 -4
  60. package/dist/react/ui/scroll-area.d.ts +3 -3
  61. package/dist/react/ui/select.d.ts +11 -11
  62. package/dist/react/ui/separator.d.ts +2 -2
  63. package/dist/react/ui/sheet.d.ts +9 -9
  64. package/dist/react/ui/sidebar.d.ts +24 -24
  65. package/dist/react/ui/skeleton.d.ts +2 -2
  66. package/dist/react/ui/slider.d.ts +2 -2
  67. package/dist/react/ui/sonner.d.ts +2 -2
  68. package/dist/react/ui/spinner.d.ts +2 -2
  69. package/dist/react/ui/switch.d.ts +2 -2
  70. package/dist/react/ui/table.d.ts +9 -9
  71. package/dist/react/ui/tabs.d.ts +5 -5
  72. package/dist/react/ui/textarea.d.ts +2 -2
  73. package/dist/react/ui/toggle-group.d.ts +3 -3
  74. package/dist/react/ui/toggle.d.ts +2 -2
  75. package/dist/react/ui/tooltip.d.ts +5 -5
  76. package/dist/react/ui/tooltip.d.ts.map +1 -1
  77. package/dist/schemas/plugin-manifest.schema.json +9 -0
  78. package/dist/schemas/template-plugins.schema.json +4 -0
  79. package/docs/docs/api/appkit/Class.AppKitError/index.html +3 -3
  80. package/docs/docs/api/appkit/Class.AuthenticationError/index.html +3 -3
  81. package/docs/docs/api/appkit/Class.ConfigurationError/index.html +3 -3
  82. package/docs/docs/api/appkit/Class.ConnectionError/index.html +3 -3
  83. package/docs/docs/api/appkit/Class.ExecutionError/index.html +3 -3
  84. package/docs/docs/api/appkit/Class.InitializationError/index.html +3 -3
  85. package/docs/docs/api/appkit/Class.Plugin/index.html +3 -3
  86. package/docs/docs/api/appkit/Class.ResourceRegistry/index.html +3 -3
  87. package/docs/docs/api/appkit/Class.ServerError/index.html +3 -3
  88. package/docs/docs/api/appkit/Class.TunnelError/index.html +3 -3
  89. package/docs/docs/api/appkit/Class.ValidationError/index.html +3 -3
  90. package/docs/docs/api/appkit/Enumeration.RequestedClaimsPermissionSet/index.html +3 -3
  91. package/docs/docs/api/appkit/Enumeration.ResourceType/index.html +3 -3
  92. package/docs/docs/api/appkit/Function.appKitTypesPlugin/index.html +3 -3
  93. package/docs/docs/api/appkit/Function.createApp/index.html +3 -3
  94. package/docs/docs/api/appkit/Function.createLakebasePool/index.html +3 -3
  95. package/docs/docs/api/appkit/Function.generateDatabaseCredential/index.html +3 -3
  96. package/docs/docs/api/appkit/Function.getExecutionContext/index.html +3 -3
  97. package/docs/docs/api/appkit/Function.getLakebaseOrmConfig/index.html +3 -3
  98. package/docs/docs/api/appkit/Function.getLakebasePgConfig/index.html +3 -3
  99. package/docs/docs/api/appkit/Function.getPluginManifest/index.html +3 -3
  100. package/docs/docs/api/appkit/Function.getResourceRequirements/index.html +3 -3
  101. package/docs/docs/api/appkit/Function.getUsernameWithApiLookup/index.html +3 -3
  102. package/docs/docs/api/appkit/Function.getWorkspaceClient/index.html +3 -3
  103. package/docs/docs/api/appkit/Function.isSQLTypeMarker/index.html +3 -3
  104. package/docs/docs/api/appkit/Interface.BasePluginConfig/index.html +3 -3
  105. package/docs/docs/api/appkit/Interface.CacheConfig/index.html +3 -3
  106. package/docs/docs/api/appkit/Interface.DatabaseCredential/index.html +3 -3
  107. package/docs/docs/api/appkit/Interface.GenerateDatabaseCredentialRequest/index.html +3 -3
  108. package/docs/docs/api/appkit/Interface.ITelemetry/index.html +3 -3
  109. package/docs/docs/api/appkit/Interface.LakebasePoolConfig/index.html +3 -3
  110. package/docs/docs/api/appkit/Interface.PluginManifest/index.html +8 -4
  111. package/docs/docs/api/appkit/Interface.PluginManifest.md +11 -0
  112. package/docs/docs/api/appkit/Interface.RequestedClaims/index.html +3 -3
  113. package/docs/docs/api/appkit/Interface.RequestedResource/index.html +3 -3
  114. package/docs/docs/api/appkit/Interface.ResourceEntry/index.html +3 -3
  115. package/docs/docs/api/appkit/Interface.ResourceFieldEntry/index.html +3 -3
  116. package/docs/docs/api/appkit/Interface.ResourceRequirement/index.html +3 -3
  117. package/docs/docs/api/appkit/Interface.StreamExecutionSettings/index.html +3 -3
  118. package/docs/docs/api/appkit/Interface.TelemetryConfig/index.html +3 -3
  119. package/docs/docs/api/appkit/Interface.ValidationResult/index.html +3 -3
  120. package/docs/docs/api/appkit/TypeAlias.ConfigSchema/index.html +3 -3
  121. package/docs/docs/api/appkit/TypeAlias.IAppRouter/index.html +3 -3
  122. package/docs/docs/api/appkit/TypeAlias.ResourcePermission/index.html +3 -3
  123. package/docs/docs/api/appkit/TypeAlias.ToPlugin/index.html +3 -3
  124. package/docs/docs/api/appkit/Variable.sql/index.html +3 -3
  125. package/docs/docs/api/appkit/index.html +3 -3
  126. package/docs/docs/api/appkit-ui/data/AreaChart/index.html +3 -3
  127. package/docs/docs/api/appkit-ui/data/BarChart/index.html +3 -3
  128. package/docs/docs/api/appkit-ui/data/DataTable/index.html +3 -3
  129. package/docs/docs/api/appkit-ui/data/DonutChart/index.html +3 -3
  130. package/docs/docs/api/appkit-ui/data/HeatmapChart/index.html +3 -3
  131. package/docs/docs/api/appkit-ui/data/LineChart/index.html +3 -3
  132. package/docs/docs/api/appkit-ui/data/PieChart/index.html +3 -3
  133. package/docs/docs/api/appkit-ui/data/RadarChart/index.html +3 -3
  134. package/docs/docs/api/appkit-ui/data/ScatterChart/index.html +3 -3
  135. package/docs/docs/api/appkit-ui/index.html +3 -3
  136. package/docs/docs/api/appkit-ui/styling/index.html +3 -3
  137. package/docs/docs/api/appkit-ui/ui/Accordion/index.html +3 -3
  138. package/docs/docs/api/appkit-ui/ui/Alert/index.html +3 -3
  139. package/docs/docs/api/appkit-ui/ui/AlertDialog/index.html +3 -3
  140. package/docs/docs/api/appkit-ui/ui/AspectRatio/index.html +3 -3
  141. package/docs/docs/api/appkit-ui/ui/Avatar/index.html +3 -3
  142. package/docs/docs/api/appkit-ui/ui/Badge/index.html +3 -3
  143. package/docs/docs/api/appkit-ui/ui/Breadcrumb/index.html +3 -3
  144. package/docs/docs/api/appkit-ui/ui/Button/index.html +3 -3
  145. package/docs/docs/api/appkit-ui/ui/ButtonGroup/index.html +3 -3
  146. package/docs/docs/api/appkit-ui/ui/Calendar/index.html +3 -3
  147. package/docs/docs/api/appkit-ui/ui/Card/index.html +3 -3
  148. package/docs/docs/api/appkit-ui/ui/Carousel/index.html +3 -3
  149. package/docs/docs/api/appkit-ui/ui/ChartContainer/index.html +3 -3
  150. package/docs/docs/api/appkit-ui/ui/Checkbox/index.html +3 -3
  151. package/docs/docs/api/appkit-ui/ui/Collapsible/index.html +3 -3
  152. package/docs/docs/api/appkit-ui/ui/Command/index.html +3 -3
  153. package/docs/docs/api/appkit-ui/ui/ContextMenu/index.html +3 -3
  154. package/docs/docs/api/appkit-ui/ui/Dialog/index.html +3 -3
  155. package/docs/docs/api/appkit-ui/ui/Drawer/index.html +3 -3
  156. package/docs/docs/api/appkit-ui/ui/DropdownMenu/index.html +3 -3
  157. package/docs/docs/api/appkit-ui/ui/Empty/index.html +3 -3
  158. package/docs/docs/api/appkit-ui/ui/Field/index.html +3 -3
  159. package/docs/docs/api/appkit-ui/ui/FormControl/index.html +3 -3
  160. package/docs/docs/api/appkit-ui/ui/HoverCard/index.html +3 -3
  161. package/docs/docs/api/appkit-ui/ui/Input/index.html +3 -3
  162. package/docs/docs/api/appkit-ui/ui/InputGroup/index.html +3 -3
  163. package/docs/docs/api/appkit-ui/ui/InputOTP/index.html +3 -3
  164. package/docs/docs/api/appkit-ui/ui/Item/index.html +3 -3
  165. package/docs/docs/api/appkit-ui/ui/Kbd/index.html +3 -3
  166. package/docs/docs/api/appkit-ui/ui/Label/index.html +3 -3
  167. package/docs/docs/api/appkit-ui/ui/Menubar/index.html +3 -3
  168. package/docs/docs/api/appkit-ui/ui/NavigationMenu/index.html +3 -3
  169. package/docs/docs/api/appkit-ui/ui/Pagination/index.html +3 -3
  170. package/docs/docs/api/appkit-ui/ui/Popover/index.html +3 -3
  171. package/docs/docs/api/appkit-ui/ui/Progress/index.html +3 -3
  172. package/docs/docs/api/appkit-ui/ui/RadioGroup/index.html +3 -3
  173. package/docs/docs/api/appkit-ui/ui/ResizableHandle/index.html +3 -3
  174. package/docs/docs/api/appkit-ui/ui/ScrollArea/index.html +3 -3
  175. package/docs/docs/api/appkit-ui/ui/Select/index.html +3 -3
  176. package/docs/docs/api/appkit-ui/ui/Separator/index.html +3 -3
  177. package/docs/docs/api/appkit-ui/ui/Sheet/index.html +3 -3
  178. package/docs/docs/api/appkit-ui/ui/Sidebar/index.html +3 -3
  179. package/docs/docs/api/appkit-ui/ui/Skeleton/index.html +3 -3
  180. package/docs/docs/api/appkit-ui/ui/Slider/index.html +3 -3
  181. package/docs/docs/api/appkit-ui/ui/Spinner/index.html +3 -3
  182. package/docs/docs/api/appkit-ui/ui/Switch/index.html +3 -3
  183. package/docs/docs/api/appkit-ui/ui/Table/index.html +3 -3
  184. package/docs/docs/api/appkit-ui/ui/Tabs/index.html +3 -3
  185. package/docs/docs/api/appkit-ui/ui/Textarea/index.html +3 -3
  186. package/docs/docs/api/appkit-ui/ui/Toaster/index.html +3 -3
  187. package/docs/docs/api/appkit-ui/ui/Toggle/index.html +3 -3
  188. package/docs/docs/api/appkit-ui/ui/ToggleGroup/index.html +3 -3
  189. package/docs/docs/api/appkit-ui/ui/Tooltip/index.html +3 -3
  190. package/docs/docs/api/index.html +3 -3
  191. package/docs/docs/app-management/index.html +4 -4
  192. package/docs/docs/architecture/index.html +6 -6
  193. package/docs/docs/category/development/index.html +3 -3
  194. package/docs/docs/configuration/index.html +4 -4
  195. package/docs/docs/core-principles/index.html +3 -3
  196. package/docs/docs/development/ai-assisted-development/index.html +3 -3
  197. package/docs/docs/development/index.html +3 -3
  198. package/docs/docs/development/llm-guide/index.html +3 -3
  199. package/docs/docs/development/local-development/index.html +3 -3
  200. package/docs/docs/development/project-setup/index.html +4 -4
  201. package/docs/docs/development/remote-bridge/index.html +3 -3
  202. package/docs/docs/development/type-generation/index.html +4 -4
  203. package/docs/docs/index.html +3 -3
  204. package/docs/docs/plugins/analytics/index.html +53 -0
  205. package/docs/docs/plugins/analytics.md +66 -0
  206. package/docs/docs/plugins/caching/index.html +23 -0
  207. package/docs/docs/plugins/caching.md +33 -0
  208. package/docs/docs/plugins/custom-plugins/index.html +49 -0
  209. package/docs/docs/plugins/custom-plugins.md +161 -0
  210. package/docs/docs/plugins/execution-context/index.html +40 -0
  211. package/docs/docs/plugins/execution-context.md +45 -0
  212. package/docs/docs/plugins/index.html +6 -173
  213. package/docs/docs/plugins/lakebase/index.html +62 -0
  214. package/docs/docs/plugins/lakebase.md +179 -0
  215. package/docs/docs/plugins/plugin-management/index.html +44 -0
  216. package/docs/docs/plugins/plugin-management.md +88 -0
  217. package/docs/docs/plugins/server/index.html +45 -0
  218. package/docs/docs/plugins/server.md +78 -0
  219. package/docs/docs/plugins.md +0 -481
  220. package/llms.txt +7 -0
  221. package/package.json +1 -1
@@ -4,202 +4,6 @@ Plugins are modular extensions that add capabilities to your AppKit application.
4
4
 
5
5
  For complete API documentation, see the [`Plugin`](/appkit/docs/api/appkit/Class.Plugin.md) class reference.
6
6
 
7
- ## Built-in plugins[​](#built-in-plugins "Direct link to Built-in plugins")
8
-
9
- ### Server plugin[​](#server-plugin "Direct link to Server plugin")
10
-
11
- Provides HTTP server capabilities with development and production modes.
12
-
13
- **Key features:**
14
-
15
- * Express server for REST APIs
16
- * Vite dev server with hot module reload
17
- * Static file serving for production
18
- * Remote tunneling to deployed backends
19
-
20
- The Server plugin uses the deferred initialization phase to access routes from other plugins.
21
-
22
- #### What it does[​](#what-it-does "Direct link to What it does")
23
-
24
- * Starts an Express server (default `host=0.0.0.0`, `port=8000`)
25
-
26
- * Mounts plugin routes under `/api/<pluginName>/...`
27
-
28
- * Adds `/health` endpoint (returns `{ status: "ok" }`)
29
-
30
- * Serves frontend:
31
-
32
- <!-- -->
33
-
34
- * **Development** (`NODE_ENV=development`): runs a Vite dev server in middleware mode
35
- * **Production**: auto-detects static frontend directory (checks `dist`, `client/dist`, `build`, `public`, `out`)
36
-
37
- #### Minimal server example[​](#minimal-server-example "Direct link to Minimal server example")
38
-
39
- The smallest valid AppKit server:
40
-
41
- ```ts
42
- // server/index.ts
43
- import { createApp, server } from "@databricks/appkit";
44
-
45
- await createApp({
46
- plugins: [server()],
47
- });
48
-
49
- ```
50
-
51
- #### Manual server start example[​](#manual-server-start-example "Direct link to Manual server start example")
52
-
53
- When you need to extend Express with custom routes:
54
-
55
- ```ts
56
- import { createApp, server } from "@databricks/appkit";
57
-
58
- const appkit = await createApp({
59
- plugins: [server({ autoStart: false })],
60
- });
61
-
62
- appkit.server.extend((app) => {
63
- app.get("/custom", (_req, res) => res.json({ ok: true }));
64
- });
65
-
66
- await appkit.server.start();
67
-
68
- ```
69
-
70
- #### Configuration options[​](#configuration-options "Direct link to Configuration options")
71
-
72
- ```ts
73
- import { createApp, server } from "@databricks/appkit";
74
-
75
- await createApp({
76
- plugins: [
77
- server({
78
- port: 8000, // default: Number(process.env.DATABRICKS_APP_PORT) || 8000
79
- host: "0.0.0.0", // default: process.env.FLASK_RUN_HOST || "0.0.0.0"
80
- autoStart: true, // default: true
81
- staticPath: "dist", // optional: force a specific static directory
82
- }),
83
- ],
84
- });
85
-
86
- ```
87
-
88
- ### Analytics plugin[​](#analytics-plugin "Direct link to Analytics plugin")
89
-
90
- Enables SQL query execution against Databricks SQL Warehouses.
91
-
92
- **Key features:**
93
-
94
- * File-based SQL queries with automatic type generation
95
- * Parameterized queries with type-safe [SQL helpers](/appkit/docs/api/appkit/Variable.sql.md)
96
- * JSON and Arrow format support
97
- * Built-in caching and retry logic
98
- * Server-Sent Events (SSE) streaming
99
-
100
- #### Basic usage[​](#basic-usage "Direct link to Basic usage")
101
-
102
- ```ts
103
- import { analytics, createApp, server } from "@databricks/appkit";
104
-
105
- await createApp({
106
- plugins: [server(), analytics({})],
107
- });
108
-
109
- ```
110
-
111
- #### Where queries live[​](#where-queries-live "Direct link to Where queries live")
112
-
113
- * Put `.sql` files in `config/queries/`
114
- * Query key is the filename without `.sql` (e.g. `spend_summary.sql` → `"spend_summary"`)
115
-
116
- #### SQL parameters[​](#sql-parameters "Direct link to SQL parameters")
117
-
118
- Use `:paramName` placeholders and optionally annotate parameter types using SQL comments:
119
-
120
- ```sql
121
- -- @param startDate DATE
122
- -- @param endDate DATE
123
- -- @param limit NUMERIC
124
- SELECT ...
125
- WHERE usage_date BETWEEN :startDate AND :endDate
126
- LIMIT :limit
127
-
128
- ```
129
-
130
- **Supported `-- @param` types** (case-insensitive):
131
-
132
- * `STRING`, `NUMERIC`, `BOOLEAN`, `DATE`, `TIMESTAMP`, `BINARY`
133
-
134
- #### Server-injected parameters[​](#server-injected-parameters "Direct link to Server-injected parameters")
135
-
136
- `:workspaceId` is **injected by the server** and **must not** be annotated:
137
-
138
- ```sql
139
- WHERE workspace_id = :workspaceId
140
-
141
- ```
142
-
143
- #### HTTP endpoints[​](#http-endpoints "Direct link to HTTP endpoints")
144
-
145
- The analytics plugin exposes these endpoints (mounted under `/api/analytics`):
146
-
147
- * `POST /api/analytics/query/:query_key`
148
- * `POST /api/analytics/users/me/query/:query_key`
149
- * `GET /api/analytics/arrow-result/:jobId`
150
- * `GET /api/analytics/users/me/arrow-result/:jobId`
151
-
152
- #### Format options[​](#format-options "Direct link to Format options")
153
-
154
- * `format: "JSON"` (default) returns JSON rows
155
- * `format: "ARROW"` returns an Arrow "statement\_id" payload over SSE, then the client fetches binary Arrow from `/api/analytics/arrow-result/:jobId`
156
-
157
- ### Execution context and `asUser(req)`[​](#execution-context-and-asuserreq "Direct link to execution-context-and-asuserreq")
158
-
159
- AppKit manages Databricks authentication via two contexts:
160
-
161
- * **ServiceContext** (singleton): Initialized at app startup with service principal credentials
162
- * **ExecutionContext**: Determined at runtime - either service principal or user context
163
-
164
- #### Headers for user context[​](#headers-for-user-context "Direct link to Headers for user context")
165
-
166
- * `x-forwarded-user`: required in production; identifies the user
167
- * `x-forwarded-access-token`: required for user token passthrough
168
-
169
- #### Using `asUser(req)` for user-scoped operations[​](#using-asuserreq-for-user-scoped-operations "Direct link to using-asuserreq-for-user-scoped-operations")
170
-
171
- The `asUser(req)` pattern allows plugins to execute operations using the requesting user's credentials:
172
-
173
- ```ts
174
- // In a custom plugin route handler
175
- router.post("/users/me/data", async (req, res) => {
176
- // Execute as the user (uses their Databricks permissions)
177
- const result = await this.asUser(req).query("SELECT ...");
178
- res.json(result);
179
- });
180
-
181
- // Service principal execution (default)
182
- router.post("/system/data", async (req, res) => {
183
- const result = await this.query("SELECT ...");
184
- res.json(result);
185
- });
186
-
187
- ```
188
-
189
- #### Context helper functions[​](#context-helper-functions "Direct link to Context helper functions")
190
-
191
- Exported from `@databricks/appkit`:
192
-
193
- * `getCurrentUserId()`: Returns user ID in user context, service user ID otherwise
194
- * `getWorkspaceClient()`: Returns the appropriate WorkspaceClient for current context
195
- * `getWarehouseId()`: `Promise<string>` (from `DATABRICKS_WAREHOUSE_ID` or auto-selected in dev)
196
- * `getWorkspaceId()`: `Promise<string>` (from `DATABRICKS_WORKSPACE_ID` or fetched)
197
- * `isInUserContext()`: Returns `true` if currently executing in user context
198
-
199
- #### Development mode behavior[​](#development-mode-behavior "Direct link to Development mode behavior")
200
-
201
- In local development (`NODE_ENV=development`), if `asUser(req)` is called without a user token, it logs a warning and falls back to the service principal.
202
-
203
7
  ## Using plugins[​](#using-plugins "Direct link to Using plugins")
204
8
 
205
9
  Configure plugins when creating your AppKit instance:
@@ -218,291 +22,6 @@ const AppKit = await createApp({
218
22
 
219
23
  For complete configuration options, see [`createApp`](/appkit/docs/api/appkit/Function.createApp.md).
220
24
 
221
- ## Plugin management[​](#plugin-management "Direct link to Plugin management")
222
-
223
- AppKit includes a CLI for managing plugins. All commands are available under `npx @databricks/appkit plugin`.
224
-
225
- ### Create a plugin[​](#create-a-plugin "Direct link to Create a plugin")
226
-
227
- Scaffold a new plugin interactively:
228
-
229
- ```bash
230
- npx @databricks/appkit plugin create
231
-
232
- ```
233
-
234
- The wizard walks you through:
235
-
236
- * **Placement**: In your repository (e.g. `plugins/my-plugin`) or as a standalone package
237
- * **Metadata**: Name, display name, description
238
- * **Resources**: Which Databricks resources the plugin needs (SQL Warehouse, Secret, etc.) and whether each is required or optional
239
- * **Optional fields**: Author, version, license
240
-
241
- The command generates a complete plugin scaffold with `manifest.json`, TypeScript class, and barrel exports — ready to register in your app.
242
-
243
- ### Sync plugin manifests[​](#sync-plugin-manifests "Direct link to Sync plugin manifests")
244
-
245
- Scan your project for plugins and generate `appkit.plugins.json`:
246
-
247
- ```bash
248
- npx @databricks/appkit plugin sync --write
249
-
250
- ```
251
-
252
- This discovers plugin manifests from installed packages and local imports, then writes a consolidated manifest used by deployment tooling. Plugins referenced in your `createApp({ plugins: [...] })` call are automatically marked as required.
253
-
254
- Use the `--silent` flag in build hooks to suppress output:
255
-
256
- ```json
257
- {
258
- "scripts": {
259
- "sync": "appkit plugin sync --write --silent",
260
- "predev": "npm run sync",
261
- "prebuild": "npm run sync"
262
- }
263
- }
264
-
265
- ```
266
-
267
- ### Validate manifests[​](#validate-manifests "Direct link to Validate manifests")
268
-
269
- Check plugin manifests against the JSON schema:
270
-
271
- ```bash
272
- # Validate manifest.json in the current directory
273
- npx @databricks/appkit plugin validate
274
-
275
- # Validate specific files or directories
276
- npx @databricks/appkit plugin validate plugins/my-plugin appkit.plugins.json
277
-
278
- ```
279
-
280
- The validator auto-detects whether a file is a plugin manifest or a template manifest (from `$schema`) and reports errors with humanized paths and expected values.
281
-
282
- ### List plugins[​](#list-plugins "Direct link to List plugins")
283
-
284
- View registered plugins from `appkit.plugins.json` or scan a directory:
285
-
286
- ```bash
287
- # From appkit.plugins.json (default)
288
- npx @databricks/appkit plugin list
289
-
290
- # Scan a directory for plugin folders
291
- npx @databricks/appkit plugin list --dir plugins/
292
-
293
- # JSON output for scripting
294
- npx @databricks/appkit plugin list --json
295
-
296
- ```
297
-
298
- ### Add a resource to a plugin[​](#add-a-resource-to-a-plugin "Direct link to Add a resource to a plugin")
299
-
300
- Interactively add a new resource requirement to an existing plugin manifest:
301
-
302
- ```bash
303
- npx @databricks/appkit plugin add-resource
304
-
305
- # Or specify the plugin directory
306
- npx @databricks/appkit plugin add-resource --path plugins/my-plugin
307
-
308
- ```
309
-
310
- ## Creating custom plugins[​](#creating-custom-plugins "Direct link to Creating custom plugins")
311
-
312
- If you need custom API routes or background logic, implement an AppKit plugin. The fastest way is to use the CLI:
313
-
314
- ```bash
315
- npx @databricks/appkit plugin create
316
-
317
- ```
318
-
319
- For a deeper understanding of the plugin structure, read on.
320
-
321
- ### Basic plugin example[​](#basic-plugin-example "Direct link to Basic plugin example")
322
-
323
- Extend the [`Plugin`](/appkit/docs/api/appkit/Class.Plugin.md) class and export with `toPlugin()`:
324
-
325
- ```typescript
326
- import { Plugin, toPlugin } from "@databricks/appkit";
327
- import type express from "express";
328
-
329
- class MyPlugin extends Plugin {
330
- name = "myPlugin";
331
-
332
- // Define resource requirements in the static manifest
333
- static manifest = {
334
- name: "myPlugin",
335
- displayName: "My Plugin",
336
- description: "A custom plugin",
337
- resources: {
338
- required: [
339
- {
340
- type: "secret",
341
- alias: "apiKey",
342
- resourceKey: "apiKey",
343
- description: "API key for external service",
344
- permission: "READ",
345
- fields: {
346
- scope: { env: "MY_SECRET_SCOPE", description: "Secret scope" },
347
- key: { env: "MY_API_KEY", description: "Secret key name" }
348
- }
349
- }
350
- ],
351
- optional: []
352
- }
353
- };
354
-
355
- async setup() {
356
- // Initialize your plugin
357
- }
358
-
359
- myCustomMethod() {
360
- // Some implementation
361
- }
362
-
363
- async shutdown() {
364
- // Clean up resources
365
- }
366
-
367
- exports() {
368
- // an object with the methods from this plugin to expose
369
- return {
370
- myCustomMethod: this.myCustomMethod
371
- }
372
- }
373
- }
374
-
375
- export const myPlugin = toPlugin<typeof MyPlugin, Record<string, never>, "myPlugin">(
376
- MyPlugin,
377
- "myPlugin",
378
- );
379
-
380
- ```
381
-
382
- ### Config-dependent resources[​](#config-dependent-resources "Direct link to Config-dependent resources")
383
-
384
- The manifest defines resources as either `required` (always needed) or `optional` (may be needed). For resources that become required based on plugin configuration, implement a static `getResourceRequirements(config)` method:
385
-
386
- ```typescript
387
- interface MyPluginConfig extends BasePluginConfig {
388
- enableCaching?: boolean;
389
- }
390
-
391
- class MyPlugin extends Plugin<MyPluginConfig> {
392
- name = "myPlugin";
393
-
394
- static manifest = {
395
- name: "myPlugin",
396
- displayName: "My Plugin",
397
- description: "A plugin with optional caching",
398
- resources: {
399
- required: [
400
- { type: "sql_warehouse", alias: "warehouse", resourceKey: "sqlWarehouse", description: "Query execution", permission: "CAN_USE", fields: { id: { env: "DATABRICKS_WAREHOUSE_ID" } } }
401
- ],
402
- optional: [
403
- // Listed as optional in manifest for static analysis
404
- { type: "database", alias: "cache", resourceKey: "cache", description: "Query result caching (if enabled)", permission: "CAN_CONNECT_AND_CREATE", fields: { instance_name: { env: "DATABRICKS_CACHE_INSTANCE" }, database_name: { env: "DATABRICKS_CACHE_DB" } } }
405
- ]
406
- }
407
- };
408
-
409
- // Runtime: Convert optional resources to required based on config
410
- static getResourceRequirements(config: MyPluginConfig) {
411
- const resources = [];
412
- if (config.enableCaching) {
413
- // When caching is enabled, Database becomes required
414
- resources.push({
415
- type: "database",
416
- alias: "cache",
417
- resourceKey: "cache",
418
- description: "Query result caching",
419
- permission: "CAN_CONNECT_AND_CREATE",
420
- fields: {
421
- instance_name: { env: "DATABRICKS_CACHE_INSTANCE" },
422
- database_name: { env: "DATABRICKS_CACHE_DB" },
423
- },
424
- required: true // Mark as required at runtime
425
- });
426
- }
427
- return resources;
428
- }
429
- }
430
-
431
- ```
432
-
433
- This pattern allows:
434
-
435
- * **Static tools** (CLI, docs) to show all possible resources
436
- * **Runtime validation** to enforce resources based on actual configuration
437
-
438
- ### Key extension points[​](#key-extension-points "Direct link to Key extension points")
439
-
440
- * **Route injection**: Implement `injectRoutes()` to add custom endpoints using [`IAppRouter`](/appkit/docs/api/appkit/TypeAlias.IAppRouter.md)
441
-
442
- * **Lifecycle hooks**: Override `setup()`, and `shutdown()` methods
443
-
444
- * **Shared services**:
445
-
446
- <!-- -->
447
-
448
- * **Cache management**: Access the cache service via `this.cache`. See [`CacheConfig`](/appkit/docs/api/appkit/Interface.CacheConfig.md) for configuration.
449
- * **Telemetry**: Instrument your plugin with traces and metrics via `this.telemetry`. See [`ITelemetry`](/appkit/docs/api/appkit/Interface.ITelemetry.md).
450
-
451
- * **Execution interceptors**: Use `execute()` and `executeStream()` with [`StreamExecutionSettings`](/appkit/docs/api/appkit/Interface.StreamExecutionSettings.md)
452
-
453
- **Consuming your plugin programmatically**
454
-
455
- Optionally, you may want to provide a way to consume your plugin programmatically using the AppKit object. To do that, your plugin needs to implement the `exports` method, returning an object with the methods you want to expose. From the previous example, the plugin could be consumed as follows:
456
-
457
- ```ts
458
- const AppKit = await createApp({
459
- plugins: [
460
- server({ port: 8000 }),
461
- analytics(),
462
- myPlugin(),
463
- ],
464
- });
465
-
466
- AppKit.myPlugin.myCustomMethod();
467
-
468
- ```
469
-
470
- See the [`Plugin`](/appkit/docs/api/appkit/Class.Plugin.md) API reference for complete documentation.
471
-
472
- ## Caching[​](#caching "Direct link to Caching")
473
-
474
- AppKit provides both global and plugin-level caching capabilities.
475
-
476
- ### Global cache configuration[​](#global-cache-configuration "Direct link to Global cache configuration")
477
-
478
- ```ts
479
- await createApp({
480
- plugins: [server(), analytics({})],
481
- cache: {
482
- enabled: true,
483
- ttl: 3600, // seconds
484
- strictPersistence: false,
485
- },
486
- });
487
-
488
- ```
489
-
490
- Storage auto-selects **Lakebase V1 (Provisioned) persistent cache when healthy**, otherwise falls back to in-memory. Support for Lakebase Autoscaling coming soon.
491
-
492
- ### Plugin-level caching[​](#plugin-level-caching "Direct link to Plugin-level caching")
493
-
494
- Inside a Plugin subclass:
495
-
496
- ```ts
497
- const value = await this.cache.getOrExecute(
498
- ["myPlugin", "data", userId],
499
- async () => expensiveWork(),
500
- userKey,
501
- { ttl: 300 },
502
- );
503
-
504
- ```
505
-
506
25
  ## Plugin phases[​](#plugin-phases "Direct link to Plugin phases")
507
26
 
508
27
  Plugins initialize in three phases:
package/llms.txt CHANGED
@@ -148,3 +148,10 @@ The CLI will display the documentation content directly in the terminal.
148
148
  - [Remote Bridge](./docs/docs/development/remote-bridge.md): 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.
149
149
  - [Type generation](./docs/docs/development/type-generation.md): AppKit can automatically generate TypeScript types for your SQL queries, providing end-to-end type safety from database to UI.
150
150
  - [Plugins](./docs/docs/plugins.md): Plugins are modular extensions that add capabilities to your AppKit application. They follow a defined lifecycle and have access to shared services like caching, telemetry, and streaming.
151
+ - [Analytics plugin](./docs/docs/plugins/analytics.md): Enables SQL query execution against Databricks SQL Warehouses.
152
+ - [Caching](./docs/docs/plugins/caching.md): AppKit provides both global and plugin-level caching capabilities.
153
+ - [Creating custom plugins](./docs/docs/plugins/custom-plugins.md): If you need custom API routes or background logic, implement an AppKit plugin. The fastest way is to use the CLI:
154
+ - [Execution context](./docs/docs/plugins/execution-context.md): AppKit manages Databricks authentication via two contexts:
155
+ - [Lakebase plugin](./docs/docs/plugins/lakebase.md): Currently, the Lakebase plugin currently requires a one-time manual setup to connect your Databricks App with your Lakebase database. An automated setup process is planned for an upcoming future release.
156
+ - [Plugin management](./docs/docs/plugins/plugin-management.md): AppKit includes a CLI for managing plugins. All commands are available under npx @databricks/appkit plugin.
157
+ - [Server plugin](./docs/docs/plugins/server.md): Provides HTTP server capabilities with development and production modes.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@databricks/appkit-ui",
3
3
  "type": "module",
4
- "version": "0.10.1",
4
+ "version": "0.11.1",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/databricks/appkit.git"