feat(plugin): Add dynamic plugin and manifest loader

This commit is contained in:
Jesse Wierzbinski 2024-09-23 11:51:15 +02:00
parent f623f2c1a0
commit d224d7b9b8
No known key found for this signature in database
9 changed files with 451 additions and 9 deletions

View file

@ -55,9 +55,9 @@ export class Plugin<ConfigSchema extends z.ZodTypeAny> {
* This will be called when the plugin is loaded.
* @param config Values the user has set in the configuration file.
*/
protected _loadConfig(config: z.input<ConfigSchema>) {
protected _loadConfig(config: z.input<ConfigSchema>): Promise<void> {
// biome-ignore lint/complexity/useLiteralKeys: Private method
this.configManager["_load"](config);
return this.configManager["_load"](config);
}
protected _addToApp(app: OpenAPIHono<HonoEnv>) {
@ -117,7 +117,7 @@ export class PluginConfigManager<Schema extends z.ZodTypeAny> {
try {
this.store = await this.schema.parseAsync(config);
} catch (error) {
throw fromZodError(error as ZodError);
throw fromZodError(error as ZodError).message;
}
}