Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
55 changes: 54 additions & 1 deletion docs/docs/api/appkit/Class.Plugin.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,52 @@
# Abstract Class: Plugin\<TConfig\>

Base abstract class for creating AppKit plugins
Base abstract class for creating AppKit plugins.

All plugins must declare a static `manifest` property with their metadata
and resource requirements. Plugins can also implement a static
`getResourceRequirements()` method for dynamic requirements based on config.

## Example

```typescript
import { Plugin, toPlugin, PluginManifest, ResourceType } from '@databricks/appkit';

// Define manifest (required)
const myManifest: PluginManifest = {
name: 'myPlugin',
displayName: 'My Plugin',
description: 'Does something awesome',
resources: {
required: [
{
type: ResourceType.SQL_WAREHOUSE,
alias: 'warehouse',
description: 'SQL Warehouse for queries',
permission: 'CAN_USE',
env: 'DATABRICKS_WAREHOUSE_ID'
}
],
optional: []
}
};

class MyPlugin extends Plugin<MyConfig> {
static manifest = myManifest; // Required!

name = 'myPlugin';
protected envVars: string[] = [];

async setup() {
// Initialize your plugin
}

injectRoutes(router: Router) {
// Register HTTP endpoints
}
}

export const myPlugin = toPlugin(MyPlugin, 'myPlugin');
```

## Type Parameters

Expand Down Expand Up @@ -86,6 +132,8 @@ protected isReady: boolean = false;
name: string;
```

Plugin name identifier.

#### Implementation of

```ts
Expand Down Expand Up @@ -116,6 +164,11 @@ protected telemetry: ITelemetry;
static phase: PluginPhase = "normal";
```

Plugin initialization phase.
- 'core': Initialized first (e.g., config plugins)
- 'normal': Initialized second (most plugins)
- 'deferred': Initialized last (e.g., server plugin)

## Methods

### abortActiveOperations()
Expand Down
73 changes: 73 additions & 0 deletions docs/docs/api/appkit/Enumeration.ResourceType.md
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something went wrong with displaying an icon near to the enum in the docs - it falls-back to the "other" category, but it should use enum:

.api-kind-enum .menu__link::before {
border-color: var(--api-kind-enum-color);
color: var(--api-kind-enum-color);
content: "E";
}

appkit/docs/sidebars.ts

Lines 35 to 46 in b70ea1c

for (const subItem of item.items) {
// Extract kind from the id (e.g., "Function." from "api/appkit/Function.name")
// To get "function", "class", "interface", etc.
const idParts = subItem.id.split("/").pop() || "";
const rawKind = idParts.split(".")[0].toLowerCase();
const kind = SUPPORTED_KINDS.has(rawKind) ? rawKind : "other";
flatItems.push({
...subItem,
className: `api-kind-${kind}`,
});
}

Could you please check? maybe it's just named "enumeration" or sth, and the fix will be easy. Thanks!

image

Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# Enumeration: ResourceType

Supported Databricks resource types that plugins can depend on.

## Enumeration Members

### JOB

```ts
JOB: "job";
```

Databricks Job for scheduled or triggered workflows

***

### LAKEBASE

```ts
LAKEBASE: "lakebase";
```

Lakebase instance for persistent caching or data storage

***

### SECRET\_SCOPE

```ts
SECRET_SCOPE: "secret-scope";
```

Secret scope for secure credential storage

***

### SERVING\_ENDPOINT

```ts
SERVING_ENDPOINT: "serving-endpoint";
```

Model serving endpoint for ML inference

***

### SQL\_WAREHOUSE

```ts
SQL_WAREHOUSE: "sql-warehouse";
```

Databricks SQL Warehouse for query execution

***

### UNITY\_CATALOG

```ts
UNITY_CATALOG: "unity-catalog";
```

Unity Catalog for data governance and metadata

***

### VECTOR\_SEARCH\_INDEX

```ts
VECTOR_SEARCH_INDEX: "vector-search-index";
```

Vector search index for similarity search
36 changes: 36 additions & 0 deletions docs/docs/api/appkit/Function.getPluginManifest.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Function: getPluginManifest()

```ts
function getPluginManifest(plugin: PluginConstructor): PluginManifest;
```

Loads and validates the manifest from a plugin constructor.

All plugins must have a static `manifest` property that declares their
metadata and resource requirements.

## Parameters

| Parameter | Type | Description |
| ------ | ------ | ------ |
| `plugin` | `PluginConstructor` | The plugin constructor class |

## Returns

[`PluginManifest`](Interface.PluginManifest.md)

The validated plugin manifest

## Throws

If the manifest is missing or invalid

## Example

```typescript
import { AnalyticsPlugin } from '@databricks/appkit';
import { getPluginManifest } from './manifest-loader';

const manifest = getPluginManifest(AnalyticsPlugin);
console.log('Required resources:', manifest.resources.required);
```
40 changes: 40 additions & 0 deletions docs/docs/api/appkit/Function.getResourceRequirements.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Function: getResourceRequirements()

```ts
function getResourceRequirements(plugin: PluginConstructor): {
alias: string;
description: string;
env?: string;
permission: ResourcePermission;
required: boolean;
type: ResourceType;
}[];
```

Gets the resource requirements from a plugin's manifest.

Combines required and optional resources into a single array with the
`required` flag set appropriately.

## Parameters

| Parameter | Type | Description |
| ------ | ------ | ------ |
| `plugin` | `PluginConstructor` | The plugin constructor class |

## Returns

Combined array of required and optional resources

## Throws

If the plugin manifest is missing or invalid

## Example

```typescript
const resources = getResourceRequirements(AnalyticsPlugin);
for (const resource of resources) {
console.log(`${resource.type}: ${resource.description} (required: ${resource.required})`);
}
```
52 changes: 52 additions & 0 deletions docs/docs/api/appkit/Interface.ConfigSchema.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Interface: ConfigSchema

Configuration schema definition for plugin config.
Uses JSON Schema format for validation and documentation.

## Indexable

```ts
[key: string]: unknown
```

Allow additional JSON Schema properties

## Properties

### additionalProperties?

```ts
optional additionalProperties: boolean;
```

***

### items?

```ts
optional items: ConfigSchema;
```

***

### properties?

```ts
optional properties: Record<string, ConfigSchemaProperty>;
```

***

### required?

```ts
optional required: string[];
```

***

### type

```ts
type: "string" | "number" | "boolean" | "object" | "array";
```
83 changes: 83 additions & 0 deletions docs/docs/api/appkit/Interface.ConfigSchemaProperty.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# Interface: ConfigSchemaProperty

Individual property definition in a config schema.

## Properties

### default?

```ts
optional default: unknown;
```

***

### description?

```ts
optional description: string;
```

***

### enum?

```ts
optional enum: unknown[];
```

***

### items?

```ts
optional items: ConfigSchemaProperty;
```

***

### maximum?

```ts
optional maximum: number;
```

***

### maxLength?

```ts
optional maxLength: number;
```

***

### minimum?

```ts
optional minimum: number;
```

***

### minLength?

```ts
optional minLength: number;
```

***

### properties?

```ts
optional properties: Record<string, ConfigSchemaProperty>;
```

***

### type

```ts
type: "string" | "number" | "boolean" | "object" | "array";
```
Loading