Skip to content
This repository has been archived by the owner on May 19, 2019. It is now read-only.

Commit

Permalink
0.6.8
Browse files Browse the repository at this point in the history
  • Loading branch information
c58 committed Mar 11, 2016
1 parent 384b5f4 commit 1e7c1da
Show file tree
Hide file tree
Showing 5 changed files with 125 additions and 65 deletions.
90 changes: 63 additions & 27 deletions build/marsdb.js
Expand Up @@ -6654,6 +6654,14 @@ var joinAll = exports.joinAll = {
},{"check-types":32,"fast.js/function/bind":45,"fast.js/map":49,"invariant":56}],25:[function(require,module,exports){
'use strict';

var _typeof2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; };

var _typeof = typeof Symbol === "function" && _typeof2(Symbol.iterator) === "symbol" ? function (obj) {
return typeof obj === "undefined" ? "undefined" : _typeof2(obj);
} : function (obj) {
return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj === "undefined" ? "undefined" : _typeof2(obj);
};

Object.defineProperty(exports, "__esModule", {
value: true
});
Expand Down Expand Up @@ -6686,17 +6694,35 @@ var joinEach = exports.joinEach = {
},

process: function process(docs, pipeObj, cursor) {
docs = _checkTypes2.default.array(docs) ? docs : [docs];
var docsLength = docs.length;
return Promise.all((0, _map3.default)(docs, function (x, i) {
return _joinAll.joinAll.process(x, pipeObj, cursor, i, docsLength);
}));
if (!docs) {
return Promise.resolve(docs);
} else {
var _ret = function () {
docs = _checkTypes2.default.array(docs) ? docs : [docs];
var docsLength = docs.length;
return {
v: Promise.all((0, _map3.default)(docs, function (x, i) {
return _joinAll.joinAll.process(x, pipeObj, cursor, i, docsLength);
}))
};
}();

if ((typeof _ret === 'undefined' ? 'undefined' : _typeof(_ret)) === "object") return _ret.v;
}
}
};

},{"./joinAll":24,"check-types":32,"fast.js/map":49,"invariant":56}],26:[function(require,module,exports){
'use strict';

var _typeof2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; };

var _typeof = typeof Symbol === "function" && _typeof2(Symbol.iterator) === "symbol" ? function (obj) {
return typeof obj === "undefined" ? "undefined" : _typeof2(obj);
} : function (obj) {
return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj === "undefined" ? "undefined" : _typeof2(obj);
};

var _extends = Object.assign || function (target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];for (var key in source) {
Expand Down Expand Up @@ -6870,34 +6896,44 @@ var joinObj = exports.joinObj = {
},

process: function process(docs, pipeObj, cursor) {
var obj = pipeObj.value;
var options = pipeObj.args[0] || {};
var isObj = !_checkTypes2.default.array(docs);
docs = !isObj ? docs : [docs];
if (!docs) {
return Promise.resolve(docs);
} else {
var _ret = function () {
var obj = pipeObj.value;
var options = pipeObj.args[0] || {};
var isObj = !_checkTypes2.default.array(docs);
docs = !isObj ? docs : [docs];

var joinerFn = function joinerFn(dcs) {
return (0, _map3.default)((0, _keys3.default)(obj), function (k) {
var _getJoinOptions2 = _getJoinOptions(k, obj[k]);
var joinerFn = function joinerFn(dcs) {
return (0, _map3.default)((0, _keys3.default)(obj), function (k) {
var _getJoinOptions2 = _getJoinOptions(k, obj[k]);

var model = _getJoinOptions2.model;
var joinPath = _getJoinOptions2.joinPath;
var model = _getJoinOptions2.model;
var joinPath = _getJoinOptions2.joinPath;

var _decomposeDocuments2 = _decomposeDocuments(docs, k);
var _decomposeDocuments2 = _decomposeDocuments(docs, k);

var allIds = _decomposeDocuments2.allIds;
var docsWrapped = _decomposeDocuments2.docsWrapped;
var allIds = _decomposeDocuments2.allIds;
var docsWrapped = _decomposeDocuments2.docsWrapped;

var execFnName = options.observe ? 'observe' : 'then';
return model.find({ _id: { $in: allIds } })[execFnName](function (res) {
_joinDocsWithResult(joinPath, res, docsWrapped);
});
});
};
var execFnName = options.observe ? 'observe' : 'then';
return model.find({ _id: { $in: allIds } })[execFnName](function (res) {
_joinDocsWithResult(joinPath, res, docsWrapped);
});
});
};

var newPipeObj = _extends({}, pipeObj, { value: joinerFn });
return _joinAll.joinAll.process(docs, newPipeObj, cursor).then(function (res) {
return isObj ? res[0] : res;
});
var newPipeObj = _extends({}, pipeObj, { value: joinerFn });
return {
v: _joinAll.joinAll.process(docs, newPipeObj, cursor).then(function (res) {
return isObj ? res[0] : res;
})
};
}();

if ((typeof _ret === 'undefined' ? 'undefined' : _typeof(_ret)) === "object") return _ret.v;
}
}
};

Expand Down
8 changes: 4 additions & 4 deletions build/marsdb.min.js

Large diffs are not rendered by default.

22 changes: 17 additions & 5 deletions dist/cursor-processors/joinEach.js
@@ -1,5 +1,7 @@
'use strict';

var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; };

