import { ErrorObject } from '../error.js'; import { svc } from '../service.js'; import { GreenDotAppConfig } from '../types/appConfig.types.js'; import { GenericDef } from '../lib/good-cop/index-backend.js'; export declare abstract class GDplugin { abstract readonly name: Name; /** Will register those services into the app and SDK and eventually expose configured routes */ serviceToRegister: Record>; onInit?: () => any; handlers: GDpluginHandlers[]; addUserAdditionalFields?(): Record; /** Use this to register new errors to use via ctx.error.myCustomError * * Don't forget to also put that code at the end of your plugin * ``` * declare global { * interface GreenDotErrors extends RegisterErrorType { } * } * ``` */ errors?: ErrorObject; } export type GDpluginHandlers = { /** The lower, the prior. From 0 to 100 */ priority?: number; } & ({ event: 'onLogin'; callback: GreenDotAppConfig['onBeforeLoginCallback']; }); export type GDpluginHandlerEventNames = GDpluginHandlers['event'];