Skip to content
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,6 @@ coverage
*.tsbuildinfo

.turbo

# AppKit type generator caches
.databricks
114 changes: 114 additions & 0 deletions apps/dev-playground/client/src/appKitServingTypes.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
// Auto-generated by AppKit - DO NOT EDIT
// Generated from serving endpoint OpenAPI schemas
import "@databricks/appkit";
import "@databricks/appkit-ui/react";

declare module "@databricks/appkit" {
interface ServingEndpointRegistry {
default: {
request: {
messages?: {
role?: "user" | "assistant";
content?: string;
}[];
/** @openapi integer, nullable */
n?: number | null;
max_tokens?: number;
/** @openapi double, nullable */
top_p?: number | null;
reasoning_effort?: "low" | "medium" | "high" | null;
/** @openapi double, nullable */
temperature?: number | null;
stop?: string | string[] | null;
};
response: {
model?: string;
choices?: {
index?: number;
message?: {
role?: "user" | "assistant";
content?: string;
};
finish_reason?: string;
}[];
usage?: {
prompt_tokens?: number;
completion_tokens?: number;
total_tokens?: number;
} | null;
object?: string;
id?: string;
created?: number;
};
chunk: {
model?: string;
choices?: {
index?: number;
delta?: {
role?: "user" | "assistant";
content?: string;
};
finish_reason?: string | null;
}[];
object?: string;
id?: string;
created?: number;
};
};
}
}

declare module "@databricks/appkit-ui/react" {
interface ServingEndpointRegistry {
default: {
request: {
messages?: {
role?: "user" | "assistant";
content?: string;
}[];
/** @openapi integer, nullable */
n?: number | null;
max_tokens?: number;
/** @openapi double, nullable */
top_p?: number | null;
reasoning_effort?: "low" | "medium" | "high" | null;
/** @openapi double, nullable */
temperature?: number | null;
stop?: string | string[] | null;
};
response: {
model?: string;
choices?: {
index?: number;
message?: {
role?: "user" | "assistant";
content?: string;
};
finish_reason?: string;
}[];
usage?: {
prompt_tokens?: number;
completion_tokens?: number;
total_tokens?: number;
} | null;
object?: string;
id?: string;
created?: number;
};
chunk: {
model?: string;
choices?: {
index?: number;
delta?: {
role?: "user" | "assistant";
content?: string;
};
finish_reason?: string | null;
}[];
object?: string;
id?: string;
created?: number;
};
};
}
}
24 changes: 24 additions & 0 deletions docs/docs/api/appkit/Function.appKitServingTypesPlugin.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Function: appKitServingTypesPlugin()

```ts
function appKitServingTypesPlugin(options?: AppKitServingTypesPluginOptions): Plugin$1;
```

Vite plugin to generate TypeScript types for AppKit serving endpoints.
Fetches OpenAPI schemas from Databricks and generates a .d.ts with
ServingEndpointRegistry module augmentation.

Endpoint discovery order:
1. Explicit `endpoints` option (override)
2. AST extraction from server file (server/index.ts or server/server.ts)
3. DATABRICKS_SERVING_ENDPOINT_NAME env var (single default endpoint)

## Parameters

| Parameter | Type |
| ------ | ------ |
| `options?` | `AppKitServingTypesPluginOptions` |

## Returns

`Plugin$1`
24 changes: 24 additions & 0 deletions docs/docs/api/appkit/Function.extractServingEndpoints.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Function: extractServingEndpoints()

```ts
function extractServingEndpoints(serverFilePath: string):
| Record<string, EndpointConfig>
| null;
```

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.

## Parameters

| Parameter | Type | Description |
| ------ | ------ | ------ |
| `serverFilePath` | `string` | Absolute path to the server entry file |

## Returns

\| `Record`\<`string`, [`EndpointConfig`](Interface.EndpointConfig.md)\>
\| `null`

Extracted endpoint config, or null if not found or not extractable
19 changes: 19 additions & 0 deletions docs/docs/api/appkit/Function.findServerFile.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Function: findServerFile()

```ts
function findServerFile(basePath: string): string | null;
```

Find the server entry file by checking candidate paths in order.

## Parameters

| Parameter | Type | Description |
| ------ | ------ | ------ |
| `basePath` | `string` | Project root directory to search from |

## Returns

`string` \| `null`

Absolute path to the server file, or null if none found
3 changes: 3 additions & 0 deletions docs/docs/api/appkit/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,12 @@ plugin architecture, and React integration.

| Function | Description |
| ------ | ------ |
| [appKitServingTypesPlugin](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. |
| [appKitTypesPlugin](Function.appKitTypesPlugin.md) | Vite plugin to generate types for AppKit queries. Calls generateFromEntryPoint under the hood. |
| [createApp](Function.createApp.md) | Bootstraps AppKit with the provided configuration. |
| [createLakebasePool](Function.createLakebasePool.md) | Create a Lakebase pool with appkit's logger integration. Telemetry automatically uses appkit's OpenTelemetry configuration via global registry. |
| [extractServingEndpoints](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. |
| [findServerFile](Function.findServerFile.md) | Find the server entry file by checking candidate paths in order. |
| [generateDatabaseCredential](Function.generateDatabaseCredential.md) | Generate OAuth credentials for Postgres database connection using the proper Postgres API. |
| [getExecutionContext](Function.getExecutionContext.md) | Get the current execution context. |
| [getLakebaseOrmConfig](Function.getLakebaseOrmConfig.md) | Get Lakebase connection configuration for ORMs that don't accept pg.Pool directly. |
Expand Down
15 changes: 15 additions & 0 deletions docs/docs/api/appkit/typedoc-sidebar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,11 @@ const typedocSidebar: SidebarsConfig = {
type: "category",
label: "Functions",
items: [
{
type: "doc",
id: "api/appkit/Function.appKitServingTypesPlugin",
label: "appKitServingTypesPlugin"
},
{
type: "doc",
id: "api/appkit/Function.appKitTypesPlugin",
Expand All @@ -240,6 +245,16 @@ const typedocSidebar: SidebarsConfig = {
id: "api/appkit/Function.createLakebasePool",
label: "createLakebasePool"
},
{
type: "doc",
id: "api/appkit/Function.extractServingEndpoints",
label: "extractServingEndpoints"
},
{
type: "doc",
id: "api/appkit/Function.findServerFile",
label: "findServerFile"
},
{
type: "doc",
id: "api/appkit/Function.generateDatabaseCredential",
Expand Down
Loading
Loading