@firebase/storage 0.13.7-canary.0cbff6bc7 → 0.13.7-canary.0e1276649
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 +16 -9
- package/dist/index.browser.cjs.js.map +1 -1
- package/dist/index.cjs.js +16 -9
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm2017.js +17 -10
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.node.cjs.js +27 -20
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/node-esm/index.node.esm.js +28 -21
- package/dist/node-esm/index.node.esm.js.map +1 -1
- package/dist/node-esm/src/implementation/connection.d.ts +1 -1
- package/dist/node-esm/src/implementation/request.d.ts +1 -1
- package/dist/node-esm/src/platform/browser/connection.d.ts +1 -1
- package/dist/node-esm/src/platform/node/connection.d.ts +2 -2
- package/dist/node-esm/src/service.d.ts +2 -1
- package/dist/node-esm/test/unit/connection.d.ts +1 -1
- package/dist/src/implementation/connection.d.ts +1 -1
- package/dist/src/implementation/request.d.ts +1 -1
- package/dist/src/platform/browser/connection.d.ts +1 -1
- package/dist/src/platform/node/connection.d.ts +2 -2
- package/dist/src/service.d.ts +2 -1
- package/dist/storage.d.ts +3 -2
- package/dist/test/unit/connection.d.ts +1 -1
- package/package.json +6 -6
|
@@ -661,7 +661,7 @@ function isRetryStatusCode(status, additionalRetryCodes) {
|
|
|
661
661
|
* happens in the specified `callback_`.
|
|
662
662
|
*/
|
|
663
663
|
class NetworkRequest {
|
|
664
|
-
constructor(url_, method_, headers_, body_, successCodes_, additionalRetryCodes_, callback_, errorCallback_, timeout_, progressCallback_, connectionFactory_, retry = true) {
|
|
664
|
+
constructor(url_, method_, headers_, body_, successCodes_, additionalRetryCodes_, callback_, errorCallback_, timeout_, progressCallback_, connectionFactory_, retry = true, isUsingEmulator = false) {
|
|
665
665
|
this.url_ = url_;
|
|
666
666
|
this.method_ = method_;
|
|
667
667
|
this.headers_ = headers_;
|
|
@@ -674,6 +674,7 @@ class NetworkRequest {
|
|
|
674
674
|
this.progressCallback_ = progressCallback_;
|
|
675
675
|
this.connectionFactory_ = connectionFactory_;
|
|
676
676
|
this.retry = retry;
|
|
677
|
+
this.isUsingEmulator = isUsingEmulator;
|
|
677
678
|
this.pendingConnection_ = null;
|
|
678
679
|
this.backoffId_ = null;
|
|
679
680
|
this.canceled_ = false;
|
|
@@ -708,7 +709,7 @@ class NetworkRequest {
|
|
|
708
709
|
// connection.send() never rejects, so we don't need to have a error handler or use catch on the returned promise.
|
|
709
710
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
710
711
|
connection
|
|
711
|
-
.send(this.url_, this.method_, this.body_, this.headers_)
|
|
712
|
+
.send(this.url_, this.method_, this.isUsingEmulator, this.body_, this.headers_)
|
|
712
713
|
.then(() => {
|
|
713
714
|
if (this.progressCallback_ !== null) {
|
|
714
715
|
connection.removeUploadProgressListener(progressListener);
|
|
@@ -825,7 +826,7 @@ function addAppCheckHeader_(headers, appCheckToken) {
|
|
|
825
826
|
headers['X-Firebase-AppCheck'] = appCheckToken;
|
|
826
827
|
}
|
|
827
828
|
}
|
|
828
|
-
function makeRequest(requestInfo, appId, authToken, appCheckToken, requestFactory, firebaseVersion, retry = true) {
|
|
829
|
+
function makeRequest(requestInfo, appId, authToken, appCheckToken, requestFactory, firebaseVersion, retry = true, isUsingEmulator = false) {
|
|
829
830
|
const queryPart = makeQueryString(requestInfo.urlParams);
|
|
830
831
|
const url = requestInfo.url + queryPart;
|
|
831
832
|
const headers = Object.assign({}, requestInfo.headers);
|
|
@@ -833,7 +834,7 @@ function makeRequest(requestInfo, appId, authToken, appCheckToken, requestFactor
|
|
|
833
834
|
addAuthHeader_(headers, authToken);
|
|
834
835
|
addVersionHeader_(headers, firebaseVersion);
|
|
835
836
|
addAppCheckHeader_(headers, appCheckToken);
|
|
836
|
-
return new NetworkRequest(url, requestInfo.method, headers, requestInfo.body, requestInfo.successCodes, requestInfo.additionalRetryCodes, requestInfo.handler, requestInfo.errorHandler, requestInfo.timeout, requestInfo.progressCallback, requestFactory, retry);
|
|
837
|
+
return new NetworkRequest(url, requestInfo.method, headers, requestInfo.body, requestInfo.successCodes, requestInfo.additionalRetryCodes, requestInfo.handler, requestInfo.errorHandler, requestInfo.timeout, requestInfo.progressCallback, requestFactory, retry, isUsingEmulator);
|
|
837
838
|
}
|
|
838
839
|
|
|
839
840
|
/**
|
|
@@ -2162,10 +2163,13 @@ class XhrConnection {
|
|
|
2162
2163
|
});
|
|
2163
2164
|
});
|
|
2164
2165
|
}
|
|
2165
|
-
send(url, method, body, headers) {
|
|
2166
|
+
send(url, method, isUsingEmulator, body, headers) {
|
|
2166
2167
|
if (this.sent_) {
|
|
2167
2168
|
throw internalError('cannot .send() more than once');
|
|
2168
2169
|
}
|
|
2170
|
+
if (util.isCloudWorkstation(url) && isUsingEmulator) {
|
|
2171
|
+
this.xhr_.withCredentials = true;
|
|
2172
|
+
}
|
|
2169
2173
|
this.sent_ = true;
|
|
2170
2174
|
this.xhr_.open(method, url, true);
|
|
2171
2175
|
if (headers !== undefined) {
|
|
@@ -3170,7 +3174,9 @@ function extractBucket(host, config) {
|
|
|
3170
3174
|
}
|
|
3171
3175
|
function connectStorageEmulator$1(storage, host, port, options = {}) {
|
|
3172
3176
|
storage.host = `${host}:${port}`;
|
|
3173
|
-
|
|
3177
|
+
const useSsl = util.isCloudWorkstation(host);
|
|
3178
|
+
storage._isUsingEmulator = true;
|
|
3179
|
+
storage._protocol = useSsl ? 'https' : 'http';
|
|
3174
3180
|
const { mockUserToken } = options;
|
|
3175
3181
|
if (mockUserToken) {
|
|
3176
3182
|
storage._overrideAuthToken =
|
|
@@ -3198,12 +3204,13 @@ class FirebaseStorageImpl {
|
|
|
3198
3204
|
/**
|
|
3199
3205
|
* @internal
|
|
3200
3206
|
*/
|
|
3201
|
-
_url, _firebaseVersion) {
|
|
3207
|
+
_url, _firebaseVersion, _isUsingEmulator = false) {
|
|
3202
3208
|
this.app = app;
|
|
3203
3209
|
this._authProvider = _authProvider;
|
|
3204
3210
|
this._appCheckProvider = _appCheckProvider;
|
|
3205
3211
|
this._url = _url;
|
|
3206
3212
|
this._firebaseVersion = _firebaseVersion;
|
|
3213
|
+
this._isUsingEmulator = _isUsingEmulator;
|
|
3207
3214
|
this._bucket = null;
|
|
3208
3215
|
/**
|
|
3209
3216
|
* This string can be in the formats:
|
|
@@ -3317,7 +3324,7 @@ class FirebaseStorageImpl {
|
|
|
3317
3324
|
*/
|
|
3318
3325
|
_makeRequest(requestInfo, requestFactory, authToken, appCheckToken, retry = true) {
|
|
3319
3326
|
if (!this._deleted) {
|
|
3320
|
-
const request = makeRequest(requestInfo, this._appId, authToken, appCheckToken, requestFactory, this._firebaseVersion, retry);
|
|
3327
|
+
const request = makeRequest(requestInfo, this._appId, authToken, appCheckToken, requestFactory, this._firebaseVersion, retry, this._isUsingEmulator);
|
|
3321
3328
|
this._requests.add(request);
|
|
3322
3329
|
// Request removes itself from set when complete.
|
|
3323
3330
|
request.getPromise().then(() => this._requests.delete(request), () => this._requests.delete(request));
|
|
@@ -3337,7 +3344,7 @@ class FirebaseStorageImpl {
|
|
|
3337
3344
|
}
|
|
3338
3345
|
|
|
3339
3346
|
const name = "@firebase/storage";
|
|
3340
|
-
const version = "0.13.7-canary.
|
|
3347
|
+
const version = "0.13.7-canary.0e1276649";
|
|
3341
3348
|
|
|
3342
3349
|
/**
|
|
3343
3350
|
* @license
|