Demo for query storing
Change-Id: I947bcac841992c3f6cfd01ab337c265b0d01cb70
diff --git a/node_modules/unique-stream/LICENSE b/node_modules/unique-stream/LICENSE
new file mode 100644
index 0000000..cd2225a
--- /dev/null
+++ b/node_modules/unique-stream/LICENSE
@@ -0,0 +1,20 @@
+Copyright 2014 Eugene Ware
+
+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/unique-stream/README.md b/node_modules/unique-stream/README.md
new file mode 100644
index 0000000..afd49a0
--- /dev/null
+++ b/node_modules/unique-stream/README.md
@@ -0,0 +1,134 @@
+# unique-stream
+
+node.js through stream that emits a unique stream of objects based on criteria
+
+[](https://travis-ci.org/eugeneware/unique-stream)
+[](https://coveralls.io/github/eugeneware/unique-stream?branch=master)
+
+## Installation
+
+Install via [npm](https://www.npmjs.com/):
+
+```
+$ npm install unique-stream
+```
+
+## Examples
+
+### Dedupe a ReadStream based on JSON.stringify:
+
+``` js
+var unique = require('unique-stream')
+ , Stream = require('stream');
+
+// return a stream of 3 identical objects
+function makeStreamOfObjects() {
+ var s = new Stream;
+ s.readable = true;
+ var count = 3;
+ for (var i = 0; i < 3; i++) {
+ setImmediate(function () {
+ s.emit('data', { name: 'Bob', number: 123 });
+ --count || end();
+ });
+ }
+
+ function end() {
+ s.emit('end');
+ }
+
+ return s;
+}
+
+// Will only print out one object as the rest are dupes. (Uses JSON.stringify)
+makeStreamOfObjects()
+ .pipe(unique())
+ .on('data', console.log);
+
+```
+
+### Dedupe a ReadStream based on an object property:
+
+``` js
+// Use name as the key field to dedupe on. Will only print one object
+makeStreamOfObjects()
+ .pipe(unique('name'))
+ .on('data', console.log);
+```
+
+### Dedupe a ReadStream based on a custom function:
+
+``` js
+// Use a custom function to dedupe on. Use the 'number' field. Will only print one object.
+makeStreamOfObjects()
+ .pipe(function (data) {
+ return data.number;
+ })
+ .on('data', console.log);
+```
+
+## Dedupe multiple streams
+
+The reason I wrote this was to dedupe multiple object streams:
+
+``` js
+var aggregator = unique();
+
+// Stream 1
+makeStreamOfObjects()
+ .pipe(aggregator);
+
+// Stream 2
+makeStreamOfObjects()
+ .pipe(aggregator);
+
+// Stream 3
+makeStreamOfObjects()
+ .pipe(aggregator);
+
+aggregator.on('data', console.log);
+```
+
+## Use a custom store to record keys that have been encountered
+
+By default a set is used to store keys encountered so far, in order to check new ones for
+uniqueness. You can supply your own store instead, providing it supports the add(key) and
+has(key) methods. This could allow you to use a persistent store so that already encountered
+objects are not re-streamed when node is reloaded.
+
+``` js
+var keyStore = {
+ store: {},
+
+ add: function(key) {
+ this.store[key] = true;
+ },
+
+ has: function(key) {
+ return this.store[key] !== undefined;
+ }
+};
+
+makeStreamOfObjects()
+ .pipe(unique('name', keyStore))
+ .on('data', console.log);
+```
+
+## Contributing
+
+unique-stream is an **OPEN Open Source Project**. This means that:
+
+> Individuals making significant and valuable contributions are given commit-access to the project to contribute as they see fit. This project is more like an open wiki than a standard guarded open source project.
+
+See the [CONTRIBUTING.md](https://github.com/eugeneware/unique-stream/blob/master/CONTRIBUTING.md) file for more details.
+
+### Contributors
+
+unique-stream is only possible due to the excellent work of the following contributors:
+
+<table><tbody>
+<tr><th align="left">Eugene Ware</th><td><a href="https://github.com/eugeneware">GitHub/eugeneware</a></td></tr>
+<tr><th align="left">Craig Ambrose</th><td><a href="https://github.com/craigambrose">GitHub/craigambrose</a></td></tr>
+<tr><th align="left">Shinnosuke Watanabe</th><td><a href="https://github.com/shinnn">GitHub/shinnn</a></td></tr>
+<tr><th align="left">Rouven Weßling</th><td><a href="https://github.com/realityking">GitHub/realityking</a></td></tr>
+</tbody></table>
diff --git a/node_modules/unique-stream/index.js b/node_modules/unique-stream/index.js
new file mode 100644
index 0000000..13209b9
--- /dev/null
+++ b/node_modules/unique-stream/index.js
@@ -0,0 +1,48 @@
+'use strict';
+
+var filter = require('through2-filter').obj;
+var stringify = require("json-stable-stringify-without-jsonify");
+
+var ES6Set;
+if (typeof global.Set === 'function') {
+ ES6Set = global.Set;
+} else {
+ ES6Set = function() {
+ this.keys = [];
+ this.has = function(val) {
+ return this.keys.indexOf(val) !== -1;
+ },
+ this.add = function(val) {
+ this.keys.push(val);
+ }
+ }
+}
+
+function prop(propName) {
+ return function (data) {
+ return data[propName];
+ };
+}
+
+module.exports = unique;
+function unique(propName, keyStore) {
+ keyStore = keyStore || new ES6Set();
+
+ var keyfn = stringify;
+ if (typeof propName === 'string') {
+ keyfn = prop(propName);
+ } else if (typeof propName === 'function') {
+ keyfn = propName;
+ }
+
+ return filter(function (data) {
+ var key = keyfn(data);
+
+ if (keyStore.has(key)) {
+ return false;
+ }
+
+ keyStore.add(key);
+ return true;
+ });
+}
diff --git a/node_modules/unique-stream/package.json b/node_modules/unique-stream/package.json
new file mode 100644
index 0000000..cfefae0
--- /dev/null
+++ b/node_modules/unique-stream/package.json
@@ -0,0 +1,67 @@
+{
+ "_from": "unique-stream@^2.0.2",
+ "_id": "unique-stream@2.3.1",
+ "_inBundle": false,
+ "_integrity": "sha512-2nY4TnBE70yoxHkDli7DMazpWiP7xMdCYqU2nBRO0UB+ZpEkGsSija7MvmvnZFUeC+mrgiUfcHSr3LmRFIg4+A==",
+ "_location": "/unique-stream",
+ "_phantomChildren": {},
+ "_requested": {
+ "type": "range",
+ "registry": true,
+ "raw": "unique-stream@^2.0.2",
+ "name": "unique-stream",
+ "escapedName": "unique-stream",
+ "rawSpec": "^2.0.2",
+ "saveSpec": null,
+ "fetchSpec": "^2.0.2"
+ },
+ "_requiredBy": [
+ "/glob-stream"
+ ],
+ "_resolved": "https://registry.npmjs.org/unique-stream/-/unique-stream-2.3.1.tgz",
+ "_shasum": "c65d110e9a4adf9a6c5948b28053d9a8d04cbeac",
+ "_spec": "unique-stream@^2.0.2",
+ "_where": "C:\\Users\\marcr\\Desktop\\KorAp\\Git\\Kalamar\\node_modules\\glob-stream",
+ "author": {
+ "name": "Eugene Ware",
+ "email": "eugene@noblesamurai.com"
+ },
+ "bugs": {
+ "url": "https://github.com/eugeneware/unique-stream/issues"
+ },
+ "bundleDependencies": false,
+ "dependencies": {
+ "json-stable-stringify-without-jsonify": "^1.0.1",
+ "through2-filter": "^3.0.0"
+ },
+ "deprecated": false,
+ "description": "node.js through stream that emits a unique stream of objects based on criteria",
+ "devDependencies": {
+ "after": "~0.8.1",
+ "chai": "^4.2.0",
+ "istanbul": "^0.4.5",
+ "mocha": "^5.2.0"
+ },
+ "files": [
+ "index.js"
+ ],
+ "homepage": "https://github.com/eugeneware/unique-stream#readme",
+ "keywords": [
+ "unique",
+ "stream",
+ "unique-stream",
+ "streaming",
+ "streams"
+ ],
+ "license": "MIT",
+ "name": "unique-stream",
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/eugeneware/unique-stream.git"
+ },
+ "scripts": {
+ "coverage": "istanbul cover _mocha",
+ "test": "mocha"
+ },
+ "version": "2.3.1"
+}