diff --git a/keyserver/package.json b/keyserver/package.json --- a/keyserver/package.json +++ b/keyserver/package.json @@ -49,7 +49,6 @@ "@commapp/olm": "0.1.0", "@parse/node-apn": "^3.2.0", "@vingle/bmp-js": "^0.2.5", - "JSONStream": "^1.3.5", "bad-words": "^3.0.4", "common-tags": "^1.7.2", "compression": "^1.7.4", @@ -79,13 +78,11 @@ "react-router": "^5.2.0", "redis": "^3.1.1", "redux": "^4.0.4", - "replacestream": "^4.0.3", "rereadable-stream": "^1.4.5", "rust-node-addon": "0.0.1", "sharp": "^0.30.5", "siwe": "^1.1.6", "sql-template-strings": "^2.2.2", - "stream-combiner": "^0.2.2", "tcomb": "^3.2.29", "twin-bcrypt": "^2.1.1", "uuid": "^3.4.0", diff --git a/keyserver/src/utils/json-stream.js b/keyserver/src/utils/json-stream.js --- a/keyserver/src/utils/json-stream.js +++ b/keyserver/src/utils/json-stream.js @@ -1,50 +1,9 @@ // @flow -import type { $Response } from 'express'; -import JSONStream from 'JSONStream'; -import replaceStream from 'replacestream'; -import Combine from 'stream-combiner'; - -function streamJSON( - res: $Response, - input: { +[key: string]: mixed }, -): stream$Readable { - const jsonStream = Combine( - JSONStream.stringifyObject('{', ',', '}'), - replaceStream(/ mixed, +end: () => mixed, ... }, - input: { +[key: string]: mixed }, -) { - const blocking = []; - for (const key in input) { - const value = input[key]; - if (value instanceof Promise) { - blocking.push( - (async () => { - const result = await value; - stream.write([key, result]); - })(), - ); - } else { - stream.write([key, value]); - } - } - Promise.all(blocking).then(() => { - stream.end(); - }); -} - function waitForStream(readable: stream$Readable): Promise { return new Promise(r => { readable.on('end', r); }); } -export { streamJSON, waitForStream }; +export { waitForStream }; diff --git a/yarn.lock b/yarn.lock --- a/yarn.lock +++ b/yarn.lock @@ -10847,11 +10847,6 @@ resolved "https://registry.yarnpkg.com/duplexer3/-/duplexer3-0.1.4.tgz#ee01dd1cac0ed3cbc7fdbea37dc0a8f1ce002ce2" integrity sha512-CEj8FwwNA4cVH2uFCoHUrmojhYh1vmCdOaneKJXwkeY1i9jnlslVo9dx+hQ5Hl9GnH/Bwy/IjxAyOePyPKYnzA== -duplexer@~0.1.1: - version "0.1.1" - resolved "https://registry.yarnpkg.com/duplexer/-/duplexer-0.1.1.tgz#ace6ff808c1ce66b57d1ebf97977acb02334cfc1" - integrity sha1-rOb/gIwc5mtX0ev5eXessCM0z8E= - duplexify@^4.0.0, duplexify@^4.1.1, duplexify@^4.1.2: version "4.1.2" resolved "https://registry.yarnpkg.com/duplexify/-/duplexify-4.1.2.tgz#18b4f8d28289132fa0b9573c898d9f903f81c7b0" @@ -11294,7 +11289,7 @@ resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz#a30304e99daa32e23b2fd20f51babd07cffca344" integrity sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w== -escape-string-regexp@^1.0.2, escape-string-regexp@^1.0.3, escape-string-regexp@^1.0.5: +escape-string-regexp@^1.0.2, escape-string-regexp@^1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" integrity sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ= @@ -21796,15 +21791,6 @@ resolved "https://registry.yarnpkg.com/repeat-string/-/repeat-string-1.6.1.tgz#8dcae470e1c88abc2d600fff4a776286da75e637" integrity sha1-jcrkcOHIirwtYA//Sndihtp15jc= -replacestream@^4.0.3: - version "4.0.3" - resolved "https://registry.yarnpkg.com/replacestream/-/replacestream-4.0.3.tgz#3ee5798092be364b1cdb1484308492cb3dff2f36" - integrity sha512-AC0FiLS352pBBiZhd4VXB1Ab/lh0lEgpP+GGvZqbQh8a5cmXVoTe5EX/YeTFArnp4SRGTHh1qCHu9lGs1qG8sA== - dependencies: - escape-string-regexp "^1.0.3" - object-assign "^4.0.1" - readable-stream "^2.0.2" - request-promise-core@1.1.4: version "1.1.4" resolved "https://registry.yarnpkg.com/request-promise-core/-/request-promise-core-1.1.4.tgz#3eedd4223208d419867b78ce815167d10593a22f" @@ -23316,14 +23302,6 @@ duplexer2 "~0.1.0" readable-stream "^2.0.2" -stream-combiner@^0.2.2: - version "0.2.2" - resolved "https://registry.yarnpkg.com/stream-combiner/-/stream-combiner-0.2.2.tgz#aec8cbac177b56b6f4fa479ced8c1912cee52858" - integrity sha1-rsjLrBd7Vrb0+kec7YwZEs7lKFg= - dependencies: - duplexer "~0.1.1" - through "~2.3.4" - stream-events@^1.0.4, stream-events@^1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/stream-events/-/stream-events-1.0.5.tgz#bbc898ec4df33a4902d892333d47da9bf1c406d5" @@ -24120,7 +24098,7 @@ dependencies: readable-stream "3" -through@2, "through@>=2.2.7 <3", through@^2.3.6, through@^2.3.8, through@~2.3.4: +through@2, "through@>=2.2.7 <3", through@^2.3.6, through@^2.3.8: version "2.3.8" resolved "https://registry.yarnpkg.com/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5" integrity sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=