@wireapp/core 32.0.5 → 32.0.6

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/package.json CHANGED
@@ -81,6 +81,6 @@
81
81
  "test": "jest",
82
82
  "watch": "tsc ---watch"
83
83
  },
84
- "version": "32.0.5",
85
- "gitHead": "03b66bf602b6fd57eeca4725e1a0a9218332d78d"
84
+ "version": "32.0.6",
85
+ "gitHead": "b7e78c5c3923cd10386056cdeff94c74a56030a2"
86
86
  }
@@ -1,5 +1,5 @@
1
1
  import { APIClient } from '@wireapp/api-client';
2
- import { MessageSendingStatus, Conversation, DefaultConversationRoleName, MutedStatus, NewConversation, QualifiedUserClients, UserClients, ClientMismatch } from '@wireapp/api-client/src/conversation';
2
+ import { Conversation, DefaultConversationRoleName, MutedStatus, NewConversation, QualifiedUserClients, UserClients } from '@wireapp/api-client/src/conversation';
3
3
  import { ConversationMemberLeaveEvent } from '@wireapp/api-client/src/event';
4
4
  import { QualifiedId, UserPreKeyBundleMap } from '@wireapp/api-client/src/user';
5
5
  import { MessageTimer, PayloadBundleState, RemoveUsersParams } from '../../conversation/';
@@ -7,9 +7,8 @@ import { RemoteData } from '../content';
7
7
  import { CryptographyService } from '../../cryptography/';
8
8
  import { MLSService } from '../../mls';
9
9
  import { NotificationService } from '../../notification';
10
- import { ClearConversationMessage } from '../message/OtrMessage';
11
10
  import { XOR } from '@wireapp/commons/src/main/util/TypeUtil';
