Demo for query storing
Change-Id: I947bcac841992c3f6cfd01ab337c265b0d01cb70
diff --git a/node_modules/p-reduce/index.js b/node_modules/p-reduce/index.js
new file mode 100644
index 0000000..e121b32
--- /dev/null
+++ b/node_modules/p-reduce/index.js
@@ -0,0 +1,22 @@
+'use strict';
+module.exports = (iterable, reducer, initVal) => new Promise((resolve, reject) => {
+ const iterator = iterable[Symbol.iterator]();
+ let i = 0;
+
+ const next = total => {
+ const el = iterator.next();
+
+ if (el.done) {
+ resolve(total);
+ return;
+ }
+
+ Promise.all([total, el.value])
+ .then(value => {
+ next(reducer(value[0], value[1], i++));
+ })
+ .catch(reject);
+ };
+
+ next(initVal);
+});
diff --git a/node_modules/p-reduce/license b/node_modules/p-reduce/license
new file mode 100644
index 0000000..654d0bf
--- /dev/null
+++ b/node_modules/p-reduce/license
@@ -0,0 +1,21 @@
+The MIT License (MIT)
+
+Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
diff --git a/node_modules/p-reduce/package.json b/node_modules/p-reduce/package.json
new file mode 100644
index 0000000..e5e08bf
--- /dev/null
+++ b/node_modules/p-reduce/package.json
@@ -0,0 +1,73 @@
+{
+ "_from": "p-reduce@^1.0.0",
+ "_id": "p-reduce@1.0.0",
+ "_inBundle": false,
+ "_integrity": "sha1-GMKw3ZNqRpClKfgjH1ig/bakffo=",
+ "_location": "/p-reduce",
+ "_phantomChildren": {},
+ "_requested": {
+ "type": "range",
+ "registry": true,
+ "raw": "p-reduce@^1.0.0",
+ "name": "p-reduce",
+ "escapedName": "p-reduce",
+ "rawSpec": "^1.0.0",
+ "saveSpec": null,
+ "fetchSpec": "^1.0.0"
+ },
+ "_requiredBy": [
+ "/p-map-series"
+ ],
+ "_resolved": "https://registry.npmjs.org/p-reduce/-/p-reduce-1.0.0.tgz",
+ "_shasum": "18c2b0dd936a4690a529f8231f58a0fdb6a47dfa",
+ "_spec": "p-reduce@^1.0.0",
+ "_where": "C:\\Users\\marcr\\Desktop\\KorAp\\Git\\Kalamar\\node_modules\\p-map-series",
+ "author": {
+ "name": "Sindre Sorhus",
+ "email": "sindresorhus@gmail.com",
+ "url": "sindresorhus.com"
+ },
+ "bugs": {
+ "url": "https://github.com/sindresorhus/p-reduce/issues"
+ },
+ "bundleDependencies": false,
+ "deprecated": false,
+ "description": "Reduce a list of values using promises into a promise for a value",
+ "devDependencies": {
+ "ava": "*",
+ "delay": "^1.3.1",
+ "xo": "*"
+ },
+ "engines": {
+ "node": ">=4"
+ },
+ "files": [
+ "index.js"
+ ],
+ "homepage": "https://github.com/sindresorhus/p-reduce#readme",
+ "keywords": [
+ "promise",
+ "reduce",
+ "collection",
+ "iterable",
+ "iterator",
+ "async",
+ "await",
+ "promises",
+ "accumulate",
+ "bluebird"
+ ],
+ "license": "MIT",
+ "name": "p-reduce",
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/sindresorhus/p-reduce.git"
+ },
+ "scripts": {
+ "test": "xo && ava"
+ },
+ "version": "1.0.0",
+ "xo": {
+ "esnext": true
+ }
+}
diff --git a/node_modules/p-reduce/readme.md b/node_modules/p-reduce/readme.md
new file mode 100644
index 0000000..ed13fb8
--- /dev/null
+++ b/node_modules/p-reduce/readme.md
@@ -0,0 +1,72 @@
+# p-reduce [](https://travis-ci.org/sindresorhus/p-reduce)
+
+> Reduce a list of values using promises into a promise for a value
+
+Useful when you need to calculate some accumulated value based on async resources.
+
+
+## Install
+
+```
+$ npm install --save p-reduce
+```
+
+
+## Usage
+
+```js
+const pReduce = require('p-reduce');
+const humanInfo = require('human-info'); // not a real module
+
+const names = [
+ getUser('sindresorhus').then(info => info.name),
+ 'Addy Osmani',
+ 'Pascal Hartig',
+ 'Stephen Sawchuk'
+];
+
+pReduce(names, (total, name) => {
+ return humanInfo(name).then(info => total + info.age);
+}, 0).then(totalAge => {
+ console.log(totalAge);
+ //=> 125
+});
+```
+
+
+## API
+
+### pReduce(input, reducer, [initialValue])
+
+Returns a `Promise` that is fulfilled when all promises in `input` and ones returned from `reducer` are fulfilled, or rejects if any of the promises reject. The fulfilled value is the result of the reduction.
+
+#### input
+
+Type: `Iterable<Promise|any>`
+
+Iterated over serially in the `reducer` function.
+
+#### reducer(previousValue, currentValue, index)
+
+Type: `Function`
+
+Expected to return a value. If a `Promise` is returned, it's awaited before continuing with the next iteration.
+
+#### initialValue
+
+Type: `any`
+
+Value to use as `previousValue` in the first `reducer` invocation.
+
+
+## Related
+
+- [p-each-series](https://github.com/sindresorhus/p-each-series) - Iterate over promises serially
+- [p-map-series](https://github.com/sindresorhus/p-map-series) - Map over promises serially
+- [p-map](https://github.com/sindresorhus/p-map) - Map over promises concurrently
+- [More…](https://github.com/sindresorhus/promise-fun)
+
+
+## License
+
+MIT © [Sindre Sorhus](https://sindresorhus.com)