@wireapp/core 42.19.1 → 42.20.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.
Files changed (43) hide show
  1. package/lib/Account.d.ts +5 -3
  2. package/lib/Account.d.ts.map +1 -1
  3. package/lib/Account.js +12 -6
  4. package/lib/conversation/ConversationService/ConversationService.d.ts +3 -2
  5. package/lib/conversation/ConversationService/ConversationService.d.ts.map +1 -1
  6. package/lib/conversation/ConversationService/ConversationService.js +3 -2
  7. package/lib/conversation/ConversationService/ConversationService.test.js +2 -1
  8. package/lib/conversation/SubconversationService/SubconversationService.d.ts +14 -3
  9. package/lib/conversation/SubconversationService/SubconversationService.d.ts.map +1 -1
  10. package/lib/conversation/SubconversationService/SubconversationService.js +33 -19
  11. package/lib/conversation/SubconversationService/SubconversationService.test.js +37 -53
  12. package/lib/conversation/SubconversationService/subconversationUtil.d.ts +4 -0
  13. package/lib/conversation/SubconversationService/subconversationUtil.d.ts.map +1 -0
  14. package/lib/conversation/SubconversationService/subconversationUtil.js +25 -0
  15. package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/messageAdd.d.ts +4 -1
  16. package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/messageAdd.d.ts.map +1 -1
  17. package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/messageAdd.js +2 -2
  18. package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/messageAdd.test.js +8 -8
  19. package/lib/messagingProtocols/mls/MLSService/MLSService.d.ts +2 -11
  20. package/lib/messagingProtocols/mls/MLSService/MLSService.d.ts.map +1 -1
  21. package/lib/messagingProtocols/mls/MLSService/MLSService.js +8 -24
  22. package/lib/messagingProtocols/mls/MLSService/MLSService.test.js +5 -4
  23. package/lib/messagingProtocols/mls/types.d.ts +2 -3
  24. package/lib/messagingProtocols/mls/types.d.ts.map +1 -1
  25. package/lib/self/SelfService.d.ts +7 -0
  26. package/lib/self/SelfService.d.ts.map +1 -1
  27. package/lib/self/SelfService.js +19 -0
  28. package/lib/self/SelfService.test.d.ts +2 -0
  29. package/lib/self/SelfService.test.d.ts.map +1 -0
  30. package/lib/self/SelfService.test.js +54 -0
  31. package/lib/storage/CoreDB.d.ts +10 -0
  32. package/lib/storage/CoreDB.d.ts.map +1 -1
  33. package/lib/storage/CoreDB.js +3 -1
  34. package/lib/user/UserService.d.ts +5 -0
  35. package/lib/user/UserService.d.ts.map +1 -1
  36. package/lib/user/UserService.js +12 -0
  37. package/package.json +9 -9
  38. package/lib/messagingProtocols/mls/MLSService/stores/subconversationGroupIdStore/subconversationGroupIdStore.d.ts +0 -13
  39. package/lib/messagingProtocols/mls/MLSService/stores/subconversationGroupIdStore/subconversationGroupIdStore.d.ts.map +0 -1
  40. package/lib/messagingProtocols/mls/MLSService/stores/subconversationGroupIdStore/subconversationGroupIdStore.js +0 -67
  41. package/lib/messagingProtocols/mls/MLSService/stores/subconversationGroupIdStore/subconversationGroupIdStore.test.d.ts +0 -2
  42. package/lib/messagingProtocols/mls/MLSService/stores/subconversationGroupIdStore/subconversationGroupIdStore.test.d.ts.map +0 -1
  43. package/lib/messagingProtocols/mls/MLSService/stores/subconversationGroupIdStore/subconversationGroupIdStore.test.js +0 -72
@@ -1,7 +1,9 @@
1
+ import { ConversationProtocol } from '@wireapp/api-client/lib/conversation';
1
2
  import { Self } from '@wireapp/api-client/lib/self/';
2
3
  import { APIClient } from '@wireapp/api-client';
3
4
  export declare class SelfService {
4
5
  private readonly apiClient;
6
+ private readonly logger;
5
7
  constructor(apiClient: APIClient);
6
8
  checkUsername(username: string): Promise<boolean>;
7
9
  checkUsernames(usernames: string[]): Promise<string[]>;
@@ -10,5 +12,10 @@ export declare class SelfService {
10
12
  getUsername(): Promise<string | undefined>;
11
13
  setName(name: string): Promise<void>;
12
14
  setUsername(username: string): Promise<void>;
15
+ /**
16
+ * Update self user's list of supported-protocols
17
+ * @param supportedProtocols The list of supported protocols
18
+ */
19
+ putSupportedProtocols(supportedProtocols: ConversationProtocol[]): Promise<void>;
13
20
  }
14
21
  //# sourceMappingURL=SelfService.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"SelfService.d.ts","sourceRoot":"","sources":["../../src/self/SelfService.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,IAAI,EAAC,MAAM,+BAA+B,CAAC;AAEnD,OAAO,EAAC,SAAS,EAAC,MAAM,qBAAqB,CAAC;AAE9C,qBAAa,WAAW;IACV,OAAO,CAAC,QAAQ,CAAC,SAAS;gBAAT,SAAS,EAAE,SAAS;IAEpC,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAKvD,cAAc,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAMhD,OAAO,IAAI,OAAO,CAAC,MAAM,CAAC;IAK1B,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAKxB,WAAW,IAAI,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;IAKhD,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIpC,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAGpD"}
1
+ {"version":3,"file":"SelfService.d.ts","sourceRoot":"","sources":["../../src/self/SelfService.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,oBAAoB,EAAC,MAAM,sCAAsC,CAAC;AAC1E,OAAO,EAAC,IAAI,EAAC,MAAM,+BAA+B,CAAC;AAGnD,OAAO,EAAC,SAAS,EAAC,MAAM,qBAAqB,CAAC;AAE9C,qBAAa,WAAW;IAGV,OAAO,CAAC,QAAQ,CAAC,SAAS;IAFtC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAwC;gBAElC,SAAS,EAAE,SAAS;IAEpC,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAKvD,cAAc,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAMhD,OAAO,IAAI,OAAO,CAAC,MAAM,CAAC;IAK1B,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAKxB,WAAW,IAAI,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;IAKhD,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIpC,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAInD;;;OAGG;IACU,qBAAqB,CAAC,kBAAkB,EAAE,oBAAoB,EAAE;CAY9E"}
@@ -17,11 +17,16 @@
17
17
  * along with this program. If not, see http://www.gnu.org/licenses/.
18
18
  *
19
19
  */
20
+ var __importDefault = (this && this.__importDefault) || function (mod) {
21
+ return (mod && mod.__esModule) ? mod : { "default": mod };
22
+ };
20
23
  Object.defineProperty(exports, "__esModule", { value: true });
21
24
  exports.SelfService = void 0;
25
+ const logdown_1 = __importDefault(require("logdown"));
22
26
  class SelfService {
23
27
  constructor(apiClient) {
24
28
  this.apiClient = apiClient;
29
+ this.logger = (0, logdown_1.default)('@wireapp/core/SelfService');
25
30
  }
26
31
  async checkUsername(username) {
27
32
  const [availableUsername] = await this.checkUsernames([username]);
@@ -50,5 +55,19 @@ class SelfService {
50
55
  setUsername(username) {
51
56
  return this.apiClient.api.self.putHandle({ handle: username });
52
57
  }
58
+ /**
59
+ * Update self user's list of supported-protocols
60
+ * @param supportedProtocols The list of supported protocols
61
+ */
62
+ async putSupportedProtocols(supportedProtocols) {
63
+ if (!this.apiClient.backendFeatures.supportsMLS) {
64
+ this.logger.warn('Self supported protocols were not updated, because endpoint is not supported by backend');
65
+ return;
66
+ }
67
+ if (!supportedProtocols || supportedProtocols.length === 0) {
68
+ throw new Error('Supported protocols must be a non-empty protocols list');
69
+ }
70
+ return this.apiClient.api.self.putSupportedProtocols(supportedProtocols);
71
+ }
53
72
  }
54
73
  exports.SelfService = SelfService;
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=SelfService.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SelfService.test.d.ts","sourceRoot":"","sources":["../../src/self/SelfService.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ /*
3
+ * Wire
4
+ * Copyright (C) 2023 Wire Swiss GmbH
5
+ *
6
+ * This program is free software: you can redistribute it and/or modify
7
+ * it under the terms of the GNU General Public License as published by
8
+ * the Free Software Foundation, either version 3 of the License, or
9
+ * (at your option) any later version.
10
+ *
11
+ * This program is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ * GNU General Public License for more details.
15
+ *
16
+ * You should have received a copy of the GNU General Public License
17
+ * along with this program. If not, see http://www.gnu.org/licenses/.
18
+ *
19
+ */
20
+ Object.defineProperty(exports, "__esModule", { value: true });
21
+ const conversation_1 = require("@wireapp/api-client/lib/conversation");
22
+ const api_client_1 = require("@wireapp/api-client");
23
+ const SelfService_1 = require("./SelfService");
24
+ const BASE_URL = 'mock-backend.wire.com';
25
+ const MOCK_BACKEND = {
26
+ name: 'mock',
27
+ rest: `https://${BASE_URL}`,
28
+ ws: `wss://${BASE_URL}`,
29
+ };
30
+ describe('SelfService', () => {
31
+ describe('putSupportedProtocols', () => {
32
+ const apiClient = new api_client_1.APIClient({ urls: MOCK_BACKEND });
33
+ apiClient.backendFeatures.supportsMLS = true;
34
+ it('updates the list of self supported protocols', async () => {
35
+ const selfService = new SelfService_1.SelfService(apiClient);
36
+ const supportedProtocols = [conversation_1.ConversationProtocol.PROTEUS, conversation_1.ConversationProtocol.MLS];
37
+ jest.spyOn(apiClient.api.self, 'putSupportedProtocols').mockImplementation(jest.fn());
38
+ await selfService.putSupportedProtocols(supportedProtocols);
39
+ expect(apiClient.api.self.putSupportedProtocols).toHaveBeenCalledWith(supportedProtocols);
40
+ });
41
+ it('throws if supported protocols list is not provided', async () => {
42
+ const selfService = new SelfService_1.SelfService(apiClient);
43
+ const supportedProtocols = undefined;
44
+ jest.spyOn(apiClient.api.self, 'putSupportedProtocols').mockImplementation(jest.fn());
45
+ await expect(() => selfService.putSupportedProtocols(supportedProtocols)).rejects.toThrow('Supported protocols must be a non-empty protocols list');
46
+ });
47
+ it('throws if supported protocols list is empty', async () => {
48
+ const selfService = new SelfService_1.SelfService(apiClient);
49
+ const supportedProtocols = [];
50
+ jest.spyOn(apiClient.api.self, 'putSupportedProtocols').mockImplementation(jest.fn());
51
+ await expect(() => selfService.putSupportedProtocols(supportedProtocols)).rejects.toThrow('Supported protocols must be a non-empty protocols list');
52
+ });
53
+ });
54
+ });
@@ -1,3 +1,5 @@
1
+ import { SUBCONVERSATION_ID } from '@wireapp/api-client/lib/conversation';
2
+ import { QualifiedId } from '@wireapp/api-client/lib/user';
1
3
  import { DBSchema, IDBPDatabase } from 'idb';
2
4
  interface CoreDBSchema extends DBSchema {
3
5
  prekeys: {
@@ -28,6 +30,14 @@ interface CoreDBSchema extends DBSchema {
28
30
  domain: string;
29
31
  };
30
32
  };
33
+ subconversations: {
34
+ key: string;
35
+ value: {
36
+ parentConversationId: QualifiedId;
37
+ subconversationId: SUBCONVERSATION_ID;
38
+ groupId: string;
39
+ };
40
+ };
31
41
  }
32
42
  export type CoreDatabase = IDBPDatabase<CoreDBSchema>;
33
43
  export declare function openDB(dbName: string): Promise<CoreDatabase>;
@@ -1 +1 @@
1
- {"version":3,"file":"CoreDB.d.ts","sourceRoot":"","sources":["../../src/storage/CoreDB.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,QAAQ,EAA2B,YAAY,EAAsB,MAAM,KAAK,CAAC;AAGzF,UAAU,YAAa,SAAQ,QAAQ;IACrC,OAAO,EAAE;QACP,GAAG,EAAE,MAAM,CAAC;QACZ,KAAK,EAAE;YAAC,SAAS,EAAE,MAAM,CAAC;YAAC,SAAS,EAAE,MAAM,CAAA;SAAC,CAAC;KAC/C,CAAC;IACF,gBAAgB,EAAE;QAChB,GAAG,EAAE,MAAM,CAAC;QACZ,KAAK,EAAE;YAAC,OAAO,EAAE,MAAM,CAAC;YAAC,UAAU,EAAE,MAAM,CAAA;SAAC,CAAC;KAC9C,CAAC;IACF,cAAc,EAAE;QACd,GAAG,EAAE,MAAM,CAAC;QACZ,KAAK,EAAE;YAAC,GAAG,EAAE,MAAM,CAAC;YAAC,UAAU,EAAE,MAAM,CAAA;SAAC,CAAC;KAC1C,CAAC;IACF,qBAAqB,EAAE;QACrB,GAAG,EAAE,MAAM,CAAC;QACZ,KAAK,EAAE;YAAC,EAAE,EAAE,MAAM,CAAC;YAAC,MAAM,EAAE,MAAM,CAAA;SAAC,CAAC;KACrC,CAAC;CACH;AAED,MAAM,MAAM,YAAY,GAAG,YAAY,CAAC,YAAY,CAAC,CAAC;AAEtD,wBAAsB,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC,CAiBlE;AAED,wBAAsB,QAAQ,CAAC,EAAE,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAE9D"}
1
+ {"version":3,"file":"CoreDB.d.ts","sourceRoot":"","sources":["../../src/storage/CoreDB.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,kBAAkB,EAAC,MAAM,sCAAsC,CAAC;AACxE,OAAO,EAAC,WAAW,EAAC,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAC,QAAQ,EAA2B,YAAY,EAAsB,MAAM,KAAK,CAAC;AAGzF,UAAU,YAAa,SAAQ,QAAQ;IACrC,OAAO,EAAE;QACP,GAAG,EAAE,MAAM,CAAC;QACZ,KAAK,EAAE;YAAC,SAAS,EAAE,MAAM,CAAC;YAAC,SAAS,EAAE,MAAM,CAAA;SAAC,CAAC;KAC/C,CAAC;IACF,gBAAgB,EAAE;QAChB,GAAG,EAAE,MAAM,CAAC;QACZ,KAAK,EAAE;YAAC,OAAO,EAAE,MAAM,CAAC;YAAC,UAAU,EAAE,MAAM,CAAA;SAAC,CAAC;KAC9C,CAAC;IACF,cAAc,EAAE;QACd,GAAG,EAAE,MAAM,CAAC;QACZ,KAAK,EAAE;YAAC,GAAG,EAAE,MAAM,CAAC;YAAC,UAAU,EAAE,MAAM,CAAA;SAAC,CAAC;KAC1C,CAAC;IACF,qBAAqB,EAAE;QACrB,GAAG,EAAE,MAAM,CAAC;QACZ,KAAK,EAAE;YAAC,EAAE,EAAE,MAAM,CAAC;YAAC,MAAM,EAAE,MAAM,CAAA;SAAC,CAAC;KACrC,CAAC;IACF,gBAAgB,EAAE;QAChB,GAAG,EAAE,MAAM,CAAC;QACZ,KAAK,EAAE;YAAC,oBAAoB,EAAE,WAAW,CAAC;YAAC,iBAAiB,EAAE,kBAAkB,CAAC;YAAC,OAAO,EAAE,MAAM,CAAA;SAAC,CAAC;KACpG,CAAC;CACH;AAED,MAAM,MAAM,YAAY,GAAG,YAAY,CAAC,YAAY,CAAC,CAAC;AAEtD,wBAAsB,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC,CAmBlE;AAED,wBAAsB,QAAQ,CAAC,EAAE,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAE9D"}
@@ -20,7 +20,7 @@
20
20
  Object.defineProperty(exports, "__esModule", { value: true });
21
21
  exports.deleteDB = exports.openDB = void 0;
22
22
  const idb_1 = require("idb");
23
- const VERSION = 4;
23
+ const VERSION = 5;
24
24
  async function openDB(dbName) {
25
25
  const db = await (0, idb_1.openDB)(dbName, VERSION, {
26
26
  upgrade: (db, oldVersion) => {
@@ -34,6 +34,8 @@ async function openDB(dbName) {
34
34
  db.createObjectStore('recurringTasks');
35
35
  case 3:
36
36
  db.createObjectStore('conversationBlacklist');
37
+ case 4:
38
+ db.createObjectStore('subconversations');
37
39
  }
38
40
  },
39
41
  });
@@ -1,3 +1,4 @@
1
+ import { ConversationProtocol } from '@wireapp/api-client/lib/conversation';
1
2
  import { QualifiedId, User } from '@wireapp/api-client/lib/user/';
2
3
  import { APIClient } from '@wireapp/api-client';
3
4
  export declare class UserService {
@@ -9,5 +10,9 @@ export declare class UserService {
9
10
  failed?: QualifiedId[] | undefined;
10
11
  not_found?: QualifiedId[] | undefined;
11
12
  } | never[]>;
13
+ /**
14
+ * Get the list of other user's supported protocols.
15
+ */
16
+ getUserSupportedProtocols(userId: QualifiedId): Promise<ConversationProtocol[]>;
12
17
  }
13
18
  //# sourceMappingURL=UserService.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"UserService.d.ts","sourceRoot":"","sources":["../../src/user/UserService.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,WAAW,EAAE,IAAI,EAAC,MAAM,+BAA+B,CAAC;AAEhE,OAAO,EAAC,SAAS,EAAC,MAAM,qBAAqB,CAAC;AAE9C,qBAAa,WAAW;IACtB,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAY;gBAE1B,SAAS,EAAE,SAAS;IAIzB,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;IAI9C,QAAQ,CAAC,OAAO,EAAE,WAAW,EAAE;;;;;CAM7C"}
1
+ {"version":3,"file":"UserService.d.ts","sourceRoot":"","sources":["../../src/user/UserService.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,oBAAoB,EAAC,MAAM,sCAAsC,CAAC;AAC1E,OAAO,EAAC,WAAW,EAAE,IAAI,EAAC,MAAM,+BAA+B,CAAC;AAEhE,OAAO,EAAC,SAAS,EAAC,MAAM,qBAAqB,CAAC;AAE9C,qBAAa,WAAW;IACtB,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAY;gBAE1B,SAAS,EAAE,SAAS;IAIzB,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;IAI9C,QAAQ,CAAC,OAAO,EAAE,WAAW,EAAE;;;;;IAO5C;;OAEG;IACU,yBAAyB,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,oBAAoB,EAAE,CAAC;CAS7F"}
@@ -19,6 +19,7 @@
19
19
  */
20
20
  Object.defineProperty(exports, "__esModule", { value: true });
21
21
  exports.UserService = void 0;
22
+ const conversation_1 = require("@wireapp/api-client/lib/conversation");
22
23
  class UserService {
23
24
  constructor(apiClient) {
24
25
  this.apiClient = apiClient;
@@ -32,5 +33,16 @@ class UserService {
32
33
  }
33
34
  return this.apiClient.api.user.postListUsers({ qualified_ids: userIds });
34
35
  }
36
+ /**
37
+ * Get the list of other user's supported protocols.
38
+ */
39
+ async getUserSupportedProtocols(userId) {
40
+ // Clients that uses version below the one supporting MLS, are not aware of user's supported protocols, we default to Proteus in this case.
41
+ if (!this.apiClient.backendFeatures.supportsMLS) {
42
+ return [conversation_1.ConversationProtocol.PROTEUS];
43
+ }
44
+ const supportedProtocols = await this.apiClient.api.user.getUserSupportedProtocols(userId);
45
+ return supportedProtocols.length > 0 ? supportedProtocols : [conversation_1.ConversationProtocol.PROTEUS];
46
+ }
35
47
  }
36
48
  exports.UserService = UserService;
package/package.json CHANGED
@@ -11,16 +11,16 @@
11
11
  "./lib/cryptography/AssetCryptography/crypto.node": "./lib/cryptography/AssetCryptography/crypto.browser.js"
12
12
  },
13
13
  "dependencies": {
14
- "@wireapp/api-client": "^26.5.0",
15
- "@wireapp/commons": "^5.2.2",
14
+ "@wireapp/api-client": "^26.5.2",
15
+ "@wireapp/commons": "^5.2.3",
16
16
  "@wireapp/core-crypto": "1.0.0-rc.16",
17
17
  "@wireapp/cryptobox": "12.8.0",
18
- "@wireapp/promise-queue": "^2.2.7",
18
+ "@wireapp/promise-queue": "^2.2.8",
19
19
  "@wireapp/protocol-messaging": "1.44.0",
20
20
  "@wireapp/store-engine": "5.1.4",
21
21
  "@wireapp/store-engine-dexie": "^2.1.6",
22
- "axios": "1.5.1",
23
- "bazinga64": "^6.3.2",
22
+ "axios": "1.6.1",
23
+ "bazinga64": "^6.3.3",
24
24
  "deepmerge-ts": "5.1.0",
25
25
  "hash.js": "1.1.7",
26
26
  "http-status-codes": "2.3.0",
@@ -37,14 +37,14 @@
37
37
  "@types/jest": "^29.2.0",
38
38
  "@types/long": "^5.0.0",
39
39
  "@types/rimraf": "^3.0.2",
40
- "@types/tough-cookie": "4.0.4",
40
+ "@types/tough-cookie": "4.0.5",
41
41
  "commander": "11.1.0",
42
42
  "cross-env": "7.0.3",
43
43
  "dotenv-defaults": "5.0.2",
44
44
  "fake-indexeddb": "^4.0.0",
45
45
  "jest": "^29.2.1",
46
46
  "jest-websocket-mock": "2.5.0",
47
- "nock": "13.3.6",
47
+ "nock": "13.3.8",
48
48
  "rimraf": "^3.0.2",
49
49
  "typescript": "^5.0.4"
50
50
  },
@@ -61,6 +61,6 @@
61
61
  "test:coverage": "jest --coverage",
62
62
  "watch": "tsc --watch"
63
63
  },
64
- "version": "42.19.1",
65
- "gitHead": "278e386599ad8b55a532765615287adf51b1c189"
64
+ "version": "42.20.0",
65
+ "gitHead": "27dbdafb95eecf3c86b398f9144e1021d428622b"
66
66
  }
@@ -1,13 +0,0 @@
1
- import { SUBCONVERSATION_ID } from '@wireapp/api-client/lib/conversation';
2
- import { QualifiedId } from '@wireapp/api-client/lib/user';
3
- export declare const subconversationGroupIdStore: {
4
- storeGroupId: (parentConversationId: QualifiedId, subconversationId: SUBCONVERSATION_ID, subconversationGroupId: string) => void;
5
- getGroupId: (parentConversationId: QualifiedId, subconversationId: SUBCONVERSATION_ID) => string | undefined;
6
- removeGroupId: (parentConversationId: QualifiedId, subconversationId: SUBCONVERSATION_ID) => void;
7
- getAllGroupIdsBySubconversationId: (subconversationIdQuery: SUBCONVERSATION_ID) => {
8
- subconversationGroupId: string;
9
- parentConversationId: QualifiedId;
10
- subconversationId: SUBCONVERSATION_ID;
11
- }[];
12
- };
13
- //# sourceMappingURL=subconversationGroupIdStore.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"subconversationGroupIdStore.d.ts","sourceRoot":"","sources":["../../../../../../src/messagingProtocols/mls/MLSService/stores/subconversationGroupIdStore/subconversationGroupIdStore.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,kBAAkB,EAAC,MAAM,sCAAsC,CAAC;AACxE,OAAO,EAAC,WAAW,EAAC,MAAM,8BAA8B,CAAC;AAgEzD,eAAO,MAAM,2BAA2B;yCA3BhB,WAAW,qBACd,kBAAkB,0BACb,MAAM;uCAMU,WAAW,qBAAqB,kBAAkB;0CAc/C,WAAW,qBAAqB,kBAAkB;gEAT5B,kBAAkB;;8BArC3D,WAAW;2BAAqB,kBAAkB;;CAwD3E,CAAC"}
@@ -1,67 +0,0 @@
1
- "use strict";
2
- /*
3
- * Wire
4
- * Copyright (C) 2023 Wire Swiss GmbH
5
- *
6
- * This program is free software: you can redistribute it and/or modify
7
- * it under the terms of the GNU General Public License as published by
8
- * the Free Software Foundation, either version 3 of the License, or
9
- * (at your option) any later version.
10
- *
11
- * This program is distributed in the hope that it will be useful,
12
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
- * GNU General Public License for more details.
15
- *
16
- * You should have received a copy of the GNU General Public License
17
- * along with this program. If not, see http://www.gnu.org/licenses/.
18
- *
19
- */
20
- Object.defineProperty(exports, "__esModule", { value: true });
21
- exports.subconversationGroupIdStore = void 0;
22
- const storageKey = 'subconversationGroupIdStore';
23
- const generateSubconversationStoreKey = (parentConversationId, subconversationId) => {
24
- return `${parentConversationId.id}@${parentConversationId.domain}:${subconversationId}`;
25
- };
26
- const parseSubconversationStoreKey = (subconversationStoreKey) => {
27
- const [parentConversationId, subconversationId] = subconversationStoreKey.split(':');
28
- const [id, domain] = parentConversationId.split('@');
29
- return { parentConversationId: { domain, id }, subconversationId };
30
- };
31
- const getCurrentMap = () => {
32
- const storedEntry = localStorage.getItem(storageKey);
33
- return storedEntry ? new Map(JSON.parse(storedEntry)) : new Map();
34
- };
35
- const addItemToMap = (subconversationId, subgroupId) => {
36
- const currentMap = getCurrentMap();
37
- currentMap.set(subconversationId, subgroupId);
38
- localStorage.setItem(storageKey, JSON.stringify(Array.from(currentMap.entries())));
39
- };
40
- const removeItemFromMap = (subconversationId) => {
41
- const currentMap = getCurrentMap();
42
- currentMap.delete(subconversationId);
43
- localStorage.setItem(storageKey, JSON.stringify(Array.from(currentMap.entries())));
44
- };
45
- const storeGroupId = (parentConversationId, subconversationId, subconversationGroupId) => {
46
- const subconversationStoreKey = generateSubconversationStoreKey(parentConversationId, subconversationId);
47
- addItemToMap(subconversationStoreKey, subconversationGroupId);
48
- };
49
- const getGroupId = (parentConversationId, subconversationId) => {
50
- const subconversationStoreKey = generateSubconversationStoreKey(parentConversationId, subconversationId);
51
- return getCurrentMap().get(subconversationStoreKey);
52
- };
53
- const getAllGroupIdsBySubconversationId = (subconversationIdQuery) => {
54
- return Array.from(getCurrentMap().entries())
55
- .map(([subconversationId, subconversationGroupId]) => (Object.assign(Object.assign({}, parseSubconversationStoreKey(subconversationId)), { subconversationGroupId })))
56
- .filter(({ subconversationId }) => subconversationId === subconversationIdQuery);
57
- };
58
- const removeGroupId = (parentConversationId, subconversationId) => {
59
- const subconversationStoreKey = generateSubconversationStoreKey(parentConversationId, subconversationId);
60
- return removeItemFromMap(subconversationStoreKey);
61
- };
62
- exports.subconversationGroupIdStore = {
63
- storeGroupId,
64
- getGroupId,
65
- removeGroupId,
66
- getAllGroupIdsBySubconversationId,
67
- };
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=subconversationGroupIdStore.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"subconversationGroupIdStore.test.d.ts","sourceRoot":"","sources":["../../../../../../src/messagingProtocols/mls/MLSService/stores/subconversationGroupIdStore/subconversationGroupIdStore.test.ts"],"names":[],"mappings":""}
@@ -1,72 +0,0 @@
1
- "use strict";
2
- /*
3
- * Wire
4
- * Copyright (C) 2018 Wire Swiss GmbH
5
- *
6
- * This program is free software: you can redistribute it and/or modify
7
- * it under the terms of the GNU General Public License as published by
8
- * the Free Software Foundation, either version 3 of the License, or
9
- * (at your option) any later version.
10
- *
11
- * This program is distributed in the hope that it will be useful,
12
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
- * GNU General Public License for more details.
15
- *
16
- * You should have received a copy of the GNU General Public License
17
- * along with this program. If not, see http://www.gnu.org/licenses/.
18
- *
19
- */
20
- Object.defineProperty(exports, "__esModule", { value: true });
21
- const conversation_1 = require("@wireapp/api-client/lib/conversation");
22
- const subconversationGroupIdStore_1 = require("./subconversationGroupIdStore");
23
- describe('subconversationGroupIdMapper', () => {
24
- it('returns empty groupId if conversation is not known', () => {
25
- const groupId = subconversationGroupIdStore_1.subconversationGroupIdStore.getGroupId({ domain: 'example.com', id: '123' }, conversation_1.SUBCONVERSATION_ID.CONFERENCE);
26
- expect(groupId).toBeUndefined();
27
- });
28
- it('returns the stored groupId', () => {
29
- const conversationId = { domain: 'example.com', id: '123' };
30
- const subconversation = conversation_1.SUBCONVERSATION_ID.CONFERENCE;
31
- const groupId = 'groupID';
32
- subconversationGroupIdStore_1.subconversationGroupIdStore.storeGroupId(conversationId, subconversation, groupId);
33
- const result = subconversationGroupIdStore_1.subconversationGroupIdStore.getGroupId(conversationId, subconversation);
34
- expect(result).toBe(groupId);
35
- });
36
- it('removes groupId from the store', () => {
37
- const conversationId = { domain: 'example.com', id: '123' };
38
- const subconversation = conversation_1.SUBCONVERSATION_ID.CONFERENCE;
39
- const groupId = 'groupID';
40
- subconversationGroupIdStore_1.subconversationGroupIdStore.storeGroupId(conversationId, subconversation, groupId);
41
- expect(subconversationGroupIdStore_1.subconversationGroupIdStore.getGroupId(conversationId, subconversation)).toEqual(groupId);
42
- subconversationGroupIdStore_1.subconversationGroupIdStore.removeGroupId(conversationId, subconversation);
43
- expect(subconversationGroupIdStore_1.subconversationGroupIdStore.getGroupId(conversationId, subconversation)).toBeUndefined();
44
- });
45
- it('retrieves all entries from the store by subconversation id', () => {
46
- const conversationId = { domain: 'example.com', id: '123' };
47
- const subconversation = conversation_1.SUBCONVERSATION_ID.CONFERENCE;
48
- const groupId = 'groupID';
49
- const conversationId2 = { domain: 'example2.com', id: '1234' };
50
- const subconversation2 = conversation_1.SUBCONVERSATION_ID.CONFERENCE;
51
- const groupId2 = 'groupID2';
52
- const conversationId3 = { domain: 'example3.com', id: '12345' };
53
- const subconversation3 = 'none';
54
- const groupId3 = 'groupID3';
55
- subconversationGroupIdStore_1.subconversationGroupIdStore.storeGroupId(conversationId, subconversation, groupId);
56
- subconversationGroupIdStore_1.subconversationGroupIdStore.storeGroupId(conversationId2, subconversation2, groupId2);
57
- subconversationGroupIdStore_1.subconversationGroupIdStore.storeGroupId(conversationId3, subconversation3, groupId3);
58
- const result = subconversationGroupIdStore_1.subconversationGroupIdStore.getAllGroupIdsBySubconversationId(conversation_1.SUBCONVERSATION_ID.CONFERENCE);
59
- expect(result).toEqual([
60
- {
61
- parentConversationId: conversationId,
62
- subconversationId: subconversation,
63
- subconversationGroupId: groupId,
64
- },
65
- {
66
- parentConversationId: conversationId2,
67
- subconversationId: subconversation2,
68
- subconversationGroupId: groupId2,
69
- },
70
- ]);
71
- });
72
- });