@nextlyhq/storage-vercel-blob 0.0.2-alpha.66 → 0.0.2-alpha.68
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 +118 -19
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +118 -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-NY7DNPQY.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,8 +124,46 @@ 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,
|
|
@@ -123,7 +183,16 @@ var NEXTLY_ERROR_STATUS = {
|
|
|
123
183
|
// has not installed. 503 rather than 500 for the same reason as the mail
|
|
124
184
|
// transport above: nothing is broken and the request is not malformed, the
|
|
125
185
|
// install simply cannot carry it out until one command is run.
|
|
126
|
-
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
|
|
127
196
|
};
|
|
128
197
|
var CANONICAL_CODE_FOR_STATUS = [
|
|
129
198
|
"VALIDATION_ERROR",
|
|
@@ -276,6 +345,20 @@ var NextlyError = class _NextlyError extends Error {
|
|
|
276
345
|
logContext: opts?.logContext
|
|
277
346
|
});
|
|
278
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
|
+
}
|
|
279
362
|
static authRequired(opts) {
|
|
280
363
|
return new _NextlyError({
|
|
281
364
|
code: "AUTH_REQUIRED",
|
|
@@ -313,6 +396,19 @@ var NextlyError = class _NextlyError extends Error {
|
|
|
313
396
|
logContext: opts?.logContext
|
|
314
397
|
});
|
|
315
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
|
+
}
|
|
316
412
|
/**
|
|
317
413
|
* A call the caller got wrong, where naming the mistake IS the value of the
|
|
318
414
|
* error.
|
|
@@ -344,6 +440,7 @@ var NextlyError = class _NextlyError extends Error {
|
|
|
344
440
|
return new _NextlyError({
|
|
345
441
|
code: "CONFLICT",
|
|
346
442
|
publicMessage: opts?.message ?? "The resource has changed since you last loaded it. Please refresh and try again.",
|
|
443
|
+
publicData: opts?.data,
|
|
347
444
|
cause: opts?.cause,
|
|
348
445
|
logContext: { reason: opts?.reason, ...opts?.logContext }
|
|
349
446
|
});
|
|
@@ -451,7 +548,7 @@ var NextlyError = class _NextlyError extends Error {
|
|
|
451
548
|
}
|
|
452
549
|
};
|
|
453
550
|
|
|
454
|
-
// ../nextly/dist/chunk-
|
|
551
|
+
// ../nextly/dist/chunk-RCQ3Z2YP.mjs
|
|
455
552
|
var StorageReadTooLargeError = class extends NextlyError {
|
|
456
553
|
constructor(path, maxBytes, size) {
|
|
457
554
|
super({
|
|
@@ -469,7 +566,20 @@ var StorageReadTooLargeError = class extends NextlyError {
|
|
|
469
566
|
}
|
|
470
567
|
};
|
|
471
568
|
|
|
472
|
-
// ../nextly/dist/chunk-
|
|
569
|
+
// ../nextly/dist/chunk-FLULBGQB.mjs
|
|
570
|
+
function ipv4ToInt(ip) {
|
|
571
|
+
const parts = ip.split(".");
|
|
572
|
+
if (parts.length !== 4) return null;
|
|
573
|
+
let acc = 0;
|
|
574
|
+
for (const p of parts) {
|
|
575
|
+
const n = Number(p);
|
|
576
|
+
if (!Number.isInteger(n) || n < 0 || n > 255) return null;
|
|
577
|
+
acc = acc << 8 | n;
|
|
578
|
+
}
|
|
579
|
+
return acc >>> 0;
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
// ../nextly/dist/chunk-W4ZTBBDW.mjs
|
|
473
583
|
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)$/;
|
|
474
584
|
var PRIVATE_IPV4_CIDRS = [
|
|
475
585
|
"0.0.0.0/8",
|
|
@@ -855,17 +965,6 @@ function errorCode(err) {
|
|
|
855
965
|
}
|
|
856
966
|
return void 0;
|
|
857
967
|
}
|
|
858
|
-
function ipv4ToInt(ip) {
|
|
859
|
-
const parts = ip.split(".");
|
|
860
|
-
if (parts.length !== 4) return null;
|
|
861
|
-
let acc = 0;
|
|
862
|
-
for (const p of parts) {
|
|
863
|
-
const n = Number(p);
|
|
864
|
-
if (!Number.isInteger(n) || n < 0 || n > 255) return null;
|
|
865
|
-
acc = acc << 8 | n;
|
|
866
|
-
}
|
|
867
|
-
return acc >>> 0;
|
|
868
|
-
}
|
|
869
968
|
function isIpv4InCidr(intIp, cidr) {
|
|
870
969
|
const [addr, prefixRaw] = cidr.split("/");
|
|
871
970
|
const intCidr = ipv4ToInt(addr);
|