@firebase/storage 0.13.7-auth-redirect-credentials.b424e5897 → 0.13.7-canary.080a90dcc

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.
@@ -1,5 +1,5 @@
1
1
  import { _isFirebaseServerApp, _getProvider, getApp, _registerComponent, registerVersion, SDK_VERSION } from '@firebase/app';
2
- import { FirebaseError, isCloudWorkstation, createMockUserToken, getModularInstance, getDefaultEmulatorHostnameAndPort } from '@firebase/util';
2
+ import { FirebaseError, isCloudWorkstation, pingServer, createMockUserToken, getModularInstance, getDefaultEmulatorHostnameAndPort } from '@firebase/util';
3
3
  import { Component } from '@firebase/component';
4
4
 
5
5
  /**
@@ -702,7 +702,7 @@ class NetworkRequest {
702
702
  // connection.send() never rejects, so we don't need to have a error handler or use catch on the returned promise.
703
703
  // eslint-disable-next-line @typescript-eslint/no-floating-promises
704
704
  connection
705
- .send(this.url_, this.method_, this.body_, this.headers_, this.isUsingEmulator)
705
+ .send(this.url_, this.method_, this.isUsingEmulator, this.body_, this.headers_)
706
706
  .then(() => {
707
707
  if (this.progressCallback_ !== null) {
708
708
  connection.removeUploadProgressListener(progressListener);
@@ -2146,13 +2146,13 @@ class FetchConnection {
2146
2146
  this.sent_ = false;
2147
2147
  this.errorCode_ = ErrorCode.NO_ERROR;
2148
2148
  }
2149
- async send(url, method, body, headers, isUsingEmulator) {
2149
+ async send(url, method, isUsingEmulator, body, headers) {
2150
2150
  if (this.sent_) {
2151
2151
  throw internalError('cannot .send() more than once');
2152
2152
  }
2153
2153
  this.sent_ = true;
2154
2154
  try {
2155
- const response = await newFetch(url, method, headers, body, isUsingEmulator);
2155
+ const response = await newFetch(url, method, isUsingEmulator, headers, body);
2156
2156
  this.headers_ = response.headers;
2157
2157
  this.statusCode_ = response.status;
2158
2158
  this.errorCode_ = ErrorCode.NO_ERROR;
@@ -2225,13 +2225,13 @@ class FetchStreamConnection extends FetchConnection {
2225
2225
  super(...arguments);
2226
2226
  this.stream_ = null;
2227
2227
  }
2228
- async send(url, method, body, headers) {
2228
+ async send(url, method, isUsingEmulator, body, headers) {
2229
2229
  if (this.sent_) {
2230
2230
  throw internalError('cannot .send() more than once');
2231
2231
  }
2232
2232
  this.sent_ = true;
2233
2233
  try {
2234
- const response = await newFetch(url, method, headers, body);
2234
+ const response = await newFetch(url, method, isUsingEmulator, headers, body);
2235
2235
  this.headers_ = response.headers;
2236
2236
  this.statusCode_ = response.status;
2237
2237
  this.errorCode_ = ErrorCode.NO_ERROR;
@@ -2251,7 +2251,7 @@ class FetchStreamConnection extends FetchConnection {
2251
2251
  return this.stream_;
2252
2252
  }
2253
2253
  }
2254
- function newFetch(url, method, headers, body, isUsingEmulator) {
2254
+ function newFetch(url, method, isUsingEmulator, headers, body) {
2255
2255
  const fetchArgs = {
2256
2256
  method,
2257
2257
  headers: headers || {},
@@ -3197,7 +3197,13 @@ function extractBucket(host, config) {
3197
3197
  }
3198
3198
  function connectStorageEmulator$1(storage, host, port, options = {}) {
3199
3199
  storage.host = `${host}:${port}`;
3200
- storage._protocol = 'http';
3200
+ const useSsl = isCloudWorkstation(host);
3201
+ // Workaround to get cookies in Firebase Studio
3202
+ if (useSsl) {
3203
+ void pingServer(`https://${storage.host}`);
3204
+ }
3205
+ storage._isUsingEmulator = true;
3206
+ storage._protocol = useSsl ? 'https' : 'http';
3201
3207
  const { mockUserToken } = options;
3202
3208
  if (mockUserToken) {
3203
3209
  storage._overrideAuthToken =
@@ -3365,7 +3371,7 @@ class FirebaseStorageImpl {
3365
3371
  }
3366
3372
 
3367
3373
  const name = "@firebase/storage";
3368
- const version = "0.13.7-auth-redirect-credentials.b424e5897";
3374
+ const version = "0.13.7-canary.080a90dcc";
3369
3375
 
3370
3376
  /**
3371
3377
  * @license