@koolbase/core 11.0.0 → 11.2.0
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/dist/cjs/auth-errors.d.ts +80 -1
- package/dist/cjs/auth-errors.js +142 -3
- package/dist/cjs/auth.js +43 -0
- package/dist/cjs/database-errors.d.ts +44 -2
- package/dist/cjs/database-errors.js +77 -7
- package/dist/cjs/function-errors.d.ts +19 -0
- package/dist/cjs/function-errors.js +35 -1
- package/dist/cjs/storage-errors.d.ts +18 -0
- package/dist/cjs/storage-errors.js +33 -1
- package/dist/esm/auth-errors.d.ts +80 -1
- package/dist/esm/auth-errors.js +129 -2
- package/dist/esm/auth.js +44 -1
- package/dist/esm/database-errors.d.ts +44 -2
- package/dist/esm/database-errors.js +72 -6
- package/dist/esm/function-errors.d.ts +19 -0
- package/dist/esm/function-errors.js +32 -0
- package/dist/esm/storage-errors.d.ts +18 -0
- package/dist/esm/storage-errors.js +30 -0
- package/package.json +1 -1
|
@@ -96,6 +96,32 @@ export class KoolbaseStoragePermissionError extends KoolbaseStorageError {
|
|
|
96
96
|
* 409 but means "path collides"); branch on the error type via
|
|
97
97
|
* `instanceof`, not on status.
|
|
98
98
|
*/
|
|
99
|
+
/**
|
|
100
|
+
* The presigned upload was confirmed after its window closed.
|
|
101
|
+
*
|
|
102
|
+
* An upload URL has a lifetime. A user who picks a file, gets distracted and
|
|
103
|
+
* comes back twenty minutes later hits this — so it is a retry, not a
|
|
104
|
+
* failure: presign again and send the same bytes. Worth catching rather than
|
|
105
|
+
* showing "upload failed" to someone whose file was fine.
|
|
106
|
+
*/
|
|
107
|
+
export class KoolbaseUploadExpiredError extends KoolbaseStorageError {
|
|
108
|
+
constructor(message) {
|
|
109
|
+
super(message ?? 'This upload is past the confirmation window — please re-upload', 'upload_expired');
|
|
110
|
+
this.name = 'KoolbaseUploadExpiredError';
|
|
111
|
+
Object.setPrototypeOf(this, KoolbaseUploadExpiredError.prototype);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* A bucket cap set below what the bucket already holds. A dashboard
|
|
116
|
+
* operation rather than an app one, mapped so it does not arrive untyped.
|
|
117
|
+
*/
|
|
118
|
+
export class KoolbaseCapBelowUsageError extends KoolbaseStorageError {
|
|
119
|
+
constructor(message) {
|
|
120
|
+
super(message ?? 'The cap is below the bucket\'s current usage', 'cap_below_usage');
|
|
121
|
+
this.name = 'KoolbaseCapBelowUsageError';
|
|
122
|
+
Object.setPrototypeOf(this, KoolbaseCapBelowUsageError.prototype);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
99
125
|
export class KoolbaseStorageQuotaError extends KoolbaseStorageError {
|
|
100
126
|
constructor(message) {
|
|
101
127
|
super(message ?? 'Bucket quota exceeded', 'quota_exceeded');
|
|
@@ -195,6 +221,10 @@ export function koolbaseStorageError(status, body, fallbackMessage = 'Storage re
|
|
|
195
221
|
return new KoolbaseStorageConflictError(message, body?.path);
|
|
196
222
|
case 'quota_exceeded':
|
|
197
223
|
return new KoolbaseStorageQuotaError(message);
|
|
224
|
+
case 'upload_expired':
|
|
225
|
+
return new KoolbaseUploadExpiredError(message);
|
|
226
|
+
case 'cap_below_usage':
|
|
227
|
+
return new KoolbaseCapBelowUsageError(message);
|
|
198
228
|
case 'file_too_large':
|
|
199
229
|
return new KoolbaseStorageFileTooLargeError(message);
|
|
200
230
|
case 'mime_not_allowed':
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@koolbase/core",
|
|
3
|
-
"version": "11.
|
|
3
|
+
"version": "11.2.0",
|
|
4
4
|
"description": "Koolbase SDK core \u2014 shared behaviour behind @koolbase/react-native and @koolbase/js. Install one of those, not this.",
|
|
5
5
|
"main": "./dist/cjs/index.js",
|
|
6
6
|
"types": "./dist/esm/index.d.ts",
|