@firebase/storage 0.10.1 → 0.11.0-20230201003102

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.
@@ -115,19 +115,53 @@ class StorageError extends FirebaseError {
115
115
  }
116
116
  }
117
117
  }
118
+ /**
119
+ * @public
120
+ * Error codes that can be attached to `StorageError`s.
121
+ */
122
+ var StorageErrorCode;
123
+ (function (StorageErrorCode) {
124
+ // Shared between all platforms
125
+ StorageErrorCode["UNKNOWN"] = "unknown";
126
+ StorageErrorCode["OBJECT_NOT_FOUND"] = "object-not-found";
127
+ StorageErrorCode["BUCKET_NOT_FOUND"] = "bucket-not-found";
128
+ StorageErrorCode["PROJECT_NOT_FOUND"] = "project-not-found";
129
+ StorageErrorCode["QUOTA_EXCEEDED"] = "quota-exceeded";
130
+ StorageErrorCode["UNAUTHENTICATED"] = "unauthenticated";
131
+ StorageErrorCode["UNAUTHORIZED"] = "unauthorized";
132
+ StorageErrorCode["UNAUTHORIZED_APP"] = "unauthorized-app";
133
+ StorageErrorCode["RETRY_LIMIT_EXCEEDED"] = "retry-limit-exceeded";
134
+ StorageErrorCode["INVALID_CHECKSUM"] = "invalid-checksum";
135
+ StorageErrorCode["CANCELED"] = "canceled";
136
+ // JS specific
137
+ StorageErrorCode["INVALID_EVENT_NAME"] = "invalid-event-name";
138
+ StorageErrorCode["INVALID_URL"] = "invalid-url";
139
+ StorageErrorCode["INVALID_DEFAULT_BUCKET"] = "invalid-default-bucket";
140
+ StorageErrorCode["NO_DEFAULT_BUCKET"] = "no-default-bucket";
141
+ StorageErrorCode["CANNOT_SLICE_BLOB"] = "cannot-slice-blob";
142
+ StorageErrorCode["SERVER_FILE_WRONG_SIZE"] = "server-file-wrong-size";
143
+ StorageErrorCode["NO_DOWNLOAD_URL"] = "no-download-url";
144
+ StorageErrorCode["INVALID_ARGUMENT"] = "invalid-argument";
145
+ StorageErrorCode["INVALID_ARGUMENT_COUNT"] = "invalid-argument-count";
146
+ StorageErrorCode["APP_DELETED"] = "app-deleted";
147
+ StorageErrorCode["INVALID_ROOT_OPERATION"] = "invalid-root-operation";
148
+ StorageErrorCode["INVALID_FORMAT"] = "invalid-format";
149
+ StorageErrorCode["INTERNAL_ERROR"] = "internal-error";
150
+ StorageErrorCode["UNSUPPORTED_ENVIRONMENT"] = "unsupported-environment";
151
+ })(StorageErrorCode || (StorageErrorCode = {}));
118
152
  function prependCode(code) {
119
153
  return 'storage/' + code;
120
154
  }
121
155
  function unknown() {
122
156
  const message = 'An unknown error occurred, please check the error payload for ' +
123
157
  'server response.';
124
- return new StorageError("unknown" /* StorageErrorCode.UNKNOWN */, message);
158
+ return new StorageError(StorageErrorCode.UNKNOWN, message);
125
159
  }
126
160
  function objectNotFound(path) {
127
- return new StorageError("object-not-found" /* StorageErrorCode.OBJECT_NOT_FOUND */, "Object '" + path + "' does not exist.");
161
+ return new StorageError(StorageErrorCode.OBJECT_NOT_FOUND, "Object '" + path + "' does not exist.");
128
162
  }
