@wireapp/core 17.30.0 → 17.31.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.
Files changed (239) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/package.json +8 -8
  3. package/src/main/cryptography/GenericMessageMapper.d.ts +0 -1
  4. package/src/main/cryptography/GenericMessageMapper.js +23 -158
  5. package/src/main/Account.js.map +0 -1
  6. package/src/main/Account.test.browser.js +0 -114
  7. package/src/main/Account.test.node.d.ts +0 -1
  8. package/src/main/Account.test.node.js +0 -214
  9. package/src/main/Account.test.node.js.map +0 -1
  10. package/src/main/Account.test.node.ts +0 -236
  11. package/src/main/Account.ts +0 -401
  12. package/src/main/CoreError.js.map +0 -1
  13. package/src/main/CoreError.ts +0 -30
  14. package/src/main/auth/LoginSanitizer.js.map +0 -1
  15. package/src/main/auth/LoginSanitizer.test.node.d.ts +0 -1
  16. package/src/main/auth/LoginSanitizer.test.node.js +0 -56
  17. package/src/main/auth/LoginSanitizer.test.node.js.map +0 -1
  18. package/src/main/auth/LoginSanitizer.test.node.ts +0 -68
  19. package/src/main/auth/LoginSanitizer.ts +0 -44
  20. package/src/main/auth/index.js.map +0 -1
  21. package/src/main/auth/index.ts +0 -20
  22. package/src/main/broadcast/AvailabilityType.js.map +0 -1
  23. package/src/main/broadcast/AvailabilityType.ts +0 -22
  24. package/src/main/broadcast/BroadcastService.js.map +0 -1
  25. package/src/main/broadcast/BroadcastService.ts +0 -66
  26. package/src/main/broadcast/index.js.map +0 -1
  27. package/src/main/broadcast/index.ts +0 -21
  28. package/src/main/client/ClientBackendRepository.js.map +0 -1
  29. package/src/main/client/ClientBackendRepository.ts +0 -33
  30. package/src/main/client/ClientDatabaseRepository.js.map +0 -1
  31. package/src/main/client/ClientDatabaseRepository.ts +0 -130
  32. package/src/main/client/ClientInfo.js.map +0 -1
  33. package/src/main/client/ClientInfo.ts +0 -28
  34. package/src/main/client/ClientService.js.map +0 -1
  35. package/src/main/client/ClientService.ts +0 -116
  36. package/src/main/client/index.js.map +0 -1
  37. package/src/main/client/index.ts +0 -23
  38. package/src/main/connection/ConnectionService.js.map +0 -1
  39. package/src/main/connection/ConnectionService.ts +0 -49
  40. package/src/main/connection/index.js.map +0 -1
  41. package/src/main/connection/index.ts +0 -20
  42. package/src/main/conversation/AbortReason.js.map +0 -1
  43. package/src/main/conversation/AbortReason.ts +0 -22
  44. package/src/main/conversation/AssetService.js.map +0 -1
  45. package/src/main/conversation/AssetService.test.node.d.ts +0 -1
  46. package/src/main/conversation/AssetService.test.node.js +0 -61
  47. package/src/main/conversation/AssetService.test.node.js.map +0 -1
  48. package/src/main/conversation/AssetService.test.node.ts +0 -65
  49. package/src/main/conversation/AssetService.ts +0 -60
  50. package/src/main/conversation/AssetTransferState.js.map +0 -1
  51. package/src/main/conversation/AssetTransferState.ts +0 -23
  52. package/src/main/conversation/ClientActionType.js.map +0 -1
  53. package/src/main/conversation/ClientActionType.ts +0 -20
  54. package/src/main/conversation/ConversationMapper.js.map +0 -1
  55. package/src/main/conversation/ConversationMapper.test.node.d.ts +0 -1
  56. package/src/main/conversation/ConversationMapper.test.node.js +0 -111
  57. package/src/main/conversation/ConversationMapper.test.node.js.map +0 -1
  58. package/src/main/conversation/ConversationMapper.test.node.ts +0 -154
  59. package/src/main/conversation/ConversationMapper.ts +0 -56
  60. package/src/main/conversation/ConversationService.js.map +0 -1
  61. package/src/main/conversation/ConversationService.test.node.d.ts +0 -1
  62. package/src/main/conversation/ConversationService.test.node.js +0 -344
  63. package/src/main/conversation/ConversationService.test.node.js.map +0 -1
  64. package/src/main/conversation/ConversationService.test.node.ts +0 -416
  65. package/src/main/conversation/ConversationService.ts +0 -1024
  66. package/src/main/conversation/GenericMessageType.js.map +0 -1
  67. package/src/main/conversation/GenericMessageType.ts +0 -44
  68. package/src/main/conversation/MessageTimer.js.map +0 -1
  69. package/src/main/conversation/MessageTimer.test.node.d.ts +0 -1
  70. package/src/main/conversation/MessageTimer.test.node.js +0 -88
  71. package/src/main/conversation/MessageTimer.test.node.js.map +0 -1
  72. package/src/main/conversation/MessageTimer.test.node.ts +0 -103
  73. package/src/main/conversation/MessageTimer.ts +0 -56
  74. package/src/main/conversation/ReactionType.js.map +0 -1
  75. package/src/main/conversation/ReactionType.ts +0 -23
  76. package/src/main/conversation/content/AssetContent.js.map +0 -1
  77. package/src/main/conversation/content/AssetContent.ts +0 -71
  78. package/src/main/conversation/content/ButtonActionConfirmationContent.js.map +0 -1
  79. package/src/main/conversation/content/ButtonActionConfirmationContent.ts +0 -21
  80. package/src/main/conversation/content/ButtonActionContent.js.map +0 -1
  81. package/src/main/conversation/content/ButtonActionContent.ts +0 -21
  82. package/src/main/conversation/content/CallingContent.js.map +0 -1
  83. package/src/main/conversation/content/CallingContent.ts +0 -20
  84. package/src/main/conversation/content/ClearedContent.js.map +0 -1
  85. package/src/main/conversation/content/ClearedContent.ts +0 -21
  86. package/src/main/conversation/content/ClientActionContent.js.map +0 -1
  87. package/src/main/conversation/content/ClientActionContent.ts +0 -22
  88. package/src/main/conversation/content/ClientAddContent.js.map +0 -1
  89. package/src/main/conversation/content/ClientAddContent.ts +0 -24
  90. package/src/main/conversation/content/ClientRemoveContent.js.map +0 -1
  91. package/src/main/conversation/content/ClientRemoveContent.ts +0 -25
  92. package/src/main/conversation/content/CompositeContent.js.map +0 -1
  93. package/src/main/conversation/content/CompositeContent.ts +0 -21
  94. package/src/main/conversation/content/ConfirmationContent.js.map +0 -1
  95. package/src/main/conversation/content/ConfirmationContent.ts +0 -21
  96. package/src/main/conversation/content/ContentType.js.map +0 -1
  97. package/src/main/conversation/content/ContentType.ts +0 -112
  98. package/src/main/conversation/content/ConversationContent.js.map +0 -1
  99. package/src/main/conversation/content/ConversationContent.ts +0 -71
  100. package/src/main/conversation/content/DeletedContent.js.map +0 -1
  101. package/src/main/conversation/content/DeletedContent.ts +0 -21
  102. package/src/main/conversation/content/EditedTextContent.js.map +0 -1
  103. package/src/main/conversation/content/EditedTextContent.ts +0 -31
  104. package/src/main/conversation/content/FileContent.js.map +0 -1
  105. package/src/main/conversation/content/FileContent.ts +0 -32
  106. package/src/main/conversation/content/HiddenContent.js.map +0 -1
  107. package/src/main/conversation/content/HiddenContent.ts +0 -21
  108. package/src/main/conversation/content/ImageContent.js.map +0 -1
  109. package/src/main/conversation/content/ImageContent.ts +0 -25
  110. package/src/main/conversation/content/KnockContent.js.map +0 -1
  111. package/src/main/conversation/content/KnockContent.ts +0 -21
  112. package/src/main/conversation/content/LinkPreviewContent.js.map +0 -1
  113. package/src/main/conversation/content/LinkPreviewContent.ts +0 -32
  114. package/src/main/conversation/content/LocationContent.js.map +0 -1
  115. package/src/main/conversation/content/LocationContent.ts +0 -29
  116. package/src/main/conversation/content/MentionContent.js.map +0 -1
  117. package/src/main/conversation/content/MentionContent.ts +0 -21
  118. package/src/main/conversation/content/QuoteContent.js.map +0 -1
  119. package/src/main/conversation/content/QuoteContent.ts +0 -29
  120. package/src/main/conversation/content/ReactionContent.js.map +0 -1
  121. package/src/main/conversation/content/ReactionContent.ts +0 -27
  122. package/src/main/conversation/content/TextContent.js.map +0 -1
  123. package/src/main/conversation/content/TextContent.ts +0 -29
  124. package/src/main/conversation/content/TweetContent.js.map +0 -1
  125. package/src/main/conversation/content/TweetContent.ts +0 -21
  126. package/src/main/conversation/content/index.js.map +0 -1
  127. package/src/main/conversation/content/index.ts +0 -49
  128. package/src/main/conversation/index.js.map +0 -1
  129. package/src/main/conversation/index.ts +0 -28
  130. package/src/main/conversation/message/CompositeContentBuilder.js.map +0 -1
  131. package/src/main/conversation/message/CompositeContentBuilder.ts +0 -60
  132. package/src/main/conversation/message/Message.js.map +0 -1
  133. package/src/main/conversation/message/Message.ts +0 -24
  134. package/src/main/conversation/message/MessageBuilder.js.map +0 -1
  135. package/src/main/conversation/message/MessageBuilder.test.browser.js +0 -27
  136. package/src/main/conversation/message/MessageBuilder.ts +0 -488
  137. package/src/main/conversation/message/MessageService.js.map +0 -1
  138. package/src/main/conversation/message/MessageService.test.node.d.ts +0 -1
  139. package/src/main/conversation/message/MessageService.test.node.js +0 -308
  140. package/src/main/conversation/message/MessageService.test.node.js.map +0 -1
  141. package/src/main/conversation/message/MessageService.test.node.ts +0 -398
  142. package/src/main/conversation/message/MessageService.ts +0 -383
  143. package/src/main/conversation/message/MessageToProtoMapper.js.map +0 -1
  144. package/src/main/conversation/message/MessageToProtoMapper.ts +0 -114
  145. package/src/main/conversation/message/OtrMessage.js.map +0 -1
  146. package/src/main/conversation/message/OtrMessage.ts +0 -160
  147. package/src/main/conversation/message/PayloadBundle.js.map +0 -1
  148. package/src/main/conversation/message/PayloadBundle.ts +0 -101
  149. package/src/main/conversation/message/TeamMessage.js.map +0 -1
  150. package/src/main/conversation/message/TeamMessage.ts +0 -72
  151. package/src/main/conversation/message/TextContentBuilder.js.map +0 -1
  152. package/src/main/conversation/message/TextContentBuilder.ts +0 -88
  153. package/src/main/conversation/message/UserClientsUtil.js.map +0 -1
  154. package/src/main/conversation/message/UserClientsUtil.ts +0 -44
  155. package/src/main/conversation/message/UserClientsUtils.test.node.d.ts +0 -1
  156. package/src/main/conversation/message/UserClientsUtils.test.node.js +0 -42
  157. package/src/main/conversation/message/UserClientsUtils.test.node.js.map +0 -1
  158. package/src/main/conversation/message/UserClientsUtils.test.node.ts +0 -44
  159. package/src/main/conversation/message/UserMessage.js.map +0 -1
  160. package/src/main/conversation/message/UserMessage.ts +0 -95
  161. package/src/main/cryptography/AssetCryptography.browser.js.map +0 -1
  162. package/src/main/cryptography/AssetCryptography.browser.ts +0 -76
  163. package/src/main/cryptography/AssetCryptography.node.js.map +0 -1
  164. package/src/main/cryptography/AssetCryptography.node.ts +0 -85
  165. package/src/main/cryptography/CryptographyDatabaseRepository.js.map +0 -1
  166. package/src/main/cryptography/CryptographyDatabaseRepository.ts +0 -44
  167. package/src/main/cryptography/CryptographyService.js.map +0 -1
  168. package/src/main/cryptography/CryptographyService.test.browser.js +0 -195
  169. package/src/main/cryptography/CryptographyService.test.node.d.ts +0 -1
  170. package/src/main/cryptography/CryptographyService.test.node.js +0 -228
  171. package/src/main/cryptography/CryptographyService.test.node.js.map +0 -1
  172. package/src/main/cryptography/CryptographyService.test.node.ts +0 -246
  173. package/src/main/cryptography/CryptographyService.ts +0 -246
  174. package/src/main/cryptography/EncryptedAsset.js.map +0 -1
  175. package/src/main/cryptography/EncryptedAsset.ts +0 -30
  176. package/src/main/cryptography/GenericMessageMapper.js.map +0 -1
  177. package/src/main/cryptography/GenericMessageMapper.ts +0 -364
  178. package/src/main/cryptography/MessageHashService.js.map +0 -1
  179. package/src/main/cryptography/MessageHashService.test.browser.js +0 -176
  180. package/src/main/cryptography/MessageHashService.test.node.d.ts +0 -1
  181. package/src/main/cryptography/MessageHashService.test.node.js +0 -138
  182. package/src/main/cryptography/MessageHashService.test.node.js.map +0 -1
  183. package/src/main/cryptography/MessageHashService.test.node.ts +0 -176
  184. package/src/main/cryptography/MessageHashService.ts +0 -109
  185. package/src/main/cryptography/SessionPayloadBundle.js.map +0 -1
  186. package/src/main/cryptography/SessionPayloadBundle.ts +0 -23
  187. package/src/main/cryptography/index.js.map +0 -1
  188. package/src/main/cryptography/index.ts +0 -23
  189. package/src/main/giphy/GiphyService.js.map +0 -1
  190. package/src/main/giphy/GiphyService.ts +0 -37
  191. package/src/main/giphy/index.js.map +0 -1
  192. package/src/main/giphy/index.ts +0 -20
  193. package/src/main/index.js.map +0 -1
  194. package/src/main/index.test.browser.js +0 -22
  195. package/src/main/index.ts +0 -34
  196. package/src/main/notification/NotificationBackendRepository.js.map +0 -1
  197. package/src/main/notification/NotificationBackendRepository.ts +0 -33
  198. package/src/main/notification/NotificationDatabaseRepository.js.map +0 -1
  199. package/src/main/notification/NotificationDatabaseRepository.ts +0 -74
  200. package/src/main/notification/NotificationService.js.map +0 -1
  201. package/src/main/notification/NotificationService.test.browser.js +0 -179
  202. package/src/main/notification/NotificationService.test.node.d.ts +0 -1
  203. package/src/main/notification/NotificationService.test.node.js +0 -99
  204. package/src/main/notification/NotificationService.test.node.js.map +0 -1
  205. package/src/main/notification/NotificationService.test.node.ts +0 -124
  206. package/src/main/notification/NotificationService.ts +0 -260
  207. package/src/main/notification/index.js.map +0 -1
  208. package/src/main/notification/index.ts +0 -20
  209. package/src/main/self/SelfService.js.map +0 -1
  210. package/src/main/self/SelfService.ts +0 -59
  211. package/src/main/self/index.js.map +0 -1
  212. package/src/main/self/index.ts +0 -20
  213. package/src/main/team/TeamService.js.map +0 -1
  214. package/src/main/team/TeamService.ts +0 -68
  215. package/src/main/team/index.js.map +0 -1
  216. package/src/main/team/index.ts +0 -20
  217. package/src/main/test/CryptographyHelper.js.map +0 -1
  218. package/src/main/test/CryptographyHelper.ts +0 -57
  219. package/src/main/test/PayloadHelper.js.map +0 -1
  220. package/src/main/test/PayloadHelper.ts +0 -60
  221. package/src/main/user/UserMapper.js.map +0 -1
  222. package/src/main/user/UserMapper.test.node.d.ts +0 -1
  223. package/src/main/user/UserMapper.test.node.js +0 -55
  224. package/src/main/user/UserMapper.test.node.js.map +0 -1
  225. package/src/main/user/UserMapper.test.node.ts +0 -63
  226. package/src/main/user/UserMapper.ts +0 -92
  227. package/src/main/user/UserService.js.map +0 -1
  228. package/src/main/user/UserService.test.node.js +0 -141
  229. package/src/main/user/UserService.ts +0 -98
  230. package/src/main/user/index.js.map +0 -1
  231. package/src/main/user/index.ts +0 -20
  232. package/src/main/util/TypePredicateUtil.js.map +0 -1
  233. package/src/main/util/TypePredicateUtil.test.node.d.ts +0 -1
  234. package/src/main/util/TypePredicateUtil.test.node.js +0 -42
  235. package/src/main/util/TypePredicateUtil.test.node.js.map +0 -1
  236. package/src/main/util/TypePredicateUtil.test.node.ts +0 -44
  237. package/src/main/util/TypePredicateUtil.ts +0 -52
  238. package/src/main/util/index.js.map +0 -1
  239. package/src/main/util/index.ts +0 -20
