@wireapp/core 28.3.5 → 28.4.1

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 CHANGED
@@ -3,6 +3,33 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [28.4.1](https://github.com/wireapp/wire-web-packages/tree/main/packages/core/compare/@wireapp/core@28.4.0...@wireapp/core@28.4.1) (2022-07-08)
7
+
8
+ **Note:** Version bump only for package @wireapp/core
9
+
10
+
11
+
12
+
13
+
14
+ # [28.4.0](https://github.com/wireapp/wire-web-packages/tree/main/packages/core/compare/@wireapp/core@28.3.6...@wireapp/core@28.4.0) (2022-07-08)
15
+
16
+
17
+ ### Features
18
+
19
+ * **core:** Send MLS messages (FS-560) ([#4314](https://github.com/wireapp/wire-web-packages/tree/main/packages/core/issues/4314)) ([2f29052](https://github.com/wireapp/wire-web-packages/tree/main/packages/core/commit/2f2905233b29c31294ec64e97c1e84998e28821f))
20
+
21
+
22
+
23
+
24
+
25
+ ## [28.3.6](https://github.com/wireapp/wire-web-packages/tree/main/packages/core/compare/@wireapp/core@28.3.5...@wireapp/core@28.3.6) (2022-07-08)
26
+
27
+ **Note:** Version bump only for package @wireapp/core
28
+
29
+
30
+
31
+
32
+
6
33
  ## [28.3.5](https://github.com/wireapp/wire-web-packages/tree/main/packages/core/compare/@wireapp/core@28.3.4...@wireapp/core@28.3.5) (2022-07-07)
7
34
 
8
35
  **Note:** Version bump only for package @wireapp/core
package/package.json CHANGED
@@ -7,8 +7,10 @@
7
7
  "@otak/core-crypto": "0.3.0-beta-1",
8
8
  "@types/long": "4.0.1",
9
9
  "@types/node": "~14",
10
- "@wireapp/api-client": "19.12.2",
10
+ "@wireapp/api-client": "19.13.1",
11
+ "@wireapp/commons": "4.3.0",
11
12
  "@wireapp/cryptobox": "12.8.0",
13
+ "@wireapp/store-engine-dexie": "1.6.10",
12
14
  "bazinga64": "5.10.0",
13
15
  "hash.js": "1.1.7",
14
16
  "http-status-codes": "2.1.4",
@@ -22,6 +24,7 @@
22
24
  "@types/faker": "5.5.7",
23
25
  "@types/jasmine": "3.8.2",
24
26
  "@types/karma": "6.3.1",
27
+ "@types/tough-cookie": "4.0.2",
25
28
  "@wireapp/commons": "4.3.0",
26
29
  "@wireapp/store-engine-dexie": "1.6.10",
27
30
  "commander": "8.0.0",
@@ -39,6 +42,7 @@
39
42
  "karma-spec-reporter": "0.0.32",
40
43
  "mock-socket": "9.0.3",
41
44
  "nock": "13.1.1",
45
+ "nodemon": "2.0.19",
42
46
  "nyc": "15.1.0",
43
47
  "rimraf": "3.0.2",
44
48
  "typescript": "4.4.2",
@@ -71,8 +75,10 @@
71
75
  "test": "yarn test:node && yarn test:browser",
72
76
  "test:browser": "webpack --mode=development && karma start",
73
77
  "test:project": "yarn dist && yarn test",
74
- "test:node": "nyc jasmine --config=jasmine.json"
78
+ "test:node": "nyc jasmine --config=jasmine.json",
79
+ "watch": "tsc ---watch",
80
+ "test:watch": "nodemon --ext ts --exec 'yarn test:node'"
75
81
  },
76
- "version": "28.3.5",
77
- "gitHead": "2e4b3ccb98f3fe7095384b1ae98084378fdd0133"
82
+ "version": "28.4.1",
83
+ "gitHead": "f199dcd94757cfa838c5f4e6f0c4b8c9c3e5c70f"
78
84
  }
@@ -1,6 +1,6 @@
1
1
  import type { CoreCrypto } from '@otak/core-crypto';
2
2
  import type { APIClient } from '@wireapp/api-client';
3
- import { MessageSendingStatus, Conversation, DefaultConversationRoleName, MutedStatus, NewConversation, QualifiedUserClients, UserClients, ClientMismatch } from '@wireapp/api-client/src/conversation';
3
+ import { MessageSendingStatus, Conversation, DefaultConversationRoleName, MutedStatus, NewConversation, QualifiedUserClients, UserClients, ClientMismatch, ConversationProtocol } from '@wireapp/api-client/src/conversation';
4
4
  import type { ConversationMemberLeaveEvent } from '@wireapp/api-client/src/event';
5
5
  import type { QualifiedId, UserPreKeyBundleMap } from '@wireapp/api-client/src/user';
6
6
  import { GenericMessage } from '@wireapp/protocol-messaging';
@@ -8,11 +8,25 @@ import { MessageTimer } from '../conversation/';
8
8
  import type { RemoteData } from '../conversation/content/';
9
9
  import type { CryptographyService } from '../cryptography/';
10
10
  import type { ClearConversationMessage, DeleteMessage, HideMessage, OtrMessage } from './message/OtrMessage';
11
+ import { XOR } from '@wireapp/commons/src/main/util/TypeUtil';
11
12
  export declare enum MessageTargetMode {
12
13
  NONE = 0,
13
14
  USERS = 1,
14
15
  USERS_CLIENTS = 2
15
16
  }
17
+ interface SendCommonParams<T> {
18
+ protocol: ConversationProtocol;
19
+ payload: T;
20
+ onStart?: (message: GenericMessage) => void | boolean | Promise<boolean>;
21
+ onSuccess?: (message: GenericMessage, sentTime?: string) => void;
22
+ }
23
+ declare type SendProteusMessageParams<T> = SendCommonParams<T> & MessageSendingOptions & {
24
+ userIds?: string[] | QualifiedId[] | UserClients | QualifiedUserClients;
25
+ onClientMismatch?: (status: ClientMismatch | MessageSendingStatus, wasSent: boolean) => void | boolean | Promise<boolean>;
26
+ };
27
+ declare type SendMlsMessageParams<T> = SendCommonParams<T> & {
28
+ groupId: string;
29
+ };
16
30
  interface MessageSendingOptions {
17
31
  /**
18
32
  * The federated domain the server runs on. Should only be set for federation enabled envs
@@ -103,6 +117,7 @@ export declare class ConversationService {
103
117
  private generateFileDataGenericMessage;
104
118
  private generateFileMetaDataGenericMessage;
105
119
  private generateFileAbortGenericMessage;
120
+ private generateAsset;
106
121
  private generateImageGenericMessage;
107
122
  private generateLocationGenericMessage;
108
123
  private generatePingGenericMessage;
@@ -177,26 +192,35 @@ export declare class ConversationService {
177
192
  addUser(conversationId: QualifiedId, userIds: string | string[] | QualifiedId | QualifiedId[]): Promise<QualifiedId[]>;
178
193
  removeUser(conversationId: string, userId: string): Promise<string>;
179
194
  /**
180
- * Sends a message to a conversation
195
+ * Sends a mls message to a conversation
181
196
  *
182
- * @param params.payloadBundle The message to send to the conversation
183
- * @param params.userIds? Can be either a QualifiedId[], string[], UserClients or QualfiedUserClients. The type has some effect on the behavior of the method.
197
+ * @param params.payload The message to send to the conversation
198
+ * @param params.protocol The protocol to use to send the message (MLS or Proteus)
199
+ * @param params.groupId? The groupId of the conversation to send the message to (Needed only for MLS)
200
+ * @return resolves with the sent message
201
+ */
202
+ private sendMlsMessage;
203
+ /**
204
+ * Sends a proteus message to a conversation
205
+ * @param params.userIds? Can be either a QualifiedId[], string[], UserClients or QualfiedUserClients. The type has some effect on the behavior of the method. (Needed only for Proteus)
184
206
  * When given a QualifiedId[] or string[] the method will fetch the freshest list of devices for those users (since they are not given by the consumer). As a consequence no ClientMismatch error will trigger and we will ignore missing clients when sending
185
207
  * When given a QualifiedUserClients or UserClients the method will only send to the clients listed in the userIds. This could lead to ClientMismatch (since the given list of devices might not be the freshest one and new clients could have been created)
186
208
  * When given a QualifiedId[] or QualifiedUserClients the method will send the message through the federated API endpoint
187
209
  * When given a string[] or UserClients the method will send the message through the old API endpoint
188
210
  * @return resolves with the sent message
189
211
  */
190
- send<T extends OtrMessage = OtrMessage>({ payloadBundle, userIds, sendAsProtobuf, conversationDomain, nativePush, targetMode, callbacks, }: {
191
- payloadBundle: T;
192
- userIds?: string[] | QualifiedId[] | UserClients | QualifiedUserClients;
193
- callbacks?: MessageSendingCallbacks;
194
- } & MessageSendingOptions): Promise<T>;
212
+ private sendProteusMessage;
213
+ /**
214
+ * Sends a message to a conversation
215
+ * @return resolves with the sent message
216
+ */
217
+ send<T extends OtrMessage>(params: XOR<SendMlsMessageParams<T>, SendProteusMessageParams<T>>): Promise<T>;
195
218
  sendTypingStart(conversationId: string): Promise<void>;
196
219
  sendTypingStop(conversationId: string): Promise<void>;
197
220
  setConversationMutedStatus(conversationId: string, status: MutedStatus, muteTimestamp: number | Date): Promise<void>;
198
221
  toggleArchiveConversation(conversationId: string, archived: boolean, archiveTimestamp?: number | Date): Promise<void>;
199
222
  setMemberConversationRole(conversationId: string, userId: string, conversationRole: DefaultConversationRoleName | string): Promise<void>;
200
223
  private isClearFromMismatch;
224
+ private generateGenericMessage;
201
225
  }
202
226
  export {};
@@ -35,6 +35,9 @@ var MessageTargetMode;
35
35
  MessageTargetMode[MessageTargetMode["USERS"] = 1] = "USERS";
36
36
  MessageTargetMode[MessageTargetMode["USERS_CLIENTS"] = 2] = "USERS_CLIENTS";
37
37
  })(MessageTargetMode = exports.MessageTargetMode || (exports.MessageTargetMode = {}));
