mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-08 16:40:30 +08:00
Create my-meteor
These declarations help me with node-mysql-wrapper, I wrote those the project needs.
This commit is contained in:
Vendored
+80
@@ -0,0 +1,80 @@
|
||||
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(); /** TODO: add return value **/
|
||||
rawDatabase(); /** TODO: add return value **/
|
||||
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;
|
||||
var bindEnvironment: Function;
|
||||
}
|
||||
Reference in New Issue
Block a user