@firebase/storage 0.10.1 → 0.11.0-20230131204242
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/CHANGELOG.md +15 -0
- package/dist/index.browser.cjs.js +59 -24
- package/dist/index.browser.cjs.js.map +1 -1
- package/dist/index.cjs.js +3688 -0
- package/dist/index.cjs.js.map +1 -0
- package/dist/index.esm2017.js +59 -25
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.esm5.js +59 -25
- package/dist/index.esm5.js.map +1 -1
- package/dist/index.node.cjs.js +58 -23
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/node-esm/index.node.esm.js +58 -24
- package/dist/node-esm/index.node.esm.js.map +1 -1
- package/dist/node-esm/src/api.d.ts +1 -0
- package/dist/node-esm/src/implementation/error.d.ts +1 -1
- package/dist/node-esm/src/public-types.d.ts +2 -11
- package/dist/src/api.d.ts +1 -0
- package/dist/src/implementation/error.d.ts +1 -1
- package/dist/src/public-types.d.ts +2 -11
- package/dist/storage-public.d.ts +51 -3
- package/dist/storage.d.ts +9 -20
- package/package.json +11 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
#Unreleased
|
|
2
2
|
|
|
3
|
+
## 0.11.0-20230131204242
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`825e648b8`](https://github.com/firebase/firebase-js-sdk/commit/825e648b81ca63c7bc64f8700f7a46eb320b2106) [#6974](https://github.com/firebase/firebase-js-sdk/pull/6974) (fixes [#6944](https://github.com/firebase/firebase-js-sdk/issues/6944)) - Fixed issue where users were unable to check if an Error was an instance of `StorageError`.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- [`0bab0b7a7`](https://github.com/firebase/firebase-js-sdk/commit/0bab0b7a786d1563bf665904c7097d1fe06efce5) [#6981](https://github.com/firebase/firebase-js-sdk/pull/6981) - Added browser CJS entry points (expected by Jest when using JSDOM mode).
|
|
12
|
+
|
|
13
|
+
- Updated dependencies [[`0bab0b7a7`](https://github.com/firebase/firebase-js-sdk/commit/0bab0b7a786d1563bf665904c7097d1fe06efce5)]:
|
|
14
|
+
- @firebase/util@1.9.1-20230131204242
|
|
15
|
+
- @firebase/app@0.9.2-20230131204242
|
|
16
|
+
- @firebase/component@0.6.2-20230131204242
|
|
17
|
+
|
|
3
18
|
## 0.10.1
|
|
4
19
|
|
|
5
20
|
### Patch Changes
|
|
@@ -130,19 +130,53 @@ var StorageError = /** @class */ (function (_super) {
|
|
|
130
130
|
});
|
|
131
131
|
return StorageError;
|
|
132
132
|
}(util.FirebaseError));
|
|
133
|
+
/**
|
|
134
|
+
* @public
|
|
135
|
+
* Error codes that can be attached to `StorageError`s.
|
|
136
|
+
*/
|
|
137
|
+
exports.StorageErrorCode = void 0;
|
|
138
|
+
(function (StorageErrorCode) {
|
|
139
|
+
// Shared between all platforms
|
|
140
|
+
StorageErrorCode["UNKNOWN"] = "unknown";
|
|
141
|
+
StorageErrorCode["OBJECT_NOT_FOUND"] = "object-not-found";
|
|
142
|
+
StorageErrorCode["BUCKET_NOT_FOUND"] = "bucket-not-found";
|
|
143
|
+
StorageErrorCode["PROJECT_NOT_FOUND"] = "project-not-found";
|
|
144
|
+
StorageErrorCode["QUOTA_EXCEEDED"] = "quota-exceeded";
|
|
145
|
+
StorageErrorCode["UNAUTHENTICATED"] = "unauthenticated";
|
|
146
|
+
StorageErrorCode["UNAUTHORIZED"] = "unauthorized";
|
|
147
|
+
StorageErrorCode["UNAUTHORIZED_APP"] = "unauthorized-app";
|
|
148
|
+
StorageErrorCode["RETRY_LIMIT_EXCEEDED"] = "retry-limit-exceeded";
|
|
149
|
+
StorageErrorCode["INVALID_CHECKSUM"] = "invalid-checksum";
|
|
150
|
+
StorageErrorCode["CANCELED"] = "canceled";
|
|
151
|
+
// JS specific
|
|
152
|
+
StorageErrorCode["INVALID_EVENT_NAME"] = "invalid-event-name";
|
|
153
|
+
StorageErrorCode["INVALID_URL"] = "invalid-url";
|
|
154
|
+
StorageErrorCode["INVALID_DEFAULT_BUCKET"] = "invalid-default-bucket";
|
|
155
|
+
StorageErrorCode["NO_DEFAULT_BUCKET"] = "no-default-bucket";
|
|
156
|
+
StorageErrorCode["CANNOT_SLICE_BLOB"] = "cannot-slice-blob";
|
|
157
|
+
StorageErrorCode["SERVER_FILE_WRONG_SIZE"] = "server-file-wrong-size";
|
|
158
|
+
StorageErrorCode["NO_DOWNLOAD_URL"] = "no-download-url";
|
|
159
|
+
StorageErrorCode["INVALID_ARGUMENT"] = "invalid-argument";
|
|
160
|
+
StorageErrorCode["INVALID_ARGUMENT_COUNT"] = "invalid-argument-count";
|
|
161
|
+
StorageErrorCode["APP_DELETED"] = "app-deleted";
|
|
162
|
+
StorageErrorCode["INVALID_ROOT_OPERATION"] = "invalid-root-operation";
|
|
163
|
+
StorageErrorCode["INVALID_FORMAT"] = "invalid-format";
|
|
164
|
+
StorageErrorCode["INTERNAL_ERROR"] = "internal-error";
|
|
165
|
+
StorageErrorCode["UNSUPPORTED_ENVIRONMENT"] = "unsupported-environment";
|
|
166
|
+
})(exports.StorageErrorCode || (exports.StorageErrorCode = {}));
|
|
133
167
|
function prependCode(code) {
|
|
134
168
|
return 'storage/' + code;
|
|
135
169
|
}
|
|
136
170
|
function unknown() {
|
|
137
171
|
var message = 'An unknown error occurred, please check the error payload for ' +
|
|
138
172
|
'server response.';
|
|
139
|
-
return new StorageError(
|
|
173
|
+
return new StorageError(exports.StorageErrorCode.UNKNOWN, message);
|
|
140
174
|
}
|
|
141
175
|
function objectNotFound(path) {
|
|
142
|
-
return new StorageError(
|
|
176
|
+
return new StorageError(exports.StorageErrorCode.OBJECT_NOT_FOUND, "Object '" + path + "' does not exist.");
|
|
143
177
|
}
|
|
144
178
|
function quotaExceeded(bucket) {
|
|
145
|
-
return new StorageError(
|
|
179
|
+
return new StorageError(exports.StorageErrorCode.QUOTA_EXCEEDED, "Quota for bucket '" +
|
|
146
180
|
bucket +
|
|
147
181
|
"' exceeded, please view quota on " +
|
|
148
182
|
'https://firebase.google.com/pricing/.');
|
|
@@ -150,52 +184,52 @@ function quotaExceeded(bucket) {
|
|
|
150
184
|
function unauthenticated() {
|
|
151
185
|
var message = 'User is not authenticated, please authenticate using Firebase ' +
|
|
152
186
|
'Authentication and try again.';
|
|
153
|
-
return new StorageError(
|
|
187
|
+
return new StorageError(exports.StorageErrorCode.UNAUTHENTICATED, message);
|
|
154
188
|
}
|
|
155
189
|
function unauthorizedApp() {
|
|
156
|
-
return new StorageError(
|
|
190
|
+
return new StorageError(exports.StorageErrorCode.UNAUTHORIZED_APP, 'This app does not have permission to access Firebase Storage on this project.');
|
|
157
191
|
}
|
|
158
192
|
function unauthorized(path) {
|
|
159
|
-
return new StorageError(
|
|
193
|
+
return new StorageError(exports.StorageErrorCode.UNAUTHORIZED, "User does not have permission to access '" + path + "'.");
|
|
160
194
|
}
|
|
161
195
|
function retryLimitExceeded() {
|
|
162
|
-
return new StorageError(
|
|
196
|
+
return new StorageError(exports.StorageErrorCode.RETRY_LIMIT_EXCEEDED, 'Max retry time for operation exceeded, please try again.');
|
|
163
197
|
}
|
|
164
198
|
function canceled() {
|
|
165
|
-
return new StorageError(
|
|
199
|
+
return new StorageError(exports.StorageErrorCode.CANCELED, 'User canceled the upload/download.');
|
|
166
200
|
}
|
|
167
201
|
function invalidUrl(url) {
|
|
168
|
-
return new StorageError(
|
|
202
|
+
return new StorageError(exports.StorageErrorCode.INVALID_URL, "Invalid URL '" + url + "'.");
|
|
169
203
|
}
|
|
170
204
|
function invalidDefaultBucket(bucket) {
|
|
171
|
-
return new StorageError(
|
|
205
|
+
return new StorageError(exports.StorageErrorCode.INVALID_DEFAULT_BUCKET, "Invalid default bucket '" + bucket + "'.");
|
|
172
206
|
}
|
|
173
207
|
function noDefaultBucket() {
|
|
174
|
-
return new StorageError(
|
|
208
|
+
return new StorageError(exports.StorageErrorCode.NO_DEFAULT_BUCKET, 'No default bucket ' +
|
|
175
209
|
"found. Did you set the '" +
|
|
176
210
|
CONFIG_STORAGE_BUCKET_KEY +
|
|
177
211
|
"' property when initializing the app?");
|
|
178
212
|
}
|
|
179
213
|
function cannotSliceBlob() {
|
|
180
|
-
return new StorageError(
|
|
214
|
+
return new StorageError(exports.StorageErrorCode.CANNOT_SLICE_BLOB, 'Cannot slice blob for upload. Please retry the upload.');
|
|
181
215
|
}
|
|
182
216
|
function serverFileWrongSize() {
|
|
183
|
-
return new StorageError(
|
|
217
|
+
return new StorageError(exports.StorageErrorCode.SERVER_FILE_WRONG_SIZE, 'Server recorded incorrect upload file size, please retry the upload.');
|
|
184
218
|
}
|
|
185
219
|
function noDownloadURL() {
|
|
186
|
-
return new StorageError(
|
|
220
|
+
return new StorageError(exports.StorageErrorCode.NO_DOWNLOAD_URL, 'The given file does not have any download URLs.');
|
|
187
221
|
}
|
|
188
222
|
function missingPolyFill(polyFill) {
|
|
189
|
-
return new StorageError(
|
|
223
|
+
return new StorageError(exports.StorageErrorCode.UNSUPPORTED_ENVIRONMENT, "".concat(polyFill, " is missing. Make sure to install the required polyfills. See https://firebase.google.com/docs/web/environments-js-sdk#polyfills for more information."));
|
|
190
224
|
}
|
|
191
225
|
/**
|
|
192
226
|
* @internal
|
|
193
227
|
*/
|
|
194
228
|
function invalidArgument(message) {
|
|
195
|
-
return new StorageError(
|
|
229
|
+
return new StorageError(exports.StorageErrorCode.INVALID_ARGUMENT, message);
|
|
196
230
|
}
|
|
197
231
|
function appDeleted() {
|
|
198
|
-
return new StorageError(
|
|
232
|
+
return new StorageError(exports.StorageErrorCode.APP_DELETED, 'The Firebase app was deleted.');
|
|
199
233
|
}
|
|
200
234
|
/**
|
|
201
235
|
* @param name - The name of the operation that was invalid.
|
|
@@ -203,7 +237,7 @@ function appDeleted() {
|
|
|
203
237
|
* @internal
|
|
204
238
|
*/
|
|
205
239
|
function invalidRootOperation(name) {
|
|
206
|
-
return new StorageError(
|
|
240
|
+
return new StorageError(exports.StorageErrorCode.INVALID_ROOT_OPERATION, "The operation '" +
|
|
207
241
|
name +
|
|
208
242
|
"' cannot be performed on a root reference, create a non-root " +
|
|
209
243
|
"reference using child, such as .child('file.png').");
|
|
@@ -213,13 +247,13 @@ function invalidRootOperation(name) {
|
|
|
213
247
|
* @param message - A message describing the format violation.
|
|
214
248
|
*/
|
|
215
249
|
function invalidFormat(format, message) {
|
|
216
|
-
return new StorageError(
|
|
250
|
+
return new StorageError(exports.StorageErrorCode.INVALID_FORMAT, "String does not match format '" + format + "': " + message);
|
|
217
251
|
}
|
|
218
252
|
/**
|
|
219
253
|
* @param message - A message describing the internal error.
|
|
220
254
|
*/
|
|
221
255
|
function internalError(message) {
|
|
222
|
-
throw new StorageError(
|
|
256
|
+
throw new StorageError(exports.StorageErrorCode.INTERNAL_ERROR, 'Internal error: ' + message);
|
|
223
257
|
}
|
|
224
258
|
|
|
225
259
|
/**
|
|
@@ -909,7 +943,7 @@ function getBlob$1() {
|
|
|
909
943
|
return new Blob(args);
|
|
910
944
|
}
|
|
911
945
|
else {
|
|
912
|
-
throw new StorageError(
|
|
946
|
+
throw new StorageError(exports.StorageErrorCode.UNSUPPORTED_ENVIRONMENT, "This browser doesn't seem to support creating Blobs");
|
|
913
947
|
}
|
|
914
948
|
}
|
|
915
949
|
}
|
|
@@ -2367,7 +2401,7 @@ var UploadTask = /** @class */ (function () {
|
|
|
2367
2401
|
this._errorHandler = function (error) {
|
|
2368
2402
|
_this._request = undefined;
|
|
2369
2403
|
_this._chunkMultiplier = 1;
|
|
2370
|
-
if (error._codeEquals(
|
|
2404
|
+
if (error._codeEquals(exports.StorageErrorCode.CANCELED)) {
|
|
2371
2405
|
_this._needToFetchStatus = true;
|
|
2372
2406
|
_this.completeTransitions_();
|
|
2373
2407
|
}
|
|
@@ -2390,7 +2424,7 @@ var UploadTask = /** @class */ (function () {
|
|
|
2390
2424
|
};
|
|
2391
2425
|
this._metadataErrorHandler = function (error) {
|
|
2392
2426
|
_this._request = undefined;
|
|
2393
|
-
if (error._codeEquals(
|
|
2427
|
+
if (error._codeEquals(exports.StorageErrorCode.CANCELED)) {
|
|
2394
2428
|
_this.completeTransitions_();
|
|
2395
2429
|
}
|
|
2396
2430
|
else {
|
|
@@ -3500,7 +3534,7 @@ var FirebaseStorageImpl = /** @class */ (function () {
|
|
|
3500
3534
|
}());
|
|
3501
3535
|
|
|
3502
3536
|
var name = "@firebase/storage";
|
|
3503
|
-
var version = "0.
|
|
3537
|
+
var version = "0.11.0-20230131204242";
|
|
3504
3538
|
|
|
3505
3539
|
/**
|
|
3506
3540
|
* @license
|
|
@@ -3794,6 +3828,7 @@ function registerStorage() {
|
|
|
3794
3828
|
}
|
|
3795
3829
|
registerStorage();
|
|
3796
3830
|
|
|
3831
|
+
exports.StorageError = StorageError;
|
|
3797
3832
|
exports.StringFormat = StringFormat;
|
|
3798
3833
|
exports._FbsBlob = FbsBlob;
|
|
3799
3834
|
exports._Location = Location;
|