@wireapp/core 46.46.6-beta.10.d7a6c4c53 → 46.46.6-beta.14.f6fd03fe6

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 (195) hide show
  1. package/lib/Account.d.ts +51 -168
  2. package/lib/Account.d.ts.map +1 -1
  3. package/lib/Account.js +127 -517
  4. package/lib/Account.test.js +147 -158
  5. package/lib/broadcast/AvailabilityType.d.ts +1 -1
  6. package/lib/broadcast/AvailabilityType.d.ts.map +1 -1
  7. package/lib/broadcast/BroadcastService.d.ts +1 -1
  8. package/lib/broadcast/BroadcastService.d.ts.map +1 -1
  9. package/lib/broadcast/BroadcastService.js +1 -1
  10. package/lib/client/ClientService.d.ts +3 -4
  11. package/lib/client/ClientService.d.ts.map +1 -1
  12. package/lib/client/ClientService.js +5 -19
  13. package/lib/conversation/AbortReason.d.ts +1 -1
  14. package/lib/conversation/AbortReason.d.ts.map +1 -1
  15. package/lib/conversation/AssetService/AssetService.d.ts +30 -12
  16. package/lib/conversation/AssetService/AssetService.d.ts.map +1 -1
  17. package/lib/conversation/AssetService/AssetService.js +10 -1
  18. package/lib/conversation/AssetService/AssetService.test.js +3 -8
  19. package/lib/conversation/ClientActionType.d.ts +1 -1
  20. package/lib/conversation/ClientActionType.d.ts.map +1 -1
  21. package/lib/conversation/ClientActionType.js +1 -1
  22. package/lib/conversation/ConversationService/ConversationService.d.ts +14 -98
  23. package/lib/conversation/ConversationService/ConversationService.d.ts.map +1 -1
  24. package/lib/conversation/ConversationService/ConversationService.js +101 -314
  25. package/lib/conversation/ConversationService/ConversationService.test.js +47 -441
  26. package/lib/conversation/ConversationService/ConversationService.types.d.ts +4 -5
  27. package/lib/conversation/ConversationService/ConversationService.types.d.ts.map +1 -1
  28. package/lib/conversation/ConversationService/Utility/getConversationQualifiedMembers.d.ts.map +1 -1
  29. package/lib/conversation/ConversationService/Utility/getConversationQualifiedMembers.js +3 -6
  30. package/lib/conversation/SubconversationService/SubconversationService.d.ts.map +1 -1
  31. package/lib/conversation/SubconversationService/SubconversationService.js +11 -158
  32. package/lib/conversation/SubconversationService/SubconversationService.test.js +2 -8
  33. package/lib/conversation/content/AssetContent.d.ts +1 -1
  34. package/lib/conversation/content/AssetContent.d.ts.map +1 -1
  35. package/lib/conversation/content/ButtonActionConfirmationContent.d.ts +1 -1
  36. package/lib/conversation/content/ButtonActionConfirmationContent.d.ts.map +1 -1
  37. package/lib/conversation/content/ButtonActionContent.d.ts +1 -1
  38. package/lib/conversation/content/ButtonActionContent.d.ts.map +1 -1
  39. package/lib/conversation/content/ClearedContent.d.ts +1 -1
  40. package/lib/conversation/content/ClearedContent.d.ts.map +1 -1
  41. package/lib/conversation/content/ClientActionContent.d.ts +1 -1
  42. package/lib/conversation/content/ClientActionContent.d.ts.map +1 -1
  43. package/lib/conversation/content/CompositeContent.d.ts +1 -1
  44. package/lib/conversation/content/CompositeContent.d.ts.map +1 -1
  45. package/lib/conversation/content/ConfirmationContent.d.ts +1 -1
  46. package/lib/conversation/content/ConfirmationContent.d.ts.map +1 -1
  47. package/lib/conversation/content/DeletedContent.d.ts +1 -1
  48. package/lib/conversation/content/DeletedContent.d.ts.map +1 -1
  49. package/lib/conversation/content/HiddenContent.d.ts +1 -1
  50. package/lib/conversation/content/HiddenContent.d.ts.map +1 -1
  51. package/lib/conversation/content/KnockContent.d.ts +1 -1
  52. package/lib/conversation/content/KnockContent.d.ts.map +1 -1
  53. package/lib/conversation/content/LinkPreviewContent.d.ts +1 -1
  54. package/lib/conversation/content/LinkPreviewContent.d.ts.map +1 -1
  55. package/lib/conversation/content/MentionContent.d.ts +1 -1
  56. package/lib/conversation/content/MentionContent.d.ts.map +1 -1
  57. package/lib/conversation/content/MultipartContent.d.ts +1 -1
  58. package/lib/conversation/content/MultipartContent.d.ts.map +1 -1
  59. package/lib/conversation/content/QuoteContent.d.ts +1 -1
  60. package/lib/conversation/content/QuoteContent.d.ts.map +1 -1
  61. package/lib/conversation/content/TweetContent.d.ts +1 -1
  62. package/lib/conversation/content/TweetContent.d.ts.map +1 -1
  63. package/lib/conversation/content/index.d.ts +1 -1
  64. package/lib/conversation/content/index.d.ts.map +1 -1
  65. package/lib/conversation/content/index.js +1 -1
  66. package/lib/conversation/message/MessageBuilder.d.ts +1 -1
  67. package/lib/conversation/message/MessageBuilder.d.ts.map +1 -1
  68. package/lib/conversation/message/MessageBuilder.js +1 -1
  69. package/lib/conversation/message/MessageService.d.ts.map +1 -1
  70. package/lib/conversation/message/MessageService.js +1 -1
  71. package/lib/conversation/message/MessageService.test.js +1 -7
  72. package/lib/conversation/message/MessageToProtoMapper.d.ts +1 -1
  73. package/lib/conversation/message/MessageToProtoMapper.d.ts.map +1 -1
  74. package/lib/conversation/message/MessageToProtoMapper.js +1 -1
  75. package/lib/conversation/message/messageSender.js +2 -2
  76. package/lib/cryptography/AssetCryptography/EncryptedAsset.d.ts +2 -2
  77. package/lib/cryptography/AssetCryptography/EncryptedAsset.d.ts.map +1 -1
  78. package/lib/messagingProtocols/common.types.d.ts +0 -9
  79. package/lib/messagingProtocols/common.types.d.ts.map +1 -1
  80. package/lib/messagingProtocols/mls/E2EIdentityService/E2EIService.types.d.ts +2 -2
  81. package/lib/messagingProtocols/mls/E2EIdentityService/E2EIService.types.d.ts.map +1 -1
  82. package/lib/messagingProtocols/mls/E2EIdentityService/E2EIService.types.js +1 -2
  83. package/lib/messagingProtocols/mls/E2EIdentityService/E2EIServiceExternal.d.ts +1 -1
  84. package/lib/messagingProtocols/mls/E2EIdentityService/E2EIServiceExternal.d.ts.map +1 -1
  85. package/lib/messagingProtocols/mls/E2EIdentityService/E2EIServiceExternal.js +11 -13
  86. package/lib/messagingProtocols/mls/E2EIdentityService/E2EIServiceExternal.test.js +16 -21
  87. package/lib/messagingProtocols/mls/E2EIdentityService/E2EIServiceInternal.d.ts +3 -9
  88. package/lib/messagingProtocols/mls/E2EIdentityService/E2EIServiceInternal.d.ts.map +1 -1
  89. package/lib/messagingProtocols/mls/E2EIdentityService/E2EIServiceInternal.js +12 -31
  90. package/lib/messagingProtocols/mls/E2EIdentityService/Helper/index.d.ts +0 -6
  91. package/lib/messagingProtocols/mls/E2EIdentityService/Helper/index.d.ts.map +1 -1
  92. package/lib/messagingProtocols/mls/E2EIdentityService/Helper/index.js +1 -19
  93. package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/IncomingMessagesQueue/IncomingMesssagesQueue.d.ts +4 -0
  94. package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/IncomingMessagesQueue/IncomingMesssagesQueue.d.ts.map +1 -0
  95. package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/IncomingMessagesQueue/IncomingMesssagesQueue.js +69 -0
  96. package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/IncomingMessagesQueue/index.d.ts +2 -0
  97. package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/{IncomingProposalsQueue → IncomingMessagesQueue}/index.d.ts.map +1 -1
  98. package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/{IncomingProposalsQueue → IncomingMessagesQueue}/index.js +1 -1
  99. package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/index.d.ts +1 -0
  100. package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/index.d.ts.map +1 -1
  101. package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/index.js +1 -0
  102. package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/messageAdd.d.ts.map +1 -1
  103. package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/messageAdd.js +14 -23
  104. package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/messageAdd.test.d.ts +2 -0
  105. package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/messageAdd.test.d.ts.map +1 -0
  106. package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/messageAdd.test.js +98 -0
  107. package/lib/messagingProtocols/mls/EventHandler/events/welcomeMessage/welcomeMessage.d.ts.map +1 -1
  108. package/lib/messagingProtocols/mls/EventHandler/events/welcomeMessage/welcomeMessage.js +2 -5
  109. package/lib/messagingProtocols/mls/EventHandler/events/welcomeMessage/welcomeMessage.test.js +3 -13
  110. package/lib/messagingProtocols/mls/MLSService/CoreCryptoMLSError.d.ts +2 -38
  111. package/lib/messagingProtocols/mls/MLSService/CoreCryptoMLSError.d.ts.map +1 -1
  112. package/lib/messagingProtocols/mls/MLSService/CoreCryptoMLSError.js +6 -41
  113. package/lib/messagingProtocols/mls/MLSService/MLSService.d.ts +34 -38
  114. package/lib/messagingProtocols/mls/MLSService/MLSService.d.ts.map +1 -1
  115. package/lib/messagingProtocols/mls/MLSService/MLSService.js +208 -267
  116. package/lib/messagingProtocols/mls/MLSService/MLSService.test.js +160 -157
  117. package/lib/messagingProtocols/mls/MLSService/commitBundleUtil.js +3 -3
  118. package/lib/messagingProtocols/mls/MLSService/commitBundleUtil.test.js +5 -5
  119. package/lib/messagingProtocols/mls/conversationRejoinQueue.js +2 -2
  120. package/lib/messagingProtocols/mls/types.d.ts +8 -0
  121. package/lib/messagingProtocols/mls/types.d.ts.map +1 -1
  122. package/lib/messagingProtocols/proteus/EventHandler/events/otrMessageAdd/otrMessageAdd.d.ts.map +1 -1
  123. package/lib/messagingProtocols/proteus/EventHandler/events/otrMessageAdd/otrMessageAdd.js +1 -7
  124. package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CoreCryptoWrapper/CoreCryptoWrapper.d.ts +15 -8
  125. package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CoreCryptoWrapper/CoreCryptoWrapper.d.ts.map +1 -1
  126. package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CoreCryptoWrapper/CoreCryptoWrapper.js +62 -97
  127. package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CryptoClient.types.d.ts +6 -0
  128. package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CryptoClient.types.d.ts.map +1 -1
  129. package/lib/messagingProtocols/proteus/ProteusService/DecryptionErrorGenerator/DecryptionErrorGenerator.d.ts +6 -1
  130. package/lib/messagingProtocols/proteus/ProteusService/DecryptionErrorGenerator/DecryptionErrorGenerator.d.ts.map +1 -1
  131. package/lib/messagingProtocols/proteus/ProteusService/DecryptionErrorGenerator/DecryptionErrorGenerator.js +22 -19
  132. package/lib/messagingProtocols/proteus/ProteusService/ProteusService.d.ts +3 -5
  133. package/lib/messagingProtocols/proteus/ProteusService/ProteusService.d.ts.map +1 -1
  134. package/lib/messagingProtocols/proteus/ProteusService/ProteusService.js +24 -11
  135. package/lib/messagingProtocols/proteus/ProteusService/ProteusService.mocks.d.ts +0 -1
  136. package/lib/messagingProtocols/proteus/ProteusService/ProteusService.mocks.d.ts.map +1 -1
  137. package/lib/messagingProtocols/proteus/ProteusService/ProteusService.mocks.js +2 -11
  138. package/lib/messagingProtocols/proteus/ProteusService/ProteusService.test.js +9 -13
  139. package/lib/messagingProtocols/proteus/ProteusService/ProteusService.types.d.ts +2 -3
  140. package/lib/messagingProtocols/proteus/ProteusService/ProteusService.types.d.ts.map +1 -1
  141. package/lib/messagingProtocols/proteus/ProteusService/WithMockedGenerics.test.js +4 -11
  142. package/lib/messagingProtocols/proteus/ProteusService/cryptoMigrationStateStore.d.ts +4 -0
  143. package/lib/messagingProtocols/proteus/ProteusService/cryptoMigrationStateStore.d.ts.map +1 -1
  144. package/lib/messagingProtocols/proteus/ProteusService/cryptoMigrationStateStore.js +5 -0
  145. package/lib/messagingProtocols/proteus/ProteusService/identityClearer.d.ts +1 -2
  146. package/lib/messagingProtocols/proteus/ProteusService/identityClearer.d.ts.map +1 -1
  147. package/lib/messagingProtocols/proteus/ProteusService/identityClearer.js +2 -8
  148. package/lib/messagingProtocols/proteus/Utility/SessionHandler/SessionHandler.test.js +0 -4
  149. package/lib/messagingProtocols/proteus/Utility/getGenericMessageParams.d.ts +1 -1
  150. package/lib/messagingProtocols/proteus/Utility/getGenericMessageParams.d.ts.map +1 -1
  151. package/lib/messagingProtocols/proteus/Utility/getGenericMessageParams.js +1 -1
  152. package/lib/notification/NotificationService.d.ts +6 -20
  153. package/lib/notification/NotificationService.d.ts.map +1 -1
  154. package/lib/notification/NotificationService.js +14 -23
  155. package/lib/notification/NotificationService.test.js +0 -8
  156. package/lib/secretStore/secretKeyGenerator.d.ts +0 -1
  157. package/lib/secretStore/secretKeyGenerator.d.ts.map +1 -1
  158. package/lib/secretStore/secretKeyGenerator.js +1 -3
  159. package/lib/self/SelfService.d.ts +2 -2
  160. package/lib/self/SelfService.d.ts.map +1 -1
  161. package/lib/self/SelfService.test.js +2 -5
  162. package/lib/team/TeamService.d.ts +2 -5
  163. package/lib/team/TeamService.d.ts.map +1 -1
  164. package/lib/team/TeamService.js +2 -12
  165. package/lib/user/UserService.d.ts +2 -2
  166. package/lib/user/UserService.d.ts.map +1 -1
  167. package/lib/user/UserService.js +3 -3
  168. package/lib/util/TypePredicateUtil.d.ts.map +1 -1
  169. package/lib/util/TypePredicateUtil.js +2 -2
  170. package/package.json +3 -3
  171. package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/IncomingProposalsQueue/IncomingProposalsQueue.d.ts +0 -7
  172. package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/IncomingProposalsQueue/IncomingProposalsQueue.d.ts.map +0 -1
  173. package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/IncomingProposalsQueue/IncomingProposalsQueue.js +0 -48
  174. package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/IncomingProposalsQueue/index.d.ts +0 -2
  175. package/lib/messagingProtocols/mls/MLSService/CoreCryptoMLSError.test.d.ts +0 -2
  176. package/lib/messagingProtocols/mls/MLSService/CoreCryptoMLSError.test.d.ts.map +0 -1
  177. package/lib/messagingProtocols/mls/MLSService/CoreCryptoMLSError.test.js +0 -124
  178. package/lib/messagingProtocols/mls/recovery/MlsErrorMapper.d.ts +0 -78
  179. package/lib/messagingProtocols/mls/recovery/MlsErrorMapper.d.ts.map +0 -1
  180. package/lib/messagingProtocols/mls/recovery/MlsErrorMapper.js +0 -173
  181. package/lib/messagingProtocols/mls/recovery/MlsErrorMapper.test.d.ts +0 -2
  182. package/lib/messagingProtocols/mls/recovery/MlsErrorMapper.test.d.ts.map +0 -1
  183. package/lib/messagingProtocols/mls/recovery/MlsErrorMapper.test.js +0 -117
  184. package/lib/messagingProtocols/mls/recovery/MlsRecoveryOrchestrator.d.ts +0 -167
  185. package/lib/messagingProtocols/mls/recovery/MlsRecoveryOrchestrator.d.ts.map +0 -1
  186. package/lib/messagingProtocols/mls/recovery/MlsRecoveryOrchestrator.js +0 -317
  187. package/lib/messagingProtocols/mls/recovery/MlsRecoveryOrchestrator.test.d.ts +0 -2
  188. package/lib/messagingProtocols/mls/recovery/MlsRecoveryOrchestrator.test.d.ts.map +0 -1
  189. package/lib/messagingProtocols/mls/recovery/MlsRecoveryOrchestrator.test.js +0 -248
  190. package/lib/messagingProtocols/mls/recovery/index.d.ts +0 -5
  191. package/lib/messagingProtocols/mls/recovery/index.d.ts.map +0 -1
  192. package/lib/messagingProtocols/mls/recovery/index.js +0 -28
  193. package/lib/test/StoreHelper.d.ts +0 -2
  194. package/lib/test/StoreHelper.d.ts.map +0 -1
  195. package/lib/test/StoreHelper.js +0 -27
