@cascateer/core 2.2.4 → 2.2.5

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/multicast.ts +19 -27
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cascateer/core",
3
- "version": "2.2.4",
3
+ "version": "2.2.5",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/cascateer/core.git"
package/src/multicast.ts CHANGED
@@ -6,7 +6,6 @@ import {
6
6
  mergeMap,
7
7
  Observable,
8
8
  partition,
9
- tap,
10
9
  } from "rxjs";
11
10
  import { v4 } from "uuid";
12
11
  import { nonNullable } from "./lib";
@@ -72,33 +71,26 @@ const actions = proxyReplaySubject<
72
71
  self.addEventListener("connect", ({ ports }) => {
73
72
  for (const port of ports) {
74
73
  actions.next(
75
- proxyReplaySubject<
76
- [MulticastConnectMessage<any>, MulticastActionMessage<any>]
77
- >((sliceActions) =>
78
- actions.pipe(
79
- flatMap(({ ports, action: { origin, ...message } }) =>
80
- ports.includes(port) && (!message.sameOrigin || origin === port)
81
- ? message
82
- : [],
83
- ),
84
- sequence(([action, previousAction]) =>
85
- action.type === "seedAction"
86
- ? action
87
- : {
88
- ...action,
89
- previousId: nonNullable(previousAction).id,
90
- },
91
- ),
92
- exchangeWith<MulticastClientMessage, MulticastActionMessage<any>>(
93
- port,
94
- ),
95
- map((event) => ({ ...event, origin: port })),
96
- (messages) =>
97
- combineLatest(
98
- partition(messages, (message) => message.type === "connect"),
99
- ),
100
- tap(sliceActions),
74
+ actions.pipe(
75
+ flatMap(({ ports, action: { origin, ...message } }) =>
76
+ ports.includes(port) && (!message.sameOrigin || origin === port)
77
+ ? message
78
+ : [],
79
+ ),
80
+ sequence(([action, previousAction]) =>
81
+ action.type === "seedAction"
82
+ ? action
83
+ : {
84
+ ...action,
85
+ previousId: nonNullable(previousAction).id,
86
+ },
101
87
  ),
88
+ exchangeWith<MulticastClientMessage, MulticastActionMessage<any>>(port),
89
+ map((event) => ({ ...event, origin: port })),
90
+ (messages) =>
91
+ combineLatest(
92
+ partition(messages, (message) => message.type === "connect"),
93
+ ),
102
94
  ),
103
95
  );
104
96
  }