From 3329d7fa113038bf844a5e886c8ece2ae2d1a259 Mon Sep 17 00:00:00 2001 From: Benjamin Pannell Date: Tue, 21 Apr 2015 09:30:26 +0200 Subject: [PATCH] Removed compiled JS files --- example/IntelliSense.js | 47 -- example/IntelliSense.js.map | 1 - lib/Cache.js | 1 - lib/Cache.js.map | 1 - lib/CacheDirector.js | 1 - lib/CacheDirector.js.map | 1 - lib/Configuration.js | 1 - lib/Configuration.js.map | 1 - lib/Core.js | 170 ------- lib/Core.js.map | 1 - lib/General.js | 1 - lib/General.js.map | 1 - lib/Hooks.js | 2 - lib/Hooks.js.map | 1 - lib/Instance.js | 168 ------- lib/Instance.js.map | 1 - lib/Middleware.js | 1 - lib/Middleware.js.map | 1 - lib/Model.js | 595 ------------------------- lib/Model.js.map | 1 - lib/Plugins.js | 2 - lib/Plugins.js.map | 1 - lib/Schema.js | 1 - lib/Schema.js.map | 1 - lib/cacheControllers/IDDirector.js | 13 - lib/cacheControllers/IDDirector.js.map | 1 - lib/caches/MemoryCache.js | 23 - lib/caches/MemoryCache.js.map | 1 - lib/caches/NoOpCache.js | 17 - lib/caches/NoOpCache.js.map | 1 - lib/middleware/Express.js | 14 - lib/middleware/Express.js.map | 1 - lib/utils/Omnom.js | 149 ------- lib/utils/Omnom.js.map | 1 - 34 files changed, 1223 deletions(-) delete mode 100644 example/IntelliSense.js delete mode 100644 example/IntelliSense.js.map delete mode 100644 lib/Cache.js delete mode 100644 lib/Cache.js.map delete mode 100644 lib/CacheDirector.js delete mode 100644 lib/CacheDirector.js.map delete mode 100644 lib/Configuration.js delete mode 100644 lib/Configuration.js.map delete mode 100644 lib/Core.js delete mode 100644 lib/Core.js.map delete mode 100644 lib/General.js delete mode 100644 lib/General.js.map delete mode 100644 lib/Hooks.js delete mode 100644 lib/Hooks.js.map delete mode 100644 lib/Instance.js delete mode 100644 lib/Instance.js.map delete mode 100644 lib/Middleware.js delete mode 100644 lib/Middleware.js.map delete mode 100644 lib/Model.js delete mode 100644 lib/Model.js.map delete mode 100644 lib/Plugins.js delete mode 100644 lib/Plugins.js.map delete mode 100644 lib/Schema.js delete mode 100644 lib/Schema.js.map delete mode 100644 lib/cacheControllers/IDDirector.js delete mode 100644 lib/cacheControllers/IDDirector.js.map delete mode 100644 lib/caches/MemoryCache.js delete mode 100644 lib/caches/MemoryCache.js.map delete mode 100644 lib/caches/NoOpCache.js delete mode 100644 lib/caches/NoOpCache.js.map delete mode 100644 lib/middleware/Express.js delete mode 100644 lib/middleware/Express.js.map delete mode 100644 lib/utils/Omnom.js delete mode 100644 lib/utils/Omnom.js.map diff --git a/example/IntelliSense.js b/example/IntelliSense.js deleted file mode 100644 index fa24ddd..0000000 --- a/example/IntelliSense.js +++ /dev/null @@ -1,47 +0,0 @@ -var __extends = this.__extends || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - __.prototype = b.prototype; - d.prototype = new __(); -}; -var Iridium = require('../index'); -var MyDB = (function (_super) { - __extends(MyDB, _super); - function MyDB() { - _super.apply(this, arguments); - this.Users = new Iridium.Model(this, "users", { - username: /^[a-z][a-z0-9_]{7,}$/, - fullname: String, - email: String, - dateOfBirth: Date, - passwordHash: String - }, { - indexes: [ - { email: 1 } - ] - }); - } - return MyDB; -})(Iridium); -var db = new MyDB("mongodb://localhost/test"); -db.connect().then(function () { - db.Users.insert({ fullname: 'test', username: 'test', passwordHash: 'test', email: 'test@test.com', dateOfBirth: new Date() }).then(function (user) { - user.fullname; - user.dateOfBirth.getTime(); - }); - db.Users.insert([{ fullname: 'test', username: 'test', passwordHash: 'test', email: 'test@test.com', dateOfBirth: new Date() }]).then(function (users) { - users[0].fullname; - }); - db.Users.findOne().then(function (instance) { - instance.save().then(function (i) { - i.remove().then(function (i) { - i.username = 'test'; - return i.save(); - }); - }); - }); - db.Users.count().then(function (count) { - count.toPrecision(2); - }); -}); -//# sourceMappingURL=IntelliSense.js.map \ No newline at end of file diff --git a/example/IntelliSense.js.map b/example/IntelliSense.js.map deleted file mode 100644 index 70ea218..0000000 --- a/example/IntelliSense.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"IntelliSense.js","sourceRoot":"","sources":["IntelliSense.ts"],"names":["MyDB","MyDB.constructor"],"mappings":";;;;;;AACA,IAAO,OAAO,WAAW,UAAU,CAAC,CAAC;AAcrC,IAAM,IAAI;IAASA,UAAbA,IAAIA,UAAgBA;IAA1BA,SAAMA,IAAIA;QAASC,8BAAOA;QACtBA,UAAKA,GAAGA,IAAIA,OAAOA,CAACA,KAAKA,CAAuBA,IAAIA,EAAEA,OAAOA,EAAEA;YAC3DA,QAAQA,EAAEA,sBAAsBA;YAChCA,QAAQA,EAAEA,MAAMA;YAChBA,KAAKA,EAAEA,MAAMA;YACbA,WAAWA,EAAEA,IAAIA;YACjBA,YAAYA,EAAEA,MAAMA;SACvBA,EAAEA;YACKA,OAAOA,EAAEA;gBACLA,EAAEA,KAAKA,EAAEA,CAACA,EAAEA;aACfA;SACRA,CAACA,CAACA;IACPA,CAACA;IAADD,WAACA;AAADA,CAACA,AAZD,EAAmB,OAAO,EAYzB;AAED,IAAI,EAAE,GAAG,IAAI,IAAI,CAAC,0BAA0B,CAAC,CAAC;AAE9C,EAAE,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC;IACd,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,eAAe,EAAE,WAAW,EAAE,IAAI,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,UAAU,IAAI;QAC9I,IAAI,CAAC,QAAQ,CAAC;QACd,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,CAAC;IAC/B,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,eAAe,EAAE,WAAW,EAAE,IAAI,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,KAAK;QACjJ,KAAK,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC;IACtB,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,UAAU,QAAuB;QACrD,QAAQ,CAAC,IAAI,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC;YAC5B,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC;gBACvB,CAAC,CAAC,QAAQ,GAAG,MAAM,CAAC;gBACpB,MAAM,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;YACpB,CAAC,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC,IAAI,CAAC,UAAU,KAAK;QACjC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;IACzB,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/lib/Cache.js b/lib/Cache.js deleted file mode 100644 index 3338fd7..0000000 --- a/lib/Cache.js +++ /dev/null @@ -1 +0,0 @@ -//# sourceMappingURL=Cache.js.map \ No newline at end of file diff --git a/lib/Cache.js.map b/lib/Cache.js.map deleted file mode 100644 index 5e13fb8..0000000 --- a/lib/Cache.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Cache.js","sourceRoot":"","sources":["Cache.ts"],"names":[],"mappings":"AASC"} \ No newline at end of file diff --git a/lib/CacheDirector.js b/lib/CacheDirector.js deleted file mode 100644 index bd4b9ba..0000000 --- a/lib/CacheDirector.js +++ /dev/null @@ -1 +0,0 @@ -//# sourceMappingURL=CacheDirector.js.map \ No newline at end of file diff --git a/lib/CacheDirector.js.map b/lib/CacheDirector.js.map deleted file mode 100644 index 37bc429..0000000 --- a/lib/CacheDirector.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"CacheDirector.js","sourceRoot":"","sources":["CacheDirector.ts"],"names":[],"mappings":"AAKC"} \ No newline at end of file diff --git a/lib/Configuration.js b/lib/Configuration.js deleted file mode 100644 index a8ab8ef..0000000 --- a/lib/Configuration.js +++ /dev/null @@ -1 +0,0 @@ -//# sourceMappingURL=Configuration.js.map \ No newline at end of file diff --git a/lib/Configuration.js.map b/lib/Configuration.js.map deleted file mode 100644 index a1b0de5..0000000 --- a/lib/Configuration.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Configuration.js","sourceRoot":"","sources":["Configuration.ts"],"names":[],"mappings":"AAOC"} \ No newline at end of file diff --git a/lib/Core.js b/lib/Core.js deleted file mode 100644 index 8895d8e..0000000 --- a/lib/Core.js +++ /dev/null @@ -1,170 +0,0 @@ -/// -/// -/// -/// -/// -/// -var Promise = require('bluebird'); -var MongoDB = require('mongodb'); -var expressMiddleware = require('./middleware/Express'); -var noOpCache = require('./caches/NoOpCache'); -var MongoConnectAsyc = Promise.promisify(MongoDB.MongoClient.connect); -var Core = (function () { - /** - * Creates a new Iridium Core instance connected to the specified MongoDB instance - * @param {String} url The URL of the MongoDB instance to connect to - * @param {Iridium.IridiumConfiguration} config The config object made available as settings - * @constructs Core - */ - function Core(url, config) { - this._cache = new noOpCache(); - var args = Array.prototype.slice.call(arguments, 0); - url = config = null; - for (var i = 0; i < args.length; i++) { - if (typeof args[i] == 'string') - url = args[i]; - else if (typeof args[i] == 'object') - config = args[i]; - } - if (!url && !config) - throw new Error("Expected either a URI or config object to be supplied when initializing Iridium"); - this._url = url; - this._config = config; - } - Object.defineProperty(Core.prototype, "models", { - /** - * Gets the models registered with this Iridium Core - * @returns {{}} - */ - get: function () { - return this._models; - }, - enumerable: true, - configurable: true - }); - 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 () { - if (this._url) - return this._url; - var url = 'mongodb://'; - url += (this._config.host || 'localhost'); - if (this._config.port) - url += ':' + this._config.port; - 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 - }); - Core.prototype.register = function (arg0, arg1) { - if (typeof arg0 == 'object') { - this.plugins.push(arg0); - return this; - } - if (arg1.isModel) - this.models[arg0] = arg1; - else - this.models[arg0] = arg1(this); - Object.defineProperty(this, arg0, { - get: function () { - return this.models[arg0]; - }, - enumerable: false - }); - return this; - }; - /** - * Connects to the database server specified in the provided configuration - * @param {function(Error, Iridium.Core)} [callback] A callback to be triggered once the connection is established. - * @returns {Promise} - */ - Core.prototype.connect = function (callback) { - var self = this; - return Promise.bind(this).then(function () { - if (self._connection) - return self._connection; - return MongoConnectAsyc(self.url); - }).then(function (db) { - self._connection = db; - return self; - }).nodeify(callback); - }; - /** - * Closes the active database connection - * @type {Promise} - */ - Core.prototype.close = function () { - var self = this; - return Promise.bind(this).then(function () { - if (!self._connection) - return this; - var conn = self._connection; - self._connection = null; - conn.close(); - return this; - }); - }; - /** - * Provides an express middleware which can be used to set the req.db property - * to the current Iridium instance. - * @returns {Iridium.ExpressMiddleware} - */ - Core.prototype.express = function () { - return expressMiddleware.ExpressMiddlewareFactory(this); - }; - return Core; -})(); -module.exports = Core; -//# sourceMappingURL=Core.js.map \ No newline at end of file diff --git a/lib/Core.js.map b/lib/Core.js.map deleted file mode 100644 index 60c9bb2..0000000 --- a/lib/Core.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Core.js","sourceRoot":"","sources":["Core.ts"],"names":["Core","Core.constructor","Core.models","Core.plugins","Core.settings","Core.connection","Core.url","Core.cache","Core.register","Core.connect","Core.close","Core.express"],"mappings":"AAAA,kDAAkD;AAClD,wDAAwD;AACxD,sDAAsD;AACtD,0DAA0D;AAC1D,gCAAgC;AAChC,mCAAmC;AAEnC,IAAO,OAAO,WAAW,UAAU,CAAC,CAAC;AACrC,IAAO,OAAO,WAAW,SAAS,CAAC,CAAC;AAWpC,IAAO,iBAAiB,WAAW,sBAAsB,CAAC,CAAC;AAG3D,IAAO,SAAS,WAAW,oBAAoB,CAAC,CAAC;AAGjD,IAAI,gBAAgB,GAAG,OAAO,CAAC,SAAS,CAAC,OAAO,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;AAItE,IAAM,IAAI;IAoENA;;;;;OAKGA;IACHA,SA1EEA,IAAIA,CA0EMA,GAAYA,EAAEA,MAA6BA;QApE/CC,WAAMA,GAAUA,IAAIA,SAASA,EAAEA,CAACA;QAsEpCA,IAAIA,IAAIA,GAAGA,KAAKA,CAACA,SAASA,CAACA,KAAKA,CAACA,IAAIA,CAACA,SAASA,EAAEA,CAACA,CAACA,CAACA;QACpDA,GAAGA,GAAGA,MAAMA,GAAGA,IAAIA,CAACA;QACpBA,GAAGA,CAAAA,CAACA,GAAGA,CAACA,CAACA,GAAGA,CAACA,EAAEA,CAACA,GAAGA,IAAIA,CAACA,MAAMA,EAAEA,CAACA,EAAEA,EAAEA,CAACA;YAClCA,EAAEA,CAAAA,CAACA,OAAOA,IAAIA,CAACA,CAACA,CAACA,IAAIA,QAAQA,CAACA;gBAC1BA,GAAGA,GAAGA,I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AE,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC;gBAAC,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC;YAC9C,MAAM,CAAC,gBAAgB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACtC,CAAC,CAACA,CAACA,IAAIA,CAACA,UAAUA,EAAcA;YAC5B,IAAI,CAAC,WAAW,GAAG,EAAE,CAAC;YACtB,MAAM,CAAC,IAAI,CAAC;QAChB,CAAC,CAACA,CAACA,OAAOA,CAACA,QAAQA,CAACA,CAACA;IACzBA,CAACA;IAEDT;;;OAGGA;IACHA,oBAAKA,GAALA;QACIU,IAAIA,IAAIA,GAAGA,IAAIA,CAACA;QAChBA,MAAMA,CAACA,OAAOA,CAACA,IAAIA,CAACA,IAAIA,CAACA,CAACA,IAAIA,CAACA;YAC3B,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC;gBAAC,MAAM,CAAC,IAAI,CAAC;YACnC,IAAI,IAAI,GAAe,IAAI,CAAC,WAAW,CAAC;YACxC,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;YACxB,IAAI,CAAC,KAAK,EAAE,CAAC;YACb,MAAM,CAAC,IAAI,CAAC;QAChB,CAAC,CAACA,CAACA;IACPA,CAACA;IAEDV;;;;OAIGA;IACHA,sBAAOA,GAAPA;QACIW,MAAMA,CAACA,iBAAiBA,CAACA,wBAAwBA,CAACA,IAAIA,CAACA,CAACA;IAC5DA,CAACA;IACLX,WAACA;AAADA,CAACA,AA1KD,IA0KC;AA5KD,iBAAS,IAAI,CAAC"} \ No newline at end of file diff --git a/lib/General.js b/lib/General.js deleted file mode 100644 index 07146e8..0000000 --- a/lib/General.js +++ /dev/null @@ -1 +0,0 @@ -//# sourceMappingURL=General.js.map \ No newline at end of file diff --git a/lib/General.js.map b/lib/General.js.map deleted file mode 100644 index b08baf9..0000000 --- a/lib/General.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"General.js","sourceRoot":"","sources":["General.ts"],"names":[],"mappings":"AAMC"} \ No newline at end of file diff --git a/lib/Hooks.js b/lib/Hooks.js deleted file mode 100644 index 1072b7a..0000000 --- a/lib/Hooks.js +++ /dev/null @@ -1,2 +0,0 @@ -/// -//# sourceMappingURL=Hooks.js.map \ No newline at end of file diff --git a/lib/Hooks.js.map b/lib/Hooks.js.map deleted file mode 100644 index 511627b..0000000 --- a/lib/Hooks.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Hooks.js","sourceRoot":"","sources":["Hooks.ts"],"names":[],"mappings":"AAAA,0DAA0D;AASzD"} \ No newline at end of file diff --git a/lib/Instance.js b/lib/Instance.js deleted file mode 100644 index 78a4351..0000000 --- a/lib/Instance.js +++ /dev/null @@ -1,168 +0,0 @@ -/// -/// -/// -/// -/// -/// -var _ = require('lodash'); -var Promise = require('bluebird'); -var Instance = (function () { - function Instance(model, document, isNew, isPartial) { - if (isNew === void 0) { isNew = false; } - if (isPartial === void 0) { isPartial = false; } - this._model = model; - this._isNew = !!isNew; - this._isPartial = isPartial; - this._original = document; - this._modified = _.cloneDeep(document); - _.each(model.core.plugins, function (plugin) { - if (plugin.newInstance) - plugin.newInstance(this, model); - }); - } - Object.defineProperty(Instance.prototype, "document", { - get: function () { - return this._modified; - }, - enumerable: true, - configurable: true - }); - Instance.prototype.save = function () { - 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) { - if (typeof arg == 'function') - callback = arg; - else if (typeof arg == 'object') { - if (!changes) - changes = arg; - else - conditions = arg; - } - }); - return Promise.resolve().then(function () { - _.merge(conditions, this._model.helpers.selectOneDownstream(this._modified)); - this._model.helpers.transform.reverse(conditions); - if (!changes) { - var validation = this._model.helpers.validate(this._modified); - if (validation.failed) - return Promise.reject(validation.error).bind(this).nodeify(callback); - var original = _.cloneDeep(this._original); - var modified = _.cloneDeep(this._modified); - changes = this._model.helpers.diff(original, modified); - } - }).then(function () { - return this._model.handlers.savingDocument(this, changes); - }).then(function () { - return new Promise(function (resolve, reject) { - this._model.collection.update(conditions, changes, { w: 1 }, function (err, changed) { - if (err) - return reject(err); - return resolve(changed); - }); - }); - }).then(function (changed) { - conditions = this._model.helpers.selectOne(this.modified); - if (!changed) - return this._modified; - return new Promise(function (resolve, reject) { - this._model.collection.findOne(conditions, function (err, latest) { - if (err) - return reject(err); - return resolve(latest); - }); - }); - }).then(function (latest) { - return this._model.handlers.documentsReceived(conditions, [latest], function (value) { - this._model.helpers.transform.apply(value); - this._isPartial = false; - this._isNew = false; - this._original = value; - this._modified = _.clone(value); - return this; - }); - }).nodeify(callback); - }; - Instance.prototype.update = function (callback) { - return this.refresh(callback); - }; - Instance.prototype.refresh = function (callback) { - var conditions = this._model.helpers.selectOne(this._original); - return Promise.resolve().then(function () { - return new Promise(function (resolve, reject) { - this._model.collection.findOne(conditions, function (err, doc) { - if (err) - return reject(err); - return resolve(doc); - }); - }); - }).then(function (doc) { - if (!doc) { - this._isPartial = true; - this._isNew = true; - this._original = _.cloneDeep(this._modified); - return this; - } - return this._model.handle.documentsReceived(conditions, [doc], this._model.helpers.transform.apply, { wrap: false }).then(function (doc) { - this._model.helpers.transformFromSource(doc); - this._isNew = false; - this._isPartial = false; - this._original = doc; - this._modified = _.cloneDeep(doc); - this._model._helpers.transformDown(doc); - return this; - }); - }).nodeify(callback); - }; - Instance.prototype.delete = function (callback) { - return this.remove(callback); - }; - Instance.prototype.remove = function (callback) { - var conditions = this._model.helpers.selectOne(this._original); - return Promise.resolve().then(function () { - if (this._isNew) - return 0; - return new Promise(function (resolve, reject) { - this._model.collection.remove(conditions, function (err, removed) { - if (err) - return reject(err); - return resolve(removed); - }); - }); - }).then(function (removed) { - if (removed) - return this._model.cache.remove(conditions); - }).nodeify(callback); - }; - Instance.prototype.first = function (collection, predicate) { - var result = null; - _.each(collection, function (value, key) { - if (predicate.call(this, value, key)) { - result = value; - return false; - } - }, this); - return result; - }; - Instance.prototype.select = function (collection, predicate) { - var isArray = Array.isArray(collection); - var results = isArray ? [] : {}; - _.each(collection, function (value, key) { - if (predicate.call(this, value, key)) { - if (isArray) - results.push(value); - else - results[key] = value; - } - }, this); - return results; - }; - return Instance; -})(); -exports.Instance = Instance; -//# sourceMappingURL=Instance.js.map \ No newline at end of file diff --git a/lib/Instance.js.map b/lib/Instance.js.map deleted file mode 100644 index 0a25f6d..0000000 --- a/lib/Instance.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Instance.js","sourceRoot":"","sources":["Instance.ts"],"names":["Instance","Instance.constructor","Instance.document","Instance.save","Instance.update","Instance.refresh","Instance.delete","Instance.remove","Instance.first","Instance.select"],"mappings":"AAAA,kDAAkD;AAClD,wDAAwD;AACxD,sDAAsD;AACtD,0DAA0D;AAC1D,gCAAgC;AAChC,iCAAiC;AAKjC,IAAO,CAAC,WAAW,QAAQ,CAAC,CAAC;AAC7B,IAAO,OAAO,WAAW,UAAU,CAAC,CAAC;AA8BrC,IAAa,QAAQ;IACjBA,SADSA,QAAQA,CACLA,KAAsCA,EAAEA,QAAiBA,EAAEA,KAAsBA,EAAEA,SAA0BA;QAAlDC,qBAAsBA,GAAtBA,aAAsBA;QAAEA,yBAA0BA,GAA1BA,iBAA0BA;QACjHA,IAAIA,CAACA,MAAMA,GAAGA,KAAKA,CAACA;QAEpBA,IAAIA,CAACA,MAAMA,GAAGA,CAACA,CAACA,KAAKA,CAACA;QACtBA,IAAIA,CAACA,UAAUA,GAAGA,SAASA,CAACA;QAC5BA,IAAIA,CAACA,SAASA,GAAGA,QAAQA,CAACA;QAC1BA,IAAIA,CAACA,SAASA,GAAGA,CAACA,CAACA,SAASA,CAACA,QAAQA,CAACA,CAACA;QAEvCA,CAACA,CAACA,IAAIA,CAACA,KAAKA,CAACA,IAAIA,CAACA,OAAOA,EAAEA,UAASA,MAAgBA;YAChD,EAAE,CAAA,CAAC,MAAM,CAAC,WAAW,CAAC;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file mode 100644 index 6c69b91..0000000 --- a/lib/Middleware.js +++ /dev/null @@ -1 +0,0 @@ -//# sourceMappingURL=Middleware.js.map \ No newline at end of file diff --git a/lib/Middleware.js.map b/lib/Middleware.js.map deleted file mode 100644 index 029f1dd..0000000 --- a/lib/Middleware.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Middleware.js","sourceRoot":"","sources":["Middleware.ts"],"names":[],"mappings":"AAKC"} \ No newline at end of file diff --git a/lib/Model.js b/lib/Model.js deleted file mode 100644 index b8bb438..0000000 --- a/lib/Model.js +++ /dev/null @@ -1,595 +0,0 @@ -/// -/// -/// -/// -/// -/// -/// -var MongoDB = require('mongodb'); -var Skmatc = require('skmatc'); -var Concoction = require('concoction'); -var Promise = require('bluebird'); -var util = require('util'); -var instance = require('./Instance'); -var idCacheController = require('./cacheControllers/IDDirector'); -var Omnom = require('./utils/Omnom'); -/** - * An Iridium Model which represents a structured MongoDB collection - * @class - */ -var Model = (function () { - /** - * Creates a new Iridium model representing a given ISchema and backed by a collection whose name is specified - * @param {Iridium} core The Iridium core that this model should use for database access - * @param {String} collection The name of the collection within the database which should be used by this model - * @param {schema} schema The schema defining the data validations to be performed on the model - * @param {IModelOptions} options The options dictating the behaviour of the model - * @returns {Model} - * @constructor - */ - function Model(core, collection, schema, options) { - if (options === void 0) { options = {}; } - // Allow instantiation doing `require('iridium').Model(db, 'collection', {})` - if (!(this instanceof Model)) - return new Model(core, collection, schema, options); - options = options || {}; - _.defaults(options, { - hooks: {}, - transforms: [ - Concoction.Rename({ _id: 'id' }), - Concoction.Convert({ - id: { - apply: function (value) { - return (value && value.id) ? new MongoDB.ObjectID(value.id).toHexString() : value; - }, - reverse: function (value) { - if (value === null || value === undefined) - return undefined; - if (value && /^[a-f0-9]{24}$/.test(value)) - return MongoDB.ObjectID.createFromHexString(value); - return value; - } - } - }) - ], - cache: new idCacheController() - }); - this._core = core; - this._collection = collection; - this._schema = schema; - this._options = options; - core.plugins.forEach(function (plugin) { - if (plugin.newModel) - plugin.newModel(this); - }); - this._cache = options.cache; - this._Instance = new ModelSpecificInstance(this); - this._helpers = new ModelHelpers(this); - this._handlers = new ModelHandlers(this); - } - Object.defineProperty(Model.prototype, "options", { - /** - * Gets the options provided when instantiating this model - * @public - * @returns {IModelOptions} - * @description - * This is intended to be consumed by plugins which require any configuration - * options. Changes made to this object after the {plugin.newModel} hook are - * called will not have any effect on this model. - */ - get: function () { - return this._options; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Model.prototype, "helpers", { - /** - * Provides helper methods used by Iridium for common tasks - * @returns {ModelHelpers} - */ - 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 {ModelHandlers} - */ - get: function () { - return this._handlers; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Model.prototype, "schema", { - /** - * Gets the ISchema dictating the data structure represented by this model - * @public - * @returns {schema} - */ - 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 {Iridium} - */ - 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 - * @public - * @returns {Collection} - */ - get: function () { - return this.core.connection.collection(this._collection); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Model.prototype, "cache", { - /** - * Gets the cache controller which dictates which queries will be cached, and under which key - * @public - * @returns {cacheDirector} - */ - get: function () { - return this._cache; - }, - enumerable: true, - configurable: true - }); - /** - * Gets the constructor used to create instances for this model - * @public - * @returns {function(Object): Instance} - * @constructor - */ - Model.prototype.Instance = function (document, isNew, isPartial) { - if (isNew === void 0) { isNew = true; } - if (isPartial === void 0) { isPartial = false; } - return this._Instance.build(document, isNew, isPartial); - }; - Model.prototype.find = function (conditions, options, callback) { - if (typeof options == 'function') { - callback = options; - options = {}; - } - if (typeof conditions == 'function') { - callback = conditions; - conditions = {}; - options = {}; - } - conditions = conditions || {}; - options = options || {}; - _.defaults(options, { - wrap: true - }); - var $this = this; - return Promise.resolve().then(function () { - if (options.fields) - $this.helpers.transform.reverse(options.fields); - if (!_.isPlainObject(conditions)) - conditions = $this.helpers.selectOneDownstream(conditions); - $this.helpers.transform.reverse(conditions); - var cursor = $this.collection.find(conditions, { - limit: options.limit, - sort: options.sort, - skip: options.skip, - fields: options.fields - }); - return Promise.promisify(function (callback) { - cursor.toArray(callback); - })(); - }).then(function (results) { - if (!results || !results.length) - return Promise.resolve([]); - return $this.handlers.documentsReceived(conditions, results, $this.helpers.wrapDocument, options); - }).nodeify(callback); - }; - Model.prototype.get = function () { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i - 0] = arguments[_i]; - } - return this.get.apply(this, args); - }; - Model.prototype.findOne = function () { - 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++) { - if (typeof args[argI] == 'function') - callback = callback || args[argI]; - else if (_.isPlainObject(args[argI])) { - if (conditions) - options = args[argI]; - else - conditions = args[argI]; - } - else - conditions = this.helpers.selectOneDownstream(args[argI]); - } - _.defaults(options, { - wrap: true, - cache: true - }); - var $this = this; - return Promise.resolve().bind(this).then(function () { - $this.helpers.transform.reverse(conditions); - if (options.fields) - $this.helpers.transform.reverse(options.fields); - if (options.cache && $this.cache && $this.core.cache && $this.cache.valid(conditions)) - return $this.core.cache.get($this.cache.buildKey(conditions)); - return null; - }).then(function (cachedDocument) { - if (cachedDocument) - return cachedDocument; - return null; - }).then(function (document) { - if (!document) - return null; - return $this.handlers.documentsReceived(conditions, [document], $this.helpers.wrapDocument, options).then(function (documents) { - return documents[0]; - }); - }).nodeify(callback); - }; - Model.prototype.create = function () { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i - 0] = arguments[_i]; - } - return this.insert.apply(this, args); - }; - Model.prototype.insert = function (objs) { - var args = []; - for (var _i = 1; _i < arguments.length; _i++) { - args[_i - 1] = arguments[_i]; - } - var objects; - var options = {}; - var callback = null; - if (typeof args[0] == 'function') - callback = args[0]; - else { - options = args[0]; - callback = args[1]; - } - var returnArray = false; - if (Array.isArray(objs)) - returnArray = true; - else - objects = [objs]; - _.defaults(options, { - wrap: true, - w: 1 - }); - var $this = this; - return Promise.resolve().then(function () { - var queryOptions = { w: options.w, upsert: options.upsert, new: true }; - if (options.upsert) - return $this.handlers.creatingDocuments(objects).map(function (object) { - return new Promise(function (resolve, reject) { - $this.collection.findAndModify({ _id: object._id }, ["_id"], object, queryOptions, function (err, result) { - if (err) - return reject(err); - return resolve(result); - }); - }); - }); - else - return $this.handlers.creatingDocuments(objects).then(function (objects) { - return new Promise(function (resolve, reject) { - $this.collection.insert(objects, queryOptions, function (err, results) { - if (err) - return reject(err); - return resolve(results); - }); - }); - }); - }).then(function (inserted) { - return $this.handlers.documentsReceived(null, inserted, $this.helpers.wrapDocument, { wrap: options.wrap, cache: options.cache }); - }).then(function (results) { - if (objs instanceof Array) - return results; - return results[0]; - }).nodeify(callback); - }; - Model.prototype.update = function (conditions, changes, options, callback) { - if (typeof options == 'function') { - callback = options; - options = {}; - } - _.defaults(options, { - w: 1, - multi: true - }); - this.helpers.transform.reverse(conditions); - var $this = this; - return new Promise(function (resolve, reject) { - $this.collection.update(conditions, changes, options, function (err, changes) { - if (err) - return reject(err); - return resolve(changes); - }); - }).nodeify(callback); - }; - Model.prototype.count = function (conditions, callback) { - if (typeof conditions == 'function') { - callback = conditions; - conditions = {}; - } - var $this = this; - return new Promise(function (resolve, reject) { - $this.collection.count(conditions, function (err, results) { - if (err) - return reject(err); - return resolve(results); - }); - }).nodeify(callback); - }; - Model.prototype.remove = function (conditions, callback) { - if (typeof conditions == 'function') { - callback = conditions; - conditions = {}; - } - var $this = this; - return new Promise(function (resolve, reject) { - $this.collection.remove(conditions, function (err, results) { - if (err) - return reject(err); - return resolve(results); - }); - }).then(function (count) { - if ($this.cache && $this.core.cache && $this.cache.valid(conditions)) - return $this.core.cache.clear($this.cache.buildKey(conditions)).then(function () { - return count; - }); - return Promise.resolve(count); - }).nodeify(callback); - }; - Model.prototype.ensureIndex = function (specification, options, callback) { - if (typeof options == 'function') { - callback = options; - options = {}; - } - var $this = this; - return new Promise(function (resolve, reject) { - $this.collection.ensureIndex(specification, options, function (err, name) { - if (err) - return reject(err); - return resolve(name); - }); - }).nodeify(callback); - }; - Model.prototype.ensureIndices = function (callback) { - var $this = this; - return Promise.resolve(this.options.indices).map(function (index) { - return $this.ensureIndex(index.spec || index, index.options || {}); - }).nodeify(callback); - }; - return Model; -})(); -exports.Model = Model; -var ModelSpecificInstance = (function () { - function ModelSpecificInstance(model) { - this.Constructor = function (document, isNew, isPartial) { - instance.Instance.call(this, model, document, isNew, isPartial); - }; - util.inherits(this.Constructor, instance.Instance); - _.each(model.schema, function (property, key) { - Object.defineProperty(this.Constructor.prototype, key, { - get: function () { - return this._modified[key]; - }, - set: function (value) { - this._modified[key] = value; - } - }); - }, this); - } - ModelSpecificInstance.prototype.build = function (document, isNew, isPartial) { - return new this.Constructor(document, isNew, isPartial); - }; - return ModelSpecificInstance; -})(); -exports.ModelSpecificInstance = ModelSpecificInstance; -var ModelHelpers = (function () { - function ModelHelpers(model) { - this._model = model; - this._validator = new Skmatc(model.schema); - this._transform = new concoction(model.options.transforms); - } - Object.defineProperty(ModelHelpers.prototype, "transform", { - /** - * Gets the Concoction transforms defined for this model - * @returns {Concoction} - */ - get: function () { - return this._transform; - }, - enumerable: true, - configurable: true - }); - /** - * Validates a document to ensure that it matches the model's ISchema requirements - * @param {any} document The document to validate against the ISchema - * @returns {SkmatcCore.IResult} The result of the validation - */ - ModelHelpers.prototype.validate = function (document) { - return this._validator.validate(document); - }; - /** - * Creates a selector based on the document's unique _id field - * @param {object} document The document to render the unique selector for - * @returns {{_id: any}} A database selector which can be used to return only this document - */ - ModelHelpers.prototype.selectOne = function (document) { - var testDoc = _.cloneDeep(document); - this.transform.reverse(testDoc); - return { - _id: testDoc._id - }; - }; - Object.defineProperty(ModelHelpers.prototype, "identifierField", { - /** - * Gets the field used in the ISchema to represent the document _id - */ - get: function () { - var id = new String(""); - var testDoc = { - _id: id - }; - this.transform.apply(testDoc); - var idField = null; - for (var k in testDoc) - if (testDoc[k] === id) { - idField = k; - break; - } - return idField; - }, - enumerable: true, - configurable: true - }); - /** - * Creates a selector based on the document's unique _id field in downstream format - * @param {any} id The downstream identifier to use when creating the selector - * @returns {object} A database selector which can be used to return only this document in downstream form - */ - ModelHelpers.prototype.selectOneDownstream = function (id) { - var conditions = {}; - conditions[this.identifierField] = id; - return conditions; - }; - /** - * Wraps the given document in an instance wrapper for use throughout the application - * @param {any} document The document to be wrapped as an instance - * @param {Boolean} isNew Whether the instance originated from the database or was created by the application - * @param {Boolean} isPartial Whether the document supplied contains all information present in the database - * @returns {instance.IInstance} An instance which wraps this document - */ - ModelHelpers.prototype.wrapDocument = function (document, isNew, isPartial) { - return this._model.Instance(document, isNew, isPartial); - }; - /** - * Performs a diff operation between two documents and creates a MongoDB changes object to represent the differences - * @param {any} original The original document prior to changes being made - * @param {any} modified The document after changes were made - */ - ModelHelpers.prototype.diff = function (original, modified) { - var omnom = new Omnom(); - omnom.diff(original, modified); - return omnom.changes; - }; - return ModelHelpers; -})(); -exports.ModelHelpers = ModelHelpers; -var ModelHandlers = (function () { - function ModelHandlers(model) { - this._model = model; - } - Object.defineProperty(ModelHandlers.prototype, "model", { - get: function () { - return this._model; - }, - enumerable: true, - configurable: true - }); - ModelHandlers.prototype.documentsReceived = function (conditions, results, wrapper, options) { - if (options === void 0) { options = {}; } - _.defaults(options, { - wrap: true, - cache: true, - partial: false - }); - return Promise.resolve(results).map(function (target) { - return Promise.resolve().then(function () { - // Trigger the received hook - if (this.model.hooks.retrieved) - return this.model.hooks.retrieved(target); - }).then(function () { - // Cache the document if caching is enabled - if (this.model.core.cache && options.cache && !options.fields) { - var cacheDoc = _.cloneDeep(target); - return this.cache.store(conditions, cacheDoc); - } - }).then(function () { - // Wrap the document and trigger the ready hook - var wrapped = wrapper(target, false, !!options.fields); - if (this.model.hooks.ready) - return Promise.resolve(this.model.hooks.ready(wrapped)).then(function () { return wrapped; }); - return wrapped; - }); - }); - }; - ModelHandlers.prototype.creatingDocuments = function (documents) { - return Promise.resolve(documents).map(function (document) { - return Promise.resolve().then(function () { - if (this.model.hooks.retrieved) - return this.model.hooks.creating(document); - }).then(function () { - var validation = this.model.helpers.validate(document); - if (validation.failed) - return Promise.reject(validation.error); - this.model.helpers.transform.reverse(document); - return document; - }); - }); - }; - ModelHandlers.prototype.savingDocument = function (instance, changes) { - return Promise.resolve().then(function () { - if (this.model.hooks.saving) - return this.model.hooks.saving(instance, changes); - }).then(function () { return instance; }); - }; - return ModelHandlers; -})(); -exports.ModelHandlers = ModelHandlers; -var ModelCache = (function () { - function ModelCache(model) { - this._model = model; - } - Object.defineProperty(ModelCache.prototype, "model", { - get: function () { - return this._model; - }, - enumerable: true, - configurable: true - }); - ModelCache.prototype.set = function (conditions, value) { - if (!this.model.cache.valid(conditions)) - return Promise.resolve(value); - return this.model.core.cache.set(this.model.cache.buildKey(conditions), value); - }; - ModelCache.prototype.get = function (conditions) { - if (!this.model.cache.valid(conditions)) - return Promise.resolve(null); - return this.model.core.cache.get(this.model.cache.buildKey(conditions)); - }; - ModelCache.prototype.clear = function (conditions) { - if (!this.model.cache.valid(conditions)) - return Promise.resolve(false); - return this.model.core.cache.clear(this.model.cache.buildKey(conditions)); - }; - return ModelCache; -})(); -//# sourceMappingURL=Model.js.map \ No newline at end of file diff --git a/lib/Model.js.map b/lib/Model.js.map deleted file mode 100644 index 9d3eff3..0000000 --- a/lib/Model.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Model.js","sourceRoot":"","sources":["Model.ts"],"names":["Model","Model.constructor","Model.options","Model.helpers","Model.handlers","Model.schema","Model.core","Model.collection","Model.cache","Model.Instance","Model.find","Model.get","Model.findOne","Model.create","Model.insert","Model.update","Model.count","Model.remove","Model.ensureIndex","Model.ensureIndices","ModelSpecificInstance","ModelSpecificInstance.constructor","ModelSpecificInstance.build","ModelHelpers","ModelHelpers.constructor","ModelHelpers.transform","ModelHelpers.validate","ModelHelpers.selectOne","ModelHelpers.identifierField","ModelHelpers.selectOneDownstream","ModelHelpers.wrapDocument","ModelHelpers.diff","ModelHandlers","ModelHandlers.constructor","ModelHandlers.model","ModelHandlers.documentsReceived","ModelHandlers.creatingDocuments","ModelHandlers.savingDocument","ModelCache","ModelCache.constructor","ModelCache.model","ModelCache.set","ModelCache.get","ModelCache.clear"],"mappings":"AAAA,kDAAkD;AAClD,wDAAwD;AACxD,sDAAsD;AACtD,sDAAsD;AACtD,0DAA0D;AAC1D,8DAA8D;AAC9D,gCAAgC;AAEhC,IAAO,OAAO,WAAW,SAAS,CAAC,CAAC;AACpC,IAAO,MAAM,WAAW,QAAQ,CAAC,CAAC;AAClC,IAAO,UAAU,WAAW,YAAY,CAAC,CAAC;AAC1C,IAAO,OAAO,WAAW,UAAU,CAAC,CAAC;AACrC,IAAO,IAAI,WAAW,MAAM,CAAC,CAAC;AAG9B,IAAO,QAAQ,WAAW,YAAY,CAAC,CAAC;AAUxC,IAAO,iBAAiB,WAAW,+BAA+B,CAAC,CAAC;AAEpE,IAAO,KAAK,WAAW,eAAe,CAAC,CAAC;AAMxC,AAJA;;;GAGG;IACU,KAAK;IACdA;;;;;;;;OAQGA;IACHA,SAVSA,KAAKA,CAUFA,IAAaA,EAAEA,UAAkBA,EAAEA,MAAeA,EAAEA,OAAoCA;QAApCC,uBAAoCA,GAApCA,YAAoCA;QAGhGA,AADAA,6EAA6EA;QAC7EA,EAAEA,CAACA,CAACA,CAACA,CAACA,IAAIA,YAAYA,KAAKA,CAACA,CAACA;YAACA,MAAMA,CAACA,IAAIA,KAAKA,CAAqBA,IAAIA,EAAEA,UA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CAACA,CAACA,CAACA;IAC/EA,CAACA;IAEDJ,0BAAKA,GAALA,UAAMA,UAAeA;QACjBK,EAAEA,CAACA,CAACA,CAACA,IAAIA,CAACA,KAAKA,CAACA,KAAKA,CAACA,KAAKA,CAACA,UAAUA,CAACA,CAACA;YAACA,MAAMA,CAACA,OAAOA,CAACA,OAAOA,CAACA,KAAKA,CAACA,CAACA;QACvEA,MAAMA,CAACA,IAAIA,CAACA,KAAKA,CAACA,IAAIA,CAACA,KAAKA,CAACA,KAAKA,CAACA,IAAIA,CAACA,KAAKA,CAACA,KAAKA,CAACA,QAAQA,CAACA,UAAUA,CAACA,CAACA,CAACA;IAC9EA,CAACA;IACLL,iBAACA;AAADA,CAACA,AAxBD,IAwBC"} \ No newline at end of file diff --git a/lib/Plugins.js b/lib/Plugins.js deleted file mode 100644 index 03826e6..0000000 --- a/lib/Plugins.js +++ /dev/null @@ -1,2 +0,0 @@ -/// -//# sourceMappingURL=Plugins.js.map \ No newline at end of file diff --git a/lib/Plugins.js.map b/lib/Plugins.js.map deleted file mode 100644 index bf4e9fc..0000000 --- a/lib/Plugins.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Plugins.js","sourceRoot":"","sources":["Plugins.ts"],"names":[],"mappings":"AAAA,sDAAsD;AAYrD"} \ No newline at end of file diff --git a/lib/Schema.js b/lib/Schema.js deleted file mode 100644 index 4df92c0..0000000 --- a/lib/Schema.js +++ /dev/null @@ -1 +0,0 @@ -//# sourceMappingURL=Schema.js.map \ No newline at end of file diff --git a/lib/Schema.js.map b/lib/Schema.js.map deleted file mode 100644 index eb24a90..0000000 --- a/lib/Schema.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Schema.js","sourceRoot":"","sources":["Schema.ts"],"names":[],"mappings":"AAIC"} \ No newline at end of file diff --git a/lib/cacheControllers/IDDirector.js b/lib/cacheControllers/IDDirector.js deleted file mode 100644 index 52cc05a..0000000 --- a/lib/cacheControllers/IDDirector.js +++ /dev/null @@ -1,13 +0,0 @@ -var IDCacheDirector = (function () { - function IDCacheDirector() { - } - IDCacheDirector.prototype.valid = function (object) { - return object._id; - }; - IDCacheDirector.prototype.buildKey = function (object) { - return JSON.stringify(object._id); - }; - return IDCacheDirector; -})(); -module.exports = IDCacheDirector; -//# sourceMappingURL=IDDirector.js.map \ No newline at end of file diff --git a/lib/cacheControllers/IDDirector.js.map b/lib/cacheControllers/IDDirector.js.map deleted file mode 100644 index ad8830d..0000000 --- a/lib/cacheControllers/IDDirector.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"IDDirector.js","sourceRoot":"","sources":["IDDirector.ts"],"names":["IDCacheDirector","IDCacheDirector.constructor","IDCacheDirector.valid","IDCacheDirector.buildKey"],"mappings":"AAIA,IAAM,eAAe;IAArBA,SAAMA,eAAeA;IAQrBC,CAACA;IAPGD,+BAAKA,GAALA,UAAMA,MAAoBA;QACtBE,MAAMA,CAACA,MAAMA,CAACA,GAAGA,CAACA;IACtBA,CAACA;IAEDF,kCAAQA,GAARA,UAASA,MAAoBA;QACzBG,MAAMA,CAACA,IAAIA,CAACA,SAASA,CAACA,MAAMA,CAACA,GAAGA,CAACA,CAACA;IACtCA,CAACA;IACLH,sBAACA;AAADA,CAACA,AARD,IAQC;AAVD,iBAAS,eAAe,CAAC"} \ No newline at end of file diff --git a/lib/caches/MemoryCache.js b/lib/caches/MemoryCache.js deleted file mode 100644 index e26ccc7..0000000 --- a/lib/caches/MemoryCache.js +++ /dev/null @@ -1,23 +0,0 @@ -/// -var Promise = require('bluebird'); -var MemoryCache = (function () { - function MemoryCache() { - this.cache = {}; - } - MemoryCache.prototype.set = function (key, value) { - this.cache[key] = value; - return Promise.resolve(value); - }; - MemoryCache.prototype.get = function (key) { - return Promise.resolve(this.cache[key]); - }; - MemoryCache.prototype.clear = function (key) { - var has = this.cache.hasOwnProperty(key); - if (has) - delete this.cache[key]; - return Promise.resolve(has); - }; - return MemoryCache; -})(); -module.exports = MemoryCache; -//# sourceMappingURL=MemoryCache.js.map \ No newline at end of file diff --git a/lib/caches/MemoryCache.js.map b/lib/caches/MemoryCache.js.map deleted file mode 100644 index a51be5b..0000000 --- a/lib/caches/MemoryCache.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"MemoryCache.js","sourceRoot":"","sources":["MemoryCache.ts"],"names":["MemoryCache","MemoryCache.constructor","MemoryCache.set","MemoryCache.get","MemoryCache.clear"],"mappings":"AACA,AADA,6DAA6D;AAC7D,IAAO,OAAO,WAAW,UAAU,CAAC,CAAC;AAKrC,IAAM,WAAW;IAAjBA,SAAMA,WAAWA;QACLC,UAAKA,GAAQA,EAAEA,CAACA;IAgB5BA,CAACA;IAdGD,yBAAGA,GAAHA,UAAOA,GAAWA,EAAEA,KAAQA;QACxBE,IAAIA,CAACA,KAAKA,CAACA,GAAGA,CAACA,GAAGA,KAAKA,CAACA;QACxBA,MAAMA,CAACA,OAAOA,CAACA,OAAOA,CAACA,KAAKA,CAACA,CAACA;IAClCA,CAACA;IAEDF,yBAAGA,GAAHA,UAAOA,GAAWA;QACdG,MAAMA,CAACA,OAAOA,CAACA,OAAOA,CAACA,IAAIA,CAACA,KAAKA,CAACA,GAAGA,CAACA,CAACA,CAACA;IAC5CA,CAACA;IAEDH,2BAAKA,GAALA,UAAMA,GAAWA;QACbI,IAAIA,GAAGA,GAAGA,IAAIA,CAACA,KAAKA,CAACA,cAAcA,CAACA,GAAGA,CAACA,CAACA;QACzCA,EAAEA,CAAAA,CAACA,GAAGA,CAACA;YAACA,OAAOA,IAAIA,CAACA,KAAKA,CAACA,GAAGA,CAACA,CAACA;QAC/BA,MAAMA,CAACA,OAAOA,CAACA,OAAOA,CAACA,GAAGA,CAACA,CAACA;IAChCA,CAACA;IACLJ,kBAACA;AAADA,CAACA,AAjBD,IAiBC;AAnBD,iBAAS,WAAW,CAAC"} \ No newline at end of file diff --git a/lib/caches/NoOpCache.js b/lib/caches/NoOpCache.js deleted file mode 100644 index f432db6..0000000 --- a/lib/caches/NoOpCache.js +++ /dev/null @@ -1,17 +0,0 @@ -var Promise = require('bluebird'); -var NoOpCache = (function () { - function NoOpCache() { - } - NoOpCache.prototype.set = function (key, object) { - return Promise.resolve(object); - }; - NoOpCache.prototype.get = function (key) { - return Promise.resolve(); - }; - NoOpCache.prototype.clear = function (key) { - return Promise.resolve(false); - }; - return NoOpCache; -})(); -module.exports = NoOpCache; -//# sourceMappingURL=NoOpCache.js.map \ No newline at end of file diff --git a/lib/caches/NoOpCache.js.map b/lib/caches/NoOpCache.js.map deleted file mode 100644 index 0ee472b..0000000 --- a/lib/caches/NoOpCache.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"NoOpCache.js","sourceRoot":"","sources":["NoOpCache.ts"],"names":["NoOpCache","NoOpCache.constructor","NoOpCache.set","NoOpCache.get","NoOpCache.clear"],"mappings":"AAEA,IAAO,OAAO,WAAW,UAAU,CAAC,CAAC;AAIrC,IAAM,SAAS;IAAfA,SAAMA,SAASA;IAYfC,CAACA;IAXGD,uBAAGA,GAAHA,UAAOA,GAAWA,EAAEA,MAASA;QACzBE,MAAMA,CAACA,OAAOA,CAACA,OAAOA,CAACA,MAAMA,CAACA,CAACA;IACnCA,CAACA;IAEDF,uBAAGA,GAAHA,UAAOA,GAAWA;QACdG,MAAMA,CAACA,OAAOA,CAACA,OAAOA,EAAEA,CAACA;IAC7BA,CAACA;IAEDH,yBAAKA,GAALA,UAAMA,GAAWA;QACbI,MAAMA,CAACA,OAAOA,CAACA,OAAOA,CAACA,KAAKA,CAACA,CAACA;IAClCA,CAACA;IACLJ,gBAACA;AAADA,CAACA,AAZD,IAYC;AAdD,iBAAS,SAAS,CAAC"} \ No newline at end of file diff --git a/lib/middleware/Express.js b/lib/middleware/Express.js deleted file mode 100644 index edf57a5..0000000 --- a/lib/middleware/Express.js +++ /dev/null @@ -1,14 +0,0 @@ -function ExpressMiddlewareFactory(core) { - return function (req, res, next) { - core.connect().then(function () { - Object.defineProperty(req, 'db', { - get: function () { - return core; - } - }); - next(); - }).catch(next); - }; -} -exports.ExpressMiddlewareFactory = ExpressMiddlewareFactory; -//# sourceMappingURL=Express.js.map \ No newline at end of file diff --git a/lib/middleware/Express.js.map b/lib/middleware/Express.js.map deleted file mode 100644 index 50f6823..0000000 --- a/lib/middleware/Express.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Express.js","sourceRoot":"","sources":["Express.ts"],"names":["ExpressMiddlewareFactory"],"mappings":"AAIA,SAAgB,wBAAwB,CAAC,IAAU;IAC/CA,MAAMA,CAACA,UAAUA,GAAuBA,EAAEA,GAAwBA,EAAEA,IAA0CA;QAC1G,IAAI,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC;YAChB,MAAM,CAAC,cAAc,CAAC,GAAG,EAAE,IAAI,EAAE;gBAC7B,GAAG,EAAE;oBAAa,MAAM,CAAC,IAAI,CAAC;gBAAC,CAAC;aACnC,CAAC,CAAC;YACH,IAAI,EAAE,CAAC;QACX,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IACnB,CAAC,CAACA;AACNA,CAACA;AATe,gCAAwB,GAAxB,wBASf,CAAA;AAIA"} \ No newline at end of file diff --git a/lib/utils/Omnom.js b/lib/utils/Omnom.js deleted file mode 100644 index 3f39a13..0000000 --- a/lib/utils/Omnom.js +++ /dev/null @@ -1,149 +0,0 @@ -/// -/// -/// -var _ = require('lodash'); -var MongoDB = require('mongodb'); -var Omnom = (function () { - function Omnom(options) { - if (options === void 0) { 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) { - this.onObject(original, modified); - }; - Omnom.prototype.onObject = function (original, modified, changePath) { - if (original === undefined || original === null) - return (original !== modified) && this.set(changePath, modified); - if (typeof original == 'number' && typeof modified == 'number' && original !== modified) { - if (this.options.atomicNumbers) - return this.inc(changePath, modified - original); - return this.set(changePath, modified); - } - if (Array.isArray(original) && Array.isArray(modified)) - return this.onArray(original, modified, changePath); - if (original instanceof MongoDB.ObjectID && modified instanceof MongoDB.ObjectID) - return !original.equals(modified) && this.set(changePath, modified); - if (!_.isPlainObject(original) || !_.isPlainObject(modified)) - return !_.isEqual(original, modified) && this.set(changePath, modified); - _.each(modified, function (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)); - else - this.onObject(original[key], value, this.resolve(changePath, key)); - }, this); - // Unset removed properties - _.each(original, function (value, key) { - if (modified[key] === undefined || modified[key] === null) - return this.unset(this.resolve(changePath, key)); - }, this); - }; - Omnom.prototype.onArray = function (original, modified, changePath) { - var i, j; - // Check if we can get from original => modified using just pulls - if (original.length > modified.length) { - var pulls = []; - for (i = 0, j = 0; i < original.length && j < modified.length; i++) { - if (this.almostEqual(original[i], modified[j])) - j++; - else - pulls.push(original[i]); - } - for (; i < original.length; i++) - pulls.push(original[i]); - if (j === modified.length) { - if (pulls.length === 1) - return this.pull(changePath, pulls[0]); - // We can complete using just pulls - return this.pullAll(changePath, pulls); - } - else - return this.set(changePath, modified); - } - }; - Omnom.prototype.set = function (path, value) { - if (!this.changes.$set) - this.changes.$set = {}; - this.changes.$set[path] = value; - }; - Omnom.prototype.unset = function (path, value) { - if (!this.changes.$unset) - this.changes.$unset = {}; - this.changes.$unset[path] = value; - }; - Omnom.prototype.inc = function (path, value) { - if (!this.changes.$inc) - this.changes.$inc = {}; - this.changes.$inc[path] = value; - }; - Omnom.prototype.push = function (path, value) { - if (!this.changes.$push) - this.changes.$push = {}; - if (this.changes.$push[path]) { - if (this.changes.$push[path].$each) - this.changes.$push[path].$each.push(value); - else - this.changes.$push[path] = { $each: [this.changes.$push[path], value] }; - } - else - this.changes.$push[path] = value; - }; - Omnom.prototype.pull = function (path, value) { - if (!this.changes.$pull) - this.changes.$pull = {}; - if (this.changes.$pullAll && this.changes.$pullAll[path]) { - return this.changes.$pullAll[path].push(value); - } - if (this.changes.$pull[path]) { - this.pullAll(path, [this.changes.$pull[path], value]); - delete this.changes.$pull[path]; - return; - } - this.changes.$pull[path] = value; - }; - Omnom.prototype.pullAll = function (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 = []; - args.forEach(function (arg) { - if (arg) - validArguments.push(arg); - }); - return validArguments.join('.'); - }; - Omnom.prototype.almostEqual = function (o1, o2) { - if (!_.isPlainObject(o1) || !_.isPlainObject(o2)) - return o1 == o2 ? 1 : 0; - var o1i, o1k = Object.keys(o1); - var o2i, o2k = Object.keys(o2); - var commonKeys = []; - for (o1i = 0; o1i < o1k.length; o1i++) - if (~o2k.indexOf(o1k[o1i])) - commonKeys.push(o1k[o1i]); - var totalKeys = o1k.length + o2k.length - commonKeys.length; - var keysDifference = totalKeys - commonKeys.length; - var requiredChanges = 0; - for (var 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; -})(); -module.exports = Omnom; -//# sourceMappingURL=Omnom.js.map \ No newline at end of file diff --git a/lib/utils/Omnom.js.map b/lib/utils/Omnom.js.map deleted file mode 100644 index 4ed23f0..0000000 --- a/lib/utils/Omnom.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"Omnom.js","sourceRoot":"","sources":["Omnom.ts"],"names":["Omnom","Omnom.constructor","Omnom.changes","Omnom.diff","Omnom.onObject","Omnom.onArray","Omnom.set","Omnom.unset","Omnom.inc","Omnom.push","Omnom.pull","Omnom.pullAll","Omnom.resolve","Omnom.almostEqual"],"mappings":"AAAA,qDAAqD;AACrD,2DAA2D;AAC3D,yDAAyD;AAEzD,IAAO,CAAC,WAAW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