@twilio/mcs-client 0.6.1 → 1.0.0-rc.3

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 (35) hide show
  1. package/builds/browser.js +251 -898
  2. package/builds/browser.js.map +1 -1
  3. package/builds/lib.d.ts +3 -41
  4. package/builds/lib.js +251 -873
  5. package/builds/lib.js.map +1 -1
  6. package/builds/twilio-mcs-client.js +2106 -10654
  7. package/builds/twilio-mcs-client.min.js +37 -24
  8. package/dist/client.js +7 -7
  9. package/dist/client.js.map +1 -1
  10. package/dist/index.js +5 -2
  11. package/dist/index.js.map +1 -1
  12. package/dist/media.js +2 -2
  13. package/dist/media.js.map +1 -1
  14. package/dist/node_modules/tslib/tslib.es6.js.map +1 -1
  15. package/dist/packages/mcs-client/package.json.js +1 -1
  16. package/dist/services/network.js +4 -4
  17. package/dist/services/network.js.map +1 -1
  18. package/dist/services/transport.js +4 -3
  19. package/dist/services/transport.js.map +1 -1
  20. package/package.json +21 -8
  21. package/CHANGELOG.md +0 -315
  22. package/dist/_virtual/rng-browser.js +0 -34
  23. package/dist/_virtual/rng-browser.js.map +0 -1
  24. package/dist/cancellable-promise.js +0 -98
  25. package/dist/cancellable-promise.js.map +0 -1
  26. package/dist/node_modules/uuid/index.js +0 -44
  27. package/dist/node_modules/uuid/index.js.map +0 -1
  28. package/dist/node_modules/uuid/lib/bytesToUuid.js +0 -60
  29. package/dist/node_modules/uuid/lib/bytesToUuid.js.map +0 -1
  30. package/dist/node_modules/uuid/lib/rng-browser.js +0 -65
  31. package/dist/node_modules/uuid/lib/rng-browser.js.map +0 -1
  32. package/dist/node_modules/uuid/v1.js +0 -146
  33. package/dist/node_modules/uuid/v1.js.map +0 -1
  34. package/dist/node_modules/uuid/v4.js +0 -66
  35. package/dist/node_modules/uuid/v4.js.map +0 -1
