@twilio/mcs-client 0.5.3 → 0.6.0-canary.102

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 (40) hide show
  1. package/builds/browser.js +449 -484
  2. package/builds/browser.js.map +1 -1
  3. package/builds/lib.d.ts +16 -25
  4. package/builds/lib.js +449 -484
  5. package/builds/lib.js.map +1 -1
  6. package/builds/twilio-mcs-client.js +11240 -9472
  7. package/builds/twilio-mcs-client.min.js +37 -38
  8. package/dist/_virtual/rng-browser.js +34 -0
  9. package/dist/_virtual/rng-browser.js.map +1 -0
  10. package/dist/cancellable-promise.js +98 -0
  11. package/dist/cancellable-promise.js.map +1 -0
  12. package/dist/client.js +88 -23
  13. package/dist/client.js.map +1 -1
  14. package/dist/configuration.js.map +1 -1
  15. package/dist/index.js +8 -9
  16. package/dist/index.js.map +1 -1
  17. package/dist/logger.js +2 -4
  18. package/dist/logger.js.map +1 -1
  19. package/dist/media.js +15 -22
  20. package/dist/media.js.map +1 -1
  21. package/dist/node_modules/tslib/tslib.es6.js +1 -1
  22. package/dist/node_modules/tslib/tslib.es6.js.map +1 -1
  23. package/dist/node_modules/uuid/index.js +44 -0
  24. package/dist/node_modules/uuid/index.js.map +1 -0
  25. package/dist/node_modules/uuid/lib/bytesToUuid.js +60 -0
  26. package/dist/node_modules/uuid/lib/bytesToUuid.js.map +1 -0
  27. package/dist/node_modules/uuid/lib/rng-browser.js +65 -0
  28. package/dist/node_modules/uuid/lib/rng-browser.js.map +1 -0
  29. package/dist/node_modules/uuid/v1.js +146 -0
  30. package/dist/node_modules/uuid/v1.js.map +1 -0
  31. package/dist/node_modules/uuid/v4.js +66 -0
  32. package/dist/node_modules/uuid/v4.js.map +1 -0
  33. package/dist/packages/mcs-client/package.json.js +1 -1
  34. package/dist/services/network.js +54 -32
  35. package/dist/services/network.js.map +1 -1
  36. package/dist/services/transport.js +26 -11
  37. package/dist/services/transport.js.map +1 -1
  38. package/dist/services/transporterror.js.map +1 -1
  39. package/package.json +21 -16
  40. package/CHANGELOG.md +0 -210
package/builds/lib.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  /// <reference types="node" />
2
2
  import * as log from "loglevel";
3
3
  import * as loglevel from "loglevel";
4
+ import { CancellablePromise } from "@twilio/shared";
4
5
  type Headers = {
5
6
  [id: string]: string;
6
7
  };
@@ -17,11 +18,11 @@ declare class Transport {
17
18
  /**
18
19
  * Make a GET request by given URL
19
20
  */
20
- get(url: string, headers: Headers): Promise<Response>;
21
+ get(url: string, headers: Headers): CancellablePromise<Response>;
21
22
  /**
22
23
  * Make a POST request by given URL
23
24
  */
24
- post(url: string, headers: Headers, body?: any): Promise<Response>;
25
+ post(url: string, headers: Headers, body?: any): CancellablePromise<Response>;
25
26
  }
26
27
  interface BackoffOverride {
27
28
  max: number;
@@ -60,8 +61,8 @@ declare class Network {
60
61
  private backoffConfig;
61
62
  private retryWhenThrottled;
62
63
  private executeWithRetry;
63
- get(url: string): Promise<any>;
64
- post(url: string, category: MediaCategory | null, media: string | Buffer | Blob | FormData | Record<string, unknown>, contentType?: string, filename?: string): Promise<any>;
64
+ get(url: string): CancellablePromise<any>;
65
+ post(url: string, category: MediaCategory | null, media: string | Buffer | Blob | FormData | Record<string, unknown>, contentType?: string, filename?: string): CancellablePromise<any>;
65
66
  }
66
67
  type MediaCategory = "media" | "body" | "history";
67
68
  interface Links {
@@ -118,21 +119,8 @@ declare class Media {
118
119
  *
119
120
  * It is reasonable to build your own refresh logic upon these two functions: as soon as URL returned
120
121
  * by getCachedContentUrl() returns 40x status you should call getContentUrl() to refresh it.
121
- *
122
- * @returns {Promise<string>}
123
- */
124
- getContentUrl(): Promise<string | null>;
125
- /**
126
- * Returns direct content URL to uploaded binary. This URL will expire after some time.
127
- * This function does not support getting a new URL however. Once set it will remain the same.
128
- * Use getContentUrl() to query a new one.
129
- *
130
- * It is reasonable to build your own refresh logic upon these two functions: as soon as URL returned
131
- * by getCachedContentUrl() returns 40x status you should call getContentUrl() to refresh it.
132
- *
133
- * @returns {Promise<string>}
134
122
  */
135
- getCachedContentUrl(): Promise<string | null>;
123
+ getContentUrl(): CancellablePromise<string | null>;
136
124
  private _update;
137
125
  }
138
126
  interface Options$0 {
@@ -175,30 +163,33 @@ declare class Client {
175
163
  /**
176
164
  * Gets media from media service
177
165
  * @param {String} sid - Media's SID
178
- * @returns {Promise<Media>}
179
166
  */
180
- get(sid: string): Promise<Media>;
167
+ get(sid: string): CancellablePromise<Media>;
181
168
  /**
182
169
  * Posts raw content to media service
183
170
  * @param {String} contentType - content type of media
184
171
  * @param {String|Buffer|Blob} media - content to post
185
172
  * @param {MediaCategory|null} category - category for the media
186
- * @returns {Promise<Media>}
187
173
  */
188
- post(contentType: string, media: string | Buffer | Blob, category: MediaCategory | null, filename?: string): Promise<Media>;
174
+ post(contentType: string, media: string | Buffer | Blob, category: MediaCategory | null, filename?: string): CancellablePromise<Media>;
189
175
  /**
190
176
  * Posts FormData to media service. Can be used only with browser engine's FormData.
191
177
  * In non-browser FormData case the method will do promise reject with
192
178
  * new TypeError("Posting FormData supported only with browser engine's FormData")
193
179
  * @param {FormData} formData - form data to post
194
180
  * @param {MediaCategory|null} category - category for the media
195
- * @returns {Promise<Media>}
196
181
  */
197
- postFormData(formData: FormData, category?: MediaCategory | null): Promise<Media>;
182
+ postFormData(formData: FormData, category?: MediaCategory | null): CancellablePromise<Media>;
198
183
  /**
199
184
  * Retrieve information about multiple media SIDs at the same time.
200
185
  * @param mediaSids Array of Media SIDs to get information from.
201
186
  */
202
- mediaSetGet(mediaSids: string[]): Promise<Media[]>;
187
+ mediaSetGet(mediaSids: string[]): CancellablePromise<Media[]>;
188
+ /**
189
+ * Retrieve temporary URLs for a set of media SIDs.
190
+ * @param mediaSids array of the media SIDs to get URLs from.
191
+ */
192
+ mediaSetGetContentUrls(mediaSids: string[]): CancellablePromise<Map<string, string>>;
203
193
  }
194
+ export { CancellablePromise } from "@twilio/shared";
204
195
  export { Client, Client as McsClient, Client as default, Media, Media as McsMedia, MediaCategory, MediaCategory as McsMediaCategory };