@firebase/storage 0.8.4-2021920175447 → 0.8.4-canary.dfed7f83f
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.browser.cjs.js +184 -255
- package/dist/index.browser.cjs.js.map +1 -1
- package/dist/index.cjs.js +125 -148
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm2017.js +164 -187
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.esm5.js +184 -255
- package/dist/index.esm5.js.map +1 -1
- package/dist/src/implementation/request.d.ts +1 -2
- package/dist/src/platform/browser/connection.d.ts +1 -0
- package/dist/src/platform/connection.d.ts +1 -0
- package/dist/src/platform/node/connection.d.ts +1 -0
- package/dist/src/service.d.ts +4 -5
- package/dist/storage.d.ts +3 -11
- package/dist/test/unit/connection.d.ts +1 -0
- package/dist/test/unit/testshared.d.ts +0 -3
- package/package.json +6 -6
- package/dist/src/implementation/connectionPool.d.ts +0 -26
- package/dist/src/implementation/requestmaker.d.ts +0 -21
package/dist/index.esm2017.js
CHANGED
|
@@ -2,32 +2,6 @@ import { getApp, _getProvider, _registerComponent, registerVersion, SDK_VERSION
|
|
|
2
2
|
import { FirebaseError, createMockUserToken, getModularInstance } from '@firebase/util';
|
|
3
3
|
import { Component } from '@firebase/component';
|
|
4
4
|
|
|
5
|
-
/**
|
|
6
|
-
* @license
|
|
7
|
-
* Copyright 2017 Google LLC
|
|
8
|
-
*
|
|
9
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
10
|
-
* you may not use this file except in compliance with the License.
|
|
11
|
-
* You may obtain a copy of the License at
|
|
12
|
-
*
|
|
13
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
14
|
-
*
|
|
15
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
16
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
17
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
18
|
-
* See the License for the specific language governing permissions and
|
|
19
|
-
* limitations under the License.
|
|
20
|
-
*/
|
|
21
|
-
/**
|
|
22
|
-
* Error codes for requests made by the the XhrIo wrapper.
|
|
23
|
-
*/
|
|
24
|
-
var ErrorCode;
|
|
25
|
-
(function (ErrorCode) {
|
|
26
|
-
ErrorCode[ErrorCode["NO_ERROR"] = 0] = "NO_ERROR";
|
|
27
|
-
ErrorCode[ErrorCode["NETWORK_ERROR"] = 1] = "NETWORK_ERROR";
|
|
28
|
-
ErrorCode[ErrorCode["ABORT"] = 2] = "ABORT";
|
|
29
|
-
})(ErrorCode || (ErrorCode = {}));
|
|
30
|
-
|
|
31
5
|
/**
|
|
32
6
|
* @license
|
|
33
7
|
* Copyright 2017 Google LLC
|
|
@@ -200,136 +174,6 @@ function internalError(message) {
|
|
|
200
174
|
throw new StorageError("internal-error" /* INTERNAL_ERROR */, 'Internal error: ' + message);
|
|
201
175
|
}
|
|
202
176
|
|
|
203
|
-
/**
|
|
204
|
-
* @license
|
|
205
|
-
* Copyright 2017 Google LLC
|
|
206
|
-
*
|
|
207
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
208
|
-
* you may not use this file except in compliance with the License.
|
|
209
|
-
* You may obtain a copy of the License at
|
|
210
|
-
*
|
|
211
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
212
|
-
*
|
|
213
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
214
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
215
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
216
|
-
* See the License for the specific language governing permissions and
|
|
217
|
-
* limitations under the License.
|
|
218
|
-
*/
|
|
219
|
-
/**
|
|
220
|
-
* Network layer for browsers. We use this instead of goog.net.XhrIo because
|
|
221
|
-
* goog.net.XhrIo is hyuuuuge and doesn't work in React Native on Android.
|
|
222
|
-
*/
|
|
223
|
-
class XhrConnection {
|
|
224
|
-
constructor() {
|
|
225
|
-
this.sent_ = false;
|
|
226
|
-
this.xhr_ = new XMLHttpRequest();
|
|
227
|
-
this.errorCode_ = ErrorCode.NO_ERROR;
|
|
228
|
-
this.sendPromise_ = new Promise(resolve => {
|
|
229
|
-
this.xhr_.addEventListener('abort', () => {
|
|
230
|
-
this.errorCode_ = ErrorCode.ABORT;
|
|
231
|
-
resolve();
|
|
232
|
-
});
|
|
233
|
-
this.xhr_.addEventListener('error', () => {
|
|
234
|
-
this.errorCode_ = ErrorCode.NETWORK_ERROR;
|
|
235
|
-
resolve();
|
|
236
|
-
});
|
|
237
|
-
this.xhr_.addEventListener('load', () => {
|
|
238
|
-
resolve();
|
|
239
|
-
});
|
|
240
|
-
});
|
|
241
|
-
}
|
|
242
|
-
send(url, method, body, headers) {
|
|
243
|
-
if (this.sent_) {
|
|
244
|
-
throw internalError('cannot .send() more than once');
|
|
245
|
-
}
|
|
246
|
-
this.sent_ = true;
|
|
247
|
-
this.xhr_.open(method, url, true);
|
|
248
|
-
if (headers !== undefined) {
|
|
249
|
-
for (const key in headers) {
|
|
250
|
-
if (headers.hasOwnProperty(key)) {
|
|
251
|
-
this.xhr_.setRequestHeader(key, headers[key].toString());
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
if (body !== undefined) {
|
|
256
|
-
this.xhr_.send(body);
|
|
257
|
-
}
|
|
258
|
-
else {
|
|
259
|
-
this.xhr_.send();
|
|
260
|
-
}
|
|
261
|
-
return this.sendPromise_;
|
|
262
|
-
}
|
|
263
|
-
getErrorCode() {
|
|
264
|
-
if (!this.sent_) {
|
|
265
|
-
throw internalError('cannot .getErrorCode() before sending');
|
|
266
|
-
}
|
|
267
|
-
return this.errorCode_;
|
|
268
|
-
}
|
|
269
|
-
getStatus() {
|
|
270
|
-
if (!this.sent_) {
|
|
271
|
-
throw internalError('cannot .getStatus() before sending');
|
|
272
|
-
}
|
|
273
|
-
try {
|
|
274
|
-
return this.xhr_.status;
|
|
275
|
-
}
|
|
276
|
-
catch (e) {
|
|
277
|
-
return -1;
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
getResponseText() {
|
|
281
|
-
if (!this.sent_) {
|
|
282
|
-
throw internalError('cannot .getResponseText() before sending');
|
|
283
|
-
}
|
|
284
|
-
return this.xhr_.responseText;
|
|
285
|
-
}
|
|
286
|
-
/** Aborts the request. */
|
|
287
|
-
abort() {
|
|
288
|
-
this.xhr_.abort();
|
|
289
|
-
}
|
|
290
|
-
getResponseHeader(header) {
|
|
291
|
-
return this.xhr_.getResponseHeader(header);
|
|
292
|
-
}
|
|
293
|
-
addUploadProgressListener(listener) {
|
|
294
|
-
if (this.xhr_.upload != null) {
|
|
295
|
-
this.xhr_.upload.addEventListener('progress', listener);
|
|
296
|
-
}
|
|
297
|
-
}
|
|
298
|
-
removeUploadProgressListener(listener) {
|
|
299
|
-
if (this.xhr_.upload != null) {
|
|
300
|
-
this.xhr_.upload.removeEventListener('progress', listener);
|
|
301
|
-
}
|
|
302
|
-
}
|
|
303
|
-
}
|
|
304
|
-
function newConnection() {
|
|
305
|
-
return new XhrConnection();
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
/**
|
|
309
|
-
* @license
|
|
310
|
-
* Copyright 2017 Google LLC
|
|
311
|
-
*
|
|
312
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
313
|
-
* you may not use this file except in compliance with the License.
|
|
314
|
-
* You may obtain a copy of the License at
|
|
315
|
-
*
|
|
316
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
317
|
-
*
|
|
318
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
319
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
320
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
321
|
-
* See the License for the specific language governing permissions and
|
|
322
|
-
* limitations under the License.
|
|
323
|
-
*/
|
|
324
|
-
/**
|
|
325
|
-
* Factory-like class for creating XhrIo instances.
|
|
326
|
-
*/
|
|
327
|
-
class ConnectionPool {
|
|
328
|
-
createConnection() {
|
|
329
|
-
return newConnection();
|
|
330
|
-
}
|
|
331
|
-
}
|
|
332
|
-
|
|
333
177
|
/**
|
|
334
178
|
* @license
|
|
335
179
|
* Copyright 2017 Google LLC
|
|
@@ -659,6 +503,32 @@ function makeQueryString(params) {
|
|
|
659
503
|
return queryPart;
|
|
660
504
|
}
|
|
661
505
|
|
|
506
|
+
/**
|
|
507
|
+
* @license
|
|
508
|
+
* Copyright 2017 Google LLC
|
|
509
|
+
*
|
|
510
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
511
|
+
* you may not use this file except in compliance with the License.
|
|
512
|
+
* You may obtain a copy of the License at
|
|
513
|
+
*
|
|
514
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
515
|
+
*
|
|
516
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
517
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
518
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
519
|
+
* See the License for the specific language governing permissions and
|
|
520
|
+
* limitations under the License.
|
|
521
|
+
*/
|
|
522
|
+
/**
|
|
523
|
+
* Error codes for requests made by the the XhrIo wrapper.
|
|
524
|
+
*/
|
|
525
|
+
var ErrorCode;
|
|
526
|
+
(function (ErrorCode) {
|
|
527
|
+
ErrorCode[ErrorCode["NO_ERROR"] = 0] = "NO_ERROR";
|
|
528
|
+
ErrorCode[ErrorCode["NETWORK_ERROR"] = 1] = "NETWORK_ERROR";
|
|
529
|
+
ErrorCode[ErrorCode["ABORT"] = 2] = "ABORT";
|
|
530
|
+
})(ErrorCode || (ErrorCode = {}));
|
|
531
|
+
|
|
662
532
|
/**
|
|
663
533
|
* @license
|
|
664
534
|
* Copyright 2017 Google LLC
|
|
@@ -676,7 +546,7 @@ function makeQueryString(params) {
|
|
|
676
546
|
* limitations under the License.
|
|
677
547
|
*/
|
|
678
548
|
class NetworkRequest {
|
|
679
|
-
constructor(url_, method_, headers_, body_, successCodes_, additionalRetryCodes_, callback_, errorCallback_, timeout_, progressCallback_,
|
|
549
|
+
constructor(url_, method_, headers_, body_, successCodes_, additionalRetryCodes_, callback_, errorCallback_, timeout_, progressCallback_, connectionFactory_) {
|
|
680
550
|
this.url_ = url_;
|
|
681
551
|
this.method_ = method_;
|
|
682
552
|
this.headers_ = headers_;
|
|
@@ -687,7 +557,7 @@ class NetworkRequest {
|
|
|
687
557
|
this.errorCallback_ = errorCallback_;
|
|
688
558
|
this.timeout_ = timeout_;
|
|
689
559
|
this.progressCallback_ = progressCallback_;
|
|
690
|
-
this.
|
|
560
|
+
this.connectionFactory_ = connectionFactory_;
|
|
691
561
|
this.pendingConnection_ = null;
|
|
692
562
|
this.backoffId_ = null;
|
|
693
563
|
this.canceled_ = false;
|
|
@@ -707,7 +577,7 @@ class NetworkRequest {
|
|
|
707
577
|
backoffCallback(false, new RequestEndStatus(false, null, true));
|
|
708
578
|
return;
|
|
709
579
|
}
|
|
710
|
-
const connection = this.
|
|
580
|
+
const connection = this.connectionFactory_();
|
|
711
581
|
this.pendingConnection_ = connection;
|
|
712
582
|
const progressListener = progressEvent => {
|
|
713
583
|
const loaded = progressEvent.loaded;
|
|
@@ -853,7 +723,7 @@ function addAppCheckHeader_(headers, appCheckToken) {
|
|
|
853
723
|
headers['X-Firebase-AppCheck'] = appCheckToken;
|
|
854
724
|
}
|
|
855
725
|
}
|
|
856
|
-
function makeRequest(requestInfo, appId, authToken, appCheckToken,
|
|
726
|
+
function makeRequest(requestInfo, appId, authToken, appCheckToken, requestFactory, firebaseVersion) {
|
|
857
727
|
const queryPart = makeQueryString(requestInfo.urlParams);
|
|
858
728
|
const url = requestInfo.url + queryPart;
|
|
859
729
|
const headers = Object.assign({}, requestInfo.headers);
|
|
@@ -861,7 +731,7 @@ function makeRequest(requestInfo, appId, authToken, appCheckToken, pool, firebas
|
|
|
861
731
|
addAuthHeader_(headers, authToken);
|
|
862
732
|
addVersionHeader_(headers, firebaseVersion);
|
|
863
733
|
addAppCheckHeader_(headers, appCheckToken);
|
|
864
|
-
return new NetworkRequest(url, requestInfo.method, headers, requestInfo.body, requestInfo.successCodes, requestInfo.additionalRetryCodes, requestInfo.handler, requestInfo.errorHandler, requestInfo.timeout, requestInfo.progressCallback,
|
|
734
|
+
return new NetworkRequest(url, requestInfo.method, headers, requestInfo.body, requestInfo.successCodes, requestInfo.additionalRetryCodes, requestInfo.handler, requestInfo.errorHandler, requestInfo.timeout, requestInfo.progressCallback, requestFactory);
|
|
865
735
|
}
|
|
866
736
|
|
|
867
737
|
/**
|
|
@@ -2113,6 +1983,115 @@ function async(f) {
|
|
|
2113
1983
|
};
|
|
2114
1984
|
}
|
|
2115
1985
|
|
|
1986
|
+
/**
|
|
1987
|
+
* @license
|
|
1988
|
+
* Copyright 2017 Google LLC
|
|
1989
|
+
*
|
|
1990
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1991
|
+
* you may not use this file except in compliance with the License.
|
|
1992
|
+
* You may obtain a copy of the License at
|
|
1993
|
+
*
|
|
1994
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1995
|
+
*
|
|
1996
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1997
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1998
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1999
|
+
* See the License for the specific language governing permissions and
|
|
2000
|
+
* limitations under the License.
|
|
2001
|
+
*/
|
|
2002
|
+
/** An override for the text-based Connection. Used in tests. */
|
|
2003
|
+
let connectionFactoryOverride = null;
|
|
2004
|
+
/**
|
|
2005
|
+
* Network layer for browsers. We use this instead of goog.net.XhrIo because
|
|
2006
|
+
* goog.net.XhrIo is hyuuuuge and doesn't work in React Native on Android.
|
|
2007
|
+
*/
|
|
2008
|
+
class XhrConnection {
|
|
2009
|
+
constructor() {
|
|
2010
|
+
this.sent_ = false;
|
|
2011
|
+
this.xhr_ = new XMLHttpRequest();
|
|
2012
|
+
this.errorCode_ = ErrorCode.NO_ERROR;
|
|
2013
|
+
this.sendPromise_ = new Promise(resolve => {
|
|
2014
|
+
this.xhr_.addEventListener('abort', () => {
|
|
2015
|
+
this.errorCode_ = ErrorCode.ABORT;
|
|
2016
|
+
resolve();
|
|
2017
|
+
});
|
|
2018
|
+
this.xhr_.addEventListener('error', () => {
|
|
2019
|
+
this.errorCode_ = ErrorCode.NETWORK_ERROR;
|
|
2020
|
+
resolve();
|
|
2021
|
+
});
|
|
2022
|
+
this.xhr_.addEventListener('load', () => {
|
|
2023
|
+
resolve();
|
|
2024
|
+
});
|
|
2025
|
+
});
|
|
2026
|
+
}
|
|
2027
|
+
send(url, method, body, headers) {
|
|
2028
|
+
if (this.sent_) {
|
|
2029
|
+
throw internalError('cannot .send() more than once');
|
|
2030
|
+
}
|
|
2031
|
+
this.sent_ = true;
|
|
2032
|
+
this.xhr_.open(method, url, true);
|
|
2033
|
+
if (headers !== undefined) {
|
|
2034
|
+
for (const key in headers) {
|
|
2035
|
+
if (headers.hasOwnProperty(key)) {
|
|
2036
|
+
this.xhr_.setRequestHeader(key, headers[key].toString());
|
|
2037
|
+
}
|
|
2038
|
+
}
|
|
2039
|
+
}
|
|
2040
|
+
if (body !== undefined) {
|
|
2041
|
+
this.xhr_.send(body);
|
|
2042
|
+
}
|
|
2043
|
+
else {
|
|
2044
|
+
this.xhr_.send();
|
|
2045
|
+
}
|
|
2046
|
+
return this.sendPromise_;
|
|
2047
|
+
}
|
|
2048
|
+
getErrorCode() {
|
|
2049
|
+
if (!this.sent_) {
|
|
2050
|
+
throw internalError('cannot .getErrorCode() before sending');
|
|
2051
|
+
}
|
|
2052
|
+
return this.errorCode_;
|
|
2053
|
+
}
|
|
2054
|
+
getStatus() {
|
|
2055
|
+
if (!this.sent_) {
|
|
2056
|
+
throw internalError('cannot .getStatus() before sending');
|
|
2057
|
+
}
|
|
2058
|
+
try {
|
|
2059
|
+
return this.xhr_.status;
|
|
2060
|
+
}
|
|
2061
|
+
catch (e) {
|
|
2062
|
+
return -1;
|
|
2063
|
+
}
|
|
2064
|
+
}
|
|
2065
|
+
getResponseText() {
|
|
2066
|
+
if (!this.sent_) {
|
|
2067
|
+
throw internalError('cannot .getResponseText() before sending');
|
|
2068
|
+
}
|
|
2069
|
+
return this.xhr_.responseText;
|
|
2070
|
+
}
|
|
2071
|
+
/** Aborts the request. */
|
|
2072
|
+
abort() {
|
|
2073
|
+
this.xhr_.abort();
|
|
2074
|
+
}
|
|
2075
|
+
getResponseHeader(header) {
|
|
2076
|
+
return this.xhr_.getResponseHeader(header);
|
|
2077
|
+
}
|
|
2078
|
+
addUploadProgressListener(listener) {
|
|
2079
|
+
if (this.xhr_.upload != null) {
|
|
2080
|
+
this.xhr_.upload.addEventListener('progress', listener);
|
|
2081
|
+
}
|
|
2082
|
+
}
|
|
2083
|
+
removeUploadProgressListener(listener) {
|
|
2084
|
+
if (this.xhr_.upload != null) {
|
|
2085
|
+
this.xhr_.upload.removeEventListener('progress', listener);
|
|
2086
|
+
}
|
|
2087
|
+
}
|
|
2088
|
+
}
|
|
2089
|
+
function newConnection() {
|
|
2090
|
+
return connectionFactoryOverride
|
|
2091
|
+
? connectionFactoryOverride()
|
|
2092
|
+
: new XhrConnection();
|
|
2093
|
+
}
|
|
2094
|
+
|
|
2116
2095
|
/**
|
|
2117
2096
|
* @license
|
|
2118
2097
|
* Copyright 2017 Google LLC
|
|
@@ -2252,7 +2231,7 @@ class UploadTask {
|
|
|
2252
2231
|
_createResumable() {
|
|
2253
2232
|
this._resolveToken((authToken, appCheckToken) => {
|
|
2254
2233
|
const requestInfo = createResumableUpload(this._ref.storage, this._ref._location, this._mappings, this._blob, this._metadata);
|
|
2255
|
-
const createRequest = this._ref.storage._makeRequest(requestInfo, authToken, appCheckToken);
|
|
2234
|
+
const createRequest = this._ref.storage._makeRequest(requestInfo, newConnection, authToken, appCheckToken);
|
|
2256
2235
|
this._request = createRequest;
|
|
2257
2236
|
createRequest.getPromise().then((url) => {
|
|
2258
2237
|
this._request = undefined;
|
|
@@ -2267,7 +2246,7 @@ class UploadTask {
|
|
|
2267
2246
|
const url = this._uploadUrl;
|
|
2268
2247
|
this._resolveToken((authToken, appCheckToken) => {
|
|
2269
2248
|
const requestInfo = getResumableUploadStatus(this._ref.storage, this._ref._location, url, this._blob);
|
|
2270
|
-
const statusRequest = this._ref.storage._makeRequest(requestInfo, authToken, appCheckToken);
|
|
2249
|
+
const statusRequest = this._ref.storage._makeRequest(requestInfo, newConnection, authToken, appCheckToken);
|
|
2271
2250
|
this._request = statusRequest;
|
|
2272
2251
|
statusRequest.getPromise().then(status => {
|
|
2273
2252
|
status = status;
|
|
@@ -2296,7 +2275,7 @@ class UploadTask {
|
|
|
2296
2275
|
this._transition("error" /* ERROR */);
|
|
2297
2276
|
return;
|
|
2298
2277
|
}
|
|
2299
|
-
const uploadRequest = this._ref.storage._makeRequest(requestInfo, authToken, appCheckToken);
|
|
2278
|
+
const uploadRequest = this._ref.storage._makeRequest(requestInfo, newConnection, authToken, appCheckToken);
|
|
2300
2279
|
this._request = uploadRequest;
|
|
2301
2280
|
uploadRequest.getPromise().then((newStatus) => {
|
|
2302
2281
|
this._increaseMultiplier();
|
|
@@ -2322,7 +2301,7 @@ class UploadTask {
|
|
|
2322
2301
|
_fetchMetadata() {
|
|
2323
2302
|
this._resolveToken((authToken, appCheckToken) => {
|
|
2324
2303
|
const requestInfo = getMetadata$2(this._ref.storage, this._ref._location, this._mappings);
|
|
2325
|
-
const metadataRequest = this._ref.storage._makeRequest(requestInfo, authToken, appCheckToken);
|
|
2304
|
+
const metadataRequest = this._ref.storage._makeRequest(requestInfo, newConnection, authToken, appCheckToken);
|
|
2326
2305
|
this._request = metadataRequest;
|
|
2327
2306
|
metadataRequest.getPromise().then(metadata => {
|
|
2328
2307
|
this._request = undefined;
|
|
@@ -2334,7 +2313,7 @@ class UploadTask {
|
|
|
2334
2313
|
_oneShotUpload() {
|
|
2335
2314
|
this._resolveToken((authToken, appCheckToken) => {
|
|
2336
2315
|
const requestInfo = multipartUpload(this._ref.storage, this._ref._location, this._mappings, this._blob, this._metadata);
|
|
2337
|
-
const multipartRequest = this._ref.storage._makeRequest(requestInfo, authToken, appCheckToken);
|
|
2316
|
+
const multipartRequest = this._ref.storage._makeRequest(requestInfo, newConnection, authToken, appCheckToken);
|
|
2338
2317
|
this._request = multipartRequest;
|
|
2339
2318
|
multipartRequest.getPromise().then(metadata => {
|
|
2340
2319
|
this._request = undefined;
|
|
@@ -2712,8 +2691,7 @@ function uploadBytes$1(ref, data, metadata) {
|
|
|
2712
2691
|
ref._throwIfRoot('uploadBytes');
|
|
2713
2692
|
const requestInfo = multipartUpload(ref.storage, ref._location, getMappings(), new FbsBlob(data, true), metadata);
|
|
2714
2693
|
return ref.storage
|
|
2715
|
-
.makeRequestWithTokens(requestInfo)
|
|
2716
|
-
.then(request => request.getPromise())
|
|
2694
|
+
.makeRequestWithTokens(requestInfo, newConnection)
|
|
2717
2695
|
.then(finalMetadata => {
|
|
2718
2696
|
return {
|
|
2719
2697
|
metadata: finalMetadata,
|
|
@@ -2819,7 +2797,7 @@ async function listAllHelper(ref, accumulator, pageToken) {
|
|
|
2819
2797
|
* contains references to objects in this folder. `nextPageToken`
|
|
2820
2798
|
* can be used to get the rest of the results.
|
|
2821
2799
|
*/
|
|
2822
|
-
|
|
2800
|
+
function list$1(ref, options) {
|
|
2823
2801
|
if (options != null) {
|
|
2824
2802
|
if (typeof options.maxResults === 'number') {
|
|
2825
2803
|
validateNumber('options.maxResults',
|
|
@@ -2830,7 +2808,7 @@ async function list$1(ref, options) {
|
|
|
2830
2808
|
const op = options || {};
|
|
2831
2809
|
const requestInfo = list$2(ref.storage, ref._location,
|
|
2832
2810
|
/*delimiter= */ '/', op.pageToken, op.maxResults);
|
|
2833
|
-
return
|
|
2811
|
+
return ref.storage.makeRequestWithTokens(requestInfo, newConnection);
|
|
2834
2812
|
}
|
|
2835
2813
|
/**
|
|
2836
2814
|
* A `Promise` that resolves with the metadata for this object. If this
|
|
@@ -2839,10 +2817,10 @@ async function list$1(ref, options) {
|
|
|
2839
2817
|
* @public
|
|
2840
2818
|
* @param ref - StorageReference to get metadata from.
|
|
2841
2819
|
*/
|
|
2842
|
-
|
|
2820
|
+
function getMetadata$1(ref) {
|
|
2843
2821
|
ref._throwIfRoot('getMetadata');
|
|
2844
2822
|
const requestInfo = getMetadata$2(ref.storage, ref._location, getMappings());
|
|
2845
|
-
return
|
|
2823
|
+
return ref.storage.makeRequestWithTokens(requestInfo, newConnection);
|
|
2846
2824
|
}
|
|
2847
2825
|
/**
|
|
2848
2826
|
* Updates the metadata for this object.
|
|
@@ -2855,10 +2833,10 @@ async function getMetadata$1(ref) {
|
|
|
2855
2833
|
* with the new metadata for this object.
|
|
2856
2834
|
* See `firebaseStorage.Reference.prototype.getMetadata`
|
|
2857
2835
|
*/
|
|
2858
|
-
|
|
2836
|
+
function updateMetadata$1(ref, metadata) {
|
|
2859
2837
|
ref._throwIfRoot('updateMetadata');
|
|
2860
2838
|
const requestInfo = updateMetadata$2(ref.storage, ref._location, metadata, getMappings());
|
|
2861
|
-
return
|
|
2839
|
+
return ref.storage.makeRequestWithTokens(requestInfo, newConnection);
|
|
2862
2840
|
}
|
|
2863
2841
|
/**
|
|
2864
2842
|
* Returns the download URL for the given Reference.
|
|
@@ -2866,11 +2844,11 @@ async function updateMetadata$1(ref, metadata) {
|
|
|
2866
2844
|
* @returns A `Promise` that resolves with the download
|
|
2867
2845
|
* URL for this object.
|
|
2868
2846
|
*/
|
|
2869
|
-
|
|
2847
|
+
function getDownloadURL$1(ref) {
|
|
2870
2848
|
ref._throwIfRoot('getDownloadURL');
|
|
2871
2849
|
const requestInfo = getDownloadUrl(ref.storage, ref._location, getMappings());
|
|
2872
|
-
return
|
|
2873
|
-
.
|
|
2850
|
+
return ref.storage
|
|
2851
|
+
.makeRequestWithTokens(requestInfo, newConnection)
|
|
2874
2852
|
.then(url => {
|
|
2875
2853
|
if (url === null) {
|
|
2876
2854
|
throw noDownloadURL();
|
|
@@ -2884,10 +2862,10 @@ async function getDownloadURL$1(ref) {
|
|
|
2884
2862
|
* @param ref - StorageReference for object to delete.
|
|
2885
2863
|
* @returns A `Promise` that resolves if the deletion succeeds.
|
|
2886
2864
|
*/
|
|
2887
|
-
|
|
2865
|
+
function deleteObject$1(ref) {
|
|
2888
2866
|
ref._throwIfRoot('deleteObject');
|
|
2889
2867
|
const requestInfo = deleteObject$2(ref.storage, ref._location);
|
|
2890
|
-
return
|
|
2868
|
+
return ref.storage.makeRequestWithTokens(requestInfo, newConnection);
|
|
2891
2869
|
}
|
|
2892
2870
|
/**
|
|
2893
2871
|
* Returns reference for object obtained by appending `childPath` to `ref`.
|
|
@@ -3008,11 +2986,10 @@ class FirebaseStorageImpl {
|
|
|
3008
2986
|
/**
|
|
3009
2987
|
* @internal
|
|
3010
2988
|
*/
|
|
3011
|
-
|
|
2989
|
+
_url, _firebaseVersion) {
|
|
3012
2990
|
this.app = app;
|
|
3013
2991
|
this._authProvider = _authProvider;
|
|
3014
2992
|
this._appCheckProvider = _appCheckProvider;
|
|
3015
|
-
this._pool = _pool;
|
|
3016
2993
|
this._url = _url;
|
|
3017
2994
|
this._firebaseVersion = _firebaseVersion;
|
|
3018
2995
|
this._bucket = null;
|
|
@@ -3123,9 +3100,9 @@ class FirebaseStorageImpl {
|
|
|
3123
3100
|
* @param requestInfo - HTTP RequestInfo object
|
|
3124
3101
|
* @param authToken - Firebase auth token
|
|
3125
3102
|
*/
|
|
3126
|
-
_makeRequest(requestInfo, authToken, appCheckToken) {
|
|
3103
|
+
_makeRequest(requestInfo, requestFactory, authToken, appCheckToken) {
|
|
3127
3104
|
if (!this._deleted) {
|
|
3128
|
-
const request = makeRequest(requestInfo, this._appId, authToken, appCheckToken,
|
|
3105
|
+
const request = makeRequest(requestInfo, this._appId, authToken, appCheckToken, requestFactory, this._firebaseVersion);
|
|
3129
3106
|
this._requests.add(request);
|
|
3130
3107
|
// Request removes itself from set when complete.
|
|
3131
3108
|
request.getPromise().then(() => this._requests.delete(request), () => this._requests.delete(request));
|
|
@@ -3135,17 +3112,17 @@ class FirebaseStorageImpl {
|
|
|
3135
3112
|
return new FailRequest(appDeleted());
|
|
3136
3113
|
}
|
|
3137
3114
|
}
|
|
3138
|
-
async makeRequestWithTokens(requestInfo) {
|
|
3115
|
+
async makeRequestWithTokens(requestInfo, requestFactory) {
|
|
3139
3116
|
const [authToken, appCheckToken] = await Promise.all([
|
|
3140
3117
|
this._getAuthToken(),
|
|
3141
3118
|
this._getAppCheckToken()
|
|
3142
3119
|
]);
|
|
3143
|
-
return this._makeRequest(requestInfo, authToken, appCheckToken);
|
|
3120
|
+
return this._makeRequest(requestInfo, requestFactory, authToken, appCheckToken).getPromise();
|
|
3144
3121
|
}
|
|
3145
3122
|
}
|
|
3146
3123
|
|
|
3147
3124
|
const name = "@firebase/storage";
|
|
3148
|
-
const version = "0.8.4-
|
|
3125
|
+
const version = "0.8.4-canary.dfed7f83f";
|
|
3149
3126
|
|
|
3150
3127
|
/**
|
|
3151
3128
|
* @license
|
|
@@ -3367,7 +3344,7 @@ function factory(container, { instanceIdentifier: url }) {
|
|
|
3367
3344
|
const app = container.getProvider('app').getImmediate();
|
|
3368
3345
|
const authProvider = container.getProvider('auth-internal');
|
|
3369
3346
|
const appCheckProvider = container.getProvider('app-check-internal');
|
|
3370
|
-
return new FirebaseStorageImpl(app, authProvider, appCheckProvider,
|
|
3347
|
+
return new FirebaseStorageImpl(app, authProvider, appCheckProvider, url, SDK_VERSION);
|
|
3371
3348
|
}
|
|
3372
3349
|
function registerStorage() {
|
|
3373
3350
|
_registerComponent(new Component(STORAGE_TYPE, factory, "PUBLIC" /* PUBLIC */).setMultipleInstances(true));
|