@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.
@@ -239,9 +239,6 @@ class XhrConnection {
239
239
  });
240
240
  });
241
241
  }
242
- /**
243
- * @override
244
- */
245
242
  send(url, method, body, headers) {
246
243
  if (this.sent_) {
247
244
  throw internalError('cannot .send() more than once');
@@ -263,18 +260,12 @@ class XhrConnection {
263
260
  }
264
261
  return this.sendPromise_;
265
262
  }
266
- /**
267
- * @override
268
- */
269
263
  getErrorCode() {
270
264
  if (!this.sent_) {
271
265
  throw internalError('cannot .getErrorCode() before sending');
272
266
  }
273
267
  return this.errorCode_;
274
268
  }
275
- /**
276
- * @override
277
- */
278
269
  getStatus() {
279
270
  if (!this.sent_) {
280
271
  throw internalError('cannot .getStatus() before sending');
@@ -286,39 +277,24 @@ class XhrConnection {
286
277
  return -1;
287
278
  }
288
279
  }
289
- /**
290
- * @override
291
- */
292
280
  getResponseText() {
293
281
  if (!this.sent_) {
294
282
  throw internalError('cannot .getResponseText() before sending');
295
283
  }
296
284
  return this.xhr_.responseText;
297
285
  }
298
- /**
299
- * Aborts the request.
300
- * @override
301
- */
286
+ /** Aborts the request. */
302
287
  abort() {
303
288
  this.xhr_.abort();
304
289
  }
305
- /**
306
- * @override
307
- */
308
290
  getResponseHeader(header) {
309
291
  return this.xhr_.getResponseHeader(header);
310
292
  }
311
- /**
312
- * @override
313
- */
314
293
  addUploadProgressListener(listener) {
315
294
  if (this.xhr_.upload != null) {
316
295
  this.xhr_.upload.addEventListener('progress', listener);
317
296
  }
318
297
  }
319
- /**
320
- * @override
321
- */
322
298
  removeUploadProgressListener(listener) {
323
299
  if (this.xhr_.upload != null) {
324
300
  this.xhr_.upload.removeEventListener('progress', listener);
@@ -700,22 +676,22 @@ function makeQueryString(params) {
700
676
  * limitations under the License.
701
677
  */
702
678
  class NetworkRequest {
703
- constructor(url, method, headers, body, successCodes, additionalRetryCodes, callback, errorCallback, timeout, progressCallback, pool) {
679
+ constructor(url_, method_, headers_, body_, successCodes_, additionalRetryCodes_, callback_, errorCallback_, timeout_, progressCallback_, pool_) {
680
+ this.url_ = url_;
681
+ this.method_ = method_;
682
+ this.headers_ = headers_;
683
+ this.body_ = body_;
684
+ this.successCodes_ = successCodes_;
685
+ this.additionalRetryCodes_ = additionalRetryCodes_;
686
+ this.callback_ = callback_;
687
+ this.errorCallback_ = errorCallback_;
688
+ this.timeout_ = timeout_;
689
+ this.progressCallback_ = progressCallback_;
690
+ this.pool_ = pool_;
704
691
  this.pendingConnection_ = null;
705
692
  this.backoffId_ = null;
706
693
  this.canceled_ = false;
707
694
  this.appDelete_ = false;
708
- this.url_ = url;
709
- this.method_ = method;
710
- this.headers_ = headers;
711
- this.body_ = body;
712
- this.successCodes_ = successCodes.slice();
713
- this.additionalRetryCodes_ = additionalRetryCodes.slice();
714
- this.callback_ = callback;
715
- this.errorCallback_ = errorCallback;
716
- this.progressCallback_ = progressCallback;
717
- this.timeout_ = timeout;
718
- this.pool_ = pool;
719
695
  this.promise_ = new Promise((resolve, reject) => {
720
696
  this.resolve_ = resolve;
721
697
  this.reject_ = reject;
@@ -726,54 +702,55 @@ class NetworkRequest {
726
702
  * Actually starts the retry loop.
727
703
  */
728
704
  start_() {
729
- const self = this;
730
- function doTheRequest(backoffCallback, canceled) {
705
+ const doTheRequest = (backoffCallback, canceled) => {
731
706
  if (canceled) {
732
707
  backoffCallback(false, new RequestEndStatus(false, null, true));
733
708
  return;
734
709
  }
735
- const connection = self.pool_.createConnection();
736
- self.pendingConnection_ = connection;
737
- function progressListener(progressEvent) {
710
+ const connection = this.pool_.createConnection();
711
+ this.pendingConnection_ = connection;
712
+ const progressListener = progressEvent => {
738
713
  const loaded = progressEvent.loaded;
739
- const total = progressEvent.lengthComputable ? progressEvent.total : -1;
740
- if (self.progressCallback_ !== null) {
741
- self.progressCallback_(loaded, total);
714
+ const total = progressEvent.lengthComputable
715
+ ? progressEvent.total
716
+ : -1;
717
+ if (this.progressCallback_ !== null) {
718
+ this.progressCallback_(loaded, total);
742
719
  }
743
- }
744
- if (self.progressCallback_ !== null) {
720
+ };
721
+ if (this.progressCallback_ !== null) {
745
722
  connection.addUploadProgressListener(progressListener);
746
723
  }
747
724
  // eslint-disable-next-line @typescript-eslint/no-floating-promises
748
725
  connection
749
- .send(self.url_, self.method_, self.body_, self.headers_)
726
+ .send(this.url_, this.method_, this.body_, this.headers_)
750
727
  .then(() => {
751
- if (self.progressCallback_ !== null) {
728
+ if (this.progressCallback_ !== null) {
752
729
  connection.removeUploadProgressListener(progressListener);
753
730
  }
754
- self.pendingConnection_ = null;
731
+ this.pendingConnection_ = null;
755
732
  const hitServer = connection.getErrorCode() === ErrorCode.NO_ERROR;
756
733
  const status = connection.getStatus();
757
- if (!hitServer || self.isRetryStatusCode_(status)) {
734
+ if (!hitServer || this.isRetryStatusCode_(status)) {
758
735
  const wasCanceled = connection.getErrorCode() === ErrorCode.ABORT;
759
736
  backoffCallback(false, new RequestEndStatus(false, null, wasCanceled));
760
737
  return;
761
738
  }
762
- const successCode = self.successCodes_.indexOf(status) !== -1;
739
+ const successCode = this.successCodes_.indexOf(status) !== -1;
763
740
  backoffCallback(true, new RequestEndStatus(successCode, connection));
764
741
  });
765
- }
742
+ };
766
743
  /**
767
744
  * @param requestWentThrough - True if the request eventually went
768
745
  * through, false if it hit the retry limit or was canceled.
769
746
  */
770
- function backoffDone(requestWentThrough, status) {
771
- const resolve = self.resolve_;
772
- const reject = self.reject_;
747
+ const backoffDone = (requestWentThrough, status) => {
748
+ const resolve = this.resolve_;
749
+ const reject = this.reject_;
773
750
  const connection = status.connection;
774
751
  if (status.wasSuccessCode) {
775
752
  try {
776
- const result = self.callback_(connection, connection.getResponseText());
753
+ const result = this.callback_(connection, connection.getResponseText());
777
754
  if (isJustDef(result)) {
778
755
  resolve(result);
779
756
  }
@@ -789,8 +766,8 @@ class NetworkRequest {
789
766
  if (connection !== null) {
790
767
  const err = unknown();
791
768
  err.serverResponse = connection.getResponseText();
792
- if (self.errorCallback_) {
793
- reject(self.errorCallback_(connection, err));
769
+ if (this.errorCallback_) {
770
+ reject(this.errorCallback_(connection, err));
794
771
  }
795
772
  else {
796
773
  reject(err);
@@ -798,7 +775,7 @@ class NetworkRequest {
798
775
  }
799
776
  else {
800
777
  if (status.canceled) {
801
- const err = self.appDelete_ ? appDeleted() : canceled();
778
+ const err = this.appDelete_ ? appDeleted() : canceled();
802
779
  reject(err);
803
780
  }
804
781
  else {
@@ -807,7 +784,7 @@ class NetworkRequest {
807
784
  }
808
785
  }
809
786
  }
810
- }
787
+ };
811
788
  if (this.canceled_) {
812
789
  backoffDone(false, new RequestEndStatus(false, null, true));
813
790
  }
@@ -3167,7 +3144,7 @@ class FirebaseStorageImpl {
3167
3144
  }
3168
3145
 
3169
3146
  const name = "@firebase/storage";
3170
- const version = "0.8.3-canary.85d2c4d29";
3147
+ const version = "0.8.3-canary.88ea06930";
3171
3148
 
3172
3149
  /**
3173
3150
  * @license