@twilio/conversations 2.0.1-rc.4 → 2.0.1-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.
Files changed (96) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/{dist → builds}/browser.js +1 -1
  3. package/{dist → builds}/browser.js.map +0 -0
  4. package/{dist → builds}/lib.d.ts +0 -0
  5. package/{dist → builds}/lib.js +1 -1
  6. package/{dist → builds}/lib.js.map +0 -0
  7. package/{dist → builds}/twilio-conversations.js +492 -259
  8. package/builds/twilio-conversations.min.js +156 -0
  9. package/dist/aggregated-delivery-receipt.js +227 -0
  10. package/dist/aggregated-delivery-receipt.js.map +1 -0
  11. package/dist/client.js +872 -0
  12. package/dist/client.js.map +1 -0
  13. package/dist/command-executor.js +203 -0
  14. package/dist/command-executor.js.map +1 -0
  15. package/dist/configuration.js +196 -0
  16. package/dist/configuration.js.map +1 -0
  17. package/dist/conversation.js +973 -0
  18. package/dist/conversation.js.map +1 -0
  19. package/dist/data/conversations.js +443 -0
  20. package/dist/data/conversations.js.map +1 -0
  21. package/dist/data/messages.js +341 -0
  22. package/dist/data/messages.js.map +1 -0
  23. package/dist/data/participants.js +313 -0
  24. package/dist/data/participants.js.map +1 -0
  25. package/dist/data/users.js +228 -0
  26. package/dist/data/users.js.map +1 -0
  27. package/dist/detailed-delivery-receipt.js +154 -0
  28. package/dist/detailed-delivery-receipt.js.map +1 -0
  29. package/dist/index.js +167 -0
  30. package/dist/index.js.map +1 -0
  31. package/dist/interfaces/notification-types.js +143 -0
  32. package/dist/interfaces/notification-types.js.map +1 -0
  33. package/dist/logger.js +190 -0
  34. package/dist/logger.js.map +1 -0
  35. package/dist/media.js +213 -0
  36. package/dist/media.js.map +1 -0
  37. package/dist/message-builder.js +209 -0
  38. package/dist/message-builder.js.map +1 -0
  39. package/dist/message.js +450 -0
  40. package/dist/message.js.map +1 -0
  41. package/dist/node_modules/tslib/tslib.es6.js +161 -0
  42. package/dist/node_modules/tslib/tslib.es6.js.map +1 -0
  43. package/dist/packages/conversations/package.json.js +136 -0
  44. package/dist/packages/conversations/package.json.js.map +1 -0
  45. package/dist/participant.js +346 -0
  46. package/dist/participant.js.map +1 -0
  47. package/dist/push-notification.js +152 -0
  48. package/dist/push-notification.js.map +1 -0
  49. package/dist/rest-paginator.js +175 -0
  50. package/dist/rest-paginator.js.map +1 -0
  51. package/dist/services/network.js +205 -0
  52. package/dist/services/network.js.map +1 -0
  53. package/dist/services/typing-indicator.js +235 -0
  54. package/dist/services/typing-indicator.js.map +1 -0
  55. package/dist/unsent-message.js +159 -0
  56. package/dist/unsent-message.js.map +1 -0
  57. package/dist/user.js +392 -0
  58. package/dist/user.js.map +1 -0
  59. package/dist/util/deferred.js +154 -0
  60. package/dist/util/deferred.js.map +1 -0
  61. package/dist/util/index.js +206 -0
  62. package/dist/util/index.js.map +1 -0
  63. package/{dist/docs → docs}/assets/css/main.css +0 -0
  64. package/{dist/docs → docs}/assets/images/icons.png +0 -0
  65. package/{dist/docs → docs}/assets/images/icons@2x.png +0 -0
  66. package/{dist/docs → docs}/assets/images/widgets.png +0 -0
  67. package/{dist/docs → docs}/assets/images/widgets@2x.png +0 -0
  68. package/{dist/docs → docs}/assets/js/main.js +0 -0
  69. package/{dist/docs → docs}/assets/js/search.js +0 -0
  70. package/{dist/docs → docs}/classes/AggregatedDeliveryReceipt.html +0 -0
  71. package/{dist/docs → docs}/classes/Client.html +0 -0
  72. package/{dist/docs → docs}/classes/Conversation.html +0 -0
  73. package/{dist/docs → docs}/classes/DetailedDeliveryReceipt.html +0 -0
  74. package/{dist/docs → docs}/classes/Media.html +0 -0
  75. package/{dist/docs → docs}/classes/Message.html +0 -0
  76. package/{dist/docs → docs}/classes/MessageBuilder.html +0 -0
  77. package/{dist/docs → docs}/classes/Participant.html +0 -0
  78. package/{dist/docs → docs}/classes/PushNotification.html +0 -0
  79. package/{dist/docs → docs}/classes/RestPaginator.html +0 -0
  80. package/{dist/docs → docs}/classes/UnsentMessage.html +0 -0
  81. package/{dist/docs → docs}/classes/User.html +0 -0
  82. package/{dist/docs → docs}/index.html +0 -0
  83. package/{dist/docs → docs}/interfaces/ClientOptions.html +0 -0
  84. package/{dist/docs → docs}/interfaces/ConversationState.html +0 -0
  85. package/{dist/docs → docs}/interfaces/CreateConversationOptions.html +0 -0
  86. package/{dist/docs → docs}/interfaces/LastMessage.html +0 -0
  87. package/{dist/docs → docs}/interfaces/Paginator.html +0 -0
  88. package/{dist/docs → docs}/interfaces/PushNotificationData.html +0 -0
  89. package/{dist/docs → docs}/interfaces/SendEmailOptions.html +0 -0
  90. package/{dist/docs → docs}/interfaces/SendMediaOptions.html +0 -0
  91. package/{dist/docs → docs}/modules.html +0 -0
  92. package/package.json +24 -25
  93. package/dist/post-install.js +0 -29
  94. package/dist/react-native.js +0 -4035
  95. package/dist/react-native.js.map +0 -1
  96. package/dist/twilio-conversations.min.js +0 -156
