openWa / src /modules /plugins /dto /plugin.dto.ts
harsh
Deploy: Initial commit without binaries
525d39f
Raw History Blame Contribute Delete
1.63 kB
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
import { IsObject } from 'class-validator';
import type { PluginConfigSchema } from '../../../core/plugins';
import { PluginType, PluginStatus } from '../../../core/plugins';
export class PluginDto {
@ApiProperty({ description: 'Plugin ID' })
id!: string;
@ApiProperty({ description: 'Plugin name' })
name!: string;
@ApiProperty({ description: 'Plugin version' })
version!: string;
@ApiProperty({ enum: PluginType, description: 'Plugin type' })
type!: PluginType;
@ApiPropertyOptional({ description: 'Plugin description' })
description?: string;
@ApiPropertyOptional({ description: 'Plugin author' })
author?: string;
@ApiProperty({ enum: PluginStatus, description: 'Plugin status' })
status!: PluginStatus;
@ApiProperty({ description: 'Plugin configuration' })
config!: Record<string, unknown>;
@ApiProperty({ description: 'Whether this is a built-in plugin' })
builtIn!: boolean;
@ApiProperty({ description: 'Features provided by this plugin' })
provides!: string[];
@ApiPropertyOptional({ description: 'Configuration schema' })
configSchema?: PluginConfigSchema;
@ApiPropertyOptional({ description: 'When the plugin was loaded' })
loadedAt?: string;
@ApiPropertyOptional({ description: 'When the plugin was enabled' })
enabledAt?: string;
@ApiPropertyOptional({ description: 'Error message if plugin is in error state' })
error?: string;
}
export class PluginConfigDto {
@ApiProperty({ description: 'Plugin configuration object' })
@IsObject()
config!: Record<string, unknown>;
}