void 0.28.0 → 1.0.3
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-Ci00cncT.mjs → account-cmd-BTcUzv9L.mjs} +4 -4
- package/dist/{application-analysis-D72ZQfMZ.mjs → application-analysis-AB_YYWgH.mjs} +1 -1
- package/dist/{application-routing-Dy589Vgn.mjs → application-routing-L7V-TFhZ.mjs} +1 -1
- package/dist/auth-Cbqi1iVX.mjs +1 -0
- package/dist/{auth-link-DWr6Afao.mjs → auth-link-DUJuvRx5.mjs} +4 -4
- package/dist/{auth-router-DP14wVkZ.mjs → auth-router-CIxiMG7i.mjs} +3 -3
- package/dist/{build-cmd-Cr3FJxv0.mjs → build-cmd-BkIv25PA.mjs} +3 -3
- package/dist/{cache-D0Tt28cn.mjs → cache-Ctzfig-W.mjs} +3 -3
- package/dist/{cancel-deploy-CJKvk7AN.mjs → cancel-deploy-CD9o-SsC.mjs} +2 -2
- package/dist/cf-build-output-BU3hqdHu.mjs +1 -0
- package/dist/cli/cli.mjs +31 -31
- package/dist/cli/cloudflare-operation-process.mjs +2 -2
- package/dist/cli/env-schema-probe.d.mts +2 -1
- package/dist/cli/env-schema-probe.mjs +2 -2
- package/dist/client-B60PwCC4.mjs +1 -0
- package/dist/{cloudflare-cmd-CTrn-lXJ.mjs → cloudflare-cmd-BIAF_BIY.mjs} +2 -2
- package/dist/{cloudflare-connect-BosmCNlq.mjs → cloudflare-connect-WjwnVOJA.mjs} +1 -1
- package/dist/{cloudflare-operations-BKdSfNBN.mjs → cloudflare-operations-B42EZeJy.mjs} +3 -3
- package/dist/cloudflare-operations-CrSUFRzJ.mjs +1 -0
- package/dist/collect-Cae8A7Zr.mjs +1 -0
- package/dist/config-QrJWu0IX.mjs +1 -0
- package/dist/{connect-nukQSoEO.mjs → connect-CKtk-EZe.mjs} +5 -5
- package/dist/create-project-B-ewF_Af.mjs +1 -0
- package/dist/{create-project-D4APeBwX.mjs → create-project-yInGo72M.mjs} +3 -3
- package/dist/database-provider.mjs +1 -2
- package/dist/{db-27RztQLy.mjs → db-7I_gfdVq.mjs} +37 -38
- package/dist/db-types-Bb4WBWIs.mjs +49 -0
- package/dist/{delete-BbsZFZIw.mjs → delete-Cy-M1u-r.mjs} +3 -3
- package/dist/deploy-9lgfhrXS.mjs +2 -0
- package/dist/{deploy-B06EQq4t.mjs → deploy-BYYlnsiy.mjs} +176 -21
- package/dist/{deploy-managed-static-CGswbcay.mjs → deploy-managed-static-Ca4TFdmx.mjs} +24 -706
- package/dist/{deploy-transport-BiicfoQW.mjs → deploy-transport-DWlWBe6M.mjs} +1 -1
- package/dist/deploy.mjs +4 -4
- package/dist/discover-ClzFSwns.mjs +1 -0
- package/dist/dispatch-DrTTk8Xg.mjs +431 -0
- package/dist/{dist-D3m88sjf.mjs → dist-BVdsO7Py.mjs} +5 -6
- package/dist/dist-CfgIkieS.mjs +1 -0
- package/dist/{domain-Bfq9n03H.mjs → domain-CZGxPv9u.mjs} +4 -4
- package/dist/edge.mjs +1 -2
- package/dist/{email-DIwaQU4P.mjs → email-DzyNVuoU.mjs} +6 -6
- package/dist/{email-cloudflare-CH053RxK.mjs → email-cloudflare-DfG6UEMm.mjs} +1 -1
- package/dist/{env-BhdWMrNy.mjs → env-0jrMQJI_.mjs} +5 -2
- package/dist/{env-C6ipBLp3.mjs → env-Nx3yf50r.mjs} +4 -4
- package/dist/{env-raw-Cklzcde3.mjs → env-raw-D74P4ebM.mjs} +12 -1
- package/dist/env-validation-BT7z-qpQ.mjs +1 -0
- package/dist/{env-validation-cE0zcmzO.mjs → env-validation-DYxjz_Wo.mjs} +2 -0
- package/dist/{gen-CnN1Xidx.mjs → gen-CufHEf42.mjs} +2 -2
- package/dist/gen-sXyp5DFO.mjs +1 -0
- package/dist/generate-ClI89brV.mjs +1 -0
- package/dist/{github-cmd-BdkU4Nhe.mjs → github-cmd-FU8EjFyU.mjs} +3 -3
- package/dist/{help-Bug7pyK_.mjs → help-BT2hovNI.mjs} +9 -5
- package/dist/help-i2YGGnTH.mjs +1 -0
- package/dist/{inbound-DmkTQeWp.mjs → inbound-BuTfm11U.mjs} +1 -1
- package/dist/index.mjs +551 -303
- package/dist/{info-CujPwtMe.mjs → info-l249eUdH.mjs} +1 -1
- package/dist/{init-ZWOJvc-Z.mjs → init-D0A6M64Q.mjs} +60 -14
- package/dist/{isr-config-DPjXM8J2.mjs → isr-config-fZaJJ8t7.mjs} +1 -30
- package/dist/{link-UEc7bnF4.mjs → link-WMoJFf4i.mjs} +4 -4
- package/dist/{list-CuWeOnzk.mjs → list-CQ2EQEHL.mjs} +4 -4
- package/dist/{live-BxLX-JqJ.mjs → live-BcHoTDFe.mjs} +1 -1
- package/dist/{local-d1-BM3p74mm.mjs → local-d1-BxvQYEFi.mjs} +1 -1
- package/dist/{login-CZ2Cqa-D.mjs → login-C2T1oVG-.mjs} +3 -3
- package/dist/login-XD844Xs-.mjs +1 -0
- package/dist/{logs-TihRcLTk.mjs → logs-DnC1d7xB.mjs} +3 -3
- package/dist/{migrate-uFwojusJ.mjs → migrate-BDIprOYd.mjs} +2 -2
- package/dist/migrate-BRwU-blY.mjs +1 -0
- package/dist/mysql-migration-sql-BIS5vbNk.mjs +241 -0
- package/dist/nitro.d.mts +30 -0
- package/dist/nitro.mjs +88 -0
- package/dist/{node-DoKbo1SZ.mjs → node-cPadMgUO.mjs} +3 -3
- package/dist/operator-cmd-D6gnZsnK.mjs +1 -0
- package/dist/{operator-cmd-C5lCctnc.mjs → operator-cmd-DHieWtFp.mjs} +5 -5
- package/dist/{output-FNHKw5Ac.mjs → output-Ba6ZbrzY.mjs} +1 -1
- package/dist/pages/head.mjs +1 -2
- package/dist/pages/prefetch.mjs +1 -2
- package/dist/pages/serialize.mjs +1 -2
- package/dist/plan-CKX_jWnD.mjs +1 -0
- package/dist/platform-args-B0HeTh0C.mjs +1 -0
- package/dist/{platform-args-C6Mb_I3a.mjs → platform-args-CaCL_1Ch.mjs} +9 -2
- package/dist/{platform-auth-config-CJmNkFT2.mjs → platform-auth-config-Z16-I8nT.mjs} +6 -6
- package/dist/{platform-auth-protection-D5wvsI-Y.mjs → platform-auth-protection-BXwZiJSF.mjs} +4 -4
- package/dist/{platform-auth-recovery-D_0I3n-1.mjs → platform-auth-recovery-CXjfqyOv.mjs} +4 -4
- package/dist/{platform-cmd-DxxZO6e5.mjs → platform-cmd-DaAOiWTl.mjs} +7 -7
- package/dist/platform-cmd-PT4YwMLM.mjs +1 -0
- package/dist/{platform-domain-zLXnW1G_.mjs → platform-domain-CxpvUeo0.mjs} +4 -4
- package/dist/{platform-lifecycle-DOW-wLfx.mjs → platform-lifecycle-DBiS0cJd.mjs} +317 -99
- package/dist/platform-lifecycle-u9pMOvxC.mjs +1 -0
- package/dist/{platform-management-t7HKy4-U.mjs → platform-management-DhEFdQAf.mjs} +67 -9
- package/dist/platform-management-DvBS83rC.mjs +1 -0
- package/dist/{platform-plans-config-CNH6zbPX.mjs → platform-plans-config-BWn1S2Rv.mjs} +2 -2
- package/dist/{platform-recovery-DeucI7A9.mjs → platform-recovery-BUGOB4RC.mjs} +2 -2
- package/dist/{platform-setup-CTf6MMT9.mjs → platform-setup-YvN9VQXV.mjs} +3 -3
- package/dist/prepare-CYT6tAzD.mjs +1 -0
- package/dist/{prepare-CSH9dKTI.mjs → prepare-DEB5SeVJ.mjs} +3 -2
- package/dist/{prepare-C4zfwks4.mjs → prepare-PQCgsny0.mjs} +3 -3
- package/dist/prerender-render.mjs +1 -2
- package/dist/{project-cmd-Dq75AXzy.mjs → project-cmd-DVatD8Ev.mjs} +16 -16
- package/dist/project-slug-6cyz8E7k.mjs +1 -0
- package/dist/{project-team-B3_QcStG.mjs → project-team-DJrWEAG1.mjs} +3 -3
- package/dist/{project-token-CvsRvv2I.mjs → project-token-CBgLBuL6.mjs} +3 -3
- package/dist/project-zdB3fs9G.mjs +1 -0
- package/dist/{project-zero-trust-D1ICiwN_.mjs → project-zero-trust-92gLtZ25.mjs} +3 -3
- package/dist/{provision-DDh7ITVS.mjs → provision-BnSSkiED.mjs} +1 -1
- package/dist/{requests-3CL3BuZh.mjs → requests-7W1Pygt2.mjs} +2 -2
- package/dist/resolve-project-PnhzMtY6.mjs +1 -0
- package/dist/{resolve-project-C_Cu7E8a.mjs → resolve-project-WpwkCB_c.mjs} +1 -1
- package/dist/{rollback-Ce1d_0J9.mjs → rollback-BcASVnwP.mjs} +3 -3
- package/dist/{route-types-IrBuwJ7u.mjs → route-types-BZi26DVS.mjs} +2 -49
- package/dist/{runner-DcVDrzuR.mjs → runner-CabsQ-iM.mjs} +15 -6
- package/dist/runner-So9mYfcm.mjs +1 -0
- package/dist/runner-mysql-BhRaONkO.mjs +146 -0
- package/dist/runner-mysql-DWwE8jKi.mjs +1 -0
- package/dist/{runner-pg-CPd-CB_F.mjs → runner-pg-BRemq_GX.mjs} +2 -2
- package/dist/runner-pg-_Xncr3H5.mjs +1 -0
- package/dist/runtime/ai.mjs +15 -4
- package/dist/runtime/auth-client-react.mjs +1 -2
- package/dist/runtime/auth-client-solid.mjs +1 -2
- package/dist/runtime/auth-client-svelte.mjs +1 -2
- package/dist/runtime/auth-client-vue.mjs +1 -2
- package/dist/runtime/auth-client.mjs +1 -2
- package/dist/runtime/auth.mjs +1 -2
- package/dist/runtime/better-auth-mysql.mjs +4 -1
- package/dist/runtime/db.mjs +6 -2
- package/dist/runtime/durable.d.mts +2 -1
- package/dist/runtime/durable.mjs +1 -1
- package/dist/runtime/email/testing.mjs +1 -1
- package/dist/runtime/email-protocol.mjs +1 -2
- package/dist/runtime/email.mjs +1 -1
- package/dist/runtime/env-public.mjs +2 -2
- package/dist/runtime/env.mjs +1 -2
- package/dist/runtime/isr.mjs +1 -1
- package/dist/runtime/kv.mjs +1 -1
- package/dist/runtime/limits.mjs +1 -2
- package/dist/runtime/live-client.d.mts +2 -1
- package/dist/runtime/live-server.d.mts +2 -1
- package/dist/runtime/live-server.mjs +1 -1
- package/dist/runtime/live.mjs +1 -2
- package/dist/runtime/log.d.mts +2 -1
- package/dist/runtime/migration-handler-mysql.mjs +38 -8
- package/dist/runtime/migration-handler.mjs +1 -2
- package/dist/runtime/queues.mjs +1 -1
- package/dist/runtime/response.mjs +1 -2
- package/dist/runtime/route-url.mjs +1 -2
- package/dist/runtime/routing.d.mts +2 -1
- package/dist/runtime/sandbox-container.mjs +1 -2
- package/dist/runtime/sandbox.mjs +3 -3
- package/dist/runtime/seed.d.mts +2 -1
- package/dist/runtime/sse.mjs +1 -2
- package/dist/runtime/storage.mjs +1 -1
- package/dist/runtime/validator.mjs +1 -2
- package/dist/runtime/ws-server.d.mts +2 -1
- package/dist/runtime/ws-server.mjs +1 -1
- package/dist/{secret-B5J8bBsI.mjs → secret-bg73f1Ge.mjs} +5 -5
- package/dist/{skills-BJsan98C.mjs → skills-C_yRTg0g.mjs} +1 -1
- package/dist/{subcommand-prompt-gQ-NDA-u.mjs → subcommand-prompt-Bm3ZlYgA.mjs} +2 -2
- package/dist/sveltekit.d.mts +2 -1
- package/dist/validate-BQFdf0Pi.mjs +1 -0
- package/dist/wrapper-CwhpNWtH.mjs +663 -0
- package/docs/guide/ai.md +8 -2
- package/docs/guide/database/mysql.md +14 -3
- package/docs/guide/database.md +1 -5
- package/docs/guide/durable-state.md +9 -5
- package/docs/guide/platform/installation/credentials.md +18 -2
- package/docs/guide/platform/installation/domains.md +1 -1
- package/docs/guide/platform/installation/maintenance.md +38 -1
- package/docs/guide/platform/installation/prerequisites.md +6 -2
- package/docs/guide/platform/installation/setup.md +23 -1
- package/docs/guide/platform/installation/uninstall.md +6 -1
- package/docs/guide/sandboxes.md +1 -1
- package/docs/guide/self-hosted-platform.md +1 -1
- package/docs/integrations/cloudflare.md +2 -2
- package/docs/integrations/frameworks/analog.md +3 -11
- package/docs/integrations/frameworks/nuxt.md +7 -10
- package/docs/integrations/nodejs-bun-deno.md +2 -0
- package/docs/reference/api.md +1 -0
- package/docs/reference/cli/platform-installation.md +18 -6
- package/docs/reference/config.md +2 -0
- package/package.json +34 -28
- package/sandbox.Dockerfile +1 -1
- package/skills/void/SKILL.md +1 -1
- package/dist/auth-wn6F8dB8.mjs +0 -2
- package/dist/cf-build-output-2u583yJK.mjs +0 -2
- package/dist/client-C1BjRn3g.mjs +0 -2
- package/dist/cloudflare-operations-Ds-lX3Ts.mjs +0 -2
- package/dist/collect-NUlJMpLY.mjs +0 -2
- package/dist/config-CNnrSMYm.mjs +0 -2
- package/dist/create-project-DL7YXpjj.mjs +0 -2
- package/dist/deploy-Db2ALnQP.mjs +0 -3
- package/dist/discover-CTUiSsfG.mjs +0 -2
- package/dist/dist-Bx1z6Eva.mjs +0 -2
- package/dist/env-validation-CTn-HhG1.mjs +0 -2
- package/dist/gen-F8pSZnhc.mjs +0 -2
- package/dist/generate-Rii9klHB.mjs +0 -2
- package/dist/help-s9q7LTcu.mjs +0 -2
- package/dist/login-DhK7o1oJ.mjs +0 -2
- package/dist/migrate-BgT-hmu8.mjs +0 -2
- package/dist/operator-cmd-Cjk5DiRx.mjs +0 -2
- package/dist/plan-CH2G51je.mjs +0 -2
- package/dist/platform-args-Cm7x-fot.mjs +0 -2
- package/dist/platform-cmd-Cuj4oUVo.mjs +0 -2
- package/dist/platform-lifecycle-_gfnjUBr.mjs +0 -2
- package/dist/platform-management-CYrLvTGH.mjs +0 -2
- package/dist/prepare-dr9uxQSV.mjs +0 -2
- package/dist/project-DiiOBZPF.mjs +0 -2
- package/dist/project-slug-DofjTFd-.mjs +0 -2
- package/dist/resolve-project-B9Hr0D3n.mjs +0 -2
- package/dist/runner-B5huK2eC.mjs +0 -2
- package/dist/runner-mysql-CCtyI0p6.mjs +0 -55
- package/dist/runner-mysql-CaJq-hd6.mjs +0 -2
- package/dist/runner-pg-BJhFZZG4.mjs +0 -2
- package/dist/validate-C9xtFOYR.mjs +0 -2
- package/dist/{sandbox-container-DBKIqDEK.mjs → sandbox-container-a9LRUtii.mjs} +1 -1
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { t as collectMigrations } from "./collect-xjffdCdk.mjs";
|
|
2
|
+
import { a as mySqlMigrationLockError, o as mySqlMigrationLockName, s as readMySqlMigrationLease, t as splitMySqlMigrationSql } from "./mysql-migration-sql-BIS5vbNk.mjs";
|
|
3
|
+
//#region src/migrations/runner-mysql.ts
|
|
4
|
+
async function readMySqlAppliedMigrations(client) {
|
|
5
|
+
try {
|
|
6
|
+
return (await client.query("SELECT `name` FROM `_void_migrations`")).map((row) => String(row.name));
|
|
7
|
+
} catch (error) {
|
|
8
|
+
const value = typeof error === "object" && error !== null ? error : void 0;
|
|
9
|
+
if (value?.code === "ER_NO_SUCH_TABLE" || value?.errno === 1146) return [];
|
|
10
|
+
throw error;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
function toMySqlClient(connection) {
|
|
14
|
+
return { async query(sql, params) {
|
|
15
|
+
const [rows] = await connection.query(sql, params);
|
|
16
|
+
return Array.isArray(rows) ? rows : [];
|
|
17
|
+
} };
|
|
18
|
+
}
|
|
19
|
+
async function getMySqlAppliedMigrations(url) {
|
|
20
|
+
const { createConnection } = await import("mysql2/promise");
|
|
21
|
+
const connection = await createConnection(url);
|
|
22
|
+
try {
|
|
23
|
+
return await readMySqlAppliedMigrations(toMySqlClient(connection));
|
|
24
|
+
} finally {
|
|
25
|
+
await connection.end();
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
const MIGRATION_LOCK_TIMEOUT_SECONDS = 10;
|
|
29
|
+
/**
|
|
30
|
+
* Take a named lock so two runs on one database cannot both apply a pending file. The lock
|
|
31
|
+
* survives the commits MySQL makes for DDL and ends with the session. A deploy cannot hold a
|
|
32
|
+
* session lock and writes a lease row instead, so this also waits for that lease.
|
|
33
|
+
*/
|
|
34
|
+
async function acquireMySqlMigrationLock(client) {
|
|
35
|
+
const [row] = await client.query("SELECT DATABASE() AS db");
|
|
36
|
+
const database = row?.db ?? "";
|
|
37
|
+
const name = mySqlMigrationLockName(database);
|
|
38
|
+
const [lock] = await client.query("SELECT GET_LOCK(?, ?) AS acquired", [name, MIGRATION_LOCK_TIMEOUT_SECONDS]);
|
|
39
|
+
if (Number(Object.values(lock ?? {})[0]) !== 1) throw mySqlMigrationLockError(database, "run the command again");
|
|
40
|
+
const readLease = () => readMySqlMigrationLease((sql, params) => client.query(sql, params));
|
|
41
|
+
const deadline = Date.now() + MIGRATION_LOCK_TIMEOUT_SECONDS * 1e3;
|
|
42
|
+
let remaining = await readLease();
|
|
43
|
+
while (remaining !== void 0 && Date.now() < deadline) {
|
|
44
|
+
await new Promise((resolve) => setTimeout(resolve, 1e3));
|
|
45
|
+
remaining = await readLease();
|
|
46
|
+
}
|
|
47
|
+
if (remaining !== void 0) {
|
|
48
|
+
await client.query("SELECT RELEASE_LOCK(?)", [name]).catch(() => {});
|
|
49
|
+
throw new Error(`A deploy is applying migrations to MySQL database "${database}". Wait for it to finish, then run the command again. If that deploy stopped, its lock expires in ${remaining} seconds.`);
|
|
50
|
+
}
|
|
51
|
+
return name;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* A DDL statement makes MySQL commit and close the open transaction. A savepoint can only be
|
|
55
|
+
* rolled back to inside a transaction, so this tells whether the file's changes can still be undone.
|
|
56
|
+
*/
|
|
57
|
+
async function isTransactionOpen(client) {
|
|
58
|
+
try {
|
|
59
|
+
await client.query("SAVEPOINT `void_migration`");
|
|
60
|
+
await client.query("ROLLBACK TO SAVEPOINT `void_migration`");
|
|
61
|
+
return true;
|
|
62
|
+
} catch {
|
|
63
|
+
return false;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
const ROLLED_BACK_BY_SERVER_ERRNOS = /* @__PURE__ */ new Set([1213, 3101]);
|
|
67
|
+
function isRolledBackByServer(error) {
|
|
68
|
+
const errno = typeof error === "object" && error !== null ? error.errno : void 0;
|
|
69
|
+
return typeof errno === "number" && ROLLED_BACK_BY_SERVER_ERRNOS.has(errno);
|
|
70
|
+
}
|
|
71
|
+
function mySqlMigrationError(name, error, committed) {
|
|
72
|
+
const lines = [`migration ${name} failed: ${error instanceof Error ? error.message : String(error)}`];
|
|
73
|
+
if (committed) lines.push(`MySQL commits schema changes immediately, so earlier statements in ${name} may already be applied. Undo them, fix the file, then run the command again.`, "See https://void.cloud/guide/database/mysql#failed-migrations");
|
|
74
|
+
return new Error(lines.join("\n"), { cause: error });
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Runs `work` while this session holds the database's migration lock, so no other migration run,
|
|
78
|
+
* deploy or reset changes the schema meanwhile.
|
|
79
|
+
*/
|
|
80
|
+
async function withMySqlMigrationLock(client, work) {
|
|
81
|
+
const lock = await acquireMySqlMigrationLock(client);
|
|
82
|
+
try {
|
|
83
|
+
return await work();
|
|
84
|
+
} finally {
|
|
85
|
+
await client.query("SELECT RELEASE_LOCK(?)", [lock]).catch(() => {});
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
async function applyMySqlMigrations(client, migrations) {
|
|
89
|
+
if (migrations.length === 0) return [];
|
|
90
|
+
return withMySqlMigrationLock(client, () => applyPendingMySqlMigrations(client, migrations));
|
|
91
|
+
}
|
|
92
|
+
/** Applies the files not yet recorded. The caller holds the migration lock. */
|
|
93
|
+
async function applyPendingMySqlMigrations(client, migrations) {
|
|
94
|
+
if (migrations.length === 0) return [];
|
|
95
|
+
await client.query("CREATE TABLE IF NOT EXISTS `_void_migrations` (`name` VARCHAR(255) PRIMARY KEY, `applied_at` VARCHAR(64) NOT NULL)");
|
|
96
|
+
const existing = await client.query("SELECT `name` FROM `_void_migrations`");
|
|
97
|
+
const appliedSet = new Set(existing.map((row) => String(row.name)));
|
|
98
|
+
const pending = migrations.filter((migration) => !appliedSet.has(migration.name));
|
|
99
|
+
for (const migration of pending) {
|
|
100
|
+
let ran = 0;
|
|
101
|
+
await client.query("BEGIN");
|
|
102
|
+
try {
|
|
103
|
+
for (const statement of splitMySqlMigrationSql(migration.sql)) {
|
|
104
|
+
await client.query(statement);
|
|
105
|
+
ran++;
|
|
106
|
+
}
|
|
107
|
+
await client.query("INSERT INTO `_void_migrations` (`name`, `applied_at`) VALUES (?, ?)", [migration.name, (/* @__PURE__ */ new Date()).toISOString()]);
|
|
108
|
+
await client.query("COMMIT");
|
|
109
|
+
} catch (error) {
|
|
110
|
+
const committed = ran > 0 && !isRolledBackByServer(error) && !await isTransactionOpen(client);
|
|
111
|
+
await client.query("ROLLBACK").catch(() => {});
|
|
112
|
+
throw mySqlMigrationError(migration.name, error, committed);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
return pending.map((migration) => migration.name);
|
|
116
|
+
}
|
|
117
|
+
/** Connects to `url` and runs `work` while holding that database's migration lock. */
|
|
118
|
+
async function withMySqlMigrationLockAt(url, work) {
|
|
119
|
+
const { createConnection } = await import("mysql2/promise");
|
|
120
|
+
const connection = await createConnection({
|
|
121
|
+
uri: url,
|
|
122
|
+
multipleStatements: true
|
|
123
|
+
});
|
|
124
|
+
try {
|
|
125
|
+
const client = toMySqlClient(connection);
|
|
126
|
+
return await withMySqlMigrationLock(client, () => work(client));
|
|
127
|
+
} finally {
|
|
128
|
+
await connection.end();
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Applies the pending files in `migrationsDir`. `afterApply` gets the applied names and runs before
|
|
133
|
+
* the lock is released, so the schema changes it makes (Better Auth's tables) do not overlap
|
|
134
|
+
* another run either.
|
|
135
|
+
*/
|
|
136
|
+
async function runMySqlMigrations(migrationsDir, url, afterApply) {
|
|
137
|
+
const migrations = collectMigrations(migrationsDir);
|
|
138
|
+
if (migrations.length === 0 && !afterApply) return [];
|
|
139
|
+
return withMySqlMigrationLockAt(url, async (client) => {
|
|
140
|
+
const applied = await applyPendingMySqlMigrations(client, migrations);
|
|
141
|
+
await afterApply?.(applied);
|
|
142
|
+
return applied;
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
//#endregion
|
|
146
|
+
export { runMySqlMigrations as a, withMySqlMigrationLockAt as c, readMySqlAppliedMigrations as i, applyPendingMySqlMigrations as n, toMySqlClient as o, getMySqlAppliedMigrations as r, withMySqlMigrationLock as s, applyMySqlMigrations as t };
|
|
@@ -0,0 +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-BhRaONkO.mjs";
|
|
@@ -36,8 +36,8 @@ async function applyPgMigrations(client, migrations) {
|
|
|
36
36
|
await client.query("INSERT INTO _void_migrations (name, applied_at) VALUES ($1, $2)", [m.name, (/* @__PURE__ */ new Date()).toISOString()]);
|
|
37
37
|
await client.query("COMMIT");
|
|
38
38
|
} catch (err) {
|
|
39
|
-
await client.query("ROLLBACK");
|
|
40
|
-
throw err;
|
|
39
|
+
await client.query("ROLLBACK").catch(() => {});
|
|
40
|
+
throw new Error(`migration ${m.name} failed: ${err instanceof Error ? err.message : String(err)}`, { cause: err });
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
return pending.map((m) => m.name);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { t as applyPgMigrations, n as getPgAppliedMigrations, r as readPgAppliedMigrations, i as runPgMigrations } from "./runner-pg-BRemq_GX.mjs";
|
package/dist/runtime/ai.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { n as bytesToBase64 } from "../base64-DVrOndmI.mjs";
|
|
2
2
|
import { t as cfAccessHeaders } from "../cf-access-BM9G0lhO.mjs";
|
|
3
|
-
import { a as getRawRuntimeEnv } from "../env-raw-
|
|
3
|
+
import { a as getRawRuntimeEnv } from "../env-raw-D74P4ebM.mjs";
|
|
4
4
|
import { r as limitFromResponse, t as UsageLimit } from "../limits-D0vD1M9A.mjs";
|
|
5
5
|
//#region src/runtime/ai-types.ts
|
|
6
6
|
/** Maps provider prefix to expected env var name for the API key */
|
|
@@ -293,7 +293,16 @@ async function providerRequestBody(provider, path, init, options, runtimeEnv) {
|
|
|
293
293
|
/** Backend for the Void platform proxy, reached by service binding or HTTPS. */
|
|
294
294
|
function makeProxyBackend(send, runtimeEnv) {
|
|
295
295
|
async function proxyFetch(action, payload, options = {}) {
|
|
296
|
-
|
|
296
|
+
let signal;
|
|
297
|
+
if (typeof payload.options === "object" && payload.options !== null) {
|
|
298
|
+
const { signal: bindingSignal, ...wireOptions } = payload.options;
|
|
299
|
+
signal = bindingSignal;
|
|
300
|
+
payload = {
|
|
301
|
+
...payload,
|
|
302
|
+
options: wireOptions
|
|
303
|
+
};
|
|
304
|
+
}
|
|
305
|
+
const res = await send(action, payload, signal);
|
|
297
306
|
const limit = await limitFromResponse(res, "ai");
|
|
298
307
|
if (limit) throw limit;
|
|
299
308
|
if (options.throwOnError !== false && !res.ok) {
|
|
@@ -334,8 +343,9 @@ function makeProxyBackend(send, runtimeEnv) {
|
|
|
334
343
|
};
|
|
335
344
|
}
|
|
336
345
|
function makeServiceBindingBackend(proxy, runtimeEnv) {
|
|
337
|
-
return makeProxyBackend((action, payload) => proxy.fetch(`https://ai-proxy/ai/${action}`, {
|
|
346
|
+
return makeProxyBackend((action, payload, signal) => proxy.fetch(`https://ai-proxy/ai/${action}`, {
|
|
338
347
|
method: "POST",
|
|
348
|
+
signal,
|
|
339
349
|
headers: { "content-type": "application/json" },
|
|
340
350
|
body: JSON.stringify({
|
|
341
351
|
action,
|
|
@@ -352,8 +362,9 @@ function makeHttpBackend(token, projectId, runtimeEnv) {
|
|
|
352
362
|
authorization: `Bearer ${token}`,
|
|
353
363
|
...cfAccessHeaders(runtimeEnv, base)
|
|
354
364
|
};
|
|
355
|
-
return makeProxyBackend((action, payload) => fetch(`${base}/${action}`, {
|
|
365
|
+
return makeProxyBackend((action, payload, signal) => fetch(`${base}/${action}`, {
|
|
356
366
|
method: "POST",
|
|
367
|
+
signal,
|
|
357
368
|
headers,
|
|
358
369
|
body: JSON.stringify({
|
|
359
370
|
action,
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { auth, createAuthClient };
|
|
1
|
+
export { t as auth, n as createAuthClient } from "../auth-client-react-CMLwT2xI.mjs";
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { auth, createAuthClient };
|
|
1
|
+
export { t as auth, n as createAuthClient } from "../auth-client-solid-UoreJWZG.mjs";
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { auth, createAuthClient };
|
|
1
|
+
export { t as auth, n as createAuthClient } from "../auth-client-svelte-Cv_WvrRk.mjs";
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { auth, createAuthClient };
|
|
1
|
+
export { t as auth, n as createAuthClient } from "../auth-client-vue-CFk7Xbv3.mjs";
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { auth, createAuthClient };
|
|
1
|
+
export { t as auth, n as createAuthClient } from "../auth-client-BWBT8HLp.mjs";
|
package/dist/runtime/auth.mjs
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { authContext, defineAuth, getSession, getUser, requireAuth };
|
|
1
|
+
export { t as authContext, n as defineAuth, r as getSession, i as getUser, a as requireAuth } from "../auth-3sGB0zJ1.mjs";
|
|
@@ -3,7 +3,10 @@ import { n as resolveConnectionString, t as createVoidAuthRuntime } from "../bet
|
|
|
3
3
|
//#region src/runtime/better-auth-mysql.ts
|
|
4
4
|
async function applyMigrations(env, migrationSchema) {
|
|
5
5
|
const { createConnection } = await import("mysql2/promise");
|
|
6
|
-
const connection = await createConnection(
|
|
6
|
+
const connection = await createConnection({
|
|
7
|
+
uri: resolveConnectionString(env, "MySQL"),
|
|
8
|
+
disableEval: true
|
|
9
|
+
});
|
|
7
10
|
try {
|
|
8
11
|
await applyMySqlAuthMigrations(mysqlMigrationRunner(connection), migrationSchema);
|
|
9
12
|
} finally {
|
package/dist/runtime/db.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as requireRuntimeBinding, r as getRuntimeRequestResource } from "../env-
|
|
1
|
+
import { a as requireRuntimeBinding, r as getRuntimeRequestResource, t as getRuntimeBinding } from "../env-0jrMQJI_.mjs";
|
|
2
2
|
import { drizzle } from "drizzle-orm/d1";
|
|
3
3
|
import { and, asc, avg, between, count, desc, eq, exists, gt, gte, ilike, inArray, isNotNull, isNull, like, lt, lte, max, min, ne, not, notBetween, notExists, notInArray, notLike, or, sql, sum } from "drizzle-orm";
|
|
4
4
|
//#region src/runtime/db.ts
|
|
@@ -20,13 +20,17 @@ function createPrimaryDb(d1) {
|
|
|
20
20
|
return drizzle(d1.withSession("first-primary"));
|
|
21
21
|
}
|
|
22
22
|
const requestDbKey = {};
|
|
23
|
+
function requireD1() {
|
|
24
|
+
if (getRuntimeBinding("DB") == null && (getRuntimeBinding("HYPERDRIVE") != null || getRuntimeBinding("DATABASE_URL") != null)) throw new Error("db: Missing Cloudflare binding 'DB'. This app connects through HYPERDRIVE or DATABASE_URL, but its server bundle loaded the D1 client. In Nuxt or Analog, add 'void/nitro' to the Nitro modules. An installed package that imports void/db must be an ES module that lists void in its dependencies or peerDependencies, and the app must list it or reach it through such packages.");
|
|
25
|
+
return requireRuntimeBinding("DB");
|
|
26
|
+
}
|
|
23
27
|
/**
|
|
24
28
|
* Default Drizzle D1 instance — resolves the `DB` binding from the runtime
|
|
25
29
|
* environment. When the Void plugin is active, this is replaced with a
|
|
26
30
|
* schema-aware instance via virtual module.
|
|
27
31
|
*/
|
|
28
32
|
const db = new Proxy({}, { get(_, prop) {
|
|
29
|
-
const instance = getRuntimeRequestResource(requestDbKey, () => createDb(
|
|
33
|
+
const instance = getRuntimeRequestResource(requestDbKey, () => createDb(requireD1()), () => createPrimaryDb(requireD1()));
|
|
30
34
|
return Reflect.get(instance, prop);
|
|
31
35
|
} });
|
|
32
36
|
//#endregion
|
|
@@ -62,4 +62,5 @@ export type DurableStateApi<TMethods> = {
|
|
|
62
62
|
getById(namespace: DurableObjectNamespace, id: DurableObjectId): TypedDurableObjectStub<TMethods>;
|
|
63
63
|
};
|
|
64
64
|
export declare function defineDurableState<TState, TEnv extends Record<string, unknown> = Record<string, unknown>, const TMethods extends DurableStateMethods<TState, TEnv> = DurableStateMethods<TState, TEnv>>(definition: DurableStateDefinition<TState, TEnv, TMethods>): DurableStateApi<TMethods>;
|
|
65
|
-
//#endregion
|
|
65
|
+
//#endregion
|
|
66
|
+
export {};
|
package/dist/runtime/durable.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as isResourceName } from "../resource-name-C7LVpcRm.mjs";
|
|
2
|
-
import { a as requireRuntimeBinding, o as withRuntimeEnv } from "../env-
|
|
2
|
+
import { a as requireRuntimeBinding, o as withRuntimeEnv } from "../env-0jrMQJI_.mjs";
|
|
3
3
|
import { DurableObject } from "cloudflare:workers";
|
|
4
4
|
//#region src/runtime/durable.ts
|
|
5
5
|
const DEFAULT_STORAGE_KEY = "__void_durable_state";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { o as normalizeEmail, r as buildMime } from "../../mime-srOklVVv.mjs";
|
|
2
2
|
import { n as compileEmailPattern, t as compareEmailRoutes } from "../../email-BcjSyAL0.mjs";
|
|
3
3
|
import { y as registerEmailSink } from "../../dev-inbox-Rd6j_8vM.mjs";
|
|
4
|
-
import { a as createMessageProxy, n as MAX_INBOUND_HEADERS, t as MAX_INBOUND_BYTES } from "../../inbound-
|
|
4
|
+
import { a as createMessageProxy, n as MAX_INBOUND_HEADERS, t as MAX_INBOUND_BYTES } from "../../inbound-BuTfm11U.mjs";
|
|
5
5
|
//#region src/runtime/email/testing.ts
|
|
6
6
|
/**
|
|
7
7
|
* Test harnesses for void/email.
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { EMAIL_PROTOCOL_VERSION, encodeEmailActions, readBoundedJson, readEmailEnvelope, verifyEmailReceiptThroughProxy, withTimeout };
|
|
1
|
+
export { t as EMAIL_PROTOCOL_VERSION, n as encodeEmailActions, r as readBoundedJson, i as readEmailEnvelope, a as verifyEmailReceiptThroughProxy, o as withTimeout } from "../email-protocol-D9nTvhCp.mjs";
|
package/dist/runtime/email.mjs
CHANGED
|
@@ -2,7 +2,7 @@ import { n as bytesToBase64 } from "../base64-DVrOndmI.mjs";
|
|
|
2
2
|
import { a as newId, n as MimeError, o as normalizeEmail, r as buildMime } from "../mime-srOklVVv.mjs";
|
|
3
3
|
import { a as DEV_INBOX_ENV_VAR, b as serializeCapturedMessage, c as DEV_INBOX_TOKEN_ENV_VAR, d as captureMessage, h as hasActiveSink, i as DEV_INBOX_CAPTURE_URL, p as dispatchToSinks } from "../dev-inbox-Rd6j_8vM.mjs";
|
|
4
4
|
import { o as withTimeout, r as readBoundedJson } from "../email-protocol-D9nTvhCp.mjs";
|
|
5
|
-
import { a as createMessageProxy, c as isForwardableEmailMessage, d as readProjectSlug, f as replyEmail, i as bytesToReadableStream, l as parseEmail, o as defineEmail, p as tryGetRawRuntimeEnv, r as ParseEmailError, s as enactEmailActions, u as readEnvString } from "../inbound-
|
|
5
|
+
import { a as createMessageProxy, c as isForwardableEmailMessage, d as readProjectSlug, f as replyEmail, i as bytesToReadableStream, l as parseEmail, o as defineEmail, p as tryGetRawRuntimeEnv, r as ParseEmailError, s as enactEmailActions, u as readEnvString } from "../inbound-BuTfm11U.mjs";
|
|
6
6
|
import { isRecord } from "@void/deploy-core";
|
|
7
7
|
//#region src/runtime/email.ts
|
|
8
8
|
function makeError(code, message, cause) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as getRawRuntimeEnv } from "../env-raw-
|
|
2
|
-
import { i as isInternalBinding, n as getRuntimeEnv } from "../env-
|
|
1
|
+
import { a as getRawRuntimeEnv } from "../env-raw-D74P4ebM.mjs";
|
|
2
|
+
import { i as isInternalBinding, n as getRuntimeEnv } from "../env-0jrMQJI_.mjs";
|
|
3
3
|
import { a as oneOf, i as number, n as email, o as string, r as json, s as url, t as boolean } from "../env-helpers--wFmQ_5Q.mjs";
|
|
4
4
|
//#region src/shared/env-mask.ts
|
|
5
5
|
/**
|
package/dist/runtime/env.mjs
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { getRuntimeBinding, getRuntimeEnv, getRuntimeRequestResource, isInternalBinding, requireRuntimeBinding, withRuntimeEnv };
|
|
1
|
+
export { t as getRuntimeBinding, n as getRuntimeEnv, r as getRuntimeRequestResource, i as isInternalBinding, a as requireRuntimeBinding, o as withRuntimeEnv } from "../env-0jrMQJI_.mjs";
|
package/dist/runtime/isr.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as getRawRuntimeEnv } from "../env-raw-
|
|
1
|
+
import { a as getRawRuntimeEnv } from "../env-raw-D74P4ebM.mjs";
|
|
2
2
|
import { isrEdgeCacheUrlForToken, splitIsrCacheKey } from "@void/isr";
|
|
3
3
|
import { denormalizeIsrPath, isrKey, isrPrefix, isrVariantPrefix, listIsrHosts } from "@void/isr/runtime";
|
|
4
4
|
//#region src/runtime/isr.ts
|
package/dist/runtime/kv.mjs
CHANGED
package/dist/runtime/limits.mjs
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { UsageLimit, asUsageLimit, limitFromResponse, readUsageLimit };
|
|
1
|
+
export { t as UsageLimit, n as asUsageLimit, r as limitFromResponse, i as readUsageLimit } from "../limits-D0vD1M9A.mjs";
|
|
@@ -29,4 +29,5 @@ type EventSourceConstructor = new (url: string, options?: {
|
|
|
29
29
|
withCredentials?: boolean;
|
|
30
30
|
}) => EventSourceLike;
|
|
31
31
|
export declare function connectLiveStream(url: string | URL, options?: ConnectLiveStreamOptions): LiveClient;
|
|
32
|
-
//#endregion
|
|
32
|
+
//#endregion
|
|
33
|
+
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as eventStream } from "../sse-CMvCgjNk.mjs";
|
|
2
|
-
import { a as connectionInstanceName, c as topicInstanceName, o as internalUrl, s as topicDigest, t as __getLiveBindingName } from "../live-
|
|
2
|
+
import { a as connectionInstanceName, c as topicInstanceName, o as internalUrl, s as topicDigest, t as __getLiveBindingName } from "../live-BcHoTDFe.mjs";
|
|
3
3
|
//#region src/runtime/live-server.ts
|
|
4
4
|
const GENERATION_KEY = "connection:generation";
|
|
5
5
|
const TOPIC_PRUNE_ALARM_DELAY_MS = 6e4;
|
package/dist/runtime/live.mjs
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { __getLiveBindingName, __setLiveBindingName, __setLiveDev, defineLiveStream };
|
|
1
|
+
export { t as __getLiveBindingName, n as __setLiveBindingName, r as __setLiveDev, i as defineLiveStream } from "../live-BcHoTDFe.mjs";
|
package/dist/runtime/log.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as
|
|
1
|
+
import { i as holdMySqlMigrationLease, n as splitMySqlMigrationStatements, r as acquireMySqlMigrationLease } from "../mysql-migration-sql-BIS5vbNk.mjs";
|
|
2
2
|
//#region src/runtime/migration-handler-mysql.ts
|
|
3
3
|
function createMigrationHandler(env, migrations, runAuthMigrations) {
|
|
4
4
|
return async (request) => {
|
|
@@ -9,9 +9,7 @@ function createMigrationHandler(env, migrations, runAuthMigrations) {
|
|
|
9
9
|
migrations: []
|
|
10
10
|
}, { status: 401 });
|
|
11
11
|
try {
|
|
12
|
-
|
|
13
|
-
if (result.ok && runAuthMigrations) await runAuthMigrations();
|
|
14
|
-
return Response.json(result);
|
|
12
|
+
return Response.json(await runMySqlMigrations(env, migrations, runAuthMigrations));
|
|
15
13
|
} catch (error) {
|
|
16
14
|
return Response.json({
|
|
17
15
|
ok: false,
|
|
@@ -21,7 +19,7 @@ function createMigrationHandler(env, migrations, runAuthMigrations) {
|
|
|
21
19
|
}
|
|
22
20
|
};
|
|
23
21
|
}
|
|
24
|
-
async function runMySqlMigrations(env, migrations) {
|
|
22
|
+
async function runMySqlMigrations(env, migrations, runAuthMigrations) {
|
|
25
23
|
const hyperdrive = env.HYPERDRIVE;
|
|
26
24
|
if (!hyperdrive?.connectionString) return {
|
|
27
25
|
ok: false,
|
|
@@ -31,9 +29,17 @@ async function runMySqlMigrations(env, migrations) {
|
|
|
31
29
|
const { createConnection } = await import("mysql2/promise");
|
|
32
30
|
const connection = await createConnection({
|
|
33
31
|
uri: hyperdrive.connectionString,
|
|
34
|
-
|
|
32
|
+
disableEval: true
|
|
35
33
|
});
|
|
34
|
+
let leaseConnection;
|
|
35
|
+
let lease;
|
|
36
36
|
try {
|
|
37
|
+
const leaseClient = await createConnection({
|
|
38
|
+
uri: hyperdrive.connectionString,
|
|
39
|
+
disableEval: true
|
|
40
|
+
});
|
|
41
|
+
leaseConnection = leaseClient;
|
|
42
|
+
lease = await acquireMySqlMigrationLease(async (sql, params) => (await leaseClient.query(sql, params))[0]);
|
|
37
43
|
await connection.query("CREATE TABLE IF NOT EXISTS `_void_migrations` (`name` VARCHAR(255) PRIMARY KEY, `applied_at` VARCHAR(64) NOT NULL)");
|
|
38
44
|
const [rows] = await connection.query("SELECT `name` FROM `_void_migrations`");
|
|
39
45
|
const applied = new Set(rows.map((row) => String(row.name)));
|
|
@@ -49,14 +55,23 @@ async function runMySqlMigrations(env, migrations) {
|
|
|
49
55
|
}
|
|
50
56
|
const start = Date.now();
|
|
51
57
|
try {
|
|
52
|
-
|
|
58
|
+
await connection.query("BEGIN");
|
|
59
|
+
for (const statement of splitMySqlMigrationStatements(migration.sql)) {
|
|
60
|
+
await lease.renew();
|
|
61
|
+
await connection.query(statement.sql).catch((error) => {
|
|
62
|
+
throw statement.program ? withBreakpointNote(error, migration.name) : error;
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
await lease.renew();
|
|
53
66
|
await connection.query("INSERT INTO `_void_migrations` (`name`, `applied_at`) VALUES (?, ?)", [migration.name, (/* @__PURE__ */ new Date()).toISOString()]);
|
|
67
|
+
await connection.query("COMMIT");
|
|
54
68
|
results.push({
|
|
55
69
|
name: migration.name,
|
|
56
70
|
applied: true,
|
|
57
71
|
durationMs: Date.now() - start
|
|
58
72
|
});
|
|
59
73
|
} catch (error) {
|
|
74
|
+
await connection.query("ROLLBACK").catch(() => {});
|
|
60
75
|
results.push({
|
|
61
76
|
name: migration.name,
|
|
62
77
|
applied: false,
|
|
@@ -70,13 +85,28 @@ async function runMySqlMigrations(env, migrations) {
|
|
|
70
85
|
};
|
|
71
86
|
}
|
|
72
87
|
}
|
|
88
|
+
if (runAuthMigrations) await holdMySqlMigrationLease(lease, runAuthMigrations);
|
|
73
89
|
return {
|
|
74
90
|
ok: true,
|
|
75
91
|
migrations: results
|
|
76
92
|
};
|
|
77
93
|
} finally {
|
|
78
|
-
await
|
|
94
|
+
await lease?.release().catch(() => {});
|
|
95
|
+
await Promise.all([connection.end(), leaseConnection?.end()]);
|
|
79
96
|
}
|
|
80
97
|
}
|
|
98
|
+
/**
|
|
99
|
+
* The splitter keeps the SQL after a trigger, routine or event with it. The CLI runs that with
|
|
100
|
+
* `multipleStatements`; here one query takes one statement, so the server rejects it as a syntax
|
|
101
|
+
* error before running any of it. MySQL reports 1064; Vitess (PlanetScale) reports "syntax error
|
|
102
|
+
* at position", or 1149 for several statements it can parse. A syntax error inside the body looks
|
|
103
|
+
* the same, so the note says "if".
|
|
104
|
+
*/
|
|
105
|
+
function withBreakpointNote(error, name) {
|
|
106
|
+
if (!(error instanceof Error)) return error;
|
|
107
|
+
const errno = error.errno;
|
|
108
|
+
if (errno !== 1064 && errno !== 1149 && !/syntax error at position/.test(error.message)) return error;
|
|
109
|
+
return new Error(`${error.message}\nThis deploy runs one statement per query. If ${name} has more SQL after a trigger, procedure, function or event, add a \`--> statement-breakpoint\` line after it.`, { cause: error });
|
|
110
|
+
}
|
|
81
111
|
//#endregion
|
|
82
112
|
export { createMigrationHandler };
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { createMigrationHandler, splitMigrationSql };
|
|
1
|
+
export { t as createMigrationHandler, n as splitMigrationSql } from "../migration-handler-Cg0Y4EPu.mjs";
|
package/dist/runtime/queues.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as requireRuntimeBinding } from "../env-
|
|
1
|
+
import { a as requireRuntimeBinding } from "../env-0jrMQJI_.mjs";
|
|
2
2
|
//#region src/runtime/queues.ts
|
|
3
3
|
/** Typed queue producers — resolves `QUEUE_*` bindings from the active runtime environment. */
|
|
4
4
|
const queues = new Proxy({}, { get(_, name) {
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { convertReturnValue, isConvertedResponse };
|
|
1
|
+
export { t as convertReturnValue, n as isConvertedResponse } from "../response-Tn7rU0MV.mjs";
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { interpolateRouteParams };
|
|
1
|
+
export { t as interpolateRouteParams } from "../route-url-BjGv_KKY.mjs";
|
|
@@ -174,4 +174,5 @@ export declare function createRoutingRuntime(app: Hono, options?: {
|
|
|
174
174
|
export declare function markNoMatch(request: Request, response: Response): Response;
|
|
175
175
|
export declare function createHttpRouteHandler(load: () => Promise<Record<string, (c: Context) => unknown>>, method: string): (c: Context) => Promise<Response>;
|
|
176
176
|
export declare function createModuleLoader<T>(load: () => Promise<T>, cache?: boolean): () => Promise<T>;
|
|
177
|
-
//#endregion
|
|
177
|
+
//#endregion
|
|
178
|
+
export {};
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { DEFAULT_SANDBOX_INACTIVITY_TIMEOUT_MS, SANDBOX_PORT_HEADER, SandboxContainer, validateSandboxOptions };
|
|
1
|
+
export { t as DEFAULT_SANDBOX_INACTIVITY_TIMEOUT_MS, n as SANDBOX_PORT_HEADER, r as SandboxContainer, i as validateSandboxOptions } from "../sandbox-container-a9LRUtii.mjs";
|
package/dist/runtime/sandbox.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { a as getRawRuntimeEnv } from "../env-raw-
|
|
1
|
+
import { a as getRawRuntimeEnv } from "../env-raw-D74P4ebM.mjs";
|
|
2
2
|
import { t as UsageLimit } from "../limits-D0vD1M9A.mjs";
|
|
3
|
-
import { a as requireRuntimeBinding } from "../env-
|
|
4
|
-
import { i as validateSandboxOptions, n as SANDBOX_PORT_HEADER, r as SandboxContainer } from "../sandbox-container-
|
|
3
|
+
import { a as requireRuntimeBinding } from "../env-0jrMQJI_.mjs";
|
|
4
|
+
import { i as validateSandboxOptions, n as SANDBOX_PORT_HEADER, r as SandboxContainer } from "../sandbox-container-a9LRUtii.mjs";
|
|
5
5
|
export * from "@cloudflare/sandbox";
|
|
6
6
|
//#region src/runtime/sandbox.ts
|
|
7
7
|
const DEFAULT_SANDBOX_ID = "default";
|
package/dist/runtime/seed.d.mts
CHANGED
|
@@ -32,4 +32,5 @@ type FallbackSeedContext<TSchema extends Record<string, unknown>> = SchemaHasSql
|
|
|
32
32
|
export type SeedContext<TSchema extends Record<string, unknown> = Record<string, never>> = (SchemaHasSqliteTables<TSchema> extends true ? SqliteSeedContext<TSchema> : never) | (SchemaHasPostgresTables<TSchema> extends true ? PostgresSeedContext<TSchema> : never) | (SchemaHasMySqlTables<TSchema> extends true ? MySqlSeedContext<TSchema> : never) | FallbackSeedContext<TSchema>;
|
|
33
33
|
export type SeedFn<TSchema extends Record<string, unknown> = Record<string, never>> = (context: SeedContext<TSchema>) => void | Promise<void>;
|
|
34
34
|
export declare function defineSeed<TSchema extends Record<string, unknown> = Record<string, never>>(seed: SeedFn<TSchema>): SeedFn<TSchema>;
|
|
35
|
-
//#endregion
|
|
35
|
+
//#endregion
|
|
36
|
+
export {};
|
package/dist/runtime/sse.mjs
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { SseStreamClosedError, eventStream, formatSse, formatSseText, getLastEventId };
|
|
1
|
+
export { t as SseStreamClosedError, n as eventStream, r as formatSse, i as formatSseText, a as getLastEventId } from "../sse-CMvCgjNk.mjs";
|
package/dist/runtime/storage.mjs
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { runValidation };
|
|
1
|
+
export { t as runValidation } from "../validator-BTOu0fB0.mjs";
|
|
@@ -24,4 +24,5 @@ export declare function createWebSocketDurableObject(definition: AnyWebSocketDef
|
|
|
24
24
|
/** Keep a removed WebSocket Durable Object class deployable without deleting its storage. */
|
|
25
25
|
export declare function createWebSocketTombstoneDurableObject(className: string): WebSocketDurableObjectClass;
|
|
26
26
|
export declare function forwardWebSocketRequest(request: Request, env: Record<string, unknown>, route: WebSocketRouteMeta): Promise<Response>;
|
|
27
|
-
//#endregion
|
|
27
|
+
//#endregion
|
|
28
|
+
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as authContext } from "../auth-3sGB0zJ1.mjs";
|
|
2
|
-
import { o as withRuntimeEnv } from "../env-
|
|
2
|
+
import { o as withRuntimeEnv } from "../env-0jrMQJI_.mjs";
|
|
3
3
|
//#region src/runtime/ws-server.ts
|
|
4
4
|
function matchRoute(pattern, pathname) {
|
|
5
5
|
const patternSegments = pattern.split("/").filter(Boolean);
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { n as readDeploymentPlatform, r as readProjectConfig } from "./project-rqDnVsJN.mjs";
|
|
2
2
|
import { c as getToken } from "./auth-B6iOCjKI.mjs";
|
|
3
|
-
import { A as confirm, H as outro, L as log, O as cancel, U as password, tt as isCancel } from "./dist-
|
|
4
|
-
import { m as printSuccess, o as formatCount, p as note } from "./output-
|
|
3
|
+
import { A as confirm, H as outro, L as log, O as cancel, U as password, tt as isCancel } from "./dist-BVdsO7Py.mjs";
|
|
4
|
+
import { m as printSuccess, o as formatCount, p as note } from "./output-Ba6ZbrzY.mjs";
|
|
5
5
|
import { r as PlatformClient } from "./client-DM9Kcf4e.mjs";
|
|
6
|
-
import { a as resolveProjectBySlug, t as getRequestedProjectSlug } from "./resolve-project-
|
|
7
|
-
import { _ as validateSecretValues } from "./env-validation-
|
|
6
|
+
import { a as resolveProjectBySlug, t as getRequestedProjectSlug } from "./resolve-project-WpwkCB_c.mjs";
|
|
7
|
+
import { _ as validateSecretValues } from "./env-validation-DYxjz_Wo.mjs";
|
|
8
8
|
import { readFileSync } from "node:fs";
|
|
9
9
|
//#region src/cli/secret.ts
|
|
10
10
|
async function runSecretCommand(root, args) {
|
|
@@ -93,7 +93,7 @@ async function resolveSecretBackend(root, args) {
|
|
|
93
93
|
}
|
|
94
94
|
async function resolveCloudflareSecretBackend(root, args) {
|
|
95
95
|
if (args.projectName) throw new Error("secret: --project selects a Void platform project and is not used for direct Cloudflare apps.");
|
|
96
|
-
const { deleteCloudflareSecret, listCloudflareSecrets, putCloudflareSecret, resolveCloudflareOperationContext, syncCloudflareSecrets } = await import("./cloudflare-operations-
|
|
96
|
+
const { deleteCloudflareSecret, listCloudflareSecrets, putCloudflareSecret, resolveCloudflareOperationContext, syncCloudflareSecrets } = await import("./cloudflare-operations-CrSUFRzJ.mjs");
|
|
97
97
|
const context = resolveCloudflareOperationContext(root);
|
|
98
98
|
return {
|
|
99
99
|
target: "Cloudflare Worker",
|