@firebase/storage 0.8.4 → 0.8.5-2021102231614
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 +11 -0
- package/dist/index.browser.cjs.js +184 -255
- package/dist/index.browser.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/{index.cjs.js → index.node.cjs.js} +152 -178
- package/dist/index.node.cjs.js.map +1 -0
- package/dist/node-esm/index.node.esm.js +3351 -0
- package/dist/node-esm/index.node.esm.js.map +1 -0
- package/dist/node-esm/package.json +1 -0
- package/dist/node-esm/src/api.browser.d.ts +17 -0
- package/dist/node-esm/src/api.d.ts +184 -0
- package/dist/node-esm/src/api.node.d.ts +17 -0
- package/dist/node-esm/src/constants.d.ts +20 -0
- package/dist/{src/implementation/connectionPool.d.ts → node-esm/src/implementation/async.d.ts} +4 -8
- package/dist/node-esm/src/implementation/backoff.d.ts +37 -0
- package/dist/node-esm/src/implementation/blob.d.ts +34 -0
- package/dist/node-esm/src/implementation/connection.d.ts +47 -0
- package/dist/node-esm/src/implementation/constants.d.ts +44 -0
- package/dist/node-esm/src/implementation/error.d.ts +105 -0
- package/dist/node-esm/src/implementation/failrequest.d.ts +29 -0
- package/dist/node-esm/src/implementation/fs.d.ts +17 -0
- package/dist/node-esm/src/implementation/json.d.ts +7 -0
- package/dist/node-esm/src/implementation/list.d.ts +19 -0
- package/dist/node-esm/src/implementation/location.d.ts +32 -0
- package/dist/node-esm/src/implementation/metadata.d.ts +40 -0
- package/dist/node-esm/src/implementation/observer.d.ts +47 -0
- package/dist/node-esm/src/implementation/path.d.ts +31 -0
- package/dist/node-esm/src/implementation/request.d.ts +47 -0
- package/dist/node-esm/src/implementation/requestinfo.d.ts +65 -0
- package/dist/node-esm/src/implementation/requests.d.ts +83 -0
- package/dist/node-esm/src/implementation/string.d.ts +73 -0
- package/dist/node-esm/src/implementation/taskenums.d.ts +77 -0
- package/dist/node-esm/src/implementation/type.d.ts +23 -0
- package/dist/{src/implementation/requestmaker.d.ts → node-esm/src/implementation/url.d.ts} +6 -5
- package/dist/node-esm/src/index.d.ts +7 -0
- package/dist/node-esm/src/index.node.d.ts +7 -0
- package/dist/node-esm/src/list.d.ts +41 -0
- package/dist/node-esm/src/metadata.d.ts +27 -0
- package/dist/node-esm/src/platform/base64.d.ts +20 -0
- package/dist/node-esm/src/platform/browser/base64.d.ts +19 -0
- package/dist/node-esm/src/platform/browser/connection.d.ts +39 -0
- package/dist/node-esm/src/platform/connection.d.ts +19 -0
- package/dist/node-esm/src/platform/node/base64.d.ts +19 -0
- package/dist/node-esm/src/platform/node/connection.d.ts +45 -0
- package/dist/node-esm/src/public-types.d.ts +433 -0
- package/dist/node-esm/src/reference.d.ts +196 -0
- package/dist/node-esm/src/service.d.ts +130 -0
- package/dist/node-esm/src/task.d.ts +143 -0
- package/dist/node-esm/test/browser/blob.test.d.ts +17 -0
- package/dist/node-esm/test/browser/connection.test.d.ts +17 -0
- package/dist/node-esm/test/integration/integration.test.d.ts +20 -0
- package/dist/node-esm/test/unit/connection.d.ts +46 -0
- package/dist/node-esm/test/unit/connection.test.d.ts +17 -0
- package/dist/node-esm/test/unit/index.test.d.ts +4 -0
- package/dist/node-esm/test/unit/location.test.d.ts +1 -0
- package/dist/node-esm/test/unit/reference.test.d.ts +1 -0
- package/dist/node-esm/test/unit/request.test.d.ts +1 -0
- package/dist/node-esm/test/unit/requests.test.d.ts +1 -0
- package/dist/node-esm/test/unit/service.test.d.ts +1 -0
- package/dist/node-esm/test/unit/string.test.d.ts +1 -0
- package/dist/node-esm/test/unit/task.test.d.ts +1 -0
- package/dist/node-esm/test/unit/testshared.d.ts +47 -0
- package/dist/src/api.browser.d.ts +17 -0
- package/dist/src/api.d.ts +1 -1
- package/dist/src/api.node.d.ts +17 -0
- package/dist/src/implementation/request.d.ts +1 -2
- package/dist/src/index.d.ts +1 -1
- package/dist/src/index.node.d.ts +7 -0
- 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 +18 -8
- package/dist/index.cjs.js.map +0 -1
|
@@ -11,32 +11,6 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
11
11
|
|
|
12
12
|
var nodeFetch__default = /*#__PURE__*/_interopDefaultLegacy(nodeFetch);
|
|
13
13
|
|
|
14
|
-
/**
|
|
15
|
-
* @license
|
|
16
|
-
* Copyright 2017 Google LLC
|
|
17
|
-
*
|
|
18
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
19
|
-
* you may not use this file except in compliance with the License.
|
|
20
|
-
* You may obtain a copy of the License at
|
|
21
|
-
*
|
|
22
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
23
|
-
*
|
|
24
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
25
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
26
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
27
|
-
* See the License for the specific language governing permissions and
|
|
28
|
-
* limitations under the License.
|
|
29
|
-
*/
|
|
30
|
-
/**
|
|
31
|
-
* Error codes for requests made by the the XhrIo wrapper.
|
|
32
|
-
*/
|
|
33
|
-
var ErrorCode;
|
|
34
|
-
(function (ErrorCode) {
|
|
35
|
-
ErrorCode[ErrorCode["NO_ERROR"] = 0] = "NO_ERROR";
|
|
36
|
-
ErrorCode[ErrorCode["NETWORK_ERROR"] = 1] = "NETWORK_ERROR";
|
|
37
|
-
ErrorCode[ErrorCode["ABORT"] = 2] = "ABORT";
|
|
38
|
-
})(ErrorCode || (ErrorCode = {}));
|
|
39
|
-
|
|
40
14
|
/**
|
|
41
15
|
* @license
|
|
42
16
|
* Copyright 2017 Google LLC
|
|
@@ -209,122 +183,6 @@ function internalError(message) {
|
|
|
209
183
|
throw new StorageError("internal-error" /* INTERNAL_ERROR */, 'Internal error: ' + message);
|
|
210
184
|
}
|
|
211
185
|
|
|
212
|
-
/**
|
|
213
|
-
* @license
|
|
214
|
-
* Copyright 2021 Google LLC
|
|
215
|
-
*
|
|
216
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
217
|
-
* you may not use this file except in compliance with the License.
|
|
218
|
-
* You may obtain a copy of the License at
|
|
219
|
-
*
|
|
220
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
221
|
-
*
|
|
222
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
223
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
224
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
225
|
-
* See the License for the specific language governing permissions and
|
|
226
|
-
* limitations under the License.
|
|
227
|
-
*/
|
|
228
|
-
/**
|
|
229
|
-
* Network layer that works in Node.
|
|
230
|
-
*
|
|
231
|
-
* This network implementation should not be used in browsers as it does not
|
|
232
|
-
* support progress updates.
|
|
233
|
-
*/
|
|
234
|
-
class FetchConnection {
|
|
235
|
-
constructor() {
|
|
236
|
-
this.sent_ = false;
|
|
237
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
238
|
-
this.fetch_ = nodeFetch__default["default"];
|
|
239
|
-
this.errorCode_ = ErrorCode.NO_ERROR;
|
|
240
|
-
}
|
|
241
|
-
send(url, method, body, headers) {
|
|
242
|
-
if (this.sent_) {
|
|
243
|
-
throw internalError('cannot .send() more than once');
|
|
244
|
-
}
|
|
245
|
-
this.sent_ = true;
|
|
246
|
-
return this.fetch_(url, {
|
|
247
|
-
method,
|
|
248
|
-
headers: headers || {},
|
|
249
|
-
body
|
|
250
|
-
}).then(resp => {
|
|
251
|
-
this.headers_ = resp.headers;
|
|
252
|
-
this.statusCode_ = resp.status;
|
|
253
|
-
return resp.text().then(body => {
|
|
254
|
-
this.body_ = body;
|
|
255
|
-
});
|
|
256
|
-
}, (_err) => {
|
|
257
|
-
this.errorCode_ = ErrorCode.NETWORK_ERROR;
|
|
258
|
-
// emulate XHR which sets status to 0 when encountering a network error
|
|
259
|
-
this.statusCode_ = 0;
|
|
260
|
-
});
|
|
261
|
-
}
|
|
262
|
-
getErrorCode() {
|
|
263
|
-
if (this.errorCode_ === undefined) {
|
|
264
|
-
throw internalError('cannot .getErrorCode() before receiving response');
|
|
265
|
-
}
|
|
266
|
-
return this.errorCode_;
|
|
267
|
-
}
|
|
268
|
-
getStatus() {
|
|
269
|
-
if (this.statusCode_ === undefined) {
|
|
270
|
-
throw internalError('cannot .getStatus() before receiving response');
|
|
271
|
-
}
|
|
272
|
-
return this.statusCode_;
|
|
273
|
-
}
|
|
274
|
-
getResponseText() {
|
|
275
|
-
if (this.body_ === undefined) {
|
|
276
|
-
throw internalError('cannot .getResponseText() before receiving response');
|
|
277
|
-
}
|
|
278
|
-
return this.body_;
|
|
279
|
-
}
|
|
280
|
-
abort() {
|
|
281
|
-
// Not supported
|
|
282
|
-
}
|
|
283
|
-
getResponseHeader(header) {
|
|
284
|
-
if (!this.headers_) {
|
|
285
|
-
throw internalError('cannot .getResponseText() before receiving response');
|
|
286
|
-
}
|
|
287
|
-
return this.headers_.get(header);
|
|
288
|
-
}
|
|
289
|
-
addUploadProgressListener(listener) {
|
|
290
|
-
// Not supported
|
|
291
|
-
}
|
|
292
|
-
/**
|
|
293
|
-
* @override
|
|
294
|
-
*/
|
|
295
|
-
removeUploadProgressListener(listener) {
|
|
296
|
-
// Not supported
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
function newConnection() {
|
|
300
|
-
return new FetchConnection();
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
/**
|
|
304
|
-
* @license
|
|
305
|
-
* Copyright 2017 Google LLC
|
|
306
|
-
*
|
|
307
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
308
|
-
* you may not use this file except in compliance with the License.
|
|
309
|
-
* You may obtain a copy of the License at
|
|
310
|
-
*
|
|
311
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
312
|
-
*
|
|
313
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
314
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
315
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
316
|
-
* See the License for the specific language governing permissions and
|
|
317
|
-
* limitations under the License.
|
|
318
|
-
*/
|
|
319
|
-
/**
|
|
320
|
-
* Factory-like class for creating XhrIo instances.
|
|
321
|
-
*/
|
|
322
|
-
class ConnectionPool {
|
|
323
|
-
createConnection() {
|
|
324
|
-
return newConnection();
|
|
325
|
-
}
|
|
326
|
-
}
|
|
327
|
-
|
|
328
186
|
/**
|
|
329
187
|
* @license
|
|
330
188
|
* Copyright 2017 Google LLC
|
|
@@ -654,6 +512,32 @@ function makeQueryString(params) {
|
|
|
654
512
|
return queryPart;
|
|
655
513
|
}
|
|
656
514
|
|
|
515
|
+
/**
|
|
516
|
+
* @license
|
|
517
|
+
* Copyright 2017 Google LLC
|
|
518
|
+
*
|
|
519
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
520
|
+
* you may not use this file except in compliance with the License.
|
|
521
|
+
* You may obtain a copy of the License at
|
|
522
|
+
*
|
|
523
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
524
|
+
*
|
|
525
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
526
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
527
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
528
|
+
* See the License for the specific language governing permissions and
|
|
529
|
+
* limitations under the License.
|
|
530
|
+
*/
|
|
531
|
+
/**
|
|
532
|
+
* Error codes for requests made by the the XhrIo wrapper.
|
|
533
|
+
*/
|
|
534
|
+
var ErrorCode;
|
|
535
|
+
(function (ErrorCode) {
|
|
536
|
+
ErrorCode[ErrorCode["NO_ERROR"] = 0] = "NO_ERROR";
|
|
537
|
+
ErrorCode[ErrorCode["NETWORK_ERROR"] = 1] = "NETWORK_ERROR";
|
|
538
|
+
ErrorCode[ErrorCode["ABORT"] = 2] = "ABORT";
|
|
539
|
+
})(ErrorCode || (ErrorCode = {}));
|
|
540
|
+
|
|
657
541
|
/**
|
|
658
542
|
* @license
|
|
659
543
|
* Copyright 2017 Google LLC
|
|
@@ -671,7 +555,7 @@ function makeQueryString(params) {
|
|
|
671
555
|
* limitations under the License.
|
|
672
556
|
*/
|
|
673
557
|
class NetworkRequest {
|
|
674
|
-
constructor(url_, method_, headers_, body_, successCodes_, additionalRetryCodes_, callback_, errorCallback_, timeout_, progressCallback_,
|
|
558
|
+
constructor(url_, method_, headers_, body_, successCodes_, additionalRetryCodes_, callback_, errorCallback_, timeout_, progressCallback_, connectionFactory_) {
|
|
675
559
|
this.url_ = url_;
|
|
676
560
|
this.method_ = method_;
|
|
677
561
|
this.headers_ = headers_;
|
|
@@ -682,7 +566,7 @@ class NetworkRequest {
|
|
|
682
566
|
this.errorCallback_ = errorCallback_;
|
|
683
567
|
this.timeout_ = timeout_;
|
|
684
568
|
this.progressCallback_ = progressCallback_;
|
|
685
|
-
this.
|
|
569
|
+
this.connectionFactory_ = connectionFactory_;
|
|
686
570
|
this.pendingConnection_ = null;
|
|
687
571
|
this.backoffId_ = null;
|
|
688
572
|
this.canceled_ = false;
|
|
@@ -702,7 +586,7 @@ class NetworkRequest {
|
|
|
702
586
|
backoffCallback(false, new RequestEndStatus(false, null, true));
|
|
703
587
|
return;
|
|
704
588
|
}
|
|
705
|
-
const connection = this.
|
|
589
|
+
const connection = this.connectionFactory_();
|
|
706
590
|
this.pendingConnection_ = connection;
|
|
707
591
|
const progressListener = progressEvent => {
|
|
708
592
|
const loaded = progressEvent.loaded;
|
|
@@ -848,7 +732,7 @@ function addAppCheckHeader_(headers, appCheckToken) {
|
|
|
848
732
|
headers['X-Firebase-AppCheck'] = appCheckToken;
|
|
849
733
|
}
|
|
850
734
|
}
|
|
851
|
-
function makeRequest(requestInfo, appId, authToken, appCheckToken,
|
|
735
|
+
function makeRequest(requestInfo, appId, authToken, appCheckToken, requestFactory, firebaseVersion) {
|
|
852
736
|
const queryPart = makeQueryString(requestInfo.urlParams);
|
|
853
737
|
const url = requestInfo.url + queryPart;
|
|
854
738
|
const headers = Object.assign({}, requestInfo.headers);
|
|
@@ -856,7 +740,7 @@ function makeRequest(requestInfo, appId, authToken, appCheckToken, pool, firebas
|
|
|
856
740
|
addAuthHeader_(headers, authToken);
|
|
857
741
|
addVersionHeader_(headers, firebaseVersion);
|
|
858
742
|
addAppCheckHeader_(headers, appCheckToken);
|
|
859
|
-
return new NetworkRequest(url, requestInfo.method, headers, requestInfo.body, requestInfo.successCodes, requestInfo.additionalRetryCodes, requestInfo.handler, requestInfo.errorHandler, requestInfo.timeout, requestInfo.progressCallback,
|
|
743
|
+
return new NetworkRequest(url, requestInfo.method, headers, requestInfo.body, requestInfo.successCodes, requestInfo.additionalRetryCodes, requestInfo.handler, requestInfo.errorHandler, requestInfo.timeout, requestInfo.progressCallback, requestFactory);
|
|
860
744
|
}
|
|
861
745
|
|
|
862
746
|
/**
|
|
@@ -2113,6 +1997,101 @@ function async(f) {
|
|
|
2113
1997
|
};
|
|
2114
1998
|
}
|
|
2115
1999
|
|
|
2000
|
+
/**
|
|
2001
|
+
* @license
|
|
2002
|
+
* Copyright 2021 Google LLC
|
|
2003
|
+
*
|
|
2004
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2005
|
+
* you may not use this file except in compliance with the License.
|
|
2006
|
+
* You may obtain a copy of the License at
|
|
2007
|
+
*
|
|
2008
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2009
|
+
*
|
|
2010
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2011
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2012
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2013
|
+
* See the License for the specific language governing permissions and
|
|
2014
|
+
* limitations under the License.
|
|
2015
|
+
*/
|
|
2016
|
+
/** An override for the text-based Connection. Used in tests. */
|
|
2017
|
+
let connectionFactoryOverride = null;
|
|
2018
|
+
/**
|
|
2019
|
+
* Network layer that works in Node.
|
|
2020
|
+
*
|
|
2021
|
+
* This network implementation should not be used in browsers as it does not
|
|
2022
|
+
* support progress updates.
|
|
2023
|
+
*/
|
|
2024
|
+
class FetchConnection {
|
|
2025
|
+
constructor() {
|
|
2026
|
+
this.sent_ = false;
|
|
2027
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2028
|
+
this.fetch_ = nodeFetch__default["default"];
|
|
2029
|
+
this.errorCode_ = ErrorCode.NO_ERROR;
|
|
2030
|
+
}
|
|
2031
|
+
send(url, method, body, headers) {
|
|
2032
|
+
if (this.sent_) {
|
|
2033
|
+
throw internalError('cannot .send() more than once');
|
|
2034
|
+
}
|
|
2035
|
+
this.sent_ = true;
|
|
2036
|
+
return this.fetch_(url, {
|
|
2037
|
+
method,
|
|
2038
|
+
headers: headers || {},
|
|
2039
|
+
body
|
|
2040
|
+
}).then(resp => {
|
|
2041
|
+
this.headers_ = resp.headers;
|
|
2042
|
+
this.statusCode_ = resp.status;
|
|
2043
|
+
return resp.text().then(body => {
|
|
2044
|
+
this.body_ = body;
|
|
2045
|
+
});
|
|
2046
|
+
}, (_err) => {
|
|
2047
|
+
this.errorCode_ = ErrorCode.NETWORK_ERROR;
|
|
2048
|
+
// emulate XHR which sets status to 0 when encountering a network error
|
|
2049
|
+
this.statusCode_ = 0;
|
|
2050
|
+
});
|
|
2051
|
+
}
|
|
2052
|
+
getErrorCode() {
|
|
2053
|
+
if (this.errorCode_ === undefined) {
|
|
2054
|
+
throw internalError('cannot .getErrorCode() before receiving response');
|
|
2055
|
+
}
|
|
2056
|
+
return this.errorCode_;
|
|
2057
|
+
}
|
|
2058
|
+
getStatus() {
|
|
2059
|
+
if (this.statusCode_ === undefined) {
|
|
2060
|
+
throw internalError('cannot .getStatus() before receiving response');
|
|
2061
|
+
}
|
|
2062
|
+
return this.statusCode_;
|
|
2063
|
+
}
|
|
2064
|
+
getResponseText() {
|
|
2065
|
+
if (this.body_ === undefined) {
|
|
2066
|
+
throw internalError('cannot .getResponseText() before receiving response');
|
|
2067
|
+
}
|
|
2068
|
+
return this.body_;
|
|
2069
|
+
}
|
|
2070
|
+
abort() {
|
|
2071
|
+
// Not supported
|
|
2072
|
+
}
|
|
2073
|
+
getResponseHeader(header) {
|
|
2074
|
+
if (!this.headers_) {
|
|
2075
|
+
throw internalError('cannot .getResponseText() before receiving response');
|
|
2076
|
+
}
|
|
2077
|
+
return this.headers_.get(header);
|
|
2078
|
+
}
|
|
2079
|
+
addUploadProgressListener(listener) {
|
|
2080
|
+
// Not supported
|
|
2081
|
+
}
|
|
2082
|
+
/**
|
|
2083
|
+
* @override
|
|
2084
|
+
*/
|
|
2085
|
+
removeUploadProgressListener(listener) {
|
|
2086
|
+
// Not supported
|
|
2087
|
+
}
|
|
2088
|
+
}
|
|
2089
|
+
function newConnection() {
|
|
2090
|
+
return connectionFactoryOverride
|
|
2091
|
+
? connectionFactoryOverride()
|
|
2092
|
+
: new FetchConnection();
|
|
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.
|
|
3125
|
+
const version = "0.8.5-2021102231614";
|
|
3149
3126
|
|
|
3150
3127
|
/**
|
|
3151
3128
|
* @license
|
|
@@ -3367,14 +3344,11 @@ function factory(container, { instanceIdentifier: url }) {
|
|
|
3367
3344
|
const app$1 = 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$1, authProvider, appCheckProvider,
|
|
3347
|
+
return new FirebaseStorageImpl(app$1, authProvider, appCheckProvider, url, app.SDK_VERSION);
|
|
3371
3348
|
}
|
|
3372
3349
|
function registerStorage() {
|
|
3373
3350
|
app._registerComponent(new component.Component(STORAGE_TYPE, factory, "PUBLIC" /* PUBLIC */).setMultipleInstances(true));
|
|
3374
|
-
|
|
3375
|
-
app.registerVersion(name, version, 'node');
|
|
3376
|
-
// BUILD_TARGET will be replaced by values like esm5, esm2017, cjs5, etc during the compilation
|
|
3377
|
-
app.registerVersion(name, version, 'cjs2017');
|
|
3351
|
+
app.registerVersion(name, version);
|
|
3378
3352
|
}
|
|
3379
3353
|
registerStorage();
|
|
3380
3354
|
|
|
@@ -3400,4 +3374,4 @@ exports.updateMetadata = updateMetadata;
|
|
|
3400
3374
|
exports.uploadBytes = uploadBytes;
|
|
3401
3375
|
exports.uploadBytesResumable = uploadBytesResumable;
|
|
3402
3376
|
exports.uploadString = uploadString;
|
|
3403
|
-
//# sourceMappingURL=index.cjs.js.map
|
|
3377
|
+
//# sourceMappingURL=index.node.cjs.js.map
|