@nextlyhq/storage-s3 0.0.2-alpha.70 → 0.0.2-alpha.72
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/index.cjs +53 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +53 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { DeleteObjectCommand, DeleteObjectsCommand, GetObjectCommand, HeadObjectCommand, ListObjectsV2Command, PutObjectCommand, S3Client } from "@aws-sdk/client-s3";
|
|
2
2
|
import { Upload } from "@aws-sdk/lib-storage";
|
|
3
3
|
import { getSignedUrl } from "@aws-sdk/s3-request-presigner";
|
|
4
|
-
// ../nextly/dist/nextly-error-
|
|
4
|
+
// ../nextly/dist/nextly-error-DetCjZnO.mjs
|
|
5
5
|
function isDbError(err) {
|
|
6
6
|
if (!err || typeof err !== "object") return false;
|
|
7
7
|
const obj = err;
|
|
@@ -79,6 +79,7 @@ const NEXTLY_ERROR_STATUS = {
|
|
|
79
79
|
API_KEY_ROLE_ABOVE_CREATOR: 403,
|
|
80
80
|
NOT_FOUND: 404,
|
|
81
81
|
METHOD_NOT_ALLOWED: 405,
|
|
82
|
+
RANGE_NOT_SATISFIABLE: 416,
|
|
82
83
|
CONFLICT: 409,
|
|
83
84
|
DUPLICATE: 409,
|
|
84
85
|
RATE_LIMITED: 429,
|
|
@@ -192,6 +193,7 @@ const GENERIC_PUBLIC_MESSAGE = {
|
|
|
192
193
|
FORBIDDEN: "You don't have permission to perform this action.",
|
|
193
194
|
NOT_FOUND: "Not found.",
|
|
194
195
|
METHOD_NOT_ALLOWED: "That method is not allowed on this address.",
|
|
196
|
+
RANGE_NOT_SATISFIABLE: "The requested range is outside the file.",
|
|
195
197
|
CONFLICT: "The resource has changed since you last loaded it. Please refresh and try again.",
|
|
196
198
|
DUPLICATE: "Resource already exists.",
|
|
197
199
|
PAYLOAD_TOO_LARGE: "The request is too large.",
|
|
@@ -412,6 +414,55 @@ var NextlyError = class NextlyError extends Error {
|
|
|
412
414
|
});
|
|
413
415
|
}
|
|
414
416
|
/**
|
|
417
|
+
* Something only a signed-in person can do, asked by a caller that is not
|
|
418
|
+
* one: an API key, or a request acting as no person. Forbidden, and the
|
|
419
|
+
* message says so, since it is about what kind of caller asked, not about
|
|
420
|
+
* the caller's permissions. `doing` completes "Only a signed-in person can".
|
|
421
|
+
*/
|
|
422
|
+
static personOnly(opts) {
|
|
423
|
+
return new NextlyError({
|
|
424
|
+
code: "FORBIDDEN",
|
|
425
|
+
publicMessage: `Only a signed-in person can ${opts.doing}.`,
|
|
426
|
+
logContext: opts.logContext
|
|
427
|
+
});
|
|
428
|
+
}
|
|
429
|
+
/**
|
|
430
|
+
* A role or permission built into Nextly, which is never changed or
|
|
431
|
+
* deleted. Forbidden, and the message says so: it is a fact about the role,
|
|
432
|
+
* not about the caller's permissions.
|
|
433
|
+
*/
|
|
434
|
+
static builtIn(opts) {
|
|
435
|
+
return new NextlyError({
|
|
436
|
+
code: "FORBIDDEN",
|
|
437
|
+
publicMessage: `This ${opts.thing} is built in, so it can't be ${opts.change === "change" ? "changed" : "deleted"}.`,
|
|
438
|
+
logContext: opts.logContext
|
|
439
|
+
});
|
|
440
|
+
}
|
|
441
|
+
/**
|
|
442
|
+
* A request from a site not allowed to make it: its own `Origin` names a
|
|
443
|
+
* site the installation does not allow. Forbidden, and the message says so;
|
|
444
|
+
* the origin is the caller's own, so naming its kind tells them nothing.
|
|
445
|
+
*/
|
|
446
|
+
static originRefused(opts) {
|
|
447
|
+
return new NextlyError({
|
|
448
|
+
code: "FORBIDDEN",
|
|
449
|
+
publicMessage: "This request came from a site that isn't allowed to make it.",
|
|
450
|
+
logContext: opts?.logContext
|
|
451
|
+
});
|
|
452
|
+
}
|
|
453
|
+
/**
|
|
454
|
+
* A Single deleted without `force`: Singles hold a site's lasting settings,
|
|
455
|
+
* so they are not deleted from here, only by an admin or CLI clean-up that
|
|
456
|
+
* passes `force`. Forbidden, and the message says so.
|
|
457
|
+
*/
|
|
458
|
+
static singleNotDeletable(opts) {
|
|
459
|
+
return new NextlyError({
|
|
460
|
+
code: "FORBIDDEN",
|
|
461
|
+
publicMessage: "A Single can't be deleted from here.",
|
|
462
|
+
logContext: opts?.logContext
|
|
463
|
+
});
|
|
464
|
+
}
|
|
465
|
+
/**
|
|
415
466
|
* A collection, Single or component defined in code, which is changed by
|
|
416
467
|
* changing its code and not from here. Forbidden, and the message says so:
|
|
417
468
|
* it is a fact about the thing, not about the caller's permissions, so it
|
|
@@ -641,7 +692,7 @@ var NextlyError = class NextlyError extends Error {
|
|
|
641
692
|
return NextlyError.isCode(err, "RATE_LIMITED");
|
|
642
693
|
}
|
|
643
694
|
};
|
|
644
|
-
// ../nextly/dist/validate-external-url-
|
|
695
|
+
// ../nextly/dist/validate-external-url-CfT2WjgH.mjs
|
|
645
696
|
/** Default response body cap: reject anything larger before buffering it all. */
|
|
646
697
|
/**
|
|
647
698
|
* How many bytes a bounded external read may buffer, absent a caller's own cap.
|