@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
|
@@ -7,32 +7,6 @@ var tslib = require('tslib');
|
|
|
7
7
|
var util = require('@firebase/util');
|
|
8
8
|
var component = require('@firebase/component');
|
|
9
9
|
|
|
10
|
-
/**
|
|
11
|
-
* @license
|
|
12
|
-
* Copyright 2017 Google LLC
|
|
13
|
-
*
|
|
14
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
15
|
-
* you may not use this file except in compliance with the License.
|
|
16
|
-
* You may obtain a copy of the License at
|
|
17
|
-
*
|
|
18
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
19
|
-
*
|
|
20
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
21
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
22
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
23
|
-
* See the License for the specific language governing permissions and
|
|
24
|
-
* limitations under the License.
|
|
25
|
-
*/
|
|
26
|
-
/**
|
|
27
|
-
* Error codes for requests made by the the XhrIo wrapper.
|
|
28
|
-
*/
|
|
29
|
-
var ErrorCode;
|
|
30
|
-
(function (ErrorCode) {
|
|
31
|
-
ErrorCode[ErrorCode["NO_ERROR"] = 0] = "NO_ERROR";
|
|
32
|
-
ErrorCode[ErrorCode["NETWORK_ERROR"] = 1] = "NETWORK_ERROR";
|
|
33
|
-
ErrorCode[ErrorCode["ABORT"] = 2] = "ABORT";
|
|
34
|
-
})(ErrorCode || (ErrorCode = {}));
|
|
35
|
-
|
|
36
10
|
/**
|
|
37
11
|
* @license
|
|
38
12
|
* Copyright 2017 Google LLC
|
|
@@ -212,141 +186,6 @@ function internalError(message) {
|
|
|
212
186
|
throw new StorageError("internal-error" /* INTERNAL_ERROR */, 'Internal error: ' + message);
|
|
213
187
|
}
|
|
214
188
|
|
|
215
|
-
/**
|
|
216
|
-
* @license
|
|
217
|
-
* Copyright 2017 Google LLC
|
|
218
|
-
*
|
|
219
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
220
|
-
* you may not use this file except in compliance with the License.
|
|
221
|
-
* You may obtain a copy of the License at
|
|
222
|
-
*
|
|
223
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
224
|
-
*
|
|
225
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
226
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
227
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
228
|
-
* See the License for the specific language governing permissions and
|
|
229
|
-
* limitations under the License.
|
|
230
|
-
*/
|
|
231
|
-
/**
|
|
232
|
-
* Network layer for browsers. We use this instead of goog.net.XhrIo because
|
|
233
|
-
* goog.net.XhrIo is hyuuuuge and doesn't work in React Native on Android.
|
|
234
|
-
*/
|
|
235
|
-
var XhrConnection = /** @class */ (function () {
|
|
236
|
-
function XhrConnection() {
|
|
237
|
-
var _this = this;
|
|
238
|
-
this.sent_ = false;
|
|
239
|
-
this.xhr_ = new XMLHttpRequest();
|
|
240
|
-
this.errorCode_ = ErrorCode.NO_ERROR;
|
|
241
|
-
this.sendPromise_ = new Promise(function (resolve) {
|
|
242
|
-
_this.xhr_.addEventListener('abort', function () {
|
|
243
|
-
_this.errorCode_ = ErrorCode.ABORT;
|
|
244
|
-
resolve();
|
|
245
|
-
});
|
|
246
|
-
_this.xhr_.addEventListener('error', function () {
|
|
247
|
-
_this.errorCode_ = ErrorCode.NETWORK_ERROR;
|
|
248
|
-
resolve();
|
|
249
|
-
});
|
|
250
|
-
_this.xhr_.addEventListener('load', function () {
|
|
251
|
-
resolve();
|
|
252
|
-
});
|
|
253
|
-
});
|
|
254
|
-
}
|
|
255
|
-
XhrConnection.prototype.send = function (url, method, body, headers) {
|
|
256
|
-
if (this.sent_) {
|
|
257
|
-
throw internalError('cannot .send() more than once');
|
|
258
|
-
}
|
|
259
|
-
this.sent_ = true;
|
|
260
|
-
this.xhr_.open(method, url, true);
|
|
261
|
-
if (headers !== undefined) {
|
|
262
|
-
for (var key in headers) {
|
|
263
|
-
if (headers.hasOwnProperty(key)) {
|
|
264
|
-
this.xhr_.setRequestHeader(key, headers[key].toString());
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
}
|
|
268
|
-
if (body !== undefined) {
|
|
269
|
-
this.xhr_.send(body);
|
|
270
|
-
}
|
|
271
|
-
else {
|
|
272
|
-
this.xhr_.send();
|
|
273
|
-
}
|
|
274
|
-
return this.sendPromise_;
|
|
275
|
-
};
|
|
276
|
-
XhrConnection.prototype.getErrorCode = function () {
|
|
277
|
-
if (!this.sent_) {
|
|
278
|
-
throw internalError('cannot .getErrorCode() before sending');
|
|
279
|
-
}
|
|
280
|
-
return this.errorCode_;
|
|
281
|
-
};
|
|
282
|
-
XhrConnection.prototype.getStatus = function () {
|
|
283
|
-
if (!this.sent_) {
|
|
284
|
-
throw internalError('cannot .getStatus() before sending');
|
|
285
|
-
}
|
|
286
|
-
try {
|
|
287
|
-
return this.xhr_.status;
|
|
288
|
-
}
|
|
289
|
-
catch (e) {
|
|
290
|
-
return -1;
|
|
291
|
-
}
|
|
292
|
-
};
|
|
293
|
-
XhrConnection.prototype.getResponseText = function () {
|
|
294
|
-
if (!this.sent_) {
|
|
295
|
-
throw internalError('cannot .getResponseText() before sending');
|
|
296
|
-
}
|
|
297
|
-
return this.xhr_.responseText;
|
|
298
|
-
};
|
|
299
|
-
/** Aborts the request. */
|
|
300
|
-
XhrConnection.prototype.abort = function () {
|
|
301
|
-
this.xhr_.abort();
|
|
302
|
-
};
|
|
303
|
-
XhrConnection.prototype.getResponseHeader = function (header) {
|
|
304
|
-
return this.xhr_.getResponseHeader(header);
|
|
305
|
-
};
|
|
306
|
-
XhrConnection.prototype.addUploadProgressListener = function (listener) {
|
|
307
|
-
if (this.xhr_.upload != null) {
|
|
308
|
-
this.xhr_.upload.addEventListener('progress', listener);
|
|
309
|
-
}
|
|
310
|
-
};
|
|
311
|
-
XhrConnection.prototype.removeUploadProgressListener = function (listener) {
|
|
312
|
-
if (this.xhr_.upload != null) {
|
|
313
|
-
this.xhr_.upload.removeEventListener('progress', listener);
|
|
314
|
-
}
|
|
315
|
-
};
|
|
316
|
-
return XhrConnection;
|
|
317
|
-
}());
|
|
318
|
-
function newConnection() {
|
|
319
|
-
return new XhrConnection();
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
/**
|
|
323
|
-
* @license
|
|
324
|
-
* Copyright 2017 Google LLC
|
|
325
|
-
*
|
|
326
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
327
|
-
* you may not use this file except in compliance with the License.
|
|
328
|
-
* You may obtain a copy of the License at
|
|
329
|
-
*
|
|
330
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
331
|
-
*
|
|
332
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
333
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
334
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
335
|
-
* See the License for the specific language governing permissions and
|
|
336
|
-
* limitations under the License.
|
|
337
|
-
*/
|
|
338
|
-
/**
|
|
339
|
-
* Factory-like class for creating XhrIo instances.
|
|
340
|
-
*/
|
|
341
|
-
var ConnectionPool = /** @class */ (function () {
|
|
342
|
-
function ConnectionPool() {
|
|
343
|
-
}
|
|
344
|
-
ConnectionPool.prototype.createConnection = function () {
|
|
345
|
-
return newConnection();
|
|
346
|
-
};
|
|
347
|
-
return ConnectionPool;
|
|
348
|
-
}());
|
|
349
|
-
|
|
350
189
|
/**
|
|
351
190
|
* @license
|
|
352
191
|
* Copyright 2017 Google LLC
|
|
@@ -695,6 +534,32 @@ function makeQueryString(params) {
|
|
|
695
534
|
return queryPart;
|
|
696
535
|
}
|
|
697
536
|
|
|
537
|
+
/**
|
|
538
|
+
* @license
|
|
539
|
+
* Copyright 2017 Google LLC
|
|
540
|
+
*
|
|
541
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
542
|
+
* you may not use this file except in compliance with the License.
|
|
543
|
+
* You may obtain a copy of the License at
|
|
544
|
+
*
|
|
545
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
546
|
+
*
|
|
547
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
548
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
549
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
550
|
+
* See the License for the specific language governing permissions and
|
|
551
|
+
* limitations under the License.
|
|
552
|
+
*/
|
|
553
|
+
/**
|
|
554
|
+
* Error codes for requests made by the the XhrIo wrapper.
|
|
555
|
+
*/
|
|
556
|
+
var ErrorCode;
|
|
557
|
+
(function (ErrorCode) {
|
|
558
|
+
ErrorCode[ErrorCode["NO_ERROR"] = 0] = "NO_ERROR";
|
|
559
|
+
ErrorCode[ErrorCode["NETWORK_ERROR"] = 1] = "NETWORK_ERROR";
|
|
560
|
+
ErrorCode[ErrorCode["ABORT"] = 2] = "ABORT";
|
|
561
|
+
})(ErrorCode || (ErrorCode = {}));
|
|
562
|
+
|
|
698
563
|
/**
|
|
699
564
|
* @license
|
|
700
565
|
* Copyright 2017 Google LLC
|
|
@@ -712,7 +577,7 @@ function makeQueryString(params) {
|
|
|
712
577
|
* limitations under the License.
|
|
713
578
|
*/
|
|
714
579
|
var NetworkRequest = /** @class */ (function () {
|
|
715
|
-
function NetworkRequest(url_, method_, headers_, body_, successCodes_, additionalRetryCodes_, callback_, errorCallback_, timeout_, progressCallback_,
|
|
580
|
+
function NetworkRequest(url_, method_, headers_, body_, successCodes_, additionalRetryCodes_, callback_, errorCallback_, timeout_, progressCallback_, connectionFactory_) {
|
|
716
581
|
var _this = this;
|
|
717
582
|
this.url_ = url_;
|
|
718
583
|
this.method_ = method_;
|
|
@@ -724,7 +589,7 @@ var NetworkRequest = /** @class */ (function () {
|
|
|
724
589
|
this.errorCallback_ = errorCallback_;
|
|
725
590
|
this.timeout_ = timeout_;
|
|
726
591
|
this.progressCallback_ = progressCallback_;
|
|
727
|
-
this.
|
|
592
|
+
this.connectionFactory_ = connectionFactory_;
|
|
728
593
|
this.pendingConnection_ = null;
|
|
729
594
|
this.backoffId_ = null;
|
|
730
595
|
this.canceled_ = false;
|
|
@@ -745,7 +610,7 @@ var NetworkRequest = /** @class */ (function () {
|
|
|
745
610
|
backoffCallback(false, new RequestEndStatus(false, null, true));
|
|
746
611
|
return;
|
|
747
612
|
}
|
|
748
|
-
var connection = _this.
|
|
613
|
+
var connection = _this.connectionFactory_();
|
|
749
614
|
_this.pendingConnection_ = connection;
|
|
750
615
|
var progressListener = function (progressEvent) {
|
|
751
616
|
var loaded = progressEvent.loaded;
|
|
@@ -893,7 +758,7 @@ function addAppCheckHeader_(headers, appCheckToken) {
|
|
|
893
758
|
headers['X-Firebase-AppCheck'] = appCheckToken;
|
|
894
759
|
}
|
|
895
760
|
}
|
|
896
|
-
function makeRequest(requestInfo, appId, authToken, appCheckToken,
|
|
761
|
+
function makeRequest(requestInfo, appId, authToken, appCheckToken, requestFactory, firebaseVersion) {
|
|
897
762
|
var queryPart = makeQueryString(requestInfo.urlParams);
|
|
898
763
|
var url = requestInfo.url + queryPart;
|
|
899
764
|
var headers = Object.assign({}, requestInfo.headers);
|
|
@@ -901,7 +766,7 @@ function makeRequest(requestInfo, appId, authToken, appCheckToken, pool, firebas
|
|
|
901
766
|
addAuthHeader_(headers, authToken);
|
|
902
767
|
addVersionHeader_(headers, firebaseVersion);
|
|
903
768
|
addAppCheckHeader_(headers, appCheckToken);
|
|
904
|
-
return new NetworkRequest(url, requestInfo.method, headers, requestInfo.body, requestInfo.successCodes, requestInfo.additionalRetryCodes, requestInfo.handler, requestInfo.errorHandler, requestInfo.timeout, requestInfo.progressCallback,
|
|
769
|
+
return new NetworkRequest(url, requestInfo.method, headers, requestInfo.body, requestInfo.successCodes, requestInfo.additionalRetryCodes, requestInfo.handler, requestInfo.errorHandler, requestInfo.timeout, requestInfo.progressCallback, requestFactory);
|
|
905
770
|
}
|
|
906
771
|
|
|
907
772
|
/**
|
|
@@ -2174,6 +2039,117 @@ function async(f) {
|
|
|
2174
2039
|
};
|
|
2175
2040
|
}
|
|
2176
2041
|
|
|
2042
|
+
/**
|
|
2043
|
+
* @license
|
|
2044
|
+
* Copyright 2017 Google LLC
|
|
2045
|
+
*
|
|
2046
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2047
|
+
* you may not use this file except in compliance with the License.
|
|
2048
|
+
* You may obtain a copy of the License at
|
|
2049
|
+
*
|
|
2050
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2051
|
+
*
|
|
2052
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2053
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2054
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2055
|
+
* See the License for the specific language governing permissions and
|
|
2056
|
+
* limitations under the License.
|
|
2057
|
+
*/
|
|
2058
|
+
/** An override for the text-based Connection. Used in tests. */
|
|
2059
|
+
var connectionFactoryOverride = null;
|
|
2060
|
+
/**
|
|
2061
|
+
* Network layer for browsers. We use this instead of goog.net.XhrIo because
|
|
2062
|
+
* goog.net.XhrIo is hyuuuuge and doesn't work in React Native on Android.
|
|
2063
|
+
*/
|
|
2064
|
+
var XhrConnection = /** @class */ (function () {
|
|
2065
|
+
function XhrConnection() {
|
|
2066
|
+
var _this = this;
|
|
2067
|
+
this.sent_ = false;
|
|
2068
|
+
this.xhr_ = new XMLHttpRequest();
|
|
2069
|
+
this.errorCode_ = ErrorCode.NO_ERROR;
|
|
2070
|
+
this.sendPromise_ = new Promise(function (resolve) {
|
|
2071
|
+
_this.xhr_.addEventListener('abort', function () {
|
|
2072
|
+
_this.errorCode_ = ErrorCode.ABORT;
|
|
2073
|
+
resolve();
|
|
2074
|
+
});
|
|
2075
|
+
_this.xhr_.addEventListener('error', function () {
|
|
2076
|
+
_this.errorCode_ = ErrorCode.NETWORK_ERROR;
|
|
2077
|
+
resolve();
|
|
2078
|
+
});
|
|
2079
|
+
_this.xhr_.addEventListener('load', function () {
|
|
2080
|
+
resolve();
|
|
2081
|
+
});
|
|
2082
|
+
});
|
|
2083
|
+
}
|
|
2084
|
+
XhrConnection.prototype.send = function (url, method, body, headers) {
|
|
2085
|
+
if (this.sent_) {
|
|
2086
|
+
throw internalError('cannot .send() more than once');
|
|
2087
|
+
}
|
|
2088
|
+
this.sent_ = true;
|
|
2089
|
+
this.xhr_.open(method, url, true);
|
|
2090
|
+
if (headers !== undefined) {
|
|
2091
|
+
for (var key in headers) {
|
|
2092
|
+
if (headers.hasOwnProperty(key)) {
|
|
2093
|
+
this.xhr_.setRequestHeader(key, headers[key].toString());
|
|
2094
|
+
}
|
|
2095
|
+
}
|
|
2096
|
+
}
|
|
2097
|
+
if (body !== undefined) {
|
|
2098
|
+
this.xhr_.send(body);
|
|
2099
|
+
}
|
|
2100
|
+
else {
|
|
2101
|
+
this.xhr_.send();
|
|
2102
|
+
}
|
|
2103
|
+
return this.sendPromise_;
|
|
2104
|
+
};
|
|
2105
|
+
XhrConnection.prototype.getErrorCode = function () {
|
|
2106
|
+
if (!this.sent_) {
|
|
2107
|
+
throw internalError('cannot .getErrorCode() before sending');
|
|
2108
|
+
}
|
|
2109
|
+
return this.errorCode_;
|
|
2110
|
+
};
|
|
2111
|
+
XhrConnection.prototype.getStatus = function () {
|
|
2112
|
+
if (!this.sent_) {
|
|
2113
|
+
throw internalError('cannot .getStatus() before sending');
|
|
2114
|
+
}
|
|
2115
|
+
try {
|
|
2116
|
+
return this.xhr_.status;
|
|
2117
|
+
}
|
|
2118
|
+
catch (e) {
|
|
2119
|
+
return -1;
|
|
2120
|
+
}
|
|
2121
|
+
};
|
|
2122
|
+
XhrConnection.prototype.getResponseText = function () {
|
|
2123
|
+
if (!this.sent_) {
|
|
2124
|
+
throw internalError('cannot .getResponseText() before sending');
|
|
2125
|
+
}
|
|
2126
|
+
return this.xhr_.responseText;
|
|
2127
|
+
};
|
|
2128
|
+
/** Aborts the request. */
|
|
2129
|
+
XhrConnection.prototype.abort = function () {
|
|
2130
|
+
this.xhr_.abort();
|
|
2131
|
+
};
|
|
2132
|
+
XhrConnection.prototype.getResponseHeader = function (header) {
|
|
2133
|
+
return this.xhr_.getResponseHeader(header);
|
|
2134
|
+
};
|
|
2135
|
+
XhrConnection.prototype.addUploadProgressListener = function (listener) {
|
|
2136
|
+
if (this.xhr_.upload != null) {
|
|
2137
|
+
this.xhr_.upload.addEventListener('progress', listener);
|
|
2138
|
+
}
|
|
2139
|
+
};
|
|
2140
|
+
XhrConnection.prototype.removeUploadProgressListener = function (listener) {
|
|
2141
|
+
if (this.xhr_.upload != null) {
|
|
2142
|
+
this.xhr_.upload.removeEventListener('progress', listener);
|
|
2143
|
+
}
|
|
2144
|
+
};
|
|
2145
|
+
return XhrConnection;
|
|
2146
|
+
}());
|
|
2147
|
+
function newConnection() {
|
|
2148
|
+
return connectionFactoryOverride
|
|
2149
|
+
? connectionFactoryOverride()
|
|
2150
|
+
: new XhrConnection();
|
|
2151
|
+
}
|
|
2152
|
+
|
|
2177
2153
|
/**
|
|
2178
2154
|
* @license
|
|
2179
2155
|
* Copyright 2017 Google LLC
|
|
@@ -2319,7 +2295,7 @@ var UploadTask = /** @class */ (function () {
|
|
|
2319
2295
|
var _this = this;
|
|
2320
2296
|
this._resolveToken(function (authToken, appCheckToken) {
|
|
2321
2297
|
var requestInfo = createResumableUpload(_this._ref.storage, _this._ref._location, _this._mappings, _this._blob, _this._metadata);
|
|
2322
|
-
var createRequest = _this._ref.storage._makeRequest(requestInfo, authToken, appCheckToken);
|
|
2298
|
+
var createRequest = _this._ref.storage._makeRequest(requestInfo, newConnection, authToken, appCheckToken);
|
|
2323
2299
|
_this._request = createRequest;
|
|
2324
2300
|
createRequest.getPromise().then(function (url) {
|
|
2325
2301
|
_this._request = undefined;
|
|
@@ -2335,7 +2311,7 @@ var UploadTask = /** @class */ (function () {
|
|
|
2335
2311
|
var url = this._uploadUrl;
|
|
2336
2312
|
this._resolveToken(function (authToken, appCheckToken) {
|
|
2337
2313
|
var requestInfo = getResumableUploadStatus(_this._ref.storage, _this._ref._location, url, _this._blob);
|
|
2338
|
-
var statusRequest = _this._ref.storage._makeRequest(requestInfo, authToken, appCheckToken);
|
|
2314
|
+
var statusRequest = _this._ref.storage._makeRequest(requestInfo, newConnection, authToken, appCheckToken);
|
|
2339
2315
|
_this._request = statusRequest;
|
|
2340
2316
|
statusRequest.getPromise().then(function (status) {
|
|
2341
2317
|
status = status;
|
|
@@ -2365,7 +2341,7 @@ var UploadTask = /** @class */ (function () {
|
|
|
2365
2341
|
_this._transition("error" /* ERROR */);
|
|
2366
2342
|
return;
|
|
2367
2343
|
}
|
|
2368
|
-
var uploadRequest = _this._ref.storage._makeRequest(requestInfo, authToken, appCheckToken);
|
|
2344
|
+
var uploadRequest = _this._ref.storage._makeRequest(requestInfo, newConnection, authToken, appCheckToken);
|
|
2369
2345
|
_this._request = uploadRequest;
|
|
2370
2346
|
uploadRequest.getPromise().then(function (newStatus) {
|
|
2371
2347
|
_this._increaseMultiplier();
|
|
@@ -2392,7 +2368,7 @@ var UploadTask = /** @class */ (function () {
|
|
|
2392
2368
|
var _this = this;
|
|
2393
2369
|
this._resolveToken(function (authToken, appCheckToken) {
|
|
2394
2370
|
var requestInfo = getMetadata$2(_this._ref.storage, _this._ref._location, _this._mappings);
|
|
2395
|
-
var metadataRequest = _this._ref.storage._makeRequest(requestInfo, authToken, appCheckToken);
|
|
2371
|
+
var metadataRequest = _this._ref.storage._makeRequest(requestInfo, newConnection, authToken, appCheckToken);
|
|
2396
2372
|
_this._request = metadataRequest;
|
|
2397
2373
|
metadataRequest.getPromise().then(function (metadata) {
|
|
2398
2374
|
_this._request = undefined;
|
|
@@ -2405,7 +2381,7 @@ var UploadTask = /** @class */ (function () {
|
|
|
2405
2381
|
var _this = this;
|
|
2406
2382
|
this._resolveToken(function (authToken, appCheckToken) {
|
|
2407
2383
|
var requestInfo = multipartUpload(_this._ref.storage, _this._ref._location, _this._mappings, _this._blob, _this._metadata);
|
|
2408
|
-
var multipartRequest = _this._ref.storage._makeRequest(requestInfo, authToken, appCheckToken);
|
|
2384
|
+
var multipartRequest = _this._ref.storage._makeRequest(requestInfo, newConnection, authToken, appCheckToken);
|
|
2409
2385
|
_this._request = multipartRequest;
|
|
2410
2386
|
multipartRequest.getPromise().then(function (metadata) {
|
|
2411
2387
|
_this._request = undefined;
|
|
@@ -2815,8 +2791,7 @@ function uploadBytes$1(ref, data, metadata) {
|
|
|
2815
2791
|
ref._throwIfRoot('uploadBytes');
|
|
2816
2792
|
var requestInfo = multipartUpload(ref.storage, ref._location, getMappings(), new FbsBlob(data, true), metadata);
|
|
2817
2793
|
return ref.storage
|
|
2818
|
-
.makeRequestWithTokens(requestInfo)
|
|
2819
|
-
.then(function (request) { return request.getPromise(); })
|
|
2794
|
+
.makeRequestWithTokens(requestInfo, newConnection)
|
|
2820
2795
|
.then(function (finalMetadata) {
|
|
2821
2796
|
return {
|
|
2822
2797
|
metadata: finalMetadata,
|
|
@@ -2938,26 +2913,17 @@ function listAllHelper(ref, accumulator, pageToken) {
|
|
|
2938
2913
|
* can be used to get the rest of the results.
|
|
2939
2914
|
*/
|
|
2940
2915
|
function list$1(ref, options) {
|
|
2941
|
-
|
|
2942
|
-
|
|
2943
|
-
|
|
2944
|
-
|
|
2945
|
-
|
|
2946
|
-
|
|
2947
|
-
|
|
2948
|
-
|
|
2949
|
-
|
|
2950
|
-
|
|
2951
|
-
|
|
2952
|
-
}
|
|
2953
|
-
op = options || {};
|
|
2954
|
-
requestInfo = list$2(ref.storage, ref._location,
|
|
2955
|
-
/*delimiter= */ '/', op.pageToken, op.maxResults);
|
|
2956
|
-
return [4 /*yield*/, ref.storage.makeRequestWithTokens(requestInfo)];
|
|
2957
|
-
case 1: return [2 /*return*/, (_a.sent()).getPromise()];
|
|
2958
|
-
}
|
|
2959
|
-
});
|
|
2960
|
-
});
|
|
2916
|
+
if (options != null) {
|
|
2917
|
+
if (typeof options.maxResults === 'number') {
|
|
2918
|
+
validateNumber('options.maxResults',
|
|
2919
|
+
/* minValue= */ 1,
|
|
2920
|
+
/* maxValue= */ 1000, options.maxResults);
|
|
2921
|
+
}
|
|
2922
|
+
}
|
|
2923
|
+
var op = options || {};
|
|
2924
|
+
var requestInfo = list$2(ref.storage, ref._location,
|
|
2925
|
+
/*delimiter= */ '/', op.pageToken, op.maxResults);
|
|
2926
|
+
return ref.storage.makeRequestWithTokens(requestInfo, newConnection);
|
|
2961
2927
|
}
|
|
2962
2928
|
/**
|
|
2963
2929
|
* A `Promise` that resolves with the metadata for this object. If this
|
|
@@ -2967,18 +2933,9 @@ function list$1(ref, options) {
|
|
|
2967
2933
|
* @param ref - StorageReference to get metadata from.
|
|
2968
2934
|
*/
|
|
2969
2935
|
function getMetadata$1(ref) {
|
|
2970
|
-
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
switch (_a.label) {
|
|
2974
|
-
case 0:
|
|
2975
|
-
ref._throwIfRoot('getMetadata');
|
|
2976
|
-
requestInfo = getMetadata$2(ref.storage, ref._location, getMappings());
|
|
2977
|
-
return [4 /*yield*/, ref.storage.makeRequestWithTokens(requestInfo)];
|
|
2978
|
-
case 1: return [2 /*return*/, (_a.sent()).getPromise()];
|
|
2979
|
-
}
|
|
2980
|
-
});
|
|
2981
|
-
});
|
|
2936
|
+
ref._throwIfRoot('getMetadata');
|
|
2937
|
+
var requestInfo = getMetadata$2(ref.storage, ref._location, getMappings());
|
|
2938
|
+
return ref.storage.makeRequestWithTokens(requestInfo, newConnection);
|
|
2982
2939
|
}
|
|
2983
2940
|
/**
|
|
2984
2941
|
* Updates the metadata for this object.
|
|
@@ -2992,18 +2949,9 @@ function getMetadata$1(ref) {
|
|
|
2992
2949
|
* See `firebaseStorage.Reference.prototype.getMetadata`
|
|
2993
2950
|
*/
|
|
2994
2951
|
function updateMetadata$1(ref, metadata) {
|
|
2995
|
-
|
|
2996
|
-
|
|
2997
|
-
|
|
2998
|
-
switch (_a.label) {
|
|
2999
|
-
case 0:
|
|
3000
|
-
ref._throwIfRoot('updateMetadata');
|
|
3001
|
-
requestInfo = updateMetadata$2(ref.storage, ref._location, metadata, getMappings());
|
|
3002
|
-
return [4 /*yield*/, ref.storage.makeRequestWithTokens(requestInfo)];
|
|
3003
|
-
case 1: return [2 /*return*/, (_a.sent()).getPromise()];
|
|
3004
|
-
}
|
|
3005
|
-
});
|
|
3006
|
-
});
|
|
2952
|
+
ref._throwIfRoot('updateMetadata');
|
|
2953
|
+
var requestInfo = updateMetadata$2(ref.storage, ref._location, metadata, getMappings());
|
|
2954
|
+
return ref.storage.makeRequestWithTokens(requestInfo, newConnection);
|
|
3007
2955
|
}
|
|
3008
2956
|
/**
|
|
3009
2957
|
* Returns the download URL for the given Reference.
|
|
@@ -3012,24 +2960,15 @@ function updateMetadata$1(ref, metadata) {
|
|
|
3012
2960
|
* URL for this object.
|
|
3013
2961
|
*/
|
|
3014
2962
|
function getDownloadURL$1(ref) {
|
|
3015
|
-
|
|
3016
|
-
|
|
3017
|
-
|
|
3018
|
-
|
|
3019
|
-
|
|
3020
|
-
|
|
3021
|
-
|
|
3022
|
-
|
|
3023
|
-
|
|
3024
|
-
.getPromise()
|
|
3025
|
-
.then(function (url) {
|
|
3026
|
-
if (url === null) {
|
|
3027
|
-
throw noDownloadURL();
|
|
3028
|
-
}
|
|
3029
|
-
return url;
|
|
3030
|
-
})];
|
|
3031
|
-
}
|
|
3032
|
-
});
|
|
2963
|
+
ref._throwIfRoot('getDownloadURL');
|
|
2964
|
+
var requestInfo = getDownloadUrl(ref.storage, ref._location, getMappings());
|
|
2965
|
+
return ref.storage
|
|
2966
|
+
.makeRequestWithTokens(requestInfo, newConnection)
|
|
2967
|
+
.then(function (url) {
|
|
2968
|
+
if (url === null) {
|
|
2969
|
+
throw noDownloadURL();
|
|
2970
|
+
}
|
|
2971
|
+
return url;
|
|
3033
2972
|
});
|
|
3034
2973
|
}
|
|
3035
2974
|
/**
|
|
@@ -3039,18 +2978,9 @@ function getDownloadURL$1(ref) {
|
|
|
3039
2978
|
* @returns A `Promise` that resolves if the deletion succeeds.
|
|
3040
2979
|
*/
|
|
3041
2980
|
function deleteObject$1(ref) {
|
|
3042
|
-
|
|
3043
|
-
|
|
3044
|
-
|
|
3045
|
-
switch (_a.label) {
|
|
3046
|
-
case 0:
|
|
3047
|
-
ref._throwIfRoot('deleteObject');
|
|
3048
|
-
requestInfo = deleteObject$2(ref.storage, ref._location);
|
|
3049
|
-
return [4 /*yield*/, ref.storage.makeRequestWithTokens(requestInfo)];
|
|
3050
|
-
case 1: return [2 /*return*/, (_a.sent()).getPromise()];
|
|
3051
|
-
}
|
|
3052
|
-
});
|
|
3053
|
-
});
|
|
2981
|
+
ref._throwIfRoot('deleteObject');
|
|
2982
|
+
var requestInfo = deleteObject$2(ref.storage, ref._location);
|
|
2983
|
+
return ref.storage.makeRequestWithTokens(requestInfo, newConnection);
|
|
3054
2984
|
}
|
|
3055
2985
|
/**
|
|
3056
2986
|
* Returns reference for object obtained by appending `childPath` to `ref`.
|
|
@@ -3172,11 +3102,10 @@ var FirebaseStorageImpl = /** @class */ (function () {
|
|
|
3172
3102
|
/**
|
|
3173
3103
|
* @internal
|
|
3174
3104
|
*/
|
|
3175
|
-
|
|
3105
|
+
_url, _firebaseVersion) {
|
|
3176
3106
|
this.app = app;
|
|
3177
3107
|
this._authProvider = _authProvider;
|
|
3178
3108
|
this._appCheckProvider = _appCheckProvider;
|
|
3179
|
-
this._pool = _pool;
|
|
3180
3109
|
this._url = _url;
|
|
3181
3110
|
this._firebaseVersion = _firebaseVersion;
|
|
3182
3111
|
this._bucket = null;
|
|
@@ -3318,10 +3247,10 @@ var FirebaseStorageImpl = /** @class */ (function () {
|
|
|
3318
3247
|
* @param requestInfo - HTTP RequestInfo object
|
|
3319
3248
|
* @param authToken - Firebase auth token
|
|
3320
3249
|
*/
|
|
3321
|
-
FirebaseStorageImpl.prototype._makeRequest = function (requestInfo, authToken, appCheckToken) {
|
|
3250
|
+
FirebaseStorageImpl.prototype._makeRequest = function (requestInfo, requestFactory, authToken, appCheckToken) {
|
|
3322
3251
|
var _this = this;
|
|
3323
3252
|
if (!this._deleted) {
|
|
3324
|
-
var request_1 = makeRequest(requestInfo, this._appId, authToken, appCheckToken,
|
|
3253
|
+
var request_1 = makeRequest(requestInfo, this._appId, authToken, appCheckToken, requestFactory, this._firebaseVersion);
|
|
3325
3254
|
this._requests.add(request_1);
|
|
3326
3255
|
// Request removes itself from set when complete.
|
|
3327
3256
|
request_1.getPromise().then(function () { return _this._requests.delete(request_1); }, function () { return _this._requests.delete(request_1); });
|
|
@@ -3331,7 +3260,7 @@ var FirebaseStorageImpl = /** @class */ (function () {
|
|
|
3331
3260
|
return new FailRequest(appDeleted());
|
|
3332
3261
|
}
|
|
3333
3262
|
};
|
|
3334
|
-
FirebaseStorageImpl.prototype.makeRequestWithTokens = function (requestInfo) {
|
|
3263
|
+
FirebaseStorageImpl.prototype.makeRequestWithTokens = function (requestInfo, requestFactory) {
|
|
3335
3264
|
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
3336
3265
|
var _a, authToken, appCheckToken;
|
|
3337
3266
|
return tslib.__generator(this, function (_b) {
|
|
@@ -3342,7 +3271,7 @@ var FirebaseStorageImpl = /** @class */ (function () {
|
|
|
3342
3271
|
])];
|
|
3343
3272
|
case 1:
|
|
3344
3273
|
_a = _b.sent(), authToken = _a[0], appCheckToken = _a[1];
|
|
3345
|
-
return [2 /*return*/, this._makeRequest(requestInfo, authToken, appCheckToken)];
|
|
3274
|
+
return [2 /*return*/, this._makeRequest(requestInfo, requestFactory, authToken, appCheckToken).getPromise()];
|
|
3346
3275
|
}
|
|
3347
3276
|
});
|
|
3348
3277
|
});
|
|
@@ -3351,7 +3280,7 @@ var FirebaseStorageImpl = /** @class */ (function () {
|
|
|
3351
3280
|
}());
|
|
3352
3281
|
|
|
3353
3282
|
var name = "@firebase/storage";
|
|
3354
|
-
var version = "0.8.4-
|
|
3283
|
+
var version = "0.8.4-canary.dfed7f83f";
|
|
3355
3284
|
|
|
3356
3285
|
/**
|
|
3357
3286
|
* @license
|
|
@@ -3576,7 +3505,7 @@ function factory(container, _a) {
|
|
|
3576
3505
|
var app$1 = container.getProvider('app').getImmediate();
|
|
3577
3506
|
var authProvider = container.getProvider('auth-internal');
|
|
3578
3507
|
var appCheckProvider = container.getProvider('app-check-internal');
|
|
3579
|
-
return new FirebaseStorageImpl(app$1, authProvider, appCheckProvider,
|
|
3508
|
+
return new FirebaseStorageImpl(app$1, authProvider, appCheckProvider, url, app.SDK_VERSION);
|
|
3580
3509
|
}
|
|
3581
3510
|
function registerStorage() {
|
|
3582
3511
|
app._registerComponent(new component.Component(STORAGE_TYPE, factory, "PUBLIC" /* PUBLIC */).setMultipleInstances(true));
|