diff --git a/acl/acl-mongodbBackend-tests.ts b/acl/acl-mongodbBackend-tests.ts
index 01c9af9082..ae3b1d03c9 100644
--- a/acl/acl-mongodbBackend-tests.ts
+++ b/acl/acl-mongodbBackend-tests.ts
@@ -1,10 +1,8 @@
-///
-
// https://github.com/OptimalBits/node_acl/blob/master/Readme.md
import Acl = require('acl');
import mongodb = require('mongodb');
-var db: mongodb.Db;
+declare var db: mongodb.Db;
// Using the mongo db backend
var acl = new Acl(new Acl.mongodbBackend(db, 'acl_', true));
diff --git a/acl/acl-redisBackend-tests.ts b/acl/acl-redisBackend-tests.ts
index 273aeab3b7..ec1924cce6 100644
--- a/acl/acl-redisBackend-tests.ts
+++ b/acl/acl-redisBackend-tests.ts
@@ -1,10 +1,8 @@
-///
-
// https://github.com/OptimalBits/node_acl/blob/master/Readme.md
import Acl = require('acl');
import redis = require('redis');
-var client: redis.RedisClient;
+declare var client: redis.RedisClient;
// Using the redis backend
var acl = new Acl(new Acl.redisBackend(client, 'acl_'));
diff --git a/acl/acl-tests.ts b/acl/acl-tests.ts
index 551ad9c1cd..07dc401891 100644
--- a/acl/acl-tests.ts
+++ b/acl/acl-tests.ts
@@ -1,5 +1,3 @@
-///
-
// Sample code from
// https://github.com/OptimalBits/node_acl/blob/master/Readme.md
import Acl = require('acl');
diff --git a/acl/acl.d.ts b/acl/index.d.ts
similarity index 97%
rename from acl/acl.d.ts
rename to acl/index.d.ts
index daabcf628f..063ef21be1 100644
--- a/acl/acl.d.ts
+++ b/acl/index.d.ts
@@ -6,10 +6,6 @@
///
///
-///
-///
-
-
import http = require('http');
import Promise = require("bluebird");
diff --git a/mongodb/mongodb.d.ts b/mongodb/index.d.ts
similarity index 86%
rename from mongodb/mongodb.d.ts
rename to mongodb/index.d.ts
index a08251b8ba..1f2ec71e82 100644
--- a/mongodb/mongodb.d.ts
+++ b/mongodb/index.d.ts
@@ -7,12 +7,10 @@
///
-declare module "mongodb" {
- import {EventEmitter} from 'events';
+import {EventEmitter} from 'events';
-
- // Class documentation : http://mongodb.github.io/node-mongodb-native/2.1/api/MongoClient.html
- export class MongoClient {
+// Class documentation : http://mongodb.github.io/node-mongodb-native/2.1/api/MongoClient.html
+export class MongoClient {
constructor();
static connect(uri: string, callback: MongoCallback): void;
@@ -22,30 +20,30 @@ declare module "mongodb" {
connect(uri: string, callback: MongoCallback): void;
connect(uri: string, options?: MongoClientOptions): Promise;
connect(uri: string, options: MongoClientOptions, callback: MongoCallback): void;
- }
+}
- export interface MongoCallback {
+export interface MongoCallback {
(error: MongoError, result: T): void;
- }
+}
- // http://mongodb.github.io/node-mongodb-native/2.1/api/MongoError.html
- export class MongoError extends Error {
+// http://mongodb.github.io/node-mongodb-native/2.1/api/MongoError.html
+export class MongoError extends Error {
constructor(message: string);
static create(options: Object): MongoError;
- }
+}
- //http://mongodb.github.io/node-mongodb-native/2.1/api/MongoClient.html#.connect
- export interface MongoClientOptions {
+//http://mongodb.github.io/node-mongodb-native/2.1/api/MongoClient.html#.connect
+export interface MongoClientOptions {
uri_decode_auth?: boolean;
db?: DbCreateOptions;
server?: ServerOptions;
replSet?: ReplSetOptions;
mongos?: MongosOptions;
promiseLibrary?: Object;
- }
+}
- // See : http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html
- export interface DbCreateOptions {
+// See : http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html
+export interface DbCreateOptions {
authSource?: string;
// the write concern for the operation where < 1 is no acknowlegement of write and w >= 1, w = ‘majority’ or tag acknowledges the write.
w?: number | string;
@@ -69,10 +67,10 @@ declare module "mongodb" {
pkFactory?: Object;
promiseLibrary?: Object;
readConcern?: { level?: Object };
- }
+}
- // See http://mongodb.github.io/node-mongodb-native/2.1/api/ReadPreference.html
- export class ReadPreference {
+// See http://mongodb.github.io/node-mongodb-native/2.1/api/ReadPreference.html
+export class ReadPreference {
constructor(mode: string, tags: Object);
mode: string;
tags: any;
@@ -83,10 +81,10 @@ declare module "mongodb" {
static NEAREST: string;
isValid(mode: string): boolean;
static isValid(mode: string): boolean;
- }
+}
- //http://mongodb.github.io/node-mongodb-native/2.1/api/Server.html
- export interface SocketOptions {
+//http://mongodb.github.io/node-mongodb-native/2.1/api/Server.html
+export interface SocketOptions {
// Reconnect on error. default:false
autoReconnect?: boolean;
// TCP Socket NoDelay option. default:true
@@ -97,10 +95,10 @@ declare module "mongodb" {
connectTimeoutMS?: number;
// TCP Socket timeout setting. default 0
socketTimeoutMS?: number;
- }
+}
- //http://mongodb.github.io/node-mongodb-native/2.1/api/Server.html
- export interface ServerOptions {
+//http://mongodb.github.io/node-mongodb-native/2.1/api/Server.html
+export interface ServerOptions {
// - specify the number of connections in the pool default:5
poolSize?: number;
ssl?: boolean;
@@ -113,10 +111,10 @@ declare module "mongodb" {
socketOptions?: SocketOptions;
reconnectTries?: number;
reconnectInterval?: number;
- }
+}
- //http://mongodb.github.io/node-mongodb-native/2.1/api/ReplSet.html
- export interface ReplSetOptions {
+//http://mongodb.github.io/node-mongodb-native/2.1/api/ReplSet.html
+export interface ReplSetOptions {
ha?: boolean;
haInterval?: number;
replicaSet?: string;
@@ -132,10 +130,10 @@ declare module "mongodb" {
sslKey?: Buffer | string;
sslPass?: Buffer | string;
socketOptions?: SocketOptions;
- }
+}
- //http://mongodb.github.io/node-mongodb-native/2.1/api/Mongos.html
- export interface MongosOptions {
+//http://mongodb.github.io/node-mongodb-native/2.1/api/Mongos.html
+export interface MongosOptions {
ha?: boolean;
haInterval?: number;
// - specify the number of connections in the pool default:5
@@ -148,10 +146,10 @@ declare module "mongodb" {
sslKey?: Buffer | string;
sslPass?: Buffer | string;
socketOptions?: SocketOptions;
- }
+}
- // Class documentation : http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html
- export class Db extends EventEmitter {
+// Class documentation : http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html
+export class Db extends EventEmitter {
constructor(databaseName: string, serverConfig: Server | ReplSet | Mongos, options?: DbCreateOptions);
serverConfig: Server | ReplSet | Mongos;
@@ -239,42 +237,42 @@ declare module "mongodb" {
stats(callback: MongoCallback): void;
stats(options?: { scale?: number }): Promise;
stats(options: { scale?: number }, callback: MongoCallback): void;
- }
+}
- // Deprecated http://mongodb.github.io/node-mongodb-native/2.1/api/Server.html
- export class Server extends EventEmitter {
+// Deprecated http://mongodb.github.io/node-mongodb-native/2.1/api/Server.html
+export class Server extends EventEmitter {
constructor(host: string, port: number, options?: ServerOptions);
connections(): Array;
- }
+}
- // Deprecated http://mongodb.github.io/node-mongodb-native/2.1/api/ReplSet.html
- export class ReplSet extends EventEmitter {
+// Deprecated http://mongodb.github.io/node-mongodb-native/2.1/api/ReplSet.html
+export class ReplSet extends EventEmitter {
constructor(servers: Array, options?: ReplSetOptions);
connections(): Array;
- }
-
- // Deprecated http://mongodb.github.io/node-mongodb-native/2.1/api/ReplSet.html
- export class Mongos extends EventEmitter {
+}
+
+// Deprecated http://mongodb.github.io/node-mongodb-native/2.1/api/ReplSet.html
+export class Mongos extends EventEmitter {
constructor(servers: Array, options?: MongosOptions);
connections(): Array;
- }
-
- // http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#addUser
- export interface DbAddUserOptions {
+}
+
+// http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#addUser
+export interface DbAddUserOptions {
w?: string | number;
wtimeout?: number;
j?: boolean;
customData?: Object;
roles?: Object[];
- }
+}
- //http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#createCollection
- export interface CollectionCreateOptions {
+//http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#createCollection
+export interface CollectionCreateOptions {
w?: number | string;
wtimeout?: number;
j?: boolean;
@@ -287,10 +285,10 @@ declare module "mongodb" {
size?: number;
max?: number;
autoIndexId?: boolean;
- }
+}
- // http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#collection
- export interface DbCollectionOptions {
+// http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#collection
+export interface DbCollectionOptions {
w?: number | string;
wtimeout?: number;
j?: boolean;
@@ -300,10 +298,10 @@ declare module "mongodb" {
serializeFunctions?: boolean;
strict?: boolean;
readConcern?: { level: Object };
- }
+}
- //http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#createIndex
- export interface IndexOptions {
+//http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#createIndex
+export interface IndexOptions {
// The write concern.
w?: number | string;
// The write concern timeout.
@@ -330,10 +328,10 @@ declare module "mongodb" {
expireAfterSeconds?: number;
// Override the auto generated index name (useful if the resulting name is larger than 128 bytes)
name?: string;
- }
+}
- // http://mongodb.github.io/node-mongodb-native/2.1/api/Admin.html
- export interface Admin {
+// http://mongodb.github.io/node-mongodb-native/2.1/api/Admin.html
+export interface Admin {
// http://mongodb.github.io/node-mongodb-native/2.1/api/Admin.html#addUser
addUser(username: string, password: string, callback: MongoCallback): void;
addUser(username: string, password: string, options?: AddUserOptions): Promise;
@@ -384,28 +382,28 @@ declare module "mongodb" {
validateCollection(collectionNme: string, callback: MongoCallback): void;
validateCollection(collectionNme: string, options?: Object): Promise;
validateCollection(collectionNme: string, options: Object, callback: MongoCallback): void;
- }
+}
- //http://mongodb.github.io/node-mongodb-native/2.1/api/Admin.html#addUser
- export interface AddUserOptions {
+//http://mongodb.github.io/node-mongodb-native/2.1/api/Admin.html#addUser
+export interface AddUserOptions {
w?: number | string;
wtimeout?: number;
j?: boolean;
fsync: boolean;
customData?: Object;
roles?: Object[]
- }
+}
- //http://mongodb.github.io/node-mongodb-native/2.1/api/Admin.html#removeUser
- export interface FSyncOptions {
+//http://mongodb.github.io/node-mongodb-native/2.1/api/Admin.html#removeUser
+export interface FSyncOptions {
w?: number | string;
wtimeout?: number;
j?: boolean;
fsync?: boolean
- }
+}
- // Class documentation : http://mongodb.github.io/node-mongodb-native/2.1/api/ObjectID.html
- export class ObjectID {
+// Class documentation : http://mongodb.github.io/node-mongodb-native/2.1/api/ObjectID.html
+export class ObjectID {
constructor(s?: string | number);
generationTime: number;
@@ -428,10 +426,10 @@ declare module "mongodb" {
getTimestamp(): Date;
// Returns the ObjectID id as a 24 byte hex string representation
toHexString(): string;
- }
+}
- // Class documentation : http://mongodb.github.io/node-mongodb-native/2.1/api/Binary.html
- export class Binary {
+// Class documentation : http://mongodb.github.io/node-mongodb-native/2.1/api/Binary.html
+export class Binary {
constructor(buffer: Buffer, subType?: number);
static SUBTYPE_BYTE_ARRAY: number;
@@ -452,16 +450,16 @@ declare module "mongodb" {
value(): string;
// Writes a buffer or string to the binary
write(buffer: Buffer | string, offset: number): void;
- }
- //http://mongodb.github.io/node-mongodb-native/2.1/api/Double.html
- export class Double {
+}
+//http://mongodb.github.io/node-mongodb-native/2.1/api/Double.html
+export class Double {
constructor(value: number);
valueOf(): number;
- }
+}
- //http://mongodb.github.io/node-mongodb-native/2.1/api/Long.html
- export class Long {
+//http://mongodb.github.io/node-mongodb-native/2.1/api/Long.html
+export class Long {
constructor(low: number, high: number);
static MAX_VALUE: Long;
@@ -506,16 +504,16 @@ declare module "mongodb" {
toNumber(): number;
toString(radix?: number): string;
xor(other: Long): Long;
- }
+}
- //http://mongodb.github.io/node-mongodb-native/2.1/api/MaxKey.html
- export class MaxKey { }
+//http://mongodb.github.io/node-mongodb-native/2.1/api/MaxKey.html
+export class MaxKey { }
- //http://mongodb.github.io/node-mongodb-native/2.1/api/MinKey.html
- export class MinKey { }
+//http://mongodb.github.io/node-mongodb-native/2.1/api/MinKey.html
+export class MinKey { }
- //http://mongodb.github.io/node-mongodb-native/2.1/api/Timestamp.html
- export class Timestamp {
+//http://mongodb.github.io/node-mongodb-native/2.1/api/Timestamp.html
+export class Timestamp {
constructor(low: number, high: number);
static MAX_VALUE: Timestamp;
@@ -560,10 +558,10 @@ declare module "mongodb" {
toNumber(): number;
toString(radix?: number): string;
xor(other: Timestamp): Timestamp;
- }
+}
- // Documentation : http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html
- export interface Collection {
+// Documentation : http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html
+export interface Collection {
// Get the collection name.
collectionName: string;
// Get the full collection namespace.
@@ -729,11 +727,11 @@ declare module "mongodb" {
updateOne(filter: Object, update: Object, callback: MongoCallback): void;
updateOne(filter: Object, update: Object, options?: ReplaceOneOptions): Promise;
updateOne(filter: Object, update: Object, options: ReplaceOneOptions, callback: MongoCallback): void;
- }
+}
- // Documentation: http://docs.mongodb.org/manual/reference/command/collStats/
- //TODO complete this
- export interface CollStats {
+// Documentation: http://docs.mongodb.org/manual/reference/command/collStats/
+//TODO complete this
+export interface CollStats {
// Namespace.
ns: string;
// Number of documents.
@@ -757,18 +755,18 @@ declare module "mongodb" {
totalIndexSize: number;
// Size of specific indexes in bytes.
indexSizes: {
- _id_: number;
- username: number;
+ _id_: number;
+ username: number;
};
capped: boolean;
maxSize: boolean;
wiredTiger: any;
indexDetails: any;
ok: number;
- }
+}
- //http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#aggregate
- export interface CollectionAggregationOptions {
+//http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#aggregate
+export interface CollectionAggregationOptions {
readPreference?: ReadPreference | string;
// Return the query as cursor, on 2.6 > it returns as a real cursor
// on pre 2.6 it returns as an emulated cursor.
@@ -783,10 +781,10 @@ declare module "mongodb" {
maxTimeMS?: boolean;
// Allow driver to bypass schema validation in MongoDB 3.2 or higher.
bypassDocumentValidation?: boolean;
- }
+}
- //http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#insertMany
- export interface CollectionInsertManyOptions {
+//http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#insertMany
+export interface CollectionInsertManyOptions {
// The write concern.
w?: number | string;
// The write concern timeout.
@@ -797,10 +795,10 @@ declare module "mongodb" {
serializeFunctions?: boolean;
//Force server to assign _id values instead of driver.
forceServerObjectId?: boolean;
- }
+}
- //http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#bulkWrite
- export interface CollectionBluckWriteOptions {
+//http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#bulkWrite
+export interface CollectionBluckWriteOptions {
// The write concern.
w?: number | string;
// The write concern timeout.
@@ -813,10 +811,10 @@ declare module "mongodb" {
ordered?: boolean;
// Allow driver to bypass schema validation in MongoDB 3.2 or higher.
bypassDocumentValidation?: boolean;
- }
+}
- //http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#~BulkWriteOpResult
- export interface BulkWriteOpResultObject {
+//http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#~BulkWriteOpResult
+export interface BulkWriteOpResultObject {
insertedCount?: number;
matchedCount?: number;
modifiedCount?: number;
@@ -825,10 +823,10 @@ declare module "mongodb" {
insertedIds?: any;
upsertedIds?: any;
result?: any;
- }
+}
- //http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#count
- export interface MongoCountPreferences {
+//http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#count
+export interface MongoCountPreferences {
// The limit of documents to count.
limit?: number;
// The number of documents to skip for the count.
@@ -837,52 +835,52 @@ declare module "mongodb" {
hint?: string;
// The preferred read preference
readPreference?: ReadPreference | string;
- }
+}
- //http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#~deleteWriteOpResult
- export interface DeleteWriteOpResultObject {
+//http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#~deleteWriteOpResult
+export interface DeleteWriteOpResultObject {
//The raw result returned from MongoDB, field will vary depending on server version.
result: {
- //Is 1 if the command executed correctly.
- ok?: number;
- //The total count of documents deleted.
- n?: number;
+ //Is 1 if the command executed correctly.
+ ok?: number;
+ //The total count of documents deleted.
+ n?: number;
}
//The connection object used for the operation.
connection?: any;
//The number of documents deleted.
deletedCount?: number;
- }
+}
- //http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#~findAndModifyWriteOpResult
- export interface FindAndModifyWriteOpResultObject {
+//http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#~findAndModifyWriteOpResult
+export interface FindAndModifyWriteOpResultObject {
//Document returned from findAndModify command.
value?: any;
//The raw lastErrorObject returned from the command.
lastErrorObject?: any;
//Is 1 if the command executed correctly.
ok?: number;
- }
+}
- //http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#findOneAndReplace
- export interface FindOneAndReplaceOption {
+//http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#findOneAndReplace
+export interface FindOneAndReplaceOption {
projection?: Object;
sort?: Object;
maxTimeMS?: number;
upsert?: boolean;
returnOriginal?: boolean;
- }
+}
- //http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#geoHaystackSearch
- export interface GeoHaystackSearchOptions {
+//http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#geoHaystackSearch
+export interface GeoHaystackSearchOptions {
readPreference?: ReadPreference | string;
maxDistance?: number;
search?: Object;
limit?: number;
- }
+}
- //http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#geoNear
- export interface GeoNearOptions {
+//http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#geoNear
+export interface GeoNearOptions {
readPreference?: ReadPreference | string;
num?: number;
minDistance?: number;
@@ -892,27 +890,27 @@ declare module "mongodb" {
spherical?: boolean;
uniqueDocs?: boolean;
includeLocs?: boolean;
- }
+}
- //http://mongodb.github.io/node-mongodb-native/2.1/api/Code.html
- export class Code {
+//http://mongodb.github.io/node-mongodb-native/2.1/api/Code.html
+export class Code {
constructor(code: string | Function, scope?: Object)
code: string | Function;
scope: any;
- }
+}
- //http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#deleteMany
- export interface CollectionOptions {
+//http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#deleteMany
+export interface CollectionOptions {
//The write concern.
w?: number | string;
//The write concern timeout.
wtimeout?: number;
//Specify a journal write concern.
j?: boolean;
- }
+}
- //http://mongodb.github.io/node-mongodb-native/2.1/api/OrderedBulkOperation.html
- export interface OrderedBulkOperation {
+//http://mongodb.github.io/node-mongodb-native/2.1/api/OrderedBulkOperation.html
+export interface OrderedBulkOperation {
length: number;
//http://mongodb.github.io/node-mongodb-native/2.1/api/OrderedBulkOperation.html#execute
execute(callback: MongoCallback): void;
@@ -922,10 +920,10 @@ declare module "mongodb" {
find(selector: Object): FindOperatorsOrdered;
//http://mongodb.github.io/node-mongodb-native/2.1/api/OrderedBulkOperation.html#insert
insert(doc: Object): OrderedBulkOperation;
- }
+}
- //http://mongodb.github.io/node-mongodb-native/2.1/api/BulkWriteResult.html
- export interface BulkWriteResult {
+//http://mongodb.github.io/node-mongodb-native/2.1/api/BulkWriteResult.html
+export interface BulkWriteResult {
ok: number;
nInserted: number;
nUpdated: number;
@@ -943,38 +941,38 @@ declare module "mongodb" {
getWriteErrorCount(): number;
getWriteErrors(): Array