equipped 4.1.1 → 4.1.2
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 +2 -0
- package/lib/listeners/emitter.d.ts +3 -3
- package/lib/listeners/emitter.js +11 -9
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
### [4.1.2](https://github.com/kevinand11/equipped/compare/v4.1.1...v4.1.2) (2023-03-11)
|
|
6
|
+
|
|
5
7
|
### [4.1.1](https://github.com/kevinand11/equipped/compare/v4.1.0...v4.1.1) (2023-03-10)
|
|
6
8
|
|
|
7
9
|
## [4.1.0](https://github.com/kevinand11/equipped/compare/v4.0.2-alpha.3...v4.1.0) (2023-03-07)
|
|
@@ -13,9 +13,9 @@ export declare class Listener {
|
|
|
13
13
|
#private;
|
|
14
14
|
constructor(socket: io.Server, callers: SocketCallers);
|
|
15
15
|
start(): Promise<void>;
|
|
16
|
-
created(
|
|
17
|
-
updated(
|
|
18
|
-
deleted(
|
|
16
|
+
created(channels: string[], data: BaseEntity): Promise<void>;
|
|
17
|
+
updated(channels: string[], data: BaseEntity): Promise<void>;
|
|
18
|
+
deleted(channels: string[], data: BaseEntity): Promise<void>;
|
|
19
19
|
set callers(callers: SocketCallers);
|
|
20
20
|
register(channel: string, onJoin?: OnJoinFn): this;
|
|
21
21
|
}
|
package/lib/listeners/emitter.js
CHANGED
|
@@ -100,14 +100,14 @@ class Listener {
|
|
|
100
100
|
async start() {
|
|
101
101
|
await __classPrivateFieldGet(this, _Listener_subscriber, "f").subscribe();
|
|
102
102
|
}
|
|
103
|
-
async created(
|
|
104
|
-
await __classPrivateFieldGet(this, _Listener_instances, "m", _Listener_emit).call(this,
|
|
103
|
+
async created(channels, data) {
|
|
104
|
+
await __classPrivateFieldGet(this, _Listener_instances, "m", _Listener_emit).call(this, channels, EmitTypes.created, data);
|
|
105
105
|
}
|
|
106
|
-
async updated(
|
|
107
|
-
await __classPrivateFieldGet(this, _Listener_instances, "m", _Listener_emit).call(this,
|
|
106
|
+
async updated(channels, data) {
|
|
107
|
+
await __classPrivateFieldGet(this, _Listener_instances, "m", _Listener_emit).call(this, channels, EmitTypes.updated, data);
|
|
108
108
|
}
|
|
109
|
-
async deleted(
|
|
110
|
-
await __classPrivateFieldGet(this, _Listener_instances, "m", _Listener_emit).call(this,
|
|
109
|
+
async deleted(channels, data) {
|
|
110
|
+
await __classPrivateFieldGet(this, _Listener_instances, "m", _Listener_emit).call(this, channels, EmitTypes.deleted, data);
|
|
111
111
|
}
|
|
112
112
|
set callers(callers) {
|
|
113
113
|
__classPrivateFieldSet(this, _Listener_callers, callers, "f");
|
|
@@ -134,7 +134,9 @@ _Listener_socket = new WeakMap(), _Listener_callers = new WeakMap(), _Listener_r
|
|
|
134
134
|
onJoin: __classPrivateFieldGet(this, _Listener_routes, "f")[matchedChannel],
|
|
135
135
|
params: JSON.parse(JSON.stringify(match.params))
|
|
136
136
|
};
|
|
137
|
-
}, _Listener_emit = async function _Listener_emit(
|
|
138
|
-
|
|
139
|
-
|
|
137
|
+
}, _Listener_emit = async function _Listener_emit(channels, type, data) {
|
|
138
|
+
await Promise.all(channels.map(async (channel) => {
|
|
139
|
+
const emitData = { channel, type, data };
|
|
140
|
+
await __classPrivateFieldGet(this, _Listener_publisher, "f").publish(emitData);
|
|
141
|
+
}));
|
|
140
142
|
};
|