@@ -0,0 +1,450 @@
1
+ /*
2
+ @license
3
+ The following license applies to all parts of this software except as
4
+ documented below.
5
+
6
+ Copyright (c) 2019, Twilio, inc.
7
+ All rights reserved.
8
+
9
+ Redistribution and use in source and binary forms, with or without
10
+ modification, are permitted provided that the following conditions are
11
+ met:
12
+
13
+ 1. Redistributions of source code must retain the above copyright
14
+ notice, this list of conditions and the following disclaimer.
15
+
16
+ 2. Redistributions in binary form must reproduce the above copyright
17
+ notice, this list of conditions and the following disclaimer in
18
+ the documentation and/or other materials provided with the
19
+ distribution.
20
+
21
+ 3. Neither the name of Twilio nor the names of its contributors may
22
+ be used to endorse or promote products derived from this software
23
+ without specific prior written permission.
24
+
25
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
26
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
27
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
28
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
29
+ HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
30
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
31
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
32
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
33
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
34
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
35
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36
+
37
+ This software includes javascript-state-machine under the following license.
38
+
39
+ Copyright (c) 2012, 2013, 2014, 2015, Jake Gordon and contributors
40
+
41
+ Permission is hereby granted, free of charge, to any person obtaining a copy
42
+ of this software and associated documentation files (the "Software"), to deal
43
+ in the Software without restriction, including without limitation the rights
44
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
45
+ copies of the Software, and to permit persons to whom the Software is
46
+ furnished to do so, subject to the following conditions:
47
+
48
+ The above copyright notice and this permission notice shall be included in all
49
+ copies or substantial portions of the Software.
50
+
51
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
52
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
53
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
54
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
55
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
56
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
57
+
58
+ This software includes loglevel under the following license.
59
+
60
+ Copyright (c) 2013 Tim Perry
61
+
62
+ Permission is hereby granted, free of charge, to any person
63
+ obtaining a copy of this software and associated documentation
64
+ files (the "Software"), to deal in the Software without
65
+ restriction, including without limitation the rights to use,
66
+ copy, modify, merge, publish, distribute, sublicense, and/or sell
67
+ copies of the Software, and to permit persons to whom the
68
+ Software is furnished to do so, subject to the following
69
+ conditions:
70
+
71
+ The above copyright notice and this permission notice shall be
72
+ included in all copies or substantial portions of the Software.
73
+
74
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
75
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
76
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
77
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
78
+ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
79
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
80
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
81
+ OTHER DEALINGS IN THE SOFTWARE.
82
+
83
+ This software includes q under the following license.
84
+
85
+ Copyright 2009–2014 Kristopher Michael Kowal. All rights reserved.
86
+ Permission is hereby granted, free of charge, to any person obtaining a copy
87
+ of this software and associated documentation files (the "Software"), to
88
+ deal in the Software without restriction, including without limitation the
89
+ rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
90
+ sell copies of the Software, and to permit persons to whom the Software is
91
+ furnished to do so, subject to the following conditions:
92
+
93
+ The above copyright notice and this permission notice shall be included in
94
+ all copies or substantial portions of the Software.
95
+
96
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
97
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
98
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
99
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
100
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
101
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
102
+ IN THE SOFTWARE.
103
+
104
+ This software includes platform.js under the following license.
105
+
106
+ Copyright 2014 Benjamin Tan <https://d10.github.io/>
107
+ Copyright 2011-2015 John-David Dalton <http://allyoucanleet.com/>
108
+
109
+ Permission is hereby granted, free of charge, to any person obtaining
110
+ a copy of this software and associated documentation files (the
111
+ "Software"), to deal in the Software without restriction, including
112
+ without limitation the rights to use, copy, modify, merge, publish,
113
+ distribute, sublicense, and/or sell copies of the Software, and to
114
+ permit persons to whom the Software is furnished to do so, subject to
115
+ the following conditions:
116
+
117
+ The above copyright notice and this permission notice shall be
118
+ included in all copies or substantial portions of the Software.
119
+
120
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
121
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
122
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
123
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
124
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
125
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
126
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
127
+
128
+ */
129
+ 'use strict';
130
+
131
+ Object.defineProperty(exports, '__esModule', { value: true });
132
+
133
+ var tslib_es6 = require('./node_modules/tslib/tslib.es6.js');
134
+ var index = require('./util/index.js');
135
+ var logger = require('./logger.js');
136
+ var media = require('./media.js');
137
+ var aggregatedDeliveryReceipt = require('./aggregated-delivery-receipt.js');
138
+ var declarativeTypeValidator = require('@twilio/declarative-type-validator');
139
+ var restPaginator = require('./rest-paginator.js');
140
+ var detailedDeliveryReceipt = require('./detailed-delivery-receipt.js');
141
+ var replayEventEmitter = require('@twilio/replay-event-emitter');
142
+ var isEqual = require('lodash.isequal');
143
+
144
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
145
+
146
+ var isEqual__default = /*#__PURE__*/_interopDefaultLegacy(isEqual);
147
+
148
+ const log = logger.Logger.scope('Message');
149
+ /**
150
+ * A message in a conversation.
151
+ */
152
+ class Message extends replayEventEmitter.ReplayEventEmitter {
153
+ /**
154
+ * @internal
155
+ */
156
+ constructor(index$1, data, conversation, links, configuration, services) {
157
+ var _a, _b, _c, _d, _e;
158
+ super();
159
+ this.conversation = conversation;
160
+ this.links = links;
161
+ this.configuration = configuration;
162
+ this.services = services;
163
+ this.state = {
164
+ sid: data.sid,
165
+ index: index$1,
166
+ author: (_a = data.author) !== null && _a !== void 0 ? _a : null,
167
+ subject: (_b = data.subject) !== null && _b !== void 0 ? _b : null,
168
+ body: data.text,
169
+ timestamp: data.timestamp ? new Date(data.timestamp) : null,
170
+ dateUpdated: data.dateUpdated ? new Date(data.dateUpdated) : null,
171
+ lastUpdatedBy: (_c = data.lastUpdatedBy) !== null && _c !== void 0 ? _c : null,
172
+ attributes: index.parseAttributes(data.attributes, `Got malformed attributes for the message ${data.sid}`, log),
173
+ type: (_d = data.type) !== null && _d !== void 0 ? _d : 'text',
174
+ media: (data.type && data.type === 'media' && data.media)
175
+ ? new media.Media(data.media, this.services) : null,
176
+ medias: (data.type && data.type === 'media' && data.medias)
177
+ ? data.medias.map((m) => new media.Media(m, this.services)) : null,
178
+ participantSid: (_e = data.memberSid) !== null && _e !== void 0 ? _e : null,
179
+ aggregatedDeliveryReceipt: data.delivery ? new aggregatedDeliveryReceipt.AggregatedDeliveryReceipt(data.delivery) : null
180
+ };
181
+ }
182
+ /**
183
+ * The server-assigned unique identifier for the message.
184
+ */
185
+ get sid() { return this.state.sid; }
186
+ /**
187
+ * Name of the user that sent the message.
188
+ */
189
+ get author() { return this.state.author; }
190
+ /**
191
+ * Message subject. Used only in email conversations.
192
+ */
193
+ get subject() { return this.state.subject; }
194
+ /**
195
+ * Body of the message.
196
+ */
197
+ get body() { return this.state.body; }
198
+ /**
199
+ * Date this message was last updated on.
200
+ */
201
+ get dateUpdated() { return this.state.dateUpdated; }
202
+ /**
203
+ * Index of the message in the conversation's messages list.
204
+ * By design of the Conversations system, the message indices may have arbitrary gaps between them,
205
+ * that does not necessarily mean they were deleted or otherwise modified - just that
206
+ * messages may have some non-contiguous indices even if they are being sent immediately one after another.
207
+ *
208
+ * Trying to use indices for some calculations is going to be unreliable.
209
+ *
210
+ * To calculate the number of unread messages it is better to use the read horizon API.
211
+ * See {@link Conversation.getUnreadMessagesCount} for details.
212
+ */
213
+ get index() { return this.state.index; }
214
+ /**
215
+ * Identity of the last user that updated the message.
216
+ */
217
+ get lastUpdatedBy() { return this.state.lastUpdatedBy; }
218
+ /**
219
+ * Date this message was created on.
220
+ */
221
+ get dateCreated() { return this.state.timestamp; }
222
+ /**
223
+ * Custom attributes of the message.
224
+ */
225
+ get attributes() { return this.state.attributes; }
226
+ /**
227
+ * Push notification type of the message.
228
+ */
229
+ get type() { return this.state.type; }
230
+ /**
231
+ * One of the attached media.
232
+ * @deprecated Use attachedMedia instead. Note that the latter is now an array.
233
+ */
234
+ get media() { return this.state.media; }
235
+ /**
236
+ * Return all media attachments, except email body/history attachments, without temporary urls.
237
+ */
238
+ get attachedMedia() { return this.getMediaByCategory(['media']); }
239
+ /**
240
+ * The server-assigned unique identifier of the authoring participant.
241
+ */
242
+ get participantSid() { return this.state.participantSid; }
243
+ /**
244
+ * Aggregated information about the message delivery statuses across all participants of a conversation..
245
+ */
246
+ get aggregatedDeliveryReceipt() {
247
+ return this.state.aggregatedDeliveryReceipt;
248
+ }
249
+ /**
250
+ * Return a (possibly empty) array of media matching a specific set of categories.
251
+ * Allowed category is so far only 'media'.
252
+ * @param categories Array of categories to match.
253
+ * @returns Array of media descriptors matching given categories.
254
+ */
255
+ getMediaByCategory(categories) {
256
+ var _a;
257
+ return (_a = this.state.medias) === null || _a === void 0 ? void 0 : _a.filter((m) => categories.includes(m.category));
258
+ }
259
+ _update(data) {
260
+ let updateReasons = [];
261
+ if ((data.text || ((typeof data.text) === 'string')) && data.text !== this.state.body) {
262
+ this.state.body = data.text;
263
+ updateReasons.push('body');
264
+ }
265
+ if (data.subject && data.subject !== this.state.subject) {
266
+ this.state.subject = data.subject;
267
+ updateReasons.push('subject');
268
+ }
269
+ if (data.lastUpdatedBy && data.lastUpdatedBy !== this.state.lastUpdatedBy) {
270
+ this.state.lastUpdatedBy = data.lastUpdatedBy;
271
+ updateReasons.push('lastUpdatedBy');
272
+ }
273
+ if (data.author && data.author !== this.state.author) {
274
+ this.state.author = data.author;
275
+ updateReasons.push('author');
276
+ }
277
+ if (data.dateUpdated &&
278
+ new Date(data.dateUpdated).getTime() !== (this.state.dateUpdated && this.state.dateUpdated.getTime())) {
279
+ this.state.dateUpdated = new Date(data.dateUpdated);
280
+ updateReasons.push('dateUpdated');
281
+ }
282
+ if (data.timestamp &&
283
+ new Date(data.timestamp).getTime() !== (this.state.timestamp && this.state.timestamp.getTime())) {
284
+ this.state.timestamp = new Date(data.timestamp);
285
+ updateReasons.push('dateCreated');
286
+ }
287
+ let updatedAttributes = index.parseAttributes(data.attributes, `Got malformed attributes for the message ${this.sid}`, log);
288
+ if (!isEqual__default['default'](this.state.attributes, updatedAttributes)) {
289
+ this.state.attributes = updatedAttributes;
290
+ updateReasons.push('attributes');
291
+ }
292
+ let updatedAggregatedDelivery = data.delivery;
293
+ let currentAggregatedDelivery = this.state.aggregatedDeliveryReceipt;
294
+ let isUpdatedAggregateDeliveryValid = !!updatedAggregatedDelivery && !!updatedAggregatedDelivery.total &&
295
+ !!updatedAggregatedDelivery.delivered && !!updatedAggregatedDelivery.failed && !!updatedAggregatedDelivery.read &&
296
+ !!updatedAggregatedDelivery.sent && !!updatedAggregatedDelivery.undelivered;
297
+ if (isUpdatedAggregateDeliveryValid) {
298
+ if (!currentAggregatedDelivery) {
299
+ this.state.aggregatedDeliveryReceipt = new aggregatedDeliveryReceipt.AggregatedDeliveryReceipt(updatedAggregatedDelivery);
300
+ updateReasons.push('deliveryReceipt');
301
+ }
302
+ else if (!currentAggregatedDelivery._isEquals(updatedAggregatedDelivery)) {
303
+ currentAggregatedDelivery._update(updatedAggregatedDelivery);
304
+ updateReasons.push('deliveryReceipt');
305
+ }
306
+ }
307
+ if (updateReasons.length > 0) {
308
+ this.emit('updated', { message: this, updateReasons: updateReasons });
309
+ }
310
+ }
311
+ /**
312
+ * Get the participant who is the author of the message.
313
+ */
314
+ async getParticipant() {
315
+ let participant = null;
316
+ if (this.state.participantSid) {
317
+ participant = await this.conversation.getParticipantBySid(this.participantSid)
318
+ .catch(() => {
319
+ log.debug(`Participant with sid "${this.participantSid}" not found for message ${this.sid}`);
320
+ return null;
321
+ });
322
+ }
323
+ if (!participant && this.state.author) {
324
+ participant = await this.conversation.getParticipantByIdentity(this.state.author)
325
+ .catch(() => {
326
+ log.debug(`Participant with identity "${this.author}" not found for message ${this.sid}`);
327
+ return null;
328
+ });
329
+ }
330
+ if (participant) {
331
+ return participant;
332
+ }
333
+ let errorMesage = 'Participant with ';
334
+ if (this.state.participantSid) {
335
+ errorMesage += 'SID \'' + this.state.participantSid + '\' ';
336
+ }
337
+ if (this.state.author) {
338
+ if (this.state.participantSid) {
339
+ errorMesage += 'or ';
340
+ }
341
+ errorMesage += 'identity \'' + this.state.author + '\' ';
342
+ }
343
+ if (errorMesage === 'Participant with ') {
344
+ errorMesage = 'Participant ';
345
+ }
346
+ errorMesage += 'was not found';
347
+ throw new Error(errorMesage);
348
+ }
349
+ /**
350
+ * Get the delivery receipts of the message.
351
+ */
352
+ async getDetailedDeliveryReceipts() {
353
+ let paginator = await this._getDetailedDeliveryReceiptsPaginator();
354
+ let detailedDeliveryReceipts = [];
355
+ while (true) {
356
+ detailedDeliveryReceipts = [...detailedDeliveryReceipts, ...paginator.items];
357
+ if (!paginator.hasNextPage) {
358
+ break;
359
+ }
360
+ paginator = await paginator.nextPage();
361
+ }
362
+ return detailedDeliveryReceipts;
363
+ }
364
+ /**
365
+ * Remove the message.
366
+ */
367
+ async remove() {
368
+ await this.services.commandExecutor.mutateResource('delete', this.links.self);
369
+ return this;
370
+ }
371
+ /**
372
+ * Edit the message body.
373
+ * @param body New body of the message.
374
+ */
375
+ async updateBody(body) {
376
+ await this.services.commandExecutor.mutateResource('post', this.links.self, {
377
+ body
378
+ });
379
+ return this;
380
+ }
381
+ /**
382
+ * Edit the message attributes.
383
+ * @param attributes New attributes.
384
+ */
385
+ async updateAttributes(attributes) {
386
+ await this.services.commandExecutor.mutateResource('post', this.links.self, {
387
+ attributes: typeof attributes !== 'undefined' ? JSON.stringify(attributes) : undefined
388
+ });
389
+ return this;
390
+ }
391
+ /**
392
+ * Get content URLs for all media attachments in the given set using single operation.
393
+ * @param contentSet Set of media attachments to query for content URL.
394
+ */
395
+ async attachTemporaryUrlsFor(contentSet) {
396
+ // We ignore existing mcsMedia members of each of the media entries.
397
+ // Instead we just collect their sids and pull new descriptors from a mediaSet GET endpoint.
398
+ const sids = contentSet.map((m) => m.sid);
399
+ if (this.services.mcsClient) {
400
+ return (await this.services.mcsClient.mediaSetGet(sids)).map((item) => { return new media.Media(item, this.services); });
401
+ }
402
+ else {
403
+ throw new Error('Media Content Service is unavailable');
404
+ }
405
+ }
406
+ async _getDetailedDeliveryReceiptsPaginator(options) {
407
+ const messagesReceiptsUrl = this.configuration.links.messagesReceipts
408
+ .replace('%s', this.conversation.sid)
409
+ .replace('%s', this.sid);
410
+ const url = new index.UriBuilder(messagesReceiptsUrl)
411
+ .arg('PageToken', options === null || options === void 0 ? void 0 : options.pageToken)
412
+ .arg('PageSize', options === null || options === void 0 ? void 0 : options.pageSize)
413
+ .build();
414
+ const response = await this.services.network.get(url);
415
+ 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);
416
+ }
417
+ }
418
+ /**
419
+ * Fired when the properties or the body of the message has been updated.
420
+ *
421
+ * Parameters:
422
+ * 1. object `data` - info object provided with the event. It has the following properties:
423
+ * * {@link Message} message - the message in question
424
+ * * {@link MessageUpdateReason}[] updateReasons - array of reasons for the update
425
+ */
426
+ Message.updated = 'updated';
427
+ tslib_es6.__decorate([
428
+ declarativeTypeValidator.validateTypesAsync('string'),
429
+ tslib_es6.__metadata("design:type", Function),
430
+ tslib_es6.__metadata("design:paramtypes", [String]),
431
+ tslib_es6.__metadata("design:returntype", Promise)
432
+ ], Message.prototype, "updateBody", null);
433
+ tslib_es6.__decorate([
434
+ declarativeTypeValidator.validateTypesAsync(['string', 'number', 'boolean', 'object', declarativeTypeValidator.literal(null)]),
435
+ tslib_es6.__metadata("design:type", Function),
436
+ tslib_es6.__metadata("design:paramtypes", [Object]),
437
+ tslib_es6.__metadata("design:returntype", Promise)
438
+ ], Message.prototype, "updateAttributes", null);
439
+ tslib_es6.__decorate([
440
+ declarativeTypeValidator.validateTypesAsync(declarativeTypeValidator.custom(value => [
441
+ value instanceof Array && value.length > 0 && value.reduce((a, c) => a && c instanceof media.Media),
442
+ 'a non-empty array of Media'
443
+ ])),
444
+ tslib_es6.__metadata("design:type", Function),
445
+ tslib_es6.__metadata("design:paramtypes", [Array]),
446
+ tslib_es6.__metadata("design:returntype", Promise)
447
+ ], Message.prototype, "attachTemporaryUrlsFor", null);
448
+
449
+ exports.Message = Message;
450
+ //# sourceMappingURL=message.js.map
@@ -0,0 +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 { validateTypesAsync, literal, custom } from '@twilio/declarative-type-validator';\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 * Push notification type of the message.\n */\n public get type(): MessageType { return this.state.type; }\n\n /**\n * One of the attached media.\n * @deprecated Use attachedMedia instead. Note that the latter is now an array.\n */\n public get media(): Media { 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 _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(['string', 'number', 'boolean', 'object', literal(null)])\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),\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","validateTypesAsync","literal","custom"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0BA,MAAM,GAAG,GAAGA,aAAM,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;AAsDpC;;;AAGA,MAAM,OAAQ,SAAQC,qCAAiC;;;;IAerD,Y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AAK,CAAC,MAAM,GAAG,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,YAAYT,WAAK,CAAC;QAC7F,4BAA4B;KAC7B,CAAC,CAAC;;;;qDAUF;;;;"}
@@ -0,0 +1,161 @@
1
+ /*
2
+ @license
3
+ The following license applies to all parts of this software except as
4
+ documented below.
5
+
6
+ Copyright (c) 2019, Twilio, inc.
7
+ All rights reserved.
8
+
9
+ Redistribution and use in source and binary forms, with or without
10
+ modification, are permitted provided that the following conditions are
11
+ met:
12
+
13
+ 1. Redistributions of source code must retain the above copyright
14
+ notice, this list of conditions and the following disclaimer.
15
+
16
+ 2. Redistributions in binary form must reproduce the above copyright
17
+ notice, this list of conditions and the following disclaimer in
18
+ the documentation and/or other materials provided with the
19
+ distribution.
20
+
21
+ 3. Neither the name of Twilio nor the names of its contributors may
22
+ be used to endorse or promote products derived from this software
23
+ without specific prior written permission.
24
+
25
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
26
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
27
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
28
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
29
+ HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
30
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
31
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
32
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
33
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
34
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
35
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36
+
37
+ This software includes javascript-state-machine under the following license.
38
+
39
+ Copyright (c) 2012, 2013, 2014, 2015, Jake Gordon and contributors
40
+
41
+ Permission is hereby granted, free of charge, to any person obtaining a copy
42
+ of this software and associated documentation files (the "Software"), to deal
43
+ in the Software without restriction, including without limitation the rights
44
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
45
+ copies of the Software, and to permit persons to whom the Software is
46
+ furnished to do so, subject to the following conditions:
47
+
48
+ The above copyright notice and this permission notice shall be included in all
49
+ copies or substantial portions of the Software.
50
+
51
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
52
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
53
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
54
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
55
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
56
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
57
+
58
+ This software includes loglevel under the following license.
59
+
60
+ Copyright (c) 2013 Tim Perry
61
+
62
+ Permission is hereby granted, free of charge, to any person
63
+ obtaining a copy of this software and associated documentation
64
+ files (the "Software"), to deal in the Software without
65
+ restriction, including without limitation the rights to use,
66
+ copy, modify, merge, publish, distribute, sublicense, and/or sell
67
+ copies of the Software, and to permit persons to whom the
68
+ Software is furnished to do so, subject to the following
69
+ conditions:
70
+
71
+ The above copyright notice and this permission notice shall be
72
+ included in all copies or substantial portions of the Software.
73
+
74
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
75
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
76
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
77
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
78
+ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
79
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
80
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
81
+ OTHER DEALINGS IN THE SOFTWARE.
82
+
83
+ This software includes q under the following license.
84
+
85
+ Copyright 2009–2014 Kristopher Michael Kowal. All rights reserved.
86
+ Permission is hereby granted, free of charge, to any person obtaining a copy
87
+ of this software and associated documentation files (the "Software"), to
88
+ deal in the Software without restriction, including without limitation the
89
+ rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
90
+ sell copies of the Software, and to permit persons to whom the Software is
91
+ furnished to do so, subject to the following conditions:
92
+
93
+ The above copyright notice and this permission notice shall be included in
94
+ all copies or substantial portions of the Software.
95
+
96
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
97
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
98
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
99
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
100
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
101
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
102
+ IN THE SOFTWARE.
103
+
104
+ This software includes platform.js under the following license.
105
+
106
+ Copyright 2014 Benjamin Tan <https://d10.github.io/>
107
+ Copyright 2011-2015 John-David Dalton <http://allyoucanleet.com/>
108
+
109
+ Permission is hereby granted, free of charge, to any person obtaining
110
+ a copy of this software and associated documentation files (the
111
+ "Software"), to deal in the Software without restriction, including
112
+ without limitation the rights to use, copy, modify, merge, publish,
113
+ distribute, sublicense, and/or sell copies of the Software, and to
114
+ permit persons to whom the Software is furnished to do so, subject to
115
+ the following conditions:
116
+
117
+ The above copyright notice and this permission notice shall be
118
+ included in all copies or substantial portions of the Software.
119
+
120
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
121
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
122
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
123
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
124
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
125
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
126
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
127
+
128
+ */
129
+ 'use strict';
130
+
131
+ Object.defineProperty(exports, '__esModule', { value: true });
132
+
133
+ /*! *****************************************************************************
134
+ Copyright (c) Microsoft Corporation.
135
+
136
+ Permission to use, copy, modify, and/or distribute this software for any
137
+ purpose with or without fee is hereby granted.
138
+
139
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
140
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
141
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
142
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
143
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
144
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
145
+ PERFORMANCE OF THIS SOFTWARE.
146
+ ***************************************************************************** */
147
+
148
+ function __decorate(decorators, target, key, desc) {
149
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
150
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
151
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
152
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
153
+ }
154
+
155
+ function __metadata(metadataKey, metadataValue) {
156
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
157
+ }
158
+
159
+ exports.__decorate = __decorate;
160
+ exports.__metadata = __metadata;
161
+ //# sourceMappingURL=tslib.es6.js.map