@firebase/storage 0.10.0 → 0.10.1-canary.0bab0b7a7
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 +10 -0
- package/dist/index.browser.cjs.js +62 -27
- 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 +62 -28
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.esm5.js +62 -28
- package/dist/index.esm5.js.map +1 -1
- package/dist/index.node.cjs.js +61 -26
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/node-esm/index.node.esm.js +61 -27
- 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/node-esm/test/unit/testshared.d.ts +1 -1
- 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/dist/test/unit/testshared.d.ts +1 -1
- package/package.json +11 -7
package/dist/index.esm5.js
CHANGED
|
@@ -126,19 +126,53 @@ var StorageError = /** @class */ (function (_super) {
|
|
|
126
126
|
});
|
|
127
127
|
return StorageError;
|
|
128
128
|
}(FirebaseError));
|
|
129
|
+
/**
|
|
130
|
+
* @public
|
|
131
|
+
* Error codes that can be attached to `StorageError`s.
|
|
132
|
+
*/
|
|
133
|
+
var StorageErrorCode;
|
|
134
|
+
(function (StorageErrorCode) {
|
|
135
|
+
// Shared between all platforms
|
|
136
|
+
StorageErrorCode["UNKNOWN"] = "unknown";
|
|
137
|
+
StorageErrorCode["OBJECT_NOT_FOUND"] = "object-not-found";
|
|
138
|
+
StorageErrorCode["BUCKET_NOT_FOUND"] = "bucket-not-found";
|
|
139
|
+
StorageErrorCode["PROJECT_NOT_FOUND"] = "project-not-found";
|
|
140
|
+
StorageErrorCode["QUOTA_EXCEEDED"] = "quota-exceeded";
|
|
141
|
+
StorageErrorCode["UNAUTHENTICATED"] = "unauthenticated";
|
|
142
|
+
StorageErrorCode["UNAUTHORIZED"] = "unauthorized";
|
|
143
|
+
StorageErrorCode["UNAUTHORIZED_APP"] = "unauthorized-app";
|
|
144
|
+
StorageErrorCode["RETRY_LIMIT_EXCEEDED"] = "retry-limit-exceeded";
|
|
145
|
+
StorageErrorCode["INVALID_CHECKSUM"] = "invalid-checksum";
|
|
146
|
+
StorageErrorCode["CANCELED"] = "canceled";
|
|
147
|
+
// JS specific
|
|
148
|
+
StorageErrorCode["INVALID_EVENT_NAME"] = "invalid-event-name";
|
|
149
|
+
StorageErrorCode["INVALID_URL"] = "invalid-url";
|
|
150
|
+
StorageErrorCode["INVALID_DEFAULT_BUCKET"] = "invalid-default-bucket";
|
|
151
|
+
StorageErrorCode["NO_DEFAULT_BUCKET"] = "no-default-bucket";
|
|
152
|
+
StorageErrorCode["CANNOT_SLICE_BLOB"] = "cannot-slice-blob";
|
|
153
|
+
StorageErrorCode["SERVER_FILE_WRONG_SIZE"] = "server-file-wrong-size";
|
|
154
|
+
StorageErrorCode["NO_DOWNLOAD_URL"] = "no-download-url";
|
|
155
|
+
StorageErrorCode["INVALID_ARGUMENT"] = "invalid-argument";
|
|
156
|
+
StorageErrorCode["INVALID_ARGUMENT_COUNT"] = "invalid-argument-count";
|
|
157
|
+
StorageErrorCode["APP_DELETED"] = "app-deleted";
|
|
158
|
+
StorageErrorCode["INVALID_ROOT_OPERATION"] = "invalid-root-operation";
|
|
159
|
+
StorageErrorCode["INVALID_FORMAT"] = "invalid-format";
|
|
160
|
+
StorageErrorCode["INTERNAL_ERROR"] = "internal-error";
|
|
161
|
+
StorageErrorCode["UNSUPPORTED_ENVIRONMENT"] = "unsupported-environment";
|
|
162
|
+
})(StorageErrorCode || (StorageErrorCode = {}));
|
|
129
163
|
function prependCode(code) {
|
|
130
164
|
return 'storage/' + code;
|
|
131
165
|
}
|
|
132
166
|
function unknown() {
|
|
133
167
|
var message = 'An unknown error occurred, please check the error payload for ' +
|
|
134
168
|
'server response.';
|
|
135
|
-
return new StorageError(
|
|
169
|
+
return new StorageError(StorageErrorCode.UNKNOWN, message);
|
|
136
170
|
}
|
|
137
171
|
function objectNotFound(path) {
|
|
138
|
-
return new StorageError(
|
|
172
|
+
return new StorageError(StorageErrorCode.OBJECT_NOT_FOUND, "Object '" + path + "' does not exist.");
|
|
139
173
|
}
|
|
140
174
|
function quotaExceeded(bucket) {
|
|
141
|
-
return new StorageError(
|
|
175
|
+
return new StorageError(StorageErrorCode.QUOTA_EXCEEDED, "Quota for bucket '" +
|
|
142
176
|
bucket +
|
|
143
177
|
"' exceeded, please view quota on " +
|
|
144
178
|
'https://firebase.google.com/pricing/.');
|
|
@@ -146,52 +180,52 @@ function quotaExceeded(bucket) {
|
|
|
146
180
|
function unauthenticated() {
|
|
147
181
|
var message = 'User is not authenticated, please authenticate using Firebase ' +
|
|
148
182
|
'Authentication and try again.';
|
|
149
|
-
return new StorageError(
|
|
183
|
+
return new StorageError(StorageErrorCode.UNAUTHENTICATED, message);
|
|
150
184
|
}
|
|
151
185
|
function unauthorizedApp() {
|
|
152
|
-
return new StorageError(
|
|
186
|
+
return new StorageError(StorageErrorCode.UNAUTHORIZED_APP, 'This app does not have permission to access Firebase Storage on this project.');
|
|
153
187
|
}
|
|
154
188
|
function unauthorized(path) {
|
|
155
|
-
return new StorageError(
|
|
189
|
+
return new StorageError(StorageErrorCode.UNAUTHORIZED, "User does not have permission to access '" + path + "'.");
|
|
156
190
|
}
|
|
157
191
|
function retryLimitExceeded() {
|
|
158
|
-
return new StorageError(
|
|
192
|
+
return new StorageError(StorageErrorCode.RETRY_LIMIT_EXCEEDED, 'Max retry time for operation exceeded, please try again.');
|
|
159
193
|
}
|
|
160
194
|
function canceled() {
|
|
161
|
-
return new StorageError(
|
|
195
|
+
return new StorageError(StorageErrorCode.CANCELED, 'User canceled the upload/download.');
|
|
162
196
|
}
|
|
163
197
|
function invalidUrl(url) {
|
|
164
|
-
return new StorageError(
|
|
198
|
+
return new StorageError(StorageErrorCode.INVALID_URL, "Invalid URL '" + url + "'.");
|
|
165
199
|
}
|
|
166
200
|
function invalidDefaultBucket(bucket) {
|
|
167
|
-
return new StorageError(
|
|
201
|
+
return new StorageError(StorageErrorCode.INVALID_DEFAULT_BUCKET, "Invalid default bucket '" + bucket + "'.");
|
|
168
202
|
}
|
|
169
203
|
function noDefaultBucket() {
|
|
170
|
-
return new StorageError(
|
|
204
|
+
return new StorageError(StorageErrorCode.NO_DEFAULT_BUCKET, 'No default bucket ' +
|
|
171
205
|
"found. Did you set the '" +
|
|
172
206
|
CONFIG_STORAGE_BUCKET_KEY +
|
|
173
207
|
"' property when initializing the app?");
|
|
174
208
|
}
|
|
175
209
|
function cannotSliceBlob() {
|
|
176
|
-
return new StorageError(
|
|
210
|
+
return new StorageError(StorageErrorCode.CANNOT_SLICE_BLOB, 'Cannot slice blob for upload. Please retry the upload.');
|
|
177
211
|
}
|
|
178
212
|
function serverFileWrongSize() {
|
|
179
|
-
return new StorageError(
|
|
213
|
+
return new StorageError(StorageErrorCode.SERVER_FILE_WRONG_SIZE, 'Server recorded incorrect upload file size, please retry the upload.');
|
|
180
214
|
}
|
|
181
215
|
function noDownloadURL() {
|
|
182
|
-
return new StorageError(
|
|
216
|
+
return new StorageError(StorageErrorCode.NO_DOWNLOAD_URL, 'The given file does not have any download URLs.');
|
|
183
217
|
}
|
|
184
218
|
function missingPolyFill(polyFill) {
|
|
185
|
-
return new StorageError(
|
|
219
|
+
return new StorageError(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."));
|
|
186
220
|
}
|
|
187
221
|
/**
|
|
188
222
|
* @internal
|
|
189
223
|
*/
|
|
190
224
|
function invalidArgument(message) {
|
|
191
|
-
return new StorageError(
|
|
225
|
+
return new StorageError(StorageErrorCode.INVALID_ARGUMENT, message);
|
|
192
226
|
}
|
|
193
227
|
function appDeleted() {
|
|
194
|
-
return new StorageError(
|
|
228
|
+
return new StorageError(StorageErrorCode.APP_DELETED, 'The Firebase app was deleted.');
|
|
195
229
|
}
|
|
196
230
|
/**
|
|
197
231
|
* @param name - The name of the operation that was invalid.
|
|
@@ -199,7 +233,7 @@ function appDeleted() {
|
|
|
199
233
|
* @internal
|
|
200
234
|
*/
|
|
201
235
|
function invalidRootOperation(name) {
|
|
202
|
-
return new StorageError(
|
|
236
|
+
return new StorageError(StorageErrorCode.INVALID_ROOT_OPERATION, "The operation '" +
|
|
203
237
|
name +
|
|
204
238
|
"' cannot be performed on a root reference, create a non-root " +
|
|
205
239
|
"reference using child, such as .child('file.png').");
|
|
@@ -209,13 +243,13 @@ function invalidRootOperation(name) {
|
|
|
209
243
|
* @param message - A message describing the format violation.
|
|
210
244
|
*/
|
|
211
245
|
function invalidFormat(format, message) {
|
|
212
|
-
return new StorageError(
|
|
246
|
+
return new StorageError(StorageErrorCode.INVALID_FORMAT, "String does not match format '" + format + "': " + message);
|
|
213
247
|
}
|
|
214
248
|
/**
|
|
215
249
|
* @param message - A message describing the internal error.
|
|
216
250
|
*/
|
|
217
251
|
function internalError(message) {
|
|
218
|
-
throw new StorageError(
|
|
252
|
+
throw new StorageError(StorageErrorCode.INTERNAL_ERROR, 'Internal error: ' + message);
|
|
219
253
|
}
|
|
220
254
|
|
|
221
255
|
/**
|
|
@@ -731,9 +765,9 @@ var NetworkRequest = /** @class */ (function () {
|
|
|
731
765
|
_this.pendingConnection_ = null;
|
|
732
766
|
var hitServer = connection.getErrorCode() === ErrorCode.NO_ERROR;
|
|
733
767
|
var status = connection.getStatus();
|
|
734
|
-
if (
|
|
735
|
-
isRetryStatusCode(status, _this.additionalRetryCodes_)
|
|
736
|
-
|
|
768
|
+
if (!hitServer ||
|
|
769
|
+
(isRetryStatusCode(status, _this.additionalRetryCodes_) &&
|
|
770
|
+
_this.retry)) {
|
|
737
771
|
var wasCanceled = connection.getErrorCode() === ErrorCode.ABORT;
|
|
738
772
|
backoffCallback(false, new RequestEndStatus(false, null, wasCanceled));
|
|
739
773
|
return;
|
|
@@ -905,7 +939,7 @@ function getBlob$1() {
|
|
|
905
939
|
return new Blob(args);
|
|
906
940
|
}
|
|
907
941
|
else {
|
|
908
|
-
throw new StorageError(
|
|
942
|
+
throw new StorageError(StorageErrorCode.UNSUPPORTED_ENVIRONMENT, "This browser doesn't seem to support creating Blobs");
|
|
909
943
|
}
|
|
910
944
|
}
|
|
911
945
|
}
|
|
@@ -2363,7 +2397,7 @@ var UploadTask = /** @class */ (function () {
|
|
|
2363
2397
|
this._errorHandler = function (error) {
|
|
2364
2398
|
_this._request = undefined;
|
|
2365
2399
|
_this._chunkMultiplier = 1;
|
|
2366
|
-
if (error._codeEquals(
|
|
2400
|
+
if (error._codeEquals(StorageErrorCode.CANCELED)) {
|
|
2367
2401
|
_this._needToFetchStatus = true;
|
|
2368
2402
|
_this.completeTransitions_();
|
|
2369
2403
|
}
|
|
@@ -2386,7 +2420,7 @@ var UploadTask = /** @class */ (function () {
|
|
|
2386
2420
|
};
|
|
2387
2421
|
this._metadataErrorHandler = function (error) {
|
|
2388
2422
|
_this._request = undefined;
|
|
2389
|
-
if (error._codeEquals(
|
|
2423
|
+
if (error._codeEquals(StorageErrorCode.CANCELED)) {
|
|
2390
2424
|
_this.completeTransitions_();
|
|
2391
2425
|
}
|
|
2392
2426
|
else {
|
|
@@ -3496,7 +3530,7 @@ var FirebaseStorageImpl = /** @class */ (function () {
|
|
|
3496
3530
|
}());
|
|
3497
3531
|
|
|
3498
3532
|
var name = "@firebase/storage";
|
|
3499
|
-
var version = "0.10.
|
|
3533
|
+
var version = "0.10.1-canary.0bab0b7a7";
|
|
3500
3534
|
|
|
3501
3535
|
/**
|
|
3502
3536
|
* @license
|
|
@@ -3790,5 +3824,5 @@ function registerStorage() {
|
|
|
3790
3824
|
}
|
|
3791
3825
|
registerStorage();
|
|
3792
3826
|
|
|
3793
|
-
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 };
|
|
3827
|
+
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 };
|
|
3794
3828
|
//# sourceMappingURL=index.esm5.js.map
|