@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.esm5.js
CHANGED
|
@@ -3,32 +3,6 @@ import { __extends, __spreadArray, __awaiter, __generator, __assign } from 'tsli
|
|
|
3
3
|
import { FirebaseError, createMockUserToken, getModularInstance } from '@firebase/util';
|
|
4
4
|
import { Component } from '@firebase/component';
|
|
5
5
|
|
|
6
|
-
/**
|
|
7
|
-
* @license
|
|
8
|
-
* Copyright 2017 Google LLC
|
|
9
|
-
*
|
|
10
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
11
|
-
* you may not use this file except in compliance with the License.
|
|
12
|
-
* You may obtain a copy of the License at
|
|
13
|
-
*
|
|
14
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
15
|
-
*
|
|
16
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
17
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
18
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
19
|
-
* See the License for the specific language governing permissions and
|
|
20
|
-
* limitations under the License.
|
|
21
|
-
*/
|
|
22
|
-
/**
|
|
23
|
-
* Error codes for requests made by the the XhrIo wrapper.
|
|
24
|
-
*/
|
|
25
|
-
var ErrorCode;
|
|
26
|
-
(function (ErrorCode) {
|
|
27
|
-
ErrorCode[ErrorCode["NO_ERROR"] = 0] = "NO_ERROR";
|
|
28
|
-
ErrorCode[ErrorCode["NETWORK_ERROR"] = 1] = "NETWORK_ERROR";
|
|
29
|
-
ErrorCode[ErrorCode["ABORT"] = 2] = "ABORT";
|
|
30
|
-
})(ErrorCode || (ErrorCode = {}));
|
|
31
|
-
|
|
32
6
|
/**
|
|
33
7
|
* @license
|
|
34
8
|
* Copyright 2017 Google LLC
|
|
@@ -208,141 +182,6 @@ function internalError(message) {
|
|
|
208
182
|
throw new StorageError("internal-error" /* INTERNAL_ERROR */, 'Internal error: ' + message);
|
|
209
183
|
}
|
|
210
184
|
|
|
211
|
-
/**
|
|
212
|
-
* @license
|
|
213
|
-
* Copyright 2017 Google LLC
|
|
214
|
-
*
|
|
215
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
216
|
-
* you may not use this file except in compliance with the License.
|
|
217
|
-
* You may obtain a copy of the License at
|
|
218
|
-
*
|
|
219
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
220
|
-
*
|
|
221
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
222
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
223
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
224
|
-
* See the License for the specific language governing permissions and
|
|
225
|
-
* limitations under the License.
|
|
226
|
-
*/
|
|
227
|
-
/**
|
|
228
|
-
* Network layer for browsers. We use this instead of goog.net.XhrIo because
|
|
229
|
-
* goog.net.XhrIo is hyuuuuge and doesn't work in React Native on Android.
|
|
230
|
-
*/
|
|
231
|
-
var XhrConnection = /** @class */ (function () {
|
|
232
|
-
function XhrConnection() {
|
|
233
|
-
var _this = this;
|
|
234
|
-
this.sent_ = false;
|
|
235
|
-
this.xhr_ = new XMLHttpRequest();
|
|
236
|
-
this.errorCode_ = ErrorCode.NO_ERROR;
|
|
237
|
-
this.sendPromise_ = new Promise(function (resolve) {
|
|
238
|
-
_this.xhr_.addEventListener('abort', function () {
|
|
239
|
-
_this.errorCode_ = ErrorCode.ABORT;
|
|
240
|
-
resolve();
|
|
241
|
-
});
|
|
242
|
-
_this.xhr_.addEventListener('error', function () {
|
|
243
|
-
_this.errorCode_ = ErrorCode.NETWORK_ERROR;
|
|
244
|
-
resolve();
|
|
245
|
-
});
|
|
246
|
-
_this.xhr_.addEventListener('load', function () {
|
|
247
|
-
resolve();
|
|
248
|
-
});
|
|
249
|
-
});
|
|
250
|
-
}
|
|
251
|
-
XhrConnection.prototype.send = function (url, method, body, headers) {
|
|
252
|
-
if (this.sent_) {
|
|
253
|
-
throw internalError('cannot .send() more than once');
|
|
254
|
-
}
|
|
255
|
-
this.sent_ = true;
|
|
256
|
-
this.xhr_.open(method, url, true);
|
|
257
|
-
if (headers !== undefined) {
|
|
258
|
-
for (var key in headers) {
|
|
259
|
-
if (headers.hasOwnProperty(key)) {
|
|
260
|
-
this.xhr_.setRequestHeader(key, headers[key].toString());
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
if (body !== undefined) {
|
|
265
|
-
this.xhr_.send(body);
|
|
266
|
-
}
|
|
267
|
-
else {
|
|
268
|
-
this.xhr_.send();
|
|
269
|
-
}
|
|
270
|
-
return this.sendPromise_;
|
|
271
|
-
};
|
|
272
|
-
XhrConnection.prototype.getErrorCode = function () {
|
|
273
|
-
if (!this.sent_) {
|
|
274
|
-
throw internalError('cannot .getErrorCode() before sending');
|
|
275
|
-
}
|
|
276
|
-
return this.errorCode_;
|
|
277
|
-
};
|
|
278
|
-
XhrConnection.prototype.getStatus = function () {
|
|
279
|
-
if (!this.sent_) {
|
|
280
|
-
throw internalError('cannot .getStatus() before sending');
|
|
281
|
-
}
|
|
282
|
-
try {
|
|
283
|
-
return this.xhr_.status;
|
|
284
|
-
}
|
|
285
|
-
catch (e) {
|
|
286
|
-
return -1;
|
|
287
|
-
}
|
|
288
|
-
};
|
|
289
|
-
XhrConnection.prototype.getResponseText = function () {
|
|
290
|
-
if (!this.sent_) {
|
|
291
|
-
throw internalError('cannot .getResponseText() before sending');
|
|
292
|
-
}
|
|
293
|
-
return this.xhr_.responseText;
|
|
294
|
-
};
|
|
295
|
-
/** Aborts the request. */
|
|
296
|
-
XhrConnection.prototype.abort = function () {
|
|
297
|
-
this.xhr_.abort();
|
|
298
|
-
};
|
|
299
|
-
XhrConnection.prototype.getResponseHeader = function (header) {
|
|
300
|
-
return this.xhr_.getResponseHeader(header);
|
|
301
|
-
};
|
|
302
|
-
XhrConnection.prototype.addUploadProgressListener = function (listener) {
|
|
303
|
-
if (this.xhr_.upload != null) {
|
|
304
|
-
this.xhr_.upload.addEventListener('progress', listener);
|
|
305
|
-
}
|
|
306
|
-
};
|
|
307
|
-
XhrConnection.prototype.removeUploadProgressListener = function (listener) {
|
|
308
|
-
if (this.xhr_.upload != null) {
|
|
309
|
-
this.xhr_.upload.removeEventListener('progress', listener);
|
|
310
|
-
}
|
|
311
|
-
};
|
|
312
|
-
return XhrConnection;
|
|
313
|
-
}());
|
|
314
|
-
function newConnection() {
|
|
315
|
-
return new XhrConnection();
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
/**
|
|
319
|
-
* @license
|
|
320
|
-
* Copyright 2017 Google LLC
|
|
321
|
-
*
|
|
322
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
323
|
-
* you may not use this file except in compliance with the License.
|
|
324
|
-
* You may obtain a copy of the License at
|
|
325
|
-
*
|
|
326
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
327
|
-
*
|
|
328
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
329
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
330
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
331
|
-
* See the License for the specific language governing permissions and
|
|
332
|
-
* limitations under the License.
|
|
333
|
-
*/
|
|
334
|
-
/**
|
|
335
|
-
* Factory-like class for creating XhrIo instances.
|
|
336
|
-
*/
|
|
337
|
-
var ConnectionPool = /** @class */ (function () {
|
|
338
|
-
function ConnectionPool() {
|
|
339
|
-
}
|
|
340
|
-
ConnectionPool.prototype.createConnection = function () {
|
|
341
|
-
return newConnection();
|
|
342
|
-
};
|
|
343
|
-
return ConnectionPool;
|
|
344
|
-
}());
|
|
345
|
-
|
|
346
185
|
/**
|
|
347
186
|
* @license
|
|
348
187
|
* Copyright 2017 Google LLC
|
|
@@ -691,6 +530,32 @@ function makeQueryString(params) {
|
|
|
691
530
|
return queryPart;
|
|
692
531
|
}
|
|
693
532
|
|
|
533
|
+
/**
|
|
534
|
+
* @license
|
|
535
|
+
* Copyright 2017 Google LLC
|
|
536
|
+
*
|
|
537
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
538
|
+
* you may not use this file except in compliance with the License.
|
|
539
|
+
* You may obtain a copy of the License at
|
|
540
|
+
*
|
|
541
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
542
|
+
*
|
|
543
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
544
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
545
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
546
|
+
* See the License for the specific language governing permissions and
|
|
547
|
+
* limitations under the License.
|
|
548
|
+
*/
|
|
549
|
+
/**
|
|
550
|
+
* Error codes for requests made by the the XhrIo wrapper.
|
|
551
|
+
*/
|
|
552
|
+
var ErrorCode;
|
|
553
|
+
(function (ErrorCode) {
|
|
554
|
+
ErrorCode[ErrorCode["NO_ERROR"] = 0] = "NO_ERROR";
|
|
555
|
+
ErrorCode[ErrorCode["NETWORK_ERROR"] = 1] = "NETWORK_ERROR";
|
|
556
|
+
ErrorCode[ErrorCode["ABORT"] = 2] = "ABORT";
|
|
557
|
+
})(ErrorCode || (ErrorCode = {}));
|
|
558
|
+
|
|
694
559
|
/**
|
|
695
560
|
* @license
|
|
696
561
|
* Copyright 2017 Google LLC
|
|
@@ -708,7 +573,7 @@ function makeQueryString(params) {
|
|
|
708
573
|
* limitations under the License.
|
|
709
574
|
*/
|
|
710
575
|
var NetworkRequest = /** @class */ (function () {
|
|
711
|
-
function NetworkRequest(url_, method_, headers_, body_, successCodes_, additionalRetryCodes_, callback_, errorCallback_, timeout_, progressCallback_,
|
|
576
|
+
function NetworkRequest(url_, method_, headers_, body_, successCodes_, additionalRetryCodes_, callback_, errorCallback_, timeout_, progressCallback_, connectionFactory_) {
|
|
712
577
|
var _this = this;
|
|
713
578
|
this.url_ = url_;
|
|
714
579
|
this.method_ = method_;
|
|
@@ -720,7 +585,7 @@ var NetworkRequest = /** @class */ (function () {
|
|
|
720
585
|
this.errorCallback_ = errorCallback_;
|
|
721
586
|
this.timeout_ = timeout_;
|
|
722
587
|
this.progressCallback_ = progressCallback_;
|
|
723
|
-
this.
|
|
588
|
+
this.connectionFactory_ = connectionFactory_;
|
|
724
589
|
this.pendingConnection_ = null;
|
|
725
590
|
this.backoffId_ = null;
|
|
726
591
|
this.canceled_ = false;
|
|
@@ -741,7 +606,7 @@ var NetworkRequest = /** @class */ (function () {
|
|
|
741
606
|
backoffCallback(false, new RequestEndStatus(false, null, true));
|
|
742
607
|
return;
|
|
743
608
|
}
|
|
744
|
-
var connection = _this.
|
|
609
|
+
var connection = _this.connectionFactory_();
|
|
745
610
|
_this.pendingConnection_ = connection;
|
|
746
611
|
var progressListener = function (progressEvent) {
|
|
747
612
|
var loaded = progressEvent.loaded;
|
|
@@ -889,7 +754,7 @@ function addAppCheckHeader_(headers, appCheckToken) {
|
|
|
889
754
|
headers['X-Firebase-AppCheck'] = appCheckToken;
|
|
890
755
|
}
|
|
891
756
|
}
|
|
892
|
-
function makeRequest(requestInfo, appId, authToken, appCheckToken,
|
|
757
|
+
function makeRequest(requestInfo, appId, authToken, appCheckToken, requestFactory, firebaseVersion) {
|
|
893
758
|
var queryPart = makeQueryString(requestInfo.urlParams);
|
|
894
759
|
var url = requestInfo.url + queryPart;
|
|
895
760
|
var headers = Object.assign({}, requestInfo.headers);
|
|
@@ -897,7 +762,7 @@ function makeRequest(requestInfo, appId, authToken, appCheckToken, pool, firebas
|
|
|
897
762
|
addAuthHeader_(headers, authToken);
|
|
898
763
|
addVersionHeader_(headers, firebaseVersion);
|
|
899
764
|
addAppCheckHeader_(headers, appCheckToken);
|
|
900
|
-
return new NetworkRequest(url, requestInfo.method, headers, requestInfo.body, requestInfo.successCodes, requestInfo.additionalRetryCodes, requestInfo.handler, requestInfo.errorHandler, requestInfo.timeout, requestInfo.progressCallback,
|
|
765
|
+
return new NetworkRequest(url, requestInfo.method, headers, requestInfo.body, requestInfo.successCodes, requestInfo.additionalRetryCodes, requestInfo.handler, requestInfo.errorHandler, requestInfo.timeout, requestInfo.progressCallback, requestFactory);
|
|
901
766
|
}
|
|
902
767
|
|
|
903
768
|
/**
|
|
@@ -2170,6 +2035,117 @@ function async(f) {
|
|
|
2170
2035
|
};
|
|
2171
2036
|
}
|
|
2172
2037
|
|
|
2038
|
+
/**
|
|
2039
|
+
* @license
|
|
2040
|
+
* Copyright 2017 Google LLC
|
|
2041
|
+
*
|
|
2042
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2043
|
+
* you may not use this file except in compliance with the License.
|
|
2044
|
+
* You may obtain a copy of the License at
|
|
2045
|
+
*
|
|
2046
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2047
|
+
*
|
|
2048
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2049
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2050
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2051
|
+
* See the License for the specific language governing permissions and
|
|
2052
|
+
* limitations under the License.
|
|
2053
|
+
*/
|
|
2054
|
+
/** An override for the text-based Connection. Used in tests. */
|
|
2055
|
+
var connectionFactoryOverride = null;
|
|
2056
|
+
/**
|
|
2057
|
+
* Network layer for browsers. We use this instead of goog.net.XhrIo because
|
|
2058
|
+
* goog.net.XhrIo is hyuuuuge and doesn't work in React Native on Android.
|
|
2059
|
+
*/
|
|
2060
|
+
var XhrConnection = /** @class */ (function () {
|
|
2061
|
+
function XhrConnection() {
|
|
2062
|
+
var _this = this;
|
|
2063
|
+
this.sent_ = false;
|
|
2064
|
+
this.xhr_ = new XMLHttpRequest();
|
|
2065
|
+
this.errorCode_ = ErrorCode.NO_ERROR;
|
|
2066
|
+
this.sendPromise_ = new Promise(function (resolve) {
|
|
2067
|
+
_this.xhr_.addEventListener('abort', function () {
|
|
2068
|
+
_this.errorCode_ = ErrorCode.ABORT;
|
|
2069
|
+
resolve();
|
|
2070
|
+
});
|
|
2071
|
+
_this.xhr_.addEventListener('error', function () {
|
|
2072
|
+
_this.errorCode_ = ErrorCode.NETWORK_ERROR;
|
|
2073
|
+
resolve();
|
|
2074
|
+
});
|
|
2075
|
+
_this.xhr_.addEventListener('load', function () {
|
|
2076
|
+
resolve();
|
|
2077
|
+
});
|
|
2078
|
+
});
|
|
2079
|
+
}
|
|
2080
|
+
XhrConnection.prototype.send = function (url, method, body, headers) {
|
|
2081
|
+
if (this.sent_) {
|
|
2082
|
+
throw internalError('cannot .send() more than once');
|
|
2083
|
+
}
|
|
2084
|
+
this.sent_ = true;
|
|
2085
|
+
this.xhr_.open(method, url, true);
|
|
2086
|
+
if (headers !== undefined) {
|
|
2087
|
+
for (var key in headers) {
|
|
2088
|
+
if (headers.hasOwnProperty(key)) {
|
|
2089
|
+
this.xhr_.setRequestHeader(key, headers[key].toString());
|
|
2090
|
+
}
|
|
2091
|
+
}
|
|
2092
|
+
}
|
|
2093
|
+
if (body !== undefined) {
|
|
2094
|
+
this.xhr_.send(body);
|
|
2095
|
+
}
|
|
2096
|
+
else {
|
|
2097
|
+
this.xhr_.send();
|
|
2098
|
+
}
|
|
2099
|
+
return this.sendPromise_;
|
|
2100
|
+
};
|
|
2101
|
+
XhrConnection.prototype.getErrorCode = function () {
|
|
2102
|
+
if (!this.sent_) {
|
|
2103
|
+
throw internalError('cannot .getErrorCode() before sending');
|
|
2104
|
+
}
|
|
2105
|
+
return this.errorCode_;
|
|
2106
|
+
};
|
|
2107
|
+
XhrConnection.prototype.getStatus = function () {
|
|
2108
|
+
if (!this.sent_) {
|
|
2109
|
+
throw internalError('cannot .getStatus() before sending');
|
|
2110
|
+
}
|
|
2111
|
+
try {
|
|
2112
|
+
return this.xhr_.status;
|
|
2113
|
+
}
|
|
2114
|
+
catch (e) {
|
|
2115
|
+
return -1;
|
|
2116
|
+
}
|
|
2117
|
+
};
|
|
2118
|
+
XhrConnection.prototype.getResponseText = function () {
|
|
2119
|
+
if (!this.sent_) {
|
|
2120
|
+
throw internalError('cannot .getResponseText() before sending');
|
|
2121
|
+
}
|
|
2122
|
+
return this.xhr_.responseText;
|
|
2123
|
+
};
|
|
2124
|
+
/** Aborts the request. */
|
|
2125
|
+
XhrConnection.prototype.abort = function () {
|
|
2126
|
+
this.xhr_.abort();
|
|
2127
|
+
};
|
|
2128
|
+
XhrConnection.prototype.getResponseHeader = function (header) {
|
|
2129
|
+
return this.xhr_.getResponseHeader(header);
|
|
2130
|
+
};
|
|
2131
|
+
XhrConnection.prototype.addUploadProgressListener = function (listener) {
|
|
2132
|
+
if (this.xhr_.upload != null) {
|
|
2133
|
+
this.xhr_.upload.addEventListener('progress', listener);
|
|
2134
|
+
}
|
|
2135
|
+
};
|
|
2136
|
+
XhrConnection.prototype.removeUploadProgressListener = function (listener) {
|
|
2137
|
+
if (this.xhr_.upload != null) {
|
|
2138
|
+
this.xhr_.upload.removeEventListener('progress', listener);
|
|
2139
|
+
}
|
|
2140
|
+
};
|
|
2141
|
+
return XhrConnection;
|
|
2142
|
+
}());
|
|
2143
|
+
function newConnection() {
|
|
2144
|
+
return connectionFactoryOverride
|
|
2145
|
+
? connectionFactoryOverride()
|
|
2146
|
+
: new XhrConnection();
|
|
2147
|
+
}
|
|
2148
|
+
|
|
2173
2149
|
/**
|
|
2174
2150
|
* @license
|
|
2175
2151
|
* Copyright 2017 Google LLC
|
|
@@ -2315,7 +2291,7 @@ var UploadTask = /** @class */ (function () {
|
|
|
2315
2291
|
var _this = this;
|
|
2316
2292
|
this._resolveToken(function (authToken, appCheckToken) {
|
|
2317
2293
|
var requestInfo = createResumableUpload(_this._ref.storage, _this._ref._location, _this._mappings, _this._blob, _this._metadata);
|
|
2318
|
-
var createRequest = _this._ref.storage._makeRequest(requestInfo, authToken, appCheckToken);
|
|
2294
|
+
var createRequest = _this._ref.storage._makeRequest(requestInfo, newConnection, authToken, appCheckToken);
|
|
2319
2295
|
_this._request = createRequest;
|
|
2320
2296
|
createRequest.getPromise().then(function (url) {
|
|
2321
2297
|
_this._request = undefined;
|
|
@@ -2331,7 +2307,7 @@ var UploadTask = /** @class */ (function () {
|
|
|
2331
2307
|
var url = this._uploadUrl;
|
|
2332
2308
|
this._resolveToken(function (authToken, appCheckToken) {
|
|
2333
2309
|
var requestInfo = getResumableUploadStatus(_this._ref.storage, _this._ref._location, url, _this._blob);
|
|
2334
|
-
var statusRequest = _this._ref.storage._makeRequest(requestInfo, authToken, appCheckToken);
|
|
2310
|
+
var statusRequest = _this._ref.storage._makeRequest(requestInfo, newConnection, authToken, appCheckToken);
|
|
2335
2311
|
_this._request = statusRequest;
|
|
2336
2312
|
statusRequest.getPromise().then(function (status) {
|
|
2337
2313
|
status = status;
|
|
@@ -2361,7 +2337,7 @@ var UploadTask = /** @class */ (function () {
|
|
|
2361
2337
|
_this._transition("error" /* ERROR */);
|
|
2362
2338
|
return;
|
|
2363
2339
|
}
|
|
2364
|
-
var uploadRequest = _this._ref.storage._makeRequest(requestInfo, authToken, appCheckToken);
|
|
2340
|
+
var uploadRequest = _this._ref.storage._makeRequest(requestInfo, newConnection, authToken, appCheckToken);
|
|
2365
2341
|
_this._request = uploadRequest;
|
|
2366
2342
|
uploadRequest.getPromise().then(function (newStatus) {
|
|
2367
2343
|
_this._increaseMultiplier();
|
|
@@ -2388,7 +2364,7 @@ var UploadTask = /** @class */ (function () {
|
|
|
2388
2364
|
var _this = this;
|
|
2389
2365
|
this._resolveToken(function (authToken, appCheckToken) {
|
|
2390
2366
|
var requestInfo = getMetadata$2(_this._ref.storage, _this._ref._location, _this._mappings);
|
|
2391
|
-
var metadataRequest = _this._ref.storage._makeRequest(requestInfo, authToken, appCheckToken);
|
|
2367
|
+
var metadataRequest = _this._ref.storage._makeRequest(requestInfo, newConnection, authToken, appCheckToken);
|
|
2392
2368
|
_this._request = metadataRequest;
|
|
2393
2369
|
metadataRequest.getPromise().then(function (metadata) {
|
|
2394
2370
|
_this._request = undefined;
|
|
@@ -2401,7 +2377,7 @@ var UploadTask = /** @class */ (function () {
|
|
|
2401
2377
|
var _this = this;
|
|
2402
2378
|
this._resolveToken(function (authToken, appCheckToken) {
|
|
2403
2379
|
var requestInfo = multipartUpload(_this._ref.storage, _this._ref._location, _this._mappings, _this._blob, _this._metadata);
|
|
2404
|
-
var multipartRequest = _this._ref.storage._makeRequest(requestInfo, authToken, appCheckToken);
|
|
2380
|
+
var multipartRequest = _this._ref.storage._makeRequest(requestInfo, newConnection, authToken, appCheckToken);
|
|
2405
2381
|
_this._request = multipartRequest;
|
|
2406
2382
|
multipartRequest.getPromise().then(function (metadata) {
|
|
2407
2383
|
_this._request = undefined;
|
|
@@ -2811,8 +2787,7 @@ function uploadBytes$1(ref, data, metadata) {
|
|
|
2811
2787
|
ref._throwIfRoot('uploadBytes');
|
|
2812
2788
|
var requestInfo = multipartUpload(ref.storage, ref._location, getMappings(), new FbsBlob(data, true), metadata);
|
|
2813
2789
|
return ref.storage
|
|
2814
|
-
.makeRequestWithTokens(requestInfo)
|
|
2815
|
-
.then(function (request) { return request.getPromise(); })
|
|
2790
|
+
.makeRequestWithTokens(requestInfo, newConnection)
|
|
2816
2791
|
.then(function (finalMetadata) {
|
|
2817
2792
|
return {
|
|
2818
2793
|
metadata: finalMetadata,
|
|
@@ -2934,26 +2909,17 @@ function listAllHelper(ref, accumulator, pageToken) {
|
|
|
2934
2909
|
* can be used to get the rest of the results.
|
|
2935
2910
|
*/
|
|
2936
2911
|
function list$1(ref, options) {
|
|
2937
|
-
|
|
2938
|
-
|
|
2939
|
-
|
|
2940
|
-
|
|
2941
|
-
|
|
2942
|
-
|
|
2943
|
-
|
|
2944
|
-
|
|
2945
|
-
|
|
2946
|
-
|
|
2947
|
-
|
|
2948
|
-
}
|
|
2949
|
-
op = options || {};
|
|
2950
|
-
requestInfo = list$2(ref.storage, ref._location,
|
|
2951
|
-
/*delimiter= */ '/', op.pageToken, op.maxResults);
|
|
2952
|
-
return [4 /*yield*/, ref.storage.makeRequestWithTokens(requestInfo)];
|
|
2953
|
-
case 1: return [2 /*return*/, (_a.sent()).getPromise()];
|
|
2954
|
-
}
|
|
2955
|
-
});
|
|
2956
|
-
});
|
|
2912
|
+
if (options != null) {
|
|
2913
|
+
if (typeof options.maxResults === 'number') {
|
|
2914
|
+
validateNumber('options.maxResults',
|
|
2915
|
+
/* minValue= */ 1,
|
|
2916
|
+
/* maxValue= */ 1000, options.maxResults);
|
|
2917
|
+
}
|
|
2918
|
+
}
|
|
2919
|
+
var op = options || {};
|
|
2920
|
+
var requestInfo = list$2(ref.storage, ref._location,
|
|
2921
|
+
/*delimiter= */ '/', op.pageToken, op.maxResults);
|
|
2922
|
+
return ref.storage.makeRequestWithTokens(requestInfo, newConnection);
|
|
2957
2923
|
}
|
|
2958
2924
|
/**
|
|
2959
2925
|
* A `Promise` that resolves with the metadata for this object. If this
|
|
@@ -2963,18 +2929,9 @@ function list$1(ref, options) {
|
|
|
2963
2929
|
* @param ref - StorageReference to get metadata from.
|
|
2964
2930
|
*/
|
|
2965
2931
|
function getMetadata$1(ref) {
|
|
2966
|
-
|
|
2967
|
-
|
|
2968
|
-
|
|
2969
|
-
switch (_a.label) {
|
|
2970
|
-
case 0:
|
|
2971
|
-
ref._throwIfRoot('getMetadata');
|
|
2972
|
-
requestInfo = getMetadata$2(ref.storage, ref._location, getMappings());
|
|
2973
|
-
return [4 /*yield*/, ref.storage.makeRequestWithTokens(requestInfo)];
|
|
2974
|
-
case 1: return [2 /*return*/, (_a.sent()).getPromise()];
|
|
2975
|
-
}
|
|
2976
|
-
});
|
|
2977
|
-
});
|
|
2932
|
+
ref._throwIfRoot('getMetadata');
|
|
2933
|
+
var requestInfo = getMetadata$2(ref.storage, ref._location, getMappings());
|
|
2934
|
+
return ref.storage.makeRequestWithTokens(requestInfo, newConnection);
|
|
2978
2935
|
}
|
|
2979
2936
|
/**
|
|
2980
2937
|
* Updates the metadata for this object.
|
|
@@ -2988,18 +2945,9 @@ function getMetadata$1(ref) {
|
|
|
2988
2945
|
* See `firebaseStorage.Reference.prototype.getMetadata`
|
|
2989
2946
|
*/
|
|
2990
2947
|
function updateMetadata$1(ref, metadata) {
|
|
2991
|
-
|
|
2992
|
-
|
|
2993
|
-
|
|
2994
|
-
switch (_a.label) {
|
|
2995
|
-
case 0:
|
|
2996
|
-
ref._throwIfRoot('updateMetadata');
|
|
2997
|
-
requestInfo = updateMetadata$2(ref.storage, ref._location, metadata, getMappings());
|
|
2998
|
-
return [4 /*yield*/, ref.storage.makeRequestWithTokens(requestInfo)];
|
|
2999
|
-
case 1: return [2 /*return*/, (_a.sent()).getPromise()];
|
|
3000
|
-
}
|
|
3001
|
-
});
|
|
3002
|
-
});
|
|
2948
|
+
ref._throwIfRoot('updateMetadata');
|
|
2949
|
+
var requestInfo = updateMetadata$2(ref.storage, ref._location, metadata, getMappings());
|
|
2950
|
+
return ref.storage.makeRequestWithTokens(requestInfo, newConnection);
|
|
3003
2951
|
}
|
|
3004
2952
|
/**
|
|
3005
2953
|
* Returns the download URL for the given Reference.
|
|
@@ -3008,24 +2956,15 @@ function updateMetadata$1(ref, metadata) {
|
|
|
3008
2956
|
* URL for this object.
|
|
3009
2957
|
*/
|
|
3010
2958
|
function getDownloadURL$1(ref) {
|
|
3011
|
-
|
|
3012
|
-
|
|
3013
|
-
|
|
3014
|
-
|
|
3015
|
-
|
|
3016
|
-
|
|
3017
|
-
|
|
3018
|
-
|
|
3019
|
-
|
|
3020
|
-
.getPromise()
|
|
3021
|
-
.then(function (url) {
|
|
3022
|
-
if (url === null) {
|
|
3023
|
-
throw noDownloadURL();
|
|
3024
|
-
}
|
|
3025
|
-
return url;
|
|
3026
|
-
})];
|
|
3027
|
-
}
|
|
3028
|
-
});
|
|
2959
|
+
ref._throwIfRoot('getDownloadURL');
|
|
2960
|
+
var requestInfo = getDownloadUrl(ref.storage, ref._location, getMappings());
|
|
2961
|
+
return ref.storage
|
|
2962
|
+
.makeRequestWithTokens(requestInfo, newConnection)
|
|
2963
|
+
.then(function (url) {
|
|
2964
|
+
if (url === null) {
|
|
2965
|
+
throw noDownloadURL();
|
|
2966
|
+
}
|
|
2967
|
+
return url;
|
|
3029
2968
|
});
|
|
3030
2969
|
}
|
|
3031
2970
|
/**
|
|
@@ -3035,18 +2974,9 @@ function getDownloadURL$1(ref) {
|
|
|
3035
2974
|
* @returns A `Promise` that resolves if the deletion succeeds.
|
|
3036
2975
|
*/
|
|
3037
2976
|
function deleteObject$1(ref) {
|
|
3038
|
-
|
|
3039
|
-
|
|
3040
|
-
|
|
3041
|
-
switch (_a.label) {
|
|
3042
|
-
case 0:
|
|
3043
|
-
ref._throwIfRoot('deleteObject');
|
|
3044
|
-
requestInfo = deleteObject$2(ref.storage, ref._location);
|
|
3045
|
-
return [4 /*yield*/, ref.storage.makeRequestWithTokens(requestInfo)];
|
|
3046
|
-
case 1: return [2 /*return*/, (_a.sent()).getPromise()];
|
|
3047
|
-
}
|
|
3048
|
-
});
|
|
3049
|
-
});
|
|
2977
|
+
ref._throwIfRoot('deleteObject');
|
|
2978
|
+
var requestInfo = deleteObject$2(ref.storage, ref._location);
|
|
2979
|
+
return ref.storage.makeRequestWithTokens(requestInfo, newConnection);
|
|
3050
2980
|
}
|
|
3051
2981
|
/**
|
|
3052
2982
|
* Returns reference for object obtained by appending `childPath` to `ref`.
|
|
@@ -3168,11 +3098,10 @@ var FirebaseStorageImpl = /** @class */ (function () {
|
|
|
3168
3098
|
/**
|
|
3169
3099
|
* @internal
|
|
3170
3100
|
*/
|
|
3171
|
-
|
|
3101
|
+
_url, _firebaseVersion) {
|
|
3172
3102
|
this.app = app;
|
|
3173
3103
|
this._authProvider = _authProvider;
|
|
3174
3104
|
this._appCheckProvider = _appCheckProvider;
|
|
3175
|
-
this._pool = _pool;
|
|
3176
3105
|
this._url = _url;
|
|
3177
3106
|
this._firebaseVersion = _firebaseVersion;
|
|
3178
3107
|
this._bucket = null;
|
|
@@ -3314,10 +3243,10 @@ var FirebaseStorageImpl = /** @class */ (function () {
|
|
|
3314
3243
|
* @param requestInfo - HTTP RequestInfo object
|
|
3315
3244
|
* @param authToken - Firebase auth token
|
|
3316
3245
|
*/
|
|
3317
|
-
FirebaseStorageImpl.prototype._makeRequest = function (requestInfo, authToken, appCheckToken) {
|
|
3246
|
+
FirebaseStorageImpl.prototype._makeRequest = function (requestInfo, requestFactory, authToken, appCheckToken) {
|
|
3318
3247
|
var _this = this;
|
|
3319
3248
|
if (!this._deleted) {
|
|
3320
|
-
var request_1 = makeRequest(requestInfo, this._appId, authToken, appCheckToken,
|
|
3249
|
+
var request_1 = makeRequest(requestInfo, this._appId, authToken, appCheckToken, requestFactory, this._firebaseVersion);
|
|
3321
3250
|
this._requests.add(request_1);
|
|
3322
3251
|
// Request removes itself from set when complete.
|
|
3323
3252
|
request_1.getPromise().then(function () { return _this._requests.delete(request_1); }, function () { return _this._requests.delete(request_1); });
|
|
@@ -3327,7 +3256,7 @@ var FirebaseStorageImpl = /** @class */ (function () {
|
|
|
3327
3256
|
return new FailRequest(appDeleted());
|
|
3328
3257
|
}
|
|
3329
3258
|
};
|
|
3330
|
-
FirebaseStorageImpl.prototype.makeRequestWithTokens = function (requestInfo) {
|
|
3259
|
+
FirebaseStorageImpl.prototype.makeRequestWithTokens = function (requestInfo, requestFactory) {
|
|
3331
3260
|
return __awaiter(this, void 0, void 0, function () {
|
|
3332
3261
|
var _a, authToken, appCheckToken;
|
|
3333
3262
|
return __generator(this, function (_b) {
|
|
@@ -3338,7 +3267,7 @@ var FirebaseStorageImpl = /** @class */ (function () {
|
|
|
3338
3267
|
])];
|
|
3339
3268
|
case 1:
|
|
3340
3269
|
_a = _b.sent(), authToken = _a[0], appCheckToken = _a[1];
|
|
3341
|
-
return [2 /*return*/, this._makeRequest(requestInfo, authToken, appCheckToken)];
|
|
3270
|
+
return [2 /*return*/, this._makeRequest(requestInfo, requestFactory, authToken, appCheckToken).getPromise()];
|
|
3342
3271
|
}
|
|
3343
3272
|
});
|
|
3344
3273
|
});
|
|
@@ -3347,7 +3276,7 @@ var FirebaseStorageImpl = /** @class */ (function () {
|
|
|
3347
3276
|
}());
|
|
3348
3277
|
|
|
3349
3278
|
var name = "@firebase/storage";
|
|
3350
|
-
var version = "0.8.4-
|
|
3279
|
+
var version = "0.8.4-canary.dfed7f83f";
|
|
3351
3280
|
|
|
3352
3281
|
/**
|
|
3353
3282
|
* @license
|
|
@@ -3572,7 +3501,7 @@ function factory(container, _a) {
|
|
|
3572
3501
|
var app = container.getProvider('app').getImmediate();
|
|
3573
3502
|
var authProvider = container.getProvider('auth-internal');
|
|
3574
3503
|
var appCheckProvider = container.getProvider('app-check-internal');
|
|
3575
|
-
return new FirebaseStorageImpl(app, authProvider, appCheckProvider,
|
|
3504
|
+
return new FirebaseStorageImpl(app, authProvider, appCheckProvider, url, SDK_VERSION);
|
|
3576
3505
|
}
|
|
3577
3506
|
function registerStorage() {
|
|
3578
3507
|
_registerComponent(new Component(STORAGE_TYPE, factory, "PUBLIC" /* PUBLIC */).setMultipleInstances(true));
|