package/CHANGELOG.md CHANGED
@@ -3,6 +3,44 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [17.31.3](https://github.com/wireapp/wire-web-packages/tree/main/packages/core/compare/@wireapp/core@17.31.2...@wireapp/core@17.31.3) (2021-12-02)
7
+
8
+ **Note:** Version bump only for package @wireapp/core
9
+
10
+
11
+
12
+
13
+
14
+ ## [17.31.2](https://github.com/wireapp/wire-web-packages/tree/main/packages/core/compare/@wireapp/core@17.31.1...@wireapp/core@17.31.2) (2021-12-01)
15
+
16
+
17
+ ### Bug Fixes
18
+
19
+ * **core:** Fix browser specific distribution ([#4186](https://github.com/wireapp/wire-web-packages/tree/main/packages/core/issues/4186)) ([036325f](https://github.com/wireapp/wire-web-packages/tree/main/packages/core/commit/036325fb0483e994e353d019971194f0869ce199))
20
+
21
+
22
+
23
+
24
+
25
+ ## [17.31.1](https://github.com/wireapp/wire-web-packages/tree/main/packages/core/compare/@wireapp/core@17.31.0...@wireapp/core@17.31.1) (2021-11-29)
26
+
27
+ **Note:** Version bump only for package @wireapp/core
28
+
29
+
30
+
31
+
32
+
33
+ # [17.31.0](https://github.com/wireapp/wire-web-packages/tree/main/packages/core/compare/@wireapp/core@17.30.0...@wireapp/core@17.31.0) (2021-11-25)
34
+
35
+
36
+ ### Features
37
+
38
+ * **core:** Add more qualifiedIds when mapping messages ([#4184](https://github.com/wireapp/wire-web-packages/tree/main/packages/core/issues/4184)) ([c81741b](https://github.com/wireapp/wire-web-packages/tree/main/packages/core/commit/c81741b6d0159fba14a32089b9f4ba520d6f6623))
39
+
40
+
41
+
42
+
43
+
6
44
  # [17.30.0](https://github.com/wireapp/wire-web-packages/tree/main/packages/core/compare/@wireapp/core@17.29.0...@wireapp/core@17.30.0) (2021-11-25)
7
45
 
8
46
 
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "browser": {
3
- "./src/cryptography/AssetCryptography.node": "./src/cryptography/AssetCryptography.browser.js"
3
+ "./src/main/cryptography/AssetCryptography.node": "./src/main/cryptography/AssetCryptography.browser.js"
4
4
  },
5
5
  "dependencies": {
6
6
  "@types/long": "4.0.1",
7
7
  "@types/node": "~14",
8
- "@wireapp/api-client": "15.6.0",
8
+ "@wireapp/api-client": "15.7.0",
9
9
  "@wireapp/cryptobox": "12.7.1",
10
10
  "bazinga64": "5.9.7",
11
11
  "hash.js": "1.1.7",
@@ -43,10 +43,10 @@
43
43
  },
44
44
  "description": "Wire for Web's communication core.",
45
45
  "files": [
46
- "src/main",
47
- "!src/main/**/!(*.d).ts",
48
- "src/main/**/*.test.ts",
49
- "src/main/test/**/*"
46
+ "src/main/**/*.d.ts",
47
+ "src/main/**/*.js",
48
+ "!src/main/**/*test*.js",
49
+ "!src/main/**/*test*.ts"
50
50
  ],
51
51
  "license": "GPL-3.0",
52
52
  "main": "src/main/Account",
@@ -69,6 +69,6 @@
69
69
  "test:project": "yarn dist && yarn test",
70
70
  "test:node": "nyc jasmine --config=jasmine.json"
71
71
  },
72
- "version": "17.30.0",
73
- "gitHead": "443684b3269bc54dc9c462fb09193fdbf9ed9cfc"
72
+ "version": "17.31.3",
73
+ "gitHead": "0c659966cfc754833feef2b4bddb6bce787c37bb"
74
74
  }
@@ -2,6 +2,5 @@ import type { ConversationOtrMessageAddEvent } from '@wireapp/api-client/src/eve
2
2
  import { PayloadBundle, PayloadBundleSource } from '../conversation';
3
3
  export declare class GenericMessageMapper {
4
4
  private static readonly logger;
5
- private static mapButtonActionMessage;
6
5
  static mapGenericMessage(genericMessage: any, event: ConversationOtrMessageAddEvent, source: PayloadBundleSource): PayloadBundle;
7
6
  }
@@ -25,24 +25,21 @@ exports.GenericMessageMapper = void 0;
25
25
  const logdown_1 = __importDefault(require("logdown"));
26
26
  const conversation_1 = require("../conversation");
27
27
  class GenericMessageMapper {
28
- static mapButtonActionMessage(genericMessage, event, source) {
29
- const { buttonAction, messageId } = genericMessage;
30
- return {
31
- content: buttonAction,
28
+ // TODO: Turn "any" into a specific type (or collection of types) and make the return type more specific based on the
29
+ // "genericMessage" input parameter.
30
+ static mapGenericMessage(genericMessage, event, source) {
31
+ const baseMessage = {
32
32
  conversation: event.conversation,
33
- from: event.from,
33
+ qualifiedConversation: event.qualified_conversation,
34
+ qualifiedFrom: event.qualified_from,
34
35
  fromClientId: event.data.sender,
35
- id: messageId,
36
- messageTimer: 0,
37
- source,
36
+ from: event.from,
38
37
  state: conversation_1.PayloadBundleState.INCOMING,
39
38
  timestamp: new Date(event.time).getTime(),
40
- type: conversation_1.PayloadBundleType.BUTTON_ACTION,
39
+ id: genericMessage.messageId,
40
+ messageTimer: 0,
41
+ source,
41
42
  };
42
- }
43
- // TODO: Turn "any" into a specific type (or collection of types) and make the return type more specific based on the
44
- // "genericMessage" input parameter.
45
- static mapGenericMessage(genericMessage, event, source) {
46
43
  switch (genericMessage.content) {
47
44
  case conversation_1.GenericMessageType.TEXT: {
48
45
  const { content: text, expectsReadConfirmation, legalHoldStatus, linkPreview: linkPreviews, mentions, quote, } = genericMessage[conversation_1.GenericMessageType.TEXT];
@@ -59,82 +56,27 @@ class GenericMessageMapper {
59
56
  if (typeof legalHoldStatus !== 'undefined') {
60
57
  content.legalHoldStatus = legalHoldStatus;
61
58
  }
62
- return {
63
- content,
64
- conversation: event.conversation,
65
- from: event.from,
66
- fromClientId: event.data.sender,
67
- id: genericMessage.messageId,
68
- messageTimer: 0,
69
- source,
70
- state: conversation_1.PayloadBundleState.INCOMING,
71
- timestamp: new Date(event.time).getTime(),
72
- type: conversation_1.PayloadBundleType.TEXT,
73
- };
59
+ return Object.assign(Object.assign({}, baseMessage), { content, type: conversation_1.PayloadBundleType.TEXT });
74
60
  }
75
61
  case conversation_1.GenericMessageType.BUTTON_ACTION: {
76
- return GenericMessageMapper.mapButtonActionMessage(genericMessage, event, source);
62
+ return Object.assign(Object.assign({}, baseMessage), { content: genericMessage.buttonAction, type: conversation_1.PayloadBundleType.BUTTON_ACTION });
77
63
  }
78
64
  case conversation_1.GenericMessageType.CALLING: {
79
- return {
80
- content: genericMessage.calling.content,
81
- conversation: event.conversation,
82
- from: event.from,
83
- fromClientId: event.data.sender,
84
- id: genericMessage.messageId,
85
- messageTimer: 0,
86
- source,
87
- state: conversation_1.PayloadBundleState.INCOMING,
88
- timestamp: new Date(event.time).getTime(),
89
- type: conversation_1.PayloadBundleType.CALL,
90
- };
65
+ return Object.assign(Object.assign({}, baseMessage), { content: genericMessage.calling.content, type: conversation_1.PayloadBundleType.CALL });
91
66
  }
92
67
  case conversation_1.GenericMessageType.CONFIRMATION: {
93
68
  const { firstMessageId, moreMessageIds, type } = genericMessage[conversation_1.GenericMessageType.CONFIRMATION];
94
69
  const content = { firstMessageId, moreMessageIds, type };
95
- return {
96
- content,
97
- conversation: event.conversation,
98
- from: event.from,
99
- fromClientId: event.data.sender,
100
- id: genericMessage.messageId,
101
- messageTimer: 0,
102
- source,
103
- state: conversation_1.PayloadBundleState.INCOMING,
104
- timestamp: new Date(event.time).getTime(),
105
- type: conversation_1.PayloadBundleType.CONFIRMATION,
106
- };
70
+ return Object.assign(Object.assign({}, baseMessage), { content, type: conversation_1.PayloadBundleType.CONFIRMATION });
107
71
  }
108
72
  case conversation_1.GenericMessageType.CLEARED: {
109
73
  const content = genericMessage[conversation_1.GenericMessageType.CLEARED];
110
- return {
111
- content,
112
- conversation: event.conversation,
113
- from: event.from,
114
- fromClientId: event.data.sender,
115
- id: genericMessage.messageId,
116
- messageTimer: 0,
117
- source,
118
- state: conversation_1.PayloadBundleState.INCOMING,
119
- timestamp: new Date(event.time).getTime(),
120
- type: conversation_1.PayloadBundleType.CONVERSATION_CLEAR,
121
- };
74
+ return Object.assign(Object.assign({}, baseMessage), { content, type: conversation_1.PayloadBundleType.CONVERSATION_CLEAR });
122
75
  }
123
76
  case conversation_1.GenericMessageType.DELETED: {
124
77
  const originalMessageId = genericMessage[conversation_1.GenericMessageType.DELETED].messageId;
125
78
  const content = { messageId: originalMessageId };
126
- return {
127
- content,
128
- conversation: event.conversation,
129
- from: event.from,
130
- fromClientId: event.data.sender,
131
- id: genericMessage.messageId,
132
- messageTimer: 0,
133
- source,
134
- state: conversation_1.PayloadBundleState.INCOMING,
135
- timestamp: new Date(event.time).getTime(),
136
- type: conversation_1.PayloadBundleType.MESSAGE_DELETE,
137
- };
79
+ return Object.assign(Object.assign({}, baseMessage), { content, type: conversation_1.PayloadBundleType.MESSAGE_DELETE });
138
80
  }
139
81
  case conversation_1.GenericMessageType.EDITED: {
140
82
  const { expectsReadConfirmation, text: { content: editedText, legalHoldStatus, linkPreview: editedLinkPreviews, mentions: editedMentions, quote: editedQuote, }, replacingMessageId, } = genericMessage[conversation_1.GenericMessageType.EDITED];
@@ -153,18 +95,7 @@ class GenericMessageMapper {
153
95
  if (editedQuote) {
154
96
  content.quote = editedQuote;
155
97
  }
156
- return {
157
- content,
158
- conversation: event.conversation,
159
- from: event.from,
160
- fromClientId: event.data.sender,
161
- id: genericMessage.messageId,
162
- messageTimer: 0,
163
- source,
164
- state: conversation_1.PayloadBundleState.INCOMING,
165
- timestamp: new Date(event.time).getTime(),
166
- type: conversation_1.PayloadBundleType.MESSAGE_EDIT,
167
- };
98
+ return Object.assign(Object.assign({}, baseMessage), { content, type: conversation_1.PayloadBundleType.MESSAGE_EDIT });
168
99
  }
169
100
  case conversation_1.GenericMessageType.HIDDEN: {
170
101
  const { conversationId, messageId } = genericMessage[conversation_1.GenericMessageType.HIDDEN];
@@ -172,34 +103,12 @@ class GenericMessageMapper {
172
103
  conversationId,
173
104
  messageId,
174
105
  };
175
- return {
176
- content,
177
- conversation: event.conversation,
178
- from: event.from,
179
- fromClientId: event.data.sender,
180
- id: genericMessage.messageId,
181
- messageTimer: 0,
182
- source,
183
- state: conversation_1.PayloadBundleState.INCOMING,
184
- timestamp: new Date(event.time).getTime(),
185
- type: conversation_1.PayloadBundleType.MESSAGE_HIDE,
186
- };
106
+ return Object.assign(Object.assign({}, baseMessage), { content, type: conversation_1.PayloadBundleType.MESSAGE_HIDE });
187
107
  }
188
108
  case conversation_1.GenericMessageType.KNOCK: {
189
109
  const { expectsReadConfirmation, legalHoldStatus } = genericMessage[conversation_1.GenericMessageType.KNOCK];
190
110
  const content = { expectsReadConfirmation, hotKnock: false, legalHoldStatus };
191
- return {
192
- content,
193
- conversation: event.conversation,
194
- from: event.from,
195
- fromClientId: event.data.sender,
196
- id: genericMessage.messageId,
197
- messageTimer: 0,
198
- source,
199
- state: conversation_1.PayloadBundleState.INCOMING,
200
- timestamp: new Date(event.time).getTime(),
201
- type: conversation_1.PayloadBundleType.PING,
202
- };
111
+ return Object.assign(Object.assign({}, baseMessage), { content, type: conversation_1.PayloadBundleType.PING });
203
112
  }
204
113
  case conversation_1.GenericMessageType.LOCATION: {
205
114
  const { expectsReadConfirmation, latitude, legalHoldStatus, longitude, name, zoom } = genericMessage[conversation_1.GenericMessageType.LOCATION];
@@ -211,18 +120,7 @@ class GenericMessageMapper {
211
120
  name,
212
121
  zoom,
213
122
  };
214
- return {
215
- content,
216
- conversation: event.conversation,
217
- from: event.from,
218
- fromClientId: event.data.sender,
219
- id: genericMessage.messageId,
220
- messageTimer: 0,
221
- source,
222
- state: conversation_1.PayloadBundleState.INCOMING,
223
- timestamp: new Date(event.time).getTime(),
224
- type: conversation_1.PayloadBundleType.LOCATION,
225
- };
123
+ return Object.assign(Object.assign({}, baseMessage), { content, type: conversation_1.PayloadBundleType.LOCATION });
226
124
  }
227
125
  case conversation_1.GenericMessageType.ASSET: {
228
126
  const { expectsReadConfirmation, legalHoldStatus, notUploaded, original, preview, status, uploaded } = genericMessage[conversation_1.GenericMessageType.ASSET];
@@ -236,18 +134,7 @@ class GenericMessageMapper {
236
134
  status,
237
135
  uploaded,
238
136
  };
239
- return {
240
- content,
241
- conversation: event.conversation,
242
- from: event.from,
243
- fromClientId: event.data.sender,
244
- id: genericMessage.messageId,
245
- messageTimer: 0,
246
- source,
247
- state: conversation_1.PayloadBundleState.INCOMING,
248
- timestamp: new Date(event.time).getTime(),
249
- type: isImage ? conversation_1.PayloadBundleType.ASSET_IMAGE : conversation_1.PayloadBundleType.ASSET,
250
- };
137
+ return Object.assign(Object.assign({}, baseMessage), { content, type: isImage ? conversation_1.PayloadBundleType.ASSET_IMAGE : conversation_1.PayloadBundleType.ASSET });
251
138
  }
252
139
  case conversation_1.GenericMessageType.REACTION: {
253
140
  const { emoji, legalHoldStatus, messageId } = genericMessage[conversation_1.GenericMessageType.REACTION];
@@ -256,33 +143,11 @@ class GenericMessageMapper {
256
143
  originalMessageId: messageId,
257
144
  type: emoji,
258
145
  };
259
- return {
260
- content,
261
- conversation: event.conversation,
262
- from: event.from,
263
- fromClientId: event.data.sender,
264
- id: genericMessage.messageId,
265
- messageTimer: 0,
266
- source,
267
- state: conversation_1.PayloadBundleState.INCOMING,
268
- timestamp: new Date(event.time).getTime(),
269
- type: conversation_1.PayloadBundleType.REACTION,
270
- };
146
+ return Object.assign(Object.assign({}, baseMessage), { content, type: conversation_1.PayloadBundleType.REACTION });
271
147
  }
272
148
  default: {
273
149
  this.logger.warn(`Unhandled event type "${genericMessage.content}": ${JSON.stringify(genericMessage)}`);
274
- return {
275
- content: genericMessage.content,
276
- conversation: event.conversation,
277
- from: event.from,
278
- fromClientId: event.data.sender,
279
- id: genericMessage.messageId,
280
- messageTimer: 0,
281
- source,
282
- state: conversation_1.PayloadBundleState.INCOMING,
283
- timestamp: new Date(event.time).getTime(),
284
- type: conversation_1.PayloadBundleType.UNKNOWN,
285
- };
150
+ return Object.assign(Object.assign({}, baseMessage), { content: genericMessage.content, type: conversation_1.PayloadBundleType.UNKNOWN });
286
151
  }
287
152
  }
288
153
  }
@@ -1 +0,0 @@
1
- {"version":3,"file":"Account.js","sourceRoot":"","sources":["Account.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;GAiBG;;;;;;;;;;;;;;;;;;;;;;;;;AAGH,yDAA6D;AAC7D,oDAA8C;AAE9C,wDAAwH;AACxH,4DAA6E;AAE7E,sDAA6D;AAC7D,8DAAgD;AAChD,wDAA0F;AAC1F,mCAAoC;AACpC,sDAA8B;AA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AI,CAAC,OAAQ,CAAC,YAAY,CAAC,wBAAwB,CAAC,mBAAmB,CAAC,CAAC;QAC7G,MAAM,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC;QAC9C,OAAO,IAAI,CAAC;IACd,CAAC;IAqBO,KAAK,CAAC,UAAU,CAAC,OAAgB;QACvC,MAAM,UAAU,GAAG,OAAO,CAAC,UAAU,KAAK,mBAAU,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,OAAO,CAAC,UAAU,EAAE,CAAC;QAC1F,MAAM,MAAM,GAAG,QAAQ,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,IAAI,OAAO,CAAC,MAAM,GAAG,UAAU,EAAE,CAAC;QACxF,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,iCAAiC,MAAM,MAAM,CAAC,CAAC;QAC/D,IAAI,CAAC,WAAW,GAAG,MAAM,IAAI,CAAC,mBAAmB,CAAC,MAAM,CAAC,CAAC;QAC1D,MAAM,MAAM,GAAG,kBAAW,CAAC,SAAS,EAAE,CAAC;QACvC,IAAI,MAAM,EAAE;YACV,MAAM,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC;SACpD;QACD,OAAO,IAAI,CAAC,WAAW,CAAC;IAC1B,CAAC;;AAzSH,0BA0SC;AApSwB,aAAK,GAAG,KAAK,CAAC"}
@@ -1,114 +0,0 @@
1
- /*
2
- * Wire
3
- * Copyright (C) 2018 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 Dexie from 'dexie';
21
- import UUID from 'uuidjs';
22
- import {Account} from '@wireapp/core';
23
- import {IndexedDBEngine} from '@wireapp/store-engine-dexie';
24
- import {APIClient} from '@wireapp/api-client';
25
-
26
- describe('Account', () => {
27
- describe('"initClient"', () => {
28
- let storeName = undefined;
29
-
30
- afterEach(done => {
31
- if (storeName) {
32
- const deleteRequest = window.indexedDB.deleteDatabase(storeName);
33
- deleteRequest.onerror = done.fail;
34
- deleteRequest.onsuccess = done;
35
- } else {
36
- done();
37
- }
38
- });
39
-
40
- it('creates a client if there is none', async () => {
41
- storeName = UUID.genV4().toString();
42
- const db = new Dexie(storeName);
43
- db.version(1).stores({
44
- amplify: '',
45
- clients: ', meta.primary_key',
46
- keys: '',
47
- prekeys: '',
48
- sessions: '',
49
- });
50
- const engine = new IndexedDBEngine();
51
- await engine.initWithDb(db);
52
-
53
- const apiClient = new APIClient({
54
- urls: APIClient.BACKEND.STAGING,
55
- });
56
-
57
- const context = {
58
- clientId: 'aa9ecc1b-ed3a-49fc-987d-68d69ce59c0d',
59
- userId: UUID.genV4().toString(),
60
- };
61
-
62
- const account = new Account(apiClient, () => Promise.resolve(engine));
63
- await account.initServices(engine);
64
- spyOn(account.service.client, 'register').and.callThrough();
65
- account.service.client.synchronizeClients = () => Promise.resolve();
66
- account.service.notification.backend.getLastNotification = () => Promise.resolve({id: 'notification-id'});
67
- account.apiClient.context = {};
68
- account.apiClient.client.api.postClient = () => Promise.resolve({id: context.clientId});
69
- await account.initClient(context);
70
-
71
- expect(account.service.client.register).toHaveBeenCalledTimes(1);
72
- });
73
- });
74
-
75
- describe('loadAndValidateLocalClient', () => {
76
- it('synchronizes the client ID', async () => {
77
- const engine = new IndexedDBEngine();
78
- const apiClient = new APIClient({
79
- urls: APIClient.BACKEND.STAGING,
80
- });
81
- const clientId = UUID.genV4().toString().toString();
82
- const account = new Account(apiClient, () => Promise.resolve(engine));
83
- await account.initServices(engine);
84
- spyOn(account.service.cryptography, 'initCryptobox').and.returnValue(Promise.resolve());
85
- spyOn(account.service.client, 'getLocalClient').and.returnValue(Promise.resolve({id: clientId}));
86
- spyOn(account.apiClient.client.api, 'getClient').and.returnValue(Promise.resolve({id: clientId}));
87
- await account.apiClient.createContext('userId', 'clientType', 'clientId');
88
-
89
- await account.loadAndValidateLocalClient();
90
-
91
- expect(account.apiClient.context.clientId).toBe(clientId);
92
- });
93
- });
94
-
95
- describe('registerClient', () => {
96
- it('synchronizes the client ID', async () => {
97
- const engine = new IndexedDBEngine();
98
- const apiClient = new APIClient({
99
- urls: APIClient.BACKEND.STAGING,
100
- });
101
- const clientId = UUID.genV4().toString().toString();
102
- const account = new Account(apiClient, () => Promise.resolve(engine));
103
- await account.initServices(engine);
104
- spyOn(account.service.client, 'register').and.returnValue(Promise.resolve({id: clientId}));
105
- spyOn(account.service.client, 'synchronizeClients').and.returnValue(Promise.resolve());
106
- spyOn(account.service.notification, 'initializeNotificationStream').and.returnValue(Promise.resolve());
107
- await account.apiClient.createContext('userId', 'clientType', 'clientId');
108
-
109
- await account.registerClient();
110
-
111
- expect(account.apiClient.context.clientId).toBe(clientId);
112
- });
113
- });
114
- });
@@ -1 +0,0 @@
1
- export {};