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