@wireapp/core 30.4.1 → 30.5.2

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 (210) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/package.json +3 -3
  3. package/src/main/Account.d.ts +0 -220
  4. package/src/main/Account.js +0 -435
  5. package/src/main/CoreError.d.ts +0 -9
  6. package/src/main/CoreError.js +0 -26
  7. package/src/main/account/AccountService.d.ts +0 -7
  8. package/src/main/account/AccountService.js +0 -33
  9. package/src/main/account/AccountService.js.map +0 -1
  10. package/src/main/account/index.d.ts +0 -1
  11. package/src/main/account/index.js +0 -32
  12. package/src/main/account/index.js.map +0 -1
  13. package/src/main/auth/LoginSanitizer.d.ts +0 -5
  14. package/src/main/auth/LoginSanitizer.js +0 -41
  15. package/src/main/auth/index.d.ts +0 -1
  16. package/src/main/auth/index.js +0 -32
  17. package/src/main/broadcast/AvailabilityType.d.ts +0 -2
  18. package/src/main/broadcast/AvailabilityType.js +0 -21
  19. package/src/main/broadcast/BroadcastService.d.ts +0 -24
  20. package/src/main/broadcast/BroadcastService.js +0 -74
  21. package/src/main/broadcast/index.d.ts +0 -2
  22. package/src/main/broadcast/index.js +0 -33
  23. package/src/main/client/ClientBackendRepository.d.ts +0 -11
  24. package/src/main/client/ClientBackendRepository.js +0 -43
  25. package/src/main/client/ClientDatabaseRepository.d.ts +0 -27
  26. package/src/main/client/ClientDatabaseRepository.js +0 -85
  27. package/src/main/client/ClientInfo.d.ts +0 -8
  28. package/src/main/client/ClientInfo.js +0 -21
  29. package/src/main/client/ClientService.d.ts +0 -48
  30. package/src/main/client/ClientService.js +0 -118
  31. package/src/main/client/index.d.ts +0 -4
  32. package/src/main/client/index.js +0 -35
  33. package/src/main/connection/ConnectionService.d.ts +0 -11
  34. package/src/main/connection/ConnectionService.js +0 -45
  35. package/src/main/connection/index.d.ts +0 -1
  36. package/src/main/connection/index.js +0 -32
  37. package/src/main/conversation/AbortReason.d.ts +0 -2
  38. package/src/main/conversation/AbortReason.js +0 -21
  39. package/src/main/conversation/AssetService/AssetService.d.ts +0 -62
  40. package/src/main/conversation/AssetService/AssetService.js +0 -88
  41. package/src/main/conversation/AssetService/index.d.ts +0 -1
  42. package/src/main/conversation/AssetService/index.js +0 -32
  43. package/src/main/conversation/AssetTransferState.d.ts +0 -4
  44. package/src/main/conversation/AssetTransferState.js +0 -27
  45. package/src/main/conversation/ClientActionType.d.ts +0 -1
  46. package/src/main/conversation/ClientActionType.js +0 -24
  47. package/src/main/conversation/ConversationMapper/ConversationMapper.d.ts +0 -6
  48. package/src/main/conversation/ConversationMapper/ConversationMapper.js +0 -57
  49. package/src/main/conversation/ConversationMapper/index.d.ts +0 -1
  50. package/src/main/conversation/ConversationMapper/index.js +0 -32
  51. package/src/main/conversation/ConversationService/ConversationService.d.ts +0 -164
  52. package/src/main/conversation/ConversationService/ConversationService.js +0 -951
  53. package/src/main/conversation/ConversationService/ConversationService.types.d.ts +0 -108
  54. package/src/main/conversation/ConversationService/ConversationService.types.js +0 -28
  55. package/src/main/conversation/ConversationService/index.d.ts +0 -2
  56. package/src/main/conversation/ConversationService/index.js +0 -33
  57. package/src/main/conversation/GenericMessageType.d.ts +0 -25
  58. package/src/main/conversation/GenericMessageType.js +0 -49
  59. package/src/main/conversation/MessageTimer/MessageTimer.d.ts +0 -10
  60. package/src/main/conversation/MessageTimer/MessageTimer.js +0 -54
  61. package/src/main/conversation/MessageTimer/index.d.ts +0 -1
  62. package/src/main/conversation/MessageTimer/index.js +0 -32
  63. package/src/main/conversation/ReactionType.d.ts +0 -4
  64. package/src/main/conversation/ReactionType.js +0 -27
  65. package/src/main/conversation/content/AssetContent.d.ts +0 -42
  66. package/src/main/conversation/content/AssetContent.js +0 -21
  67. package/src/main/conversation/content/ButtonActionConfirmationContent.d.ts +0 -2
  68. package/src/main/conversation/content/ButtonActionConfirmationContent.js +0 -21
  69. package/src/main/conversation/content/ButtonActionContent.d.ts +0 -2
  70. package/src/main/conversation/content/ButtonActionContent.js +0 -21
  71. package/src/main/conversation/content/CallingContent.d.ts +0 -1
  72. package/src/main/conversation/content/CallingContent.js +0 -21
  73. package/src/main/conversation/content/ClearedContent.d.ts +0 -2
  74. package/src/main/conversation/content/ClearedContent.js +0 -21
  75. package/src/main/conversation/content/ClientActionContent.d.ts +0 -2
  76. package/src/main/conversation/content/ClientActionContent.js +0 -21
  77. package/src/main/conversation/content/ClientAddContent.d.ts +0 -4
  78. package/src/main/conversation/content/ClientAddContent.js +0 -21
  79. package/src/main/conversation/content/ClientRemoveContent.d.ts +0 -6
  80. package/src/main/conversation/content/ClientRemoveContent.js +0 -21
  81. package/src/main/conversation/content/CompositeContent.d.ts +0 -2
  82. package/src/main/conversation/content/CompositeContent.js +0 -21
  83. package/src/main/conversation/content/ConfirmationContent.d.ts +0 -2
  84. package/src/main/conversation/content/ConfirmationContent.js +0 -21
  85. package/src/main/conversation/content/ContentType.d.ts +0 -21
  86. package/src/main/conversation/content/ContentType.js +0 -94
  87. package/src/main/conversation/content/ConversationContent.d.ts +0 -3
  88. package/src/main/conversation/content/ConversationContent.js +0 -21
  89. package/src/main/conversation/content/DeletedContent.d.ts +0 -2
  90. package/src/main/conversation/content/DeletedContent.js +0 -21
  91. package/src/main/conversation/content/EditedTextContent.d.ts +0 -11
  92. package/src/main/conversation/content/EditedTextContent.js +0 -21
  93. package/src/main/conversation/content/FileContent.d.ts +0 -13
  94. package/src/main/conversation/content/FileContent.js +0 -21
  95. package/src/main/conversation/content/HiddenContent.d.ts +0 -2
  96. package/src/main/conversation/content/HiddenContent.js +0 -21
  97. package/src/main/conversation/content/ImageContent.d.ts +0 -7
  98. package/src/main/conversation/content/ImageContent.js +0 -21
  99. package/src/main/conversation/content/KnockContent.d.ts +0 -2
  100. package/src/main/conversation/content/KnockContent.js +0 -21
  101. package/src/main/conversation/content/LinkPreviewContent.d.ts +0 -10
  102. package/src/main/conversation/content/LinkPreviewContent.js +0 -21
  103. package/src/main/conversation/content/LocationContent.d.ts +0 -9
  104. package/src/main/conversation/content/LocationContent.js +0 -21
  105. package/src/main/conversation/content/MentionContent.d.ts +0 -2
  106. package/src/main/conversation/content/MentionContent.js +0 -21
  107. package/src/main/conversation/content/QuoteContent.d.ts +0 -7
  108. package/src/main/conversation/content/QuoteContent.js +0 -21
  109. package/src/main/conversation/content/ReactionContent.d.ts +0 -7
  110. package/src/main/conversation/content/ReactionContent.js +0 -21
  111. package/src/main/conversation/content/TextContent.d.ts +0 -9
  112. package/src/main/conversation/content/TextContent.js +0 -21
  113. package/src/main/conversation/content/TweetContent.d.ts +0 -2
  114. package/src/main/conversation/content/TweetContent.js +0 -21
  115. package/src/main/conversation/content/index.d.ts +0 -28
  116. package/src/main/conversation/content/index.js +0 -72
  117. package/src/main/conversation/index.d.ts +0 -9
  118. package/src/main/conversation/index.js +0 -40
  119. package/src/main/conversation/message/CompositeContentBuilder.d.ts +0 -14
  120. package/src/main/conversation/message/CompositeContentBuilder.js +0 -54
  121. package/src/main/conversation/message/Message.d.ts +0 -4
  122. package/src/main/conversation/message/Message.js +0 -21
  123. package/src/main/conversation/message/MessageBuilder.d.ts +0 -87
  124. package/src/main/conversation/message/MessageBuilder.js +0 -119
  125. package/src/main/conversation/message/MessageService.d.ts +0 -67
  126. package/src/main/conversation/message/MessageService.js +0 -293
  127. package/src/main/conversation/message/MessageToProtoMapper.d.ts +0 -7
  128. package/src/main/conversation/message/MessageToProtoMapper.js +0 -99
  129. package/src/main/conversation/message/OtrMessage.d.ts +0 -80
  130. package/src/main/conversation/message/OtrMessage.js +0 -21
  131. package/src/main/conversation/message/PayloadBundle.d.ts +0 -76
  132. package/src/main/conversation/message/PayloadBundle.js +0 -81
  133. package/src/main/conversation/message/TeamMessage.d.ts +0 -31
  134. package/src/main/conversation/message/TeamMessage.js +0 -21
  135. package/src/main/conversation/message/TextContentBuilder.d.ts +0 -13
  136. package/src/main/conversation/message/TextContentBuilder.js +0 -75
  137. package/src/main/conversation/message/UserClientsUtil.d.ts +0 -22
  138. package/src/main/conversation/message/UserClientsUtil.js +0 -38
  139. package/src/main/conversation/message/UserMessage.d.ts +0 -43
  140. package/src/main/conversation/message/UserMessage.js +0 -21
  141. package/src/main/cryptography/AssetCryptography/EncryptedAsset.d.ts +0 -11
  142. package/src/main/cryptography/AssetCryptography/EncryptedAsset.js +0 -21
  143. package/src/main/cryptography/AssetCryptography/crypto.browser.d.ts +0 -2
  144. package/src/main/cryptography/AssetCryptography/crypto.browser.js +0 -46
  145. package/src/main/cryptography/AssetCryptography/crypto.node.d.ts +0 -2
  146. package/src/main/cryptography/AssetCryptography/crypto.node.js +0 -68
  147. package/src/main/cryptography/AssetCryptography/index.d.ts +0 -8
  148. package/src/main/cryptography/AssetCryptography/index.js +0 -53
  149. package/src/main/cryptography/AssetCryptography/interfaces.d.ts +0 -9
  150. package/src/main/cryptography/AssetCryptography/interfaces.js +0 -21
  151. package/src/main/cryptography/CryptographyDatabaseRepository.d.ts +0 -16
  152. package/src/main/cryptography/CryptographyDatabaseRepository.js +0 -42
  153. package/src/main/cryptography/CryptographyService.d.ts +0 -52
  154. package/src/main/cryptography/CryptographyService.js +0 -205
  155. package/src/main/cryptography/GenericMessageMapper.d.ts +0 -6
  156. package/src/main/cryptography/GenericMessageMapper.js +0 -160
  157. package/src/main/cryptography/MessageHashService.d.ts +0 -16
  158. package/src/main/cryptography/MessageHashService.js +0 -114
  159. package/src/main/cryptography/SessionPayloadBundle.d.ts +0 -4
  160. package/src/main/cryptography/SessionPayloadBundle.js +0 -21
  161. package/src/main/cryptography/index.d.ts +0 -4
  162. package/src/main/cryptography/index.js +0 -35
  163. package/src/main/giphy/GiphyService.d.ts +0 -9
  164. package/src/main/giphy/GiphyService.js +0 -37
  165. package/src/main/giphy/index.d.ts +0 -1
  166. package/src/main/giphy/index.js +0 -32
  167. package/src/main/index.d.ts +0 -17
  168. package/src/main/index.js +0 -55
  169. package/src/main/linkPreview/LinkPreviewService.d.ts +0 -7
  170. package/src/main/linkPreview/LinkPreviewService.js +0 -52
  171. package/src/main/linkPreview/index.d.ts +0 -1
  172. package/src/main/linkPreview/index.js +0 -32
  173. package/src/main/notification/NotificationBackendRepository.d.ts +0 -11
  174. package/src/main/notification/NotificationBackendRepository.js +0 -34
  175. package/src/main/notification/NotificationDatabaseRepository.d.ts +0 -45
  176. package/src/main/notification/NotificationDatabaseRepository.js +0 -107
  177. package/src/main/notification/NotificationService.d.ts +0 -107
  178. package/src/main/notification/NotificationService.js +0 -411
  179. package/src/main/notification/index.d.ts +0 -1
  180. package/src/main/notification/index.js +0 -32
  181. package/src/main/notification/types.d.ts +0 -17
  182. package/src/main/notification/types.js +0 -21
  183. package/src/main/self/SelfService.d.ts +0 -13
  184. package/src/main/self/SelfService.js +0 -55
  185. package/src/main/self/index.d.ts +0 -1
  186. package/src/main/self/index.js +0 -32
  187. package/src/main/team/TeamService.d.ts +0 -15
  188. package/src/main/team/TeamService.js +0 -55
  189. package/src/main/team/index.d.ts +0 -1
  190. package/src/main/team/index.js +0 -32
  191. package/src/main/test/CryptographyHelper.d.ts +0 -4
  192. package/src/main/test/CryptographyHelper.js +0 -65
  193. package/src/main/test/PayloadHelper.d.ts +0 -3
  194. package/src/main/test/PayloadHelper.js +0 -66
  195. package/src/main/user/UserMapper.d.ts +0 -5
  196. package/src/main/user/UserMapper.js +0 -88
  197. package/src/main/user/UserService.d.ts +0 -25
  198. package/src/main/user/UserService.js +0 -81
  199. package/src/main/user/index.d.ts +0 -1
  200. package/src/main/user/index.js +0 -32
  201. package/src/main/util/TaskScheduler/TaskScheduler.d.ts +0 -10
  202. package/src/main/util/TaskScheduler/TaskScheduler.js +0 -70
  203. package/src/main/util/TypePredicateUtil.d.ts +0 -7
  204. package/src/main/util/TypePredicateUtil.js +0 -55
  205. package/src/main/util/encryptedStore.d.ts +0 -45
  206. package/src/main/util/encryptedStore.js +0 -116
  207. package/src/main/util/index.d.ts +0 -1
  208. package/src/main/util/index.js +0 -32
  209. package/src/main/util/mapQualifiedUserClientIdsToFullyQualifiedClientIds.d.ts +0 -8
  210. package/src/main/util/mapQualifiedUserClientIdsToFullyQualifiedClientIds.js +0 -32
