void 1.1.0 → 1.1.11
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/{account-cmd-BTcUzv9L.mjs → account-cmd-R35a4Oa8.mjs} +3 -3
- package/dist/{application-analysis-AB_YYWgH.mjs → application-analysis-D7nNmNJb.mjs} +6 -6
- package/dist/{application-routing-L7V-TFhZ.mjs → application-routing-CZH66gXn.mjs} +1 -1
- package/dist/{auth-link-DUJuvRx5.mjs → auth-link-VHmiKZmP.mjs} +3 -3
- package/dist/{auth-migrations-Cgs0k6lS.mjs → auth-migrations-BO27GDNr.mjs} +38 -2
- package/dist/{auth-router-CIxiMG7i.mjs → auth-router-O_Wrs5kg.mjs} +5 -4
- package/dist/{better-auth-shared-B74NJIus.d.mts → better-auth-shared-Bv18bB-l.d.mts} +2 -0
- package/dist/{better-auth-shared-CMXlZG7W.mjs → better-auth-shared-D-6z0q0f.mjs} +28 -1
- package/dist/{build-cmd-BkIv25PA.mjs → build-cmd-CMZiMn46.mjs} +1 -1
- package/dist/{cache-Ctzfig-W.mjs → cache-TZ5Ab3d7.mjs} +1 -1
- package/dist/{cancel-deploy-CD9o-SsC.mjs → cancel-deploy-DXoR6oC3.mjs} +1 -1
- package/dist/cli/cli.mjs +69 -50
- package/dist/cli/env-schema-probe.mjs +3 -3
- package/dist/client-DrdeJgHR.mjs +1 -0
- package/dist/{client-DM9Kcf4e.mjs → client-GuSO3v_x.mjs} +1 -1
- package/dist/{cloudflare-auth-CqFBDo52.mjs → cloudflare-auth-DSvBc1Gu.mjs} +1 -1
- package/dist/{cloudflare-cmd-BIAF_BIY.mjs → cloudflare-cmd-ZSErUl6Y.mjs} +3 -3
- package/dist/{cloudflare-config-DV60XFFK.mjs → cloudflare-config-rdFOys4X.mjs} +2 -2
- package/dist/{cloudflare-connect-WjwnVOJA.mjs → cloudflare-connect-BN-k2kD-.mjs} +2 -2
- package/dist/{cloudflare-operations-CrSUFRzJ.mjs → cloudflare-operations-Cm8lVx7W.mjs} +1 -1
- package/dist/{cloudflare-operations-B42EZeJy.mjs → cloudflare-operations-DH3GedbV.mjs} +6 -6
- package/dist/{cloudflare-process-CeDWJRhj.mjs → cloudflare-process-CZJ4viYl.mjs} +2 -2
- package/dist/collect-BWhkgtAn.mjs +1 -0
- package/dist/{collect-xjffdCdk.mjs → collect-Dew86qce.mjs} +4 -3
- package/dist/{config-D0GY5ItR.mjs → config-CyUJzi3q.mjs} +1 -1
- package/dist/{config-Bx_1SpnO.mjs → config-D26zcdKy.mjs} +2 -2
- package/dist/{config-BEm9vRvS.mjs → config-DC5llZaI.mjs} +2 -2
- package/dist/{config-QrJWu0IX.mjs → config-DYJV8aEH.mjs} +1 -1
- package/dist/{connect-CKtk-EZe.mjs → connect-yQuLbuiJ.mjs} +4 -4
- package/dist/{create-project-B-ewF_Af.mjs → create-project-CGOo_OL_.mjs} +1 -1
- package/dist/{create-project-yInGo72M.mjs → create-project-DEEWJX_M.mjs} +1 -1
- package/dist/database-provider.d.mts +6 -0
- package/dist/{db-7I_gfdVq.mjs → db-COI-yTJE.mjs} +255 -110
- package/dist/{db-types-Bb4WBWIs.mjs → db-types-NGxPwnlt.mjs} +1 -1
- package/dist/{delete-Cy-M1u-r.mjs → delete-PgN6L_9N.mjs} +1 -1
- package/dist/deploy-CxNgEYr4.mjs +2 -0
- package/dist/{deploy-BYYlnsiy.mjs → deploy-DsW-PrRQ.mjs} +38 -36
- package/dist/{deploy-managed-static-Ca4TFdmx.mjs → deploy-managed-static-Dqz06S2u.mjs} +20 -20
- package/dist/{deploy-transport-DWlWBe6M.mjs → deploy-transport-nY3vLXPL.mjs} +2 -2
- package/dist/deploy.mjs +5 -5
- package/dist/discover-D4TPKo57.mjs +1 -0
- package/dist/{discover-D2PGT63u.mjs → discover-LaV0tbIu.mjs} +1 -1
- package/dist/{dispatch-DrTTk8Xg.mjs → dispatch-BAbbn3jg.mjs} +6 -6
- package/dist/{domain-CZGxPv9u.mjs → domain-DKlNI0SR.mjs} +2 -2
- package/dist/{drizzle-CF84FOVM.mjs → drizzle-BQfyvQKX.mjs} +13 -2
- package/dist/{email-DzyNVuoU.mjs → email-C0s3OvJk.mjs} +10 -11
- package/dist/{email-cloudflare-DfG6UEMm.mjs → email-cloudflare-etpKiITL.mjs} +7 -10
- package/dist/{entry-ehmBvs5w.mjs → entry-B_0IhV64.mjs} +1 -1
- package/dist/{env-Nx3yf50r.mjs → env-BX2JFsgF.mjs} +4 -4
- package/dist/{env-types-DS2_y4X8.mjs → env-types-GRchm5dw.mjs} +1 -1
- package/dist/{env-validation-BT7z-qpQ.mjs → env-validation-CuGfWRJd.mjs} +1 -1
- package/dist/{env-validation-DYxjz_Wo.mjs → env-validation-D_KyMdab.mjs} +2 -2
- package/dist/{fetch-BPCYVi3H.d.mts → fetch-DHLOuPyk.d.mts} +2 -2
- package/dist/{fetch-stream-obvZ7fvO.d.mts → fetch-stream-CNxOrBdP.d.mts} +1 -1
- package/dist/{gen-CufHEf42.mjs → gen-Bj6ZkOcI.mjs} +25 -19
- package/dist/gen-DsCukhuw.mjs +1 -0
- package/dist/{generate-Dat0UTry.mjs → generate-B1m4Cm4n.mjs} +1 -1
- package/dist/{generate-ClI89brV.mjs → generate-DkEb9rL-.mjs} +1 -1
- package/dist/{github-cmd-FU8EjFyU.mjs → github-cmd-DQDryS-5.mjs} +1 -1
- package/dist/{headers-Di1FsD3e.mjs → headers-Bi4bOAwp.mjs} +1 -1
- package/dist/{help-BT2hovNI.mjs → help-D49SL_lN.mjs} +16 -12
- package/dist/help-DOFygYi4.mjs +1 -0
- package/dist/{inbound-brj2-TM5.d.mts → inbound-Da7XsjH3.d.mts} +6 -12
- package/dist/index.mjs +103 -57
- package/dist/{info-l249eUdH.mjs → info-Bxunp14X.mjs} +4 -4
- package/dist/{init-D0A6M64Q.mjs → init-DyTEY04s.mjs} +50 -27
- package/dist/{link-WMoJFf4i.mjs → link-CgOVn9EC.mjs} +2 -2
- package/dist/{list-CQ2EQEHL.mjs → list-CUfD9RSb.mjs} +2 -2
- package/dist/{local-d1-BxvQYEFi.mjs → local-d1-CpaPbd_L.mjs} +5 -5
- package/dist/{login-C2T1oVG-.mjs → login-BJvGW5Eu.mjs} +2 -2
- package/dist/login-alAlxw4S.mjs +1 -0
- package/dist/{logs-DnC1d7xB.mjs → logs-DeizBI4j.mjs} +2 -2
- package/dist/{migrate-BDIprOYd.mjs → migrate-8rk56vV8.mjs} +4 -4
- package/dist/migrate-D2odrAmh.mjs +1 -0
- package/dist/{neon-n74ta1Pr.mjs → neon-DTZr7Bu7.mjs} +0 -1
- package/dist/nitro.mjs +3 -3
- package/dist/{node-cPadMgUO.mjs → node-uN8_zxJr.mjs} +15 -9
- package/dist/{operator-cmd-DHieWtFp.mjs → operator-cmd-CA5QQyvE.mjs} +3 -3
- package/dist/operator-cmd-D7toMPJ9.mjs +1 -0
- package/dist/pages/client.d.mts +1 -1
- package/dist/pages/index.d.mts +1 -1
- package/dist/pages/index.mjs +4 -4
- package/dist/pages/islands-plugin.d.mts +1 -1
- package/dist/pages/islands-plugin.mjs +1 -1
- package/dist/pages/protocol.d.mts +1 -1
- package/dist/{platform-args-CaCL_1Ch.mjs → platform-args-B7ke06up.mjs} +1 -4
- package/dist/platform-args-B_LrqEZB.mjs +1 -0
- package/dist/{platform-auth-config-Z16-I8nT.mjs → platform-auth-config-CZaY812e.mjs} +3 -3
- package/dist/{platform-auth-protection-BXwZiJSF.mjs → platform-auth-protection-U9HCqoXv.mjs} +2 -2
- package/dist/{platform-auth-recovery-CXjfqyOv.mjs → platform-auth-recovery-B0BV2hfV.mjs} +2 -2
- package/dist/{platform-cmd-DaAOiWTl.mjs → platform-cmd-CXrjk4fb.mjs} +4 -4
- package/dist/{platform-cmd-PT4YwMLM.mjs → platform-cmd-D9lwFpcl.mjs} +1 -1
- package/dist/{platform-domain-CxpvUeo0.mjs → platform-domain-CXyq-68_.mjs} +2 -2
- package/dist/{platform-lifecycle-DBiS0cJd.mjs → platform-lifecycle-D0TdyXbN.mjs} +20 -11
- package/dist/{platform-lifecycle-u9pMOvxC.mjs → platform-lifecycle-Dz2cJsLX.mjs} +1 -1
- package/dist/{platform-management-DvBS83rC.mjs → platform-management-BvgbusqL.mjs} +1 -1
- package/dist/{platform-management-DhEFdQAf.mjs → platform-management-CnXhgxTM.mjs} +1 -3
- package/dist/{platform-recovery-BUGOB4RC.mjs → platform-recovery-CH_fThW6.mjs} +2 -2
- package/dist/{plugin-inference-DsARdQKE.mjs → plugin-inference-Bekzjuqw.mjs} +2 -2
- package/dist/{prepare-PQCgsny0.mjs → prepare-2XD6kh77.mjs} +1 -1
- package/dist/{prepare-DEB5SeVJ.mjs → prepare-DepAGBcV.mjs} +9 -9
- package/dist/prepare-EVEbQ9n2.mjs +1 -0
- package/dist/{project-cmd-DVatD8Ev.mjs → project-cmd-CpLYflCH.mjs} +16 -16
- package/dist/{project-paths-DMvEeSau.mjs → project-paths-DGu_QZ_Q.mjs} +1 -1
- package/dist/{project-team-DJrWEAG1.mjs → project-team-CTSY7W7Q.mjs} +1 -1
- package/dist/{project-token-CBgLBuL6.mjs → project-token-Cybtlfbl.mjs} +1 -1
- package/dist/{project-tsconfig-bveqhlYA.mjs → project-tsconfig-Itv1f4WC.mjs} +1 -1
- package/dist/{project-zero-trust-92gLtZ25.mjs → project-zero-trust-DKOtqyvu.mjs} +1 -1
- package/dist/{protocol-4H7V_3Os.d.mts → protocol-B8sI8dRD.d.mts} +1 -1
- package/dist/{providers-BXuhmuub.mjs → providers-BUHwJlmM.mjs} +10 -1
- package/dist/{provision-BnSSkiED.mjs → provision-BuifYvLc.mjs} +63 -64
- package/dist/provision-UcYjpTRh.mjs +1 -0
- package/dist/r2-conditions-B8xUgJRc.mjs +61 -0
- package/dist/{requests-7W1Pygt2.mjs → requests-Ryiazz9i.mjs} +1 -1
- package/dist/{rollback-BcASVnwP.mjs → rollback-Or0EV3rP.mjs} +2 -2
- package/dist/{runner-CabsQ-iM.mjs → runner-3uGC-oLF.mjs} +9 -7
- package/dist/{runner-So9mYfcm.mjs → runner-WCdfeI0q.mjs} +1 -1
- package/dist/{runner-mysql-BhRaONkO.mjs → runner-mysql-BWmbk5IE.mjs} +1 -1
- package/dist/{runner-mysql-DWwE8jKi.mjs → runner-mysql-BcHnLUuM.mjs} +1 -1
- package/dist/{runner-pg-_Xncr3H5.mjs → runner-pg-Cgp-cr_p.mjs} +1 -1
- package/dist/{runner-pg-BRemq_GX.mjs → runner-pg-Cr3qrqi4.mjs} +1 -1
- package/dist/runtime/ai.d.mts +4 -0
- package/dist/runtime/ai.mjs +2 -37
- package/dist/runtime/better-auth-mysql.d.mts +1 -1
- package/dist/runtime/better-auth-mysql.mjs +2 -2
- package/dist/runtime/better-auth-pg.d.mts +1 -1
- package/dist/runtime/better-auth-pg.mjs +2 -2
- package/dist/runtime/better-auth.d.mts +1 -1
- package/dist/runtime/better-auth.mjs +2 -2
- package/dist/runtime/client-react.d.mts +2 -2
- package/dist/runtime/client-solid.d.mts +2 -2
- package/dist/runtime/client-svelte.d.mts +2 -2
- package/dist/runtime/client-vue.d.mts +2 -2
- package/dist/runtime/client.d.mts +2 -2
- package/dist/runtime/email/testing.d.mts +1 -1
- package/dist/runtime/email.d.mts +2 -3
- package/dist/runtime/email.mjs +2 -3
- package/dist/runtime/fetch-stream.d.mts +2 -2
- package/dist/runtime/fetch.d.mts +1 -1
- package/dist/runtime/migration-handler-mysql.mjs +4 -4
- package/dist/runtime/migration-handler-pg.mjs +9 -1
- package/dist/runtime/remote/binding-handler.mjs +25 -25
- package/dist/runtime/remote/index.d.mts +3 -0
- package/dist/runtime/remote/index.mjs +86 -23
- package/dist/runtime/routing.d.mts +2 -2
- package/dist/runtime/sse-client.d.mts +4 -0
- package/dist/runtime/ws-server.d.mts +2 -2
- package/dist/runtime/ws.d.mts +1 -1
- package/dist/{scan-C0BMdmEd.mjs → scan-D2-FcLHs.mjs} +13 -5
- package/dist/{secret-bg73f1Ge.mjs → secret-CClHaFxm.mjs} +3 -3
- package/dist/{types-BAp5AEBU.d.mts → types-7AIz0OZu.d.mts} +1 -1
- package/dist/{validate-CheZGRE7.mjs → validate-CnZPMq4q.mjs} +22 -17
- package/dist/validate-D7Wn8PUX.mjs +1 -0
- package/dist/{version-metadata-DIrqEHQo.mjs → version-metadata-B1Bm2wSq.mjs} +1 -1
- package/dist/{wrangler-BYs07Rxy.mjs → wrangler-C9XSzrju.mjs} +3 -3
- package/dist/wrangler-DAdxHEzh.mjs +1 -0
- package/dist/{wrapper-CwhpNWtH.mjs → wrapper-BOigE1xJ.mjs} +4 -4
- package/dist/{ws-aKVYB-fA.d.mts → ws-CsBNxv86.d.mts} +5 -0
- package/docs/guide/auth.md +1 -1
- package/docs/guide/database/d1.md +2 -2
- package/docs/guide/database/mysql.md +1 -1
- package/docs/guide/edge/headers.md +10 -2
- package/docs/guide/edge/revalidation.md +2 -0
- package/docs/guide/email/receiving.md +1 -1
- package/docs/guide/email/sending.md +1 -1
- package/docs/guide/pages-routing/islands.md +2 -2
- package/docs/guide/platform/administration/connected-apps.md +18 -2
- package/docs/guide/remote-dev.md +2 -0
- package/docs/guide/websockets.md +2 -2
- package/docs/index.md +78 -22
- package/docs/reference/api/pages.md +7 -5
- package/docs/reference/api.md +2 -0
- package/docs/reference/cli/database.md +7 -5
- package/docs/reference/cli/deploy.md +12 -10
- package/docs/reference/cli/email.md +1 -1
- package/docs/reference/cli/generate.md +1 -1
- package/docs/reference/cli/platform-installation.md +2 -2
- package/docs/reference/cli/project.md +4 -2
- package/docs/reference/cli.md +1 -1
- package/docs/reference/config.md +11 -1
- package/package.json +7 -7
- package/dist/client-B60PwCC4.mjs +0 -1
- package/dist/collect-Cae8A7Zr.mjs +0 -1
- package/dist/deploy-9lgfhrXS.mjs +0 -2
- package/dist/discover-ClzFSwns.mjs +0 -1
- package/dist/gen-sXyp5DFO.mjs +0 -1
- package/dist/help-i2YGGnTH.mjs +0 -1
- package/dist/login-XD844Xs-.mjs +0 -1
- package/dist/migrate-BRwU-blY.mjs +0 -1
- package/dist/operator-cmd-D6gnZsnK.mjs +0 -1
- package/dist/platform-args-B0HeTh0C.mjs +0 -1
- package/dist/prepare-CYT6tAzD.mjs +0 -1
- package/dist/r2-conditions-D1Wk8i7b.mjs +0 -30
- package/dist/validate-BQFdf0Pi.mjs +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { a as join, n as dirname } from "./dist-ipQi0Q8y.mjs";
|
|
2
|
-
import { t as collectMigrations } from "./collect-
|
|
2
|
+
import { t as collectMigrations } from "./collect-Dew86qce.mjs";
|
|
3
3
|
import { n as hasPackageDependency, r as readNearestPackageJson } from "./package-json-BjYqR-So.mjs";
|
|
4
4
|
import { r as classifyMigration } from "./plan-BhLO2p4w.mjs";
|
|
5
5
|
import { existsSync, mkdirSync } from "node:fs";
|
|
@@ -92,16 +92,16 @@ async function getApplicationTables(dbPath) {
|
|
|
92
92
|
db.close();
|
|
93
93
|
}
|
|
94
94
|
}
|
|
95
|
-
function assertLocalMigrationState(migrations, appliedNames, applicationTables) {
|
|
95
|
+
function assertLocalMigrationState(migrations, appliedNames, applicationTables, dir) {
|
|
96
96
|
const migrationNames = new Set(migrations.map((migration) => migration.name));
|
|
97
97
|
const missingFiles = [...appliedNames].filter((name) => !migrationNames.has(name)).sort();
|
|
98
98
|
if (missingFiles.length > 0) throw new Error([
|
|
99
|
-
|
|
99
|
+
`Local database migration history does not match ${dir}/.`,
|
|
100
100
|
"",
|
|
101
101
|
"These migrations are recorded as applied locally but no longer exist on disk:",
|
|
102
102
|
...missingFiles.map((name) => ` - ${name}`),
|
|
103
103
|
"",
|
|
104
|
-
"If the migration files were renamed,
|
|
104
|
+
"If the migration files were renamed, restore their old names.",
|
|
105
105
|
"If the migration history was intentionally rewritten, run `void db reset` to recreate the local database from the current files."
|
|
106
106
|
].join("\n"));
|
|
107
107
|
if (appliedNames.size === 0 && migrations.length > 0 && applicationTables.length > 0) throw new Error([
|
|
@@ -110,14 +110,16 @@ function assertLocalMigrationState(migrations, appliedNames, applicationTables)
|
|
|
110
110
|
`Existing tables: ${applicationTables.join(", ")}`,
|
|
111
111
|
"",
|
|
112
112
|
"This usually means the schema was applied with `void db push` or the local database was created before migration tracking existed.",
|
|
113
|
-
|
|
113
|
+
`Run \`void db reset\` to recreate the local database from ${dir}/, or delete the local D1 state if you do not need its data.`
|
|
114
114
|
].join("\n"));
|
|
115
115
|
}
|
|
116
116
|
/**
|
|
117
117
|
* Apply pending SQL migrations and record them in `_void_migrations`.
|
|
118
118
|
* Each file runs through one `exec` so SQLite parses multi-statement SQL itself.
|
|
119
|
+
* `sourceRelative` (`ProjectPaths.sourceRelative`) adds the configured `sourceDir` to the
|
|
120
|
+
* migrations folder that errors name.
|
|
119
121
|
*/
|
|
120
|
-
async function runMigrations(migrationsDir, dbPath) {
|
|
122
|
+
async function runMigrations(migrationsDir, dbPath, sourceRelative = (path) => path) {
|
|
121
123
|
const allMigrations = collectMigrations(migrationsDir);
|
|
122
124
|
if (allMigrations.length === 0) return [];
|
|
123
125
|
mkdirSync(dirname(dbPath), { recursive: true });
|
|
@@ -131,7 +133,7 @@ async function runMigrations(migrationsDir, dbPath) {
|
|
|
131
133
|
)
|
|
132
134
|
`);
|
|
133
135
|
const appliedSet = new Set(db.prepare("SELECT name FROM _void_migrations").all().map((r) => r.name));
|
|
134
|
-
assertLocalMigrationState(allMigrations, appliedSet, getApplicationTableNames(db));
|
|
136
|
+
assertLocalMigrationState(allMigrations, appliedSet, getApplicationTableNames(db), sourceRelative("db/migrations"));
|
|
135
137
|
const pending = allMigrations.filter((m) => !appliedSet.has(m.name));
|
|
136
138
|
if (pending.length === 0) return [];
|
|
137
139
|
for (const migration of pending) classifyMigration(migration);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as getApplicationTables, n as getAppliedMigrations, r as getMiniflareDatabasePath, i as openSqliteDatabase, a as runMigrations } from "./runner-
|
|
1
|
+
export { t as getApplicationTables, n as getAppliedMigrations, r as getMiniflareDatabasePath, i as openSqliteDatabase, a as runMigrations } from "./runner-3uGC-oLF.mjs";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as collectMigrations } from "./collect-
|
|
1
|
+
import { t as collectMigrations } from "./collect-Dew86qce.mjs";
|
|
2
2
|
import { a as mySqlMigrationLockError, o as mySqlMigrationLockName, s as readMySqlMigrationLease, t as splitMySqlMigrationSql } from "./mysql-migration-sql-BIS5vbNk.mjs";
|
|
3
3
|
//#region src/migrations/runner-mysql.ts
|
|
4
4
|
async function readMySqlAppliedMigrations(client) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as applyMySqlMigrations, n as applyPendingMySqlMigrations, r as getMySqlAppliedMigrations, i as readMySqlAppliedMigrations, a as runMySqlMigrations, o as toMySqlClient, s as withMySqlMigrationLock, c as withMySqlMigrationLockAt } from "./runner-mysql-
|
|
1
|
+
export { t as applyMySqlMigrations, n as applyPendingMySqlMigrations, r as getMySqlAppliedMigrations, i as readMySqlAppliedMigrations, a as runMySqlMigrations, o as toMySqlClient, s as withMySqlMigrationLock, c as withMySqlMigrationLockAt } from "./runner-mysql-BWmbk5IE.mjs";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as applyPgMigrations, n as getPgAppliedMigrations, r as readPgAppliedMigrations, i as runPgMigrations } from "./runner-pg-
|
|
1
|
+
export { t as applyPgMigrations, n as getPgAppliedMigrations, r as readPgAppliedMigrations, i as runPgMigrations } from "./runner-pg-Cr3qrqi4.mjs";
|
package/dist/runtime/ai.d.mts
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
//#region src/runtime/ai-types.d.ts
|
|
2
2
|
type AiProviderName = "openai" | "anthropic" | "google-ai-studio" | "groq" | "mistral" | "grok" | "deepseek" | "openrouter" | "perplexity" | "cohere" | "cerebras" | "huggingface" | "replicate" | "baseten" | "cartesia" | "deepgram" | "elevenlabs" | "fal" | "ideogram" | "parallel";
|
|
3
3
|
type AiProvider = AiProviderName | (string & {});
|
|
4
|
+
/**
|
|
5
|
+
* @deprecated No Void API accepts this type. To send a file with `ai.provider().fetch()`,
|
|
6
|
+
* put it in `FormData`. Removed in the next major version.
|
|
7
|
+
*/
|
|
4
8
|
type ImageFileInput = Blob | ArrayBuffer | ArrayBufferView | {
|
|
5
9
|
data: string;
|
|
6
10
|
name?: string;
|
package/dist/runtime/ai.mjs
CHANGED
|
@@ -99,45 +99,10 @@ function copyBinaryView(value) {
|
|
|
99
99
|
function arrayBufferToBase64(buffer) {
|
|
100
100
|
return bytesToBase64(new Uint8Array(buffer));
|
|
101
101
|
}
|
|
102
|
-
function isFileLikeRecord(value) {
|
|
103
|
-
return typeof value.data === "string" && (value.name === void 0 || typeof value.name === "string") && (value.type === void 0 || typeof value.type === "string");
|
|
104
|
-
}
|
|
105
102
|
function fileNameFromBlob(value) {
|
|
106
103
|
const name = value.name;
|
|
107
104
|
return typeof name === "string" && name.length > 0 ? name : void 0;
|
|
108
105
|
}
|
|
109
|
-
async function serializeProxyValue(value, serializeDataObjectAsFile = false) {
|
|
110
|
-
if (value instanceof Blob) return {
|
|
111
|
-
[VOID_FILE_MARKER]: true,
|
|
112
|
-
data: arrayBufferToBase64(await value.arrayBuffer()),
|
|
113
|
-
name: fileNameFromBlob(value),
|
|
114
|
-
type: value.type || void 0
|
|
115
|
-
};
|
|
116
|
-
if (value instanceof ArrayBuffer) return {
|
|
117
|
-
[VOID_FILE_MARKER]: true,
|
|
118
|
-
data: arrayBufferToBase64(value),
|
|
119
|
-
type: "application/octet-stream"
|
|
120
|
-
};
|
|
121
|
-
if (isBinaryView(value)) return {
|
|
122
|
-
[VOID_FILE_MARKER]: true,
|
|
123
|
-
data: arrayBufferToBase64(copyBinaryView(value)),
|
|
124
|
-
type: "application/octet-stream"
|
|
125
|
-
};
|
|
126
|
-
if (Array.isArray(value)) return Promise.all(value.map((item) => serializeProxyValue(item, serializeDataObjectAsFile)));
|
|
127
|
-
if (typeof value === "object" && value !== null) {
|
|
128
|
-
const record = value;
|
|
129
|
-
if (serializeDataObjectAsFile && isFileLikeRecord(record)) return {
|
|
130
|
-
[VOID_FILE_MARKER]: true,
|
|
131
|
-
data: record.data,
|
|
132
|
-
name: record.name,
|
|
133
|
-
type: record.type
|
|
134
|
-
};
|
|
135
|
-
const serialized = {};
|
|
136
|
-
for (const [key, nestedValue] of Object.entries(record)) serialized[key] = await serializeProxyValue(nestedValue, key === "image" || key === "mask");
|
|
137
|
-
return serialized;
|
|
138
|
-
}
|
|
139
|
-
return value;
|
|
140
|
-
}
|
|
141
106
|
async function serializeFormData(form) {
|
|
142
107
|
const entries = [];
|
|
143
108
|
for (const [name, value] of form.entries()) {
|
|
@@ -190,7 +155,7 @@ async function serializeProviderBody(body) {
|
|
|
190
155
|
};
|
|
191
156
|
return {
|
|
192
157
|
type: "json",
|
|
193
|
-
value:
|
|
158
|
+
value: body
|
|
194
159
|
};
|
|
195
160
|
}
|
|
196
161
|
function headersToRecord(headers) {
|
|
@@ -394,7 +359,7 @@ function makeDirectBackend(directAi, runtimeEnv, gatewayId) {
|
|
|
394
359
|
return responseFromResult(await run(model, inputs, imageRunOptions(options)));
|
|
395
360
|
},
|
|
396
361
|
async providerFetch(provider, path, init, options) {
|
|
397
|
-
if (!gatewayId) return Response.json({ error: "ai: ai.provider().fetch() needs an AI Gateway when self-hosting. Set
|
|
362
|
+
if (!gatewayId) return Response.json({ error: "ai: ai.provider().fetch() needs an AI Gateway when self-hosting. Set `ai.gateway` in void.config.ts." }, { status: 501 });
|
|
398
363
|
if (isUnsafeProviderPath(path)) return Response.json({ error: `ai: provider path '${path}' must be relative.` }, { status: 400 });
|
|
399
364
|
let providerKey;
|
|
400
365
|
try {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as VoidAuthRuntimeApi } from "../better-auth-shared-
|
|
1
|
+
import { n as VoidAuthRuntimeApi } from "../better-auth-shared-Bv18bB-l.mjs";
|
|
2
2
|
//#region src/runtime/better-auth-mysql.d.ts
|
|
3
3
|
export declare const resolveVoidAuthState: VoidAuthRuntimeApi["resolveVoidAuthState"];
|
|
4
4
|
export declare const runVoidAuthMiddleware: VoidAuthRuntimeApi["runVoidAuthMiddleware"];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { i as mysqlMigrationRunner, t as applyMySqlAuthMigrations } from "../auth-migrations-
|
|
2
|
-
import { n as resolveConnectionString, t as createVoidAuthRuntime } from "../better-auth-shared-
|
|
1
|
+
import { i as mysqlMigrationRunner, t as applyMySqlAuthMigrations } from "../auth-migrations-BO27GDNr.mjs";
|
|
2
|
+
import { n as resolveConnectionString, t as createVoidAuthRuntime } from "../better-auth-shared-D-6z0q0f.mjs";
|
|
3
3
|
//#region src/runtime/better-auth-mysql.ts
|
|
4
4
|
async function applyMigrations(env, migrationSchema) {
|
|
5
5
|
const { createConnection } = await import("mysql2/promise");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as VoidAuthRuntimeApi } from "../better-auth-shared-
|
|
1
|
+
import { n as VoidAuthRuntimeApi } from "../better-auth-shared-Bv18bB-l.mjs";
|
|
2
2
|
//#region src/runtime/better-auth-pg.d.ts
|
|
3
3
|
export declare const resolveVoidAuthState: VoidAuthRuntimeApi["resolveVoidAuthState"];
|
|
4
4
|
export declare const runVoidAuthMiddleware: VoidAuthRuntimeApi["runVoidAuthMiddleware"];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as pgMigrationRunner, n as applyPgAuthMigrations } from "../auth-migrations-
|
|
2
|
-
import { n as resolveConnectionString, t as createVoidAuthRuntime } from "../better-auth-shared-
|
|
1
|
+
import { a as pgMigrationRunner, n as applyPgAuthMigrations } from "../auth-migrations-BO27GDNr.mjs";
|
|
2
|
+
import { n as resolveConnectionString, t as createVoidAuthRuntime } from "../better-auth-shared-D-6z0q0f.mjs";
|
|
3
3
|
import { t as disablePgPassFallback } from "../pg-J2HbZIkX.mjs";
|
|
4
4
|
//#region src/runtime/better-auth-pg.ts
|
|
5
5
|
async function applyMigrations(env, migrationSchema) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as VoidAuthRuntimeApi } from "../better-auth-shared-
|
|
1
|
+
import { n as VoidAuthRuntimeApi } from "../better-auth-shared-Bv18bB-l.mjs";
|
|
2
2
|
//#region src/runtime/better-auth.d.ts
|
|
3
3
|
export declare const resolveVoidAuthOptions: VoidAuthRuntimeApi["resolveVoidAuthOptions"];
|
|
4
4
|
export declare const resolveVoidAuthState: VoidAuthRuntimeApi["resolveVoidAuthState"];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { r as applySqliteAuthMigrations } from "../auth-migrations-
|
|
2
|
-
import { t as createVoidAuthRuntime } from "../better-auth-shared-
|
|
1
|
+
import { r as applySqliteAuthMigrations } from "../auth-migrations-BO27GDNr.mjs";
|
|
2
|
+
import { t as createVoidAuthRuntime } from "../better-auth-shared-D-6z0q0f.mjs";
|
|
3
3
|
//#region src/runtime/better-auth.ts
|
|
4
4
|
async function applyMigrations(env, migrationSchema) {
|
|
5
5
|
const database = env.DB;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as AuthState, r as AuthUser, t as AuthSession } from "../auth-DkcFflXV.mjs";
|
|
2
2
|
import { n as createAuthClient, t as auth } from "../auth-client-react-7GFffu8R.mjs";
|
|
3
|
-
import { a as fetch, o as FetchError } from "../fetch-
|
|
4
|
-
import { t as fetchStream } from "../fetch-stream-
|
|
3
|
+
import { a as fetch, o as FetchError } from "../fetch-DHLOuPyk.mjs";
|
|
4
|
+
import { t as fetchStream } from "../fetch-stream-CNxOrBdP.mjs";
|
|
5
5
|
export { type AuthSession, type AuthState, type AuthUser, FetchError, FetchError as StreamError, auth, createAuthClient, fetch, fetchStream };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as AuthState, r as AuthUser, t as AuthSession } from "../auth-DkcFflXV.mjs";
|
|
2
2
|
import { n as createAuthClient, t as auth } from "../auth-client-solid-DyTFL4cq.mjs";
|
|
3
|
-
import { a as fetch, o as FetchError } from "../fetch-
|
|
4
|
-
import { t as fetchStream } from "../fetch-stream-
|
|
3
|
+
import { a as fetch, o as FetchError } from "../fetch-DHLOuPyk.mjs";
|
|
4
|
+
import { t as fetchStream } from "../fetch-stream-CNxOrBdP.mjs";
|
|
5
5
|
export { type AuthSession, type AuthState, type AuthUser, FetchError, FetchError as StreamError, auth, createAuthClient, fetch, fetchStream };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as AuthState, r as AuthUser, t as AuthSession } from "../auth-DkcFflXV.mjs";
|
|
2
2
|
import { n as createAuthClient, t as auth } from "../auth-client-svelte-zetW0KIH.mjs";
|
|
3
|
-
import { a as fetch, o as FetchError } from "../fetch-
|
|
4
|
-
import { t as fetchStream } from "../fetch-stream-
|
|
3
|
+
import { a as fetch, o as FetchError } from "../fetch-DHLOuPyk.mjs";
|
|
4
|
+
import { t as fetchStream } from "../fetch-stream-CNxOrBdP.mjs";
|
|
5
5
|
export { type AuthSession, type AuthState, type AuthUser, FetchError, FetchError as StreamError, auth, createAuthClient, fetch, fetchStream };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as AuthState, r as AuthUser, t as AuthSession } from "../auth-DkcFflXV.mjs";
|
|
2
2
|
import { n as createAuthClient, t as auth } from "../auth-client-vue-bChShbQP.mjs";
|
|
3
|
-
import { a as fetch, o as FetchError } from "../fetch-
|
|
4
|
-
import { t as fetchStream } from "../fetch-stream-
|
|
3
|
+
import { a as fetch, o as FetchError } from "../fetch-DHLOuPyk.mjs";
|
|
4
|
+
import { t as fetchStream } from "../fetch-stream-CNxOrBdP.mjs";
|
|
5
5
|
export { type AuthSession, type AuthState, type AuthUser, FetchError, FetchError as StreamError, auth, createAuthClient, fetch, fetchStream };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as AuthState, r as AuthUser, t as AuthSession } from "../auth-DkcFflXV.mjs";
|
|
2
2
|
import { n as createAuthClient, t as auth } from "../auth-client-Bawdj38n.mjs";
|
|
3
|
-
import { a as fetch, o as FetchError } from "../fetch-
|
|
4
|
-
import { t as fetchStream } from "../fetch-stream-
|
|
3
|
+
import { a as fetch, o as FetchError } from "../fetch-DHLOuPyk.mjs";
|
|
4
|
+
import { t as fetchStream } from "../fetch-stream-CNxOrBdP.mjs";
|
|
5
5
|
export { type AuthSession, type AuthState, type AuthUser, FetchError, FetchError as StreamError, auth, createAuthClient, fetch, fetchStream };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="@cloudflare/workers-types" />
|
|
2
|
-
import { r as EmailHandler } from "../../inbound-
|
|
2
|
+
import { r as EmailHandler } from "../../inbound-Da7XsjH3.mjs";
|
|
3
3
|
//#region src/runtime/email/dev-inbox.d.ts
|
|
4
4
|
interface CapturedMessage {
|
|
5
5
|
id: string;
|
package/dist/runtime/email.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="@cloudflare/workers-types" />
|
|
2
|
-
import { C as SendEmailOptions, S as SendEmailErrorCode, T as SendEmailResult, _ as Attachment, a as MessageProxy, b as SendEmailDelivery, c as ParsedEmail, d as defineEmail, f as enactEmailActions, g as Address, h as replyEmail, i as EmailHandlerInfo, l as ReplyEmailOptions, m as parseEmail, n as EmailEnvelope, o as ParseEmailError, p as isForwardableEmailMessage, r as EmailHandler, s as ParseEmailErrorCode, t as EmailAction, u as createMessageProxy, v as EmailDeliveryState, w as SendEmailRecipientResult, x as SendEmailError, y as NormalizedEmail } from "../inbound-
|
|
2
|
+
import { C as SendEmailOptions, S as SendEmailErrorCode, T as SendEmailResult, _ as Attachment, a as MessageProxy, b as SendEmailDelivery, c as ParsedEmail, d as defineEmail, f as enactEmailActions, g as Address, h as replyEmail, i as EmailHandlerInfo, l as ReplyEmailOptions, m as parseEmail, n as EmailEnvelope, o as ParseEmailError, p as isForwardableEmailMessage, r as EmailHandler, s as ParseEmailErrorCode, t as EmailAction, u as createMessageProxy, v as EmailDeliveryState, w as SendEmailRecipientResult, x as SendEmailError, y as NormalizedEmail } from "../inbound-Da7XsjH3.mjs";
|
|
3
3
|
//#region src/runtime/email/mime.d.ts
|
|
4
4
|
type MimeErrorCode = "INVALID_FROM" | "INVALID_TO" | "MIME_ERROR";
|
|
5
5
|
export declare class MimeError extends Error {
|
|
@@ -14,8 +14,7 @@ export declare class MimeError extends Error {
|
|
|
14
14
|
*
|
|
15
15
|
* During `void dev` the message is captured by the local inbox
|
|
16
16
|
* (`/__void/inbox`) and never reaches the proxy; an in-process sink
|
|
17
|
-
* (`void/email/testing`) takes precedence over it.
|
|
18
|
-
* override for a single call.
|
|
17
|
+
* (`void/email/testing`) takes precedence over it.
|
|
19
18
|
*/
|
|
20
19
|
export declare function sendEmail(opts: SendEmailOptions): Promise<SendEmailResult>;
|
|
21
20
|
/**
|
package/dist/runtime/email.mjs
CHANGED
|
@@ -437,8 +437,7 @@ function capturedResult(normalized, captureId) {
|
|
|
437
437
|
*
|
|
438
438
|
* During `void dev` the message is captured by the local inbox
|
|
439
439
|
* (`/__void/inbox`) and never reaches the proxy; an in-process sink
|
|
440
|
-
* (`void/email/testing`) takes precedence over it.
|
|
441
|
-
* override for a single call.
|
|
440
|
+
* (`void/email/testing`) takes precedence over it.
|
|
442
441
|
*/
|
|
443
442
|
async function sendEmail(opts) {
|
|
444
443
|
if (opts.idempotencyKey !== void 0 && (typeof opts.idempotencyKey !== "string" || !/^[\x21-\x7e]{1,128}$/.test(opts.idempotencyKey))) return err("MIME_ERROR", "email: idempotencyKey must contain 1–128 printable non-space ASCII characters.");
|
|
@@ -480,7 +479,7 @@ async function sendEmail(opts) {
|
|
|
480
479
|
const proxy = env?.__VOID_PROXY;
|
|
481
480
|
const projectId = env?.__PROJECT_ID;
|
|
482
481
|
const proxyToken = env?.__VOID_PROXY_TOKEN;
|
|
483
|
-
if (!proxy || !projectId || !proxyToken) return err("BINDING_MISSING", "email: neither SEND_EMAIL nor __VOID_PROXY is available, so nothing was sent. Deploy via Void to bind the platform proxy, or set `email.from` in void.
|
|
482
|
+
if (!proxy || !projectId || !proxyToken) return err("BINDING_MISSING", "email: neither SEND_EMAIL nor __VOID_PROXY is available, so nothing was sent. Deploy via Void to bind the platform proxy, or set `email.from` in void.config.ts so `void deploy --platform cloudflare` provisions the SEND_EMAIL binding. Under `void dev` messages are captured by the local inbox at /__void/inbox instead — reaching this error there means that path was bypassed by the deprecated `sendInDev: true` (it never delivers) or unavailable (the worker has no assets binding to reach the dev server through).");
|
|
484
483
|
const body = {
|
|
485
484
|
projectId,
|
|
486
485
|
aiToken: proxyToken,
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { o as FetchError } from "../fetch-
|
|
2
|
-
import { t as fetchStream } from "../fetch-stream-
|
|
1
|
+
import { o as FetchError } from "../fetch-DHLOuPyk.mjs";
|
|
2
|
+
import { t as fetchStream } from "../fetch-stream-CNxOrBdP.mjs";
|
|
3
3
|
export { FetchError as StreamError, fetchStream };
|
package/dist/runtime/fetch.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as fetch, i as QueryOption, n as MethodsOf, o as FetchError, r as ParamsOption, t as BodyOption } from "../fetch-
|
|
1
|
+
import { a as fetch, i as QueryOption, n as MethodsOf, o as FetchError, r as ParamsOption, t as BodyOption } from "../fetch-DHLOuPyk.mjs";
|
|
2
2
|
export { BodyOption, FetchError, MethodsOf, ParamsOption, QueryOption, fetch };
|
|
@@ -8,18 +8,19 @@ function createMigrationHandler(env, migrations, runAuthMigrations) {
|
|
|
8
8
|
error: "unauthorized",
|
|
9
9
|
migrations: []
|
|
10
10
|
}, { status: 401 });
|
|
11
|
+
const results = [];
|
|
11
12
|
try {
|
|
12
|
-
return Response.json(await runMySqlMigrations(env, migrations, runAuthMigrations));
|
|
13
|
+
return Response.json(await runMySqlMigrations(env, migrations, results, runAuthMigrations));
|
|
13
14
|
} catch (error) {
|
|
14
15
|
return Response.json({
|
|
15
16
|
ok: false,
|
|
16
17
|
error: error instanceof Error ? error.message : String(error),
|
|
17
|
-
migrations:
|
|
18
|
+
migrations: results
|
|
18
19
|
}, { status: 500 });
|
|
19
20
|
}
|
|
20
21
|
};
|
|
21
22
|
}
|
|
22
|
-
async function runMySqlMigrations(env, migrations, runAuthMigrations) {
|
|
23
|
+
async function runMySqlMigrations(env, migrations, results, runAuthMigrations) {
|
|
23
24
|
const hyperdrive = env.HYPERDRIVE;
|
|
24
25
|
if (!hyperdrive?.connectionString) return {
|
|
25
26
|
ok: false,
|
|
@@ -43,7 +44,6 @@ async function runMySqlMigrations(env, migrations, runAuthMigrations) {
|
|
|
43
44
|
await connection.query("CREATE TABLE IF NOT EXISTS `_void_migrations` (`name` VARCHAR(255) PRIMARY KEY, `applied_at` VARCHAR(64) NOT NULL)");
|
|
44
45
|
const [rows] = await connection.query("SELECT `name` FROM `_void_migrations`");
|
|
45
46
|
const applied = new Set(rows.map((row) => String(row.name)));
|
|
46
|
-
const results = [];
|
|
47
47
|
for (const migration of migrations) {
|
|
48
48
|
if (applied.has(migration.name)) {
|
|
49
49
|
results.push({
|
|
@@ -10,7 +10,15 @@ function createMigrationHandler(env, migrations, runAuthMigrations) {
|
|
|
10
10
|
}, { status: 401 });
|
|
11
11
|
try {
|
|
12
12
|
const result = await runPgMigrations(env, migrations);
|
|
13
|
-
if (result.ok && runAuthMigrations)
|
|
13
|
+
if (result.ok && runAuthMigrations) try {
|
|
14
|
+
await runAuthMigrations();
|
|
15
|
+
} catch (err) {
|
|
16
|
+
return Response.json({
|
|
17
|
+
...result,
|
|
18
|
+
ok: false,
|
|
19
|
+
error: err instanceof Error ? err.message : String(err)
|
|
20
|
+
}, { status: 500 });
|
|
21
|
+
}
|
|
14
22
|
return Response.json(result);
|
|
15
23
|
} catch (err) {
|
|
16
24
|
return Response.json({
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as base64ToBytes } from "../../base64-DVrOndmI.mjs";
|
|
2
|
-
import {
|
|
2
|
+
import { n as parseR2Conditional, r as parseR2HttpMetadata, t as R2_OBJECT_HEADER } from "../../r2-conditions-B8xUgJRc.mjs";
|
|
3
3
|
import { Hono } from "hono";
|
|
4
4
|
//#region src/runtime/remote/binding-handler.ts
|
|
5
5
|
/** Parse the body, answer 400 when `invalid` names a problem, and 404 for an unknown binding. */
|
|
@@ -20,6 +20,19 @@ function requireBinding(body) {
|
|
|
20
20
|
function requireKey(body) {
|
|
21
21
|
return body.binding && body.key ? void 0 : "binding and key required";
|
|
22
22
|
}
|
|
23
|
+
/** Object fields that ProxyR2Bucket reads. `contentType` serves older clients. */
|
|
24
|
+
function r2ObjectJson(obj) {
|
|
25
|
+
return {
|
|
26
|
+
key: obj.key,
|
|
27
|
+
size: obj.size,
|
|
28
|
+
etag: obj.etag,
|
|
29
|
+
version: obj.version,
|
|
30
|
+
lastModified: obj.uploaded.toISOString(),
|
|
31
|
+
contentType: obj.httpMetadata?.contentType ?? "application/octet-stream",
|
|
32
|
+
httpMetadata: obj.httpMetadata,
|
|
33
|
+
customMetadata: obj.customMetadata
|
|
34
|
+
};
|
|
35
|
+
}
|
|
23
36
|
function r2DeleteKeys(body) {
|
|
24
37
|
return body.keys ? body.keys : body.key ? [body.key] : [];
|
|
25
38
|
}
|
|
@@ -153,6 +166,7 @@ function createBindingHandler(env) {
|
|
|
153
166
|
headers.set("content-type", obj.httpMetadata?.contentType ?? "application/octet-stream");
|
|
154
167
|
headers.set("content-length", String(obj.size));
|
|
155
168
|
if (obj.httpEtag) headers.set("etag", obj.httpEtag);
|
|
169
|
+
headers.set(R2_OBJECT_HEADER, encodeURIComponent(JSON.stringify(r2ObjectJson(obj))));
|
|
156
170
|
return new Response(obj.body, { headers });
|
|
157
171
|
});
|
|
158
172
|
app.on("POST", ["/r2/put", "/r2/put-conditional"], async (c) => {
|
|
@@ -160,28 +174,21 @@ function createBindingHandler(env) {
|
|
|
160
174
|
if (request instanceof Response) return request;
|
|
161
175
|
const { body, binding: bucket } = request;
|
|
162
176
|
const data = body.base64 ? base64ToBytes(body.base64) : new TextEncoder().encode(body.value ?? "");
|
|
177
|
+
let httpMetadata;
|
|
163
178
|
let onlyIf;
|
|
164
179
|
try {
|
|
180
|
+
httpMetadata = body.httpMetadata === void 0 ? { contentType: body.contentType ?? "application/octet-stream" } : parseR2HttpMetadata(body.httpMetadata);
|
|
165
181
|
if (body.onlyIf !== void 0 || c.req.path.endsWith("/put-conditional")) onlyIf = parseR2Conditional(body.onlyIf);
|
|
166
182
|
} catch (error) {
|
|
167
183
|
return c.json({ error: String(error) }, 400);
|
|
168
184
|
}
|
|
169
185
|
const obj = await bucket.put(body.key, data, {
|
|
170
|
-
httpMetadata
|
|
186
|
+
httpMetadata,
|
|
171
187
|
customMetadata: body.customMetadata,
|
|
172
188
|
onlyIf
|
|
173
189
|
});
|
|
174
190
|
if (!obj) return c.json(null);
|
|
175
|
-
return c.json(
|
|
176
|
-
key: obj.key,
|
|
177
|
-
size: obj.size,
|
|
178
|
-
etag: obj.etag,
|
|
179
|
-
version: obj.version,
|
|
180
|
-
lastModified: obj.uploaded.toISOString(),
|
|
181
|
-
contentType: obj.httpMetadata?.contentType ?? "application/octet-stream",
|
|
182
|
-
httpMetadata: obj.httpMetadata,
|
|
183
|
-
customMetadata: obj.customMetadata
|
|
184
|
-
});
|
|
191
|
+
return c.json(r2ObjectJson(obj));
|
|
185
192
|
});
|
|
186
193
|
app.post("/r2/delete", async (c) => {
|
|
187
194
|
const request = await readBindingRequest(c, env, (body) => requireBinding(body) ?? (r2DeleteKeys(body).length === 0 ? "key or keys required" : void 0));
|
|
@@ -198,15 +205,14 @@ function createBindingHandler(env) {
|
|
|
198
205
|
if (body.limit) opts.limit = body.limit;
|
|
199
206
|
if (body.cursor) opts.cursor = body.cursor;
|
|
200
207
|
if (body.delimiter) opts.delimiter = body.delimiter;
|
|
208
|
+
if (body.startAfter) opts.startAfter = body.startAfter;
|
|
209
|
+
if (Array.isArray(body.include)) opts.include = body.include;
|
|
201
210
|
const result = await bucket.list(opts);
|
|
202
211
|
return c.json({
|
|
203
|
-
objects: result.objects.map(
|
|
204
|
-
key: o.key,
|
|
205
|
-
size: o.size,
|
|
206
|
-
lastModified: o.uploaded.toISOString()
|
|
207
|
-
})),
|
|
212
|
+
objects: result.objects.map(r2ObjectJson),
|
|
208
213
|
truncated: result.truncated,
|
|
209
|
-
cursor: result.truncated ? result.cursor : null
|
|
214
|
+
cursor: result.truncated ? result.cursor : null,
|
|
215
|
+
delimitedPrefixes: result.delimitedPrefixes
|
|
210
216
|
});
|
|
211
217
|
});
|
|
212
218
|
app.post("/r2/head", async (c) => {
|
|
@@ -214,13 +220,7 @@ function createBindingHandler(env) {
|
|
|
214
220
|
if (request instanceof Response) return request;
|
|
215
221
|
const obj = await request.binding.head(request.body.key);
|
|
216
222
|
if (!obj) return c.json(null);
|
|
217
|
-
return c.json(
|
|
218
|
-
key: request.body.key,
|
|
219
|
-
size: obj.size,
|
|
220
|
-
etag: obj.httpEtag,
|
|
221
|
-
lastModified: obj.uploaded.toISOString(),
|
|
222
|
-
contentType: obj.httpMetadata?.contentType ?? "application/octet-stream"
|
|
223
|
-
});
|
|
223
|
+
return c.json(r2ObjectJson(obj));
|
|
224
224
|
});
|
|
225
225
|
return app;
|
|
226
226
|
}
|
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* Replace local D1/KV/R2 bindings with proxy-backed versions.
|
|
4
4
|
* Called from the generated worker entry point when `__VOID_REMOTE` is set.
|
|
5
|
+
*
|
|
6
|
+
* @deprecated Internal to Void. The generated worker calls this in remote mode.
|
|
7
|
+
* `void/remote` is not a supported import. Removed in the next major version.
|
|
5
8
|
*/
|
|
6
9
|
export declare function createRemoteEnv(env: Record<string, unknown>, bindingNames?: {
|
|
7
10
|
d1?: string;
|