mirror of
https://github.com/versia-pub/server.git
synced 2026-03-13 05:49:16 +01:00
feat(plugin): ✨ Add dynamic plugin and manifest loader
This commit is contained in:
parent
f623f2c1a0
commit
d224d7b9b8
9 changed files with 451 additions and 9 deletions
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue