@firebase/storage 0.3.31-canary.fc3d5396 → 0.3.31

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.
package/dist/index.cjs.js CHANGED
@@ -182,6 +182,12 @@ function invalidUrl(url) {
182
182
  function invalidDefaultBucket(bucket) {
183
183
  return new FirebaseStorageError(Code.INVALID_DEFAULT_BUCKET, "Invalid default bucket '" + bucket + "'.");
184
184
  }
185
+ function noDefaultBucket() {
186
+ return new FirebaseStorageError(Code.NO_DEFAULT_BUCKET, 'No default bucket ' +
187
+ "found. Did you set the '" +
188
+ CONFIG_STORAGE_BUCKET_KEY +
189
+ "' property when initializing the app?");
190
+ }
185
191
  function cannotSliceBlob() {
186
192
  return new FirebaseStorageError(Code.CANNOT_SLICE_BLOB, 'Cannot slice blob for upload. Please retry the upload.');
187
193
  }
@@ -1353,7 +1359,7 @@ function metadataValidator(p) {
1353
1359
 
1354
1360
  /**
1355
1361
  * @license
1356
- * Copyright 2019 Google LLC
1362
+ * Copyright 2019 Google Inc.
1357
1363
  *
1358
1364
  * Licensed under the Apache License, Version 2.0 (the "License");
1359
1365
  * you may not use this file except in compliance with the License.
@@ -1372,12 +1378,16 @@ var MAX_MAX_RESULTS = 1000;
1372
1378
  var PAGE_TOKEN_KEY = 'pageToken';
1373
1379
  var PREFIXES_KEY = 'prefixes';
1374
1380
  var ITEMS_KEY = 'items';
1375
- function fromBackendResponse(authWrapper, bucket, resource) {
1381
+ function fromBackendResponse(authWrapper, resource) {
1376
1382
  var listResult = {
1377
1383
  prefixes: [],
1378
1384
  items: [],
1379
1385
  nextPageToken: resource['nextPageToken']
1380
1386
  };
1387
+ var bucket = authWrapper.bucket();
1388
+ if (bucket === null) {
1389
+ throw noDefaultBucket();
1390
+ }
1381
1391
  if (resource[PREFIXES_KEY]) {
1382
1392
  for (var _i = 0, _a = resource[PREFIXES_KEY]; _i < _a.length; _i++) {
1383
1393
  var path = _a[_i];
@@ -1395,13 +1405,13 @@ function fromBackendResponse(authWrapper, bucket, resource) {
1395
1405
  }
1396
1406
  return listResult;
1397
1407
  }
1398
- function fromResponseString(authWrapper, bucket, resourceString) {
1408
+ function fromResponseString(authWrapper, resourceString) {
1399
1409
  var obj = jsonObjectOrNull(resourceString);
1400
1410
  if (obj === null) {
1401
1411
  return null;
1402
1412
  }
1403
1413
  var resource = obj;
1404
- return fromBackendResponse(authWrapper, bucket, resource);
1414
+ return fromBackendResponse(authWrapper, resource);
1405
1415
  }
1406
1416
  function listOptionsValidator(p) {
1407
1417
  if (!isObject(p) || !p) {
@@ -1459,7 +1469,7 @@ var RequestInfo = /** @class */ (function () {
1459
1469
 
1460
1470
  /**
1461
1471
  * @license
1462
- * Copyright 2017 Google LLC
1472
+ * Copyright 2017 Google Inc.
1463
1473
  *
1464
1474
  * Licensed under the Apache License, Version 2.0 (the "License");
1465
1475
  * you may not use this file except in compliance with the License.
@@ -1489,9 +1499,9 @@ function metadataHandler(authWrapper, mappings) {
1489
1499
  }
1490
1500
  return handler;
1491
1501
  }
1492
- function listHandler(authWrapper, bucket) {
1502
+ function listHandler(authWrapper) {
1493
1503
  function handler(xhr, text) {
1494
- var listResult = fromResponseString(authWrapper, bucket, text);
1504
+ var listResult = fromResponseString(authWrapper, text);
1495
1505
  handlerCheck(listResult !== null);
1496
1506
  return listResult;
1497
1507
  }
@@ -1571,7 +1581,7 @@ function list(authWrapper, location, delimiter, pageToken, maxResults) {
1571
1581
  var url = makeUrl(urlPart);
1572
1582
  var method = 'GET';
1573
1583
  var timeout = authWrapper.maxOperationRetryTime();
1574
- var requestInfo = new RequestInfo(url, method, listHandler(authWrapper, location.bucket), timeout);
1584
+ var requestInfo = new RequestInfo(url, method, listHandler(authWrapper), timeout);
1575
1585
  requestInfo.urlParams = urlParams;
1576
1586
  requestInfo.errorHandler = sharedErrorHandler(location);
1577
1587
  return requestInfo;
@@ -3536,7 +3546,7 @@ var ServiceInternals = /** @class */ (function () {
3536
3546
  }());
3537
3547
 
3538
3548
  var name = "@firebase/storage";
3539
- var version = "0.3.31-canary.fc3d5396";
3549
+ var version = "0.3.31";
3540
3550
 
3541
3551
  /**
3542
3552
  * @license