@wireapp/core 40.5.2 → 40.5.3-draft-20-cc.3
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/lib/Account.d.ts +7 -9
- package/lib/Account.d.ts.map +1 -1
- package/lib/Account.js +35 -32
- package/lib/CoreError.js +1 -1
- package/lib/broadcast/BroadcastService.d.ts +11 -2
- package/lib/broadcast/BroadcastService.d.ts.map +1 -1
- package/lib/broadcast/BroadcastService.js +39 -5
- package/lib/client/ClientDatabaseRepository.d.ts +5 -5
- package/lib/client/ClientDatabaseRepository.d.ts.map +1 -1
- package/lib/client/ClientDatabaseRepository.js +17 -10
- package/lib/client/ClientService.d.ts +1 -5
- package/lib/client/ClientService.d.ts.map +1 -1
- package/lib/client/ClientService.js +9 -11
- package/lib/connection/ConnectionService.d.ts +2 -2
- package/lib/connection/ConnectionService.d.ts.map +1 -1
- package/lib/connection/ConnectionService.js +2 -2
- package/lib/conversation/AssetTransferState.js +1 -1
- package/lib/conversation/ConversationService/ConversationService.d.ts +5 -12
- package/lib/conversation/ConversationService/ConversationService.d.ts.map +1 -1
- package/lib/conversation/ConversationService/ConversationService.js +11 -26
- package/lib/conversation/ConversationService/ConversationService.test.js +1 -1
- package/lib/conversation/ConversationService/ConversationService.types.d.ts +11 -12
- package/lib/conversation/ConversationService/ConversationService.types.d.ts.map +1 -1
- package/lib/conversation/ConversationService/ConversationService.types.js +1 -1
- package/lib/conversation/ConversationService/Utility/getConversationQualifiedMembers.d.ts +1 -1
- package/lib/conversation/ConversationService/Utility/getConversationQualifiedMembers.d.ts.map +1 -1
- package/lib/conversation/GenericMessageType.js +1 -1
- package/lib/conversation/ReactionType.d.ts +4 -1
- package/lib/conversation/ReactionType.d.ts.map +1 -1
- package/lib/conversation/ReactionType.js +6 -0
- package/lib/conversation/message/Message.types.js +1 -1
- package/lib/conversation/message/MessageBuilder.d.ts +1 -1
- package/lib/conversation/message/MessageBuilder.d.ts.map +1 -1
- package/lib/conversation/message/MessageBuilder.js +2 -2
- package/lib/conversation/message/MessageService.d.ts +31 -6
- package/lib/conversation/message/MessageService.d.ts.map +1 -1
- package/lib/conversation/message/MessageService.js +162 -19
- package/lib/conversation/message/MessageService.test.js +141 -151
- package/lib/conversation/message/PayloadBundle.js +1 -1
- package/lib/conversation/message/UserClientsUtil.d.ts +10 -14
- package/lib/conversation/message/UserClientsUtil.d.ts.map +1 -1
- package/lib/conversation/message/UserClientsUtil.js +11 -21
- package/lib/conversation/message/UserClientsUtils.test.js +9 -5
- package/lib/messagingProtocols/mls/EventHandler/EventHandler.d.ts +1 -1
- package/lib/messagingProtocols/mls/EventHandler/EventHandler.d.ts.map +1 -1
- package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/messageAdd.d.ts +1 -1
- package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/messageAdd.d.ts.map +1 -1
- package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/messageAdd.js +2 -7
- package/lib/messagingProtocols/mls/EventHandler/events/welcomeMessage/welcomeMessage.d.ts.map +1 -1
- package/lib/messagingProtocols/mls/EventHandler/events/welcomeMessage/welcomeMessage.js +0 -2
- package/lib/messagingProtocols/mls/EventHandler/events/welcomeMessage/welcomeMessage.test.js +1 -3
- package/lib/messagingProtocols/mls/MLSService/MLSService.d.ts +8 -19
- package/lib/messagingProtocols/mls/MLSService/MLSService.d.ts.map +1 -1
- package/lib/messagingProtocols/mls/MLSService/MLSService.js +37 -79
- package/lib/messagingProtocols/mls/MLSService/MLSService.test.js +0 -9
- package/lib/messagingProtocols/mls/MLSService/stores/keyMaterialUpdatesStore/index.d.ts +2 -0
- package/lib/messagingProtocols/mls/MLSService/stores/keyMaterialUpdatesStore/index.d.ts.map +1 -0
- package/lib/messagingProtocols/mls/MLSService/stores/keyMaterialUpdatesStore/index.js +35 -0
- package/lib/messagingProtocols/mls/MLSService/stores/keyMaterialUpdatesStore/keyMaterialUpdatesStore.d.ts +11 -0
- package/lib/messagingProtocols/mls/MLSService/stores/keyMaterialUpdatesStore/keyMaterialUpdatesStore.d.ts.map +1 -0
- package/lib/messagingProtocols/mls/MLSService/stores/keyMaterialUpdatesStore/keyMaterialUpdatesStore.js +50 -0
- package/lib/messagingProtocols/mls/MLSService/stores/keyMaterialUpdatesStore/keyMaterialUpdatesStore.test.d.ts +2 -0
- package/lib/messagingProtocols/mls/MLSService/stores/keyMaterialUpdatesStore/keyMaterialUpdatesStore.test.d.ts.map +1 -0
- package/lib/messagingProtocols/mls/MLSService/stores/keyMaterialUpdatesStore/keyMaterialUpdatesStore.test.js +39 -0
- package/lib/messagingProtocols/mls/MLSService/subconversationGroupIdMapper.d.ts +4 -0
- package/lib/messagingProtocols/mls/MLSService/subconversationGroupIdMapper.d.ts.map +1 -0
- package/lib/messagingProtocols/mls/MLSService/subconversationGroupIdMapper.js +35 -0
- package/lib/messagingProtocols/mls/MLSService/subconversationGroupIdMapper.test.d.ts +2 -0
- package/lib/messagingProtocols/mls/MLSService/subconversationGroupIdMapper.test.d.ts.map +1 -0
- package/lib/messagingProtocols/mls/MLSService/subconversationGroupIdMapper.test.js +35 -0
- package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CoreCryptoWrapper/CoreCryptoWrapper.d.ts +5 -10
- package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CoreCryptoWrapper/CoreCryptoWrapper.d.ts.map +1 -1
- package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CoreCryptoWrapper/CoreCryptoWrapper.js +11 -33
- package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CoreCryptoWrapper/PrekeysTracker/PrekeysTracker.d.ts +3 -2
- package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CoreCryptoWrapper/PrekeysTracker/PrekeysTracker.d.ts.map +1 -1
- package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CoreCryptoWrapper/PrekeysTracker/PrekeysTracker.js +9 -8
- package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CoreCryptoWrapper/PrekeysTracker/PrekeysTracker.store.d.ts +9 -4
- package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CoreCryptoWrapper/PrekeysTracker/PrekeysTracker.store.d.ts.map +1 -1
- package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CoreCryptoWrapper/PrekeysTracker/PrekeysTracker.store.js +24 -10
- package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CoreCryptoWrapper/PrekeysTracker/PrekeysTracker.test.js +10 -2
- package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CryptoClient.d.ts +2 -1
- package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CryptoClient.d.ts.map +1 -1
- package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CryptoClient.js +3 -3
- package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CryptoClient.types.d.ts +2 -2
- package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CryptoClient.types.d.ts.map +1 -1
- package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CryptoboxWrapper.d.ts +1 -1
- package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CryptoboxWrapper.d.ts.map +1 -1
- package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CryptoboxWrapper.js +2 -2
- package/lib/messagingProtocols/proteus/ProteusService/ProteusService.d.ts +7 -14
- package/lib/messagingProtocols/proteus/ProteusService/ProteusService.d.ts.map +1 -1
- package/lib/messagingProtocols/proteus/ProteusService/ProteusService.js +35 -31
- package/lib/messagingProtocols/proteus/ProteusService/ProteusService.mocks.d.ts +1 -1
- package/lib/messagingProtocols/proteus/ProteusService/ProteusService.mocks.d.ts.map +1 -1
- package/lib/messagingProtocols/proteus/ProteusService/ProteusService.mocks.js +3 -2
- package/lib/messagingProtocols/proteus/ProteusService/ProteusService.test.js +89 -109
- package/lib/messagingProtocols/proteus/ProteusService/ProteusService.types.d.ts +9 -6
- package/lib/messagingProtocols/proteus/ProteusService/ProteusService.types.d.ts.map +1 -1
- package/lib/messagingProtocols/proteus/Utility/PreKeyBundle/PreKeyBundle.d.ts +25 -0
- package/lib/messagingProtocols/proteus/Utility/PreKeyBundle/PreKeyBundle.d.ts.map +1 -0
- package/lib/messagingProtocols/proteus/Utility/PreKeyBundle/PreKeyBundle.js +93 -0
- package/lib/messagingProtocols/proteus/Utility/PreKeyBundle/PreKeyBundle.test.d.ts +2 -0
- package/lib/messagingProtocols/proteus/Utility/PreKeyBundle/PreKeyBundle.test.d.ts.map +1 -0
- package/lib/messagingProtocols/proteus/Utility/PreKeyBundle/PreKeyBundle.test.js +66 -0
- package/lib/messagingProtocols/proteus/Utility/PreKeyBundle/index.d.ts +2 -0
- package/lib/messagingProtocols/proteus/Utility/PreKeyBundle/index.d.ts.map +1 -0
- package/lib/messagingProtocols/proteus/Utility/PreKeyBundle/index.js +35 -0
- package/lib/messagingProtocols/proteus/Utility/Recipients.d.ts +10 -4
- package/lib/messagingProtocols/proteus/Utility/Recipients.d.ts.map +1 -1
- package/lib/messagingProtocols/proteus/Utility/Recipients.js +16 -16
- package/lib/messagingProtocols/proteus/Utility/SessionHandler/SessionHandler.d.ts +10 -15
- package/lib/messagingProtocols/proteus/Utility/SessionHandler/SessionHandler.d.ts.map +1 -1
- package/lib/messagingProtocols/proteus/Utility/SessionHandler/SessionHandler.js +92 -80
- package/lib/messagingProtocols/proteus/Utility/SessionHandler/SessionHandler.test.js +54 -70
- package/lib/messagingProtocols/proteus/Utility/getGenericMessageParams.d.ts +14 -5
- package/lib/messagingProtocols/proteus/Utility/getGenericMessageParams.d.ts.map +1 -1
- package/lib/messagingProtocols/proteus/Utility/getGenericMessageParams.js +35 -3
- package/lib/messagingProtocols/proteus/Utility/isClearFromMismatch.d.ts +2 -2
- package/lib/messagingProtocols/proteus/Utility/isClearFromMismatch.d.ts.map +1 -1
- package/lib/notification/NotificationDatabaseRepository.js +1 -1
- package/lib/notification/Notifications.types.js +1 -1
- package/lib/user/UserService.d.ts +17 -6
- package/lib/user/UserService.d.ts.map +1 -1
- package/lib/user/UserService.js +47 -2
- package/lib/util/TaskScheduler/TaskScheduler.d.ts +1 -4
- package/lib/util/TaskScheduler/TaskScheduler.d.ts.map +1 -1
- package/lib/util/TaskScheduler/TaskScheduler.js +3 -24
- package/lib/util/TypePredicateUtil.d.ts +1 -0
- package/lib/util/TypePredicateUtil.d.ts.map +1 -1
- package/lib/util/TypePredicateUtil.js +2 -1
- package/package.json +3 -3
- package/lib/messagingProtocols/mls/MLSService/stores/subconversationGroupIdStore/subconversationGroupIdStore.d.ts +0 -13
- package/lib/messagingProtocols/mls/MLSService/stores/subconversationGroupIdStore/subconversationGroupIdStore.d.ts.map +0 -1
- package/lib/messagingProtocols/mls/MLSService/stores/subconversationGroupIdStore/subconversationGroupIdStore.js +0 -67
- package/lib/messagingProtocols/mls/MLSService/stores/subconversationGroupIdStore/subconversationGroupIdStore.test.d.ts +0 -2
- package/lib/messagingProtocols/mls/MLSService/stores/subconversationGroupIdStore/subconversationGroupIdStore.test.d.ts.map +0 -1
- package/lib/messagingProtocols/mls/MLSService/stores/subconversationGroupIdStore/subconversationGroupIdStore.test.js +0 -72
- package/lib/util/TaskScheduler/TaskScheduler.store.d.ts +0 -7
- package/lib/util/TaskScheduler/TaskScheduler.store.d.ts.map +0 -1
- package/lib/util/TaskScheduler/TaskScheduler.store.js +0 -34
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getGenericMessageParams.d.ts","sourceRoot":"","sources":["../../../../src/messagingProtocols/proteus/Utility/getGenericMessageParams.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,SAAS,EAAC,MAAM,mCAAmC,CAAC;AAC5D,OAAO,EAAC,oBAAoB,EAAC,MAAM,sCAAsC,CAAC;
|
|
1
|
+
{"version":3,"file":"getGenericMessageParams.d.ts","sourceRoot":"","sources":["../../../../src/messagingProtocols/proteus/Utility/getGenericMessageParams.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,SAAS,EAAC,MAAM,mCAAmC,CAAC;AAC5D,OAAO,EAAC,oBAAoB,EAAE,WAAW,EAAC,MAAM,sCAAsC,CAAC;AACvF,OAAO,EAAC,WAAW,EAAE,4BAA4B,EAAE,mBAAmB,EAAC,MAAM,8BAA8B,CAAC;AAE5G,OAAO,EAAC,cAAc,EAAC,MAAM,6BAA6B,CAAC;AAK3D,OAAO,EAAoB,qBAAqB,EAAC,MAAM,uBAAuB,CAAC;AAG/E,MAAM,MAAM,sBAAsB,GAAG;IACnC,SAAS,EAAE,IAAI,CAAC;IAChB,eAAe,EAAE,MAAM,CAAC;IACxB,UAAU,EAAE,oBAAoB,GAAG,4BAA4B,CAAC;IAChE,SAAS,EAAE,UAAU,CAAC;IACtB,OAAO,EAAE;QACP,cAAc,EAAE,WAAW,CAAC;QAC5B,UAAU,EAAE,OAAO,GAAG,SAAS,CAAC;QAChC,aAAa,EAAE,OAAO,GAAG,WAAW,EAAE,GAAG,SAAS,CAAC;KACpD,CAAC;CACH,CAAC;AACF,MAAM,MAAM,aAAa,GAAG,IAAI,CAAC,sBAAsB,EAAE,YAAY,GAAG,SAAS,GAAG,WAAW,CAAC,GAAG;IACjG,SAAS,EAAE,KAAK,CAAC;IACjB,UAAU,EAAE,WAAW,GAAG,mBAAmB,CAAC;IAC9C,OAAO,EAAE,IAAI,CAAC,sBAAsB,CAAC,SAAS,CAAC,EAAE,eAAe,CAAC,GAAG;QAClE,aAAa,EAAE,OAAO,GAAG,MAAM,EAAE,GAAG,SAAS,CAAC;KAC/C,CAAC;CACH,CAAC;AACF,UAAU,6BAA6B;IACrC,eAAe,EAAE,MAAM,CAAC;IACxB,cAAc,EAAE,WAAW,CAAC;IAC5B,cAAc,EAAE,cAAc,CAAC;IAC/B,OAAO,EAAE,qBAAqB,CAAC;IAC/B,eAAe,EAAE,OAAO,CAAC;IACzB,SAAS,EAAE,SAAS,CAAC;CACtB;AACD,KAAK,iCAAiC,GAAG,OAAO,CAAC,aAAa,GAAG,sBAAsB,CAAC,CAAC;AAEzF,QAAA,MAAM,uBAAuB,mIAO1B,6BAA6B,sCAyD/B,CAAC;AAEF,OAAO,EAAC,uBAAuB,EAAC,CAAC"}
|
|
@@ -24,24 +24,56 @@ const Recipients_1 = require("./Recipients");
|
|
|
24
24
|
const UserIds_1 = require("./UserIds");
|
|
25
25
|
const conversation_1 = require("../../../conversation");
|
|
26
26
|
const util_1 = require("../../../util");
|
|
27
|
-
const getGenericMessageParams = async ({ sendingClientId, conversationId, genericMessage, options: { targetMode = conversation_1.MessageTargetMode.NONE, userIds, nativePush }, apiClient, }) => {
|
|
27
|
+
const getGenericMessageParams = async ({ sendingClientId, conversationId, genericMessage, options: { targetMode = conversation_1.MessageTargetMode.NONE, userIds, nativePush }, useQualifiedIds, apiClient, }) => {
|
|
28
28
|
const plainText = protocol_messaging_1.GenericMessage.encode(genericMessage).finish();
|
|
29
29
|
if (targetMode !== conversation_1.MessageTargetMode.NONE && !userIds) {
|
|
30
30
|
throw new Error('Cannot send targetted message when no userIds are given');
|
|
31
31
|
}
|
|
32
|
+
if (conversationId.domain && useQualifiedIds) {
|
|
33
|
+
if ((0, util_1.isStringArray)(userIds) || (0, util_1.isUserClients)(userIds)) {
|
|
34
|
+
throw new Error('Invalid userIds option for sending to federated backend');
|
|
35
|
+
}
|
|
36
|
+
const recipients = await (0, Recipients_1.getQualifiedRecipientsForConversation)({ apiClient, conversationId, userIds });
|
|
37
|
+
let reportMissing;
|
|
38
|
+
if (targetMode === conversation_1.MessageTargetMode.NONE) {
|
|
39
|
+
reportMissing = (0, util_1.isQualifiedUserClients)(userIds); // we want to check mismatch in case the consumer gave an exact list of users/devices
|
|
40
|
+
}
|
|
41
|
+
else if (targetMode === conversation_1.MessageTargetMode.USERS) {
|
|
42
|
+
reportMissing = (0, UserIds_1.extractQualifiedUserIds)({ userIds });
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
// in case the message is fully targetted at user/client pairs, we do not want to report the missing clients or users at all
|
|
46
|
+
reportMissing = false;
|
|
47
|
+
}
|
|
48
|
+
return {
|
|
49
|
+
federated: true,
|
|
50
|
+
sendingClientId,
|
|
51
|
+
recipients,
|
|
52
|
+
plainText,
|
|
53
|
+
options: {
|
|
54
|
+
conversationId,
|
|
55
|
+
nativePush,
|
|
56
|
+
reportMissing,
|
|
57
|
+
},
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
if ((0, util_1.isQualifiedIdArray)(userIds) || (0, util_1.isQualifiedUserClients)(userIds)) {
|
|
61
|
+
throw new Error('Invalid userIds option for sending');
|
|
62
|
+
}
|
|
32
63
|
const recipients = await (0, Recipients_1.getRecipientsForConversation)({ apiClient, conversationId, userIds });
|
|
33
64
|
let reportMissing;
|
|
34
65
|
if (targetMode === conversation_1.MessageTargetMode.NONE) {
|
|
35
|
-
reportMissing = (0, util_1.
|
|
66
|
+
reportMissing = (0, util_1.isUserClients)(userIds); // we want to check mismatch in case the consumer gave an exact list of users/devices
|
|
36
67
|
}
|
|
37
68
|
else if (targetMode === conversation_1.MessageTargetMode.USERS) {
|
|
38
|
-
reportMissing = (0, UserIds_1.
|
|
69
|
+
reportMissing = (0, UserIds_1.extractUserIds)({ userIds });
|
|
39
70
|
}
|
|
40
71
|
else {
|
|
41
72
|
// in case the message is fully targetted at user/client pairs, we do not want to report the missing clients or users at all
|
|
42
73
|
reportMissing = false;
|
|
43
74
|
}
|
|
44
75
|
return {
|
|
76
|
+
federated: false,
|
|
45
77
|
sendingClientId,
|
|
46
78
|
recipients,
|
|
47
79
|
plainText,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MessageSendingStatus } from '@wireapp/api-client/lib/conversation';
|
|
2
|
-
declare const isClearFromMismatch: (mismatch: MessageSendingStatus) => boolean;
|
|
1
|
+
import { ClientMismatch, MessageSendingStatus } from '@wireapp/api-client/lib/conversation';
|
|
2
|
+
declare const isClearFromMismatch: (mismatch: ClientMismatch | MessageSendingStatus) => boolean;
|
|
3
3
|
export { isClearFromMismatch };
|
|
4
4
|
//# sourceMappingURL=isClearFromMismatch.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isClearFromMismatch.d.ts","sourceRoot":"","sources":["../../../../src/messagingProtocols/proteus/Utility/isClearFromMismatch.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,oBAAoB,EAAC,MAAM,sCAAsC,CAAC;
|
|
1
|
+
{"version":3,"file":"isClearFromMismatch.d.ts","sourceRoot":"","sources":["../../../../src/messagingProtocols/proteus/Utility/isClearFromMismatch.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,cAAc,EAAE,oBAAoB,EAAC,MAAM,sCAAsC,CAAC;AAE1F,QAAA,MAAM,mBAAmB,aAAc,cAAc,GAAG,oBAAoB,KAAG,OAM9E,CAAC;AAEF,OAAO,EAAC,mBAAmB,EAAC,CAAC"}
|
|
@@ -27,7 +27,7 @@ var DatabaseKeys;
|
|
|
27
27
|
(function (DatabaseKeys) {
|
|
28
28
|
DatabaseKeys["PRIMARY_KEY_LAST_EVENT"] = "z.storage.StorageKey.EVENT.LAST_DATE";
|
|
29
29
|
DatabaseKeys["PRIMARY_KEY_LAST_NOTIFICATION"] = "z.storage.StorageKey.NOTIFICATION.LAST_ID";
|
|
30
|
-
})(DatabaseKeys
|
|
30
|
+
})(DatabaseKeys = exports.DatabaseKeys || (exports.DatabaseKeys = {}));
|
|
31
31
|
const STORES = {
|
|
32
32
|
AMPLIFY: 'amplify',
|
|
33
33
|
};
|
|
@@ -24,4 +24,4 @@ var NotificationSource;
|
|
|
24
24
|
NotificationSource["LOCAL"] = "LOCAL";
|
|
25
25
|
NotificationSource["NOTIFICATION_STREAM"] = "NOTIFICATION_STREAM";
|
|
26
26
|
NotificationSource["WEBSOCKET"] = "WEBSOCKET";
|
|
27
|
-
})(NotificationSource
|
|
27
|
+
})(NotificationSource = exports.NotificationSource || (exports.NotificationSource = {}));
|
|
@@ -1,13 +1,24 @@
|
|
|
1
1
|
import { QualifiedId, User } from '@wireapp/api-client/lib/user/';
|
|
2
2
|
import { APIClient } from '@wireapp/api-client';
|
|
3
|
+
import { AvailabilityType, BroadcastService } from '../broadcast/';
|
|
4
|
+
import { ConnectionService } from '../connection';
|
|
3
5
|
export declare class UserService {
|
|
4
6
|
private readonly apiClient;
|
|
5
|
-
|
|
7
|
+
private readonly broadcastService;
|
|
8
|
+
private readonly connectionService;
|
|
9
|
+
constructor(apiClient: APIClient, broadcastService: BroadcastService, connectionService: ConnectionService);
|
|
6
10
|
getUser(userId: string | QualifiedId): Promise<User>;
|
|
7
|
-
getUsers(userIds: QualifiedId[]): Promise<
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
11
|
+
getUsers(userIds: string[] | QualifiedId[]): Promise<User[]>;
|
|
12
|
+
/**
|
|
13
|
+
* Sends a availability update to members of the same team
|
|
14
|
+
* @param teamId
|
|
15
|
+
* @param type
|
|
16
|
+
* @param options.sendAll=false will broadcast the message to all the members of the team (instead of just direct connections). Should be avoided in a big team
|
|
17
|
+
* @param options.sendAsProtobuf=false
|
|
18
|
+
*/
|
|
19
|
+
setAvailability(teamId: string, type: AvailabilityType, { sendAll, sendAsProtobuf }?: {
|
|
20
|
+
sendAll?: boolean | undefined;
|
|
21
|
+
sendAsProtobuf?: boolean | undefined;
|
|
22
|
+
}): Promise<void>;
|
|
12
23
|
}
|
|
13
24
|
//# sourceMappingURL=UserService.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UserService.d.ts","sourceRoot":"","sources":["../../src/user/UserService.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"UserService.d.ts","sourceRoot":"","sources":["../../src/user/UserService.ts"],"names":[],"mappings":"AAoBA,OAAO,EAAC,WAAW,EAAE,IAAI,EAAsB,MAAM,+BAA+B,CAAC;AAErF,OAAO,EAAC,SAAS,EAAC,MAAM,qBAAqB,CAAC;AAG9C,OAAO,EAAC,gBAAgB,EAAE,gBAAgB,EAAC,MAAM,eAAe,CAAC;AACjE,OAAO,EAAC,iBAAiB,EAAC,MAAM,eAAe,CAAC;AAKhD,qBAAa,WAAW;IACtB,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAY;IACtC,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAmB;IACpD,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAoB;gBAE1C,SAAS,EAAE,SAAS,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,iBAAiB;IAMnG,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;IAI9C,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,WAAW,EAAE,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;IASzE;;;;;;OAMG;IACU,eAAe,CAC1B,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,gBAAgB,EACtB,EAAC,OAAe,EAAE,cAAsB,EAAC;;;KAAK,GAC7C,OAAO,CAAC,IAAI,CAAC;CAuCjB"}
|
package/lib/user/UserService.js
CHANGED
|
@@ -19,9 +19,16 @@
|
|
|
19
19
|
*/
|
|
20
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
21
|
exports.UserService = void 0;
|
|
22
|
+
const connection_1 = require("@wireapp/api-client/lib/connection");
|
|
23
|
+
const protocol_messaging_1 = require("@wireapp/protocol-messaging");
|
|
24
|
+
const MessageBuilder_1 = require("../conversation/message/MessageBuilder");
|
|
25
|
+
const PreKeyBundle_1 = require("../messagingProtocols/proteus/Utility/PreKeyBundle");
|
|
26
|
+
const TypePredicateUtil_1 = require("../util/TypePredicateUtil");
|
|
22
27
|
class UserService {
|
|
23
|
-
constructor(apiClient) {
|
|
28
|
+
constructor(apiClient, broadcastService, connectionService) {
|
|
24
29
|
this.apiClient = apiClient;
|
|
30
|
+
this.broadcastService = broadcastService;
|
|
31
|
+
this.connectionService = connectionService;
|
|
25
32
|
}
|
|
26
33
|
getUser(userId) {
|
|
27
34
|
return this.apiClient.api.user.getUser(userId);
|
|
@@ -30,7 +37,45 @@ class UserService {
|
|
|
30
37
|
if (!userIds.length) {
|
|
31
38
|
return [];
|
|
32
39
|
}
|
|
33
|
-
return
|
|
40
|
+
return (0, TypePredicateUtil_1.isQualifiedIdArray)(userIds)
|
|
41
|
+
? this.apiClient.api.user.postListUsers({ qualified_ids: userIds })
|
|
42
|
+
: this.apiClient.api.user.getUsers({ ids: userIds });
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Sends a availability update to members of the same team
|
|
46
|
+
* @param teamId
|
|
47
|
+
* @param type
|
|
48
|
+
* @param options.sendAll=false will broadcast the message to all the members of the team (instead of just direct connections). Should be avoided in a big team
|
|
49
|
+
* @param options.sendAsProtobuf=false
|
|
50
|
+
*/
|
|
51
|
+
async setAvailability(teamId, type, { sendAll = false, sendAsProtobuf = false } = {}) {
|
|
52
|
+
// Get pre-key bundles for members of your own team
|
|
53
|
+
const preKeyBundlesFromTeam = await this.broadcastService.getPreKeyBundlesFromTeam(teamId, false, !sendAll);
|
|
54
|
+
// Get pre-key bundles for all of your other 1:1 connections
|
|
55
|
+
const connections = await this.connectionService.getConnections();
|
|
56
|
+
const acceptedConnections = connections.filter(connection => connection.status === connection_1.ConnectionStatus.ACCEPTED);
|
|
57
|
+
const preKeyBundlePromises = acceptedConnections.map(connection => {
|
|
58
|
+
const mappedConnection = {
|
|
59
|
+
userId: connection.to,
|
|
60
|
+
conversationId: connection.conversation,
|
|
61
|
+
};
|
|
62
|
+
return (0, PreKeyBundle_1.getPreKeyBundleMap)({
|
|
63
|
+
apiClient: this.apiClient,
|
|
64
|
+
conversationId: { id: mappedConnection.conversationId, domain: '' },
|
|
65
|
+
userIds: [mappedConnection.userId],
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
const preKeyBundlesFromConnections = await Promise.all(preKeyBundlePromises);
|
|
69
|
+
// Merge pre-key bundles
|
|
70
|
+
const allPreKeyBundles = preKeyBundlesFromConnections.reduce((accumulator, preKeyBundleMap) => {
|
|
71
|
+
return Object.assign(Object.assign({}, accumulator), preKeyBundleMap);
|
|
72
|
+
}, preKeyBundlesFromTeam);
|
|
73
|
+
const genericMessage = protocol_messaging_1.GenericMessage.create({
|
|
74
|
+
availability: new protocol_messaging_1.Availability({ type }),
|
|
75
|
+
messageId: (0, MessageBuilder_1.createId)(),
|
|
76
|
+
});
|
|
77
|
+
// Broadcast availability status to your team members & external 1:1 connections
|
|
78
|
+
await this.broadcastService.broadcastGenericMessage(genericMessage, allPreKeyBundles, sendAsProtobuf);
|
|
34
79
|
}
|
|
35
80
|
}
|
|
36
81
|
exports.UserService = UserService;
|
|
@@ -2,13 +2,10 @@ type ScheduleTaskParams = {
|
|
|
2
2
|
task: () => void;
|
|
3
3
|
firingDate: number;
|
|
4
4
|
key: string;
|
|
5
|
-
persist?: boolean;
|
|
6
5
|
};
|
|
7
6
|
export declare const TaskScheduler: {
|
|
8
|
-
addTask: ({ task, firingDate, key
|
|
7
|
+
addTask: ({ task, firingDate, key }: ScheduleTaskParams) => void;
|
|
9
8
|
cancelTask: (key: string) => void;
|
|
10
|
-
continueTask: ({ key, task }: Omit<ScheduleTaskParams, 'firingDate' | 'persist'>) => void;
|
|
11
|
-
hasActiveTask: (key: string) => boolean;
|
|
12
9
|
};
|
|
13
10
|
export {};
|
|
14
11
|
//# sourceMappingURL=TaskScheduler.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TaskScheduler.d.ts","sourceRoot":"","sources":["../../../src/util/TaskScheduler/TaskScheduler.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"TaskScheduler.d.ts","sourceRoot":"","sources":["../../../src/util/TaskScheduler/TaskScheduler.ts"],"names":[],"mappings":"AA0BA,KAAK,kBAAkB,GAAG;IACxB,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,GAAG,EAAE,MAAM,CAAC;CACb,CAAC;AAiDF,eAAO,MAAM,aAAa;yCAtCgB,kBAAkB;sBA6BnC,MAAM;CAY9B,CAAC"}
|
|
@@ -23,7 +23,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
23
23
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
24
|
exports.TaskScheduler = void 0;
|
|
25
25
|
const logdown_1 = __importDefault(require("logdown"));
|
|
26
|
-
const TaskScheduler_store_1 = require("./TaskScheduler.store");
|
|
27
26
|
const logger = (0, logdown_1.default)('@wireapp/core/TaskScheduler', {
|
|
28
27
|
logger: console,
|
|
29
28
|
markdown: false,
|
|
@@ -36,27 +35,20 @@ const activeTimeouts = {};
|
|
|
36
35
|
* @param firingDate execution date
|
|
37
36
|
* @param key unique key for the task
|
|
38
37
|
*/
|
|
39
|
-
const addTask = ({ task, firingDate, key
|
|
40
|
-
const now = Date
|
|
38
|
+
const addTask = ({ task, firingDate, key }) => {
|
|
39
|
+
const now = new Date();
|
|
41
40
|
const execute = new Date(firingDate);
|
|
42
|
-
const delay = execute.getTime() - now;
|
|
43
|
-
if (TaskScheduler_store_1.TaskSchedulerStore.has(key)) {
|
|
44
|
-
TaskScheduler_store_1.TaskSchedulerStore.remove(key);
|
|
45
|
-
}
|
|
41
|
+
const delay = execute.getTime() - now.getTime();
|
|
46
42
|
if (activeTimeouts[key]) {
|
|
47
43
|
cancelTask(key);
|
|
48
44
|
}
|
|
49
45
|
const timeout = setTimeout(async () => {
|
|
50
46
|
logger.info(`Executing task with key "${key}"`);
|
|
51
47
|
delete activeTimeouts[key];
|
|
52
|
-
TaskScheduler_store_1.TaskSchedulerStore.remove(key);
|
|
53
48
|
await task();
|
|
54
49
|
}, delay > 0 ? delay : 0);
|
|
55
50
|
// add the task to the list of active tasks
|
|
56
51
|
activeTimeouts[key] = timeout;
|
|
57
|
-
if (persist) {
|
|
58
|
-
TaskScheduler_store_1.TaskSchedulerStore.add(key, firingDate);
|
|
59
|
-
}
|
|
60
52
|
logger.info(`New scheduled task to be executed at "${execute}" with key "${key}"`);
|
|
61
53
|
};
|
|
62
54
|
/**
|
|
@@ -72,20 +64,7 @@ const cancelTask = (key) => {
|
|
|
72
64
|
logger.info(`Scheduled task with key "${key}" prematurely cleared`);
|
|
73
65
|
}
|
|
74
66
|
};
|
|
75
|
-
/**
|
|
76
|
-
* Checks if a task has been scheduled in the past and reschedules it
|
|
77
|
-
* @param task function to be executed
|
|
78
|
-
* @param key unique key for the task
|
|
79
|
-
*/
|
|
80
|
-
const continueTask = ({ key, task }) => {
|
|
81
|
-
const activeTaskEndTime = TaskScheduler_store_1.TaskSchedulerStore.get(key);
|
|
82
|
-
if (activeTaskEndTime) {
|
|
83
|
-
addTask({ task, firingDate: activeTaskEndTime, key, persist: true });
|
|
84
|
-
}
|
|
85
|
-
};
|
|
86
67
|
exports.TaskScheduler = {
|
|
87
68
|
addTask,
|
|
88
69
|
cancelTask,
|
|
89
|
-
continueTask,
|
|
90
|
-
hasActiveTask: TaskScheduler_store_1.TaskSchedulerStore.has,
|
|
91
70
|
};
|
|
@@ -2,6 +2,7 @@ import { Conversation, QualifiedUserClients, UserClients } from '@wireapp/api-cl
|
|
|
2
2
|
import { QualifiedId } from '@wireapp/api-client/lib/user/';
|
|
3
3
|
import { MLSConversation } from '../messagingProtocols/mls/types';
|
|
4
4
|
export declare function isStringArray(obj: any): obj is string[];
|
|
5
|
+
export declare function isQualifiedId(obj: any): obj is QualifiedId;
|
|
5
6
|
export declare function isQualifiedIdArray(obj: any): obj is QualifiedId[];
|
|
6
7
|
export declare function isQualifiedUserClients(obj: any): obj is QualifiedUserClients;
|
|
7
8
|
export declare function isUserClients(obj: any): obj is UserClients;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TypePredicateUtil.d.ts","sourceRoot":"","sources":["../../src/util/TypePredicateUtil.ts"],"names":[],"mappings":"AAmBA,OAAO,EACL,YAAY,EAEZ,oBAAoB,EACpB,WAAW,EACZ,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAAC,WAAW,EAAC,MAAM,+BAA+B,CAAC;AAE1D,OAAO,EAAC,eAAe,EAAC,MAAM,iCAAiC,CAAC;AAEhE,wBAAgB,aAAa,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG,IAAI,MAAM,EAAE,CAEvD;
|
|
1
|
+
{"version":3,"file":"TypePredicateUtil.d.ts","sourceRoot":"","sources":["../../src/util/TypePredicateUtil.ts"],"names":[],"mappings":"AAmBA,OAAO,EACL,YAAY,EAEZ,oBAAoB,EACpB,WAAW,EACZ,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAAC,WAAW,EAAC,MAAM,+BAA+B,CAAC;AAE1D,OAAO,EAAC,eAAe,EAAC,MAAM,iCAAiC,CAAC;AAEhE,wBAAgB,aAAa,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG,IAAI,MAAM,EAAE,CAEvD;AAED,wBAAgB,aAAa,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG,IAAI,WAAW,CAE1D;AAED,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG,IAAI,WAAW,EAAE,CAEjE;AAED,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG,IAAI,oBAAoB,CAS5E;AAED,wBAAgB,aAAa,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG,IAAI,WAAW,CAM1D;AAED,wBAAgB,iBAAiB,CAAC,YAAY,EAAE,YAAY,GAAG,YAAY,IAAI,eAAe,CAG7F"}
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
*
|
|
19
19
|
*/
|
|
20
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
-
exports.isMLSConversation = exports.isUserClients = exports.isQualifiedUserClients = exports.isQualifiedIdArray = exports.isStringArray = void 0;
|
|
21
|
+
exports.isMLSConversation = exports.isUserClients = exports.isQualifiedUserClients = exports.isQualifiedIdArray = exports.isQualifiedId = exports.isStringArray = void 0;
|
|
22
22
|
const conversation_1 = require("@wireapp/api-client/lib/conversation/");
|
|
23
23
|
function isStringArray(obj) {
|
|
24
24
|
return Array.isArray(obj) && (obj.length === 0 || typeof obj[0] === 'string');
|
|
@@ -27,6 +27,7 @@ exports.isStringArray = isStringArray;
|
|
|
27
27
|
function isQualifiedId(obj) {
|
|
28
28
|
return typeof obj === 'object' && typeof obj['domain'] === 'string';
|
|
29
29
|
}
|
|
30
|
+
exports.isQualifiedId = isQualifiedId;
|
|
30
31
|
function isQualifiedIdArray(obj) {
|
|
31
32
|
return Array.isArray(obj) && isQualifiedId(obj[0]);
|
|
32
33
|
}
|
package/package.json
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"dependencies": {
|
|
14
14
|
"@wireapp/api-client": "^24.15.5",
|
|
15
15
|
"@wireapp/commons": "^5.1.0",
|
|
16
|
-
"@wireapp/core-crypto": "0.
|
|
16
|
+
"@wireapp/core-crypto": "1.0.0-pre.5",
|
|
17
17
|
"@wireapp/cryptobox": "12.8.0",
|
|
18
18
|
"@wireapp/promise-queue": "^2.2.0",
|
|
19
19
|
"@wireapp/protocol-messaging": "1.44.0",
|
|
@@ -60,6 +60,6 @@
|
|
|
60
60
|
"test:coverage": "jest --coverage",
|
|
61
61
|
"watch": "tsc --watch"
|
|
62
62
|
},
|
|
63
|
-
"version": "40.5.
|
|
64
|
-
"gitHead": "
|
|
63
|
+
"version": "40.5.3-draft-20-cc.3+eb1ee03af",
|
|
64
|
+
"gitHead": "eb1ee03af53d793cd367ddf15f3f2a93cf73f9bc"
|
|
65
65
|
}
|
|
@@ -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 +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
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TaskScheduler.store.d.ts","sourceRoot":"","sources":["../../../src/util/TaskScheduler/TaskScheduler.store.ts"],"names":[],"mappings":"AAqBA,eAAO,MAAM,kBAAkB;eAClB,MAAM;eAON,MAAM,cAAc,MAAM;kBACvB,MAAM;eACT,MAAM;CAClB,CAAC"}
|
|
@@ -1,34 +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.TaskSchedulerStore = void 0;
|
|
22
|
-
const prependKey = (key) => `TaskScheduler_${key}`;
|
|
23
|
-
exports.TaskSchedulerStore = {
|
|
24
|
-
get: (key) => {
|
|
25
|
-
const value = localStorage.getItem(prependKey(key));
|
|
26
|
-
if (value) {
|
|
27
|
-
return Number(value);
|
|
28
|
-
}
|
|
29
|
-
return undefined;
|
|
30
|
-
},
|
|
31
|
-
add: (key, firingDate) => localStorage.setItem(prependKey(key), String(firingDate)),
|
|
32
|
-
remove: (key) => localStorage.removeItem(prependKey(key)),
|
|
33
|
-
has: (key) => !!localStorage.getItem(prependKey(key)),
|
|
34
|
-
};
|