@nextlyhq/storage-vercel-blob 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 +5 -5
- package/dist/index.cjs +124 -19
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +124 -19
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -70,11 +70,11 @@ The admin uploader hands the file to the browser-side SDK, which uploads directl
|
|
|
70
70
|
|
|
71
71
|
## Compatibility
|
|
72
72
|
|
|
73
|
-
| Tool | Version
|
|
74
|
-
| -------------- |
|
|
75
|
-
| Node.js | 20+
|
|
76
|
-
| `@vercel/blob` | peer
|
|
77
|
-
| `nextly` | 0.0.x
|
|
73
|
+
| Tool | Version |
|
|
74
|
+
| -------------- | --------------------- |
|
|
75
|
+
| Node.js | 20.19+, 22.12+ or 24+ |
|
|
76
|
+
| `@vercel/blob` | peer |
|
|
77
|
+
| `nextly` | 0.0.x |
|
|
78
78
|
|
|
79
79
|
## Documentation
|
|
80
80
|
|
package/dist/index.cjs
CHANGED
|
@@ -4,7 +4,7 @@ var blob = require('@vercel/blob');
|
|
|
4
4
|
|
|
5
5
|
// src/adapter.ts
|
|
6
6
|
|
|
7
|
-
// ../nextly/dist/chunk-
|
|
7
|
+
// ../nextly/dist/chunk-UF2PDDU4.mjs
|
|
8
8
|
function isDbError(err) {
|
|
9
9
|
if (!err || typeof err !== "object") return false;
|
|
10
10
|
const obj = err;
|
|
@@ -17,9 +17,18 @@ var NEXTLY_ERROR_STATUS = {
|
|
|
17
17
|
AUTH_INVALID_CREDENTIALS: 401,
|
|
18
18
|
TOKEN_EXPIRED: 401,
|
|
19
19
|
FORBIDDEN: 403,
|
|
20
|
+
// The password was right and the address is unverified. Distinct from
|
|
21
|
+
// AUTH_INVALID_CREDENTIALS so the login page can offer to resend the link;
|
|
22
|
+
// only a caller who proved the password ever receives it.
|
|
23
|
+
EMAIL_NOT_VERIFIED: 403,
|
|
20
24
|
// The schema builder is off in this environment (production by default).
|
|
21
25
|
// Separate from FORBIDDEN: the caller's permissions are not the problem.
|
|
22
26
|
BUILDER_DISABLED: 403,
|
|
27
|
+
// A cookie-authenticated write whose origin or CSRF token did not check
|
|
28
|
+
// out. Separate from FORBIDDEN for the same reason: the caller may hold
|
|
29
|
+
// every permission, and a client can recover by reloading, not by asking
|
|
30
|
+
// an administrator for access.
|
|
31
|
+
CSRF_FAILED: 403,
|
|
23
32
|
NOT_FOUND: 404,
|
|
24
33
|
CONFLICT: 409,
|
|
25
34
|
DUPLICATE: 409,
|
|
@@ -79,20 +88,33 @@ var NEXTLY_ERROR_STATUS = {
|
|
|
79
88
|
NEXTLY_CORE_DESTRUCTIVE_REFUSED: 409,
|
|
80
89
|
NEXTLY_MIGRATION_DRIFT: 409,
|
|
81
90
|
NEXTLY_MIGRATION_APPLY_FAILED: 500,
|
|
82
|
-
//
|
|
91
|
+
// A SQLite migration unit would leave a row referencing a row that does
|
|
92
|
+
// not exist, or could not switch foreign-key enforcement off to run.
|
|
93
|
+
NEXTLY_MIGRATION_FOREIGN_KEY_VIOLATION: 409,
|
|
94
|
+
// A migration unit marked to run outside a transaction failed part-way;
|
|
95
|
+
// the statements before the failing one stayed applied.
|
|
96
|
+
NEXTLY_MIGRATION_PARTIALLY_APPLIED: 500,
|
|
97
|
+
// Another run recorded the same migration applied, or rolled back, while
|
|
98
|
+
// this one was running it: this run's ledger write lost, and its work is
|
|
99
|
+
// rolled back wherever the transaction can undo it.
|
|
100
|
+
NEXTLY_MIGRATION_CONCURRENT_RUN: 409,
|
|
101
|
+
// `nextly migrate:resolve`, the recovery command.
|
|
83
102
|
NEXTLY_MIGRATION_FILE_MISSING: 404,
|
|
84
103
|
NEXTLY_MIGRATION_SNAPSHOT_MISSING: 404,
|
|
85
104
|
NEXTLY_MIGRATION_RESOLVE_DRIFT: 409,
|
|
86
105
|
NEXTLY_MIGRATION_RESOLVE_PRECONDITION: 409,
|
|
87
|
-
//
|
|
106
|
+
// The Builder's UI schema.
|
|
88
107
|
NEXTLY_UI_SCHEMA_INVALID: 400,
|
|
89
108
|
NEXTLY_SCHEMA_SLUG_COLLISION: 409,
|
|
90
109
|
NEXTLY_SCHEMA_RELATION_TARGET_MISSING: 400,
|
|
91
|
-
//
|
|
110
|
+
// A declared table's relation names a table or column the registry does
|
|
111
|
+
// not have once every table is registered.
|
|
112
|
+
NEXTLY_SCHEMA_RELATION_UNRESOLVED: 400,
|
|
113
|
+
// Plugin schema: `contributes.extend` and relations.
|
|
92
114
|
NEXTLY_SCHEMA_EXTEND_TARGET_UNKNOWN: 400,
|
|
93
115
|
NEXTLY_SCHEMA_EXTEND_FIELD_DUPLICATE: 409,
|
|
94
116
|
NEXTLY_SCHEMA_CROSS_PLUGIN_RELATION: 409,
|
|
95
|
-
// Plugin
|
|
117
|
+
// Plugin schema: the framework remap (`.rename()`).
|
|
96
118
|
NEXTLY_SCHEMA_RENAME_UNKNOWN_TARGET: 400,
|
|
97
119
|
// Plugin platform — a declared admin.clientConfig that cannot be delivered
|
|
98
120
|
// to the browser, refused at boot rather than serialized mangled.
|
|
@@ -102,11 +124,56 @@ var NEXTLY_ERROR_STATUS = {
|
|
|
102
124
|
// `/api/admin-meta/workspace` payload: a value `JSON.stringify` throws on
|
|
103
125
|
// fails that request for every admin, not just the widget's own card.
|
|
104
126
|
NEXTLY_PLUGIN_ADMIN_WIDGET_INVALID: 500,
|
|
127
|
+
// A plugin's document view cannot be routed: a malformed or reserved path,
|
|
128
|
+
// or one two declarations claim on the same document. Refused at boot.
|
|
129
|
+
NEXTLY_PLUGIN_DOCUMENT_VIEW_INVALID: 500,
|
|
105
130
|
// Plugin platform (P0) — boot-time plugin dependency/version resolution.
|
|
106
131
|
PLUGIN_RESOLUTION_ERROR: 500,
|
|
132
|
+
// Plugin schema lifecycle. All 409: each is a state
|
|
133
|
+
// the database and the config disagree about, which retrying cannot change
|
|
134
|
+
// and an operator command resolves.
|
|
135
|
+
PLUGIN_DEPENDENCY_NOT_INSTALLED: 409,
|
|
136
|
+
PLUGIN_HAS_DEPENDENTS: 409,
|
|
137
|
+
PLUGIN_UNINSTALL_IRREVERSIBLE: 409,
|
|
138
|
+
// A full uninstall that would drop tables, run without `--yes`.
|
|
139
|
+
PLUGIN_UNINSTALL_UNCONFIRMED: 409,
|
|
140
|
+
PLUGIN_SCHEMA_BEHIND: 409,
|
|
141
|
+
PLUGIN_SCHEMA_UNINSTALLED: 409,
|
|
142
|
+
// A configured plugin `nextly plugins install` has not recorded as
|
|
143
|
+
// installed, refused at a production boot.
|
|
144
|
+
PLUGIN_NOT_INSTALLED: 409,
|
|
145
|
+
PLUGIN_DISABLED: 409,
|
|
146
|
+
// An uninstall that began and did not finish: refused at boot, and when
|
|
147
|
+
// run again the other way (with or without `--keep-data`).
|
|
148
|
+
PLUGIN_UNINSTALL_UNFINISHED: 409,
|
|
149
|
+
PLUGIN_SCHEMA_VERSION_NOT_ADVANCED: 409,
|
|
150
|
+
// A generated plugin migration that would drop a table or column the
|
|
151
|
+
// plugin's earlier modules created: a rename comes out as a drop and an add.
|
|
152
|
+
PLUGIN_MIGRATION_DROPS_CREATED_SCHEMA: 409,
|
|
153
|
+
// A generated plugin migration that would add a NOT NULL column with no
|
|
154
|
+
// default to a table its earlier modules created: existing rows have no
|
|
155
|
+
// value for it.
|
|
156
|
+
PLUGIN_MIGRATION_ADDS_UNFILLABLE_COLUMN: 409,
|
|
157
|
+
// A plugin migration that changes the schema on a dialect with no
|
|
158
|
+
// statements for it: its author's SQL was never written.
|
|
159
|
+
PLUGIN_MIGRATION_SQL_MISSING: 409,
|
|
160
|
+
PLUGIN_MIGRATIONS_UNAVAILABLE: 409,
|
|
161
|
+
// A migration would drop or rename a table or column another owner holds
|
|
162
|
+
// (or, for a plugin, a table no owner row claims), or names a drop target
|
|
163
|
+
// the guard cannot read — refused for the same reason.
|
|
164
|
+
DROP_OF_FOREIGN_TABLE: 409,
|
|
165
|
+
// A plugin migration module whose content no longer matches its checksum.
|
|
166
|
+
MIGRATION_CHECKSUM_MISMATCH: 409,
|
|
107
167
|
// Plugin platform (P4) — contributes.routes collection (D25).
|
|
108
168
|
NEXTLY_ROUTE_COLLISION: 409,
|
|
109
169
|
NEXTLY_ROUTE_INVALID_PATH: 400,
|
|
170
|
+
// A root-mounted route declared where the request pipeline never reaches the
|
|
171
|
+
// root pass. 400 like an invalid path and not 409: nothing else claims the
|
|
172
|
+
// address, the declaration simply cannot be served from there.
|
|
173
|
+
NEXTLY_ROUTE_UNREACHABLE_ROOT: 400,
|
|
174
|
+
// A `mount` outside the declared union, which only an untyped caller can
|
|
175
|
+
// produce. 400 for the same reason: the declaration itself is unserveable.
|
|
176
|
+
NEXTLY_ROUTE_INVALID_MOUNT: 400,
|
|
110
177
|
// An email transport whose library is an optional peer dependency the host
|
|
111
178
|
// has not installed. 503 rather than 500: the request is not malformed and
|
|
112
179
|
// nothing is broken, the install simply cannot carry it out yet, and the
|
|
@@ -116,7 +183,16 @@ var NEXTLY_ERROR_STATUS = {
|
|
|
116
183
|
// has not installed. 503 rather than 500 for the same reason as the mail
|
|
117
184
|
// transport above: nothing is broken and the request is not malformed, the
|
|
118
185
|
// install simply cannot carry it out until one command is run.
|
|
119
|
-
NEXTLY_CONFIG_TOOLING_UNAVAILABLE: 503
|
|
186
|
+
NEXTLY_CONFIG_TOOLING_UNAVAILABLE: 503,
|
|
187
|
+
// `db.postgres.schema` names one schema and the adapter the application
|
|
188
|
+
// supplied writes to another. 500 like the other boot-time configuration
|
|
189
|
+
// refusals: no request caused it, and the fix is a change to the server's
|
|
190
|
+
// own configuration.
|
|
191
|
+
NEXTLY_POSTGRES_SCHEMA_MISMATCH: 500,
|
|
192
|
+
// `db.postgres.schema` names a schema other than `public`, which the schema
|
|
193
|
+
// push cannot yet create tables in. 500 for the same reason as the mismatch
|
|
194
|
+
// above: a boot-time refusal of the server's own configuration.
|
|
195
|
+
NEXTLY_POSTGRES_SCHEMA_UNSUPPORTED: 500
|
|
120
196
|
};
|
|
121
197
|
var CANONICAL_CODE_FOR_STATUS = [
|
|
122
198
|
"VALIDATION_ERROR",
|
|
@@ -269,6 +345,20 @@ var NextlyError = class _NextlyError extends Error {
|
|
|
269
345
|
logContext: opts?.logContext
|
|
270
346
|
});
|
|
271
347
|
}
|
|
348
|
+
/**
|
|
349
|
+
* The password was correct and the address is unverified. Thrown only once
|
|
350
|
+
* the password is proven, so only someone who holds it learns the address
|
|
351
|
+
* is unverified; every other refusal stays
|
|
352
|
+
* {@link NextlyError.invalidCredentials}.
|
|
353
|
+
*/
|
|
354
|
+
static emailNotVerified(opts) {
|
|
355
|
+
return new _NextlyError({
|
|
356
|
+
code: "EMAIL_NOT_VERIFIED",
|
|
357
|
+
publicMessage: "Verify your email address to sign in. Check your inbox for the link.",
|
|
358
|
+
logMessage: "Login refused: email not verified",
|
|
359
|
+
logContext: opts?.logContext
|
|
360
|
+
});
|
|
361
|
+
}
|
|
272
362
|
static authRequired(opts) {
|
|
273
363
|
return new _NextlyError({
|
|
274
364
|
code: "AUTH_REQUIRED",
|
|
@@ -306,6 +396,19 @@ var NextlyError = class _NextlyError extends Error {
|
|
|
306
396
|
logContext: opts?.logContext
|
|
307
397
|
});
|
|
308
398
|
}
|
|
399
|
+
/**
|
|
400
|
+
* A cookie-authenticated write refused because its origin or CSRF token did
|
|
401
|
+
* not check out. The public message names no detail of which check failed;
|
|
402
|
+
* that goes to the log through `logMessage`.
|
|
403
|
+
*/
|
|
404
|
+
static csrfFailed(opts) {
|
|
405
|
+
return new _NextlyError({
|
|
406
|
+
code: "CSRF_FAILED",
|
|
407
|
+
publicMessage: "This request could not be verified. Reload the page and try again.",
|
|
408
|
+
logMessage: opts?.logMessage,
|
|
409
|
+
logContext: opts?.logContext
|
|
410
|
+
});
|
|
411
|
+
}
|
|
309
412
|
/**
|
|
310
413
|
* A call the caller got wrong, where naming the mistake IS the value of the
|
|
311
414
|
* error.
|
|
@@ -444,7 +547,7 @@ var NextlyError = class _NextlyError extends Error {
|
|
|
444
547
|
}
|
|
445
548
|
};
|
|
446
549
|
|
|
447
|
-
// ../nextly/dist/chunk-
|
|
550
|
+
// ../nextly/dist/chunk-V6N5XUUA.mjs
|
|
448
551
|
var StorageReadTooLargeError = class extends NextlyError {
|
|
449
552
|
constructor(path, maxBytes, size) {
|
|
450
553
|
super({
|
|
@@ -462,7 +565,20 @@ var StorageReadTooLargeError = class extends NextlyError {
|
|
|
462
565
|
}
|
|
463
566
|
};
|
|
464
567
|
|
|
465
|
-
// ../nextly/dist/chunk-
|
|
568
|
+
// ../nextly/dist/chunk-FLULBGQB.mjs
|
|
569
|
+
function ipv4ToInt(ip) {
|
|
570
|
+
const parts = ip.split(".");
|
|
571
|
+
if (parts.length !== 4) return null;
|
|
572
|
+
let acc = 0;
|
|
573
|
+
for (const p of parts) {
|
|
574
|
+
const n = Number(p);
|
|
575
|
+
if (!Number.isInteger(n) || n < 0 || n > 255) return null;
|
|
576
|
+
acc = acc << 8 | n;
|
|
577
|
+
}
|
|
578
|
+
return acc >>> 0;
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
// ../nextly/dist/chunk-FKT4HLI3.mjs
|
|
466
582
|
var 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)$/;
|
|
467
583
|
var PRIVATE_IPV4_CIDRS = [
|
|
468
584
|
"0.0.0.0/8",
|
|
@@ -848,17 +964,6 @@ function errorCode(err) {
|
|
|
848
964
|
}
|
|
849
965
|
return void 0;
|
|
850
966
|
}
|
|
851
|
-
function ipv4ToInt(ip) {
|
|
852
|
-
const parts = ip.split(".");
|
|
853
|
-
if (parts.length !== 4) return null;
|
|
854
|
-
let acc = 0;
|
|
855
|
-
for (const p of parts) {
|
|
856
|
-
const n = Number(p);
|
|
857
|
-
if (!Number.isInteger(n) || n < 0 || n > 255) return null;
|
|
858
|
-
acc = acc << 8 | n;
|
|
859
|
-
}
|
|
860
|
-
return acc >>> 0;
|
|
861
|
-
}
|
|
862
967
|
function isIpv4InCidr(intIp, cidr) {
|
|
863
968
|
const [addr, prefixRaw] = cidr.split("/");
|
|
864
969
|
const intCidr = ipv4ToInt(addr);
|