UNPKG

1.66 kBTypeScriptView Raw
1import { HookContextData, HookManager, Middleware } from '@feathersjs/hooks';
2import { Service, ServiceOptions, HookContext, FeathersService, HookMap, AroundHookFunction, HookFunction } from './declarations';
3type HookStore = {
4 around: {
5 [method: string]: AroundHookFunction[];
6 };
7 before: {
8 [method: string]: HookFunction[];
9 };
10 after: {
11 [method: string]: HookFunction[];
12 };
13 error: {
14 [method: string]: HookFunction[];
15 };
16 collected: {
17 [method: string]: AroundHookFunction[];
18 };
19 collectedAll: {
20 before?: AroundHookFunction[];
21 after?: AroundHookFunction[];
22 };
23};
24type HookEnabled = {
25 __hooks: HookStore;
26};
27export declare function convertHookData(input: any): {
28 [method: string]: AroundHookFunction[] | HookFunction[];
29};
30export declare function collectHooks(target: HookEnabled, method: string): AroundHookFunction[];
31export declare function enableHooks(object: any): (this: HookEnabled, input: HookMap<any, any>) => HookEnabled;
32export declare function createContext(service: Service, method: string, data?: HookContextData): HookContext;
33export declare class FeathersHookManager<A> extends HookManager {
34 app: A;
35 method: string;
36 constructor(app: A, method: string);
37 collectMiddleware(self: any, args: any[]): Middleware[];
38 initializeContext(self: any, args: any[], context: HookContext): import("@feathersjs/hooks").HookContext<any, any>;
39 middleware(mw: Middleware[]): this;
40}
41export declare function hookMixin<A>(this: A, service: FeathersService<A>, path: string, options: ServiceOptions): FeathersService<A>;
42export {};