@firebase/storage 0.9.12 → 0.9.13-canary.0c0c58f47

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.
@@ -1,6 +1,6 @@
1
1
  import { getApp, _getProvider, _registerComponent, registerVersion, SDK_VERSION } from '@firebase/app';
2
- import { __extends, __spreadArray, __awaiter, __generator, __assign } from 'tslib';
3
- import { FirebaseError, createMockUserToken, getModularInstance, getDefaultEmulatorHostnameAndPort } from '@firebase/util';
2
+ import { __extends, __spreadArray, __assign, __awaiter, __generator } from 'tslib';
3
+ import { FirebaseError, isNode, createMockUserToken, getModularInstance, getDefaultEmulatorHostnameAndPort } from '@firebase/util';
4
4
  import { Component } from '@firebase/component';
5
5
 
6
6
  /**
@@ -181,6 +181,9 @@ function serverFileWrongSize() {
181
181
  function noDownloadURL() {
182
182
  return new StorageError("no-download-url" /* NO_DOWNLOAD_URL */, 'The given file does not have any download URLs.');
183
183
  }
184
+ function missingPolyFill(polyFill) {
185
+ return new StorageError("unsupported-environment" /* UNSUPPORTED_ENVIRONMENT */, polyFill + " is missing. Make sure to install the required polyfills. See https://firebase.google.com/docs/web/environments-js-sdk#polyfills for more information.");
186
+ }
184
187
  /**
185
188
  * @internal
186
189
  */
@@ -532,7 +535,9 @@ function isNativeBlob(p) {
532
535
  return isNativeBlobDefined() && p instanceof Blob;
533
536
  }
534
537
  function isNativeBlobDefined() {
535
- return typeof Blob !== 'undefined';
538
+ // Note: The `isNode()` check can be removed when `node-fetch` adds native Blob support
539
+ // PR: https://github.com/node-fetch/node-fetch/pull/1664
540
+ return typeof Blob !== 'undefined' && !isNode();
536
541
  }
537
542
  function validateNumber(argument, minValue, maxValue, value) {
538
543
  if (value < minValue) {
@@ -944,6 +949,9 @@ function sliceBlob(blob, start, end) {
944
949
  */
945
950
  /** Converts a Base64 encoded string to a binary string. */
946
951
  function decodeBase64(encoded) {
952
+ if (typeof atob === 'undefined') {
953
+ throw missingPolyFill('base-64');
954
+ }
947
955
  return atob(encoded);
948
956
  }
949
957
 
@@ -1105,6 +1113,9 @@ function base64Bytes_(format, value) {
1105
1113
  bytes = decodeBase64(value);
1106
1114
  }
1107
1115
  catch (e) {
1116
+ if (e.message.includes('polyfill')) {
1117
+ throw e;
1118
+ }
1108
1119
  throw invalidFormat(format, 'Invalid character found');
1109
1120
  }
1110
1121
  var array = new Uint8Array(bytes.length);
@@ -3485,7 +3496,7 @@ var FirebaseStorageImpl = /** @class */ (function () {
3485
3496
  }());
3486
3497
 
3487
3498
  var name = "@firebase/storage";
3488
- var version = "0.9.12";
3499
+ var version = "0.9.13-canary.0c0c58f47";
3489
3500
 
3490
3501
  /**
3491
3502
  * @license