@thi.ng/rstream 9.4.2 → 9.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/nodejs.d.ts +12 -10
- package/nodejs.js +5 -5
- package/package.json +13 -13
- package/subscription.js +1 -0
- package/transduce.d.ts +2 -2
package/README.md
CHANGED
package/nodejs.d.ts
CHANGED
|
@@ -1,25 +1,26 @@
|
|
|
1
1
|
import type { Readable } from "node:stream";
|
|
2
|
-
import {
|
|
3
|
-
import type { Subscription } from "./subscription.js";
|
|
2
|
+
import type { ISubscriber, ISubscription } from "./api.js";
|
|
4
3
|
/**
|
|
5
|
-
* Adapter bridge from NodeJS streams.
|
|
6
|
-
* of type `T`
|
|
7
|
-
*
|
|
8
|
-
* Unless `close` is false,
|
|
4
|
+
* Adapter bridge from NodeJS streams. Pipes data from given `stdout` (assumed
|
|
5
|
+
* to produce data of type `T`) into `ingest` or creates and returns a new
|
|
6
|
+
* {@link stream}. If given, also connects given `stderr` to `ingest`'s error
|
|
7
|
+
* handler (if defined). Unless `close` is false, `ingest` closes once `stdout` is closed.
|
|
9
8
|
*
|
|
10
9
|
* @param stdout -
|
|
11
10
|
* @param stderr -
|
|
12
11
|
* @param close -
|
|
12
|
+
* @param ingest -
|
|
13
13
|
*/
|
|
14
|
-
export declare const fromNodeJS: <T>(stdout: Readable, stderr?: Readable, close?: boolean) =>
|
|
14
|
+
export declare const fromNodeJS: <T>(stdout: Readable, stderr?: Readable, close?: boolean, ingest?: ISubscriber<T>) => ISubscriber<T>;
|
|
15
15
|
/**
|
|
16
16
|
* Specialized version of {@link fromNodeJS} for string inputs and automatic
|
|
17
17
|
* rechunking/splitting of the input using the optionally provided regexp (line
|
|
18
18
|
* breaks by default).
|
|
19
19
|
*
|
|
20
20
|
* @remarks
|
|
21
|
-
* Internally uses
|
|
22
|
-
* to rechunk
|
|
21
|
+
* Internally uses
|
|
22
|
+
* https://docs.thi.ng/umbrella/transducers/functions/rechunk.html to rechunk
|
|
23
|
+
* input.
|
|
23
24
|
*
|
|
24
25
|
* @example
|
|
25
26
|
* ```ts tangle:../export/lines-from-nodejs.ts
|
|
@@ -45,6 +46,7 @@ export declare const fromNodeJS: <T>(stdout: Readable, stderr?: Readable, close?
|
|
|
45
46
|
* @param stderr -
|
|
46
47
|
* @param re -
|
|
47
48
|
* @param close -
|
|
49
|
+
* @param ingest -
|
|
48
50
|
*/
|
|
49
|
-
export declare const linesFromNodeJS: (stdout: Readable, stderr?: Readable, re?: RegExp, close?: boolean) =>
|
|
51
|
+
export declare const linesFromNodeJS: (stdout: Readable, stderr?: Readable, re?: RegExp, close?: boolean, ingest?: ISubscription<string, string>) => ISubscription<string, string>;
|
|
50
52
|
//# sourceMappingURL=nodejs.d.ts.map
|
package/nodejs.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { rechunk } from "@thi.ng/transducers/rechunk";
|
|
2
2
|
import { stream } from "./stream.js";
|
|
3
|
-
const fromNodeJS = (stdout, stderr, close = true) => {
|
|
4
|
-
const ingest = stream();
|
|
3
|
+
const fromNodeJS = (stdout, stderr, close = true, ingest = stream()) => {
|
|
5
4
|
stdout.on("data", (data) => ingest.next(data));
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
if (stderr && ingest.error)
|
|
6
|
+
stderr.on("data", (data) => ingest.error(data));
|
|
7
|
+
if (close && ingest.done) stdout.on("close", () => ingest.done());
|
|
8
8
|
return ingest;
|
|
9
9
|
};
|
|
10
|
-
const linesFromNodeJS = (stdout, stderr, re, close) => fromNodeJS(stdout, stderr, close).transform(rechunk(re));
|
|
10
|
+
const linesFromNodeJS = (stdout, stderr, re, close, ingest) => fromNodeJS(stdout, stderr, close, ingest).transform(rechunk(re));
|
|
11
11
|
export {
|
|
12
12
|
fromNodeJS,
|
|
13
13
|
linesFromNodeJS
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thi.ng/rstream",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.5.1",
|
|
4
4
|
"description": "Reactive streams & subscription primitives for constructing dataflow graphs / pipelines",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -44,19 +44,19 @@
|
|
|
44
44
|
"tool:tangle": "../../node_modules/.bin/tangle src/**/*.ts"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@thi.ng/api": "^8.12.
|
|
48
|
-
"@thi.ng/arrays": "^2.14.
|
|
49
|
-
"@thi.ng/associative": "^7.1.
|
|
50
|
-
"@thi.ng/atom": "^5.3.
|
|
51
|
-
"@thi.ng/checks": "^3.8.
|
|
52
|
-
"@thi.ng/errors": "^2.6.
|
|
53
|
-
"@thi.ng/logger": "^3.3.
|
|
54
|
-
"@thi.ng/transducers": "^9.6.
|
|
47
|
+
"@thi.ng/api": "^8.12.19",
|
|
48
|
+
"@thi.ng/arrays": "^2.14.15",
|
|
49
|
+
"@thi.ng/associative": "^7.1.35",
|
|
50
|
+
"@thi.ng/atom": "^5.3.60",
|
|
51
|
+
"@thi.ng/checks": "^3.8.9",
|
|
52
|
+
"@thi.ng/errors": "^2.6.8",
|
|
53
|
+
"@thi.ng/logger": "^3.3.2",
|
|
54
|
+
"@thi.ng/transducers": "^9.6.32"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
|
-
"@types/node": "^
|
|
58
|
-
"esbuild": "^0.
|
|
59
|
-
"typedoc": "^0.28.
|
|
57
|
+
"@types/node": "^25.5.2",
|
|
58
|
+
"esbuild": "^0.28.0",
|
|
59
|
+
"typedoc": "^0.28.18",
|
|
60
60
|
"typescript": "^5.9.3"
|
|
61
61
|
},
|
|
62
62
|
"keywords": [
|
|
@@ -223,5 +223,5 @@
|
|
|
223
223
|
],
|
|
224
224
|
"year": 2017
|
|
225
225
|
},
|
|
226
|
-
"gitHead": "
|
|
226
|
+
"gitHead": "27c7195e4ebd818402f3bf5ae0d1d21d7c108e99"
|
|
227
227
|
}
|
package/subscription.js
CHANGED
package/transduce.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Reducer, Transducer } from "@thi.ng/transducers";
|
|
2
|
-
import type {
|
|
2
|
+
import type { ISubscribable } from "./api.js";
|
|
3
3
|
/**
|
|
4
4
|
* Returns a promise which subscribes to given input and transforms
|
|
5
5
|
* incoming values using given transducer `xform` and reducer `rfn`.
|
|
@@ -27,5 +27,5 @@ import type { Subscription } from "./subscription.js";
|
|
|
27
27
|
* @param rfn -
|
|
28
28
|
* @param init -
|
|
29
29
|
*/
|
|
30
|
-
export declare const transduce: <A, B, C>(src:
|
|
30
|
+
export declare const transduce: <A, B, C>(src: ISubscribable<A>, xform: Transducer<A, B>, rfn: Reducer<B, C>, init?: C) => Promise<C>;
|
|
31
31
|
//# sourceMappingURL=transduce.d.ts.map
|