@wireapp/core 32.0.4 → 32.0.5
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 +3 -3
- package/src/main/Account.js +1 -0
- package/src/main/conversation/ConversationMapper/ConversationMapper.js +1 -1
- package/src/main/conversation/ConversationService/ConversationService.d.ts +16 -7
- package/src/main/conversation/ConversationService/ConversationService.js +36 -45
- package/src/main/conversation/ConversationService/ConversationService.types.d.ts +5 -17
- package/src/main/conversation/message/CompositeContentBuilder.js +1 -1
- package/src/main/conversation/message/MessageBuilder.d.ts +21 -96
- package/src/main/conversation/message/MessageBuilder.js +238 -100
- package/src/main/conversation/message/MessageService.d.ts +1 -1
- package/src/main/conversation/message/MessageService.js +3 -3
- package/src/main/conversation/message/MessageToProtoMapper.d.ts +1 -1
- package/src/main/conversation/message/MessageToProtoMapper.js +1 -1
- package/src/main/conversation/message/TextContentBuilder.d.ts +10 -11
- package/src/main/conversation/message/TextContentBuilder.js +3 -5
- package/src/main/conversation/message/messageSender.d.ts +1 -0
- package/src/main/conversation/message/messageSender.js +5 -1
- package/src/main/index.d.ts +7 -17
- package/src/main/index.js +12 -16
- package/src/main/user/UserMapper.js +4 -4
- package/src/main/user/UserService.js +3 -1
- package/src/main/account/AccountService.js.map +0 -1
- package/src/main/account/AccountService.ts +0 -31
- package/src/main/account/index.js.map +0 -1
- package/src/main/account/index.ts +0 -20
- package/src/main/conversation/ConversationService/messageGenerator.d.ts +0 -9
- package/src/main/conversation/ConversationService/messageGenerator.js +0 -313
|
@@ -21,105 +21,243 @@ 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.
|
|
25
|
-
const protocol_messaging_1 = require("@wireapp/protocol-messaging");
|
|
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;
|
|
26
25
|
const uuidjs_1 = __importDefault(require("uuidjs"));
|
|
27
|
-
const
|
|
28
|
-
const
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
26
|
+
const protocol_messaging_1 = require("@wireapp/protocol-messaging");
|
|
27
|
+
const MessageToProtoMapper_1 = require("../message/MessageToProtoMapper");
|
|
28
|
+
const GenericMessageType_1 = require("../GenericMessageType");
|
|
29
|
+
const AssetTransferState_1 = require("../AssetTransferState");
|
|
30
|
+
function createId() {
|
|
31
|
+
return uuidjs_1.default.genV4().toString();
|
|
32
|
+
}
|
|
33
|
+
exports.createId = createId;
|
|
34
|
+
function buildButtonActionMessage(payloadBundle) {
|
|
35
|
+
return protocol_messaging_1.GenericMessage.create({
|
|
36
|
+
[GenericMessageType_1.GenericMessageType.BUTTON_ACTION]: protocol_messaging_1.ButtonAction.create(payloadBundle),
|
|
37
|
+
messageId: createId(),
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
exports.buildButtonActionMessage = buildButtonActionMessage;
|
|
41
|
+
function buildButtonActionConfirmationMessage(payloadBundle) {
|
|
42
|
+
return protocol_messaging_1.GenericMessage.create({
|
|
43
|
+
[GenericMessageType_1.GenericMessageType.BUTTON_ACTION_CONFIRMATION]: protocol_messaging_1.ButtonActionConfirmation.create(payloadBundle),
|
|
44
|
+
messageId: createId(),
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
exports.buildButtonActionConfirmationMessage = buildButtonActionConfirmationMessage;
|
|
48
|
+
function buildCompositeMessage(payload) {
|
|
49
|
+
return protocol_messaging_1.GenericMessage.create({
|
|
50
|
+
[GenericMessageType_1.GenericMessageType.COMPOSITE]: protocol_messaging_1.Composite.create(payload),
|
|
51
|
+
messageId: createId(),
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
exports.buildCompositeMessage = buildCompositeMessage;
|
|
55
|
+
function buildConfirmationMessage(payloadBundle) {
|
|
56
|
+
const content = protocol_messaging_1.Confirmation.create(payloadBundle);
|
|
57
|
+
return protocol_messaging_1.GenericMessage.create({
|
|
58
|
+
[GenericMessageType_1.GenericMessageType.CONFIRMATION]: content,
|
|
59
|
+
messageId: createId(),
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
exports.buildConfirmationMessage = buildConfirmationMessage;
|
|
63
|
+
function buildEditedTextMessage(payloadBundle, messageId = createId()) {
|
|
64
|
+
const editedMessage = protocol_messaging_1.MessageEdit.create({
|
|
65
|
+
replacingMessageId: payloadBundle.originalMessageId,
|
|
66
|
+
text: MessageToProtoMapper_1.MessageToProtoMapper.mapText(payloadBundle),
|
|
67
|
+
});
|
|
68
|
+
return protocol_messaging_1.GenericMessage.create({
|
|
69
|
+
[GenericMessageType_1.GenericMessageType.EDITED]: editedMessage,
|
|
70
|
+
messageId,
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
exports.buildEditedTextMessage = buildEditedTextMessage;
|
|
74
|
+
function buildFileDataMessage(payloadBundle, messageId = createId()) {
|
|
75
|
+
const { asset, expectsReadConfirmation, legalHoldStatus } = payloadBundle;
|
|
76
|
+
const remoteData = protocol_messaging_1.Asset.RemoteData.create({
|
|
77
|
+
assetId: asset.key,
|
|
78
|
+
assetToken: asset.token,
|
|
79
|
+
otrKey: asset.keyBytes,
|
|
80
|
+
sha256: asset.sha256,
|
|
81
|
+
assetDomain: asset.domain,
|
|
82
|
+
});
|
|
83
|
+
const assetMessage = protocol_messaging_1.Asset.create({
|
|
84
|
+
expectsReadConfirmation,
|
|
85
|
+
legalHoldStatus,
|
|
86
|
+
uploaded: remoteData,
|
|
87
|
+
});
|
|
88
|
+
assetMessage.status = AssetTransferState_1.AssetTransferState.UPLOADED;
|
|
89
|
+
const genericMessage = protocol_messaging_1.GenericMessage.create({
|
|
90
|
+
[GenericMessageType_1.GenericMessageType.ASSET]: assetMessage,
|
|
91
|
+
messageId,
|
|
92
|
+
});
|
|
93
|
+
return genericMessage;
|
|
94
|
+
}
|
|
95
|
+
exports.buildFileDataMessage = buildFileDataMessage;
|
|
96
|
+
function buildFileMetaDataMessage(payloadBundle) {
|
|
97
|
+
const { expectsReadConfirmation, legalHoldStatus, metaData } = payloadBundle;
|
|
98
|
+
const original = protocol_messaging_1.Asset.Original.create({
|
|
99
|
+
audio: metaData.audio,
|
|
100
|
+
mimeType: metaData.type,
|
|
101
|
+
name: metaData.name,
|
|
102
|
+
size: metaData.length,
|
|
103
|
+
video: metaData.video,
|
|
104
|
+
image: metaData.image,
|
|
105
|
+
});
|
|
106
|
+
const assetMessage = protocol_messaging_1.Asset.create({
|
|
107
|
+
expectsReadConfirmation,
|
|
108
|
+
legalHoldStatus,
|
|
109
|
+
original,
|
|
110
|
+
});
|
|
111
|
+
const genericMessage = protocol_messaging_1.GenericMessage.create({
|
|
112
|
+
[GenericMessageType_1.GenericMessageType.ASSET]: assetMessage,
|
|
113
|
+
messageId: createId(),
|
|
114
|
+
});
|
|
115
|
+
return genericMessage;
|
|
116
|
+
}
|
|
117
|
+
exports.buildFileMetaDataMessage = buildFileMetaDataMessage;
|
|
118
|
+
function buildFileAbortMessage(payloadBundle, messageId = createId()) {
|
|
119
|
+
const { expectsReadConfirmation, legalHoldStatus, reason } = payloadBundle;
|
|
120
|
+
const assetMessage = protocol_messaging_1.Asset.create({
|
|
121
|
+
expectsReadConfirmation,
|
|
122
|
+
legalHoldStatus,
|
|
123
|
+
notUploaded: reason,
|
|
124
|
+
});
|
|
125
|
+
assetMessage.status = AssetTransferState_1.AssetTransferState.NOT_UPLOADED;
|
|
126
|
+
const genericMessage = protocol_messaging_1.GenericMessage.create({
|
|
127
|
+
[GenericMessageType_1.GenericMessageType.ASSET]: assetMessage,
|
|
128
|
+
messageId,
|
|
129
|
+
});
|
|
130
|
+
return genericMessage;
|
|
131
|
+
}
|
|
132
|
+
exports.buildFileAbortMessage = buildFileAbortMessage;
|
|
133
|
+
function buildImageMessage(payloadBundle, messageId = createId()) {
|
|
134
|
+
const imageAsset = buildAsset(payloadBundle);
|
|
135
|
+
const genericMessage = protocol_messaging_1.GenericMessage.create({
|
|
136
|
+
[GenericMessageType_1.GenericMessageType.ASSET]: imageAsset,
|
|
137
|
+
messageId,
|
|
138
|
+
});
|
|
139
|
+
return genericMessage;
|
|
140
|
+
}
|
|
141
|
+
exports.buildImageMessage = buildImageMessage;
|
|
142
|
+
function buildLocationMessage(payloadBundle) {
|
|
143
|
+
const { expectsReadConfirmation, latitude, legalHoldStatus, longitude, name, zoom } = payloadBundle;
|
|
144
|
+
const locationMessage = protocol_messaging_1.Location.create({
|
|
145
|
+
expectsReadConfirmation,
|
|
146
|
+
latitude,
|
|
147
|
+
legalHoldStatus,
|
|
148
|
+
longitude,
|
|
149
|
+
name,
|
|
150
|
+
zoom,
|
|
151
|
+
});
|
|
152
|
+
const genericMessage = protocol_messaging_1.GenericMessage.create({
|
|
153
|
+
[GenericMessageType_1.GenericMessageType.LOCATION]: locationMessage,
|
|
154
|
+
messageId: createId(),
|
|
155
|
+
});
|
|
156
|
+
return genericMessage;
|
|
157
|
+
}
|
|
158
|
+
exports.buildLocationMessage = buildLocationMessage;
|
|
159
|
+
function buildPingMessage(payloadBundle) {
|
|
160
|
+
const content = protocol_messaging_1.Knock.create(payloadBundle);
|
|
161
|
+
const genericMessage = protocol_messaging_1.GenericMessage.create({
|
|
162
|
+
[GenericMessageType_1.GenericMessageType.KNOCK]: content,
|
|
163
|
+
messageId: createId(),
|
|
164
|
+
});
|
|
165
|
+
return genericMessage;
|
|
166
|
+
}
|
|
167
|
+
exports.buildPingMessage = buildPingMessage;
|
|
168
|
+
function buildReactionMessage(payloadBundle) {
|
|
169
|
+
const { legalHoldStatus, originalMessageId, type } = payloadBundle;
|
|
170
|
+
const reaction = protocol_messaging_1.Reaction.create({
|
|
171
|
+
emoji: type,
|
|
172
|
+
legalHoldStatus,
|
|
173
|
+
messageId: originalMessageId,
|
|
174
|
+
});
|
|
175
|
+
const genericMessage = protocol_messaging_1.GenericMessage.create({
|
|
176
|
+
[GenericMessageType_1.GenericMessageType.REACTION]: reaction,
|
|
177
|
+
messageId: createId(),
|
|
178
|
+
});
|
|
179
|
+
return genericMessage;
|
|
180
|
+
}
|
|
181
|
+
exports.buildReactionMessage = buildReactionMessage;
|
|
182
|
+
function buildSessionResetMessage() {
|
|
183
|
+
return protocol_messaging_1.GenericMessage.create({
|
|
184
|
+
[GenericMessageType_1.GenericMessageType.CLIENT_ACTION]: protocol_messaging_1.ClientAction.RESET_SESSION,
|
|
185
|
+
messageId: createId(),
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
exports.buildSessionResetMessage = buildSessionResetMessage;
|
|
189
|
+
function buildCallMessage(payloadBundle) {
|
|
190
|
+
const callMessage = protocol_messaging_1.Calling.create({
|
|
191
|
+
content: payloadBundle,
|
|
192
|
+
});
|
|
193
|
+
return protocol_messaging_1.GenericMessage.create({
|
|
194
|
+
[GenericMessageType_1.GenericMessageType.CALLING]: callMessage,
|
|
195
|
+
messageId: createId(),
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
exports.buildCallMessage = buildCallMessage;
|
|
199
|
+
function buildDeleteMessage(payload) {
|
|
200
|
+
const content = protocol_messaging_1.MessageDelete.create(payload);
|
|
201
|
+
return protocol_messaging_1.GenericMessage.create({
|
|
202
|
+
[GenericMessageType_1.GenericMessageType.DELETED]: content,
|
|
203
|
+
messageId: createId(),
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
exports.buildDeleteMessage = buildDeleteMessage;
|
|
207
|
+
function buildHideMessage(payload) {
|
|
208
|
+
const content = protocol_messaging_1.MessageHide.create(payload);
|
|
209
|
+
return protocol_messaging_1.GenericMessage.create({
|
|
210
|
+
[GenericMessageType_1.GenericMessageType.HIDDEN]: content,
|
|
211
|
+
messageId: createId(),
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
exports.buildHideMessage = buildHideMessage;
|
|
215
|
+
function buildTextMessage(payloadBundle, messageId = createId()) {
|
|
216
|
+
const genericMessage = protocol_messaging_1.GenericMessage.create({
|
|
217
|
+
messageId,
|
|
218
|
+
[GenericMessageType_1.GenericMessageType.TEXT]: MessageToProtoMapper_1.MessageToProtoMapper.mapText(payloadBundle),
|
|
219
|
+
});
|
|
220
|
+
return genericMessage;
|
|
221
|
+
}
|
|
222
|
+
exports.buildTextMessage = buildTextMessage;
|
|
223
|
+
function buildAsset(payloadBundle) {
|
|
224
|
+
const { asset, expectsReadConfirmation, image, legalHoldStatus } = payloadBundle;
|
|
225
|
+
const imageMetadata = protocol_messaging_1.Asset.ImageMetaData.create({
|
|
226
|
+
height: image.height,
|
|
227
|
+
width: image.width,
|
|
228
|
+
});
|
|
229
|
+
const original = protocol_messaging_1.Asset.Original.create({
|
|
230
|
+
[GenericMessageType_1.GenericMessageType.IMAGE]: imageMetadata,
|
|
231
|
+
mimeType: image.type,
|
|
232
|
+
name: null,
|
|
233
|
+
size: image.data.length,
|
|
234
|
+
});
|
|
235
|
+
const remoteData = protocol_messaging_1.Asset.RemoteData.create({
|
|
236
|
+
assetId: asset.key,
|
|
237
|
+
assetToken: asset.token,
|
|
238
|
+
assetDomain: asset.domain,
|
|
239
|
+
otrKey: asset.keyBytes,
|
|
240
|
+
sha256: asset.sha256,
|
|
241
|
+
});
|
|
242
|
+
const assetMessage = protocol_messaging_1.Asset.create({
|
|
243
|
+
expectsReadConfirmation,
|
|
244
|
+
legalHoldStatus,
|
|
245
|
+
original,
|
|
246
|
+
uploaded: remoteData,
|
|
247
|
+
});
|
|
248
|
+
assetMessage.status = AssetTransferState_1.AssetTransferState.UPLOADED;
|
|
249
|
+
return assetMessage;
|
|
250
|
+
}
|
|
251
|
+
function wrapInEphemeral(originalGenericMessage, expireAfterMillis) {
|
|
252
|
+
const ephemeralMessage = protocol_messaging_1.Ephemeral.create({
|
|
253
|
+
expireAfterMillis,
|
|
254
|
+
[originalGenericMessage.content]: originalGenericMessage[originalGenericMessage.content],
|
|
255
|
+
});
|
|
256
|
+
const genericMessage = protocol_messaging_1.GenericMessage.create({
|
|
257
|
+
[GenericMessageType_1.GenericMessageType.EPHEMERAL]: ephemeralMessage,
|
|
258
|
+
messageId: originalGenericMessage.messageId,
|
|
259
|
+
});
|
|
260
|
+
return genericMessage;
|
|
261
|
+
}
|
|
262
|
+
exports.wrapInEphemeral = wrapInEphemeral;
|
|
125
263
|
//# sourceMappingURL=MessageBuilder.js.map
|
|
@@ -19,7 +19,7 @@ export declare class MessageService {
|
|
|
19
19
|
* @return the ClientMismatch status returned by the backend
|
|
20
20
|
*/
|
|
21
21
|
sendMessage(sendingClientId: string, recipients: UserClients | UserPreKeyBundleMap, plainText: Uint8Array, options?: {
|
|
22
|
-
conversationId?:
|
|
22
|
+
conversationId?: QualifiedId;
|
|
23
23
|
reportMissing?: boolean | string[];
|
|
24
24
|
sendAsProtobuf?: boolean;
|
|
25
25
|
nativePush?: boolean;
|
|
@@ -184,12 +184,12 @@ class MessageService {
|
|
|
184
184
|
}
|
|
185
185
|
return !options.conversationId
|
|
186
186
|
? this.apiClient.api.broadcast.postBroadcastMessage(sendingClientId, message, ignoreMissing)
|
|
187
|
-
: this.apiClient.api.conversation.postOTRMessage(sendingClientId, options.conversationId, message, ignoreMissing);
|
|
187
|
+
: this.apiClient.api.conversation.postOTRMessage(sendingClientId, options.conversationId.id, message, ignoreMissing);
|
|
188
188
|
}
|
|
189
189
|
async generateExternalPayload(plainText) {
|
|
190
190
|
const asset = await (0, AssetCryptography_1.encryptAsset)({ plainText });
|
|
191
191
|
const { cipherText, keyBytes, sha256 } = asset;
|
|
192
|
-
const messageId = MessageBuilder_1.
|
|
192
|
+
const messageId = (0, MessageBuilder_1.createId)();
|
|
193
193
|
const externalMessage = {
|
|
194
194
|
otrKey: new Uint8Array(keyBytes),
|
|
195
195
|
sha256: new Uint8Array(sha256),
|
|
@@ -286,7 +286,7 @@ class MessageService {
|
|
|
286
286
|
}
|
|
287
287
|
return !options.conversationId
|
|
288
288
|
? this.apiClient.api.broadcast.postBroadcastProtobufMessage(sendingClientId, protoMessage, ignoreMissing)
|
|
289
|
-
: this.apiClient.api.conversation.postOTRProtobufMessage(sendingClientId, options.conversationId, protoMessage, ignoreMissing);
|
|
289
|
+
: this.apiClient.api.conversation.postOTRProtobufMessage(sendingClientId, options.conversationId.id, protoMessage, ignoreMissing);
|
|
290
290
|
}
|
|
291
291
|
}
|
|
292
292
|
exports.MessageService = MessageService;
|
|
@@ -3,5 +3,5 @@ import { LinkPreviewUploadedContent } from '../content';
|
|
|
3
3
|
import { EditedTextMessage, TextMessage } from './OtrMessage';
|
|
4
4
|
export declare class MessageToProtoMapper {
|
|
5
5
|
static mapLinkPreviews(linkPreviews: LinkPreviewUploadedContent[]): LinkPreview[];
|
|
6
|
-
static mapText(payloadBundle: TextMessage | EditedTextMessage): Text;
|
|
6
|
+
static mapText(payloadBundle: TextMessage['content'] | EditedTextMessage['content']): Text;
|
|
7
7
|
}
|
|
@@ -74,7 +74,7 @@ class MessageToProtoMapper {
|
|
|
74
74
|
return builtLinkPreviews;
|
|
75
75
|
}
|
|
76
76
|
static mapText(payloadBundle) {
|
|
77
|
-
const { expectsReadConfirmation, legalHoldStatus, linkPreviews, mentions, quote, text } = payloadBundle
|
|
77
|
+
const { expectsReadConfirmation, legalHoldStatus, linkPreviews, mentions, quote, text } = payloadBundle;
|
|
78
78
|
const textMessage = protocol_messaging_1.Text.create({
|
|
79
79
|
content: text,
|
|
80
80
|
expectsReadConfirmation,
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import { LegalHoldStatus, LinkPreviewUploadedContent, MentionContent, QuoteContent } from '../content';
|
|
2
|
-
import {
|
|
3
|
-
export declare class TextContentBuilder {
|
|
1
|
+
import { EditedTextContent, LegalHoldStatus, LinkPreviewUploadedContent, MentionContent, QuoteContent, TextContent } from '../content';
|
|
2
|
+
import { QuotableMessage } from './OtrMessage';
|
|
3
|
+
export declare class TextContentBuilder<T extends TextContent | EditedTextContent> {
|
|
4
4
|
private readonly content;
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
withLegalHoldStatus(legalHoldStatus?: LegalHoldStatus): TextContentBuilder;
|
|
5
|
+
constructor(textContent: T);
|
|
6
|
+
build(): T;
|
|
7
|
+
withLinkPreviews(linkPreviews?: LinkPreviewUploadedContent[]): this;
|
|
8
|
+
withMentions(mentions?: MentionContent[]): this;
|
|
9
|
+
withQuote(quote?: QuotableMessage | QuoteContent): this;
|
|
10
|
+
withReadConfirmation(expectsReadConfirmation?: boolean): this;
|
|
11
|
+
withLegalHoldStatus(legalHoldStatus?: LegalHoldStatus): this;
|
|
13
12
|
}
|
|
@@ -22,13 +22,11 @@ exports.TextContentBuilder = void 0;
|
|
|
22
22
|
const cryptography_1 = require("../../cryptography");
|
|
23
23
|
const content_1 = require("../content");
|
|
24
24
|
class TextContentBuilder {
|
|
25
|
-
constructor(
|
|
26
|
-
this.
|
|
27
|
-
this.content = this.payloadBundle.content;
|
|
25
|
+
constructor(textContent) {
|
|
26
|
+
this.content = textContent;
|
|
28
27
|
}
|
|
29
28
|
build() {
|
|
30
|
-
|
|
31
|
-
return this.payloadBundle;
|
|
29
|
+
return this.content;
|
|
32
30
|
}
|
|
33
31
|
withLinkPreviews(linkPreviews) {
|
|
34
32
|
if (linkPreviews === null || linkPreviews === void 0 ? void 0 : linkPreviews.length) {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Task } from '@wireapp/promise-queue';
|
|
2
2
|
export declare function sendMessage<T>(sendingFunction: Task<T>): Promise<T>;
|
|
3
|
+
export declare function getQueueLength(): number;
|
|
3
4
|
export declare function resumeMessageSending(): void;
|
|
4
5
|
export declare function pauseMessageSending(): void;
|
|
@@ -18,13 +18,17 @@
|
|
|
18
18
|
*
|
|
19
19
|
*/
|
|
20
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
-
exports.pauseMessageSending = exports.resumeMessageSending = exports.sendMessage = void 0;
|
|
21
|
+
exports.pauseMessageSending = exports.resumeMessageSending = exports.getQueueLength = exports.sendMessage = void 0;
|
|
22
22
|
const promise_queue_1 = require("@wireapp/promise-queue");
|
|
23
23
|
const sendingQueue = new promise_queue_1.PromiseQueue({ name: 'message-sender', paused: true });
|
|
24
24
|
function sendMessage(sendingFunction) {
|
|
25
25
|
return sendingQueue.push(sendingFunction);
|
|
26
26
|
}
|
|
27
27
|
exports.sendMessage = sendMessage;
|
|
28
|
+
function getQueueLength() {
|
|
29
|
+
return sendingQueue.getLength();
|
|
30
|
+
}
|
|
31
|
+
exports.getQueueLength = getQueueLength;
|
|
28
32
|
function resumeMessageSending() {
|
|
29
33
|
sendingQueue.pause(false);
|
|
30
34
|
}
|
package/src/main/index.d.ts
CHANGED
|
@@ -1,17 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
declare const _default: {
|
|
9
|
-
Account: typeof Account;
|
|
10
|
-
MessageBuilder: typeof MessageBuilder;
|
|
11
|
-
CoreError: typeof CoreError;
|
|
12
|
-
auth: typeof auth;
|
|
13
|
-
conversation: typeof conversation;
|
|
14
|
-
cryptography: typeof cryptography;
|
|
15
|
-
util: typeof util;
|
|
16
|
-
};
|
|
17
|
-
export = _default;
|
|
1
|
+
export { Account, ConnectionState, ProcessedEventPayload } from './Account';
|
|
2
|
+
export * as auth from './auth/';
|
|
3
|
+
export * as conversation from './conversation/';
|
|
4
|
+
export { CoreError } from './CoreError';
|
|
5
|
+
export * as cryptography from './cryptography/';
|
|
6
|
+
export * as util from './util';
|
|
7
|
+
export * as MessageBuilder from './conversation/message/MessageBuilder';
|
package/src/main/index.js
CHANGED
|
@@ -40,20 +40,16 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
40
40
|
__setModuleDefault(result, mod);
|
|
41
41
|
return result;
|
|
42
42
|
};
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
conversation,
|
|
56
|
-
cryptography,
|
|
57
|
-
util,
|
|
58
|
-
};
|
|
43
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
44
|
+
exports.MessageBuilder = exports.util = exports.cryptography = exports.CoreError = exports.conversation = exports.auth = exports.ConnectionState = exports.Account = void 0;
|
|
45
|
+
var Account_1 = require("./Account");
|
|
46
|
+
Object.defineProperty(exports, "Account", { enumerable: true, get: function () { return Account_1.Account; } });
|
|
47
|
+
Object.defineProperty(exports, "ConnectionState", { enumerable: true, get: function () { return Account_1.ConnectionState; } });
|
|
48
|
+
exports.auth = __importStar(require("./auth/"));
|
|
49
|
+
exports.conversation = __importStar(require("./conversation/"));
|
|
50
|
+
var CoreError_1 = require("./CoreError");
|
|
51
|
+
Object.defineProperty(exports, "CoreError", { enumerable: true, get: function () { return CoreError_1.CoreError; } });
|
|
52
|
+
exports.cryptography = __importStar(require("./cryptography/"));
|
|
53
|
+
exports.util = __importStar(require("./util"));
|
|
54
|
+
exports.MessageBuilder = __importStar(require("./conversation/message/MessageBuilder"));
|
|
59
55
|
//# sourceMappingURL=index.js.map
|
|
@@ -31,7 +31,7 @@ class UserMapper {
|
|
|
31
31
|
content: { connection, user },
|
|
32
32
|
conversation: connection.conversation,
|
|
33
33
|
from: connection.from,
|
|
34
|
-
id: MessageBuilder_1.
|
|
34
|
+
id: (0, MessageBuilder_1.createId)(),
|
|
35
35
|
messageTimer: 0,
|
|
36
36
|
source,
|
|
37
37
|
state: conversation_1.PayloadBundleState.INCOMING,
|
|
@@ -45,7 +45,7 @@ class UserMapper {
|
|
|
45
45
|
content: { client },
|
|
46
46
|
conversation: selfUserId,
|
|
47
47
|
from: selfUserId,
|
|
48
|
-
id: MessageBuilder_1.
|
|
48
|
+
id: (0, MessageBuilder_1.createId)(),
|
|
49
49
|
messageTimer: 0,
|
|
50
50
|
source,
|
|
51
51
|
state: conversation_1.PayloadBundleState.INCOMING,
|
|
@@ -59,7 +59,7 @@ class UserMapper {
|
|
|
59
59
|
content: { user },
|
|
60
60
|
conversation: selfUserId,
|
|
61
61
|
from: selfUserId,
|
|
62
|
-
id: MessageBuilder_1.
|
|
62
|
+
id: (0, MessageBuilder_1.createId)(),
|
|
63
63
|
source,
|
|
64
64
|
state: conversation_1.PayloadBundleState.INCOMING,
|
|
65
65
|
timestamp: new Date().getTime(),
|
|
@@ -72,7 +72,7 @@ class UserMapper {
|
|
|
72
72
|
content: { client },
|
|
73
73
|
conversation: selfUserId,
|
|
74
74
|
from: selfUserId,
|
|
75
|
-
id: MessageBuilder_1.
|
|
75
|
+
id: (0, MessageBuilder_1.createId)(),
|
|
76
76
|
messageTimer: 0,
|
|
77
77
|
source,
|
|
78
78
|
state: conversation_1.PayloadBundleState.INCOMING,
|
|
@@ -62,7 +62,9 @@ class UserService {
|
|
|
62
62
|
userId: connection.to,
|
|
63
63
|
conversationId: connection.conversation,
|
|
64
64
|
};
|
|
65
|
-
return this.conversationService.getPreKeyBundleMap(mappedConnection.conversationId, [
|
|
65
|
+
return this.conversationService.getPreKeyBundleMap({ id: mappedConnection.conversationId, domain: '' }, [
|
|
66
|
+
mappedConnection.userId,
|
|
67
|
+
]);
|
|
66
68
|
});
|
|
67
69
|
const preKeyBundlesFromConnections = await Promise.all(preKeyBundlePromises);
|
|
68
70
|
// Merge pre-key bundles
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AccountService.js","sourceRoot":"","sources":["AccountService.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;GAiBG;;;AAGH,8CAAyC;AAGzC,MAAa,cAAc;IACzB,YAA6B,SAAoB;QAApB,cAAS,GAAT,SAAS,CAAW;IAAG,CAAC;IAErD,aAAa;QACX,MAAM,iBAAiB,GAAG,iBAAO,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QAC9D,OAAO,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,OAAO,CAAC,aAAa,CAAC,iBAAiB,CAAC,CAAC;IACrE,CAAC;CACF;AAPD,wCAOC"}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Wire
|
|
3
|
-
* Copyright (C) 2020 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 {Runtime} from '@wireapp/commons';
|
|
22
|
-
import {CallConfigData} from '@wireapp/api-client/src/account/CallConfigData';
|
|
23
|
-
|
|
24
|
-
export class AccountService {
|
|
25
|
-
constructor(private readonly apiClient: APIClient) {}
|
|
26
|
-
|
|
27
|
-
getCallConfig(): Promise<CallConfigData> {
|
|
28
|
-
const iceCandidateLimit = Runtime.isFirefox() ? 3 : undefined;
|
|
29
|
-
return this.apiClient.api.account.getCallConfig(iceCandidateLimit);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;GAiBG;;;;;;;;;;;;;;;;AAEH,mDAAiC"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Wire
|
|
3
|
-
* Copyright (C) 2020 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 './AccountService';
|