@accounts/mikro-orm
Version:
MikroORM adaptor for accounts
24 lines (23 loc) • 1.2 kB
TypeScript
import { type Ref, EntitySchema } from '@mikro-orm/core';
import { type IUser, type UserCtor } from './User';
export declare class Service<CustomUser extends IUser<any, any, any>> {
id: number;
user: Ref<CustomUser>;
name: string;
token?: string;
options?: object;
constructor({ name, user, password }: ServiceCtorArgs<CustomUser>);
}
export type ServiceCtorArgs<CustomUser extends IUser<any, any, any>> = {
name: string;
user?: CustomUser;
password?: string;
};
export type ServiceCtor<CustomUser extends IUser<any, any, any>, CustomServiceCtorArgs extends ServiceCtorArgs<CustomUser> = ServiceCtorArgs<CustomUser>> = new (args: CustomServiceCtorArgs) => Service<CustomUser>;
export declare const getServiceCtor: <CustomUser extends IUser<any, any, any>, CustomServiceCtorArgs extends ServiceCtorArgs<CustomUser> = ServiceCtorArgs<CustomUser>>({ abstract, }?: {
abstract?: boolean | undefined;
}) => ServiceCtor<CustomUser, CustomServiceCtorArgs>;
export declare const getServiceSchema: ({ UserEntity, abstract, }?: {
UserEntity?: UserCtor<any, any, any, any> | undefined;
abstract?: boolean | undefined;
}) => EntitySchema<Service<any>, never>;