@thi.ng/rstream 7.0.9 → 7.2.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/CHANGELOG.md +886 -50
- package/README.md +2 -1
- package/api.d.ts +1 -0
- package/defworker.d.ts +2 -1
- package/defworker.js +4 -1
- package/forkjoin.d.ts +2 -2
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/nodejs.d.ts +51 -0
- package/nodejs.js +54 -0
- package/package.json +201 -193
- package/promises.d.ts +9 -6
- package/promises.js +8 -5
- package/tunnel.d.ts +3 -3
- package/worker.d.ts +2 -2
package/README.md
CHANGED
|
@@ -201,7 +201,7 @@ node --experimental-repl-await
|
|
|
201
201
|
> const rstream = await import("@thi.ng/rstream");
|
|
202
202
|
```
|
|
203
203
|
|
|
204
|
-
Package sizes (gzipped, pre-treeshake): ESM: 6.
|
|
204
|
+
Package sizes (gzipped, pre-treeshake): ESM: 6.12 KB
|
|
205
205
|
|
|
206
206
|
## Dependencies
|
|
207
207
|
|
|
@@ -402,6 +402,7 @@ s.next(42);
|
|
|
402
402
|
- [fromDOMEvent()](https://github.com/thi-ng/umbrella/tree/develop/packages/rstream/src/event.ts#L25) - DOM events
|
|
403
403
|
- [fromInterval()](https://github.com/thi-ng/umbrella/tree/develop/packages/rstream/src/interval.ts) - interval based counters
|
|
404
404
|
- [fromIterable()](https://github.com/thi-ng/umbrella/tree/develop/packages/rstream/src/iterable.ts) - arrays, iterators / generators (async & sync)
|
|
405
|
+
- [fromNodeJS() / linesFromNodeJS()](https://github.com/thi-ng/umbrella/tree/develop/packages/rstream/src/nodejs.ts) - NodeJS streams adapters
|
|
405
406
|
- [fromObject()](https://github.com/thi-ng/umbrella/tree/develop/packages/rstream/src/object.ts) - object property streams
|
|
406
407
|
- [fromPromise()](https://github.com/thi-ng/umbrella/tree/develop/packages/rstream/src/promise.ts) - single value stream from promise
|
|
407
408
|
- [fromPromises()](https://github.com/thi-ng/umbrella/tree/develop/packages/rstream/src/promises.ts) - results from multiple promise
|
package/api.d.ts
CHANGED
|
@@ -183,4 +183,5 @@ export interface IStream<T> extends ISubscriber<T> {
|
|
|
183
183
|
}
|
|
184
184
|
export declare type StreamCancel = () => void;
|
|
185
185
|
export declare type StreamSource<T> = (sub: Stream<T>) => StreamCancel | void;
|
|
186
|
+
export declare type WorkerSource = Worker | Blob | Fn0<Worker> | string;
|
|
186
187
|
//# sourceMappingURL=api.d.ts.map
|
package/defworker.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { WorkerSource } from "./api.js";
|
|
1
2
|
export declare const defInlineWorker: (src: string) => Worker;
|
|
2
|
-
export declare const defWorker: (worker:
|
|
3
|
+
export declare const defWorker: (worker: WorkerSource) => Worker;
|
|
3
4
|
//# sourceMappingURL=defworker.d.ts.map
|
package/defworker.js
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
import { isFunction } from "@thi.ng/checks/is-function";
|
|
1
2
|
export const defInlineWorker = (src) => defWorker(new Blob([src], { type: "text/javascript" }));
|
|
2
3
|
export const defWorker = (worker) => worker instanceof Worker
|
|
3
4
|
? worker
|
|
4
|
-
:
|
|
5
|
+
: isFunction(worker)
|
|
6
|
+
? worker()
|
|
7
|
+
: new Worker(worker instanceof Blob ? URL.createObjectURL(worker) : worker);
|
package/forkjoin.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ArrayLikeIterable, Fn, Fn3 } from "@thi.ng/api";
|
|
2
|
-
import type { CommonOpts, ITransformable } from "./api.js";
|
|
2
|
+
import type { CommonOpts, ITransformable, WorkerSource } from "./api.js";
|
|
3
3
|
import type { Subscription } from "./subscription.js";
|
|
4
4
|
export interface ForkJoinOpts<IN, MSG, RES, OUT> extends Partial<CommonOpts> {
|
|
5
5
|
/**
|
|
@@ -38,7 +38,7 @@ export interface ForkJoinOpts<IN, MSG, RES, OUT> extends Partial<CommonOpts> {
|
|
|
38
38
|
* string. In the latter two cases, a worker is created
|
|
39
39
|
* automatically using `makeWorker()`.
|
|
40
40
|
*/
|
|
41
|
-
worker:
|
|
41
|
+
worker: WorkerSource;
|
|
42
42
|
/**
|
|
43
43
|
* Optional max number of workers to use. Defaults to
|
|
44
44
|
* `navigator.hardwareConcurrency` (or if unavailable, then 4 as
|
package/index.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ export * from "./iterable.js";
|
|
|
13
13
|
export * from "./logger.js";
|
|
14
14
|
export * from "./merge.js";
|
|
15
15
|
export * from "./metastream.js";
|
|
16
|
+
export * from "./nodejs.js";
|
|
16
17
|
export * from "./object.js";
|
|
17
18
|
export * from "./post-worker.js";
|
|
18
19
|
export * from "./promise.js";
|
package/index.js
CHANGED
|
@@ -13,6 +13,7 @@ export * from "./iterable.js";
|
|
|
13
13
|
export * from "./logger.js";
|
|
14
14
|
export * from "./merge.js";
|
|
15
15
|
export * from "./metastream.js";
|
|
16
|
+
export * from "./nodejs.js";
|
|
16
17
|
export * from "./object.js";
|
|
17
18
|
export * from "./post-worker.js";
|
|
18
19
|
export * from "./promise.js";
|
package/nodejs.d.ts
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import type { Readable } from "stream";
|
|
3
|
+
import { Stream } from "./stream.js";
|
|
4
|
+
import type { Subscription } from "./subscription.js";
|
|
5
|
+
/**
|
|
6
|
+
* Adapter bridge from NodeJS streams. Creates and returns a new {@link stream}
|
|
7
|
+
* of type `T` and pipes in data from `stdout` (also assumed to produce data of
|
|
8
|
+
* type `T`). If given, also connects `stderr` to new rstream's error handler.
|
|
9
|
+
* Unless `close` is false, the new stream closes once `stdout` is closed.
|
|
10
|
+
*
|
|
11
|
+
* @param stdout
|
|
12
|
+
* @param stderr
|
|
13
|
+
* @param close
|
|
14
|
+
*/
|
|
15
|
+
export declare const fromNodeJS: <T>(stdout: Readable, stderr?: Readable | undefined, close?: boolean) => Stream<T>;
|
|
16
|
+
/**
|
|
17
|
+
* Specialized version of {@link fromNodeJS} for string inputs and automatic
|
|
18
|
+
* rechunking/splitting of the input using the optionally provided regexp (line
|
|
19
|
+
* breaks by default).
|
|
20
|
+
*
|
|
21
|
+
* @remarks
|
|
22
|
+
* Internally uses https://docs.thi.ng/umbrella/transducers/modules.html#rechunk
|
|
23
|
+
* to rechunk input.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```ts
|
|
27
|
+
* import { spawn } from "child_process"
|
|
28
|
+
* import { linesFromNodeJS, trace } from "@thi.ng/rstream";
|
|
29
|
+
*
|
|
30
|
+
* const cmd = spawn("ls", ["-la"]);
|
|
31
|
+
*
|
|
32
|
+
* linesFromNodeJS<string>(cmd.stdout, cmd.stderr).subscribe(trace("output"));
|
|
33
|
+
*
|
|
34
|
+
* // output total 12760
|
|
35
|
+
* // output drwxr-xr-x 37 foo staff 1184 Nov 15 15:29 .
|
|
36
|
+
* // output drwxr-xr-x 143 foo staff 4576 Nov 11 21:08 ..
|
|
37
|
+
* // output drwxr-xr-x 17 foo staff 544 Nov 15 17:39 .git
|
|
38
|
+
* // output -rw-r--r-- 1 foo staff 149 Aug 4 15:32 .gitattributes
|
|
39
|
+
* // output drwxr-xr-x 5 foo staff 160 Apr 12 2021 .github
|
|
40
|
+
* // output -rw-r--r-- 1 foo staff 659 Sep 10 22:55 .gitignore
|
|
41
|
+
* // ...
|
|
42
|
+
* // output done
|
|
43
|
+
* ```
|
|
44
|
+
*
|
|
45
|
+
* @param stdout
|
|
46
|
+
* @param stderr
|
|
47
|
+
* @param re
|
|
48
|
+
* @param close
|
|
49
|
+
*/
|
|
50
|
+
export declare const linesFromNodeJS: (stdout: Readable, stderr?: Readable | undefined, re?: RegExp | undefined, close?: boolean | undefined) => Subscription<string, string>;
|
|
51
|
+
//# sourceMappingURL=nodejs.d.ts.map
|
package/nodejs.js
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { rechunk } from "@thi.ng/transducers/rechunk";
|
|
2
|
+
import { stream } from "./stream.js";
|
|
3
|
+
/**
|
|
4
|
+
* Adapter bridge from NodeJS streams. Creates and returns a new {@link stream}
|
|
5
|
+
* of type `T` and pipes in data from `stdout` (also assumed to produce data of
|
|
6
|
+
* type `T`). If given, also connects `stderr` to new rstream's error handler.
|
|
7
|
+
* Unless `close` is false, the new stream closes once `stdout` is closed.
|
|
8
|
+
*
|
|
9
|
+
* @param stdout
|
|
10
|
+
* @param stderr
|
|
11
|
+
* @param close
|
|
12
|
+
*/
|
|
13
|
+
export const fromNodeJS = (stdout, stderr, close = true) => {
|
|
14
|
+
const ingest = stream();
|
|
15
|
+
stdout.on("data", (data) => ingest.next(data));
|
|
16
|
+
stderr && stderr.on("data", (data) => ingest.error(data));
|
|
17
|
+
close && stdout.on("close", () => ingest.done());
|
|
18
|
+
return ingest;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Specialized version of {@link fromNodeJS} for string inputs and automatic
|
|
22
|
+
* rechunking/splitting of the input using the optionally provided regexp (line
|
|
23
|
+
* breaks by default).
|
|
24
|
+
*
|
|
25
|
+
* @remarks
|
|
26
|
+
* Internally uses https://docs.thi.ng/umbrella/transducers/modules.html#rechunk
|
|
27
|
+
* to rechunk input.
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```ts
|
|
31
|
+
* import { spawn } from "child_process"
|
|
32
|
+
* import { linesFromNodeJS, trace } from "@thi.ng/rstream";
|
|
33
|
+
*
|
|
34
|
+
* const cmd = spawn("ls", ["-la"]);
|
|
35
|
+
*
|
|
36
|
+
* linesFromNodeJS<string>(cmd.stdout, cmd.stderr).subscribe(trace("output"));
|
|
37
|
+
*
|
|
38
|
+
* // output total 12760
|
|
39
|
+
* // output drwxr-xr-x 37 foo staff 1184 Nov 15 15:29 .
|
|
40
|
+
* // output drwxr-xr-x 143 foo staff 4576 Nov 11 21:08 ..
|
|
41
|
+
* // output drwxr-xr-x 17 foo staff 544 Nov 15 17:39 .git
|
|
42
|
+
* // output -rw-r--r-- 1 foo staff 149 Aug 4 15:32 .gitattributes
|
|
43
|
+
* // output drwxr-xr-x 5 foo staff 160 Apr 12 2021 .github
|
|
44
|
+
* // output -rw-r--r-- 1 foo staff 659 Sep 10 22:55 .gitignore
|
|
45
|
+
* // ...
|
|
46
|
+
* // output done
|
|
47
|
+
* ```
|
|
48
|
+
*
|
|
49
|
+
* @param stdout
|
|
50
|
+
* @param stderr
|
|
51
|
+
* @param re
|
|
52
|
+
* @param close
|
|
53
|
+
*/
|
|
54
|
+
export const linesFromNodeJS = (stdout, stderr, re, close) => (fromNodeJS(stdout, stderr, close).transform(rechunk(re)));
|
package/package.json
CHANGED
|
@@ -1,197 +1,205 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
"
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
"
|
|
67
|
-
|
|
2
|
+
"name": "@thi.ng/rstream",
|
|
3
|
+
"version": "7.2.1",
|
|
4
|
+
"description": "Reactive streams & subscription primitives for constructing dataflow graphs / pipelines",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"module": "./index.js",
|
|
7
|
+
"typings": "./index.d.ts",
|
|
8
|
+
"sideEffects": false,
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "https://github.com/thi-ng/umbrella.git"
|
|
12
|
+
},
|
|
13
|
+
"homepage": "https://github.com/thi-ng/umbrella/tree/develop/packages/rstream#readme",
|
|
14
|
+
"funding": [
|
|
15
|
+
{
|
|
16
|
+
"type": "github",
|
|
17
|
+
"url": "https://github.com/sponsors/postspectacular"
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"type": "patreon",
|
|
21
|
+
"url": "https://patreon.com/thing_umbrella"
|
|
22
|
+
}
|
|
23
|
+
],
|
|
24
|
+
"author": "Karsten Schmidt <k+npm@thi.ng>",
|
|
25
|
+
"license": "Apache-2.0",
|
|
26
|
+
"scripts": {
|
|
27
|
+
"build": "yarn clean && tsc --declaration",
|
|
28
|
+
"clean": "rimraf '*.js' '*.d.ts' '*.map' doc",
|
|
29
|
+
"doc": "typedoc --excludePrivate --excludeInternal --out doc src/index.ts",
|
|
30
|
+
"doc:ae": "mkdir -p .ae/doc .ae/temp && api-extractor run --local --verbose",
|
|
31
|
+
"doc:readme": "yarn doc:stats && tools:readme",
|
|
32
|
+
"doc:stats": "tools:module-stats",
|
|
33
|
+
"pub": "yarn npm publish --access public",
|
|
34
|
+
"test": "testament test"
|
|
35
|
+
},
|
|
36
|
+
"dependencies": {
|
|
37
|
+
"@thi.ng/api": "^8.3.3",
|
|
38
|
+
"@thi.ng/arrays": "^2.1.3",
|
|
39
|
+
"@thi.ng/associative": "^6.1.3",
|
|
40
|
+
"@thi.ng/atom": "^5.1.3",
|
|
41
|
+
"@thi.ng/checks": "^3.1.3",
|
|
42
|
+
"@thi.ng/errors": "^2.1.3",
|
|
43
|
+
"@thi.ng/logger": "^1.1.3",
|
|
44
|
+
"@thi.ng/transducers": "^8.1.3"
|
|
45
|
+
},
|
|
46
|
+
"devDependencies": {
|
|
47
|
+
"@microsoft/api-extractor": "^7.19.2",
|
|
48
|
+
"@thi.ng/testament": "^0.2.3",
|
|
49
|
+
"rimraf": "^3.0.2",
|
|
50
|
+
"tools": "^0.0.1",
|
|
51
|
+
"typedoc": "^0.22.10",
|
|
52
|
+
"typescript": "^4.5.3"
|
|
53
|
+
},
|
|
54
|
+
"keywords": [
|
|
55
|
+
"async",
|
|
56
|
+
"datastructure",
|
|
57
|
+
"event",
|
|
58
|
+
"graph",
|
|
59
|
+
"pipeline",
|
|
60
|
+
"pubsub",
|
|
61
|
+
"reactive",
|
|
62
|
+
"rstream",
|
|
63
|
+
"state",
|
|
64
|
+
"stream",
|
|
65
|
+
"subscription",
|
|
66
|
+
"transducer",
|
|
67
|
+
"transformation",
|
|
68
|
+
"typescript",
|
|
69
|
+
"webworker"
|
|
70
|
+
],
|
|
71
|
+
"publishConfig": {
|
|
72
|
+
"access": "public"
|
|
73
|
+
},
|
|
74
|
+
"engines": {
|
|
75
|
+
"node": ">=12.7"
|
|
76
|
+
},
|
|
77
|
+
"files": [
|
|
78
|
+
"*.js",
|
|
79
|
+
"*.d.ts",
|
|
80
|
+
"internal"
|
|
81
|
+
],
|
|
82
|
+
"exports": {
|
|
83
|
+
".": {
|
|
84
|
+
"import": "./index.js"
|
|
85
|
+
},
|
|
86
|
+
"./api": {
|
|
87
|
+
"import": "./api.js"
|
|
88
|
+
},
|
|
89
|
+
"./asidechain": {
|
|
90
|
+
"import": "./asidechain.js"
|
|
91
|
+
},
|
|
92
|
+
"./atom": {
|
|
93
|
+
"import": "./atom.js"
|
|
94
|
+
},
|
|
95
|
+
"./bisect": {
|
|
96
|
+
"import": "./bisect.js"
|
|
97
|
+
},
|
|
98
|
+
"./checks": {
|
|
99
|
+
"import": "./checks.js"
|
|
100
|
+
},
|
|
101
|
+
"./debounce": {
|
|
102
|
+
"import": "./debounce.js"
|
|
103
|
+
},
|
|
104
|
+
"./defworker": {
|
|
105
|
+
"import": "./defworker.js"
|
|
106
|
+
},
|
|
107
|
+
"./event": {
|
|
108
|
+
"import": "./event.js"
|
|
109
|
+
},
|
|
110
|
+
"./forkjoin": {
|
|
111
|
+
"import": "./forkjoin.js"
|
|
112
|
+
},
|
|
113
|
+
"./idgen": {
|
|
114
|
+
"import": "./idgen.js"
|
|
115
|
+
},
|
|
116
|
+
"./interval": {
|
|
117
|
+
"import": "./interval.js"
|
|
118
|
+
},
|
|
119
|
+
"./iterable": {
|
|
120
|
+
"import": "./iterable.js"
|
|
121
|
+
},
|
|
122
|
+
"./logger": {
|
|
123
|
+
"import": "./logger.js"
|
|
124
|
+
},
|
|
125
|
+
"./merge": {
|
|
126
|
+
"import": "./merge.js"
|
|
127
|
+
},
|
|
128
|
+
"./metastream": {
|
|
129
|
+
"import": "./metastream.js"
|
|
130
|
+
},
|
|
131
|
+
"./nodejs": {
|
|
132
|
+
"import": "./nodejs.js"
|
|
133
|
+
},
|
|
134
|
+
"./object": {
|
|
135
|
+
"import": "./object.js"
|
|
136
|
+
},
|
|
137
|
+
"./post-worker": {
|
|
138
|
+
"import": "./post-worker.js"
|
|
139
|
+
},
|
|
140
|
+
"./promise": {
|
|
141
|
+
"import": "./promise.js"
|
|
142
|
+
},
|
|
143
|
+
"./promises": {
|
|
144
|
+
"import": "./promises.js"
|
|
145
|
+
},
|
|
146
|
+
"./pubsub": {
|
|
147
|
+
"import": "./pubsub.js"
|
|
148
|
+
},
|
|
149
|
+
"./raf": {
|
|
150
|
+
"import": "./raf.js"
|
|
151
|
+
},
|
|
152
|
+
"./resolve": {
|
|
153
|
+
"import": "./resolve.js"
|
|
154
|
+
},
|
|
155
|
+
"./sidechain-partition": {
|
|
156
|
+
"import": "./sidechain-partition.js"
|
|
157
|
+
},
|
|
158
|
+
"./sidechain-toggle": {
|
|
159
|
+
"import": "./sidechain-toggle.js"
|
|
160
|
+
},
|
|
161
|
+
"./stream": {
|
|
162
|
+
"import": "./stream.js"
|
|
163
|
+
},
|
|
164
|
+
"./subscription": {
|
|
165
|
+
"import": "./subscription.js"
|
|
166
|
+
},
|
|
167
|
+
"./sync": {
|
|
168
|
+
"import": "./sync.js"
|
|
169
|
+
},
|
|
170
|
+
"./timeout": {
|
|
171
|
+
"import": "./timeout.js"
|
|
172
|
+
},
|
|
173
|
+
"./trace": {
|
|
174
|
+
"import": "./trace.js"
|
|
175
|
+
},
|
|
176
|
+
"./transduce": {
|
|
177
|
+
"import": "./transduce.js"
|
|
178
|
+
},
|
|
179
|
+
"./trigger": {
|
|
180
|
+
"import": "./trigger.js"
|
|
181
|
+
},
|
|
182
|
+
"./tunnel": {
|
|
183
|
+
"import": "./tunnel.js"
|
|
184
|
+
},
|
|
185
|
+
"./tween": {
|
|
186
|
+
"import": "./tween.js"
|
|
68
187
|
},
|
|
69
|
-
"
|
|
70
|
-
|
|
188
|
+
"./view": {
|
|
189
|
+
"import": "./view.js"
|
|
71
190
|
},
|
|
72
|
-
"
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
191
|
+
"./worker": {
|
|
192
|
+
"import": "./worker.js"
|
|
193
|
+
}
|
|
194
|
+
},
|
|
195
|
+
"thi.ng": {
|
|
196
|
+
"related": [
|
|
197
|
+
"atom",
|
|
198
|
+
"hdom",
|
|
199
|
+
"rdom",
|
|
200
|
+
"transducers"
|
|
76
201
|
],
|
|
77
|
-
"
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
"./api": {
|
|
82
|
-
"import": "./api.js"
|
|
83
|
-
},
|
|
84
|
-
"./asidechain": {
|
|
85
|
-
"import": "./asidechain.js"
|
|
86
|
-
},
|
|
87
|
-
"./atom": {
|
|
88
|
-
"import": "./atom.js"
|
|
89
|
-
},
|
|
90
|
-
"./bisect": {
|
|
91
|
-
"import": "./bisect.js"
|
|
92
|
-
},
|
|
93
|
-
"./checks": {
|
|
94
|
-
"import": "./checks.js"
|
|
95
|
-
},
|
|
96
|
-
"./debounce": {
|
|
97
|
-
"import": "./debounce.js"
|
|
98
|
-
},
|
|
99
|
-
"./defworker": {
|
|
100
|
-
"import": "./defworker.js"
|
|
101
|
-
},
|
|
102
|
-
"./event": {
|
|
103
|
-
"import": "./event.js"
|
|
104
|
-
},
|
|
105
|
-
"./forkjoin": {
|
|
106
|
-
"import": "./forkjoin.js"
|
|
107
|
-
},
|
|
108
|
-
"./idgen": {
|
|
109
|
-
"import": "./idgen.js"
|
|
110
|
-
},
|
|
111
|
-
"./interval": {
|
|
112
|
-
"import": "./interval.js"
|
|
113
|
-
},
|
|
114
|
-
"./iterable": {
|
|
115
|
-
"import": "./iterable.js"
|
|
116
|
-
},
|
|
117
|
-
"./logger": {
|
|
118
|
-
"import": "./logger.js"
|
|
119
|
-
},
|
|
120
|
-
"./merge": {
|
|
121
|
-
"import": "./merge.js"
|
|
122
|
-
},
|
|
123
|
-
"./metastream": {
|
|
124
|
-
"import": "./metastream.js"
|
|
125
|
-
},
|
|
126
|
-
"./object": {
|
|
127
|
-
"import": "./object.js"
|
|
128
|
-
},
|
|
129
|
-
"./post-worker": {
|
|
130
|
-
"import": "./post-worker.js"
|
|
131
|
-
},
|
|
132
|
-
"./promise": {
|
|
133
|
-
"import": "./promise.js"
|
|
134
|
-
},
|
|
135
|
-
"./promises": {
|
|
136
|
-
"import": "./promises.js"
|
|
137
|
-
},
|
|
138
|
-
"./pubsub": {
|
|
139
|
-
"import": "./pubsub.js"
|
|
140
|
-
},
|
|
141
|
-
"./raf": {
|
|
142
|
-
"import": "./raf.js"
|
|
143
|
-
},
|
|
144
|
-
"./resolve": {
|
|
145
|
-
"import": "./resolve.js"
|
|
146
|
-
},
|
|
147
|
-
"./sidechain-partition": {
|
|
148
|
-
"import": "./sidechain-partition.js"
|
|
149
|
-
},
|
|
150
|
-
"./sidechain-toggle": {
|
|
151
|
-
"import": "./sidechain-toggle.js"
|
|
152
|
-
},
|
|
153
|
-
"./stream": {
|
|
154
|
-
"import": "./stream.js"
|
|
155
|
-
},
|
|
156
|
-
"./subscription": {
|
|
157
|
-
"import": "./subscription.js"
|
|
158
|
-
},
|
|
159
|
-
"./sync": {
|
|
160
|
-
"import": "./sync.js"
|
|
161
|
-
},
|
|
162
|
-
"./timeout": {
|
|
163
|
-
"import": "./timeout.js"
|
|
164
|
-
},
|
|
165
|
-
"./trace": {
|
|
166
|
-
"import": "./trace.js"
|
|
167
|
-
},
|
|
168
|
-
"./transduce": {
|
|
169
|
-
"import": "./transduce.js"
|
|
170
|
-
},
|
|
171
|
-
"./trigger": {
|
|
172
|
-
"import": "./trigger.js"
|
|
173
|
-
},
|
|
174
|
-
"./tunnel": {
|
|
175
|
-
"import": "./tunnel.js"
|
|
176
|
-
},
|
|
177
|
-
"./tween": {
|
|
178
|
-
"import": "./tween.js"
|
|
179
|
-
},
|
|
180
|
-
"./view": {
|
|
181
|
-
"import": "./view.js"
|
|
182
|
-
},
|
|
183
|
-
"./worker": {
|
|
184
|
-
"import": "./worker.js"
|
|
185
|
-
}
|
|
186
|
-
},
|
|
187
|
-
"thi.ng": {
|
|
188
|
-
"related": [
|
|
189
|
-
"atom",
|
|
190
|
-
"hdom",
|
|
191
|
-
"rdom",
|
|
192
|
-
"transducers"
|
|
193
|
-
],
|
|
194
|
-
"year": 2017
|
|
195
|
-
},
|
|
196
|
-
"gitHead": "5fe52419af63984ebe53032201b2a6174b9cb159"
|
|
197
|
-
}
|
|
202
|
+
"year": 2017
|
|
203
|
+
},
|
|
204
|
+
"gitHead": "2db9dd34c0c2c60cbfde3dad0bca352b20292f5c\n"
|
|
205
|
+
}
|
package/promises.d.ts
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import type { ISubscription, WithErrorHandlerOpts } from "./api.js";
|
|
2
2
|
/**
|
|
3
|
-
* Wraps given iterable in `Promise.all()` to yield {@link Stream} of
|
|
4
|
-
*
|
|
3
|
+
* Wraps given iterable in `Promise.all()` to yield {@link Stream} of results in
|
|
4
|
+
* same order as arguments, then closes.
|
|
5
5
|
*
|
|
6
6
|
* @remarks
|
|
7
|
-
* If any of the promises rejects, all others will do so too. In this
|
|
8
|
-
*
|
|
9
|
-
*
|
|
7
|
+
* If any of the promises rejects, all others will do so too. In this case the
|
|
8
|
+
* stream calls {@link ISubscriber.error} in all of its subscribers.
|
|
9
|
+
*
|
|
10
|
+
* @remarks
|
|
11
|
+
* Type signature updated to use `Awaited<T>`, a new core type introduced in
|
|
12
|
+
* TypeScript 4.5.
|
|
10
13
|
*
|
|
11
14
|
* @example
|
|
12
15
|
* ```ts
|
|
@@ -36,5 +39,5 @@ import type { ISubscription, WithErrorHandlerOpts } from "./api.js";
|
|
|
36
39
|
* @param promises -
|
|
37
40
|
* @param opts -
|
|
38
41
|
*/
|
|
39
|
-
export declare const fromPromises: <T>(promises: Iterable<T | PromiseLike<T>>, opts?: Partial<WithErrorHandlerOpts> | undefined) => ISubscription<T[], T
|
|
42
|
+
export declare const fromPromises: <T>(promises: Iterable<T | PromiseLike<T>>, opts?: Partial<WithErrorHandlerOpts> | undefined) => ISubscription<Awaited<T>[], Awaited<T>>;
|
|
40
43
|
//# sourceMappingURL=promises.d.ts.map
|
package/promises.js
CHANGED
|
@@ -2,13 +2,16 @@ import { mapcat } from "@thi.ng/transducers/mapcat";
|
|
|
2
2
|
import { __optsWithID } from "./idgen.js";
|
|
3
3
|
import { fromPromise } from "./promise.js";
|
|
4
4
|
/**
|
|
5
|
-
* Wraps given iterable in `Promise.all()` to yield {@link Stream} of
|
|
6
|
-
*
|
|
5
|
+
* Wraps given iterable in `Promise.all()` to yield {@link Stream} of results in
|
|
6
|
+
* same order as arguments, then closes.
|
|
7
7
|
*
|
|
8
8
|
* @remarks
|
|
9
|
-
* If any of the promises rejects, all others will do so too. In this
|
|
10
|
-
*
|
|
11
|
-
*
|
|
9
|
+
* If any of the promises rejects, all others will do so too. In this case the
|
|
10
|
+
* stream calls {@link ISubscriber.error} in all of its subscribers.
|
|
11
|
+
*
|
|
12
|
+
* @remarks
|
|
13
|
+
* Type signature updated to use `Awaited<T>`, a new core type introduced in
|
|
14
|
+
* TypeScript 4.5.
|
|
12
15
|
*
|
|
13
16
|
* @example
|
|
14
17
|
* ```ts
|
package/tunnel.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import type { Fn } from "@thi.ng/api";
|
|
1
|
+
import type { Fn, Fn0 } from "@thi.ng/api";
|
|
2
2
|
import { Subscription } from "./subscription.js";
|
|
3
3
|
export interface TunnelOpts<A> {
|
|
4
4
|
/**
|
|
5
5
|
* Tunnelled worker instance, source blob or script URL.
|
|
6
6
|
* If `interrupt` is enabled, the worker MUST be given as blob or URL.
|
|
7
7
|
*/
|
|
8
|
-
src: Worker | Blob | string
|
|
8
|
+
src: Worker | Blob | string | Fn0<Worker>;
|
|
9
9
|
/**
|
|
10
10
|
* Max. number of worker instances to use. Only useful if
|
|
11
11
|
* `interrupt` is disabled. If more than one worker is used,
|
|
@@ -62,7 +62,7 @@ export declare const tunnel: <A, B>(opts: TunnelOpts<A>) => Tunnel<A, B>;
|
|
|
62
62
|
*/
|
|
63
63
|
export declare class Tunnel<A, B> extends Subscription<A, B> {
|
|
64
64
|
workers: Worker[];
|
|
65
|
-
src: Worker | Blob | string
|
|
65
|
+
src: Worker | Blob | string | Fn0<Worker>;
|
|
66
66
|
transferables?: Fn<A, any[]>;
|
|
67
67
|
terminate: number;
|
|
68
68
|
interrupt: boolean;
|