@twilio/mcs-client 0.5.3 → 0.6.0-canary.18
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/builds/browser.js +517 -362
- package/builds/browser.js.map +1 -1
- package/builds/lib.d.ts +54 -26
- package/builds/lib.js +517 -362
- package/builds/lib.js.map +1 -1
- package/builds/twilio-mcs-client.js +10206 -9443
- package/builds/twilio-mcs-client.min.js +24 -38
- package/dist/cancellable-promise.js +88 -0
- package/dist/cancellable-promise.js.map +1 -0
- package/dist/client.js +88 -23
- package/dist/client.js.map +1 -1
- package/dist/configuration.js.map +1 -1
- package/dist/index.js +5 -9
- package/dist/index.js.map +1 -1
- package/dist/logger.js +2 -4
- package/dist/logger.js.map +1 -1
- package/dist/media.js +15 -22
- package/dist/media.js.map +1 -1
- package/dist/node_modules/tslib/tslib.es6.js +1 -1
- package/dist/node_modules/tslib/tslib.es6.js.map +1 -1
- package/dist/packages/mcs-client/package.json.js +1 -1
- package/dist/services/network.js +48 -31
- package/dist/services/network.js.map +1 -1
- package/dist/services/transport.js +11 -5
- package/dist/services/transport.js.map +1 -1
- package/dist/services/transporterror.js.map +1 -1
- package/package.json +15 -12
- package/CHANGELOG.md +0 -210
package/builds/browser.js
CHANGED
|
@@ -28,9 +28,13 @@ var global =
|
|
|
28
28
|
|
|
29
29
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
30
30
|
|
|
31
|
+
require('core-js/modules/es.promise.js');
|
|
31
32
|
var _asyncToGenerator = require('@babel/runtime/helpers/asyncToGenerator');
|
|
32
33
|
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
33
|
-
require('core-js/modules/es.
|
|
34
|
+
require('core-js/modules/es.array.iterator.js');
|
|
35
|
+
require('core-js/modules/es.map.js');
|
|
36
|
+
require('core-js/modules/web.dom-collections.iterator.js');
|
|
37
|
+
require('core-js/modules/web.dom-collections.for-each.js');
|
|
34
38
|
var _regeneratorRuntime = require('@babel/runtime/regenerator');
|
|
35
39
|
require('core-js/modules/es.array.from.js');
|
|
36
40
|
var log$2 = require('loglevel');
|
|
@@ -38,33 +42,31 @@ require('core-js/modules/es.string.starts-with.js');
|
|
|
38
42
|
require('core-js/modules/es.array.reduce.js');
|
|
39
43
|
require('core-js/modules/es.regexp.exec.js');
|
|
40
44
|
require('core-js/modules/es.string.split.js');
|
|
45
|
+
require('core-js/modules/es.json.stringify.js');
|
|
41
46
|
require('core-js/modules/es.object.assign.js');
|
|
42
|
-
require('core-js/modules/es.array.iterator.js');
|
|
43
|
-
require('core-js/modules/web.dom-collections.iterator.js');
|
|
44
47
|
require('core-js/modules/web.url.js');
|
|
48
|
+
require('core-js/modules/web.url-search-params.js');
|
|
45
49
|
var operationRetrier = require('@twilio/operation-retrier');
|
|
46
50
|
var declarativeTypeValidator = require('@twilio/declarative-type-validator');
|
|
47
51
|
|
|
48
52
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
49
53
|
|
|
50
54
|
function _interopNamespace(e) {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
return e[k];
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
}
|
|
55
|
+
if (e && e.__esModule) return e;
|
|
56
|
+
var n = Object.create(null);
|
|
57
|
+
if (e) {
|
|
58
|
+
Object.keys(e).forEach(function (k) {
|
|
59
|
+
if (k !== 'default') {
|
|
60
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
61
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
62
|
+
enumerable: true,
|
|
63
|
+
get: function () { return e[k]; }
|
|
64
64
|
});
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
n["default"] = e;
|
|
69
|
+
return Object.freeze(n);
|
|
68
70
|
}
|
|
69
71
|
|
|
70
72
|
var _asyncToGenerator__default = /*#__PURE__*/_interopDefaultLegacy(_asyncToGenerator);
|
|
@@ -72,7 +74,67 @@ var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_definePropert
|
|
|
72
74
|
var _regeneratorRuntime__default = /*#__PURE__*/_interopDefaultLegacy(_regeneratorRuntime);
|
|
73
75
|
var log__namespace = /*#__PURE__*/_interopNamespace(log$2);
|
|
74
76
|
|
|
75
|
-
|
|
77
|
+
/**
|
|
78
|
+
* Cancellable promise. Extends the functionality of the native Promise to include the cancel method.
|
|
79
|
+
*
|
|
80
|
+
* Example:
|
|
81
|
+
*
|
|
82
|
+
* ```ts
|
|
83
|
+
*
|
|
84
|
+
* const cancellableFetchPromise = new CancellablePromise(async (resolve, reject, onCancel) => {
|
|
85
|
+
* const request = fetch("https://example.com/");
|
|
86
|
+
*
|
|
87
|
+
* onCancel(() => request.cancel());
|
|
88
|
+
*
|
|
89
|
+
* try {
|
|
90
|
+
* const response = await request;
|
|
91
|
+
* resolve(response);
|
|
92
|
+
* } catch (err) {
|
|
93
|
+
* reject(err);
|
|
94
|
+
* }
|
|
95
|
+
* });
|
|
96
|
+
*
|
|
97
|
+
* cancellableFetchPromise.cancel();
|
|
98
|
+
* ```
|
|
99
|
+
*/
|
|
100
|
+
class CancellablePromise extends Promise {
|
|
101
|
+
/**
|
|
102
|
+
* Creates a new CancellablePromise.
|
|
103
|
+
* @param executor A callback used to initialize the promise. This callback is passed three arguments:
|
|
104
|
+
* a resolve callback used to resolve the promise with a value or the result of another promise,
|
|
105
|
+
* a reject callback used to reject the promise with a provided reason or error,
|
|
106
|
+
* and an onCancel callback used to define behavior of cancellation.
|
|
107
|
+
*/
|
|
108
|
+
constructor(executor) {
|
|
109
|
+
var outerCancellationFunction;
|
|
110
|
+
var outerRejectPromise;
|
|
111
|
+
super((resolve, reject) => {
|
|
112
|
+
outerRejectPromise = reject;
|
|
113
|
+
return executor(resolve, reject, cancellationFunction => {
|
|
114
|
+
outerCancellationFunction = cancellationFunction;
|
|
115
|
+
});
|
|
116
|
+
});
|
|
117
|
+
this.cancel = outerCancellationFunction;
|
|
118
|
+
this.rejectPromise = outerRejectPromise;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Cancels the promise and invokes the cancellation callback if it was defined during instantiation. Cancellation will result in the promise being rejected.
|
|
122
|
+
*/
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
cancel() {
|
|
126
|
+
if (this.onCancel) {
|
|
127
|
+
this.onCancel();
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
if (this.rejectPromise) {
|
|
131
|
+
this.rejectPromise(new Error("Promise was cancelled"));
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/******************************************************************************
|
|
76
138
|
Copyright (c) Microsoft Corporation.
|
|
77
139
|
|
|
78
140
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
@@ -105,7 +167,7 @@ function prepareLine(prefix, args) {
|
|
|
105
167
|
|
|
106
168
|
class Logger {
|
|
107
169
|
constructor(prefix) {
|
|
108
|
-
_defineProperty__default[
|
|
170
|
+
_defineProperty__default["default"](this, "prefix", "");
|
|
109
171
|
|
|
110
172
|
this.prefix = prefix !== null && prefix !== undefined && prefix.length > 0 ? prefix + " " : "";
|
|
111
173
|
}
|
|
@@ -259,6 +321,7 @@ class Configuration {
|
|
|
259
321
|
* @property {String} fileName - file name, if present, null otherwise
|
|
260
322
|
* @property {MediaCategory} category - attachment category
|
|
261
323
|
*/
|
|
324
|
+
|
|
262
325
|
class Media {
|
|
263
326
|
constructor(config, network, data) {
|
|
264
327
|
this.config = config;
|
|
@@ -311,79 +374,51 @@ class Media {
|
|
|
311
374
|
*
|
|
312
375
|
* It is reasonable to build your own refresh logic upon these two functions: as soon as URL returned
|
|
313
376
|
* by getCachedContentUrl() returns 40x status you should call getContentUrl() to refresh it.
|
|
314
|
-
*
|
|
315
|
-
* @returns {Promise<string>}
|
|
316
377
|
*/
|
|
317
378
|
|
|
318
379
|
|
|
319
380
|
getContentUrl() {
|
|
320
381
|
var _this = this;
|
|
321
382
|
|
|
322
|
-
return
|
|
323
|
-
var
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
}
|
|
343
|
-
}, _callee);
|
|
344
|
-
}))();
|
|
345
|
-
}
|
|
346
|
-
/**
|
|
347
|
-
* Returns direct content URL to uploaded binary. This URL will expire after some time.
|
|
348
|
-
* This function does not support getting a new URL however. Once set it will remain the same.
|
|
349
|
-
* Use getContentUrl() to query a new one.
|
|
350
|
-
*
|
|
351
|
-
* It is reasonable to build your own refresh logic upon these two functions: as soon as URL returned
|
|
352
|
-
* by getCachedContentUrl() returns 40x status you should call getContentUrl() to refresh it.
|
|
353
|
-
*
|
|
354
|
-
* @returns {Promise<string>}
|
|
355
|
-
*/
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
getCachedContentUrl() {
|
|
359
|
-
var _this2 = this;
|
|
360
|
-
|
|
361
|
-
return _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee2() {
|
|
362
|
-
return _regeneratorRuntime__default['default'].wrap(function _callee2$(_context2) {
|
|
363
|
-
while (1) {
|
|
364
|
-
switch (_context2.prev = _context2.next) {
|
|
365
|
-
case 0:
|
|
366
|
-
if (!_this2.state.contentDirectUrl) {
|
|
367
|
-
_context2.next = 2;
|
|
383
|
+
return new CancellablePromise( /*#__PURE__*/function () {
|
|
384
|
+
var _ref = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee(resolve, reject, onCancel) {
|
|
385
|
+
var request, response;
|
|
386
|
+
return _regeneratorRuntime__default["default"].wrap(function _callee$(_context) {
|
|
387
|
+
while (1) {
|
|
388
|
+
switch (_context.prev = _context.next) {
|
|
389
|
+
case 0:
|
|
390
|
+
request = _this.network.get("".concat(_this.config.mediaUrl, "/").concat(_this.sid));
|
|
391
|
+
onCancel(() => request.cancel());
|
|
392
|
+
_context.prev = 2;
|
|
393
|
+
_context.next = 5;
|
|
394
|
+
return request;
|
|
395
|
+
|
|
396
|
+
case 5:
|
|
397
|
+
response = _context.sent;
|
|
398
|
+
|
|
399
|
+
_this._update(response.body);
|
|
400
|
+
|
|
401
|
+
resolve(_this.state.contentDirectUrl);
|
|
402
|
+
_context.next = 13;
|
|
368
403
|
break;
|
|
369
|
-
}
|
|
370
404
|
|
|
371
|
-
|
|
405
|
+
case 10:
|
|
406
|
+
_context.prev = 10;
|
|
407
|
+
_context.t0 = _context["catch"](2);
|
|
408
|
+
reject(_context.t0);
|
|
372
409
|
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
case 4:
|
|
378
|
-
return _context2.abrupt("return", _context2.sent);
|
|
379
|
-
|
|
380
|
-
case 5:
|
|
381
|
-
case "end":
|
|
382
|
-
return _context2.stop();
|
|
410
|
+
case 13:
|
|
411
|
+
case "end":
|
|
412
|
+
return _context.stop();
|
|
413
|
+
}
|
|
383
414
|
}
|
|
384
|
-
}
|
|
385
|
-
}
|
|
386
|
-
|
|
415
|
+
}, _callee, null, [[2, 10]]);
|
|
416
|
+
}));
|
|
417
|
+
|
|
418
|
+
return function (_x, _x2, _x3) {
|
|
419
|
+
return _ref.apply(this, arguments);
|
|
420
|
+
};
|
|
421
|
+
}());
|
|
387
422
|
}
|
|
388
423
|
|
|
389
424
|
_update(data) {
|
|
@@ -455,64 +490,56 @@ function extractBody(xhr) {
|
|
|
455
490
|
|
|
456
491
|
class Transport {
|
|
457
492
|
static request(method, url, headers, body) {
|
|
458
|
-
return
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
var headers = parseResponseHeaders(xhr.getAllResponseHeaders());
|
|
473
|
-
var body = extractBody(xhr);
|
|
474
|
-
|
|
475
|
-
if (200 <= xhr.status && xhr.status < 300) {
|
|
476
|
-
resolve({
|
|
477
|
-
status: xhr.status,
|
|
478
|
-
headers,
|
|
479
|
-
body
|
|
480
|
-
});
|
|
481
|
-
} else {
|
|
482
|
-
var _xhr$statusText;
|
|
483
|
-
|
|
484
|
-
var status = (_xhr$statusText = xhr.statusText) !== null && _xhr$statusText !== void 0 ? _xhr$statusText : "NONE";
|
|
485
|
-
var bodyRepresentation;
|
|
486
|
-
|
|
487
|
-
if (typeof body === "string") {
|
|
488
|
-
bodyRepresentation = body && body.split("\n", 2).length === 1 ? body : "";
|
|
489
|
-
} else {
|
|
490
|
-
bodyRepresentation = JSON.stringify(body);
|
|
491
|
-
}
|
|
492
|
-
|
|
493
|
-
var message = "".concat(xhr.status, ": [").concat(status, "] ").concat(bodyRepresentation);
|
|
494
|
-
reject(new TransportError(message, xhr.status, body, status, headers));
|
|
495
|
-
}
|
|
496
|
-
};
|
|
493
|
+
return new CancellablePromise((resolve, reject, onCancel) => {
|
|
494
|
+
var xhr = new XHR();
|
|
495
|
+
var isCancelled = false;
|
|
496
|
+
onCancel(() => {
|
|
497
|
+
xhr.abort();
|
|
498
|
+
isCancelled = true;
|
|
499
|
+
});
|
|
500
|
+
xhr.open(method, url, true);
|
|
501
|
+
|
|
502
|
+
xhr.onreadystatechange = function onreadystatechange() {
|
|
503
|
+
if (xhr.readyState !== 4 || isCancelled) {
|
|
504
|
+
return;
|
|
505
|
+
}
|
|
497
506
|
|
|
498
|
-
|
|
499
|
-
|
|
507
|
+
var headers = parseResponseHeaders(xhr.getAllResponseHeaders());
|
|
508
|
+
var body = extractBody(xhr);
|
|
509
|
+
|
|
510
|
+
if (200 <= xhr.status && xhr.status < 300) {
|
|
511
|
+
resolve({
|
|
512
|
+
status: xhr.status,
|
|
513
|
+
headers,
|
|
514
|
+
body
|
|
515
|
+
});
|
|
516
|
+
} else {
|
|
517
|
+
var _xhr$statusText;
|
|
518
|
+
|
|
519
|
+
var status = (_xhr$statusText = xhr.statusText) !== null && _xhr$statusText !== void 0 ? _xhr$statusText : "NONE";
|
|
520
|
+
var bodyRepresentation;
|
|
521
|
+
|
|
522
|
+
if (typeof body === "string") {
|
|
523
|
+
bodyRepresentation = body && body.split("\n", 2).length === 1 ? body : "";
|
|
524
|
+
} else {
|
|
525
|
+
bodyRepresentation = JSON.stringify(body);
|
|
526
|
+
}
|
|
500
527
|
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
528
|
+
var message = "".concat(xhr.status, ": [").concat(status, "] ").concat(bodyRepresentation);
|
|
529
|
+
reject(new TransportError(message, xhr.status, body, status, headers));
|
|
530
|
+
}
|
|
531
|
+
};
|
|
505
532
|
|
|
506
|
-
|
|
507
|
-
|
|
533
|
+
for (var headerName in headers) {
|
|
534
|
+
xhr.setRequestHeader(headerName, headers[headerName]);
|
|
508
535
|
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
return _context.stop();
|
|
512
|
-
}
|
|
536
|
+
if (headerName === "Content-Type" && headers[headerName] === "application/json") {
|
|
537
|
+
body = JSON.stringify(body);
|
|
513
538
|
}
|
|
514
|
-
}
|
|
515
|
-
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
xhr.send(body);
|
|
542
|
+
});
|
|
516
543
|
}
|
|
517
544
|
/**
|
|
518
545
|
* Make a GET request by given URL
|
|
@@ -520,20 +547,7 @@ class Transport {
|
|
|
520
547
|
|
|
521
548
|
|
|
522
549
|
get(url, headers) {
|
|
523
|
-
return
|
|
524
|
-
return _regeneratorRuntime__default['default'].wrap(function _callee2$(_context2) {
|
|
525
|
-
while (1) {
|
|
526
|
-
switch (_context2.prev = _context2.next) {
|
|
527
|
-
case 0:
|
|
528
|
-
return _context2.abrupt("return", Transport.request("GET", url, headers));
|
|
529
|
-
|
|
530
|
-
case 1:
|
|
531
|
-
case "end":
|
|
532
|
-
return _context2.stop();
|
|
533
|
-
}
|
|
534
|
-
}
|
|
535
|
-
}, _callee2);
|
|
536
|
-
}))();
|
|
550
|
+
return Transport.request("GET", url, headers);
|
|
537
551
|
}
|
|
538
552
|
/**
|
|
539
553
|
* Make a POST request by given URL
|
|
@@ -541,20 +555,7 @@ class Transport {
|
|
|
541
555
|
|
|
542
556
|
|
|
543
557
|
post(url, headers, body) {
|
|
544
|
-
return
|
|
545
|
-
return _regeneratorRuntime__default['default'].wrap(function _callee3$(_context3) {
|
|
546
|
-
while (1) {
|
|
547
|
-
switch (_context3.prev = _context3.next) {
|
|
548
|
-
case 0:
|
|
549
|
-
return _context3.abrupt("return", Transport.request("POST", url, headers, body));
|
|
550
|
-
|
|
551
|
-
case 1:
|
|
552
|
-
case "end":
|
|
553
|
-
return _context3.stop();
|
|
554
|
-
}
|
|
555
|
-
}
|
|
556
|
-
}, _callee3);
|
|
557
|
-
}))();
|
|
558
|
+
return Transport.request("POST", url, headers, body);
|
|
558
559
|
}
|
|
559
560
|
|
|
560
561
|
}
|
|
@@ -580,22 +581,28 @@ class Network {
|
|
|
580
581
|
executeWithRetry(request, retryWhenThrottled) {
|
|
581
582
|
var _this = this;
|
|
582
583
|
|
|
583
|
-
return
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
584
|
+
return new CancellablePromise( /*#__PURE__*/function () {
|
|
585
|
+
var _ref2 = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee2(resolve, reject, onCancel) {
|
|
586
|
+
var retrier, codesToRetryOn;
|
|
587
|
+
return _regeneratorRuntime__default["default"].wrap(function _callee2$(_context2) {
|
|
588
|
+
while (1) {
|
|
589
|
+
switch (_context2.prev = _context2.next) {
|
|
590
|
+
case 0:
|
|
591
|
+
retrier = new operationRetrier.Retrier(_this.backoffConfig());
|
|
592
|
+
onCancel(() => {
|
|
593
|
+
request.cancel();
|
|
594
|
+
retrier.removeAllListeners();
|
|
595
|
+
retrier.cancel();
|
|
596
|
+
});
|
|
597
|
+
codesToRetryOn = [502, 503, 504];
|
|
590
598
|
|
|
591
599
|
if (retryWhenThrottled) {
|
|
592
600
|
codesToRetryOn.push(429);
|
|
593
601
|
}
|
|
594
602
|
|
|
595
|
-
|
|
596
|
-
retrier.on("attempt", /*#__PURE__*/_asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee() {
|
|
603
|
+
retrier.on("attempt", /*#__PURE__*/_asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee() {
|
|
597
604
|
var result;
|
|
598
|
-
return _regeneratorRuntime__default[
|
|
605
|
+
return _regeneratorRuntime__default["default"].wrap(function _callee$(_context) {
|
|
599
606
|
while (1) {
|
|
600
607
|
switch (_context.prev = _context.next) {
|
|
601
608
|
case 0:
|
|
@@ -638,132 +645,156 @@ class Network {
|
|
|
638
645
|
retrier.on("cancelled", err => reject(err));
|
|
639
646
|
retrier.on("failed", err => reject(err));
|
|
640
647
|
retrier.start();
|
|
641
|
-
}));
|
|
642
648
|
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
649
|
+
case 9:
|
|
650
|
+
case "end":
|
|
651
|
+
return _context2.stop();
|
|
652
|
+
}
|
|
646
653
|
}
|
|
647
|
-
}
|
|
648
|
-
}
|
|
649
|
-
|
|
654
|
+
}, _callee2);
|
|
655
|
+
}));
|
|
656
|
+
|
|
657
|
+
return function (_x, _x2, _x3) {
|
|
658
|
+
return _ref2.apply(this, arguments);
|
|
659
|
+
};
|
|
660
|
+
}());
|
|
650
661
|
}
|
|
651
662
|
|
|
652
663
|
get(url) {
|
|
653
664
|
var _this2 = this;
|
|
654
665
|
|
|
655
|
-
return
|
|
656
|
-
var
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
666
|
+
return new CancellablePromise( /*#__PURE__*/function () {
|
|
667
|
+
var _ref4 = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee3(resolve, reject, onCancel) {
|
|
668
|
+
var headers, request, response;
|
|
669
|
+
return _regeneratorRuntime__default["default"].wrap(function _callee3$(_context3) {
|
|
670
|
+
while (1) {
|
|
671
|
+
switch (_context3.prev = _context3.next) {
|
|
672
|
+
case 0:
|
|
673
|
+
headers = {
|
|
674
|
+
"X-Twilio-Token": _this2.config.token
|
|
675
|
+
};
|
|
676
|
+
request = _this2.executeWithRetry(() => _this2.transport.get(url, headers), _this2.retryWhenThrottled());
|
|
677
|
+
log$1.trace("sending GET request to ", url, " headers ", headers);
|
|
678
|
+
onCancel(() => request.cancel());
|
|
679
|
+
_context3.prev = 4;
|
|
680
|
+
_context3.next = 7;
|
|
681
|
+
return request;
|
|
682
|
+
|
|
683
|
+
case 7:
|
|
684
|
+
response = _context3.sent;
|
|
685
|
+
log$1.trace("response", response);
|
|
686
|
+
resolve(response);
|
|
687
|
+
_context3.next = 16;
|
|
688
|
+
break;
|
|
689
|
+
|
|
690
|
+
case 12:
|
|
691
|
+
_context3.prev = 12;
|
|
692
|
+
_context3.t0 = _context3["catch"](4);
|
|
693
|
+
log$1.debug("get() error ".concat(_context3.t0));
|
|
694
|
+
reject(_context3.t0);
|
|
695
|
+
|
|
696
|
+
case 16:
|
|
697
|
+
case "end":
|
|
698
|
+
return _context3.stop();
|
|
699
|
+
}
|
|
683
700
|
}
|
|
684
|
-
}
|
|
685
|
-
}
|
|
686
|
-
|
|
701
|
+
}, _callee3, null, [[4, 12]]);
|
|
702
|
+
}));
|
|
703
|
+
|
|
704
|
+
return function (_x4, _x5, _x6) {
|
|
705
|
+
return _ref4.apply(this, arguments);
|
|
706
|
+
};
|
|
707
|
+
}());
|
|
687
708
|
}
|
|
688
709
|
|
|
689
710
|
post(url, category, media, contentType, filename) {
|
|
690
711
|
var _this3 = this;
|
|
691
712
|
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
while (1) {
|
|
696
|
-
switch (_context4.prev = _context4.next) {
|
|
697
|
-
case 0:
|
|
698
|
-
headers = {
|
|
699
|
-
"X-Twilio-Token": _this3.config.token
|
|
700
|
-
};
|
|
701
|
-
|
|
702
|
-
if ((typeof FormData === "undefined" || !(media instanceof FormData)) && contentType) {
|
|
703
|
-
Object.assign(headers, {
|
|
704
|
-
"Content-Type": contentType
|
|
705
|
-
});
|
|
706
|
-
}
|
|
713
|
+
var headers = {
|
|
714
|
+
"X-Twilio-Token": this.config.token
|
|
715
|
+
};
|
|
707
716
|
|
|
708
|
-
|
|
717
|
+
if ((typeof FormData === "undefined" || !(media instanceof FormData)) && contentType) {
|
|
718
|
+
Object.assign(headers, {
|
|
719
|
+
"Content-Type": contentType
|
|
720
|
+
});
|
|
721
|
+
}
|
|
709
722
|
|
|
710
|
-
|
|
711
|
-
fullUrl.searchParams.append("Category", category);
|
|
712
|
-
}
|
|
723
|
+
var fullUrl = new URL(url);
|
|
713
724
|
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
725
|
+
if (category) {
|
|
726
|
+
fullUrl.searchParams.append("Category", category);
|
|
727
|
+
}
|
|
717
728
|
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
return _this3.transport.post(fullUrl.href, headers, media);
|
|
729
|
+
if (filename) {
|
|
730
|
+
fullUrl.searchParams.append("Filename", filename);
|
|
731
|
+
}
|
|
722
732
|
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
733
|
+
return new CancellablePromise( /*#__PURE__*/function () {
|
|
734
|
+
var _ref5 = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee4(resolve, reject, onCancel) {
|
|
735
|
+
var request, response;
|
|
736
|
+
return _regeneratorRuntime__default["default"].wrap(function _callee4$(_context4) {
|
|
737
|
+
while (1) {
|
|
738
|
+
switch (_context4.prev = _context4.next) {
|
|
739
|
+
case 0:
|
|
740
|
+
request = _this3.transport.post(fullUrl.href, headers, media);
|
|
741
|
+
onCancel(() => request.cancel());
|
|
742
|
+
log$1.trace("sending POST request to ".concat(url, " with headers ").concat(headers));
|
|
743
|
+
_context4.prev = 3;
|
|
744
|
+
_context4.next = 6;
|
|
745
|
+
return request;
|
|
746
|
+
|
|
747
|
+
case 6:
|
|
748
|
+
response = _context4.sent;
|
|
749
|
+
_context4.next = 17;
|
|
750
|
+
break;
|
|
727
751
|
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
752
|
+
case 9:
|
|
753
|
+
_context4.prev = 9;
|
|
754
|
+
_context4.t0 = _context4["catch"](3);
|
|
731
755
|
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
756
|
+
if (!(global["XMLHttpRequest"] === undefined && media instanceof FormData)) {
|
|
757
|
+
_context4.next = 14;
|
|
758
|
+
break;
|
|
759
|
+
}
|
|
736
760
|
|
|
737
|
-
|
|
761
|
+
reject(new TypeError("Posting FormData supported only with browser engine's FormData"));
|
|
762
|
+
return _context4.abrupt("return");
|
|
738
763
|
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
764
|
+
case 14:
|
|
765
|
+
log$1.debug("post() error ".concat(_context4.t0));
|
|
766
|
+
reject(_context4.t0);
|
|
767
|
+
return _context4.abrupt("return");
|
|
742
768
|
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
769
|
+
case 17:
|
|
770
|
+
log$1.trace("response", response);
|
|
771
|
+
resolve(response);
|
|
746
772
|
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
773
|
+
case 19:
|
|
774
|
+
case "end":
|
|
775
|
+
return _context4.stop();
|
|
776
|
+
}
|
|
750
777
|
}
|
|
751
|
-
}
|
|
752
|
-
}
|
|
753
|
-
|
|
778
|
+
}, _callee4, null, [[3, 9]]);
|
|
779
|
+
}));
|
|
780
|
+
|
|
781
|
+
return function (_x7, _x8, _x9) {
|
|
782
|
+
return _ref5.apply(this, arguments);
|
|
783
|
+
};
|
|
784
|
+
}());
|
|
754
785
|
}
|
|
755
786
|
|
|
756
787
|
}
|
|
757
788
|
|
|
758
|
-
var version = "0.
|
|
789
|
+
var version = "0.6.0-rc.1";
|
|
759
790
|
|
|
760
|
-
var _class
|
|
791
|
+
var _class;
|
|
761
792
|
var log = Logger.scope("");
|
|
762
793
|
/**
|
|
763
794
|
* @classdesc A Client provides an interface for Media Content Service
|
|
764
795
|
*/
|
|
765
796
|
|
|
766
|
-
exports[
|
|
797
|
+
exports["default"] = (_class = class Client {
|
|
767
798
|
// eslint-disable-next-line
|
|
768
799
|
|
|
769
800
|
/**
|
|
@@ -808,66 +839,96 @@ exports['default'] = (_temp = _class = class Client {
|
|
|
808
839
|
/**
|
|
809
840
|
* Gets media from media service
|
|
810
841
|
* @param {String} sid - Media's SID
|
|
811
|
-
* @returns {Promise<Media>}
|
|
812
842
|
*/
|
|
813
843
|
|
|
814
844
|
|
|
815
845
|
get(sid) {
|
|
816
846
|
var _this = this;
|
|
817
847
|
|
|
818
|
-
return
|
|
819
|
-
var
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
848
|
+
return new CancellablePromise( /*#__PURE__*/function () {
|
|
849
|
+
var _ref = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee(resolve, reject, onCancel) {
|
|
850
|
+
var request, response;
|
|
851
|
+
return _regeneratorRuntime__default["default"].wrap(function _callee$(_context) {
|
|
852
|
+
while (1) {
|
|
853
|
+
switch (_context.prev = _context.next) {
|
|
854
|
+
case 0:
|
|
855
|
+
request = _this.network.get("".concat(_this.config.mediaUrl, "/").concat(sid));
|
|
856
|
+
onCancel(() => request.cancel());
|
|
857
|
+
_context.prev = 2;
|
|
858
|
+
_context.next = 5;
|
|
859
|
+
return request;
|
|
860
|
+
|
|
861
|
+
case 5:
|
|
862
|
+
response = _context.sent;
|
|
863
|
+
resolve(new Media(_this.config, _this.network, response.body));
|
|
864
|
+
_context.next = 12;
|
|
865
|
+
break;
|
|
866
|
+
|
|
867
|
+
case 9:
|
|
868
|
+
_context.prev = 9;
|
|
869
|
+
_context.t0 = _context["catch"](2);
|
|
870
|
+
reject(_context.t0);
|
|
871
|
+
|
|
872
|
+
case 12:
|
|
873
|
+
case "end":
|
|
874
|
+
return _context.stop();
|
|
875
|
+
}
|
|
834
876
|
}
|
|
835
|
-
}
|
|
836
|
-
}
|
|
837
|
-
|
|
877
|
+
}, _callee, null, [[2, 9]]);
|
|
878
|
+
}));
|
|
879
|
+
|
|
880
|
+
return function (_x, _x2, _x3) {
|
|
881
|
+
return _ref.apply(this, arguments);
|
|
882
|
+
};
|
|
883
|
+
}());
|
|
838
884
|
}
|
|
839
885
|
/**
|
|
840
886
|
* Posts raw content to media service
|
|
841
887
|
* @param {String} contentType - content type of media
|
|
842
888
|
* @param {String|Buffer|Blob} media - content to post
|
|
843
889
|
* @param {MediaCategory|null} category - category for the media
|
|
844
|
-
* @returns {Promise<Media>}
|
|
845
890
|
*/
|
|
846
891
|
|
|
847
892
|
|
|
848
893
|
post(contentType, media, category, filename) {
|
|
849
894
|
var _this2 = this;
|
|
850
895
|
|
|
851
|
-
return
|
|
852
|
-
var
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
896
|
+
return new CancellablePromise( /*#__PURE__*/function () {
|
|
897
|
+
var _ref2 = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee2(resolve, reject, onCancel) {
|
|
898
|
+
var request, response;
|
|
899
|
+
return _regeneratorRuntime__default["default"].wrap(function _callee2$(_context2) {
|
|
900
|
+
while (1) {
|
|
901
|
+
switch (_context2.prev = _context2.next) {
|
|
902
|
+
case 0:
|
|
903
|
+
request = _this2.network.post(_this2.config.mediaUrl, category !== null && category !== void 0 ? category : "media", media, contentType, filename);
|
|
904
|
+
onCancel(() => request.cancel());
|
|
905
|
+
_context2.prev = 2;
|
|
906
|
+
_context2.next = 5;
|
|
907
|
+
return request;
|
|
908
|
+
|
|
909
|
+
case 5:
|
|
910
|
+
response = _context2.sent;
|
|
911
|
+
resolve(new Media(_this2.config, _this2.network, response.body));
|
|
912
|
+
_context2.next = 12;
|
|
913
|
+
break;
|
|
914
|
+
|
|
915
|
+
case 9:
|
|
916
|
+
_context2.prev = 9;
|
|
917
|
+
_context2.t0 = _context2["catch"](2);
|
|
918
|
+
reject(_context2.t0);
|
|
919
|
+
|
|
920
|
+
case 12:
|
|
921
|
+
case "end":
|
|
922
|
+
return _context2.stop();
|
|
923
|
+
}
|
|
867
924
|
}
|
|
868
|
-
}
|
|
869
|
-
}
|
|
870
|
-
|
|
925
|
+
}, _callee2, null, [[2, 9]]);
|
|
926
|
+
}));
|
|
927
|
+
|
|
928
|
+
return function (_x4, _x5, _x6) {
|
|
929
|
+
return _ref2.apply(this, arguments);
|
|
930
|
+
};
|
|
931
|
+
}());
|
|
871
932
|
}
|
|
872
933
|
/**
|
|
873
934
|
* Posts FormData to media service. Can be used only with browser engine's FormData.
|
|
@@ -875,33 +936,48 @@ exports['default'] = (_temp = _class = class Client {
|
|
|
875
936
|
* new TypeError("Posting FormData supported only with browser engine's FormData")
|
|
876
937
|
* @param {FormData} formData - form data to post
|
|
877
938
|
* @param {MediaCategory|null} category - category for the media
|
|
878
|
-
* @returns {Promise<Media>}
|
|
879
939
|
*/
|
|
880
940
|
|
|
881
941
|
|
|
882
942
|
postFormData(formData, category) {
|
|
883
943
|
var _this3 = this;
|
|
884
944
|
|
|
885
|
-
return
|
|
886
|
-
var
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
945
|
+
return new CancellablePromise( /*#__PURE__*/function () {
|
|
946
|
+
var _ref3 = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee3(resolve, reject, onCancel) {
|
|
947
|
+
var request, response;
|
|
948
|
+
return _regeneratorRuntime__default["default"].wrap(function _callee3$(_context3) {
|
|
949
|
+
while (1) {
|
|
950
|
+
switch (_context3.prev = _context3.next) {
|
|
951
|
+
case 0:
|
|
952
|
+
request = _this3.network.post(_this3.config.mediaUrl, category !== null && category !== void 0 ? category : "media", formData);
|
|
953
|
+
onCancel(() => request.cancel());
|
|
954
|
+
_context3.prev = 2;
|
|
955
|
+
_context3.next = 5;
|
|
956
|
+
return request;
|
|
957
|
+
|
|
958
|
+
case 5:
|
|
959
|
+
response = _context3.sent;
|
|
960
|
+
resolve(new Media(_this3.config, _this3.network, response.body));
|
|
961
|
+
_context3.next = 12;
|
|
962
|
+
break;
|
|
963
|
+
|
|
964
|
+
case 9:
|
|
965
|
+
_context3.prev = 9;
|
|
966
|
+
_context3.t0 = _context3["catch"](2);
|
|
967
|
+
reject(_context3.t0);
|
|
968
|
+
|
|
969
|
+
case 12:
|
|
970
|
+
case "end":
|
|
971
|
+
return _context3.stop();
|
|
972
|
+
}
|
|
901
973
|
}
|
|
902
|
-
}
|
|
903
|
-
}
|
|
904
|
-
|
|
974
|
+
}, _callee3, null, [[2, 9]]);
|
|
975
|
+
}));
|
|
976
|
+
|
|
977
|
+
return function (_x7, _x8, _x9) {
|
|
978
|
+
return _ref3.apply(this, arguments);
|
|
979
|
+
};
|
|
980
|
+
}());
|
|
905
981
|
}
|
|
906
982
|
/**
|
|
907
983
|
* Retrieve information about multiple media SIDs at the same time.
|
|
@@ -912,51 +988,130 @@ exports['default'] = (_temp = _class = class Client {
|
|
|
912
988
|
mediaSetGet(mediaSids) {
|
|
913
989
|
var _this4 = this;
|
|
914
990
|
|
|
915
|
-
return
|
|
916
|
-
var
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
991
|
+
return new CancellablePromise( /*#__PURE__*/function () {
|
|
992
|
+
var _ref4 = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee4(resolve, reject, onCancel) {
|
|
993
|
+
var query, request, response, media;
|
|
994
|
+
return _regeneratorRuntime__default["default"].wrap(function _callee4$(_context4) {
|
|
995
|
+
while (1) {
|
|
996
|
+
switch (_context4.prev = _context4.next) {
|
|
997
|
+
case 0:
|
|
998
|
+
query = {
|
|
999
|
+
command: "get",
|
|
1000
|
+
list: mediaSids.map(sid => ({
|
|
1001
|
+
media_sid: sid
|
|
1002
|
+
}))
|
|
1003
|
+
};
|
|
1004
|
+
request = _this4.network.post("".concat(_this4.config.mediaSetUrl), null, query, "application/json");
|
|
1005
|
+
onCancel(() => request.cancel());
|
|
1006
|
+
_context4.prev = 3;
|
|
1007
|
+
_context4.next = 6;
|
|
1008
|
+
return request;
|
|
1009
|
+
|
|
1010
|
+
case 6:
|
|
1011
|
+
response = _context4.sent;
|
|
1012
|
+
media = response.body.map(item => {
|
|
1013
|
+
if (item.code !== 200) {
|
|
1014
|
+
reject("Failed to obtain detailed information about Media items (failed SID ".concat(item.media_record.sid, ")"));
|
|
1015
|
+
return;
|
|
1016
|
+
}
|
|
1017
|
+
|
|
1018
|
+
return new Media(_this4.config, _this4.network, item.media_record);
|
|
1019
|
+
});
|
|
1020
|
+
resolve(media);
|
|
1021
|
+
_context4.next = 14;
|
|
1022
|
+
break;
|
|
936
1023
|
|
|
937
|
-
|
|
938
|
-
|
|
1024
|
+
case 11:
|
|
1025
|
+
_context4.prev = 11;
|
|
1026
|
+
_context4.t0 = _context4["catch"](3);
|
|
1027
|
+
reject(_context4.t0);
|
|
939
1028
|
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
1029
|
+
case 14:
|
|
1030
|
+
case "end":
|
|
1031
|
+
return _context4.stop();
|
|
1032
|
+
}
|
|
943
1033
|
}
|
|
944
|
-
}
|
|
945
|
-
}
|
|
946
|
-
|
|
1034
|
+
}, _callee4, null, [[3, 11]]);
|
|
1035
|
+
}));
|
|
1036
|
+
|
|
1037
|
+
return function (_x10, _x11, _x12) {
|
|
1038
|
+
return _ref4.apply(this, arguments);
|
|
1039
|
+
};
|
|
1040
|
+
}());
|
|
1041
|
+
}
|
|
1042
|
+
/**
|
|
1043
|
+
* Retrieve temporary URLs for a set of media SIDs.
|
|
1044
|
+
* @param mediaSids array of the media SIDs to get URLs from.
|
|
1045
|
+
*/
|
|
1046
|
+
|
|
1047
|
+
|
|
1048
|
+
mediaSetGetContentUrls(mediaSids) {
|
|
1049
|
+
var _this5 = this;
|
|
1050
|
+
|
|
1051
|
+
return new CancellablePromise( /*#__PURE__*/function () {
|
|
1052
|
+
var _ref5 = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee5(resolve, reject, onCancel) {
|
|
1053
|
+
var query, request, response, urls;
|
|
1054
|
+
return _regeneratorRuntime__default["default"].wrap(function _callee5$(_context5) {
|
|
1055
|
+
while (1) {
|
|
1056
|
+
switch (_context5.prev = _context5.next) {
|
|
1057
|
+
case 0:
|
|
1058
|
+
query = {
|
|
1059
|
+
command: "get",
|
|
1060
|
+
list: mediaSids.map(sid => ({
|
|
1061
|
+
media_sid: sid
|
|
1062
|
+
}))
|
|
1063
|
+
};
|
|
1064
|
+
request = _this5.network.post("".concat(_this5.config.mediaSetUrl), null, query, "application/json");
|
|
1065
|
+
onCancel(() => request.cancel());
|
|
1066
|
+
_context5.prev = 3;
|
|
1067
|
+
_context5.next = 6;
|
|
1068
|
+
return request;
|
|
1069
|
+
|
|
1070
|
+
case 6:
|
|
1071
|
+
response = _context5.sent;
|
|
1072
|
+
urls = new Map();
|
|
1073
|
+
response.body.forEach(item => {
|
|
1074
|
+
if (item.code !== 200) {
|
|
1075
|
+
reject("Failed to obtain detailed information about Media items (failed SID ".concat(item.media_record.sid, ")"));
|
|
1076
|
+
return;
|
|
1077
|
+
}
|
|
1078
|
+
|
|
1079
|
+
urls.set(item.media_record.sid, item.media_record.links.content_direct_temporary);
|
|
1080
|
+
});
|
|
1081
|
+
resolve(urls);
|
|
1082
|
+
_context5.next = 15;
|
|
1083
|
+
break;
|
|
1084
|
+
|
|
1085
|
+
case 12:
|
|
1086
|
+
_context5.prev = 12;
|
|
1087
|
+
_context5.t0 = _context5["catch"](3);
|
|
1088
|
+
reject(_context5.t0);
|
|
1089
|
+
|
|
1090
|
+
case 15:
|
|
1091
|
+
case "end":
|
|
1092
|
+
return _context5.stop();
|
|
1093
|
+
}
|
|
1094
|
+
}
|
|
1095
|
+
}, _callee5, null, [[3, 12]]);
|
|
1096
|
+
}));
|
|
1097
|
+
|
|
1098
|
+
return function (_x13, _x14, _x15) {
|
|
1099
|
+
return _ref5.apply(this, arguments);
|
|
1100
|
+
};
|
|
1101
|
+
}());
|
|
947
1102
|
}
|
|
948
1103
|
|
|
949
|
-
}, _defineProperty__default[
|
|
1104
|
+
}, _defineProperty__default["default"](_class, "version", version), _class);
|
|
950
1105
|
|
|
951
|
-
__decorate([declarativeTypeValidator.validateTypes(declarativeTypeValidator.nonEmptyString), __metadata("design:type", Function), __metadata("design:paramtypes", [String]), __metadata("design:returntype", void 0)], exports[
|
|
1106
|
+
__decorate([declarativeTypeValidator.validateTypes(declarativeTypeValidator.nonEmptyString), __metadata("design:type", Function), __metadata("design:paramtypes", [String]), __metadata("design:returntype", void 0)], exports["default"].prototype, "updateToken", null);
|
|
952
1107
|
|
|
953
|
-
__decorate([declarativeTypeValidator.validateTypesAsync(declarativeTypeValidator.nonEmptyString), __metadata("design:type", Function), __metadata("design:paramtypes", [String]), __metadata("design:returntype",
|
|
1108
|
+
__decorate([declarativeTypeValidator.validateTypesAsync(declarativeTypeValidator.nonEmptyString), __metadata("design:type", Function), __metadata("design:paramtypes", [String]), __metadata("design:returntype", CancellablePromise)], exports["default"].prototype, "get", null);
|
|
954
1109
|
|
|
955
|
-
exports[
|
|
1110
|
+
exports["default"] = __decorate([declarativeTypeValidator.validateConstructorTypes(declarativeTypeValidator.nonEmptyString, declarativeTypeValidator.nonEmptyString, [declarativeTypeValidator.nonEmptyString, declarativeTypeValidator.literal(null)], [declarativeTypeValidator.pureObject, "undefined"]), __metadata("design:paramtypes", [String, String, Object, Object])], exports["default"]); // Proper renames should happen in index.ts,
|
|
956
1111
|
|
|
957
|
-
exports.
|
|
958
|
-
exports.
|
|
1112
|
+
exports.CancellablePromise = CancellablePromise;
|
|
1113
|
+
exports.Client = exports["default"];
|
|
1114
|
+
exports.McsClient = exports["default"];
|
|
959
1115
|
exports.McsMedia = Media;
|
|
960
1116
|
exports.Media = Media;
|
|
961
|
-
exports.default = exports['default'];
|
|
962
1117
|
//# sourceMappingURL=browser.js.map
|