@nextlyhq/storage-s3 0.0.2-alpha.65 → 0.0.2-alpha.67
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/README.md +7 -7
- package/dist/index.cjs +111 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +111 -8
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @nextlyhq/storage-s3
|
|
2
2
|
|
|
3
|
-
Amazon S3 (and S3-compatible: Cloudflare R2, MinIO,
|
|
3
|
+
Amazon S3 (and S3-compatible: Cloudflare R2, MinIO, DigitalOcean Spaces) storage adapter for Nextly.
|
|
4
4
|
|
|
5
5
|
<p align="center">
|
|
6
6
|
<a href="https://www.npmjs.com/package/@nextlyhq/storage-s3"><img alt="npm" src="https://img.shields.io/npm/v/@nextlyhq/storage-s3?style=flat-square&label=npm&color=cb3837" /></a>
|
|
@@ -13,7 +13,7 @@ Amazon S3 (and S3-compatible: Cloudflare R2, MinIO, Backblaze B2, Wasabi, Digita
|
|
|
13
13
|
|
|
14
14
|
## What it is
|
|
15
15
|
|
|
16
|
-
Stores Nextly media uploads on Amazon S3 or
|
|
16
|
+
Stores Nextly media uploads on Amazon S3 or an S3-compatible object store. Cloudflare R2, MinIO and DigitalOcean Spaces all work via the same adapter; you do not need separate packages.
|
|
17
17
|
|
|
18
18
|
> **You do not need this for development.** Nextly's default storage is local disk under `./public/uploads/`. Install this when you are ready to move uploads to a cloud object store, typically for production deployments.
|
|
19
19
|
|
|
@@ -109,11 +109,11 @@ s3Storage({
|
|
|
109
109
|
|
|
110
110
|
## Compatibility
|
|
111
111
|
|
|
112
|
-
| Tool | Version
|
|
113
|
-
| -------- |
|
|
114
|
-
| Node.js | 20+
|
|
115
|
-
| `nextly` | 0.0.x
|
|
116
|
-
| Stores | AWS S3, Cloudflare R2, MinIO,
|
|
112
|
+
| Tool | Version |
|
|
113
|
+
| -------- | ------------------------------------------------- |
|
|
114
|
+
| Node.js | 20.19+, 22.12+ or 24+ |
|
|
115
|
+
| `nextly` | 0.0.x |
|
|
116
|
+
| Stores | AWS S3, Cloudflare R2, MinIO, DigitalOcean Spaces |
|
|
117
117
|
|
|
118
118
|
## Documentation
|
|
119
119
|
|
package/dist/index.cjs
CHANGED
|
@@ -6,7 +6,7 @@ var s3RequestPresigner = require('@aws-sdk/s3-request-presigner');
|
|
|
6
6
|
|
|
7
7
|
// src/adapter.ts
|
|
8
8
|
|
|
9
|
-
// ../nextly/dist/chunk-
|
|
9
|
+
// ../nextly/dist/chunk-UF2PDDU4.mjs
|
|
10
10
|
function isDbError(err) {
|
|
11
11
|
if (!err || typeof err !== "object") return false;
|
|
12
12
|
const obj = err;
|
|
@@ -19,9 +19,18 @@ var NEXTLY_ERROR_STATUS = {
|
|
|
19
19
|
AUTH_INVALID_CREDENTIALS: 401,
|
|
20
20
|
TOKEN_EXPIRED: 401,
|
|
21
21
|
FORBIDDEN: 403,
|
|
22
|
+
// The password was right and the address is unverified. Distinct from
|
|
23
|
+
// AUTH_INVALID_CREDENTIALS so the login page can offer to resend the link;
|
|
24
|
+
// only a caller who proved the password ever receives it.
|
|
25
|
+
EMAIL_NOT_VERIFIED: 403,
|
|
22
26
|
// The schema builder is off in this environment (production by default).
|
|
23
27
|
// Separate from FORBIDDEN: the caller's permissions are not the problem.
|
|
24
28
|
BUILDER_DISABLED: 403,
|
|
29
|
+
// A cookie-authenticated write whose origin or CSRF token did not check
|
|
30
|
+
// out. Separate from FORBIDDEN for the same reason: the caller may hold
|
|
31
|
+
// every permission, and a client can recover by reloading, not by asking
|
|
32
|
+
// an administrator for access.
|
|
33
|
+
CSRF_FAILED: 403,
|
|
25
34
|
NOT_FOUND: 404,
|
|
26
35
|
CONFLICT: 409,
|
|
27
36
|
DUPLICATE: 409,
|
|
@@ -81,20 +90,33 @@ var NEXTLY_ERROR_STATUS = {
|
|
|
81
90
|
NEXTLY_CORE_DESTRUCTIVE_REFUSED: 409,
|
|
82
91
|
NEXTLY_MIGRATION_DRIFT: 409,
|
|
83
92
|
NEXTLY_MIGRATION_APPLY_FAILED: 500,
|
|
84
|
-
//
|
|
93
|
+
// A SQLite migration unit would leave a row referencing a row that does
|
|
94
|
+
// not exist, or could not switch foreign-key enforcement off to run.
|
|
95
|
+
NEXTLY_MIGRATION_FOREIGN_KEY_VIOLATION: 409,
|
|
96
|
+
// A migration unit marked to run outside a transaction failed part-way;
|
|
97
|
+
// the statements before the failing one stayed applied.
|
|
98
|
+
NEXTLY_MIGRATION_PARTIALLY_APPLIED: 500,
|
|
99
|
+
// Another run recorded the same migration applied, or rolled back, while
|
|
100
|
+
// this one was running it: this run's ledger write lost, and its work is
|
|
101
|
+
// rolled back wherever the transaction can undo it.
|
|
102
|
+
NEXTLY_MIGRATION_CONCURRENT_RUN: 409,
|
|
103
|
+
// `nextly migrate:resolve`, the recovery command.
|
|
85
104
|
NEXTLY_MIGRATION_FILE_MISSING: 404,
|
|
86
105
|
NEXTLY_MIGRATION_SNAPSHOT_MISSING: 404,
|
|
87
106
|
NEXTLY_MIGRATION_RESOLVE_DRIFT: 409,
|
|
88
107
|
NEXTLY_MIGRATION_RESOLVE_PRECONDITION: 409,
|
|
89
|
-
//
|
|
108
|
+
// The Builder's UI schema.
|
|
90
109
|
NEXTLY_UI_SCHEMA_INVALID: 400,
|
|
91
110
|
NEXTLY_SCHEMA_SLUG_COLLISION: 409,
|
|
92
111
|
NEXTLY_SCHEMA_RELATION_TARGET_MISSING: 400,
|
|
93
|
-
//
|
|
112
|
+
// A declared table's relation names a table or column the registry does
|
|
113
|
+
// not have once every table is registered.
|
|
114
|
+
NEXTLY_SCHEMA_RELATION_UNRESOLVED: 400,
|
|
115
|
+
// Plugin schema: `contributes.extend` and relations.
|
|
94
116
|
NEXTLY_SCHEMA_EXTEND_TARGET_UNKNOWN: 400,
|
|
95
117
|
NEXTLY_SCHEMA_EXTEND_FIELD_DUPLICATE: 409,
|
|
96
118
|
NEXTLY_SCHEMA_CROSS_PLUGIN_RELATION: 409,
|
|
97
|
-
// Plugin
|
|
119
|
+
// Plugin schema: the framework remap (`.rename()`).
|
|
98
120
|
NEXTLY_SCHEMA_RENAME_UNKNOWN_TARGET: 400,
|
|
99
121
|
// Plugin platform — a declared admin.clientConfig that cannot be delivered
|
|
100
122
|
// to the browser, refused at boot rather than serialized mangled.
|
|
@@ -104,11 +126,56 @@ var NEXTLY_ERROR_STATUS = {
|
|
|
104
126
|
// `/api/admin-meta/workspace` payload: a value `JSON.stringify` throws on
|
|
105
127
|
// fails that request for every admin, not just the widget's own card.
|
|
106
128
|
NEXTLY_PLUGIN_ADMIN_WIDGET_INVALID: 500,
|
|
129
|
+
// A plugin's document view cannot be routed: a malformed or reserved path,
|
|
130
|
+
// or one two declarations claim on the same document. Refused at boot.
|
|
131
|
+
NEXTLY_PLUGIN_DOCUMENT_VIEW_INVALID: 500,
|
|
107
132
|
// Plugin platform (P0) — boot-time plugin dependency/version resolution.
|
|
108
133
|
PLUGIN_RESOLUTION_ERROR: 500,
|
|
134
|
+
// Plugin schema lifecycle. All 409: each is a state
|
|
135
|
+
// the database and the config disagree about, which retrying cannot change
|
|
136
|
+
// and an operator command resolves.
|
|
137
|
+
PLUGIN_DEPENDENCY_NOT_INSTALLED: 409,
|
|
138
|
+
PLUGIN_HAS_DEPENDENTS: 409,
|
|
139
|
+
PLUGIN_UNINSTALL_IRREVERSIBLE: 409,
|
|
140
|
+
// A full uninstall that would drop tables, run without `--yes`.
|
|
141
|
+
PLUGIN_UNINSTALL_UNCONFIRMED: 409,
|
|
142
|
+
PLUGIN_SCHEMA_BEHIND: 409,
|
|
143
|
+
PLUGIN_SCHEMA_UNINSTALLED: 409,
|
|
144
|
+
// A configured plugin `nextly plugins install` has not recorded as
|
|
145
|
+
// installed, refused at a production boot.
|
|
146
|
+
PLUGIN_NOT_INSTALLED: 409,
|
|
147
|
+
PLUGIN_DISABLED: 409,
|
|
148
|
+
// An uninstall that began and did not finish: refused at boot, and when
|
|
149
|
+
// run again the other way (with or without `--keep-data`).
|
|
150
|
+
PLUGIN_UNINSTALL_UNFINISHED: 409,
|
|
151
|
+
PLUGIN_SCHEMA_VERSION_NOT_ADVANCED: 409,
|
|
152
|
+
// A generated plugin migration that would drop a table or column the
|
|
153
|
+
// plugin's earlier modules created: a rename comes out as a drop and an add.
|
|
154
|
+
PLUGIN_MIGRATION_DROPS_CREATED_SCHEMA: 409,
|
|
155
|
+
// A generated plugin migration that would add a NOT NULL column with no
|
|
156
|
+
// default to a table its earlier modules created: existing rows have no
|
|
157
|
+
// value for it.
|
|
158
|
+
PLUGIN_MIGRATION_ADDS_UNFILLABLE_COLUMN: 409,
|
|
159
|
+
// A plugin migration that changes the schema on a dialect with no
|
|
160
|
+
// statements for it: its author's SQL was never written.
|
|
161
|
+
PLUGIN_MIGRATION_SQL_MISSING: 409,
|
|
162
|
+
PLUGIN_MIGRATIONS_UNAVAILABLE: 409,
|
|
163
|
+
// A migration would drop or rename a table or column another owner holds
|
|
164
|
+
// (or, for a plugin, a table no owner row claims), or names a drop target
|
|
165
|
+
// the guard cannot read — refused for the same reason.
|
|
166
|
+
DROP_OF_FOREIGN_TABLE: 409,
|
|
167
|
+
// A plugin migration module whose content no longer matches its checksum.
|
|
168
|
+
MIGRATION_CHECKSUM_MISMATCH: 409,
|
|
109
169
|
// Plugin platform (P4) — contributes.routes collection (D25).
|
|
110
170
|
NEXTLY_ROUTE_COLLISION: 409,
|
|
111
171
|
NEXTLY_ROUTE_INVALID_PATH: 400,
|
|
172
|
+
// A root-mounted route declared where the request pipeline never reaches the
|
|
173
|
+
// root pass. 400 like an invalid path and not 409: nothing else claims the
|
|
174
|
+
// address, the declaration simply cannot be served from there.
|
|
175
|
+
NEXTLY_ROUTE_UNREACHABLE_ROOT: 400,
|
|
176
|
+
// A `mount` outside the declared union, which only an untyped caller can
|
|
177
|
+
// produce. 400 for the same reason: the declaration itself is unserveable.
|
|
178
|
+
NEXTLY_ROUTE_INVALID_MOUNT: 400,
|
|
112
179
|
// An email transport whose library is an optional peer dependency the host
|
|
113
180
|
// has not installed. 503 rather than 500: the request is not malformed and
|
|
114
181
|
// nothing is broken, the install simply cannot carry it out yet, and the
|
|
@@ -118,7 +185,16 @@ var NEXTLY_ERROR_STATUS = {
|
|
|
118
185
|
// has not installed. 503 rather than 500 for the same reason as the mail
|
|
119
186
|
// transport above: nothing is broken and the request is not malformed, the
|
|
120
187
|
// install simply cannot carry it out until one command is run.
|
|
121
|
-
NEXTLY_CONFIG_TOOLING_UNAVAILABLE: 503
|
|
188
|
+
NEXTLY_CONFIG_TOOLING_UNAVAILABLE: 503,
|
|
189
|
+
// `db.postgres.schema` names one schema and the adapter the application
|
|
190
|
+
// supplied writes to another. 500 like the other boot-time configuration
|
|
191
|
+
// refusals: no request caused it, and the fix is a change to the server's
|
|
192
|
+
// own configuration.
|
|
193
|
+
NEXTLY_POSTGRES_SCHEMA_MISMATCH: 500,
|
|
194
|
+
// `db.postgres.schema` names a schema other than `public`, which the schema
|
|
195
|
+
// push cannot yet create tables in. 500 for the same reason as the mismatch
|
|
196
|
+
// above: a boot-time refusal of the server's own configuration.
|
|
197
|
+
NEXTLY_POSTGRES_SCHEMA_UNSUPPORTED: 500
|
|
122
198
|
};
|
|
123
199
|
var CANONICAL_CODE_FOR_STATUS = [
|
|
124
200
|
"VALIDATION_ERROR",
|
|
@@ -271,6 +347,20 @@ var NextlyError = class _NextlyError extends Error {
|
|
|
271
347
|
logContext: opts?.logContext
|
|
272
348
|
});
|
|
273
349
|
}
|
|
350
|
+
/**
|
|
351
|
+
* The password was correct and the address is unverified. Thrown only once
|
|
352
|
+
* the password is proven, so only someone who holds it learns the address
|
|
353
|
+
* is unverified; every other refusal stays
|
|
354
|
+
* {@link NextlyError.invalidCredentials}.
|
|
355
|
+
*/
|
|
356
|
+
static emailNotVerified(opts) {
|
|
357
|
+
return new _NextlyError({
|
|
358
|
+
code: "EMAIL_NOT_VERIFIED",
|
|
359
|
+
publicMessage: "Verify your email address to sign in. Check your inbox for the link.",
|
|
360
|
+
logMessage: "Login refused: email not verified",
|
|
361
|
+
logContext: opts?.logContext
|
|
362
|
+
});
|
|
363
|
+
}
|
|
274
364
|
static authRequired(opts) {
|
|
275
365
|
return new _NextlyError({
|
|
276
366
|
code: "AUTH_REQUIRED",
|
|
@@ -308,6 +398,19 @@ var NextlyError = class _NextlyError extends Error {
|
|
|
308
398
|
logContext: opts?.logContext
|
|
309
399
|
});
|
|
310
400
|
}
|
|
401
|
+
/**
|
|
402
|
+
* A cookie-authenticated write refused because its origin or CSRF token did
|
|
403
|
+
* not check out. The public message names no detail of which check failed;
|
|
404
|
+
* that goes to the log through `logMessage`.
|
|
405
|
+
*/
|
|
406
|
+
static csrfFailed(opts) {
|
|
407
|
+
return new _NextlyError({
|
|
408
|
+
code: "CSRF_FAILED",
|
|
409
|
+
publicMessage: "This request could not be verified. Reload the page and try again.",
|
|
410
|
+
logMessage: opts?.logMessage,
|
|
411
|
+
logContext: opts?.logContext
|
|
412
|
+
});
|
|
413
|
+
}
|
|
311
414
|
/**
|
|
312
415
|
* A call the caller got wrong, where naming the mistake IS the value of the
|
|
313
416
|
* error.
|
|
@@ -446,7 +549,7 @@ var NextlyError = class _NextlyError extends Error {
|
|
|
446
549
|
}
|
|
447
550
|
};
|
|
448
551
|
|
|
449
|
-
// ../nextly/dist/chunk-
|
|
552
|
+
// ../nextly/dist/chunk-V6N5XUUA.mjs
|
|
450
553
|
var StorageReadTooLargeError = class extends NextlyError {
|
|
451
554
|
constructor(path, maxBytes, size) {
|
|
452
555
|
super({
|
|
@@ -464,7 +567,7 @@ var StorageReadTooLargeError = class extends NextlyError {
|
|
|
464
567
|
}
|
|
465
568
|
};
|
|
466
569
|
|
|
467
|
-
// ../nextly/dist/chunk-
|
|
570
|
+
// ../nextly/dist/chunk-FKT4HLI3.mjs
|
|
468
571
|
var DEFAULT_MAX_RESPONSE_BYTES = 10 * 1024 * 1024;
|
|
469
572
|
var DEFAULT_TIMEOUT_MS = 3e4;
|
|
470
573
|
var DEFAULT_READ_TIMEOUT_MS = DEFAULT_TIMEOUT_MS;
|