38
+ function isMLS(params) {
39
+ return params.protocol === conversation_1.ConversationProtocol.MLS;
40
+ }
38
41
  class ConversationService {
39
42
  constructor(apiClient, cryptographyService, config, coreCryptoClientProvider) {
40
43
  this.apiClient = apiClient;
@@ -335,7 +338,7 @@ class ConversationService {
335
338
  const expireAfterMillis = this.messageTimer.getMessageTimer(payloadBundle.conversation);
336
339
  return expireAfterMillis > 0 ? this.createEphemeral(genericMessage, expireAfterMillis) : genericMessage;
337
340
  }
338
- generateImageGenericMessage(payloadBundle) {
341
+ generateAsset(payloadBundle) {
339
342
  if (!payloadBundle.content) {
340
343
  throw new Error('No content for sendImage provided.');
341
344
  }
@@ -364,15 +367,19 @@ class ConversationService {
364
367
  uploaded: remoteData,
365
368
  });
366
369
  assetMessage.status = conversation_2.AssetTransferState.UPLOADED;
370
+ return assetMessage;
371
+ }
372
+ generateImageGenericMessage(payloadBundle) {
373
+ const imageAsset = this.generateAsset(payloadBundle);
367
374
  let genericMessage = protocol_messaging_1.GenericMessage.create({
368
- [conversation_2.GenericMessageType.ASSET]: assetMessage,
375
+ [conversation_2.GenericMessageType.ASSET]: imageAsset,
369
376
  messageId: payloadBundle.id,
370
377
  });
371
378
  const expireAfterMillis = this.messageTimer.getMessageTimer(payloadBundle.conversation);
372
379
  if (expireAfterMillis) {
373
380
  genericMessage = this.createEphemeral(genericMessage, expireAfterMillis);
374
381
  }
375
- return { content: assetMessage, genericMessage };
382
+ return { genericMessage, content: imageAsset };
376
383
  }
377
384
  generateLocationGenericMessage(payloadBundle) {
378
385
  const { expectsReadConfirmation, latitude, legalHoldStatus, longitude, name, zoom } = payloadBundle.content;
@@ -714,95 +721,71 @@ class ConversationService {
714
721
  return userId;
715
722
  }
716
723
  /**
717
- * Sends a message to a conversation
724
+ * Sends a mls message to a conversation
718
725
  *
719
- * @param params.payloadBundle The message to send to the conversation
720
- * @param params.userIds? Can be either a QualifiedId[], string[], UserClients or QualfiedUserClients. The type has some effect on the behavior of the method.
726
+ * @param params.payload The message to send to the conversation
727
+ * @param params.protocol The protocol to use to send the message (MLS or Proteus)
728
+ * @param params.groupId? The groupId of the conversation to send the message to (Needed only for MLS)
729
+ * @return resolves with the sent message
730
+ */
731
+ async sendMlsMessage(params, genericMessage, content) {
732
+ var _a, _b;
733
+ const { groupId, onSuccess, payload } = params;
734
+ const groupIdBytes = bazinga64_1.Decoder.fromBase64(groupId).asBytes;
735
+ const coreCryptoClient = this.coreCryptoClientProvider();
736
+ const encrypted = await coreCryptoClient.encryptMessage(groupIdBytes, protocol_messaging_1.GenericMessage.encode(genericMessage).finish());
737
+ try {
738
+ await this.apiClient.api.conversation.postMlsMessage(encrypted);
739
+ onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(genericMessage, new Date().toISOString());
740
+ return Object.assign(Object.assign({}, payload), { content, messageTimer: ((_a = genericMessage.ephemeral) === null || _a === void 0 ? void 0 : _a.expireAfterMillis) || 0, state: conversation_2.PayloadBundleState.OUTGOING_SENT });
741
+ }
742
+ catch (_c) {
743
+ return Object.assign(Object.assign({}, payload), { content, messageTimer: ((_b = genericMessage.ephemeral) === null || _b === void 0 ? void 0 : _b.expireAfterMillis) || 0, state: conversation_2.PayloadBundleState.CANCELLED });
744
+ }
745
+ }
746
+ /**
747
+ * Sends a proteus message to a conversation
748
+ * @param params.userIds? Can be either a QualifiedId[], string[], UserClients or QualfiedUserClients. The type has some effect on the behavior of the method. (Needed only for Proteus)
721
749
  * When given a QualifiedId[] or string[] the method will fetch the freshest list of devices for those users (since they are not given by the consumer). As a consequence no ClientMismatch error will trigger and we will ignore missing clients when sending
722
750
  * When given a QualifiedUserClients or UserClients the method will only send to the clients listed in the userIds. This could lead to ClientMismatch (since the given list of devices might not be the freshest one and new clients could have been created)
723
751
  * When given a QualifiedId[] or QualifiedUserClients the method will send the message through the federated API endpoint
724
752
  * When given a string[] or UserClients the method will send the message through the old API endpoint
725
753
  * @return resolves with the sent message
726
754
  */
727
- async send({ payloadBundle, userIds, sendAsProtobuf, conversationDomain, nativePush, targetMode, callbacks, }) {
728
- var _a, _b, _c, _d;
729
- let genericMessage;
730
- let processedContent = undefined;
731
- switch (payloadBundle.type) {
732
- case conversation_2.PayloadBundleType.ASSET:
733
- genericMessage = this.generateFileDataGenericMessage(payloadBundle);
734
- break;
735
- case conversation_2.PayloadBundleType.ASSET_ABORT:
736
- genericMessage = this.generateFileAbortGenericMessage(payloadBundle);
737
- break;
738
- case conversation_2.PayloadBundleType.ASSET_META:
739
- genericMessage = this.generateFileMetaDataGenericMessage(payloadBundle);
740
- break;
741
- case conversation_2.PayloadBundleType.ASSET_IMAGE:
742
- const res = this.generateImageGenericMessage(payloadBundle);
743
- genericMessage = res.genericMessage;
744
- processedContent = res.content;
745
- break;
746
- case conversation_2.PayloadBundleType.BUTTON_ACTION:
747
- genericMessage = this.generateButtonActionGenericMessage(payloadBundle);
748
- break;
749
- case conversation_2.PayloadBundleType.BUTTON_ACTION_CONFIRMATION:
750
- genericMessage = this.generateButtonActionConfirmationGenericMessage(payloadBundle);
751
- break;
752
- case conversation_2.PayloadBundleType.CALL:
753
- genericMessage = this.generateCallGenericMessage(payloadBundle);
754
- break;
755
- case conversation_2.PayloadBundleType.CLIENT_ACTION: {
756
- if (payloadBundle.content.clientAction !== protocol_messaging_1.ClientAction.RESET_SESSION) {
757
- throw new Error(`No send method implemented for "${payloadBundle.type}" and ClientAction "${payloadBundle.content}".`);
758
- }
759
- genericMessage = this.generateSessionResetGenericMessage(payloadBundle);
760
- break;
761
- }
762
- case conversation_2.PayloadBundleType.COMPOSITE:
763
- genericMessage = this.generateCompositeGenericMessage(payloadBundle);
764
- break;
765
- case conversation_2.PayloadBundleType.CONFIRMATION:
766
- genericMessage = this.generateConfirmationGenericMessage(payloadBundle);
767
- break;
768
- case conversation_2.PayloadBundleType.LOCATION:
769
- genericMessage = this.generateLocationGenericMessage(payloadBundle);
770
- break;
771
- case conversation_2.PayloadBundleType.MESSAGE_EDIT:
772
- genericMessage = this.generateEditedTextGenericMessage(payloadBundle);
773
- break;
774
- case conversation_2.PayloadBundleType.PING:
775
- genericMessage = this.generatePingGenericMessage(payloadBundle);
776
- break;
777
- case conversation_2.PayloadBundleType.REACTION:
778
- genericMessage = this.generateReactionGenericMessage(payloadBundle);
779
- break;
780
- case conversation_2.PayloadBundleType.TEXT:
781
- genericMessage = this.generateTextGenericMessage(payloadBundle);
782
- break;
783
- default:
784
- throw new Error(`No send method implemented for "${payloadBundle['type']}".`);
785
- }
786
- if ((await ((_a = callbacks === null || callbacks === void 0 ? void 0 : callbacks.onStart) === null || _a === void 0 ? void 0 : _a.call(callbacks, genericMessage))) === false) {
787
- // If the onStart call returns false, it means the consumer wants to cancel the message sending
788
- return Object.assign(Object.assign({}, payloadBundle), { state: conversation_2.PayloadBundleState.CANCELLED });
789
- }
790
- const response = await this.sendGenericMessage(this.apiClient.validatedClientId, payloadBundle.conversation, genericMessage, {
755
+ async sendProteusMessage(params, genericMessage, content) {
756
+ var _a;
757
+ const { userIds, sendAsProtobuf, conversationDomain, nativePush, targetMode, payload, onClientMismatch, onSuccess } = params;
758
+ const response = await this.sendGenericMessage(this.apiClient.validatedClientId, payload.conversation, genericMessage, {
791
759
  userIds,
792
760
  sendAsProtobuf,
793
761
  conversationDomain,
794
762
  nativePush,
795
763
  targetMode,
796
- onClientMismatch: callbacks === null || callbacks === void 0 ? void 0 : callbacks.onClientMismatch,
764
+ onClientMismatch,
797
765
  });
798
766
  if (!response.errored) {
799
767
  if (!this.isClearFromMismatch(response)) {
800
768
  // We warn the consumer that there is a mismatch that did not prevent message sending
801
- await ((_b = callbacks === null || callbacks === void 0 ? void 0 : callbacks.onClientMismatch) === null || _b === void 0 ? void 0 : _b.call(callbacks, response, true));
769
+ await (onClientMismatch === null || onClientMismatch === void 0 ? void 0 : onClientMismatch(response, true));
802
770
  }
803
- (_c = callbacks === null || callbacks === void 0 ? void 0 : callbacks.onSuccess) === null || _c === void 0 ? void 0 : _c.call(callbacks, genericMessage, response.time);
771
+ onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(genericMessage, response.time);
804
772
  }
805
- return Object.assign(Object.assign({}, payloadBundle), { content: processedContent || payloadBundle.content, messageTimer: ((_d = genericMessage.ephemeral) === null || _d === void 0 ? void 0 : _d.expireAfterMillis) || 0, state: response.errored ? conversation_2.PayloadBundleState.CANCELLED : conversation_2.PayloadBundleState.OUTGOING_SENT });
773
+ return Object.assign(Object.assign({}, payload), { content, messageTimer: ((_a = genericMessage.ephemeral) === null || _a === void 0 ? void 0 : _a.expireAfterMillis) || 0, state: response.errored ? conversation_2.PayloadBundleState.CANCELLED : conversation_2.PayloadBundleState.OUTGOING_SENT });
774
+ }
775
+ /**
776
+ * Sends a message to a conversation
777
+ * @return resolves with the sent message
778
+ */
779
+ async send(params) {
780
+ const { payload, onStart } = params;
781
+ const { genericMessage, content } = this.generateGenericMessage(payload);
782
+ if ((await (onStart === null || onStart === void 0 ? void 0 : onStart(genericMessage))) === false) {
783
+ // If the onStart call returns false, it means the consumer wants to cancel the message sending
784
+ return Object.assign(Object.assign({}, payload), { state: conversation_2.PayloadBundleState.CANCELLED });
785
+ }
786
+ return isMLS(params)
787
+ ? this.sendMlsMessage(params, genericMessage, content)
788
+ : this.sendProteusMessage(params, genericMessage, content);
806
789
  }
807
790
  sendTypingStart(conversationId) {
808
791
  return this.apiClient.api.conversation.postTyping(conversationId, { status: data_1.CONVERSATION_TYPING.STARTED });
@@ -842,6 +825,65 @@ class ConversationService {
842
825
  const hasFailed = Object.keys(mismatch.failed_to_send || {}).length > 0;
843
826
  return !hasMissing && !hasDeleted && !hasRedundant && !hasFailed;
844
827
  }
828
+ generateGenericMessage(payload) {
829
+ let genericMessage;
830
+ const content = payload.content;
831
+ switch (payload.type) {
832
+ case conversation_2.PayloadBundleType.ASSET:
833
+ genericMessage = this.generateFileDataGenericMessage(payload);
834
+ return { genericMessage, content };
835
+ case conversation_2.PayloadBundleType.ASSET_ABORT:
836
+ genericMessage = this.generateFileAbortGenericMessage(payload);
837
+ return { genericMessage, content };
838
+ case conversation_2.PayloadBundleType.ASSET_META:
839
+ genericMessage = this.generateFileMetaDataGenericMessage(payload);
840
+ return { genericMessage, content };
841
+ case conversation_2.PayloadBundleType.ASSET_IMAGE:
842
+ return this.generateImageGenericMessage(payload);
843
+ case conversation_2.PayloadBundleType.BUTTON_ACTION:
844
+ genericMessage = this.generateButtonActionGenericMessage(payload);
845
+ return { genericMessage, content };
846
+ case conversation_2.PayloadBundleType.BUTTON_ACTION_CONFIRMATION:
847
+ genericMessage = this.generateButtonActionConfirmationGenericMessage(payload);
848
+ return { genericMessage, content };
849
+ case conversation_2.PayloadBundleType.CALL:
850
+ genericMessage = this.generateCallGenericMessage(payload);
851
+ return { genericMessage, content };
852
+ case conversation_2.PayloadBundleType.CLIENT_ACTION: {
853
+ if (payload.content.clientAction !== protocol_messaging_1.ClientAction.RESET_SESSION) {
854
+ throw new Error(`No send method implemented for "${payload.type}" and ClientAction "${payload.content}".`);
855
+ }
856
+ genericMessage = this.generateSessionResetGenericMessage(payload);
857
+ return { genericMessage, content };
858
+ }
859
+ case conversation_2.PayloadBundleType.COMPOSITE:
860
+ genericMessage = this.generateCompositeGenericMessage(payload);
861
+ return { genericMessage, content };
862
+ case conversation_2.PayloadBundleType.CONFIRMATION:
863
+ genericMessage = this.generateConfirmationGenericMessage(payload);
864
+ return { genericMessage, content };
865
+ case conversation_2.PayloadBundleType.LOCATION:
866
+ genericMessage = this.generateLocationGenericMessage(payload);
867
+ return { genericMessage, content };
868
+ case conversation_2.PayloadBundleType.MESSAGE_EDIT:
869
+ genericMessage = this.generateEditedTextGenericMessage(payload);
870
+ return { genericMessage, content };
871
+ case conversation_2.PayloadBundleType.PING:
872
+ genericMessage = this.generatePingGenericMessage(payload);
873
+ return { genericMessage, content };
874
+ case conversation_2.PayloadBundleType.REACTION:
875
+ genericMessage = this.generateReactionGenericMessage(payload);
876
+ return { genericMessage, content };
877
+ case conversation_2.PayloadBundleType.TEXT:
878
+ genericMessage = this.generateTextGenericMessage(payload);
879
+ return { genericMessage, content };
880
+ /**
881
+ * ToDo: Create Generic implementation for everything else
882
+ */
883
+ default:
884
+ throw new Error(`No send method implemented for "${payload['type']}".`);
885
+ }
886
+ }
845
887
  }
846
888
  exports.ConversationService = ConversationService;
847
889
  //# sourceMappingURL=ConversationService.js.map