diff --git a/node-mysql-wrapper/my-meteor.d.ts b/node-mysql-wrapper/my-meteor.d.ts new file mode 100644 index 000000000..af1f7df6e --- /dev/null +++ b/node-mysql-wrapper/my-meteor.d.ts @@ -0,0 +1,80 @@ +declare module Mongo { + var Collection: CollectionStatic; + interface CollectionStatic { + new (name: string, options?: { + connection?: Object; + idGeneration?: string; + transform?: Function; + }): Collection; + } + interface Collection { + 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; + 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 (): Cursor; + } + interface Cursor { + count(): number; + fetch(): Array; + forEach(callback: (doc: T, index: number, cursor: Mongo.Cursor) => void, thisArg?: any): void; + map(callback: (doc: T, index: number, cursor: Mongo.Cursor) => U, thisArg?: any): Array; + 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; +}