@wireapp/core 32.0.7 → 32.0.8

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/package.json CHANGED
@@ -43,13 +43,14 @@
43
43
  "jest": "29.0.3",
44
44
  "jest-babel": "1.0.1",
45
45
  "jest-jasmine2": "29.0.3",
46
+ "jest-websocket-mock": "2.4.0",
46
47
  "karma": "6.4.1",
47
48
  "karma-chrome-launcher": "3.1.1",
48
49
  "karma-jasmine": "4.0.2",
49
50
  "karma-jasmine-diff-reporter": "2.0.1",
50
51
  "karma-sourcemap-loader": "0.3.8",
51
52
  "karma-spec-reporter": "0.0.34",
52
- "mock-socket": "9.0.3",
53
+ "mock-socket": "9.1.5",
53
54
  "nock": "13.1.1",
54
55
  "nyc": "15.1.0",
55
56
  "rimraf": "3.0.2",
@@ -81,6 +82,6 @@
81
82
  "test": "jest",
82
83
  "watch": "tsc ---watch"
83
84
  },
84
- "version": "32.0.7",
85
- "gitHead": "b8b83908d9516f9dc79e8e7591c0401618956caf"
85
+ "version": "32.0.8",
86
+ "gitHead": "9b39965aa991efec2376de9b40118be153d803f6"
86
87
  }
@@ -211,7 +211,7 @@ export declare class Account<T = any> extends EventEmitter {
211
211
  * 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
212
212
  */
213
213
  dryRun?: boolean;
214
- }): Promise<() => void>;
214
+ }): () => void;
215
215
  private generateDbName;
216
216
  private generateSecretsDbName;
217
217
  private initEngine;
@@ -377,7 +377,7 @@ class Account extends events_1.EventEmitter {
377
377
  * @param callbacks callbacks that will be called to handle different events
378
378
  * @returns close a function that will disconnect from the websocket
379
379
  */
380
- async listen({ onEvent = () => { }, onConnectionStateChanged = () => { }, onNotificationStreamProgress = () => { }, onMissedNotifications = () => { }, dryRun = false, } = {}) {
380
+ listen({ onEvent = () => { }, onConnectionStateChanged = () => { }, onNotificationStreamProgress = () => { }, onMissedNotifications = () => { }, dryRun = false, } = {}) {
381
381
  if (!this.apiClient.context) {
382
382
  throw new Error('Context is not set - please login first');
383
383
  }
@@ -432,8 +432,8 @@ class Account extends events_1.EventEmitter {
432
432
  });
433
433
  const processNotificationStream = async (abortHandler) => {
434
434
  // Lock websocket in order to buffer any message that arrives while we handle the notification stream
435
- onConnectionStateChanged(ConnectionState.PROCESSING_NOTIFICATIONS);
436
435
  this.apiClient.transport.ws.lock();
436
+ onConnectionStateChanged(ConnectionState.PROCESSING_NOTIFICATIONS);
437
437
  const results = await this.service.notification.processNotificationStream(async (notification, source, progress) => {
438
438
  await handleNotification(notification, source);
439
439
  onNotificationStreamProgress(progress);
@@ -443,13 +443,13 @@ class Account extends events_1.EventEmitter {
443
443
  this.logger.warn('Ending connection process as websocket was closed');
444
444
  return;
445
445
  }
446
+ onConnectionStateChanged(ConnectionState.LIVE);
446
447
  // We can now unlock the websocket and let the new messages being handled and decrypted
447
448
  this.apiClient.transport.ws.unlock();
448
449
  // We need to wait for the notification stream to be fully handled before releasing the message sending queue.
449
450
  // This is due to the nature of how message are encrypted, any change in mls epoch needs to happen before we start encrypting any kind of messages
450
451
  this.logger.info(`Resuming message sending. ${(0, messageSender_1.getQueueLength)()} messages to be sent`);
451
452
  (0, messageSender_1.resumeMessageSending)();
452
- onConnectionStateChanged(ConnectionState.LIVE);
453
453
  };
454
454
  this.apiClient.connect(processNotificationStream);
455
455
  return () => {