@nextlyhq/storage-vercel-blob 0.0.2-alpha.71 → 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-CwDiSPDF.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;
@@ -412,6 +412,55 @@ var NextlyError = class NextlyError extends Error {
412
412
  });
413
413
  }
414
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
+ /**
415
464
  * A collection, Single or component defined in code, which is changed by
416
465
  * changing its code and not from here. Forbidden, and the message says so:
417
466
  * it is a fact about the thing, not about the caller's permissions, so it
@@ -658,7 +707,7 @@ function ipv4ToInt(ip) {
658
707
  }
659
708
  return acc >>> 0;
660
709
  }
661
- // ../nextly/dist/validate-external-url-CnZrcJdP.mjs
710
+ // ../nextly/dist/validate-external-url-CfT2WjgH.mjs
662
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)$/;
663
712
  /**
664
713
  * IPv4 CIDR ranges that must NEVER be the destination of an outbound