@nextlyhq/storage-s3 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,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-CwDiSPDF.mjs
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;
@@ -414,6 +414,55 @@ var NextlyError = class NextlyError extends Error {
414
414
  });
415
415
  }
416
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
+ /**
417
466
  * A collection, Single or component defined in code, which is changed by
418
467
  * changing its code and not from here. Forbidden, and the message says so:
419
468
  * it is a fact about the thing, not about the caller's permissions, so it
@@ -643,7 +692,7 @@ var NextlyError = class NextlyError extends Error {
643
692
  return NextlyError.isCode(err, "RATE_LIMITED");
644
693
  }
645
694
  };
646
- // ../nextly/dist/validate-external-url-CnZrcJdP.mjs
695
+ // ../nextly/dist/validate-external-url-CfT2WjgH.mjs
647
696
  /** Default response body cap: reject anything larger before buffering it all. */
648
697
  /**
649
698
  * How many bytes a bounded external read may buffer, absent a caller's own cap.