@wireapp/core 37.2.0 → 37.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/Account.d.ts +3 -31
- package/lib/Account.d.ts.map +1 -1
- package/lib/Account.js +6 -8
- package/lib/conversation/ConversationMapper/ConversationMapper.d.ts +3 -2
- package/lib/conversation/ConversationMapper/ConversationMapper.d.ts.map +1 -1
- package/lib/conversation/ConversationMapper/ConversationMapper.js +2 -1
- package/lib/conversation/ConversationService/ConversationService.d.ts.map +1 -1
- package/lib/conversation/ConversationService/ConversationService.js +1 -1
- package/lib/conversation/ConversationService/ConversationService.types.d.ts +2 -2
- package/lib/conversation/ConversationService/ConversationService.types.d.ts.map +1 -1
- package/lib/conversation/index.d.ts +1 -0
- package/lib/conversation/index.d.ts.map +1 -1
- package/lib/conversation/index.js +1 -0
- package/lib/conversation/message/Message.types.d.ts +7 -0
- package/lib/conversation/message/Message.types.d.ts.map +1 -0
- package/lib/conversation/message/Message.types.js +28 -0
- package/lib/conversation/message/MessageService.d.ts.map +1 -1
- package/lib/conversation/message/MessageService.js +1 -2
- package/lib/conversation/message/MessageToProtoMapper.d.ts +2 -3
- package/lib/conversation/message/MessageToProtoMapper.d.ts.map +1 -1
- package/lib/conversation/message/PayloadBundle.d.ts +4 -13
- package/lib/conversation/message/PayloadBundle.d.ts.map +1 -1
- package/lib/conversation/message/PayloadBundle.js +1 -14
- package/lib/conversation/message/TextContentBuilder.d.ts +1 -2
- package/lib/conversation/message/TextContentBuilder.d.ts.map +1 -1
- package/lib/conversation/message/TextContentBuilder.js +1 -12
- package/lib/conversation/message/index.d.ts +2 -0
- package/lib/conversation/message/index.d.ts.map +1 -0
- package/lib/conversation/{ConversationMapper → message}/index.js +1 -1
- package/lib/cryptography/CryptographyService.d.ts +0 -2
- package/lib/cryptography/CryptographyService.d.ts.map +1 -1
- package/lib/cryptography/CryptographyService.js +0 -15
- package/lib/cryptography/GenericMessageMapper.d.ts +3 -2
- package/lib/cryptography/GenericMessageMapper.d.ts.map +1 -1
- package/lib/cryptography/GenericMessageMapper.js +1 -1
- package/lib/messagingProtocols/mls/EventHandler/ConversationEvent/events/messageAdd/messageAdd.d.ts.map +1 -1
- package/lib/messagingProtocols/mls/EventHandler/ConversationEvent/events/messageAdd/messageAdd.js +0 -4
- package/lib/messagingProtocols/mls/EventHandler/EventHandler.types.d.ts +3 -3
- package/lib/messagingProtocols/mls/EventHandler/EventHandler.types.d.ts.map +1 -1
- package/lib/messagingProtocols/mls/EventHandler/EventHandler.types.js +0 -3
- package/lib/messagingProtocols/proteus/EventHandler/ConversationEvent/events/otrMessageAdd/otrMessageAdd.d.ts +1 -1
- package/lib/messagingProtocols/proteus/EventHandler/ConversationEvent/events/otrMessageAdd/otrMessageAdd.d.ts.map +1 -1
- package/lib/messagingProtocols/proteus/EventHandler/ConversationEvent/events/otrMessageAdd/otrMessageAdd.js +1 -2
- package/lib/messagingProtocols/proteus/EventHandler/EventHandler.types.d.ts +3 -3
- package/lib/messagingProtocols/proteus/EventHandler/EventHandler.types.d.ts.map +1 -1
- package/lib/messagingProtocols/proteus/EventHandler/EventHandler.types.js +0 -3
- package/lib/messagingProtocols/proteus/ProteusService/ProteusService.d.ts.map +1 -1
- package/lib/messagingProtocols/proteus/ProteusService/ProteusService.js +1 -1
- package/lib/notification/NotificationService.d.ts +6 -8
- package/lib/notification/NotificationService.d.ts.map +1 -1
- package/lib/notification/NotificationService.js +6 -63
- package/lib/notification/Notifications.types.d.ts +6 -0
- package/lib/notification/Notifications.types.d.ts.map +1 -0
- package/lib/notification/Notifications.types.js +27 -0
- package/lib/notification/index.d.ts +1 -0
- package/lib/notification/index.d.ts.map +1 -1
- package/lib/notification/index.js +1 -0
- package/lib/user/UserMapper.d.ts +3 -2
- package/lib/user/UserMapper.d.ts.map +1 -1
- package/lib/user/UserMapper.js +4 -4
- package/lib/user/UserService.d.ts.map +1 -1
- package/lib/user/UserService.js +2 -2
- package/package.json +6 -6
- package/lib/conversation/ConversationMapper/index.d.ts +0 -2
- package/lib/conversation/ConversationMapper/index.d.ts.map +0 -1
- package/lib/conversation/message/CompositeContentBuilder.d.ts +0 -15
- package/lib/conversation/message/CompositeContentBuilder.d.ts.map +0 -1
- package/lib/conversation/message/CompositeContentBuilder.js +0 -53
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EventHandler.types.d.ts","sourceRoot":"","sources":["../../../../src/messagingProtocols/mls/EventHandler/EventHandler.types.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,YAAY,EAAC,MAAM,+BAA+B,CAAC;AAE3D,OAAO,EAAC,
|
|
1
|
+
{"version":3,"file":"EventHandler.types.d.ts","sourceRoot":"","sources":["../../../../src/messagingProtocols/mls/EventHandler/EventHandler.types.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,YAAY,EAAC,MAAM,+BAA+B,CAAC;AAE3D,OAAO,EAAC,kBAAkB,EAAC,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAC,UAAU,EAAC,MAAM,0BAA0B,CAAC;AAEpD,OAAO,EAAC,YAAY,EAAC,CAAC;AAEtB,MAAM,MAAM,kBAAkB,GAAG;IAC/B,UAAU,EAAE,UAAU,CAAC;IACvB,KAAK,EAAE,YAAY,CAAC;IACpB,MAAM,EAAE,kBAAkB,CAAC;IAC3B,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB,CAAC"}
|
|
@@ -18,6 +18,3 @@
|
|
|
18
18
|
*
|
|
19
19
|
*/
|
|
20
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
-
exports.PayloadBundleSource = void 0;
|
|
22
|
-
const conversation_1 = require("../../../conversation");
|
|
23
|
-
Object.defineProperty(exports, "PayloadBundleSource", { enumerable: true, get: function () { return conversation_1.PayloadBundleSource; } });
|
|
@@ -5,6 +5,6 @@ declare const isOtrMessageAddEvent: (event: BackendEvent) => event is Conversati
|
|
|
5
5
|
type HandleOtrMessageAddParams = Omit<EventHandlerParams, 'event'> & {
|
|
6
6
|
event: ConversationOtrMessageAddEvent;
|
|
7
7
|
};
|
|
8
|
-
declare const handleOtrMessageAdd: ({ cryptographyService, event,
|
|
8
|
+
declare const handleOtrMessageAdd: ({ cryptographyService, event, dryRun, }: HandleOtrMessageAddParams) => EventHandlerResult;
|
|
9
9
|
export { isOtrMessageAddEvent, handleOtrMessageAdd };
|
|
10
10
|
//# sourceMappingURL=otrMessageAdd.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"otrMessageAdd.d.ts","sourceRoot":"","sources":["../../../../../../../src/messagingProtocols/proteus/EventHandler/ConversationEvent/events/otrMessageAdd/otrMessageAdd.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,YAAY,EAAE,8BAA8B,EAAqB,MAAM,+BAA+B,CAAC;AAG/G,OAAO,EAAC,kBAAkB,EAAC,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAC,kBAAkB,EAAC,MAAM,6BAA6B,CAAC;AAE/D,QAAA,MAAM,oBAAoB,UAAW,YAAY,4CACE,CAAC;AAEpD,KAAK,yBAAyB,GAAG,IAAI,CAAC,kBAAkB,EAAE,OAAO,CAAC,GAAG;IACnE,KAAK,EAAE,8BAA8B,CAAC;CACvC,CAAC;AACF,QAAA,MAAM,mBAAmB,
|
|
1
|
+
{"version":3,"file":"otrMessageAdd.d.ts","sourceRoot":"","sources":["../../../../../../../src/messagingProtocols/proteus/EventHandler/ConversationEvent/events/otrMessageAdd/otrMessageAdd.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,YAAY,EAAE,8BAA8B,EAAqB,MAAM,+BAA+B,CAAC;AAG/G,OAAO,EAAC,kBAAkB,EAAC,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAC,kBAAkB,EAAC,MAAM,6BAA6B,CAAC;AAE/D,QAAA,MAAM,oBAAoB,UAAW,YAAY,4CACE,CAAC;AAEpD,KAAK,yBAAyB,GAAG,IAAI,CAAC,kBAAkB,EAAE,OAAO,CAAC,GAAG;IACnE,KAAK,EAAE,8BAA8B,CAAC;CACvC,CAAC;AACF,QAAA,MAAM,mBAAmB,4CAItB,yBAAyB,uBAkB3B,CAAC;AAEF,OAAO,EAAC,oBAAoB,EAAE,mBAAmB,EAAC,CAAC"}
|
|
@@ -23,7 +23,7 @@ const event_1 = require("@wireapp/api-client/lib/event");
|
|
|
23
23
|
const DecryptionError_1 = require("../../../../../../errors/DecryptionError");
|
|
24
24
|
const isOtrMessageAddEvent = (event) => event.type === event_1.CONVERSATION_EVENT.OTR_MESSAGE_ADD;
|
|
25
25
|
exports.isOtrMessageAddEvent = isOtrMessageAddEvent;
|
|
26
|
-
const handleOtrMessageAdd = async ({ cryptographyService, event,
|
|
26
|
+
const handleOtrMessageAdd = async ({ cryptographyService, event, dryRun = false, }) => {
|
|
27
27
|
if (dryRun) {
|
|
28
28
|
// In case of a dry run, we do not want to decrypt messages
|
|
29
29
|
// We just return the raw event to the caller
|
|
@@ -32,7 +32,6 @@ const handleOtrMessageAdd = async ({ cryptographyService, event, source, dryRun
|
|
|
32
32
|
try {
|
|
33
33
|
const decryptedData = await cryptographyService.decryptMessage(event);
|
|
34
34
|
return {
|
|
35
|
-
mappedEvent: cryptographyService.mapGenericMessage(event, decryptedData, source),
|
|
36
35
|
event,
|
|
37
36
|
decryptedData,
|
|
38
37
|
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { BackendEvent } from '@wireapp/api-client/lib/event';
|
|
2
|
-
import { PayloadBundleSource } from '../../../conversation';
|
|
3
2
|
import { CryptographyService } from '../../../cryptography';
|
|
4
|
-
|
|
3
|
+
import { NotificationSource } from '../../../notification';
|
|
4
|
+
export { BackendEvent };
|
|
5
5
|
export type EventHandlerParams = {
|
|
6
6
|
dryRun?: boolean;
|
|
7
7
|
event: BackendEvent;
|
|
8
|
-
source:
|
|
8
|
+
source: NotificationSource;
|
|
9
9
|
cryptographyService: CryptographyService;
|
|
10
10
|
};
|
|
11
11
|
//# sourceMappingURL=EventHandler.types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EventHandler.types.d.ts","sourceRoot":"","sources":["../../../../src/messagingProtocols/proteus/EventHandler/EventHandler.types.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,YAAY,EAAC,MAAM,+BAA+B,CAAC;AAE3D,OAAO,EAAC,mBAAmB,EAAC,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAC,
|
|
1
|
+
{"version":3,"file":"EventHandler.types.d.ts","sourceRoot":"","sources":["../../../../src/messagingProtocols/proteus/EventHandler/EventHandler.types.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,YAAY,EAAC,MAAM,+BAA+B,CAAC;AAE3D,OAAO,EAAC,mBAAmB,EAAC,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAC,kBAAkB,EAAC,MAAM,uBAAuB,CAAC;AAEzD,OAAO,EAAC,YAAY,EAAC,CAAC;AAEtB,MAAM,MAAM,kBAAkB,GAAG;IAC/B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,YAAY,CAAC;IACpB,MAAM,EAAE,kBAAkB,CAAC;IAC3B,mBAAmB,EAAE,mBAAmB,CAAC;CAC1C,CAAC"}
|
|
@@ -18,6 +18,3 @@
|
|
|
18
18
|
*
|
|
19
19
|
*/
|
|
20
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
-
exports.PayloadBundleSource = void 0;
|
|
22
|
-
const conversation_1 = require("../../../conversation");
|
|
23
|
-
Object.defineProperty(exports, "PayloadBundleSource", { enumerable: true, get: function () { return conversation_1.PayloadBundleSource; } });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProteusService.d.ts","sourceRoot":"","sources":["../../../../src/messagingProtocols/proteus/ProteusService/ProteusService.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,SAAS,EAAC,MAAM,mCAAmC,CAAC;AAC5D,OAAO,EAAC,YAAY,EAAkB,MAAM,sCAAsC,CAAC;AAGnF,OAAO,EACL,mCAAmC,EACnC,+BAA+B,EAC/B,oBAAoB,EACpB,wBAAwB,EACzB,MAAM,wBAAwB,CAAC;AAIhC,OAAO,
|
|
1
|
+
{"version":3,"file":"ProteusService.d.ts","sourceRoot":"","sources":["../../../../src/messagingProtocols/proteus/ProteusService/ProteusService.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAC,SAAS,EAAC,MAAM,mCAAmC,CAAC;AAC5D,OAAO,EAAC,YAAY,EAAkB,MAAM,sCAAsC,CAAC;AAGnF,OAAO,EACL,mCAAmC,EACnC,+BAA+B,EAC/B,oBAAoB,EACpB,wBAAwB,EACzB,MAAM,wBAAwB,CAAC;AAIhC,OAAO,EAAsB,UAAU,EAAC,MAAM,uBAAuB,CAAC;AAEtE,OAAO,EAAC,mBAAmB,EAAC,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAC,kBAAkB,EAAC,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAC,kBAAkB,EAAqB,MAAM,iBAAiB,CAAC;AAEvE,qBAAa,cAAc;IAKvB,OAAO,CAAC,QAAQ,CAAC,SAAS;IAC1B,OAAO,CAAC,QAAQ,CAAC,mBAAmB;IACpC,OAAO,CAAC,QAAQ,CAAC,MAAM;IANzB,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAiB;IAChD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA2C;gBAG/C,SAAS,EAAE,SAAS,EACpB,mBAAmB,EAAE,mBAAmB,EACxC,MAAM,EAAE,oBAAoB;IAKlC,WAAW,CAAC,MAAM,EAAE,IAAI,CAAC,kBAAkB,EAAE,qBAAqB,CAAC,GAAG,kBAAkB;IAIxF,kBAAkB,CAAC,EAC9B,gBAAgB,EAChB,YAAY,GACb,EAAE,+BAA+B,GAAG,OAAO,CAAC,YAAY,CAAC;IAiB7C,sBAAsB,CAAC,EAAC,cAAc,EAAE,gBAAgB,EAAC,EAAE,mCAAmC;IAI9F,WAAW,CAAC,EACvB,OAAO,EACP,cAAc,EACd,cAAc,EACd,UAAU,EACV,UAAU,EACV,OAAO,EACP,gBAAgB,GACjB,EAAE,wBAAwB,GAAG,OAAO,CAAC,UAAU,CAAC;CA0ClD"}
|
|
@@ -86,7 +86,7 @@ class ProteusService {
|
|
|
86
86
|
return {
|
|
87
87
|
id: payload.messageId,
|
|
88
88
|
sentAt: response.time,
|
|
89
|
-
state: response.errored ? conversation_1.
|
|
89
|
+
state: response.errored ? conversation_1.MessageSendingState.CANCELLED : conversation_1.MessageSendingState.OUTGOING_SENT,
|
|
90
90
|
};
|
|
91
91
|
}
|
|
92
92
|
}
|
|
@@ -1,26 +1,25 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
import
|
|
2
|
+
import { BackendEvent } from '@wireapp/api-client/lib/event';
|
|
3
3
|
import { Notification } from '@wireapp/api-client/lib/notification/';
|
|
4
4
|
import { AbortHandler } from '@wireapp/api-client/lib/tcp';
|
|
5
5
|
import { EventEmitter } from 'events';
|
|
6
6
|
import { APIClient } from '@wireapp/api-client';
|
|
7
7
|
import { GenericMessage } from '@wireapp/protocol-messaging';
|
|
8
8
|
import { CRUDEngine } from '@wireapp/store-engine';
|
|
9
|
-
import {
|
|
9
|
+
import { NotificationSource } from './Notifications.types';
|
|
10
10
|
import { NotificationError } from '../CoreError';
|
|
11
11
|
import { DecryptionError } from '../errors/DecryptionError';
|
|
12
12
|
import { MLSService } from '../messagingProtocols/mls';
|
|
13
13
|
import { ProteusService } from '../messagingProtocols/proteus';
|
|
14
14
|
export type HandledEventPayload = {
|
|
15
|
-
event:
|
|
16
|
-
mappedEvent?: PayloadBundle;
|
|
15
|
+
event: BackendEvent;
|
|
17
16
|
decryptedData?: GenericMessage;
|
|
18
17
|
decryptionError?: DecryptionError;
|
|
19
18
|
};
|
|
20
19
|
declare enum TOPIC {
|
|
21
20
|
NOTIFICATION_ERROR = "NotificationService.TOPIC.NOTIFICATION_ERROR"
|
|
22
21
|
}
|
|
23
|
-
export type NotificationHandler = (notification: Notification, source:
|
|
22
|
+
export type NotificationHandler = (notification: Notification, source: NotificationSource, progress: {
|
|
24
23
|
done: number;
|
|
25
24
|
total: number;
|
|
26
25
|
}) => Promise<void>;
|
|
@@ -40,7 +39,7 @@ export declare class NotificationService extends EventEmitter {
|
|
|
40
39
|
/** Should only be called with a completely new client. */
|
|
41
40
|
initializeNotificationStream(): Promise<string>;
|
|
42
41
|
hasHistory(): Promise<boolean>;
|
|
43
|
-
getNotificationEventList(): Promise<
|
|
42
|
+
getNotificationEventList(): Promise<BackendEvent[]>;
|
|
44
43
|
setLastEventDate(eventDate: Date): Promise<Date>;
|
|
45
44
|
setLastNotificationId(lastNotification: Notification): Promise<string>;
|
|
46
45
|
processNotificationStream(notificationHandler: NotificationHandler, onMissedNotifications: (notificationId: string) => void, abortHandler: AbortHandler): Promise<{
|
|
@@ -57,8 +56,7 @@ export declare class NotificationService extends EventEmitter {
|
|
|
57
56
|
* @param lastEventDate?
|
|
58
57
|
*/
|
|
59
58
|
private isOutdatedEvent;
|
|
60
|
-
handleNotification(notification: Notification, source:
|
|
61
|
-
private cleanupPayloadBundle;
|
|
59
|
+
handleNotification(notification: Notification, source: NotificationSource, dryRun?: boolean): AsyncGenerator<HandledEventPayload>;
|
|
62
60
|
/**
|
|
63
61
|
* Will process one event
|
|
64
62
|
* @param event The backend event to process
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NotificationService.d.ts","sourceRoot":"","sources":["../../src/notification/NotificationService.ts"],"names":[],"mappings":";AAmBA,OAAO,
|
|
1
|
+
{"version":3,"file":"NotificationService.d.ts","sourceRoot":"","sources":["../../src/notification/NotificationService.ts"],"names":[],"mappings":";AAmBA,OAAO,EAAC,YAAY,EAAqB,MAAM,+BAA+B,CAAC;AAC/E,OAAO,EAAC,YAAY,EAAC,MAAM,uCAAuC,CAAC;AACnE,OAAO,EAAC,YAAY,EAAC,MAAM,6BAA6B,CAAC;AAGzD,OAAO,EAAC,YAAY,EAAC,MAAM,QAAQ,CAAC;AAEpC,OAAO,EAAC,SAAS,EAAC,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAC,cAAc,EAAC,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAC,UAAU,EAA4B,MAAM,uBAAuB,CAAC;AAI5E,OAAO,EAAC,kBAAkB,EAAC,MAAM,uBAAuB,CAAC;AAEzD,OAAO,EAAY,iBAAiB,EAAC,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAC,eAAe,EAAC,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAC,UAAU,EAAC,MAAM,2BAA2B,CAAC;AACrD,OAAO,EAAC,cAAc,EAAC,MAAM,+BAA+B,CAAC;AAE7D,MAAM,MAAM,mBAAmB,GAAG;IAChC,KAAK,EAAE,YAAY,CAAC;IACpB,aAAa,CAAC,EAAE,cAAc,CAAC;IAC/B,eAAe,CAAC,EAAE,eAAe,CAAC;CACnC,CAAC;AAEF,aAAK,KAAK;IACR,kBAAkB,iDAAiD;CACpE;AAED,MAAM,MAAM,mBAAmB,GAAG,CAChC,YAAY,EAAE,YAAY,EAC1B,MAAM,EAAE,kBAAkB,EAC1B,QAAQ,EAAE;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAC,KACpC,OAAO,CAAC,IAAI,CAAC,CAAC;AAEnB,MAAM,WAAW,mBAAmB;IAClC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,kBAAkB,EAAE,QAAQ,EAAE,CAAC,OAAO,EAAE,iBAAiB,KAAK,IAAI,GAAG,IAAI,CAAC;CAC3F;AAED,qBAAa,mBAAoB,SAAQ,YAAY;IAYjD,OAAO,CAAC,QAAQ,CAAC,UAAU;IAC3B,OAAO,CAAC,QAAQ,CAAC,cAAc;IAZjC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAY;IACtC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAgC;IACxD,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAiC;IAC1D,OAAO,CAAC,QAAQ,CAAC,MAAM,CAGpB;IACH,gBAAuB,KAAK,eAAS;gBAGnC,SAAS,EAAE,SAAS,EACH,UAAU,EAAE,UAAU,EACtB,cAAc,EAAE,cAAc,EAC/C,WAAW,EAAE,UAAU;YAQX,mBAAmB;IAKjC,0DAA0D;IAC7C,4BAA4B,IAAI,OAAO,CAAC,MAAM,CAAC;IAO/C,UAAU,IAAI,OAAO,CAAC,OAAO,CAAC;IAKpC,wBAAwB,IAAI,OAAO,CAAC,YAAY,EAAE,CAAC;IAI7C,gBAAgB,CAAC,SAAS,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAsBhD,qBAAqB,CAAC,gBAAgB,EAAE,YAAY,GAAG,OAAO,CAAC,MAAM,CAAC;IAItE,yBAAyB,CACpC,mBAAmB,EAAE,mBAAmB,EACxC,qBAAqB,EAAE,CAAC,cAAc,EAAE,MAAM,KAAK,IAAI,EACvD,YAAY,EAAE,YAAY,GACzB,OAAO,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAC,CAAC;IAoC3D;;;;;;;OAOG;IACH,OAAO,CAAC,eAAe;IAYT,kBAAkB,CAC9B,YAAY,EAAE,YAAY,EAC1B,MAAM,EAAE,kBAAkB,EAC1B,MAAM,GAAE,OAAe,GACtB,cAAc,CAAC,mBAAmB,CAAC;IAmCtC;;;;;;OAMG;YACW,WAAW;CAmC1B"}
|
|
@@ -17,29 +17,6 @@
|
|
|
17
17
|
* along with this program. If not, see http://www.gnu.org/licenses/.
|
|
18
18
|
*
|
|
19
19
|
*/
|
|
20
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
21
|
-
if (k2 === undefined) k2 = k;
|
|
22
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
23
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
24
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
25
|
-
}
|
|
26
|
-
Object.defineProperty(o, k2, desc);
|
|
27
|
-
}) : (function(o, m, k, k2) {
|
|
28
|
-
if (k2 === undefined) k2 = k;
|
|
29
|
-
o[k2] = m[k];
|
|
30
|
-
}));
|
|
31
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
32
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
33
|
-
}) : function(o, v) {
|
|
34
|
-
o["default"] = v;
|
|
35
|
-
});
|
|
36
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
37
|
-
if (mod && mod.__esModule) return mod;
|
|
38
|
-
var result = {};
|
|
39
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
40
|
-
__setModuleDefault(result, mod);
|
|
41
|
-
return result;
|
|
42
|
-
};
|
|
43
20
|
var __await = (this && this.__await) || function (v) { return this instanceof __await ? (this.v = v, this) : new __await(v); }
|
|
44
21
|
var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) {
|
|
45
22
|
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
@@ -57,16 +34,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
57
34
|
};
|
|
58
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
59
36
|
exports.NotificationService = void 0;
|
|
60
|
-
const
|
|
37
|
+
const event_1 = require("@wireapp/api-client/lib/event");
|
|
61
38
|
const logdown_1 = __importDefault(require("logdown"));
|
|
62
39
|
const events_1 = require("events");
|
|
63
40
|
const store_engine_1 = require("@wireapp/store-engine");
|
|
64
41
|
const NotificationBackendRepository_1 = require("./NotificationBackendRepository");
|
|
65
42
|
const NotificationDatabaseRepository_1 = require("./NotificationDatabaseRepository");
|
|
66
|
-
const
|
|
67
|
-
const ConversationMapper_1 = require("../conversation/ConversationMapper");
|
|
43
|
+
const Notifications_types_1 = require("./Notifications.types");
|
|
68
44
|
const CoreError_1 = require("../CoreError");
|
|
69
|
-
const UserMapper_1 = require("../user/UserMapper");
|
|
70
45
|
var TOPIC;
|
|
71
46
|
(function (TOPIC) {
|
|
72
47
|
TOPIC["NOTIFICATION_ERROR"] = "NotificationService.TOPIC.NOTIFICATION_ERROR";
|
|
@@ -142,7 +117,7 @@ class NotificationService extends events_1.EventEmitter {
|
|
|
142
117
|
return results;
|
|
143
118
|
}
|
|
144
119
|
try {
|
|
145
|
-
await notificationHandler(notification,
|
|
120
|
+
await notificationHandler(notification, Notifications_types_1.NotificationSource.NOTIFICATION_STREAM, {
|
|
146
121
|
done: index + 1,
|
|
147
122
|
total: notifications.length,
|
|
148
123
|
});
|
|
@@ -165,7 +140,7 @@ class NotificationService extends events_1.EventEmitter {
|
|
|
165
140
|
* @param lastEventDate?
|
|
166
141
|
*/
|
|
167
142
|
isOutdatedEvent(event, source, lastEventDate) {
|
|
168
|
-
const isFromNotificationStream = source ===
|
|
143
|
+
const isFromNotificationStream = source === Notifications_types_1.NotificationSource.NOTIFICATION_STREAM;
|
|
169
144
|
const shouldCheckEventDate = !!event.time && isFromNotificationStream && lastEventDate;
|
|
170
145
|
if (shouldCheckEventDate) {
|
|
171
146
|
/** This check prevents duplicated "You joined" system messages. */
|
|
@@ -190,7 +165,7 @@ class NotificationService extends events_1.EventEmitter {
|
|
|
190
165
|
try {
|
|
191
166
|
const data = yield __await(this.handleEvent(event, source, dryRun));
|
|
192
167
|
if (typeof data !== 'undefined') {
|
|
193
|
-
yield yield __await(
|
|
168
|
+
yield yield __await(data);
|
|
194
169
|
}
|
|
195
170
|
}
|
|
196
171
|
catch (error) {
|
|
@@ -209,24 +184,6 @@ class NotificationService extends events_1.EventEmitter {
|
|
|
209
184
|
}
|
|
210
185
|
});
|
|
211
186
|
}
|
|
212
|
-
cleanupPayloadBundle(payload) {
|
|
213
|
-
switch (payload.type) {
|
|
214
|
-
case conversation_1.PayloadBundleType.ASSET: {
|
|
215
|
-
const assetContent = payload.content;
|
|
216
|
-
const isMetaData = !!(assetContent === null || assetContent === void 0 ? void 0 : assetContent.original) && !(assetContent === null || assetContent === void 0 ? void 0 : assetContent.uploaded);
|
|
217
|
-
const isAbort = !!assetContent.abortReason || (!assetContent.original && !assetContent.uploaded);
|
|
218
|
-
if (isMetaData) {
|
|
219
|
-
payload.type = conversation_1.PayloadBundleType.ASSET_META;
|
|
220
|
-
}
|
|
221
|
-
else if (isAbort) {
|
|
222
|
-
payload.type = conversation_1.PayloadBundleType.ASSET_ABORT;
|
|
223
|
-
}
|
|
224
|
-
return payload;
|
|
225
|
-
}
|
|
226
|
-
default:
|
|
227
|
-
return payload;
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
187
|
/**
|
|
231
188
|
* Will process one event
|
|
232
189
|
* @param event The backend event to process
|
|
@@ -252,27 +209,13 @@ class NotificationService extends events_1.EventEmitter {
|
|
|
252
209
|
// Fallback to other events
|
|
253
210
|
switch (event.type) {
|
|
254
211
|
// Meta events
|
|
255
|
-
case
|
|
212
|
+
case event_1.CONVERSATION_EVENT.MEMBER_JOIN:
|
|
256
213
|
// As of today (07/07/2022) the backend sends `WELCOME` message to the user's own conversation (not the actual conversation that the welcome should be part of)
|
|
257
214
|
// So in order to map conversation Ids and groupId together, we need to first fetch the conversation and get the groupId linked to it.
|
|
258
215
|
const conversation = await this.apiClient.api.conversation.getConversation((_a = event.qualified_conversation) !== null && _a !== void 0 ? _a : { id: event.conversation, domain: '' });
|
|
259
216
|
if (!conversation) {
|
|
260
217
|
throw new Error('no conv');
|
|
261
218
|
}
|
|
262
|
-
case Events.CONVERSATION_EVENT.MESSAGE_TIMER_UPDATE:
|
|
263
|
-
case Events.CONVERSATION_EVENT.RENAME:
|
|
264
|
-
case Events.CONVERSATION_EVENT.TYPING: {
|
|
265
|
-
const { conversation, from } = event;
|
|
266
|
-
const metaEvent = Object.assign(Object.assign({}, event), { conversation, from });
|
|
267
|
-
return { mappedEvent: ConversationMapper_1.ConversationMapper.mapConversationEvent(metaEvent, source), event };
|
|
268
|
-
}
|
|
269
|
-
// User events
|
|
270
|
-
case Events.USER_EVENT.CONNECTION:
|
|
271
|
-
case Events.USER_EVENT.CLIENT_ADD:
|
|
272
|
-
case Events.USER_EVENT.UPDATE:
|
|
273
|
-
case Events.USER_EVENT.CLIENT_REMOVE: {
|
|
274
|
-
return { mappedEvent: UserMapper_1.UserMapper.mapUserEvent(event, this.apiClient.context.userId, source), event };
|
|
275
|
-
}
|
|
276
219
|
}
|
|
277
220
|
return { event };
|
|
278
221
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Notifications.types.d.ts","sourceRoot":"","sources":["../../src/notification/Notifications.types.ts"],"names":[],"mappings":"AAmBA,oBAAY,kBAAkB;IAC5B,KAAK,UAAU;IACf,mBAAmB,wBAAwB;IAC3C,SAAS,cAAc;CACxB"}
|
|
@@ -0,0 +1,27 @@
|
|
|
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.NotificationSource = void 0;
|
|
22
|
+
var NotificationSource;
|
|
23
|
+
(function (NotificationSource) {
|
|
24
|
+
NotificationSource["LOCAL"] = "LOCAL";
|
|
25
|
+
NotificationSource["NOTIFICATION_STREAM"] = "NOTIFICATION_STREAM";
|
|
26
|
+
NotificationSource["WEBSOCKET"] = "WEBSOCKET";
|
|
27
|
+
})(NotificationSource = exports.NotificationSource || (exports.NotificationSource = {}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/notification/index.ts"],"names":[],"mappings":"AAmBA,cAAc,uBAAuB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/notification/index.ts"],"names":[],"mappings":"AAmBA,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC"}
|
package/lib/user/UserMapper.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { UserEvent } from '@wireapp/api-client/lib/event';
|
|
2
|
-
import { PayloadBundle
|
|
2
|
+
import { PayloadBundle } from '../conversation';
|
|
3
|
+
import { NotificationSource } from '../notification';
|
|
3
4
|
export declare class UserMapper {
|
|
4
|
-
static mapUserEvent(event: UserEvent, selfUserId: string, source:
|
|
5
|
+
static mapUserEvent(event: UserEvent, selfUserId: string, source: NotificationSource): PayloadBundle | undefined;
|
|
5
6
|
}
|
|
6
7
|
//# sourceMappingURL=UserMapper.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UserMapper.d.ts","sourceRoot":"","sources":["../../src/user/UserMapper.ts"],"names":[],"mappings":"AAmBA,OAAO,EAKL,SAAS,EAEV,MAAM,+BAA+B,CAAC;AAEvC,OAAO,
|
|
1
|
+
{"version":3,"file":"UserMapper.d.ts","sourceRoot":"","sources":["../../src/user/UserMapper.ts"],"names":[],"mappings":"AAmBA,OAAO,EAKL,SAAS,EAEV,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EAAsB,aAAa,EAAoB,MAAM,iBAAiB,CAAC;AAEtF,OAAO,EAAC,kBAAkB,EAAC,MAAM,iBAAiB,CAAC;AAEnD,qBAAa,UAAU;WACP,YAAY,CACxB,KAAK,EAAE,SAAS,EAChB,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,kBAAkB,GACzB,aAAa,GAAG,SAAS;CA4D7B"}
|
package/lib/user/UserMapper.js
CHANGED
|
@@ -34,7 +34,7 @@ class UserMapper {
|
|
|
34
34
|
id: (0, MessageBuilder_1.createId)(),
|
|
35
35
|
messageTimer: 0,
|
|
36
36
|
source,
|
|
37
|
-
state: conversation_1.
|
|
37
|
+
state: conversation_1.MessageSendingState.INCOMING,
|
|
38
38
|
timestamp: new Date(connection.last_update).getTime(),
|
|
39
39
|
type: conversation_1.PayloadBundleType.CONNECTION_REQUEST,
|
|
40
40
|
};
|
|
@@ -48,7 +48,7 @@ class UserMapper {
|
|
|
48
48
|
id: (0, MessageBuilder_1.createId)(),
|
|
49
49
|
messageTimer: 0,
|
|
50
50
|
source,
|
|
51
|
-
state: conversation_1.
|
|
51
|
+
state: conversation_1.MessageSendingState.INCOMING,
|
|
52
52
|
timestamp: new Date().getTime(),
|
|
53
53
|
type: conversation_1.PayloadBundleType.CLIENT_ADD,
|
|
54
54
|
};
|
|
@@ -61,7 +61,7 @@ class UserMapper {
|
|
|
61
61
|
from: selfUserId,
|
|
62
62
|
id: (0, MessageBuilder_1.createId)(),
|
|
63
63
|
source,
|
|
64
|
-
state: conversation_1.
|
|
64
|
+
state: conversation_1.MessageSendingState.INCOMING,
|
|
65
65
|
timestamp: new Date().getTime(),
|
|
66
66
|
type: conversation_1.PayloadBundleType.USER_UPDATE,
|
|
67
67
|
};
|
|
@@ -75,7 +75,7 @@ class UserMapper {
|
|
|
75
75
|
id: (0, MessageBuilder_1.createId)(),
|
|
76
76
|
messageTimer: 0,
|
|
77
77
|
source,
|
|
78
|
-
state: conversation_1.
|
|
78
|
+
state: conversation_1.MessageSendingState.INCOMING,
|
|
79
79
|
timestamp: new Date().getTime(),
|
|
80
80
|
type: conversation_1.PayloadBundleType.CLIENT_REMOVE,
|
|
81
81
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UserService.d.ts","sourceRoot":"","sources":["../../src/user/UserService.ts"],"names":[],"mappings":"AAoBA,OAAO,EAAC,WAAW,EAAE,IAAI,EAAsB,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"UserService.d.ts","sourceRoot":"","sources":["../../src/user/UserService.ts"],"names":[],"mappings":"AAoBA,OAAO,EAAC,WAAW,EAAE,IAAI,EAAsB,MAAM,+BAA+B,CAAC;AAErF,OAAO,EAAC,SAAS,EAAC,MAAM,qBAAqB,CAAC;AAG9C,OAAO,EAAC,gBAAgB,EAAE,gBAAgB,EAAC,MAAM,eAAe,CAAC;AACjE,OAAO,EAAC,iBAAiB,EAAC,MAAM,eAAe,CAAC;AAKhD,qBAAa,WAAW;IACtB,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAY;IACtC,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAmB;IACpD,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAoB;gBAE1C,SAAS,EAAE,SAAS,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,iBAAiB;IAMnG,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;IAI9C,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,WAAW,EAAE,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;IASzE;;;;;;OAMG;IACU,eAAe,CAC1B,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,gBAAgB,EACtB,EAAC,OAAe,EAAE,cAAsB,EAAC;;;KAAK,GAC7C,OAAO,CAAC,IAAI,CAAC;CAuCjB"}
|
package/lib/user/UserService.js
CHANGED
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
21
|
exports.UserService = void 0;
|
|
22
22
|
const connection_1 = require("@wireapp/api-client/lib/connection");
|
|
23
|
-
const uuidjs_1 = require("uuidjs");
|
|
24
23
|
const protocol_messaging_1 = require("@wireapp/protocol-messaging");
|
|
24
|
+
const MessageBuilder_1 = require("../conversation/message/MessageBuilder");
|
|
25
25
|
const proteus_1 = require("../messagingProtocols/proteus");
|
|
26
26
|
const TypePredicateUtil_1 = require("../util/TypePredicateUtil");
|
|
27
27
|
class UserService {
|
|
@@ -72,7 +72,7 @@ class UserService {
|
|
|
72
72
|
}, preKeyBundlesFromTeam);
|
|
73
73
|
const genericMessage = protocol_messaging_1.GenericMessage.create({
|
|
74
74
|
availability: new protocol_messaging_1.Availability({ type }),
|
|
75
|
-
messageId: (0,
|
|
75
|
+
messageId: (0, MessageBuilder_1.createId)(),
|
|
76
76
|
});
|
|
77
77
|
// Broadcast availability status to your team members & external 1:1 connections
|
|
78
78
|
await this.broadcastService.broadcastGenericMessage(genericMessage, allPreKeyBundles, sendAsProtobuf);
|
package/package.json
CHANGED
|
@@ -11,14 +11,14 @@
|
|
|
11
11
|
"./lib/cryptography/AssetCryptography/crypto.node": "./lib/cryptography/AssetCryptography/crypto.browser.js"
|
|
12
12
|
},
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"@wireapp/api-client": "^22.
|
|
15
|
-
"@wireapp/commons": "^5.0.
|
|
14
|
+
"@wireapp/api-client": "^22.8.0",
|
|
15
|
+
"@wireapp/commons": "^5.0.4",
|
|
16
16
|
"@wireapp/core-crypto": "0.6.0-pre.4",
|
|
17
17
|
"@wireapp/cryptobox": "12.8.0",
|
|
18
|
-
"@wireapp/promise-queue": "^2.1.
|
|
18
|
+
"@wireapp/promise-queue": "^2.1.1",
|
|
19
19
|
"@wireapp/protocol-messaging": "1.42.0",
|
|
20
20
|
"@wireapp/store-engine-dexie": "^2.0.3",
|
|
21
|
-
"axios": "1.1
|
|
21
|
+
"axios": "1.2.1",
|
|
22
22
|
"bazinga64": "6.0.3",
|
|
23
23
|
"hash.js": "1.1.7",
|
|
24
24
|
"http-status-codes": "2.2.0",
|
|
@@ -58,6 +58,6 @@
|
|
|
58
58
|
"test:coverage": "jest --coverage",
|
|
59
59
|
"watch": "tsc --watch"
|
|
60
60
|
},
|
|
61
|
-
"version": "37.2.
|
|
62
|
-
"gitHead": "
|
|
61
|
+
"version": "37.2.2",
|
|
62
|
+
"gitHead": "073ba4e4894358c2ebc85719ffac6982bd517d60"
|
|
63
63
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/conversation/ConversationMapper/index.ts"],"names":[],"mappings":"AAmBA,cAAc,sBAAsB,CAAC"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { Text } from '@wireapp/protocol-messaging';
|
|
2
|
-
import { CompositeMessage } from './OtrMessage';
|
|
3
|
-
import { LegalHoldStatus } from '../content';
|
|
4
|
-
export declare class CompositeContentBuilder {
|
|
5
|
-
private readonly content;
|
|
6
|
-
private readonly payloadBundle;
|
|
7
|
-
private readonly items;
|
|
8
|
-
constructor(payloadBundle: CompositeMessage);
|
|
9
|
-
build(): CompositeMessage;
|
|
10
|
-
withReadConfirmation(expectsReadConfirmation?: boolean): CompositeContentBuilder;
|
|
11
|
-
withLegalHoldStatus(legalHoldStatus?: LegalHoldStatus): CompositeContentBuilder;
|
|
12
|
-
addText(text: Text): CompositeContentBuilder;
|
|
13
|
-
addButton(buttonText: string, id?: string): CompositeContentBuilder;
|
|
14
|
-
}
|
|
15
|
-
//# sourceMappingURL=CompositeContentBuilder.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CompositeContentBuilder.d.ts","sourceRoot":"","sources":["../../../src/conversation/message/CompositeContentBuilder.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAoB,IAAI,EAAC,MAAM,6BAA6B,CAAC;AAGpE,OAAO,EAAC,gBAAgB,EAAC,MAAM,cAAc,CAAC;AAE9C,OAAO,EAAmB,eAAe,EAAC,MAAM,YAAY,CAAC;AAE7D,qBAAa,uBAAuB;IAClC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAwB;IAChD,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAmB;IACjD,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAyB;gBAEnC,aAAa,EAAE,gBAAgB;IAI3C,KAAK,IAAI,gBAAgB;IAMzB,oBAAoB,CAAC,uBAAuB,GAAE,OAAe,GAAG,uBAAuB;IAKvF,mBAAmB,CAAC,eAAe,GAAE,eAAyC,GAAG,uBAAuB;IAKxG,OAAO,CAAC,IAAI,EAAE,IAAI,GAAG,uBAAuB;IAK5C,SAAS,CAAC,UAAU,EAAE,MAAM,EAAE,EAAE,GAAE,MAAmB,GAAG,uBAAuB;CAIhF"}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* Wire
|
|
4
|
-
* Copyright (C) 2020 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.CompositeContentBuilder = void 0;
|
|
22
|
-
const protocol_messaging_1 = require("@wireapp/protocol-messaging");
|
|
23
|
-
const MessageBuilder_1 = require("./MessageBuilder");
|
|
24
|
-
const content_1 = require("../content");
|
|
25
|
-
class CompositeContentBuilder {
|
|
26
|
-
constructor(payloadBundle) {
|
|
27
|
-
this.content = {};
|
|
28
|
-
this.items = [];
|
|
29
|
-
this.payloadBundle = payloadBundle;
|
|
30
|
-
}
|
|
31
|
-
build() {
|
|
32
|
-
this.payloadBundle.content = this.content;
|
|
33
|
-
this.payloadBundle.content.items = this.items;
|
|
34
|
-
return this.payloadBundle;
|
|
35
|
-
}
|
|
36
|
-
withReadConfirmation(expectsReadConfirmation = false) {
|
|
37
|
-
this.content.expectsReadConfirmation = expectsReadConfirmation;
|
|
38
|
-
return this;
|
|
39
|
-
}
|
|
40
|
-
withLegalHoldStatus(legalHoldStatus = content_1.LegalHoldStatus.UNKNOWN) {
|
|
41
|
-
this.content.legalHoldStatus = legalHoldStatus;
|
|
42
|
-
return this;
|
|
43
|
-
}
|
|
44
|
-
addText(text) {
|
|
45
|
-
this.items.push(protocol_messaging_1.Composite.Item.create({ text }));
|
|
46
|
-
return this;
|
|
47
|
-
}
|
|
48
|
-
addButton(buttonText, id = (0, MessageBuilder_1.createId)()) {
|
|
49
|
-
this.items.push(protocol_messaging_1.Composite.Item.create({ button: protocol_messaging_1.Button.create({ id, text: buttonText }) }));
|
|
50
|
-
return this;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
exports.CompositeContentBuilder = CompositeContentBuilder;
|