From 2d04141d076761338d94042aeaeee1c181cb89de Mon Sep 17 00:00:00 2001 From: Sven Slootweg Date: Sat, 9 Oct 2021 20:59:59 +0200 Subject: [PATCH] Flotsam and jetsam --- README.md | 4 +++ index.js | 1 + yarn.lock | 73 ++++++++++++++++++++++++++++++++----------------------- 3 files changed, 47 insertions(+), 31 deletions(-) diff --git a/README.md b/README.md index 382e13f..ff8cb26 100644 --- a/README.md +++ b/README.md @@ -10,3 +10,7 @@ __Why does Promistreams not have Duplex streams?__ Because they're surprisingly Aside from that, they are also just difficult to work with. Developers routinely get tripped up by the difference between a Duplex and a Transform stream, and it's much simpler to reason about your streams code when a separate readable and writable stream don't pretend to be a single stream when they're really not. +-- + +Things to document: +- "Cannot read from a partial pipeline; maybe you forgot to specify a source stream?" means that the stream you thought was readable/writable is actually a transform stream that's internally wired up to something else, and you should use the explicit fromReadable/fromWritable methods in that case. The adapter library cannot (currently) detect it, and wiring this up wrong can result in strange behaviour and phantom values. diff --git a/index.js b/index.js index 785fd64..50cb9d3 100644 --- a/index.js +++ b/index.js @@ -137,6 +137,7 @@ function fromTransform(stream) { if (endHandled) { // NOTE: This logic exists at the start, not in the upstream EndOfStream handling code, because any number of buffer reads may be required before the wrapped Node stream can be closed // NOTE: The push-buffer will automatically produce EndOfStream markers once the buffer has run out and the underlying stream has closed, so long as we're using the wireUpReadableInterface function + // FIXME: Refactor this design to request-matcher instead? return Promise.try(() => { return readable.request(); }).then((result) => { diff --git a/yarn.lock b/yarn.lock index f7d4e00..cf905e6 100644 --- a/yarn.lock +++ b/yarn.lock @@ -71,9 +71,9 @@ bluebird "^3.5.4" "@promistream/pipe@^0.1.1", "@promistream/pipe@^0.1.4": - version "0.1.4" - resolved "https://registry.yarnpkg.com/@promistream/pipe/-/pipe-0.1.4.tgz#ef05fe582a33768c7eb56ad20635e1b7b48ac95b" - integrity sha512-4js6lhu/aTNEMosIBFcCz8Rkxc1S2V4zzI2QvZp9HqglhL5UTuxnv5VbU2ZlPFAFVID1aJOurZ8KdiVagHfOCw== + version "0.1.6" + resolved "https://registry.yarnpkg.com/@promistream/pipe/-/pipe-0.1.6.tgz#fb7d930fd7011a9542502904049023fdaa87b82d" + integrity sha512-B/n4WPJ/goXALCWJYgZV0M/lLMIF5OuaqvxezJq/lcSCo9RuV82wmdJBZd+IEmc6Ykn/EYTFtUHCnRjkl56+3w== dependencies: "@validatem/allow-extra-properties" "^0.1.0" "@validatem/anything" "^0.1.0" @@ -85,9 +85,9 @@ "@validatem/wrap-error" "^0.3.0" "@promistream/propagate-abort@^0.1.2", "@promistream/propagate-abort@^0.1.3", "@promistream/propagate-abort@^0.1.6": - version "0.1.6" - resolved "https://registry.yarnpkg.com/@promistream/propagate-abort/-/propagate-abort-0.1.6.tgz#dfc3c78c2e22662b9e5d548afce2180c40584ef5" - integrity sha512-Ap4eDFiIcLb4yuJdin2tQM1+2ZJZm78sYWkKVdqECJY0UGkwNsbaMMeYyfZpFRpJGmW8mCCuOkWs0fQl5H9DGA== + version "0.1.7" + resolved "https://registry.yarnpkg.com/@promistream/propagate-abort/-/propagate-abort-0.1.7.tgz#06a5af16adb433ae27b25bb38b957b01619bf9e8" + integrity sha512-BR0XZMirAjO1IRpyTtOG4n0fGuuvRGJsO8Hmn4HOJXhi10onX3GlfCNZN2tqe4Mq/5fEDgRNGNUHjCY7naDYUA== "@promistream/propagate-peek@^0.1.0", "@promistream/propagate-peek@^0.1.1": version "0.1.1" @@ -119,9 +119,9 @@ bluebird "^3.5.4" "@promistream/simple-sink@^0.2.0": - version "0.2.0" - resolved "https://registry.yarnpkg.com/@promistream/simple-sink/-/simple-sink-0.2.0.tgz#74cf5fadbd98dc3dd7b237f7816ea5a1fdc2147d" - integrity sha512-QEFpCoZRbTqVzicetUxImQQKgzJ2gfOxyFcAs/LudSxU7TXzsPkYKqLnXteNWk8UZ6gZkmCW80jLW7DfjqVnbQ== + version "0.2.1" + resolved "https://registry.yarnpkg.com/@promistream/simple-sink/-/simple-sink-0.2.1.tgz#bc3360dfe1a3bb687e68f7c8e43d598242e2b4ae" + integrity sha512-g0KXsofGw+a0+p9WaDbZfeU5KlkNt1x2HDbXw65ZDJ6ZjsMA2MkcwVws19EeyHZ0zIGbHD9F8qjFknTHdkUe9Q== dependencies: "@promistream/is-aborted" "^0.1.1" "@promistream/is-end-of-stream" "^0.1.1" @@ -135,9 +135,9 @@ result-buffer "^0.1.0" "@promistream/simple-source@^0.1.0", "@promistream/simple-source@^0.1.1": - version "0.1.3" - resolved "https://registry.yarnpkg.com/@promistream/simple-source/-/simple-source-0.1.3.tgz#8139ed088f8249eb9a93287fc04213008325cf06" - integrity sha512-rmpEW0Ec/9Ajrgnx0FHV+mYk4uZ+X3tRhACexUjeal6Jxgzp1oITES59+y2FZA86/a7VPCaadXBA6sWuRfcc3w== + version "0.1.4" + resolved "https://registry.yarnpkg.com/@promistream/simple-source/-/simple-source-0.1.4.tgz#a0029040660cd577e51eede1978b49b04b1e5ed0" + integrity sha512-dMAVpcX2WC40IVMA6zvSAcgwxXjDVj4QIQzOyDdXgOnKjCRnGPhtUvK2ST5Jiw8/lVpEYx0bviqgezttU3IaFg== dependencies: "@joepie91/unreachable" "^1.0.0" "@promistream/aborted" "^0.1.1" @@ -445,7 +445,7 @@ bluebird@^3.5.4, bluebird@^3.7.2: resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.7.2.tgz#9f229c15be272454ffa973ace0dbee79a1b0c36f" integrity sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg== -call-bind@^1.0.0: +call-bind@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/call-bind/-/call-bind-1.0.2.tgz#b1d4e89e688119c3c9a903ad30abb2f6a919be3c" integrity sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA== @@ -487,9 +487,9 @@ create-error@^0.3.1: integrity sha1-aYECRaYp5lRDK/BDdzYAA6U1GiM= debug@^4.3.1: - version "4.3.1" - resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.1.tgz#f0d229c505e0c6d8c49ac553d1b13dc183f6b2ee" - integrity sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ== + version "4.3.2" + resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.2.tgz#f0a49c18ac8779e31d4a0c6029dfb76873c7428b" + integrity sha512-mOp8wKcvj7XxC78zLgw/ZA+6TSgkoE2C/ienthhRD298T7UNwAg9diBpLRxC0mOezLl4B0xV7M0cCO6P/O0Xhw== dependencies: ms "2.1.2" @@ -574,11 +574,18 @@ has-flag@^4.0.0: resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-4.0.0.tgz#944771fd9c81c81265c4d6941860da06bb59479b" integrity sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ== -has-symbols@^1.0.1: +has-symbols@^1.0.1, has-symbols@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/has-symbols/-/has-symbols-1.0.2.tgz#165d3070c00309752a1236a479331e3ac56f1423" integrity sha512-chXa79rL/UC2KlX17jo3vRGz0azaWEx5tGqZg5pO3NUyEJVB17dMruQlzCCOfUvElghKcm5194+BCRvi2Rv/Gw== +has-tostringtag@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/has-tostringtag/-/has-tostringtag-1.0.0.tgz#7e133818a7d394734f941e73c3d3f9291e658b25" + integrity sha512-kFjcSNhnlGV1kyoGk7OXKSawH5JOb/LzUc5w9B02hOTO0dfFRjbHQKvg1d6cf3HbeUmtU9VbbV3qzZ2Teh97WQ== + dependencies: + has-symbols "^1.0.2" + has@^1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/has/-/has-1.0.3.tgz#722d7cbfc1f6aa8241f16dd814e011e1f41e8796" @@ -592,23 +599,25 @@ indent-string@^4.0.0: integrity sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg== is-arguments@^1.0.4: - version "1.1.0" - resolved "https://registry.yarnpkg.com/is-arguments/-/is-arguments-1.1.0.tgz#62353031dfbee07ceb34656a6bde59efecae8dd9" - integrity sha512-1Ij4lOMPl/xB5kBDn7I+b2ttPMKa8szhEIrXDuXQD/oe3HJLTLhqhgGspwgyGd6MOywBUqVvYicF72lkgDnIHg== + version "1.1.1" + resolved "https://registry.yarnpkg.com/is-arguments/-/is-arguments-1.1.1.tgz#15b3f88fda01f2a97fec84ca761a560f123efa9b" + integrity sha512-8Q7EARjzEnKpt/PCD7e1cgUS0a6X8u5tdSiMqXhojOdoV9TsMsiO+9VLC5vAmO8N7/GmXn7yjR8qnA6bVAEzfA== dependencies: - call-bind "^1.0.0" + call-bind "^1.0.2" + has-tostringtag "^1.0.0" is-boolean-object@^1.0.1: - version "1.1.0" - resolved "https://registry.yarnpkg.com/is-boolean-object/-/is-boolean-object-1.1.0.tgz#e2aaad3a3a8fca34c28f6eee135b156ed2587ff0" - integrity sha512-a7Uprx8UtD+HWdyYwnD1+ExtTgqQtD2k/1yJgtXP6wnMm8byhkoTZRl+95LLThpzNZJ5aEvi46cdH+ayMFRwmA== + version "1.1.2" + resolved "https://registry.yarnpkg.com/is-boolean-object/-/is-boolean-object-1.1.2.tgz#5c6dc200246dd9321ae4b885a114bb1f75f63719" + integrity sha512-gDYaKHJmnj4aWxyj6YHyXVpdQawtVLHU5cb+eztPGczf6cjuTdwve5ZIEfgXqH4e57An1D1AKf8CZ3kYrQRqYA== dependencies: - call-bind "^1.0.0" + call-bind "^1.0.2" + has-tostringtag "^1.0.0" is-callable@^1.1.5: - version "1.2.3" - resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.2.3.tgz#8b1e0500b73a1d76c70487636f368e519de8db8e" - integrity sha512-J1DcMe8UYTBSrKezuIUTUwjXsho29693unXM2YhJUTR2txK/eG47bvNa/wipPFmZFgr/N6f1GA66dv0mEyTIyQ== + version "1.2.4" + resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.2.4.tgz#47301d58dd0259407865547853df6d61fe471945" + integrity sha512-nsuwtxZfMX67Oryl9LCQ+upnC0Z0BgpwntpS89m1H/TLF0zNfzfLMV/9Wa/6MZsj0acpEjAO0KF1xT6ZdLl95w== is-plain-obj@^2.1.0: version "2.1.0" @@ -621,9 +630,11 @@ is-regexp@^2.0.0: integrity sha512-OZ4IlER3zmRIoB9AqNhEggVxqIH4ofDns5nRrPS6yQxXE1TPCUpFznBfRQmQa8uC+pXqjMnukiJBxCisIxiLGA== is-string@^1.0.5: - version "1.0.5" - resolved "https://registry.yarnpkg.com/is-string/-/is-string-1.0.5.tgz#40493ed198ef3ff477b8c7f92f644ec82a5cd3a6" - integrity sha512-buY6VNRjhQMiF1qWDouloZlQbRhDPCebwxSjxMjxgemYT46YMd2NR0/H+fBhEfWX4A/w9TBJ+ol+okqJKFE6vQ== + version "1.0.7" + resolved "https://registry.yarnpkg.com/is-string/-/is-string-1.0.7.tgz#0dd12bf2006f255bb58f695110eff7491eebc0fd" + integrity sha512-tE2UXzivje6ofPW7l23cjDOMa09gb7xlAqG6jG5ej6uPV32TlWP3NKPigtaGeHNu9fohccRYvIiZMfOOnOYUtg== + dependencies: + has-tostringtag "^1.0.0" is.object@^1.0.0: version "1.0.0"