From 51d5bc19a23fbc501760fca73a15bc711c4c9a89 Mon Sep 17 00:00:00 2001 From: Franck Royer Date: Thu, 23 Jun 2022 17:07:38 +1000 Subject: [PATCH] fix: removed usage of buffer in streams --- package-lock.json | 486 ++++--------------------------- package.json | 6 +- src/lib/waku_filter/index.ts | 18 +- src/lib/waku_light_push/index.ts | 16 +- src/lib/waku_store/index.ts | 16 +- 5 files changed, 93 insertions(+), 449 deletions(-) diff --git a/package-lock.json b/package-lock.json index bb4b8e86d2..180b26c59c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -26,9 +26,8 @@ "debug": "^4.3.4", "dns-query": "^0.11.1", "hi-base32": "^0.5.1", - "it-concat": "^2.0.0", - "it-length-prefixed": "^5.0.2", - "it-pipe": "^1.1.0", + "it-length-prefixed": "^7.0.1", + "it-pipe": "^2.0.3", "js-sha3": "^0.8.0", "libp2p": "^0.37.3", "multiformats": "^9.6.5", @@ -55,7 +54,6 @@ "@typescript-eslint/eslint-plugin": "^5.8.1", "@typescript-eslint/parser": "^5.8.1", "app-root-path": "^3.0.0", - "buffer": "^6.0.3", "chai": "^4.3.4", "cspell": "^5.14.0", "eslint": "^8.6.0", @@ -752,21 +750,6 @@ "resolved": "https://registry.npmjs.org/is-loopback-addr/-/is-loopback-addr-2.0.1.tgz", "integrity": "sha512-SEsepLbdWFb13B6U0tt6dYcUM0iK/U7XOC43N70Z4Qb88WpNtp+ospyNI9ddpqncs7Z7brAEsVBTQpaqSNntIw==" }, - "node_modules/@chainsafe/libp2p-gossipsub/node_modules/it-pipe": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/it-pipe/-/it-pipe-2.0.3.tgz", - "integrity": "sha512-1bfNC0v8yFDQu5KwZpHZrVO+nxOIEXfrobYtv55NXcsMfGu2SueMOCyCm63khejA+sCU0gLcRFQIfKWlBNNTGw==", - "dependencies": { - "it-merge": "^1.0.4", - "it-pushable": "^2.0.0", - "it-stream-types": "^1.0.3" - } - }, - "node_modules/@chainsafe/libp2p-gossipsub/node_modules/it-pushable": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/it-pushable/-/it-pushable-2.0.2.tgz", - "integrity": "sha512-f/n6HqXGDbHvuMR/3UN+S6W4y/bS1Pxg6Lb0oVc5dbflxy5f3NKkizKs86B8vzqHnB9hm1YpE0pgcEvI3FKDQw==" - }, "node_modules/@chainsafe/libp2p-noise": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/@chainsafe/libp2p-noise/-/libp2p-noise-7.0.0.tgz", @@ -811,36 +794,6 @@ "npm": ">=7.0.0" } }, - "node_modules/@chainsafe/libp2p-noise/node_modules/it-length-prefixed": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/it-length-prefixed/-/it-length-prefixed-7.0.1.tgz", - "integrity": "sha512-UozKoT0zZPUa0LO9OSq5KaLKPn83U7Vsy/BNAN0TUXfTI/pKrOz6RuyTSOok6NDad12FZsShBGnl9DKlfDT95g==", - "dependencies": { - "err-code": "^3.0.1", - "it-stream-types": "^1.0.4", - "uint8arraylist": "^1.2.0", - "varint": "^6.0.0" - }, - "engines": { - "node": ">=16.0.0", - "npm": ">=7.0.0" - } - }, - "node_modules/@chainsafe/libp2p-noise/node_modules/it-pipe": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/it-pipe/-/it-pipe-2.0.3.tgz", - "integrity": "sha512-1bfNC0v8yFDQu5KwZpHZrVO+nxOIEXfrobYtv55NXcsMfGu2SueMOCyCm63khejA+sCU0gLcRFQIfKWlBNNTGw==", - "dependencies": { - "it-merge": "^1.0.4", - "it-pushable": "^2.0.0", - "it-stream-types": "^1.0.3" - } - }, - "node_modules/@chainsafe/libp2p-noise/node_modules/it-pushable": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/it-pushable/-/it-pushable-2.0.2.tgz", - "integrity": "sha512-f/n6HqXGDbHvuMR/3UN+S6W4y/bS1Pxg6Lb0oVc5dbflxy5f3NKkizKs86B8vzqHnB9hm1YpE0pgcEvI3FKDQw==" - }, "node_modules/@cspell/cspell-bundled-dicts": { "version": "5.14.0", "resolved": "https://registry.npmjs.org/@cspell/cspell-bundled-dicts/-/cspell-bundled-dicts-5.14.0.tgz", @@ -1979,21 +1932,6 @@ "resolved": "https://registry.npmjs.org/get-iterator/-/get-iterator-2.0.0.tgz", "integrity": "sha512-BDJawD5PU2gZv6Vlp8O28H4GnZcsr3h9gZUvnAP5xXP3WOy/QAoOsyMepSkw21jur+4t5Vppde72ChjhTIzxzg==" }, - "node_modules/@libp2p/mplex/node_modules/it-pipe": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/it-pipe/-/it-pipe-2.0.3.tgz", - "integrity": "sha512-1bfNC0v8yFDQu5KwZpHZrVO+nxOIEXfrobYtv55NXcsMfGu2SueMOCyCm63khejA+sCU0gLcRFQIfKWlBNNTGw==", - "dependencies": { - "it-merge": "^1.0.4", - "it-pushable": "^2.0.0", - "it-stream-types": "^1.0.3" - } - }, - "node_modules/@libp2p/mplex/node_modules/it-pipe/node_modules/it-pushable": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/it-pushable/-/it-pushable-2.0.2.tgz", - "integrity": "sha512-f/n6HqXGDbHvuMR/3UN+S6W4y/bS1Pxg6Lb0oVc5dbflxy5f3NKkizKs86B8vzqHnB9hm1YpE0pgcEvI3FKDQw==" - }, "node_modules/@libp2p/mplex/node_modules/it-pushable": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/it-pushable/-/it-pushable-3.0.0.tgz", @@ -2055,31 +1993,6 @@ "resolved": "https://registry.npmjs.org/get-iterator/-/get-iterator-2.0.0.tgz", "integrity": "sha512-BDJawD5PU2gZv6Vlp8O28H4GnZcsr3h9gZUvnAP5xXP3WOy/QAoOsyMepSkw21jur+4t5Vppde72ChjhTIzxzg==" }, - "node_modules/@libp2p/multistream-select/node_modules/it-length-prefixed": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/it-length-prefixed/-/it-length-prefixed-7.0.1.tgz", - "integrity": "sha512-UozKoT0zZPUa0LO9OSq5KaLKPn83U7Vsy/BNAN0TUXfTI/pKrOz6RuyTSOok6NDad12FZsShBGnl9DKlfDT95g==", - "dependencies": { - "err-code": "^3.0.1", - "it-stream-types": "^1.0.4", - "uint8arraylist": "^1.2.0", - "varint": "^6.0.0" - }, - "engines": { - "node": ">=16.0.0", - "npm": ">=7.0.0" - } - }, - "node_modules/@libp2p/multistream-select/node_modules/it-pipe": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/it-pipe/-/it-pipe-2.0.3.tgz", - "integrity": "sha512-1bfNC0v8yFDQu5KwZpHZrVO+nxOIEXfrobYtv55NXcsMfGu2SueMOCyCm63khejA+sCU0gLcRFQIfKWlBNNTGw==", - "dependencies": { - "it-merge": "^1.0.4", - "it-pushable": "^2.0.0", - "it-stream-types": "^1.0.3" - } - }, "node_modules/@libp2p/multistream-select/node_modules/it-pushable": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/it-pushable/-/it-pushable-2.0.2.tgz", @@ -2229,16 +2142,6 @@ "npm": ">=7.0.0" } }, - "node_modules/@libp2p/peer-record/node_modules/it-pipe": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/it-pipe/-/it-pipe-2.0.3.tgz", - "integrity": "sha512-1bfNC0v8yFDQu5KwZpHZrVO+nxOIEXfrobYtv55NXcsMfGu2SueMOCyCm63khejA+sCU0gLcRFQIfKWlBNNTGw==", - "dependencies": { - "it-merge": "^1.0.4", - "it-pushable": "^2.0.0", - "it-stream-types": "^1.0.3" - } - }, "node_modules/@libp2p/peer-record/node_modules/it-pushable": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/it-pushable/-/it-pushable-2.0.2.tgz", @@ -2288,16 +2191,6 @@ "npm": ">=7.0.0" } }, - "node_modules/@libp2p/peer-store/node_modules/it-pipe": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/it-pipe/-/it-pipe-2.0.3.tgz", - "integrity": "sha512-1bfNC0v8yFDQu5KwZpHZrVO+nxOIEXfrobYtv55NXcsMfGu2SueMOCyCm63khejA+sCU0gLcRFQIfKWlBNNTGw==", - "dependencies": { - "it-merge": "^1.0.4", - "it-pushable": "^2.0.0", - "it-stream-types": "^1.0.3" - } - }, "node_modules/@libp2p/peer-store/node_modules/it-pushable": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/it-pushable/-/it-pushable-2.0.2.tgz", @@ -2345,36 +2238,6 @@ "resolved": "https://registry.npmjs.org/get-iterator/-/get-iterator-2.0.0.tgz", "integrity": "sha512-BDJawD5PU2gZv6Vlp8O28H4GnZcsr3h9gZUvnAP5xXP3WOy/QAoOsyMepSkw21jur+4t5Vppde72ChjhTIzxzg==" }, - "node_modules/@libp2p/pubsub/node_modules/it-length-prefixed": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/it-length-prefixed/-/it-length-prefixed-7.0.1.tgz", - "integrity": "sha512-UozKoT0zZPUa0LO9OSq5KaLKPn83U7Vsy/BNAN0TUXfTI/pKrOz6RuyTSOok6NDad12FZsShBGnl9DKlfDT95g==", - "dependencies": { - "err-code": "^3.0.1", - "it-stream-types": "^1.0.4", - "uint8arraylist": "^1.2.0", - "varint": "^6.0.0" - }, - "engines": { - "node": ">=16.0.0", - "npm": ">=7.0.0" - } - }, - "node_modules/@libp2p/pubsub/node_modules/it-pipe": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/it-pipe/-/it-pipe-2.0.3.tgz", - "integrity": "sha512-1bfNC0v8yFDQu5KwZpHZrVO+nxOIEXfrobYtv55NXcsMfGu2SueMOCyCm63khejA+sCU0gLcRFQIfKWlBNNTGw==", - "dependencies": { - "it-merge": "^1.0.4", - "it-pushable": "^2.0.0", - "it-stream-types": "^1.0.3" - } - }, - "node_modules/@libp2p/pubsub/node_modules/it-pipe/node_modules/it-pushable": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/it-pushable/-/it-pushable-2.0.2.tgz", - "integrity": "sha512-f/n6HqXGDbHvuMR/3UN+S6W4y/bS1Pxg6Lb0oVc5dbflxy5f3NKkizKs86B8vzqHnB9hm1YpE0pgcEvI3FKDQw==" - }, "node_modules/@libp2p/pubsub/node_modules/it-pushable": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/it-pushable/-/it-pushable-3.0.0.tgz", @@ -4317,6 +4180,7 @@ "version": "1.5.1", "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", + "dev": true, "funding": [ { "type": "github", @@ -4349,16 +4213,6 @@ "node": ">=8" } }, - "node_modules/bl": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/bl/-/bl-5.0.0.tgz", - "integrity": "sha512-8vxFNZ0pflFfi0WXA3WQXlj6CaMEwsmh63I1CNp0q+wWv8sD0ARx1KovSQd0l2GkwrMIOyedq0EF1FxI+RCZLQ==", - "dependencies": { - "buffer": "^6.0.3", - "inherits": "^2.0.4", - "readable-stream": "^3.4.0" - } - }, "node_modules/body-parser": { "version": "1.19.0", "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.19.0.tgz", @@ -4501,29 +4355,6 @@ "url": "https://opencollective.com/browserslist" } }, - "node_modules/buffer": { - "version": "6.0.3", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", - "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "dependencies": { - "base64-js": "^1.3.1", - "ieee754": "^1.2.1" - } - }, "node_modules/buffer-crc32": { "version": "0.2.13", "resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.13.tgz", @@ -5427,6 +5258,11 @@ "npm": ">=7.0.0" } }, + "node_modules/datastore-core/node_modules/it-pipe": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/it-pipe/-/it-pipe-1.1.0.tgz", + "integrity": "sha512-lF0/3qTVeth13TOnHVs0BTFaziwQF7m5Gg+E6JV0BXcLKutC92YjSi7bASgkPOXaLEb+YvNZrPorGMBIJvZfxg==" + }, "node_modules/date-format": { "version": "4.0.3", "resolved": "https://registry.npmjs.org/date-format/-/date-format-4.0.3.tgz", @@ -7442,6 +7278,7 @@ "version": "1.2.1", "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", + "dev": true, "funding": [ { "type": "github", @@ -8111,14 +7948,6 @@ "resolved": "https://registry.npmjs.org/it-all/-/it-all-1.0.6.tgz", "integrity": "sha512-3cmCc6Heqe3uWi3CVM/k51fa/XbMFpQVzFoDsV0IZNHSQDyAXl3c4MjHkFX5kF3922OGj7Myv1nSEUgRtcuM1A==" }, - "node_modules/it-concat": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/it-concat/-/it-concat-2.0.0.tgz", - "integrity": "sha512-jchrEB3fHlUENWkVJRmbFJ1A7gcjJDmwiolQsHhVC14DpUIbX8fgr3SOC7XNE5OoUUQNL6/RaMCPChkPemyQUw==", - "dependencies": { - "bl": "^5.0.0" - } - }, "node_modules/it-drain": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/it-drain/-/it-drain-1.0.5.tgz", @@ -8172,13 +8001,18 @@ } }, "node_modules/it-length-prefixed": { - "version": "5.0.3", - "resolved": "https://registry.npmjs.org/it-length-prefixed/-/it-length-prefixed-5.0.3.tgz", - "integrity": "sha512-b+jDHLcnOnPDQN79ronmzF5jeBjdJsy0ce2O6i6X4J5tnaO8Fd146ZA/tMbzaLlKnTpXa0eKtofpYhumXGENeg==", + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/it-length-prefixed/-/it-length-prefixed-7.0.1.tgz", + "integrity": "sha512-UozKoT0zZPUa0LO9OSq5KaLKPn83U7Vsy/BNAN0TUXfTI/pKrOz6RuyTSOok6NDad12FZsShBGnl9DKlfDT95g==", "dependencies": { - "bl": "^5.0.0", - "buffer": "^6.0.3", + "err-code": "^3.0.1", + "it-stream-types": "^1.0.4", + "uint8arraylist": "^1.2.0", "varint": "^6.0.0" + }, + "engines": { + "node": ">=16.0.0", + "npm": ">=7.0.0" } }, "node_modules/it-map": { @@ -8229,25 +8063,20 @@ "npm": ">=7.0.0" } }, - "node_modules/it-pb-stream/node_modules/it-length-prefixed": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/it-length-prefixed/-/it-length-prefixed-7.0.1.tgz", - "integrity": "sha512-UozKoT0zZPUa0LO9OSq5KaLKPn83U7Vsy/BNAN0TUXfTI/pKrOz6RuyTSOok6NDad12FZsShBGnl9DKlfDT95g==", + "node_modules/it-pipe": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/it-pipe/-/it-pipe-2.0.3.tgz", + "integrity": "sha512-1bfNC0v8yFDQu5KwZpHZrVO+nxOIEXfrobYtv55NXcsMfGu2SueMOCyCm63khejA+sCU0gLcRFQIfKWlBNNTGw==", "dependencies": { - "err-code": "^3.0.1", - "it-stream-types": "^1.0.4", - "uint8arraylist": "^1.2.0", - "varint": "^6.0.0" - }, - "engines": { - "node": ">=16.0.0", - "npm": ">=7.0.0" + "it-merge": "^1.0.4", + "it-pushable": "^2.0.0", + "it-stream-types": "^1.0.3" } }, - "node_modules/it-pipe": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/it-pipe/-/it-pipe-1.1.0.tgz", - "integrity": "sha512-lF0/3qTVeth13TOnHVs0BTFaziwQF7m5Gg+E6JV0BXcLKutC92YjSi7bASgkPOXaLEb+YvNZrPorGMBIJvZfxg==" + "node_modules/it-pipe/node_modules/it-pushable": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/it-pushable/-/it-pushable-2.0.2.tgz", + "integrity": "sha512-f/n6HqXGDbHvuMR/3UN+S6W4y/bS1Pxg6Lb0oVc5dbflxy5f3NKkizKs86B8vzqHnB9hm1YpE0pgcEvI3FKDQw==" }, "node_modules/it-pushable": { "version": "1.4.2", @@ -8742,31 +8571,6 @@ "resolved": "https://registry.npmjs.org/get-iterator/-/get-iterator-2.0.0.tgz", "integrity": "sha512-BDJawD5PU2gZv6Vlp8O28H4GnZcsr3h9gZUvnAP5xXP3WOy/QAoOsyMepSkw21jur+4t5Vppde72ChjhTIzxzg==" }, - "node_modules/libp2p/node_modules/it-length-prefixed": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/it-length-prefixed/-/it-length-prefixed-7.0.1.tgz", - "integrity": "sha512-UozKoT0zZPUa0LO9OSq5KaLKPn83U7Vsy/BNAN0TUXfTI/pKrOz6RuyTSOok6NDad12FZsShBGnl9DKlfDT95g==", - "dependencies": { - "err-code": "^3.0.1", - "it-stream-types": "^1.0.4", - "uint8arraylist": "^1.2.0", - "varint": "^6.0.0" - }, - "engines": { - "node": ">=16.0.0", - "npm": ">=7.0.0" - } - }, - "node_modules/libp2p/node_modules/it-pipe": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/it-pipe/-/it-pipe-2.0.3.tgz", - "integrity": "sha512-1bfNC0v8yFDQu5KwZpHZrVO+nxOIEXfrobYtv55NXcsMfGu2SueMOCyCm63khejA+sCU0gLcRFQIfKWlBNNTGw==", - "dependencies": { - "it-merge": "^1.0.4", - "it-pushable": "^2.0.0", - "it-stream-types": "^1.0.3" - } - }, "node_modules/libp2p/node_modules/it-pushable": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/it-pushable/-/it-pushable-2.0.2.tgz", @@ -14139,21 +13943,6 @@ "version": "2.0.1", "resolved": "https://registry.npmjs.org/is-loopback-addr/-/is-loopback-addr-2.0.1.tgz", "integrity": "sha512-SEsepLbdWFb13B6U0tt6dYcUM0iK/U7XOC43N70Z4Qb88WpNtp+ospyNI9ddpqncs7Z7brAEsVBTQpaqSNntIw==" - }, - "it-pipe": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/it-pipe/-/it-pipe-2.0.3.tgz", - "integrity": "sha512-1bfNC0v8yFDQu5KwZpHZrVO+nxOIEXfrobYtv55NXcsMfGu2SueMOCyCm63khejA+sCU0gLcRFQIfKWlBNNTGw==", - "requires": { - "it-merge": "^1.0.4", - "it-pushable": "^2.0.0", - "it-stream-types": "^1.0.3" - } - }, - "it-pushable": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/it-pushable/-/it-pushable-2.0.2.tgz", - "integrity": "sha512-f/n6HqXGDbHvuMR/3UN+S6W4y/bS1Pxg6Lb0oVc5dbflxy5f3NKkizKs86B8vzqHnB9hm1YpE0pgcEvI3FKDQw==" } } }, @@ -14192,32 +13981,6 @@ "interface-datastore": "^6.1.0", "multiformats": "^9.6.3" } - }, - "it-length-prefixed": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/it-length-prefixed/-/it-length-prefixed-7.0.1.tgz", - "integrity": "sha512-UozKoT0zZPUa0LO9OSq5KaLKPn83U7Vsy/BNAN0TUXfTI/pKrOz6RuyTSOok6NDad12FZsShBGnl9DKlfDT95g==", - "requires": { - "err-code": "^3.0.1", - "it-stream-types": "^1.0.4", - "uint8arraylist": "^1.2.0", - "varint": "^6.0.0" - } - }, - "it-pipe": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/it-pipe/-/it-pipe-2.0.3.tgz", - "integrity": "sha512-1bfNC0v8yFDQu5KwZpHZrVO+nxOIEXfrobYtv55NXcsMfGu2SueMOCyCm63khejA+sCU0gLcRFQIfKWlBNNTGw==", - "requires": { - "it-merge": "^1.0.4", - "it-pushable": "^2.0.0", - "it-stream-types": "^1.0.3" - } - }, - "it-pushable": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/it-pushable/-/it-pushable-2.0.2.tgz", - "integrity": "sha512-f/n6HqXGDbHvuMR/3UN+S6W4y/bS1Pxg6Lb0oVc5dbflxy5f3NKkizKs86B8vzqHnB9hm1YpE0pgcEvI3FKDQw==" } } }, @@ -15142,23 +14905,6 @@ "resolved": "https://registry.npmjs.org/get-iterator/-/get-iterator-2.0.0.tgz", "integrity": "sha512-BDJawD5PU2gZv6Vlp8O28H4GnZcsr3h9gZUvnAP5xXP3WOy/QAoOsyMepSkw21jur+4t5Vppde72ChjhTIzxzg==" }, - "it-pipe": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/it-pipe/-/it-pipe-2.0.3.tgz", - "integrity": "sha512-1bfNC0v8yFDQu5KwZpHZrVO+nxOIEXfrobYtv55NXcsMfGu2SueMOCyCm63khejA+sCU0gLcRFQIfKWlBNNTGw==", - "requires": { - "it-merge": "^1.0.4", - "it-pushable": "^2.0.0", - "it-stream-types": "^1.0.3" - }, - "dependencies": { - "it-pushable": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/it-pushable/-/it-pushable-2.0.2.tgz", - "integrity": "sha512-f/n6HqXGDbHvuMR/3UN+S6W4y/bS1Pxg6Lb0oVc5dbflxy5f3NKkizKs86B8vzqHnB9hm1YpE0pgcEvI3FKDQw==" - } - } - }, "it-pushable": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/it-pushable/-/it-pushable-3.0.0.tgz", @@ -15214,27 +14960,6 @@ "resolved": "https://registry.npmjs.org/get-iterator/-/get-iterator-2.0.0.tgz", "integrity": "sha512-BDJawD5PU2gZv6Vlp8O28H4GnZcsr3h9gZUvnAP5xXP3WOy/QAoOsyMepSkw21jur+4t5Vppde72ChjhTIzxzg==" }, - "it-length-prefixed": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/it-length-prefixed/-/it-length-prefixed-7.0.1.tgz", - "integrity": "sha512-UozKoT0zZPUa0LO9OSq5KaLKPn83U7Vsy/BNAN0TUXfTI/pKrOz6RuyTSOok6NDad12FZsShBGnl9DKlfDT95g==", - "requires": { - "err-code": "^3.0.1", - "it-stream-types": "^1.0.4", - "uint8arraylist": "^1.2.0", - "varint": "^6.0.0" - } - }, - "it-pipe": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/it-pipe/-/it-pipe-2.0.3.tgz", - "integrity": "sha512-1bfNC0v8yFDQu5KwZpHZrVO+nxOIEXfrobYtv55NXcsMfGu2SueMOCyCm63khejA+sCU0gLcRFQIfKWlBNNTGw==", - "requires": { - "it-merge": "^1.0.4", - "it-pushable": "^2.0.0", - "it-stream-types": "^1.0.3" - } - }, "it-pushable": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/it-pushable/-/it-pushable-2.0.2.tgz", @@ -15354,16 +15079,6 @@ "multiformats": "^9.6.3" } }, - "it-pipe": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/it-pipe/-/it-pipe-2.0.3.tgz", - "integrity": "sha512-1bfNC0v8yFDQu5KwZpHZrVO+nxOIEXfrobYtv55NXcsMfGu2SueMOCyCm63khejA+sCU0gLcRFQIfKWlBNNTGw==", - "requires": { - "it-merge": "^1.0.4", - "it-pushable": "^2.0.0", - "it-stream-types": "^1.0.3" - } - }, "it-pushable": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/it-pushable/-/it-pushable-2.0.2.tgz", @@ -15407,16 +15122,6 @@ "multiformats": "^9.6.3" } }, - "it-pipe": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/it-pipe/-/it-pipe-2.0.3.tgz", - "integrity": "sha512-1bfNC0v8yFDQu5KwZpHZrVO+nxOIEXfrobYtv55NXcsMfGu2SueMOCyCm63khejA+sCU0gLcRFQIfKWlBNNTGw==", - "requires": { - "it-merge": "^1.0.4", - "it-pushable": "^2.0.0", - "it-stream-types": "^1.0.3" - } - }, "it-pushable": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/it-pushable/-/it-pushable-2.0.2.tgz", @@ -15462,34 +15167,6 @@ "resolved": "https://registry.npmjs.org/get-iterator/-/get-iterator-2.0.0.tgz", "integrity": "sha512-BDJawD5PU2gZv6Vlp8O28H4GnZcsr3h9gZUvnAP5xXP3WOy/QAoOsyMepSkw21jur+4t5Vppde72ChjhTIzxzg==" }, - "it-length-prefixed": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/it-length-prefixed/-/it-length-prefixed-7.0.1.tgz", - "integrity": "sha512-UozKoT0zZPUa0LO9OSq5KaLKPn83U7Vsy/BNAN0TUXfTI/pKrOz6RuyTSOok6NDad12FZsShBGnl9DKlfDT95g==", - "requires": { - "err-code": "^3.0.1", - "it-stream-types": "^1.0.4", - "uint8arraylist": "^1.2.0", - "varint": "^6.0.0" - } - }, - "it-pipe": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/it-pipe/-/it-pipe-2.0.3.tgz", - "integrity": "sha512-1bfNC0v8yFDQu5KwZpHZrVO+nxOIEXfrobYtv55NXcsMfGu2SueMOCyCm63khejA+sCU0gLcRFQIfKWlBNNTGw==", - "requires": { - "it-merge": "^1.0.4", - "it-pushable": "^2.0.0", - "it-stream-types": "^1.0.3" - }, - "dependencies": { - "it-pushable": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/it-pushable/-/it-pushable-2.0.2.tgz", - "integrity": "sha512-f/n6HqXGDbHvuMR/3UN+S6W4y/bS1Pxg6Lb0oVc5dbflxy5f3NKkizKs86B8vzqHnB9hm1YpE0pgcEvI3FKDQw==" - } - } - }, "it-pushable": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/it-pushable/-/it-pushable-3.0.0.tgz", @@ -16995,7 +16672,8 @@ "base64-js": { "version": "1.5.1", "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", - "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==" + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", + "dev": true }, "base64id": { "version": "2.0.0", @@ -17008,16 +16686,6 @@ "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==" }, - "bl": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/bl/-/bl-5.0.0.tgz", - "integrity": "sha512-8vxFNZ0pflFfi0WXA3WQXlj6CaMEwsmh63I1CNp0q+wWv8sD0ARx1KovSQd0l2GkwrMIOyedq0EF1FxI+RCZLQ==", - "requires": { - "buffer": "^6.0.3", - "inherits": "^2.0.4", - "readable-stream": "^3.4.0" - } - }, "body-parser": { "version": "1.19.0", "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.19.0.tgz", @@ -17134,15 +16802,6 @@ "node-releases": "^1.1.73" } }, - "buffer": { - "version": "6.0.3", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", - "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", - "requires": { - "base64-js": "^1.3.1", - "ieee754": "^1.2.1" - } - }, "buffer-crc32": { "version": "0.2.13", "resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.13.tgz", @@ -17830,6 +17489,13 @@ "it-pushable": "^1.4.2", "it-take": "^1.0.1", "uint8arrays": "^3.0.0" + }, + "dependencies": { + "it-pipe": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/it-pipe/-/it-pipe-1.1.0.tgz", + "integrity": "sha512-lF0/3qTVeth13TOnHVs0BTFaziwQF7m5Gg+E6JV0BXcLKutC92YjSi7bASgkPOXaLEb+YvNZrPorGMBIJvZfxg==" + } } }, "date-format": { @@ -19326,7 +18992,8 @@ "ieee754": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", - "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==" + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", + "dev": true }, "ignore": { "version": "4.0.6", @@ -19800,14 +19467,6 @@ "resolved": "https://registry.npmjs.org/it-all/-/it-all-1.0.6.tgz", "integrity": "sha512-3cmCc6Heqe3uWi3CVM/k51fa/XbMFpQVzFoDsV0IZNHSQDyAXl3c4MjHkFX5kF3922OGj7Myv1nSEUgRtcuM1A==" }, - "it-concat": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/it-concat/-/it-concat-2.0.0.tgz", - "integrity": "sha512-jchrEB3fHlUENWkVJRmbFJ1A7gcjJDmwiolQsHhVC14DpUIbX8fgr3SOC7XNE5OoUUQNL6/RaMCPChkPemyQUw==", - "requires": { - "bl": "^5.0.0" - } - }, "it-drain": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/it-drain/-/it-drain-1.0.5.tgz", @@ -19853,12 +19512,13 @@ } }, "it-length-prefixed": { - "version": "5.0.3", - "resolved": "https://registry.npmjs.org/it-length-prefixed/-/it-length-prefixed-5.0.3.tgz", - "integrity": "sha512-b+jDHLcnOnPDQN79ronmzF5jeBjdJsy0ce2O6i6X4J5tnaO8Fd146ZA/tMbzaLlKnTpXa0eKtofpYhumXGENeg==", + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/it-length-prefixed/-/it-length-prefixed-7.0.1.tgz", + "integrity": "sha512-UozKoT0zZPUa0LO9OSq5KaLKPn83U7Vsy/BNAN0TUXfTI/pKrOz6RuyTSOok6NDad12FZsShBGnl9DKlfDT95g==", "requires": { - "bl": "^5.0.0", - "buffer": "^6.0.3", + "err-code": "^3.0.1", + "it-stream-types": "^1.0.4", + "uint8arraylist": "^1.2.0", "varint": "^6.0.0" } }, @@ -19900,25 +19560,24 @@ "it-length-prefixed": "^7.0.0", "it-stream-types": "^1.0.4", "uint8arraylist": "^1.3.0" - }, - "dependencies": { - "it-length-prefixed": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/it-length-prefixed/-/it-length-prefixed-7.0.1.tgz", - "integrity": "sha512-UozKoT0zZPUa0LO9OSq5KaLKPn83U7Vsy/BNAN0TUXfTI/pKrOz6RuyTSOok6NDad12FZsShBGnl9DKlfDT95g==", - "requires": { - "err-code": "^3.0.1", - "it-stream-types": "^1.0.4", - "uint8arraylist": "^1.2.0", - "varint": "^6.0.0" - } - } } }, "it-pipe": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/it-pipe/-/it-pipe-1.1.0.tgz", - "integrity": "sha512-lF0/3qTVeth13TOnHVs0BTFaziwQF7m5Gg+E6JV0BXcLKutC92YjSi7bASgkPOXaLEb+YvNZrPorGMBIJvZfxg==" + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/it-pipe/-/it-pipe-2.0.3.tgz", + "integrity": "sha512-1bfNC0v8yFDQu5KwZpHZrVO+nxOIEXfrobYtv55NXcsMfGu2SueMOCyCm63khejA+sCU0gLcRFQIfKWlBNNTGw==", + "requires": { + "it-merge": "^1.0.4", + "it-pushable": "^2.0.0", + "it-stream-types": "^1.0.3" + }, + "dependencies": { + "it-pushable": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/it-pushable/-/it-pushable-2.0.2.tgz", + "integrity": "sha512-f/n6HqXGDbHvuMR/3UN+S6W4y/bS1Pxg6Lb0oVc5dbflxy5f3NKkizKs86B8vzqHnB9hm1YpE0pgcEvI3FKDQw==" + } + } }, "it-pushable": { "version": "1.4.2", @@ -20329,27 +19988,6 @@ "resolved": "https://registry.npmjs.org/get-iterator/-/get-iterator-2.0.0.tgz", "integrity": "sha512-BDJawD5PU2gZv6Vlp8O28H4GnZcsr3h9gZUvnAP5xXP3WOy/QAoOsyMepSkw21jur+4t5Vppde72ChjhTIzxzg==" }, - "it-length-prefixed": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/it-length-prefixed/-/it-length-prefixed-7.0.1.tgz", - "integrity": "sha512-UozKoT0zZPUa0LO9OSq5KaLKPn83U7Vsy/BNAN0TUXfTI/pKrOz6RuyTSOok6NDad12FZsShBGnl9DKlfDT95g==", - "requires": { - "err-code": "^3.0.1", - "it-stream-types": "^1.0.4", - "uint8arraylist": "^1.2.0", - "varint": "^6.0.0" - } - }, - "it-pipe": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/it-pipe/-/it-pipe-2.0.3.tgz", - "integrity": "sha512-1bfNC0v8yFDQu5KwZpHZrVO+nxOIEXfrobYtv55NXcsMfGu2SueMOCyCm63khejA+sCU0gLcRFQIfKWlBNNTGw==", - "requires": { - "it-merge": "^1.0.4", - "it-pushable": "^2.0.0", - "it-stream-types": "^1.0.3" - } - }, "it-pushable": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/it-pushable/-/it-pushable-2.0.2.tgz", diff --git a/package.json b/package.json index 4fe2e97049..d6f28a890c 100644 --- a/package.json +++ b/package.json @@ -83,9 +83,8 @@ "debug": "^4.3.4", "dns-query": "^0.11.1", "hi-base32": "^0.5.1", - "it-concat": "^2.0.0", - "it-length-prefixed": "^5.0.2", - "it-pipe": "^1.1.0", + "it-length-prefixed": "^7.0.1", + "it-pipe": "^2.0.3", "js-sha3": "^0.8.0", "libp2p": "^0.37.3", "multiformats": "^9.6.5", @@ -112,7 +111,6 @@ "@typescript-eslint/eslint-plugin": "^5.8.1", "@typescript-eslint/parser": "^5.8.1", "app-root-path": "^3.0.0", - "buffer": "^6.0.3", "chai": "^4.3.4", "cspell": "^5.14.0", "eslint": "^8.6.0", diff --git a/src/lib/waku_filter/index.ts b/src/lib/waku_filter/index.ts index 46c323986d..d58a02e7aa 100644 --- a/src/lib/waku_filter/index.ts +++ b/src/lib/waku_filter/index.ts @@ -1,7 +1,7 @@ import type { PeerId } from "@libp2p/interface-peer-id"; import type { Peer } from "@libp2p/interface-peer-store"; import debug from "debug"; -import lp from "it-length-prefixed"; +import * as lp from "it-length-prefixed"; import { pipe } from "it-pipe"; import { Libp2p } from "libp2p"; @@ -109,18 +109,14 @@ export class WakuFilter { private onRequest({ stream }: any): void { log("Receiving message push"); try { - pipe( - stream.source, - lp.decode(), - async (source: AsyncIterable) => { - for await (const bytes of source) { - const res = FilterRPC.decode(bytes.slice()); - if (res.requestId && res.push?.messages?.length) { - await this.pushMessages(res.requestId, res.push.messages); - } + pipe(stream.source, lp.decode(), async (source) => { + for await (const bytes of source) { + const res = FilterRPC.decode(bytes.slice()); + if (res.requestId && res.push?.messages?.length) { + await this.pushMessages(res.requestId, res.push.messages); } } - ); + }); } catch (e) { log("Error decoding message", e); } diff --git a/src/lib/waku_light_push/index.ts b/src/lib/waku_light_push/index.ts index 56bbb9b975..7c0ed36982 100644 --- a/src/lib/waku_light_push/index.ts +++ b/src/lib/waku_light_push/index.ts @@ -1,9 +1,9 @@ import type { PeerId } from "@libp2p/interface-peer-id"; import type { Peer } from "@libp2p/interface-peer-store"; -import concat from "it-concat"; -import lp from "it-length-prefixed"; +import * as lp from "it-length-prefixed"; import { pipe } from "it-pipe"; import { Libp2p } from "libp2p"; +import { concat } from "uint8arrays/concat"; import { PushResponse } from "../../proto/light_push"; import { DefaultPubSubTopic } from "../constants"; @@ -71,15 +71,21 @@ export class WakuLightPush { ? opts.pubSubTopic : this.pubSubTopic; const query = PushRPC.createRequest(message, pubSubTopic); - const res = await pipe( + const res: Uint8Array[] = []; + await pipe( [query.encode()], lp.encode(), stream, lp.decode(), - concat + async (source) => { + for await (const chunk of source) { + res.push(chunk.slice()); + } + } ); try { - const response = PushRPC.decode(res.slice()).response; + const bytes = concat(res); + const response = PushRPC.decode(bytes).response; if (!response) { console.log("No response in PushRPC"); diff --git a/src/lib/waku_store/index.ts b/src/lib/waku_store/index.ts index 3319970c32..1d9e94eee8 100644 --- a/src/lib/waku_store/index.ts +++ b/src/lib/waku_store/index.ts @@ -1,10 +1,10 @@ import type { PeerId } from "@libp2p/interface-peer-id"; import { Peer } from "@libp2p/interface-peer-store"; import debug from "debug"; -import concat from "it-concat"; -import lp from "it-length-prefixed"; +import * as lp from "it-length-prefixed"; import { pipe } from "it-pipe"; import { Libp2p } from "libp2p"; +import { concat } from "uint8arrays/concat"; import * as protoV2Beta4 from "../../proto/store_v2beta4"; import { DefaultPubSubTopic, StoreCodecs } from "../constants"; @@ -205,14 +205,20 @@ export class WakuStore { const historyRpcQuery = HistoryRPC.createQuery(queryOpts); dbg("Querying store peer", connections[0].remoteAddr.toString()); - const res = await pipe( + const res: Uint8Array[] = []; + await pipe( [historyRpcQuery.encode()], lp.encode(), stream, lp.decode(), - concat + async (source) => { + for await (const chunk of source) { + res.push(chunk.slice()); + } + } ); - const reply = historyRpcQuery.decode(res.slice()); + const bytes = concat(res); + const reply = historyRpcQuery.decode(bytes); if (!reply.response) { throw "History response misses response field";