-
Notifications
You must be signed in to change notification settings - Fork 0
/
ambient.d.ts
95 lines (86 loc) · 3.59 KB
/
ambient.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
// eslint-disable-next-line @typescript-eslint/triple-slash-reference
/// <reference path="./node_modules/types__mongoose-paginate-v2/index.d.ts" />
declare module 'mongoose-paginate-v2';
// declare module 'mongoose' {
// interface CustomLabels {
// totalDocs?: string | undefined;
// docs?: string | undefined;
// limit?: string | undefined;
// page?: string | undefined;
// nextPage?: string | undefined;
// prevPage?: string | undefined;
// hasNextPage?: string | undefined;
// hasPrevPage?: string | undefined;
// totalPages?: string | undefined;
// pagingCounter?: string | undefined;
// meta?: string | undefined;
// }
// interface ReadOptions {
// pref: string;
// tags?: any[] | undefined;
// }
// interface PaginateOptions {
// select?: object | string | undefined;
// collation?: import('mongodb').CollationOptions | undefined;
// sort?: object | string | undefined;
// populate?: PopulateOptions[] | string[] | PopulateOptions | string | PopulateOptions | undefined;
// projection?: any;
// lean?: boolean | undefined;
// leanWithId?: boolean | undefined;
// offset?: number | undefined;
// page?: number | undefined;
// limit?: number | undefined;
// customLabels?: CustomLabels | undefined;
// /* If pagination is set to `false`, it will return all docs without adding limit condition. (Default: `true`) */
// pagination?: boolean | undefined;
// useEstimatedCount?: boolean | undefined;
// useCustomCountFn?: (() => Promise<number>) | undefined;
// forceCountFn?: boolean | undefined;
// allowDiskUse?: boolean | undefined;
// read?: ReadOptions | undefined;
// options?: QueryOptions | undefined;
// }
// // Extended Type definitions for mongoose-paginate-v2 1.4
// // We are extending it to support custom Paginate Labels
// // @see src/infra/database.ts
// interface PaginateResult<T> {
// docs: T[];
// totalDocs: number;
// total: number; // custom label for totalDocs
// limit: number;
// hasPrevPage: boolean;
// hasNextPage: boolean;
// page?: number | undefined;
// current?: number | undefined; // custom label for page
// totalPages: number;
// pages: number; // custom label for totalPages
// offset: number;
// prevPage?: number | null | undefined;
// prev?: number | null | undefined; // custom label for prevPage
// nextPage?: number | null | undefined;
// next?: number | null | undefined; // custom label for nextPage
// pagingCounter: number;
// // eslint-disable-next-line @typescript-eslint/no-explicit-any
// meta?: any;
// result: T[];
// }
// type PaginateDocument<T, TMethods, TVirtuals, O extends PaginateOptions = {}> = O['lean'] extends true
// ? O['leanWithId'] extends true
// ? LeanDocument<T & { id: string }>
// : LeanDocument<T>
// : HydratedDocument<T, TMethods, TVirtuals>;
// interface PaginateModel<T, TQueryHelpers = {}, TMethods = {}, TVirtuals = {}>
// extends Model<T, TQueryHelpers, TMethods, TVirtuals> {
// paginate<O extends PaginateOptions>(
// query?: FilterQuery<T>,
// options?: O,
// callback?: (err: any, result: PaginateResult<PaginateDocument<T, TMethods, TVirtuals, O>>) => void,
// ): Promise<PaginateResult<PaginateDocument<T, TMethods, TVirtuals, O>>>;
// }
// }
// import mongoose = require('mongoose');
// declare function _(schema: mongoose.Schema): void;
// export = _;
// declare namespace _ {
// const paginate: { options: mongoose.PaginateOptions };
// }