@@ -41,14 +41,15 @@ var __importStar = (this && this.__importStar) || function (mod) {
41
41
  return result;
42
42
  };
43
43
  Object.defineProperty(exports, "__esModule", { value: true });
44
+ const protocol_messaging_1 = require("@pydio/protocol-messaging");
44
45
  const auth_1 = require("@wireapp/api-client/lib/auth");
45
46
  const client_1 = require("@wireapp/api-client/lib/client");
46
- const Config_1 = require("@wireapp/api-client/lib/Config");
47
47
  const conversation_1 = require("@wireapp/api-client/lib/conversation");
48
+ const event_1 = require("@wireapp/api-client/lib/event");
48
49
  const http_1 = require("@wireapp/api-client/lib/http");
49
50
  const notification_1 = require("@wireapp/api-client/lib/notification");
50
- const ConsumableNotification_1 = require("@wireapp/api-client/lib/notification/ConsumableNotification");
51
51
  const self_1 = require("@wireapp/api-client/lib/self");
52
+ const tcp_1 = require("@wireapp/api-client/lib/tcp");
52
53
  const ReconnectingWebsocket_1 = require("@wireapp/api-client/lib/tcp/ReconnectingWebsocket");
53
54
  const http_status_codes_1 = require("http-status-codes");
54
55
  const jest_websocket_mock_1 = require("jest-websocket-mock");
