Plugin metadata (name, description, documentation, tags, etc.)
AnyVali validation schema for the plugin configuration
A Config class that extends BSBPluginConfig with metadata
// v9 pattern:
const TodoConfigSchema = av.object({
database: av.object({
// .default() makes the key optional in config files while keeping the
// inferred type non-optional. Only wrap in av.optional() when there is
// no default and the field may genuinely be absent.
host: av.string().default('localhost'),
port: av.int32().default(5432),
}),
});
export const Config = createConfigSchema(
{
name: 'service-demo-todo',
description: 'Demo Todo Service',
tags: ['demo', 'todo', 'example'],
},
TodoConfigSchema
);
// Usage in plugin:
export class Plugin extends BSBService<InstanceType<typeof Config>, typeof EventSchemas> {
static Config = Config; // Required for auto-generation
}
Helper function to create a typed plugin configuration class with metadata.
v9 Breaking Change: This replaces the manual Config class pattern. Instead of extending BSBPluginConfig directly, use this helper to create a Config class with built-in metadata support.
The metadata is used to:
Plugin metadata (name, description, documentation, tags, etc.)
A Config class that extends BSBPluginConfig with metadata
// v9 pattern:
const TodoConfigSchema = av.object({
database: av.object({
// .default() makes the key optional in config files while keeping the
// inferred type non-optional. Only wrap in av.optional() when there is
// no default and the field may genuinely be absent.
host: av.string().default('localhost'),
port: av.int32().default(5432),
}),
});
export const Config = createConfigSchema(
{
name: 'service-demo-todo',
description: 'Demo Todo Service',
tags: ['demo', 'todo', 'example'],
},
TodoConfigSchema
);
// Usage in plugin:
export class Plugin extends BSBService<InstanceType<typeof Config>, typeof EventSchemas> {
static Config = Config; // Required for auto-generation
}
Helper function to create a typed plugin configuration class with metadata.
v9 Breaking Change: This replaces the manual Config class pattern. Instead of extending BSBPluginConfig directly, use this helper to create a Config class with built-in metadata support.
The metadata is used to: