@wireapp/core 17.24.0 → 17.24.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.
Files changed (30) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/package.json +2 -2
  3. package/src/main/broadcast/BroadcastService.js +3 -4
  4. package/src/main/broadcast/BroadcastService.js.map +1 -1
  5. package/src/main/broadcast/BroadcastService.ts +3 -5
  6. package/src/main/conversation/ConversationService.d.ts +4 -6
  7. package/src/main/conversation/ConversationService.js +26 -59
  8. package/src/main/conversation/ConversationService.js.map +1 -1
  9. package/src/main/conversation/ConversationService.test.node.js +0 -38
  10. package/src/main/conversation/ConversationService.test.node.js.map +1 -1
  11. package/src/main/conversation/ConversationService.test.node.ts +1 -50
  12. package/src/main/conversation/ConversationService.ts +32 -116
  13. package/src/main/conversation/message/MessageService.d.ts +42 -12
  14. package/src/main/conversation/message/MessageService.js +146 -281
  15. package/src/main/conversation/message/MessageService.js.map +1 -1
  16. package/src/main/conversation/message/MessageService.test.node.js +100 -6
  17. package/src/main/conversation/message/MessageService.test.node.js.map +1 -1
  18. package/src/main/conversation/message/MessageService.test.node.ts +153 -29
  19. package/src/main/conversation/message/MessageService.ts +208 -360
  20. package/src/main/conversation/message/UserClientsUtil.d.ts +22 -0
  21. package/src/main/conversation/message/UserClientsUtil.js +38 -0
  22. package/src/main/conversation/message/UserClientsUtil.js.map +1 -0
  23. package/src/main/conversation/message/UserClientsUtil.ts +44 -0
  24. package/src/main/conversation/message/UserClientsUtils.test.node.d.ts +1 -0
  25. package/src/main/conversation/message/UserClientsUtils.test.node.js +42 -0
  26. package/src/main/conversation/message/UserClientsUtils.test.node.js.map +1 -0
  27. package/src/main/conversation/message/UserClientsUtils.test.node.ts +44 -0
  28. package/src/main/util/TypePredicateUtil.js +3 -9
  29. package/src/main/util/TypePredicateUtil.js.map +1 -1
  30. package/src/main/util/TypePredicateUtil.ts +3 -9
@@ -0,0 +1,22 @@
1
+ import { QualifiedId } from '@wireapp/api-client/src/user';
2
+ declare type UserClientsContainer<T> = {
3
+ [userId: string]: T;
4
+ };
5
+ declare type QualifiedUserClientsContainer<T> = {
6
+ [domain: string]: UserClientsContainer<T>;
7
+ };
8
+ export declare function flattenUserClients<T>(userClients: UserClientsContainer<T>, domain?: string): {
9
+ data: T;
10
+ userId: QualifiedId;
11
+ }[];
12
+ /**
13
+ * Will flatten a container of users=>clients infos to an array
14
+ *
15
+ * @param userClients The UserClients (qualified or not) to flatten
16
+ * @return An array containing the qualified user Ids and the clients info
17
+ */
18
+ export declare function flattenQualifiedUserClients<T = unknown>(userClients: QualifiedUserClientsContainer<T>): {
19
+ data: T;
20
+ userId: QualifiedId;
21
+ }[];
22
+ export {};
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ /*
3
+ * Wire
4
+ * Copyright (C) 2021 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.flattenQualifiedUserClients = exports.flattenUserClients = void 0;
22
+ function flattenUserClients(userClients, domain = '') {
23
+ return Object.entries(userClients).map(([id, data]) => ({ data, userId: { domain, id } }));
24
+ }
25
+ exports.flattenUserClients = flattenUserClients;
26
+ /**
27
+ * Will flatten a container of users=>clients infos to an array
28
+ *
29
+ * @param userClients The UserClients (qualified or not) to flatten
30
+ * @return An array containing the qualified user Ids and the clients info
31
+ */
32
+ function flattenQualifiedUserClients(userClients) {
33
+ return Object.entries(userClients).reduce((ids, [domain, userClients]) => {
34
+ return [...ids, ...flattenUserClients(userClients, domain)];
35
+ }, []);
36
+ }
37
+ exports.flattenQualifiedUserClients = flattenQualifiedUserClients;
38
+ //# sourceMappingURL=UserClientsUtil.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UserClientsUtil.js","sourceRoot":"","sources":["UserClientsUtil.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;GAiBG;;;AAOH,SAAgB,kBAAkB,CAChC,WAAoC,EACpC,SAAiB,EAAE;IAEnB,OAAO,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC,EAAC,IAAI,EAAE,MAAM,EAAE,EAAC,MAAM,EAAE,EAAE,EAAC,EAAC,CAAC,CAAC,CAAC;AACzF,CAAC;AALD,gDAKC;AAED;;;;;GAKG;AACH,SAAgB,2BAA2B,CACzC,WAA6C;IAE7C,OAAO,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC,MAAM,EAAE,WAAW,CAAC,EAAE,EAAE;QACvE,OAAO,CAAC,GAAG,GAAG,EAAE,GAAG,kBAAkB,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC,CAAC;IAC9D,CAAC,EAAE,EAAsC,CAAC,CAAC;AAC7C,CAAC;AAND,kEAMC"}
@@ -0,0 +1,44 @@
1
+ /*
2
+ * Wire
3
+ * Copyright (C) 2021 Wire Swiss GmbH
4
+ *
5
+ * This program is free software: you can redistribute it and/or modify
6
+ * it under the terms of the GNU General Public License as published by
7
+ * the Free Software Foundation, either version 3 of the License, or
8
+ * (at your option) any later version.
9
+ *
10
+ * This program is distributed in the hope that it will be useful,
11
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ * GNU General Public License for more details.
14
+ *
15
+ * You should have received a copy of the GNU General Public License
16
+ * along with this program. If not, see http://www.gnu.org/licenses/.
17
+ *
18
+ */
19
+
20
+ import {QualifiedId} from '@wireapp/api-client/src/user';
21
+
22
+ type UserClientsContainer<T> = {[userId: string]: T};
23
+ type QualifiedUserClientsContainer<T> = {[domain: string]: UserClientsContainer<T>};
24
+
25
+ export function flattenUserClients<T>(
26
+ userClients: UserClientsContainer<T>,
27
+ domain: string = '',
28
+ ): {data: T; userId: QualifiedId}[] {
29
+ return Object.entries(userClients).map(([id, data]) => ({data, userId: {domain, id}}));
30
+ }
31
+
32
+ /**
33
+ * Will flatten a container of users=>clients infos to an array
34
+ *
35
+ * @param userClients The UserClients (qualified or not) to flatten
36
+ * @return An array containing the qualified user Ids and the clients info
37
+ */
38
+ export function flattenQualifiedUserClients<T = unknown>(
39
+ userClients: QualifiedUserClientsContainer<T>,
40
+ ): {data: T; userId: QualifiedId}[] {
41
+ return Object.entries(userClients).reduce((ids, [domain, userClients]) => {
42
+ return [...ids, ...flattenUserClients(userClients, domain)];
43
+ }, [] as {data: T; userId: QualifiedId}[]);
44
+ }
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ /*
3
+ * Wire
4
+ * Copyright (C) 2021 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 UserClientsUtil_1 = require("./UserClientsUtil");
22
+ describe('userClientsUtils', () => {
23
+ it('extracts user and data info from qualified payload', () => {
24
+ const payload = { domain1: { user1: ['client1'], user2: ['client11'] }, domain2: { user3: ['client1', 'client2'] } };
25
+ const expected = [
26
+ { data: ['client1'], userId: { domain: 'domain1', id: 'user1' } },
27
+ { data: ['client11'], userId: { domain: 'domain1', id: 'user2' } },
28
+ { data: ['client1', 'client2'], userId: { domain: 'domain2', id: 'user3' } },
29
+ ];
30
+ expect((0, UserClientsUtil_1.flattenQualifiedUserClients)(payload)).toEqual(expected);
31
+ });
32
+ it('extracts user and data info from non-qualified payload', () => {
33
+ const payload = { user1: ['client1'], user2: ['client11'], user3: ['client1', 'client2'] };
34
+ const expected = [
35
+ { data: ['client1'], userId: { domain: '', id: 'user1' } },
36
+ { data: ['client11'], userId: { domain: '', id: 'user2' } },
37
+ { data: ['client1', 'client2'], userId: { domain: '', id: 'user3' } },
38
+ ];
39
+ expect((0, UserClientsUtil_1.flattenUserClients)(payload)).toEqual(expected);
40
+ });
41
+ });
42
+ //# sourceMappingURL=UserClientsUtils.test.node.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UserClientsUtils.test.node.js","sourceRoot":"","sources":["UserClientsUtils.test.node.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;GAiBG;;AAEH,uDAAkF;AAElF,QAAQ,CAAC,kBAAkB,EAAE,GAAG,EAAE;IAChC,EAAE,CAAC,oDAAoD,EAAE,GAAG,EAAE;QAC5D,MAAM,OAAO,GAAG,EAAC,OAAO,EAAE,EAAC,KAAK,EAAE,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,CAAC,UAAU,CAAC,EAAC,EAAE,OAAO,EAAE,EAAC,KAAK,EAAE,CAAC,SAAS,EAAE,SAAS,CAAC,EAAC,EAAC,CAAC;QAC/G,MAAM,QAAQ,GAAG;YACf,EAAC,IAAI,EAAE,CAAC,SAAS,CAAC,EAAE,MAAM,EAAE,EAAC,MAAM,EAAE,SAAS,EAAE,EAAE,EAAE,OAAO,EAAC,EAAC;YAC7D,EAA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modify
6
+ * it under the terms of the GNU General Public License as published by
7
+ * the Free Software Foundation, either version 3 of the License, or
8
+ * (at your option) any later version.
9
+ *
10
+ * This program is distributed in the hope that it will be useful,
11
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ * GNU General Public License for more details.
14
+ *
15
+ * You should have received a copy of the GNU General Public License
16
+ * along with this program. If not, see http://www.gnu.org/licenses/.
17
+ *
18
+ */
19
+
20
+ import {flattenQualifiedUserClients, flattenUserClients} from './UserClientsUtil';
21
+
22
+ describe('userClientsUtils', () => {
23
+ it('extracts user and data info from qualified payload', () => {
24
+ const payload = {domain1: {user1: ['client1'], user2: ['client11']}, domain2: {user3: ['client1', 'client2']}};
25
+ const expected = [
26
+ {data: ['client1'], userId: {domain: 'domain1', id: 'user1'}},
27
+ {data: ['client11'], userId: {domain: 'domain1', id: 'user2'}},
28
+ {data: ['client1', 'client2'], userId: {domain: 'domain2', id: 'user3'}},
29
+ ];
30
+
31
+ expect(flattenQualifiedUserClients(payload)).toEqual(expected);
32
+ });
33
+
34
+ it('extracts user and data info from non-qualified payload', () => {
35
+ const payload = {user1: ['client1'], user2: ['client11'], user3: ['client1', 'client2']};
36
+ const expected = [
37
+ {data: ['client1'], userId: {domain: '', id: 'user1'}},
38
+ {data: ['client11'], userId: {domain: '', id: 'user2'}},
39
+ {data: ['client1', 'client2'], userId: {domain: '', id: 'user3'}},
40
+ ];
41
+
42
+ expect(flattenUserClients(payload)).toEqual(expected);
43
+ });
44
+ });
@@ -20,7 +20,7 @@
20
20
  Object.defineProperty(exports, "__esModule", { value: true });
21
21
  exports.isUserClients = exports.isQualifiedUserClients = exports.isQualifiedIdArray = exports.isQualifiedId = exports.isStringArray = void 0;
22
22
  function isStringArray(obj) {
23
- return Array.isArray(obj) && typeof obj[0] === 'string';
23
+ return Array.isArray(obj) && (obj.length === 0 || typeof obj[0] === 'string');
24
24
  }
25
25
  exports.isStringArray = isStringArray;
26
26
  function isQualifiedId(obj) {
@@ -37,10 +37,7 @@ function isQualifiedUserClients(obj) {
37
37
  const firstUserClientObject = (_a = Object.values(obj)) === null || _a === void 0 ? void 0 : _a[0];
38
38
  if (typeof firstUserClientObject === 'object') {
39
39
  const firstClientIdArray = Object.values(firstUserClientObject)[0];
40
- if (Array.isArray(firstClientIdArray)) {
41
- const firstClientId = firstClientIdArray[0];
42
- return typeof firstClientId === 'string' || typeof firstClientId === 'undefined';
43
- }
40
+ return isStringArray(firstClientIdArray);
44
41
  }
45
42
  }
46
43
  return false;
@@ -50,10 +47,7 @@ function isUserClients(obj) {
50
47
  var _a;
51
48
  if (typeof obj === 'object') {
52
49
  const firstUserClientArray = (_a = Object.values(obj)) === null || _a === void 0 ? void 0 : _a[0];
53
- if (Array.isArray(firstUserClientArray)) {
54
- const firstClientId = firstUserClientArray[0];
55
- return typeof firstClientId === 'string';
56
- }
50
+ return isStringArray(firstUserClientArray);
57
51
  }
58
52
  return false;
59
53
  }
@@ -1 +1 @@
1
- {"version":3,"file":"TypePredicateUtil.js","sourceRoot":"","sources":["TypePredicateUtil.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;GAiBG;;;AAKH,SAAgB,aAAa,CAAC,GAAQ;IACpC,OAAO,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,OAAO,GAAG,CAAC,CAAC,CAAC,KAAK,QAAQ,CAAC;AAC1D,CAAC;AAFD,sCAEC;AAED,SAAgB,aAAa,CAAC,GAAQ;IACpC,OAAO,OAAO,GAAG,KAAK,QAAQ,IAAI,OAAO,GAAG,CAAC,QAAQ,CAAC,KAAK,QAAQ,CAAC;AACtE,CAAC;AAFD,sCAEC;AAED,SAAgB,kBAAkB,CAAC,GAAQ;IACzC,OAAO,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;AACrD,CAAC;AAFD,gDAEC;AAED,S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AC,CAAC;AAChF,CAAC;AAFD,sCAEC;AAED,SAAgB,aAAa,CAAC,GAAQ;IACpC,OAAO,OAAO,GAAG,KAAK,QAAQ,IAAI,OAAO,GAAG,CAAC,QAAQ,CAAC,KAAK,QAAQ,CAAC;AACtE,CAAC;AAFD,sCAEC;AAED,SAAgB,kBAAkB,CAAC,GAAQ;IACzC,OAAO,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;AACrD,CAAC;AAFD,gDAEC;AAED,SAAgB,sBAAsB,CAAC,GAAQ;;IAC7C,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE;QAC3B,MAAM,qBAAqB,GAAG,MAAA,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,0CAAG,CAAC,CAAC,CAAC;QACtD,IAAI,OAAO,qBAAqB,KAAK,QAAQ,EAAE;YAC7C,MAAM,kBAAkB,GAAG,MAAM,CAAC,MAAM,CAAC,qBAA+B,CAAC,CAAC,CAAC,CAAC,CAAC;YAC7E,OAAO,aAAa,CAAC,kBAAkB,CAAC,CAAC;SAC1C;KACF;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AATD,wDASC;AAED,SAAgB,aAAa,CAAC,GAAQ;;IACpC,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE;QAC3B,MAAM,oBAAoB,GAAG,MAAA,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,0CAAG,CAAC,CAAC,CAAC;QACrD,OAAO,aAAa,CAAC,oBAAoB,CAAC,CAAC;KAC5C;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAND,sCAMC"}
@@ -21,7 +21,7 @@ import type {QualifiedUserClients, UserClients} from '@wireapp/api-client/src/co
21
21
  import type {QualifiedId} from '@wireapp/api-client/src/user/';
22
22
 
23
23
  export function isStringArray(obj: any): obj is string[] {
24
- return Array.isArray(obj) && typeof obj[0] === 'string';
24
+ return Array.isArray(obj) && (obj.length === 0 || typeof obj[0] === 'string');
25
25
  }
26
26
 
27
27
  export function isQualifiedId(obj: any): obj is QualifiedId {
@@ -37,10 +37,7 @@ export function isQualifiedUserClients(obj: any): obj is QualifiedUserClients {
37
37
  const firstUserClientObject = Object.values(obj)?.[0];
38
38
  if (typeof firstUserClientObject === 'object') {
39
39
  const firstClientIdArray = Object.values(firstUserClientObject as object)[0];
40
- if (Array.isArray(firstClientIdArray)) {
41
- const firstClientId = firstClientIdArray[0];
42
- return typeof firstClientId === 'string' || typeof firstClientId === 'undefined';
43
- }
40
+ return isStringArray(firstClientIdArray);
44
41
  }
45
42
  }
46
43
  return false;
@@ -49,10 +46,7 @@ export function isQualifiedUserClients(obj: any): obj is QualifiedUserClients {
49
46
  export function isUserClients(obj: any): obj is UserClients {
50
47
  if (typeof obj === 'object') {
51
48
  const firstUserClientArray = Object.values(obj)?.[0];
52
- if (Array.isArray(firstUserClientArray)) {
53
- const firstClientId = firstUserClientArray[0];
54
- return typeof firstClientId === 'string';
55
- }
49
+ return isStringArray(firstUserClientArray);
56
50
  }
57
51
  return false;
58
52
  }