@nextlyhq/storage-s3 0.0.2-alpha.72 → 0.0.2-alpha.73
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 +77 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +77 -4
- 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-BLaA7N-v.mjs
|
|
6
6
|
function isDbError(err) {
|
|
7
7
|
if (!err || typeof err !== "object") return false;
|
|
8
8
|
const obj = err;
|
|
@@ -79,6 +79,8 @@ const NEXTLY_ERROR_STATUS = {
|
|
|
79
79
|
SETUP_TOKEN_REQUIRED: 403,
|
|
80
80
|
API_KEY_ROLE_ABOVE_CREATOR: 403,
|
|
81
81
|
NOT_FOUND: 404,
|
|
82
|
+
ENTITY_REMOVED_FROM_CODE: 409,
|
|
83
|
+
ENTITY_NOT_MIGRATED: 409,
|
|
82
84
|
METHOD_NOT_ALLOWED: 405,
|
|
83
85
|
RANGE_NOT_SATISFIABLE: 416,
|
|
84
86
|
CONFLICT: 409,
|
|
@@ -92,6 +94,7 @@ const NEXTLY_ERROR_STATUS = {
|
|
|
92
94
|
DATABASE_BUSY: 503,
|
|
93
95
|
EXTERNAL_SERVICE_ERROR: 502,
|
|
94
96
|
SERVICE_UNAVAILABLE: 503,
|
|
97
|
+
CONFIGURATION_ERROR: 500,
|
|
95
98
|
EXTERNAL_URL_BLOCKED: 400,
|
|
96
99
|
EXTERNAL_REQUEST_FAILED: 502,
|
|
97
100
|
FILENAME_INVALID: 400,
|
|
@@ -133,7 +136,7 @@ const NEXTLY_ERROR_STATUS = {
|
|
|
133
136
|
NEXTLY_SCHEMA_RENAME_UNKNOWN_TARGET: 400,
|
|
134
137
|
NEXTLY_PLUGIN_CLIENT_CONFIG_INVALID: 500,
|
|
135
138
|
NEXTLY_PLUGIN_ADMIN_WIDGET_INVALID: 500,
|
|
136
|
-
|
|
139
|
+
NEXTLY_PLUGIN_REMOVED_WIDGET_CHANNEL: 500,
|
|
137
140
|
NEXTLY_PLUGIN_DOCUMENT_VIEW_INVALID: 500,
|
|
138
141
|
PLUGIN_RESOLUTION_ERROR: 500,
|
|
139
142
|
PLUGIN_DEPENDENCY_NOT_INSTALLED: 409,
|
|
@@ -433,9 +436,15 @@ var NextlyError = class NextlyError extends Error {
|
|
|
433
436
|
* not about the caller's permissions.
|
|
434
437
|
*/
|
|
435
438
|
static builtIn(opts) {
|
|
439
|
+
const done = {
|
|
440
|
+
change: "changed",
|
|
441
|
+
delete: "deleted",
|
|
442
|
+
assign: "assigned",
|
|
443
|
+
inherit: "inherited"
|
|
444
|
+
}[opts.change];
|
|
436
445
|
return new NextlyError({
|
|
437
446
|
code: "FORBIDDEN",
|
|
438
|
-
publicMessage: `This ${opts.thing} is built in, so it can't be ${
|
|
447
|
+
publicMessage: `This ${opts.thing} is built in, so it can't be ${done}.`,
|
|
439
448
|
logContext: opts.logContext
|
|
440
449
|
});
|
|
441
450
|
}
|
|
@@ -478,6 +487,57 @@ var NextlyError = class NextlyError extends Error {
|
|
|
478
487
|
});
|
|
479
488
|
}
|
|
480
489
|
/**
|
|
490
|
+
* A write to an entry of a collection or Single removed from code: its
|
|
491
|
+
* registry row says the app's code defines it, and the running configuration
|
|
492
|
+
* no longer declares it. Its entries are read-only until it is retired or
|
|
493
|
+
* declared again, so the message names the entity, says what happened and
|
|
494
|
+
* gives both ways out. `publicData` carries the kind and the slug, which the
|
|
495
|
+
* caller named, so a client can mark the entity without parsing the sentence.
|
|
496
|
+
*/
|
|
497
|
+
static removedFromCode(opts) {
|
|
498
|
+
const thing = opts.kind === "single" ? "Single" : "collection";
|
|
499
|
+
const its = opts.kind === "single" ? "it" : "its entries";
|
|
500
|
+
return new NextlyError({
|
|
501
|
+
code: "ENTITY_REMOVED_FROM_CODE",
|
|
502
|
+
publicMessage: `The ${thing} "${opts.slug}" was removed from code, so ${its} can't be changed. To retire it, run \`nextly migrate:create\` and then \`nextly migrate\`. To keep it, declare it again in nextly.config.ts.`,
|
|
503
|
+
publicData: {
|
|
504
|
+
kind: opts.kind,
|
|
505
|
+
slug: opts.slug
|
|
506
|
+
},
|
|
507
|
+
logContext: {
|
|
508
|
+
kind: opts.kind,
|
|
509
|
+
slug: opts.slug,
|
|
510
|
+
...opts.logContext
|
|
511
|
+
}
|
|
512
|
+
});
|
|
513
|
+
}
|
|
514
|
+
/**
|
|
515
|
+
* A read or write of a collection or Single the database has not been
|
|
516
|
+
* migrated for: the column of one of its declared fields is missing, its
|
|
517
|
+
* table is missing, or this running instance never registered it (an
|
|
518
|
+
* entity a migration added after the instance started). The message names
|
|
519
|
+
* the entity, the field or the table, and `nextly migrate`; the driver's
|
|
520
|
+
* error stays on `cause`, for the log, so no SQL reaches the answer.
|
|
521
|
+
*/
|
|
522
|
+
static notMigrated(opts) {
|
|
523
|
+
const { cause, logContext, ...publicData } = opts;
|
|
524
|
+
const entity = `${publicData.kind === "single" ? "Single" : "collection"} "${publicData.slug}"`;
|
|
525
|
+
const field = publicData.field === void 0 ? "a field" : `the field "${publicData.field}"`;
|
|
526
|
+
const table = publicData.table === void 0 ? "" : ` "${publicData.table}"`;
|
|
527
|
+
const publicMessage = publicData.reason === "column" ? `The database has not been migrated for ${field} of the ${entity}. Run \`nextly migrate\`.` : publicData.reason === "table" ? `The database has not been migrated for the ${entity}: its table${table} does not exist. Run \`nextly migrate\`.` : `The ${entity}${publicData.table === void 0 ? "" : ` (table "${publicData.table}")`} is not registered in this running instance. Run \`nextly migrate\`, then restart the server.`;
|
|
528
|
+
return new NextlyError({
|
|
529
|
+
code: "ENTITY_NOT_MIGRATED",
|
|
530
|
+
publicMessage,
|
|
531
|
+
publicData,
|
|
532
|
+
logMessage: "The database has not been migrated for this entity",
|
|
533
|
+
logContext: {
|
|
534
|
+
...publicData,
|
|
535
|
+
...logContext
|
|
536
|
+
},
|
|
537
|
+
cause
|
|
538
|
+
});
|
|
539
|
+
}
|
|
540
|
+
/**
|
|
481
541
|
* An autosave where the collection or Single does not autosave: its owner
|
|
482
542
|
* switched autosave off, or it keeps no drafts to autosave into. Forbidden,
|
|
483
543
|
* and the message says so, since it is a setting and not a permission.
|
|
@@ -621,6 +681,19 @@ var NextlyError = class NextlyError extends Error {
|
|
|
621
681
|
logContext: opts?.logContext
|
|
622
682
|
});
|
|
623
683
|
}
|
|
684
|
+
/**
|
|
685
|
+
* The app is set up so nextly cannot work: a missing `config`, or a Next.js
|
|
686
|
+
* or React outside the supported ranges. The public message stays generic;
|
|
687
|
+
* what to change goes in `logMessage`, for the operator.
|
|
688
|
+
*/
|
|
689
|
+
static configuration(opts) {
|
|
690
|
+
return new NextlyError({
|
|
691
|
+
code: "CONFIGURATION_ERROR",
|
|
692
|
+
publicMessage: "Server configuration error.",
|
|
693
|
+
logMessage: opts.logMessage,
|
|
694
|
+
logContext: opts.logContext
|
|
695
|
+
});
|
|
696
|
+
}
|
|
624
697
|
static serviceUnavailable(opts) {
|
|
625
698
|
return new NextlyError({
|
|
626
699
|
code: "SERVICE_UNAVAILABLE",
|
|
@@ -693,7 +766,7 @@ var NextlyError = class NextlyError extends Error {
|
|
|
693
766
|
return NextlyError.isCode(err, "RATE_LIMITED");
|
|
694
767
|
}
|
|
695
768
|
};
|
|
696
|
-
// ../nextly/dist/validate-external-url-
|
|
769
|
+
// ../nextly/dist/validate-external-url-DpPuwVvV.mjs
|
|
697
770
|
/** Default response body cap: reject anything larger before buffering it all. */
|
|
698
771
|
/**
|
|
699
772
|
* How many bytes a bounded external read may buffer, absent a caller's own cap.
|