@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
@@ -1,117 +0,0 @@
1
- "use strict";
2
- /*
3
- * Wire
4
- * Copyright (C) 2025 Wire Swiss GmbH
5
- *
6
- * This program is free software: you can redistribute it and/or modify
7
- * it under the terms of the GNU General Public License as published by
8
- * the Free Software Foundation, either version 3 of the License, or
9
- * (at your option) any later version.
10
- *
11
- * This program is distributed in the hope that it will be useful,
12
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
- * GNU General Public License for more details.
15
- *
16
- * You should have received a copy of the GNU General Public License
17
- * along with this program. If not, see http://www.gnu.org/licenses/.
18
- *
19
- */
20
- Object.defineProperty(exports, "__esModule", { value: true });
21
- const conversation_1 = require("@wireapp/api-client/lib/conversation");
22
- const bazinga64_1 = require("bazinga64");
23
- const core_crypto_1 = require("@wireapp/core-crypto");
24
- const MlsErrorMapper_1 = require("./MlsErrorMapper");
25
- const CoreCryptoMLSError_1 = require("../MLSService/CoreCryptoMLSError");
26
- // Helpers
27
- const id = { id: 'conv-id', domain: 'wire.test' };
28
- const groupIdBase64 = bazinga64_1.Encoder.toBase64(new Uint8Array([1, 2, 3, 4])).asString;
29
- const mapper = (0, MlsErrorMapper_1.createDefaultMlsErrorMapper)();
30
- function map(error, extra) {
31
- return mapper.map(error, { qualifiedConversationId: id, groupId: extra?.groupId });
32
- }
33
- describe('MlsErrorMapper', () => {
34
- afterEach(() => {
35
- jest.restoreAllMocks();
36
- });
37
- it('maps WrongEpoch via stale message class instance', () => {
38
- const err = new conversation_1.MLSStaleMessageError('stale');
39
- const mapped = map(err, { groupId: groupIdBase64 });
40
- expect(mapped.type).toBe('WrongEpoch');
41
- expect(mapped.context?.qualifiedConversationId).toEqual(id);
42
- expect(mapped.context?.groupId).toBe(groupIdBase64);
43
- });
44
- it('maps GroupNotEstablished for broken conversation error', () => {
45
- const err = {
46
- type: core_crypto_1.ErrorType.Mls,
47
- context: {
48
- type: core_crypto_1.MlsErrorType.MessageRejected,
49
- context: { reason: (0, CoreCryptoMLSError_1.serializeAbortReason)({ message: CoreCryptoMLSError_1.UPLOAD_COMMIT_BUNDLE_ABORT_REASONS.BROKEN_MLS_CONVERSATION }) },
50
- },
51
- };
52
- const mapped = map(err);
53
- expect(mapped.type).toBe('GroupNotEstablished');
54
- });
55
- it('maps GroupOutOfSync with missing users list', () => {
56
- const missing = [
57
- { id: 'u1', domain: 'wire.test' },
58
- { id: 'u2', domain: 'wire.test' },
59
- ];
60
- const err = {
61
- type: core_crypto_1.ErrorType.Mls,
62
- context: {
63
- type: core_crypto_1.MlsErrorType.MessageRejected,
64
- context: {
65
- reason: (0, CoreCryptoMLSError_1.serializeAbortReason)({
66
- message: CoreCryptoMLSError_1.UPLOAD_COMMIT_BUNDLE_ABORT_REASONS.MLS_GROUP_OUT_OF_SYNC,
67
- missing_users: missing,
68
- }),
69
- },
70
- },
71
- };
72
- const mapped = map(err, { groupId: groupIdBase64 });
73
- expect(mapped.type).toBe('GroupOutOfSync');
74
- expect(mapped.context?.missingUsers).toEqual(missing);
75
- expect(mapped.context?.groupId).toBe(groupIdBase64);
76
- });
77
- it('maps ConversationAlreadyExists and extracts groupId bytes', () => {
78
- const conversationIdArray = [1, 2, 3, 4];
79
- const expectedGroupId = bazinga64_1.Encoder.toBase64(new Uint8Array(conversationIdArray)).asString;
80
- const err = {
81
- type: core_crypto_1.ErrorType.Mls,
82
- context: { type: core_crypto_1.MlsErrorType.ConversationAlreadyExists, context: { conversationId: conversationIdArray } },
83
- };
84
- const mapped = map(err);
85
- expect(mapped.type).toBe('ConversationAlreadyExists');
86
- expect(mapped.context?.groupId).toBe(expectedGroupId);
87
- });
88
- it('maps OrphanWelcome', () => {
89
- const err = { type: core_crypto_1.ErrorType.Mls, context: { type: core_crypto_1.MlsErrorType.OrphanWelcome } };
90
- const mapped = map(err);
91
- expect(mapped.type).toBe('OrphanWelcome');
92
- expect(mapped.context?.qualifiedConversationId).toEqual(id);
93
- });
94
- it('falls back to Unknown for unmapped error', () => {
95
- const err = new Error('random');
96
- const mapped = map(err);
97
- expect(mapped.type).toBe(core_crypto_1.MlsErrorType.Other);
98
- expect(mapped.cause).toBe(err);
99
- });
100
- it('honors handler priority (WrongEpoch before GroupOutOfSync)', () => {
101
- const err = new Error('ambiguous');
102
- err.name = CoreCryptoMLSError_1.CORE_CRYPTO_ERROR_NAMES.MlsErrorWrongEpoch; // triggers WrongEpoch guard
103
- // Also craft message-rejected with out-of-sync to trigger GroupOutOfSync guard
104
- err.type = core_crypto_1.ErrorType.Mls;
105
- err.context = {
106
- type: core_crypto_1.MlsErrorType.MessageRejected,
107
- context: {
108
- reason: (0, CoreCryptoMLSError_1.serializeAbortReason)({
109
- message: CoreCryptoMLSError_1.UPLOAD_COMMIT_BUNDLE_ABORT_REASONS.MLS_GROUP_OUT_OF_SYNC,
110
- missing_users: [],
111
- }),
112
- },
113
- };
114
- const mapped = map(err);
115
- expect(mapped.type).toBe('WrongEpoch');
116
- });
117
- });
@@ -1,167 +0,0 @@
1
- import { SUBCONVERSATION_ID } from '@wireapp/api-client/lib/conversation';
2
- import { QualifiedId } from '@wireapp/api-client/lib/user';
3
- import { DomainMlsErrorType, MlsErrorMapper } from './MlsErrorMapper';
4
- import { BaseCreateConversationResponse } from '../../../conversation';
5
- /**
6
- * Coordinates recovery actions for MLS operations.
7
- *
8
- * The orchestrator takes an arbitrary async "operation" (e.g. send, add users, handle welcome),
9
- * executes it, and on failure maps the thrown error to a DomainMlsError via {@link MlsErrorMapper}.
10
- * A recovery policy is then resolved and executed exactly-once per unique key, with optional
11
- * re-run of the original operation after recovery.
12
- *
13
- * Key properties:
14
- * - Single-flight: duplicate recoveries (same action+conversation+group+subconv) are deduplicated.
15
- * - Per-operation policies: the same DomainMlsError can map to different actions depending on operation.
16
- * - Non-invasive: the orchestrator has no MLS logic; it calls provided deps to perform actions.
17
- */
18
- /**
19
- * Concrete recovery actions the orchestrator can trigger.
20
- */
21
- export declare enum RecoveryActionKind {
22
- /**
23
- * Issue an external-commit join for the conversation.
24
- */
25
- JoinViaExternalCommit = "JoinViaExternalCommit",
26
- /**
27
- * Fetch missing epoch state and reconcile.
28
- */
29
- RecoverFromEpochMismatch = "RecoverFromEpochMismatch",
30
- /**
31
- * Tear down local MLS state and re-create the group.
32
- */
33
- ResetAndReestablish = "ResetAndReestablish",
34
- /**
35
- * Add users reported as missing to get the group back in sync.
36
- */
37
- AddMissingUsers = "AddMissingUsers",
38
- /**
39
- * Remove local MLS artifacts for the group and retry welcome handling.
40
- */
41
- WipeAndReprocessWelcome = "WipeAndReprocessWelcome",
42
- /**
43
- * No matching policy found; treated as no-op and the original error is re-thrown.
44
- */
45
- Unknown = "Unknown"
46
- }
47
- /**
48
- * Retry behavior for an operation under recovery.
49
- */
50
- export type RetryPolicy = {
51
- maxAttempts: number;
52
- delayMs?: number;
53
- /**
54
- * Whether to retry the original operation once after a successful recovery
55
- */
56
- reRunOriginalOperation?: boolean;
57
- };
58
- /**
59
- * A single recovery policy that pairs an action with a retry configuration.
60
- */
61
- export type RecoveryPolicy = {
62
- action: RecoveryActionKind;
63
- retryConfig: RetryPolicy;
64
- };
65
- type PerOperationPolicies = Partial<Record<OperationName, RecoveryPolicy>>;
66
- /**
67
- * Global policy table from DomainMlsErrorType to RecoveryPolicy.
68
- *
69
- * A value can be either a flat policy (applies to all operations) or a per-operation
70
- * map that allows different actions depending on the invoking operation.
71
- */
72
- export type PolicyTable = Partial<Record<DomainMlsErrorType, RecoveryPolicy | PerOperationPolicies>>;
73
- export declare enum OperationName {
74
- send = "send",
75
- addUsers = "addUsers",
76
- removeUsers = "removeUsers",
77
- joinExternalCommit = "joinExternalCommit",
78
- handleWelcome = "handleWelcome",
79
- handleMessageAdd = "handleMessageAdd",
80
- keyMaterialUpdate = "keyMaterialUpdate"
81
- }
82
- /**
83
- * Context about the operation being orchestrated. Used for policy selection and keying.
84
- */
85
- export type OperationContext = {
86
- operationName: OperationName;
87
- qualifiedConversationId?: QualifiedId;
88
- groupId?: string;
89
- subconvId?: SUBCONVERSATION_ID;
90
- };
91
- /**
92
- * Public orchestrator interface. Wrap your async operation with {@link execute}.
93
- *
94
- * The callback is invoked immediately. If it throws, the orchestrator maps the error,
95
- * performs recovery according to policies, optionally waits, and may re-run the callback once.
96
- */
97
- export interface MlsRecoveryOrchestrator {
98
- execute(params: executeParams<void>): Promise<void>;
99
- execute<T>(params: executeParams<T>): Promise<T>;
100
- }
101
- /**
102
- * Concrete side-effecting functions the orchestrator uses to perform recovery.
103
- * Provided by the MLS layer/service.
104
- */
105
- export type OrchestratorDeps = {
106
- joinViaExternalCommit: (conversationId: QualifiedId) => Promise<void>;
107
- resetAndReestablish: (conversationId: QualifiedId) => Promise<void>;
108
- recoverFromEpochMismatch: (conversationId: QualifiedId, subconvId?: SUBCONVERSATION_ID) => Promise<void>;
109
- addMissingUsers: (conversationId: QualifiedId, groupId: string, users: QualifiedId[]) => Promise<BaseCreateConversationResponse>;
110
- wipeMLSConversation: (groupId: string) => Promise<void>;
111
- };
112
- /**
113
- * Parameters for {@link execute}.
114
- */
115
- type executeParams<T> = {
116
- context: OperationContext;
117
- callBack: () => Promise<T>;
118
- retry?: boolean;
119
- };
120
- /**
121
- * Default implementation with in-process deduplication keyed by action and context.
122
- */
123
- export declare class MlsRecoveryOrchestratorImpl implements MlsRecoveryOrchestrator {
124
- private readonly mapper;
125
- private readonly policies;
126
- private readonly deps;
127
- private readonly inProgressRecoveries;
128
- private readonly logger;
129
- constructor(mapper: MlsErrorMapper, policies: PolicyTable, deps: OrchestratorDeps, inProgressRecoveries?: Set<string>, logger?: import("logdown").Logger);
130
- /**
131
- * Execute the provided callback, and on failure, map and perform a configured recovery.
132
- * If {@link RetryPolicy.reRunOriginalOperation} is true, the callback is re-invoked once after recovery.
133
- */
134
- execute(params: executeParams<void>): Promise<void>;
135
- execute<T>(params: executeParams<T>): Promise<T>;
136
- /** Resolve the effective policy for the mapped error and operation. Supports per-operation policies. */
137
- private getPolicyFor;
138
- /**
139
- * Execute the concrete recovery action once per unique recovery key. Throws if required context is missing.
140
- * For WipeAndReprocessWelcome, attempts to derive groupId from either the operation context or error context.
141
- */
142
- private performRecovery;
143
- /**
144
- * Build a stable deduplication key from action and operation context.
145
- */
146
- private getRecoveryKey;
147
- /**
148
- * Ensure the provided async task runs at most once for the given key at a time.
149
- */
150
- private runOnceWithKey;
151
- /** Optionally wait before re-invoking the original operation. */
152
- private maybeDelay;
153
- private sleep;
154
- }
155
- /**
156
- * Minimal default policies used by the initial integration. These can be extended over time.
157
- *
158
- * Highlights:
159
- * - WrongEpoch: reconcile and retry for typed ops; do not re-run for join.
160
- * - GroupNotEstablished: reset and re-establish; typed ops re-run once.
161
- * - GroupOutOfSync: add missing users and retry for typed ops.
162
- * - ConversationAlreadyExists (welcome): wipe local MLS state and re-run welcome once.
163
- * - OrphanWelcome (welcome): attempt join via external commit; do not re-run.
164
- */
165
- export declare const minimalDefaultPolicies: PolicyTable;
166
- export {};
167
- //# sourceMappingURL=MlsRecoveryOrchestrator.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"MlsRecoveryOrchestrator.d.ts","sourceRoot":"","sources":["../../../../src/messagingProtocols/mls/recovery/MlsRecoveryOrchestrator.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,kBAAkB,EAAC,MAAM,sCAAsC,CAAC;AACxE,OAAO,EAAC,WAAW,EAAC,MAAM,8BAA8B,CAAC;AAIzD,OAAO,EAAiB,kBAAkB,EAAE,cAAc,EAAC,MAAM,kBAAkB,CAAC;AAEpF,OAAO,EAAC,8BAA8B,EAAC,MAAM,uBAAuB,CAAC;AAErE;;;;;;;;;;;;GAYG;AAEH;;GAEG;AACH,oBAAY,kBAAkB;IAC5B;;OAEG;IACH,qBAAqB,0BAA0B;IAC/C;;OAEG;IACH,wBAAwB,6BAA6B;IACrD;;OAEG;IACH,mBAAmB,wBAAwB;IAC3C;;OAEG;IACH,eAAe,oBAAoB;IACnC;;OAEG;IACH,uBAAuB,4BAA4B;IACnD;;OAEG;IACH,OAAO,YAAY;CACpB;AAED;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,sBAAsB,CAAC,EAAE,OAAO,CAAC;CAClC,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B,MAAM,EAAE,kBAAkB,CAAC;IAC3B,WAAW,EAAE,WAAW,CAAC;CAC1B,CAAC;AAEF,KAAK,oBAAoB,GAAG,OAAO,CAAC,MAAM,CAAC,aAAa,EAAE,cAAc,CAAC,CAAC,CAAC;AAC3E;;;;;GAKG;AACH,MAAM,MAAM,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC,kBAAkB,EAAE,cAAc,GAAG,oBAAoB,CAAC,CAAC,CAAC;AAErG,oBAAY,aAAa;IACvB,IAAI,SAAS;IACb,QAAQ,aAAa;IACrB,WAAW,gBAAgB;IAC3B,kBAAkB,uBAAuB;IACzC,aAAa,kBAAkB;IAC/B,gBAAgB,qBAAqB;IACrC,iBAAiB,sBAAsB;CACxC;AAED;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B,aAAa,EAAE,aAAa,CAAC;IAC7B,uBAAuB,CAAC,EAAE,WAAW,CAAC;IACtC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,kBAAkB,CAAC;CAChC,CAAC;AAEF;;;;;GAKG;AACH,MAAM,WAAW,uBAAuB;IAEtC,OAAO,CAAC,MAAM,EAAE,aAAa,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEpD,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,aAAa,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;CAClD;AAED;;;GAGG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B,qBAAqB,EAAE,CAAC,cAAc,EAAE,WAAW,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACtE,mBAAmB,EAAE,CAAC,cAAc,EAAE,WAAW,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACpE,wBAAwB,EAAE,CAAC,cAAc,EAAE,WAAW,EAAE,SAAS,CAAC,EAAE,kBAAkB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACzG,eAAe,EAAE,CACf,cAAc,EAAE,WAAW,EAC3B,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,WAAW,EAAE,KACjB,OAAO,CAAC,8BAA8B,CAAC,CAAC;IAE7C,mBAAmB,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CACzD,CAAC;AAEF;;GAEG;AACH,KAAK,aAAa,CAAC,CAAC,IAAI;IACtB,OAAO,EAAE,gBAAgB,CAAC;IAC1B,QAAQ,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,CAAC;IAC3B,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,CAAC;AAMF;;GAEG;AACH,qBAAa,2BAA4B,YAAW,uBAAuB;IAEvE,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,QAAQ;IACzB,OAAO,CAAC,QAAQ,CAAC,IAAI;IACrB,OAAO,CAAC,QAAQ,CAAC,oBAAoB;IACrC,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAJN,MAAM,EAAE,cAAc,EACtB,QAAQ,EAAE,WAAW,EACrB,IAAI,EAAE,gBAAgB,EACtB,oBAAoB,GAAE,GAAG,CAAC,MAAM,CAAa,EAC7C,MAAM,2BAAgE;IAGzF;;;OAGG;IACU,OAAO,CAAC,MAAM,EAAE,aAAa,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IACnD,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,aAAa,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC;IAgC7D,wGAAwG;IACxG,OAAO,CAAC,YAAY,CAYlB;IAEF;;;OAGG;YACW,eAAe;IAsD7B;;OAEG;IACH,OAAO,CAAC,cAAc;IAStB;;OAEG;IACH,OAAO,CAAC,cAAc,CAgBpB;IAEF,iEAAiE;YACnD,UAAU;IAOxB,OAAO,CAAC,KAAK;CAGd;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,sBAAsB,EAAE,WA4EpC,CAAC"}
@@ -1,317 +0,0 @@
1
- "use strict";
2
- /*
3
- * Wire
4
- * Copyright (C) 2025 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.minimalDefaultPolicies = exports.MlsRecoveryOrchestratorImpl = exports.OperationName = exports.RecoveryActionKind = void 0;
22
- const commons_1 = require("@wireapp/commons");
23
- /**
24
- * Coordinates recovery actions for MLS operations.
25
- *
26
- * The orchestrator takes an arbitrary async "operation" (e.g. send, add users, handle welcome),
27
- * executes it, and on failure maps the thrown error to a DomainMlsError via {@link MlsErrorMapper}.
28
- * A recovery policy is then resolved and executed exactly-once per unique key, with optional
29
- * re-run of the original operation after recovery.
30
- *
31
- * Key properties:
32
- * - Single-flight: duplicate recoveries (same action+conversation+group+subconv) are deduplicated.
33
- * - Per-operation policies: the same DomainMlsError can map to different actions depending on operation.
34
- * - Non-invasive: the orchestrator has no MLS logic; it calls provided deps to perform actions.
35
- */
36
- /**
37
- * Concrete recovery actions the orchestrator can trigger.
38
- */
39
- var RecoveryActionKind;
40
- (function (RecoveryActionKind) {
41
- /**
42
- * Issue an external-commit join for the conversation.
43
- */
44
- RecoveryActionKind["JoinViaExternalCommit"] = "JoinViaExternalCommit";
45
- /**
46
- * Fetch missing epoch state and reconcile.
47
- */
48
- RecoveryActionKind["RecoverFromEpochMismatch"] = "RecoverFromEpochMismatch";
49
- /**
50
- * Tear down local MLS state and re-create the group.
51
- */
52
- RecoveryActionKind["ResetAndReestablish"] = "ResetAndReestablish";
53
- /**
54
- * Add users reported as missing to get the group back in sync.
55
- */
56
- RecoveryActionKind["AddMissingUsers"] = "AddMissingUsers";
57
- /**
58
- * Remove local MLS artifacts for the group and retry welcome handling.
59
- */
60
- RecoveryActionKind["WipeAndReprocessWelcome"] = "WipeAndReprocessWelcome";
61
- /**
62
- * No matching policy found; treated as no-op and the original error is re-thrown.
63
- */
64
- RecoveryActionKind["Unknown"] = "Unknown";
65
- })(RecoveryActionKind || (exports.RecoveryActionKind = RecoveryActionKind = {}));
66
- var OperationName;
67
- (function (OperationName) {
68
- OperationName["send"] = "send";
69
- OperationName["addUsers"] = "addUsers";
70
- OperationName["removeUsers"] = "removeUsers";
71
- OperationName["joinExternalCommit"] = "joinExternalCommit";
72
- OperationName["handleWelcome"] = "handleWelcome";
73
- OperationName["handleMessageAdd"] = "handleMessageAdd";
74
- OperationName["keyMaterialUpdate"] = "keyMaterialUpdate";
75
- })(OperationName || (exports.OperationName = OperationName = {}));
76
- function isRecoveryPolicy(entry) {
77
- return 'action' in entry && typeof entry.action === 'string';
78
- }
79
- /**
80
- * Default implementation with in-process deduplication keyed by action and context.
81
- */
82
- class MlsRecoveryOrchestratorImpl {
83
- mapper;
84
- policies;
85
- deps;
86
- inProgressRecoveries;
87
- logger;
88
- constructor(mapper, policies, deps, inProgressRecoveries = new Set(), logger = commons_1.LogFactory.getLogger('@wireapp/core/MlsRecoveryOrchestrator')) {
89
- this.mapper = mapper;
90
- this.policies = policies;
91
- this.deps = deps;
92
- this.inProgressRecoveries = inProgressRecoveries;
93
- this.logger = logger;
94
- }
95
- async execute({ context, callBack, retry = true }) {
96
- try {
97
- this.logger.info('Executing MLS operation with recovery orchestration', { context });
98
- return await callBack();
99
- }
100
- catch (rawError) {
101
- this.logger.info('Operation failed, invoking MLS recovery orchestrator', { rawError });
102
- const normalizedError = this.mapper.map(rawError, {
103
- qualifiedConversationId: context.qualifiedConversationId,
104
- groupId: context.groupId,
105
- subconvId: context.subconvId,
106
- });
107
- this.logger.info(`Mapped error to domain MLS error of type ${normalizedError.type}`, { normalizedError });
108
- const policy = this.getPolicyFor(normalizedError, context);
109
- this.logger.info(`Resolved recovery policy: action=${policy.action}`, { policy });
110
- if (policy.action === 'Unknown' || !retry) {
111
- this.logger.info('No recovery action configured or retry disabled, re-throwing original error');
112
- throw rawError;
113
- }
114
- const key = this.getRecoveryKey(context, policy.action);
115
- await this.performRecovery(context, normalizedError, policy, key);
116
- await this.maybeDelay(policy.retryConfig);
117
- if (policy.retryConfig.reRunOriginalOperation) {
118
- this.logger.info(`Re-running original operation after recovery for key ${key}`);
119
- return this.execute({ context, callBack, retry: false });
120
- }
121
- }
122
- }
123
- /** Resolve the effective policy for the mapped error and operation. Supports per-operation policies. */
124
- getPolicyFor = (err, ctx) => {
125
- const entry = this.policies[err.type];
126
- if (!entry) {
127
- return { action: RecoveryActionKind.Unknown, retryConfig: { maxAttempts: 0 } };
128
- }
129
- if (isRecoveryPolicy(entry)) {
130
- return entry;
131
- }
132
- const perOperationPolicy = entry;
133
- return perOperationPolicy[ctx.operationName] ?? { action: RecoveryActionKind.Unknown, retryConfig: { maxAttempts: 0 } };
134
- };
135
- /**
136
- * Execute the concrete recovery action once per unique recovery key. Throws if required context is missing.
137
- * For WipeAndReprocessWelcome, attempts to derive groupId from either the operation context or error context.
138
- */
139
- async performRecovery(context, err, policy, recoveryKey) {
140
- const id = context.qualifiedConversationId;
141
- if (!id) {
142
- const errorMessage = `Missing conversationId for recovery action ${policy.action}`;
143
- this.logger.error(errorMessage);
144
- throw new Error(errorMessage);
145
- }
146
- switch (policy.action) {
147
- case 'RecoverFromEpochMismatch': {
148
- await this.runOnceWithKey(recoveryKey, () => this.deps.recoverFromEpochMismatch(id, context.subconvId));
149
- break;
150
- }
151
- case 'JoinViaExternalCommit': {
152
- await this.runOnceWithKey(recoveryKey, () => this.deps.joinViaExternalCommit(id));
153
- break;
154
- }
155
- case 'ResetAndReestablish': {
156
- await this.runOnceWithKey(recoveryKey, () => this.deps.resetAndReestablish(id));
157
- break;
158
- }
159
- case 'AddMissingUsers': {
160
- const groupId = context.groupId;
161
- const missing = err.context?.missingUsers;
162
- if (!missing || missing.length === 0) {
163
- throw new Error('No missing users reported in error context for AddMissingUsers');
164
- }
165
- if (!groupId) {
166
- throw new Error('Missing groupId for AddMissingUsers');
167
- }
168
- await this.runOnceWithKey(recoveryKey, () => this.deps.addMissingUsers(id, groupId, missing));
169
- break;
170
- }
171
- case 'WipeAndReprocessWelcome': {
172
- // We rely on either the operation context groupId (preferred) or any mapped error context
173
- const groupId = context.groupId ?? err.context?.groupId;
174
- if (!groupId) {
175
- this.logger.warn('Could not determine groupId for WipeAndReprocessWelcome; skipping wipe');
176
- break;
177
- }
178
- await this.runOnceWithKey(recoveryKey, () => this.deps.wipeMLSConversation(groupId));
179
- break;
180
- }
181
- default:
182
- this.logger.info(`No recovery action taken for action ${policy.action}`);
183
- break;
184
- }
185
- }
186
- /**
187
- * Build a stable deduplication key from action and operation context.
188
- */
189
- getRecoveryKey(context, action) {
190
- const conv = context.qualifiedConversationId?.id ?? 'unknownConv';
191
- const group = context.groupId ?? 'unknownGroup';
192
- const sub = context.subconvId ?? 'none';
193
- const key = `${action}:${conv}:${group}:${String(sub)}`;
194
- this.logger.info(`Generated recovery key: ${key} for action ${action} with context`, { context });
195
- return key;
196
- }
197
- /**
198
- * Ensure the provided async task runs at most once for the given key at a time.
199
- */
200
- runOnceWithKey = async (key, task) => {
201
- if (this.inProgressRecoveries.has(key)) {
202
- this.logger.info(`Recovery already in progress for key ${key}, skipping duplicate recovery`);
203
- return;
204
- }
205
- this.logger.info(`Starting recovery for key ${key}`);
206
- this.inProgressRecoveries.add(key);
207
- try {
208
- await task();
209
- }
210
- catch (error) {
211
- this.logger.warn(`Recovery failed for key ${key}`, { error });
212
- throw error;
213
- }
214
- finally {
215
- this.logger.info(`Completed recovery for key ${key}`);
216
- this.inProgressRecoveries.delete(key);
217
- }
218
- };
219
- /** Optionally wait before re-invoking the original operation. */
220
- async maybeDelay(retry) {
221
- if (retry.delayMs) {
222
- this.logger.info(`Waiting for ${retry.delayMs}ms before retrying original operation`);
223
- await this.sleep(retry.delayMs);
224
- }
225
- }
226
- sleep(ms) {
227
- return new Promise(resolve => setTimeout(resolve, ms));
228
- }
229
- }
230
- exports.MlsRecoveryOrchestratorImpl = MlsRecoveryOrchestratorImpl;
231
- /**
232
- * Minimal default policies used by the initial integration. These can be extended over time.
233
- *
234
- * Highlights:
235
- * - WrongEpoch: reconcile and retry for typed ops; do not re-run for join.
236
- * - GroupNotEstablished: reset and re-establish; typed ops re-run once.
237
- * - GroupOutOfSync: add missing users and retry for typed ops.
238
- * - ConversationAlreadyExists (welcome): wipe local MLS state and re-run welcome once.
239
- * - OrphanWelcome (welcome): attempt join via external commit; do not re-run.
240
- */
241
- exports.minimalDefaultPolicies = {
242
- WrongEpoch: {
243
- // For join operations, recover from epoch mismatch; do not re-run original op
244
- joinExternalCommit: {
245
- action: RecoveryActionKind.RecoverFromEpochMismatch,
246
- retryConfig: { maxAttempts: 1, reRunOriginalOperation: false },
247
- },
248
- // For non-join operations, recover from epoch mismatch and retry original once
249
- send: {
250
- action: RecoveryActionKind.RecoverFromEpochMismatch,
251
- retryConfig: { maxAttempts: 1, reRunOriginalOperation: true },
252
- },
253
- addUsers: {
254
- action: RecoveryActionKind.RecoverFromEpochMismatch,
255
- retryConfig: { maxAttempts: 1, reRunOriginalOperation: true },
256
- },
257
- removeUsers: {
258
- action: RecoveryActionKind.RecoverFromEpochMismatch,
259
- retryConfig: { maxAttempts: 1, reRunOriginalOperation: true },
260
- },
261
- // For inbound message-add processing, fix epoch and allow normal flow to progress (no auto re-run)
262
- handleMessageAdd: {
263
- action: RecoveryActionKind.RecoverFromEpochMismatch,
264
- retryConfig: { maxAttempts: 1, reRunOriginalOperation: true },
265
- },
266
- keyMaterialUpdate: {
267
- action: RecoveryActionKind.RecoverFromEpochMismatch,
268
- retryConfig: { maxAttempts: 1, reRunOriginalOperation: false },
269
- },
270
- },
271
- // Use per-operation semantics so typed operations re-run once post-recovery
272
- GroupNotEstablished: {
273
- joinExternalCommit: {
274
- action: RecoveryActionKind.ResetAndReestablish,
275
- retryConfig: { maxAttempts: 1, reRunOriginalOperation: false },
276
- },
277
- send: { action: RecoveryActionKind.ResetAndReestablish, retryConfig: { maxAttempts: 1, reRunOriginalOperation: true } },
278
- addUsers: {
279
- action: RecoveryActionKind.ResetAndReestablish,
280
- retryConfig: { maxAttempts: 1, reRunOriginalOperation: true },
281
- },
282
- removeUsers: {
283
- action: RecoveryActionKind.ResetAndReestablish,
284
- retryConfig: { maxAttempts: 1, reRunOriginalOperation: true },
285
- },
286
- keyMaterialUpdate: {
287
- action: RecoveryActionKind.ResetAndReestablish,
288
- retryConfig: { maxAttempts: 1, reRunOriginalOperation: false },
289
- },
290
- },
291
- GroupOutOfSync: {
292
- send: { action: RecoveryActionKind.AddMissingUsers, retryConfig: { maxAttempts: 1, reRunOriginalOperation: true } },
293
- addUsers: { action: RecoveryActionKind.AddMissingUsers, retryConfig: { maxAttempts: 1, reRunOriginalOperation: true } },
294
- removeUsers: {
295
- action: RecoveryActionKind.AddMissingUsers,
296
- retryConfig: { maxAttempts: 1, reRunOriginalOperation: true },
297
- },
298
- keyMaterialUpdate: {
299
- action: RecoveryActionKind.AddMissingUsers,
300
- retryConfig: { maxAttempts: 1, reRunOriginalOperation: false },
301
- },
302
- },
303
- ConversationAlreadyExists: {
304
- // For welcome handling, wipe local state; do not auto re-run the original callback
305
- handleWelcome: {
306
- action: RecoveryActionKind.WipeAndReprocessWelcome,
307
- retryConfig: { maxAttempts: 1, reRunOriginalOperation: true },
308
- },
309
- },
310
- OrphanWelcome: {
311
- // For orphan welcome, attempt an external commit join; no auto re-run
312
- handleWelcome: {
313
- action: RecoveryActionKind.JoinViaExternalCommit,
314
- retryConfig: { maxAttempts: 1, reRunOriginalOperation: false },
315
- },
316
- },
317
- };
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=MlsRecoveryOrchestrator.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"MlsRecoveryOrchestrator.test.d.ts","sourceRoot":"","sources":["../../../../src/messagingProtocols/mls/recovery/MlsRecoveryOrchestrator.test.ts"],"names":[],"mappings":""}