Object.defineProperty(exports, "__esModule", {
value: true
});
Expand Down Expand Up @@ -30,10 +32,20 @@ var joinEach = exports.joinEach = {
},

process: function process(docs, pipeObj, cursor) {
docs = _checkTypes2.default.array(docs) ? docs : [docs];
var docsLength = docs.length;
return Promise.all((0, _map3.default)(docs, function (x, i) {
return _joinAll.joinAll.process(x, pipeObj, cursor, i, docsLength);
}));
if (!docs) {
return Promise.resolve(docs);
} else {
var _ret = function () {
docs = _checkTypes2.default.array(docs) ? docs : [docs];
var docsLength = docs.length;
return {
v: Promise.all((0, _map3.default)(docs, function (x, i) {
return _joinAll.joinAll.process(x, pipeObj, cursor, i, docsLength);
}))
};
}();

if ((typeof _ret === 'undefined' ? 'undefined' : _typeof(_ret)) === "object") return _ret.v;
}
}
};
68 changes: 40 additions & 28 deletions dist/cursor-processors/joinObj.js
@@ -1,5 +1,7 @@
'use strict';

var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; };

var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };

Object.defineProperty(exports, "__esModule", {
Expand Down Expand Up @@ -155,33 +157,43 @@ var joinObj = exports.joinObj = {
},

process: function process(docs, pipeObj, cursor) {
var obj = pipeObj.value;
var options = pipeObj.args[0] || {};
var isObj = !_checkTypes2.default.array(docs);
docs = !isObj ? docs : [docs];

var joinerFn = function joinerFn(dcs) {
return (0, _map3.default)((0, _keys3.default)(obj), function (k) {
var _getJoinOptions2 = _getJoinOptions(k, obj[k]);

var model = _getJoinOptions2.model;
var joinPath = _getJoinOptions2.joinPath;

var _decomposeDocuments2 = _decomposeDocuments(docs, k);

var allIds = _decomposeDocuments2.allIds;
var docsWrapped = _decomposeDocuments2.docsWrapped;

var execFnName = options.observe ? 'observe' : 'then';
return model.find({ _id: { $in: allIds } })[execFnName](function (res) {
_joinDocsWithResult(joinPath, res, docsWrapped);
});
});
};

var newPipeObj = _extends({}, pipeObj, { value: joinerFn });
return _joinAll.joinAll.process(docs, newPipeObj, cursor).then(function (res) {
return isObj ? res[0] : res;
});
if (!docs) {
return Promise.resolve(docs);
} else {
var _ret = function () {
var obj = pipeObj.value;
var options = pipeObj.args[0] || {};
var isObj = !_checkTypes2.default.array(docs);
docs = !isObj ? docs : [docs];

var joinerFn = function joinerFn(dcs) {
return (0, _map3.default)((0, _keys3.default)(obj), function (k) {
var _getJoinOptions2 = _getJoinOptions(k, obj[k]);

var model = _getJoinOptions2.model;
var joinPath = _getJoinOptions2.joinPath;

var _decomposeDocuments2 = _decomposeDocuments(docs, k);

var allIds = _decomposeDocuments2.allIds;
var docsWrapped = _decomposeDocuments2.docsWrapped;

var execFnName = options.observe ? 'observe' : 'then';
return model.find({ _id: { $in: allIds } })[execFnName](function (res) {
_joinDocsWithResult(joinPath, res, docsWrapped);
});
});
};

var newPipeObj = _extends({}, pipeObj, { value: joinerFn });
return {
v: _joinAll.joinAll.process(docs, newPipeObj, cursor).then(function (res) {
return isObj ? res[0] : res;
})
};
}();

if ((typeof _ret === 'undefined' ? 'undefined' : _typeof(_ret)) === "object") return _ret.v;
}
}
};
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "marsdb",
"version": "0.6.7",
"version": "0.6.8",
"author": {
"name": "Artem Artemev",
"email": "art@studytime.me"
Expand Down

0 comments on commit 1e7c1da

Please sign in to comment.