Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

iridium

Package Overview
Dependencies
Maintainers
1
Versions
157
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

iridium - npm Package Compare versions

Comparing version 7.0.0-alpha.8 to 7.0.0-alpha.9

0

dist/iridium.d.ts

@@ -0,0 +0,0 @@ export * from "./lib/Core";

3

dist/iridium.js

@@ -14,3 +14,2 @@ "use strict";

__export(require("./lib/utils/ObjectID"));
//# sourceMappingURL=iridium.js.map
//# sourceMappingURL=iridium.js.map
"use strict";
//# sourceMappingURL=Aggregate.js.map
//# sourceMappingURL=Aggregate.js.map

@@ -5,3 +5,2 @@ "use strict";

exports.Binary = mongodb_1.Binary;
//# sourceMappingURL=BSON.js.map
//# sourceMappingURL=BSON.js.map
"use strict";
//# sourceMappingURL=Cache.js.map
//# sourceMappingURL=Cache.js.map
"use strict";
var MongoDB = require("mongodb");
const MongoDB = require("mongodb");
/**

@@ -9,25 +9,21 @@ * Caches documents using their _id field as the unique cache key. This

*/
var CacheOnID = (function () {
function CacheOnID() {
class CacheOnID {
valid(object) {
return !!object._id;
}
CacheOnID.prototype.valid = function (object) {
return !!object._id;
};
CacheOnID.prototype.buildKey = function (object) {
buildKey(object) {
if (object._id._bsontype === "ObjectID")
return new MongoDB.ObjectID(object._id.id).toHexString();
return object._id;
};
CacheOnID.prototype.validQuery = function (conditions) {
}
validQuery(conditions) {
return !!conditions._id;
};
CacheOnID.prototype.buildQueryKey = function (conditions) {
}
buildQueryKey(conditions) {
if (conditions._id._bsontype === "ObjectID")
return new MongoDB.ObjectID(conditions._id.id).toHexString();
return conditions._id;
};
return CacheOnID;
}());
}
}
exports.CacheOnID = CacheOnID;
//# sourceMappingURL=IDDirector.js.map
//# sourceMappingURL=IDDirector.js.map
"use strict";
//# sourceMappingURL=CacheDirector.js.map
//# sourceMappingURL=CacheDirector.js.map
"use strict";
var Bluebird = require("bluebird");
const Bluebird = require("bluebird");
/**

@@ -9,23 +9,21 @@ * A cache implementation which stores documents in an in-memory cache.

*/
var MemoryCache = (function () {
function MemoryCache() {
class MemoryCache {
constructor() {
this.cache = {};
}
MemoryCache.prototype.set = function (key, value) {
set(key, value) {
this.cache[key] = value;
return Bluebird.resolve(value);
};
MemoryCache.prototype.get = function (key) {
}
get(key) {
return Bluebird.resolve(this.cache[key]);
};
MemoryCache.prototype.clear = function (key) {
var has = this.cache.hasOwnProperty(key);
}
clear(key) {
let has = this.cache.hasOwnProperty(key);
if (has)
delete this.cache[key];
return Bluebird.resolve(has);
};
return MemoryCache;
}());
}
}
exports.MemoryCache = MemoryCache;
//# sourceMappingURL=MemoryCache.js.map
//# sourceMappingURL=MemoryCache.js.map
"use strict";
var Bluebird = require("bluebird");
const Bluebird = require("bluebird");
/**

@@ -10,18 +10,14 @@ * A cache implementation which does not cache any received documents

*/
var NoOpCache = (function () {
function NoOpCache() {
class NoOpCache {
set(key, object) {
return Bluebird.resolve(object);
}
NoOpCache.prototype.set = function (key, object) {
return Bluebird.resolve(object);
};
NoOpCache.prototype.get = function (key) {
get(key) {
return Bluebird.resolve();
};
NoOpCache.prototype.clear = function (key) {
}
clear(key) {
return Bluebird.resolve(false);
};
return NoOpCache;
}());
}
}
exports.NoOpCache = NoOpCache;
//# sourceMappingURL=NoOpCache.js.map
//# sourceMappingURL=NoOpCache.js.map
"use strict";
//# sourceMappingURL=Configuration.js.map
//# sourceMappingURL=Configuration.js.map
"use strict";
var Bluebird = require("bluebird");
var MongoDB = require("mongodb");
var _ = require("lodash");
var Express_1 = require("./middleware/Express");
var NoOpCache_1 = require("./caches/NoOpCache");
const Bluebird = require("bluebird");
const MongoDB = require("mongodb");
const _ = require("lodash");
const Express_1 = require("./middleware/Express");
const NoOpCache_1 = require("./caches/NoOpCache");
/**

@@ -14,10 +14,10 @@ * The Iridium Core, responsible for managing the connection to the database as well

*/
var Core = (function () {
function Core(uri, config) {
class Core {
constructor(uri, config) {
this.mongoConnectAsyc = Bluebird.promisify(MongoDB.MongoClient.connect);
this._plugins = [];
this._cache = new NoOpCache_1.NoOpCache();
var args = Array.prototype.slice.call(arguments, 0);
let args = Array.prototype.slice.call(arguments, 0);
uri = config = null;
for (var i = 0; i < args.length; i++) {
for (let i = 0; i < args.length; i++) {
if (typeof args[i] == "string")

@@ -33,95 +33,74 @@ uri = args[i];

}
Object.defineProperty(Core.prototype, "plugins", {
/**
* Gets the plugins registered with this Iridium Core
* @returns {[Iridium.Plugin]}
*/
get: function () {
return this._plugins;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Core.prototype, "settings", {
/**
* Gets the configuration specified in the construction of this
* Iridium Core.
* @returns {Iridium.Configuration}
*/
get: function () {
return this._config;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Core.prototype, "connection", {
/**
* Gets the currently active database connection for this Iridium
* Core.
* @returns {MongoDB.Db}
*/
get: function () {
return this._connection;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Core.prototype, "url", {
/**
* Gets the URL used to connect to MongoDB
* @returns {String}
*/
get: function () {
var _this = this;
if (this._url)
return this._url;
var url = "mongodb://";
if (this._config.username) {
url += this._config.username;
if (this._config.password)
url += ":" + this._config.password;
url += "@";
}
var hosts = [];
if (this._config.host) {
if (this._config.port)
hosts.push(this._config.host + ":" + this._config.port);
/**
* Gets the plugins registered with this Iridium Core
* @returns {[Iridium.Plugin]}
*/
get plugins() {
return this._plugins;
}
/**
* Gets the configuration specified in the construction of this
* Iridium Core.
* @returns {Iridium.Configuration}
*/
get settings() {
return this._config;
}
/**
* Gets the currently active database connection for this Iridium
* Core.
* @returns {MongoDB.Db}
*/
get connection() {
return this._connection;
}
/**
* Gets the URL used to connect to MongoDB
* @returns {String}
*/
get url() {
if (this._url)
return this._url;
let url = "mongodb://";
if (this._config.username) {
url += this._config.username;
if (this._config.password)
url += ":" + this._config.password;
url += "@";
}
let hosts = [];
if (this._config.host) {
if (this._config.port)
hosts.push(this._config.host + ":" + this._config.port);
else
hosts.push(this._config.host);
}
if (this._config.hosts) {
_.each(this._config.hosts, (host) => {
if (host.port)
hosts.push(host.address + ":" + host.port);
else if (this._config.port)
hosts.push(host.address + ":" + this._config.port);
else
hosts.push(this._config.host);
}
if (this._config.hosts) {
_.each(this._config.hosts, function (host) {
if (host.port)
hosts.push(host.address + ":" + host.port);
else if (_this._config.port)
hosts.push(host.address + ":" + _this._config.port);
else
hosts.push(host.address);
});
}
if (hosts.length)
url += _.uniq(hosts).join(",");
else
url += "localhost";
url += "/" + this._config.database;
return url;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Core.prototype, "cache", {
/**
* Gets the cache used to store objects retrieved from the database for performance reasons
* @returns {cache}
*/
get: function () {
return this._cache;
},
set: function (value) {
this._cache = value;
},
enumerable: true,
configurable: true
});
hosts.push(host.address);
});
}
if (hosts.length)
url += _.uniq(hosts).join(",");
else
url += "localhost";
url += "/" + this._config.database;
return url;
}
/**
* Gets the cache used to store objects retrieved from the database for performance reasons
* @returns {cache}
*/
get cache() {
return this._cache;
}
set cache(value) {
this._cache = value;
}
/**
* Registers a new plugin with this Iridium Core

@@ -131,6 +110,6 @@ * @param {Iridium.Plugin} plugin The plugin to register with this Iridium Core

*/
Core.prototype.register = function (plugin) {
register(plugin) {
this.plugins.push(plugin);
return this;
};
}
/**

@@ -141,26 +120,25 @@ * Connects to the database server specified in the provided configuration

*/
Core.prototype.connect = function (callback) {
var _this = this;
return Bluebird.resolve().then(function () {
if (_this._connection)
return _this._connection;
if (_this._connectPromise)
return _this._connectPromise;
return _this._connectPromise = _this.mongoConnectAsyc(_this.url, _this._config && _this._config.options);
}).then(function (db) {
return _this.onConnecting(db);
}).then(function (db) {
_this._connection = db;
_this._connectPromise = null;
return _this.onConnected();
}).then(function () {
return _this;
}, function (err) {
if (_this._connection)
_this._connection.close();
_this._connection = null;
_this._connectPromise = null;
connect(callback) {
return Bluebird.resolve().then(() => {
if (this._connection)
return this._connection;
if (this._connectPromise)
return this._connectPromise;
return this._connectPromise = this.mongoConnectAsyc(this.url, this._config && this._config.options);
}).then((db) => {
return this.onConnecting(db);
}).then(db => {
this._connection = db;
this._connectPromise = null;
return this.onConnected();
}).then(() => {
return this;
}, (err) => {
if (this._connection)
this._connection.close();
this._connection = null;
this._connectPromise = null;
return Bluebird.reject(err);
}).nodeify(callback);
};
}
/**

@@ -170,13 +148,12 @@ * Closes the active database connection

*/
Core.prototype.close = function () {
var _this = this;
return Bluebird.resolve().then(function () {
if (!_this._connection)
return _this;
var conn = _this._connection;
_this._connection = null;
close() {
return Bluebird.resolve().then(() => {
if (!this._connection)
return this;
let conn = this._connection;
this._connection = null;
conn.close();
return _this;
return this;
});
};
}
/**

@@ -187,5 +164,5 @@ * Provides an express middleware which can be used to set the req.db property

*/
Core.prototype.express = function () {
express() {
return Express_1.ExpressMiddlewareFactory(this);
};
}
/**

@@ -202,5 +179,5 @@ * A method which is called whenever a new connection is made to the database.

*/
Core.prototype.onConnecting = function (connection) {
onConnecting(connection) {
return Bluebird.resolve(connection);
};
}
/**

@@ -213,9 +190,7 @@ * A method which is called once a database connection has been established and accepted by Iridium

*/
Core.prototype.onConnected = function () {
onConnected() {
return Bluebird.resolve();
};
return Core;
}());
}
}
exports.Core = Core;
//# sourceMappingURL=Core.js.map
//# sourceMappingURL=Core.js.map
"use strict";
var Bluebird = require("bluebird");
const Bluebird = require("bluebird");
/**

@@ -10,3 +10,3 @@ * An Iridium collection cursor which allows the itteration through documents

*/
var Cursor = (function () {
class Cursor {
/**

@@ -19,3 +19,3 @@ * Creates a new Iridium cursor which wraps a MongoDB cursor object

*/
function Cursor(model, conditions, cursor) {
constructor(model, conditions, cursor) {
this.model = model;

@@ -30,6 +30,5 @@ this.conditions = conditions;

*/
Cursor.prototype.count = function (callback) {
var _this = this;
return new Bluebird(function (resolve, reject) {
_this.cursor.count(true, function (err, count) {
count(callback) {
return new Bluebird((resolve, reject) => {
this.cursor.count(true, (err, count) => {
if (err)

@@ -40,3 +39,3 @@ return reject(err);

}).nodeify(callback);
};
}
/**

@@ -48,9 +47,8 @@ * Runs the specified handler over each instance in the query results

*/
Cursor.prototype.forEach = function (handler, callback) {
var _this = this;
var helpers = this.model.helpers;
return new Bluebird(function (resolve, reject) {
_this.cursor.forEach(function (item) {
_this.model.handlers.documentReceived(_this.conditions, item, function () { return helpers.wrapDocument.apply(helpers, arguments); }).then(handler);
}, function (err) {
forEach(handler, callback) {
let helpers = this.model.helpers;
return new Bluebird((resolve, reject) => {
this.cursor.forEach((item) => {
this.model.handlers.documentReceived(this.conditions, item, function () { return helpers.wrapDocument.apply(helpers, arguments); }).then(handler);
}, (err) => {
if (err)

@@ -61,3 +59,3 @@ return reject(err);

}).nodeify(callback);
};
}
/**

@@ -69,11 +67,10 @@ * Runs the specified transform over each instance in the query results and returns the resulting transformed objects

*/
Cursor.prototype.map = function (transform, callback) {
var _this = this;
var helpers = this.model.helpers;
return new Bluebird(function (resolve, reject) {
var promises = [];
_this.cursor.forEach(function (item) {
promises.push(_this.model.handlers.documentReceived(_this.conditions, item, function () { return helpers.wrapDocument.apply(helpers, arguments); })
map(transform, callback) {
let helpers = this.model.helpers;
return new Bluebird((resolve, reject) => {
let promises = [];
this.cursor.forEach((item) => {
promises.push(this.model.handlers.documentReceived(this.conditions, item, function () { return helpers.wrapDocument.apply(helpers, arguments); })
.then(transform));
}, function (err) {
}, (err) => {
if (err)

@@ -84,3 +81,3 @@ return reject(err);

}).nodeify(callback);
};
}
/**

@@ -91,7 +88,6 @@ * Retrieves all matching instances and returns them in an array

*/
Cursor.prototype.toArray = function (callback) {
var _this = this;
var helpers = this.model.helpers;
return new Bluebird(function (resolve, reject) {
_this.cursor.toArray(function (err, results) {
toArray(callback) {
let helpers = this.model.helpers;
return new Bluebird((resolve, reject) => {
this.cursor.toArray((err, results) => {
if (err)

@@ -101,6 +97,6 @@ return reject(err);

});
}).map(function (document) {
return _this.model.handlers.documentReceived(_this.conditions, document, function () { return helpers.wrapDocument.apply(helpers, arguments); });
}).map((document) => {
return this.model.handlers.documentReceived(this.conditions, document, function () { return helpers.wrapDocument.apply(helpers, arguments); });
}).nodeify(callback);
};
}
/**

@@ -111,6 +107,5 @@ * Retrieves the next item in the results list

*/
Cursor.prototype.next = function (callback) {
var _this = this;
return new Bluebird(function (resolve, reject) {
_this.cursor.next(function (err, result) {
next(callback) {
return new Bluebird((resolve, reject) => {
this.cursor.next((err, result) => {
if (err)

@@ -120,8 +115,8 @@ return reject(err);

});
}).then(function (document) {
}).then((document) => {
if (!document)
return Bluebird.resolve(null);
return _this.model.handlers.documentReceived(_this.conditions, document, function (document, isNew, isPartial) { return _this.model.helpers.wrapDocument(document, isNew, isPartial); });
return this.model.handlers.documentReceived(this.conditions, document, (document, isNew, isPartial) => this.model.helpers.wrapDocument(document, isNew, isPartial));
}).nodeify(callback);
};
}
/**

@@ -132,6 +127,5 @@ * Retrieves the next item in the result list and then closes the cursor

*/
Cursor.prototype.one = function (callback) {
var _this = this;
return new Bluebird(function (resolve, reject) {
_this.cursor.next(function (err, result) {
one(callback) {
return new Bluebird((resolve, reject) => {
this.cursor.next((err, result) => {
if (err)

@@ -141,5 +135,5 @@ return reject(err);

});
}).then(function (document) {
return new Bluebird(function (resolve, reject) {
_this.cursor.close(function (err) {
}).then((document) => {
return new Bluebird((resolve, reject) => {
this.cursor.close((err) => {
if (err)

@@ -150,8 +144,8 @@ return reject(err);

});
}).then(function (document) {
}).then((document) => {
if (!document)
return Bluebird.resolve(null);
return _this.model.handlers.documentReceived(_this.conditions, document, function (document, isNew, isPartial) { return _this.model.helpers.wrapDocument(document, isNew, isPartial); });
return this.model.handlers.documentReceived(this.conditions, document, (document, isNew, isPartial) => this.model.helpers.wrapDocument(document, isNew, isPartial));
}).nodeify(callback);
};
}
/**

@@ -161,6 +155,6 @@ * Returns a new cursor which behaves the same as this one did before any results were retrieved

*/
Cursor.prototype.rewind = function () {
rewind() {
this.cursor.rewind();
return this;
};
}
/**

@@ -171,5 +165,5 @@ * Returns a new cursor which sorts its results by the given index expression

*/
Cursor.prototype.sort = function (sortExpression) {
sort(sortExpression) {
return new Cursor(this.model, this.conditions, this.cursor.sort(sortExpression));
};
}
/**

@@ -180,5 +174,5 @@ * Returns a new cursor which limits the number of returned results

*/
Cursor.prototype.limit = function (limit) {
limit(limit) {
return new Cursor(this.model, this.conditions, this.cursor.limit(limit));
};
}
/**

@@ -190,5 +184,5 @@ * Returns a new cursor which skips a number of results before it begins

*/
Cursor.prototype.skip = function (skip) {
skip(skip) {
return new Cursor(this.model, this.conditions, this.cursor.skip(skip));
};
}
/**

@@ -199,9 +193,7 @@ * Returns a new cursor which will read from the specified node type.

*/
Cursor.prototype.readFrom = function (type) {
readFrom(type) {
return new Cursor(this.model, this.conditions, this.cursor.setReadPreference(type));
};
return Cursor;
}());
}
}
exports.Cursor = Cursor;
//# sourceMappingURL=Cursor.js.map
//# sourceMappingURL=Cursor.js.map
"use strict";
var MongoDB = require("mongodb");
var _ = require("lodash");
var Skmatc = require("skmatc");
var Transforms_1 = require("./Transforms");
const MongoDB = require("mongodb");
const _ = require("lodash");
const Skmatc = require("skmatc");
const Transforms_1 = require("./Transforms");
/**

@@ -48,16 +48,12 @@ * Specifies the name of the collection to which this instance's documents should be sent.

return function (target) {
target.validators = (target.validators || []).concat(Skmatc.create(function (schema) { return schema === forType; }, validate));
target.validators = (target.validators || []).concat(Skmatc.create(schema => schema === forType, validate));
};
}
exports.Validate = Validate;
function Property() {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i - 0] = arguments[_i];
}
var name = null, asType = false, required = true;
function Property(...args) {
let name = null, asType = false, required = true;
if (args.length > 1 && typeof args[args.length - 1] === "boolean")
required = args.pop();
return function (target, property) {
var staticTarget = target;
let staticTarget = target;
if (!property)

@@ -95,5 +91,4 @@ name = args.shift();

function Transform(fromDB, toDB) {
return function (target, property) {
if (property === void 0) { property = "$document"; }
var staticTarget = (target.constructor || target);
return function (target, property = "$document") {
let staticTarget = (target.constructor || target);
staticTarget.transforms = _.clone(staticTarget.transforms || {});

@@ -132,3 +127,2 @@ staticTarget.transforms[property] = {

exports.Binary = Binary;
//# sourceMappingURL=Decorators.js.map
//# sourceMappingURL=Decorators.js.map
"use strict";
//# sourceMappingURL=General.js.map
//# sourceMappingURL=General.js.map
"use strict";
//# sourceMappingURL=Hooks.js.map
//# sourceMappingURL=Hooks.js.map
"use strict";
//# sourceMappingURL=Index.js.map
//# sourceMappingURL=Index.js.map
"use strict";
var Validators_1 = require("./Validators");
var _ = require("lodash");
var Bluebird = require("bluebird");
const Validators_1 = require("./Validators");
const _ = require("lodash");
const Bluebird = require("bluebird");
/**

@@ -19,3 +19,3 @@ * The default Iridium Instance implementation which provides methods for saving, refreshing and

*/
var Instance = (function () {
class Instance {
/**

@@ -29,6 +29,3 @@ * Creates a new instance which represents the given document as a type of model

*/
function Instance(model, document, isNew, isPartial) {
var _this = this;
if (isNew === void 0) { isNew = true; }
if (isPartial === void 0) { isPartial = false; }
constructor(model, document, isNew = true, isPartial = false) {
this._model = model;

@@ -39,27 +36,18 @@ this._isNew = !!isNew;

this._modified = model.helpers.cloneDocument(document);
_.each(model.core.plugins, function (plugin) {
_.each(model.core.plugins, (plugin) => {
if (plugin.newInstance)
plugin.newInstance(_this, model);
plugin.newInstance(this, model);
});
}
Object.defineProperty(Instance.prototype, "document", {
/**
* Gets the underlying document representation of this instance
*/
get: function () {
return this._modified;
},
enumerable: true,
configurable: true
});
Instance.prototype.save = function () {
var _this = this;
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i - 0] = arguments[_i];
}
var callback = null;
var changes = null;
var conditions = {};
Array.prototype.slice.call(args, 0).reverse().forEach(function (arg) {
/**
* Gets the underlying document representation of this instance
*/
get document() {
return this._modified;
}
save(...args) {
let callback = null;
let changes = null;
let conditions = {};
Array.prototype.slice.call(args, 0).reverse().forEach((arg) => {
if (typeof arg == "function")

@@ -74,13 +62,13 @@ callback = arg;

});
return Bluebird.resolve().then(function () {
conditions = _this._model.helpers.cloneConditions(conditions);
_.merge(conditions, { _id: _this._modified._id });
return Bluebird.resolve().then(() => {
conditions = this._model.helpers.cloneConditions(conditions);
_.merge(conditions, { _id: this._modified._id });
if (!changes) {
var validation = _this._model.helpers.validate(_this._modified);
let validation = this._model.helpers.validate(this._modified);
if (validation.failed)
return Bluebird.reject(validation.error).bind(_this).nodeify(callback);
var original = _this._model.helpers.cloneDocument(_this._original);
var modified = _this._model.helpers.cloneDocument(_this._modified);
modified = _this._model.helpers.transformToDB(modified, { document: true });
changes = _this._model.helpers.diff(original, modified);
return Bluebird.reject(validation.error).bind(this).nodeify(callback);
let original = this._model.helpers.cloneDocument(this._original);
let modified = this._model.helpers.cloneDocument(this._modified);
modified = this._model.helpers.transformToDB(modified, { document: true });
changes = this._model.helpers.diff(original, modified);
}

@@ -90,12 +78,12 @@ if (!_.keys(changes).length)

return changes;
}).then(function (changes) {
if (!changes && !_this._isNew)
}).then((changes) => {
if (!changes && !this._isNew)
return changes;
return _this._model.handlers.savingDocument(_this, changes).then(function () { return changes; });
}).then(function (changes) {
if (!changes && !_this._isNew)
return this._model.handlers.savingDocument(this, changes).then(() => changes);
}).then((changes) => {
if (!changes && !this._isNew)
return false;
if (_this._isNew) {
return new Bluebird(function (resolve, reject) {
_this._model.collection.insertOne(_this._modified, { w: "majority" }, function (err, doc) {
if (this._isNew) {
return new Bluebird((resolve, reject) => {
this._model.collection.insertOne(this._modified, { w: "majority" }, (err, doc) => {
if (err)

@@ -108,4 +96,4 @@ return reject(err);

else {
return new Bluebird(function (resolve, reject) {
_this._model.collection.updateOne(conditions, changes, { w: "majority" }, function (err, changed) {
return new Bluebird((resolve, reject) => {
this._model.collection.updateOne(conditions, changes, { w: "majority" }, (err, changed) => {
if (err) {

@@ -120,12 +108,12 @@ err["conditions"] = conditions;

}
}).catch(function (err) {
err["original"] = _this._original;
err["modified"] = _this._modified;
}).catch(err => {
err["original"] = this._original;
err["modified"] = this._modified;
return Bluebird.reject(err);
}).then(function (changed) {
conditions = { _id: _this._modified._id };
}).then((changed) => {
conditions = { _id: this._modified._id };
if (!changed)
return _this._modified;
return new Bluebird(function (resolve, reject) {
_this._model.collection.find(conditions).limit(1).next(function (err, latest) {
return this._modified;
return new Bluebird((resolve, reject) => {
this._model.collection.find(conditions).limit(1).next((err, latest) => {
if (err)

@@ -136,17 +124,17 @@ return reject(err);

});
}).then(function (latest) {
}).then((latest) => {
if (!latest) {
_this._isNew = true;
_this._original = _this._model.helpers.cloneDocument(_this._modified);
return Bluebird.resolve(_this);
this._isNew = true;
this._original = this._model.helpers.cloneDocument(this._modified);
return Bluebird.resolve(this);
}
return _this._model.handlers.documentReceived(conditions, latest, function (value) {
_this._isPartial = false;
_this._isNew = false;
_this._modified = value;
_this._original = _this._model.helpers.cloneDocument(value);
return _this;
return this._model.handlers.documentReceived(conditions, latest, (value) => {
this._isPartial = false;
this._isNew = false;
this._modified = value;
this._original = this._model.helpers.cloneDocument(value);
return this;
});
}).nodeify(callback);
};
}
/**

@@ -157,5 +145,5 @@ * Updates this instance to match the latest document available in the backing collection

*/
Instance.prototype.update = function (callback) {
update(callback) {
return this.refresh(callback);
};
}
/**

@@ -166,8 +154,7 @@ * Updates this instance to match the latest document available in the backing collection

*/
Instance.prototype.refresh = function (callback) {
var _this = this;
var conditions = { _id: this._original._id };
return Bluebird.resolve().then(function () {
return new Bluebird(function (resolve, reject) {
_this._model.collection.find(conditions).limit(1).next(function (err, doc) {
refresh(callback) {
let conditions = { _id: this._original._id };
return Bluebird.resolve().then(() => {
return new Bluebird((resolve, reject) => {
this._model.collection.find(conditions).limit(1).next((err, doc) => {
if (err)

@@ -178,18 +165,18 @@ return reject(err);

});
}).then(function (newDocument) {
}).then((newDocument) => {
if (!newDocument) {
_this._isPartial = true;
_this._isNew = true;
_this._original = _this._model.helpers.cloneDocument(_this._modified);
return _this;
this._isPartial = true;
this._isNew = true;
this._original = this._model.helpers.cloneDocument(this._modified);
return this;
}
return _this._model.handlers.documentReceived(conditions, newDocument, function (doc) {
_this._isNew = false;
_this._isPartial = false;
_this._original = doc;
_this._modified = _this._model.helpers.cloneDocument(doc);
return _this;
return this._model.handlers.documentReceived(conditions, newDocument, (doc) => {
this._isNew = false;
this._isPartial = false;
this._original = doc;
this._modified = this._model.helpers.cloneDocument(doc);
return this;
});
}).nodeify(callback);
};
}
/**

@@ -200,5 +187,5 @@ * Removes this instance's document from the backing collection

*/
Instance.prototype.delete = function (callback) {
delete(callback) {
return this.remove(callback);
};
}
/**

@@ -209,10 +196,9 @@ * Removes this instance's document from the backing collection

*/
Instance.prototype.remove = function (callback) {
var _this = this;
var conditions = { _id: this._original._id };
return Bluebird.resolve().then(function () {
if (_this._isNew)
remove(callback) {
let conditions = { _id: this._original._id };
return Bluebird.resolve().then(() => {
if (this._isNew)
return 0;
return new Bluebird(function (resolve, reject) {
_this._model.collection.deleteOne(conditions, { w: "majority" }, function (err, removed) {
return new Bluebird((resolve, reject) => {
this._model.collection.deleteOne(conditions, { w: "majority" }, (err, removed) => {
if (err)

@@ -223,16 +209,15 @@ return reject(err);

});
}).then(function (removed) {
}).then((removed) => {
if (removed)
return _this._model.cache.clear(conditions);
return this._model.cache.clear(conditions);
return false;
}).then(function () {
_this._isNew = true;
return _this;
}).then(() => {
this._isNew = true;
return this;
}).nodeify(callback);
};
Instance.prototype.first = function (collection, predicate) {
var _this = this;
var result = null;
_.each(collection, function (value, key) {
if (predicate.call(_this, value, key)) {
}
first(collection, predicate) {
let result = null;
_.each(collection, (value, key) => {
if (predicate.call(this, value, key)) {
result = value;

@@ -243,9 +228,8 @@ return false;

return result;
};
Instance.prototype.select = function (collection, predicate) {
var _this = this;
var isArray = Array.isArray(collection);
var results = isArray ? [] : {};
_.each(collection, function (value, key) {
if (predicate.call(_this, value, key)) {
}
select(collection, predicate) {
let isArray = Array.isArray(collection);
let results = isArray ? [] : {};
_.each(collection, (value, key) => {
if (predicate.call(this, value, key)) {
if (isArray)

@@ -258,3 +242,3 @@ results.push(value);

return results;
};
}
/**

@@ -264,5 +248,5 @@ * Gets the JSON representation of this instance

*/
Instance.prototype.toJSON = function () {
toJSON() {
return this.document;
};
}
/**

@@ -272,27 +256,25 @@ * Gets a string representation of this instance

*/
Instance.prototype.toString = function () {
toString() {
return JSON.stringify(this.document, null, 2);
};
/**
* The schema used to validate documents of this type before being stored in the database.
*/
Instance.schema = {
_id: false
};
/**
* Additional which should be made available for use in the schema definition for this instance.
*/
Instance.validators = Validators_1.DefaultValidators();
/**
* The transformations which should be applied to properties of documents of this type.
*/
Instance.transforms = {};
/**
* The indexes which should be managed by Iridium for the collection used by this type.
*/
Instance.indexes = [];
return Instance;
}());
}
}
/**
* The schema used to validate documents of this type before being stored in the database.
*/
Instance.schema = {
_id: false
};
/**
* Additional which should be made available for use in the schema definition for this instance.
*/
Instance.validators = Validators_1.DefaultValidators();
/**
* The transformations which should be applied to properties of documents of this type.
*/
Instance.transforms = {};
/**
* The indexes which should be managed by Iridium for the collection used by this type.
*/
Instance.indexes = [];
exports.Instance = Instance;
//# sourceMappingURL=Instance.js.map
//# sourceMappingURL=Instance.js.map
"use strict";
//# sourceMappingURL=InstanceInterface.js.map
//# sourceMappingURL=InstanceInterface.js.map
"use strict";
//# sourceMappingURL=Middleware.js.map
//# sourceMappingURL=Middleware.js.map

@@ -20,3 +20,2 @@ "use strict";

exports.ExpressMiddlewareFactory = ExpressMiddlewareFactory;
//# sourceMappingURL=Express.js.map
//# sourceMappingURL=Express.js.map
"use strict";
var MongoDB = require("mongodb");
var Bluebird = require("bluebird");
var _ = require("lodash");
var Core_1 = require("./Core");
var Instance_1 = require("./Instance");
var Cursor_1 = require("./Cursor");
var ModelCache_1 = require("./ModelCache");
var ModelHelpers_1 = require("./ModelHelpers");
var ModelHandlers_1 = require("./ModelHandlers");
var ModelSpecificInstance_1 = require("./ModelSpecificInstance");
var Transforms_1 = require("./Transforms");
const MongoDB = require("mongodb");
const Bluebird = require("bluebird");
const _ = require("lodash");
const Core_1 = require("./Core");
const Instance_1 = require("./Instance");
const Cursor_1 = require("./Cursor");
const ModelCache_1 = require("./ModelCache");
const ModelHelpers_1 = require("./ModelHelpers");
const ModelHandlers_1 = require("./ModelHandlers");
const ModelSpecificInstance_1 = require("./ModelSpecificInstance");
const Transforms_1 = require("./Transforms");
/**

@@ -23,3 +23,3 @@ * An Iridium Model which represents a structured MongoDB collection.

*/
var Model = (function () {
class Model {
/**

@@ -31,3 +31,3 @@ * Creates a new Iridium model representing a given ISchema and backed by a collection whose name is specified

*/
function Model(core, instanceType) {
constructor(core, instanceType) {
this._hooks = {};

@@ -50,3 +50,3 @@ if (!(core instanceof Core_1.Core))

*/
Model.prototype.loadExternal = function (instanceType) {
loadExternal(instanceType) {
this._collection = instanceType.collection;

@@ -67,11 +67,11 @@ this._schema = instanceType.schema;

this._Instance = instanceType.bind(undefined, this);
};
}
/**
* Loads any internally (protected/private) properties and helpers only used within Iridium itself.
*/
Model.prototype.loadInternal = function () {
loadInternal() {
this._cache = new ModelCache_1.ModelCache(this);
this._helpers = new ModelHelpers_1.ModelHelpers(this);
this._handlers = new ModelHandlers_1.ModelHandlers(this);
};
}
/**

@@ -82,174 +82,121 @@ * Process any callbacks and plugin delegation for the creation of this model.

*/
Model.prototype.onNewModel = function () {
var _this = this;
this._core.plugins.forEach(function (plugin) { return plugin.newModel && plugin.newModel(_this); });
};
Object.defineProperty(Model.prototype, "helpers", {
/**
* Provides helper methods used by Iridium for common tasks
* @returns A set of helper methods which are used within Iridium for common tasks
*/
get: function () {
return this._helpers;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Model.prototype, "handlers", {
/**
* Provides helper methods used by Iridium for hook delegation and common processes
* @returns A set of helper methods which perform common event and response handling tasks within Iridium.
*/
get: function () {
return this._handlers;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Model.prototype, "hooks", {
/**
* Gets the even hooks subscribed on this model for a number of different state changes.
* These hooks are primarily intended to allow lifecycle manipulation logic to be added
* in the user's model definition, allowing tasks such as the setting of default values
* or automatic client-side joins to take place.
*/
get: function () {
return this._hooks;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Model.prototype, "schema", {
/**
* Gets the schema dictating the data structure represented by this model.
* The schema is used by skmatc to validate documents before saving to the database, however
* until MongoDB 3.1 becomes widely available (with server side validation support) we are
* limited in our ability to validate certain types of updates. As such, these validations
* act more as a data-integrity check than anything else, unless you purely make use of Omnom
* updates within instances.
* @public
* @returns The defined validation schema for this model
*/
get: function () {
return this._schema;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Model.prototype, "core", {
/**
* Gets the Iridium core that this model is associated with.
* @public
* @returns The Iridium core that this model is bound to
*/
get: function () {
return this._core;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Model.prototype, "collection", {
/**
* Gets the underlying MongoDB collection from which this model's documents are retrieved.
* You can make use of this object if you require any low level access to the MongoDB collection,
* however we recommend you make use of the Iridium methods whereever possible, as we cannot
* guarantee the accuracy of the type definitions for the underlying MongoDB driver.
* @public
* @returns {Collection}
*/
get: function () {
if (!this.core.connection)
throw new Error("Iridium Core not connected to a database.");
return this.core.connection.collection(this._collection);
},
enumerable: true,
configurable: true
});
Object.defineProperty(Model.prototype, "collectionName", {
/**
* Gets the name of the underlying MongoDB collection from which this model's documents are retrieved
* @public
*/
get: function () {
return this._collection;
},
/**
* Sets the name of the underlying MongoDB collection from which this model's documents are retrieved
* @public
*/
set: function (value) {
this._collection = value;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Model.prototype, "cacheDirector", {
/**
* Gets the cache controller which dictates which queries will be cached, and under which key
* @public
* @returns {CacheDirector}
*/
get: function () {
return this._cacheDirector;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Model.prototype, "cache", {
/**
* Gets the cache responsible for storing objects for quick retrieval under certain conditions
* @public
* @returns {ModelCache}
*/
get: function () {
return this._cache;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Model.prototype, "Instance", {
/**
* Gets the constructor responsible for creating instances for this model
*/
get: function () {
return this._Instance;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Model.prototype, "transforms", {
/**
* Gets the transforms which are applied whenever a document is received from the database, or
* prior to storing a document in the database. Tasks such as converting an ObjectID to a string
* and vice versa are all listed in this object.
*/
get: function () {
return this._transforms;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Model.prototype, "validators", {
/**
* Gets the custom validation types available for this model. These validators are added to the
* default skmatc validators, as well as those available through plugins, for use when checking
* your instances.
*/
get: function () {
return this._validators;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Model.prototype, "indexes", {
/**
* Gets the indexes which Iridium will manage on this model's database collection.
*/
get: function () {
return this._indexes;
},
enumerable: true,
configurable: true
});
Model.prototype.find = function (conditions, fields) {
onNewModel() {
this._core.plugins.forEach(plugin => plugin.newModel && plugin.newModel(this));
}
/**
* Provides helper methods used by Iridium for common tasks
* @returns A set of helper methods which are used within Iridium for common tasks
*/
get helpers() {
return this._helpers;
}
/**
* Provides helper methods used by Iridium for hook delegation and common processes
* @returns A set of helper methods which perform common event and response handling tasks within Iridium.
*/
get handlers() {
return this._handlers;
}
/**
* Gets the even hooks subscribed on this model for a number of different state changes.
* These hooks are primarily intended to allow lifecycle manipulation logic to be added
* in the user's model definition, allowing tasks such as the setting of default values
* or automatic client-side joins to take place.
*/
get hooks() {
return this._hooks;
}
/**
* Gets the schema dictating the data structure represented by this model.
* The schema is used by skmatc to validate documents before saving to the database, however
* until MongoDB 3.1 becomes widely available (with server side validation support) we are
* limited in our ability to validate certain types of updates. As such, these validations
* act more as a data-integrity check than anything else, unless you purely make use of Omnom
* updates within instances.
* @public
* @returns The defined validation schema for this model
*/
get schema() {
return this._schema;
}
/**
* Gets the Iridium core that this model is associated with.
* @public
* @returns The Iridium core that this model is bound to
*/
get core() {
return this._core;
}
/**
* Gets the underlying MongoDB collection from which this model's documents are retrieved.
* You can make use of this object if you require any low level access to the MongoDB collection,
* however we recommend you make use of the Iridium methods whereever possible, as we cannot
* guarantee the accuracy of the type definitions for the underlying MongoDB driver.
* @public
* @returns {Collection}
*/
get collection() {
if (!this.core.connection)
throw new Error("Iridium Core not connected to a database.");
return this.core.connection.collection(this._collection);
}
/**
* Gets the name of the underlying MongoDB collection from which this model's documents are retrieved
* @public
*/
get collectionName() {
return this._collection;
}
/**
* Sets the name of the underlying MongoDB collection from which this model's documents are retrieved
* @public
*/
set collectionName(value) {
this._collection = value;
}
/**
* Gets the cache controller which dictates which queries will be cached, and under which key
* @public
* @returns {CacheDirector}
*/
get cacheDirector() {
return this._cacheDirector;
}
/**
* Gets the cache responsible for storing objects for quick retrieval under certain conditions
* @public
* @returns {ModelCache}
*/
get cache() {
return this._cache;
}
/**
* Gets the constructor responsible for creating instances for this model
*/
get Instance() {
return this._Instance;
}
/**
* Gets the transforms which are applied whenever a document is received from the database, or
* prior to storing a document in the database. Tasks such as converting an ObjectID to a string
* and vice versa are all listed in this object.
*/
get transforms() {
return this._transforms;
}
/**
* Gets the custom validation types available for this model. These validators are added to the
* default skmatc validators, as well as those available through plugins, for use when checking
* your instances.
*/
get validators() {
return this._validators;
}
/**
* Gets the indexes which Iridium will manage on this model's database collection.
*/
get indexes() {
return this._indexes;
}
find(conditions, fields) {
conditions = conditions || {};

@@ -259,24 +206,15 @@ if (!_.isPlainObject(conditions))

conditions = this._helpers.convertToDB(conditions);
var cursor = this.collection.find(conditions);
let cursor = this.collection.find(conditions);
if (fields)
cursor = cursor.project(fields);
return new Cursor_1.Cursor(this, conditions, cursor);
};
Model.prototype.get = function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i - 0] = arguments[_i];
}
}
get(...args) {
return this.findOne.apply(this, args);
};
Model.prototype.findOne = function () {
var _this = this;
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i - 0] = arguments[_i];
}
var conditions = null;
var options = null;
var callback = null;
for (var argI = 0; argI < args.length; argI++) {
}
findOne(...args) {
let conditions = null;
let options = null;
let callback = null;
for (let argI = 0; argI < args.length; argI++) {
if (typeof args[argI] === "function")

@@ -298,10 +236,10 @@ callback = callback || args[argI];

});
return Bluebird.resolve().bind(this).then(function () {
conditions = _this._helpers.convertToDB(conditions);
return _this._cache.get(conditions);
}).then(function (cachedDocument) {
return Bluebird.resolve().bind(this).then(() => {
conditions = this._helpers.convertToDB(conditions);
return this._cache.get(conditions);
}).then((cachedDocument) => {
if (cachedDocument)
return cachedDocument;
return new Bluebird(function (resolve, reject) {
var cursor = _this.collection.find(conditions);
return new Bluebird((resolve, reject) => {
let cursor = this.collection.find(conditions);
if (options.sort)

@@ -314,3 +252,3 @@ cursor = cursor.sort(options.sort);

cursor = cursor.project(options.fields);
return cursor.next(function (err, result) {
return cursor.next((err, result) => {
if (err)

@@ -321,24 +259,15 @@ return reject(err);

});
}).then(function (document) {
}).then((document) => {
if (!document)
return null;
return _this._handlers.documentReceived(conditions, document, function (document, isNew, isPartial) { return _this._helpers.wrapDocument(document, isNew, isPartial); }, options);
return this._handlers.documentReceived(conditions, document, (document, isNew, isPartial) => this._helpers.wrapDocument(document, isNew, isPartial), options);
}).nodeify(callback);
};
Model.prototype.create = function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i - 0] = arguments[_i];
}
}
create(...args) {
return this.insert.apply(this, args);
};
Model.prototype.insert = function (objs) {
var _this = this;
var args = [];
for (var _i = 1; _i < arguments.length; _i++) {
args[_i - 1] = arguments[_i];
}
var objects;
var options = {};
var callback = null;
}
insert(objs, ...args) {
let objects;
let options = {};
let callback = null;
if (typeof args[0] === "function")

@@ -359,12 +288,12 @@ callback = args[0];

});
return Bluebird.resolve().then(function () {
var queryOptions = { w: options.w, upsert: options.upsert, new: true };
return Bluebird.resolve().then(() => {
let queryOptions = { w: options.w, upsert: options.upsert, new: true };
if (options.upsert) {
var docs = _this._handlers.creatingDocuments(objects);
return docs.map(function (object) {
return new Bluebird(function (resolve, reject) {
_this.collection.findOneAndUpdate({ _id: object._id }, object, {
let docs = this._handlers.creatingDocuments(objects);
return docs.map((object) => {
return new Bluebird((resolve, reject) => {
this.collection.findOneAndUpdate({ _id: object._id }, object, {
upsert: options.upsert,
returnOriginal: false
}, function (err, result) {
}, (err, result) => {
if (err)

@@ -378,5 +307,5 @@ return reject(err);

else
return _this._handlers.creatingDocuments(objects).then(function (objects) { return _.chunk(objects, 1000); }).map(function (objects) {
return new Bluebird(function (resolve, reject) {
_this.collection.insertMany(objects, queryOptions, function (err, result) {
return this._handlers.creatingDocuments(objects).then(objects => _.chunk(objects, 1000)).map((objects) => {
return new Bluebird((resolve, reject) => {
this.collection.insertMany(objects, queryOptions, (err, result) => {
if (err)

@@ -387,6 +316,6 @@ return reject(err);

});
}).then(function (results) { return _.flatten(results); });
}).map(function (inserted) {
return _this._handlers.documentReceived(null, inserted, function (document, isNew, isPartial) { return _this._helpers.wrapDocument(document, isNew, isPartial); }, { cache: options.cache });
}).then(function (results) {
}).then(results => _.flatten(results));
}).map((inserted) => {
return this._handlers.documentReceived(null, inserted, (document, isNew, isPartial) => this._helpers.wrapDocument(document, isNew, isPartial), { cache: options.cache });
}).then((results) => {
if (Array.isArray(objs))

@@ -396,5 +325,4 @@ return results;

}).nodeify(callback);
};
Model.prototype.update = function (conditions, changes, options, callback) {
var _this = this;
}
update(conditions, changes, options, callback) {
if (typeof options === "function") {

@@ -413,6 +341,6 @@ callback = options;

});
return Bluebird.resolve().then(function () {
conditions = _this._helpers.convertToDB(conditions);
return new Bluebird(function (resolve, reject) {
_this.collection.updateMany(conditions, changes, options, function (err, response) {
return Bluebird.resolve().then(() => {
conditions = this._helpers.convertToDB(conditions);
return new Bluebird((resolve, reject) => {
this.collection.updateMany(conditions, changes, options, (err, response) => {
if (err)

@@ -428,6 +356,5 @@ return reject(err);

}).nodeify(callback);
};
Model.prototype.count = function (conds, callback) {
var _this = this;
var conditions = conds;
}
count(conds, callback) {
let conditions = conds;
if (typeof conds === "function") {

@@ -442,6 +369,6 @@ callback = conds;

};
return Bluebird.resolve().then(function () {
conditions = _this._helpers.convertToDB(conditions);
return new Bluebird(function (resolve, reject) {
_this.collection.count(conditions, function (err, results) {
return Bluebird.resolve().then(() => {
conditions = this._helpers.convertToDB(conditions);
return new Bluebird((resolve, reject) => {
this.collection.count(conditions, (err, results) => {
if (err)

@@ -453,6 +380,5 @@ return reject(err);

}).nodeify(callback);
};
Model.prototype.remove = function (conds, options, callback) {
var _this = this;
var conditions = conds;
}
remove(conds, options, callback) {
let conditions = conds;
if (typeof options === "function") {

@@ -476,7 +402,7 @@ callback = options;

};
return Bluebird.resolve().then(function () {
conditions = _this._helpers.convertToDB(conditions);
return new Bluebird(function (resolve, reject) {
return Bluebird.resolve().then(() => {
conditions = this._helpers.convertToDB(conditions);
return new Bluebird((resolve, reject) => {
if (options.single)
return _this.collection.deleteOne(conditions, options, function (err, response) {
return this.collection.deleteOne(conditions, options, (err, response) => {
if (err)

@@ -486,3 +412,3 @@ return reject(err);

});
_this.collection.deleteMany(conditions, options, function (err, response) {
this.collection.deleteMany(conditions, options, (err, response) => {
if (err)

@@ -493,12 +419,11 @@ return reject(err);

});
}).then(function (count) {
}).then((count) => {
if (count === 1)
_this._cache.clear(conditions);
this._cache.clear(conditions);
return Bluebird.resolve(count);
}).nodeify(callback);
};
Model.prototype.aggregate = function (pipeline) {
var _this = this;
return new Bluebird(function (resolve, reject) {
_this.collection.aggregate(pipeline, function (err, results) {
}
aggregate(pipeline) {
return new Bluebird((resolve, reject) => {
this.collection.aggregate(pipeline, (err, results) => {
if (err)

@@ -509,5 +434,4 @@ return reject(err);

});
};
Model.prototype.ensureIndex = function (specification, options, callback) {
var _this = this;
}
ensureIndex(specification, options, callback) {
if (typeof options === "function") {

@@ -517,4 +441,4 @@ callback = options;

}
return new Bluebird(function (resolve, reject) {
_this.collection.createIndex(specification, options, function (err, name) {
return new Bluebird((resolve, reject) => {
this.collection.createIndex(specification, options, (err, name) => {
if (err)

@@ -525,3 +449,3 @@ return reject(err);

}).nodeify(callback);
};
}
/**

@@ -532,18 +456,16 @@ * Ensures that all indexes defined in the model's options are created

*/
Model.prototype.ensureIndexes = function (callback) {
var _this = this;
return Bluebird.resolve(this._indexes).map(function (index) {
return _this.ensureIndex(index.spec || index, index.options || {});
ensureIndexes(callback) {
return Bluebird.resolve(this._indexes).map((index) => {
return this.ensureIndex(index.spec || index, index.options || {});
}).nodeify(callback);
};
Model.prototype.dropIndex = function (specification, callback) {
var _this = this;
var index;
}
dropIndex(specification, callback) {
let index;
if (typeof (specification) === "string")
index = specification;
else {
index = _(specification).map(function (direction, key) { return (key + "_" + direction); }).reduce(function (x, y) { return (x + "_" + y); });
index = _(specification).map((direction, key) => `${key}_${direction}`).reduce((x, y) => `${x}_${y}`);
}
return new Bluebird(function (resolve, reject) {
_this.collection.dropIndex(index, function (err, result) {
return new Bluebird((resolve, reject) => {
this.collection.dropIndex(index, (err, result) => {
if (err)

@@ -554,3 +476,3 @@ return reject(err);

}).nodeify(callback);
};
}
/**

@@ -561,6 +483,5 @@ * Removes all indexes (except for _id) from the collection

*/
Model.prototype.dropIndexes = function (callback) {
var _this = this;
return new Bluebird(function (resolve, reject) {
_this.collection.dropIndexes(function (err, count) {
dropIndexes(callback) {
return new Bluebird((resolve, reject) => {
this.collection.dropIndexes((err, count) => {
if (err)

@@ -571,7 +492,5 @@ return reject(err);

}).nodeify(callback);
};
return Model;
}());
}
}
exports.Model = Model;
//# sourceMappingURL=Model.js.map
//# sourceMappingURL=Model.js.map
"use strict";
var Bluebird = require("bluebird");
const Bluebird = require("bluebird");
/**

@@ -8,25 +8,23 @@ * A centralized class which ties the cache and cache directors together in a cohesive way

*/
var ModelCache = (function () {
function ModelCache(model) {
class ModelCache {
constructor(model) {
this.model = model;
}
ModelCache.prototype.set = function (value) {
set(value) {
if (!this.model.cacheDirector || !this.model.cacheDirector.valid(value))
return;
this.model.core.cache.set(this.model.cacheDirector.buildKey(value), value);
};
ModelCache.prototype.get = function (conditions) {
}
get(conditions) {
if (!this.model.cacheDirector || !this.model.cacheDirector.validQuery(conditions))
return Bluebird.resolve(null);
return Bluebird.resolve(this.model.core.cache.get(this.model.cacheDirector.buildQueryKey(conditions)));
};
ModelCache.prototype.clear = function (conditions) {
}
clear(conditions) {
if (!this.model.cacheDirector || !this.model.cacheDirector.validQuery(conditions))
return;
this.model.core.cache.clear(this.model.cacheDirector.buildQueryKey(conditions));
};
return ModelCache;
}());
}
}
exports.ModelCache = ModelCache;
//# sourceMappingURL=ModelCache.js.map
//# sourceMappingURL=ModelCache.js.map
"use strict";
var _ = require("lodash");
var Bluebird = require("bluebird");
const _ = require("lodash");
const Bluebird = require("bluebird");
/**

@@ -12,9 +12,7 @@ * Provides a number of methods which are used to handle events that occur within

*/
var ModelHandlers = (function () {
function ModelHandlers(model) {
class ModelHandlers {
constructor(model) {
this.model = model;
}
ModelHandlers.prototype.documentReceived = function (conditions, result, wrapper, options) {
var _this = this;
if (options === void 0) { options = {}; }
documentReceived(conditions, result, wrapper, options = {}) {
_.defaults(options, {

@@ -24,30 +22,29 @@ cache: true,

});
var wrapped;
return Bluebird.resolve(this.model.helpers.transformFromDB(result, { document: true })).then(function (target) {
let wrapped;
return Bluebird.resolve(this.model.helpers.transformFromDB(result, { document: true })).then((target) => {
return Bluebird
.resolve(_this.model.hooks.onRetrieved && _this.model.hooks.onRetrieved(target))
.then(function () {
.resolve(this.model.hooks.onRetrieved && this.model.hooks.onRetrieved(target))
.then(() => {
// Cache the document if caching is enabled
if (_this.model.core.cache && options.cache && !options.fields) {
_this.model.cache.set(target); // Does not block execution pipeline - fire and forget
if (this.model.core.cache && options.cache && !options.fields) {
this.model.cache.set(target); // Does not block execution pipeline - fire and forget
}
// Wrap the document and trigger the ready hook
var wrapped = wrapper(target, false, !!options.fields);
let wrapped = wrapper(target, false, !!options.fields);
// Only incur the additional promise's performance penalty if this hook is being used
if (_this.model.hooks.onReady)
if (this.model.hooks.onReady)
return Bluebird
.resolve(_this.model.hooks.onReady(wrapped))
.then(function () { return wrapped; });
.resolve(this.model.hooks.onReady(wrapped))
.then(() => wrapped);
return wrapped;
});
});
};
ModelHandlers.prototype.creatingDocuments = function (documents) {
var _this = this;
return Bluebird.all(documents.map(function (document) {
}
creatingDocuments(documents) {
return Bluebird.all(documents.map((document) => {
return Bluebird
.resolve(_this.model.hooks.onCreating && _this.model.hooks.onCreating(document))
.then(function () {
document = _this.model.helpers.convertToDB(document, { document: true, properties: true });
var validation = _this.model.helpers.validate(document);
.resolve(this.model.hooks.onCreating && this.model.hooks.onCreating(document))
.then(() => {
document = this.model.helpers.convertToDB(document, { document: true, properties: true });
let validation = this.model.helpers.validate(document);
if (validation.failed)

@@ -58,14 +55,12 @@ return Bluebird.reject(validation.error);

}));
};
ModelHandlers.prototype.savingDocument = function (instance, changes) {
}
savingDocument(instance, changes) {
return Bluebird
.resolve(this.model.hooks.onSaving && this.model.hooks.onSaving(instance, changes))
.then(function () {
.then(() => {
return instance;
});
};
return ModelHandlers;
}());
}
}
exports.ModelHandlers = ModelHandlers;
//# sourceMappingURL=ModelHandlers.js.map
//# sourceMappingURL=ModelHandlers.js.map
"use strict";
var MongoDB = require("mongodb");
var Skmatc = require("skmatc");
var Omnom_1 = require("./utils/Omnom");
var _ = require("lodash");
const MongoDB = require("mongodb");
const Skmatc = require("skmatc");
const Omnom_1 = require("./utils/Omnom");
const _ = require("lodash");
/**

@@ -12,8 +12,7 @@ * A number of helper methods used commonly within Iridium, they provide a means to transform,

*/
var ModelHelpers = (function () {
function ModelHelpers(model) {
var _this = this;
class ModelHelpers {
constructor(model) {
this.model = model;
this._validator = Skmatc.scope(model.schema);
model.validators.forEach(function (validator) { return _this._validator.register(validator); });
model.validators.forEach(validator => this._validator.register(validator));
}

@@ -25,5 +24,5 @@ /**

*/
ModelHelpers.prototype.validate = function (document) {
validate(document) {
return this._validator.validate(document);
};
}
/**

@@ -36,5 +35,5 @@ * Wraps the given document in an instance wrapper for use throughout the application

*/
ModelHelpers.prototype.wrapDocument = function (document, isNew, isPartial) {
wrapDocument(document, isNew, isPartial) {
return new this.model.Instance(document, isNew, isPartial);
};
}
/**

@@ -47,4 +46,3 @@ * Converts the given document to its database form into a form

*/
ModelHelpers.prototype.transformToDB = function (document, options) {
if (options === void 0) { options = { properties: true }; }
transformToDB(document, options = { properties: true }) {
if (options.document && this.model.transforms.$document)

@@ -54,3 +52,3 @@ document = this.model.transforms.$document.toDB(document, "$document", this.model);

return document;
for (var property in this.model.transforms)
for (let property in this.model.transforms)
if (property === "$document")

@@ -62,3 +60,3 @@ continue;

return document;
};
}
/**

@@ -73,4 +71,3 @@ * Converts the given document from its database form using the

*/
ModelHelpers.prototype.transformFromDB = function (document, options) {
if (options === void 0) { options = { properties: true }; }
transformFromDB(document, options = { properties: true }) {
if (options.document && this.model.transforms.$document)

@@ -80,3 +77,3 @@ document = this.model.transforms.$document.fromDB(document, "$document", this.model);

return document;
for (var property in this.model.transforms)
for (let property in this.model.transforms)
if (property === "$document")

@@ -88,3 +85,3 @@ continue;

return document;
};
}
/**

@@ -98,7 +95,6 @@ * Converts the given document to its database form into a form

*/
ModelHelpers.prototype.convertToDB = function (document, options) {
if (options === void 0) { options = { properties: true }; }
var doc = this.cloneDocument(document);
convertToDB(document, options = { properties: true }) {
let doc = this.cloneDocument(document);
return this.transformToDB(doc, options);
};
}
/**

@@ -109,7 +105,7 @@ * Performs a diff operation between two documents and creates a MongoDB changes object to represent the differences

*/
ModelHelpers.prototype.diff = function (original, modified) {
var omnom = new Omnom_1.Omnom();
diff(original, modified) {
let omnom = new Omnom_1.Omnom();
omnom.diff(original, modified);
return omnom.changes;
};
}
/**

@@ -121,4 +117,4 @@ * Clones the given document recursively, taking into account complex types like

*/
ModelHelpers.prototype.cloneDocument = function (original) {
return _.cloneDeepWith(original, function (value) {
cloneDocument(original) {
return _.cloneDeepWith(original, (value) => {
if (Buffer.isBuffer(value)) {

@@ -134,3 +130,3 @@ return value;

});
};
}
/**

@@ -143,9 +139,7 @@ * Clones the given document recursively, taking into account complex types like

*/
ModelHelpers.prototype.cloneConditions = function (original) {
cloneConditions(original) {
return this.cloneDocument(original);
};
return ModelHelpers;
}());
}
}
exports.ModelHelpers = ModelHelpers;
//# sourceMappingURL=ModelHelpers.js.map
//# sourceMappingURL=ModelHelpers.js.map
"use strict";
//# sourceMappingURL=ModelInterfaces.js.map
//# sourceMappingURL=ModelInterfaces.js.map
"use strict";
//# sourceMappingURL=ModelOptions.js.map
//# sourceMappingURL=ModelOptions.js.map
"use strict";
var __extends = (this && this.__extends) || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var _ = require("lodash");
const _ = require("lodash");
/**

@@ -21,15 +16,10 @@ * Creates a new subclass of the given instanceType which correctly performs property transforms

function ModelSpecificInstance(model, instanceType) {
var instanceTypeConstructor = instanceType;
var virtualClass = (function (_super) {
__extends(class_1, _super);
function class_1() {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i - 0] = arguments[_i];
}
_super.apply(this, [model].concat(args));
const instanceTypeConstructor = instanceType;
let virtualClass = class extends instanceTypeConstructor {
constructor(...args) {
super(model, ...args);
}
return class_1;
}(instanceTypeConstructor));
_.each(Object.keys(model.schema), function (property) {
}
;
_.each(Object.keys(model.schema), (property) => {
if (model.transforms.hasOwnProperty(property)) {

@@ -60,3 +50,2 @@ return Object.defineProperty(virtualClass.prototype, property, {

exports.ModelSpecificInstance = ModelSpecificInstance;
//# sourceMappingURL=ModelSpecificInstance.js.map
//# sourceMappingURL=ModelSpecificInstance.js.map
"use strict";
//# sourceMappingURL=Plugins.js.map
//# sourceMappingURL=Plugins.js.map
"use strict";
//# sourceMappingURL=Schema.js.map
//# sourceMappingURL=Schema.js.map
"use strict";
var BSON_1 = require("./BSON");
const BSON_1 = require("./BSON");
exports.DefaultTransforms = {
ObjectID: {
fromDB: function (value) { return value instanceof BSON_1.ObjectID ? value.toHexString() : value; },
toDB: function (value) { return typeof value === "string" ? new BSON_1.ObjectID(value) : value; }
fromDB: value => value instanceof BSON_1.ObjectID ? value.toHexString() : value,
toDB: value => typeof value === "string" ? new BSON_1.ObjectID(value) : value
},
Binary: {
fromDB: function (value) {
fromDB: value => {
if (!value)

@@ -16,3 +16,3 @@ return null;

},
toDB: function (value) {
toDB: value => {
if (Buffer.isBuffer(value))

@@ -26,3 +26,2 @@ return new BSON_1.Binary(value);

};
//# sourceMappingURL=Transforms.js.map
//# sourceMappingURL=Transforms.js.map
"use strict";
var MongoDB = require("mongodb");
const MongoDB = require("mongodb");
/**

@@ -20,3 +20,2 @@ * Converts a string to an ObjectID instance - a shortcut for require("mongodb").ObjectID.createFromHexString

exports.toObjectID = toObjectID;
//# sourceMappingURL=ObjectID.js.map
//# sourceMappingURL=ObjectID.js.map
"use strict";
var _ = require("lodash");
var MongoDB = require("mongodb");
var Omnom = (function () {
function Omnom(options) {
if (options === void 0) { options = {}; }
const _ = require("lodash");
const MongoDB = require("mongodb");
class Omnom {
constructor(options = {}) {
this.options = options;
this._changes = {};
}
Object.defineProperty(Omnom.prototype, "changes", {
get: function () {
return this._changes;
},
enumerable: true,
configurable: true
});
Omnom.prototype.diff = function (original, modified) {
get changes() {
return this._changes;
}
diff(original, modified) {
this.onObject(original, modified);
return this;
};
Omnom.diff = function (original, modified, options) {
}
static diff(original, modified, options) {
return new Omnom(options).diff(original, modified).changes;
};
Omnom.prototype.onObject = function (original, modified, changePath) {
var _this = this;
}
onObject(original, modified, changePath) {
if (original === undefined || original === null)

@@ -39,16 +33,16 @@ return (original !== modified) && this.set(changePath, modified);

return !_.isEqual(original, modified) && this.set(changePath, modified);
_.forOwn(modified, function (value, key) {
_.forOwn(modified, (value, key) => {
// Handle array diffs in their own special way
if (Array.isArray(value) && Array.isArray(original[key]))
_this.onArray(original[key], value, _this.resolve(changePath, key));
this.onArray(original[key], value, this.resolve(changePath, key));
else
_this.onObject(original[key], value, _this.resolve(changePath, key));
this.onObject(original[key], value, this.resolve(changePath, key));
}, this);
// Unset removed properties
_.forOwn(original, function (value, key) {
_.forOwn(original, (value, key) => {
if (modified[key] === undefined)
return _this.unset(_this.resolve(changePath, key));
return this.unset(this.resolve(changePath, key));
}, this);
};
Omnom.prototype.onArray = function (original, modified, changePath) {
}
onArray(original, modified, changePath) {
// Check if we can get from original => modified using just pulls

@@ -64,8 +58,7 @@ if (original.length > modified.length) {

return this.onSimilarArray(original, modified, changePath);
};
Omnom.prototype.onSmallerArray = function (original, modified, changePath) {
var _this = this;
var pulls = [];
var i = 0;
var j = 0;
}
onSmallerArray(original, modified, changePath) {
let pulls = [];
let i = 0;
let j = 0;
for (; i < original.length && j < modified.length; i++) {

@@ -83,10 +76,10 @@ if (this.almostEqual(original[i], modified[j]))

// We can complete using just pulls
return pulls.forEach(function (pull) { return _this.pull(changePath, pull); });
return pulls.forEach((pull) => this.pull(changePath, pull));
}
else
return this.set(changePath, modified);
};
Omnom.prototype.onLargerArray = function (original, modified, changePath) {
var canPush = true;
for (var i = 0; i < original.length; i++)
}
onLargerArray(original, modified, changePath) {
let canPush = true;
for (let i = 0; i < original.length; i++)
if (this.almostEqual(original[i], modified[i]) < 1) {

@@ -97,3 +90,3 @@ canPush = false;

if (canPush) {
for (var i = original.length; i < modified.length; i++)
for (let i = original.length; i < modified.length; i++)
this.push(changePath, modified[i]);

@@ -103,10 +96,10 @@ return;

return this.onSimilarArray(original, modified, changePath);
};
Omnom.prototype.onSimilarArray = function (original, modified, changePath) {
}
onSimilarArray(original, modified, changePath) {
// Check how many manipulations would need to be performed, if it's more than half the array size
// then rather re-create the array
var sets = [];
var partials = [];
for (var i = 0; i < modified.length; i++) {
var equality = this.almostEqual(original[i], modified[i]);
let sets = [];
let partials = [];
for (let i = 0; i < modified.length; i++) {
let equality = this.almostEqual(original[i], modified[i]);
if (equality === 0)

@@ -119,23 +112,23 @@ sets.push(i);

return this.set(changePath, modified);
for (var i = 0; i < sets.length; i++)
for (let i = 0; i < sets.length; i++)
this.set(this.resolve(changePath, sets[i].toString()), modified[sets[i]]);
for (var i = 0; i < partials.length; i++)
for (let i = 0; i < partials.length; i++)
this.onObject(original[partials[i]], modified[partials[i]], this.resolve(changePath, partials[i].toString()));
};
Omnom.prototype.set = function (path, value) {
}
set(path, value) {
if (!this.changes.$set)
this.changes.$set = {};
this.changes.$set[path] = value;
};
Omnom.prototype.unset = function (path) {
}
unset(path) {
if (!this.changes.$unset)
this.changes.$unset = {};
this.changes.$unset[path] = 1;
};
Omnom.prototype.inc = function (path, value) {
}
inc(path, value) {
if (!this.changes.$inc)
this.changes.$inc = {};
this.changes.$inc[path] = value;
};
Omnom.prototype.push = function (path, value) {
}
push(path, value) {
if (!this.changes.$push)

@@ -151,4 +144,4 @@ this.changes.$push = {};

this.changes.$push[path] = value;
};
Omnom.prototype.pull = function (path, value) {
}
pull(path, value) {
if (!this.changes.$pull)

@@ -167,14 +160,10 @@ this.changes.$pull = {};

this.changes.$pull[path] = value;
};
Omnom.prototype.pullAll = function (path, values) {
}
pullAll(path, values) {
if (!this.changes.$pullAll)
this.changes.$pullAll = {};
this.changes.$pullAll[path] = values;
};
Omnom.prototype.resolve = function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i - 0] = arguments[_i];
}
var validArguments = [];
}
resolve(...args) {
let validArguments = [];
args.forEach(function (arg) {

@@ -185,24 +174,22 @@ if (arg)

return validArguments.join(".");
};
Omnom.prototype.almostEqual = function (o1, o2) {
}
almostEqual(o1, o2) {
if (!_.isPlainObject(o1) || !_.isPlainObject(o2))
return o1 == o2 ? 1 : 0;
var object1KeyIndex, object1Keys = Object.keys(o1);
var object2Keys = Object.keys(o2);
var commonKeys = [];
let object1KeyIndex, object1Keys = Object.keys(o1);
let object2Keys = Object.keys(o2);
let commonKeys = [];
for (object1KeyIndex = 0; object1KeyIndex < object1Keys.length; object1KeyIndex++)
if (~object2Keys.indexOf(object1Keys[object1KeyIndex]))
commonKeys.push(object1Keys[object1KeyIndex]);
var totalKeys = object1Keys.length + object2Keys.length - commonKeys.length;
var keysDifference = totalKeys - commonKeys.length;
var requiredChanges = 0;
for (var i = 0; i < commonKeys.length; i++)
let totalKeys = object1Keys.length + object2Keys.length - commonKeys.length;
let keysDifference = totalKeys - commonKeys.length;
let requiredChanges = 0;
for (let i = 0; i < commonKeys.length; i++)
if (this.almostEqual(o1[commonKeys[i]], o2[commonKeys[i]]) < 1)
requiredChanges++;
return 1 - (keysDifference / totalKeys) - (requiredChanges / commonKeys.length);
};
return Omnom;
}());
}
}
exports.Omnom = Omnom;
//# sourceMappingURL=Omnom.js.map
//# sourceMappingURL=Omnom.js.map
"use strict";
var MongoDB = require("mongodb");
var Skmatc = require("skmatc");
const MongoDB = require("mongodb");
const Skmatc = require("skmatc");
function DefaultValidators() {
return [
Skmatc.create(function (schema) { return schema === MongoDB.ObjectID; }, function (schema, data) {
Skmatc.create(schema => schema === MongoDB.ObjectID, function (schema, data) {
return this.assert(!data || data instanceof MongoDB.ObjectID || (data._bsontype === "ObjectID" && data.id), "Expected " + JSON.stringify(data) + " to be a valid MongoDB.ObjectID object");
}, { name: "ObjectID validation" }),
Skmatc.create(function (schema) { return schema === Buffer; }, function (schema, data) {
Skmatc.create(schema => schema === Buffer, function (schema, data) {
return this.assert(data && (data instanceof MongoDB.Binary || (data._bsontype === "Binary" && data.buffer)), "Expected " + JSON.stringify(data) + " to be a valid MongoDB.Binary object");

@@ -15,3 +15,2 @@ }, { name: "Buffer validation" })

exports.DefaultValidators = DefaultValidators;
//# sourceMappingURL=Validators.js.map
//# sourceMappingURL=Validators.js.map
{
"name": "iridium",
"version": "7.0.0-alpha.8",
"version": "7.0.0-alpha.9",
"author": "Benjamin Pannell <admin@sierrasoftworks.com>",

@@ -21,9 +21,26 @@ "description": "A custom lightweight ORM for MongoDB designed for power-users",

"scripts": {
"test": "gulp ci",
"prepublish": "gulp bundle",
"postversion": "gulp version",
"coverage": "gulp coverage",
"lint": "jshint lib/",
"benchmark": "node ./benchmarks/mongodb.js",
"build": "gulp build"
"build": "tsc",
"build:definitions": "node ./build/bundle.js",
"prepublish": "npm run build && npm run build:definitions",
"pretest": "npm run build",
"test": "mocha --opts test/mocha.opts dist/test",
"coverage": "istanbul cover node_modules/mocha/bin/_mocha -- --opts test/mocha.opts dist/test",
"lint": "tslint lib/",
"git:stash": "git stash",
"git:stash:pop": "git stash pop",
"changelog": "node build/changelog.js",
"doc": "npm run doc:build && npm run doc:publish && npm run doc:submodule",
"predoc:build": "cd ./doc && git checkout gh-pages",
"doc:build": "typedoc --out ./doc --mode file --name Iridium typings/index.d.ts iridium.ts",
"postdoc:build": "echo gitdir: ../.git/modules/doc> ./doc/.git",
"doc:stage": "cd ./doc && git add -A",
"doc:commit": "cd ./doc && git diff --cached --exit-code && git commit -m \"doc: Update documentation\" || true",
"doc:push": "cd ./doc && git push",
"doc:publish": "npm run doc:stage && npm run doc:commit && npm run doc:push",
"doc:submodule": "npm run doc:submodule:commit",
"doc:submodule:commit": "git commit doc -m \"doc: Update documentation\"",
"postversion": "npm run version:tag",
"version:tag": "npm run exec -- git tag -a v$npm_package_version -m \"Version $npm_package_version\"",
"version:get": "npm run exec -- echo -e $npm_package_version",
"exec": "node ./build/exec.js"
},

@@ -43,29 +60,14 @@ "typings": "iridium.ts",

"chai-as-promised": "^5.2.0",
"chalk": "^1.1.3",
"codeclimate-test-reporter": "^0.3.1",
"colors": "^1.1.2",
"coveralls": "^2.11.8",
"del": "^2.2.0",
"gulp": "^3.9.1",
"gulp-bump": "^1.0.0",
"gulp-git": "~1.7.0",
"gulp-istanbul": "~0.10.3",
"gulp-mocha": "~2.2.0",
"gulp-plumber": "~1.1.0",
"gulp-replace": "~0.5.4",
"gulp-sourcemaps": "~1.6.0",
"gulp-typedoc": "sierrasoftworks/gulp-typedoc#v1.8.10",
"gulp-typescript": "^2.12.1",
"gulp-util": "~3.0.7",
"istanbul": "~0.4.2",
"jshint": "^2.8.0",
"merge2": "^1.0.2",
"minimist": "^1.2.0",
"mocha": "^2.4.5",
"require-dir": "~0.3.0",
"run-sequence": "^1.1.4",
"istanbul": "~0.4.3",
"mocha": "^2.5.3",
"semver": "^5.1.0",
"tick": "~0.1.1",
"tslint": "^3.5.0",
"typedoc": "sierrasoftworks/typedoc#v1.8.10",
"typescript": "~1.8.7",
"typings-core": "^0.2.16",
"typedoc": "~0.4.2",
"typescript": "~1.8.10",
"typings-core": "^1.0.1",
"underscore": "~1.8.3"

@@ -72,0 +74,0 @@ },

@@ -5,6 +5,5 @@ {

"module": "commonjs",
"target": "es5",
"target": "es6",
"sourceMap": true,
"declaration": true,
"sourceRoot": "./lib",
"experimentalDecorators": true,

@@ -11,0 +10,0 @@ "outDir": "./dist/",

@@ -7,3 +7,2 @@ {

"bluebird": "registry:npm/bluebird#3.3.4+20160515010139",
"es6-promise": "registry:npm/es6-promise#3.0.0+20160211003958",
"lodash": "registry:npm/lodash#4.0.0+20160416211519",

@@ -21,5 +20,4 @@ "mongodb": "registry:npm/mongodb#2.1.0+20160422172506",

"globalDependencies": {
"es6-promise": "registry:dt/es6-promise#0.0.0+20160317120654",
"node": "registry:dt/node#6.0.0+20160514165920"
}
}

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc