@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.esm.js CHANGED
@@ -176,6 +176,12 @@ function invalidUrl(url) {
176
176
  function invalidDefaultBucket(bucket) {
177
177
  return new FirebaseStorageError(Code.INVALID_DEFAULT_BUCKET, "Invalid default bucket '" + bucket + "'.");
178
178
  }
179
+ function noDefaultBucket() {
180
+ return new FirebaseStorageError(Code.NO_DEFAULT_BUCKET, 'No default bucket ' +
181
+ "found. Did you set the '" +
182
+ CONFIG_STORAGE_BUCKET_KEY +
183
+ "' property when initializing the app?");
184
+ }
179
185
  function cannotSliceBlob() {
180
186
  return new FirebaseStorageError(Code.CANNOT_SLICE_BLOB, 'Cannot slice blob for upload. Please retry the upload.');
181
187
  }
@@ -1347,7 +1353,7 @@ function metadataValidator(p) {
1347
1353
 
1348
1354
  /**
1349
1355
  * @license
1350
- * Copyright 2019 Google LLC
1356
+ * Copyright 2019 Google Inc.
1351
1357
  *
1352
1358
  * Licensed under the Apache License, Version 2.0 (the "License");
1353
1359
  * you may not use this file except in compliance with the License.
@@ -1366,12 +1372,16 @@ var MAX_MAX_RESULTS = 1000;
1366
1372
  var PAGE_TOKEN_KEY = 'pageToken';
1367
1373
  var PREFIXES_KEY = 'prefixes';
1368
1374
  var ITEMS_KEY = 'items';
1369
- function fromBackendResponse(authWrapper, bucket, resource) {
1375
+ function fromBackendResponse(authWrapper, resource) {
1370
1376
  var listResult = {
1371
1377
  prefixes: [],
1372
1378
  items: [],
1373
1379
  nextPageToken: resource['nextPageToken']
1374
1380
  };
1381
+ var bucket = authWrapper.bucket();
1382
+ if (bucket === null) {
1383
+ throw noDefaultBucket();
1384
+ }
1375
1385
  if (resource[PREFIXES_KEY]) {
1376
1386
  for (var _i = 0, _a = resource[PREFIXES_KEY]; _i < _a.length; _i++) {
1377
1387
  var path = _a[_i];
@@ -1389,13 +1399,13 @@ function fromBackendResponse(authWrapper, bucket, resource) {
1389
1399
  }
1390
1400
  return listResult;
1391
1401
  }
1392
- function fromResponseString(authWrapper, bucket, resourceString) {
1402
+ function fromResponseString(authWrapper, resourceString) {
1393
1403
  var obj = jsonObjectOrNull(resourceString);
1394
1404
  if (obj === null) {
1395
1405
  return null;
1396
1406
  }
1397
1407
  var resource = obj;
1398
- return fromBackendResponse(authWrapper, bucket, resource);
1408
+ return fromBackendResponse(authWrapper, resource);
1399
1409
  }
1400
1410
  function listOptionsValidator(p) {
1401
1411
  if (!isObject(p) || !p) {
@@ -1453,7 +1463,7 @@ var RequestInfo = /** @class */ (function () {
1453
1463
 
1454
1464
  /**
1455
1465
  * @license
1456
- * Copyright 2017 Google LLC
1466
+ * Copyright 2017 Google Inc.
1457
1467
  *
1458
1468
  * Licensed under the Apache License, Version 2.0 (the "License");
1459
1469
  * you may not use this file except in compliance with the License.
@@ -1483,9 +1493,9 @@ function metadataHandler(authWrapper, mappings) {
1483
1493
  }
1484
1494
  return handler;
1485
1495
  }
1486
- function listHandler(authWrapper, bucket) {
1496
+ function listHandler(authWrapper) {
1487
1497
  function handler(xhr, text) {
1488
- var listResult = fromResponseString(authWrapper, bucket, text);
1498
+ var listResult = fromResponseString(authWrapper, text);
1489
1499
  handlerCheck(listResult !== null);
1490
1500
  return listResult;
1491
1501
  }
@@ -1565,7 +1575,7 @@ function list(authWrapper, location, delimiter, pageToken, maxResults) {
1565
1575
  var url = makeUrl(urlPart);
1566
1576
  var method = 'GET';
1567
1577
  var timeout = authWrapper.maxOperationRetryTime();
1568
- var requestInfo = new RequestInfo(url, method, listHandler(authWrapper, location.bucket), timeout);
1578
+ var requestInfo = new RequestInfo(url, method, listHandler(authWrapper), timeout);
1569
1579
  requestInfo.urlParams = urlParams;
1570
1580
  requestInfo.errorHandler = sharedErrorHandler(location);
1571
1581
  return requestInfo;
@@ -3530,7 +3540,7 @@ var ServiceInternals = /** @class */ (function () {
3530
3540
  }());
3531
3541
 
3532
3542
  var name = "@firebase/storage";
3533
- var version = "0.3.31-canary.fc3d5396";
3543
+ var version = "0.3.31";
3534
3544
 
3535
3545
  /**
3536
3546
  * @license