forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
my-meteor.d.ts
84 lines (79 loc) · 2.44 KB
/
my-meteor.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
// Type definitions for meteorjs for node-mysql-wrapper which helps in development
// Project: https://github.com/nodets/node-mysql-wrapper
// Definitions by: Makis Maropoulos <https://github.com/kataras>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare module Mongo {
var Collection: CollectionStatic;
interface CollectionStatic {
new <T>(name: string, options?: {
connection?: Object;
idGeneration?: string;
transform?: Function;
}): Collection<T>;
}
interface Collection<T> {
allow(options: {
insert?: (userId: string, doc: T) => boolean;
update?: (userId: string, doc: T, fieldNames: string[], modifier: any) => boolean;
remove?: (userId: string, doc: T) => boolean;
fetch?: string[];
transform?: Function;
}): boolean;
deny(options: {
insert?: (userId: string, doc: T) => boolean;
update?: (userId: string, doc: T, fieldNames: string[], modifier: any) => boolean;
remove?: (userId: string, doc: T) => boolean;
fetch?: string[];
transform?: Function;
}): boolean;
find(selector?: any, options?: {
sort?: any;
skip?: number;
limit?: number;
fields?: any;
reactive?: boolean;
transform?: Function;
}): Mongo.Cursor<T>;
findOne(selector?: any, options?: {
sort?: any;
skip?: number;
fields?: any;
reactive?: boolean;
transform?: Function;
}): T;
insert(doc: T, callback?: Function): string;
rawCollection():any;
rawDatabase():any;
remove(selector: any, callback?: Function): void;
update(selector: any, modifier: any, options?: {
multi?: boolean;
upsert?: boolean;
}, callback?: Function): number;
upsert(selector: any, modifier: any, options?: {
multi?: boolean;
}, callback?: Function): { numberAffected?: number; insertedId?: string; };
_ensureIndex(indexName: string, options?: { [key: string]: any }): void;
}
var Cursor: CursorStatic;
interface CursorStatic {
new <T>(): Cursor<T>;
}
interface Cursor<T> {
count(): number;
fetch(): Array<T>;
forEach(callback: <T>(doc: T, index: number, cursor: Mongo.Cursor<T>) => void, thisArg?: any): void;
map<U>(callback: (doc: T, index: number, cursor: Mongo.Cursor<T>) => U, thisArg?: any): Array<U>;
observe(callbacks: Object): any;
observeChanges(callbacks: Object): any;
}
var ObjectID: ObjectIDStatic;
interface ObjectIDStatic {
new (hexString: string): ObjectID;
}
interface ObjectID {
}
}
declare module Meteor {
var isServer: boolean;
var isClient: boolean;
}