@twilio/conversations 2.1.0-rc.1 → 2.1.0-rc.8
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 +60 -0
- package/NOTICE.txt +679 -0
- package/builds/browser.js +674 -587
- package/builds/browser.js.map +1 -1
- package/builds/lib.d.ts +319 -122
- package/builds/lib.js +674 -587
- package/builds/lib.js.map +1 -1
- package/builds/twilio-conversations.js +852 -909
- package/builds/twilio-conversations.min.js +2 -14
- package/dist/aggregated-delivery-receipt.js +6 -1
- package/dist/aggregated-delivery-receipt.js.map +1 -1
- package/dist/client.js +165 -142
- package/dist/client.js.map +1 -1
- package/dist/command-executor.js +16 -14
- package/dist/command-executor.js.map +1 -1
- package/dist/configuration.js +14 -10
- package/dist/configuration.js.map +1 -1
- package/dist/conversation.js +212 -153
- package/dist/conversation.js.map +1 -1
- package/dist/data/conversations.js +81 -77
- package/dist/data/conversations.js.map +1 -1
- package/dist/data/messages.js +42 -38
- package/dist/data/messages.js.map +1 -1
- package/dist/data/participants.js +93 -75
- package/dist/data/participants.js.map +1 -1
- package/dist/data/users.js +24 -22
- package/dist/data/users.js.map +1 -1
- package/dist/detailed-delivery-receipt.js +1 -1
- package/dist/detailed-delivery-receipt.js.map +1 -1
- package/dist/interfaces/attributes.js +4 -4
- package/dist/interfaces/attributes.js.map +1 -1
- package/dist/interfaces/notification-types.js +5 -5
- package/dist/interfaces/notification-types.js.map +1 -1
- package/dist/logger.js +36 -15
- package/dist/logger.js.map +1 -1
- package/dist/media.js +21 -9
- package/dist/media.js.map +1 -1
- package/dist/message-builder.js +10 -9
- package/dist/message-builder.js.map +1 -1
- package/dist/message.js +131 -83
- package/dist/message.js.map +1 -1
- package/dist/packages/conversations/package.json.js +1 -1
- package/dist/participant.js +85 -51
- package/dist/participant.js.map +1 -1
- package/dist/push-notification.js.map +1 -1
- package/dist/rest-paginator.js +16 -6
- package/dist/rest-paginator.js.map +1 -1
- package/dist/services/network.js +18 -14
- package/dist/services/network.js.map +1 -1
- package/dist/services/typing-indicator.js +20 -17
- package/dist/services/typing-indicator.js.map +1 -1
- package/dist/unsent-message.js.map +1 -1
- package/dist/user.js +85 -59
- package/dist/user.js.map +1 -1
- package/dist/util/deferred.js +3 -1
- package/dist/util/deferred.js.map +1 -1
- package/dist/util/index.js +6 -6
- package/dist/util/index.js.map +1 -1
- package/docs/assets/js/search.js +1 -1
- package/docs/classes/AggregatedDeliveryReceipt.html +0 -117
- package/docs/classes/Client.html +24 -147
- package/docs/classes/Conversation.html +30 -147
- package/docs/classes/DetailedDeliveryReceipt.html +1 -118
- package/docs/classes/Media.html +0 -117
- package/docs/classes/Message.html +7 -124
- package/docs/classes/MessageBuilder.html +2 -119
- package/docs/classes/Participant.html +7 -124
- package/docs/classes/PushNotification.html +0 -117
- package/docs/classes/RestPaginator.html +0 -117
- package/docs/classes/UnsentMessage.html +0 -117
- package/docs/classes/User.html +7 -124
- package/docs/index.html +60 -0
- package/docs/interfaces/ClientOptions.html +0 -117
- package/docs/interfaces/ConversationBindings.html +0 -117
- package/docs/interfaces/ConversationEmailBinding.html +0 -117
- package/docs/interfaces/ConversationLimits.html +3098 -0
- package/docs/interfaces/ConversationState.html +0 -117
- package/docs/interfaces/CreateConversationOptions.html +1 -118
- package/docs/interfaces/LastMessage.html +0 -117
- package/docs/interfaces/Paginator.html +0 -117
- package/docs/interfaces/ParticipantBindings.html +0 -117
- package/docs/interfaces/ParticipantEmailBinding.html +0 -117
- package/docs/interfaces/PushNotificationData.html +0 -117
- package/docs/interfaces/SendEmailOptions.html +0 -117
- package/docs/interfaces/SendMediaOptions.html +0 -117
- package/docs/modules.html +60 -0
- package/package.json +23 -17
package/dist/message.js
CHANGED
@@ -146,7 +146,7 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
146
146
|
|
147
147
|
var isEqual__default = /*#__PURE__*/_interopDefaultLegacy(isEqual);
|
148
148
|
|
149
|
-
const log = logger.Logger.scope(
|
149
|
+
const log = logger.Logger.scope("Message");
|
150
150
|
/**
|
151
151
|
* A message in a conversation.
|
152
152
|
*/
|
@@ -155,7 +155,7 @@ class Message extends replayEventEmitter.ReplayEventEmitter {
|
|
155
155
|
* @internal
|
156
156
|
*/
|
157
157
|
constructor(index$1, data, conversation, links, configuration, services) {
|
158
|
-
var _a, _b, _c, _d
|
158
|
+
var _a, _b, _c, _d;
|
159
159
|
super();
|
160
160
|
this.conversation = conversation;
|
161
161
|
this.links = links;
|
@@ -164,42 +164,56 @@ class Message extends replayEventEmitter.ReplayEventEmitter {
|
|
164
164
|
this.state = {
|
165
165
|
sid: data.sid,
|
166
166
|
index: index$1,
|
167
|
-
author:
|
168
|
-
subject:
|
169
|
-
body: data.text,
|
167
|
+
author: data.author,
|
168
|
+
subject: data.subject,
|
169
|
+
body: (_a = data.text) !== null && _a !== void 0 ? _a : null,
|
170
170
|
timestamp: data.timestamp ? new Date(data.timestamp) : null,
|
171
171
|
dateUpdated: data.dateUpdated ? new Date(data.dateUpdated) : null,
|
172
|
-
lastUpdatedBy: (
|
172
|
+
lastUpdatedBy: (_b = data.lastUpdatedBy) !== null && _b !== void 0 ? _b : null,
|
173
173
|
attributes: index.parseAttributes(data.attributes, `Got malformed attributes for the message ${data.sid}`, log),
|
174
|
-
type: (
|
175
|
-
media:
|
176
|
-
? new media.Media(data.media, this.services)
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
174
|
+
type: (_c = data.type) !== null && _c !== void 0 ? _c : "text",
|
175
|
+
media: data.type && data.type === "media" && data.media
|
176
|
+
? new media.Media(data.media, this.services)
|
177
|
+
: null,
|
178
|
+
medias: data.type && data.type === "media" && data.medias
|
179
|
+
? data.medias.map((m) => new media.Media(m, this.services))
|
180
|
+
: null,
|
181
|
+
participantSid: (_d = data.memberSid) !== null && _d !== void 0 ? _d : null,
|
182
|
+
aggregatedDeliveryReceipt: data.delivery
|
183
|
+
? new aggregatedDeliveryReceipt.AggregatedDeliveryReceipt(data.delivery)
|
184
|
+
: null,
|
181
185
|
};
|
182
186
|
}
|
183
187
|
/**
|
184
188
|
* The server-assigned unique identifier for the message.
|
185
189
|
*/
|
186
|
-
get sid() {
|
190
|
+
get sid() {
|
191
|
+
return this.state.sid;
|
192
|
+
}
|
187
193
|
/**
|
188
194
|
* Name of the user that sent the message.
|
189
195
|
*/
|
190
|
-
get author() {
|
196
|
+
get author() {
|
197
|
+
return this.state.author;
|
198
|
+
}
|
191
199
|
/**
|
192
200
|
* Message subject. Used only in email conversations.
|
193
201
|
*/
|
194
|
-
get subject() {
|
202
|
+
get subject() {
|
203
|
+
return this.state.subject;
|
204
|
+
}
|
195
205
|
/**
|
196
206
|
* Body of the message.
|
197
207
|
*/
|
198
|
-
get body() {
|
208
|
+
get body() {
|
209
|
+
return this.state.body;
|
210
|
+
}
|
199
211
|
/**
|
200
212
|
* Date this message was last updated on.
|
201
213
|
*/
|
202
|
-
get dateUpdated() {
|
214
|
+
get dateUpdated() {
|
215
|
+
return this.state.dateUpdated;
|
216
|
+
}
|
203
217
|
/**
|
204
218
|
* Index of the message in the conversation's messages list.
|
205
219
|
* By design of the Conversations system, the message indices may have arbitrary gaps between them,
|
@@ -211,36 +225,52 @@ class Message extends replayEventEmitter.ReplayEventEmitter {
|
|
211
225
|
* To calculate the number of unread messages it is better to use the read horizon API.
|
212
226
|
* See {@link Conversation.getUnreadMessagesCount} for details.
|
213
227
|
*/
|
214
|
-
get index() {
|
228
|
+
get index() {
|
229
|
+
return this.state.index;
|
230
|
+
}
|
215
231
|
/**
|
216
232
|
* Identity of the last user that updated the message.
|
217
233
|
*/
|
218
|
-
get lastUpdatedBy() {
|
234
|
+
get lastUpdatedBy() {
|
235
|
+
return this.state.lastUpdatedBy;
|
236
|
+
}
|
219
237
|
/**
|
220
238
|
* Date this message was created on.
|
221
239
|
*/
|
222
|
-
get dateCreated() {
|
240
|
+
get dateCreated() {
|
241
|
+
return this.state.timestamp;
|
242
|
+
}
|
223
243
|
/**
|
224
244
|
* Custom attributes of the message.
|
225
245
|
*/
|
226
|
-
get attributes() {
|
246
|
+
get attributes() {
|
247
|
+
return this.state.attributes;
|
248
|
+
}
|
227
249
|
/**
|
228
250
|
* Type of the message.
|
229
251
|
*/
|
230
|
-
get type() {
|
252
|
+
get type() {
|
253
|
+
return this.state.type;
|
254
|
+
}
|
231
255
|
/**
|
232
256
|
* One of the attached media (if present).
|
233
257
|
* @deprecated Use attachedMedia instead. Note that the latter is now an array.
|
234
258
|
*/
|
235
|
-
get media() {
|
259
|
+
get media() {
|
260
|
+
return this.state.media;
|
261
|
+
}
|
236
262
|
/**
|
237
263
|
* Return all media attachments, except email body/history attachments, without temporary urls.
|
238
264
|
*/
|
239
|
-
get attachedMedia() {
|
265
|
+
get attachedMedia() {
|
266
|
+
return this.getMediaByCategory(["media"]);
|
267
|
+
}
|
240
268
|
/**
|
241
269
|
* The server-assigned unique identifier of the authoring participant.
|
242
270
|
*/
|
243
|
-
get participantSid() {
|
271
|
+
get participantSid() {
|
272
|
+
return this.state.participantSid;
|
273
|
+
}
|
244
274
|
/**
|
245
275
|
* Aggregated information about the message delivery statuses across all participants of a conversation..
|
246
276
|
*/
|
@@ -255,76 +285,83 @@ class Message extends replayEventEmitter.ReplayEventEmitter {
|
|
255
285
|
*/
|
256
286
|
getMediaByCategory(categories) {
|
257
287
|
var _a;
|
258
|
-
return (_a = this.state.medias)
|
288
|
+
return ((_a = this.state.medias) !== null && _a !== void 0 ? _a : []).filter((m) => categories.includes(m.category));
|
259
289
|
}
|
260
290
|
/**
|
261
291
|
* Get a media descriptor for an email body attachment of a provided type.
|
262
292
|
* Allowed body types are returned in the Conversation.limits().emailBodiesAllowedMimeTypes array.
|
263
293
|
* @param type Type of email body to request, defaults to `text/plain`.
|
264
294
|
*/
|
265
|
-
getEmailBody(type =
|
295
|
+
getEmailBody(type = "text/plain") {
|
266
296
|
var _a, _b;
|
267
|
-
return (_b = (_a = this.getMediaByCategory([
|
297
|
+
return ((_b = (_a = this.getMediaByCategory(["body"])) === null || _a === void 0 ? void 0 : _a.filter((m) => m.contentType == type).shift()) !== null && _b !== void 0 ? _b : null);
|
268
298
|
}
|
269
299
|
/**
|
270
300
|
* Get a media descriptor for an email history attachment of a provided type.
|
271
301
|
* Allowed body types are returned in the Conversation.limits().emailHistoriesAllowedMimeTypes array.
|
272
302
|
* @param type Type of email history to request, defaults to `text/plain`.
|
273
303
|
*/
|
274
|
-
getEmailHistory(type =
|
304
|
+
getEmailHistory(type = "text/plain") {
|
275
305
|
var _a, _b;
|
276
|
-
return (_b = (_a = this.getMediaByCategory([
|
306
|
+
return ((_b = (_a = this.getMediaByCategory(["history"])) === null || _a === void 0 ? void 0 : _a.filter((m) => m.contentType == type).shift()) !== null && _b !== void 0 ? _b : null);
|
277
307
|
}
|
278
308
|
_update(data) {
|
279
|
-
|
280
|
-
if ((data.text ||
|
309
|
+
const updateReasons = [];
|
310
|
+
if ((data.text || typeof data.text === "string") &&
|
311
|
+
data.text !== this.state.body) {
|
281
312
|
this.state.body = data.text;
|
282
|
-
updateReasons.push(
|
313
|
+
updateReasons.push("body");
|
283
314
|
}
|
284
315
|
if (data.subject && data.subject !== this.state.subject) {
|
285
316
|
this.state.subject = data.subject;
|
286
|
-
updateReasons.push(
|
317
|
+
updateReasons.push("subject");
|
287
318
|
}
|
288
319
|
if (data.lastUpdatedBy && data.lastUpdatedBy !== this.state.lastUpdatedBy) {
|
289
320
|
this.state.lastUpdatedBy = data.lastUpdatedBy;
|
290
|
-
updateReasons.push(
|
321
|
+
updateReasons.push("lastUpdatedBy");
|
291
322
|
}
|
292
323
|
if (data.author && data.author !== this.state.author) {
|
293
324
|
this.state.author = data.author;
|
294
|
-
updateReasons.push(
|
325
|
+
updateReasons.push("author");
|
295
326
|
}
|
296
327
|
if (data.dateUpdated &&
|
297
|
-
new Date(data.dateUpdated).getTime() !==
|
328
|
+
new Date(data.dateUpdated).getTime() !==
|
329
|
+
(this.state.dateUpdated && this.state.dateUpdated.getTime())) {
|
298
330
|
this.state.dateUpdated = new Date(data.dateUpdated);
|
299
|
-
updateReasons.push(
|
331
|
+
updateReasons.push("dateUpdated");
|
300
332
|
}
|
301
333
|
if (data.timestamp &&
|
302
|
-
new Date(data.timestamp).getTime() !==
|
334
|
+
new Date(data.timestamp).getTime() !==
|
335
|
+
(this.state.timestamp && this.state.timestamp.getTime())) {
|
303
336
|
this.state.timestamp = new Date(data.timestamp);
|
304
|
-
updateReasons.push(
|
337
|
+
updateReasons.push("dateCreated");
|
305
338
|
}
|
306
|
-
|
339
|
+
const updatedAttributes = index.parseAttributes(data.attributes, `Got malformed attributes for the message ${this.sid}`, log);
|
307
340
|
if (!isEqual__default['default'](this.state.attributes, updatedAttributes)) {
|
308
341
|
this.state.attributes = updatedAttributes;
|
309
|
-
updateReasons.push(
|
342
|
+
updateReasons.push("attributes");
|
310
343
|
}
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
!!updatedAggregatedDelivery.
|
315
|
-
!!updatedAggregatedDelivery.
|
344
|
+
const updatedAggregatedDelivery = data.delivery;
|
345
|
+
const currentAggregatedDelivery = this.state.aggregatedDeliveryReceipt;
|
346
|
+
const isUpdatedAggregateDeliveryValid = !!updatedAggregatedDelivery &&
|
347
|
+
!!updatedAggregatedDelivery.total &&
|
348
|
+
!!updatedAggregatedDelivery.delivered &&
|
349
|
+
!!updatedAggregatedDelivery.failed &&
|
350
|
+
!!updatedAggregatedDelivery.read &&
|
351
|
+
!!updatedAggregatedDelivery.sent &&
|
352
|
+
!!updatedAggregatedDelivery.undelivered;
|
316
353
|
if (isUpdatedAggregateDeliveryValid) {
|
317
354
|
if (!currentAggregatedDelivery) {
|
318
355
|
this.state.aggregatedDeliveryReceipt = new aggregatedDeliveryReceipt.AggregatedDeliveryReceipt(updatedAggregatedDelivery);
|
319
|
-
updateReasons.push(
|
356
|
+
updateReasons.push("deliveryReceipt");
|
320
357
|
}
|
321
358
|
else if (!currentAggregatedDelivery._isEquals(updatedAggregatedDelivery)) {
|
322
359
|
currentAggregatedDelivery._update(updatedAggregatedDelivery);
|
323
|
-
updateReasons.push(
|
360
|
+
updateReasons.push("deliveryReceipt");
|
324
361
|
}
|
325
362
|
}
|
326
363
|
if (updateReasons.length > 0) {
|
327
|
-
this.emit(
|
364
|
+
this.emit("updated", { message: this, updateReasons: updateReasons });
|
328
365
|
}
|
329
366
|
}
|
330
367
|
/**
|
@@ -333,14 +370,16 @@ class Message extends replayEventEmitter.ReplayEventEmitter {
|
|
333
370
|
async getParticipant() {
|
334
371
|
let participant = null;
|
335
372
|
if (this.state.participantSid) {
|
336
|
-
participant = await this.conversation
|
373
|
+
participant = await this.conversation
|
374
|
+
.getParticipantBySid(this.state.participantSid)
|
337
375
|
.catch(() => {
|
338
376
|
log.debug(`Participant with sid "${this.participantSid}" not found for message ${this.sid}`);
|
339
377
|
return null;
|
340
378
|
});
|
341
379
|
}
|
342
380
|
if (!participant && this.state.author) {
|
343
|
-
participant = await this.conversation
|
381
|
+
participant = await this.conversation
|
382
|
+
.getParticipantByIdentity(this.state.author)
|
344
383
|
.catch(() => {
|
345
384
|
log.debug(`Participant with identity "${this.author}" not found for message ${this.sid}`);
|
346
385
|
return null;
|
@@ -349,20 +388,20 @@ class Message extends replayEventEmitter.ReplayEventEmitter {
|
|
349
388
|
if (participant) {
|
350
389
|
return participant;
|
351
390
|
}
|
352
|
-
let errorMesage =
|
391
|
+
let errorMesage = "Participant with ";
|
353
392
|
if (this.state.participantSid) {
|
354
|
-
errorMesage +=
|
393
|
+
errorMesage += "SID '" + this.state.participantSid + "' ";
|
355
394
|
}
|
356
395
|
if (this.state.author) {
|
357
396
|
if (this.state.participantSid) {
|
358
|
-
errorMesage +=
|
397
|
+
errorMesage += "or ";
|
359
398
|
}
|
360
|
-
errorMesage +=
|
399
|
+
errorMesage += "identity '" + this.state.author + "' ";
|
361
400
|
}
|
362
|
-
if (errorMesage ===
|
363
|
-
errorMesage =
|
401
|
+
if (errorMesage === "Participant with ") {
|
402
|
+
errorMesage = "Participant ";
|
364
403
|
}
|
365
|
-
errorMesage +=
|
404
|
+
errorMesage += "was not found";
|
366
405
|
throw new Error(errorMesage);
|
367
406
|
}
|
368
407
|
/**
|
@@ -372,7 +411,10 @@ class Message extends replayEventEmitter.ReplayEventEmitter {
|
|
372
411
|
let paginator = await this._getDetailedDeliveryReceiptsPaginator();
|
373
412
|
let detailedDeliveryReceipts = [];
|
374
413
|
while (true) {
|
375
|
-
detailedDeliveryReceipts = [
|
414
|
+
detailedDeliveryReceipts = [
|
415
|
+
...detailedDeliveryReceipts,
|
416
|
+
...paginator.items,
|
417
|
+
];
|
376
418
|
if (!paginator.hasNextPage) {
|
377
419
|
break;
|
378
420
|
}
|
@@ -384,7 +426,7 @@ class Message extends replayEventEmitter.ReplayEventEmitter {
|
|
384
426
|
* Remove the message.
|
385
427
|
*/
|
386
428
|
async remove() {
|
387
|
-
await this.services.commandExecutor.mutateResource(
|
429
|
+
await this.services.commandExecutor.mutateResource("delete", this.links.self);
|
388
430
|
return this;
|
389
431
|
}
|
390
432
|
/**
|
@@ -392,8 +434,8 @@ class Message extends replayEventEmitter.ReplayEventEmitter {
|
|
392
434
|
* @param body New body of the message.
|
393
435
|
*/
|
394
436
|
async updateBody(body) {
|
395
|
-
await this.services.commandExecutor.mutateResource(
|
396
|
-
body
|
437
|
+
await this.services.commandExecutor.mutateResource("post", this.links.self, {
|
438
|
+
body,
|
397
439
|
});
|
398
440
|
return this;
|
399
441
|
}
|
@@ -402,8 +444,10 @@ class Message extends replayEventEmitter.ReplayEventEmitter {
|
|
402
444
|
* @param attributes New attributes.
|
403
445
|
*/
|
404
446
|
async updateAttributes(attributes) {
|
405
|
-
await this.services.commandExecutor.mutateResource(
|
406
|
-
attributes: typeof attributes !==
|
447
|
+
await this.services.commandExecutor.mutateResource("post", this.links.self, {
|
448
|
+
attributes: typeof attributes !== "undefined"
|
449
|
+
? JSON.stringify(attributes)
|
450
|
+
: undefined,
|
407
451
|
});
|
408
452
|
return this;
|
409
453
|
}
|
@@ -414,21 +458,23 @@ class Message extends replayEventEmitter.ReplayEventEmitter {
|
|
414
458
|
async attachTemporaryUrlsFor(contentSet) {
|
415
459
|
// We ignore existing mcsMedia members of each of the media entries.
|
416
460
|
// Instead we just collect their sids and pull new descriptors from a mediaSet GET endpoint.
|
417
|
-
const sids = contentSet.map((m) => m.sid);
|
418
|
-
if (this.services.mcsClient) {
|
419
|
-
return (await this.services.mcsClient.mediaSetGet(sids)).map((item) => {
|
461
|
+
const sids = contentSet === null || contentSet === void 0 ? void 0 : contentSet.map((m) => m.sid);
|
462
|
+
if (this.services.mcsClient && sids) {
|
463
|
+
return (await this.services.mcsClient.mediaSetGet(sids)).map((item) => {
|
464
|
+
return new media.Media(item, this.services);
|
465
|
+
});
|
420
466
|
}
|
421
467
|
else {
|
422
|
-
throw new Error(
|
468
|
+
throw new Error("Media Content Service is unavailable");
|
423
469
|
}
|
424
470
|
}
|
425
471
|
async _getDetailedDeliveryReceiptsPaginator(options) {
|
426
472
|
const messagesReceiptsUrl = this.configuration.links.messagesReceipts
|
427
|
-
.replace(
|
428
|
-
.replace(
|
473
|
+
.replace("%s", this.conversation.sid)
|
474
|
+
.replace("%s", this.sid);
|
429
475
|
const url = new index.UriBuilder(messagesReceiptsUrl)
|
430
|
-
.arg(
|
431
|
-
.arg(
|
476
|
+
.arg("PageToken", options === null || options === void 0 ? void 0 : options.pageToken)
|
477
|
+
.arg("PageSize", options === null || options === void 0 ? void 0 : options.pageSize)
|
432
478
|
.build();
|
433
479
|
const response = await this.services.network.get(url);
|
434
480
|
return new restPaginator.RestPaginator(response.body.delivery_receipts.map((x) => new detailedDeliveryReceipt.DetailedDeliveryReceipt(x)), (pageToken, pageSize) => this._getDetailedDeliveryReceiptsPaginator({ pageToken, pageSize }), response.body.meta.previous_token, response.body.meta.next_token);
|
@@ -442,21 +488,21 @@ class Message extends replayEventEmitter.ReplayEventEmitter {
|
|
442
488
|
* * {@link Message} message - the message in question
|
443
489
|
* * {@link MessageUpdateReason}[] updateReasons - array of reasons for the update
|
444
490
|
*/
|
445
|
-
Message.updated =
|
491
|
+
Message.updated = "updated";
|
446
492
|
tslib_es6.__decorate([
|
447
|
-
declarativeTypeValidator.validateTypes(declarativeTypeValidator.nonEmptyString),
|
493
|
+
declarativeTypeValidator.validateTypes([declarativeTypeValidator.nonEmptyString, "undefined"]),
|
448
494
|
tslib_es6.__metadata("design:type", Function),
|
449
|
-
tslib_es6.__metadata("design:paramtypes", [
|
495
|
+
tslib_es6.__metadata("design:paramtypes", [Object]),
|
450
496
|
tslib_es6.__metadata("design:returntype", media.Media)
|
451
497
|
], Message.prototype, "getEmailBody", null);
|
452
498
|
tslib_es6.__decorate([
|
453
|
-
declarativeTypeValidator.validateTypes(declarativeTypeValidator.nonEmptyString),
|
499
|
+
declarativeTypeValidator.validateTypes([declarativeTypeValidator.nonEmptyString, "undefined"]),
|
454
500
|
tslib_es6.__metadata("design:type", Function),
|
455
|
-
tslib_es6.__metadata("design:paramtypes", [
|
501
|
+
tslib_es6.__metadata("design:paramtypes", [Object]),
|
456
502
|
tslib_es6.__metadata("design:returntype", media.Media)
|
457
503
|
], Message.prototype, "getEmailHistory", null);
|
458
504
|
tslib_es6.__decorate([
|
459
|
-
declarativeTypeValidator.validateTypesAsync(
|
505
|
+
declarativeTypeValidator.validateTypesAsync("string"),
|
460
506
|
tslib_es6.__metadata("design:type", Function),
|
461
507
|
tslib_es6.__metadata("design:paramtypes", [String]),
|
462
508
|
tslib_es6.__metadata("design:returntype", Promise)
|
@@ -468,9 +514,11 @@ tslib_es6.__decorate([
|
|
468
514
|
tslib_es6.__metadata("design:returntype", Promise)
|
469
515
|
], Message.prototype, "updateAttributes", null);
|
470
516
|
tslib_es6.__decorate([
|
471
|
-
declarativeTypeValidator.validateTypesAsync(declarativeTypeValidator.custom(value => [
|
472
|
-
value instanceof Array &&
|
473
|
-
|
517
|
+
declarativeTypeValidator.validateTypesAsync(declarativeTypeValidator.custom((value) => [
|
518
|
+
value instanceof Array &&
|
519
|
+
value.length > 0 &&
|
520
|
+
value.reduce((a, c) => a && c instanceof media.Media, true),
|
521
|
+
"a non-empty array of Media",
|
474
522
|
])),
|
475
523
|
tslib_es6.__metadata("design:type", Function),
|
476
524
|
tslib_es6.__metadata("design:paramtypes", [Array]),
|
package/dist/message.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"message.js","sources":["../src/message.ts"],"sourcesContent":["import { parseAttributes, UriBuilder } from './util';\nimport { Logger } from './logger';\nimport { Conversation } from './conversation';\nimport { McsClient, MediaCategory } from '@twilio/mcs-client';\nimport { Media } from './media';\nimport { Participant } from './participant';\nimport { AggregatedDeliveryReceipt } from './aggregated-delivery-receipt';\nimport { validateTypes, validateTypesAsync, literal, nonEmptyString, custom } from '@twilio/declarative-type-validator';\nimport { attributesValidator } from './interfaces/attributes';\nimport { Network } from './services/network';\nimport { RestPaginator } from './rest-paginator';\nimport { DetailedDeliveryReceipt } from './detailed-delivery-receipt';\nimport { Paginator } from './interfaces/paginator';\nimport { Configuration } from './configuration';\nimport { CommandExecutor } from './command-executor';\nimport { EditMessageRequest } from './interfaces/commands/edit-message';\nimport { MessageResponse } from './interfaces/commands/message-response';\nimport { ReplayEventEmitter } from '@twilio/replay-event-emitter';\nimport isEqual from 'lodash.isequal';\n\ntype MessageEvents = {\n updated: (data: {\n message: Message;\n updateReasons: MessageUpdateReason[]\n }) => void;\n};\n\nconst log = Logger.scope('Message');\n\ninterface MessageState {\n sid: string;\n index: number;\n author?: string;\n subject?: string;\n body: string;\n dateUpdated: Date;\n lastUpdatedBy: string;\n attributes: Object;\n timestamp: Date;\n type: MessageType;\n media?: Media;\n medias?: Media[];\n participantSid?: string;\n aggregatedDeliveryReceipt?: AggregatedDeliveryReceipt;\n}\n\ninterface MessageServices {\n mcsClient: McsClient;\n network: Network;\n commandExecutor: CommandExecutor;\n}\n\ninterface MessageLinks {\n self: string;\n conversation: string;\n messages_receipts: string;\n}\n\n/**\n * The reason for the `updated` event being emitted by a message.\n */\ntype MessageUpdateReason =\n | 'body'\n | 'lastUpdatedBy'\n | 'dateCreated'\n | 'dateUpdated'\n | 'attributes'\n | 'author'\n | 'deliveryReceipt'\n | 'subject';\n\n/**\n * Type of a message.\n */\ntype MessageType = 'text' | 'media';\n\ninterface MessageUpdatedEventArgs {\n message: Message;\n updateReasons: MessageUpdateReason[];\n}\n\n/**\n * A message in a conversation.\n */\nclass Message extends ReplayEventEmitter<MessageEvents> {\n /**\n * Conversation that the message is in.\n */\n public readonly conversation: Conversation;\n\n private readonly links: MessageLinks;\n private readonly configuration: Configuration;\n private readonly services: MessageServices;\n\n private state: MessageState;\n\n /**\n * @internal\n */\n constructor(\n index: number,\n data: any,\n conversation: Conversation,\n links: MessageLinks,\n configuration: Configuration,\n services: MessageServices,\n ) {\n super();\n\n this.conversation = conversation;\n\n this.links = links;\n this.configuration = configuration;\n this.services = services;\n\n this.state = {\n sid: data.sid,\n index: index,\n author: data.author ?? null,\n subject: data.subject ?? null,\n body: data.text,\n timestamp: data.timestamp ? new Date(data.timestamp) : null,\n dateUpdated: data.dateUpdated ? new Date(data.dateUpdated) : null,\n lastUpdatedBy: data.lastUpdatedBy ?? null,\n attributes: parseAttributes(data.attributes, `Got malformed attributes for the message ${data.sid}`, log),\n type: data.type ?? 'text',\n media: (data.type && data.type === 'media' && data.media)\n ? new Media(data.media, this.services) : null,\n medias: (data.type && data.type === 'media' && data.medias)\n ? data.medias.map((m) => new Media(m, this.services)) : null,\n participantSid: data.memberSid ?? null,\n aggregatedDeliveryReceipt: data.delivery ? new AggregatedDeliveryReceipt(data.delivery) : null\n };\n }\n\n /**\n * Fired when the properties or the body of the message has been updated.\n *\n * Parameters:\n * 1. object `data` - info object provided with the event. It has the following properties:\n * * {@link Message} message - the message in question\n * * {@link MessageUpdateReason}[] updateReasons - array of reasons for the update\n */\n static readonly updated = 'updated';\n\n /**\n * The server-assigned unique identifier for the message.\n */\n public get sid(): string { return this.state.sid; }\n\n /**\n * Name of the user that sent the message.\n */\n public get author(): string { return this.state.author; }\n\n /**\n * Message subject. Used only in email conversations.\n */\n public get subject(): string | null { return this.state.subject; }\n\n /**\n * Body of the message.\n */\n public get body(): string { return this.state.body; }\n\n /**\n * Date this message was last updated on.\n */\n public get dateUpdated(): Date { return this.state.dateUpdated; }\n\n /**\n * Index of the message in the conversation's messages list.\n * By design of the Conversations system, the message indices may have arbitrary gaps between them,\n * that does not necessarily mean they were deleted or otherwise modified - just that\n * messages may have some non-contiguous indices even if they are being sent immediately one after another.\n *\n * Trying to use indices for some calculations is going to be unreliable.\n *\n * To calculate the number of unread messages it is better to use the read horizon API.\n * See {@link Conversation.getUnreadMessagesCount} for details.\n */\n public get index(): number { return this.state.index; }\n\n /**\n * Identity of the last user that updated the message.\n */\n public get lastUpdatedBy(): string { return this.state.lastUpdatedBy; }\n\n /**\n * Date this message was created on.\n */\n public get dateCreated(): Date { return this.state.timestamp; }\n\n /**\n * Custom attributes of the message.\n */\n public get attributes(): Object { return this.state.attributes; }\n\n /**\n * Type of the message.\n */\n public get type(): MessageType { return this.state.type; }\n\n /**\n * One of the attached media (if present).\n * @deprecated Use attachedMedia instead. Note that the latter is now an array.\n */\n public get media(): Media | null { return this.state.media; }\n\n /**\n * Return all media attachments, except email body/history attachments, without temporary urls.\n */\n public get attachedMedia(): Array<Media> | null { return this.getMediaByCategory(['media']); }\n\n /**\n * The server-assigned unique identifier of the authoring participant.\n */\n public get participantSid(): string { return this.state.participantSid; }\n\n /**\n * Aggregated information about the message delivery statuses across all participants of a conversation..\n */\n public get aggregatedDeliveryReceipt(): AggregatedDeliveryReceipt | null {\n return this.state.aggregatedDeliveryReceipt;\n }\n\n /**\n * Return a (possibly empty) array of media matching a specific set of categories.\n * Allowed category is so far only 'media'.\n * @param categories Array of categories to match.\n * @returns Array of media descriptors matching given categories.\n */\n public getMediaByCategory(categories: Array<MediaCategory>): Array<Media> | null {\n return this.state.medias?.filter((m) => categories.includes(m.category));\n }\n\n /**\n * Get a media descriptor for an email body attachment of a provided type.\n * Allowed body types are returned in the Conversation.limits().emailBodiesAllowedMimeTypes array.\n * @param type Type of email body to request, defaults to `text/plain`.\n */\n @validateTypes(nonEmptyString)\n public getEmailBody(type: string = 'text/plain'): Media | null {\n return this.getMediaByCategory(['body'])?.filter((m) => m.contentType == type).shift() ?? null;\n }\n\n /**\n * Get a media descriptor for an email history attachment of a provided type.\n * Allowed body types are returned in the Conversation.limits().emailHistoriesAllowedMimeTypes array.\n * @param type Type of email history to request, defaults to `text/plain`.\n */\n @validateTypes(nonEmptyString)\n public getEmailHistory(type: string = 'text/plain'): Media | null {\n return this.getMediaByCategory(['history'])?.filter((m) => m.contentType == type).shift() ?? null;\n }\n\n _update(data) {\n let updateReasons: MessageUpdateReason[] = [];\n\n if ((data.text || ((typeof data.text) === 'string')) && data.text !== this.state.body) {\n this.state.body = data.text;\n updateReasons.push('body');\n }\n\n if (data.subject && data.subject !== this.state.subject) {\n this.state.subject = data.subject;\n updateReasons.push('subject');\n }\n\n if (data.lastUpdatedBy && data.lastUpdatedBy !== this.state.lastUpdatedBy) {\n this.state.lastUpdatedBy = data.lastUpdatedBy;\n updateReasons.push('lastUpdatedBy');\n }\n\n if (data.author && data.author !== this.state.author) {\n this.state.author = data.author;\n updateReasons.push('author');\n }\n\n if (data.dateUpdated &&\n new Date(data.dateUpdated).getTime() !== (this.state.dateUpdated && this.state.dateUpdated.getTime())) {\n this.state.dateUpdated = new Date(data.dateUpdated);\n updateReasons.push('dateUpdated');\n }\n\n if (data.timestamp &&\n new Date(data.timestamp).getTime() !== (this.state.timestamp && this.state.timestamp.getTime())) {\n this.state.timestamp = new Date(data.timestamp);\n updateReasons.push('dateCreated');\n }\n\n let updatedAttributes = parseAttributes(data.attributes, `Got malformed attributes for the message ${this.sid}`, log);\n if (!isEqual(this.state.attributes, updatedAttributes)) {\n this.state.attributes = updatedAttributes;\n updateReasons.push('attributes');\n }\n\n let updatedAggregatedDelivery = data.delivery;\n let currentAggregatedDelivery = this.state.aggregatedDeliveryReceipt;\n let isUpdatedAggregateDeliveryValid = !!updatedAggregatedDelivery && !!updatedAggregatedDelivery.total &&\n !!updatedAggregatedDelivery.delivered && !!updatedAggregatedDelivery.failed && !!updatedAggregatedDelivery.read &&\n !!updatedAggregatedDelivery.sent && !!updatedAggregatedDelivery.undelivered;\n if (isUpdatedAggregateDeliveryValid) {\n if (!currentAggregatedDelivery) {\n this.state.aggregatedDeliveryReceipt = new AggregatedDeliveryReceipt(updatedAggregatedDelivery);\n updateReasons.push('deliveryReceipt');\n } else if (!currentAggregatedDelivery._isEquals(updatedAggregatedDelivery)) {\n currentAggregatedDelivery._update(updatedAggregatedDelivery);\n updateReasons.push('deliveryReceipt');\n }\n }\n\n if (updateReasons.length > 0) {\n this.emit('updated', { message: this, updateReasons: updateReasons });\n }\n }\n\n /**\n * Get the participant who is the author of the message.\n */\n public async getParticipant(): Promise<Participant> {\n let participant: Participant = null;\n if (this.state.participantSid) {\n participant = await this.conversation.getParticipantBySid(this.participantSid)\n .catch(() => {\n log.debug(`Participant with sid \"${this.participantSid}\" not found for message ${this.sid}`);\n return null;\n });\n }\n if (!participant && this.state.author) {\n participant = await this.conversation.getParticipantByIdentity(this.state.author)\n .catch(() => {\n log.debug(`Participant with identity \"${this.author}\" not found for message ${this.sid}`);\n return null;\n });\n }\n if (participant) {\n return participant;\n }\n let errorMesage = 'Participant with ';\n if (this.state.participantSid) {\n errorMesage += 'SID \\'' + this.state.participantSid + '\\' ';\n }\n if (this.state.author) {\n if (this.state.participantSid) {\n errorMesage += 'or ';\n }\n errorMesage += 'identity \\'' + this.state.author + '\\' ';\n }\n if (errorMesage === 'Participant with ') {\n errorMesage = 'Participant ';\n }\n errorMesage += 'was not found';\n throw new Error(errorMesage);\n }\n\n /**\n * Get the delivery receipts of the message.\n */\n public async getDetailedDeliveryReceipts(): Promise<DetailedDeliveryReceipt[]> {\n let paginator: Paginator<DetailedDeliveryReceipt> = await this._getDetailedDeliveryReceiptsPaginator();\n let detailedDeliveryReceipts: DetailedDeliveryReceipt[] = [];\n\n while (true) {\n detailedDeliveryReceipts = [...detailedDeliveryReceipts, ...paginator.items];\n\n if (!paginator.hasNextPage) {\n break;\n }\n\n paginator = await paginator.nextPage();\n }\n\n return detailedDeliveryReceipts;\n }\n\n /**\n * Remove the message.\n */\n public async remove(): Promise<Message> {\n await this.services.commandExecutor.mutateResource(\n 'delete',\n this.links.self\n );\n\n return this;\n }\n\n /**\n * Edit the message body.\n * @param body New body of the message.\n */\n @validateTypesAsync('string')\n public async updateBody(body: string): Promise<Message> {\n await this.services.commandExecutor.mutateResource<EditMessageRequest, MessageResponse>(\n 'post',\n this.links.self,\n {\n body\n }\n );\n\n return this;\n }\n\n /**\n * Edit the message attributes.\n * @param attributes New attributes.\n */\n @validateTypesAsync(attributesValidator)\n public async updateAttributes(attributes: any): Promise<Message> {\n await this.services.commandExecutor.mutateResource<EditMessageRequest, MessageResponse>(\n 'post',\n this.links.self,\n {\n attributes: typeof attributes !== 'undefined' ? JSON.stringify(attributes) : undefined\n }\n );\n\n return this;\n }\n\n /**\n * Get content URLs for all media attachments in the given set using single operation.\n * @param contentSet Set of media attachments to query for content URL.\n */\n @validateTypesAsync(custom(value => [\n value instanceof Array && value.length > 0 && value.reduce((a, c) => a && c instanceof Media, true),\n 'a non-empty array of Media'\n ]))\n public async attachTemporaryUrlsFor(contentSet: Media[]): Promise<Media[]> {\n // We ignore existing mcsMedia members of each of the media entries.\n // Instead we just collect their sids and pull new descriptors from a mediaSet GET endpoint.\n const sids = contentSet.map((m) => m.sid);\n if (this.services.mcsClient) {\n return (await this.services.mcsClient.mediaSetGet(sids)).map((item) => { return new Media(item, this.services); });\n } else {\n throw new Error('Media Content Service is unavailable');\n }\n }\n\n private async _getDetailedDeliveryReceiptsPaginator(options?: {\n pageToken?: string;\n pageSize?: number;\n }): Promise<Paginator<DetailedDeliveryReceipt>> {\n const messagesReceiptsUrl = this.configuration.links.messagesReceipts\n .replace('%s', this.conversation.sid)\n .replace('%s', this.sid);\n const url = new UriBuilder(messagesReceiptsUrl)\n .arg('PageToken', options?.pageToken)\n .arg('PageSize', options?.pageSize)\n .build();\n const response = await this.services.network.get(url);\n\n return new RestPaginator<DetailedDeliveryReceipt>(\n response.body.delivery_receipts.map(\n (x) => new DetailedDeliveryReceipt(x)\n ),\n (pageToken, pageSize) =>\n this._getDetailedDeliveryReceiptsPaginator({ pageToken, pageSize }),\n response.body.meta.previous_token,\n response.body.meta.next_token\n );\n }\n}\n\nexport {\n Message,\n MessageServices,\n MessageType,\n MessageUpdateReason,\n MessageUpdatedEventArgs\n};\n"],"names":["Logger","ReplayEventEmitter","index","parseAttributes","Media","AggregatedDeliveryReceipt","isEqual","UriBuilder","RestPaginator","DetailedDeliveryReceipt","__decorate","validateTypes","nonEmptyString","validateTypesAsync","attributesValidator","custom"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BA,MAAM,GAAG,GAAGA,aAAM,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;AAsDpC;;;AAGA,MAAM,OAAQ,SAAQC,qCAAiC;;;;IAerD,YACEC,OAAa,EACb,IAAS,EACT,YAA0B,EAC1B,KAAmB,EACnB,aAA4B,EAC5B,QAAyB;;QAEzB,KAAK,EAAE,CAAC;QAER,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QAEjC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;QACnC,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QAEzB,IAAI,CAAC,KAAK,GAAG;YACX,GAAG,EAAE,IAAI,CAAC,GAAG;YACb,KAAK,EAAEA,OAAK;YACZ,MAAM,EAAE,MAAA,IAA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mB,CAAC;;;;+CAWvC;AAUDJ;IAJCG,2CAAkB,CAACE,+BAAM,CAAC,KAAK,IAAI;QAClC,KAAK,YAAY,KAAK,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,YAAYX,WAAK,EAAE,IAAI,CAAC;QACnG,4BAA4B;KAC7B,CAAC,CAAC;;;;qDAUF;;;;"}
|
1
|
+
{"version":3,"file":"message.js","sources":["../src/message.ts"],"sourcesContent":["import { parseAttributes, UriBuilder } from \"./util\";\nimport { Logger } from \"./logger\";\nimport { Conversation } from \"./conversation\";\nimport { McsClient, MediaCategory } from \"@twilio/mcs-client\";\nimport { Media } from \"./media\";\nimport { Participant } from \"./participant\";\nimport {\n AggregatedDeliveryDescriptor,\n AggregatedDeliveryReceipt,\n} from \"./aggregated-delivery-receipt\";\nimport {\n validateTypes,\n validateTypesAsync,\n nonEmptyString,\n custom,\n} from \"@twilio/declarative-type-validator\";\nimport { attributesValidator } from \"./interfaces/attributes\";\nimport { Network } from \"./services/network\";\nimport { RestPaginator } from \"./rest-paginator\";\nimport { DetailedDeliveryReceipt } from \"./detailed-delivery-receipt\";\nimport { Paginator } from \"./interfaces/paginator\";\nimport { Configuration } from \"./configuration\";\nimport { CommandExecutor } from \"./command-executor\";\nimport { EditMessageRequest } from \"./interfaces/commands/edit-message\";\nimport { MessageResponse } from \"./interfaces/commands/message-response\";\nimport { ReplayEventEmitter } from \"@twilio/replay-event-emitter\";\nimport isEqual from \"lodash.isequal\";\nimport { JSONValue } from \"./types\";\nimport { ResponseMeta } from \"./interfaces/commands/response-meta\";\nimport { DeliveryReceiptResponse } from \"./interfaces/commands/delivery-receipt-response\";\n\ntype MessageEvents = {\n updated: (data: {\n message: Message;\n updateReasons: MessageUpdateReason[];\n }) => void;\n};\n\nconst log = Logger.scope(\"Message\");\n\ninterface MessageState {\n sid: string;\n index: number;\n author: string | null;\n subject: string | null;\n body: string | null;\n dateUpdated: Date | null;\n lastUpdatedBy: string | null;\n attributes: JSONValue;\n timestamp: Date | null;\n type: MessageType;\n media: Media | null;\n medias: Media[] | null;\n participantSid: string | null;\n aggregatedDeliveryReceipt: AggregatedDeliveryReceipt | null;\n}\n\ninterface MessageServices {\n mcsClient: McsClient;\n network: Network;\n commandExecutor: CommandExecutor;\n}\n\ninterface MessageLinks {\n self: string;\n conversation: string;\n messages_receipts: string;\n}\n\n/**\n * The reason for the `updated` event being emitted by a message.\n */\ntype MessageUpdateReason =\n | \"body\"\n | \"lastUpdatedBy\"\n | \"dateCreated\"\n | \"dateUpdated\"\n | \"attributes\"\n | \"author\"\n | \"deliveryReceipt\"\n | \"subject\";\n\n/**\n * Type of a message.\n */\ntype MessageType = \"text\" | \"media\";\n\ninterface MessageUpdatedEventArgs {\n message: Message;\n updateReasons: MessageUpdateReason[];\n}\n\nexport interface MessageData {\n sid: string;\n text?: string;\n type?: MessageType;\n author: string | null;\n subject: string | null;\n lastUpdatedBy?: string | null;\n attributes?: JSONValue;\n dateUpdated: string;\n timestamp?: string;\n medias?: Media[];\n media?: Media;\n memberSid?: string;\n delivery?: AggregatedDeliveryDescriptor;\n}\n\n/**\n * A message in a conversation.\n */\nclass Message extends ReplayEventEmitter<MessageEvents> {\n /**\n * Conversation that the message is in.\n */\n public readonly conversation: Conversation;\n\n private readonly links: MessageLinks;\n private readonly configuration: Configuration;\n private readonly services: MessageServices;\n\n private state: MessageState;\n\n /**\n * @internal\n */\n constructor(\n index: number,\n data: MessageData,\n conversation: Conversation,\n links: MessageLinks,\n configuration: Configuration,\n services: MessageServices\n ) {\n super();\n\n this.conversation = conversation;\n\n this.links = links;\n this.configuration = configuration;\n this.services = services;\n\n this.state = {\n sid: data.sid,\n index: index,\n author: data.author,\n subject: data.subject,\n body: data.text ?? null,\n timestamp: data.timestamp ? new Date(data.timestamp) : null,\n dateUpdated: data.dateUpdated ? new Date(data.dateUpdated) : null,\n lastUpdatedBy: data.lastUpdatedBy ?? null,\n attributes: parseAttributes(\n data.attributes,\n `Got malformed attributes for the message ${data.sid}`,\n log\n ),\n type: data.type ?? \"text\",\n media:\n data.type && data.type === \"media\" && data.media\n ? new Media(data.media, this.services)\n : null,\n medias:\n data.type && data.type === \"media\" && data.medias\n ? data.medias.map((m) => new Media(m, this.services))\n : null,\n participantSid: data.memberSid ?? null,\n aggregatedDeliveryReceipt: data.delivery\n ? new AggregatedDeliveryReceipt(data.delivery)\n : null,\n };\n }\n\n /**\n * Fired when the properties or the body of the message has been updated.\n *\n * Parameters:\n * 1. object `data` - info object provided with the event. It has the following properties:\n * * {@link Message} message - the message in question\n * * {@link MessageUpdateReason}[] updateReasons - array of reasons for the update\n */\n static readonly updated = \"updated\";\n\n /**\n * The server-assigned unique identifier for the message.\n */\n public get sid(): string {\n return this.state.sid;\n }\n\n /**\n * Name of the user that sent the message.\n */\n public get author(): string | null {\n return this.state.author;\n }\n\n /**\n * Message subject. Used only in email conversations.\n */\n public get subject(): string | null {\n return this.state.subject;\n }\n\n /**\n * Body of the message.\n */\n public get body(): string | null {\n return this.state.body;\n }\n\n /**\n * Date this message was last updated on.\n */\n public get dateUpdated(): Date | null {\n return this.state.dateUpdated;\n }\n\n /**\n * Index of the message in the conversation's messages list.\n * By design of the Conversations system, the message indices may have arbitrary gaps between them,\n * that does not necessarily mean they were deleted or otherwise modified - just that\n * messages may have some non-contiguous indices even if they are being sent immediately one after another.\n *\n * Trying to use indices for some calculations is going to be unreliable.\n *\n * To calculate the number of unread messages it is better to use the read horizon API.\n * See {@link Conversation.getUnreadMessagesCount} for details.\n */\n public get index(): number {\n return this.state.index;\n }\n\n /**\n * Identity of the last user that updated the message.\n */\n public get lastUpdatedBy(): string | null {\n return this.state.lastUpdatedBy;\n }\n\n /**\n * Date this message was created on.\n */\n public get dateCreated(): Date | null {\n return this.state.timestamp;\n }\n\n /**\n * Custom attributes of the message.\n */\n public get attributes(): JSONValue {\n return this.state.attributes;\n }\n\n /**\n * Type of the message.\n */\n public get type(): MessageType {\n return this.state.type;\n }\n\n /**\n * One of the attached media (if present).\n * @deprecated Use attachedMedia instead. Note that the latter is now an array.\n */\n public get media(): Media | null {\n return this.state.media;\n }\n\n /**\n * Return all media attachments, except email body/history attachments, without temporary urls.\n */\n public get attachedMedia(): Array<Media> | null {\n return this.getMediaByCategory([\"media\"]);\n }\n\n /**\n * The server-assigned unique identifier of the authoring participant.\n */\n public get participantSid(): string | null {\n return this.state.participantSid;\n }\n\n /**\n * Aggregated information about the message delivery statuses across all participants of a conversation..\n */\n public get aggregatedDeliveryReceipt(): AggregatedDeliveryReceipt | null {\n return this.state.aggregatedDeliveryReceipt;\n }\n\n /**\n * Return a (possibly empty) array of media matching a specific set of categories.\n * Allowed category is so far only 'media'.\n * @param categories Array of categories to match.\n * @returns Array of media descriptors matching given categories.\n */\n public getMediaByCategory(\n categories: Array<MediaCategory>\n ): Array<Media> | null {\n return (this.state.medias ?? []).filter((m) =>\n categories.includes(m.category)\n );\n }\n\n /**\n * Get a media descriptor for an email body attachment of a provided type.\n * Allowed body types are returned in the Conversation.limits().emailBodiesAllowedMimeTypes array.\n * @param type Type of email body to request, defaults to `text/plain`.\n */\n @validateTypes([nonEmptyString, \"undefined\"])\n public getEmailBody(type = \"text/plain\"): Media | null {\n return (\n this.getMediaByCategory([\"body\"])\n ?.filter((m) => m.contentType == type)\n .shift() ?? null\n );\n }\n\n /**\n * Get a media descriptor for an email history attachment of a provided type.\n * Allowed body types are returned in the Conversation.limits().emailHistoriesAllowedMimeTypes array.\n * @param type Type of email history to request, defaults to `text/plain`.\n */\n @validateTypes([nonEmptyString, \"undefined\"])\n public getEmailHistory(type = \"text/plain\"): Media | null {\n return (\n this.getMediaByCategory([\"history\"])\n ?.filter((m) => m.contentType == type)\n .shift() ?? null\n );\n }\n\n _update(data) {\n const updateReasons: MessageUpdateReason[] = [];\n\n if (\n (data.text || typeof data.text === \"string\") &&\n data.text !== this.state.body\n ) {\n this.state.body = data.text;\n updateReasons.push(\"body\");\n }\n\n if (data.subject && data.subject !== this.state.subject) {\n this.state.subject = data.subject;\n updateReasons.push(\"subject\");\n }\n\n if (data.lastUpdatedBy && data.lastUpdatedBy !== this.state.lastUpdatedBy) {\n this.state.lastUpdatedBy = data.lastUpdatedBy;\n updateReasons.push(\"lastUpdatedBy\");\n }\n\n if (data.author && data.author !== this.state.author) {\n this.state.author = data.author;\n updateReasons.push(\"author\");\n }\n\n if (\n data.dateUpdated &&\n new Date(data.dateUpdated).getTime() !==\n (this.state.dateUpdated && this.state.dateUpdated.getTime())\n ) {\n this.state.dateUpdated = new Date(data.dateUpdated);\n updateReasons.push(\"dateUpdated\");\n }\n\n if (\n data.timestamp &&\n new Date(data.timestamp).getTime() !==\n (this.state.timestamp && this.state.timestamp.getTime())\n ) {\n this.state.timestamp = new Date(data.timestamp);\n updateReasons.push(\"dateCreated\");\n }\n\n const updatedAttributes = parseAttributes(\n data.attributes,\n `Got malformed attributes for the message ${this.sid}`,\n log\n );\n if (!isEqual(this.state.attributes, updatedAttributes)) {\n this.state.attributes = updatedAttributes;\n updateReasons.push(\"attributes\");\n }\n\n const updatedAggregatedDelivery = data.delivery;\n const currentAggregatedDelivery = this.state.aggregatedDeliveryReceipt;\n const isUpdatedAggregateDeliveryValid =\n !!updatedAggregatedDelivery &&\n !!updatedAggregatedDelivery.total &&\n !!updatedAggregatedDelivery.delivered &&\n !!updatedAggregatedDelivery.failed &&\n !!updatedAggregatedDelivery.read &&\n !!updatedAggregatedDelivery.sent &&\n !!updatedAggregatedDelivery.undelivered;\n if (isUpdatedAggregateDeliveryValid) {\n if (!currentAggregatedDelivery) {\n this.state.aggregatedDeliveryReceipt = new AggregatedDeliveryReceipt(\n updatedAggregatedDelivery\n );\n updateReasons.push(\"deliveryReceipt\");\n } else if (\n !currentAggregatedDelivery._isEquals(updatedAggregatedDelivery)\n ) {\n currentAggregatedDelivery._update(updatedAggregatedDelivery);\n updateReasons.push(\"deliveryReceipt\");\n }\n }\n\n if (updateReasons.length > 0) {\n this.emit(\"updated\", { message: this, updateReasons: updateReasons });\n }\n }\n\n /**\n * Get the participant who is the author of the message.\n */\n public async getParticipant(): Promise<Participant> {\n let participant: Participant | null = null;\n if (this.state.participantSid) {\n participant = await this.conversation\n .getParticipantBySid(this.state.participantSid)\n .catch(() => {\n log.debug(\n `Participant with sid \"${this.participantSid}\" not found for message ${this.sid}`\n );\n return null;\n });\n }\n if (!participant && this.state.author) {\n participant = await this.conversation\n .getParticipantByIdentity(this.state.author)\n .catch(() => {\n log.debug(\n `Participant with identity \"${this.author}\" not found for message ${this.sid}`\n );\n return null;\n });\n }\n if (participant) {\n return participant;\n }\n let errorMesage = \"Participant with \";\n if (this.state.participantSid) {\n errorMesage += \"SID '\" + this.state.participantSid + \"' \";\n }\n if (this.state.author) {\n if (this.state.participantSid) {\n errorMesage += \"or \";\n }\n errorMesage += \"identity '\" + this.state.author + \"' \";\n }\n if (errorMesage === \"Participant with \") {\n errorMesage = \"Participant \";\n }\n errorMesage += \"was not found\";\n throw new Error(errorMesage);\n }\n\n /**\n * Get the delivery receipts of the message.\n */\n public async getDetailedDeliveryReceipts(): Promise<\n DetailedDeliveryReceipt[]\n > {\n let paginator: Paginator<DetailedDeliveryReceipt> =\n await this._getDetailedDeliveryReceiptsPaginator();\n let detailedDeliveryReceipts: DetailedDeliveryReceipt[] = [];\n\n while (true) {\n detailedDeliveryReceipts = [\n ...detailedDeliveryReceipts,\n ...paginator.items,\n ];\n\n if (!paginator.hasNextPage) {\n break;\n }\n\n paginator = await paginator.nextPage();\n }\n\n return detailedDeliveryReceipts;\n }\n\n /**\n * Remove the message.\n */\n public async remove(): Promise<Message> {\n await this.services.commandExecutor.mutateResource(\n \"delete\",\n this.links.self\n );\n\n return this;\n }\n\n /**\n * Edit the message body.\n * @param body New body of the message.\n */\n @validateTypesAsync(\"string\")\n public async updateBody(body: string): Promise<Message> {\n await this.services.commandExecutor.mutateResource<\n EditMessageRequest,\n MessageResponse\n >(\"post\", this.links.self, {\n body,\n });\n\n return this;\n }\n\n /**\n * Edit the message attributes.\n * @param attributes New attributes.\n */\n @validateTypesAsync(attributesValidator)\n public async updateAttributes(attributes: JSONValue): Promise<Message> {\n await this.services.commandExecutor.mutateResource<\n EditMessageRequest,\n MessageResponse\n >(\"post\", this.links.self, {\n attributes:\n typeof attributes !== \"undefined\"\n ? JSON.stringify(attributes)\n : undefined,\n });\n\n return this;\n }\n\n /**\n * Get content URLs for all media attachments in the given set using single operation.\n * @param contentSet Set of media attachments to query for content URL.\n */\n @validateTypesAsync(\n custom((value) => [\n value instanceof Array &&\n value.length > 0 &&\n value.reduce((a, c) => a && c instanceof Media, true),\n \"a non-empty array of Media\",\n ])\n )\n public async attachTemporaryUrlsFor(\n contentSet: Media[] | null\n ): Promise<Media[]> {\n // We ignore existing mcsMedia members of each of the media entries.\n // Instead we just collect their sids and pull new descriptors from a mediaSet GET endpoint.\n const sids = contentSet?.map((m) => m.sid);\n if (this.services.mcsClient && sids) {\n return (await this.services.mcsClient.mediaSetGet(sids)).map((item) => {\n return new Media(item, this.services);\n });\n } else {\n throw new Error(\"Media Content Service is unavailable\");\n }\n }\n\n private async _getDetailedDeliveryReceiptsPaginator(options?: {\n pageToken?: string;\n pageSize?: number;\n }): Promise<Paginator<DetailedDeliveryReceipt>> {\n const messagesReceiptsUrl = this.configuration.links.messagesReceipts\n .replace(\"%s\", this.conversation.sid)\n .replace(\"%s\", this.sid);\n const url = new UriBuilder(messagesReceiptsUrl)\n .arg(\"PageToken\", options?.pageToken as string)\n .arg(\"PageSize\", options?.pageSize as number)\n .build();\n const response = await this.services.network.get<\n { delivery_receipts: DeliveryReceiptResponse[] } & ResponseMeta\n >(url);\n\n return new RestPaginator<DetailedDeliveryReceipt>(\n response.body.delivery_receipts.map(\n (x) => new DetailedDeliveryReceipt(x)\n ),\n (pageToken, pageSize) =>\n this._getDetailedDeliveryReceiptsPaginator({ pageToken, pageSize }),\n response.body.meta.previous_token,\n response.body.meta.next_token\n );\n }\n}\n\nexport {\n Message,\n MessageServices,\n MessageType,\n MessageUpdateReason,\n MessageUpdatedEventArgs,\n};\n"],"names":["Logger","ReplayEventEmitter","index","parseAttributes","Media","AggregatedDeliveryReceipt","isEqual","UriBuilder","RestPaginator","DetailedDeliveryReceipt","__decorate","validateTypes","nonEmptyString","validateTypesAsync","attributesValidator","custom"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsCA,MAAM,GAAG,GAAGA,aAAM,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;AAsEpC;;;AAGA,MAAM,OAAQ,SAAQC,qCAAiC;;;;IAerD,YACEC,OAAa,EACb,IAAiB,EACjB,YAA0B,EAC1B,KAAmB,EACnB,aAA4B,EAC5B,QAAyB;;QAEzB,KAAK,EAAE,CAAC;QAER,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QAEjC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;QACnC,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QAEzB,IAAI,CAAC,KAAK,GAAG;YACX,GAAG,EAAE,IAAI,CAAC,GAAG;YACb,KAAK,EAAEA,OAAK;YACZ,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,IAAI,EAAE,MAAA,IAAI,CAAC,IAAI,mCAAI,IAAI;YACvB,SAAS,EAAE,IAAI,CAAC,SAAS,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,IAAI;YAC3D,WAAW,EAAE,IAAI,CAAC,WAAW,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,GAAG,IAAI;YACjE,a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AAE,IAAI,CAAC;QACvD,4BAA4B;KAC7B,CAAC,CACH;;;;qDAcA;;;;"}
|
@@ -130,7 +130,7 @@ This software includes platform.js under the following license.
|
|
130
130
|
|
131
131
|
Object.defineProperty(exports, '__esModule', { value: true });
|
132
132
|
|
133
|
-
var version = "2.1.0-rc.
|
133
|
+
var version = "2.1.0-rc.8";
|
134
134
|
|
135
135
|
exports.version = version;
|
136
136
|
//# sourceMappingURL=package.json.js.map
|