1 | /// <reference types="node" />
|
2 | /// <reference types="mongoose/types/aggregate" />
|
3 | /// <reference types="mongoose/types/callback" />
|
4 | /// <reference types="mongoose/types/collection" />
|
5 | /// <reference types="mongoose/types/connection" />
|
6 | /// <reference types="mongoose/types/cursor" />
|
7 | /// <reference types="mongoose/types/document" />
|
8 | /// <reference types="mongoose/types/error" />
|
9 | /// <reference types="mongoose/types/expressions" />
|
10 | /// <reference types="mongoose/types/helpers" />
|
11 | /// <reference types="mongoose/types/middlewares" />
|
12 | /// <reference types="mongoose/types/indexes" />
|
13 | /// <reference types="mongoose/types/models" />
|
14 | /// <reference types="mongoose/types/mongooseoptions" />
|
15 | /// <reference types="mongoose/types/pipelinestage" />
|
16 | /// <reference types="mongoose/types/populate" />
|
17 | /// <reference types="mongoose/types/query" />
|
18 | /// <reference types="mongoose/types/schemaoptions" />
|
19 | /// <reference types="mongoose/types/schematypes" />
|
20 | /// <reference types="mongoose/types/session" />
|
21 | /// <reference types="mongoose/types/types" />
|
22 | /// <reference types="mongoose/types/utility" />
|
23 | /// <reference types="mongoose/types/validation" />
|
24 | /// <reference types="mongoose/types/virtuals" />
|
25 | /// <reference types="mongoose/types/inferschematype" />
|
26 | /// <reference types="mongoose/types/inferrawdoctype" />
|
27 | import * as mongoose from 'mongoose';
|
28 | import type { DocumentType, Ref, RefType } from './types';
|
29 | /**
|
30 | * Check if the given document is populated
|
31 | * @param doc The Ref with uncertain type
|
32 | */
|
33 | export declare function isDocument<T, S extends RefType>(doc: Ref<T, S> | null | undefined): doc is DocumentType<T>;
|
34 | /**
|
35 | * Check if the given array is fully populated
|
36 | * Only returns "true" if all members in the array are populated
|
37 | * @param docs The Array of Refs with uncertain type
|
38 | */
|
39 | export declare function isDocumentArray<T, S extends RefType>(docs: mongoose.Types.Array<Ref<T, S>> | null | undefined): docs is mongoose.Types.Array<DocumentType<NonNullable<T>>>;
|
40 | /**
|
41 | * Check if the given array is fully populated
|
42 | * Only returns "true" if all members in the array are populated
|
43 | * @param docs The Array of Refs with uncertain type
|
44 | */
|
45 | export declare function isDocumentArray<T, S extends RefType>(docs: Ref<T, S>[] | null | undefined): docs is DocumentType<NonNullable<T>>[];
|
46 | type AllowedRefTypes = typeof String | typeof Number | typeof Buffer | typeof mongoose.Types.ObjectId | typeof mongoose.Types.Buffer;
|
47 | /**
|
48 | * Check if the document is of type "refType"
|
49 | * @param doc The Ref with uncretain type
|
50 | * @param refType The Expected Reference Type (this is required because this type is only known at compile time, not at runtime)
|
51 | */
|
52 | export declare function isRefType<T, S extends RefType>(doc: Ref<T, S> | null | undefined, refType: AllowedRefTypes): doc is NonNullable<S>;
|
53 | /**
|
54 | * Check if the array is fully of type "refType"
|
55 | * Only returns "true" if all members in the array are of type "refType"
|
56 | * @param docs The Ref with uncretain type
|
57 | * @param refType The Expected Reference Type (this is required because this type is only known at compile time, not at runtime)
|
58 | */
|
59 | export declare function isRefTypeArray<T, S extends RefType>(docs: mongoose.Types.Array<Ref<T, S>> | null | undefined, refType: AllowedRefTypes): docs is mongoose.Types.Array<NonNullable<S>>;
|
60 | /**
|
61 | * Check if the array is fully of type "refType"
|
62 | * Only returns "true" if all members in the array are of type "refType"
|
63 | * @param docs The Ref with uncretain type
|
64 | * @param refType The Expected Reference Type (this is required because this type is only known at compile time, not at runtime)
|
65 | */
|
66 | export declare function isRefTypeArray<T, S extends RefType>(docs: Ref<T, S>[] | null | undefined, refType: AllowedRefTypes): docs is NonNullable<S>[];
|
67 | /**
|
68 | * Check if the input is a mongoose.Model
|
69 | * @param model The Value to check
|
70 | */
|
71 | export declare function isModel(model: any): model is mongoose.Model<any>;
|
72 | export {};
|