@nextlyhq/storage-vercel-blob 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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
let _vercel_blob = require("@vercel/blob");
|
|
3
|
-
// ../nextly/dist/nextly-error-
|
|
3
|
+
// ../nextly/dist/nextly-error-DetCjZnO.mjs
|
|
4
4
|
function isDbError(err) {
|
|
5
5
|
if (!err || typeof err !== "object") return false;
|
|
6
6
|
const obj = err;
|
|
@@ -78,6 +78,7 @@ const NEXTLY_ERROR_STATUS = {
|
|
|
78
78
|
API_KEY_ROLE_ABOVE_CREATOR: 403,
|
|
79
79
|
NOT_FOUND: 404,
|
|
80
80
|
METHOD_NOT_ALLOWED: 405,
|
|
81
|
+
RANGE_NOT_SATISFIABLE: 416,
|
|
81
82
|
CONFLICT: 409,
|
|
82
83
|
DUPLICATE: 409,
|
|
83
84
|
RATE_LIMITED: 429,
|
|
@@ -191,6 +192,7 @@ const GENERIC_PUBLIC_MESSAGE = {
|
|
|
191
192
|
FORBIDDEN: "You don't have permission to perform this action.",
|
|
192
193
|
NOT_FOUND: "Not found.",
|
|
193
194
|
METHOD_NOT_ALLOWED: "That method is not allowed on this address.",
|
|
195
|
+
RANGE_NOT_SATISFIABLE: "The requested range is outside the file.",
|
|
194
196
|
CONFLICT: "The resource has changed since you last loaded it. Please refresh and try again.",
|
|
195
197
|
DUPLICATE: "Resource already exists.",
|
|
196
198
|
PAYLOAD_TOO_LARGE: "The request is too large.",
|
|
@@ -411,6 +413,55 @@ var NextlyError = class NextlyError extends Error {
|
|
|
411
413
|
});
|
|
412
414
|
}
|
|
413
415
|
/**
|
|
416
|
+
* Something only a signed-in person can do, asked by a caller that is not
|
|
417
|
+
* one: an API key, or a request acting as no person. Forbidden, and the
|
|
418
|
+
* message says so, since it is about what kind of caller asked, not about
|
|
419
|
+
* the caller's permissions. `doing` completes "Only a signed-in person can".
|
|
420
|
+
*/
|
|
421
|
+
static personOnly(opts) {
|
|
422
|
+
return new NextlyError({
|
|
423
|
+
code: "FORBIDDEN",
|
|
424
|
+
publicMessage: `Only a signed-in person can ${opts.doing}.`,
|
|
425
|
+
logContext: opts.logContext
|
|
426
|
+
});
|
|
427
|
+
}
|
|
428
|
+
/**
|
|
429
|
+
* A role or permission built into Nextly, which is never changed or
|
|
430
|
+
* deleted. Forbidden, and the message says so: it is a fact about the role,
|
|
431
|
+
* not about the caller's permissions.
|
|
432
|
+
*/
|
|
433
|
+
static builtIn(opts) {
|
|
434
|
+
return new NextlyError({
|
|
435
|
+
code: "FORBIDDEN",
|
|
436
|
+
publicMessage: `This ${opts.thing} is built in, so it can't be ${opts.change === "change" ? "changed" : "deleted"}.`,
|
|
437
|
+
logContext: opts.logContext
|
|
438
|
+
});
|
|
439
|
+
}
|
|
440
|
+
/**
|
|
441
|
+
* A request from a site not allowed to make it: its own `Origin` names a
|
|
442
|
+
* site the installation does not allow. Forbidden, and the message says so;
|
|
443
|
+
* the origin is the caller's own, so naming its kind tells them nothing.
|
|
444
|
+
*/
|
|
445
|
+
static originRefused(opts) {
|
|
446
|
+
return new NextlyError({
|
|
447
|
+
code: "FORBIDDEN",
|
|
448
|
+
publicMessage: "This request came from a site that isn't allowed to make it.",
|
|
449
|
+
logContext: opts?.logContext
|
|
450
|
+
});
|
|
451
|
+
}
|
|
452
|
+
/**
|
|
453
|
+
* A Single deleted without `force`: Singles hold a site's lasting settings,
|
|
454
|
+
* so they are not deleted from here, only by an admin or CLI clean-up that
|
|
455
|
+
* passes `force`. Forbidden, and the message says so.
|
|
456
|
+
*/
|
|
457
|
+
static singleNotDeletable(opts) {
|
|
458
|
+
return new NextlyError({
|
|
459
|
+
code: "FORBIDDEN",
|
|
460
|
+
publicMessage: "A Single can't be deleted from here.",
|
|
461
|
+
logContext: opts?.logContext
|
|
462
|
+
});
|
|
463
|
+
}
|
|
464
|
+
/**
|
|
414
465
|
* A collection, Single or component defined in code, which is changed by
|
|
415
466
|
* changing its code and not from here. Forbidden, and the message says so:
|
|
416
467
|
* it is a fact about the thing, not about the caller's permissions, so it
|
|
@@ -657,7 +708,7 @@ function ipv4ToInt(ip) {
|
|
|
657
708
|
}
|
|
658
709
|
return acc >>> 0;
|
|
659
710
|
}
|
|
660
|
-
// ../nextly/dist/validate-external-url-
|
|
711
|
+
// ../nextly/dist/validate-external-url-CfT2WjgH.mjs
|
|
661
712
|
const IPV4_RE = /^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/;
|
|
662
713
|
/**
|
|
663
714
|
* IPv4 CIDR ranges that must NEVER be the destination of an outbound
|