@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.
@@ -20,6 +20,7 @@ import { Reference } from './reference';
20
20
  import { EmulatorMockTokenOptions } from '@firebase/util';
21
21
  import { StringFormat } from './implementation/string';
22
22
  export { EmulatorMockTokenOptions } from '@firebase/util';
23
+ export { StorageError, StorageErrorCode } from './implementation/error';
23
24
  /**
24
25
  * Public types.
25
26
  */
@@ -52,7 +52,7 @@ export declare const errors: {};
52
52
  * @public
53
53
  * Error codes that can be attached to `StorageError`s.
54
54
  */
55
- export declare const enum StorageErrorCode {
55
+ export declare enum StorageErrorCode {
56
56
  UNKNOWN = "unknown",
57
57
  OBJECT_NOT_FOUND = "object-not-found",
58
58
  BUCKET_NOT_FOUND = "bucket-not-found",
@@ -15,7 +15,8 @@
15
15
  * limitations under the License.
16
16
  */
17
17
  import { FirebaseApp, _FirebaseService } from '@firebase/app';
18
- import { CompleteFn, FirebaseError, NextFn, Subscribe, Unsubscribe } from '@firebase/util';
18
+ import { CompleteFn, NextFn, Subscribe, Unsubscribe } from '@firebase/util';
19
+ import { StorageError } from './implementation/error';
19
20
  /**
20
21
  * A Firebase Storage instance.
21
22
  * @public
@@ -215,16 +216,6 @@ export declare type TaskEvent = 'state_changed';
215
216
  * @public
216
217
  */
217
218
  export declare type TaskState = 'running' | 'paused' | 'success' | 'canceled' | 'error';
218
- /**
219
- * An error returned by the Firebase Storage SDK.
220
- * @public
221
- */
222
- export interface StorageError extends FirebaseError {
223
- /**
224
- * A server response message for the error, if applicable.
225
- */
226
- serverResponse: string | null;
227
- }
228
219
  /**
229
220
  * A stream observer for Firebase Storage.
230
221
  * @public
package/dist/src/api.d.ts CHANGED
@@ -20,6 +20,7 @@ import { Reference } from './reference';
20
20
  import { EmulatorMockTokenOptions } from '@firebase/util';
21
21
  import { StringFormat } from './implementation/string';
22
22
  export { EmulatorMockTokenOptions } from '@firebase/util';
23
+ export { StorageError, StorageErrorCode } from './implementation/error';
23
24
  /**
24
25
  * Public types.
25
26
  */
@@ -52,7 +52,7 @@ export declare const errors: {};
52
52
  * @public
53
53
  * Error codes that can be attached to `StorageError`s.
54
54
  */
55
- export declare const enum StorageErrorCode {
55
+ export declare enum StorageErrorCode {
56
56
  UNKNOWN = "unknown",
57
57
  OBJECT_NOT_FOUND = "object-not-found",
58
58
  BUCKET_NOT_FOUND = "bucket-not-found",
@@ -15,7 +15,8 @@
15
15
  * limitations under the License.
16
16
  */
17
17
  import { FirebaseApp, _FirebaseService } from '@firebase/app';
18
- import { CompleteFn, FirebaseError, NextFn, Subscribe, Unsubscribe } from '@firebase/util';
18
+ import { CompleteFn, NextFn, Subscribe, Unsubscribe } from '@firebase/util';
19
+ import { StorageError } from './implementation/error';
19
20
  /**
20
21
  * A Firebase Storage instance.
21
22
  * @public
@@ -215,16 +216,6 @@ export declare type TaskEvent = 'state_changed';
215
216
  * @public
216
217
  */
217
218
  export declare type TaskState = 'running' | 'paused' | 'success' | 'canceled' | 'error';
218
- /**
219
- * An error returned by the Firebase Storage SDK.
220
- * @public
221
- */
222
- export interface StorageError extends FirebaseError {
223
- /**
224
- * A server response message for the error, if applicable.
225
- */
226
- serverResponse: string | null;
227
- }
228
219
  /**
229
220
  * A stream observer for Firebase Storage.
230
221
  * @public
@@ -307,11 +307,59 @@ export declare interface SettableMetadata {
307
307
  * An error returned by the Firebase Storage SDK.
308
308
  * @public
309
309
  */
310
- export declare interface StorageError extends FirebaseError {
310
+ export declare class StorageError extends FirebaseError {
311
+ private status_;
311
312
  /**
312
- * A server response message for the error, if applicable.
313
+ * Stores custom error data unque to StorageError.
313
314
  */
314
- serverResponse: string | null;
315
+ customData: {
316
+ serverResponse: string | null;
317
+ };
318
+ /**
319
+ * @param code - A StorageErrorCode string to be prefixed with 'storage/' and
320
+ * added to the end of the message.
321
+ * @param message - Error message.
322
+ * @param status_ - Corresponding HTTP Status Code
323
+ */
324
+ constructor(code: StorageErrorCode, message: string, status_?: number);
325
+ get status(): number;
326
+ set status(status: number);
327
+ /**
328
+ * Optional response message that was added by the server.
329
+ */
330
+ get serverResponse(): null | string;
331
+ set serverResponse(serverResponse: string | null);
332
+ }
333
+ /**
334
+ * @public
335
+ * Error codes that can be attached to `StorageError`s.
336
+ */
337
+ export declare enum StorageErrorCode {
338
+ UNKNOWN = "unknown",
339
+ OBJECT_NOT_FOUND = "object-not-found",
340
+ BUCKET_NOT_FOUND = "bucket-not-found",
341
+ PROJECT_NOT_FOUND = "project-not-found",
342
+ QUOTA_EXCEEDED = "quota-exceeded",
343
+ UNAUTHENTICATED = "unauthenticated",
344
+ UNAUTHORIZED = "unauthorized",
345
+ UNAUTHORIZED_APP = "unauthorized-app",
346
+ RETRY_LIMIT_EXCEEDED = "retry-limit-exceeded",
347
+ INVALID_CHECKSUM = "invalid-checksum",
348
+ CANCELED = "canceled",
349
+ INVALID_EVENT_NAME = "invalid-event-name",
350
+ INVALID_URL = "invalid-url",
351
+ INVALID_DEFAULT_BUCKET = "invalid-default-bucket",
352
+ NO_DEFAULT_BUCKET = "no-default-bucket",
353
+ CANNOT_SLICE_BLOB = "cannot-slice-blob",
354
+ SERVER_FILE_WRONG_SIZE = "server-file-wrong-size",
355
+ NO_DOWNLOAD_URL = "no-download-url",
356
+ INVALID_ARGUMENT = "invalid-argument",
357
+ INVALID_ARGUMENT_COUNT = "invalid-argument-count",
358
+ APP_DELETED = "app-deleted",
359
+ INVALID_ROOT_OPERATION = "invalid-root-operation",
360
+ INVALID_FORMAT = "invalid-format",
361
+ INTERNAL_ERROR = "internal-error",
362
+ UNSUPPORTED_ENVIRONMENT = "unsupported-environment"
315
363
  }
316
364
  /**
317
365
  * A stream observer for Firebase Storage.
package/dist/storage.d.ts CHANGED
@@ -95,10 +95,10 @@ declare enum ErrorCode {
95
95
  * A function that is called with a `StorageError`
96
96
  * if the event stream ends due to an error.
97
97
  */
98
- declare type ErrorFn = (error: StorageError_2) => void;
98
+ declare type ErrorFn = (error: StorageError) => void;
99
99
 
100
100
  /** A function to handle an error. */
101
- declare type ErrorHandler = (connection: Connection<ConnectionType>, response: StorageError_2) => StorageError_2;
101
+ declare type ErrorHandler = (connection: Connection<ConnectionType>, response: StorageError) => StorageError;
102
102
 
103
103
  /**
104
104
  * @license
@@ -406,14 +406,14 @@ declare const enum InternalTaskState {
406
406
  /**
407
407
  * @internal
408
408
  */
409
- export declare function _invalidArgument(message: string): StorageError_2;
409
+ export declare function _invalidArgument(message: string): StorageError;
410
410
 
411
411
  /**
412
412
  * @param name - The name of the operation that was invalid.
413
413
  *
414
414
  * @internal
415
415
  */
416
- export declare function _invalidRootOperation(name: string): StorageError_2;
416
+ export declare function _invalidRootOperation(name: string): StorageError;
417
417
 
418
418
  /**
419
419
  * List items (files) and prefixes (folders) under this storage reference.
@@ -721,18 +721,7 @@ export declare interface SettableMetadata {
721
721
  * An error returned by the Firebase Storage SDK.
722
722
  * @public
723
723
  */
724
- export declare interface StorageError extends FirebaseError {
725
- /**
726
- * A server response message for the error, if applicable.
727
- */
728
- serverResponse: string | null;
729
- }
730
-
731
- /**
732
- * An error returned by the Firebase Storage SDK.
733
- * @public
734
- */
735
- declare class StorageError_2 extends FirebaseError {
724
+ export declare class StorageError extends FirebaseError {
736
725
  private status_;
737
726
  private readonly _baseMessage;
738
727
  /**
@@ -765,7 +754,7 @@ declare class StorageError_2 extends FirebaseError {
765
754
  * @public
766
755
  * Error codes that can be attached to `StorageError`s.
767
756
  */
768
- declare const enum StorageErrorCode {
757
+ export declare enum StorageErrorCode {
769
758
  UNKNOWN = "unknown",
770
759
  OBJECT_NOT_FOUND = "object-not-found",
771
760
  BUCKET_NOT_FOUND = "bucket-not-found",
@@ -1320,18 +1309,18 @@ export declare class _UploadTask {
1320
1309
  * argument is passed, returns a function you can call to unregister the
1321
1310
  * callbacks.
1322
1311
  */
1323
- on(type: _TaskEvent, nextOrObserver?: StorageObserver<UploadTaskSnapshot> | null | ((snapshot: UploadTaskSnapshot) => unknown), error?: ((a: StorageError_2) => unknown) | null, completed?: CompleteFn | null): Unsubscribe_2 | Subscribe_2<UploadTaskSnapshot>;
1312
+ on(type: _TaskEvent, nextOrObserver?: StorageObserver<UploadTaskSnapshot> | null | ((snapshot: UploadTaskSnapshot) => unknown), error?: ((a: StorageError) => unknown) | null, completed?: CompleteFn | null): Unsubscribe_2 | Subscribe_2<UploadTaskSnapshot>;
1324
1313
  /**
1325
1314
  * This object behaves like a Promise, and resolves with its snapshot data
1326
1315
  * when the upload completes.
1327
1316
  * @param onFulfilled - The fulfillment callback. Promise chaining works as normal.
1328
1317
  * @param onRejected - The rejection callback.
1329
1318
  */
1330
- then<U>(onFulfilled?: ((value: UploadTaskSnapshot) => U | Promise<U>) | null, onRejected?: ((error: StorageError_2) => U | Promise<U>) | null): Promise<U>;
1319
+ then<U>(onFulfilled?: ((value: UploadTaskSnapshot) => U | Promise<U>) | null, onRejected?: ((error: StorageError) => U | Promise<U>) | null): Promise<U>;
1331
1320
  /**
1332
1321
  * Equivalent to calling `then(null, onRejected)`.
1333
1322
  */
1334
- catch<T>(onRejected: (p1: StorageError_2) => T | Promise<T>): Promise<T>;
1323
+ catch<T>(onRejected: (p1: StorageError) => T | Promise<T>): Promise<T>;
1335
1324
  /**
1336
1325
  * Adds the given observer.
1337
1326
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@firebase/storage",
3
- "version": "0.10.1",
3
+ "version": "0.11.0-20230201003102",
4
4
  "description": "",
5
5
  "author": "Firebase <firebase-support@google.com> (https://firebase.google.com/)",
6
6
  "main": "dist/index.node.cjs.js",
@@ -15,7 +15,11 @@
15
15
  "default": "./dist/index.node.cjs.js"
16
16
  },
17
17
  "esm5": "./dist/index.esm5.js",
18
- "default": "./dist/index.esm2017.js"
18
+ "default": "./dist/index.esm2017.js",
19
+ "browser": {
20
+ "require": "./dist/index.cjs.js",
21
+ "import": "./dist/index.esm2017.js"
22
+ }
19
23
  },
20
24
  "./package.json": "./package.json"
21
25
  },
@@ -42,17 +46,17 @@
42
46
  },
43
47
  "license": "Apache-2.0",
44
48
  "dependencies": {
45
- "@firebase/util": "1.9.0",
46
- "@firebase/component": "0.6.1",
49
+ "@firebase/util": "1.9.1-20230201003102",
50
+ "@firebase/component": "0.6.2-20230201003102",
47
51
  "node-fetch": "2.6.7",
48
52
  "tslib": "^2.1.0"
49
53
  },
50
54
  "peerDependencies": {
51
- "@firebase/app": "0.x"
55
+ "@firebase/app": "0.9.2-20230201003102"
52
56
  },
53
57
  "devDependencies": {
54
- "@firebase/app": "0.9.1",
55
- "@firebase/auth": "0.21.1",
58
+ "@firebase/app": "0.9.2-20230201003102",
59
+ "@firebase/auth": "0.21.2-20230201003102",
56
60
  "rollup": "2.79.1",
57
61
  "@rollup/plugin-alias": "3.1.9",
58
62
  "@rollup/plugin-json": "4.1.0",