@wireapp/core 17.31.0 → 17.31.4
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/CHANGELOG.md +35 -0
- package/package.json +9 -9
- package/src/main/Account.js.map +0 -1
- package/src/main/Account.test.browser.js +0 -114
- package/src/main/Account.test.node.d.ts +0 -1
- package/src/main/Account.test.node.js +0 -214
- package/src/main/Account.test.node.js.map +0 -1
- package/src/main/Account.test.node.ts +0 -236
- package/src/main/Account.ts +0 -401
- package/src/main/CoreError.js.map +0 -1
- package/src/main/CoreError.ts +0 -30
- package/src/main/auth/LoginSanitizer.js.map +0 -1
- package/src/main/auth/LoginSanitizer.test.node.d.ts +0 -1
- package/src/main/auth/LoginSanitizer.test.node.js +0 -56
- package/src/main/auth/LoginSanitizer.test.node.js.map +0 -1
- package/src/main/auth/LoginSanitizer.test.node.ts +0 -68
- package/src/main/auth/LoginSanitizer.ts +0 -44
- package/src/main/auth/index.js.map +0 -1
- package/src/main/auth/index.ts +0 -20
- package/src/main/broadcast/AvailabilityType.js.map +0 -1
- package/src/main/broadcast/AvailabilityType.ts +0 -22
- package/src/main/broadcast/BroadcastService.js.map +0 -1
- package/src/main/broadcast/BroadcastService.ts +0 -66
- package/src/main/broadcast/index.js.map +0 -1
- package/src/main/broadcast/index.ts +0 -21
- package/src/main/client/ClientBackendRepository.js.map +0 -1
- package/src/main/client/ClientBackendRepository.ts +0 -33
- package/src/main/client/ClientDatabaseRepository.js.map +0 -1
- package/src/main/client/ClientDatabaseRepository.ts +0 -130
- package/src/main/client/ClientInfo.js.map +0 -1
- package/src/main/client/ClientInfo.ts +0 -28
- package/src/main/client/ClientService.js.map +0 -1
- package/src/main/client/ClientService.ts +0 -116
- package/src/main/client/index.js.map +0 -1
- package/src/main/client/index.ts +0 -23
- package/src/main/connection/ConnectionService.js.map +0 -1
- package/src/main/connection/ConnectionService.ts +0 -49
- package/src/main/connection/index.js.map +0 -1
- package/src/main/connection/index.ts +0 -20
- package/src/main/conversation/AbortReason.js.map +0 -1
- package/src/main/conversation/AbortReason.ts +0 -22
- package/src/main/conversation/AssetService.js.map +0 -1
- package/src/main/conversation/AssetService.test.node.d.ts +0 -1
- package/src/main/conversation/AssetService.test.node.js +0 -61
- package/src/main/conversation/AssetService.test.node.js.map +0 -1
- package/src/main/conversation/AssetService.test.node.ts +0 -65
- package/src/main/conversation/AssetService.ts +0 -60
- package/src/main/conversation/AssetTransferState.js.map +0 -1
- package/src/main/conversation/AssetTransferState.ts +0 -23
- package/src/main/conversation/ClientActionType.js.map +0 -1
- package/src/main/conversation/ClientActionType.ts +0 -20
- package/src/main/conversation/ConversationMapper.js.map +0 -1
- package/src/main/conversation/ConversationMapper.test.node.d.ts +0 -1
- package/src/main/conversation/ConversationMapper.test.node.js +0 -111
- package/src/main/conversation/ConversationMapper.test.node.js.map +0 -1
- package/src/main/conversation/ConversationMapper.test.node.ts +0 -154
- package/src/main/conversation/ConversationMapper.ts +0 -56
- package/src/main/conversation/ConversationService.js.map +0 -1
- package/src/main/conversation/ConversationService.test.node.d.ts +0 -1
- package/src/main/conversation/ConversationService.test.node.js +0 -344
- package/src/main/conversation/ConversationService.test.node.js.map +0 -1
- package/src/main/conversation/ConversationService.test.node.ts +0 -416
- package/src/main/conversation/ConversationService.ts +0 -1024
- package/src/main/conversation/GenericMessageType.js.map +0 -1
- package/src/main/conversation/GenericMessageType.ts +0 -44
- package/src/main/conversation/MessageTimer.js.map +0 -1
- package/src/main/conversation/MessageTimer.test.node.d.ts +0 -1
- package/src/main/conversation/MessageTimer.test.node.js +0 -88
- package/src/main/conversation/MessageTimer.test.node.js.map +0 -1
- package/src/main/conversation/MessageTimer.test.node.ts +0 -103
- package/src/main/conversation/MessageTimer.ts +0 -56
- package/src/main/conversation/ReactionType.js.map +0 -1
- package/src/main/conversation/ReactionType.ts +0 -23
- package/src/main/conversation/content/AssetContent.js.map +0 -1
- package/src/main/conversation/content/AssetContent.ts +0 -71
- package/src/main/conversation/content/ButtonActionConfirmationContent.js.map +0 -1
- package/src/main/conversation/content/ButtonActionConfirmationContent.ts +0 -21
- package/src/main/conversation/content/ButtonActionContent.js.map +0 -1
- package/src/main/conversation/content/ButtonActionContent.ts +0 -21
- package/src/main/conversation/content/CallingContent.js.map +0 -1
- package/src/main/conversation/content/CallingContent.ts +0 -20
- package/src/main/conversation/content/ClearedContent.js.map +0 -1
- package/src/main/conversation/content/ClearedContent.ts +0 -21
- package/src/main/conversation/content/ClientActionContent.js.map +0 -1
- package/src/main/conversation/content/ClientActionContent.ts +0 -22
- package/src/main/conversation/content/ClientAddContent.js.map +0 -1
- package/src/main/conversation/content/ClientAddContent.ts +0 -24
- package/src/main/conversation/content/ClientRemoveContent.js.map +0 -1
- package/src/main/conversation/content/ClientRemoveContent.ts +0 -25
- package/src/main/conversation/content/CompositeContent.js.map +0 -1
- package/src/main/conversation/content/CompositeContent.ts +0 -21
- package/src/main/conversation/content/ConfirmationContent.js.map +0 -1
- package/src/main/conversation/content/ConfirmationContent.ts +0 -21
- package/src/main/conversation/content/ContentType.js.map +0 -1
- package/src/main/conversation/content/ContentType.ts +0 -112
- package/src/main/conversation/content/ConversationContent.js.map +0 -1
- package/src/main/conversation/content/ConversationContent.ts +0 -71
- package/src/main/conversation/content/DeletedContent.js.map +0 -1
- package/src/main/conversation/content/DeletedContent.ts +0 -21
- package/src/main/conversation/content/EditedTextContent.js.map +0 -1
- package/src/main/conversation/content/EditedTextContent.ts +0 -31
- package/src/main/conversation/content/FileContent.js.map +0 -1
- package/src/main/conversation/content/FileContent.ts +0 -32
- package/src/main/conversation/content/HiddenContent.js.map +0 -1
- package/src/main/conversation/content/HiddenContent.ts +0 -21
- package/src/main/conversation/content/ImageContent.js.map +0 -1
- package/src/main/conversation/content/ImageContent.ts +0 -25
- package/src/main/conversation/content/KnockContent.js.map +0 -1
- package/src/main/conversation/content/KnockContent.ts +0 -21
- package/src/main/conversation/content/LinkPreviewContent.js.map +0 -1
- package/src/main/conversation/content/LinkPreviewContent.ts +0 -32
- package/src/main/conversation/content/LocationContent.js.map +0 -1
- package/src/main/conversation/content/LocationContent.ts +0 -29
- package/src/main/conversation/content/MentionContent.js.map +0 -1
- package/src/main/conversation/content/MentionContent.ts +0 -21
- package/src/main/conversation/content/QuoteContent.js.map +0 -1
- package/src/main/conversation/content/QuoteContent.ts +0 -29
- package/src/main/conversation/content/ReactionContent.js.map +0 -1
- package/src/main/conversation/content/ReactionContent.ts +0 -27
- package/src/main/conversation/content/TextContent.js.map +0 -1
- package/src/main/conversation/content/TextContent.ts +0 -29
- package/src/main/conversation/content/TweetContent.js.map +0 -1
- package/src/main/conversation/content/TweetContent.ts +0 -21
- package/src/main/conversation/content/index.js.map +0 -1
- package/src/main/conversation/content/index.ts +0 -49
- package/src/main/conversation/index.js.map +0 -1
- package/src/main/conversation/index.ts +0 -28
- package/src/main/conversation/message/CompositeContentBuilder.js.map +0 -1
- package/src/main/conversation/message/CompositeContentBuilder.ts +0 -60
- package/src/main/conversation/message/Message.js.map +0 -1
- package/src/main/conversation/message/Message.ts +0 -24
- package/src/main/conversation/message/MessageBuilder.js.map +0 -1
- package/src/main/conversation/message/MessageBuilder.test.browser.js +0 -27
- package/src/main/conversation/message/MessageBuilder.ts +0 -488
- package/src/main/conversation/message/MessageService.js.map +0 -1
- package/src/main/conversation/message/MessageService.test.node.d.ts +0 -1
- package/src/main/conversation/message/MessageService.test.node.js +0 -308
- package/src/main/conversation/message/MessageService.test.node.js.map +0 -1
- package/src/main/conversation/message/MessageService.test.node.ts +0 -398
- package/src/main/conversation/message/MessageService.ts +0 -383
- package/src/main/conversation/message/MessageToProtoMapper.js.map +0 -1
- package/src/main/conversation/message/MessageToProtoMapper.ts +0 -114
- package/src/main/conversation/message/OtrMessage.js.map +0 -1
- package/src/main/conversation/message/OtrMessage.ts +0 -160
- package/src/main/conversation/message/PayloadBundle.js.map +0 -1
- package/src/main/conversation/message/PayloadBundle.ts +0 -101
- package/src/main/conversation/message/TeamMessage.js.map +0 -1
- package/src/main/conversation/message/TeamMessage.ts +0 -72
- package/src/main/conversation/message/TextContentBuilder.js.map +0 -1
- package/src/main/conversation/message/TextContentBuilder.ts +0 -88
- package/src/main/conversation/message/UserClientsUtil.js.map +0 -1
- package/src/main/conversation/message/UserClientsUtil.ts +0 -44
- package/src/main/conversation/message/UserClientsUtils.test.node.d.ts +0 -1
- package/src/main/conversation/message/UserClientsUtils.test.node.js +0 -42
- package/src/main/conversation/message/UserClientsUtils.test.node.js.map +0 -1
- package/src/main/conversation/message/UserClientsUtils.test.node.ts +0 -44
- package/src/main/conversation/message/UserMessage.js.map +0 -1
- package/src/main/conversation/message/UserMessage.ts +0 -95
- package/src/main/cryptography/AssetCryptography.browser.js.map +0 -1
- package/src/main/cryptography/AssetCryptography.browser.ts +0 -76
- package/src/main/cryptography/AssetCryptography.node.js.map +0 -1
- package/src/main/cryptography/AssetCryptography.node.ts +0 -85
- package/src/main/cryptography/CryptographyDatabaseRepository.js.map +0 -1
- package/src/main/cryptography/CryptographyDatabaseRepository.ts +0 -44
- package/src/main/cryptography/CryptographyService.js.map +0 -1
- package/src/main/cryptography/CryptographyService.test.browser.js +0 -195
- package/src/main/cryptography/CryptographyService.test.node.d.ts +0 -1
- package/src/main/cryptography/CryptographyService.test.node.js +0 -228
- package/src/main/cryptography/CryptographyService.test.node.js.map +0 -1
- package/src/main/cryptography/CryptographyService.test.node.ts +0 -246
- package/src/main/cryptography/CryptographyService.ts +0 -246
- package/src/main/cryptography/EncryptedAsset.js.map +0 -1
- package/src/main/cryptography/EncryptedAsset.ts +0 -30
- package/src/main/cryptography/GenericMessageMapper.js.map +0 -1
- package/src/main/cryptography/GenericMessageMapper.ts +0 -274
- package/src/main/cryptography/MessageHashService.js.map +0 -1
- package/src/main/cryptography/MessageHashService.test.browser.js +0 -176
- package/src/main/cryptography/MessageHashService.test.node.d.ts +0 -1
- package/src/main/cryptography/MessageHashService.test.node.js +0 -138
- package/src/main/cryptography/MessageHashService.test.node.js.map +0 -1
- package/src/main/cryptography/MessageHashService.test.node.ts +0 -176
- package/src/main/cryptography/MessageHashService.ts +0 -109
- package/src/main/cryptography/SessionPayloadBundle.js.map +0 -1
- package/src/main/cryptography/SessionPayloadBundle.ts +0 -23
- package/src/main/cryptography/index.js.map +0 -1
- package/src/main/cryptography/index.ts +0 -23
- package/src/main/giphy/GiphyService.js.map +0 -1
- package/src/main/giphy/GiphyService.ts +0 -37
- package/src/main/giphy/index.js.map +0 -1
- package/src/main/giphy/index.ts +0 -20
- package/src/main/index.js.map +0 -1
- package/src/main/index.test.browser.js +0 -22
- package/src/main/index.ts +0 -34
- package/src/main/notification/NotificationBackendRepository.js.map +0 -1
- package/src/main/notification/NotificationBackendRepository.ts +0 -33
- package/src/main/notification/NotificationDatabaseRepository.js.map +0 -1
- package/src/main/notification/NotificationDatabaseRepository.ts +0 -74
- package/src/main/notification/NotificationService.js.map +0 -1
- package/src/main/notification/NotificationService.test.browser.js +0 -179
- package/src/main/notification/NotificationService.test.node.d.ts +0 -1
- package/src/main/notification/NotificationService.test.node.js +0 -99
- package/src/main/notification/NotificationService.test.node.js.map +0 -1
- package/src/main/notification/NotificationService.test.node.ts +0 -124
- package/src/main/notification/NotificationService.ts +0 -260
- package/src/main/notification/index.js.map +0 -1
- package/src/main/notification/index.ts +0 -20
- package/src/main/self/SelfService.js.map +0 -1
- package/src/main/self/SelfService.ts +0 -59
- package/src/main/self/index.js.map +0 -1
- package/src/main/self/index.ts +0 -20
- package/src/main/team/TeamService.js.map +0 -1
- package/src/main/team/TeamService.ts +0 -68
- package/src/main/team/index.js.map +0 -1
- package/src/main/team/index.ts +0 -20
- package/src/main/test/CryptographyHelper.js.map +0 -1
- package/src/main/test/CryptographyHelper.ts +0 -57
- package/src/main/test/PayloadHelper.js.map +0 -1
- package/src/main/test/PayloadHelper.ts +0 -60
- package/src/main/user/UserMapper.js.map +0 -1
- package/src/main/user/UserMapper.test.node.d.ts +0 -1
- package/src/main/user/UserMapper.test.node.js +0 -55
- package/src/main/user/UserMapper.test.node.js.map +0 -1
- package/src/main/user/UserMapper.test.node.ts +0 -63
- package/src/main/user/UserMapper.ts +0 -92
- package/src/main/user/UserService.js.map +0 -1
- package/src/main/user/UserService.test.node.js +0 -141
- package/src/main/user/UserService.ts +0 -98
- package/src/main/user/index.js.map +0 -1
- package/src/main/user/index.ts +0 -20
- package/src/main/util/TypePredicateUtil.js.map +0 -1
- package/src/main/util/TypePredicateUtil.test.node.d.ts +0 -1
- package/src/main/util/TypePredicateUtil.test.node.js +0 -42
- package/src/main/util/TypePredicateUtil.test.node.js.map +0 -1
- package/src/main/util/TypePredicateUtil.test.node.ts +0 -44
- package/src/main/util/TypePredicateUtil.ts +0 -52
- package/src/main/util/index.js.map +0 -1
- package/src/main/util/index.ts +0 -20
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;GAiBG;;;;;;;;;;;;AAEH,+CAA6B;AAC7B,kDAAgC;AAChC,4DAA0C;AAC1C,6DAA2C"}
|
package/src/main/client/index.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Wire
|
|
3
|
-
* Copyright (C) 2018 Wire Swiss GmbH
|
|
4
|
-
*
|
|
5
|
-
* This program is free software: you can redistribute it and/or modify
|
|
6
|
-
* it under the terms of the GNU General Public License as published by
|
|
7
|
-
* the Free Software Foundation, either version 3 of the License, or
|
|
8
|
-
* (at your option) any later version.
|
|
9
|
-
*
|
|
10
|
-
* This program is distributed in the hope that it will be useful,
|
|
11
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
-
* GNU General Public License for more details.
|
|
14
|
-
*
|
|
15
|
-
* You should have received a copy of the GNU General Public License
|
|
16
|
-
* along with this program. If not, see http://www.gnu.org/licenses/.
|
|
17
|
-
*
|
|
18
|
-
*/
|
|
19
|
-
|
|
20
|
-
export * from './ClientInfo';
|
|
21
|
-
export * from './ClientService';
|
|
22
|
-
export * from './ClientBackendRepository';
|
|
23
|
-
export * from './ClientDatabaseRepository';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ConnectionService.js","sourceRoot":"","sources":["ConnectionService.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;GAiBG;;;AAGH,oEAAiF;AAEjF,MAAa,iBAAiB;IAC5B,YAA6B,SAAoB;QAApB,cAAS,GAAT,SAAS,CAAW;IAAG,CAAC;IAE9C,cAAc;QACnB,OAAO,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,GAAG,CAAC,iBAAiB,EAAE,CAAC;IAC3D,CAAC;IAEM,gBAAgB,CAAC,MAAc;QACpC,OAAO,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,GAAG,CAAC,aAAa,CAAC,MAAM,EAAE;YACzD,MAAM,EAAE,6BAAgB,CAAC,QAAQ;SAClC,CAAC,CAAC;IACL,CAAC;IAEM,gBAAgB,CAAC,MAAc;QACpC,OAAO,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,GAAG,CAAC,aAAa,CAAC,MAAM,EAAE;YACzD,MAAM,EAAE,6BAAgB,CAAC,OAAO;SACjC,CAAC,CAAC;IACL,CAAC;IAEM,gBAAgB,CAAC,MAAc;QACpC,OAAO,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,GAAG,CAAC,cAAc,CAAC;YAClD,OAAO,EAAE,GAAG;YACZ,IAAI,EAAE,GAAG;YACT,IAAI,EAAE,MAAM;SACb,CAAC,CAAC;IACL,CAAC;CACF;AA1BD,8CA0BC"}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Wire
|
|
3
|
-
* Copyright (C) 2018 Wire Swiss GmbH
|
|
4
|
-
*
|
|
5
|
-
* This program is free software: you can redistribute it and/or modify
|
|
6
|
-
* it under the terms of the GNU General Public License as published by
|
|
7
|
-
* the Free Software Foundation, either version 3 of the License, or
|
|
8
|
-
* (at your option) any later version.
|
|
9
|
-
*
|
|
10
|
-
* This program is distributed in the hope that it will be useful,
|
|
11
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
-
* GNU General Public License for more details.
|
|
14
|
-
*
|
|
15
|
-
* You should have received a copy of the GNU General Public License
|
|
16
|
-
* along with this program. If not, see http://www.gnu.org/licenses/.
|
|
17
|
-
*
|
|
18
|
-
*/
|
|
19
|
-
|
|
20
|
-
import type {APIClient} from '@wireapp/api-client';
|
|
21
|
-
import {Connection, ConnectionStatus} from '@wireapp/api-client/src/connection/';
|
|
22
|
-
|
|
23
|
-
export class ConnectionService {
|
|
24
|
-
constructor(private readonly apiClient: APIClient) {}
|
|
25
|
-
|
|
26
|
-
public getConnections(): Promise<Connection[]> {
|
|
27
|
-
return this.apiClient.connection.api.getAllConnections();
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
public acceptConnection(userId: string): Promise<Connection> {
|
|
31
|
-
return this.apiClient.connection.api.putConnection(userId, {
|
|
32
|
-
status: ConnectionStatus.ACCEPTED,
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
public ignoreConnection(userId: string): Promise<Connection> {
|
|
37
|
-
return this.apiClient.connection.api.putConnection(userId, {
|
|
38
|
-
status: ConnectionStatus.IGNORED,
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
public createConnection(userId: string): Promise<Connection> {
|
|
43
|
-
return this.apiClient.connection.api.postConnection({
|
|
44
|
-
message: ' ',
|
|
45
|
-
name: ' ',
|
|
46
|
-
user: userId,
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;GAiBG;;;;;;;;;;;;AAEH,sDAAoC"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Wire
|
|
3
|
-
* Copyright (C) 2018 Wire Swiss GmbH
|
|
4
|
-
*
|
|
5
|
-
* This program is free software: you can redistribute it and/or modify
|
|
6
|
-
* it under the terms of the GNU General Public License as published by
|
|
7
|
-
* the Free Software Foundation, either version 3 of the License, or
|
|
8
|
-
* (at your option) any later version.
|
|
9
|
-
*
|
|
10
|
-
* This program is distributed in the hope that it will be useful,
|
|
11
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
-
* GNU General Public License for more details.
|
|
14
|
-
*
|
|
15
|
-
* You should have received a copy of the GNU General Public License
|
|
16
|
-
* along with this program. If not, see http://www.gnu.org/licenses/.
|
|
17
|
-
*
|
|
18
|
-
*/
|
|
19
|
-
|
|
20
|
-
export * from './ConnectionService';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AbortReason.js","sourceRoot":"","sources":["AbortReason.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;GAiBG"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Wire
|
|
3
|
-
* Copyright (C) 2018 Wire Swiss GmbH
|
|
4
|
-
*
|
|
5
|
-
* This program is free software: you can redistribute it and/or modify
|
|
6
|
-
* it under the terms of the GNU General Public License as published by
|
|
7
|
-
* the Free Software Foundation, either version 3 of the License, or
|
|
8
|
-
* (at your option) any later version.
|
|
9
|
-
*
|
|
10
|
-
* This program is distributed in the hope that it will be useful,
|
|
11
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
-
* GNU General Public License for more details.
|
|
14
|
-
*
|
|
15
|
-
* You should have received a copy of the GNU General Public License
|
|
16
|
-
* along with this program. If not, see http://www.gnu.org/licenses/.
|
|
17
|
-
*
|
|
18
|
-
*/
|
|
19
|
-
|
|
20
|
-
import type {Asset} from '@wireapp/protocol-messaging';
|
|
21
|
-
|
|
22
|
-
export type AbortReason = Asset.NotUploaded;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AssetService.js","sourceRoot":"","sources":["AssetService.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;GAiBG;;;;;;;;;;;;;;;;;;;;;;AAQH,0FAA4E;AAE5E,MAAa,YAAY;IACvB,YAA6B,SAAoB;QAApB,cAAS,GAAT,SAAS,CAAW;IAAG,CAAC;IAE7C,KAAK,CAAC,SAAS,CACrB,SAA8B,EAC9B,OAAsB,EACtB,gBAAmC;QAEnC,MAAM,EAAC,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAC,GAAG,MAAM,iBAAiB,CAAC,YAAY,CAAC;YAC1E,SAAS;YACT,SAAS,EAAE,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,SAAS;YAC7B,IAAI,EAAE,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,IAAI;SACpB,CAAC,CAAC;QACH,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,UAAU,CAAC,UAAU,CAAC,EAAE,OAAO,EAAE,gBAAgB,CAAC,CAAC;QAChH,MAAM,EAAC,GAAG,EAAE,KAAK,EAAC,GAAG,MAAM,OAAO,CAAC,QAAQ,CAAC;QAE5C,OAAO;YACL,UAAU;YACV,GAAG;YACH,QAAQ;YACR,MAAM;YACN,KAAK;SACN,CAAC;IACJ,CAAC;IAEM,gBAAgB,CAAC,KAAmB,EAAE,OAAsB;QACjE,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAC7C,CAAC;IAEM,eAAe,CAAC,IAAiB,EAAE,OAAsB;QAC9D,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAC5C,CAAC;CACF;AAhCD,oCAgCC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* Wire
|
|
4
|
-
* Copyright (C) 2018 Wire Swiss GmbH
|
|
5
|
-
*
|
|
6
|
-
* This program is free software: you can redistribute it and/or modify
|
|
7
|
-
* it under the terms of the GNU General Public License as published by
|
|
8
|
-
* the Free Software Foundation, either version 3 of the License, or
|
|
9
|
-
* (at your option) any later version.
|
|
10
|
-
*
|
|
11
|
-
* This program is distributed in the hope that it will be useful,
|
|
12
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14
|
-
* GNU General Public License for more details.
|
|
15
|
-
*
|
|
16
|
-
* You should have received a copy of the GNU General Public License
|
|
17
|
-
* along with this program. If not, see http://www.gnu.org/licenses/.
|
|
18
|
-
*
|
|
19
|
-
*/
|
|
20
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
21
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
22
|
-
};
|
|
23
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
|
-
const api_client_1 = require("@wireapp/api-client");
|
|
25
|
-
const store_engine_1 = require("@wireapp/store-engine");
|
|
26
|
-
const uuidjs_1 = __importDefault(require("uuidjs"));
|
|
27
|
-
const Account_1 = require("../Account");
|
|
28
|
-
describe('AssetService', () => {
|
|
29
|
-
let account;
|
|
30
|
-
beforeAll(async () => {
|
|
31
|
-
const client = new api_client_1.APIClient({ urls: api_client_1.APIClient.BACKEND.STAGING });
|
|
32
|
-
account = new Account_1.Account(client);
|
|
33
|
-
await account.initServices(new store_engine_1.MemoryEngine());
|
|
34
|
-
});
|
|
35
|
-
describe('"uploadImageAsset"', () => {
|
|
36
|
-
it('builds an encrypted asset payload', async () => {
|
|
37
|
-
const assetServerData = {
|
|
38
|
-
key: `3-2-${uuidjs_1.default.genV4().toString()}`,
|
|
39
|
-
keyBytes: Buffer.from(uuidjs_1.default.genV4().toString()),
|
|
40
|
-
sha256: uuidjs_1.default.genV4().toString(),
|
|
41
|
-
token: uuidjs_1.default.genV4().toString(),
|
|
42
|
-
};
|
|
43
|
-
const assetService = account.service.conversation['assetService'];
|
|
44
|
-
const image = {
|
|
45
|
-
data: Buffer.from([1, 2, 3]),
|
|
46
|
-
height: 600,
|
|
47
|
-
type: 'image/png',
|
|
48
|
-
width: 600,
|
|
49
|
-
};
|
|
50
|
-
spyOn(assetService, 'postAsset').and.returnValue(Promise.resolve(assetServerData));
|
|
51
|
-
const asset = await assetService.uploadImageAsset(image);
|
|
52
|
-
expect(asset).toEqual(jasmine.objectContaining({
|
|
53
|
-
key: assetServerData.key,
|
|
54
|
-
keyBytes: assetServerData.keyBytes,
|
|
55
|
-
sha256: assetServerData.sha256,
|
|
56
|
-
token: assetServerData.token,
|
|
57
|
-
}));
|
|
58
|
-
});
|
|
59
|
-
});
|
|
60
|
-
});
|
|
61
|
-
//# sourceMappingURL=AssetService.test.node.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AssetService.test.node.js","sourceRoot":"","sources":["AssetService.test.node.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;GAiBG;;;;;AAEH,oDAA8C;AAC9C,wDAAmD;AACnD,oDAA0B;AAC1B,wCAAmC;AAEnC,QAAQ,CAAC,cAAc,EAAE,GAAG,EAAE;IAC5B,IAAI,OAAgB,CAAC;IAErB,SAAS,CAAC,KAAK,IAAI,EAAE;QACnB,MAAM,MAAM,GAAG,IAAI,sBAAS,CAAC,EAAC,IAAI,EAAE,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Q,EAAE,eAAe,CAAC,QAAQ;gBAClC,MAAM,EAAE,eAAe,CAAC,MAAM;gBAC9B,KAAK,EAAE,eAAe,CAAC,KAAK;aAC7B,CAAC,CACH,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Wire
|
|
3
|
-
* Copyright (C) 2018 Wire Swiss GmbH
|
|
4
|
-
*
|
|
5
|
-
* This program is free software: you can redistribute it and/or modify
|
|
6
|
-
* it under the terms of the GNU General Public License as published by
|
|
7
|
-
* the Free Software Foundation, either version 3 of the License, or
|
|
8
|
-
* (at your option) any later version.
|
|
9
|
-
*
|
|
10
|
-
* This program is distributed in the hope that it will be useful,
|
|
11
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
-
* GNU General Public License for more details.
|
|
14
|
-
*
|
|
15
|
-
* You should have received a copy of the GNU General Public License
|
|
16
|
-
* along with this program. If not, see http://www.gnu.org/licenses/.
|
|
17
|
-
*
|
|
18
|
-
*/
|
|
19
|
-
|
|
20
|
-
import {APIClient} from '@wireapp/api-client';
|
|
21
|
-
import {MemoryEngine} from '@wireapp/store-engine';
|
|
22
|
-
import UUID from 'uuidjs';
|
|
23
|
-
import {Account} from '../Account';
|
|
24
|
-
|
|
25
|
-
describe('AssetService', () => {
|
|
26
|
-
let account: Account;
|
|
27
|
-
|
|
28
|
-
beforeAll(async () => {
|
|
29
|
-
const client = new APIClient({urls: APIClient.BACKEND.STAGING});
|
|
30
|
-
account = new Account(client);
|
|
31
|
-
await account.initServices(new MemoryEngine());
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
describe('"uploadImageAsset"', () => {
|
|
35
|
-
it('builds an encrypted asset payload', async () => {
|
|
36
|
-
const assetServerData = {
|
|
37
|
-
key: `3-2-${UUID.genV4().toString()}`,
|
|
38
|
-
keyBytes: Buffer.from(UUID.genV4().toString()),
|
|
39
|
-
sha256: UUID.genV4().toString(),
|
|
40
|
-
token: UUID.genV4().toString(),
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
const assetService = account.service!.conversation['assetService'];
|
|
44
|
-
const image = {
|
|
45
|
-
data: Buffer.from([1, 2, 3]),
|
|
46
|
-
height: 600,
|
|
47
|
-
type: 'image/png',
|
|
48
|
-
width: 600,
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
spyOn<any>(assetService, 'postAsset').and.returnValue(Promise.resolve(assetServerData));
|
|
52
|
-
|
|
53
|
-
const asset = await assetService.uploadImageAsset(image);
|
|
54
|
-
|
|
55
|
-
expect(asset).toEqual(
|
|
56
|
-
jasmine.objectContaining({
|
|
57
|
-
key: assetServerData.key,
|
|
58
|
-
keyBytes: assetServerData.keyBytes,
|
|
59
|
-
sha256: assetServerData.sha256,
|
|
60
|
-
token: assetServerData.token,
|
|
61
|
-
}),
|
|
62
|
-
);
|
|
63
|
-
});
|
|
64
|
-
});
|
|
65
|
-
});
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Wire
|
|
3
|
-
* Copyright (C) 2018 Wire Swiss GmbH
|
|
4
|
-
*
|
|
5
|
-
* This program is free software: you can redistribute it and/or modify
|
|
6
|
-
* it under the terms of the GNU General Public License as published by
|
|
7
|
-
* the Free Software Foundation, either version 3 of the License, or
|
|
8
|
-
* (at your option) any later version.
|
|
9
|
-
*
|
|
10
|
-
* This program is distributed in the hope that it will be useful,
|
|
11
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
-
* GNU General Public License for more details.
|
|
14
|
-
*
|
|
15
|
-
* You should have received a copy of the GNU General Public License
|
|
16
|
-
* along with this program. If not, see http://www.gnu.org/licenses/.
|
|
17
|
-
*
|
|
18
|
-
*/
|
|
19
|
-
|
|
20
|
-
import type {APIClient} from '@wireapp/api-client';
|
|
21
|
-
import type {AssetOptions} from '@wireapp/api-client/src/asset';
|
|
22
|
-
import type {ProgressCallback} from '@wireapp/api-client/src/http';
|
|
23
|
-
|
|
24
|
-
import type {FileContent, ImageContent} from '../conversation/content/';
|
|
25
|
-
import type {EncryptedAssetUploaded} from '../cryptography/';
|
|
26
|
-
import * as AssetCryptography from '../cryptography/AssetCryptography.node';
|
|
27
|
-
|
|
28
|
-
export class AssetService {
|
|
29
|
-
constructor(private readonly apiClient: APIClient) {}
|
|
30
|
-
|
|
31
|
-
private async postAsset(
|
|
32
|
-
plainText: Buffer | Uint8Array,
|
|
33
|
-
options?: AssetOptions,
|
|
34
|
-
progressCallback?: ProgressCallback,
|
|
35
|
-
): Promise<EncryptedAssetUploaded> {
|
|
36
|
-
const {cipherText, keyBytes, sha256} = await AssetCryptography.encryptAsset({
|
|
37
|
-
plainText,
|
|
38
|
-
algorithm: options?.algorithm,
|
|
39
|
-
hash: options?.hash,
|
|
40
|
-
});
|
|
41
|
-
const request = await this.apiClient.asset.api.postAsset(new Uint8Array(cipherText), options, progressCallback);
|
|
42
|
-
const {key, token} = await request.response;
|
|
43
|
-
|
|
44
|
-
return {
|
|
45
|
-
cipherText,
|
|
46
|
-
key,
|
|
47
|
-
keyBytes,
|
|
48
|
-
sha256,
|
|
49
|
-
token,
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
public uploadImageAsset(image: ImageContent, options?: AssetOptions): Promise<EncryptedAssetUploaded> {
|
|
54
|
-
return this.postAsset(image.data, options);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
public uploadFileAsset(file: FileContent, options?: AssetOptions): Promise<EncryptedAssetUploaded> {
|
|
58
|
-
return this.postAsset(file.data, options);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AssetTransferState.js","sourceRoot":"","sources":["AssetTransferState.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;GAiBG;;;AAEH,IAAY,kBAGX;AAHD,WAAY,kBAAkB;IAC5B,kDAA4B,CAAA;IAC5B,2CAAqB,CAAA;AACvB,CAAC,EAHW,kBAAkB,GAAlB,0BAAkB,KAAlB,0BAAkB,QAG7B"}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Wire
|
|
3
|
-
* Copyright (C) 2018 Wire Swiss GmbH
|
|
4
|
-
*
|
|
5
|
-
* This program is free software: you can redistribute it and/or modify
|
|
6
|
-
* it under the terms of the GNU General Public License as published by
|
|
7
|
-
* the Free Software Foundation, either version 3 of the License, or
|
|
8
|
-
* (at your option) any later version.
|
|
9
|
-
*
|
|
10
|
-
* This program is distributed in the hope that it will be useful,
|
|
11
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
-
* GNU General Public License for more details.
|
|
14
|
-
*
|
|
15
|
-
* You should have received a copy of the GNU General Public License
|
|
16
|
-
* along with this program. If not, see http://www.gnu.org/licenses/.
|
|
17
|
-
*
|
|
18
|
-
*/
|
|
19
|
-
|
|
20
|
-
export enum AssetTransferState {
|
|
21
|
-
NOT_UPLOADED = 'notUploaded',
|
|
22
|
-
UPLOADED = 'uploaded',
|
|
23
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ClientActionType.js","sourceRoot":"","sources":["ClientActionType.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;GAiBG;;;AAEH,kEAA6E;AAArE,sHAAA,YAAY,OAAoB"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Wire
|
|
3
|
-
* Copyright (C) 2018 Wire Swiss GmbH
|
|
4
|
-
*
|
|
5
|
-
* This program is free software: you can redistribute it and/or modify
|
|
6
|
-
* it under the terms of the GNU General Public License as published by
|
|
7
|
-
* the Free Software Foundation, either version 3 of the License, or
|
|
8
|
-
* (at your option) any later version.
|
|
9
|
-
*
|
|
10
|
-
* This program is distributed in the hope that it will be useful,
|
|
11
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
-
* GNU General Public License for more details.
|
|
14
|
-
*
|
|
15
|
-
* You should have received a copy of the GNU General Public License
|
|
16
|
-
* along with this program. If not, see http://www.gnu.org/licenses/.
|
|
17
|
-
*
|
|
18
|
-
*/
|
|
19
|
-
|
|
20
|
-
export {ClientAction as ClientActionType} from '@wireapp/protocol-messaging';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ConversationMapper.js","sourceRoot":"","sources":["ConversationMapper.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;GAiBG;;;AAEH,yDAAoF;AAEpF,6DAAwD;AACxD,2DAAkH;AAElH,MAAa,kBAAkB;IACtB,MAAM,CAAC,oBAAoB,CAAC,KAAwB,EAAE,MAA2B;QACtF,OAAO;YACL,OAAO,EAAE,KAAK,CAAC,IAAI;YACnB,YAAY,EAAE,KAAK,CAAC,YAAY;YAChC,qBAAqB,EAAE,KAAK,CAAC,sBAAsB;YACnD,aAAa,EAAE,KAAK,CAAC,cAAc;YACnC,IAAI,EAAE,KAAK,CAAC,IAAI;YAChB,EAAE,EAAE,+BAAc,CAAC,QAAQ,EAAE;YAC7B,YAAY,EAAE,CAAC;YACf,MAAM;YACN,KAAK,EAAE,kCAAkB,CAAC,QAAQ;YAClC,SAAS,EAAE,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE;YACzC,IAAI,EAAE,IAAI,CAAC,wBAAwB,CAAC,KAAK,CAAC,IAAI,CAAC;SAChD,CAAC;IACJ,CAAC;IAEO,MAAM,CAAC,wBAAwB,CAAC,IAAwB;QAC9D,QAAQ,IAAI,EAAE;YACZ,KAAK,0BAAkB,CAAC,WAAW;gBACjC,OAAO,iCAAiB,CAAC,WAAW,CAAC;YACvC,KAAK,0BAAkB,CAAC,oBAAoB;gBAC1C,OAAO,iCAAiB,CAAC,YAAY,CAAC;YACxC,KAAK,0BAAkB,CAAC,MAAM;gBAC5B,OAAO,iCAAiB,CAAC,mBAAmB,CAAC;YAC/C,KAAK,0BAAkB,CAAC,MAAM;gBAC5B,OAAO,iCAAiB,CAAC,MAAM,CAAC;YAClC;gBACE,OAAO,iCAAiB,CAAC,OAAO,CAAC;SACpC;IACH,CAAC;CACF;AA/BD,gDA+BC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* Wire
|
|
4
|
-
* Copyright (C) 2019 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 event_1 = require("@wireapp/api-client/src/event");
|
|
22
|
-
const data_1 = require("@wireapp/api-client/src/conversation/data");
|
|
23
|
-
const ConversationMapper_1 = require("./ConversationMapper");
|
|
24
|
-
const PayloadBundle_1 = require("./message/PayloadBundle");
|
|
25
|
-
describe('ConversationMapper', () => {
|
|
26
|
-
describe('"mapConversationEvent"', () => {
|
|
27
|
-
it('maps "conversation.message-timer-update" events', () => {
|
|
28
|
-
const event = {
|
|
29
|
-
conversation: 'ed5e4cd5-85ab-4d9e-be59-4e1c0324a9d4',
|
|
30
|
-
data: {
|
|
31
|
-
message_timer: 2419200000,
|
|
32
|
-
},
|
|
33
|
-
from: '39b7f597-dfd1-4dff-86f5-fe1b79cb70a0',
|
|
34
|
-
time: '2018-08-01T09:40:25.481Z',
|
|
35
|
-
type: event_1.CONVERSATION_EVENT.MESSAGE_TIMER_UPDATE,
|
|
36
|
-
};
|
|
37
|
-
const incomingEvent = ConversationMapper_1.ConversationMapper.mapConversationEvent(event, PayloadBundle_1.PayloadBundleSource.WEBSOCKET);
|
|
38
|
-
expect(incomingEvent.content).toBe(event.data);
|
|
39
|
-
expect(incomingEvent.conversation).toBe(event.conversation);
|
|
40
|
-
expect(incomingEvent.from).toBe(event.from);
|
|
41
|
-
expect(typeof incomingEvent.id).toBe('string');
|
|
42
|
-
expect(incomingEvent.messageTimer).toBe(0);
|
|
43
|
-
expect(incomingEvent.state).toBe(PayloadBundle_1.PayloadBundleState.INCOMING);
|
|
44
|
-
expect(incomingEvent.timestamp).toBe(new Date(event.time).getTime());
|
|
45
|
-
expect(incomingEvent.type).toBe(PayloadBundle_1.PayloadBundleType.TIMER_UPDATE);
|
|
46
|
-
});
|
|
47
|
-
it('maps "conversation.member-join" events', () => {
|
|
48
|
-
const event = {
|
|
49
|
-
conversation: '87591650-8676-430f-985f-dec8583f58cb',
|
|
50
|
-
data: {
|
|
51
|
-
user_ids: [
|
|
52
|
-
'e023c681-7e51-43dd-a5d8-0f821e70a9c0',
|
|
53
|
-
'b8a09877-7b73-4636-a664-95b2bda193b0',
|
|
54
|
-
'5b068afd-1ef2-4860-9fbb-9c3c70a22f97',
|
|
55
|
-
],
|
|
56
|
-
},
|
|
57
|
-
from: '39b7f597-dfd1-4dff-86f5-fe1b79cb70a0',
|
|
58
|
-
time: '2018-07-12T09:43:34.442Z',
|
|
59
|
-
type: event_1.CONVERSATION_EVENT.MEMBER_JOIN,
|
|
60
|
-
};
|
|
61
|
-
const incomingEvent = ConversationMapper_1.ConversationMapper.mapConversationEvent(event, PayloadBundle_1.PayloadBundleSource.WEBSOCKET);
|
|
62
|
-
expect(incomingEvent.content).toBe(event.data);
|
|
63
|
-
expect(incomingEvent.conversation).toBe(event.conversation);
|
|
64
|
-
expect(incomingEvent.from).toBe(event.from);
|
|
65
|
-
expect(typeof incomingEvent.id).toBe('string');
|
|
66
|
-
expect(incomingEvent.messageTimer).toBe(0);
|
|
67
|
-
expect(incomingEvent.state).toBe(PayloadBundle_1.PayloadBundleState.INCOMING);
|
|
68
|
-
expect(incomingEvent.timestamp).toBe(new Date(event.time).getTime());
|
|
69
|
-
expect(incomingEvent.type).toBe(PayloadBundle_1.PayloadBundleType.MEMBER_JOIN);
|
|
70
|
-
});
|
|
71
|
-
it('maps "conversation.rename" events', () => {
|
|
72
|
-
const event = {
|
|
73
|
-
conversation: 'ed5e4cd5-85ab-4d9e-be59-4e1c0324a9d4',
|
|
74
|
-
data: {
|
|
75
|
-
name: 'Tiny Timed Messages',
|
|
76
|
-
},
|
|
77
|
-
from: '39b7f597-dfd1-4dff-86f5-fe1b79cb70a0',
|
|
78
|
-
time: '2018-08-01T12:01:21.629Z',
|
|
79
|
-
type: event_1.CONVERSATION_EVENT.RENAME,
|
|
80
|
-
};
|
|
81
|
-
const incomingEvent = ConversationMapper_1.ConversationMapper.mapConversationEvent(event, PayloadBundle_1.PayloadBundleSource.WEBSOCKET);
|
|
82
|
-
expect(incomingEvent.content).toBe(event.data);
|
|
83
|
-
expect(incomingEvent.conversation).toBe(event.conversation);
|
|
84
|
-
expect(incomingEvent.from).toBe(event.from);
|
|
85
|
-
expect(typeof incomingEvent.id).toBe('string');
|
|
86
|
-
expect(incomingEvent.messageTimer).toBe(0);
|
|
87
|
-
expect(incomingEvent.state).toBe(PayloadBundle_1.PayloadBundleState.INCOMING);
|
|
88
|
-
expect(incomingEvent.timestamp).toBe(new Date(event.time).getTime());
|
|
89
|
-
expect(incomingEvent.type).toBe(PayloadBundle_1.PayloadBundleType.CONVERSATION_RENAME);
|
|
90
|
-
});
|
|
91
|
-
it('maps "conversation.typing" events', () => {
|
|
92
|
-
const event = {
|
|
93
|
-
conversation: '508f14b9-ef4c-405d-bba9-5c4300cc1cbf',
|
|
94
|
-
data: { status: data_1.CONVERSATION_TYPING.STARTED },
|
|
95
|
-
from: '16d71f22-0f7b-425e-b4b3-5e288700ac1f',
|
|
96
|
-
time: '2018-08-01T12:10:42.422Z',
|
|
97
|
-
type: event_1.CONVERSATION_EVENT.TYPING,
|
|
98
|
-
};
|
|
99
|
-
const incomingEvent = ConversationMapper_1.ConversationMapper.mapConversationEvent(event, PayloadBundle_1.PayloadBundleSource.WEBSOCKET);
|
|
100
|
-
expect(incomingEvent.content).toBe(event.data);
|
|
101
|
-
expect(incomingEvent.conversation).toBe(event.conversation);
|
|
102
|
-
expect(incomingEvent.from).toBe(event.from);
|
|
103
|
-
expect(typeof incomingEvent.id).toBe('string');
|
|
104
|
-
expect(incomingEvent.messageTimer).toBe(0);
|
|
105
|
-
expect(incomingEvent.state).toBe(PayloadBundle_1.PayloadBundleState.INCOMING);
|
|
106
|
-
expect(incomingEvent.timestamp).toBe(new Date(event.time).getTime());
|
|
107
|
-
expect(incomingEvent.type).toBe(PayloadBundle_1.PayloadBundleType.TYPING);
|
|
108
|
-
});
|
|
109
|
-
});
|
|
110
|
-
});
|
|
111
|
-
//# sourceMappingURL=ConversationMapper.test.node.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ConversationMapper.test.node.js","sourceRoot":"","sources":["ConversationMapper.test.node.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;GAiBG;;AAEH,yDAMuC;AAEvC,oEAMmD;AACnD,6DAAwD;AACxD,2DAAkH;A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