@firebase/storage 0.8.3-canary.85d2c4d29 → 0.8.3-canary.88ea06930

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.cjs.js CHANGED
@@ -226,7 +226,7 @@ function internalError(message) {
226
226
  * limitations under the License.
227
227
  */
228
228
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
229
- const fetch = nodeFetch__default['default'];
229
+ const fetch = nodeFetch__default["default"];
230
230
  /**
231
231
  * Network layer that works in Node.
232
232
  *
@@ -669,22 +669,22 @@ function makeQueryString(params) {
669
669
  * limitations under the License.
670
670
  */
671
671
  class NetworkRequest {
672
- constructor(url, method, headers, body, successCodes, additionalRetryCodes, callback, errorCallback, timeout, progressCallback, pool) {
672
+ constructor(url_, method_, headers_, body_, successCodes_, additionalRetryCodes_, callback_, errorCallback_, timeout_, progressCallback_, pool_) {
673
+ this.url_ = url_;
674
+ this.method_ = method_;
675
+ this.headers_ = headers_;
676
+ this.body_ = body_;
677
+ this.successCodes_ = successCodes_;
678
+ this.additionalRetryCodes_ = additionalRetryCodes_;
679
+ this.callback_ = callback_;
680
+ this.errorCallback_ = errorCallback_;
681
+ this.timeout_ = timeout_;
682
+ this.progressCallback_ = progressCallback_;
683
+ this.pool_ = pool_;
673
684
  this.pendingConnection_ = null;
674
685
  this.backoffId_ = null;
675
686
  this.canceled_ = false;
676
687
  this.appDelete_ = false;
677
- this.url_ = url;
678
- this.method_ = method;
679
- this.headers_ = headers;
680
- this.body_ = body;
681
- this.successCodes_ = successCodes.slice();
682
- this.additionalRetryCodes_ = additionalRetryCodes.slice();
683
- this.callback_ = callback;
684
- this.errorCallback_ = errorCallback;
685
- this.progressCallback_ = progressCallback;
686
- this.timeout_ = timeout;
687
- this.pool_ = pool;
688
688
  this.promise_ = new Promise((resolve, reject) => {
689
689
  this.resolve_ = resolve;
690
690
  this.reject_ = reject;
@@ -695,54 +695,55 @@ class NetworkRequest {
695
695
  * Actually starts the retry loop.
696
696
  */
697
697
  start_() {
698
- const self = this;
699
- function doTheRequest(backoffCallback, canceled) {
698
+ const doTheRequest = (backoffCallback, canceled) => {
700
699
  if (canceled) {
701
700
  backoffCallback(false, new RequestEndStatus(false, null, true));
702
701
  return;
703
702
  }
704
- const connection = self.pool_.createConnection();
705
- self.pendingConnection_ = connection;
706
- function progressListener(progressEvent) {
703
+ const connection = this.pool_.createConnection();
704
+ this.pendingConnection_ = connection;
705
+ const progressListener = progressEvent => {
707
706
  const loaded = progressEvent.loaded;
708
- const total = progressEvent.lengthComputable ? progressEvent.total : -1;
709
- if (self.progressCallback_ !== null) {
710
- self.progressCallback_(loaded, total);
707
+ const total = progressEvent.lengthComputable
708
+ ? progressEvent.total
709
+ : -1;
710
+ if (this.progressCallback_ !== null) {
711
+ this.progressCallback_(loaded, total);
711
712
  }
712
- }
713
- if (self.progressCallback_ !== null) {
713
+ };
714
+ if (this.progressCallback_ !== null) {
714
715
  connection.addUploadProgressListener(progressListener);
715
716
  }
716
717
  // eslint-disable-next-line @typescript-eslint/no-floating-promises
717
718
  connection
718
- .send(self.url_, self.method_, self.body_, self.headers_)
719
+ .send(this.url_, this.method_, this.body_, this.headers_)
719
720
  .then(() => {
720
- if (self.progressCallback_ !== null) {
721
+ if (this.progressCallback_ !== null) {
721
722
  connection.removeUploadProgressListener(progressListener);
722
723
  }
723
- self.pendingConnection_ = null;
724
+ this.pendingConnection_ = null;
724
725
  const hitServer = connection.getErrorCode() === ErrorCode.NO_ERROR;
725
726
  const status = connection.getStatus();
726
- if (!hitServer || self.isRetryStatusCode_(status)) {
727
+ if (!hitServer || this.isRetryStatusCode_(status)) {
727
728
  const wasCanceled = connection.getErrorCode() === ErrorCode.ABORT;
728
729
  backoffCallback(false, new RequestEndStatus(false, null, wasCanceled));
729
730
  return;
730
731
  }
731
- const successCode = self.successCodes_.indexOf(status) !== -1;
732
+ const successCode = this.successCodes_.indexOf(status) !== -1;
732
733
  backoffCallback(true, new RequestEndStatus(successCode, connection));
733
734
  });
734
- }
735
+ };
735
736
  /**
736
737
  * @param requestWentThrough - True if the request eventually went
737
738
  * through, false if it hit the retry limit or was canceled.
738
739
  */
739
- function backoffDone(requestWentThrough, status) {
740
- const resolve = self.resolve_;
741
- const reject = self.reject_;
740
+ const backoffDone = (requestWentThrough, status) => {
741
+ const resolve = this.resolve_;
742
+ const reject = this.reject_;
742
743
  const connection = status.connection;
743
744
  if (status.wasSuccessCode) {
744
745
  try {
745
- const result = self.callback_(connection, connection.getResponseText());
746
+ const result = this.callback_(connection, connection.getResponseText());
746
747
  if (isJustDef(result)) {
747
748
  resolve(result);
748
749
  }
@@ -758,8 +759,8 @@ class NetworkRequest {
758
759
  if (connection !== null) {
759
760
  const err = unknown();
760
761
  err.serverResponse = connection.getResponseText();
761
- if (self.errorCallback_) {
762
- reject(self.errorCallback_(connection, err));
762
+ if (this.errorCallback_) {
763
+ reject(this.errorCallback_(connection, err));
763
764
  }
764
765
  else {
765
766
  reject(err);
@@ -767,7 +768,7 @@ class NetworkRequest {
767
768
  }
768
769
  else {
769
770
  if (status.canceled) {
770
- const err = self.appDelete_ ? appDeleted() : canceled();
771
+ const err = this.appDelete_ ? appDeleted() : canceled();
771
772
  reject(err);
772
773
  }
773
774
  else {
@@ -776,7 +777,7 @@ class NetworkRequest {
776
777
  }
777
778
  }
778
779
  }
779
- }
780
+ };
780
781
  if (this.canceled_) {
781
782
  backoffDone(false, new RequestEndStatus(false, null, true));
782
783
  }
@@ -3141,7 +3142,7 @@ class FirebaseStorageImpl {
3141
3142
  }
3142
3143
 
3143
3144
  const name = "@firebase/storage";
3144
- const version = "0.8.3-canary.85d2c4d29";
3145
+ const version = "0.8.3-canary.88ea06930";
3145
3146
 
3146
3147
  /**
3147
3148
  * @license