@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.
- package/lib/Account.d.ts +51 -168
- package/lib/Account.d.ts.map +1 -1
- package/lib/Account.js +127 -517
- package/lib/Account.test.js +147 -158
- package/lib/broadcast/AvailabilityType.d.ts +1 -1
- package/lib/broadcast/AvailabilityType.d.ts.map +1 -1
- package/lib/broadcast/BroadcastService.d.ts +1 -1
- package/lib/broadcast/BroadcastService.d.ts.map +1 -1
- package/lib/broadcast/BroadcastService.js +1 -1
- package/lib/client/ClientService.d.ts +3 -4
- package/lib/client/ClientService.d.ts.map +1 -1
- package/lib/client/ClientService.js +5 -19
- package/lib/conversation/AbortReason.d.ts +1 -1
- package/lib/conversation/AbortReason.d.ts.map +1 -1
- package/lib/conversation/AssetService/AssetService.d.ts +30 -12
- package/lib/conversation/AssetService/AssetService.d.ts.map +1 -1
- package/lib/conversation/AssetService/AssetService.js +10 -1
- package/lib/conversation/AssetService/AssetService.test.js +3 -8
- package/lib/conversation/ClientActionType.d.ts +1 -1
- package/lib/conversation/ClientActionType.d.ts.map +1 -1
- package/lib/conversation/ClientActionType.js +1 -1
- package/lib/conversation/ConversationService/ConversationService.d.ts +14 -98
- package/lib/conversation/ConversationService/ConversationService.d.ts.map +1 -1
- package/lib/conversation/ConversationService/ConversationService.js +101 -314
- package/lib/conversation/ConversationService/ConversationService.test.js +47 -441
- package/lib/conversation/ConversationService/ConversationService.types.d.ts +4 -5
- package/lib/conversation/ConversationService/ConversationService.types.d.ts.map +1 -1
- package/lib/conversation/ConversationService/Utility/getConversationQualifiedMembers.d.ts.map +1 -1
- package/lib/conversation/ConversationService/Utility/getConversationQualifiedMembers.js +3 -6
- package/lib/conversation/SubconversationService/SubconversationService.d.ts.map +1 -1
- package/lib/conversation/SubconversationService/SubconversationService.js +11 -158
- package/lib/conversation/SubconversationService/SubconversationService.test.js +2 -8
- package/lib/conversation/content/AssetContent.d.ts +1 -1
- package/lib/conversation/content/AssetContent.d.ts.map +1 -1
- package/lib/conversation/content/ButtonActionConfirmationContent.d.ts +1 -1
- package/lib/conversation/content/ButtonActionConfirmationContent.d.ts.map +1 -1
- package/lib/conversation/content/ButtonActionContent.d.ts +1 -1
- package/lib/conversation/content/ButtonActionContent.d.ts.map +1 -1
- package/lib/conversation/content/ClearedContent.d.ts +1 -1
- package/lib/conversation/content/ClearedContent.d.ts.map +1 -1
- package/lib/conversation/content/ClientActionContent.d.ts +1 -1
- package/lib/conversation/content/ClientActionContent.d.ts.map +1 -1
- package/lib/conversation/content/CompositeContent.d.ts +1 -1
- package/lib/conversation/content/CompositeContent.d.ts.map +1 -1
- package/lib/conversation/content/ConfirmationContent.d.ts +1 -1
- package/lib/conversation/content/ConfirmationContent.d.ts.map +1 -1
- package/lib/conversation/content/DeletedContent.d.ts +1 -1
- package/lib/conversation/content/DeletedContent.d.ts.map +1 -1
- package/lib/conversation/content/HiddenContent.d.ts +1 -1
- package/lib/conversation/content/HiddenContent.d.ts.map +1 -1
- package/lib/conversation/content/KnockContent.d.ts +1 -1
- package/lib/conversation/content/KnockContent.d.ts.map +1 -1
- package/lib/conversation/content/LinkPreviewContent.d.ts +1 -1
- package/lib/conversation/content/LinkPreviewContent.d.ts.map +1 -1
- package/lib/conversation/content/MentionContent.d.ts +1 -1
- package/lib/conversation/content/MentionContent.d.ts.map +1 -1
- package/lib/conversation/content/MultipartContent.d.ts +1 -1
- package/lib/conversation/content/MultipartContent.d.ts.map +1 -1
- package/lib/conversation/content/QuoteContent.d.ts +1 -1
- package/lib/conversation/content/QuoteContent.d.ts.map +1 -1
- package/lib/conversation/content/TweetContent.d.ts +1 -1
- package/lib/conversation/content/TweetContent.d.ts.map +1 -1
- package/lib/conversation/content/index.d.ts +1 -1
- package/lib/conversation/content/index.d.ts.map +1 -1
- package/lib/conversation/content/index.js +1 -1
- package/lib/conversation/message/MessageBuilder.d.ts +1 -1
- package/lib/conversation/message/MessageBuilder.d.ts.map +1 -1
- package/lib/conversation/message/MessageBuilder.js +1 -1
- package/lib/conversation/message/MessageService.d.ts.map +1 -1
- package/lib/conversation/message/MessageService.js +1 -1
- package/lib/conversation/message/MessageService.test.js +1 -7
- package/lib/conversation/message/MessageToProtoMapper.d.ts +1 -1
- package/lib/conversation/message/MessageToProtoMapper.d.ts.map +1 -1
- package/lib/conversation/message/MessageToProtoMapper.js +1 -1
- package/lib/conversation/message/messageSender.js +2 -2
- package/lib/cryptography/AssetCryptography/EncryptedAsset.d.ts +2 -2
- package/lib/cryptography/AssetCryptography/EncryptedAsset.d.ts.map +1 -1
- package/lib/messagingProtocols/common.types.d.ts +0 -9
- package/lib/messagingProtocols/common.types.d.ts.map +1 -1
- package/lib/messagingProtocols/mls/E2EIdentityService/E2EIService.types.d.ts +2 -2
- package/lib/messagingProtocols/mls/E2EIdentityService/E2EIService.types.d.ts.map +1 -1
- package/lib/messagingProtocols/mls/E2EIdentityService/E2EIService.types.js +1 -2
- package/lib/messagingProtocols/mls/E2EIdentityService/E2EIServiceExternal.d.ts +1 -1
- package/lib/messagingProtocols/mls/E2EIdentityService/E2EIServiceExternal.d.ts.map +1 -1
- package/lib/messagingProtocols/mls/E2EIdentityService/E2EIServiceExternal.js +11 -13
- package/lib/messagingProtocols/mls/E2EIdentityService/E2EIServiceExternal.test.js +16 -21
- package/lib/messagingProtocols/mls/E2EIdentityService/E2EIServiceInternal.d.ts +3 -9
- package/lib/messagingProtocols/mls/E2EIdentityService/E2EIServiceInternal.d.ts.map +1 -1
- package/lib/messagingProtocols/mls/E2EIdentityService/E2EIServiceInternal.js +12 -31
- package/lib/messagingProtocols/mls/E2EIdentityService/Helper/index.d.ts +0 -6
- package/lib/messagingProtocols/mls/E2EIdentityService/Helper/index.d.ts.map +1 -1
- package/lib/messagingProtocols/mls/E2EIdentityService/Helper/index.js +1 -19
- package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/IncomingMessagesQueue/IncomingMesssagesQueue.d.ts +4 -0
- package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/IncomingMessagesQueue/IncomingMesssagesQueue.d.ts.map +1 -0
- package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/IncomingMessagesQueue/IncomingMesssagesQueue.js +69 -0
- package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/IncomingMessagesQueue/index.d.ts +2 -0
- package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/{IncomingProposalsQueue → IncomingMessagesQueue}/index.d.ts.map +1 -1
- package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/{IncomingProposalsQueue → IncomingMessagesQueue}/index.js +1 -1
- package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/index.d.ts +1 -0
- package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/index.d.ts.map +1 -1
- package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/index.js +1 -0
- package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/messageAdd.d.ts.map +1 -1
- package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/messageAdd.js +14 -23
- package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/messageAdd.test.d.ts +2 -0
- package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/messageAdd.test.d.ts.map +1 -0
- package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/messageAdd.test.js +98 -0
- package/lib/messagingProtocols/mls/EventHandler/events/welcomeMessage/welcomeMessage.d.ts.map +1 -1
- package/lib/messagingProtocols/mls/EventHandler/events/welcomeMessage/welcomeMessage.js +2 -5
- package/lib/messagingProtocols/mls/EventHandler/events/welcomeMessage/welcomeMessage.test.js +3 -13
- package/lib/messagingProtocols/mls/MLSService/CoreCryptoMLSError.d.ts +2 -38
- package/lib/messagingProtocols/mls/MLSService/CoreCryptoMLSError.d.ts.map +1 -1
- package/lib/messagingProtocols/mls/MLSService/CoreCryptoMLSError.js +6 -41
- package/lib/messagingProtocols/mls/MLSService/MLSService.d.ts +34 -38
- package/lib/messagingProtocols/mls/MLSService/MLSService.d.ts.map +1 -1
- package/lib/messagingProtocols/mls/MLSService/MLSService.js +208 -267
- package/lib/messagingProtocols/mls/MLSService/MLSService.test.js +160 -157
- package/lib/messagingProtocols/mls/MLSService/commitBundleUtil.js +3 -3
- package/lib/messagingProtocols/mls/MLSService/commitBundleUtil.test.js +5 -5
- package/lib/messagingProtocols/mls/conversationRejoinQueue.js +2 -2
- package/lib/messagingProtocols/mls/types.d.ts +8 -0
- package/lib/messagingProtocols/mls/types.d.ts.map +1 -1
- package/lib/messagingProtocols/proteus/EventHandler/events/otrMessageAdd/otrMessageAdd.d.ts.map +1 -1
- package/lib/messagingProtocols/proteus/EventHandler/events/otrMessageAdd/otrMessageAdd.js +1 -7
- package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CoreCryptoWrapper/CoreCryptoWrapper.d.ts +15 -8
- package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CoreCryptoWrapper/CoreCryptoWrapper.d.ts.map +1 -1
- package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CoreCryptoWrapper/CoreCryptoWrapper.js +62 -97
- package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CryptoClient.types.d.ts +6 -0
- package/lib/messagingProtocols/proteus/ProteusService/CryptoClient/CryptoClient.types.d.ts.map +1 -1
- package/lib/messagingProtocols/proteus/ProteusService/DecryptionErrorGenerator/DecryptionErrorGenerator.d.ts +6 -1
- package/lib/messagingProtocols/proteus/ProteusService/DecryptionErrorGenerator/DecryptionErrorGenerator.d.ts.map +1 -1
- package/lib/messagingProtocols/proteus/ProteusService/DecryptionErrorGenerator/DecryptionErrorGenerator.js +22 -19
- package/lib/messagingProtocols/proteus/ProteusService/ProteusService.d.ts +3 -5
- package/lib/messagingProtocols/proteus/ProteusService/ProteusService.d.ts.map +1 -1
- package/lib/messagingProtocols/proteus/ProteusService/ProteusService.js +24 -11
- package/lib/messagingProtocols/proteus/ProteusService/ProteusService.mocks.d.ts +0 -1
- package/lib/messagingProtocols/proteus/ProteusService/ProteusService.mocks.d.ts.map +1 -1
- package/lib/messagingProtocols/proteus/ProteusService/ProteusService.mocks.js +2 -11
- package/lib/messagingProtocols/proteus/ProteusService/ProteusService.test.js +9 -13
- package/lib/messagingProtocols/proteus/ProteusService/ProteusService.types.d.ts +2 -3
- package/lib/messagingProtocols/proteus/ProteusService/ProteusService.types.d.ts.map +1 -1
- package/lib/messagingProtocols/proteus/ProteusService/WithMockedGenerics.test.js +4 -11
- package/lib/messagingProtocols/proteus/ProteusService/cryptoMigrationStateStore.d.ts +4 -0
- package/lib/messagingProtocols/proteus/ProteusService/cryptoMigrationStateStore.d.ts.map +1 -1
- package/lib/messagingProtocols/proteus/ProteusService/cryptoMigrationStateStore.js +5 -0
- package/lib/messagingProtocols/proteus/ProteusService/identityClearer.d.ts +1 -2
- package/lib/messagingProtocols/proteus/ProteusService/identityClearer.d.ts.map +1 -1
- package/lib/messagingProtocols/proteus/ProteusService/identityClearer.js +2 -8
- package/lib/messagingProtocols/proteus/Utility/SessionHandler/SessionHandler.test.js +0 -4
- package/lib/messagingProtocols/proteus/Utility/getGenericMessageParams.d.ts +1 -1
- package/lib/messagingProtocols/proteus/Utility/getGenericMessageParams.d.ts.map +1 -1
- package/lib/messagingProtocols/proteus/Utility/getGenericMessageParams.js +1 -1
- package/lib/notification/NotificationService.d.ts +6 -20
- package/lib/notification/NotificationService.d.ts.map +1 -1
- package/lib/notification/NotificationService.js +14 -23
- package/lib/notification/NotificationService.test.js +0 -8
- package/lib/secretStore/secretKeyGenerator.d.ts +0 -1
- package/lib/secretStore/secretKeyGenerator.d.ts.map +1 -1
- package/lib/secretStore/secretKeyGenerator.js +1 -3
- package/lib/self/SelfService.d.ts +2 -2
- package/lib/self/SelfService.d.ts.map +1 -1
- package/lib/self/SelfService.test.js +2 -5
- package/lib/team/TeamService.d.ts +2 -5
- package/lib/team/TeamService.d.ts.map +1 -1
- package/lib/team/TeamService.js +2 -12
- package/lib/user/UserService.d.ts +2 -2
- package/lib/user/UserService.d.ts.map +1 -1
- package/lib/user/UserService.js +3 -3
- package/lib/util/TypePredicateUtil.d.ts.map +1 -1
- package/lib/util/TypePredicateUtil.js +2 -2
- package/package.json +3 -3
- package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/IncomingProposalsQueue/IncomingProposalsQueue.d.ts +0 -7
- package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/IncomingProposalsQueue/IncomingProposalsQueue.d.ts.map +0 -1
- package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/IncomingProposalsQueue/IncomingProposalsQueue.js +0 -48
- package/lib/messagingProtocols/mls/EventHandler/events/messageAdd/IncomingProposalsQueue/index.d.ts +0 -2
- package/lib/messagingProtocols/mls/MLSService/CoreCryptoMLSError.test.d.ts +0 -2
- package/lib/messagingProtocols/mls/MLSService/CoreCryptoMLSError.test.d.ts.map +0 -1
- package/lib/messagingProtocols/mls/MLSService/CoreCryptoMLSError.test.js +0 -124
- package/lib/messagingProtocols/mls/recovery/MlsErrorMapper.d.ts +0 -78
- package/lib/messagingProtocols/mls/recovery/MlsErrorMapper.d.ts.map +0 -1
- package/lib/messagingProtocols/mls/recovery/MlsErrorMapper.js +0 -173
- package/lib/messagingProtocols/mls/recovery/MlsErrorMapper.test.d.ts +0 -2
- package/lib/messagingProtocols/mls/recovery/MlsErrorMapper.test.d.ts.map +0 -1
- package/lib/messagingProtocols/mls/recovery/MlsErrorMapper.test.js +0 -117
- package/lib/messagingProtocols/mls/recovery/MlsRecoveryOrchestrator.d.ts +0 -167
- package/lib/messagingProtocols/mls/recovery/MlsRecoveryOrchestrator.d.ts.map +0 -1
- package/lib/messagingProtocols/mls/recovery/MlsRecoveryOrchestrator.js +0 -317
- package/lib/messagingProtocols/mls/recovery/MlsRecoveryOrchestrator.test.d.ts +0 -2
- package/lib/messagingProtocols/mls/recovery/MlsRecoveryOrchestrator.test.d.ts.map +0 -1
- package/lib/messagingProtocols/mls/recovery/MlsRecoveryOrchestrator.test.js +0 -248
- package/lib/messagingProtocols/mls/recovery/index.d.ts +0 -5
- package/lib/messagingProtocols/mls/recovery/index.d.ts.map +0 -1
- package/lib/messagingProtocols/mls/recovery/index.js +0 -28
- package/lib/test/StoreHelper.d.ts +0 -2
- package/lib/test/StoreHelper.d.ts.map +0 -1
- package/lib/test/StoreHelper.js +0 -27
|
@@ -1,248 +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 MlsRecoveryOrchestrator_1 = require("./MlsRecoveryOrchestrator");
|
|
23
|
-
function qid(id = 'conv-1') {
|
|
24
|
-
return { id, domain: 'wire.test' };
|
|
25
|
-
}
|
|
26
|
-
function makeMapperReturning(err) {
|
|
27
|
-
return { map: jest.fn().mockReturnValue(err) };
|
|
28
|
-
}
|
|
29
|
-
describe('MlsRecoveryOrchestrator', () => {
|
|
30
|
-
const baseDeps = () => ({
|
|
31
|
-
joinViaExternalCommit: jest.fn().mockResolvedValue(undefined),
|
|
32
|
-
resetAndReestablish: jest.fn().mockResolvedValue(undefined),
|
|
33
|
-
recoverFromEpochMismatch: jest.fn().mockResolvedValue(undefined),
|
|
34
|
-
addMissingUsers: jest.fn().mockResolvedValue(undefined),
|
|
35
|
-
wipeMLSConversation: jest.fn().mockResolvedValue(undefined),
|
|
36
|
-
});
|
|
37
|
-
it('does nothing when callback succeeds', async () => {
|
|
38
|
-
const deps = baseDeps();
|
|
39
|
-
const mapper = makeMapperReturning({ type: 'Unknown' });
|
|
40
|
-
const orch = new MlsRecoveryOrchestrator_1.MlsRecoveryOrchestratorImpl(mapper, MlsRecoveryOrchestrator_1.minimalDefaultPolicies, deps);
|
|
41
|
-
const cb = jest.fn().mockResolvedValue('ok');
|
|
42
|
-
const res = await orch.execute({
|
|
43
|
-
context: { operationName: MlsRecoveryOrchestrator_1.OperationName.send, qualifiedConversationId: qid() },
|
|
44
|
-
callBack: cb,
|
|
45
|
-
});
|
|
46
|
-
expect(res).toBe('ok');
|
|
47
|
-
expect(cb).toHaveBeenCalledTimes(1);
|
|
48
|
-
expect(deps.joinViaExternalCommit).not.toHaveBeenCalled();
|
|
49
|
-
expect(deps.wipeMLSConversation).not.toHaveBeenCalled();
|
|
50
|
-
});
|
|
51
|
-
it('retries original when policy requests reRunOriginalOperation (WrongEpoch/send)', async () => {
|
|
52
|
-
const deps = baseDeps();
|
|
53
|
-
const mapper = makeMapperReturning({ type: 'WrongEpoch' });
|
|
54
|
-
const orch = new MlsRecoveryOrchestrator_1.MlsRecoveryOrchestratorImpl(mapper, MlsRecoveryOrchestrator_1.minimalDefaultPolicies, deps);
|
|
55
|
-
const cb = jest.fn().mockRejectedValueOnce(new Error('boom')).mockResolvedValueOnce('ok');
|
|
56
|
-
const res = await orch.execute({
|
|
57
|
-
context: {
|
|
58
|
-
operationName: MlsRecoveryOrchestrator_1.OperationName.send,
|
|
59
|
-
qualifiedConversationId: qid(),
|
|
60
|
-
subconvId: conversation_1.SUBCONVERSATION_ID.CONFERENCE,
|
|
61
|
-
},
|
|
62
|
-
callBack: cb,
|
|
63
|
-
});
|
|
64
|
-
expect(deps.recoverFromEpochMismatch).toHaveBeenCalledWith(qid(), conversation_1.SUBCONVERSATION_ID.CONFERENCE);
|
|
65
|
-
expect(cb).toHaveBeenCalledTimes(2);
|
|
66
|
-
expect(res).toBe('ok');
|
|
67
|
-
});
|
|
68
|
-
it('handles JoinViaExternalCommit without re-running original (OrphanWelcome/handleWelcome)', async () => {
|
|
69
|
-
const deps = baseDeps();
|
|
70
|
-
const mapper = makeMapperReturning({ type: 'OrphanWelcome' });
|
|
71
|
-
const orch = new MlsRecoveryOrchestrator_1.MlsRecoveryOrchestratorImpl(mapper, MlsRecoveryOrchestrator_1.minimalDefaultPolicies, deps);
|
|
72
|
-
const cb = jest.fn().mockRejectedValue(new Error('orphan'));
|
|
73
|
-
const res = await orch.execute({
|
|
74
|
-
context: { operationName: MlsRecoveryOrchestrator_1.OperationName.handleWelcome, qualifiedConversationId: qid() },
|
|
75
|
-
callBack: cb,
|
|
76
|
-
});
|
|
77
|
-
expect(deps.joinViaExternalCommit).toHaveBeenCalledWith(qid());
|
|
78
|
-
expect(cb).toHaveBeenCalledTimes(1);
|
|
79
|
-
expect(res).toBeUndefined();
|
|
80
|
-
});
|
|
81
|
-
it('wipes group using context groupId when ConversationAlreadyExists and retries once', async () => {
|
|
82
|
-
const deps = baseDeps();
|
|
83
|
-
const mapper = makeMapperReturning({ type: 'ConversationAlreadyExists' });
|
|
84
|
-
const orch = new MlsRecoveryOrchestrator_1.MlsRecoveryOrchestratorImpl(mapper, MlsRecoveryOrchestrator_1.minimalDefaultPolicies, deps);
|
|
85
|
-
const cb = jest.fn().mockRejectedValueOnce('exists').mockResolvedValueOnce(undefined);
|
|
86
|
-
await orch.execute({
|
|
87
|
-
context: {
|
|
88
|
-
operationName: MlsRecoveryOrchestrator_1.OperationName.handleWelcome,
|
|
89
|
-
qualifiedConversationId: qid(),
|
|
90
|
-
groupId: 'gid-from-context',
|
|
91
|
-
},
|
|
92
|
-
callBack: cb,
|
|
93
|
-
});
|
|
94
|
-
expect(deps.wipeMLSConversation).toHaveBeenCalledTimes(1);
|
|
95
|
-
expect(deps.wipeMLSConversation).toHaveBeenCalledWith('gid-from-context');
|
|
96
|
-
expect(cb).toHaveBeenCalledTimes(2);
|
|
97
|
-
});
|
|
98
|
-
it('wipes group using mapped error groupId when missing in context', async () => {
|
|
99
|
-
const deps = baseDeps();
|
|
100
|
-
const mapper = makeMapperReturning({
|
|
101
|
-
type: 'ConversationAlreadyExists',
|
|
102
|
-
context: { groupId: 'gid-from-error' },
|
|
103
|
-
});
|
|
104
|
-
const orch = new MlsRecoveryOrchestrator_1.MlsRecoveryOrchestratorImpl(mapper, MlsRecoveryOrchestrator_1.minimalDefaultPolicies, deps);
|
|
105
|
-
const cb = jest.fn().mockRejectedValueOnce('exists').mockResolvedValueOnce(undefined);
|
|
106
|
-
await orch.execute({
|
|
107
|
-
context: { operationName: MlsRecoveryOrchestrator_1.OperationName.handleWelcome, qualifiedConversationId: qid() },
|
|
108
|
-
callBack: cb,
|
|
109
|
-
});
|
|
110
|
-
expect(deps.wipeMLSConversation).toHaveBeenCalledWith('gid-from-error');
|
|
111
|
-
expect(cb).toHaveBeenCalledTimes(2);
|
|
112
|
-
});
|
|
113
|
-
it('throws if AddMissingUsers missing required inputs', async () => {
|
|
114
|
-
const deps = baseDeps();
|
|
115
|
-
const mapper = makeMapperReturning({ type: 'GroupOutOfSync', context: { missingUsers: [] } });
|
|
116
|
-
const policies = {
|
|
117
|
-
GroupOutOfSync: {
|
|
118
|
-
action: MlsRecoveryOrchestrator_1.RecoveryActionKind.AddMissingUsers,
|
|
119
|
-
retryConfig: { maxAttempts: 1, reRunOriginalOperation: true },
|
|
120
|
-
},
|
|
121
|
-
};
|
|
122
|
-
const orch = new MlsRecoveryOrchestrator_1.MlsRecoveryOrchestratorImpl(mapper, policies, deps);
|
|
123
|
-
const cb = jest.fn().mockRejectedValueOnce('oops');
|
|
124
|
-
await expect(orch.execute({
|
|
125
|
-
context: { operationName: MlsRecoveryOrchestrator_1.OperationName.send, qualifiedConversationId: qid(), groupId: 'gid' },
|
|
126
|
-
callBack: cb,
|
|
127
|
-
})).rejects.toThrow('No missing users reported in error context for AddMissingUsers');
|
|
128
|
-
});
|
|
129
|
-
it('calls AddMissingUsers with provided missing users and retries', async () => {
|
|
130
|
-
const deps = baseDeps();
|
|
131
|
-
const missing = [qid('u1'), qid('u2')];
|
|
132
|
-
const mapper = makeMapperReturning({ type: 'GroupOutOfSync', context: { missingUsers: missing } });
|
|
133
|
-
const policies = {
|
|
134
|
-
GroupOutOfSync: {
|
|
135
|
-
action: MlsRecoveryOrchestrator_1.RecoveryActionKind.AddMissingUsers,
|
|
136
|
-
retryConfig: { maxAttempts: 1, reRunOriginalOperation: true },
|
|
137
|
-
},
|
|
138
|
-
};
|
|
139
|
-
const orch = new MlsRecoveryOrchestrator_1.MlsRecoveryOrchestratorImpl(mapper, policies, deps);
|
|
140
|
-
const cb = jest.fn().mockRejectedValueOnce('oops').mockResolvedValueOnce('ok');
|
|
141
|
-
const res = await orch.execute({
|
|
142
|
-
context: { operationName: MlsRecoveryOrchestrator_1.OperationName.send, qualifiedConversationId: qid(), groupId: 'gid' },
|
|
143
|
-
callBack: cb,
|
|
144
|
-
});
|
|
145
|
-
expect(deps.addMissingUsers).toHaveBeenCalledWith(qid(), 'gid', missing);
|
|
146
|
-
expect(cb).toHaveBeenCalledTimes(2);
|
|
147
|
-
expect(res).toBe('ok');
|
|
148
|
-
});
|
|
149
|
-
it('rethrows when action is Unknown', async () => {
|
|
150
|
-
const deps = baseDeps();
|
|
151
|
-
const mapper = makeMapperReturning({ type: 'ConversationAlreadyExists' });
|
|
152
|
-
const policies = {
|
|
153
|
-
ConversationAlreadyExists: { action: MlsRecoveryOrchestrator_1.RecoveryActionKind.Unknown, retryConfig: { maxAttempts: 0 } },
|
|
154
|
-
};
|
|
155
|
-
const orch = new MlsRecoveryOrchestrator_1.MlsRecoveryOrchestratorImpl(mapper, policies, deps);
|
|
156
|
-
const cb = jest.fn().mockRejectedValue(new Error('problem'));
|
|
157
|
-
await expect(orch.execute({
|
|
158
|
-
context: { operationName: MlsRecoveryOrchestrator_1.OperationName.handleWelcome, qualifiedConversationId: qid() },
|
|
159
|
-
callBack: cb,
|
|
160
|
-
})).rejects.toThrow('problem');
|
|
161
|
-
});
|
|
162
|
-
it('deduplicates concurrent recoveries for the same key', async () => {
|
|
163
|
-
const deps = baseDeps();
|
|
164
|
-
const mapper = makeMapperReturning({ type: 'OrphanWelcome' });
|
|
165
|
-
const orch = new MlsRecoveryOrchestrator_1.MlsRecoveryOrchestratorImpl(mapper, MlsRecoveryOrchestrator_1.minimalDefaultPolicies, deps);
|
|
166
|
-
// Simulate slow recovery function to keep the window open
|
|
167
|
-
let resolveJoin = () => { };
|
|
168
|
-
const joinPromise = new Promise(resolve => {
|
|
169
|
-
resolveJoin = resolve;
|
|
170
|
-
});
|
|
171
|
-
deps.joinViaExternalCommit.mockImplementation(() => joinPromise);
|
|
172
|
-
const ctx = {
|
|
173
|
-
operationName: MlsRecoveryOrchestrator_1.OperationName.handleWelcome,
|
|
174
|
-
qualifiedConversationId: qid('same'),
|
|
175
|
-
};
|
|
176
|
-
const callBack = () => Promise.reject(new Error('orphan'));
|
|
177
|
-
const p1 = orch.execute({ context: ctx, callBack });
|
|
178
|
-
const p2 = orch.execute({ context: ctx, callBack });
|
|
179
|
-
// Let both catch handlers run and start recovery
|
|
180
|
-
await new Promise(r => setImmediate(r));
|
|
181
|
-
// Release the recovery
|
|
182
|
-
resolveJoin();
|
|
183
|
-
await Promise.all([p1, p2]);
|
|
184
|
-
expect(deps.joinViaExternalCommit).toHaveBeenCalledTimes(1);
|
|
185
|
-
});
|
|
186
|
-
it('waits delayMs before re-running original operation', async () => {
|
|
187
|
-
jest.useFakeTimers({ advanceTimers: true });
|
|
188
|
-
const deps = baseDeps();
|
|
189
|
-
const mapper = makeMapperReturning({ type: 'WrongEpoch' });
|
|
190
|
-
const policies = {
|
|
191
|
-
WrongEpoch: {
|
|
192
|
-
send: {
|
|
193
|
-
action: 'RecoverFromEpochMismatch',
|
|
194
|
-
retryConfig: { maxAttempts: 1, reRunOriginalOperation: true, delayMs: 50 },
|
|
195
|
-
},
|
|
196
|
-
},
|
|
197
|
-
};
|
|
198
|
-
const orch = new MlsRecoveryOrchestrator_1.MlsRecoveryOrchestratorImpl(mapper, policies, deps);
|
|
199
|
-
const cb = jest.fn().mockRejectedValueOnce(new Error('boom')).mockResolvedValueOnce('ok');
|
|
200
|
-
const runPromise = orch.execute({
|
|
201
|
-
context: {
|
|
202
|
-
operationName: MlsRecoveryOrchestrator_1.OperationName.send,
|
|
203
|
-
qualifiedConversationId: qid(),
|
|
204
|
-
subconvId: conversation_1.SUBCONVERSATION_ID.CONFERENCE,
|
|
205
|
-
},
|
|
206
|
-
callBack: cb,
|
|
207
|
-
});
|
|
208
|
-
// Flush any microtasks from initial rejection handling
|
|
209
|
-
await Promise.resolve();
|
|
210
|
-
expect(cb).toHaveBeenCalledTimes(1);
|
|
211
|
-
expect(deps.recoverFromEpochMismatch).toHaveBeenCalledWith(qid(), conversation_1.SUBCONVERSATION_ID.CONFERENCE);
|
|
212
|
-
// The rerun should not happen until timers advance
|
|
213
|
-
jest.advanceTimersByTime(49);
|
|
214
|
-
await Promise.resolve();
|
|
215
|
-
expect(cb).toHaveBeenCalledTimes(1);
|
|
216
|
-
// Advance past delay and await completion
|
|
217
|
-
jest.advanceTimersByTime(1);
|
|
218
|
-
// Drain queued timers and microtasks
|
|
219
|
-
await Promise.resolve();
|
|
220
|
-
const res = await runPromise;
|
|
221
|
-
expect(cb).toHaveBeenCalledTimes(2);
|
|
222
|
-
expect(res).toBe('ok');
|
|
223
|
-
jest.useRealTimers();
|
|
224
|
-
});
|
|
225
|
-
it('ResetAndReestablish re-runs original for add/remove operations', async () => {
|
|
226
|
-
const deps = baseDeps();
|
|
227
|
-
const mapper = makeMapperReturning({ type: 'GroupNotEstablished' });
|
|
228
|
-
const orch = new MlsRecoveryOrchestrator_1.MlsRecoveryOrchestratorImpl(mapper, MlsRecoveryOrchestrator_1.minimalDefaultPolicies, deps);
|
|
229
|
-
// addUsers path
|
|
230
|
-
const cbAdd = jest.fn().mockRejectedValueOnce(new Error('broken')).mockResolvedValueOnce('ok-add');
|
|
231
|
-
const resAdd = await orch.execute({
|
|
232
|
-
context: { operationName: MlsRecoveryOrchestrator_1.OperationName.addUsers, qualifiedConversationId: qid() },
|
|
233
|
-
callBack: cbAdd,
|
|
234
|
-
});
|
|
235
|
-
expect(deps.resetAndReestablish).toHaveBeenCalledWith(qid());
|
|
236
|
-
expect(cbAdd).toHaveBeenCalledTimes(2);
|
|
237
|
-
expect(resAdd).toBe('ok-add');
|
|
238
|
-
// removeUsers path
|
|
239
|
-
const cbRemove = jest.fn().mockRejectedValueOnce(new Error('broken')).mockResolvedValueOnce('ok-remove');
|
|
240
|
-
const resRemove = await orch.execute({
|
|
241
|
-
context: { operationName: MlsRecoveryOrchestrator_1.OperationName.removeUsers, qualifiedConversationId: qid() },
|
|
242
|
-
callBack: cbRemove,
|
|
243
|
-
});
|
|
244
|
-
expect(deps.resetAndReestablish).toHaveBeenCalledWith(qid());
|
|
245
|
-
expect(cbRemove).toHaveBeenCalledTimes(2);
|
|
246
|
-
expect(resRemove).toBe('ok-remove');
|
|
247
|
-
});
|
|
248
|
-
});
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export type { DomainMlsError, DomainMlsErrorType, ErrorContextInput, ErrorHandler, MlsErrorMapper, } from './MlsErrorMapper';
|
|
2
|
-
export { ChainedMlsErrorMapper, createDefaultMlsErrorMapper } from './MlsErrorMapper';
|
|
3
|
-
export type { RecoveryActionKind, RetryPolicy, RecoveryPolicy, PolicyTable, OperationContext, MlsRecoveryOrchestrator, OrchestratorDeps, } from './MlsRecoveryOrchestrator';
|
|
4
|
-
export { MlsRecoveryOrchestratorImpl, minimalDefaultPolicies, OperationName } from './MlsRecoveryOrchestrator';
|
|
5
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/messagingProtocols/mls/recovery/index.ts"],"names":[],"mappings":"AAmBA,YAAY,EACV,cAAc,EACd,kBAAkB,EAClB,iBAAiB,EACjB,YAAY,EACZ,cAAc,GACf,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAC,qBAAqB,EAAE,2BAA2B,EAAC,MAAM,kBAAkB,CAAC;AACpF,YAAY,EACV,kBAAkB,EAClB,WAAW,EACX,cAAc,EACd,WAAW,EACX,gBAAgB,EAChB,uBAAuB,EACvB,gBAAgB,GACjB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAC,2BAA2B,EAAE,sBAAsB,EAAE,aAAa,EAAC,MAAM,2BAA2B,CAAC"}
|
|
@@ -1,28 +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.OperationName = exports.minimalDefaultPolicies = exports.MlsRecoveryOrchestratorImpl = exports.createDefaultMlsErrorMapper = exports.ChainedMlsErrorMapper = void 0;
|
|
22
|
-
var MlsErrorMapper_1 = require("./MlsErrorMapper");
|
|
23
|
-
Object.defineProperty(exports, "ChainedMlsErrorMapper", { enumerable: true, get: function () { return MlsErrorMapper_1.ChainedMlsErrorMapper; } });
|
|
24
|
-
Object.defineProperty(exports, "createDefaultMlsErrorMapper", { enumerable: true, get: function () { return MlsErrorMapper_1.createDefaultMlsErrorMapper; } });
|
|
25
|
-
var MlsRecoveryOrchestrator_1 = require("./MlsRecoveryOrchestrator");
|
|
26
|
-
Object.defineProperty(exports, "MlsRecoveryOrchestratorImpl", { enumerable: true, get: function () { return MlsRecoveryOrchestrator_1.MlsRecoveryOrchestratorImpl; } });
|
|
27
|
-
Object.defineProperty(exports, "minimalDefaultPolicies", { enumerable: true, get: function () { return MlsRecoveryOrchestrator_1.minimalDefaultPolicies; } });
|
|
28
|
-
Object.defineProperty(exports, "OperationName", { enumerable: true, get: function () { return MlsRecoveryOrchestrator_1.OperationName; } });
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"StoreHelper.d.ts","sourceRoot":"","sources":["../../src/test/StoreHelper.ts"],"names":[],"mappings":"AAqBA,wBAAsB,kBAAkB,CAAC,SAAS,SAAuB,gBAIxE"}
|
package/lib/test/StoreHelper.js
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* Wire
|
|
4
|
-
* Copyright (C) 2022 Wire Swiss GmbH
|
|
5
|
-
*
|
|
6
|
-
* This program is free software: you can redistribute it and/or modify
|
|
7
|
-
* it under the terms of the GNU General Public License as published by
|
|
8
|
-
* the Free Software Foundation, either version 3 of the License, or
|
|
9
|
-
* (at your option) any later version.
|
|
10
|
-
*
|
|
11
|
-
* This program is distributed in the hope that it will be useful,
|
|
12
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14
|
-
* GNU General Public License for more details.
|
|
15
|
-
*
|
|
16
|
-
* You should have received a copy of the GNU General Public License
|
|
17
|
-
* along with this program. If not, see http://www.gnu.org/licenses/.
|
|
18
|
-
*
|
|
19
|
-
*/
|
|
20
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
-
exports.createMemoryEngine = createMemoryEngine;
|
|
22
|
-
const { MemoryEngine } = require('@wireapp/store-engine');
|
|
23
|
-
async function createMemoryEngine(storeName = `temp-${Date.now()}`) {
|
|
24
|
-
const engine = new MemoryEngine();
|
|
25
|
-
await engine.init(storeName);
|
|
26
|
-
return engine;
|
|
27
|
-
}
|