@wireapp/core 31.1.3 → 31.1.4

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 (227) hide show
  1. package/package.json +9 -8
  2. package/src/main/Account.d.ts +214 -0
  3. package/src/main/Account.js +463 -0
  4. package/src/main/CoreError.d.ts +9 -0
  5. package/src/main/CoreError.js +26 -0
  6. package/src/main/account/AccountService.d.ts +7 -0
  7. package/src/main/account/AccountService.js +33 -0
  8. package/src/main/account/AccountService.js.map +1 -0
  9. package/src/main/account/index.d.ts +1 -0
  10. package/src/main/account/index.js +36 -0
  11. package/src/main/account/index.js.map +1 -0
  12. package/src/main/auth/LoginSanitizer.d.ts +5 -0
  13. package/src/main/auth/LoginSanitizer.js +41 -0
  14. package/src/main/auth/index.d.ts +1 -0
  15. package/src/main/auth/index.js +36 -0
  16. package/src/main/broadcast/AvailabilityType.d.ts +2 -0
  17. package/src/main/broadcast/AvailabilityType.js +21 -0
  18. package/src/main/broadcast/BroadcastService.d.ts +24 -0
  19. package/src/main/broadcast/BroadcastService.js +74 -0
  20. package/src/main/broadcast/index.d.ts +2 -0
  21. package/src/main/broadcast/index.js +37 -0
  22. package/src/main/client/ClientBackendRepository.d.ts +11 -0
  23. package/src/main/client/ClientBackendRepository.js +43 -0
  24. package/src/main/client/ClientDatabaseRepository.d.ts +27 -0
  25. package/src/main/client/ClientDatabaseRepository.js +85 -0
  26. package/src/main/client/ClientInfo.d.ts +8 -0
  27. package/src/main/client/ClientInfo.js +21 -0
  28. package/src/main/client/ClientService.d.ts +40 -0
  29. package/src/main/client/ClientService.js +103 -0
  30. package/src/main/client/index.d.ts +4 -0
  31. package/src/main/client/index.js +39 -0
  32. package/src/main/connection/ConnectionService.d.ts +11 -0
  33. package/src/main/connection/ConnectionService.js +45 -0
  34. package/src/main/connection/index.d.ts +1 -0
  35. package/src/main/connection/index.js +36 -0
  36. package/src/main/conversation/AbortReason.d.ts +2 -0
  37. package/src/main/conversation/AbortReason.js +21 -0
  38. package/src/main/conversation/AssetService/AssetService.d.ts +62 -0
  39. package/src/main/conversation/AssetService/AssetService.js +88 -0
  40. package/src/main/conversation/AssetService/index.d.ts +1 -0
  41. package/src/main/conversation/AssetService/index.js +36 -0
  42. package/src/main/conversation/AssetTransferState.d.ts +4 -0
  43. package/src/main/conversation/AssetTransferState.js +27 -0
  44. package/src/main/conversation/ClientActionType.d.ts +1 -0
  45. package/src/main/conversation/ClientActionType.js +24 -0
  46. package/src/main/conversation/ConversationMapper/ConversationMapper.d.ts +6 -0
  47. package/src/main/conversation/ConversationMapper/ConversationMapper.js +57 -0
  48. package/src/main/conversation/ConversationMapper/index.d.ts +1 -0
  49. package/src/main/conversation/ConversationMapper/index.js +36 -0
  50. package/src/main/conversation/ConversationService/ConversationService.d.ts +149 -0
  51. package/src/main/conversation/ConversationService/ConversationService.js +584 -0
  52. package/src/main/conversation/ConversationService/ConversationService.types.d.ts +110 -0
  53. package/src/main/conversation/ConversationService/ConversationService.types.js +28 -0
  54. package/src/main/conversation/ConversationService/index.d.ts +2 -0
  55. package/src/main/conversation/ConversationService/index.js +37 -0
  56. package/src/main/conversation/ConversationService/messageGenerator.d.ts +9 -0
  57. package/src/main/conversation/ConversationService/messageGenerator.js +313 -0
  58. package/src/main/conversation/GenericMessageType.d.ts +25 -0
  59. package/src/main/conversation/GenericMessageType.js +49 -0
  60. package/src/main/conversation/MessageTimer/MessageTimer.d.ts +10 -0
  61. package/src/main/conversation/MessageTimer/MessageTimer.js +54 -0
  62. package/src/main/conversation/MessageTimer/index.d.ts +1 -0
  63. package/src/main/conversation/MessageTimer/index.js +36 -0
  64. package/src/main/conversation/ReactionType.d.ts +4 -0
  65. package/src/main/conversation/ReactionType.js +27 -0
  66. package/src/main/conversation/content/AssetContent.d.ts +42 -0
  67. package/src/main/conversation/content/AssetContent.js +21 -0
  68. package/src/main/conversation/content/ButtonActionConfirmationContent.d.ts +2 -0
  69. package/src/main/conversation/content/ButtonActionConfirmationContent.js +21 -0
  70. package/src/main/conversation/content/ButtonActionContent.d.ts +2 -0
  71. package/src/main/conversation/content/ButtonActionContent.js +21 -0
  72. package/src/main/conversation/content/CallingContent.d.ts +1 -0
  73. package/src/main/conversation/content/CallingContent.js +21 -0
  74. package/src/main/conversation/content/ClearedContent.d.ts +2 -0
  75. package/src/main/conversation/content/ClearedContent.js +21 -0
  76. package/src/main/conversation/content/ClientActionContent.d.ts +2 -0
  77. package/src/main/conversation/content/ClientActionContent.js +21 -0
  78. package/src/main/conversation/content/ClientAddContent.d.ts +4 -0
  79. package/src/main/conversation/content/ClientAddContent.js +21 -0
  80. package/src/main/conversation/content/ClientRemoveContent.d.ts +6 -0
  81. package/src/main/conversation/content/ClientRemoveContent.js +21 -0
  82. package/src/main/conversation/content/CompositeContent.d.ts +2 -0
  83. package/src/main/conversation/content/CompositeContent.js +21 -0
  84. package/src/main/conversation/content/ConfirmationContent.d.ts +2 -0
  85. package/src/main/conversation/content/ConfirmationContent.js +21 -0
  86. package/src/main/conversation/content/ContentType.d.ts +21 -0
  87. package/src/main/conversation/content/ContentType.js +94 -0
  88. package/src/main/conversation/content/ConversationContent.d.ts +3 -0
  89. package/src/main/conversation/content/ConversationContent.js +21 -0
  90. package/src/main/conversation/content/DeletedContent.d.ts +2 -0
  91. package/src/main/conversation/content/DeletedContent.js +21 -0
  92. package/src/main/conversation/content/EditedTextContent.d.ts +11 -0
  93. package/src/main/conversation/content/EditedTextContent.js +21 -0
  94. package/src/main/conversation/content/FileContent.d.ts +13 -0
  95. package/src/main/conversation/content/FileContent.js +21 -0
  96. package/src/main/conversation/content/HiddenContent.d.ts +2 -0
  97. package/src/main/conversation/content/HiddenContent.js +21 -0
  98. package/src/main/conversation/content/ImageContent.d.ts +7 -0
  99. package/src/main/conversation/content/ImageContent.js +21 -0
  100. package/src/main/conversation/content/KnockContent.d.ts +2 -0
  101. package/src/main/conversation/content/KnockContent.js +21 -0
  102. package/src/main/conversation/content/LinkPreviewContent.d.ts +10 -0
  103. package/src/main/conversation/content/LinkPreviewContent.js +21 -0
  104. package/src/main/conversation/content/LocationContent.d.ts +9 -0
  105. package/src/main/conversation/content/LocationContent.js +21 -0
  106. package/src/main/conversation/content/MentionContent.d.ts +2 -0
  107. package/src/main/conversation/content/MentionContent.js +21 -0
  108. package/src/main/conversation/content/QuoteContent.d.ts +7 -0
  109. package/src/main/conversation/content/QuoteContent.js +21 -0
  110. package/src/main/conversation/content/ReactionContent.d.ts +7 -0
  111. package/src/main/conversation/content/ReactionContent.js +21 -0
  112. package/src/main/conversation/content/TextContent.d.ts +9 -0
  113. package/src/main/conversation/content/TextContent.js +21 -0
  114. package/src/main/conversation/content/TweetContent.d.ts +2 -0
  115. package/src/main/conversation/content/TweetContent.js +21 -0
  116. package/src/main/conversation/content/index.d.ts +28 -0
  117. package/src/main/conversation/content/index.js +76 -0
  118. package/src/main/conversation/index.d.ts +9 -0
  119. package/src/main/conversation/index.js +44 -0
  120. package/src/main/conversation/message/CompositeContentBuilder.d.ts +14 -0
  121. package/src/main/conversation/message/CompositeContentBuilder.js +54 -0
  122. package/src/main/conversation/message/Message.d.ts +4 -0
  123. package/src/main/conversation/message/Message.js +21 -0
  124. package/src/main/conversation/message/MessageBuilder.d.ts +96 -0
  125. package/src/main/conversation/message/MessageBuilder.js +125 -0
  126. package/src/main/conversation/message/MessageService.d.ts +67 -0
  127. package/src/main/conversation/message/MessageService.js +293 -0
  128. package/src/main/conversation/message/MessageToProtoMapper.d.ts +7 -0
  129. package/src/main/conversation/message/MessageToProtoMapper.js +99 -0
  130. package/src/main/conversation/message/OtrMessage.d.ts +80 -0
  131. package/src/main/conversation/message/OtrMessage.js +21 -0
  132. package/src/main/conversation/message/PayloadBundle.d.ts +76 -0
  133. package/src/main/conversation/message/PayloadBundle.js +81 -0
  134. package/src/main/conversation/message/TeamMessage.d.ts +31 -0
  135. package/src/main/conversation/message/TeamMessage.js +21 -0
  136. package/src/main/conversation/message/TextContentBuilder.d.ts +13 -0
  137. package/src/main/conversation/message/TextContentBuilder.js +75 -0
  138. package/src/main/conversation/message/UserClientsUtil.d.ts +22 -0
  139. package/src/main/conversation/message/UserClientsUtil.js +38 -0
  140. package/src/main/conversation/message/UserMessage.d.ts +43 -0
  141. package/src/main/conversation/message/UserMessage.js +21 -0
  142. package/src/main/conversation/message/messageSender.d.ts +4 -0
  143. package/src/main/conversation/message/messageSender.js +36 -0
  144. package/src/main/cryptography/AssetCryptography/EncryptedAsset.d.ts +11 -0
  145. package/src/main/cryptography/AssetCryptography/EncryptedAsset.js +21 -0
  146. package/src/main/cryptography/AssetCryptography/crypto.browser.d.ts +2 -0
  147. package/src/main/cryptography/AssetCryptography/crypto.browser.js +46 -0
  148. package/src/main/cryptography/AssetCryptography/crypto.node.d.ts +2 -0
  149. package/src/main/cryptography/AssetCryptography/crypto.node.js +72 -0
  150. package/src/main/cryptography/AssetCryptography/index.d.ts +8 -0
  151. package/src/main/cryptography/AssetCryptography/index.js +53 -0
  152. package/src/main/cryptography/AssetCryptography/interfaces.d.ts +9 -0
  153. package/src/main/cryptography/AssetCryptography/interfaces.js +21 -0
  154. package/src/main/cryptography/CryptographyDatabaseRepository.d.ts +16 -0
  155. package/src/main/cryptography/CryptographyDatabaseRepository.js +44 -0
  156. package/src/main/cryptography/CryptographyService.d.ts +52 -0
  157. package/src/main/cryptography/CryptographyService.js +205 -0
  158. package/src/main/cryptography/GenericMessageMapper.d.ts +6 -0
  159. package/src/main/cryptography/GenericMessageMapper.js +160 -0
  160. package/src/main/cryptography/MessageHashService.d.ts +16 -0
  161. package/src/main/cryptography/MessageHashService.js +118 -0
  162. package/src/main/cryptography/SessionPayloadBundle.d.ts +4 -0
  163. package/src/main/cryptography/SessionPayloadBundle.js +21 -0
  164. package/src/main/cryptography/index.d.ts +4 -0
  165. package/src/main/cryptography/index.js +39 -0
  166. package/src/main/giphy/GiphyService.d.ts +9 -0
  167. package/src/main/giphy/GiphyService.js +37 -0
  168. package/src/main/giphy/index.d.ts +1 -0
  169. package/src/main/giphy/index.js +36 -0
  170. package/src/main/index.d.ts +17 -0
  171. package/src/main/index.js +59 -0
  172. package/src/main/linkPreview/LinkPreviewService.d.ts +7 -0
  173. package/src/main/linkPreview/LinkPreviewService.js +52 -0
  174. package/src/main/linkPreview/index.d.ts +1 -0
  175. package/src/main/linkPreview/index.js +36 -0
  176. package/src/main/mls/MLSService/MLSService.d.ts +39 -0
  177. package/src/main/mls/MLSService/MLSService.js +181 -0
  178. package/src/main/mls/index.d.ts +1 -0
  179. package/src/main/mls/index.js +36 -0
  180. package/src/main/mls/keyMaterialUpdatesStore/index.d.ts +1 -0
  181. package/src/main/mls/keyMaterialUpdatesStore/index.js +36 -0
  182. package/src/main/mls/keyMaterialUpdatesStore/keyMaterialUpdatesStore.d.ts +9 -0
  183. package/src/main/mls/keyMaterialUpdatesStore/keyMaterialUpdatesStore.js +51 -0
  184. package/src/main/mls/keyPackagesStatusStore/keyPackagesStatusStore.d.ts +7 -0
  185. package/src/main/mls/keyPackagesStatusStore/keyPackagesStatusStore.js +42 -0
  186. package/src/main/mls/types.d.ts +33 -0
  187. package/src/main/mls/types.js +21 -0
  188. package/src/main/notification/NotificationBackendRepository.d.ts +11 -0
  189. package/src/main/notification/NotificationBackendRepository.js +34 -0
  190. package/src/main/notification/NotificationDatabaseRepository.d.ts +42 -0
  191. package/src/main/notification/NotificationDatabaseRepository.js +97 -0
  192. package/src/main/notification/NotificationService.d.ts +129 -0
  193. package/src/main/notification/NotificationService.js +501 -0
  194. package/src/main/notification/index.d.ts +1 -0
  195. package/src/main/notification/index.js +36 -0
  196. package/src/main/notification/types.d.ts +16 -0
  197. package/src/main/notification/types.js +21 -0
  198. package/src/main/self/SelfService.d.ts +13 -0
  199. package/src/main/self/SelfService.js +55 -0
  200. package/src/main/self/index.d.ts +1 -0
  201. package/src/main/self/index.js +36 -0
  202. package/src/main/team/TeamService.d.ts +15 -0
  203. package/src/main/team/TeamService.js +55 -0
  204. package/src/main/team/index.d.ts +1 -0
  205. package/src/main/team/index.js +36 -0
  206. package/src/main/test/CryptographyHelper.d.ts +4 -0
  207. package/src/main/test/CryptographyHelper.js +69 -0
  208. package/src/main/test/PayloadHelper.d.ts +3 -0
  209. package/src/main/test/PayloadHelper.js +66 -0
  210. package/src/main/user/UserMapper.d.ts +5 -0
  211. package/src/main/user/UserMapper.js +88 -0
  212. package/src/main/user/UserService.d.ts +25 -0
  213. package/src/main/user/UserService.js +81 -0
  214. package/src/main/user/index.d.ts +1 -0
  215. package/src/main/user/index.js +36 -0
  216. package/src/main/util/LowPrecisionTaskScheduler/LowPrecisionTaskScheduler.d.ts +21 -0
  217. package/src/main/util/LowPrecisionTaskScheduler/LowPrecisionTaskScheduler.js +62 -0
  218. package/src/main/util/TaskScheduler/TaskScheduler.d.ts +10 -0
  219. package/src/main/util/TaskScheduler/TaskScheduler.js +70 -0
  220. package/src/main/util/TypePredicateUtil.d.ts +7 -0
  221. package/src/main/util/TypePredicateUtil.js +55 -0
  222. package/src/main/util/encryptedStore.d.ts +45 -0
  223. package/src/main/util/encryptedStore.js +116 -0
  224. package/src/main/util/fullyQualifiedClientIdUtils.d.ts +13 -0
  225. package/src/main/util/fullyQualifiedClientIdUtils.js +42 -0
  226. package/src/main/util/index.d.ts +1 -0
  227. package/src/main/util/index.js +36 -0
