From cab9a81717efadd47a7ddb581d82317022037141 Mon Sep 17 00:00:00 2001 From: Benjamin Pannell Date: Fri, 24 Apr 2015 20:16:03 +0200 Subject: [PATCH] Renamed Promise to Bluebird to avoid confusion and possible conflicts --- lib/Cache.ts | 8 +-- lib/Core.js | 8 +-- lib/Core.js.map | 2 +- lib/Core.ts | 12 ++-- lib/Cursor.js | 14 ++--- lib/Cursor.js.map | 2 +- lib/Cursor.ts | 26 ++++----- lib/Instance.js | 20 +++---- lib/Instance.js.map | 2 +- lib/Instance.ts | 38 ++++++------ lib/Model.js | 28 ++++----- lib/Model.js.map | 2 +- lib/Model.ts | 106 +++++++++++++++++----------------- lib/ModelCache.js | 8 +-- lib/ModelCache.js.map | 2 +- lib/ModelCache.ts | 14 ++--- lib/ModelHandlers.js | 16 ++--- lib/ModelHandlers.js.map | 2 +- lib/ModelHandlers.ts | 22 +++---- lib/ModelHelpers.ts | 2 +- lib/caches/MemoryCache.js | 8 +-- lib/caches/MemoryCache.js.map | 2 +- lib/caches/MemoryCache.ts | 14 ++--- lib/caches/NoOpCache.js | 8 +-- lib/caches/NoOpCache.js.map | 2 +- lib/caches/NoOpCache.ts | 14 ++--- 26 files changed, 191 insertions(+), 191 deletions(-) diff --git a/lib/Cache.ts b/lib/Cache.ts index cd7cf0f..3c7b5ce 100644 --- a/lib/Cache.ts +++ b/lib/Cache.ts @@ -1,10 +1,10 @@ /// -import Promise = require('bluebird'); +import Bluebird = require('bluebird'); export = ICache; interface ICache { - set(key: string, value: T): Promise; - get(key: string): Promise; - clear(key: string): Promise + set(key: string, value: T): Bluebird; + get(key: string): Bluebird; + clear(key: string): Bluebird } \ No newline at end of file diff --git a/lib/Core.js b/lib/Core.js index 0f09c09..bf6ee0b 100644 --- a/lib/Core.js +++ b/lib/Core.js @@ -1,9 +1,9 @@ /// -var Promise = require('bluebird'); +var Bluebird = require('bluebird'); var MongoDB = require('mongodb'); var expressMiddleware = require('./middleware/Express'); var noOpCache = require('./caches/NoOpCache'); -var MongoConnectAsyc = Promise.promisify(MongoDB.MongoClient.connect); +var MongoConnectAsyc = Bluebird.promisify(MongoDB.MongoClient.connect); var Core = (function () { function Core(uri, config) { this._plugins = []; @@ -110,7 +110,7 @@ var Core = (function () { */ Core.prototype.connect = function (callback) { var self = this; - return Promise.bind(this).then(function () { + return Bluebird.bind(this).then(function () { if (self._connection) return self._connection; return MongoConnectAsyc(self.url); @@ -125,7 +125,7 @@ var Core = (function () { */ Core.prototype.close = function () { var self = this; - return Promise.bind(this).then(function () { + return Bluebird.bind(this).then(function () { if (!self._connection) return this; var conn = self._connection; diff --git a/lib/Core.js.map b/lib/Core.js.map index aa8cb84..fa1d3b1 100644 --- a/lib/Core.js.map +++ b/lib/Core.js.map @@ -1 +1 @@ -{"version":3,"file":"Core.js","sourceRoot":"","sources":["Core.ts"],"names":["Core","Core.constructor","Core.plugins","Core.settings","Core.connection","Core.url","Core.cache","Core.register","Core.connect","Core.close","Core.express"],"mappings":"AACA,AADA,4CAA4C;AAC5C,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;IAkFNA,SAlFEA,IAAIA,CAkFMA,GAAoBA,EAAEA,MAAeA;QAjFzCC,aAAQA,GAAcA,EAAEA,CAACA;QAIzBA,WAAMA,GAAUA,IAAIA,SAASA,EAAEA,CAACA;QA+EpCA,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,CAAA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C,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;IAEDR;;;OAGGA;IACHA,oBAAKA,GAALA;QACIS,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;IAEDT;;;;OAIGA;IACHA,sBAAOA,GAAPA;QACIU,MAAMA,CAACA,iBAAiBA,CAACA,wBAAwBA,CAACA,IAAIA,CAACA,CAACA;IAC5DA,CAACA;IACLV,WAACA;AAADA,CAACA,AApJD,IAoJC;AAtJD,iBAAS,IAAI,CAAC"} \ No newline at end of file +{"version":3,"file":"Core.js","sourceRoot":"","sources":["Core.ts"],"names":["Core","Core.constructor","Core.plugins","Core.settings","Core.connection","Core.url","Core.cache","Core.register","Core.connect","Core.close","Core.express"],"mappings":"AACA,AADA,4CAA4C;AAC5C,IAAO,QAAQ,WAAW,UAAU,CAAC,CAAC;AACtC,IAAO,OAAO,WAAW,SAAS,CAAC,CAAC;AAWpC,IAAO,iBAAiB,WAAW,sBAAsB,CAAC,CAA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,CAACA;IAEDT;;;;OAIGA;IACHA,sBAAOA,GAAPA;QACIU,MAAMA,CAACA,iBAAiBA,CAACA,wBAAwBA,CAACA,IAAIA,CAACA,CAACA;IAC5DA,CAACA;IACLV,WAACA;AAADA,CAACA,AApJD,IAoJC;AAtJD,iBAAS,IAAI,CAAC"} \ No newline at end of file diff --git a/lib/Core.ts b/lib/Core.ts index 369bb6f..9dbf30a 100644 --- a/lib/Core.ts +++ b/lib/Core.ts @@ -1,5 +1,5 @@ /// -import Promise = require('bluebird'); +import Bluebird = require('bluebird'); import MongoDB = require('mongodb'); import _ = require('lodash'); import http = require('http'); @@ -17,7 +17,7 @@ import cache = require('./Cache'); import noOpCache = require('./caches/NoOpCache'); import memoryCache = require('./caches/MemoryCache'); -var MongoConnectAsyc = Promise.promisify(MongoDB.MongoClient.connect); +var MongoConnectAsyc = Bluebird.promisify(MongoDB.MongoClient.connect); export = Core; @@ -135,9 +135,9 @@ class Core { * @param {function(Error, Iridium.Core)} [callback] A callback to be triggered once the connection is established. * @returns {Promise} */ - connect(callback?: (err: Error, core: Core) => any): Promise { + connect(callback?: (err: Error, core: Core) => any): Bluebird { var self = this; - return Promise.bind(this).then(function() { + return Bluebird.bind(this).then(function() { if (self._connection) return self._connection; return MongoConnectAsyc(self.url); }).then(function (db: MongoDB.Db) { @@ -150,9 +150,9 @@ class Core { * Closes the active database connection * @type {Promise} */ - close(): Promise { + close(): Bluebird { var self = this; - return Promise.bind(this).then(function() { + return Bluebird.bind(this).then(function() { if (!self._connection) return this; var conn: MongoDB.Db = self._connection; self._connection = null; diff --git a/lib/Cursor.js b/lib/Cursor.js index 6a81ea2..5474853 100644 --- a/lib/Cursor.js +++ b/lib/Cursor.js @@ -1,4 +1,4 @@ -var Promise = require('bluebird'); +var Bluebird = require('bluebird'); var Cursor = (function () { /** * Creates a new Iridium cursor which wraps a MongoDB cursor object @@ -19,7 +19,7 @@ var Cursor = (function () { */ Cursor.prototype.count = function (callback) { var _this = this; - return new Promise(function (resolve, reject) { + return new Bluebird(function (resolve, reject) { _this.cursor.count(true, function (err, count) { if (err) return reject(err); @@ -35,7 +35,7 @@ var Cursor = (function () { */ Cursor.prototype.each = function (handler, callback) { var _this = this; - return new Promise(function (resolve, reject) { + return new Bluebird(function (resolve, reject) { _this.cursor.each(function (err, item) { if (err) return reject(err); @@ -53,13 +53,13 @@ var Cursor = (function () { */ Cursor.prototype.map = function (transform, callback) { var _this = this; - return new Promise(function (resolve, reject) { + return new Bluebird(function (resolve, reject) { var promises = []; _this.cursor.each(function (err, item) { if (err) return reject(err); if (!item) - return resolve(Promise.all(promises)); + return resolve(Bluebird.all(promises)); promises.push(_this.model.handlers.documentReceived(_this.conditions, item, function (document, isNew, isPartial) { return _this.model.helpers.wrapDocument(document, isNew, isPartial); }).then(transform)); }); }).nodeify(callback); @@ -71,7 +71,7 @@ var Cursor = (function () { */ Cursor.prototype.toArray = function (callback) { var _this = this; - return new Promise(function (resolve, reject) { + return new Bluebird(function (resolve, reject) { _this.cursor.toArray(function (err, results) { if (err) return reject(err); @@ -88,7 +88,7 @@ var Cursor = (function () { */ Cursor.prototype.next = function (callback) { var _this = this; - return new Promise(function (resolve, reject) { + return new Bluebird(function (resolve, reject) { _this.cursor.nextObject(function (err, result) { if (err) return reject(err); diff --git a/lib/Cursor.js.map b/lib/Cursor.js.map index 7ad0838..f818d5e 100644 --- a/lib/Cursor.js.map +++ b/lib/Cursor.js.map @@ -1 +1 @@ -{"version":3,"file":"Cursor.js","sourceRoot":"","sources":["Cursor.ts"],"names":["Cursor","Cursor.constructor","Cursor.count","Cursor.each","Cursor.map","Cursor.toArray","Cursor.next","Cursor.rewind","Cursor.sort","Cursor.limit","Cursor.skip"],"mappings":"AAIA,IAAO,OAAO,WAAW,UAAU,CAAC,CAAC;AAKrC,IAAM,MAAM;IACRA;;;;;;OAMGA;IACHA,SAREA,MAAMA,CAQYA,KAAkCA,EAAUA,UAAeA,EAASA,MAAsBA;QAA1FC,UAAKA,GAALA,KAAKA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C"} \ No newline at end of file +{"version":3,"file":"Cursor.js","sourceRoot":"","sources":["Cursor.ts"],"names":["Cursor","Cursor.constructor","Cursor.count","Cursor.each","Cursor.map","Cursor.toArray","Cursor.next","Cursor.rewind","Cursor.sort","Cursor.limit","Cursor.skip"],"mappings":"AAIA,IAAO,QAAQ,WAAW,UAAU,CAAC,CAAC;AAKtC,IAAM,MAAM;IACRA;;;;;;OAMGA;IACHA,SAREA,MAAMA,CAQYA,KAAkCA,EAAUA,UAAeA,EAASA,MAAsBA;QAA1FC,UAAKA,GAALA,KAAKA,CAA6BA;QAAUA,eAAUA,GAAVA,UAAUA,CAAKA;QAASA,WAAMA,GAANA,MAAMA,CAAgBA;IAE9GA,CAACA;IAEDD;;;;OAIGA;IACHA,sBAAKA,GAALA,UAAMA,QAAmCA;QAAzCE,iBAOCA;QANGA,MAAMA,CAACA,IAAIA,QAAQA,CAASA,UAACA,OAAOA,EAAEA,MAAMA;YACxCA,KAAIA,CAACA,MAAMA,CAACA,KAAKA,CAACA,IAAIA,EAACA,UAACA,GAAGA,EAAEA,KAAKA;gBAC9BA,EAAEA,CAACA,CAACA,GAAGA,CAACA;oBAACA,MAAMA,CAACA,MAAMA,CAACA,GAAGA,CAACA,CAACA;gBAC5BA,MAAMA,CAACA,OAAOA,CAAMA,KAAKA,CAACA,CAACA;YAC/BA,CAACA,CAACA,CAACA;QACPA,CAACA,CAACA,CAACA,OAAOA,CAACA,QAAQA,CAACA,CAACA;IACzBA,CAACA;IAEDF;;;;;OAKGA;IACHA,qBAAIA,GAAJA,UAAKA,OAAsCA,EAAEA,QAAiCA;QAA9EG,iBAQCA;QAPGA,MAAMA,CAACA,IAAIA,QAAQA,CAAOA,UAACA,OAAOA,EAAEA,MAAMA;YACtCA,KAAIA,CAACA,MAAMA,CAACA,IAAIA,CAACA,UAACA,GAAGA,EAAEA,IAAeA;gBAClCA,EAAEA,CAACA,CAACA,GAAGA,CAACA;oBAACA,MAAMA,CAACA,MAAMA,CAACA,GAAG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AACA,KAAKA,CAACA,KAAKA,CAACA,CAACA,CAACA;IAC7EA,CAACA;IAEDT;;;;;OAKGA;IACHA,qBAAIA,GAAJA,UAAKA,IAAYA;QACbU,MAAMA,CAACA,IAAIA,MAAMA,CAACA,IAAIA,CAACA,KAAKA,EAAEA,IAAIA,CAACA,UAAUA,EAAEA,IAAIA,CAACA,MAAMA,CAACA,IAAIA,CAACA,IAAIA,CAACA,CAACA,CAACA;IAC3EA,CAACA;IACLV,aAACA;AAADA,CAACA,AA/HD,IA+HC;AAjID,iBAAS,MAAM,CAAC"} \ No newline at end of file diff --git a/lib/Cursor.ts b/lib/Cursor.ts index 3bb6139..0308a33 100644 --- a/lib/Cursor.ts +++ b/lib/Cursor.ts @@ -2,7 +2,7 @@ import Model = require('./Model'); import General = require('./General'); import MongoDB = require('mongodb'); -import Promise = require('bluebird'); +import Bluebird = require('bluebird'); import Index = require('./Index'); export = Cursor; @@ -24,8 +24,8 @@ class Cursor { * @param {function(Error, Number)} callback A callback which is triggered when the result is available * @return {Promise} A promise which will resolve with the number of documents matched by this cursor */ - count(callback?: General.Callback): Promise { - return new Promise((resolve, reject) => { + count(callback?: General.Callback): Bluebird { + return new Bluebird((resolve, reject) => { this.cursor.count(true,(err, count) => { if (err) return reject(err); return resolve(count); @@ -39,8 +39,8 @@ class Cursor { * @param {function(Error)} callback A callback which is triggered when all operations have been dispatched * @return {Promise} A promise which is resolved when all operations have been dispatched */ - each(handler: (instance: TInstance) => void, callback?: General.Callback): Promise { - return new Promise((resolve, reject) => { + each(handler: (instance: TInstance) => void, callback?: General.Callback): Bluebird { + return new Bluebird((resolve, reject) => { this.cursor.each((err, item: TDocument) => { if (err) return reject(err); if (!item) return resolve(null); @@ -55,12 +55,12 @@ class Cursor { * @param {function(Error, TResult[])} callback A callback which is triggered when the transformations are completed * @return {Promise} A promise which is fulfilled with the results of the transformations */ - map(transform: (instance: TInstance) => TResult | Promise, callback?: General.Callback): Promise { - return new Promise((resolve, reject) => { - var promises: Promise[] = []; + map(transform: (instance: TInstance) => TResult | Bluebird, callback?: General.Callback): Bluebird { + return new Bluebird((resolve, reject) => { + var promises: Bluebird[] = []; this.cursor.each((err, item: TDocument) => { if (err) return reject(err); - if (!item) return resolve(Promise.all(promises)); + if (!item) return resolve(Bluebird.all(promises)); promises.push(this.model.handlers.documentReceived(this.conditions, item,(document, isNew?, isPartial?) => this.model.helpers.wrapDocument(document, isNew, isPartial)) .then(<(instance) => TResult>transform)); }); @@ -72,8 +72,8 @@ class Cursor { * @param {function(Error, TInstance[])} callback A callback which is triggered with the resulting instances * @return {Promise} A promise which resolves with the instances returned by the query */ - toArray(callback?: General.Callback): Promise { - return new Promise((resolve, reject) => { + toArray(callback?: General.Callback): Bluebird { + return new Bluebird((resolve, reject) => { this.cursor.toArray((err, results: any[]) => { if (err) return reject(err); return resolve(results); @@ -88,8 +88,8 @@ class Cursor { * @param {function(Error, TInstance)} callback A callback which is triggered when the next item becomes available * @return {Promise} A promise which is resolved with the next item */ - next(callback?: General.Callback): Promise { - return new Promise((resolve, reject) => { + next(callback?: General.Callback): Bluebird { + return new Bluebird((resolve, reject) => { this.cursor.nextObject((err, result: any) => { if (err) return reject(err); return resolve(result); diff --git a/lib/Instance.js b/lib/Instance.js index 5da15a6..cb3d94d 100644 --- a/lib/Instance.js +++ b/lib/Instance.js @@ -1,5 +1,5 @@ var _ = require('lodash'); -var Promise = require('bluebird'); +var Bluebird = require('bluebird'); var Instance = (function () { /** * Creates a new instance which represents the given document as a type of model @@ -56,13 +56,13 @@ var Instance = (function () { conditions = arg; } }); - return Promise.resolve().then(function () { + return Bluebird.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); + return Bluebird.reject(validation.error).bind(_this).nodeify(callback); var original = _.cloneDeep(_this._original); var modified = _.cloneDeep(_this._modified); changes = _this._model.helpers.diff(original, modified); @@ -78,14 +78,14 @@ var Instance = (function () { if (!changes && !_this._isNew) return false; if (_this._isNew) - return new Promise(function (resolve, reject) { + return new Bluebird(function (resolve, reject) { _this._model.collection.insert(_this._modified, function (err, doc) { if (err) return reject(err); return resolve(!!doc); }); }); - return new Promise(function (resolve, reject) { + return new Bluebird(function (resolve, reject) { _this._model.collection.update(conditions, changes, { w: 1 }, function (err, changed) { if (err) return reject(err); @@ -99,7 +99,7 @@ var Instance = (function () { _this._model.helpers.transform.reverse(document); return document; } - return new Promise(function (resolve, reject) { + return new Bluebird(function (resolve, reject) { _this._model.collection.findOne(conditions, function (err, latest) { if (err) return reject(err); @@ -133,8 +133,8 @@ var Instance = (function () { Instance.prototype.refresh = function (callback) { var _this = this; var conditions = this._model.helpers.selectOne(this._original); - return Promise.resolve().then(function () { - return new Promise(function (resolve, reject) { + return Bluebird.resolve().then(function () { + return new Bluebird(function (resolve, reject) { _this._model.collection.findOne(conditions, function (err, doc) { if (err) return reject(err); @@ -176,10 +176,10 @@ var Instance = (function () { Instance.prototype.remove = function (callback) { var _this = this; var conditions = this._model.helpers.selectOne(this._original); - return Promise.resolve().then(function () { + return Bluebird.resolve().then(function () { if (_this._isNew) return 0; - return new Promise(function (resolve, reject) { + return new Bluebird(function (resolve, reject) { _this._model.collection.remove(conditions, function (err, removed) { if (err) return reject(err); diff --git a/lib/Instance.js.map b/lib/Instance.js.map index 6c306cc..cb4f9d8 100644 --- a/lib/Instance.js.map +++ b/lib/Instance.js.map @@ -1 +1 @@ -{"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","Instance.toJSON","Instance.toString"],"mappings":"AAIA,IAAO,CAAC,WAAW,QAAQ,CAAC,CAAC;AAC7B,IAAO,OAAO,WAAW,UAAU,CAAC,CAAC;AAIrC,IAAM,QAAQ;IACVA;;;;;;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CA,EAAEA,MAAMA;gBACpEA,KAAIA,CAACA,MAAMA,CAACA,UAAUA,CAACA,MAAMA,CAACA,UAAUA,EAAEA,OAAOA,EAAEA,EAAEA,CAACA,EAAEA,CAACA,EAAEA,EAACA,UAACA,GAAUA,EAAEA,OAAgBA;oBACrFA,EAAEA,CAACA,CAACA,GAAGA,CAACA;wBAACA,MAAMA,CAACA,MAAMA,CAACA,GAAGA,CAACA,CAACA;oBAC5BA,MAAMA,CAACA,OAAOA,CAACA,OAAOA,CAACA,CAACA;gBAC5BA,CAACA,CAACA,CAACA;YACPA,CAACA,CAACA,CAACA;QACPA,CAACA,CAACA,CAACA,IAAIA,CAACA,UAACA,OAAgBA;YACrBA,UAAUA,GAAGA,KAAIA,CAACA,MAAMA,CAACA,OAAOA,CAACA,SAASA,CAACA,KAAIA,CAACA,SAASA,CAACA,CAACA;YAC3DA,EAAEA,CAACA,CAACA,CAACA,OAAOA,CAACA,CAACA,CAACA;gBACXA,IAAIA,QAAQA,GAAGA,CAACA,CAACA,SAASA,CAACA,KAAIA,CAACA,SAASA,CAACA,CAACA;gBAC3CA,KAAIA,CAACA,MAAMA,CAACA,OAAOA,CAACA,SAASA,CAACA,OAAOA,CAACA,QAAQA,CAACA,CAACA;gBAChDA,MAAMA,CAACA,QAAQA,CAACA;YACpBA,CAACA;YAEDA,MAAMA,CAACA,IAAIA,OAAOA,CAAYA,UAACA,OAAOA,EAAEA,MAAMA;gBAC1CA,KAAIA,CAACA,MAAMA,CAACA,UAAUA,CAACA,OAAOA,CAACA,UAAUA,EAACA,UAACA,GAAUA,EAAEA,MAAMA;oBACzDA,EAAEA,CAACA,CAACA,GAAGA,CAACA;wBAACA,MAAMA,CAACA,MAAMA,CAACA,GAAGA,CAACA,CAACA;oBAC5BA,MAAMA,CAACA,OAAOA,CAACA,MAAMA,CAACA,CAACA;gBAC3BA,CAACA,CAACA,CAACA;YACPA,CAACA,CAACA,CAACA;QACPA,CAACA,CAACA,CAACA,IAAIA,CAACA,U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ACA,CAACA;oBAC5BA,MAAMA,CAACA,OAAOA,CAACA,GAAGA,CAACA,CAACA;gBACxBA,CAACA,CAACA,CAACA;YACPA,CAACA,CAACA,CAACA;QACPA,CAACA,CAACA,CAACA,IAAIA,CAACA,UAACA,WAAWA;YAChBA,EAAEA,CAACA,CAACA,CAACA,WAAWA,CAACA,CAACA,CAACA;gBACfA,KAAIA,CAACA,UAAUA,GAAGA,IAAIA,CAACA;gBACvBA,KAAIA,CAACA,MAAMA,GAAGA,IAAIA,CAACA;gBACnBA,KAAIA,CAACA,SAASA,GAAGA,CAACA,CAACA,SAASA,CAACA,KAAIA,CAACA,SAASA,CAACA,CAACA;gBAC7CA,MAAMA,CAA0BA,KAAIA,CAACA;YACzCA,CAACA;YAEDA,MAAMA,CAACA,KAAIA,CAACA,MAAMA,CAACA,QAAQA,CAACA,gBAAgBA,CAAYA,UAAUA,EAAEA,WAAWA,EAACA,UAACA,GAAGA;gBAChFA,KAAIA,CAACA,MAAMA,CAACA,OAAOA,CAACA,SAASA,CAACA,KAAKA,CAACA,GAAGA,CAACA,CAACA;gBACzCA,MAAMA,CAACA,GAAGA,CAACA;YACfA,CAACA,CAACA,CAACA,IAAIA,CAACA,UAACA,GAAGA;gBACRA,KAAIA,CAACA,MAAMA,GAAGA,KAAKA,CAACA;gBACpBA,KAAIA,CAACA,UAAUA,GAAGA,KAAKA,CAACA;gBACxBA,KAAIA,CAACA,SAASA,GAAGA,GAAGA,CAACA;gBACrBA,KAAIA,CAACA,SAASA,GAAGA,CAACA,CAACA,SAASA,CAACA,GAAGA,CAACA,CAACA;gBAElCA,MAAMA,CAAiBA,KAAIA,CAACA;YAChCA,CAACA,CAACA,CAACA;QACPA,CAACA,CAACA,CAACA,OAAOA,CAACA,QAAQA,CAACA,CAACA;IACzBA,CAACA;IAEDL;;;;OAIGA;IACHA,yBAAMA,GAANA,UAAOA,QAAsCA;QACzCM,MAAMA,CAACA,IAAIA,CAACA,MAAMA,CAACA,QAAQA,CAACA,CA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IAAIA,EAAEA,CAACA,CAACA,CAACA;IAClDA,CAACA;IACLX,eAACA;AAADA,CAACA,AAhSD,IAgSC;AAEiB,AAAlB,iBAAS,QAAQ,CAAC"} \ No newline at end of file +{"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","Instance.toJSON","Instance.toString"],"mappings":"AAIA,IAAO,CAAC,WAAW,QAAQ,CAAC,CAAC;AAC7B,IAAO,QAAQ,WAAW,UAAU,CAAC,CAAC;AAItC,IAAM,QAAQ;IACVA;;;;;;;;;;;OAWGA;IACHA,SAbEA,QAAQA,CAaEA,KAAkCA,EAAEA,QAAmBA,EAAEA,KAAqBA,EAAEA,SAA0BA;QAb1HC,iBAgSCA;QAnRwEA,qBAAqBA,GAArBA,YAAqBA;QAAEA,yBAA0BA,GAA1BA,iBAA0BA;QAClHA,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,EAACA,UAACA,MAAeA;YACtCA,EAAEA,CAACA,CAACA,MAAMA,CAACA,WAAWA,CAACA;gBAACA,MAAMA,CAACA,WAAWA,CAACA,KAAIA,EAAEA,KAAKA,CAACA,CAACA;QAC5DA,CAACA,CAACA,CAACA;IACPA,CAACA;IAWDD,sBAAIA,8BAAQA;QAHZA;;WAEGA;aACHA;YACIE,MAAMA,CAACA,IAAIA,CAACA,SAASA,CAACA;QAC1BA,CAACA;;;OAAAF;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,OAAOA,EAAEA,MAAMA;oBAC1DA,KAAIA,CAACA,MAAMA,CAACA,UAAUA,CAACA,MAAMA,CAACA,KAAIA,CAACA,SAASA,EAACA,UAACA,GAAGA,EAAEA,GAAGA;wBAClDA,EAAEA,CAACA,CAACA,GAAGA,CAACA;4BAACA,MAAMA,CAACA,MAAMA,CAACA,GAAGA,CAACA,CAACA;wBAC5BA,MAAMA,CAACA,OAAOA,CAAMA,CAACA,CAACA,GAAGA,CAACA,CAACA;oBAC/BA,CAACA,CAACA,CAACA;gBACPA,CAACA,CAACA,CAACA;YAEHA,MAAMA,CAACA,IAAIA,QAAQA,CAAUA,UAACA,OAAmCA,EAAEA,MAAMA;gBACrEA,KAAIA,CAACA,MAAMA,CAACA,UAAUA,CAACA,MAAMA,CAACA,UAAUA,EAAEA,OAAOA,EAAEA,EAAEA,CAACA,EAAEA,CAACA,EAAEA,EAACA,UAACA,GAAUA,EAAEA,OAAgBA;oBACrFA,EAAEA,CAACA,CAACA,GAAGA,CAACA;wBAACA,MAAMA,CAACA,MAAMA,CAACA,GAAGA,CAACA,CAACA;oBAC5BA,MAAMA,CAACA,OAAOA,CAACA,OAAOA,CAACA,CAACA;gBAC5BA,CAACA,CAACA,CAACA;YACPA,CAACA,CAACA,CAACA;QACPA,CAACA,CAACA,CAACA,IAAIA,CAACA,UAACA,OAAgBA;YACrBA,UAAUA,GAAGA,KAAIA,CAACA,MAAMA,CAACA,OAAOA,CAACA,SAASA,CAACA,KAAIA,CAACA,SAASA,CAACA,CAACA;YAC3DA,EAAEA,CAACA,CAACA,CAACA,OAAOA,CAACA,CAACA,CAACA;gBACXA,IAAIA,QAAQA,GAAGA,CAACA,CAACA,SAASA,CAACA,KAAIA,CAACA,SAASA,CAACA,CAACA;gBAC3CA,KAAIA,CAACA,MAAMA,CAACA,OAAOA,CAACA,SAASA,CAACA,OAAOA,CAACA,QAAQA,CAACA,CAACA;gBAChDA,MAAMA,CAACA,QAAQA,CAACA;YACpBA,CAACA;YAEDA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,OAAOA,CAACA,IAAIA,CAACA,KAAKA,CAACA,CAACA;gBACjCA,IAAIA;oBAACA,OAAOA,CAACA,GAAGA,CAACA,GAAGA,KAAKA,CAACA;YAC9BA,CAACA;QACLA,CAACA,CAACA,CAACA;QAEHA,MAAMA,CAACA,OAAOA,CAACA;IACnBA,CAACA;IAEDT;;;OAGGA;IACHA,yBAAMA,GAANA;QACIU,MAAMA,CAACA,IAAIA,CAACA,QAAQA,CAACA;IACzBA,CAACA;IAEDV;;;OAGGA;IACHA,2BAAQA,GAARA;QACIW,MAAMA,CAACA,IAAIA,CAACA,SAASA,CAACA,IAAIA,CAACA,QAAQA,EAAEA,IAAIA,EAAEA,CAACA,CAACA,CAACA;IAClDA,CAACA;IACLX,eAACA;AAADA,CAACA,AAhSD,IAgSC;AAEiB,AAAlB,iBAAS,QAAQ,CAAC"} \ No newline at end of file diff --git a/lib/Instance.ts b/lib/Instance.ts index c454d16..97b23bd 100644 --- a/lib/Instance.ts +++ b/lib/Instance.ts @@ -3,7 +3,7 @@ import iridium = require('./Core'); import Model = require('./Model'); import IPlugin = require('./Plugins'); import _ = require('lodash'); -import Promise = require('bluebird'); +import Bluebird = require('bluebird'); import general = require('./General'); @@ -53,14 +53,14 @@ class Instance { * @param {function(Error, IInstance)} callback A callback which is triggered when the save operation completes * @returns {Promise} */ - save(callback?: general.Callback): Promise; + save(callback?: general.Callback): Bluebird; /** * Saves the given changes to this instance and updates the instance to match the latest database document. * @param {Object} changes The MongoDB changes object to be used when updating this instance * @param {function(Error, IInstance)} callback A callback which is triggered when the save operation completes * @returns {Promise} */ - save(changes: Object, callback?: general.Callback): Promise; + save(changes: Object, callback?: general.Callback): Bluebird; /** * Saves the given changes to this instance and updates the instance to match the latest database document. * @param {Object} conditions The conditions under which the update will take place - these will be merged with an _id query @@ -68,8 +68,8 @@ class Instance { * @param {function(Error, IInstance)} callback A callback which is triggered when the save operation completes * @returns {Promise} */ - save(conditions: Object, changes: Object, callback?: general.Callback): Promise; - save(...args: any[]): Promise { + save(conditions: Object, changes: Object, callback?: general.Callback): Bluebird; + save(...args: any[]): Bluebird { var callback: general.Callback = null; var changes: any = null; var conditions: any = {}; @@ -82,14 +82,14 @@ class Instance { } }); - return Promise.resolve().then(() => { + return Bluebird.resolve().then(() => { _.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); + if (validation.failed) return Bluebird.reject(validation.error).bind(this).nodeify(callback); var original = _.cloneDeep(this._original); var modified = _.cloneDeep(this._modified); @@ -106,14 +106,14 @@ class Instance { }).then((changes) => { if (!changes && !this._isNew) return false; - if (this._isNew) return new Promise((resolve, reject) => { + if (this._isNew) return new Bluebird((resolve, reject) => { this._model.collection.insert(this._modified,(err, doc) => { if (err) return reject(err); return resolve(!!doc); }); }); - return new Promise((resolve: (changed: boolean) => void, reject) => { + return new Bluebird((resolve: (changed: boolean) => void, reject) => { this._model.collection.update(conditions, changes, { w: 1 },(err: Error, changed: boolean) => { if (err) return reject(err); return resolve(changed); @@ -127,7 +127,7 @@ class Instance { return document; } - return new Promise((resolve, reject) => { + return new Bluebird((resolve, reject) => { this._model.collection.findOne(conditions,(err: Error, latest) => { if (err) return reject(err); return resolve(latest); @@ -150,7 +150,7 @@ class Instance { * @param {function(Error, IInstance)} callback A callback which is triggered when the update completes * @returns {Promise} */ - update(callback?: general.Callback): Promise { + update(callback?: general.Callback): Bluebird { return this.refresh(callback); } @@ -159,11 +159,11 @@ class Instance { * @param {function(Error, IInstance)} callback A callback which is triggered when the update completes * @returns {Promise} */ - refresh(callback?: general.Callback): Promise { + refresh(callback?: general.Callback): Bluebird { var conditions = this._model.helpers.selectOne(this._original); - return Promise.resolve().then(() => { - return new Promise((resolve, reject) => { + return Bluebird.resolve().then(() => { + return new Bluebird((resolve, reject) => { this._model.collection.findOne(conditions,(err: Error, doc: any) => { if (err) return reject(err); return resolve(doc); @@ -174,7 +174,7 @@ class Instance { this._isPartial = true; this._isNew = true; this._original = _.cloneDeep(this._modified); - return >this; + return >this; } return this._model.handlers.documentReceived(conditions, newDocument,(doc) => { @@ -196,7 +196,7 @@ class Instance { * @param {function(Error, IInstance)} callback A callback which is triggered when the operation completes * @returns {Promise} */ - delete(callback?: general.Callback): Promise { + delete(callback?: general.Callback): Bluebird { return this.remove(callback); } @@ -205,12 +205,12 @@ class Instance { * @param {function(Error, IInstance)} callback A callback which is triggered when the operation completes * @returns {Promise} */ - remove(callback?: general.Callback): Promise { + remove(callback?: general.Callback): Bluebird { var conditions = this._model.helpers.selectOne(this._original); - return Promise.resolve().then(() => { + return Bluebird.resolve().then(() => { if (this._isNew) return 0; - return new Promise((resolve, reject) => { + return new Bluebird((resolve, reject) => { this._model.collection.remove(conditions,(err: Error, removed?: any) => { if (err) return reject(err); return resolve(removed); diff --git a/lib/Model.js b/lib/Model.js index 05a29bd..af73919 100644 --- a/lib/Model.js +++ b/lib/Model.js @@ -1,7 +1,7 @@ /// var MongoDB = require('mongodb'); var Concoction = require('concoction'); -var Promise = require('bluebird'); +var Bluebird = require('bluebird'); var _ = require('lodash'); var Iridium = require('./Core'); var instance = require('./Instance'); @@ -248,7 +248,7 @@ var Model = (function () { _.defaults(options, { cache: true }); - return Promise.resolve().bind(this).then(function () { + return Bluebird.resolve().bind(this).then(function () { _this._helpers.transform.reverse(conditions); if (options.fields) _this._helpers.transform.reverse(options.fields); @@ -256,7 +256,7 @@ var Model = (function () { }).then(function (cachedDocument) { if (cachedDocument) return cachedDocument; - return new Promise(function (resolve, reject) { + return new Bluebird(function (resolve, reject) { _this.collection.findOne(conditions, { fields: options.fields, skip: options.skip, @@ -305,12 +305,12 @@ var Model = (function () { _.defaults(options, { w: 1 }); - return Promise.resolve().then(function () { + return Bluebird.resolve().then(function () { var 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 Promise(function (resolve, reject) { + return new Bluebird(function (resolve, reject) { _this.collection.findAndModify({ _id: object._id }, ["_id"], object, queryOptions, function (err, result) { if (err) return reject(err); @@ -321,7 +321,7 @@ var Model = (function () { } else return _this._handlers.creatingDocuments(objects).then(function (objects) { - return new Promise(function (resolve, reject) { + return new Bluebird(function (resolve, reject) { _this.collection.insert(objects, queryOptions, function (err, results) { if (err) return reject(err); @@ -348,7 +348,7 @@ var Model = (function () { multi: true }); this._helpers.transform.reverse(conditions); - return new Promise(function (resolve, reject) { + return new Bluebird(function (resolve, reject) { _this.collection.update(conditions, changes, options, function (err, changes) { if (err) return reject(err); @@ -362,7 +362,7 @@ var Model = (function () { callback = conditions; conditions = {}; } - return new Promise(function (resolve, reject) { + return new Bluebird(function (resolve, reject) { _this.collection.count(conditions, function (err, results) { if (err) return reject(err); @@ -377,7 +377,7 @@ var Model = (function () { conditions = {}; } conditions = conditions || {}; - return new Promise(function (resolve, reject) { + return new Bluebird(function (resolve, reject) { _this._helpers.transform.reverse(conditions); _this.collection.remove(conditions, function (err, results) { if (err) @@ -387,7 +387,7 @@ var Model = (function () { }).then(function (count) { if (count === 1) return _this._cache.clear(conditions).then(function () { return count; }); - return Promise.resolve(count); + return Bluebird.resolve(count); }).nodeify(callback); }; Model.prototype.ensureIndex = function (specification, options, callback) { @@ -396,7 +396,7 @@ var Model = (function () { callback = options; options = {}; } - return new Promise(function (resolve, reject) { + return new Bluebird(function (resolve, reject) { _this.collection.ensureIndex(specification, options, function (err, name) { if (err) return reject(err); @@ -411,7 +411,7 @@ var Model = (function () { */ Model.prototype.ensureIndexes = function (callback) { var _this = this; - return Promise.resolve(this.options.indexes).map(function (index) { + return Bluebird.resolve(this.options.indexes).map(function (index) { return _this.ensureIndex(index.spec || index, index.options || {}); }).nodeify(callback); }; @@ -423,7 +423,7 @@ var Model = (function () { else { index = _(specification).map(function (direction, key) { return key + '_' + direction; }).reduce(function (x, y) { return x + '_' + y; }); } - return new Promise(function (resolve, reject) { + return new Bluebird(function (resolve, reject) { _this.collection.dropIndex(index, function (err, count) { if (err) return reject(err); @@ -438,7 +438,7 @@ var Model = (function () { */ Model.prototype.dropIndexes = function (callback) { var _this = this; - return new Promise(function (resolve, reject) { + return new Bluebird(function (resolve, reject) { _this.collection.dropAllIndexes(function (err, count) { if (err) return reject(err); diff --git a/lib/Model.js.map b/lib/Model.js.map index 5fbbcdc..141c8ae 100644 --- a/lib/Model.js.map +++ b/lib/Model.js.map @@ -1 +1 @@ -{"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.collectionName","Model.cacheDirector","Model.cache","Model.Instance","Model.find","Model.get","Model.findOne","Model.create","Model.insert","Model.update","Model.count","Model.remove","Model.ensureIndex","Model.ensureIndexes","Model.dropIndex","Model.dropIndexes"],"mappings":"AACA,AADA,4CAA4C;AAC5C,IAAO,OAAO,WAAW,SAAS,CAAC,CAAC;AAEpC,IAAO,UAAU,WAAW,YAAY,CAAC,CAAC;AAC1C,IAAO,OAAO,WAAW,UAAU,CAAC,CAAC;AAErC,IAAO,CAAC,WAAW,QAAQ,CAAC,CAAC;AAE7B,IAAO,OAAO,WAAW,QAAQ,CAAC,CAAC;AACnC,IAAO,QAAQ,WAAW,YAAY,CAAC,CAAC;AAOxC,IAAO,MAAM,WAAW,UAAU,CAAC,CAAC;AAMpC,IAAO,iBAAiB,WAAW,+BAA+B,CAAC,CAAC;AAGpE,IAAO,UAAU,WAAW,cAAc,CAAC,CAAC;AAC5C,IAAO,YAAY,WAAW,gBAAgB,CAAC,CAAC;AAChD,IAAO,aAAa,WAAW,iBAAiB,CAAC,CAAC;AAElD,IAAO,qBAAqB,WAAW,yBAAyB,CAAC,CAAC;AAQlE,AAJA;;;GAGG;IACG,KAAK;IACPA;;;;;;;;OAQGA;IACHA,SAVEA,KAAKA,CAUKA,IAAaA,EAAEA,YAA+HA,EAAEA,UAAkBA,EA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A,GAAGA,CAACA,UAACA,SAASA,EAAEA,GAAGA,IAAKA,OAAAA,GAAGA,GAAGA,GAAGA,GAAGA,SAASA,EAArBA,CAAqBA,CAACA,CAACA,MAAMA,CAASA,UAACA,CAACA,EAAEA,CAACA,IAAKA,OAAAA,CAACA,GAAGA,GAAGA,GAAGA,CAACA,EAAXA,CAAWA,CAACA,CAACA;QAC5IA,CAACA;QAEDA,MAAMA,CAACA,IAAIA,OAAOA,CAAMA,UAACA,OAAOA,EAAEA,MAAMA;YACpCA,KAAIA,CAACA,UAAUA,CAACA,SAASA,CAACA,KAAKA,EAACA,UAACA,GAAGA,EAAEA,KAAKA;gBACvCA,EAAEA,CAACA,CAACA,GAAGA,CAACA;oBAACA,MAAMA,CAACA,MAAMA,CAACA,GAAGA,CAACA,CAACA;gBAC5BA,MAAMA,CAACA,OAAOA,CAACA,KAAKA,CAACA,CAACA;YAC1BA,CAACA,CAACA,CAACA;QACPA,CAACA,CAACA,CAACA,OAAOA,CAACA,QAAQA,CAACA,CAACA;IACzBA,CAACA;IAEDtB;;;;OAIGA;IACHA,2BAAWA,GAAXA,UAAYA,QAAoCA;QAAhDuB,iBAOCA;QANGA,MAAMA,CAACA,IAAIA,OAAOA,CAAMA,UAACA,OAAOA,EAAEA,MAAMA;YACpCA,KAAIA,CAACA,UAAUA,CAACA,cAAcA,CAACA,UAACA,GAAGA,EAAEA,KAAKA;gBACtCA,EAAEA,CAACA,CAACA,GAAGA,CAACA;oBAACA,MAAMA,CAACA,MAAMA,CAACA,GAAGA,CAACA,CAACA;gBAC5BA,MAAMA,CAACA,OAAOA,CAACA,KAAKA,CAACA,CAACA;YAC1BA,CAACA,CAACA,CAACA;QACPA,CAACA,CAACA,CAACA,OAAOA,CAACA,QAAQA,CAACA,CAACA;IACzBA,CAACA;IACLvB,YAACA;AAADA,CAACA,AA5mBD,IA4mBC;AAlnBD,iBAAS,KAAK,CAAC"} \ No newline at end of file +{"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.collectionName","Model.cacheDirector","Model.cache","Model.Instance","Model.find","Model.get","Model.findOne","Model.create","Model.insert","Model.update","Model.count","Model.remove","Model.ensureIndex","Model.ensureIndexes","Model.dropIndex","Model.dropIndexes"],"mappings":"AACA,AADA,4CAA4C;AAC5C,IAAO,OAAO,WAAW,SAAS,CAAC,CAAC;AAEpC,IAAO,UAAU,WAAW,YAAY,CAAC,CAAC;AAC1C,IAAO,QAAQ,WAAW,UAAU,CAAC,CAAC;AAEtC,IAAO,CAAC,WAAW,QAAQ,CAAC,CAAC;AAE7B,IAAO,OAAO,WAAW,QAAQ,CAAC,CAAC;AACnC,IAAO,QAAQ,WAAW,YAAY,CAAC,CAAC;AAOxC,IAAO,MAAM,WAAW,UAAU,CAAC,CAAC;AAMpC,IAAO,iBAAiB,WAAW,+BAA+B,CAAC,CAAC;AAGpE,IAAO,UAAU,WAAW,cAAc,CAAC,CAAC;AAC5C,IAAO,YAAY,WAAW,gBAAgB,CAAC,CAAC;AAChD,IAAO,aAAa,WAAW,iBAAiB,CAAC,CAAC;AAElD,IAAO,qBAAqB,WAAW,yBAAyB,CAAC,CAAC;AAQlE,AAJA;;;GAGG;IACG,KAAK;IACPA;;;;;;;;OAQGA;IACHA,SAVEA,KAAKA,CAUKA,IAAaA,EAAEA,YAA+HA,EAAEA,UAAkBA,EAAEA,MAAeA,EAAEA,OAAiEA;QAVtQC,iBA4mBCA;QAlmBoMA,uBAAiEA,GAAjEA,YAAiEA;QAC9PA,EAAEA,CAACA,CAACA,CAACA,CAACA,IAAIA,YAAYA,OAAOA,CAACA,CAACA;YAACA,MAAMA,IAAIA,KAAKA,CAACA,2DAA2DA,CAACA,CAACA;QAC7GA,EAAEA,CAACA,CAACA,OAAOA,YAAYA,IAAIA,UAAUA,CAACA;YAACA,MAAMA,IAAIA,KAAKA,CAACA,mEAAmEA,CAACA,CAACA;QAC5HA,EAAE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CAACA,SAASA,CAACA,KAAKA,EAACA,UAACA,GAAGA,EAAEA,KAAKA;gBACvCA,EAAEA,CAACA,CAACA,GAAGA,CAACA;oBAACA,MAAMA,CAACA,MAAMA,CAACA,GAAGA,CAACA,CAACA;gBAC5BA,MAAMA,CAACA,OAAOA,CAACA,KAAKA,CAACA,CAACA;YAC1BA,CAACA,CAACA,CAACA;QACPA,CAACA,CAACA,CAACA,OAAOA,CAACA,QAAQA,CAACA,CAACA;IACzBA,CAACA;IAEDtB;;;;OAIGA;IACHA,2BAAWA,GAAXA,UAAYA,QAAoCA;QAAhDuB,iBAOCA;QANGA,MAAMA,CAACA,IAAIA,QAAQA,CAAMA,UAACA,OAAOA,EAAEA,MAAMA;YACrCA,KAAIA,CAACA,UAAUA,CAACA,cAAcA,CAACA,UAACA,GAAGA,EAAEA,KAAKA;gBACtCA,EAAEA,CAACA,CAACA,GAAGA,CAACA;oBAACA,MAAMA,CAACA,MAAMA,CAACA,GAAGA,CAACA,CAACA;gBAC5BA,MAAMA,CAACA,OAAOA,CAACA,KAAKA,CAACA,CAACA;YAC1BA,CAACA,CAACA,CAACA;QACPA,CAACA,CAACA,CAACA,OAAOA,CAACA,QAAQA,CAACA,CAACA;IACzBA,CAACA;IACLvB,YAACA;AAADA,CAACA,AA5mBD,IA4mBC;AAlnBD,iBAAS,KAAK,CAAC"} \ No newline at end of file diff --git a/lib/Model.ts b/lib/Model.ts index af82d73..f486a65 100644 --- a/lib/Model.ts +++ b/lib/Model.ts @@ -2,7 +2,7 @@ import MongoDB = require('mongodb'); import Skmatc = require('skmatc'); import Concoction = require('concoction'); -import Promise = require('bluebird'); +import Bluebird = require('bluebird'); import util = require('util'); import _ = require('lodash'); @@ -241,21 +241,21 @@ class Model implements ModelInterfaces.IModel} */ - get(callback?: general.Callback): Promise; + get(callback?: general.Callback): Bluebird; /** * Retrieves a single document from the collection with the given ID and wraps it as an instance * @param {any} id The document's unique _id field value in downstream format * @param {function(Error, TInstance)} callback An optional callback which will be triggered when a result is available * @returns {Promise} */ - get(id: any, callback?: general.Callback): Promise; + get(id: any, callback?: general.Callback): Bluebird; /** * Retrieves a single document from the collection which matches the conditions * @param {Object} conditions The MongoDB query dictating which document to return * @param {function(Error, TInstance)} callback An optional callback which will be triggered when a result is available * @returns {Promise} */ - get(conditions: { [key: string]: any }, callback?: general.Callback): Promise; + get(conditions: { [key: string]: any }, callback?: general.Callback): Bluebird; /** * Retrieves a single document from the collection with the given ID and wraps it as an instance * @param {any} id The document's unique _id field value in downstream format @@ -263,7 +263,7 @@ class Model implements ModelInterfaces.IModel} */ - get(id: any, options: ModelOptions.QueryOptions, callback?: general.Callback): Promise; + get(id: any, options: ModelOptions.QueryOptions, callback?: general.Callback): Bluebird; /** * Retrieves a single document from the collection which matches the conditions * @param {Object} conditions The MongoDB query dictating which document to return @@ -271,8 +271,8 @@ class Model implements ModelInterfaces.IModel} */ - get(conditions: { [key: string]: any }, options: ModelOptions.QueryOptions, callback?: general.Callback): Promise; - get(...args: any[]): Promise { + get(conditions: { [key: string]: any }, options: ModelOptions.QueryOptions, callback?: general.Callback): Bluebird; + get(...args: any[]): Bluebird { return this.findOne.apply(this, args); } @@ -281,21 +281,21 @@ class Model implements ModelInterfaces.IModel} */ - findOne(callback?: general.Callback): Promise; + findOne(callback?: general.Callback): Bluebird; /** * Retrieves a single document from the collection with the given ID and wraps it as an instance * @param {any} id The document's unique _id field value in downstream format * @param {function(Error, TInstance)} callback An optional callback which will be triggered when a result is available * @returns {Promise} */ - findOne(id: any, callback?: general.Callback): Promise; + findOne(id: any, callback?: general.Callback): Bluebird; /** * Retrieves a single document from the collection which matches the conditions * @param {Object} conditions The MongoDB query dictating which document to return * @param {function(Error, TInstance)} callback An optional callback which will be triggered when a result is available * @returns {Promise} */ - findOne(conditions: { [key: string]: any }, callback?: general.Callback): Promise; + findOne(conditions: { [key: string]: any }, callback?: general.Callback): Bluebird; /** * Retrieves a single document from the collection with the given ID and wraps it as an instance * @param {any} id The document's unique _id field value in downstream format @@ -303,7 +303,7 @@ class Model implements ModelInterfaces.IModel} */ - findOne(id: any, options: ModelOptions.QueryOptions, callback?: general.Callback): Promise; + findOne(id: any, options: ModelOptions.QueryOptions, callback?: general.Callback): Bluebird; /** * Retrieves a single document from the collection which matches the conditions * @param {Object} conditions The MongoDB query dictating which document to return @@ -311,8 +311,8 @@ class Model implements ModelInterfaces.IModel} */ - findOne(conditions: { [key: string]: any }, options: ModelOptions.QueryOptions, callback?: general.Callback): Promise; - findOne(...args: any[]): Promise { + findOne(conditions: { [key: string]: any }, options: ModelOptions.QueryOptions, callback?: general.Callback): Bluebird; + findOne(...args: any[]): Bluebird { var conditions: { [key: string]: any } = null; var options: ModelOptions.QueryOptions = null; var callback: general.Callback = null; @@ -333,7 +333,7 @@ class Model implements ModelInterfaces.IModel { + return Bluebird.resolve().bind(this).then(() => { this._helpers.transform.reverse(conditions); if (options.fields) @@ -343,7 +343,7 @@ class Model implements ModelInterfaces.IModel { if (cachedDocument) return cachedDocument; - return new Promise((resolve, reject) => { + return new Bluebird((resolve, reject) => { this.collection.findOne(conditions, { fields: options.fields, skip: options.skip, @@ -366,7 +366,7 @@ class Model implements ModelInterfaces.IModel} */ - create(objects: TDocument, callback?: general.Callback): Promise; + create(objects: TDocument, callback?: general.Callback): Bluebird; /** * Inserts an object into the collection after validating it against this model's schema * @param {Object} object The object to insert into the collection @@ -374,14 +374,14 @@ class Model implements ModelInterfaces.IModel} */ - create(objects: TDocument, options: ModelOptions.CreateOptions, callback?: general.Callback): Promise; + create(objects: TDocument, options: ModelOptions.CreateOptions, callback?: general.Callback): Bluebird; /** * Inserts the objects into the collection after validating them against this model's schema * @param {Object[]} objects The objects to insert into the collection * @param {function(Error, TInstance)} callback A callback which is triggered when the operation completes * @returns {Promise} */ - create(objects: TDocument[], callback?: general.Callback): Promise; + create(objects: TDocument[], callback?: general.Callback): Bluebird; /** * Inserts the objects into the collection after validating them against this model's schema * @param {Object[]} objects The objects to insert into the collection @@ -389,8 +389,8 @@ class Model implements ModelInterfaces.IModel} */ - create(objects: TDocument[], options: ModelOptions.CreateOptions, callback?: general.Callback): Promise; - create(...args: any[]): Promise { + create(objects: TDocument[], options: ModelOptions.CreateOptions, callback?: general.Callback): Bluebird; + create(...args: any[]): Bluebird { return this.insert.apply(this, args); } @@ -400,7 +400,7 @@ class Model implements ModelInterfaces.IModel} */ - insert(objects: TDocument, callback?: general.Callback): Promise; + insert(objects: TDocument, callback?: general.Callback): Bluebird; /** * Inserts an object into the collection after validating it against this model's schema * @param {Object} object The object to insert into the collection @@ -408,14 +408,14 @@ class Model implements ModelInterfaces.IModel} */ - insert(objects: TDocument, options: ModelOptions.CreateOptions, callback?: general.Callback): Promise; + insert(objects: TDocument, options: ModelOptions.CreateOptions, callback?: general.Callback): Bluebird; /** * Inserts the objects into the collection after validating them against this model's schema * @param {Object[]} objects The objects to insert into the collection * @param {function(Error, TInstance[])} callback A callback which is triggered when the operation completes * @returns {Promise} */ - insert(objects: TDocument[], callback?: general.Callback): Promise; + insert(objects: TDocument[], callback?: general.Callback): Bluebird; /** * Inserts the objects into the collection after validating them against this model's schema * @param {Object[]} objects The objects to insert into the collection @@ -423,8 +423,8 @@ class Model implements ModelInterfaces.IModel} */ - insert(objects: TDocument[], options: ModelOptions.CreateOptions, callback?: general.Callback): Promise; - insert(objs: TDocument | TDocument[], ...args: any[]): Promise { + insert(objects: TDocument[], options: ModelOptions.CreateOptions, callback?: general.Callback): Bluebird; + insert(objs: TDocument | TDocument[], ...args: any[]): Bluebird { var objects: TDocument[]; var options: ModelOptions.CreateOptions = {}; var callback: general.Callback = null; @@ -445,13 +445,13 @@ class Model implements ModelInterfaces.IModel { + return Bluebird.resolve().then(() => { var queryOptions = { w: options.w, upsert: options.upsert, new: true }; if (options.upsert) { var docs = this._handlers.creatingDocuments(objects); return docs.map((object:{ _id: any; }) => { - return new Promise((resolve, reject) => { + return new Bluebird((resolve, reject) => { this.collection.findAndModify({_id: object._id}, ["_id"], object, queryOptions, (err, result) => { if (err) return reject(err); return resolve(result); @@ -461,7 +461,7 @@ class Model implements ModelInterfaces.IModel { - return new Promise((resolve, reject) => { + return new Bluebird((resolve, reject) => { this.collection.insert(objects, queryOptions,(err, results) => { if (err) return reject(err); return resolve(results); @@ -482,7 +482,7 @@ class Model implements ModelInterfaces.IModel): Promise; + update(conditions: any, changes: any, callback?: general.Callback): Bluebird; /** * Updates the documents in the backing collection which match the conditions using the given update instructions * @param {Object} conditions The conditions which determine which documents will be updated @@ -490,8 +490,8 @@ class Model implements ModelInterfaces.IModel): Promise; - update(conditions: any, changes: any, options?: ModelOptions.UpdateOptions, callback?: general.Callback): Promise { + update(conditions: any, changes: any, options: ModelOptions.UpdateOptions, callback?: general.Callback): Bluebird; + update(conditions: any, changes: any, options?: ModelOptions.UpdateOptions, callback?: general.Callback): Bluebird { if (typeof options == 'function') { callback = >options; options = {}; @@ -504,7 +504,7 @@ class Model implements ModelInterfaces.IModel((resolve, reject) => { + return new Bluebird((resolve, reject) => { this.collection.update(conditions, changes, options,(err, changes) => { if (err) return reject(err); return resolve(changes); @@ -517,21 +517,21 @@ class Model implements ModelInterfaces.IModel} */ - count(callback?: general.Callback): Promise; + count(callback?: general.Callback): Bluebird; /** * Counts the number of documents in the collection which match the conditions provided * @param {Object} conditions The conditions which determine whether an object is counted or not * @param {function(Error, Number)} callback A callback which is triggered when the operation completes * @returns {Promise} */ - count(conditions: any, callback?: general.Callback): Promise; - count(conditions?: any, callback?: general.Callback): Promise { + count(conditions: any, callback?: general.Callback): Bluebird; + count(conditions?: any, callback?: general.Callback): Bluebird { if (typeof conditions == 'function') { callback = >conditions; conditions = {}; } - return new Promise((resolve, reject) => { + return new Bluebird((resolve, reject) => { this.collection.count(conditions,(err, results) => { if (err) return reject(err); return resolve(results); @@ -544,22 +544,22 @@ class Model implements ModelInterfaces.IModel} */ - remove(callback?: general.Callback): Promise; + remove(callback?: general.Callback): Bluebird; /** * Removes all documents from the collection which match the conditions * @param {Object} conditions The conditions determining whether an object is removed or not * @param {function(Error, Number)} callback A callback which is triggered when the operation completes * @returns {Promise} */ - remove(conditions: any, callback?: general.Callback): Promise; - remove(conditions?: any, callback?: general.Callback): Promise { + remove(conditions: any, callback?: general.Callback): Bluebird; + remove(conditions?: any, callback?: general.Callback): Bluebird { if (typeof conditions == 'function') { callback = >conditions; conditions = {}; } conditions = conditions || {}; - return new Promise((resolve, reject) => { + return new Bluebird((resolve, reject) => { this._helpers.transform.reverse(conditions); this.collection.remove(conditions,(err, results) => { if (err) return reject(err); @@ -568,7 +568,7 @@ class Model implements ModelInterfaces.IModel { if(count === 1) return this._cache.clear(conditions).then(() => count); - return Promise.resolve(count); + return Bluebird.resolve(count); }).nodeify(callback); } @@ -578,7 +578,7 @@ class Model implements ModelInterfaces.IModel} The name of the index */ - ensureIndex(specification: Index.IndexSpecification, callback?: general.Callback): Promise; + ensureIndex(specification: Index.IndexSpecification, callback?: general.Callback): Bluebird; /** * Ensures that the given index is created for the collection * @param {Object} specification The index specification object used by MongoDB @@ -586,14 +586,14 @@ class Model implements ModelInterfaces.IModel} The name of the index */ - ensureIndex(specification: Index.IndexSpecification, options: MongoDB.IndexOptions, callback?: general.Callback): Promise; - ensureIndex(specification: Index.IndexSpecification, options?: MongoDB.IndexOptions, callback?: general.Callback): Promise { + ensureIndex(specification: Index.IndexSpecification, options: MongoDB.IndexOptions, callback?: general.Callback): Bluebird; + ensureIndex(specification: Index.IndexSpecification, options?: MongoDB.IndexOptions, callback?: general.Callback): Bluebird { if (typeof options == 'function') { callback = >options; options = {}; } - return new Promise((resolve, reject) => { + return new Bluebird((resolve, reject) => { this.collection.ensureIndex(specification, options,(err, name: any) => { if (err) return reject(err); return resolve(name); @@ -606,8 +606,8 @@ class Model implements ModelInterfaces.IModel} The names of the indexes */ - ensureIndexes(callback?: general.Callback): Promise { - return Promise.resolve(this.options.indexes).map((index: Index.Index | Index.IndexSpecification) => { + ensureIndexes(callback?: general.Callback): Bluebird { + return Bluebird.resolve(this.options.indexes).map((index: Index.Index | Index.IndexSpecification) => { return this.ensureIndex((index).spec || index,(index).options || {}); }).nodeify(callback); } @@ -618,15 +618,15 @@ class Model implements ModelInterfaces.IModel} Whether the index was dropped */ - dropIndex(name: string, callback?: general.Callback): Promise; + dropIndex(name: string, callback?: general.Callback): Bluebird; /** * Drops the index if it exists in the collection * @param {IndexSpecification} index The index to remove * @param {function(Error, Boolean)} callback A callback which is triggered when the operation completes * @returns {Promise} Whether the index was dropped */ - dropIndex(index: Index.IndexSpecification, callback?: general.Callback): Promise; - dropIndex(specification: string | Index.IndexSpecification, callback?: general.Callback): Promise { + dropIndex(index: Index.IndexSpecification, callback?: general.Callback): Bluebird; + dropIndex(specification: string | Index.IndexSpecification, callback?: general.Callback): Bluebird { var index: string; if (typeof (specification) === 'string') index = specification; @@ -634,7 +634,7 @@ class Model implements ModelInterfaces.IModelspecification).map((direction, key) => key + '_' + direction).reduce((x, y) => x + '_' + y); } - return new Promise((resolve, reject) => { + return new Bluebird((resolve, reject) => { this.collection.dropIndex(index,(err, count) => { if (err) return reject(err); return resolve(count); @@ -647,8 +647,8 @@ class Model implements ModelInterfaces.IModel} Whether the indexes were dropped */ - dropIndexes(callback?: general.Callback): Promise { - return new Promise((resolve, reject) => { + dropIndexes(callback?: general.Callback): Bluebird { + return new Bluebird((resolve, reject) => { this.collection.dropAllIndexes((err, count) => { if (err) return reject(err); return resolve(count); diff --git a/lib/ModelCache.js b/lib/ModelCache.js index 3add95a..91da52e 100644 --- a/lib/ModelCache.js +++ b/lib/ModelCache.js @@ -1,21 +1,21 @@ -var Promise = require('bluebird'); +var Bluebird = require('bluebird'); var ModelCache = (function () { function ModelCache(model) { this.model = model; } ModelCache.prototype.set = function (value) { if (!this.model.cacheDirector || !this.model.cacheDirector.valid(value)) - return Promise.resolve(value); + return Bluebird.resolve(value); return this.model.core.cache.set(this.model.cacheDirector.buildKey(value), value); }; ModelCache.prototype.get = function (conditions) { if (!this.model.cacheDirector || !this.model.cacheDirector.validQuery(conditions)) - return Promise.resolve(null); + return Bluebird.resolve(null); return this.model.core.cache.get(this.model.cacheDirector.buildQueryKey(conditions)); }; ModelCache.prototype.clear = function (conditions) { if (!this.model.cacheDirector || !this.model.cacheDirector.validQuery(conditions)) - return Promise.resolve(false); + return Bluebird.resolve(false); return this.model.core.cache.clear(this.model.cacheDirector.buildQueryKey(conditions)); }; return ModelCache; diff --git a/lib/ModelCache.js.map b/lib/ModelCache.js.map index 9fb72f6..f54475b 100644 --- a/lib/ModelCache.js.map +++ b/lib/ModelCache.js.map @@ -1 +1 @@ -{"version":3,"file":"ModelCache.js","sourceRoot":"","sources":["ModelCache.ts"],"names":["ModelCache","ModelCache.constructor","ModelCache.set","ModelCache.get","ModelCache.clear"],"mappings":"AAEA,IAAO,OAAO,WAAW,UAAU,CAAC,CAAC;AAIrC,IAAM,UAAU;IACZA,SADEA,UAAUA,CACOA,KAAiCA;QAAjCC,UAAKA,GAALA,KAAKA,CAA4BA;IAEpDA,CAACA;IAEDD,wBAAGA,GAAHA,UAAOA,KAAQA;QACXE,EAAEA,CAACA,CAACA,CAACA,IAAIA,CAACA,KAAKA,CAACA,aAAaA,IAAIA,CAACA,IAAIA,CAACA,KAAKA,CAACA,aAAaA,CAACA,KAAKA,CAACA,KAAKA,CAACA,CAACA;YAACA,MAAMA,CAACA,OAAOA,CAACA,OAAOA,CAACA,KAAKA,CAACA,CAACA;QACvGA,MAAMA,CAACA,IAAIA,CAACA,KAAKA,CAACA,IAAIA,CAACA,KAAKA,CAACA,GAAGA,CAACA,IAAIA,CAACA,KAAKA,CAACA,aAAaA,CAACA,QAAQA,CAACA,KAAKA,CAACA,EAAEA,KAAKA,CAACA,CAACA;IACtFA,CAACA;IAEDF,wBAAGA,GAAHA,UAAOA,UAAeA;QAClBG,EAAEA,CAACA,CAACA,CAACA,IAAIA,CAACA,KAAKA,CAACA,aAAaA,IAAIA,CAACA,IAAIA,CAACA,KAAKA,CAACA,aAAaA,CAACA,UAAUA,CAACA,UAAUA,CAACA,CAACA;YAACA,MAAMA,CAACA,OAAOA,CAACA,OAAOA,CAAIA,IAAIA,CAACA,CAACA;QACnHA,MAAMA,CAACA,IAAIA,CAACA,KAAKA,CAACA,IAAIA,CAACA,KAAKA,CAACA,GAAGA,CAAIA,IAAIA,CAACA,KAAKA,CAACA,aAAaA,CAACA,aAAaA,CAACA,UAAUA,CAACA,CAACA,CAACA;IAC5FA,CAACA;IAEDH,0BAAKA,GAALA,UAAMA,UAAeA;QACjBI,EAAEA,CAACA,CAACA,CAACA,IAAIA,CAACA,KAAKA,CAACA,aAAaA,IAAIA,CAACA,IAAIA,CAACA,KAAKA,CAACA,aAAaA,CAACA,UAAUA,CAACA,UAAUA,CAACA,CAACA;YAACA,MAAMA,CAACA,OAAOA,CAACA,OAAOA,CAACA,KAAKA,CAACA,CAACA;QACjHA,MAAMA,CAACA,IAAIA,CAACA,KAAKA,CAACA,IAAIA,CAACA,KAAKA,CAACA,KAAKA,CAACA,IAAIA,CAACA,KAAKA,CAACA,aAAaA,CAACA,aAAaA,CAACA,UAAUA,CAACA,CAACA,CAACA;IAC3FA,CAACA;IACLJ,iBAACA;AAADA,CAACA,AAnBD,IAmBC;AArBD,iBAAS,UAAU,CAAC"} \ No newline at end of file +{"version":3,"file":"ModelCache.js","sourceRoot":"","sources":["ModelCache.ts"],"names":["ModelCache","ModelCache.constructor","ModelCache.set","ModelCache.get","ModelCache.clear"],"mappings":"AAEA,IAAO,QAAQ,WAAW,UAAU,CAAC,CAAC;AAItC,IAAM,UAAU;IACZA,SADEA,UAAUA,CACOA,KAAiCA;QAAjCC,UAAKA,GAALA,KAAKA,CAA4BA;IAEpDA,CAACA;IAEDD,wBAAGA,GAAHA,UAAOA,KAAQA;QACXE,EAAEA,CAACA,CAACA,CAACA,IAAIA,CAACA,KAAKA,CAACA,aAAaA,IAAIA,CAACA,IAAIA,CAACA,KAAKA,CAACA,aAAaA,CAACA,KAAKA,CAACA,KAAKA,CAACA,CAACA;YAACA,MAAMA,CAACA,QAAQA,CAACA,OAAOA,CAACA,KAAKA,CAACA,CAACA;QACxGA,MAAMA,CAACA,IAAIA,CAACA,KAAKA,CAACA,IAAIA,CAACA,KAAKA,CAACA,GAAGA,CAACA,IAAIA,CAACA,KAAKA,CAACA,aAAaA,CAACA,QAAQA,CAACA,KAAKA,CAACA,EAAEA,KAAKA,CAACA,CAACA;IACtFA,CAACA;IAEDF,wBAAGA,GAAHA,UAAOA,UAAeA;QAClBG,EAAEA,CAACA,CAACA,CAACA,IAAIA,CAACA,KAAKA,CAACA,aAAaA,IAAIA,CAACA,IAAIA,CAACA,KAAKA,CAACA,aAAaA,CAACA,UAAUA,CAACA,UAAUA,CAACA,CAACA;YAACA,MAAMA,CAACA,QAAQA,CAACA,OAAOA,CAAIA,IAAIA,CAACA,CAACA;QACpHA,MAAMA,CAACA,IAAIA,CAACA,KAAKA,CAACA,IAAIA,CAACA,KAAKA,CAACA,GAAGA,CAAIA,IAAIA,CAACA,KAAKA,CAACA,aAAaA,CAACA,aAAaA,CAACA,UAAUA,CAACA,CAACA,CAACA;IAC5FA,CAACA;IAEDH,0BAAKA,GAALA,UAAMA,UAAeA;QACjBI,EAAEA,CAACA,CAACA,CAACA,IAAIA,CAACA,KAAKA,CAACA,aAAaA,IAAIA,CAACA,IAAIA,CAACA,KAAKA,CAACA,aAAaA,CAACA,UAAUA,CAACA,UAAUA,CAACA,CAACA;YAACA,MAAMA,CAACA,QAAQA,CAACA,OAAOA,CAACA,KAAKA,CAACA,CAACA;QAClHA,MAAMA,CAACA,IAAIA,CAACA,KAAKA,CAACA,IAAIA,CAACA,KAAKA,CAACA,KAAKA,CAACA,IAAIA,CAACA,KAAKA,CAACA,aAAaA,CAACA,aAAaA,CAACA,UAAUA,CAACA,CAACA,CAACA;IAC3FA,CAACA;IACLJ,iBAACA;AAADA,CAACA,AAnBD,IAmBC;AArBD,iBAAS,UAAU,CAAC"} \ No newline at end of file diff --git a/lib/ModelCache.ts b/lib/ModelCache.ts index 3342520..582b426 100644 --- a/lib/ModelCache.ts +++ b/lib/ModelCache.ts @@ -1,6 +1,6 @@ /// import ModelInterfaces = require('./ModelInterfaces'); -import Promise = require('bluebird'); +import Bluebird = require('bluebird'); export = ModelCache; @@ -9,18 +9,18 @@ class ModelCache { } - set(value: T): Promise { - if (!this.model.cacheDirector || !this.model.cacheDirector.valid(value)) return Promise.resolve(value); + set(value: T): Bluebird { + if (!this.model.cacheDirector || !this.model.cacheDirector.valid(value)) return Bluebird.resolve(value); return this.model.core.cache.set(this.model.cacheDirector.buildKey(value), value); } - get(conditions: any): Promise { - if (!this.model.cacheDirector || !this.model.cacheDirector.validQuery(conditions)) return Promise.resolve(null); + get(conditions: any): Bluebird { + if (!this.model.cacheDirector || !this.model.cacheDirector.validQuery(conditions)) return Bluebird.resolve(null); return this.model.core.cache.get(this.model.cacheDirector.buildQueryKey(conditions)); } - clear(conditions: any): Promise { - if (!this.model.cacheDirector || !this.model.cacheDirector.validQuery(conditions)) return Promise.resolve(false); + clear(conditions: any): Bluebird { + if (!this.model.cacheDirector || !this.model.cacheDirector.validQuery(conditions)) return Bluebird.resolve(false); return this.model.core.cache.clear(this.model.cacheDirector.buildQueryKey(conditions)); } } diff --git a/lib/ModelHandlers.js b/lib/ModelHandlers.js index cba9fdb..753fa09 100644 --- a/lib/ModelHandlers.js +++ b/lib/ModelHandlers.js @@ -1,5 +1,5 @@ var _ = require('lodash'); -var Promise = require('bluebird'); +var Bluebird = require('bluebird'); var ModelHandlers = (function () { function ModelHandlers(model) { this.model = model; @@ -11,8 +11,8 @@ var ModelHandlers = (function () { cache: true, partial: false }); - return Promise.resolve(result).then(function (target) { - return Promise.resolve().then(function () { + return Bluebird.resolve(result).then(function (target) { + return Bluebird.resolve().then(function () { // Trigger the received hook if (_this.model.options.hooks.retrieved) return _this.model.options.hooks.retrieved(target); @@ -28,21 +28,21 @@ var ModelHandlers = (function () { // Wrap the document and trigger the ready hook var wrapped = wrapper(target, false, !!options.fields); if (_this.model.options.hooks.ready && wrapped instanceof _this.model.Instance) - return Promise.resolve(_this.model.options.hooks.ready(wrapped)).then(function () { return wrapped; }); + return Bluebird.resolve(_this.model.options.hooks.ready(wrapped)).then(function () { return wrapped; }); return wrapped; }); }); }; ModelHandlers.prototype.creatingDocuments = function (documents) { var _this = this; - return Promise.all(documents.map(function (document) { - return Promise.resolve().then(function () { + return Bluebird.all(documents.map(function (document) { + return Bluebird.resolve().then(function () { if (_this.model.options.hooks.retrieved) return _this.model.options.hooks.creating(document); }).then(function () { var validation = _this.model.helpers.validate(document); if (validation.failed) - return Promise.reject(validation.error); + return Bluebird.reject(validation.error); _this.model.helpers.transform.reverse(document); return document; }); @@ -50,7 +50,7 @@ var ModelHandlers = (function () { }; ModelHandlers.prototype.savingDocument = function (instance, changes) { var _this = this; - return Promise.resolve().then(function () { + return Bluebird.resolve().then(function () { if (_this.model.options.hooks.saving) return _this.model.options.hooks.saving(instance, changes); }).then(function () { return instance; }); diff --git a/lib/ModelHandlers.js.map b/lib/ModelHandlers.js.map index 57e4ec3..dac15b1 100644 --- a/lib/ModelHandlers.js.map +++ b/lib/ModelHandlers.js.map @@ -1 +1 @@ -{"version":3,"file":"ModelHandlers.js","sourceRoot":"","sources":["ModelHandlers.ts"],"names":["ModelHandlers","ModelHandlers.constructor","ModelHandlers.documentReceived","ModelHandlers.creatingDocuments","ModelHandlers.savingDocument"],"mappings":"AAOA,IAAO,CAAC,WAAW,QAAQ,CAAC,CAAC;AAC7B,IAAO,OAAO,WAAW,UAAU,CAAC,CAAC;AAIrC,IAAM,aAAa;IACfA,SADEA,aAAaA,CACIA,KAAkCA;QAAlCC,UAAKA,GAALA,KAAKA,CAA6BA;IAErDA,CAACA;IAEDD,wCAAgBA,GAAhBA,UAA0BA,UAAeA,EACrCA,MAAiBA,EACjBA,OAA+EA,EAC/EA,OAAuCA;QAH3CE,iBA8BCA;QA3BGA,uBAAuCA,GAAvCA,YAAuCA;QACvCA,CAACA,CAACA,QAAQA,CAACA,OAAOA,EAA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CAACA,CAACA;IACRA,CAACA;IAEDH,sCAAcA,GAAdA,UAAeA,QAAmBA,EAAEA,OAAYA;QAAhDI,iBAICA;QAHGA,MAAMA,CAACA,OAAOA,CAACA,OAAOA,EAAEA,CAACA,IAAIA,CAACA;YAC1BA,EAAEA,CAACA,CAACA,KAAIA,CAACA,KAAKA,CAACA,OAAOA,CAACA,KAAKA,CAACA,MAAMA,CAACA;gBAACA,MAAMA,CAACA,KAAIA,CAACA,KAAKA,CAACA,OAAOA,CAACA,KAAKA,CAACA,MAAMA,CAACA,QAAQA,EAAEA,OAAOA,CAACA,CAACA;QACnGA,CAACA,CAACA,CAACA,IAAIA,CAACA,cAAMA,eAAQA,EAARA,CAAQA,CAACA,CAACA;IAC5BA,CAACA;IACLJ,oBAACA;AAADA,CAACA,AAvDD,IAuDC;AAzDD,iBAAS,aAAa,CAAC"} \ No newline at end of file +{"version":3,"file":"ModelHandlers.js","sourceRoot":"","sources":["ModelHandlers.ts"],"names":["ModelHandlers","ModelHandlers.constructor","ModelHandlers.documentReceived","ModelHandlers.creatingDocuments","ModelHandlers.savingDocument"],"mappings":"AAOA,IAAO,CAAC,WAAW,QAAQ,CAAC,CAAC;AAC7B,IAAO,QAAQ,WAAW,UAAU,CAAC,CAAC;AAItC,IAAM,aAAa;IACfA,SADEA,aAAaA,CACIA,KAAkCA;QAAlCC,UAAKA,GAALA,KAAKA,CAA6BA;IAErDA,CAACA;IAEDD,wCAAgBA,GAAhBA,UAA0BA,UAAeA,EACrCA,MAAiBA,EACjBA,OAA+EA,EAC/EA,OAAuCA;QAH3CE,iBA8BCA;QA3BGA,uBAAuCA,GAAvCA,YAAuCA;QACvCA,CAACA,CAACA,QAAQA,CAACA,OAAOA,EAAEA;YAChBA,KAAKA,EAAEA,IAAIA;YACXA,OAAOA,EAAEA,KAAKA;SACjBA,CAACA,CAACA;QAEHA,MAAMA,CAACA,QAAQA,CAACA,OAAOA,CAACA,MAAMA,CAACA,CAACA,IAAIA,CAACA,UAACA,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A,EAAEA,CAACA,CAACA,KAAIA,CAACA,KAAKA,CAACA,OAAOA,CAACA,KAAKA,CAACA,MAAMA,CAACA;gBAACA,MAAMA,CAACA,KAAIA,CAACA,KAAKA,CAACA,OAAOA,CAACA,KAAKA,CAACA,MAAMA,CAACA,QAAQA,EAAEA,OAAOA,CAACA,CAACA;QACnGA,CAACA,CAACA,CAACA,IAAIA,CAACA,cAAMA,eAAQA,EAARA,CAAQA,CAACA,CAACA;IAC5BA,CAACA;IACLJ,oBAACA;AAADA,CAACA,AAvDD,IAuDC;AAzDD,iBAAS,aAAa,CAAC"} \ No newline at end of file diff --git a/lib/ModelHandlers.ts b/lib/ModelHandlers.ts index 4e53a27..47ab29e 100644 --- a/lib/ModelHandlers.ts +++ b/lib/ModelHandlers.ts @@ -6,7 +6,7 @@ import Model = require('./Model'); import ModelCache = require('./ModelCache'); import ModelOptions = require('./ModelOptions'); import _ = require('lodash'); -import Promise = require('bluebird'); +import Bluebird = require('bluebird'); export = ModelHandlers; @@ -18,14 +18,14 @@ class ModelHandlers { documentReceived(conditions: any, result: TDocument, wrapper: (document: TDocument, isNew?: boolean, isPartial?: boolean) => TResult, - options: ModelOptions.QueryOptions = {}): Promise { + options: ModelOptions.QueryOptions = {}): Bluebird { _.defaults(options, { cache: true, partial: false }); - return Promise.resolve(result).then((target: any) => { - return >Promise.resolve().then(() => { + return Bluebird.resolve(result).then((target: any) => { + return >Bluebird.resolve().then(() => { // Trigger the received hook if (this.model.options.hooks.retrieved) return this.model.options.hooks.retrieved(target); }).then(() => { @@ -41,27 +41,27 @@ class ModelHandlers { // Wrap the document and trigger the ready hook var wrapped: TResult = wrapper(target, false, !!options.fields); - if (this.model.options.hooks.ready && wrapped instanceof this.model.Instance) return Promise.resolve(this.model.options.hooks.ready(wrapped)).then(() => wrapped); + if (this.model.options.hooks.ready && wrapped instanceof this.model.Instance) return Bluebird.resolve(this.model.options.hooks.ready(wrapped)).then(() => wrapped); return wrapped; }); }); } - creatingDocuments(documents: TDocument[]): Promise { - return Promise.all(documents.map((document: any) => { - return Promise.resolve().then(() => { + creatingDocuments(documents: TDocument[]): Bluebird { + return Bluebird.all(documents.map((document: any) => { + return Bluebird.resolve().then(() => { if (this.model.options.hooks.retrieved) return this.model.options.hooks.creating(document); }).then(() => { var validation: SkmatcCore.IResult = this.model.helpers.validate(document); - if (validation.failed) return Promise.reject(validation.error); + if (validation.failed) return Bluebird.reject(validation.error); this.model.helpers.transform.reverse(document); return document; }); })); } - savingDocument(instance: TInstance, changes: any): Promise { - return Promise.resolve().then(() => { + savingDocument(instance: TInstance, changes: any): Bluebird { + return Bluebird.resolve().then(() => { if (this.model.options.hooks.saving) return this.model.options.hooks.saving(instance, changes); }).then(() => instance); } diff --git a/lib/ModelHelpers.ts b/lib/ModelHelpers.ts index 3a0d74f..f34f80d 100644 --- a/lib/ModelHelpers.ts +++ b/lib/ModelHelpers.ts @@ -5,7 +5,7 @@ import Concoction = require('concoction'); import Skmatc = require('skmatc'); import Omnom = require('./utils/Omnom'); import _ = require('lodash'); -import Promise = require('bluebird'); +import Bluebird = require('bluebird'); export = ModelHelpers; diff --git a/lib/caches/MemoryCache.js b/lib/caches/MemoryCache.js index ad2937b..fc05843 100644 --- a/lib/caches/MemoryCache.js +++ b/lib/caches/MemoryCache.js @@ -1,21 +1,21 @@ /// -var Promise = require('bluebird'); +var Bluebird = require('bluebird'); var MemoryCache = (function () { function MemoryCache() { this.cache = {}; } MemoryCache.prototype.set = function (key, value) { this.cache[key] = value; - return Promise.resolve(value); + return Bluebird.resolve(value); }; MemoryCache.prototype.get = function (key) { - return Promise.resolve(this.cache[key]); + return Bluebird.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 Bluebird.resolve(has); }; return MemoryCache; })(); diff --git a/lib/caches/MemoryCache.js.map b/lib/caches/MemoryCache.js.map index a0ce2e1..bb1ff6f 100644 --- a/lib/caches/MemoryCache.js.map +++ b/lib/caches/MemoryCache.js.map @@ -1 +1 @@ -{"version":3,"file":"MemoryCache.js","sourceRoot":"","sources":["MemoryCache.ts"],"names":["MemoryCache","MemoryCache.constructor","MemoryCache.set","MemoryCache.get","MemoryCache.clear"],"mappings":"AACA,AADA,+CAA+C;AAC/C,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 +{"version":3,"file":"MemoryCache.js","sourceRoot":"","sources":["MemoryCache.ts"],"names":["MemoryCache","MemoryCache.constructor","MemoryCache.set","MemoryCache.get","MemoryCache.clear"],"mappings":"AACA,AADA,+CAA+C;AAC/C,IAAO,QAAQ,WAAW,UAAU,CAAC,CAAC;AAKtC,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,QAAQA,CAACA,OAAOA,CAACA,KAAKA,CAACA,CAACA;IACnCA,CAACA;IAEDF,yBAAGA,GAAHA,UAAOA,GAAWA;QACdG,MAAMA,CAACA,QAAQA,CAACA,OAAOA,CAACA,IAAIA,CAACA,KAAKA,CAACA,GAAGA,CAACA,CAACA,CAACA;IAC7CA,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,QAAQA,CAACA,OAAOA,CAACA,GAAGA,CAACA,CAACA;IACjCA,CAACA;IACLJ,kBAACA;AAADA,CAACA,AAjBD,IAiBC;AAnBD,iBAAS,WAAW,CAAC"} \ No newline at end of file diff --git a/lib/caches/MemoryCache.ts b/lib/caches/MemoryCache.ts index aed9fd1..574e66a 100644 --- a/lib/caches/MemoryCache.ts +++ b/lib/caches/MemoryCache.ts @@ -1,5 +1,5 @@ /// -import Promise = require('bluebird'); +import Bluebird = require('bluebird'); import cache = require('../Cache'); export = MemoryCache; @@ -7,18 +7,18 @@ export = MemoryCache; class MemoryCache implements cache { private cache: any = {}; - set(key: string, value: T): Promise { + set(key: string, value: T): Bluebird { this.cache[key] = value; - return Promise.resolve(value); + return Bluebird.resolve(value); } - get(key: string): Promise { - return Promise.resolve(this.cache[key]); + get(key: string): Bluebird { + return Bluebird.resolve(this.cache[key]); } - clear(key: string) : Promise { + clear(key: string) : Bluebird { var has = this.cache.hasOwnProperty(key); if(has) delete this.cache[key]; - return Promise.resolve(has); + return Bluebird.resolve(has); } } \ No newline at end of file diff --git a/lib/caches/NoOpCache.js b/lib/caches/NoOpCache.js index f432db6..35caa3c 100644 --- a/lib/caches/NoOpCache.js +++ b/lib/caches/NoOpCache.js @@ -1,15 +1,15 @@ -var Promise = require('bluebird'); +var Bluebird = require('bluebird'); var NoOpCache = (function () { function NoOpCache() { } NoOpCache.prototype.set = function (key, object) { - return Promise.resolve(object); + return Bluebird.resolve(object); }; NoOpCache.prototype.get = function (key) { - return Promise.resolve(); + return Bluebird.resolve(); }; NoOpCache.prototype.clear = function (key) { - return Promise.resolve(false); + return Bluebird.resolve(false); }; return NoOpCache; })(); diff --git a/lib/caches/NoOpCache.js.map b/lib/caches/NoOpCache.js.map index 0ee472b..e1cf57a 100644 --- a/lib/caches/NoOpCache.js.map +++ b/lib/caches/NoOpCache.js.map @@ -1 +1 @@ -{"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 +{"version":3,"file":"NoOpCache.js","sourceRoot":"","sources":["NoOpCache.ts"],"names":["NoOpCache","NoOpCache.constructor","NoOpCache.set","NoOpCache.get","NoOpCache.clear"],"mappings":"AAEA,IAAO,QAAQ,WAAW,UAAU,CAAC,CAAC;AAItC,IAAM,SAAS;IAAfA,SAAMA,SAASA;IAYfC,CAACA;IAXGD,uBAAGA,GAAHA,UAAOA,GAAWA,EAAEA,MAASA;QACzBE,MAAMA,CAACA,QAAQA,CAACA,OAAOA,CAACA,MAAMA,CAACA,CAACA;IACpCA,CAACA;IAEDF,uBAAGA,GAAHA,UAAOA,GAAWA;QACdG,MAAMA,CAACA,QAAQA,CAACA,OAAOA,EAAEA,CAACA;IAC9BA,CAACA;IAEDH,yBAAKA,GAALA,UAAMA,GAAWA;QACbI,MAAMA,CAACA,QAAQA,CAACA,OAAOA,CAACA,KAAKA,CAACA,CAACA;IACnCA,CAACA;IACLJ,gBAACA;AAADA,CAACA,AAZD,IAYC;AAdD,iBAAS,SAAS,CAAC"} \ No newline at end of file diff --git a/lib/caches/NoOpCache.ts b/lib/caches/NoOpCache.ts index 3111c07..8b5448c 100644 --- a/lib/caches/NoOpCache.ts +++ b/lib/caches/NoOpCache.ts @@ -1,19 +1,19 @@ /// import cache = require('../Cache'); -import Promise = require('bluebird'); +import Bluebird = require('bluebird'); export = NoOpCache; class NoOpCache implements cache { - set(key: string, object: T): Promise { - return Promise.resolve(object); + set(key: string, object: T): Bluebird { + return Bluebird.resolve(object); } - get(key: string): Promise { - return Promise.resolve(); + get(key: string): Bluebird { + return Bluebird.resolve(); } - clear(key: string): Promise { - return Promise.resolve(false); + clear(key: string): Bluebird { + return Bluebird.resolve(false); } } \ No newline at end of file