@thi.ng/rstream 9.3.7 → 9.3.9
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/internal/remove.js +1 -1
- package/iterable.js +1 -1
- package/merge.js +4 -4
- package/object.js +4 -4
- package/package.json +10 -10
- package/pubsub.js +2 -2
- package/sync.js +6 -6
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
[](https://mastodon.thi.ng/@toxi)
|
|
8
8
|
|
|
9
9
|
> [!NOTE]
|
|
10
|
-
> This is one of
|
|
10
|
+
> This is one of 211 standalone projects, maintained as part
|
|
11
11
|
> of the [@thi.ng/umbrella](https://github.com/thi-ng/umbrella/) monorepo
|
|
12
12
|
> and anti-framework.
|
|
13
13
|
>
|
package/internal/remove.js
CHANGED
package/iterable.js
CHANGED
|
@@ -14,7 +14,7 @@ const fromIterable = (src, opts = {}) => stream((stream2) => {
|
|
|
14
14
|
return () => clearInterval(id);
|
|
15
15
|
}, __optsWithID("iterable", opts));
|
|
16
16
|
const fromIterableSync = (src, opts) => stream((stream2) => {
|
|
17
|
-
for (
|
|
17
|
+
for (const s of src) {
|
|
18
18
|
stream2.next(s);
|
|
19
19
|
}
|
|
20
20
|
stream2.closeIn !== "never" && stream2.done();
|
package/merge.js
CHANGED
|
@@ -29,7 +29,7 @@ class StreamMerge extends Subscription {
|
|
|
29
29
|
);
|
|
30
30
|
}
|
|
31
31
|
addAll(src) {
|
|
32
|
-
for (
|
|
32
|
+
for (const s of src) {
|
|
33
33
|
this.add(s);
|
|
34
34
|
}
|
|
35
35
|
}
|
|
@@ -43,7 +43,7 @@ class StreamMerge extends Subscription {
|
|
|
43
43
|
return false;
|
|
44
44
|
}
|
|
45
45
|
removeID(id) {
|
|
46
|
-
for (
|
|
46
|
+
for (const s of this.sources) {
|
|
47
47
|
if (s[0].id === id) {
|
|
48
48
|
return this.remove(s[0]);
|
|
49
49
|
}
|
|
@@ -52,7 +52,7 @@ class StreamMerge extends Subscription {
|
|
|
52
52
|
}
|
|
53
53
|
removeAll(src) {
|
|
54
54
|
let ok = true;
|
|
55
|
-
for (
|
|
55
|
+
for (const s of src) {
|
|
56
56
|
ok = this.remove(s) && ok;
|
|
57
57
|
}
|
|
58
58
|
return ok;
|
|
@@ -62,7 +62,7 @@ class StreamMerge extends Subscription {
|
|
|
62
62
|
}
|
|
63
63
|
unsubscribe(sub) {
|
|
64
64
|
if (!sub) {
|
|
65
|
-
for (
|
|
65
|
+
for (const s of this.sources.values()) {
|
|
66
66
|
s.unsubscribe();
|
|
67
67
|
}
|
|
68
68
|
this.state = State.DONE;
|
package/object.js
CHANGED
|
@@ -19,7 +19,7 @@ class StreamObj extends Subscription {
|
|
|
19
19
|
xform: dedupe(opts.equiv || ((a, b) => a === b)),
|
|
20
20
|
...opts
|
|
21
21
|
} : opts;
|
|
22
|
-
for (
|
|
22
|
+
for (const k of this.keys) {
|
|
23
23
|
this.streams[k] = subscription(void 0, {
|
|
24
24
|
..._opts,
|
|
25
25
|
id: `${this.id}-${k}`
|
|
@@ -40,7 +40,7 @@ class StreamObj extends Subscription {
|
|
|
40
40
|
*/
|
|
41
41
|
next(x) {
|
|
42
42
|
this.cacheLast && (this.last = x);
|
|
43
|
-
for (
|
|
43
|
+
for (const k of this.keys) {
|
|
44
44
|
const val = x[k];
|
|
45
45
|
this.streams[k].next(
|
|
46
46
|
this.defaults && val === void 0 ? this.defaults[k] : val
|
|
@@ -49,14 +49,14 @@ class StreamObj extends Subscription {
|
|
|
49
49
|
super.next(x);
|
|
50
50
|
}
|
|
51
51
|
done() {
|
|
52
|
-
for (
|
|
52
|
+
for (const k of this.keys) {
|
|
53
53
|
this.streams[k].done?.();
|
|
54
54
|
}
|
|
55
55
|
super.done();
|
|
56
56
|
}
|
|
57
57
|
unsubscribe(sub) {
|
|
58
58
|
if (!sub) {
|
|
59
|
-
for (
|
|
59
|
+
for (const k of this.keys) {
|
|
60
60
|
this.streams[k].unsubscribe();
|
|
61
61
|
}
|
|
62
62
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thi.ng/rstream",
|
|
3
|
-
"version": "9.3.
|
|
3
|
+
"version": "9.3.9",
|
|
4
4
|
"description": "Reactive streams & subscription primitives for constructing dataflow graphs / pipelines",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -43,14 +43,14 @@
|
|
|
43
43
|
"tool:tangle": "../../node_modules/.bin/tangle src/**/*.ts"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@thi.ng/api": "^8.12.
|
|
47
|
-
"@thi.ng/arrays": "^2.14.
|
|
48
|
-
"@thi.ng/associative": "^7.1.
|
|
49
|
-
"@thi.ng/atom": "^5.3.
|
|
50
|
-
"@thi.ng/checks": "^3.
|
|
51
|
-
"@thi.ng/errors": "^2.5.
|
|
52
|
-
"@thi.ng/logger": "^3.2.
|
|
53
|
-
"@thi.ng/transducers": "^9.6.
|
|
46
|
+
"@thi.ng/api": "^8.12.10",
|
|
47
|
+
"@thi.ng/arrays": "^2.14.3",
|
|
48
|
+
"@thi.ng/associative": "^7.1.22",
|
|
49
|
+
"@thi.ng/atom": "^5.3.51",
|
|
50
|
+
"@thi.ng/checks": "^3.8.0",
|
|
51
|
+
"@thi.ng/errors": "^2.5.50",
|
|
52
|
+
"@thi.ng/logger": "^3.2.9",
|
|
53
|
+
"@thi.ng/transducers": "^9.6.19"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
56
|
"@types/node": "^24.10.1",
|
|
@@ -222,5 +222,5 @@
|
|
|
222
222
|
],
|
|
223
223
|
"year": 2017
|
|
224
224
|
},
|
|
225
|
-
"gitHead": "
|
|
225
|
+
"gitHead": "8625a1c6383737a8fdbe7a3f96ea3cbabc957fa6\n"
|
|
226
226
|
}
|
package/pubsub.js
CHANGED
|
@@ -58,7 +58,7 @@ class PubSub extends Subscription {
|
|
|
58
58
|
}
|
|
59
59
|
unsubscribe(sub) {
|
|
60
60
|
if (!sub) {
|
|
61
|
-
for (
|
|
61
|
+
for (const t of this.topics.values()) {
|
|
62
62
|
t.unsubscribe();
|
|
63
63
|
}
|
|
64
64
|
this.topics.clear();
|
|
@@ -67,7 +67,7 @@ class PubSub extends Subscription {
|
|
|
67
67
|
return unsupported();
|
|
68
68
|
}
|
|
69
69
|
done() {
|
|
70
|
-
for (
|
|
70
|
+
for (const t of this.topics.values()) {
|
|
71
71
|
t.done();
|
|
72
72
|
}
|
|
73
73
|
super.done();
|
package/sync.js
CHANGED
|
@@ -76,10 +76,10 @@ class StreamSync extends Subscription {
|
|
|
76
76
|
);
|
|
77
77
|
}
|
|
78
78
|
addAll(src) {
|
|
79
|
-
for (
|
|
79
|
+
for (const id in src) {
|
|
80
80
|
this.psync.add(id);
|
|
81
81
|
}
|
|
82
|
-
for (
|
|
82
|
+
for (const id in src) {
|
|
83
83
|
this.add(src[id], id);
|
|
84
84
|
}
|
|
85
85
|
}
|
|
@@ -103,11 +103,11 @@ class StreamSync extends Subscription {
|
|
|
103
103
|
return src ? this.remove(src) : false;
|
|
104
104
|
}
|
|
105
105
|
removeAll(src) {
|
|
106
|
-
for (
|
|
106
|
+
for (const s of src) {
|
|
107
107
|
this.psync.delete(this.invRealSourceIDs.get(s.id));
|
|
108
108
|
}
|
|
109
109
|
let ok = true;
|
|
110
|
-
for (
|
|
110
|
+
for (const s of src) {
|
|
111
111
|
ok = this.remove(s) && ok;
|
|
112
112
|
}
|
|
113
113
|
return ok;
|
|
@@ -120,7 +120,7 @@ class StreamSync extends Subscription {
|
|
|
120
120
|
}
|
|
121
121
|
getSources() {
|
|
122
122
|
const res = {};
|
|
123
|
-
for (
|
|
123
|
+
for (const [id, src] of this.idSources) {
|
|
124
124
|
res[this.invRealSourceIDs.get(id)] = src;
|
|
125
125
|
}
|
|
126
126
|
return res;
|
|
@@ -128,7 +128,7 @@ class StreamSync extends Subscription {
|
|
|
128
128
|
unsubscribe(sub) {
|
|
129
129
|
if (!sub) {
|
|
130
130
|
LOGGER.debug(this.id, "unsub sources");
|
|
131
|
-
for (
|
|
131
|
+
for (const s of this.sources.values()) {
|
|
132
132
|
s.unsubscribe();
|
|
133
133
|
}
|
|
134
134
|
this.sources.clear();
|