@wireapp/core 30.5.0 → 30.6.0

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,38 @@
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
+ # [30.6.0](https://github.com/wireapp/wire-web-packages/tree/main/packages/core/compare/@wireapp/core@30.5.2...@wireapp/core@30.6.0) (2022-09-13)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * restore initial getAllParticipantsClients ([#4388](https://github.com/wireapp/wire-web-packages/tree/main/packages/core/issues/4388)) ([614b908](https://github.com/wireapp/wire-web-packages/tree/main/packages/core/commit/614b908e2a2410c4d6cb1510bd66d03d0d609c84))
12
+
13
+
14
+ ### Features
15
+
16
+ * add fetchAllParticipantsClients method for MLS conversations ([#4389](https://github.com/wireapp/wire-web-packages/tree/main/packages/core/issues/4389)) ([e3e0a3d](https://github.com/wireapp/wire-web-packages/tree/main/packages/core/commit/e3e0a3d00ce52d3ff9f2637f8e0ca655551a23fd))
17
+
18
+
19
+
20
+
21
+
22
+ ## [30.5.2](https://github.com/wireapp/wire-web-packages/tree/main/packages/core/compare/@wireapp/core@30.5.1...@wireapp/core@30.5.2) (2022-09-12)
23
+
24
+ **Note:** Version bump only for package @wireapp/core
25
+
26
+
27
+
28
+
29
+
30
+ ## [30.5.1](https://github.com/wireapp/wire-web-packages/tree/main/packages/core/compare/@wireapp/core@30.5.0...@wireapp/core@30.5.1) (2022-09-12)
31
+
32
+ **Note:** Version bump only for package @wireapp/core
33
+
34
+
35
+
36
+
37
+
6
38
  # [30.5.0](https://github.com/wireapp/wire-web-packages/tree/main/packages/core/compare/@wireapp/core@30.4.1...@wireapp/core@30.5.0) (2022-09-09)
7
39
 
8
40
 
package/package.json CHANGED
@@ -7,7 +7,7 @@
7
7
  "@otak/core-crypto": "0.3.0-es2017",
8
8
  "@types/long": "4.0.1",
9
9
  "@types/node": "~14",
10
- "@wireapp/api-client": "20.2.1",
10
+ "@wireapp/api-client": "20.3.0",
11
11
  "@wireapp/commons": "4.3.0",
12
12
  "@wireapp/cryptobox": "12.8.0",
13
13
  "@wireapp/store-engine-dexie": "1.6.10",
@@ -77,6 +77,6 @@
77
77
  "test:node": "nyc jasmine --config=jasmine.json",
78
78
  "watch": "tsc ---watch"
79
79
  },
80
- "version": "30.5.0",
81
- "gitHead": "a2a55f074ebfb3fe5e3a32df1153a9c1ae7091dd"
80
+ "version": "30.6.0",
81
+ "gitHead": "d440686b77284f831240e66ee649dac346fe2ccc"
82
82
  }
@@ -92,10 +92,22 @@ export declare class ConversationService {
92
92
  })>;
93
93
  /**
94
94
  * Get a fresh list from backend of clients for all the participants of the conversation.
95
+ * This is a hacky way of getting all the clients for a conversation.
96
+ * The idea is to send an empty message to the backend to absolutely no users and let backend reply with a mismatch error.
97
+ * We then get the missing members in the mismatch, that is our fresh list of participants' clients.
98
+ *
99
+ * @deprecated
95
100
  * @param {string} conversationId
96
101
  * @param {string} conversationDomain? - If given will send the message to the new qualified endpoint
97
102
  */
98
103
  getAllParticipantsClients(conversationId: string, conversationDomain?: string): Promise<UserClients | QualifiedUserClients>;