@@ -56,20 +57,6 @@ const nock_1 = __importStar(require("nock"));
56
57
  const uuid_1 = require("uuid");
57
58
  const api_client_1 = require("@wireapp/api-client");
58
59
  const commons_1 = require("@wireapp/commons");
59
- const protocol_messaging_1 = require("@wireapp/protocol-messaging");
60
- // Mock ConversationService to avoid requiring MLSService in constructor during tests
61
- jest.mock('./conversation', () => {
62
- const actual = jest.requireActual('./conversation');
63
- class FakeConversationService {
64
- constructor(..._args) { }
65
- // Return unhandled so NotificationService falls back to generic handling in tests
66
- handleEvent = jest.fn(async () => ({ status: 'unhandled' }));
67
- }
68
- return {
69
- ...actual,
70
- ConversationService: FakeConversationService,
71
- };
72
- });
73
60
  const Account_1 = require("./Account");
74
61
  const notification_2 = require("./notification");
75
62
  const BASE_URL = 'mock-backend.wire.com';
@@ -78,10 +65,8 @@ const MOCK_BACKEND = {
78
65
  rest: `https://${BASE_URL}`,
79
66
  ws: `wss://${BASE_URL}`,
80
67
  };
81
- const apiClients = [];
82
68
  async function createAccount() {
83
69
  const apiClient = new api_client_1.APIClient({ urls: MOCK_BACKEND });
84
- apiClients.push(apiClient);
85
70
  const account = new Account_1.Account(apiClient);
86
71
  await account['initServices']({
87
72
  clientType: client_1.ClientType.TEMPORARY,
@@ -112,9 +97,6 @@ const waitFor = (assertion) => {
112
97
  /* eslint-disable jest/no-conditional-expect */
113
98
  describe('Account', () => {
114
99
  const CLIENT_ID = '4e37b32f57f6da55';
115
- afterAll(() => {
116
- apiClients.forEach(client => client.disconnect());
117
- });
118
100
  // Fix for node 16, crypto.subtle.decrypt has a type problem
119
101
  jest.spyOn(global.crypto.subtle, 'decrypt').mockResolvedValue(new Uint8Array(32));
120
102
  const accessTokenData = {
@@ -123,8 +105,6 @@ describe('Account', () => {
123
105
  token_type: 'Bearer',
124
106
  user: 'aaf9a833-ef30-4c22-86a0-9adc8a15b3b4',
125
107
  };
126
- const markerId = '90da5591-0a26-45f8-bbb2-6c0fc4a2df19';
127
- const websocketServerAddress = `${MOCK_BACKEND.ws}/v${Config_1.MINIMUM_API_VERSION}/events?access_token=${accessTokenData.access_token}&marker=${markerId}`;
128
108
  beforeEach(() => {
129
109
  (0, nock_1.default)(MOCK_BACKEND.rest)
130
110
  .post(auth_1.AuthAPI.URL.LOGIN, body => body.email && body.password)
@@ -154,14 +134,6 @@ describe('Account', () => {
154
134
  .get(`${notification_1.NotificationAPI.URL.NOTIFICATION}/${notification_1.NotificationAPI.URL.LAST}`)
155
135
  .query({ client: CLIENT_ID })
156
136
  .reply(http_status_codes_1.StatusCodes.OK, {});
157
- (0, nock_1.default)(MOCK_BACKEND.rest)
158
- .get(`/api-version`)
159
- .reply(http_status_codes_1.StatusCodes.OK, {
160
- supported: [Config_1.MINIMUM_API_VERSION],
161
- federation: false,
162
- development: [Config_1.MINIMUM_API_VERSION + 1],
163
- domain: 'zinfra.io',
164
- });
165
137
  (0, nock_1.default)(MOCK_BACKEND.rest)
166
138
  .get(notification_1.NotificationAPI.URL.NOTIFICATION)
167
139
  .query({ client: CLIENT_ID, size: 10000 })
@@ -170,16 +142,6 @@ describe('Account', () => {
170
142
  (0, nock_1.default)(MOCK_BACKEND.rest)
171
143
  .get(client_1.ClientAPI.URL.CLIENTS)
172
144
  .reply(http_status_codes_1.StatusCodes.OK, [{ id: CLIENT_ID }]);
173
- (0, nock_1.default)(MOCK_BACKEND.rest)
174
- .put(/\/clients\/[\w-]+$/, {
175
- capabilities: ['legalhold-implicit-consent', 'consumable-notifications'],
176
- })
177
- .reply(http_status_codes_1.StatusCodes.OK);
178
- (0, nock_1.default)(MOCK_BACKEND.rest)
179
- .put(/\/clients\/[\w-]+$/, {
180
- capabilities: ['legalhold-implicit-consent'],
181
- })
182
- .reply(http_status_codes_1.StatusCodes.OK);
183
145
  (0, nock_1.default)(MOCK_BACKEND.rest)
184
146
  .get(self_1.SelfAPI.URL.SELF)
185
147
  .reply(http_status_codes_1.StatusCodes.OK, {
@@ -201,7 +163,6 @@ describe('Account', () => {
201
163
  (0, nock_1.cleanAll)();
202
164
  });
203
165
  const currentClient = {
204
- capabilities: [],
205
166
  id: CLIENT_ID,
206
167
  cookie: '',
207
168
  time: '',
@@ -212,9 +173,6 @@ describe('Account', () => {
212
173
  describe('"init"', () => {
213
174
  it('initializes the Protocol buffers', async () => {
214
175
  const account = new Account_1.Account();
215
- if (account['apiClient']) {
216
- apiClients.push(account['apiClient']);
217
- }
218
176
  await account['initServices']({ clientType: client_1.ClientType.TEMPORARY, userId: '' });
219
177
  expect(account.service.conversation).toBeDefined();
220
178
  const message = protocol_messaging_1.GenericMessage.create({
@@ -227,7 +185,6 @@ describe('Account', () => {
227
185
  describe('"login"', () => {
228
186
  it('logs in with correct credentials', async () => {
229
187
  const apiClient = new api_client_1.APIClient({ urls: MOCK_BACKEND });
230
- apiClients.push(apiClient);
231
188
  const account = new Account_1.Account(apiClient);
232
189
  await account['initServices']({ clientType: client_1.ClientType.TEMPORARY, userId: '' });
233
190
  const { clientType, userId } = await account.login({
@@ -240,7 +197,6 @@ describe('Account', () => {
240
197
  });
241
198
  it('does not log in with incorrect credentials', async () => {
242
199
  const apiClient = new api_client_1.APIClient({ urls: MOCK_BACKEND });
243
- apiClients.push(apiClient);
244
200
  const account = new Account_1.Account(apiClient);
245
201
  let backendError;
246
202
  await account['initServices']({ clientType: client_1.ClientType.TEMPORARY, userId: '' });
@@ -262,9 +218,35 @@ describe('Account', () => {
262
218
  }
263
219
  });
264
220
  });
221
+ it('emits text messages', () => {
222
+ return new Promise(async (resolve) => {
223
+ const { account, apiClient } = await createAccount();
224
+ await account.login({
225
+ clientType: client_1.ClientType.TEMPORARY,
226
+ email: 'hello@example.com',
227
+ password: 'my-secret',
228
+ });
229
+ account['currentClient'] = currentClient;
230
+ jest.spyOn(apiClient, 'connect').mockImplementation();
231
+ jest.spyOn(account.service.notification, 'handleEvent').mockReturnValue({
232
+ status: 'handled',
233
+ payload: {
234
+ event: { type: event_1.CONVERSATION_EVENT.OTR_MESSAGE_ADD },
235
+ },
236
+ });
237
+ const kill = account.listen({
238
+ onEvent: ({ event }) => {
239
+ expect(event.type).toBe(event_1.CONVERSATION_EVENT.OTR_MESSAGE_ADD);
240
+ resolve();
241
+ },
242
+ });
243
+ apiClient.transport.ws.emit(tcp_1.WebSocketClient.TOPIC.ON_MESSAGE, { payload: [{}] });
244
+ kill();
245
+ });
246
+ });
265
247
  describe('Websocket connection', () => {
266
- let dependencies;
267
248
  let server;
249
+ let dependencies;
268
250
  const mockNotifications = (size) => {
269
251
  const notifications = Array.from(new Array(size)).map(() => ({
270
252
  id: (0, uuid_1.v4)(),
@@ -285,12 +267,12 @@ describe('Account', () => {
285
267
  return callback();
286
268
  };
287
269
  };
288
- beforeAll(() => {
270
+ beforeEach(() => {
271
+ server = new jest_websocket_mock_1.WS(`${MOCK_BACKEND.ws}/await?access_token=${accessTokenData.access_token}`);
289
272
  // Forces the reconnecting websocket not to automatically reconnect (to avoid infinitely hanging tests)
290
273
  ReconnectingWebsocket_1.ReconnectingWebsocket['RECONNECTING_OPTIONS'].maxRetries = 0;
291
274
  });
292
275
  beforeEach(async () => {
293
- server = new jest_websocket_mock_1.WS(websocketServerAddress); // isolate per test
294
276
  dependencies = await createAccount();
295
277
  const { account } = dependencies;
296
278
  await account.login({
@@ -305,48 +287,46 @@ describe('Account', () => {
305
287
  jest
306
288
  .spyOn(dependencies.account.service.notification['database'], 'getLastNotificationId')
307
289
  .mockResolvedValue('0');
308
- await account.useAPIVersion(Config_1.MINIMUM_API_VERSION, Config_1.MINIMUM_API_VERSION);
309
- jest
310
- .spyOn(dependencies.apiClient.transport.ws, 'buildWebSocketUrl')
311
- .mockResolvedValue(websocketServerAddress);
312
- jest.spyOn(dependencies.account, 'getNotificationEventTime').mockReturnValue('2025-10-01T00:00:00Z');
313
290
  });
314
291
  afterEach(() => {
315
- server.close(); // ensure server shutdown
316
- jest_websocket_mock_1.WS.clean();
292
+ server.close();
317
293
  });
318
294
  describe('listen', () => {
319
- it('connects to websocket after the notification stream has been processed', async () => {
320
- jest
321
- .spyOn(dependencies.account, 'getClientCapabilities')
322
- .mockReturnValue([client_1.ClientCapability.LEGAL_HOLD_IMPLICIT_CONSENT]);
295
+ it('warns consumer of the connection state', async () => {
296
+ return new Promise(async (resolve) => {
297
+ const expectedConnectionStates = [
298
+ Account_1.ConnectionState.CONNECTING,
299
+ Account_1.ConnectionState.PROCESSING_NOTIFICATIONS,
300
+ Account_1.ConnectionState.LIVE,
301
+ Account_1.ConnectionState.CLOSED,
302
+ ];
303
+ const disconnect = dependencies.account.listen({
304
+ onConnectionStateChanged: state => {
305
+ expect(state).toBe(expectedConnectionStates.splice(0, 1)[0]);
306
+ switch (state) {
307
+ case Account_1.ConnectionState.LIVE:
308
+ // We socket is live we disconnect before ending the test
309
+ disconnect();
310
+ break;
311
+ case Account_1.ConnectionState.CLOSED:
312
+ resolve();
313
+ }
314
+ },
315
+ });
316
+ });
317
+ });
318
+ it('processes notification stream upon connection', async () => {
323
319
  return new Promise(async (resolve) => {
324
320
  const nbNotifications = 10;
325
321
  const onNotificationStreamProgress = jest.fn();
326
- const onEvent = jest.fn().mockImplementation(() => { });
322
+ const onEvent = jest.fn();
327
323
  mockNotifications(nbNotifications);
328
- await dependencies.account.listen({
329
- useLegacy: false,
330
- onConnectionStateChanged: callWhen(Account_1.ConnectionState.LIVE, async () => {
324
+ const disconnect = dependencies.account.listen({
325
+ onConnectionStateChanged: callWhen(Account_1.ConnectionState.LIVE, () => {
331
326
  expect(onNotificationStreamProgress).toHaveBeenCalledTimes(nbNotifications);
332
327
  expect(onEvent).toHaveBeenCalledTimes(nbNotifications);
333
328
  expect(onEvent).toHaveBeenCalledWith(expect.any(Object), notification_2.NotificationSource.NOTIFICATION_STREAM);
334
- expect(onEvent).not.toHaveBeenCalledWith(expect.any(Object), notification_2.NotificationSource.WEBSOCKET);
335
- onEvent.mockReset();
336
- await server.connected;
337
- jest
338
- .spyOn(dependencies.account.service.notification, 'handleNotification')
339
- .mockReturnValue([{ event: { testData: 1 } }]);
340
- server.send(JSON.stringify({
341
- type: ConsumableNotification_1.ConsumableEvent.EVENT,
342
- data: {
343
- delivery_tag: 1000,
344
- event: { id: (0, uuid_1.v4)(), payload: [] },
345
- },
346
- }));
347
- await waitFor(() => expect(onEvent).toHaveBeenCalledTimes(1));
348
- expect(onEvent).not.toHaveBeenCalledWith(expect.any(Object), notification_2.NotificationSource.NOTIFICATION_STREAM);
349
- expect(onEvent).toHaveBeenCalledWith(expect.any(Object), notification_2.NotificationSource.WEBSOCKET);
329
+ disconnect();
350
330
  resolve();
351
331
  }),
352
332
  onEvent: onEvent,
@@ -354,66 +334,24 @@ describe('Account', () => {
354
334
  });
355
335
  });
356
336
  });
357
- it('sends information to consumer of the connection state change in order', async () => {
358
- await new Promise(async (resolve) => {
359
- mockNotifications(10);
360
- const onConnectionStateChanged = jest.fn().mockImplementation((state) => {
361
- switch (state) {
362
- case Account_1.ConnectionState.LIVE:
363
- break;
364
- case Account_1.ConnectionState.CLOSED:
365
- // Expect all states to have been called in order
366
- expect(onConnectionStateChanged).toHaveBeenNthCalledWith(1, Account_1.ConnectionState.PROCESSING_NOTIFICATIONS);
367
- expect(onConnectionStateChanged).toHaveBeenNthCalledWith(2, Account_1.ConnectionState.CONNECTING);
368
- expect(onConnectionStateChanged).toHaveBeenNthCalledWith(3, Account_1.ConnectionState.LIVE);
369
- resolve();
370
- break;
371
- }
372
- });
373
- const disconnect = await dependencies.account.listen({
374
- useLegacy: false,
375
- onConnectionStateChanged,
376
- });
377
- await waitFor(() => expect(onConnectionStateChanged).toHaveBeenCalledWith(Account_1.ConnectionState.LIVE));
378
- disconnect();
379
- });
380
- });
381
- it('warns consumer of the connection close', async () => {
382
- await new Promise(async (resolve) => {
383
- mockNotifications(10);
384
- const onConnectionStateChanged = jest.fn().mockImplementation((state) => {
385
- switch (state) {
386
- case Account_1.ConnectionState.LIVE:
387
- break;
388
- case Account_1.ConnectionState.CLOSED:
389
- // Expect all states to have been called in order
390
- expect(onConnectionStateChanged).toHaveBeenNthCalledWith(1, Account_1.ConnectionState.PROCESSING_NOTIFICATIONS);
391
- expect(onConnectionStateChanged).toHaveBeenNthCalledWith(2, Account_1.ConnectionState.CONNECTING);
392
- expect(onConnectionStateChanged).toHaveBeenNthCalledWith(3, Account_1.ConnectionState.CLOSED);
393
- resolve();
394
- break;
395
- }
396
- });
397
- const disconnect = await dependencies.account.listen({
398
- useLegacy: false,
399
- onConnectionStateChanged,
400
- });
401
- await waitFor(() => expect(onConnectionStateChanged).toHaveBeenCalledWith(Account_1.ConnectionState.PROCESSING_NOTIFICATIONS));
402
- disconnect();
403
- });
404
- });
405
- it('processes notification stream upon connection', async () => {
337
+ it('fowards events from websocket to consumer after the notification stream has been processed', async () => {
406
338
  return new Promise(async (resolve) => {
407
339
  const nbNotifications = 10;
408
340
  const onNotificationStreamProgress = jest.fn();
409
341
  const onEvent = jest.fn();
410
342
  mockNotifications(nbNotifications);
411
- await dependencies.account.listen({
412
- useLegacy: false,
413
- onConnectionStateChanged: callWhen(Account_1.ConnectionState.LIVE, () => {
343
+ const disconnect = dependencies.account.listen({
344
+ onConnectionStateChanged: callWhen(Account_1.ConnectionState.LIVE, async () => {
414
345
  expect(onNotificationStreamProgress).toHaveBeenCalledTimes(nbNotifications);
415
346
  expect(onEvent).toHaveBeenCalledTimes(nbNotifications);
416
347
  expect(onEvent).toHaveBeenCalledWith(expect.any(Object), notification_2.NotificationSource.NOTIFICATION_STREAM);
348
+ expect(onEvent).not.toHaveBeenCalledWith(expect.any(Object), notification_2.NotificationSource.WEBSOCKET);
349
+ onEvent.mockReset();
350
+ server.send(JSON.stringify({ id: (0, uuid_1.v4)(), payload: [{}] }));
351
+ await waitFor(() => expect(onEvent).toHaveBeenCalledTimes(1));
352
+ expect(onEvent).not.toHaveBeenCalledWith(expect.any(Object), notification_2.NotificationSource.NOTIFICATION_STREAM);
353
+ expect(onEvent).toHaveBeenCalledWith(expect.any(Object), notification_2.NotificationSource.WEBSOCKET);
354
+ disconnect();
417
355
  resolve();
418
356
  }),
419
357
  onEvent: onEvent,
@@ -421,41 +359,63 @@ describe('Account', () => {
421
359
  });
422
360
  });
423
361
  });
424
- it('does stop processing messages if websocket connection is aborted', async () => {
425
- jest
426
- .spyOn(dependencies.account, 'getClientCapabilities')
427
- .mockReturnValue([client_1.ClientCapability.LEGAL_HOLD_IMPLICIT_CONSENT, client_1.ClientCapability.CONSUMABLE_NOTIFICATIONS]);
362
+ it('locks the websocket and waits for notification stream to be processed before sending websocket events', async () => {
428
363
  const nbNotifications = 10;
429
364
  const onNotificationStreamProgress = jest.fn();
430
- const onEvent = jest
365
+ const onEvent = jest.fn();
366
+ mockNotifications(nbNotifications);
367
+ return new Promise(async (resolve) => {
368
+ const disconnect = dependencies.account.listen({
369
+ onConnectionStateChanged: async (state) => {
370
+ switch (state) {
371
+ case Account_1.ConnectionState.PROCESSING_NOTIFICATIONS:
372
+ // sending a message as soon as the notificaiton stream starts to process
373
+ // This message should only be forwarded once the notification stream is fully processed
374
+ server.send(JSON.stringify({ id: (0, uuid_1.v4)(), payload: [{}] }));
375
+ break;
376
+ case Account_1.ConnectionState.LIVE:
377
+ expect(onNotificationStreamProgress).toHaveBeenCalledTimes(nbNotifications);
378
+ expect(onEvent).toHaveBeenCalledTimes(nbNotifications);
379
+ expect(onEvent).toHaveBeenCalledWith(expect.any(Object), notification_2.NotificationSource.NOTIFICATION_STREAM);
380
+ expect(onEvent).not.toHaveBeenCalledWith(expect.any(Object), notification_2.NotificationSource.WEBSOCKET);
381
+ onEvent.mockReset();
382
+ await waitFor(() => expect(onEvent).toHaveBeenCalledTimes(1));
383
+ expect(onEvent).not.toHaveBeenCalledWith(expect.any(Object), notification_2.NotificationSource.NOTIFICATION_STREAM);
384
+ expect(onEvent).toHaveBeenCalledWith(expect.any(Object), notification_2.NotificationSource.WEBSOCKET);
385
+ disconnect();
386
+ resolve();
387
+ }
388
+ },
389
+ onEvent: onEvent,
390
+ onNotificationStreamProgress: onNotificationStreamProgress,
391
+ });
392
+ });
393
+ });
394
+ it('does not unlock the websocket if the connection was aborted', async () => {
395
+ const nbNotifications = 10;
396
+ const onNotificationStreamProgress = jest
431
397
  .fn()
432
398
  .mockImplementationOnce(() => { })
433
- .mockImplementationOnce(() => {
434
- // abort websocket connection after the second notification is processeed
435
- server.close({ reason: 'Aborted by test', code: 2000, wasClean: true });
436
- });
437
- return new Promise(async (resolve) => {
438
- return dependencies.account.listen({
439
- useLegacy: false,
399
+ .mockImplementationOnce(() => server.close());
400
+ const onEvent = jest.fn();
401
+ mockNotifications(nbNotifications);
402
+ return new Promise(async (resolve, reject) => {
403
+ dependencies.account.listen({
440
404
  onConnectionStateChanged: async (state) => {
441
405
  switch (state) {
442
- case Account_1.ConnectionState.CONNECTING:
443
- await server.connected;
444
- for (let i = 0; i < nbNotifications; i++) {
445
- server.send(JSON.stringify({
446
- type: ConsumableNotification_1.ConsumableEvent.EVENT,
447
- data: {
448
- delivery_tag: 1000,
449
- event: { id: (0, uuid_1.v4)(), payload: [{ domain: 'zinfra.io', type: 'federation.delete' }] },
450
- },
451
- }));
452
- }
406
+ case Account_1.ConnectionState.PROCESSING_NOTIFICATIONS:
407
+ // sending a message as soon as the notificaiton stream starts to process
408
+ // This message should only be forwarded once the notification stream is fully processed
409
+ server.send(JSON.stringify({ id: (0, uuid_1.v4)(), payload: [{}] }));
453
410
  break;
411
+ case Account_1.ConnectionState.LIVE:
412
+ reject(new Error());
413
+ throw new Error('should not go to `live` state');
454
414
  case Account_1.ConnectionState.CLOSED:
455
415
  expect(onNotificationStreamProgress).toHaveBeenCalledTimes(2);
456
416
  expect(onEvent).toHaveBeenCalledTimes(2);
457
- expect(onEvent).toHaveBeenCalledWith({ domain: 'zinfra.io', type: 'federation.delete' }, notification_2.NotificationSource.WEBSOCKET);
458
- expect(dependencies.account.service.notification.handleNotification).toHaveBeenCalledTimes(2);
417
+ expect(onEvent).toHaveBeenCalledWith(expect.any(Object), notification_2.NotificationSource.NOTIFICATION_STREAM);
418
+ expect(dependencies.account.service.notification.handleNotification).not.toHaveBeenCalledWith(expect.any(Object), notification_2.NotificationSource.WEBSOCKET);
459
419
  resolve();
460
420
  }
461
421
  },
@@ -464,6 +424,35 @@ describe('Account', () => {
464
424
  });
465
425
  });
466
426
  });
427
+ it('cancels notification stream process if socket is disconnected', () => {
428
+ const nbNotifications = 10;
429
+ const onNotificationStreamProgress = jest.fn();
430
+ const onEvent = jest
431
+ .fn()
432
+ .mockImplementationOnce(() => { })
433
+ .mockImplementationOnce(() => {
434
+ // on second message, we kill the websocket
435
+ server.close();
436
+ });
437
+ mockNotifications(nbNotifications);
438
+ return new Promise(resolve => {
439
+ dependencies.account.listen({
440
+ onConnectionStateChanged: callWhen(Account_1.ConnectionState.CLOSED, () => {
441
+ try {
442
+ expect(onNotificationStreamProgress).toHaveBeenCalledTimes(1);
443
+ expect(onEvent).toHaveBeenCalledTimes(2);
444
+ expect(onEvent).toHaveBeenCalledWith(expect.any(Object), notification_2.NotificationSource.NOTIFICATION_STREAM);
445
+ }
446
+ catch (error) {
447
+ throw error;
448
+ }
449
+ resolve();
450
+ }, 1),
451
+ onEvent: onEvent,
452
+ onNotificationStreamProgress: onNotificationStreamProgress,
453
+ });
454
+ });
455
+ });
467
456
  });
468
457
  });
469
458
  });
@@ -1,3 +1,3 @@
1
- import { Availability } from '@wireapp/protocol-messaging';
1
+ import { Availability } from '@pydio/protocol-messaging';
2
2
  export type AvailabilityType = Availability.Type;
3
3
  //# sourceMappingURL=AvailabilityType.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"AvailabilityType.d.ts","sourceRoot":"","sources":["../../src/broadcast/AvailabilityType.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,YAAY,EAAC,MAAM,6BAA6B,CAAC;AAEzD,MAAM,MAAM,gBAAgB,GAAG,YAAY,CAAC,IAAI,CAAC"}
1
+ {"version":3,"file":"AvailabilityType.d.ts","sourceRoot":"","sources":["../../src/broadcast/AvailabilityType.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,YAAY,EAAC,MAAM,2BAA2B,CAAC;AAEvD,MAAM,MAAM,gBAAgB,GAAG,YAAY,CAAC,IAAI,CAAC"}
@@ -1,6 +1,6 @@
1
+ import { GenericMessage } from '@pydio/protocol-messaging';
1
2
  import { MessageSendingStatus, QualifiedUserClients } from '@wireapp/api-client/lib/conversation';
2
3
  import { APIClient } from '@wireapp/api-client';
3
- import { GenericMessage } from '@wireapp/protocol-messaging';
4
4
  import { ProteusService } from '../messagingProtocols/proteus';
5
5
  export declare class BroadcastService {
6
6
  private readonly apiClient;
@@ -1 +1 @@
1
- {"version":3,"file":"BroadcastService.d.ts","sourceRoot":"","sources":["../../src/broadcast/BroadcastService.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,oBAAoB,EAAE,oBAAoB,EAAC,MAAM,sCAAsC,CAAC;AAEhG,OAAO,EAAC,SAAS,EAAC,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAC,cAAc,EAAC,MAAM,6BAA6B,CAAC;AAK3D,OAAO,EAAC,cAAc,EAAC,MAAM,+BAA+B,CAAC;AAE7D,qBAAa,gBAAgB;IAIzB,OAAO,CAAC,QAAQ,CAAC,SAAS;IAC1B,OAAO,CAAC,QAAQ,CAAC,cAAc;IAJjC,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAiB;gBAG7B,SAAS,EAAE,SAAS,EACpB,cAAc,EAAE,cAAc;IAKpC,uBAAuB,CAClC,cAAc,EAAE,cAAc,EAC9B,UAAU,EAAE,oBAAoB,EAChC,gBAAgB,CAAC,EAAE,CAAC,QAAQ,EAAE,oBAAoB,KAAK,IAAI,GAAG,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;CAY3F"}
1
+ {"version":3,"file":"BroadcastService.d.ts","sourceRoot":"","sources":["../../src/broadcast/BroadcastService.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,cAAc,EAAC,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAC,oBAAoB,EAAE,oBAAoB,EAAC,MAAM,sCAAsC,CAAC;AAEhG,OAAO,EAAC,SAAS,EAAC,MAAM,qBAAqB,CAAC;AAK9C,OAAO,EAAC,cAAc,EAAC,MAAM,+BAA+B,CAAC;AAE7D,qBAAa,gBAAgB;IAIzB,OAAO,CAAC,QAAQ,CAAC,SAAS;IAC1B,OAAO,CAAC,QAAQ,CAAC,cAAc;IAJjC,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAiB;gBAG7B,SAAS,EAAE,SAAS,EACpB,cAAc,EAAE,cAAc;IAKpC,uBAAuB,CAClC,cAAc,EAAE,cAAc,EAC9B,UAAU,EAAE,oBAAoB,EAChC,gBAAgB,CAAC,EAAE,CAAC,QAAQ,EAAE,oBAAoB,KAAK,IAAI,GAAG,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;CAY3F"}
@@ -19,7 +19,7 @@
19
19
  */
20
20
  Object.defineProperty(exports, "__esModule", { value: true });
21
21
  exports.BroadcastService = void 0;
22
- const protocol_messaging_1 = require("@wireapp/protocol-messaging");
22
+ const protocol_messaging_1 = require("@pydio/protocol-messaging");
23
23
  const messageSender_1 = require("../conversation/message/messageSender");
24
24
  const MessageService_1 = require("../conversation/message/MessageService");
25
25
  const UserClientsUtil_1 = require("../conversation/message/UserClientsUtil");
@@ -1,5 +1,5 @@
1
1
  import { LoginData } from '@wireapp/api-client/lib/auth/';
2
- import { ClientCapabilityData, RegisteredClient } from '@wireapp/api-client/lib/client/';
2
+ import { RegisteredClient } from '@wireapp/api-client/lib/client/';
3
3
  import { APIClient } from '@wireapp/api-client';
4
4
  import { CRUDEngine } from '@wireapp/store-engine';
5
5
  import type { ProteusService } from '../messagingProtocols/proteus';
@@ -45,14 +45,13 @@ export declare class ClientService {
45
45
  *
46
46
  * @return the loaded client or undefined
47
47
  */
48
- loadClient(): Promise<MetaClient | undefined>;
48
+ loadClient(): Promise<RegisteredClient | undefined>;
49
49
  private createLocalClient;
50
- putClientCapabilities(clientId: string, capabilities: ClientCapabilityData): Promise<void>;
51
50
  /**
52
51
  * Will download all the clients of the self user (excluding the current client) and will store them in the database
53
52
  * @param currentClient - the id of the current client (to be excluded from the list)
54
53
  */
55
54
  synchronizeClients(currentClient: string): Promise<MetaClient[]>;
56
- register(loginData: LoginData, clientInfo: ClientInfo, { prekeys, lastPrekey }: InitialPrekeys, useLegacyNotificationStream?: boolean): Promise<RegisteredClient>;
55
+ register(loginData: LoginData, clientInfo: ClientInfo, { prekeys, lastPrekey }: InitialPrekeys): Promise<RegisteredClient>;
57
56
  }
58
57
  //# sourceMappingURL=ClientService.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ClientService.d.ts","sourceRoot":"","sources":["../../src/client/ClientService.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,SAAS,EAAC,MAAM,+BAA+B,CAAC;AACxD,OAAO,EAEL,oBAAoB,EAGpB,gBAAgB,EACjB,MAAM,iCAAiC,CAAC;AAKzC,OAAO,EAAC,SAAS,EAAC,MAAM,qBAAqB,CAAC;AAE9C,OAAO,EAAC,UAAU,EAAC,MAAM,uBAAuB,CAAC;AAEjD,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAC,cAAc,EAAC,MAAM,2DAA2D,CAAC;AAEzF,OAAO,EAAC,UAAU,EAAoD,MAAM,IAAI,CAAC;AAEjF,MAAM,WAAW,UAAW,SAAQ,gBAAgB;IAClD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE;QACJ,WAAW,CAAC,EAAE,OAAO,CAAC;QACtB,eAAe,CAAC,EAAE,OAAO,CAAC;QAC1B,WAAW,EAAE,MAAM,CAAC;KACrB,CAAC;CACH;AAED,qBAAa,aAAa;IAMtB,OAAO,CAAC,QAAQ,CAAC,SAAS;IAC1B,OAAO,CAAC,QAAQ,CAAC,cAAc;IAC/B,OAAO,CAAC,QAAQ,CAAC,WAAW;IAP9B,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAA2B;IACpD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA0B;IAClD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAgD;gBAGpD,SAAS,EAAE,SAAS,EACpB,cAAc,EAAE,cAAc,EAC9B,WAAW,EAAE,UAAU;IAMnC,UAAU,IAAI,OAAO,CAAC,gBAAgB,EAAE,CAAC;IAIhD;;;;;;;OAOG;IACU,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAMhF;;;OAGG;IACU,iBAAiB,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;YAepD,cAAc;IAQ5B;;;;;;;OAOG;IACU,UAAU,IAAI,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC;IAyB1D,OAAO,CAAC,iBAAiB;IAIlB,qBAAqB,CAAC,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,oBAAoB,GAAG,OAAO,CAAC,IAAI,CAAC;IAIjG;;;OAGG;IACU,kBAAkB,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC;IAUhE,QAAQ,CACnB,SAAS,EAAE,SAAS,EACpB,UAAU,EAAE,UAAU,EACtB,EAAC,OAAO,EAAE,UAAU,EAAC,EAAE,cAAc,EACrC,2BAA2B,GAAE,OAAc,GAC1C,OAAO,CAAC,gBAAgB,CAAC;CAkC7B"}
1
+ {"version":3,"file":"ClientService.d.ts","sourceRoot":"","sources":["../../src/client/ClientService.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,SAAS,EAAC,MAAM,+BAA+B,CAAC;AACxD,OAAO,EAAoD,gBAAgB,EAAC,MAAM,iCAAiC,CAAC;AAKpH,OAAO,EAAC,SAAS,EAAC,MAAM,qBAAqB,CAAC;AAE9C,OAAO,EAAC,UAAU,EAAC,MAAM,uBAAuB,CAAC;AAEjD,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAC,cAAc,EAAC,MAAM,2DAA2D,CAAC;AAEzF,OAAO,EAAC,UAAU,EAAoD,MAAM,IAAI,CAAC;AAEjF,MAAM,WAAW,UAAW,SAAQ,gBAAgB;IAClD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE;QACJ,WAAW,CAAC,EAAE,OAAO,CAAC;QACtB,eAAe,CAAC,EAAE,OAAO,CAAC;QAC1B,WAAW,EAAE,MAAM,CAAC;KACrB,CAAC;CACH;AAED,qBAAa,aAAa;IAMtB,OAAO,CAAC,QAAQ,CAAC,SAAS;IAC1B,OAAO,CAAC,QAAQ,CAAC,cAAc;IAC/B,OAAO,CAAC,QAAQ,CAAC,WAAW;IAP9B,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAA2B;IACpD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA0B;IAClD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAgD;gBAGpD,SAAS,EAAE,SAAS,EACpB,cAAc,EAAE,cAAc,EAC9B,WAAW,EAAE,UAAU;IAMnC,UAAU,IAAI,OAAO,CAAC,gBAAgB,EAAE,CAAC;IAIhD;;;;;;;OAOG;IACU,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAMhF;;;OAGG;IACU,iBAAiB,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;YASpD,cAAc;IAQ5B;;;;;;;OAOG;IACU,UAAU,IAAI,OAAO,CAAC,gBAAgB,GAAG,SAAS,CAAC;IAyBhE,OAAO,CAAC,iBAAiB;IAIzB;;;OAGG;IACU,kBAAkB,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC;IAUhE,QAAQ,CACnB,SAAS,EAAE,SAAS,EACpB,UAAU,EAAE,UAAU,EACtB,EAAC,OAAO,EAAE,UAAU,EAAC,EAAE,cAAc,GACpC,OAAO,CAAC,gBAAgB,CAAC;CA6B7B"}
@@ -64,16 +64,9 @@ class ClientService {
64
64
  async deleteLocalClient(password) {
65
65
  const localClientId = this.apiClient.context?.clientId;
66
66
  if (!localClientId) {
67
- // No client in context -> there's nothing to delete on backend, just drop local state
68
- this.logger.warn('No local client id in context; deleting local client data from DB only.');
69
- return this.database.deleteLocalClient();
70
- }
71
- try {
72
- await this.backend.deleteClient(localClientId, password);
73
- }
74
- catch (error) {
75
- this.logger.warn('Failed to delete client on backend', error);
67
+ throw new Error('Trying to delete local client, but local client has not been set');
76
68
  }
69
+ await this.backend.deleteClient(localClientId, password);
77
70
  return this.database.deleteLocalClient();
78
71
  }
79
72
  async getLocalClient() {
@@ -105,7 +98,7 @@ class ClientService {
105
98
  const notFoundOnBackend = axios_1.default.isAxiosError(error) ? error.response?.status === http_status_codes_1.StatusCodes.NOT_FOUND : false;
106
99
  if (notFoundOnBackend && this.storeEngine) {
107
100
  const shouldDeleteWholeDatabase = loadedClient.type === client_1.ClientType.TEMPORARY;
108
- await this.proteusService.wipe();
101
+ await this.proteusService.wipe(this.storeEngine);
109
102
  if (shouldDeleteWholeDatabase) {
110
103
  await this.storeEngine.clearTables();
111
104
  }
@@ -118,9 +111,6 @@ class ClientService {
118
111
  createLocalClient(client, domain) {
119
112
  return this.database.createLocalClient(client, domain);
120
113
  }
121
- putClientCapabilities(clientId, capabilities) {
122
- return this.backend.putClient(clientId, capabilities);
123
- }
124
114
  /**
125
115
  * Will download all the clients of the self user (excluding the current client) and will store them in the database
126
116
  * @param currentClient - the id of the current client (to be excluded from the list)
@@ -131,20 +121,16 @@ class ClientService {
131
121
  return this.database.createClientList({ id: this.apiClient.context.userId, domain: this.apiClient.context.domain ?? '' }, filteredClients);
132
122
  }
133
123
  // TODO: Split functionality into "create" and "register" client
134
- async register(loginData, clientInfo, { prekeys, lastPrekey }, useLegacyNotificationStream = true) {
124
+ async register(loginData, clientInfo, { prekeys, lastPrekey }) {
135
125
  if (!this.apiClient.context) {
136
126
  throw new Error('Context is not set.');
137
127
  }
138
128
  if (loginData.clientType === client_1.ClientType.NONE) {
139
129
  throw new Error(`Can't register client of type "${client_1.ClientType.NONE}"`);
140
130
  }
141
- const capabilities = [client_1.ClientCapability.LEGAL_HOLD_IMPLICIT_CONSENT];
142
- if (!useLegacyNotificationStream) {
143
- capabilities.push(client_1.ClientCapability.CONSUMABLE_NOTIFICATIONS);
144
- }
145
131
  const newClient = {
146
132
  class: clientInfo.classification,
147
- capabilities,
133
+ capabilities: [client_1.ClientCapability.LEGAL_HOLD_IMPLICIT_CONSENT],
148
134
  cookie: clientInfo.cookieLabel,
149
135
  label: clientInfo.label,
150
136
  lastkey: lastPrekey,
@@ -1,3 +1,3 @@
1
- import { Asset } from '@wireapp/protocol-messaging';
1
+ import { Asset } from '@pydio/protocol-messaging';
2
2
  export type AbortReason = Asset.NotUploaded;
3
3
  //# sourceMappingURL=AbortReason.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"AbortReason.d.ts","sourceRoot":"","sources":["../../src/conversation/AbortReason.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,KAAK,EAAC,MAAM,6BAA6B,CAAC;AAElD,MAAM,MAAM,WAAW,GAAG,KAAK,CAAC,WAAW,CAAC"}
1
+ {"version":3,"file":"AbortReason.d.ts","sourceRoot":"","sources":["../../src/conversation/AbortReason.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,KAAK,EAAC,MAAM,2BAA2B,CAAC;AAEhD,MAAM,MAAM,WAAW,GAAG,KAAK,CAAC,WAAW,CAAC"}