129
163
  function quotaExceeded(bucket) {
130
- return new StorageError("quota-exceeded" /* StorageErrorCode.QUOTA_EXCEEDED */, "Quota for bucket '" +
164
+ return new StorageError(StorageErrorCode.QUOTA_EXCEEDED, "Quota for bucket '" +
131
165
  bucket +
132
166
  "' exceeded, please view quota on " +
133
167
  'https://firebase.google.com/pricing/.');
@@ -135,49 +169,49 @@ function quotaExceeded(bucket) {
135
169
  function unauthenticated() {
136
170
  const message = 'User is not authenticated, please authenticate using Firebase ' +
137
171
  'Authentication and try again.';
138
- return new StorageError("unauthenticated" /* StorageErrorCode.UNAUTHENTICATED */, message);
172
+ return new StorageError(StorageErrorCode.UNAUTHENTICATED, message);
139
173
  }
140
174
  function unauthorizedApp() {
141
- return new StorageError("unauthorized-app" /* StorageErrorCode.UNAUTHORIZED_APP */, 'This app does not have permission to access Firebase Storage on this project.');
175
+ return new StorageError(StorageErrorCode.UNAUTHORIZED_APP, 'This app does not have permission to access Firebase Storage on this project.');
142
176
  }
143
177
  function unauthorized(path) {
144
- return new StorageError("unauthorized" /* StorageErrorCode.UNAUTHORIZED */, "User does not have permission to access '" + path + "'.");
178
+ return new StorageError(StorageErrorCode.UNAUTHORIZED, "User does not have permission to access '" + path + "'.");
145
179
  }
146
180
  function retryLimitExceeded() {
147
- return new StorageError("retry-limit-exceeded" /* StorageErrorCode.RETRY_LIMIT_EXCEEDED */, 'Max retry time for operation exceeded, please try again.');
181
+ return new StorageError(StorageErrorCode.RETRY_LIMIT_EXCEEDED, 'Max retry time for operation exceeded, please try again.');
148
182
  }
149
183
  function canceled() {
150
- return new StorageError("canceled" /* StorageErrorCode.CANCELED */, 'User canceled the upload/download.');
184
+ return new StorageError(StorageErrorCode.CANCELED, 'User canceled the upload/download.');
151
185
  }
152
186
  function invalidUrl(url) {
153
- return new StorageError("invalid-url" /* StorageErrorCode.INVALID_URL */, "Invalid URL '" + url + "'.");
187
+ return new StorageError(StorageErrorCode.INVALID_URL, "Invalid URL '" + url + "'.");
154
188
  }
155
189
  function invalidDefaultBucket(bucket) {
156
- return new StorageError("invalid-default-bucket" /* StorageErrorCode.INVALID_DEFAULT_BUCKET */, "Invalid default bucket '" + bucket + "'.");
190
+ return new StorageError(StorageErrorCode.INVALID_DEFAULT_BUCKET, "Invalid default bucket '" + bucket + "'.");
157
191
  }
158
192
  function noDefaultBucket() {
159
- return new StorageError("no-default-bucket" /* StorageErrorCode.NO_DEFAULT_BUCKET */, 'No default bucket ' +
193
+ return new StorageError(StorageErrorCode.NO_DEFAULT_BUCKET, 'No default bucket ' +
160
194
  "found. Did you set the '" +
161
195
  CONFIG_STORAGE_BUCKET_KEY +
162
196
  "' property when initializing the app?");
163
197
  }
164
198
  function cannotSliceBlob() {
165
- return new StorageError("cannot-slice-blob" /* StorageErrorCode.CANNOT_SLICE_BLOB */, 'Cannot slice blob for upload. Please retry the upload.');
199
+ return new StorageError(StorageErrorCode.CANNOT_SLICE_BLOB, 'Cannot slice blob for upload. Please retry the upload.');
166
200
  }
167
201
  function serverFileWrongSize() {
168
- return new StorageError("server-file-wrong-size" /* StorageErrorCode.SERVER_FILE_WRONG_SIZE */, 'Server recorded incorrect upload file size, please retry the upload.');
202
+ return new StorageError(StorageErrorCode.SERVER_FILE_WRONG_SIZE, 'Server recorded incorrect upload file size, please retry the upload.');
169
203
  }
170
204
  function noDownloadURL() {
171
- return new StorageError("no-download-url" /* StorageErrorCode.NO_DOWNLOAD_URL */, 'The given file does not have any download URLs.');
205
+ return new StorageError(StorageErrorCode.NO_DOWNLOAD_URL, 'The given file does not have any download URLs.');
172
206
  }
173
207
  /**
174
208
  * @internal
175
209
  */
176
210
  function invalidArgument(message) {
177
- return new StorageError("invalid-argument" /* StorageErrorCode.INVALID_ARGUMENT */, message);
211
+ return new StorageError(StorageErrorCode.INVALID_ARGUMENT, message);
178
212
  }
179
213
  function appDeleted() {
180
- return new StorageError("app-deleted" /* StorageErrorCode.APP_DELETED */, 'The Firebase app was deleted.');
214
+ return new StorageError(StorageErrorCode.APP_DELETED, 'The Firebase app was deleted.');
181
215
  }
182
216
  /**
183
217
  * @param name - The name of the operation that was invalid.
@@ -185,7 +219,7 @@ function appDeleted() {
185
219
  * @internal
186
220
  */
187
221
  function invalidRootOperation(name) {
188
- return new StorageError("invalid-root-operation" /* StorageErrorCode.INVALID_ROOT_OPERATION */, "The operation '" +
222
+ return new StorageError(StorageErrorCode.INVALID_ROOT_OPERATION, "The operation '" +
189
223
  name +
190
224
  "' cannot be performed on a root reference, create a non-root " +
191
225
  "reference using child, such as .child('file.png').");
@@ -195,13 +229,13 @@ function invalidRootOperation(name) {
195
229
  * @param message - A message describing the format violation.
196
230
  */
197
231
  function invalidFormat(format, message) {
198
- return new StorageError("invalid-format" /* StorageErrorCode.INVALID_FORMAT */, "String does not match format '" + format + "': " + message);
232
+ return new StorageError(StorageErrorCode.INVALID_FORMAT, "String does not match format '" + format + "': " + message);
199
233
  }
200
234
  /**
201
235
  * @param message - A message describing the internal error.
202
236
  */
203
237
  function internalError(message) {
204
- throw new StorageError("internal-error" /* StorageErrorCode.INTERNAL_ERROR */, 'Internal error: ' + message);
238
+ throw new StorageError(StorageErrorCode.INTERNAL_ERROR, 'Internal error: ' + message);
205
239
  }
206
240
 
207
241
  /**
@@ -862,7 +896,7 @@ function getBlob$1(...args) {
862
896
  return new Blob(args);
863
897
  }
864
898
  else {
865
- throw new StorageError("unsupported-environment" /* StorageErrorCode.UNSUPPORTED_ENVIRONMENT */, "This browser doesn't seem to support creating Blobs");
899
+ throw new StorageError(StorageErrorCode.UNSUPPORTED_ENVIRONMENT, "This browser doesn't seem to support creating Blobs");
866
900
  }
867
901
  }
868
902
  }
@@ -2299,7 +2333,7 @@ class UploadTask {
2299
2333
  this._errorHandler = error => {
2300
2334
  this._request = undefined;
2301
2335
  this._chunkMultiplier = 1;
2302
- if (error._codeEquals("canceled" /* StorageErrorCode.CANCELED */)) {
2336
+ if (error._codeEquals(StorageErrorCode.CANCELED)) {
2303
2337
  this._needToFetchStatus = true;
2304
2338
  this.completeTransitions_();
2305
2339
  }
@@ -2322,7 +2356,7 @@ class UploadTask {
2322
2356
  };
2323
2357
  this._metadataErrorHandler = error => {
2324
2358
  this._request = undefined;
2325
- if (error._codeEquals("canceled" /* StorageErrorCode.CANCELED */)) {
2359
+ if (error._codeEquals(StorageErrorCode.CANCELED)) {
2326
2360
  this.completeTransitions_();
2327
2361
  }
2328
2362
  else {
@@ -3345,7 +3379,7 @@ class FirebaseStorageImpl {
3345
3379
  }
3346
3380
 
3347
3381
  const name = "@firebase/storage";
3348
- const version = "0.10.1";
3382
+ const version = "0.11.0-20230201003102";
3349
3383
 
3350
3384
  /**
3351
3385
  * @license
@@ -3650,5 +3684,5 @@ function registerStorage() {
3650
3684
  }
3651
3685
  registerStorage();
3652
3686
 
3653
- export { StringFormat, FbsBlob as _FbsBlob, Location as _Location, TaskEvent as _TaskEvent, TaskState as _TaskState, UploadTask as _UploadTask, dataFromString as _dataFromString, _getChild, invalidArgument as _invalidArgument, invalidRootOperation as _invalidRootOperation, connectStorageEmulator, deleteObject, getBlob, getBytes, getDownloadURL, getMetadata, getStorage, getStream, list, listAll, ref, updateMetadata, uploadBytes, uploadBytesResumable, uploadString };
3687
+ export { StorageError, StorageErrorCode, StringFormat, FbsBlob as _FbsBlob, Location as _Location, TaskEvent as _TaskEvent, TaskState as _TaskState, UploadTask as _UploadTask, dataFromString as _dataFromString, _getChild, invalidArgument as _invalidArgument, invalidRootOperation as _invalidRootOperation, connectStorageEmulator, deleteObject, getBlob, getBytes, getDownloadURL, getMetadata, getStorage, getStream, list, listAll, ref, updateMetadata, uploadBytes, uploadBytesResumable, uploadString };
3654
3688
  //# sourceMappingURL=index.node.esm.js.map