@wireapp/core 22.1.0 → 23.0.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,49 @@
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
+ # [23.0.0](https://github.com/wireapp/wire-web-packages/tree/main/packages/core/compare/@wireapp/core@22.1.3...@wireapp/core@23.0.0) (2022-02-21)
7
+
8
+
9
+ ### Code Refactoring
10
+
11
+ * **api-client:** Move all the specific apis to an `api` namespace of the ApiClient ([#4228](https://github.com/wireapp/wire-web-packages/tree/main/packages/core/issues/4228)) ([d18b348](https://github.com/wireapp/wire-web-packages/tree/main/packages/core/commit/d18b34841822eea20114d99db67dc376b1311f15))
12
+
13
+
14
+ ### BREAKING CHANGES
15
+
16
+ * **api-client:** All the specific api accessible from the apiClient have moved from `apiClient.<specificApi>.api` to `apiClient.api.<specificApi>` (eg. `apiClient.user.api` needs to be replaced with `apiClient.api.user`)
17
+
18
+
19
+
20
+
21
+
22
+ ## [22.1.3](https://github.com/wireapp/wire-web-packages/tree/main/packages/core/compare/@wireapp/core@22.1.2...@wireapp/core@22.1.3) (2022-02-17)
23
+
24
+ **Note:** Version bump only for package @wireapp/core
25
+
26
+
27
+
28
+
29
+
30
+ ## [22.1.2](https://github.com/wireapp/wire-web-packages/tree/main/packages/core/compare/@wireapp/core@22.1.1...@wireapp/core@22.1.2) (2022-02-01)
31
+
32
+ **Note:** Version bump only for package @wireapp/core
33
+
34
+
35
+
36
+
37
+
38
+ ## [22.1.1](https://github.com/wireapp/wire-web-packages/tree/main/packages/core/compare/@wireapp/core@22.1.0...@wireapp/core@22.1.1) (2022-02-01)
39
+
40
+
41
+ ### Bug Fixes
42
+
43
+ * **core:** Do not try to encrypt for clients without prekeys ([#4220](https://github.com/wireapp/wire-web-packages/tree/main/packages/core/issues/4220)) ([1adea26](https://github.com/wireapp/wire-web-packages/tree/main/packages/core/commit/1adea2652de6fd7833a3f1ae99b488f2d25e9817))
44
+
45
+
46
+
47
+
48
+
6
49
  # [22.1.0](https://github.com/wireapp/wire-web-packages/tree/main/packages/core/compare/@wireapp/core@22.0.0...@wireapp/core@22.1.0) (2022-02-01)
7
50
 
8
51
 
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "dependencies": {
6
6
  "@types/long": "4.0.1",
7
7
  "@types/node": "~14",
8
- "@wireapp/api-client": "16.6.0",
8
+ "@wireapp/api-client": "17.0.0",
9
9
  "@wireapp/cryptobox": "12.7.1",
10
10
  "bazinga64": "5.10.0",
11
11
  "hash.js": "1.1.7",
@@ -20,14 +20,14 @@
20
20
  "@types/jasmine": "3.8.2",
21
21
  "@types/karma": "6.3.1",
22
22
  "@wireapp/commons": "4.2.13",
23
- "@wireapp/store-engine-dexie": "1.6.7",
23
+ "@wireapp/store-engine-dexie": "1.6.8",
24
24
  "commander": "8.0.0",
25
25
  "cross-env": "7.0.3",
26
26
  "dotenv-defaults": "2.0.2",
27
27
  "faker": "5.5.3",
28
28
  "istanbul": "1.1.0-alpha.1",
29
29
  "jasmine": "3.8.0",
30
- "karma": "6.3.4",
30
+ "karma": "6.3.14",
31
31
  "karma-chrome-launcher": "3.1.0",
32
32
  "karma-jasmine": "4.0.1",
33
33
  "karma-jasmine-diff-reporter": "2.0.1",
@@ -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": "22.1.0",
73
- "gitHead": "97061d487f550a9bcb587ae730a61b9c16fbe074"
72
+ "version": "23.0.0",
73
+ "gitHead": "64d590b40155de334291669dfea523f3f9ad5c97"
74
74
  }
@@ -238,7 +238,7 @@ class Account extends events_1.EventEmitter {
238
238
  async loadAndValidateLocalClient() {
239
239
  await this.service.cryptography.initCryptobox();
240
240
  const loadedClient = await this.service.client.getLocalClient();
241
- await this.apiClient.client.api.getClient(loadedClient.id);
241
+ await this.apiClient.api.client.getClient(loadedClient.id);
242
242
  this.apiClient.context.clientId = loadedClient.id;
243
243
  return loadedClient;
244
244
  }
@@ -26,7 +26,7 @@ class AccountService {
26
26
  }
27
27
  getCallConfig() {
28
28
  const iceCandidateLimit = commons_1.Runtime.isFirefox() ? 3 : undefined;
29
- return this.apiClient.account.api.getCallConfig(iceCandidateLimit);
29
+ return this.apiClient.api.account.getCallConfig(iceCandidateLimit);
30
30
  }
31
31
  }
32
32
  exports.AccountService = AccountService;
@@ -1 +1 @@
1
- {"version":3,"file":"AccountService.js","sourceRoot":"","sources":["AccountService.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;GAiBG;;;AAGH,8CAAyC;AAGzC,MAAa,cAAc;IACzB,YAA6B,SAAoB;QAApB,cAAS,GAAT,SAAS,CAAW;IAAG,CAAC;IAErD,aAAa;QACX,MAAM,iBAAiB,GAAG,iBAAO,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QAC9D,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,iBAAiB,CAAC,CAAC;IACrE,CAAC;CACF;AAPD,wCAOC"}
1
+ {"version":3,"file":"AccountService.js","sourceRoot":"","sources":["AccountService.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;GAiBG;;;AAGH,8CAAyC;AAGzC,MAAa,cAAc;IACzB,YAA6B,SAAoB;QAApB,cAAS,GAAT,SAAS,CAAW;IAAG,CAAC;IAErD,aAAa;QACX,MAAM,iBAAiB,GAAG,iBAAO,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QAC9D,OAAO,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,OAAO,CAAC,aAAa,CAAC,iBAAiB,CAAC,CAAC;IACrE,CAAC;CACF;AAPD,wCAOC"}
@@ -26,6 +26,6 @@ export class AccountService {
26
26
 
27
27
  getCallConfig(): Promise<CallConfigData> {
28
28
  const iceCandidateLimit = Runtime.isFirefox() ? 3 : undefined;
29
- return this.apiClient.account.api.getCallConfig(iceCandidateLimit);
29
+ return this.apiClient.api.account.getCallConfig(iceCandidateLimit);
30
30
  }
31
31
  }
@@ -36,16 +36,16 @@ class BroadcastService {
36
36
  */
37
37
  async getPreKeyBundlesFromTeam(teamId, skipOwnClients = false, onlyDirectConnections = false) {
38
38
  const teamMembers = onlyDirectConnections
39
- ? (await this.apiClient.conversation.api.getConversations()).conversations
39
+ ? (await this.apiClient.api.conversation.getConversations()).conversations
40
40
  .map(({ members }) => members.others.map(user => user.id).concat(members.self.id))
41
41
  .flat()
42
- : (await this.apiClient.teams.member.api.getAllMembers(teamId)).members.map(({ user }) => user);
42
+ : (await this.apiClient.api.teams.member.getAllMembers(teamId)).members.map(({ user }) => user);
43
43
  let members = Array.from(new Set(teamMembers)).map(member => ({ id: member }));
44
44
  if (skipOwnClients) {
45
- const selfUser = await this.apiClient.self.api.getSelf();
45
+ const selfUser = await this.apiClient.api.self.getSelf();
46
46
  members = members.filter(member => member.id !== selfUser.id);
47
47
  }
48
- const preKeys = await Promise.all(members.map(member => this.apiClient.user.api.getUserPreKeys(member.id)));
48
+ const preKeys = await Promise.all(members.map(member => this.apiClient.api.user.getUserPreKeys(member.id)));
49
49
  return preKeys.reduce((bundleMap, bundle) => {
50
50
  bundleMap[bundle.user] = {};
51
51
  for (const client of bundle.clients) {
@@ -24,10 +24,10 @@ class ClientBackendRepository {
24
24
  this.apiClient = apiClient;
25
25
  }
26
26
  getClients() {
27
- return this.apiClient.client.api.getClients();
27
+ return this.apiClient.api.client.getClients();
28
28
  }
29
29
  postClient(client) {
30
- return this.apiClient.client.api.postClient(client);
30
+ return this.apiClient.api.client.postClient(client);
31
31
  }
32
32
  }
33
33
  exports.ClientBackendRepository = ClientBackendRepository;
@@ -25,20 +25,20 @@ class ConnectionService {
25
25
  this.apiClient = apiClient;
26
26
  }
27
27
  getConnections() {
28
- return this.apiClient.connection.api.getAllConnections();
28
+ return this.apiClient.api.connection.getAllConnections();
29
29
  }
30
30
  acceptConnection(userId) {
31
- return this.apiClient.connection.api.putConnection(userId, {
31
+ return this.apiClient.api.connection.putConnection(userId, {
32
32
  status: connection_1.ConnectionStatus.ACCEPTED,
33
33
  });
34
34
  }
35
35
  ignoreConnection(userId) {
36
- return this.apiClient.connection.api.putConnection(userId, {
36
+ return this.apiClient.api.connection.putConnection(userId, {
37
37
  status: connection_1.ConnectionStatus.IGNORED,
38
38
  });
39
39
  }
40
40
  createConnection(userId) {
41
- return this.apiClient.connection.api.postConnection({
41
+ return this.apiClient.api.connection.postConnection({
42
42
  message: ' ',
43
43
  name: ' ',
44
44
  user: userId,
@@ -36,13 +36,13 @@ class AssetService {
36
36
  const { forceCaching } = assetData;
37
37
  switch (assetData.version) {
38
38
  case 1:
39
- return this.apiClient.asset.api.getAssetV1(assetData.assetId, assetData.conversationId, forceCaching, progressCallback);
39
+ return this.apiClient.api.asset.getAssetV1(assetData.assetId, assetData.conversationId, forceCaching, progressCallback);
40
40
  case 2:
41
- return this.apiClient.asset.api.getAssetV2(assetData.assetId, assetData.conversationId, forceCaching, progressCallback);
41
+ return this.apiClient.api.asset.getAssetV2(assetData.assetId, assetData.conversationId, forceCaching, progressCallback);
42
42
  case 3:
43
- return this.apiClient.asset.api.getAssetV3(assetData.assetKey, assetData.assetToken, forceCaching, progressCallback);
43
+ return this.apiClient.api.asset.getAssetV3(assetData.assetKey, assetData.assetToken, forceCaching, progressCallback);
44
44
  case 4:
45
- return this.apiClient.asset.api.getAssetV4(assetData.assetKey, assetData.assetDomain, assetData.assetToken, forceCaching, progressCallback);
45
+ return this.apiClient.api.asset.getAssetV4(assetData.assetKey, assetData.assetDomain, assetData.assetToken, forceCaching, progressCallback);
46
46
  }
47
47
  }
48
48
  /**
@@ -54,7 +54,7 @@ class AssetService {
54
54
  * @return cancellable request that resolves with the uploaded image
55
55
  */
56
56
  uploadRawAsset(asset, options, progressCallback) {
57
- return this.apiClient.asset.api.postAsset(new Uint8Array(asset), options, progressCallback);
57
+ return this.apiClient.api.asset.postAsset(new Uint8Array(asset), options, progressCallback);
58
58
  }
59
59
  /**
60
60
  * Will encrypt and upload an asset to the backend
@@ -53,7 +53,7 @@ class ConversationService {
53
53
  return genericMessage;
54
54
  }
55
55
  async getConversationQualifiedMembers(conversationId) {
56
- const conversation = await this.apiClient.conversation.api.getConversation(conversationId, true);
56
+ const conversation = await this.apiClient.api.conversation.getConversation(conversationId, true);
57
57
  /*
58
58
  * If you are sending a message to a conversation, you have to include
59
59
  * yourself in the list of users if you want to sync a message also to your
@@ -89,7 +89,7 @@ class ConversationService {
89
89
  }
90
90
  }
91
91
  const preKeys = await Promise.all(targets.map(async ({ id: userId, clients }) => {
92
- const prekeyBundle = await this.apiClient.user.api.getUserPreKeys(userId);
92
+ const prekeyBundle = await this.apiClient.api.user.getUserPreKeys(userId);
93
93
  // We filter the clients that should not receive the message (if a QualifiedUserClients was given as parameter)
94
94
  const userClients = clients
95
95
  ? prekeyBundle.clients.filter(client => clients.includes(client.client))
@@ -117,7 +117,7 @@ class ConversationService {
117
117
  }
118
118
  }
119
119
  if (!members.length) {
120
- const conversation = await this.apiClient.conversation.api.getConversation(conversationId);
120
+ const conversation = await this.apiClient.api.conversation.getConversation(conversationId);
121
121
  /*
122
122
  * If you are sending a message to a conversation, you have to include
123
123
  * yourself in the list of users if you want to sync a message also to your
@@ -125,7 +125,7 @@ class ConversationService {
125
125
  */
126
126
  members = conversation.members.others.map(member => member.id).concat(conversation.members.self.id);
127
127
  }
128
- const preKeys = await Promise.all(members.map(member => this.apiClient.user.api.getUserPreKeys(member)));
128
+ const preKeys = await Promise.all(members.map(member => this.apiClient.api.user.getUserPreKeys(member)));
129
129
  return preKeys.reduce((bundleMap, bundle) => {
130
130
  const userId = bundle.user;
131
131
  bundleMap[userId] || (bundleMap[userId] = {});
@@ -138,7 +138,7 @@ class ConversationService {
138
138
  async getSelfConversationId() {
139
139
  if (!this.selfConversationId) {
140
140
  const { userId } = this.apiClient.context;
141
- const { qualified_id, id } = await this.apiClient.conversation.api.getConversation(userId);
141
+ const { qualified_id, id } = await this.apiClient.api.conversation.getConversation(userId);
142
142
  const domain = this.config.useQualifiedIds ? qualified_id.domain : '';
143
143
  this.selfConversationId = { id, domain };
144
144
  }
@@ -602,7 +602,7 @@ class ConversationService {
602
602
  };
603
603
  }
604
604
  leaveConversation(conversationId) {
605
- return this.apiClient.conversation.api.deleteMember(conversationId, this.apiClient.context.userId);
605
+ return this.apiClient.api.conversation.deleteMember(conversationId, this.apiClient.context.userId);
606
606
  }
607
607
  async leaveConversations(conversationIds) {
608
608
  if (!conversationIds) {
@@ -620,19 +620,19 @@ class ConversationService {
620
620
  receipt_mode: null,
621
621
  users: ids,
622
622
  };
623
- return this.apiClient.conversation.api.postConversation(newConversation);
623
+ return this.apiClient.api.conversation.postConversation(newConversation);
624
624
  }
625
625
  async getConversations(conversationIds) {
626
626
  if (!conversationIds || !conversationIds.length) {
627
- return this.apiClient.conversation.api.getAllConversations();
627
+ return this.apiClient.api.conversation.getAllConversations();
628
628
  }
629
629
  if (typeof conversationIds === 'string') {
630
- return this.apiClient.conversation.api.getConversation(conversationIds);
630
+ return this.apiClient.api.conversation.getConversation(conversationIds);
631
631
  }
632
- return this.apiClient.conversation.api.getConversationsByIds(conversationIds);
632
+ return this.apiClient.api.conversation.getConversationsByIds(conversationIds);
633
633
  }
634
634
  async getAsset({ assetId, assetToken, otrKey, sha256 }) {
635
- const request = this.apiClient.asset.api.getAssetV3(assetId, assetToken);
635
+ const request = this.apiClient.api.asset.getAssetV3(assetId, assetToken);
636
636
  const encryptedBuffer = (await request.response).buffer;
637
637
  return (0, AssetCryptography_1.decryptAsset)({
638
638
  cipherText: new Uint8Array(encryptedBuffer),
@@ -641,21 +641,21 @@ class ConversationService {
641
641
  });
642
642
  }
643
643
  async getUnencryptedAsset(assetId, assetToken) {
644
- const request = await this.apiClient.asset.api.getAssetV3(assetId, assetToken);
644
+ const request = await this.apiClient.api.asset.getAssetV3(assetId, assetToken);
645
645
  return (await request.response).buffer;
646
646
  }
647
647
  async addUser(conversationId, userIds) {
648
648
  const ids = Array.isArray(userIds) ? userIds : [userIds];
649
649
  if ((0, TypePredicateUtil_1.isStringArray)(ids)) {
650
- await this.apiClient.conversation.api.postMembers(conversationId, ids);
650
+ await this.apiClient.api.conversation.postMembers(conversationId, ids);
651
651
  }
652
652
  else if ((0, TypePredicateUtil_1.isQualifiedIdArray)(ids)) {
653
- await this.apiClient.conversation.api.postMembersV2(conversationId, ids);
653
+ await this.apiClient.api.conversation.postMembersV2(conversationId, ids);
654
654
  }
655
655
  return userIds;
656
656
  }
657
657
  async removeUser(conversationId, userId) {
658
- await this.apiClient.conversation.api.deleteMember(conversationId, userId);
658
+ await this.apiClient.api.conversation.deleteMember(conversationId, userId);
659
659
  return userId;
660
660
  }
661
661
  /**
@@ -750,10 +750,10 @@ class ConversationService {
750
750
  return Object.assign(Object.assign({}, payloadBundle), { content: processedContent || payloadBundle.content, messageTimer: ((_d = genericMessage.ephemeral) === null || _d === void 0 ? void 0 : _d.expireAfterMillis) || 0, state: response.errored ? conversation_2.PayloadBundleState.CANCELLED : conversation_2.PayloadBundleState.OUTGOING_SENT });
751
751
  }
752
752
  sendTypingStart(conversationId) {
753
- return this.apiClient.conversation.api.postTyping(conversationId, { status: data_1.CONVERSATION_TYPING.STARTED });
753
+ return this.apiClient.api.conversation.postTyping(conversationId, { status: data_1.CONVERSATION_TYPING.STARTED });
754
754
  }
755
755
  sendTypingStop(conversationId) {
756
- return this.apiClient.conversation.api.postTyping(conversationId, { status: data_1.CONVERSATION_TYPING.STOPPED });
756
+ return this.apiClient.api.conversation.postTyping(conversationId, { status: data_1.CONVERSATION_TYPING.STOPPED });
757
757
  }
758
758
  setConversationMutedStatus(conversationId, status, muteTimestamp) {
759
759
  if (typeof muteTimestamp === 'number') {
@@ -763,7 +763,7 @@ class ConversationService {
763
763
  otr_muted_ref: muteTimestamp.toISOString(),
764
764
  otr_muted_status: status,
765
765
  };
766
- return this.apiClient.conversation.api.putMembershipProperties(conversationId, payload);
766
+ return this.apiClient.api.conversation.putMembershipProperties(conversationId, payload);
767
767
  }
768
768
  toggleArchiveConversation(conversationId, archived, archiveTimestamp = new Date()) {
769
769
  if (typeof archiveTimestamp === 'number') {
@@ -773,10 +773,10 @@ class ConversationService {
773
773
  otr_archived: archived,
774
774
  otr_archived_ref: archiveTimestamp.toISOString(),
775
775
  };
776
- return this.apiClient.conversation.api.putMembershipProperties(conversationId, payload);
776
+ return this.apiClient.api.conversation.putMembershipProperties(conversationId, payload);
777
777
  }
778
778
  setMemberConversationRole(conversationId, userId, conversationRole) {
779
- return this.apiClient.conversation.api.putOtherMember(userId, conversationId, {
779
+ return this.apiClient.api.conversation.putOtherMember(userId, conversationId, {
780
780
  conversation_role: conversationRole,
781
781
  });
782
782
  }
@@ -166,7 +166,7 @@ class MessageService {
166
166
  throw new Error('Unimplemented federated broadcast');
167
167
  }
168
168
  const { id, domain } = options.conversationId;
169
- return this.apiClient.conversation.api.postOTRMessageV2(id, domain, protoMessage);
169
+ return this.apiClient.api.conversation.postOTRMessageV2(id, domain, protoMessage);
170
170
  }
171
171
  async sendOTRMessage(sendingClientId, recipients, options) {
172
172
  const message = {
@@ -184,8 +184,8 @@ class MessageService {
184
184
  ignoreMissing = typeof options.reportMissing === 'boolean' ? !options.reportMissing : false;
185
185
  }
186
186
  return !options.conversationId
187
- ? this.apiClient.broadcast.api.postBroadcastMessage(sendingClientId, message, ignoreMissing)
188
- : this.apiClient.conversation.api.postOTRMessage(sendingClientId, options.conversationId, message, ignoreMissing);
187
+ ? this.apiClient.api.broadcast.postBroadcastMessage(sendingClientId, message, ignoreMissing)
188
+ : this.apiClient.api.conversation.postOTRMessage(sendingClientId, options.conversationId, message, ignoreMissing);
189
189
  }
190
190
  async generateExternalPayload(plainText) {
191
191
  const asset = await (0, AssetCryptography_1.encryptAsset)({ plainText });
@@ -221,7 +221,7 @@ class MessageService {
221
221
  // remove deleted clients to the recipients
222
222
  deleted.forEach(({ userId, data }) => data.forEach(clientId => delete recipients[userId.id][clientId]));
223
223
  if (missing.length) {
224
- const missingPreKeyBundles = await this.apiClient.user.api.postMultiPreKeyBundles(mismatch.missing);
224
+ const missingPreKeyBundles = await this.apiClient.api.user.postMultiPreKeyBundles(mismatch.missing);
225
225
  const { encrypted } = await this.cryptographyService.encrypt(plainText, missingPreKeyBundles);
226
226
  const reEncryptedPayloads = (0, UserClientsUtil_1.flattenUserClients)(encrypted);
227
227
  // add missing clients to the recipients
@@ -243,7 +243,7 @@ class MessageService {
243
243
  // remove deleted clients to the recipients
244
244
  deleted.forEach(({ userId, data }) => data.forEach(clientId => delete recipients[userId.domain][userId.id][clientId]));
245
245
  if (Object.keys(missing).length) {
246
- const missingPreKeyBundles = await this.apiClient.user.api.postQualifiedMultiPreKeyBundles(mismatch.missing);
246
+ const missingPreKeyBundles = await this.apiClient.api.user.postQualifiedMultiPreKeyBundles(mismatch.missing);
247
247
  const { encrypted } = await this.cryptographyService.encryptQualified(plainText, missingPreKeyBundles);
248
248
  const reEncryptedPayloads = (0, UserClientsUtil_1.flattenQualifiedUserClients)(encrypted);
249
249
  reEncryptedPayloads.forEach(({ data, userId }) => (recipients[userId.domain][userId.id] = Object.assign(Object.assign({}, recipients[userId.domain][userId.id]), data)));
@@ -286,8 +286,8 @@ class MessageService {
286
286
  protoMessage.blob = options.assetData;
287
287
  }
288
288
  return !options.conversationId
289
- ? this.apiClient.broadcast.api.postBroadcastProtobufMessage(sendingClientId, protoMessage, ignoreMissing)
290
- : this.apiClient.conversation.api.postOTRProtobufMessage(sendingClientId, options.conversationId, protoMessage, ignoreMissing);
289
+ ? this.apiClient.api.broadcast.postBroadcastProtobufMessage(sendingClientId, protoMessage, ignoreMissing)
290
+ : this.apiClient.api.conversation.postOTRProtobufMessage(sendingClientId, options.conversationId, protoMessage, ignoreMissing);
291
291
  }
292
292
  }
293
293
  exports.MessageService = MessageService;
@@ -94,12 +94,17 @@ class CryptographyService {
94
94
  };
95
95
  }
96
96
  async encrypt(plainText, users, domain) {
97
+ var _a;
97
98
  const encrypted = {};
98
99
  const missing = {};
99
100
  for (const userId in users) {
100
- const clientIds = (0, util_1.isUserClients)(users) ? users[userId] : Object.keys(users[userId]);
101
+ const clientIds = (0, util_1.isUserClients)(users)
102
+ ? users[userId]
103
+ : Object.keys(users[userId])
104
+ // We filter out clients that have `null` prekey
105
+ .filter(clientId => !!users[userId][clientId]);
101
106
  for (const clientId of clientIds) {
102
- const base64PreKey = (0, util_1.isUserClients)(users) ? undefined : users[userId][clientId].key;
107
+ const base64PreKey = (0, util_1.isUserClients)(users) ? undefined : (_a = users[userId][clientId]) === null || _a === void 0 ? void 0 : _a.key;
103
108
  const sessionId = CryptographyService.constructSessionId(userId, clientId, domain || null);
104
109
  const result = await this.encryptPayloadForSession(sessionId, plainText, base64PreKey);
105
110
  if (result) {
@@ -24,13 +24,13 @@ class GiphyService {
24
24
  this.apiClient = apiClient;
25
25
  }
26
26
  getRandomGif(tag, rating) {
27
- return this.apiClient.giphy.api.getGiphyRandom({ rating, tag });
27
+ return this.apiClient.api.giphy.getGiphyRandom({ rating, tag });
28
28
  }
29
29
  getTrendingGif(rating) {
30
- return this.apiClient.giphy.api.getGiphyTrending({ rating });
30
+ return this.apiClient.api.giphy.getGiphyTrending({ rating });
31
31
  }
32
32
  searchGif(options) {
33
- return this.apiClient.giphy.api.getGiphySearch(options);
33
+ return this.apiClient.api.giphy.getGiphySearch(options);
34
34
  }
35
35
  }
36
36
  exports.GiphyService = GiphyService;
@@ -24,10 +24,10 @@ class NotificationBackendRepository {
24
24
  this.apiClient = apiClient;
25
25
  }
26
26
  async getAllNotifications(clientId, lastNotificationId) {
27
- return this.apiClient.notification.api.getAllNotifications(clientId, lastNotificationId);
27
+ return this.apiClient.api.notification.getAllNotifications(clientId, lastNotificationId);
28
28
  }
29
29
  getLastNotification(clientId) {
30
- return this.apiClient.notification.api.getLastNotification(clientId);
30
+ return this.apiClient.api.notification.getLastNotification(clientId);
31
31
  }
32
32
  }
33
33
  exports.NotificationBackendRepository = NotificationBackendRepository;
@@ -28,16 +28,16 @@ class SelfService {
28
28
  return !!availableUsername;
29
29
  }
30
30
  checkUsernames(usernames) {
31
- return this.apiClient.user.api.postHandles({
31
+ return this.apiClient.api.user.postHandles({
32
32
  handles: usernames,
33
33
  });
34
34
  }
35
35
  async getName() {
36
- const { name } = await this.apiClient.self.api.getName();
36
+ const { name } = await this.apiClient.api.self.getName();
37
37
  return name;
38
38
  }
39
39
  async getSelf() {
40
- const selfData = await this.apiClient.self.api.getSelf();
40
+ const selfData = await this.apiClient.api.self.getSelf();
41
41
  return selfData;
42
42
  }
43
43
  async getUsername() {
@@ -45,10 +45,10 @@ class SelfService {
45
45
  return handle;
46
46
  }
47
47
  setName(name) {
48
- return this.apiClient.self.api.putSelf({ name });
48
+ return this.apiClient.api.self.putSelf({ name });
49
49
  }
50
50
  setUsername(username) {
51
- return this.apiClient.self.api.putHandle({ handle: username });
51
+ return this.apiClient.api.self.putHandle({ handle: username });
52
52
  }
53
53
  }
54
54
  exports.SelfService = SelfService;
@@ -24,31 +24,31 @@ class TeamService {
24
24
  this.apiClient = apiClient;
25
25
  }
26
26
  addMember(teamId, memberData) {
27
- return this.apiClient.teams.member.api.postMembers(teamId, memberData);
27
+ return this.apiClient.api.teams.member.postMembers(teamId, memberData);
28
28
  }
29
29
  createTeam(teamData) {
30
- return this.apiClient.teams.team.api.postTeam(teamData);
30
+ return this.apiClient.api.teams.team.postTeam(teamData);
31
31
  }
32
32
  deleteTeam(teamId, password) {
33
- return this.apiClient.teams.team.api.deleteTeam(teamId, password);
33
+ return this.apiClient.api.teams.team.deleteTeam(teamId, password);
34
34
  }
35
35
  getAllMembers(teamId) {
36
- return this.apiClient.teams.member.api.getAllMembers(teamId);
36
+ return this.apiClient.api.teams.member.getAllMembers(teamId);
37
37
  }
38
38
  getTeam(teamId) {
39
- return this.apiClient.teams.team.api.getTeam(teamId);
39
+ return this.apiClient.api.teams.team.getTeam(teamId);
40
40
  }
41
41
  getTeams() {
42
- return this.apiClient.teams.team.api.getTeams();
42
+ return this.apiClient.api.teams.team.getTeams();
43
43
  }
44
44
  removeMember(teamId, userId, password) {
45
- return this.apiClient.teams.member.api.deleteMember(teamId, userId, password);
45
+ return this.apiClient.api.teams.member.deleteMember(teamId, userId, password);
46
46
  }
47
47
  updateMember(teamId, memberData) {
48
- return this.apiClient.teams.member.api.putMembers(teamId, memberData);
48
+ return this.apiClient.api.teams.member.putMembers(teamId, memberData);
49
49
  }
50
50
  updateTeam(teamId, teamData) {
51
- return this.apiClient.teams.team.api.putTeam(teamId, teamData);
51
+ return this.apiClient.api.teams.team.putTeam(teamId, teamData);
52
52
  }
53
53
  }
54
54
  exports.TeamService = TeamService;
@@ -34,15 +34,15 @@ class UserService {
34
34
  this.conversationService = conversationService;
35
35
  }
36
36
  getUser(userId) {
37
- return this.apiClient.user.api.getUser(userId);
37
+ return this.apiClient.api.user.getUser(userId);
38
38
  }
39
39
  async getUsers(userIds) {
40
40
  if (!userIds.length) {
41
41
  return [];
42
42
  }
43
43
  return (0, TypePredicateUtil_1.isQualifiedIdArray)(userIds)
44
- ? this.apiClient.user.api.postListUsers({ qualified_ids: userIds })
45
- : this.apiClient.user.api.getUsers({ ids: userIds });
44
+ ? this.apiClient.api.user.postListUsers({ qualified_ids: userIds })
45
+ : this.apiClient.api.user.getUsers({ ids: userIds });
46
46
  }
47
47
  /**
48
48
  * Sends a availability update to members of the same team