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