12
- import { AddUsersParams, MessageSendingOptions, MLSReturnType, SendMlsMessageParams, SendProteusMessageParams } from './ConversationService.types';
11
+ import { AddUsersParams, MLSReturnType, SendMlsMessageParams, SendProteusMessageParams } from './ConversationService.types';
13
12
  declare type SendResult = {
14
13
  /** The id of the message sent */
15
14
  id: string;
@@ -25,7 +24,6 @@ export declare class ConversationService {
25
24
  private readonly mlsService;
26
25
  readonly messageTimer: MessageTimer;
27
26
  private readonly messageService;
28
- private selfConversationId?;
29
27
  constructor(apiClient: APIClient, cryptographyService: CryptographyService, config: {
30
28
  useQualifiedIds?: boolean;
31
29
  }, notificationService: NotificationService, mlsService: MLSService);
@@ -40,7 +38,6 @@ export declare class ConversationService {
40
38
  */
41
39
  private getQualifiedPreKeyBundle;
42
40
  getPreKeyBundleMap(conversationId: QualifiedId, userIds?: string[] | UserClients): Promise<UserPreKeyBundleMap>;
43
- private getSelfConversationId;
44
41
  private getQualifiedRecipientsForConversation;
45
42
  private getRecipientsForConversation;
46
43
  /**
@@ -54,33 +51,6 @@ export declare class ConversationService {
54
51
  private sendGenericMessage;
55
52
  private extractUserIds;
56
53
  private extractQualifiedUserIds;
57
- clearConversation(conversationId: string, timestamp?: number | Date, messageId?: string, sendAsProtobuf?: boolean): Promise<ClearConversationMessage>;
58
- /**
59
- * Sends a LastRead message to the current user's self conversation.
60
- * This will allow all the user's devices to compute which messages are unread
61
- *
62
- * @param conversationId The conversation which has been read
63
- * @param lastReadTimestamp The timestamp at which the conversation was read
64
- * @param sendingOptions?
65
- * @return Resolves when the message has been sent
66
- */
67
- sendLastRead(conversationId: QualifiedId, lastReadTimestamp: number, sendingOptions?: MessageSendingOptions): Promise<(MessageSendingStatus & {
68
- errored?: boolean | undefined;
69
- }) | (ClientMismatch & {
70
- errored?: boolean | undefined;
71
- })>;
72
- /**
73
- * Syncs all self user's devices with the countly id
74
- *
75
- * @param countlyId The countly id of the current device
76
- * @param sendingOptions?
77
- * @return Resolves when the message has been sent
78
- */
79
- sendCountlySync(countlyId: string, sendingOptions: MessageSendingOptions): Promise<(MessageSendingStatus & {
80
- errored?: boolean | undefined;
81
- }) | (ClientMismatch & {
82
- errored?: boolean | undefined;
83
- })>;
84
54
  /**
85
55
  * Get a fresh list from backend of clients for all the participants of the conversation.
86
56
  * This is a hacky way of getting all the clients for a conversation.
@@ -26,7 +26,6 @@ const protocol_messaging_1 = require("@wireapp/protocol-messaging");
26
26
  const conversation_2 = require("../../conversation/");
27
27
  const AssetCryptography_1 = require("../../cryptography/AssetCryptography");
28
28
  const TypePredicateUtil_1 = require("../../util/TypePredicateUtil");
29
- const MessageBuilder_1 = require("../message/MessageBuilder");
30
29
  const MessageService_1 = require("../message/MessageService");
31
30
  const ConversationService_types_1 = require("./ConversationService.types");
32
31
  const bazinga64_1 = require("bazinga64");
@@ -124,15 +123,6 @@ class ConversationService {
124
123
  return bundleMap;
125
124
  }, {});
126
125
  }
127
- async getSelfConversationId() {
128
- if (!this.selfConversationId) {
129
- const { userId } = this.apiClient.context;
130
- const { qualified_id, id } = await this.apiClient.api.conversation.getConversation(userId);
131
- const domain = this.config.useQualifiedIds ? qualified_id.domain : '';
132
- this.selfConversationId = { id, domain };
133
- }
134
- return this.selfConversationId;
135
- }
136
126
  async getQualifiedRecipientsForConversation(conversationId, userIds) {
137
127
  if ((0, TypePredicateUtil_1.isQualifiedUserClients)(userIds)) {
138
128
  return userIds;
@@ -219,76 +209,6 @@ class ConversationService {
219
209
  }
220
210
  return userIds;
221
211
  }
222
- async clearConversation(conversationId, timestamp = new Date(), messageId = (0, MessageBuilder_1.createId)(), sendAsProtobuf) {
223
- if (timestamp instanceof Date) {
224
- timestamp = timestamp.getTime();
225
- }
226
- const content = {
227
- clearedTimestamp: timestamp,
228
- conversationId,
229
- };
230
- const clearedMessage = protocol_messaging_1.Cleared.create(content);
231
- const genericMessage = protocol_messaging_1.GenericMessage.create({
232
- [conversation_2.GenericMessageType.CLEARED]: clearedMessage,
233
- messageId,
234
- });
235
- const selfConversationId = await this.getSelfConversationId();
236
- await this.sendGenericMessage(selfConversationId, this.apiClient.validatedClientId, genericMessage, {
237
- sendAsProtobuf,
238
- });
239
- return {
240
- content,
241
- conversation: conversationId,
242
- from: this.apiClient.context.userId,
243
- id: messageId,
244
- messageTimer: 0,
245
- source: conversation_2.PayloadBundleSource.LOCAL,
246
- state: conversation_2.PayloadBundleState.OUTGOING_SENT,
247
- timestamp: Date.now(),
248
- type: conversation_2.PayloadBundleType.CONVERSATION_CLEAR,
249
- };
250
- }
251
- /**
252
- * Sends a LastRead message to the current user's self conversation.
253
- * This will allow all the user's devices to compute which messages are unread
254
- *
255
- * @param conversationId The conversation which has been read
256
- * @param lastReadTimestamp The timestamp at which the conversation was read
257
- * @param sendingOptions?
258
- * @return Resolves when the message has been sent
259
- */
260
- async sendLastRead(conversationId, lastReadTimestamp, sendingOptions) {
261
- const lastRead = new protocol_messaging_1.LastRead({
262
- conversationId: conversationId.id,
263
- lastReadTimestamp,
264
- });
265
- const genericMessage = protocol_messaging_1.GenericMessage.create({
266
- [conversation_2.GenericMessageType.LAST_READ]: lastRead,
267
- messageId: (0, MessageBuilder_1.createId)(),
268
- });
269
- const selfConversationId = await this.getSelfConversationId();
270
- return this.sendGenericMessage(selfConversationId, this.apiClient.validatedClientId, genericMessage, Object.assign({}, sendingOptions));
271
- }
272
- /**
273
- * Syncs all self user's devices with the countly id
274
- *
275
- * @param countlyId The countly id of the current device
276
- * @param sendingOptions?
277
- * @return Resolves when the message has been sent
278
- */
279
- async sendCountlySync(countlyId, sendingOptions) {
280
- const dataTransfer = new protocol_messaging_1.DataTransfer({
281
- trackingIdentifier: {
282
- identifier: countlyId,
283
- },
284
- });
285
- const genericMessage = new protocol_messaging_1.GenericMessage({
286
- [conversation_2.GenericMessageType.DATA_TRANSFER]: dataTransfer,
287
- messageId: (0, MessageBuilder_1.createId)(),
288
- });
289
- const selfConversationId = await this.getSelfConversationId();
290
- return this.sendGenericMessage(selfConversationId, this.apiClient.validatedClientId, genericMessage, Object.assign({}, sendingOptions));
291
- }
292
212
  /**
293
213
  * Get a fresh list from backend of clients for all the participants of the conversation.
294
214
  * This is a hacky way of getting all the clients for a conversation.
@@ -1,5 +1,6 @@
1
1
  import { ButtonActionConfirmationMessage, ButtonActionMessage, CallMessage, ConfirmationMessage, DeleteMessage, EditedTextMessage, FileAssetAbortMessage, FileAssetMessage, FileAssetMetaDataMessage, HideMessage, ImageAssetMessageOutgoing, LocationMessage, PingMessage, ReactionMessage, TextMessage } from './OtrMessage';
2
2
  import { IComposite, GenericMessage } from '@wireapp/protocol-messaging';
3
+ import { QualifiedId } from '@wireapp/api-client/src/user';
3
4
  export declare function createId(): string;
4
5
  export declare function buildButtonActionMessage(payloadBundle: ButtonActionMessage['content']): GenericMessage;
5
6
  export declare function buildButtonActionConfirmationMessage(payloadBundle: ButtonActionConfirmationMessage['content']): GenericMessage;
@@ -9,6 +10,9 @@ export declare function buildEditedTextMessage(payloadBundle: EditedTextMessage[
9
10
  export declare function buildFileDataMessage(payloadBundle: FileAssetMessage['content'], messageId?: string): GenericMessage;
10
11
  export declare function buildFileMetaDataMessage(payloadBundle: FileAssetMetaDataMessage['content']): GenericMessage;
11
12
  export declare function buildFileAbortMessage(payloadBundle: FileAssetAbortMessage['content'], messageId?: string): GenericMessage;
13
+ export declare function buildLastReadMessage(conversationId: QualifiedId, lastReadTimestamp: number): GenericMessage;
14
+ export declare function buildDataTransferMessage(identifier: string): GenericMessage;
15
+ export declare function buildClearedMessage(conversationId: QualifiedId, timestamp?: number): GenericMessage;
12
16
  export declare function buildImageMessage(payloadBundle: ImageAssetMessageOutgoing['content'], messageId?: string): GenericMessage;
13
17
  export declare function buildLocationMessage(payloadBundle: LocationMessage['content']): GenericMessage;
14
18
  export declare function buildPingMessage(payloadBundle: PingMessage['content']): GenericMessage;
@@ -21,7 +21,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
21
21
  return (mod && mod.__esModule) ? mod : { "default": mod };
22
22
  };
23
23
  Object.defineProperty(exports, "__esModule", { value: true });
24
- exports.wrapInEphemeral = exports.buildTextMessage = exports.buildHideMessage = exports.buildDeleteMessage = exports.buildCallMessage = exports.buildSessionResetMessage = exports.buildReactionMessage = exports.buildPingMessage = exports.buildLocationMessage = exports.buildImageMessage = exports.buildFileAbortMessage = exports.buildFileMetaDataMessage = exports.buildFileDataMessage = exports.buildEditedTextMessage = exports.buildConfirmationMessage = exports.buildCompositeMessage = exports.buildButtonActionConfirmationMessage = exports.buildButtonActionMessage = exports.createId = void 0;
24
+ exports.wrapInEphemeral = exports.buildTextMessage = exports.buildHideMessage = exports.buildDeleteMessage = exports.buildCallMessage = exports.buildSessionResetMessage = exports.buildReactionMessage = exports.buildPingMessage = exports.buildLocationMessage = exports.buildImageMessage = exports.buildClearedMessage = exports.buildDataTransferMessage = exports.buildLastReadMessage = exports.buildFileAbortMessage = exports.buildFileMetaDataMessage = exports.buildFileDataMessage = exports.buildEditedTextMessage = exports.buildConfirmationMessage = exports.buildCompositeMessage = exports.buildButtonActionConfirmationMessage = exports.buildButtonActionMessage = exports.createId = void 0;
25
25
  const uuidjs_1 = __importDefault(require("uuidjs"));
26
26
  const protocol_messaging_1 = require("@wireapp/protocol-messaging");
27
27
  const MessageToProtoMapper_1 = require("../message/MessageToProtoMapper");
@@ -130,6 +130,40 @@ function buildFileAbortMessage(payloadBundle, messageId = createId()) {
130
130
  return genericMessage;
131
131
  }
132
132
  exports.buildFileAbortMessage = buildFileAbortMessage;
133
+ function buildLastReadMessage(conversationId, lastReadTimestamp) {
134
+ const lastRead = new protocol_messaging_1.LastRead({
135
+ conversationId: conversationId.id,
136
+ lastReadTimestamp,
137
+ });
138
+ return protocol_messaging_1.GenericMessage.create({
139
+ [GenericMessageType_1.GenericMessageType.LAST_READ]: lastRead,
140
+ messageId: createId(),
141
+ });
142
+ }
143
+ exports.buildLastReadMessage = buildLastReadMessage;
144
+ function buildDataTransferMessage(identifier) {
145
+ const dataTransfer = new protocol_messaging_1.DataTransfer({
146
+ trackingIdentifier: {
147
+ identifier,
148
+ },
149
+ });
150
+ return new protocol_messaging_1.GenericMessage({
151
+ [GenericMessageType_1.GenericMessageType.DATA_TRANSFER]: dataTransfer,
152
+ messageId: createId(),
153
+ });
154
+ }
155
+ exports.buildDataTransferMessage = buildDataTransferMessage;
156
+ function buildClearedMessage(conversationId, timestamp = Date.now()) {
157
+ const clearedMessage = protocol_messaging_1.Cleared.create({
158
+ clearedTimestamp: timestamp,
159
+ conversationId: conversationId.id,
160
+ });
161
+ return protocol_messaging_1.GenericMessage.create({
162
+ [GenericMessageType_1.GenericMessageType.CLEARED]: clearedMessage,
163
+ messageId: createId(),
164
+ });
165
+ }
166
+ exports.buildClearedMessage = buildClearedMessage;
133
167
  function buildImageMessage(payloadBundle, messageId = createId()) {
134
168
  const imageAsset = buildAsset(payloadBundle);
135
169
  const genericMessage = protocol_messaging_1.GenericMessage.create({