@wireapp/core 27.2.3 → 27.3.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
CHANGED
|
@@ -3,6 +3,33 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [27.3.1](https://github.com/wireapp/wire-web-packages/tree/main/packages/core/compare/@wireapp/core@27.3.0...@wireapp/core@27.3.1) (2022-06-03)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @wireapp/core
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
# [27.3.0](https://github.com/wireapp/wire-web-packages/tree/main/packages/core/compare/@wireapp/core@27.2.4...@wireapp/core@27.3.0) (2022-06-03)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Features
|
|
18
|
+
|
|
19
|
+
* Add listen dryrun option ([#4282](https://github.com/wireapp/wire-web-packages/tree/main/packages/core/issues/4282)) ([a10bbe1](https://github.com/wireapp/wire-web-packages/tree/main/packages/core/commit/a10bbe14f1967a85d38444ed3e745f57c6504e9e))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
## [27.2.4](https://github.com/wireapp/wire-web-packages/tree/main/packages/core/compare/@wireapp/core@27.2.3...@wireapp/core@27.2.4) (2022-06-01)
|
|
26
|
+
|
|
27
|
+
**Note:** Version bump only for package @wireapp/core
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
6
33
|
## [27.2.3](https://github.com/wireapp/wire-web-packages/tree/main/packages/core/compare/@wireapp/core@27.2.2...@wireapp/core@27.2.3) (2022-05-31)
|
|
7
34
|
|
|
8
35
|
**Note:** Version bump only for package @wireapp/core
|
package/package.json
CHANGED
|
@@ -5,14 +5,14 @@
|
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@types/long": "4.0.1",
|
|
7
7
|
"@types/node": "~14",
|
|
8
|
-
"@wireapp/api-client": "19.
|
|
8
|
+
"@wireapp/api-client": "19.4.0",
|
|
9
9
|
"@wireapp/cryptobox": "12.8.0",
|
|
10
10
|
"bazinga64": "5.10.0",
|
|
11
11
|
"hash.js": "1.1.7",
|
|
12
12
|
"http-status-codes": "2.1.4",
|
|
13
13
|
"logdown": "3.3.1",
|
|
14
14
|
"long": "4.0.0",
|
|
15
|
-
"protobufjs": "6.11.
|
|
15
|
+
"protobufjs": "6.11.3",
|
|
16
16
|
"uuidjs": "4.2.8"
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
@@ -69,6 +69,6 @@
|
|
|
69
69
|
"test:project": "yarn dist && yarn test",
|
|
70
70
|
"test:node": "nyc jasmine --config=jasmine.json"
|
|
71
71
|
},
|
|
72
|
-
"version": "27.
|
|
73
|
-
"gitHead": "
|
|
72
|
+
"version": "27.3.1",
|
|
73
|
+
"gitHead": "c99307f4d8a8b5e2373b204dbca151415648042c"
|
|
74
74
|
}
|
package/src/main/Account.d.ts
CHANGED
|
@@ -150,7 +150,7 @@ export declare class Account extends EventEmitter {
|
|
|
150
150
|
* @param callbacks callbacks that will be called to handle different events
|
|
151
151
|
* @returns close a function that will disconnect from the websocket
|
|
152
152
|
*/
|
|
153
|
-
listen({ onEvent, onConnected, onConnectionStateChanged, onNotificationStreamProgress, onMissedNotifications, }?: {
|
|
153
|
+
listen({ onEvent, onConnected, onConnectionStateChanged, onNotificationStreamProgress, onMissedNotifications, dryRun, }?: {
|
|
154
154
|
/**
|
|
155
155
|
* Called when a new event arrives from backend
|
|
156
156
|
* @param payload the payload of the event. Contains the raw event received and the decrypted data (if event was encrypted)
|
|
@@ -180,6 +180,10 @@ export declare class Account extends EventEmitter {
|
|
|
180
180
|
* @param {string} notificationId
|
|
181
181
|
*/
|
|
182
182
|
onMissedNotifications?: (notificationId: string) => void;
|
|
183
|
+
/**
|
|
184
|
+
* When set will not decrypt and not store the last notification ID. This is useful if you only want to subscribe to unencrypted backend events
|
|
185
|
+
*/
|
|
186
|
+
dryRun?: boolean;
|
|
183
187
|
}): Promise<() => void>;
|
|
184
188
|
private initEngine;
|
|
185
189
|
}
|
package/src/main/Account.js
CHANGED
|
@@ -284,7 +284,7 @@ class Account extends events_1.EventEmitter {
|
|
|
284
284
|
* @param callbacks callbacks that will be called to handle different events
|
|
285
285
|
* @returns close a function that will disconnect from the websocket
|
|
286
286
|
*/
|
|
287
|
-
async listen({ onEvent = () => { }, onConnected = () => { }, onConnectionStateChanged = () => { }, onNotificationStreamProgress = () => { }, onMissedNotifications = () => { }, } = {}) {
|
|
287
|
+
async listen({ onEvent = () => { }, onConnected = () => { }, onConnectionStateChanged = () => { }, onNotificationStreamProgress = () => { }, onMissedNotifications = () => { }, dryRun = false, } = {}) {
|
|
288
288
|
if (!this.apiClient.context) {
|
|
289
289
|
throw new Error('Context is not set - please login first');
|
|
290
290
|
}
|
|
@@ -306,7 +306,7 @@ class Account extends events_1.EventEmitter {
|
|
|
306
306
|
const handleNotification = async (notification, source) => {
|
|
307
307
|
var e_1, _a;
|
|
308
308
|
try {
|
|
309
|
-
const messages = this.service.notification.handleNotification(notification, conversation_1.PayloadBundleSource.WEBSOCKET);
|
|
309
|
+
const messages = this.service.notification.handleNotification(notification, conversation_1.PayloadBundleSource.WEBSOCKET, dryRun);
|
|
310
310
|
try {
|
|
311
311
|
for (var messages_1 = __asyncValues(messages), messages_1_1; messages_1_1 = await messages_1.next(), !messages_1_1.done;) {
|
|
312
312
|
const message = messages_1_1.value;
|
|
@@ -43,7 +43,7 @@ export declare class NotificationService extends EventEmitter {
|
|
|
43
43
|
setLastEventDate(eventDate: Date): Promise<Date>;
|
|
44
44
|
setLastNotificationId(lastNotification: Notification): Promise<string>;
|
|
45
45
|
handleNotificationStream(notificationHandler: NotificationHandler, onMissedNotifications: (notificationId: string) => void): Promise<void>;
|
|
46
|
-
handleNotification(notification: Notification, source: PayloadBundleSource): AsyncGenerator<HandledEventPayload>;
|
|
46
|
+
handleNotification(notification: Notification, source: PayloadBundleSource, dryRun?: boolean): AsyncGenerator<HandledEventPayload>;
|
|
47
47
|
private cleanupPayloadBundle;
|
|
48
48
|
private handleEvent;
|
|
49
49
|
}
|
|
@@ -130,16 +130,12 @@ class NotificationService extends events_1.EventEmitter {
|
|
|
130
130
|
}).catch(error => this.logger.error(error));
|
|
131
131
|
}
|
|
132
132
|
}
|
|
133
|
-
handleNotification(notification, source) {
|
|
133
|
+
handleNotification(notification, source, dryRun = false) {
|
|
134
134
|
return __asyncGenerator(this, arguments, function* handleNotification_1() {
|
|
135
135
|
for (const event of notification.payload) {
|
|
136
136
|
this.logger.log(`Handling event of type "${event.type}" for notification with ID "${notification.id}"`, event);
|
|
137
137
|
try {
|
|
138
|
-
const data = yield __await(this.handleEvent(event, source));
|
|
139
|
-
if (!notification.transient) {
|
|
140
|
-
// keep track of the last handled notification for next time we fetch the notification stream
|
|
141
|
-
yield __await(this.setLastNotificationId(notification));
|
|
142
|
-
}
|
|
138
|
+
const data = yield __await(this.handleEvent(event, source, dryRun));
|
|
143
139
|
yield yield __await(Object.assign(Object.assign({}, data), { mappedEvent: data.mappedEvent ? this.cleanupPayloadBundle(data.mappedEvent) : undefined }));
|
|
144
140
|
}
|
|
145
141
|
catch (error) {
|
|
@@ -152,7 +148,7 @@ class NotificationService extends events_1.EventEmitter {
|
|
|
152
148
|
this.emit(NotificationService.TOPIC.NOTIFICATION_ERROR, notificationError);
|
|
153
149
|
}
|
|
154
150
|
}
|
|
155
|
-
if (!notification.transient) {
|
|
151
|
+
if (!dryRun && !notification.transient) {
|
|
156
152
|
// keep track of the last handled notification for next time we fetch the notification stream
|
|
157
153
|
yield __await(this.setLastNotificationId(notification));
|
|
158
154
|
}
|
|
@@ -176,10 +172,15 @@ class NotificationService extends events_1.EventEmitter {
|
|
|
176
172
|
return payload;
|
|
177
173
|
}
|
|
178
174
|
}
|
|
179
|
-
async handleEvent(event, source) {
|
|
175
|
+
async handleEvent(event, source, dryRun = false) {
|
|
180
176
|
switch (event.type) {
|
|
181
177
|
// Encrypted events
|
|
182
178
|
case Events.CONVERSATION_EVENT.OTR_MESSAGE_ADD: {
|
|
179
|
+
if (dryRun) {
|
|
180
|
+
// In case of a dry run, we do not want to decrypt messages
|
|
181
|
+
// We just return the raw event to the caller
|
|
182
|
+
return { event };
|
|
183
|
+
}
|
|
183
184
|
try {
|
|
184
185
|
const decryptedData = await this.cryptographyService.decryptMessage(event);
|
|
185
186
|
return {
|