104
+ /**
105
+ * Get a fresh list from backend of clients for all the participants of the conversation.
106
+ * @fixme there are some case where this method is not enough to detect removed devices
107
+ * @param {string} conversationId
108
+ * @param {string} conversationDomain? - If given will send the message to the new qualified endpoint
109
+ */
110
+ fetchAllParticipantsClients(conversationId: string, conversationDomain?: string): Promise<UserClients | QualifiedUserClients>;
99
111
  deleteMessageLocal(conversationId: string, messageIdToHide: string, sendAsProtobuf?: boolean, conversationDomain?: string): Promise<HideMessage>;
100
112
  deleteMessageEveryone(conversationId: string, messageIdToDelete: string, userIds?: string[] | QualifiedId[] | UserClients | QualifiedUserClients, sendAsProtobuf?: boolean, conversationDomain?: string, callbacks?: MessageSendingCallbacks): Promise<DeleteMessage>;
101
113
  leaveConversation(conversationId: QualifiedId): Promise<ConversationMemberLeaveEvent>;
@@ -510,10 +510,46 @@ class ConversationService {
510
510
  }
511
511
  /**
512
512
  * Get a fresh list from backend of clients for all the participants of the conversation.
513
+ * This is a hacky way of getting all the clients for a conversation.
514
+ * The idea is to send an empty message to the backend to absolutely no users and let backend reply with a mismatch error.
515
+ * We then get the missing members in the mismatch, that is our fresh list of participants' clients.
516
+ *
517
+ * @deprecated
518
+ * @param {string} conversationId
519
+ * @param {string} conversationDomain? - If given will send the message to the new qualified endpoint
520
+ */
521
+ getAllParticipantsClients(conversationId, conversationDomain) {
522
+ const sendingClientId = this.apiClient.validatedClientId;
523
+ const recipients = {};
524
+ const text = new Uint8Array();
525
+ return new Promise(async (resolve) => {
526
+ const onClientMismatch = (mismatch) => {
527
+ resolve(mismatch.missing);
528
+ // When the mismatch happens, we ask the messageService to cancel the sending
529
+ return false;
530
+ };
531
+ if (conversationDomain && this.config.useQualifiedIds) {
532
+ await this.messageService.sendFederatedMessage(sendingClientId, recipients, text, {
533
+ conversationId: { id: conversationId, domain: conversationDomain },
534
+ onClientMismatch,
535
+ reportMissing: true,
536
+ });
537
+ }
538
+ else {
539
+ await this.messageService.sendMessage(sendingClientId, recipients, text, {
540
+ conversationId,
541
+ onClientMismatch,
542
+ });
543
+ }
544
+ });
545
+ }
546
+ /**
547
+ * Get a fresh list from backend of clients for all the participants of the conversation.
548
+ * @fixme there are some case where this method is not enough to detect removed devices
513
549
  * @param {string} conversationId
514
550
  * @param {string} conversationDomain? - If given will send the message to the new qualified endpoint
515
551
  */
516
- async getAllParticipantsClients(conversationId, conversationDomain) {
552
+ async fetchAllParticipantsClients(conversationId, conversationDomain) {
517
553
  const qualifiedMembers = await this.getConversationQualifiedMembers(conversationDomain ? { id: conversationId, domain: conversationDomain } : conversationId);
518
554
  const allClients = await this.apiClient.api.user.postListClients({ qualified_users: qualifiedMembers });
519
555
  const qualifiedUserClients = {};
@@ -35,7 +35,9 @@ class CryptographyDatabaseRepository {
35
35
  this.storeEngine = storeEngine;
36
36
  }
37
37
  deleteStores() {
38
- return Promise.all(Object.keys(CryptographyDatabaseRepository.STORES).map(store => this.storeEngine.deleteAll(store)));
38
+ return Promise.all(
39
+ //make sure we use enum's lowercase values, not uppercase keys
40
+ Object.values(CryptographyDatabaseRepository.STORES).map(store => this.storeEngine.deleteAll(store)));
39
41
  }
40
42
  }
41
43
  exports.CryptographyDatabaseRepository = CryptographyDatabaseRepository;