@@ -1,17 +0,0 @@
1
- import { Account } from './Account';
2
- import * as auth from './auth/';
3
- import * as conversation from './conversation/';
4
- import { CoreError } from './CoreError';
5
- import * as cryptography from './cryptography/';
6
- import * as util from './util';
7
- import { MessageBuilder } from './conversation/message/MessageBuilder';
8
- declare const _default: {
9
- Account: typeof Account;
10
- MessageBuilder: typeof MessageBuilder;
11
- CoreError: typeof CoreError;
12
- auth: typeof auth;
13
- conversation: typeof conversation;
14
- cryptography: typeof cryptography;
15
- util: typeof util;
16
- };
17
- export = _default;
package/src/main/index.js DELETED
@@ -1,55 +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
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
21
- if (k2 === undefined) k2 = k;
22
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
23
- }) : (function(o, m, k, k2) {
24
- if (k2 === undefined) k2 = k;
25
- o[k2] = m[k];
26
- }));
27
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
28
- Object.defineProperty(o, "default", { enumerable: true, value: v });
29
- }) : function(o, v) {
30
- o["default"] = v;
31
- });
32
- var __importStar = (this && this.__importStar) || function (mod) {
33
- if (mod && mod.__esModule) return mod;
34
- var result = {};
35
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
36
- __setModuleDefault(result, mod);
37
- return result;
38
- };
39
- const Account_1 = require("./Account");
40
- const auth = __importStar(require("./auth/"));
41
- const conversation = __importStar(require("./conversation/"));
42
- const CoreError_1 = require("./CoreError");
43
- const cryptography = __importStar(require("./cryptography/"));
44
- const util = __importStar(require("./util"));
45
- const MessageBuilder_1 = require("./conversation/message/MessageBuilder");
46
- module.exports = {
47
- Account: Account_1.Account,
48
- MessageBuilder: MessageBuilder_1.MessageBuilder,
49
- CoreError: CoreError_1.CoreError,
50
- auth,
51
- conversation,
52
- cryptography,
53
- util,
54
- };
55
- //# sourceMappingURL=index.js.map
@@ -1,7 +0,0 @@
1
- import { AssetService } from '../conversation';
2
- import { LinkPreviewContent, LinkPreviewUploadedContent } from '../conversation/content';
3
- export declare class LinkPreviewService {
4
- private readonly assetService;
5
- constructor(assetService: AssetService);
6
- uploadLinkPreviewImage(linkPreview: LinkPreviewContent, domain?: string): Promise<LinkPreviewUploadedContent>;
7
- }
@@ -1,52 +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
- var __rest = (this && this.__rest) || function (s, e) {
21
- var t = {};
22
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
23
- t[p] = s[p];
24
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
25
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
26
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
27
- t[p[i]] = s[p[i]];
28
- }
29
- return t;
30
- };
31
- Object.defineProperty(exports, "__esModule", { value: true });
32
- exports.LinkPreviewService = void 0;
33
- class LinkPreviewService {
34
- constructor(assetService) {
35
- this.assetService = assetService;
36
- }
37
- async uploadLinkPreviewImage(linkPreview, domain) {
38
- const { image } = linkPreview, preview = __rest(linkPreview, ["image"]);
39
- if (!image) {
40
- return preview;
41
- }
42
- const uploadedLinkPreview = preview;
43
- const asset = await (await this.assetService.uploadAsset(linkPreview.image.data, { domain })).response;
44
- uploadedLinkPreview.imageUploaded = {
45
- asset,
46
- image,
47
- };
48
- return uploadedLinkPreview;
49
- }
50
- }
51
- exports.LinkPreviewService = LinkPreviewService;
52
- //# sourceMappingURL=LinkPreviewService.js.map
@@ -1 +0,0 @@
1
- export * from './LinkPreviewService';
@@ -1,32 +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
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
21
- if (k2 === undefined) k2 = k;
22
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
23
- }) : (function(o, m, k, k2) {
24
- if (k2 === undefined) k2 = k;
25
- o[k2] = m[k];
26
- }));
27
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
28
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
29
- };
30
- Object.defineProperty(exports, "__esModule", { value: true });
31
- __exportStar(require("./LinkPreviewService"), exports);
32
- //# sourceMappingURL=index.js.map
@@ -1,11 +0,0 @@
1
- import type { APIClient } from '@wireapp/api-client';
2
- import type { Notification } from '@wireapp/api-client/src/notification/';
3
- export declare class NotificationBackendRepository {
4
- private readonly apiClient;
5
- constructor(apiClient: APIClient);
6
- getAllNotifications(clientId?: string, lastNotificationId?: string): Promise<{
7
- notifications: Notification[];
8
- missedNotification?: string | undefined;
9
- }>;
10
- getLastNotification(clientId?: string): Promise<Notification>;
11
- }
@@ -1,34 +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
- exports.NotificationBackendRepository = void 0;
22
- class NotificationBackendRepository {
23
- constructor(apiClient) {
24
- this.apiClient = apiClient;
25
- }
26
- async getAllNotifications(clientId, lastNotificationId) {
27
- return this.apiClient.api.notification.getAllNotifications(clientId, lastNotificationId);
28
- }
29
- getLastNotification(clientId) {
30
- return this.apiClient.api.notification.getLastNotification(clientId);
31
- }
32
- }
33
- exports.NotificationBackendRepository = NotificationBackendRepository;
34
- //# sourceMappingURL=NotificationBackendRepository.js.map
@@ -1,45 +0,0 @@
1
- import type { BackendEvent } from '@wireapp/api-client/src/event';
2
- import type { Notification } from '@wireapp/api-client/src/notification/';
3
- import type { CRUDEngine } from '@wireapp/store-engine';
4
- import { CommonMLS, CompoundGroupIdParams, StorePendingProposalsParams } from './types';
5
- export declare enum DatabaseStores {
6
- EVENTS = "events"
7
- }
8
- export declare enum DatabaseKeys {
9
- PRIMARY_KEY_LAST_EVENT = "z.storage.StorageKey.EVENT.LAST_DATE",
10
- PRIMARY_KEY_LAST_NOTIFICATION = "z.storage.StorageKey.NOTIFICATION.LAST_ID"
11
- }
12
- export declare class NotificationDatabaseRepository {
13
- private readonly storeEngine;
14
- constructor(storeEngine: CRUDEngine);
15
- getNotificationEventList(): Promise<BackendEvent[]>;
16
- getLastEventDate(): Promise<Date>;
17
- updateLastEventDate(eventDate: Date): Promise<Date>;
18
- createLastEventDate(eventDate: Date): Promise<Date>;
19
- getLastNotificationId(): Promise<string>;
20
- updateLastNotificationId(lastNotification: Notification): Promise<string>;
21
- private generateCompoundGroupIdPrimaryKey;
22
- addCompoundGroupId(params: CompoundGroupIdParams): Promise<CompoundGroupIdParams>;
23
- getCompoundGroupId(params: Omit<CompoundGroupIdParams, 'groupId'>): Promise<string>;
24
- /**
25
- * ## MLS only ##
26
- * Store groupIds with pending proposals and a delay in the DB until the proposals get committed.
27
- *
28
- * @param groupId groupId of the mls conversation
29
- * @param firingDate date when the pending proposals should be committed
30
- */
31
- storePendingProposal(params: StorePendingProposalsParams): Promise<boolean>;
32
- /**
33
- * ## MLS only ##
34
- * Delete stored entries for pending proposals that have been committed.
35
- *
36
- * @param groupId groupId of the mls conversation
37
- */
38
- deletePendingProposal({ groupId }: CommonMLS): Promise<boolean>;
39
- /**
40
- * ## MLS only ##
41
- * Get all stored entries for pending proposals.
42
- *
43
- */
44
- getStoredPendingProposals(): Promise<StorePendingProposalsParams[]>;
45
- }
@@ -1,107 +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
- exports.NotificationDatabaseRepository = exports.DatabaseKeys = exports.DatabaseStores = void 0;
22
- const CryptographyDatabaseRepository_1 = require("../cryptography/CryptographyDatabaseRepository");
23
- var DatabaseStores;
24
- (function (DatabaseStores) {
25
- DatabaseStores["EVENTS"] = "events";
26
- })(DatabaseStores = exports.DatabaseStores || (exports.DatabaseStores = {}));
27
- var DatabaseKeys;
28
- (function (DatabaseKeys) {
29
- DatabaseKeys["PRIMARY_KEY_LAST_EVENT"] = "z.storage.StorageKey.EVENT.LAST_DATE";
30
- DatabaseKeys["PRIMARY_KEY_LAST_NOTIFICATION"] = "z.storage.StorageKey.NOTIFICATION.LAST_ID";
31
- })(DatabaseKeys = exports.DatabaseKeys || (exports.DatabaseKeys = {}));
32
- const STORES = Object.assign({}, CryptographyDatabaseRepository_1.CryptographyDatabaseRepository.STORES);
33
- class NotificationDatabaseRepository {
34
- constructor(storeEngine) {
35
- this.storeEngine = storeEngine;
36
- }
37
- getNotificationEventList() {
38
- return this.storeEngine.readAll(DatabaseStores.EVENTS);
39
- }
40
- async getLastEventDate() {
41
- const { value } = await this.storeEngine.read(STORES.AMPLIFY, DatabaseKeys.PRIMARY_KEY_LAST_EVENT);
42
- return new Date(value);
43
- }
44
- async updateLastEventDate(eventDate) {
45
- await this.storeEngine.update(STORES.AMPLIFY, DatabaseKeys.PRIMARY_KEY_LAST_EVENT, {
46
- value: eventDate.toISOString(),
47
- });
48
- return eventDate;
49
- }
50
- async createLastEventDate(eventDate) {
51
- await this.storeEngine.create(STORES.AMPLIFY, DatabaseKeys.PRIMARY_KEY_LAST_EVENT, {
52
- value: eventDate.toISOString(),
53
- });
54
- return eventDate;
55
- }
56
- async getLastNotificationId() {
57
- const { value } = await this.storeEngine.read(STORES.AMPLIFY, DatabaseKeys.PRIMARY_KEY_LAST_NOTIFICATION);
58
- return value;
59
- }
60
- async updateLastNotificationId(lastNotification) {
61
- await this.storeEngine.updateOrCreate(STORES.AMPLIFY, DatabaseKeys.PRIMARY_KEY_LAST_NOTIFICATION, {
62
- value: lastNotification.id,
63
- });
64
- return lastNotification.id;
65
- }
66
- generateCompoundGroupIdPrimaryKey({ conversationId, conversationDomain, }) {
67
- return `${conversationId}@${conversationDomain}`;
68
- }
69
- async addCompoundGroupId(params) {
70
- await this.storeEngine.updateOrCreate(STORES.GROUP_IDS, this.generateCompoundGroupIdPrimaryKey(params), params.groupId);
71
- return params;
72
- }
73
- async getCompoundGroupId(params) {
74
- return this.storeEngine.read(STORES.GROUP_IDS, this.generateCompoundGroupIdPrimaryKey(params));
75
- }
76
- /**
77
- * ## MLS only ##
78
- * Store groupIds with pending proposals and a delay in the DB until the proposals get committed.
79
- *
80
- * @param groupId groupId of the mls conversation
81
- * @param firingDate date when the pending proposals should be committed
82
- */
83
- async storePendingProposal(params) {
84
- await this.storeEngine.updateOrCreate(STORES.PENDING_PROPOSALS, `${params.groupId}`, params);
85
- return true;
86
- }
87
- /**
88
- * ## MLS only ##
89
- * Delete stored entries for pending proposals that have been committed.
90
- *
91
- * @param groupId groupId of the mls conversation
92
- */
93
- async deletePendingProposal({ groupId }) {
94
- await this.storeEngine.delete(STORES.PENDING_PROPOSALS, `${groupId}`);
95
- return true;
96
- }
97
- /**
98
- * ## MLS only ##
99
- * Get all stored entries for pending proposals.
100
- *
101
- */
102
- async getStoredPendingProposals() {
103
- return this.storeEngine.readAll(STORES.PENDING_PROPOSALS);
104
- }
105
- }
106
- exports.NotificationDatabaseRepository = NotificationDatabaseRepository;
107
- //# sourceMappingURL=NotificationDatabaseRepository.js.map
@@ -1,107 +0,0 @@
1
- /// <reference types="node" />
2
- import type { APIClient } from '@wireapp/api-client';
3
- import * as Events from '@wireapp/api-client/src/event';
4
- import type { Notification } from '@wireapp/api-client/src/notification/';
5
- import { CRUDEngine } from '@wireapp/store-engine';
6
- import { EventEmitter } from 'events';
7
- import { PayloadBundle, PayloadBundleSource } from '../conversation';
8
- import { NotificationError } from '../CoreError';
9
- import type { CryptographyService } from '../cryptography';
10
- import { GenericMessage } from '@wireapp/protocol-messaging';
11
- import { AbortHandler } from '@wireapp/api-client/src/tcp';
12
- import type { CoreCrypto } from '@otak/core-crypto/platforms/web/corecrypto';
13
- import { QualifiedId } from '@wireapp/api-client/src/user';
14
- import { Conversation } from '@wireapp/api-client/src/conversation';
15
- import { CommitPendingProposalsParams } from './types';
16
- export declare type HandledEventPayload = {
17
- event: Events.BackendEvent;
18
- mappedEvent?: PayloadBundle;
19
- decryptedData?: GenericMessage;
20
- decryptionError?: {
21
- code: number;
22
- message: string;
23
- };
24
- };
25
- declare enum TOPIC {
26
- NOTIFICATION_ERROR = "NotificationService.TOPIC.NOTIFICATION_ERROR"
27
- }
28
- export declare type NotificationHandler = (notification: Notification, source: PayloadBundleSource, progress: {
29
- done: number;
30
- total: number;
31
- }) => Promise<void>;
32
- export interface NotificationService {
33
- on(event: TOPIC.NOTIFICATION_ERROR, listener: (payload: NotificationError) => void): this;
34
- }
35
- export declare class NotificationService extends EventEmitter {
36
- private readonly coreCryptoClientProvider;
37
- private readonly apiClient;
38
- private readonly backend;
39
- private readonly cryptographyService;
40
- private readonly database;
41
- private readonly logger;
42
- static readonly TOPIC: typeof TOPIC;
43
- constructor(apiClient: APIClient, cryptographyService: CryptographyService, storeEngine: CRUDEngine, coreCryptoClientProvider: () => CoreCrypto | undefined);
44
- private getAllNotifications;
45
- /** Should only be called with a completely new client. */
46
- initializeNotificationStream(): Promise<string>;
47
- hasHistory(): Promise<boolean>;
48
- getNotificationEventList(): Promise<Events.BackendEvent[]>;
49
- setLastEventDate(eventDate: Date): Promise<Date>;
50
- setLastNotificationId(lastNotification: Notification): Promise<string>;
51
- handleNotificationStream(notificationHandler: NotificationHandler, onMissedNotifications: (notificationId: string) => void, abortHandler: AbortHandler): Promise<void>;
52
- /**
53
- * Checks if an event should be ignored.
54
- * An event that has a date prior to that last event that we have parsed should be ignored
55
- *
56
- * @param event
57
- * @param source
58
- * @param lastEventDate?
59
- */
60
- private isOutdatedEvent;
61
- handleNotification(notification: Notification, source: PayloadBundleSource, dryRun?: boolean): AsyncGenerator<HandledEventPayload>;
62
- private cleanupPayloadBundle;
63
- private handleEvent;
64
- /**
65
- * ## MLS only ##
66
- * If there is a groupId in the conversation, we need to store the conversationId => groupId pair
67
- * in order to find the groupId when decrypting messages
68
- * This is a bit hacky but since mls messages do not embed the groupId we need to keep a mapping of those
69
- *
70
- * @param conversation conversation with group_id
71
- */
72
- saveConversationGroupId(conversation: Conversation): Promise<void>;
73
- /**
74
- * ## MLS only ##
75
- * If there is a matching conversationId => groupId pair in the database,
76
- * we can find the groupId and return it as a Uint8Array
77
- *
78
- * @param conversationQualifiedId
79
- */
80
- getUint8ArrayFromConversationGroupId(conversationQualifiedId: QualifiedId): Promise<Uint8Array>;
81
- /**
82
- * ## MLS only ##
83
- * If there are pending proposals, we need to either process them,
84
- * or save them in the database for later processing
85
- *
86
- * @param groupId groupId of the mls conversation
87
- * @param delayInMs delay in ms before processing proposals
88
- * @param eventTime time of the event that had the proposals
89
- */
90
- private handlePendingProposals;
91
- /**
92
- * ## MLS only ##
93
- * Commit all pending proposals for a given groupId
94
- *
95
- * @param groupId groupId of the conversation
96
- * @param skipDelete if true, do not delete the pending proposals from the database
97
- */
98
- commitPendingProposals({ groupId, skipDelete }: CommitPendingProposalsParams): Promise<void>;
99
- /**
100
- * ## MLS only ##
101
- * Get all pending proposals from the database and schedule them
102
- * Function must only be called once, after application start
103
- *
104
- */
105
- checkExistingPendingProposals(): Promise<void>;
106
- }
107
- export {};