@@ -0,0 +1,110 @@
1
+ import { GenericMessage } from '@wireapp/protocol-messaging';
2
+ import { QualifiedUserClients, ClientMismatch, ConversationProtocol, MessageSendingStatus, UserClients, Conversation } from '@wireapp/api-client/src/conversation';
3
+ import { QualifiedId } from '@wireapp/api-client/src/user';
4
+ import { MlsEvent } from '@wireapp/api-client/src/conversation/data/MlsEventData';
5
+ export declare enum MessageTargetMode {
6
+ NONE = 0,
7
+ USERS = 1,
8
+ USERS_CLIENTS = 2
9
+ }
10
+ export interface MessageSendingOptions {
11
+ /**
12
+ * The federated domain the server runs on. Should only be set for federation enabled envs
13
+ */
14
+ conversationDomain?: string;
15
+ /**
16
+ * can be either a QualifiedId[] or QualfiedUserClients or undefined. The type has some effect on the behavior of the method.
17
+ * When given undefined the method will fetch both the members of the conversations and their devices. No ClientMismatch can happen in that case
18
+ * When given a QualifiedId[] the method will fetch the freshest list of devices for those users (since they are not given by the consumer). As a consequence no ClientMismatch error will trigger and we will ignore missing clients when sending
19
+ * When given a QualifiedUserClients the method will only send to the clients listed in the userIds. This could lead to ClientMismatch (since the given list of devices might not be the freshest one and new clients could have been created)
20
+ */
21
+ userIds?: string[] | QualifiedId[] | UserClients | QualifiedUserClients;
22
+ /**
23
+ * Will send the message as a protobuf payload
24
+ */
25
+ sendAsProtobuf?: boolean;
26
+ nativePush?: boolean;
27
+ /**
28
+ * Will be called whenever there is a clientmismatch returned from the server. Needs to be combined with a userIds of type QualifiedUserClients
29
+ */
30
+ onClientMismatch?: MessageSendingCallbacks['onClientMismatch'];
31
+ /**
32
+ * Defines the behavior to use when a mismatch happens on backend side:
33
+ * - NONE -> Not a targetted message, we want to send to all the users/clients in the conversation. Will report all missing users and clients (default mode)
34
+ * - USERS -> A message targetted to all the clients of the given users (according to params.userIds). Will ignore missing users and only report missing clients for the given params.userIds
35
+ * - USERS_CLIENTS -> A message targetted at some specific clients of specific users (according to params.userIds). Will force sending the message even if users or clients are missing
36
+ */
37
+ targetMode?: MessageTargetMode;
38
+ }
39
+ export interface MessageSendingCallbacks {
40
+ /**
41
+ * Will be called before a message is actually sent. Returning 'false' will prevent the message from being sent
42
+ * @param message The message being sent
43
+ * @return true or undefined if the message should be sent, false if the message sending should be cancelled
44
+ */
45
+ onStart?: (message: GenericMessage) => void | boolean | Promise<boolean>;
46
+ onSuccess?: (message: GenericMessage, sentTime?: string) => void;
47
+ /**
48
+ * Called whenever there is a clientmismatch returned from the server. Will also indicate the sending status of the message (if it was already sent or not)
49
+ *
50
+ * @param status The mismatch info
51
+ * @param wasSent Indicate whether the message was already sent or if it can still be canceled
52
+ * @return
53
+ */
54
+ onClientMismatch?: (status: ClientMismatch | MessageSendingStatus, wasSent: boolean) => void | boolean | Promise<boolean>;
55
+ }
56
+ /**
57
+ * ######################################################################
58
+ * ################ MLS and Proteus implementation types ################
59
+ * ######################################################################
60
+ */
61
+ /**
62
+ * The protocol to use to send the message (MLS or Proteus)
63
+ */
64
+ export declare type ProtocolParam = {
65
+ protocol: ConversationProtocol;
66
+ };
67
+ /**
68
+ * The message to send to the conversation
69
+ */
70
+ export declare type SendCommonParams<T> = ProtocolParam & {
71
+ payload: T;
72
+ onStart?: (message: GenericMessage) => void | boolean | Promise<boolean>;
73
+ onSuccess?: (message: GenericMessage, sentTime?: string) => void;
74
+ };
75
+ export declare type SendProteusMessageParams<T> = SendCommonParams<T> & MessageSendingOptions & {
76
+ /**
77
+ * Can be either a QualifiedId[], string[], UserClients or QualfiedUserClients. The type has some effect on the behavior of the method. (Needed only for Proteus)
78
+ * When given a QualifiedId[] or string[] the method will fetch the freshest list of devices for those users (since they are not given by the consumer). As a consequence no ClientMismatch error will trigger and we will ignore missing clients when sending
79
+ * When given a QualifiedUserClients or UserClients the method will only send to the clients listed in the userIds. This could lead to ClientMismatch (since the given list of devices might not be the freshest one and new clients could have been created)
80
+ * When given a QualifiedId[] or QualifiedUserClients the method will send the message through the federated API endpoint
81
+ * When given a string[] or UserClients the method will send the message through the old API endpoint
82
+ */
83
+ userIds?: string[] | QualifiedId[] | UserClients | QualifiedUserClients;
84
+ onClientMismatch?: (status: ClientMismatch | MessageSendingStatus, wasSent: boolean) => void | boolean | Promise<boolean>;
85
+ protocol: ConversationProtocol.PROTEUS;
86
+ };
87
+ export declare type SendMlsMessageParams<T> = SendCommonParams<T> & {
88
+ /**
89
+ * The groupId of the conversation to send the message to (Needed only for MLS)
90
+ */
91
+ groupId: string;
92
+ protocol: ConversationProtocol.MLS;
93
+ };
94
+ export declare type QualifiedUsers = QualifiedId & {
95
+ skipOwn?: string;
96
+ };
97
+ export declare type AddUsersParams = {
98
+ conversationId: QualifiedId;
99
+ qualifiedUserIds: QualifiedId[];
100
+ groupId?: string;
101
+ };
102
+ export declare type RemoveUsersParams = {
103
+ conversationId: QualifiedId;
104
+ qualifiedUserIds: QualifiedId[];
105
+ groupId: string;
106
+ };
107
+ export declare type MLSReturnType = {
108
+ events: MlsEvent[];
109
+ conversation: Conversation;
110
+ };
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ /*
3
+ * Wire
4
+ * Copyright (C) 2022 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.MessageTargetMode = void 0;
22
+ var MessageTargetMode;
23
+ (function (MessageTargetMode) {
24
+ MessageTargetMode[MessageTargetMode["NONE"] = 0] = "NONE";
25
+ MessageTargetMode[MessageTargetMode["USERS"] = 1] = "USERS";
26
+ MessageTargetMode[MessageTargetMode["USERS_CLIENTS"] = 2] = "USERS_CLIENTS";
27
+ })(MessageTargetMode = exports.MessageTargetMode || (exports.MessageTargetMode = {}));
28
+ //# sourceMappingURL=ConversationService.types.js.map
@@ -0,0 +1,2 @@
1
+ export * from './ConversationService.types';
2
+ export * from './ConversationService';
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ /*
3
+ * Wire
4
+ * Copyright (C) 2022 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
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
21
+ if (k2 === undefined) k2 = k;
22
+ var desc = Object.getOwnPropertyDescriptor(m, k);
23
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
24
+ desc = { enumerable: true, get: function() { return m[k]; } };
25
+ }
26
+ Object.defineProperty(o, k2, desc);
27
+ }) : (function(o, m, k, k2) {
28
+ if (k2 === undefined) k2 = k;
29
+ o[k2] = m[k];
30
+ }));
31
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
32
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
33
+ };
34
+ Object.defineProperty(exports, "__esModule", { value: true });
35
+ __exportStar(require("./ConversationService.types"), exports);
36
+ __exportStar(require("./ConversationService"), exports);
37
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,9 @@
1
+ import { OtrMessage } from '../message/OtrMessage';
2
+ import { GenericMessage } from '@wireapp/protocol-messaging';
3
+ import { MessageTimer } from '../MessageTimer';
4
+ interface GeneratedMessage<T extends OtrMessage> {
5
+ genericMessage: GenericMessage;
6
+ content: T['content'];
7
+ }
8
+ export declare function generateGenericMessage<T extends OtrMessage>(payload: T, messageTimer: MessageTimer): GeneratedMessage<T>;
9
+ export {};
@@ -0,0 +1,313 @@
1
+ "use strict";
2
+ /*
3
+ * Wire
4
+ * Copyright (C) 2022 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.generateGenericMessage = void 0;
22
+ const protocol_messaging_1 = require("@wireapp/protocol-messaging");
23
+ const PayloadBundle_1 = require("../message/PayloadBundle");
24
+ const MessageToProtoMapper_1 = require("../message/MessageToProtoMapper");
25
+ const GenericMessageType_1 = require("../GenericMessageType");
26
+ const AssetTransferState_1 = require("../AssetTransferState");
27
+ function generateGenericMessage(payload, messageTimer) {
28
+ const content = payload.content;
29
+ switch (payload.type) {
30
+ case PayloadBundle_1.PayloadBundleType.ASSET:
31
+ return { genericMessage: generateFileDataGenericMessage(payload, messageTimer), content };
32
+ case PayloadBundle_1.PayloadBundleType.ASSET_ABORT:
33
+ return { genericMessage: generateFileAbortGenericMessage(payload, messageTimer), content };
34
+ case PayloadBundle_1.PayloadBundleType.ASSET_META:
35
+ return { genericMessage: generateFileMetaDataGenericMessage(payload, messageTimer), content };
36
+ case PayloadBundle_1.PayloadBundleType.ASSET_IMAGE:
37
+ return generateImageGenericMessage(payload, messageTimer);
38
+ case PayloadBundle_1.PayloadBundleType.BUTTON_ACTION:
39
+ return { genericMessage: generateButtonActionGenericMessage(payload), content };
40
+ case PayloadBundle_1.PayloadBundleType.BUTTON_ACTION_CONFIRMATION:
41
+ return { genericMessage: generateButtonActionConfirmationGenericMessage(payload), content };
42
+ case PayloadBundle_1.PayloadBundleType.CALL:
43
+ return { genericMessage: generateCallGenericMessage(payload), content };
44
+ case PayloadBundle_1.PayloadBundleType.CLIENT_ACTION:
45
+ return { genericMessage: generateSessionResetGenericMessage(payload), content };
46
+ case PayloadBundle_1.PayloadBundleType.COMPOSITE:
47
+ return { genericMessage: generateCompositeGenericMessage(payload), content };
48
+ case PayloadBundle_1.PayloadBundleType.CONFIRMATION:
49
+ return { genericMessage: generateConfirmationGenericMessage(payload), content };
50
+ case PayloadBundle_1.PayloadBundleType.LOCATION:
51
+ return { genericMessage: generateLocationGenericMessage(payload, messageTimer), content };
52
+ case PayloadBundle_1.PayloadBundleType.MESSAGE_EDIT:
53
+ return { genericMessage: generateEditedTextGenericMessage(payload), content };
54
+ case PayloadBundle_1.PayloadBundleType.PING:
55
+ return { genericMessage: generatePingGenericMessage(payload, messageTimer), content };
56
+ case PayloadBundle_1.PayloadBundleType.REACTION:
57
+ return { genericMessage: generateReactionGenericMessage(payload), content };
58
+ case PayloadBundle_1.PayloadBundleType.TEXT:
59
+ return { genericMessage: generateTextGenericMessage(payload, messageTimer), content };
60
+ case PayloadBundle_1.PayloadBundleType.MESSAGE_DELETE:
61
+ return { genericMessage: generateDeleteMessage(payload), content };
62
+ case PayloadBundle_1.PayloadBundleType.MESSAGE_HIDE:
63
+ return { genericMessage: generateHideMessage(payload), content };
64
+ /**
65
+ * ToDo: Create Generic implementation for everything else
66
+ */
67
+ default:
68
+ throw new Error(`No send method implemented for "${payload['type']}".`);
69
+ }
70
+ }
71
+ exports.generateGenericMessage = generateGenericMessage;
72
+ function generateButtonActionGenericMessage(payloadBundle) {
73
+ return protocol_messaging_1.GenericMessage.create({
74
+ [GenericMessageType_1.GenericMessageType.BUTTON_ACTION]: protocol_messaging_1.ButtonAction.create(payloadBundle.content),
75
+ messageId: payloadBundle.id,
76
+ });
77
+ }
78
+ function generateButtonActionConfirmationGenericMessage(payloadBundle) {
79
+ return protocol_messaging_1.GenericMessage.create({
80
+ [GenericMessageType_1.GenericMessageType.BUTTON_ACTION_CONFIRMATION]: protocol_messaging_1.ButtonActionConfirmation.create(payloadBundle.content),
81
+ messageId: payloadBundle.id,
82
+ });
83
+ }
84
+ function generateCompositeGenericMessage(payloadBundle) {
85
+ return protocol_messaging_1.GenericMessage.create({
86
+ [GenericMessageType_1.GenericMessageType.COMPOSITE]: protocol_messaging_1.Composite.create(payloadBundle.content),
87
+ messageId: payloadBundle.id,
88
+ });
89
+ }
90
+ function generateConfirmationGenericMessage(payloadBundle) {
91
+ const content = protocol_messaging_1.Confirmation.create(payloadBundle.content);
92
+ return protocol_messaging_1.GenericMessage.create({
93
+ [GenericMessageType_1.GenericMessageType.CONFIRMATION]: content,
94
+ messageId: payloadBundle.id,
95
+ });
96
+ }
97
+ function generateEditedTextGenericMessage(payloadBundle) {
98
+ const editedMessage = protocol_messaging_1.MessageEdit.create({
99
+ replacingMessageId: payloadBundle.content.originalMessageId,
100
+ text: MessageToProtoMapper_1.MessageToProtoMapper.mapText(payloadBundle),
101
+ });
102
+ return protocol_messaging_1.GenericMessage.create({
103
+ [GenericMessageType_1.GenericMessageType.EDITED]: editedMessage,
104
+ messageId: payloadBundle.id,
105
+ });
106
+ }
107
+ function generateFileDataGenericMessage(payloadBundle, messageTimer) {
108
+ if (!payloadBundle.content) {
109
+ throw new Error('No content for sendFileData provided.');
110
+ }
111
+ const { asset, expectsReadConfirmation, legalHoldStatus } = payloadBundle.content;
112
+ const remoteData = protocol_messaging_1.Asset.RemoteData.create({
113
+ assetId: asset.key,
114
+ assetToken: asset.token,
115
+ otrKey: asset.keyBytes,
116
+ sha256: asset.sha256,
117
+ assetDomain: asset.domain,
118
+ });
119
+ const assetMessage = protocol_messaging_1.Asset.create({
120
+ expectsReadConfirmation,
121
+ legalHoldStatus,
122
+ uploaded: remoteData,
123
+ });
124
+ assetMessage.status = AssetTransferState_1.AssetTransferState.UPLOADED;
125
+ const genericMessage = protocol_messaging_1.GenericMessage.create({
126
+ [GenericMessageType_1.GenericMessageType.ASSET]: assetMessage,
127
+ messageId: payloadBundle.id,
128
+ });
129
+ const expireAfterMillis = messageTimer.getMessageTimer(payloadBundle.conversation);
130
+ return expireAfterMillis > 0 ? createEphemeral(genericMessage, expireAfterMillis) : genericMessage;
131
+ }
132
+ function generateFileMetaDataGenericMessage(payloadBundle, messageTimer) {
133
+ if (!payloadBundle.content) {
134
+ throw new Error('No content for sendFileMetaData provided.');
135
+ }
136
+ const { expectsReadConfirmation, legalHoldStatus, metaData } = payloadBundle.content;
137
+ const original = protocol_messaging_1.Asset.Original.create({
138
+ audio: metaData.audio,
139
+ mimeType: metaData.type,
140
+ name: metaData.name,
141
+ size: metaData.length,
142
+ video: metaData.video,
143
+ image: metaData.image,
144
+ });
145
+ const assetMessage = protocol_messaging_1.Asset.create({
146
+ expectsReadConfirmation,
147
+ legalHoldStatus,
148
+ original,
149
+ });
150
+ const genericMessage = protocol_messaging_1.GenericMessage.create({
151
+ [GenericMessageType_1.GenericMessageType.ASSET]: assetMessage,
152
+ messageId: payloadBundle.id,
153
+ });
154
+ const expireAfterMillis = messageTimer.getMessageTimer(payloadBundle.conversation);
155
+ return expireAfterMillis > 0 ? createEphemeral(genericMessage, expireAfterMillis) : genericMessage;
156
+ }
157
+ function generateFileAbortGenericMessage(payloadBundle, messageTimer) {
158
+ if (!payloadBundle.content) {
159
+ throw new Error('No content for sendFileAbort provided.');
160
+ }
161
+ const { expectsReadConfirmation, legalHoldStatus, reason } = payloadBundle.content;
162
+ const assetMessage = protocol_messaging_1.Asset.create({
163
+ expectsReadConfirmation,
164
+ legalHoldStatus,
165
+ notUploaded: reason,
166
+ });
167
+ assetMessage.status = AssetTransferState_1.AssetTransferState.NOT_UPLOADED;
168
+ const genericMessage = protocol_messaging_1.GenericMessage.create({
169
+ [GenericMessageType_1.GenericMessageType.ASSET]: assetMessage,
170
+ messageId: payloadBundle.id,
171
+ });
172
+ const expireAfterMillis = messageTimer.getMessageTimer(payloadBundle.conversation);
173
+ return expireAfterMillis > 0 ? createEphemeral(genericMessage, expireAfterMillis) : genericMessage;
174
+ }
175
+ function generateImageGenericMessage(payloadBundle, messageTimer) {
176
+ const imageAsset = generateAsset(payloadBundle);
177
+ let genericMessage = protocol_messaging_1.GenericMessage.create({
178
+ [GenericMessageType_1.GenericMessageType.ASSET]: imageAsset,
179
+ messageId: payloadBundle.id,
180
+ });
181
+ const expireAfterMillis = messageTimer.getMessageTimer(payloadBundle.conversation);
182
+ if (expireAfterMillis) {
183
+ genericMessage = createEphemeral(genericMessage, expireAfterMillis);
184
+ }
185
+ return { genericMessage, content: imageAsset };
186
+ }
187
+ function generateLocationGenericMessage(payloadBundle, messageTimer) {
188
+ const { expectsReadConfirmation, latitude, legalHoldStatus, longitude, name, zoom } = payloadBundle.content;
189
+ const locationMessage = protocol_messaging_1.Location.create({
190
+ expectsReadConfirmation,
191
+ latitude,
192
+ legalHoldStatus,
193
+ longitude,
194
+ name,
195
+ zoom,
196
+ });
197
+ const genericMessage = protocol_messaging_1.GenericMessage.create({
198
+ [GenericMessageType_1.GenericMessageType.LOCATION]: locationMessage,
199
+ messageId: payloadBundle.id,
200
+ });
201
+ const expireAfterMillis = messageTimer.getMessageTimer(payloadBundle.conversation);
202
+ return expireAfterMillis > 0 ? createEphemeral(genericMessage, expireAfterMillis) : genericMessage;
203
+ }
204
+ function generatePingGenericMessage(payloadBundle, messageTimer) {
205
+ const content = protocol_messaging_1.Knock.create(payloadBundle.content);
206
+ const genericMessage = protocol_messaging_1.GenericMessage.create({
207
+ [GenericMessageType_1.GenericMessageType.KNOCK]: content,
208
+ messageId: payloadBundle.id,
209
+ });
210
+ const expireAfterMillis = messageTimer.getMessageTimer(payloadBundle.conversation);
211
+ return expireAfterMillis > 0 ? createEphemeral(genericMessage, expireAfterMillis) : genericMessage;
212
+ }
213
+ function generateReactionGenericMessage(payloadBundle) {
214
+ const { legalHoldStatus, originalMessageId, type } = payloadBundle.content;
215
+ const reaction = protocol_messaging_1.Reaction.create({
216
+ emoji: type,
217
+ legalHoldStatus,
218
+ messageId: originalMessageId,
219
+ });
220
+ const genericMessage = protocol_messaging_1.GenericMessage.create({
221
+ [GenericMessageType_1.GenericMessageType.REACTION]: reaction,
222
+ messageId: payloadBundle.id,
223
+ });
224
+ return genericMessage;
225
+ }
226
+ function generateSessionResetGenericMessage(payload) {
227
+ if (payload.content.clientAction !== protocol_messaging_1.ClientAction.RESET_SESSION) {
228
+ throw new Error(`No send method implemented for "${payload.type}" and ClientAction "${payload.content}".`);
229
+ }
230
+ return protocol_messaging_1.GenericMessage.create({
231
+ [GenericMessageType_1.GenericMessageType.CLIENT_ACTION]: protocol_messaging_1.ClientAction.RESET_SESSION,
232
+ messageId: payload.id,
233
+ });
234
+ }
235
+ function generateCallGenericMessage(payloadBundle) {
236
+ const callMessage = protocol_messaging_1.Calling.create({
237
+ content: payloadBundle.content,
238
+ });
239
+ return protocol_messaging_1.GenericMessage.create({
240
+ [GenericMessageType_1.GenericMessageType.CALLING]: callMessage,
241
+ messageId: payloadBundle.id,
242
+ });
243
+ }
244
+ function generateDeleteMessage(payload) {
245
+ const content = protocol_messaging_1.MessageDelete.create({
246
+ messageId: payload.content.messageId,
247
+ });
248
+ return protocol_messaging_1.GenericMessage.create({
249
+ [GenericMessageType_1.GenericMessageType.DELETED]: content,
250
+ messageId: payload.id,
251
+ });
252
+ }
253
+ function generateHideMessage(payload) {
254
+ const content = protocol_messaging_1.MessageHide.create({
255
+ messageId: payload.content.messageId,
256
+ conversationId: payload.content.conversationId,
257
+ });
258
+ return protocol_messaging_1.GenericMessage.create({
259
+ [GenericMessageType_1.GenericMessageType.HIDDEN]: content,
260
+ messageId: payload.id,
261
+ });
262
+ }
263
+ function generateTextGenericMessage(payloadBundle, messageTimer) {
264
+ const genericMessage = protocol_messaging_1.GenericMessage.create({
265
+ messageId: payloadBundle.id,
266
+ [GenericMessageType_1.GenericMessageType.TEXT]: MessageToProtoMapper_1.MessageToProtoMapper.mapText(payloadBundle),
267
+ });
268
+ const expireAfterMillis = messageTimer.getMessageTimer(payloadBundle.conversation);
269
+ return expireAfterMillis > 0 ? createEphemeral(genericMessage, expireAfterMillis) : genericMessage;
270
+ }
271
+ function generateAsset(payloadBundle) {
272
+ if (!payloadBundle.content) {
273
+ throw new Error('No content for sendImage provided.');
274
+ }
275
+ const { asset, expectsReadConfirmation, image, legalHoldStatus } = payloadBundle.content;
276
+ const imageMetadata = protocol_messaging_1.Asset.ImageMetaData.create({
277
+ height: image.height,
278
+ width: image.width,
279
+ });
280
+ const original = protocol_messaging_1.Asset.Original.create({
281
+ [GenericMessageType_1.GenericMessageType.IMAGE]: imageMetadata,
282
+ mimeType: image.type,
283
+ name: null,
284
+ size: image.data.length,
285
+ });
286
+ const remoteData = protocol_messaging_1.Asset.RemoteData.create({
287
+ assetId: asset.key,
288
+ assetToken: asset.token,
289
+ assetDomain: asset.domain,
290
+ otrKey: asset.keyBytes,
291
+ sha256: asset.sha256,
292
+ });
293
+ const assetMessage = protocol_messaging_1.Asset.create({
294
+ expectsReadConfirmation,
295
+ legalHoldStatus,
296
+ original,
297
+ uploaded: remoteData,
298
+ });
299
+ assetMessage.status = AssetTransferState_1.AssetTransferState.UPLOADED;
300
+ return assetMessage;
301
+ }
302
+ function createEphemeral(originalGenericMessage, expireAfterMillis) {
303
+ const ephemeralMessage = protocol_messaging_1.Ephemeral.create({
304
+ expireAfterMillis,
305
+ [originalGenericMessage.content]: originalGenericMessage[originalGenericMessage.content],
306
+ });
307
+ const genericMessage = protocol_messaging_1.GenericMessage.create({
308
+ [GenericMessageType_1.GenericMessageType.EPHEMERAL]: ephemeralMessage,
309
+ messageId: originalGenericMessage.messageId,
310
+ });
311
+ return genericMessage;
312
+ }
313
+ //# sourceMappingURL=messageGenerator.js.map
@@ -0,0 +1,25 @@
1
+ export declare enum GenericMessageType {
2
+ ASSET = "asset",
3
+ ASSET_ABORT = "assetAbort",
4
+ ASSET_META = "assetMeta",
5
+ AVAILABILITY = "availability",
6
+ BUTTON_ACTION = "buttonAction",
7
+ BUTTON_ACTION_CONFIRMATION = "buttonActionConfirmation",
8
+ CALLING = "calling",
9
+ CLEARED = "cleared",
10
+ CLIENT_ACTION = "clientAction",
11
+ COMPOSITE = "composite",
12
+ CONFIRMATION = "confirmation",
13
+ DATA_TRANSFER = "dataTransfer",
14
+ DELETED = "deleted",
15
+ EDITED = "edited",
16
+ EPHEMERAL = "ephemeral",
17
+ EXTERNAL = "external",
18
+ HIDDEN = "hidden",
19
+ IMAGE = "image",
20
+ KNOCK = "knock",
21
+ LAST_READ = "lastRead",
22
+ LOCATION = "location",
23
+ REACTION = "reaction",
24
+ TEXT = "text"
25
+ }
@@ -0,0 +1,49 @@
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
+ exports.GenericMessageType = void 0;
22
+ // Enum values come from "IGenericMessage" properties in "Protobuf.d.ts"
23
+ var GenericMessageType;
24
+ (function (GenericMessageType) {
25
+ GenericMessageType["ASSET"] = "asset";
26
+ GenericMessageType["ASSET_ABORT"] = "assetAbort";
27
+ GenericMessageType["ASSET_META"] = "assetMeta";
28
+ GenericMessageType["AVAILABILITY"] = "availability";
29
+ GenericMessageType["BUTTON_ACTION"] = "buttonAction";
30
+ GenericMessageType["BUTTON_ACTION_CONFIRMATION"] = "buttonActionConfirmation";
31
+ GenericMessageType["CALLING"] = "calling";
32
+ GenericMessageType["CLEARED"] = "cleared";
33
+ GenericMessageType["CLIENT_ACTION"] = "clientAction";
34
+ GenericMessageType["COMPOSITE"] = "composite";
35
+ GenericMessageType["CONFIRMATION"] = "confirmation";
36
+ GenericMessageType["DATA_TRANSFER"] = "dataTransfer";
37
+ GenericMessageType["DELETED"] = "deleted";
38
+ GenericMessageType["EDITED"] = "edited";
39
+ GenericMessageType["EPHEMERAL"] = "ephemeral";
40
+ GenericMessageType["EXTERNAL"] = "external";
41
+ GenericMessageType["HIDDEN"] = "hidden";
42
+ GenericMessageType["IMAGE"] = "image";
43
+ GenericMessageType["KNOCK"] = "knock";
44
+ GenericMessageType["LAST_READ"] = "lastRead";
45
+ GenericMessageType["LOCATION"] = "location";
46
+ GenericMessageType["REACTION"] = "reaction";
47
+ GenericMessageType["TEXT"] = "text";
48
+ })(GenericMessageType = exports.GenericMessageType || (exports.GenericMessageType = {}));
49
+ //# sourceMappingURL=GenericMessageType.js.map
@@ -0,0 +1,10 @@
1
+ export declare class MessageTimer {
2
+ private readonly conversationLevelTimers;
3
+ private readonly messageLevelTimers;
4
+ constructor();
5
+ getConversationLevelTimer(conversationId: string): number;
6
+ getMessageLevelTimer(conversationId: string): number;
7
+ getMessageTimer(conversationId: string): number;
8
+ setConversationLevelTimer(conversationId: string, messageTimer: number): void;
9
+ setMessageLevelTimer(conversationId: string, messageTimer: number): void;
10
+ }
@@ -0,0 +1,54 @@
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
+ exports.MessageTimer = void 0;
22
+ class MessageTimer {
23
+ constructor() {
24
+ this.conversationLevelTimers = new Map();
25
+ this.messageLevelTimers = new Map();
26
+ }
27
+ getConversationLevelTimer(conversationId) {
28
+ return this.conversationLevelTimers.get(conversationId) || 0;
29
+ }
30
+ getMessageLevelTimer(conversationId) {
31
+ return this.messageLevelTimers.get(conversationId) || 0;
32
+ }
33
+ getMessageTimer(conversationId) {
34
+ return this.getConversationLevelTimer(conversationId) || this.getMessageLevelTimer(conversationId);
35
+ }
36
+ setConversationLevelTimer(conversationId, messageTimer) {
37
+ if (messageTimer === 0) {
38
+ this.conversationLevelTimers.delete(conversationId);
39
+ }
40
+ else {
41
+ this.conversationLevelTimers.set(conversationId, messageTimer);
42
+ }
43
+ }
44
+ setMessageLevelTimer(conversationId, messageTimer) {
45
+ if (messageTimer === 0) {
46
+ this.messageLevelTimers.delete(conversationId);
47
+ }
48
+ else {
49
+ this.messageLevelTimers.set(conversationId, messageTimer);
50
+ }
51
+ }
52
+ }
53
+ exports.MessageTimer = MessageTimer;
54
+ //# sourceMappingURL=MessageTimer.js.map
@@ -0,0 +1 @@
1
+ export * from './MessageTimer';