package/CHANGELOG.md DELETED
@@ -1,315 +0,0 @@
1
- # Change Log
2
-
3
- All notable changes to this project will be documented in this file.
4
- See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
-
6
- ### [0.6.1](https://github.com/twilio/rtd-sdk-monorepo-js/compare/@twilio/mcs-client@0.6.1-rc.1...@twilio/mcs-client@0.6.1) (2022-09-21)
7
-
8
- **Note:** Version bump only for package @twilio/mcs-client
9
-
10
-
11
-
12
-
13
-
14
- ### [0.6.1-rc.1](https://github.com/twilio/rtd-sdk-monorepo-js/compare/@twilio/mcs-client@0.6.0-rc.5...@twilio/mcs-client@0.6.1-rc.1) (2022-09-21)
15
-
16
-
17
- ### Bug Fixes
18
-
19
- * Fix request error message ([9692911](https://github.com/twilio/rtd-sdk-monorepo-js/commit/96929111e9f83e6f09bce0bc8d8527f62ae051d9))
20
- * Rollback twilsock type, update loglevel version ([d318c5c](https://github.com/twilio/rtd-sdk-monorepo-js/commit/d318c5c0750096651ce1e01fef360aded070bb5c))
21
-
22
-
23
-
24
- ## [0.6.0-rc.10](https://github.com/twilio/rtd-sdk-monorepo-js/compare/@twilio/mcs-client@0.6.0-rc.9...@twilio/mcs-client@0.6.0-rc.10) (2022-09-13)
25
-
26
-
27
- ### Bug Fixes
28
-
29
- * Fix request error message ([7847cc3](https://github.com/twilio/rtd-sdk-monorepo-js/commit/7847cc31a78fd8f099571a02dad8e2db1e412132))
30
-
31
-
32
-
33
- ## [0.6.0-rc.9](https://github.com/twilio/rtd-sdk-monorepo-js/compare/@twilio/mcs-client@0.6.0-rc.8...@twilio/mcs-client@0.6.0-rc.9) (2022-08-23)
34
-
35
- **Note:** Version bump only for package @twilio/mcs-client
36
-
37
-
38
-
39
-
40
-
41
- ## [0.6.0-rc.8](https://github.com/twilio/rtd-sdk-monorepo-js/compare/@twilio/mcs-client@0.6.0-rc.7...@twilio/mcs-client@0.6.0-rc.8) (2022-07-25)
42
-
43
- **Note:** Version bump only for package @twilio/mcs-client
44
-
45
-
46
-
47
-
48
-
49
- ## [0.6.0-rc.7](https://github.com/twilio/rtd-sdk-monorepo-js/compare/@twilio/mcs-client@0.6.0-rc.6...@twilio/mcs-client@0.6.0-rc.7) (2022-07-20)
50
-
51
-
52
- ### Bug Fixes
53
-
54
- * Rollback twilsock type, update loglevel version ([b8c4b2c](https://github.com/twilio/rtd-sdk-monorepo-js/commit/b8c4b2c174a8a2cf413b0ef6c719fd45e0cfce6d))
55
-
56
-
57
-
58
- ## [0.6.0-rc.6](https://github.com/twilio/rtd-sdk-monorepo-js/compare/@twilio/mcs-client@0.6.0-rc.5...@twilio/mcs-client@0.6.0-rc.6) (2022-07-05)
59
-
60
- **Note:** Version bump only for package @twilio/mcs-client
61
-
62
-
63
-
64
-
65
-
66
- ## [0.6.0-rc.5](https://github.com/twilio/rtd-sdk-monorepo-js/compare/@twilio/mcs-client@0.6.0-rc.4...@twilio/mcs-client@0.6.0-rc.5) (2022-05-18)
67
-
68
-
69
- ### Reverts
70
-
71
- * Revert "chore(release): Publish" ([03b27ca](https://github.com/twilio/rtd-sdk-monorepo-js/commit/03b27ca9830bc6aba2d37febebe6e53f7abddb2d))
72
-
73
-
74
-
75
- ## [0.6.0-rc.4](https://github.com/twilio/rtd-sdk-monorepo-js/compare/@twilio/mcs-client@0.6.0-rc.3...@twilio/mcs-client@0.6.0-rc.4) (2022-05-04)
76
-
77
-
78
- ### Bug Fixes
79
-
80
- * Add cancellable promise export from conversations ([04bd2fc](https://github.com/twilio/rtd-sdk-monorepo-js/commit/04bd2fc10ca1331fbcddf94a186eec351ea922f1))
81
- * Fix onCancel storing in Cancellable promise ([2dfaccd](https://github.com/twilio/rtd-sdk-monorepo-js/commit/2dfaccd7a984cc3b608bada7cf649473a145fe8b))
82
- * Fix promise cancelling retrier ([9b30ce2](https://github.com/twilio/rtd-sdk-monorepo-js/commit/9b30ce2750b7447f28e745513f7e1a29e2c48127))
83
-
84
-
85
-
86
- ## [0.6.0-rc.3](https://github.com/twilio/rtd-sdk-monorepo-js/compare/@twilio/mcs-client@0.6.0-rc.2...@twilio/mcs-client@0.6.0-rc.3) (2022-05-02)
87
-
88
- **Note:** Version bump only for package @twilio/mcs-client
89
-
90
-
91
-
92
-
93
-
94
- ## [0.6.0-rc.2](https://github.com/twilio/rtd-sdk-monorepo-js/compare/@twilio/mcs-client@0.6.0-rc.1...@twilio/mcs-client@0.6.0-rc.2) (2022-05-02)
95
-
96
-
97
- ### Bug Fixes
98
-
99
- * Fix faulty type definitions by upgrading tooling ([b6d25ce](https://github.com/twilio/rtd-sdk-monorepo-js/commit/b6d25cecb08ab4e0d369430b90a786e1b275af91))
100
-
101
-
102
-
103
- ## [0.6.0-rc.1](https://github.com/twilio/rtd-sdk-monorepo-js/compare/@twilio/mcs-client@0.6.0-rc.0...@twilio/mcs-client@0.6.0-rc.1) (2022-03-16)
104
-
105
- **Note:** Version bump only for package @twilio/mcs-client
106
-
107
-
108
-
109
-
110
-
111
- ### [0.5.3](https://github.com/twilio/rtd-sdk-monorepo-js/compare/@twilio/mcs-client@0.5.3-rc.0...@twilio/mcs-client@0.5.3) (2022-03-03)
112
-
113
- **Note:** Version bump only for package @twilio/mcs-client
114
-
115
-
116
-
117
-
118
-
119
- ### [0.5.3-rc.0](https://github.com/twilio/rtd-sdk-monorepo-js/compare/@twilio/mcs-client@0.5.2...@twilio/mcs-client@0.5.3-rc.0) (2022-01-28)
120
-
121
-
122
- ### Bug Fixes
123
-
124
- * Fix media SID attachment ([e260ea7](https://github.com/twilio/rtd-sdk-monorepo-js/commit/e260ea7963328450043cbd4ade76cb9f230e1240))
125
-
126
-
127
-
128
- ### [0.5.2](https://github.com/twilio/rtd-sdk-monorepo-js/compare/@twilio/mcs-client@0.5.2-rc.4...@twilio/mcs-client@0.5.2) (2021-11-25)
129
-
130
- **Note:** Version bump only for package @twilio/mcs-client
131
-
132
-
133
-
134
-
135
-
136
- ### [0.5.2-rc.4](https://github.com/twilio/rtd-sdk-monorepo-js/compare/@twilio/mcs-client@0.5.2-rc.3...@twilio/mcs-client@0.5.2-rc.4) (2021-11-12)
137
-
138
- **Note:** Version bump only for package @twilio/mcs-client
139
-
140
-
141
-
142
-
143
-
144
- ### [0.5.2-rc.3](https://github.com/twilio/rtd-sdk-monorepo-js/compare/@twilio/mcs-client@0.5.2-rc.2...@twilio/mcs-client@0.5.2-rc.3) (2021-11-11)
145
-
146
-
147
- ### Bug Fixes
148
-
149
- * Remove the post-install script in favour of the "react-native" option ([0fe352d](https://github.com/twilio/rtd-sdk-monorepo-js/commit/0fe352d45e50cec78e880affee589009055d5338))
150
-
151
-
152
-
153
- ### [0.5.2-rc.2](https://github.com/twilio/rtd-sdk-monorepo-js/compare/@twilio/mcs-client@0.5.2-rc.1...@twilio/mcs-client@0.5.2-rc.2) (2021-11-10)
154
-
155
-
156
- ### Bug Fixes
157
-
158
- * Fix the post-install script (yet again) ([c8cb1ee](https://github.com/twilio/rtd-sdk-monorepo-js/commit/c8cb1ee501d1c793497985592d2c1ae97162a219))
159
-
160
-
161
-
162
- ### [0.5.2-rc.1](https://github.com/twilio/rtd-sdk-monorepo-js/compare/@twilio/mcs-client@0.5.2-rc.0...@twilio/mcs-client@0.5.2-rc.1) (2021-11-09)
163
-
164
-
165
- ### Bug Fixes
166
-
167
- * Fix the post-install script to be runnable cross-platform ([a16eede](https://github.com/twilio/rtd-sdk-monorepo-js/commit/a16eede598dd3dbdda1997fbd2033fa2254f113f))
168
-
169
-
170
-
171
- ### [0.5.2-rc.0](https://github.com/twilio/rtd-sdk-monorepo-js/compare/@twilio/mcs-client@0.5.1...@twilio/mcs-client@0.5.2-rc.0) (2021-10-26)
172
-
173
-
174
- ### Bug Fixes
175
-
176
- * Bump Node required version to current LTS (14) ([ee272b3](https://github.com/twilio/rtd-sdk-monorepo-js/commit/ee272b350f4556a454a18a8aa192c37b54aaaeeb))
177
-
178
-
179
-
180
- ### [0.5.1](https://github.com/twilio/rtd-sdk-monorepo-js/compare/@twilio/mcs-client@0.5.1-rc.12...@twilio/mcs-client@0.5.1) (2021-10-19)
181
-
182
- **Note:** Version bump only for package @twilio/mcs-client
183
-
184
-
185
-
186
-
187
-
188
- ### [0.5.1-rc.12](https://github.com/twilio/rtd-sdk-monorepo-js/compare/@twilio/mcs-client@0.5.1-rc.11...@twilio/mcs-client@0.5.1-rc.12) (2021-09-23)
189
-
190
- **Note:** Version bump only for package @twilio/mcs-client
191
-
192
-
193
-
194
-
195
-
196
- ### [0.5.1-rc.11](https://github.com/twilio/rtd-sdk-monorepo-js/compare/@twilio/mcs-client@0.5.1-rc.10...@twilio/mcs-client@0.5.1-rc.11) (2021-09-12)
197
-
198
-
199
- ### Bug Fixes
200
-
201
- * Fix the removal of node-js libs from React Native bundles ([317a19a](https://github.com/twilio/rtd-sdk-monorepo-js/commit/317a19a013e3fe51b67864efab75459dafb312a8))
202
-
203
-
204
-
205
- ### [0.5.1-rc.10](https://github.com/twilio/rtd-sdk-monorepo-js/compare/@twilio/mcs-client@0.5.1-rc.9...@twilio/mcs-client@0.5.1-rc.10) (2021-09-12)
206
-
207
- **Note:** Version bump only for package @twilio/mcs-client
208
-
209
-
210
-
211
-
212
-
213
- ### [0.5.1-rc.9](https://github.com/twilio/rtd-sdk-monorepo-js/compare/@twilio/mcs-client@0.5.1-rc.8...@twilio/mcs-client@0.5.1-rc.9) (2021-09-12)
214
-
215
- **Note:** Version bump only for package @twilio/mcs-client
216
-
217
-
218
-
219
-
220
-
221
- ### [0.5.1-rc.8](https://github.com/twilio/rtd-sdk-monorepo-js/compare/@twilio/mcs-client@0.5.1-rc.7...@twilio/mcs-client@0.5.1-rc.8) (2021-09-12)
222
-
223
- **Note:** Version bump only for package @twilio/mcs-client
224
-
225
-
226
-
227
-
228
-
229
- ### [0.5.1-rc.7](https://github.com/twilio/rtd-sdk-monorepo-js/compare/@twilio/mcs-client@0.5.1-rc.6...@twilio/mcs-client@0.5.1-rc.7) (2021-09-12)
230
-
231
- **Note:** Version bump only for package @twilio/mcs-client
232
-
233
-
234
-
235
-
236
-
237
- ### [0.5.1-rc.6](https://github.com/twilio/rtd-sdk-monorepo-js/compare/@twilio/mcs-client@0.5.1-rc.4...@twilio/mcs-client@0.5.1-rc.6) (2021-09-12)
238
-
239
- **Note:** Version bump only for package @twilio/mcs-client
240
-
241
-
242
-
243
-
244
-
245
- ### [0.5.1-rc.5](https://github.com/twilio/rtd-sdk-monorepo-js/compare/@twilio/mcs-client@0.5.1-rc.4...@twilio/mcs-client@0.5.1-rc.5) (2021-09-12)
246
-
247
- **Note:** Version bump only for package @twilio/mcs-client
248
-
249
-
250
-
251
-
252
-
253
- ### [0.5.1-rc.4](https://github.com/twilio/rtd-sdk-monorepo-js/compare/@twilio/mcs-client@0.5.1-rc.3...@twilio/mcs-client@0.5.1-rc.4) (2021-09-10)
254
-
255
- **Note:** Version bump only for package @twilio/mcs-client
256
-
257
-
258
-
259
-
260
-
261
- ### [0.5.1-rc.3](https://github.com/twilio/rtd-sdk-monorepo-js/compare/@twilio/mcs-client@0.5.1-rc.2...@twilio/mcs-client@0.5.1-rc.3) (2021-09-10)
262
-
263
- **Note:** Version bump only for package @twilio/mcs-client
264
-
265
-
266
-
267
-
268
-
269
- ### [0.5.1-rc.2](https://github.com/twilio/rtd-sdk-monorepo-js/compare/@twilio/mcs-client@0.5.1-rc.1...@twilio/mcs-client@0.5.1-rc.2) (2021-09-09)
270
-
271
-
272
- ### Bug Fixes
273
-
274
- * Remove require('xmlhttprequest') from browser bundles ([0399152](https://github.com/twilio/rtd-sdk-monorepo-js/commit/03991522ec0abc8b2e456673aa4256a96af0f6b7))
275
-
276
-
277
-
278
- ### [0.5.1-rc.1](https://github.com/twilio/rtd-sdk-monorepo-js/compare/@twilio/mcs-client@0.5.1-rc.0...@twilio/mcs-client@0.5.1-rc.1) (2021-09-09)
279
-
280
-
281
- ### Bug Fixes
282
-
283
- * Add a browser shim for Node's global ([0de6b0e](https://github.com/twilio/rtd-sdk-monorepo-js/commit/0de6b0e5bab1270f894ba2c5cd00476f61dab498))
284
-
285
-
286
-
287
- ### [0.5.1-rc.0](https://github.com/twilio/rtd-sdk-monorepo-js/compare/@twilio/mcs-client@0.5.0...@twilio/mcs-client@0.5.1-rc.0) (2021-09-07)
288
-
289
- **Note:** Version bump only for package @twilio/mcs-client
290
-
291
-
292
-
293
-
294
-
295
- ## [0.5.0](https://github.com/twilio/rtd-sdk-monorepo-js/compare/@twilio/mcs-client@0.5.0-rc.1...@twilio/mcs-client@0.5.0) (2021-08-04)
296
-
297
- **Note:** Version bump only for package @twilio/mcs-client
298
-
299
-
300
-
301
-
302
-
303
- ## 0.5.0-rc.1 (2021-08-03)
304
-
305
-
306
- ### Bug Fixes
307
-
308
- * Fix rollup config paths ([ec3f6f3](https://github.com/twilio/rtd-sdk-monorepo-js/commit/ec3f6f362d85eedb94d2ad8330ce66d14175d8e4))
309
- * Update packages versions ([812ec45](https://github.com/twilio/rtd-sdk-monorepo-js/commit/812ec45459d680ca1d0bdccdbae0bfaf4b6639cc))
310
-
311
-
312
-
313
- ## 0.5.0-rc.0 (2021-07-30)
314
-
315
- **Note:** Version bump only for package @twilio/mcs-client
@@ -1,34 +0,0 @@
1
- /*
2
- @license
3
- Copyright (c) 2018, Twilio, Inc.
4
-
5
- Permission to use, copy, modify, and/or distribute this software for any
6
- purpose with or without fee is hereby granted, provided that the above
7
- copyright notice and this permission notice appear in all copies.
8
-
9
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10
- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11
- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
12
- SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13
- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
14
- OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
15
- CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16
-
17
- */
18
- 'use strict';
19
-
20
- var global =
21
- typeof global !== "undefined"
22
- ? global
23
- : typeof self !== "undefined"
24
- ? self
25
- : typeof window !== "undefined"
26
- ? window
27
- : {};
28
-
29
- Object.defineProperty(exports, '__esModule', { value: true });
30
-
31
- var rngBrowser = {exports: {}};
32
-
33
- exports.rngBrowser = rngBrowser;
34
- //# sourceMappingURL=rng-browser.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"rng-browser.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,98 +0,0 @@
1
- /*
2
- @license
3
- Copyright (c) 2018, Twilio, Inc.
4
-
5
- Permission to use, copy, modify, and/or distribute this software for any
6
- purpose with or without fee is hereby granted, provided that the above
7
- copyright notice and this permission notice appear in all copies.
8
-
9
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10
- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11
- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
12
- SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13
- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
14
- OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
15
- CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16
-
17
- */
18
- 'use strict';
19
-
20
- var global =
21
- typeof global !== "undefined"
22
- ? global
23
- : typeof self !== "undefined"
24
- ? self
25
- : typeof window !== "undefined"
26
- ? window
27
- : {};
28
-
29
- Object.defineProperty(exports, '__esModule', { value: true });
30
-
31
- var index = require('./node_modules/uuid/index.js');
32
-
33
- /**
34
- * Cancellable promise. Extends the functionality of the native Promise to include the cancel method.
35
- *
36
- * Example:
37
- *
38
- * ```ts
39
- *
40
- * const cancellableFetchPromise = new CancellablePromise(async (resolve, reject, onCancel) => {
41
- * const request = fetch("https://example.com/");
42
- *
43
- * onCancel(() => request.cancel());
44
- *
45
- * try {
46
- * const response = await request;
47
- * resolve(response);
48
- * } catch (err) {
49
- * reject(err);
50
- * }
51
- * });
52
- *
53
- * cancellableFetchPromise.cancel();
54
- * ```
55
- */
56
- class CancellablePromise extends Promise {
57
- /**
58
- * Creates a new CancellablePromise.
59
- * @param executor A callback used to initialize the promise. This callback is passed three arguments:
60
- * a resolve callback used to resolve the promise with a value or the result of another promise,
61
- * a reject callback used to reject the promise with a provided reason or error,
62
- * and an onCancel callback used to define behavior of cancellation.
63
- */
64
- constructor(executor) {
65
- const outerId = index["default"].v4();
66
- let outerRejectPromise;
67
- super((resolve, reject) => {
68
- outerRejectPromise = reject;
69
- return executor((value) => {
70
- CancellablePromise.cancellationMap.delete(outerId);
71
- resolve(value);
72
- }, (reason) => {
73
- CancellablePromise.cancellationMap.delete(outerId);
74
- reject(reason);
75
- }, (cancellationFunction) => {
76
- CancellablePromise.cancellationMap.set(outerId, cancellationFunction);
77
- });
78
- });
79
- this.id = outerId;
80
- this.rejectPromise = outerRejectPromise;
81
- }
82
- /**
83
- * Cancels the promise and invokes the cancellation callback if it was defined during instantiation. Cancellation will result in the promise being rejected.
84
- */
85
- cancel() {
86
- const onCancel = CancellablePromise.cancellationMap.get(this.id);
87
- onCancel === null || onCancel === void 0 ? void 0 : onCancel();
88
- if (this.rejectPromise) {
89
- this.catch(() => void 0);
90
- this.rejectPromise(new Error("Promise was cancelled"));
91
- }
92
- return this;
93
- }
94
- }
95
- CancellablePromise.cancellationMap = new Map();
96
-
97
- exports.CancellablePromise = CancellablePromise;
98
- //# sourceMappingURL=cancellable-promise.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"cancellable-promise.js","sources":["../src/cancellable-promise.ts"],"sourcesContent":["import { v4 as uuidv4 } from \"uuid\";\n\n/**\n * Cancellable promise. Extends the functionality of the native Promise to include the cancel method.\n *\n * Example:\n *\n * ```ts\n *\n * const cancellableFetchPromise = new CancellablePromise(async (resolve, reject, onCancel) => {\n * const request = fetch(\"https://example.com/\");\n *\n * onCancel(() => request.cancel());\n *\n * try {\n * const response = await request;\n * resolve(response);\n * } catch (err) {\n * reject(err);\n * }\n * });\n *\n * cancellableFetchPromise.cancel();\n * ```\n */\nclass CancellablePromise<T> extends Promise<T> {\n private readonly id: string;\n private rejectPromise?: (reason?: any) => void;\n\n private static readonly cancellationMap: Map<string, () => void> = new Map();\n\n /**\n * Creates a new CancellablePromise.\n * @param executor A callback used to initialize the promise. This callback is passed three arguments:\n * a resolve callback used to resolve the promise with a value or the result of another promise,\n * a reject callback used to reject the promise with a provided reason or error,\n * and an onCancel callback used to define behavior of cancellation.\n */\n constructor(\n executor: (\n resolve: (value: T | PromiseLike<T>) => void,\n reject: (reason?: string | Error) => void,\n onCancel: (cancellationFunction: () => void) => void\n ) => void\n ) {\n const outerId = uuidv4();\n let outerRejectPromise!: (reason?: any) => void;\n\n super((resolve, reject) => {\n outerRejectPromise = reject;\n return executor(\n (value: T | PromiseLike<T>) => {\n CancellablePromise.cancellationMap.delete(outerId);\n resolve(value);\n },\n (reason?: string | Error) => {\n CancellablePromise.cancellationMap.delete(outerId);\n reject(reason);\n },\n (cancellationFunction: () => void) => {\n CancellablePromise.cancellationMap.set(outerId, cancellationFunction);\n }\n );\n });\n\n this.id = outerId;\n this.rejectPromise = outerRejectPromise;\n }\n\n /**\n * Cancels the promise and invokes the cancellation callback if it was defined during instantiation. Cancellation will result in the promise being rejected.\n */\n cancel(): this {\n const onCancel = CancellablePromise.cancellationMap.get(this.id);\n\n onCancel?.();\n\n if (this.rejectPromise) {\n this.catch(() => void 0);\n this.rejectPromise(new Error(\"Promise was cancelled\"));\n }\n\n return this;\n }\n}\n\nexport { CancellablePromise };\n"],"names":["uuidv4"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA;;;;;;;;;;;;;;;;;;;;;;AAsBG;AACH,MAAM,kBAAsB,SAAQ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AAA,OAAO,IAAI,CAAC;KACb;;AAtDuB,kBAAA,CAAA,eAAe,GAA4B,IAAI,GAAG,EAAE;;;;"}
@@ -1,44 +0,0 @@
1
- /*
2
- @license
3
- Copyright (c) 2018, Twilio, Inc.
4
-
5
- Permission to use, copy, modify, and/or distribute this software for any
6
- purpose with or without fee is hereby granted, provided that the above
7
- copyright notice and this permission notice appear in all copies.
8
-
9
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10
- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11
- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
12
- SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13
- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
14
- OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
15
- CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16
-
17
- */
18
- 'use strict';
19
-
20
- var global =
21
- typeof global !== "undefined"
22
- ? global
23
- : typeof self !== "undefined"
24
- ? self
25
- : typeof window !== "undefined"
26
- ? window
27
- : {};
28
-
29
- Object.defineProperty(exports, '__esModule', { value: true });
30
-
31
- var v1$1 = require('./v1.js');
32
- var v4$1 = require('./v4.js');
33
-
34
- var v1 = v1$1["default"];
35
- var v4 = v4$1["default"];
36
-
37
- var uuid = v4;
38
- uuid.v1 = v1;
39
- uuid.v4 = v4;
40
-
41
- var uuid_1 = uuid;
42
-
43
- exports["default"] = uuid_1;
44
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sources":["../../../../../node_modules/uuid/index.js"],"sourcesContent":["var v1 = require('./v1');\nvar v4 = require('./v4');\n\nvar uuid = v4;\nuuid.v1 = v1;\nuuid.v4 = v4;\n\nmodule.exports = uuid;\n"],"names":["require$$0","require$$1"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAI,EAAE,GAAGA,eAAe,CAAC;AACzB,IAAI,EAAE,GAAGC,eAAe,CAAC;AACzB;AACA,IAAI,IAAI,GAAG,EAAE,CAAC;AACd,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;AACb,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;AACb;AACA,IAAA,MAAc,GAAG;;;;"}
@@ -1,60 +0,0 @@
1
- /*
2
- @license
3
- Copyright (c) 2018, Twilio, Inc.
4
-
5
- Permission to use, copy, modify, and/or distribute this software for any
6
- purpose with or without fee is hereby granted, provided that the above
7
- copyright notice and this permission notice appear in all copies.
8
-
9
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10
- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11
- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
12
- SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13
- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
14
- OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
15
- CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16
-
17
- */
18
- 'use strict';
19
-
20
- var global =
21
- typeof global !== "undefined"
22
- ? global
23
- : typeof self !== "undefined"
24
- ? self
25
- : typeof window !== "undefined"
26
- ? window
27
- : {};
28
-
29
- Object.defineProperty(exports, '__esModule', { value: true });
30
-
31
- /**
32
- * Convert array of 16 byte values to UUID string format of the form:
33
- * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
34
- */
35
-
36
- var byteToHex = [];
37
- for (var i = 0; i < 256; ++i) {
38
- byteToHex[i] = (i + 0x100).toString(16).substr(1);
39
- }
40
-
41
- function bytesToUuid(buf, offset) {
42
- var i = offset || 0;
43
- var bth = byteToHex;
44
- // join used to fix memory issue caused by concatenation: https://bugs.chromium.org/p/v8/issues/detail?id=3175#c4
45
- return ([
46
- bth[buf[i++]], bth[buf[i++]],
47
- bth[buf[i++]], bth[buf[i++]], '-',
48
- bth[buf[i++]], bth[buf[i++]], '-',
49
- bth[buf[i++]], bth[buf[i++]], '-',
50
- bth[buf[i++]], bth[buf[i++]], '-',
51
- bth[buf[i++]], bth[buf[i++]],
52
- bth[buf[i++]], bth[buf[i++]],
53
- bth[buf[i++]], bth[buf[i++]]
54
- ]).join('');
55
- }
56
-
57
- var bytesToUuid_1 = bytesToUuid;
58
-
59
- exports["default"] = bytesToUuid_1;
60
- //# sourceMappingURL=bytesToUuid.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"bytesToUuid.js","sources":["../../../../../../node_modules/uuid/lib/bytesToUuid.js"],"sourcesContent":["/**\n * Convert array of 16 byte values to UUID string format of the form:\n * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX\n */\nvar byteToHex = [];\nfor (var i = 0; i < 256; ++i) {\n byteToHex[i] = (i + 0x100).toString(16).substr(1);\n}\n\nfunction bytesToUuid(buf, offset) {\n var i = offset || 0;\n var bth = byteToHex;\n // join used to fix memory issue caused by concatenation: https://bugs.chromium.org/p/v8/issues/detail?id=3175#c4\n return ([\n bth[buf[i++]], bth[buf[i++]],\n bth[buf[i++]], bth[buf[i++]], '-',\n bth[buf[i++]], bth[buf[i++]], '-',\n bth[buf[i++]], bth[buf[i++]], '-',\n bth[buf[i++]], bth[buf[i++]], '-',\n bth[buf[i++]], bth[buf[i++]],\n bth[buf[i++]], bth[buf[i++]],\n bth[buf[i++]], bth[buf[i++]]\n ]).join('');\n}\n\nmodule.exports = bytesToUuid;\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,IAAI,SAAS,GAAG,EAAE,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AAC,CAAC,EAAE,CAAC,CAAC;AAChC,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC;AAChC,GAAG,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC;AACd,CAAC;AACD;AACA,IAAA,aAAc,GAAG;;;;"}
@@ -1,65 +0,0 @@
1
- /*
2
- @license
3
- Copyright (c) 2018, Twilio, Inc.
4
-
5
- Permission to use, copy, modify, and/or distribute this software for any
6
- purpose with or without fee is hereby granted, provided that the above
7
- copyright notice and this permission notice appear in all copies.
8
-
9
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10
- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11
- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
12
- SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13
- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
14
- OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
15
- CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16
-
17
- */
18
- 'use strict';
19
-
20
- var global =
21
- typeof global !== "undefined"
22
- ? global
23
- : typeof self !== "undefined"
24
- ? self
25
- : typeof window !== "undefined"
26
- ? window
27
- : {};
28
-
29
- var rngBrowser = require('../../../_virtual/rng-browser.js');
30
-
31
- // Unique ID creation requires a high quality random # generator. In the
32
- // browser this is a little complicated due to unknown quality of Math.random()
33
- // and inconsistent support for the `crypto` API. We do the best we can via
34
- // feature-detection
35
-
36
- // getRandomValues needs to be invoked in a context where "this" is a Crypto
37
- // implementation. Also, find the complete implementation of crypto on IE11.
38
- var getRandomValues = (typeof(crypto) != 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto)) ||
39
- (typeof(msCrypto) != 'undefined' && typeof window.msCrypto.getRandomValues == 'function' && msCrypto.getRandomValues.bind(msCrypto));
40
-
41
- if (getRandomValues) {
42
- // WHATWG crypto RNG - http://wiki.whatwg.org/wiki/Crypto
43
- var rnds8 = new Uint8Array(16); // eslint-disable-line no-undef
44
-
45
- rngBrowser.rngBrowser.exports = function whatwgRNG() {
46
- getRandomValues(rnds8);
47
- return rnds8;
48
- };
49
- } else {
50
- // Math.random()-based (RNG)
51
- //
52
- // If all else fails, use Math.random(). It's fast, but is of unspecified
53
- // quality.
54
- var rnds = new Array(16);
55
-
56
- rngBrowser.rngBrowser.exports = function mathRNG() {
57
- for (var i = 0, r; i < 16; i++) {
58
- if ((i & 0x03) === 0) r = Math.random() * 0x100000000;
59
- rnds[i] = r >>> ((i & 0x03) << 3) & 0xff;
60
- }
61
-
62
- return rnds;
63
- };
64
- }
65
- //# sourceMappingURL=rng-browser.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"rng-browser.js","sources":["../../../../../../node_modules/uuid/lib/rng-browser.js"],"sourcesContent":["// Unique ID creation requires a high quality random # generator. In the\n// browser this is a little complicated due to unknown quality of Math.random()\n// and inconsistent support for the `crypto` API. We do the best we can via\n// feature-detection\n\n// getRandomValues needs to be invoked in a context where \"this\" is a Crypto\n// implementation. Also, find the complete implementation of crypto on IE11.\nvar getRandomValues = (typeof(crypto) != 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto)) ||\n (typeof(msCrypto) != 'undefined' && typeof window.msCrypto.getRandomValues == 'function' && msCrypto.getRandomValues.bind(msCrypto));\n\nif (getRandomValues) {\n // WHATWG crypto RNG - http://wiki.whatwg.org/wiki/Crypto\n var rnds8 = new Uint8Array(16); // eslint-disable-line no-undef\n\n module.exports = function whatwgRNG() {\n getRandomValues(rnds8);\n return rnds8;\n };\n} else {\n // Math.random()-based (RNG)\n //\n // If all else fails, use Math.random(). It's fast, but is of unspecified\n // quality.\n var rnds = new Array(16);\n\n module.exports = function mathRNG() {\n for (var i = 0, r; i < 16; i++) {\n if ((i & 0x03) === 0) r = Math.random() * 0x100000000;\n rnds[i] = r >>> ((i & 0x03) << 3) & 0xff;\n }\n\n return rnds;\n };\n}\n"],"names":["rngBrowserModule"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,eAAe,GAAG,CAAC,OAAO,MAAM,CAAC,IAAI,WAAW,IAAI,MAAM,CAAC,eAAe,IAAI,MAAM,CAAC,eAAe,CAAC,IAAI,CAAC,MAAM,CAAC;AACrH,uBAAuB,OAAO,QAAQ,CAAC,IAAI,WAAW,IAAI,OAAO,MAAM,CAAC,QAAQ,CAAC,eAAe,IAAI,UAAU,IAAI,QAAQ,CAAC,eAAe,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;AAC3J;AACA,IAAI,eAAe,EAAE;AACrB;AACA,EAAE,IAAI,KAAK,GAAG,IAAI,UAAU,CAAC,EAAE,CAAC,CAAC;AACjC;AACA,EAAEA,qBAAc,CAAA,OAAA,GAAG,SAAS,SAAS,GAAG;AACxC,IAAI,eAAe,CAAC,KAAK,CAAC,CAAC;AAC3B,IAAI,OAAO,KAAK,CAAC;AACjB,GAAG,CAAC;AACJ,CAAC,MAAM;AACP;AACA;AACA;AACA;AACA,EAAE,IAAI,IAAI,GAAG,IAAI,KAAK,CAAC,EAAE,CAAC,CAAC;AAC3B;AACA,EAAEA,qBAAc,CAAA,OAAA,GAAG,SAAS,OAAO,GAAG;AACtC,IAAI,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,EAAE,EAAE;AACpC,MAAM,IAAI,CAAC,CAAC,GAAG,IAAI,MAAM,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,GAAG,WAAW,CAAC;AAC5D,MAAM,IAAI,CAAC,CAAC,CA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