@firebase/storage 0.8.6 → 0.8.7-canary.ce39a1a07
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/CHANGELOG.md +6 -0
- package/dist/index.browser.cjs.js +215 -31
- package/dist/index.browser.cjs.js.map +1 -1
- package/dist/index.esm2017.js +194 -32
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.esm5.js +213 -32
- package/dist/index.esm5.js.map +1 -1
- package/dist/index.node.cjs.js +262 -51
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/node-esm/index.node.esm.js +206 -52
- package/dist/node-esm/index.node.esm.js.map +1 -1
- package/dist/node-esm/src/api.browser.d.ts +32 -1
- package/dist/node-esm/src/api.d.ts +15 -0
- package/dist/node-esm/src/api.node.d.ts +32 -1
- package/dist/node-esm/src/implementation/connection.d.ts +14 -4
- package/dist/node-esm/src/implementation/request.d.ts +5 -5
- package/dist/node-esm/src/implementation/requestinfo.d.ts +14 -6
- package/dist/node-esm/src/implementation/requests.d.ts +17 -16
- package/dist/node-esm/src/platform/browser/connection.d.ts +24 -7
- package/dist/node-esm/src/platform/connection.d.ts +6 -2
- package/dist/node-esm/src/platform/node/connection.d.ts +30 -14
- package/dist/node-esm/src/reference.d.ts +13 -0
- package/dist/node-esm/src/service.d.ts +3 -3
- package/dist/node-esm/test/integration/integration.test.d.ts +4 -0
- package/dist/node-esm/test/{unit → node}/connection.test.d.ts +0 -0
- package/dist/{test/unit/connection.test.d.ts → node-esm/test/node/stream.test.d.ts} +0 -0
- package/dist/node-esm/test/unit/connection.d.ts +4 -3
- package/dist/node-esm/test/unit/testshared.d.ts +2 -2
- package/dist/src/api.browser.d.ts +32 -1
- package/dist/src/api.d.ts +15 -0
- package/dist/src/api.node.d.ts +32 -1
- package/dist/src/implementation/connection.d.ts +14 -4
- package/dist/src/implementation/request.d.ts +5 -5
- package/dist/src/implementation/requestinfo.d.ts +14 -6
- package/dist/src/implementation/requests.d.ts +17 -16
- package/dist/src/platform/browser/connection.d.ts +24 -7
- package/dist/src/platform/connection.d.ts +6 -2
- package/dist/src/platform/node/connection.d.ts +30 -14
- package/dist/src/reference.d.ts +13 -0
- package/dist/src/service.d.ts +3 -3
- package/dist/storage-public.d.ts +46 -0
- package/dist/storage.d.ts +80 -11
- package/dist/test/integration/integration.test.d.ts +4 -0
- package/dist/test/node/connection.test.d.ts +17 -0
- package/dist/test/node/stream.test.d.ts +17 -0
- package/dist/test/unit/connection.d.ts +4 -3
- package/dist/test/unit/testshared.d.ts +2 -2
- package/package.json +6 -6
package/dist/index.esm5.js
CHANGED
|
@@ -355,7 +355,9 @@ callback, timeout) {
|
|
|
355
355
|
// Would type this as "number" but that doesn't work for Node so ¯\_(ツ)_/¯
|
|
356
356
|
// TODO: find a way to exclude Node type definition for storage because storage only works in browser
|
|
357
357
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
358
|
-
var
|
|
358
|
+
var retryTimeoutId = null;
|
|
359
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
360
|
+
var globalTimeoutId = null;
|
|
359
361
|
var hitTimeout = false;
|
|
360
362
|
var cancelState = 0;
|
|
361
363
|
function canceled() {
|
|
@@ -373,25 +375,33 @@ callback, timeout) {
|
|
|
373
375
|
}
|
|
374
376
|
}
|
|
375
377
|
function callWithDelay(millis) {
|
|
376
|
-
|
|
377
|
-
|
|
378
|
+
retryTimeoutId = setTimeout(function () {
|
|
379
|
+
retryTimeoutId = null;
|
|
378
380
|
f(handler, canceled());
|
|
379
381
|
}, millis);
|
|
380
382
|
}
|
|
383
|
+
function clearGlobalTimeout() {
|
|
384
|
+
if (globalTimeoutId) {
|
|
385
|
+
clearTimeout(globalTimeoutId);
|
|
386
|
+
}
|
|
387
|
+
}
|
|
381
388
|
function handler(success) {
|
|
382
389
|
var args = [];
|
|
383
390
|
for (var _i = 1; _i < arguments.length; _i++) {
|
|
384
391
|
args[_i - 1] = arguments[_i];
|
|
385
392
|
}
|
|
386
393
|
if (triggeredCallback) {
|
|
394
|
+
clearGlobalTimeout();
|
|
387
395
|
return;
|
|
388
396
|
}
|
|
389
397
|
if (success) {
|
|
398
|
+
clearGlobalTimeout();
|
|
390
399
|
triggerCallback.call.apply(triggerCallback, __spreadArray([null, success], args));
|
|
391
400
|
return;
|
|
392
401
|
}
|
|
393
402
|
var mustStop = canceled() || hitTimeout;
|
|
394
403
|
if (mustStop) {
|
|
404
|
+
clearGlobalTimeout();
|
|
395
405
|
triggerCallback.call.apply(triggerCallback, __spreadArray([null, success], args));
|
|
396
406
|
return;
|
|
397
407
|
}
|
|
@@ -415,14 +425,15 @@ callback, timeout) {
|
|
|
415
425
|
return;
|
|
416
426
|
}
|
|
417
427
|
stopped = true;
|
|
428
|
+
clearGlobalTimeout();
|
|
418
429
|
if (triggeredCallback) {
|
|
419
430
|
return;
|
|
420
431
|
}
|
|
421
|
-
if (
|
|
432
|
+
if (retryTimeoutId !== null) {
|
|
422
433
|
if (!wasTimeout) {
|
|
423
434
|
cancelState = 2;
|
|
424
435
|
}
|
|
425
|
-
clearTimeout(
|
|
436
|
+
clearTimeout(retryTimeoutId);
|
|
426
437
|
callWithDelay(0);
|
|
427
438
|
}
|
|
428
439
|
else {
|
|
@@ -432,7 +443,7 @@ callback, timeout) {
|
|
|
432
443
|
}
|
|
433
444
|
}
|
|
434
445
|
callWithDelay(0);
|
|
435
|
-
setTimeout(function () {
|
|
446
|
+
globalTimeoutId = setTimeout(function () {
|
|
436
447
|
hitTimeout = true;
|
|
437
448
|
stop(true);
|
|
438
449
|
}, timeout);
|
|
@@ -572,6 +583,14 @@ var ErrorCode;
|
|
|
572
583
|
* See the License for the specific language governing permissions and
|
|
573
584
|
* limitations under the License.
|
|
574
585
|
*/
|
|
586
|
+
/**
|
|
587
|
+
* Handles network logic for all Storage Requests, including error reporting and
|
|
588
|
+
* retries with backoff.
|
|
589
|
+
*
|
|
590
|
+
* @param I - the type of the backend's network response.
|
|
591
|
+
* @param - O the output type used by the rest of the SDK. The conversion
|
|
592
|
+
* happens in the specified `callback_`.
|
|
593
|
+
*/
|
|
575
594
|
var NetworkRequest = /** @class */ (function () {
|
|
576
595
|
function NetworkRequest(url_, method_, headers_, body_, successCodes_, additionalRetryCodes_, callback_, errorCallback_, timeout_, progressCallback_, connectionFactory_) {
|
|
577
596
|
var _this = this;
|
|
@@ -650,7 +669,7 @@ var NetworkRequest = /** @class */ (function () {
|
|
|
650
669
|
var connection = status.connection;
|
|
651
670
|
if (status.wasSuccessCode) {
|
|
652
671
|
try {
|
|
653
|
-
var result = _this.callback_(connection, connection.
|
|
672
|
+
var result = _this.callback_(connection, connection.getResponse());
|
|
654
673
|
if (isJustDef(result)) {
|
|
655
674
|
resolve(result);
|
|
656
675
|
}
|
|
@@ -665,7 +684,7 @@ var NetworkRequest = /** @class */ (function () {
|
|
|
665
684
|
else {
|
|
666
685
|
if (connection !== null) {
|
|
667
686
|
var err = unknown();
|
|
668
|
-
err.serverResponse = connection.
|
|
687
|
+
err.serverResponse = connection.getErrorText();
|
|
669
688
|
if (_this.errorCallback_) {
|
|
670
689
|
reject(_this.errorCallback_(connection, err));
|
|
671
690
|
}
|
|
@@ -798,7 +817,7 @@ function getBlobBuilder() {
|
|
|
798
817
|
* @param args The values that will make up the resulting blob.
|
|
799
818
|
* @return The blob.
|
|
800
819
|
*/
|
|
801
|
-
function getBlob() {
|
|
820
|
+
function getBlob$1() {
|
|
802
821
|
var args = [];
|
|
803
822
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
804
823
|
args[_i] = arguments[_i];
|
|
@@ -1158,7 +1177,7 @@ var FbsBlob = /** @class */ (function () {
|
|
|
1158
1177
|
return val;
|
|
1159
1178
|
}
|
|
1160
1179
|
});
|
|
1161
|
-
return new FbsBlob(getBlob.apply(null, blobby));
|
|
1180
|
+
return new FbsBlob(getBlob$1.apply(null, blobby));
|
|
1162
1181
|
}
|
|
1163
1182
|
else {
|
|
1164
1183
|
var uint8Arrays = args.map(function (val) {
|
|
@@ -1484,6 +1503,12 @@ function fromResponseString(service, bucket, resourceString) {
|
|
|
1484
1503
|
return fromBackendResponse(service, bucket, resource);
|
|
1485
1504
|
}
|
|
1486
1505
|
|
|
1506
|
+
/**
|
|
1507
|
+
* Contains a fully specified request.
|
|
1508
|
+
*
|
|
1509
|
+
* @param I - the type of the backend's network response.
|
|
1510
|
+
* @param O - the output response type used by the rest of the SDK.
|
|
1511
|
+
*/
|
|
1487
1512
|
var RequestInfo = /** @class */ (function () {
|
|
1488
1513
|
function RequestInfo(url, method,
|
|
1489
1514
|
/**
|
|
@@ -1568,7 +1593,7 @@ function sharedErrorHandler(location) {
|
|
|
1568
1593
|
if (
|
|
1569
1594
|
// This exact message string is the only consistent part of the
|
|
1570
1595
|
// server's error response that identifies it as an App Check error.
|
|
1571
|
-
xhr.
|
|
1596
|
+
xhr.getErrorText().includes('Firebase App Check token is invalid')) {
|
|
1572
1597
|
newErr = unauthorizedApp();
|
|
1573
1598
|
}
|
|
1574
1599
|
else {
|
|
@@ -1640,6 +1665,19 @@ function list$2(service, location, delimiter, pageToken, maxResults) {
|
|
|
1640
1665
|
requestInfo.errorHandler = sharedErrorHandler(location);
|
|
1641
1666
|
return requestInfo;
|
|
1642
1667
|
}
|
|
1668
|
+
function getBytes$1(service, location, maxDownloadSizeBytes) {
|
|
1669
|
+
var urlPart = location.fullServerUrl();
|
|
1670
|
+
var url = makeUrl(urlPart, service.host, service._protocol) + '?alt=media';
|
|
1671
|
+
var method = 'GET';
|
|
1672
|
+
var timeout = service.maxOperationRetryTime;
|
|
1673
|
+
var requestInfo = new RequestInfo(url, method, function (_, data) { return data; }, timeout);
|
|
1674
|
+
requestInfo.errorHandler = objectErrorHandler(location);
|
|
1675
|
+
if (maxDownloadSizeBytes !== undefined) {
|
|
1676
|
+
requestInfo.headers['Range'] = "bytes=0-" + maxDownloadSizeBytes;
|
|
1677
|
+
requestInfo.successCodes = [200 /* OK */, 206 /* Partial Content */];
|
|
1678
|
+
}
|
|
1679
|
+
return requestInfo;
|
|
1680
|
+
}
|
|
1643
1681
|
function getDownloadUrl(service, location, mappings) {
|
|
1644
1682
|
var urlPart = location.fullServerUrl();
|
|
1645
1683
|
var url = makeUrl(urlPart, service.host, service._protocol);
|
|
@@ -2052,7 +2090,7 @@ function async(f) {
|
|
|
2052
2090
|
* limitations under the License.
|
|
2053
2091
|
*/
|
|
2054
2092
|
/** An override for the text-based Connection. Used in tests. */
|
|
2055
|
-
var
|
|
2093
|
+
var textFactoryOverride = null;
|
|
2056
2094
|
/**
|
|
2057
2095
|
* Network layer for browsers. We use this instead of goog.net.XhrIo because
|
|
2058
2096
|
* goog.net.XhrIo is hyuuuuge and doesn't work in React Native on Android.
|
|
@@ -2062,6 +2100,7 @@ var XhrConnection = /** @class */ (function () {
|
|
|
2062
2100
|
var _this = this;
|
|
2063
2101
|
this.sent_ = false;
|
|
2064
2102
|
this.xhr_ = new XMLHttpRequest();
|
|
2103
|
+
this.initXhr();
|
|
2065
2104
|
this.errorCode_ = ErrorCode.NO_ERROR;
|
|
2066
2105
|
this.sendPromise_ = new Promise(function (resolve) {
|
|
2067
2106
|
_this.xhr_.addEventListener('abort', function () {
|
|
@@ -2115,11 +2154,17 @@ var XhrConnection = /** @class */ (function () {
|
|
|
2115
2154
|
return -1;
|
|
2116
2155
|
}
|
|
2117
2156
|
};
|
|
2118
|
-
XhrConnection.prototype.
|
|
2157
|
+
XhrConnection.prototype.getResponse = function () {
|
|
2158
|
+
if (!this.sent_) {
|
|
2159
|
+
throw internalError('cannot .getResponse() before sending');
|
|
2160
|
+
}
|
|
2161
|
+
return this.xhr_.response;
|
|
2162
|
+
};
|
|
2163
|
+
XhrConnection.prototype.getErrorText = function () {
|
|
2119
2164
|
if (!this.sent_) {
|
|
2120
|
-
throw internalError('cannot .
|
|
2165
|
+
throw internalError('cannot .getErrorText() before sending');
|
|
2121
2166
|
}
|
|
2122
|
-
return this.xhr_.
|
|
2167
|
+
return this.xhr_.statusText;
|
|
2123
2168
|
};
|
|
2124
2169
|
/** Aborts the request. */
|
|
2125
2170
|
XhrConnection.prototype.abort = function () {
|
|
@@ -2140,10 +2185,44 @@ var XhrConnection = /** @class */ (function () {
|
|
|
2140
2185
|
};
|
|
2141
2186
|
return XhrConnection;
|
|
2142
2187
|
}());
|
|
2143
|
-
function
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2188
|
+
var XhrTextConnection = /** @class */ (function (_super) {
|
|
2189
|
+
__extends(XhrTextConnection, _super);
|
|
2190
|
+
function XhrTextConnection() {
|
|
2191
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
2192
|
+
}
|
|
2193
|
+
XhrTextConnection.prototype.initXhr = function () {
|
|
2194
|
+
this.xhr_.responseType = 'text';
|
|
2195
|
+
};
|
|
2196
|
+
return XhrTextConnection;
|
|
2197
|
+
}(XhrConnection));
|
|
2198
|
+
function newTextConnection() {
|
|
2199
|
+
return textFactoryOverride ? textFactoryOverride() : new XhrTextConnection();
|
|
2200
|
+
}
|
|
2201
|
+
var XhrBytesConnection = /** @class */ (function (_super) {
|
|
2202
|
+
__extends(XhrBytesConnection, _super);
|
|
2203
|
+
function XhrBytesConnection() {
|
|
2204
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
2205
|
+
}
|
|
2206
|
+
XhrBytesConnection.prototype.initXhr = function () {
|
|
2207
|
+
this.xhr_.responseType = 'arraybuffer';
|
|
2208
|
+
};
|
|
2209
|
+
return XhrBytesConnection;
|
|
2210
|
+
}(XhrConnection));
|
|
2211
|
+
function newBytesConnection() {
|
|
2212
|
+
return new XhrBytesConnection();
|
|
2213
|
+
}
|
|
2214
|
+
var XhrBlobConnection = /** @class */ (function (_super) {
|
|
2215
|
+
__extends(XhrBlobConnection, _super);
|
|
2216
|
+
function XhrBlobConnection() {
|
|
2217
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
2218
|
+
}
|
|
2219
|
+
XhrBlobConnection.prototype.initXhr = function () {
|
|
2220
|
+
this.xhr_.responseType = 'blob';
|
|
2221
|
+
};
|
|
2222
|
+
return XhrBlobConnection;
|
|
2223
|
+
}(XhrConnection));
|
|
2224
|
+
function newBlobConnection() {
|
|
2225
|
+
return new XhrBlobConnection();
|
|
2147
2226
|
}
|
|
2148
2227
|
|
|
2149
2228
|
/**
|
|
@@ -2291,7 +2370,7 @@ var UploadTask = /** @class */ (function () {
|
|
|
2291
2370
|
var _this = this;
|
|
2292
2371
|
this._resolveToken(function (authToken, appCheckToken) {
|
|
2293
2372
|
var requestInfo = createResumableUpload(_this._ref.storage, _this._ref._location, _this._mappings, _this._blob, _this._metadata);
|
|
2294
|
-
var createRequest = _this._ref.storage._makeRequest(requestInfo,
|
|
2373
|
+
var createRequest = _this._ref.storage._makeRequest(requestInfo, newTextConnection, authToken, appCheckToken);
|
|
2295
2374
|
_this._request = createRequest;
|
|
2296
2375
|
createRequest.getPromise().then(function (url) {
|
|
2297
2376
|
_this._request = undefined;
|
|
@@ -2307,7 +2386,7 @@ var UploadTask = /** @class */ (function () {
|
|
|
2307
2386
|
var url = this._uploadUrl;
|
|
2308
2387
|
this._resolveToken(function (authToken, appCheckToken) {
|
|
2309
2388
|
var requestInfo = getResumableUploadStatus(_this._ref.storage, _this._ref._location, url, _this._blob);
|
|
2310
|
-
var statusRequest = _this._ref.storage._makeRequest(requestInfo,
|
|
2389
|
+
var statusRequest = _this._ref.storage._makeRequest(requestInfo, newTextConnection, authToken, appCheckToken);
|
|
2311
2390
|
_this._request = statusRequest;
|
|
2312
2391
|
statusRequest.getPromise().then(function (status) {
|
|
2313
2392
|
status = status;
|
|
@@ -2337,7 +2416,7 @@ var UploadTask = /** @class */ (function () {
|
|
|
2337
2416
|
_this._transition("error" /* ERROR */);
|
|
2338
2417
|
return;
|
|
2339
2418
|
}
|
|
2340
|
-
var uploadRequest = _this._ref.storage._makeRequest(requestInfo,
|
|
2419
|
+
var uploadRequest = _this._ref.storage._makeRequest(requestInfo, newTextConnection, authToken, appCheckToken);
|
|
2341
2420
|
_this._request = uploadRequest;
|
|
2342
2421
|
uploadRequest.getPromise().then(function (newStatus) {
|
|
2343
2422
|
_this._increaseMultiplier();
|
|
@@ -2364,7 +2443,7 @@ var UploadTask = /** @class */ (function () {
|
|
|
2364
2443
|
var _this = this;
|
|
2365
2444
|
this._resolveToken(function (authToken, appCheckToken) {
|
|
2366
2445
|
var requestInfo = getMetadata$2(_this._ref.storage, _this._ref._location, _this._mappings);
|
|
2367
|
-
var metadataRequest = _this._ref.storage._makeRequest(requestInfo,
|
|
2446
|
+
var metadataRequest = _this._ref.storage._makeRequest(requestInfo, newTextConnection, authToken, appCheckToken);
|
|
2368
2447
|
_this._request = metadataRequest;
|
|
2369
2448
|
metadataRequest.getPromise().then(function (metadata) {
|
|
2370
2449
|
_this._request = undefined;
|
|
@@ -2377,7 +2456,7 @@ var UploadTask = /** @class */ (function () {
|
|
|
2377
2456
|
var _this = this;
|
|
2378
2457
|
this._resolveToken(function (authToken, appCheckToken) {
|
|
2379
2458
|
var requestInfo = multipartUpload(_this._ref.storage, _this._ref._location, _this._mappings, _this._blob, _this._metadata);
|
|
2380
|
-
var multipartRequest = _this._ref.storage._makeRequest(requestInfo,
|
|
2459
|
+
var multipartRequest = _this._ref.storage._makeRequest(requestInfo, newTextConnection, authToken, appCheckToken);
|
|
2381
2460
|
_this._request = multipartRequest;
|
|
2382
2461
|
multipartRequest.getPromise().then(function (metadata) {
|
|
2383
2462
|
_this._request = undefined;
|
|
@@ -2774,6 +2853,38 @@ var Reference = /** @class */ (function () {
|
|
|
2774
2853
|
};
|
|
2775
2854
|
return Reference;
|
|
2776
2855
|
}());
|
|
2856
|
+
/**
|
|
2857
|
+
* Download the bytes at the object's location.
|
|
2858
|
+
* @returns A Promise containing the downloaded bytes.
|
|
2859
|
+
*/
|
|
2860
|
+
function getBytesInternal(ref, maxDownloadSizeBytes) {
|
|
2861
|
+
ref._throwIfRoot('getBytes');
|
|
2862
|
+
var requestInfo = getBytes$1(ref.storage, ref._location, maxDownloadSizeBytes);
|
|
2863
|
+
return ref.storage
|
|
2864
|
+
.makeRequestWithTokens(requestInfo, newBytesConnection)
|
|
2865
|
+
.then(function (bytes) {
|
|
2866
|
+
return maxDownloadSizeBytes !== undefined
|
|
2867
|
+
? // GCS may not honor the Range header for small files
|
|
2868
|
+
bytes.slice(0, maxDownloadSizeBytes)
|
|
2869
|
+
: bytes;
|
|
2870
|
+
});
|
|
2871
|
+
}
|
|
2872
|
+
/**
|
|
2873
|
+
* Download the bytes at the object's location.
|
|
2874
|
+
* @returns A Promise containing the downloaded blob.
|
|
2875
|
+
*/
|
|
2876
|
+
function getBlobInternal(ref, maxDownloadSizeBytes) {
|
|
2877
|
+
ref._throwIfRoot('getBlob');
|
|
2878
|
+
var requestInfo = getBytes$1(ref.storage, ref._location, maxDownloadSizeBytes);
|
|
2879
|
+
return ref.storage
|
|
2880
|
+
.makeRequestWithTokens(requestInfo, newBlobConnection)
|
|
2881
|
+
.then(function (blob) {
|
|
2882
|
+
return maxDownloadSizeBytes !== undefined
|
|
2883
|
+
? // GCS may not honor the Range header for small files
|
|
2884
|
+
blob.slice(0, maxDownloadSizeBytes)
|
|
2885
|
+
: blob;
|
|
2886
|
+
});
|
|
2887
|
+
}
|
|
2777
2888
|
/**
|
|
2778
2889
|
* Uploads data to this object's location.
|
|
2779
2890
|
* The upload is not resumable.
|
|
@@ -2787,7 +2898,7 @@ function uploadBytes$1(ref, data, metadata) {
|
|
|
2787
2898
|
ref._throwIfRoot('uploadBytes');
|
|
2788
2899
|
var requestInfo = multipartUpload(ref.storage, ref._location, getMappings(), new FbsBlob(data, true), metadata);
|
|
2789
2900
|
return ref.storage
|
|
2790
|
-
.makeRequestWithTokens(requestInfo,
|
|
2901
|
+
.makeRequestWithTokens(requestInfo, newTextConnection)
|
|
2791
2902
|
.then(function (finalMetadata) {
|
|
2792
2903
|
return {
|
|
2793
2904
|
metadata: finalMetadata,
|
|
@@ -2919,7 +3030,7 @@ function list$1(ref, options) {
|
|
|
2919
3030
|
var op = options || {};
|
|
2920
3031
|
var requestInfo = list$2(ref.storage, ref._location,
|
|
2921
3032
|
/*delimiter= */ '/', op.pageToken, op.maxResults);
|
|
2922
|
-
return ref.storage.makeRequestWithTokens(requestInfo,
|
|
3033
|
+
return ref.storage.makeRequestWithTokens(requestInfo, newTextConnection);
|
|
2923
3034
|
}
|
|
2924
3035
|
/**
|
|
2925
3036
|
* A `Promise` that resolves with the metadata for this object. If this
|
|
@@ -2931,7 +3042,7 @@ function list$1(ref, options) {
|
|
|
2931
3042
|
function getMetadata$1(ref) {
|
|
2932
3043
|
ref._throwIfRoot('getMetadata');
|
|
2933
3044
|
var requestInfo = getMetadata$2(ref.storage, ref._location, getMappings());
|
|
2934
|
-
return ref.storage.makeRequestWithTokens(requestInfo,
|
|
3045
|
+
return ref.storage.makeRequestWithTokens(requestInfo, newTextConnection);
|
|
2935
3046
|
}
|
|
2936
3047
|
/**
|
|
2937
3048
|
* Updates the metadata for this object.
|
|
@@ -2947,7 +3058,7 @@ function getMetadata$1(ref) {
|
|
|
2947
3058
|
function updateMetadata$1(ref, metadata) {
|
|
2948
3059
|
ref._throwIfRoot('updateMetadata');
|
|
2949
3060
|
var requestInfo = updateMetadata$2(ref.storage, ref._location, metadata, getMappings());
|
|
2950
|
-
return ref.storage.makeRequestWithTokens(requestInfo,
|
|
3061
|
+
return ref.storage.makeRequestWithTokens(requestInfo, newTextConnection);
|
|
2951
3062
|
}
|
|
2952
3063
|
/**
|
|
2953
3064
|
* Returns the download URL for the given Reference.
|
|
@@ -2959,7 +3070,7 @@ function getDownloadURL$1(ref) {
|
|
|
2959
3070
|
ref._throwIfRoot('getDownloadURL');
|
|
2960
3071
|
var requestInfo = getDownloadUrl(ref.storage, ref._location, getMappings());
|
|
2961
3072
|
return ref.storage
|
|
2962
|
-
.makeRequestWithTokens(requestInfo,
|
|
3073
|
+
.makeRequestWithTokens(requestInfo, newTextConnection)
|
|
2963
3074
|
.then(function (url) {
|
|
2964
3075
|
if (url === null) {
|
|
2965
3076
|
throw noDownloadURL();
|
|
@@ -2976,7 +3087,7 @@ function getDownloadURL$1(ref) {
|
|
|
2976
3087
|
function deleteObject$1(ref) {
|
|
2977
3088
|
ref._throwIfRoot('deleteObject');
|
|
2978
3089
|
var requestInfo = deleteObject$2(ref.storage, ref._location);
|
|
2979
|
-
return ref.storage.makeRequestWithTokens(requestInfo,
|
|
3090
|
+
return ref.storage.makeRequestWithTokens(requestInfo, newTextConnection);
|
|
2980
3091
|
}
|
|
2981
3092
|
/**
|
|
2982
3093
|
* Returns reference for object obtained by appending `childPath` to `ref`.
|
|
@@ -3276,7 +3387,7 @@ var FirebaseStorageImpl = /** @class */ (function () {
|
|
|
3276
3387
|
}());
|
|
3277
3388
|
|
|
3278
3389
|
var name = "@firebase/storage";
|
|
3279
|
-
var version = "0.8.
|
|
3390
|
+
var version = "0.8.7-canary.ce39a1a07";
|
|
3280
3391
|
|
|
3281
3392
|
/**
|
|
3282
3393
|
* @license
|
|
@@ -3315,6 +3426,24 @@ var STORAGE_TYPE = 'storage';
|
|
|
3315
3426
|
* See the License for the specific language governing permissions and
|
|
3316
3427
|
* limitations under the License.
|
|
3317
3428
|
*/
|
|
3429
|
+
/**
|
|
3430
|
+
* Downloads the data at the object's location. Returns an error if the object
|
|
3431
|
+
* is not found.
|
|
3432
|
+
*
|
|
3433
|
+
* To use this functionality, you have to whitelist your app's origin in your
|
|
3434
|
+
* Cloud Storage bucket. See also
|
|
3435
|
+
* https://cloud.google.com/storage/docs/configuring-cors
|
|
3436
|
+
*
|
|
3437
|
+
* @public
|
|
3438
|
+
* @param ref - StorageReference where data should be downloaded.
|
|
3439
|
+
* @param maxDownloadSizeBytes - If set, the maximum allowed size in bytes to
|
|
3440
|
+
* retrieve.
|
|
3441
|
+
* @returns A Promise containing the object's bytes
|
|
3442
|
+
*/
|
|
3443
|
+
function getBytes(ref, maxDownloadSizeBytes) {
|
|
3444
|
+
ref = getModularInstance(ref);
|
|
3445
|
+
return getBytesInternal(ref, maxDownloadSizeBytes);
|
|
3446
|
+
}
|
|
3318
3447
|
/**
|
|
3319
3448
|
* Uploads data to this object's location.
|
|
3320
3449
|
* The upload is not resumable.
|
|
@@ -3491,6 +3620,58 @@ function connectStorageEmulator(storage, host, port, options) {
|
|
|
3491
3620
|
connectStorageEmulator$1(storage, host, port, options);
|
|
3492
3621
|
}
|
|
3493
3622
|
|
|
3623
|
+
/**
|
|
3624
|
+
* @license
|
|
3625
|
+
* Copyright 2021 Google LLC
|
|
3626
|
+
*
|
|
3627
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
3628
|
+
* you may not use this file except in compliance with the License.
|
|
3629
|
+
* You may obtain a copy of the License at
|
|
3630
|
+
*
|
|
3631
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
3632
|
+
*
|
|
3633
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
3634
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
3635
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3636
|
+
* See the License for the specific language governing permissions and
|
|
3637
|
+
* limitations under the License.
|
|
3638
|
+
*/
|
|
3639
|
+
/**
|
|
3640
|
+
* Downloads the data at the object's location. Returns an error if the object
|
|
3641
|
+
* is not found.
|
|
3642
|
+
*
|
|
3643
|
+
* To use this functionality, you have to whitelist your app's origin in your
|
|
3644
|
+
* Cloud Storage bucket. See also
|
|
3645
|
+
* https://cloud.google.com/storage/docs/configuring-cors
|
|
3646
|
+
*
|
|
3647
|
+
* This API is not available in Node.
|
|
3648
|
+
*
|
|
3649
|
+
* @public
|
|
3650
|
+
* @param ref - StorageReference where data should be downloaded.
|
|
3651
|
+
* @param maxDownloadSizeBytes - If set, the maximum allowed size in bytes to
|
|
3652
|
+
* retrieve.
|
|
3653
|
+
* @returns A Promise that resolves with a Blob containing the object's bytes
|
|
3654
|
+
*/
|
|
3655
|
+
function getBlob(ref, maxDownloadSizeBytes) {
|
|
3656
|
+
ref = getModularInstance(ref);
|
|
3657
|
+
return getBlobInternal(ref, maxDownloadSizeBytes);
|
|
3658
|
+
}
|
|
3659
|
+
/**
|
|
3660
|
+
* Downloads the data at the object's location. Raises an error event if the
|
|
3661
|
+
* object is not found.
|
|
3662
|
+
*
|
|
3663
|
+
* This API is only available in Node.
|
|
3664
|
+
*
|
|
3665
|
+
* @public
|
|
3666
|
+
* @param ref - StorageReference where data should be downloaded.
|
|
3667
|
+
* @param maxDownloadSizeBytes - If set, the maximum allowed size in bytes to
|
|
3668
|
+
* retrieve.
|
|
3669
|
+
* @returns A stream with the object's data as bytes
|
|
3670
|
+
*/
|
|
3671
|
+
function getStream(ref, maxDownloadSizeBytes) {
|
|
3672
|
+
throw new Error('getStream() is only supported by NodeJS builds');
|
|
3673
|
+
}
|
|
3674
|
+
|
|
3494
3675
|
/**
|
|
3495
3676
|
* Cloud Storage for Firebase
|
|
3496
3677
|
*
|
|
@@ -3512,5 +3693,5 @@ function registerStorage() {
|
|
|
3512
3693
|
}
|
|
3513
3694
|
registerStorage();
|
|
3514
3695
|
|
|
3515
|
-
export { StringFormat, FbsBlob as _FbsBlob, Location as _Location, TaskEvent as _TaskEvent, TaskState as _TaskState, UploadTask as _UploadTask, dataFromString as _dataFromString, _getChild, invalidArgument as _invalidArgument, invalidRootOperation as _invalidRootOperation, connectStorageEmulator, deleteObject, getDownloadURL, getMetadata, getStorage, list, listAll, ref, updateMetadata, uploadBytes, uploadBytesResumable, uploadString };
|
|
3696
|
+
export { StringFormat, FbsBlob as _FbsBlob, Location as _Location, TaskEvent as _TaskEvent, TaskState as _TaskState, UploadTask as _UploadTask, dataFromString as _dataFromString, _getChild, invalidArgument as _invalidArgument, invalidRootOperation as _invalidRootOperation, connectStorageEmulator, deleteObject, getBlob, getBytes, getDownloadURL, getMetadata, getStorage, getStream, list, listAll, ref, updateMetadata, uploadBytes, uploadBytesResumable, uploadString };
|
|
3516
3697
|
//# sourceMappingURL=index.esm5.js.map
|