@firebase/storage 0.8.6-2021108175111 → 0.8.6-canary.7a5bc84bd

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 (48) hide show
  1. package/CHANGELOG.md +3 -4
  2. package/dist/index.browser.cjs.js +215 -31
  3. package/dist/index.browser.cjs.js.map +1 -1
  4. package/dist/index.esm2017.js +194 -32
  5. package/dist/index.esm2017.js.map +1 -1
  6. package/dist/index.esm5.js +213 -32
  7. package/dist/index.esm5.js.map +1 -1
  8. package/dist/index.node.cjs.js +262 -51
  9. package/dist/index.node.cjs.js.map +1 -1
  10. package/dist/node-esm/index.node.esm.js +206 -52
  11. package/dist/node-esm/index.node.esm.js.map +1 -1
  12. package/dist/node-esm/src/api.browser.d.ts +32 -1
  13. package/dist/node-esm/src/api.d.ts +15 -0
  14. package/dist/node-esm/src/api.node.d.ts +32 -1
  15. package/dist/node-esm/src/implementation/connection.d.ts +14 -4
  16. package/dist/node-esm/src/implementation/request.d.ts +5 -5
  17. package/dist/node-esm/src/implementation/requestinfo.d.ts +14 -6
  18. package/dist/node-esm/src/implementation/requests.d.ts +17 -16
  19. package/dist/node-esm/src/platform/browser/connection.d.ts +24 -7
  20. package/dist/node-esm/src/platform/connection.d.ts +6 -2
  21. package/dist/node-esm/src/platform/node/connection.d.ts +30 -14
  22. package/dist/node-esm/src/reference.d.ts +13 -0
  23. package/dist/node-esm/src/service.d.ts +3 -3
  24. package/dist/node-esm/test/integration/integration.test.d.ts +4 -0
  25. package/dist/node-esm/test/{unit → node}/connection.test.d.ts +0 -0
  26. package/dist/{test/unit/connection.test.d.ts → node-esm/test/node/stream.test.d.ts} +0 -0
  27. package/dist/node-esm/test/unit/connection.d.ts +4 -3
  28. package/dist/node-esm/test/unit/testshared.d.ts +2 -2
  29. package/dist/src/api.browser.d.ts +32 -1
  30. package/dist/src/api.d.ts +15 -0
  31. package/dist/src/api.node.d.ts +32 -1
  32. package/dist/src/implementation/connection.d.ts +14 -4
  33. package/dist/src/implementation/request.d.ts +5 -5
  34. package/dist/src/implementation/requestinfo.d.ts +14 -6
  35. package/dist/src/implementation/requests.d.ts +17 -16
  36. package/dist/src/platform/browser/connection.d.ts +24 -7
  37. package/dist/src/platform/connection.d.ts +6 -2
  38. package/dist/src/platform/node/connection.d.ts +30 -14
  39. package/dist/src/reference.d.ts +13 -0
  40. package/dist/src/service.d.ts +3 -3
  41. package/dist/storage-public.d.ts +46 -0
  42. package/dist/storage.d.ts +80 -11
  43. package/dist/test/integration/integration.test.d.ts +4 -0
  44. package/dist/test/node/connection.test.d.ts +17 -0
  45. package/dist/test/node/stream.test.d.ts +17 -0
  46. package/dist/test/unit/connection.d.ts +4 -3
  47. package/dist/test/unit/testshared.d.ts +2 -2
  48. package/package.json +6 -6
package/CHANGELOG.md CHANGED
@@ -1,15 +1,14 @@
1
1
  #Unreleased
2
2
 
3
- ## 0.8.6-2021108175111
3
+ ## 0.8.6
4
4
 
5
5
  ### Patch Changes
6
6
 
7
7
  - [`3281315fa`](https://github.com/firebase/firebase-js-sdk/commit/3281315fae9c6f535f9d5052ee17d60861ea569a) [#5708](https://github.com/firebase/firebase-js-sdk/pull/5708) (fixes [#1487](https://github.com/firebase/firebase-js-sdk/issues/1487)) - Update build scripts to work with the exports field
8
8
 
9
9
  - Updated dependencies [[`3281315fa`](https://github.com/firebase/firebase-js-sdk/commit/3281315fae9c6f535f9d5052ee17d60861ea569a)]:
10
- - @firebase/app@0.7.7-2021108175111
11
- - @firebase/component@0.5.9-2021108175111
12
- - @firebase/util@1.4.2-2021108175111
10
+ - @firebase/component@0.5.9
11
+ - @firebase/util@1.4.2
13
12
 
14
13
  ## 0.8.5
15
14
 
@@ -359,7 +359,9 @@ callback, timeout) {
359
359
  // Would type this as "number" but that doesn't work for Node so ¯\_(ツ)_/¯
360
360
  // TODO: find a way to exclude Node type definition for storage because storage only works in browser
361
361
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
362
- var timeoutId = null;
362
+ var retryTimeoutId = null;
363
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
364
+ var globalTimeoutId = null;
363
365
  var hitTimeout = false;
364
366
  var cancelState = 0;
365
367
  function canceled() {
@@ -377,25 +379,33 @@ callback, timeout) {
377
379
  }
378
380
  }
379
381
  function callWithDelay(millis) {
380
- timeoutId = setTimeout(function () {
381
- timeoutId = null;
382
+ retryTimeoutId = setTimeout(function () {
383
+ retryTimeoutId = null;
382
384
  f(handler, canceled());
383
385
  }, millis);
384
386
  }
387
+ function clearGlobalTimeout() {
388
+ if (globalTimeoutId) {
389
+ clearTimeout(globalTimeoutId);
390
+ }
391
+ }
385
392
  function handler(success) {
386
393
  var args = [];
387
394
  for (var _i = 1; _i < arguments.length; _i++) {
388
395
  args[_i - 1] = arguments[_i];
389
396
  }
390
397
  if (triggeredCallback) {
398
+ clearGlobalTimeout();
391
399
  return;
392
400
  }
393
401
  if (success) {
402
+ clearGlobalTimeout();
394
403
  triggerCallback.call.apply(triggerCallback, tslib.__spreadArray([null, success], args));
395
404
  return;
396
405
  }
397
406
  var mustStop = canceled() || hitTimeout;
398
407
  if (mustStop) {
408
+ clearGlobalTimeout();
399
409
  triggerCallback.call.apply(triggerCallback, tslib.__spreadArray([null, success], args));
400
410
  return;
401
411
  }
@@ -419,14 +429,15 @@ callback, timeout) {
419
429
  return;
420
430
  }
421
431
  stopped = true;
432
+ clearGlobalTimeout();
422
433
  if (triggeredCallback) {
423
434
  return;
424
435
  }
425
- if (timeoutId !== null) {
436
+ if (retryTimeoutId !== null) {
426
437
  if (!wasTimeout) {
427
438
  cancelState = 2;
428
439
  }
429
- clearTimeout(timeoutId);
440
+ clearTimeout(retryTimeoutId);
430
441
  callWithDelay(0);
431
442
  }
432
443
  else {
@@ -436,7 +447,7 @@ callback, timeout) {
436
447
  }
437
448
  }
438
449
  callWithDelay(0);
439
- setTimeout(function () {
450
+ globalTimeoutId = setTimeout(function () {
440
451
  hitTimeout = true;
441
452
  stop(true);
442
453
  }, timeout);
@@ -576,6 +587,14 @@ var ErrorCode;
576
587
  * See the License for the specific language governing permissions and
577
588
  * limitations under the License.
578
589
  */
590
+ /**
591
+ * Handles network logic for all Storage Requests, including error reporting and
592
+ * retries with backoff.
593
+ *
594
+ * @param I - the type of the backend's network response.
595
+ * @param - O the output type used by the rest of the SDK. The conversion
596
+ * happens in the specified `callback_`.
597
+ */
579
598
  var NetworkRequest = /** @class */ (function () {
580
599
  function NetworkRequest(url_, method_, headers_, body_, successCodes_, additionalRetryCodes_, callback_, errorCallback_, timeout_, progressCallback_, connectionFactory_) {
581
600
  var _this = this;
@@ -654,7 +673,7 @@ var NetworkRequest = /** @class */ (function () {
654
673
  var connection = status.connection;
655
674
  if (status.wasSuccessCode) {
656
675
  try {
657
- var result = _this.callback_(connection, connection.getResponseText());
676
+ var result = _this.callback_(connection, connection.getResponse());
658
677
  if (isJustDef(result)) {
659
678
  resolve(result);
660
679
  }
@@ -669,7 +688,7 @@ var NetworkRequest = /** @class */ (function () {
669
688
  else {
670
689
  if (connection !== null) {
671
690
  var err = unknown();
672
- err.serverResponse = connection.getResponseText();
691
+ err.serverResponse = connection.getErrorText();
673
692
  if (_this.errorCallback_) {
674
693
  reject(_this.errorCallback_(connection, err));
675
694
  }
@@ -802,7 +821,7 @@ function getBlobBuilder() {
802
821
  * @param args The values that will make up the resulting blob.
803
822
  * @return The blob.
804
823
  */
805
- function getBlob() {
824
+ function getBlob$1() {
806
825
  var args = [];
807
826
  for (var _i = 0; _i < arguments.length; _i++) {
808
827
  args[_i] = arguments[_i];
@@ -1162,7 +1181,7 @@ var FbsBlob = /** @class */ (function () {
1162
1181
  return val;
1163
1182
  }
1164
1183
  });
1165
- return new FbsBlob(getBlob.apply(null, blobby));
1184
+ return new FbsBlob(getBlob$1.apply(null, blobby));
1166
1185
  }
1167
1186
  else {
1168
1187
  var uint8Arrays = args.map(function (val) {
@@ -1488,6 +1507,12 @@ function fromResponseString(service, bucket, resourceString) {
1488
1507
  return fromBackendResponse(service, bucket, resource);
1489
1508
  }
1490
1509
 
1510
+ /**
1511
+ * Contains a fully specified request.
1512
+ *
1513
+ * @param I - the type of the backend's network response.
1514
+ * @param O - the output response type used by the rest of the SDK.
1515
+ */
1491
1516
  var RequestInfo = /** @class */ (function () {
1492
1517
  function RequestInfo(url, method,
1493
1518
  /**
@@ -1572,7 +1597,7 @@ function sharedErrorHandler(location) {
1572
1597
  if (
1573
1598
  // This exact message string is the only consistent part of the
1574
1599
  // server's error response that identifies it as an App Check error.
1575
- xhr.getResponseText().includes('Firebase App Check token is invalid')) {
1600
+ xhr.getErrorText().includes('Firebase App Check token is invalid')) {
1576
1601
  newErr = unauthorizedApp();
1577
1602
  }
1578
1603
  else {
@@ -1644,6 +1669,19 @@ function list$2(service, location, delimiter, pageToken, maxResults) {
1644
1669
  requestInfo.errorHandler = sharedErrorHandler(location);
1645
1670
  return requestInfo;
1646
1671
  }
1672
+ function getBytes$1(service, location, maxDownloadSizeBytes) {
1673
+ var urlPart = location.fullServerUrl();
1674
+ var url = makeUrl(urlPart, service.host, service._protocol) + '?alt=media';
1675
+ var method = 'GET';
1676
+ var timeout = service.maxOperationRetryTime;
1677
+ var requestInfo = new RequestInfo(url, method, function (_, data) { return data; }, timeout);
1678
+ requestInfo.errorHandler = objectErrorHandler(location);
1679
+ if (maxDownloadSizeBytes !== undefined) {
1680
+ requestInfo.headers['Range'] = "bytes=0-" + maxDownloadSizeBytes;
1681
+ requestInfo.successCodes = [200 /* OK */, 206 /* Partial Content */];
1682
+ }
1683
+ return requestInfo;
1684
+ }
1647
1685
  function getDownloadUrl(service, location, mappings) {
1648
1686
  var urlPart = location.fullServerUrl();
1649
1687
  var url = makeUrl(urlPart, service.host, service._protocol);
@@ -2056,7 +2094,7 @@ function async(f) {
2056
2094
  * limitations under the License.
2057
2095
  */
2058
2096
  /** An override for the text-based Connection. Used in tests. */
2059
- var connectionFactoryOverride = null;
2097
+ var textFactoryOverride = null;
2060
2098
  /**
2061
2099
  * Network layer for browsers. We use this instead of goog.net.XhrIo because
2062
2100
  * goog.net.XhrIo is hyuuuuge and doesn't work in React Native on Android.
@@ -2066,6 +2104,7 @@ var XhrConnection = /** @class */ (function () {
2066
2104
  var _this = this;
2067
2105
  this.sent_ = false;
2068
2106
  this.xhr_ = new XMLHttpRequest();
2107
+ this.initXhr();
2069
2108
  this.errorCode_ = ErrorCode.NO_ERROR;
2070
2109
  this.sendPromise_ = new Promise(function (resolve) {
2071
2110
  _this.xhr_.addEventListener('abort', function () {
@@ -2119,11 +2158,17 @@ var XhrConnection = /** @class */ (function () {
2119
2158
  return -1;
2120
2159
  }
2121
2160
  };
2122
- XhrConnection.prototype.getResponseText = function () {
2161
+ XhrConnection.prototype.getResponse = function () {
2162
+ if (!this.sent_) {
2163
+ throw internalError('cannot .getResponse() before sending');
2164
+ }
2165
+ return this.xhr_.response;
2166
+ };
2167
+ XhrConnection.prototype.getErrorText = function () {
2123
2168
  if (!this.sent_) {
2124
- throw internalError('cannot .getResponseText() before sending');
2169
+ throw internalError('cannot .getErrorText() before sending');
2125
2170
  }
2126
- return this.xhr_.responseText;
2171
+ return this.xhr_.statusText;
2127
2172
  };
2128
2173
  /** Aborts the request. */
2129
2174
  XhrConnection.prototype.abort = function () {
@@ -2144,10 +2189,44 @@ var XhrConnection = /** @class */ (function () {
2144
2189
  };
2145
2190
  return XhrConnection;
2146
2191
  }());
2147
- function newConnection() {
2148
- return connectionFactoryOverride
2149
- ? connectionFactoryOverride()
2150
- : new XhrConnection();
2192
+ var XhrTextConnection = /** @class */ (function (_super) {
2193
+ tslib.__extends(XhrTextConnection, _super);
2194
+ function XhrTextConnection() {
2195
+ return _super !== null && _super.apply(this, arguments) || this;
2196
+ }
2197
+ XhrTextConnection.prototype.initXhr = function () {
2198
+ this.xhr_.responseType = 'text';
2199
+ };
2200
+ return XhrTextConnection;
2201
+ }(XhrConnection));
2202
+ function newTextConnection() {
2203
+ return textFactoryOverride ? textFactoryOverride() : new XhrTextConnection();
2204
+ }
2205
+ var XhrBytesConnection = /** @class */ (function (_super) {
2206
+ tslib.__extends(XhrBytesConnection, _super);
2207
+ function XhrBytesConnection() {
2208
+ return _super !== null && _super.apply(this, arguments) || this;
2209
+ }
2210
+ XhrBytesConnection.prototype.initXhr = function () {
2211
+ this.xhr_.responseType = 'arraybuffer';
2212
+ };
2213
+ return XhrBytesConnection;
2214
+ }(XhrConnection));
2215
+ function newBytesConnection() {
2216
+ return new XhrBytesConnection();
2217
+ }
2218
+ var XhrBlobConnection = /** @class */ (function (_super) {
2219
+ tslib.__extends(XhrBlobConnection, _super);
2220
+ function XhrBlobConnection() {
2221
+ return _super !== null && _super.apply(this, arguments) || this;
2222
+ }
2223
+ XhrBlobConnection.prototype.initXhr = function () {
2224
+ this.xhr_.responseType = 'blob';
2225
+ };
2226
+ return XhrBlobConnection;
2227
+ }(XhrConnection));
2228
+ function newBlobConnection() {
2229
+ return new XhrBlobConnection();
2151
2230
  }
2152
2231
 
2153
2232
  /**
@@ -2295,7 +2374,7 @@ var UploadTask = /** @class */ (function () {
2295
2374
  var _this = this;
2296
2375
  this._resolveToken(function (authToken, appCheckToken) {
2297
2376
  var requestInfo = createResumableUpload(_this._ref.storage, _this._ref._location, _this._mappings, _this._blob, _this._metadata);
2298
- var createRequest = _this._ref.storage._makeRequest(requestInfo, newConnection, authToken, appCheckToken);
2377
+ var createRequest = _this._ref.storage._makeRequest(requestInfo, newTextConnection, authToken, appCheckToken);
2299
2378
  _this._request = createRequest;
2300
2379
  createRequest.getPromise().then(function (url) {
2301
2380
  _this._request = undefined;
@@ -2311,7 +2390,7 @@ var UploadTask = /** @class */ (function () {
2311
2390
  var url = this._uploadUrl;
2312
2391
  this._resolveToken(function (authToken, appCheckToken) {
2313
2392
  var requestInfo = getResumableUploadStatus(_this._ref.storage, _this._ref._location, url, _this._blob);
2314
- var statusRequest = _this._ref.storage._makeRequest(requestInfo, newConnection, authToken, appCheckToken);
2393
+ var statusRequest = _this._ref.storage._makeRequest(requestInfo, newTextConnection, authToken, appCheckToken);
2315
2394
  _this._request = statusRequest;
2316
2395
  statusRequest.getPromise().then(function (status) {
2317
2396
  status = status;
@@ -2341,7 +2420,7 @@ var UploadTask = /** @class */ (function () {
2341
2420
  _this._transition("error" /* ERROR */);
2342
2421
  return;
2343
2422
  }
2344
- var uploadRequest = _this._ref.storage._makeRequest(requestInfo, newConnection, authToken, appCheckToken);
2423
+ var uploadRequest = _this._ref.storage._makeRequest(requestInfo, newTextConnection, authToken, appCheckToken);
2345
2424
  _this._request = uploadRequest;
2346
2425
  uploadRequest.getPromise().then(function (newStatus) {
2347
2426
  _this._increaseMultiplier();
@@ -2368,7 +2447,7 @@ var UploadTask = /** @class */ (function () {
2368
2447
  var _this = this;
2369
2448
  this._resolveToken(function (authToken, appCheckToken) {
2370
2449
  var requestInfo = getMetadata$2(_this._ref.storage, _this._ref._location, _this._mappings);
2371
- var metadataRequest = _this._ref.storage._makeRequest(requestInfo, newConnection, authToken, appCheckToken);
2450
+ var metadataRequest = _this._ref.storage._makeRequest(requestInfo, newTextConnection, authToken, appCheckToken);
2372
2451
  _this._request = metadataRequest;
2373
2452
  metadataRequest.getPromise().then(function (metadata) {
2374
2453
  _this._request = undefined;
@@ -2381,7 +2460,7 @@ var UploadTask = /** @class */ (function () {
2381
2460
  var _this = this;
2382
2461
  this._resolveToken(function (authToken, appCheckToken) {
2383
2462
  var requestInfo = multipartUpload(_this._ref.storage, _this._ref._location, _this._mappings, _this._blob, _this._metadata);
2384
- var multipartRequest = _this._ref.storage._makeRequest(requestInfo, newConnection, authToken, appCheckToken);
2463
+ var multipartRequest = _this._ref.storage._makeRequest(requestInfo, newTextConnection, authToken, appCheckToken);
2385
2464
  _this._request = multipartRequest;
2386
2465
  multipartRequest.getPromise().then(function (metadata) {
2387
2466
  _this._request = undefined;
@@ -2778,6 +2857,38 @@ var Reference = /** @class */ (function () {
2778
2857
  };
2779
2858
  return Reference;
2780
2859
  }());
2860
+ /**
2861
+ * Download the bytes at the object's location.
2862
+ * @returns A Promise containing the downloaded bytes.
2863
+ */
2864
+ function getBytesInternal(ref, maxDownloadSizeBytes) {
2865
+ ref._throwIfRoot('getBytes');
2866
+ var requestInfo = getBytes$1(ref.storage, ref._location, maxDownloadSizeBytes);
2867
+ return ref.storage
2868
+ .makeRequestWithTokens(requestInfo, newBytesConnection)
2869
+ .then(function (bytes) {
2870
+ return maxDownloadSizeBytes !== undefined
2871
+ ? // GCS may not honor the Range header for small files
2872
+ bytes.slice(0, maxDownloadSizeBytes)
2873
+ : bytes;
2874
+ });
2875
+ }
2876
+ /**
2877
+ * Download the bytes at the object's location.
2878
+ * @returns A Promise containing the downloaded blob.
2879
+ */
2880
+ function getBlobInternal(ref, maxDownloadSizeBytes) {
2881
+ ref._throwIfRoot('getBlob');
2882
+ var requestInfo = getBytes$1(ref.storage, ref._location, maxDownloadSizeBytes);
2883
+ return ref.storage
2884
+ .makeRequestWithTokens(requestInfo, newBlobConnection)
2885
+ .then(function (blob) {
2886
+ return maxDownloadSizeBytes !== undefined
2887
+ ? // GCS may not honor the Range header for small files
2888
+ blob.slice(0, maxDownloadSizeBytes)
2889
+ : blob;
2890
+ });
2891
+ }
2781
2892
  /**
2782
2893
  * Uploads data to this object's location.
2783
2894
  * The upload is not resumable.
@@ -2791,7 +2902,7 @@ function uploadBytes$1(ref, data, metadata) {
2791
2902
  ref._throwIfRoot('uploadBytes');
2792
2903
  var requestInfo = multipartUpload(ref.storage, ref._location, getMappings(), new FbsBlob(data, true), metadata);
2793
2904
  return ref.storage
2794
- .makeRequestWithTokens(requestInfo, newConnection)
2905
+ .makeRequestWithTokens(requestInfo, newTextConnection)
2795
2906
  .then(function (finalMetadata) {
2796
2907
  return {
2797
2908
  metadata: finalMetadata,
@@ -2923,7 +3034,7 @@ function list$1(ref, options) {
2923
3034
  var op = options || {};
2924
3035
  var requestInfo = list$2(ref.storage, ref._location,
2925
3036
  /*delimiter= */ '/', op.pageToken, op.maxResults);
2926
- return ref.storage.makeRequestWithTokens(requestInfo, newConnection);
3037
+ return ref.storage.makeRequestWithTokens(requestInfo, newTextConnection);
2927
3038
  }
2928
3039
  /**
2929
3040
  * A `Promise` that resolves with the metadata for this object. If this
@@ -2935,7 +3046,7 @@ function list$1(ref, options) {
2935
3046
  function getMetadata$1(ref) {
2936
3047
  ref._throwIfRoot('getMetadata');
2937
3048
  var requestInfo = getMetadata$2(ref.storage, ref._location, getMappings());
2938
- return ref.storage.makeRequestWithTokens(requestInfo, newConnection);
3049
+ return ref.storage.makeRequestWithTokens(requestInfo, newTextConnection);
2939
3050
  }
2940
3051
  /**
2941
3052
  * Updates the metadata for this object.
@@ -2951,7 +3062,7 @@ function getMetadata$1(ref) {
2951
3062
  function updateMetadata$1(ref, metadata) {
2952
3063
  ref._throwIfRoot('updateMetadata');
2953
3064
  var requestInfo = updateMetadata$2(ref.storage, ref._location, metadata, getMappings());
2954
- return ref.storage.makeRequestWithTokens(requestInfo, newConnection);
3065
+ return ref.storage.makeRequestWithTokens(requestInfo, newTextConnection);
2955
3066
  }
2956
3067
  /**
2957
3068
  * Returns the download URL for the given Reference.
@@ -2963,7 +3074,7 @@ function getDownloadURL$1(ref) {
2963
3074
  ref._throwIfRoot('getDownloadURL');
2964
3075
  var requestInfo = getDownloadUrl(ref.storage, ref._location, getMappings());
2965
3076
  return ref.storage
2966
- .makeRequestWithTokens(requestInfo, newConnection)
3077
+ .makeRequestWithTokens(requestInfo, newTextConnection)
2967
3078
  .then(function (url) {
2968
3079
  if (url === null) {
2969
3080
  throw noDownloadURL();
@@ -2980,7 +3091,7 @@ function getDownloadURL$1(ref) {
2980
3091
  function deleteObject$1(ref) {
2981
3092
  ref._throwIfRoot('deleteObject');
2982
3093
  var requestInfo = deleteObject$2(ref.storage, ref._location);
2983
- return ref.storage.makeRequestWithTokens(requestInfo, newConnection);
3094
+ return ref.storage.makeRequestWithTokens(requestInfo, newTextConnection);
2984
3095
  }
2985
3096
  /**
2986
3097
  * Returns reference for object obtained by appending `childPath` to `ref`.
@@ -3280,7 +3391,7 @@ var FirebaseStorageImpl = /** @class */ (function () {
3280
3391
  }());
3281
3392
 
3282
3393
  var name = "@firebase/storage";
3283
- var version = "0.8.6-2021108175111";
3394
+ var version = "0.8.6-canary.7a5bc84bd";
3284
3395
 
3285
3396
  /**
3286
3397
  * @license
@@ -3319,6 +3430,24 @@ var STORAGE_TYPE = 'storage';
3319
3430
  * See the License for the specific language governing permissions and
3320
3431
  * limitations under the License.
3321
3432
  */
3433
+ /**
3434
+ * Downloads the data at the object's location. Returns an error if the object
3435
+ * is not found.
3436
+ *
3437
+ * To use this functionality, you have to whitelist your app's origin in your
3438
+ * Cloud Storage bucket. See also
3439
+ * https://cloud.google.com/storage/docs/configuring-cors
3440
+ *
3441
+ * @public
3442
+ * @param ref - StorageReference where data should be downloaded.
3443
+ * @param maxDownloadSizeBytes - If set, the maximum allowed size in bytes to
3444
+ * retrieve.
3445
+ * @returns A Promise containing the object's bytes
3446
+ */
3447
+ function getBytes(ref, maxDownloadSizeBytes) {
3448
+ ref = util.getModularInstance(ref);
3449
+ return getBytesInternal(ref, maxDownloadSizeBytes);
3450
+ }
3322
3451
  /**
3323
3452
  * Uploads data to this object's location.
3324
3453
  * The upload is not resumable.
@@ -3495,6 +3624,58 @@ function connectStorageEmulator(storage, host, port, options) {
3495
3624
  connectStorageEmulator$1(storage, host, port, options);
3496
3625
  }
3497
3626
 
3627
+ /**
3628
+ * @license
3629
+ * Copyright 2021 Google LLC
3630
+ *
3631
+ * Licensed under the Apache License, Version 2.0 (the "License");
3632
+ * you may not use this file except in compliance with the License.
3633
+ * You may obtain a copy of the License at
3634
+ *
3635
+ * http://www.apache.org/licenses/LICENSE-2.0
3636
+ *
3637
+ * Unless required by applicable law or agreed to in writing, software
3638
+ * distributed under the License is distributed on an "AS IS" BASIS,
3639
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3640
+ * See the License for the specific language governing permissions and
3641
+ * limitations under the License.
3642
+ */
3643
+ /**
3644
+ * Downloads the data at the object's location. Returns an error if the object
3645
+ * is not found.
3646
+ *
3647
+ * To use this functionality, you have to whitelist your app's origin in your
3648
+ * Cloud Storage bucket. See also
3649
+ * https://cloud.google.com/storage/docs/configuring-cors
3650
+ *
3651
+ * This API is not available in Node.
3652
+ *
3653
+ * @public
3654
+ * @param ref - StorageReference where data should be downloaded.
3655
+ * @param maxDownloadSizeBytes - If set, the maximum allowed size in bytes to
3656
+ * retrieve.
3657
+ * @returns A Promise that resolves with a Blob containing the object's bytes
3658
+ */
3659
+ function getBlob(ref, maxDownloadSizeBytes) {
3660
+ ref = util.getModularInstance(ref);
3661
+ return getBlobInternal(ref, maxDownloadSizeBytes);
3662
+ }
3663
+ /**
3664
+ * Downloads the data at the object's location. Raises an error event if the
3665
+ * object is not found.
3666
+ *
3667
+ * This API is only available in Node.
3668
+ *
3669
+ * @public
3670
+ * @param ref - StorageReference where data should be downloaded.
3671
+ * @param maxDownloadSizeBytes - If set, the maximum allowed size in bytes to
3672
+ * retrieve.
3673
+ * @returns A stream with the object's data as bytes
3674
+ */
3675
+ function getStream(ref, maxDownloadSizeBytes) {
3676
+ throw new Error('getStream() is only supported by NodeJS builds');
3677
+ }
3678
+
3498
3679
  /**
3499
3680
  * Cloud Storage for Firebase
3500
3681
  *
@@ -3528,9 +3709,12 @@ exports._invalidArgument = invalidArgument;
3528
3709
  exports._invalidRootOperation = invalidRootOperation;
3529
3710
  exports.connectStorageEmulator = connectStorageEmulator;
3530
3711
  exports.deleteObject = deleteObject;
3712
+ exports.getBlob = getBlob;
3713
+ exports.getBytes = getBytes;
3531
3714
  exports.getDownloadURL = getDownloadURL;
3532
3715
  exports.getMetadata = getMetadata;
3533
3716
  exports.getStorage = getStorage;
3717
+ exports.getStream = getStream;
3534
3718
  exports.list = list;
3535
3719
  exports.listAll = listAll;
3536
3720
  exports.ref = ref;