@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,5 +1,5 @@
1
- import { getApp, _getProvider, _registerComponent, registerVersion, SDK_VERSION } from '@firebase/app';
2
- import { FirebaseError, createMockUserToken, getModularInstance, getDefaultEmulatorHostnameAndPort } from '@firebase/util';
1
+ import { _getProvider, getApp, _registerComponent, registerVersion, SDK_VERSION } from '@firebase/app';
2
+ import { FirebaseError, isNode, createMockUserToken, getModularInstance, getDefaultEmulatorHostnameAndPort } from '@firebase/util';
3
3
  import { Component } from '@firebase/component';
4
4
 
5
5
  /**
@@ -168,6 +168,9 @@ function serverFileWrongSize() {
168
168
  function noDownloadURL() {
169
169
  return new StorageError("no-download-url" /* NO_DOWNLOAD_URL */, 'The given file does not have any download URLs.');
170
170
  }
171
+ function missingPolyFill(polyFill) {
172
+ 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.`);
173
+ }
171
174
  /**
172
175
  * @internal
173
176
  */
@@ -500,7 +503,9 @@ function isNativeBlob(p) {
500
503
  return isNativeBlobDefined() && p instanceof Blob;
501
504
  }
502
505
  function isNativeBlobDefined() {
503
- return typeof Blob !== 'undefined';
506
+ // Note: The `isNode()` check can be removed when `node-fetch` adds native Blob support
507
+ // PR: https://github.com/node-fetch/node-fetch/pull/1664
508
+ return typeof Blob !== 'undefined' && !isNode();
504
509
  }
505
510
  function validateNumber(argument, minValue, maxValue, value) {
506
511
  if (value < minValue) {
@@ -902,6 +907,9 @@ function sliceBlob(blob, start, end) {
902
907
  */
903
908
  /** Converts a Base64 encoded string to a binary string. */
904
909
  function decodeBase64(encoded) {
910
+ if (typeof atob === 'undefined') {
911
+ throw missingPolyFill('base-64');
912
+ }
905
913
  return atob(encoded);
906
914
  }
907
915
 
@@ -1062,6 +1070,9 @@ function base64Bytes_(format, value) {
1062
1070
  bytes = decodeBase64(value);
1063
1071
  }
1064
1072
  catch (e) {
1073
+ if (e.message.includes('polyfill')) {
1074
+ throw e;
1075
+ }
1065
1076
  throw invalidFormat(format, 'Invalid character found');
1066
1077
  }
1067
1078
  const array = new Uint8Array(bytes.length);
@@ -3303,7 +3314,7 @@ class FirebaseStorageImpl {
3303
3314
  }
3304
3315
 
3305
3316
  const name = "@firebase/storage";
3306
- const version = "0.9.12";
3317
+ const version = "0.9.13-canary.0c0c58f47";
3307
3318
 
3308
3319
  /**
3309
3320
  * @license