1 | import type { Aggregate, Query } from 'mongoose';
|
2 | import { mongoose } from './typegoose';
|
3 | import type { DocumentType, EmptyVoidFn } from './types';
|
4 | declare type NumberOrDocumentOrDocumentArray<T> = number | DocumentType<T> | DocumentType<T>[];
|
5 | declare type ReturnVoid = void | Promise<void>;
|
6 | declare type HookNextErrorFn = (err?: Error) => ReturnVoid;
|
7 | declare type PreFnWithAggregate<T> = (this: Aggregate<T>, next: (error?: Error) => ReturnVoid) => ReturnVoid;
|
8 | declare type PreFnWithDocumentType<T> = (this: DocumentType<T>, next: HookNextErrorFn) => ReturnVoid;
|
9 | declare type PreFnWithQuery<T> = (this: Query<any, DocumentType<T>>, next: (error?: Error) => ReturnVoid) => ReturnVoid;
|
10 | declare type ModelPostFn<T> = (result: any, next: EmptyVoidFn) => ReturnVoid;
|
11 | declare type PostNumberResponse<T> = (result: number, next: EmptyVoidFn) => ReturnVoid;
|
12 | declare type PostSingleResponse<T> = (result: DocumentType<T>, next: EmptyVoidFn) => ReturnVoid;
|
13 | declare type PostMultipleResponse<T> = (result: DocumentType<T>[], next: EmptyVoidFn) => ReturnVoid;
|
14 | declare type PostRegExpResponse<T> = (result: NumberOrDocumentOrDocumentArray<T>, next: EmptyVoidFn) => ReturnVoid;
|
15 | declare type PostArrayResponse<T> = (result: NumberOrDocumentOrDocumentArray<T>, next: EmptyVoidFn) => ReturnVoid;
|
16 | declare type PostQueryArrayResponse<T> = (this: Query<any, DocumentType<T>>, result: NumberOrDocumentOrDocumentArray<T>, next: EmptyVoidFn) => ReturnVoid;
|
17 | declare type PostNumberWithError<T> = (error: Error, result: number, next: HookNextErrorFn) => ReturnVoid;
|
18 | declare type PostSingleWithError<T> = (error: Error, result: DocumentType<T>, next: HookNextErrorFn) => ReturnVoid;
|
19 | declare type PostMultipleWithError<T> = (error: Error, result: DocumentType<T>[], next: HookNextErrorFn) => ReturnVoid;
|
20 | declare type PostRegExpWithError<T> = (error: Error, result: NumberOrDocumentOrDocumentArray<T>, next: HookNextErrorFn) => ReturnVoid;
|
21 | declare type PostArrayWithError<T> = (error: Error, result: NumberOrDocumentOrDocumentArray<T>, next: EmptyVoidFn) => ReturnVoid;
|
22 | declare type PostQueryArrayWithError<T> = (this: Query<any, DocumentType<T>>, error: Error, result: NumberOrDocumentOrDocumentArray<T>, next: EmptyVoidFn) => ReturnVoid;
|
23 | declare type AggregateMethod = 'aggregate';
|
24 | declare type DocumentMethod = 'init' | 'validate' | 'save' | 'remove';
|
25 | declare type NumberMethod = 'count';
|
26 | declare type SingleMethod = 'findOne' | 'findOneAndRemove' | 'findOneAndUpdate' | 'findOneAndDelete' | 'deleteOne' | DocumentMethod;
|
27 | declare type MultipleMethod = 'find' | 'update' | 'deleteMany' | 'aggregate';
|
28 | declare type QueryMethod = 'count' | 'countDocuments' | 'estimatedDocumentCount' | 'find' | 'findOne' | 'findOneAndRemove' | 'findOneAndUpdate' | 'update' | 'updateOne' | 'updateMany' | 'findOneAndDelete' | 'deleteOne' | 'deleteMany';
|
29 | declare type ModelMethod = 'insertMany';
|
30 | declare type QMR = QueryMethod | ModelMethod | RegExp;
|
31 | declare type DR = DocumentMethod | RegExp;
|
32 | export declare const pre: {
|
33 | <T>(method: AggregateMethod, fn: PreFnWithAggregate<T>, options?: mongoose.MiddlewareOptions | undefined): ClassDecorator;
|
34 | <T_1>(method: DR | DR[], fn: PreFnWithDocumentType<T_1>, options?: mongoose.MiddlewareOptions | undefined): ClassDecorator;
|
35 | <T_2>(method: QMR | QMR[], fn: PreFnWithQuery<T_2>, options?: mongoose.MiddlewareOptions | undefined): ClassDecorator;
|
36 | };
|
37 | export declare const post: {
|
38 | <T>(method: RegExp, fn: PostRegExpResponse<T>, options?: mongoose.MiddlewareOptions | undefined): ClassDecorator;
|
39 | <T_1>(method: RegExp, fn: PostRegExpWithError<T_1>, options?: mongoose.MiddlewareOptions | undefined): ClassDecorator;
|
40 | <T_2>(method: NumberMethod, fn: PostNumberResponse<T_2>, options?: mongoose.MiddlewareOptions | undefined): ClassDecorator;
|
41 | <T_3>(method: NumberMethod, fn: PostNumberWithError<T_3>, options?: mongoose.MiddlewareOptions | undefined): ClassDecorator;
|
42 | <T_4>(method: SingleMethod, fn: PostSingleResponse<T_4>, options?: mongoose.MiddlewareOptions | undefined): ClassDecorator;
|
43 | <T_5>(method: SingleMethod, fn: PostSingleWithError<T_5>, options?: mongoose.MiddlewareOptions | undefined): ClassDecorator;
|
44 | <T_6>(method: MultipleMethod, fn: PostMultipleResponse<T_6>, options?: mongoose.MiddlewareOptions | undefined): ClassDecorator;
|
45 | <T_7>(method: MultipleMethod, fn: PostMultipleWithError<T_7>, options?: mongoose.MiddlewareOptions | undefined): ClassDecorator;
|
46 | <T_8>(method: ModelMethod, fn: ModelPostFn<T_8> | PostMultipleResponse<T_8>, options?: mongoose.MiddlewareOptions | undefined): ClassDecorator;
|
47 | <T_9>(method: DocumentMethod | DocumentMethod[], fn: PostArrayResponse<T_9>, options?: mongoose.MiddlewareOptions | undefined): ClassDecorator;
|
48 | <T_10>(method: DocumentMethod | DocumentMethod[], fn: PostArrayWithError<T_10>, options?: mongoose.MiddlewareOptions | undefined): ClassDecorator;
|
49 | <T_11>(method: QMR | QMR[], fn: PostQueryArrayResponse<T_11>, options?: mongoose.MiddlewareOptions | undefined): ClassDecorator;
|
50 | <T_12>(method: QMR | QMR[], fn: PostQueryArrayWithError<T_12>, options?: mongoose.MiddlewareOptions | undefined): ClassDecorator;
|
51 | };
|
52 | export declare const Pre: {
|
53 | <T>(method: AggregateMethod, fn: PreFnWithAggregate<T>, options?: mongoose.MiddlewareOptions | undefined): ClassDecorator;
|
54 | <T_1>(method: DR | DR[], fn: PreFnWithDocumentType<T_1>, options?: mongoose.MiddlewareOptions | undefined): ClassDecorator;
|
55 | <T_2>(method: QMR | QMR[], fn: PreFnWithQuery<T_2>, options?: mongoose.MiddlewareOptions | undefined): ClassDecorator;
|
56 | };
|
57 | export declare const Post: {
|
58 | <T>(method: RegExp, fn: PostRegExpResponse<T>, options?: mongoose.MiddlewareOptions | undefined): ClassDecorator;
|
59 | <T_1>(method: RegExp, fn: PostRegExpWithError<T_1>, options?: mongoose.MiddlewareOptions | undefined): ClassDecorator;
|
60 | <T_2>(method: NumberMethod, fn: PostNumberResponse<T_2>, options?: mongoose.MiddlewareOptions | undefined): ClassDecorator;
|
61 | <T_3>(method: NumberMethod, fn: PostNumberWithError<T_3>, options?: mongoose.MiddlewareOptions | undefined): ClassDecorator;
|
62 | <T_4>(method: SingleMethod, fn: PostSingleResponse<T_4>, options?: mongoose.MiddlewareOptions | undefined): ClassDecorator;
|
63 | <T_5>(method: SingleMethod, fn: PostSingleWithError<T_5>, options?: mongoose.MiddlewareOptions | undefined): ClassDecorator;
|
64 | <T_6>(method: MultipleMethod, fn: PostMultipleResponse<T_6>, options?: mongoose.MiddlewareOptions | undefined): ClassDecorator;
|
65 | <T_7>(method: MultipleMethod, fn: PostMultipleWithError<T_7>, options?: mongoose.MiddlewareOptions | undefined): ClassDecorator;
|
66 | <T_8>(method: ModelMethod, fn: ModelPostFn<T_8> | PostMultipleResponse<T_8>, options?: mongoose.MiddlewareOptions | undefined): ClassDecorator;
|
67 | <T_9>(method: DocumentMethod | DocumentMethod[], fn: PostArrayResponse<T_9>, options?: mongoose.MiddlewareOptions | undefined): ClassDecorator;
|
68 | <T_10>(method: DocumentMethod | DocumentMethod[], fn: PostArrayWithError<T_10>, options?: mongoose.MiddlewareOptions | undefined): ClassDecorator;
|
69 | <T_11>(method: QMR | QMR[], fn: PostQueryArrayResponse<T_11>, options?: mongoose.MiddlewareOptions | undefined): ClassDecorator;
|
70 | <T_12>(method: QMR | QMR[], fn: PostQueryArrayWithError<T_12>, options?: mongoose.MiddlewareOptions | undefined): ClassDecorator;
|
71 | };
|
72 | export {};
|